@ansible-flow/designer 0.0.0-stage → 0.86.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +9 -2
- package/THIRD_PARTY_NOTICES.md +41 -0
- package/dist/index.css +2 -0
- package/dist/index.d.ts +28 -0
- package/dist/index.js +201 -0
- package/dist/transport.d.ts +16 -0
- package/package.json +31 -4
package/dist/index.js
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
var xT=Object.create,yk=Object.defineProperty,wT=Object.getOwnPropertyDescriptor,kT=Object.getOwnPropertyNames,ST=Object.getPrototypeOf,vk=Object.prototype.hasOwnProperty,wn=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t,t.exports),e=null),t.exports),NT=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(var a=kT(t),s=0,l=a.length,f;s<l;s++)f=a[s],!vk.call(e,f)&&f!==n&&yk(e,f,{get:(p=>t[p]).bind(null,f),enumerable:!(r=wT(t,f))||r.enumerable});return e},bk=(e,t,n)=>(n=e==null?{}:xT(ST(e)),NT(t||!e||!e.__esModule||!vk.call(e,"default")?yk(n,"default",{value:e,enumerable:!0}):n,e)),jT=wn((e=>{function t(L,U){var W=L.length;L.push(U);e:for(;0<W;){var re=W-1>>>1,le=L[re];if(0<a(le,U))L[re]=U,L[W]=le,W=re;else break e}}function n(L){return L.length===0?null:L[0]}function r(L){if(L.length===0)return null;var U=L[0],W=L.pop();if(W!==U){L[0]=W;e:for(var re=0,le=L.length,pe=le>>>1;re<pe;){var xe=2*(re+1)-1,Ne=L[xe],we=xe+1,R=L[we];if(0>a(Ne,W))we<le&&0>a(R,Ne)?(L[re]=R,L[we]=W,re=we):(L[re]=Ne,L[xe]=W,re=xe);else if(we<le&&0>a(R,W))L[re]=R,L[we]=W,re=we;else break e}}return U}function a(L,U){var W=L.sortIndex-U.sortIndex;return W===0?L.id-U.id:W}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var s=performance;e.unstable_now=function(){return s.now()}}else{var l=Date,f=l.now();e.unstable_now=function(){return l.now()-f}}var p=[],h=[],v=1,g=null,m=3,b=!1,w=!1,k=!1,S=!1,N=typeof setTimeout=="function"?setTimeout:null,$=typeof clearTimeout=="function"?clearTimeout:null,j=typeof setImmediate<"u"?setImmediate:null;function E(L){for(var U=n(h);U!==null;){if(U.callback===null)r(h);else if(U.startTime<=L)r(h),U.sortIndex=U.expirationTime,t(p,U);else break;U=n(h)}}function I(L){if(k=!1,E(L),!w)if(n(p)!==null)w=!0,z||(z=!0,V());else{var U=n(h);U!==null&&J(I,U.startTime-L)}}var z=!1,T=-1,M=5,O=-1;function K(){return S?!0:!(e.unstable_now()-O<M)}function B(){if(S=!1,z){var L=e.unstable_now();O=L;var U=!0;try{e:{w=!1,k&&(k=!1,$(T),T=-1),b=!0;var W=m;try{t:{for(E(L),g=n(p);g!==null&&!(g.expirationTime>L&&K());){var re=g.callback;if(typeof re=="function"){g.callback=null,m=g.priorityLevel;var le=re(g.expirationTime<=L);if(L=e.unstable_now(),typeof le=="function"){g.callback=le,E(L),U=!0;break t}g===n(p)&&r(p),E(L)}else r(p);g=n(p)}if(g!==null)U=!0;else{var pe=n(h);pe!==null&&J(I,pe.startTime-L),U=!1}}break e}finally{g=null,m=W,b=!1}U=void 0}}finally{U?V():z=!1}}}var V;if(typeof j=="function")V=function(){j(B)};else if(typeof MessageChannel<"u"){var oe=new MessageChannel,F=oe.port2;oe.port1.onmessage=B,V=function(){F.postMessage(null)}}else V=function(){N(B,0)};function J(L,U){T=N(function(){L(e.unstable_now())},U)}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(L){L.callback=null},e.unstable_forceFrameRate=function(L){0>L||125<L?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):M=0<L?Math.floor(1e3/L):5},e.unstable_getCurrentPriorityLevel=function(){return m},e.unstable_next=function(L){switch(m){case 1:case 2:case 3:var U=3;break;default:U=m}var W=m;m=U;try{return L()}finally{m=W}},e.unstable_requestPaint=function(){S=!0},e.unstable_runWithPriority=function(L,U){switch(L){case 1:case 2:case 3:case 4:case 5:break;default:L=3}var W=m;m=L;try{return U()}finally{m=W}},e.unstable_scheduleCallback=function(L,U,W){var re=e.unstable_now();switch(typeof W=="object"&&W?(W=W.delay,W=typeof W=="number"&&0<W?re+W:re):W=re,L){case 1:var le=-1;break;case 2:le=250;break;case 5:le=1073741823;break;case 4:le=1e4;break;default:le=5e3}return le=W+le,L={id:v++,callback:U,priorityLevel:L,startTime:W,expirationTime:le,sortIndex:-1},W>re?(L.sortIndex=W,t(h,L),n(p)===null&&L===n(h)&&(k?($(T),T=-1):k=!0,J(I,W-re))):(L.sortIndex=le,t(p,L),w||b||(w=!0,z||(z=!0,V()))),L},e.unstable_shouldYield=K,e.unstable_wrapCallback=function(L){var U=m;return function(){var W=m;m=U;try{return L.apply(this,arguments)}finally{m=W}}}})),CT=wn(((e,t)=>{t.exports=jT()})),$T=wn((e=>{var t=Symbol.for("react.transitional.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),l=Symbol.for("react.consumer"),f=Symbol.for("react.context"),p=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),v=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),m=Symbol.for("react.activity"),b=Symbol.for("react.view_transition"),w=Symbol.iterator;function k(R){return typeof R!="object"||!R?null:(R=w&&R[w]||R["@@iterator"],typeof R=="function"?R:null)}var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},N=Object.assign,$={};function j(R,Q,fe){this.props=R,this.context=Q,this.refs=$,this.updater=fe||S}j.prototype.isReactComponent={},j.prototype.setState=function(R,Q){if(typeof R!="object"&&typeof R!="function"&&R!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,R,Q,"setState")},j.prototype.forceUpdate=function(R){this.updater.enqueueForceUpdate(this,R,"forceUpdate")};function E(){}E.prototype=j.prototype;function I(R,Q,fe){this.props=R,this.context=Q,this.refs=$,this.updater=fe||S}var z=I.prototype=new E;z.constructor=I,N(z,j.prototype),z.isPureReactComponent=!0;var T=Array.isArray;function M(){}var O={H:null,A:null,T:null,S:null},K=Object.prototype.hasOwnProperty;function B(R,Q,fe){var X=fe.ref;return{$$typeof:t,type:R,key:Q,ref:X===void 0?null:X,props:fe}}function V(R,Q){return B(R.type,Q,R.props)}function oe(R){return typeof R=="object"&&!!R&&R.$$typeof===t}function F(R){var Q={"=":"=0",":":"=2"};return"$"+R.replace(/[=:]/g,function(fe){return Q[fe]})}var J=/\/+/g;function L(R,Q){return typeof R=="object"&&R&&R.key!=null?F(""+R.key):Q.toString(36)}function U(R){switch(R.status){case"fulfilled":return R.value;case"rejected":throw R.reason;default:switch(typeof R.status=="string"?R.then(M,M):(R.status="pending",R.then(function(Q){R.status==="pending"&&(R.status="fulfilled",R.value=Q)},function(Q){R.status==="pending"&&(R.status="rejected",R.reason=Q)})),R.status){case"fulfilled":return R.value;case"rejected":throw R.reason}}throw R}function W(R,Q,fe,X,he){var Z=typeof R;(Z==="undefined"||Z==="boolean")&&(R=null);var q=!1;if(R===null)q=!0;else switch(Z){case"bigint":case"string":case"number":q=!0;break;case"object":switch(R.$$typeof){case t:case n:q=!0;break;case g:return q=R._init,W(q(R._payload),Q,fe,X,he)}}if(q)return he=he(R),q=X===""?"."+L(R,0):X,T(he)?(fe="",q!=null&&(fe=q.replace(J,"$&/")+"/"),W(he,Q,fe,"",function(me){return me})):he!=null&&(oe(he)&&(he=V(he,fe+(he.key==null||R&&R.key===he.key?"":(""+he.key).replace(J,"$&/")+"/")+q)),Q.push(he)),1;q=0;var ee=X===""?".":X+":";if(T(R))for(var de=0;de<R.length;de++)X=R[de],Z=ee+L(X,de),q+=W(X,Q,fe,Z,he);else if(de=k(R),typeof de=="function")for(R=de.call(R),de=0;!(X=R.next()).done;)X=X.value,Z=ee+L(X,de++),q+=W(X,Q,fe,Z,he);else if(Z==="object"){if(typeof R.then=="function")return W(U(R),Q,fe,X,he);throw Q=String(R),Error("Objects are not valid as a React child (found: "+(Q==="[object Object]"?"object with keys {"+Object.keys(R).join(", ")+"}":Q)+"). If you meant to render a collection of children, use an array instead.")}return q}function re(R,Q,fe){if(R==null)return R;var X=[],he=0;return W(R,X,"","",function(Z){return Q.call(fe,Z,he++)}),X}function le(R){if(R._status===-1){var Q=R._result,fe=Q();fe.then(function(X){(R._status===0||R._status===-1)&&(R._status=1,R._result=X,fe.status===void 0&&(fe.status="fulfilled",fe.value=X))},function(X){(R._status===0||R._status===-1)&&(R._status=2,R._result=X,fe.status===void 0&&(fe.status="rejected",fe.reason=X))}),R._status===-1&&(R._status=0,R._result=fe)}if(R._status===1)return R._result.default;throw R._result}var pe=typeof reportError=="function"?reportError:function(R){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var Q=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof R=="object"&&R&&typeof R.message=="string"?String(R.message):String(R),error:R});if(!window.dispatchEvent(Q))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",R);return}console.error(R)};function xe(R){var Q=O.T,fe={};fe.types=Q===null?null:Q.types,O.T=fe;try{var X=R(),he=O.S;he!==null&&he(fe,X),typeof X=="object"&&X&&typeof X.then=="function"&&X.then(M,pe)}catch(Z){pe(Z)}finally{Q!==null&&fe.types!==null&&(Q.types=fe.types),O.T=Q}}function Ne(R){var Q=O.T;if(Q!==null){var fe=Q.types;fe===null?Q.types=[R]:fe.indexOf(R)===-1&&fe.push(R)}else xe(Ne.bind(null,R))}var we={map:re,forEach:function(R,Q,fe){re(R,function(){Q.apply(this,arguments)},fe)},count:function(R){var Q=0;return re(R,function(){Q++}),Q},toArray:function(R){return re(R,function(Q){return Q})||[]},only:function(R){if(!oe(R))throw Error("React.Children.only expected to receive a single React element child.");return R}};e.Activity=m,e.Children=we,e.Component=j,e.Fragment=r,e.Profiler=s,e.PureComponent=I,e.StrictMode=a,e.Suspense=h,e.ViewTransition=b,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=O,e.__COMPILER_RUNTIME={__proto__:null,c:function(R){return O.H.useMemoCache(R)}},e.addTransitionType=Ne,e.cache=function(R){return function(){return R.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(R,Q,fe){if(R==null)throw Error("The argument must be a React element, but you passed "+R+".");var X=N({},R.props),he=R.key;if(Q!=null)for(Z in Q.key!==void 0&&(he=""+Q.key),Q)!K.call(Q,Z)||Z==="key"||Z==="__self"||Z==="__source"||Z==="ref"&&Q.ref===void 0||(X[Z]=Q[Z]);var Z=arguments.length-2;if(Z===1)X.children=fe;else if(1<Z){for(var q=Array(Z),ee=0;ee<Z;ee++)q[ee]=arguments[ee+2];X.children=q}return B(R.type,he,X)},e.createContext=function(R){return R={$$typeof:f,_currentValue:R,_currentValue2:R,_threadCount:0,Provider:null,Consumer:null},R.Provider=R,R.Consumer={$$typeof:l,_context:R},R},e.createElement=function(R,Q,fe){var X,he={},Z=null;if(Q!=null)for(X in Q.key!==void 0&&(Z=""+Q.key),Q)K.call(Q,X)&&X!=="key"&&X!=="__self"&&X!=="__source"&&(he[X]=Q[X]);var q=arguments.length-2;if(q===1)he.children=fe;else if(1<q){for(var ee=Array(q),de=0;de<q;de++)ee[de]=arguments[de+2];he.children=ee}if(R&&R.defaultProps)for(X in q=R.defaultProps,q)he[X]===void 0&&(he[X]=q[X]);return B(R,Z,he)},e.createRef=function(){return{current:null}},e.forwardRef=function(R){return{$$typeof:p,render:R}},e.isValidElement=oe,e.lazy=function(R){return{$$typeof:g,_payload:{_status:-1,_result:R},_init:le}},e.memo=function(R,Q){return{$$typeof:v,type:R,compare:Q===void 0?null:Q}},e.startTransition=xe,e.unstable_useCacheRefresh=function(){return O.H.useCacheRefresh()},e.use=function(R){return O.H.use(R)},e.useActionState=function(R,Q,fe){return O.H.useActionState(R,Q,fe)},e.useCallback=function(R,Q){return O.H.useCallback(R,Q)},e.useContext=function(R){return O.H.useContext(R)},e.useDebugValue=function(){},e.useDeferredValue=function(R,Q){return O.H.useDeferredValue(R,Q)},e.useEffect=function(R,Q){return O.H.useEffect(R,Q)},e.useEffectEvent=function(R){return O.H.useEffectEvent(R)},e.useId=function(){return O.H.useId()},e.useImperativeHandle=function(R,Q,fe){return O.H.useImperativeHandle(R,Q,fe)},e.useInsertionEffect=function(R,Q){return O.H.useInsertionEffect(R,Q)},e.useLayoutEffect=function(R,Q){return O.H.useLayoutEffect(R,Q)},e.useMemo=function(R,Q){return O.H.useMemo(R,Q)},e.useOptimistic=function(R,Q){return O.H.useOptimistic(R,Q)},e.useReducer=function(R,Q,fe){return O.H.useReducer(R,Q,fe)},e.useRef=function(R){return O.H.useRef(R)},e.useState=function(R){return O.H.useState(R)},e.useSyncExternalStore=function(R,Q,fe){return O.H.useSyncExternalStore(R,Q,fe)},e.useTransition=function(){return O.H.useTransition()},e.version="19.3.1"})),ed=wn(((e,t)=>{t.exports=$T()})),ET=wn((e=>{var t=ed();function n(g){var m="https://react.dev/errors/"+g;if(1<arguments.length){m+="?args[]="+encodeURIComponent(arguments[1]);for(var b=2;b<arguments.length;b++)m+="&args[]="+encodeURIComponent(arguments[b])}return"Minified React error #"+g+"; visit "+m+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(){}var a={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},s=Symbol.for("react.portal"),l=Symbol.for("react.recoverable"),f=Symbol.for("react.optimistic_key");function p(g,m,b){var w=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:s,key:w==null?null:w===f?f:""+w,children:g,containerInfo:m,implementation:b}}var h=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function v(g,m){if(g==="font")return"";if(typeof m=="string")return m==="use-credentials"?m:""}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,e.browser=function(g){return{$$typeof:l,_reason:g}},e.createPortal=function(g,m){var b=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!m||m.nodeType!==1&&m.nodeType!==9&&m.nodeType!==11)throw Error(n(299));return p(g,m,null,b)},e.flushSync=function(g){var m=h.T,b=a.p;try{if(h.T=null,a.p=2,g)return g()}finally{h.T=m,a.p=b,a.d.f()}},e.preconnect=function(g,m){typeof g=="string"&&(m?(m=m.crossOrigin,m=typeof m=="string"?m==="use-credentials"?m:"":void 0):m=null,a.d.C(g,m))},e.prefetchDNS=function(g){typeof g=="string"&&a.d.D(g)},e.preinit=function(g,m){if(typeof g=="string"&&m&&typeof m.as=="string"){var b=m.as,w=v(b,m.crossOrigin),k=typeof m.integrity=="string"?m.integrity:void 0,S=typeof m.fetchPriority=="string"?m.fetchPriority:void 0;b==="style"?a.d.S(g,typeof m.precedence=="string"?m.precedence:void 0,{crossOrigin:w,integrity:k,fetchPriority:S}):b==="script"&&a.d.X(g,{crossOrigin:w,integrity:k,fetchPriority:S,nonce:typeof m.nonce=="string"?m.nonce:void 0})}},e.preinitModule=function(g,m){if(typeof g=="string")if(typeof m=="object"&&m){if(m.as==null||m.as==="script"){var b=v(m.as,m.crossOrigin);a.d.M(g,{crossOrigin:b,integrity:typeof m.integrity=="string"?m.integrity:void 0,nonce:typeof m.nonce=="string"?m.nonce:void 0,fetchPriority:typeof m.fetchPriority=="string"?m.fetchPriority:void 0})}}else m??a.d.M(g)},e.preload=function(g,m){if(typeof g=="string"&&typeof m=="object"&&m&&typeof m.as=="string"){var b=m.as,w=v(b,m.crossOrigin);a.d.L(g,b,{crossOrigin:w,integrity:typeof m.integrity=="string"?m.integrity:void 0,nonce:typeof m.nonce=="string"?m.nonce:void 0,type:typeof m.type=="string"?m.type:void 0,fetchPriority:typeof m.fetchPriority=="string"?m.fetchPriority:void 0,referrerPolicy:typeof m.referrerPolicy=="string"?m.referrerPolicy:void 0,imageSrcSet:typeof m.imageSrcSet=="string"?m.imageSrcSet:void 0,imageSizes:typeof m.imageSizes=="string"?m.imageSizes:void 0,media:typeof m.media=="string"?m.media:void 0})}},e.preloadModule=function(g,m){if(typeof g=="string")if(m){var b=v(m.as,m.crossOrigin);a.d.m(g,{as:typeof m.as=="string"&&m.as!=="script"?m.as:void 0,crossOrigin:b,integrity:typeof m.integrity=="string"?m.integrity:void 0,nonce:typeof m.nonce=="string"?m.nonce:void 0,fetchPriority:typeof m.fetchPriority=="string"?m.fetchPriority:void 0})}else a.d.m(g)},e.requestFormReset=function(g){a.d.r(g)},e.unstable_batchedUpdates=function(g,m){return g(m)},e.useFormState=function(g,m,b){return h.H.useFormState(g,m,b)},e.useFormStatus=function(){return h.H.useHostTransitionStatus()},e.version="19.3.1"})),xk=wn(((e,t)=>{function n(){if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE=="function")try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(r){console.error(r)}}n(),t.exports=ET()})),_T=wn((e=>{var t=CT(),n=ed(),r=xk();function a(o){var i="https://react.dev/errors/"+o;if(1<arguments.length){i+="?args[]="+encodeURIComponent(arguments[1]);for(var d=2;d<arguments.length;d++)i+="&args[]="+encodeURIComponent(arguments[d])}return"Minified React error #"+o+"; visit "+i+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(o){return!(!o||o.nodeType!==1&&o.nodeType!==9&&o.nodeType!==11)}function l(o){for(var i=o,d=i;d&&!d.alternate;)i=d,i.flags&4098&&(o=i.return),d=i.return;for(;i.return;)i=i.return;return i.tag===3?o:null}function f(o){if(o.tag===13){var i=o.memoizedState;if(i===null&&(o=o.alternate,o!==null&&(i=o.memoizedState)),i!==null)return i.dehydrated}return null}function p(o){if(o.tag===31){var i=o.memoizedState;if(i===null&&(o=o.alternate,o!==null&&(i=o.memoizedState)),i!==null)return i.dehydrated}return null}function h(o){if(l(o)!==o)throw Error(a(188))}function v(o){var i=o.alternate;if(!i){if(i=l(o),i===null)throw Error(a(188));return i===o?o:null}for(var d=o,u=i;;){var y=d.return;if(y===null)break;var x=y.alternate;if(x===null){if(u=y.return,u!==null){d=u;continue}break}if(y.child===x.child){for(x=y.child;x;){if(x===d)return h(y),o;if(x===u)return h(y),i;x=x.sibling}throw Error(a(188))}if(d.return!==u.return)d=y,u=x;else{for(var C=!1,P=y.child;P;){if(P===d){C=!0,d=y,u=x;break}if(P===u){C=!0,u=y,d=x;break}P=P.sibling}if(!C){for(P=x.child;P;){if(P===d){C=!0,d=x,u=y;break}if(P===u){C=!0,u=x,d=y;break}P=P.sibling}if(!C)throw Error(a(189))}}if(d.alternate!==u)throw Error(a(190))}if(d.tag!==3)throw Error(a(188));return d.stateNode.current===d?o:i}function g(o){var i=o.tag;if(i===5||i===26||i===27||i===6)return o;for(o=o.child;o!==null;){if(i=g(o),i!==null)return i;o=o.sibling}return null}function m(o,i,d,u,y,x){for(;o!==null;){if((o.tag===5||o.tag===27||o.tag===6)&&d(o,u,y,x)||(o.tag!==22||o.memoizedState===null)&&(i||o.tag!==5&&o.tag!==27)&&m(o.child,i,d,u,y,x))return!0;o=o.sibling}return!1}function b(o){for(o=o.return;o!==null;){if(o.tag===3||o.tag===5||o.tag===27)return o;o=o.return}return null}function w(o){var i=!1;for(o=o.return;o!==null&&(o.tag===4&&(i=!0),o.tag!==3&&o.tag!==5&&o.tag!==27);)o=o.return;return i}function k(o){var i=[null,null],d=b(o);return d===null||S(i,o,d.child,{foundSelf:!1}),i}function S(o,i,d,u){for(;d!==null;){if(d===i)u.foundSelf=!0;else if(d.tag===5||d.tag===27||d.tag===6){if(u.foundSelf)return o[1]=d,!0;o[0]=d}else if((d.tag!==22||d.memoizedState===null)&&S(o,i,d.child,u))return!0;d=d.sibling}return!1}function N(o){switch(o.tag){case 5:case 27:case 6:return o.stateNode;case 3:return o.stateNode.containerInfo;default:throw Error(a(559))}}var $=null,j=null;function E(o,i,d){return o===d||o===i&&($=o,!0)}function I(o,i,d){return o===d?(j=o,!1):o===i&&(j!==null&&($=o),!0)}function z(o){if(o===null)return null;do o=o===null?null:o.return;while(o&&o.tag!==5&&o.tag!==27&&o.tag!==3);return o||null}function T(o,i,d){for(var u=0,y=o;y;y=d(y))u++;y=0;for(var x=i;x;x=d(x))y++;for(;0<u-y;)o=d(o),u--;for(;0<y-u;)i=d(i),y--;for(;u--;){if(o===i||i!==null&&o===i.alternate)return o;o=d(o),i=d(i)}return null}var M=Object.assign,O=Symbol.for("react.element"),K=Symbol.for("react.transitional.element"),B=Symbol.for("react.portal"),V=Symbol.for("react.fragment"),oe=Symbol.for("react.strict_mode"),F=Symbol.for("react.profiler"),J=Symbol.for("react.consumer"),L=Symbol.for("react.context"),U=Symbol.for("react.forward_ref"),W=Symbol.for("react.suspense"),re=Symbol.for("react.suspense_list"),le=Symbol.for("react.memo"),pe=Symbol.for("react.lazy"),xe=Symbol.for("react.activity"),Ne=Symbol.for("react.legacy_hidden"),we=Symbol.for("react.memo_cache_sentinel"),R=Symbol.for("react.view_transition"),Q=Symbol.for("react.recoverable"),fe=Symbol.iterator;function X(o){return typeof o!="object"||!o?null:(o=fe&&o[fe]||o["@@iterator"],typeof o=="function"?o:null)}var he=Symbol.for("react.client.reference");function Z(o){if(o==null)return null;if(typeof o=="function")return o.$$typeof===he?null:o.displayName||o.name||null;if(typeof o=="string")return o;switch(o){case V:return"Fragment";case F:return"Profiler";case oe:return"StrictMode";case W:return"Suspense";case re:return"SuspenseList";case xe:return"Activity";case R:return"ViewTransition"}if(typeof o=="object")switch(o.$$typeof){case B:return"Portal";case L:return o.displayName||"Context";case J:return(o._context.displayName||"Context")+".Consumer";case U:var i=o.render;return o=o.displayName,o||=(o=i.displayName||i.name||"",o===""?"ForwardRef":"ForwardRef("+o+")"),o;case le:return i=o.displayName||null,i===null?Z(o.type)||"Memo":i;case pe:i=o._payload,o=o._init;try{return Z(o(i))}catch{}}return null}var q=Array.isArray,ee=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,de=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,me={pending:!1,data:null,method:null,action:null},De=[],Fe=-1;function Ye(o){return{current:o}}function Le(o){0>Fe||(o.current=De[Fe],De[Fe]=null,Fe--)}function Be(o,i){Fe++,De[Fe]=o.current,o.current=i}var ut=Ye(null),kt=Ye(null),It=Ye(null),zt=Ye(null);function hn(o,i){switch(Be(It,i),Be(kt,o),Be(ut,null),i.nodeType){case 9:case 11:o=(o=i.documentElement)&&(o=o.namespaceURI)?Ew(o):0;break;default:if(o=i.tagName,i=i.namespaceURI)i=Ew(i),o=_w(i,o);else switch(o){case"svg":o=1;break;case"math":o=2;break;default:o=0}}Le(ut),Be(ut,o)}function Ft(){Le(ut),Le(kt),Le(It)}function Bt(o){var i=o.memoizedState;i!==null&&(gs._currentValue=i.memoizedState,Be(zt,o)),i=ut.current;var d=_w(i,o.type);i!==d&&(Be(kt,o),Be(ut,d))}function nn(o){kt.current===o&&(Le(ut),Le(kt)),zt.current===o&&(Le(zt),gs._currentValue=me)}var pn,bt;function mn(o){if(pn===void 0)try{throw Error()}catch(d){var i=d.stack.trim().match(/\n( *(at )?)/);pn=i&&i[1]||"",bt=-1<d.stack.indexOf(`
|
|
2
|
+
at`)?" (<anonymous>)":-1<d.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
3
|
+
`+pn+o+bt}var Uo=!1;function $r(o,i){if(!o||Uo)return"";Uo=!0;var d=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var u={DetermineComponentFrameRoot:function(){try{if(i){var ye=function(){throw Error()};if(Object.defineProperty(ye.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ye,[])}catch(Se){var te=Se}Reflect.construct(o,[],ye)}else{try{ye.call()}catch(Se){te=Se}ye=!1;try{var ue=Object.getOwnPropertyDescriptor(o.prototype,"props");Object.defineProperty(o.prototype,"props",{configurable:!0,set:function(){throw Error()}}),ye=!0,new o}finally{ye&&(ue===void 0?delete o.prototype.props:Object.defineProperty(o.prototype,"props",ue))}}}else{try{throw Error()}catch(Se){te=Se}(ye=o())&&typeof ye.catch=="function"&&ye.catch(function(){})}}catch(Se){if(Se&&te&&typeof Se.stack=="string")return[Se.stack,te.stack]}return[null,null]}};u.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var y=Object.getOwnPropertyDescriptor(u.DetermineComponentFrameRoot,"name");y&&y.configurable&&Object.defineProperty(u.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var x=u.DetermineComponentFrameRoot(),C=x[0],P=x[1];if(C&&P){var H=C.split(`
|
|
4
|
+
`),ie=P.split(`
|
|
5
|
+
`);for(y=u=0;u<H.length&&!H[u].includes("DetermineComponentFrameRoot");)u++;for(;y<ie.length&&!ie[y].includes("DetermineComponentFrameRoot");)y++;if(u===H.length||y===ie.length)for(u=H.length-1,y=ie.length-1;1<=u&&0<=y&&H[u]!==ie[y];)y--;for(;1<=u&&0<=y;u--,y--)if(H[u]!==ie[y]){if(u!==1||y!==1)do if(u--,y--,0>y||H[u]!==ie[y]){var ce=`
|
|
6
|
+
`+H[u].replace(" at new "," at ");return o.displayName&&ce.includes("<anonymous>")&&(ce=ce.replace("<anonymous>",o.displayName)),ce}while(1<=u&&0<=y);break}}}finally{Uo=!1,Error.prepareStackTrace=d}return(d=o?o.displayName||o.name:"")?mn(d):""}function ja(o,i){switch(o.tag){case 26:case 27:case 5:return mn(o.type);case 16:return mn("Lazy");case 13:return o.child!==i&&i!==null?mn("Suspense Fallback"):mn("Suspense");case 19:return mn("SuspenseList");case 0:case 15:return $r(o.type,!1);case 11:return $r(o.type.render,!1);case 1:return $r(o.type,!0);case 31:return mn("Activity");case 30:return mn("ViewTransition");default:return""}}function Er(o){try{var i="",d=null;do i+=ja(o,d),d=o,o=o.return;while(o);return i}catch(u){return`
|
|
7
|
+
Error generating stack: `+u.message+`
|
|
8
|
+
`+u.stack}}var rn=Object.prototype.hasOwnProperty,Yo=t.unstable_scheduleCallback,Sn=t.unstable_cancelCallback,Ca=t.unstable_shouldYield,dl=t.unstable_requestPaint,Xt=t.unstable_now,$a=t.unstable_getCurrentPriorityLevel,_r=t.unstable_ImmediatePriority,Ni=t.unstable_UserBlockingPriority,Xo=t.unstable_NormalPriority,Ea=t.unstable_LowPriority,_a=t.unstable_IdlePriority,ul=t.log,ji=t.unstable_setDisableYieldValue,Dn=null,jt=null;function In(o){if(typeof ul=="function"&&ji(o),jt&&typeof jt.setStrictMode=="function")try{jt.setStrictMode(Dn,o)}catch{}}var qt=Math.clz32?Math.clz32:cl,Aa=Math.log,Ci=Math.LN2;function cl(o){return o>>>=0,o===0?32:31-(Aa(o)/Ci|0)|0}var Ar=256,bo=262144,Tr=4194304;function Qn(o){var i=o&42;if(i!==0)return i;switch(o&-o){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:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return o&-o;case 262144:case 524288:case 1048576:case 2097152:return o&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return o&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return o}}function Mr(o,i,d){var u=o.pendingLanes;if(u===0)return 0;var y=0,x=o.suspendedLanes,C=o.pingedLanes;o=o.warmLanes;var P=u&134217727;return P===0?(P=u&~x,P===0?C===0?d||(d=u&~o,d!==0&&(y=Qn(d))):y=Qn(C):y=Qn(P)):(u=P&~x,u===0?(C&=P,C===0?d||(d=P&~o,d!==0&&(y=Qn(d))):y=Qn(C)):y=Qn(u)),y===0?0:i!==0&&i!==y&&(i&x)===0&&(x=y&-y,d=i&-i,x>=d||x===32&&d&4194048)?i:y}function Zt(o,i){return(o.pendingLanes&~(o.suspendedLanes&~o.pingedLanes)&i)===0}function $i(o,i){i&8&&(i|=i&32);var d=o.entangledLanes;if(d!==0)for(o=o.entanglements,d&=i;0<d;){var u=31-qt(d),y=1<<u;i|=o[u],d&=~y}return i}function Or(o,i){switch(o){case 1:case 2:case 4:case 8:case 64:return i+250;case 16:case 32: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 i+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Ei(){var o=Tr;return Tr<<=1,!(Tr&62914560)&&(Tr=4194304),o}function Pr(o){for(var i=[],d=0;31>d;d++)i.push(o);return i}function Zo(o,i){o.pendingLanes|=i,i!==268435456&&(o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0)}function Ta(o,i,d,u,y,x){var C=o.pendingLanes;o.pendingLanes=d,o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0,o.expiredLanes&=d,o.entangledLanes&=d,o.errorRecoveryDisabledLanes&=d,o.shellSuspendCounter=0;var P=o.entanglements,H=o.expirationTimes,ie=o.hiddenUpdates;for(d=C&~d;0<d;){var ce=31-qt(d),ye=1<<ce;P[ce]=0,H[ce]=-1;var te=ie[ce];if(te!==null)for(ie[ce]=null,ce=0;ce<te.length;ce++){var ue=te[ce];ue!==null&&(ue.lane&=-536870913)}d&=~ye}u!==0&&Go(o,u,0),x!==0&&y===0&&o.tag!==0&&(o.suspendedLanes|=x&~(C&~i))}function Go(o,i,d){o.pendingLanes|=i,o.suspendedLanes&=~i;var u=31-qt(i);o.entangledLanes|=i,o.entanglements[u]=o.entanglements[u]|1073741824|d&261930}function _i(o,i){var d=o.entangledLanes|=i;for(o=o.entanglements;d;){var u=31-qt(d),y=1<<u;y&i|o[u]&i&&(o[u]|=i),d&=~y}}function Dr(o,i){var d=i&-i;return d=d&42?1:Ma(d),(d&(o.suspendedLanes|i))===0?d:0}function Ma(o){switch(o){case 2:o=1;break;case 8:o=4;break;case 32:o=16;break;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:o=128;break;case 268435456:o=134217728;break;default:o=0}return o}function D(o){return o&=-o,2<o?8<o?o&134217727?32:268435456:8:2}function G(){var o=de.p;return o===0?(o=window.event,o===void 0?32:ck(o.type)):o}function ve(o,i){var d=de.p;try{return de.p=o,i()}finally{de.p=d}}var be=Math.random().toString(36).slice(2),ke="__reactFiber$"+be,Te="__reactProps$"+be,Xe="__reactContainer$"+be,Re="__reactEvents$"+be,Ue="__reactListeners$"+be,mt="__reactHandles$"+be,ze="__reactResources$"+be,Ht="__reactMarker$"+be,xt="__reactLoad$"+be;function xo(o){delete o[ke],delete o[Te],delete o[Ue],delete o[mt]}function Qo(o){var i;if(i=o[ke])return i;for(var d=o.parentNode;d;){if(i=d[Xe]||d[ke]){if(d=i.alternate,i.child!==null||d!==null&&d.child!==null)for(o=Uw(o);o!==null;){if(d=o[ke])return d;o=Uw(o)}return i}o=d,d=o.parentNode}return null}function Ir(o){if(o=o[ke]||o[Xe]){var i=o.tag;if(i===5||i===6||i===13||i===31||i===26||i===27||i===3)return o}return null}function Lr(o){var i=o.tag;if(i===5||i===26||i===27||i===6)return o.stateNode;throw Error(a(33))}function Rr(o){var i=o[ze];return i||=o[ze]={hoistableStyles:new Map,hoistableScripts:new Map},i}function Ct(o){o[Ht]=!0}function cu(o){o[xt]=void 0}var fu=new Set,Oa={};function Jo(o,i){zr(o,i),zr(o+"Capture",i)}function zr(o,i){for(Oa[o]=i,o=0;o<i.length;o++)fu.add(i[o])}var hu=RegExp("^[: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]*$"),pv={},mv={};function U_(o){return rn.call(mv,o)?!0:rn.call(pv,o)?!1:hu.test(o)?mv[o]=!0:(pv[o]=!0,!1)}var tt=!1;function gv(){var o=tt;return tt=!1,o}function pu(o,i,d){if(U_(i))if(d===null)o.removeAttribute(i);else{switch(typeof d){case"undefined":case"function":case"symbol":o.removeAttribute(i);return;case"boolean":var u=i.toLowerCase().slice(0,5);if(u!=="data-"&&u!=="aria-"){o.removeAttribute(i);return}}o.setAttribute(i,d)}}function mu(o,i,d){if(d===null)o.removeAttribute(i);else{switch(typeof d){case"undefined":case"function":case"symbol":case"boolean":o.removeAttribute(i);return}o.setAttribute(i,d)}}function er(o,i,d,u){if(u===null)o.removeAttribute(d);else{switch(typeof u){case"undefined":case"function":case"symbol":case"boolean":o.removeAttribute(d);return}o.setAttributeNS(i,d,u)}}function Nn(o){switch(typeof o){case"bigint":case"boolean":case"number":case"string":case"undefined":return o;case"object":return o;default:return""}}function yv(o){var i=o.type;return(o=o.nodeName)&&o.toLowerCase()==="input"&&(i==="checkbox"||i==="radio")}function Y_(o,i,d){var u=Object.getOwnPropertyDescriptor(o.constructor.prototype,i);if(!o.hasOwnProperty(i)&&u!==void 0&&typeof u.get=="function"&&typeof u.set=="function"){var y=u.get,x=u.set;return Object.defineProperty(o,i,{configurable:!0,get:function(){return y.call(this)},set:function(C){d=""+C,x.call(this,C)}}),Object.defineProperty(o,i,{enumerable:u.enumerable}),{getValue:function(){return d},setValue:function(C){d=""+C},stopTracking:function(){o._valueTracker=null,delete o[i]}}}}function Oh(o){if(!o._valueTracker){var i=yv(o)?"checked":"value";o._valueTracker=Y_(o,i,""+o[i])}}function vv(o){if(!o)return!1;var i=o._valueTracker;if(!i)return!0;var d=i.getValue(),u="";return o&&(u=yv(o)?o.checked?"true":"false":o.value),o=u,o!==d&&(i.setValue(o),!0)}var X_=/[\n"\\]/g;function Jn(o){return o.replace(X_,function(i){return"\\"+i.charCodeAt(0).toString(16)+" "})}function Ph(o,i,d,u,y,x,C,P){o.name="",C!=null&&typeof C!="function"&&typeof C!="symbol"&&typeof C!="boolean"?o.type=C:o.removeAttribute("type"),i==null?C!=="submit"&&C!=="reset"||o.removeAttribute("value"):C==="number"?(i===0&&o.value===""||o.value!=i)&&(o.value=""+Nn(i)):o.value!==""+Nn(i)&&(o.value=""+Nn(i)),i==null?d==null?u!=null&&o.removeAttribute("value"):Dh(o,Nn(d)):C==="number"&&o.value==i?Dh(o,Nn(o.value)):Dh(o,Nn(i)),y==null&&x!=null&&(o.defaultChecked=!!x),y!=null&&(o.checked=y&&typeof y!="function"&&typeof y!="symbol"),P!=null&&typeof P!="function"&&typeof P!="symbol"&&typeof P!="boolean"?o.name=""+Nn(P):o.removeAttribute("name")}function bv(o,i,d,u,y,x,C,P){if(x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(o.type=x),i!=null||d!=null){if(!(x!=="submit"&&x!=="reset"||i!=null)){Oh(o);return}d=d==null?"":""+Nn(d),i=i==null?d:""+Nn(i),P||i===o.value||(o.value=i),o.defaultValue=i}u??=y,u=typeof u!="function"&&typeof u!="symbol"&&!!u,o.checked=P?o.checked:!!u,o.defaultChecked=!!u,C!=null&&typeof C!="function"&&typeof C!="symbol"&&typeof C!="boolean"&&(o.name=C),Oh(o)}function Dh(o,i){o.defaultValue!==""+i&&(o.defaultValue=""+i)}function Pa(o,i,d,u){if(o=o.options,i){i={};for(var y=0;y<d.length;y++)i["$"+d[y]]=!0;for(d=0;d<o.length;d++)y=i.hasOwnProperty("$"+o[d].value),o[d].selected!==y&&(o[d].selected=y),y&&u&&(o[d].defaultSelected=!0)}else{for(d=""+Nn(d),i=null,y=0;y<o.length;y++){if(o[y].value===d){o[y].selected=!0,u&&(o[y].defaultSelected=!0);return}i!==null||o[y].disabled||(i=o[y])}i!==null&&(i.selected=!0)}}function xv(o,i,d){i!=null&&(i=""+Nn(i),i!==o.value&&(o.value=i),d==null)?o.defaultValue!==i&&(o.defaultValue=i):o.defaultValue=d==null?"":""+Nn(d)}function wv(o,i,d,u){if(i==null){if(u!=null){if(d!=null)throw Error(a(92));if(q(u)){if(1<u.length)throw Error(a(93));u=u[0]}d=u}d??="",i=d}d=Nn(i),o.defaultValue=d,u=o.textContent,u===d&&u!==""&&u!==null&&(o.value=u),Oh(o)}function Da(o,i){if(i){var d=o.firstChild;if(d&&d===o.lastChild&&d.nodeType===3){d.nodeValue=i;return}}o.textContent=i}var Z_=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function kv(o,i,d){var u=i.indexOf("--")===0;d==null||typeof d=="boolean"||d===""?u?o.setProperty(i,""):i==="float"?o.cssFloat="":o[i]="":u?o.setProperty(i,d):typeof d!="number"||d===0||Z_.has(i)?i==="float"?o.cssFloat=d:o[i]=(""+d).trim():o[i]=d+"px"}function Sv(o,i,d){if(i!=null&&typeof i!="object")throw Error(a(62));if(o=o.style,d!=null){for(var u in d)!d.hasOwnProperty(u)||i!=null&&i.hasOwnProperty(u)||(u.indexOf("--")===0?o.setProperty(u,""):u==="float"?o.cssFloat="":o[u]="",tt=!0);for(var y in i)u=i[y],i.hasOwnProperty(y)&&d[y]!==u&&(kv(o,y,u),tt=!0)}else for(var x in i)i.hasOwnProperty(x)&&kv(o,x,i[x])}function Ih(o){if(o.indexOf("-")===-1)return!1;switch(o){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 G_=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["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"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["maskType","mask-type"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["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"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["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"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),Q_=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function gu(o){return Q_.test(""+o)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":o}function wo(){}var Lh=null;function Rh(o){return o=o.target||o.srcElement||window,o.correspondingUseElement&&(o=o.correspondingUseElement),o.nodeType===3?o.parentNode:o}var Ia=null,La=null;function Nv(o){var i=Ir(o);if(i&&(o=i.stateNode)){var d=o[Te]||null;e:switch(o=i.stateNode,i.type){case"input":if(Ph(o,d.value,d.defaultValue,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name),i=d.name,d.type==="radio"&&i!=null){for(d=o;d.parentNode;)d=d.parentNode;for(d=d.querySelectorAll('input[name="'+Jn(""+i)+'"][type="radio"]'),i=0;i<d.length;i++){var u=d[i];if(u!==o&&u.form===o.form){var y=u[Te]||null;if(!y)throw Error(a(90));Ph(u,y.value,y.defaultValue,y.defaultValue,y.checked,y.defaultChecked,y.type,y.name)}}for(i=0;i<d.length;i++)u=d[i],u.form===o.form&&vv(u)}break e;case"textarea":xv(o,d.value,d.defaultValue);break e;case"select":i=d.value,i!=null&&Pa(o,!!d.multiple,i,!1)}}}var zh=!1;function jv(o,i,d){if(zh)return o(i,d);zh=!0;try{return o(i)}finally{if(zh=!1,(Ia!==null||La!==null)&&(gc(),Ia&&(i=Ia,o=La,La=Ia=null,Nv(i),o)))for(i=0;i<o.length;i++)Nv(o[i])}}function fl(o,i){var d=o.stateNode;if(d===null)return null;var u=d[Te]||null;if(u===null)return null;d=u[i];e:switch(i){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(u=!u.disabled)||(o=o.type,u=o!=="button"&&o!=="input"&&o!=="select"&&o!=="textarea"),o=!u;break e;default:o=!1}if(o)return null;if(d&&typeof d!="function")throw Error(a(231,i,typeof d));return d}var tr=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,Fh=!1;if(tr)try{var hl={};Object.defineProperty(hl,"passive",{get:function(){Fh=!0}}),window.addEventListener("test",hl,hl),window.removeEventListener("test",hl,hl)}catch{Fh=!1}var Fr=null,Bh=null,yu=null;function Cv(){if(yu)return yu;var o,i=Bh,d=i.length,u,y="value"in Fr?Fr.value:Fr.textContent,x=y.length;for(o=0;o<d&&i[o]===y[o];o++);var C=d-o;for(u=1;u<=C&&i[d-u]===y[x-u];u++);return yu=y.slice(o,1<u?1-u:void 0)}function vu(o){var i=o.keyCode;return"charCode"in o?(o=o.charCode,o===0&&i===13&&(o=13)):o=i,o===10&&(o=13),32<=o||o===13?o:0}function bu(){return!0}function $v(){return!1}function an(o){function i(d,u,y,x,C){for(var P in this._reactName=d,this._targetInst=y,this.type=u,this.nativeEvent=x,this.target=C,this.currentTarget=null,o)o.hasOwnProperty(P)&&(d=o[P],this[P]=d?d(x):x[P]);return this.isDefaultPrevented=(x.defaultPrevented==null?x.returnValue===!1:x.defaultPrevented)?bu:$v,this.isPropagationStopped=$v,this}return M(i.prototype,{preventDefault:function(){this.defaultPrevented=!0;var d=this.nativeEvent;d&&(d.preventDefault?d.preventDefault():typeof d.returnValue!="unknown"&&(d.returnValue=!1),this.isDefaultPrevented=bu)},stopPropagation:function(){var d=this.nativeEvent;d&&(d.stopPropagation?d.stopPropagation():typeof d.cancelBubble!="unknown"&&(d.cancelBubble=!0),this.isPropagationStopped=bu)},persist:function(){},isPersistent:bu}),i}var Br={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(o){return o.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},xu=an(Br),pl=M({},Br,{view:0,detail:0}),J_=an(pl),qh,Hh,ml,wu=M({},pl,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Kh,button:0,buttons:0,relatedTarget:function(o){return o.relatedTarget===void 0?o.fromElement===o.srcElement?o.toElement:o.fromElement:o.relatedTarget},movementX:function(o){return"movementX"in o?o.movementX:(o!==ml&&(ml&&o.type==="mousemove"?(qh=o.screenX-ml.screenX,Hh=o.screenY-ml.screenY):Hh=qh=0,ml=o),qh)},movementY:function(o){return"movementY"in o?o.movementY:Hh}}),Ev=an(wu),e2=an(M({},wu,{dataTransfer:0})),Vh=an(M({},pl,{relatedTarget:0})),t2=an(M({},Br,{animationName:0,elapsedTime:0,pseudoElement:0})),n2=an(M({},Br,{clipboardData:function(o){return"clipboardData"in o?o.clipboardData:window.clipboardData}})),_v=an(M({},Br,{data:0})),o2={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},r2={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"},i2={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function a2(o){var i=this.nativeEvent;return i.getModifierState?i.getModifierState(o):(o=i2[o])?!!i[o]:!1}function Kh(){return a2}var s2=an(M({},pl,{key:function(o){if(o.key){var i=o2[o.key]||o.key;if(i!=="Unidentified")return i}return o.type==="keypress"?(o=vu(o),o===13?"Enter":String.fromCharCode(o)):o.type==="keydown"||o.type==="keyup"?r2[o.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Kh,charCode:function(o){return o.type==="keypress"?vu(o):0},keyCode:function(o){return o.type==="keydown"||o.type==="keyup"?o.keyCode:0},which:function(o){return o.type==="keypress"?vu(o):o.type==="keydown"||o.type==="keyup"?o.keyCode:0}})),Av=an(M({},wu,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),l2=an(M({},Br,{submitter:0})),d2=an(M({},pl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Kh})),u2=an(M({},Br,{propertyName:0,elapsedTime:0,pseudoElement:0})),c2=an(M({},wu,{deltaX:function(o){return"deltaX"in o?o.deltaX:"wheelDeltaX"in o?-o.wheelDeltaX:0},deltaY:function(o){return"deltaY"in o?o.deltaY:"wheelDeltaY"in o?-o.wheelDeltaY:"wheelDelta"in o?-o.wheelDelta:0},deltaZ:0,deltaMode:0})),f2=an(M({},Br,{newState:0,oldState:0,source:0})),h2=[9,13,27,32],Wh=tr&&"CompositionEvent"in window,gl=null;tr&&"documentMode"in document&&(gl=document.documentMode);var p2=tr&&"TextEvent"in window&&!gl,Tv=tr&&(!Wh||gl&&8<gl&&11>=gl),Mv=" ",Ov=!1;function Pv(o,i){switch(o){case"keyup":return h2.indexOf(i.keyCode)!==-1;case"keydown":return i.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Dv(o){return o=o.detail,typeof o=="object"&&"data"in o?o.data:null}var Ra=!1;function m2(o,i){switch(o){case"compositionend":return Dv(i);case"keypress":return i.which===32?(Ov=!0,Mv):null;case"textInput":return o=i.data,o===Mv&&Ov?null:o;default:return null}}function g2(o,i){if(Ra)return o==="compositionend"||!Wh&&Pv(o,i)?(o=Cv(),yu=Bh=Fr=null,Ra=!1,o):null;switch(o){case"paste":return null;case"keypress":if(!(i.ctrlKey||i.altKey||i.metaKey)||i.ctrlKey&&i.altKey){if(i.char&&1<i.char.length)return i.char;if(i.which)return String.fromCharCode(i.which)}return null;case"compositionend":return Tv&&i.locale!=="ko"?null:i.data;default:return null}}var y2={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 Iv(o){var i=o&&o.nodeName&&o.nodeName.toLowerCase();return i==="input"?!!y2[o.type]:i==="textarea"}function Lv(o,i,d,u){Ia?La?La.push(u):La=[u]:Ia=u,i=kc(i,"onChange"),0<i.length&&(d=new xu("onChange","change",null,d,u),o.push({event:d,listeners:i}))}var yl=null,vl=null;function v2(o){ww(o,0)}function ku(o){if(vv(Lr(o)))return o}function Rv(o,i){if(o==="change")return i}var zv=!1;if(tr){var Uh;if(tr){var Yh="oninput"in document;if(!Yh){var Fv=document.createElement("div");Fv.setAttribute("oninput","return;"),Yh=typeof Fv.oninput=="function"}Uh=Yh}else Uh=!1;zv=Uh&&(!document.documentMode||9<document.documentMode)}function Bv(){yl&&(yl.detachEvent("onpropertychange",qv),vl=yl=null)}function qv(o){if(o.propertyName==="value"&&ku(vl)){var i=[];Lv(i,vl,o,Rh(o)),jv(v2,i)}}function b2(o,i,d){o==="focusin"?(Bv(),yl=i,vl=d,yl.attachEvent("onpropertychange",qv)):o==="focusout"&&Bv()}function x2(o){if(o==="selectionchange"||o==="keyup"||o==="keydown")return ku(vl)}function w2(o,i){if(o==="click")return ku(i)}function k2(o,i){if(o==="input"||o==="change")return ku(i)}function S2(o,i){return o===i&&(o!==0||1/o==1/i)||o!==o&&i!==i}var jn=typeof Object.is=="function"?Object.is:S2;function bl(o,i){if(jn(o,i))return!0;if(typeof o!="object"||!o||typeof i!="object"||!i)return!1;var d=Object.keys(o),u=Object.keys(i);if(d.length!==u.length)return!1;for(u=0;u<d.length;u++){var y=d[u];if(!rn.call(i,y)||!jn(o[y],i[y]))return!1}return!0}function Xh(o){if(o||=typeof document<"u"?document:void 0,o===void 0)return null;try{return o.activeElement||o.body}catch{return o.body}}function Hv(o){for(;o&&o.firstChild;)o=o.firstChild;return o}function Vv(o,i){var d=Hv(o);o=0;for(var u;d;){if(d.nodeType===3){if(u=o+d.textContent.length,o<=i&&u>=i)return{node:d,offset:i-o};o=u}e:{for(;d;){if(d.nextSibling){d=d.nextSibling;break e}d=d.parentNode}d=void 0}d=Hv(d)}}function Kv(o,i){return o&&i?o===i?!0:o&&o.nodeType===3?!1:i&&i.nodeType===3?Kv(o,i.parentNode):"contains"in o?o.contains(i):o.compareDocumentPosition?!!(o.compareDocumentPosition(i)&16):!1:!1}function Wv(o){o=o!=null&&o.ownerDocument!=null&&o.ownerDocument.defaultView!=null?o.ownerDocument.defaultView:window;for(var i=Xh(o.document);i instanceof o.HTMLIFrameElement;){try{var d=typeof i.contentWindow.location.href=="string"}catch{d=!1}if(d)o=i.contentWindow;else break;i=Xh(o.document)}return i}function Zh(o){var i=o&&o.nodeName&&o.nodeName.toLowerCase();return i&&(i==="input"&&(o.type==="text"||o.type==="search"||o.type==="tel"||o.type==="url"||o.type==="password")||i==="textarea"||o.contentEditable==="true")}var N2=tr&&"documentMode"in document&&11>=document.documentMode,za=null,Gh=null,xl=null,Qh=!1;function Uv(o,i,d){var u=d.window===d?d.document:d.nodeType===9?d:d.ownerDocument;Qh||za==null||za!==Xh(u)||(u=za,"selectionStart"in u&&Zh(u)?u={start:u.selectionStart,end:u.selectionEnd}:(u=(u.ownerDocument&&u.ownerDocument.defaultView||window).getSelection(),u={anchorNode:u.anchorNode,anchorOffset:u.anchorOffset,focusNode:u.focusNode,focusOffset:u.focusOffset}),xl&&bl(xl,u)||(xl=u,u=kc(Gh,"onSelect"),0<u.length&&(i=new xu("onSelect","select",null,i,d),o.push({event:i,listeners:u}),i.target=za)))}function Ai(o,i){var d={};return d[o.toLowerCase()]=i.toLowerCase(),d["Webkit"+o]="webkit"+i,d["Moz"+o]="moz"+i,d}var Fa={animationend:Ai("Animation","AnimationEnd"),animationiteration:Ai("Animation","AnimationIteration"),animationstart:Ai("Animation","AnimationStart"),transitionrun:Ai("Transition","TransitionRun"),transitionstart:Ai("Transition","TransitionStart"),transitioncancel:Ai("Transition","TransitionCancel"),transitionend:Ai("Transition","TransitionEnd")},Jh={},Yv={};tr&&(Yv=document.createElement("div").style,"AnimationEvent"in window||(delete Fa.animationend.animation,delete Fa.animationiteration.animation,delete Fa.animationstart.animation),"TransitionEvent"in window||delete Fa.transitionend.transition);function Ti(o){if(Jh[o])return Jh[o];if(!Fa[o])return o;var i=Fa[o],d;for(d in i)if(i.hasOwnProperty(d)&&d in Yv)return Jh[o]=i[d];return o}var Xv=Ti("animationend"),Zv=Ti("animationiteration"),Gv=Ti("animationstart"),j2=Ti("transitionrun"),C2=Ti("transitionstart"),$2=Ti("transitioncancel"),Qv=Ti("transitionend"),Jv=new Map,ep="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error fullscreenChange fullscreenError 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(" ");ep.push("scrollEnd");function eo(o,i){Jv.set(o,i),Jo(i,[o])}var E2=0;function nr(o,i){if(o.name!=null&&o.name!=="auto")return o.name;if(i.autoName!==null)return i.autoName;o=ro.identifierPrefix;var d=E2++;return o="_"+o+"t_"+d.toString(32)+"_",i.autoName=o}function eb(o){if(o==null||typeof o=="string")return o;var i=null,d=as;if(d!==null)for(var u=0;u<d.length;u++){var y=o[d[u]];if(y!=null){if(y==="none")return"none";i=i==null?y:i+(" "+y)}}return i??o.default}function or(o,i){return o=eb(o),i=eb(i),i==null?o==="auto"?null:o:i==="auto"?null:i}var Su=typeof reportError=="function"?reportError:function(o){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var i=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof o=="object"&&o&&typeof o.message=="string"?String(o.message):String(o),error:o});if(!window.dispatchEvent(i))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",o);return}console.error(o)},Ln=[],Ba=0,tp=0;function Nu(){for(var o=Ba,i=tp=Ba=0;i<o;){var d=Ln[i];Ln[i++]=null;var u=Ln[i];Ln[i++]=null;var y=Ln[i];Ln[i++]=null;var x=Ln[i];if(Ln[i++]=null,u!==null&&y!==null){var C=u.pending;C===null?y.next=y:(y.next=C.next,C.next=y),u.pending=y}x!==0&&tb(d,y,x)}}function ju(o,i,d,u){Ln[Ba++]=o,Ln[Ba++]=i,Ln[Ba++]=d,Ln[Ba++]=u,tp|=u,o.lanes|=u,o=o.alternate,o!==null&&(o.lanes|=u)}function np(o,i,d,u){return ju(o,i,d,u),Cu(o)}function Mi(o,i){return ju(o,null,null,i),Cu(o)}function tb(o,i,d){o.lanes|=d;var u=o.alternate;u!==null&&(u.lanes|=d);for(var y=!1,x=o.return;x!==null;)x.childLanes|=d,u=x.alternate,u!==null&&(u.childLanes|=d),x.tag===22&&(o=x.stateNode,o===null||o._visibility&1||(y=!0)),o=x,x=x.return;return o.tag===3?(x=o.stateNode,y&&i!==null&&(y=31-qt(d),o=x.hiddenUpdates,u=o[y],u===null?o[y]=[i]:u.push(i),i.lane=d|536870912),x):null}function Cu(o){if(50<ql)throw ql=0,mc=null,Error(a(185));for(var i=o.return;i!==null;)o=i,i=o.return;return o.tag===3?o.stateNode:null}var qa={};function _2(o,i,d,u){this.tag=o,this.key=d,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=i,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=u,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function gn(o,i,d,u){return new _2(o,i,d,u)}function op(o){return o=o.prototype,!(!o||!o.isReactComponent)}function rr(o,i){var d=o.alternate;return d===null?(d=gn(o.tag,i,o.key,o.mode),d.elementType=o.elementType,d.type=o.type,d.stateNode=o.stateNode,d.alternate=o,o.alternate=d):(d.pendingProps=i,d.type=o.type,d.flags=0,d.subtreeFlags=0,d.deletions=null),d.flags=o.flags&1206910976,d.childLanes=o.childLanes,d.lanes=o.lanes,d.child=o.child,d.memoizedProps=o.memoizedProps,d.memoizedState=o.memoizedState,d.updateQueue=o.updateQueue,i=o.dependencies,d.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext},d.sibling=o.sibling,d.index=o.index,d.ref=o.ref,d.refCleanup=o.refCleanup,d}function nb(o,i){o.flags&=1206910978;var d=o.alternate;return d===null?(o.childLanes=0,o.lanes=i,o.child=null,o.subtreeFlags=0,o.memoizedProps=null,o.memoizedState=null,o.updateQueue=null,o.dependencies=null,o.stateNode=null):(o.childLanes=d.childLanes,o.lanes=d.lanes,o.child=d.child,o.subtreeFlags=0,o.deletions=null,o.memoizedProps=d.memoizedProps,o.memoizedState=d.memoizedState,o.updateQueue=d.updateQueue,o.type=d.type,i=d.dependencies,o.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext}),o}function $u(o,i,d,u,y,x){var C=0;if(u=o,typeof u=="function")op(u)&&(C=1);else if(typeof u=="string")C=rT(o,d,ut.current)?26:o==="html"||o==="head"||o==="body"?27:5;else e:switch(u){case xe:return o=gn(31,d,i,y),o.elementType=xe,o.lanes=x,o;case V:return Oi(d.children,y,x,i);case oe:C=8,y|=24;break;case F:return o=gn(12,d,i,y|2),o.elementType=F,o.lanes=x,o;case W:return o=gn(13,d,i,y),o.elementType=W,o.lanes=x,o;case re:return o=gn(19,d,i,y),o.elementType=re,o.lanes=x,o;case Ne:case R:return o=y|32,o=gn(30,d,i,o),o.elementType=R,o.lanes=x,o.stateNode={autoName:null,paired:null,clones:null,ref:null},o;default:if(typeof u=="object"&&u)switch(u.$$typeof){case L:C=10;break e;case J:C=9;break e;case U:C=11;break e;case le:C=14;break e;case pe:C=16,u=null;break e}C=29,d=Error(a(130,o===null?"null":typeof o,"")),u=null}return i=gn(C,d,i,y),i.elementType=o,i.type=u,i.lanes=x,i}function Oi(o,i,d,u){return o=gn(7,o,u,i),o.lanes=d,o}function rp(o,i,d){return o=gn(6,o,null,i),o.lanes=d,o}function ob(o){var i=gn(18,null,null,0);return i.stateNode=o,i}function ip(o,i,d){return i=gn(4,o.children===null?[]:o.children,o.key,i),i.lanes=d,i.stateNode={containerInfo:o.containerInfo,pendingChildren:null,implementation:o.implementation},i}var rb=new WeakMap;function Rn(o,i){if(typeof o=="object"&&o){var d=rb.get(o);return d===void 0?(i={value:o,source:i,stack:Er(i)},rb.set(o,i),i):d}return{value:o,source:i,stack:Er(i)}}var Ha=[],Va=0,Eu=null,wl=0,zn=[],Fn=0,qr=null,ko=1,So="";function ir(o,i){Ha[Va++]=wl,Ha[Va++]=Eu,Eu=o,wl=i}function ib(o,i,d){zn[Fn++]=ko,zn[Fn++]=So,zn[Fn++]=qr,qr=o;var u=ko;o=So;var y=32-qt(u)-1;u&=~(1<<y),d+=1;var x=32-qt(i)+y;if(30<x){var C=y-y%5;x=(u&(1<<C)-1).toString(32),u>>=C,y-=C,ko=1<<32-qt(i)+y|d<<y|u,So=x+o}else ko=1<<x|d<<y|u,So=o}function _u(o){o.return!==null&&(ir(o,1),ib(o,1,0))}function ap(o){for(;o===Eu;)Eu=Ha[--Va],Ha[Va]=null,wl=Ha[--Va],Ha[Va]=null;for(;o===qr;)qr=zn[--Fn],zn[Fn]=null,So=zn[--Fn],zn[Fn]=null,ko=zn[--Fn],zn[Fn]=null}function ab(o,i){zn[Fn++]=ko,zn[Fn++]=So,zn[Fn++]=qr,ko=i.id,So=i.overflow,qr=o}var Vt=null,ft=null,We=!1,Hr=null,Bn=!1,sp=Error(a(519));function Vr(o){throw kl(Rn(Error(a(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML","")),o)),sp}function sb(o){var i=o.stateNode,d=o.type,u=o.memoizedProps;switch(i[ke]=o,i[Te]=u,d){case"dialog":Ge("cancel",i),Ge("close",i);break;case"iframe":case"object":case"embed":Ge("load",i);break;case"video":case"audio":for(d=0;d<Vl.length;d++)Ge(Vl[d],i);break;case"source":Ge("error",i);break;case"img":case"image":case"link":Ge("error",i),Ge("load",i);break;case"details":Ge("toggle",i);break;case"input":Ge("invalid",i),bv(i,u.value,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name,!0);break;case"select":Ge("invalid",i);break;case"textarea":Ge("invalid",i),wv(i,u.value,u.defaultValue,u.children)}d=u.children,typeof d!="string"&&typeof d!="number"&&typeof d!="bigint"||i.textContent===""+d||u.suppressHydrationWarning===!0||Cw(i.textContent,d)?(u.popover!=null&&(Ge("beforetoggle",i),Ge("toggle",i)),u.onScroll!=null&&Ge("scroll",i),u.onScrollEnd!=null&&Ge("scrollend",i),u.onClick!=null&&(i.onclick=wo),i=!0):i=!1,i||Vr(o,!0)}function Au(o){for(Vt=o.return;Vt;)switch(Vt.tag){case 5:case 31:case 13:Bn=!1;return;case 27:case 3:Bn=!0;return;default:Vt=Vt.return}}function Ka(o){if(o!==Vt)return!1;if(!We)return Au(o),We=!0,!1;var i=o.tag,d;if((d=i!==3&&i!==27)&&((d=i===5)&&(d=o.type,d=d==="form"||d==="button"||Im(o.type,o.memoizedProps)),d=!d),d&&ft&&Vr(o),Au(o),i===13){if(o=o.memoizedState,o=o===null?null:o.dehydrated,!o)throw Error(a(317));ft=Ww(o)}else if(i===31){if(o=o.memoizedState,o=o===null?null:o.dehydrated,!o)throw Error(a(317));ft=Ww(o)}else i===27?(i=ft,ri(o.type)?(o=Km,Km=null,ft=o):ft=i):ft=Vt?Vn(o.stateNode.nextSibling):null;return!0}function Pi(){ft=Vt=null,We=!1}function lp(){var o=Hr;return o!==null&&(bn===null?bn=o:bn.push.apply(bn,o),Hr=null),o}function kl(o){Hr===null?Hr=[o]:Hr.push(o)}var dp=Ye(null),Di=null,ar=null;function Kr(o,i,d){Be(dp,i._currentValue),i._currentValue=d}function sr(o){o._currentValue=dp.current,Le(dp)}function Tu(o,i,d){for(;o!==null;){var u=o.alternate;if((o.childLanes&i)===i?u!==null&&(u.childLanes&i)!==i&&(u.childLanes|=i):(o.childLanes|=i,u!==null&&(u.childLanes|=i)),o===d)break;o=o.return}}function up(o,i,d,u){var y=o.child;for(y!==null&&(y.return=o);y!==null;){var x=y.dependencies;if(x!==null){var C=y.child;x=x.firstContext;e:for(;x!==null;){var P=x;x=y;for(var H=0;H<i.length;H++)if(P.context===i[H]){x.lanes|=d,P=x.alternate,P!==null&&(P.lanes|=d),Tu(x.return,d,o),u||(C=null);break e}x=P.next}}else if(y.tag===18){if(C=y.return,C===null)throw Error(a(341));C.lanes|=d,x=C.alternate,x!==null&&(x.lanes|=d),Tu(C,d,o),C=null}else y.tag===13&&y.memoizedState!==null&&y.memoizedState.dehydrated===null?(y.lanes|=d,C=y.alternate,C!==null&&(C.lanes|=d),Tu(y.return,d,o),C=y.child,C=C===null?null:C.sibling):C=y.child;if(C!==null)C.return=y;else for(C=y;C!==null;){if(C===o){C=null;break}if(y=C.sibling,y!==null){y.return=C.return,C=y;break}C=C.return}y=C}}function Ii(o,i,d,u){o=null;for(var y=i,x=!1;y!==null;){if(!x){if(y.flags&524288)x=!0;else if(y.flags&262144)break}if(y.tag===10){var C=y.alternate;if(C===null)throw Error(a(387));if(C=C.memoizedProps,C!==null){var P=y.type;jn(y.pendingProps.value,C.value)||(o===null?o=[P]:o.push(P))}}else if(y===zt.current){if(C=y.alternate,C===null)throw Error(a(387));C.memoizedState.memoizedState!==y.memoizedState.memoizedState&&(o===null?o=[gs]:o.push(gs))}y=y.return}return o!==null&&up(i,o,d,u),i.flags|=262144,o!==null}function Mu(o){for(o=o.firstContext;o!==null;){if(!jn(o.context._currentValue,o.memoizedValue))return!0;o=o.next}return!1}function Li(o){Di=o,ar=null,o=o.dependencies,o!==null&&(o.firstContext=null)}function Gt(o){return lb(Di,o)}function Ou(o,i){return Di===null&&Li(o),lb(o,i)}function lb(o,i){var d=i._currentValue;if(i={context:i,memoizedValue:d,next:null},ar===null){if(o===null)throw Error(a(308));ar=i,o.dependencies={lanes:0,firstContext:i},o.flags|=524288}else ar=ar.next=i;return d}var A2=typeof AbortController<"u"?AbortController:function(){var o=[],i=this.signal={aborted:!1,addEventListener:function(d,u){o.push(u)}};this.abort=function(){i.aborted=!0,o.forEach(function(d){return d()})}},T2=t.unstable_scheduleCallback,M2=t.unstable_NormalPriority,Tt={$$typeof:L,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function cp(){return{controller:new A2,data:new Map,refCount:0}}function Sl(o){o.refCount--,o.refCount===0&&T2(M2,function(){o.controller.abort()})}function db(o,i){if(o.pendingLanes&4194048){var d=o.transitionTypes;for(d===null&&(d=o.transitionTypes=[]),o=0;o<i.length;o++){var u=i[o];d.indexOf(u)===-1&&d.push(u)}}}var Nl=null;function O2(o){var i=o.transitionTypes;return o.transitionTypes=null,i}var jl=null,fp=0,Ri=0,Wa=null;function P2(o,i){if(jl===null){var d=jl=[];fp=0,Ri=Em(),Wa={status:"pending",value:void 0,then:function(u){d.push(u)}}}return fp++,i.then(ub,ub),i}function ub(){if(--fp===0&&(Nl=null,jl!==null)){Wa!==null&&(Wa.status="fulfilled");var o=jl;jl=null,Ri=0,Wa=null;for(var i=0;i<o.length;i++)(0,o[i])()}}function D2(o,i){var d=[],u={status:"pending",value:null,reason:null,then:function(y){d.push(y)}};return o.then(function(){u.status="fulfilled",u.value=i;for(var y=0;y<d.length;y++)(0,d[y])(i)},function(y){for(u.status="rejected",u.reason=y,y=0;y<d.length;y++)(0,d[y])(void 0)}),u}var cb=ee.S;ee.S=function(o,i){if(ew=Xt(),typeof i=="object"&&i&&typeof i.then=="function"&&P2(o,i),Nl!==null)for(var d=us;d!==null;)db(d,Nl),d=d.next;if(d=o.types,d!==null){for(var u=us;u!==null;)db(u,d),u=u.next;if(Ri!==0){u=Nl,u===null&&(u=Nl=[]);for(var y=0;y<d.length;y++){var x=d[y];u.indexOf(x)===-1&&u.push(x)}}}cb!==null&&cb(o,i)};var zi=Ye(null);function hp(){var o=zi.current;return o===null?ct.pooledCache:o}function Pu(o,i){i===null?Be(zi,zi.current):Be(zi,i.pool)}function fb(){var o=hp();return o===null?null:{parent:Tt._currentValue,pool:o}}var Ua=Error(a(460)),pp=Error(a(474)),Du=Error(a(542)),Iu={then:function(){}};function hb(o){return o=o.status,o==="fulfilled"||o==="rejected"}function pb(o,i,d){switch(d=o[d],d===void 0?o.push(i):d!==i&&(i.then(wo,wo),i=d),i.status){case"fulfilled":return i.value;case"rejected":throw o=i.reason,gb(o),o===void 0&&!("reason"in i)?Error(a(600)):o;default:if(typeof i.status=="string")i.then(wo,wo);else{if(o=ct,o!==null&&100<o.shellSuspendCounter)throw Error(a(482));o=i,o.status="pending",o.then(function(u){if(i.status==="pending"){var y=i;y.status="fulfilled",y.value=u}},function(u){if(i.status==="pending"){var y=i;y.status="rejected",y.reason=u}})}switch(i.status){case"fulfilled":return i.value;case"rejected":throw o=i.reason,gb(o),o}throw Bi=i,Ua}}function Fi(o){try{var i=o._init;return i(o._payload)}catch(d){throw typeof d=="object"&&d&&typeof d.then=="function"?(Bi=d,Ua):d}}var Bi=null;function mb(){if(Bi===null)throw Error(a(459));var o=Bi;return Bi=null,o}function gb(o){if(o===Ua||o===Du)throw Error(a(483))}var Ya=null,Cl=0;function Lu(o){var i=Cl;return Cl+=1,Ya===null&&(Ya=[]),pb(Ya,o,i)}function Wr(o,i){i=i.props.ref,o.ref=i===void 0?null:i}function Ru(o,i){throw i.$$typeof===O?Error(a(525)):(o=Object.prototype.toString.call(i),Error(a(31,o==="[object Object]"?"object with keys {"+Object.keys(i).join(", ")+"}":o)))}function yb(o){function i(ne,Y){if(o){var se=ne.deletions;se===null?(ne.deletions=[Y],ne.flags|=16):se.push(Y)}}function d(ne,Y){if(!o)return null;for(;Y!==null;)i(ne,Y),Y=Y.sibling;return null}function u(ne){for(var Y=new Map;ne!==null;)ne.key===null?Y.set(ne.index,ne):Y.set(ne.key,ne),ne=ne.sibling;return Y}function y(ne,Y){return ne=rr(ne,Y),ne.index=0,ne.sibling=null,ne}function x(ne,Y,se){return ne.index=se,o?(se=ne.alternate,se===null?(ne.flags|=134217730,Y):(se=se.index,se<Y?(ne.flags|=2,Y):se)):(ne.flags|=1048576,Y)}function C(ne){return o&&ne.alternate===null&&(ne.flags|=134217730),ne}function P(ne,Y,se,ge){return Y===null||Y.tag!==6?(Y=rp(se,ne.mode,ge),Y.return=ne,Y):(Y=y(Y,se),Y.return=ne,Y)}function H(ne,Y,se,ge){var _e=se.type;return _e===V?(ne=ce(ne,Y,se.props.children,ge,se.key),Wr(ne,se),ne):Y!==null&&(Y.elementType===_e||typeof _e=="object"&&_e&&_e.$$typeof===pe&&Fi(_e)===Y.type)?(Y=y(Y,se.props),Wr(Y,se),Y.return=ne,Y):(Y=$u(se.type,se.key,se.props,null,ne.mode,ge),Wr(Y,se),Y.return=ne,Y)}function ie(ne,Y,se,ge){return Y===null||Y.tag!==4||Y.stateNode.containerInfo!==se.containerInfo||Y.stateNode.implementation!==se.implementation?(Y=ip(se,ne.mode,ge),Y.return=ne,Y):(Y=y(Y,se.children||[]),Y.return=ne,Y)}function ce(ne,Y,se,ge,_e){return Y===null||Y.tag!==7?(Y=Oi(se,ne.mode,ge,_e),Y.return=ne,Y):(Y=y(Y,se),Y.return=ne,Y)}function ye(ne,Y,se){if(typeof Y=="string"&&Y!==""||typeof Y=="number"||typeof Y=="bigint")return Y=rp(""+Y,ne.mode,se),Y.return=ne,Y;if(typeof Y=="object"&&Y){switch(Y.$$typeof){case K:return se=$u(Y.type,Y.key,Y.props,null,ne.mode,se),Wr(se,Y),se.return=ne,se;case B:return Y=ip(Y,ne.mode,se),Y.return=ne,Y;case pe:return Y=Fi(Y),ye(ne,Y,se)}if(q(Y)||X(Y))return Y=Oi(Y,ne.mode,se,null),Y.return=ne,Y;if(typeof Y.then=="function")return ye(ne,Lu(Y),se);if(Y.$$typeof===L)return ye(ne,Ou(ne,Y),se);Ru(ne,Y)}return null}function te(ne,Y,se,ge){var _e=Y===null?null:Y.key;if(typeof se=="string"&&se!==""||typeof se=="number"||typeof se=="bigint")return _e===null?P(ne,Y,""+se,ge):null;if(typeof se=="object"&&se){switch(se.$$typeof){case K:return se.key===_e?H(ne,Y,se,ge):null;case B:return se.key===_e?ie(ne,Y,se,ge):null;case pe:return se=Fi(se),te(ne,Y,se,ge)}if(q(se)||X(se))return _e===null?ce(ne,Y,se,ge,null):null;if(typeof se.then=="function")return te(ne,Y,Lu(se),ge);if(se.$$typeof===L)return te(ne,Y,Ou(ne,se),ge);Ru(ne,se)}return null}function ue(ne,Y,se,ge,_e){if(typeof ge=="string"&&ge!==""||typeof ge=="number"||typeof ge=="bigint")return ne=ne.get(se)||null,P(Y,ne,""+ge,_e);if(typeof ge=="object"&&ge){switch(ge.$$typeof){case K:return ne=ne.get(ge.key===null?se:ge.key)||null,H(Y,ne,ge,_e);case B:return ne=ne.get(ge.key===null?se:ge.key)||null,ie(Y,ne,ge,_e);case pe:return ge=Fi(ge),ue(ne,Y,se,ge,_e)}if(q(ge)||X(ge))return ne=ne.get(se)||null,ce(Y,ne,ge,_e,null);if(typeof ge.then=="function")return ue(ne,Y,se,Lu(ge),_e);if(ge.$$typeof===L)return ue(ne,Y,se,Ou(Y,ge),_e);Ru(Y,ge)}return null}function Se(ne,Y,se,ge){for(var _e=null,Je=null,Oe=Y,Ie=Y=0,Pt=null;Oe!==null&&Ie<se.length;Ie++){Oe.index>Ie?(Pt=Oe,Oe=null):Pt=Oe.sibling;var et=te(ne,Oe,se[Ie],ge);if(et===null){Oe===null&&(Oe=Pt);break}o&&Oe&&et.alternate===null&&i(ne,Oe),Y=x(et,Y,Ie),Je===null?_e=et:Je.sibling=et,Je=et,Oe=Pt}if(Ie===se.length)return d(ne,Oe),We&&ir(ne,Ie),_e;if(Oe===null){for(;Ie<se.length;Ie++)Oe=ye(ne,se[Ie],ge),Oe!==null&&(Y=x(Oe,Y,Ie),Je===null?_e=Oe:Je.sibling=Oe,Je=Oe);return We&&ir(ne,Ie),_e}for(Oe=u(Oe);Ie<se.length;Ie++)Pt=ue(Oe,ne,Ie,se[Ie],ge),Pt!==null&&(o&&(et=Pt.alternate,et!==null&&Oe.delete(et.key===null?Ie:et.key)),Y=x(Pt,Y,Ie),Je===null?_e=Pt:Je.sibling=Pt,Je=Pt);return o&&Oe.forEach(function(di){return i(ne,di)}),We&&ir(ne,Ie),_e}function Me(ne,Y,se,ge){if(se==null)throw Error(a(151));for(var _e=null,Je=null,Oe=Y,Ie=Y=0,Pt=null,et=se.next();Oe!==null&&!et.done;Ie++,et=se.next()){Oe.index>Ie?(Pt=Oe,Oe=null):Pt=Oe.sibling;var di=te(ne,Oe,et.value,ge);if(di===null){Oe===null&&(Oe=Pt);break}o&&Oe&&di.alternate===null&&i(ne,Oe),Y=x(di,Y,Ie),Je===null?_e=di:Je.sibling=di,Je=di,Oe=Pt}if(et.done)return d(ne,Oe),We&&ir(ne,Ie),_e;if(Oe===null){for(;!et.done;Ie++,et=se.next())et=ye(ne,et.value,ge),et!==null&&(Y=x(et,Y,Ie),Je===null?_e=et:Je.sibling=et,Je=et);return We&&ir(ne,Ie),_e}for(Oe=u(Oe);!et.done;Ie++,et=se.next())et=ue(Oe,ne,Ie,et.value,ge),et!==null&&(o&&(Pt=et.alternate,Pt!==null&&Oe.delete(Pt.key===null?Ie:Pt.key)),Y=x(et,Y,Ie),Je===null?_e=et:Je.sibling=et,Je=et);return o&&Oe.forEach(function(bT){return i(ne,bT)}),We&&ir(ne,Ie),_e}function Ve(ne,Y,se,ge){if(typeof se=="object"&&se&&se.type===V&&se.key===null&&se.props.ref===void 0&&(se=se.props.children),typeof se=="object"&&se){switch(se.$$typeof){case K:e:{for(var _e=se.key;Y!==null;){if(Y.key===_e){if(_e=se.type,_e===V){if(Y.tag===7){d(ne,Y.sibling),ge=y(Y,se.props.children),Wr(ge,se),ge.return=ne,ne=ge;break e}}else if(Y.elementType===_e||typeof _e=="object"&&_e&&_e.$$typeof===pe&&Fi(_e)===Y.type){d(ne,Y.sibling),ge=y(Y,se.props),Wr(ge,se),ge.return=ne,ne=ge;break e}d(ne,Y);break}i(ne,Y),Y=Y.sibling}se.type===V?(ge=Oi(se.props.children,ne.mode,ge,se.key),Wr(ge,se),ge.return=ne,ne=ge):(ge=$u(se.type,se.key,se.props,null,ne.mode,ge),Wr(ge,se),ge.return=ne,ne=ge)}return C(ne);case B:e:{for(_e=se.key;Y!==null;){if(Y.key===_e){if(Y.tag===4&&Y.stateNode.containerInfo===se.containerInfo&&Y.stateNode.implementation===se.implementation){d(ne,Y.sibling),ge=y(Y,se.children||[]),ge.return=ne,ne=ge;break e}d(ne,Y);break}i(ne,Y),Y=Y.sibling}ge=ip(se,ne.mode,ge),ge.return=ne,ne=ge}return C(ne);case pe:return se=Fi(se),Ve(ne,Y,se,ge)}if(q(se))return Se(ne,Y,se,ge);if(X(se)){if(_e=X(se),typeof _e!="function")throw Error(a(150));return se=_e.call(se),Me(ne,Y,se,ge)}if(typeof se.then=="function")return Ve(ne,Y,Lu(se),ge);if(se.$$typeof===L)return Ve(ne,Y,Ou(ne,se),ge);Ru(ne,se)}return typeof se=="string"&&se!==""||typeof se=="number"||typeof se=="bigint"?(se=""+se,Y!==null&&Y.tag===6?(d(ne,Y.sibling),ge=y(Y,se),ge.return=ne,ne=ge):(d(ne,Y),ge=rp(se,ne.mode,ge),ge.return=ne,ne=ge),C(ne)):d(ne,Y)}return function(ne,Y,se,ge){try{Cl=0;var _e=Ve(ne,Y,se,ge);return Ya=null,_e}catch(Oe){if(Oe===Ua||Oe===Du)throw Oe;var Je=gn(29,Oe,null,ne.mode);return Je.lanes=ge,Je.return=ne,Je}}}var qi=yb(!0),vb=yb(!1),Ur=!1;function mp(o){o.updateQueue={baseState:o.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function gp(o,i){o=o.updateQueue,i.updateQueue===o&&(i.updateQueue={baseState:o.baseState,firstBaseUpdate:o.firstBaseUpdate,lastBaseUpdate:o.lastBaseUpdate,shared:o.shared,callbacks:null})}function Hi(o){return{lane:o,tag:0,payload:null,callback:null,next:null}}function Vi(o,i,d){var u=o.updateQueue;if(u===null)return null;if(u=u.shared,nt&2){var y=u.pending;return y===null?i.next=i:(i.next=y.next,y.next=i),u.pending=i,i=Cu(o),tb(o,null,d),i}return ju(o,u,i,d),Cu(o)}function $l(o,i,d){if(i=i.updateQueue,i!==null&&(i=i.shared,d&4194048)){var u=i.lanes;u&=o.pendingLanes,d|=u,i.lanes=d,_i(o,d)}}function yp(o,i){var d=o.updateQueue,u=o.alternate;if(u!==null&&(u=u.updateQueue,d===u)){var y=null,x=null;if(d=d.firstBaseUpdate,d!==null){do{var C={lane:d.lane,tag:d.tag,payload:d.payload,callback:null,next:null};x===null?y=x=C:x=x.next=C,d=d.next}while(d!==null);x===null?y=x=i:x=x.next=i}else y=x=i;d={baseState:u.baseState,firstBaseUpdate:y,lastBaseUpdate:x,shared:u.shared,callbacks:u.callbacks},o.updateQueue=d}else o=d.lastBaseUpdate,o===null?d.firstBaseUpdate=i:o.next=i,d.lastBaseUpdate=i}var vp=!1;function El(){if(vp){var o=Wa;if(o!==null)throw o}}function _l(o,i,d,u){vp=!1;var y=o.updateQueue;Ur=!1;var x=y.firstBaseUpdate,C=y.lastBaseUpdate,P=y.shared.pending;if(P!==null){y.shared.pending=null;var H=P,ie=H.next;H.next=null,C===null?x=ie:C.next=ie,C=H;var ce=o.alternate;ce!==null&&(ce=ce.updateQueue,P=ce.lastBaseUpdate,P!==C&&(P===null?ce.firstBaseUpdate=ie:P.next=ie,ce.lastBaseUpdate=H))}if(x!==null){var ye=y.baseState;C=0,ce=ie=H=null,P=x;do{var te=P.lane&-536870913,ue=te!==P.lane;if(ue?(Qe&te)===te:(u&te)===te){te!==0&&te===Ri&&(vp=!0),ce!==null&&(ce=ce.next={lane:0,tag:P.tag,payload:P.payload,callback:null,next:null});e:{var Se=o,Me=P;te=i;var Ve=d;switch(Me.tag){case 1:if(Se=Me.payload,typeof Se=="function"){ye=Se.call(Ve,ye,te);break e}ye=Se;break e;case 3:Se.flags=Se.flags&-65537|128;case 0:if(Se=Me.payload,te=typeof Se=="function"?Se.call(Ve,ye,te):Se,te==null)break e;ye=M({},ye,te);break e;case 2:Ur=!0}}te=P.callback,te!==null&&(o.flags|=64,ue&&(o.flags|=8192),ue=y.callbacks,ue===null?y.callbacks=[te]:ue.push(te))}else ue={lane:te,tag:P.tag,payload:P.payload,callback:P.callback,next:null},ce===null?(ie=ce=ue,H=ye):ce=ce.next=ue,C|=te;if(P=P.next,P===null){if(P=y.shared.pending,P===null)break;ue=P,P=ue.next,ue.next=null,y.lastBaseUpdate=ue,y.shared.pending=null}}while(!0);ce===null&&(H=ye),y.baseState=H,y.firstBaseUpdate=ie,y.lastBaseUpdate=ce,x===null&&(y.shared.lanes=0),ei|=C,o.lanes=C,o.memoizedState=ye}}function bb(o,i){if(typeof o!="function")throw Error(a(191,o));o.call(i)}function xb(o,i){var d=o.callbacks;if(d!==null)for(o.callbacks=null,o=0;o<d.length;o++)bb(d[o],i)}var Yr=Ye(null),zu=Ye(0);function wb(o,i){o=fr,Be(zu,o),Be(Yr,i),fr=o|i.baseLanes}function bp(){Be(zu,fr),Be(Yr,Yr.current)}function xp(){fr=zu.current,Le(Yr),Le(zu)}var Qt=Ye(null),sn=null;function Xr(o){var i=o.alternate;Be(Jt,Jt.current&1),Be(Qt,o),sn===null&&(i===null||Yr.current!==null||i.memoizedState!==null)&&(sn=o)}function wp(o){Be(Jt,Jt.current),Be(Qt,o),sn===null&&(sn=o)}function kb(o){o.tag===22?(Be(Jt,Jt.current),Be(Qt,o),sn===null&&(sn=o)):Zr()}function Zr(){Be(Jt,Jt.current),Be(Qt,Qt.current)}function Cn(o){Le(Qt),sn===o&&(sn=null),Le(Jt)}var Jt=Ye(0);function Al(o,i){Be(Qt,Qt.current),Be(Jt,i)}function kp(o){Le(Jt),Le(Qt),sn===o&&(sn=null)}function Fu(o){for(var i=o;i!==null;){if(i.tag===13){var d=i.memoizedState;if(d!==null&&(d=d.dehydrated,d===null||Hm(d)||Vm(d)))return i}else if(i.tag===19&&i.memoizedProps.revealOrder!=="independent"){if(i.flags&128)return i}else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===o)break;for(;i.sibling===null;){if(i.return===null||i.return===o)return null;i=i.return}i.sibling.return=i.return,i=i.sibling}return null}var lr=0,He=null,lt=null,Mt=null,Bu=!1,Xa=!1,Ki=!1,qu=0,Tl=0,Za=null,I2=0;function St(){throw Error(a(321))}function Sp(o,i){if(i===null)return!1;for(var d=0;d<i.length&&d<o.length;d++)if(!jn(o[d],i[d]))return!1;return!0}function Np(o,i,d,u,y,x){return lr=x,He=i,i.memoizedState=null,i.updateQueue=null,i.lanes=0,ee.H=o===null||o.memoizedState===null?ix:ax,Ki=!1,x=d(u,y),Ki=!1,Xa&&(x=Nb(i,d,u,y)),Sb(o),x}function Sb(o){ee.H=Xu;var i=lt!==null&<.next!==null;if(lr=0,Mt=lt=He=null,Bu=!1,Tl=0,Za=null,i)throw Error(a(300));o===null||Ot||(o=o.dependencies,o!==null&&Mu(o)&&(Ot=!0))}function Nb(o,i,d,u){He=o;var y=0;do{if(Xa&&(Za=null),Tl=0,Xa=!1,25<=y)throw Error(a(301));if(y+=1,Mt=lt=null,o.updateQueue!=null){var x=o.updateQueue;x.lastEffect=null,x.events=null,x.stores=null,x.memoCache!=null&&(x.memoCache.index=0)}ee.H=V2,x=i(d,u)}while(Xa);return x}function L2(){var o=ee.H,i=o.useState()[0];return i=typeof i.then=="function"?Ml(i):i,o=o.useState()[0],(lt===null?null:lt.memoizedState)!==o&&(He.flags|=1024),i}function jp(){var o=qu!==0;return qu=0,o}function Cp(o,i,d){i.updateQueue=o.updateQueue,i.flags&=-2053,o.lanes&=~d}function $p(o){if(Bu){for(o=o.memoizedState;o!==null;){var i=o.queue;i!==null&&(i.pending=null),o=o.next}Bu=!1}lr=0,Mt=lt=He=null,Xa=!1,Tl=qu=0,Za=null}function ln(){var o={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Mt===null?He.memoizedState=Mt=o:Mt=Mt.next=o,Mt}function $t(){if(lt===null){var o=He.alternate;o=o===null?null:o.memoizedState}else o=lt.next;var i=Mt===null?He.memoizedState:Mt.next;if(i!==null)Mt=i,lt=o;else{if(o===null)throw He.alternate===null?Error(a(467)):Error(a(310));lt=o,o={memoizedState:lt.memoizedState,baseState:lt.baseState,baseQueue:lt.baseQueue,queue:lt.queue,next:null},Mt===null?He.memoizedState=Mt=o:Mt=Mt.next=o}return Mt}function Hu(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Ml(o){var i=Tl;return Tl+=1,Za===null&&(Za=[]),o=pb(Za,o,i),i=He,(Mt===null?i.memoizedState:Mt.next)===null&&(i=i.alternate,ee.H=i===null||i.memoizedState===null?ix:ax),o}function Vu(o){if(typeof o=="object"&&o){if(typeof o.then=="function")return Ml(o);if(o.$$typeof===Q)return;if(o.$$typeof===L)return Gt(o)}throw Error(a(438,String(o)))}function Ep(o){var i=null,d=He.updateQueue;if(d!==null&&(i=d.memoCache),i==null){var u=He.alternate;u!==null&&(u=u.updateQueue,u!==null&&(u=u.memoCache,u!=null&&(i={data:u.data.map(function(y){return y.slice()}),index:0})))}if(i??={data:[],index:0},d===null&&(d=Hu(),He.updateQueue=d),d.memoCache=i,d=i.data[i.index],d===void 0)for(d=i.data[i.index]=Array(o),u=0;u<o;u++)d[u]=we;return i.index++,d}function dr(o,i){return typeof i=="function"?i(o):i}function Ku(o){return _p($t(),lt,o)}function _p(o,i,d){var u=o.queue;if(u===null)throw Error(a(311));u.lastRenderedReducer=d;var y=o.baseQueue,x=u.pending;if(x!==null){if(y!==null){var C=y.next;y.next=x.next,x.next=C}i.baseQueue=y=x,u.pending=null}if(x=o.baseState,y===null)o.memoizedState=x;else{i=y.next;var P=C=null,H=null,ie=i,ce=!1;do{var ye=ie.lane&-536870913;if(ye===ie.lane?(lr&ye)===ye:(Qe&ye)===ye){var te=ie.revertLane;if(te===0)H!==null&&(H=H.next={lane:0,revertLane:0,gesture:null,action:ie.action,hasEagerState:ie.hasEagerState,eagerState:ie.eagerState,next:null}),ye===Ri&&(ce=!0);else if((lr&te)===te){ie=ie.next,te===Ri&&(ce=!0);continue}else ye={lane:0,revertLane:ie.revertLane,gesture:null,action:ie.action,hasEagerState:ie.hasEagerState,eagerState:ie.eagerState,next:null},H===null?(P=H=ye,C=x):H=H.next=ye,He.lanes|=te,ei|=te;ye=ie.action,Ki&&d(x,ye),x=ie.hasEagerState?ie.eagerState:d(x,ye)}else te={lane:ye,revertLane:ie.revertLane,gesture:ie.gesture,action:ie.action,hasEagerState:ie.hasEagerState,eagerState:ie.eagerState,next:null},H===null?(P=H=te,C=x):H=H.next=te,He.lanes|=ye,ei|=ye;ie=ie.next}while(ie!==null&&ie!==i);if(H===null?C=x:H.next=P,!jn(x,o.memoizedState)&&(Ot=!0,ce&&(d=Wa,d!==null)))throw d;o.memoizedState=x,o.baseState=C,o.baseQueue=H,u.lastRenderedState=x}return y===null&&(u.lanes=0),[o.memoizedState,u.dispatch]}function Ap(o){var i=$t(),d=i.queue;if(d===null)throw Error(a(311));d.lastRenderedReducer=o;var u=d.dispatch,y=d.pending,x=i.memoizedState;if(y!==null){d.pending=null;var C=y=y.next;do x=o(x,C.action),C=C.next;while(C!==y);jn(x,i.memoizedState)||(Ot=!0),i.memoizedState=x,i.baseQueue===null&&(i.baseState=x),d.lastRenderedState=x}return[x,u]}function jb(o,i,d){var u=He,y=$t(),x=We;if(x){if(d===void 0)throw Error(a(407));d=d()}else d=i();var C=!jn((lt||y).memoizedState,d);if(C&&(y.memoizedState=d,Ot=!0),y=y.queue,Op(Eb.bind(null,u,y,o),[o]),o=y.getSnapshot!==i||C||Mt!==null&&!!(Mt.memoizedState.tag&1),Ga(o?9:8,{destroy:void 0},$b.bind(null,u,y,d,i),null),o){if(u.flags|=2048,ct===null)throw Error(a(349));x||lr&127||Cb(u,i,d)}return d}function Cb(o,i,d){o.flags|=16384,o={getSnapshot:i,value:d},i=He.updateQueue,i===null?(i=Hu(),He.updateQueue=i,i.stores=[o]):(d=i.stores,d===null?i.stores=[o]:d.push(o))}function $b(o,i,d,u){i.value=d,i.getSnapshot=u,_b(i)&&Ab(o)}function Eb(o,i,d){return d(function(){_b(i)&&Ab(o)})}function _b(o){var i=o.getSnapshot;o=o.value;try{var d=i();return!jn(o,d)}catch{return!0}}function Ab(o){var i=Mi(o,2);i!==null&&xn(i,o,2)}function Tp(o){var i=ln();if(typeof o=="function"){var d=o;if(o=d(),Ki){In(!0);try{d()}finally{In(!1)}}}return i.memoizedState=i.baseState=o,i.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:dr,lastRenderedState:o},i}function Tb(o,i,d,u){return o.baseState=d,_p(o,lt,typeof u=="function"?u:dr)}function R2(o,i,d,u,y){if(Yu(o))throw Error(a(485));if(o=i.action,o!==null){var x={payload:y,action:o,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(C){x.listeners.push(C)}};ee.T===null?x.isTransition=!1:d(!0),u(x),d=i.pending,d===null?(x.next=i.pending=x,Mb(i,x)):(x.next=d.next,i.pending=d.next=x)}}function Mb(o,i){var d=i.action,u=i.payload,y=o.state;if(i.isTransition){var x=ee.T,C={};C.types=x===null?null:x.types,ee.T=C;try{var P=d(y,u),H=ee.S;H!==null&&H(C,P),Ob(o,i,P)}catch(ie){Mp(o,i,ie)}finally{x!==null&&C.types!==null&&(x.types=C.types),ee.T=x}}else try{x=d(y,u),Ob(o,i,x)}catch(ie){Mp(o,i,ie)}}function Ob(o,i,d){typeof d=="object"&&d&&typeof d.then=="function"?d.then(function(u){Pb(o,i,u)},function(u){return Mp(o,i,u)}):Pb(o,i,d)}function Pb(o,i,d){i.status="fulfilled",i.value=d,Db(i),o.state=d,i=o.pending,i!==null&&(d=i.next,d===i?o.pending=null:(d=d.next,i.next=d,Mb(o,d)))}function Mp(o,i,d){var u=o.pending;if(o.pending=null,u!==null){u=u.next;do i.status="rejected",i.reason=d,Db(i),i=i.next;while(i!==u)}o.action=null}function Db(o){o=o.listeners;for(var i=0;i<o.length;i++)(0,o[i])()}function Ib(o,i){return i}function Lb(o,i){if(We){var d=ct.formState;if(d!==null){e:{var u=He;if(We){if(ft){t:{for(var y=ft,x=Bn;y.nodeType!==8;)if(!x||(y=Vn(y.nextSibling),y===null)){y=null;break t}x=y.data,y=x==="F!"||x==="F"?y:null}if(y){ft=Vn(y.nextSibling),u=y.data==="F!";break e}}Vr(u)}u=!1}u&&(i=d[0])}}return d=ln(),d.memoizedState=d.baseState=i,u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ib,lastRenderedState:i},d.queue=u,d=nx.bind(null,He,u),u.dispatch=d,u=Tp(!1),x=Rp.bind(null,He,!1,u.queue),u=ln(),y={state:i,dispatch:null,action:o,pending:null},u.queue=y,d=R2.bind(null,He,y,x,d),y.dispatch=d,u.memoizedState=o,[i,d,!1]}function Rb(o){return zb($t(),lt,o)}function zb(o,i,d){if(i=_p(o,i,Ib)[0],o=Ku(dr)[0],typeof i=="object"&&i&&typeof i.then=="function")try{var u=Ml(i)}catch(C){throw C===Ua?Du:C}else u=i;i=$t();var y=i.queue,x=y.dispatch;return d!==i.memoizedState&&(He.flags|=2048,Ga(9,{destroy:void 0},z2.bind(null,y,d),null)),[u,x,o]}function z2(o,i){o.action=i}function Fb(o){var i=$t(),d=lt;if(d!==null)return zb(i,d,o);$t(),i=i.memoizedState,d=$t();var u=d.queue.dispatch;return d.memoizedState=o,[i,u,!1]}function Ga(o,i,d,u){return o={tag:o,create:d,deps:u,inst:i,next:null},i=He.updateQueue,i===null&&(i=Hu(),He.updateQueue=i),d=i.lastEffect,d===null?i.lastEffect=o.next=o:(u=d.next,d.next=o,o.next=u,i.lastEffect=o),o}function Bb(){return $t().memoizedState}function Wu(o,i,d,u){var y=ln();He.flags|=o,y.memoizedState=Ga(1|i,{destroy:void 0},d,u===void 0?null:u)}function Uu(o,i,d,u){var y=$t();u=u===void 0?null:u;var x=y.memoizedState.inst;lt!==null&&u!==null&&Sp(u,lt.memoizedState.deps)?y.memoizedState=Ga(i,x,d,u):(He.flags|=o,y.memoizedState=Ga(1|i,x,d,u))}function qb(o,i){Wu(8390656,8,o,i)}function Op(o,i){Uu(2048,8,o,i)}function F2(o){He.flags|=4;var i=He.updateQueue;if(i===null)i=Hu(),He.updateQueue=i,i.events=[o];else{var d=i.events;d===null?i.events=[o]:d.push(o)}}function Hb(o){var i=$t().memoizedState;return F2({ref:i,nextImpl:o}),function(){if(nt&2)throw Error(a(440));return i.impl.apply(void 0,arguments)}}function Vb(o,i){return Uu(4,2,o,i)}function Kb(o,i){return Uu(4,4,o,i)}function Wb(o,i){if(typeof i=="function"){o=o();var d=i(o);return function(){typeof d=="function"?d():i(null)}}if(i!=null)return o=o(),i.current=o,function(){i.current=null}}function Ub(o,i,d){d=d==null?null:d.concat([o]),Uu(4,4,Wb.bind(null,i,o),d)}function Pp(){}function Yb(o,i){var d=$t();i=i===void 0?null:i;var u=d.memoizedState;return i!==null&&Sp(i,u[1])?u[0]:(d.memoizedState=[o,i],o)}function Xb(o,i){var d=$t();i=i===void 0?null:i;var u=d.memoizedState;if(i!==null&&Sp(i,u[1]))return u[0];if(u=o(),Ki){In(!0);try{o()}finally{In(!1)}}return d.memoizedState=[u,i],u}function Dp(o,i,d){return d===void 0||lr&1073741824&&!(Qe&261930)?o.memoizedState=i:(o.memoizedState=d,o=nw(),He.lanes|=o,ei|=o,d)}function Zb(o,i,d,u){return jn(d,i)?d:Yr.current===null?!(lr&106)||lr&1073741824&&!(Qe&261930)?(Ot=!0,o.memoizedState=d):(o=nw(),He.lanes|=o,ei|=o,i):(o=Dp(o,d,u),jn(o,i)||(Ot=!0),o)}function Gb(o,i,d,u,y){var x=de.p;de.p=x!==0&&8>x?x:8;var C=ee.T,P={};P.types=C===null?null:C.types,ee.T=P,Rp(o,!1,i,d);try{var H=y(),ie=ee.S;ie!==null&&ie(P,H),typeof H=="object"&&H&&typeof H.then=="function"?Ol(o,i,D2(H,u),Hn(o)):Ol(o,i,u,Hn(o))}catch(ce){Ol(o,i,{then:function(){},status:"rejected",reason:ce},Hn())}finally{de.p=x,C!==null&&P.types!==null&&(C.types=P.types),ee.T=C}}function B2(){}function Ip(o,i,d,u){if(o.tag!==5)throw Error(a(476));var y=Qb(o).queue;Gb(o,y,i,me,d===null?B2:function(){return Jb(o),d(u)})}function Qb(o){var i=o.memoizedState;if(i!==null)return i;i={memoizedState:me,baseState:me,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:dr,lastRenderedState:me},next:null};var d={};return i.next={memoizedState:d,baseState:d,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:dr,lastRenderedState:d},next:null},o.memoizedState=i,o=o.alternate,o!==null&&(o.memoizedState=i),i}function Jb(o){var i=Qb(o);i.next===null&&(i=o.alternate.memoizedState),Ol(o,i.next.queue,{},Hn())}function Lp(){return Gt(gs)}function ex(){return $t().memoizedState}function tx(){return $t().memoizedState}function q2(o){for(var i=o.return;i!==null;){switch(i.tag){case 24:case 3:var d=Hn();o=Hi(d);var u=Vi(i,o,d);u!==null&&(xn(u,i,d),$l(u,i,d)),i={cache:cp()},o.payload=i;return}i=i.return}}function H2(o,i,d){var u=Hn();d={lane:u,revertLane:0,gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null},Yu(o)?ox(i,d):(d=np(o,i,d,u),d!==null&&(xn(d,o,u),rx(d,i,u)))}function nx(o,i,d){Ol(o,i,d,Hn())}function Ol(o,i,d,u){var y={lane:u,revertLane:0,gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null};if(Yu(o))ox(i,y);else{var x=o.alternate;if(o.lanes===0&&(x===null||x.lanes===0)&&(x=i.lastRenderedReducer,x!==null))try{var C=i.lastRenderedState,P=x(C,d);if(y.hasEagerState=!0,y.eagerState=P,jn(P,C))return ju(o,i,y,0),ct===null&&Nu(),!1}catch{}if(d=np(o,i,y,u),d!==null)return xn(d,o,u),rx(d,i,u),!0}return!1}function Rp(o,i,d,u){if(u={lane:2,revertLane:Em(),gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},Yu(o)){if(i)throw Error(a(479))}else i=np(o,d,u,2),i!==null&&xn(i,o,2)}function Yu(o){var i=o.alternate;return o===He||i!==null&&i===He}function ox(o,i){Xa=Bu=!0;var d=o.pending;d===null?i.next=i:(i.next=d.next,d.next=i),o.pending=i}function rx(o,i,d){if(d&4194048){var u=i.lanes;u&=o.pendingLanes,d|=u,i.lanes=d,_i(o,d)}}var Xu={readContext:Gt,use:Vu,useCallback:St,useContext:St,useEffect:St,useImperativeHandle:St,useLayoutEffect:St,useInsertionEffect:St,useMemo:St,useReducer:St,useRef:St,useState:St,useDebugValue:St,useDeferredValue:St,useTransition:St,useSyncExternalStore:St,useId:St,useHostTransitionStatus:St,useFormState:St,useActionState:St,useOptimistic:St,useMemoCache:St,useCacheRefresh:St,useEffectEvent:St},ix={readContext:Gt,use:Vu,useCallback:function(o,i){return ln().memoizedState=[o,i===void 0?null:i],o},useContext:Gt,useEffect:qb,useImperativeHandle:function(o,i,d){d=d==null?null:d.concat([o]),Wu(4194308,4,Wb.bind(null,i,o),d)},useLayoutEffect:function(o,i){return Wu(4194308,4,o,i)},useInsertionEffect:function(o,i){Wu(4,2,o,i)},useMemo:function(o,i){var d=ln();i=i===void 0?null:i;var u=o();if(Ki){In(!0);try{o()}finally{In(!1)}}return d.memoizedState=[u,i],u},useReducer:function(o,i,d){var u=ln();if(d!==void 0){var y=d(i);if(Ki){In(!0);try{d(i)}finally{In(!1)}}}else y=i;return u.memoizedState=u.baseState=y,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:o,lastRenderedState:y},u.queue=o,o=o.dispatch=H2.bind(null,He,o),[u.memoizedState,o]},useRef:function(o){var i=ln();return o={current:o},i.memoizedState=o},useState:function(o){o=Tp(o);var i=o.queue,d=nx.bind(null,He,i);return i.dispatch=d,[o.memoizedState,d]},useDebugValue:Pp,useDeferredValue:function(o,i){return Dp(ln(),o,i)},useTransition:function(){var o=Tp(!1);return o=Gb.bind(null,He,o.queue,!0,!1),ln().memoizedState=o,[!1,o]},useSyncExternalStore:function(o,i,d){var u=He,y=ln();if(We){if(d===void 0)throw Error(a(407));d=d()}else{if(d=i(),ct===null)throw Error(a(349));Qe&127||Cb(u,i,d)}y.memoizedState=d;var x={value:d,getSnapshot:i};return y.queue=x,qb(Eb.bind(null,u,x,o),[o]),u.flags|=2048,Ga(9,{destroy:void 0},$b.bind(null,u,x,d,i),null),d},useId:function(){var o=ln(),i=ct.identifierPrefix;if(We){var d=So,u=ko;d=(u&~(1<<32-qt(u)-1)).toString(32)+d,i="_"+i+"R_"+d,d=qu++,0<d&&(i+="H"+d.toString(32)),i+="_"}else d=I2++,i="_"+i+"r_"+d.toString(32)+"_";return o.memoizedState=i},useHostTransitionStatus:Lp,useFormState:Lb,useActionState:Lb,useOptimistic:function(o){var i=ln();i.memoizedState=i.baseState=o;var d={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return i.queue=d,i=Rp.bind(null,He,!0,d),d.dispatch=i,[o,i]},useMemoCache:Ep,useCacheRefresh:function(){return ln().memoizedState=q2.bind(null,He)},useEffectEvent:function(o){var i=ln(),d={impl:o};return i.memoizedState=d,function(){if(nt&2)throw Error(a(440));return d.impl.apply(void 0,arguments)}}},ax={readContext:Gt,use:Vu,useCallback:Yb,useContext:Gt,useEffect:Op,useImperativeHandle:Ub,useInsertionEffect:Vb,useLayoutEffect:Kb,useMemo:Xb,useReducer:Ku,useRef:Bb,useState:function(){return Ku(dr)},useDebugValue:Pp,useDeferredValue:function(o,i){return Zb($t(),lt.memoizedState,o,i)},useTransition:function(){var o=Ku(dr)[0],i=$t().memoizedState;return[typeof o=="boolean"?o:Ml(o),i]},useSyncExternalStore:jb,useId:ex,useHostTransitionStatus:Lp,useFormState:Rb,useActionState:Rb,useOptimistic:function(o,i){return Tb($t(),lt,o,i)},useMemoCache:Ep,useCacheRefresh:tx,useEffectEvent:Hb},V2={readContext:Gt,use:Vu,useCallback:Yb,useContext:Gt,useEffect:Op,useImperativeHandle:Ub,useInsertionEffect:Vb,useLayoutEffect:Kb,useMemo:Xb,useReducer:Ap,useRef:Bb,useState:function(){return Ap(dr)},useDebugValue:Pp,useDeferredValue:function(o,i){var d=$t();return lt===null?Dp(d,o,i):Zb(d,lt.memoizedState,o,i)},useTransition:function(){var o=Ap(dr)[0],i=$t().memoizedState;return[typeof o=="boolean"?o:Ml(o),i]},useSyncExternalStore:jb,useId:ex,useHostTransitionStatus:Lp,useFormState:Fb,useActionState:Fb,useOptimistic:function(o,i){var d=$t();return lt===null?(d.baseState=o,[o,d.queue.dispatch]):Tb(d,lt,o,i)},useMemoCache:Ep,useCacheRefresh:tx,useEffectEvent:Hb};function zp(o,i,d,u){i=o.memoizedState,d=d(u,i),d=d==null?i:M({},i,d),o.memoizedState=d,o.lanes===0&&(o.updateQueue.baseState=d)}var Fp={enqueueSetState:function(o,i,d){o=o._reactInternals;var u=Hn(),y=Hi(u);y.payload=i,d!=null&&(y.callback=d),i=Vi(o,y,u),i!==null&&(xn(i,o,u),$l(i,o,u))},enqueueReplaceState:function(o,i,d){o=o._reactInternals;var u=Hn(),y=Hi(u);y.tag=1,y.payload=i,d!=null&&(y.callback=d),i=Vi(o,y,u),i!==null&&(xn(i,o,u),$l(i,o,u))},enqueueForceUpdate:function(o,i){o=o._reactInternals;var d=Hn(),u=Hi(d);u.tag=2,i!=null&&(u.callback=i),i=Vi(o,u,d),i!==null&&(xn(i,o,d),$l(i,o,d))}};function sx(o,i,d,u,y,x,C){return o=o.stateNode,typeof o.shouldComponentUpdate=="function"?o.shouldComponentUpdate(u,x,C):i.prototype&&i.prototype.isPureReactComponent?!bl(d,u)||!bl(y,x):!0}function lx(o,i,d,u){o=i.state,typeof i.componentWillReceiveProps=="function"&&i.componentWillReceiveProps(d,u),typeof i.UNSAFE_componentWillReceiveProps=="function"&&i.UNSAFE_componentWillReceiveProps(d,u),i.state!==o&&Fp.enqueueReplaceState(i,i.state,null)}function Wi(o,i){var d=i;if("ref"in i)for(var u in d={},i)u!=="ref"&&(d[u]=i[u]);if(o=o.defaultProps)for(var y in d===i&&(d=M({},d)),o)d[y]===void 0&&(d[y]=o[y]);return d}function K2(o){Su(o)}function W2(o){console.error(o)}function U2(o){Su(o)}function Zu(o,i){try{var d=o.onUncaughtError;d(i.value,{componentStack:i.stack})}catch(u){setTimeout(function(){throw u})}}function dx(o,i,d){try{var u=o.onCaughtError;u(d.value,{componentStack:d.stack,errorBoundary:i.tag===1?i.stateNode:null})}catch(y){setTimeout(function(){throw y})}}function Bp(o,i,d){return d=Hi(d),d.tag=3,d.payload={element:null},d.callback=function(){Zu(o,i)},d}function ux(o){return o=Hi(o),o.tag=3,o}function cx(o,i,d,u){var y=d.type.getDerivedStateFromError;if(typeof y=="function"){var x=u.value;o.payload=function(){return y(x)},o.callback=function(){dx(i,d,u)}}var C=d.stateNode;C!==null&&typeof C.componentDidCatch=="function"&&(o.callback=function(){dx(i,d,u),typeof y!="function"&&(ti===null?ti=new Set([this]):ti.add(this));var P=u.stack;this.componentDidCatch(u.value,{componentStack:P===null?"":P})})}function Y2(o,i,d,u,y){if(d.flags|=32768,typeof u=="object"&&u&&typeof u.then=="function"){if(i=d.alternate,i!==null&&Ii(i,d,y,!0),d=Qt.current,d!==null){switch(d.tag){case 31:case 13:case 19:return sn===null?yc():d.alternate===null&&Nt===0&&(Nt=3),d.flags&=-257,d.flags|=65536,d.lanes=y,u===Iu?d.flags|=16384:(i=d.updateQueue,i===null?d.updateQueue=new Set([u]):i.add(u),jm(o,u,y)),!1;case 22:return d.flags|=65536,u===Iu?d.flags|=16384:(i=d.updateQueue,i===null?(i={transitions:null,markerInstances:null,retryQueue:new Set([u])},d.updateQueue=i):(d=i.retryQueue,d===null?i.retryQueue=new Set([u]):d.add(u)),jm(o,u,y)),!1}throw Error(a(435,d.tag))}return jm(o,u,y),yc(),!1}if(We)return i=Qt.current,i===null?(u!==sp&&(i=Error(a(423),{cause:u}),kl(Rn(i,d))),o=o.current.alternate,o.flags|=65536,y&=-y,o.lanes|=y,u=Rn(u,d),y=Bp(o.stateNode,u,y),yp(o,y),Nt!==4&&(Nt=2)):(!(i.flags&65536)&&(i.flags|=256),i.flags|=65536,i.lanes=y,u!==sp&&(o=Error(a(422),{cause:u}),kl(Rn(o,d)))),!1;var x=Error(a(520),{cause:u});if(x=Rn(x,d),Bl===null?Bl=[x]:Bl.push(x),Nt!==4&&(Nt=2),i===null)return!0;u=Rn(u,d),d=i;do{switch(d.tag){case 3:return d.flags|=65536,o=y&-y,d.lanes|=o,o=Bp(d.stateNode,u,o),yp(d,o),!1;case 1:if(i=d.type,x=d.stateNode,!(d.flags&128)&&(typeof i.getDerivedStateFromError=="function"||x!==null&&typeof x.componentDidCatch=="function"&&(ti===null||!ti.has(x))))return d.flags|=65536,y&=-y,d.lanes|=y,y=ux(y),cx(y,o,d,u),yp(d,y),!1;break;case 22:if(d.memoizedState!==null)return d.flags|=65536,!1}d=d.return}while(d!==null);return!1}var qp=Error(a(461)),Ot=!1;function Lt(o,i,d,u){i.child=o===null?vb(i,null,d,u):qi(i,o.child,d,u)}function fx(o,i,d,u,y){d=d.render;var x=i.ref;if("ref"in u){var C={};for(var P in u)P!=="ref"&&(C[P]=u[P])}else C=u;return Li(i),u=Np(o,i,d,C,x,y),P=jp(),o!==null&&!Ot?(Cp(o,i,y),ur(o,i,y)):(We&&P&&_u(i),i.flags|=1,Lt(o,i,u,y),i.child)}function hx(o,i,d,u,y){if(o===null){var x=d.type;return typeof x=="function"&&!op(x)&&x.defaultProps===void 0&&d.compare===null?(i.tag=15,i.type=x,px(o,i,x,u,y)):(o=$u(d.type,null,u,i,i.mode,y),o.ref=i.ref,o.return=i,i.child=o)}if(x=o.child,!Zp(o,y)){var C=x.memoizedProps;if(d=d.compare,d=d===null?bl:d,d(C,u)&&o.ref===i.ref)return ur(o,i,y)}return i.flags|=1,o=rr(x,u),o.ref=i.ref,o.return=i,i.child=o}function px(o,i,d,u,y){if(o!==null){var x=o.memoizedProps;if(bl(x,u)&&o.ref===i.ref)if(Ot=!1,i.pendingProps=u=x,Zp(o,y))o.flags&131072&&(Ot=!0);else return i.lanes=o.lanes,ur(o,i,y)}return Hp(o,i,d,u,y)}function mx(o,i,d,u){var y=u.children,x=o===null?null:o.memoizedState;if(o===null&&i.stateNode===null&&(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),u.mode==="hidden"){if(i.flags&128){if(x=x===null?d:x.baseLanes|d,o!==null){for(u=i.child=o.child,y=0;u!==null;)y=y|u.lanes|u.childLanes,u=u.sibling;u=y&~x}else u=0,i.child=null;return gx(o,i,x,d,u)}if(d&536870912)i.memoizedState={baseLanes:0,cachePool:null},o!==null&&Pu(i,x===null?null:x.cachePool),x===null?bp():wb(i,x),kb(i);else return u=i.lanes=536870912,gx(o,i,x===null?d:x.baseLanes|d,d,u)}else x===null?(o!==null&&Pu(i,null),bp(),Zr()):(Pu(i,x.cachePool),wb(i,x),Zr(),i.memoizedState=null);return Lt(o,i,y,d),i.child}function Pl(o,i){return o!==null&&o.tag===22||i.stateNode!==null||(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),i.sibling}function gx(o,i,d,u,y){var x=hp();return x=x===null?null:{parent:Tt._currentValue,pool:x},i.memoizedState={baseLanes:d,cachePool:x},o!==null&&Pu(i,null),bp(),kb(i),o!==null&&Ii(o,i,u,!0),i.childLanes=y,null}function Gu(o,i){return i=Qu({mode:i.mode,children:i.children},o.mode),i.ref=o.ref,o.child=i,i.return=o,i}function yx(o,i,d){return qi(i,o.child,null,d),o=Gu(i,i.pendingProps),o.flags|=2,Cn(i),i.memoizedState=null,o}function X2(o,i,d){var u=i.pendingProps,y=!!(i.flags&128);if(i.flags&=-129,o===null){if(We){if(u.mode==="hidden")return o=Gu(i,u),i.lanes=536870912,o.memoizedState={baseLanes:0,cachePool:null},Pl(null,o);if(wp(i),(o=ft)?(o=Kw(o,Bn),o=o!==null&&o.data==="&"?o:null,o!==null&&(i.memoizedState={dehydrated:o,treeContext:qr===null?null:{id:ko,overflow:So},retryLane:536870912,hydrationErrors:null},d=ob(o),d.return=i,i.child=d,Vt=i,ft=null)):o=null,o===null)throw Vr(i);return i.lanes=536870912,null}return Gu(i,u)}var x=o.memoizedState;if(x!==null){var C=x.dehydrated;if(wp(i),y)if(i.flags&256)i.flags&=-257,i=yx(o,i,d);else if(i.memoizedState!==null)i.child=o.child,i.flags|=128,i=null;else throw Error(a(558));else if(Ot||Ii(o,i,d,!1),y=(d&o.childLanes)!==0,Ot||y){if(Yr.current===null){if(u=ct,u!==null&&(C=Dr(u,d),C!==0&&C!==x.retryLane))throw x.retryLane=C,Mi(o,C),xn(u,o,C),qp;yc()}i=yx(o,i,d)}else o=x.treeContext,ft=Vn(C.nextSibling),Vt=i,We=!0,Hr=null,Bn=!1,o!==null&&ab(i,o),i=Gu(i,u),i.flags|=134221824;return i}return o=rr(o.child,{mode:u.mode,children:u.children}),o.ref=i.ref,i.child=o,o.return=i,o}function Qa(o,i){var d=i.ref;if(d===null)o!==null&&o.ref!==null&&(i.flags|=4194816);else{if(typeof d!="function"&&typeof d!="object")throw Error(a(284));(o===null||o.ref!==d)&&(i.flags|=4194816)}}function Hp(o,i,d,u,y){return Li(i),d=Np(o,i,d,u,void 0,y),u=jp(),o!==null&&!Ot?(Cp(o,i,y),ur(o,i,y)):(We&&u&&_u(i),i.flags|=1,Lt(o,i,d,y),i.child)}function vx(o,i,d,u,y,x){return Li(i),i.updateQueue=null,d=Nb(i,u,d,y),Sb(o),u=jp(),o!==null&&!Ot?(Cp(o,i,x),ur(o,i,x)):(We&&u&&_u(i),i.flags|=1,Lt(o,i,d,x),i.child)}function bx(o,i,d,u,y){if(Li(i),i.stateNode===null){var x=qa,C=d.contextType;typeof C=="object"&&C&&(x=Gt(C)),x=new d(u,x),i.memoizedState=x.state!==null&&x.state!==void 0?x.state:null,x.updater=Fp,i.stateNode=x,x._reactInternals=i,x=i.stateNode,x.props=u,x.state=i.memoizedState,x.refs={},mp(i),C=d.contextType,x.context=typeof C=="object"&&C?Gt(C):qa,x.state=i.memoizedState,C=d.getDerivedStateFromProps,typeof C=="function"&&(zp(i,d,C,u),x.state=i.memoizedState),typeof d.getDerivedStateFromProps=="function"||typeof x.getSnapshotBeforeUpdate=="function"||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(C=x.state,typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount(),C!==x.state&&Fp.enqueueReplaceState(x,x.state,null),_l(i,u,x,y),El(),x.state=i.memoizedState),typeof x.componentDidMount=="function"&&(i.flags|=4194308),u=!0}else if(o===null){x=i.stateNode;var P=i.memoizedProps,H=Wi(d,P);x.props=H;var ie=x.context,ce=d.contextType;C=qa,typeof ce=="object"&&ce&&(C=Gt(ce));var ye=d.getDerivedStateFromProps;ce=typeof ye=="function"||typeof x.getSnapshotBeforeUpdate=="function",P=i.pendingProps!==P,ce||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(P||ie!==C)&&lx(i,x,u,C),Ur=!1;var te=i.memoizedState;x.state=te,_l(i,u,x,y),El(),ie=i.memoizedState,P||te!==ie||Ur?(typeof ye=="function"&&(zp(i,d,ye,u),ie=i.memoizedState),(H=Ur||sx(i,d,H,u,te,ie,C))?(ce||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount()),typeof x.componentDidMount=="function"&&(i.flags|=4194308)):(typeof x.componentDidMount=="function"&&(i.flags|=4194308),i.memoizedProps=u,i.memoizedState=ie),x.props=u,x.state=ie,x.context=C,u=H):(typeof x.componentDidMount=="function"&&(i.flags|=4194308),u=!1)}else{x=i.stateNode,gp(o,i),C=i.memoizedProps,ce=Wi(d,C),x.props=ce,ye=i.pendingProps,te=x.context,ie=d.contextType,H=qa,typeof ie=="object"&&ie&&(H=Gt(ie)),P=d.getDerivedStateFromProps,(ie=typeof P=="function"||typeof x.getSnapshotBeforeUpdate=="function")||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(C!==ye||te!==H)&&lx(i,x,u,H),Ur=!1,te=i.memoizedState,x.state=te,_l(i,u,x,y),El();var ue=i.memoizedState;C!==ye||te!==ue||Ur||o!==null&&o.dependencies!==null&&Mu(o.dependencies)?(typeof P=="function"&&(zp(i,d,P,u),ue=i.memoizedState),(ce=Ur||sx(i,d,ce,u,te,ue,H)||o!==null&&o.dependencies!==null&&Mu(o.dependencies))?(ie||typeof x.UNSAFE_componentWillUpdate!="function"&&typeof x.componentWillUpdate!="function"||(typeof x.componentWillUpdate=="function"&&x.componentWillUpdate(u,ue,H),typeof x.UNSAFE_componentWillUpdate=="function"&&x.UNSAFE_componentWillUpdate(u,ue,H)),typeof x.componentDidUpdate=="function"&&(i.flags|=4),typeof x.getSnapshotBeforeUpdate=="function"&&(i.flags|=1024)):(typeof x.componentDidUpdate!="function"||C===o.memoizedProps&&te===o.memoizedState||(i.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||C===o.memoizedProps&&te===o.memoizedState||(i.flags|=1024),i.memoizedProps=u,i.memoizedState=ue),x.props=u,x.state=ue,x.context=H,u=ce):(typeof x.componentDidUpdate!="function"||C===o.memoizedProps&&te===o.memoizedState||(i.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||C===o.memoizedProps&&te===o.memoizedState||(i.flags|=1024),u=!1)}return x=u,Qa(o,i),u=!!(i.flags&128),x||u?(x=i.stateNode,d=u&&typeof d.getDerivedStateFromError!="function"?null:x.render(),i.flags|=1,o!==null&&u?(i.child=qi(i,o.child,null,y),i.child=qi(i,null,d,y)):Lt(o,i,d,y),i.memoizedState=x.state,o=i.child):o=ur(o,i,y),o}function xx(o,i,d,u){return Pi(),i.flags|=256,Lt(o,i,d,u),i.child}var Vp={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Kp(o){return{baseLanes:o,cachePool:fb()}}function Wp(o,i,d){return o=o===null?0:o.childLanes&~d,i&&(o|=_n),o}function wx(o,i,d){var u=i.pendingProps,y=!1,x=!!(i.flags&128),C;if((C=x)||(C=o!==null&&o.memoizedState===null?!1:!!(Jt.current&2)),C&&(y=!0,i.flags&=-129),C=!!(i.flags&32),i.flags&=-33,o===null){if(We){if(y?Xr(i):Zr(),(o=ft)?(o=Kw(o,Bn),o=o!==null&&o.data!=="&"?o:null,o!==null&&(i.memoizedState={dehydrated:o,treeContext:qr===null?null:{id:ko,overflow:So},retryLane:536870912,hydrationErrors:null},d=ob(o),d.return=i,i.child=d,Vt=i,ft=null)):o=null,o===null)throw Vr(i);return i.lanes=Vm(o)?32:536870912,null}return x=u.children,u=u.fallback,y?(Zr(),y=i.mode,x=Qu({mode:"hidden",children:x},y),u=Oi(u,y,d,null),x.return=i,u.return=i,x.sibling=u,i.child=x,u=i.child,u.memoizedState=Kp(d),u.childLanes=Wp(o,C,d),i.memoizedState=Vp,Pl(null,u)):(Xr(i),Up(i,x))}var P=o.memoizedState;if(P!==null){var H=P.dehydrated;if(H!==null)return Z2(o,i,x,C,u,H,P,d)}return y?(Zr(),y=u.fallback,x=i.mode,P=o.child,H=P.sibling,u=rr(P,{mode:"hidden",children:u.children}),u.subtreeFlags=P.subtreeFlags&1206910976,H===null?(y=Oi(y,x,d,null),y.flags|=2):y=rr(H,y),y.return=i,u.return=i,u.sibling=y,i.child=u,Pl(null,u),u=i.child,y=o.child.memoizedState,y===null?y=Kp(d):(x=y.cachePool,x===null?x=fb():(P=Tt._currentValue,x=x.parent===P?x:{parent:P,pool:P}),y={baseLanes:y.baseLanes|d,cachePool:x}),u.memoizedState=y,u.childLanes=Wp(o,C,d),i.memoizedState=Vp,Pl(o.child,u)):(Xr(i),d=o.child,o=d.sibling,d=rr(d,{mode:"visible",children:u.children}),d.return=i,d.sibling=null,o!==null&&(C=i.deletions,C===null?(i.deletions=[o],i.flags|=16):C.push(o)),i.child=d,i.memoizedState=null,d)}function Up(o,i){return i=Qu({mode:"visible",children:i},o.mode),i.return=o,o.child=i}function Qu(o,i){return o=gn(22,o,null,i),o.lanes=0,o}function Ju(o,i,d){return qi(i,o.child,null,d),o=Up(i,i.pendingProps.children),o.flags|=2,i.memoizedState=null,o}function Z2(o,i,d,u,y,x,C,P){if(d)return i.flags&256?(Xr(i),i.flags&=-257,Ju(o,i,P)):i.memoizedState===null?(Zr(),x=y.fallback,C=i.mode,y=Qu({mode:"visible",children:y.children},C),x=Oi(x,C,P,null),x.flags|=2,y.return=i,x.return=i,y.sibling=x,i.child=y,qi(i,o.child,null,P),y=i.child,y.memoizedState=Kp(P),y.childLanes=Wp(o,u,P),i.memoizedState=Vp,Pl(null,y)):(Zr(),i.child=o.child,i.flags|=128,null);if(Xr(i),Vm(x)){if(u=x.nextSibling&&x.nextSibling.dataset,u)var H=u.dgst;return u=H,u!==""&&(y=Error(a(419)),y.stack="",y.digest=u,kl({value:y,source:null,stack:null})),Ju(o,i,P)}if(Ot||Ii(o,i,P,!1),u=(P&o.childLanes)!==0,Ot||u){if(Yr.current!==null)return Ju(o,i,P);if(u=ct,u!==null&&(y=Dr(u,P),y!==0&&y!==C.retryLane))throw C.retryLane=y,Mi(o,y),xn(u,o,y),qp;return Hm(x)||yc(),Ju(o,i,P)}return Hm(x)?(i.flags|=192,i.child=o.child,null):(o=C.treeContext,ft=Vn(x.nextSibling),Vt=i,We=!0,Hr=null,Bn=!1,o!==null&&ab(i,o),i=Up(i,y.children),i.flags|=134221824,i)}function kx(o,i,d){o.lanes|=i;var u=o.alternate;u!==null&&(u.lanes|=i),Tu(o.return,i,d)}function Sx(o){for(var i=null;o!==null;){var d=o.alternate;d!==null&&Fu(d)===null&&(i=o),o=o.sibling}return i}function ec(o,i,d,u,y,x){var C=o.memoizedState;C===null?o.memoizedState={isBackwards:i,rendering:null,renderingStartTime:0,last:u,tail:d,tailMode:y,treeForkCount:x}:(C.isBackwards=i,C.rendering=null,C.renderingStartTime=0,C.last=u,C.tail=d,C.tailMode=y,C.treeForkCount=x)}function Yp(o){var i=o.child;for(o.child=null;i!==null;){var d=i.sibling;i.sibling=o.child,o.child=i,i=d}}function Xp(o,i,d){var u=i.pendingProps,y=u.revealOrder,x=u.tail;u=u.children;var C=Jt.current;if(i.flags&128)return Al(i,C),null;var P=!!(C&2);if(P?(C=C&1|2,i.flags|=128):C&=1,Al(i,C),y==="backwards"&&o!==null?(Yp(o),Lt(o,i,u,d),Yp(o)):Lt(o,i,u,d),u=We?wl:0,!P&&o!==null&&o.flags&128)e:for(o=i.child;o!==null;){if(o.tag===13)o.memoizedState!==null&&kx(o,d,i);else if(o.tag===19)kx(o,d,i);else if(o.child!==null){o.child.return=o,o=o.child;continue}if(o===i)break e;for(;o.sibling===null;){if(o.return===null||o.return===i)break e;o=o.return}o.sibling.return=o.return,o=o.sibling}switch(y){case"backwards":d=Sx(i.child),d===null?(y=i.child,i.child=null):(y=d.sibling,d.sibling=null,Yp(i)),ec(i,!0,y,null,x,u);break;case"unstable_legacy-backwards":for(d=null,y=i.child,i.child=null;y!==null;){if(o=y.alternate,o!==null&&Fu(o)===null){i.child=y;break}o=y.sibling,y.sibling=d,d=y,y=o}ec(i,!0,d,null,x,u);break;case"together":ec(i,!1,null,null,void 0,u);break;case"independent":i.memoizedState=null;break;default:d=Sx(i.child),d===null?(y=i.child,i.child=null):(y=d.sibling,d.sibling=null),ec(i,!1,y,d,x,u)}return i.child}function Nx(o,i,d){var u=i.pendingProps;return Kr(i,i.type,u.value),Lt(o,i,u.children,d),i.child}function ur(o,i,d){if(o!==null&&(i.dependencies=o.dependencies),ei|=i.lanes,(d&i.childLanes)===0)if(o!==null){if(Ii(o,i,d,!1),(d&i.childLanes)===0)return null}else return null;if(o!==null&&i.child!==o.child)throw Error(a(153));if(i.child!==null){for(o=i.child,d=rr(o,o.pendingProps),i.child=d,d.return=i;o.sibling!==null;)o=o.sibling,d=d.sibling=rr(o,o.pendingProps),d.return=i;d.sibling=null}return i.child}function Zp(o,i){return(o.lanes&i)!==0||(o=o.dependencies,!!(o!==null&&Mu(o)))}function G2(o,i,d){switch(i.tag){case 3:hn(i,i.stateNode.containerInfo),Kr(i,Tt,o.memoizedState.cache),Pi();break;case 27:case 5:Bt(i);break;case 4:hn(i,i.stateNode.containerInfo);break;case 10:Kr(i,i.type,i.memoizedProps.value);break;case 31:if(i.memoizedState!==null)return i.flags|=128,wp(i),null;break;case 13:var u=i.memoizedState;if(u!==null){if(u.dehydrated!==null)return Xr(i),i.flags|=128,null;u=Ii(o,i,d,!1);var y=i.child.childLanes;return u||(d&y)!==0?wx(o,i,d):(Xr(i),o=ur(o,i,d),o===null?null:o.sibling)}Xr(i);break;case 19:if(i.flags&128)return Xp(o,i,d);if(y=!!(o.flags&128),u=(d&i.childLanes)!==0,u||=(Ii(o,i,d,!1),(d&i.childLanes)!==0),y){if(u)return Xp(o,i,d);i.flags|=128}if(y=i.memoizedState,y!==null&&(y.rendering=null,y.tail=null,y.lastEffect=null),Al(i,Jt.current),u)break;return null;case 22:return i.lanes=0,mx(o,i,d,i.pendingProps);case 24:Kr(i,Tt,o.memoizedState.cache)}return ur(o,i,d)}function jx(o,i,d){if(o!==null)if(o.memoizedProps!==i.pendingProps)Ot=!0;else{if(!Zp(o,d)&&!(i.flags&128))return Ot=!1,G2(o,i,d);Ot=!!(o.flags&131072)}else Ot=!1,We&&i.flags&1048576&&ib(i,wl,i.index);switch(i.lanes=0,i.tag){case 16:e:{var u=i.pendingProps;if(o=Fi(i.elementType),i.type=o,typeof o=="function")op(o)?(u=Wi(o,u),i.tag=1,i=bx(null,i,o,u,d)):(i.tag=0,i=Hp(null,i,o,u,d));else{if(o!=null){var y=o.$$typeof;if(y===U){i.tag=11,i=fx(null,i,o,u,d);break e}if(y===le){i.tag=14,i=hx(null,i,o,u,d);break e}if(y===L){i.tag=10,i.type=o,i=Nx(null,i,d);break e}}throw i=Z(o)||o,Error(a(306,i,""))}}return i;case 0:return Hp(o,i,i.type,i.pendingProps,d);case 1:return u=i.type,y=Wi(u,i.pendingProps),bx(o,i,u,y,d);case 3:e:{if(hn(i,i.stateNode.containerInfo),o===null)throw Error(a(387));u=i.pendingProps;var x=i.memoizedState;y=x.element,gp(o,i),_l(i,u,null,d);var C=i.memoizedState;if(u=C.cache,Kr(i,Tt,u),u!==x.cache&&up(i,[Tt],d,!0),El(),u=C.element,x.isDehydrated){if(x={element:u,isDehydrated:!1,cache:C.cache},i.updateQueue.baseState=x,i.memoizedState=x,i.flags&256){i=xx(o,i,u,d);break e}if(u!==y){y=Rn(Error(a(424)),i),kl(y),i=xx(o,i,u,d);break e}for((o=i.stateNode.containerInfo,o.nodeType)===9?o=o.body:o=o.nodeName==="HTML"?o.ownerDocument.body:o,ft=Vn(o.firstChild),Vt=i,We=!0,Hr=null,Bn=!0,d=vb(i,null,u,d),i.child=d;d;)d.flags=d.flags&-3|134221824,d=d.sibling}else{if(Pi(),u===y){i=ur(o,i,d);break e}Lt(o,i,u,d)}i=i.child}return i;case 26:return Qa(o,i),o===null?(d=Qw(i.type,null,i.pendingProps,null))?i.memoizedState=d:We||(i.stateNode=Aw(i.type,i.pendingProps,It.current,i)):i.memoizedState=Qw(i.type,o.memoizedProps,i.pendingProps,o.memoizedState),null;case 27:return Bt(i),o===null&&We&&(u=i.stateNode=Yw(i.type,i.pendingProps,It.current),Vt=i,Bn=!0,y=ft,ri(i.type)?(Km=y,ft=Vn(u.firstChild)):ft=y),Lt(o,i,i.pendingProps.children,d),Qa(o,i),o===null&&(i.flags|=4194304),i.child;case 5:return o===null&&We&&((y=u=ft)&&(u=HA(u,i.type,i.pendingProps,Bn),u===null?y=!1:(i.stateNode=u,Vt=i,ft=Vn(u.firstChild),Bn=!1,y=!0)),y||Vr(i)),Bt(i),y=i.type,x=i.pendingProps,C=o===null?null:o.memoizedProps,u=x.children,Im(y,x)?u=null:C!==null&&Im(y,C)&&(i.flags|=32),i.memoizedState!==null&&(y=Np(o,i,L2,null,null,d),gs._currentValue=y),Qa(o,i),Lt(o,i,u,d),i.child;case 6:return o===null&&We&&((o=d=ft)&&(d=VA(d,i.pendingProps,Bn),d===null?o=!1:(i.stateNode=d,Vt=i,ft=null,o=!0)),o||Vr(i)),null;case 13:return wx(o,i,d);case 4:return hn(i,i.stateNode.containerInfo),u=i.pendingProps,o===null?i.child=qi(i,null,u,d):Lt(o,i,u,d),i.child;case 11:return fx(o,i,i.type,i.pendingProps,d);case 7:return u=i.pendingProps,Qa(o,i),Lt(o,i,u,d),i.child;case 8:return Lt(o,i,i.pendingProps.children,d),i.child;case 12:return Lt(o,i,i.pendingProps.children,d),i.child;case 10:return Nx(o,i,d);case 9:return y=i.type._context,u=i.pendingProps.children,Li(i),y=Gt(y),u=u(y),i.flags|=1,Lt(o,i,u,d),i.child;case 14:return hx(o,i,i.type,i.pendingProps,d);case 15:return px(o,i,i.type,i.pendingProps,d);case 19:return Xp(o,i,d);case 31:return X2(o,i,d);case 22:return mx(o,i,d,i.pendingProps);case 24:return Li(i),u=Gt(Tt),o===null?(y=hp(),y===null&&(y=ct,x=cp(),y.pooledCache=x,x.refCount++,x!==null&&(y.pooledCacheLanes|=d),y=x),i.memoizedState={parent:u,cache:y},mp(i),Kr(i,Tt,y)):((o.lanes&d)!==0&&(gp(o,i),_l(i,null,null,d),El()),y=o.memoizedState,x=i.memoizedState,y.parent===u?(u=x.cache,Kr(i,Tt,u),u!==y.cache&&up(i,[Tt],d,!0)):(y={parent:u,cache:u},i.memoizedState=y,i.lanes===0&&(i.memoizedState=i.updateQueue.baseState=y),Kr(i,Tt,u))),Lt(o,i,i.pendingProps.children,d),i.child;case 30:return i.stateNode===null&&(i.stateNode={autoName:null,paired:null,clones:null,ref:null}),u=i.pendingProps,u.name!=null&&u.name!=="auto"?i.flags|=o===null?18882560:18874368:We&&_u(i),o!==null&&o.memoizedProps.name!==u.name?i.flags|=4194816:Qa(o,i),Lt(o,i,u.children,d),i.child;case 29:throw i.pendingProps}throw Error(a(156,i.tag))}function cr(o){o.flags|=4}function Gp(o,i,d,u,y){var x;if((x=!!(o.mode&32))&&(x=d===null?nk(i,u):nk(i,u)&&(u.src!==d.src||u.srcSet!==d.srcSet)),x){if(o.flags|=16777216,(y&335544128)===y)if(o.stateNode.complete)o.flags|=8192;else if(aw())o.flags|=8192;else throw Bi=Iu,pp}else o.flags&=-16777217}function Cx(o,i){if(i.type!=="stylesheet"||i.state.loading&4)o.flags&=-16777217;else if(o.flags|=16777216,!ok(i))if(aw())o.flags|=8192;else throw Bi=Iu,pp}function tc(o,i){i!==null&&(o.flags|=4),o.flags&16384&&(i=o.tag===22?536870912:Ei(),o.lanes|=i,os|=i)}function Dl(o,i){if(!We)switch(o.tailMode){case"visible":break;case"collapsed":for(var d=o.tail,u=null;d!==null;)d.alternate!==null&&(u=d),d=d.sibling;u===null?i||o.tail===null?o.tail=null:o.tail.sibling=null:u.sibling=null;break;default:for(i=o.tail,d=null;i!==null;)i.alternate!==null&&(d=i),i=i.sibling;d===null?o.tail=null:d.sibling=null}}function ht(o){var i=o.alternate!==null&&o.alternate.child===o.child,d=0,u=0;if(i)for(var y=o.child;y!==null;)d|=y.lanes|y.childLanes,u|=y.subtreeFlags&1206910976,u|=y.flags&1206910976,y.return=o,y=y.sibling;else for(y=o.child;y!==null;)d|=y.lanes|y.childLanes,u|=y.subtreeFlags,u|=y.flags,y.return=o,y=y.sibling;return o.subtreeFlags|=u,o.childLanes=d,i}function Q2(o,i,d){var u=i.pendingProps;switch(ap(i),i.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ht(i),null;case 1:return ht(i),null;case 3:return d=i.stateNode,u=null,o!==null&&(u=o.memoizedState.cache),i.memoizedState.cache!==u&&(i.flags|=2048),sr(Tt),Ft(),d.pendingContext&&(d.context=d.pendingContext,d.pendingContext=null),(o===null||o.child===null)&&(Ka(i)?cr(i):o===null||o.memoizedState.isDehydrated&&!(i.flags&256)||(i.flags|=1024,lp())),ht(i),null;case 26:var y=i.type,x=i.memoizedState;return o===null?(cr(i),x===null?(ht(i),Gp(i,y,null,u,d)):(ht(i),Cx(i,x))):x?x===o.memoizedState?(ht(i),i.flags&=-16777217):(cr(i),ht(i),Cx(i,x)):(o=o.memoizedProps,o!==u&&cr(i),ht(i),Gp(i,y,o,u,d)),null;case 27:if(nn(i),d=It.current,y=i.type,o!==null&&i.stateNode!=null)o.memoizedProps!==u&&cr(i);else{if(!u){if(i.stateNode===null)throw Error(a(166));return ht(i),i.subtreeFlags&=-33554433,null}o=ut.current,Ka(i)?sb(i,o):(o=Yw(y,u,d),i.stateNode=o,cr(i))}return ht(i),i.subtreeFlags&=-33554433,null;case 5:if(nn(i),y=i.type,o!==null&&i.stateNode!=null)o.memoizedProps!==u&&cr(i);else{if(!u){if(i.stateNode===null)throw Error(a(166));return ht(i),i.subtreeFlags&=-33554433,null}if(x=ut.current,Ka(i))sb(i,x);else{var C=Wl(It.current);switch(x){case 1:x=C.createElementNS("http://www.w3.org/2000/svg",y);break;case 2:x=C.createElementNS("http://www.w3.org/1998/Math/MathML",y);break;default:switch(y){case"svg":x=C.createElementNS("http://www.w3.org/2000/svg",y);break;case"math":x=C.createElementNS("http://www.w3.org/1998/Math/MathML",y);break;case"script":x=C.createElement("div"),x.innerHTML="<script><\/script>",x=x.removeChild(x.firstChild);break;case"select":x=typeof u.is=="string"?C.createElement("select",{is:u.is}):C.createElement("select"),u.multiple?x.multiple=!0:u.size&&(x.size=u.size);break;default:x=typeof u.is=="string"?C.createElement(y,{is:u.is}):C.createElement(y)}}x[ke]=i,x[Te]=u;e:for(C=i.child;C!==null;){if(C.tag===5||C.tag===6)x.appendChild(C.stateNode);else if(C.tag!==4&&C.tag!==27&&C.child!==null){C.child.return=C,C=C.child;continue}if(C===i)break e;for(;C.sibling===null;){if(C.return===null||C.return===i)break e;C=C.return}C.sibling.return=C.return,C=C.sibling}i.stateNode=x;e:switch(tn(x,y,u),y){case"button":case"input":case"select":case"textarea":u=!!u.autoFocus;break e;case"img":u=!0;break e;default:u=!1}u&&cr(i)}}return ht(i),i.subtreeFlags&=-33554433,Gp(i,i.type,o===null?null:o.memoizedProps,i.pendingProps,d),null;case 6:if(o&&i.stateNode!=null)o.memoizedProps!==u&&cr(i);else{if(typeof u!="string"&&i.stateNode===null)throw Error(a(166));if(o=It.current,Ka(i)){if(o=i.stateNode,d=i.memoizedProps,u=null,y=Vt,y!==null)switch(y.tag){case 27:case 5:u=y.memoizedProps}o[ke]=i,o=!!(o.nodeValue===d||u!==null&&u.suppressHydrationWarning===!0||Cw(o.nodeValue,d)),o||Vr(i,!0)}else o=Wl(o).createTextNode(u),o[ke]=i,i.stateNode=o}return ht(i),null;case 31:if(d=i.memoizedState,o===null||o.memoizedState!==null){if(u=Ka(i),d!==null){if(o===null){if(!u)throw Error(a(318));if(o=i.memoizedState,o=o===null?null:o.dehydrated,!o)throw Error(a(557));o[ke]=i}else Pi(),!(i.flags&128)&&(i.memoizedState=null),i.flags|=4;ht(i),o=!1}else d=lp(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=d),o=!0;if(!o)return i.flags&256?(Cn(i),i):(Cn(i),null);if(i.flags&128)throw Error(a(558))}return ht(i),null;case 13:if(u=i.memoizedState,o===null||o.memoizedState!==null&&o.memoizedState.dehydrated!==null){if(y=Ka(i),u!==null&&u.dehydrated!==null){if(o===null){if(!y)throw Error(a(318));if(y=i.memoizedState,y=y===null?null:y.dehydrated,!y)throw Error(a(317));y[ke]=i}else Pi(),!(i.flags&128)&&(i.memoizedState=null),i.flags|=4;ht(i),y=!1}else y=lp(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=y),y=!0;if(!y)return i.flags&256?(Cn(i),i):(Cn(i),null)}return Cn(i),i.flags&128?(i.lanes=d,i):(d=u!==null,o=o!==null&&o.memoizedState!==null,d&&(u=i.child,y=null,u.alternate!==null&&u.alternate.memoizedState!==null&&u.alternate.memoizedState.cachePool!==null&&(y=u.alternate.memoizedState.cachePool.pool),x=null,u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(x=u.memoizedState.cachePool.pool),x!==y&&(u.flags|=2048)),d!==o&&d&&(i.child.flags|=8192),tc(i,i.updateQueue),ht(i),null);case 4:return Ft(),o===null&&kw(i.stateNode.containerInfo),i.flags|=67108864,ht(i),null;case 10:return sr(i.type),ht(i),null;case 19:if(kp(i),u=i.memoizedState,u===null)return ht(i),null;if(y=!!(i.flags&128),x=u.rendering,x===null)if(y)Dl(u,!1);else{if(Nt!==0||o!==null&&o.flags&128)for(o=i.child;o!==null;){if(x=Fu(o),x!==null){for(i.flags|=128,Dl(u,!1),o=x.updateQueue,i.updateQueue=o,tc(i,o),i.subtreeFlags=0,o=d,d=i.child;d!==null;)nb(d,o),d=d.sibling;return Al(i,Jt.current&1|2),We&&ir(i,u.treeForkCount),i.child}o=o.sibling}u.tail!==null&&Xt()>hc&&(i.flags|=128,y=!0,Dl(u,!1),i.lanes=4194304)}else{if(!y)if(o=Fu(x),o!==null){if(i.flags|=128,y=!0,o=o.updateQueue,i.updateQueue=o,tc(i,o),Dl(u,!0),u.tail===null&&u.tailMode!=="collapsed"&&u.tailMode!=="visible"&&!x.alternate&&!We)return ht(i),null}else 2*Xt()-u.renderingStartTime>hc&&d!==536870912&&(i.flags|=128,y=!0,Dl(u,!1),i.lanes=4194304);u.isBackwards?(x.sibling=i.child,i.child=x):(o=u.last,o===null?i.child=x:o.sibling=x,u.last=x)}if(u.tail!==null){o=u.tail;e:{for(d=o;d!==null;){if(d.alternate!==null){d=!1;break e}d=d.sibling}d=!0}return u.rendering=o,u.tail=o.sibling,u.renderingStartTime=Xt(),o.sibling=null,x=Jt.current,x=y?x&1|2:x&1,u.tailMode==="visible"||u.tailMode==="collapsed"||!d||We?Al(i,x):(d=x,Be(Qt,i),Be(Jt,d),sn===null&&(sn=i)),We&&ir(i,u.treeForkCount),o}return ht(i),null;case 22:case 23:return Cn(i),xp(),u=i.memoizedState!==null,o===null?u&&(i.flags|=8192):o.memoizedState!==null!==u&&(i.flags|=8192),u?d&536870912&&!(i.flags&128)&&(ht(i),i.subtreeFlags&6&&(i.flags|=8192)):ht(i),d=i.updateQueue,d!==null&&tc(i,d.retryQueue),d=null,o!==null&&o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(d=o.memoizedState.cachePool.pool),u=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(u=i.memoizedState.cachePool.pool),u!==d&&(i.flags|=2048),o!==null&&Le(zi),null;case 24:return d=null,o!==null&&(d=o.memoizedState.cache),i.memoizedState.cache!==d&&(i.flags|=2048),sr(Tt),ht(i),null;case 25:return null;case 30:return i.flags|=33554432,ht(i),null}throw Error(a(156,i.tag))}function J2(o,i){switch(ap(i),i.tag){case 1:return o=i.flags,o&65536?(i.flags=o&-65537|128,i):null;case 3:return sr(Tt),Ft(),o=i.flags,o&65536&&!(o&128)?(i.flags=o&-65537|128,i):null;case 26:case 27:case 5:return nn(i),null;case 31:if(i.memoizedState!==null){if(Cn(i),i.alternate===null)throw Error(a(340));Pi()}return o=i.flags,o&65536?(i.flags=o&-65537|128,i):null;case 13:if(Cn(i),o=i.memoizedState,o!==null&&o.dehydrated!==null){if(i.alternate===null)throw Error(a(340));Pi()}return o=i.flags,o&65536?(i.flags=o&-65537|128,i):null;case 19:return kp(i),o=i.flags,o&65536?(i.flags=o&-65537|128,o=i.memoizedState,o!==null&&(o.rendering=null,o.tail=null),i.flags|=4,i):null;case 4:return Ft(),null;case 10:return sr(i.type),null;case 22:case 23:return Cn(i),xp(),o!==null&&Le(zi),o=i.flags,o&65536?(i.flags=o&-65537|128,i):null;case 24:return sr(Tt),null;case 25:return null;default:return null}}function $x(o,i){switch(ap(i),i.tag){case 3:sr(Tt),Ft();break;case 26:case 27:case 5:nn(i);break;case 4:Ft();break;case 31:i.memoizedState!==null&&Cn(i);break;case 13:Cn(i);break;case 19:kp(i);break;case 10:sr(i.type);break;case 22:case 23:Cn(i),xp(),o!==null&&Le(zi);break;case 24:sr(Tt)}}function Il(o,i){try{var d=i.updateQueue,u=d===null?null:d.lastEffect;if(u!==null){var y=u.next;d=y;do{if((d.tag&o)===o){u=void 0;var x=d.create,C=d.inst;u=x(),C.destroy=u}d=d.next}while(d!==y)}}catch(P){at(i,i.return,P)}}function Gr(o,i,d){try{var u=i.updateQueue,y=u===null?null:u.lastEffect;if(y!==null){var x=y.next;u=x;do{if((u.tag&o)===o){var C=u.inst,P=C.destroy;if(P!==void 0){C.destroy=void 0,y=i;var H=d,ie=P;try{ie()}catch(ce){at(y,H,ce)}}}u=u.next}while(u!==x)}}catch(ce){at(i,i.return,ce)}}function Ex(o){var i=o.updateQueue;if(i!==null){var d=o.stateNode;try{xb(i,d)}catch(u){at(o,o.return,u)}}}function _x(o,i,d){d.props=Wi(o.type,o.memoizedProps),d.state=o.memoizedState;try{d.componentWillUnmount()}catch(u){at(o,i,u)}}function No(o,i){try{var d=o.ref;if(d!==null){switch(o.tag){case 26:case 27:case 5:var u=o.stateNode;break;case 30:var y=o.stateNode,x=nr(o.memoizedProps,y);(y.ref===null||y.ref.name!==x)&&(y.ref=Rw(x)),u=y.ref;break;case 7:if(o.stateNode===null){var C=new An(o);m(o.child,!1,BA,C,void 0,void 0),o.stateNode=C}u=o.stateNode;break;default:u=o.stateNode}typeof d=="function"?o.refCleanup=d(u):d.current=u}}catch(P){at(o,i,P)}}function en(o,i){var d=o.ref,u=o.refCleanup;if(d!==null)if(typeof u=="function")try{u()}catch(y){at(o,i,y)}finally{o.refCleanup=null,o=o.alternate,o!=null&&(o.refCleanup=null)}else if(typeof d=="function")try{d(null)}catch(y){at(o,i,y)}else d.current=null}function nc(o,i){if((o.tag===5||o.tag===27||o.tag===6)&&o.alternate===null&&i!==null)for(var d=0;d<i.length;d++)Vw(o.stateNode,i[d])}function Ax(o){for(var i=o.return;i!==null&&(Jp(i)&&Vw(o.stateNode,i.stateNode),!Qp(i));)i=i.return}function Ll(o){for(var i=o.return;i!==null&&(Jp(i)&&qA(o.stateNode,i.stateNode),!Qp(i));)i=i.return}function Qp(o){return o.tag===5||o.tag===3||o.tag===27}function Jp(o){return o&&o.tag===7&&o.stateNode!==null}function em(o){var i=o.type,d=o.memoizedProps,u=o.stateNode;try{e:switch(i){case"button":case"input":case"select":case"textarea":d.autoFocus&&u.focus();break e;case"img":d.src?u.src=d.src:d.srcSet&&(u.srcset=d.srcSet)}}catch(y){at(o,o.return,y)}}function tm(o,i,d){try{var u=o.stateNode;SA(u,o.type,d,i),u[Te]=i}catch(y){at(o,o.return,y)}}function Tx(o){return o.tag===5||o.tag===3||o.tag===26||o.tag===27&&ri(o.type)||o.tag===4}function nm(o){e:for(;;){for(;o.sibling===null;){if(o.return===null||Tx(o.return))return null;o=o.return}for(o.sibling.return=o.return,o=o.sibling;o.tag!==5&&o.tag!==6&&o.tag!==18;){if(o.tag===27&&ri(o.type)||o.flags&2||o.child===null||o.tag===4)continue e;o.child.return=o,o=o.child}if(!(o.flags&2))return o.stateNode}}function om(o,i,d,u){var y=o.tag;if(y===5||y===6)y=o.stateNode,i?(d.nodeType===9?d.body:d.nodeName==="HTML"?d.ownerDocument.body:d).insertBefore(y,i):(i=d.nodeType===9?d.body:d.nodeName==="HTML"?d.ownerDocument.body:d,i.appendChild(y),d=d._reactRootContainer,d!=null||i.onclick!==null||(i.onclick=wo)),nc(o,u),tt=!0;else if(y!==4&&(y===27&&(nc(o,u),u=null,ri(o.type)&&(d=o.stateNode,i=null)),o=o.child,o!==null))for(om(o,i,d,u),o=o.sibling;o!==null;)om(o,i,d,u),o=o.sibling}function oc(o,i,d,u){var y=o.tag;if(y===5||y===6)y=o.stateNode,i?d.insertBefore(y,i):d.appendChild(y),nc(o,u),tt=!0;else if(y!==4&&(y===27&&(nc(o,u),u=null,ri(o.type)&&(d=o.stateNode)),o=o.child,o!==null))for(oc(o,i,d,u),o=o.sibling;o!==null;)oc(o,i,d,u),o=o.sibling}function Mx(o){var i=o.stateNode,d=o.memoizedProps;try{for(var u=o.type,y=i.attributes;y.length;)i.removeAttributeNode(y[0]);tn(i,u,d),i[ke]=o,i[Te]=d}catch(x){at(o,o.return,x)}}var rc=!1,$n=null;function Ox(o){(o.tag===30||o.subtreeFlags&33554432)&&(rc=!0)}var jo=null;function Px(){var o=jo;return jo=null,o}var yn=0;function Ja(o,i,d,u,y){return yn=0,Dx(o.child,i,d,u,y)}function Dx(o,i,d,u,y){for(var x=!1;o!==null;){if(o.tag===5){var C=o.stateNode;if(u!==null){var P=zm(C);u.push(P),P.view&&(x=!0)}else x||zm(C).view&&(x=!0);rc=!0,Dw(C,yn===0?i:i+"_"+yn,d),yn++}else o.tag===22&&o.memoizedState!==null||o.tag===30&&y||Dx(o.child,i,d,u,y)&&(x=!0);o=o.sibling}return x}function Co(o,i){for(;o!==null;)o.tag===5?Iw(o.stateNode,o.memoizedProps):o.tag===22&&o.memoizedState!==null||o.tag===30&&i||Co(o.child,i),o=o.sibling}function ic(o){if(o.subtreeFlags&18874368)for(o=o.child;o!==null;){if((o.tag!==22||o.memoizedState===null)&&(ic(o),o.tag===30&&o.flags&18874368&&o.stateNode.paired)){var i=o.memoizedProps;if(i.name==null||i.name==="auto")throw Error(a(544));var d=i.name;i=or(i.default,i.share),i!=="none"&&(Ja(o,d,i,null,!1)||Co(o.child,!1))}o=o.sibling}}function rm(o,i){if(o.tag===30){var d=o.stateNode,u=o.memoizedProps,y=nr(u,d),x=or(u.default,d.paired?u.share:u.enter);x==="none"?ic(o):Ja(o,y,x,null,!1)?(ic(o),d.paired||i||ss(o,u.onEnter)):Co(o.child,!1)}else if(o.subtreeFlags&33554432)for(o=o.child;o!==null;)rm(o,i),o=o.sibling;else ic(o)}function im(o){if($n!==null&&$n.size!==0){var i=$n;if(o.subtreeFlags&18874368)for(o=o.child;o!==null;){if(o.tag!==22||o.memoizedState===null){if(o.tag===30&&o.flags&18874368){var d=o.memoizedProps,u=d.name;if(u!=null&&u!=="auto"){var y=i.get(u);if(y!==void 0){var x=or(d.default,d.share);if(x!=="none"&&(Ja(o,u,x,null,!1)?(x=o.stateNode,y.paired=x,x.paired=y,ss(o,d.onShare)):Co(o.child,!1)),i.delete(u),i.size===0)break}}}im(o)}o=o.sibling}}}function am(o){if(o.tag===30){var i=o.memoizedProps,d=nr(i,o.stateNode),u=$n===null?void 0:$n.get(d),y=or(i.default,u===void 0?i.exit:i.share);y!=="none"&&(Ja(o,d,y,null,!1)?u===void 0?ss(o,i.onExit):(y=o.stateNode,u.paired=y,y.paired=u,$n.delete(d),ss(o,i.onShare)):Co(o.child,!1)),$n!==null&&im(o)}else if(o.subtreeFlags&33554432)for(o=o.child;o!==null;)am(o),o=o.sibling;else $n!==null&&im(o)}function Ix(o){for(o=o.child;o!==null;){if(o.tag===30){var i=o.memoizedProps,d=nr(i,o.stateNode);i=or(i.default,i.update),o.flags&=-5,i!=="none"&&Ja(o,d,i,o.memoizedState=[],!1)}else o.subtreeFlags&33554432&&Ix(o);o=o.sibling}}function sm(o){if(o.subtreeFlags&18874368)for(o=o.child;o!==null;){if(o.tag!==22||o.memoizedState===null){if(o.tag===30&&o.flags&18874368){var i=o.stateNode;i.paired!==null&&(i.paired=null,Co(o.child,!1))}sm(o)}o=o.sibling}}function ac(o){if(o.tag===30)o.stateNode.paired=null,Co(o.child,!1),sm(o);else if(o.subtreeFlags&33554432)for(o=o.child;o!==null;)ac(o),o=o.sibling;else sm(o)}function Lx(o){for(o=o.child;o!==null;)o.tag===30?Co(o.child,!1):o.subtreeFlags&33554432&&Lx(o),o=o.sibling}function lm(o,i,d,u,y,x,C){for(var P=!1;i!==null;){if(i.tag===5){var H=i.stateNode;if(x!==null&&yn<x.length){var ie=x[yn],ce=zm(H);(ie.view||ce.view)&&(P=!0);var ye;if(ye=!(o.flags&4))if(ce.clip)ye=!0;else{ye=ie.rect;var te=ce.rect;ye=ye.y!==te.y||ye.x!==te.x||ye.height!==te.height||ye.width!==te.width}ye&&(o.flags|=4),ce.abs?ce=!ie.abs:(ie=ie.rect,ce=ce.rect,ce=ie.height!==ce.height||ie.width!==ce.width),ce&&(o.flags|=32)}else o.flags|=32;o.flags&4&&Dw(H,yn===0?d:d+"_"+yn,y),P&&o.flags&4||(jo===null&&(jo=[]),jo.push(H,yn===0?u:u+"_"+yn,i.memoizedProps)),yn++}else(i.tag!==22||i.memoizedState===null)&&(i.tag===30&&C?o.flags|=i.flags&32:lm(o,i.child,d,u,y,x,C)&&(P=!0));i=i.sibling}return P}function Rx(o,i){for(o=o.child;o!==null;){if(o.tag===30){var d=o.memoizedProps,u=o.stateNode,y=nr(d,u),x=or(d.default,d.update);if(i){u=u.clones;var C=u===null?null:u.map(_A)}else C=o.memoizedState,o.memoizedState=null;u=o;var P=o.child;yn=0,y=lm(u,P,y,y,x,C,!1),o.flags&4&&y&&(i||ss(o,d.onUpdate))}else o.subtreeFlags&33554432&&Rx(o,i);o=o.sibling}}var Kt=!1,ot=!1,$o=!1,dm=!1,zx=typeof WeakSet=="function"?WeakSet:Set,Wt=null,Eo=!1,Rl=!1,sc=!1,um=!1;function eA(o,i,d){if(o=o.containerInfo,Pm=ys,o=Wv(o),Zh(o)){if("selectionStart"in o)var u={start:o.selectionStart,end:o.selectionEnd};else e:{u=(u=o.ownerDocument)&&u.defaultView||window;var y=u.getSelection&&u.getSelection();if(y&&y.rangeCount!==0){u=y.anchorNode;var x=y.anchorOffset,C=y.focusNode;y=y.focusOffset;try{u.nodeType,C.nodeType}catch{u=null;break e}var P=0,H=-1,ie=-1,ce=0,ye=0,te=o,ue=null;t:for(;;){for(var Se;te!==u||x!==0&&te.nodeType!==3||(H=P+x),te!==C||y!==0&&te.nodeType!==3||(ie=P+y),te.nodeType===3&&(P+=te.nodeValue.length),(Se=te.firstChild)!==null;)ue=te,te=Se;for(;;){if(te===o)break t;if(ue===u&&++ce===x&&(H=P),ue===C&&++ye===y&&(ie=P),(Se=te.nextSibling)!==null)break;te=ue,ue=te.parentNode}te=Se}u=H===-1||ie===-1?null:{start:H,end:ie}}else u=null}u||={start:0,end:0}}else u=null;for(Dm={focusedElem:o,selectionRange:u},ys=!1,d=(d&335544064)===d,Wt=i,i=d?9270:1024;Wt!==null;){if(o=Wt,d&&(u=o.deletions,u!==null))for(x=0;x<u.length;x++)d&&am(u[x]);if(o.alternate===null&&o.flags&2)d&&Ox(o),lc(d);else{if(o.tag===22){if(u=o.alternate,o.memoizedState!==null){u!==null&&u.memoizedState===null&&d&&am(u),lc(d);continue}if(u!==null&&u.memoizedState!==null){d&&Ox(o),lc(d);continue}}u=o.child,(o.subtreeFlags&i)!==0&&u!==null?(u.return=o,Wt=u):(d&&Ix(o),lc(d))}}$n=null}function lc(o){for(;Wt!==null;){var i=Wt,d=o,u=i.alternate,y=i.flags;switch(i.tag){case 0:case 11:case 15:break;case 1:if(y&1024&&u!==null){d=void 0,y=u.memoizedProps,u=u.memoizedState;var x=i.stateNode;try{var C=Wi(i.type,y);d=x.getSnapshotBeforeUpdate(C,u),x.__reactInternalSnapshotBeforeUpdate=d}catch(P){at(i,i.return,P)}}break;case 3:if(y&1024){if(u=i.stateNode.containerInfo,d=u.nodeType,d===9)qm(u);else if(d===1)switch(u.nodeName){case"HEAD":case"HTML":case"BODY":qm(u);break;default:u.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;case 30:d&&u!==null&&(d=nr(u.memoizedProps,u.stateNode),y=i.memoizedProps,y=or(y.default,y.update),y!=="none"&&Ja(u,d,y,u.memoizedState=[],!0));break;default:if(y&1024)throw Error(a(163))}if(u=i.sibling,u!==null){u.return=i.return,Wt=u;break}Wt=i.return}}function Fx(o,i,d){var u=d.flags;switch(d.tag){case 0:case 11:case 15:_o(o,d),u&4&&Il(5,d);break;case 1:if(_o(o,d),u&4)if(o=d.stateNode,i===null)try{o.componentDidMount()}catch(C){at(d,d.return,C)}else{var y=Wi(d.type,i.memoizedProps);i=i.memoizedState;try{o.componentDidUpdate(y,i,o.__reactInternalSnapshotBeforeUpdate)}catch(C){at(d,d.return,C)}}u&64&&Ex(d),u&512&&No(d,d.return);break;case 3:if(_o(o,d),u&64&&(o=d.updateQueue,o!==null)){if(i=null,d.child!==null)switch(d.child.tag){case 27:case 5:i=d.child.stateNode;break;case 1:i=d.child.stateNode}try{xb(o,i)}catch(C){at(d,d.return,C)}}break;case 27:i===null&&u&4&&Mx(d);case 26:case 5:_o(o,d),i===null&&u&4&&em(d),u&512&&No(d,d.return);break;case 12:_o(o,d);break;case 31:_o(o,d),u&4&&Vx(o,d);break;case 13:_o(o,d),u&4&&Kx(o,d),u&64&&(o=d.memoizedState,o!==null&&(o=o.dehydrated,o!==null&&(d=fA.bind(null,d),KA(o,d))));break;case 22:if(u=d.memoizedState!==null||Kt,!u){var x=i!==null&&i.memoizedState!==null||ot;i=Kt,y=ot,Kt=u,(ot=x)&&!y?(u=2,d.subtreeFlags&8772&&(u|=1),oo(o,d,u)):_o(o,d),Kt=i,ot=y}break;case 30:_o(o,d),u&512&&No(d,d.return);break;case 7:u&512&&No(d,d.return);default:_o(o,d)}}function cm(o,i){for(o=o.child;o!==null;)Bx(o,i),o=o.sibling}function Bx(o,i){switch(o.tag){case 5:case 26:try{var d=o.stateNode;if(i){var u=d.style;typeof u.setProperty=="function"?u.setProperty("display","none","important"):u.display="none"}else{var y=o.stateNode,x=o.memoizedProps.style,C=x!=null&&x.hasOwnProperty("display")?x.display:null;y.style.display=C==null||typeof C=="boolean"?"":(""+C).trim()}}catch(H){at(o,o.return,H)}fm(o,i);break;case 6:try{o.stateNode.nodeValue=i?"":o.memoizedProps,tt=!0}catch(H){at(o,o.return,H)}break;case 18:try{var P=o.stateNode;i?Pw(P,!0):Pw(o.stateNode,!1)}catch(H){at(o,o.return,H)}break;case 22:case 23:o.memoizedState===null&&cm(o,i);break;default:cm(o,i)}}function fm(o,i){if(o.subtreeFlags&67108864)for(o=o.child;o!==null;){e:{var d=o,u=i;switch(d.tag){case 4:Bx(d,u);break e;case 22:d.memoizedState===null&&fm(d,u);break e;default:fm(d,u)}}o=o.sibling}}function qx(o){var i=o.alternate;i!==null&&(o.alternate=null,qx(i)),o.child=null,o.deletions=null,o.sibling=null,o.tag===5&&(i=o.stateNode,i!==null&&xo(i)),o.stateNode=null,o.return=null,o.dependencies=null,o.memoizedProps=null,o.memoizedState=null,o.pendingProps=null,o.stateNode=null,o.updateQueue=null}var gt=null,vn=!1;function to(o,i,d){for(d=d.child;d!==null;)Hx(o,i,d),d=d.sibling}function Hx(o,i,d){if(jt&&typeof jt.onCommitFiberUnmount=="function")try{jt.onCommitFiberUnmount(Dn,d)}catch{}switch(d.tag){case 26:ot||en(d,i),to(o,i,d),d.memoizedState?d.memoizedState.count--:d.stateNode&&!ot&&(d=d.stateNode,d.parentNode.removeChild(d));break;case 27:ot||en(d,i),Ll(d);var u=gt,y=vn;ri(d.type)&&(gt=d.stateNode,vn=!1),to(o,i,d),Xw(d.stateNode,d.type,d.memoizedProps),gt=u,vn=y;break;case 5:ot||en(d,i),Ll(d);case 6:if(d.tag===6&&Ll(d),u=gt,y=vn,gt=null,to(o,i,d),gt=u,vn=y,gt!==null)if(vn)try{(gt.nodeType===9?gt.body:gt.nodeName==="HTML"?gt.ownerDocument.body:gt).removeChild(d.stateNode),tt=!0}catch(x){at(d,i,x)}else try{gt.removeChild(d.stateNode),tt=!0}catch(x){at(d,i,x)}break;case 18:gt!==null&&(vn?(o=gt,Ow(o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o,d.stateNode),vs(o)):Ow(gt,d.stateNode));break;case 4:u=gt,y=vn,gt=d.stateNode.containerInfo,vn=!0,to(o,i,d),gt=u,vn=y;break;case 0:case 11:case 14:case 15:Gr(2,d,i),ot||Gr(4,d,i),to(o,i,d);break;case 1:ot||(en(d,i),u=d.stateNode,typeof u.componentWillUnmount=="function"&&_x(d,i,u)),to(o,i,d);break;case 21:to(o,i,d);break;case 22:ot=(u=ot)||d.memoizedState!==null,to(o,i,d),ot=u;break;case 30:en(d,i),to(o,i,d);break;case 7:ot||en(d,i),to(o,i,d);break;default:to(o,i,d)}}function Vx(o,i){if(i.memoizedState===null&&(o=i.alternate,o!==null&&(o=o.memoizedState,o!==null))){o=o.dehydrated;try{vs(o)}catch(d){at(i,i.return,d)}}}function Kx(o,i){if(i.memoizedState===null&&(o=i.alternate,o!==null&&(o=o.memoizedState,o!==null&&(o=o.dehydrated,o!==null))))try{vs(o)}catch(d){at(i,i.return,d)}}function tA(o){switch(o.tag){case 31:case 13:case 19:var i=o.stateNode;return i===null&&(i=o.stateNode=new zx),i;case 22:return o=o.stateNode,i=o._retryCache,i===null&&(i=o._retryCache=new zx),i;default:throw Error(a(435,o.tag))}}function dc(o,i){var d=tA(o);i.forEach(function(u){if(!d.has(u)){d.add(u);var y=hA.bind(null,o,u);u.then(y,y)}})}function dn(o,i,d){var u=i.deletions;if(u!==null)for(var y=0;y<u.length;y++){var x=u[y],C=o,P=i,H=P;e:for(;H!==null;){switch(H.tag){case 27:if(ri(H.type)){gt=H.stateNode,vn=!1;break e}break;case 5:gt=H.stateNode,vn=!1;break e;case 3:case 4:gt=H.stateNode.containerInfo,vn=!0;break e}H=H.return}if(gt===null)throw Error(a(160));Hx(C,P,x),gt=null,vn=!1,C=x.alternate,C!==null&&(C.return=null),x.return=null}if(i.subtreeFlags&13886)for(i=i.child;i!==null;)Wx(i,o,d),i=i.sibling}var no=null;function Wx(o,i,d){var u=o.alternate,y=o.flags;switch(o.tag){case 0:case 11:case 14:case 15:if(y&4&&(u=o.updateQueue,u=u===null?null:u.events,u!==null))for(var x=0;x<u.length;x++){var C=u[x];C.ref.impl=C.nextImpl}dn(i,o,d),un(o),y&4&&(Gr(3,o,o.return),Il(3,o),Gr(5,o,o.return));break;case 1:dn(i,o,d),un(o),y&512&&(ot||u===null||en(u,u.return)),y&64&&Kt&&(o=o.updateQueue,o!==null&&(i=o.callbacks,i!==null&&(d=o.shared.hiddenCallbacks,o.shared.hiddenCallbacks=d===null?i:d.concat(i))));break;case 26:if(x=no,dn(i,o,d),un(o),y&512&&(ot||u===null||en(u,u.return)),y&4)if(y=u===null?null:u.memoizedState,d=o.memoizedState,u===null)if(d===null)if(o.stateNode===null)if(Kt)o.stateNode=Aw(o.type,o.memoizedProps,i.containerInfo,o);else{e:{i=o.type,d=o.memoizedProps,y=x.ownerDocument||x;t:switch(i){case"title":u=y.getElementsByTagName("title")[0],(!u||u[Ht]||u[ke]||u.namespaceURI==="http://www.w3.org/2000/svg"||u.hasAttribute("itemprop"))&&(u=y.createElement(i),y.head.insertBefore(u,y.querySelector("head > title"))),tn(u,i,d),u[ke]=o,Ct(u),i=u;break e;case"link":if(x=tk("link","href",y).get(i+(d.href||""))){for(C=0;C<x.length;C++)if(u=x[C],u.getAttribute("href")===(d.href==null||d.href===""?null:d.href)&&u.getAttribute("rel")===(d.rel==null?null:d.rel)&&u.getAttribute("title")===(d.title==null?null:d.title)&&u.getAttribute("crossorigin")===(d.crossOrigin==null?null:d.crossOrigin)){x.splice(C,1);break t}}u=y.createElement(i),tn(u,i,d),y.head.appendChild(u);break;case"meta":if(x=tk("meta","content",y).get(i+(d.content||""))){for(C=0;C<x.length;C++)if(u=x[C],u.getAttribute("content")===(d.content==null?null:""+d.content)&&u.getAttribute("name")===(d.name==null?null:d.name)&&u.getAttribute("property")===(d.property==null?null:d.property)&&u.getAttribute("http-equiv")===(d.httpEquiv==null?null:d.httpEquiv)&&u.getAttribute("charset")===(d.charSet==null?null:d.charSet)){x.splice(C,1);break t}}u=y.createElement(i),tn(u,i,d),y.head.appendChild(u);break;default:throw Error(a(468,i))}u[ke]=o,Ct(u),i=u}o.stateNode=i}else Kt||Xm(x,o.type,o.stateNode);else o.stateNode=ek(x,d,o.memoizedProps);else y===d?d===null&&o.stateNode!==null&&tm(o,o.memoizedProps,u.memoizedProps):(y===null?(i=u.stateNode,i===null||ot||i.parentNode.removeChild(i)):y.count--,d===null?Kt||Xm(x,o.type,o.stateNode):ek(x,d,o.memoizedProps));break;case 27:dn(i,o,d),un(o),y&512&&(ot||u===null||en(u,u.return)),u!==null&&y&4&&tm(o,o.memoizedProps,u.memoizedProps);break;case 5:if(x=$o,$o=!1,dn(i,o,d),$o=x,un(o),y&512&&(ot||u===null||en(u,u.return)),o.flags&32){i=o.stateNode;try{Da(i,""),tt=!0}catch(ce){at(o,o.return,ce)}}y&4&&o.stateNode!=null&&(i=o.memoizedProps,tm(o,i,u===null?i:u.memoizedProps)),y&1024&&(dm=!0);break;case 6:if(dn(i,o,d),un(o),y&4){if(o.stateNode===null)throw Error(a(162));i=o.memoizedProps,d=o.stateNode;try{d.nodeValue=i,tt=!0}catch(ce){at(o,o.return,ce)}}break;case 3:if(tt=!1,Nc=null,x=no,no=Ul(i.containerInfo),dn(i,o,d),no=x,un(o),y&4&&u!==null&&u.memoizedState.isDehydrated)try{vs(i.containerInfo)}catch(ce){at(o,o.return,ce)}dm&&(dm=!1,Ux(o)),tt=!1;break;case 4:y=$o,$o=Kt,u=gv(),x=no,no=Ul(o.stateNode.containerInfo),dn(i,o,d),un(o),no=x,tt&&Rl&&(sc=!0),tt=u,$o=y;break;case 12:dn(i,o,d),un(o);break;case 31:dn(i,o,d),un(o),y&4&&(i=o.updateQueue,i!==null&&(o.updateQueue=null,dc(o,i)));break;case 13:dn(i,o,d),un(o),o.child.flags&8192&&o.memoizedState!==null!=(u!==null&&u.memoizedState!==null)&&(fc=Xt()),y&4&&(i=o.updateQueue,i!==null&&(o.updateQueue=null,dc(o,i)));break;case 22:x=o.memoizedState!==null,C=u!==null&&u.memoizedState!==null;var P=Kt,H=ot,ie=$o;Kt=P||x,$o=ie||x,ot=H||C,dn(i,o,d),ot=H,$o=ie,Kt=P,un(o),y&8192&&(i=o.stateNode,i._visibility=x?i._visibility&-2:i._visibility|1,!x||u===null||C||Kt||ot||(i=C||ot,d=Kt,u=ot,Kt=x||Kt,ot=i,Qr(o,2),Kt=d,ot=u),!x&&$o||cm(o,x)),y&4&&(i=o.updateQueue,i!==null&&(d=i.retryQueue,d!==null&&(i.retryQueue=null,dc(o,d))));break;case 19:dn(i,o,d),un(o),y&4&&(i=o.updateQueue,i!==null&&(o.updateQueue=null,dc(o,i)));break;case 30:y&512&&(ot||u===null||en(u,u.return)),y=gv(),x=Rl,C=(d&335544064)===d,P=o.memoizedProps,Rl=C&&or(P.default,P.update)!=="none",dn(i,o,d),un(o),C&&u!==null&&tt&&(o.flags|=4),Rl=x,tt=y;break;case 21:break;case 7:y&512&&(ot||u===null||en(u,u.return)),u&&u.stateNode!==null&&(u.stateNode._fragmentFiber=o);default:dn(i,o,d),un(o)}}function un(o){var i=o.flags;if(i&2){try{for(var d,u=o.return;u!==null;){if(Tx(u)){d=u;break}u=u.return}u=null;for(var y=o.return;y!==null;){if(Jp(y)){var x=y.stateNode;u===null?u=[x]:u.push(x)}if(Qp(y))break;y=y.return}var C=u;if(d==null)throw Error(a(160));switch(d.tag){case 27:var P=d.stateNode;oc(o,nm(o),P,C);break;case 5:var H=d.stateNode;d.flags&32&&(Da(H,""),d.flags&=-33),oc(o,nm(o),H,C);break;case 3:case 4:var ie=d.stateNode.containerInfo;om(o,nm(o),ie,C);break;default:throw Error(a(161))}}catch(ce){at(o,o.return,ce)}o.flags&=-3}i&4096&&(o.flags&=-4097)}function Ux(o){if(o.subtreeFlags&1024)for(o=o.child;o!==null;){var i=o;Ux(i),i.tag===5&&i.flags&1024&&(i=i.stateNode,ys=!0,i.reset(),ys=!1),o=o.sibling}}function es(o,i){if(i.subtreeFlags&9270)for(i=i.child;i!==null;)Yx(i,o),i=i.sibling;else Rx(i,!1)}function Yx(o,i){var d=o.alternate;if(d===null)rm(o,!1);else switch(o.tag){case 3:if(um=Eo=!1,Px(),es(i,o),!Eo&&!sc){if(o=jo,o!==null)for(var u=0;u<o.length;u+=3){d=o[u];var y=o[u+1];Iw(d,o[u+2]),d=d.ownerDocument.documentElement,d!==null&&d.animate({opacity:[0,0],pointerEvents:["none","none"]},{duration:0,fill:"forwards",pseudoElement:"::view-transition-group("+y+")"})}o=i.containerInfo,o=o.nodeType===9?o.documentElement:o.ownerDocument.documentElement,o!==null&&o.style.viewTransitionName===""&&(o.style.viewTransitionName="none",o.animate({opacity:[0,0],pointerEvents:["none","none"]},{duration:0,fill:"forwards",pseudoElement:"::view-transition-group(root)"}),o.animate({width:[0,0],height:[0,0]},{duration:0,fill:"forwards",pseudoElement:"::view-transition"})),um=!0}jo=null;break;case 5:es(i,o);break;case 4:u=Eo,Eo=!1,es(i,o),Eo&&(sc=!0),Eo=u;break;case 22:o.memoizedState===null&&(d.memoizedState===null?es(i,o):rm(o,!1));break;case 30:u=Eo,y=Px(),Eo=!1,es(i,o),Eo&&(o.flags|=4);var x=o.memoizedProps,C=o.stateNode;i=nr(x,C),C=nr(d.memoizedProps,C);var P=or(x.default,x.update);P==="none"?i=!1:(x=d.memoizedState,d.memoizedState=null,d=o.child,yn=0,i=lm(o,d,i,C,P,x,!0),yn!==(x===null?0:x.length)&&(o.flags|=32)),o.flags&4&&i?(ss(o,o.memoizedProps.onUpdate),jo=y):y!==null&&(y.push.apply(y,jo),jo=y),Eo=o.flags&32?!0:u;break;default:es(i,o)}}function _o(o,i){if(i.subtreeFlags&8772)for(i=i.child;i!==null;)Fx(o,i.alternate,i),i=i.sibling}function Qr(o,i){for(o=o.child;o!==null;){var d=o,u=i;switch(d.tag){case 0:case 11:case 14:case 15:Gr(4,d,d.return),Qr(d,u);break;case 1:en(d,d.return);var y=d.stateNode;typeof y.componentWillUnmount=="function"&&_x(d,d.return,y),Qr(d,u);break;case 27:u&2&&Xw(d.stateNode,d.type,d.memoizedProps);case 5:en(d,d.return),d.tag!==5&&d.tag!==27||Ll(d),Qr(d,u);break;case 6:Ll(d);break;case 26:en(d,d.return),y=d.stateNode,d.memoizedState!==null||y===null||ot||y.parentNode.removeChild(y),Qr(d,u);break;case 22:d.memoizedState===null&&Qr(d,u);break;case 30:en(d,d.return),Qr(d,u);break;case 7:en(d,d.return);default:Qr(d,u)}o=o.sibling}}function oo(o,i,d){for(d=i.subtreeFlags&8772?d:d&-2,i=i.child;i!==null;){var u=i.alternate,y=o,x=i,C=x.flags,P=!!(d&1);switch(x.tag){case 0:case 11:case 15:oo(y,x,d),Il(4,x);break;case 1:if(oo(y,x,d),u=x,y=u.stateNode,typeof y.componentDidMount=="function")try{y.componentDidMount()}catch(ce){at(u,u.return,ce)}if(u=x,y=u.updateQueue,y!==null){var H=u.stateNode;try{var ie=y.shared.hiddenCallbacks;if(ie!==null)for(y.shared.hiddenCallbacks=null,y=0;y<ie.length;y++)bb(ie[y],H)}catch(ce){at(u,u.return,ce)}}P&&C&64&&Ex(x),No(x,x.return);break;case 27:d&2&&Mx(x);case 5:x.tag!==5&&x.tag!==27||Ax(x),oo(y,x,d),P&&u===null&&C&4&&em(x),No(x,x.return);break;case 6:Ax(x);break;case 26:H=x.stateNode,x.memoizedState!==null||H===null||Kt||Xm(Ul(H.ownerDocument),x.type,H),oo(y,x,d),P&&u===null&&C&4&&em(x),No(x,x.return);break;case 12:oo(y,x,d);break;case 31:oo(y,x,d),P&&C&4&&Vx(y,x);break;case 13:oo(y,x,d),P&&C&4&&Kx(y,x);break;case 22:x.memoizedState===null&&oo(y,x,d),No(x,x.return);break;case 30:oo(y,x,d),No(x,x.return);break;case 7:No(x,x.return);default:oo(y,x,d)}i=i.sibling}}function hm(o,i){var d=null;o!==null&&o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(d=o.memoizedState.cachePool.pool),o=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(o=i.memoizedState.cachePool.pool),o!==d&&(o!=null&&o.refCount++,d!=null&&Sl(d))}function pm(o,i){o=null,i.alternate!==null&&(o=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==o&&(i.refCount++,o!=null&&Sl(o))}function qn(o,i,d,u){var y=(d&335544064)===d;if(i.subtreeFlags&(y?10262:10256))for(i=i.child;i!==null;)Xx(o,i,d,u),i=i.sibling;else y&&Lx(i)}function Xx(o,i,d,u){var y=(d&335544064)===d;y&&i.alternate===null&&i.return!==null&&i.return.alternate!==null&&ac(i);var x=i.flags;switch(i.tag){case 0:case 11:case 15:qn(o,i,d,u),x&2048&&Il(9,i);break;case 1:qn(o,i,d,u);break;case 3:qn(o,i,d,u),y&&um&&(o=o.containerInfo,o=o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o,o.style.viewTransitionName==="root"&&(o.style.viewTransitionName=""),o=o.ownerDocument.documentElement,o!==null&&o.style.viewTransitionName==="none"&&(o.style.viewTransitionName="")),x&2048&&(x=null,i.alternate!==null&&(x=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==x&&(i.refCount++,x!=null&&Sl(x)));break;case 12:if(x&2048){qn(o,i,d,u),x=i.stateNode;try{var C=i.memoizedProps,P=C.id,H=C.onPostCommit;typeof H=="function"&&H(P,i.alternate===null?"mount":"update",x.passiveEffectDuration,-0)}catch(ie){at(i,i.return,ie)}}else qn(o,i,d,u);break;case 31:qn(o,i,d,u);break;case 13:qn(o,i,d,u);break;case 23:break;case 22:C=i.stateNode,P=i.alternate,i.memoizedState===null?(y&&P!==null&&P.memoizedState!==null&&ac(i),C._visibility&2?qn(o,i,d,u):(C._visibility|=2,ts(o,i,d,u,!!(i.subtreeFlags&10256)||!1))):(y&&P!==null&&P.memoizedState===null&&ac(P),C._visibility&2?qn(o,i,d,u):zl(o,i)),x&2048&&hm(P,i);break;case 24:qn(o,i,d,u),x&2048&&pm(i.alternate,i);break;case 30:y&&(x=i.alternate,x!==null&&(Co(x.child,!0),Co(i.child,!0))),qn(o,i,d,u);break;default:qn(o,i,d,u)}}function ts(o,i,d,u,y){for(y&&=!!(i.subtreeFlags&10256)||!1,i=i.child;i!==null;){var x=o,C=i,P=d,H=u,ie=C.flags;switch(C.tag){case 0:case 11:case 15:ts(x,C,P,H,y),Il(8,C);break;case 23:break;case 22:var ce=C.stateNode;C.memoizedState===null?(ce._visibility|=2,ts(x,C,P,H,y)):ce._visibility&2?ts(x,C,P,H,y):zl(x,C),y&&ie&2048&&hm(C.alternate,C);break;case 24:ts(x,C,P,H,y),y&&ie&2048&&pm(C.alternate,C);break;default:ts(x,C,P,H,y)}i=i.sibling}}function zl(o,i){if(i.subtreeFlags&10256)for(i=i.child;i!==null;){var d=o,u=i,y=u.flags;switch(u.tag){case 22:zl(d,u),y&2048&&hm(u.alternate,u);break;case 24:zl(d,u),y&2048&&pm(u.alternate,u);break;default:zl(d,u)}i=i.sibling}}var Ui=8192;function Yi(o,i,d){if(o.subtreeFlags&Ui)for(o=o.child;o!==null;)Zx(o,i,d),o=o.sibling}function Zx(o,i,d){switch(o.tag){case 26:Yi(o,i,d),o.flags&Ui&&(o.memoizedState===null?(o=o.stateNode,(i&335544128)===i&&ik(d,o)):iT(d,no,o.memoizedState,o.memoizedProps));break;case 5:Yi(o,i,d),o.flags&Ui&&(o=o.stateNode,(i&335544128)===i&&ik(d,o));break;case 3:case 4:var u=no;no=Ul(o.stateNode.containerInfo),Yi(o,i,d),no=u;break;case 22:o.memoizedState===null&&(u=o.alternate,u!==null&&u.memoizedState!==null?(u=Ui,Ui=16777216,Yi(o,i,d),Ui=u):Yi(o,i,d));break;case 30:if((o.flags&Ui)!==0&&(u=o.memoizedProps.name,u!=null&&u!=="auto")){var y=o.stateNode;y.paired=null,$n===null&&($n=new Map),$n.set(u,y)}Yi(o,i,d);break;default:Yi(o,i,d)}}function Gx(o){var i=o.alternate;if(i!==null&&(o=i.child,o!==null)){i.child=null;do i=o.sibling,o.sibling=null,o=i;while(o!==null)}}function Fl(o){var i=o.deletions;if(o.flags&16){if(i!==null)for(var d=0;d<i.length;d++){var u=i[d];Wt=u,Jx(u,o)}Gx(o)}if(o.subtreeFlags&10256)for(o=o.child;o!==null;)Qx(o),o=o.sibling}function Qx(o){switch(o.tag){case 0:case 11:case 15:Fl(o),o.flags&2048&&Gr(9,o,o.return);break;case 3:Fl(o);break;case 12:Fl(o);break;case 22:var i=o.stateNode;o.memoizedState!==null&&i._visibility&2&&(o.return===null||o.return.tag!==13)?(i._visibility&=-3,uc(o)):Fl(o);break;default:Fl(o)}}function uc(o){var i=o.deletions;if(o.flags&16){if(i!==null)for(var d=0;d<i.length;d++){var u=i[d];Wt=u,Jx(u,o)}Gx(o)}for(o=o.child;o!==null;){switch(i=o,i.tag){case 0:case 11:case 15:Gr(8,i,i.return),uc(i);break;case 22:d=i.stateNode,d._visibility&2&&(d._visibility&=-3,uc(i));break;default:uc(i)}o=o.sibling}}function Jx(o,i){for(;Wt!==null;){var d=Wt;switch(d.tag){case 0:case 11:case 15:Gr(8,d,i);break;case 23:case 22:if(d.memoizedState!==null&&d.memoizedState.cachePool!==null){var u=d.memoizedState.cachePool.pool;u!=null&&u.refCount++}break;case 24:Sl(d.memoizedState.cache)}if(u=d.child,u!==null)u.return=d,Wt=u;else e:for(d=o;Wt!==null;){u=Wt;var y=u.sibling,x=u.return;if(qx(u),u===d){Wt=null;break e}if(y!==null){y.return=x,Wt=y;break e}Wt=x}}}var nA={getCacheForType:function(o){var i=Gt(Tt),d=i.data.get(o);return d===void 0&&(d=o(),i.data.set(o,d)),d},cacheSignal:function(){return Gt(Tt).controller.signal}},oA=typeof WeakMap=="function"?WeakMap:Map,nt=0,ct=null,Ze=null,Qe=0,it=0,En=null,Jr=!1,ns=!1,mm=!1,fr=0,Nt=0,ei=0,Xi=0,cc=0,_n=0,os=0,Bl=null,bn=null,gm=!1,fc=0,ew=0,hc=1/0,pc=null,ti=null,wt=0,ro=null,Zi=null,Ao=0,ym=0,vm=null,tw=null,rs=null,is=null,as=null,ql=0,mc=null;function Hn(){return nt&2&&Qe!==0?Qe&-Qe:ee.T===null?G():Em()}function nw(){if(_n===0)if(!(Qe&536870912)||We){var o=bo;bo<<=1,!(bo&3932160)&&(bo=262144),_n=o}else _n=536870912;return o=Qt.current,o!==null&&(o.flags|=32),_n}function ss(o,i){if(i!=null){var d=o.stateNode,u=d.ref;u===null&&(u=d.ref=Rw(nr(o.memoizedProps,d))),is===null&&(is=[]),is.push(i.bind(null,u))}}function xn(o,i,d){(o===ct&&(it===2||it===9)||o.cancelPendingCommit!==null)&&(ls(o,0),ni(o,Qe,_n,!1)),Zo(o,d),nt&2&&o===ct||(o===ct&&(!(nt&2)&&(Xi|=d),Nt===4&&ni(o,Qe,_n,!1)),hr(o))}function ow(o,i,d){if(nt&6)throw Error(a(327));var u=!d&&!(i&127)&&(i&o.expiredLanes)===0||Zt(o,i),y=u?aA(o,i):xm(o,i,!0),x=u;do{if(y===0){ns&&!u&&ni(o,i,0,!1);break}if(d=o.current.alternate,x&&!rA(d))y=xm(o,i,!1),x=!1;else{if(y===2){if(x=i,o.errorRecoveryDisabledLanes&x)var C=0;else C=o.pendingLanes&-536870913,C=C===0?C&536870912?536870912:0:C;if(C!==0){i=C;e:{var P=o;y=Bl;var H=P.current.memoizedState.isDehydrated;if(H&&(ls(P,C).flags|=256),C=xm(P,C,!1),C!==2&&C!==6){if(mm&&!H){P.errorRecoveryDisabledLanes|=x,Xi|=x,y=4;break e}x=bn,bn=y,x!==null&&(bn===null?bn=x:bn.push.apply(bn,x))}y=C}if(x=!1,y!==2)continue}}if(y===1){ls(o,0),ni(o,i,0,!0);break}e:{switch(u=o,x=y,x){case 0:case 1:throw Error(a(345));case 4:if((i&4194048)!==i&&(i&62914560)!==i)break;case 6:ni(u,i,_n,!Jr);break e;case 2:bn=null;break;case 3:case 5:break;default:throw Error(a(329))}if((i&62914560)===i&&(y=fc+300-Xt(),10<y)){if(ni(u,i,_n,!Jr),Mr(u,0,!0)!==0)break e;Ao=i,u.timeoutHandle=Rm(rw.bind(null,u,d,bn,pc,gm,i,_n,Xi,os,Jr,x,"Throttled",-0,0),y);break e}rw(u,d,bn,pc,gm,i,_n,Xi,os,Jr,x,null,-0,0)}break}}while(!0);hr(o)}function rw(o,i,d,u,y,x,C,P,H,ie,ce,ye,te,ue){o.timeoutHandle=-1;var Se=i.subtreeFlags,Me=(x&335544064)===x;ye=null,(Me||Se&8192||(Se&16785408)==16785408)&&(ye={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:wo},$n=null,Zx(i,x,ye),Me&&(Se=ye,Me=o.containerInfo,Me=(Me.nodeType===9?Me:Me.ownerDocument).__reactViewTransition,Me!=null&&(Se.count++,Se.waitingForViewTransition=!0,Se=Zl.bind(Se),Me.finished.then(Se,Se))),Se=(x&62914560)===x?fc-Xt():(x&4194048)===x?ew-Xt():0,Se=aT(ye,Se),Se!==null)?(Ao=x,o.cancelPendingCommit=Se(fw.bind(null,o,i,x,d,u,y,C,P,H,ie,ce,ye,null,te,ue)),ni(o,x,C,!ie)):fw(o,i,x,d,u,y,C,P,H,ie,ce,ye)}function rA(o){for(var i=o;;){var d=i.tag;if((d===0||d===11||d===15)&&i.flags&16384&&(d=i.updateQueue,d!==null&&(d=d.stores,d!==null)))for(var u=0;u<d.length;u++){var y=d[u],x=y.getSnapshot;y=y.value;try{if(!jn(x(),y))return!1}catch{return!1}}if(d=i.child,i.subtreeFlags&16384&&d!==null)d.return=i,i=d;else{if(i===o)break;for(;i.sibling===null;){if(i.return===null||i.return===o)return!0;i=i.return}i.sibling.return=i.return,i=i.sibling}}return!0}function ni(o,i,d,u){i=$i(o,i),i&=~cc,i&=~Xi,o.suspendedLanes|=i,o.pingedLanes&=~i,u&&(o.warmLanes|=i),u=o.expirationTimes;for(var y=i;0<y;){var x=31-qt(y),C=1<<x;u[x]=-1,y&=~C}d!==0&&Go(o,d,i)}function gc(){return nt&6?!0:(Hl(0,!1),!1)}function bm(){if(Ze!==null){if(it===0)var o=Ze.return;else o=Ze,ar=Di=null,$p(o),Ya=null,Cl=0,o=Ze;for(;o!==null;)$x(o.alternate,o),o=o.return;Ze=null}}function ls(o,i){var d=o.timeoutHandle;return d!==-1&&(o.timeoutHandle=-1,CA(d)),d=o.cancelPendingCommit,d!==null&&(o.cancelPendingCommit=null,d()),Ao=0,bm(),ct=o,Ze=d=rr(o.current,null),Qe=i,it=0,En=null,Jr=!1,ns=Zt(o,i),mm=!1,os=_n=cc=Xi=ei=Nt=0,bn=Bl=null,gm=!1,fr=$i(o,i),Nu(),d}function iw(o,i){He=null,ee.H=Xu,i===Ua||i===Du?(i=mb(),it=3):i===pp?(i=mb(),it=4):it=i===qp?8:typeof i=="object"&&i&&typeof i.then=="function"?6:1,En=i,Ze===null&&(Nt=1,Zu(o,Rn(i,o.current)))}function aw(){var o=Qt.current;return o===null?!0:(Qe&4194048)===Qe?sn===null:(Qe&62914560)===Qe||Qe&536870912?o===sn:!1}function sw(){var o=ee.H;return ee.H=Xu,o===null?Xu:o}function lw(){var o=ee.A;return ee.A=nA,o}function yc(){Nt=4,Jr||(Qe&4194048)!==Qe&&Qt.current!==null||(ns=!0),!(ei&134217727)&&!(Xi&134217727)||ct===null||ni(ct,Qe,_n,!1)}function xm(o,i,d){var u=nt;nt|=2;var y=sw(),x=lw();(ct!==o||Qe!==i)&&(pc=null,ls(o,i)),i=!1;var C=Nt;e:do try{if(it!==0&&Ze!==null){var P=Ze,H=En;switch(it){case 8:bm(),C=6;break e;case 3:case 2:case 9:case 6:Qt.current===null&&(i=!0);var ie=it;if(it=0,En=null,ds(o,P,H,ie),d&&ns){C=0;break e}break;default:ie=it,it=0,En=null,ds(o,P,H,ie)}}iA(),C=Nt;break}catch(ce){iw(o,ce)}while(!0);return i&&o.shellSuspendCounter++,ar=Di=null,nt=u,ee.H=y,ee.A=x,Ze===null&&(ct=null,Qe=0,Nu()),C}function iA(){for(;Ze!==null;)dw(Ze)}function aA(o,i){var d=nt;nt|=2;var u=sw(),y=lw();ct!==o||Qe!==i?(pc=null,hc=Xt()+500,ls(o,i)):ns=Zt(o,i);e:do try{if(it!==0&&Ze!==null){i=Ze;var x=En;t:switch(it){case 1:it=0,En=null,ds(o,i,x,1);break;case 2:case 9:if(hb(x)){it=0,En=null,uw(i);break}i=function(){it!==2&&it!==9||ct!==o||(it=7),hr(o)},x.then(i,i);break e;case 3:it=7;break e;case 4:it=5;break e;case 7:hb(x)?(it=0,En=null,uw(i)):(it=0,En=null,ds(o,i,x,7));break;case 5:var C=null;switch(Ze.tag){case 26:C=Ze.memoizedState;case 5:case 27:var P=Ze;if(C?ok(C):P.stateNode.complete){it=0,En=null;var H=P.sibling;if(H!==null)Ze=H;else{var ie=P.return;ie===null?Ze=null:(Ze=ie,vc(ie))}break t}}it=0,En=null,ds(o,i,x,5);break;case 6:it=0,En=null,ds(o,i,x,6);break;case 8:bm(),Nt=6;break e;default:throw Error(a(462))}}sA();break}catch(ce){iw(o,ce)}while(!0);return ar=Di=null,ee.H=u,ee.A=y,nt=d,Ze===null?(ct=null,Qe=0,Nu(),Nt):0}function sA(){for(;Ze!==null&&!Ca();)dw(Ze)}function dw(o){var i=jx(o.alternate,o,fr);o.memoizedProps=o.pendingProps,i===null?vc(o):Ze=i}function uw(o){var i=o,d=i.alternate;switch(i.tag){case 15:case 0:i=vx(d,i,i.pendingProps,i.type,void 0,Qe);break;case 11:i=vx(d,i,i.pendingProps,i.type.render,i.ref,Qe);break;case 5:$p(i);var u=i;u===Vt&&(We?(Au(u),u.tag===5&&u.stateNode!=null&&(ft=u.stateNode)):(Au(u),We=!0));default:$x(d,i),i=Ze=nb(i,fr),i=jx(d,i,fr)}o.memoizedProps=o.pendingProps,i===null?vc(o):Ze=i}function ds(o,i,d,u){ar=Di=null,$p(i),Ya=null,Cl=0;var y=i.return;try{if(Y2(o,y,i,d,Qe)){Nt=1,Zu(o,Rn(d,o.current)),Ze=null;return}}catch(x){if(y!==null)throw Ze=y,x;Nt=1,Zu(o,Rn(d,o.current)),Ze=null;return}i.flags&32768?(We||u===1?o=!0:ns||Qe&536870912?o=!1:(Jr=o=!0,(u===2||u===9||u===3||u===6)&&(u=Qt.current,u!==null&&u.tag===13&&(u.flags|=16384))),cw(i,o)):vc(i)}function vc(o){var i=o;do{if(i.flags&32768){cw(i,Jr);return}o=i.return;var d=Q2(i.alternate,i,fr);if(d!==null){Ze=d;return}if(i=i.sibling,i!==null){Ze=i;return}Ze=i=o}while(i!==null);Nt===0&&(Nt=5)}function cw(o,i){do{var d=J2(o.alternate,o);if(d!==null){d.flags&=32767,Ze=d;return}if(d=o.return,d!==null&&(d.flags|=32768,d.subtreeFlags=0,d.deletions=null),!i&&(o=o.sibling,o!==null)){Ze=o;return}Ze=o=d}while(o!==null);Nt=6,Ze=null}function fw(o,i,d,u,y,x,C,P,H,ie,ce,ye){o.cancelPendingCommit=null;do bc();while(wt!==0);if(nt&6)throw Error(a(327));if(i!==null){if(i===o.current)throw Error(a(177));o===ct&&(Ze=ct=null,Qe=0),Zi=i,ro=o,Ao=d,vm=y,tw=u,lA(o,i,d,C,P,H,ye)}}function lA(o,i,d,u,y,x,C){var P=i.lanes|i.childLanes;if(ym=P,P|=tp,Ta(o,d,P,u,y,x),is=null,(d&335544064)===d?(as=O2(o),u=10262):(as=null,u=10256),(i.subtreeFlags&u)!==0||(i.flags&u)!==0?(o.callbackNode=null,o.callbackPriority=0,pA(Xo,function(){return Nm(),null})):(o.callbackNode=null,o.callbackPriority=0),rc=!1,u=!!(i.flags&13878),i.subtreeFlags&13878||u){u=ee.T,ee.T=null,y=de.p,de.p=2,x=nt,nt|=4;try{eA(o,i,d)}finally{nt=x,de.p=y,ee.T=u}}wt=1,rc?rs=MA(C,o.containerInfo,as,wm,km,uA,Sm,Nm,dA,null,null):(wm(),km(),Sm())}function dA(o){if(wt!==0){var i=ro.onRecoverableError;i(o,{componentStack:null})}}function uA(){wt===3&&(wt=0,Yx(Zi,ro),wt=4)}function wm(){if(wt===1){wt=0;var o=ro,i=Zi,d=Ao,u=!!(i.flags&13878);if(i.subtreeFlags&13878||u){u=ee.T,ee.T=null;var y=de.p;de.p=2;var x=nt;nt|=4;try{Rl=sc=!1,Wx(i,o,d),d=Dm;var C=Wv(o.containerInfo),P=d.focusedElem,H=d.selectionRange;if(C!==P&&P&&P.ownerDocument&&Kv(P.ownerDocument.documentElement,P)){if(H!==null&&Zh(P)){var ie=H.start,ce=H.end;if(ce===void 0&&(ce=ie),"selectionStart"in P)P.selectionStart=ie,P.selectionEnd=Math.min(ce,P.value.length);else{var ye=P.ownerDocument||document,te=ye&&ye.defaultView||window;if(te.getSelection){var ue=te.getSelection(),Se=P.textContent.length,Me=Math.min(H.start,Se),Ve=H.end===void 0?Me:Math.min(H.end,Se);!ue.extend&&Me>Ve&&(C=Ve,Ve=Me,Me=C);var ne=Vv(P,Me),Y=Vv(P,Ve);if(ne&&Y&&(ue.rangeCount!==1||ue.anchorNode!==ne.node||ue.anchorOffset!==ne.offset||ue.focusNode!==Y.node||ue.focusOffset!==Y.offset)){var se=ye.createRange();se.setStart(ne.node,ne.offset),ue.removeAllRanges(),Me>Ve?(ue.addRange(se),ue.extend(Y.node,Y.offset)):(se.setEnd(Y.node,Y.offset),ue.addRange(se))}}}}for(ye=[],ue=P;ue=ue.parentNode;)ue.nodeType===1&&ye.push({element:ue,left:ue.scrollLeft,top:ue.scrollTop});for(typeof P.focus=="function"&&P.focus(),P=0;P<ye.length;P++){var ge=ye[P];ge.element.scrollLeft=ge.left,ge.element.scrollTop=ge.top}}ys=!!Pm,Dm=Pm=null}finally{nt=x,de.p=y,ee.T=u}}o.current=i,wt=2}}function km(){if(wt===2){wt=0;var o=ro,i=Zi,d=!!(i.flags&8772);if(i.subtreeFlags&8772||d){d=ee.T,ee.T=null;var u=de.p;de.p=2;var y=nt;nt|=4;try{Fx(o,i.alternate,i)}finally{nt=y,de.p=u,ee.T=d}}wt=3}}function Sm(){if(wt===4||wt===3){wt=0;var o=rs;rs=null,dl();var i=ro,d=Zi,u=Ao,y=tw,x=(u&335544064)===u?10262:10256;if((d.subtreeFlags&x)!==0||(d.flags&x)!==0?wt=5:(wt=0,Zi=ro=null,hw(i,i.pendingLanes)),x=i.pendingLanes,x===0&&(ti=null),D(u),d=d.stateNode,jt&&typeof jt.onCommitFiberRoot=="function")try{jt.onCommitFiberRoot(Dn,d,void 0,(d.current.flags&128)==128)}catch{}if(y!==null){d=ee.T,x=de.p,de.p=2,ee.T=null;try{for(var C=i.onRecoverableError,P=0;P<y.length;P++){var H=y[P];C(H.value,{componentStack:H.stack})}}finally{ee.T=d,de.p=x}}if(y=is,C=as,as=null,y!==null&&(is=null,C===null&&(C=[]),o!==null))for(H=0;H<y.length;H++)d=(0,y[H])(C),d!==void 0&&o.finished.finally(d);Ao&3&&bc(),hr(i),x=i.pendingLanes,u&261930&&x&42?i===mc?ql++:(ql=0,mc=i):(ql=0,mc=null),Hl(0,!1)}}function hw(o,i){(o.pooledCacheLanes&=i)===0&&(i=o.pooledCache,i!=null&&(o.pooledCache=null,Sl(i)))}function bc(){return rs!==null&&(rs.skipTransition(),rs=null),wm(),km(),Sm(),Nm()}function Nm(){if(wt!==5)return!1;var o=ro,i=ym;ym=0;var d=D(Ao),u=ee.T,y=de.p;try{de.p=32>d?32:d,ee.T=null,d=vm,vm=null;var x=ro,C=Ao;if(wt=0,Zi=ro=null,Ao=0,nt&6)throw Error(a(331));var P=nt;if(nt|=4,Qx(x.current),Xx(x,x.current,C,d),nt=P,Hl(0,!1),jt&&typeof jt.onPostCommitFiberRoot=="function")try{jt.onPostCommitFiberRoot(Dn,x)}catch{}return!0}finally{de.p=y,ee.T=u,hw(o,i)}}function pw(o,i,d){i=Rn(d,i),i=Bp(o.stateNode,i,2),o=Vi(o,i,2),o!==null&&(Zo(o,2),hr(o))}function at(o,i,d){if(o.tag===3)pw(o,o,d);else for(;i!==null;){if(i.tag===3){pw(i,o,d);break}if(i.tag===1){var u=i.stateNode;if(typeof i.type.getDerivedStateFromError=="function"||typeof u.componentDidCatch=="function"&&(ti===null||!ti.has(u))){o=Rn(d,o),d=ux(2),u=Vi(i,d,2),u!==null&&(cx(d,u,i,o),Zo(u,2),hr(u));break}}i=i.return}}function jm(o,i,d){var u=o.pingCache;if(u===null){u=o.pingCache=new oA;var y=new Set;u.set(i,y)}else y=u.get(i),y===void 0&&(y=new Set,u.set(i,y));y.has(d)||(mm=!0,y.add(d),o=cA.bind(null,o,i,d),i.then(o,o))}function cA(o,i,d){var u=o.pingCache;u!==null&&u.delete(i),o.pingedLanes|=o.suspendedLanes&d,o.warmLanes&=~d,ct===o&&(Qe&d)===d&&(Nt===4||Nt===3&&(Qe&62914560)===Qe&&300>Xt()-fc?nt&2?cc|=d:ls(o,0):cc|=d,os===Qe&&(os=0)),hr(o)}function mw(o,i){i===0&&(i=Ei()),o=Mi(o,i),o!==null&&(Zo(o,i),hr(o))}function fA(o){var i=o.memoizedState,d=0;i!==null&&(d=i.retryLane),mw(o,d)}function hA(o,i){var d=0;switch(o.tag){case 31:case 13:var u=o.stateNode,y=o.memoizedState;y!==null&&(d=y.retryLane);break;case 19:u=o.stateNode;break;case 22:u=o.stateNode._retryCache;break;default:throw Error(a(314))}u!==null&&u.delete(i),mw(o,d)}function pA(o,i){return Yo(o,i)}var us=null,cs=null,Cm=!1,xc=!1,$m=!1,oi=0;function hr(o){o!==cs&&o.next===null&&(cs===null?us=cs=o:cs=cs.next=o),xc=!0,Cm||(Cm=!0,gA())}function Hl(o,i){if(!$m&&xc){$m=!0;do for(var d=!1,u=us;u!==null;){if(!i)if(o!==0){var y=u.pendingLanes;if(y===0)var x=0;else{var C=u.suspendedLanes,P=u.pingedLanes;x=(1<<31-qt(42|o)+1)-1,x&=y&~(C&~P),x=x&201326741?x&201326741|1:x?x|2:0}x!==0&&(d=!0,bw(u,x))}else x=Qe,x=Mr(u,u===ct?x:0,u.cancelPendingCommit!==null||u.timeoutHandle!==-1),!(x&3)||Zt(u,x)||(d=!0,bw(u,x));u=u.next}while(d);$m=!1}}function mA(){gw()}function gw(){xc=Cm=!1;var o=0;oi!==0&&jA()&&(o=oi);for(var i=Xt(),d=null,u=us;u!==null;){var y=u.next,x=yw(u,i);x===0?(u.next=null,d===null?us=y:d.next=y,y===null&&(cs=d)):(d=u,(o!==0||x&3)&&(xc=!0)),u=y}wt!==0&&wt!==5||Hl(o,!1),oi!==0&&(oi=0)}function yw(o,i){for(var d=o.suspendedLanes,u=o.pingedLanes,y=o.expirationTimes,x=o.pendingLanes&-62914561;0<x;){var C=31-qt(x),P=1<<C,H=y[C];H===-1?((P&d)===0||(P&u)!==0)&&(y[C]=Or(P,i)):H<=i&&(o.expiredLanes|=P),x&=~P}if(i=ct,d=Qe,d=Mr(o,o===i?d:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),u=o.callbackNode,d===0||o===i&&(it===2||it===9)||o.cancelPendingCommit!==null)return u!==null&&u!==null&&Sn(u),o.callbackNode=null,o.callbackPriority=0;if(!(d&3)||Zt(o,d)){if(i=d&-d,i===o.callbackPriority)return i;switch(u!==null&&Sn(u),D(d)){case 2:case 8:d=Ni;break;case 32:d=Xo;break;case 268435456:d=_a;break;default:d=Xo}return u=vw.bind(null,o),d=Yo(d,u),o.callbackPriority=i,o.callbackNode=d,i}return u!==null&&u!==null&&Sn(u),o.callbackPriority=2,o.callbackNode=null,2}function vw(o,i){if(wt!==0&&wt!==5)return o.callbackNode=null,o.callbackPriority=0,null;var d=o.callbackNode;if(bc()&&o.callbackNode!==d)return null;var u=Qe;return u=Mr(o,o===ct?u:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),u===0?null:(ow(o,u,i),yw(o,Xt()),o.callbackNode!=null&&o.callbackNode===d?vw.bind(null,o):null)}function bw(o,i){if(bc())return null;ow(o,i,!0)}function gA(){$A(function(){nt&6?Yo(_r,mA):gw()})}function Em(){if(oi===0){var o=Ri;o===0&&(o=Ar,Ar<<=1,!(Ar&261888)&&(Ar=256)),oi=o}return oi}function xw(o){return o==null||typeof o=="symbol"||typeof o=="boolean"?null:typeof o=="function"?o:gu(o)}function yA(o,i,d,u,y){if(i==="submit"&&d&&d.stateNode===y){var x=xw((y[Te]||null).action),C=u.submitter;C&&(i=(i=C[Te]||null)?xw(i.formAction):C.getAttribute("formAction"),i!==null&&(x=i,C=null));var P=new xu("action","action",null,u,y);o.push({event:P,listeners:[{instance:null,listener:function(){if(u.defaultPrevented){if(oi!==0){var H=new FormData(y,C);Ip(d,{pending:!0,data:H,method:y.method,action:x},null,H)}}else typeof x=="function"&&(P.preventDefault(),H=new FormData(y,C),Ip(d,{pending:!0,data:H,method:y.method,action:x},x,H))},currentTarget:y}]})}}for(var _m=0;_m<ep.length;_m++){var Am=ep[_m];eo(Am.toLowerCase(),"on"+(Am[0].toUpperCase()+Am.slice(1)))}eo(Xv,"onAnimationEnd"),eo(Zv,"onAnimationIteration"),eo(Gv,"onAnimationStart"),eo("dblclick","onDoubleClick"),eo("focusin","onFocus"),eo("focusout","onBlur"),eo(j2,"onTransitionRun"),eo(C2,"onTransitionStart"),eo($2,"onTransitionCancel"),eo(Qv,"onTransitionEnd"),zr("onMouseEnter",["mouseout","mouseover"]),zr("onMouseLeave",["mouseout","mouseover"]),zr("onPointerEnter",["pointerout","pointerover"]),zr("onPointerLeave",["pointerout","pointerover"]),Jo("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Jo("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Jo("onBeforeInput",["compositionend","keypress","textInput","paste"]),Jo("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Jo("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Jo("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Vl="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(" "),vA=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Vl));function ww(o,i){i=!!(i&4);for(var d=0;d<o.length;d++){var u=o[d],y=u.event;u=u.listeners;e:{var x=void 0;if(i)for(var C=u.length-1;0<=C;C--){var P=u[C],H=P.instance,ie=P.currentTarget;if(P=P.listener,H!==x&&y.isPropagationStopped())break e;x=P,y.currentTarget=ie;try{x(y)}catch(ce){Su(ce)}y.currentTarget=null,x=H}else for(C=0;C<u.length;C++){if(P=u[C],H=P.instance,ie=P.currentTarget,P=P.listener,H!==x&&y.isPropagationStopped())break e;x=P,y.currentTarget=ie;try{x(y)}catch(ce){Su(ce)}y.currentTarget=null,x=H}}}}function Ge(o,i){var d=i[Re];d===void 0&&(d=i[Re]=new Set);var u=o+"__bubble";d.has(u)||(Sw(i,o,2,!1),d.add(u))}function Tm(o,i,d){var u=0;i&&(u|=4),Sw(d,o,u,i)}var wc="_reactListening"+Math.random().toString(36).slice(2);function kw(o){if(!o[wc]){o[wc]=!0,fu.forEach(function(d){d!=="selectionchange"&&(vA.has(d)||Tm(d,!1,o),Tm(d,!0,o))});var i=o.nodeType===9?o:o.ownerDocument;i===null||i[wc]||(i[wc]=!0,Tm("selectionchange",!1,i))}}function Sw(o,i,d,u){switch(ck(i)){case 2:var y=fT;break;case 8:y=hT;break;default:y=Gm}d=y.bind(null,i,d,o),y=void 0,!Fh||i!=="touchstart"&&i!=="touchmove"&&i!=="wheel"||(y=!0),u?y===void 0?o.addEventListener(i,d,!0):o.addEventListener(i,d,{capture:!0,passive:y}):y===void 0?o.addEventListener(i,d,!1):o.addEventListener(i,d,{passive:y})}function Mm(o,i,d,u,y){var x=u;if(!(i&1)&&!(i&2)&&u!==null)e:for(;;){if(u===null)return;var C=u.tag;if(C===3||C===4){var P=u.stateNode.containerInfo;if(P===y)break;if(C===4)for(C=u.return;C!==null;){var H=C.tag;if((H===3||H===4)&&C.stateNode.containerInfo===y)return;C=C.return}for(;P!==null;){if(C=Qo(P),C===null)return;if(H=C.tag,H===5||H===6||H===26||H===27){u=x=C;continue e}P=P.parentNode}}u=u.return}jv(function(){var ie=x,ce=Rh(d),ye=[];e:{var te=Jv.get(o);if(te!==void 0){var ue=xu,Se=o;switch(o){case"keypress":if(vu(d)===0)break e;case"keydown":case"keyup":ue=s2;break;case"focusin":Se="focus",ue=Vh;break;case"focusout":Se="blur",ue=Vh;break;case"beforeblur":case"afterblur":ue=Vh;break;case"click":if(d.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ue=Ev;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ue=e2;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ue=d2;break;case Xv:case Zv:case Gv:ue=t2;break;case Qv:ue=u2;break;case"scroll":case"scrollend":ue=J_;break;case"wheel":ue=c2;break;case"copy":case"cut":case"paste":ue=n2;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ue=Av;break;case"submit":ue=l2;break;case"toggle":case"beforetoggle":ue=f2}var Me=!!(i&4),Ve=!Me&&(o==="scroll"||o==="scrollend"),ne=Me?te===null?null:te+"Capture":te;Me=[];for(var Y=ie,se;Y!==null;){var ge=Y;if(se=ge.stateNode,ge=ge.tag,ge!==5&&ge!==26&&ge!==27||se===null||ne===null||(ge=fl(Y,ne),ge!=null&&Me.push(Kl(Y,ge,se))),Ve)break;Y=Y.return}0<Me.length&&(te=new ue(te,Se,null,d,ce),ye.push({event:te,listeners:Me}))}}if(!(i&7)){e:{if(ue=o==="mouseover"||o==="pointerover",te=o==="mouseout"||o==="pointerout",ue&&d!==Lh&&(Se=d.relatedTarget||d.fromElement)&&(Qo(Se)||Se[Xe]))break e;(te||ue)&&(Se=ce.window===ce?ce:(ue=ce.ownerDocument)?ue.defaultView||ue.parentWindow:window,te?(ue=d.relatedTarget||d.toElement,te=ie,ue=ue?Qo(ue):null,ue!==null&&(Ve=l(ue),Me=ue.tag,ue!==Ve||Me!==5&&Me!==27&&Me!==6)&&(ue=null)):(te=null,ue=ie),te!==ue&&(Me=Ev,ge="onMouseLeave",ne="onMouseEnter",Y="mouse",(o==="pointerout"||o==="pointerover")&&(Me=Av,ge="onPointerLeave",ne="onPointerEnter",Y="pointer"),Ve=te==null?Se:Lr(te),se=ue==null?Se:Lr(ue),Se=new Me(ge,Y+"leave",te,d,ce),Se.target=Ve,Se.relatedTarget=se,ge=null,Qo(ce)===ie&&(Me=new Me(ne,Y+"enter",ue,d,ce),Me.target=se,Me.relatedTarget=Ve,ge=Me),Ve=ge,Me=te&&ue?T(te,ue,bA):null,te!==null&&Nw(ye,Se,te,Me,!1),ue!==null&&Ve!==null&&Nw(ye,Ve,ue,Me,!0)))}e:{if(te=ie?Lr(ie):window,ue=te.nodeName&&te.nodeName.toLowerCase(),ue==="select"||ue==="input"&&te.type==="file")var _e=Rv;else if(Iv(te))if(zv)_e=k2;else{_e=x2;var Je=b2}else ue=te.nodeName,!ue||ue.toLowerCase()!=="input"||te.type!=="checkbox"&&te.type!=="radio"?ie&&Ih(ie.elementType)&&(_e=Rv):_e=w2;if(_e&&=_e(o,ie)){Lv(ye,_e,d,ce);break e}Je&&Je(o,te,ie)}switch(Je=ie?Lr(ie):window,o){case"focusin":(Iv(Je)||Je.contentEditable==="true")&&(za=Je,Gh=ie,xl=null);break;case"focusout":xl=Gh=za=null;break;case"mousedown":Qh=!0;break;case"contextmenu":case"mouseup":case"dragend":Qh=!1,Uv(ye,d,ce);break;case"selectionchange":if(N2)break;case"keydown":case"keyup":Uv(ye,d,ce)}var Oe;if(Wh)e:{switch(o){case"compositionstart":var Ie="onCompositionStart";break e;case"compositionend":Ie="onCompositionEnd";break e;case"compositionupdate":Ie="onCompositionUpdate";break e}Ie=void 0}else Ra?Pv(o,d)&&(Ie="onCompositionEnd"):o==="keydown"&&d.keyCode===229&&(Ie="onCompositionStart");Ie&&(Tv&&d.locale!=="ko"&&(Ra||Ie!=="onCompositionStart"?Ie==="onCompositionEnd"&&Ra&&(Oe=Cv()):(Fr=ce,Bh="value"in Fr?Fr.value:Fr.textContent,Ra=!0)),Je=kc(ie,Ie),0<Je.length&&(Ie=new _v(Ie,o,null,d,ce),ye.push({event:Ie,listeners:Je}),Oe?Ie.data=Oe:(Oe=Dv(d),Oe!==null&&(Ie.data=Oe)))),(Oe=p2?m2(o,d):g2(o,d))&&(Ie=kc(ie,"onBeforeInput"),0<Ie.length&&(Je=new _v("onBeforeInput","beforeinput",null,d,ce),ye.push({event:Je,listeners:Ie}),Je.data=Oe)),yA(ye,o,ie,d,ce)}ww(ye,i)})}function Kl(o,i,d){return{instance:o,listener:i,currentTarget:d}}function kc(o,i){for(var d=i+"Capture",u=[];o!==null;){var y=o,x=y.stateNode;if(y=y.tag,y!==5&&y!==26&&y!==27||x===null||(y=fl(o,d),y!=null&&u.unshift(Kl(o,y,x)),y=fl(o,i),y!=null&&u.push(Kl(o,y,x))),o.tag===3)return u;o=o.return}return[]}function bA(o){if(o===null)return null;do o=o.return;while(o&&o.tag!==5&&o.tag!==27);return o||null}function Nw(o,i,d,u,y){for(var x=i._reactName,C=[];d!==null&&d!==u;){var P=d,H=P.alternate,ie=P.stateNode;if(P=P.tag,H!==null&&H===u)break;P!==5&&P!==26&&P!==27||ie===null||(H=ie,y?(ie=fl(d,x),ie!=null&&C.unshift(Kl(d,ie,H))):y||(ie=fl(d,x),ie!=null&&C.push(Kl(d,ie,H)))),d=d.return}C.length!==0&&o.push({event:i,listeners:C})}var xA=/\r\n?/g,wA=/\u0000|\uFFFD/g;function jw(o){return(typeof o=="string"?o:""+o).replace(xA,`
|
|
9
|
+
`).replace(wA,"")}function Cw(o,i){return i=jw(i),jw(o)===i}function st(o,i,d,u,y,x){switch(d){case"children":if(typeof u=="string")i==="body"||i==="textarea"&&u===""||Da(o,u);else if(typeof u=="number"||typeof u=="bigint")i!=="body"&&Da(o,""+u);else return;break;case"className":mu(o,"class",u);break;case"tabIndex":mu(o,"tabindex",u);break;case"dir":case"role":case"viewBox":case"width":case"height":mu(o,d,u);break;case"style":Sv(o,u,x);return;case"data":if(i!=="object"){mu(o,"data",u);break}case"src":case"href":if(u===""&&(i!=="a"||d!=="href")||u==null||typeof u=="function"||typeof u=="symbol"||typeof u=="boolean"){o.removeAttribute(d);break}u=gu(u),o.setAttribute(d,u);break;case"action":case"formAction":if(typeof u=="function"){o.setAttribute(d,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}if(typeof x=="function"&&(d==="formAction"?(i!=="input"&&st(o,i,"name",y.name,y,null),st(o,i,"formEncType",y.formEncType,y,null),st(o,i,"formMethod",y.formMethod,y,null),st(o,i,"formTarget",y.formTarget,y,null)):(st(o,i,"encType",y.encType,y,null),st(o,i,"method",y.method,y,null),st(o,i,"target",y.target,y,null))),u==null||typeof u=="symbol"||typeof u=="boolean"){o.removeAttribute(d);break}u=gu(u),o.setAttribute(d,u);break;case"onClick":u!=null&&(o.onclick=wo);return;case"onScroll":u!=null&&Ge("scroll",o);return;case"onScrollEnd":u!=null&&Ge("scrollend",o);return;case"dangerouslySetInnerHTML":if(u!=null){if(typeof u!="object"||!("__html"in u))throw Error(a(61));if(d=u.__html,d!=null){if(y.children!=null)throw Error(a(60));x?.__html!==d&&(o.innerHTML=d)}}break;case"multiple":o.multiple=u&&typeof u!="function"&&typeof u!="symbol";break;case"muted":o.muted=u&&typeof u!="function"&&typeof u!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(u==null||typeof u=="function"||typeof u=="boolean"||typeof u=="symbol"){o.removeAttribute("xlink:href");break}d=gu(u),o.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",d);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":u!=null&&typeof u!="function"&&typeof u!="symbol"?o.setAttribute(d,u):o.removeAttribute(d);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"credentialless":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":u&&typeof u!="function"&&typeof u!="symbol"?o.setAttribute(d,""):o.removeAttribute(d);break;case"capture":case"download":u===!0?o.setAttribute(d,""):u!==!1&&u!=null&&typeof u!="function"&&typeof u!="symbol"?o.setAttribute(d,u):o.removeAttribute(d);break;case"cols":case"rows":case"size":case"span":u!=null&&typeof u!="function"&&typeof u!="symbol"&&!isNaN(u)&&1<=u?o.setAttribute(d,u):o.removeAttribute(d);break;case"rowSpan":case"start":u==null||typeof u=="function"||typeof u=="symbol"||isNaN(u)?o.removeAttribute(d):o.setAttribute(d,u);break;case"popover":Ge("beforetoggle",o),Ge("toggle",o),pu(o,"popover",u);break;case"xlinkActuate":er(o,"http://www.w3.org/1999/xlink","xlink:actuate",u);break;case"xlinkArcrole":er(o,"http://www.w3.org/1999/xlink","xlink:arcrole",u);break;case"xlinkRole":er(o,"http://www.w3.org/1999/xlink","xlink:role",u);break;case"xlinkShow":er(o,"http://www.w3.org/1999/xlink","xlink:show",u);break;case"xlinkTitle":er(o,"http://www.w3.org/1999/xlink","xlink:title",u);break;case"xlinkType":er(o,"http://www.w3.org/1999/xlink","xlink:type",u);break;case"xmlBase":er(o,"http://www.w3.org/XML/1998/namespace","xml:base",u);break;case"xmlLang":er(o,"http://www.w3.org/XML/1998/namespace","xml:lang",u);break;case"xmlSpace":er(o,"http://www.w3.org/XML/1998/namespace","xml:space",u);break;case"is":pu(o,"is",u);break;case"innerText":case"textContent":return;default:if(!(2<d.length)||d[0]!=="o"&&d[0]!=="O"||d[1]!=="n"&&d[1]!=="N")d=G_.get(d)||d,pu(o,d,u);else return}tt=!0}function Om(o,i,d,u,y,x){switch(d){case"style":Sv(o,u,x);return;case"dangerouslySetInnerHTML":if(u!=null){if(typeof u!="object"||!("__html"in u))throw Error(a(61));if(d=u.__html,d!=null){if(y.children!=null)throw Error(a(60));x?.__html!==d&&(o.innerHTML=d)}}break;case"children":if(typeof u=="string")Da(o,u);else if(typeof u=="number"||typeof u=="bigint")Da(o,""+u);else return;break;case"onScroll":u!=null&&Ge("scroll",o);return;case"onScrollEnd":u!=null&&Ge("scrollend",o);return;case"onClick":u!=null&&(o.onclick=wo);return;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":return;case"innerText":case"textContent":return;default:if(!Oa.hasOwnProperty(d))e:{if(d[0]==="o"&&d[1]==="n"&&(y=d.endsWith("Capture"),x=d.slice(2,y?d.length-7:void 0),i=o[Te]||null,i=i==null?null:i[d],typeof i=="function"&&o.removeEventListener(x,i,y),typeof u=="function")){typeof i!="function"&&i!==null&&(d in o?o[d]=null:o.hasAttribute(d)&&o.removeAttribute(d)),o.addEventListener(x,u,y);break e}tt=!0,d in o?o[d]=u:u===!0?o.setAttribute(d,""):pu(o,d,u)}return}tt=!0}function tn(o,i,d){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ge("error",o),Ge("load",o);var u=!1,y=!1,x;for(x in d)if(d.hasOwnProperty(x)){var C=d[x];if(C!=null)switch(x){case"src":u=!0;break;case"srcSet":y=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(a(137,i));default:st(o,i,x,C,d,null)}}y&&st(o,i,"srcSet",d.srcSet,d,null),u&&st(o,i,"src",d.src,d,null);return;case"input":Ge("invalid",o);var P=x=C=y=null,H=null,ie=null;for(u in d)if(d.hasOwnProperty(u)){var ce=d[u];if(ce!=null)switch(u){case"name":y=ce;break;case"type":C=ce;break;case"checked":H=ce;break;case"defaultChecked":ie=ce;break;case"value":x=ce;break;case"defaultValue":P=ce;break;case"children":case"dangerouslySetInnerHTML":if(ce!=null)throw Error(a(137,i));break;default:st(o,i,u,ce,d,null)}}bv(o,x,P,H,ie,C,y,!1);return;case"select":for(y in Ge("invalid",o),u=C=x=null,d)if(d.hasOwnProperty(y)&&(P=d[y],P!=null))switch(y){case"value":x=P;break;case"defaultValue":C=P;break;case"multiple":u=P;default:st(o,i,y,P,d,null)}i=x,d=C,o.multiple=!!u,i==null?d!=null&&Pa(o,!!u,d,!0):Pa(o,!!u,i,!1);return;case"textarea":for(C in Ge("invalid",o),x=y=u=null,d)if(d.hasOwnProperty(C)&&(P=d[C],P!=null))switch(C){case"value":u=P;break;case"defaultValue":y=P;break;case"children":x=P;break;case"dangerouslySetInnerHTML":if(P!=null)throw Error(a(91));break;default:st(o,i,C,P,d,null)}wv(o,u,y,x);return;case"option":for(H in d)d.hasOwnProperty(H)&&(u=d[H],u!=null)&&(H==="selected"?o.selected=u&&typeof u!="function"&&typeof u!="symbol":st(o,i,H,u,d,null));return;case"dialog":Ge("beforetoggle",o),Ge("toggle",o),Ge("cancel",o),Ge("close",o);break;case"iframe":case"object":Ge("load",o);break;case"video":case"audio":for(u=0;u<Vl.length;u++)Ge(Vl[u],o);break;case"image":Ge("error",o),Ge("load",o);break;case"details":Ge("toggle",o);break;case"embed":case"source":case"link":Ge("error",o),Ge("load",o);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(ie in d)if(d.hasOwnProperty(ie)&&(u=d[ie],u!=null))switch(ie){case"children":case"dangerouslySetInnerHTML":throw Error(a(137,i));default:st(o,i,ie,u,d,null)}return;default:if(Ih(i)){for(ce in d)d.hasOwnProperty(ce)&&(u=d[ce],u!==void 0&&Om(o,i,ce,u,d,void 0));return}}for(P in d)d.hasOwnProperty(P)&&(u=d[P],u!=null&&st(o,i,P,u,d,null))}var kA={};function SA(o,i,d,u){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var y=null,x=null,C=null,P=null,H=null,ie=null,ce=null;for(ue in d){var ye=d[ue];if(d.hasOwnProperty(ue)&&ye!=null)switch(ue){case"checked":break;case"value":break;case"defaultValue":H=ye;default:u.hasOwnProperty(ue)||st(o,i,ue,null,u,ye)}}for(var te in u){var ue=u[te];if(ye=d[te],u.hasOwnProperty(te)&&(ue!=null||ye!=null))switch(te){case"type":ue!==ye&&(tt=!0),x=ue;break;case"name":ue!==ye&&(tt=!0),y=ue;break;case"checked":ue!==ye&&(tt=!0),ie=ue;break;case"defaultChecked":ue!==ye&&(tt=!0),ce=ue;break;case"value":ue!==ye&&(tt=!0),C=ue;break;case"defaultValue":ue!==ye&&(tt=!0),P=ue;break;case"children":case"dangerouslySetInnerHTML":if(ue!=null)throw Error(a(137,i));break;default:ue!==ye&&st(o,i,te,ue,u,ye)}}Ph(o,C,P,H,ie,ce,x,y);return;case"select":for(x in ue=C=P=te=null,d)if(H=d[x],d.hasOwnProperty(x)&&H!=null)switch(x){case"value":break;case"multiple":ue=H;default:u.hasOwnProperty(x)||st(o,i,x,null,u,H)}for(y in u)if(x=u[y],H=d[y],u.hasOwnProperty(y)&&(x!=null||H!=null))switch(y){case"value":x!==H&&(tt=!0),te=x;break;case"defaultValue":x!==H&&(tt=!0),P=x;break;case"multiple":x!==H&&(tt=!0),C=x;default:x!==H&&st(o,i,y,x,u,H)}i=P,d=C,u=ue,te==null?!!u!=!!d&&(i==null?Pa(o,!!d,d?[]:"",!1):Pa(o,!!d,i,!0)):Pa(o,!!d,te,!1);return;case"textarea":for(P in ue=te=null,d)if(y=d[P],d.hasOwnProperty(P)&&y!=null&&!u.hasOwnProperty(P))switch(P){case"value":break;case"children":break;default:st(o,i,P,null,u,y)}for(C in u)if(y=u[C],x=d[C],u.hasOwnProperty(C)&&(y!=null||x!=null))switch(C){case"value":y!==x&&(tt=!0),te=y;break;case"defaultValue":y!==x&&(tt=!0),ue=y;break;case"children":break;case"dangerouslySetInnerHTML":if(y!=null)throw Error(a(91));break;default:y!==x&&st(o,i,C,y,u,x)}xv(o,te,ue);return;case"option":for(var Se in d)te=d[Se],d.hasOwnProperty(Se)&&te!=null&&!u.hasOwnProperty(Se)&&(Se==="selected"?o.selected=!1:st(o,i,Se,null,u,te));for(H in u)te=u[H],ue=d[H],u.hasOwnProperty(H)&&te!==ue&&(te!=null||ue!=null)&&(H==="selected"?(te!==ue&&(tt=!0),o.selected=te&&typeof te!="function"&&typeof te!="symbol"):st(o,i,H,te,u,ue));return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Me in d)te=d[Me],d.hasOwnProperty(Me)&&te!=null&&!u.hasOwnProperty(Me)&&st(o,i,Me,null,u,te);for(ie in u)if(te=u[ie],ue=d[ie],u.hasOwnProperty(ie)&&te!==ue&&(te!=null||ue!=null))switch(ie){case"children":case"dangerouslySetInnerHTML":if(te!=null)throw Error(a(137,i));break;default:st(o,i,ie,te,u,ue)}return;default:if(Ih(i)){for(var Ve in d)te=d[Ve],d.hasOwnProperty(Ve)&&te!==void 0&&!u.hasOwnProperty(Ve)&&Om(o,i,Ve,void 0,u,te);for(ce in u)te=u[ce],ue=d[ce],!u.hasOwnProperty(ce)||te===ue||te===void 0&&ue===void 0||Om(o,i,ce,te,u,ue);return}}for(var ne in d)te=d[ne],d.hasOwnProperty(ne)&&te!=null&&!u.hasOwnProperty(ne)&&st(o,i,ne,null,u,te);for(ye in u)te=u[ye],ue=d[ye],!u.hasOwnProperty(ye)||te===ue||te==null&&ue==null||st(o,i,ye,te,u,ue)}function $w(o){switch(o){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function NA(){if(typeof performance.getEntriesByType=="function"){for(var o=0,i=0,d=performance.getEntriesByType("resource"),u=0;u<d.length;u++){var y=d[u],x=y.transferSize,C=y.initiatorType,P=y.duration;if(x&&P&&$w(C)){for(C=0,P=y.responseEnd,u+=1;u<d.length;u++){var H=d[u],ie=H.startTime;if(ie>P)break;var ce=H.transferSize,ye=H.initiatorType;ce&&$w(ye)&&(H=H.responseEnd,C+=ce*(H<P?1:(P-ie)/(H-ie)))}if(--u,i+=8*(x+C)/(y.duration/1e3),o++,10<o)break}}if(0<o)return i/o/1e6}return navigator.connection&&(o=navigator.connection.downlink,typeof o=="number")?o:5}var Pm=null,Dm=null;function Wl(o){return o.nodeType===9?o:o.ownerDocument}function Ew(o){switch(o){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function _w(o,i){if(o===0)switch(i){case"svg":return 1;case"math":return 2;default:return 0}return o===1&&i==="foreignObject"?0:o}function Aw(o,i,d,u){return d=Wl(d).createElement(o),d[ke]=u,d[Te]=i,tn(d,o,i),Ct(d),d}function Im(o,i){return o==="textarea"||o==="noscript"||typeof i.children=="string"||typeof i.children=="number"||typeof i.children=="bigint"||typeof i.dangerouslySetInnerHTML=="object"&&i.dangerouslySetInnerHTML!==null&&i.dangerouslySetInnerHTML.__html!=null}var Lm=null;function jA(){var o=window.event;return o&&o.type==="popstate"?o!==Lm&&(Lm=o,!0):(Lm=null,!1)}var Rm=typeof setTimeout=="function"?setTimeout:void 0,CA=typeof clearTimeout=="function"?clearTimeout:void 0,Tw=typeof Promise=="function"?Promise:void 0,Mw=typeof requestAnimationFrame=="function"?requestAnimationFrame:Rm,$A=typeof queueMicrotask=="function"?queueMicrotask:Tw===void 0?Rm:function(o){return Tw.resolve(null).then(o).catch(EA)};function EA(o){setTimeout(function(){throw o})}function ri(o){return o==="head"}function Ow(o,i){var d=i,u=0;do{var y=d.nextSibling;if(o.removeChild(d),y&&y.nodeType===8)if(d=y.data,d==="/$"||d==="/&"){if(u===0){o.removeChild(y),vs(i);return}u--}else if(d==="$"||d==="$?"||d==="$~"||d==="$!"||d==="&")u++;else if(d==="html")Wm(o.ownerDocument.documentElement);else if(d==="head"){d=o.ownerDocument.head,Wm(d);for(var x=d.firstChild;x;){var C=x.nextSibling,P=x.nodeName;x[Ht]||P==="SCRIPT"||P==="STYLE"||P==="LINK"&&x.rel.toLowerCase()==="stylesheet"||d.removeChild(x),x=C}}else d==="body"&&Wm(o.ownerDocument.body);d=y}while(d);vs(i)}function Pw(o,i){var d=o;o=0;do{var u=d.nextSibling;if(d.nodeType===1?i?(d._stashedDisplay=d.style.display,d.style.display="none"):(d.style.display=d._stashedDisplay||"",d.getAttribute("style")===""&&d.removeAttribute("style")):d.nodeType===3&&(i?(d._stashedText=d.nodeValue,d.nodeValue=""):d.nodeValue=d._stashedText||""),u&&u.nodeType===8)if(d=u.data,d==="/$"){if(o===0)break;o--}else d!=="$"&&d!=="$?"&&d!=="$~"&&d!=="$!"||o++;d=u}while(d)}function Dw(o,i,d){if(i=CSS.escape(i)===i?i:"r-"+btoa(i).replace(/=/g,""),o.style.viewTransitionName=i,d!=null&&(o.style.viewTransitionClass=d),d=getComputedStyle(o),d.display==="inline"){if(i=o.getClientRects(),i.length===1)var u=1;else for(var y=u=0;y<i.length;y++){var x=i[y];0<x.width&&0<x.height&&u++}u===1&&(o=o.style,o.display=i.length===1?"inline-block":"block",o.marginTop="-"+d.paddingTop,o.marginBottom="-"+d.paddingBottom)}}function Iw(o,i){o=o.style,i=i.style;var d=i==null?null:i.hasOwnProperty("viewTransitionName")?i.viewTransitionName:i.hasOwnProperty("view-transition-name")?i["view-transition-name"]:null;o.viewTransitionName=d==null||typeof d=="boolean"?"":(""+d).trim(),d=i==null?null:i.hasOwnProperty("viewTransitionClass")?i.viewTransitionClass:i.hasOwnProperty("view-transition-class")?i["view-transition-class"]:null,o.viewTransitionClass=d==null||typeof d=="boolean"?"":(""+d).trim(),o.display==="inline-block"&&(i==null?o.display=o.margin="":(d=i.display,o.display=d==null||typeof d=="boolean"?"":d,d=i.margin,d==null?(d=i.hasOwnProperty("marginTop")?i.marginTop:i["margin-top"],o.marginTop=d==null||typeof d=="boolean"?"":d,i=i.hasOwnProperty("marginBottom")?i.marginBottom:i["margin-bottom"],o.marginBottom=i==null||typeof i=="boolean"?"":i):o.margin=d))}function Lw(o,i,d){return d=d.ownerDocument.defaultView,{rect:o,abs:i.position==="absolute"||i.position==="fixed",clip:i.clipPath!=="none"||i.overflow!=="visible"||i.filter!=="none"||i.mask!=="none"||i.mask!=="none"||i.borderRadius!=="0px",view:0<=o.bottom&&0<=o.right&&o.top<=d.innerHeight&&o.left<=d.innerWidth}}function zm(o){return Lw(o.getBoundingClientRect(),getComputedStyle(o),o)}function _A(o){var i=o.getBoundingClientRect();i=new DOMRect(i.x+2e4,i.y+2e4,i.width,i.height);var d=getComputedStyle(o);return Lw(i,d,o)}function AA(o){return o.documentElement.clientHeight}function TA(o){this.addEventListener("load",o),this.addEventListener("error",o)}function MA(o,i,d,u,y,x,C,P,H){var ie=i.nodeType===9?i:i.ownerDocument;try{var ce=ie.startViewTransition({update:function(){var te=ie.defaultView,ue=te.navigation&&te.navigation.transition,Se=ie.fonts.status;u();var Me=[];if(Se==="loaded"&&(AA(ie),ie.fonts.status==="loading"&&Me.push(ie.fonts.ready)),Se=Me.length,o!==null)for(var Ve=o.suspenseyImages,ne=0,Y=0;Y<Ve.length;Y++){var se=Ve[Y];if(!se.complete){var ge=se.getBoundingClientRect();if(0<ge.bottom&&0<ge.right&&ge.top<te.innerHeight&&ge.left<te.innerWidth){if(ne+=rk(se),ne>jc){Me.length=Se;break}se=new Promise(TA.bind(se)),Me.push(se)}}}if(0<Me.length)return te=Promise.race([Promise.all(Me),new Promise(function(_e){return setTimeout(_e,500)})]).then(y,y),(ue?Promise.allSettled([ue.finished,te]):te).then(x,x);if(y(),ue)return ue.finished.then(x,x);x()},types:d});ie.__reactViewTransition=ce;var ye=[];return ce.ready.then(function(){for(var te=ie.documentElement.getAnimations({subtree:!0}),ue=0;ue<te.length;ue++){var Se=te[ue],Me=Se.effect,Ve=Me.pseudoElement;if(Ve!=null&&Ve.startsWith("::view-transition")){ye.push(Se),Se=Me.getKeyframes();for(var ne=Ve=void 0,Y=!0,se=0;se<Se.length;se++){var ge=Se[se],_e=ge.width;if(Ve===void 0)Ve=_e;else if(Ve!==_e){Y=!1;break}if(_e=ge.height,ne===void 0)ne=_e;else if(ne!==_e){Y=!1;break}delete ge.width,delete ge.height,ge.transform==="none"&&delete ge.transform}Y&&Ve!==void 0&&ne!==void 0&&(Me.setKeyframes(Se),Y=getComputedStyle(Me.target,Me.pseudoElement),Y.width!==Ve||Y.height!==ne)&&(Y=Se[0],Y.width=Ve,Y.height=ne,Y=Se[Se.length-1],Y.width=Ve,Y.height=ne,Me.setKeyframes(Se))}}C()},function(te){ie.__reactViewTransition===ce&&(ie.__reactViewTransition=null);try{typeof te=="object"&&te&&te.name==="InvalidStateError"&&(te.message==="View transition was skipped because document visibility state is hidden."||te.message==="Skipping view transition because document visibility state has become hidden."||te.message==="Skipping view transition because viewport size changed."||te.message==="Transition was aborted because of invalid state")&&(te=null),te!==null&&H(te)}finally{u(),y(),C()}}),ce.finished.finally(function(){for(var te=0;te<ye.length;te++)ye[te].cancel();ie.__reactViewTransition===ce&&(ie.__reactViewTransition=null),P()}),ce}catch{return u(),y(),C(),null}}function Gi(o,i){this._scope=document.documentElement,this._selector="::view-transition-"+o+"("+i+")"}Gi.prototype.animate=function(o,i){return i=typeof i=="number"?{duration:i}:M({},i),i.pseudoElement=this._selector,this._scope.animate(o,i)},Gi.prototype.getAnimations=function(){for(var o=this._scope,i=this._selector,d=o.getAnimations({subtree:!0}),u=[],y=0;y<d.length;y++){var x=d[y].effect;x!==null&&x.target===o&&x.pseudoElement===i&&u.push(d[y])}return u},Gi.prototype.getComputedStyle=function(){return getComputedStyle(this._scope,this._selector)};function Rw(o){return{name:o,group:new Gi("group",o),imagePair:new Gi("image-pair",o),old:new Gi("old",o),new:new Gi("new",o)}}function An(o){this._fragmentFiber=o,this._observers=this._eventListeners=null}An.prototype.addEventListener=function(o,i,d){var u=null,y=null;if(!(d!=null&&typeof d!="boolean"&&(u=d.signal||null,u!==null&&u.aborted))){this._eventListeners===null&&(this._eventListeners=[]);var x=this._eventListeners;if(Fw(x,o,i,d)===-1){var C=this,P=i;d!=null&&typeof d!="boolean"&&d.once===!0&&(P=function(H){C.removeEventListener(o,i,d),typeof i=="function"?i.call(this,H):i.handleEvent(H)}),u!==null&&(y=C.removeEventListener.bind(C,o,i,d),u.addEventListener("abort",y,{once:!0}),y=u.removeEventListener.bind(u,"abort",y)),u=fs(d),x.push({type:o,listener:i,optionsOrUseCapture:d,attachedListener:P,cleanup:y}),m(this._fragmentFiber.child,!1,OA,o,P,u)}this._eventListeners=x}};function OA(o,i,d,u){return N(o).addEventListener(i,d,u),!1}An.prototype.removeEventListener=function(o,i,d){var u=this._eventListeners;if(u!==null&&(i=Fw(u,o,i,d),i!==-1)){var y=u[i];d=y.attachedListener;var x=y.cleanup;y=fs(y.optionsOrUseCapture),m(this._fragmentFiber.child,!1,PA,o,d,y),u.splice(i,1),x!==null&&x()}};function PA(o,i,d,u){return N(o).removeEventListener(i,d,u),!1}function fs(o){return o!=null&&typeof o!="boolean"&&(o.once===!0||o.signal instanceof AbortSignal)?{capture:o.capture,passive:o.passive}:o}function zw(o){return o==null?"c=0":typeof o=="boolean"?"c="+(o?"1":"0"):"c="+(o.capture?"1":"0")}function Fw(o,i,d,u){if(o.length===0)return-1;u=zw(u);for(var y=0;y<o.length;y++){var x=o[y];if(x.type===i&&x.listener===d&&zw(x.optionsOrUseCapture)===u)return y}return-1}An.prototype.dispatchEvent=function(o){var i=b(this._fragmentFiber);if(i===null)return!0;i=N(i);var d=this._eventListeners;if(d!==null&&0<d.length||!o.bubbles){var u=i.nodeType===9?i.createComment(""):document.createTextNode("");if(d)for(var y=0;y<d.length;y++){var x=d[y];u.addEventListener(x.type,x.attachedListener,fs(x.optionsOrUseCapture))}if(i.appendChild(u),o=u.dispatchEvent(o),d)for(y=0;y<d.length;y++)x=d[y],u.removeEventListener(x.type,x.attachedListener,fs(x.optionsOrUseCapture));return i.removeChild(u),o}return i.dispatchEvent(o)},An.prototype.focus=function(o){m(this._fragmentFiber.child,!0,Bw,o,void 0,void 0)};function Bw(o,i){return o.tag!==6&&(o=N(o),WA(o,i))}An.prototype.focusLast=function(o){var i=[];m(this._fragmentFiber.child,!0,Fm,i,void 0,void 0);for(var d=i.length-1;0<=d&&!Bw(i[d],o);d--);};function Fm(o,i){return i.push(o),!1}An.prototype.blur=function(){var o=b(this._fragmentFiber);o!==null&&(o=N(o),o=Wl(o).activeElement,o!==null&&m(this._fragmentFiber.child,!1,DA,o,void 0,void 0))};function DA(o,i){return o.tag!==6&&(o=N(o),o===i||o.contains(i)?(i.blur(),!0):!1)}An.prototype.observeUsing=function(o){this._observers===null&&(this._observers=new Set),this._observers.add(o),m(this._fragmentFiber.child,!1,IA,o,void 0,void 0)};function IA(o,i){return o.tag===6||(o=N(o),i.observe(o)),!1}An.prototype.unobserveUsing=function(o){var i=this._observers;if(i!==null&&i.has(o)){i.delete(o),m(this._fragmentFiber.child,!1,LA,o,void 0,void 0);for(var d=i=0;d<io.length;d++){var u=io[d];u.fragmentInstance===this&&u.observer===o?o.unobserve(u.instance):io[i++]=u}io.length=i}};function LA(o,i){return o.tag===6||(o=N(o),i.unobserve(o)),!1}var io=[],Bm=!1;function RA(o,i,d){io.push({fragmentInstance:o,observer:i,instance:d}),Bm||(Bm=!0,UA(function(){Bm=!1;var u=io;io=[];for(var y=0;y<u.length;y++){var x=u[y];x.observer.unobserve(x.instance)}}))}An.prototype.getClientRects=function(){var o=[];return m(this._fragmentFiber.child,!1,zA,o,void 0,void 0),o};function zA(o,i){if(o.tag===6){o=o.stateNode;var d=o.ownerDocument.createRange();d.selectNodeContents(o),i.push.apply(i,d.getClientRects())}else o=N(o),i.push.apply(i,o.getClientRects());return!1}An.prototype.getRootNode=function(o){var i=b(this._fragmentFiber);return i===null?this:N(i).getRootNode(o)},An.prototype.compareDocumentPosition=function(o){var i=b(this._fragmentFiber);if(i===null)return Node.DOCUMENT_POSITION_DISCONNECTED;var d=[];m(this._fragmentFiber.child,!1,Fm,d,void 0,void 0);var u=N(i);if(d.length===0){if(d=u,w(this._fragmentFiber)){e:{for(i=this._fragmentFiber.return;i!==null;){if(i.tag===4){i=i.stateNode.containerInfo;break e}if(i.tag===3||i.tag===5||i.tag===27)break;i=i.return}i=null}i!=null&&(d=i)}i=this._fragmentFiber;var y=u=d.compareDocumentPosition(o);return d===o?y=Node.DOCUMENT_POSITION_CONTAINS:u&Node.DOCUMENT_POSITION_CONTAINED_BY&&(d=k(i)[1],d===null?y=Node.DOCUMENT_POSITION_PRECEDING:(o=N(d).compareDocumentPosition(o),y=o===0||o&Node.DOCUMENT_POSITION_FOLLOWING?Node.DOCUMENT_POSITION_FOLLOWING:Node.DOCUMENT_POSITION_PRECEDING)),y|=Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC}i=N(d[0]),y=N(d[d.length-1]);var x=w(this._fragmentFiber)?i.parentElement:u;if(x==null)return Node.DOCUMENT_POSITION_DISCONNECTED;u=x.compareDocumentPosition(i)&Node.DOCUMENT_POSITION_CONTAINED_BY,x=x.compareDocumentPosition(y)&Node.DOCUMENT_POSITION_CONTAINED_BY;var C=i.compareDocumentPosition(o),P=y.compareDocumentPosition(o),H=C&Node.DOCUMENT_POSITION_CONTAINED_BY||P&Node.DOCUMENT_POSITION_CONTAINED_BY;return P=u&&x&&C&Node.DOCUMENT_POSITION_FOLLOWING&&P&Node.DOCUMENT_POSITION_PRECEDING,i=u&&i===o||x&&y===o||H||P?Node.DOCUMENT_POSITION_CONTAINED_BY:!u&&i===o||!x&&y===o?Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:C,i&Node.DOCUMENT_POSITION_DISCONNECTED||i&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC||FA(i,this._fragmentFiber,d[0],d[d.length-1],o)?i:Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC};function FA(o,i,d,u,y){var x=Qo(y);if(o&Node.DOCUMENT_POSITION_CONTAINED_BY){if(d=!!x)e:{for(;x!==null;){if(x.tag===7&&(x===i||x.alternate===i)){d=!0;break e}x=x.return}d=!1}return d}if(o&Node.DOCUMENT_POSITION_CONTAINS){if(x===null)return x=y.ownerDocument,y===x||y===x.documentElement||y===x.body;e:{for(x=i,i=b(i);x!==null;){if(!(x.tag!==5&&x.tag!==3&&x.tag!==27||x!==i&&x.alternate!==i)){x=!0;break e}x=x.return}x=!1}return x}return o&Node.DOCUMENT_POSITION_PRECEDING?((i=!!x)&&!(i=x===d)&&(i=T(d,x,z),i===null?i=!1:(m(i,!0,E,x,d),x=$,$=null,i=x!==null)),i):o&Node.DOCUMENT_POSITION_FOLLOWING?((i=!!x)&&!(i=x===u)&&(i=T(u,x,z),i===null?i=!1:(m(i,!0,I,x,u),x=$,j=$=null,i=x!==null)),i):!1}function qw(o,i){var d=o.ownerDocument.createRange();d.selectNodeContents(o),o=d.getBoundingClientRect(),window.scrollTo(window.scrollX+o.left,i?window.scrollY+o.top:window.scrollY+o.bottom-window.innerHeight)}An.prototype.scrollIntoView=function(o){if(typeof o=="object")throw Error(a(566));var i=[];m(this._fragmentFiber.child,!1,Fm,i,void 0,void 0);var d=o!==!1;if(i.length===0){var u=k(this._fragmentFiber);if(u=d?u[1]||u[0]||b(this._fragmentFiber):u[0]||u[1],u===null)return;if(u.tag===6){o=N(u),qw(o,d);return}if(u=N(u),u.nodeType!==9){if(u.nodeType===11){d="host"in u?u.host:null,d!==null&&d.scrollIntoView(o);return}u.scrollIntoView(o)}}for(u=d?i.length-1:0;u!==(d?-1:i.length);){var y=i[u];y.tag===6?(y=N(y),qw(y,d)):N(y).scrollIntoView(o),u+=d?-1:1}};function BA(o,i){return o=N(o),Hw(o,i),!1}function Hw(o,i){o.reactFragments??=new Set,o.reactFragments.add(i)}function Vw(o,i){var d=i._eventListeners;if(d!==null)for(var u=0;u<d.length;u++){var y=d[u];o.addEventListener(y.type,y.attachedListener,fs(y.optionsOrUseCapture))}o.nodeType!==3&&(d=i._observers,d!==null&&d.forEach(function(x){for(var C=0,P=0;P<io.length;P++){var H=io[P];(H.fragmentInstance!==i||H.observer!==x||H.instance!==o)&&(io[C++]=H)}io.length=C,x.observe(o)}),Hw(o,i))}function qA(o,i){var d=i._eventListeners;if(d!==null)for(var u=0;u<d.length;u++){var y=d[u];o.removeEventListener(y.type,y.attachedListener,fs(y.optionsOrUseCapture))}o.nodeType!==3&&(d=i._observers,d!==null&&d.forEach(function(x){typeof x.rootMargin=="string"?RA(i,x,o):x.unobserve(o)}),o.reactFragments!=null&&o.reactFragments.delete(i))}function qm(o){var i=o.firstChild;for(i&&i.nodeType===10&&(i=i.nextSibling);i;){var d=i;switch(i=i.nextSibling,d.nodeName){case"HTML":case"HEAD":case"BODY":qm(d),xo(d);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(d.rel.toLowerCase()==="stylesheet")continue}o.removeChild(d)}}function HA(o,i,d,u){for(;o.nodeType===1;){var y=d;if(o.nodeName.toLowerCase()!==i.toLowerCase()){if(!u&&(o.nodeName!=="INPUT"||o.type!=="hidden"))break}else if(u){if(!o[Ht])switch(i){case"meta":if(!o.hasAttribute("itemprop"))break;return o;case"link":if(x=o.getAttribute("rel"),x==="stylesheet"&&o.hasAttribute("data-precedence")||x!==y.rel||o.getAttribute("href")!==(y.href==null||y.href===""?null:y.href)||o.getAttribute("crossorigin")!==(y.crossOrigin==null?null:y.crossOrigin)||o.getAttribute("title")!==(y.title==null?null:y.title))break;return o;case"style":if(o.hasAttribute("data-precedence"))break;return o;case"script":if(x=o.getAttribute("src"),(x!==(y.src==null?null:y.src)||o.getAttribute("type")!==(y.type==null?null:y.type)||o.getAttribute("crossorigin")!==(y.crossOrigin==null?null:y.crossOrigin))&&x&&o.hasAttribute("async")&&!o.hasAttribute("itemprop"))break;return o;default:return o}}else if(i==="input"&&o.type==="hidden"){var x=y.name==null?null:""+y.name;if(y.type==="hidden"&&o.getAttribute("name")===x)return o}else return o;if(o=Vn(o.nextSibling),o===null)break}return null}function VA(o,i,d){if(i==="")return null;for(;o.nodeType!==3;)if((o.nodeType!==1||o.nodeName!=="INPUT"||o.type!=="hidden")&&!d||(o=Vn(o.nextSibling),o===null))return null;return o}function Kw(o,i){for(;o.nodeType!==8;)if((o.nodeType!==1||o.nodeName!=="INPUT"||o.type!=="hidden")&&!i||(o=Vn(o.nextSibling),o===null))return null;return o}function Hm(o){return o.data==="$?"||o.data==="$~"}function Vm(o){return o.data==="$!"||o.data==="$?"&&o.ownerDocument.readyState!=="loading"}function KA(o,i){var d=o.ownerDocument;if(o.data==="$~")o._reactRetry=i;else if(o.data!=="$?"||d.readyState!=="loading")i();else{var u=function(){i(),d.removeEventListener("DOMContentLoaded",u)};d.addEventListener("DOMContentLoaded",u),o._reactRetry=u}}function Vn(o){for(;o!=null;o=o.nextSibling){var i=o.nodeType;if(i===1||i===3)break;if(i===8){if(i=o.data,i==="$"||i==="$!"||i==="$?"||i==="$~"||i==="&"||i==="F!"||i==="F")break;if(i==="/$"||i==="/&")return null}}return o}var Km=null;function Ww(o){o=o.nextSibling;for(var i=0;o;){if(o.nodeType===8){var d=o.data;if(d==="/$"||d==="/&"){if(i===0)return Vn(o.nextSibling);i--}else d!=="$"&&d!=="$!"&&d!=="$?"&&d!=="$~"&&d!=="&"||i++}o=o.nextSibling}return null}function Uw(o){o=o.previousSibling;for(var i=0;o;){if(o.nodeType===8){var d=o.data;if(d==="$"||d==="$!"||d==="$?"||d==="$~"||d==="&"){if(i===0)return o;i--}else d!=="/$"&&d!=="/&"||i++}o=o.previousSibling}return null}function WA(o,i){function d(){u=!0}if(o.ownerDocument.activeElement===o)return!0;var u=!1;try{o.ownerDocument.addEventListener("focus",d,!0),(o.focus||HTMLElement.prototype.focus).call(o,i)}finally{o.ownerDocument.removeEventListener("focus",d,!0)}return u}function UA(o){Mw(function(){Mw(function(i){return o(i)})})}function Yw(o,i,d){switch(i=Wl(d),o){case"html":if(o=i.documentElement,!o)throw Error(a(452));return o;case"head":if(o=i.head,!o)throw Error(a(453));return o;case"body":if(o=i.body,!o)throw Error(a(454));return o;default:throw Error(a(451))}}function Xw(o,i,d){for(var u in d){var y=d[u];d.hasOwnProperty(u)&&y!=null&&st(o,i,u,null,kA,y)}d.dangerouslySetInnerHTML!=null&&(o.textContent=""),o.onclick===wo&&(o.onclick=null),xo(o)}function Wm(o){for(var i=o.attributes;i.length;)o.removeAttributeNode(i[0]);xo(o)}var Kn=new Map,Zw=new Set;function Ul(o){if(typeof o.getRootNode=="function"){var i=o.getRootNode();if(i.nodeType===9||i.nodeType===11)return i}return o.nodeType===9?o:o.ownerDocument}var pr=de.d;de.d={f:YA,r:XA,D:ZA,C:GA,L:QA,m:JA,X:tT,S:eT,M:nT};function YA(){var o=pr.f(),i=gc();return o||i}function XA(o){var i=Ir(o);i!==null&&i.tag===5&&i.type==="form"?Jb(i):pr.r(o)}var hs=typeof document>"u"?null:document;function Gw(o,i,d){var u=hs;if(u&&typeof i=="string"&&i){var y=Jn(i);y='link[rel="'+o+'"][href="'+y+'"]',typeof d=="string"&&(y+='[crossorigin="'+d+'"]'),Zw.has(y)||(Zw.add(y),o={rel:o,crossOrigin:d,href:i},u.querySelector(y)===null&&(i=u.createElement("link"),tn(i,"link",o),Ct(i),u.head.appendChild(i)))}}function ZA(o){pr.D(o),Gw("dns-prefetch",o,null)}function GA(o,i){pr.C(o,i),Gw("preconnect",o,i)}function QA(o,i,d){pr.L(o,i,d);var u=hs;if(u&&o&&i){var y='link[rel="preload"][as="'+Jn(i)+'"]';i==="image"&&d&&d.imageSrcSet?(y+='[imagesrcset="'+Jn(d.imageSrcSet)+'"]',typeof d.imageSizes=="string"&&(y+='[imagesizes="'+Jn(d.imageSizes)+'"]')):y+='[href="'+Jn(o)+'"]';var x=y;switch(i){case"style":x=ps(o);break;case"script":x=ms(o)}if(!(Kn.has(x)||(o=M({rel:"preload",href:i==="image"&&d&&d.imageSrcSet?void 0:o,as:i},d),Kn.set(x,o),u.querySelector(y)!==null||i==="style"&&u.querySelector(Yl(x))||i==="script"&&u.querySelector(Xl(x))))){var C=u.createElement("link");tn(C,"link",o),i==="style"&&(C[xt]=!0,C.onload=C.onerror=function(){cu(C)}),Ct(C),u.head.appendChild(C)}}}function JA(o,i){pr.m(o,i);var d=hs;if(d&&o){var u=i&&typeof i.as=="string"?i.as:"script",y='link[rel="modulepreload"][as="'+Jn(u)+'"][href="'+Jn(o)+'"]',x=y;switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":x=ms(o)}if(!Kn.has(x)&&(o=M({rel:"modulepreload",href:o},i),Kn.set(x,o),d.querySelector(y)===null)){switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(d.querySelector(Xl(x)))return}u=d.createElement("link"),tn(u,"link",o),Ct(u),d.head.appendChild(u)}}}function eT(o,i,d){pr.S(o,i,d);var u=hs;if(u&&o){var y=Rr(u).hoistableStyles,x=ps(o);i||="default";var C=y.get(x);if(!C){var P={loading:0,preload:null};if(C=u.querySelector(Yl(x)))P.loading=5;else{o=M({rel:"stylesheet",href:o,"data-precedence":i},d),(d=Kn.get(x))&&Um(o,d);var H=C=u.createElement("link");Ct(H),tn(H,"link",o),H._p=new Promise(function(ie,ce){H.onload=ie,H.onerror=ce}),H.addEventListener("load",function(){P.loading|=1}),H.addEventListener("error",function(){P.loading|=2}),P.loading|=4,Sc(C,i,u)}C={type:"stylesheet",instance:C,count:1,state:P},y.set(x,C)}}}function tT(o,i){pr.X(o,i);var d=hs;if(d&&o){var u=Rr(d).hoistableScripts,y=ms(o),x=u.get(y);x||(x=d.querySelector(Xl(y)),x||(o=M({src:o,async:!0},i),(i=Kn.get(y))&&Ym(o,i),x=d.createElement("script"),Ct(x),tn(x,"link",o),d.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},u.set(y,x))}}function nT(o,i){pr.M(o,i);var d=hs;if(d&&o){var u=Rr(d).hoistableScripts,y=ms(o),x=u.get(y);x||(x=d.querySelector(Xl(y)),x||(o=M({src:o,async:!0,type:"module"},i),(i=Kn.get(y))&&Ym(o,i),x=d.createElement("script"),Ct(x),tn(x,"link",o),d.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},u.set(y,x))}}function Qw(o,i,d,u){var y=(y=It.current)?Ul(y):null;if(!y)throw Error(a(446));switch(o){case"meta":case"title":return null;case"style":return typeof d.precedence=="string"&&typeof d.href=="string"?(d=ps(d.href),i=Rr(y).hoistableStyles,u=i.get(d),u||(u={type:"style",instance:null,count:0,state:null},i.set(d,u)),u):{type:"void",instance:null,count:0,state:null};case"link":if(d.rel==="stylesheet"&&typeof d.href=="string"&&typeof d.precedence=="string"){o=ps(d.href);var x=Rr(y).hoistableStyles,C=x.get(o);if(C||(y=y.ownerDocument||y,C={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},x.set(o,C),(x=y.querySelector(Yl(o)))?x._p||(C.instance=x,C.state.loading=5):(x=Kn.get(o),x||(x={rel:"preload",as:"style",href:d.href,crossOrigin:d.crossOrigin,integrity:d.integrity,media:d.media,hrefLang:d.hrefLang,referrerPolicy:d.referrerPolicy},Kn.set(o,x)),oT(y,o,x,C.state))),i&&u===null)throw Error(a(528,""));return C}if(i&&u!==null)throw Error(a(529,""));return null;case"script":return i=d.async,d=d.src,typeof d=="string"&&i&&typeof i!="function"&&typeof i!="symbol"?(d=ms(d),i=Rr(y).hoistableScripts,u=i.get(d),u||(u={type:"script",instance:null,count:0,state:null},i.set(d,u)),u):{type:"void",instance:null,count:0,state:null};default:throw Error(a(444,o))}}function ps(o){return'href="'+Jn(o)+'"'}function Yl(o){return'link[rel="stylesheet"]['+o+"]"}function Jw(o){return M({},o,{"data-precedence":o.precedence,precedence:null})}function oT(o,i,d,u){if(i=o.querySelector('link[rel="preload"][as="style"]['+i+"]")){if(i[xt]!==!0){u.loading=1;return}}else i=o.createElement("link"),i[xt]=!0,i.onload=i.onerror=cu.bind(null,i),tn(i,"link",d),Ct(i),o.head.appendChild(i);u.preload=i,i.addEventListener("load",function(){return u.loading|=1}),i.addEventListener("error",function(){return u.loading|=2})}function ms(o){return'[src="'+Jn(o)+'"]'}function Xl(o){return"script[async]"+o}function ek(o,i,d){if(i.count++,i.instance===null)switch(i.type){case"style":var u=o.querySelector('style[data-href~="'+Jn(d.href)+'"]');if(u)return i.instance=u,Ct(u),u;var y=M({},d,{"data-href":d.href,"data-precedence":d.precedence,href:null,precedence:null});return u=(o.ownerDocument||o).createElement("style"),Ct(u),tn(u,"style",y),Sc(u,d.precedence,o),i.instance=u;case"stylesheet":y=ps(d.href);var x=o.querySelector(Yl(y));if(x)return i.state.loading|=4,i.instance=x,Ct(x),x;u=Jw(d),(y=Kn.get(y))&&Um(u,y),x=(o.ownerDocument||o).createElement("link"),Ct(x);var C=x;return C._p=new Promise(function(P,H){C.onload=P,C.onerror=H}),tn(x,"link",u),i.state.loading|=4,Sc(x,d.precedence,o),i.instance=x;case"script":return x=ms(d.src),(y=o.querySelector(Xl(x)))?(i.instance=y,Ct(y),y):(u=d,(y=Kn.get(x))&&(u=M({},d),Ym(u,y)),o=o.ownerDocument||o,y=o.createElement("script"),Ct(y),tn(y,"link",u),o.head.appendChild(y),i.instance=y);case"void":return null;default:throw Error(a(443,i.type))}else i.type==="stylesheet"&&!(i.state.loading&4)&&(u=i.instance,i.state.loading|=4,Sc(u,d.precedence,o));return i.instance}function Sc(o,i,d){for(var u=d.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),y=u.length?u[u.length-1]:null,x=y,C=0;C<u.length;C++){var P=u[C];if(P.dataset.precedence===i)x=P;else if(x!==y)break}x?x.parentNode.insertBefore(o,x.nextSibling):(i=d.nodeType===9?d.head:d,i.insertBefore(o,i.firstChild))}function Um(o,i){o.crossOrigin??=i.crossOrigin,o.referrerPolicy??=i.referrerPolicy,o.title??=i.title}function Ym(o,i){o.crossOrigin??=i.crossOrigin,o.referrerPolicy??=i.referrerPolicy,o.integrity??=i.integrity}var Nc=null;function tk(o,i,d){if(Nc===null){var u=new Map,y=Nc=new Map;y.set(d,u)}else y=Nc,u=y.get(d),u||(u=new Map,y.set(d,u));if(u.has(o))return u;for(u.set(o,null),d=d.getElementsByTagName(o),y=0;y<d.length;y++){var x=d[y];if(!(x[Ht]||x[ke]||o==="link"&&x.getAttribute("rel")==="stylesheet")&&x.namespaceURI!=="http://www.w3.org/2000/svg"){var C=x.getAttribute(i)||"";C=o+C;var P=u.get(C);P?P.push(x):u.set(C,[x])}}return u}function Xm(o,i,d){o=o.ownerDocument||o,o.head.insertBefore(d,i==="title"?o.querySelector("head > title"):null)}function rT(o,i,d){if(d===1||i.itemProp!=null)return!1;switch(o){case"meta":case"title":return!0;case"style":if(typeof i.precedence!="string"||typeof i.href!="string"||i.href==="")break;return!0;case"link":if(typeof i.rel!="string"||typeof i.href!="string"||i.href===""||i.onLoad||i.onError)break;return i.rel==="stylesheet"?(o=i.disabled,typeof i.precedence=="string"&&o==null):!0;case"script":if(i.async&&typeof i.async!="function"&&typeof i.async!="symbol"&&!i.onLoad&&!i.onError&&i.src&&typeof i.src=="string")return!0}return!1}function nk(o,i){return o==="img"&&i.src!=null&&i.src!==""&&i.onLoad==null&&i.loading!=="lazy"}function ok(o){return!(o.type==="stylesheet"&&!(o.state.loading&3))}function rk(o){return(o.width||100)*(o.height||100)*(typeof devicePixelRatio=="number"?devicePixelRatio:1)*.25}function ik(o,i){typeof i.decode=="function"&&(o.imgCount++,i.complete||(o.imgBytes+=rk(i),o.suspenseyImages.push(i)),o=sT.bind(o),i.decode().then(o,o))}function iT(o,i,d,u){if(d.type==="stylesheet"&&(typeof u.media!="string"||matchMedia(u.media).matches!==!1)&&!(d.state.loading&4)){if(d.instance===null){var y=ps(u.href),x=i.querySelector(Yl(y));if(x){i=x._p,typeof i=="object"&&i&&typeof i.then=="function"&&(o.count++,o=Zl.bind(o),i.then(o,o)),d.state.loading|=4,d.instance=x,Ct(x);return}x=i.ownerDocument||i,u=Jw(u),(y=Kn.get(y))&&Um(u,y),x=x.createElement("link"),Ct(x);var C=x;C._p=new Promise(function(P,H){C.onload=P,C.onerror=H}),tn(x,"link",u),d.instance=x}o.stylesheets===null&&(o.stylesheets=new Map),o.stylesheets.set(d,i),(i=d.state.preload)&&!(d.state.loading&3)&&(o.count++,d=Zl.bind(o),i.addEventListener("load",d),i.addEventListener("error",d))}}var jc=0;function aT(o,i){return o.stylesheets&&o.count===0&&$c(o,o.stylesheets),0<o.count||0<o.imgCount?function(d){var u=setTimeout(function(){if(o.stylesheets&&$c(o,o.stylesheets),o.unsuspend){var x=o.unsuspend;o.unsuspend=null,x()}},6e4+i);0<o.imgBytes&&jc===0&&(jc=62500*NA());var y=setTimeout(function(){if(o.waitingForImages=!1,o.count===0&&(o.stylesheets&&$c(o,o.stylesheets),o.unsuspend)){var x=o.unsuspend;o.unsuspend=null,x()}},(o.imgBytes>jc?50:800)+i);return o.unsuspend=d,function(){o.unsuspend=null,clearTimeout(u),clearTimeout(y)}}:null}function ak(o){if(o.count===0&&(o.imgCount===0||!o.waitingForImages)){if(o.stylesheets)$c(o,o.stylesheets);else if(o.unsuspend){var i=o.unsuspend;o.unsuspend=null,i()}}}function Zl(){this.count--,ak(this)}function sT(){this.imgCount--,ak(this)}var Cc=null;function $c(o,i){o.stylesheets=null,o.unsuspend!==null&&(o.count++,Cc=new Map,i.forEach(lT,o),Cc=null,Zl.call(o))}function lT(o,i){if(!(i.state.loading&4)){var d=Cc.get(o);if(d)var u=d.get(null);else{d=new Map,Cc.set(o,d);for(var y=o.querySelectorAll("link[data-precedence],style[data-precedence]"),x=0;x<y.length;x++){var C=y[x];(C.nodeName==="LINK"||C.getAttribute("media")!=="not all")&&(d.set(C.dataset.precedence,C),u=C)}u&&d.set(null,u)}y=i.instance,C=y.getAttribute("data-precedence"),x=d.get(C)||u,x===u&&d.set(null,y),d.set(C,y),this.count++,u=Zl.bind(this),y.addEventListener("load",u),y.addEventListener("error",u),x?x.parentNode.insertBefore(y,x.nextSibling):(o=o.nodeType===9?o.head:o,o.insertBefore(y,o.firstChild)),i.state.loading|=4}}var gs={$$typeof:L,Provider:null,Consumer:null,_currentValue:me,_currentValue2:me,_threadCount:0};function dT(o,i,d,u,y,x,C,P,H){this.tag=1,this.containerInfo=o,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Pr(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Pr(0),this.hiddenUpdates=Pr(null),this.identifierPrefix=u,this.onUncaughtError=y,this.onCaughtError=x,this.onRecoverableError=C,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=H,this.transitionTypes=null,this.incompleteTransitions=new Map}function uT(o,i,d,u,y,x,C,P,H,ie,ce,ye){return o=new dT(o,i,d,C,H,ie,ce,ye,P),i=1,x===!0&&(i|=24),x=gn(3,null,null,i),o.current=x,x.stateNode=o,i=cp(),i.refCount++,o.pooledCache=i,i.refCount++,x.memoizedState={element:u,isDehydrated:d,cache:i},mp(x),o}function cT(o){return o?(o=qa,o):qa}function sk(o,i,d,u,y,x){y=cT(y),u.context===null?u.context=y:u.pendingContext=y,u=Hi(i),u.payload={element:d},x=x===void 0?null:x,x!==null&&(u.callback=x),d=Vi(o,u,i),d!==null&&(xn(d,o,i),$l(d,o,i))}function lk(o,i){if(o=o.memoizedState,o!==null&&o.dehydrated!==null){var d=o.retryLane;o.retryLane=d!==0&&d<i?d:i}}function Zm(o,i){lk(o,i),(o=o.alternate)&&lk(o,i)}function dk(o){if(o.tag===13||o.tag===31){var i=Mi(o,67108864);i!==null&&xn(i,o,67108864),Zm(o,67108864)}}function uk(o){if(o.tag===13||o.tag===31){var i=Hn();i=Ma(i);var d=Mi(o,i);d!==null&&xn(d,o,i),Zm(o,i)}}var ys=!0;function fT(o,i,d,u){var y=ee.T;ee.T=null;var x=de.p;try{de.p=2,Gm(o,i,d,u)}finally{de.p=x,ee.T=y}}function hT(o,i,d,u){var y=ee.T;ee.T=null;var x=de.p;try{de.p=8,Gm(o,i,d,u)}finally{de.p=x,ee.T=y}}function Gm(o,i,d,u){if(ys){var y=Qm(u);if(y===null)Mm(o,i,u,Ec,d),fk(o,u);else if(mT(y,o,i,d,u))u.stopPropagation();else if(fk(o,u),i&4&&-1<pT.indexOf(o)){for(;y!==null;){var x=Ir(y);if(x!==null)switch(x.tag){case 3:if(x=x.stateNode,x.current.memoizedState.isDehydrated){var C=Qn(x.pendingLanes);if(C!==0){var P=x;for(P.pendingLanes|=2,P.entangledLanes|=2;C;){var H=1<<31-qt(C);P.entanglements[1]|=H,C&=~H}hr(x),!(nt&6)&&(hc=Xt()+500,Hl(0,!1))}}break;case 31:case 13:P=Mi(x,2),P!==null&&xn(P,x,2),gc(),Zm(x,2)}if(x=Qm(u),x===null&&Mm(o,i,u,Ec,d),x===y)break;y=x}y!==null&&u.stopPropagation()}else Mm(o,i,u,null,d)}}function Qm(o){return o=Rh(o),Jm(o)}var Ec=null;function Jm(o){if(Ec=null,o=Qo(o),o!==null){var i=l(o);if(i===null)o=null;else{var d=i.tag;if(d===13){if(o=f(i),o!==null)return o;o=null}else if(d===31){if(o=p(i),o!==null)return o;o=null}else if(d===3){if(i.stateNode.current.memoizedState.isDehydrated)return i.tag===3?i.stateNode.containerInfo:null;o=null}else i!==o&&(o=null)}}return Ec=o,null}function ck(o){switch(o){case"beforetoggle":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"seeked":case"submit":case"toggle":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"fullscreenerror":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"resize":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch($a()){case _r:return 2;case Ni:return 8;case Xo:case Ea:return 32;case _a:return 268435456;default:return 32}default:return 32}}var eg=!1,ii=null,ai=null,si=null,Gl=new Map,Ql=new Map,li=[],pT="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".split(" ");function fk(o,i){switch(o){case"focusin":case"focusout":ii=null;break;case"dragenter":case"dragleave":ai=null;break;case"mouseover":case"mouseout":si=null;break;case"pointerover":case"pointerout":Gl.delete(i.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ql.delete(i.pointerId)}}function Jl(o,i,d,u,y,x){return o===null||o.nativeEvent!==x?(o={blockedOn:i,domEventName:d,eventSystemFlags:u,nativeEvent:x,targetContainers:[y]},i!==null&&(i=Ir(i),i!==null&&dk(i)),o):(o.eventSystemFlags|=u,i=o.targetContainers,y!==null&&i.indexOf(y)===-1&&i.push(y),o)}function mT(o,i,d,u,y){switch(i){case"focusin":return ii=Jl(ii,o,i,d,u,y),!0;case"dragenter":return ai=Jl(ai,o,i,d,u,y),!0;case"mouseover":return si=Jl(si,o,i,d,u,y),!0;case"pointerover":var x=y.pointerId;return Gl.set(x,Jl(Gl.get(x)||null,o,i,d,u,y)),!0;case"gotpointercapture":return x=y.pointerId,Ql.set(x,Jl(Ql.get(x)||null,o,i,d,u,y)),!0}return!1}function hk(o){var i=Qo(o.target);if(i!==null){var d=l(i);if(d!==null){if(i=d.tag,i===13){if(i=f(d),i!==null){o.blockedOn=i,ve(o.priority,function(){uk(d)});return}}else if(i===31){if(i=p(d),i!==null){o.blockedOn=i,ve(o.priority,function(){uk(d)});return}}else if(i===3&&d.stateNode.current.memoizedState.isDehydrated){o.blockedOn=d.tag===3?d.stateNode.containerInfo:null;return}}}o.blockedOn=null}function _c(o){if(o.blockedOn!==null)return!1;for(var i=o.targetContainers;0<i.length;){var d=Qm(o.nativeEvent);if(d===null){d=o.nativeEvent;var u=new d.constructor(d.type,d);Lh=u,d.target.dispatchEvent(u),Lh=null}else return i=Ir(d),i!==null&&dk(i),o.blockedOn=d,!1;i.shift()}return!0}function pk(o,i,d){_c(o)&&d.delete(i)}function gT(){eg=!1,ii!==null&&_c(ii)&&(ii=null),ai!==null&&_c(ai)&&(ai=null),si!==null&&_c(si)&&(si=null),Gl.forEach(pk),Ql.forEach(pk)}function Ac(o,i){o.blockedOn===i&&(o.blockedOn=null,eg||(eg=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,gT)))}var Tc=null;function mk(o){Tc!==o&&(Tc=o,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Tc===o&&(Tc=null);for(var i=0;i<o.length;i+=3){var d=o[i],u=o[i+1],y=o[i+2];if(typeof u!="function"){if(Jm(u||d)===null)continue;break}var x=Ir(d);x!==null&&(o.splice(i,3),i-=3,Ip(x,{pending:!0,data:y,method:d.method,action:u},u,y))}}))}function vs(o){function i(H){return Ac(H,o)}ii!==null&&Ac(ii,o),ai!==null&&Ac(ai,o),si!==null&&Ac(si,o),Gl.forEach(i),Ql.forEach(i);for(var d=0;d<li.length;d++){var u=li[d];u.blockedOn===o&&(u.blockedOn=null)}for(;0<li.length&&(d=li[0],d.blockedOn===null);)hk(d),d.blockedOn===null&&li.shift();if(d=(o.ownerDocument||o).$$reactFormReplay,d!=null)for(u=0;u<d.length;u+=3){var y=d[u],x=d[u+1],C=y[Te]||null;if(typeof x=="function")C||mk(d);else if(C){var P=null;if(x&&x.hasAttribute("formAction")){if(y=x,C=x[Te]||null)P=C.formAction;else if(Jm(y)!==null)continue}else P=C.action;typeof P=="function"?d[u+1]=P:(d.splice(u,3),u-=3),mk(d)}}}function yT(){function o(x){x.canIntercept&&x.info==="react-transition"&&x.intercept({handler:function(){return new Promise(function(C){return y=C})},focusReset:"manual",scroll:"manual"})}function i(){y!==null&&(y(),y=null),u||setTimeout(d,20)}function d(){if(!u&&!navigation.transition){var x=navigation.currentEntry;x&&x.url!=null&&navigation.navigate(x.url,{state:x.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var u=!1,y=null;return navigation.addEventListener("navigate",o),navigation.addEventListener("navigatesuccess",i),navigation.addEventListener("navigateerror",i),setTimeout(d,100),function(){u=!0,navigation.removeEventListener("navigate",o),navigation.removeEventListener("navigatesuccess",i),navigation.removeEventListener("navigateerror",i),y!==null&&(y(),y=null)}}}function tg(o){this._internalRoot=o}ng.prototype.render=tg.prototype.render=function(o){var i=this._internalRoot;if(i===null)throw Error(a(409));var d=i.current;sk(d,Hn(),o,i,null,null)},ng.prototype.unmount=tg.prototype.unmount=function(){var o=this._internalRoot;if(o!==null){this._internalRoot=null;var i=o.containerInfo;sk(o.current,2,null,o,null,null),gc(),i[Xe]=null}};function ng(o){this._internalRoot=o}ng.prototype.unstable_scheduleHydration=function(o){if(o){var i=G();o={blockedOn:null,target:o,priority:i};for(var d=0;d<li.length&&i!==0&&i<li[d].priority;d++);li.splice(d,0,o),d===0&&hk(o)}};var gk=n.version;if(gk!=="19.3.1")throw Error(a(527,gk,"19.3.1"));de.findDOMNode=function(o){var i=o._reactInternals;if(i===void 0)throw typeof o.render=="function"?Error(a(188)):(o=Object.keys(o).join(","),Error(a(268,o)));return o=v(i),o=o===null?null:g(o),o=o===null?null:o.stateNode,o};var vT={bundleType:0,version:"19.3.1",rendererPackageName:"react-dom",currentDispatcherRef:ee,reconcilerVersion:"19.3.1"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Mc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Mc.isDisabled&&Mc.supportsFiber)try{Dn=Mc.inject(vT),jt=Mc}catch{}}e.createRoot=function(o,i){if(!s(o))throw Error(a(299));var d=!1,u="",y=K2,x=W2,C=U2;return i!=null&&(i.unstable_strictMode===!0&&(d=!0),i.identifierPrefix!==void 0&&(u=i.identifierPrefix),i.onUncaughtError!==void 0&&(y=i.onUncaughtError),i.onCaughtError!==void 0&&(x=i.onCaughtError),i.onRecoverableError!==void 0&&(C=i.onRecoverableError)),i=uT(o,1,!1,null,null,d,u,null,y,x,C,yT),o[Xe]=i.current,kw(o),new tg(i)}})),AT=wn(((e,t)=>{function n(){if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE=="function")try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(r){console.error(r)}}n(),t.exports=_T()})),TT=wn((e=>{var t=Symbol.for("react.transitional.element"),n=Symbol.for("react.fragment");function r(a,s,l){var f=null;if(l!==void 0&&(f=""+l),s.key!==void 0&&(f=""+s.key),"key"in s)for(var p in l={},s)p!=="key"&&(l[p]=s[p]);else l=s;return s=l.ref,{$$typeof:t,type:a,key:f,ref:s===void 0?null:s,props:l}}e.Fragment=n,e.jsx=r,e.jsxs=r})),MT=wn(((e,t)=>{t.exports=TT()})),A=bk(ed(),1),OT=AT(),c=MT();function Dt(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=Dt(e[n]))!==""&&(t+=(t&&" ")+r);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var PT={value:()=>{}};function Oc(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+"")||r in n||/[\s.]/.test(r))throw Error("illegal type: "+r);n[r]=[]}return new Pc(n)}function Pc(e){this._=e}function DT(e,t){return e.trim().split(/^|\s+/).map(function(n){var r="",a=n.indexOf(".");if(a>=0&&(r=n.slice(a+1),n=n.slice(0,a)),n&&!t.hasOwnProperty(n))throw Error("unknown type: "+n);return{type:n,name:r}})}Pc.prototype=Oc.prototype={constructor:Pc,on:function(e,t){var n=this._,r=DT(e+"",n),a,s=-1,l=r.length;if(arguments.length<2){for(;++s<l;)if((a=(e=r[s]).type)&&(a=IT(n[a],e.name)))return a}else{if(t!=null&&typeof t!="function")throw Error("invalid callback: "+t);for(;++s<l;)if(a=(e=r[s]).type)n[a]=wk(n[a],e.name,t);else if(t==null)for(a in n)n[a]=wk(n[a],e.name,null);return this}},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new Pc(e)},call:function(e,t){if((a=arguments.length-2)>0)for(var n=Array(a),r=0,a,s;r<a;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw Error("unknown type: "+e);for(s=this._[e],r=0,a=s.length;r<a;++r)s[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw Error("unknown type: "+e);for(var r=this._[e],a=0,s=r.length;a<s;++a)r[a].value.apply(t,n)}};function IT(e,t){for(var n=0,r=e.length,a;n<r;++n)if((a=e[n]).name===t)return a.value}function wk(e,t,n){for(var r=0,a=e.length;r<a;++r)if(e[r].name===t){e[r]=PT,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var kk={svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Dc(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),kk.hasOwnProperty(t)?{space:kk[t],local:e}:e}function LT(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n==="http://www.w3.org/1999/xhtml"&&t.documentElement.namespaceURI==="http://www.w3.org/1999/xhtml"?t.createElement(e):t.createElementNS(n,e)}}function RT(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Sk(e){var t=Dc(e);return(t.local?RT:LT)(t)}function zT(){}function og(e){return e==null?zT:function(){return this.querySelector(e)}}function FT(e){typeof e!="function"&&(e=og(e));for(var t=this._groups,n=t.length,r=Array(n),a=0;a<n;++a)for(var s=t[a],l=s.length,f=r[a]=Array(l),p,h,v=0;v<l;++v)(p=s[v])&&(h=e.call(p,p.__data__,v,s))&&("__data__"in p&&(h.__data__=p.__data__),f[v]=h);return new Tn(r,this._parents)}function BT(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function qT(){return[]}function Nk(e){return e==null?qT:function(){return this.querySelectorAll(e)}}function HT(e){return function(){return BT(e.apply(this,arguments))}}function VT(e){e=typeof e=="function"?HT(e):Nk(e);for(var t=this._groups,n=t.length,r=[],a=[],s=0;s<n;++s)for(var l=t[s],f=l.length,p,h=0;h<f;++h)(p=l[h])&&(r.push(e.call(p,p.__data__,h,l)),a.push(p));return new Tn(r,a)}function jk(e){return function(){return this.matches(e)}}function Ck(e){return function(t){return t.matches(e)}}var KT=Array.prototype.find;function WT(e){return function(){return KT.call(this.children,e)}}function UT(){return this.firstElementChild}function YT(e){return this.select(e==null?UT:WT(typeof e=="function"?e:Ck(e)))}var XT=Array.prototype.filter;function ZT(){return Array.from(this.children)}function GT(e){return function(){return XT.call(this.children,e)}}function QT(e){return this.selectAll(e==null?ZT:GT(typeof e=="function"?e:Ck(e)))}function JT(e){typeof e!="function"&&(e=jk(e));for(var t=this._groups,n=t.length,r=Array(n),a=0;a<n;++a)for(var s=t[a],l=s.length,f=r[a]=[],p,h=0;h<l;++h)(p=s[h])&&e.call(p,p.__data__,h,s)&&f.push(p);return new Tn(r,this._parents)}function $k(e){return Array(e.length)}function eM(){return new Tn(this._enter||this._groups.map($k),this._parents)}function Ic(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Ic.prototype={constructor:Ic,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 tM(e){return function(){return e}}function nM(e,t,n,r,a,s){for(var l=0,f,p=t.length,h=s.length;l<h;++l)(f=t[l])?(f.__data__=s[l],r[l]=f):n[l]=new Ic(e,s[l]);for(;l<p;++l)(f=t[l])&&(a[l]=f)}function oM(e,t,n,r,a,s,l){var f,p,h=new Map,v=t.length,g=s.length,m=Array(v),b;for(f=0;f<v;++f)(p=t[f])&&(m[f]=b=l.call(p,p.__data__,f,t)+"",h.has(b)?a[f]=p:h.set(b,p));for(f=0;f<g;++f)b=l.call(e,s[f],f,s)+"",(p=h.get(b))?(r[f]=p,p.__data__=s[f],h.delete(b)):n[f]=new Ic(e,s[f]);for(f=0;f<v;++f)(p=t[f])&&h.get(m[f])===p&&(a[f]=p)}function rM(e){return e.__data__}function iM(e,t){if(!arguments.length)return Array.from(this,rM);var n=t?oM:nM,r=this._parents,a=this._groups;typeof e!="function"&&(e=tM(e));for(var s=a.length,l=Array(s),f=Array(s),p=Array(s),h=0;h<s;++h){var v=r[h],g=a[h],m=g.length,b=aM(e.call(v,v&&v.__data__,h,r)),w=b.length,k=f[h]=Array(w),S=l[h]=Array(w);n(v,g,k,S,p[h]=Array(m),b,t);for(var N=0,$=0,j,E;N<w;++N)if(j=k[N]){for(N>=$&&($=N+1);!(E=S[$])&&++$<w;);j._next=E||null}}return l=new Tn(l,r),l._enter=f,l._exit=p,l}function aM(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function sM(){return new Tn(this._exit||this._groups.map($k),this._parents)}function lM(e,t,n){var r=this.enter(),a=this,s=this.exit();return typeof e=="function"?(r=e(r),r&&=r.selection()):r=r.append(e+""),t!=null&&(a=t(a),a&&=a.selection()),n==null?s.remove():n(s),r&&a?r.merge(a).order():a}function dM(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,a=n.length,s=r.length,l=Math.min(a,s),f=Array(a),p=0;p<l;++p)for(var h=n[p],v=r[p],g=h.length,m=f[p]=Array(g),b,w=0;w<g;++w)(b=h[w]||v[w])&&(m[w]=b);for(;p<a;++p)f[p]=n[p];return new Tn(f,this._parents)}function uM(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],a=r.length-1,s=r[a],l;--a>=0;)(l=r[a])&&(s&&l.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(l,s),s=l);return this}function cM(e){e||=fM;function t(g,m){return g&&m?e(g.__data__,m.__data__):!g-!m}for(var n=this._groups,r=n.length,a=Array(r),s=0;s<r;++s){for(var l=n[s],f=l.length,p=a[s]=Array(f),h,v=0;v<f;++v)(h=l[v])&&(p[v]=h);p.sort(t)}return new Tn(a,this._parents).order()}function fM(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function hM(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function pM(){return Array.from(this)}function mM(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],a=0,s=r.length;a<s;++a){var l=r[a];if(l)return l}return null}function gM(){let e=0;for(let t of this)++e;return e}function yM(){return!this.node()}function vM(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var a=t[n],s=0,l=a.length,f;s<l;++s)(f=a[s])&&e.call(f,f.__data__,s,a);return this}function bM(e){return function(){this.removeAttribute(e)}}function xM(e){return function(){this.removeAttributeNS(e.space,e.local)}}function wM(e,t){return function(){this.setAttribute(e,t)}}function kM(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 NM(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 jM(e,t){var n=Dc(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?xM:bM:typeof t=="function"?n.local?NM:SM:n.local?kM:wM)(n,t))}function Ek(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function CM(e){return function(){this.style.removeProperty(e)}}function $M(e,t,n){return function(){this.style.setProperty(e,t,n)}}function EM(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function _M(e,t,n){return arguments.length>1?this.each((t==null?CM:typeof t=="function"?EM:$M)(e,t,n??"")):bs(this.node(),e)}function bs(e,t){return e.style.getPropertyValue(t)||Ek(e).getComputedStyle(e,null).getPropertyValue(t)}function AM(e){return function(){delete this[e]}}function TM(e,t){return function(){this[e]=t}}function MM(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function OM(e,t){return arguments.length>1?this.each((t==null?AM:typeof t=="function"?MM:TM)(e,t)):this.node()[e]}function _k(e){return e.trim().split(/^|\s+/)}function rg(e){return e.classList||new Ak(e)}function Ak(e){this._node=e,this._names=_k(e.getAttribute("class")||"")}Ak.prototype={add:function(e){this._names.indexOf(e)<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 Tk(e,t){for(var n=rg(e),r=-1,a=t.length;++r<a;)n.add(t[r])}function Mk(e,t){for(var n=rg(e),r=-1,a=t.length;++r<a;)n.remove(t[r])}function PM(e){return function(){Tk(this,e)}}function DM(e){return function(){Mk(this,e)}}function IM(e,t){return function(){(t.apply(this,arguments)?Tk:Mk)(this,e)}}function LM(e,t){var n=_k(e+"");if(arguments.length<2){for(var r=rg(this.node()),a=-1,s=n.length;++a<s;)if(!r.contains(n[a]))return!1;return!0}return this.each((typeof t=="function"?IM:t?PM:DM)(n,t))}function RM(){this.textContent=""}function zM(e){return function(){this.textContent=e}}function FM(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function BM(e){return arguments.length?this.each(e==null?RM:(typeof e=="function"?FM:zM)(e)):this.node().textContent}function qM(){this.innerHTML=""}function HM(e){return function(){this.innerHTML=e}}function VM(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function KM(e){return arguments.length?this.each(e==null?qM:(typeof e=="function"?VM:HM)(e)):this.node().innerHTML}function WM(){this.nextSibling&&this.parentNode.appendChild(this)}function UM(){return this.each(WM)}function YM(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function XM(){return this.each(YM)}function ZM(e){var t=typeof e=="function"?e:Sk(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function GM(){return null}function QM(e,t){var n=typeof e=="function"?e:Sk(e),r=t==null?GM:typeof t=="function"?t:og(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function JM(){var e=this.parentNode;e&&e.removeChild(this)}function eO(){return this.each(JM)}function tO(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function nO(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function oO(e){return this.select(e?nO:tO)}function rO(e){return arguments.length?this.property("__data__",e):this.node().__data__}function iO(e){return function(t){e.call(this,t,this.__data__)}}function aO(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 sO(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,a=t.length,s;n<a;++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 lO(e,t,n){return function(){var r=this.__on,a,s=iO(t);if(r){for(var l=0,f=r.length;l<f;++l)if((a=r[l]).type===e.type&&a.name===e.name){this.removeEventListener(a.type,a.listener,a.options),this.addEventListener(a.type,a.listener=s,a.options=n),a.value=t;return}}this.addEventListener(e.type,s,n),a={type:e.type,name:e.name,value:t,listener:s,options:n},r?r.push(a):this.__on=[a]}}function dO(e,t,n){var r=aO(e+""),a,s=r.length,l;if(arguments.length<2){var f=this.node().__on;if(f){for(var p=0,h=f.length,v;p<h;++p)for(a=0,v=f[p];a<s;++a)if((l=r[a]).type===v.type&&l.name===v.name)return v.value}}else{for(f=t?lO:sO,a=0;a<s;++a)this.each(f(r[a],t,n));return this}}function Ok(e,t,n){var r=Ek(e),a=r.CustomEvent;typeof a=="function"?a=new a(t,n):(a=r.document.createEvent("Event"),n?(a.initEvent(t,n.bubbles,n.cancelable),a.detail=n.detail):a.initEvent(t,!1,!1)),e.dispatchEvent(a)}function uO(e,t){return function(){return Ok(this,e,t)}}function cO(e,t){return function(){return Ok(this,e,t.apply(this,arguments))}}function fO(e,t){return this.each((typeof t=="function"?cO:uO)(e,t))}function*hO(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],a=0,s=r.length,l;a<s;++a)(l=r[a])&&(yield l)}var Pk=[null];function Tn(e,t){this._groups=e,this._parents=t}function td(){return new Tn([[document.documentElement]],Pk)}function pO(){return this}Tn.prototype=td.prototype={constructor:Tn,select:FT,selectAll:VT,selectChild:YT,selectChildren:QT,filter:JT,data:iM,enter:eM,exit:sM,join:lM,merge:dM,selection:pO,order:uM,sort:cM,call:hM,nodes:pM,node:mM,size:gM,empty:yM,each:vM,attr:jM,style:_M,property:OM,classed:LM,text:BM,html:KM,raise:UM,lower:XM,append:ZM,insert:QM,remove:eO,clone:oO,datum:rO,on:dO,dispatch:fO,[Symbol.iterator]:hO};function Mn(e){return typeof e=="string"?new Tn([[document.querySelector(e)]],[document.documentElement]):new Tn([[e]],Pk)}function mO(e){let t;for(;t=e.sourceEvent;)e=t;return e}function ao(e,t){if(e=mO(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 a=t.getBoundingClientRect();return[e.clientX-a.left-t.clientLeft,e.clientY-a.top-t.clientTop]}}return[e.pageX,e.pageY]}var gO={passive:!1},nd={capture:!0,passive:!1};function ig(e){e.stopImmediatePropagation()}function xs(e){e.preventDefault(),e.stopImmediatePropagation()}function Dk(e){var t=e.document.documentElement,n=Mn(e).on("dragstart.drag",xs,nd);"onselectstart"in t?n.on("selectstart.drag",xs,nd):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Ik(e,t){var n=e.document.documentElement,r=Mn(e).on("dragstart.drag",null);t&&(r.on("click.drag",xs,nd),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}var Lc=e=>()=>e;function ag(e,{sourceEvent:t,subject:n,target:r,identifier:a,active:s,x:l,y:f,dx:p,dy:h,dispatch:v}){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:a,enumerable:!0,configurable:!0},active:{value:s,enumerable:!0,configurable:!0},x:{value:l,enumerable:!0,configurable:!0},y:{value:f,enumerable:!0,configurable:!0},dx:{value:p,enumerable:!0,configurable:!0},dy:{value:h,enumerable:!0,configurable:!0},_:{value:v}})}ag.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function yO(e){return!e.ctrlKey&&!e.button}function vO(){return this.parentNode}function bO(e,t){return t??{x:e.x,y:e.y}}function xO(){return navigator.maxTouchPoints||"ontouchstart"in this}function Lk(){var e=yO,t=vO,n=bO,r=xO,a={},s=Oc("start","drag","end"),l=0,f,p,h,v,g=0;function m(E){E.on("mousedown.drag",b).filter(r).on("touchstart.drag",S).on("touchmove.drag",N,gO).on("touchend.drag touchcancel.drag",$).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function b(E,I){if(!v&&e.call(this,E,I)){var z=j(this,t.call(this,E,I),E,I,"mouse");z&&(Mn(E.view).on("mousemove.drag",w,nd).on("mouseup.drag",k,nd),Dk(E.view),ig(E),h=!1,f=E.clientX,p=E.clientY,z("start",E))}}function w(E){if(xs(E),!h){var I=E.clientX-f,z=E.clientY-p;h=I*I+z*z>g}a.mouse("drag",E)}function k(E){Mn(E.view).on("mousemove.drag mouseup.drag",null),Ik(E.view,h),xs(E),a.mouse("end",E)}function S(E,I){if(e.call(this,E,I))for(var z=E.changedTouches,T=t.call(this,E,I),M=z.length,O=0,K;O<M;++O)(K=j(this,T,E,I,z[O].identifier,z[O]))&&(ig(E),K("start",E,z[O]))}function N(E){for(var I=E.changedTouches,z=I.length,T=0,M;T<z;++T)(M=a[I[T].identifier])&&(xs(E),M("drag",E,I[T]))}function $(E){var I=E.changedTouches,z=I.length,T,M;for(v&&clearTimeout(v),v=setTimeout(function(){v=null},500),T=0;T<z;++T)(M=a[I[T].identifier])&&(ig(E),M("end",E,I[T]))}function j(E,I,z,T,M,O){var K=s.copy(),B=ao(O||z,I),V,oe,F;if((F=n.call(E,new ag("beforestart",{sourceEvent:z,target:m,identifier:M,active:l,x:B[0],y:B[1],dx:0,dy:0,dispatch:K}),T))!=null)return V=F.x-B[0]||0,oe=F.y-B[1]||0,function J(L,U,W){var re=B,le;switch(L){case"start":a[M]=J,le=l++;break;case"end":delete a[M],--l;case"drag":B=ao(W||U,I),le=l}K.call(L,E,new ag(L,{sourceEvent:U,subject:F,target:m,identifier:M,active:le,x:B[0]+V,y:B[1]+oe,dx:B[0]-re[0],dy:B[1]-re[1],dispatch:K}),T)}}return m.filter=function(E){return arguments.length?(e=typeof E=="function"?E:Lc(!!E),m):e},m.container=function(E){return arguments.length?(t=typeof E=="function"?E:Lc(E),m):t},m.subject=function(E){return arguments.length?(n=typeof E=="function"?E:Lc(E),m):n},m.touchable=function(E){return arguments.length?(r=typeof E=="function"?E:Lc(!!E),m):r},m.on=function(){var E=s.on.apply(s,arguments);return E===s?m:E},m.clickDistance=function(E){return arguments.length?(g=(E=+E)*E,m):Math.sqrt(g)},m}function sg(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function Rk(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function od(){}var rd=.7,Rc=1/rd,ws="\\s*([+-]?\\d+)\\s*",id="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",To="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",wO=/^#([0-9a-f]{3,8})$/,kO=RegExp(`^rgb\\(${ws},${ws},${ws}\\)$`),SO=RegExp(`^rgb\\(${To},${To},${To}\\)$`),NO=RegExp(`^rgba\\(${ws},${ws},${ws},${id}\\)$`),jO=RegExp(`^rgba\\(${To},${To},${To},${id}\\)$`),CO=RegExp(`^hsl\\(${id},${To},${To}\\)$`),$O=RegExp(`^hsla\\(${id},${To},${To},${id}\\)$`),zk={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};sg(od,Qi,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Fk,formatHex:Fk,formatHex8:EO,formatHsl:_O,formatRgb:Bk,toString:Bk});function Fk(){return this.rgb().formatHex()}function EO(){return this.rgb().formatHex8()}function _O(){return Wk(this).formatHsl()}function Bk(){return this.rgb().formatRgb()}function Qi(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=wO.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?qk(t):n===3?new kn(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?zc(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?zc(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=kO.exec(e))?new kn(t[1],t[2],t[3],1):(t=SO.exec(e))?new kn(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=NO.exec(e))?zc(t[1],t[2],t[3],t[4]):(t=jO.exec(e))?zc(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=CO.exec(e))?Kk(t[1],t[2]/100,t[3]/100,1):(t=$O.exec(e))?Kk(t[1],t[2]/100,t[3]/100,t[4]):zk.hasOwnProperty(e)?qk(zk[e]):e==="transparent"?new kn(NaN,NaN,NaN,0):null}function qk(e){return new kn(e>>16&255,e>>8&255,e&255,1)}function zc(e,t,n,r){return r<=0&&(e=t=n=NaN),new kn(e,t,n,r)}function AO(e){return e instanceof od||(e=Qi(e)),e?(e=e.rgb(),new kn(e.r,e.g,e.b,e.opacity)):new kn}function lg(e,t,n,r){return arguments.length===1?AO(e):new kn(e,t,n,r??1)}function kn(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}sg(kn,lg,Rk(od,{brighter(e){return e=e==null?Rc:Rc**+e,new kn(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?rd:rd**+e,new kn(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new kn(Ji(this.r),Ji(this.g),Ji(this.b),Fc(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:Hk,formatHex:Hk,formatHex8:TO,formatRgb:Vk,toString:Vk}));function Hk(){return`#${ea(this.r)}${ea(this.g)}${ea(this.b)}`}function TO(){return`#${ea(this.r)}${ea(this.g)}${ea(this.b)}${ea((isNaN(this.opacity)?1:this.opacity)*255)}`}function Vk(){let e=Fc(this.opacity);return`${e===1?"rgb(":"rgba("}${Ji(this.r)}, ${Ji(this.g)}, ${Ji(this.b)}${e===1?")":`, ${e})`}`}function Fc(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Ji(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function ea(e){return e=Ji(e),(e<16?"0":"")+e.toString(16)}function Kk(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new so(e,t,n,r)}function Wk(e){if(e instanceof so)return new so(e.h,e.s,e.l,e.opacity);if(e instanceof od||(e=Qi(e)),!e)return new so;if(e instanceof so)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,a=Math.min(t,n,r),s=Math.max(t,n,r),l=NaN,f=s-a,p=(s+a)/2;return f?(l=t===s?(n-r)/f+(n<r)*6:n===s?(r-t)/f+2:(t-n)/f+4,f/=p<.5?s+a:2-s-a,l*=60):f=p>0&&p<1?0:l,new so(l,f,p,e.opacity)}function MO(e,t,n,r){return arguments.length===1?Wk(e):new so(e,t,n,r??1)}function so(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}sg(so,MO,Rk(od,{brighter(e){return e=e==null?Rc:Rc**+e,new so(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?rd:rd**+e,new so(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,a=2*n-r;return new kn(dg(e>=240?e-240:e+120,a,r),dg(e,a,r),dg(e<120?e+240:e-120,a,r),this.opacity)},clamp(){return new so(Uk(this.h),Bc(this.s),Bc(this.l),Fc(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(){let e=Fc(this.opacity);return`${e===1?"hsl(":"hsla("}${Uk(this.h)}, ${Bc(this.s)*100}%, ${Bc(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Uk(e){return e=(e||0)%360,e<0?e+360:e}function Bc(e){return Math.max(0,Math.min(1,e||0))}function dg(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}var ug=e=>()=>e;function OO(e,t){return function(n){return e+n*t}}function PO(e,t,n){return e**=+n,t=t**+n-e,n=1/n,function(r){return(e+r*t)**+n}}function DO(e){return(e=+e)==1?Yk:function(t,n){return n-t?PO(t,n,e):ug(isNaN(t)?n:t)}}function Yk(e,t){var n=t-e;return n?OO(e,n):ug(isNaN(e)?t:e)}var qc=(function e(t){var n=DO(t);function r(a,s){var l=n((a=lg(a)).r,(s=lg(s)).r),f=n(a.g,s.g),p=n(a.b,s.b),h=Yk(a.opacity,s.opacity);return function(v){return a.r=l(v),a.g=f(v),a.b=p(v),a.opacity=h(v),a+""}}return r.gamma=e,r})(1);function IO(e,t){t||=[];var n=e?Math.min(t.length,e.length):0,r=t.slice(),a;return function(s){for(a=0;a<n;++a)r[a]=e[a]*(1-s)+t[a]*s;return r}}function LO(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function RO(e,t){for(var n=t?t.length:0,r=e?Math.min(n,e.length):0,a=Array(r),s=Array(n),l=0;l<r;++l)a[l]=ad(e[l],t[l]);for(;l<n;++l)s[l]=t[l];return function(f){for(l=0;l<r;++l)s[l]=a[l](f);return s}}function zO(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function Mo(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function FO(e,t){var n={},r={},a;for(a in typeof e=="object"&&e||(e={}),typeof t=="object"&&t||(t={}),t)a in e?n[a]=ad(e[a],t[a]):r[a]=t[a];return function(s){for(a in n)r[a]=n[a](s);return r}}var cg=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,fg=new RegExp(cg.source,"g");function BO(e){return function(){return e}}function qO(e){return function(t){return e(t)+""}}function Xk(e,t){var n=cg.lastIndex=fg.lastIndex=0,r,a,s,l=-1,f=[],p=[];for(e+="",t+="";(r=cg.exec(e))&&(a=fg.exec(t));)(s=a.index)>n&&(s=t.slice(n,s),f[l]?f[l]+=s:f[++l]=s),(r=r[0])===(a=a[0])?f[l]?f[l]+=a:f[++l]=a:(f[++l]=null,p.push({i:l,x:Mo(r,a)})),n=fg.lastIndex;return n<t.length&&(s=t.slice(n),f[l]?f[l]+=s:f[++l]=s),f.length<2?p[0]?qO(p[0].x):BO(t):(t=p.length,function(h){for(var v=0,g;v<t;++v)f[(g=p[v]).i]=g.x(h);return f.join("")})}function ad(e,t){var n=typeof t,r;return t==null||n==="boolean"?ug(t):(n==="number"?Mo:n==="string"?(r=Qi(t))?(t=r,qc):Xk:t instanceof Qi?qc:t instanceof Date?zO:LO(t)?IO:Array.isArray(t)?RO:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?FO:Mo)(e,t)}var Zk=180/Math.PI,Gk={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Qk(e,t,n,r,a,s){var l,f,p;return(l=Math.sqrt(e*e+t*t))&&(e/=l,t/=l),(p=e*n+t*r)&&(n-=e*p,r-=t*p),(f=Math.sqrt(n*n+r*r))&&(n/=f,r/=f,p/=f),e*r<t*n&&(e=-e,t=-t,p=-p,l=-l),{translateX:a,translateY:s,rotate:Math.atan2(t,e)*Zk,skewX:Math.atan(p)*Zk,scaleX:l,scaleY:f}}var hg;function HO(e){let t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Gk:Qk(t.a,t.b,t.c,t.d,t.e,t.f)}function VO(e){return e==null||(hg||=document.createElementNS("http://www.w3.org/2000/svg","g"),hg.setAttribute("transform",e),!(e=hg.transform.baseVal.consolidate()))?Gk:(e=e.matrix,Qk(e.a,e.b,e.c,e.d,e.e,e.f))}function Jk(e,t,n,r){function a(h){return h.length?h.pop()+" ":""}function s(h,v,g,m,b,w){if(h!==g||v!==m){var k=b.push("translate(",null,t,null,n);w.push({i:k-4,x:Mo(h,g)},{i:k-2,x:Mo(v,m)})}else(g||m)&&b.push("translate("+g+t+m+n)}function l(h,v,g,m){h===v?v&&g.push(a(g)+"rotate("+v+r):(h-v>180?v+=360:v-h>180&&(h+=360),m.push({i:g.push(a(g)+"rotate(",null,r)-2,x:Mo(h,v)}))}function f(h,v,g,m){h===v?v&&g.push(a(g)+"skewX("+v+r):m.push({i:g.push(a(g)+"skewX(",null,r)-2,x:Mo(h,v)})}function p(h,v,g,m,b,w){if(h!==g||v!==m){var k=b.push(a(b)+"scale(",null,",",null,")");w.push({i:k-4,x:Mo(h,g)},{i:k-2,x:Mo(v,m)})}else(g!==1||m!==1)&&b.push(a(b)+"scale("+g+","+m+")")}return function(h,v){var g=[],m=[];return h=e(h),v=e(v),s(h.translateX,h.translateY,v.translateX,v.translateY,g,m),l(h.rotate,v.rotate,g,m),f(h.skewX,v.skewX,g,m),p(h.scaleX,h.scaleY,v.scaleX,v.scaleY,g,m),h=v=null,function(b){for(var w=-1,k=m.length,S;++w<k;)g[(S=m[w]).i]=S.x(b);return g.join("")}}}var KO=Jk(HO,"px, ","px)","deg)"),WO=Jk(VO,", ",")",")"),UO=1e-12;function e1(e){return((e=Math.exp(e))+1/e)/2}function YO(e){return((e=Math.exp(e))-1/e)/2}function XO(e){return((e=Math.exp(2*e))-1)/(e+1)}var Hc=(function e(t,n,r){function a(s,l){var f=s[0],p=s[1],h=s[2],v=l[0],g=l[1],m=l[2],b=v-f,w=g-p,k=b*b+w*w,S,N;if(k<UO)N=Math.log(m/h)/t,S=function(z){return[f+z*b,p+z*w,h*Math.exp(t*z*N)]};else{var $=Math.sqrt(k),j=(m*m-h*h+r*k)/(2*h*n*$),E=(m*m-h*h-r*k)/(2*m*n*$),I=Math.log(Math.sqrt(j*j+1)-j);N=(Math.log(Math.sqrt(E*E+1)-E)-I)/t,S=function(z){var T=z*N,M=e1(I),O=h/(n*$)*(M*XO(t*T+I)-YO(I));return[f+O*b,p+O*w,h*M/e1(t*T+I)]}}return S.duration=N*1e3*t/Math.SQRT2,S}return a.rho=function(s){var l=Math.max(.001,+s),f=l*l;return e(l,f,f*f)},a})(Math.SQRT2,2,4),ks=0,Vc=0,pg=0,t1=1e3,Kc,sd,Wc=0,Ss=0,Uc=0,ld=typeof performance=="object"&&performance.now?performance:Date,n1=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function mg(){return Ss||=(n1(ZO),ld.now()+Uc)}function ZO(){Ss=0}function Yc(){this._call=this._time=this._next=null}Yc.prototype=o1.prototype={constructor:Yc,restart:function(e,t,n){if(typeof e!="function")throw TypeError("callback is not a function");n=(n==null?mg():+n)+(t==null?0:+t),!this._next&&sd!==this&&(sd?sd._next=this:Kc=this,sd=this),this._call=e,this._time=n,gg()},stop:function(){this._call&&(this._call=null,this._time=1/0,gg())}};function o1(e,t,n){var r=new Yc;return r.restart(e,t,n),r}function GO(){mg(),++ks;for(var e=Kc,t;e;)(t=Ss-e._time)>=0&&e._call.call(void 0,t),e=e._next;--ks}function r1(){Ss=(Wc=ld.now())+Uc,ks=Vc=0;try{GO()}finally{ks=0,JO(),Ss=0}}function QO(){var e=ld.now(),t=e-Wc;t>t1&&(Uc-=t,Wc=e)}function JO(){for(var e,t=Kc,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:Kc=n);sd=e,gg(r)}function gg(e){ks||(Vc&&=clearTimeout(Vc),e-Ss>24?(e<1/0&&(Vc=setTimeout(r1,e-ld.now()-Uc)),pg&&=clearInterval(pg)):(pg||=(Wc=ld.now(),setInterval(QO,t1)),ks=1,n1(r1)))}function i1(e,t,n){var r=new Yc;return t=t==null?0:+t,r.restart(a=>{r.stop(),e(a+t)},t,n),r}var eP=Oc("start","end","cancel","interrupt"),tP=[];function Xc(e,t,n,r,a,s){var l=e.__transition;if(!l)e.__transition={};else if(n in l)return;nP(e,n,{name:t,index:r,group:a,on:eP,tween:tP,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:0})}function yg(e,t){var n=lo(e,t);if(n.state>0)throw Error("too late; already scheduled");return n}function Oo(e,t){var n=lo(e,t);if(n.state>3)throw Error("too late; already running");return n}function lo(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw Error("transition not found");return n}function nP(e,t,n){var r=e.__transition,a;r[t]=n,n.timer=o1(s,0,n.time);function s(h){n.state=1,n.timer.restart(l,n.delay,n.time),n.delay<=h&&l(h-n.delay)}function l(h){var v,g,m,b;if(n.state!==1)return p();for(v in r)if(b=r[v],b.name===n.name){if(b.state===3)return i1(l);b.state===4?(b.state=6,b.timer.stop(),b.on.call("interrupt",e,e.__data__,b.index,b.group),delete r[v]):+v<t&&(b.state=6,b.timer.stop(),b.on.call("cancel",e,e.__data__,b.index,b.group),delete r[v])}if(i1(function(){n.state===3&&(n.state=4,n.timer.restart(f,n.delay,n.time),f(h))}),n.state=2,n.on.call("start",e,e.__data__,n.index,n.group),n.state===2){for(n.state=3,a=Array(m=n.tween.length),v=0,g=-1;v<m;++v)(b=n.tween[v].value.call(e,e.__data__,n.index,n.group))&&(a[++g]=b);a.length=g+1}}function f(h){for(var v=h<n.duration?n.ease.call(null,h/n.duration):(n.timer.restart(p),n.state=5,1),g=-1,m=a.length;++g<m;)a[g].call(e,v);n.state===5&&(n.on.call("end",e,e.__data__,n.index,n.group),p())}function p(){for(var h in n.state=6,n.timer.stop(),delete r[t],r)return;delete e.__transition}}function Zc(e,t){var n=e.__transition,r,a,s=!0,l;if(n){for(l in t=t==null?null:t+"",n)(r=n[l]).name===t?(a=r.state>2&&r.state<5,r.state=6,r.timer.stop(),r.on.call(a?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[l]):s=!1;s&&delete e.__transition}}function oP(e){return this.each(function(){Zc(this,e)})}function rP(e,t){var n,r;return function(){var a=Oo(this,e),s=a.tween;if(s!==n){r=n=s;for(var l=0,f=r.length;l<f;++l)if(r[l].name===t){r=r.slice(),r.splice(l,1);break}}a.tween=r}}function iP(e,t,n){var r,a;if(typeof n!="function")throw Error();return function(){var s=Oo(this,e),l=s.tween;if(l!==r){a=(r=l).slice();for(var f={name:t,value:n},p=0,h=a.length;p<h;++p)if(a[p].name===t){a[p]=f;break}p===h&&a.push(f)}s.tween=a}}function aP(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=lo(this.node(),n).tween,a=0,s=r.length,l;a<s;++a)if((l=r[a]).name===e)return l.value;return null}return this.each((t==null?rP:iP)(n,e,t))}function vg(e,t,n){var r=e._id;return e.each(function(){var a=Oo(this,r);(a.value||={})[t]=n.apply(this,arguments)}),function(a){return lo(a,r).value[t]}}function a1(e,t){var n;return(typeof t=="number"?Mo:t instanceof Qi?qc:(n=Qi(t))?(t=n,qc):Xk)(e,t)}function sP(e){return function(){this.removeAttribute(e)}}function lP(e){return function(){this.removeAttributeNS(e.space,e.local)}}function dP(e,t,n){var r,a=n+"",s;return function(){var l=this.getAttribute(e);return l===a?null:l===r?s:s=t(r=l,n)}}function uP(e,t,n){var r,a=n+"",s;return function(){var l=this.getAttributeNS(e.space,e.local);return l===a?null:l===r?s:s=t(r=l,n)}}function cP(e,t,n){var r,a,s;return function(){var l,f=n(this),p;return f==null?void this.removeAttribute(e):(l=this.getAttribute(e),p=f+"",l===p?null:l===r&&p===a?s:(a=p,s=t(r=l,f)))}}function fP(e,t,n){var r,a,s;return function(){var l,f=n(this),p;return f==null?void this.removeAttributeNS(e.space,e.local):(l=this.getAttributeNS(e.space,e.local),p=f+"",l===p?null:l===r&&p===a?s:(a=p,s=t(r=l,f)))}}function hP(e,t){var n=Dc(e),r=n==="transform"?WO:a1;return this.attrTween(e,typeof t=="function"?(n.local?fP:cP)(n,r,vg(this,"attr."+e,t)):t==null?(n.local?lP:sP)(n):(n.local?uP:dP)(n,r,t))}function pP(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function mP(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function gP(e,t){var n,r;function a(){var s=t.apply(this,arguments);return s!==r&&(n=(r=s)&&mP(e,s)),n}return a._value=t,a}function yP(e,t){var n,r;function a(){var s=t.apply(this,arguments);return s!==r&&(n=(r=s)&&pP(e,s)),n}return a._value=t,a}function vP(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 Error();var r=Dc(e);return this.tween(n,(r.local?gP:yP)(r,t))}function bP(e,t){return function(){yg(this,e).delay=+t.apply(this,arguments)}}function xP(e,t){return t=+t,function(){yg(this,e).delay=t}}function wP(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?bP:xP)(t,e)):lo(this.node(),t).delay}function kP(e,t){return function(){Oo(this,e).duration=+t.apply(this,arguments)}}function SP(e,t){return t=+t,function(){Oo(this,e).duration=t}}function NP(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?kP:SP)(t,e)):lo(this.node(),t).duration}function jP(e,t){if(typeof t!="function")throw Error();return function(){Oo(this,e).ease=t}}function CP(e){var t=this._id;return arguments.length?this.each(jP(t,e)):lo(this.node(),t).ease}function $P(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw Error();Oo(this,e).ease=n}}function EP(e){if(typeof e!="function")throw Error();return this.each($P(this._id,e))}function _P(e){typeof e!="function"&&(e=jk(e));for(var t=this._groups,n=t.length,r=Array(n),a=0;a<n;++a)for(var s=t[a],l=s.length,f=r[a]=[],p,h=0;h<l;++h)(p=s[h])&&e.call(p,p.__data__,h,s)&&f.push(p);return new mr(r,this._parents,this._name,this._id)}function AP(e){if(e._id!==this._id)throw Error();for(var t=this._groups,n=e._groups,r=t.length,a=n.length,s=Math.min(r,a),l=Array(r),f=0;f<s;++f)for(var p=t[f],h=n[f],v=p.length,g=l[f]=Array(v),m,b=0;b<v;++b)(m=p[b]||h[b])&&(g[b]=m);for(;f<r;++f)l[f]=t[f];return new mr(l,this._parents,this._name,this._id)}function TP(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 MP(e,t,n){var r,a,s=TP(t)?yg:Oo;return function(){var l=s(this,e),f=l.on;f!==r&&(a=(r=f).copy()).on(t,n),l.on=a}}function OP(e,t){var n=this._id;return arguments.length<2?lo(this.node(),n).on.on(e):this.each(MP(n,e,t))}function PP(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function DP(){return this.on("end.remove",PP(this._id))}function IP(e){var t=this._name,n=this._id;typeof e!="function"&&(e=og(e));for(var r=this._groups,a=r.length,s=Array(a),l=0;l<a;++l)for(var f=r[l],p=f.length,h=s[l]=Array(p),v,g,m=0;m<p;++m)(v=f[m])&&(g=e.call(v,v.__data__,m,f))&&("__data__"in v&&(g.__data__=v.__data__),h[m]=g,Xc(h[m],t,n,m,h,lo(v,n)));return new mr(s,this._parents,t,n)}function LP(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Nk(e));for(var r=this._groups,a=r.length,s=[],l=[],f=0;f<a;++f)for(var p=r[f],h=p.length,v,g=0;g<h;++g)if(v=p[g]){for(var m=e.call(v,v.__data__,g,p),b,w=lo(v,n),k=0,S=m.length;k<S;++k)(b=m[k])&&Xc(b,t,n,k,m,w);s.push(m),l.push(v)}return new mr(s,l,t,n)}var RP=td.prototype.constructor;function zP(){return new RP(this._groups,this._parents)}function FP(e,t){var n,r,a;return function(){var s=bs(this,e),l=(this.style.removeProperty(e),bs(this,e));return s===l?null:s===n&&l===r?a:a=t(n=s,r=l)}}function s1(e){return function(){this.style.removeProperty(e)}}function BP(e,t,n){var r,a=n+"",s;return function(){var l=bs(this,e);return l===a?null:l===r?s:s=t(r=l,n)}}function qP(e,t,n){var r,a,s;return function(){var l=bs(this,e),f=n(this),p=f+"";return f??(p=f=(this.style.removeProperty(e),bs(this,e))),l===p?null:l===r&&p===a?s:(a=p,s=t(r=l,f))}}function HP(e,t){var n,r,a,s="style."+t,l="end."+s,f;return function(){var p=Oo(this,e),h=p.on,v=p.value[s]==null?f||=s1(t):void 0;(h!==n||a!==v)&&(r=(n=h).copy()).on(l,a=v),p.on=r}}function VP(e,t,n){var r=(e+="")=="transform"?KO:a1;return t==null?this.styleTween(e,FP(e,r)).on("end.style."+e,s1(e)):typeof t=="function"?this.styleTween(e,qP(e,r,vg(this,"style."+e,t))).each(HP(this._id,e)):this.styleTween(e,BP(e,r,t),n).on("end.style."+e,null)}function KP(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function WP(e,t,n){var r,a;function s(){var l=t.apply(this,arguments);return l!==a&&(r=(a=l)&&KP(e,l,n)),r}return s._value=t,s}function UP(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 Error();return this.tween(r,WP(e,t,n??""))}function YP(e){return function(){this.textContent=e}}function XP(e){return function(){var t=e(this);this.textContent=t??""}}function ZP(e){return this.tween("text",typeof e=="function"?XP(vg(this,"text",e)):YP(e==null?"":e+""))}function GP(e){return function(t){this.textContent=e.call(this,t)}}function QP(e){var t,n;function r(){var a=e.apply(this,arguments);return a!==n&&(t=(n=a)&&GP(a)),t}return r._value=e,r}function JP(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 Error();return this.tween(t,QP(e))}function eD(){for(var e=this._name,t=this._id,n=l1(),r=this._groups,a=r.length,s=0;s<a;++s)for(var l=r[s],f=l.length,p,h=0;h<f;++h)if(p=l[h]){var v=lo(p,t);Xc(p,e,n,h,l,{time:v.time+v.delay+v.duration,delay:0,duration:v.duration,ease:v.ease})}return new mr(r,this._parents,e,n)}function tD(){var e,t,n=this,r=n._id,a=n.size();return new Promise(function(s,l){var f={value:l},p={value:function(){--a===0&&s()}};n.each(function(){var h=Oo(this,r),v=h.on;v!==e&&(t=(e=v).copy(),t._.cancel.push(f),t._.interrupt.push(f),t._.end.push(p)),h.on=t}),a===0&&s()})}var nD=0;function mr(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function l1(){return++nD}var gr=td.prototype;mr.prototype={constructor:mr,select:IP,selectAll:LP,selectChild:gr.selectChild,selectChildren:gr.selectChildren,filter:_P,merge:AP,selection:zP,transition:eD,call:gr.call,nodes:gr.nodes,node:gr.node,size:gr.size,empty:gr.empty,each:gr.each,on:OP,attr:hP,attrTween:vP,style:VP,styleTween:UP,text:ZP,textTween:JP,remove:DP,tween:aP,delay:wP,duration:NP,ease:CP,easeVarying:EP,end:tD,[Symbol.iterator]:gr[Symbol.iterator]};function oD(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var rD={time:null,delay:0,duration:250,ease:oD};function iD(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw Error(`transition ${t} not found`);return n}function aD(e){var t,n;e instanceof mr?(t=e._id,e=e._name):(t=l1(),(n=rD).time=mg(),e=e==null?null:e+"");for(var r=this._groups,a=r.length,s=0;s<a;++s)for(var l=r[s],f=l.length,p,h=0;h<f;++h)(p=l[h])&&Xc(p,e,t,h,l,n||iD(p,t));return new mr(r,this._parents,e,t)}td.prototype.interrupt=oP,td.prototype.transition=aD;var Gc=e=>()=>e;function sD(e,{sourceEvent:t,target:n,transform:r,dispatch:a}){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:a}})}function yr(e,t,n){this.k=e,this.x=t,this.y=n}yr.prototype={constructor:yr,scale:function(e){return e===1?this:new yr(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new yr(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 Qc=new yr(1,0,0);d1.prototype=yr.prototype;function d1(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Qc;return e.__zoom}function bg(e){e.stopImmediatePropagation()}function dd(e){e.preventDefault(),e.stopImmediatePropagation()}function lD(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function dD(){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 u1(){return this.__zoom||Qc}function uD(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function cD(){return navigator.maxTouchPoints||"ontouchstart"in this}function fD(e,t,n){var r=e.invertX(t[0][0])-n[0][0],a=e.invertX(t[1][0])-n[1][0],s=e.invertY(t[0][1])-n[0][1],l=e.invertY(t[1][1])-n[1][1];return e.translate(a>r?(r+a)/2:Math.min(0,r)||Math.max(0,a),l>s?(s+l)/2:Math.min(0,s)||Math.max(0,l))}function c1(){var e=lD,t=dD,n=fD,r=uD,a=cD,s=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],f=250,p=Hc,h=Oc("start","zoom","end"),v,g,m,b=500,w=150,k=0,S=10;function N(F){F.property("__zoom",u1).on("wheel.zoom",M,{passive:!1}).on("mousedown.zoom",O).on("dblclick.zoom",K).filter(a).on("touchstart.zoom",B).on("touchmove.zoom",V).on("touchend.zoom touchcancel.zoom",oe).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}N.transform=function(F,J,L,U){var W=F.selection?F.selection():F;W.property("__zoom",u1),F===W?W.interrupt().each(function(){z(this,arguments).event(U).start().zoom(null,typeof J=="function"?J.apply(this,arguments):J).end()}):I(F,J,L,U)},N.scaleBy=function(F,J,L,U){N.scaleTo(F,function(){return this.__zoom.k*(typeof J=="function"?J.apply(this,arguments):J)},L,U)},N.scaleTo=function(F,J,L,U){N.transform(F,function(){var W=t.apply(this,arguments),re=this.__zoom,le=L==null?E(W):typeof L=="function"?L.apply(this,arguments):L,pe=re.invert(le),xe=typeof J=="function"?J.apply(this,arguments):J;return n(j($(re,xe),le,pe),W,l)},L,U)},N.translateBy=function(F,J,L,U){N.transform(F,function(){return n(this.__zoom.translate(typeof J=="function"?J.apply(this,arguments):J,typeof L=="function"?L.apply(this,arguments):L),t.apply(this,arguments),l)},null,U)},N.translateTo=function(F,J,L,U,W){N.transform(F,function(){var re=t.apply(this,arguments),le=this.__zoom,pe=U==null?E(re):typeof U=="function"?U.apply(this,arguments):U;return n(Qc.translate(pe[0],pe[1]).scale(le.k).translate(typeof J=="function"?-J.apply(this,arguments):-J,typeof L=="function"?-L.apply(this,arguments):-L),re,l)},U,W)};function $(F,J){return J=Math.max(s[0],Math.min(s[1],J)),J===F.k?F:new yr(J,F.x,F.y)}function j(F,J,L){var U=J[0]-L[0]*F.k,W=J[1]-L[1]*F.k;return U===F.x&&W===F.y?F:new yr(F.k,U,W)}function E(F){return[(+F[0][0]+ +F[1][0])/2,(+F[0][1]+ +F[1][1])/2]}function I(F,J,L,U){F.on("start.zoom",function(){z(this,arguments).event(U).start()}).on("interrupt.zoom end.zoom",function(){z(this,arguments).event(U).end()}).tween("zoom",function(){var W=this,re=arguments,le=z(W,re).event(U),pe=t.apply(W,re),xe=L==null?E(pe):typeof L=="function"?L.apply(W,re):L,Ne=Math.max(pe[1][0]-pe[0][0],pe[1][1]-pe[0][1]),we=W.__zoom,R=typeof J=="function"?J.apply(W,re):J,Q=p(we.invert(xe).concat(Ne/we.k),R.invert(xe).concat(Ne/R.k));return function(fe){if(fe===1)fe=R;else{var X=Q(fe),he=Ne/X[2];fe=new yr(he,xe[0]-X[0]*he,xe[1]-X[1]*he)}le.zoom(null,fe)}})}function z(F,J,L){return!L&&F.__zooming||new T(F,J)}function T(F,J){this.that=F,this.args=J,this.active=0,this.sourceEvent=null,this.extent=t.apply(F,J),this.taps=0}T.prototype={event:function(F){return F&&(this.sourceEvent=F),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(F,J){return this.mouse&&F!=="mouse"&&(this.mouse[1]=J.invert(this.mouse[0])),this.touch0&&F!=="touch"&&(this.touch0[1]=J.invert(this.touch0[0])),this.touch1&&F!=="touch"&&(this.touch1[1]=J.invert(this.touch1[0])),this.that.__zoom=J,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(F){var J=Mn(this.that).datum();h.call(F,this.that,new sD(F,{sourceEvent:this.sourceEvent,target:N,type:F,transform:this.that.__zoom,dispatch:h}),J)}};function M(F,...J){if(!e.apply(this,arguments))return;var L=z(this,J).event(F),U=this.__zoom,W=Math.max(s[0],Math.min(s[1],U.k*2**r.apply(this,arguments))),re=ao(F);if(L.wheel)(L.mouse[0][0]!==re[0]||L.mouse[0][1]!==re[1])&&(L.mouse[1]=U.invert(L.mouse[0]=re)),clearTimeout(L.wheel);else{if(U.k===W)return;L.mouse=[re,U.invert(re)],Zc(this),L.start()}dd(F),L.wheel=setTimeout(le,w),L.zoom("mouse",n(j($(U,W),L.mouse[0],L.mouse[1]),L.extent,l));function le(){L.wheel=null,L.end()}}function O(F,...J){if(m||!e.apply(this,arguments))return;var L=F.currentTarget,U=z(this,J,!0).event(F),W=Mn(F.view).on("mousemove.zoom",xe,!0).on("mouseup.zoom",Ne,!0),re=ao(F,L),le=F.clientX,pe=F.clientY;Dk(F.view),bg(F),U.mouse=[re,this.__zoom.invert(re)],Zc(this),U.start();function xe(we){if(dd(we),!U.moved){var R=we.clientX-le,Q=we.clientY-pe;U.moved=R*R+Q*Q>k}U.event(we).zoom("mouse",n(j(U.that.__zoom,U.mouse[0]=ao(we,L),U.mouse[1]),U.extent,l))}function Ne(we){W.on("mousemove.zoom mouseup.zoom",null),Ik(we.view,U.moved),dd(we),U.event(we).end()}}function K(F,...J){if(e.apply(this,arguments)){var L=this.__zoom,U=ao(F.changedTouches?F.changedTouches[0]:F,this),W=L.invert(U),re=L.k*(F.shiftKey?.5:2),le=n(j($(L,re),U,W),t.apply(this,J),l);dd(F),f>0?Mn(this).transition().duration(f).call(I,le,U,F):Mn(this).call(N.transform,le,U,F)}}function B(F,...J){if(e.apply(this,arguments)){var L=F.touches,U=L.length,W=z(this,J,F.changedTouches.length===U).event(F),re,le,pe,xe;for(bg(F),le=0;le<U;++le)pe=L[le],xe=ao(pe,this),xe=[xe,this.__zoom.invert(xe),pe.identifier],W.touch0?!W.touch1&&W.touch0[2]!==xe[2]&&(W.touch1=xe,W.taps=0):(W.touch0=xe,re=!0,W.taps=1+!!v);v&&=clearTimeout(v),re&&(W.taps<2&&(g=xe[0],v=setTimeout(function(){v=null},b)),Zc(this),W.start())}}function V(F,...J){if(this.__zooming){var L=z(this,J).event(F),U=F.changedTouches,W=U.length,re,le,pe,xe;for(dd(F),re=0;re<W;++re)le=U[re],pe=ao(le,this),L.touch0&&L.touch0[2]===le.identifier?L.touch0[0]=pe:L.touch1&&L.touch1[2]===le.identifier&&(L.touch1[0]=pe);if(le=L.that.__zoom,L.touch1){var Ne=L.touch0[0],we=L.touch0[1],R=L.touch1[0],Q=L.touch1[1],fe=(fe=R[0]-Ne[0])*fe+(fe=R[1]-Ne[1])*fe,X=(X=Q[0]-we[0])*X+(X=Q[1]-we[1])*X;le=$(le,Math.sqrt(fe/X)),pe=[(Ne[0]+R[0])/2,(Ne[1]+R[1])/2],xe=[(we[0]+Q[0])/2,(we[1]+Q[1])/2]}else if(L.touch0)pe=L.touch0[0],xe=L.touch0[1];else return;L.zoom("touch",n(j(le,pe,xe),L.extent,l))}}function oe(F,...J){if(this.__zooming){var L=z(this,J).event(F),U=F.changedTouches,W=U.length,re,le;for(bg(F),m&&clearTimeout(m),m=setTimeout(function(){m=null},b),re=0;re<W;++re)le=U[re],L.touch0&&L.touch0[2]===le.identifier?delete L.touch0:L.touch1&&L.touch1[2]===le.identifier&&delete L.touch1;if(L.touch1&&!L.touch0&&(L.touch0=L.touch1,delete L.touch1),L.touch0)L.touch0[1]=this.__zoom.invert(L.touch0[0]);else if(L.end(),L.taps===2&&(le=ao(le,this),Math.hypot(g[0]-le[0],g[1]-le[1])<S)){var pe=Mn(this).on("dblclick.zoom");pe&&pe.apply(this,arguments)}}}return N.wheelDelta=function(F){return arguments.length?(r=typeof F=="function"?F:Gc(+F),N):r},N.filter=function(F){return arguments.length?(e=typeof F=="function"?F:Gc(!!F),N):e},N.touchable=function(F){return arguments.length?(a=typeof F=="function"?F:Gc(!!F),N):a},N.extent=function(F){return arguments.length?(t=typeof F=="function"?F:Gc([[+F[0][0],+F[0][1]],[+F[1][0],+F[1][1]]]),N):t},N.scaleExtent=function(F){return arguments.length?(s[0]=+F[0],s[1]=+F[1],N):[s[0],s[1]]},N.translateExtent=function(F){return arguments.length?(l[0][0]=+F[0][0],l[1][0]=+F[1][0],l[0][1]=+F[0][1],l[1][1]=+F[1][1],N):[[l[0][0],l[0][1]],[l[1][0],l[1][1]]]},N.constrain=function(F){return arguments.length?(n=F,N):n},N.duration=function(F){return arguments.length?(f=+F,N):f},N.interpolate=function(F){return arguments.length?(p=F,N):p},N.on=function(){var F=h.on.apply(h,arguments);return F===h?N:F},N.clickDistance=function(F){return arguments.length?(k=(F=+F)*F,N):Math.sqrt(k)},N.tapDistance=function(F){return arguments.length?(S=+F,N):S},N}var Wn={error001:(e="react")=>`Seems like you have not used ${e==="svelte"?"SvelteFlowProvider":"ReactFlowProvider"} as an ancestor. Help: https://${e}flow.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 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.",error016:e=>`Edge with id "${e}" does not exist, it may have been removed. This can happen when an edge is deleted before the "onEdgeClick" handler is called.`},ud=[[-1/0,-1/0],[1/0,1/0]],f1=["Enter"," ","Escape"],h1={"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"},cd;(function(e){e.Strict="strict",e.Loose="loose"})(cd||={});var Ns;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Ns||={});var Jc;(function(e){e.Partial="partial",e.Full="full"})(Jc||={});var p1={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null},ta;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(ta||={});var na;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(na||={});var Ce;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Ce||={});var m1={[Ce.Left]:Ce.Right,[Ce.Right]:Ce.Left,[Ce.Top]:Ce.Bottom,[Ce.Bottom]:Ce.Top},g1=e=>!!e&&typeof e=="object"&&"id"in e&&"source"in e&&"target"in e,hD=e=>!!e&&typeof e=="object"&&"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),xg=e=>!!e&&typeof e=="object"&&"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),fd=(e,t=[0,0])=>{let{width:n,height:r}=co(e),a=e.origin??t,s=n*a[0],l=r*a[1];return{x:e.position.x-s,y:e.position.y-l}},ef=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};let n=!1,r=e.reduce((a,s)=>{let l=typeof s=="string",f=!t.nodeLookup&&!l?s:void 0;return t.nodeLookup&&(f=l?t.nodeLookup.get(s):xg(s)?s:t.nodeLookup.get(s.id)),f?(n=!0,tf(a,of(f,t.nodeOrigin))):a},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return n?nf(r):{x:0,y:0,width:0,height:0}},hd=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(a=>{(t.filter===void 0||t.filter(a))&&(n=tf(n,of(a)),r=!0)}),r?nf(n):{x:0,y:0,width:0,height:0}},wg=(e,t,[n,r,a]=[0,0,1],s=!1,l=!1)=>{let f=(t.x-n)/a,p=(t.y-r)/a,h=t.width/a,v=t.height/a,g=[];for(let m of e.values()){let{measured:b,selectable:w=!0,hidden:k=!1}=m;if(l&&!w||k)continue;let S=b.width??m.width??m.initialWidth??0,N=b.height??m.height??m.initialHeight??0,{x:$,y:j}=m.internals.positionAbsolute,E=w1(f,p,h,v,$,j,S,N),I=S*N,z=s&&E>0;(!m.internals.handleBounds||z||E>=I||m.dragging)&&g.push(m)}return g},pD=(e,t)=>{let n=new Set;return e.forEach(r=>{n.add(r.id)}),t.filter(r=>n.has(r.source)||n.has(r.target))};function mD(e,t){let n=new Map,r=t?.nodes?new Set(t.nodes.map(a=>a.id)):null;return e.forEach(a=>{let s;if(t?.includeHiddenNodes){let{width:l,height:f}=co(a);s=l>0&&f>0}else s=!!(a.measured.width&&a.measured.height&&!a.hidden);s&&(!r||r.has(a.id))&&n.set(a.id,a)}),n}async function gD({nodes:e,width:t,height:n,panZoom:r,minZoom:a,maxZoom:s},l){if(e.size===0)return!0;let f=Ng(hd(mD(e,l)),t,n,l?.minZoom??a,l?.maxZoom??s,l?.padding??.1);return await r.setViewport(f,{duration:l?.duration,ease:l?.ease,interpolate:l?.interpolate}),!0}function y1({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:a,onError:s}){let l=n.get(e),f=l.parentId?n.get(l.parentId):void 0,{x:p,y:h}=f?f.internals.positionAbsolute:{x:0,y:0},v=l.origin??r,g=l.extent||a;if(l.extent==="parent"&&!l.expandParent)if(!f)s?.("005",Wn.error005());else{let{width:b,height:w}=co(f);b&&w&&(g=[[p,h],[p+b,h+w]])}else f&&ra(l.extent)&&(g=[[l.extent[0][0]+p,l.extent[0][1]+h],[l.extent[1][0]+p,l.extent[1][1]+h]]);let m=ra(g)?oa(t,g,l.measured):t;return(l.measured.width===void 0||l.measured.height===void 0)&&s?.("015",Wn.error015()),{position:{x:m.x-p+(l.measured.width??0)*v[0],y:m.y-h+(l.measured.height??0)*v[1]},positionAbsolute:m}}async function yD({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:a}){let s=new Set(e.map(g=>g.id)),l=[];for(let g of n){if(g.deletable===!1)continue;let m=s.has(g.id),b=!m&&g.parentId&&l.find(w=>w.id===g.parentId);(m||b)&&l.push(g)}let f=new Set(t.map(g=>g.id)),p=r.filter(g=>g.deletable!==!1),h=pD(l,p);for(let g of p)f.has(g.id)&&!h.find(m=>m.id===g.id)&&h.push(g);if(!a)return{edges:h,nodes:l};let v=await a({nodes:l,edges:h});return typeof v=="boolean"?v?{edges:h,nodes:l}:{edges:[],nodes:[]}:v}var js=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),oa=(e={x:0,y:0},t,n)=>({x:js(e.x,t[0][0],t[1][0]-(n?.width??0)),y:js(e.y,t[0][1],t[1][1]-(n?.height??0))});function v1(e,t,n){let{width:r,height:a}=co(n),{x:s,y:l}=n.internals.positionAbsolute;return oa(e,[[s,l],[s+r,l+a]],t)}var b1=(e,t,n)=>e<t?js(Math.abs(e-t),1,t)/t:e>n?-js(Math.abs(e-n),1,t)/t:0,kg=(e,t,n=15,r=40)=>[b1(e.x,r,t.width-r)*n,b1(e.y,r,t.height-r)*n],tf=(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)}),Sg=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),nf=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),pd=(e,t=[0,0])=>{let{x:n,y:r}=xg(e)?e.internals.positionAbsolute:fd(e,t);return{x:n,y:r,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},of=(e,t=[0,0])=>{let{x:n,y:r}=xg(e)?e.internals.positionAbsolute:fd(e,t);return{x:n,y:r,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:r+(e.measured?.height??e.height??e.initialHeight??0)}},x1=(e,t)=>nf(tf(Sg(e),Sg(t))),w1=(e,t,n,r,a,s,l,f)=>{let p=Math.max(0,Math.min(e+n,a+l)-Math.max(e,a)),h=Math.max(0,Math.min(t+r,s+f)-Math.max(t,s));return Math.ceil(p*h)},rf=(e,t)=>w1(e.x,e.y,e.width,e.height,t.x,t.y,t.width,t.height),k1=e=>uo(e.width)&&uo(e.height)&&uo(e.x)&&uo(e.y),uo=e=>!isNaN(e)&&isFinite(e),S1=(e,t)=>(n,r)=>{},md=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),gd=({x:e,y:t},[n,r,a],s=!1,l=[1,1])=>{let f={x:(e-n)/a,y:(t-r)/a};return s?md(f,l):f},Cs=({x:e,y:t},[n,r,a])=>({x:e*a+n,y:t*a+r});function $s(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){let n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){let n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function vD(e,t,n){if(typeof e=="string"||typeof e=="number"){let r=$s(e,n),a=$s(e,t);return{top:r,right:a,bottom:r,left:a,x:a*2,y:r*2}}if(typeof e=="object"){let r=$s(e.top??e.y??0,n),a=$s(e.bottom??e.y??0,n),s=$s(e.left??e.x??0,t),l=$s(e.right??e.x??0,t);return{top:r,right:l,bottom:a,left:s,x:s+l,y:r+a}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function bD(e,t,n,r,a,s){let{x:l,y:f}=Cs(e,[t,n,r]),{x:p,y:h}=Cs({x:e.x+e.width,y:e.y+e.height},[t,n,r]),v=a-p,g=s-h;return{left:Math.floor(l),top:Math.floor(f),right:Math.floor(v),bottom:Math.floor(g)}}var Ng=(e,t,n,r,a,s)=>{let l=vD(s,t,n),f=(t-l.x)/e.width,p=(n-l.y)/e.height,h=js(Math.min(f,p),r,a),v=e.x+e.width/2,g=e.y+e.height/2,m=t/2-v*h,b=n/2-g*h,w=bD(e,m,b,h,t,n),k={left:Math.min(w.left-l.left,0),top:Math.min(w.top-l.top,0),right:Math.min(w.right-l.right,0),bottom:Math.min(w.bottom-l.bottom,0)};return{x:m-k.left+k.right,y:b-k.top+k.bottom,zoom:h}},yd=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function ra(e){return e!=null&&e!=="parent"}function co(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function N1(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function j1(e,t={width:0,height:0},n,r,a){let s={...e},l=r.get(n);if(l){let f=l.origin||a;s.x+=l.internals.positionAbsolute.x-(t.width??0)*f[0],s.y+=l.internals.positionAbsolute.y-(t.height??0)*f[1]}return s}function C1(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function xD(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}function wD(e){return{...h1,...e||{}}}function $1(e){return e===null?null:e?"valid":"invalid"}function vd(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:a}){let{x:s,y:l}=fo(e),f=gd({x:s-(a?.left??0),y:l-(a?.top??0)},r),{x:p,y:h}=n?md(f,t):f;return{xSnapped:p,ySnapped:h,...f}}var jg=e=>({width:e.offsetWidth,height:e.offsetHeight}),E1=e=>e?.getRootNode?.()||window?.document,kD=["INPUT","SELECT","TEXTAREA"];function _1(e){let t=e.composedPath?.()?.[0]||e.target;return t?.nodeType===1?kD.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey"):!1}var A1=e=>"clientX"in e,fo=(e,t)=>{let n=A1(e),r=n?e.clientX:e.touches?.[0].clientX,a=n?e.clientY:e.touches?.[0].clientY;return{x:r-(t?.left??0),y:a-(t?.top??0)}},T1=(e,t,n,r,a)=>{let s=t.querySelectorAll(`.${e}`);return!s||!s.length?null:Array.from(s).map(l=>{let f=l.getBoundingClientRect();return{id:l.getAttribute("data-handleid"),type:e,nodeId:a,position:l.getAttribute("data-handlepos"),x:(f.left-n.left)/r,y:(f.top-n.top)/r,...jg(l)}})};function M1({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:a,sourceControlY:s,targetControlX:l,targetControlY:f}){let p=e*.125+a*.375+l*.375+n*.125,h=t*.125+s*.375+f*.375+r*.125;return[p,h,Math.abs(p-e),Math.abs(h-t)]}function af(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function O1({pos:e,x1:t,y1:n,x2:r,y2:a,c:s}){switch(e){case Ce.Left:return[t-af(t-r,s),n];case Ce.Right:return[t+af(r-t,s),n];case Ce.Top:return[t,n-af(n-a,s)];case Ce.Bottom:return[t,n+af(a-n,s)]}}function P1({sourceX:e,sourceY:t,sourcePosition:n=Ce.Bottom,targetX:r,targetY:a,targetPosition:s=Ce.Top,curvature:l=.25}){let[f,p]=O1({pos:n,x1:e,y1:t,x2:r,y2:a,c:l}),[h,v]=O1({pos:s,x1:r,y1:a,x2:e,y2:t,c:l}),[g,m,b,w]=M1({sourceX:e,sourceY:t,targetX:r,targetY:a,sourceControlX:f,sourceControlY:p,targetControlX:h,targetControlY:v});return[`M${e},${t} C${f},${p} ${h},${v} ${r},${a}`,g,m,b,w]}function D1({sourceX:e,sourceY:t,targetX:n,targetY:r}){let a=Math.abs(n-e)/2,s=n<e?n+a:n-a,l=Math.abs(r-t)/2;return[s,r<t?r+l:r-l,a,l]}function SD({sourceNode:e,targetNode:t,selected:n=!1,zIndex:r=0,elevateOnSelect:a=!1,zIndexMode:s="basic"}){return s==="manual"?r:(a&&n?r+1e3:r)+Math.max(e.parentId||a&&e.selected?e.internals.z:0,t.parentId||a&&t.selected?t.internals.z:0)}function ND({sourceNode:e,targetNode:t,width:n,height:r,transform:a}){let s=tf(of(e),of(t));return s.x===s.x2&&(s.x2+=1),s.y===s.y2&&(s.y2+=1),rf({x:-a[0]/a[2],y:-a[1]/a[2],width:n/a[2],height:r/a[2]},nf(s))>0}var jD=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,CD=(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)),$D=(e,t,n={})=>{if(!e.source||!e.target)return n.onError?.("006",Wn.error006()),t;let r=n.getEdgeId||jD,a;return a=g1(e)?{...e}:{...e,id:r(e)},CD(a,t)?t:(a.sourceHandle===null&&delete a.sourceHandle,a.targetHandle===null&&delete a.targetHandle,t.concat(a))};function I1({sourceX:e,sourceY:t,targetX:n,targetY:r}){let[a,s,l,f]=D1({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,a,s,l,f]}var L1={[Ce.Left]:{x:-1,y:0},[Ce.Right]:{x:1,y:0},[Ce.Top]:{x:0,y:-1},[Ce.Bottom]:{x:0,y:1}},ED=({source:e,sourcePosition:t=Ce.Bottom,target:n})=>t===Ce.Left||t===Ce.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},R1=(e,t)=>Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2);function _D({source:e,sourcePosition:t=Ce.Bottom,target:n,targetPosition:r=Ce.Top,center:a,offset:s,stepPosition:l}){let f=L1[t],p=L1[r],h={x:e.x+f.x*s,y:e.y+f.y*s},v={x:n.x+p.x*s,y:n.y+p.y*s},g=ED({source:h,sourcePosition:t,target:v}),m=g.x===0?"y":"x",b=g[m],w=[],k,S,N={x:0,y:0},$={x:0,y:0},[,,j,E]=D1({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(f[m]*p[m]===-1){m==="x"?(k=a.x??h.x+(v.x-h.x)*l,S=a.y??(h.y+v.y)/2):(k=a.x??(h.x+v.x)/2,S=a.y??h.y+(v.y-h.y)*l);let T=[{x:k,y:h.y},{x:k,y:v.y}],M=[{x:h.x,y:S},{x:v.x,y:S}];w=f[m]===b?m==="x"?T:M:m==="x"?M:T}else{let T=[{x:h.x,y:v.y}],M=[{x:v.x,y:h.y}];if(w=m==="x"?f.x===b?M:T:f.y===b?T:M,t===r){let B=Math.abs(e[m]-n[m]);if(B<=s){let V=Math.min(s-1,s-B);f[m]===b?N[m]=(h[m]>e[m]?-1:1)*V:$[m]=(v[m]>n[m]?-1:1)*V}}if(t!==r){let B=m==="x"?"y":"x",V=f[m]===p[B],oe=h[B]>v[B],F=h[B]<v[B];(f[m]===1&&(!V&&oe||V&&F)||f[m]!==1&&(!V&&F||V&&oe))&&(w=m==="x"?T:M)}let O={x:h.x+N.x,y:h.y+N.y},K={x:v.x+$.x,y:v.y+$.y};Math.max(Math.abs(O.x-w[0].x),Math.abs(K.x-w[0].x))>=Math.max(Math.abs(O.y-w[0].y),Math.abs(K.y-w[0].y))?(k=(O.x+K.x)/2,S=w[0].y):(k=w[0].x,S=(O.y+K.y)/2)}let I={x:h.x+N.x,y:h.y+N.y},z={x:v.x+$.x,y:v.y+$.y};return[[e,...I.x!==w[0].x||I.y!==w[0].y?[I]:[],...w,...z.x!==w[w.length-1].x||z.y!==w[w.length-1].y?[z]:[],n],k,S,j,E]}function AD(e,t,n,r){let a=Math.min(R1(e,t)/2,R1(t,n)/2,r),{x:s,y:l}=t;if(e.x===s&&s===n.x||e.y===l&&l===n.y)return`L${s} ${l}`;if(e.y===l){let p=e.x<n.x?-1:1,h=e.y<n.y?1:-1;return`L ${s+a*p},${l}Q ${s},${l} ${s},${l+a*h}`}let f=e.x<n.x?1:-1;return`L ${s},${l+a*(e.y<n.y?-1:1)}Q ${s},${l} ${s+a*f},${l}`}function sf({sourceX:e,sourceY:t,sourcePosition:n=Ce.Bottom,targetX:r,targetY:a,targetPosition:s=Ce.Top,borderRadius:l=5,centerX:f,centerY:p,offset:h=20,stepPosition:v=.5}){let[g,m,b,w,k]=_D({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:a},targetPosition:s,center:{x:f,y:p},offset:h,stepPosition:v}),S=`M${g[0].x} ${g[0].y}`;for(let N=1;N<g.length-1;N++)S+=AD(g[N-1],g[N],g[N+1],l);return S+=`L${g[g.length-1].x} ${g[g.length-1].y}`,[S,m,b,w,k]}function z1(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function TD(e){let{sourceNode:t,targetNode:n}=e;if(!z1(t)||!z1(n))return null;let r=t.internals.handleBounds||F1(t.handles),a=n.internals.handleBounds||F1(n.handles),s=B1(r?.source??[],e.sourceHandle),l=B1(e.connectionMode===cd.Strict?a?.target??[]:(a?.target??[]).concat(a?.source??[]),e.targetHandle);if(!s||!l)return e.onError?.("008",Wn.error008(s?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;let f=s?.position||Ce.Bottom,p=l?.position||Ce.Top,h=ia(t,s,f),v=ia(n,l,p);return{sourceX:h.x,sourceY:h.y,targetX:v.x,targetY:v.y,sourcePosition:f,targetPosition:p}}function F1(e){if(!e)return null;let t=[],n=[];for(let 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 ia(e,t,n=Ce.Left,r=!1){let a=(t?.x??0)+e.internals.positionAbsolute.x,s=(t?.y??0)+e.internals.positionAbsolute.y,{width:l,height:f}=t??co(e);if(r)return{x:a+l/2,y:s+f/2};switch(t?.position??n){case Ce.Top:return{x:a+l/2,y:s};case Ce.Right:return{x:a+l,y:s+f/2};case Ce.Bottom:return{x:a+l/2,y:s+f};case Ce.Left:return{x:a,y:s+f/2}}}function B1(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function Cg(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(n=>`${n}=${e[n]}`).join("&")}`:""}function MD(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:a}){let s=new Set;return e.reduce((l,f)=>([f.markerStart||r,f.markerEnd||a].forEach(p=>{if(p&&typeof p=="object"){let h=Cg(p,t);s.has(h)||(l.push({id:h,color:p.color||n,...p}),s.add(h))}}),l),[]).sort((l,f)=>l.id.localeCompare(f.id))}var q1=1e3,OD=10,$g={nodeOrigin:[0,0],nodeExtent:ud,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},PD={...$g,checkEquality:!0};function Eg(e,t){let n={...e};for(let r in t)t[r]!==void 0&&(n[r]=t[r]);return n}function DD(e,t,n){let r=Eg($g,n);for(let a of e.values())if(a.parentId)Tg(a,e,t,r);else{let s=oa(fd(a,r.nodeOrigin),ra(a.extent)?a.extent:r.nodeExtent,co(a));a.internals.positionAbsolute=s}}function ID(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;let n=[],r=[];for(let a of e.handles){let s={id:a.id,width:a.width??1,height:a.height??1,nodeId:e.id,x:a.x,y:a.y,position:a.position,type:a.type};a.type==="source"?n.push(s):a.type==="target"&&r.push(s)}return{source:n,target:r}}function _g(e){return e==="manual"}function Ag(e,t,n,r={}){let a=Eg(PD,r),s={i:0},l=new Map(t),f=a?.elevateNodesOnSelect&&!_g(a.zIndexMode)?q1:0,p=e.length>0,h=!1;t.clear(),n.clear();for(let v of e){let g=l.get(v.id);if(a.checkEquality&&v===g?.internals.userNode)t.set(v.id,g);else{let m=oa(fd(v,a.nodeOrigin),ra(v.extent)?v.extent:a.nodeExtent,co(v));g={...a.defaults,...v,measured:{width:v.measured?.width,height:v.measured?.height},internals:{positionAbsolute:m,handleBounds:ID(v,g),z:H1(v,f,a.zIndexMode),userNode:v}},t.set(v.id,g)}g.measured!==void 0&&g.measured.width!==void 0&&g.measured.height!==void 0||g.hidden||(p=!1),v.parentId&&Tg(g,t,n,r,s),h||=v.selected??!1}return{nodesInitialized:p,hasSelectedNodes:h}}function LD(e,t){if(!e.parentId)return;let n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function Tg(e,t,n,r,a){let{elevateNodesOnSelect:s,nodeOrigin:l,nodeExtent:f,zIndexMode:p}=Eg($g,r),h=e.parentId,v=t.get(h);if(!v){console.warn(`Parent node ${h} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}LD(e,n),a&&!v.parentId&&v.internals.rootParentIndex===void 0&&p==="auto"&&(v.internals.rootParentIndex=++a.i,v.internals.z=v.internals.z+a.i*OD),a&&v.internals.rootParentIndex!==void 0&&(a.i=v.internals.rootParentIndex);let{x:g,y:m,z:b}=RD(e,v,l,f,s&&!_g(p)?q1:0,p),{positionAbsolute:w}=e.internals,k=g!==w.x||m!==w.y;(k||b!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:k?{x:g,y:m}:w,z:b}})}function H1(e,t,n){let r=uo(e.zIndex)?e.zIndex:0;return _g(n)?r:r+(e.selected?t:0)}function RD(e,t,n,r,a,s){let{x:l,y:f}=t.internals.positionAbsolute,p=co(e),h=fd(e,n),v=ra(e.extent)?oa(h,e.extent,p):h,g=oa({x:l+v.x,y:f+v.y},r,p);e.extent==="parent"&&(g=v1(g,p,t));let m=H1(e,a,s),b=t.internals.z??0;return{x:g.x,y:g.y,z:b>=m?b+1:m}}function Mg(e,t,n,r=[0,0]){let a=[],s=new Map;for(let l of e){let f=t.get(l.parentId);if(!f)continue;let p=x1(s.get(l.parentId)?.expandedRect??pd(f),l.rect);s.set(l.parentId,{expandedRect:p,parent:f})}return s.size>0&&s.forEach(({expandedRect:l,parent:f},p)=>{let h=f.internals.positionAbsolute,v=co(f),g=f.origin??r,m=l.x<h.x?Math.round(Math.abs(h.x-l.x)):0,b=l.y<h.y?Math.round(Math.abs(h.y-l.y)):0,w=Math.max(v.width,Math.round(l.width)),k=Math.max(v.height,Math.round(l.height)),S=(w-v.width)*g[0],N=(k-v.height)*g[1];(m>0||b>0||S||N)&&(a.push({id:p,type:"position",position:{x:f.position.x-m+S,y:f.position.y-b+N}}),n.get(p)?.forEach($=>{e.some(j=>j.id===$.id)||a.push({id:$.id,type:"position",position:{x:$.position.x+m,y:$.position.y+b}})})),(v.width<l.width||v.height<l.height||m||b)&&a.push({id:p,type:"dimensions",setAttributes:!0,dimensions:{width:w+(m?g[0]*m-S:0),height:k+(b?g[1]*b-N:0)}})}),a}function zD(e,t,n,r,a,s,l){let f=r?.querySelector(".xyflow__viewport"),p=!1;if(!f)return{changes:[],updatedInternals:p};let h=[],v=window.getComputedStyle(f),{m22:g}=new window.DOMMatrixReadOnly(v.transform),m=[];for(let b of e.values()){let w=t.get(b.id);if(!w)continue;if(w.hidden){t.set(w.id,{...w,internals:{...w.internals,handleBounds:void 0}}),p=!0;continue}let k=jg(b.nodeElement),S=w.measured.width!==k.width||w.measured.height!==k.height;if(k.width&&k.height&&(S||!w.internals.handleBounds||b.force)){let N=b.nodeElement.getBoundingClientRect(),$=ra(w.extent)?w.extent:s,{positionAbsolute:j}=w.internals;if(w.parentId&&w.extent==="parent"){let I=t.get(w.parentId);I&&(j=v1(j,k,I))}else $&&(j=oa(j,$,k));let E={...w,measured:k,internals:{...w.internals,positionAbsolute:j,handleBounds:{source:T1("source",b.nodeElement,N,g,w.id),target:T1("target",b.nodeElement,N,g,w.id)}}};t.set(w.id,E),w.parentId&&Tg(E,t,n,{nodeOrigin:a,zIndexMode:l}),p=!0,S&&(h.push({id:w.id,type:"dimensions",dimensions:k}),w.expandParent&&w.parentId&&m.push({id:w.id,parentId:w.parentId,rect:pd(E,a)}))}}if(m.length>0){let b=Mg(m,t,n,a);h.push(...b)}return{changes:h,updatedInternals:p}}async function FD({delta:e,panZoom:t,transform:n,translateExtent:r,width:a,height:s}){if(!t||!e.x&&!e.y)return!1;let l=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[a,s]],r);return!!l&&(l.x!==n[0]||l.y!==n[1]||l.k!==n[2])}function V1(e,t,n,r,a,s){let l=a,f=r.get(l)||new Map;r.set(l,f.set(n,t)),l=`${a}-${e}`;let p=r.get(l)||new Map;if(r.set(l,p.set(n,t)),s){l=`${a}-${e}-${s}`;let h=r.get(l)||new Map;r.set(l,h.set(n,t))}}function K1(e,t,n){e.clear(),t.clear();for(let r of n){let{source:a,target:s,sourceHandle:l=null,targetHandle:f=null}=r,p={edgeId:r.id,source:a,target:s,sourceHandle:l,targetHandle:f},h=`${a}-${l}--${s}-${f}`;V1("source",p,`${s}-${f}--${a}-${l}`,e,a,l),V1("target",p,h,e,s,f),t.set(r.id,r)}}function W1(e,t){if(!e.parentId)return!1;let n=t.get(e.parentId);return n?n.selected?!0:W1(n,t):!1}function U1(e,t,n){let r=e;do{if(r?.matches?.(t))return!0;if(r===n)return!1;r=r?.parentElement}while(r);return!1}function BD(e,t,n,r){let a=new Map;for(let[s,l]of e)if((l.selected||l.id===r)&&(!l.parentId||!W1(l,e))&&(l.draggable||t&&l.draggable===void 0)){let f=e.get(s);f&&a.set(s,{id:s,position:f.position||{x:0,y:0},distance:{x:n.x-f.internals.positionAbsolute.x,y:n.y-f.internals.positionAbsolute.y},extent:f.extent,parentId:f.parentId,origin:f.origin,expandParent:f.expandParent,internals:{positionAbsolute:f.internals.positionAbsolute||{x:0,y:0}},measured:{width:f.measured.width??0,height:f.measured.height??0}})}return a}function Og({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){let a=[];for(let[l,f]of t){let p=n.get(l)?.internals.userNode;p&&a.push({...p,position:f.position,dragging:r})}if(!e)return[a[0],a];let s=n.get(e)?.internals.userNode;return[s?{...s,position:t.get(e)?.position||s.position,dragging:r}:a[0],a]}function qD({dragItems:e,snapGrid:t,x:n,y:r}){let a=e.values().next().value;if(!a)return null;let s={x:n-a.distance.x,y:r-a.distance.y},l=md(s,t);return{x:l.x-s.x,y:l.y-s.y}}function HD({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:a}){let s={x:null,y:null},l=0,f=new Map,p=!1,h={x:0,y:0},v=null,g=!1,m=null,b=!1,w=!1,k=null;function S({noDragClassName:$,handleSelector:j,domNode:E,isSelectable:I,nodeId:z,nodeClickDistance:T=0}){m=Mn(E);function M({x:V,y:oe}){let{nodeLookup:F,nodeExtent:J,snapGrid:L,snapToGrid:U,nodeOrigin:W,onNodeDrag:re,onSelectionDrag:le,onError:pe,updateNodePositions:xe}=t();s={x:V,y:oe};let Ne=!1,we=f.size>1,R=we&&J?Sg(hd(f)):null,Q=we&&U?qD({dragItems:f,snapGrid:L,x:V,y:oe}):null;for(let[fe,X]of f){if(!F.has(fe))continue;let he={x:V-X.distance.x,y:oe-X.distance.y};U&&(he=Q?{x:Math.round(he.x+Q.x),y:Math.round(he.y+Q.y)}:md(he,L));let Z=null;if(we&&J&&!X.extent&&R){let{positionAbsolute:de}=X.internals,me=de.x-R.x+J[0][0],De=de.x+X.measured.width-R.x2+J[1][0],Fe=de.y-R.y+J[0][1],Ye=de.y+X.measured.height-R.y2+J[1][1];Z=[[me,Fe],[De,Ye]]}let{position:q,positionAbsolute:ee}=y1({nodeId:fe,nextPosition:he,nodeLookup:F,nodeExtent:Z||J,nodeOrigin:W,onError:pe});Ne=Ne||X.position.x!==q.x||X.position.y!==q.y,X.position=q,X.internals.positionAbsolute=ee}if(w||=Ne,Ne&&(xe(f,!0),k&&(r||re||!z&&le))){let[fe,X]=Og({nodeId:z,dragItems:f,nodeLookup:F});r?.(k,f,fe,X),re?.(k,fe,X),z||le?.(k,X)}}async function O(){if(!v)return;let{transform:V,panBy:oe,autoPanSpeed:F,autoPanOnNodeDrag:J}=t();if(!J){p=!1,cancelAnimationFrame(l);return}let[L,U]=kg(h,v,F);(L!==0||U!==0)&&(s.x=(s.x??0)-L/V[2],s.y=(s.y??0)-U/V[2],await oe({x:L,y:U})&&M(s)),l=requestAnimationFrame(O)}function K(V){let{nodeLookup:oe,multiSelectionActive:F,nodesDraggable:J,transform:L,snapGrid:U,snapToGrid:W,selectNodesOnDrag:re,onNodeDragStart:le,onSelectionDragStart:pe,unselectNodesAndEdges:xe}=t();g=!0,re&&I||F||!z||oe.get(z)?.selected||xe(),I&&re&&z&&e?.(z);let Ne=vd(V.sourceEvent,{transform:L,snapGrid:U,snapToGrid:W,containerBounds:v});if(s=Ne,f=BD(oe,J,Ne,z),f.size>0&&(n||le||!z&&pe)){let[we,R]=Og({nodeId:z,dragItems:f,nodeLookup:oe});n?.(V.sourceEvent,f,we,R),le?.(V.sourceEvent,we,R),z||pe?.(V.sourceEvent,R)}}let B=Lk().clickDistance(T).on("start",V=>{let{domNode:oe,nodeDragThreshold:F,transform:J,snapGrid:L,snapToGrid:U}=t();v=oe?.getBoundingClientRect()||null,b=!1,w=!1,k=V.sourceEvent,F===0&&K(V),s=vd(V.sourceEvent,{transform:J,snapGrid:L,snapToGrid:U,containerBounds:v}),h=fo(V.sourceEvent,v)}).on("drag",V=>{let{autoPanOnNodeDrag:oe,transform:F,snapGrid:J,snapToGrid:L,nodeDragThreshold:U,nodeLookup:W}=t(),re=vd(V.sourceEvent,{transform:F,snapGrid:J,snapToGrid:L,containerBounds:v});if(k=V.sourceEvent,(V.sourceEvent.type==="touchmove"&&V.sourceEvent.touches.length>1||z&&!W.has(z))&&(b=!0),!b){if(!p&&oe&&g&&(p=!0,O()),!g){let le=fo(V.sourceEvent,v),pe=le.x-h.x,xe=le.y-h.y;Math.sqrt(pe*pe+xe*xe)>U&&K(V)}(s.x!==re.xSnapped||s.y!==re.ySnapped)&&f&&g&&(h=fo(V.sourceEvent,v),M(re))}}).on("end",V=>{if(!g||b)b&&f.size>0&&t().updateNodePositions(f,!1);else if(p=!1,g=!1,cancelAnimationFrame(l),f.size>0){let{nodeLookup:oe,updateNodePositions:F,onNodeDragStop:J,onSelectionDragStop:L}=t();if(w&&=(F(f,!1),!1),a||J||!z&&L){let[U,W]=Og({nodeId:z,dragItems:f,nodeLookup:oe,dragging:!1});a?.(V.sourceEvent,f,U,W),J?.(V.sourceEvent,U,W),z||L?.(V.sourceEvent,W)}}}).filter(V=>{let oe=V.target;return!V.button&&(!$||!U1(oe,`.${$}`,E))&&(!j||U1(oe,j,E))});m.call(B)}function N(){m?.on(".drag",null)}return{update:S,destroy:N}}function VD(e,t,n){let r=[],a={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(let s of t.values())rf(a,pd(s))>0&&r.push(s);return r}var KD=250;function WD(e,t,n,r){let a=[],s=1/0,l=VD(e,n,t+KD);for(let f of l){let p=[...f.internals.handleBounds?.source??[],...f.internals.handleBounds?.target??[]];for(let h of p){if(r.nodeId===h.nodeId&&r.type===h.type&&r.id===h.id)continue;let{x:v,y:g}=ia(f,h,h.position,!0),m=Math.sqrt((v-e.x)**2+(g-e.y)**2);m>t||(m<s?(a=[{...h,x:v,y:g}],s=m):m===s&&a.push({...h,x:v,y:g}))}}if(!a.length)return null;if(a.length>1){let f=r.type==="source"?"target":"source";return a.find(p=>p.type===f)??a[0]}return a[0]}function Y1(e,t,n,r,a,s=!1){let l=r.get(e);if(!l)return null;let f=a==="strict"?l.internals.handleBounds?.[t]:[...l.internals.handleBounds?.source??[],...l.internals.handleBounds?.target??[]],p=(n?f?.find(h=>h.id===n):f?.[0])??null;return p&&s?{...p,...ia(l,p,p.position,!0)}:p}function X1(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function UD(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}var Z1=()=>!0;function YD(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:a,edgeUpdaterType:s,isTarget:l,domNode:f,nodeLookup:p,lib:h,autoPanOnConnect:v,flowId:g,panBy:m,cancelConnection:b,onConnectStart:w,onConnect:k,onConnectEnd:S,isValidConnection:N=Z1,onReconnectEnd:$,updateConnection:j,getTransform:E,getFromHandle:I,autoPanSpeed:z,dragThreshold:T=1,handleDomNode:M}){let O=E1(e.target),K=0,B,{x:V,y:oe}=fo(e),F=X1(s,M),J=f?.getBoundingClientRect(),L=!1;if(!J||!F)return;let U=Y1(a,F,r,p,t);if(!U)return;let W=fo(e,J),re=!1,le=null,pe=!1,xe=null;function Ne(){if(!v||!J)return;let[Z,q]=kg(W,J,z);m({x:Z,y:q}),K=requestAnimationFrame(Ne)}let we={...U,nodeId:a,type:F,position:U.position},R=p.get(a),Q={inProgress:!0,isValid:null,from:ia(R,we,Ce.Left,!0),fromHandle:we,fromPosition:we.position,fromNode:R,to:W,toHandle:null,toPosition:m1[we.position],toNode:null,pointer:W};function fe(){L=!0,j(Q),w?.(e,{nodeId:a,handleId:r,handleType:F})}T===0&&fe();function X(Z){if(!L){let{x:Fe,y:Ye}=fo(Z),Le=Fe-V,Be=Ye-oe;if(!(Le*Le+Be*Be>T*T))return;fe()}if(!I()||!we){he(Z);return}let q=E();W=fo(Z,J),B=WD(gd(W,q,!1,[1,1]),n,p,we),re||=(Ne(),!0);let ee=G1(Z,{handle:B,connectionMode:t,fromNodeId:a,fromHandleId:r,fromType:l?"target":"source",isValidConnection:N,doc:O,lib:h,flowId:g,nodeLookup:p});xe=ee.handleDomNode,le=ee.connection,pe=UD(!!B,ee.isValid);let de=p.get(a),me=de?ia(de,we,Ce.Left,!0):Q.from,De={...Q,from:me,isValid:pe,to:ee.toHandle&&pe?Cs({x:ee.toHandle.x,y:ee.toHandle.y},q):W,toHandle:ee.toHandle,toPosition:pe&&ee.toHandle?ee.toHandle.position:m1[we.position],toNode:ee.toHandle?p.get(ee.toHandle.nodeId):null,pointer:W};j(De),Q=De}function he(Z){if(!("touches"in Z&&Z.touches.length>0)){if(L){(B||xe)&&le&&pe&&k?.(le);let{inProgress:q,...ee}=Q,de={...ee,toPosition:Q.toHandle?Q.toPosition:null};S?.(Z,de),s&&$?.(Z,de)}b(),cancelAnimationFrame(K),re=!1,pe=!1,le=null,xe=null,O.removeEventListener("mousemove",X),O.removeEventListener("mouseup",he),O.removeEventListener("touchmove",X),O.removeEventListener("touchend",he)}}O.addEventListener("mousemove",X),O.addEventListener("mouseup",he),O.addEventListener("touchmove",X),O.addEventListener("touchend",he)}function G1(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:a,fromType:s,doc:l,lib:f,flowId:p,isValidConnection:h=Z1,nodeLookup:v}){let g=s==="target",m=t?l.querySelector(`.${f}-flow__handle[data-id="${p}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:b,y:w}=fo(e),k=l.elementFromPoint(b,w),S=k?.classList.contains(`${f}-flow__handle`)?k:m,N={handleDomNode:S,isValid:!1,connection:null,toHandle:null};if(S){let $=X1(void 0,S),j=S.getAttribute("data-nodeid"),E=S.getAttribute("data-handleid"),I=S.classList.contains("connectable"),z=S.classList.contains("connectableend");if(!j||!$)return N;let T={source:g?j:r,sourceHandle:g?E:a,target:g?r:j,targetHandle:g?a:E};N.connection=T,N.isValid=I&&z&&(n===cd.Strict?g&&$==="source"||!g&&$==="target":j!==r||E!==a)&&h(T),N.toHandle=Y1(j,$,E,v,n,!0)}return N}var Pg={onPointerDown:YD,isValid:G1};function XD({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){let a=Mn(e);function s({translateExtent:f,width:p,height:h,zoomStep:v=1,pannable:g=!0,zoomable:m=!0,inversePan:b=!1}){let w=N=>{if(N.sourceEvent.type!=="wheel"||!t)return;let $=n(),j=N.sourceEvent.ctrlKey&&yd()?10:1,E=-N.sourceEvent.deltaY*(N.sourceEvent.deltaMode===1?.05:N.sourceEvent.deltaMode?1:.002)*v,I=$[2]*2**(E*j);t.scaleTo(I)},k=[0,0],S=c1().on("start",N=>{(N.sourceEvent.type==="mousedown"||N.sourceEvent.type==="touchstart")&&(k=[N.sourceEvent.clientX??N.sourceEvent.touches[0].clientX,N.sourceEvent.clientY??N.sourceEvent.touches[0].clientY])}).on("zoom",g?N=>{let $=n();if(N.sourceEvent.type!=="mousemove"&&N.sourceEvent.type!=="touchmove"||!t)return;let j=[N.sourceEvent.clientX??N.sourceEvent.touches[0].clientX,N.sourceEvent.clientY??N.sourceEvent.touches[0].clientY],E=[j[0]-k[0],j[1]-k[1]];k=j;let I=r()*Math.max($[2],Math.log($[2]))*(b?-1:1),z={x:$[0]-E[0]*I,y:$[1]-E[1]*I},T=[[0,0],[p,h]];t.setViewportConstrained({x:z.x,y:z.y,zoom:$[2]},T,f)}:null).on("zoom.wheel",m?w:null);a.call(S,{})}function l(){a.on("zoom",null)}return{update:s,destroy:l,pointer:ao}}var lf=e=>({x:e.x,y:e.y,zoom:e.k}),Dg=({x:e,y:t,zoom:n})=>Qc.translate(e,t).scale(n),ui=(e,t)=>e.target.closest(`.${t}`),Q1=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),ZD=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Ig=(e,t=0,n=ZD,r=()=>{})=>{let a=typeof t=="number"&&t>0;return a||r(),a?e.transition().duration(t).ease(n).on("end",r):e},J1=e=>{let t=e.ctrlKey&&yd()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function GD({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:a,panOnScrollSpeed:s,zoomOnPinch:l,onPanZoomStart:f,onPanZoom:p,onPanZoomEnd:h}){return v=>{if(ui(v,t))return v.ctrlKey&&v.preventDefault(),!1;v.preventDefault(),v.stopImmediatePropagation();let g=n.property("__zoom").k||1;if(v.ctrlKey&&l){let S=ao(v),N=g*2**J1(v);r.scaleTo(n,N,S,v);return}let m=v.deltaMode===1?20:1,b=a===Ns.Vertical?0:v.deltaX*m,w=a===Ns.Horizontal?0:v.deltaY*m;!yd()&&v.shiftKey&&a!==Ns.Vertical&&(b=v.deltaY*m,w=0),r.translateBy(n,-(b/g)*s,-(w/g)*s,{internal:!0});let k=lf(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?p?.(v,k):(e.isPanScrolling=!0,f?.(v,k)),e.panScrollTimeout=setTimeout(()=>{h?.(v,k),e.isPanScrolling=!1},150)}}function QD({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,a){let s=r.type==="wheel",l=!t&&s&&!r.ctrlKey,f=ui(r,e);if(r.ctrlKey&&s&&f&&r.preventDefault(),l||f)return null;r.preventDefault(),n.call(this,r,a)}}function JD({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{if(r.sourceEvent?.internal)return;let a=lf(r.transform);e.mouseButton=r.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=a,r.sourceEvent?.type==="mousedown"&&t(!0),n&&n?.(r.sourceEvent,a)}}function eI({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:a}){return s=>{e.usedRightMouseButton=!!(n&&Q1(t,e.mouseButton??0)),s.sourceEvent?.sync||r([s.transform.x,s.transform.y,s.transform.k]),a&&!s.sourceEvent?.internal&&a?.(s.sourceEvent,lf(s.transform))}}function tI({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:a,onPaneContextMenu:s}){return l=>{if(!l.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,s&&Q1(t,e.mouseButton??0)&&!e.usedRightMouseButton&&l.sourceEvent&&s(l.sourceEvent),e.usedRightMouseButton=!1,r(!1),a)){let f=lf(l.transform);e.prevViewport=f,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{a?.(l.sourceEvent,f)},n?150:0)}}}function nI({panActivationKeyPressed:e,zoomActivationKeyPressed:t,zoomOnScroll:n,zoomOnPinch:r,panOnDrag:a,panOnScroll:s,zoomOnDoubleClick:l,userSelectionActive:f,noWheelClassName:p,noPanClassName:h,lib:v,connectionInProgress:g}){return m=>{let b=t||n,w=r&&m.ctrlKey,k=m.type==="wheel";if(m.button===1&&m.type==="mousedown"&&(ui(m,`${v}-flow__node`)||ui(m,`${v}-flow__edge`)||ui(m,`${v}-flow__selection`)||ui(m,`${v}-flow__nodesselection`)))return!0;if(!a&&!b&&!s&&!l&&!r||f||g&&!k||ui(m,p)&&k||ui(m,h)&&(!k||s&&k&&!t)||!r&&m.ctrlKey&&k)return!1;if(!r&&m.type==="touchstart"&&m.touches?.length>1)return m.preventDefault(),!1;if(!b&&!s&&!w&&k||!a&&(m.type==="mousedown"||m.type==="touchstart")||Array.isArray(a)&&!a.includes(m.button)&&m.type==="mousedown")return!1;let S=Array.isArray(a)&&a.includes(m.button)||!m.button||m.button<=1;return(!m.ctrlKey||k||e)&&S}}function oI({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:a,onPanZoom:s,onPanZoomStart:l,onPanZoomEnd:f,onDraggingChange:p}){let h={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},v=e.getBoundingClientRect(),g=[[0,0],[v.width,v.height]];(typeof ResizeObserver<"u"?new ResizeObserver(V=>{let oe=V[0];oe&&(g=[[0,0],[oe.contentRect.width,oe.contentRect.height]])}):null)?.observe(e);let m=c1().extent(()=>g).scaleExtent([t,n]).translateExtent(r),b=Mn(e).call(m);j({x:a.x,y:a.y,zoom:js(a.zoom,t,n)},[[0,0],[v.width,v.height]],r);let w=b.on("wheel.zoom"),k=b.on("dblclick.zoom");m.wheelDelta(J1);async function S(V,oe){return b?new Promise(F=>{m?.interpolate(oe?.interpolate==="linear"?ad:Hc).transform(Ig(b,oe?.duration,oe?.ease,()=>F(!0)),V)}):!1}function N({noWheelClassName:V,noPanClassName:oe,onPaneContextMenu:F,userSelectionActive:J,panOnScroll:L,panOnDrag:U,panOnScrollMode:W,panOnScrollSpeed:re,preventScrolling:le,zoomOnPinch:pe,zoomOnScroll:xe,zoomOnDoubleClick:Ne,panActivationKeyPressed:we=!1,zoomActivationKeyPressed:R,lib:Q,onTransformChange:fe,connectionInProgress:X,paneClickDistance:he,selectionOnDrag:Z}){J&&!h.isZoomingOrPanning&&$();let q=L&&!R&&!J;m.clickDistance(Z?1/0:!uo(he)||he<0?0:he);let ee=q?GD({zoomPanValues:h,noWheelClassName:V,d3Selection:b,d3Zoom:m,panOnScrollMode:W,panOnScrollSpeed:re,zoomOnPinch:pe,onPanZoomStart:l,onPanZoom:s,onPanZoomEnd:f}):QD({noWheelClassName:V,preventScrolling:le,d3ZoomHandler:w});b.on("wheel.zoom",ee,{passive:!1});let de=JD({zoomPanValues:h,onDraggingChange:p,onPanZoomStart:l});m.on("start",de);let me=eI({zoomPanValues:h,panOnDrag:U,onPaneContextMenu:!!F,onPanZoom:s,onTransformChange:fe});m.on("zoom",me);let De=tI({zoomPanValues:h,panOnDrag:U,panOnScroll:L,onPaneContextMenu:F,onPanZoomEnd:f,onDraggingChange:p});m.on("end",De);let Fe=nI({panActivationKeyPressed:we,zoomActivationKeyPressed:R,panOnDrag:U,zoomOnScroll:xe,panOnScroll:L,zoomOnDoubleClick:Ne,zoomOnPinch:pe,userSelectionActive:J,noPanClassName:oe,noWheelClassName:V,lib:Q,connectionInProgress:X});m.filter(Fe),Ne?b.on("dblclick.zoom",k):b.on("dblclick.zoom",null)}function $(){m.on("zoom",null)}async function j(V,oe,F){let J=Dg(V),L=m?.constrain()(J,oe,F);return L&&await S(L),L}async function E(V,oe){let F=Dg(V);return await S(F,oe),F}function I(V){if(b){let oe=Dg(V),F=b.property("__zoom");(F.k!==V.zoom||F.x!==V.x||F.y!==V.y)&&m?.transform(b,oe,null,{sync:!0})}}function z(){let V=b?d1(b.node()):{x:0,y:0,k:1};return{x:V.x,y:V.y,zoom:V.k}}async function T(V,oe){return b?new Promise(F=>{m?.interpolate(oe?.interpolate==="linear"?ad:Hc).scaleTo(Ig(b,oe?.duration,oe?.ease,()=>F(!0)),V)}):!1}async function M(V,oe){return b?new Promise(F=>{m?.interpolate(oe?.interpolate==="linear"?ad:Hc).scaleBy(Ig(b,oe?.duration,oe?.ease,()=>F(!0)),V)}):!1}function O(V){m?.scaleExtent(V)}function K(V){m?.translateExtent(V)}function B(V){let oe=!uo(V)||V<0?0:V;m?.clickDistance(oe)}return{update:N,destroy:$,setViewport:E,setViewportConstrained:j,getViewport:z,scaleTo:T,scaleBy:M,setScaleExtent:O,setTranslateExtent:K,syncViewport:I,setClickDistance:B}}var Es;(function(e){e.Line="line",e.Handle="handle"})(Es||={});var rI=["top-left","top-right","bottom-left","bottom-right"],iI=["top","right","bottom","left"];function aI({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:a,affectsY:s}){let l=e-t,f=n-r,p=[l>0?1:l<0?-1:0,f>0?1:f<0?-1:0];return l&&a&&(p[0]*=-1),f&&s&&(p[1]*=-1),p}function eS(e){return{isHorizontal:e.includes("right")||e.includes("left"),isVertical:e.includes("bottom")||e.includes("top"),affectsX:e.includes("left"),affectsY:e.includes("top")}}function ci(e,t){return Math.max(0,t-e)}function fi(e,t){return Math.max(0,e-t)}function df(e,t,n){return Math.max(0,t-e,e-n)}function tS(e,t){return e?!t:t}function sI(e,t,n,r,a,s,l,f){let{affectsX:p,affectsY:h}=t,{isHorizontal:v,isVertical:g}=t,m=v&&g,{xSnapped:b,ySnapped:w}=n,{minWidth:k,maxWidth:S,minHeight:N,maxHeight:$}=r,{x:j,y:E,width:I,height:z,aspectRatio:T}=e,M=Math.floor(v?b-e.pointerX:0),O=Math.floor(g?w-e.pointerY:0),K=I+(p?-M:M),B=z+(h?-O:O),V=-s[0]*I,oe=-s[1]*z,F=df(K,k,S),J=df(B,N,$);if(l){let W=0,re=0;p&&M<0?W=ci(j+M+V,l[0][0]):!p&&M>0&&(W=fi(j+K+V,l[1][0])),h&&O<0?re=ci(E+O+oe,l[0][1]):!h&&O>0&&(re=fi(E+B+oe,l[1][1])),F=Math.max(F,W),J=Math.max(J,re)}if(f){let W=0,re=0;p&&M>0?W=fi(j+M,f[0][0]):!p&&M<0&&(W=ci(j+K,f[1][0])),h&&O>0?re=fi(E+O,f[0][1]):!h&&O<0&&(re=ci(E+B,f[1][1])),F=Math.max(F,W),J=Math.max(J,re)}if(a){if(v){let W=df(K/T,N,$)*T;if(F=Math.max(F,W),l){let re=0;re=!p&&!h||p&&!h&&m?fi(E+oe+K/T,l[1][1])*T:ci(E+oe+(p?M:-M)/T,l[0][1])*T,F=Math.max(F,re)}if(f){let re=0;re=!p&&!h||p&&!h&&m?ci(E+K/T,f[1][1])*T:fi(E+(p?M:-M)/T,f[0][1])*T,F=Math.max(F,re)}}if(g){let W=df(B*T,k,S)/T;if(J=Math.max(J,W),l){let re=0;re=!p&&!h||h&&!p&&m?fi(j+B*T+V,l[1][0])/T:ci(j+(h?O:-O)*T+V,l[0][0])/T,J=Math.max(J,re)}if(f){let re=0;re=!p&&!h||h&&!p&&m?ci(j+B*T,f[1][0])/T:fi(j+(h?O:-O)*T,f[0][0])/T,J=Math.max(J,re)}}}O+=O<0?J:-J,M+=M<0?F:-F,a&&(m?K>B*T?O=(tS(p,h)?-M:M)/T:M=(tS(p,h)?-O:O)*T:v?(O=M/T,h=p):(M=O*T,p=h));let L=p?j+M:j,U=h?E+O:E;return{width:I+(p?-M:M),height:z+(h?-O:O),x:s[0]*M*(p?-1:1)+L,y:s[1]*O*(h?-1:1)+U}}var nS={width:0,height:0,x:0,y:0},lI={...nS,pointerX:0,pointerY:0,aspectRatio:1};function dI(e,t,n){let r=t.position.x+e.position.x,a=t.position.y+e.position.y,s=e.measured.width??0,l=e.measured.height??0,f=n[0]*s,p=n[1]*l;return[[r-f,a-p],[r+s-f,a+l-p]]}function uI({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:a}){let s=Mn(e),l={controlDirection:eS("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function f({controlPosition:h,boundaries:v,keepAspectRatio:g,resizeDirection:m,onResizeStart:b,onResize:w,onResizeEnd:k,shouldResize:S}){let N={...nS},$={...lI};l={boundaries:v,resizeDirection:m,keepAspectRatio:g,controlDirection:eS(h)};let j,E=null,I=[],z,T,M,O=Lk().on("start",K=>{let{nodeLookup:B,transform:V,snapGrid:oe,snapToGrid:F,nodeOrigin:J,paneDomNode:L}=n();if(j=B.get(t),!j)return;E=L?.getBoundingClientRect()??null;let{xSnapped:U,ySnapped:W}=vd(K.sourceEvent,{transform:V,snapGrid:oe,snapToGrid:F,containerBounds:E});N={width:j.measured.width??0,height:j.measured.height??0,x:j.position.x??0,y:j.position.y??0},$={...N,pointerX:U,pointerY:W,aspectRatio:N.width/N.height},z=void 0,T=ra(j.extent)?j.extent:void 0,j.parentId&&(j.extent==="parent"||j.expandParent)&&(z=B.get(j.parentId)),z&&j.extent==="parent"&&(T=[[0,0],[z.measured.width,z.measured.height]]),I=[],M=void 0;for(let[re,le]of B)if(le.parentId===t&&(I.push({id:re,position:{...le.position},extent:le.extent}),le.extent==="parent"||le.expandParent)){let pe=dI(le,j,le.origin??J);M=M?[[Math.min(pe[0][0],M[0][0]),Math.min(pe[0][1],M[0][1])],[Math.max(pe[1][0],M[1][0]),Math.max(pe[1][1],M[1][1])]]:pe}b?.(K,{...N})}).on("drag",K=>{let{transform:B,snapGrid:V,snapToGrid:oe,nodeOrigin:F}=n(),J=vd(K.sourceEvent,{transform:B,snapGrid:V,snapToGrid:oe,containerBounds:E}),L=[];if(!j)return;let{x:U,y:W,width:re,height:le}=N,pe={},xe=j.origin??F,{width:Ne,height:we,x:R,y:Q}=sI($,l.controlDirection,J,l.boundaries,l.keepAspectRatio,xe,T,M),fe=Ne!==re,X=we!==le,he=R!==U&&fe,Z=Q!==W&&X;if(!he&&!Z&&!fe&&!X)return;let q={prevValues:{...N},startX:$.x,startY:$.y,childNodes:I.map(me=>({...me,position:{...me.position}}))};if((he||Z||xe[0]===1||xe[1]===1)&&(pe.x=he?R:N.x,pe.y=Z?Q:N.y,N.x=pe.x,N.y=pe.y,I.length>0)){let me=R-U,De=Q-W;for(let Fe of I)Fe.position={x:Fe.position.x-me+xe[0]*(Ne-re),y:Fe.position.y-De+xe[1]*(we-le)},L.push(Fe)}if((fe||X)&&(pe.width=fe&&(!l.resizeDirection||l.resizeDirection==="horizontal")?Ne:N.width,pe.height=X&&(!l.resizeDirection||l.resizeDirection==="vertical")?we:N.height,N.width=pe.width,N.height=pe.height),z&&j.expandParent){let me=xe[0]*(pe.width??0);pe.x&&pe.x<me&&(N.x=me,$.x-=pe.x-me);let De=xe[1]*(pe.height??0);pe.y&&pe.y<De&&(N.y=De,$.y-=pe.y-De)}let ee=aI({width:N.width,prevWidth:re,height:N.height,prevHeight:le,affectsX:l.controlDirection.affectsX,affectsY:l.controlDirection.affectsY}),de={...N,direction:ee};S?.(K,de)===!1?(N=q.prevValues,$.x=q.startX,$.y=q.startY,I.forEach((me,De)=>{me.position=q.childNodes[De].position})):(w?.(K,de),r(pe,L))}).on("end",K=>{k?.(K,{...N}),a?.({...N})});s.call(O)}function p(){s.on(".drag",null)}return{update:f,destroy:p}}var cI=wn((e=>{var t=ed();function n(m,b){return m===b&&(m!==0||1/m==1/b)||m!==m&&b!==b}var r=typeof Object.is=="function"?Object.is:n,a=t.useState,s=t.useEffect,l=t.useLayoutEffect,f=t.useDebugValue;function p(m,b){var w=b(),k=a({inst:{value:w,getSnapshot:b}}),S=k[0].inst,N=k[1];return l(function(){S.value=w,S.getSnapshot=b,h(S)&&N({inst:S})},[m,w,b]),s(function(){return h(S)&&N({inst:S}),m(function(){h(S)&&N({inst:S})})},[m]),f(w),w}function h(m){var b=m.getSnapshot;m=m.value;try{var w=b();return!r(m,w)}catch{return!0}}function v(m,b){return b()}var g=typeof window>"u"||window.document===void 0||window.document.createElement===void 0?v:p;e.useSyncExternalStore=t.useSyncExternalStore===void 0?g:t.useSyncExternalStore})),fI=wn(((e,t)=>{t.exports=cI()})),hI=wn((e=>{var t=ed(),n=fI();function r(v,g){return v===g&&(v!==0||1/v==1/g)||v!==v&&g!==g}var a=typeof Object.is=="function"?Object.is:r,s=n.useSyncExternalStore,l=t.useRef,f=t.useEffect,p=t.useMemo,h=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(v,g,m,b,w){var k=l(null);if(k.current===null){var S={hasValue:!1,value:null};k.current=S}else S=k.current;k=p(function(){function $(T){if(!j){if(j=!0,E=T,T=b(T),w!==void 0&&S.hasValue){var M=S.value;if(w(M,T))return I=M}return I=T}if(M=I,a(E,T))return M;var O=b(T);return w!==void 0&&w(M,O)?(E=T,M):(E=T,I=O)}var j=!1,E,I,z=m===void 0?null:m;return[function(){return $(g())},z===null?void 0:function(){return $(z())}]},[g,m,b,w]);var N=s(v,k[0],k[1]);return f(function(){S.hasValue=!0,S.value=N},[N]),h(N),N}})),pI=bk(wn(((e,t)=>{t.exports=hI()}))(),1),oS=e=>{let t,n=new Set,r=(f,p)=>{let h=typeof f=="function"?f(t):f;if(!Object.is(h,t)){let v=t;t=p??(typeof h!="object"||!h)?h:Object.assign({},t,h),n.forEach(g=>g(t,v))}},a=()=>t,s={setState:r,getState:a,getInitialState:()=>l,subscribe:f=>(n.add(f),()=>n.delete(f)),destroy:()=>{n.clear()}},l=t=e(r,a,s);return s},mI=e=>e?oS(e):oS,{useDebugValue:gI}=A.default,{useSyncExternalStoreWithSelector:yI}=pI.default,vI=e=>e;function rS(e,t=vI,n){let r=yI(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return gI(r),r}var iS=(e,t)=>{let n=mI(e),r=(a,s=t)=>rS(n,a,s);return Object.assign(r,n),r},bI=(e,t)=>e?iS(e,t):iS;function yt(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||!e||typeof t!="object"||!t)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(let[r,a]of e)if(!Object.is(a,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let r of e)if(!t.has(r))return!1;return!0}let n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}var Lg=xk(),uf=(0,A.createContext)(null),xI=uf.Provider,aS=Wn.error001("react");function Ke(e,t){let n=(0,A.useContext)(uf);if(n===null)throw Error(aS);return rS(n,e,t)}function pt(){let e=(0,A.useContext)(uf);if(e===null)throw Error(aS);return(0,A.useMemo)(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}var sS={display:"none"},wI={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},lS="react-flow__node-desc",dS="react-flow__edge-desc",kI="react-flow__aria-live",SI=e=>e.ariaLiveMessage,NI=e=>e.ariaLabelConfig;function jI({rfId:e}){let t=Ke(SI);return(0,c.jsx)("div",{id:`${kI}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:wI,children:t})}function CI({rfId:e,disableKeyboardA11y:t}){let n=Ke(NI);return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("div",{id:`${lS}-${e}`,style:sS,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),(0,c.jsx)("div",{id:`${dS}-${e}`,style:sS,children:n["edge.a11yDescription.default"]}),!t&&(0,c.jsx)(jI,{rfId:e})]})}var _s=(0,A.forwardRef)(({position:e="top-left",children:t,className:n,style:r,...a},s)=>{let l=`${e}`.split("-");return(0,c.jsx)("div",{className:Dt(["react-flow__panel",n,...l]),style:r,ref:s,...a,children:t})});_s.displayName="Panel";var uS="https://reactflow.dev?utm_source=attribution";function $I({proOptions:e,position:t="bottom-right"}){return(0,A.useEffect)(()=>{},[]),e?.hideAttribution?null:(0,c.jsx)(_s,{position:t,className:"react-flow__attribution","data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: ${uS}`,children:(0,c.jsx)("a",{href:uS,target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}var EI=e=>{let t=[],n=[];for(let[,r]of e.nodeLookup)r.selected&&t.push(r.internals.userNode);for(let[,r]of e.edgeLookup)r.selected&&n.push(r);return{selectedNodes:t,selectedEdges:n}},cf=e=>e.id;function _I(e,t){return yt(e.selectedNodes.map(cf),t.selectedNodes.map(cf))&&yt(e.selectedEdges.map(cf),t.selectedEdges.map(cf))}function AI({onSelectionChange:e}){let t=pt(),{selectedNodes:n,selectedEdges:r}=Ke(EI,_I);return(0,A.useEffect)(()=>{let a={nodes:n,edges:r};e?.(a),t.getState().onSelectionChangeHandlers.forEach(s=>s(a))},[n,r,e]),null}var TI=e=>!!e.onSelectionChangeHandlers;function MI({onSelectionChange:e}){let t=Ke(TI);return e||t?(0,c.jsx)(AI,{onSelectionChange:e}):null}var cS=[0,0],OI={x:0,y:0,zoom:1},fS=[..."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".split("."),"rfId"],PI=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}),hS={translateExtent:ud,nodeOrigin:cS,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function DI(e){let{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:a,setTranslateExtent:s,setNodeExtent:l,reset:f,setDefaultNodesAndEdges:p}=Ke(PI,yt),h=pt();(0,A.useEffect)(()=>(p(e.defaultNodes,e.defaultEdges),()=>{v.current=hS,f()}),[]);let v=(0,A.useRef)(hS);return(0,A.useEffect)(()=>{for(let g of fS){let m=e[g];m!==v.current[g]&&e[g]!==void 0&&(g==="nodes"?t(m):g==="edges"?n(m):g==="minZoom"?r(m):g==="maxZoom"?a(m):g==="translateExtent"?s(m):g==="nodeExtent"?l(m):g==="ariaLabelConfig"?h.setState({ariaLabelConfig:wD(m)}):g==="fitView"?h.setState({fitViewQueued:m}):g==="fitViewOptions"?h.setState({fitViewOptions:m}):h.setState({[g]:m}))}v.current=e},fS.map(g=>e[g])),null}function pS(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function II(e){let[t,n]=(0,A.useState)(e==="system"?null:e);return(0,A.useEffect)(()=>{if(e!=="system"){n(e);return}let r=pS(),a=()=>n(r?.matches?"dark":"light");return a(),r?.addEventListener("change",a),()=>{r?.removeEventListener("change",a)}},[e]),t===null?pS()?.matches?"dark":"light":t}var mS=typeof document<"u"?document:null;function bd(e=null,t={target:mS,actInsideInputWithModifier:!0}){let[n,r]=(0,A.useState)(!1),a=(0,A.useRef)(!1),s=(0,A.useRef)(new Set([])),[l,f]=(0,A.useMemo)(()=>{if(e!==null){let p=(Array.isArray(e)?e:[e]).filter(h=>typeof h=="string").map(h=>h.replace(/\+/g,`
|
|
10
|
+
`).replace(`
|
|
11
|
+
|
|
12
|
+
`,`
|
|
13
|
+
+`).split(`
|
|
14
|
+
`));return[p,p.reduce((h,v)=>h.concat(...v),[])]}return[[],[]]},[e]);return(0,A.useEffect)(()=>{let p=t?.target??mS,h=t?.actInsideInputWithModifier??!0;if(e!==null){let v=b=>{if(a.current=b.ctrlKey||b.metaKey||b.shiftKey||b.altKey,(!a.current||a.current&&!h)&&_1(b))return!1;let w=yS(b.code,f);if(s.current.add(b[w]),gS(l,s.current,!1)){let k=b.composedPath?.()?.[0]||b.target,S=k?.nodeName==="BUTTON"||k?.nodeName==="A";t.preventDefault!==!1&&(a.current||!S)&&b.preventDefault(),r(!0)}},g=b=>{let w=yS(b.code,f);gS(l,s.current,!0)?(r(!1),s.current.clear()):s.current.delete(b[w]),b.key==="Meta"&&s.current.clear(),a.current=!1},m=()=>{s.current.clear(),r(!1)};return p?.addEventListener("keydown",v),p?.addEventListener("keyup",g),window.addEventListener("blur",m),window.addEventListener("contextmenu",m),()=>{p?.removeEventListener("keydown",v),p?.removeEventListener("keyup",g),window.removeEventListener("blur",m),window.removeEventListener("contextmenu",m)}}},[e,r]),n}function gS(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(a=>t.has(a)))}function yS(e,t){return t.includes(e)?"code":"key"}var LI=()=>{let e=pt();return(0,A.useMemo)(()=>({zoomIn:async t=>{let{panZoom:n}=e.getState();return n?n.scaleBy(1.2,t):!1},zoomOut:async t=>{let{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,t):!1},zoomTo:async(t,n)=>{let{panZoom:r}=e.getState();return r?r.scaleTo(t,n):!1},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{let{transform:[r,a,s],panZoom:l}=e.getState();return l?(await l.setViewport({x:t.x??r,y:t.y??a,zoom:t.zoom??s},n),!0):!1},getViewport:()=>{let[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)=>{let{width:r,height:a,minZoom:s,maxZoom:l,panZoom:f}=e.getState(),p=Ng(t,r,a,s,l,n?.padding??.1);return f?(await f.setViewport(p,{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),!0):!1},screenToFlowPosition:(t,n={})=>{let{transform:r,snapGrid:a,snapToGrid:s,domNode:l}=e.getState();if(!l)return t;let{x:f,y:p}=l.getBoundingClientRect(),h={x:t.x-f,y:t.y-p},v=n.snapGrid??a;return gd(h,r,n.snapToGrid??s,v)},flowToScreenPosition:t=>{let{transform:n,domNode:r}=e.getState();if(!r)return t;let{x:a,y:s}=r.getBoundingClientRect(),l=Cs(t,n);return{x:l.x+a,y:l.y+s}}}),[])};function vS(e,t){let n=[],r=new Map,a=[];for(let s of e)if(s.type==="add"){a.push(s);continue}else if(s.type==="remove"||s.type==="replace")r.set(s.id,[s]);else{let l=r.get(s.id);l?l.push(s):r.set(s.id,[s])}for(let s of t){let l=r.get(s.id);if(!l){n.push(s);continue}if(l[0].type==="remove")continue;if(l[0].type==="replace"){n.push({...l[0].item});continue}let f={...s};for(let p of l)RI(p,f);n.push(f)}return a.length&&a.forEach(s=>{s.index===void 0?n.push({...s.item}):n.splice(s.index,0,{...s.item})}),n}function RI(e,t){switch(e.type){case"select":t.selected=e.selected;break;case"position":e.position!==void 0&&(t.position=e.position),e.dragging!==void 0&&(t.dragging=e.dragging);break;case"dimensions":e.dimensions!==void 0&&(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)}}function Rg(e,t){return vS(e,t)}function zI(e,t){return vS(e,t)}function aa(e,t){return{id:e,type:"select",selected:t}}function As(e,t=new Set,n=!1){let r=[];for(let[a,s]of e){let l=t.has(a);(s.selected!==void 0||l)&&s.selected!==l&&(n&&(s.selected=l),r.push(aa(s.id,l)))}return r}function bS({items:e=[],lookup:t}){let n=[],r=new Map(e.map(a=>[a.id,a]));for(let[a,s]of e.entries()){let l=t.get(s.id),f=l?.internals?.userNode??l;f!==void 0&&f!==s&&n.push({id:s.id,item:s,type:"replace"}),f===void 0&&n.push({item:s,type:"add",index:a})}for(let[a]of t)r.get(a)===void 0&&n.push({id:a,type:"remove"});return n}function xS(e){return{id:e.id,type:"remove"}}var FI=S1("React Flow","https://reactflow.dev/");function BI(e,t,n={}){return $D(e,t,{...n,onError:n.onError??FI})}var wS=e=>hD(e),qI=e=>g1(e);function kS(e){return(0,A.forwardRef)(e)}var SS=typeof window<"u"?A.useLayoutEffect:A.useEffect;function NS(e){let[t,n]=(0,A.useState)(BigInt(0)),[r]=(0,A.useState)(()=>HI(()=>n(a=>a+BigInt(1))));return SS(()=>{let a=r.get();a.length&&(e(a),r.reset())},[t]),r}function HI(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}var jS=(0,A.createContext)(null);function VI({children:e}){let t=pt(),n=NS((0,A.useCallback)(s=>{let{nodes:l=[],setNodes:f,hasDefaultNodes:p,onNodesChange:h,nodeLookup:v,fitViewQueued:g,onNodesChangeMiddlewareMap:m}=t.getState(),b=l;for(let k of s)b=typeof k=="function"?k(b):k;let w=bS({items:b,lookup:v});for(let k of m.values())w=k(w);p&&f(b),w.length>0?h?.(w):g&&window.requestAnimationFrame(()=>{let{fitViewQueued:k,nodes:S,setNodes:N}=t.getState();k&&N(S)})},[])),r=NS((0,A.useCallback)(s=>{let{edges:l=[],setEdges:f,hasDefaultEdges:p,onEdgesChange:h,edgeLookup:v}=t.getState(),g=l;for(let m of s)g=typeof m=="function"?m(g):m;p?f(g):h&&h(bS({items:g,lookup:v}))},[])),a=(0,A.useMemo)(()=>({nodeQueue:n,edgeQueue:r}),[]);return(0,c.jsx)(jS.Provider,{value:a,children:e})}function KI(){let e=(0,A.useContext)(jS);if(!e)throw Error("useBatchContext must be used within a BatchProvider");return e}var WI=e=>!!e.panZoom;function Ts(){let e=LI(),t=pt(),n=KI(),r=Ke(WI),a=(0,A.useMemo)(()=>{let s=g=>t.getState().nodeLookup.get(g),l=g=>{n.nodeQueue.push(g)},f=g=>{n.edgeQueue.push(g)},p=g=>{let{nodeLookup:m,nodeOrigin:b}=t.getState(),w=wS(g)?g:m.get(g.id),k=w.parentId?j1(w.position,w.measured,w.parentId,m,b):w.position;return pd({...w,position:k,width:w.measured?.width??w.width,height:w.measured?.height??w.height})},h=(g,m,b={replace:!1})=>{l(w=>w.map(k=>{if(k.id===g){let S=typeof m=="function"?m(k):m;return b.replace&&wS(S)?S:{...k,...S}}return k}))},v=(g,m,b={replace:!1})=>{f(w=>w.map(k=>{if(k.id===g){let S=typeof m=="function"?m(k):m;return b.replace&&qI(S)?S:{...k,...S}}return k}))};return{getNodes:()=>t.getState().nodes.map(g=>({...g})),getNode:g=>s(g)?.internals.userNode,getInternalNode:s,getEdges:()=>{let{edges:g=[]}=t.getState();return g.map(m=>({...m}))},getEdge:g=>t.getState().edgeLookup.get(g),setNodes:l,setEdges:f,addNodes:g=>{let m=Array.isArray(g)?g:[g];n.nodeQueue.push(b=>[...b,...m])},addEdges:g=>{let m=Array.isArray(g)?g:[g];n.edgeQueue.push(b=>[...b,...m])},toObject:()=>{let{nodes:g=[],edges:m=[],transform:b}=t.getState(),[w,k,S]=b;return{nodes:g.map(N=>({...N})),edges:m.map(N=>({...N})),viewport:{x:w,y:k,zoom:S}}},deleteElements:async({nodes:g=[],edges:m=[]})=>{let{nodes:b,edges:w,onNodesDelete:k,onEdgesDelete:S,triggerNodeChanges:N,triggerEdgeChanges:$,onDelete:j,onBeforeDelete:E}=t.getState(),{nodes:I,edges:z}=await yD({nodesToRemove:g,edgesToRemove:m,nodes:b,edges:w,onBeforeDelete:E}),T=z.length>0,M=I.length>0;if(T){let O=z.map(xS);S?.(z),$(O)}if(M){let O=I.map(xS);k?.(I),N(O)}return(M||T)&&j?.({nodes:I,edges:z}),{deletedNodes:I,deletedEdges:z}},getIntersectingNodes:(g,m=!0,b)=>{let w=k1(g),k=w?g:p(g),S=b!==void 0;return k?(b||t.getState().nodes).filter(N=>{let $=t.getState().nodeLookup.get(N.id);if($&&!w&&(N.id===g.id||!$.internals.positionAbsolute))return!1;let j=pd(S?N:$),E=rf(j,k);return m&&E>0||E>=j.width*j.height||E>=k.width*k.height}):[]},isNodeIntersecting:(g,m,b=!0)=>{let w=k1(g)?g:p(g);if(!w)return!1;let k=rf(w,m);return b&&k>0||k>=m.width*m.height||k>=w.width*w.height},updateNode:h,updateNodeData:(g,m,b={replace:!1})=>{h(g,w=>{let k=typeof m=="function"?m(w):m;return b.replace?{...w,data:k}:{...w,data:{...w.data,...k}}},b)},updateEdge:v,updateEdgeData:(g,m,b={replace:!1})=>{v(g,w=>{let k=typeof m=="function"?m(w):m;return b.replace?{...w,data:k}:{...w,data:{...w.data,...k}}},b)},getNodesBounds:g=>{let{nodeLookup:m,nodeOrigin:b}=t.getState();return ef(g,{nodeLookup:m,nodeOrigin:b})},getHandleConnections:({type:g,id:m,nodeId:b})=>Array.from(t.getState().connectionLookup.get(`${b}-${g}${m?`-${m}`:""}`)?.values()??[]),getNodeConnections:({type:g,handleId:m,nodeId:b})=>Array.from(t.getState().connectionLookup.get(`${b}${g?m?`-${g}-${m}`:`-${g}`:""}`)?.values()??[]),fitView:async g=>{let m=t.getState().fitViewResolver??xD();return t.setState({fitViewQueued:!0,fitViewOptions:g,fitViewResolver:m}),n.nodeQueue.push(b=>[...b]),m.promise}}},[]);return(0,A.useMemo)(()=>({...a,...e,viewportInitialized:r}),[r])}var CS=e=>e.selected,UI=typeof window<"u"?window:void 0;function YI({deleteKeyCode:e,multiSelectionKeyCode:t}){let n=pt(),{deleteElements:r}=Ts(),a=bd(e,{actInsideInputWithModifier:!1}),s=bd(t,{target:UI});(0,A.useEffect)(()=>{if(a){let{edges:l,nodes:f}=n.getState();r({nodes:f.filter(CS),edges:l.filter(CS)}),n.setState({nodesSelectionActive:!1})}},[a]),(0,A.useEffect)(()=>{n.setState({multiSelectionActive:s})},[s])}function XI(e){let t=pt();(0,A.useEffect)(()=>{let n=()=>{if(!e.current||!(e.current.checkVisibility?.()??!0))return!1;let r=jg(e.current);(r.height===0||r.width===0)&&t.getState().onError?.("004",Wn.error004()),t.setState({width:r.width||500,height:r.height||500})};if(e.current){n(),window.addEventListener("resize",n);let r=new ResizeObserver(()=>n());return r.observe(e.current),()=>{window.removeEventListener("resize",n),r&&e.current&&r.unobserve(e.current)}}},[])}var ff={position:"absolute",width:"100%",height:"100%",top:0,left:0},ZI=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function GI({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panActivationKeyPressed:a,panOnScrollSpeed:s=.5,panOnScrollMode:l=Ns.Free,zoomOnDoubleClick:f=!0,panOnDrag:p=!0,defaultViewport:h,translateExtent:v,minZoom:g,maxZoom:m,zoomActivationKeyCode:b,preventScrolling:w=!0,children:k,noWheelClassName:S,noPanClassName:N,onViewportChange:$,isControlledViewport:j,paneClickDistance:E,selectionOnDrag:I}){let z=pt(),T=(0,A.useRef)(null),{userSelectionActive:M,lib:O,connectionInProgress:K}=Ke(ZI,yt),B=bd(b),V=(0,A.useRef)();XI(T);let oe=(0,A.useCallback)(F=>{$?.({x:F[0],y:F[1],zoom:F[2]}),j||z.setState({transform:F})},[$,j]);return(0,A.useEffect)(()=>{if(T.current){V.current=oI({domNode:T.current,minZoom:g,maxZoom:m,translateExtent:v,viewport:h,onDraggingChange:U=>z.setState(W=>W.paneDragging===U?W:{paneDragging:U}),onPanZoomStart:(U,W)=>{let{onViewportChangeStart:re,onMoveStart:le}=z.getState();le?.(U,W),re?.(W)},onPanZoom:(U,W)=>{let{onViewportChange:re,onMove:le}=z.getState();le?.(U,W),re?.(W)},onPanZoomEnd:(U,W)=>{let{onViewportChangeEnd:re,onMoveEnd:le}=z.getState();le?.(U,W),re?.(W)}});let{x:F,y:J,zoom:L}=V.current.getViewport();return z.setState({panZoom:V.current,transform:[F,J,L],domNode:T.current.closest(".react-flow")}),()=>{V.current?.destroy()}}},[]),(0,A.useEffect)(()=>{V.current?.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panActivationKeyPressed:a,panOnScrollSpeed:s,panOnScrollMode:l,zoomOnDoubleClick:f,panOnDrag:p,zoomActivationKeyPressed:B,preventScrolling:w,noPanClassName:N,userSelectionActive:M,noWheelClassName:S,lib:O,onTransformChange:oe,connectionInProgress:K,selectionOnDrag:I,paneClickDistance:E})},[e,t,n,r,a,s,l,f,p,B,w,N,M,S,O,oe,K,I,E]),(0,c.jsx)("div",{className:"react-flow__renderer",ref:T,style:ff,children:k})}var QI=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function JI(){let{userSelectionActive:e,userSelectionRect:t}=Ke(QI,yt);return e&&t?(0,c.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}var zg=(e,t)=>n=>{n.target===t.current&&e?.(n)},eL=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging,panBy:e.panBy,autoPanSpeed:e.autoPanSpeed});function tL({isSelecting:e,selectionKeyPressed:t,selectionMode:n=Jc.Full,panOnDrag:r,autoPanOnSelection:a,paneClickDistance:s,selectionOnDrag:l,onSelectionStart:f,onSelectionEnd:p,onPaneClick:h,onPaneContextMenu:v,onPaneScroll:g,onPaneMouseEnter:m,onPaneMouseMove:b,onPaneMouseLeave:w,children:k}){let S=(0,A.useRef)(0),N=pt(),{userSelectionActive:$,elementsSelectable:j,dragging:E,panBy:I,autoPanSpeed:z}=Ke(eL,yt),T=j&&(e||$),M=(0,A.useRef)(null),O=(0,A.useRef)(),K=(0,A.useRef)(new Set),B=(0,A.useRef)(new Set),V=(0,A.useRef)(!1),oe=(0,A.useRef)(!1),F=(0,A.useRef)({x:0,y:0}),J=(0,A.useRef)(!1),L=X=>{oe.current||V.current||N.getState().connection.inProgress?(oe.current=!1,V.current=!1):(h?.(X),N.getState().resetSelectedElements(),N.setState({nodesSelectionActive:!1}))},U=X=>{Array.isArray(r)&&r?.includes(2)?X.preventDefault():v?.(X)},W=g?X=>g(X):void 0,re=X=>{oe.current&&=(X.stopPropagation(),!1)},le=X=>{if(X.pointerType==="touch"&&r!==!1&&!t)return;let{domNode:he,transform:Z}=N.getState();if(O.current=he?.getBoundingClientRect(),!O.current)return;let q=X.target===M.current;if(!q&&X.target.closest(".nokey")||!e||!(l&&q||t)||X.button!==0||!X.isPrimary)return;X.target?.setPointerCapture?.(X.pointerId),oe.current=!1;let{x:ee,y:de}=fo(X.nativeEvent,O.current),me=gd({x:ee,y:de},Z);N.setState({userSelectionRect:{width:0,height:0,startX:me.x,startY:me.y,x:ee,y:de}}),q||(X.stopPropagation(),X.preventDefault())};function pe(X,he){let{userSelectionRect:Z}=N.getState();if(!Z)return;let{transform:q,nodeLookup:ee,edgeLookup:de,connectionLookup:me,triggerNodeChanges:De,triggerEdgeChanges:Fe,defaultEdgeOptions:Ye}=N.getState(),Le={x:Z.startX,y:Z.startY},{x:Be,y:ut}=Cs(Le,q),kt={startX:Le.x,startY:Le.y,x:X<Be?X:Be,y:he<ut?he:ut,width:Math.abs(X-Be),height:Math.abs(he-ut)},It=K.current,zt=B.current;K.current=new Set(wg(ee,kt,q,n===Jc.Partial,!0).map(Ft=>Ft.id)),B.current=new Set;let hn=Ye?.selectable??!0;for(let Ft of K.current){let Bt=me.get(Ft);if(Bt)for(let{edgeId:nn}of Bt.values()){let pn=de.get(nn);pn&&(pn.selectable??hn)&&B.current.add(nn)}}C1(It,K.current)||De(As(ee,K.current,!0)),C1(zt,B.current)||Fe(As(de,B.current)),N.setState({userSelectionRect:kt,userSelectionActive:!0,nodesSelectionActive:!1})}function xe(){if(!a||!O.current)return;let[X,he]=kg(F.current,O.current,z);I({x:X,y:he}).then(Z=>{if(!oe.current||!Z){S.current=requestAnimationFrame(xe);return}let{x:q,y:ee}=F.current;pe(q,ee),S.current=requestAnimationFrame(xe)})}let Ne=()=>{cancelAnimationFrame(S.current),S.current=0,J.current=!1};(0,A.useEffect)(()=>()=>Ne(),[]);let we=X=>{let{userSelectionRect:he,transform:Z,resetSelectedElements:q}=N.getState();if(!O.current||!he)return;let{x:ee,y:de}=fo(X.nativeEvent,O.current);F.current={x:ee,y:de};let me=Cs({x:he.startX,y:he.startY},Z);if(!oe.current){let De=t?0:s;if(Math.hypot(ee-me.x,de-me.y)<=De)return;q(),f?.(X)}oe.current=!0,J.current||=(xe(),!0),pe(ee,de)},R=X=>{T?X.button===0&&(X.target?.releasePointerCapture?.(X.pointerId),!$&&X.target===M.current&&N.getState().userSelectionRect&&L?.(X),N.setState({userSelectionActive:!1,userSelectionRect:null}),oe.current&&(p?.(X),N.setState({nodesSelectionActive:K.current.size>0})),Ne()):X.target===M.current&&N.getState().connection.inProgress&&(V.current=!0)},Q=X=>{X.target?.releasePointerCapture?.(X.pointerId),Ne()},fe=r===!0||Array.isArray(r)&&r.includes(0);return(0,c.jsxs)("div",{className:Dt(["react-flow__pane",{draggable:fe,dragging:E,selection:e}]),onClick:T?void 0:zg(L,M),onContextMenu:zg(U,M),onWheel:zg(W,M),onPointerEnter:T?void 0:m,onPointerMove:T?we:b,onPointerUp:R,onPointerCancel:T?Q:void 0,onPointerDownCapture:T?le:void 0,onClickCapture:T?re:void 0,onPointerLeave:w,ref:M,style:ff,children:[k,(0,c.jsx)(JI,{})]})}function Fg({id:e,store:t,unselect:n=!1,nodeRef:r}){let{addSelectedNodes:a,unselectNodesAndEdges:s,multiSelectionActive:l,nodeLookup:f,onError:p}=t.getState(),h=f.get(e);h?(t.setState({nodesSelectionActive:!1}),h.selected?(n||h.selected&&l)&&(s({nodes:[h],edges:[]}),requestAnimationFrame(()=>r?.current?.blur())):a([e])):p?.("012",Wn.error012(e))}function $S({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:a,isSelectable:s,nodeClickDistance:l}){let f=pt(),[p,h]=(0,A.useState)(!1),v=(0,A.useRef)();return(0,A.useEffect)(()=>{if(!t)return v.current=HD({getStoreItems:()=>f.getState(),onNodeMouseDown:g=>{Fg({id:g,store:f,nodeRef:e})},onDragStart:()=>{h(!0)},onDragStop:()=>{h(!1)}}),()=>{v.current?.destroy(),v.current=void 0}},[t,f,e]),(0,A.useEffect)(()=>{!t&&e.current&&v.current&&v.current.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:s,nodeId:a,nodeClickDistance:l})},[n,r,t,s,e,a,l]),p}var nL=e=>t=>t.selected&&(t.draggable||e&&t.draggable===void 0);function ES(){let e=pt();return(0,A.useCallback)(t=>{let{nodeExtent:n,snapToGrid:r,snapGrid:a,nodesDraggable:s,onError:l,updateNodePositions:f,nodeLookup:p,nodeOrigin:h}=e.getState(),v=new Map,g=nL(s),m=r?a[0]:5,b=r?a[1]:5,w=t.direction.x*m*t.factor,k=t.direction.y*b*t.factor;for(let[,S]of p){if(!g(S))continue;let N={x:S.internals.positionAbsolute.x+w,y:S.internals.positionAbsolute.y+k};r&&(N=md(N,a));let{position:$,positionAbsolute:j}=y1({nodeId:S.id,nextPosition:N,nodeLookup:p,nodeExtent:n,nodeOrigin:h,onError:l});S.position=$,S.internals.positionAbsolute=j,v.set(S.id,S)}f(v)},[])}var Bg=(0,A.createContext)(null),oL=Bg.Provider;Bg.Consumer;var _S=()=>(0,A.useContext)(Bg),rL=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),AS=(0,A.createContext)(null);function iL({children:e}){let t=Ke(rL,yt);return(0,c.jsx)(AS.Provider,{value:t,children:e})}function aL(){let e=(0,A.useContext)(AS);if(!e)throw Error("useHandleConfig must be used within a HandleConfigProvider");return e}var sL={connectingFrom:!1,connectingTo:!1,clickConnecting:!1,isPossibleEndHandle:!0,connectionInProcess:!1,clickConnectionInProcess:!1,valid:!1},lL=(e,t,n)=>r=>{let{connectionClickStartHandle:a,connectionMode:s,connection:l}=r,{fromHandle:f,toHandle:p,isValid:h}=l;if(!f&&!a)return sL;let v=p?.nodeId===e&&p?.id===t&&p?.type===n;return{connectingFrom:f?.nodeId===e&&f?.id===t&&f?.type===n,connectingTo:v,clickConnecting:a?.nodeId===e&&a?.id===t&&a?.type===n,isPossibleEndHandle:s===cd.Strict?f?.type!==n:e!==f?.nodeId||t!==f?.id,connectionInProcess:!!f,clickConnectionInProcess:!!a,valid:v&&h}};function dL({type:e="source",position:t=Ce.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:a=!0,isConnectableEnd:s=!0,id:l,onConnect:f,children:p,className:h,onMouseDown:v,onTouchStart:g,...m},b){let w=l||null,k=e==="target",S=pt(),N=_S(),{connectOnClick:$,noPanClassName:j,rfId:E}=aL(),{connectingFrom:I,connectingTo:z,clickConnecting:T,isPossibleEndHandle:M,connectionInProcess:O,clickConnectionInProcess:K,valid:B}=Ke(lL(N,w,e),yt);N||S.getState().onError?.("010",Wn.error010());let V=F=>{let{defaultEdgeOptions:J,onConnect:L,hasDefaultEdges:U}=S.getState(),W={...J,...F};if(U){let{edges:re,setEdges:le,onError:pe}=S.getState();le(BI(W,re,{onError:pe}))}L?.(W),f?.(W)},oe=F=>{if(!N)return;let J=A1(F.nativeEvent);if(a&&(J&&F.button===0||!J)){let L=S.getState();Pg.onPointerDown(F.nativeEvent,{handleDomNode:F.currentTarget,autoPanOnConnect:L.autoPanOnConnect,connectionMode:L.connectionMode,connectionRadius:L.connectionRadius,domNode:L.domNode,nodeLookup:L.nodeLookup,lib:L.lib,isTarget:k,handleId:w,nodeId:N,flowId:L.rfId,panBy:L.panBy,cancelConnection:L.cancelConnection,onConnectStart:L.onConnectStart,onConnectEnd:(...U)=>S.getState().onConnectEnd?.(...U),updateConnection:L.updateConnection,onConnect:V,isValidConnection:n||((...U)=>S.getState().isValidConnection?.(...U)??!0),getTransform:()=>S.getState().transform,getFromHandle:()=>S.getState().connection.fromHandle,autoPanSpeed:L.autoPanSpeed,dragThreshold:L.connectionDragThreshold})}J?v?.(F):g?.(F)};return(0,c.jsx)("div",{"data-handleid":w,"data-nodeid":N,"data-handlepos":t,"data-id":`${E}-${N}-${w}-${e}`,className:Dt(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",j,h,{source:!k,target:k,connectable:r,connectablestart:a,connectableend:s,clickconnecting:T,connectingfrom:I,connectingto:z,valid:B,connectionindicator:r&&(!O||M)&&(O||K?s:a)}]),onMouseDown:oe,onTouchStart:oe,onClick:$?F=>{let{onClickConnectStart:J,onClickConnectEnd:L,connectionClickStartHandle:U,connectionMode:W,isValidConnection:re,lib:le,rfId:pe,nodeLookup:xe,connection:Ne}=S.getState();if(!N||!U&&!a)return;if(!U){J?.(F.nativeEvent,{nodeId:N,handleId:w,handleType:e}),S.setState({connectionClickStartHandle:{nodeId:N,type:e,id:w}});return}let we=E1(F.target),R=n||re,{connection:Q,isValid:fe}=Pg.isValid(F.nativeEvent,{handle:{nodeId:N,id:w,type:e},connectionMode:W,fromNodeId:U.nodeId,fromHandleId:U.id||null,fromType:U.type,isValidConnection:R,flowId:pe,doc:we,lib:le,nodeLookup:xe});fe&&Q&&V(Q);let X=structuredClone(Ne);delete X.inProgress,X.toPosition=X.toHandle?X.toHandle.position:null,L?.(F,X),S.setState({connectionClickStartHandle:null})}:void 0,ref:b,...m,children:p})}var vr=(0,A.memo)(kS(dL));function uL({data:e,isConnectable:t,sourcePosition:n=Ce.Bottom}){return(0,c.jsxs)(c.Fragment,{children:[e?.label,(0,c.jsx)(vr,{type:"source",position:n,isConnectable:t})]})}function cL({data:e,isConnectable:t,targetPosition:n=Ce.Top,sourcePosition:r=Ce.Bottom}){return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(vr,{type:"target",position:n,isConnectable:t}),e?.label,(0,c.jsx)(vr,{type:"source",position:r,isConnectable:t})]})}function fL(){return null}function hL({data:e,isConnectable:t,targetPosition:n=Ce.Top}){return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(vr,{type:"target",position:n,isConnectable:t}),e?.label]})}var hf={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},TS={input:uL,default:cL,output:hL,group:fL};function pL(e){return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??e.style?.width,height:e.height??e.initialHeight??e.style?.height}:{width:e.width??e.style?.width,height:e.height??e.style?.height}}var mL=e=>{let{width:t,height:n,x:r,y:a}=hd(e.nodeLookup,{filter:s=>!!s.selected});return{width:uo(t)?t:null,height:uo(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${a}px)`}};function gL({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){let r=pt(),{width:a,height:s,transformString:l,userSelectionActive:f}=Ke(mL,yt),p=ES(),h=(0,A.useRef)(null);(0,A.useEffect)(()=>{n||h.current?.focus({preventScroll:!0})},[n]);let v=!f&&a!==null&&s!==null;if($S({nodeRef:h,disabled:!v}),!v)return null;let g=e?m=>{e(m,r.getState().nodes.filter(b=>b.selected))}:void 0;return(0,c.jsx)("div",{className:Dt(["react-flow__nodesselection","react-flow__container",t]),style:{transform:l},children:(0,c.jsx)("div",{ref:h,className:"react-flow__nodesselection-rect",onContextMenu:g,tabIndex:n?void 0:-1,onKeyDown:n?void 0:m=>{Object.prototype.hasOwnProperty.call(hf,m.key)&&(m.preventDefault(),p({direction:hf[m.key],factor:m.shiftKey?4:1}))},style:{width:a,height:s}})})}var MS=typeof window<"u"?window:void 0,yL=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function OS({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:a,onPaneContextMenu:s,onPaneScroll:l,paneClickDistance:f,deleteKeyCode:p,selectionKeyCode:h,selectionOnDrag:v,selectionMode:g,onSelectionStart:m,onSelectionEnd:b,multiSelectionKeyCode:w,panActivationKeyCode:k,zoomActivationKeyCode:S,elementsSelectable:N,zoomOnScroll:$,zoomOnPinch:j,panOnScroll:E,panOnScrollSpeed:I,panOnScrollMode:z,zoomOnDoubleClick:T,panOnDrag:M,autoPanOnSelection:O,defaultViewport:K,translateExtent:B,minZoom:V,maxZoom:oe,preventScrolling:F,onSelectionContextMenu:J,noWheelClassName:L,noPanClassName:U,disableKeyboardA11y:W,onViewportChange:re,isControlledViewport:le}){let{nodesSelectionActive:pe,userSelectionActive:xe}=Ke(yL,yt),Ne=bd(h,{target:MS}),we=bd(k,{target:MS}),R=we||M,Q=we||E,fe=v&&R!==!0,X=Ne||xe||fe;return YI({deleteKeyCode:p,multiSelectionKeyCode:w}),(0,c.jsx)(GI,{onPaneContextMenu:s,elementsSelectable:N,zoomOnScroll:$,zoomOnPinch:j,panOnScroll:Q,panActivationKeyPressed:we,panOnScrollSpeed:I,panOnScrollMode:z,zoomOnDoubleClick:T,panOnDrag:!Ne&&R,defaultViewport:K,translateExtent:B,minZoom:V,maxZoom:oe,zoomActivationKeyCode:S,preventScrolling:F,noWheelClassName:L,noPanClassName:U,onViewportChange:re,isControlledViewport:le,paneClickDistance:f,selectionOnDrag:fe,children:(0,c.jsxs)(tL,{onSelectionStart:m,onSelectionEnd:b,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:a,onPaneContextMenu:s,onPaneScroll:l,panOnDrag:R,autoPanOnSelection:O,isSelecting:!!X,selectionMode:g,selectionKeyPressed:Ne,paneClickDistance:f,selectionOnDrag:fe,children:[e,pe&&(0,c.jsx)(gL,{onSelectionContextMenu:J,noPanClassName:U,disableKeyboardA11y:W})]})})}OS.displayName="FlowRenderer";var vL=(0,A.memo)(OS),bL=e=>t=>e?wg(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 xL(e){return Ke((0,A.useCallback)(bL(e),[e]),yt)}var wL=e=>e.updateNodeInternals;function kL(){let e=Ke(wL),[t]=(0,A.useState)(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{let r=new Map;n.forEach(a=>{let s=a.target.getAttribute("data-id");r.set(s,{id:s,nodeElement:a.target,force:!0})}),e(r)}));return(0,A.useEffect)(()=>()=>{t?.disconnect()},[t]),t}function SL({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){let a=pt(),s=(0,A.useRef)(null),l=(0,A.useRef)(null),f=(0,A.useRef)(e.sourcePosition),p=(0,A.useRef)(e.targetPosition),h=(0,A.useRef)(t),v=n&&!!e.internals.handleBounds;return(0,A.useEffect)(()=>{!s.current||e.hidden||v&&l.current===s.current||(l.current&&r?.unobserve(l.current),r?.observe(s.current),l.current=s.current)},[v,e.hidden]),(0,A.useEffect)(()=>()=>{l.current&&=(r?.unobserve(l.current),null)},[]),(0,A.useEffect)(()=>{if(s.current){let g=h.current!==t,m=f.current!==e.sourcePosition,b=p.current!==e.targetPosition;(g||m||b)&&(h.current=t,f.current=e.sourcePosition,p.current=e.targetPosition,a.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:s.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),s}function NL({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:a,onContextMenu:s,onDoubleClick:l,nodesDraggable:f,elementsSelectable:p,nodesConnectable:h,nodesFocusable:v,resizeObserver:g,noDragClassName:m,noPanClassName:b,disableKeyboardA11y:w,rfId:k,nodeTypes:S,nodeClickDistance:N,onError:$}){let{node:j,internals:E,isParent:I}=Ke(X=>{let he=X.nodeLookup.get(e),Z=X.parentLookup.has(e);return{node:he,internals:he.internals,isParent:Z}},yt),z=j.type||"default",T=S?.[z]||TS[z];T===void 0&&($?.("003",Wn.error003(z)),z="default",T=S?.default||TS.default);let M=!!(j.draggable||f&&j.draggable===void 0),O=!!(j.selectable||p&&j.selectable===void 0),K=!!(j.connectable||h&&j.connectable===void 0),B=!!(j.focusable||v&&j.focusable===void 0),V=pt(),oe=N1(j),F=SL({node:j,nodeType:z,hasDimensions:oe,resizeObserver:g}),J=$S({nodeRef:F,disabled:j.hidden||!M,noDragClassName:m,handleSelector:j.dragHandle,nodeId:e,isSelectable:O,nodeClickDistance:N}),L=ES();if(j.hidden)return null;let U=co(j),W=pL(j),re=O||M||t||n||r||a,le=n?X=>n(X,{...E.userNode}):void 0,pe=r?X=>r(X,{...E.userNode}):void 0,xe=a?X=>a(X,{...E.userNode}):void 0,Ne=s?X=>s(X,{...E.userNode}):void 0,we=l?X=>l(X,{...E.userNode}):void 0,R=X=>{let{selectNodesOnDrag:he,nodeDragThreshold:Z}=V.getState();O&&(!he||!M||Z>0)&&Fg({id:e,store:V,nodeRef:F}),t&&t(X,{...E.userNode})},Q=X=>{if(!(_1(X.nativeEvent)||w)){if(f1.includes(X.key)&&O){let he=X.key==="Escape";Fg({id:e,store:V,unselect:he,nodeRef:F})}else if(M&&j.selected&&Object.prototype.hasOwnProperty.call(hf,X.key)){X.preventDefault();let{ariaLabelConfig:he}=V.getState();V.setState({ariaLiveMessage:he["node.a11yDescription.ariaLiveMessage"]({direction:X.key.replace("Arrow","").toLowerCase(),x:~~E.positionAbsolute.x,y:~~E.positionAbsolute.y})}),L({direction:hf[X.key],factor:X.shiftKey?4:1})}}},fe=()=>{if(w||!F.current?.matches(":focus-visible"))return;let{transform:X,width:he,height:Z,autoPanOnNodeFocus:q,setCenter:ee}=V.getState();q&&(wg(new Map([[e,j]]),{x:0,y:0,width:he,height:Z},X,!0).length>0||ee(j.position.x+U.width/2,j.position.y+U.height/2,{zoom:X[2]}))};return(0,c.jsx)("div",{className:Dt(["react-flow__node",`react-flow__node-${z}`,{[b]:M},j.className,{selected:j.selected,selectable:O,parent:I,draggable:M,dragging:J}]),ref:F,style:{zIndex:E.z,transform:`translate(${E.positionAbsolute.x}px,${E.positionAbsolute.y}px)`,pointerEvents:re?"all":"none",visibility:oe?"visible":"hidden",...j.style,...W},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:le,onMouseMove:pe,onMouseLeave:xe,onContextMenu:Ne,onClick:R,onDoubleClick:we,onKeyDown:B?Q:void 0,tabIndex:B?0:void 0,onFocus:B?fe:void 0,role:j.ariaRole??(B?"group":void 0),"aria-roledescription":"node","aria-describedby":w?void 0:`${lS}-${k}`,"aria-label":j.ariaLabel,...j.domAttributes,children:(0,c.jsx)(oL,{value:e,children:(0,c.jsx)(T,{id:e,data:j.data,type:z,positionAbsoluteX:E.positionAbsolute.x,positionAbsoluteY:E.positionAbsolute.y,selected:j.selected??!1,selectable:O,draggable:M,deletable:j.deletable??!0,isConnectable:K,sourcePosition:j.sourcePosition,targetPosition:j.targetPosition,dragging:J,dragHandle:j.dragHandle,zIndex:E.z,parentId:j.parentId,...U})})})}var jL=(0,A.memo)(NL),CL=e=>({nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function PS(e){let{nodesConnectable:t,nodesFocusable:n,elementsSelectable:r,onError:a}=Ke(CL,yt),s=xL(e.onlyRenderVisibleElements),l=kL();return(0,c.jsx)("div",{className:"react-flow__nodes",style:ff,children:s.map(f=>(0,c.jsx)(jL,{id:f,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:e.nodesDraggable??!0,nodesConnectable:t,nodesFocusable:n,elementsSelectable:r,nodeClickDistance:e.nodeClickDistance,onError:a},f))})}PS.displayName="NodeRenderer";var $L=(0,A.memo)(PS);function EL(e){return Ke((0,A.useCallback)(t=>{if(!e)return t.edges.map(r=>r.id);let n=[];if(t.width&&t.height)for(let r of t.edges){let a=t.nodeLookup.get(r.source),s=t.nodeLookup.get(r.target);a&&s&&ND({sourceNode:a,targetNode:s,width:t.width,height:t.height,transform:t.transform})&&n.push(r.id)}return n},[e]),yt)}var _L=({color:e="none",strokeWidth:t=1})=>{let n={strokeWidth:t,...e&&{stroke:e}};return(0,c.jsx)("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},AL=({color:e="none",strokeWidth:t=1})=>{let n={strokeWidth:t,...e&&{stroke:e,fill:e}};return(0,c.jsx)("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},DS={[na.Arrow]:_L,[na.ArrowClosed]:AL};function TL(e){let t=pt();return(0,A.useMemo)(()=>Object.prototype.hasOwnProperty.call(DS,e)?DS[e]:(t.getState().onError?.("009",Wn.error009(e)),null),[e])}var ML=({id:e,type:t,color:n,width:r=12.5,height:a=12.5,markerUnits:s="strokeWidth",strokeWidth:l,orient:f="auto-start-reverse"})=>{let p=TL(t);return p?(0,c.jsx)("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${a}`,viewBox:"-10 -10 20 20",markerUnits:s,orient:f,refX:"0",refY:"0",children:(0,c.jsx)(p,{color:n,strokeWidth:l})}):null},IS=({defaultColor:e,rfId:t})=>{let n=Ke(s=>s.edges),r=Ke(s=>s.defaultEdgeOptions),a=(0,A.useMemo)(()=>MD(n,{id:t,defaultColor:e,defaultMarkerStart:r?.markerStart,defaultMarkerEnd:r?.markerEnd}),[n,r,t,e]);return a.length?(0,c.jsx)("svg",{className:"react-flow__marker","aria-hidden":"true",children:(0,c.jsx)("defs",{children:a.map(s=>(0,c.jsx)(ML,{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};IS.displayName="MarkerDefinitions";var OL=(0,A.memo)(IS);function LS({x:e,y:t,label:n,labelStyle:r,labelShowBg:a=!0,labelBgStyle:s,labelBgPadding:l=[2,4],labelBgBorderRadius:f=2,children:p,className:h,...v}){let[g,m]=(0,A.useState)({x:1,y:0,width:0,height:0}),b=Dt(["react-flow__edge-textwrapper",h]),w=(0,A.useRef)(null);return(0,A.useEffect)(()=>{if(w.current){let k=w.current.getBBox();m({x:k.x,y:k.y,width:k.width,height:k.height})}},[n]),n?(0,c.jsxs)("g",{transform:`translate(${e-g.width/2} ${t-g.height/2})`,className:b,visibility:g.width?"visible":"hidden",...v,children:[a&&(0,c.jsx)("rect",{width:g.width+2*l[0],x:-l[0],y:-l[1],height:g.height+2*l[1],className:"react-flow__edge-textbg",style:s,rx:f,ry:f}),(0,c.jsx)("text",{className:"react-flow__edge-text",y:g.height/2,dy:"0.3em",ref:w,style:r,children:n}),p]}):null}LS.displayName="EdgeText";var PL=(0,A.memo)(LS);function xd({path:e,labelX:t,labelY:n,label:r,labelStyle:a,labelShowBg:s,labelBgStyle:l,labelBgPadding:f,labelBgBorderRadius:p,interactionWidth:h=20,...v}){return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("path",{...v,d:e,fill:"none",className:Dt(["react-flow__edge-path",v.className])}),h?(0,c.jsx)("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:h,className:"react-flow__edge-interaction"}):null,r&&uo(t)&&uo(n)?(0,c.jsx)(PL,{x:t,y:n,label:r,labelStyle:a,labelShowBg:s,labelBgStyle:l,labelBgPadding:f,labelBgBorderRadius:p}):null]})}function RS({pos:e,x1:t,y1:n,x2:r,y2:a}){return e===Ce.Left||e===Ce.Right?[.5*(t+r),n]:[t,.5*(n+a)]}function zS({sourceX:e,sourceY:t,sourcePosition:n=Ce.Bottom,targetX:r,targetY:a,targetPosition:s=Ce.Top}){let[l,f]=RS({pos:n,x1:e,y1:t,x2:r,y2:a}),[p,h]=RS({pos:s,x1:r,y1:a,x2:e,y2:t}),[v,g,m,b]=M1({sourceX:e,sourceY:t,targetX:r,targetY:a,sourceControlX:l,sourceControlY:f,targetControlX:p,targetControlY:h});return[`M${e},${t} C${l},${f} ${p},${h} ${r},${a}`,v,g,m,b]}function FS(e){return(0,A.memo)(({id:t,sourceX:n,sourceY:r,targetX:a,targetY:s,sourcePosition:l,targetPosition:f,label:p,labelStyle:h,labelShowBg:v,labelBgStyle:g,labelBgPadding:m,labelBgBorderRadius:b,style:w,markerEnd:k,markerStart:S,interactionWidth:N})=>{let[$,j,E]=zS({sourceX:n,sourceY:r,sourcePosition:l,targetX:a,targetY:s,targetPosition:f}),I=e.isInternal?void 0:t;return(0,c.jsx)(xd,{id:I,path:$,labelX:j,labelY:E,label:p,labelStyle:h,labelShowBg:v,labelBgStyle:g,labelBgPadding:m,labelBgBorderRadius:b,style:w,markerEnd:k,markerStart:S,interactionWidth:N})})}var DL=FS({isInternal:!1}),BS=FS({isInternal:!0});DL.displayName="SimpleBezierEdge",BS.displayName="SimpleBezierEdgeInternal";function qS(e){return(0,A.memo)(({id:t,sourceX:n,sourceY:r,targetX:a,targetY:s,label:l,labelStyle:f,labelShowBg:p,labelBgStyle:h,labelBgPadding:v,labelBgBorderRadius:g,style:m,sourcePosition:b=Ce.Bottom,targetPosition:w=Ce.Top,markerEnd:k,markerStart:S,pathOptions:N,interactionWidth:$})=>{let[j,E,I]=sf({sourceX:n,sourceY:r,sourcePosition:b,targetX:a,targetY:s,targetPosition:w,borderRadius:N?.borderRadius,offset:N?.offset,stepPosition:N?.stepPosition}),z=e.isInternal?void 0:t;return(0,c.jsx)(xd,{id:z,path:j,labelX:E,labelY:I,label:l,labelStyle:f,labelShowBg:p,labelBgStyle:h,labelBgPadding:v,labelBgBorderRadius:g,style:m,markerEnd:k,markerStart:S,interactionWidth:$})})}var HS=qS({isInternal:!1}),VS=qS({isInternal:!0});HS.displayName="SmoothStepEdge",VS.displayName="SmoothStepEdgeInternal";function KS(e){return(0,A.memo)(({id:t,...n})=>{let r=e.isInternal?void 0:t;return(0,c.jsx)(HS,{...n,id:r,pathOptions:(0,A.useMemo)(()=>({borderRadius:0,offset:n.pathOptions?.offset}),[n.pathOptions?.offset])})})}var IL=KS({isInternal:!1}),WS=KS({isInternal:!0});IL.displayName="StepEdge",WS.displayName="StepEdgeInternal";function US(e){return(0,A.memo)(({id:t,sourceX:n,sourceY:r,targetX:a,targetY:s,label:l,labelStyle:f,labelShowBg:p,labelBgStyle:h,labelBgPadding:v,labelBgBorderRadius:g,style:m,markerEnd:b,markerStart:w,interactionWidth:k})=>{let[S,N,$]=I1({sourceX:n,sourceY:r,targetX:a,targetY:s}),j=e.isInternal?void 0:t;return(0,c.jsx)(xd,{id:j,path:S,labelX:N,labelY:$,label:l,labelStyle:f,labelShowBg:p,labelBgStyle:h,labelBgPadding:v,labelBgBorderRadius:g,style:m,markerEnd:b,markerStart:w,interactionWidth:k})})}var LL=US({isInternal:!1}),YS=US({isInternal:!0});LL.displayName="StraightEdge",YS.displayName="StraightEdgeInternal";function XS(e){return(0,A.memo)(({id:t,sourceX:n,sourceY:r,targetX:a,targetY:s,sourcePosition:l=Ce.Bottom,targetPosition:f=Ce.Top,label:p,labelStyle:h,labelShowBg:v,labelBgStyle:g,labelBgPadding:m,labelBgBorderRadius:b,style:w,markerEnd:k,markerStart:S,pathOptions:N,interactionWidth:$})=>{let[j,E,I]=P1({sourceX:n,sourceY:r,sourcePosition:l,targetX:a,targetY:s,targetPosition:f,curvature:N?.curvature}),z=e.isInternal?void 0:t;return(0,c.jsx)(xd,{id:z,path:j,labelX:E,labelY:I,label:p,labelStyle:h,labelShowBg:v,labelBgStyle:g,labelBgPadding:m,labelBgBorderRadius:b,style:w,markerEnd:k,markerStart:S,interactionWidth:$})})}var RL=XS({isInternal:!1}),ZS=XS({isInternal:!0});RL.displayName="BezierEdge",ZS.displayName="BezierEdgeInternal";var GS={default:ZS,straight:YS,step:WS,smoothstep:VS,simplebezier:BS},QS={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null,zIndex:void 0},zL=(e,t,n)=>n===Ce.Left?e-t:n===Ce.Right?e+t:e,FL=(e,t,n)=>n===Ce.Top?e-t:n===Ce.Bottom?e+t:e,JS="react-flow__edgeupdater";function eN({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:a,onMouseEnter:s,onMouseOut:l,type:f}){return(0,c.jsx)("circle",{onMouseDown:a,onMouseEnter:s,onMouseOut:l,className:Dt([JS,`${JS}-${f}`]),cx:zL(t,r,e),cy:FL(n,r,e),r,stroke:"transparent",fill:"transparent"})}function BL({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:a,targetX:s,targetY:l,sourcePosition:f,targetPosition:p,onReconnect:h,onReconnectStart:v,onReconnectEnd:g,setReconnecting:m,setUpdateHover:b}){let w=pt(),k=(E,I)=>{if(E.button!==0)return;let{autoPanOnConnect:z,domNode:T,connectionMode:M,connectionRadius:O,lib:K,onConnectStart:B,cancelConnection:V,nodeLookup:oe,rfId:F,panBy:J,updateConnection:L}=w.getState(),U=I.type==="target";Pg.onPointerDown(E.nativeEvent,{autoPanOnConnect:z,connectionMode:M,connectionRadius:O,domNode:T,handleId:I.id,nodeId:I.nodeId,nodeLookup:oe,isTarget:U,edgeUpdaterType:I.type,lib:K,flowId:F,cancelConnection:V,panBy:J,isValidConnection:(...W)=>w.getState().isValidConnection?.(...W)??!0,onConnect:W=>h?.(n,W),onConnectStart:(W,re)=>{m(!0),v?.(E,n,I.type),B?.(W,re)},onConnectEnd:(...W)=>w.getState().onConnectEnd?.(...W),onReconnectEnd:(W,re)=>{m(!1),g?.(W,n,I.type,re)},updateConnection:L,getTransform:()=>w.getState().transform,getFromHandle:()=>w.getState().connection.fromHandle,dragThreshold:w.getState().connectionDragThreshold,handleDomNode:E.currentTarget})},S=E=>k(E,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),N=E=>k(E,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),$=()=>b(!0),j=()=>b(!1);return(0,c.jsxs)(c.Fragment,{children:[(e===!0||e==="source")&&(0,c.jsx)(eN,{position:f,centerX:r,centerY:a,radius:t,onMouseDown:S,onMouseEnter:$,onMouseOut:j,type:"source"}),(e===!0||e==="target")&&(0,c.jsx)(eN,{position:p,centerX:s,centerY:l,radius:t,onMouseDown:N,onMouseEnter:$,onMouseOut:j,type:"target"})]})}function qL({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:a,onDoubleClick:s,onContextMenu:l,onMouseEnter:f,onMouseMove:p,onMouseLeave:h,reconnectRadius:v,onReconnect:g,onReconnectStart:m,onReconnectEnd:b,rfId:w,edgeTypes:k,noPanClassName:S,onError:N,disableKeyboardA11y:$}){let j=Ke(q=>q.edgeLookup.get(e)),E=Ke(q=>q.defaultEdgeOptions);j=E?{...E,...j}:j;let I=j.type||"default",z=k?.[I]||GS[I];z===void 0&&(N?.("011",Wn.error011(I)),I="default",z=k?.default||GS.default);let T=!!(j.focusable||t&&j.focusable===void 0),M=g!==void 0&&(j.reconnectable||n&&j.reconnectable===void 0),O=!!(j.selectable||r&&j.selectable===void 0),K=(0,A.useRef)(null),[B,V]=(0,A.useState)(!1),[oe,F]=(0,A.useState)(!1),J=pt(),{zIndex:L=j.zIndex,sourceX:U,sourceY:W,targetX:re,targetY:le,sourcePosition:pe,targetPosition:xe}=Ke((0,A.useCallback)(q=>{let ee=q.nodeLookup.get(j.source),de=q.nodeLookup.get(j.target);if(!ee||!de)return QS;let me=TD({id:e,sourceNode:ee,targetNode:de,sourceHandle:j.sourceHandle||null,targetHandle:j.targetHandle||null,connectionMode:q.connectionMode,onError:N}),De=SD({selected:j.selected,zIndex:j.zIndex,sourceNode:ee,targetNode:de,elevateOnSelect:q.elevateEdgesOnSelect,zIndexMode:q.zIndexMode});return{...me||QS,zIndex:De}},[j.source,j.target,j.sourceHandle,j.targetHandle,j.selected,j.zIndex,N]),yt),Ne=(0,A.useMemo)(()=>j.markerStart?`url('#${Cg(j.markerStart,w)}')`:void 0,[j.markerStart,w]),we=(0,A.useMemo)(()=>j.markerEnd?`url('#${Cg(j.markerEnd,w)}')`:void 0,[j.markerEnd,w]);if(j.hidden||U===null||W===null||re===null||le===null)return null;let R=q=>{let{addSelectedEdges:ee,unselectNodesAndEdges:de,multiSelectionActive:me}=J.getState();O&&(J.setState({nodesSelectionActive:!1}),j.selected&&me?(de({nodes:[],edges:[j]}),K.current?.blur()):ee([e])),a&&a(q,j)},Q=s?q=>{s(q,{...j})}:void 0,fe=l?q=>{l(q,{...j})}:void 0,X=f?q=>{f(q,{...j})}:void 0,he=p?q=>{p(q,{...j})}:void 0,Z=h?q=>{h(q,{...j})}:void 0;return(0,c.jsx)("svg",{style:{zIndex:L},children:(0,c.jsxs)("g",{className:Dt(["react-flow__edge",`react-flow__edge-${I}`,j.className,S,{selected:j.selected,animated:j.animated,inactive:!O&&!a,updating:B,selectable:O}]),onClick:R,onDoubleClick:Q,onContextMenu:fe,onMouseEnter:X,onMouseMove:he,onMouseLeave:Z,onKeyDown:T?q=>{if(!$&&f1.includes(q.key)&&O){let{unselectNodesAndEdges:ee,addSelectedEdges:de}=J.getState();q.key==="Escape"?(K.current?.blur(),ee({edges:[j]})):de([e])}}:void 0,tabIndex:T?0:void 0,role:j.ariaRole??(T?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":j.ariaLabel===null?void 0:j.ariaLabel||`Edge from ${j.source} to ${j.target}`,"aria-describedby":T?`${dS}-${w}`:void 0,ref:K,...j.domAttributes,children:[!oe&&(0,c.jsx)(z,{id:e,source:j.source,target:j.target,type:j.type,selected:j.selected,animated:j.animated,selectable:O,deletable:j.deletable??!0,label:j.label,labelStyle:j.labelStyle,labelShowBg:j.labelShowBg,labelBgStyle:j.labelBgStyle,labelBgPadding:j.labelBgPadding,labelBgBorderRadius:j.labelBgBorderRadius,sourceX:U,sourceY:W,targetX:re,targetY:le,sourcePosition:pe,targetPosition:xe,data:j.data,style:j.style,sourceHandleId:j.sourceHandle,targetHandleId:j.targetHandle,markerStart:Ne,markerEnd:we,pathOptions:"pathOptions"in j?j.pathOptions:void 0,interactionWidth:j.interactionWidth}),M&&(0,c.jsx)(BL,{edge:j,isReconnectable:M,reconnectRadius:v,onReconnect:g,onReconnectStart:m,onReconnectEnd:b,sourceX:U,sourceY:W,targetX:re,targetY:le,sourcePosition:pe,targetPosition:xe,setUpdateHover:V,setReconnecting:F})]})})}var HL=(0,A.memo)(qL),VL=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function tN({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:a,onReconnect:s,onEdgeContextMenu:l,onEdgeMouseEnter:f,onEdgeMouseMove:p,onEdgeMouseLeave:h,onEdgeClick:v,reconnectRadius:g,onEdgeDoubleClick:m,onReconnectStart:b,onReconnectEnd:w,disableKeyboardA11y:k}){let{edgesFocusable:S,edgesReconnectable:N,elementsSelectable:$,onError:j}=Ke(VL,yt),E=EL(t);return(0,c.jsxs)("div",{className:"react-flow__edges",children:[(0,c.jsx)(OL,{defaultColor:e,rfId:n}),E.map(I=>(0,c.jsx)(HL,{id:I,edgesFocusable:S,edgesReconnectable:N,elementsSelectable:$,noPanClassName:a,onReconnect:s,onContextMenu:l,onMouseEnter:f,onMouseMove:p,onMouseLeave:h,onClick:v,reconnectRadius:g,onDoubleClick:m,onReconnectStart:b,onReconnectEnd:w,rfId:n,onError:j,edgeTypes:r,disableKeyboardA11y:k},I))]})}tN.displayName="EdgeRenderer";var KL=(0,A.memo)(tN),nN=e=>`translate(${e[0]}px,${e[1]}px) scale(${e[2]})`;function WL({children:e}){let t=pt(),n=(0,A.useRef)(null),[r]=(0,A.useState)(()=>t.getState().transform);return SS(()=>{let a=null,s=()=>{let l=t.getState().transform;a&&l[0]===a[0]&&l[1]===a[1]&&l[2]===a[2]||(a=l,n.current&&(n.current.style.transform=nN(l)))};return s(),t.subscribe(s)},[t]),(0,c.jsx)("div",{ref:n,className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:nN(r)},children:e})}function UL(e){let t=Ts(),n=(0,A.useRef)(!1);(0,A.useEffect)(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}var YL=e=>e.panZoom?.syncViewport;function XL(e){let t=Ke(YL),n=pt();return(0,A.useEffect)(()=>{e&&(t?.(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function oN(e){return e.connection.inProgress?{...e.connection,to:gd(e.connection.to,e.transform)}:{...e.connection}}function ZL(e){return e?t=>e(oN(t)):oN}function GL(e){return Ke(ZL(e),yt)}var QL=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function JL({containerStyle:e,style:t,type:n,component:r}){let{nodesConnectable:a,width:s,height:l,isValid:f,inProgress:p}=Ke(QL,yt);return s&&a&&p?(0,c.jsx)("svg",{style:e,width:s,height:l,className:"react-flow__connectionline react-flow__container",children:(0,c.jsx)("g",{className:Dt(["react-flow__connection",$1(f)]),children:(0,c.jsx)(rN,{style:t,type:n,CustomComponent:r,isValid:f})})}):null}var rN=({style:e,type:t=ta.Bezier,CustomComponent:n,isValid:r})=>{let{inProgress:a,from:s,fromNode:l,fromHandle:f,fromPosition:p,to:h,toNode:v,toHandle:g,toPosition:m,pointer:b}=GL();if(!a)return;if(n)return(0,c.jsx)(n,{connectionLineType:t,connectionLineStyle:e,fromNode:l,fromHandle:f,fromX:s.x,fromY:s.y,toX:h.x,toY:h.y,fromPosition:p,toPosition:m,connectionStatus:$1(r),toNode:v,toHandle:g,pointer:b});let w="",k={sourceX:s.x,sourceY:s.y,sourcePosition:p,targetX:h.x,targetY:h.y,targetPosition:m};switch(t){case ta.Bezier:[w]=P1(k);break;case ta.SimpleBezier:[w]=zS(k);break;case ta.Step:[w]=sf({...k,borderRadius:0});break;case ta.SmoothStep:[w]=sf(k);break;default:[w]=I1(k)}return(0,c.jsx)("path",{d:w,fill:"none",className:"react-flow__connection-path",style:e})};rN.displayName="ConnectionLine";var e3={};function iN(e=e3){(0,A.useRef)(e),pt(),(0,A.useEffect)(()=>{},[e])}function t3(){pt(),(0,A.useRef)(!1),(0,A.useEffect)(()=>{},[])}function aN({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:a,onNodeDoubleClick:s,onEdgeDoubleClick:l,onNodeMouseEnter:f,onNodeMouseMove:p,onNodeMouseLeave:h,onNodeContextMenu:v,onSelectionContextMenu:g,onSelectionStart:m,onSelectionEnd:b,connectionLineType:w,connectionLineStyle:k,connectionLineComponent:S,connectionLineContainerStyle:N,selectionKeyCode:$,selectionOnDrag:j,selectionMode:E,multiSelectionKeyCode:I,panActivationKeyCode:z,zoomActivationKeyCode:T,deleteKeyCode:M,onlyRenderVisibleElements:O,elementsSelectable:K,defaultViewport:B,translateExtent:V,minZoom:oe,maxZoom:F,preventScrolling:J,defaultMarkerColor:L,zoomOnScroll:U,zoomOnPinch:W,panOnScroll:re,panOnScrollSpeed:le,panOnScrollMode:pe,zoomOnDoubleClick:xe,panOnDrag:Ne,autoPanOnSelection:we,onPaneClick:R,onPaneMouseEnter:Q,onPaneMouseMove:fe,onPaneMouseLeave:X,onPaneScroll:he,onPaneContextMenu:Z,paneClickDistance:q,nodeClickDistance:ee,onEdgeContextMenu:de,onEdgeMouseEnter:me,onEdgeMouseMove:De,onEdgeMouseLeave:Fe,reconnectRadius:Ye,onReconnect:Le,onReconnectStart:Be,onReconnectEnd:ut,noDragClassName:kt,noWheelClassName:It,noPanClassName:zt,disableKeyboardA11y:hn,nodeExtent:Ft,rfId:Bt,viewport:nn,onViewportChange:pn,nodesDraggable:bt}){return iN(e),iN(t),t3(),UL(n),XL(nn),(0,c.jsx)(vL,{onPaneClick:R,onPaneMouseEnter:Q,onPaneMouseMove:fe,onPaneMouseLeave:X,onPaneContextMenu:Z,onPaneScroll:he,paneClickDistance:q,deleteKeyCode:M,selectionKeyCode:$,selectionOnDrag:j,selectionMode:E,onSelectionStart:m,onSelectionEnd:b,multiSelectionKeyCode:I,panActivationKeyCode:z,zoomActivationKeyCode:T,elementsSelectable:K,zoomOnScroll:U,zoomOnPinch:W,zoomOnDoubleClick:xe,panOnScroll:re,panOnScrollSpeed:le,panOnScrollMode:pe,panOnDrag:Ne,autoPanOnSelection:we,defaultViewport:B,translateExtent:V,minZoom:oe,maxZoom:F,onSelectionContextMenu:g,preventScrolling:J,noDragClassName:kt,noWheelClassName:It,noPanClassName:zt,disableKeyboardA11y:hn,onViewportChange:pn,isControlledViewport:!!nn,children:(0,c.jsxs)(WL,{children:[(0,c.jsx)(KL,{edgeTypes:t,onEdgeClick:a,onEdgeDoubleClick:l,onReconnect:Le,onReconnectStart:Be,onReconnectEnd:ut,onlyRenderVisibleElements:O,onEdgeContextMenu:de,onEdgeMouseEnter:me,onEdgeMouseMove:De,onEdgeMouseLeave:Fe,reconnectRadius:Ye,defaultMarkerColor:L,noPanClassName:zt,disableKeyboardA11y:hn,rfId:Bt}),(0,c.jsx)(JL,{style:k,type:w,component:S,containerStyle:N}),(0,c.jsx)("div",{className:"react-flow__edgelabel-renderer"}),(0,c.jsx)($L,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:s,onNodeMouseEnter:f,onNodeMouseMove:p,onNodeMouseLeave:h,onNodeContextMenu:v,nodeClickDistance:ee,onlyRenderVisibleElements:O,noPanClassName:zt,noDragClassName:kt,disableKeyboardA11y:hn,nodeExtent:Ft,rfId:Bt,nodesDraggable:bt}),(0,c.jsx)("div",{className:"react-flow__viewport-portal"})]})})}aN.displayName="GraphView";var n3=(0,A.memo)(aN),o3=S1("React Flow","https://reactflow.dev/"),sN=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:a,height:s,fitView:l,fitViewOptions:f,minZoom:p=.5,maxZoom:h=2,nodeOrigin:v,nodeExtent:g,zIndexMode:m="basic"}={})=>{let b=new Map,w=new Map,k=new Map,S=new Map,N=r??t??[],$=n??e??[],j=v??[0,0],E=g??ud;K1(k,S,N);let{nodesInitialized:I}=Ag($,b,w,{nodeOrigin:j,nodeExtent:E,zIndexMode:m}),z=[0,0,1];if(l&&a&&s){let{x:T,y:M,zoom:O}=Ng(hd(b,{filter:K=>!(!K.width&&!K.initialWidth||!K.height&&!K.initialHeight)}),a,s,p,h,f?.padding??.1);z=[T,M,O]}return{rfId:"1",width:a??0,height:s??0,transform:z,nodes:$,nodesInitialized:I,nodeLookup:b,parentLookup:w,edges:N,edgeLookup:S,connectionLookup:k,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:p,maxZoom:h,translateExtent:ud,nodeExtent:E,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:cd.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:j,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:l??!1,fitViewOptions:f,fitViewResolver:null,connection:{...p1},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:o3,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:h1,zIndexMode:m,defaultEdgeOptions:void 0,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map,onNodesDelete:void 0,onEdgesDelete:void 0,onDelete:void 0,onBeforeDelete:void 0,onViewportChangeStart:void 0,onViewportChange:void 0,onViewportChangeEnd:void 0,onNodeDragStart:void 0,onNodeDrag:void 0,onNodeDragStop:void 0,onSelectionDragStart:void 0,onSelectionDrag:void 0,onSelectionDragStop:void 0,onMoveStart:void 0,onMove:void 0,onMoveEnd:void 0,onConnect:void 0,onConnectStart:void 0,onConnectEnd:void 0,onClickConnectStart:void 0,onClickConnectEnd:void 0}},r3=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:a,height:s,fitView:l,fitViewOptions:f,minZoom:p,maxZoom:h,nodeOrigin:v,nodeExtent:g,zIndexMode:m})=>bI((b,w)=>{async function k(){let{nodeLookup:S,panZoom:N,fitViewOptions:$,fitViewResolver:j,width:E,height:I,minZoom:z,maxZoom:T}=w();N&&(await gD({nodes:S,width:E,height:I,panZoom:N,minZoom:z,maxZoom:T},$),j?.resolve(!0),b({fitViewResolver:null}))}return{...sN({nodes:e,edges:t,width:a,height:s,fitView:l,fitViewOptions:f,minZoom:p,maxZoom:h,nodeOrigin:v,nodeExtent:g,defaultNodes:n,defaultEdges:r,zIndexMode:m}),setNodes:S=>{let{nodeLookup:N,parentLookup:$,nodeOrigin:j,nodeExtent:E,elevateNodesOnSelect:I,fitViewQueued:z,zIndexMode:T,nodesSelectionActive:M}=w(),{nodesInitialized:O,hasSelectedNodes:K}=Ag(S,N,$,{nodeOrigin:j,nodeExtent:E,elevateNodesOnSelect:I,checkEquality:!0,zIndexMode:T}),B=M&&K;z&&O?(k(),b({nodes:S,nodesInitialized:O,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:B})):b({nodes:S,nodesInitialized:O,nodesSelectionActive:B})},setEdges:S=>{let{connectionLookup:N,edgeLookup:$}=w();K1(N,$,S),b({edges:S})},setDefaultNodesAndEdges:(S,N)=>{if(S){let{setNodes:$}=w();$(S),b({hasDefaultNodes:!0})}if(N){let{setEdges:$}=w();$(N),b({hasDefaultEdges:!0})}},updateNodeInternals:S=>{let{triggerNodeChanges:N,nodeLookup:$,parentLookup:j,domNode:E,nodeOrigin:I,nodeExtent:z,debug:T,fitViewQueued:M,zIndexMode:O}=w(),{changes:K,updatedInternals:B}=zD(S,$,j,E,I,z,O);B&&(DD($,j,{nodeOrigin:I,nodeExtent:z,zIndexMode:O}),M?(k(),b({fitViewQueued:!1,fitViewOptions:void 0})):b({}),K?.length>0&&(T&&console.log("React Flow: trigger node changes",K),N?.(K)))},updateNodePositions:(S,N=!1)=>{let $=[],j=[],{nodeLookup:E,triggerNodeChanges:I,connection:z,updateConnection:T,onNodesChangeMiddlewareMap:M}=w();for(let[O,K]of S){let B=E.get(O),V=!!(B?.expandParent&&B?.parentId&&K?.position),oe={id:O,type:"position",position:V?{x:Math.max(0,K.position.x),y:Math.max(0,K.position.y)}:K.position,dragging:N};if(B&&z.inProgress&&z.fromNode.id===B.id){let F=ia(B,z.fromHandle,Ce.Left,!0);T({...z,from:F})}V&&B.parentId&&$.push({id:O,parentId:B.parentId,rect:{...K.internals.positionAbsolute,width:K.measured.width??0,height:K.measured.height??0}}),j.push(oe)}if($.length>0){let{parentLookup:O,nodeOrigin:K}=w(),B=Mg($,E,O,K);j.push(...B)}for(let O of M.values())j=O(j);I(j)},triggerNodeChanges:S=>{let{onNodesChange:N,setNodes:$,nodes:j,hasDefaultNodes:E,debug:I}=w();S?.length&&(E&&$(Rg(S,j)),I&&console.log("React Flow: trigger node changes",S),N?.(S))},triggerEdgeChanges:S=>{let{onEdgesChange:N,setEdges:$,edges:j,hasDefaultEdges:E,debug:I}=w();S?.length&&(E&&$(zI(S,j)),I&&console.log("React Flow: trigger edge changes",S),N?.(S))},addSelectedNodes:S=>{let{multiSelectionActive:N,edgeLookup:$,nodeLookup:j,triggerNodeChanges:E,triggerEdgeChanges:I}=w();N?E(S.map(z=>aa(z,!0))):(E(As(j,new Set([...S]),!0)),I(As($)))},addSelectedEdges:S=>{let{multiSelectionActive:N,edgeLookup:$,nodeLookup:j,triggerNodeChanges:E,triggerEdgeChanges:I}=w();N?I(S.map(z=>aa(z,!0))):(I(As($,new Set([...S]))),E(As(j,new Set,!0)))},unselectNodesAndEdges:({nodes:S,edges:N}={})=>{let{edges:$,nodes:j,nodeLookup:E,triggerNodeChanges:I,triggerEdgeChanges:z}=w(),T=S||j,M=N||$,O=[];for(let B of T){if(!B.selected)continue;let V=E.get(B.id);V&&(V.selected=!1),O.push(aa(B.id,!1))}let K=[];for(let B of M)B.selected&&K.push(aa(B.id,!1));I(O),z(K)},setMinZoom:S=>{let{panZoom:N,maxZoom:$}=w();N?.setScaleExtent([S,$]),b({minZoom:S})},setMaxZoom:S=>{let{panZoom:N,minZoom:$}=w();N?.setScaleExtent([$,S]),b({maxZoom:S})},setTranslateExtent:S=>{w().panZoom?.setTranslateExtent(S),b({translateExtent:S})},resetSelectedElements:()=>{let{edges:S,nodes:N,triggerNodeChanges:$,triggerEdgeChanges:j,elementsSelectable:E}=w();if(!E)return;let I=N.reduce((T,M)=>M.selected?[...T,aa(M.id,!1)]:T,[]),z=S.reduce((T,M)=>M.selected?[...T,aa(M.id,!1)]:T,[]);$(I),j(z)},setNodeExtent:S=>{let{nodes:N,nodeLookup:$,parentLookup:j,nodeOrigin:E,elevateNodesOnSelect:I,nodeExtent:z,zIndexMode:T}=w();(S[0][0]!==z[0][0]||S[0][1]!==z[0][1]||S[1][0]!==z[1][0]||S[1][1]!==z[1][1])&&(Ag(N,$,j,{nodeOrigin:E,nodeExtent:S,elevateNodesOnSelect:I,checkEquality:!1,zIndexMode:T}),b({nodeExtent:S}))},panBy:S=>{let{transform:N,width:$,height:j,panZoom:E,translateExtent:I}=w();return FD({delta:S,panZoom:E,transform:N,translateExtent:I,width:$,height:j})},setCenter:async(S,N,$)=>{let{width:j,height:E,maxZoom:I,panZoom:z}=w();if(!z)return!1;let T=$?.zoom===void 0?I:$.zoom;return await z.setViewport({x:j/2-S*T,y:E/2-N*T,zoom:T},{duration:$?.duration,ease:$?.ease,interpolate:$?.interpolate}),!0},cancelConnection:()=>{b({connection:{...p1}})},updateConnection:S=>{b({connection:S})},reset:()=>b({...sN()})}},Object.is);function lN({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:a,initialHeight:s,initialMinZoom:l,initialMaxZoom:f,initialFitViewOptions:p,fitView:h,nodeOrigin:v,nodeExtent:g,zIndexMode:m,children:b}){let[w]=(0,A.useState)(()=>r3({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:a,height:s,fitView:h,minZoom:l,maxZoom:f,fitViewOptions:p,nodeOrigin:v,nodeExtent:g,zIndexMode:m}));return(0,c.jsx)(xI,{value:w,children:(0,c.jsx)(VI,{children:(0,c.jsx)(iL,{children:b})})})}function i3({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:a,width:s,height:l,fitView:f,fitViewOptions:p,minZoom:h,maxZoom:v,nodeOrigin:g,nodeExtent:m,zIndexMode:b}){return(0,A.useContext)(uf)?(0,c.jsx)(c.Fragment,{children:e}):(0,c.jsx)(lN,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:a,initialWidth:s,initialHeight:l,fitView:f,initialFitViewOptions:p,initialMinZoom:h,initialMaxZoom:v,nodeOrigin:g,nodeExtent:m,zIndexMode:b,children:e})}var a3={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function s3({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:a,nodeTypes:s,edgeTypes:l,onNodeClick:f,onEdgeClick:p,onInit:h,onMove:v,onMoveStart:g,onMoveEnd:m,onConnect:b,onConnectStart:w,onConnectEnd:k,onClickConnectStart:S,onClickConnectEnd:N,onNodeMouseEnter:$,onNodeMouseMove:j,onNodeMouseLeave:E,onNodeContextMenu:I,onNodeDoubleClick:z,onNodeDragStart:T,onNodeDrag:M,onNodeDragStop:O,onNodesDelete:K,onEdgesDelete:B,onDelete:V,onSelectionChange:oe,onSelectionDragStart:F,onSelectionDrag:J,onSelectionDragStop:L,onSelectionContextMenu:U,onSelectionStart:W,onSelectionEnd:re,onBeforeDelete:le,connectionMode:pe,connectionLineType:xe=ta.Bezier,connectionLineStyle:Ne,connectionLineComponent:we,connectionLineContainerStyle:R,deleteKeyCode:Q="Backspace",selectionKeyCode:fe="Shift",selectionOnDrag:X=!1,selectionMode:he=Jc.Full,panActivationKeyCode:Z="Space",multiSelectionKeyCode:q=yd()?"Meta":"Control",zoomActivationKeyCode:ee=yd()?"Meta":"Control",snapToGrid:de,snapGrid:me,onlyRenderVisibleElements:De=!1,selectNodesOnDrag:Fe,nodesDraggable:Ye,autoPanOnNodeFocus:Le,nodesConnectable:Be,nodesFocusable:ut,nodeOrigin:kt=cS,edgesFocusable:It,edgesReconnectable:zt,elementsSelectable:hn=!0,defaultViewport:Ft=OI,minZoom:Bt=.5,maxZoom:nn=2,translateExtent:pn=ud,preventScrolling:bt=!0,nodeExtent:mn,defaultMarkerColor:Uo="#b1b1b7",zoomOnScroll:$r=!0,zoomOnPinch:ja=!0,panOnScroll:Er=!1,panOnScrollSpeed:rn=.5,panOnScrollMode:Yo=Ns.Free,zoomOnDoubleClick:Sn=!0,panOnDrag:Ca=!0,onPaneClick:dl,onPaneMouseEnter:Xt,onPaneMouseMove:$a,onPaneMouseLeave:_r,onPaneScroll:Ni,onPaneContextMenu:Xo,paneClickDistance:Ea=1,nodeClickDistance:_a=0,children:ul,onReconnect:ji,onReconnectStart:Dn,onReconnectEnd:jt,onEdgeContextMenu:In,onEdgeDoubleClick:qt,onEdgeMouseEnter:Aa,onEdgeMouseMove:Ci,onEdgeMouseLeave:cl,reconnectRadius:Ar=10,onNodesChange:bo,onEdgesChange:Tr,noDragClassName:Qn="nodrag",noWheelClassName:Mr="nowheel",noPanClassName:Zt="nopan",fitView:$i,fitViewOptions:Or,connectOnClick:Ei,attributionPosition:Pr,proOptions:Zo,defaultEdgeOptions:Ta,elevateNodesOnSelect:Go=!0,elevateEdgesOnSelect:_i=!1,disableKeyboardA11y:Dr=!1,autoPanOnConnect:Ma,autoPanOnNodeDrag:D,autoPanOnSelection:G=!0,autoPanSpeed:ve,connectionRadius:be,isValidConnection:ke,onError:Te,style:Xe,id:Re,nodeDragThreshold:Ue,connectionDragThreshold:mt,viewport:ze,onViewportChange:Ht,width:xt,height:xo,colorMode:Qo="light",debug:Ir,onScroll:Lr,ariaLabelConfig:Rr,zIndexMode:Ct="basic",...cu},fu){let Oa=Re||"1",Jo=II(Qo),zr=(0,A.useCallback)(hu=>{hu.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),Lr?.(hu)},[Lr]);return(0,c.jsx)("div",{"data-testid":"rf__wrapper",...cu,onScroll:zr,style:{...Xe,...a3},ref:fu,className:Dt(["react-flow",a,Jo]),id:Re,role:"application",children:(0,c.jsxs)(i3,{nodes:e,edges:t,width:xt,height:xo,fitView:$i,fitViewOptions:Or,minZoom:Bt,maxZoom:nn,nodeOrigin:kt,nodeExtent:mn,zIndexMode:Ct,children:[(0,c.jsx)(DI,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:b,onConnectStart:w,onConnectEnd:k,onClickConnectStart:S,onClickConnectEnd:N,nodesDraggable:Ye,autoPanOnNodeFocus:Le,nodesConnectable:Be,nodesFocusable:ut,edgesFocusable:It,edgesReconnectable:zt,elementsSelectable:hn,elevateNodesOnSelect:Go,elevateEdgesOnSelect:_i,minZoom:Bt,maxZoom:nn,nodeExtent:mn,onNodesChange:bo,onEdgesChange:Tr,snapToGrid:de,snapGrid:me,connectionMode:pe,translateExtent:pn,connectOnClick:Ei,defaultEdgeOptions:Ta,fitView:$i,fitViewOptions:Or,onNodesDelete:K,onEdgesDelete:B,onDelete:V,onNodeDragStart:T,onNodeDrag:M,onNodeDragStop:O,onSelectionDrag:J,onSelectionDragStart:F,onSelectionDragStop:L,onMove:v,onMoveStart:g,onMoveEnd:m,noPanClassName:Zt,nodeOrigin:kt,rfId:Oa,autoPanOnConnect:Ma,autoPanOnNodeDrag:D,autoPanSpeed:ve,onError:Te,connectionRadius:be,isValidConnection:ke,selectNodesOnDrag:Fe,nodeDragThreshold:Ue,connectionDragThreshold:mt,onBeforeDelete:le,debug:Ir,ariaLabelConfig:Rr,zIndexMode:Ct}),(0,c.jsx)(n3,{onInit:h,onNodeClick:f,onEdgeClick:p,onNodeMouseEnter:$,onNodeMouseMove:j,onNodeMouseLeave:E,onNodeContextMenu:I,onNodeDoubleClick:z,nodeTypes:s,edgeTypes:l,connectionLineType:xe,connectionLineStyle:Ne,connectionLineComponent:we,connectionLineContainerStyle:R,selectionKeyCode:fe,selectionOnDrag:X,selectionMode:he,deleteKeyCode:Q,multiSelectionKeyCode:q,panActivationKeyCode:Z,zoomActivationKeyCode:ee,onlyRenderVisibleElements:De,defaultViewport:Ft,translateExtent:pn,minZoom:Bt,maxZoom:nn,preventScrolling:bt,zoomOnScroll:$r,zoomOnPinch:ja,zoomOnDoubleClick:Sn,panOnScroll:Er,panOnScrollSpeed:rn,panOnScrollMode:Yo,panOnDrag:Ca,autoPanOnSelection:G,onPaneClick:dl,onPaneMouseEnter:Xt,onPaneMouseMove:$a,onPaneMouseLeave:_r,onPaneScroll:Ni,onPaneContextMenu:Xo,paneClickDistance:Ea,nodeClickDistance:_a,onSelectionContextMenu:U,onSelectionStart:W,onSelectionEnd:re,onReconnect:ji,onReconnectStart:Dn,onReconnectEnd:jt,onEdgeContextMenu:In,onEdgeDoubleClick:qt,onEdgeMouseEnter:Aa,onEdgeMouseMove:Ci,onEdgeMouseLeave:cl,reconnectRadius:Ar,defaultMarkerColor:Uo,noDragClassName:Qn,noWheelClassName:Mr,noPanClassName:Zt,rfId:Oa,disableKeyboardA11y:Dr,nodeExtent:mn,viewport:ze,onViewportChange:Ht,nodesDraggable:Ye}),(0,c.jsx)(MI,{onSelectionChange:oe}),ul,(0,c.jsx)($I,{proOptions:Zo,position:Pr}),(0,c.jsx)(CI,{rfId:Oa,disableKeyboardA11y:Dr})]})})}var l3=kS(s3),d3=e=>e.domNode?.querySelector(".react-flow__edgelabel-renderer");function u3({children:e}){let t=Ke(d3);return t?(0,Lg.createPortal)(e,t):null}var c3=e=>e.domNode?.querySelector(".react-flow__viewport-portal");function dN({children:e}){let t=Ke(c3);return t?(0,Lg.createPortal)(e,t):null}function f3(){let e=pt();return(0,A.useCallback)(t=>{let{domNode:n,updateNodeInternals:r}=e.getState(),a=Array.isArray(t)?t:[t],s=new Map;a.forEach(l=>{let f=n?.querySelector(`.react-flow__node[data-id="${l}"]`);f&&s.set(l,{id:l,nodeElement:f,force:!0})}),requestAnimationFrame(()=>r(s,{triggerFitView:!1}))},[])}Wn.error014();function h3(e){return Ke((0,A.useCallback)(t=>t.nodeLookup.get(e),[e]),yt)}function p3({dimensions:e,lineWidth:t,variant:n,className:r}){return(0,c.jsx)("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:Dt(["react-flow__background-pattern",n,r])})}function m3({radius:e,className:t}){return(0,c.jsx)("circle",{cx:e,cy:e,r:e,className:Dt(["react-flow__background-pattern","dots",t])})}var hi;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(hi||={});var g3={[hi.Dots]:1,[hi.Lines]:1,[hi.Cross]:6},y3=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function uN({id:e,variant:t=hi.Dots,gap:n=20,size:r,lineWidth:a=1,offset:s=0,color:l,bgColor:f,style:p,className:h,patternClassName:v}){let g=(0,A.useRef)(null),{transform:m,patternId:b}=Ke(y3,yt),w=r||g3[t],k=t===hi.Dots,S=t===hi.Cross,N=Array.isArray(n)?n:[n,n],$=[N[0]*m[2]||1,N[1]*m[2]||1],j=w*m[2],E=Array.isArray(s)?s:[s,s],I=S?[j,j]:$,z=[E[0]*m[2]+I[0]/2,E[1]*m[2]+I[1]/2],T=`${b}${e||""}`;return(0,c.jsxs)("svg",{className:Dt(["react-flow__background",h]),style:{...p,...ff,"--xy-background-color-props":f,"--xy-background-pattern-color-props":l},ref:g,"data-testid":"rf__background",children:[(0,c.jsx)("pattern",{id:T,x:m[0]%$[0],y:m[1]%$[1],width:$[0],height:$[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${z[0]},-${z[1]})`,children:k?(0,c.jsx)(m3,{radius:j/2,className:v}):(0,c.jsx)(p3,{dimensions:I,lineWidth:a,variant:t,className:v})}),(0,c.jsx)("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${T})`})]})}uN.displayName="Background";var v3=(0,A.memo)(uN);function b3(){return(0,c.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:(0,c.jsx)("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function x3(){return(0,c.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:(0,c.jsx)("path",{d:"M0 0h32v4.2H0z"})})}function w3(){return(0,c.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:(0,c.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 k3(){return(0,c.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:(0,c.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 S3(){return(0,c.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:(0,c.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 wd({children:e,className:t,...n}){return(0,c.jsx)("button",{type:"button",className:Dt(["react-flow__controls-button",t]),...n,children:e})}var N3=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function cN({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:a,onZoomIn:s,onZoomOut:l,onFitView:f,onInteractiveChange:p,className:h,children:v,position:g="bottom-left",orientation:m="vertical","aria-label":b}){let w=pt(),{isInteractive:k,minZoomReached:S,maxZoomReached:N,ariaLabelConfig:$}=Ke(N3,yt),{zoomIn:j,zoomOut:E,fitView:I}=Ts();return(0,c.jsxs)(_s,{className:Dt(["react-flow__controls",m==="horizontal"?"horizontal":"vertical",h]),position:g,style:e,"data-testid":"rf__controls","aria-label":b??$["controls.ariaLabel"],children:[t&&(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(wd,{onClick:()=>{j(),s?.()},className:"react-flow__controls-zoomin",title:$["controls.zoomIn.ariaLabel"],"aria-label":$["controls.zoomIn.ariaLabel"],disabled:N,children:(0,c.jsx)(b3,{})}),(0,c.jsx)(wd,{onClick:()=>{E(),l?.()},className:"react-flow__controls-zoomout",title:$["controls.zoomOut.ariaLabel"],"aria-label":$["controls.zoomOut.ariaLabel"],disabled:S,children:(0,c.jsx)(x3,{})})]}),n&&(0,c.jsx)(wd,{className:"react-flow__controls-fitview",onClick:()=>{I(a),f?.()},title:$["controls.fitView.ariaLabel"],"aria-label":$["controls.fitView.ariaLabel"],children:(0,c.jsx)(w3,{})}),r&&(0,c.jsx)(wd,{className:"react-flow__controls-interactive",onClick:()=>{w.setState({nodesDraggable:!k,nodesConnectable:!k,elementsSelectable:!k}),p?.(!k)},title:$["controls.interactive.ariaLabel"],"aria-label":$["controls.interactive.ariaLabel"],children:k?(0,c.jsx)(S3,{}):(0,c.jsx)(k3,{})}),v]})}cN.displayName="Controls";var j3=(0,A.memo)(cN);function C3({id:e,x:t,y:n,width:r,height:a,style:s,color:l,strokeColor:f,strokeWidth:p,className:h,borderRadius:v,shapeRendering:g,selected:m,onClick:b}){let{background:w,backgroundColor:k}=s||{},S=l||w||k;return(0,c.jsx)("rect",{className:Dt(["react-flow__minimap-node",{selected:m},h]),x:t,y:n,rx:v,ry:v,width:r,height:a,style:{fill:S,stroke:f,strokeWidth:p},shapeRendering:g,onClick:b?N=>b(N,e):void 0})}var $3=(0,A.memo)(C3),E3=e=>e.nodes.map(t=>t.id),qg=e=>e instanceof Function?e:()=>e;function _3({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:a,nodeComponent:s=$3,onClick:l}){let f=Ke(E3,yt),p=qg(t),h=qg(e),v=qg(n),g=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return(0,c.jsx)(c.Fragment,{children:f.map(m=>(0,c.jsx)(T3,{id:m,nodeColorFunc:p,nodeStrokeColorFunc:h,nodeClassNameFunc:v,nodeBorderRadius:r,nodeStrokeWidth:a,NodeComponent:s,onClick:l,shapeRendering:g},m))})}function A3({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:a,nodeStrokeWidth:s,shapeRendering:l,NodeComponent:f,onClick:p}){let{node:h,x:v,y:g,width:m,height:b}=Ke(w=>{let k=w.nodeLookup.get(e);if(!k)return{node:void 0,x:0,y:0,width:0,height:0};let S=k.internals.userNode,{x:N,y:$}=k.internals.positionAbsolute,{width:j,height:E}=co(S);return{node:S,x:N,y:$,width:j,height:E}},yt);return!h||h.hidden||!N1(h)?null:(0,c.jsx)(f,{x:v,y:g,width:m,height:b,style:h.style,selected:!!h.selected,className:r(h),color:t(h),borderRadius:a,strokeColor:n(h),strokeWidth:s,shapeRendering:l,onClick:p,id:h.id})}var T3=(0,A.memo)(A3),M3=(0,A.memo)(_3),O3=200,P3=150,D3=e=>!e.hidden,I3=e=>{let 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]},n=!1;for(let r of e.nodeLookup.values())if(!r.hidden){n=!0;break}return{viewBB:t,boundingRect:n?x1(hd(e.nodeLookup,{filter:D3}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},fN=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,L3=(e,t)=>fN(e.viewBB,t.viewBB)&&fN(e.boundingRect,t.boundingRect)&&e.rfId===t.rfId&&e.panZoom===t.panZoom&&e.translateExtent===t.translateExtent&&e.flowWidth===t.flowWidth&&e.flowHeight===t.flowHeight&&e.ariaLabelConfig===t.ariaLabelConfig,R3="react-flow__minimap-desc";function hN({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:a="",nodeBorderRadius:s=5,nodeStrokeWidth:l,nodeComponent:f,bgColor:p,maskColor:h,maskStrokeColor:v,maskStrokeWidth:g,position:m="bottom-right",onClick:b,onNodeClick:w,pannable:k=!1,zoomable:S=!1,ariaLabel:N,inversePan:$,zoomStep:j=1,offsetScale:E=5}){let I=pt(),z=(0,A.useRef)(null),{boundingRect:T,panZoom:M,viewBB:O,rfId:K,translateExtent:B,flowWidth:V,flowHeight:oe,ariaLabelConfig:F}=Ke(I3,L3),J=e?.width??O3,L=e?.height??P3,U=T.width/J,W=T.height/L,re=Math.max(U,W),le=re*J,pe=re*L,xe=E*re,Ne=T.x-(le-T.width)/2-xe,we=T.y-(pe-T.height)/2-xe,R=le+xe*2,Q=pe+xe*2,fe=`${R3}-${K}`,X=(0,A.useRef)(0),he=(0,A.useRef)();X.current=re,(0,A.useEffect)(()=>{let me=I.getState().panZoom;if(z.current&&me)return he.current=XD({domNode:z.current,panZoom:me,getTransform:()=>I.getState().transform,getViewScale:()=>X.current}),()=>{he.current?.destroy()}},[M]),(0,A.useEffect)(()=>{he.current?.update({translateExtent:B,width:V,height:oe,inversePan:$,pannable:k,zoomStep:j,zoomable:S})},[k,S,$,j,B,V,oe]);let Z=b?me=>{let[De,Fe]=he.current?.pointer(me)||[0,0];b(me,{x:De,y:Fe})}:void 0,q=(0,A.useCallback)((me,De)=>{let Fe=I.getState().nodeLookup.get(De).internals.userNode;w?.(me,Fe)},[w]),ee=w?q:void 0,de=N??F["minimap.ariaLabel"];return(0,c.jsx)(_s,{position:m,style:{...e,"--xy-minimap-background-color-props":typeof p=="string"?p:void 0,"--xy-minimap-mask-background-color-props":typeof h=="string"?h:void 0,"--xy-minimap-mask-stroke-color-props":typeof v=="string"?v:void 0,"--xy-minimap-mask-stroke-width-props":typeof g=="number"?g*re: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 l=="number"?l:void 0},className:Dt(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:(0,c.jsxs)("svg",{width:J,height:L,viewBox:`${Ne} ${we} ${R} ${Q}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":fe,ref:z,onClick:Z,children:[de&&(0,c.jsx)("title",{id:fe,children:de}),(0,c.jsx)(M3,{onClick:ee,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:s,nodeClassName:a,nodeStrokeWidth:l,nodeComponent:f}),(0,c.jsx)("path",{className:"react-flow__minimap-mask",d:`M${Ne-xe},${we-xe}h${R+xe*2}v${Q+xe*2}h${-R-xe*2}z
|
|
15
|
+
M${O.x},${O.y}h${O.width}v${O.height}h${-O.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}hN.displayName="MiniMap";var z3=(0,A.memo)(hN),F3=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,B3={[Es.Line]:"right",[Es.Handle]:"bottom-right"};function q3({nodeId:e,position:t,variant:n=Es.Handle,className:r,style:a=void 0,children:s,color:l,minWidth:f=10,minHeight:p=10,maxWidth:h=Number.MAX_VALUE,maxHeight:v=Number.MAX_VALUE,keepAspectRatio:g=!1,resizeDirection:m,autoScale:b=!0,shouldResize:w,onResizeStart:k,onResize:S,onResizeEnd:N}){let $=_S(),j=typeof e=="string"?e:$,E=pt(),I=(0,A.useRef)(null),z=n===Es.Handle,T=Ke((0,A.useCallback)(F3(z&&b),[z,b]),yt),M=(0,A.useRef)(null),O=t??B3[n];(0,A.useEffect)(()=>{if(I.current&&j)return M.current||=uI({domNode:I.current,nodeId:j,getStoreItems:()=>{let{nodeLookup:B,transform:V,snapGrid:oe,snapToGrid:F,nodeOrigin:J,domNode:L}=E.getState();return{nodeLookup:B,transform:V,snapGrid:oe,snapToGrid:F,nodeOrigin:J,paneDomNode:L}},onChange:(B,V)=>{let{triggerNodeChanges:oe,nodeLookup:F,parentLookup:J,nodeOrigin:L}=E.getState(),U=[],W={x:B.x,y:B.y},re=F.get(j);if(re&&re.expandParent&&re.parentId){let le=re.origin??L,pe=B.width??re.measured.width??0,xe=B.height??re.measured.height??0,Ne=Mg([{id:re.id,parentId:re.parentId,rect:{width:pe,height:xe,...j1({x:B.x??re.position.x,y:B.y??re.position.y},{width:pe,height:xe},re.parentId,F,le)}}],F,J,L);U.push(...Ne),W.x=B.x?Math.max(le[0]*pe,B.x):void 0,W.y=B.y?Math.max(le[1]*xe,B.y):void 0}if(W.x!==void 0&&W.y!==void 0){let le={id:j,type:"position",position:{...W}};U.push(le)}if(B.width!==void 0&&B.height!==void 0){let le={id:j,type:"dimensions",resizing:!0,setAttributes:m?m==="horizontal"?"width":"height":!0,dimensions:{width:B.width,height:B.height}};U.push(le)}for(let le of V){let pe={...le,type:"position"};U.push(pe)}oe(U)},onEnd:({width:B,height:V})=>{let oe={id:j,type:"dimensions",resizing:!1,dimensions:{width:B,height:V}};E.getState().triggerNodeChanges([oe])}}),M.current.update({controlPosition:O,boundaries:{minWidth:f,minHeight:p,maxWidth:h,maxHeight:v},keepAspectRatio:g,resizeDirection:m,onResizeStart:k,onResize:S,onResizeEnd:N,shouldResize:w}),()=>{M.current?.destroy()}},[O,f,p,h,v,g,k,S,N,w]);let K=O.split("-");return(0,c.jsx)("div",{className:Dt(["react-flow__resize-control","nodrag",...K,n,r]),ref:I,style:{...a,scale:T,...l&&{[z?"backgroundColor":"borderColor"]:l}},children:s})}var pN=(0,A.memo)(q3);function H3({nodeId:e,isVisible:t=!0,handleClassName:n,handleStyle:r,lineClassName:a,lineStyle:s,color:l,minWidth:f=10,minHeight:p=10,maxWidth:h=Number.MAX_VALUE,maxHeight:v=Number.MAX_VALUE,keepAspectRatio:g=!1,autoScale:m=!0,shouldResize:b,onResizeStart:w,onResize:k,onResizeEnd:S}){return t?(0,c.jsxs)(c.Fragment,{children:[iI.map(N=>(0,c.jsx)(pN,{className:a,style:s,nodeId:e,position:N,variant:Es.Line,color:l,minWidth:f,minHeight:p,maxWidth:h,maxHeight:v,onResizeStart:w,keepAspectRatio:g,autoScale:m,shouldResize:b,onResize:k,onResizeEnd:S},N)),rI.map(N=>(0,c.jsx)(pN,{className:n,style:r,nodeId:e,position:N,color:l,minWidth:f,minHeight:p,maxWidth:h,maxHeight:v,onResizeStart:w,keepAspectRatio:g,autoScale:m,shouldResize:b,onResize:k,onResizeEnd:S},N))]}):null}var sa=[{id:"inventory",label:"Inventory",hint:"Which hosts each step runs on, counted in your inventory"},{id:"data",label:"Data",hint:"What each step reads and sets, with dotted wires from where each input comes"},{id:"code",label:"Code",hint:"What each step runs (module, role or playbook) and whether your environment has it"},{id:"access",label:"Access",hint:"Who each step acts as: credential, user, become, vaulted variables"},{id:"timing",label:"Timing",hint:"Batches, timeouts and measured durations, against the maintenance window"},{id:"changes",label:"Changes",hint:"What changed since another version of the flow: HEAD, a branch or a commit"}],V3=new Set(["ready","run","launchCheck","launchRun","launchCancel","stopRun","showRun","runOutput","showRunOutput","approve","catalog","copyText","openLink","inspectResult","pngRendered","cspViolation","perf"]);function mN(e){return V3.has(e)}var K3="This view only shows and runs the flow",W3=()=>typeof acquireVsCodeApi=="function";function U3(){let e=acquireVsCodeApi();return{hostName:"VS Code",post:t=>e.postMessage(t),subscribe(t){let n=r=>t(r.data);return window.addEventListener("message",n),()=>window.removeEventListener("message",n)},getState:()=>e.getState(),setState:t=>e.setState(t)}}var pf,gN,Hg=new Set,kd=new Map,Y3=1,Vg=new Set,Kg=()=>{for(let e of Vg)e(kd.size)};function X3(e){return Vg.add(e),()=>Vg.delete(e)}function Z3(e){if(e&&typeof e=="object"&&"type"in e){e.type==="ack"&&(kd.get(e.reqId)?.({ok:e.ok,error:e.error,created:e.created,pasted:e.pasted}),kd.delete(e.reqId),Kg());for(let t of Hg)t(e)}}function yN(e){gN?.(),pf=e,gN=e.subscribe(Z3)}W3()&&yN(U3());function Wg(){if(!pf)throw Error("The designer has no host: call setTransport() first");return pf}var Ug=!1;function G3(){Ug=!0}function je(e){(!Ug||mN(e.type))&&Wg().post(e)}function Yg(e){return Hg.add(e),()=>Hg.delete(e)}var Q3=12e4;function mf(e){let t=Y3++;return Ug&&!mN(e(t).type)?Promise.resolve({ok:!1,error:K3}):new Promise(n=>{let r=setTimeout(()=>{kd.delete(t)&&(Kg(),n({ok:!1,error:`${pf?.hostName??"The host"} did not answer in 2 minutes: the change may not have been made`}))},Q3);kd.set(t,a=>{clearTimeout(r),n(a)}),Kg(),je(e(t))})}var J3=e=>mf(t=>({type:"driftAction",reqId:t,action:e})),gf=e=>mf(t=>({type:"scenarioEdit",reqId:t,request:e})),eR=()=>mf(e=>({type:"scenarioUndo",reqId:e})),la=e=>mf(t=>({type:"command",reqId:t,command:e}));function Ms(){return Wg().getState()??{}}function Xg(e){Wg().setState(e)}var Zg=Symbol.for("yaml.alias"),Gg=Symbol.for("yaml.document"),pi=Symbol.for("yaml.map"),vN=Symbol.for("yaml.pair"),Po=Symbol.for("yaml.scalar"),Os=Symbol.for("yaml.seq"),Un=Symbol.for("yaml.node.type"),br=e=>!!e&&typeof e=="object"&&e[Un]===Zg,Sd=e=>!!e&&typeof e=="object"&&e[Un]===Gg,Do=e=>!!e&&typeof e=="object"&&e[Un]===pi,Et=e=>!!e&&typeof e=="object"&&e[Un]===vN,rt=e=>!!e&&typeof e=="object"&&e[Un]===Po,Io=e=>!!e&&typeof e=="object"&&e[Un]===Os;function _t(e){if(e&&typeof e=="object")switch(e[Un]){case pi:case Os:return!0}return!1}function At(e){if(e&&typeof e=="object")switch(e[Un]){case Zg:case pi:case Po:case Os:return!0}return!1}var bN=e=>(rt(e)||_t(e))&&!!e.anchor,da=Symbol("break visit"),tR=Symbol("skip children"),Nd=Symbol("remove node");function mi(e,t){let n=nR(t);Sd(e)?Ps(null,e.contents,n,Object.freeze([e]))===Nd&&(e.contents=null):Ps(null,e,n,Object.freeze([]))}mi.BREAK=da,mi.SKIP=tR,mi.REMOVE=Nd;function Ps(e,t,n,r){let a=oR(e,t,n,r);if(At(a)||Et(a))return rR(e,r,a),Ps(e,a,n,r);if(typeof a!="symbol"){if(_t(t)){r=Object.freeze(r.concat(t));for(let s=0;s<t.items.length;++s){let l=Ps(s,t.items[s],n,r);if(typeof l=="number")s=l-1;else{if(l===da)return da;l===Nd&&(t.items.splice(s,1),--s)}}}else if(Et(t)){r=Object.freeze(r.concat(t));let s=Ps("key",t.key,n,r);if(s===da)return da;s===Nd&&(t.key=null);let l=Ps("value",t.value,n,r);if(l===da)return da;l===Nd&&(t.value=null)}}return a}function nR(e){return typeof e=="object"&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function oR(e,t,n,r){if(typeof n=="function")return n(e,t,r);if(Do(t))return n.Map?.(e,t,r);if(Io(t))return n.Seq?.(e,t,r);if(Et(t))return n.Pair?.(e,t,r);if(rt(t))return n.Scalar?.(e,t,r);if(br(t))return n.Alias?.(e,t,r)}function rR(e,t,n){let r=t[t.length-1];if(_t(r))r.items[e]=n;else if(Et(r))e==="key"?r.key=n:r.value=n;else if(Sd(r))r.contents=n;else{let a=br(r)?"alias":"scalar";throw Error(`Cannot replace node with ${a} parent`)}}var iR={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},aR=e=>e.replace(/[!,[\]{}]/g,t=>iR[t]),Ds=class Cr{constructor(t,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},Cr.defaultYaml,t),this.tags=Object.assign({},Cr.defaultTags,n)}clone(){let t=new Cr(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){let t=new Cr(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:Cr.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},Cr.defaultTags)}return t}add(t,n){this.atNextDocument&&=(this.yaml={explicit:Cr.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},Cr.defaultTags),!1);let r=t.trim().split(/[ \t]+/),a=r.shift();switch(a){case"%TAG":{if(r.length!==2&&(n(0,"%TAG directive should contain exactly two parts"),r.length<2))return!1;let[s,l]=r;return this.tags[s]=l,!0}case"%YAML":{if(this.yaml.explicit=!0,r.length!==1)return n(0,"%YAML directive should contain exactly one part"),!1;let[s]=r;if(s==="1.1"||s==="1.2")return this.yaml.version=s,!0;{let l=/^\d+\.\d+$/.test(s);return n(6,`Unsupported YAML version ${s}`,l),!1}}default:return n(0,`Unknown directive ${a}`,!0),!1}}tagName(t,n){if(t==="!")return"!";if(t[0]!=="!")return n(`Not a valid tag: ${t}`),null;if(t[1]==="<"){let l=t.slice(2,-1);return l==="!"||l==="!!"?(n(`Verbatim tags aren't resolved, so ${t} is invalid.`),null):(t[t.length-1]!==">"&&n("Verbatim tags must end with a >"),l)}let[,r,a]=t.match(/^(.*!)([^!]*)$/s);a||n(`The ${t} tag has no suffix`);let s=this.tags[r];if(s)try{return s+decodeURIComponent(a)}catch(l){return n(String(l)),null}return r==="!"?t:(n(`Could not resolve tag: ${t}`),null)}tagString(t){for(let[n,r]of Object.entries(this.tags))if(t.startsWith(r))return n+aR(t.substring(r.length));return t[0]==="!"?t:`!<${t}>`}toString(t){let n=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],r=Object.entries(this.tags),a;if(t&&r.length>0&&At(t.contents)){let s={};mi(t.contents,(l,f)=>{At(f)&&f.tag&&(s[f.tag]=!0)}),a=Object.keys(s)}else a=[];for(let[s,l]of r)s==="!!"&&l==="tag:yaml.org,2002:"||t&&!a.some(f=>f.startsWith(l))||n.push(`%TAG ${s} ${l}`);return n.join(`
|
|
16
|
+
`)}};Ds.defaultYaml={explicit:!1,version:"1.2"},Ds.defaultTags={"!!":"tag:yaml.org,2002:"};function xN(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw Error(t)}return!0}function wN(e){let t=new Set;return mi(e,{Value(n,r){r.anchor&&t.add(r.anchor)}}),t}function kN(e,t){for(let n=1;;++n){let r=`${e}${n}`;if(!t.has(r))return r}}function sR(e,t){let n=[],r=new Map,a=null;return{onAnchor:s=>{n.push(s),a??=wN(e);let l=kN(t,a);return a.add(l),l},setAnchors:()=>{for(let s of n){let l=r.get(s);if(typeof l=="object"&&l.anchor&&(rt(l.node)||_t(l.node)))l.node.anchor=l.anchor;else{let f=Error("Failed to resolve repeated object (this should not happen)");throw f.source=s,f}}},sourceObjects:r}}function Is(e,t,n,r){if(r&&typeof r=="object")if(Array.isArray(r))for(let a=0,s=r.length;a<s;++a){let l=r[a],f=Is(e,r,String(a),l);f===void 0?delete r[a]:f!==l&&(r[a]=f)}else if(r instanceof Map)for(let a of Array.from(r.keys())){let s=r.get(a),l=Is(e,r,a,s);l===void 0?r.delete(a):l!==s&&r.set(a,l)}else if(r instanceof Set)for(let a of Array.from(r)){let s=Is(e,r,a,a);s===void 0?r.delete(a):s!==a&&(r.delete(a),r.add(s))}else for(let[a,s]of Object.entries(r)){let l=Is(e,r,a,s);l===void 0?delete r[a]:l!==s&&(r[a]=l)}return e.call(t,n,r)}function Yn(e,t,n){if(Array.isArray(e))return e.map((r,a)=>Yn(r,String(a),n));if(e&&typeof e.toJSON=="function"){if(!n||!bN(e))return e.toJSON(t,n);let r={aliasCount:0,count:1,res:void 0};n.anchors.set(e,r),n.onCreate=s=>{r.res=s,delete n.onCreate};let a=e.toJSON(t,n);return n.onCreate&&n.onCreate(a),a}return typeof e=="bigint"&&!n?.keep?Number(e):e}var Qg=class{constructor(e){Object.defineProperty(this,Un,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:t,maxAliasCount:n,onAnchor:r,reviver:a}={}){if(!Sd(e))throw TypeError("A document argument is required");let s={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof n=="number"?n:100},l=Yn(this,"",s);if(typeof r=="function")for(let{count:f,res:p}of s.anchors.values())r(p,f);return typeof a=="function"?Is(a,{"":l},"",l):l}},Jg=class extends Qg{constructor(e){super(Zg),this.source=e,Object.defineProperty(this,"tag",{set(){throw Error("Alias nodes cannot have tags")}})}resolve(e,t){if(t?.maxAliasCount===0)throw ReferenceError("Alias resolution is disabled");let n;t?.aliasResolveCache?n=t.aliasResolveCache:(n=[],mi(e,{Node:(a,s)=>{(br(s)||bN(s))&&n.push(s)}}),t&&(t.aliasResolveCache=n));let r;for(let a of n){if(a===this)break;a.anchor===this.source&&(r=a)}if(r&&t){let{anchors:a,doc:s,maxAliasCount:l}=t,f=a.get(r);if(f||=(Yn(r,null,t),a.get(r)),f?.res===void 0)throw ReferenceError("This should not happen: Alias anchor was not resolved?");if(l>=0&&(f.count+=1,f.aliasCount===0&&(f.aliasCount=yf(s,r,a)),f.count*f.aliasCount>l))throw ReferenceError("Excessive alias count indicates a resource exhaustion attack")}return r}toJSON(e,t){if(!t)return{source:this.source};let n=this.resolve(t.doc,t);if(!n){let r=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(r)}return t.anchors.get(n).res}toString(e,t,n){let r=`*${this.source}`;if(e){if(xN(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let a=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(a)}if(e.implicitKey)return`${r} `}return r}};function yf(e,t,n){if(br(t)){let r=t.resolve(e),a=n&&r&&n.get(r);return a?a.count*a.aliasCount:0}if(_t(t)){let r=0;for(let a of t.items){let s=yf(e,a,n);s>r&&(r=s)}return r}if(Et(t)){let r=yf(e,t.key,n),a=yf(e,t.value,n);return Math.max(r,a)}return 1}var SN=e=>!e||typeof e!="function"&&typeof e!="object",qe=class extends Qg{constructor(e){super(Po),this.value=e}toJSON(e,t){return t?.keep?this.value:Yn(this.value,e,t)}toString(){return String(this.value)}};qe.BLOCK_FOLDED="BLOCK_FOLDED",qe.BLOCK_LITERAL="BLOCK_LITERAL",qe.PLAIN="PLAIN",qe.QUOTE_DOUBLE="QUOTE_DOUBLE",qe.QUOTE_SINGLE="QUOTE_SINGLE";var lR="tag:yaml.org,2002:";function dR(e,t,n){if(t){let r=n.filter(s=>s.tag===t),a=r.find(s=>!s.format)??r[0];if(!a)throw Error(`Tag ${t} not found`);return a}return n.find(r=>r.identify?.(e)&&!r.format)}function jd(e,t,n){if(Sd(e)&&(e=e.contents),At(e))return e;if(Et(e)){let g=n.schema[pi].createNode?.(n.schema,null,n);return g.items.push(e),g}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<"u"&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:r,onAnchor:a,onTagObj:s,schema:l,sourceObjects:f}=n,p;if(r&&e&&typeof e=="object"){if(p=f.get(e),p)return p.anchor??(p.anchor=a(e)),new Jg(p.anchor);p={anchor:null,node:null},f.set(e,p)}t?.startsWith("!!")&&(t=lR+t.slice(2));let h=dR(e,t,l.tags);if(!h){if(e&&typeof e.toJSON=="function"&&(e=e.toJSON()),!e||typeof e!="object"){let g=new qe(e);return p&&(p.node=g),g}h=e instanceof Map?l[pi]:Symbol.iterator in Object(e)?l[Os]:l[pi]}s&&(s(h),delete n.onTagObj);let v=h?.createNode?h.createNode(n.schema,e,n):typeof h?.nodeClass?.from=="function"?h.nodeClass.from(n.schema,e,n):new qe(e);return t?v.tag=t:h.default||(v.tag=h.tag),p&&(p.node=v),v}function vf(e,t,n){let r=n;for(let a=t.length-1;a>=0;--a){let s=t[a];if(typeof s=="number"&&Number.isInteger(s)&&s>=0){let l=[];l[s]=r,r=l}else r=new Map([[s,r]])}return jd(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error("This should not happen, please report a bug.")},schema:e,sourceObjects:new Map})}var Cd=e=>e==null||typeof e=="object"&&!!e[Symbol.iterator]().next().done,NN=class extends Qg{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(n=>At(n)||Et(n)?n.clone(e):n),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(Cd(e))this.add(t);else{let[n,...r]=e,a=this.get(n,!0);if(_t(a))a.addIn(r,t);else if(a===void 0&&this.schema)this.set(n,vf(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}deleteIn(e){let[t,...n]=e;if(n.length===0)return this.delete(t);let r=this.get(t,!0);if(_t(r))return r.deleteIn(n);throw Error(`Expected YAML collection at ${t}. Remaining path: ${n}`)}getIn(e,t){let[n,...r]=e,a=this.get(n,!0);return r.length===0?!t&&rt(a)?a.value:a:_t(a)?a.getIn(r,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!Et(t))return!1;let n=t.value;return n==null||e&&rt(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[t,...n]=e;if(n.length===0)return this.has(t);let r=this.get(t,!0);return _t(r)?r.hasIn(n):!1}setIn(e,t){let[n,...r]=e;if(r.length===0)this.set(n,t);else{let a=this.get(n,!0);if(_t(a))a.setIn(r,t);else if(a===void 0&&this.schema)this.set(n,vf(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}},uR=e=>e.replace(/^(?!$)(?: $)?/gm,"#");function xr(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}var ua=(e,t,n)=>e.endsWith(`
|
|
17
|
+
`)?xr(n,t):n.includes(`
|
|
18
|
+
`)?`
|
|
19
|
+
`+xr(n,t):(e.endsWith(" ")?"":" ")+n,jN="flow",cR="block",fR="quoted";function bf(e,t,n="flow",{indentAtStart:r,lineWidth:a=80,minContentWidth:s=20,onFold:l,onOverflow:f}={}){if(!a||a<0)return e;a<s&&(s=0);let p=Math.max(1+s,1+a-t.length);if(e.length<=p)return e;let h=[],v={},g=a-t.length;typeof r=="number"&&(r>a-Math.max(2,s)?h.push(0):g=a-r);let m,b,w=!1,k=-1,S=-1,N=-1;n==="block"&&(k=CN(e,k,t.length),k!==-1&&(g=k+p));for(let j;j=e[k+=1];){if(n==="quoted"&&j==="\\"){switch(S=k,e[k+1]){case"x":k+=3;break;case"u":k+=5;break;case"U":k+=9;break;default:k+=1}N=k}if(j===`
|
|
20
|
+
`)n==="block"&&(k=CN(e,k,t.length)),g=k+t.length+p,m=void 0;else{if(j===" "&&b&&b!==" "&&b!==`
|
|
21
|
+
`&&b!==" "){let E=e[k+1];E&&E!==" "&&E!==`
|
|
22
|
+
`&&E!==" "&&(m=k)}if(k>=g)if(m)h.push(m),g=m+p,m=void 0;else if(n==="quoted"){for(;b===" "||b===" ";)b=j,j=e[k+=1],w=!0;let E=k>N+1?k-2:S-1;if(v[E])return e;h.push(E),v[E]=!0,g=E+p,m=void 0}else w=!0}b=j}if(w&&f&&f(),h.length===0)return e;l&&l();let $=e.slice(0,h[0]);for(let j=0;j<h.length;++j){let E=h[j],I=h[j+1]||e.length;E===0?$=`
|
|
23
|
+
${t}${e.slice(0,I)}`:(n==="quoted"&&v[E]&&($+=`${e[E]}\\`),$+=`
|
|
24
|
+
${t}${e.slice(E+1,I)}`)}return $}function CN(e,t,n){let r=t,a=t+1,s=e[a];for(;s===" "||s===" ";)if(t<a+n)s=e[++t];else{do s=e[++t];while(s&&s!==`
|
|
25
|
+
`);r=t,a=t+1,s=e[a]}return r}var xf=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),wf=e=>/^(%|---|\.\.\.)/m.test(e);function hR(e,t,n){if(!t||t<0)return!1;let r=t-n,a=e.length;if(a<=r)return!1;for(let s=0,l=0;s<a;++s)if(e[s]===`
|
|
26
|
+
`){if(s-l>r)return!0;if(l=s+1,a-l<=r)return!1}return!0}function $d(e,t){let n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;let{implicitKey:r}=t,a=t.options.doubleQuotedMinMultiLineLength,s=t.indent||(wf(e)?" ":""),l="",f=0;for(let p=0,h=n[p];h;h=n[++p])if(h===" "&&n[p+1]==="\\"&&n[p+2]==="n"&&(l+=n.slice(f,p)+"\\ ",p+=1,f=p,h="\\"),h==="\\")switch(n[p+1]){case"u":{l+=n.slice(f,p);let v=n.substr(p+2,4);switch(v){case"0000":l+="\\0";break;case"0007":l+="\\a";break;case"000b":l+="\\v";break;case"001b":l+="\\e";break;case"0085":l+="\\N";break;case"00a0":l+="\\_";break;case"2028":l+="\\L";break;case"2029":l+="\\P";break;default:v.substr(0,2)==="00"?l+="\\x"+v.substr(2):l+=n.substr(p,6)}p+=5,f=p+1}break;case"n":if(r||n[p+2]==='"'||n.length<a)p+=1;else{for(l+=n.slice(f,p)+`
|
|
27
|
+
|
|
28
|
+
`;n[p+2]==="\\"&&n[p+3]==="n"&&n[p+4]!=='"';)l+=`
|
|
29
|
+
`,p+=2;l+=s,n[p+2]===" "&&(l+="\\"),p+=1,f=p+1}break;default:p+=1}return l=f?l+n.slice(f):n,r?l:bf(l,s,fR,xf(t,!1))}function e0(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
|
|
30
|
+
`)||/[ \t]\n|\n[ \t]/.test(e))return $d(e,t);let n=t.indent||(wf(e)?" ":""),r="'"+e.replace(/'/g,"''").replace(/\n+/g,`$&
|
|
31
|
+
${n}`)+"'";return t.implicitKey?r:bf(r,n,jN,xf(t,!1))}function Ls(e,t){let{singleQuote:n}=t.options,r;if(n===!1)r=$d;else{let a=e.includes('"'),s=e.includes("'");r=a&&!s?e0:s&&!a?$d:n?e0:$d}return r(e,t)}var t0;try{t0=RegExp(`(^|(?<!
|
|
32
|
+
))
|
|
33
|
+
+(?!
|
|
34
|
+
|$)`,"g")}catch{t0=/\n+(?!\n|$)/g}function kf({comment:e,type:t,value:n},r,a,s){let{blockQuote:l,commentString:f,lineWidth:p}=r.options;if(!l||/\n[\t ]+$/.test(n))return Ls(n,r);let h=r.indent||(r.forceBlockIndent||wf(n)?" ":""),v=l==="literal"?!0:l==="folded"||t===qe.BLOCK_FOLDED?!1:t===qe.BLOCK_LITERAL||!hR(n,p,h.length);if(!n)return v?`|
|
|
35
|
+
`:`>
|
|
36
|
+
`;let g,m;for(m=n.length;m>0;--m){let E=n[m-1];if(E!==`
|
|
37
|
+
`&&E!==" "&&E!==" ")break}let b=n.substring(m),w=b.indexOf(`
|
|
38
|
+
`);w===-1?g="-":n===b||w!==b.length-1?(g="+",s&&s()):g="",b&&=(n=n.slice(0,-b.length),b[b.length-1]===`
|
|
39
|
+
`&&(b=b.slice(0,-1)),b.replace(t0,`$&${h}`));let k=!1,S,N=-1;for(S=0;S<n.length;++S){let E=n[S];if(E===" ")k=!0;else if(E===`
|
|
40
|
+
`)N=S;else break}let $=n.substring(0,N<S?N+1:S);$&&=(n=n.substring($.length),$.replace(/\n+/g,`$&${h}`));let j=(k?h?"2":"1":"")+g;if(e&&(j+=" "+f(e.replace(/ ?[\r\n]+/g," ")),a&&a()),!v){let E=n.replace(/\n+/g,`
|
|
41
|
+
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${h}`),I=!1,z=xf(r,!0);l!=="folded"&&t!==qe.BLOCK_FOLDED&&(z.onOverflow=()=>{I=!0});let T=bf(`${$}${E}${b}`,h,cR,z);if(!I)return`>${j}
|
|
42
|
+
${h}${T}`}return n=n.replace(/\n+/g,`$&${h}`),`|${j}
|
|
43
|
+
${h}${$}${n}${b}`}function pR(e,t,n,r){let{type:a,value:s}=e,{actualString:l,implicitKey:f,indent:p,indentStep:h,inFlow:v}=t;if(f&&s.includes(`
|
|
44
|
+
`)||v&&/[[\]{},]/.test(s))return Ls(s,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(s))return f||v||!s.includes(`
|
|
45
|
+
`)?Ls(s,t):kf(e,t,n,r);if(!f&&!v&&a!==qe.PLAIN&&s.includes(`
|
|
46
|
+
`))return kf(e,t,n,r);if(wf(s)){if(p==="")return t.forceBlockIndent=!0,kf(e,t,n,r);if(f&&p===h)return Ls(s,t)}let g=s.replace(/\n+/g,`$&
|
|
47
|
+
${p}`);if(l){let m=k=>k.default&&k.tag!=="tag:yaml.org,2002:str"&&k.test?.test(g),{compat:b,tags:w}=t.doc.schema;if(w.some(m)||b?.some(m))return Ls(s,t)}return f?g:bf(g,p,jN,xf(t,!1))}function n0(e,t,n,r){let{implicitKey:a,inFlow:s}=t,l=typeof e.value=="string"?e:Object.assign({},e,{value:String(e.value)}),{type:f}=e;f!==qe.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(l.value)&&(f=qe.QUOTE_DOUBLE);let p=v=>{switch(v){case qe.BLOCK_FOLDED:case qe.BLOCK_LITERAL:return a||s?Ls(l.value,t):kf(l,t,n,r);case qe.QUOTE_DOUBLE:return $d(l.value,t);case qe.QUOTE_SINGLE:return e0(l.value,t);case qe.PLAIN:return pR(l,t,n,r);default:return null}},h=p(f);if(h===null){let{defaultKeyType:v,defaultStringType:g}=t.options,m=a&&v||g;if(h=p(m),h===null)throw Error(`Unsupported default string type ${m}`)}return h}function $N(e,t){let n=Object.assign({blockQuote:!0,commentString:uR,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},e.schema.toStringOptions,t),r;switch(n.collectionStyle){case"block":r=!1;break;case"flow":r=!0;break;default:r=null}return{anchors:new Set,doc:e,flowCollectionPadding:n.flowCollectionPadding?" ":"",indent:"",indentStep:typeof n.indent=="number"?" ".repeat(n.indent):" ",inFlow:r,options:n}}function mR(e,t){if(t.tag){let a=e.filter(s=>s.tag===t.tag);if(a.length>0)return a.find(s=>s.format===t.format)??a[0]}let n,r;if(rt(t)){r=t.value;let a=e.filter(s=>s.identify?.(r));if(a.length>1){let s=a.filter(l=>l.test);s.length>0&&(a=s)}n=a.find(s=>s.format===t.format)??a.find(s=>!s.format)}else r=t,n=e.find(a=>a.nodeClass&&r instanceof a.nodeClass);if(!n){let a=r?.constructor?.name??(r===null?"null":typeof r);throw Error(`Tag not resolved for ${a} value`)}return n}function gR(e,t,{anchors:n,doc:r}){if(!r.directives)return"";let a=[],s=(rt(e)||_t(e))&&e.anchor;s&&xN(s)&&(n.add(s),a.push(`&${s}`));let l=e.tag??(t.default?null:t.tag);return l&&a.push(r.directives.tagString(l)),a.join(" ")}function Rs(e,t,n,r){if(Et(e))return e.toString(t,n,r);if(br(e)){if(t.doc.directives)return e.toString(t);if(t.resolvedAliases?.has(e))throw TypeError("Cannot stringify circular structure without alias nodes");t.resolvedAliases?t.resolvedAliases.add(e):t.resolvedAliases=new Set([e]),e=e.resolve(t.doc)}let a,s=At(e)?e:t.doc.createNode(e,{onTagObj:p=>a=p});a??=mR(t.doc.schema.tags,s);let l=gR(s,a,t);l.length>0&&(t.indentAtStart=(t.indentAtStart??0)+l.length+1);let f=typeof a.stringify=="function"?a.stringify(s,t,n,r):rt(s)?n0(s,t,n,r):s.toString(t,n,r);return l?rt(s)||f[0]==="{"||f[0]==="["?`${l} ${f}`:`${l}
|
|
48
|
+
${t.indent}${f}`:f}function yR({key:e,value:t},n,r,a){let{allNullValues:s,doc:l,indent:f,indentStep:p,options:{commentString:h,indentSeq:v,simpleKeys:g}}=n,m=At(e)&&e.comment||null;if(g){if(m)throw Error("With simple keys, key nodes cannot have comments");if(_t(e)||!At(e)&&typeof e=="object")throw Error("With simple keys, collection cannot be used as a key value")}let b=!g&&(!e||m&&t==null&&!n.inFlow||_t(e)||(rt(e)?e.type===qe.BLOCK_FOLDED||e.type===qe.BLOCK_LITERAL:typeof e=="object"));n=Object.assign({},n,{allNullValues:!1,implicitKey:!b&&(g||!s),indent:f+p});let w=!1,k=!1,S=Rs(e,n,()=>w=!0,()=>k=!0);if(!b&&!n.inFlow&&S.length>1024){if(g)throw Error("With simple keys, single line scalar must not span more than 1024 characters");b=!0}if(n.inFlow){if(s||t==null)return w&&r&&r(),S===""?"?":b?`? ${S}`:S}else if(s&&!g||t==null&&b)return S=`? ${S}`,m&&!w?S+=ua(S,n.indent,h(m)):k&&a&&a(),S;w&&(m=null),b?(m&&(S+=ua(S,n.indent,h(m))),S=`? ${S}
|
|
49
|
+
${f}:`):(S=`${S}:`,m&&(S+=ua(S,n.indent,h(m))));let N,$,j;At(t)?(N=!!t.spaceBefore,$=t.commentBefore,j=t.comment):(N=!1,$=null,j=null,t&&typeof t=="object"&&(t=l.createNode(t))),n.implicitKey=!1,!b&&!m&&rt(t)&&(n.indentAtStart=S.length+1),k=!1,!v&&p.length>=2&&!n.inFlow&&!b&&Io(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let E=!1,I=Rs(t,n,()=>E=!0,()=>k=!0),z=" ";if(m||N||$){if(z=N?`
|
|
50
|
+
`:"",$){let T=h($);z+=`
|
|
51
|
+
${xr(T,n.indent)}`}I===""&&!n.inFlow?z===`
|
|
52
|
+
`&&j&&(z=`
|
|
53
|
+
|
|
54
|
+
`):z+=`
|
|
55
|
+
${n.indent}`}else if(!b&&_t(t)){let T=I[0],M=I.indexOf(`
|
|
56
|
+
`),O=M!==-1,K=n.inFlow??t.flow??t.items.length===0;if(O||!K){let B=!1;if(O&&(T==="&"||T==="!")){let V=I.indexOf(" ");T==="&"&&V!==-1&&V<M&&I[V+1]==="!"&&(V=I.indexOf(" ",V+1)),(V===-1||M<V)&&(B=!0)}B||(z=`
|
|
57
|
+
${n.indent}`)}}else(I===""||I[0]===`
|
|
58
|
+
`)&&(z="");return S+=z+I,n.inFlow?E&&r&&r():j&&!E?S+=ua(S,n.indent,h(j)):k&&a&&a(),S}function EN(e,t){(e==="debug"||e==="warn")&&console.warn(t)}var Sf="<<",wr={identify:e=>e===Sf||typeof e=="symbol"&&e.description===Sf,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new qe(Symbol(Sf)),{addToJSMap:_N}),stringify:()=>Sf},vR=(e,t)=>(wr.identify(t)||rt(t)&&(!t.type||t.type===qe.PLAIN)&&wr.identify(t.value))&&e?.doc.schema.tags.some(n=>n.tag===wr.tag&&n.default);function _N(e,t,n){let r=AN(e,n);if(Io(r))for(let a of r.items)o0(e,t,a);else if(Array.isArray(r))for(let a of r)o0(e,t,a);else o0(e,t,r)}function o0(e,t,n){let r=AN(e,n);if(!Do(r))throw Error("Merge sources must be maps or map aliases");let a=r.toJSON(null,e,Map);for(let[s,l]of a)t instanceof Map?t.has(s)||t.set(s,l):t instanceof Set?t.add(s):Object.prototype.hasOwnProperty.call(t,s)||Object.defineProperty(t,s,{value:l,writable:!0,enumerable:!0,configurable:!0});return t}function AN(e,t){return e&&br(t)?t.resolve(e.doc,e):t}function TN(e,t,{key:n,value:r}){if(At(n)&&n.addToJSMap)n.addToJSMap(e,t,r);else if(vR(e,n))_N(e,t,r);else{let a=Yn(n,"",e);if(t instanceof Map)t.set(a,Yn(r,a,e));else if(t instanceof Set)t.add(a);else{let s=bR(n,a,e),l=Yn(r,s,e);s in t?Object.defineProperty(t,s,{value:l,writable:!0,enumerable:!0,configurable:!0}):t[s]=l}}return t}function bR(e,t,n){if(t===null)return"";if(typeof t!="object")return String(t);if(At(e)&&n?.doc){let r=$N(n.doc,{});r.anchors=new Set;for(let s of n.anchors.keys())r.anchors.add(s.anchor);r.inFlow=!0,r.inStringifyKey=!0;let a=e.toString(r);if(!n.mapKeyWarned){let s=JSON.stringify(a);s.length>40&&(s=s.substring(0,36)+'..."'),EN(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${s}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return a}return JSON.stringify(t)}function r0(e,t,n){return new On(jd(e,void 0,n),jd(t,void 0,n))}var On=class q_{constructor(t,n=null){Object.defineProperty(this,Un,{value:vN}),this.key=t,this.value=n}clone(t){let{key:n,value:r}=this;return At(n)&&(n=n.clone(t)),At(r)&&(r=r.clone(t)),new q_(n,r)}toJSON(t,n){return TN(n,n?.mapAsMap?new Map:{},this)}toString(t,n,r){return t?.doc?yR(this,t,n,r):JSON.stringify(this)}};function MN(e,t,n){return(t.inFlow??e.flow?wR:xR)(e,t,n)}function xR({comment:e,items:t},n,{blockItemPrefix:r,flowChars:a,itemIndent:s,onChompKeep:l,onComment:f}){let{indent:p,options:{commentString:h}}=n,v=Object.assign({},n,{indent:s,type:null}),g=!1,m=[];for(let w=0;w<t.length;++w){let k=t[w],S=null;if(At(k))!g&&k.spaceBefore&&m.push(""),Nf(n,m,k.commentBefore,g),k.comment&&(S=k.comment);else if(Et(k)){let $=At(k.key)?k.key:null;$&&(!g&&$.spaceBefore&&m.push(""),Nf(n,m,$.commentBefore,g))}g=!1;let N=Rs(k,v,()=>S=null,()=>g=!0);S&&(N+=ua(N,s,h(S))),g&&S&&(g=!1),m.push(r+N)}let b;if(m.length===0)b=a.start+a.end;else{b=m[0];for(let w=1;w<m.length;++w){let k=m[w];b+=k?`
|
|
59
|
+
${p}${k}`:`
|
|
60
|
+
`}}return e?(b+=`
|
|
61
|
+
`+xr(h(e),p),f&&f()):g&&l&&l(),b}function wR({items:e},t,{flowChars:n,itemIndent:r}){let{indent:a,indentStep:s,flowCollectionPadding:l,options:{commentString:f}}=t;r+=s;let p=Object.assign({},t,{indent:r,inFlow:!0,type:null}),h=!1,v=0,g=[];for(let w=0;w<e.length;++w){let k=e[w],S=null;if(At(k))k.spaceBefore&&g.push(""),Nf(t,g,k.commentBefore,!1),k.comment&&(S=k.comment);else if(Et(k)){let $=At(k.key)?k.key:null;$&&($.spaceBefore&&g.push(""),Nf(t,g,$.commentBefore,!1),$.comment&&(h=!0));let j=At(k.value)?k.value:null;j?(j.comment&&(S=j.comment),j.commentBefore&&(h=!0)):k.value==null&&$?.comment&&(S=$.comment)}S&&(h=!0);let N=Rs(k,p,()=>S=null);h||=g.length>v||N.includes(`
|
|
62
|
+
`),w<e.length-1?N+=",":t.options.trailingComma&&(t.options.lineWidth>0&&(h||=g.reduce(($,j)=>$+j.length+2,2)+(N.length+2)>t.options.lineWidth),h&&(N+=",")),S&&(N+=ua(N,r,f(S))),g.push(N),v=g.length}let{start:m,end:b}=n;if(g.length===0)return m+b;if(!h){let w=g.reduce((k,S)=>k+S.length+2,2);h=t.options.lineWidth>0&&w>t.options.lineWidth}if(h){let w=m;for(let k of g)w+=k?`
|
|
63
|
+
${s}${a}${k}`:`
|
|
64
|
+
`;return`${w}
|
|
65
|
+
${a}${b}`}return`${m}${l}${g.join(" ")}${l}${b}`}function Nf({indent:e,options:{commentString:t}},n,r,a){if(r&&a&&(r=r.replace(/^\n+/,"")),r){let s=xr(t(r),e);n.push(s.trimStart())}}function ca(e,t){let n=rt(t)?t.value:t;for(let r of e)if(Et(r)&&(r.key===t||r.key===n||rt(r.key)&&r.key.value===n))return r}var Xn=class extends NN{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(pi,e),this.items=[]}static from(e,t,n){let{keepUndefined:r,replacer:a}=n,s=new this(e),l=(f,p)=>{if(typeof a=="function")p=a.call(t,f,p);else if(Array.isArray(a)&&!a.includes(f))return;(p!==void 0||r)&&s.items.push(r0(f,p,n))};if(t instanceof Map)for(let[f,p]of t)l(f,p);else if(t&&typeof t=="object")for(let f of Object.keys(t))l(f,t[f]);return typeof e.sortMapEntries=="function"&&s.items.sort(e.sortMapEntries),s}add(e,t){let n;n=Et(e)?e:!e||typeof e!="object"||!("key"in e)?new On(e,e?.value):new On(e.key,e.value);let r=ca(this.items,n.key),a=this.schema?.sortMapEntries;if(r){if(!t)throw Error(`Key ${n.key} already set`);rt(r.value)&&SN(n.value)?r.value.value=n.value:r.value=n.value}else if(a){let s=this.items.findIndex(l=>a(n,l)<0);s===-1?this.items.push(n):this.items.splice(s,0,n)}else this.items.push(n)}delete(e){let t=ca(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let n=ca(this.items,e)?.value;return(!t&&rt(n)?n.value:n)??void 0}has(e){return!!ca(this.items,e)}set(e,t){this.add(new On(e,t),!0)}toJSON(e,t,n){let r=n?new n:t?.mapAsMap?new Map:{};t?.onCreate&&t.onCreate(r);for(let a of this.items)TN(t,r,a);return r}toString(e,t,n){if(!e)return JSON.stringify(this);for(let r of this.items)if(!Et(r))throw Error(`Map items must all be pairs; found ${JSON.stringify(r)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),MN(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:t})}},zs={collection:"map",default:!0,nodeClass:Xn,tag:"tag:yaml.org,2002:map",resolve(e,t){return Do(e)||t("Expected a mapping for this tag"),e},createNode:(e,t,n)=>Xn.from(e,t,n)},fa=class extends NN{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(Os,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=jf(e);return typeof t=="number"&&this.items.splice(t,1).length>0}get(e,t){let n=jf(e);if(typeof n!="number")return;let r=this.items[n];return!t&&rt(r)?r.value:r}has(e){let t=jf(e);return typeof t=="number"&&t<this.items.length}set(e,t){let n=jf(e);if(typeof n!="number")throw Error(`Expected a valid index, not ${e}.`);let r=this.items[n];rt(r)&&SN(t)?r.value=t:this.items[n]=t}toJSON(e,t){let n=[];t?.onCreate&&t.onCreate(n);let r=0;for(let a of this.items)n.push(Yn(a,String(r++),t));return n}toString(e,t,n){return e?MN(this,e,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(e.indent||"")+" ",onChompKeep:n,onComment:t}):JSON.stringify(this)}static from(e,t,n){let{replacer:r}=n,a=new this(e);if(t&&Symbol.iterator in Object(t)){let s=0;for(let l of t){if(typeof r=="function"){let f=t instanceof Set?l:String(s++);l=r.call(t,f,l)}a.items.push(jd(l,void 0,n))}}return a}};function jf(e){let t=rt(e)?e.value:e;return t&&typeof t=="string"&&(t=Number(t)),typeof t=="number"&&Number.isInteger(t)&&t>=0?t:null}var Fs={collection:"seq",default:!0,nodeClass:fa,tag:"tag:yaml.org,2002:seq",resolve(e,t){return Io(e)||t("Expected a sequence for this tag"),e},createNode:(e,t,n)=>fa.from(e,t,n)},Cf={identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify(e,t,n,r){return t=Object.assign({actualString:!0},t),n0(e,t,n,r)}},$f={identify:e=>e==null,createNode:()=>new qe(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new qe(null),stringify:({source:e},t)=>typeof e=="string"&&$f.test.test(e)?e:t.options.nullStr},i0={identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new qe(e[0]==="t"||e[0]==="T"),stringify({source:e,value:t},n){return e&&i0.test.test(e)&&t===(e[0]==="t"||e[0]==="T")?e:t?n.options.trueStr:n.options.falseStr}};function ho({format:e,minFractionDigits:t,tag:n,value:r}){if(typeof r=="bigint")return String(r);let a=typeof r=="number"?r:Number(r);if(!isFinite(a))return isNaN(a)?".nan":a<0?"-.inf":".inf";let s=Object.is(r,-0)?"-0":JSON.stringify(r);if(!e&&t&&(!n||n==="tag:yaml.org,2002:float")&&/^-?\d/.test(s)&&!s.includes("e")){let l=s.indexOf(".");l<0&&(l=s.length,s+=".");let f=t-(s.length-l-1);for(;f-- >0;)s+="0"}return s}var ON={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?-1/0:1/0,stringify:ho},PN={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():ho(e)}},DN={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(e){let t=new qe(parseFloat(e)),n=e.indexOf(".");return n!==-1&&e[e.length-1]==="0"&&(t.minFractionDigits=e.length-n-1),t},stringify:ho},Ef=e=>typeof e=="bigint"||Number.isInteger(e),a0=(e,t,n,{intAsBigInt:r})=>r?BigInt(e):parseInt(e.substring(t),n);function IN(e,t,n){let{value:r}=e;return Ef(r)&&r>=0?n+r.toString(t):ho(e)}var LN={identify:e=>Ef(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(e,t,n)=>a0(e,2,8,n),stringify:e=>IN(e,8,"0o")},RN={identify:Ef,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(e,t,n)=>a0(e,0,10,n),stringify:ho},zN={identify:e=>Ef(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,n)=>a0(e,2,16,n),stringify:e=>IN(e,16,"0x")},kR=[zs,Fs,Cf,$f,i0,LN,RN,zN,ON,PN,DN];function FN(e){return typeof e=="bigint"||Number.isInteger(e)}var _f=({value:e})=>JSON.stringify(e),SR=[{identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify:_f},{identify:e=>e==null,createNode:()=>new qe(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:_f},{identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:e=>e==="true",stringify:_f},{identify:FN,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:n})=>n?BigInt(e):parseInt(e,10),stringify:({value:e})=>FN(e)?e.toString():JSON.stringify(e)},{identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:e=>parseFloat(e),stringify:_f}],NR=[zs,Fs].concat(SR,{default:!0,tag:"",test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}}),s0={identify:e=>e instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(e,t){if(typeof atob=="function"){let n=atob(e.replace(/[\n\r]/g,"")),r=new Uint8Array(n.length);for(let a=0;a<n.length;++a)r[a]=n.charCodeAt(a);return r}return t("This environment does not support reading binary tags; either Buffer or atob is required"),e},stringify({comment:e,type:t,value:n},r,a,s){if(!n)return"";let l=n,f;if(typeof btoa=="function"){let p="";for(let h=0;h<l.length;++h)p+=String.fromCharCode(l[h]);f=btoa(p)}else throw Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(t??=qe.BLOCK_LITERAL,t!==qe.QUOTE_DOUBLE){let p=Math.max(r.options.lineWidth-r.indent.length,r.options.minContentWidth),h=Math.ceil(f.length/p),v=Array(h);for(let g=0,m=0;g<h;++g,m+=p)v[g]=f.substr(m,p);f=v.join(t===qe.BLOCK_LITERAL?`
|
|
66
|
+
`:" ")}return n0({comment:e,type:t,value:f},r,a,s)}};function BN(e,t){if(Io(e))for(let n=0;n<e.items.length;++n){let r=e.items[n];if(!Et(r)){if(Do(r)){r.items.length>1&&t("Each pair must have its own sequence indicator");let a=r.items[0]||new On(new qe(null));if(r.commentBefore&&(a.key.commentBefore=a.key.commentBefore?`${r.commentBefore}
|
|
67
|
+
${a.key.commentBefore}`:r.commentBefore),r.comment){let s=a.value??a.key;s.comment=s.comment?`${r.comment}
|
|
68
|
+
${s.comment}`:r.comment}r=a}e.items[n]=Et(r)?r:new On(r)}}else t("Expected a sequence for this tag");return e}function qN(e,t,n){let{replacer:r}=n,a=new fa(e);a.tag="tag:yaml.org,2002:pairs";let s=0;if(t&&Symbol.iterator in Object(t))for(let l of t){typeof r=="function"&&(l=r.call(t,String(s++),l));let f,p;if(Array.isArray(l))if(l.length===2)f=l[0],p=l[1];else throw TypeError(`Expected [key, value] tuple: ${l}`);else if(l&&l instanceof Object){let h=Object.keys(l);if(h.length===1)f=h[0],p=l[f];else throw TypeError(`Expected tuple with one key, not ${h.length} keys`)}else f=l;a.items.push(r0(f,p,n))}return a}var l0={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:BN,createNode:qN},Af=class H_ extends fa{constructor(){super(),this.add=Xn.prototype.add.bind(this),this.delete=Xn.prototype.delete.bind(this),this.get=Xn.prototype.get.bind(this),this.has=Xn.prototype.has.bind(this),this.set=Xn.prototype.set.bind(this),this.tag=H_.tag}toJSON(t,n){if(!n)return super.toJSON(t);let r=new Map;n?.onCreate&&n.onCreate(r);for(let a of this.items){let s,l;if(Et(a)?(s=Yn(a.key,"",n),l=Yn(a.value,s,n)):s=Yn(a,"",n),r.has(s))throw Error("Ordered maps must not include duplicate keys");r.set(s,l)}return r}static from(t,n,r){let a=qN(t,n,r),s=new this;return s.items=a.items,s}};Af.tag="tag:yaml.org,2002:omap";var d0={collection:"seq",identify:e=>e instanceof Map,nodeClass:Af,default:!1,tag:"tag:yaml.org,2002:omap",resolve(e,t){let n=BN(e,t),r=[];for(let{key:a}of n.items)rt(a)&&(r.includes(a.value)?t(`Ordered maps must not include duplicate keys: ${a.value}`):r.push(a.value));return Object.assign(new Af,n)},createNode:(e,t,n)=>Af.from(e,t,n)};function HN({value:e,source:t},n){return t&&(e?VN:KN).test.test(t)?t:e?n.options.trueStr:n.options.falseStr}var VN={identify:e=>e===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new qe(!0),stringify:HN},KN={identify:e=>e===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new qe(!1),stringify:HN},jR={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?-1/0:1/0,stringify:ho},CR={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e.replace(/_/g,"")),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():ho(e)}},$R={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(e){let t=new qe(parseFloat(e.replace(/_/g,""))),n=e.indexOf(".");if(n!==-1){let r=e.substring(n+1).replace(/_/g,"");r[r.length-1]==="0"&&(t.minFractionDigits=r.length)}return t},stringify:ho},Ed=e=>typeof e=="bigint"||Number.isInteger(e);function Tf(e,t,n,{intAsBigInt:r}){let a=e[0];if((a==="-"||a==="+")&&(t+=1),e=e.substring(t).replace(/_/g,""),r){switch(n){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`}let l=BigInt(e);return a==="-"?BigInt(-1)*l:l}let s=parseInt(e,n);return a==="-"?-1*s:s}function u0(e,t,n){let{value:r}=e;if(Ed(r)){let a=r.toString(t);return r<0?"-"+n+a.substr(1):n+a}return ho(e)}var ER={identify:Ed,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>Tf(e,2,2,n),stringify:e=>u0(e,2,"0b")},_R={identify:Ed,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>Tf(e,1,8,n),stringify:e=>u0(e,8,"0")},AR={identify:Ed,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>Tf(e,0,10,n),stringify:ho},TR={identify:Ed,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>Tf(e,2,16,n),stringify:e=>u0(e,16,"0x")},Mf=class V_ extends Xn{constructor(t){super(t),this.tag=V_.tag}add(t){let n;n=Et(t)?t:t&&typeof t=="object"&&"key"in t&&"value"in t&&t.value===null?new On(t.key,null):new On(t,null),ca(this.items,n.key)||this.items.push(n)}get(t,n){let r=ca(this.items,t);return!n&&Et(r)?rt(r.key)?r.key.value:r.key:r}set(t,n){if(typeof n!="boolean")throw Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof n}`);let r=ca(this.items,t);r&&!n?this.items.splice(this.items.indexOf(r),1):!r&&n&&this.items.push(new On(t))}toJSON(t,n){return super.toJSON(t,n,Set)}toString(t,n,r){if(!t)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},t,{allNullValues:!0}),n,r);throw Error("Set items must all have null values")}static from(t,n,r){let{replacer:a}=r,s=new this(t);if(n&&Symbol.iterator in Object(n))for(let l of n)typeof a=="function"&&(l=a.call(n,l,l)),s.items.push(r0(l,null,r));return s}};Mf.tag="tag:yaml.org,2002:set";var c0={collection:"map",identify:e=>e instanceof Set,nodeClass:Mf,default:!1,tag:"tag:yaml.org,2002:set",createNode:(e,t,n)=>Mf.from(e,t,n),resolve(e,t){if(Do(e)){if(e.hasAllNullValues(!0))return Object.assign(new Mf,e);t("Set items must all have null values")}else t("Expected a mapping for this tag");return e}};function f0(e,t){let n=e[0],r=n==="-"||n==="+"?e.substring(1):e,a=l=>t?BigInt(l):Number(l),s=r.replace(/_/g,"").split(":").reduce((l,f)=>l*a(60)+a(f),a(0));return n==="-"?a(-1)*s:s}function WN(e){let{value:t}=e,n=l=>l;if(typeof t=="bigint")n=l=>BigInt(l);else if(isNaN(t)||!isFinite(t))return ho(e);let r="";t<0&&(r="-",t*=n(-1));let a=n(60),s=[t%a];return t<60?s.unshift(0):(t=(t-s[0])/a,s.unshift(t%a),t>=60&&(t=(t-s[0])/a,s.unshift(t))),r+s.map(l=>String(l).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var UN={identify:e=>typeof e=="bigint"||Number.isInteger(e),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(e,t,{intAsBigInt:n})=>f0(e,n),stringify:WN},YN={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:e=>f0(e,!1),stringify:WN},Of={identify:e=>e instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(e){let t=e.match(Of.test);if(!t)throw Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,n,r,a,s,l,f]=t.map(Number),p=t[7]?Number((t[7]+"00").substr(1,3)):0,h=Date.UTC(n,r-1,a,s||0,l||0,f||0,p),v=t[8];if(v&&v!=="Z"){let g=f0(v,!1);Math.abs(g)<30&&(g*=60),h-=6e4*g}return new Date(h)},stringify:({value:e})=>e?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""},XN=[zs,Fs,Cf,$f,VN,KN,ER,_R,AR,TR,jR,CR,$R,s0,wr,d0,l0,c0,UN,YN,Of],ZN=new Map([["core",kR],["failsafe",[zs,Fs,Cf]],["json",NR],["yaml11",XN],["yaml-1.1",XN]]),GN={binary:s0,bool:i0,float:DN,floatExp:PN,floatNaN:ON,floatTime:YN,int:RN,intHex:zN,intOct:LN,intTime:UN,map:zs,merge:wr,null:$f,omap:d0,pairs:l0,seq:Fs,set:c0,timestamp:Of},MR={"tag:yaml.org,2002:binary":s0,"tag:yaml.org,2002:merge":wr,"tag:yaml.org,2002:omap":d0,"tag:yaml.org,2002:pairs":l0,"tag:yaml.org,2002:set":c0,"tag:yaml.org,2002:timestamp":Of};function h0(e,t,n){let r=ZN.get(t);if(r&&!e)return n&&!r.includes(wr)?r.concat(wr):r.slice();let a=r;if(!a)if(Array.isArray(e))a=[];else{let s=Array.from(ZN.keys()).filter(l=>l!=="yaml11").map(l=>JSON.stringify(l)).join(", ");throw Error(`Unknown schema "${t}"; use one of ${s} or define customTags array`)}if(Array.isArray(e))for(let s of e)a=a.concat(s);else typeof e=="function"&&(a=e(a.slice()));return n&&(a=a.concat(wr)),a.reduce((s,l)=>{let f=typeof l=="string"?GN[l]:l;if(!f){let p=JSON.stringify(l),h=Object.keys(GN).map(v=>JSON.stringify(v)).join(", ");throw Error(`Unknown custom tag ${p}; use one of ${h}`)}return s.includes(f)||s.push(f),s},[])}var OR=(e,t)=>e.key<t.key?-1:+(e.key>t.key),PR=class K_{constructor({compat:t,customTags:n,merge:r,resolveKnownTags:a,schema:s,sortMapEntries:l,toStringDefaults:f}){this.compat=Array.isArray(t)?h0(t,"compat"):t?h0(null,t):null,this.name=typeof s=="string"&&s||"core",this.knownTags=a?MR:{},this.tags=h0(n,this.name,r),this.toStringOptions=f??null,Object.defineProperty(this,pi,{value:zs}),Object.defineProperty(this,Po,{value:Cf}),Object.defineProperty(this,Os,{value:Fs}),this.sortMapEntries=typeof l=="function"?l:l===!0?OR:null}clone(){let t=Object.create(K_.prototype,Object.getOwnPropertyDescriptors(this));return t.tags=this.tags.slice(),t}};function DR(e,t){let n=[],r=t.directives===!0;if(t.directives!==!1&&e.directives){let p=e.directives.toString(e);p?(n.push(p),r=!0):e.directives.docStart&&(r=!0)}r&&n.push("---");let a=$N(e,t),{commentString:s}=a.options;if(e.commentBefore){n.length!==1&&n.unshift("");let p=s(e.commentBefore);n.unshift(xr(p,""))}let l=!1,f=null;if(e.contents){if(At(e.contents)){if(e.contents.spaceBefore&&r&&n.push(""),e.contents.commentBefore){let v=s(e.contents.commentBefore);n.push(xr(v,""))}a.forceBlockIndent=!!e.comment,f=e.contents.comment}let p=f?void 0:()=>l=!0,h=Rs(e.contents,a,()=>f=null,p);f&&(h+=ua(h,"",s(f))),(h[0]==="|"||h[0]===">")&&n[n.length-1]==="---"?n[n.length-1]=`--- ${h}`:n.push(h)}else n.push(Rs(e.contents,a));if(e.directives?.docEnd)if(e.comment){let p=s(e.comment);p.includes(`
|
|
69
|
+
`)?(n.push("..."),n.push(xr(p,""))):n.push(`... ${p}`)}else n.push("...");else{let p=e.comment;p&&l&&(p=p.replace(/^\n+/,"")),p&&((!l||f)&&n[n.length-1]!==""&&n.push(""),n.push(xr(s(p),"")))}return n.join(`
|
|
70
|
+
`)+`
|
|
71
|
+
`}var p0=class W_{constructor(t,n,r){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,Un,{value:Gg});let a=null;typeof n=="function"||Array.isArray(n)?a=n:r===void 0&&n&&(r=n,n=void 0);let s=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},r);this.options=s;let{version:l}=s;r?._directives?(this.directives=r._directives.atDocument(),this.directives.yaml.explicit&&(l=this.directives.yaml.version)):this.directives=new Ds({version:l}),this.setSchema(l,r),this.contents=t===void 0?null:this.createNode(t,a,r)}clone(){let t=Object.create(W_.prototype,{[Un]:{value:Gg}});return t.commentBefore=this.commentBefore,t.comment=this.comment,t.errors=this.errors.slice(),t.warnings=this.warnings.slice(),t.options=Object.assign({},this.options),this.directives&&(t.directives=this.directives.clone()),t.schema=this.schema.clone(),t.contents=At(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(t){Bs(this.contents)&&this.contents.add(t)}addIn(t,n){Bs(this.contents)&&this.contents.addIn(t,n)}createAlias(t,n){if(!t.anchor){let r=wN(this);t.anchor=!n||r.has(n)?kN(n||"a",r):n}return new Jg(t.anchor)}createNode(t,n,r){let a;if(typeof n=="function")t=n.call({"":t},"",t),a=n;else if(Array.isArray(n)){let S=n.filter(N=>typeof N=="number"||N instanceof String||N instanceof Number).map(String);S.length>0&&(n=n.concat(S)),a=n}else r===void 0&&n&&(r=n,n=void 0);let{aliasDuplicateObjects:s,anchorPrefix:l,flow:f,keepUndefined:p,onTagObj:h,tag:v}=r??{},{onAnchor:g,setAnchors:m,sourceObjects:b}=sR(this,l||"a"),w={aliasDuplicateObjects:s??!0,keepUndefined:p??!1,onAnchor:g,onTagObj:h,replacer:a,schema:this.schema,sourceObjects:b},k=jd(t,v,w);return f&&_t(k)&&(k.flow=!0),m(),k}createPair(t,n,r={}){return new On(this.createNode(t,null,r),this.createNode(n,null,r))}delete(t){return Bs(this.contents)?this.contents.delete(t):!1}deleteIn(t){return Cd(t)?this.contents!=null&&(this.contents=null,!0):Bs(this.contents)?this.contents.deleteIn(t):!1}get(t,n){return _t(this.contents)?this.contents.get(t,n):void 0}getIn(t,n){return Cd(t)?!n&&rt(this.contents)?this.contents.value:this.contents:_t(this.contents)?this.contents.getIn(t,n):void 0}has(t){return _t(this.contents)?this.contents.has(t):!1}hasIn(t){return Cd(t)?this.contents!==void 0:_t(this.contents)?this.contents.hasIn(t):!1}set(t,n){this.contents==null?this.contents=vf(this.schema,[t],n):Bs(this.contents)&&this.contents.set(t,n)}setIn(t,n){Cd(t)?this.contents=n:this.contents==null?this.contents=vf(this.schema,Array.from(t),n):Bs(this.contents)&&this.contents.setIn(t,n)}setSchema(t,n={}){typeof t=="number"&&(t=String(t));let r;switch(t){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new Ds({version:"1.1"}),r={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=t:this.directives=new Ds({version:t}),r={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,r=null;break;default:{let a=JSON.stringify(t);throw Error(`Expected '1.1', '1.2' or null as first argument, but found: ${a}`)}}if(n.schema instanceof Object)this.schema=n.schema;else if(r)this.schema=new PR(Object.assign(r,n));else throw Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:t,jsonArg:n,mapAsMap:r,maxAliasCount:a,onAnchor:s,reviver:l}={}){let f={anchors:new Map,doc:this,keep:!t,mapAsMap:r===!0,mapKeyWarned:!1,maxAliasCount:typeof a=="number"?a:100},p=Yn(this.contents,n??"",f);if(typeof s=="function")for(let{count:h,res:v}of f.anchors.values())s(v,h);return typeof l=="function"?Is(l,{"":p},"",p):p}toJSON(t,n){return this.toJS({json:!0,jsonArg:t,mapAsMap:!1,onAnchor:n})}toString(t={}){if(this.errors.length>0)throw Error("Document with errors cannot be stringified");if("indent"in t&&(!Number.isInteger(t.indent)||Number(t.indent)<=0)){let n=JSON.stringify(t.indent);throw Error(`"indent" option must be a positive integer, not ${n}`)}return DR(this,t)}};function Bs(e){if(_t(e))return!0;throw Error("Expected a YAML collection as document contents")}var QN=class extends Error{constructor(e,t,n,r){super(),this.name=e,this.code=n,this.message=r,this.pos=t}},_d=class extends QN{constructor(e,t,n){super("YAMLParseError",e,t,n)}},IR=class extends QN{constructor(e,t,n){super("YAMLWarning",e,t,n)}},JN=(e,t)=>n=>{if(n.pos[0]===-1)return;n.linePos=n.pos.map(f=>t.linePos(f));let{line:r,col:a}=n.linePos[0];n.message+=` at line ${r}, column ${a}`;let s=a-1,l=e.substring(t.lineStarts[r-1],t.lineStarts[r]).replace(/[\n\r]+$/,"");if(s>=60&&l.length>80){let f=Math.min(s-39,l.length-79);l="\u2026"+l.substring(f),s-=f-1}if(l.length>80&&(l=l.substring(0,79)+"\u2026"),r>1&&/^ *$/.test(l.substring(0,s))){let f=e.substring(t.lineStarts[r-2],t.lineStarts[r-1]);f.length>80&&(f=f.substring(0,79)+`\u2026
|
|
72
|
+
`),l=f+l}if(/[^ ]/.test(l)){let f=1,p=n.linePos[1];p?.line===r&&p.col>a&&(f=Math.max(1,Math.min(p.col-a,80-s)));let h=" ".repeat(s)+"^".repeat(f);n.message+=`:
|
|
73
|
+
|
|
74
|
+
${l}
|
|
75
|
+
${h}
|
|
76
|
+
`}};function qs(e,{flow:t,indicator:n,next:r,offset:a,onError:s,parentIndent:l,startOnNewline:f}){let p=!1,h=f,v=f,g="",m="",b=!1,w=!1,k=null,S=null,N=null,$=null,j=null,E=null,I=null;for(let M of e)switch(w&&=(M.type!=="space"&&M.type!=="newline"&&M.type!=="comma"&&s(M.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),!1),k&&=(h&&M.type!=="comment"&&M.type!=="newline"&&s(k,"TAB_AS_INDENT","Tabs are not allowed as indentation"),null),M.type){case"space":!t&&(n!=="doc-start"||r?.type!=="flow-collection")&&M.source.includes(" ")&&(k=M),v=!0;break;case"comment":{v||s(M,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let O=M.source.substring(1)||" ";g?g+=m+O:g=O,m="",h=!1;break}case"newline":h?g?g+=M.source:E&&n==="seq-item-ind"||(p=!0):m+=M.source,h=!0,b=!0,(S||N)&&($=M),v=!0;break;case"anchor":S&&s(M,"MULTIPLE_ANCHORS","A node can have at most one anchor"),M.source.endsWith(":")&&s(M.offset+M.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),S=M,I??=M.offset,h=!1,v=!1,w=!0;break;case"tag":N&&s(M,"MULTIPLE_TAGS","A node can have at most one tag"),N=M,I??=M.offset,h=!1,v=!1,w=!0;break;case n:(S||N)&&s(M,"BAD_PROP_ORDER",`Anchors and tags must be after the ${M.source} indicator`),E&&s(M,"UNEXPECTED_TOKEN",`Unexpected ${M.source} in ${t??"collection"}`),E=M,h=n==="seq-item-ind"||n==="explicit-key-ind",v=!1;break;case"comma":if(t){j&&s(M,"UNEXPECTED_TOKEN",`Unexpected , in ${t}`),j=M,h=!1,v=!1;break}default:s(M,"UNEXPECTED_TOKEN",`Unexpected ${M.type} token`),h=!1,v=!1}let z=e[e.length-1],T=z?z.offset+z.source.length:a;return w&&r&&r.type!=="space"&&r.type!=="newline"&&r.type!=="comma"&&(r.type!=="scalar"||r.source!=="")&&s(r.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),k&&(h&&k.indent<=l||r?.type==="block-map"||r?.type==="block-seq")&&s(k,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:j,found:E,spaceBefore:p,comment:g,hasNewline:b,anchor:S,tag:N,newlineAfterProp:$,end:T,start:I??T}}function Ad(e){if(!e)return null;switch(e.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(e.source.includes(`
|
|
77
|
+
`))return!0;if(e.end){for(let t of e.end)if(t.type==="newline")return!0}return!1;case"flow-collection":for(let t of e.items){for(let n of t.start)if(n.type==="newline")return!0;if(t.sep){for(let n of t.sep)if(n.type==="newline")return!0}if(Ad(t.key)||Ad(t.value))return!0}return!1;default:return!0}}function m0(e,t,n){if(t?.type==="flow-collection"){let r=t.end[0];r.indent===e&&(r.source==="]"||r.source==="}")&&Ad(t)&&n(r,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}function ej(e,t,n){let{uniqueKeys:r}=e.options;if(r===!1)return!1;let a=typeof r=="function"?r:(s,l)=>s===l||rt(s)&&rt(l)&&s.value===l.value;return t.some(s=>a(s.key,n))}var tj="All mapping items must start at the same column";function LR({composeNode:e,composeEmptyNode:t},n,r,a,s){let l=new(s?.nodeClass??Xn)(n.schema);n.atRoot&&=!1;let f=r.offset,p=null;for(let h of r.items){let{start:v,key:g,sep:m,value:b}=h,w=qs(v,{indicator:"explicit-key-ind",next:g??m?.[0],offset:f,onError:a,parentIndent:r.indent,startOnNewline:!0}),k=!w.found;if(k){if(g&&(g.type==="block-seq"?a(f,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in g&&g.indent!==r.indent&&a(f,"BAD_INDENT",tj)),!w.anchor&&!w.tag&&!m){p=w.end,w.comment&&(l.comment?l.comment+=`
|
|
78
|
+
`+w.comment:l.comment=w.comment);continue}(w.newlineAfterProp||Ad(g))&&a(g??v[v.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else w.found?.indent!==r.indent&&a(f,"BAD_INDENT",tj);n.atKey=!0;let S=w.end,N=g?e(n,g,w,a):t(n,S,v,null,w,a);n.schema.compat&&m0(r.indent,g,a),n.atKey=!1,ej(n,l.items,N)&&a(S,"DUPLICATE_KEY","Map keys must be unique");let $=qs(m??[],{indicator:"map-value-ind",next:b,offset:N.range[2],onError:a,parentIndent:r.indent,startOnNewline:!g||g.type==="block-scalar"});if(f=$.end,$.found){k&&(b?.type==="block-map"&&!$.hasNewline&&a(f,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),n.options.strict&&w.start<$.found.offset-1024&&a(N.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let j=b?e(n,b,$,a):t(n,f,m,null,$,a);n.schema.compat&&m0(r.indent,b,a),f=j.range[2];let E=new On(N,j);n.options.keepSourceTokens&&(E.srcToken=h),l.items.push(E)}else{k&&a(N.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),$.comment&&(N.comment?N.comment+=`
|
|
79
|
+
`+$.comment:N.comment=$.comment);let j=new On(N);n.options.keepSourceTokens&&(j.srcToken=h),l.items.push(j)}}return p&&p<f&&a(p,"IMPOSSIBLE","Map comment with trailing content"),l.range=[r.offset,f,p??f],l}function RR({composeNode:e,composeEmptyNode:t},n,r,a,s){let l=new(s?.nodeClass??fa)(n.schema);n.atRoot&&=!1,n.atKey&&=!1;let f=r.offset,p=null;for(let{start:h,value:v}of r.items){let g=qs(h,{indicator:"seq-item-ind",next:v,offset:f,onError:a,parentIndent:r.indent,startOnNewline:!0});if(!g.found)if(g.anchor||g.tag||v)v?.type==="block-seq"?a(g.end,"BAD_INDENT","All sequence items must start at the same column"):a(f,"MISSING_CHAR","Sequence item without - indicator");else{p=g.end,g.comment&&(l.comment=g.comment);continue}let m=v?e(n,v,g,a):t(n,g.end,h,null,g,a);n.schema.compat&&m0(r.indent,v,a),f=m.range[2],l.items.push(m)}return l.range=[r.offset,f,p??f],l}function Td(e,t,n,r){let a="";if(e){let s=!1,l="";for(let f of e){let{source:p,type:h}=f;switch(h){case"space":s=!0;break;case"comment":{n&&!s&&r(f,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let v=p.substring(1)||" ";a?a+=l+v:a=v,l="";break}case"newline":a&&(l+=p),s=!0;break;default:r(f,"UNEXPECTED_TOKEN",`Unexpected ${h} at node end`)}t+=p.length}}return{comment:a,offset:t}}var g0="Block collections are not allowed within flow collections",y0=e=>e&&(e.type==="block-map"||e.type==="block-seq");function zR({composeNode:e,composeEmptyNode:t},n,r,a,s){let l=r.start.source==="{",f=l?"flow map":"flow sequence",p=new(s?.nodeClass??(l?Xn:fa))(n.schema);p.flow=!0;let h=n.atRoot;h&&(n.atRoot=!1),n.atKey&&=!1;let v=r.offset+r.start.source.length;for(let k=0;k<r.items.length;++k){let S=r.items[k],{start:N,key:$,sep:j,value:E}=S,I=qs(N,{flow:f,indicator:"explicit-key-ind",next:$??j?.[0],offset:v,onError:a,parentIndent:r.indent,startOnNewline:!1});if(!I.found){if(!I.anchor&&!I.tag&&!j&&!E){k===0&&I.comma?a(I.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${f}`):k<r.items.length-1&&a(I.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${f}`),I.comment&&(p.comment?p.comment+=`
|
|
80
|
+
`+I.comment:p.comment=I.comment),v=I.end;continue}!l&&n.options.strict&&Ad($)&&a($,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(k===0)I.comma&&a(I.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${f}`);else if(I.comma||a(I.start,"MISSING_CHAR",`Missing , between ${f} items`),I.comment){let z="";e:for(let T of N)switch(T.type){case"comma":case"space":break;case"comment":z=T.source.substring(1);break e;default:break e}if(z){let T=p.items[p.items.length-1];Et(T)&&(T=T.value??T.key),T.comment?T.comment+=`
|
|
81
|
+
`+z:T.comment=z,I.comment=I.comment.substring(z.length+1)}}if(!l&&!j&&!I.found){let z=E?e(n,E,I,a):t(n,I.end,j,null,I,a);p.items.push(z),v=z.range[2],y0(E)&&a(z.range,"BLOCK_IN_FLOW",g0)}else{n.atKey=!0;let z=I.end,T=$?e(n,$,I,a):t(n,z,N,null,I,a);y0($)&&a(T.range,"BLOCK_IN_FLOW",g0),n.atKey=!1;let M=qs(j??[],{flow:f,indicator:"map-value-ind",next:E,offset:T.range[2],onError:a,parentIndent:r.indent,startOnNewline:!1});if(M.found){if(!l&&!I.found&&n.options.strict){if(j)for(let B of j){if(B===M.found)break;if(B.type==="newline"){a(B,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}I.start<M.found.offset-1024&&a(M.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else E&&("source"in E&&E.source?.[0]===":"?a(E,"MISSING_CHAR",`Missing space after : in ${f}`):a(M.start,"MISSING_CHAR",`Missing , or : between ${f} items`));let O=E?e(n,E,M,a):M.found?t(n,M.end,j,null,M,a):null;O?y0(E)&&a(O.range,"BLOCK_IN_FLOW",g0):M.comment&&(T.comment?T.comment+=`
|
|
82
|
+
`+M.comment:T.comment=M.comment);let K=new On(T,O);if(n.options.keepSourceTokens&&(K.srcToken=S),l){let B=p;ej(n,B.items,T)&&a(z,"DUPLICATE_KEY","Map keys must be unique"),B.items.push(K)}else{let B=new Xn(n.schema);B.flow=!0,B.items.push(K);let V=(O??T).range;B.range=[T.range[0],V[1],V[2]],p.items.push(B)}v=O?O.range[2]:M.end}}let g=l?"}":"]",[m,...b]=r.end,w=v;if(m?.source===g)w=m.offset+m.source.length;else{let k=f[0].toUpperCase()+f.substring(1),S=h?`${k} must end with a ${g}`:`${k} in block collection must be sufficiently indented and end with a ${g}`;a(v,h?"MISSING_CHAR":"BAD_INDENT",S),m&&m.source.length!==1&&b.unshift(m)}if(b.length>0){let k=Td(b,w,n.options.strict,a);k.comment&&(p.comment?p.comment+=`
|
|
83
|
+
`+k.comment:p.comment=k.comment),p.range=[r.offset,w,k.offset]}else p.range=[r.offset,w,w];return p}function v0(e,t,n,r,a,s){let l=n.type==="block-map"?LR(e,t,n,r,s):n.type==="block-seq"?RR(e,t,n,r,s):zR(e,t,n,r,s),f=l.constructor;return a==="!"||a===f.tagName?(l.tag=f.tagName,l):(a&&(l.tag=a),l)}function FR(e,t,n,r,a){let s=r.tag,l=s?t.directives.tagName(s.source,m=>a(s,"TAG_RESOLVE_FAILED",m)):null;if(n.type==="block-seq"){let{anchor:m,newlineAfterProp:b}=r,w=m&&s?m.offset>s.offset?m:s:m??s;w&&(!b||b.offset<w.offset)&&a(w,"MISSING_CHAR","Missing newline after block sequence props")}let f=n.type==="block-map"?"map":n.type==="block-seq"?"seq":n.start.source==="{"?"map":"seq";if(!s||!l||l==="!"||l===Xn.tagName&&f==="map"||l===fa.tagName&&f==="seq")return v0(e,t,n,a,l);let p=t.schema.tags.find(m=>m.tag===l&&m.collection===f);if(!p){let m=t.schema.knownTags[l];if(m?.collection===f)t.schema.tags.push(Object.assign({},m,{default:!1})),p=m;else return m?a(s,"BAD_COLLECTION_TYPE",`${m.tag} used for ${f} collection, but expects ${m.collection??"scalar"}`,!0):a(s,"TAG_RESOLVE_FAILED",`Unresolved tag: ${l}`,!0),v0(e,t,n,a,l)}let h=v0(e,t,n,a,l,p),v=p.resolve?.(h,m=>a(s,"TAG_RESOLVE_FAILED",m),t.options)??h,g=At(v)?v:new qe(v);return g.range=h.range,g.tag=l,p?.format&&(g.format=p.format),g}function BR(e,t,n){let r=t.offset,a=qR(t,e.options.strict,n);if(!a)return{value:"",type:null,comment:"",range:[r,r,r]};let s=a.mode===">"?qe.BLOCK_FOLDED:qe.BLOCK_LITERAL,l=t.source?HR(t.source):[],f=l.length;for(let k=l.length-1;k>=0;--k){let S=l[k][1];if(S===""||S==="\r")f=k;else break}if(f===0){let k=a.chomp==="+"&&l.length>0?`
|
|
84
|
+
`.repeat(Math.max(1,l.length-1)):"",S=r+a.length;return t.source&&(S+=t.source.length),{value:k,type:s,comment:a.comment,range:[r,S,S]}}let p=t.indent+a.indent,h=t.offset+a.length,v=0;for(let k=0;k<f;++k){let[S,N]=l[k];if(N===""||N==="\r")a.indent===0&&S.length>p&&(p=S.length);else{S.length<p&&n(h+S.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),a.indent===0&&(p=S.length),v=k,p===0&&!e.atRoot&&n(h,"BAD_INDENT","Block scalar values in collections must be indented");break}h+=S.length+N.length+1}for(let k=l.length-1;k>=f;--k)l[k][0].length>p&&(f=k+1);let g="",m="",b=!1;for(let k=0;k<v;++k)g+=l[k][0].slice(p)+`
|
|
85
|
+
`;for(let k=v;k<f;++k){let[S,N]=l[k];h+=S.length+N.length+1;let $=N[N.length-1]==="\r";if($&&(N=N.slice(0,-1)),N&&S.length<p){let j=`Block scalar lines must not be less indented than their ${a.indent?"explicit indentation indicator":"first line"}`;n(h-N.length-($?2:1),"BAD_INDENT",j),S=""}s===qe.BLOCK_LITERAL?(g+=m+S.slice(p)+N,m=`
|
|
86
|
+
`):S.length>p||N[0]===" "?(m===" "?m=`
|
|
87
|
+
`:!b&&m===`
|
|
88
|
+
`&&(m=`
|
|
89
|
+
|
|
90
|
+
`),g+=m+S.slice(p)+N,m=`
|
|
91
|
+
`,b=!0):N===""?m===`
|
|
92
|
+
`?g+=`
|
|
93
|
+
`:m=`
|
|
94
|
+
`:(g+=m+N,m=" ",b=!1)}switch(a.chomp){case"-":break;case"+":for(let k=f;k<l.length;++k)g+=`
|
|
95
|
+
`+l[k][0].slice(p);g[g.length-1]!==`
|
|
96
|
+
`&&(g+=`
|
|
97
|
+
`);break;default:g+=`
|
|
98
|
+
`}let w=r+a.length+t.source.length;return{value:g,type:s,comment:a.comment,range:[r,w,w]}}function qR({offset:e,props:t},n,r){if(t[0].type!=="block-scalar-header")return r(t[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:a}=t[0],s=a[0],l=0,f="",p=-1;for(let m=1;m<a.length;++m){let b=a[m];if(!f&&(b==="-"||b==="+"))f=b;else{let w=Number(b);!l&&w?l=w:p===-1&&(p=e+m)}}p!==-1&&r(p,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${a}`);let h=!1,v="",g=a.length;for(let m=1;m<t.length;++m){let b=t[m];switch(b.type){case"space":h=!0;case"newline":g+=b.source.length;break;case"comment":n&&!h&&r(b,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),g+=b.source.length,v=b.source.substring(1);break;case"error":r(b,"UNEXPECTED_TOKEN",b.message),g+=b.source.length;break;default:{r(b,"UNEXPECTED_TOKEN",`Unexpected token in block scalar header: ${b.type}`);let w=b.source;w&&typeof w=="string"&&(g+=w.length)}}}return{mode:s,indent:l,chomp:f,comment:v,length:g}}function HR(e){let t=e.split(/\n( *)/),n=t[0],r=n.match(/^( *)/),a=[r?.[1]?[r[1],n.slice(r[1].length)]:["",n]];for(let s=1;s<t.length;s+=2)a.push([t[s],t[s+1]]);return a}function VR(e,t,n){let{offset:r,type:a,source:s,end:l}=e,f,p,h=(m,b,w)=>n(r+m,b,w);switch(a){case"scalar":f=qe.PLAIN,p=KR(s,h);break;case"single-quoted-scalar":f=qe.QUOTE_SINGLE,p=WR(s,h);break;case"double-quoted-scalar":f=qe.QUOTE_DOUBLE,p=UR(s,h);break;default:return n(e,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${a}`),{value:"",type:null,comment:"",range:[r,r+s.length,r+s.length]}}let v=r+s.length,g=Td(l,v,t,n);return{value:p,type:f,comment:g.comment,range:[r,v,g.offset]}}function KR(e,t){let n="";switch(e[0]){case" ":n="a tab character";break;case",":n="flow indicator character ,";break;case"%":n="directive indicator character %";break;case"|":case">":n=`block scalar indicator ${e[0]}`;break;case"@":case"`":n=`reserved character ${e[0]}`}return n&&t(0,"BAD_SCALAR_START",`Plain value cannot start with ${n}`),nj(e)}function WR(e,t){return(e[e.length-1]!=="'"||e.length===1)&&t(e.length,"MISSING_CHAR","Missing closing 'quote"),nj(e.slice(1,-1)).replace(/''/g,"'")}function nj(e){let t=/(.*?)\r?\n/sy,n=t.exec(e);if(!n)return e;let r,a;try{r=RegExp("(?<![ ])[ ]+$"),a=RegExp("^[ ]+|(?<![ ])[ ]+$","g")}catch{r=/[ \t]+$/,a=/^[ \t]+|[ \t]+$/g}let s=n[1].replace(r,""),l=" ",f=t.lastIndex;for(;n=t.exec(e);){let h=n[1].replace(a,"");h===""?l===`
|
|
99
|
+
`?s+=l:l=`
|
|
100
|
+
`:(s+=l+h,l=" "),f=t.lastIndex}let p=/[ \t]*(.*)/sy;return p.lastIndex=f,n=p.exec(e),s+l+(n?.[1]??"")}function UR(e,t){let n="";for(let r=1;r<e.length-1;++r){let a=e[r];if(a!=="\r"||e[r+1]!==`
|
|
101
|
+
`)if(a===`
|
|
102
|
+
`){let{fold:s,offset:l}=YR(e,r);n+=s,r=l}else if(a==="\\"){let s=e[++r],l=XR[s];if(l)n+=l;else if(s===`
|
|
103
|
+
`)for(s=e[r+1];s===" "||s===" ";)s=e[++r+1];else if(s==="\r"&&e[r+1]===`
|
|
104
|
+
`)for(s=e[++r+1];s===" "||s===" ";)s=e[++r+1];else if(s==="x"||s==="u"||s==="U"){let f=s==="x"?2:s==="u"?4:8;n+=ZR(e,r+1,f,t),r+=f}else{let f=e.substr(r-1,2);t(r-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${f}`),n+=f}}else if(a===" "||a===" "){let s=r,l=e[r+1];for(;l===" "||l===" ";)l=e[++r+1];l!==`
|
|
105
|
+
`&&(l!=="\r"||e[r+2]!==`
|
|
106
|
+
`)&&(n+=r>s?e.slice(s,r+1):a)}else n+=a}return(e[e.length-1]!=='"'||e.length===1)&&t(e.length,"MISSING_CHAR",'Missing closing "quote'),n}function YR(e,t){let n="",r=e[t+1];for(;(r===" "||r===" "||r===`
|
|
107
|
+
`||r==="\r")&&(r!=="\r"||e[t+2]===`
|
|
108
|
+
`);)r===`
|
|
109
|
+
`&&(n+=`
|
|
110
|
+
`),t+=1,r=e[t+1];return n||=" ",{fold:n,offset:t}}var XR={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
|
|
111
|
+
`,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function ZR(e,t,n,r){let a=e.substr(t,n),s=a.length===n&&/^[0-9a-fA-F]+$/.test(a)?parseInt(a,16):NaN;try{return String.fromCodePoint(s)}catch{let l=e.substr(t-2,n+2);return r(t-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${l}`),l}}function oj(e,t,n,r){let{value:a,type:s,comment:l,range:f}=t.type==="block-scalar"?BR(e,t,r):VR(t,e.options.strict,r),p=n?e.directives.tagName(n.source,g=>r(n,"TAG_RESOLVE_FAILED",g)):null,h;h=e.options.stringKeys&&e.atKey?e.schema[Po]:p?GR(e.schema,a,p,n,r):t.type==="scalar"?QR(e,a,t,r):e.schema[Po];let v;try{let g=h.resolve(a,m=>r(n??t,"TAG_RESOLVE_FAILED",m),e.options);v=rt(g)?g:new qe(g)}catch(g){let m=g instanceof Error?g.message:String(g);r(n??t,"TAG_RESOLVE_FAILED",m),v=new qe(a)}return v.range=f,v.source=a,s&&(v.type=s),p&&(v.tag=p),h.format&&(v.format=h.format),l&&(v.comment=l),v}function GR(e,t,n,r,a){if(n==="!")return e[Po];let s=[];for(let f of e.tags)if(!f.collection&&f.tag===n)if(f.default&&f.test)s.push(f);else return f;for(let f of s)if(f.test?.test(t))return f;let l=e.knownTags[n];return l&&!l.collection?(e.tags.push(Object.assign({},l,{default:!1,test:void 0})),l):(a(r,"TAG_RESOLVE_FAILED",`Unresolved tag: ${n}`,n!=="tag:yaml.org,2002:str"),e[Po])}function QR({atKey:e,directives:t,schema:n},r,a,s){let l=n.tags.find(f=>(f.default===!0||e&&f.default==="key")&&f.test?.test(r))||n[Po];if(n.compat){let f=n.compat.find(p=>p.default&&p.test?.test(r))??n[Po];l.tag!==f.tag&&s(a,"TAG_RESOLVE_FAILED",`Value may be parsed as either ${t.tagString(l.tag)} or ${t.tagString(f.tag)}`,!0)}return l}function JR(e,t,n){if(t){n??=t.length;for(let r=n-1;r>=0;--r){let a=t[r];switch(a.type){case"space":case"comment":case"newline":e-=a.source.length;continue}for(a=t[++r];a?.type==="space";)e+=a.source.length,a=t[++r];break}}return e}var ez={composeNode:rj,composeEmptyNode:b0};function rj(e,t,n,r){let a=e.atKey,{spaceBefore:s,comment:l,anchor:f,tag:p}=n,h,v=!0;switch(t.type){case"alias":h=tz(e,t,r),(f||p)&&r(t,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":h=oj(e,t,p,r),f&&(h.anchor=f.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{h=FR(ez,e,t,n,r),f&&(h.anchor=f.source.substring(1))}catch(g){r(t,"RESOURCE_EXHAUSTION",g instanceof Error?g.message:String(g))}break;default:r(t,"UNEXPECTED_TOKEN",t.type==="error"?t.message:`Unsupported token (type: ${t.type})`),v=!1}return h??=b0(e,t.offset,void 0,null,n,r),f&&h.anchor===""&&r(f,"BAD_ALIAS","Anchor cannot be an empty string"),a&&e.options.stringKeys&&(!rt(h)||typeof h.value!="string"||h.tag&&h.tag!=="tag:yaml.org,2002:str")&&r(p??t,"NON_STRING_KEY","With stringKeys, all keys must be strings"),s&&(h.spaceBefore=!0),l&&(t.type==="scalar"&&t.source===""?h.comment=l:h.commentBefore=l),e.options.keepSourceTokens&&v&&(h.srcToken=t),h}function b0(e,t,n,r,{spaceBefore:a,comment:s,anchor:l,tag:f,end:p},h){let v=oj(e,{type:"scalar",offset:JR(t,n,r),indent:-1,source:""},f,h);return l&&(v.anchor=l.source.substring(1),v.anchor===""&&h(l,"BAD_ALIAS","Anchor cannot be an empty string")),a&&(v.spaceBefore=!0),s&&(v.comment=s,v.range[2]=p),v}function tz({options:e},{offset:t,source:n,end:r},a){let s=new Jg(n.substring(1));s.source===""&&a(t,"BAD_ALIAS","Alias cannot be an empty string"),s.source.endsWith(":")&&a(t+n.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let l=t+n.length,f=Td(r,l,e.strict,a);return s.range=[t,l,f.offset],f.comment&&(s.comment=f.comment),s}function nz(e,t,{offset:n,start:r,value:a,end:s},l){let f=new p0(void 0,Object.assign({_directives:t},e)),p={atKey:!1,atRoot:!0,directives:f.directives,options:f.options,schema:f.schema},h=qs(r,{indicator:"doc-start",next:a??s?.[0],offset:n,onError:l,parentIndent:0,startOnNewline:!0});h.found&&(f.directives.docStart=!0,a&&(a.type==="block-map"||a.type==="block-seq")&&!h.hasNewline&&l(h.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),f.contents=a?rj(p,a,h,l):b0(p,h.end,r,null,h,l);let v=f.contents.range[2],g=Td(s,v,!1,l);return g.comment&&(f.comment=g.comment),f.range=[n,v,g.offset],f}function Md(e){if(typeof e=="number")return[e,e+1];if(Array.isArray(e))return e.length===2?e:[e[0],e[1]];let{offset:t,source:n}=e;return[t,t+(typeof n=="string"?n.length:1)]}function ij(e){let t="",n=!1,r=!1;for(let a=0;a<e.length;++a){let s=e[a];switch(s[0]){case"#":t+=(t===""?"":r?`
|
|
112
|
+
|
|
113
|
+
`:`
|
|
114
|
+
`)+(s.substring(1)||" "),n=!0,r=!1;break;case"%":e[a+1]?.[0]!=="#"&&(a+=1),n=!1;break;default:n||(r=!0),n=!1}}return{comment:t,afterEmptyLine:r}}var oz=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(t,n,r,a)=>{let s=Md(t);a?this.warnings.push(new IR(s,n,r)):this.errors.push(new _d(s,n,r))},this.directives=new Ds({version:e.version||"1.2"}),this.options=e}decorate(e,t){let{comment:n,afterEmptyLine:r}=ij(this.prelude);if(n){let a=e.contents;if(t)e.comment=e.comment?`${e.comment}
|
|
115
|
+
${n}`:n;else if(r||e.directives.docStart||!a)e.commentBefore=n;else if(_t(a)&&!a.flow&&a.items.length>0){let s=a.items[0];Et(s)&&(s=s.key);let l=s.commentBefore;s.commentBefore=l?`${n}
|
|
116
|
+
${l}`:n}else{let s=a.commentBefore;a.commentBefore=s?`${n}
|
|
117
|
+
${s}`:n}}if(t){for(let a=0;a<this.errors.length;++a)e.errors.push(this.errors[a]);for(let a=0;a<this.warnings.length;++a)e.warnings.push(this.warnings[a])}else e.errors=this.errors,e.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:ij(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,t=!1,n=-1){for(let r of e)yield*this.next(r);yield*this.end(t,n)}*next(e){switch(e.type){case"directive":this.directives.add(e.source,(t,n,r)=>{let a=Md(e);a[0]+=t,this.onError(a,"BAD_DIRECTIVE",n,r)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let t=nz(this.options,this.directives,e,this.onError);this.atDirectives&&!t.directives.docStart&&this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(t,!1),this.doc&&(yield this.doc),this.doc=t,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{let t=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,n=new _d(Md(e),"UNEXPECTED_TOKEN",t);this.atDirectives||!this.doc?this.errors.push(n):this.doc.errors.push(n);break}case"doc-end":{if(!this.doc){this.errors.push(new _d(Md(e),"UNEXPECTED_TOKEN","Unexpected doc-end without preceding document"));break}this.doc.directives.docEnd=!0;let t=Td(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),t.comment){let n=this.doc.comment;this.doc.comment=n?`${n}
|
|
118
|
+
${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.push(new _d(Md(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,t=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let n=new p0(void 0,Object.assign({_directives:this.directives},this.options));this.atDirectives&&this.onError(t,"MISSING_CHAR","Missing directives-end indicator line"),n.range=[0,t,t],this.decorate(n,!1),yield n}}},x0=Symbol("break visit"),rz=Symbol("skip children"),aj=Symbol("remove item");function Hs(e,t){"type"in e&&e.type==="document"&&(e={start:e.start,value:e.value}),sj(Object.freeze([]),e,t)}Hs.BREAK=x0,Hs.SKIP=rz,Hs.REMOVE=aj,Hs.itemAtPath=(e,t)=>{let n=e;for(let[r,a]of t){let s=n?.[r];if(s&&"items"in s)n=s.items[a];else return}return n},Hs.parentCollection=(e,t)=>{let n=Hs.itemAtPath(e,t.slice(0,-1)),r=t[t.length-1][0],a=n?.[r];if(a&&"items"in a)return a;throw Error("Parent collection not found")};function sj(e,t,n){let r=n(t,e);if(typeof r=="symbol")return r;for(let a of["key","value"]){let s=t[a];if(s&&"items"in s){for(let l=0;l<s.items.length;++l){let f=sj(Object.freeze(e.concat([[a,l]])),s.items[l],n);if(typeof f=="number")l=f-1;else{if(f===x0)return x0;f===aj&&(s.items.splice(l,1),--l)}}typeof r=="function"&&a==="key"&&(r=r(t,e))}}return typeof r=="function"?r(t,e):r}function iz(e){switch(e){case"\uFEFF":return"byte-order-mark";case"":return"doc-mode";case"":return"flow-error-end";case"":return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
|
|
119
|
+
`:case`\r
|
|
120
|
+
`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(e[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}function po(e){switch(e){case void 0:case" ":case`
|
|
121
|
+
`:case"\r":case" ":return!0;default:return!1}}var lj=new Set("0123456789ABCDEFabcdef"),az=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),Pf=new Set(",[]{}"),sz=new Set(` ,[]{}
|
|
122
|
+
\r `),w0=e=>!e||sz.has(e),lz=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,t=!1){if(e){if(typeof e!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!t;let n=this.next??"stream";for(;n&&(t||this.hasChars(1));)n=yield*this.parseNext(n)}atLineEnd(){let e=this.pos,t=this.buffer[e];for(;t===" "||t===" ";)t=this.buffer[++e];return!t||t==="#"||t===`
|
|
123
|
+
`||t==="\r"&&this.buffer[e+1]===`
|
|
124
|
+
`}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let t=this.buffer[e];if(this.indentNext>0){let n=0;for(;t===" ";)t=this.buffer[++n+e];if(t==="\r"){let r=this.buffer[n+e+1];if(r===`
|
|
125
|
+
`||!r&&!this.atEnd)return e+n+1}return t===`
|
|
126
|
+
`||n>=this.indentNext||!t&&!this.atEnd?e+n:-1}if(t==="-"||t==="."){let n=this.buffer.substr(e,3);if((n==="---"||n==="...")&&po(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!="number"||e!==-1&&e<this.pos)&&(e=this.buffer.indexOf(`
|
|
127
|
+
`,this.pos),this.lineEndPos=e),e===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[e-1]==="\r"&&--e,this.buffer.substring(this.pos,e))}hasChars(e){return this.pos+e<=this.buffer.length}setNext(e){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=e,null}peek(e){return this.buffer.substr(this.pos,e)}*parseNext(e){switch(e){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let e=this.getLine();if(e===null)return this.setNext("stream");if(e[0]==="\uFEFF"&&(yield*this.pushCount(1),e=e.substring(1)),e[0]==="%"){let t=e.length,n=e.indexOf("#");for(;n!==-1;){let a=e[n-1];if(a===" "||a===" "){t=n-1;break}n=e.indexOf("#",n+1)}for(;;){let a=e[t-1];if(a===" "||a===" ")--t;else break}let r=(yield*this.pushCount(t))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-r),this.pushNewline(),"stream"}if(this.atLineEnd()){let t=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-t),yield*this.pushNewline(),"stream"}return yield"",yield*this.parseLineStart()}*parseLineStart(){let e=this.charAt(0);if(!e&&!this.atEnd)return this.setNext("line-start");if(e==="-"||e==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let t=this.peek(3);if((t==="---"||t==="...")&&po(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,t==="---"?"doc":"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!po(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,t]=this.peek(2);if(!t&&!this.atEnd)return this.setNext("block-start");if((e==="-"||e==="?"||e===":")&&po(t)){let n=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=n,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext("doc");let t=yield*this.pushIndicators();switch(e[t]){case"#":yield*this.pushCount(e.length-t);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(w0),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return t+=yield*this.parseBlockScalarHeader(),t+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-t),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,t,n=-1;do e=yield*this.pushNewline(),e>0?(t=yield*this.pushSpaces(!1),this.indentValue=n=t):t=0,t+=yield*this.pushSpaces(!0);while(e+t>0);let r=this.getLine();if(r===null)return this.setNext("flow");if((n!==-1&&n<this.indentNext&&r[0]!=="#"||n===0&&(r.startsWith("---")||r.startsWith("..."))&&po(r[3]))&&(n!==this.indentNext-1||this.flowLevel!==1||r[0]!=="]"&&r[0]!=="}"))return this.flowLevel=0,yield"",yield*this.parseLineStart();let a=0;for(;r[a]===",";)a+=yield*this.pushCount(1),a+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(a+=yield*this.pushIndicators(),r[a]){case void 0:return"flow";case"#":return yield*this.pushCount(r.length-a),"flow";case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,"flow";case"}":case"]":return yield*this.pushCount(1),this.flowKey=!0,--this.flowLevel,this.flowLevel?"flow":"doc";case"*":return yield*this.pushUntil(w0),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let s=this.charAt(1);if(this.flowKey||po(s)||s===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let e=this.charAt(0),t=this.buffer.indexOf(e,this.pos+1);if(e==="'")for(;t!==-1&&this.buffer[t+1]==="'";)t=this.buffer.indexOf("'",t+2);else for(;t!==-1;){let a=0;for(;this.buffer[t-1-a]==="\\";)a+=1;if(a%2==0)break;t=this.buffer.indexOf('"',t+1)}let n=this.buffer.substring(0,t),r=n.indexOf(`
|
|
128
|
+
`,this.pos);if(r!==-1){for(;r!==-1;){let a=this.continueScalar(r+1);if(a===-1)break;r=n.indexOf(`
|
|
129
|
+
`,a)}r!==-1&&(t=r-(n[r-1]==="\r"?2:1))}if(t===-1){if(!this.atEnd)return this.setNext("quoted-scalar");t=this.buffer.length}return yield*this.pushToIndex(t+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){let t=this.buffer[++e];if(t==="+")this.blockScalarKeep=!0;else if(t>"0"&&t<="9")this.blockScalarIndent=Number(t)-1;else if(t!=="-")break}return yield*this.pushUntil(t=>po(t)||t==="#")}*parseBlockScalar(){let e=this.pos-1,t=0,n;e:for(let a=this.pos;n=this.buffer[a];++a)switch(n){case" ":t+=1;break;case`
|
|
130
|
+
`:e=a,t=0;break;case"\r":{let s=this.buffer[a+1];if(!s&&!this.atEnd)return this.setNext("block-scalar");if(s===`
|
|
131
|
+
`)break}default:break e}if(!n&&!this.atEnd)return this.setNext("block-scalar");if(t>=this.indentNext){this.indentNext=this.blockScalarIndent===-1?t:this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let a=this.continueScalar(e+1);if(a===-1)break;e=this.buffer.indexOf(`
|
|
132
|
+
`,a)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext("block-scalar");e=this.buffer.length}}let r=e+1;for(n=this.buffer[r];n===" ";)n=this.buffer[++r];if(n===" "){for(;n===" "||n===" "||n==="\r"||n===`
|
|
133
|
+
`;)n=this.buffer[++r];e=r-1}else if(!this.blockScalarKeep)do{let a=e-1,s=this.buffer[a];s==="\r"&&(s=this.buffer[--a]);let l=a;for(;s===" ";)s=this.buffer[--a];if(s===`
|
|
134
|
+
`&&a>=this.pos&&a+1+t>l)e=a;else break}while(!0);return yield"",yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,t=this.pos-1,n=this.pos-1,r;for(;r=this.buffer[++n];)if(r===":"){let a=this.buffer[n+1];if(po(a)||e&&Pf.has(a))break;t=n}else if(po(r)){let a=this.buffer[n+1];if(r==="\r"&&(a===`
|
|
135
|
+
`?(n+=1,r=`
|
|
136
|
+
`,a=this.buffer[n+1]):t=n),a==="#"||e&&Pf.has(a))break;if(r===`
|
|
137
|
+
`){let s=this.continueScalar(n+1);if(s===-1)break;n=Math.max(n,s-2)}}else{if(e&&Pf.has(r))break;t=n}return!r&&!this.atEnd?this.setNext("plain-scalar"):(yield"",yield*this.pushToIndex(t+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,t){let n=this.buffer.slice(this.pos,e);return n?(yield n,this.pos+=n.length,n.length):(t&&(yield""),0)}*pushIndicators(){let e=0;e:for(;;){switch(this.charAt(0)){case"!":e+=yield*this.pushTag(),e+=yield*this.pushSpaces(!0);continue e;case"&":e+=yield*this.pushUntil(w0),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let t=this.flowLevel>0,n=this.charAt(1);if(po(n)||t&&Pf.has(n)){t?this.flowKey&&=!1:this.indentNext=this.indentValue+1,e+=yield*this.pushCount(1),e+=yield*this.pushSpaces(!0);continue e}}}break e}return e}*pushTag(){if(this.charAt(1)==="<"){let e=this.pos+2,t=this.buffer[e];for(;!po(t)&&t!==">";)t=this.buffer[++e];return yield*this.pushToIndex(t===">"?e+1:e,!1)}{let e=this.pos+1,t=this.buffer[e];for(;t;)if(az.has(t))t=this.buffer[++e];else if(t==="%"&&lj.has(this.buffer[e+1])&&lj.has(this.buffer[e+2]))t=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===`
|
|
138
|
+
`?yield*this.pushCount(1):e==="\r"&&this.charAt(1)===`
|
|
139
|
+
`?yield*this.pushCount(2):0}*pushSpaces(e){let t=this.pos-1,n;do n=this.buffer[++t];while(n===" "||e&&n===" ");let r=t-this.pos;return r>0&&(yield this.buffer.substr(this.pos,r),this.pos=t),r}*pushUntil(e){let t=this.pos,n=this.buffer[t];for(;!e(n);)n=this.buffer[++t];return yield*this.pushToIndex(t,!1)}},dz=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let t=0,n=this.lineStarts.length;for(;t<n;){let a=t+n>>1;this.lineStarts[a]<e?t=a+1:n=a}if(this.lineStarts[t]===e)return{line:t+1,col:1};if(t===0)return{line:0,col:e};let r=this.lineStarts[t-1];return{line:t,col:e-r+1}}}};function gi(e,t){for(let n=0;n<e.length;++n)if(e[n].type===t)return!0;return!1}function dj(e){for(let t=0;t<e.length;++t)switch(e[t].type){case"space":case"comment":case"newline":break;default:return t}return-1}function uj(e){switch(e?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function Df(e){switch(e.type){case"document":return e.start;case"block-map":{let t=e.items[e.items.length-1];return t.sep??t.start}case"block-seq":return e.items[e.items.length-1].start;default:return[]}}function Vs(e){if(e.length===0)return[];let t=e.length;e:for(;--t>=0;)switch(e[t].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;e[++t]?.type==="space";);return e.splice(t,e.length)}function If(e,t){if(t.length<1e5)Array.prototype.push.apply(e,t);else for(let n=0;n<t.length;++n)e.push(t[n])}function cj(e){if(e.start.type==="flow-seq-start")for(let t of e.items)t.sep&&!t.value&&!gi(t.start,"explicit-key-ind")&&!gi(t.sep,"map-value-ind")&&(t.key&&(t.value=t.key),delete t.key,uj(t.value)?t.value.end?If(t.value.end,t.sep):t.value.end=t.sep:If(t.start,t.sep),delete t.sep)}var uz=class{constructor(e){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new lz,this.onNewLine=e}*parse(e,t=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let n of this.lexer.lex(e,t))yield*this.next(n);t||(yield*this.end())}*next(e){if(this.source=e,this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let t=iz(e);if(t)if(t==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=t,yield*this.step(),t){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+e.length);break;case"space":this.atNewLine&&e[0]===" "&&(this.indent+=e.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=e.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=e.length}else{let n=`Not a YAML token: ${e}`;yield*this.pop({type:"error",offset:this.offset,message:n,source:e}),this.offset+=e.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let e=this.peek(1);if(this.type==="doc-end"&&e?.type!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source})}else{if(!e)return yield*this.stream();switch(e.type){case"document":return yield*this.document(e);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(e);case"block-scalar":return yield*this.blockScalar(e);case"block-map":return yield*this.blockMap(e);case"block-seq":return yield*this.blockSequence(e);case"flow-collection":return yield*this.flowCollection(e);case"doc-end":return yield*this.documentEnd(e)}yield*this.pop()}}peek(e){return this.stack[this.stack.length-e]}*pop(e){let t=e??this.stack.pop();if(!t)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield t;else{let n=this.peek(1);switch(t.type==="block-scalar"?t.indent="indent"in n?n.indent:0:t.type==="flow-collection"&&n.type==="document"&&(t.indent=0),t.type==="flow-collection"&&cj(t),n.type){case"document":n.value=t;break;case"block-scalar":n.props.push(t);break;case"block-map":{let r=n.items[n.items.length-1];if(r.value){n.items.push({start:[],key:t,sep:[]}),this.onKeyLine=!0;return}if(r.sep)r.value=t;else{Object.assign(r,{key:t,sep:[]}),this.onKeyLine=!r.explicitKey;return}break}case"block-seq":{let r=n.items[n.items.length-1];r.value?n.items.push({start:[],value:t}):r.value=t;break}case"flow-collection":{let r=n.items[n.items.length-1];!r||r.value?n.items.push({start:[],key:t,sep:[]}):r.sep?r.value=t:Object.assign(r,{key:t,sep:[]});return}default:yield*this.pop(),yield*this.pop(t)}if((n.type==="document"||n.type==="block-map"||n.type==="block-seq")&&(t.type==="block-map"||t.type==="block-seq")){let r=t.items[t.items.length-1];r&&!r.sep&&!r.value&&r.start.length>0&&dj(r.start)===-1&&(t.indent===0||r.start.every(a=>a.type!=="comment"||a.indent<t.indent))&&(n.type==="document"?n.end=r.start:n.items.push({start:r.start}),t.items.splice(-1,1))}}}*stream(){switch(this.type){case"directive-line":yield{type:"directive",offset:this.offset,source:this.source};return;case"byte-order-mark":case"space":case"comment":case"newline":yield this.sourceToken;return;case"doc-mode":case"doc-start":{let e={type:"document",offset:this.offset,start:[]};this.type==="doc-start"&&e.start.push(this.sourceToken),this.stack.push(e);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(e){if(e.value)return yield*this.lineEnd(e);switch(this.type){case"doc-start":dj(e.start)===-1?e.start.push(this.sourceToken):(yield*this.pop(),yield*this.step());return;case"anchor":case"tag":case"space":case"comment":case"newline":e.start.push(this.sourceToken);return}let t=this.startBlockValue(e);t?this.stack.push(t):yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(e){if(this.type==="map-value-ind"){let t=Vs(Df(this.peek(2))),n;e.end?(n=e.end,n.push(this.sourceToken),delete e.end):n=[this.sourceToken];let r={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:t,key:e,sep:n}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=r}else yield*this.lineEnd(e)}*blockScalar(e){switch(this.type){case"space":case"comment":case"newline":e.props.push(this.sourceToken);return;case"scalar":if(e.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let t=this.source.indexOf(`
|
|
140
|
+
`)+1;for(;t!==0;)this.onNewLine(this.offset+t),t=this.source.indexOf(`
|
|
141
|
+
`,t)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let t=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,t.value){let n="end"in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"space":case"comment":if(t.value)e.items.push({start:[this.sourceToken]});else if(t.sep)t.sep.push(this.sourceToken);else{if(this.atIndentedComment(t.start,e.indent)){let n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){If(n,t.start),n.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let n=!this.onKeyLine&&this.indent===e.indent,r=n&&(t.sep||t.explicitKey)&&this.type!=="seq-item-ind",a=[];if(r&&t.sep&&!t.value){let s=[];for(let l=0;l<t.sep.length;++l){let f=t.sep[l];switch(f.type){case"newline":s.push(l);break;case"space":break;case"comment":f.indent>e.indent&&(s.length=0);break;default:s.length=0}}s.length>=2&&(a=t.sep.splice(s[1]))}switch(this.type){case"anchor":case"tag":r||t.value?(a.push(this.sourceToken),e.items.push({start:a}),this.onKeyLine=!0):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"explicit-key-ind":!t.sep&&!t.explicitKey?(t.start.push(this.sourceToken),t.explicitKey=!0):r||t.value?(a.push(this.sourceToken),e.items.push({start:a,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(t.explicitKey)if(t.sep)if(t.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(gi(t.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:a,key:null,sep:[this.sourceToken]}]});else if(uj(t.key)&&!gi(t.sep,"newline")){let s=Vs(t.start),l=t.key,f=t.sep;f.push(this.sourceToken),delete t.key,delete t.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:l,sep:f}]})}else a.length>0?t.sep=t.sep.concat(a,this.sourceToken):t.sep.push(this.sourceToken);else if(gi(t.start,"newline"))Object.assign(t,{key:null,sep:[this.sourceToken]});else{let s=Vs(t.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:null,sep:[this.sourceToken]}]})}else t.sep?t.value||r?e.items.push({start:a,key:null,sep:[this.sourceToken]}):gi(t.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let s=this.flowScalar(this.type);r||t.value?(e.items.push({start:a,key:s,sep:[]}),this.onKeyLine=!0):t.sep?this.stack.push(s):(Object.assign(t,{key:s,sep:[]}),this.onKeyLine=!0);return}default:{let s=this.startBlockValue(e);if(s){if(s.type==="block-seq"){if(!t.explicitKey&&t.sep&&!gi(t.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else n&&e.items.push({start:a});this.stack.push(s);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let t=e.items[e.items.length-1];switch(this.type){case"newline":if(t.value){let n="end"in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.start.push(this.sourceToken);return;case"space":case"comment":if(t.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(t.start,e.indent)){let n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){If(n,t.start),n.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return;case"anchor":case"tag":if(t.value||this.indent<=e.indent)break;t.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;t.value||gi(t.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return}if(this.indent>e.indent){let n=this.startBlockValue(e);if(n){this.stack.push(n);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let t=e.items[e.items.length-1];if(this.type==="flow-error-end"){let n;do yield*this.pop(),n=this.peek(1);while(n?.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!t||t.sep?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return;case"map-value-ind":!t||t.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!t||t.value?e.items.push({start:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let r=this.flowScalar(this.type);!t||t.value?e.items.push({start:[],key:r,sep:[]}):t.sep?this.stack.push(r):Object.assign(t,{key:r,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let n=this.startBlockValue(e);n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{let n=this.peek(2);if(n.type==="block-map"&&(this.type==="map-value-ind"&&n.indent===e.indent||this.type==="newline"&&!n.items[n.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&n.type!=="flow-collection"){let r=Vs(Df(n));cj(e);let a=e.end.splice(1,e.end.length);a.push(this.sourceToken);let s={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:r,key:e,sep:a}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=s}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let t=this.source.indexOf(`
|
|
142
|
+
`)+1;for(;t!==0;)this.onNewLine(this.offset+t),t=this.source.indexOf(`
|
|
143
|
+
`,t)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let t=Vs(Df(e));return t.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:t,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let t=Vs(Df(e));return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:t,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!=="comment"||this.indent<=t?!1:e.every(n=>n.type==="newline"||n.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};function cz(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new dz||null,prettyErrors:t}}function fz(e,t={}){let{lineCounter:n,prettyErrors:r}=cz(t),a=new uz(n?.addNewLine),s=new oz(t),l=null;for(let f of s.compose(a.parse(e),!0,e.length))if(!l)l=f;else if(l.options.logLevel!=="silent"){l.errors.push(new _d(f.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return r&&n&&(l.errors.forEach(JN(e,n)),l.warnings.forEach(JN(e,n))),l}function kr(e,t,n){let r;typeof t=="function"?r=t:n===void 0&&t&&typeof t=="object"&&(n=t);let a=fz(e,n);if(!a)return null;if(a.warnings.forEach(s=>EN(a.options.logLevel,s)),a.errors.length>0){if(a.options.logLevel!=="silent")throw a.errors[0];a.errors=[]}return a.toJS(Object.assign({reviver:r},n))}function fj(e,t,n){let r=null;if(typeof t=="function"||Array.isArray(t)?r=t:n===void 0&&t&&(n=t),typeof n=="string"&&(n=n.length),typeof n=="number"){let a=Math.round(n);n=a<1?void 0:a>8?{indent:8}:{indent:a}}if(e===void 0){let{keepUndefined:a}=n??t??{};if(!a)return}return Sd(e)&&!r?e.toString(n):new p0(e,r,n).toString(n)}var yi=class{text;constructor(e){this.text=e}},hj=class{items;constructor(e){this.items=e}};function k0(e,t){if(!e.includes(`
|
|
144
|
+
`)||/[\r\u0085\u2028\u2029\ufeff]/.test(e))return;for(let f=0;f<e.length;f++){let p=e.charCodeAt(f);if(p<32&&p!==10&&p!==9)return}let n=/\n*$/.exec(e)?.[0].length??0;if(n>1)return;let r=(n?e.slice(0,-1):e).split(`
|
|
145
|
+
`);if(/^[ \t]/.test(r[0]??"")||r.some(f=>f!==""&&f.trim()===""))return;let a=" ".repeat(Math.max(t,1)),s=n?"|":"|-",l=r.map(f=>f===""?"":a+f);try{if(kr(`k: ${s}
|
|
146
|
+
${l.join(`
|
|
147
|
+
`)}
|
|
148
|
+
`)?.k!==e)return}catch{return}return{indicator:s,lines:l}}var pj=e=>e instanceof yi?e.text:e,hz=/^[-?:,[\]{}#&*!|>'"%@`\s]/;function Lf(e){if(e===""||e!==e.trim()||/[\n\r\t]/.test(e)||hz.test(e)||e.includes(": ")||e.includes(" #")||e.endsWith(":"))return!1;try{return kr(e)===e&&(/^[yYnN]$/.test(e)||kr(e,{version:"1.1"})===e)}catch{return!1}}function pz(e){for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n<32||n>=127&&n<=159||n===8232||n===8233)return!0}return!1}function Rf(e){return`'${e.replaceAll("'","''")}'`}function mz(e){let t="";for(let n of JSON.stringify(e)){let r=n.charCodeAt(0);t+=r>=127&&r<=159||r===8232||r===8233?`\\u${r.toString(16).padStart(4,"0")}`:n}return t}function S0(e,t){if(e===null)return"null";if(typeof e=="boolean")return e?"true":"false";if(typeof e=="number"){if(!Number.isFinite(e))throw Error(`cannot render ${e}`);return String(e)}return pz(e)||t==="QUOTE_DOUBLE"?mz(e):t==="QUOTE_SINGLE"?Rf(e):Lf(e)?e:Rf(e)}function mj(e){return Lf(e)?e:Rf(e)}function gj(e){return typeof e!="object"||!e||e instanceof yi}function gz(e){return Array.isArray(e)?e.length===0:typeof e=="object"&&!!e&&Object.keys(e).length===0}function N0(e,t){if(!(e instanceof yi&&k0(e.text,2))){if(e instanceof hj)return vi([...e.items]);if(gj(e))return S0(pj(e),t);if(gz(e))return Array.isArray(e)?"[]":"{}"}}function yj(e){return Lf(e)&&/[,[\]{}]/.test(e)?Rf(e):e}function vi(e,t){return gj(e)?yj(S0(pj(e),t)):e instanceof hj?vi([...e.items]):Array.isArray(e)?`[${e.map(n=>vi(n)).join(", ")}]`:`{${Object.entries(e).map(([n,r])=>`${yj(mj(n))}: ${vi(r)}`).join(", ")}}`}function Lo(e,t,n,r=!1){let a=" ".repeat(t),s=[],l=f=>{s.push(r&&s.length===0?f.slice(t):f)};if(Array.isArray(e)){for(let f of e){let p=f instanceof yi?S0(f.text):N0(f);if(p!==void 0){l(`${a}- ${p}`);continue}let h=Lo(f,t+2,n,!0);l(`${a}- ${h[0]}`),s.push(...h.slice(1))}return s}for(let[f,p]of Object.entries(e)){let h=mj(f),v=p instanceof yi?k0(p.text,t+n.indentUnit):void 0;if(v){l(`${a}${h}: ${v.indicator}`),s.push(...v.lines);continue}let g=N0(p);if(g!==void 0){l(`${a}${h}: ${g}`);continue}l(`${a}${h}:`);let m=Array.isArray(p)&&n.seqIndentless?t:t+n.indentUnit;s.push(...Lo(p,m,n))}return s}function Rt(e){let t=Number(e?.schema_version);return Number.isInteger(t)&&t>0?t:1}var vj=["id","key","type","title","status","tested","disabled","intent","condition","outcome","handler","purpose","join_mode","branches","ports","inputs","outputs","settings","approval","impl","undo","ref","origin","subflow"],yz=["id","key","kind","on","x","y","width","height","color","size","text"];function j0(e){return vj.slice(vj.indexOf(e)+1)}function Od(e){return e?.purpose??e?.handler}function C0(e){return e==="start"||e==="end"?{width:136,height:40}:e==="parallel"||e==="join"?{width:208,height:36}:{width:208,height:76}}var bj={width:200,height:120},xj={width:480,height:320},vz={s:13,m:18,l:26};function wj(e){let t=e.kind??"note";if(t==="note")return{width:e.width??bj.width,height:e.height??bj.height};if(t==="section")return{width:e.width??xj.width,height:e.height??xj.height};let n=vz[e.size??"m"],r=String(e.text??"").split(`
|
|
149
|
+
`),a=Math.max(1,...r.map(s=>s.length));return{width:e.width??Math.max(40,Math.round(a*n*.58)+8),height:e.height??Math.max(24,Math.round(r.length*n*1.35)+8)}}var kj={x:232,y:0},bz=e=>e.kind??"note";function xz(e,t,n={}){let r=[];for(let a of e.annotations){if(!a||typeof a!="object"||typeof a.id!="string")continue;let s=n[a.id]??{x:Number(a.x)||0,y:Number(a.y)||0},l=bz(a),f=l==="note"&&a.on?t.get(a.on):void 0;r.push({annotation:a,kind:l,position:f?{x:f.x+s.x,y:f.y+s.y}:s,...wj(a),...f?{on:a.on}:{}})}return r}var Sj=(e,t)=>e.position.x>=t.position.x&&e.position.y>=t.position.y&&e.position.x+e.width<=t.position.x+t.width&&e.position.y+e.height<=t.position.y+t.height;function wz(e,t){let n=e.annotations.find(r=>r.annotation.id===t&&r.kind==="section");return n?{nodes:e.nodes.filter(r=>Sj(r,n)).map(r=>r.node.id),annotations:e.annotations.filter(r=>r.annotation.id!==t&&!r.on&&Sj(r,n)).map(r=>r.annotation.id)}:{nodes:[],annotations:[]}}var kz=(e,t,n)=>e.position.x<t.position.x+t.width+n&&t.position.x<e.position.x+e.width+n&&e.position.y<t.position.y+t.height+n&&t.position.y<e.position.y+e.height+n;function Sz(e,t,n,r=16){let a={x:n.x-t.width/2,y:n.y-t.height/2},s=[];for(let l=-12;l<=12;l++)for(let f=-12;f<=12;f++)s.push({x:l*40,y:f*40});s.sort((l,f)=>Math.hypot(l.x,l.y)-Math.hypot(f.x,f.y));for(let l of s){let f={x:a.x+l.x,y:a.y+l.y};if(!e.some(p=>kz({position:f,...t},p,r)))return f}return a}function Nz(e,t=24){if(e.length===0)return;let n=Math.min(...e.map(l=>l.position.x))-t,r=Math.min(...e.map(l=>l.position.y))-t-32,a=Math.max(...e.map(l=>l.position.x+l.width))+t,s=Math.max(...e.map(l=>l.position.y+l.height))+t;return{position:{x:Math.round(n),y:Math.round(r)},width:Math.round(a-n),height:Math.round(s-r)}}function jz(e,t){let n=new Set(e),r=1;for(;n.has(`${t}-${r}`);)r++;return`${t}-${r}`}function Cz(e){let t={};for(let n of yz){let r=e[n];r!=null&&(t[n]=n==="text"?new yi(String(r)):r)}return t}var Nj={left:"Align Left Edges",center:"Align Centers (Flow Line)",right:"Align Right Edges",top:"Align Top Edges",middle:"Align Middles",bottom:"Align Bottom Edges"},jj={vertical:"Distribute Vertically",horizontal:"Distribute Horizontally"},zf=e=>Math.round(e);function Cj(e,t){let n={};for(let r of e){let a=t(r),s={x:zf(a.x),y:zf(a.y)};(s.x!==r.x||s.y!==r.y)&&(n[r.id]=s)}return n}function $z(e,t){if(e.length<2)return{};let n=Math.min(...e.map(h=>h.x)),r=Math.max(...e.map(h=>h.x+h.width)),a=Math.min(...e.map(h=>h.y)),s=Math.max(...e.map(h=>h.y+h.height)),l=h=>e.reduce((v,g)=>v+h(g),0)/e.length,f=l(h=>h.x+h.width/2),p=l(h=>h.y+h.height/2);return Cj(e,h=>{switch(t){case"left":return{x:n,y:h.y};case"right":return{x:r-h.width,y:h.y};case"center":return{x:f-h.width/2,y:h.y};case"top":return{x:h.x,y:a};case"bottom":return{x:h.x,y:s-h.height};case"middle":return{x:h.x,y:p-h.height/2}}})}function Ez(e,t){if(e.length<3)return{};let n=t==="vertical",r=g=>n?g.y:g.x,a=g=>n?g.height:g.width,s=[...e].sort((g,m)=>r(g)-r(m)||g.id.localeCompare(m.id)),l=s[0],f=s.at(-1),p=(r(f)+a(f)-r(l)-s.reduce((g,m)=>g+a(m),0))/(s.length-1),h=new Map,v=r(l);for(let g of s)h.set(g.id,v),v+=a(g)+p;return Cj(e,g=>n?{x:g.x,y:h.get(g.id)??g.y}:{x:h.get(g.id)??g.x,y:g.y})}function _z(e,t,n=6){let r=g=>t.flatMap(g),a=r(g=>[g.x,g.x+g.width/2,g.x+g.width]),s=r(g=>[g.y,g.y+g.height/2,g.y+g.height]),l=(g,m)=>{let b;for(let w of g)for(let k of m){let S=k-w;Math.abs(S)<=n&&(!b||Math.abs(S)<Math.abs(b.delta))&&(b={delta:S,line:k})}return b},f=l([e.x,e.x+e.width/2,e.x+e.width],a),p=l([e.y,e.y+e.height/2,e.y+e.height],s),h={...e,x:e.x+(f?.delta??0),y:e.y+(p?.delta??0)},v=(g,m)=>[...new Set(m.filter(b=>g.some(w=>Math.abs(w-b)<.5)))].sort((b,w)=>b-w);return{xs:v([h.x,h.x+h.width/2,h.x+h.width],a),ys:v([h.y,h.y+h.height/2,h.y+h.height],s),snap:{x:zf(h.x),y:zf(h.y)},...Az(h,t,n)}}function Az(e,t,n){for(let r of["vertical","horizontal"]){let a=r==="vertical",s=g=>a?g.x<e.x+e.width&&e.x<g.x+g.width:g.y<e.y+e.height&&e.y<g.y+g.height,l=g=>a?g.y:g.x,f=g=>a?g.y+g.height:g.x+g.width,p=t.filter(s),h=p.filter(g=>f(g)<=l(e)).sort((g,m)=>f(m)-f(g))[0],v=p.filter(g=>l(g)>=f(e)).sort((g,m)=>l(g)-l(m))[0];if(h&&v){let g=l(e)-f(h),m=l(v)-f(e);if(Math.abs(g-m)<=n)return{even:r}}}return{}}var $0=new Set(["failed_hosts","unreachable","timeout","rejected"]),$j={start:["ok_hosts"],end:["in"],task:["in","ok_hosts","failed_hosts"],subflow:["in","ok_hosts","failed_hosts"],decision:["in","true","false"],approval:["in","approved","rejected"],join:["in","ok_hosts"]},Ej=["unreachable","unchanged","always","cancelled","timeout","undo"],mo=new Set(["undo","cancelled"]),Ff={start:[],end:[],task:Ej,subflow:Ej,decision:[],approval:["timeout"],parallel:[],join:["failed_hosts"]},_j=/^branch_([0-9]+)$/;function Aj(e){return e.branches&&e.branches>=2?e.branches:2}function Tj(e){if(e.type==="parallel"){let t=["in"];for(let n=1;n<=Aj(e);n++)t.push(`branch_${n}`);return t}return[...$j[e.type]]}var Tz={start:["ok_hosts"],task:["ok_hosts"],subflow:["ok_hosts"],join:["ok_hosts"],decision:["true","false"],approval:["approved"]};function Bf(e){return e.type==="parallel"?Array.from({length:Aj(e)},(t,n)=>`branch_${n+1}`):Tz[e.type]??[]}function Mj(e){return Ff[e].filter(t=>!mo.has(t))}function qf(e){return e==="in"||e==="undo"?"in":"out"}function ha(e){return $0.has(e)}function Mz(e){return e==="in"?"top":e==="undo"?"left":$0.has(e)||e==="cancelled"?"right":"bottom"}function Oz(e){switch(e){case"ok_hosts":return"ok";case"failed_hosts":return"failed";case"unreachable":case"timeout":return"unreachable";case"true":case"false":return"decision";case"approved":case"rejected":return"approval";case"undo":return"undo";default:return"neutral"}}function pa(e,t=!1){return{name:e,direction:qf(e),side:Mz(e),tone:Oz(e),fail:$0.has(e),optional:t}}function Ks(e){let t=Tj(e),n=Ff[e.type],r=t.map(a=>pa(a));for(let a of n)e.ports?.includes(a)&&!t.includes(a)&&r.push(pa(a,!0));for(let a of Oj(e))r.push(pa(a));return r}var Pz=new Set([...Object.values($j).flat(),...Object.values(Ff).flat(),"join"]);function Dz(e){return/^[a-z][a-z0-9_]*$/.test(e)&&!Pz.has(e)&&!_j.test(e)}function Oj(e){return e.type==="subflow"?Object.keys(e.subflow?.boundary?.outputs??{}).filter(Dz):[]}var E0=["in","undo","always","ok_hosts","unchanged","true","false","approved","failed_hosts","rejected","unreachable","timeout","cancelled"];function Pj(e){let t=_j.exec(e);if(t)return E0.indexOf("approved")+Number(t[1])/1e3;let n=E0.indexOf(e);return n>=0?n:E0.indexOf("unchanged")+.5}function Pd(e){let t=new Set(Ks(e).map(r=>r.name)),n=Tj(e);return[...n,...Ff[e.type].filter(r=>!n.includes(r)&&(!mo.has(r)||t.has(r))),...Oj(e)].map(r=>({...pa(r,!n.includes(r)),enabled:t.has(r)})).sort((r,a)=>Pj(r.name)-Pj(a.name))}var Iz={task:"ok_hosts",subflow:"ok_hosts",join:"ok_hosts",decision:"true",approval:"approved",parallel:"branch_1"};function Dj(e,t,n=[]){let r={wires:[],exits:[],entries:[]},a=new Set(t.filter(f=>e.nodes.has(f))),s=new Set(n),l=new Set([...a].map(f=>e.nodes.get(f)?.level));for(let f of l){let p=e.levels.get(f);if(!p||p.parent&&Lz(e,p.parent,a))continue;let h=p.parent?e.nodes.get(p.parent)?.node:void 0,v=b=>Rz(p,h,b,s),g=b=>{let w=new Set;for(let k=b;;){if(w.has(k))return;w.add(k);let S=e.nodes.get(k)?.node,N=S?v(S):void 0;if(!N)return;if(N.kind==="exit"||!a.has(N.to.node))return N;k=N.to.node}};for(let b of p.edges){if(!b?.from?.node||!b.to?.node||s.has(b.id)||a.has(b.from.node)||!a.has(b.to.node))continue;let w=g(b.to.node);w?.kind==="wire"?r.wires.push({edge:b.id,to:w.to}):w?.kind==="exit"&&r.exits.push({edge:b.id,subflow:w.subflow,port:w.port,from:{node:b.from.node,port:b.from.port},...w.reason?{reason:w.reason}:{}})}let m=h?.subflow?.boundary?.in;if(h&&m&&a.has(m)){let b=g(m);b?.kind==="wire"&&r.entries.push({subflow:h.id,node:b.to.node})}}return r}function Lz(e,t,n){for(let r=t;r;r=e.nodes.get(r)?.level){if(n.has(r))return!0;if(!e.nodes.has(r))return!1}return!1}function Rz(e,t,n,r){let a=[];for(let s of Bf(n)){let l=e.edges.find(f=>f?.from?.node===n.id&&f.from.port===s&&!r.has(f.id));if(l?.to?.node)a.push({kind:"wire",to:{node:l.to.node,port:l.to.port}});else for(let[f,p]of Object.entries(t?.subflow?.boundary?.outputs??{})){let h=(p??[]).find(v=>v?.node===n.id&&v.port===s);h&&t&&a.push({kind:"exit",subflow:t.id,port:f,...h.reason?{reason:h.reason}:{}})}}return a.length===1?a[0]:void 0}function Ij(e){let t=e.wires.length+e.exits.length;if(t!==0||e.entries.length!==0)return t===0?"The subflow now starts at the next step":`Reconnected ${t} wire${t===1?"":"s"} across the gap`}function Lj(e,t,n){let r=e.nodes.get(t);if(!r)return"No such node";let a=Iz[r.node.type];if(!a)return`A ${r.node.type} node cannot sit on a wire`;let s=e.levels.get(r.level),l=s?.edges??[];if(l.some(p=>p?.to?.node===t))return"The node is already wired into a path";if(l.some(p=>p?.from?.node===t&&p.from.port===a))return`The node's ${a} is already wired`;let f=s?.parent?e.nodes.get(s.parent)?.node:void 0;if(f?.subflow?.boundary?.in===t)return"The node is the entry of the subflow";for(let p of Object.values(f?.subflow?.boundary?.outputs??{}))if((p??[]).some(h=>h?.node===t&&h.port===a))return`The node's ${a} already leaves the subflow`;if(n){let p=e.edges.get(n);if(!p)return"No such wire";if(p.level!==r.level)return"The node and the wire must be in the same level";if(p.edge.from.node===t||p.edge.to.node===t)return"The wire already touches the node"}}var on="root",zz={builds:0},Rj=new WeakMap;function $e(e){let t=Rj.get(e);return t||(t=Ro(e),Rj.set(e,t)),t}function Ro(e){zz.builds++;let t={doc:e,levels:new Map,nodes:new Map,edges:new Map,annotations:new Map};return zj(t,on,void 0,[],e),t}function zj(e,t,n,r,a){let s=Array.isArray(a.nodes)?a.nodes:[],l=Array.isArray(a.edges)?a.edges:[],f=Array.isArray(a.annotations)?a.annotations:[],p=[...r,"nodes"],h=[...r,"edges"],v=[...r,"annotations"];e.levels.set(t,{id:t,parent:n,nodesPath:p,edgesPath:h,annotationsPath:v,nodes:s,edges:l,annotations:f}),s.forEach((g,m)=>{if(!g||typeof g!="object")return;let b=[...p,m];typeof g.id=="string"&&(e.nodes.has(g.id)||e.nodes.set(g.id,{node:g,level:t,path:b}),g.subflow&&typeof g.subflow=="object"&&zj(e,g.id,g.id,[...b,"subflow"],g.subflow))}),l.forEach((g,m)=>{g&&typeof g=="object"&&typeof g.id=="string"&&(e.edges.has(g.id)||e.edges.set(g.id,{edge:g,level:t,path:[...h,m]}))}),f.forEach((g,m)=>{g&&typeof g=="object"&&typeof g.id=="string"&&(e.annotations.has(g.id)||e.annotations.set(g.id,{annotation:g,level:t,path:[...v,m]}))})}function Fz(e,t){let n=new Map,r=e.levels.get(t);for(;r;){for(let a of r.nodes)a&&!n.has(a.key)&&n.set(a.key,a.id);r=r.parent?e.levels.get(e.nodes.get(r.parent)?.level??""):void 0}return n}var Bz=["rollback","notify-stop","exclude","retry","stop","done","escalate","report"],Hf={rollback:{id:"rollback",label:"Rollback from Backup",hint:"Undo the completed nodes for the failed hosts only (reuses the Rollback of this level)",accepts:["failed_hosts"],palette:!0},"notify-stop":{id:"notify-stop",label:"Notify On-Call and Stop",hint:"Open a ticket, page on-call, end these hosts as stopped",accepts:["failed_hosts","unreachable","timeout","rejected"],palette:!0},retry:{id:"retry",label:"Retry",hint:"Try the step again, up to 3 more times 10 s apart, before hosts leave by this port",accepts:["failed_hosts","timeout"],types:["task"],bindings:["module"],palette:!0},exclude:{id:"exclude",label:"Exclude and Report",hint:"Take these hosts out of the run and list them in the report",accepts:["failed_hosts","unreachable"],palette:!0},stop:{id:"stop",label:"Stop Flow",hint:"End these hosts with a failed outcome",accepts:["failed_hosts","unreachable","timeout","rejected"],palette:!1},done:{id:"done",label:"Connect to Done",hint:"End these hosts with a success outcome",accepts:["ok_hosts","unchanged","approved","true","false"],palette:!1},escalate:{id:"escalate",label:"Escalate Approval",hint:"Ask the next approver; approved hosts rejoin the happy path",accepts:["rejected","timeout"],types:["approval"],palette:!1},report:{id:"report",label:"Send Run Report",hint:"Send per-host results after the step, whatever the outcome",accepts:["always"],palette:!1}};function _0(e,t,n){let r=Hf[e];return r.types&&!r.types.includes(t.type)||r.bindings&&t.impl&&!r.bindings.includes(t.impl.kind)?!1:r.accepts.includes(n)||r.accepts.includes("ok_hosts")&&/^branch_[0-9]+$/.test(n)}function Fj(e){return(e?.type==="task"||e?.type==="subflow")&&(Od(e)==="rollback"||e.key==="rollback")}function Bj(e,t){return e.nodes.find(n=>n?.id!==t&&Fj(n))}function*zo(e){for(let t of e??[])t&&typeof t=="object"&&(yield t,t.subflow&&typeof t.subflow=="object"&&(yield*zo(t.subflow.nodes)))}function qj(e){return(e.subflow?.nodes??[]).flatMap(t=>t?.id?[t.id,...qj(t)]:[])}function ma(e){if(Array.isArray(e))return e.map(ma);if(typeof e=="object"&&e){let t={};for(let n of Object.keys(e).sort())t[n]=ma(e[n]);return t}return e}function Hj(e){let{status:t,tested:n,approval:r,handler:a,subflow:s,ports:l,...f}=e,p=a!==void 0&&f.purpose===void 0?{...f,purpose:a}:f,h=l?.filter(w=>!mo.has(w));if(h?.length&&(p.ports=h),!s||typeof s!="object")return p;let{layout:v,annotations:g,nodes:m,...b}=s;return{...p,subflow:{...b,nodes:(m??[]).map(Hj)}}}function qz(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return(t>>>0).toString(16).padStart(8,"0")}function Hz(e){let t={};for(let n of zo(e.nodes))t[n.id]=qz(JSON.stringify(ma(Hj(n))));return t}function Vf(e,t){let n=$e(e);for(let r=t;r!=="root";){let a=n.nodes.get(r);if(!a)return;if(a.node.ref)return a.node;r=a.level}}function Kf(e,t){let n=new Map,r=a=>{let s=n.get(a);return s||(s={host:a,ports:[]},n.set(a,s)),s};for(let[a,s]of Object.entries(e.nodes[t]??{}))for(let l of s)r(l).ports.push(a);for(let[a,s]of Object.entries(e.problems?.[t]??{}))r(a).problem=s;for(let a of e.failures)a.node===t&&(r(a.host).problem??={task:a.task,status:"failed",msg:a.msg});return[...n.values()].sort((a,s)=>a.host.localeCompare(s.host))}function Vz(e,t){let n=Kf(e,t),r=e.timings?.[t],a=r?r.end-r.start:void 0;if(n.length===0)return{state:r?"ok":"idle",hosts:0,failed:0,seconds:a};let s=e.failures.some(f=>f.node===t),l=n.filter(f=>f.ports.length===0||f.ports.some(ha)).length;return{state:s?"failed":l>0?"warn":"ok",hosts:n.length,failed:l,seconds:a}}function Vj(e,t,n){return e.nodes[t]?.[n]??[]}function A0(e,t,n){return e.nodes.get(n.from.node)?.node.type==="start"?t.hosts:Vj(t,n.from.node,n.from.port)}function Wf(e,t,n){let r=e.levels.get(e.nodes.get(n)?.level??""),a=new Set;for(let s of r?.edges??[])if(s.to.node===n)for(let l of A0(e,t,s))a.add(l);return[...a].sort()}function Kz(e,t){let n=$e(e),r={};for(let{node:a}of n.nodes.values())if(a.type==="start"){let s=t.hosts.length;r[a.id]={state:s>0?"ok":"idle",hosts:s,failed:0}}else if(a.type==="end"){let s=Wf(n,t,a.id).length,l=a.outcome==="failed"?s:0;r[a.id]={state:s===0?"idle":l?"failed":"ok",hosts:s,failed:l}}else r[a.id]=Vz(t,a.id);for(let a=t.running;a&&a!=="root";a=n.nodes.get(a)?.level){let s=r[a];s&&(r[a]={...s,state:"running"})}return r}function Ut(e){if(e===void 0)return"";if(e<1)return"<1 s";if(e<60)return`${e.toFixed(+(e<10))} s`;let t=Math.floor(e/60);return`${t} min ${String(Math.round(e-t*60)).padStart(2,"0")} s`}function Kj(e){let t=e.summary,n=t?Object.keys(t.outcome).length+t.failures.length:0;return{ok:e.rc===0&&n===0&&!t?.stoppedEarly,failed:n}}function Wj(e){let t=e?.summary;return!!e&&!!t&&e.state==="done"&&e.mode==="real"&&e.rc===0&&!t.stoppedEarly&&t.failures.length===0&&Object.keys(t.outcome).length===0}function Wz(e,t){if(!t||!Wj(t)||t.flowVersion!==e.flow.version)return[];let n=t.summary,r=t.design?Hz(e):void 0;return[...$e(e).nodes.values()].map(a=>a.node).filter(a=>a.status==="implemented"&&(n.nodes[a.id]||n.timings?.[a.id])&&(!r||t.design?.[a.id]===r[a.id])).map(a=>a.id)}var Uj=44,Uz=28,Yj={view:{nodes:[],edges:[],annotations:[]},shift:{},inner:{},frames:new Set};function Yz(e,t,n){let r=e.nodes.filter(b=>b.node.type==="subflow"&&n.includes(b.node.id));if(r.length===0)return{...Yj,view:e};let a=[...r].sort((b,w)=>b.position.y-w.position.y).map(b=>b.node.id),s=new Map(e.nodes.map(b=>[b.node.id,{...b}])),l={},f=(b,w,k)=>{let S=s.get(b);if(!S||w===0&&k===0)return;S.position={x:S.position.x+w,y:S.position.y+k};let N=l[b]??{x:0,y:0};l[b]={x:N.x+w,y:N.y+k}},p={},h=new Set,v=[],g=[];for(let b of a){let w=s.get(b),k=t(b);if(!w||k.nodes.length===0)continue;let S=Math.min(...k.nodes.map(B=>B.position.x)),N=Math.min(...k.nodes.map(B=>B.position.y)),$=Math.max(...k.nodes.map(B=>B.position.x+B.width)),j=Math.max(...k.nodes.map(B=>B.position.y+B.height)),E=Math.max(w.width,$-S+56),I=j-N+Uj+Uz,z=E-w.width,T=I-w.height,M={...w.position,width:w.width,height:w.height},O=M.x+M.width/2;for(let B of s.values()){if(B.node.id===b)continue;let V=B.position.y>=M.y+M.height,oe=!V&&B.position.y+B.height>M.y&&B.position.y<M.y+I;V?f(B.node.id,0,T):oe&&f(B.node.id,B.position.x+B.width/2>=O?z/2:-z/2,0)}f(b,-z/2,0),w.width=E,w.height=I,h.add(b);let K={x:(E-($-S))/2-S,y:Uj-N};for(let B of k.nodes)p[B.node.id]=b,v.push({node:B,frame:b,rel:{x:B.position.x+K.x,y:B.position.y+K.y}});for(let B of k.edges)g.push({...B,inner:!0})}if(h.size===0)return{...Yj,view:e};let m=v.map(({node:b,frame:w,rel:k})=>{let S=s.get(w).position;return{...b,position:{x:S.x+k.x,y:S.y+k.y}}});return{view:{nodes:[...e.nodes.map(b=>s.get(b.node.id)),...m],edges:[...e.edges,...g],annotations:e.annotations},shift:l,inner:p,frames:h}}var Xz=.8,T0={padding:.15,maxZoom:1};function Zz(e,t,n=e.x+e.width/2){let r={width:Math.max(1,t.width-64),height:Math.max(1,t.height-64)},a=Math.max(1,e.width),s=Math.max(1,e.height),l=Math.min(r.width/a,r.height/s,1);if(l>=.8)return{zoom:l,x:(t.width-a*l)/2-e.x*l,y:(t.height-s*l)/2-e.y*l};let f=Math.max(Xz,Math.min(r.width/a,1)),p=32-e.y*f;if(a*f<=r.width)return{zoom:f,x:(t.width-a*f)/2-e.x*f,y:p};let h=t.width/2-n*f,v=32-e.x*f,g=t.width-32-(e.x+a)*f;return{zoom:f,x:Math.min(v,Math.max(g,h)),y:p}}var Xj={width:440,height:240};function Gz(e,t=Xj,n=32){return{x:e.x+e.width/2-t.width/2,y:e.y+e.height+n,...t}}function Qz(e,t){let n=Math.min(e.x,t.x),r=Math.min(e.y,t.y);return{x:n,y:r,width:Math.max(e.x+e.width,t.x+t.width)-n,height:Math.max(e.y+e.height,t.y+t.height)-r}}var Jz={width:160,height:110,margin:15};function e4(e,t,n=!1,r=Jz){let a=l=>({x:r.margin,y:l,width:r.width,height:r.height}),s=l=>!e.some(f=>f.x<l.x+l.width&&f.x+f.width>l.x&&f.y<l.y+l.height&&f.y+f.height>l.y);return!n&&s(a(t.height-r.margin-r.height))?"bottom-left":s(a(r.margin))?"top-left":null}var t4=["port","drift","lens","check"],n4=(e,t)=>`${e}:${t}`;function o4(e){let t=e.indexOf(":"),n=e.slice(0,t);return t>0&&t4.includes(n)?{area:n,what:e.slice(t+1)}:void 0}function Zj(e,t){if(!e||typeof e!="object")return;let n={index:t,...e.node?{node:e.node}:{},...e.reason===void 0?{}:{reason:e.reason},...e.by?{by:e.by}:{},..."at"in e&&e.at?{at:e.at}:{}};switch(e.kind){case"open_on_purpose":return{...n,area:"port",what:e.port};case"drift_ignored":return{...n,area:"drift",what:e.item};case"finding_accepted":return{...n,area:"lens",what:e.finding};case"accepted":{let r=o4(e.finding);return r?{...n,...r}:void 0}default:return}}function Ws(e){return(e.decisions??[]).flatMap((t,n)=>Zj(t,n)??[])}function r4(e){return{kind:"accepted",...e.node?{node:e.node}:{},finding:n4(e.area,e.what),...e.reason===void 0?{}:{reason:e.reason},...e.by?{by:e.by}:{},...e.at?{at:e.at}:{}}}function i4(e){let t=e.levels.get(on);if(!t)return;let n=t.nodes.filter(g=>!!g&&typeof g=="object"),r=new Map(n.map(g=>[g.id,g])),a=[];for(let{node:g,level:m}of e.nodes.values())g.type==="approval"&&m!=="root"&&a.push({node:g.id,message:`"${g.title}" is inside a subflow: runs that wait for a person (AWX workflows, Ansible Flow Server) split at top-level approvals only`});let s=n.filter(g=>g.type==="approval");if(s.length===0&&a.length===0)return;if(s.length===0)return{segments:[],problems:a};let l=new Map;for(let g of t.edges)g?.from?.node&&r.has(g.to?.node)&&l.set(g.from.node,[...l.get(g.from.node)??[],g]);let f=g=>{let m=new Set,b=g.flatMap(w=>(l.get(w.node)??[]).filter(k=>k.from.port===w.port).map(k=>k.to.node));for(;b.length>0;){let w=b.pop();if(!m.has(w)&&(m.add(w),r.get(w)?.type!=="approval"))for(let k of l.get(w)??[])b.push(k.to.node)}return m},p=[],h=(g,m,b,w)=>{if(p.length>=32)return;let k=n.filter(j=>j.type==="approval"&&m.has(j.id)).map(j=>j.id);k.length>1&&a.push({node:k[0],message:`${k.map(j=>`"${r.get(j)?.title}"`).join(" and ")} can wait for approval at the same time: a run that waits for a person (AWX workflow, Ansible Flow Server) waits at one approval at a time`});let S={name:g,nodes:m,entry:b,parent:w,gate:k[0]};p.push(S);let N=k.length===1?r.get(k[0]):void 0;if(!N)return;let $=g==="start"?"":`${g}_`;h(`${$}${N.key}-approved`,f([{node:N.id,port:"approved"}]),{approval:N.id,outcome:"approved"},g),h(`${$}${N.key}-rejected`,f([{node:N.id,port:"rejected"},{node:N.id,port:"timeout"}]),{approval:N.id,outcome:"rejected"},g)},v=n.find(g=>g.type==="start");return h("start",v?f([{node:v.id,port:"ok_hosts"}]):new Set),p.length>=32&&a.push({message:"The approvals split the flow into more than 32 segments"}),p.push({name:"finish",nodes:new Set,finish:!0}),{segments:p,problems:a}}var a4=["start","end","task","subflow","decision","approval","parallel","join"],Gj=["draft","specified","implemented","tested"],Qj=["yellow","blue","green","pink","purple","gray"],Jj=e=>Gj.indexOf(e);function Us(e){return e.type!=="start"&&e.type!=="end"}function Uf(e){return(e.subflow?.nodes??[]).filter(t=>!!t&&typeof t=="object"&&Us(t))}function s4(e){return e.type==="decision"?!!e.condition?.trim():e.type==="approval"||e.type==="parallel"||e.type==="join"}function Dd(e){let t=e.type==="subflow"?Uf(e):[];return t.length>0?eC(t.map(n=>n.status??"draft")):e.impl||s4(e)?"implemented":Object.keys(e.inputs??{}).length+Object.keys(e.outputs??{}).length>0?"specified":"draft"}function eC(e){return e.reduce((t,n)=>Jj(n)<Jj(t)?n:t,"tested")}function l4(e,t){return Rt(e)<2||!!t.tested}function M0(e,t){let n=Dd(t);return Uf(t).length>0?n:t.status==="tested"&&n==="implemented"&&l4(e,t)?"tested":n}function tC(e,t){return Us(t)&&Uf(t).length===0&&Dd(t)==="implemented"&&M0(e,t)!=="tested"}function d4(e,t){if(Us(t)){if(Uf(t).length>0)return M0(e,t)==="tested"?void 0:"A subflow is as far as its least finished step";switch(M0(e,t)){case"draft":return t.type==="decision"?"Write the condition to make it implemented":"Define at least one input or output to make it specified";case"specified":return t.type==="decision"?"Write the condition to make it implemented":"Bind a module, role or playbook to make it implemented";case"implemented":return"A passing real run of this flow version makes it tested (or Mark Tested\u2026 with a reason)";default:return}}}function O0(e){let t=e.doc.flow?.runtime;if(Rt(e.doc)<2)return t?.kind;if(!t?.template)return"ansible_playbook";let n=i4(e);return n&&n.problems.length===0&&n.segments.length>0?"awx_workflow":"awx_job"}var P0={start:"Start",end:"End",task:"Task",subflow:"Subflow",decision:"Decision",approval:"Approval",parallel:"Parallel",join:"Join"},nC=/^\{\{-?\s*([A-Za-z_][A-Za-z0-9_]*(?:\.[A-Za-z_][A-Za-z0-9_]*)*)\s*-?\}\}$/,u4=/\{\{[\s\S]*?\}\}/g;function c4(e){let t=[],n=0;for(let r of e.matchAll(u4)){let a=r.index??0,s=nC.exec(r[0])?.[1];s&&(a>n&&t.push({text:e.slice(n,a)}),t.push({ref:s,raw:r[0]}),n=a+r[0].length)}return(n<e.length||t.length===0)&&t.push({text:e.slice(n)}),t}function f4(e){return e.map(t=>"ref"in t?`{{ ${t.ref} }}`:t.text).join("")}var h4=new Set(["and","or","not","in","is","if","else","true","false","none","True","False","None"]);function D0(e){let t=[],n=0,r="";for(;n<e.length;){let a=e[n]??"";if(a==="'"||a==='"'){let l=e.indexOf(a,n+1);n=l<0?e.length:l+1,r="str";continue}let s=/^[A-Za-z_][A-Za-z0-9_]*/.exec(e.slice(n));if(s){let l=s[0],f=e.slice(n+l.length).trimStart(),p=f.startsWith("=")&&!f.startsWith("=="),h=f.startsWith("(");r==="."||r==="|"||r==="is"||p||h||h4.has(l)||t.push({name:l,start:n}),r=l==="is"||l==="not"&&r==="is"?"is":"id",n+=l.length}else/\s/.test(a)||(r=a),n++}return t}var p4=/\{\{([\s\S]*?)\}\}|\{%-?([\s\S]*?)-?%\}/g,m4=/\{#[\s\S]*?#\}/g,oC=/[A-Za-z_][A-Za-z0-9_]*/g;function g4(e){let t=/^\s*([a-z_]+)\b/.exec(e);if(!t)return{reads:[],binds:[]};let n=t[1],r=t[0].length,a=e.slice(r),s=(l,f)=>D0(l).map(p=>({name:p.name,start:p.start+f}));switch(n){case"if":case"elif":case"do":return{reads:s(a,r),binds:[]};case"set":{let l=/^\s*([A-Za-z_][\w]*(?:\s*,\s*[A-Za-z_]\w*)*)\s*(?=[=]|$)/.exec(a),f=a.indexOf("="),p=f<0?[]:s(a.slice(f+1),r+f+1);return l?{reads:p,binds:l[1]?.match(oC)??[]}:{reads:[...s(a.slice(0,f<0?void 0:f),r),...p],binds:[]}}case"for":{let l=/^\s*\(?\s*([\w\s,]+?)\s*\)?\s+in\s/.exec(a);if(!l)return{reads:s(a,r),binds:[]};let f=r+l[0].length;return{reads:s(e.slice(f),f).filter(p=>p.name!=="recursive"),binds:l[1]?.match(oC)??[]}}case"with":{let l=[...a.matchAll(/([A-Za-z_]\w*)\s*=(?!=)/g)].map(f=>f[1]);return{reads:s(a,r),binds:l}}case"macro":{let l=/^\s*([A-Za-z_]\w*)\s*\(([^)]*)\)/.exec(a),f=(l?.[2]??"").split(",").map(p=>p.split("=")[0]?.trim()??"");return{reads:[],binds:[l?.[1]??"",...f].filter(Boolean)}}default:return{reads:[],binds:[]}}}function rC(e){let t=[],n=new Set;for(let r of e.replaceAll(m4,"").matchAll(p4)){if(r[1]!==void 0){for(let s of D0(r[1]))t.includes(s.name)||t.push(s.name);continue}let a=g4(r[2]??"");for(let s of a.binds)n.add(s);for(let s of a.reads)t.includes(s.name)||t.push(s.name)}return n.size?t.filter(r=>!n.has(r)):t}function Yf(e){return typeof e=="string"&&/^\s*\{\{[\s\S]*\}\}\s*$/.test(e)}function I0(e){if(typeof e!="string")return;let t=nC.exec(e.trim())?.[1];return t&&!t.includes(".")?t:void 0}function Xf(e,t){return typeof e=="string"?t(e):Array.isArray(e)?e.map(n=>Xf(n,t)):e&&typeof e=="object"?Object.fromEntries(Object.entries(e).map(([n,r])=>[n,Xf(r,t)])):e}function L0(e){let t=new Set;return Xf(e,n=>{for(let r of rC(n))t.add(r);return n}),[...t]}function iC(e){let t=new Set;return Xf(e,n=>{let r=n.includes("{{")?rC(n):D0(n).map(a=>a.name);for(let a of r)t.add(a);return n}),[...t]}var y4="when.changed_when.failed_when.loop.loop_control.ignore_errors.delegate_to.delegate_facts.run_once.no_log.check_mode.diff.environment.become_user.become_method.become_flags.become_exe.connection.remote_user.port.throttle.async.poll.vars.module_defaults.debugger".split("."),Zf=/^with_[a-z_]+$/,v4=new Set(["when","changed_when","failed_when"]),b4={assert:["that"],debug:["var"]};function x4(e,t){return(b4[(e??"").replace(/^ansible\.(builtin|legacy)\./,"")]??[]).includes(t)}var w4=new Set(["when","loop","loop_control"]),k4={name:"the node title",register:"impl.register",tags:"settings.tags",become:"settings.become",timeout:"settings.timeout",retries:"settings.retries",delay:"settings.delay",until:"settings.until",notify:"a handler step with when: <register> is changed",listen:"a handler step with when: <register> is changed",ignore_unreachable:"the unreachable port",block:"a subflow",rescue:"a failure path from failed_hosts",always:"the always port or a step after both paths",action:"impl.ref and impl.params",local_action:"impl.ref with delegate_to: localhost",args:"impl.params",any_errors_fatal:"settings.max_fail_percentage: 0",collections:"a fully qualified impl.ref"};function S4(e){return y4.includes(e)||Zf.test(e)}function N4(e){if(S4(e))return;let t=k4[e];return t?`${e} is modelled by the flow: use ${t}`:`${e} is not a task keyword a binding can carry`}function j4(e){let t=Object.keys(e?.keywords??{});return[t.includes("when")?"when":"",t.some(n=>n==="loop"||Zf.test(n))?"loop":""].filter(Boolean).join(" + ")}var C4=new Set(["ok_hosts","approved","in"]);function aC(e){return!C4.has(e)}function $4(e){return e.kind==="exit"&&(!!e.exit?.reason||aC(e.exit?.port??"ok_hosts"))}function R0(e){return e.disabled?"Disabled \xB7 hosts pass through":e.type==="decision"?e.condition?`if ${e.condition}`:"Decision":[e.impl?.ref??(e.type==="task"?`${P0.task} \xB7 not implemented yet`:P0[e.type]),e.ref?`shared v${e.ref.version}`:void 0,Od(e),j4(e.impl)].filter(Boolean).join(" \xB7 ")}var Fo=(e,t=Hf[e].label)=>({kind:"pattern",label:t,hint:Hf[e].hint,pattern:e});function E4(e,t,n,r){let a=[],s=l=>_0(l,t,n);if(s("rollback")){let l=e.levels.get(r),f=l?Bj(l,t.id):void 0;f?a.push(Fo("rollback",`${f.title} (existing)`)):Fj(t)||a.push(Fo("rollback"))}return s("notify-stop")&&a.push(Fo("notify-stop",n==="rejected"?"Notify requester and stop":void 0)),s("exclude")&&a.push(Fo("exclude")),s("retry")&&a.push(Fo("retry")),s("escalate")&&a.push(Fo("escalate")),s("stop")&&a.push(Fo("stop")),a}function _4(e,t){switch(t){case"unchanged":return[Fo("done","Skip to Done"),{kind:"pick",label:"Skip to Another Node\u2026",mode:"to"}];case"always":return[{kind:"quickAdd",label:"Cleanup Task",title:"Cleanup"},Fo("report"),{kind:"pick",label:"Connect to Another Node\u2026",mode:"to"}];case"cancelled":return[];default:{let n=[{kind:"quickAdd",label:"Add Next Node"}];return _0("done",e,t)&&n.push(Fo("done",t==="false"?"Skip to Done":"Connect to Done")),n.push({kind:"pick",label:"Connect to Another Node\u2026",mode:"to"}),n}}}function Id(e,t){let n=e.nodes.get(t.node);if(!n)return;let{node:r,level:a}=n,s=Pd(r).find(v=>v.name===t.port);if(!s)return;let l=e.levels.get(a)?.edges??[],f=(e.doc.decisions??[]).some(v=>v?.node===t.node&&v.port===t.port),p=[];if(qf(t.port)==="in"){let v=l.filter(g=>g?.to?.node===t.node&&g.to.port===t.port);t.port!=="undo"&&p.push({kind:"pick",label:"Connect from Another Node\u2026",mode:"from"});for(let g of v){let m=e.nodes.get(g.from.node)?.node;p.push({kind:"disconnect",label:`Disconnect from ${m?.title??g.from.node} \xB7 ${g.from.port}`,edge:g.id})}return s.enabled?s.optional&&v.length===0&&p.push({kind:"disable",label:"Remove Port"}):p.unshift({kind:"enable",label:"Enable Port"}),{ref:t,node:r,enabled:s.enabled,connected:v.length>0,decided:f,items:p}}let h=l.find(v=>v?.from?.node===t.node&&v.from.port===t.port);return h?(p.push({kind:"insert",label:"Insert Node on This Wire",edge:h.id},{kind:"pick",label:"Rewire to Another Node\u2026",mode:"rewire",edge:h.id},{kind:"disconnect",label:"Disconnect",edge:h.id}),{ref:t,node:r,enabled:!0,connected:!0,decided:f,items:p}):(ha(t.port)?(p.push(...E4(e,r,t.port,a)),p.push({kind:"pick",label:"Connect to Another Node\u2026",mode:"to"}),f?p.push({kind:"decide",label:"Edit Reason\u2026"},{kind:"reopen",label:"Reopen"}):s.enabled&&p.push({kind:"decide",label:"Accept with Reason\u2026"})):p.push(..._4(r,t.port)),s.enabled?s.optional&&!f&&p.push({kind:"disable",label:"Remove Port"}):p.unshift({kind:"enable",label:"Enable Port"}),{ref:t,node:r,enabled:s.enabled,connected:!1,decided:f,items:p})}function Gf(e,t){let n=e.nodes.get(t);if(!n)return;let r=e.levels.get(n.level)?.edges??[],a=p=>r.find(h=>h?.from?.node===t&&h.from.port===p),s=Bf(n.node),l=s.find(p=>!a(p));if(l)return{port:l};let f=s[0]?a(s[0]):void 0;return f&&s[0]?{port:s[0],insertOn:f.id}:void 0}function sC(e,t){let n=e.nodes.get(t);if(!n)return;let r=e.levels.get(n.level)?.edges??[],a=l=>r.some(f=>f?.from?.node===t&&f.from.port===l),s=Pd(n.node).filter(l=>l.direction==="out"&&!l.fail&&l.name!=="cancelled"&&!a(l.name));return(s.find(l=>l.enabled)??s[0])?.name}function A4(e,t,n,r){let a=e.nodes.get(t);if(!a)return;let s=e.levels.get(a.level)?.edges??[],l=p=>s.some(h=>h?.from?.node===t&&h.from.port===p),f=Pd(a.node).filter(p=>p.direction==="out"&&_0(n,a.node,p.name)&&!l(p.name));return r&&f.some(p=>p.name===r)?r:(f.find(p=>p.enabled)??f[0])?.name}function T4(e,t,n){let r=a=>n.mode==="attach"?!0:n.mode==="from"?sC(e,a.id)!==void 0:Ks(a).some(s=>s.name==="in");return t.filter(({node:a})=>a.id!==n.node&&r(a)).sort((a,s)=>a.position.y-s.position.y||a.position.x-s.position.x).map(({node:a})=>a.id)}function M4(e,t,n){if(e.length===0)return;let r=t?e.indexOf(t):-1;return r<0?n>0?e[0]:e.at(-1):e[(r+n+e.length)%e.length]}var lC=e=>{let t,n=new Set,r=(f,p)=>{let h=typeof f=="function"?f(t):f;if(!Object.is(h,t)){let v=t;t=p??(typeof h!="object"||!h)?h:Object.assign({},t,h),n.forEach(g=>g(t,v))}},a=()=>t,s={setState:r,getState:a,getInitialState:()=>l,subscribe:f=>(n.add(f),()=>n.delete(f))},l=t=e(r,a,s);return s},O4=(e=>e?lC(e):lC),P4=e=>e;function D4(e,t=P4){let n=A.useSyncExternalStore(e.subscribe,A.useCallback(()=>t(e.getState()),[e,t]),()=>t(e.getInitialState()));return A.useDebugValue(n),n}var dC=e=>{let t=O4(e),n=r=>D4(t,r);return Object.assign(n,t),n},I4=(e=>e?dC(e):dC),L4=new WeakMap;function R4(e,t){let n=new Map;for(let r of e){let a=r?.from?.node,s=r?.to?.node;if(!a||!s)continue;let[l,f]=t?[a,s]:[s,a],p=n.get(l);p?p.push(f):n.set(l,[f])}return{size:e.length,map:n}}function z4(e,t,n){let r=e.get(t);return r&&r.size===t.length||(r=R4(t,n),e.set(t,r)),r.map}function F4(e,t){return z4(L4,e,!1).get(t)??[]}function z0(e,t){let n=[],r=t;for(;r&&r!=="root";){let a=e.nodes.get(r);if(!a)break;n.push(a.node),r=a.level}return n}function uC(e,t){let n=(e.subflow?.nodes??[]).filter(s=>!!s?.key),r=e.outputs?.[t]?.from;if(r){let[s,l,...f]=r.split("."),p=n.find(h=>h.key===s);return p&&l?{inner:p,output:l,path:f}:void 0}if(!e.outputs||!(t in e.outputs))return;let a=n.filter(s=>s.outputs&&t in s.outputs);return a.length===1?{inner:a[0],output:t,path:[]}:a.length>1?{ambiguous:a.map(s=>s.key)}:void 0}function cC(e){let t=Object.keys(e??{});return t.length?` (it has ${t.join(", ")})`:" (it has none)"}function B4(e,t,n,r){return r==="outputs"&&e.levels.has(t.id)?t.id:n}function F0(e,t,n,r,a){let[s="",l="",...f]=a.trim().split(".");if(s==="flow")return l in(e.doc.flow?.inputs??{})?{kind:"flow",name:l,path:f}:{kind:"unresolved",why:`the flow has no input ${l}`};if(s==="impl")return{kind:"impl",path:[l,...f].filter(Boolean)};if(s.includes("/")){let[m="",...b]=s.split("/");return{kind:"unresolved",why:`reads a step inside subflow ${m}; from outside, read what ${m} lifts: give ${m} an output ${l} (from: ${b.join("/")}.${l}) and read ${m}.${l} (the AI tools and the @ picker lift it for you)`}}let p=B4(e,t,n,r),h=Fz(e,p).get(s),v=h?e.nodes.get(h)?.node:void 0;if(!v)return{kind:"unresolved",why:`no node "${s}" on this level or around it`};if(z0(e,p).some(m=>m.id===v.id)){let m=v.inputs?.[l];return m?{kind:"subflowInput",node:v,name:l,field:m,path:f}:{kind:"unresolved",why:`inside subflow ${s}, ${s}.<name> reads its input, and it has no input ${l}${cC(v.inputs)}`}}if(!l||v.outputs&&l in v.outputs)return{kind:"output",node:v,name:l,path:f};let g=(v.subflow?.nodes??[]).find(m=>m?.outputs&&l in m.outputs);return v.type==="subflow"&&g?{kind:"unresolved",target:v,why:`${s} does not lift ${l}; its step ${g.key} has it: give ${s} an output ${l} (from: ${g.key}.${l}), or pass the path ${s}/${g.key}.${l} to the AI tools, which lift it`}:{kind:"unresolved",target:v,why:`${s} has no output ${l}${cC(v.outputs)}`}}function fC(e,t){let n=[],r=e.nodes.get(t);for(;r;){let a=e.levels.get(r.level);if(!a)break;let s=new Set([r.node.id]),l=[r.node.id];for(let f=0;f<l.length;f++)for(let p of F4(a.edges,l[f])){if(s.has(p))continue;s.add(p),l.push(p);let h=e.nodes.get(p)?.node;h&&h.type!=="start"&&n.push(h)}r=a.parent?e.nodes.get(a.parent):void 0}return n}function q4(e){return e.toLowerCase().replaceAll(/[^a-z0-9_]/g,"_")}function Ys(e,t=e.impl){return t?.register||`${q4(e.key)}_result`}var H4=/^\[[a-z0-9-]+\] keep output [a-z][a-z0-9_]*$/,V4={s:1,m:60,h:3600,d:86400};function ga(e){if(typeof e=="number")return e>0?Math.round(e):void 0;let t=e?.trim().toLowerCase();if(!t)return;if(/^[0-9]+$/.test(t))return Number(t)||void 0;let n=[...t.matchAll(/([0-9]+)\s*([smhd])/g)];if(n.length!==0&&n.map(r=>r[0]).join("")===t.replaceAll(/\s+/g,""))return n.reduce((r,a)=>r+Number(a[1])*(V4[a[2]]??0),0)||void 0}function K4(e){let t=Math.floor(e/3600),n=Math.floor(e%3600/60),r=e%60;return`${t?`${t}h`:""}${n?`${n}m`:""}${r?`${r}s`:""}`||"0s"}function B0(e){let t=Math.floor(e/3600),n=Math.floor(e%3600/60),r=e%60;return[t?`${t} h`:"",n?`${n} min`:"",r?`${r} s`:""].filter(Boolean).join(" ")||"0 s"}function hC(e){return e.replaceAll(/\{[{%#]/g,t=>`{{ '${t}' }}`)}var pC=class{$flow;constructor(e){this.$flow=e}},W4=class{$comment;constructor(e){this.$comment=e}},q0=e=>new pC(e),U4=e=>e instanceof pC,mC=e=>e instanceof W4,gC=/[\u0000-\u001f\u007f-\u009f\u2028\u2029]/g,yC=e=>String(e).replaceAll(gC," ").replaceAll(/\s+/g," ").trim(),Y4=e=>`# ${String(e).replaceAll(gC," ")}`.trimEnd(),X4=/^[A-Za-z_][A-Za-z0-9_./-]*$/,Z4=/^(true|false|yes|no|on|off|null)$/i,Qf=new Map;function G4(e){if(X4.test(e))return!Z4.test(e);let t=Qf.get(e);return t===void 0&&(t=Lf(e),Qf.size>5e3&&Qf.clear(),Qf.set(e,t)),t}var Q4=/[\u0000-\u001f\u007f-\u009f\u2028\u2029]/;function J4(e){return JSON.stringify(e).replaceAll(/[\u007f-\u009f\u2028\u2029]/g,t=>`\\u${t.charCodeAt(0).toString(16).padStart(4,"0")}`)}function Jf(e){return e===null?"null":typeof e=="string"?!Q4.test(e)&&G4(e)?e:J4(e):String(e)}function vC(e){if(typeof e!="object"||!e)return Jf(e);if(U4(e))return`[${e.$flow.map(Jf).join(", ")}]`;if(Array.isArray(e)&&e.length===0)return"[]";if(!Array.isArray(e)&&!mC(e)&&Object.keys(e).length===0)return"{}"}function eh(e,t,n=!1){let r=" ".repeat(t),a=[],s=l=>a.push(n&&a.length===0?l:r+l);if(Array.isArray(e)){for(let l of e){if(mC(l)){a.push(`${r}${Y4(l.$comment)}`);continue}let f=vC(l);if(f!==void 0){s(`- ${f}`);continue}let p=eh(l,t+2,!0);s(`- ${p[0]}`),a.push(...p.slice(1))}return a}for(let[l,f]of Object.entries(e)){if(f===void 0)continue;let p=vC(f);p===void 0?(s(`${Jf(l)}:`),a.push(...eh(f,t+2))):s(`${Jf(l)}: ${p}`)}return a}function Sr(e,t){return e.lastIndexOf(`
|
|
150
|
+
`,t-1)+1}function Xs(e,t){return t-Sr(e,t)}function eF(e){let t=e.key;return rt(t)?String(t.value):void 0}function Ld(e,t){return e.items.find(n=>eF(n)===t)}function Zs(e,t){let n=e.doc.contents,r=[],a={node:n,ancestors:r};for(let s of t){if(!n)return;if(br(n))return{node:n,ancestors:r,alias:!0};if(r.push(n),typeof s=="number"){if(!Io(n))return;let l=n.items[s];if(l===void 0)return;a={node:l,parent:n,ancestors:[...r]},n=l}else{if(!Do(n))return;let l=Ld(n,s);if(!l)return;a={node:l.value,pair:l,parent:n,ancestors:[...r]},n=l.value}}return br(a.node)&&(a.alias=!0),a}function Zn(e){return!!e&&"anchor"in e&&!!e.anchor}function Rd(e){if(!e)return!1;let t=!1;return mi(e,{Node(n,r){if(br(r)||Zn(r))return t=!0,mi.BREAK}}),t}var vt=e=>({ok:!0,edits:e}),dt=(e,t)=>({ok:!1,code:e,reason:t});function tF(e,t){if(t===0||e[t-1]===`
|
|
151
|
+
`)return t;let n=e.indexOf(`
|
|
152
|
+
`,t);return n===-1?e.length:n+1}function th(e,t,n){let r=n;for(;r>t&&(e[r-1]===`
|
|
153
|
+
`||e[r-1]==="\r");)r--;return r}function nh(e,t){let n=t.range?.[1]??0,r=e.indexOf(":",n);return r===-1?n:r+1}function bC(e){return(Do(e)||Io(e))&&!e.flow}function xC(e){return rt(e)?e.type:void 0}function nF(e,t){if(e.alias||e.ancestors.some(Zn)||Rd(t))return dt("unsupported","edit touches YAML anchors or aliases")}function H0(e,t,n){let{eol:r}=e.style,a=n.join(r);return{start:t,end:t,newText:t===0||e.text[t-1]===`
|
|
154
|
+
`?a+r:r+a}}function zd(e,t){let n=e.range;return n?vt([{start:n[0],end:n[1],newText:vi(t)}]):dt("invalid","node has no source range")}function ya(e,t,n){let r=nF(t,t.node);if(r)return r;let{text:a,style:s}=e,l=t.node,f=t.parent,p=f?.flow?void 0:t.pair?.key,h=n instanceof yi&&!p?n.text:n,v=h instanceof yi&&p?k0(h.text,oh(e,p,h)):void 0;if(v&&p){let S=nh(a,p),N=l?.range;return vt([{start:S,end:!N||N[0]===N[1]?Math.max(S,N?.[1]??S):th(a,N[0],bC(l)?N[2]:N[1]),newText:` ${v.indicator}${s.eol}${v.lines.join(s.eol)}`}])}if(f?.flow){if(l?.range&&l.range[0]<l.range[1]){let N=vi(h,xC(l));return vt([{start:l.range[0],end:l.range[1],newText:N}])}let S=f.toJSON();return Array.isArray(S)?S[f.items.indexOf(l)]=h:t.pair&&(S[String(t.pair.key.value)]=h),zd(f,S)}let g=N0(h,xC(l)),m=t.pair?.key;if(!l?.range||l.range[0]===l.range[1]){if(!m)return dt("invalid","empty value without a key");let S=nh(a,m),N=l?.range?Math.max(S,l.range[1]):S;if(g!==void 0)return vt([{start:S,end:N,newText:` ${g}`}]);let $=oh(e,m,h);return vt([{start:S,end:N,newText:s.eol+Lo(h,$,s).join(s.eol)}])}if(!bC(l)){let S=th(a,l.range[0],l.range[1]);if(g!==void 0)return vt([{start:l.range[0],end:S,newText:g}]);if(m){let $=Lo(h,oh(e,m,h),s);return vt([{start:nh(a,m),end:S,newText:s.eol+$.join(s.eol)}])}let N=Lo(h,Xs(a,l.range[0]),s,!0);return vt([{start:l.range[0],end:S,newText:N.join(s.eol)}])}let b=th(a,l.range[0],l.range[2]);if(g!==void 0)return vt([{start:m?nh(a,m):l.range[0],end:b,newText:m?` ${g}`:g}]);let w=Io(l)===Array.isArray(h)||!m?Xs(a,l.range[0]):oh(e,m,h);if(m)return vt([{start:Sr(a,l.range[0]),end:b,newText:Lo(h,w,s).join(s.eol)}]);let k=Lo(h,w,s,!0);return vt([{start:l.range[0],end:b,newText:k.join(s.eol)}])}function oh(e,t,n){let r=Xs(e.text,t.range?.[0]??0);return Array.isArray(n)&&e.style.seqIndentless?r:r+e.style.indentUnit}function Nr(e,t,n,r={}){if(t.length===0)return dt("invalid","empty path");let a=Zs(e,t);if(a)return ya(e,a,n);let s=t.slice(0,-1),l=t.at(-1),f=Zs(e,s);return f?.alias?dt("unsupported","edit touches YAML anchors or aliases"):f?typeof l=="number"?sF(e,s,l,n):rF(e,f,l,n,r.before??[]):typeof l=="string"?Nr(e,s,{[l]:n}):dt("not-found",`no sequence at ${s.join(".")}`)}function oF(e,t,n,r){if(!t.range||e[t.range[0]]!=="{")return;if(n?.range){let l=n.range[0];return/[{,]\s*$/.test(e.slice(t.range[0],l))?{start:l,end:l,newText:`${r}, `}:void 0}let a=t.items.at(-1),s=Math.max(a?.key?.range?.[1]??0,a?.value?.range?.[1]??0);if(/^\s*[,}]/.test(e.slice(s,t.range[1])))return{start:s,end:s,newText:`, ${r}`}}function rF(e,t,n,r,a){let s=t.node;if(s===null||rt(s)&&s.value===null)return ya(e,t,{[n]:r});if(!Do(s))return dt("invalid","parent is not a map");if(t.ancestors.some(Zn)||Zn(s))return dt("unsupported","edit touches YAML anchors or aliases");let l=a.map(m=>Ld(s,m)).find(m=>m!==void 0)?.key;if(s.flow){if(s.items.length===0)return ya(e,t,{[n]:r});let m=oF(e.text,s,l,`${vi(n)}: ${vi(r)}`);return m?vt([m]):zd(s,{...s.toJSON(),[n]:r})}let{text:f,style:p}=e,h=s.items[0]?.key;if(!h?.range||!s.range)return dt("invalid","map has no source range");let v=Xs(f,h.range[0]),g=Lo({[n]:r},v,p);if(l?.range){let m=Sr(f,l.range[0]);if(f.slice(m,l.range[0]).trim()==="")return vt([{start:m,end:m,newText:g.join(p.eol)+p.eol}]);let b=" ".repeat(v),w=[g[0]?.slice(v)??"",...g.slice(1)].join(p.eol);return vt([{start:l.range[0],end:l.range[0],newText:w+p.eol+b}])}return vt([H0(e,s.range[2],g)])}function wC(e,t,n){let r=Sr(e,t),a=tF(e,n);return a===e.length&&!e.endsWith(`
|
|
155
|
+
`)&&r>0?[r-(e[r-2]==="\r"?2:1),a]:[r,a]}function iF(e,t){let n=t.key,r=n.range?.[0]??0;return wC(e,r,t.value?.range?.[2]??n.range?.[2]??r)}function aF(e,t,n,r){let a=Zs(e,t),s=a?.node;if(a?.alias)return dt("unsupported","edit touches YAML anchors or aliases");if(!a||!Do(s))return dt("not-found",`no map at ${t.join(".")}`);let l=Ld(s,n),f=l?.key?.range;if(!l||!f)return dt("not-found",`no key ${n}`);if(Ld(s,r))return dt("invalid",`key ${r} already exists`);if(a.ancestors.some(Zn)||Zn(s)||Rd(l.key))return dt("unsupported","edit touches YAML anchors or aliases");let p=/^[A-Za-z0-9][A-Za-z0-9_./-]*$/.test(r);return vt([{start:f[0],end:f[1],newText:p?r:JSON.stringify(r)}])}function Bo(e,t,n){let r=Zs(e,t),a=r?.node;if(r?.alias)return dt("unsupported","edit touches YAML anchors or aliases");if(!r||!Do(a))return dt("not-found",`no map at ${t.join(".")}`);let s=Ld(a,n);if(!s)return dt("not-found",`no key ${n}`);if(r.ancestors.some(Zn)||Zn(a)||Rd(s.value)||Rd(s.key))return dt("unsupported","edit touches YAML anchors or aliases");if(a.flow){let g=a.toJSON();return delete g[n],zd(a,g)}let{text:l}=e;if(a.items.length===1){if(t.length>0)return ya(e,r,{});let g=Sr(l,a.range?.[0]??0);return vt([{start:g,end:th(l,g,a.range?.[2]??l.length),newText:"{}"}])}let f=s.key.range?.[0]??0,p=Sr(l,f);if(l.slice(p,f).trim()!==""){let g=a.items[a.items.indexOf(s)+1]?.key;return g?.range?vt([{start:f,end:g.range[0],newText:""}]):dt("invalid","cannot remove the only key of an item")}let[h,v]=iF(l,s);return vt([{start:h,end:v,newText:""}])}function sF(e,t,n,r){let a=Zs(e,t);if(!a)return Nr(e,t,[r]);if(a.alias)return dt("unsupported","edit touches YAML anchors or aliases");let s=a.node;if(s===null||rt(s)&&s.value===null)return ya(e,a,[r]);if(!Io(s))return dt("invalid","not a sequence");if(a.ancestors.some(Zn)||Zn(s))return dt("unsupported","edit touches YAML anchors or aliases");let l=n==="end"?s.items.length:Math.min(n,s.items.length);if(s.flow){if(s.items.length===0)return ya(e,a,[r]);let w=s.toJSON();return w.splice(l,0,r),zd(s,w)}let{text:f,style:p}=e;if(!s.range)return dt("invalid","sequence has no source range");let h=Xs(f,s.range[0]),v=Lo([r],h,p),g=s.items[l];if(!g?.range)return vt([H0(e,s.range[2],v)]);let m=Sr(f,g.range[0]),b=m+h;return f.slice(m,b).trim()===""?vt([H0(e,m,v)]):vt([{start:b,end:b,newText:[v[0]?.slice(h)??"",...v.slice(1)].join(p.eol)+p.eol+" ".repeat(h)}])}function rh(e,t,n){let r=Zs(e,t),a=r?.node;if(r?.alias)return dt("unsupported","edit touches YAML anchors or aliases");if(!r||!Io(a))return dt("not-found",`no sequence at ${t.join(".")}`);let s=a.items[n];if(!s?.range)return dt("not-found",`no item ${n}`);if(r.ancestors.some(Zn)||Zn(a)||Rd(s))return dt("unsupported","edit touches YAML anchors or aliases");if(a.flow){let g=a.toJSON();return g.splice(n,1),zd(a,g)}if(a.items.length===1)return ya(e,r,[]);let{text:l}=e,f=Sr(l,s.range[0]),p=f+Xs(l,a.range?.[0]??f);if(l.slice(f,p).trim()!==""){let g=a.items[n+1];return g?.range?vt([{start:p,end:Sr(l,g.range[0])+(p-f),newText:""}]):dt("invalid","cannot remove the item")}let[h,v]=wC(l,s.range[0],s.range[2]);return vt([{start:h,end:v,newText:""}])}function lF(e){return e.replaceAll(/[^A-Za-z0-9_]/g,"_")}var dF=e=>typeof e=="string"&&/^[\w-]+(\.[\w-]+)?$/.test(e),uF=/^node_([0-9A-HJKMNP-TV-Z]{26})$/,kC=3,V0="not scanned",cF={str:"string",raw:"any",path:"string",int:"integer",float:"any",bool:"boolean",list:"list",dict:"dict"};function K0(e){let t=e.impl?.params?.tasks_from;return typeof t=="string"&&t?t:null}function fF(e,t,n){return e.roles.find(r=>r.name===t&&(r.tasks_from??null)===n)}function hF(e){let t=new Set;for(let n of e)for(let r of[...n.register,...n.facts,...n.stats])t.add(r);return[...t]}var bi=e=>e.map(t=>`\`${t}\``).join(", ");function pF(e,t){return(e.find(n=>n.origin&&(!t||t(n)))??e.find(n=>n.origin))?.origin??void 0}function mF(e,t){let n=e.nodes.get(t.id);return(n?e.levels.get(n.level)?.edges??[]:[]).some(r=>r?.to?.node===t.id&&ha(r.from?.port??""))}function SC(e,t){let n=e.nodes.get(t.id),r=n?e.levels.get(n.level):void 0;return r?r.edges.some(a=>a?.to?.node===t.id)?!0:(r.parent?e.nodes.get(r.parent)?.node:void 0)?.subflow?.boundary?.in===t.id:!1}function gF(e,t,n,r){let a=n.find(h=>h.name.startsWith(`[${t.key}]`))??n[0],s={node:t.id,matched:n.length>0,play:a?.origin??void 0},l=t.impl?.ref?t.impl:void 0;if(t.type==="subflow"&&(t.subflow?.nodes?.length??0)>0){let h=r.flatMap(g=>g.tasks),v=`${r.length} step${r.length===1?"":"s"}`;return{...s,artifact:l?`${l.kind}: ${l.ref} \xB7 ${v}`:v,tasks:h,dynamic:r.reduce((g,m)=>g+m.dynamic,0)}}if(!l){let h=t.type==="task"||t.type==="subflow"?"not bound":t.type;return{...s,artifact:h,tasks:[],dynamic:0}}if(l.kind==="module"){let h=n.flatMap(v=>v.tasks).filter(v=>v.action===l.ref&&!H4.test(v.name??""));return{...s,artifact:`module: ${l.ref}`,tasks:h,dynamic:0}}if(l.kind==="role"){let h=K0(t),v=fF(e,l.ref,h),g=(v?.tasks??[]).filter(m=>!m.auto);return{...s,artifact:`role: ${l.ref}${h?` \xB7 ${h}`:""}`,tasks:g,dynamic:g.filter(m=>m.dynamic).length,missing:v?.error??(v?void 0:V0)}}let f=e.playbooks.find(h=>h.path===l.ref.replace(/^\.\//,"")),p=(f?.plays??[]).flatMap(h=>h.tasks).filter(h=>!h.auto);return{...s,artifact:`playbook: ${l.ref.split("/").pop()}`,tasks:p,dynamic:p.filter(h=>h.dynamic).length,missing:f?f.error:V0}}function yF(e,t){let n=$e(e),r=[],a=new Map;for(let b of Ws(e))b.area==="drift"&&a.set(`${b.node}|${b.what}`,{reason:b.reason,by:b.by});let s=b=>{let w=b.node?a.get(`${b.node}|${b.id}`):void 0;w?r.push({...b,ignored:w,actions:[{label:"Reopen",action:{kind:"unignore",node:b.node,item:b.id}}]}):(b.node&&b.actions.push({label:"Accept with Reason\u2026",action:{kind:"ignore",node:b.node,item:b.id}}),r.push(b))},l=new Map,f=t.generated;for(let b of f.plays)for(let w of b.tags){let k=uF.exec(w)?.[1];k&&(n.nodes.has(k)?l.set(k,[...l.get(k)??[],b]):r.push({id:`orphan-play:${k}:${b.name}`,kind:"code_without_design",title:b.name,label:"play without a node",detail:`\`${b.name}\` is tagged for a node that is not in this flow (node_${k}).`,severity:"warning",actions:[{label:"Regenerate",action:{kind:"regenerate"}},...b.origin?[{label:"Open Code",action:{kind:"openCode",...b.origin}}]:[]]}))}if(f.error||f.plays.length===0){let b=f.error==="not found"||!f.error;r.push({id:"generated",kind:"design_without_code",title:n.doc.flow.name,label:b?"no generated code":"generated code does not compile",detail:b?`${f.path} does not exist yet: save the flow to generate it.`:`${f.path}: ${f.error}`,severity:"warning",actions:[{label:"Regenerate",action:{kind:"regenerate"}},...b?[]:[{label:"Open Code",action:{kind:"openCode",path:f.path}}]]})}let p={},h=n.doc.flow?.inputs??{},v=b=>{let w=(b.subflow?.nodes??[]).filter(S=>!!S?.id).map(v),k=gF(t,b,l.get(b.id)??[],w);return p[b.id]=k,k};for(let b of e.nodes??[])b?.id&&v(b);let g=0,m=0;for(let{node:b}of n.nodes.values()){if(b.type==="start"||b.type==="end")continue;let w=p[b.id];w&&(m++,w.matched?g++:!f.error&&f.plays.length>0&&s({id:`unmatched:${b.id}`,kind:"design_without_code",node:b.id,title:b.title,label:"not in generated code",detail:SC(n,b)?`No play in ${f.path} is tagged node_${b.id}: save the flow to regenerate it.`:"Nothing leads to this node, so no play is generated for it.",severity:SC(n,b)?"warning":"info",actions:[{label:"Regenerate",action:{kind:"regenerate"}},{label:"Open Code",action:{kind:"openCode",path:f.path}}]}),vF(n,t,b,w,h,s))}return{items:r,nodes:p,matched:g,matchable:m}}function vF(e,t,n,r,a,s){let l=n.impl?.ref?n.impl:void 0,f=(n.subflow?.nodes?.length??0)>0,p=n.type==="task"||n.type==="subflow"&&!f,h=n.id,v=n.title;if(p&&!l)s({id:`unbound:${h}`,kind:"design_without_code",node:h,title:v,label:"no code yet",detail:mF(e,n)?"Designed and wired to a fail port, but nothing is bound.":"Nothing is bound: it runs as a TODO stub.",severity:"warning",actions:[{label:"Generate Stub",action:{kind:"generateStub",node:h,role:lF(n.key)}},{label:"Bind Role",action:{kind:"bind",node:h,bindKind:"role"}}]});else if(l)if(r.missing===V0)s({id:`unscanned:${h}`,kind:"design_without_code",node:h,title:v,label:"not scanned yet",detail:`${l.kind} ${l.ref} was bound after the last sync.`,severity:"info",actions:[{label:"Re-sync",action:{kind:"resync"}}]});else if(l.kind==="playbook"&&r.missing)s({id:`missing:${h}`,kind:"design_without_code",node:h,title:v,label:"playbook missing",detail:`${l.ref} ${r.missing==="not found"?"does not exist":`does not load: ${r.missing}`}.`,severity:"warning",actions:[{label:"Bind Playbook",action:{kind:"bind",node:h,bindKind:"playbook"}}]});else{if(l.kind==="role"){let g=t.roleInfo.find(w=>w.name===l.ref),m=!!r.missing&&/not found|was not found/i.test(r.missing),b=/^[\w-]+\.[\w-]+\.[\w-]+$/.test(l.ref);if(m||!g&&!b){s({id:`missing:${h}`,kind:"design_without_code",node:h,title:v,label:"role missing",detail:`Role ${l.ref} is not in roles_path.`,severity:"warning",actions:[...dF(l.ref)?[{label:"Create Role",action:{kind:"generateStub",node:h,role:l.ref}}]:[],{label:"Bind Role",action:{kind:"bind",node:h,bindKind:"role"}}]});return}if(!g)return;if(f){bF(e,n,g.tasks,s,g.includes);return}xF(n,r,g,a,s)}l.kind==="module"&&wF(t,n,r,s)}}function bF(e,t,n,r,a={}){let s=t.impl?.ref??"",l=new Set([...e.nodes.values()].filter(p=>p.level===t.id&&p.node.impl?.kind==="role"&&p.node.impl.ref===s).map(p=>K0(p.node)??"main")),f=new Set(l);for(let p of[...f])for(let h=[p];h.length;)for(let v of a[h.pop()]??[])f.has(v)||(f.add(v),h.push(v));for(let p of n)p==="main"||f.has(p)||r({id:`task-file:${p}`,kind:"code_without_design",node:t.id,title:t.title,label:"task not in design",detail:`\`${p}\` exists in the role but not in the subflow.`,severity:"warning",actions:[{label:"Add to Subflow",action:{kind:"addToSubflow",subflow:t.id,role:s,tasksFrom:p}}]})}function xF(e,t,n,r,a){let s=e.id,l=e.title,f=K0(e)??"main",p=`${n.path}/tasks/${f}.yml`,h=hF(t.tasks),v=e.outputs??{},g=t.dynamic>0?" (dynamic includes are not expanded, so this may be incomplete)":"";for(let[S,N]of Object.entries(v)){if(N?.from?.startsWith("impl.")||h.includes(S))continue;let $=h.filter(E=>!(E in v)).slice(0,kC),j=pF(t.tasks,E=>E.register.length+E.facts.length+E.stats.length>0);a({id:`output:${S}`,kind:"contract_mismatch",node:s,title:l,label:"outputs differ",detail:h.length?`Design expects ${bi([S])}, code registers ${bi(h)}.${g}`:`Design expects ${bi([S])}, the role sets no variables.${g}`,severity:t.dynamic>0?"info":"warning",actions:[...$.length===1?[{label:"Update Design",action:{kind:"renameOutput",node:s,from:S,to:$[0]}}]:$.map(E=>({label:`Use ${E}`,action:{kind:"renameOutput",node:s,from:S,to:E}})),...$.length===0?[{label:"Remove Output",action:{kind:"removeOutput",node:s,name:S}}]:[],{label:"Open Code",action:{kind:"openCode",...j??{path:p}}}]})}let m=n.entry_points[f],b=`${n.path}/meta/argument_specs.yml`;if(!m){a({id:`no-spec:${f}`,kind:"contract_mismatch",node:s,title:l,label:"no argument spec",detail:`${n.name} has no argument_specs for \`${f}\`: its inputs are not checked.`,severity:"info",actions:[{label:"Write argument_specs",action:{kind:"writeSpecs",node:s}},{label:"Open Code",action:{kind:"openCode",path:p}}]});return}let w=e.inputs??{},k=e.impl?.params??{};for(let[S,N]of Object.entries(m.options)){if(!N.required||N.default!==void 0||S in w||S in k)continue;let $={type:cF[N.type]??"any",required:!0,...S in r?{from:`flow.${S}`}:{}};a({id:`input-required:${S}`,kind:"contract_mismatch",node:s,title:l,label:"inputs differ",detail:`The role requires ${bi([S])}; the node has no input ${bi([S])}.`,severity:"warning",actions:[{label:"Update Design",action:{kind:"addInput",node:s,name:S,field:$}},{label:"Open Code",action:{kind:"openCode",path:b}}]})}for(let S of Object.keys(w))S in m.options||a({id:`input-unknown:${S}`,kind:"contract_mismatch",node:s,title:l,label:"input unknown to the role",detail:`${bi([S])} is not an argument of ${n.name} (${f}).`,severity:"info",actions:[{label:"Update Design",action:{kind:"removeInput",node:s,name:S}},{label:"Open Code",action:{kind:"openCode",path:b}}]})}function wF(e,t,n,r){let a=t.impl?.ref??"",s=e.moduleReturns?.[a];if(s)for(let[l,f]of Object.entries(t.outputs??{})){let p=f?.from?.match(/^impl\.register\.([A-Za-z0-9_]+)/)?.[1];p&&!s.includes(p)&&r({id:`return:${l}`,kind:"contract_mismatch",node:t.id,title:t.title,label:"outputs differ",detail:`Design reads ${bi([p])} from the ${a} result, which returns ${bi(s)}.`,severity:"warning",actions:[...s.slice(0,kC).map(h=>({label:`Read ${h}`,action:{kind:"setOutputFrom",node:t.id,name:l,from:`impl.register.${h}`}})),...n.play?[{label:"Open Code",action:{kind:"openCode",...n.play}}]:[]]})}}function NC(e){let t=Object.entries(e.flow.inputs??{}).filter(([,n])=>n?.type==="host_list");return(t.find(([,n])=>n.targets)??t[0])?.[0]}function go(e,t){return e.nodes.get(t)?.node.title??t}function jC(e,t){return(e.levels.get(e.nodes.get(t)?.level??"")?.edges??[]).filter(n=>n?.to?.node===t).map(n=>({from:n.from.node,port:n.from.port}))}function CC(e,t){let n=e.levels.get(e.nodes.get(t)?.level??""),r=new Set;for(let a of n?.edges??[])a?.from?.node===t&&r.add(a.to.node),a?.to?.node===t&&r.add(a.from.node);return r.delete(t),[...r].map(a=>e.nodes.get(a)?.node).filter(a=>!!a)}function $C(e,t,n){let r=e.nodes.get(t),a=t;for(;r;){if(r.level===n)return a;if(r.level==="root")return;a=r.level,r=e.nodes.get(r.level)}}function qo(e){return e.type!=="start"&&e.type!=="end"}function EC(e,t,n=2){if(t.length!==0)return{text:`${e}${t.slice(0,n).join(", ")}${t.length>n?` +${t.length-n}`:""}`,title:t.join(", ")}}function Pn(e,t){return`${e} ${t}${e===1?"":"s"}`}function ih(e){return e.length<=1?e.join(""):e.length===2?`${e[0]} and ${e[1]}`:`${e.slice(0,-1).join(", ")} and ${e.at(-1)}`}var kF=/\{\{\s*(?:flow\.)?([A-Za-z_][A-Za-z0-9_]*)\s*\}\}/g;function Gs(e){return e.split(/[,:]/).map(t=>t.trim()).filter(t=>t&&!t.startsWith("!")&&!t.startsWith("&"))}function W0(e,t,n,r){let a=t.settings?.inventory_target?.trim();if(a){let l=NC(e),f=a.replaceAll(kF,(p,h)=>h===l&&n?n:p);return{pattern:f,source:"inventory_target",unresolved:f.includes("{{")}}let s=r?.nodes[t.id]?.hosts;if(s&&s.length>0)return{pattern:s.join(","),source:"playbook",unresolved:s.join("").includes("{{")}}function SF(e,t,n){return n.type==="start"?t.hosts.length:n.type==="end"?Wf(e,t,n.id).length:Kf(t,n.id).length}function NF(e,t){return Object.values(e.flow.inputs??{}).some(n=>{if(n?.type!=="host_list")return!1;let r=n.default;return(Array.isArray(r)?r.map(String):typeof r=="string"?Gs(r):[]).includes(t)})}function jF(e){let t=e.toLowerCase().replaceAll(/[^a-z0-9_]/g,"_");return/^[a-z_]/.test(t)?t:`g_${t}`}function CF(e,t,n,r){let a=$e(e),s=t?.state==="ready"?t.facts:void 0,l=s?.targets??t?.targets??"",f=NC(e)??"targets",p=n?.summary,h=T=>s?.patterns[T],v=T=>h(T)?.count,g={},m=[],b=new Map,w=(T,M,O)=>{let K=b.get(T)??{nodes:new Set,input:O};K.nodes.add(M),K.input||=O,b.set(T,K)},k=[];for(let{node:T}of a.nodes.values()){let M=p?SF(a,p,T):void 0,O=qo(T)?W0(e,T,l,r):void 0;if(T.type==="start"){g[T.id]=l?[{text:`${l} \xB7 ${v(l)??"?"}`,title:`flow input ${f}`}]:[{text:`${f}: not set`,tone:"muted",title:"Enter the flow targets in the side panel"}];for(let B of Gs(l))w(B,T.id,!0);continue}if(T.type==="end"){g[T.id]=M===void 0?[]:[{text:`\xB7 ${M}`,title:"hosts that ended here"}];continue}if(O){k.push({node:T,d:O});let B=Gs(O.pattern),V=B.map(oe=>{let F=h(oe);return O.unresolved||!F?{text:oe,title:`declared target (${O.source})`}:F.outside===0?{text:`${oe} \xB7 ${M??F.count}`}:{text:`+ ${oe} \xB7 ${F.count}`,tone:"warn",title:`${F.outside} of these hosts are outside the flow targets`}});g[T.id]=V.length>2?[V[0],{text:`+${V.length-1} more`,title:O.pattern}]:V;for(let oe of B)w(oe,T.id,!1);continue}if(!l){g[T.id]=[];continue}let K=M??v(l);g[T.id]=[{text:`${l} \xB7 ${K??"?"}`,title:M===void 0?"at most this many hosts arrive (no run yet)":"hosts at this node in the last run"}];for(let B of Gs(l))w(B,T.id,!0)}let S={};if(p)for(let T of a.edges.values())S[T.edge.id]=`${T.edge.from.port} \xB7 ${A0(a,p,T.edge).length}`;let N=new Set;for(let{node:T,d:M}of k){if(M.unresolved||!s)continue;let O=h(M.pattern);if(!O)continue;for(let oe of Gs(M.pattern))v(oe)===0&&m.push({id:`inventory:no-match:${T.id}:${oe}`,lens:"inventory",severity:"warning",title:`${T.title}: ${oe} matches no host`,detail:`The declared target ${M.pattern} names ${oe}, which is not a group or host of the inventory (${s.sources.join(", ")}).`,node:T.id,nodes:[T.id],fixes:[]});let K=jC(a,T.id),B=K.length>0&&K.every(oe=>ha(oe.port));if(O.outside===0||!(Od(T)||B))continue;N.add(T.id);let V=[...new Set(K.map(oe=>oe.port))].join(", ")||"its wires";m.push({id:`inventory:broad-target:${T.id}`,lens:"inventory",severity:"warning",title:`${T.title} targets ${M.pattern} (${O.count})`,detail:`It receives hosts from ${V}, but its ${M.source==="playbook"?"playbook runs on":"target is"} ${M.pattern}: ${Pn(O.outside,"host")} outside the flow targets${O.sample.length?` (${O.sample.join(", ")}${O.outside>O.sample.length?", \u2026":""})`:""}. One wrong condition could touch every one of them.`,node:T.id,nodes:[T.id],fixes:M.source==="inventory_target"?[{label:"Limit to Arriving Hosts",command:{kind:"updateNode",id:T.id,patch:{settings:{inventory_target:null}}}}]:[]})}if(s){let T=new Map;for(let{node:O,d:K}of k)if(!(K.unresolved||N.has(O.id)))for(let B of Gs(K.pattern)){let V=h(B);V&&V.outside!==0&&V.count!==0&&!NF(e,B)&&T.set(B,(T.get(B)??new Set).add(O.id))}for(let[O,K]of T){let B=h(O),V=[...K];m.push({id:`inventory:group-not-input:${O}`,lens:"inventory",severity:"warning",title:`${O} is not a flow input`,detail:`${ih(V.map(oe=>go(a,oe)))} ${V.length===1?"touches":"touch"} ${Pn(B.count,"host")} in ${O} that the flow targets (${l||f}) do not include. Approvers only see the flow targets.`,nodes:V,fixes:[{label:"Add to Flow Inputs",command:{kind:"setContractField",target:"flow",side:"inputs",name:jF(O),field:{type:"host_list",default:O}}}]})}let M=s.prod_groups.filter(O=>s.scope.groups[O]);M.length>0&&m.push({id:"inventory:prod",lens:"inventory",severity:"info",title:`The flow touches production groups: ${M.join(", ")}`,detail:`${M.map(O=>`${O}: ${Pn(s.scope.groups[O]??0,"host")}`).join(", ")} in scope, in groups whose names look like production. Real runs ask for confirmation.`,nodes:[],fixes:[]})}let $=[...b.entries()].map(([T,M])=>{let O=h(T),K=[Pn(M.nodes.size,"node")];return M.input&&K.push("flow input"),O?.outside&&K.push(`${O.outside} outside the targets`),{key:`group:${T}`,label:T,value:O?String(O.count):void 0,detail:K.join(" \xB7 "),nodes:[...M.nodes],tone:O?.outside?"warn":void 0}}).sort((T,M)=>Number(M.value??0)-Number(T.value??0)||T.label.localeCompare(M.label)),j=[];if(p){let T=new Set;for(let[M,O]of Object.entries(p.nodes))for(let[K,B]of Object.entries(O))if(ha(K))for(let V of B)T.has(V)||(T.add(V),j.push({key:`host:${V}`,label:V,detail:`${go(a,M)} \xB7 ${K}`,nodes:[M]}))}let E=[];!t||t.state==="idle"?E.push("The inventory has not been read yet."):t.state==="loading"?E.push("Reading the inventory\u2026"):t.state==="error"&&E.push(`The inventory could not be read: ${t.error}`),l||E.push(`Enter the flow targets (${f}) to count hosts per node.`);let I=e.flow.runtime,z=O0($e(e));return(z==="awx_job"||z==="awx_workflow")&&E.push(`This flow runs in AWX${I?.template?` (${I.template})`:""}; AWX may use another inventory than the local one.`),s?.dynamic.length&&E.push(`Dynamic sources read on demand: ${s.dynamic.join(", ")}.`),{lens:"inventory",chips:g,wires:p?S:void 0,stats:s?[{label:"groups touched",value:String(Object.keys(s.scope.groups).length)},{label:"hosts in scope",value:String(s.scope.count)},{label:"inventory",value:Pn(s.total,"host")}]:[],sections:[{title:"Groups used by this flow",items:$,empty:"No targets yet."},...p?[{title:"Excluded last run",items:j,empty:"No host left through a fail port."}]:[]],findings:m,notes:E}}function $F(e,t){return[...new Set([...L0(e.impl?.params??{}),...L0(e.inputs??{})])].filter(n=>n in t).sort()}function EF(e){let t=Object.keys(e?.values??{});return t.length===1?t[0]:void 0}function _F(e,t,n){let r=$e(e),a=t?.state==="ready"?t.facts:void 0,s=a?.targets??t?.targets??"",l=a?.vaulted??{},f={},p=[],h=new Map,v=new Set,g=new Map,m=O0(r),b=m==="awx_job"||m==="awx_workflow",w=Rt(e)>=2?(e.flow.runtime?.credentials??[]).join(", "):"",k=$=>Rt(e)>=2?w||void 0:$.settings?.credential;for(let{node:$}of r.nodes.values()){if(!qo($))continue;let j=[],E=k($),I=W0(e,$,s,n)?.pattern??s,z=a?.access[I];if(E)j.push({text:E,title:b?"AWX credential":"AWX credential (local runs use the environment)"}),h.set(E,(h.get(E)??new Set).add($.id));else{let O=EF(z?.ansible_user);O&&j.push({text:`user ${O}`,title:z?.ansible_user?.origins.join(", "),tone:"muted"})}let T=z?.ansible_become?.values.true;$.settings?.become?(j.push({text:"become"}),v.add($.id)):T&&j.push({text:"become (inventory)",title:`${Pn(T,"host")} get ansible_become`});let M=$F($,l);for(let O of M)g.set(O,(g.get(O)??new Set).add($.id));M.length>0&&j.push({text:`vault: ${M.join(", ")}`,title:M.map(O=>`${O} (${l[O]})`).join(`
|
|
156
|
+
`)}),f[$.id]=j.slice(0,2)}for(let{node:$}of r.nodes.values()){if(!qo($))continue;let j=CC(r,$.id).filter(qo),E=k($),I=j.map(T=>k(T)).filter(T=>!!T),z=[...new Set(I)];E&&I.length>=2&&z.length===1&&z[0]!==E&&p.push({id:`access:credential:${$.id}`,lens:"access",severity:"warning",title:`${$.title} uses ${E}, its neighbours use ${z[0]}`,detail:`${ih(j.filter(T=>k(T)).map(T=>T.title))} run with ${z[0]}. Check that ${$.title} needs the access ${E} gives.`,node:$.id,nodes:[$.id,...j.map(T=>T.id)],fixes:[]}),_C(r,$)&&p.push({id:`access:become:${$.id}`,lens:"access",severity:"info",title:`${$.title} escalates privileges, unlike its neighbours`,detail:`${$.title} sets become; none of the nodes wired to it do. Needs root? Accept it with a reason, so others know why.`,node:$.id,nodes:[$.id],acceptFirst:!0,fixes:[{label:"Remove Become",command:{kind:"updateNode",id:$.id,patch:{settings:{become:null}}}}]})}if(!b&&h.size>0){let $=[...h.values()].flatMap(j=>[...j]);p.push({id:"access:awx-only",lens:"access",severity:"info",title:"Node credentials apply in AWX only",detail:`${ih($.map(j=>go(r,j)))} name an AWX credential. Local runs use the environment's keys and the inventory's connection variables.`,nodes:$,fixes:[]})}if(g.size>0){let $=[...new Set([...g.values()].flatMap(j=>[...j]))];p.push({id:"access:vault",lens:"access",severity:"info",title:`${Pn($.length,"node")} ${$.length===1?"reads":"read"} vaulted variables`,detail:`${[...g.keys()].join(", ")}: runs need the vault password (asked per run locally, never stored).`,nodes:$,fixes:[]})}let S=[];for(let[$,j]of Object.entries(a?.access??{}))if(!/[,:]/.test($))for(let[E,I]of Object.entries(j.ansible_user?.values??{}))S.push({key:`user:${$}:${E}`,label:E,value:String(I),detail:`${$} \xB7 ${j.ansible_user?.origins.join(", ")||"origin unknown"}`,nodes:[]});let N=[];return a||N.push("Read the inventory (Inventory lens) to see connection users and vaulted variables."),{lens:"access",chips:f,stats:[{label:"credentials",value:String(h.size)},{label:"become",value:String(v.size)},{label:"vaulted vars",value:String(g.size)}],sections:[{title:"Credentials",items:[...h.entries()].map(([$,j])=>({key:`cred:${$}`,label:$,detail:[...j].map(E=>go(r,E)).join(", "),nodes:[...j]})),empty:"No node names a credential."},{title:"Privilege escalation",items:[...v].map($=>({key:`become:${$}`,label:go(r,$),nodes:[$]})),empty:"No node sets become."},{title:"Vaulted variables",items:Object.entries(l).map(([$,j])=>({key:`vault:${$}`,label:$,detail:`${j}${g.get($)?` \xB7 ${[...g.get($)??[]].map(E=>go(r,E)).join(", ")}`:""}`,nodes:[...g.get($)??[]]})),empty:a?"No vaulted variables for the hosts in scope.":"Inventory not read."},{title:"Connection users",items:S,empty:a?"No ansible_user set.":"Inventory not read."}],findings:p,notes:N}}function _C(e,t){if(!t.settings?.become||!qo(t))return!1;let n=CC(e,t.id).filter(qo);return n.length>0&&!n.some(r=>r.settings?.become)}var AF=/^[0-9A-HJKMNP-TV-Z]{26}$/,Qs=e=>typeof e=="string"&&AF.test(e),Fd=e=>typeof e=="string"&&e!==""&&!Qs(e);function TF(e){let t=[],n=(r,a,s,l,f,p,h)=>{let v=Array.isArray(s)?s:[];t.push({label:a,nodesPath:[...r,"nodes"],edgesPath:[...r,"edges"],annotationsPath:[...r,"annotations"],nodes:v,edges:Array.isArray(l)?l:[],annotations:Array.isArray(f)?f:[],boundaryPath:p,boundary:h}),v.forEach((g,m)=>{if(!g||typeof g!="object"||!g.subflow||typeof g.subflow!="object")return;let b=[...r,"nodes",m,"subflow"];n(b,`subflow ${g.key}`,g.subflow.nodes,g.subflow.edges,g.subflow.annotations,[...b,"boundary"],g.subflow.boundary)})};return n([],"the top level",e.nodes,e.edges,e.annotations),t}function MF(e,t){let n=[],r=[],a=e.flow;a&&typeof a=="object"&&!Qs(a.id)&&(r.push({op:"id",of:"flow",path:["flow","id"],id:t("flow"),before:Object.keys(a)}),n.push({kind:"flow",path:["flow"],message:`Flow "${a.key??a.name??""}" has no id`}));let s=TF(e),l=new Map,f=new Map;for(let h of s){let v=new Map;h.nodes.forEach((g,m)=>{if(!g||typeof g!="object")return;let b=[...h.nodesPath,m],w=g.id;Qs(w)||(w=t(`node|${b.join(".")}|${g.key??""}`),r.push({op:"id",of:"node",path:[...b,"id"],id:w,before:Object.keys(g)}),n.push({kind:"node",path:b,message:`Node "${g.key??g.title??m}" on ${h.label} has no id`})),typeof g.key=="string"&&(v.set(g.key,v.has(g.key)?null:w),f.set(g.key,f.has(g.key)?null:w))}),l.set(h,v)}let p=(h,v,g,m)=>{let b=h.get(v);if(b)return b;n.push({kind:"ref",path:m,unresolved:!0,message:b===null?`Key "${v}" (${g}) is used by several nodes: name the node by its id`:`No node with key "${v}" (${g})`})};for(let h of s){let v=l.get(h)??new Map;h.edges.forEach((b,w)=>{if(!b||typeof b!="object")return;let k=[...h.edgesPath,w],S=[];if(!Qs(b.id)){let $=t(`wire|${k.join(".")}`);r.push({op:"id",of:"wire",path:[...k,"id"],id:$,before:Object.keys(b)}),S.push("no id")}let N=!1;for(let $ of["from","to"]){let j=b[$]?.node;if(!Fd(j))continue;let E=p(v,j,`wire ${$} on ${h.label}`,[...k,$,"node"]);E&&(r.push({op:"set",path:[...k,$,"node"],id:E}),N=!0)}N&&S.push("names nodes by key"),S.length>0&&n.push({kind:"wire",path:k,message:`Wire ${b.from?.node}.${b.from?.port} -> ${b.to?.node}.${b.to?.port} on ${h.label}: ${S.join(", ")}`})});let g=h.annotations.map(b=>b&&typeof b=="object"?b.key:void 0);h.annotations.forEach((b,w)=>{if(!b||typeof b!="object")return;let k=[...h.annotationsPath,w],S=[];if(!Qs(b.id)){let N=t(`annotation|${k.join(".")}|${b.key??""}`);r.push({op:"id",of:"annotation",path:[...k,"id"],id:N,before:Object.keys(b)}),S.push("no id")}if(typeof b.key!="string"||b.key===""){let N=jz(g,b.kind??"note");g.push(N);let $=Object.keys(b).filter(j=>j!=="id");r.push({op:"id",of:"annotation",path:[...k,"key"],id:N,before:$}),S.push("no key")}if(Fd(b.on)){let N=p(v,b.on,`annotation on ${h.label}`,[...k,"on"]);N&&(r.push({op:"set",path:[...k,"on"],id:N}),S.push(`names "${b.on}" by key`))}S.length>0&&n.push({kind:"annotation",path:k,message:`${b.kind??"note"} "${b.key??w}" on ${h.label}: ${S.join(", ")}`})});let m=h.boundary;if(h.boundaryPath&&m&&typeof m=="object"){if(Fd(m.in)){let b=[...h.boundaryPath,"in"],w=p(v,m.in,`entry of ${h.label}`,b);w&&(r.push({op:"set",path:b,id:w}),n.push({kind:"ref",path:b,message:`The entry of ${h.label} names "${m.in}" by key`}))}for(let[b,w]of Object.entries(m.outputs??{}))(w??[]).forEach((k,S)=>{if(!Fd(k?.node))return;let N=[...h.boundaryPath,"outputs",b,S,"node"],$=p(v,k.node,`exit ${b} of ${h.label}`,N);$&&(r.push({op:"set",path:N,id:$}),n.push({kind:"ref",path:N,message:`Exit ${b} of ${h.label} names "${k.node}" by key`}))})}}(e.decisions??[]).forEach((h,v)=>{if(!Fd(h?.node))return;let g=["decisions",v,"node"],m=p(f,h.node,`decision ${v+1}`,g);m&&(r.push({op:"set",path:g,id:m}),n.push({kind:"ref",path:g,message:`Decision ${v+1} names "${h.node}" by key`}))});for(let h of Object.keys(e.layout??{})){if(Qs(h))continue;let v=f.get(h);v&&!Object.hasOwn(e.layout??{},v)&&(r.push({op:"rename",mapPath:["layout"],key:h,id:v}),n.push({kind:"layout",path:["layout",h],message:`Position of "${h}" is keyed by key`}))}return{gaps:n,fixes:r}}function OF(e){let t=2166136261,n=16777619;for(let a=0;a<e.length;a++)t=Math.imul(t^e.charCodeAt(a),16777619)>>>0,n=Math.imul(n^e.charCodeAt(a),1540483477)>>>0;let r="0";for(let a=0;a<25;a++){let s=a%2==0?t:n;r+="0123456789ABCDEFGHJKMNPQRSTVWXYZ"[s>>>a*5%27&31],a%2==1?t=Math.imul(t^n>>>7,16777619)>>>0:n=Math.imul(n^t>>>11,1540483477)>>>0}return r}function PF(e,t,n){let r=e;for(let a of t.slice(0,-1))r=r[a];r[t.at(-1)]=n}function AC(e){let{fixes:t}=MF(e,OF);if(t.length===0)return e;let n=structuredClone(e);for(let r of t)if(r.op==="rename"){let a=n.layout;a[r.id]=a[r.key],delete a[r.key]}else PF(n,r.path,r.id);return n}var DF=(e,t)=>JSON.stringify(ma(e))===JSON.stringify(ma(t));function TC(e,t){let{id:n,subflow:r,tested:a,handler:s,...l}=t,f={...l};s!==void 0&&f.purpose===void 0&&(f.purpose=s),r?.boundary&&(f.boundary=r.boundary);let p=Ws(e).filter(h=>h.node===t.id).map(h=>`${h.area}:${h.what}${h.reason?` (${h.reason})`:""}`).sort();return p.length>0&&(f.accepted=p),f}function U0(e,t){let n=[];for(let r of new Set([...Object.keys(e),...Object.keys(t)]))DF(e[r],t[r])||n.push({field:r,before:e[r],after:t[r]});return n}function Bd(e,t){let n=[];for(let r=t;r!==on;){let a=e.nodes.get(r);if(!a)break;n.unshift(a.node.title),r=a.level}return n}function IF(e,t,n){let r=t.nodes.get(n)?.level;return(r&&r!=="root"?t.nodes.get(r)?.node.subflow?.layout:void 0)?.[n]??e.layout?.[n]}function LF(e,t,n){return`${e}|${t.node}.${t.port}>${n.node}.${n.port}`}function MC(e,t=n=>n){let n=new Map;for(let r of e.levels.values())for(let a of r.edges)a?.from&&a.to&&n.set(LF(r.id==="root"?on:t(r.id),{...a.from,node:t(a.from.node)},{...a.to,node:t(a.to.node)}),{level:r.id,edge:a.id,from:a.from,to:a.to});return n}var Y0=(e,t)=>{let n=e.nodes.get(t);return n?`${n.level==="root"?"":Y0(e,n.level)}/${n.node.key}:${n.node.type}`:""};function RF(e,t){let n=new Map;for(let a of e.nodes.keys())t.nodes.has(a)&&n.set(a,a);let r=new Map;for(let a of t.nodes.keys())e.nodes.has(a)||r.set(Y0(t,a),a);for(let a of e.nodes.keys()){if(n.has(a))continue;let s=Y0(e,a),l=r.get(s);l&&(n.set(a,l),r.delete(s))}return n}function OC(e,t){let n=AC(e),r=AC(t),a=Ro(n),s=Ro(r),l=RF(a,s),f=new Map([...l].map(([E,I])=>[I,E])),p=[];for(let[E,{node:I,level:z}]of s.nodes){let T=f.get(E),M=T?a.nodes.get(T):void 0,O={id:E,key:I.key,title:I.title,type:I.type,level:z,where:Bd(s,z)};if(!M){p.push({...O,kind:"added",fields:[]});continue}let K=U0(TC(n,M.node),TC(r,I));(l.get(M.level)??M.level)!==z&&K.unshift({field:"level",before:Bd(a,M.level).join(" \u203A ")||"top level",after:O.where.join(" \u203A ")||"top level"}),K.length>0&&p.push({...O,kind:"changed",fields:K})}for(let[E,{node:I,level:z}]of a.nodes)l.has(E)||p.push({id:E,kind:"removed",key:I.key,title:I.title,type:I.type,level:z,where:Bd(a,z),fields:[],position:IF(n,a,E)});let h=(E,I)=>`${E.nodes.get(I.from.node)?.node.key??"?"}.${I.from.port} \u2192 ${E.nodes.get(I.to.node)?.node.key??"?"}`,v=MC(a,E=>l.get(E)??E),g=MC(s),m=[...[...g].filter(([E])=>!v.has(E)).map(([,E])=>({kind:"added",...E,label:h(s,E)})),...[...v].filter(([E])=>!g.has(E)).map(([,E])=>({kind:"removed",...E,label:h(a,E)}))],b=zF(a,s,l,f),{version:w,id:k,...S}=n.flow,{version:N,id:$,...j}=r.flow;return{nodes:p,wires:m,annotations:b,flow:U0({...S,format:n.schema_version},{...j,format:r.schema_version})}}function PC(e,t){let n=t.kind??"note";return{kind:n,text:t.text,color:t.color??(n==="note"?"yellow":"gray"),...t.size?{size:t.size}:{},on:t.on?e.nodes.get(t.on)?.node.key??t.on:void 0}}function zF(e,t,n,r){let a=[],s=f=>String(f.text??"").split(`
|
|
157
|
+
`)[0]??"",l=new Set;for(let[f,{annotation:p,level:h}]of t.annotations){let v=h==="root"?on:r.get(h)??h,g=e.annotations.get(f)??[...e.annotations.values()].find(w=>!t.annotations.has(w.annotation.id)&&w.level===v&&w.annotation.key===p.key),m={id:f,key:p.key,annotation:p.kind??"note",label:s(p),level:h,where:Bd(t,h)};if(!g){a.push({...m,kind:"added",fields:[]});continue}l.add(g.annotation.id);let b=U0(PC(e,g.annotation),PC(t,p));b.length>0&&a.push({...m,kind:"changed",fields:b})}for(let[f,{annotation:p,level:h}]of e.annotations)l.has(f)||a.push({id:f,kind:"removed",key:p.key,annotation:p.kind??"note",label:s(p),level:n.get(h)??h,where:Bd(e,h),fields:[]});return a}function FF(e,t,n){let r=a=>{for(let s=a;s!==on;){if(s===n)return!0;let l=t.nodes.get(s);if(!l)return!1;s=l.level}return!1};return e.nodes.filter(a=>a.kind!=="removed"&&r(a.level)).length+e.nodes.filter(a=>a.kind==="removed"&&(a.level===n||r(a.level))).length}var BF={impl:"binding",settings:"settings",inputs:"inputs",outputs:"outputs",accepted:"accepted",boundary:"boundary"},X0=e=>BF[e.field]??e.field,qF=(e,t)=>`${e} ${t}${e===1?"":"s"}`;function HF(e,t){let n={lens:"changes",chips:{},stats:[],sections:[],findings:[],notes:[]};if(!t)return n.notes.push("Reading the versions of this flow from Git\u2026"),n;if(n.stats.push({label:"Compared with",value:t.label}),t.state!=="ready"||!t.base)return n.notes.push(t.state==="loading"?`Reading ${t.label}\u2026`:t.error??`${t.label} has no version of this flow`),n;let r=OC(t.base,e),a=$e(e),s=m=>m.length?m.join(" \u203A "):"top level",l=[],f=[],p=[];for(let m of r.nodes)if(m.kind==="changed"){let b=m.fields.map(X0);n.chips[m.id]=[{text:`changed: ${b.join(", ")}`,title:b.join(", ")}],l.push({key:m.id,label:m.title,value:b.join(", "),detail:s(m.where),nodes:[m.id]})}else m.kind==="added"?(n.chips[m.id]=[{text:"added"}],f.push({key:m.id,label:m.title,detail:s(m.where),nodes:[m.id]})):p.push({key:m.id,label:m.title,detail:`was on ${s(m.where)}`,nodes:[],tone:"muted"});for(let{node:m}of a.nodes.values()){if(m.type!=="subflow")continue;let b=FF(r,a,m.id);if(b===0)continue;let w={text:`${qF(b,"change")} inside`};n.chips[m.id]=[...n.chips[m.id]??[],w].slice(0,2)}n.ghosts=r.nodes.filter(m=>m.kind==="removed").map(m=>({id:m.id,title:m.title,type:m.type,level:m.level,position:m.position})),n.wires=Object.fromEntries(r.wires.filter(m=>m.kind==="added"&&m.edge).map(m=>[m.edge,"added"]));let h=r.wires.map(m=>({key:`${m.kind}:${m.label}`,label:`${m.kind==="added"?"+":"\u2212"} ${m.label}`,nodes:m.kind==="added"?[m.from.node,m.to.node].filter(b=>a.nodes.has(b)):[],tone:m.kind==="removed"?"muted":void 0})),v=r.flow.map(m=>({key:m.field,label:m.field,nodes:[]}));n.annotations=Object.fromEntries(r.annotations.filter(m=>m.kind!=="removed").map(m=>[m.id,m.kind]));let g=r.annotations.map(m=>({key:`annotation:${m.kind}:${m.id}`,label:`${m.kind==="added"?"+":m.kind==="removed"?"\u2212":"~"} ${m.annotation} ${m.key}: ${m.label}`,detail:m.kind==="changed"?m.fields.map(X0).join(", "):s(m.where),nodes:[],tone:m.kind==="removed"?"muted":void 0}));return n.stats.push({label:"Changed",value:String(l.length)},{label:"Added",value:String(f.length)},{label:"Removed",value:String(p.length)},{label:"Wires",value:`+${r.wires.filter(m=>m.kind==="added").length} \u2212${r.wires.filter(m=>m.kind==="removed").length}`}),r.annotations.length>0&&n.stats.push({label:"Annotations",value:["added","changed","removed"].map(m=>`${m==="added"?"+":m==="removed"?"\u2212":"~"}${r.annotations.filter(b=>b.kind===m).length}`).join(" ")}),n.sections.push({title:"Changed",items:l,empty:"No node changed"},{title:"Added",items:f,empty:"No node added"},{title:"Removed",items:p,empty:"No node removed"},{title:"Wires",items:h,empty:"No wire added or removed"},{title:"Flow",items:v,empty:"Name, goal, inputs and runtime unchanged"}),g.length>0&&n.sections.push({title:"Annotations",items:g,empty:""}),r.nodes.length+r.wires.length+r.flow.length+r.annotations.length===0&&n.notes.push(`No changes since ${t.label}`),n}function DC(e){let[t="",n]=e.trim().split(/[-+]/,2);return{nums:t.split(".").map(r=>Number.parseInt(r,10)||0),pre:n!==void 0}}function VF(e,t){let n=DC(e),r=DC(t);for(let a=0;a<Math.max(n.nums.length,r.nums.length,3);a++){let s=(n.nums[a]??0)-(r.nums[a]??0);if(s!==0)return s}return Number(r.pre)-Number(n.pre)}function KF(e,t){for(let n of t.split(",")){let r=n.trim();if(!r||r==="*")continue;let a=/^(==|!=|>=|<=|>|<)?\s*(.+)$/.exec(r);if(!a)return!1;let s=VF(e,a[2]);if(!(a[1]==="!="?s!==0:a[1]===">="?s>=0:a[1]==="<="?s<=0:a[1]===">"?s>0:a[1]==="<"?s<0:s===0))return!1}return!0}function WF(e){return e.replace(/^[a-z]+:\s*/,"")}function UF(e){return e.split(".").at(-1)??e}function YF(e,t){let n=$e(e),r={},a=[],s=t?WF(t.environment):void 0,l=new Map,f=new Map,p=0;for(let{node:b}of n.nodes.values()){if(!qo(b))continue;let w=b.impl,k=t?.nodes[b.id],S=b.settings?.execution_environment??s,N=[];if(w?.ref){p++;let j=k?.version;N.push({text:`${UF(w.ref)}${j?` ${j}`:""}`,title:`${w.kind} ${k?.fqcn??w.ref}${k?.collection?` (${k.collection})`:""}`,tone:k&&k.state!=="ok"&&k.state!=="unknown"?"warn":void 0}),k?.collection&&l.set(k.collection,(l.get(k.collection)??new Set).add(b.id))}else(b.type==="task"||b.type==="subflow")&&N.push({text:b.subflow?.nodes?.length?"inner steps":"TODO stub",tone:"muted"});if(S&&(N.push({text:S,title:b.settings?.execution_environment?"node execution environment":"flow environment"}),f.set(S,(f.get(S)??new Set).add(b.id))),r[b.id]=N.slice(0,2),!w?.ref||!k)continue;let $={lens:"code",node:b.id,nodes:[b.id],fixes:[]};k.state==="not-in-ee"?a.push({...$,id:`code:not-in-ee:${b.id}`,severity:"warning",title:`${b.title}: ${w.ref} is not in the environment`,detail:`${t?.environment??"The environment"} has no ${w.kind} ${w.ref}${k.collection?`; ${k.collection} is not installed there`:""}. Add the collection to the EE or bind another ${w.kind}.`,fixes:[{label:"Open Details",properties:b.id}]}):(k.state==="removed"||k.state==="deprecated")&&a.push({...$,id:`code:${k.state}:${b.id}`,severity:"warning",title:`${b.title}: ${k.fqcn??w.ref} is ${k.state}`,detail:k.why?`${k.why}`:`The catalog marks ${k.fqcn??w.ref} as ${k.state}.`,fixes:[{label:"Open Details",properties:b.id}]}),b.settings?.execution_environment&&s&&b.settings.execution_environment!==s&&a.push({...$,id:`code:ee-override:${b.id}`,severity:"info",title:`${b.title} runs in ${b.settings.execution_environment}`,detail:`The flow's environment is ${s}; the catalog and checks describe that one, not ${b.settings.execution_environment}.`})}let h=t?.requirements?.pins??{},v=[...l.entries()].map(([b,w])=>{let k=t?.collections[b],S=h[b],N=!S||k!==void 0&&KF(k,S);return N||a.push({id:`code:outdated:${b}`,lens:"code",severity:"warning",title:k?`${b} ${k} does not meet requirements (${S})`:`${b} is required (${S}) but not installed`,detail:`${t?.requirements?.path??"requirements.yml"} asks for ${b} ${S}; ${t?.environment??"the environment"} has ${k??"none"}. ${ih([...w].map($=>go(n,$)))} use it. Rebuild the EE from the requirements.`,nodes:[...w],fixes:[]}),{key:`collection:${b}`,label:b,value:k??"missing",detail:[Pn(w.size,"node"),S?`requires ${S}`:"not pinned"].join(" \xB7 "),nodes:[...w],tone:N?void 0:"warn"}}).sort((b,w)=>b.label.localeCompare(w.label)),g=[...f.entries()].map(([b,w])=>({key:`ee:${b}`,label:b,detail:Pn(w.size,"node"),nodes:[...w]})),m=[];return t?.ready||m.push(`No catalog of the environment yet: open a node's properties, or run "Rebuild Module Catalog".`),t?.ready&&!t.requirements&&m.push("No collections/requirements.yml in the repository: versions are not compared."),{lens:"code",chips:r,stats:[{label:"bound nodes",value:String(p)},{label:"collections",value:String(l.size)},...s?[{label:"environment",value:s}]:[]],sections:[{title:"Collections in use",items:v,empty:"No bound node uses a collection."},{title:"Execution environments",items:g,empty:"No environment configured."}],findings:a,notes:m}}function XF(e){let t=$e(e),n=e.flow.inputs??{},r=t.levels.get(on)?.nodes.find(b=>b?.type==="start")?.id,a={},s=new Map,l=[],f=new Map,p=new Map,h=(b,w,k,S)=>{if(b===w)return;let N=`data:${b}>${w}`,$=s.get(N);$?$.label.split(", ").includes(k)||($.label=`${$.label}, ${k}`,$.title=`${$.title}
|
|
158
|
+
${S}`):s.set(N,{id:N,from:b,to:w,label:k,title:S})};for(let{node:b,level:w}of t.nodes.values()){if(!qo(b))continue;let k=Object.keys(b.inputs??{}),S=Object.keys(b.outputs??{});a[b.id]=[EC("in: ",k),EC("out: ",S)].filter($=>!!$);let N=QF(b);for(let[$,j]of Object.entries(b.inputs??{})){let E=j?.from,I=N.get($)?.join(", "),z=I?` \xB7 ${I}`:"";if(!E){j?.default===void 0&&j?.type!=="host_list"&&l.push({id:`data:unfed:${b.id}.${$}`,lens:"data",severity:"warning",title:`${b.title} has no value for ${$}`,detail:`The input ${$} has no default and no \`from:\`. Wire it to a flow input or an upstream output.`,node:b.id,nodes:[b.id],fixes:[{label:"Open Details",properties:b.id}]});continue}let T=F0(t,b,w,"inputs",E);if(T.kind==="impl"||T.kind==="subflowInput")continue;if(T.kind==="unresolved"){l.push(ZF(b.id,b.title,$,E,T.why));continue}if(T.kind==="flow"){let oe=T.name;p.set(oe,(p.get(oe)??new Set).add(b.id));let F=r?$C(t,b.id,on):void 0;r&&F&&h(r,F,oe,`flow.${oe} \u2192 ${b.title}.${$}${z}`);continue}let M=T.node.id,O=t.nodes.get(M);if(!O)continue;let K=T.name,B=`${M}.${K}`;f.set(B,(f.get(B)??new Set).add(b.id));let V=$C(t,b.id,O.level);V&&h(M,V,K===$?K:`${K} \u2192 ${$}`,`${E} \u2192 ${b.title}.${$}${z}`)}}for(let{node:b}of t.nodes.values())for(let w of b.type==="subflow"?Object.keys(b.outputs??{}):[]){let k=uC(b,w);if(!k||!("inner"in k))continue;let S=`${k.inner.id}.${k.output}`;f.set(S,(f.get(S)??new Set).add(b.id))}let v=[];for(let{node:b}of t.nodes.values())for(let w of Object.keys(b.outputs??{})){let k=[...f.get(`${b.id}.${w}`)??[]];v.push({key:`var:${b.id}.${w}`,label:`${b.key}.${w}`,detail:k.length?`read by ${k.map(S=>go(t,S)).join(", ")}`:"not read",nodes:[b.id,...k],tone:k.length?void 0:"muted"}),k.length===0&&l.push({id:`data:unused-output:${b.id}.${w}`,lens:"data",severity:"info",title:`${b.title} writes ${w}, which nothing reads`,detail:`No node input refers to ${b.key}.${w}. Remove the output, or wire it where it is needed.`,node:b.id,nodes:[b.id],fixes:[{label:"Open Details",properties:b.id}]})}let g=Object.keys(n).map(b=>{let w=[...p.get(b)??[]];return{key:`input:${b}`,label:`flow.${b}`,detail:w.length?`read by ${w.map(k=>go(t,k)).join(", ")}`:"not read by a node input",nodes:w,tone:w.length?void 0:"muted"}}),m=[...s.values()];return{lens:"data",chips:a,dataWires:m,stats:[{label:"data wires",value:String(m.length)},{label:"unresolved",value:String(l.filter(b=>b.severity==="warning").length)},{label:"unused outputs",value:String(l.filter(b=>b.id.startsWith("data:unused")).length)}],sections:[{title:"Flow inputs",items:g,empty:"The flow has no inputs."},{title:"Node outputs",items:v,empty:"No node declares outputs."}],findings:l,notes:m.length===0?["No data wires: no node input has a from: reference."]:[]}}function ZF(e,t,n,r,a){return{id:`data:unresolved:${e}.${n}`,lens:"data",severity:"warning",title:`${t}: ${n} reads ${r}, which does not exist`,detail:`"${r}" ${a}.`,node:e,nodes:[e],fixes:[{label:"Open Details",properties:e}]}}var GF={retries:"Retries",delay:"Delay",timeout:"Timeout"};function QF(e){let t=new Map;for(let[n,r]of Object.entries(GF)){let a=e.settings?.[n];if(Yf(a))for(let s of iC(a))t.set(s,[...t.get(s)??[],r])}return t}function JF(e,t,n,r){let a=t?.nodes[n.id]?.[r];return a===void 0?n.type==="subflow"&&e.levels.has(n.id)?Z0(e,t,n.id,r):0:a}function Z0(e,t,n,r){let a=e.levels.get(n);if(!a)return 0;let s=new Map;for(let g of a.edges)g?.from&&g.to&&s.set(g.from.node,[...s.get(g.from.node)??[],g.to.node]);let l=new Map,f=new Set,p=g=>{let m=l.get(g);if(m!==void 0)return m;if(f.has(g))return 0;f.add(g);let b=a.nodes.find(S=>S?.id===g),w=b?JF(e,t,b,r):0,k=Math.max(0,...(s.get(g)??[]).map(p));return f.delete(g),l.set(g,w+k),w+k},h=new Set(a.edges.map(g=>g?.to?.node)),v=a.nodes.filter(g=>g&&(g.type==="start"||!h.has(g.id)));return Math.max(0,...v.map(g=>p(g.id)))}function IC(e){let t=e.settings??{},n=[];return t.serial!==void 0&&n.push(`serial ${t.serial}`),t.timeout&&n.push(n.length?t.timeout:`timeout ${t.timeout}`),n.length===0&&t.retries&&n.push(`retries ${t.retries}`),n.length?{text:n.join(" \xB7 ")}:void 0}function e5(e,t){let n=$e(e),r={},a=[],s=[];for(let{node:w}of n.nodes.values()){if(!qo(w))continue;let k=[],S=IC(w);S&&k.push(S);let N=t?.nodes[w.id];if(N&&k.push({text:N.runs>1?`avg ${Ut(N.avg)}`:`last ${Ut(N.last)}`,title:`${Pn(N.runs,"run")}: avg ${Ut(N.avg)}, p95 ${Ut(N.p95)}`}),r[w.id]=k.slice(0,2),N){s.push({key:`node:${w.id}`,label:w.title,value:Ut(N.avg),detail:`p95 ${Ut(N.p95)} \xB7 ${Pn(N.runs,"run")}`,nodes:[w.id]});let $=ga(w.settings?.timeout);$&&N.p95>.8*$&&a.push({id:`timing:timeout:${w.id}`,lens:"timing",severity:"info",title:`${w.title} runs close to its timeout`,detail:`p95 ${Ut(N.p95)} against a timeout of ${w.settings?.timeout}: a slow host will time out.`,node:w.id,nodes:[w.id],fixes:[]})}}let l=Z0(n,t,on,"avg"),f=Z0(n,t,on,"p95"),p=e.flow.maintenance_window,h=ga(p),v=[],g=[...n.nodes.values()].filter(w=>qo(w.node)&&w.node.type!=="subflow"),m=g.filter(w=>!t?.nodes[w.node.id]).length;!t||t.runs===0?v.push("No runs in the history yet: durations appear after the first run from VS Code."):m>0&&v.push(`${Pn(m,"node")} ${m===1?"has":"have"} no measurement and count${m===1?"s":""} as 0 in the estimate.`),h||v.push("No maintenance window: set one in the flow description to check the estimate."),h&&t?.runs&&(l>h?a.push({id:"timing:window",lens:"timing",severity:"warning",title:`The flow does not fit its ${p} window`,detail:`The slowest path takes about ${Ut(l)} on average over ${Pn(t.runs,"run")} (p95 ${Ut(f)}). Raise serial, split the flow, or widen the window.`,nodes:[],fixes:[]}):f>h&&a.push({id:"timing:window-p95",lens:"timing",severity:"info",title:`Slow runs overrun the ${p} window`,detail:`On average the slowest path takes ${Ut(l)}, but p95 is ${Ut(f)}.`,nodes:[],fixes:[]}));let b=g.filter(w=>w.node.settings?.timeout||w.node.settings?.serial!==void 0).map(w=>({key:`limit:${w.node.id}`,label:go(n,w.node.id),value:IC(w.node)?.text,nodes:[w.node.id]}));return{lens:"timing",chips:r,stats:[{label:"window",value:p??"not set"},{label:"estimate",value:t?.runs?Ut(l):"-"},{label:"p95",value:t?.runs?Ut(f):"-"},{label:"runs",value:String(t?.runs??0)}],sections:[{title:"Slowest nodes",items:s.sort((w,k)=>(t?.nodes[k.nodes[0]]?.avg??0)-(t?.nodes[w.nodes[0]]?.avg??0)).slice(0,8),empty:"No measurements yet."},{title:"Serial and timeouts",items:b,empty:"No node sets serial or a timeout."}],findings:a,notes:v}}function t5(e,t,n,r){let a=e==="inventory"?CF(t,n.inventory,r,n.code):e==="data"?XF(t):e==="code"?YF(t,n.code):e==="access"?_F(t,n.inventory,n.code):e==="changes"?HF(t,n.compare):e5(t,n.timing),s=new Map(Ws(t).filter(f=>f.area==="lens").map(f=>[f.what,{reason:f.reason??"",by:f.by}])),l=f=>(f.accepted?2:0)+(f.severity==="warning"?0:1);return a.findings=a.findings.map(f=>s.has(f.id)?{...f,accepted:s.get(f.id)}:f).sort((f,p)=>l(f)-l(p)),a}function n5(e,t,n,r){let a=$e(e),s=[],l=(w,k)=>{k&&s.push({label:w,value:k})},f=n.inventory?.state==="ready"?n.inventory.facts:void 0,p=f?.targets??n.inventory?.targets??"",h=W0(e,t,p,n.code)?.pattern??p;if(h){let w=f?.patterns[h]?.count,k=r?.summary?Kf(r.summary,t.id).length:void 0;l("hosts",`${h}${w===void 0?"":` \xB7 ${w}`}${k?` \u2192 ${k}`:""}`)}let v=jC(a,t.id);v.length>0&&l("limit",`${v[0]?.port} from ${go(a,v[0]?.from??"")}${v.length>1?` +${v.length-1}`:""}`),l("inputs",Object.keys(t.inputs??{}).join(", ")),l("outputs",Object.keys(t.outputs??{}).join(", "));let g=n.code?.nodes[t.id];t.impl?.ref&&l(t.impl.kind,`${t.impl.ref}${g?.version?` ${g.version}`:""}`),g?.collection&&l("collection",`${g.collection}${n.code?.collections[g.collection]?` ${n.code.collections[g.collection]}`:""}`),l("credential",t.settings?.credential),t.settings?.become&&l("become","yes");let m=t.settings??{};l("serial",[m.serial===void 0?"":`${m.serial}`,m.timeout?`timeout ${m.timeout}`:"",m.retries?`retries ${m.retries}`:""].filter(Boolean).join(" \xB7 "));let b=n.timing?.nodes[t.id];if(b)l("duration",`avg ${Ut(b.avg)} \xB7 p95 ${Ut(b.p95)}`);else if(ga(m.timeout)===void 0&&r?.summary?.timings?.[t.id]){let w=r.summary.timings[t.id];w&&l("duration",`last ${Ut(w.end-w.start)}`)}return s}var G0=/^[a-z0-9]+(-[a-z0-9]+)*$/;function LC(e,t="node"){return e.normalize("NFKD").replace(/[̀-ͯ]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||t}function o5(e,t){if(!t.has(e))return e;for(let n=2;;n++){let r=`${e}-${n}`;if(!t.has(r))return r}}function va(e){let t=$e(e),n=new Map,r=a=>{let s=t.nodes.get(a);if(!s)return"";let l=t.nodes.get(s.level);return l?`${r(l.node.id)}/${s.node.key}`:s.node.key};for(let{node:a}of t.nodes.values())n.set(r(a.id),a);return n}function RC(e){let t=Object.entries(e.flow.inputs??{}).filter(([,n])=>n?.type==="host_list");return(t.find(([,n])=>n.targets)??t[0])?.[0]}var r5=e=>!!e&&typeof e=="object"&&!Array.isArray(e);function zC(e,t){let n=RC(e),r=n&&r5(t?.inputs)?t.inputs[n]:void 0,a=Array.isArray(r)?r:typeof r=="string"?r.split(","):[];return[...new Set(a.map(s=>String(s).trim()).filter(Boolean))]}var FC=e=>e.filter(t=>t.severity!=="warning");function ah(e,t){if(t==="(dropped out)")return"dropped out of the run";let n=va(e),r=n.get(t);if(r)return r.title||r.key;let a=t.lastIndexOf("."),s=a>0?n.get(t.slice(0,a)):void 0;return s?`${s.title||s.key}'s open ${t.slice(a+1)}`:t}function i5(e,t,n=!1){return`${t.host} ${BC(e,t,n)}`}function BC(e,t,n=!1){let r=a=>{let s=e?ah(e,a):a;return n&&s!==a?`${s} (${a})`:s};return`${t.actual==="(dropped out)"?"dropped out of the run":t.actual==="not run"||t.actual==="no run"?"did not run":`ended at ${r(t.actual)}`}; the scenario expected ${r(t.expected)}`}var a5={failed:"fail",unreachable:"be unreachable",timeout:"time out",unchanged:"report no change",false:"decide false"};function Q0(e,t){let n=e?va(e).get(t.step):void 0;return`the scenario forces ${n?.title||n?.key||t.step} to ${a5[t.outcome]??t.outcome} for it (force: ${t.outcome}), so it leaves by ${t.port}`}function qC(e,t,n,r){if(!t?.length)return;let a=va(e);return t.find(s=>s.host===n&&a.get(s.step)?.id===r)}function s5(e,t,n,r=!1){let a=(n??[]).filter(s=>s.host===t.host).map(s=>Q0(e,s));return`${i5(e,t,r)}${a.length?`, because ${a.join(" and ")}`:""}`}function HC(e,t){return{id:`scenario:${e.name}`,mode:"check",state:e.summary?"done":"error",startedAt:t,finishedAt:t,source:"scenario",rc:e.passed?0:2,...e.summary?{summary:e.summary}:{},...e.error?{error:e.error}:{},scenario:{name:e.name,passed:e.passed,hosts:e.hosts,...e.error?{error:e.error}:{},...e.forced?.length?{forced:e.forced}:{}}}}function J0(e){return e.hosts.filter(t=>t.expected!==t.actual)}function l5(e,t,n,r){let a=new Set;for(let[p,h]of va(e))h.id===r&&a.add(p);let s=$e(e).nodes.get(r)?.node.key;s&&a.add(s);let l=new Set(n.summary?Wf($e(e),n.summary,r):[]),f=new Map;for(let p of t.hosts){let h=a.has(p.expected);(h||l.has(p.host))&&f.set(p.host,{host:p.host,expected:h,ended:p.actual,ok:p.expected===p.actual})}for(let p of l)f.has(p)||f.set(p,{host:p,expected:!1,ended:s??"here",ok:!0});return[...f.values()].sort((p,h)=>p.host.localeCompare(h.host))}var ey=(e,t)=>JSON.stringify(ma(e))===JSON.stringify(ma(t));function d5(e,t){let n=$e(t),r=new Set;for(let a of e.nodes)for(let s=n.nodes.get(a)?.level;s&&s!=="root";s=n.nodes.get(s)?.level)r.add(s);return[...r]}function u5(e){let t=(l,f)=>`${l} ${f}${l===1?"":"s"}`,n=[e.nodes.length?t(e.nodes.length,"step"):"",e.edges.length?t(e.edges.length,"wire"):""].filter(Boolean),r=(e.wires??[]).filter(l=>l.kind==="removed").length,a=[e.removed?`${t(e.removed,"step")} removed`:"",r?`${t(r,"wire")} removed`:"",e.flow?.length?`the flow's ${e.flow.join(", ")} changed`:""].filter(Boolean);if(!n.length){let[l="",...f]=a;return`${[`${l.charAt(0).toUpperCase()}${l.slice(1)}`,...f].join(", ")} outside the designer`}let s=a.length?`, ${a.join(", ")}`:"";return`${n.join(" and ")} changed outside the designer${s}`}function c5(e,t=new Date){let n=new Date(e),r=n.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"});return n.toDateString()===t.toDateString()?r:`${n.toLocaleDateString([],{day:"numeric",month:"short"})}, ${r}`}var f5={impl:"binding",accepted:"accepted findings"};function VC(e,t){let n=e??{},r=t??{};return[...new Set([...Object.keys(n),...Object.keys(r)])].filter(a=>!ey(n[a],r[a]))}function h5(e,t){let n=e,r=t;if(!n?.ref&&r?.ref)return`bound to ${r.ref}`;if(n?.ref&&!r?.ref)return"binding removed";if(n?.ref!==r?.ref)return`bound to ${r?.ref} instead of ${n?.ref}`;let a=[...VC(n?.params,r?.params),...ey(n?.register,r?.register)?[]:["register"],...ey(n?.keywords,r?.keywords)?[]:["task keywords"]];return`binding changed${a.length?` (${a.join(", ")})`:""}`}function ty(e){let t=e.where.length?`, in ${e.where[e.where.length-1]}`:"";if(e.kind==="added")return`Added ${e.title}${t}${e.after?`, after ${e.after}`:""}`;if(e.kind==="removed")return`Removed ${e.title}${t}`;let n="",r=[];for(let a of e.fields)a.field==="title"?n=`Renamed ${String(a.before)} to ${String(a.after)}${t}`:a.field==="impl"?r.push(h5(a.before,a.after)):a.field==="settings"?r.push(`settings changed (${VC(a.before,a.after).join(", ")})`):a.field==="level"?r.push("moved to another level"):r.push(`${f5[a.field]??a.field} changed`);return n?[n,...r].join("; "):`${e.title}${t}: ${r.join(", ")||"changed"}`}function p5(e){return[...(e.changes??[]).map(t=>({id:t.kind==="removed"?void 0:t.id,text:ty(t)})),...(e.wires??[]).map(t=>({text:`Wire ${t.kind==="added"?"added":"removed"}: ${t.words??t.label}`})),...(e.flow??[]).map(t=>({text:`The flow's ${t} changed`}))]}var KC={quickAdd:null,portMenu:null,contextMenu:null,pick:null,decide:null,ignore:null,accept:null,testedReason:null,cheatSheet:!1,preview:null,find:!1},m5={quickAdd:[],portMenu:["contextMenu"],contextMenu:["portMenu","preview"],pick:["portMenu"],decide:["portMenu"],ignore:[],accept:[],testedReason:["contextMenu","portMenu"],cheatSheet:["contextMenu"],preview:[],find:["contextMenu","portMenu"],details:["preview","portMenu","contextMenu","quickAdd"],level:["portMenu","contextMenu","pick","quickAdd","decide","preview"],mode:["portMenu","contextMenu","pick","quickAdd","preview"]},g5=["portMenu","contextMenu","pick","quickAdd","decide"],y5=["contextMenu","portMenu","cheatSheet","quickAdd","decide","ignore","accept","testedReason","find","pick"];function Ho(e){return Object.fromEntries(m5[e].map(t=>[t,KC[t]]))}function WC(e,t){return!!e[t]}var ba,qd,sh=!1,UC=!1,v5={info:4e3,success:4e3,error:9e3},b5=0,Hd={min:260,initial:340,max:720};function lh(e,t){return e?.doc&&t?.summary?Kz(e.doc,t.summary):null}function Js(e,t,n,r){return e?.doc&&t?t5(t,e.doc,n,r):null}function YC(e,t){return e?.doc&&t?yF(e.doc,t):null}var _=I4((e,t)=>({snapshot:null,testMode:!1,viewer:!1,runner:!1,expandSubflows:!1,expandedSubflows:[],firstFlow:null,selection:{},quickAdd:null,portMenu:null,contextMenu:null,focusRequest:null,renaming:null,zoomNonce:0,cheatSheet:!1,find:!1,findQuery:"",findNonce:0,centerOn:null,pick:null,pickAt:null,decide:null,bannerDismissedAt:null,formatDismissed:!1,optimistic:{},toasts:[],saving:!1,run:null,runAsked:!1,pastRuns:[],launch:null,scenarios:null,scenarioCheck:null,scenarioUndo:0,scenariosOpen:!1,scenariosTab:!1,scenarioEditing:null,hostPick:null,scenarioShown:null,runBeforeScenario:null,outside:null,merge:null,outsideAround:[],repo:null,runNodes:null,level:on,preview:null,detailsTab:"general",bindKind:null,pendingBinding:null,leave:null,panelWidth:Hd.initial,expanded:!1,paletteCollapsed:!1,panelCollapsed:!1,annotationsHidden:!1,editingAnnotation:null,catalog:{state:"idle"},mode:"design",sync:{state:"idle"},drift:null,ignore:null,lens:null,lensTab:!1,lensScroll:0,lensFacts:{},lensView:null,highlight:null,accept:null,testedReason:null,setSnapshot(n){let r=t().snapshot;if(r&&n.docVersion<r.docVersion)return;let a=n.doc?.layout??{},s=Object.fromEntries(Object.entries(t().optimistic).filter(([S,N])=>{let $=a[S];return!($&&$.x===Math.round(N.x)&&$.y===Math.round(N.y))})),l=n.doc?$e(n.doc):void 0;for(let[S,N]of Object.entries(s)){let $=l?.annotations.get(S)?.annotation;$&&$.x===Math.round(N.x)&&$.y===Math.round(N.y)&&delete s[S]}let f=new Set(l?l.nodes.keys():[]),p=new Set(l?l.annotations.keys():[]),h=t().level,v=l?.levels.has(h)||l?.nodes.get(h)?.node.type==="subflow"?h:on,g=t().selection,m=g.node&&!f.has(g.node)||g.nodes?.some(S=>!f.has(S))||g.annotations?.some(S=>!p.has(S))?{}:g,b=S=>S!==void 0&&!f.has(S.node),w=t().contextMenu?.target,k=w?.kind==="node"&&!f.has(w.id)||w?.kind==="nodes"&&w.ids.some(S=>!f.has(S))||w?.kind==="edge"&&!l?.edges.has(w.id);e({snapshot:n,optimistic:s,selection:v===t().level?m:{},level:v,...b(t().portMenu?.ref)?{portMenu:null}:{},...k?{contextMenu:null}:{},...b(t().pick?.ref)?{pick:null}:{},...t().preview&&!f.has(t().preview?.node??"")?{preview:null}:{},drift:YC(n,t().sync.scan),runNodes:lh(n,t().run),lensView:Js(n,t().lens,t().lensFacts,t().run)})},setTestMode:n=>e({testMode:n}),setRunner:n=>e({runner:n}),setViewer(){t().viewer||(t().setMode("run"),e({viewer:!0,mode:"run",detailsTab:"run",leave:null}))},setExpandSubflows:n=>e({expandSubflows:n,...n?{}:{expandedSubflows:[]}}),toggleExpanded:n=>{let r=t().expandedSubflows;e({expandedSubflows:r.includes(n)?r.filter(a=>a!==n):[...r,n]})},setFirstFlow:n=>e({firstFlow:n}),select(n){let r=t().pendingBinding;if(r&&n.node!==r)return void e({leave:{kind:"select",selection:n}});let a=!!(n.node||n.nodes?.length||n.edge||n.annotations?.length),s=t().editingAnnotation;e({selection:n,...a?{lensTab:!1}:{},...s&&!n.annotations?.includes(s)?{editingAnnotation:null}:{}})},setAnnotationsHidden:n=>e({annotationsHidden:n}),editAnnotation:n=>e({editingAnnotation:n}),openQuickAdd:n=>e({quickAdd:n}),openPortMenu:n=>e({portMenu:n,...Ho("portMenu")}),openContextMenu:n=>{clearTimeout(ba),e({contextMenu:n,...Ho("contextMenu")})},requestFocus:n=>e({focusRequest:{field:n,nonce:Date.now()}}),setRenaming:n=>e({renaming:n}),zoomToSelection:()=>e({zoomNonce:t().zoomNonce+1}),showCheatSheet:n=>e({cheatSheet:n,...Ho("cheatSheet")}),setPick:n=>e({pick:n,pickAt:null,...Ho("pick")}),setPickAt:n=>e({pickAt:n}),setDecide:n=>e({decide:n,...Ho("decide")}),dismissBanner:n=>e({bannerDismissedAt:n}),setOptimistic:n=>e({optimistic:{...t().optimistic,...n}}),dropOptimistic:n=>{let r={...t().optimistic};for(let[a,s]of Object.entries(n)){let l=r[a];l&&l.x===s.x&&l.y===s.y&&delete r[a]}e({optimistic:r})},setError(n){n&&t().notify("error",n)},notify(n,r){let a=++b5;e({toasts:[...t().toasts.filter(s=>s.text!==r),{id:a,level:n,text:r}].slice(-4)}),setTimeout(()=>t().dismissToast(a),v5[n])},dismissToast:n=>e({toasts:t().toasts.filter(r=>r.id!==n)}),setRun(n){let r=t().runAsked&&!!n;(t().scenarioShown||t().scenarioEditing)&&e({scenarioShown:null,scenarioEditing:null,runBeforeScenario:null}),e({run:n,runNodes:lh(t().snapshot,n),lensView:Js(t().snapshot,t().lens,t().lensFacts,n),...r?{runAsked:!1}:{}}),r&&n?.state==="running"&&t().setMode("run")},setRunAsked:n=>e({runAsked:n}),setPastRuns:n=>e({pastRuns:n}),setRepo:n=>e({repo:n}),setMerge(n){e({merge:n})},setOutside(n){let r=t().snapshot?.doc;e({outside:n,outsideAround:n&&r?d5(n,r):[]})},setScenarioCheck(n,r=0){e({scenarioCheck:n,scenarioUndo:r});let a=t().scenarioEditing;a&&t().editScenario(n.names.includes(a)?a:null)},openScenarios(){e({scenariosOpen:!0,scenariosTab:!0,lensTab:!1,panelCollapsed:!1})},showScenariosTab(n){e({scenariosTab:n,...n?{lensTab:!1}:{}})},closeScenarios(){t().scenarioEditing&&t().editScenario(null),e({scenariosOpen:!1,scenariosTab:!1})},editScenario(n){let{scenarioCheck:r,scenarioEditing:a,scenarioShown:s,snapshot:l,lens:f,lensFacts:p}=t(),h=n?r?.names.indexOf(n)??-1:-1,v=h>=0?r?.results[h]:void 0,g=a!==null||s!==null,m=v?HC(v,new Date().toISOString()):t().runBeforeScenario;(v||g)&&(e({...v&&!g?{runBeforeScenario:t().run}:{},...v?{}:{runBeforeScenario:null},scenarioEditing:v?v.name:null,scenarioShown:null,run:m,runNodes:lh(l,m),lensView:Js(l,f,p,m)}),v&&!a&&t().setMode("run"))},setHostPick:n=>e({hostPick:n}),setScenarios(n,r){e({scenarios:n}),r&&t().showScenario(r)},showScenario(n){let{scenarios:r,scenarioShown:a,scenarioEditing:s,snapshot:l,lens:f,lensFacts:p}=t(),h=n?r?.find(m=>m.name===n):void 0,v=a!==null||s!==null,g=h?HC(h,new Date().toISOString()):v?t().runBeforeScenario:t().run;e({...h&&!v?{runBeforeScenario:t().run}:{},...h?{}:{runBeforeScenario:null},scenarioShown:h?h.name:null,scenarioEditing:null,run:g,runNodes:lh(l,g),lensView:Js(l,f,p,g)}),h&&t().setMode("run")},setLaunch:(n,r)=>e({launch:n,launchNotice:r}),setLaunchFacts(n,r,a){let s=t().launch;s?.token===n&&e({launch:{...s,facts:r,factsError:r?void 0:a}})},setLens(n){e({lens:n,lensTab:n!==null&&!t().pendingBinding,highlight:null,lensView:Js(t().snapshot,n,t().lensFacts,t().run)})},showLensTab(n){if(n&&t().pendingBinding)return void e({leave:{kind:"lensTab"}});e({lensTab:n,...n?{scenariosTab:!1}:{}})},setLensFacts(n){let r={...t().lensFacts,...n};e({lensFacts:r,lensView:Js(t().snapshot,t().lens,r,t().run)})},setHighlight:n=>e({highlight:n}),setAccept:n=>e({accept:n}),setTestedReason:n=>e({testedReason:n,...Ho("testedReason")}),setLevel(n){if(n!==t().level){if(t().pendingBinding)return void e({leave:{kind:"level",level:n}});clearTimeout(ba),e({level:n,selection:{},...Ho("level")})}},setPreview(n){clearTimeout(ba),clearTimeout(qd),sh=!1,e({preview:n})},hoverNode(n,r){clearTimeout(ba),!n||!r?(clearTimeout(qd),qd=setTimeout(()=>{sh||e({preview:null})},200)):(clearTimeout(qd),t().preview?.node!==n&&(ba=setTimeout(()=>{let a=t();g5.some(s=>WC(a,s))||UC||e({preview:{node:n,x:r.right+12,y:r.top,left:r.left}})},400)))},portHover(n){UC=n,n&&(clearTimeout(ba),sh||e({preview:null}))},holdPreview(n){sh=n,n?clearTimeout(qd):t().hoverNode(null)},openDetails(n,r="general",a){clearTimeout(ba);let s=t().pendingBinding;if(s&&s!==n)return void e({leave:{kind:"details",node:n,tab:r,bindKind:a}});e({selection:{node:n},detailsTab:r,bindKind:a?{node:n,kind:a}:null,...Ho("details")})},setDetailsTab:n=>e({detailsTab:n}),setPendingBinding:n=>e({pendingBinding:n}),resolveLeave(n){let r=t().leave;e({leave:null}),r&&n!=="stay"&&(e({pendingBinding:null}),r.kind==="select"?t().select(r.selection):r.kind==="level"?t().setLevel(r.level):r.kind==="mode"?t().setMode(r.mode):r.kind==="reveal"?t().reveal(r.node):r.kind==="collapse"?t().setPanelCollapsed(!0):r.kind==="lensTab"?t().showLensTab(!0):t().openDetails(r.node,r.tab,r.bindKind))},setPanelWidth:n=>e({panelWidth:Math.round(Math.min(Hd.max,Math.max(Hd.min,n)))}),setExpanded:n=>e({expanded:n}),setPaletteCollapsed:n=>e({paletteCollapsed:n}),setPanelCollapsed(n){if(n&&t().pendingBinding)return void e({leave:{kind:"collapse"}});e({panelCollapsed:n})},openFind:n=>e(n?{find:!0,findNonce:t().findNonce+1,...Ho("find")}:{find:!1}),setFindQuery:n=>e({findQuery:n}),setMode(n){if(n===t().mode||t().viewer)return;if(t().pendingBinding)return void e({leave:{kind:"mode",mode:n}});let r=t().detailsTab;e({mode:n,detailsTab:n==="code"?"code":n==="run"?"run":r==="code"||r==="run"?"general":r,...Ho("mode")})},setSync(n){e({sync:n,drift:YC(t().snapshot,n.scan)})},setIgnore:n=>e({ignore:n}),setCatalog:n=>e({catalog:n}),reveal(n){let r=t().pendingBinding;if(r&&r!==n)return void e({leave:{kind:"reveal",node:n}});let a=t().snapshot?.doc,s=a?$e(a):void 0,l=s?.annotations.get(n);if(l){t().setLevel(l.level),e({selection:{annotations:[n]},centerOn:n,annotationsHidden:!1});return}let f=s?.nodes.get(n);f&&(t().setLevel(f.level),e({selection:{node:n},centerOn:n}))}}));async function Pe(e){let t=await la(e);return t.ok||_.getState().setError(t.error??"The change was refused"),t}function XC(e){let t=_.getState();t.setMode(e),e==="code"&&t.sync.state==="idle"&&je({type:"sync"})}var x5="# Ansible Flow Designer nodes: paste them on a flow canvas (Ctrl+V)";function ZC(e,t,n={},r=[]){let a=Ro(e),s=[...t.map(S=>a.nodes.get(S)),...r.map(S=>a.annotations.get(S))].find(Boolean),l=s?a.levels.get(s.level):void 0;if(!l)return"";let f=new Set(t),p=new Set(r),h=l.nodes.filter(S=>S&&f.has(S.id)),v=l.annotations.filter(S=>S&&(p.has(S.id)||S.on!==void 0&&f.has(S.on))),g=l.edges.filter(S=>f.has(S?.from?.node)&&f.has(S?.to?.node)),m=new Set(h.flatMap(S=>[S.id,...qj(S)])),b=Object.fromEntries(Object.entries({...n,...e.layout}).filter(([S])=>m.has(S))),w=(e.decisions??[]).filter((S,N)=>{let $=Zj(S,N);return $?.area==="port"&&!!$.node&&m.has($.node)}),k={nodes:h};return g.length>0&&(k.edges=g),v.length>0&&(k.annotations=v.map(Cz)),Object.keys(b).length>0&&(k.layout=b),w.length>0&&(k.decisions=w),`${x5}
|
|
159
|
+
${Lo(k,0,{eol:`
|
|
160
|
+
`,indentUnit:2,seqIndentless:!0}).join(`
|
|
161
|
+
`)}
|
|
162
|
+
`}function w5(e){switch(e.type){case"start":case"end":case"decision":return;case"task":return e.impl?.kind==="playbook"?"a playbook binding runs plays of its own":e.settings?.inventory_target?.trim()?"it runs on its inventory_target, in plays of its own":e.settings?.serial===void 0?e.settings?.max_fail_percentage===void 0?void 0:"max_fail_percentage counts a play of its own":"serial batches a play of its own; the subflow sets the batch";case"subflow":return e.subflow?.nodes?.length?"a subflow with steps is a level of its own":void 0;default:return`a ${e.type} node needs plays of its own`}}function k5(e,t){let n=[],r=e.nodes.get(t.id)?.level,a=[t,...r?z0(e,r):[]].find(s=>s.settings?.inventory_target?.trim());a&&n.push({node:t,why:`its steps run on the inventory_target of ${a.title}, in plays of their own`});for(let s of e.levels.get(t.id)?.nodes??[]){if(!s)continue;let l=w5(s);l&&n.push({node:s,why:l})}return n}var ny=(e,t)=>`${e}|${t}`;function S5(e,t){return{wired:new Set(e.map(n=>ny(n?.from?.node,n?.from?.port))),exits:new Set(Object.values(t?.subflow?.boundary?.outputs??{}).flatMap(n=>(n??[]).map(r=>ny(r?.node,r?.port))))}}function GC(e,t){return!!e&&Ks(e).some(n=>n.name===t)}function N5(e,t,n){let r=ny(e,t);return!n.wired.has(r)&&!n.exits.has(r)}function j5(e,t,n,r){return ha(n)&&N5(t,n,r)&&GC(e,n)}function C5(e,t,n,r){return n.some(a=>GC(a,t)&&j5(e,a.id,t,r))}var $5=new Set(["connected","open-fail","open-purpose"]);function cn(e,t={},n=on){let r=e.doc;if(!r)return{nodes:[],edges:[],annotations:[]};let a=$e(r),s=a.levels.get(n);if(!s)return{nodes:[],edges:[],annotations:[]};let l=new Set;for(let b of s.edges)b?.from&&b.to&&(l.add(`${b.from.node}|${b.from.port}`),l.add(`${b.to.node}|${b.to.port}`));let f=s.parent?a.nodes.get(s.parent)?.node.subflow?.boundary:void 0;f?.in&&l.add(`${f.in}|in`);for(let b of Object.values(f?.outputs??{}))for(let w of b??[])l.add(`${w?.node}|${w?.port}`);let p=new Set(e.openPorts.map(b=>`${b.node}|${b.port}`)),h=new Set((r.decisions??[]).map(b=>`${b?.node}|${b?.port}`)),v=r.layout??{},g=s.nodes.filter(b=>!!b?.id).map(b=>{let w=t[b.id]??v[b.id]??e.autoPositions[b.id]??{x:0,y:0},k=E5(Pd(b).map(({enabled:S,...N})=>{let $=`${b.id}|${N.name}`,j=S?"open":"available";return l.has($)?j="connected":S?p.has($)?j="open-fail":N.fail&&h.has($)&&(j="open-purpose"):j="available",{...N,state:j,rest:$5.has(j),offset:.5}}));return{node:b,position:w,...C0(b.type),ports:k,openFail:k.filter(S=>S.state==="open-fail").length}}),m=new Set(g.map(b=>b.node.id));return{nodes:g,edges:s.edges.filter(b=>b?.from&&b.to&&m.has(b.from.node)&&m.has(b.to.node)).map(b=>{let w=pa(b.from.port);return{id:b.id,source:b.from.node,sourcePort:b.from.port,target:b.to.node,targetPort:b.to.port,tone:w.tone,problem:w.side==="right"}}),annotations:xz(s,new Map(g.map(b=>[b.node.id,b.position])),t)}}function E5(e){let t=new Map;for(let n of e)t.set(n.side,[...t.get(n.side)??[],n]);for(let n of t.values())n.forEach((r,a)=>{r.offset=(a+1)/(n.length+1)});return e}var _5="boundary:",Vd={x:64,top:72,bottom:72},oy={width:420,height:280};function ry(e,t,n){let r=e.doc;if(!r||n==="root")return;let a=$e(r).nodes.get(n)?.node;if(!a)return;let s=a.subflow?.boundary,l=`${_5}${a.id}`,f={x:0,y:0,...oy},p=[...t.nodes,...t.annotations];if(p.length>0){let w=p.flatMap(E=>[E.position.x,E.position.x+E.width]),k=p.flatMap(E=>[E.position.y,E.position.y+E.height]),[S,N,$,j]=[Math.min(...w),Math.max(...w),Math.min(...k),Math.max(...k)];f={x:S-Vd.x,y:$-Vd.top,width:Math.max(oy.width,N-S+2*Vd.x),height:Math.max(oy.height,j-$+Vd.top+Vd.bottom)}}let h=t.nodes.map(w=>w.node),v=S5(t.edges.map(w=>({from:{node:w.source,port:w.sourcePort}})),a),g=[];for(let w of Pd(a)){if(w.name==="undo"||w.name==="cancelled")continue;if(w.direction==="in"){g.push({name:w.name,side:"top",tone:w.tone,fail:!1,state:s?.in?"connected":"unfed",offset:.5});continue}let k=w.enabled?"unfed":"available";(s?.outputs?.[w.name]??[]).length>0?k="connected":C5(a,w.name,h,v)&&(k="bubbled"),g.push({name:w.name,side:w.side==="right"?"right":"bottom",tone:w.tone,fail:w.fail,state:k,offset:0})}for(let w of["bottom","right"]){let k=g.filter(S=>S.side===w);k.forEach((S,N)=>{S.offset=(N+1)/(k.length+1)})}let m=[],b=new Set(h.map(w=>w.id));s?.in&&b.has(s.in)&&m.push({id:`entry:${a.id}`,kind:"entry",source:l,sourcePort:"in",target:s.in,targetPort:"in",tone:"neutral",problem:!1,label:"in"});for(let[w,k]of Object.entries(s?.outputs??{}))for(let S of k??[]){if(!S?.node||!b.has(S.node))continue;let N=pa(w);m.push({id:`exit:${a.id}|${S.node}|${S.port}|${w}`,kind:"exit",source:S.node,sourcePort:S.port,target:l,targetPort:w,tone:pa(S.port).tone,problem:N.side==="right",label:S.reason??w,exit:{from:{node:S.node,port:S.port},port:w,reason:S.reason}})}return{subflow:a,id:l,frame:f,ports:g,edges:m}}function xa(e,t){let n={};for(let r of e.nodes)t?.[r.node.id]||(n[r.node.id]={x:Math.round(r.position.x),y:Math.round(r.position.y)});return n}var dh=24;function QC(e,t,n){let r=s=>e.nodes.some(l=>s.x<l.position.x+l.width+dh&&s.x+n.width+dh>l.position.x&&s.y<l.position.y+l.height+dh&&s.y+n.height+dh>l.position.y),a={x:Math.round(t.x),y:Math.round(t.y)};for(let s=0;s<40&&r(a);s++)a.y+=40;return a}function iy(e,t,n){let r=e.nodes.find(l=>l.node.id===t);if(!r)return;let a=r.ports.find(l=>l.name===n)?.side??"bottom",s=C0("task");return QC(e,a==="right"?{x:r.position.x+r.width+90,y:r.position.y}:{x:r.position.x,y:r.position.y+r.height+70},s)}function A5(e){let t={draft:0,specified:0,implemented:0,tested:0},n=0;if(!e)return{counts:t,total:n};for(let{node:r}of $e(e).nodes.values())r.type!=="start"&&r.type!=="end"&&(t[r.status??"draft"]++,n++);return{counts:t,total:n}}function JC(e){return e.length}var ay=["draft","specified","implemented","tested"];function T5(e){switch(e.status??"draft"){case"draft":return"Define at least one input or output to make it specified";case"specified":return"Bind a module, role or playbook to make it implemented";case"implemented":return"A passing real run of this flow version makes it tested";default:return}}function M5(e,t){let n=$e(e),r=[],a=t;for(;a&&a!=="root";){let s=n.nodes.get(a);if(!s)break;r.unshift({id:a,title:s.node.title}),a=s.level}return[{id:on,title:e.flow.name},...r]}function O5(e,t){let n=$e(e),r=[],a=new Set,s=t;for(;s&&s!=="root";){let l=n.nodes.get(s);if(!l)break;let f=l.node.settings??{},p=l.node.title,h=(v,g,m)=>{a.has(v)||(a.add(v),r.push({label:m?g:`${g} \xB7 not applied`,title:m?`From ${p}: every step inside runs on it`:`Set on ${p}, but the generated plays of the steps inside do not use it: set it on the steps`,applied:m}))};f.inventory_target&&h("inventory",`inherits ${f.inventory_target}`,!0),f.credential&&Rt(e)<2&&h("credential",f.credential,!1),f.execution_environment&&Rt(e)<2&&h("ee",`EE ${f.execution_environment}`,!1),f.become&&h("become",f.become_user?`become ${f.become_user}`:"become",Rt(e)>=2),l.node.ref&&h("shared",`shared from ${l.node.ref.from} v${l.node.ref.version} \xB7 edit it there`,!0),f.rolling!==void 0&&s===t&&h("rolling",`rolling, ${f.rolling} at a time`,k5(n,l.node).length===0),s=l.level}return r}function sy(e,t){let{selection:n,snapshot:r}=_.getState(),a=e??n.nodes??(n.node?[n.node]:[]),s=t??(e?[]:n.annotations??[]);if(!r?.doc||a.length+s.length===0)return;let l=ZC(r.doc,a,r.autoPositions,s);return l?{text:l,count:a.length+s.length}:void 0}function Kd(e,t){let n=sy(e,t);n?je({type:"copyText",...n}):_.getState().setError("Select the nodes to copy first")}var ly=()=>{},el;function e$(e){ly=e}function dy(){return ly()}async function t$(e,t){let n=_.getState();if(!n.snapshot?.doc)return[];if(n.mode!=="design")return n.setError(`The graph is read-only in ${n.mode==="run"?"Run":"Code"} mode: switch to Design to paste`),[];let r=t??ly();r&&el&&el.at.x===r.x&&el.at.y===r.y?el.times+=1:el=r?{at:r,times:0}:void 0;let a=(el?.times??0)*32,s=xa(cn(n.snapshot,n.optimistic,n.level),n.snapshot.doc.layout),l=await la({kind:"pasteNodes",text:e,level:n.level,...r?{position:{x:r.x+a,y:r.y+a}}:{},...Object.keys(s).length>0?{freeze:s}:{}});if(!l.ok)return _.getState().setError(l.error??"Nothing was pasted"),[];let f=l.pasted??[];return f.length>1?_.getState().select({nodes:f}):f[0]&&_.getState().select({node:f[0]}),f}function uy(){if(document.activeElement?.closest('input, textarea, select, [contenteditable="true"]'))return!0;let e=document.getSelection();if(!e?.toString())return!1;let t=e.anchorNode;return!(t instanceof Element?t:t?.parentElement)?.closest(".react-flow")}function P5(e){let t=a=>{if(uy()||!a.clipboardData)return;let s=sy();s&&(a.clipboardData.setData("text/plain",s.text),a.preventDefault())},n=a=>{if(uy()||!a.clipboardData)return;let{selection:s}=_.getState(),l=s.nodes??(s.node?[s.node]:[]),f=sy(l);f&&(a.clipboardData.setData("text/plain",f.text),a.preventDefault(),_.getState().mode==="design"?e(l):_.getState().setError("The graph is read-only outside Design mode: copied, not cut"))},r=a=>{if(uy())return;let s=a.clipboardData?.getData("text/plain");s?.trim()&&(a.preventDefault(),t$(s))};return document.addEventListener("copy",t),document.addEventListener("cut",n),document.addEventListener("paste",r),()=>{document.removeEventListener("copy",t),document.removeEventListener("cut",n),document.removeEventListener("paste",r)}}function cy(e){return e.type!=="start"&&e.type!=="end"}function Wd(){let{selection:e}=_.getState();return e.nodes??(e.node?[e.node]:[])}function fy(){return _.getState().selection.annotations??[]}function Yt(){let{mode:e,snapshot:t,level:n}=_.getState();return e==="design"&&!!t?.doc&&!t.stale&&!t.idGaps&&!Vf(t.doc,n)}function wa(){return _(e=>!e.viewer&&!!e.snapshot?.doc&&!e.snapshot.stale&&!e.snapshot.idGaps&&!Vf(e.snapshot.doc,e.level))}function n$(e){if(e.startsWith("entry:"))return{kind:"entry",subflow:e.slice(6)};if(!e.startsWith("exit:"))return;let[t,n,r,a]=e.slice(5).split("|");if(t&&n&&r&&a)return{kind:"exit",subflow:t,edge:e,from:{node:n,port:r},port:a}}function D5(e){let t=e.pasted??(e.created?[e.created]:[]);return t.length>1?_.getState().select({nodes:t}):t[0]&&_.getState().select({node:t[0]}),t}async function Ud(e,t=[],n=[],r=!0){if(!Yt())return;let a=new Set(e),s=_.getState().snapshot?.doc,l=v=>s?$e(s).nodes.get(v)?.node.subflow?.boundary?.in:void 0,f=[];for(let v of t){let g=n$(v);if(g?.kind==="entry"){let m=l(g.subflow);m&&a.has(m)||await Pe({kind:"setBoundaryIn",subflow:g.subflow,node:null})}else g?.kind==="exit"?a.has(g.from.node)||await Pe({kind:"disconnectBoundary",subflow:g.subflow,from:g.from,port:g.port}):f.push(v)}if(e.length===0&&f.length===0&&n.length===0)return;let p=r&&e.length>0,h=p&&s?Ij(Dj($e(s),e,f)):void 0;(await Pe({kind:"deleteNodes",ids:e,edges:f,...n.length?{annotations:n}:{},...p?{heal:!0}:{}})).ok&&h&&_.getState().notify("info",h)}async function I5(e){let t=_.getState().snapshot?.doc;if(!Yt()||!t)return;let n=$e(t),r=e.map(s=>n.nodes.get(s)?.node).filter(s=>!!s&&cy(s));if(r.length===0)return;let a=!r.every(s=>s.disabled);await Pe({kind:"setDisabled",ids:r.map(s=>s.id),disabled:a})}async function L5(e){let t=_.getState().snapshot?.doc;if(!Yt()||e.length===0||!t)return;let n=Ij(Dj($e(t),e));(await Pe({kind:"detachNodes",ids:e})).ok&&n&&_.getState().notify("info",n)}async function R5(e,t=[]){(e.length!==0||t.length!==0)&&(Kd(e,t),await Ud(e,[],t))}async function o$(e,t=[]){let n=_.getState();if(!Yt()||e.length===0&&t.length===0||!n.snapshot?.doc)return;let r=ZC(n.snapshot.doc,e,n.snapshot.autoPositions,t);if(!r)return;let a=xa(cn(n.snapshot,n.optimistic,n.level),n.snapshot.doc.layout),s=await Pe({kind:"pasteNodes",text:r,level:n.level,...Object.keys(a).length>0?{freeze:a}:{}});s.ok&&D5(s)}function r$(){let e=_.getState();if(!e.snapshot)return;let t=cn(e.snapshot,e.optimistic,e.level),n=t.nodes.map(s=>s.node.id),r=e.annotationsHidden?[]:t.annotations.map(s=>s.annotation.id),a=r.length?{annotations:r}:{};n.length>1?e.select({nodes:n,...a}):n[0]?e.select({node:n[0],...a}):r.length&&e.select(a)}function hy(){let e=_.getState();if(e.level==="root"||!e.snapshot?.doc)return;let t=$e(e.snapshot.doc).nodes.get(e.level)?.level??"root",n=e.level;e.setLevel(t),e.select({node:n})}function py(e){let t=_.getState();Yt()&&(t.select({node:e}),t.setRenaming(e))}function i$(e){let t=_.getState().snapshot?.doc;if(!t)return;let n=$e(t),r=n.nodes.get(e),a=r?n.levels.get(r.level):void 0;return r&&a?{node:r.node,edges:a.edges.filter(s=>!!s)}:void 0}function z5(e,t){let n=i$(e);if(!n)return;let r=new Set([e]);for(let s=[e];s.length>0;){let l=s.pop();for(let f of n.edges){let[p,h]=t==="down"?[f.from.node,f.to.node]:[f.to.node,f.from.node];p===l&&!r.has(h)&&(r.add(h),s.push(h))}}let a=[...r];_.getState().select(a.length>1?{nodes:a}:{node:e})}function a$(e){let t=_.getState(),n=t.selection.node,r=n?i$(n):void 0;if(!n||!r)return!1;let a;if(e==="up")a=r.edges.find(s=>s.to.node===n)?.from.node;else{let s=r.edges.filter(f=>f.from.node===n),l=Bf(r.node);a=(s.find(f=>l.includes(f.from.port))??s[0])?.to.node}return a?(t.select({node:a}),document.querySelector(`.react-flow__node[data-id="${a}"]`)?.focus(),!0):!1}function F5(e){let t=_.getState();t.select({nodes:e}),t.requestFocus("extractTitle")}function B5(e){let t=_.getState();t.select({edge:e}),t.requestFocus("exitReason")}var q5={note:"",section:"Section",text:"Text"};async function Yd(e,t,n,r={}){let a=_.getState();if(!Yt()||!a.snapshot?.doc)return;let s=cn(a.snapshot,a.optimistic,a.level),l=q5[e],f=new Set(r.around??[]),p=e==="section"?Nz([...s.nodes.filter(b=>f.has(b.node.id)),...s.annotations.filter(b=>b.kind!=="section"&&(f.has(b.annotation.id)||!!b.on&&f.has(b.on)))]):void 0,h=[...s.nodes,...s.annotations.filter(b=>e==="section"||b.kind!=="section")],v=n?kj:p?p.position:r.near&&t?Sz(h,wj({kind:e,text:l}),t):t??dy()??{x:0,y:0},g=e==="section"?xa(s,a.snapshot.doc.layout):{},m=await Pe({kind:"addAnnotation",level:a.level,annotation:{kind:e,text:l,x:Math.round(v.x),y:Math.round(v.y),...p?{width:p.width,height:p.height}:{},...n?{on:n}:{}},...Object.keys(g).length?{freeze:g}:{}});m.ok&&m.created&&(_.getState().select({annotations:[m.created]}),_.getState().editAnnotation(m.created))}function uh(e){Yt()&&(_.getState().select({annotations:[e]}),_.getState().editAnnotation(e))}function H5(e,t){Pe({kind:"updateAnnotation",id:e,patch:{color:t}})}function s$(e,t){let n=_.getState();if(!n.snapshot)return{};let r=cn(n.snapshot,n.optimistic,n.level);return{at:r.annotations.find(a=>a.annotation.id===e)?.position,node:t?r.nodes.find(a=>a.node.id===t)?.position:void 0}}function l$(e){let{at:t}=s$(e);Pe({kind:"updateAnnotation",id:e,patch:{on:null,...t??{}}})}function d$(e){_.getState().setPick({mode:"attach",ref:{node:e,port:""}})}async function V5(e,t){let{at:n,node:r}=s$(e,t),a=n&&r?{x:n.x-r.x,y:n.y-r.y}:kj;await Pe({kind:"updateAnnotation",id:e,patch:{on:t,x:a.x,y:a.y}})}var yo=P0,ch={connected:"connected","open-fail":"open: not handled","open-purpose":"open on purpose",open:"open",available:"optional, not enabled"},u$="application/x-afd-node-type",c$="application/x-afd-pattern",f$="application/x-afd-annotation";function fh(e,t=Date.now()){if(!e)return"";let n=Math.max(0,Math.round((t-Date.parse(e))/1e3));return n<60?"just now":n<3600?`${Math.round(n/60)} min ago`:n<86400?`${Math.round(n/3600)} h ago`:`${Math.round(n/86400)} d ago`}function hh(){return _(e=>e.snapshot?.doc?$e(e.snapshot.doc):void 0)}function K5(e){let t=hh();return e?t?.nodes.get(e):void 0}function ph(e){let t=_(s=>s.snapshot),n=_(s=>s.optimistic),r=_(s=>s.level),a=e??r;return(0,A.useMemo)(()=>t?cn(t,n,a):{nodes:[],edges:[],annotations:[]},[t,n,a])}function W5(e,t,n,r){let a=e.type==="subflow"&&(e.subflow?.nodes?.length??0)>0,s=t.artifact==="not bound"?void 0:`${t.tasks.length} task${t.tasks.length===1?"":"s"}`;return n?{count:s,state:`drift: ${n.label}`,tone:"warn"}:!e.impl?.ref&&!a&&(e.type==="task"||e.type==="subflow")?{count:s,state:"runs as TODO stub",tone:"neutral"}:r?.failures.some(l=>l.node===e.id)?{count:s,state:"last run failed",tone:"warn"}:r?.nodes[e.id]?{count:s,state:"last run ok",tone:"ok"}:a?{count:s,state:"open subflow",tone:"neutral"}:t.matched?{count:s,state:"matched by ID",tone:"neutral"}:{count:s,state:"not in generated code",tone:"warn"}}var h$=["type","status","has","open","tag","target"],U5={type:["task","subflow","decision","approval","parallel","join","end"],status:["draft","specified","implemented","tested"],has:["no-binding","binding","problems","errors","disabled"],open:["fail"],tag:[],target:[]},Y5={"has:no-binding":"Steps not implemented yet: no module, role or playbook","has:binding":"Steps bound to a module, role or playbook","has:errors":"Steps with an error","has:problems":"Steps with an error or a warning","has:disabled":"Steps switched off: their hosts pass through","type:approval":"Approval steps","open:fail":"Steps with a fail port nothing handles","status:draft":"Draft steps, and subflows with a draft step inside"},X5={"has:no-binding":["step not implemented yet","steps not implemented yet"],"has:binding":["step bound to a module, role or playbook","steps bound to a module, role or playbook"],"has:errors":["step with an error","steps with an error"],"has:problems":["step with an error or a warning","steps with an error or a warning"],"has:disabled":["disabled step","disabled steps"],"open:fail":["step with a fail port nothing handles","steps with a fail port nothing handles"]};function Z5(e,t){let n=p$(e),r=Object.entries(n.filters);if(n.words.length||r.length!==1)return;let[a,s]=r[0];if(s.length!==1)return;let l=s[0],f=t===1,p=X5[`${a}:${l}`];if(p)return`${t} ${f?p[0]:p[1]}`;if(a==="type")return`${t} ${l}${f?"":"s"}`;if(a==="status")return`${t} ${l} ${f?"step or subflow":"steps and subflows"}`}var G5=/([A-Za-z]+):"([^"]*)"|([A-Za-z]+):(\S+)|"([^"]*)"|(\S+)/g;function p$(e){let t=[],n={};for(let r of e.matchAll(G5)){let a=(r[1]??r[3])?.toLowerCase(),s=r[2]??r[4];if(a&&s!==void 0&&s!==""&&h$.includes(a)){n[a]=[...n[a]??[],s.toLowerCase()];continue}let l=(r[5]??r[0]).toLowerCase();l&&t.push(...l.split(/\s+/).filter(Boolean))}return{words:t,filters:n}}var Q5=e=>Object.keys(e.filters).length>0;function J5(e,t,n={}){let r=(l,f)=>{let p=t.filters[l];return!p||p.some(f)},a=e.status??"draft",s=(n.findings??[]).filter(l=>l.node===e.id);return r("type",l=>e.type===l||l==="handler"&&!!e.purpose)&&r("status",l=>e.type!=="start"&&e.type!=="end"&&a===l)&&r("has",l=>l==="no-binding"?e.type==="task"&&!e.impl:l==="binding"?!!e.impl:l==="problems"?s.length>0:l==="errors"?s.some(f=>f.severity==="error"):l==="disabled"&&e.disabled===!0)&&r("open",l=>l==="fail"&&(n.openPorts??[]).some(f=>f.node===e.id))&&r("tag",l=>(e.settings?.tags??[]).some(f=>f.toLowerCase()===l))&&r("target",l=>(e.settings?.inventory_target??"").toLowerCase().includes(l))}function e6(e){let t=e.split(/\s+/).at(-1)??"",[n,r]=t.includes(":")?t.split(":",2):[t,void 0];return r===void 0?t?h$.filter(a=>a.startsWith(t.toLowerCase())).map(a=>`${a}:`):[]:(U5[n?.toLowerCase()]??[]).filter(a=>a.startsWith((r??"").toLowerCase())).map(a=>`${n}:${a}`)}var t6=e=>/^https?:\/\/[^\s<>"]+$/i.test(e),n6=/`([^`\n]+)`|\*\*([^*\n]+?)\*\*|\*([^*\n]+?)\*|\[([^\]\n]+)\]\(([^)\s]+)\)|(https?:\/\/[^\s<>"()[\]]*[^\s<>"()[\].,;:!?'])/g;function m$(e){let t=[],n=a=>{if(!a)return;let s=t.at(-1);s?.kind==="text"?s.text+=a:t.push({kind:"text",text:a})},r=0;for(let a of e.matchAll(n6))n(e.slice(r,a.index)),r=(a.index??0)+a[0].length,a[1]===void 0?a[2]===void 0?a[3]===void 0?a[4]!==void 0&&a[5]!==void 0?t6(a[5])?t.push({kind:"link",text:a[4],href:a[5]}):n(a[4]):a[6]!==void 0&&t.push({kind:"link",text:a[6],href:a[6]}):t.push({kind:"italic",text:a[3]}):t.push({kind:"bold",text:a[2]}):t.push({kind:"code",text:a[1]});return n(e.slice(r)),t}var g$=/^\s*[-*]\s+/;function y$(e){let t=[],n=[],r,a=()=>{n.length&&t.push({kind:"para",parts:m$(n.join(`
|
|
163
|
+
`))}),n=[]},s=()=>{r&&t.push({kind:"list",items:r}),r=void 0};for(let l of String(e??"").split(/\r?\n/))g$.test(l)?(a(),r??=[],r.push(m$(l.replace(g$,"")))):l.trim()===""?(a(),s()):(s(),n.push(l));return a(),s(),t}var v$=e=>e.map(t=>t.kind==="link"&&t.text!==t.href?`${t.text} (${t.href})`:t.text).join("");function b$(e){return y$(e).map(t=>t.kind==="para"?v$(t.parts):t.items.map(n=>`- ${v$(n)}`).join(`
|
|
164
|
+
`)).join(`
|
|
165
|
+
`)}function mh(e,t){let n=[];for(let r=t;r!==on;){let a=e.nodes.get(r);if(!a)break;n.unshift(a.node.title),r=a.level}return n}function o6(e,t){let n=e.nodes.get(t);if(!n)return;let r=mh(e,n.level);return r.length?`in ${r.join(" \u203A ")}`:"on the top level"}function r6(e,t){return t.some(n=>{let r=n.length===1?e.nodes.get(n[0]):void 0;return!!r&&r.level!=="root"})}function i6(e,t,n){let r=new Set;for(let a of t)for(let s=a;s;){let l=e.nodes.get(s);if(!l)break;if(l.level===n){r.add(s);break}s=l.level==="root"?void 0:l.level}return[...r]}function a6(e,t,n=50,r={}){let a=p$(t),{words:s}=a,l=Q5(a);if(s.length===0&&!l)return[];let f=s.join(" "),p=[];for(let{node:h,level:v}of e.nodes.values()){let g=h.title.toLowerCase(),m=h.key?.toLowerCase()??"",b=h.impl?.ref?.toLowerCase()??"";if(!s.every(S=>g.includes(S)||m.includes(S)||b.includes(S))||l&&!J5(h,a,r))continue;let w=f?g.startsWith(f)?0:g.split(/\W+/).some(S=>S.startsWith(s[0]??""))?1:g.includes(f)?2:m.includes(f)?3:4:0,k=mh(e,v);p.push({found:{id:h.id,title:h.title,key:h.key??"",type:h.type,level:v,trail:k,...h.impl?.ref?{ref:h.impl.ref}:{}},score:w,depth:k.length})}for(let{annotation:h,level:v}of l?[]:e.annotations.values()){let g=b$(h.text??""),m=g.toLowerCase();if(!s.every(k=>m.includes(k)))continue;let b=mh(e,v),w=g.split(`
|
|
166
|
+
`)[0]??"";p.push({found:{id:h.id,title:w.length>60?`${w.slice(0,59)}\u2026`:w,key:h.key??"",type:"task",level:v,trail:b,annotation:h.kind??"note"},score:m.startsWith(f)?3:4,depth:b.length})}return p.sort((h,v)=>h.score-v.score||h.depth-v.depth||h.found.title.localeCompare(v.found.title)).slice(0,n).map(h=>h.found)}var s6={in:"Hosts arrive here",ok_hosts:"Hosts this step succeeded on continue here",failed_hosts:"Hosts that failed this step continue here",unreachable:"Hosts this step could not reach continue here",unchanged:"Hosts this step succeeded on without changing anything continue here",always:"Every host continues here after this step, whatever happened",timeout:"Hosts that ran out of time continue here",true:"Hosts the condition is true for continue here",false:"Hosts the condition is false for continue here",approved:"Hosts a person approved continue here",rejected:"Hosts a person rejected continue here"};function ka(e,t){return e==="timeout"&&t==="approval"?"Hosts with no answer in time continue here":e==="failed_hosts"&&t==="join"?"Hosts that failed on a branch continue here":/^branch_[0-9]+$/.test(e)?"Every host goes down each branch":s6[e]}var l6=["in","ok_hosts","failed_hosts","unreachable","always"],d6={impl:"binding",inputs:"io",outputs:"io",settings:"execution",ports:"ports"};function x$(e,t,n){return e.filter(r=>r.node===t).map(r=>{let a=r.path.length>n.length&&n.every((p,h)=>r.path[h]===p)?r.path.slice(n.length).map(String):[],s=a[0],l=r.port?"ports":s&&d6[s]||"general",f=s==="settings"&&a[1]?`settings.${a[1]}`:s;return{finding:r,tab:l,...f?{field:f}:{}}})}function tl(e,t){return e.find(n=>n.field===t)?.finding.message}var u6=new Set(["open-fail-port"]),c6=4;function f6(e,t){let n=new Map,r=new Map,a=l=>{let f=n.get(l);return f||(f={errors:0,warnings:0,inside:0,severity:"warning",title:""},n.set(l,f)),f},s=t.filter(l=>l.node&&l.severity!=="info"&&!u6.has(l.code)).sort((l,f)=>+(f.severity==="error")-+(l.severity==="error"));for(let l of s){let f=e.nodes.get(l.node);if(!f)continue;let p=a(f.node.id);l.severity==="error"?(p.errors++,p.severity="error"):p.warnings++,p.tab??=x$([l],f.node.id,f.path)[0]?.tab,r.set(f.node.id,[...r.get(f.node.id)??[],l.message]);for(let h=f.level;e.nodes.has(h);h=e.nodes.get(h)?.level){let v=a(h);v.inside++,l.severity==="error"&&(v.severity="error")}}for(let[l,f]of n){let p=r.get(l)??[],h=p.slice(0,c6);p.length>h.length&&h.push(`\u2026and ${p.length-h.length} more`),f.inside>0&&h.push(`${f.inside} problem${f.inside===1?"":"s"} in the steps inside`),f.title=h.join(`
|
|
167
|
+
`)}return n}function my(e){return e.type==="subflow"||!!e.impl?.ref}function w$(e){if(!e?.ref)return;let t=e.params?.tasks_from?` \xB7 ${e.params.tasks_from}`:"";return`${e.kind} ${e.ref}${e.collection_version?` ${e.collection_version}`:""}${t}`}function k$(e){if(!e)return[];let t=[];return typeof e.retries=="string"?t.push(`${e.until?"poll":"retry"} (${I0(e.retries)??"at run time"})`):e.retries?t.push(e.until?`poll \xD7${e.retries+1}`:`retry \xD7${e.retries}`):e.until&&t.push("poll"),e.serial!==void 0&&t.push(`serial ${e.serial}`),e.timeout&&t.push(`timeout ${e.timeout}`),e.max_fail_percentage!==void 0&&t.push(`max fail ${e.max_fail_percentage}%`),e.become&&t.push("become"),e.credential&&t.push(`credential ${e.credential}`),e.execution_environment&&t.push(`EE ${e.execution_environment}`),t}function S$(e,t){let n=e?.state==="done"?e.summary?.nodes[t]:void 0;if(n)return Object.entries(n).map(([r,a])=>r==="ok_hosts"||a.length>3?`${r} ${a.length}`:`${r} ${a.length} (${a.join(", ")})`).join(" \xB7 ")}function h6(e,t){let n=new Map(e.map((l,f)=>[l.id,f])),r=new Map(e.map(l=>[l.id,0]));for(let l of t)n.has(l.to.node)&&r.set(l.to.node,(r.get(l.to.node)??0)+1);let a=e.filter(l=>r.get(l.id)===0),s=[];for(;a.length>0;){a.sort((f,p)=>(n.get(f.id)??0)-(n.get(p.id)??0));let l=a.shift();s.push(l);for(let f of t){if(f.from.node!==l.id||!n.has(f.to.node))continue;let p=(r.get(f.to.node)??0)-1;r.set(f.to.node,p),p===0&&a.push(e[n.get(f.to.node)??0])}}for(let l of e)s.includes(l)||s.push(l);return s}function p6(e,t,n){let r=$e(e).nodes.get(t)?.node;if(!r||!my(r))return;let a=(r.subflow?.nodes??[]).filter(h=>!!h?.id),s=r.subflow?.boundary,l=new Map;for(let[h,v]of Object.entries(s?.outputs??{}))for(let g of v??[])g?.node&&l.set(g.node,[...l.get(g.node)??[],{port:h,reason:g.reason}]);let f=h6(a,(r.subflow?.edges??[]).filter(h=>h?.from&&h.to)).map(h=>({id:h.id,title:h.title,type:h.type,status:h.status,entry:s?.in===h.id,badges:[...h.impl?.ref?[h.impl.kind]:[],...h.ref?[`shared v${h.ref.version}`]:[],...k$(h.settings)],exits:l.get(h.id)??[],run:S$(n,h.id)})),p=r.type==="subflow"?a.length>0?`Subflow \xB7 ${a.length} step${a.length===1?"":"s"}`:"Subflow \xB7 no inner steps yet":`${r.type[0]?.toUpperCase()}${r.type.slice(1)}`;return{node:r,binding:w$(r.impl),subtitle:p,steps:f,undo:w$(r.undo),settings:k$(r.settings),run:S$(n,r.id),hasInner:a.length>0}}function gy(e,t){let n=e?.approvals?.[t];if(n)return{...n,label:n.status};let r=e?.awx?.approvals?.[t];if(r)return{status:r.status==="denied"?"rejected":r.status,url:r.url,label:r.status}}function N$(e){return[...new Set([...Object.keys(e?.approvals??{}),...Object.keys(e?.awx?.approvals??{})])].some(t=>gy(e,t)?.status==="waiting")}var m6={draft:"circle-large-outline",specified:"circle-large-filled",implemented:"pass",tested:"verified-filled"};function gh({status:e,label:t=!0}){let n=`Status: ${e}`;return(0,c.jsx)("span",{className:`afd-status-icon codicon codicon-${m6[e]} status-${e}`,...t?{role:"img","aria-label":n,title:n}:{"aria-hidden":!0}})}var g6={top:Ce.Top,bottom:Ce.Bottom,left:Ce.Left,right:Ce.Right},y6=e=>e.transform[2]<.45,v6=1.4,b6=e=>e.transform[2]>=v6,j$=new Set(["parallel","join"]);function C$(e,t){let n=e.getBoundingClientRect();return t==="left"?{x:n.left-8,y:n.top-8}:t==="bottom"?{x:n.left-8,y:n.bottom+8}:{x:n.right+8,y:n.top-8}}function x6({nodeId:e,type:t,port:n,focusable:r,preview:a,readOnly:s}){let l=_(m=>m.openPortMenu),f=`${Math.round(n.offset*100)}%`,p=n.side==="top"||n.side==="bottom"?{left:f}:{top:f},h=n.direction==="out",v=_(m=>m.mode!=="design")||s===!0,g=m=>{_.getState().pick||v||l({ref:{node:e,port:n.name},...C$(m,n.side)})};return(0,c.jsx)(vr,{id:n.name,type:h?"source":"target",position:g6[n.side],isConnectable:!v,isConnectableStart:h&&n.state!=="connected",isConnectableEnd:!h,className:["afd-port",`state-${n.state}`,`tone-${n.tone}`,`side-${n.side}`,n.optional?"optional":"",n.rest?"rest":"reveal"].filter(Boolean).join(" "),style:p,"data-port":n.name,"data-port-state":n.state,"data-rest":n.rest?"true":void 0,title:[n.name,ka(n.name,t),ch[n.state],"click for options"].filter(Boolean).join(" \xB7 "),"aria-label":`Port ${n.name}, ${ch[n.state]}`,role:"button","aria-haspopup":v?void 0:"menu","aria-disabled":v||void 0,tabIndex:r&&!v?0:-1,onClick:m=>g(m.currentTarget),onKeyDown:m=>{(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),m.stopPropagation(),g(m.currentTarget))},onPointerEnter:()=>_.getState().portHover(!0),onPointerLeave:m=>{let b=_.getState();b.portHover(!1);let w=m.currentTarget.closest(".react-flow__node")?.getBoundingClientRect();a&&w&&b.hoverNode(e,{left:w.left,right:w.right,top:w.top})},children:(0,c.jsx)("span",{className:"afd-port-label","aria-hidden":"true",children:n.name})})}function w6({nodeId:e,port:t,focusable:n}){let r=`${Math.round(t.offset*100)}%`;return(0,c.jsx)("button",{type:"button",className:`afd-plus afd-port-plus side-${t.side} nodrag nopan`,style:t.side==="bottom"?{left:r}:{top:r},title:`Add Next Node from ${t.name}`,"aria-label":`Add Next Node from ${t.name}`,"data-port-plus":t.name,tabIndex:n?0:-1,onPointerEnter:()=>_.getState().portHover(!0),onPointerLeave:()=>_.getState().portHover(!1),onDoubleClick:a=>a.stopPropagation(),onKeyDown:a=>{(a.key==="Enter"||a.key===" ")&&a.stopPropagation()},onClick:a=>{a.stopPropagation(),Ey({node:e,port:t.name})},children:(0,c.jsx)("span",{className:"codicon codicon-add","aria-hidden":"true"})})}var yy;function k6(e,t){if(e?.doc)return yy?.snapshot!==e&&(yy={snapshot:e,badges:f6($e(e.doc),e.findings)}),yy?.badges.get(t)}function S6({node:e,badge:t}){let n=t.errors+t.warnings,r=n+t.inside,a=`${r} problem${r===1?"":"s"}`;return(0,c.jsxs)("button",{type:"button",className:`afd-node-problem tone-${t.severity} nodrag nopan`,"data-node-problem":t.severity,title:`${t.title}
|
|
168
|
+
${n>0?"Click for the details":"Click to open the subflow"}`,"aria-label":`${a}: ${n>0?"show in Details":"open the subflow"}`,tabIndex:-1,onDoubleClick:s=>s.stopPropagation(),onClick:s=>{s.stopPropagation();let l=_.getState();n>0?l.openDetails(e.id,t.tab??"general"):l.setLevel(e.id)},children:[(0,c.jsx)("span",{className:`codicon codicon-${t.severity==="error"?"error":"warning"}`,"aria-hidden":"true"}),r>1?r:null]})}var vy=e=>`__inner:${e}`,N6={top:Ce.Bottom,bottom:Ce.Top,right:Ce.Left,left:Ce.Right},j6={top:{top:0,bottom:"auto",transform:"translate(-50%, -50%)"},bottom:{top:"auto",bottom:0,transform:"translate(-50%, 50%)"},right:{left:"auto",right:0,transform:"translate(50%, -50%)"},left:{left:0,right:"auto",transform:"translate(-50%, -50%)"}};function C6({ports:e}){return(0,c.jsx)(c.Fragment,{children:e.map(t=>{let n=`${Math.round(t.offset*100)}%`,r=t.side==="top"||t.side==="bottom"?{left:n}:{top:n};return(0,c.jsx)(vr,{id:vy(t.name),type:t.direction==="in"?"source":"target",position:N6[t.side],isConnectable:!1,className:"afd-inner-handle",style:{...j6[t.side],...r},"aria-hidden":"true"},t.name)})})}function yh({node:e}){return _(t=>t.renaming===e.id)?(0,c.jsx)($6,{node:e}):(0,c.jsx)("span",{className:"afd-node-title",children:e.title})}function $6({node:e}){let[t,n]=(0,A.useState)(e.title),r=(0,A.useRef)(null),a=(0,A.useRef)(!1);(0,A.useEffect)(()=>{r.current?.focus(),r.current?.select()},[]);let s=l=>{if(a.current)return;a.current=!0,_.getState().setRenaming(null);let f=t.trim();l&&f&&f!==e.title&&Pe({kind:"updateNode",id:e.id,patch:{title:f}}),r.current?.closest(".react-flow__node")?.focus()};return(0,c.jsx)("input",{ref:r,className:"afd-node-title afd-node-title-input nodrag nopan nokey","aria-label":"Node title",value:t,onChange:l=>n(l.target.value),onBlur:()=>s(!0),onKeyDown:l=>{l.stopPropagation(),l.key==="Enter"?s(!0):l.key==="Escape"&&s(!1)},onClick:l=>l.stopPropagation(),onDoubleClick:l=>l.stopPropagation()})}function E6({node:e}){let t=_(f=>f.drift?.nodes[e.id]),n=_(f=>f.drift?.items.find(p=>p.node===e.id&&!p.ignored&&p.severity==="warning")),r=_(f=>f.run?.state==="done"?f.run.summary:void 0);if(!t)return(0,c.jsx)("div",{className:"afd-node-sub muted",children:"not synced"});let{count:a,state:s,tone:l}=W5(e,t,n,r);return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("div",{className:"afd-node-sub mono afd-node-artifact",title:t.artifact,children:t.artifact}),(0,c.jsx)("div",{className:`afd-node-code tone-${l}`,"data-code-state":s,children:a?`${a} \xB7 ${s}`:s})]})}function _6({node:e}){let t=_(l=>l.runNodes?.[e.id]),n=_(l=>l.run?.state==="running"),r=gy(_(l=>l.run),e.id);if(r){let l=t&&t.state!=="idle"?` \xB7 ${t.hosts} host${t.hosts===1?"":"s"}`:"",f=r.status==="approved"?"ok":"warn";return(0,c.jsxs)("div",{className:`afd-node-run tone-${f}`,"data-approval":r.label,children:[r.status==="waiting"?"waiting for approval":r.label,l]})}if(!t)return(0,c.jsx)("div",{className:"afd-node-run tone-neutral",children:n?"waiting":"no run"});if(t.state==="idle")return(0,c.jsx)("div",{className:"afd-node-run tone-neutral","data-run-state":"idle",children:n?"waiting":"not reached"});if(t.state==="running"){let l=[t.hosts>0?`${t.hosts} host${t.hosts===1?"":"s"}`:""];return t.failed>0&&l.push(`${t.failed} failed`),(0,c.jsx)("div",{className:"afd-node-run tone-running","data-run-state":"running",children:["running\u2026",...l.filter(Boolean)].join(" \xB7 ")})}let a=[`${t.hosts} host${t.hosts===1?"":"s"}`];t.failed>0&&a.push(`${t.failed} failed`),t.seconds!==void 0&&a.push(Ut(t.seconds));let s=t.state==="ok"?"ok":"warn";return(0,c.jsx)("div",{className:`afd-node-run tone-${s}`,"data-run-state":t.state,children:a.join(" \xB7 ")})}function vh({id:e}){let t=_(r=>r.lens),n=_(r=>r.lensView?.chips[e]);return t?(0,c.jsx)("div",{className:`afd-chips afd-lens-chips lens-${t}`,"data-lens-chips":(n??[]).map(r=>r.text).join("|"),children:(n??[]).map(r=>(0,c.jsx)("span",{className:`afd-chip afd-lens-chip${r.tone?` tone-${r.tone}`:""}`,title:r.title,children:r.text},r.text))}):null}function A6(e){let t=_(a=>a.snapshot?.doc),n=_(a=>a.lensFacts),r=_(a=>a.run);return(0,A.useMemo)(()=>t?n5(t,e,n,r):[],[t,e,n,r])}function T6({node:e,max:t,className:n}){let r=A6(e);return r.length===0?null:(0,c.jsx)("dl",{className:n,children:r.slice(0,t).map(a=>(0,c.jsxs)(A.Fragment,{children:[(0,c.jsx)("dt",{children:a.label}),(0,c.jsx)("dd",{title:a.value,children:a.value})]},a.label))})}var M6=(0,A.memo)(function({node:e,near:t}){let n=_(p=>p.mode==="code"),r=_(p=>p.mode==="run"),a=_(p=>p.lens);if(e.type==="start"||e.type==="end"||j$.has(e.type))return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(yh,{node:e}),j$.has(e.type)?null:(0,c.jsx)(vh,{id:e.id})]});let s=e.status??"draft";if(e.disabled&&!t)return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsxs)("div",{className:"afd-node-head",children:[(0,c.jsx)(gh,{status:s}),(0,c.jsx)(yh,{node:e})]}),(0,c.jsx)(vh,{id:e.id}),(0,c.jsx)("div",{className:"afd-node-sub",title:R0(e),children:R0(e)})]});let l=(0,c.jsxs)("div",{className:"afd-node-head",children:[(0,c.jsx)(gh,{status:s}),(0,c.jsx)(yh,{node:e})]});if(t)return(0,c.jsxs)(c.Fragment,{children:[l,(0,c.jsx)(vh,{id:e.id}),(0,c.jsx)(T6,{node:e,max:a?1:3,className:"afd-node-summary"})]});if(a)return(0,c.jsxs)(c.Fragment,{children:[l,(0,c.jsx)(vh,{id:e.id})]});if(r)return(0,c.jsxs)(c.Fragment,{children:[l,(0,c.jsx)(_6,{node:e})]});if(n)return(0,c.jsxs)(c.Fragment,{children:[l,(0,c.jsx)(E6,{node:e})]});let f=R0(e);return(0,c.jsxs)(c.Fragment,{children:[l,(0,c.jsx)("div",{className:`afd-node-sub${e.impl?.ref||e.condition?" mono":""}`,title:f,children:f})]})}),O6=(0,A.memo)(function({data:e,selected:t}){let n=Ke(y6),r=Ke(b6),{node:a,ports:s}=e.view,l=e.role,f=_(O=>O.expandSubflows)&&a.type==="subflow"&&l!=="inner",p=_(O=>O.lens==="data"),h=f3(),v=(0,A.useRef)(p);(0,A.useEffect)(()=>{v.current!==p&&(v.current=p,h(a.id))},[p,a.id,h]);let g=(0,A.useRef)(l);(0,A.useEffect)(()=>{g.current!==l&&(g.current=l,h(a.id))},[l,a.id,h]);let m=_(O=>O.lens?(O.lensView?.chips[a.id]??[]).map(K=>K.text).join("|"):void 0),b=_(O=>{if(!O.highlight)return"";let K=O.snapshot?.doc,B=K?i6($e(K),O.highlight,O.level):O.highlight;return B.length===0?"":B.includes(a.id)?"lens-hit":"lens-dim"}),w=_(O=>O.portMenu?.ref.node===a.id),k=_(O=>O.pick!==null&&O.pickAt===a.id),S=_(O=>O.mode==="run"),N=_(O=>O.mode==="run"?O.runNodes?.[a.id]?.state:void 0),$=_(O=>O.outside?.nodes.includes(a.id)?"outside-mark":O.outsideAround.includes(a.id)?"outside-inside":""),j=_(O=>{let K=$==="outside-mark"&&O.outside?.changes?.find(B=>B.id===a.id);return K?`Changed outside the designer: ${ty(K)}`:void 0}),E=_(O=>k6(O.snapshot,a.id)),I=_(O=>O.mode==="design"&&!!O.snapshot?.doc&&!O.snapshot.stale&&!O.snapshot.idGaps&&!Vf(O.snapshot.doc,O.level)),z=Bf(a),T=I&&!n&&!l?s.find(O=>O.state==="open"&&z.includes(O.name)):void 0,M=[$,S?"run-mode":"",N?`run-${N}`:"","afd-node",`type-${a.type}`,`status-${a.status??"draft"}`,Od(a)?"handler":"",a.type==="end"&&a.outcome==="failed"?"outcome-failed":"",t?"selected":"",w?"active":"",k?"afd-pick-at":"",E?`has-problem problem-${E.severity}`:"",a.disabled?"disabled":"",l==="frame"?"expanded":"",l==="inner"?"inner":"",b].filter(Boolean).join(" ");return(0,c.jsxs)("div",{className:M,"data-node-id":a.id,"data-disabled":a.disabled?"true":void 0,"data-run-state":N,"data-lens":m,"data-outside":$||void 0,title:j,children:[(0,c.jsx)("div",{className:"afd-hover-zone","aria-hidden":"true"}),s.map(O=>(0,c.jsx)(x6,{nodeId:a.id,type:a.type,port:O,readOnly:l==="inner",focusable:(t||w)&&l!=="inner",preview:my(a)},O.name)),f&&!n?(0,c.jsx)("button",{type:"button",className:"afd-expand icon nodrag nopan","data-expand":l==="frame"?"open":"closed",title:l==="frame"?"Collapse: show the subflow as one step":"Expand here: show the steps inside","aria-label":l==="frame"?"Collapse the subflow":"Expand the subflow here","aria-expanded":l==="frame",tabIndex:-1,onDoubleClick:O=>O.stopPropagation(),onClick:O=>{O.stopPropagation(),_.getState().toggleExpanded(a.id)},children:(0,c.jsx)("span",{className:`codicon codicon-chevron-${l==="frame"?"up":"down"}`,"aria-hidden":"true"})}):null,E&&!n?(0,c.jsx)(S6,{node:a,badge:E}):null,l==="frame"?(0,c.jsx)(C6,{ports:s}):null,T?(0,c.jsx)(w6,{nodeId:a.id,port:T,focusable:t||w}):null,p?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(vr,{id:"__data_in",type:"target",position:Ce.Left,isConnectable:!1,className:"afd-data-handle",style:{top:"30%"}}),(0,c.jsx)(vr,{id:"__data_out",type:"source",position:Ce.Right,isConnectable:!1,className:"afd-data-handle",style:{top:"70%"}})]}):null,n?(0,c.jsx)(yh,{node:a}):(0,c.jsx)(M6,{node:a,near:r})]})}),P6=6,$$=3,D6=6;function I6(e){let t=e.query.trim().toLowerCase(),n=e.type==="task";if(!t)return n?e.used.slice(0,D6).map(h=>({kind:h.kind,ref:h.ref,label:h.ref,hint:`${h.kind}, used in this flow`})):[];let r=e.types.filter(h=>h.type!==e.type&&h.label.toLowerCase().startsWith(t)).map(h=>({kind:"type",type:h.type,label:h.label,hint:"step type"}));if(!n)return r;let a=new Set,s=h=>!a.has(h)&&!!a.add(h),l=e.used.filter(h=>h.ref.toLowerCase().includes(t)&&s(`${h.kind}:${h.ref}`)).slice(0,$$).map(h=>({kind:h.kind,ref:h.ref,label:h.ref,hint:`${h.kind}, used in this flow`})),f=e.modules.filter(h=>!h.dimmed&&s(`module:${h.fqcn}`)).slice(0,P6).map(h=>({kind:"module",ref:h.fqcn,label:h.fqcn,hint:h.short_description||"module"})),p=e.roles.filter(h=>h.toLowerCase().includes(t)&&s(`role:${h}`)).slice(0,$$).map(h=>({kind:"role",ref:h,label:h,hint:"role"}));return[...r,...l,...f,...p]}function L6(e){let t=(e.split(/[./]/).pop()??e).replace(/[_-]+/g," ").trim();return t?t.charAt(0).toUpperCase()+t.slice(1):e}function R6(e){let t=new Map;for(let{node:n}of e.nodes.values()){let r=n.impl;if(!r?.ref||r.kind!=="module"&&r.kind!=="role")continue;let a=`${r.kind}:${r.ref}`;t.delete(a),t.set(a,{kind:r.kind,ref:r.ref})}return[...t.values()].reverse()}var z6=/^(ansible\.(builtin|legacy)\.)?set_fact$/;function by(e){return!!e&&z6.test(e)}function E$(e,t){if(!t||!by(e)||!("key_value"in t))return t;let{key_value:n,...r}=t;return r}function _$(e){let t=new Set(e.flow.runtime?.credentials??[]),n=[],r=[];for(let s of zo(e.nodes)){let l=s.settings;(l?.credential||l?.execution_environment)&&(r.push(s.id),l.credential&&t.add(l.credential),l.execution_environment&&!n.includes(l.execution_environment)&&n.push(l.execution_environment))}let a=e.flow.runtime?.execution_environment??n[0];return{credentials:[...t],...a?{execution_environment:a}:{},otherEnvironments:n.filter(s=>s!==a),nodes:r}}var xy=e=>`status:tested|${e}`;function A$(e){let t={statuses:new Map,records:new Map,decisions:new Set,dropped:[]},n=new Map((e.decisions??[]).filter(a=>a?.kind==="finding_accepted").map(a=>[a.finding,a])),r=[...zo(structuredClone(e.nodes))].reverse();for(let a of r){if(!Us(a)||!a.id)continue;let s=(a.subflow?.nodes??[]).filter(h=>!!h&&Us(h)),l=s.length>0?eC(s.map(h=>h.status??"draft")):Dd(a),f=a.status??"draft",p=f==="tested"&&l==="implemented"&&s.length===0?"tested":l;if(p!==f&&t.statuses.set(a.id,p),a.status=p,p==="tested"){let h=n.get(xy(a.id));t.records.set(a.id,h?{reason:h.reason??"Marked tested by hand",...h.by?{by:h.by}:{}}:{reason:"Tested in flow format 1, before runs were recorded",flow_version:e.flow.version})}n.has(xy(a.id))&&(t.decisions.add(xy(a.id)),p!=="tested"&&t.dropped.push(a.title||a.key))}return t}var F6={from:1,notes(e){let t=A$(e),n=[],r=[...zo(e.nodes)].filter(s=>t.statuses.has(s.id)).map(s=>`${s.title} \u2192 ${t.statuses.get(s.id)}`);r.length&&n.push(`${r.length} status${r.length===1?"":"es"} follow what the nodes have (${r.slice(0,3).join(", ")}${r.length>3?", \u2026":""})`),t.records.size&&n.push(`${t.records.size} tested node${t.records.size===1?"":"s"} keep why on the node`);let a=t.dropped;return a.length&&n.push(`${a.length} node${a.length===1?"":"s"} marked tested by hand ${a.length===1?"is":"are"} not implemented, so the mark and its reason go (${a.slice(0,3).join(", ")}${a.length>3?", \u2026":""})`),e.flow.runtime?.kind&&n.push("the runtime kind is worked out from the flow"),n},apply(e){let t=A$(e.current.doc.toJS()),n=l=>Ro(e.current.doc.toJS()).nodes.get(l)?.path;for(let[l,f]of t.statuses){let p=n(l);p&&e.apply(h=>Nr(h,[...p,"status"],f,{before:j0("status")}))}for(let[l,f]of t.records){let p=n(l);p&&e.apply(h=>Nr(h,[...p,"tested"],f,{before:j0("tested")}))}let r=e.current.doc.toJS().decisions??[],a=r.map((l,f)=>l?.kind==="finding_accepted"&&t.decisions.has(l.finding)?f:-1).filter(l=>l>=0);if(a.length===r.length&&a.length>0)e.apply(l=>Bo(l,[],"decisions"));else for(let l of a.reverse())e.apply(f=>rh(f,["decisions"],l));let s=e.current.doc.toJS().flow.runtime;s?.kind!==void 0&&(Object.keys(s).length===1?e.apply(l=>Bo(l,["flow"],"runtime")):e.apply(l=>Bo(l,["flow","runtime"],"kind")))}},B6={from:1,notes(e){let t=Ws(e).filter(n=>e.decisions?.[n.index]?.kind!=="accepted").filter(n=>!(n.area==="lens"&&n.what.startsWith("status:tested|"))).length;return t?[`${t} decision${t===1?"":"s"} become one kind: accepted`]:[]},apply(e){let t=e.current.doc.toJS(),n=Ws(t).filter(r=>t.decisions?.[r.index]?.kind!=="accepted").map(r=>a=>Nr(a,["decisions",r.index],r4(r)));e.applyAll(n)}};function T$(e){return(e.subflow?.nodes??[]).reduce((t,n)=>!n||!Us(n)?t:n.type==="subflow"?t+(n.settings?.become===void 0?1+T$(n):0):t+ +(n.settings?.become===void 0),0)}var q6={from:1,notes(e){let t=[],n=[...zo(e.nodes)],r=n.filter(a=>a.impl?.keywords&&"become_user"in a.impl.keywords).length;r&&t.push(`become_user moves from task keywords to the Privilege settings (${r} node${r===1?"":"s"})`);for(let a of n){let s=a.type==="subflow"&&a.settings?.become?T$(a):0;s&&t.push(`become on ${a.title} now applies to its ${s} step${s===1?"":"s"}`)}return t},apply(e){let t=e.current.doc.toJS();for(let n of zo(t.nodes)){let r=n.impl?.keywords?.become_user;if(r===void 0)continue;let a=Ro(e.current.doc.toJS()).nodes.get(n.id)?.path;a&&(n.settings?e.apply(s=>Nr(s,[...a,"settings","become_user"],String(r))):e.apply(s=>Nr(s,[...a,"settings"],{become_user:String(r)},{before:j0("settings")})),Object.keys(n.impl?.keywords??{}).filter(s=>s!=="become_user").length?e.apply(s=>Bo(s,[...a,"impl","keywords"],"become_user")):e.apply(s=>Bo(s,[...a,"impl"],"keywords")))}}},H6={from:1,notes(e){let t=_$(e);return t.nodes.length===0?[]:[`${[t.credentials.length?`credentials ${t.credentials.join(", ")}`:"",t.execution_environment?`execution environment ${t.execution_environment}`:""].filter(Boolean).join(" and ")} move from ${t.nodes.length} node${t.nodes.length===1?"":"s"} to the flow, where Set Up AWX Template applies them`,...t.otherEnvironments.length?[`execution environment ${t.otherEnvironments.join(", ")} is dropped (one per template)`]:[]]},apply(e){let t=_$(e.current.doc.toJS());if(t.nodes.length!==0){for(let n of t.nodes){let r=Ro(e.current.doc.toJS()).nodes.get(n);if(!r)continue;let a=r.node.settings??{};if(Object.keys(a).filter(s=>s!=="credential"&&s!=="execution_environment").length===0)e.apply(s=>Bo(s,r.path,"settings"));else for(let s of["credential","execution_environment"])a[s]!==void 0&&e.apply(l=>Bo(l,[...r.path,"settings"],s))}if(t.credentials.length&&e.apply(n=>Nr(n,["flow","runtime","credentials"],t.credentials)),t.execution_environment){let n=t.execution_environment;e.apply(r=>Nr(r,["flow","runtime","execution_environment"],n))}}}},V6={from:1,notes(e){let t=[...zo(e.nodes)].filter(n=>n.handler!==void 0).length;return t?[`handler is called purpose (${t} node${t===1?"":"s"})`]:[]},apply(e){let t=e.current.doc.toJS(),n=Ro(t);for(let r of zo(t.nodes)){if(r.handler===void 0)continue;let a=n.nodes.get(r.id)?.path;a&&(r.purpose===void 0?e.apply(s=>aF(s,a,"handler","purpose")):e.apply(s=>Bo(s,a,"handler")))}}},M$=e=>!!e&&(mo.has(e.from?.port??"")||mo.has(e.to?.port??"")),K6=[F6,B6,q6,H6,V6,{from:1,notes(e){let t=Ro(e),n=[...zo(e.nodes)].filter(s=>s.ports?.some(l=>mo.has(l))).length,r=[...t.levels.values()].flatMap(s=>s.edges.filter(M$)).length;if(n+r===0)return[];let a=(s,l)=>`${s} ${l}${s===1?"":"s"}`;return[`the undo and cancelled ports go (${a(n,"node")}, ${a(r,"wire")}): they were never built; Rollback wires explicit undo steps, and undo bindings stay`]},apply(e){let t=()=>Ro(e.current.doc.toJS());for(let n of t().levels.values()){let r=n.edges.flatMap((a,s)=>M$(a)?[s]:[]).reverse();for(let a of r)e.apply(s=>rh(s,n.edgesPath,a))}for(let{node:n,path:r}of t().nodes.values()){let a=n.subflow?.boundary?.outputs??{};for(let[s,l]of Object.entries(a)){let f=[...r,"subflow","boundary","outputs"];if(mo.has(s)){e.apply(h=>Bo(h,f,s));continue}let p=Array.isArray(l)?l:[];for(let h=p.length-1;h>=0;h--)mo.has(p[h]?.port??"")&&e.apply(v=>rh(v,[...f,s],h))}}for(let{node:n,path:r}of t().nodes.values()){let a=n.ports??[];if(a.some(s=>mo.has(s)))if(a.every(s=>mo.has(s)))e.apply(s=>Bo(s,r,"ports"));else for(let s=a.length-1;s>=0;s--)mo.has(a[s])&&e.apply(l=>rh(l,[...r,"ports"],s))}}}];function W6(e,t=K6){let n=Rt(e);return t.filter(r=>r.from>=n&&r.from<2).flatMap(r=>r.notes(e))}new Set("False.None.True.and.as.assert.async.await.break.class.continue.def.del.elif.else.except.false.finally.for.from.global.if.import.in.is.lambda.none.nonlocal.not.or.pass.raise.return.true.try.while.with.yield".split("."));var U6=/^(ansible_[a-z0-9_]*|inventory_hostname(_short)?|inventory_dir|inventory_file|hostvars|groups|group_names|play_hosts|playbook_dir|role_path|role_name|omit|item|ansible_loop_var|lookup|query|q|now|range|dict|namespace|loop|afd_[a-z0-9_]*|awx_[a-z0-9_]*|tower_[a-z0-9_]*)$/;function Xd(e){let t=e.impl;return{kind:t?.kind??"module",ref:t?.ref??"",collection_version:t?.collection_version,params:structuredClone(t?.params??{}),register:t?.kind==="module"||!t?Ys(e,t):"",inputs:{},outputs:{}}}var wy=e=>e===void 0||e===""||Array.isArray(e)&&e.length===0;function O$(e){if(!e.ref.trim())return null;let t=Object.fromEntries(Object.entries(e.params).filter(([,n])=>!wy(n)));return{kind:e.kind,ref:e.ref.trim(),...e.kind==="module"&&e.collection_version?{collection_version:e.collection_version}:{},...Object.keys(t).length>0?{params:t}:{},...e.kind==="module"&&e.register?{register:e.register}:{}}}function P$(e,t){let n={...e??{}};for(let[r,a]of Object.entries(t))a===null?delete n[r]:n[r]=a;return Object.keys(n).length>0?n:void 0}function Zd(e,t){let n=O$(t),r=n&&n.kind!=="playbook"?e.impl?.keywords:void 0;return{...e,impl:n&&r?{...n,keywords:r}:n,inputs:P$(e.inputs,t.inputs),outputs:P$(e.outputs,t.outputs)}}function Y6(e,t){let n=Zd(e,Xd(e)),r=Zd(e,t);return JSON.stringify(r.impl??null)!==JSON.stringify(n.impl??null)||JSON.stringify(r.inputs??null)!==JSON.stringify(n.inputs??null)||JSON.stringify(r.outputs??null)!==JSON.stringify(n.outputs??null)}function X6(e,t){let n=O$(t),r=(a,s)=>Object.fromEntries(Object.entries(a).filter(([l,f])=>JSON.stringify(f)!==JSON.stringify(e[s]?.[l]??null)));return{kind:"setBinding",id:e.id,impl:n,inputs:r(t.inputs,"inputs"),outputs:r(t.outputs,"outputs")}}function Z6(e){return e.type==="bool"||e.type==="boolean"?"bool":e.choices&&e.choices.length>0&&e.type!=="list"?"choice":e.type==="list"&&(!e.elements||e.elements==="str")&&!e.suboptions?"list":e.type==="int"||e.type==="float"?"number":e.type==="dict"||e.type==="list"||e.type==="json"||e.suboptions?"yaml":"text"}function D$(e,t){let n=Object.entries(e??{}).map(([a,s])=>({name:a,option:s,control:Z6(s),required:!!s.required&&s.default===void 0})),r=a=>a.required||!wy(t[a.name])||(a.option.aliases??[]).some(s=>!wy(t[s]));return{shown:n.filter(r),more:n.filter(a=>!r(a))}}function G6(e,t,n=[]){let{shown:r,more:a}=D$(e,t);return{required:r.filter(s=>s.required),set:r.filter(s=>!s.required),added:n.flatMap(s=>a.filter(l=>l.name===s)),rest:a.filter(s=>!n.includes(s.name))}}function Q6(e,t){let n=t.trim().toLowerCase();if(!n)return[...e];let r=a=>{let s=a.name.toLowerCase();return s===n?0:s.startsWith(n)?1:s.includes(n)?2:(a.option.aliases??[]).some(l=>l.toLowerCase().includes(n))?3:a.option.description.toLowerCase().includes(n)?4:-1};return e.map((a,s)=>({f:a,i:s,r:r(a)})).filter(a=>a.r>=0).sort((a,s)=>a.r-s.r||a.i-s.i).map(a=>a.f)}var J6=new Set(["binding-not-in-ee","binding-removed","binding-redirect","binding-deprecated"]),e8={str:"string",string:"string",int:"integer",integer:"integer",float:"any",bool:"boolean",boolean:"boolean",list:"list",dict:"dict",complex:"dict"};function t8(e){return e8[e.type]??"any"}function n8(e,t,n){let r=t.impl;if(!r)return[{state:"missing",text:"Choose a module, role or playbook"}];let a=[],s=n.plugin;if(r.kind==="module"&&s){let l=r.params??{},f=new Set(Object.keys(l)),p=Object.entries(E$(r.ref,s.options)??{}).filter(([h,v])=>v.required&&v.default===void 0&&!f.has(h)).filter(([,h])=>!(h.aliases??[]).some(v=>f.has(v))).map(([h])=>h);a.push(p.length>0?{state:"missing",text:`Required parameters missing: ${p.join(", ")}`}:{state:"ok",text:"Required parameters set"})}for(let l of L0(r.params??{})){if(U6.test(l))continue;let f=t.inputs?.[l],p=f?.from;if(!f)a.push({state:"missing",text:`${l} is not an input of this node`});else if(p?.startsWith("flow."))a.push({state:"ok",text:`${l} comes from flow inputs`});else if(p){let h=p.split(".")[0]??"",v=[...e.nodes.values()].find(g=>g.node.key===h)?.node;a.push({state:"ok",text:`${l} comes from ${v?`"${v.title}"`:p}`})}else a.push({state:"warn",text:`${l} is an input without a source (from:)`})}if(r.kind==="module"&&s){let l=s.attributes?.check_mode?.support;l==="full"?a.push({state:"ok",text:"Supports check mode, safe in skeleton runs"}):l==="partial"?a.push({state:"warn",text:"Partial check mode support: skeleton runs may differ"}):l==="none"&&a.push({state:"warn",text:"No check mode: skeleton runs skip this task"}),s.deprecated&&a.push({state:"warn",text:`Deprecated: ${s.deprecated.why||"see the docs"}`})}return r.kind==="role"&&a.push(n.roleSpec?{state:"ok",text:"The role checks its arguments (argument_specs)"}:{state:"warn",text:"No argument_specs: variables are free-form"}),r.kind==="playbook"&&a.push(n.playbookTargets?{state:"ok",text:"Its plays target {{ afd_hosts }}, the hosts arriving here"}:{state:"warn",text:"Its plays do not target {{ afd_hosts }}: they run on their own hosts"}),a}var I$=["stdout","stdout_lines","rc","stderr","json","status","content","msg"];function o8(e){let t=(e.split(`
|
|
169
|
+
`)[0]??"").trim();return(/^(.*?[.!?])(\s|$)/.exec(t)?.[1]??t).slice(0,120)}function L$(e){let t=n=>{let r=I$.indexOf(n);return r<0?I$.length:r};return Object.entries(e??{}).filter(([n])=>/^[A-Za-z_][A-Za-z0-9_]*$/.test(n)).sort(([n],[r])=>t(n)-t(r)).map(([n,r])=>({name:n,detail:o8(String(r?.description??""))}))}function ky(e,t){if(!t.has(e))return e;let n=2;for(;t.has(`${e}_${n}`);)n++;return`${e}_${n}`}function Gd(e,t,n){let r=t.inputs??{},a=new Set(Object.keys(r)),s=new Set(Object.values(r).map(w=>w?.from)),l=e.nodes.get(t.id)?.level,f=w=>{let k=w.impl?.kind==="module"?n?.(w):void 0;return k&&k.length>0?{fields:k}:{}},p=w=>{if(!w||!l||!n)return{};let k=F0(e,t,l,"inputs",w);return k.kind!=="output"||!k.name||k.path.length>0?{}:k.node.outputs?.[k.name]?.from==="impl.register"?f(k.node):{}},h=Object.entries(r).map(([w,k])=>({name:w,label:w,detail:k?.from?`input from ${k.from}`:"node input",...p(k?.from)}));for(let[w,k]of Object.entries(e.doc.flow?.inputs??{})){let S=`flow.${w}`;if(s.has(S)||k?.type==="host_list")continue;let N=ky(w,a);a.add(N),h.push({name:N,label:S,detail:"flow input \xB7 adds a node input",field:{type:k?.type??"any",from:S}})}let v=(w,k,S,N,$={})=>{if(s.has(k))return;s.add(k);let j=ky(w,a);a.add(j),h.push({name:j,label:k,detail:S,field:{type:N,from:k},...$})},g=e.nodes.get(t.id)?.level;for(let w of g?z0(e,g):[])for(let[k,S]of Object.entries(w.inputs??{}))v(k,`${w.key}.${k}`,`input of subflow "${w.title}" \xB7 adds a node input`,S?.type??"any");let m=fC(e,t.id);for(let w of m)for(let[k,S]of Object.entries(w.outputs??{}))v(k,`${w.key}.${k}`,`output of "${w.title}" \xB7 adds a node input`,S?.type??"any",S?.from==="impl.register"?f(w):{});let b=(w,k)=>{for(let S of w.subflow?.nodes??[]){if(!S?.key)continue;let N=`${k}/${S.key}`;for(let[$,j]of Object.entries(S.outputs??{}))Object.keys(w.outputs??{}).some(E=>{let I=uC(w,E);return!!I&&"inner"in I&&I.inner.id===S.id&&I.output===$})||v($,`${N}.${$}`,`output of "${S.title}" inside "${w.title}" \xB7 lifts it to ${k.split("/")[0]}`,j?.type??"any");S.subflow&&b(S,N)}};for(let w of m)w.type==="subflow"&&b(w,w.key);for(let w of m){if(w.impl?.kind!=="module"||Object.values(w.outputs??{}).some($=>$?.from==="impl.register"))continue;let k=Ys(w),S=`${w.key}.${k}`;if(s.has(S))continue;s.add(S);let N=ky(k,a);a.add(N),h.push({name:N,label:S,detail:`result of "${w.title}" \xB7 makes it an output there`,field:{type:"dict",from:S},expose:{node:w.id,output:k},...f(w)})}return h}var Sy=new Map,r8=1;Yg(e=>{if(e.type==="catalogStatus"&&e.status.state==="ready"&&Ny.clear(),e.type!=="catalogReply")return;let t=Sy.get(e.reqId);Sy.delete(e.reqId),t&&(e.ok?t.resolve(e.result):t.reject(Error(e.error??"The catalog request failed")))});function bh(e){let t=r8++;return new Promise((n,r)=>{Sy.set(t,{resolve:n,reject:r}),je({type:"catalog",reqId:t,request:e})})}function xi(e,t,n=0){let[r,a]=(0,A.useState)({loading:!!e});return(0,A.useEffect)(()=>{if(!e){a({loading:!1});return}let s=!0;a(f=>({...f,loading:!0}));let l=setTimeout(()=>{bh(e).then(f=>s&&a({data:f,loading:!1}),f=>s&&a({error:f.message,loading:!1}))},n);return()=>{s=!1,clearTimeout(l)}},[t]),r}function i8(e){let t=[...new Set(e)].sort().join(","),[n,r]=(0,A.useState)({});return(0,A.useEffect)(()=>{let a=!0;for(let s of t?t.split(","):[])bh({op:"doc",fqcn:s}).then(l=>a&&r(f=>({...f,[s]:L$(l?.returns)})),()=>{});return()=>{a=!1}},[t]),n}var Ny=new Map;function jy(e){let t=Ny.get(e);return t||(t=bh({op:"names",type:e}).catch(()=>[]),Ny.set(e,t)),t}function a8(e=!0){let[t,n]=(0,A.useState)({});return(0,A.useEffect)(()=>{if(!e)return;let r=!0;return Promise.all([jy("filter"),jy("test"),jy("lookup")]).then(([a,s,l])=>r&&n({filters:a,tests:s,lookups:l})),()=>{r=!1}},[e]),t}function R$(e,t){let n=_(r=>r.focusRequest);(0,A.useEffect)(()=>{let r=t.current;e&&n?.field===e&&r&&(r.focus(),r.select(),_.setState({focusRequest:null}))},[e,n,t])}var s8='button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [contenteditable="true"], [tabindex]:not([tabindex="-1"])';function z$(e){return[...e?.querySelectorAll(s8)??[]].filter(t=>!t.closest("[hidden], [inert]")&&t.getAttribute("aria-hidden")!=="true")}var xh=[];function F$(e=!0){let[t]=(0,A.useState)(()=>{if(!e)return null;let n=document.activeElement;return n?.closest?.('[role="menu"]')?xh.at(-1)??n:n});(0,A.useEffect)(()=>{if(t)return xh.push(t),()=>{xh.splice(xh.lastIndexOf(t),1);let n=t;(document.activeElement===document.body||!document.activeElement)&&n.isConnected&&typeof n.focus=="function"&&n.focus()}},[t])}function nl(e){return F$(),(0,A.useLayoutEffect)(()=>{let t=setTimeout(()=>{let n=e.current;n&&!n.contains(document.activeElement)&&z$(n)[0]?.focus()},0);return()=>clearTimeout(t)},[e]),t=>{if(t.key!=="Tab")return;let n=z$(e.current),r=n[0],a=n.at(-1);if(!r||!a)return;let s=document.activeElement;t.shiftKey&&(s===r||!e.current?.contains(s))?(t.preventDefault(),a.focus()):t.shiftKey||s!==a&&e.current?.contains(s)||(t.preventDefault(),r.focus())}}function B$(e){let t=[...e.currentTarget.querySelectorAll('[role="tab"]:not([disabled])')],n=t.indexOf(document.activeElement);if(n<0)return;let r=e.key==="ArrowRight"?(n+1)%t.length:e.key==="ArrowLeft"?(n-1+t.length)%t.length:e.key==="Home"?0:e.key==="End"?t.length-1:-1;r<0||(e.preventDefault(),e.stopPropagation(),t[r]?.focus(),t[r]?.click())}function jr({id:e,summary:t,open:n=!1,defaultOpen:r=!1,lazy:a=!1,children:s}){let[l,f]=(0,A.useState)(()=>Ms().folds?.[e]??r),p=n||l;return(0,c.jsxs)("details",{className:"afd-fold","data-fold":e,open:p,onToggle:h=>{let v=h.currentTarget.open;if(v===p)return;f(v);let g=Ms();Xg({...g,folds:{...g.folds,[e]:v}})},children:[(0,c.jsx)("summary",{children:t}),p||!a?s:null]})}var Cy=["task","subflow","decision","approval","parallel","join"];function l8(){return _(e=>e.quickAdd!==null)?(0,c.jsx)(d8,{}):null}function d8(){let e=_(q=>q.quickAdd),t=_(q=>q.snapshot),n=_(q=>q.openQuickAdd),r=_(q=>q.select),[a,s]=(0,A.useState)("task"),[l,f]=(0,A.useState)(""),[p,h]=(0,A.useState)(""),[v,g]=(0,A.useState)([]),[m,b]=(0,A.useState)([]),[w,k]=(0,A.useState)(!0),[S,N]=(0,A.useState)(null),[$,j]=(0,A.useState)(!1),[E,I]=(0,A.useState)(-1),z=(0,A.useId)(),T=(0,A.useRef)(null),M=(0,A.useRef)(null),O=nl(M);(0,A.useEffect)(()=>{e&&(s(e.type),f(e.title??""),h(""),g([]),b([]),k(!0),N(null),j(!1),I(-1),setTimeout(()=>T.current?.focus(),0))},[e]);let K=(0,A.useMemo)(()=>t?.doc?$e(t.doc):void 0,[t]),B=_(q=>q.level),V=$&&!S?l.trim():"",oe=a==="task"&&!S,F=xi(oe&&V.length>=2?{op:"search",query:V,types:["module"]}:null,`quick-add:${oe?V:""}`,200),J=xi(oe&&$?{op:"roles"}:null,`quick-add-roles:${oe&&$}`),L=(0,A.useMemo)(()=>K?R6(K):[],[K]);if(!e||!K)return null;let U=K.levels.get(B),W=e.insertOn?K.edges.get(e.insertOn)?.edge:void 0,re=e.connectFrom??W?.from,le=re?K.nodes.get(re.node)?.node:void 0,pe=W?K.nodes.get(W.to.node)?.node:void 0,xe=new Set(U?.nodes.map(q=>q?.key)),Ne=o5(LC(l||yo[a]),xe),we=U?Bj(U):void 0,R=Ks({type:a}).some(q=>q.name==="failed_hosts"),Q=Object.entries(le?.outputs??{}),fe=a4.filter(q=>e.insertOn?Cy.includes(q):!e.connectFrom||q!=="start"),X=S?[]:I6({query:$?l.trim():"",type:a,types:fe.map(q=>({type:q,label:yo[q]})),modules:F.data??[],roles:(J.data??[]).map(q=>q.name),used:L}),he=E<X.length?E:-1,Z=q=>{I(-1),q.kind==="type"?(s(q.type),g([]),f(""),j(!1)):(s("task"),g([]),N({kind:q.kind,ref:q.ref}),f(L6(q.ref)),setTimeout(()=>T.current?.select(),0)),T.current?.focus()};return(0,c.jsx)("div",{className:"afd-modal-backdrop",children:(0,c.jsxs)("form",{ref:M,className:"afd-modal",role:"dialog","aria-modal":"true","aria-labelledby":"afd-qa-title",onSubmit:async q=>{if(q?.preventDefault(),!l.trim())return;let ee={};for(let Fe of m)ee[Fe]={type:le?.outputs?.[Fe]?.type??"any",from:`${le?.key}.${Fe}`};let de=_.getState().snapshot,me=de?.doc&&e.position?xa(cn(de,_.getState().optimistic,B),de.doc.layout):void 0,De=await Pe({kind:"addNode",parent:B==="root"?void 0:B,type:a,title:l.trim(),intent:p.trim()||void 0,ports:v,inputs:ee,...S&&a==="task"?{impl:S}:{},position:e.position,connectFrom:e.connectFrom,insertOn:e.insertOn,freeze:me,wireFailedTo:R&&w&&we?we.id:void 0});De.ok&&(n(null),De.created&&r({node:De.created}))},onKeyDown:q=>{O(q),q.key==="Escape"&&(q.stopPropagation(),n(null))},children:[(0,c.jsx)("h2",{id:"afd-qa-title",children:"Add Node"}),(0,c.jsx)("p",{className:"muted",children:le&&W?(0,c.jsxs)(c.Fragment,{children:["Between ",(0,c.jsx)("strong",{children:le.title})," \xB7"," ",(0,c.jsx)("span",{className:"mono",children:W.from.port})," and"," ",(0,c.jsx)("strong",{children:pe?.title})]}):le&&e.connectFrom?(0,c.jsxs)(c.Fragment,{children:["After ",(0,c.jsx)("strong",{children:le.title}),", from port"," ",(0,c.jsx)("span",{className:"mono",children:e.connectFrom.port})]}):"New draft node on the canvas"}),(0,c.jsx)("fieldset",{className:"afd-type-picker","aria-label":"Node type",children:fe.map(q=>(0,c.jsx)("button",{type:"button","aria-pressed":a===q,className:a===q?"active":"",onClick:()=>{s(q),g([]),q!=="task"&&N(null)},children:yo[q]},q))}),(0,c.jsxs)("div",{className:"afd-field",children:[(0,c.jsx)("label",{htmlFor:"afd-qa-name",children:"Title"}),(0,c.jsx)("input",{id:"afd-qa-name",ref:T,className:"afd-input",value:l,placeholder:a==="task"?"A name, or a module or role to find":"e.g. Check NTP",role:"combobox","aria-expanded":X.length>0,"aria-controls":z,"aria-autocomplete":"list","aria-activedescendant":he>=0?`${z}-${he}`:void 0,autoComplete:"off",onChange:q=>{f(q.target.value),j(!0),I(-1)},onKeyDown:q=>{if(X.length!==0)if(q.key==="ArrowDown"||q.key==="ArrowUp"){q.preventDefault();let ee=q.key==="ArrowDown"?1:-1,de=he+ee;I(de>=X.length||de<-1?-1:de)}else q.key==="Enter"&&he>=0&&(q.preventDefault(),Z(X[he]))}}),S?(0,c.jsxs)("div",{className:"afd-qa-bound","data-bound":S.ref,children:[(0,c.jsxs)("span",{className:"muted",children:["Runs ",S.kind]})," ",(0,c.jsx)("span",{className:"mono",children:S.ref}),(0,c.jsx)("button",{type:"button",className:"icon","aria-label":`Do not bind to ${S.ref}`,title:"Add the step without a binding",onClick:()=>{N(null),T.current?.focus()},children:(0,c.jsx)("span",{className:"codicon codicon-close","aria-hidden":"true"})})]}):null,X.length>0?(0,c.jsx)("div",{className:"afd-qa-list",id:z,role:"listbox","aria-label":"Matching steps",children:X.map((q,ee)=>(0,c.jsxs)("div",{id:`${z}-${ee}`,role:"option","aria-selected":ee===he,className:ee===he?"active":"",onMouseDown:de=>de.preventDefault(),onClick:()=>Z(q),children:[(0,c.jsx)("span",{className:"afd-qa-what mono",children:q.label}),(0,c.jsx)("span",{className:"afd-qa-why muted",title:q.hint,children:q.hint})]},`${q.kind}:${q.kind==="type"?q.type:q.ref}`))}):null,(0,c.jsxs)("div",{className:"muted mono afd-key-preview",title:"The step's name in the file and in the generated code; its ID is made when you add it",children:["Key: ",Ne]})]}),a!=="start"&&a!=="end"?(0,c.jsxs)("div",{className:"afd-field",children:[(0,c.jsx)("label",{htmlFor:"afd-qa-intent",children:"Intent (optional)"}),(0,c.jsx)("textarea",{id:"afd-qa-intent",className:"afd-input",rows:2,value:p,placeholder:"One sentence on what the step does: a skeleton run prints it",onChange:q=>h(q.target.value)})]}):null,Q.length>0?(0,c.jsxs)("fieldset",{className:"afd-fieldset",children:[(0,c.jsxs)("legend",{children:["Inputs from ",le?.title]}),Q.map(([q,ee])=>(0,c.jsxs)("label",{className:"afd-check",children:[(0,c.jsx)("input",{type:"checkbox",checked:m.includes(q),onChange:de=>b(me=>de.target.checked?[...me,q]:me.filter(De=>De!==q))}),(0,c.jsx)("span",{className:"mono",children:q})," ",(0,c.jsx)("span",{className:"muted",children:ee?.type})]},q))]}):null,Mj(a).length>0?(0,c.jsx)(jr,{id:"quick-add-ports",open:v.length>0,summary:`Extra ports (optional)${v.length?`: ${v.join(", ")}`:""}`,children:Mj(a).map(q=>(0,c.jsxs)("label",{className:"afd-check",children:[(0,c.jsx)("input",{type:"checkbox",checked:v.includes(q),onChange:ee=>g(de=>ee.target.checked?[...de,q]:de.filter(me=>me!==q))}),(0,c.jsx)("span",{className:"mono",children:q})," ",(0,c.jsx)("span",{className:"muted",children:ka(q,a)})]},q))}):null,R&&we?(0,c.jsxs)("label",{className:"afd-check",children:[(0,c.jsx)("input",{type:"checkbox",checked:w,onChange:q=>k(q.target.checked)}),"Wire ",(0,c.jsx)("span",{className:"mono",children:"failed_hosts"})," to ",(0,c.jsx)("strong",{children:we.title})]}):null,(0,c.jsxs)("div",{className:"afd-modal-actions",children:[(0,c.jsx)("button",{type:"button",className:"secondary",onClick:()=>n(null),children:"Cancel"}),(0,c.jsxs)("button",{type:"submit",disabled:!l.trim(),children:["Add ",yo[a]]})]})]})})}function wh(){let{snapshot:e,optimistic:t}=_.getState();if(!e?.doc)return;let n=cn(e,t,_.getState().level);return{doc:e.doc,view:n,freeze:xa(n,e.doc.layout)}}async function q$(e,t){let n=wh();if(!n)return;let r=await Pe({kind:"applyPattern",pattern:e,from:t,position:iy(n.view,t.node,t.port),freeze:n.freeze});r.ok&&r.created&&_.getState().select({node:r.created})}async function H$(e,t,n){let r=_.getState().snapshot?.doc;if(!r)return;let a=A4($e(r),t,e,n);a?await q$(e,{node:t,port:a}):_.getState().setError("This node has no open port this pattern fits")}function $y(e){let t=wh(),n=t?.view.edges.find(l=>l.id===e),r=t?.view.nodes.find(l=>l.node.id===n?.source),a=t?.view.nodes.find(l=>l.node.id===n?.target);if(!t||!r||!a)return;let s={x:(r.position.x+a.position.x)/2+40,y:(r.position.y+a.position.y)/2};return QC(t.view,s,{width:r.width,height:r.height})}async function ol(e,t){let n=_.getState();switch(n.openPortMenu(null),e.kind){case"pattern":await q$(e.pattern,t);return;case"quickAdd":{let r=wh();n.openQuickAdd({type:"task",connectFrom:t,title:e.title,position:r?iy(r.view,t.node,t.port):void 0});return}case"insert":n.openQuickAdd({type:"task",insertOn:e.edge,position:$y(e.edge)});return;case"pick":n.setPick({mode:e.mode,ref:t,edge:e.edge});return;case"disconnect":await Pe({kind:"disconnect",edge:e.edge});return;case"decide":n.setDecide(t);return;case"reopen":await Pe({kind:"clearDecision",node:t.node,port:t.port});return;case"enable":case"disable":await Pe({kind:"setPortEnabled",node:t.node,port:t.port,enabled:e.kind==="enable"});return;case"later":return}}function u8(e){let t=_.getState(),n=t.snapshot?.doc?$e(t.snapshot.doc).edges.get(e)?.edge.from.node:"",r=!!n&&n in(t.snapshot?.autoPositions??{});t.openQuickAdd({type:"task",insertOn:e,...r?{}:{position:$y(e)}})}async function c8(e,t,n){let r=_.getState(),a=r.snapshot?.doc,s=a?$e(a).edges.get(e)?.edge:void 0;if(!a||!s)return;if(!n){await Pe({kind:"disconnect",edge:e});return}if(t==="target"){let p=n.port&&qf(n.port)==="in"?n.port:"in";if(s.to.node===n.node&&s.to.port===p)return;await Pe({kind:"rewire",edge:e,to:{node:n.node,port:p}});return}let l=Gf($e(a),n.node),f=n.port&&qf(n.port)==="out"?n.port:s.from.node===n.node?s.from.port:l&&!l.insertOn?l.port:void 0;f?(s.from.node!==n.node||s.from.port!==f)&&await Pe({kind:"rewireFrom",edge:e,from:{node:n.node,port:f}}):r.setError("That node has no open output to wire from")}async function V$(e){let{pick:t,snapshot:n,setPick:r,setError:a}=_.getState();if(t&&n?.doc)switch(r(null),t.mode){case"to":await Pe({kind:"connect",from:t.ref,to:{node:e,port:"in"}});return;case"rewire":t.edge&&await Pe({kind:"rewire",edge:t.edge,to:{node:e,port:"in"}});return;case"attach":await V5(t.ref.node,e);return;case"from":{let s=sC($e(n.doc),e);if(!s){a("That node has no free output to wire from");return}await Pe({kind:"connect",from:{node:e,port:s},to:t.ref});return}}}function Ey(e,t){let n=e.node in(_.getState().snapshot?.autoPositions??{});t&&n?_.getState().openQuickAdd({type:"task",insertOn:t}):ol(t?{kind:"insert",label:"Add Next Node",edge:t}:{kind:"quickAdd",label:"Add Next Node"},e)}function _y(e){let t=_.getState(),n=t.snapshot?.doc;if(!n)return;let r=e??t.selection.node,a=r?Gf($e(n),r):void 0;if(r&&a)Ey({node:r,port:a.port},a.insertOn);else{let s=dy();t.openQuickAdd({type:"task",...s?{position:s}:{}})}}function f8(e){let t=_.getState(),n=t.snapshot?.doc;if(!n||!Cy.includes(e))return!1;let r=$e(n),a=r.levels.get(t.level)?.nodes??[],s=a.every(h=>h.type==="start"||h.type==="end"),l=t.selection.node??(s?a.find(h=>h.type==="start")?.id:void 0),f=l?Gf(r,l):void 0;if(!l||!f)return!1;let p=l in(t.snapshot?.autoPositions??{});if(f.insertOn)t.openQuickAdd({type:e,insertOn:f.insertOn,...p?{}:{position:$y(f.insertOn)}});else{let h=wh();t.openQuickAdd({type:e,connectFrom:{node:l,port:f.port},position:h?iy(h.view,l,f.port):void 0})}return!0}function K$(e){_.getState().reveal(e.node),setTimeout(()=>{let t=document.querySelector(`.react-flow__node[data-id="${e.node}"] [data-port="${e.port}"]`);t&&_.getState().openPortMenu({ref:e,...C$(t,"right")})},300)}function h8(e){return e.every(t=>t.node.type==="start"||t.node.type==="end")}function W$(){let e=ph(),t=_(r=>r.mode==="design"),n=_(()=>Yt());return t&&n&&h8(e.nodes)}function p8({at:e}){let t=ph(),n=_(l=>l.level);if(!W$())return null;let r=t.nodes.find(l=>l.node.type==="start")?.node.id,a=()=>_y(r),s=n===on;return(0,c.jsxs)("section",{className:"afd-empty-level nodrag nopan","aria-label":"Start this level","data-empty-level":!0,style:{transform:`translate(${e.x}px, ${e.y}px)`,width:Xj.width},children:[(0,c.jsx)("h2",{children:s?"Start with a Step":"This subflow has no steps yet"}),(0,c.jsx)("p",{className:"muted",children:s?"Add the first step after Start, then wire what happens when it fails. Or begin from what you already have.":"Add the first step; the wires into and out of the frame lead to it."}),(0,c.jsxs)("div",{className:"afd-empty-actions",children:[(0,c.jsxs)("button",{type:"button",onClick:a,children:[(0,c.jsx)("span",{className:"codicon codicon-add","aria-hidden":"true"})," Add a Step"," ",(0,c.jsx)("kbd",{className:"afd-menu-key",children:"N"})]}),s?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("button",{type:"button",className:"secondary",onClick:()=>je({type:"startFrom",what:"playbooks"}),children:"Import Ansible Playbooks\u2026"}),(0,c.jsx)("button",{type:"button",className:"secondary",onClick:()=>je({type:"startFrom",what:"awx"}),children:"Import AWX Workflow or Job Template\u2026"}),(0,c.jsx)("button",{type:"button",className:"secondary",onClick:()=>je({type:"startFrom",what:"sample"}),children:"Open Sample Flow\u2026"})]}):null]}),s?(0,c.jsxs)("p",{className:"muted",children:["New here?"," ",(0,c.jsx)("button",{type:"button",className:"link",onClick:()=>je({type:"startFrom",what:"tour"}),children:"Get Started"})," ","walks you through a first flow."]}):null]})}var m8={note:"Note",section:"Section",text:"Text"},Qd=50;function g8(){return _(e=>e.find)?(0,c.jsx)(y8,{}):null}function y8(){let e=hh(),t=_(k=>k.findQuery),n=_(k=>k.findNonce),r=(0,A.useRef)(null),a=_(k=>k.snapshot?.findings),s=_(k=>k.snapshot?.openPorts),l=(0,A.useMemo)(()=>e?a6(e,t,Qd,{findings:a,openPorts:s}):[],[e,t,a,s]),f=e6(t),p=t.trim()&&l.length?Z5(t,l.length)?.replace(/^\d+/,l.length===Qd?`${Qd}+`:String(l.length)):void 0,h=k=>{let S=t.replace(/\S*$/,"");_.getState().setFindQuery(`${S}${k}${k.endsWith(":")?"":" "}`),g(0),r.current?.focus()},[v,g]=(0,A.useState)(()=>Math.max(0,l.findIndex(k=>k.id===_.getState().selection.node)));(0,A.useEffect)(()=>{r.current?.focus(),r.current?.select()},[n]);let m=k=>{let S=l[k];S&&(g(k),_.getState().reveal(S.id))},b=()=>{let k=_.getState().selection.node;_.getState().openFind(!1),setTimeout(()=>document.querySelector(`.react-flow__node[data-id="${k}"]`)?.focus())},w=l[v];return(0,c.jsxs)("search",{className:"afd-find nodrag nopan nowheel","data-find":l.length,children:[(0,c.jsxs)("div",{className:"afd-find-row",children:[(0,c.jsx)("span",{className:"codicon codicon-search","aria-hidden":"true"}),(0,c.jsx)("input",{ref:r,className:"afd-input",role:"combobox","aria-label":"Find a node","aria-expanded":l.length>0,"aria-controls":"afd-find-results","aria-autocomplete":"list","aria-activedescendant":w?`afd-find-${w.id}`:void 0,placeholder:"Title, key or module; status:draft, type:approval\u2026",value:t,onChange:k=>{_.getState().setFindQuery(k.target.value),g(0)},onKeyDown:k=>{if(k.key==="ArrowDown"||k.key==="ArrowUp"){k.preventDefault();let S=k.key==="ArrowDown"?1:-1;l.length&&g((v+S+l.length)%l.length)}else k.key==="Enter"?(k.preventDefault(),m(k.shiftKey?(v-1+l.length)%l.length:v)):k.key==="Escape"&&(k.preventDefault(),k.stopPropagation(),b())}}),(0,c.jsx)("span",{className:"muted afd-find-count","aria-live":"polite",children:t.trim()?`${l.length===Qd?`${Qd}+`:l.length} found`:"every level"}),(0,c.jsx)("button",{type:"button",className:"icon","aria-label":"Close Find",title:"Close (Esc)",onClick:b,children:(0,c.jsx)("span",{className:"codicon codicon-close","aria-hidden":"true"})})]}),!t.trim()||f.length?(0,c.jsx)("div",{className:"afd-find-hints muted","data-find-hints":!0,children:(f.length?f:["has:no-binding","type:approval","open:fail","has:errors","status:draft"]).map(k=>(0,c.jsx)("button",{type:"button",className:"chip-button mono",title:Y5[k],onMouseDown:S=>S.preventDefault(),onClick:()=>h(k),children:k},k))}):null,p?(0,c.jsx)("p",{className:"muted afd-find-summary","data-find-summary":!0,children:p}):null,t.trim()&&l.length?(0,c.jsx)("div",{id:"afd-find-results",role:"listbox","aria-label":"Nodes found",className:"afd-find-results",children:l.map((k,S)=>(0,c.jsxs)("div",{id:`afd-find-${k.id}`,role:"option","aria-selected":S===v,className:S===v?"active":"","data-found":k.id,onMouseDown:N=>N.preventDefault(),onClick:()=>m(S),children:[(0,c.jsx)("span",{className:"afd-find-title",children:k.title}),(0,c.jsxs)("span",{className:"muted",children:[[...k.trail,k.annotation?m8[k.annotation]:yo[k.type]].join(" \u203A "),k.ref?` \xB7 ${k.ref}`:""]})]},k.id))}):null]})}function U$(e){return(e.nodes??[]).filter(t=>t&&t.type!=="start"&&t.type!=="end").length}function v8(e,t,n){let r=U$(e);return[{id:"step",label:"Add a step",detail:"Add a Step (N) puts one between Start and Done.",done:r>0},{id:"code",label:"See the playbook it makes",detail:"One play per step, in generated/. Peek Code shows a step's play.",done:n.includes("codeSeen")},{id:"failure",label:"Decide what happens when it fails",detail:"A fail port needs a handler, or a reason to stay open.",done:r>0&&t===0},{id:"run",label:"Run it as a skeleton",detail:"Steps without code print TODO. It needs an Ansible environment.",done:n.includes("skeletonRun")}]}function b8(e){let t=U$(e);return t>=1&&t<=5}function Ay(e){_.getState().setRunAsked(!0),je({type:"run",mode:e})}function x8(e,t){_.getState().setRunAsked(!0),je({type:"runPartial",node:e,only:t})}function w8(e){je({type:"showRun",id:e})}function Y$(){return _(e=>!!e.snapshot?.doc&&!!e.firstFlow&&!e.firstFlow.hidden&&e.mode==="design"&&e.level==="root"&&Yt()&&b8(e.snapshot.doc))}function k8(){let e=_(h=>h.snapshot),t=_(h=>h.firstFlow),n=Y$(),r=e?.doc;if(!r||!t||!n)return null;let a=v8(r,e.openPorts.length,t.done),s=a.filter(h=>h.done).length,l=()=>je({type:"firstFlow",hidden:!0}),f=(r.nodes??[]).find(h=>h&&h.type!=="start"&&h.type!=="end"),p=h=>{let v=_.getState();h==="step"?_y((r.nodes??[]).find(g=>g?.type==="start")?.id):h==="code"&&f?(v.select({node:f.id}),je({type:"peekCode",node:f.id})):h==="failure"&&e.openPorts[0]?K$(e.openPorts[0]):h==="run"&&Ay("check")};return(0,c.jsxs)("details",{className:"afd-first-flow nodrag nopan",open:!0,"data-first-flow":s,children:[(0,c.jsxs)("summary",{children:["Your first flow \xB7 ",s," of ",a.length]}),s===a.length?(0,c.jsxs)("p",{children:["Your first flow is done. Next:"," ",(0,c.jsx)("button",{type:"button",className:"link",onClick:()=>je({type:"openGuide",page:"tutorials/02-design-to-production.md"}),children:"Tutorial 2"}),"."]}):(0,c.jsx)("ol",{children:a.map(h=>(0,c.jsxs)("li",{className:h.done?"done":"",children:[(0,c.jsx)("span",{className:`codicon codicon-${h.done?"pass-filled":"circle-large-outline"}`,"aria-hidden":"true"}),(0,c.jsxs)("span",{children:[(0,c.jsx)("strong",{children:h.label}),h.done?null:(0,c.jsxs)("span",{className:"muted",children:[" ",h.detail]})," ",h.done||h.id!=="step"&&!f?null:(0,c.jsx)("button",{type:"button",className:"link","aria-label":`Show me: ${h.label}`,onClick:()=>p(h.id),children:"Show Me"})]})]},h.id))}),(0,c.jsx)("button",{type:"button",className:"link",onClick:l,children:"Hide Checklist"})]})}var Ty=e=>({x:e.x+e.width/2,y:e.y+e.height/2});function X$(e,t){let n=Ty(e),r=t.x-n.x,a=t.y-n.y;if(r===0&&a===0)return n;let s=Math.min(r===0?1/0:e.width/2/Math.abs(r),a===0?1/0:e.height/2/Math.abs(a));return{x:n.x+r*s,y:n.y+a*s}}var S8=(e,t)=>e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y;function N8(e,t){if(!S8(e,t))return{from:X$(e,Ty(t)),to:X$(t,Ty(e))}}function j8(e,t){e.preventDefault(),e.stopPropagation(),je({type:"openLink",url:t})}function Z$({parts:e}){return(0,c.jsx)(c.Fragment,{children:e.map((t,n)=>{let r=`${n}-${t.kind}`,a=t.text.split(`
|
|
170
|
+
`).map((s,l)=>(0,c.jsxs)(A.Fragment,{children:[l>0?(0,c.jsx)("br",{}):null,s]},l));return t.kind==="bold"?(0,c.jsx)("strong",{children:a},r):t.kind==="italic"?(0,c.jsx)("em",{children:a},r):t.kind==="code"?(0,c.jsx)("code",{children:t.text},r):t.kind==="link"?(0,c.jsx)("a",{href:t.href,className:"nodrag",title:t.href,onClick:s=>j8(s,t.href),onDoubleClick:s=>s.stopPropagation(),children:t.text},r):(0,c.jsx)(A.Fragment,{children:a},r)})})}function G$({text:e}){return(0,c.jsx)(c.Fragment,{children:y$(e).map((t,n)=>t.kind==="para"?(0,c.jsx)("p",{children:(0,c.jsx)(Z$,{parts:t.parts})},n):(0,c.jsx)("ul",{children:t.items.map((r,a)=>(0,c.jsx)("li",{children:(0,c.jsx)(Z$,{parts:r})},a))},n))})}var C8={note:"Note",section:"Section",text:"Text"};function $8(e){let t=b$(e.annotation.text).split(`
|
|
171
|
+
`)[0]??"";return`${C8[e.kind]}: ${t.slice(0,80)||"(empty)"}`}function Q$({id:e,text:t,done:n}){let[r,a]=(0,A.useState)(t),s=(0,A.useRef)(null),l=(0,A.useRef)(!1);(0,A.useEffect)(()=>{s.current?.focus(),s.current?.select()},[]);let f=()=>{l.current||(l.current=!0,r!==t&&Pe({kind:"updateAnnotation",id:e,patch:{text:r}}),n())};return(0,c.jsx)("textarea",{ref:s,className:"afd-annotation-editor nodrag nopan nowheel","aria-label":"Annotation text (Markdown); Ctrl+Enter saves, Escape cancels",value:r,onChange:p=>a(p.target.value),onBlur:f,onKeyDown:p=>{p.key==="Escape"?(p.preventDefault(),p.stopPropagation(),l.current=!0,n()):p.key==="Enter"&&(p.ctrlKey||p.metaKey)&&(p.preventDefault(),f()),p.stopPropagation()}})}var E8=(0,A.memo)(function({id:e,data:t,selected:n,parentId:r,positionAbsoluteX:a,positionAbsoluteY:s,width:l,height:f}){let{view:p,editable:h}=t,v=p.annotation,g=_(E=>E.editingAnnotation===e),m=_(E=>E.editAnnotation),b=h3(r??""),w=l??p.width,k=f??p.height,S;if(r&&b?.measured.width&&b.measured.height){let E={x:a-b.internals.positionAbsolute.x,y:s-b.internals.positionAbsolute.y},I=N8({...E,width:w,height:k},{x:0,y:0,width:b.measured.width,height:b.measured.height});S=I&&{from:{x:I.from.x-E.x,y:I.from.y-E.y},to:{x:I.to.x-E.x,y:I.to.y-E.y}}}let N=["afd-annotation",`afd-kind-${p.kind}`,`color-${v.color??(p.kind==="note"?"yellow":"gray")}`,p.kind==="text"?`size-${v.size??"m"}`:"",n?"selected":""].filter(Boolean).join(" "),$=()=>m(null),j=g?(0,c.jsx)(Q$,{id:e,text:v.text,done:$}):(0,c.jsx)("div",{className:"afd-annotation-text",children:(0,c.jsx)(G$,{text:v.text})});return(0,c.jsxs)("div",{className:N,"data-annotation-id":v.id,"data-annotation-kind":p.kind,style:{width:w,height:k},children:[n&&h&&!g?(0,c.jsx)(H3,{minWidth:40,minHeight:24,color:"var(--afd-accent)",onResizeEnd:(E,I)=>{Pe({kind:"updateAnnotation",id:e,patch:{x:Math.round(I.x),y:Math.round(I.y),width:Math.round(I.width),height:Math.round(I.height)}})}}):null,S?(0,c.jsx)("svg",{className:"afd-tie","aria-hidden":"true",overflow:"visible",width:"1",height:"1",children:(0,c.jsx)("line",{x1:S.from.x,y1:S.from.y,x2:S.to.x,y2:S.to.y})}):null,p.kind==="section"?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsxs)("div",{className:"afd-annotation-title",title:g?void 0:"Drag to move the section and what is inside it",children:[(0,c.jsx)("span",{className:"afd-annotation-grip codicon codicon-gripper","aria-hidden":"true"}),(0,c.jsx)("div",{className:"afd-annotation-title-text",children:g?(0,c.jsx)(Q$,{id:e,text:v.text,done:$}):(0,c.jsx)(G$,{text:v.text})})]}),(0,c.jsx)("div",{className:"afd-annotation-body"})]}):j]})}),_8={top:Ce.Bottom,bottom:Ce.Top,right:Ce.Left},A8={top:{top:0,bottom:"auto",transform:"translate(-50%, -50%)"},bottom:{top:"auto",bottom:0,transform:"translate(-50%, 50%)"},right:{left:"auto",right:0,transform:"translate(50%, -50%)"}},J$={connected:"an inner step leaves through it",bubbled:"fed by inner fail ports that bubble up",unfed:"no inner step leads here",available:"optional; wiring an exit here enables it on the subflow"};function T8({port:e}){let t=`${e.offset*100}%`,n={...A8[e.side],...e.side==="right"?{top:t}:{left:t}},r=e.name==="in"?e.state==="connected"?"in: hosts entering the subflow start at the entry step":"in: no entry step yet; drag from here to an inner step":`${e.name}: ${J$[e.state]}`;return(0,c.jsx)(vr,{id:e.name,type:e.name==="in"?"source":"target",position:_8[e.side],style:n,className:`afd-frame-port state-${e.state} tone-${e.tone} side-${e.side}`,"data-frame-port":e.name,"data-port-state":e.state,title:r,"aria-label":`Subflow port ${e.name}, ${J$[e.state]??e.state}`,children:(0,c.jsx)("span",{className:"afd-frame-label",children:e.name})})}function M8({data:e}){let{boundary:t,empty:n}=e;return(0,c.jsxs)("div",{className:"afd-frame","data-frame":t.subflow.id,children:[(0,c.jsxs)("span",{className:"afd-frame-title",children:["Subflow boundary \xB7 ",t.subflow.title]}),n?(0,c.jsx)("p",{className:"afd-frame-empty",children:"No steps yet."}):null,t.ports.map(r=>(0,c.jsx)(T8,{port:r},r.name))]})}var O8=(0,A.memo)(M8);function P8({data:e}){let{ghost:t}=e;return(0,c.jsxs)("div",{className:"afd-ghost","data-ghost":t.id,title:"Removed since the compared version",children:[(0,c.jsx)("div",{className:"afd-ghost-title",children:t.title}),(0,c.jsxs)("div",{className:"afd-ghost-sub",children:[yo[t.type]," \xB7 removed"]})]})}var kh=20,D8=5,rl=25,wi=8,My=40,I8=1,Sh=[{x:0,y:-1},{x:1,y:0},{x:0,y:1},{x:-1,y:0}],eE={[Ce.Top]:0,[Ce.Right]:1,[Ce.Bottom]:2,[Ce.Left]:3};function L8(e){let t=e.match(/-?\d+(\.\d+)?(e-?\d+)?/g)?.map(Number)??[],n=[];for(let r=0;r+1<t.length;r+=2)n.push({x:t[r],y:t[r+1]});return n}var Oy=(e,t)=>e.x<t.x+t.width&&t.x<e.x+e.width&&e.y<t.y+t.height&&t.y<e.y+e.height,R8=(e,t)=>({x:e.x+t,y:e.y+t,width:Math.max(0,e.width-2*t),height:Math.max(0,e.height-2*t)});function z8(e,t,n){let r=0,a=1,s=t.x-e.x,l=t.y-e.y,f=[[-s,e.x-n.x],[s,n.x+n.width-e.x],[-l,e.y-n.y],[l,n.y+n.height-e.y]];for(let[p,h]of f){if(p===0){if(h<0)return!1;continue}let v=h/p;if(p<0?r=Math.max(r,v):a=Math.min(a,v),r>a)return!1}return!0}function Py(e,t){for(let n of t){let r=R8(n,2);for(let a=0;a+1<e.length;a++)if(z8(e[a],e[a+1],r))return!0}return!1}function Dy(e,t){let n=[...e].length*6+8;return{x:t.x-n/2,y:t.y-8,width:n,height:16}}function F8(e,t,n,r,a,s){let[l,f,p]=sf({sourceX:e.x,sourceY:e.y,sourcePosition:t,targetX:n.x,targetY:n.y,targetPosition:r}),h={path:l,label:{x:f,y:p}};if(!Py(L8(l),a))return h;let v=B8(e,eE[t],n,eE[r],a);return v?{path:W8(v),label:Y8(v,a,s),bends:v.slice(1,-1)}:h}function tE(e,t,n){let r=n.flat().sort((s,l)=>s-l),a=[e,t];for(let[s,l]of n)a.push(s-rl,l+rl);for(let s=0;s+1<r.length;s++){let l=r[s+1]-r[s];l>16&&l<50&&a.push((r[s]+r[s+1])/2)}return[...new Set(a)].sort((s,l)=>s-l)}function B8(e,t,n,r,a){let s=Sh[t],l=Sh[r],f={x:e.x+s.x*kh,y:e.y+s.y*kh},p={x:n.x+l.x*kh,y:n.y+l.y*kh};if(!(Py([e,f],a)||Py([p,n],a)))for(let h of[q8,1/0]){let v=H8(f,p,a,h),g=V8(f,t,p,(r+2)%4,v);if(g)return K8([e,...g,n]);if(v.length===a.length)break}}var q8=400;function H8(e,t,n,r){if(!Number.isFinite(r))return n;let a=(l,f)=>{let p=l.map(m=>m.x),h=l.map(m=>m.y),[v,g]=[Math.min(...p)-f,Math.min(...h)-f];return{x:v,y:g,width:Math.max(...p)+f-v,height:Math.max(...h)+f-g}},s=n.filter(l=>Oy(l,a([e,t],r)));for(;;){let l=a([e,t,...s.flatMap(p=>[p,{x:p.x+p.width,y:p.y+p.height}])],33),f=n.filter(p=>s.includes(p)||Oy(p,l));if(f.length===s.length)return s;s=f}}function V8(e,t,n,r,a){let s=tE(e.x,n.x,a.map(O=>[O.x,O.x+O.width])),l=tE(e.y,n.y,a.map(O=>[O.y,O.y+O.height])),f=s.length,p=l.length,h=new Float32Array(f*p),v=new Float32Array(f*p),g=(O,K,B,V,oe,F,J,L,U)=>{V<=J||B>=L||O[K]<0||(O[K]=U&&V>oe&&B<F?-1:Math.max(O[K],Math.min(V,L)-Math.max(B,J)))};for(let O of a){let[K,B,V,oe]=[O.x-wi,O.x+O.width+wi,O.y-wi,O.y+O.height+wi],[F,J,L,U]=[O.x-rl,O.x+O.width+rl,O.y-rl,O.y+O.height+rl];for(let W=0;W<p;W++){let re=l[W];if(!(re<=L||re>=U))for(let le=0;le+1<f;le++)g(h,le*p+W,s[le],s[le+1],K,B,F,J,re>V&&re<oe)}for(let W=0;W<f;W++){let re=s[W];if(!(re<=F||re>=J))for(let le=0;le+1<p;le++)g(v,W*p+le,l[le],l[le+1],V,oe,L,U,re>K&&re<B)}}let m=O=>a.some(K=>O.x>K.x-wi&&O.x<K.x+K.width+wi&&O.y>K.y-wi&&O.y<K.y+K.height+wi);if(m(e)||m(n))return;let b=s.indexOf(e.x),w=l.indexOf(e.y),k=s.indexOf(n.x),S=l.indexOf(n.y),N=f*p*4,$=new Float64Array(N).fill(1/0),j=new Int32Array(N).fill(-1),E=(O,K,B)=>{let V=n.x-s[O],oe=n.y-l[K];if(V===0&&oe===0)return 0;let F=Sh[B],J=B===r?V*F.y===oe*F.x&&V*F.x+oe*F.y>=0?0:2:B===(r+2)%4?2:1;return Math.abs(V)+Math.abs(oe)+J*My},I=new X8,z=(b*p+w)*4+t;$[z]=0,I.push(E(b,w,t),0,z);let T=-1;for(;I.size>0;){let{key:O,value:K}=I.pop(),B=K%4,V=(K-B)/4,oe=Math.floor(V/p),F=V%p;if(!(O>$[K]+E(oe,F,B))){if(oe===k&&F===S){T=K;break}for(let J=0;J<4;J++){if(J===(B+2)%4)continue;let L=Sh[J],U=oe+L.x,W=F+L.y;if(U<0||W<0||U>=f||W>=p)continue;let re=J%2==1,le=re?h[Math.min(oe,U)*p+F]:v[oe*p+Math.min(F,W)];if(le<0)continue;let pe=s[oe],xe=l[F],Ne=Math.abs(re?s[U]-pe:l[W]-xe),we=re?xe===e.y||xe===n.y:pe===e.x||pe===n.x,R=$[K]+Ne*(we?1:1.01)+le*I8+(J===B?0:My),Q=(U*p+W)*4+J;if(U===k&&W===S){if(J===(r+2)%4)continue;J!==r&&(R+=My)}R<$[Q]&&($[Q]=R,j[Q]=K,I.push(R+E(U,W,J),R,Q))}}}if(T<0)return;let M=[];for(let O=T;O>=0;O=j[O]){let K=(O-O%4)/4;M.push({x:s[Math.floor(K/p)],y:l[K%p]})}return M.reverse()}function K8(e){let t=[];for(let n of e){let r=t.at(-1);if(r&&r.x===n.x&&r.y===n.y)continue;let a=t.at(-2);a&&r&&(a.x===r.x&&r.x===n.x||a.y===r.y&&r.y===n.y)&&t.pop(),t.push(n)}return t}function W8(e){let t=e[0],n=e.at(-1),r=`M${t.x} ${t.y}`;for(let a=1;a<e.length-1;a++)r+=U8(e[a-1],e[a],e[a+1]);return`${r}L${n.x} ${n.y}`}function U8(e,t,n){let r=Math.min(Math.hypot(e.x-t.x,e.y-t.y)/2,Math.hypot(t.x-n.x,t.y-n.y)/2,D8),{x:a,y:s}=t;if(e.x===a&&a===n.x||e.y===s&&s===n.y)return`L${a} ${s}`;if(e.y===s){let f=e.x<n.x?-1:1,p=e.y<n.y?1:-1;return`L ${a+r*f},${s}Q ${a},${s} ${a},${s+r*p}`}let l=e.x<n.x?1:-1;return`L ${a},${s+r*(e.y<n.y?-1:1)}Q ${a},${s} ${a+r*l},${s}`}var nE=(e,t)=>Math.abs(t.x-e.x)+Math.abs(t.y-e.y);function Y8(e,t,n){for(let s=0;n&&s+1<e.length;s++){let l=e[s],f=e[s+1],p=nE(l,f),h=(p-(l.y===f.y?Dy(n,l).width:16)-8)/2,v=Math.sign(f.x-l.x),g=Math.sign(f.y-l.y);for(let m=0;m<=h;m+=8)for(let b of m?[-1,1]:[1]){let w=p/2+b*m,k={x:l.x+v*w,y:l.y+g*w},S=Dy(n,k);if(!t.some(N=>Oy(S,N)))return k}}let r=e.slice(1).map((s,l)=>nE(e[l],s)),a=r.reduce((s,l)=>s+l,0)/2;for(let s=0;s+1<e.length;s++){let l=e[s],f=e[s+1],p=r[s];if(a<=p)return{x:l.x+Math.sign(f.x-l.x)*a,y:l.y+Math.sign(f.y-l.y)*a};a-=p}return e[0]}var X8=class{heap=[];keys=[];depths=[];values=[];get size(){return this.heap.length}push(e,t,n){let r=this.keys.length;this.keys.push(e),this.depths.push(t),this.values.push(n);let a=this.heap,s=a.length;for(a.push(r);s>0;){let l=s-1>>1;if(!this.before(r,a[l]))break;a[s]=a[l],s=l}a[s]=r}pop(){let e=this.heap,t=e[0],n=e.pop();if(e.length>0){let r=0;for(;;){let a=2*r+1;if(a>=e.length)break;let s=a+1,l=s<e.length&&this.before(e[s],e[a])?s:a;if(!this.before(e[l],n))break;e[r]=e[l],r=l}e[r]=n}return{key:this.keys[t],value:this.values[t]}}before(e,t){let n=this.keys[e],r=this.keys[t];if(n!==r)return n<r;let a=this.depths[e],s=this.depths[t];return a===s?e<t:a>s}},oE=(0,A.createContext)([]),rE=(0,A.createContext)(()=>{}),Z8=(0,A.memo)(function({id:e,data:t,sourceX:n,sourceY:r,sourcePosition:a,targetX:s,targetY:l,targetPosition:f,label:p,labelStyle:h,labelShowBg:v,labelBgStyle:g,labelBgPadding:m,labelBgBorderRadius:b,style:w,markerEnd:k,markerStart:S,interactionWidth:N}){let $=(0,A.useContext)(oE),j=(0,A.useContext)(rE),E=typeof p=="string"?p:void 0,I=(0,A.useMemo)(()=>F8({x:n,y:r},a,{x:s,y:l},f,$,E),[n,r,a,s,l,f,$,E]),z=t?.plus,T=E?Dy(E,I.label):void 0,M={x:T?T.x+T.width+12:I.label.x,y:I.label.y};return(0,c.jsxs)(c.Fragment,{children:[z?(0,c.jsx)(u3,{children:(0,c.jsx)("button",{type:"button",className:"afd-plus afd-wire-plus nodrag nopan",style:{transform:`translate(-50%, -50%) translate(${M.x}px, ${M.y}px)`},title:"Insert a node on this wire","aria-label":"Insert a node on this wire","data-wire-plus":e,onMouseEnter:()=>j(e),onMouseLeave:()=>j(null),onClick:O=>{O.stopPropagation(),u8(e)},children:(0,c.jsx)("span",{className:"codicon codicon-add","aria-hidden":"true"})})}):null,(0,c.jsx)(xd,{path:I.path,labelX:I.label.x,labelY:I.label.y,label:p,labelStyle:h,labelShowBg:v,labelBgStyle:g,labelBgPadding:m,labelBgBorderRadius:b,style:w,markerEnd:k,markerStart:S,interactionWidth:N})]})}),G8={flow:O6,boundary:O8,ghost:P8,annotation:E8},Q8={routed:Z8},J8=[],eB=[],tB=()=>{},iE=e=>e.type==="annotation"?e.data.view.kind:void 0,ki={section:-2,frame:-1,note:0,node:1,tied:2,innerWire:2,inner:3};function nB(e,t,n,r,a,s){let l=e.annotation,f=e.on&&r.has(e.on)?e.on:void 0;return{id:l.id,type:"annotation",position:f?a[l.id]??{x:l.x,y:l.y}:e.position,...f?{parentId:f}:{},width:e.width,height:e.height,measured:{width:e.width,height:e.height},data:{view:e,editable:n},selected:t,zIndex:e.kind==="section"?ki.section:f?ki.tied:ki.note,...e.kind==="section"?{dragHandle:".afd-annotation-title",style:{pointerEvents:"none"}}:{},ariaLabel:$8(e),...s?{className:`afd-mark-${s}`}:{},draggable:n,deletable:!1,connectable:!1}}function oB({node:e,ports:t}){let n=e.type==="start"||e.type==="end"?"":`, ${e.status??"draft"}`,r=t.filter(s=>s.state==="open-fail").length,a=r?`, ${r} open fail port${r===1?"":"s"}`:"";return`${yo[e.type]} ${e.title}${n}${a}`}function rB(e,t){let n=Math.max(0,...t.map(s=>s.position.x+s.width))+80,r=Math.min(...t.map(s=>s.position.y),0),a=0;return e.map(s=>({id:`ghost:${s.id}`,type:"ghost",position:s.position??{x:n,y:r+90*a++},data:{ghost:s},selectable:!1,draggable:!1,connectable:!1,deletable:!1,focusable:!1}))}function aE(e,t,n){return{id:e.node.id,type:"flow",position:e.position,width:e.width,height:e.height,data:{view:e,...n?{role:n}:{}},ariaLabel:oB(e),selected:t,deletable:!n,...n?{draggable:!1,connectable:!1}:{},zIndex:n==="inner"?ki.inner:ki.node}}var iB={shift:{},inner:{},frames:new Set},aB=e=>`${e} host${e===1?"":"s"}`;function sB({cull:e=!0}){let t=_(D=>D.snapshot),n=_(D=>D.optimistic),r=_(D=>D.selection),a=_(D=>D.select),s=_(D=>D.setOptimistic),l=_(D=>D.openQuickAdd),f=_(D=>D.setError),p=_(D=>D.pick!==null),h=_(D=>D.setPick),v=_(D=>D.openPortMenu),g=_(D=>D.openContextMenu),m=_(D=>D.level),b=_(D=>D.setLevel),[w,k]=(0,A.useState)(!1),[S,N]=(0,A.useState)(null),$=(0,A.useRef)(!1),j=_(D=>D.testMode),[E,I]=(0,A.useState)(null),z=(0,A.useRef)(void 0),T=(0,A.useCallback)(D=>{clearTimeout(z.current),D?I(D):z.current=setTimeout(()=>I(null),250)},[]);(0,A.useEffect)(()=>()=>clearTimeout(z.current),[]);let M=(0,A.useRef)(null),[O,K]=(0,A.useState)(null),B=(0,A.useCallback)((D,G)=>aC(G)||D===E||D===r.edge,[E,r.edge]),{screenToFlowPosition:V,setViewport:oe,fitView:F,getViewport:J,setCenter:L}=Ts(),U=_(D=>D.centerOn),W=hh(),re=_(D=>D.pick?D.pickAt:null),le=Ke(D=>D.width),pe=Ke(D=>D.height),xe=_(D=>D.mode!=="design"||!!D.snapshot?.doc&&!!Vf(D.snapshot.doc,D.level)),Ne=_(D=>!!D.snapshot?.idGaps),we=_(D=>D.mode==="run"?D.run?.summary:void 0),R=_(D=>D.lens!==null||D.mode==="run"),Q=_(D=>D.lensView?.wires),fe=_(D=>D.lensView?.dataWires),X=_(D=>D.lens==="data"),he=_(D=>D.lens==="changes"?D.lensView?.ghosts:void 0),Z=(0,A.useMemo)(()=>(he??[]).filter(D=>D.level===m),[he,m]),q=ph(),ee=_(D=>D.expandSubflows?D.expandedSubflows:eB),de=(0,A.useMemo)(()=>ee.length>0&&t?Yz(q,D=>cn(t,n,D),ee):{...iB,view:q},[q,ee,t,n]),me=de.view,De=(0,A.useRef)(de);De.current=de;let Fe=_(D=>D.annotationsHidden),Ye=_(D=>D.optimistic),Le=!xe&&!Ne,Be=_(D=>D.lens==="changes"?D.lensView?.annotations:void 0),ut=Fe?J8:me.annotations,kt=(0,A.useMemo)(()=>{let D=[...me.nodes.map(G=>aE(G,!1)),...ut.map(G=>({position:G.position,width:G.width,height:G.height}))];return D.length?ef(D):null},[me.nodes,ut]),It=W$(),zt=(0,A.useMemo)(()=>It?Gz(kt??{x:0,y:0,width:0,height:0}):null,[It,kt]),hn=Y$(),Ft=Ke(D=>{let[G,ve,be]=D.transform;return e4(me.nodes.map(ke=>({x:ke.position.x*be+G,y:ke.position.y*be+ve,width:ke.width*be,height:ke.height*be})),{width:D.width,height:D.height},hn)}),[Bt,nn]=(0,A.useState)(!1),pn=Ke(D=>{if(!kt||D.width<=0)return!1;let[G,ve,be]=D.transform,ke=kt.x*be+G,Te=kt.y*be+ve;return ke<0||Te<0||ke+kt.width*be>D.width||Te+kt.height*be>D.height}),bt=(0,A.useMemo)(()=>t?ry(t,me,m):void 0,[t,me,m]),mn=bt?JSON.stringify([bt.frame,bt.ports,me.nodes.length,It]):"",Uo=(0,A.useMemo)(()=>bt?{id:bt.id,type:"boundary",position:{x:bt.frame.x,y:bt.frame.y},width:bt.frame.width,height:bt.frame.height,data:{boundary:bt,empty:me.nodes.length===0&&!It},draggable:!1,selectable:!1,deletable:!1,focusable:!1,zIndex:ki.frame,style:{pointerEvents:"none"}}:void 0,[mn]),$r=(0,A.useRef)(new Map),ja=(0,A.useRef)(new Map),Er=(0,A.useMemo)(()=>{let D=new Map,G=new Map,ve=me.nodes.map(Re=>{let Ue=r.node===Re.node.id||!!r.nodes?.includes(Re.node.id),mt=de.inner[Re.node.id]?"inner":de.frames.has(Re.node.id)?"frame":void 0,ze=JSON.stringify([Re,Ue,mt]),Ht=$r.current.get(Re.node.id),xt=Ht&&Ht.key===ze?Ht:{key:ze,node:aE(Re,Ue,mt)};return D.set(Re.node.id,xt),xt.node});$r.current=D;let be=new Set(me.nodes.map(Re=>Re.node.id)),ke=new Set(r.annotations??[]),Te=ut.map(Re=>{let Ue=ke.has(Re.annotation.id),mt=Be?.[Re.annotation.id],ze=JSON.stringify([Re,Ue,Le,Ye[Re.annotation.id],mt]),Ht=ja.current.get(Re.annotation.id),xt=Ht&&Ht.key===ze?Ht:{key:ze,node:nB(Re,Ue,Le,be,Ye,mt)};return G.set(Re.annotation.id,xt),xt.node});ja.current=G;let Xe=Uo?[Uo,...ve,...Te]:[...ve,...Te];return Z.length>0?[...Xe,...rB(Z,me.nodes)]:Xe},[me.nodes,de,r.node,r.nodes,r.annotations,Uo,Z,ut,Le,Ye,Be]),[rn,Yo]=(0,A.useState)(Er);(0,A.useEffect)(()=>Yo(Er),[Er]);let Sn=(0,A.useRef)(rn);Sn.current=rn;let Ca=rn.filter(D=>D.type==="flow"&&D.data.role!=="frame"),dl=Ca.map(D=>`${D.position.x},${D.position.y},${D.width},${D.height}`).join(";"),Xt=(0,A.useMemo)(()=>Ca.map(D=>({x:D.position.x,y:D.position.y,width:D.width??0,height:D.height??0})),[dl]),$a=_(D=>D.outside?.edges),_r=(0,A.useMemo)(()=>{let D=new Set(me.nodes.filter(G=>G.node.type==="start").map(G=>G.node.id));return(G,ve)=>D.has(ve.source)?G.hosts:Vj(G,ve.source,ve.sourcePort)},[me.nodes]),Ni=(0,A.useMemo)(()=>me.edges.map(D=>({id:D.id,source:D.source,sourceHandle:D.sourcePort,target:D.target,targetHandle:D.targetPort,type:"routed",label:we?aB(_r(we,D).length):Q?.[D.id]??(B(D.id,D.sourcePort)?D.sourcePort:void 0),className:`afd-edge tone-${D.tone}${D.problem?" problem":""}${we?_r(we,D).length>0?" run-taken":" run-idle":""}${X?" lens-control":""}${$a?.includes(D.id)?" outside-mark":""}${O===D.id?" drop-target":""}`,markerEnd:{type:na.ArrowClosed,color:`var(--afd-${D.tone==="neutral"?"neutral":D.tone})`},selected:r.edge===D.id,deletable:!xe&&!D.inner,reconnectable:Le&&!D.inner,data:{plus:Le&&!D.inner&&(E===D.id||r.edge===D.id)},...D.inner?{selectable:!1,focusable:!1,zIndex:ki.innerWire}:{}})),[me.edges,r.edge,we,xe,Le,E,_r,Q,X,B,$a,O]),Xo=(0,A.useMemo)(()=>{if(!X||!fe)return[];let D=new Set(me.nodes.map(G=>G.node.id));return fe.filter(G=>D.has(G.from)&&D.has(G.to)).map(G=>({id:G.id,source:G.from,sourceHandle:"__data_out",target:G.to,targetHandle:"__data_in",type:"default",label:G.label,className:"afd-edge afd-data-edge",data:{title:G.title},markerEnd:{type:na.ArrowClosed,color:"var(--afd-lens-data)"},selectable:!1,deletable:!1,focusable:!1,reconnectable:!1}))},[X,fe,me.nodes]),Ea=(0,A.useMemo)(()=>{if(!t||de.frames.size===0)return[];let D=[];for(let G of de.frames){let ve=ry(t,cn(t,n,G),G);for(let be of ve?.edges??[]){let ke=be.kind==="entry";D.push({id:`inline:${be.id}`,source:ke?G:be.source,sourceHandle:ke?vy(be.sourcePort):be.sourcePort,target:ke?be.target:G,targetHandle:ke?be.targetPort:vy(be.targetPort),type:"routed",className:`afd-edge afd-boundary-edge afd-inline-edge tone-${be.tone}${be.problem?" problem":""}`,markerEnd:{type:na.ArrowClosed,color:`var(--afd-${be.tone==="neutral"?"neutral":be.tone})`},selectable:!1,focusable:!1,deletable:!1,reconnectable:!1,zIndex:ki.innerWire})}}return D},[t,de.frames,n]),_a=(0,A.useMemo)(()=>[...Ni,...Xo,...Ea,...(bt?.edges??[]).map(D=>({id:D.id,source:D.source,sourceHandle:D.sourcePort,target:D.target,targetHandle:D.targetPort,type:"routed",label:$4(D)||B(D.id,"in")?D.label:void 0,className:`afd-edge afd-boundary-edge tone-${D.tone}${D.problem?" problem":""}`,markerEnd:{type:na.ArrowClosed,color:`var(--afd-${D.tone==="neutral"?"neutral":D.tone})`},selected:r.edge===D.id,deletable:!0,reconnectable:!1}))],[Ni,Xo,Ea,bt,r.edge,B]),ul=(0,A.useCallback)(D=>{let G=D.filter(ve=>ve.type==="select");if(G.length>0){let ve=Rg(G,Sn.current).filter(Ue=>Ue.selected),be=ve.filter(Ue=>Ue.type==="flow").map(Ue=>Ue.id),ke=ve.filter(Ue=>Ue.type==="annotation").map(Ue=>Ue.id),Te=_.getState().selection,Xe=ke.length?{annotations:ke}:{},Re=(Ue,mt)=>(Ue??[]).length===mt.length&&mt.every(ze=>Ue?.includes(ze));be.length>1?a({nodes:be,...Xe}):be.length===1?Te.node===be[0]&&Re(Te.annotations,ke)||a({node:be[0],...Xe}):ke.length?(Te.node||Te.nodes||!Re(Te.annotations,ke))&&a(Xe):(Te.node||Te.nodes||Te.annotations?.length)&&a({})}Yo(ve=>Rg(D.filter(be=>be.type!=="remove"),ve))},[a]),ji=(0,A.useRef)(!1),Dn=(0,A.useCallback)((D,G)=>{if(D.length===0)return;let ve={},be={},ke=ze=>({x:Math.round(ze.x),y:Math.round(ze.y)}),{shift:Te,inner:Xe}=De.current,Re=ze=>ke({x:ze.position.x-(Te[ze.id]?.x??0),y:ze.position.y-(Te[ze.id]?.y??0)});for(let ze of D)ze.type==="annotation"?be[ze.id]=ke(ze.position):ze.type==="flow"&&!Xe[ze.id]&&(ve[ze.id]=Re(ze));let Ue=_.getState().snapshot?.doc?.layout??{};for(let ze of Sn.current)ze.type!=="flow"||Xe[ze.id]||Ue[ze.id]||ve[ze.id]||(ve[ze.id]=Re(ze));let mt={...ve,...be};s(mt),la(G?{kind:"spliceNode",...G,positions:ve}:{kind:"moveNodes",positions:ve,...Object.keys(be).length?{annotations:be}:{}}).then(ze=>{ze.ok||(_.getState().dropOptimistic(mt),f(ze.error??"Move failed"))})},[s,f]),jt=(0,A.useRef)(null),In=(0,A.useCallback)((D,G)=>{if(_.getState().setPreview(null),jt.current=null,ji.current=G.type==="flow"&&Le&&!!W&&!Lj(W,G.id),G.type!=="annotation"||G.data.view.kind!=="section")return;let ve=wz(me,G.id),be=new Map;for(let ke of Sn.current)(ve.nodes.includes(ke.id)||ve.annotations.includes(ke.id))&&be.set(ke.id,ke.position);jt.current={id:G.id,from:G.position,items:be}},[me,Le,W]),[qt,Aa]=(0,A.useState)(null),Ci=(0,A.useRef)(null),cl=(0,A.useCallback)((D,G,ve=[G])=>{let be=jt.current;if(!be||be.id!==G.id){if(G.type!=="flow"||ve.length!==1)return;let Xe=D,Re=null;if(ji.current&&W&&Xe.clientX!==void 0&&Xe.clientY!==void 0)for(let xt of document.elementsFromPoint?.(Xe.clientX,Xe.clientY)??[]){let xo=xt.closest(".react-flow__edge")?.dataset.id;if(xo&&!Lj(W,G.id,xo)){Re=xo;break}}Re!==M.current&&(M.current=Re,K(Re));let Ue=xt=>({id:xt.id,x:xt.position.x,y:xt.position.y,width:xt.data.view.width,height:xt.data.view.height}),mt=Sn.current.filter(xt=>xt.type==="flow"&&xt.id!==G.id).map(Ue),ze=_z(Ue(G),mt),Ht=ze.xs.length>0||ze.ys.length>0;Ci.current=Ht?{id:G.id,at:ze.snap}:null,Aa(Ht||ze.even?{...ze,box:{...Ue(G),...ze.snap}}:null);return}M.current&&(M.current=null,K(null));let ke=G.position.x-be.from.x,Te=G.position.y-be.from.y;Yo(Xe=>Xe.map(Re=>{let Ue=be.items.get(Re.id);return Ue?{...Re,position:{x:Ue.x+ke,y:Ue.y+Te}}:Re}))},[W]),Ar=(0,A.useCallback)((D,G,ve)=>{let be=jt.current;jt.current=null;let ke=Ci.current;Ci.current=null,Aa(null);let Te=ke?ve.map(mt=>mt.id===ke.id?{...mt,position:ke.at}:mt):ve,Xe=be?Sn.current.filter(mt=>be.items.has(mt.id)):[],Re=M.current;M.current=null,K(null);let Ue=ve.length===1&&ve[0]?.type==="flow"?ve[0].id:void 0;Dn([...Te,...Xe.filter(mt=>!Te.some(ze=>ze.id===mt.id))],Re&&Ue&&ji.current?{node:Ue,edge:Re}:void 0)},[Dn]),bo=(0,A.useRef)(void 0);(0,A.useEffect)(()=>()=>clearTimeout(bo.current),[]);let Tr=(0,A.useCallback)(D=>{!D.key.startsWith("Arrow")||D.altKey||D.ctrlKey||D.metaKey||xe||D.target.closest?.(".react-flow__node, .react-flow__nodesselection")&&(clearTimeout(bo.current),bo.current=setTimeout(()=>Dn(Sn.current.filter(G=>(G.type==="flow"||G.type==="annotation")&&G.selected)),500))},[Dn,xe]),Qn=(0,A.useCallback)(D=>{if(!D.sourceHandle||!D.targetHandle)return;let G=bt?.subflow.id;G&&D.source===bt.id?la({kind:"setBoundaryIn",subflow:G,node:D.target}).then(ve=>{ve.ok||f(ve.error??"Could not set the entry")}):G&&D.target===bt.id?la({kind:"connectBoundary",subflow:G,from:{node:D.source,port:D.sourceHandle},port:D.targetHandle}).then(ve=>{ve.ok||f(ve.error??"Could not add the exit")}):la({kind:"connect",from:{node:D.source,port:D.sourceHandle},to:{node:D.target,port:D.targetHandle}}).then(ve=>{ve.ok||f(ve.error??"Could not connect")})},[f,bt]),Mr=(0,A.useCallback)((D,G)=>{if(k(!1),$.current||G.isValid||!G.fromNode||G.fromNode.type!=="flow"||G.fromHandle?.type!=="source"||!G.fromHandle.id)return;let ve="changedTouches"in D?D.changedTouches[0]:D;ve&&l({type:"task",position:V({x:ve.clientX,y:ve.clientY}),connectFrom:{node:G.fromNode.id,port:G.fromHandle.id}})},[l,V]),Zt=(0,A.useCallback)((D,G)=>{D.preventDefault();let{clientX:ve,clientY:be}=D;if(ve===0&&be===0&&D.target instanceof Element){let Te=D.target.getBoundingClientRect();ve=Te.left+12,be=Te.bottom}let ke=V({x:ve,y:be});g({target:G,x:ve,y:be,at:{x:Math.round(ke.x),y:Math.round(ke.y)}})},[g,V]);(0,A.useEffect)(()=>{let D=()=>{M.current=null,K(null)};return window.addEventListener("dragend",D),()=>window.removeEventListener("dragend",D)},[]);let $i=(0,A.useCallback)(D=>{let G=D.dataTransfer.getData(c$);if(Bz.includes(G)){D.preventDefault();let Xe=document.elementFromPoint(D.clientX,D.clientY),Re=Xe?.closest("[data-port]")?.dataset.port,Ue=Xe?.closest("[data-node-id]")?.dataset.nodeId;Ue?H$(G,Ue,Re):f("Drop a failure pattern onto an open fail port");return}let ve=D.dataTransfer.getData(f$);if(ve){D.preventDefault();let Xe=document.elementFromPoint(D.clientX,D.clientY)?.closest("[data-node-id]")?.dataset.nodeId,Re=V({x:D.clientX,y:D.clientY});ve==="note"&&Xe?Yd("note",void 0,Xe):Yd(ve,{x:Math.round(Re.x),y:Math.round(Re.y)});return}let be=D.dataTransfer.getData(u$),ke=M.current;if(M.current=null,K(null),!be)return;D.preventDefault();let Te=ke&&Cy.includes(be)?{insertOn:ke}:{};l({type:be,position:V({x:D.clientX,y:D.clientY}),...Te})},[l,V,f]),Or=(0,A.useRef)(null),Ei=(0,A.useRef)(null);(0,A.useEffect)(()=>(e$(()=>{let D=document.querySelector(".react-flow")?.getBoundingClientRect(),G=D&&D.width>0?{x:D.left+D.width/2,y:D.top+D.height/2}:void 0,ve=Or.current??Ei.current??G;if(!ve)return;let be=V(ve);return{x:Math.round(be.x),y:Math.round(be.y)}}),()=>e$(()=>{})),[V]);let Pr=(0,A.useMemo)(()=>Ms(),[]),Zo=Pr.viewports?.[m]??(m==="root"?Pr.viewport:void 0),Ta=(0,A.useRef)(!!Zo);(0,A.useEffect)(()=>{if(Ta.current||rn.length===0||le<=0||pe<=0)return;Ta.current=!0;let D=rn.filter(G=>G.type==="flow").reduce((G,ve)=>!G||ve.position.y<G.position.y?ve:G,void 0);oe(Zz(zt?Qz(ef(rn),zt):ef(rn),{width:le,height:pe},D?D.position.x+(D.width??0)/2:void 0))},[rn,le,pe,oe,zt]),(0,A.useEffect)(()=>{if(!U||le<=0||pe<=0)return;let D=me.nodes.find(G=>G.node.id===U)??me.annotations.find(G=>G.annotation.id===U);D&&(_.setState({centerOn:null}),L(D.position.x+D.width/2,D.position.y+D.height/2,{zoom:Math.max(J().zoom,1)}))},[U,me.nodes,me.annotations,le,pe,L,J]),(0,A.useEffect)(()=>{let D=G=>{if(!(G.defaultPrevented||G.ctrlKey||G.metaKey||G.altKey)&&!G.target?.closest('input, textarea, select, button, [contenteditable="true"], [role="menu"], [role="dialog"]'))if(G.key==="Enter"&&!G.shiftKey){let ve=_.getState().selection,be=!ve.node&&ve.annotations?.length===1?ve.annotations[0]:void 0;if(be&&Le){G.preventDefault(),uh(be);return}let ke=me.nodes.find(Te=>Te.node.id===ve.node)?.node;if(!ke)return;G.preventDefault(),ke.type==="subflow"?b(ke.id):setTimeout(()=>document.querySelector('[role="tablist"][aria-label="Details"] [aria-selected="true"]')?.focus())}else G.shiftKey&&G.code==="Digit1"?(G.preventDefault(),F(T0)):G.shiftKey&&G.code==="Digit2"&&(G.preventDefault(),_.getState().zoomToSelection())};return window.addEventListener("keydown",D),()=>window.removeEventListener("keydown",D)},[me.nodes,b,F,Le]);let Go=_(D=>D.zoomNonce),_i=(0,A.useRef)(Go);(0,A.useEffect)(()=>{if(_i.current===Go)return;_i.current=Go;let D=_.getState().selection,G=[...D.nodes??(D.node?[D.node]:[]),...D.annotations??[]];G.length!==0&&F({nodes:G.map(ve=>({id:ve})),padding:.25,maxZoom:1.5,duration:200})},[Go,F]);let Dr=(0,A.useMemo)(()=>{let D=_.getState().pick;return p&&D&&W?T4(W,me.nodes,{mode:D.mode,node:D.ref.node}):[]},[p,W,me.nodes]);(0,A.useEffect)(()=>{if(!p)return;let D=G=>{if(G.ctrlKey||G.metaKey||G.altKey||G.target?.closest('input, textarea, select, [contenteditable="true"], [role="menu"], [role="dialog"]'))return;let ve=_.getState(),be=G.key==="Tab"&&G.shiftKey||G.key==="ArrowUp"||G.key==="ArrowLeft",ke=G.key==="Tab"&&!G.shiftKey||G.key==="ArrowDown"||G.key==="ArrowRight";if(be||ke){let Te=M4(Dr,ve.pickAt,be?-1:1);if(!Te)return;G.preventDefault(),G.stopPropagation(),ve.setPickAt(Te)}else(G.key==="Enter"||G.key===" ")&&ve.pickAt&&(G.preventDefault(),G.stopPropagation(),V$(ve.pickAt))};return window.addEventListener("keydown",D,!0),()=>window.removeEventListener("keydown",D,!0)},[p,Dr]),(0,A.useEffect)(()=>{let D=re?me.nodes.find(Xe=>Xe.node.id===re):void 0;if(!D||le<=0)return;let{x:G,y:ve,zoom:be}=J(),ke=D.position.x*be+G,Te=D.position.y*be+ve;ke>=0&&Te>=0&&ke+D.width*be<=le&&Te+D.height*be<=pe||L(D.position.x+D.width/2,D.position.y+D.height/2,{zoom:be})},[re,me.nodes,le,pe,J,L]);let Ma=(0,c.jsxs)(l3,{nodes:rn,edges:_a,nodeTypes:G8,edgeTypes:Q8,onNodesChange:ul,onEdgesChange:D=>{let G=D.filter(ke=>ke.type==="select"),ve=G.findLast(ke=>ke.selected),be=_.getState().selection;ve?be.edge!==ve.id&&a({edge:ve.id}):be.edge&&G.some(ke=>ke.id===be.edge)&&a({})},onEdgeMouseEnter:(D,G)=>T(G.id),onEdgeMouseLeave:()=>T(null),onNodeDragStart:In,onNodeDrag:cl,onNodeDragStop:Ar,onConnect:Qn,onConnectStart:()=>{k(!0),_.getState().setPreview(null)},onConnectEnd:Mr,onReconnect:tB,onReconnectStart:(D,G,ve)=>{$.current=!0,N(ve==="target"?"source":"target")},onReconnectEnd:(D,G,ve)=>{$.current=!1,N(null);let be="changedTouches"in D?D.changedTouches[0]:D;if(!be)return;let ke=document.elementFromPoint(be.clientX,be.clientY);if(!ke?.closest(".react-flow")||ke.closest(".react-flow__node-boundary")||ke.closest(".react-flow__panel, .react-flow__minimap, .react-flow__controls")||ke.closest(".react-flow__edge")?.dataset.id===G.id)return;let Te=ke.closest("[data-node-id]")?.dataset.nodeId,Xe=ke.closest("[data-port]")?.dataset.port;c8(G.id,ve==="target"?"source":"target",Te?{node:Te,...Xe?{port:Xe}:{}}:null)},reconnectRadius:9,connectOnClick:!1,connectionDragThreshold:4,onNodeClick:(D,G)=>{p&&G.type==="flow"&&V$(G.id)},onNodeMouseEnter:(D,G)=>{if(G.type!=="flow"||!my(G.data.view.node))return;let ve=D.currentTarget.getBoundingClientRect();_.getState().hoverNode(G.id,{left:ve.left,right:ve.right,top:ve.top})},onNodeMouseLeave:()=>_.getState().hoverNode(null),onNodeDoubleClick:(D,G)=>{G.type==="flow"&&Le&&D.target.closest?.(".afd-node-title")?py(G.id):G.type==="flow"&&G.data.view.node.type==="subflow"&&b(G.id),G.type==="annotation"&&Le&&uh(G.id)},zoomOnDoubleClick:!1,onDoubleClick:D=>{Le&&D.target.classList?.contains("react-flow__pane")&&l({type:"task",position:V({x:D.clientX,y:D.clientY})})},onPaneClick:D=>{Ei.current={x:D.clientX,y:D.clientY},p&&h(null)},onNodeContextMenu:(D,G)=>{if(G.type==="annotation"){_.getState().selection.annotations?.includes(G.id)||a({annotations:[G.id]}),Zt(D,{kind:"annotation",id:G.id});return}if(G.type!=="flow"){Zt(D,{kind:"pane"});return}let ve=D.target.closest?.("[data-port]")?.dataset.port;if(ve&&!xe){D.preventDefault(),v({ref:{node:G.id,port:ve},x:D.clientX,y:D.clientY});return}let be=_.getState().selection;be.nodes?.includes(G.id)&&be.nodes.length>1?Zt(D,{kind:"nodes",ids:be.nodes}):(be.node!==G.id&&a({node:G.id}),Zt(D,{kind:"node",id:G.id}))},onSelectionContextMenu:(D,G)=>{let ve=G.filter(Te=>Te.type==="flow").map(Te=>Te.id),be=G.filter(Te=>Te.type==="annotation").map(Te=>Te.id),ke=ve[0];Zt(D,ve.length>1||ke&&be.length?{kind:"nodes",ids:ve,...be.length?{annotations:be}:{}}:ke?{kind:"node",id:ke}:be.length>1?{kind:"annotations",ids:be}:be[0]?{kind:"annotation",id:be[0]}:{kind:"pane"})},onEdgeContextMenu:(D,G)=>{G.className?.includes("afd-data-edge")?Zt(D,{kind:"pane"}):(_.getState().selection.edge!==G.id&&a({edge:G.id}),Zt(D,n$(G.id)??{kind:"edge",id:G.id}))},onPaneContextMenu:D=>Zt(D,{kind:"pane"}),onKeyDownCapture:D=>{D.key.startsWith("Arrow")&&(D.altKey||D.ctrlKey||D.metaKey)&&(D.target.closest?.('input, textarea, [contenteditable="true"]')||(D.preventDefault(),D.stopPropagation(),D.altKey?D.key==="ArrowUp"&&hy():a$(D.key==="ArrowUp"||D.key==="ArrowLeft"?"up":"down")))},onKeyDown:Tr,onMoveStart:()=>{v(null),_.getState().openContextMenu(null),_.getState().setPreview(null)},className:[w&&S!=="source"?"afd-connecting":"",S==="source"?"afd-reconnect-source":"",p?"afd-picking":"",R?"afd-dim-annotations":""].filter(Boolean).join(" "),zIndexMode:"manual",onDragOver:D=>{if(D.dataTransfer.types.includes("application/x-afd-node-type")&&!xe){let G=document.elementFromPoint(D.clientX,D.clientY)?.closest(".react-flow__edge")?.dataset.id??null,ve=G&&me.edges.some(be=>be.id===G)?G:null;ve!==M.current&&(M.current=ve,K(ve))}(D.dataTransfer.types.includes("application/x-afd-node-type")||D.dataTransfer.types.includes("application/x-afd-pattern")||D.dataTransfer.types.includes("application/x-afd-annotation"))&&D.preventDefault()},onDrop:$i,onMouseMove:D=>{Or.current={x:D.clientX,y:D.clientY}},onMouseLeave:()=>{Or.current=null},onMoveEnd:(D,G)=>{let ve=Ms();Xg({...ve,viewports:{...ve.viewports,[m]:G}})},isValidConnection:D=>D.source!==D.target,nodesConnectable:!xe&&!Ne,nodesDraggable:!xe&&!Ne,deleteKeyCode:null,onlyRenderVisibleElements:e&&!j,defaultViewport:Zo,fitViewOptions:T0,minZoom:.2,maxZoom:2,proOptions:{hideAttribution:!0},children:[(0,c.jsx)(v3,{variant:hi.Dots,gap:16,size:1}),(0,c.jsx)(_s,{position:"bottom-left",children:(0,c.jsx)(k8,{})}),(0,c.jsx)(_s,{position:"top-right",children:(0,c.jsx)(g8,{})}),zt?(0,c.jsx)(dN,{children:(0,c.jsx)(p8,{at:zt})}):null,qt?(0,c.jsx)(dN,{children:(0,c.jsx)(lB,{guide:qt})}):null,(0,c.jsx)(j3,{showInteractive:!1,position:"bottom-right",children:pn&&!Ft?(0,c.jsx)(wd,{onClick:()=>nn(!Bt),"aria-label":Bt?"Hide Mini Map":"Show Mini Map",title:Bt?"Hide Mini Map":"Show Mini Map: it would cover steps here",children:(0,c.jsx)("span",{className:"codicon codicon-map","aria-hidden":"true"})}):null}),pn&&(Ft||Bt)?(0,c.jsx)(z3,{position:Ft??"bottom-left",pannable:!0,zoomable:!0,ariaLabel:"Mini map of the level",className:"afd-minimap",style:{width:160,height:110},bgColor:"var(--afd-minimap-bg)",maskColor:"var(--afd-minimap-mask)",nodeColor:D=>{let G=iE(D);return D.type==="boundary"||G&&G!=="note"?"transparent":G?"var(--afd-note-yellow)":"var(--afd-minimap-node)"},nodeStrokeColor:D=>D.type==="boundary"||iE(D)==="section"?"var(--afd-neutral)":"transparent",nodeBorderRadius:4}):null]});return(0,c.jsx)(rE.Provider,{value:T,children:(0,c.jsx)(oE.Provider,{value:Xt,children:Ma})})}function lB({guide:e}){let{box:t}=e,n=2e3;return(0,c.jsxs)("div",{className:"afd-guides","aria-hidden":"true","data-guides":e.xs.length+e.ys.length,children:[e.xs.map(r=>(0,c.jsx)("div",{className:"afd-guide v",style:{left:r,top:t.y-n,height:2*n}},`x${r}`)),e.ys.map(r=>(0,c.jsx)("div",{className:"afd-guide h",style:{top:r,left:t.x-n,width:2*n}},`y${r}`)),e.even?(0,c.jsx)("div",{className:"afd-guide-even","data-even":e.even,style:e.even==="vertical"?{left:t.x+t.width+8,top:t.y+t.height/2-9}:{left:t.x+t.width/2-30,top:t.y+t.height+6},children:"even gaps"}):null]})}var dB=140;function uB(e,t=3e3){let n=()=>{let r=_.getState().snapshot?.doc;return!!r&&$e(r).nodes.has(e)};return new Promise(r=>{let a=()=>{s(),clearTimeout(l),_.getState().reveal(e),r()},s=_.subscribe((f,p)=>{f.snapshot!==p.snapshot&&n()&&a()}),l=setTimeout(()=>{s(),r()},t);n()&&a()})}function cB(e){let t=e.replaceAll(/[_-]+/g," ").trim();return t.charAt(0).toUpperCase()+t.slice(1)}async function fB(e){let t=_.getState(),n=t.snapshot?.doc;if(!n)return;let r=$e(n),a="node"in e?r.nodes.get(e.node)?.node:void 0;switch(e.kind){case"renameOutput":{let s=a?.outputs?.[e.from];return s?Pe({kind:"setContractField",target:e.node,side:"outputs",name:e.from,rename:e.to,field:s}):void 0}case"removeOutput":return Pe({kind:"setContractField",target:e.node,side:"outputs",name:e.name,field:null});case"setOutputFrom":{let s=a?.outputs?.[e.name];return s?Pe({kind:"setContractField",target:e.node,side:"outputs",name:e.name,field:{...s,from:e.from}}):void 0}case"addInput":return Pe({kind:"setContractField",target:e.node,side:"inputs",name:e.name,field:e.field});case"removeInput":return Pe({kind:"setContractField",target:e.node,side:"inputs",name:e.name,field:null});case"openCode":je({type:"openCode",path:e.path,line:e.line});return;case"addToSubflow":{let s=(r.levels.get(e.subflow)?.nodes??[]).map(h=>h?n.layout?.[h.id]??t.snapshot?.autoPositions[h.id]:void 0).filter(h=>!!h),l=s.reduce((h,v)=>v.y>h.y?v:h,s[0]??{x:40,y:-100}),f=await Pe({kind:"addNode",parent:e.subflow,type:"task",title:cB(e.tasksFrom),impl:{kind:"role",ref:e.role,params:{tasks_from:e.tasksFrom}},position:{x:Math.round(l.x),y:Math.round(l.y+dB)}}),p=f.created;return f.ok&&p&&await uB(p),f}case"ignore":{let s=t.drift?.items.find(l=>l.node===e.node&&l.id===e.item);t.setIgnore({node:e.node,item:e.item,title:s?.title??"",label:s?.label??""});return}case"unignore":return Pe({kind:"clearDriftIgnore",node:e.node,item:e.item});case"bind":t.openDetails(e.node,"binding",e.bindKind);return;default:{let s=await J3(e);return s.ok||_.getState().setError(s.error??"The action failed"),s}}}var hB={canvas:"how-to/canvas-basics.md",patterns:"how-to/ports-and-failure-patterns.md",binding:"how-to/binding-and-catalog.md",io:"how-to/data-between-steps.md",execution:"how-to/polling-and-retries.md",runs:"how-to/runs-and-environments.md",code:"how-to/code-mode.md",lenses:"how-to/lenses.md",scenarios:"how-to/scenario-tests.md"};function Sa({topic:e,about:t}){return _(n=>n.viewer)?null:(0,c.jsx)("button",{type:"button",className:"icon afd-help-link","aria-label":`Help: ${t}`,title:`The guide on ${t}`,onClick:()=>je({type:"openGuide",page:hB[e]}),children:(0,c.jsx)("span",{className:"codicon codicon-question","aria-hidden":"true"})})}function Nh({id:e,title:t,children:n,placeholder:r,submit:a,initial:s,target:l,record:f,close:p}){let[h,v]=(0,A.useState)(""),g=(0,A.useRef)(null),m=(0,A.useRef)(null),b=nl(m);return(0,A.useEffect)(()=>{v(s??""),setTimeout(()=>g.current?.focus(),0)},[l]),(0,c.jsx)("div",{className:"afd-modal-backdrop",children:(0,c.jsxs)("form",{ref:m,className:"afd-modal",role:"dialog","aria-modal":"true","aria-labelledby":`${e}-title`,onSubmit:async w=>{w?.preventDefault(),h.trim()&&(await f(h)).ok&&p()},onKeyDown:w=>{b(w),w.key==="Escape"&&(w.stopPropagation(),p())},children:[(0,c.jsx)("h2",{id:`${e}-title`,children:t}),(0,c.jsx)("p",{className:"muted",children:n}),(0,c.jsxs)("div",{className:"afd-field",children:[(0,c.jsx)("label",{htmlFor:`${e}-reason`,children:"Reason (required)"}),(0,c.jsx)("textarea",{id:`${e}-reason`,ref:g,className:"afd-input",rows:3,value:h,placeholder:r,onChange:w=>v(w.target.value)})]}),(0,c.jsxs)("div",{className:"afd-modal-actions",children:[(0,c.jsx)("button",{type:"button",className:"secondary",onClick:p,children:"Cancel"}),(0,c.jsx)("button",{type:"submit",disabled:!h.trim(),children:a})]})]})})}function pB(){let e=_(r=>r.sync),t=e.scan,n=t?.git;return(0,c.jsxs)("div",{className:"afd-sync-source","data-sync-state":e.state,children:[n?.commit?(0,c.jsxs)("span",{children:[(0,c.jsx)("span",{className:"codicon codicon-git-commit","aria-hidden":"true"})," git"," ",(0,c.jsx)("span",{className:"mono",children:n.branch??"detached"})," @"," ",(0,c.jsx)("span",{className:"mono",children:n.commit}),n.when?(0,c.jsxs)("span",{className:"muted",children:[" \xB7 ",fh(n.when)]}):null]}):t?(0,c.jsx)("span",{className:"muted",children:"Not a Git repository: the working tree as it is"}):null,n&&n.dirty.length>0?(0,c.jsxs)("span",{className:"afd-badge tone-warn",title:n.dirty.join(`
|
|
172
|
+
`),children:[n.dirty.length," uncommitted"]}):null,t?(0,c.jsxs)("span",{className:"muted afd-sync-env",children:[t.environment," \xB7 scanned ",fh(t.at)]}):null,e.state==="syncing"?(0,c.jsxs)("span",{className:"muted",role:"status",children:[(0,c.jsx)("span",{className:"codicon codicon-loading codicon-modifier-spin","aria-hidden":"true"})," ","Compiling the code in the environment\u2026"]}):null,e.state==="error"?(0,c.jsx)("span",{className:"afd-catalog-error",role:"alert",children:e.error}):null]})}function jh({item:e}){let t=_(a=>a.reveal),[n,r]=(0,A.useState)(!1);return(0,c.jsxs)("li",{className:`afd-drift-item kind-${e.kind} sev-${e.severity}${e.ignored?" ignored":""}`,"data-drift":e.id,children:[(0,c.jsxs)("div",{className:"afd-drift-head",children:[e.node?(0,c.jsx)("button",{type:"button",className:"link",onClick:()=>t(e.node),children:e.title}):(0,c.jsx)("strong",{children:e.title}),(0,c.jsxs)("span",{className:"muted",children:[" \xB7 ",e.label]})]}),(0,c.jsx)("p",{className:"afd-drift-detail",children:e.detail}),e.ignored?(0,c.jsxs)("p",{className:"muted afd-drift-ignored",children:["Ignored",e.ignored.by?` by ${e.ignored.by}`:"",": ",e.ignored.reason]}):null,(0,c.jsx)("div",{className:"afd-drift-actions",children:e.actions.map((a,s)=>(0,c.jsx)("button",{type:"button",className:s===0&&!e.ignored?"":"secondary",disabled:n,onClick:async()=>{r(!0),await fB(a.action),r(!1)},children:a.label},`${a.label}|${JSON.stringify(a.action)}`))})]})}function mB({run:e,nodes:t}){let n=e?.state==="done"?e.summary:void 0;if(!n)return null;let r=new Set(n.failures.map(l=>l.node)),a=0,s=0;for(let l of t)r.has(l.node)?s++:n.nodes[l.node]&&a++;return(0,c.jsxs)("section",{className:"afd-section","data-last-run-summary":!0,children:[(0,c.jsxs)("h3",{children:["Last ",e?.mode==="check"?"skeleton run":"run"]}),(0,c.jsxs)("p",{children:["ok ",a," \xB7 failed ",s," \xB7 not run ",t.length-a-s,(0,c.jsxs)("span",{className:"muted",children:[" \xB7 ",fh(e?.finishedAt??e?.startedAt)]})]})]})}function gB(){let e=_(v=>v.drift),t=_(v=>v.sync),n=_(v=>v.run),[r,a]=(0,A.useState)(!1),[s,l]=(0,A.useState)(!1),f=e?.items.filter(v=>!v.ignored&&v.severity==="warning")??[],p=e?.items.filter(v=>!v.ignored&&v.severity==="info")??[],h=e?.items.filter(v=>v.ignored)??[];return(0,c.jsxs)("div",{className:"afd-panel-body","data-drift-panel":!0,children:[(0,c.jsxs)("div",{className:"afd-panel-head",children:[(0,c.jsxs)("h2",{className:"afd-panel-title",children:["Design vs code ",(0,c.jsx)(Sa,{topic:"code",about:"Code mode"})]}),(0,c.jsxs)("button",{type:"button",disabled:t.state==="syncing",onClick:()=>je({type:"sync"}),title:"Compile the generated code and the bound roles and playbooks in the environment, and compare them with the design",children:[(0,c.jsx)("span",{className:`codicon ${t.state==="syncing"?"codicon-loading codicon-modifier-spin":"codicon-sync"}`,"aria-hidden":"true"})," ",t.state==="syncing"?"Syncing\u2026":"Re-sync from Git"]})]}),(0,c.jsx)(pB,{}),!e&&t.state!=="syncing"?(0,c.jsx)("p",{className:"muted",children:"Re-sync to compile the generated code and every bound role and playbook in the environment, then compare them with the design."}):null,e?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsxs)("p",{className:"afd-matched","data-matched":`${e.matched}/${e.matchable}`,children:[(0,c.jsxs)("strong",{children:[e.matched," / ",e.matchable]})," ","nodes matched by ID"]}),(0,c.jsxs)("p",{children:[(0,c.jsx)("strong",{children:f.length})," drift item",f.length===1?"":"s"]}),(0,c.jsx)("ul",{className:"afd-drift-list",children:f.map(v=>(0,c.jsx)(jh,{item:v},`${v.node}|${v.id}`))}),p.length>0?(0,c.jsxs)("section",{className:"afd-section","data-drift-notes":p.length,children:[(0,c.jsxs)("button",{type:"button",className:"link",onClick:()=>l(!s),children:[s?"Hide":"Show"," ",p.length," note",p.length===1?"":"s"]}),s?(0,c.jsx)("ul",{className:"afd-drift-list",children:p.map(v=>(0,c.jsx)(jh,{item:v},`${v.node}|${v.id}`))}):null]}):null,h.length>0?(0,c.jsxs)("section",{className:"afd-section",children:[(0,c.jsxs)("button",{type:"button",className:"link",onClick:()=>a(!r),children:[r?"Hide":"Show"," ",h.length," ignored"]}),r?(0,c.jsx)("ul",{className:"afd-drift-list",children:h.map(v=>(0,c.jsx)(jh,{item:v},`${v.node}|${v.id}`))}):null]}):null,(0,c.jsx)(mB,{run:n,nodes:Object.values(e.nodes).filter(v=>v.artifact!=="start"&&v.artifact!=="end")})]}):null]})}function yB({id:e}){let t=_(l=>l.drift),n=_(l=>l.snapshot?.doc),r=_(l=>l.select);if(!(n&&$e(n).nodes.get(e)?.node))return null;let a=t?.nodes[e],s=t?.items.filter(l=>l.node===e)??[];return(0,c.jsxs)("div",{className:"afd-panel-body","data-node-code":e,children:[(0,c.jsx)("div",{className:"afd-inspector-head",children:(0,c.jsxs)("button",{type:"button",className:"link",onClick:()=>r({}),children:[(0,c.jsx)("span",{className:"codicon codicon-arrow-left","aria-hidden":"true"})," All drift"]})}),a?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("p",{className:"mono",children:a.artifact}),(0,c.jsx)("p",{children:a.matched?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("span",{className:"codicon codicon-pass","aria-hidden":"true"})," Matched by ID in the generated code"," ",a.play?(0,c.jsx)("button",{type:"button",className:"link",onClick:()=>je({type:"openCode",path:a.play?.path??"",line:a.play?.line}),children:"open play"}):null]}):(0,c.jsx)("span",{className:"muted",children:"No generated play is tagged with this node."})}),a.missing&&a.missing!=="not scanned"?(0,c.jsx)("p",{className:"afd-catalog-error",children:a.missing}):null,a.tasks.length>0?(0,c.jsxs)("section",{className:"afd-section",children:[(0,c.jsxs)("h3",{children:[a.tasks.length," task",a.tasks.length===1?"":"s",a.dynamic>0?(0,c.jsxs)("span",{className:"muted",children:[" \xB7 ",a.dynamic," dynamic include, not expanded"]}):null]}),(0,c.jsx)("ul",{className:"afd-code-tasks",children:a.tasks.map((l,f)=>(0,c.jsxs)("li",{className:l.dynamic?"dynamic":"",children:[(0,c.jsx)("span",{children:l.name||l.action})," ",(0,c.jsx)("span",{className:"muted mono",children:l.action}),l.origin?(0,c.jsxs)("button",{type:"button",className:"link mono",onClick:()=>je({type:"openCode",path:l.origin?.path??"",line:l.origin?.line}),children:[l.origin.path.split("/").slice(-2).join("/"),":",l.origin.line]}):null]},f))})]}):null]}):(0,c.jsx)("p",{className:"muted",children:"Re-sync to see the code this node runs."}),s.length>0?(0,c.jsx)("ul",{className:"afd-drift-list",children:s.map(l=>(0,c.jsx)(jh,{item:l},l.id))}):null]})}function vB(){let e=_(n=>n.ignore),t=_(n=>n.setIgnore);return e?(0,c.jsxs)(Nh,{id:"afd-ignore",title:"Accept with Reason",placeholder:"e.g. The role runs it from main",submit:"Accept",target:e,record:n=>Pe({kind:"ignoreDrift",node:e.node,item:e.item,reason:n}),close:()=>t(null),children:[(0,c.jsx)("strong",{children:e.title})," \xB7 ",e.label,". Code and design stay as they are; the item moves to the ignored list. The decision is recorded in the flow with your Git user name."]}):null}var bB=new Set(["tasks_from","vars_from","defaults_from","handlers_from","public","allow_duplicates","rolespec_validate"]),xB=new Set(["when","loop","loop_control","vars","ignore_errors","no_log","run_once","debugger"]);function wB(e){return/^(ansible\.(builtin|legacy)\.)?include_tasks$/.test(e??"")}function kB(e,t,n){let r=`node_${e.id}`,a=Object.entries(t.keywords??{});if(t.kind==="role"){let v={name:t.ref},g={};for(let[w,k]of Object.entries(t.params??{}))(bB.has(w)?v:g)[w]=k;let m={},b={};for(let[w,k]of a)w!=="vars"&&((w4.has(w)||Zf.test(w)?m:b)[w]=k);return v.apply={tags:q0([r]),timeout:n,...b},{name:`[${e.key}] Apply role`,"ansible.builtin.include_role":v,...m,vars:Object.keys(g).length>0?g:void 0}}let s=Ys(e,t);if(wB(t.ref)){let v={},g={};for(let[b,w]of a)(xB.has(b)||Zf.test(b)?v:g)[b]=w;let m=typeof t.params=="string"?{file:t.params}:t.params??{};return{name:`[${e.key}] ${hC(yC(e.title))}`,[t.ref]:{...m,apply:{tags:q0([r]),timeout:n,...g}},...v,register:s}}let{retries:l,delay:f,until:p}=e.settings??{},h=p?.trim()||(l?`${s} is succeeded`:void 0);return{name:`[${e.key}] ${hC(yC(e.title))}`,[t.ref]:t.params??{},...Object.fromEntries(a),register:s,ignore_unreachable:!0,timeout:n,retries:l,delay:h?f:void 0,until:h}}function SB(e,t){if(t.kind==="playbook")return eh([{import_playbook:t.ref,vars:{afd_hosts:"<hosts arriving here>"}}],0).join(`
|
|
173
|
+
`);let n=kB(e,t);return t.kind==="module"&&(delete n.ignore_unreachable,n.tags=q0([`node_${e.id}`])),eh([n],0).join(`
|
|
174
|
+
`)}var NB=e=>e.withErrors+e.editedByHand>0;function jB(e){let t=[],n=(r,a)=>{if(!r)return;let s=t.length?"":r===1?"flow ":"flows ";t.push(`${r} ${s}${a}`)};return n(e.withErrors,"with errors"),n(e.editedByHand,"with code edited by hand"),n(e.outOfDate,"with code out of date"),t.length?`In this workspace: ${t.join(", ")}`:e.flows>1?"Other flows of this workspace have no problems":"No other flows in this workspace"}var vo=typeof navigator<"u"&&/Mac|iPhone|iPad/i.test(navigator.platform||navigator.userAgent),Vo=vo?"\u2318":"Ctrl+",Iy=[{id:"copy",keys:`${Vo}C`,label:"Copy the selected nodes, as YAML text",group:"Edit"},{id:"cut",keys:`${Vo}X`,label:"Cut the selected nodes",group:"Edit"},{id:"paste",keys:`${Vo}V`,label:"Paste nodes at the pointer",group:"Edit"},{id:"duplicate",keys:`${Vo}D`,label:"Duplicate the selected nodes",group:"Edit"},{id:"delete",keys:"Delete",label:"Delete the selection: the path closes behind it (Shift+Delete leaves the gap)",group:"Edit"},{id:"rename",keys:"F2",label:"Rename the selected node on the canvas, or edit a note's text",group:"Edit"},{id:"undo",keys:`${Vo}Z`,label:"Undo (VS Code keeps one step per change)",group:"Edit"},{id:"redo",keys:vo?"\u21E7\u2318Z":"Ctrl+Y",label:"Redo",group:"Edit"},{id:"disable",keys:"D",label:"Disable the selected steps (their hosts pass through), or enable them again",group:"Edit"},{id:"addNode",keys:"N",label:"Add a node: after the selected one, else at the pointer",group:"Edit"},{id:"addNote",keys:"Shift+N",label:"Add a note: on the selected node, else at the pointer",group:"Edit"},{id:"open",keys:"Enter",label:"Open the selected subflow, or go to the node's Details",group:"Move around"},{id:"up",keys:vo?"\u2325\u2191":"Alt+\u2191",label:"Up to the parent level",group:"Move around"},{id:"menu",keys:"Shift+F10",label:"Menu for the selection, or the canvas",group:"Move around"},{id:"find",keys:`${Vo}F`,label:"Find a node on any level",group:"Move around"},{id:"follow",keys:`${Vo}\u2193 / ${Vo}\u2191`,label:"Follow a wire: the next step, or the one before",group:"Move around"},{id:"ports",keys:"Tab, Enter",label:"The selected node's ports; Enter opens a port's menu",group:"Move around"},{id:"pick",keys:"Tab or arrows, Enter",label:"While connecting: show a node, then wire it",group:"Move around"},{id:"modes",keys:vo?"\u23251, \u23252, \u23253":"Alt+1, Alt+2, Alt+3",label:"Design, Code or Run mode",group:"Move around"},{id:"nudge",keys:"Arrow keys",label:"Nudge the focused node (Shift: further)",group:"Canvas"},{id:"select",keys:`${Vo}click, Shift+drag`,label:"Select several nodes",group:"Canvas"},{id:"selectAll",keys:`${Vo}A`,label:"Select every node of the level",group:"Canvas"},{id:"alignCenter",keys:vo?"\u21E7\u2325A":"Shift+Alt+A",label:"Line the selected steps up on the flow line (Align Centers)",group:"Canvas"},{id:"distribute",keys:vo?"\u21E7\u2325D":"Shift+Alt+D",label:"Space three or more selected steps evenly, top to bottom",group:"Canvas"},{id:"fit",keys:"Shift+1",label:"Fit the whole level in view",group:"Canvas"},{id:"zoomSelection",keys:"Shift+2",label:"Zoom to the selection",group:"Canvas"},{id:"escape",keys:"Esc",label:"Close the menu or dialog; else clear the selection",group:"Canvas"},{id:"help",keys:"?",label:"This list",group:"Canvas"},{id:"runSkeleton",keys:"Ctrl+F5",label:"Run as Skeleton",group:"Flow"},{id:"stopRun",keys:"Shift+F5",label:"Stop Run",group:"Flow"},{id:"generate",keys:vo?"\u21E7\u2318B":"Ctrl+Shift+B",label:"Generate Code",group:"Flow"},{id:"tidyUp",keys:vo?"\u21E7\u2325F":"Shift+Alt+F",label:"Tidy Up",group:"Flow"},{id:"check",keys:"F7",label:"Check Flow",group:"Flow"}];function Na(e){return e?Iy.find(t=>t.id===e)?.keys:void 0}function CB(e,t,n,r){let a=e.nodes.get(t.id);if(!a)return r;let s=F0(e,t,a.level,n,r),l=f=>f.length?` \xB7 ${f.join(".")}`:"";switch(s.kind){case"flow":return`flow input ${s.name}${l(s.path)}`;case"impl":return`this step's result${l(s.path[0]==="register"?s.path.slice(1):s.path)}`;case"output":case"subflowInput":return`"${s.node.title}" \xB7 ${s.name}${l(s.path)}`;case"unresolved":return r}}function $B(e){return e==null?"":Array.isArray(e)?e.map(String).join(", "):typeof e=="object"?JSON.stringify(e):String(e)}function EB(e,t){let n=t.trim();if(!n)return{};switch(e){case"integer":return/^-?[0-9]+$/.test(n)?{value:Number(n)}:{problem:"A whole number"};case"boolean":{let r=n.toLowerCase();return["true","yes"].includes(r)?{value:!0}:["false","no"].includes(r)?{value:!1}:{problem:"true or false"}}case"list":case"host_list":return{value:n.split(/[,\n]/).map(r=>r.trim()).filter(Boolean)};case"dict":try{let r=kr(n);if(r&&typeof r=="object"&&!Array.isArray(r))return{value:r}}catch{}return{problem:"A map, like {site: fra1}"};case"any":try{return{value:kr(n)}}catch{return{value:n}}default:return{value:n}}}var _B=["string","integer","boolean","list","dict","host_list","any"];function AB({name:e,value:t,onCommit:n}){let[r,a]=(0,A.useState)(t),[s,l]=(0,A.useState)(t);t!==s&&(l(t),a(t));let f=()=>r.trim()!==t&&n(r.trim());return(0,c.jsx)("input",{className:"afd-input afd-contract-description","aria-label":`What ${e} is for`,placeholder:"What it is for (shown when a run asks)",value:r,"data-input-description":e,onChange:p=>a(p.target.value),onBlur:f,onKeyDown:p=>p.key==="Enter"&&f()})}function TB({name:e,type:t,value:n,onCommit:r}){let a=$B(n),[s,l]=(0,A.useState)(a),[f,p]=(0,A.useState)(a),[h,v]=(0,A.useState)();a!==f&&(p(a),l(a));let g=()=>{if(s.trim()===a)return v(void 0);let m=EB(t,s);v(m.problem),m.problem||r(m.value)};return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("input",{className:`afd-input mono afd-contract-default${h?" invalid":""}`,"aria-label":`Default for ${e}`,"aria-invalid":!!h,placeholder:"Default (when a run gives none)",value:s,"data-input-default":e,onChange:m=>l(m.target.value),onBlur:g,onKeyDown:m=>m.key==="Enter"&&g()}),h?(0,c.jsx)("span",{className:"afd-field-error",children:h}):null]})}var Ly=/^[A-Za-z_][A-Za-z0-9_]*$/;function Ry({title:e,target:t,side:n,contract:r,withFrom:a,hint:s}){let[l,f]=(0,A.useState)(""),p=_(b=>b.snapshot?.doc),h=(b,w)=>{let k=p?$e(p):void 0,S=t==="flow"?void 0:k?.nodes.get(t)?.node;return k&&S?CB(k,S,b,w):w},v=Object.entries(r??{}),g=(b,w,k)=>Pe({kind:"setContractField",target:t,side:n,name:b,field:w,rename:k}),m=()=>{let b=l.trim();!Ly.test(b)||b in(r??{})||g(b,t==="flow"&&n==="inputs"?{type:"string",required:!0}:{type:"string"}).then(w=>w.ok&&f(""))};return(0,c.jsxs)("section",{className:"afd-section",children:[(0,c.jsx)("h3",{children:e}),s?(0,c.jsx)("p",{className:"muted",children:s}):null,v.length===0?(0,c.jsx)("p",{className:"muted",children:"None yet."}):null,(0,c.jsx)("ul",{className:"afd-contract",children:v.map(([b,w])=>(0,c.jsxs)("li",{children:[(0,c.jsx)("span",{className:"mono afd-contract-name",children:b}),(0,c.jsx)("select",{"aria-label":`Type of ${b}`,value:w?.type??"any",onChange:k=>{g(b,{...w,type:k.target.value})},children:_B.map(k=>(0,c.jsx)("option",{value:k,children:k},k))}),n==="inputs"?(0,c.jsxs)("label",{className:"afd-check",title:"Required",children:[(0,c.jsx)("input",{type:"checkbox",checked:!!w?.required,onChange:k=>{g(b,{...w,required:k.target.checked||void 0})}}),"required"]}):null,a&&w?.from?(0,c.jsxs)("span",{className:"muted afd-contract-from",title:`Source of the value: ${w.from}`,children:["\u2190 ",h(n,w.from)]}):null,(0,c.jsx)("button",{type:"button",className:"icon","aria-label":`Remove ${b}`,onClick:()=>{g(b,null)},children:(0,c.jsx)("span",{className:"codicon codicon-trash","aria-hidden":"true"})}),t==="flow"&&n==="inputs"&&!w?.targets?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(AB,{name:b,value:w?.description??"",onCommit:k=>{g(b,{...w,description:k||void 0})}}),(0,c.jsx)(TB,{name:b,type:w?.type??"any",value:w?.default,onCommit:k=>{let S={...w};k===void 0?delete S.default:(S.default=k,delete S.required),g(b,S)}})]}):null]},b))}),(0,c.jsxs)("div",{className:"afd-inline-add",children:[(0,c.jsx)("input",{className:`afd-input mono${l&&!Ly.test(l.trim())?" invalid":""}`,placeholder:"new_name","aria-label":`New ${n.slice(0,-1)} name`,value:l,onChange:b=>f(b.target.value),onKeyDown:b=>b.key==="Enter"&&m()}),(0,c.jsx)("button",{type:"button",className:"secondary",onClick:m,disabled:!Ly.test(l.trim()),children:"Add"})]})]})}function fn({label:e,value:t,onCommit:n,multiline:r,mono:a,placeholder:s,validate:l,focusKey:f,problem:p,suggestions:h}){let v=(0,A.useId)(),g=(0,A.useRef)(null);R$(f,g);let[m,b]=(0,A.useState)(t);(0,A.useEffect)(()=>b(t),[t]);let w=(0,A.useRef)(!1),k=m===t?p:l?.(m),S=()=>{w.current?w.current=!1:m!==t&&(l?.(m)?b(t):n(m))},N={id:v,ref:g,value:m,placeholder:s,className:`afd-input${a?" mono":""}${k?" invalid":""}`,onBlur:S,onKeyDown:$=>{$.key==="Escape"?($.preventDefault(),w.current=!0,b(t),$.target.blur(),w.current=!1):$.key==="Enter"&&(!r||$.ctrlKey||$.metaKey)&&($.preventDefault(),S())},"aria-invalid":!!k,"aria-describedby":k?`${v}-error`:void 0};return(0,c.jsxs)("div",{className:"afd-field",children:[(0,c.jsx)("label",{htmlFor:v,children:e}),r?(0,c.jsx)("textarea",{...N,rows:3,onChange:$=>b($.target.value)}):(0,c.jsx)("input",{...N,list:h?.length?`${v}-list`:void 0,onChange:$=>b($.target.value)}),h?.length?(0,c.jsx)("datalist",{id:`${v}-list`,children:h.map($=>(0,c.jsx)("option",{value:$},$))}):null,k?(0,c.jsx)("div",{className:"afd-field-error",id:`${v}-error`,children:k}):null]})}function il({label:e,value:t,mono:n}){return(0,c.jsxs)("div",{className:"afd-field",children:[(0,c.jsx)("span",{className:"afd-label",children:e}),(0,c.jsx)("span",{className:`afd-readonly${n?" mono":""}`,children:t})]})}function sE({repo:e,hook:t}){return(0,c.jsxs)("p",{className:"muted",[t]:"",children:[e?`${jB(e)}: `:"Other flows of this workspace, with their problems and code state: ",(0,c.jsx)("button",{type:"button",className:"link",onClick:()=>je({type:"showFlows"}),children:"Flows View"})]})}function MB(){let e=_(p=>p.snapshot),t=_(p=>p.repo),n=wa(),r=e?.doc;if(!r?.flow)return(0,c.jsx)("p",{className:"muted",children:"No flow loaded."});let{flow:a}=r,s=$e(r),l=A5(r),f=p=>Pe({kind:"updateFlow",patch:p});return(0,c.jsxs)("div",{className:"afd-panel-body",children:[(0,c.jsx)("h2",{children:"Flow"}),t&&NB(t)?(0,c.jsx)(sE,{repo:t,hook:"data-repo-line"}):null,(0,c.jsxs)("fieldset",{className:"afd-editable",disabled:!n,children:[(0,c.jsx)(fn,{label:"Name",value:a.name??"",onCommit:p=>{f({name:p})},validate:p=>p.trim()?void 0:"Required"}),(0,c.jsx)(fn,{label:"Goal",value:a.goal??"",multiline:!0,placeholder:"What this flow achieves, in one sentence",onCommit:p=>{f({goal:p.trim()?p:null})}}),(0,c.jsx)(Ry,{title:"Inputs",target:"flow",side:"inputs",contract:a.inputs,hint:"What the flow asks for when it runs. devices: the hosts it runs on."}),(0,c.jsxs)(jr,{id:"flow-details",open:!G0.test(a.key??""),summary:`More details: ${a.key} \xB7 version ${a.version}${a.owner?` \xB7 owner ${a.owner}`:""}`,children:[(0,c.jsx)(fn,{label:"Key",value:a.key??"",mono:!0,onCommit:p=>{f({key:p})},validate:p=>G0.test(p)?void 0:"Lowercase words joined by dashes"}),(0,c.jsx)(il,{label:"ID (fixed)",value:a.id,mono:!0}),(0,c.jsx)(il,{label:"Version",value:String(a.version)}),(0,c.jsx)(fn,{label:"Owner",value:a.owner??"",onCommit:p=>{f({owner:p.trim()?p:null})}}),(0,c.jsx)(il,{label:"Runtime",value:a.runtime&&s?[O0(s),a.runtime.template,a.runtime.credentials?.length?`credentials ${a.runtime.credentials.join(", ")}`:"",a.runtime.execution_environment?`EE ${a.runtime.execution_environment}`:""].filter(Boolean).join(" \xB7 "):"not set"}),a.imported_from&&(0,c.jsx)(il,{label:"Imported from",value:PB(a.imported_from)}),(0,c.jsx)(fn,{label:"Maintenance window",value:a.maintenance_window??"",mono:!0,placeholder:"e.g. 4h or 2h30m",onCommit:p=>{f({maintenance_window:p.trim()?p:null})},validate:p=>!p.trim()||/^([0-9]+[smhd])+$/.test(p.trim().toLowerCase().replaceAll(/\s+/g,""))?void 0:"A duration like 4h, 90m or 2h30m"})]})]}),l.total>0?(0,c.jsxs)("section",{className:"afd-section",children:[(0,c.jsx)("h3",{children:"Readiness"}),(0,c.jsxs)("ul",{className:"afd-readiness",children:[ay.map(p=>(0,c.jsx)("li",{children:(0,c.jsxs)("button",{type:"button",className:"afd-readiness-link","data-find-filter":`status:${p}`,title:`List the ${p} steps on every level (Find status:${p})`,onClick:()=>dE(`status:${p}`),children:[(0,c.jsx)(gh,{status:p,label:!1}),p,(0,c.jsx)("strong",{children:l.counts[p]})]})},p)),(0,c.jsx)("li",{children:(0,c.jsxs)("button",{type:"button",className:"afd-readiness-link","data-find-filter":"open:fail",title:"List the steps with an open fail port (Find open:fail)",onClick:()=>dE("open:fail"),children:[(0,c.jsx)("span",{className:"codicon codicon-warning","aria-hidden":"true"}),"open fail ports",(0,c.jsx)("strong",{children:e?JC(e.openPorts):0})]})})]}),l.total>=2?(0,c.jsx)(lE,{}):null,(0,c.jsx)(sE,{repo:t,hook:"data-flows-link"})]}):null]})}function lE(){return(0,c.jsxs)("p",{className:"muted","data-select-hint":!0,children:["To work on several steps at once, select them with"," ",Iy.find(e=>e.id==="select")?.keys,": then line them up, space them evenly, copy them or make them a subflow."]})}function dE(e){let t=_.getState();t.openFind(!0),t.setFindQuery(e)}var OB={awx_workflow:"AWX workflow",awx_job_template:"AWX job template",playbook:"Playbook"};function PB(e){let t=e.template?`"${e.template}"`:e.path??"",n=e.id===void 0?"":` (id ${e.id})`,r=e.template&&e.path?` \xB7 ${e.path}`:"";return`${OB[e.kind]??e.kind} ${t}${n}${r}`.trim()}function uE(e){let t=_.getState().setHighlight;return{onMouseEnter:()=>t(e.length?e:null),onMouseLeave:()=>t(null),onFocus:()=>t(e.length?e:null),onBlur:()=>t(null)}}var DB=e=>e.length===1?e[0]:void 0,cE=e=>e.node?[e.node]:e.nodes;function fE(e,t){let n=_(a=>a.snapshot?.doc),r=DB(e);return t&&n&&r?o6($e(n),r):void 0}function hE(e,t){return e?r6($e(e),t):!1}function pE({f:e,onStep:t,onFixed:n,places:r=!1}){let a=_(v=>v.setAccept),s=_(v=>v.reveal),l=_(v=>v.openDetails),f=_(v=>v.setError),p=fE(cE(e),r),h=t?{"data-node-finding":e.id}:{"data-finding":e.id};return(0,c.jsxs)("li",{className:`afd-finding severity-${e.severity}${e.accepted?" accepted":""}`,...h,"data-accepted":e.accepted?"true":void 0,...uE(e.nodes),children:[(0,c.jsxs)("div",{className:"afd-finding-title",children:[(0,c.jsx)("span",{className:`codicon ${e.accepted?"codicon-pass":e.severity==="warning"?"codicon-warning":"codicon-info"}`,"aria-hidden":"true"})," ",e.title,p?(0,c.jsxs)("span",{className:"afd-finding-place muted","data-finding-place":!0,children:[" ","\xB7 ",p]}):null]}),(0,c.jsx)("p",{className:"afd-finding-detail",children:e.detail}),e.accepted?(0,c.jsxs)("p",{className:"afd-finding-accepted muted",children:["Expected: ",e.accepted.reason,e.accepted.by?` (${e.accepted.by})`:""," ",(0,c.jsx)("button",{type:"button",className:"link",onClick:()=>{Pe({kind:"clearFindingAccept",finding:e.id})},children:"Reopen"})]}):(0,c.jsxs)("div",{className:"afd-finding-actions",children:[e.acceptFirst?(0,c.jsx)("button",{type:"button","data-accept-first":!0,onClick:()=>a({id:e.id,node:e.node,title:e.title}),children:"Accept with Reason\u2026"}):null,e.fixes.map(v=>"command"in v?(0,c.jsx)("button",{type:"button",onClick:()=>{Pe(v.command).then(g=>{if(!g.ok)return f(g.error??"The fix failed");_.getState().setHighlight(null),n?.(e)})},children:v.label},v.label):(0,c.jsx)("button",{type:"button",className:"secondary",onClick:()=>{s(v.properties),l(v.properties)},children:v.label},v.label)),e.acceptFirst?null:(0,c.jsx)("button",{type:"button",className:"secondary",onClick:()=>a({id:e.id,node:e.node,title:e.title}),children:"Accept with Reason\u2026"})]})]})}function mE(e,t,n=()=>!1){let r=t?e.findIndex(a=>a.id===t)+1:0;return[...e.slice(r),...e.slice(0,r)].find(a=>!a.accepted&&a.id!==t&&!n(a))}function IB({id:e}){let t=_(h=>h.lens),n=_(h=>h.lensView),[r,a]=(0,A.useState)(null);if(!t||!n)return null;let s=h=>h.node===e||h.nodes.includes(e),l=n.findings.filter(s),f=sa.find(h=>h.id===t)?.label??t,p=r?mE(n.findings,r,s):void 0;return l.length===0&&!r?null:(0,c.jsxs)("div",{className:"afd-step-findings","data-step-findings":e,children:[l.length>0?(0,c.jsx)(jr,{id:`lens-${t}`,summary:`Lens: ${f} \xB7 ${l.length} on this step`,open:l.some(h=>!h.accepted),children:(0,c.jsx)("ul",{className:"afd-findings",children:l.map(h=>(0,c.jsx)(pE,{f:h,onStep:!0,onFixed:v=>a(v.id)},h.id))})}):(0,c.jsxs)("p",{className:"muted",role:"status",children:["No ",f," findings left on this step."]}),p&&!l.some(h=>!h.accepted)?(0,c.jsxs)("button",{type:"button",className:"link","data-next-finding":p.id,onClick:()=>{let h=p.node??p.nodes[0];h&&_.getState().reveal(h)},children:["Next Finding: ",p.title]}):null]})}function LB(e,t){let n=new Date(e.startedAt);return`${Number.isNaN(n.getTime())?e.id:n.toLocaleString(t,{day:"numeric",month:"short",hour:"2-digit",minute:"2-digit"})} \xB7 ${e.partial?"part of the flow":e.mode==="check"?"skeleton":"real run"} \xB7 ${`${e.hosts} host${e.hosts===1?"":"s"}`}, ${e.ok?e.failed?`${e.failed} failed`:"all passed":"did not finish"}`}var zy=new Map,RB=1;Yg(e=>{if(e.type!=="runOutputReply")return;let t=zy.get(e.reqId);zy.delete(e.reqId),t?.({entries:e.entries,error:e.error})});function zB(e,t){let n=RB++;return new Promise(r=>{zy.set(n,r),je({type:"runOutput",reqId:n,node:e,host:t})})}function Fy({run:e}){let t=_(s=>s.pastRuns),n=_(s=>s.snapshot?.doc?.flow.version);if(t.length===0||t.length===1&&t[0]?.id===e?.id)return null;let r=t.some(s=>s.id===e?.id)?e?.id:"",a=e?.past&&e.flowVersion!==void 0&&n!==void 0&&e.flowVersion!==n;return(0,c.jsxs)("div",{className:"afd-field afd-past-runs","data-past-runs":t.length,children:[(0,c.jsx)("label",{htmlFor:"afd-past-run",children:"Earlier runs"}),(0,c.jsxs)("select",{id:"afd-past-run",className:"afd-input",value:r??"",onChange:s=>s.target.value&&w8(s.target.value),children:[r?null:(0,c.jsx)("option",{value:"",children:"The run shown is not among the kept runs"}),t.map(s=>(0,c.jsx)("option",{value:s.id,title:s.partial,children:LB(s)},s.id))]}),a?(0,c.jsxs)("p",{className:"muted","data-past-version":e?.flowVersion,children:[(0,c.jsx)("span",{className:"codicon codicon-history","aria-hidden":"true"})," This run is of version"," ",e?.flowVersion," of the flow; it is at version ",n," now, so steps may have changed since."]}):null]})}function FB(e){return e.scenario?`Scenario: ${e.scenario.name} (stubs, local connection)`:e.partial?`Local skeleton run of part of the flow. ${e.partial.line}`:e.source==="awx"&&e.awx?`AWX ${e.awx.workflow?"workflow":"job"} #${e.awx.jobId} \xB7 ${e.awx.template}`:e.mode==="check"?"Local skeleton run (check mode)":"Local real run"}function BB(e){if(e.state==="running")return{label:e.awx?`running (${e.awx.status})`:e.quiet?"running \xB7 no new events for 20 s":"running",tone:e.quiet?"warn":"neutral"};if(e.scenario)return e.scenario.passed?{label:"passed: every host ended where expected",tone:"ok"}:{label:e.scenario.error??`${J0(e.scenario).length} host(s) ended elsewhere`,tone:"warn"};if(e.state==="error")return{label:e.error??"failed",tone:"warn"};if(Wj(e))return{label:`passed \xB7 exit ${e.rc}`,tone:"ok"};let{ok:t,failed:n}=Kj(e),r=n?` \xB7 ${n} failed`:"";return{label:e.awx?`${e.awx.status} \xB7 exit ${e.rc}${r}`:`exit ${e.rc}${r}`,tone:t?"ok":"warn"}}function gE({run:e}){return(0,c.jsxs)("button",{type:"button",className:"secondary",onClick:()=>je({type:"showRunOutput"}),title:e.awx?e.awx.url:"Show the terminal of the run",children:[(0,c.jsx)("span",{className:`codicon ${e.awx?"codicon-link-external":"codicon-terminal"}`,"aria-hidden":"true"})," ",e.awx?"Open in AWX":"Show Terminal"]})}function qB({run:e}){let t=_(a=>a.snapshot?.doc);if(!t)return null;let n=Wz(t,e);if(n.length===0)return null;let r=$e(t);return(0,c.jsxs)("section",{className:"afd-section","data-tested-proposal":n.length,children:[(0,c.jsx)("h3",{children:"Tested"}),(0,c.jsxs)("p",{children:["This run passed on flow version ",e.flowVersion,". Mark the implemented nodes it ran as tested? Saving the flow records it."]}),(0,c.jsx)("ul",{className:"afd-run-hosts",children:n.map(a=>(0,c.jsx)("li",{children:r.nodes.get(a)?.node.title??a},a))}),(0,c.jsxs)("button",{type:"button",onClick:()=>{Pe({kind:"setStatuses",statuses:Object.fromEntries(n.map(a=>[a,"tested"])),run:{id:e.id,...e.flowVersion===void 0?{}:{flowVersion:e.flowVersion},...e.awx?.revision?{commit:e.awx.revision}:{}}})},children:[(0,c.jsx)("span",{className:"codicon codicon-verified","aria-hidden":"true"})," Mark ",n.length," Node",n.length===1?"":"s"," Tested"]})]})}function HB(){let e=_(a=>a.runNodes),t=_(a=>a.snapshot?.doc);if(!e||!t)return null;let n=$e(t),r=Object.entries(e).filter(([a,s])=>s.failed>0&&n.nodes.get(a)?.node.type!=="subflow").map(([a,s])=>{let l=n.nodes.get(a);return{id:a,r:s,title:l?.node.title??a,trail:l?mh(n,l.level):[]}}).sort((a,s)=>a.trail.join("/").localeCompare(s.trail.join("/"))||a.title.localeCompare(s.title));return r.length===0?null:(0,c.jsxs)("section",{className:"afd-section","data-failed-steps":r.length,children:[(0,c.jsx)("h3",{children:"Failed steps"}),(0,c.jsx)("ul",{className:"afd-run-hosts",children:r.map(({id:a,r:s,title:l,trail:f})=>(0,c.jsxs)("li",{children:[(0,c.jsx)("button",{type:"button",className:"link","data-failed-step":a,onClick:()=>_.getState().reveal(a),children:l})," ",(0,c.jsxs)("span",{className:"muted",children:[f.length?`${f.join(" \u203A ")} \xB7 `:"",s.failed," of ",s.hosts," host",s.hosts===1?"":"s"," failed"]})]},a))})]})}function yE(){let e=_(s=>s.scenarios),t=_(s=>s.scenarioShown),n=_(s=>s.showScenario),r=_(s=>s.snapshot?.doc);if(!e?.length)return null;let a=e.filter(s=>!s.passed).length;return(0,c.jsxs)("section",{className:"afd-section","data-run-scenarios":e.length,children:[(0,c.jsxs)("h3",{children:["Scenarios \xB7"," ",a?`${a} of ${e.length} failed`:`all ${e.length} pass`]}),t?(0,c.jsxs)("p",{"data-scenario-shown":t,children:["On the canvas: scenario ",(0,c.jsx)("strong",{children:t}),"."," ",(0,c.jsx)("button",{type:"button",className:"link",onClick:()=>n(null),children:"Back to Last Run"})]}):null,(0,c.jsx)("ul",{className:"afd-lens-items",children:e.map(s=>{let l=J0(s);return(0,c.jsx)("li",{className:s.passed?"tone-ok":"tone-warn","data-scenario":s.name,children:(0,c.jsxs)("button",{type:"button",className:"afd-lens-item-button","aria-pressed":t===s.name,onClick:()=>n(s.name),title:"Show this scenario on the canvas",children:[(0,c.jsxs)("span",{className:"afd-lens-item-label",children:[s.passed?"pass":"fail"," \xB7 ",s.name]}),s.error?(0,c.jsx)("span",{className:"afd-lens-item-detail muted",children:s.error}):l.length?(0,c.jsx)("span",{className:"afd-lens-item-detail muted","data-scenario-misses":!0,children:l.map(f=>s5(r??void 0,f,s.forced)).join(". ")}):null]})},s.name)})})]})}function VB(){let e=_(l=>l.run),t=_(l=>l.snapshot?.doc),n=_(l=>l.viewer);if(!e&&n)return(0,c.jsxs)("div",{className:"afd-panel-body","data-run-panel":"none",children:[(0,c.jsx)("h2",{className:"afd-panel-title",children:"Run"}),(0,c.jsx)("p",{className:"muted",children:"No run of this flow yet. Run it from the bar above; nodes and wires then show what each host did."}),(0,c.jsx)(Fy,{run:null})]});if(!e)return(0,c.jsxs)("div",{className:"afd-panel-body","data-run-panel":"none",children:[(0,c.jsxs)("h2",{className:"afd-panel-title",children:["Run ",(0,c.jsx)(Sa,{topic:"runs",about:"runs"})]}),(0,c.jsx)("p",{className:"muted",children:"No run of this flow yet. Launch it in AWX, or run it as a skeleton in the local environment; nodes and wires then show what each host did."}),(0,c.jsx)(Fy,{run:null}),(0,c.jsx)(yE,{})]});let r=BB(e),a=e.summary,s=Object.entries(a?.outcome??{});return(0,c.jsxs)("div",{className:"afd-panel-body","data-run-panel":e.state,children:[(0,c.jsxs)("h2",{className:"afd-panel-title",children:["Run ",(0,c.jsx)(Sa,{topic:"runs",about:"runs"})]}),(0,c.jsx)(yE,{}),(0,c.jsx)(Fy,{run:e}),(0,c.jsxs)("dl",{className:"afd-run-facts",children:[(0,c.jsx)("dt",{children:"Run"}),(0,c.jsx)("dd",{children:FB(e)}),(0,c.jsx)("dt",{children:"Status"}),(0,c.jsx)("dd",{className:`tone-${r.tone}`,"data-run-status":e.awx?.status??e.state,children:r.label}),(0,c.jsx)("dt",{children:"When"}),(0,c.jsx)("dd",{title:e.finishedAt??e.startedAt,children:fh(e.finishedAt??e.startedAt)}),e.environment?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("dt",{children:"Where"}),(0,c.jsx)("dd",{className:"mono",children:e.environment})]}):null,e.awx?.revision?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("dt",{children:"Commit"}),(0,c.jsx)("dd",{className:"mono",title:e.awx.revision,children:e.awx.revision.slice(0,10)})]}):null,e.flowVersion===void 0?null:(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("dt",{children:"Flow"}),(0,c.jsxs)("dd",{children:["v",e.flowVersion,t&&t.flow.version!==e.flowVersion?(0,c.jsxs)("span",{className:"muted",children:[" (now v",t.flow.version,")"]}):null]})]})]}),e.awx?.revisionMismatch?(0,c.jsxs)("p",{className:"afd-run-warning","data-revision-mismatch":!0,children:[(0,c.jsx)("span",{className:"codicon codicon-warning","aria-hidden":"true"})," AWX ran another commit than your HEAD: push your changes to the project's remote so the run matches the design."]}):null,e.scenario?null:(0,c.jsx)(gE,{run:e}),(0,c.jsx)(HB,{}),e.awx?.segments?.length?(0,c.jsxs)("section",{className:"afd-section","data-run-segments":e.awx.segments.length,children:[(0,c.jsx)("h3",{children:"Segments"}),(0,c.jsx)("ul",{className:"afd-run-hosts",children:e.awx.segments.map(l=>(0,c.jsxs)("li",{children:[(0,c.jsx)("span",{className:"mono",children:l.name})," ",(0,c.jsxs)("span",{className:"muted",children:["job #",l.job," \xB7 ",l.status]})]},l.job))})]}):null,a?(0,c.jsxs)("section",{className:"afd-section",children:[(0,c.jsx)("h3",{children:"Hosts"}),(0,c.jsxs)("p",{children:[a.hosts.length," host",a.hosts.length===1?"":"s",a.stoppedEarly?" \xB7 stopped early":""]}),s.length>0?(0,c.jsx)("ul",{className:"afd-run-hosts","data-run-outcome":s.length,children:s.map(([l,f])=>(0,c.jsxs)("li",{children:[(0,c.jsx)("span",{className:"mono",children:l})," ",(0,c.jsx)("span",{className:"muted",children:f})]},l))}):null,a.failures.length>0?(0,c.jsx)("ul",{className:"afd-run-hosts","data-run-failures":a.failures.length,children:a.failures.map(l=>{let f=e.scenario&&t&&l.node?qC(t,e.scenario.forced,l.host,l.node):void 0;return(0,c.jsxs)("li",{"data-forced":f?"true":void 0,children:[(0,c.jsx)("span",{className:"mono",children:l.host}),f?`: ${Q0(t??void 0,f)}`:(0,c.jsxs)(c.Fragment,{children:[" ","failed in ",l.task,l.msg?(0,c.jsxs)("span",{className:"muted",children:[" \xB7 ",l.msg]}):null]})]},`${l.host}|${l.task}`)})}):null]}):null,(0,c.jsx)(qB,{run:e})]})}function KB({id:e}){let[t,n]=(0,A.useState)(null),r=_(m=>m.snapshot?.doc),a=_(m=>m.run),s=_(m=>m.runNodes?.[e]),l=gy(a,e),f=r?$e(r):void 0,p=f?.nodes.get(e)?.node;if(!f||!p)return null;let h=a?.summary,v=a?.source==="local"&&a.state!=="running"&&p.type!=="start"&&p.type!=="end",g=h?p.type==="start"?h.hosts.map(m=>({host:m,ports:["ok_hosts"]})):p.type==="end"?Wf(f,h,e).map(m=>({host:m,ports:[],ended:h.outcome[m]??(p.outcome==="failed"?"failed here":"ended here")})):Kf(h,e):[];if(a?.scenario&&r&&p.type==="end"){let m=l5(r,a.scenario,a,e);return(0,c.jsxs)("div",{className:"afd-panel-body","data-node-run":e,"data-scenario-end":a.scenario.name,children:[(0,c.jsxs)("p",{children:["Scenario ",(0,c.jsx)("strong",{children:a.scenario.name})]}),m.length===0?(0,c.jsx)("p",{className:"muted",children:"The scenario expected no host here, and none came."}):(0,c.jsxs)("table",{className:"afd-run-table","data-end-rows":m.length,children:[(0,c.jsx)("thead",{children:(0,c.jsxs)("tr",{children:[(0,c.jsx)("th",{children:"Host"}),(0,c.jsx)("th",{children:"Expected"}),(0,c.jsx)("th",{children:"Ended"})]})}),(0,c.jsx)("tbody",{children:m.map(b=>(0,c.jsxs)("tr",{"data-host":b.host,className:b.ok?"":"tone-warn",children:[(0,c.jsx)("td",{className:"mono",children:b.host}),(0,c.jsx)("td",{children:b.expected?"here":"elsewhere"}),(0,c.jsx)("td",{title:b.ended,children:ah(r,b.ended)})]},b.host))})]})]})}return(0,c.jsxs)("div",{className:"afd-panel-body","data-node-run":e,children:[h?s?.state==="idle"?(0,c.jsx)("p",{className:"muted",children:"The last run did not reach this node."}):(0,c.jsxs)(c.Fragment,{children:[(0,c.jsxs)("p",{children:[s?.hosts," host",s?.hosts===1?"":"s"," \xB7 ",s?.failed," failed",s?.seconds===void 0?"":` \xB7 ${Ut(s.seconds)}`]}),(0,c.jsxs)("table",{className:"afd-run-table","data-run-hosts":g.length,children:[(0,c.jsx)("thead",{children:(0,c.jsxs)("tr",{children:[(0,c.jsx)("th",{children:"Host"}),(0,c.jsx)("th",{children:"Left through"}),(0,c.jsx)("th",{children:"Result"}),v?(0,c.jsx)("th",{children:(0,c.jsx)("span",{className:"afd-sr-only",children:"Output"})}):null]})}),(0,c.jsx)("tbody",{children:g.map(m=>{let b=m.problem&&a?.scenario&&r?qC(r,a.scenario.forced,m.host,p.id):void 0,w=b?a?.scenario?.hosts.find(k=>k.host===m.host&&k.expected!==k.actual):void 0;return(0,c.jsxs)(A.Fragment,{children:[(0,c.jsxs)("tr",{"data-host":m.host,"data-port":m.ports.join(","),children:[(0,c.jsx)("td",{className:"mono",children:m.host}),(0,c.jsx)("td",{className:"mono afd-run-port",children:m.ports.join(", ")||(m.ended?"-":"(no route)")}),(0,c.jsx)("td",{children:m.ended?(0,c.jsx)("span",{className:p.outcome==="failed"?"tone-warn":"tone-ok",children:m.ended}):b?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsxs)("span",{className:"tone-warn","data-forced":!0,title:Q0(r??void 0,b),children:["Forced by the scenario (",b.outcome,")"]}),w?(0,c.jsxs)("span",{className:"muted","data-forced-miss":!0,children:[" ","\xB7 ",BC(r??void 0,w)]}):null]}):m.problem?(0,c.jsxs)("span",{title:m.problem.msg,children:[m.problem.status," in ",m.problem.task,m.problem.msg?(0,c.jsxs)("span",{className:"muted",children:[" \xB7 ",m.problem.msg]}):null]}):(0,c.jsx)("span",{className:"tone-ok",children:"ok"})}),v?(0,c.jsx)("td",{children:(0,c.jsx)("button",{type:"button",className:"icon","aria-expanded":t===m.host,"aria-label":`Output of ${m.host}`,title:`Output of ${m.host}`,"data-output-toggle":m.host,onClick:()=>n(t===m.host?null:m.host),children:(0,c.jsx)("span",{className:"codicon codicon-output","aria-hidden":"true"})})}):null]}),t===m.host?(0,c.jsx)(XB,{node:e,host:m.host}):null]},m.host)})})]})]}):(0,c.jsx)("p",{className:"muted",children:"No run yet."}),l&&a?.awx?(0,c.jsxs)("p",{"data-approval":l.label,children:["AWX approval: ",(0,c.jsx)("strong",{children:l.label})," ",(0,c.jsxs)("button",{type:"button",className:"secondary",onClick:()=>je({type:"showRunOutput",approval:e}),title:l.url,children:[(0,c.jsx)("span",{className:"codicon codicon-link-external","aria-hidden":"true"})," Open approval in AWX"]})]}):l?(0,c.jsx)(WB,{id:e,approval:l,message:p.approval?.message}):null,a&&!a.scenario?(0,c.jsx)(gE,{run:a}):null]})}function WB({id:e,approval:t,message:n}){let[r,a]=(0,A.useState)(""),[s,l]=(0,A.useState)(),f=h=>{l(h),je({type:"approve",node:e,decision:h,...r.trim()?{comment:r.trim()}:{}})},p=t.at?new Date(t.at).toLocaleString():void 0;return(0,c.jsxs)("section",{className:"afd-approval","data-approval":t.label,children:[(0,c.jsxs)("p",{children:["Approval:"," ",(0,c.jsx)("strong",{children:t.status==="waiting"?"waiting for a decision":t.label}),t.by?` by ${t.by}`:"",p?`, ${p}`:""]}),t.comment?(0,c.jsx)("blockquote",{children:t.comment}):null,n&&t.status==="waiting"?(0,c.jsx)("p",{className:"muted",children:n}):null,t.status==="waiting"&&t.mayDecide?s?(0,c.jsxs)("p",{role:"status",children:["Sent: ",s,". The run goes on once the server has it."]}):(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("label",{htmlFor:`afd-approval-${e}`,children:"Comment"}),(0,c.jsx)("textarea",{id:`afd-approval-${e}`,rows:2,value:r,onChange:h=>a(h.target.value),placeholder:"Why, for the record"}),(0,c.jsxs)("div",{className:"afd-approval-actions",children:[(0,c.jsx)("button",{type:"button",onClick:()=>f("approved"),children:"Approve"}),(0,c.jsx)("button",{type:"button",className:"secondary",onClick:()=>f("rejected"),children:"Reject"})]})]}):t.status==="waiting"?(0,c.jsx)("p",{className:"muted",children:"Someone allowed to approve decides it."}):null]})}function UB(e,t){for(let n of e){let r=n.find(a=>a.id===t);if(r)return r}}function YB({edge:e}){let t=_(p=>p.snapshot?.doc),n=_(p=>p.run?.summary);if(!t)return null;let r=$e(t),a=UB([...r.levels.values()].map(p=>p.edges),e);if(!a)return null;let s=r.nodes.get(a.from.node)?.node,l=r.nodes.get(a.to.node)?.node,f=n?A0(r,n,a):[];return(0,c.jsxs)("div",{className:"afd-panel-body","data-wire-run":e,children:[(0,c.jsxs)("h2",{className:"afd-panel-title",children:[s?.title," ",(0,c.jsx)("span",{className:"mono",children:a.from.port})," \u2192 ",l?.title]}),n?f.length===0?(0,c.jsx)("p",{className:"muted",children:"No host took this wire in the last run."}):(0,c.jsxs)(c.Fragment,{children:[(0,c.jsxs)("p",{children:[f.length," host",f.length===1?"":"s"," took this wire"]}),(0,c.jsx)("ul",{className:"afd-run-hosts mono","data-wire-hosts":f.join(","),children:f.map(p=>(0,c.jsx)("li",{children:p},p))})]}):(0,c.jsx)("p",{className:"muted",children:"No run yet."})]})}function XB({node:e,host:t}){let[n,r]=(0,A.useState)(null);return(0,A.useEffect)(()=>{let a=!0;return zB(e,t).then(s=>a&&r(s)),()=>{a=!1}},[e,t]),(0,c.jsx)("tr",{className:"afd-run-output","data-run-output":t,children:(0,c.jsx)("td",{colSpan:4,children:n?n.error?(0,c.jsx)("p",{className:"muted",children:n.error}):n.entries?.length?n.entries.map((a,s)=>(0,c.jsxs)("div",{className:"afd-output-entry","data-output-task":a.task,children:[(0,c.jsxs)("div",{children:[(0,c.jsx)("span",{className:"mono",children:a.task})," ",(0,c.jsxs)("span",{className:a.status==="ok"?"tone-ok":a.status==="skipped"?"muted":"tone-warn",children:[a.status,a.changed?" \xB7 changed":"",a.rc===void 0?"":` \xB7 rc ${a.rc}`,a.item?" \xB7 loop item":""]})]}),a.censored?(0,c.jsx)("p",{className:"muted",children:"Output hidden (no_log)."}):null,a.msg&&!a.out?.msg?(0,c.jsx)("pre",{className:"afd-code",children:a.msg}):null,["msg","stdout","stderr"].map(l=>a.out?.[l]?(0,c.jsxs)("div",{children:[(0,c.jsx)("span",{className:"muted",children:l}),(0,c.jsx)("pre",{className:"afd-code",children:a.out[l]})]},l):null)]},s)):(0,c.jsxs)("p",{className:"muted",children:["No task results for ",t," here."]}):(0,c.jsx)("p",{className:"muted",children:"Reading the output\u2026"})})})}var vE=/^\s*\{[{%]/,bE=/^(".*"|'.*')$/s,By=e=>typeof e=="object"&&!!e&&!Array.isArray(e);function qy(e){try{return kr(e)}catch{return}}function xE(e){let t=e.trim();if(vE.test(t))return e;if(t.startsWith("[")||t.startsWith("{")){let n=qy(t);return Array.isArray(n)||By(n)?n:e}if(bE.test(t)){let n=qy(t);if(typeof n=="string"&&wE(n.trim()))return n}return e}function wE(e){if(bE.test(e))return/^.\s*[[{]/.test(e);if(vE.test(e)||!/^[[{]/.test(e))return!1;let t=qy(e);return Array.isArray(t)||By(t)}function ZB(e,t){return JSON.stringify(e)===JSON.stringify(t)}function kE(e){if(e==null)return"";if(typeof e=="string")return wE(e.trim())?JSON.stringify(e):e;if(Array.isArray(e)||By(e)){let t=fj(e,{collectionStyle:"flow",flowCollectionPadding:!1,lineWidth:0}).trim();return t.includes(`
|
|
175
|
+
`)?void 0:t}return String(e)}var GB=new Set(["and","or","not","in","is","if","else","elif","for","recursive","as","with","without","context","import","from","ignore","missing"]),QB=new Set(["true","false","none","True","False","None"]),SE=/[A-Za-z_][A-Za-z0-9_]*/y,NE=/0[xX][0-9a-fA-F_]+|0[oO][0-7_]+|0[bB][01_]+|[0-9][0-9_]*(?:\.[0-9_]+)?(?:[eE][+-]?[0-9]+)?/y,JB=["**","//","==","!=","<=",">=","+","-","*","/","%","<",">","=","~","|"],e9="()[]{},.:",t9=/%[-_0^#]?[A-Za-z%]/g;function Jd(e,t){return t&&!e.includes("{{")?"expr":"template"}function al(e,t){let n=[],r=t.yamlQuote,a=t.mode==="expr"?"expr":"text",s=[],l=0,f,p,h,v=!1,g=0,m=(N,$)=>{if(N<=g)return;let j={text:e.slice(g,N),start:g,...$?{kind:$}:{}},E=n[n.length-1];!$&&E&&!E.kind&&E.start+E.text.length===g?E.text+=j.text:n.push(j),$&&(v=h?.kind==="keyword"&&h.text==="is"&&j.text==="not",h=j),g=N},b=N=>{if(r==="'"&&e.startsWith("''",N))return{q:"'",len:2};if(r==='"'&&e.startsWith('\\"',N))return{q:'"',len:2};let $=e[N];if($==="'"&&r!=="'"||$==='"'&&r!=='"')return{q:$,len:1}},w=N=>{let $=g,j=g+N.len,E=!1;for(;j<e.length;){let M=b(j);if(M&&M.q===N.q){j+=M.len,E=!0;break}e[j]==="\\"&&(r!=='"'||e[j+1]!=='"')?j+=2:j++}let I=Math.min(j,e.length),z=e.slice($,I),T=0;for(let M of z.matchAll(t9)){let O=M.index??0;O>T&&m($+O,"string"),m($+O+M[0].length,"format"),T=O+M[0].length}m(I,"string"),E||(p={quote:N.q,start:$})},k=(N,$)=>{if(a==="stmt"&&!f)return"keyword";if(QB.has(N))return"constant";let j=h;if(j?.text==="|")return"filter";if(j?.kind==="keyword"&&j.text==="is"&&N!=="not"||v)return"test";if(GB.has(N))return"keyword";let E=/^\s*(\(|=(?!=))?/.exec(e.slice($))?.[1];return j?.text==="."?E==="("?"method":"attr":E==="="&&s[s.length-1]?.open==="("?"kwarg":E==="("?"func":"var"},S=()=>{if(s.length>0)return 0;let N=a==="expr"?/[-+]?\}\}/y:/[-+]?%\}/y;return N.lastIndex=g,N.test(e)?N.lastIndex-g:0};for(;g<e.length;){if(a==="text"||a==="raw"){let T=a==="raw"?/\{%[-+]?\s*endraw\s*[-+]?%\}/g:/\{\{|\{%|\{#/g;T.lastIndex=g;let M=T.exec(e);if(!M){m(e.length);break}if(m(M.index),a==="raw"){m(g+M[0].length,"delim"),a="text";continue}if(M[0]==="{#"){let K=e.indexOf("#}",g+2);if(K<0){m(e.length,"comment"),a="comment";break}m(K+2,"comment");continue}let O=/[-+]?/y;O.lastIndex=g+2,O.test(e),m(O.lastIndex,"delim"),a=M[0]==="{{"?"expr":"stmt",l=g,f=void 0,s=[],h=void 0,v=!1;continue}let N=t.mode==="expr"?0:S();if(N){m(g+N,"delim"),a=f==="raw"?"raw":"text",h=void 0;continue}let $=e[g];if(/\s/.test($)){let T=/\s+/y;T.lastIndex=g,T.test(e),m(T.lastIndex);continue}let j=b(g);if(j){w(j);continue}SE.lastIndex=g;let E=SE.exec(e);if(E){let T=g+E[0].length,M=k(E[0],T);a==="stmt"&&!f&&(f=E[0]);let O=s[s.length-1];M==="kwarg"&&O&&(O.kwarg=E[0]),m(T,M);continue}NE.lastIndex=g;let I=NE.exec(e);if(I){m(g+I[0].length,"number");continue}if(e9.includes($)){let T=s[s.length-1];if($==="("||$==="["||$==="{"){let M=$==="("&&h&&h.start+h.text.length===g&&(h.kind==="func"||h.kind==="method"||h.kind==="filter"||h.kind==="test")?h:void 0;s.push({open:$,arg:0,...M?{callee:M.text,calleeKind:M.kind,calleeStart:M.start}:{}})}else $===","&&T?(T.arg++,delete T.kwarg):T&&($===")"&&T.open==="("||$==="]"&&T.open==="["||$==="}"&&T.open==="{")&&s.pop();m(g+1,"punct");continue}let z=JB.find(T=>e.startsWith(T,g));m(g+(z?.length??1),z?"op":"punct")}return{tokens:n,end:{where:a,...p?{string:p}:{},stack:s.map(N=>({...N})),exprStart:l,...f?{stmtWord:f}:{}}}}var jE={delim:"delim",comment:"comment",keyword:"keyword",constant:"constant",var:"var",attr:"var",kwarg:"var",func:"func",method:"func",filter:"func",test:"func",string:"string",format:"format",number:"number"};function n9(e,t){let n=[];for(let r of al(e,t).tokens){let a=r.kind&&jE[r.kind];if(!a)continue;let s=n[n.length-1];s&&s.colour===a&&s.end===r.start?s.end=r.start+r.text.length:n.push({start:r.start,end:r.start+r.text.length,colour:a})}return n}function Gn(e,t,n,r={}){let a=`${e}(${t})`,s=t.indexOf("''");return{name:e,insert:a,...s>=0?{caret:e.length+1+s+1,again:!0}:t?{caret:e.length+1}:{},doc:n,...r}}var eu=[{name:"now",insert:"now()",sig:"now(utc=False, fmt=None)",doc:"The current date and time on the controller, as a datetime.",returns:"datetime"},{name:"now",insert:"now(utc=true)",sig:"now(utc=False, fmt=None)",doc:"The current date and time in UTC, as a datetime.",returns:"datetime"},{name:"now",insert:"now(fmt='')",caret:9,again:!0,sig:"now(utc=False, fmt=None)",doc:"The current date and time as text, formatted with strftime codes.",returns:"str"},Gn("lookup","''","Runs a lookup plugin on the controller; the results joined as text.",{sig:"lookup(name, *terms, wantlist=False, **options)"}),Gn("query","''","Runs a lookup plugin on the controller; the results as a list.",{sig:"query(name, *terms, **options)",returns:"list"}),Gn("q","''","Short for query: a lookup whose results are a list.",{sig:"q(name, *terms, **options)",returns:"list"}),Gn("range","","A sequence of whole numbers.",{sig:"range([start,] stop[, step])",returns:"list"}),Gn("dict","","A dictionary made from keyword arguments.",{sig:"dict(**items)",returns:"dict"}),Gn("namespace","","An object a loop can change: {% set ns.total = ns.total + 1 %}.",{sig:"namespace(**attributes)"}),Gn("lipsum","","Placeholder text.",{sig:"lipsum(n=5, html=True, min=20, max=100)"}),Gn("cycler","","Cycles through its values with .next().",{sig:"cycler(*items)"}),Gn("joiner","', '","Gives the separator from its second call on.",{sig:"joiner(sep=', ')"}),Gn("undef","","An undefined value with a hint, for a default that must be set.",{sig:"undef(hint=None)"})],Hy=[{name:"inventory_hostname",doc:"The host's name in the inventory.",returns:"str"},{name:"inventory_hostname_short",doc:"The host's inventory name up to the first dot.",returns:"str"},{name:"hostvars",doc:"Every host's variables, by host name.",returns:"dict"},{name:"groups",doc:"Every group's hosts, by group name.",returns:"dict"},{name:"group_names",doc:"The groups this host is in.",returns:"list"},{name:"ansible_facts",doc:"The facts gathered from this host.",returns:"dict"},{name:"ansible_host",doc:"The address Ansible connects to.",returns:"str"},{name:"ansible_play_hosts",doc:"The play hosts that have not failed.",returns:"list"},{name:"ansible_play_hosts_all",doc:"Every host the play started with.",returns:"list"},{name:"ansible_play_batch",doc:"The hosts of the current batch (serial).",returns:"list"},{name:"ansible_check_mode",doc:"Whether the run is in check mode.",returns:"bool"},{name:"ansible_diff_mode",doc:"Whether the run shows diffs.",returns:"bool"},{name:"ansible_version",doc:"Ansible's version: full, major, minor, revision.",returns:"dict"},{name:"ansible_run_tags",doc:"The tags the run was asked for.",returns:"list"},{name:"ansible_skip_tags",doc:"The tags the run skips.",returns:"list"},{name:"ansible_limit",doc:"The --limit of the run.",returns:"str"},{name:"inventory_dir",doc:"The folder of the host's inventory source.",returns:"str"},{name:"inventory_file",doc:"The host's inventory source.",returns:"str"},{name:"role_path",doc:"The running role's folder.",returns:"str"},{name:"role_name",doc:"The running role's name.",returns:"str"},{name:"omit",doc:"As a parameter value: leaves the parameter out."},{name:"item",doc:"The loop's current item."},{name:"ansible_loop",doc:"Loop details (index, first, last\u2026) with loop_control.extended.",returns:"loop"},{name:"afd_repo_root",doc:"The repository's root: generated plays run from generated/, so paths start here.",returns:"str"},{name:"afd_failed_result",doc:"On a failure path: the result of the step that failed.",returns:"dict"},{name:"afd_failed_task",doc:"On a failure path: the task that failed.",returns:"str"},{name:"afd_failed_node",doc:"On a failure path: the key of the step that failed.",returns:"str"}],o9=[{name:"true",doc:"True.",returns:"bool"},{name:"false",doc:"False.",returns:"bool"},{name:"none",doc:"No value (Python None)."}],CE=[{name:"and",doc:"Both sides are true."},{name:"or",doc:"Either side is true."},{name:"not",doc:"The opposite."},{name:"in",doc:"Contained in a list, string or dict."},{name:"is",insert:"is ",doc:"Applies a test: x is defined.",again:!0},{name:"if",doc:"A value if a condition holds: a if c else b."},{name:"else",doc:"The value when the condition does not hold."}],r9=[{name:"if",doc:"Renders what follows when a condition holds."},{name:"elif",doc:"Another condition."},{name:"else",doc:"When no condition held."},{name:"endif",doc:"Ends an if."},{name:"for",insert:"for in ",caret:4,doc:"Renders what follows for each item."},{name:"endfor",doc:"Ends a for."},{name:"set",insert:"set = ",caret:4,doc:"Sets a variable of the template."},{name:"endset",doc:"Ends a set block."},{name:"with",doc:"Variables for the block that follows."},{name:"endwith",doc:"Ends a with."},{name:"macro",doc:"Defines a reusable piece of template."},{name:"endmacro",doc:"Ends a macro."},{name:"filter",doc:"Applies a filter to the block."},{name:"endfilter",doc:"Ends a filter block."},{name:"raw",doc:"Leaves what follows unrendered."},{name:"endraw",doc:"Ends raw."},{name:"break",doc:"Leaves the loop."},{name:"continue",doc:"Skips to the next item."}],ae=(e,t,n,r,a)=>({...t===""?{name:e}:Gn(e,t,n),doc:n,sig:a??(t===""?e:`${e}(${t.replaceAll("''","\u2026")})`),...r?{returns:r}:{}}),Ch=[ae("default","''","The value, or this one when it is undefined.",void 0,"default(value='', boolean=False)"),ae("d","''","Short for default.",void 0,"d(value='', boolean=False)"),ae("mandatory","","Fails when the value is undefined."),ae("string","","As text.","str"),ae("int","","As a whole number.","int","int(default=0, base=10)"),ae("float","","As a number with a fraction.",void 0,"float(default=0.0)"),ae("bool","",'As true or false ("yes", "on", 1 count as true).',"bool"),ae("length","","How many items or characters.","int"),ae("count","","How many items or characters.","int"),ae("lower","","In lower case.","str"),ae("upper","","In upper case.","str"),ae("capitalize","","The first letter in upper case, the rest lower.","str"),ae("title","","Each word capitalized.","str"),ae("trim","","Without leading and trailing whitespace.","str"),ae("replace","'', ''","Each occurrence of the first text replaced with the second.","str","replace(old, new, count=None)"),ae("regex_replace","'', ''","Each match of a regular expression replaced.","str","regex_replace(pattern, replacement='', ignorecase=False, multiline=False)"),ae("regex_search","''","The first match of a regular expression, or none.","str","regex_search(pattern, *groups, ignorecase=False, multiline=False)"),ae("regex_findall","''","Every match of a regular expression.","list","regex_findall(pattern, ignorecase=False, multiline=False)"),ae("regex_escape","","The text with regular expression characters escaped.","str"),ae("split","''","The text split into a list.","list","split(separator=None, maxsplit=-1)"),ae("join","''","The items joined into text.","str","join(separator='', attribute=None)"),ae("first","","The first item."),ae("last","","The last item."),ae("list","","As a list.","list"),ae("sort","","The items in order.","list","sort(reverse=False, case_sensitive=False, attribute=None)"),ae("reverse","","The items or characters in reverse order."),ae("unique","","The items without repeats.","list"),ae("flatten","","Nested lists made into one list.","list","flatten(levels=None)"),ae("map","''","Applies a filter, or takes an attribute, of each item.","list","map(filter, *args) or map(attribute=name)"),ae("select","''","The items a test passes.","list","select(test, *args)"),ae("reject","''","The items a test fails.","list","reject(test, *args)"),ae("selectattr","''","The items whose attribute passes a test.","list","selectattr(attribute, test, *args)"),ae("rejectattr","''","The items whose attribute fails a test.","list","rejectattr(attribute, test, *args)"),ae("groupby","''","The items grouped by an attribute.","list","groupby(attribute)"),ae("sum","","The sum of the items.",void 0,"sum(attribute=None, start=0)"),ae("min","","The smallest item."),ae("max","","The largest item."),ae("abs","","The absolute value."),ae("round","","Rounded.",void 0,"round(precision=0, method='common')"),ae("random","","A random item, or a random number below the value."),ae("shuffle","","The items in random order.","list"),ae("batch","","The items in lists of n.","list","batch(n, fill_with=None)"),ae("slice","","The items in n lists.","list","slice(n, fill_with=None)"),ae("dictsort","","A dict as (key, value) pairs, sorted.","list"),ae("items","","A dict's (key, value) pairs.","list"),ae("dict2items","","A dict as a list of {key, value}.","list","dict2items(key_name='key', value_name='value')"),ae("items2dict","","A list of {key, value} as a dict.","dict","items2dict(key_name='key', value_name='value')"),ae("combine","","Dicts merged; later ones win.","dict","combine(*dicts, recursive=False, list_merge='replace')"),ae("zip","","Lists paired item by item.","list","zip(*lists)"),ae("zip_longest","","Lists paired to the longest one.","list","zip_longest(*lists, fillvalue=None)"),ae("difference","","The items not in the other list.","list","difference(other)"),ae("intersect","","The items also in the other list.","list","intersect(other)"),ae("union","","The items of both lists, once each.","list","union(other)"),ae("symmetric_difference","","The items in only one of the lists.","list","symmetric_difference(other)"),ae("subelements","''","Each item paired with each element of its sub-list.","list","subelements(key, skip_missing=False)"),ae("extract","","The values of these keys in a container.",void 0,"extract(container, morekeys=None)"),ae("ternary","'', ''","The first value if true, else the second.",void 0,"ternary(true_val, false_val, none_val=None)"),ae("to_json","","As JSON text.","str","to_json(indent=None, sort_keys=False)"),ae("to_nice_json","","As indented JSON text.","str","to_nice_json(indent=4, sort_keys=True)"),ae("from_json","","JSON text as data."),ae("to_yaml","","As YAML text.","str"),ae("to_nice_yaml","","As indented YAML text.","str","to_nice_yaml(indent=4)"),ae("from_yaml","","YAML text as data."),ae("from_yaml_all","","Each document of YAML text, as data.","list"),ae("b64encode","","As Base64.","str"),ae("b64decode","","Base64 decoded.","str"),ae("hash","''","A hash of the text.","str","hash(hashtype='sha1')"),ae("checksum","","The SHA-1 checksum of the text.","str"),ae("md5","","The MD5 hash of the text.","str"),ae("sha1","","The SHA-1 hash of the text.","str"),ae("password_hash","''","A password hash for /etc/shadow.","str","password_hash(hashtype='sha512', salt=None)"),ae("to_uuid","","A UUID made from the text.","str"),ae("quote","","Quoted for a shell.","str"),ae("comment","","As a comment block.","str","comment(style='plain')"),ae("indent","","Each line after the first indented.","str","indent(width=4, first=False, blank=False)"),ae("center","","Centred in a width.","str","center(width=80)"),ae("truncate","","Cut to a length.","str","truncate(length=255, killwords=False, end='...')"),ae("wordcount","","How many words.","int"),ae("wordwrap","","Wrapped at a width.","str","wordwrap(width=79)"),ae("format","",'printf-style formatting: "%s-%d" | format(a, b).',"str","format(*args)"),ae("basename","","The last part of a path.","str"),ae("dirname","","A path without its last part.","str"),ae("path_join","","Parts joined into a path.","str"),ae("splitext","","A path split into (root, extension).","list"),ae("realpath","","The path with links resolved (on the controller).","str"),ae("relpath","''","The path relative to a start.","str","relpath(start)"),ae("expanduser","","The path with ~ expanded.","str"),ae("expandvars","","The path with environment variables expanded.","str"),ae("fileglob","","The controller files matching a pattern.","list"),ae("urlsplit","''","A URL split into parts, or one part.",void 0,"urlsplit(query=None)"),ae("urlencode","","Encoded for a URL.","str"),ae("urldecode","","Decoded from a URL.","str"),ae("human_readable","","A byte count as text (1.0 KB).","str"),ae("human_to_bytes","","Text like 1 KB as a byte count.","int"),ae("to_datetime","''","Text as a datetime, read with strftime codes.","datetime","to_datetime(format='%Y-%m-%d %H:%M:%S')"),ae("strftime","","Seconds since 1970 (or now) formatted with the codes in the value: '%Y-%m-%d' | strftime.","str","strftime(second=None, utc=False)"),ae("type_debug","","The Python type of the value.","str"),ae("tojson","","As JSON text (Jinja).","str"),ae("pprint","","Pretty-printed, for debugging.","str"),ae("attr","''","An attribute of the object.",void 0,"attr(name)"),ae("xmlattr","","A dict as XML attributes.","str"),ae("escape","","HTML-escaped.","str"),ae("safe","","Marked safe: not escaped.","str"),ae("striptags","","Without HTML or XML tags.","str"),ae("urlize","","URLs made into links.","str"),ae("filesizeformat","","A byte count as text (1.0 kB).","str"),ae("log","","The logarithm.",void 0,"log(base=e)"),ae("pow","","Raised to a power.",void 0,"pow(exponent)"),ae("root","","A root.",void 0,"root(base=2)"),ae("product","","The cartesian product of lists.","list"),ae("permutations","","The permutations of the items.","list"),ae("combinations","","The combinations of n items.","list","combinations(n)"),ae("vault","''","Encrypted with a vault secret.","str","vault(secret, vault_id=None)"),ae("unvault","''","Decrypted with a vault secret.","str","unvault(secret, vault_id=None)")],Vy=[ae("defined","","The variable is defined."),ae("undefined","","The variable is not defined."),ae("none","","The value is none."),ae("truthy","","The value counts as true."),ae("falsy","","The value counts as false."),ae("true","","The value is true."),ae("false","","The value is false."),ae("boolean","","The value is true or false."),ae("string","","The value is text."),ae("number","","The value is a number."),ae("integer","","The value is a whole number."),ae("float","","The value is a number with a fraction."),ae("mapping","","The value is a dict."),ae("sequence","","The value is a list or text."),ae("iterable","","The value can be looped over."),ae("callable","","The value can be called."),ae("even","","An even number."),ae("odd","","An odd number."),ae("divisibleby","","Divisible by a number.",void 0,"divisibleby(num)"),ae("eq","","Equal to.",void 0,"eq(other)"),ae("ne","","Not equal to.",void 0,"ne(other)"),ae("lt","","Less than.",void 0,"lt(other)"),ae("le","","Less than or equal to.",void 0,"le(other)"),ae("gt","","Greater than.",void 0,"gt(other)"),ae("ge","","Greater than or equal to.",void 0,"ge(other)"),ae("in","","In a list or text.",void 0,"in(container)"),ae("lower","","All lower case."),ae("upper","","All upper case."),ae("sameas","","The same object.",void 0,"sameas(other)"),ae("match","''","A regular expression matches at the start.",void 0,"match(pattern, ignorecase=False, multiline=False)"),ae("search","''","A regular expression matches anywhere.",void 0,"search(pattern, ignorecase=False, multiline=False)"),ae("regex","''","A regular expression matches.",void 0,"regex(pattern, ignorecase=False, multiline=False, match_type='search')"),ae("contains","","The list contains the item.",void 0,"contains(item)"),ae("any","","Any item is true."),ae("all","","Every item is true."),ae("subset","","Every item is in the other list.",void 0,"subset(other)"),ae("superset","","Holds every item of the other list.",void 0,"superset(other)"),ae("version","'', ''","Compares versions: x is version('17.9', '<').",void 0,"version(version, operator='eq', strict=False, version_type=None)"),ae("changed","","A task result that changed something."),ae("failed","","A task result that failed."),ae("succeeded","","A task result that succeeded."),ae("success","","A task result that succeeded."),ae("skipped","","A task result that was skipped."),ae("reachable","","A task result whose host was reachable."),ae("unreachable","","A task result whose host was unreachable."),ae("finished","","An async result that finished."),ae("started","","An async result that started."),ae("timedout","","A task result that timed out."),ae("exists","","The path exists on the controller."),ae("file","","The path is a file on the controller."),ae("directory","","The path is a folder on the controller."),ae("link","","The path is a link on the controller."),ae("abs","","The path is absolute."),ae("same_file","","Both paths are the same file.",void 0,"same_file(other)"),ae("mount","","The path is a mount point on the controller."),ae("url","","The text is a URL."),ae("uri","","The text is a URI."),ae("vault_encrypted","","The value is vault-encrypted."),ae("nan","","Not a number.")],$E=[{name:"env",doc:"An environment variable on the controller: lookup('env', 'HOME')."},{name:"file",doc:"The text of controller files."},{name:"template",doc:"Controller templates, rendered."},{name:"vars",doc:"Variables by name."},{name:"varnames",doc:"The names of variables matching a pattern."},{name:"pipe",doc:"The output of a command on the controller."},{name:"lines",doc:"The output of a command, line by line."},{name:"password",doc:"A random password, kept in a controller file."},{name:"url",doc:"The content of URLs."},{name:"fileglob",doc:"Controller files matching a pattern."},{name:"first_found",doc:"The first controller file that exists."},{name:"ini",doc:"Values from an INI file."},{name:"csvfile",doc:"Values from a CSV file."},{name:"sequence",doc:"A sequence of numbers as text."},{name:"items",doc:"The items of lists."},{name:"list",doc:"The terms as a list."},{name:"dict",doc:"A dict's items as {key, value}."},{name:"indexed_items",doc:"The items with their index."},{name:"nested",doc:"Every combination of the lists."},{name:"together",doc:"The lists paired item by item."},{name:"subelements",doc:"Items with each element of a sub-list."},{name:"random_choice",doc:"One of the terms, at random."},{name:"inventory_hostnames",doc:"The hosts matching an inventory pattern."},{name:"config",doc:"An Ansible configuration setting."},{name:"unvault",doc:"The text of vault-encrypted files."}],Ee=(e,t,n,r,a)=>t===void 0?{name:e,doc:n,...r?{returns:r}:{}}:{...Gn(e,t,n),sig:a??`${e}(${t})`,...r?{returns:r}:{}},tu={datetime:[Ee("strftime","''","Formatted with strftime codes.","str","strftime(format)"),Ee("isoformat","","As ISO 8601 text.","str"),Ee("timestamp","","Seconds since 1970.",void 0),Ee("date","","The date part.","date"),Ee("time","","The time part.","time"),Ee("year",void 0,"The year.","int"),Ee("month",void 0,"The month, 1 to 12.","int"),Ee("day",void 0,"The day of the month.","int"),Ee("hour",void 0,"The hour, 0 to 23.","int"),Ee("minute",void 0,"The minute.","int"),Ee("second",void 0,"The second.","int"),Ee("microsecond",void 0,"The microsecond.","int"),Ee("weekday","","The day of the week, Monday 0.","int"),Ee("isoweekday","","The day of the week, Monday 1.","int"),Ee("replace","","The same date and time with some parts changed.","datetime","replace(year=\u2026, month=\u2026, day=\u2026, hour=\u2026, \u2026)"),Ee("ctime","",'As text like "Thu Nov 12 10:15:30 2026".',"str")],date:[Ee("strftime","''","Formatted with strftime codes.","str","strftime(format)"),Ee("isoformat","","As ISO 8601 text.","str"),Ee("year",void 0,"The year.","int"),Ee("month",void 0,"The month, 1 to 12.","int"),Ee("day",void 0,"The day of the month.","int"),Ee("weekday","","The day of the week, Monday 0.","int"),Ee("isoweekday","","The day of the week, Monday 1.","int")],time:[Ee("strftime","''","Formatted with strftime codes.","str","strftime(format)"),Ee("isoformat","","As ISO 8601 text.","str"),Ee("hour",void 0,"The hour, 0 to 23.","int"),Ee("minute",void 0,"The minute.","int"),Ee("second",void 0,"The second.","int")],timedelta:[Ee("days",void 0,"Whole days.","int"),Ee("seconds",void 0,"Seconds past the whole days.","int"),Ee("total_seconds","","The whole duration in seconds.")],str:[Ee("upper","","In upper case.","str"),Ee("lower","","In lower case.","str"),Ee("strip","","Without leading and trailing whitespace (or these characters).","str","strip(chars=None)"),Ee("lstrip","","Without leading whitespace.","str","lstrip(chars=None)"),Ee("rstrip","","Without trailing whitespace.","str","rstrip(chars=None)"),Ee("split","","Split into a list, at whitespace or a separator.","list","split(sep=None, maxsplit=-1)"),Ee("rsplit","","Split from the right.","list","rsplit(sep=None, maxsplit=-1)"),Ee("splitlines","","Split into lines.","list"),Ee("replace","'', ''","Each occurrence replaced.","str","replace(old, new, count=-1)"),Ee("startswith","''","Starts with the text.","bool","startswith(prefix)"),Ee("endswith","''","Ends with the text.","bool","endswith(suffix)"),Ee("find","''","Where the text first is, or -1.","int","find(sub)"),Ee("count","''","How many times the text occurs.","int","count(sub)"),Ee("join","","The items joined with this text.","str","join(items)"),Ee("format","","With {} placeholders filled.","str","format(*args, **kwargs)"),Ee("capitalize","","The first letter in upper case.","str"),Ee("title","","Each word capitalized.","str"),Ee("zfill","","Padded with zeros to a width.","str","zfill(width)"),Ee("ljust","","Padded on the right to a width.","str","ljust(width)"),Ee("rjust","","Padded on the left to a width.","str","rjust(width)"),Ee("isdigit","","Only digits.","bool")],list:[Ee("index","","Where the item first is.","int","index(item)"),Ee("count","","How many times the item occurs.","int","count(item)")],dict:[Ee("keys","","The keys.","list"),Ee("values","","The values.","list"),Ee("items","","The (key, value) pairs.","list"),Ee("get","''","The value of a key, or a default.",void 0,"get(key, default=None)")],int:[],bool:[],loop:[Ee("index",void 0,"The iteration, from 1.","int"),Ee("index0",void 0,"The iteration, from 0.","int"),Ee("revindex",void 0,"Iterations left, to 1.","int"),Ee("revindex0",void 0,"Iterations left, to 0.","int"),Ee("first",void 0,"The first iteration.","bool"),Ee("last",void 0,"The last iteration.","bool"),Ee("length",void 0,"How many items.","int"),Ee("previtem",void 0,"The previous item."),Ee("nextitem",void 0,"The next item."),Ee("cycle","","One of the values in turn.",void 0,"cycle(*values)")]},Ky=Object.fromEntries(Ch.flatMap(e=>e.returns?[[e.name,e.returns]]:[])),EE={stdout:"str",stderr:"str",msg:"str",stdout_lines:"list",stderr_lines:"list",results:"list",rc:"int",changed:"bool",failed:"bool",json:"dict"},_E=[{code:"%Y",doc:"Year, 4 digits"},{code:"%y",doc:"Year, 2 digits"},{code:"%m",doc:"Month, 01 to 12"},{code:"%d",doc:"Day of the month, 01 to 31"},{code:"%H",doc:"Hour, 00 to 23"},{code:"%I",doc:"Hour, 01 to 12"},{code:"%p",doc:"AM or PM"},{code:"%M",doc:"Minute, 00 to 59"},{code:"%S",doc:"Second, 00 to 59"},{code:"%f",doc:"Microsecond, 6 digits"},{code:"%a",doc:"Weekday, short name"},{code:"%A",doc:"Weekday, full name"},{code:"%w",doc:"Weekday, Sunday 0 to Saturday 6"},{code:"%u",doc:"Weekday, Monday 1 to Sunday 7"},{code:"%b",doc:"Month, short name"},{code:"%B",doc:"Month, full name"},{code:"%j",doc:"Day of the year, 001 to 366"},{code:"%U",doc:"Week of the year, weeks start on Sunday"},{code:"%W",doc:"Week of the year, weeks start on Monday"},{code:"%V",doc:"ISO week, 01 to 53"},{code:"%G",doc:"ISO year (with %V)"},{code:"%z",doc:"UTC offset; empty for a date without a time zone"},{code:"%Z",doc:"Time zone name; empty for a date without a time zone"},{code:"%s",doc:"Seconds since 1970 (Linux)"},{code:"%c",doc:"Date and time, locale style"},{code:"%x",doc:"Date, locale style"},{code:"%X",doc:"Time, locale style"},{code:"%%",doc:"A % sign"}],AE=[{format:"%Y-%m-%d %H:%M:%S",doc:"Date and time"},{format:"%Y%m%d_%H%M%S",doc:"A stamp for file names"},{format:"%Y-%m-%d",doc:"Date"},{format:"%H:%M:%S",doc:"Time"},{format:"%Y-%m-%dT%H:%M:%S",doc:"ISO 8601 date and time"},{format:"%Y%m%d",doc:"Compact date"},{format:"%d %b %Y",doc:"Day, month name, year"},{format:"%s",doc:"Seconds since 1970 (Linux)"}],TE=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],ME=["January","February","March","April","May","June","July","August","September","October","November","December"];function nu(e,t,n=!1){let r={Y:n?t.getUTCFullYear():t.getFullYear(),m:(n?t.getUTCMonth():t.getMonth())+1,d:n?t.getUTCDate():t.getDate(),H:n?t.getUTCHours():t.getHours(),M:n?t.getUTCMinutes():t.getMinutes(),S:n?t.getUTCSeconds():t.getSeconds(),ms:n?t.getUTCMilliseconds():t.getMilliseconds(),w:n?t.getUTCDay():t.getDay()},a=(m,b=2)=>String(m).padStart(b,"0"),s=Date.UTC(r.Y,0,1),l=Date.UTC(r.Y,r.m-1,r.d),f=Math.round((l-s)/864e5)+1,p=m=>Math.floor((f-1+7-(r.w-m+7)%7)/7),h=()=>{let m=new Date(l),b=(r.w+6)%7;m.setUTCDate(m.getUTCDate()-b+3);let w=m.getUTCFullYear(),k=new Date(Date.UTC(w,0,4));return{year:w,week:1+Math.round(((m.getTime()-k.getTime())/864e5-3+(k.getUTCDay()+6)%7)/7)}},v=r.H%12==0?12:r.H%12,g=m=>{switch(m){case"Y":return String(r.Y);case"y":return a(r.Y%100);case"m":return a(r.m);case"d":return a(r.d);case"e":return String(r.d).padStart(2," ");case"H":return a(r.H);case"I":return a(v);case"p":return r.H<12?"AM":"PM";case"M":return a(r.M);case"S":return a(r.S);case"f":return a(r.ms*1e3,6);case"a":return(TE[r.w]??"").slice(0,3);case"A":return TE[r.w]??"";case"w":return String(r.w);case"u":return String(r.w===0?7:r.w);case"b":case"h":return(ME[r.m-1]??"").slice(0,3);case"B":return ME[r.m-1]??"";case"j":return a(f,3);case"U":return a(p(0));case"W":return a(p(1));case"V":return a(h().week);case"G":return String(h().year);case"z":case"Z":return"";case"s":return String(Math.floor(t.getTime()/1e3));case"c":return`${g("a")} ${g("b")} ${String(r.d).padStart(2," ")} ${g("H")}:${g("M")}:${g("S")} ${r.Y}`;case"x":return`${g("m")}/${g("d")}/${g("y")}`;case"X":return`${g("H")}:${g("M")}:${g("S")}`;case"D":return`${g("m")}/${g("d")}/${g("y")}`;case"F":return`${r.Y}-${g("m")}-${g("d")}`;case"T":return`${g("H")}:${g("M")}:${g("S")}`;case"%":return"%";default:return}};return e.replace(/%([-_0^#]?)([A-Za-z%])/g,(m,b,w)=>{let k=g(w);return k===void 0?m:(b==="-"?k=k.replace(/^[0 ]+(?=.)/,""):b==="_"?k=k.replace(/^0+(?=.)/,S=>" ".repeat(S.length)):b==="^"&&(k=k.toUpperCase()),k)})}var i9=new Set(["var","func","method","attr","filter","test","kwarg","keyword","constant"]),OE=60;function Si(e,t,n){let r=t.toLowerCase();if(!r)return e.slice(0,OE);let a=s=>{let l=n(s).toLowerCase();return l===r?0:l.startsWith(r)?1:l.split(".").at(-1)?.startsWith(r)?2:l.includes(r)?3:-1};return e.map((s,l)=>({t:s,i:l,r:a(s)})).filter(s=>s.r>=0).sort((s,l)=>s.r-l.r||s.i-l.i).slice(0,OE).map(s=>s.t)}var Ko=(e,t,n)=>({label:e.insert&&(t==="function"||t==="method")?e.insert:e.name,insert:e.insert??e.name,...e.caret===void 0?{}:{caret:e.caret},kind:t,...n?{detail:n}:{},doc:e.doc,...e.sig?{sig:e.sig}:{},...e.again?{again:!0}:{}});function sl(e,t=[]){let n=[...e],r=new Set(e.map(a=>a.name));for(let a of t)r.has(a.name)||(r.add(a.name),n.push({name:a.name,doc:a.doc??a.fqcn}));return n}function Wo(e,t){for(let n=t-1;n>=0;n--){let r=e[n];if(r.kind)return{t:r,i:n};if(r.text.trim())return}}function a9(e,t){let n={")":"(","]":"[","}":"{"}[e[t]?.text??""],r=0;for(let a=t;a>=0;a--){let s=e[a];if(s.kind==="punct"){if(s.text===e[t]?.text)r++;else if(s.text===n&&--r===0)return a}}return-1}function Wy(e,t,n){let r=e[t];if(!r)return{};if(r.kind==="string")return{type:"str"};if(r.text===")"){let a=a9(e,t),s=a>0?Wo(e,a):void 0,l=e.slice(a+1,t);if(s&&s.t.start+s.t.text.length===e[a]?.start){let p=s.t.text;if(s.t.kind==="func"&&p==="now")return{type:l.some(h=>h.kind==="kwarg"&&h.text==="fmt")?"str":"datetime"};if(s.t.kind==="func")return{type:eu.find(h=>h.name===p)?.returns};if(s.t.kind==="filter")return{type:Ky[p]};if(s.t.kind==="method"){let h=Wo(e,s.i),v=h?.t.text==="."?Wo(e,h.i):void 0,g=v?Wy(e,v.i,n).type:void 0;return{type:g?tu[g].find(m=>m.name===p)?.returns:void 0}}}let f=0;for(let p=t-1;p>a;p--){let h=e[p];if(h.text===")"||h.text==="]")f++;else if(h.text==="("||h.text==="[")f--;else if(f===0&&h.kind==="filter")return{type:Ky[h.text]}}return{}}if(r.kind==="filter")return{type:Ky[r.text]};if(r.kind==="var"){let a=n.vars.find(s=>s.name===r.text);return a?{choice:a}:r.text==="loop"?{type:"loop"}:{type:Hy.find(s=>s.name===r.text)?.returns}}if(r.kind==="attr"){let a=Wo(e,e.indexOf(r)),s=a?.t.text==="."?Wo(e,a.i):void 0;if(s?.t.kind==="var"&&n.vars.some(l=>l.name===s.t.text&&l.fields))return{type:EE[r.text]};if(s){let l=Wy(e,s.i,n).type;if(l)return{type:tu[l].find(f=>f.name===r.text)?.returns}}}return{}}function s9(e,t,n,r){let a=t?AE.map(l=>({label:l.format,insert:l.format,kind:"format",detail:l.doc,doc:`${l.doc}: ${l.format}`,preview:nu(l.format,n,r)})):[],s=_E.filter(l=>!e||l.code.startsWith(e)).map(l=>({label:l.code,insert:l.code,kind:"format",detail:l.doc,doc:l.doc,preview:nu(l.code,n,r),again:!0}));return[...a,...s]}function Uy(e){let t=e.map(n=>n.text).join("");return/now\(\s*utc\s*=\s*(true|True)\s*\)\s*\.\s*strftime\(\s*['"][^'"]*$/.test(t)}function l9(e,t){if(t==="func")return eu.find(n=>n.name===e&&n.sig);if(t==="filter")return Ch.find(n=>n.name===e);if(t==="test")return Vy.find(n=>n.name===e);if(t==="method")for(let n of Object.values(tu)){let r=n.find(a=>a.name===e&&a.sig);if(r)return r}}function Yy(e,t,n,r={}){let{tokens:a,end:s}=al(e.slice(0,t),n);if(s.where!=="expr"&&s.where!=="stmt")return;let l=[...s.stack].reverse().find(h=>h.open==="("&&h.callee);if(!l?.callee)return;let f=l9(l.callee,l.calleeKind);if(!f?.sig)return;let p={label:f.sig,doc:f.doc,arg:l.arg};return(l.callee==="strftime"&&l.calleeKind==="method"||l.callee==="now"&&l.kwarg==="fmt"||l.callee==="to_datetime"&&l.calleeKind==="filter")&&s.string&&(p.preview=nu(e.slice(s.string.start+1,t)+(/^[^'"]*/.exec(e.slice(t))?.[0]??""),r.now??new Date,Uy(a))),p}function PE(e,t,n,r){let a=e.slice(0,t),{tokens:s,end:l}=al(a,n);if(l.where!=="expr"&&l.where!=="stmt")return;let f=r.now??new Date,p=Yy(e,t,n,r),h=/^[A-Za-z0-9_]*/.exec(e.slice(t))?.[0]??"";if(l.string){let j=l.stack[l.stack.length-1],E=a.slice(l.string.start+1);if(j&&(j.callee==="strftime"&&j.calleeKind==="method"&&j.arg===0||j.callee==="now"&&j.kwarg==="fmt"||j.callee==="to_datetime"&&j.calleeKind==="filter"&&j.arg===0)){let I=/%[-_0^#]?[A-Za-z]?$/.exec(E)?.[0]??"",z=s9(I,E==="",f,Uy(s));return z.length?{from:t-I.length,to:t,items:z,context:"format",...p?{hint:p}:{}}:void 0}if(j&&j.calleeKind==="func"&&["lookup","query","q"].includes(j.callee??"")&&j.arg===0){let I=Si(sl($E,r.lookups),E,z=>z.name).map(z=>Ko({...z,insert:z.name},"lookup"));return I.length?{from:l.string.start+1,to:t+h.length,items:I,context:"lookup",...p?{hint:p}:{}}:void 0}return}let v=s[s.length-1],g=v?.kind&&i9.has(v.kind)&&v.start+v.text.length===t?v:void 0,m=g?.text??"",b=g?g.start:t,w=t+h.length,k=Wo(s,g?s.length-1:s.length),S=(j,E)=>j.length?{from:b,to:w,items:j,context:E,...p?{hint:p}:{}}:void 0;if(l.where==="stmt"&&(!l.stmtWord||g&&k?.t.kind==="delim"))return S(Si(r9,m,j=>j.name).map(j=>Ko(j,"keyword")),"statement");if(k?.t.text==="|")return S(Si(sl(Ch,r.filters),m,j=>j.name).map(j=>Ko(j,"filter")),"filter");if(k?.t.kind==="keyword"&&k.t.text==="is"||k?.t.kind==="keyword"&&k.t.text==="not"&&Wo(s,k.i)?.t.text==="is")return S(Si(sl(Vy,r.tests),m,j=>j.name).map(j=>Ko(j,"test")),"test");if(k?.t.text==="."){let j=Wo(s,k.i);if(!j)return;let{type:E,choice:I}=Wy(s,j.i,r);if(I?.fields)return S(Si(I.fields,m,M=>M.name).map(M=>({label:M.name,insert:M.name,kind:"field",detail:EE[M.name],doc:M.detail})),"member");if(!E)return;let z=[],T=/utc\s*=\s*(true|True)/.test(s.slice(Math.max(0,j.i-8),j.i+1).map(M=>M.text).join(""));for(let M of Si(tu[E],m,O=>O.name)){if(M.name==="strftime")for(let O of AE)z.push({label:`strftime('${O.format}')`,insert:`strftime('${O.format}')`,kind:"method",detail:O.doc,doc:M.doc,sig:M.sig,preview:nu(O.format,f,T)});z.push(Ko(M,M.insert?"method":"field",M.returns))}return S(z,"member")}if(k&&(k.t.kind==="var"||k.t.kind==="attr"||k.t.kind==="string"||k.t.kind==="number"||k.t.kind==="constant"||k.t.kind==="filter"||k.t.kind==="test"||k.t.text===")"||k.t.text==="]"))return m?S(Si(CE,m,j=>j.name).map(j=>Ko(j,"keyword")),"operator"):void 0;let N=[...r.vars.map(j=>({label:j.name,insert:j.name,kind:"variable",detail:j.label===j.name?j.detail:j.label,doc:j.detail,...j.field?{choice:j}:{}})),...Hy.map(j=>Ko(j,"variable")),...eu.map(j=>Ko(j,"function",j.returns)),...o9.map(j=>Ko(j,"keyword")),Ko(CE[2],"keyword")],$=new Set;return S(Si(N.filter(j=>!$.has(j.insert)&&$.add(j.insert)),m,j=>j.insert).map(j=>j),"value")}function Xy(e,t,n,r){let{tokens:a}=al(e,n),s=a.findIndex(p=>p.start<=t&&t<p.start+p.text.length),l=a[s];if(!l?.kind)return;let f=p=>p?{label:p.sig??p.name,doc:p.doc}:void 0;switch(l.kind){case"func":return f(eu.find(p=>p.name===l.text&&p.sig)??eu.find(p=>p.name===l.text));case"method":case"attr":for(let p of Object.values(tu)){let h=p.find(v=>v.name===l.text);if(h)return f(h)}return;case"filter":return f(sl(Ch,r.filters).find(p=>p.name===l.text));case"test":return f(sl(Vy,r.tests).find(p=>p.name===l.text));case"var":{let p=r.vars.find(h=>h.name===l.text);return p?{label:p.name,doc:p.detail}:f(Hy.find(h=>h.name===l.text))}case"format":{let p=_E.find(h=>h.code===l.text.replace(/^%[-_0^#]/,"%"));return p?{label:l.text,doc:p.doc,preview:nu(l.text,r.now??new Date,Uy(a.slice(0,s)))}:void 0}case"string":{let p=Wo(a,s),h=p?.t.text==="("?Wo(a,p.i):void 0;if(h?.t.kind==="func"&&["lookup","query","q"].includes(h.t.text)){let v=l.text.replace(/^['"]|['"]$/g,"");return f(sl($E,r.lookups).find(g=>g.name===v))}return}default:return}}var DE=4;function IE(e,t,n,r){let a=Math.max(DE,Math.min(e.left,r.width-DE-n.width)),s=!(e.bottom+2+n.height<=r.height)&&e.top-2-n.height>=0;return{left:a-t.left,top:s?e.top-t.top-2-n.height:e.bottom-t.top+2,above:s}}var d9=e=>`{{ ${e} }}`;function ou(e){let t=[],n=0,r=a=>{for(let s of a.childNodes)if(s instanceof HTMLElement&&s.dataset.ref){let l=d9(s.dataset.ref).length;t.push({node:s,start:n,end:n+l,chip:s}),n+=l}else if(s.nodeType===Node.TEXT_NODE){let l=(s.textContent??"").length;t.push({node:s,start:n,end:n+l}),n+=l}else s instanceof HTMLElement&&s.tagName!=="BR"&&r(s)};return r(e),t}function ru(e){return f4(ou(e).map(t=>t.chip?{ref:t.chip.dataset.ref??"",raw:""}:{text:(t.node.textContent??"").replaceAll(`
|
|
176
|
+
`," ")}))}function Zy(e,t,n,r=ou(e)){let a=r.find(f=>f.chip&&(f.chip===t||f.chip.contains(t)));if(a)return a.end;if(t.nodeType===Node.TEXT_NODE){let f=r.find(p=>p.node===t);if(f)return f.start+Math.min(n,f.end-f.start)}let s=[...t.childNodes];for(let f of s.slice(n)){let p=r.find(h=>h.node===f||f.contains(h.node));if(p)return p.start}let l=0;for(let f of r){let p=t.compareDocumentPosition(f.node);(t.contains(f.node)||p&Node.DOCUMENT_POSITION_PRECEDING)&&(l=f.end)}return l}function LE(e){let t=window.getSelection(),n=t?.focusNode;if(t&&n&&e.contains(n))return Zy(e,n,t.focusOffset)}function Gy(e,t,n=ou(e)){let r=n.find(s=>!s.chip&&s.start<=t&&t<=s.end);if(r)return[r.node,t-r.start];let a=n.find(s=>s.chip&&s.start<=t&&t<=s.end);if(a?.chip){let s=a.chip.parentNode,l=[...s.childNodes].indexOf(a.chip);return[s,t<=a.start?l:l+1]}return[e,t<=0?0:e.childNodes.length]}function u9(e,t,n){let r=ou(e),a=document.createRange();return a.setStart(...Gy(e,t,r)),a.setEnd(...Gy(e,n,r)),a}function c9(e,t){let n=document.createRange();n.setStart(...Gy(e,t)),n.collapse(!0);let r=window.getSelection();r?.removeAllRanges(),r?.addRange(n)}function f9(e,t,n,r,a=r.length){let s=u9(e,t,n),l=window.getSelection();if(l?.removeAllRanges(),l?.addRange(s),!(typeof document.execCommand=="function"&&document.execCommand("insertText",!1,r))){s.deleteContents();let f=document.createTextNode(r);s.insertNode(f),e.normalize()}c9(e,t+a)}function h9(){let e=window.getSelection();if(!e||e.rangeCount===0)return;let t=e.getRangeAt(0);if(typeof t.getBoundingClientRect!="function")return;let n=t.getBoundingClientRect();return n.height>0?n:t.getClientRects?.()[0]}var p9={variable:"symbol-variable",function:"symbol-method",method:"symbol-method",field:"symbol-field",filter:"filter",test:"beaker",lookup:"search",keyword:"symbol-keyword",format:"calendar"},m9={value:"Variables and functions",filter:"Filters",test:"Tests",member:"Members",format:"Date formats",lookup:"Lookups",statement:"Statements",operator:"Operators"};function RE(e){return{vars:e,...a8()}}function g9(e,t){let n=e.indexOf("("),r=e.lastIndexOf(")");if(n<0||r<n)return e;let a=e.slice(n+1,r).split(/,\s*/);return(0,c.jsxs)(c.Fragment,{children:[e.slice(0,n+1),a.map((s,l)=>(0,c.jsxs)(A.Fragment,{children:[l>0?", ":"",l===t?(0,c.jsx)("strong",{children:s}):s]},l)),e.slice(r)]})}var zE=(0,A.forwardRef)(function({id:e,completion:t,active:n,onPick:r,style:a},s){let l=t.items[n];return(0,c.jsxs)("div",{ref:s,className:"afd-jinja-popup",style:a,"data-jinja-context":t.context,children:[(0,c.jsx)("div",{className:"afd-ref-menu afd-jinja-menu",role:"listbox",id:e,"aria-label":m9[t.context],children:t.items.map((f,p)=>(0,c.jsxs)("div",{id:`${e}-${p}`,role:"option",tabIndex:-1,"aria-selected":p===n,className:p===n?"active":"",onMouseDown:h=>{h.preventDefault(),r(f)},children:[(0,c.jsx)("span",{className:`codicon codicon-${p9[f.kind]}`,"aria-hidden":"true"}),(0,c.jsx)("span",{className:"mono afd-jinja-label",children:f.label}),f.preview===void 0?f.detail?(0,c.jsx)("span",{className:"muted",children:f.detail}):null:(0,c.jsxs)("span",{className:"mono afd-jinja-preview",children:["\u2192 ",f.preview||"(empty)"]})]},`${f.label}|${p}`))}),l&&(l.sig||l.doc)?(0,c.jsxs)("div",{className:"afd-jinja-doc","aria-live":"polite",children:[l.sig?(0,c.jsx)("div",{className:"mono",children:l.sig}):null,l.doc?(0,c.jsx)("div",{className:"muted",children:l.doc}):null]}):null]})});function FE({hint:e}){return(0,c.jsxs)("div",{className:"afd-jinja-hint","data-jinja-hint":!0,children:[(0,c.jsx)("span",{className:"mono",children:g9(e.label,e.arg)}),e.preview===void 0?null:(0,c.jsxs)("span",{className:"mono afd-jinja-preview",children:[" \u2192 ",e.preview||"(empty)"]}),e.doc?(0,c.jsxs)("span",{className:"muted",children:[" ",e.doc]}):null]})}function BE({tip:e,style:t}){return(0,c.jsxs)("div",{className:"afd-jinja-tip",role:"tooltip",style:t,children:[(0,c.jsx)("div",{className:"mono",children:e.label}),e.doc?(0,c.jsx)("div",{className:"muted",children:e.doc}):null,e.preview===void 0?null:(0,c.jsxs)("div",{className:"mono afd-jinja-preview",children:["\u2192 ",e.preview||"(empty)"]})]})}function qE(e,t,n){if(e.nativeEvent.isComposing||e.keyCode===229)return!1;let r=()=>{e.preventDefault(),e.stopPropagation()};if(e.key===" "&&e.ctrlKey&&!e.altKey&&!e.metaKey)return r(),n.force(),!0;if(!t||t.count===0)return!1;if(e.key==="ArrowDown"||e.key==="ArrowUp"){r();let a=e.key==="ArrowDown"?1:t.count-1;return n.move((t.active+a)%t.count),!0}return(e.key==="Enter"||e.key==="Tab")&&!e.shiftKey&&!e.ctrlKey&&!e.altKey?(r(),n.pick(),!0):e.key==="Escape"&&(r(),n.close(),!0)}function HE(e,t){let n=e?.slice(-1);return!n||!t?!1:/[A-Za-z0-9_.|'"%({]/.test(n)?!0:n===" "&&(t.context==="test"||t.context==="filter")}function VE(e,t,n,r){let a=n.caret??n.insert.length,s=e.slice(t.to).split("{{")[0]??"",l=/\{\{(?![\s\S]*\}\})[\s\S]*$/.test(e.slice(0,t.from));return r&&l&&!s.includes("}}")&&t.context!=="format"&&t.context!=="lookup"?{text:`${n.insert} }}`,caret:a}:{text:n.insert,caret:a}}var KE=()=>typeof CSS<"u"&&"highlights"in CSS?CSS.highlights:void 0,WE=()=>globalThis.Highlight,UE=()=>!!KE()&&!!WE(),Qy=new Map,Jy=new Map;function y9(e){let t=Qy.get(e),n=WE(),r=KE();return!t&&n&&r&&(t=new n,Qy.set(e,t),r.set(`afd-syn-${e}`,t)),t}function v9(e,t){if(UE()){YE(e);for(let n of t)y9(n.colour)?.add(n.range);Jy.set(e,t)}}function YE(e){for(let t of Jy.get(e)??[])Qy.get(t.colour)?.delete(t.range);Jy.delete(e)}function ev(e){let t=document.createElement("span");return t.className="afd-ref-chip",t.contentEditable="false",t.dataset.ref=e,t.textContent=e,t}function b9(e,t,n){n==="expr"?e.replaceChildren(...t?[document.createTextNode(t)]:[]):e.replaceChildren(...c4(t).map(r=>"ref"in r?ev(r.ref):document.createTextNode(r.text)))}function XE(e,t,n,r){if(!UE())return;let a=ou(t).filter(l=>!l.chip&&l.end>l.start),s=[];for(let l of n9(n,{mode:Jd(n,r==="expr")}))for(let f of a){let p=Math.max(l.start,f.start),h=Math.min(l.end,f.end);if(p>=h)continue;let v=document.createRange();v.setStart(f.node,p-f.start),v.setEnd(f.node,h-f.start),s.push({colour:l.colour,range:v})}v9(e,s)}function x9(e,t){let n=window.getSelection(),r=n&&n.rangeCount>0&&e.contains(n.getRangeAt(0).commonAncestorContainer)?n.getRangeAt(0):void 0,a=document.createTextNode(t);r?(r.deleteContents(),r.insertNode(a)):e.append(a);let s=document.createRange();s.setStartAfter(a),s.collapse(!0),n?.removeAllRanges(),n?.addRange(s)}function w9(e){let t=window.getSelection();if(!t||t.rangeCount===0)return;let n=t.getRangeAt(0);return e.contains(n.startContainer)&&e.contains(n.endContainer)?n.cloneRange():void 0}function ZE(e){let t=document.createRange();t.setStartAfter(e),t.collapse(!0);let n=window.getSelection();n?.removeAllRanges(),n?.addRange(t)}function tv(e){let t=window.getSelection(),n=t?.anchorNode;if(!t||!n||n.nodeType!==Node.TEXT_NODE||!e.contains(n))return;let r=(n.textContent??"").slice(0,t.anchorOffset),a=/@([A-Za-z0-9_.]*)$/.exec(r);return a?{node:n,start:r.length-a[0].length,query:a[1]??""}:void 0}function GE(e){let t=window.getSelection(),n=t?.anchorNode;if(!t||!n||n.nodeType!==Node.TEXT_NODE||!e.contains(n))return;let r=n.previousSibling;for(;r instanceof Text&&!r.textContent;)r=r.previousSibling;if(!(r instanceof HTMLElement)||!r.dataset.ref)return;let a=/^\.([A-Za-z0-9_]*)$/.exec((n.textContent??"").slice(0,t.anchorOffset));return a?{chip:r,node:n,query:a[1]??""}:void 0}function QE(e,t,n){let r=t.node.splitText(t.start);r.textContent=(r.textContent??"").slice(1+t.query.length),e.insertBefore(n,r),r.textContent||r.remove()}var nv=(e,t)=>e.toLowerCase().includes(t.toLowerCase());function iu({id:e,value:t,onChange:n,choices:r,onAddInput:a,placeholder:s,label:l,onEnter:f,onEscape:p,onLeave:h,mode:v="template"}){let g=(0,A.useRef)(null),m=(0,A.useRef)(null),b=(0,A.useRef)(null),[w,k]=(0,A.useState)(null),S=(0,A.useRef)(void 0),[N,$]=(0,A.useState)(null),[j,E]=(0,A.useState)(null),[I,z]=(0,A.useState)(null),T=(0,A.useRef)(!1),M=(0,A.useRef)(null),O=(0,A.useRef)(null),K=(0,A.useRef)(void 0),B=(0,A.useId)(),V=RE(r),oe=Z=>({mode:Jd(Z,v==="expr")});(0,A.useLayoutEffect)(()=>{let Z=g.current;Z&&t!==b.current&&(b9(Z,t,v),XE(g,Z,t,v)),b.current=t},[t,v]),(0,A.useEffect)(()=>()=>YE(g),[]);let F=()=>{let Z=g.current;if(!Z)return;let q=ru(Z);b.current=q,XE(g,Z,q,v),q!==t&&n(q)},J=w?.kind==="refs"?r.filter(Z=>nv(Z.name,w.query)||nv(Z.label,w.query)):[],L=w?.kind==="fields"?(w.of.fields??[]).filter(Z=>nv(Z.name,w.query)):[],U=w?.kind==="fields"?L.length:J.length,W=(Z,q,ee,de)=>k({kind:"fields",of:Z,query:q,active:0,chip:ee,typed:de}),re=(Z,q)=>{if(v==="expr")return!0;let ee=q?Zy(Z,q.node,q.start):LE(Z);if(ee===void 0)return!1;let de=al(ru(Z).slice(0,ee),{mode:"template"}).end.where;return de==="expr"||de==="stmt"},le=Z=>{let q=g.current;if(!q)return;let ee=w?.kind==="refs"&&w.caret?tv(q):void 0,de=re(q,ee)?document.createTextNode(Z.name):ev(Z.name),me=!ee&&S.current&&q.contains(S.current.startContainer)?S.current:void 0;ee?QE(q,ee,de):me?(me.deleteContents(),me.insertNode(de)):q.append(de),S.current=void 0,Z.field&&a(Z),Z.fields&&de instanceof HTMLElement?W(Z,"",de,!1):k(null),F(),q.focus(),ZE(de)},pe=Z=>{let q=g.current;if(!q||w?.kind!=="fields")return;let ee=`${w.of.name}.${Z.name}`,de=w.chip&&q.contains(w.chip)?w.chip:void 0;if(de){let me=GE(q);me&&me.chip===de&&(me.node.textContent=(me.node.textContent??"").slice(1+me.query.length),me.node.textContent||me.node.remove()),de.dataset.ref=ee,de.textContent=ee}else{let me=tv(q);de=re(q,me)?document.createTextNode(ee):ev(ee),me?QE(q,me,de):q.append(de),w.of.field&&a(w.of)}k(null),F(),q.focus(),ZE(de)},xe=()=>{if(w)if(w.kind==="fields"){let Z=L[w.active];Z&&pe(Z)}else{let Z=J[w.active];Z&&le(Z)}};(0,A.useEffect)(()=>{w&&U>0&&w.active>=U&&k({...w,active:0})},[w,U]),(0,A.useEffect)(()=>{w&&m.current?.querySelector('[aria-selected="true"]')?.scrollIntoView?.({block:"nearest"})},[w]);let Ne=Z=>{let q=g.current,ee=q?LE(q):void 0;if(!q||ee===void 0){$(null),E(null);return}let de=ru(q),me=PE(de,ee,oe(de),{...V,now:new Date}),De=typeof Z=="function"?Z(me):Z;$(Fe=>me&&me.items.length>0&&(De||Fe)?{c:me,active:Fe&&Fe.c.from===me.from&&Fe.c.context===me.context?Math.min(Fe.active,me.items.length-1):0}:null),E(Yy(de,ee,oe(de),{now:new Date})??null)},we=Z=>{let q=g.current;if(!q||!N)return;let ee=ru(q),{text:de,caret:me}=VE(ee,N.c,Z,oe(ee).mode==="template");T.current=!0;try{f9(q,N.c.from,N.c.to,de,me)}finally{T.current=!1}Z.choice&&a(Z.choice),F(),q.focus(),$(null),Ne(!!Z.again)},R=Z=>{if(z(null),w||!qE(Z,N?{count:N.c.items.length,active:N.active}:null,{move:q=>$(ee=>ee&&{...ee,active:q}),pick:()=>{let q=N?.c.items[N.active];q&&we(q)},close:()=>$(null),force:()=>Ne(!0)})){if(w&&U>0){if(Z.key==="ArrowDown"||Z.key==="ArrowUp"){Z.preventDefault();let q=Z.key==="ArrowDown"?1:U-1;k({...w,active:(w.active+q)%U});return}if(Z.key==="Enter"||Z.key==="Tab"){Z.preventDefault(),xe();return}}Z.key==="Escape"&&w?(Z.preventDefault(),Z.stopPropagation(),k(null)):Z.key==="Escape"&&p?(Z.preventDefault(),Z.stopPropagation(),p()):Z.key==="Enter"&&(Z.preventDefault(),f?.())}},Q=Z=>{if(F(),T.current)return;let q=g.current;if(!q)return;z(null);let ee=tv(q);if(ee){$(null);let Ye=ee.query.lastIndexOf("."),Le=Ye>0?ee.query.slice(0,Ye):"",Be=Le?r.find(ut=>ut.fields&&(ut.name===Le||ut.label===Le)):void 0;Be?W(Be,ee.query.slice(Ye+1),void 0,!0):k({kind:"refs",query:ee.query,active:0,caret:!0});return}let de=GE(q),me=de?r.find(Ye=>Ye.fields&&Ye.name===de.chip.dataset.ref):void 0;if(de&&me){W(me,de.query,de.chip,!0),$(null);return}k(null);let De=Z?.nativeEvent,Fe=De?.inputType?.startsWith("insert")?De.data:null;Ne(Ye=>HE(Fe,Ye))},fe=()=>Ne(!1);(0,A.useLayoutEffect)(()=>{let Z=M.current,q=O.current;if(!N||!Z||!q)return;let ee=q.getBoundingClientRect(),de=IE(h9()??{left:ee.left,top:ee.top,bottom:ee.bottom},{left:0,top:0},{width:Z.offsetWidth,height:Z.offsetHeight},{width:window.innerWidth,height:window.innerHeight});Z.style.left=`${de.left}px`,Z.style.top=`${de.top}px`},[N]),(0,A.useEffect)(()=>{N&&M.current?.querySelector('[aria-selected="true"]')?.scrollIntoView?.({block:"nearest"})},[N]);let X=(Z,q)=>{clearTimeout(K.current),K.current=setTimeout(()=>{let ee=g.current,de=O.current,me=document.caretRangeFromPoint?.(Z,q);if(!ee||!de||!me||!ee.contains(me.startContainer)||N){z(null);return}let De=ru(ee),Fe=Zy(ee,me.startContainer,me.startOffset),Ye=new Date,Le=Xy(De,Fe,oe(De),{...V,now:Ye})??(Fe>0?Xy(De,Fe-1,oe(De),{...V,now:Ye}):void 0);z(Le?{d:Le,left:Z,top:q+16}:null)},300)};(0,A.useEffect)(()=>()=>clearTimeout(K.current),[]);let he=(Z,q,ee,de)=>(0,c.jsx)("div",{role:"option",tabIndex:-1,"aria-selected":q===w?.active,className:q===w?.active?"active":"",onMouseDown:me=>{me.preventDefault(),ee()},children:de},Z);return(0,c.jsxs)("div",{className:"afd-chipfield",ref:O,children:[(0,c.jsx)("div",{ref:g,id:e,className:`afd-input afd-chipfield-input${v==="expr"?" mono":""}`,contentEditable:!0,suppressContentEditableWarning:!0,role:"textbox",tabIndex:0,"aria-label":l,"aria-autocomplete":"list",spellCheck:!1,"aria-controls":N?B:void 0,"aria-activedescendant":N?`${B}-${N.active}`:void 0,"data-placeholder":s,onInput:Q,onKeyDown:R,onKeyUp:Z=>{["ArrowLeft","ArrowRight","Home","End"].includes(Z.key)&&fe()},onMouseUp:fe,onMouseMove:Z=>X(Z.clientX,Z.clientY),onMouseLeave:()=>{clearTimeout(K.current),z(null)},onBlur:()=>{setTimeout(()=>k(null),150),$(null),E(null),z(null),h?.()},onPaste:Z=>{Z.preventDefault();let q=Z.clipboardData.getData("text/plain").replaceAll("\r","");q&&(x9(Z.currentTarget,q),Q())}}),(0,c.jsx)("button",{type:"button",className:"icon afd-chipfield-at",title:"Insert an input (@)","aria-label":`Insert an input into ${l??"the value"}`,onMouseDown:Z=>{Z.preventDefault(),S.current=g.current?w9(g.current):void 0},onClick:()=>k(w?null:{kind:"refs",query:"",active:0,caret:!1}),children:"@"}),w?.kind==="refs"?(0,c.jsx)("div",{ref:m,className:"afd-ref-menu",role:"listbox","aria-label":"Inputs",children:J.length===0?(0,c.jsx)("div",{className:"muted",children:"No inputs match. Add inputs on the Inputs and outputs tab."}):J.map((Z,q)=>he(`${Z.label}|${Z.name}`,q,()=>le(Z),(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("span",{className:"afd-ref-chip",children:Z.name})," ",(0,c.jsx)("span",{className:"mono",children:Z.label===Z.name?"":Z.label})," ",(0,c.jsx)("span",{className:"muted",children:Z.detail})]})))}):null,N&&!w?(0,c.jsx)(zE,{ref:M,id:B,completion:N.c,active:N.active,onPick:we}):null,j&&!N&&!w?(0,c.jsx)(FE,{hint:j}):null,I&&!N?(0,c.jsx)(BE,{tip:I.d,style:{left:I.left,top:I.top}}):null,w?.kind==="fields"?(0,c.jsxs)("div",{ref:m,className:"afd-ref-menu",role:"listbox","aria-label":`Fields of ${w.of.name}`,"data-ref-fields":w.of.name,children:[(0,c.jsx)("p",{className:"afd-ref-menu-head muted",children:w.typed?`Fields of ${w.of.name}`:`Read one field of ${w.of.name}, or go on typing to keep the whole result`}),L.length===0?(0,c.jsx)("div",{className:"muted",children:"No documented field matches."}):L.map((Z,q)=>he(Z.name,q,()=>pe(Z),(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("span",{className:"afd-ref-chip",children:`${w.of.name}.${Z.name}`})," ",(0,c.jsx)("span",{className:"muted",children:Z.detail})]})))]}):null]})}function k9({fields:e,onPick:t}){let n=(0,A.useId)(),[r,a]=(0,A.useState)(""),[s,l]=(0,A.useState)(!1),[f,p]=(0,A.useState)(0),h=s?Q6(e,r):[],v=Math.min(f,Math.max(0,h.length-1)),g=`${n}-list`,m=w=>`${n}-opt-${w}`,b=w=>{w&&(a(""),l(!1),p(0),t(w.name))};return(0,c.jsxs)("div",{className:"afd-field afd-param-picker","data-param-picker":e.length,children:[(0,c.jsx)("label",{htmlFor:n,children:"Add a parameter"}),(0,c.jsxs)("div",{className:"afd-chipfield",children:[(0,c.jsx)("input",{id:n,className:"afd-input",role:"combobox","aria-expanded":s,"aria-controls":g,"aria-autocomplete":"list","aria-activedescendant":s&&h[v]?m(v):void 0,placeholder:`${e.length} more: a name or what it does`,value:r,autoComplete:"off",spellCheck:!1,onChange:w=>{a(w.target.value),l(!0),p(0)},onClick:()=>l(!0),onBlur:()=>setTimeout(()=>l(!1),150),onKeyDown:w=>{if(w.key==="ArrowDown"||w.key==="ArrowUp"){if(w.preventDefault(),!s)return l(!0);let k=h.length;k>0&&p((v+(w.key==="ArrowDown"?1:k-1))%k)}else w.key==="Enter"&&s?(w.preventDefault(),b(h[v])):w.key==="Escape"&&s&&(w.preventDefault(),w.stopPropagation(),l(!1))}}),s?(0,c.jsx)("div",{id:g,className:"afd-ref-menu afd-param-list",role:"listbox","aria-label":"Parameters",children:h.length===0?(0,c.jsxs)("div",{className:"muted",children:["No parameter matches \u201C",r.trim(),"\u201D."]}):h.map((w,k)=>(0,c.jsxs)("div",{id:m(k),role:"option",tabIndex:-1,"aria-selected":k===v,className:k===v?"active":"","data-param-option":w.name,onMouseDown:S=>{S.preventDefault(),b(w)},children:[(0,c.jsx)("span",{className:"mono",children:w.name}),(0,c.jsx)("span",{className:"muted",children:w.option.type}),(0,c.jsx)("span",{className:"afd-param-desc",children:w.option.description.split(`
|
|
177
|
+
`)[0]})]},w.name))}):null]})]})}var S9=/^(true|false|yes|no|null|~|-?[0-9]+(?:[.][0-9]+)?)$/i;function $h(e,t){let n=e[t];for(let r=t+1;r<e.length;r++){let a=e[r];if(n==='"'&&a==="\\")r++;else if(a===n)if(n==="'"&&e[r+1]==="'")r++;else return r+1}return e.length}function N9(e,t){let n="",r=()=>{if(!n)return;let s=n.length-n.trimStart().length,l=n.trim(),f=n.length-s-l.length;s&&t.push({text:n.slice(0,s)}),l&&t.push({text:l,kind:S9.test(l)?"scalar":void 0}),f&&t.push({text:n.slice(s+l.length)}),n=""},a=0;for(;a<e.length;){let s=e[a];if(s==="#"&&(a===0||e[a-1]===" ")){r(),t.push({text:e.slice(a),kind:"comment"});return}if(s==='"'||s==="'"){let l=$h(e,a);r(),t.push({text:e.slice(a,l),kind:"string"}),a=l}else n+=s,a++}r()}function j9(e){let t=[],n=e.length-e.trimStart().length;n&&t.push({text:e.slice(0,n)});let r=e.slice(n);if(r.startsWith("#"))return t.push({text:r,kind:"comment"}),t;let a=/^(-(?: |$))+/.exec(r);a&&(t.push({text:a[0],kind:"dash"}),r=r.slice(a[0].length));let s=/^("[^"]*"|'[^']*'|[^\s#'"][^:#]*?)(:)(?= |$)/.exec(r);return s&&(t.push({text:s[1],kind:"key"}),t.push({text:":",kind:"punct"}),r=r.slice(s[0].length)),N9(r,t),t}var JE=/\{\{|\{%|\{#/;function e_(e,t,n,r){return al(e,{mode:Jd(e,t),yamlQuote:n}).tokens.map(a=>{let s=a.kind?jE[a.kind]:a.text.trim()?r:void 0;return s?{text:a.text,colour:s}:{text:a.text}})}function Eh(e){return j9(e).map(t=>t.kind==="key"?{text:t.text,colour:"key"}:t.kind==="comment"?{text:t.text,colour:"comment"}:t.kind==="dash"||t.kind==="punct"?{text:t.text,colour:"muted"}:t.kind==="string"?{text:t.text,colour:"string"}:t.kind==="scalar"?{text:t.text,colour:/^-?[0-9]/.test(t.text)?"number":"constant"}:{text:t.text})}function t_(e){let t=e.length-e.trimStart().length;if(e.startsWith("#",t))return;let n=/^(-(?: |$))+/.exec(e.slice(t));n&&(t+=n[0].length);let r=/^("[^"]*"|'[^']*'|[^\s#'"][^:#]*?)(:)(?= |$)/.exec(e.slice(t));for(r&&(t+=r[0].length);e[t]===" ";)t++;if(t>=e.length)return{start:e.length,end:e.length};let a=e[t];if(a==='"'||a==="'")return{start:t,end:$h(e,t),quote:a};let s=/\s#/.exec(e.slice(t)),l=s?t+s.index:e.length;for(;l>t&&e[l-1]===" ";)l--;return{start:t,end:l}}function C9(e,t,n){let r=t_(e);if(!r)return;if(r.quote){let s=r.end-r.start>1&&e[r.end-1]===r.quote&&$h(e,r.start)===r.end?r.end-1:r.end;if(t<=r.start||t>s)return;let l=e.slice(r.start+1,s);return{text:l,base:r.start+1,opts:{mode:Jd(l,n),yamlQuote:r.quote}}}if(t<r.start||t>r.end)return;let a=e.slice(r.start,r.end);return{text:a,base:r.start,opts:{mode:Jd(a,n)}}}function $9(e,t=!1){let n=t_(e);if(!n||n.start===n.end)return Eh(e);let r=Eh(e.slice(0,n.start)),a=e.slice(n.start,n.end);if(n.quote){let s=a.length>1&&$h(a,0)===a.length&&a.endsWith(n.quote),l=a.slice(1,s?-1:void 0);!t&&!JE.test(l)?r.push({text:a,colour:"string"}):(r.push({text:n.quote,colour:"string"}),r.push(...e_(l,t,n.quote,t?void 0:"string")),s&&r.push({text:n.quote,colour:"string"}))}else t||JE.test(a)?r.push(...e_(a,t,void 0,void 0)):r.push(...Eh(a));return r.push(...Eh(e.slice(n.end))),r}function n_(e){let t;return e.map(n=>{let r=/^([A-Za-z_][\w-]*)\s*:(?= |$)/.exec(n);return r?t=r[1]:n.trim()&&!/^\s/.test(n)&&!n.startsWith("-")&&!n.startsWith("#")&&(t=void 0),t})}function E9(e){let t=e.length-e.trimStart().length,n=s=>" ".repeat(s),r=/^(\s*)- ?(.*)$/.exec(e);if(r){let s=r[2].trim();if(!s)return{text:n(Math.max(0,t-2)),clear:!0};let l=t+2;return/^[^#'"\s][^#]*:$/.test(s)?{text:`
|
|
178
|
+
${n(l+2)}`}:/^[^#'"\s][^:#]*: /.test(s)?{text:`
|
|
179
|
+
${n(l)}`}:{text:`
|
|
180
|
+
${n(t)}- `}}let a=e.replace(/\s+#.*$/,"").trimEnd();return/^\s*[^#'"\s][^#]*:$/.test(a)?{text:`
|
|
181
|
+
${n(t+2)}`}:{text:`
|
|
182
|
+
${n(t)}`}}function o_(e,t){if(e.trim())try{let n=t?.(kr(e));return n?{message:n}:void 0}catch(n){let r=n.linePos?.[0]?.line;return{message:(n instanceof Error?n.message.split(`
|
|
183
|
+
`)[0]??"":"").replace(/:$/,"")||"Not YAML",line:r}}}var _9=[];function A9(e,t,n,r){let a=[],s=0,l=n===void 0,f=(p,h,v,g)=>h?(0,c.jsx)("span",{className:`afd-syn-${h}`,"data-at":t+g,children:p},v):p;return e.forEach((p,h)=>{let v=s+p.text.length;if(!l&&n!==void 0&&n>=s&&n<=v){let g=n-s;g>0&&a.push(f(p.text.slice(0,g),p.colour,`${h}a`,s)),a.push(r),g<p.text.length&&a.push(f(p.text.slice(g),p.colour,`${h}b`,n)),l=!0}else a.push(f(p.text,p.colour,String(h),s));s=v}),l||a.push(r),a}var ov=(0,A.forwardRef)(function({id:e,value:t,onChange:n,validate:r,rows:a=3,placeholder:s,bareKeys:l,choices:f,onAddInput:p},h){let v=t===void 0?"":fj(t).trimEnd(),[g,m]=(0,A.useState)(v),[b,w]=(0,A.useState)(),k=(0,A.useRef)(null),S=(0,A.useRef)(null),N=(0,A.useRef)(null),$=(0,A.useId)(),[j,E]=(0,A.useState)(null),[I,z]=(0,A.useState)(null),[T,M]=(0,A.useState)(null),O=(0,A.useRef)(null),K=(0,A.useRef)(null),B=(0,A.useRef)(null),V=(0,A.useRef)(void 0),oe=(0,A.useId)(),F=RE(f??_9),J=(0,A.useRef)(r);J.current=r,(0,A.useEffect)(()=>{let R=setTimeout(()=>w(o_(g,J.current)),300);return()=>clearTimeout(R)},[g]),(0,A.useLayoutEffect)(()=>{N.current&&k.current&&(k.current.setSelectionRange(...N.current),N.current=null)});let L=R=>{if(!R.trim()){w(void 0),n(void 0);return}let Q=o_(R,r);w(Q),Q||n(kr(R))};(0,A.useImperativeHandle)(h,()=>({add(R,Q){let fe=g.trimEnd()?`${g.trimEnd()}
|
|
184
|
+
${R}`:R;m(fe),Q?.commit?L(fe):(k.current?.focus(),N.current=[fe.length-(Q?.select??0),fe.length])}}));let U=(R,Q)=>{let fe=R.lastIndexOf(`
|
|
185
|
+
`,Q-1)+1,X=R.indexOf(`
|
|
186
|
+
`,Q),he=R.slice(fe,X<0?void 0:X),Z=R.slice(0,fe).split(`
|
|
187
|
+
`).length-1,q=l?n_(R.split(`
|
|
188
|
+
`))[Z]:void 0,ee=C9(he,Q-fe,!!l?.has(q??""));return ee?{...ee,line:fe,index:Z,col:Q-fe}:void 0},W=(R,Q=g)=>{let fe=k.current;if(!fe||document.activeElement!==fe||fe.selectionStart!==fe.selectionEnd){E(null),z(null);return}let X=fe.selectionStart,he=U(Q,X),Z=new Date,q=he?PE(he.text,he.col-he.base,he.opts,{...F,now:Z}):void 0,ee=typeof R=="function"?R(q):R;E(de=>he&&q&&q.items.length>0&&(ee||de)?{c:q,text:he.text,opts:he.opts,start:he.line+he.base,index:he.index,col:he.col,active:de&&de.c.from===q.from&&de.c.context===q.context?Math.min(de.active,q.items.length-1):0}:null),z((he&&Yy(he.text,he.col-he.base,he.opts,{now:Z}))??null)},re=R=>{let Q=k.current;if(!Q||!j)return;let fe=VE(j.text,j.c,R,j.opts.mode==="template"),X=j.opts.yamlQuote,he=De=>X==="'"?De.replaceAll("'","''"):X==='"'?De.replaceAll('"','\\"'):De,Z=he(fe.text),q=he(fe.text.slice(0,fe.caret)).length,ee=j.start+j.c.from,de=j.start+j.c.to;Q.focus(),Q.setSelectionRange(ee,de);let me=g.slice(0,ee)+Z+g.slice(de);typeof document.execCommand=="function"&&document.execCommand("insertText",!1,Z)||m(me),Q.setSelectionRange(ee+q,ee+q),N.current=[ee+q,ee+q],R.choice&&p?.(R.choice),E(null),R.again?setTimeout(()=>W(!0,me)):z(null)},le=R=>{if(M(null),qE(R,j?{count:j.c.items.length,active:j.active}:null,{move:ee=>E(de=>de&&{...de,active:ee}),pick:()=>{let ee=j?.c.items[j.active];ee&&re(ee)},close:()=>E(null),force:()=>W(!0)})||R.key!=="Enter"||R.shiftKey||R.ctrlKey||R.metaKey||R.altKey||R.nativeEvent.isComposing)return;let Q=R.currentTarget,fe=Q.selectionStart,X=g.lastIndexOf(`
|
|
189
|
+
`,fe-1)+1,he=E9(g.slice(X,fe));R.preventDefault();let Z=he.clear?g.slice(0,X)+he.text+g.slice(Q.selectionEnd):g.slice(0,fe)+he.text+g.slice(Q.selectionEnd),q=(he.clear?X:fe)+he.text.length;N.current=[q,q],m(Z)};(0,A.useLayoutEffect)(()=>{let R=O.current,Q=K.current?.getBoundingClientRect();if(!j||!R||!Q||Q.height===0)return;let fe=IE({left:Q.left,top:Q.top,bottom:Q.top+18},{left:0,top:0},{width:R.offsetWidth,height:R.offsetHeight},{width:window.innerWidth,height:window.innerHeight});R.style.left=`${fe.left}px`,R.style.top=`${fe.top}px`},[j]),(0,A.useEffect)(()=>{j&&O.current?.querySelector('[aria-selected="true"]')?.scrollIntoView?.({block:"nearest"})},[j]),(0,A.useEffect)(()=>()=>clearTimeout(V.current),[]);let pe=(R,Q)=>{clearTimeout(V.current),V.current=setTimeout(()=>{let fe=[...S.current?.querySelectorAll("[data-at]")??[]].find(q=>[...q.getClientRects()].some(ee=>R>=ee.left&&R<=ee.right&&Q>=ee.top&&Q<=ee.bottom)),X=fe?Number(fe.dataset.at):NaN,he=Number.isNaN(X)||j?void 0:U(g,X),Z=he?Xy(he.text,he.col-he.base,he.opts,{...F,now:new Date}):void 0;M(Z?{d:Z,left:R,top:Q+16}:null)},300)},xe=g.split(`
|
|
190
|
+
`),Ne=l?n_(xe):[],we=0;return(0,c.jsxs)("div",{className:"afd-yaml",children:[(0,c.jsxs)("div",{className:"afd-yaml-box",ref:B,children:[(0,c.jsx)("pre",{ref:S,className:"afd-input mono afd-yaml-layer","aria-hidden":"true",children:xe.map((R,Q)=>{let fe=we;return we+=R.length+1,(0,c.jsxs)("span",{className:b?.line===Q+1?"afd-yaml-line error":"afd-yaml-line",children:[A9($9(R,!!l?.has(Ne[Q]??"")),fe,j?.index===Q?j.col:void 0,(0,c.jsx)("span",{ref:K,className:"afd-yaml-caret"},"caret")),Q<xe.length-1?`
|
|
191
|
+
`:" "]},Q)})}),(0,c.jsx)("textarea",{ref:k,id:e,className:`afd-input mono afd-yaml-text${b?" invalid":""}`,rows:a,value:g,placeholder:s,spellCheck:!1,"aria-invalid":!!b,"aria-describedby":b?$:void 0,"aria-autocomplete":"list","aria-controls":j?oe:void 0,"aria-activedescendant":j?`${oe}-${j.active}`:void 0,onChange:R=>{m(R.target.value),M(null);let Q=R.nativeEvent,fe=Q?.inputType?.startsWith("insert")?Q.data:null,X=R.target.value;setTimeout(()=>W(he=>HE(fe,he),X))},onKeyDown:le,onKeyUp:R=>{(["ArrowLeft","ArrowRight","Home","End"].includes(R.key)||!j&&["ArrowUp","ArrowDown"].includes(R.key))&&W(!1)},onMouseUp:()=>W(!1),onMouseMove:R=>pe(R.clientX,R.clientY),onMouseLeave:()=>{clearTimeout(V.current),M(null)},onScroll:R=>{S.current&&(S.current.scrollTop=R.currentTarget.scrollTop,S.current.scrollLeft=R.currentTarget.scrollLeft)},onBlur:()=>{E(null),z(null),M(null),L(g)}}),j?(0,c.jsx)(zE,{ref:O,id:oe,completion:j.c,active:j.active,onPick:re}):null,T&&!j?(0,c.jsx)(BE,{tip:T.d,style:{left:T.left,top:T.top}}):null]}),I&&!j?(0,c.jsx)(FE,{hint:I}):null,b?(0,c.jsx)("div",{className:"afd-field-error",id:$,children:b.message}):null]})}),r_={"check-mode":{text:"check mode",tone:"ok"},"check-mode-partial":{text:"check mode: partial",tone:"warn"},"no-check-mode":{text:"no check mode",tone:"warn"},diff:{text:"diff",tone:"ok"},"read-only":{text:"read-only",tone:"neutral"},"other-platform":{text:"other platform",tone:"warn"},deprecated:{text:"deprecated",tone:"warn"}},T9=[{kind:"module",label:"Module"},{kind:"role",label:"Role"},{kind:"playbook",label:"Playbook"}];function M9(e){let{draft:t}=e,[n,r]=(0,A.useState)([]),a=$=>{n.includes($)||r([...n,$]),requestAnimationFrame(()=>document.querySelector(`[data-param="${$}"] input, [data-param="${$}"] textarea, [data-param="${$}"] select, [data-param="${$}"] [contenteditable]`)?.focus())},s=xi(t.kind==="module"&&t.ref?{op:"doc",fqcn:t.ref}:null,`doc:${t.kind}:${t.ref}`),l=xi(t.kind==="role"?{op:"roles"}:null,`roles:${t.kind}`),f=xi(t.kind==="playbook"?{op:"playbooks"}:null,`playbooks:${t.kind}`),p=l.data?.find($=>$.name===t.ref),h=f.data?.find($=>$.path===t.ref),v=_($=>$.snapshot?.findings),g=_($=>$.expanded),m=(0,c.jsx)(O9,{...e,roles:l,playbooks:f});if(!t.ref)return(0,c.jsx)("div",{className:"afd-impl afd-impl-unbound",children:(0,c.jsx)("section",{className:"afd-impl-find","aria-label":"Find",children:m})});let{node:b}=e,w=t.kind==="module"?"module":t.kind,k=b.impl?.kind!==t.kind||b.impl?.ref!==t.ref,S=t.kind==="module"&&!s.loading&&(!!s.error||!s.data),N=(v??[]).some($=>$.node===b.id&&J6.has($.code));return(0,c.jsxs)("div",{className:"afd-impl",children:[(0,c.jsx)("section",{className:"afd-impl-configure","aria-label":"Configure",children:(0,c.jsx)(z9,{...e,doc:s.data??null,docLoading:s.loading,role:p,playbook:h,extra:n,addParam:a})}),(0,c.jsx)("section",{className:"afd-impl-find","aria-label":`Change ${w}`,children:(0,c.jsx)(jr,{id:"binding-change",lazy:!0,open:g||k||S||N,summary:(0,c.jsxs)(c.Fragment,{children:["Change ",w," \xB7 ",(0,c.jsx)("span",{className:"mono",children:t.ref})]}),children:m})}),(0,c.jsx)("section",{className:"afd-impl-about","aria-label":"About",children:(0,c.jsx)(jr,{id:"binding-about",open:g,summary:(0,c.jsxs)(c.Fragment,{children:["About ",(0,c.jsx)("span",{className:"mono",children:t.ref})]}),children:t.kind==="module"?(0,c.jsx)(I9,{...e,doc:s.data??null,loading:s.loading,error:s.error,extra:n,addParam:a}):t.kind==="role"?(0,c.jsx)(L9,{...e,role:p}):(0,c.jsx)(R9,{playbook:h})})})]})}function O9({node:e,draft:t,setDraft:n,roles:r,playbooks:a}){let s=(0,A.useId)(),[l,f]=(0,A.useState)(""),p=_(w=>w.catalog),h=(e.intent||e.title).trim(),v=l.trim()||h,g=xi(t.kind==="module"&&v?{op:"search",query:v,types:["module"]}:null,`search:${t.kind}:${v}`,l?200:0),m=(w,k,S={})=>n({...t,kind:w,ref:k,params:k===t.ref&&w===t.kind?t.params:{},register:w==="module"?t.register||Ys(e):"",...S}),b=l.trim().toLowerCase();return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("span",{className:"afd-label",children:"Bind to"}),(0,c.jsx)("fieldset",{className:"afd-segmented afd-kind","aria-label":"Bind to",children:T9.map(w=>(0,c.jsx)("button",{type:"button",className:t.kind===w.kind?"active":"","aria-pressed":t.kind===w.kind,onClick:()=>t.kind!==w.kind&&m(w.kind,""),children:w.label},w.kind))}),(0,c.jsx)("label",{htmlFor:s,className:"afd-label",children:t.kind==="module"?"Search modules":t.kind==="role"?"Filter roles":"Filter playbooks"}),(0,c.jsx)("input",{id:s,className:"afd-input",value:l,placeholder:t.kind==="module"?h||"vlan, restart service\u2026":"",onChange:w=>f(w.target.value),"data-catalog-search":!0}),(0,c.jsxs)("div",{className:"afd-chips",children:[p.environment?(0,c.jsxs)("span",{className:"afd-chip afd-ctx",children:["in ",p.environment]}):null,(p.platforms??[]).map(w=>(0,c.jsxs)("span",{className:"afd-chip afd-ctx",children:["platform: ",w.split(".")[1]??w]},w))]}),p.state==="loading"?(0,c.jsxs)("p",{className:"muted",role:"status",children:[(0,c.jsx)("span",{className:"codicon codicon-loading codicon-modifier-spin","aria-hidden":"true"})," ",p.message??"Loading the catalog\u2026"]}):null,t.kind==="module"?(0,c.jsxs)(c.Fragment,{children:[!l.trim()&&h?(0,c.jsxs)("p",{className:"muted afd-suggested",children:["Suggested from intent: \u201C",h,"\u201D"]}):null,g.error?(0,c.jsx)(_h,{message:g.error}):null,g.data?(0,c.jsxs)("span",{className:"muted",children:[g.data.length," results \xB7 ranked by node intent, collections in use and platform"]}):null,(0,c.jsx)("ul",{className:"afd-results","aria-label":"Modules",children:(g.data??[]).map(w=>(0,c.jsx)("li",{children:(0,c.jsx)(P9,{hit:w,selected:t.ref===w.fqcn,onPick:()=>m("module",w.fqcn)})},w.fqcn))})]}):t.kind==="role"?(0,c.jsxs)(c.Fragment,{children:[r.error?(0,c.jsx)(_h,{message:r.error}):null,r.loading?(0,c.jsx)("p",{className:"muted",children:"Reading roles\u2026"}):null,r.data&&r.data.length===0?(0,c.jsx)("p",{className:"muted",children:"No roles in this repository."}):null,(0,c.jsx)("ul",{className:"afd-results","aria-label":"Roles",children:(r.data??[]).filter(w=>!b||w.name.toLowerCase().includes(b)).map(w=>(0,c.jsx)("li",{children:(0,c.jsxs)("button",{type:"button",className:`afd-result${t.ref===w.name?" selected":""}`,onClick:()=>m("role",w.name),children:[(0,c.jsx)("span",{className:"mono afd-result-name",children:w.name}),(0,c.jsx)("span",{className:"afd-result-text",children:w.entry_points.main?.short_description||w.path}),(0,c.jsx)("span",{className:"afd-chips",children:(0,c.jsx)("span",{className:`afd-badge tone-${Object.keys(w.entry_points).length?"ok":"warn"}`,children:Object.keys(w.entry_points).length?"argument specs":"no argument specs"})})]})},w.name))})]}):(0,c.jsxs)(c.Fragment,{children:[a.error?(0,c.jsx)(_h,{message:a.error}):null,a.data&&a.data.length===0?(0,c.jsx)("p",{className:"muted",children:"No playbooks in this repository."}):null,(0,c.jsx)("ul",{className:"afd-results","aria-label":"Playbooks",children:(a.data??[]).filter(w=>!b||w.path.toLowerCase().includes(b)).map(w=>(0,c.jsx)("li",{children:(0,c.jsxs)("button",{type:"button",className:`afd-result${t.ref===w.path?" selected":""}`,onClick:()=>m("playbook",w.path),children:[(0,c.jsx)("span",{className:"mono afd-result-name",children:w.path}),(0,c.jsx)("span",{className:"afd-result-text",children:w.plays.map(k=>k.name||k.hosts).filter(Boolean).join(" \xB7 ")||"no plays"})]})},w.path))})]})]})}function P9({hit:e,selected:t,onPick:n}){return(0,c.jsxs)("button",{type:"button",className:`afd-result${t?" selected":""}${e.dimmed?" dimmed":""}`,onClick:n,"data-hit":e.fqcn,title:e.match,children:[(0,c.jsx)("span",{className:"mono afd-result-name",children:e.fqcn}),(0,c.jsx)("span",{className:"afd-result-text",children:e.short_description}),(0,c.jsxs)("span",{className:"afd-chips",children:[(0,c.jsx)("span",{className:"afd-badge tone-ok",children:"in EE"}),e.badges.map(r=>(0,c.jsx)("span",{className:`afd-badge tone-${r_[r].tone}`,children:r_[r].text},r))]})]})}function _h({message:e}){let[t,n]=(0,A.useState)(!1);return(0,c.jsxs)("div",{className:"afd-catalog-error",role:"alert",children:[(0,c.jsx)("p",{children:e}),(0,c.jsx)("button",{type:"button",className:"secondary",disabled:t,onClick:()=>{n(!0),bh({op:"rebuild"}).finally(()=>n(!1))},children:"Rebuild Catalog"})]})}var rv=6;function D9(e){let[t,n,r]=e.split(".");if(t&&n&&r)return`https://docs.ansible.com/ansible/latest/collections/${t}/${n}/${r}_module.html`}function I9({draft:e,setDraft:t,node:n,doc:r,loading:a,error:s,extra:l,addParam:f}){let[p,h]=(0,A.useState)(!1);if(!e.ref)return(0,c.jsx)("p",{className:"muted afd-empty",children:"Choose a module to see what it does and how to configure it."});if(s)return(0,c.jsx)(_h,{message:s});if(!r)return(0,c.jsx)("p",{className:"muted",children:a?"Reading the docs\u2026":`${e.ref} is not in this environment.`});let v=Object.entries(r.options??{}),g=p?v:v.slice(0,rv),m=new Set([...D$(r.options,e.params).shown.map(S=>S.name),...l]),b=D9(r.fqcn),w=Zd(n,e).outputs??{},k=(S,N)=>{let $=`impl.register.${S}`,j=w[S]?.from===$?null:{type:N,from:$},E={...e.outputs};j===null&&!n.outputs?.[S]?delete E[S]:E[S]=j,t({...e,outputs:E})};return(0,c.jsxs)("div",{className:"afd-doc","data-doc":r.fqcn,children:[b?(0,c.jsx)("a",{href:b,className:"afd-docs-link",children:"Full Docs \u2197"}):null,(0,c.jsx)("h3",{className:"mono",children:r.fqcn}),(0,c.jsx)("p",{children:r.short_description}),(0,c.jsxs)("div",{className:"afd-chips",children:[(0,c.jsxs)("span",{className:"afd-badge tone-neutral",children:[r.collection," ",r.collection_version??""]}),(0,c.jsx)("span",{className:"afd-badge tone-ok",children:"in your EE"}),r.attributes?.check_mode?.support?(0,c.jsxs)("span",{className:`afd-badge tone-${r.attributes.check_mode.support==="full"?"ok":"warn"}`,children:["check mode: ",r.attributes.check_mode.support]}):null,r.attributes?.diff_mode?.support?(0,c.jsxs)("span",{className:"afd-badge tone-neutral",children:["diff mode: ",r.attributes.diff_mode.support]}):null,r.deprecated?(0,c.jsx)("span",{className:"afd-badge tone-warn",children:"deprecated"}):null]}),r.description?(0,c.jsx)("p",{className:"afd-doc-text",children:r.description.split(`
|
|
192
|
+
`)[0]}):null,(0,c.jsxs)("table",{className:"afd-params",children:[(0,c.jsx)("thead",{children:(0,c.jsxs)("tr",{children:[(0,c.jsx)("th",{children:"Parameter"}),(0,c.jsx)("th",{children:"Type"}),(0,c.jsx)("th",{children:"Description"}),(0,c.jsx)("th",{children:(0,c.jsx)("span",{className:"afd-sr-only",children:"Add"})})]})}),(0,c.jsx)("tbody",{children:g.map(([S,N])=>(0,c.jsxs)("tr",{children:[(0,c.jsxs)("td",{className:"mono",children:[S,N.required?(0,c.jsx)("abbr",{title:"required",children:" *"}):null]}),(0,c.jsx)("td",{className:"muted",children:N.type}),(0,c.jsxs)("td",{children:[N.description.split(`
|
|
193
|
+
`)[0],(0,c.jsx)(i_,{option:N})]}),(0,c.jsx)("td",{children:(0,c.jsx)("button",{type:"button",className:"icon","aria-label":`Add ${S} to the parameters`,title:m.has(S)?`${S} is in Configure`:`Add ${S}`,disabled:m.has(S),"data-add-param":S,onClick:()=>f(S),children:(0,c.jsx)("span",{className:"codicon codicon-add","aria-hidden":"true"})})})]},S))})]}),v.length>rv?(0,c.jsx)("button",{type:"button",className:"link",onClick:()=>h(!p),children:p?"Show Fewer Parameters":`Show ${v.length-rv} More Parameters`}):null,r.returns&&Object.keys(r.returns).length>0?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("h4",{children:"Returns \xB7 usable as node outputs"}),(0,c.jsx)("div",{className:"afd-chips",children:Object.entries(r.returns).map(([S,N])=>{let $=w[S]?.from===`impl.register.${S}`;return(0,c.jsx)("button",{type:"button",className:`chip-button mono${$?" active":""}`,"aria-pressed":$,title:`${N.description}${$?" (node output)":" \xB7 add as node output"}`,onClick:()=>k(S,t8(N)),children:S},S)})})]}):null,r.examples?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("h4",{children:"Example from docs"}),(0,c.jsx)("pre",{className:"afd-code",children:r.examples.split(`
|
|
194
|
+
|
|
195
|
+
`)[0]?.trim()})]}):null]})}function i_({option:e}){let t=[];return e.choices?.length&&t.push(e.choices.map(String).join(" \xB7 ")),e.default!==void 0&&e.default!==null&&t.push(`default ${String(e.default)}`),e.aliases?.length&&t.push(`alias: ${e.aliases.join(", ")}`),t.length>0?(0,c.jsxs)("span",{className:"muted afd-facts",children:[" ",t.join(", ")]}):null}function L9({draft:e,setDraft:t,role:n}){if(!e.ref)return(0,c.jsx)("p",{className:"muted afd-empty",children:"Choose a role from this repository."});if(!n)return(0,c.jsxs)("p",{className:"muted",children:["Reading ",e.ref,"\u2026"]});let r=Object.keys(n.entry_points),a=String(e.params.tasks_from??"main"),s=n.entry_points[a];return(0,c.jsxs)("div",{className:"afd-doc","data-doc":n.name,children:[(0,c.jsx)("h3",{className:"mono",children:n.name}),(0,c.jsx)("p",{className:"muted mono",children:n.path}),r.length>1||n.tasks.length>1?(0,c.jsxs)("div",{className:"afd-field",children:[(0,c.jsx)("label",{htmlFor:"afd-role-entry",children:"Entry point (tasks_from)"}),(0,c.jsx)("select",{id:"afd-role-entry",value:a,onChange:l=>{let f={...e.params};l.target.value==="main"?delete f.tasks_from:f.tasks_from=l.target.value,t({...e,params:f})},children:[...new Set(["main",...r,...n.tasks])].map(l=>(0,c.jsx)("option",{value:l,children:l},l))})]}):null,s?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("p",{children:s.short_description}),s.description?(0,c.jsx)("p",{className:"afd-doc-text",children:s.description.split(`
|
|
196
|
+
`)[0]}):null,(0,c.jsx)("table",{className:"afd-params",children:(0,c.jsx)("tbody",{children:Object.entries(s.options).map(([l,f])=>(0,c.jsxs)("tr",{children:[(0,c.jsxs)("td",{className:"mono",children:[l,f.required?(0,c.jsx)("abbr",{title:"required",children:" *"}):null]}),(0,c.jsx)("td",{className:"muted",children:f.type}),(0,c.jsxs)("td",{children:[f.description.split(`
|
|
197
|
+
`)[0],(0,c.jsx)(i_,{option:f})]})]},l))})})]}):(0,c.jsx)("p",{className:"muted",children:"This entry point has no argument spec (meta/argument_specs.yml): its variables are free-form."})]})}function R9({playbook:e}){return e?(0,c.jsxs)("div",{className:"afd-doc","data-doc":e.path,children:[(0,c.jsx)("h3",{className:"mono",children:e.path}),(0,c.jsxs)("p",{children:["The node imports this playbook with ",(0,c.jsx)("span",{className:"mono",children:"afd_hosts"})," set to the hosts arriving here; hosts still running afterwards leave through ok_hosts. Failures inside it stop those hosts."]}),(0,c.jsx)("ul",{className:"afd-plays",children:e.plays.map((t,n)=>(0,c.jsxs)("li",{children:[t.name??"unnamed play"," ",(0,c.jsxs)("span",{className:"muted mono",children:["hosts: ",t.hosts??"?"]})]},n))})]}):(0,c.jsx)("p",{className:"muted afd-empty",children:"Choose a playbook from this repository."})}function z9({node:e,model:t,draft:n,setDraft:r,doc:a,docLoading:s,role:l,playbook:f,extra:p,addParam:h}){let v=Zd(e,n),g=i8(fC(t,e.id).flatMap(B=>B.impl?.kind==="module"&&B.impl.ref?[B.impl.ref]:[])),m=Gd(t,v,B=>B.impl?.ref?g[B.impl.ref]:void 0),b={current:n},w=B=>{b.current=B,r(B)},k=B=>{B.field&&w({...b.current,inputs:{...b.current.inputs,[B.name]:B.field}}),B.expose&&Pe({kind:"setContractField",target:B.expose.node,side:"outputs",name:B.expose.output,field:{type:"dict",from:"impl.register"}})},S=(B,V)=>{let oe={...b.current.params};V===void 0?delete oe[B]:oe[B]=V,w({...b.current,params:oe})},N=String(n.params.tasks_from??"main"),$=n.kind==="module"?E$(n.ref,a?.options):n.kind==="role"?l?.entry_points[N]?.options:void 0,j=G6($,n.params,p),E=[...j.set,...j.added],I=new Set(Object.keys($??{})),z=Object.keys(n.params).filter(B=>!I.has(B)&&B!=="tasks_from"),T=v.impl,M=n8(t,v,{plugin:a,roleSpec:!!l?.entry_points[N],playbookTargets:f?.plays.some(B=>(B.hosts??"").includes("afd_hosts"))});if(!n.ref)return(0,c.jsx)("p",{className:"muted afd-empty",children:"Configure appears once something is chosen."});if(n.kind==="module"&&!a&&s)return(0,c.jsx)("p",{className:"muted",children:"Reading the docs\u2026"});let O={choices:m,onAddInput:k},K=B=>B.map(V=>(0,c.jsx)(B9,{field:V,bare:n.kind==="module"&&x4(n.ref,V.name),value:n.params[V.name],onChange:oe=>S(V.name,oe),...O},V.name));return(0,c.jsxs)("div",{className:"afd-configure",children:[j.required.length>0?(0,c.jsxs)("div",{className:"afd-param-group","data-param-group":"required",children:[(0,c.jsx)("h4",{children:"Required"}),K(j.required)]}):null,E.length>0?(0,c.jsxs)("div",{className:"afd-param-group","data-param-group":"optional",children:[(0,c.jsx)("h4",{children:"Optional"}),K(E)]}):null,j.rest.length>0?(0,c.jsx)(k9,{fields:j.rest,onPick:h}):null,n.kind!=="module"||!$||by(n.ref)?(0,c.jsx)(K9,{names:z,params:n.params,onChange:S,label:n.kind==="playbook"?"Extra vars for the playbook":by(n.ref)?"Facts":"Variables",...O}):null,n.kind==="module"?(0,c.jsx)(F9,{node:e,draft:n,setDraft:r}):null,(0,c.jsx)("ul",{className:"afd-checklist","aria-label":"Checks",children:M.map(B=>(0,c.jsxs)("li",{className:`check-${B.state}`,children:[(0,c.jsx)("span",{className:`codicon codicon-${B.state==="ok"?"check":B.state==="warn"?"warning":"circle-large-outline"}`,"aria-hidden":"true"})," ",B.text]},B.text))}),T?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("h4",{children:"Generated task"}),(0,c.jsx)("pre",{className:"afd-code","data-binding-preview":!0,children:SB(v,T)})]}):null]})}function F9({node:e,draft:t,setDraft:n}){let r=(0,A.useId)(),a=(Zd(e,t).outputs??{})[t.register]?.from==="impl.register",s=/^[A-Za-z_][A-Za-z0-9_]*$/.test(t.register),l=(f,p=t.register)=>{let h={...t.outputs};return f?h[p]={type:"dict",from:"impl.register"}:e.outputs?.[p]?h[p]=null:delete h[p],h};return(0,c.jsxs)("div",{className:"afd-field afd-register",children:[(0,c.jsx)("label",{htmlFor:r,children:"Register result as"}),(0,c.jsx)("input",{id:r,className:`afd-input mono${s?"":" invalid"}`,value:t.register,onChange:f=>{let p=f.target.value,h=t.outputs;a&&(h=l(!1),/^[A-Za-z_][A-Za-z0-9_]*$/.test(p)&&(h={...h,[p]:{type:"dict",from:"impl.register"}})),n({...t,register:p,outputs:h})}}),(0,c.jsxs)("label",{className:"afd-check",children:[(0,c.jsx)("input",{type:"checkbox",checked:a,disabled:!s,onChange:f=>n({...t,outputs:l(f.target.checked)})}),"Expose as node output"]})]})}function B9({field:e,bare:t,value:n,onChange:r,choices:a,onAddInput:s}){let l=(0,A.useId)(),f=e.option,p=(0,c.jsxs)("label",{htmlFor:l,children:[(0,c.jsx)("span",{className:"mono",children:e.name}),e.required?(0,c.jsx)("abbr",{title:"required",children:" *"}):null]}),h=(0,c.jsx)("span",{className:"afd-help",children:f.description.split(`
|
|
198
|
+
`)[0]}),v={choices:a,onAddInput:s,mode:t?"expr":void 0},g;switch(e.control){case"bool":g=(0,c.jsxs)("select",{id:l,value:n===!0?"true":n===!1?"false":"",onChange:m=>r(m.target.value===""?void 0:m.target.value==="true"),children:[(0,c.jsx)("option",{value:"",children:f.default===void 0?"not set":`default (${String(f.default)})`}),(0,c.jsx)("option",{value:"true",children:"true"}),(0,c.jsx)("option",{value:"false",children:"false"})]});break;case"choice":g=(0,c.jsxs)("select",{id:l,value:n===void 0?"":String(n),onChange:m=>r(m.target.value===""?void 0:(f.choices??[]).find(b=>String(b)===m.target.value)),children:[(0,c.jsx)("option",{value:"",children:f.default===void 0?"not set":`default (${String(f.default)})`}),(f.choices??[]).map(m=>(0,c.jsx)("option",{value:String(m),children:String(m)},String(m)))]});break;case"list":g=(0,c.jsx)(V9,{id:l,name:e.name,value:Array.isArray(n)?n.map(String):n===void 0?[]:[String(n)],onChange:m=>r(m.length>0?m:void 0),...v});break;case"yaml":g=(0,c.jsx)(ov,{id:l,value:n,onChange:r});break;default:g=q9(f)?(0,c.jsx)(a_,{id:l,label:e.name,value:n,placeholder:f.default===void 0?void 0:`default ${String(f.default)}`,onChange:r,...v}):(0,c.jsx)(iu,{id:l,label:e.name,value:n===void 0?"":String(n),placeholder:f.default===void 0?void 0:`default ${String(f.default)}`,onChange:m=>r(m===""?void 0:e.control==="number"&&/^-?[0-9]+(\.[0-9]+)?$/.test(m)?Number(m):m),...v})}return(0,c.jsxs)("div",{className:"afd-field","data-param":e.name,children:[p,g,h]})}var q9=e=>e.type===void 0||e.type==="raw"||e.type==="any",H9=e=>typeof e=="string"||(Array.isArray(e)||typeof e=="object"&&!!e)&&kE(e)!==void 0;function a_({id:e,label:t,value:n,onChange:r,placeholder:a,choices:s,onAddInput:l,mode:f}){let[p,h]=(0,A.useState)(),v=p!==void 0&&ZB(p===""?void 0:xE(p),n)?p:kE(n)??"";return(0,c.jsx)(iu,{id:e,label:t,value:v,placeholder:a,onChange:g=>{h(g),r(g===""?void 0:xE(g))},choices:s,onAddInput:l,mode:f})}function V9({id:e,name:t,value:n,onChange:r,choices:a,onAddInput:s,mode:l}){let[f,p]=(0,A.useState)(n.length>0?n:[""]),h=n.join("\0");(0,A.useEffect)(()=>{p(g=>g.filter(m=>m!=="").join("\0")===h?g:h?h.split("\0"):[""])},[h]);let v=g=>{p(g.length>0?g:[""]),r(g.filter(m=>m!==""))};return(0,c.jsxs)("div",{className:"afd-list",id:e,children:[f.map((g,m)=>(0,c.jsxs)("div",{className:"afd-list-row",children:[(0,c.jsx)(iu,{id:`${e}-${m}`,label:`${t} ${m+1}`,value:g,onChange:b=>v(f.map((w,k)=>k===m?b:w)),choices:a,onAddInput:s,mode:l}),f.length>1?(0,c.jsx)("button",{type:"button",className:"icon","aria-label":`Remove ${t} ${m+1}`,onClick:()=>v(f.filter((b,w)=>w!==m)),children:(0,c.jsx)("span",{className:"codicon codicon-close","aria-hidden":"true"})}):null]},m)),(0,c.jsx)("button",{type:"button",className:"link",onClick:()=>p([...f,""]),children:"Add Line"})]})}function K9({names:e,params:t,onChange:n,label:r,choices:a,onAddInput:s}){let[l,f]=(0,A.useState)(""),p=/^[A-Za-z_][A-Za-z0-9_]*$/.test(l)&&!(l in t);return(0,c.jsxs)("fieldset",{className:"afd-fieldset afd-freevars",children:[(0,c.jsx)("legend",{children:r}),e.map(h=>(0,c.jsxs)("div",{className:"afd-list-row","data-param":h,children:[(0,c.jsx)("span",{className:"mono afd-freevar-name",children:h}),H9(t[h])?(0,c.jsx)(a_,{id:`afd-var-${h}`,label:h,value:t[h],onChange:v=>n(h,v===void 0?"":v),choices:a,onAddInput:s}):(0,c.jsx)(ov,{id:`afd-var-${h}`,value:t[h],rows:1,onChange:v=>n(h,v===void 0?"":v)}),(0,c.jsx)("button",{type:"button",className:"icon","aria-label":`Remove ${h}`,onClick:()=>n(h,void 0),children:(0,c.jsx)("span",{className:"codicon codicon-close","aria-hidden":"true"})})]},h)),(0,c.jsxs)("div",{className:"afd-list-row",children:[(0,c.jsx)("input",{className:"afd-input mono","aria-label":"New variable name",placeholder:"variable_name",value:l,onChange:h=>f(h.target.value)}),(0,c.jsx)("button",{type:"button",className:"secondary",disabled:!p,onClick:()=>{n(l,""),f("")},children:"Add"})]})]})}var W9=["Targeting","Privilege","Timing","Tags"],U9=[{key:"timeout",group:"Timing",label:"Timeout",kind:"text",help:"Limit for one try: 30s, 15m, 1h30m (hosts that run over take the timeout port)"},{key:"retries",group:"Timing",label:"Retries",kind:"int",help:"Tries again up to this many times after the first try: until Until holds, or until the step succeeds"},{key:"until",group:"Timing",label:"Until",kind:"text",help:"Try again until this test holds (Jinja, no braces)"},{key:"delay",group:"Timing",label:"Delay",kind:"seconds",help:"Wait between tries: 10s, 1m, or a number of seconds (Ansible default 5s)"},{key:"serial",group:"Targeting",label:"Serial",kind:"text",help:"Hosts per batch: a number or a percentage"},{key:"rolling",group:"Targeting",label:"Rolling batch",kind:"text",help:"Hosts per batch through every step inside, one batch after another: a number or a percentage",types:["subflow"]},{key:"max_fail_percentage",group:"Targeting",label:"Max fail percentage",kind:"int",help:"Stop the flow when more hosts fail"},{key:"become",group:"Privilege",label:"Become",kind:"bool",help:"Run with privilege escalation; on a subflow, the steps inside too (format 2)"},{key:"become_user",group:"Privilege",label:"Become user",kind:"text",help:"Whom to become (default root); on a subflow, the steps inside too",format:2},{key:"tags",group:"Tags",label:"Tags",kind:"list",help:"Extra play tags, comma separated"},{key:"credential",formatMax:1,group:"Privilege",label:"Credential (AWX)",kind:"text",help:"AWX credential name; local runs use the environment"},{key:"inventory_target",group:"Targeting",label:"Inventory target",kind:"text",help:"Run the work on these hosts (an inventory pattern) instead of the arriving ones; steps inside a subflow inherit it"}],Y9=["serial","become","become_user","tags","credential"],X9=["rolling","become","become_user","inventory_target","credential"];function s_(e,t){return e.types&&!e.types.includes(t.type)?!1:t.type==="subflow"&&(t.subflow?.nodes?.length??0)>0?X9.includes(e.key):t.type==="approval"&&e.key==="timeout"||!["decision","approval","parallel","join"].includes(t.type)||Y9.includes(e.key)}function l_(e){return/^0+\s*s?$/i.test(e.trim())?0:ga(e)}var iv=["retries","delay","timeout"];function Ah(e,t,n=!0){let r=t.trim(),a=n&&iv.includes(e.key);if(a&&Yf(r))return;let s=a?", or an input with @":"";if(e.kind==="int"&&r&&!/^[0-9]+$/.test(r))return`A whole number${s}`;if(e.kind==="seconds"&&r&&l_(r)===void 0)return`A duration: 10s, 1m, 1m30s, a number of seconds${s}`;if(e.key==="timeout"&&r&&ga(r)===void 0)return`A duration: 30s, 15m, 1h30m${s}`;if(e.key==="rolling"&&r&&!/^[1-9][0-9]*%?$/.test(r))return"A number of hosts, or a percentage like 25%"}function av(e,t){let n=t.trim();return n?iv.includes(e.key)&&Yf(n)?n:e.kind==="int"?Number(n):e.kind==="seconds"?l_(n)??null:e.kind==="list"?n.split(",").map(r=>r.trim()).filter(Boolean):/^[0-9]+$/.test(n)&&(e.key==="serial"||e.key==="rolling")?Number(n):n:null}function sv(e,t){return t?.kind==="seconds"&&typeof e=="number"?K4(e):Array.isArray(e)?e.join(", "):e===void 0?"":String(e)}function lv(e,t,n){if(e===void 0||e==="")return;if(typeof e=="number")return{n:e};if(!Yf(e))return{n:t(e)};let r=I0(e);return r?{ref:r,n:n?.(r)}:{expr:e.trim().slice(2,-2).trim()}}function d_(e,t=""){let n=e.ref&&e.n!==void 0?` (${B0(e.n)} by default)`:"";return e.ref?`${e.ref} s${t}${n}`:e.expr?`${e.expr} s${t}`:`${B0(e.n??0)}${t}`}function Z9(e,t,n){let r=e.until?.trim(),a=typeof e.timeout=="string"?e.timeout.trim():e.timeout;if(!r&&!e.retries&&e.delay===void 0&&!a)return;let s=[],l=lv(e.retries,()=>{},n),f=lv(e.delay,()=>{},n)??{n:5},p=lv(a,ga,n),h=r?`until ${r}`:`until it succeeds (${t} is succeeded)`,v=!!r||!!e.retries,g;if(v){let m=l??{n:3};g=m.n===void 0?void 0:1+Math.max(0,m.n);let b=d_(f," apart");m.expr?s.push(`Tries up to 1 + ${m.expr} times, worked out at run time, ${b}, ${h}`):m.ref?s.push(`Tries up to ${m.ref} + 1 times (${g===void 0?`${m.ref} is given at run time`:`${g} with its default ${m.n}`}), ${b}, ${h}`):g===1?s.push(`Tries once (Retries 0), and fails unless ${r}`):s.push(`Tries up to ${g} times (once, then ${m.n} ${m.n===1?"retry":"retries"}${l===void 0?", Ansible's default":""}), ${b}, ${h}`)}else s.push("Runs once"),e.delay!==void 0&&s.push("Delay applies only with Retries or Until");if(p){let m=v&&g!==1?", and a try that runs over ends the step":"";p.ref||p.expr?s.push(`each try at most ${d_(p)}${m}`):p.n===void 0?s.push(`"${a}" is not a duration, so no try has a limit`):s.push(`each try at most ${a}${m}`)}if(v&&g!==void 0&&g>1&&p?.n!==void 0&&f.n!==void 0){let m=g*p.n+(g-1)*f.n,b=[l,f,p].some(w=>w?.ref);s.push(`the step takes at most ${B0(m)} in all${b?" with the defaults":""}`)}return`${s.join("; ")}.`}var G9=["integer","string","any"];function Q9(e,t){let n=r=>typeof r=="number"&&Number.isInteger(r)?r:typeof r=="string"&&/^[0-9]+$/.test(r.trim())?Number(r):void 0;return r=>{let a=t.inputs?.[r];if(a?.default!==void 0)return n(a.default);let s=a?.from;return s?.startsWith("flow.")?n(e.inputs?.[s.slice(5)]?.default):void 0}}function J9(e,t){return e.filter(n=>{if(n.fields||n.expose)return!1;let r=n.field?.type??t.inputs?.[n.name]?.type;return r===void 0||G9.includes(r)})}function e7(e,t){let n=I0(e),r=n?t.inputs?.[n]?.from:void 0;return n&&r?.startsWith("flow.")?{input:n,flow:r.slice(5)}:void 0}function u_(e,t){let[n,r]=(0,A.useState)(e),a=(0,A.useRef)(n),s=(0,A.useRef)({});(0,A.useEffect)(()=>{a.current=e,s.current={},r(e)},[e]);let l=p=>{a.current=p,r(p)},f=()=>{s.current={},l(e)};return{draft:n,change:l,revert:f,commit:()=>{let p=a.current;if(p===e&&Object.keys(s.current).length===0)return;if(t.invalid?.(p)){f();return}let h=new Set(iC(p)),v=Object.fromEntries(Object.entries(s.current).filter(([g])=>h.has(g)));s.current={},t.onCommit(p,v)},addInput:p=>{p.field&&(s.current={...s.current,[p.name]:p.field})}}}function c_({label:e,value:t,choices:n,placeholder:r,problem:a,validate:s,onCommit:l}){let f=(0,A.useId)(),p=u_(t,{invalid:s,onCommit:l}),h=p.draft===t?a:s?.(p.draft);return(0,c.jsxs)("div",{className:"afd-field","data-expr-field":!0,children:[(0,c.jsx)("label",{htmlFor:f,children:e}),(0,c.jsx)(iu,{id:f,label:e,mode:"expr",value:p.draft,onChange:p.change,choices:n,onAddInput:p.addInput,onEnter:p.commit,onEscape:p.revert,onLeave:p.commit,placeholder:r}),h?(0,c.jsx)("div",{className:"afd-field-error",children:h}):null]})}function t7({node:e,flow:t,field:n,label:r,choices:a,problem:s,onCommit:l}){let f=(0,A.useId)(),p=e.settings?.[n.key],h=sv(p,n),[v,g]=(0,A.useState)(!1),{draft:m,change:b,revert:w,commit:k,addInput:S}=u_(h,{invalid:j=>Ah(n,j),onCommit:(j,E)=>l(av(n,j),E)}),N=m===h?s:Ah(n,m),$=e7(p,e);return(0,c.jsxs)("div",{className:"afd-field afd-timing-field","data-timing-field":n.key,children:[(0,c.jsx)("label",{htmlFor:f,children:r}),(0,c.jsx)(iu,{id:f,label:r,value:m,onChange:b,choices:a,onAddInput:S,onEnter:k,onEscape:w,onLeave:k}),N?(0,c.jsx)("div",{className:"afd-field-error",id:`${f}-error`,children:N}):null,$?(0,c.jsxs)("p",{className:"muted afd-timing-asked","data-timing-asked":n.key,children:["Asked at run time: the flow input ",$.flow,n7(t?.inputs?.[$.flow]?.default,n.key),"."]}):v?(0,c.jsx)(i7,{node:e,field:n,value:p,onDone:()=>g(!1)}):(0,c.jsx)("button",{type:"button",className:"link afd-timing-ask","data-timing-ask":n.key,onClick:()=>g(!0),children:"Ask at Run Time\u2026"})]})}function n7(e,t){return e===void 0?", no default: whoever runs the flow gives it":`, default ${String(e)}${t==="retries"?"":" s"}`}var o7={retries:e=>`How many more times ${e} tries`,delay:e=>`Seconds between the tries of ${e}`,timeout:e=>`Seconds one try of ${e} may take`};function r7(e,t){if(typeof t=="number")return String(t);if(e==="timeout"&&typeof t=="string"){let n=ga(t);if(n!==void 0)return String(n)}return e==="retries"?"3":e==="delay"?"5":""}function i7({node:e,field:t,value:n,onDone:r}){let a=(0,A.useId)(),[s,l]=(0,A.useState)(`${e.key.replaceAll("-","_")}_${t.key}`),[f,p]=(0,A.useState)(o7[t.key](e.title)),[h,v]=(0,A.useState)(r7(t.key,n)),g=/^[A-Za-z_][A-Za-z0-9_]*$/.test(s)?void 0:"A variable name: letters, digits and _",m=/^[0-9]*$/.test(h.trim())?void 0:"A whole number, or empty";return(0,c.jsxs)("fieldset",{className:"afd-timing-askform","data-timing-askform":t.key,children:[(0,c.jsxs)("legend",{children:["Ask for ",t.label," at run time"]}),(0,c.jsxs)("p",{className:"muted",children:["A flow input, asked for when the flow runs (the launch dialog, an AWX survey), feeds this step's ",t.label,t.key==="retries"?"":" in seconds","."]}),(0,c.jsxs)("div",{className:"afd-field",children:[(0,c.jsx)("label",{htmlFor:`${a}-name`,children:"Input name"}),(0,c.jsx)("input",{id:`${a}-name`,className:`afd-input mono${g?" invalid":""}`,value:s,onChange:b=>l(b.target.value)}),g?(0,c.jsx)("div",{className:"afd-field-error",children:g}):null]}),(0,c.jsxs)("div",{className:"afd-field",children:[(0,c.jsx)("label",{htmlFor:`${a}-description`,children:"What it is for"}),(0,c.jsx)("input",{id:`${a}-description`,className:"afd-input",value:f,onChange:b=>p(b.target.value)})]}),(0,c.jsxs)("div",{className:"afd-field",children:[(0,c.jsxs)("label",{htmlFor:`${a}-default`,children:["Default",t.key==="retries"?"":" (seconds)","; empty: required"]}),(0,c.jsx)("input",{id:`${a}-default`,className:`afd-input mono${m?" invalid":""}`,inputMode:"numeric",value:h,onChange:b=>v(b.target.value)}),m?(0,c.jsx)("div",{className:"afd-field-error",children:m}):null]}),(0,c.jsxs)("div",{className:"afd-timing-askform-buttons",children:[(0,c.jsx)("button",{type:"button",disabled:!!g||!!m,onClick:()=>{g||m||(Pe({kind:"askAtRunTime",id:e.id,setting:t.key,name:s,...f.trim()?{description:f.trim()}:{},...h.trim()?{default:Number(h.trim())}:{}}),r())},children:"Ask at Run Time"}),(0,c.jsx)("button",{type:"button",className:"secondary",onClick:r,children:"Cancel"})]})]})}var a7=["","rollback","notify","retry","exclude"],f_=e=>{if(e==null)return"(none)";let t=typeof e=="string"?e:JSON.stringify(e);return t.length>140?`${t.slice(0,139)}\u2026`:t};function s7({id:e}){let t=_(n=>n.outside?.changes?.find(r=>r.id===e));return!t||t.kind==="removed"?null:(0,c.jsxs)("p",{className:"afd-outside-step","data-outside-change":t.kind,children:[(0,c.jsx)("span",{className:"afd-swatch outside","aria-hidden":"true"})," Changed outside the designer:"," ",ty(t)]})}function l7({id:e}){let t=_(s=>s.lens==="changes"),n=_(s=>s.lensFacts.compare),r=_(s=>s.snapshot?.doc),a=(0,A.useMemo)(()=>t&&n?.state==="ready"&&n.base&&r?OC(n.base,r).nodes.find(s=>s.id===e):void 0,[t,n,r,e]);return!a||!n?null:(0,c.jsxs)("section",{className:"afd-section afd-node-changes","data-node-changes":a.kind,children:[(0,c.jsxs)("h3",{children:["Since ",n.label]}),a.kind==="added"?(0,c.jsx)("p",{className:"muted",children:"Added"}):(0,c.jsx)("dl",{children:a.fields.map(s=>(0,c.jsxs)("div",{children:[(0,c.jsx)("dt",{children:X0(s)}),(0,c.jsxs)("dd",{className:"mono",children:[f_(s.before)," \u2192 ",f_(s.after)]})]},s.field))})]})}function d7({node:e,context:t,problems:n=[]}){let r=s=>{au(e.id,s)},a=e.type!=="start"&&e.type!=="end";return(0,c.jsxs)("div",{className:"afd-details-page",children:[(0,c.jsx)(l7,{id:e.id}),(0,c.jsx)(s7,{id:e.id}),t?(0,c.jsx)("p",{className:"muted","data-level-context":e.id,children:"You are inside this subflow. Select a step to edit it; the subflow itself is described here."}):null,(0,c.jsx)(fn,{label:"Title",focusKey:"title",value:e.title,problem:tl(n,"title"),onCommit:s=>r({title:s}),validate:s=>s.trim()?void 0:"Required"}),(0,c.jsx)(fn,{label:"Key",value:e.key,mono:!0,problem:tl(n,"key"),onCommit:s=>r({key:s}),validate:s=>G0.test(s)?void 0:"Lowercase words joined by dashes"}),a?(0,c.jsx)(fn,{label:"Intent",value:e.intent??"",multiline:!0,onCommit:s=>r({intent:s.trim()?s:null})}):null,a?(0,c.jsx)(h7,{node:e,onSet:s=>s==="tested"?_.getState().setTestedReason(e.id):r({status:s})}):null,(0,c.jsx)(m7,{node:e,patch:r}),e.type==="subflow"&&!t?(0,c.jsxs)("section",{className:"afd-section",children:[(0,c.jsx)("h3",{children:"Inner steps"}),(0,c.jsx)("p",{className:"muted",children:e.subflow?.nodes?.length?`${e.subflow.nodes.length} step(s) inside.`:"No inner steps yet: open it and add the first one."}),(0,c.jsxs)("button",{type:"button",onClick:()=>_.getState().setLevel(e.id),children:[(0,c.jsx)("span",{className:"codicon codicon-arrow-right","aria-hidden":"true"})," Open Subflow"]})]}):null,(0,c.jsx)(jr,{id:"node-details",summary:"More details: the ID",children:(0,c.jsx)(il,{label:"ID (fixed)",value:e.id,mono:!0})}),(0,c.jsx)(c7,{id:e.id})]})}function u7({node:e}){return(0,c.jsxs)("div",{className:"afd-details-page",children:[(0,c.jsx)(Ry,{title:"Inputs",target:e.id,side:"inputs",contract:e.inputs,withFrom:!0}),(0,c.jsx)(Ry,{title:"Outputs",target:e.id,side:"outputs",contract:e.outputs,withFrom:!0})]})}function c7({id:e}){let t=_(a=>a.run),n=t?.summary?.nodes[e],r=t?.summary?.failures.filter(a=>a.node===e)??[];return t?.state!=="done"||!n&&r.length===0?null:(0,c.jsxs)("section",{className:"afd-section","data-last-run":e,children:[(0,c.jsxs)("h3",{children:["Last ",t.mode==="check"?"skeleton run":"run"]}),(0,c.jsxs)("ul",{className:"afd-run-ports",children:[Object.entries(n??{}).map(([a,s])=>(0,c.jsxs)("li",{title:s.join(", "),children:[(0,c.jsx)("span",{className:"mono",children:a})," ",(0,c.jsx)("span",{className:"afd-chip",children:s.length})," ",(0,c.jsxs)("span",{className:"muted",children:[s.slice(0,4).join(", "),s.length>4?", \u2026":""]})]},a)),r.map(a=>(0,c.jsxs)("li",{className:"afd-run-failure",children:[(0,c.jsx)("span",{className:"codicon codicon-error","aria-hidden":"true"})," ",a.host,":"," ",a.msg??a.task]},`${a.host}|${a.task}`))]})]})}function au(e,t){return Pe({kind:"updateNode",id:e,patch:t})}function f7(e){if(e.run)return`Tested by run ${e.run}${e.flow_version===void 0?"":` of flow version ${e.flow_version}`}${e.commit?` at ${e.commit.slice(0,10)}`:""}`;let t=[e.by,e.at].filter(Boolean).join(", ");return`Tested by hand: ${e.reason??""}${t?` (${t})`:""}`}function h7({node:e,onSet:t}){let n=_(f=>f.snapshot?.doc),r=!!n&&Rt(n)>=2,a=e.status??"draft",s=ay.indexOf(a),l=r&&n?d4(n,e):T5(e);return(0,c.jsxs)("section",{className:"afd-section","data-lifecycle":r?"derived":"manual",children:[(0,c.jsx)("h3",{children:"Lifecycle"}),(0,c.jsx)("ol",{className:`afd-stepper${r?" read":""}`,children:ay.map((f,p)=>(0,c.jsx)("li",{className:p<s?"done":p===s?"current":"",children:r?(0,c.jsx)("span",{"aria-current":p===s?"step":void 0,children:f}):(0,c.jsx)("button",{type:"button",onClick:()=>t(f),"aria-current":p===s?"step":void 0,title:`Set status to ${f}`,children:f})},f))}),r&&e.tested?(0,c.jsx)("p",{className:"muted","data-tested-record":!0,children:f7(e.tested)}):null,l?(0,c.jsxs)("p",{className:"muted",children:["Next: ",l]}):null,r&&n&&(a==="tested"||tC(n,e))?(0,c.jsx)("div",{className:"afd-inline-actions",children:a==="tested"?(0,c.jsx)("button",{type:"button",className:"secondary",onClick:()=>t(Dd(e)),children:"Clear Tested"}):(0,c.jsxs)("button",{type:"button",className:"secondary",onClick:()=>t("tested"),children:[(0,c.jsx)("span",{className:"codicon codicon-verified","aria-hidden":"true"})," Mark Tested\u2026"]})}):null]})}function p7({node:e,patch:t}){let n=_(a=>a.snapshot?.doc),r=(0,A.useMemo)(()=>n?Gd($e(n),e).filter(a=>!a.expose):[],[n,e]);return(0,c.jsx)(c_,{label:"Condition (evaluated per host)",value:e.condition??"",choices:r,placeholder:"facts.version is version('17.9', '<')",onCommit:(a,s)=>t({condition:a.trim()?a:null,...Object.keys(s).length?{inputs:s}:{}})})}function h_(e,t){return{name:e,label:e,detail:"this step's result",fields:L$(t)}}function m7({node:e,patch:t}){switch(e.type){case"decision":return(0,c.jsx)(p7,{node:e,patch:t});case"end":return(0,c.jsxs)("div",{className:"afd-field",children:[(0,c.jsx)("label",{htmlFor:"afd-outcome",children:"Outcome"}),(0,c.jsxs)("select",{id:"afd-outcome",value:e.outcome??"success",onChange:n=>t({outcome:n.target.value}),children:[(0,c.jsx)("option",{value:"success",children:"success"}),(0,c.jsx)("option",{value:"failed",children:"failed"})]})]});case"join":return(0,c.jsxs)("div",{className:"afd-field",children:[(0,c.jsx)("label",{htmlFor:"afd-join",children:"Join mode (per host)"}),(0,c.jsxs)("select",{id:"afd-join",value:e.join_mode??"all",onChange:n=>t({join_mode:n.target.value}),children:[(0,c.jsx)("option",{value:"all",children:"all: every branch delivered the host"}),(0,c.jsx)("option",{value:"any",children:"any: at least one branch"})]})]});case"parallel":return(0,c.jsx)(fn,{label:"Branches",value:String(e.branches??2),onCommit:n=>t({branches:Number(n)}),validate:n=>/^[0-9]+$/.test(n)&&Number(n)>=2?void 0:"At least 2"});case"approval":return(0,c.jsx)(g7,{node:e,patch:t});case"task":case"subflow":return(0,c.jsxs)("div",{className:"afd-field",children:[(0,c.jsx)("label",{htmlFor:"afd-purpose",children:"Purpose in failure handling"}),(0,c.jsx)("select",{id:"afd-purpose",value:Od(e)??"",onChange:n=>t({purpose:n.target.value||null}),children:a7.map(n=>(0,c.jsx)("option",{value:n,children:n||"none"},n))})]});default:return null}}var p_=e=>e.split(/[,\n]/).map(t=>t.trim()).filter(Boolean);function g7({node:e,patch:t}){let n=e.approval??{},r=a=>t({approval:{...n,...a}});return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(fn,{label:"Approvers \xB7 users or groups who may decide (commas between); empty: whoever the runner lets approve",value:(n.approvers??[]).join(", "),placeholder:"change-board, dana",onCommit:a=>r({approvers:p_(a)})}),(0,c.jsx)(fn,{label:"Notify \xB7 users or groups told it waits, beside the approvers",value:(n.notify??[]).join(", "),placeholder:"netops-oncall",onCommit:a=>r({notify:p_(a)})}),(0,c.jsx)(fn,{label:"Message \xB7 what the approvers check before deciding",value:n.message??"",multiline:!0,placeholder:"Check the change ticket and the maintenance window",onCommit:a=>r({message:a})}),(0,c.jsx)("p",{className:"muted","data-approval-note":!0,children:"Ansible Flow Server asks these people. AWX workflows set their approvers in AWX; local runs approve by themselves."})]})}function y7({model:e,node:t,port:n,target:r,reason:a}){let s=_(v=>v.openPortMenu),l={node:t,port:n.name},f=n.state==="connected"&&n.direction==="out",p=ch[n.state];f?p=`\u2192 ${r}`:a?p=`${ch[n.state]}: ${a}`:n.state==="open-fail"&&(p="open: wire it to a handler, or Accept with Reason\u2026");let h=n.state==="open-fail"?(Id(e,l)?.items??[]).filter((v,g)=>v.kind==="pattern"&&g<2||v.kind==="decide"):[];return(0,c.jsxs)("li",{className:`state-${n.state}`,"data-port-row":n.name,children:[(0,c.jsx)("span",{className:`afd-swatch port state-${n.state} tone-${n.tone}`,"aria-hidden":"true"}),(0,c.jsx)("span",{className:"mono",title:ka(n.name,e.nodes.get(t)?.node.type),children:n.name}),(0,c.jsx)("span",{className:"muted",children:p}),(0,c.jsx)("button",{type:"button",className:"icon","aria-label":`Options for port ${n.name}`,title:"Options",onClick:v=>{let g=v.currentTarget.getBoundingClientRect();s({ref:l,x:g.left-230,y:g.bottom+4})},children:(0,c.jsx)("span",{className:"codicon codicon-ellipsis","aria-hidden":"true"})}),h.length>0?(0,c.jsx)("span",{className:"afd-port-quick",children:h.map(v=>(0,c.jsx)("button",{type:"button",className:"link",onClick:()=>{ol(v,l)},children:v.label},v.label))}):null]})}function v7({id:e}){let t=_(f=>f.snapshot);if(!t?.doc)return null;let n=$e(t.doc),r=n.nodes.get(e);if(!r)return null;let a=cn(t,{},r.level).nodes.find(f=>f.node.id===e),s=n.levels.get(r.level)?.edges??[],l=t.doc.decisions??[];return(0,c.jsx)("div",{className:"afd-details-page",children:(0,c.jsx)("ul",{className:"afd-ports",children:a?.ports.map(f=>(0,c.jsx)(y7,{model:n,node:e,port:f,target:n.nodes.get(s.find(p=>p?.from?.node===e&&p.from.port===f.name)?.to.node??"")?.node.title??"",reason:l.find(p=>p?.node===e&&p.port===f.name)?.reason},f.name))})})}var b7=e=>e.charAt(0).toLowerCase()+e.slice(1);function x7(e,t,n){return`${e}${t.length===1&&t[0]?.toLowerCase()===e.toLowerCase()?"":`: ${t.join(", ")}`}${n?` \xB7 ${n} set`:""}`}function w7({node:e,problems:t=[]}){let n=(j,E)=>{au(e.id,{settings:{[j]:E}})},r=e.settings??{},a=_(j=>j.snapshot?.doc?Rt(j.snapshot.doc):1),s=e.type==="task"||e.type==="subflow"&&!e.subflow?.nodes?.length,l=j=>U9.filter(E=>E.group===j&&(E.format??1)<=a&&a<=(E.formatMax??a)&&(s_(E,e)||r[E.key]!==void 0)),f=W9.filter(j=>l(j).length>0),p=j=>l(j).filter(E=>r[E.key]!==void 0).length,h=e.impl?.kind==="module"&&e.impl.ref?e.impl.ref:void 0,v=xi(h?{op:"doc",fqcn:h}:null,`doc:module:${h}`),g=Ys(e),m=Object.keys(v.data?.returns??{}),b=m.includes("stdout")?`'ready' in ${g}.stdout`:m.includes("rc")?`${g}.rc == 0`:`${g} is succeeded`,w=_(j=>j.snapshot?.doc),k=Z9(r,g,w?Q9(w.flow,e):void 0),S=(0,A.useMemo)(()=>w?J9(Gd($e(w),e),e):[],[w,e]),N=(0,A.useMemo)(()=>[...w?Gd($e(w),e).filter(j=>!j.expose):[],h_(g,v.data?.returns)],[w,e,g,v.data]),$=(0,A.useMemo)(()=>!!w&&_C($e(w),e)&&!Ws(w).some(j=>j.area==="lens"&&j.what===`access:become:${e.id}`),[w,e]);return(0,c.jsxs)("div",{className:"afd-details-page",children:[f.map(j=>(0,c.jsx)("section",{className:"afd-section","data-setting-group":j,children:(0,c.jsxs)(jr,{id:`execution-${j}`,open:f.length===1||p(j)>0||l(j).some(E=>tl(t,`settings.${E.key}`)),defaultOpen:j==="Timing"&&!!h,summary:x7(j,l(j).map(E=>b7(E.label)),p(j)),children:[l(j).map(E=>{let I=r[E.key],z=s_(E,e)?void 0:(0,c.jsxs)("p",{className:"muted","data-setting-unused":E.key,children:["Not used on a ",yo[e.type].toLowerCase()," node: clear it."]});if(E.kind==="bool")return(0,c.jsxs)("div",{children:[(0,c.jsxs)("label",{className:"afd-check",children:[(0,c.jsx)("input",{type:"checkbox",checked:I===!0,onChange:M=>n(E.key,M.target.checked?!0:null)}),E.label," ",(0,c.jsx)("span",{className:"muted",children:E.help})]}),z]},E.key);let T=E.key==="until";return iv.includes(E.key)&&e.type!=="approval"&&!z?(0,c.jsxs)("div",{children:[(0,c.jsx)(t7,{node:e,flow:w?.flow,field:E,label:`${E.label} \xB7 ${E.help}`,choices:S,problem:tl(t,`settings.${E.key}`),onCommit:(M,O)=>{au(e.id,{settings:{[E.key]:M},...Object.keys(O).length?{inputs:O}:{}})}}),z]},E.key):T?(0,c.jsxs)("div",{children:[(0,c.jsx)(c_,{label:`${E.label} \xB7 ${E.help}; it reads ${g} (the result) and the inputs`,value:sv(I,E),choices:N,placeholder:b,problem:tl(t,`settings.${E.key}`),validate:M=>Ah(E,M,e.type!=="approval"),onCommit:(M,O)=>{au(e.id,{settings:{[E.key]:av(E,M)},...Object.keys(O).length?{inputs:O}:{}})}}),z]},E.key):(0,c.jsxs)("div",{children:[(0,c.jsx)(fn,{label:`${E.label} \xB7 ${E.key==="timeout"&&e.type==="approval"?"How long the approval waits (in AWX or on the server) before its hosts take the timeout port (30m, 4h)":E.help}`,value:sv(I,E),mono:!0,problem:tl(t,`settings.${E.key}`),validate:M=>Ah(E,M,e.type!=="approval"),onCommit:M=>n(E.key,av(E,M))}),z]},E.key)}),j==="Privilege"&&$?(0,c.jsxs)("p",{className:"muted","data-become-flagged":!0,children:["The Access lens flags this step's Become: none of the steps wired to it run as root. If it needs root, accept the finding with a reason, so others know why."," ",(0,c.jsx)("button",{type:"button",className:"link",onClick:()=>_.getState().setAccept({id:`access:become:${e.id}`,node:e.id,title:`${e.title} escalates privileges, unlike its neighbours`}),children:"Accept with Reason\u2026"})]}):null,j==="Timing"&&k?(0,c.jsx)("p",{className:"muted afd-timing-text","data-timing-text":!0,children:k}):null]})},j)),s?(0,c.jsx)(S7,{node:e}):null]})}var k7=[{key:"when",line:"when: ",help:"Run only on hosts where this test holds (no braces)"},{key:"loop",line:`loop:
|
|
199
|
+
- `,help:"Run once for each item of a list: parameters read the item as {{ item }}"},{key:"no_log",line:"no_log: true",help:"Keep what the step reads and returns out of logs and run output",commit:!0},{key:"ignore_errors",line:"ignore_errors: true",help:"A failure does not stop the host: it goes on through ok_hosts",commit:!0},{key:"delegate_to",line:"delegate_to: localhost",help:"Run the task on another host (like localhost), once for each host that arrives",select:9},{key:"run_once",line:"run_once: true",help:"Run the task on one host only, for all of them",commit:!0},{key:"changed_when",line:"changed_when: false",help:"When the step counts as changed (false: never, for a step that only reads)",select:5}];function S7({node:e}){let t=(0,A.useId)(),n=(0,A.useRef)(null),r=e.impl,a=_(m=>m.snapshot?.doc),s=r?.kind==="module"&&r.ref?r.ref:void 0,l=xi(s?{op:"doc",fqcn:s}:null,`doc:module:${s}`),f=Ys(e),p=(0,A.useMemo)(()=>[...a?Gd($e(a),e).filter(m=>!m.expose):[],...s?[h_(f,l.data?.returns)]:[]],[a,e,s,f,l.data]),h=(0,A.useRef)({}),v=Object.keys(r?.keywords??{}),g=r?.ref?r.kind==="playbook"?"A playbook binding takes no task keywords (import_playbook has none).":void 0:"Bind a module or role first: task keywords go on the task the binding generates.";return(0,c.jsx)("section",{className:"afd-section","data-keywords":!0,children:(0,c.jsx)(jr,{id:"execution-keywords",open:v.length>0,summary:`Task keywords: when, loop, no_log\u2026${v.length?` \xB7 ${v.length} set`:""}`,children:g||!r?(0,c.jsxs)("div",{className:"afd-field","data-keywords-blocked":!0,children:[(0,c.jsx)("label",{htmlFor:t,children:"Task keywords"}),(0,c.jsx)("textarea",{id:t,className:"afd-input mono",rows:2,disabled:!0,"aria-describedby":`${t}-why`}),(0,c.jsx)("p",{id:`${t}-why`,className:"muted",children:g})]}):(0,c.jsxs)("div",{className:"afd-field",children:[(0,c.jsxs)("label",{htmlFor:t,children:["Task keywords \xB7 ",(0,c.jsx)("span",{className:"muted",children:"YAML written on the generated task"})]}),(0,c.jsxs)("fieldset",{className:"afd-keyword-chips",children:[(0,c.jsx)("legend",{className:"afd-sr-only",children:"Add a task keyword"}),k7.map(m=>(0,c.jsxs)("button",{type:"button",className:"chip-button mono",title:m.help,"data-keyword-chip":m.key,disabled:v.includes(m.key),onClick:()=>n.current?.add(m.line,{commit:m.commit,select:m.select}),children:["+ ",m.key]},m.key))]}),(0,c.jsx)(ov,{ref:n,id:t,rows:4,bareKeys:v4,choices:p,onAddInput:m=>{m.field&&(h.current={...h.current,[m.name]:m.field})},value:r.keywords,placeholder:`when: version_check.stdout is version("17.9", "<")
|
|
200
|
+
loop: "{{ interfaces }}"`,validate:m=>{if(m!=null){if(typeof m!="object"||Array.isArray(m))return"A map of keyword: value";for(let b of Object.keys(m)){let w=N4(b);if(w)return w}}},onChange:m=>{let b=JSON.stringify(m??null),w=Object.fromEntries(Object.entries(h.current).filter(([k])=>RegExp(`\\b${k}\\b`).test(b)));h.current={},au(e.id,{keywords:m??null,...Object.keys(w).length?{inputs:w}:{}})}},JSON.stringify(r.keywords??null))]})})})}var m_={code:"Code",run:"Run",general:"General",binding:"Binding",io:"Inputs and outputs",ports:"Ports",execution:"Execution"};function N7(e,t){let n=e.type==="task"||e.type==="subflow",r=e.type!=="start"&&e.type!=="end",a=["general"];return n&&a.push("binding"),r&&a.push("io"),a.push("ports"),r&&a.push("execution"),t==="code"?["code",...a]:t==="run"?["run",...a]:a}var j7={code:"code",run:"runs",general:"canvas",binding:"binding",io:"io",ports:"patterns",execution:"execution"};function C7({id:e,context:t}){let n=_(L=>L.snapshot),r=_(L=>L.mode),a=_(L=>!!L.run),s=_(L=>L.detailsTab),l=_(L=>L.setDetailsTab),f=_(L=>L.expanded),p=_(L=>L.leave),h=_(L=>L.bindKind?.node===e?L.bindKind.kind:void 0),v=wa(),g=hh(),m=K5(e),b=m?.node,[w,k]=(0,A.useState)(()=>b?{...Xd(b),...h&&!b.impl?{kind:h}:{}}:void 0),[S,N]=(0,A.useState)(!1),$=n?.docVersion??0,[j,E]=(0,A.useState)(null);(0,A.useEffect)(()=>{j!==null&&$>j&&b&&(k(Xd(b)),E(null))},[j,$,b]),(0,A.useEffect)(()=>{b&&!w&&k(Xd(b))},[b,w]);let I=b?.type==="task"||b?.type==="subflow",z=!!b&&!!w&&I&&Y6(b,w);if((0,A.useEffect)(()=>{_.getState().setPendingBinding(z?e:null)},[z,e]),(0,A.useEffect)(()=>()=>{_.getState().pendingBinding===e&&_.getState().setPendingBinding(null)},[e]),!n?.doc||!g||!m||!b||!w)return null;let T=N7(b,r),M=T.includes(s)?s:T[0],O=n.plays?.[e],K=x$(n.findings,e,m.path),B=v&&!!n.doc&&Rt(n.doc)>=2,V=new Set(K.map(L=>L.tab)),oe=!v||r==="run"||r==="code"&&M!=="binding",F=async()=>{N(!0);let L=$,U=await Pe(X6(b,w));return N(!1),U.ok&&E(L),U.ok},J=()=>k(Xd(b));return(0,c.jsxs)("div",{className:"afd-details","data-details":e,"data-inspector":e,children:[r==="run"&&a?(0,c.jsx)("div",{className:"afd-inspector-head","data-back-to-run":!0,children:(0,c.jsxs)("button",{type:"button",className:"link",onClick:()=>_.getState().select({}),children:[(0,c.jsx)("span",{className:"codicon codicon-arrow-left","aria-hidden":"true"})," Run Results"]})}):null,(0,c.jsxs)("header",{className:"afd-details-head",children:[(0,c.jsxs)("div",{className:"afd-details-name",children:[(0,c.jsx)(gh,{status:b.status??"draft"}),(0,c.jsx)("h2",{children:b.title})]}),(0,c.jsxs)("div",{className:"afd-details-bar",children:[(0,c.jsxs)("span",{className:"afd-chip",children:[yo[b.type]," \xB7 ",b.status??"draft"]}),(0,c.jsxs)("div",{className:"afd-details-actions",children:[(0,c.jsx)(Sa,{topic:j7[M],about:`the ${m_[M]} tab`}),O?(0,c.jsx)("button",{type:"button",className:"icon",title:"Peek Code: the node's play in its generated file","aria-label":"Peek Code",onClick:()=>je({type:"peekCode",node:e}),children:(0,c.jsx)("span",{className:"codicon codicon-code","aria-hidden":"true"})}):null,(0,c.jsx)("button",{type:"button",className:"icon",title:"Open in Text Editor","aria-label":"Open in Text Editor",onClick:()=>je({type:"openText",path:m.path}),children:(0,c.jsx)("span",{className:"codicon codicon-go-to-file","aria-hidden":"true"})}),(0,c.jsx)("button",{type:"button",className:"icon",title:`Copy (${Na("copy")}): paste on a flow (${Na("paste")}) or in a text file`,"aria-label":"Copy node",onClick:()=>Kd(),children:(0,c.jsx)("span",{className:"codicon codicon-copy","aria-hidden":"true"})}),r==="run"?null:(0,c.jsx)("button",{type:"button",className:"icon",title:"Delete node","aria-label":"Delete node",disabled:!v,onClick:()=>{Ud([e])},children:(0,c.jsx)("span",{className:"codicon codicon-trash","aria-hidden":"true"})}),(0,c.jsx)("button",{type:"button",className:"icon",title:f?"Narrow the panel again":"Widen the panel (for the catalog docs)","aria-label":f?"Collapse the panel":"Expand the panel","aria-pressed":f,onClick:()=>_.getState().setExpanded(!f),children:(0,c.jsx)("span",{className:`codicon codicon-${f?"screen-normal":"screen-full"}`,"aria-hidden":"true"})})]})]})]}),z?(0,c.jsxs)("div",{className:"afd-pending",role:"status","data-pending-binding":e,children:[(0,c.jsx)("span",{children:"The binding is not saved."}),(0,c.jsx)("button",{type:"button",className:"secondary",onClick:J,children:"Discard"}),(0,c.jsx)("button",{type:"button",disabled:S,onClick:()=>{F()},"data-save-binding":!0,children:"Save Binding"})]}):null,K.length>0?(0,c.jsx)("ul",{className:"afd-node-problems","aria-label":"Problems of this node","data-node-problems":e,children:K.map(L=>(0,c.jsxs)("li",{children:[(0,c.jsxs)("button",{type:"button",className:"link",onClick:()=>T.includes(L.tab)&&l(L.tab),children:[(0,c.jsx)("span",{className:`codicon codicon-${L.finding.severity==="error"?"error":"warning"}`,role:"img","aria-label":L.finding.severity})," ",L.finding.message]}),B&&L.finding.severity==="warning"&&L.finding.code!=="open-fail-port"?(0,c.jsx)("button",{type:"button",className:"link afd-accept-problem",title:"Keep it as it is, with a reason",onClick:()=>_.getState().setAccept({id:`${L.finding.code}|${L.finding.subject??""}`,node:e,title:L.finding.message,check:{code:L.finding.code,...L.finding.subject?{subject:L.finding.subject}:{}}}),children:"Accept\u2026"}):null]},`${L.finding.code}|${L.finding.path.join(".")}|${L.finding.port??""}`))}):null,(0,c.jsx)("div",{className:"afd-props-tabs",role:"tablist","aria-label":"Details",onKeyDown:B$,children:T.map(L=>(0,c.jsxs)("button",{type:"button",role:"tab",id:`afd-tab-${L}`,"aria-selected":M===L,tabIndex:M===L?0:-1,"aria-controls":"afd-details-panel",className:M===L?"active":"",onClick:()=>l(L),children:[m_[L],L==="binding"&&z?(0,c.jsx)("span",{className:"afd-dirty",title:"Not saved"}):null,V.has(L)?(0,c.jsx)("span",{className:"afd-tab-problem",title:"Has problems"}):null]},L))}),(0,c.jsxs)("div",{className:"afd-details-body",role:"tabpanel",id:"afd-details-panel","aria-labelledby":`afd-tab-${M}`,children:[(0,c.jsx)(IB,{id:e},e),M==="code"?(0,c.jsx)(yB,{id:e}):M==="run"?(0,c.jsx)(KB,{id:e}):(0,c.jsx)("fieldset",{className:"afd-editable",disabled:oe,children:M==="binding"?(0,c.jsx)(M9,{node:b,model:g,draft:w,setDraft:k}):M==="io"?(0,c.jsx)(u7,{node:b}):M==="ports"?(0,c.jsx)(v7,{id:e}):M==="execution"?(0,c.jsx)(w7,{node:b,problems:K}):(0,c.jsx)(d7,{node:b,context:t,problems:K})})]}),r==="design"&&g&&$7(g,e)>=3?(0,c.jsx)("div",{className:"afd-details-page afd-details-hint",children:(0,c.jsx)(lE,{})}):null,p&&z?(0,c.jsx)(E7,{title:b.title,saving:S,save:F,discard:J}):null]})}function $7(e,t){let n=e.nodes.get(t)?.level;return[...e.nodes.values()].filter(r=>r.level===n&&r.node.type!=="start"&&r.node.type!=="end").length}function E7(e){let t=(0,A.useRef)(null),n=nl(t);return(0,c.jsx)("div",{className:"afd-modal-backdrop",children:(0,c.jsxs)("div",{ref:t,className:"afd-modal",role:"alertdialog","aria-modal":"true","aria-labelledby":"afd-leave-title","data-leave-binding":!0,onKeyDown:n,children:[(0,c.jsx)("h2",{id:"afd-leave-title",children:"Discard the binding change?"}),(0,c.jsxs)("p",{className:"muted",children:['The binding of "',e.title,'" has a change that is not saved yet. Leaving now drops it.']}),(0,c.jsxs)("div",{className:"afd-modal-actions",children:[(0,c.jsx)("button",{type:"button",className:"secondary",autoFocus:!0,onClick:()=>_.getState().resolveLeave("stay"),children:"Keep Editing"}),(0,c.jsx)("button",{type:"button",className:"secondary","data-leave-discard":!0,onClick:()=>{e.discard(),_.getState().resolveLeave("go")},children:"Discard"}),(0,c.jsx)("button",{type:"button",disabled:e.saving,onClick:()=>{e.save().then(r=>r&&_.getState().resolveLeave("go"))},children:"Save Binding"})]})]})})}function _7(e){let t=[...document.querySelectorAll("[data-node-id]")].map(s=>{let l=[...s.querySelectorAll("[data-port]")],f=p=>l.filter(p).map(h=>h.dataset.port??"");return{id:s.dataset.nodeId??"",legal:f(()=>!0),ports:f(p=>p.dataset.portState!=="available"),rest:f(p=>p.dataset.rest==="true")}}),n=document.querySelector("[data-banner-count]"),r=document.querySelector("[data-frame]"),a=document.querySelector("[data-id-gaps]");return{docVersion:e,level:_.getState().level,nodes:t,edges:document.querySelectorAll(".react-flow__edge").length,wires:Object.fromEntries([...document.querySelectorAll(".react-flow__edge[data-id]")].map(s=>[s.dataset.id??"",s.querySelector(".react-flow__edge-path")?.getAttribute("d")??""])),annotations:document.querySelectorAll("[data-annotation-id]").length,banner:n?Number(n.dataset.bannerCount):null,idGaps:a?Number(a.dataset.idGaps):null,merge:(()=>{let s=document.querySelector("[data-merge-conflicts]");return s?Number(s.dataset.mergeConflicts):null})(),frame:r?{ports:[...r.querySelectorAll("[data-frame-port]")].filter(s=>s.dataset.portState!=="available").map(s=>s.dataset.framePort??""),wires:document.querySelectorAll(".afd-boundary-edge").length}:null,run:_.getState().mode==="run"?{nodes:Object.fromEntries([...document.querySelectorAll("[data-node-id]")].map(s=>[s.dataset.nodeId??"",s.dataset.runState??""])),wires:Object.fromEntries([...document.querySelectorAll(".react-flow__edge[data-id]")].map(s=>[s.dataset.id??"",s.querySelector(".react-flow__edge-text")?.textContent??""]))}:void 0,lens:A7()}}function A7(){let e=_.getState();if(!e.lens)return;let t=[...document.querySelectorAll("[data-node-id]")];return{lens:e.lens,chips:Object.fromEntries(t.map(n=>{let r=n.dataset.lens??"";return[n.dataset.nodeId??"",r?r.split("|"):[]]})),findings:[...document.querySelectorAll("[data-finding]")].map(n=>`${n.dataset.finding}${n.dataset.accepted?" (accepted)":""}`),dataWires:document.querySelectorAll(".afd-data-edge").length,highlighted:t.filter(n=>n.classList.contains("lens-hit")).map(n=>n.dataset.nodeId??""),card:[...document.querySelectorAll("[data-summary-card] dt")].map(n=>`${n.textContent}: ${n.nextElementSibling?.textContent??""}`)}}function g_(e){let t=_.getState();return t.snapshot?cn(t.snapshot,t.optimistic,t.level).nodes.filter(n=>e.includes(n.node.id)).map(n=>({id:n.node.id,x:Math.round(n.position.x),y:Math.round(n.position.y),...C0(n.node.type)})):[]}async function y_(e,t){let n=_.getState();if(!n.snapshot?.doc)return;if(Object.keys(e).length===0){n.notify("info",t);return}let r={...xa(cn(n.snapshot,n.optimistic,n.level),n.snapshot.doc.layout),...e};n.setOptimistic(r);let a=await Pe({kind:"moveNodes",positions:r});a.ok||(_.getState().dropOptimistic(r),n.setError(a.error??"The steps could not be moved"))}function dv(e,t=_.getState().selection.nodes??[]){if(!(!Yt()||t.length<2))return y_($z(g_(t),e),"The steps are lined up already")}function uv(e,t=_.getState().selection.nodes??[]){if(!(!Yt()||t.length<3))return y_(Ez(g_(t),e),"The gaps are even already")}async function v_(e){let t=_.getState(),n=e.filter(a=>t.snapshot?.doc?.layout?.[a]);if(!Yt()||n.length===0)return;let r=await Pe({kind:"unplaceNodes",ids:n});r.ok||t.setError(r.error??"The positions could not be reset")}var T7='input, textarea, select, [contenteditable="true"]';function M7(){let e=_.getState(),t=y5.find(n=>WC(e,n));if(t)_.setState({[t]:KC[t]});else if(e.leave)e.resolveLeave("stay");else if(e.preview)e.setPreview(null);else if(e.selection.node||e.selection.nodes||e.selection.edge||e.selection.annotations?.length)e.select({});else return!1;return!0}function O7(){let e=_.getState(),{selection:t}=e,n=s=>document.querySelector(s)?.getBoundingClientRect(),r=n(".react-flow");if(!r)return;let a={x:r.left+r.width/2,y:r.top+r.height/3};if(t.nodes?.length){let s=n(`.react-flow__node[data-id="${t.nodes[0]}"]`);e.openContextMenu({target:{kind:"nodes",ids:t.nodes},x:s?s.left+12:a.x,y:s?s.bottom:a.y})}else if(t.node){let s=n(`.react-flow__node[data-id="${t.node}"]`);e.openContextMenu({target:{kind:"node",id:t.node},x:s?s.left+12:a.x,y:s?s.bottom:a.y})}else if(t.annotations?.length){let[s]=t.annotations,l=n(`.react-flow__node[data-id="${s}"]`);e.openContextMenu({target:t.annotations.length>1?{kind:"annotations",ids:t.annotations}:{kind:"annotation",id:s},x:l?l.left+12:a.x,y:l?l.bottom:a.y})}else e.openContextMenu({target:{kind:"pane"},x:a.x,y:a.y})}var b_={Digit1:"design",Digit2:"code",Digit3:"run"};function P7(){let e=n=>{if(n.defaultPrevented)return;let r=n.target,a=()=>{n.preventDefault(),n.stopPropagation()};if((vo?n.metaKey:n.ctrlKey)&&!n.altKey&&!n.shiftKey&&n.key.toLowerCase()==="f"){a(),_.getState().openFind(!0);return}if(r?.closest?.(T7))return;if(n.key==="Escape"){M7()&&a();return}if(r?.closest?.(".nokey"))return;let s=_.getState(),l=vo?n.metaKey:n.ctrlKey;if((n.key==="Delete"||n.key==="Backspace")&&!l&&!n.altKey){if(n.repeat)return a();let f=Wd(),p=fy(),h=s.selection.edge;Yt()&&(f.length>0||p.length>0||h)&&(a(),Ud(f,h?[h]:[],p,!n.shiftKey))}else if(n.key==="F2"&&!l&&!n.altKey){let f=Wd(),p=fy();f.length===1&&f[0]&&s.mode==="design"?(a(),py(f[0])):f.length===0&&p.length===1&&p[0]&&Yt()&&(a(),uh(p[0]))}else if(l&&!n.altKey&&!n.shiftKey&&n.key.toLowerCase()==="d"){if(n.repeat)return a();let f=Wd(),p=fy();f.length+p.length>0&&(a(),o$(f,p))}else if(l&&!n.altKey&&!n.shiftKey&&n.key.startsWith("Arrow"))a$(n.key==="ArrowUp"||n.key==="ArrowLeft"?"up":"down")&&a();else if(n.altKey&&!l&&n.key==="ArrowUp")a(),hy();else if(n.key==="?"&&!l&&!n.altKey)a(),s.showCheatSheet(!0);else if(l&&!n.altKey&&!n.shiftKey&&n.key.toLowerCase()==="a"){if(r&&r!==document.body&&!r.closest?.(".react-flow"))return;a(),r$()}else if(n.key.toLowerCase()==="d"&&!l&&!n.altKey&&!n.shiftKey){let f=Wd();if(!Yt()||f.length===0)return;if(n.repeat)return a();a(),I5(f)}else if(n.key.toLowerCase()==="n"&&!l&&!n.altKey&&n.shiftKey){if(!Yt())return;a();let f=s.selection.node;Yd("note",f?void 0:dy(),f)}else if(n.key.toLowerCase()==="n"&&!l&&!n.altKey&&!n.shiftKey){if(!Yt())return;a(),_y()}else if(n.altKey&&n.shiftKey&&!l&&(n.code==="KeyA"||n.code==="KeyD")){let f=Wd();if(!Yt()||f.length<(n.code==="KeyA"?2:3))return;a(),n.code==="KeyA"?dv("center",f):uv("vertical",f)}else n.altKey&&!l&&!n.shiftKey&&b_[n.code]&&(a(),XC(b_[n.code]))},t=n=>{n.defaultPrevented||(n.target===document.body||n.target===document.documentElement)&&(n.preventDefault(),O7())};return document.addEventListener("keydown",e),document.addEventListener("contextmenu",t),()=>{document.removeEventListener("keydown",e),document.removeEventListener("contextmenu",t)}}var x_={failed:"Fail for",unreachable:"Unreachable for",timeout:"Time Out for",unchanged:"Unchanged for"};function D7(e,t,n){let r=e.nodes.get(t)?.node,a=n.path(t);if(!r||!a)return[];let s=(v,g)=>`${v}\u2026${g.length?` (${g.join(", ")})`:""}`,l=new Set(Ks(r).map(v=>v.name)),f=[],p=(v,g,m)=>{let b=n.forced(a,v);f.push(Ae(s(g,b),{do:"scenarioForce",step:a,outcome:v,title:g},{icon:m,checked:b.length>0}))},h=r.type==="subflow"&&(r.subflow?.nodes?.length??0)>0;if(r.type==="task"||r.type==="subflow"&&!h){p("failed",x_.failed,"error");for(let v of["unreachable","timeout","unchanged"])l.has(v)&&p(v,x_[v],"warning")}else if(r.type==="decision")p("false","Take False for","git-compare");else if(r.type==="approval"){let v=n.approval(a);for(let[g,m]of[["approved","Approved"],["rejected","Rejected"],["timeout","Timed Out"]])(g==="approved"||l.has(g))&&f.push(Ae(`${m} in This Scenario`,{do:"scenarioApproval",approval:a,pick:g},{checked:v===g}))}else if(r.type==="end")for(let v of n.hosts)f.push(Ae(`Expect ${v} Here`,{do:"scenarioExpect",host:v,where:a},{checked:n.expect[v]===a}));return f.length===0?[]:[{type:"submenu",label:`In "${n.name}"`,icon:"beaker",items:f}]}var su="Fix the YAML errors first";function Ae(e,t,n={}){return{type:"item",label:e,action:t,...n}}function lu(...e){let t=[];for(let n of e.filter(r=>r.length>0))t.length>0&&t.push({type:"separator"}),t.push(...n);return t}var I7={pattern:"zap",quickAdd:"add",insert:"insert",pick:"link",disconnect:"debug-disconnect",decide:"pass",reopen:"discard"};function w_(e,t,n){return(Id(e,t)?.items??[]).filter(r=>r.kind!=="later"&&(!n||n.includes(r.kind))).map(r=>Ae(r.label,{do:"port",ref:t,item:r},{icon:I7[r.kind]}))}function k_(e,t){let n=new Set(t);return(e.levels.get(e.nodes.get(t[0])?.level??"root")?.edges??[]).some(r=>r&&n.has(r.from?.node)!==n.has(r.to?.node))}function L7(e,t,n){let r=e.nodes.get(t)?.node;if(!r)return[];let a=n.mode==="design",s=n.stale?{disabled:n.why??su}:{},l=r.type==="start"||r.type==="end",f=[];r.type==="subflow"&&f.push(Ae("Open Subflow",{do:"openSubflow",node:t},{icon:"arrow-right",shortcut:"open"})),(r.type==="task"||r.type==="subflow")&&(f.push(Ae("Details\u2026",{do:"properties",node:t},{icon:"settings-gear",...r.type==="subflow"?{}:{shortcut:"open"}})),n.mode!=="run"&&f.push(Ae("Binding\u2026",{do:"properties",node:t,tab:"binding"},{icon:"plug"})));let p=e.levels.get(e.nodes.get(t)?.level??"root"),h=[];a&&(p?.edges??[]).some(N=>N?.to?.node===t)&&h.push(Ae("Select Upstream",{do:"selectFlow",node:t,dir:"up"},{icon:"arrow-up"})),a&&(p?.edges??[]).some(N=>N?.from?.node===t)&&h.push(Ae("Select Downstream",{do:"selectFlow",node:t,dir:"down"},{icon:"arrow-down"}));let v=[];if(n.mode==="design"&&v.push(Ae("Rename",{do:"rename",node:t},{icon:"edit",shortcut:"rename",...s})),a&&!l&&Rt(e.doc)>=2?r.status==="tested"?v.push(Ae("Clear Tested",{do:"setStatus",node:t,status:Dd(r)},{icon:"circle-large-outline",...s})):tC(e.doc,r)&&v.push(Ae("Mark Tested\u2026",{do:"setStatus",node:t,status:"tested"},{icon:"verified",...s})):a&&!l&&v.push({type:"submenu",label:"Status",icon:"circle-large-outline",items:Gj.map(N=>Ae(N,{do:"setStatus",node:t,status:N},{checked:r.status===N,...s}))}),a&&!n.stale)for(let N of n.openPorts.filter($=>$.node===t))v.push({type:"submenu",label:`Open Port ${N.port}`,icon:"warning",items:w_(e,{node:t,port:N.port})});let g=a?Gf(e,t):void 0;if(g&&v.push(Ae("Add Next Node\u2026",{do:"addNext",from:{node:t,port:g.port},insertOn:g.insertOn},{icon:"add",shortcut:"addNode",...s})),a&&cy(r)&&v.push(Ae(r.disabled?"Enable":"Disable",{do:"setDisabled",nodes:[t],disabled:!r.disabled},{icon:r.disabled?"circle-large-outline":"circle-slash",shortcut:"disable",...s})),a&&!l&&k_(e,[t])&&v.push(Ae("Detach from Path",{do:"detach",nodes:[t]},{icon:"debug-disconnect",...s})),a&&r.type==="subflow"){let N=r.ref?"A shared subflow is edited in its source flow":(r.subflow?.nodes??[]).length===0?"The subflow has no steps to move up":void 0;v.push(Ae("Dissolve Subflow",{do:"dissolve",node:t},{icon:"ungroup-by-ref-type",...N?{disabled:N}:s}))}a&&e.doc.layout?.[t]&&v.push(Ae("Reset Position",{do:"resetPosition",nodes:[t]},{icon:"discard",...s})),a&&Rt(e.doc)>=2&&v.push(Ae("Add Note to This Node",{do:"addAnnotation",kind:"note",on:t},{icon:"note",shortcut:"addNote",...s}));let m=[t],b=[];a&&r.type!=="start"&&b.push(Ae("Cut",{do:"cut",nodes:m},{shortcut:"cut",...s})),b.push(Ae("Copy",{do:"copy",nodes:m},{icon:"copy",shortcut:"copy"})),a&&r.type!=="start"&&b.push(Ae("Duplicate",{do:"duplicate",nodes:m},{icon:"files",shortcut:"duplicate",...s}));let w=[Ae("Open in Text Editor",{do:"showInText",node:t},{icon:"go-to-file"})];n.hasPlay(t)&&w.push(Ae("Peek Code",{do:"peekCode",node:t},{icon:"code"}));let k=[];n.level==="root"&&!l&&!r.disabled&&k.push(Ae("Run from Here (Skeleton)",{do:"runPartial",node:t,only:!1},{icon:"debug-start",...s}),Ae("Run This Step (Skeleton)",{do:"runPartial",node:t,only:!0},{icon:"debug-step-over",...s}));let S=a?[Ae("Delete",{do:"delete",nodes:m},{icon:"trash",shortcut:"delete",...s})]:[];return lu(n.scenario?D7(e,t,n.scenario):[],f,v,h,b,w,k,S)}function R7(e,t,n,r=[]){let a=t.map(g=>e.nodes.get(g)?.node).filter(g=>!!g),s=n.mode==="design",l=n.stale?{disabled:n.why??su}:{},f=r.length?{annotations:r}:{},p=[];s&&p.push(Ae("Cut",{do:"cut",nodes:t,...f},{shortcut:"cut",...l})),p.push(Ae("Copy",{do:"copy",nodes:t,...f},{icon:"copy",shortcut:"copy"})),s&&p.push(Ae("Duplicate",{do:"duplicate",nodes:t,...f},{icon:"files",shortcut:"duplicate",...l}));let h=[];if(s&&Rt(e.doc)>=2&&h.push(Ae("Add Section Around",{do:"addAnnotation",kind:"section",around:[...t,...r]},{icon:"layout-panel",...l})),n.mode==="design"){let g=a.some(m=>m.type==="start"||m.type==="end");h.push(Ae("Extract into Subflow\u2026",{do:"extract",nodes:t},{icon:"type-hierarchy-sub",...g?{disabled:"Start and end nodes stay on their level"}:l}))}let v=a.filter(cy);if(s&&v.length>0){let g=v.every(m=>m.disabled);h.push(Ae(g?"Enable":"Disable",{do:"setDisabled",nodes:v.map(m=>m.id),disabled:!g},{icon:g?"circle-large-outline":"circle-slash",shortcut:"disable",...l}))}if(s&&k_(e,t)&&!a.some(g=>g.type==="start"||g.type==="end")&&h.push(Ae("Detach from Path",{do:"detach",nodes:t},{icon:"debug-disconnect",...l})),s&&t.length>=2){let g=t.length<3?{disabled:"Select three steps or more"}:l,m=t.some(b=>e.doc.layout?.[b]);h.push({type:"submenu",label:"Arrange",icon:"layout",items:[...["center","left","right"].map(b=>Ae(Nj[b],{do:"align",nodes:t,how:b},{...b==="center"?{shortcut:"alignCenter"}:{},...l})),{type:"separator"},...["top","middle","bottom"].map(b=>Ae(Nj[b],{do:"align",nodes:t,how:b},l)),{type:"separator"},Ae(jj.vertical,{do:"distribute",nodes:t,how:"vertical"},{shortcut:"distribute",...g}),Ae(jj.horizontal,{do:"distribute",nodes:t,how:"horizontal"},g),...m?[{type:"separator"},Ae("Reset Position",{do:"resetPosition",nodes:t},l)]:[]]})}return lu(p,h,s?[Ae("Delete",{do:"delete",nodes:t,...f},{icon:"trash",shortcut:"delete",...l})]:[])}var z7={yellow:"Yellow",blue:"Blue",green:"Green",pink:"Pink",purple:"Purple",gray:"Gray"};function F7(e,t,n){let r=e.annotations.get(t)?.annotation;if(!r)return ll(n);let a=r.kind??"note",s=n.mode==="design",l=n.stale?{disabled:n.why??su}:{},f={nodes:[],annotations:[t]},p=s?[Ae("Edit Text",{do:"editAnnotation",id:t},{icon:"edit",shortcut:"rename",...l}),{type:"submenu",label:"Color",icon:"symbol-color",items:Qj.map(g=>Ae(z7[g],{do:"colorAnnotation",id:t,color:g},{checked:(r.color??(a==="note"?"yellow":"gray"))===g,...l}))}]:[],h=s&&a==="note"?[r.on?Ae("Detach from Node",{do:"detachAnnotation",id:t},{icon:"debug-disconnect",...l}):Ae("Attach to Node\u2026",{do:"attachAnnotation",id:t},{icon:"link",...l})]:[],v=[];return s&&v.push(Ae("Cut",{do:"cut",...f},{shortcut:"cut",...l})),v.push(Ae("Copy",{do:"copy",...f},{icon:"copy",shortcut:"copy"})),s&&v.push(Ae("Duplicate",{do:"duplicate",...f},{icon:"files",shortcut:"duplicate",...l})),lu(p,h,v,s?[Ae("Delete",{do:"delete",...f},{icon:"trash",shortcut:"delete",...l})]:[])}function ll(e){let t=e.mode==="design",n=e.stale?{disabled:e.why??su}:{},r=t?[Ae("Paste Here",{do:"paste"},{icon:"clippy",shortcut:"paste",...n}),Ae("Add Node Here\u2026",{do:"addNode"},{icon:"add",shortcut:"addNode",...n}),Ae("Insert Shared Subflow\u2026",{do:"insertShared"},{icon:"references",...n})]:[],a=t&&(e.format??1)>=2?[Ae("Add Note Here",{do:"addAnnotation",kind:"note"},{icon:"note",shortcut:"addNote",...n}),Ae("Add Section Here",{do:"addAnnotation",kind:"section"},{icon:"layout-panel",...n}),Ae("Add Text Here",{do:"addAnnotation",kind:"text"},{icon:"text-size",...n})]:[],s=[Ae("Select All",{do:"selectAll"},{icon:"selection",shortcut:"selectAll"})];return t&&s.push(Ae("Tidy Up",{do:"tidyUp"},{icon:"layout",...n})),s.push(Ae("Fit View",{do:"fitView"},{icon:"screen-full",shortcut:"fit"})),s.push(Ae("Find Node\u2026",{do:"find"},{icon:"search",shortcut:"find"})),lu(r,a,s,e.level==="root"?[]:[Ae("Up to Parent",{do:"upLevel"},{icon:"arrow-up",shortcut:"up"})])}function B7(e,t,n){let r={...n,format:n.format??Rt(e.doc)},a=r.mode==="design"&&!r.stale;switch(t.kind){case"node":return L7(e,t.id,r);case"nodes":return R7(e,t.ids,r,t.annotations);case"annotation":return F7(e,t.id,r);case"annotations":{let s=r.stale?{disabled:r.why??su}:{},l={nodes:[],annotations:t.ids};return r.mode==="design"?lu([Ae("Cut",{do:"cut",...l},{shortcut:"cut",...s}),Ae("Copy",{do:"copy",...l},{icon:"copy",shortcut:"copy"}),Ae("Duplicate",{do:"duplicate",...l},{icon:"files",shortcut:"duplicate",...s})],[Ae("Delete",{do:"delete",...l},{icon:"trash",shortcut:"delete",...s})]):[Ae("Copy",{do:"copy",...l},{icon:"copy",shortcut:"copy"})]}case"edge":{let s=e.edges.get(t.id)?.edge;if(!s||!a)return ll(r);let l=w_(e,s.from,["insert","pick","disconnect"]);return l.length>0?l:ll(r)}case"entry":return a?[Ae("Remove Entry",{do:"removeEntry",subflow:t.subflow},{icon:"debug-disconnect"})]:ll(r);case"exit":return a?[...r.mode==="design"?[Ae("Edit Reason\u2026",{do:"editReason",edge:t.edge},{icon:"edit"})]:[],Ae("Remove Exit",{do:"removeExit",subflow:t.subflow,from:t.from,port:t.port},{icon:"debug-disconnect"})]:ll(r);case"pane":return ll(r)}}function q7(e){if(!e?.file||e.names.length===0)return{label:"Add Scenarios",tone:"none",title:"Say where each host must end when chosen steps fail, and check it as you change the flow"};if(e.error||FC(e.problems).length)return{label:"Scenarios \xB7 fix the file",tone:"error",title:"The scenarios file does not fit the flow: see the Scenarios tab or Problems"};let t=e.results.filter(n=>!n.passed).length;return t?{label:`Scenarios \xB7 ${t} failing`,tone:"warn",title:`${t} of ${e.results.length} scenarios end elsewhere in the simulation`}:{label:`Scenarios \xB7 ${e.results.length} pass`,tone:"ok",title:"Every scenario ends where it should in the simulation"}}var H7={failed:"fails",unreachable:"is unreachable",timeout:"times out",unchanged:"changes nothing",false:"takes false"};function V7(e,t){let n=va(e),r=s=>n.get(s)?.title||s,a=[];for(let[s,l]of Object.entries(t.force??{}))for(let[f,p]of Object.entries(l??{}))Array.isArray(p)&&p.length&&a.push(`${r(s)} ${H7[f]??f} for ${p.join(", ")}`);for(let[s,l]of Object.entries(t.approvals??{}))a.push(`${r(s)} is ${l==="timeout"?"timed out":l}`);return a}function K7(e,t){return t.scenarios.map((n,r)=>{let a=t.results[r],s=t.verified[n.name];return{name:n.name,hosts:zC(e,n),verdict:!a||a.error?"error":a.passed?"pass":"fail",misses:a?J0(a).map(l=>`${l.host} now ${l.actual==="not run"?"does not run":`ends at ${ah(e,l.actual)}`}; expected ${ah(e,l.expected)}`):[],...a?.error?{error:a.error}:{},bestEffort:(a?.needsAnsible??[]).map(l=>l.message),...s?{verified:{at:s.at,stale:s.stale,passed:s.result.passed}}:{},planted:V7(e,n)}})}function S_(e,t,n){let r=t.scenarios.find(s=>s.name===n);if(!r)return;let a=new Map;for(let[s,l]of va(e))a.set(l.id,s);return{name:n,hosts:zC(e,r),path:s=>a.get(s),forced:(s,l)=>{let f=r.force?.[s]?.[l];return Array.isArray(f)?f:[]},approval:s=>r.approvals?.[s]??"approved",expect:r.expect??{}}}function W7(e){let t=new Set(e?.names??[]),n=t.size+1;for(;t.has(`Scenario ${n}`);)n++;return`Scenario ${n}`}var N_=e=>Array.from({length:Math.max(1,Math.min(e,50))},(t,n)=>`host-${String(n+1).padStart(2,"0")}`);function U7(e,t,n){let r=RC(e)??"devices",a={[r]:N_(n)};for(let[s,l]of Object.entries(e.flow.inputs??{}))s!==r&&l?.required&&(a[s]=l.default===void 0?l.type==="integer"?1:l.type==="boolean"?!1:l.type==="host_list"||l.type==="list"?[]:"example":l.default);return{name:t,inputs:a,expect:{}}}var Th=8,Y7='[role^="menuitem"]';function j_(e){return[...e?.querySelectorAll(`:scope > ${Y7}`)??[]].filter(t=>t.getAttribute("aria-disabled")!=="true")}function Mh(e){let{x:t,y:n,label:r,items:a,onClose:s,header:l,className:f,data:p,opener:h,flipX:v,onBack:g}=e,m=(0,A.useRef)(null),[b,w]=(0,A.useState)(null),[k,S]=(0,A.useState)(null),N=(0,A.useRef)(void 0);F$(!g),(0,A.useLayoutEffect)(()=>{if(!m.current)return;let{width:T,height:M}=m.current.getBoundingClientRect(),O=t+T+Th>window.innerWidth?(v??t-16)-T:t,K=Math.min(n,window.innerHeight-M-Th);w({left:Math.max(Th,O),top:Math.max(Th,K)})},[t,n,v]);let $=b!==null;(0,A.useEffect)(()=>{$&&j_(m.current)[0]?.focus()},[$]),(0,A.useEffect)(()=>()=>clearTimeout(N.current),[]),(0,A.useEffect)(()=>{if(g)return;let T=K=>{let B=K;return!B?.closest?.(".afd-menu")&&!(h&&B instanceof Node&&h.contains(B))},M=K=>{T(K.target)&&s()},O=K=>{K.target instanceof Element&&T(K.target)&&s()};return document.addEventListener("pointerdown",M,!0),document.addEventListener("focusin",O,!0),()=>{document.removeEventListener("pointerdown",M,!0),document.removeEventListener("focusin",O,!0)}},[s,h,g]);let j=(T,M)=>{let O=M.getBoundingClientRect();S({index:T,x:O.right-2,y:O.top-4,flipX:O.left+2})},E=T=>{T.disabled||(s(),T.onSelect())},I=T=>{if(T.ctrlKey||T.metaKey)return;T.stopPropagation();let M=j_(m.current),O=M.indexOf(document.activeElement),K=B=>M[(B+M.length)%M.length]?.focus();switch(T.key){case"ArrowDown":T.preventDefault(),K(O+1);break;case"ArrowUp":T.preventDefault(),K(O<0?M.length-1:O-1);break;case"Home":T.preventDefault(),K(0);break;case"End":T.preventDefault(),K(M.length-1);break;case"ArrowRight":{let B=document.activeElement;B?.getAttribute("aria-haspopup")==="menu"&&(T.preventDefault(),j(Number(B.dataset.index),B));break}case"ArrowLeft":g&&(T.preventDefault(),g());break;case"Escape":T.preventDefault(),g?g():s();break;case"Tab":T.preventDefault(),s()}},z=k?a[k.index]:void 0;return(0,Lg.createPortal)((0,c.jsxs)("div",{ref:m,className:["afd-menu","nokey",f].filter(Boolean).join(" "),role:"menu","aria-label":r,...p,style:b?{left:b.left,top:b.top}:{left:t,top:n,visibility:"hidden"},onKeyDown:I,onContextMenu:T=>T.preventDefault(),children:[l,a.map((T,M)=>{if(T.type==="separator")return(0,c.jsx)("hr",{className:"afd-menu-sep"},`sep-${M}`);let O=T.icon?(0,c.jsx)("span",{className:`codicon codicon-${T.icon}`,"aria-hidden":"true"}):null;if(T.type==="submenu")return(0,c.jsxs)("button",{type:"button",role:"menuitem","aria-haspopup":"menu","aria-expanded":k?.index===M,"data-index":M,className:k?.index===M?"afd-menu-open":void 0,onClick:V=>j(M,V.currentTarget),onMouseEnter:V=>{let oe=V.currentTarget;clearTimeout(N.current),N.current=setTimeout(()=>j(M,oe),180)},children:[(0,c.jsx)("span",{className:"afd-menu-icon",children:O}),(0,c.jsx)("span",{className:"afd-menu-label",children:T.label}),(0,c.jsx)("span",{className:"codicon codicon-chevron-right afd-menu-more","aria-hidden":"true"})]},`sub-${T.label}`);let K={type:"button","aria-disabled":T.disabled?!0:void 0,"aria-label":T.shortcut||T.note?T.label:void 0,"aria-keyshortcuts":T.shortcut,title:T.disabled??T.title,onClick:()=>E(T),onMouseEnter:()=>{clearTimeout(N.current),N.current=setTimeout(()=>S(null),180)}},B=V=>(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("span",{className:"afd-menu-icon",children:V}),(0,c.jsxs)("span",{className:"afd-menu-label",children:[T.label,T.note?(0,c.jsx)("span",{className:"afd-menu-why",children:T.note}):null]}),T.shortcut?(0,c.jsx)("kbd",{className:"afd-menu-key",children:T.shortcut}):null]});return T.checked===void 0?(0,c.jsx)("button",{...K,role:"menuitem",children:B(O)},`item-${T.label}`):(0,c.jsx)("button",{...K,role:"menuitemradio","aria-checked":T.checked,children:B(T.checked?(0,c.jsx)("span",{className:"codicon codicon-check","aria-hidden":"true"}):null)},`item-${T.label}`)}),z?.type==="submenu"&&k?(0,c.jsx)(Mh,{x:k.x,y:k.y,flipX:k.flipX,label:z.label,items:z.items,onClose:s,onBack:()=>{let T=k.index;S(null),m.current?.querySelector(`[data-index="${T}"]`)?.focus()}}):null]}),document.body)}function X7(e,t){switch(t.kind){case"node":return e.nodes.get(t.id)?.node.title??"Node";case"nodes":return`${t.ids.length} nodes`;case"annotation":{let n=e.annotations.get(t.id)?.annotation.kind??"note";return n==="section"?"Section":n==="text"?"Text":"Note"}case"annotations":return`${t.ids.length} annotations`;case"edge":case"entry":case"exit":return"Wire";case"pane":return"Canvas"}}function Z7(e,t,n,r){let a=_.getState();switch(e.do){case"openSubflow":a.setLevel(e.node);return;case"scenarioForce":a.scenarioEditing&&a.setHostPick({scenario:a.scenarioEditing,step:e.step,outcome:e.outcome,title:e.title});return;case"scenarioApproval":a.scenarioEditing&&gf({kind:"setApproval",name:a.scenarioEditing,approval:e.approval,pick:e.pick}).then(s=>a.setError(s.ok?null:s.error??"The scenario did not change"));return;case"scenarioExpect":a.scenarioEditing&&gf({kind:"expectHost",name:a.scenarioEditing,host:e.host,where:e.where}).then(s=>a.setError(s.ok?null:s.error??"The scenario did not change"));return;case"properties":a.openDetails(e.node,e.tab);return;case"rename":py(e.node);return;case"setStatus":e.status==="tested"?a.setTestedReason(e.node):Pe({kind:"updateNode",id:e.node,patch:{status:e.status}});return;case"port":ol(e.item,e.ref);return;case"addNext":Ey(e.from,e.insertOn);return;case"cut":R5(e.nodes,e.annotations);return;case"copy":Kd(e.nodes,e.annotations??[]);return;case"duplicate":o$(e.nodes,e.annotations);return;case"delete":Ud(e.nodes,e.edges,e.annotations);return;case"addAnnotation":Yd(e.kind,t.at,e.on,e.around?{around:e.around}:{});return;case"editAnnotation":uh(e.id);return;case"colorAnnotation":H5(e.id,e.color);return;case"attachAnnotation":d$(e.id);return;case"detachAnnotation":l$(e.id);return;case"extract":F5(e.nodes);return;case"detach":L5(e.nodes);return;case"setDisabled":Pe({kind:"setDisabled",ids:e.nodes,disabled:e.disabled});return;case"dissolve":Pe({kind:"dissolveSubflow",id:e.node,place:!0});return;case"selectFlow":z5(e.node,e.dir);return;case"zoomSelection":a.zoomToSelection();return;case"align":dv(e.how,e.nodes);return;case"distribute":uv(e.how,e.nodes);return;case"resetPosition":v_(e.nodes);return;case"showInText":{let s=n.nodes.get(e.node)?.path;je({type:"openText",...s?{path:s}:{}});return}case"peekCode":je({type:"peekCode",node:e.node});return;case"runPartial":x8(e.node,e.only);return;case"removeEntry":Pe({kind:"setBoundaryIn",subflow:e.subflow,node:null});return;case"removeExit":Pe({kind:"disconnectBoundary",subflow:e.subflow,from:e.from,port:e.port});return;case"editReason":B5(e.edge);return;case"paste":je({type:"requestPaste",...t.at?{at:t.at}:{}});return;case"addNode":a.openQuickAdd({type:"task",...t.at?{position:t.at}:{}});return;case"insertShared":je({type:"insertShared",level:a.level,...t.at?{at:t.at}:{}});return;case"selectAll":r$();return;case"tidyUp":je({type:"tidyUp",level:a.level});return;case"fitView":r();return;case"find":a.openFind(!0);return;case"upLevel":hy();return}}function G7(){let e=_(w=>w.contextMenu),t=_(w=>w.snapshot),n=_(w=>w.mode),r=_(w=>w.level),a=_(w=>w.openContextMenu),s=_(w=>w.scenarioEditing),l=_(w=>w.scenarioCheck),f=Ts(),p=_(w=>w.viewer);if(!e||!t?.doc||p)return null;let h=$e(t.doc),v=s&&l?S_(t.doc,l,s):void 0,g=B7(h,e.target,{mode:n,level:r,stale:t.stale||!!t.idGaps,...t.idGaps?{why:"Complete IDs first (the banner above the canvas)"}:{},openPorts:t.openPorts,hasPlay:w=>!!t.plays?.[w],...v?{scenario:v}:{}});if(g.length===0)return null;let m=()=>{f.fitView(T0)},b=w=>w.type==="separator"?w:w.type==="submenu"?{...w,items:w.items.map(b)}:{type:"item",label:w.label,icon:w.icon,shortcut:Na(w.shortcut),checked:w.checked,disabled:w.disabled,note:w.disabled,onSelect:()=>Z7(w.action,e,h,m)};return(0,c.jsx)(Mh,{x:e.x,y:e.y,label:X7(h,e.target),data:{"data-canvas-menu":e.target.kind},items:g.map(b),onClose:()=>a(null)})}var Q7={note:"Note",section:"Section",text:"Text"},C_={s:"Small",m:"Medium",l:"Large"};function J7({id:e}){let t=_(v=>v.snapshot),n=_(v=>v.mode==="design"),r=wa()&&n;if(!t?.doc)return null;let a=$e(t.doc),s=a.annotations.get(e)?.annotation;if(!s)return null;let l=s.kind??"note",f=s.color??(l==="note"?"yellow":"gray"),p=s.on?a.nodes.get(s.on)?.node:void 0,h=v=>{Pe({kind:"updateAnnotation",id:e,patch:eq(v)})};return(0,c.jsxs)("div",{className:"afd-panel-body","data-annotation-panel":l,children:[(0,c.jsx)("h2",{className:"afd-panel-title",children:Q7[l]}),(0,c.jsxs)("p",{className:"muted",children:["Explains the flow and never runs: changing it keeps the flow's version.",l==="note"&&p?" Its text is a comment above the code of the node it is on.":"",l==="section"?" Drag its title bar to move it with what is wholly inside; the arrow keys move it alone.":""]}),(0,c.jsxs)("fieldset",{className:"afd-editable",disabled:!r,children:[(0,c.jsx)(fn,{label:l==="section"?"Title (Markdown)":"Text (Markdown)",focusKey:"annotationText",multiline:l!=="section",value:s.text,placeholder:"**bold**, *italic*, `code`, - lists, [links](https://...)",onCommit:v=>h({text:v})}),(0,c.jsxs)("div",{className:"afd-field",children:[(0,c.jsx)("label",{htmlFor:"afd-annotation-color",children:"Color"}),(0,c.jsx)("select",{id:"afd-annotation-color",value:f,onChange:v=>h({color:v.target.value}),children:Qj.map(v=>(0,c.jsxs)("option",{value:v,children:[v[0]?.toUpperCase(),v.slice(1)]},v))})]}),l==="text"?(0,c.jsxs)("div",{className:"afd-field",children:[(0,c.jsx)("label",{htmlFor:"afd-annotation-size",children:"Size"}),(0,c.jsx)("select",{id:"afd-annotation-size",value:s.size??"m",onChange:v=>h({size:v.target.value}),children:Object.keys(C_).map(v=>(0,c.jsx)("option",{value:v,children:C_[v]},v))})]}):null]}),l==="note"?(0,c.jsxs)("div",{className:"afd-field",children:[(0,c.jsx)(il,{label:"On node",value:p?p.title:"None (free on the canvas)"}),r?p?(0,c.jsx)("button",{type:"button",className:"secondary",onClick:()=>l$(e),children:"Detach from Node"}):(0,c.jsx)("button",{type:"button",className:"secondary",onClick:()=>d$(e),children:"Attach to Node\u2026"}):null]}):null]})}function eq(e){return Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0))}var tq={failed_hosts:"fails",unreachable:"cannot reach a host",timeout:"runs out of time",rejected:"is rejected"};function nq(){let e=_(s=>s.snapshot),t=_(s=>s.bannerDismissedAt),n=_(s=>s.dismissBanner),r=_(s=>s.reveal),a=_(s=>s.viewer);if(!e)return null;if(a)return e.stale?(0,c.jsxs)("div",{className:"afd-banner error",role:"alert","data-read-only-banner":!0,children:[(0,c.jsx)("span",{className:"codicon codicon-error","aria-hidden":"true"}),(0,c.jsxs)("span",{children:["The flow file has YAML errors (",e.parseError,"). This is its last valid version."]})]}):null;if(e.stale)return(0,c.jsxs)("div",{className:"afd-banner error",role:"alert","data-read-only-banner":!0,children:[(0,c.jsx)("span",{className:"codicon codicon-error","aria-hidden":"true"}),(0,c.jsxs)("span",{children:[(0,c.jsx)("strong",{children:"Read-only:"})," the text has YAML errors (",e.parseError,"). This is the last valid version; fix the text to edit again."]}),(0,c.jsx)("button",{type:"button",onClick:()=>je({type:"openText"}),children:"Open in Text Editor"})]});if(e.idGaps){let s=e.idGaps;return(0,c.jsxs)("div",{className:"afd-banner warning",role:"status","data-id-gaps":s,children:[(0,c.jsx)("span",{className:"codicon codicon-edit","aria-hidden":"true"}),(0,c.jsx)("strong",{children:"Written by hand:"}),(0,c.jsxs)("span",{className:"muted",children:[s," ",s===1?"item needs an ID":"items need IDs"," before the canvas can edit this flow."]}),(0,c.jsx)("button",{type:"button",onClick:()=>je({type:"completeIds"}),children:"Complete IDs"})]})}return(0,c.jsx)(oq,{reveal:r,dismiss:n,dismissedAt:t})}function oq({reveal:e,dismiss:t,dismissedAt:n}){let r=_(N=>N.snapshot),a=wa(),[s,l]=(0,A.useState)(0),f=r?JC(r.openPorts):0;if(!r?.doc||f===0||n===f)return(0,c.jsx)("span",{hidden:!0,"data-banner-count":f});let p=r.openPorts[s%f],h=$e(r.doc),v=p?h?.nodes.get(p.node)?.node:void 0,g=p?{node:p.node,port:p.port}:void 0,m=g&&h&&a?Id(h,g)?.items??[]:[],b=m.filter(N=>N.kind==="pattern"),w=b.find(N=>N.kind==="pattern"&&N.pattern==="stop"),k=b.slice(0,2),S=[...k,...w&&!k.includes(w)?[w]:[],...m.filter(N=>N.kind==="decide")];return(0,c.jsxs)("div",{className:"afd-banner warning",role:"status","data-banner-count":f,children:[(0,c.jsx)("span",{className:"codicon codicon-warning","aria-hidden":"true"}),(0,c.jsxs)("strong",{children:[f," open fail port",f===1?"":"s"]}),(0,c.jsxs)("span",{title:"Hosts that fail there have nowhere to go, so they fail the run",children:["What should happen when"," ",(0,c.jsxs)("button",{type:"button",className:"link",onClick:()=>p&&e(p.node),children:['"',v?.title??p?.node,'"']})," ",tq[p?.port??""]??`takes ${p?.port}`,"?"]}),g?S.map(N=>(0,c.jsx)("button",{type:"button",className:"secondary",title:"hint"in N?N.hint:void 0,onClick:()=>{ol(N,g)},children:N.label},N.label)):null,a?(0,c.jsx)("button",{type:"button",className:"link",onClick:()=>g&&K$(g),children:"Other Choices"}):null,f>1?(0,c.jsxs)("button",{type:"button",className:"link",onClick:()=>{let N=r.openPorts[(s+1)%f];l(s+1),N&&e(N.node)},children:["Next (",(s+1)%f+1," of ",f,")"]}):null,(0,c.jsx)("button",{type:"button",className:"icon","aria-label":"Dismiss",onClick:()=>t(f),children:(0,c.jsx)("span",{className:"codicon codicon-close","aria-hidden":"true"})})]})}function rq(){let e=_(s=>s.snapshot?.doc),t=_(s=>s.formatDismissed),n=wa();if(!e||t||!n||Rt(e)>=2)return null;let r=W6(e),a=async()=>{(await Pe({kind:"upgradeFormat"})).ok&&_.getState().notify("success","Upgraded to flow format 2. Undo reverts it.")};return(0,c.jsxs)("div",{className:"afd-banner info",role:"status","data-format-banner":Rt(e),children:[(0,c.jsx)("span",{className:"codicon codicon-arrow-circle-up","aria-hidden":"true"}),(0,c.jsxs)("span",{children:[(0,c.jsxs)("strong",{children:["Flow format ",Rt(e),"."]})," ",r.length?`Upgrading changes: ${r.join("; ")}.`:"Format 2 is what newer features use; the design stays as it is."," ","One undo step reverts it."]}),(0,c.jsx)("button",{type:"button",onClick:()=>{a()},children:"Upgrade Flow Format"}),(0,c.jsx)("button",{type:"button",className:"icon","aria-label":"Hide the format message",title:"Hide",onClick:()=>_.setState({formatDismissed:!0}),children:(0,c.jsx)("span",{className:"codicon codicon-close","aria-hidden":"true"})})]})}function iq({edge:e}){let t=_(v=>v.snapshot),n=_(v=>v.level),r=_(v=>v.select);if(!t?.doc)return null;let a=ry(t,cn(t,{},n),n),s=a?.edges.find(v=>v.id===e);if(!a||!s)return null;let l=$e(t.doc),f=v=>l.nodes.get(v)?.node.title??v,p=a.subflow.id;if(!s.exit)return(0,c.jsxs)("div",{className:"afd-panel-body","data-boundary-panel":"entry",children:[(0,c.jsxs)("h2",{className:"afd-panel-title",children:["Entry of ",a.subflow.title]}),(0,c.jsxs)("p",{className:"muted",children:["Hosts entering ",(0,c.jsx)("strong",{children:a.subflow.title})," start at"," ",(0,c.jsx)("strong",{children:f(s.target)}),". Drag from the frame's"," ",(0,c.jsx)("span",{className:"mono",children:"in"})," to another step to move the entry."]}),(0,c.jsx)("button",{type:"button",className:"secondary",onClick:()=>{r({}),Pe({kind:"setBoundaryIn",subflow:p,node:null})},children:"Remove entry"})]});let h=s.exit;return(0,c.jsxs)("div",{className:"afd-panel-body","data-boundary-panel":"exit",children:[(0,c.jsxs)("h2",{className:"afd-panel-title",children:["Exit to ",h.port]}),(0,c.jsxs)("p",{className:"muted",children:["Hosts leaving ",(0,c.jsx)("strong",{children:f(h.from.node)})," \xB7"," ",(0,c.jsx)("span",{className:"mono",children:h.from.port})," leave ",(0,c.jsx)("strong",{children:a.subflow.title})," ","through ",(0,c.jsx)("span",{className:"mono",children:h.port}),"."]}),(0,c.jsx)(fn,{label:"Reason (shown on the wire)",focusKey:"exitReason",value:h.reason??"",placeholder:"e.g. SSH timeout",onCommit:v=>{Pe({kind:"setExitReason",subflow:p,from:h.from,port:h.port,reason:v})}}),(0,c.jsx)("button",{type:"button",className:"secondary",onClick:()=>{r({}),Pe({kind:"disconnectBoundary",subflow:p,from:h.from,port:h.port})},children:"Remove exit"})]})}var aq={inventory:"No step on this level runs on hosts of its own.",data:"No step on this level reads an input or sets an output.",code:"No step on this level is bound to a module, role or playbook yet.",access:"No step on this level sets a credential, a user, become or vaulted variables: each acts as the run does.",timing:"No step on this level has batches or timeouts, and no run has timed it yet.",changes:"Nothing on this level changed since the version it compares with."};function sq(e,t,n,r){let a=sa.find(f=>f.id===e),s={lens:e,label:a?.label??e,what:a?.hint??""};if(e==="inventory"&&!r?.trim())return{...s,empty:"The flow targets are not set, so the lens cannot count the hosts each step runs on.",setTargets:!0};if(!t)return s;let l=n.filter(f=>f.type!=="start"&&f.type!=="end");return l.some(f=>(t.chips[f.id]?.length??0)>0)||e==="changes"&&(t.ghosts?.length??0)>0||l.length===0?s:{...s,empty:t.notes[0]??aq[e]}}var cv=[{id:"design",label:"Design",hint:"Draw the flow: steps, wires, and what happens when a step fails"},{id:"code",label:"Code",hint:"What each step runs, and where the code differs from the design"},{id:"run",label:"Run",hint:"The last run on the canvas: how many hosts took each wire, and which steps failed"}];function lq(){let e=_(v=>v.mode),t=_(v=>v.lens),n=_(v=>v.lensView),r=_(v=>v.snapshot?.doc),a=_(v=>v.level),s=_(v=>v.lensFacts.inventory?.targets),l=_(v=>v.viewer);if(!r||l||e==="design"&&!t)return null;let f=cv.find(v=>v.id===e),p=($e(r).levels.get(a)?.nodes??[]).map(v=>({id:v.id,type:v.type})),h=t?sq(t,n,p,s):void 0;return(0,c.jsxs)("div",{className:"afd-canvas-caption",role:"status","data-canvas-caption":t??e,children:[e!=="design"&&f?(0,c.jsxs)("p",{"data-caption-mode":e,children:[(0,c.jsxs)("strong",{children:[f.label," mode"]})," \xB7 ",f.hint,". The graph only reads here; Design changes it."]}):null,h?(0,c.jsxs)("p",{"data-caption-lens":h.lens,children:[(0,c.jsxs)("strong",{children:[h.label," lens"]})," \xB7 ",h.what,".",h.empty?(0,c.jsxs)(c.Fragment,{children:[" ",(0,c.jsx)("span",{className:"afd-caption-empty","data-lens-empty":!0,children:h.empty})]}):null,h.setTargets?(0,c.jsxs)(c.Fragment,{children:[" ",(0,c.jsx)("button",{type:"button",className:"link",onClick:()=>je({type:"setTargets"}),children:"Set Targets\u2026"})]}):null]}):null]})}var dq=["Edit","Move around","Canvas","Flow"];function uq(){return _(e=>e.cheatSheet)?(0,c.jsx)(cq,{}):null}function cq(){let e=_(r=>r.showCheatSheet),t=(0,A.useRef)(null),n=nl(t);return(0,c.jsx)("div",{className:"afd-modal-backdrop nokey",children:(0,c.jsxs)("div",{ref:t,className:"afd-modal afd-cheatsheet",role:"dialog","aria-modal":"true","aria-label":"Keyboard Shortcuts",onKeyDown:r=>{n(r),r.key==="Escape"&&(r.stopPropagation(),e(!1))},children:[(0,c.jsxs)("div",{className:"afd-cheatsheet-head",children:[(0,c.jsx)("h2",{children:"Keyboard Shortcuts"}),(0,c.jsx)("button",{type:"button",className:"icon","aria-label":"Close",autoFocus:!0,onClick:()=>e(!1),children:(0,c.jsx)("span",{className:"codicon codicon-close","aria-hidden":"true"})})]}),dq.map(r=>(0,c.jsxs)("section",{children:[(0,c.jsx)("h3",{children:r}),(0,c.jsx)("dl",{children:Iy.filter(a=>a.group===r).map(a=>(0,c.jsxs)("div",{"data-shortcut":a.id,children:[(0,c.jsx)("dt",{children:(0,c.jsx)("kbd",{children:a.keys})}),(0,c.jsx)("dd",{children:a.label})]},a.id))})]},r)),(0,c.jsx)("p",{className:"muted",children:"Right-click a node, a wire or the canvas for everything you can do there."})]})})}function fq(){let e=_(l=>l.decide),t=_(l=>l.snapshot),n=_(l=>l.setDecide);if(!e)return null;let r=(t?.doc?.decisions??[]).find(l=>l?.node===e.node&&l.port===e.port),a=t?.doc,s=a?$e(a).nodes.get(e.node)?.node:void 0;return(0,c.jsxs)(Nh,{id:"afd-decide",title:"Accept with Reason",placeholder:"e.g. Fails before any change; stopping is safe",submit:r?"Save Reason":"Accept",initial:r?.reason,target:e,record:l=>Pe({kind:"setDecision",node:e.node,port:e.port,reason:l}),close:()=>n(null),children:[(0,c.jsx)("strong",{children:s?.title??e.node})," \xB7 ",(0,c.jsx)("span",{className:"mono",children:e.port})," ","stays unwired: hosts that take it fail the run visibly and stop there. The warning goes away and the decision is recorded in the flow with your Git user name."]})}function hq(){let e=_(v=>v.hostPick),t=()=>_.getState().setHostPick(null),n=_(v=>v.snapshot?.doc),r=_(v=>v.scenarioCheck),a=e&&n&&r?S_(n,r,e.scenario):void 0,[s,l]=(0,A.useState)(new Set),f=(0,A.useRef)(null),p=nl(f);if((0,A.useEffect)(()=>{l(new Set(a&&e?a.forced(e.step,e.outcome):[])),setTimeout(()=>f.current?.querySelector("input")?.focus(),0)},[e]),!e||!a||!n)return null;let h=va(n).get(e.step);return(0,c.jsx)("div",{className:"afd-modal-backdrop",children:(0,c.jsxs)("form",{ref:f,className:"afd-modal",role:"dialog","aria-modal":"true","aria-labelledby":"afd-host-pick-title","data-host-pick":e.outcome,onSubmit:async v=>{v.preventDefault();let g=a.hosts.filter(b=>s.has(b)),m=await gf({kind:"force",name:e.scenario,step:e.step,outcome:e.outcome,hosts:g});m.ok?t():_.getState().setError(m.error??"The scenario did not change")},onKeyDown:v=>{p(v),v.key==="Escape"&&(v.stopPropagation(),t())},children:[(0,c.jsxs)("h2",{id:"afd-host-pick-title",children:[h?.title??e.step,": ",e.title,"\u2026"]}),(0,c.jsxs)("p",{className:"muted",children:["In scenario ",(0,c.jsx)("strong",{children:e.scenario}),", the hosts ticked here take this outcome at"," ",h?.title??e.step,"; the rest go on as usual."]}),(0,c.jsxs)("fieldset",{className:"afd-host-pick",children:[(0,c.jsx)("legend",{className:"afd-sr-only",children:"Hosts"}),a.hosts.map(v=>(0,c.jsxs)("label",{className:"afd-check",children:[(0,c.jsx)("input",{type:"checkbox",checked:s.has(v),onChange:g=>{let m=new Set(s);g.target.checked?m.add(v):m.delete(v),l(m)}})," ",v]},v))]}),(0,c.jsxs)("div",{className:"afd-modal-actions",children:[(0,c.jsx)("button",{type:"button",className:"secondary",onClick:t,children:"Cancel"}),(0,c.jsx)("button",{type:"submit",children:"Save"})]})]})})}function $_(e,t){let n=t.trim();switch(e){case"host_list":return{value:n.split(/[,\s]+/).map(r=>r.trim()).filter(Boolean)};case"integer":return/^-?[0-9]+$/.test(n)?{value:Number(n)}:{error:"a whole number"};case"boolean":return/^(true|yes|1)$/i.test(n)?{value:!0}:/^(false|no|0)$/i.test(n)?{value:!1}:{error:"true or false"};case"list":if(n.startsWith("["))try{let r=JSON.parse(n);return Array.isArray(r)?{value:r}:{error:"a list"}}catch{return{error:"a JSON list, or items separated by commas"}}return{value:n.split(",").map(r=>r.trim()).filter(Boolean)};case"dict":if(!n)return{value:{}};try{let r=n.startsWith("{")?JSON.parse(n):kr(n);return r&&typeof r=="object"&&!Array.isArray(r)?{value:r}:{error:"key: value pairs, as YAML or JSON"}}catch{return{error:"key: value pairs, as YAML or JSON"}}default:return{value:n}}}function pq(e,t){let n=$_(e,t);return"error"in n?`Expected ${n.error}`:Array.isArray(n.value)?n.value.length===0?"An empty list":`${n.value.length} item${n.value.length===1?"":"s"}: ${n.value.map(r=>JSON.stringify(r)).join(", ")}`:JSON.stringify(n.value)}function E_(e,t){let n={};for(let r of e){let a=t[r.name]??r.text;if(!a.trim()){if(r.required)return{error:`${r.name} is required`,field:r.name};continue}let s=$_(r.type,a);if("error"in s)return{error:`${r.name}: expected ${s.error}`,field:r.name};n[r.name]=s.value}return{inputs:n}}function mq(e,t){let n={};for(let r of e){let a=E_([r],t);if("inputs"in a)Object.assign(n,a.inputs);else if(r.type==="host_list")return a}return{inputs:n}}function gq(e){return e.map(t=>{let n=t.nodes.map(a=>`[${a}]`).join(", "),r=t.count===void 0?"resolved at run time":t.count===0?"matches no host, so those nodes fail every arriving host":`${t.count} host(s)`;return`Also on inventory_target ${t.pattern??t.declared}: ${r} (${n})`})}var yq=e=>e.uses.reduce((t,n)=>t+(n.count??0),0);function vq(e,t){let n=yq(t);return`Run "${e}" for real on ${t.count} host(s)${n?` and ${n} inventory_target host(s)`:""}?`}function bq(e){let t=e.hosts.slice(0,8).join(", ")+(e.count>8?", \u2026":"");return["This is not check mode: bound nodes change the devices.",`Inventory: ${e.sources.join(", ")}`,`Hosts: ${e.count} (${t})`,e.unknown.length?`Not in the inventory: ${e.unknown.join(", ")}`:"",...gq(e.uses),e.prod.length?`Production-looking: ${e.prod.slice(0,8).join(", ")}`:"No production-looking groups or hosts",`Environment: ${e.environment}`].filter(Boolean)}var xq={host_list:"hosts or groups, comma-separated",list:"items separated by commas, or a JSON list",dict:"key: value lines (YAML) or JSON",integer:"a whole number",boolean:"true or false"};function wq(){let e=_(t=>t.launch);return e?(0,c.jsx)(kq,{plan:e},e.token):null}function kq({plan:e}){let t=_(j=>j.launchNotice),n=(0,A.useRef)(null),r=nl(n),a=(0,A.useId)(),[s,l]=(0,A.useState)(()=>Object.fromEntries(e.fields.map(j=>[j.name,j.text]))),[f,p]=(0,A.useState)(""),[h,v]=(0,A.useState)(null),g=e.mode==="real",m=e.fields.filter(j=>j.type==="host_list").map(j=>s[j.name]??"").join("|"),b=(0,A.useRef)(!0);(0,A.useEffect)(()=>{if(b.current){b.current=!1;return}let j=setTimeout(()=>{let E=mq(e.fields.filter(I=>!I.secret),s);"inputs"in E?je({type:"launchCheck",token:e.token,inputs:E.inputs}):_.getState().setLaunchFacts(e.token,void 0,E.error)},400);return()=>clearTimeout(j)},[m]);let w=_(j=>j.viewer),k=()=>{je({type:"launchCancel",token:e.token}),_.getState().setLaunch(null)},S=j=>{je({type:"launchSwitch",token:e.token,mode:e.mode,what:j}),_.getState().setLaunch(null)},N=()=>{let j=E_(e.fields,s);"error"in j?(v({field:j.field,text:j.error}),document.getElementById(`afd-launch-${j.field}`)?.focus()):e.vault&&!f?(v({field:"__vault",text:"The vault password is needed for this run"}),document.getElementById("afd-launch-__vault")?.focus()):(_.getState().setRunAsked(!0),je({type:"launchRun",token:e.token,inputs:j.inputs,...e.vault?{vaultPassword:f}:{}}),p(""),_.getState().setLaunch(null))},$=g?"Run for Real":"Run as Skeleton";return(0,c.jsx)("div",{className:"afd-modal-backdrop",children:(0,c.jsxs)("div",{ref:n,className:`afd-modal afd-launch${g?" real":""}`,role:"dialog","aria-modal":"true","aria-labelledby":a,"data-launch":e.mode,onKeyDown:j=>{r(j),j.key==="Escape"&&(j.stopPropagation(),k())},children:[(0,c.jsxs)("h2",{id:a,children:[$,": ",e.flow]}),(0,c.jsxs)("p",{className:"muted",children:[g?"Not check mode: bound steps change the devices.":"Check mode: bound steps report what they would change, and change nothing."," "]}),(0,c.jsxs)("p",{className:"muted afd-launch-where",children:["Runs in: ",(0,c.jsx)("span",{"data-launch-environment":!0,children:e.environment})," ",w?null:(0,c.jsx)("button",{type:"button",className:"link",onClick:()=>S("environment"),children:"Change"}),e.inventory?(0,c.jsxs)(c.Fragment,{children:[" \xB7 ","Inventory: ",(0,c.jsx)("span",{"data-launch-inventory":!0,children:e.inventory})," ",w?null:(0,c.jsx)("button",{type:"button",className:"link",onClick:()=>S("inventory"),children:"Change"})]}):null]}),t?(0,c.jsx)("p",{className:"afd-launch-notice",role:"alert",children:t}):null,(0,c.jsxs)("form",{onSubmit:j=>{j.preventDefault(),N()},children:[e.fields.length===0?(0,c.jsx)("p",{className:"muted",children:"This flow has no inputs."}):null,e.fields.map(j=>(0,c.jsx)(Nq,{field:j,text:s[j.name]??"",groups:j.type==="host_list"?e.groups:[],groupHosts:e.groupHosts,problem:h?.field===j.name?h.text:void 0,onChange:E=>{l(I=>({...I,[j.name]:E})),h?.field===j.name&&v(null)}},j.name)),e.vault?(0,c.jsxs)("div",{className:"afd-field",children:[(0,c.jsx)("label",{htmlFor:"afd-launch-__vault",children:"Vault password"}),(0,c.jsx)("input",{id:"afd-launch-__vault",className:"afd-input",type:"password",autoComplete:"off",value:f,"aria-invalid":h?.field==="__vault",onChange:j=>p(j.target.value)}),(0,c.jsx)("span",{className:"afd-help",children:h?.field==="__vault"?h.text:"For this run only; never stored or logged."})]}):null,(0,c.jsx)(jq,{plan:e}),(0,c.jsxs)("div",{className:"afd-modal-actions",children:[(0,c.jsx)("button",{type:"button",className:"secondary",onClick:k,children:"Cancel"}),(0,c.jsx)("button",{type:"submit",disabled:!!e.factsError,"data-launch-run":!0,children:$})]})]})]})})}function Sq(e,t){if(!t)return`Add the inventory group ${e}`;let n=t.count>t.hosts.length?", \u2026":"";return`${e}: ${t.count} host${t.count===1?"":"s"}: ${t.hosts.join(", ")}${n}`}function Nq({field:e,text:t,groups:n,groupHosts:r,problem:a,onChange:s}){let l=`afd-launch-${e.name}`,f=e.type??"string",p=xq[f],h=e.type==="list"||e.type==="dict"?pq(f,t):"",v=t.split(/[,\s]+/).filter(Boolean);return(0,c.jsxs)("div",{className:"afd-field","data-launch-field":e.name,children:[(0,c.jsxs)("label",{htmlFor:l,children:[(0,c.jsx)("span",{className:"mono",children:e.name})," ",(0,c.jsx)("span",{className:"muted",children:f}),e.required?(0,c.jsx)("abbr",{title:"required",children:" *"}):null]}),e.type==="dict"?(0,c.jsx)("textarea",{id:l,className:"afd-input mono",rows:3,value:t,"aria-invalid":!!a,onChange:g=>s(g.target.value)}):(0,c.jsx)("input",{id:l,className:"afd-input",type:e.secret?"password":"text",autoComplete:"off",spellCheck:!1,value:t,placeholder:p,"aria-invalid":!!a,onChange:g=>s(g.target.value)}),n.length>0?(0,c.jsxs)("fieldset",{className:"afd-chips afd-launch-groups",children:[(0,c.jsxs)("legend",{className:"muted afd-launch-groups-label",children:["Inventory groups",(0,c.jsxs)("span",{className:"afd-sr-only",children:[" for ",e.name]})]}),n.slice(0,12).map(g=>(0,c.jsxs)("button",{type:"button",className:`chip-button mono${v.includes(g)?" active":""}`,"aria-pressed":v.includes(g),title:Sq(g,r?.[g]),"data-group-hosts":r?.[g]?.count,onClick:()=>s(v.includes(g)?v.filter(m=>m!==g).join(", "):[...v,g].join(", ")),children:[g,r?.[g]?(0,c.jsxs)("span",{className:"afd-chip-count","aria-hidden":"true",children:[" ","\xB7 ",r[g].count]}):null]},g))]}):null,(0,c.jsx)("span",{className:`afd-help${a?" tone-warn":""}`,"data-launch-help":!0,children:a??[e.description,e.secret?"Typed hidden; not remembered.":h||(e.description?"":p?`${p[0]?.toUpperCase()}${p.slice(1)}`:"")].filter(Boolean).join(" \xB7 ")})]})}function jq({plan:e}){if(e.factsError)return(0,c.jsx)("p",{className:"afd-launch-facts tone-warn",role:"status","data-launch-facts":"error",children:e.factsError});let t=e.facts;if(!t)return null;let n=bq(t);return(0,c.jsxs)("div",{className:"afd-launch-facts",role:"status","data-launch-facts":e.mode,"data-launch-hosts":t.count,children:[e.mode==="real"?(0,c.jsx)("strong",{children:vq(e.flow,t)}):null,(0,c.jsx)("ul",{children:(e.mode==="real"?n.slice(1):n.slice(1,-2)).map(r=>(0,c.jsx)("li",{className:r.startsWith("Production-looking")?"tone-warn":"",children:r},r))})]})}var Cq="#none-left",fv=e=>sa.find(t=>t.id===e)?.label??e;function $q({item:e,places:t}){let n=_(s=>s.reveal),r=e.nodes.length===1?e.nodes[0]:void 0,a=fE(e.nodes,t);return(0,c.jsx)("li",{className:`afd-lens-item${e.tone?` tone-${e.tone}`:""}`,"data-lens-item":e.key,...uE(e.nodes),children:(0,c.jsxs)("button",{type:"button",className:"afd-lens-item-button",disabled:!r,onClick:()=>r&&n(r),title:r?"Show the node":`${e.nodes.length} nodes`,children:[(0,c.jsx)("span",{className:"afd-lens-item-label mono",children:e.label}),e.value===void 0?null:(0,c.jsx)("span",{className:"afd-lens-item-value",children:e.value}),e.detail?(0,c.jsx)("span",{className:"afd-lens-item-detail muted",children:e.detail}):null,a?(0,c.jsx)("span",{className:"afd-lens-item-detail muted","data-finding-place":!0,children:a}):null]})})}function Eq(){let e=_(t=>t.lensFacts.compare);return e?(0,c.jsxs)("div",{className:"afd-lens-source",children:[(0,c.jsx)("label",{htmlFor:"afd-compare-ref",children:"Compare with"}),(0,c.jsxs)("select",{id:"afd-compare-ref",value:e.ref,disabled:e.refs.length===0,onChange:t=>je({type:"compareWith",ref:t.target.value}),children:[e.refs.length===0?(0,c.jsx)("option",{value:e.ref,children:e.label}):null,e.refs.map(t=>(0,c.jsx)("option",{value:t.ref,children:t.label},t.ref))]})]}):(0,c.jsx)("p",{className:"muted",children:"Reading the versions of this flow\u2026"})}function _q(){let e=_(s=>s.lensView),t=_(s=>s.lens),n=_(s=>s.lensFacts.inventory),r=_(s=>s.snapshot?.doc);if(!e||!t)return null;let a=t==="inventory"||t==="access";return(0,c.jsxs)("section",{className:"afd-panel-body afd-lens-browser","aria-label":`${fv(t)} lens`,children:[(0,c.jsxs)("h2",{className:"afd-panel-title",children:[fv(t)," ",(0,c.jsx)(Sa,{topic:"lenses",about:"lenses"})]}),(0,c.jsxs)("p",{className:"muted","data-lens-what":!0,children:[sa.find(s=>s.id===t)?.hint,"."]}),a?(0,c.jsxs)("div",{className:"afd-lens-source",children:[(0,c.jsx)("p",{className:"muted",children:n?.facts?`${n.facts.sources.join(", ")} \xB7 ${n.facts.total} hosts`:n?.state==="loading"?"Reading the inventory\u2026":"Inventory not read"}),(0,c.jsxs)("p",{children:["Targets: ",(0,c.jsx)("span",{className:"mono",children:n?.targets||"not set"})," ",(0,c.jsx)("button",{type:"button",className:"link",onClick:()=>je({type:"setTargets"}),children:"Set Targets\u2026"})]})]}):null,t==="changes"?(0,c.jsx)(Eq,{}):null,e.notes.length>0&&t==="changes"?(0,c.jsx)("p",{className:"muted","data-compare-note":!0,children:e.notes.join(" ")}):null,e.sections.map(s=>{let l=hE(r,s.items.map(f=>f.nodes));return(0,c.jsxs)("section",{className:"afd-section",children:[(0,c.jsx)("h3",{children:s.title}),s.items.length===0?(0,c.jsx)("p",{className:"muted",children:s.empty}):(0,c.jsx)("ul",{className:"afd-lens-items",children:s.items.map(f=>(0,c.jsx)($q,{item:f,places:l},f.key))})]},s.title)})]})}function Aq(){let e=_(p=>p.lensView),t=_(p=>p.lens),[n,r]=(0,A.useState)(null),a=(0,A.useRef)(null),s=_(p=>p.snapshot?.doc);if((0,A.useEffect)(()=>{n&&(r(null),([...document.querySelectorAll("[data-finding]")].find(p=>p.dataset.finding===n)?.querySelector("button")??a.current)?.focus())},[n]),!e||!t)return null;let l=e.findings.filter(p=>!p.accepted).length,f=hE(s,e.findings.map(cE));return(0,c.jsxs)("div",{className:"afd-panel-body","data-lens-panel":t,children:[(0,c.jsxs)("h2",{className:"afd-panel-title",children:[fv(t)," lens",(0,c.jsx)("button",{type:"button",className:"secondary afd-lens-refresh",title:"Read the facts again",onClick:()=>je({type:"lens",lens:t,refresh:!0}),children:(0,c.jsx)("span",{className:"codicon codicon-refresh","aria-hidden":"true"})})]}),e.stats.length>0?(0,c.jsx)("dl",{className:"afd-lens-stats",children:e.stats.map(p=>(0,c.jsxs)("div",{children:[(0,c.jsx)("dd",{children:p.value}),(0,c.jsx)("dt",{children:p.label})]},p.label))}):null,e.notes.map(p=>(0,c.jsx)("p",{className:"muted afd-lens-note",children:p},p)),(0,c.jsxs)("section",{className:"afd-section",children:[(0,c.jsxs)("h3",{ref:a,tabIndex:-1,children:["Findings ",l>0?`(${l})`:""]}),e.findings.length===0?(0,c.jsx)("p",{className:"muted",children:"Nothing to report for this lens."}):(0,c.jsx)("ul",{className:"afd-findings",children:e.findings.map(p=>(0,c.jsx)(pE,{f:p,places:f,onFixed:h=>r(mE(e.findings,h.id)?.id??Cq)},p.id))})]})]})}function Tq(){let e=_(n=>n.accept),t=_(n=>n.setAccept);return e?(0,c.jsxs)(Nh,{id:"afd-accept",title:"Accept with Reason",placeholder:"e.g. The spines must drain while the edge switch reboots",submit:"Accept",target:e,record:n=>e.check&&e.node?Pe({kind:"acceptCheck",node:e.node,...e.check,reason:n}):Pe({kind:"acceptFinding",finding:e.id,node:e.node,reason:n}),close:()=>t(null),children:[(0,c.jsx)("strong",{children:e.title}),"."," ",e.check?"The problem stops showing for this node; the decision is recorded in the flow with your Git user name.":"The finding stays visible as expected; the decision is recorded in the flow with your Git user name."]}):null}function __(e){if(e===void 0)return"(none)";if(typeof e=="string")return e.length>80?`${e.slice(0,77)}\u2026`:e;let t=JSON.stringify(e);return t.length>80?`${t.slice(0,77)}\u2026`:t}function A_({id:e,side:t,chosen:n,value:r}){let a=t==="ours"?"Mine":"Theirs";return(0,c.jsxs)("button",{type:"button",className:n===t?"afd-merge-pick chosen":"afd-merge-pick","aria-pressed":n===t,title:`${a}: ${__(r)}`,onClick:()=>je({type:"mergeChoose",id:e,side:t}),children:[a,": ",(0,c.jsx)("span",{className:"afd-merge-value",children:__(r)})]})}function Mq(){let e=_(n=>n.merge);if(!e)return null;let t=e.conflicts.length;return(0,c.jsxs)("section",{className:"afd-merge-note","aria-label":"Merge","data-merge-conflicts":t,children:[(0,c.jsx)("strong",{children:"Merge:"})," ",t?`${t} place${t===1?"":"s"} both sides changed. Choose for each; the flow shows the choice at once.`:"Nothing to choose."," ",(0,c.jsx)("button",{type:"button",className:"link",onClick:()=>je({type:"mergeFinish"}),title:"Take the file as merged (git add)",children:"Finish merge"}),e.broken.length?(0,c.jsxs)("p",{className:"afd-merge-broken",children:["The merged flow breaks a rule neither side broke: ",e.broken.join("; ")]}):null,(0,c.jsx)("ul",{className:"afd-merge-list",children:e.conflicts.map(n=>(0,c.jsxs)("li",{"data-merge-conflict":n.id,children:[n.node?(0,c.jsx)("button",{type:"button",className:"link",onClick:()=>{let r=_.getState();n.node&&(r.reveal(n.node),r.setHighlight([n.node]))},children:n.label}):n.label," ",(0,c.jsx)(A_,{id:n.id,side:"ours",chosen:n.chosen,value:n.ours})," ",(0,c.jsx)(A_,{id:n.id,side:"theirs",chosen:n.chosen,value:n.theirs})]},n.id))})]})}function Oq({snapshot:e}){let t=e.file??"This file";return(0,c.jsxs)("div",{className:"afd-not-a-flow","data-not-a-flow":e.empty?"empty":"invalid",children:[(0,c.jsxs)("h1",{children:[(0,c.jsx)("span",{className:"codicon codicon-type-hierarchy","aria-hidden":"true"})," Ansible Flow Designer"]}),(0,c.jsxs)("p",{className:"muted",children:["Files named ",(0,c.jsx)("code",{children:"*.flow.yaml"})," open here, as a flow you design on a canvas."]}),e.empty?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsxs)("p",{children:[(0,c.jsx)("code",{children:t})," is empty. Create a flow in it: a start, an end and a"," ",(0,c.jsx)("code",{children:"devices"})," input for the target hosts, named after the file."]}),(0,c.jsxs)("div",{className:"afd-not-a-flow-actions",children:[(0,c.jsxs)("button",{type:"button",onClick:()=>je({type:"initFlow"}),children:[(0,c.jsx)("span",{className:"codicon codicon-add","aria-hidden":"true"})," Create a flow here"]}),(0,c.jsx)("button",{type:"button",className:"secondary",onClick:()=>je({type:"openText"}),children:"Open in Text Editor"})]})]}):(0,c.jsxs)(c.Fragment,{children:[(0,c.jsxs)("p",{role:"alert",children:[(0,c.jsx)("code",{children:t})," is not a flow document yet:"]}),(0,c.jsx)("pre",{className:"afd-not-a-flow-error",children:e.parseError}),(0,c.jsxs)("p",{className:"muted",children:["Fix it in the text editor, or start a new flow with ",(0,c.jsx)("em",{children:"Ansible Flow: New Flow\u2026"})," in the Command Palette."]}),(0,c.jsx)("div",{className:"afd-not-a-flow-actions",children:(0,c.jsx)("button",{type:"button",onClick:()=>je({type:"openText"}),children:"Open in Text Editor"})})]})]})}function Pq(){let e=_(r=>r.outside);if(!e)return null;let t=c5(e.since),n=p5(e);return(0,c.jsxs)("div",{className:"afd-outside-note",role:"status","data-outside-note":e.nodes.length,"data-outside-closed":e.closed?"true":void 0,children:[(0,c.jsx)("span",{className:"afd-swatch outside","aria-hidden":"true"})," ",(0,c.jsxs)("span",{children:[u5(e)," ",e.closed?`since you last had this flow open (${t}).`:`since you opened it (first at ${t}).`]})," ",e.nodes.length?(0,c.jsx)("button",{type:"button",className:"link",onClick:()=>{let r=_.getState(),a=e.nodes[0];a&&r.reveal(a),r.setHighlight(e.nodes)},children:"Show"}):null," ",(0,c.jsx)("button",{type:"button",className:"link",onClick:()=>{_.getState().setHighlight(null),je({type:"clearOutside"})},children:"Clear"}),n.length?(0,c.jsxs)("details",{className:"afd-outside-list",open:!0,"data-outside-list":n.length,children:[(0,c.jsxs)("summary",{children:["What changed (",n.length,")"]}),(0,c.jsx)("ul",{children:n.map(r=>(0,c.jsx)("li",{children:r.id?(0,c.jsx)("button",{type:"button",className:"link",onClick:()=>{let a=_.getState();r.id&&(a.reveal(r.id),a.setHighlight([r.id]))},children:r.text}):r.text},`${r.id??""}|${r.text}`))})]}):null]})}var Dq={rollback:"discard","notify-stop":"bell",retry:"refresh",exclude:"circle-slash"},Iq=Object.values(Hf).filter(e=>e.palette),T_="afd-dragging-pattern",M_=[{type:"task",icon:"symbol-event",hint:"One step: a module, role or playbook"},{type:"subflow",icon:"type-hierarchy-sub",hint:"A step with its own inner graph"},{type:"decision",icon:"git-compare",hint:"Route each host on a condition"},{type:"approval",icon:"pass",hint:"Wait for an approval"},{type:"parallel",icon:"split-horizontal",hint:"Send the hosts down several branches"},{type:"join",icon:"merge",hint:"Bring branches back together"},{type:"start",icon:"debug-start",hint:"Entry point of the flow"},{type:"end",icon:"debug-stop",hint:"Exit of the flow"}],O_=new Set(["task","subflow","decision","approval"]),Lq=[{kind:"note",label:"Note",icon:"note",hint:"A sticky note; drop it on a node to tie it"},{kind:"section",label:"Section",icon:"layout-panel",hint:"A titled region behind steps; moving it moves what is inside"},{kind:"text",label:"Text",icon:"text-size",hint:"A heading or caption"}];function Rq(){let e=_(m=>m.openQuickAdd),t=_(m=>m.mode==="run"),n=_(m=>!!m.snapshot?.doc&&Rt(m.snapshot.doc)<2),r=_(m=>m.paletteCollapsed),a=ph(),s=a.nodes.some(m=>Ks(m.node).some(b=>ha(b.name))),l=a.nodes.some(m=>m.node.type==="parallel"||m.node.type==="join"),{screenToFlowPosition:f}=Ts(),p=m=>{let b=document.querySelector(".react-flow")?.getBoundingClientRect(),w=b?f({x:b.left+b.width/2,y:b.top+b.height/3}):void 0;e({type:m,position:w})},h=(m,b)=>r?{"aria-label":m,title:`${m}: ${b}`}:{title:b},v=m=>(0,c.jsx)("li",{children:(0,c.jsxs)("button",{type:"button",draggable:!t,disabled:t,onDragStart:b=>{b.dataTransfer.setData(u$,m.type),b.dataTransfer.effectAllowed="copy"},onClick:()=>f8(m.type)||p(m.type),...h(yo[m.type],m.hint),children:[(0,c.jsx)("span",{className:`codicon codicon-${m.icon}`,"aria-hidden":"true"}),r?null:yo[m.type]]})},m.type),g=(0,c.jsxs)(c.Fragment,{children:[r?null:(0,c.jsxs)("h2",{children:["Failure patterns ",(0,c.jsx)(Sa,{topic:"patterns",about:"failure patterns"})]}),(0,c.jsx)("p",{className:`afd-palette-hint muted${r?" afd-sr-only":""}`,id:"afd-pattern-hint",children:"Drop onto an open fail port, or select a node and click"}),(0,c.jsx)("ul",{className:"afd-palette",children:Iq.map(m=>(0,c.jsx)("li",{children:(0,c.jsxs)("button",{type:"button",draggable:!t,disabled:t,"data-pattern":m.id,"aria-describedby":"afd-pattern-hint",onDragStart:b=>{b.dataTransfer.setData(c$,m.id),b.dataTransfer.effectAllowed="copy",document.body.classList.add(T_)},onDragEnd:()=>document.body.classList.remove(T_),onClick:()=>{let b=_.getState().selection.node;b?H$(m.id,b):_.getState().setError("Select a node first, or drag the pattern onto a port")},...h(m.label,`${m.hint}. Accepts: ${m.accepts.join(", ")}`),children:[(0,c.jsx)("span",{className:`codicon codicon-${Dq[m.id]??"symbol-event"}`,"aria-hidden":"true"}),r?null:m.label]})},m.id))})]});return(0,c.jsxs)("aside",{className:`afd-left${r?" collapsed":""}`,"aria-label":"Palette",children:[(0,c.jsxs)("div",{className:"afd-palette-head",children:[r?null:(0,c.jsx)("h2",{children:"Nodes"}),(0,c.jsx)("button",{type:"button",className:"icon","aria-label":r?"Expand Palette":"Collapse Palette","aria-expanded":!r,title:r?"Show the names":"Icons only, for a wider canvas",onClick:()=>_.getState().setPaletteCollapsed(!r),children:(0,c.jsx)("span",{className:`codicon codicon-chevron-${r?"right":"left"}`,"aria-hidden":"true"})})]}),t?(0,c.jsx)("p",{className:"afd-palette-hint muted",children:"Run mode is read-only"}):null,(0,c.jsx)("ul",{className:"afd-palette",children:M_.filter(m=>r||O_.has(m.type)).map(v)}),r?null:(0,c.jsx)(jr,{id:"palette-more",open:l,summary:"More node types",children:(0,c.jsx)("ul",{className:"afd-palette",children:M_.filter(m=>!O_.has(m.type)).map(v)})}),s?g:null,r?null:(0,c.jsx)("h2",{children:"Annotate"}),(0,c.jsx)("ul",{className:"afd-palette","aria-label":"Annotate",children:Lq.map(m=>(0,c.jsx)("li",{children:(0,c.jsxs)("button",{type:"button",draggable:!t&&!n,disabled:t||n,"data-annotation-kind":m.kind,onDragStart:b=>{b.dataTransfer.setData(f$,m.kind),b.dataTransfer.effectAllowed="copy"},onClick:()=>{let b=document.querySelector(".react-flow")?.getBoundingClientRect(),w=b?f({x:b.left+b.width/2,y:b.top+b.height/2}):void 0,k=_.getState().selection,S=m.kind==="note"?k.node:void 0,N=[...k.nodes??(k.node?[k.node]:[]),...k.annotations??[]];Yd(m.kind,w,S,{near:!0,...m.kind==="section"&&N.length?{around:N}:{}})},...h(m.label,n?"Annotations need flow format 2: Upgrade Flow Format":m.hint),children:[(0,c.jsx)("span",{className:`codicon codicon-${m.icon}`,"aria-hidden":"true"}),r?null:m.label]})},m.kind))}),(0,c.jsx)(zq,{collapsed:r})]})}function zq({collapsed:e}){let[t,n]=(0,A.useState)(!1),r=(0,A.useRef)(null),a=(0,A.useRef)(null);(0,A.useEffect)(()=>{if(!t)return;a.current?.focus();let l=f=>{let p=f.target;!a.current?.contains(p)&&!r.current?.contains(p)&&n(!1)};return document.addEventListener("pointerdown",l,!0),()=>document.removeEventListener("pointerdown",l,!0)},[t]);let s=()=>{n(!1),r.current?.focus()};return(0,c.jsxs)("div",{className:"afd-legend-wrap",children:[(0,c.jsxs)("button",{ref:r,type:"button",className:"secondary afd-legend-button","aria-expanded":t,"aria-controls":"afd-legend","aria-label":"Legend",title:"What the port and wire styles mean",onClick:()=>t?s():n(!0),onKeyDown:l=>{l.key==="Escape"&&t&&(l.stopPropagation(),s())},children:[(0,c.jsx)("span",{className:"codicon codicon-question","aria-hidden":"true"}),e?null:" Legend"]}),t?(0,c.jsxs)("div",{ref:a,id:"afd-legend",className:"afd-legend-popover",role:"dialog","aria-label":"Legend",tabIndex:-1,onKeyDown:l=>{l.key==="Escape"&&(l.stopPropagation(),s())},children:[(0,c.jsxs)("ul",{className:"afd-legend",children:[(0,c.jsxs)("li",{children:[(0,c.jsx)("span",{className:"afd-swatch port state-connected tone-ok"})," Connected port"]}),(0,c.jsxs)("li",{children:[(0,c.jsx)("span",{className:"afd-swatch port state-open-fail tone-failed"})," Open fail port (wire it or accept it)"]}),(0,c.jsxs)("li",{children:[(0,c.jsx)("span",{className:"afd-swatch port state-open-purpose tone-failed"})," Open on purpose"]}),(0,c.jsxs)("li",{children:[(0,c.jsx)("span",{className:"afd-swatch port state-open tone-ok optional"})," Optional port, shown on hover"]}),(0,c.jsxs)("li",{children:[(0,c.jsx)("span",{className:"afd-swatch wire"})," Normal outcome"]}),(0,c.jsxs)("li",{children:[(0,c.jsx)("span",{className:"afd-swatch wire problem"})," Problem path"]}),(0,c.jsxs)("li",{children:[(0,c.jsx)("span",{className:"afd-swatch outside"})," Changed outside the designer (dashed)"]})]}),(0,c.jsx)("p",{className:"muted",children:"Hosts travel along wires, from port to port:"}),(0,c.jsx)("dl",{className:"afd-legend-ports",children:l6.map(l=>(0,c.jsxs)("div",{children:[(0,c.jsx)("dt",{className:"mono",children:l}),(0,c.jsx)("dd",{children:ka(l)})]},l))})]}):null]})}var P_={to:"Click the node to wire",rewire:"Click the new target of",from:"Click the node that feeds",attach:"Click the node this note is about"};function Fq(){let e=_(f=>f.pick),t=_(f=>f.snapshot),n=_(f=>f.setPick),r=_(f=>f.pickAt);if(!e)return null;let a=t?.doc,s=f=>(a&&$e(a).nodes.get(f)?.node.title)??f,l=s(e.ref.node);return(0,c.jsxs)("div",{className:"afd-banner info",role:"status","data-pick":e.mode,children:[(0,c.jsx)("span",{className:"codicon codicon-target","aria-hidden":"true"}),(0,c.jsx)("span",{children:e.mode==="attach"?P_.attach:(0,c.jsxs)(c.Fragment,{children:[P_[e.mode]," ",(0,c.jsx)("strong",{children:l})," \xB7"," ",(0,c.jsx)("span",{className:"mono",children:e.ref.port})]})}),(0,c.jsx)("span",{className:"muted","data-pick-at":r??void 0,children:r?(0,c.jsxs)(c.Fragment,{children:["Enter: ",(0,c.jsx)("strong",{children:s(r)})," \xB7 Esc to cancel"]}):"Tab or the arrow keys choose a node \xB7 Esc to cancel"}),(0,c.jsx)("button",{type:"button",className:"link",onClick:()=>n(null),children:"Cancel"})]})}function Bq(){let e=_(s=>s.portMenu),t=_(s=>s.snapshot),n=_(s=>s.openPortMenu),r=(0,A.useMemo)(()=>e&&t?.doc?Id($e(t.doc),e.ref):void 0,[e,t]);if(!e||!r)return null;let a=(t?.doc?.decisions??[]).find(s=>s?.node===e.ref.node&&s.port===e.ref.port)?.reason;return(0,c.jsx)(Mh,{x:e.x,y:e.y,label:`${r.node.title} \xB7 ${e.ref.port}`,className:"afd-port-menu",data:{"data-port-menu":`${e.ref.node}|${e.ref.port}`},onClose:()=>n(null),header:(0,c.jsxs)(c.Fragment,{children:[(0,c.jsxs)("div",{className:"afd-port-menu-head",children:[(0,c.jsxs)("span",{children:[(0,c.jsx)("strong",{children:r.node.title})," \xB7 ",(0,c.jsx)("span",{className:"mono",children:e.ref.port})]}),(0,c.jsx)("button",{type:"button",className:"icon","aria-label":"Close menu",onClick:()=>n(null),children:(0,c.jsx)("span",{className:"codicon codicon-close","aria-hidden":"true"})})]}),ka(e.ref.port,r.node.type)?(0,c.jsx)("p",{className:"afd-port-menu-note muted",children:ka(e.ref.port,r.node.type)}):null,a?(0,c.jsxs)("p",{className:"afd-port-menu-note",children:["Open on purpose: ",a]}):null]}),items:r.items.map(s=>({type:"item",label:s.label,...s.kind==="later"?{disabled:s.hint}:{},title:"hint"in s?s.hint:void 0,onSelect:()=>{ol(s,e.ref)}}))})}var du=8;function qq(){let e=_(v=>v.preview),t=_(v=>v.snapshot),n=_(v=>v.run),r=_(v=>v.setPreview),a=_(v=>v.setLevel),s=(0,A.useRef)(null),[l,f]=(0,A.useState)(null),p=(0,A.useMemo)(()=>e&&t?.doc?p6(t.doc,e.node,n):void 0,[e,t,n]);if((0,A.useLayoutEffect)(()=>{if(!e||!s.current){f(null);return}let{width:v,height:g}=s.current.getBoundingClientRect(),m=e.x+v+du>window.innerWidth?e.left-v-du:e.x,b=Math.min(e.y,window.innerHeight-g-du);f({left:Math.max(du,m),top:Math.max(du,b)})},[e]),!e||!p)return null;let{node:h}=p;return(0,c.jsxs)("div",{ref:s,className:"afd-preview",role:"dialog","aria-label":`Preview of ${h.title}`,"data-preview":h.id,style:l?{left:l.left,top:l.top}:{visibility:"hidden"},onMouseEnter:()=>_.getState().holdPreview(!0),onMouseLeave:()=>_.getState().holdPreview(!1),children:[(0,c.jsxs)("header",{className:"afd-preview-head",children:[(0,c.jsxs)("div",{children:[(0,c.jsx)("strong",{children:h.title}),(0,c.jsx)("div",{className:"mono muted",children:p.binding??p.subtitle})]}),h.status?(0,c.jsx)("span",{className:`afd-chip status-${h.status}`,children:h.status}):null]}),p.steps.length>0?(0,c.jsxs)("section",{children:[(0,c.jsxs)("h4",{children:["Inside",n?.state==="done"?" \xB7 last run":""]}),(0,c.jsx)("ol",{className:"afd-preview-steps",children:p.steps.map(v=>(0,c.jsxs)("li",{"data-preview-step":v.id,children:[(0,c.jsxs)("span",{className:"afd-preview-step-title",children:[v.title,v.entry?(0,c.jsx)("span",{className:"afd-chip",children:"entry"}):null,v.badges.map(g=>(0,c.jsx)("span",{className:"afd-chip",children:g},g))]}),v.exits.map(g=>(0,c.jsxs)("span",{className:"afd-preview-exit","data-exit":g.port,children:["\u2192 ",g.port,g.reason?` \xB7 ${g.reason}`:""]},g.port)),v.run?(0,c.jsx)("span",{className:"muted afd-preview-run",children:v.run}):null]},v.id))})]}):null,(0,c.jsxs)("dl",{className:"afd-preview-facts",children:[!p.hasInner&&p.run?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("dt",{children:"Last run"}),(0,c.jsx)("dd",{children:p.run})]}):null,p.undo?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("dt",{children:"Undo"}),(0,c.jsx)("dd",{className:"mono",children:p.undo})]}):null,p.settings.length>0?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("dt",{children:"Settings"}),(0,c.jsx)("dd",{children:p.settings.join(" \xB7 ")})]}):null]}),(0,c.jsxs)("footer",{className:"afd-preview-actions",children:[h.type==="subflow"?(0,c.jsx)("span",{className:"muted",children:"Double-click or Enter to open"}):(0,c.jsx)("span",{}),h.type==="subflow"?(0,c.jsx)("button",{type:"button",onClick:()=>{r(null),a(h.id)},children:"Open Subflow"}):null]})]})}async function uu(e){let t=await gf(e);return t.ok||_.getState().setError(t.error??"The scenarios file did not change"),t.ok}function Hq(e){let t=Math.max(0,Math.round((Date.now()-Date.parse(e))/1e3));return Number.isFinite(t)?t<60?"just now":t<3600?`${Math.round(t/60)} min ago`:t<86400?`${Math.round(t/3600)} h ago`:new Date(e).toLocaleDateString():e}function Vq({close:e}){let t=_(p=>p.scenarioCheck),n=_(p=>p.snapshot?.doc),r=_(p=>p.editScenario),[a,s]=(0,A.useState)(()=>W7(t)),[l,f]=(0,A.useState)(3);return(0,c.jsxs)("form",{className:"afd-section afd-scenario-new",onSubmit:async p=>{p.preventDefault();let h=a.trim();h&&n&&await uu({kind:"add",scenario:U7(n,h,l)})&&(e(),r(h))},"data-scenario-new":!0,children:[(0,c.jsx)("h3",{children:"New Scenario"}),(0,c.jsxs)("div",{className:"afd-field",children:[(0,c.jsx)("label",{htmlFor:"afd-scenario-name",children:"Name"}),(0,c.jsx)("input",{id:"afd-scenario-name",className:"afd-input",value:a,autoFocus:!0,onChange:p=>s(p.target.value)})]}),(0,c.jsxs)("div",{className:"afd-field",children:[(0,c.jsx)("label",{htmlFor:"afd-scenario-hosts",children:"Hosts"}),(0,c.jsx)("input",{id:"afd-scenario-hosts",className:"afd-input",type:"number",min:1,max:50,value:l,onChange:p=>f(Number(p.target.value)||1)}),(0,c.jsxs)("p",{className:"muted",children:[N_(l).join(", "),": names only, they run on this machine with every step as its stub."]})]}),(0,c.jsx)("p",{className:"muted",children:"It starts with every host where the flow sends it now. Then plant failures: right-click a step on the canvas."}),(0,c.jsxs)("div",{className:"afd-modal-actions",children:[(0,c.jsx)("button",{type:"button",className:"secondary",onClick:e,children:"Cancel"}),(0,c.jsx)("button",{type:"submit",disabled:!a.trim(),children:"Add Scenario"})]})]})}function Kq({name:e,close:t}){let[n,r]=(0,A.useState)(e),a=_(l=>l.editScenario),s=_(l=>l.scenarioEditing);return(0,c.jsxs)("form",{className:"afd-inline-form",onSubmit:async l=>{if(l.preventDefault(),!n.trim()||n===e)return t();await uu({kind:"rename",name:e,to:n.trim()})&&(s===e&&a(n.trim()),t())},children:[(0,c.jsx)("input",{className:"afd-input","aria-label":`New name for ${e}`,value:n,autoFocus:!0,onChange:l=>r(l.target.value),onKeyDown:l=>{l.key==="Escape"&&(l.stopPropagation(),t())}}),(0,c.jsx)("button",{type:"submit",children:"Rename"})]})}function Wq(){let e=_(b=>b.snapshot?.doc),t=_(b=>b.scenarioCheck),n=_(b=>b.scenarioUndo),r=_(b=>b.scenarioEditing),a=_(b=>b.editScenario),s=_(b=>b.closeScenarios),[l,f]=(0,A.useState)(!1),[p,h]=(0,A.useState)(null);if(!e)return null;let v=t?K7(e,t):[],g=t?FC(t.problems):[],m=v.filter(b=>b.verdict!=="pass").length;return(0,c.jsxs)("div",{className:"afd-panel-body","data-scenarios-panel":v.length,children:[(0,c.jsxs)("h2",{className:"afd-panel-title",children:["Scenarios ",(0,c.jsx)(Sa,{topic:"scenarios",about:"scenario tests"}),(0,c.jsx)("button",{type:"button",className:"icon afd-tab-close","aria-label":"Close the Scenarios tab",title:"Close the Scenarios tab (the chip in the top bar opens it again)",onClick:s,children:(0,c.jsx)("span",{className:"codicon codicon-close","aria-hidden":"true"})})]}),(0,c.jsx)("p",{className:"muted",children:"Where each host must end when chosen steps fail. Checked in a simulation as you change the flow; Verify in Ansible runs them for real, every step as its stub."}),(0,c.jsxs)("div",{className:"afd-row-actions",children:[(0,c.jsxs)("button",{type:"button",onClick:()=>f(!0),disabled:l,children:[(0,c.jsx)("span",{className:"codicon codicon-add","aria-hidden":"true"})," New Scenario"]}),v.length?(0,c.jsxs)("button",{type:"button",className:"secondary",onClick:()=>je({type:"runScenarios"}),title:"Run every scenario in the run environment, every step as its stub",children:[(0,c.jsx)("span",{className:"codicon codicon-play","aria-hidden":"true"})," Verify All in Ansible"]}):null,n?(0,c.jsxs)("button",{type:"button",className:"secondary","data-scenario-undo":n,onClick:async()=>{let b=await eR();b.ok||_.getState().setError(b.error??"Nothing to undo")},title:"Take back the last change to the scenarios made here",children:[(0,c.jsx)("span",{className:"codicon codicon-discard","aria-hidden":"true"})," Undo"]}):null,t?.file?(0,c.jsx)("button",{type:"button",className:"link",onClick:()=>je({type:"openScenarios"}),title:"The scenarios file in the text editor",children:"Open File"}):null]}),l?(0,c.jsx)(Vq,{close:()=>f(!1)}):null,t?.error||g.length?(0,c.jsxs)("section",{className:"afd-section tone-error","data-scenarios-errors":g.length||1,children:[(0,c.jsx)("h3",{children:"The file does not fit the flow"}),(0,c.jsxs)("ul",{children:[t?.error?(0,c.jsx)("li",{children:t.error}):null,g.map(b=>(0,c.jsx)("li",{children:b.message},`${b.scenario}:${b.path.join(".")}:${b.message}`))]}),(0,c.jsx)("p",{className:"muted",children:"Fix it in the file (Open File); Problems lists the same."})]}):null,r?(0,c.jsxs)("p",{className:"afd-scenario-editing","data-scenario-editing":r,children:["On the canvas: ",(0,c.jsx)("strong",{children:r}),", simulated. Right-click a step to make it fail for chosen hosts."," ",(0,c.jsx)("button",{type:"button",className:"link",onClick:()=>a(null),children:"Done"})]}):null,v.length===0&&!l?(0,c.jsx)("p",{className:"muted","data-scenarios-empty":!0,children:"No scenarios yet. A scenario names some hosts, plants a failure or two, and says where each host must end, so a later change to the flow cannot quietly send them elsewhere."}):null,v.length?(0,c.jsxs)("h3",{className:"afd-subtitle",children:[m?`${m} of ${v.length} failing`:`All ${v.length} pass`," ",(0,c.jsx)("span",{className:"muted",children:"(simulated)"})]}):null,(0,c.jsx)("ul",{className:"afd-scenario-list",children:v.map(b=>(0,c.jsxs)("li",{className:`afd-scenario tone-${b.verdict==="pass"?"ok":b.verdict==="fail"?"warn":"error"}${r===b.name?" active":""}`,"data-scenario":b.name,"data-verdict":b.verdict,children:[p===b.name?(0,c.jsx)(Kq,{name:b.name,close:()=>h(null)}):(0,c.jsxs)("div",{className:"afd-scenario-head",children:[(0,c.jsx)("span",{className:"afd-scenario-verdict",children:b.verdict==="pass"?"pass":b.verdict==="fail"?"fail":"cannot tell"}),(0,c.jsx)("strong",{children:b.name}),(0,c.jsxs)("span",{className:"muted",children:[" \xB7 ",b.hosts.length," hosts"]})]}),b.planted.length?(0,c.jsx)("p",{className:"muted","data-scenario-planted":!0,children:b.planted.join("; ")}):null,b.error?(0,c.jsx)("p",{className:"tone-error",children:b.error}):null,b.misses.length?(0,c.jsx)("ul",{className:"afd-scenario-misses","data-scenario-misses":b.misses.length,children:b.misses.map(w=>(0,c.jsx)("li",{children:w},w))}):null,b.bestEffort.length?(0,c.jsxs)("p",{className:"muted","data-scenario-best-effort":!0,title:b.bestEffort.join(`
|
|
201
|
+
`),children:["Simulated as a best effort: ",b.bestEffort[0],". Verify it in Ansible."]}):null,b.verified?(0,c.jsxs)("p",{className:"muted","data-scenario-verified":b.verified.stale?"stale":"current",children:["Ansible: ",b.verified.passed?"passed":"failed"," ",Hq(b.verified.at),b.verified.stale?" \xB7 out of date: the flow or the scenario changed since":""]}):null,(0,c.jsxs)("div",{className:"afd-row-actions",children:[(0,c.jsx)("button",{type:"button",className:r===b.name?"":"secondary","aria-pressed":r===b.name,onClick:()=>a(r===b.name?null:b.name),title:"Show this scenario's simulation on the canvas, and plant outcomes there",children:"Show on Canvas"}),b.verdict==="fail"?(0,c.jsx)("button",{type:"button",className:"secondary","data-accept-ends":!0,onClick:()=>{uu({kind:"acceptEnds",name:b.name})},title:"Expect each host where the flow now sends it",children:"Accept New Ends"}):null,(0,c.jsx)("button",{type:"button",className:"secondary",onClick:()=>je({type:"runScenarios",names:[b.name]}),title:"Run this scenario in the run environment, every step as its stub",children:"Verify in Ansible"}),(0,c.jsx)("button",{type:"button",className:"link",onClick:()=>h(b.name),children:"Rename"}),(0,c.jsx)("button",{type:"button",className:"link",onClick:()=>{uu({kind:"duplicate",name:b.name,to:`${b.name} (copy)`})},children:"Duplicate"}),(0,c.jsx)("button",{type:"button",className:"link",onClick:async()=>{await uu({kind:"delete",name:b.name})&&r===b.name&&a(null)},children:"Delete"})]})]},b.name))})]})}function Uq({ids:e}){let t=_($=>$.snapshot),n=_($=>$.select),[r,a]=(0,A.useState)(""),[s,l]=(0,A.useState)(null),[f,p]=(0,A.useState)(!1),h=(0,A.useRef)(null);R$("extractTitle",h);let v=wa(),g=_($=>$.mode),m=t?.doc;if(!m)return null;let b=$e(m),w=e.map($=>b.nodes.get($)?.node).filter($=>!!$),k=r.trim()||"Subflow",S=w.map($=>m.layout?.[$.id]??t?.autoPositions[$.id]).filter($=>!!$),N=async()=>{p(!0),l(null);let{optimistic:$,level:j}=_.getState(),E=t?xa(cn(t,$,j),m.layout):{},I=await la({kind:"extractSubflow",nodes:e,title:k,...S.length>0?{position:{x:Math.min(...S.map(z=>z.x)),y:Math.min(...S.map(z=>z.y))}}:{},...Object.keys(E).length>0?{freeze:E}:{}});p(!1),I.ok?I.created&&n({node:I.created}):l(I.error??"The nodes could not be extracted")};return(0,c.jsxs)("div",{className:"afd-panel-body","data-selection-panel":w.length,children:[(0,c.jsxs)("h2",{className:"afd-panel-title",children:[w.length," node",w.length===1?"":"s"," selected"]}),(0,c.jsx)("ul",{className:"afd-selection-list",children:w.map($=>(0,c.jsxs)("li",{children:[$.title," ",(0,c.jsx)("span",{className:"mono muted",children:$.key})]},$.id))}),v&&g==="design"?(0,c.jsxs)("section",{className:"afd-section","data-arrange":!0,children:[(0,c.jsx)("h3",{children:"Arrange"}),(0,c.jsxs)("div",{className:"afd-arrange",children:[(0,c.jsxs)("button",{type:"button",title:`Line them up on the flow line (${Na("alignCenter")})`,onClick:()=>{dv("center",e)},children:[(0,c.jsx)("span",{className:"codicon codicon-layout-centered","aria-hidden":"true"})," Align Centers"]}),(0,c.jsxs)("button",{type:"button",disabled:w.length<3,title:w.length<3?"Select three steps or more":`Equal gaps, top to bottom (${Na("distribute")})`,onClick:()=>{uv("vertical",e)},children:[(0,c.jsx)("span",{className:"codicon codicon-list-flat","aria-hidden":"true"})," Distribute Vertically"]}),w.some($=>m.layout?.[$.id])?(0,c.jsx)("button",{type:"button",className:"secondary",title:"Let the canvas place them again",onClick:()=>{v_(e)},children:"Reset Position"}):null]}),(0,c.jsx)("p",{className:"muted",children:"The selection's menu (right-click) also aligns left, right, top, middle or bottom edges and spaces them across. One undo puts them back."})]}):null,(0,c.jsxs)("section",{className:"afd-section",children:[(0,c.jsx)("p",{className:"muted",children:"Copy takes the nodes, the wires between them and their layout as text: paste them on any flow canvas, or keep them in a text file as a snippet."}),(0,c.jsxs)("button",{type:"button",onClick:()=>Kd(),children:[(0,c.jsx)("span",{className:"codicon codicon-copy","aria-hidden":"true"})," Copy nodes"]})]}),(0,c.jsxs)("section",{className:"afd-section",children:[(0,c.jsx)("h3",{children:"Extract into Subflow"}),(0,c.jsx)("p",{className:"muted",children:"The nodes and the wires between them move into a new subflow, with their IDs. Wires into the selection must reach one node; wires out leave through the subflow's ports."}),(0,c.jsxs)("label",{className:"afd-field",children:[(0,c.jsx)("span",{className:"afd-label",children:"Title"}),(0,c.jsx)("input",{ref:h,type:"text",value:r,placeholder:"Subflow",onChange:$=>a($.target.value),onKeyDown:$=>{$.key==="Enter"&&!f&&N()}})]}),(0,c.jsxs)("p",{className:"muted",children:["Key ",(0,c.jsx)("span",{className:"mono",children:LC(k,"subflow")})]}),(0,c.jsxs)("button",{type:"button",disabled:f,onClick:()=>{N()},children:[(0,c.jsx)("span",{className:"codicon codicon-type-hierarchy-sub","aria-hidden":"true"})," Extract into Subflow"]}),s?(0,c.jsxs)("p",{className:"afd-run-warning",role:"alert","data-extract-error":!0,children:[(0,c.jsx)("span",{className:"codicon codicon-warning","aria-hidden":"true"})," ",s]}):null]})]})}function Yq(){let e=_(a=>a.testedReason),t=_(a=>a.snapshot?.doc),n=_(a=>a.setTestedReason);if(!e)return null;let r=t?$e(t).nodes.get(e)?.node:void 0;return(0,c.jsxs)(Nh,{id:"afd-tested",title:"Mark Tested",placeholder:"e.g. Ran by hand on sw-lab-01 with the same parameters",submit:"Mark Tested",target:e,record:a=>Pe({kind:"markTested",id:e,reason:a}),close:()=>n(null),children:[(0,c.jsx)("strong",{children:r?.title??e})," counts as tested without a passing run of this flow. A passing real run marks nodes tested by itself (Run mode); here, say why. The reason is recorded in the flow with your Git user name, and goes when the node's design changes."]})}var Xq={info:"info",success:"pass",error:"error"};function Zq(){let e=_(n=>n.toasts),t=_(n=>n.dismissToast);return(0,c.jsxs)("div",{className:"afd-toasts","aria-live":"polite",children:[(0,c.jsx)(Gq,{}),e.map(n=>(0,c.jsxs)("div",{className:`afd-toast level-${n.level}`,role:n.level==="error"?"alert":"status","data-toast":n.level,children:[(0,c.jsx)("span",{className:`codicon codicon-${Xq[n.level]}`,"aria-hidden":"true"}),(0,c.jsx)("span",{className:"afd-toast-text",children:n.text}),(0,c.jsx)("button",{type:"button",className:"icon","aria-label":"Close message",title:"Close",onClick:()=>t(n.id),children:(0,c.jsx)("span",{className:"codicon codicon-close","aria-hidden":"true"})})]},n.id))]})}function Gq(){let e=_(r=>r.saving),[t,n]=(0,A.useState)(!1);return(0,A.useEffect)(()=>{if(!e){n(!1);return}let r=setTimeout(()=>n(!0),250);return()=>clearTimeout(r)},[e]),t?(0,c.jsxs)("div",{className:"afd-toast afd-saving",role:"status","data-saving":!0,children:[(0,c.jsx)("span",{className:"codicon codicon-loading codicon-modifier-spin","aria-hidden":"true"}),(0,c.jsx)("span",{className:"afd-toast-text",children:"Saving\u2026"})]}):null}function hv({label:e,children:t,items:n,className:r,title:a,disabled:s}){let l=(0,A.useRef)(null),[f,p]=(0,A.useState)(null),h=()=>{let v=l.current?.getBoundingClientRect();v&&p({x:v.left,y:v.bottom+2})};return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("button",{ref:l,type:"button",className:r,"aria-label":e,"aria-haspopup":"menu","aria-expanded":f!==null,title:a,disabled:s,onClick:()=>f?p(null):h(),onKeyDown:v=>{v.key==="ArrowDown"&&(v.preventDefault(),h())},children:t}),f?(0,c.jsx)(Mh,{x:f.x,y:f.y,label:e,items:n(),opener:l.current,onClose:()=>p(null)}):null]})}function Qq(){let e=_(b=>b.snapshot?.doc),t=e?.flow,n=_(b=>b.level),r=_(b=>b.setLevel),a=e?M5(e,n):[],s=e?O5(e,n):[],l=_(b=>b.run),f=l?.state==="running",p=_(b=>b.snapshot?.findings.filter(w=>w.severity==="error").length??0),h=_(b=>b.mode),v=_(b=>b.viewer),g=_(b=>b.lens),m=_(b=>b.setLens);return(0,c.jsxs)("header",{className:"afd-topbar",children:[(0,c.jsxs)("nav",{className:"afd-breadcrumb","aria-label":"Breadcrumb",children:[n==="root"?null:(0,c.jsxs)("button",{type:"button",className:"secondary afd-back",onClick:()=>r(a.at(-2)?.id??"root"),title:"Back to the enclosing level",children:[(0,c.jsx)("span",{className:"codicon codicon-arrow-left","aria-hidden":"true"})," Back"]}),a.map((b,w)=>(0,c.jsxs)("span",{className:"afd-crumb",children:[w>0?(0,c.jsx)("span",{className:"muted",children:"/"}):null,w<a.length-1?(0,c.jsx)("button",{type:"button",className:"link",onClick:()=>r(b.id),children:w===0?t?.name??"Untitled flow":b.title}):(0,c.jsx)("span",{className:"afd-flow-name","aria-current":"location",children:w===0?t?.name??"Untitled flow":b.title})]},b.id)),s.map(b=>(0,c.jsx)("span",{className:`afd-chip afd-context${b.applied?"":" muted"}`,title:b.title,"data-applied":b.applied,children:b.label},b.label)),t?(0,c.jsxs)("span",{className:"afd-chip mono",title:"Flow key and version",children:[t.key," \xB7 v",t.version]}):null,v?null:(0,c.jsx)(Jq,{})]}),(0,c.jsx)("fieldset",{className:"afd-segmented","aria-label":"Mode",style:v?{display:"none"}:void 0,children:cv.map(b=>(0,c.jsx)("button",{type:"button",className:b.id===h?"active":"","aria-pressed":b.id===h,disabled:!!b.soon,onClick:()=>XC(b.id),title:b.soon?`${b.label} mode arrives in ${b.soon}`:`${b.hint} (${vo?"\u2325":"Alt+"}${cv.indexOf(b)+1})`,children:b.label},b.id))}),v?null:g||e?.nodes?.some(b=>b?.type!=="start"&&b?.type!=="end")?(0,c.jsx)(eH,{lens:g,pick:b=>{m(b),je({type:"lens",lens:b})}}):null,(0,c.jsxs)("div",{className:"afd-actions",children:[(0,c.jsx)(lH,{run:l}),(0,c.jsx)(aH,{running:f,viewer:v}),v?null:(0,c.jsx)(iH,{icon:"file-code",label:"Generate Code",title:"Write the playbooks in generated/ now",unavailable:p>0?`Fix the ${p} error${p===1?"":"s"} first (see Problems)`:void 0,onClick:()=>je({type:"generate"})}),(0,c.jsx)(hv,{label:"More actions",className:"secondary icon",title:"More actions",items:()=>v?oH():nH(h,n),children:(0,c.jsx)("span",{className:"codicon codicon-ellipsis","aria-hidden":"true"})})]})]})}function Jq(){let e=_(r=>r.scenarioCheck),t=_(r=>r.openScenarios);if(!_(r=>r.snapshot?.doc?.nodes?.some(a=>a?.type!=="start"&&a?.type!=="end"))&&!e?.file)return null;let n=q7(e);return(0,c.jsxs)("button",{type:"button",className:`afd-chip afd-scenario-chip tone-${n.tone}`,title:n.title,"data-scenario-chip":n.tone,onClick:t,children:[(0,c.jsx)("span",{className:"codicon codicon-beaker","aria-hidden":"true"})," ",n.label]})}function eH({lens:e,pick:t}){let n=sa.find(r=>r.id===e);return(0,c.jsxs)("div",{className:"afd-lens-pick",children:[(0,c.jsxs)(hv,{label:n?`Lens: ${n.label}`:"Lens: none",className:`secondary${n?" afd-lens-on":""}`,title:"Lenses show chips, wires and findings across the flow",items:()=>[{type:"item",label:"None",checked:e===null,title:"No lens: the mode decides what nodes show",onSelect:()=>t(null)},{type:"separator"},...sa.map(r=>({type:"item",label:r.label,checked:r.id===e,title:r.hint,onSelect:()=>t(r.id)}))],children:[(0,c.jsx)("span",{className:"codicon codicon-eye","aria-hidden":"true"})," ",n?`Lens: ${n.label}`:"Lens"," ",(0,c.jsx)("span",{className:"codicon codicon-chevron-down","aria-hidden":"true"})]}),n?(0,c.jsx)("button",{type:"button",className:"icon","aria-label":"Clear lens",title:"Clear lens",onClick:()=>t(null),children:(0,c.jsx)("span",{className:"codicon codicon-close","aria-hidden":"true"})}):null]})}function tH(e){return e==="run"?"Run mode only reads: switch to Design to change the flow":e==="code"?"The graph is read-only in Code mode (bindings stay editable): switch to Design":void 0}function D_(e){let t=_.getState(),n={type:"item",label:t.panelCollapsed?"Show Side Panel":"Hide Side Panel",icon:"layout-sidebar-right",onSelect:()=>t.setPanelCollapsed(!t.panelCollapsed)},r={type:"item",label:t.annotationsHidden?"Show Annotations":"Hide Annotations",icon:"note",title:"Notes, sections and text on the canvas",onSelect:()=>t.setAnnotationsHidden(!t.annotationsHidden)};if(e!=="design")return[n,r];let a=t.firstFlow?.hidden??!1,s={type:"item",label:a?"Show First-Flow Checklist":"Hide First-Flow Checklist",icon:"checklist",title:"Four things that make a first flow, on flows with one to five steps",onSelect:()=>je({type:"firstFlow",hidden:!a})};return[{type:"item",label:t.paletteCollapsed?"Expand Palette":"Collapse Palette",icon:"layout-sidebar-left",onSelect:()=>t.setPaletteCollapsed(!t.paletteCollapsed)},n,r,s]}function nH(e,t){return[{type:"item",label:"Tidy Up",icon:"layout",title:"Lay out the whole level again",disabled:tH(e),onSelect:()=>je({type:"tidyUp",level:t})},{type:"item",label:"Open in Text Editor",icon:"go-to-file",title:"Open the flow file in the text editor",onSelect:()=>je({type:"openText"})},{type:"item",label:"Check Flow",icon:"check-all",title:"Check the design, then the generated code in the Ansible environment",onSelect:()=>je({type:"validate"})},{type:"item",label:"Find Node\u2026",icon:"search",shortcut:Na("find"),title:"Find a node on any level by title, key or binding",onSelect:()=>_.getState().openFind(!0)},...rH(t),{type:"separator"},...D_(e),{type:"separator"},{type:"item",label:"Keyboard Shortcuts",icon:"keyboard",shortcut:"?",onSelect:()=>_.getState().showCheatSheet(!0)},{type:"item",label:"User Guide",icon:"book",title:"Tutorials and how-to pages, in a Markdown preview",onSelect:()=>je({type:"openGuide"})},{type:"item",label:"Send Feedback\u2026",icon:"feedback",title:"A short form: what works, what is missing (opens in the browser)",onSelect:()=>je({type:"sendFeedback"})}]}function oH(){return[{type:"item",label:"Find Node\u2026",icon:"search",shortcut:Na("find"),title:"Find a node on any level by title, key or binding",onSelect:()=>_.getState().openFind(!0)},{type:"separator"},...D_("run"),{type:"separator"},{type:"item",label:"Keyboard Shortcuts",icon:"keyboard",shortcut:"?",onSelect:()=>_.getState().showCheatSheet(!0)}]}function rH(e){return[{type:"item",label:"Export as draw.io Diagram\u2026",icon:"export",title:"Every level as a page of a draw.io diagram, with the node details as shape data",onSelect:()=>je({type:"export",format:"drawio",level:e})},{type:"item",label:"Export as Image\u2026",icon:"file-media",title:"This level as an SVG or PNG image that draw.io also opens as a diagram",onSelect:()=>je({type:"export",format:"image",level:e})}]}function iH({icon:e,label:t,title:n,unavailable:r,onClick:a}){return(0,c.jsxs)("button",{type:"button",className:"secondary","aria-disabled":r?!0:void 0,title:r??n,onClick:()=>!r&&a(),children:[(0,c.jsx)("span",{className:`codicon codicon-${e}`,"aria-hidden":"true"})," ",t]})}function aH({running:e,viewer:t}){let n=_(a=>a.runner),r=e?"A run is going: stop it first":void 0;return(0,c.jsxs)("div",{className:"afd-split",children:[(0,c.jsxs)("button",{type:"button",onClick:()=>e?je({type:"stopRun"}):Ay("check"),title:e?"Stop the run: end the local run, or cancel the job or workflow in AWX":t?"Run the flow in check mode: bound steps report what they would change":"Generate the code and run it in check mode in the local Ansible environment",children:[(0,c.jsx)("span",{className:`codicon ${e?"codicon-debug-stop":"codicon-play"}`,"aria-hidden":"true"})," ",e?"Stop":"Run as Skeleton"]}),(0,c.jsx)(hv,{label:"More run options",title:"More run options",items:()=>[{type:"item",label:"Run for Real\u2026",icon:"debug-alt",title:"Run for real (not check mode), after a confirmation naming inventory and hosts",disabled:r,onSelect:()=>Ay("real")},...t?[]:[{type:"item",label:"Run Scenarios",icon:"beaker",title:"Run the scenario tests next to the flow: every step as its stub on local hosts, then where each host ended",disabled:r,onSelect:()=>je({type:"runScenarios"})},{type:"item",label:"Launch in AWX",icon:"rocket",title:"Launch the flow's AWX job template (the pushed commit of the AWX project) and follow its job events",disabled:r,onSelect:()=>je({type:"launchAwx"})},...n?[{type:"item",label:"Run on Server",icon:"cloud-upload",title:"Run the flow on Ansible Flow Server: its launch configuration, at the server's commit, followed here",disabled:r,onSelect:()=>je({type:"launchRunner"})}]:[]]],children:(0,c.jsx)("span",{className:"codicon codicon-chevron-down","aria-hidden":"true"})})]})}function sH({run:e}){let t=_(a=>a.snapshot?.doc),n=e.summary?.running,r=n&&t?$e(t).nodes.get(n)?.node.title:void 0;return(0,c.jsxs)("button",{type:"button",className:`afd-run-status${e.quiet?" warn":""}`,"data-run-state":"running","data-run-quiet":e.quiet?"true":void 0,onClick:()=>je({type:"showRunOutput"}),title:e.quiet?"No new events from the run for 20 s: a step may be slow, or waiting for input. Show the terminal.":"Show the terminal of the run.",children:[(0,c.jsx)("span",{className:"codicon codicon-loading codicon-modifier-spin","aria-hidden":"true"})," ",N$(e)?"Waiting for approval":e.quiet?"No new events for 20 s \xB7 Show Terminal":r?`Running: ${r}`:"Running\u2026"]})}function lH({run:e}){if(e?.state==="running"&&e.awx)return(0,c.jsxs)("button",{type:"button",className:"afd-run-status","data-run-state":"running",onClick:()=>je({type:"showRunOutput"}),title:`AWX ${e.awx.workflow?"workflow":"job"} ${e.awx.jobId} (${e.awx.status}). Open it in AWX.`,children:[(0,c.jsx)("span",{className:"codicon codicon-loading codicon-modifier-spin","aria-hidden":"true"})," AWX"," ",e.awx.workflow?"workflow":"job"," #",e.awx.jobId,N$(e)?" \xB7 waiting for approval":""]});if(e?.state==="running")return(0,c.jsx)(sH,{run:e});if(!e)return null;if(e.scenario)return(0,c.jsxs)("span",{className:`afd-run-status ${e.scenario.passed?"ok":"warn"}`,"data-run-state":"scenario",children:[(0,c.jsx)("span",{className:`codicon ${e.scenario.passed?"codicon-pass":"codicon-warning"}`,"aria-hidden":"true"})," ","Scenario: ",e.scenario.name," \xB7 ",e.scenario.passed?"passed":"failed"]});if(e.state==="error")return(0,c.jsxs)("span",{className:"afd-run-status error",title:e.error,"data-run-state":"error",children:[(0,c.jsx)("span",{className:"codicon codicon-error","aria-hidden":"true"})," ",e.awx||e.summary?"Run interrupted":"Run not started"]});let t=e.summary,{ok:n,failed:r}=Kj(e),a=e.awx?`AWX #${e.awx.jobId} \xB7 `:"",s=t?.stoppedEarly?`${a}Stopped early \xB7 exit ${e.rc}`:`${a}${t?.hosts.length??0} hosts \xB7 ${r} failed \xB7 exit ${e.rc}`;return(0,c.jsxs)("button",{type:"button",className:`afd-run-status ${n?"ok":"warn"}`,"data-run-state":e.state,onClick:()=>je({type:"showRunOutput"}),title:`${e.mode==="check"?"Skeleton run (check mode)":"Real run"} at ${e.finishedAt??e.startedAt} in ${e.environment??"the environment"}. ${e.awx?"Open the job in AWX.":"Show the terminal."}`,children:[(0,c.jsx)("span",{className:`codicon ${n?"codicon-pass":"codicon-warning"}`,"aria-hidden":"true"})," ",s]})}function dH({edge:e}){let t=_(v=>v.snapshot?.doc),n=wa(),r=t?$e(t):void 0,a=r?.edges.get(e)?.edge;if(!r||!a)return null;let s=r.nodes.get(a.from.node)?.node,l=r.nodes.get(a.to.node)?.node,f={node:a.from.node,port:a.from.port},p=ka(a.from.port,s?.type),h=n?Id(r,f)?.items??[]:[];return(0,c.jsxs)("div",{className:"afd-panel-body","data-wire-panel":e,children:[(0,c.jsx)("h2",{children:"Wire"}),(0,c.jsxs)("p",{children:["Hosts that leave ",(0,c.jsx)("strong",{children:s?.title})," by"," ",(0,c.jsx)("span",{className:"mono",children:a.from.port})," go to ",(0,c.jsx)("strong",{children:l?.title}),"."]}),p?(0,c.jsxs)("p",{className:"muted",children:[p,"."]}):null,(0,c.jsx)("div",{className:"afd-panel-actions",children:h.map(v=>(0,c.jsx)("button",{type:"button",className:"secondary",onClick:()=>{ol(v,f)},children:v.label},v.label))})]})}var uH=16e3,cH=12e7;async function fH(e,t,n){let r=Math.max(.25,Math.min(2,uH/Math.max(t,n),Math.sqrt(cH/(t*n)))),a=new Image;a.src=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(e)}`,await a.decode();let s=document.createElement("canvas");s.width=Math.round(t*r),s.height=Math.round(n*r);let l=s.getContext("2d");if(!l)throw Error("no 2D canvas");l.fillStyle="#ffffff",l.fillRect(0,0,s.width,s.height),l.drawImage(a,0,0,s.width,s.height);let f=await new Promise((v,g)=>s.toBlob(m=>m?v(m):g(Error("PNG encoding failed")),"image/png")),p=new Uint8Array(await f.arrayBuffer()),h="";for(let v=0;v<p.length;v+=8192)h+=String.fromCharCode(...p.subarray(v,v+8192));return btoa(h)}var I_=e=>!!e&&/^(entry|exit):/.test(e);function hH(e){let{node:t,edge:n,nodes:r,annotations:a}=e.selection;if(t)return{kind:"details",id:t};let s=!r?.length&&a?.length===1?a[0]:void 0;return s?{kind:"annotation",id:s}:e.mode==="code"?{kind:"drift"}:e.mode==="run"?n&&!I_(n)?{kind:"wireRun",edge:n}:{kind:"run"}:r?.length?{kind:"selection",ids:r}:n&&I_(n)?{kind:"boundary",edge:n}:n?{kind:"wire",edge:n}:e.level==="root"?{kind:"flow"}:{kind:"details",id:e.level,context:!0}}function L_(e){switch(e.kind){case"drift":return"Design vs code";case"wireRun":case"run":return"Run results";case"selection":return"Selected nodes";case"details":return e.context?"Subflow details":"Details";case"boundary":return"Subflow boundary";case"wire":return"Wire";case"annotation":return"Annotation";case"flow":return"Flow description"}}var pH={light:{ok:"#2f855a",failed:"#c2410c",unreachable:"#b45309",decision:"#3b62c4",approval:"#6b5bd2",undo:"#0f766e",neutral:"#6b7280",accent:"#1d4ed8"},dark:{ok:"#4fbf83",failed:"#f07a4a",unreachable:"#f0a742",decision:"#7f9cf5",approval:"#a99cf0",undo:"#3cc2b4",neutral:"#9aa0a6",accent:"#5b8def"},"hc-dark":{ok:"#57e389",failed:"#ff8c5a",unreachable:"#ffc457",decision:"#9db4ff",approval:"#c4b8ff",undo:"#4ee0d0",neutral:"#c8c8c8",accent:"#f38518"},"hc-light":{ok:"#1b6b44",failed:"#a3330a",unreachable:"#8a4b00",decision:"#2349a8",approval:"#4f3fb0",undo:"#0b5c56",neutral:"#4b5058",accent:"#0f4a85"}},mH={light:{"fill-specified":"#f3f0ff","fill-implemented":"#e9f7f1","fill-tested":"#dcf2e6","fill-decision":"#eaf1fb","fill-approval":"#f1effc","fill-handler":"#fdf2e7","fill-failed-end":"#fdecec"},dark:{"fill-specified":"#2c2645","fill-implemented":"#1c3329","fill-tested":"#1a3d2c","fill-decision":"#1e2a40","fill-approval":"#2a2542","fill-handler":"#3a2a17","fill-failed-end":"#3d1f1f"},"hc-dark":{"fill-specified":"transparent","fill-implemented":"transparent","fill-tested":"transparent","fill-decision":"transparent","fill-approval":"transparent","fill-handler":"transparent","fill-failed-end":"transparent"},"hc-light":{"fill-specified":"transparent","fill-implemented":"transparent","fill-tested":"transparent","fill-decision":"transparent","fill-approval":"transparent","fill-handler":"transparent","fill-failed-end":"transparent"}},gH={light:{yellow:{fill:"#fff4c2",ink:"#7a5600"},blue:{fill:"#e2edff",ink:"#1f4e9e"},green:{fill:"#e0f5e7",ink:"#1d6336"},pink:{fill:"#fde6ef",ink:"#9b2358"},purple:{fill:"#eee7ff",ink:"#5536b0"},gray:{fill:"#eceef1",ink:"#4b5058"}},dark:{yellow:{fill:"#4a3e10",ink:"#f2d46b"},blue:{fill:"#1c2d4a",ink:"#8ab4ff"},green:{fill:"#1a3925",ink:"#7ed49a"},pink:{fill:"#45202f",ink:"#f59ac0"},purple:{fill:"#2f2550",ink:"#c1aaff"},gray:{fill:"#2e3137",ink:"#c3c7cd"}},"hc-dark":{yellow:{fill:"transparent",ink:"#ffff00"},blue:{fill:"transparent",ink:"#8ab4ff"},green:{fill:"transparent",ink:"#89d185"},pink:{fill:"transparent",ink:"#ff9ccf"},purple:{fill:"transparent",ink:"#d0b8ff"},gray:{fill:"transparent",ink:"#ffffff"}},"hc-light":{yellow:{fill:"transparent",ink:"#5c4400"},blue:{fill:"transparent",ink:"#0f3d8a"},green:{fill:"transparent",ink:"#0f5223"},pink:{fill:"transparent",ink:"#8a1846"},purple:{fill:"transparent",ink:"#45249c"},gray:{fill:"transparent",ink:"#292929"}}},R_={light:{inventory:{bg:"#e8f1fb",fg:"#1e4f86"},data:{bg:"#f3f0ff",fg:"#4c3fa8"},code:{bg:"#e9f7f1",fg:"#0f5a43"},access:{bg:"#fdf2e7",fg:"#8a4b0a"},timing:{bg:"#f1f2f4",fg:"#3d444d"},changes:{bg:"#e7f3f8",fg:"#0b4f6c"}},dark:{inventory:{bg:"#1b2c42",fg:"#9cc3f0"},data:{bg:"#2c2645",fg:"#c3b8ff"},code:{bg:"#1c3329",fg:"#8fdcb7"},access:{bg:"#3a2a17",fg:"#f2c48a"},timing:{bg:"#2b2e33",fg:"#c9ced6"},changes:{bg:"#173240",fg:"#9fd3ea"}},"hc-dark":{inventory:{bg:"transparent",fg:"#9db4ff"},data:{bg:"transparent",fg:"#c4b8ff"},code:{bg:"transparent",fg:"#57e389"},access:{bg:"transparent",fg:"#ffc457"},timing:{bg:"transparent",fg:"#ffffff"},changes:{bg:"transparent",fg:"#7fdbff"}},"hc-light":{inventory:{bg:"transparent",fg:"#0f4a85"},data:{bg:"transparent",fg:"#4f3fb0"},code:{bg:"transparent",fg:"#1b6b44"},access:{bg:"transparent",fg:"#8a4b00"},timing:{bg:"transparent",fg:"#292929"},changes:{bg:"transparent",fg:"#004b6b"}}},yH={light:{delim:"#0000ff",keyword:"#af00db",constant:"#0000ff",var:"#001080",func:"#795e26",string:"#a31515",format:"#ee0000",number:"#098658",comment:"#008000",key:"#800000"},dark:{delim:"#5ca1db",keyword:"#c586c0",constant:"#5ca1db",var:"#9cdcfe",func:"#dcdcaa",string:"#ce9178",format:"#d7ba7d",number:"#b5cea8",comment:"#7ca668",key:"#5ca1db"},"hc-dark":{delim:"#569cd6",keyword:"#c586c0",constant:"#569cd6",var:"#9cdcfe",func:"#dcdcaa",string:"#ce9178",format:"#d7ba7d",number:"#b5cea8",comment:"#7ca668",key:"#569cd6"},"hc-light":{delim:"#0f4a85",keyword:"#b5200d",constant:"#0f4a85",var:"#001080",func:"#5e2cbc",string:"#0f4a85",format:"#ee0000",number:"#096d48",comment:"#515151",key:"#0f4a85"}};function vH(e){return e.classList.contains("vscode-high-contrast-light")?"hc-light":e.classList.contains("vscode-high-contrast")?"hc-dark":e.classList.contains("vscode-dark")?"dark":"light"}function bH(e,t){for(let[n,r]of Object.entries(pH[t]))e.style.setProperty(`--afd-${n}`,r);for(let[n,r]of Object.entries(mH[t]))e.style.setProperty(`--afd-${n}`,r);for(let[n,r]of Object.entries(R_[t]))e.style.setProperty(`--afd-lens-${n}-bg`,r.bg),e.style.setProperty(`--afd-lens-${n}-fg`,r.fg);for(let[n,r]of Object.entries(gH[t]))e.style.setProperty(`--afd-note-${n}`,r.fill),e.style.setProperty(`--afd-note-${n}-ink`,r.ink);for(let[n,r]of Object.entries(yH[t]))e.style.setProperty(`--afd-syn-${n}`,r);e.style.setProperty("--afd-lens-data",R_[t].data.fg),e.dataset.theme=t}function z_(){G3(),_.getState().setViewer()}function xH(){(0,A.useEffect)(()=>{let e=()=>bH(document.documentElement,vH(document.body));e();let t=new MutationObserver(e);return t.observe(document.body,{attributes:!0,attributeFilter:["class"]}),()=>t.disconnect()},[])}function wH(){let e=(0,A.useRef)(null),t=(0,A.useRef)(!1);(0,A.useEffect)(()=>{let a=Yg(h=>{let v=_.getState();h.type==="snapshot"?(e.current={version:h.snapshot.docVersion,at:performance.now()},v.setSnapshot(h.snapshot)):h.type==="run"?v.setRun(h.run):h.type==="runs"?v.setPastRuns(h.runs):h.type==="launch"?v.setLaunch(h.plan,h.notice):h.type==="launchFacts"?v.setLaunchFacts(h.token,h.facts,h.error):h.type==="scenarios"?v.setScenarios(h.results,h.show):h.type==="scenarioCheck"?v.setScenarioCheck(h.check,h.undo):h.type==="outsideMarks"?v.setOutside(h.marks):h.type==="mergeConflicts"?v.setMerge(h.merge):h.type==="repoState"?v.setRepo(h.state):h.type==="config"?(v.setTestMode(h.testMode),v.setRunner(h.runner===!0),v.setExpandSubflows(h.expandSubflows===!0),h.viewer&&z_()):h.type==="firstFlow"?v.setFirstFlow({hidden:h.hidden,done:h.done}):h.type==="reveal"?v.reveal(h.node):h.type==="setMode"?v.setMode(h.mode):h.type==="openLevel"?v.setLevel(h.level):h.type==="catalogStatus"?v.setCatalog(h.status):h.type==="sync"?v.setSync({state:h.state,scan:h.scan,error:h.error}):h.type==="lensFacts"?v.setLensFacts(h.facts):h.type==="setLens"?v.setLens(h.lens):h.type==="clipboard"?h.action==="copy"?Kd():t$(h.text,h.at):h.type==="notify"?v.notify(h.level,h.text):h.type==="openDetails"?(v.reveal(h.node),v.openDetails(h.node,h.tab)):h.type==="inspect"?je({type:"inspectResult",reqId:h.reqId,result:_7(v.snapshot?.docVersion??-1)}):h.type==="renderPng"&&fH(h.svg,h.width,h.height).then(g=>je({type:"pngRendered",reqId:h.reqId,data:g}),g=>je({type:"pngRendered",reqId:h.reqId,error:g.message}))}),s=h=>je({type:"cspViolation",detail:`${h.violatedDirective} ${h.blockedURI}`});document.addEventListener("securitypolicyviolation",s);let l=P5(h=>{Ud(h)}),f=P7(),p=X3(h=>_.setState({saving:h>0}));return je({type:"ready"}),()=>{a(),l(),f(),p(),document.removeEventListener("securitypolicyviolation",s)}},[]);let n=_(a=>a.snapshot),r=_(a=>a.testMode);(0,A.useLayoutEffect)(()=>{if(!n||!e.current||e.current.version!==n.docVersion)return;let{at:a,version:s}=e.current;requestAnimationFrame(()=>{if(!r)return;let l=t.current?"render":"firstRender";t.current=!0,je({type:"perf",event:l,ms:performance.now()-a,docVersion:s});let f=0,p=()=>{if(document.querySelector('.react-flow__node[style*="visibility: hidden"]')&&f++<60)return requestAnimationFrame(p);requestAnimationFrame(()=>je({type:"perf",event:"drawn",ms:performance.now()-a,docVersion:s}))};p()})},[n,r])}function kH({panel:e}){switch(e.kind){case"drift":return(0,c.jsx)(gB,{});case"wireRun":return(0,c.jsx)(YB,{edge:e.edge});case"run":return(0,c.jsx)(VB,{});case"selection":return(0,c.jsx)(Uq,{ids:e.ids});case"details":return(0,c.jsx)(C7,{id:e.id,context:e.context},e.id);case"boundary":return(0,c.jsx)(iq,{edge:e.edge});case"wire":return(0,c.jsx)(dH,{edge:e.edge});case"annotation":return(0,c.jsx)(J7,{id:e.id});case"flow":return(0,c.jsx)(MB,{})}}function SH(){(0,A.useEffect)(()=>{let e=Ms();return typeof e.panelWidth=="number"&&_.getState().setPanelWidth(e.panelWidth),e.expanded&&_.getState().setExpanded(!0),e.paletteCollapsed&&_.getState().setPaletteCollapsed(!0),e.panelCollapsed&&_.getState().setPanelCollapsed(!0),e.annotationsHidden&&_.getState().setAnnotationsHidden(!0),_.subscribe((t,n)=>{(t.panelWidth!==n.panelWidth||t.expanded!==n.expanded||t.paletteCollapsed!==n.paletteCollapsed||t.panelCollapsed!==n.panelCollapsed||t.annotationsHidden!==n.annotationsHidden)&&Xg({...Ms(),panelWidth:t.panelWidth,expanded:t.expanded,paletteCollapsed:t.paletteCollapsed,panelCollapsed:t.panelCollapsed,annotationsHidden:t.annotationsHidden})})},[])}function NH(){let e=_(r=>r.panelWidth),t=_(r=>r.expanded),n=r=>{_.getState().setExpanded(!1),_.getState().setPanelWidth(r)};return(0,c.jsx)("div",{className:"afd-resizer",role:"separator","aria-orientation":"vertical","aria-label":"Resize the side panel","aria-valuemin":Hd.min,"aria-valuemax":Hd.max,"aria-valuenow":e,tabIndex:0,onKeyDown:r=>{let a=r.shiftKey?64:16;if(r.key==="ArrowLeft")n(e+a);else if(r.key==="ArrowRight")n(e-a);else if(r.key==="Enter")_.getState().setPanelCollapsed(!0);else return;r.preventDefault()},onDoubleClick:()=>_.getState().setPanelCollapsed(!0),onPointerDown:r=>{r.preventDefault();let a=r.clientX,s=r.currentTarget,l=t?s.parentElement?.getBoundingClientRect().width??e:e,f=()=>{s.removeEventListener("pointermove",p),s.removeEventListener("pointerup",f),s.removeEventListener("pointercancel",f),s.removeEventListener("lostpointercapture",f),s.hasPointerCapture?.(r.pointerId)&&s.releasePointerCapture(r.pointerId)},p=h=>{h.buttons===0?f():n(l+(a-h.clientX))};s.setPointerCapture?.(r.pointerId),s.addEventListener("pointermove",p),s.addEventListener("pointerup",f),s.addEventListener("pointercancel",f),s.addEventListener("lostpointercapture",f)}})}function jH({label:e,lensTab:t}){let n=_(m=>m.lens),r=_(m=>m.lensView?.findings.length??0),a=_(m=>m.showLensTab),s=_(m=>m.scenariosOpen),l=_(m=>m.scenariosTab),f=_(m=>m.showScenariosTab),p=_(m=>m.scenarioCheck?.results.filter(b=>!b.passed).length??0),h=m=>{f(!1),a(m)},v=!t&&!l,g=sa.find(m=>m.id===n)?.label??n;return(0,c.jsxs)("div",{className:"afd-props-tabs afd-right-tabs",role:"tablist","aria-label":"Side panel",onKeyDown:B$,children:[(0,c.jsx)("button",{type:"button",role:"tab","aria-selected":v,tabIndex:v?0:-1,className:v?"active":"",onClick:()=>h(!1),children:e}),n?(0,c.jsxs)("button",{type:"button",role:"tab","aria-selected":t,tabIndex:t?0:-1,className:t?"active":"",onClick:()=>h(!0),children:["Lens: ",g," ",r?(0,c.jsx)("span",{className:"afd-chip",children:r}):null]}):null,s?(0,c.jsxs)("button",{type:"button",role:"tab","aria-selected":l,tabIndex:l?0:-1,className:l?"active":"","data-tab":"scenarios",onClick:()=>f(!0),children:["Scenarios ",p?(0,c.jsx)("span",{className:"afd-chip",children:p}):null]}):null]})}function CH(){xH(),wH();let e=_(N=>N.snapshot),t=_(N=>N.selection.node),n=_(N=>N.selection.edge),r=_(N=>N.selection.nodes),a=_(N=>N.selection.annotations),s=_(N=>N.level),l=_(N=>N.panelWidth),f=_(N=>N.lens!==null&&N.lensTab),p=_(N=>N.scenariosOpen),h=_(N=>N.scenariosOpen&&N.scenariosTab),v=(0,A.useRef)(null);(0,A.useLayoutEffect)(()=>{v.current&&(v.current.scrollTop=f?_.getState().lensScroll:0)},[f]);let g=_(N=>N.expanded),m=_(N=>N.panelCollapsed),b=_(N=>N.paletteCollapsed);SH();let w=_(N=>N.mode),k=_(N=>N.lens),S=hH({lens:k,mode:w,selection:{node:t,edge:n,nodes:r,annotations:a},level:s});return e?e.doc?(0,c.jsx)(lN,{children:(0,c.jsxs)("div",{className:"afd-shell",style:{"--afd-right-width":m?"var(--afd-collapsed-width)":g?"min(1100px, 80vw)":`${l}px`,...w==="design"?b?{"--afd-left-width":"var(--afd-collapsed-width)"}:{}:{"--afd-left-width":"0px"}},children:[(0,c.jsx)(Qq,{}),w==="design"?(0,c.jsx)(Rq,{}):null,(0,c.jsxs)("main",{className:"afd-center",children:[(0,c.jsx)(nq,{}),(0,c.jsx)(rq,{}),(0,c.jsx)(Fq,{}),(0,c.jsx)(lq,{}),(0,c.jsx)(Pq,{}),(0,c.jsx)(Mq,{}),(0,c.jsx)(sB,{}),(0,c.jsx)(Zq,{})]}),m?(0,c.jsx)("aside",{className:"afd-right collapsed","aria-label":"Side panel, hidden",children:(0,c.jsx)("button",{type:"button",className:"icon","aria-label":"Show Side Panel",title:"Show the side panel",onClick:()=>_.getState().setPanelCollapsed(!1),children:(0,c.jsx)("span",{className:"codicon codicon-layout-sidebar-right","aria-hidden":"true"})})}):(0,c.jsxs)("aside",{ref:v,className:"afd-right","aria-label":f?"Lens":h?"Scenarios":L_(S),onScroll:N=>{N.currentTarget.style.setProperty("--afd-right-scroll",`${N.currentTarget.scrollTop}px`),f&&_.setState({lensScroll:N.currentTarget.scrollTop})},children:[(0,c.jsx)(NH,{}),k||p?(0,c.jsx)(jH,{label:L_(S),lensTab:f}):null,f?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(_q,{}),(0,c.jsx)(Aq,{})]}):h?(0,c.jsx)(Wq,{}):(0,c.jsx)(kH,{panel:S})]}),(0,c.jsx)(l8,{}),(0,c.jsx)(fq,{}),(0,c.jsx)(vB,{}),(0,c.jsx)(Tq,{}),(0,c.jsx)(Yq,{}),(0,c.jsx)(hq,{}),(0,c.jsx)(Bq,{}),(0,c.jsx)(G7,{}),(0,c.jsx)(uq,{}),(0,c.jsx)(wq,{}),(0,c.jsx)(qq,{})]})},s):(0,c.jsx)(Oq,{snapshot:e}):(0,c.jsx)("div",{className:"afd-loading",children:"Loading flow\u2026"})}var F_={light:"vscode-light",dark:"vscode-dark","hc-dark":"vscode-high-contrast","hc-light":"vscode-high-contrast-light"},B_={light:{"--vscode-editor-background":"#ffffff","--vscode-editor-foreground":"#3b3b3b","--vscode-sideBar-background":"#f8f8f8","--vscode-panel-border":"#e5e5e5","--vscode-descriptionForeground":"#717171","--vscode-focusBorder":"#005fb8","--vscode-button-background":"#005fb8","--vscode-button-foreground":"#ffffff","--vscode-input-background":"#ffffff","--vscode-input-border":"#cecece"},dark:{"--vscode-editor-background":"#1f1f1f","--vscode-editor-foreground":"#cccccc","--vscode-sideBar-background":"#181818","--vscode-panel-border":"#2b2b2b","--vscode-descriptionForeground":"#9d9d9d","--vscode-focusBorder":"#0078d4","--vscode-button-background":"#0078d4","--vscode-button-foreground":"#ffffff","--vscode-input-background":"#313131","--vscode-input-border":"#3c3c3c","--vscode-editorLineNumber-foreground":"#4a4a4a"},"hc-dark":{"--vscode-editor-background":"#000000","--vscode-editor-foreground":"#ffffff","--vscode-sideBar-background":"#000000","--vscode-panel-border":"#6fc3df","--vscode-descriptionForeground":"#ffffff","--vscode-focusBorder":"#f38518","--vscode-button-background":"#000000","--vscode-button-border":"#6fc3df","--vscode-contrastBorder":"#6fc3df","--vscode-input-background":"#000000","--vscode-input-border":"#6fc3df"},"hc-light":{"--vscode-editor-background":"#ffffff","--vscode-editor-foreground":"#292929","--vscode-sideBar-background":"#ffffff","--vscode-panel-border":"#0f4a85","--vscode-descriptionForeground":"#292929","--vscode-focusBorder":"#006bbd","--vscode-button-background":"#0f4a85","--vscode-button-foreground":"#ffffff","--vscode-button-border":"#0f4a85","--vscode-contrastBorder":"#0f4a85","--vscode-input-background":"#ffffff","--vscode-input-border":"#0f4a85"}};function $H(e,t){let n=B_[t];for(let r of Object.values(F_))e.body.classList.remove(r);e.body.classList.add(F_[t]);for(let[r,a]of Object.entries(n))e.documentElement.style.setProperty(r,a);for(let r of Object.values(B_))for(let a of Object.keys(r))a in n||e.documentElement.style.removeProperty(a)}function EH(e,t){yN(t.transport),t.viewer&&z_();let n=e.ownerDocument,r=n.defaultView?.matchMedia?.("(prefers-color-scheme: dark)"),a=t.theme??"auto",s=()=>$H(n,a==="auto"?r?.matches?"dark":"light":a);s(),r?.addEventListener("change",s),e.style.height="100%";let l=(0,OT.createRoot)(e);return l.render((0,c.jsx)(CH,{})),{setTheme(f){a=f,s()},unmount(){r?.removeEventListener("change",s),l.unmount()}}}export{EH as mount};
|