yarramate 1.26.0 → 1.27.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.
@@ -0,0 +1,373 @@
1
+ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,o)=>(o=n==null?{}:e(i(n)),s(r||!n||!n.__esModule||!a.call(n,`default`)?t(o,`default`,{value:n,enumerable:!0}):o,n)),l=(e=>typeof require<`u`?require:typeof Proxy<`u`?new Proxy(e,{get:(e,t)=>(typeof require<`u`?require:e)[t]}):e)(function(e){if(typeof require<`u`)return require.apply(this,arguments);throw Error('Calling `require` for "'+e+"\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.")}),u=o((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&j(x,t.startTime-e)}}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&j(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function j(t,n){C=_(function(){t(e.unstable_now())},n)}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(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,j(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),d=o(((e,t)=>{t.exports=u()})),f=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=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,e,t,`setState`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function C(){}var w={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function E(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function D(e,t){return E(e.type,t,e.props)}function O(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function k(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var A=/\/+/g;function j(e,t){return typeof e==`object`&&e&&e.key!=null?k(``+e.key):t.toString(36)}function M(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(C,C):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function N(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,N(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+j(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(A,`$&/`)+`/`),N(o,r,i,``,function(e){return e})):o!=null&&(O(o)&&(o=D(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(A,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u<e.length;u++)a=e[u],s=l+j(a,u),c+=N(a,r,i,s,o);else if(u=m(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+j(a,u++),c+=N(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return N(M(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function P(e,t,n){if(e==null)return e;var r=[],i=0;return N(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function F(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t)},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var I=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},L={map:P,forEach:function(e,t,n){P(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return P(e,function(){t++}),t},toArray:function(e){return P(e,function(e){return e})||[]},only:function(e){if(!O(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=L,e.Component=v,e.Fragment=r,e.Profiler=a,e.PureComponent=b,e.StrictMode=i,e.Suspense=l,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=w,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return w.H.useMemoCache(e)}},e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=g({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!T.call(t,a)||a===`key`||a===`__self`||a===`__source`||a===`ref`&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];r.children=o}return E(e.type,i,r)},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:o,_context:e},e},e.createElement=function(e,t,n){var r,i={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=``+t.key),t)T.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return E(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=O,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:F}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=w.T,n={};w.T=n;try{var r=e(),i=w.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(C,I)}catch(e){I(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),w.T=t}},e.unstable_useCacheRefresh=function(){return w.H.useCacheRefresh()},e.use=function(e){return w.H.use(e)},e.useActionState=function(e,t,n){return w.H.useActionState(e,t,n)},e.useCallback=function(e,t){return w.H.useCallback(e,t)},e.useContext=function(e){return w.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return w.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return w.H.useEffect(e,t)},e.useEffectEvent=function(e){return w.H.useEffectEvent(e)},e.useId=function(){return w.H.useId()},e.useImperativeHandle=function(e,t,n){return w.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return w.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return w.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return w.H.useMemo(e,t)},e.useOptimistic=function(e,t){return w.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return w.H.useReducer(e,t,n)},e.useRef=function(e){return w.H.useRef(e)},e.useState=function(e){return w.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return w.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return w.H.useTransition()},e.version=`19.2.8`})),p=o(((e,t)=>{t.exports=f()})),m=o((e=>{var t=p();function n(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function r(){}var i={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},a=Symbol.for(`react.portal`);function o(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}var s=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function c(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,e.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(n(299));return o(e,t,null,r)},e.flushSync=function(e){var t=s.T,n=i.p;try{if(s.T=null,i.p=2,e)return e()}finally{s.T=t,i.p=n,i.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,i.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&i.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=c(n,t.crossOrigin),a=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?i.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:a,fetchPriority:o}):n===`script`&&i.d.X(e,{crossOrigin:r,integrity:a,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`){if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=c(t.as,t.crossOrigin);i.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0})}}else t??i.d.M(e)}},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=c(n,t.crossOrigin);i.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`){if(t){var n=c(t.as,t.crossOrigin);i.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0})}else i.d.m(e)}},e.requestFormReset=function(e){i.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return s.H.useFormState(e,t,n)},e.useFormStatus=function(){return s.H.useHostTransitionStatus()},e.version=`19.2.8`})),h=o(((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(e){console.error(e)}}n(),t.exports=m()})),g=o((e=>{var t=d(),n=p(),r=h();function i(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function s(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function c(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(o(e)!==e)throw Error(i(188))}function u(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return l(a),e;if(s===r)return l(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,u=a.child;u;){if(u===n){c=!0,n=a,r=s;break}if(u===r){c=!0,r=a,n=s;break}u=u.sibling}if(!c){for(u=s.child;u;){if(u===n){c=!0,n=s,r=a;break}if(u===r){c=!0,r=s,n=a;break}u=u.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function f(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=f(e),t!==null)return t;e=e.sibling}return null}var m=Object.assign,g=Symbol.for(`react.element`),_=Symbol.for(`react.transitional.element`),v=Symbol.for(`react.portal`),y=Symbol.for(`react.fragment`),b=Symbol.for(`react.strict_mode`),x=Symbol.for(`react.profiler`),S=Symbol.for(`react.consumer`),C=Symbol.for(`react.context`),w=Symbol.for(`react.forward_ref`),T=Symbol.for(`react.suspense`),E=Symbol.for(`react.suspense_list`),D=Symbol.for(`react.memo`),O=Symbol.for(`react.lazy`),k=Symbol.for(`react.activity`),A=Symbol.for(`react.memo_cache_sentinel`),j=Symbol.iterator;function M(e){return typeof e!=`object`||!e?null:(e=j&&e[j]||e[`@@iterator`],typeof e==`function`?e:null)}var N=Symbol.for(`react.client.reference`);function P(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===N?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case y:return`Fragment`;case x:return`Profiler`;case b:return`StrictMode`;case T:return`Suspense`;case E:return`SuspenseList`;case k:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case v:return`Portal`;case C:return e.displayName||`Context`;case S:return(e._context.displayName||`Context`)+`.Consumer`;case w:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case D:return t=e.displayName||null,t===null?P(e.type)||`Memo`:t;case O:t=e._payload,e=e._init;try{return P(e(t))}catch{}}return null}var F=Array.isArray,I=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,L=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,R={pending:!1,data:null,method:null,action:null},ee=[],z=-1;function B(e){return{current:e}}function V(e){0>z||(e.current=ee[z],ee[z]=null,z--)}function H(e,t){z++,ee[z]=e.current,e.current=t}var U=B(null),W=B(null),G=B(null),K=B(null);function q(e,t){switch(H(G,t),H(W,e),H(U,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Hd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Hd(t),e=Ud(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}V(U),H(U,e)}function J(){V(U),V(W),V(G)}function Y(e){e.memoizedState!==null&&H(K,e);var t=U.current,n=Ud(t,e.type);t!==n&&(H(W,e),H(U,n))}function te(e){W.current===e&&(V(U),V(W)),K.current===e&&(V(K),$f._currentValue=R)}var ne,re;function ie(e){if(ne===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);ne=t&&t[1]||``,re=-1<e.stack.indexOf(`
2
+ at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
3
+ `+ne+e+re}var ae=!1;function oe(e,t){if(!e||ae)return``;ae=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
4
+ `),l=s.split(`
5
+ `);for(i=r=0;r<c.length&&!c[r].includes(`DetermineComponentFrameRoot`);)r++;for(;i<l.length&&!l[i].includes(`DetermineComponentFrameRoot`);)i++;if(r===c.length||i===l.length)for(r=c.length-1,i=l.length-1;1<=r&&0<=i&&c[r]!==l[i];)i--;for(;1<=r&&0<=i;r--,i--)if(c[r]!==l[i]){if(r!==1||i!==1)do if(r--,i--,0>i||c[r]!==l[i]){var u=`
6
+ `+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(`<anonymous>`)&&(u=u.replace(`<anonymous>`,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{ae=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?ie(n):``}function se(e,t){switch(e.tag){case 26:case 27:case 5:return ie(e.type);case 16:return ie(`Lazy`);case 13:return e.child!==t&&t!==null?ie(`Suspense Fallback`):ie(`Suspense`);case 19:return ie(`SuspenseList`);case 0:case 15:return oe(e.type,!1);case 11:return oe(e.type.render,!1);case 1:return oe(e.type,!0);case 31:return ie(`Activity`);default:return``}}function ce(e){try{var t=``,n=null;do t+=se(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
7
+ Error generating stack: `+e.message+`
8
+ `+e.stack}}var le=Object.prototype.hasOwnProperty,ue=t.unstable_scheduleCallback,de=t.unstable_cancelCallback,fe=t.unstable_shouldYield,pe=t.unstable_requestPaint,me=t.unstable_now,he=t.unstable_getCurrentPriorityLevel,ge=t.unstable_ImmediatePriority,_e=t.unstable_UserBlockingPriority,ve=t.unstable_NormalPriority,ye=t.unstable_LowPriority,be=t.unstable_IdlePriority,xe=t.log,Se=t.unstable_setDisableYieldValue,Ce=null,we=null;function Te(e){if(typeof xe==`function`&&Se(e),we&&typeof we.setStrictMode==`function`)try{we.setStrictMode(Ce,e)}catch{}}var Ee=Math.clz32?Math.clz32:X,De=Math.log,Oe=Math.LN2;function X(e){return e>>>=0,e===0?32:31-(De(e)/Oe|0)|0}var ke=256,Ae=262144,je=4194304;function Me(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64: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 e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Ne(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=Me(n))):i=Me(o):i=Me(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=Me(n))):i=Me(o)):i=Me(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function Pe(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Fe(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+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 t+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 Ie(){var e=je;return je<<=1,!(je&62914560)&&(je=4194304),e}function Le(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Re(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function ze(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0<n;){var u=31-Ee(n),d=1<<u;s[u]=0,c[u]=-1;var f=l[u];if(f!==null)for(l[u]=null,u=0;u<f.length;u++){var p=f[u];p!==null&&(p.lane&=-536870913)}n&=~d}r!==0&&Be(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function Be(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-Ee(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function Ve(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Ee(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function He(e,t){var n=t&-t;return n=n&42?1:Ue(n),(n&(e.suspendedLanes|t))===0?n:0}function Ue(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=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:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function We(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function Ge(){var e=L.p;return e===0?(e=window.event,e===void 0?32:hp(e.type)):e}function Ke(e,t){var n=L.p;try{return L.p=e,t()}finally{L.p=n}}var qe=Math.random().toString(36).slice(2),Je=`__reactFiber$`+qe,Ye=`__reactProps$`+qe,Xe=`__reactContainer$`+qe,Ze=`__reactEvents$`+qe,Qe=`__reactListeners$`+qe,$e=`__reactHandles$`+qe,et=`__reactResources$`+qe,tt=`__reactMarker$`+qe;function nt(e){delete e[Je],delete e[Ye],delete e[Ze],delete e[Qe],delete e[$e]}function rt(e){var t=e[Je];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Xe]||n[Je]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=ff(e);e!==null;){if(n=e[Je])return n;e=ff(e)}return t}e=n,n=e.parentNode}return null}function it(e){if(e=e[Je]||e[Xe]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function at(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(i(33))}function ot(e){var t=e[et];return t||=e[et]={hoistableStyles:new Map,hoistableScripts:new Map},t}function st(e){e[tt]=!0}var ct=new Set,lt={};function ut(e,t){dt(e,t),dt(e+`Capture`,t)}function dt(e,t){for(lt[e]=t,e=0;e<t.length;e++)ct.add(t[e])}var ft=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]*$`),pt={},mt={};function ht(e){return le.call(mt,e)?!0:le.call(pt,e)?!1:ft.test(e)?mt[e]=!0:(pt[e]=!0,!1)}function gt(e,t,n){if(ht(t)){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:e.removeAttribute(t);return;case`boolean`:var r=t.toLowerCase().slice(0,5);if(r!==`data-`&&r!==`aria-`){e.removeAttribute(t);return}}e.setAttribute(t,``+n)}}}function _t(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(t);return}e.setAttribute(t,``+n)}}function vt(e,t,n,r){if(r===null)e.removeAttribute(n);else{switch(typeof r){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(n);return}e.setAttributeNS(t,n,``+r)}}function yt(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function bt(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function xt(e,t,n){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&r!==void 0&&typeof r.get==`function`&&typeof r.set==`function`){var i=r.get,a=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){n=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(e){n=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function St(e){if(!e._valueTracker){var t=bt(e)?`checked`:`value`;e._valueTracker=xt(e,t,``+e[t])}}function Ct(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=bt(e)?e.checked?`true`:`false`:e.value),e=r,e!==n&&(t.setValue(e),!0)}function wt(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}var Tt=/[\n"\\]/g;function Et(e){return e.replace(Tt,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function Dt(e,t,n,r,i,a,o,s){e.name=``,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`?e.type=o:e.removeAttribute(`type`),t==null?o!==`submit`&&o!==`reset`||e.removeAttribute(`value`):o===`number`?(t===0&&e.value===``||e.value!=t)&&(e.value=``+yt(t)):e.value!==``+yt(t)&&(e.value=``+yt(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):kt(e,o,yt(n)):kt(e,o,yt(t)),i==null&&a!=null&&(e.defaultChecked=!!a),i!=null&&(e.checked=i&&typeof i!=`function`&&typeof i!=`symbol`),s!=null&&typeof s!=`function`&&typeof s!=`symbol`&&typeof s!=`boolean`?e.name=``+yt(s):e.removeAttribute(`name`)}function Ot(e,t,n,r,i,a,o,s){if(a!=null&&typeof a!=`function`&&typeof a!=`symbol`&&typeof a!=`boolean`&&(e.type=a),t!=null||n!=null){if(!(a!==`submit`&&a!==`reset`||t!=null)){St(e);return}n=n==null?``:``+yt(n),t=t==null?n:``+yt(t),s||t===e.value||(e.value=t),e.defaultValue=t}r??=i,r=typeof r!=`function`&&typeof r!=`symbol`&&!!r,e.checked=s?e.checked:!!r,e.defaultChecked=!!r,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`&&(e.name=o),St(e)}function kt(e,t,n){t===`number`&&wt(e.ownerDocument)===e||e.defaultValue===``+n||(e.defaultValue=``+n)}function At(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t[`$`+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty(`$`+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=``+yt(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function jt(e,t,n){if(t!=null&&(t=``+yt(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n==null?``:``+yt(n)}function Mt(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(i(92));if(F(r)){if(1<r.length)throw Error(i(93));r=r[0]}n=r}n??=``,t=n}n=yt(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),St(e)}function Nt(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Pt=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 Ft(e,t,n){var r=t.indexOf(`--`)===0;n==null||typeof n==`boolean`||n===``?r?e.setProperty(t,``):t===`float`?e.cssFloat=``:e[t]=``:r?e.setProperty(t,n):typeof n!=`number`||n===0||Pt.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function It(e,t,n){if(t!=null&&typeof t!=`object`)throw Error(i(62));if(e=e.style,n!=null){for(var r in n)!n.hasOwnProperty(r)||t!=null&&t.hasOwnProperty(r)||(r.indexOf(`--`)===0?e.setProperty(r,``):r===`float`?e.cssFloat=``:e[r]=``);for(var a in t)r=t[a],t.hasOwnProperty(a)&&n[a]!==r&&Ft(e,a,r)}else for(var o in t)t.hasOwnProperty(o)&&Ft(e,o,t[o])}function Lt(e){if(e.indexOf(`-`)===-1)return!1;switch(e){case`annotation-xml`:case`color-profile`:case`font-face`:case`font-face-src`:case`font-face-uri`:case`font-face-format`:case`font-face-name`:case`missing-glyph`:return!1;default:return!0}}var Rt=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`],[`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`]]),zt=/^[\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 Bt(e){return zt.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function Vt(){}var Ht=null;function Ut(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Wt=null,Gt=null;function Kt(e){var t=it(e);if(t&&(e=t.stateNode)){var n=e[Ye]||null;a:switch(e=t.stateNode,t.type){case`input`:if(Dt(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type===`radio`&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(`input[name="`+Et(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var a=r[Ye]||null;if(!a)throw Error(i(90));Dt(r,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name)}}for(t=0;t<n.length;t++)r=n[t],r.form===e.form&&Ct(r)}break a;case`textarea`:jt(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&At(e,!!n.multiple,t,!1)}}}var qt=!1;function Jt(e,t,n){if(qt)return e(t,n);qt=!0;try{return e(t)}finally{if(qt=!1,(Wt!==null||Gt!==null)&&(yu(),Wt&&(t=Wt,e=Gt,Gt=Wt=null,Kt(t),e)))for(t=0;t<e.length;t++)Kt(e[t])}}function Yt(e,t){var n=e.stateNode;if(n===null)return null;var r=n[Ye]||null;if(r===null)return null;n=r[t];a:switch(t){case`onClick`:case`onClickCapture`:case`onDoubleClick`:case`onDoubleClickCapture`:case`onMouseDown`:case`onMouseDownCapture`:case`onMouseMove`:case`onMouseMoveCapture`:case`onMouseUp`:case`onMouseUpCapture`:case`onMouseEnter`:(r=!r.disabled)||(e=e.type,r=e!==`button`&&e!==`input`&&e!==`select`&&e!==`textarea`),e=!r;break a;default:e=!1}if(e)return null;if(n&&typeof n!=`function`)throw Error(i(231,t,typeof n));return n}var Xt=!(typeof window>`u`||window.document===void 0||window.document.createElement===void 0),Zt=!1;if(Xt)try{var Qt={};Object.defineProperty(Qt,"passive",{get:function(){Zt=!0}}),window.addEventListener(`test`,Qt,Qt),window.removeEventListener(`test`,Qt,Qt)}catch{Zt=!1}var $t=null,en=null,tn=null;function nn(){if(tn)return tn;var e,t=en,n=t.length,r,i=`value`in $t?$t.value:$t.textContent,a=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===i[a-r];r++);return tn=i.slice(e,1<r?1-r:void 0)}function rn(e){var t=e.keyCode;return`charCode`in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function an(){return!0}function on(){return!1}function sn(e){function t(t,n,r,i,a){for(var o in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=i,this.target=a,this.currentTarget=null,e)e.hasOwnProperty(o)&&(t=e[o],this[o]=t?t(i):i[o]);return this.isDefaultPrevented=(i.defaultPrevented==null?!1===i.returnValue:i.defaultPrevented)?an:on,this.isPropagationStopped=on,this}return m(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():typeof e.returnValue!=`unknown`&&(e.returnValue=!1),this.isDefaultPrevented=an)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=an)},persist:function(){},isPersistent:an}),t}var cn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ln=sn(cn),un=m({},cn,{view:0,detail:0}),dn=sn(un),fn,pn,mn,hn=m({},un,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:En,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return`movementX`in e?e.movementX:(e!==mn&&(mn&&e.type===`mousemove`?(fn=e.screenX-mn.screenX,pn=e.screenY-mn.screenY):pn=fn=0,mn=e),fn)},movementY:function(e){return`movementY`in e?e.movementY:pn}}),gn=sn(hn),_n=sn(m({},hn,{dataTransfer:0})),vn=sn(m({},un,{relatedTarget:0})),yn=sn(m({},cn,{animationName:0,elapsedTime:0,pseudoElement:0})),bn=sn(m({},cn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),xn=sn(m({},cn,{data:0})),Sn={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},Cn={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`},wn={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function Tn(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=wn[e])?!!t[e]:!1}function En(){return Tn}var Dn=sn(m({},un,{key:function(e){if(e.key){var t=Sn[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=rn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?Cn[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:En,charCode:function(e){return e.type===`keypress`?rn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?rn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),On=sn(m({},hn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),kn=sn(m({},un,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:En})),An=sn(m({},cn,{propertyName:0,elapsedTime:0,pseudoElement:0})),jn=sn(m({},hn,{deltaX:function(e){return`deltaX`in e?e.deltaX:`wheelDeltaX`in e?-e.wheelDeltaX:0},deltaY:function(e){return`deltaY`in e?e.deltaY:`wheelDeltaY`in e?-e.wheelDeltaY:`wheelDelta`in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0})),Mn=sn(m({},cn,{newState:0,oldState:0})),Nn=[9,13,27,32],Pn=Xt&&`CompositionEvent`in window,Fn=null;Xt&&`documentMode`in document&&(Fn=document.documentMode);var In=Xt&&`TextEvent`in window&&!Fn,Ln=Xt&&(!Pn||Fn&&8<Fn&&11>=Fn),Rn=` `,zn=!1;function Bn(e,t){switch(e){case`keyup`:return Nn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function Vn(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var Hn=!1;function Un(e,t){switch(e){case`compositionend`:return Vn(t);case`keypress`:return t.which===32?(zn=!0,Rn):null;case`textInput`:return e=t.data,e===Rn&&zn?null:e;default:return null}}function Wn(e,t){if(Hn)return e===`compositionend`||!Pn&&Bn(e,t)?(e=nn(),tn=en=$t=null,Hn=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case`compositionend`:return Ln&&t.locale!==`ko`?null:t.data;default:return null}}var Gn={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 Kn(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!Gn[e.type]:t===`textarea`}function qn(e,t,n,r){Wt?Gt?Gt.push(r):Gt=[r]:Wt=r,t=Ed(t,`onChange`),0<t.length&&(n=new ln(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var Jn=null,Yn=null;function Xn(e){yd(e,0)}function Zn(e){if(Ct(at(e)))return e}function Qn(e,t){if(e===`change`)return t}var $n=!1;if(Xt){var er;if(Xt){var tr=`oninput`in document;if(!tr){var nr=document.createElement(`div`);nr.setAttribute(`oninput`,`return;`),tr=typeof nr.oninput==`function`}er=tr}else er=!1;$n=er&&(!document.documentMode||9<document.documentMode)}function rr(){Jn&&(Jn.detachEvent(`onpropertychange`,ir),Yn=Jn=null)}function ir(e){if(e.propertyName===`value`&&Zn(Yn)){var t=[];qn(t,Yn,e,Ut(e)),Jt(Xn,t)}}function ar(e,t,n){e===`focusin`?(rr(),Jn=t,Yn=n,Jn.attachEvent(`onpropertychange`,ir)):e===`focusout`&&rr()}function or(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return Zn(Yn)}function sr(e,t){if(e===`click`)return Zn(t)}function cr(e,t){if(e===`input`||e===`change`)return Zn(t)}function lr(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var ur=typeof Object.is==`function`?Object.is:lr;function dr(e,t){if(ur(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!le.call(t,i)||!ur(e[i],t[i]))return!1}return!0}function fr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function pr(e,t){var n=fr(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=fr(n)}}function mr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?mr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function hr(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=wt(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=wt(e.document)}return t}function gr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}var _r=Xt&&`documentMode`in document&&11>=document.documentMode,vr=null,yr=null,br=null,xr=!1;function Sr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;xr||vr==null||vr!==wt(r)||(r=vr,`selectionStart`in r&&gr(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),br&&dr(br,r)||(br=r,r=Ed(yr,`onSelect`),0<r.length&&(t=new ln(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=vr)))}function Cr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var wr={animationend:Cr(`Animation`,`AnimationEnd`),animationiteration:Cr(`Animation`,`AnimationIteration`),animationstart:Cr(`Animation`,`AnimationStart`),transitionrun:Cr(`Transition`,`TransitionRun`),transitionstart:Cr(`Transition`,`TransitionStart`),transitioncancel:Cr(`Transition`,`TransitionCancel`),transitionend:Cr(`Transition`,`TransitionEnd`)},Tr={},Er={};Xt&&(Er=document.createElement(`div`).style,`AnimationEvent`in window||(delete wr.animationend.animation,delete wr.animationiteration.animation,delete wr.animationstart.animation),`TransitionEvent`in window||delete wr.transitionend.transition);function Dr(e){if(Tr[e])return Tr[e];if(!wr[e])return e;var t=wr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Er)return Tr[e]=t[n];return e}var Or=Dr(`animationend`),kr=Dr(`animationiteration`),Ar=Dr(`animationstart`),jr=Dr(`transitionrun`),Mr=Dr(`transitionstart`),Nr=Dr(`transitioncancel`),Pr=Dr(`transitionend`),Fr=new Map,Ir=`abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel`.split(` `);Ir.push(`scrollEnd`);function Lr(e,t){Fr.set(e,t),ut(t,[e])}var Rr=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},zr=[],Br=0,Vr=0;function Hr(){for(var e=Br,t=Vr=Br=0;t<e;){var n=zr[t];zr[t++]=null;var r=zr[t];zr[t++]=null;var i=zr[t];zr[t++]=null;var a=zr[t];if(zr[t++]=null,r!==null&&i!==null){var o=r.pending;o===null?i.next=i:(i.next=o.next,o.next=i),r.pending=i}a!==0&&Kr(n,i,a)}}function Ur(e,t,n,r){zr[Br++]=e,zr[Br++]=t,zr[Br++]=n,zr[Br++]=r,Vr|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function Wr(e,t,n,r){return Ur(e,t,n,r),qr(e)}function Gr(e,t){return Ur(e,null,null,t),qr(e)}function Kr(e,t,n){e.lanes|=n;var r=e.alternate;r!==null&&(r.lanes|=n);for(var i=!1,a=e.return;a!==null;)a.childLanes|=n,r=a.alternate,r!==null&&(r.childLanes|=n),a.tag===22&&(e=a.stateNode,e===null||e._visibility&1||(i=!0)),e=a,a=a.return;return e.tag===3?(a=e.stateNode,i&&t!==null&&(i=31-Ee(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function qr(e){if(50<uu)throw uu=0,du=null,Error(i(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Jr={};function Yr(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Xr(e,t,n,r){return new Yr(e,t,n,r)}function Zr(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Qr(e,t){var n=e.alternate;return n===null?(n=Xr(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&65011712,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function $r(e,t){e.flags&=65011714;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function ei(e,t,n,r,a,o){var s=0;if(r=e,typeof e==`function`)Zr(e)&&(s=1);else if(typeof e==`string`)s=Wf(e,n,U.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(e){case k:return e=Xr(31,n,t,a),e.elementType=k,e.lanes=o,e;case y:return ti(n.children,a,o,t);case b:s=8,a|=24;break;case x:return e=Xr(12,n,t,a|2),e.elementType=x,e.lanes=o,e;case T:return e=Xr(13,n,t,a),e.elementType=T,e.lanes=o,e;case E:return e=Xr(19,n,t,a),e.elementType=E,e.lanes=o,e;default:if(typeof e==`object`&&e)switch(e.$$typeof){case C:s=10;break a;case S:s=9;break a;case w:s=11;break a;case D:s=14;break a;case O:s=16,r=null;break a}s=29,n=Error(i(130,e===null?`null`:typeof e,``)),r=null}return t=Xr(s,n,t,a),t.elementType=e,t.type=r,t.lanes=o,t}function ti(e,t,n,r){return e=Xr(7,e,r,t),e.lanes=n,e}function ni(e,t,n){return e=Xr(6,e,null,t),e.lanes=n,e}function ri(e){var t=Xr(18,null,null,0);return t.stateNode=e,t}function ii(e,t,n){return t=Xr(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var ai=new WeakMap;function oi(e,t){if(typeof e==`object`&&e){var n=ai.get(e);return n===void 0?(t={value:e,source:t,stack:ce(t)},ai.set(e,t),t):n}return{value:e,source:t,stack:ce(t)}}var si=[],ci=0,li=null,ui=0,di=[],fi=0,pi=null,mi=1,hi=``;function gi(e,t){si[ci++]=ui,si[ci++]=li,li=e,ui=t}function _i(e,t,n){di[fi++]=mi,di[fi++]=hi,di[fi++]=pi,pi=e;var r=mi;e=hi;var i=32-Ee(r)-1;r&=~(1<<i),n+=1;var a=32-Ee(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,mi=1<<32-Ee(t)+i|n<<i|r,hi=a+e}else mi=1<<a|n<<i|r,hi=e}function vi(e){e.return!==null&&(gi(e,1),_i(e,1,0))}function yi(e){for(;e===li;)li=si[--ci],si[ci]=null,ui=si[--ci],si[ci]=null;for(;e===pi;)pi=di[--fi],di[fi]=null,hi=di[--fi],di[fi]=null,mi=di[--fi],di[fi]=null}function bi(e,t){di[fi++]=mi,di[fi++]=hi,di[fi++]=pi,mi=t.id,hi=t.overflow,pi=e}var xi=null,Si=null,Ci=!1,wi=null,Ti=!1,Ei=Error(i(519));function Di(e){throw Ni(oi(Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),Ei}function Oi(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[Je]=e,t[Ye]=r,n){case`dialog`:Q(`cancel`,t),Q(`close`,t);break;case`iframe`:case`object`:case`embed`:Q(`load`,t);break;case`video`:case`audio`:for(n=0;n<_d.length;n++)Q(_d[n],t);break;case`source`:Q(`error`,t);break;case`img`:case`image`:case`link`:Q(`error`,t),Q(`load`,t);break;case`details`:Q(`toggle`,t);break;case`input`:Q(`invalid`,t),Ot(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:Q(`invalid`,t);break;case`textarea`:Q(`invalid`,t),Mt(t,r.value,r.defaultValue,r.children)}n=r.children,typeof n!=`string`&&typeof n!=`number`&&typeof n!=`bigint`||t.textContent===``+n||!0===r.suppressHydrationWarning||Md(t.textContent,n)?(r.popover!=null&&(Q(`beforetoggle`,t),Q(`toggle`,t)),r.onScroll!=null&&Q(`scroll`,t),r.onScrollEnd!=null&&Q(`scrollend`,t),r.onClick!=null&&(t.onclick=Vt),t=!0):t=!1,t||Di(e,!0)}function ki(e){for(xi=e.return;xi;)switch(xi.tag){case 5:case 31:case 13:Ti=!1;return;case 27:case 3:Ti=!0;return;default:xi=xi.return}}function Ai(e){if(e!==xi)return!1;if(!Ci)return ki(e),Ci=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=n===`form`||n===`button`||Wd(e.type,e.memoizedProps)),n=!n),n&&Si&&Di(e),ki(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Si=df(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Si=df(e)}else t===27?(t=Si,Qd(e.type)?(e=uf,uf=null,Si=e):Si=t):Si=xi?lf(e.stateNode.nextSibling):null;return!0}function ji(){Si=xi=null,Ci=!1}function Mi(){var e=wi;return e!==null&&(Xl===null?Xl=e:Xl.push.apply(Xl,e),wi=null),e}function Ni(e){wi===null?wi=[e]:wi.push(e)}var Pi=B(null),Fi=null,Ii=null;function Li(e,t,n){H(Pi,t._currentValue),t._currentValue=n}function Ri(e){e._currentValue=Pi.current,V(Pi)}function zi(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function Bi(e,t,n,r){var a=e.child;for(a!==null&&(a.return=e);a!==null;){var o=a.dependencies;if(o!==null){var s=a.child;o=o.firstContext;a:for(;o!==null;){var c=o;o=a;for(var l=0;l<t.length;l++)if(c.context===t[l]){o.lanes|=n,c=o.alternate,c!==null&&(c.lanes|=n),zi(o.return,n,e),r||(s=null);break a}o=c.next}}else if(a.tag===18){if(s=a.return,s===null)throw Error(i(341));s.lanes|=n,o=s.alternate,o!==null&&(o.lanes|=n),zi(s,n,e),s=null}else s=a.child;if(s!==null)s.return=a;else for(s=a;s!==null;){if(s===e){s=null;break}if(a=s.sibling,a!==null){a.return=s.return,s=a;break}s=s.return}a=s}}function Vi(e,t,n,r){e=null;for(var a=t,o=!1;a!==null;){if(!o){if(a.flags&524288)o=!0;else if(a.flags&262144)break}if(a.tag===10){var s=a.alternate;if(s===null)throw Error(i(387));if(s=s.memoizedProps,s!==null){var c=a.type;ur(a.pendingProps.value,s.value)||(e===null?e=[c]:e.push(c))}}else if(a===K.current){if(s=a.alternate,s===null)throw Error(i(387));s.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(e===null?e=[$f]:e.push($f))}a=a.return}e!==null&&Bi(t,e,n,r),t.flags|=262144}function Hi(e){for(e=e.firstContext;e!==null;){if(!ur(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Ui(e){Fi=e,Ii=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Wi(e){return Ki(Fi,e)}function Gi(e,t){return Fi===null&&Ui(e),Ki(e,t)}function Ki(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Ii===null){if(e===null)throw Error(i(308));Ii=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Ii=Ii.next=t;return n}var qi=typeof AbortController<`u`?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(t,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(e){return e()})}},Ji=t.unstable_scheduleCallback,Yi=t.unstable_NormalPriority,Xi={$$typeof:C,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Zi(){return{controller:new qi,data:new Map,refCount:0}}function Qi(e){e.refCount--,e.refCount===0&&Ji(Yi,function(){e.controller.abort()})}var $i=null,ea=0,ta=0,na=null;function ra(e,t){if($i===null){var n=$i=[];ea=0,ta=dd(),na={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return ea++,t.then(ia,ia),t}function ia(){if(--ea===0&&$i!==null){na!==null&&(na.status=`fulfilled`);var e=$i;$i=null,ta=0,na=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function aa(e,t){var n=[],r={status:`pending`,value:null,reason:null,then:function(e){n.push(e)}};return e.then(function(){r.status=`fulfilled`,r.value=t;for(var e=0;e<n.length;e++)(0,n[e])(t)},function(e){for(r.status=`rejected`,r.reason=e,e=0;e<n.length;e++)(0,n[e])(void 0)}),r}var oa=I.S;I.S=function(e,t){$l=me(),typeof t==`object`&&t&&typeof t.then==`function`&&ra(e,t),oa!==null&&oa(e,t)};var sa=B(null);function ca(){var e=sa.current;return e===null?Pl.pooledCache:e}function la(e,t){t===null?H(sa,sa.current):H(sa,t.pool)}function ua(){var e=ca();return e===null?null:{parent:Xi._currentValue,pool:e}}var da=Error(i(460)),fa=Error(i(474)),pa=Error(i(542)),ma={then:function(){}};function ha(e){return e=e.status,e===`fulfilled`||e===`rejected`}function ga(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(Vt,Vt),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,ba(e),e;default:if(typeof t.status==`string`)t.then(Vt,Vt);else{if(e=Pl,e!==null&&100<e.shellSuspendCounter)throw Error(i(482));e=t,e.status=`pending`,e.then(function(e){if(t.status===`pending`){var n=t;n.status=`fulfilled`,n.value=e}},function(e){if(t.status===`pending`){var n=t;n.status=`rejected`,n.reason=e}})}switch(t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,ba(e),e}throw va=t,da}}function _a(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(va=e,da):e}}var va=null;function ya(){if(va===null)throw Error(i(459));var e=va;return va=null,e}function ba(e){if(e===da||e===pa)throw Error(i(483))}var xa=null,Sa=0;function Ca(e){var t=Sa;return Sa+=1,xa===null&&(xa=[]),ga(xa,e,t)}function wa(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function Ta(e,t){throw t.$$typeof===g?Error(i(525)):(e=Object.prototype.toString.call(t),Error(i(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e)))}function Ea(e){function t(t,n){if(e){var r=t.deletions;r===null?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;r!==null;)t(n,r),r=r.sibling;return null}function r(e){for(var t=new Map;e!==null;)e.key===null?t.set(e.index,e):t.set(e.key,e),e=e.sibling;return t}function a(e,t){return e=Qr(e,t),e.index=0,e.sibling=null,e}function o(t,n,r){return t.index=r,e?(r=t.alternate,r===null?(t.flags|=67108866,n):(r=r.index,r<n?(t.flags|=67108866,n):r)):(t.flags|=1048576,n)}function s(t){return e&&t.alternate===null&&(t.flags|=67108866),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=ni(n,e.mode,r),t.return=e,t):(t=a(t,n),t.return=e,t)}function l(e,t,n,r){var i=n.type;return i===y?d(e,t,n.props.children,r,n.key):t!==null&&(t.elementType===i||typeof i==`object`&&i&&i.$$typeof===O&&_a(i)===t.type)?(t=a(t,n.props),wa(t,n),t.return=e,t):(t=ei(n.type,n.key,n.props,null,e.mode,r),wa(t,n),t.return=e,t)}function u(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=ii(n,e.mode,r),t.return=e,t):(t=a(t,n.children||[]),t.return=e,t)}function d(e,t,n,r,i){return t===null||t.tag!==7?(t=ti(n,e.mode,r,i),t.return=e,t):(t=a(t,n),t.return=e,t)}function f(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`||typeof t==`bigint`)return t=ni(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case _:return n=ei(t.type,t.key,t.props,null,e.mode,n),wa(n,t),n.return=e,n;case v:return t=ii(t,e.mode,n),t.return=e,t;case O:return t=_a(t),f(e,t,n)}if(F(t)||M(t))return t=ti(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return f(e,Ca(t),n);if(t.$$typeof===C)return f(e,Gi(e,t),n);Ta(e,t)}return null}function p(e,t,n,r){var i=t===null?null:t.key;if(typeof n==`string`&&n!==``||typeof n==`number`||typeof n==`bigint`)return i===null?c(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case _:return n.key===i?l(e,t,n,r):null;case v:return n.key===i?u(e,t,n,r):null;case O:return n=_a(n),p(e,t,n,r)}if(F(n)||M(n))return i===null?d(e,t,n,r,null):null;if(typeof n.then==`function`)return p(e,t,Ca(n),r);if(n.$$typeof===C)return p(e,t,Gi(e,n),r);Ta(e,n)}return null}function m(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`||typeof r==`bigint`)return e=e.get(n)||null,c(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case _:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case v:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case O:return r=_a(r),m(e,t,n,r,i)}if(F(r)||M(r))return e=e.get(n)||null,d(t,e,r,i,null);if(typeof r.then==`function`)return m(e,t,n,Ca(r),i);if(r.$$typeof===C)return m(e,t,n,Gi(t,r),i);Ta(t,r)}return null}function h(i,a,s,c){for(var l=null,u=null,d=a,h=a=0,g=null;d!==null&&h<s.length;h++){d.index>h?(g=d,d=null):g=d.sibling;var _=p(i,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),Ci&&gi(i,h),l;if(d===null){for(;h<s.length;h++)d=f(i,s[h],c),d!==null&&(a=o(d,a,h),u===null?l=d:u.sibling=d,u=d);return Ci&&gi(i,h),l}for(d=r(d);h<s.length;h++)g=m(d,i,h,s[h],c),g!==null&&(e&&g.alternate!==null&&d.delete(g.key===null?h:g.key),a=o(g,a,h),u===null?l=g:u.sibling=g,u=g);return e&&d.forEach(function(e){return t(i,e)}),Ci&&gi(i,h),l}function g(a,s,c,l){if(c==null)throw Error(i(151));for(var u=null,d=null,h=s,g=s=0,_=null,v=c.next();h!==null&&!v.done;g++,v=c.next()){h.index>g?(_=h,h=null):_=h.sibling;var y=p(a,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(a,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(a,h),Ci&&gi(a,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return Ci&&gi(a,g),u}for(h=r(h);!v.done;g++,v=c.next())v=m(h,a,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(a,e)}),Ci&&gi(a,g),u}function b(e,r,o,c){if(typeof o==`object`&&o&&o.type===y&&o.key===null&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case _:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===y){if(r.tag===7){n(e,r.sibling),c=a(r,o.props.children),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===O&&_a(l)===r.type){n(e,r.sibling),c=a(r,o.props),wa(c,o),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}o.type===y?(c=ti(o.props.children,e.mode,c,o.key),c.return=e,e=c):(c=ei(o.type,o.key,o.props,null,e.mode,c),wa(c,o),c.return=e,e=c)}return s(e);case v:a:{for(l=o.key;r!==null;){if(r.key===l){if(r.tag===4&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),c=a(r,o.children||[]),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}c=ii(o,e.mode,c),c.return=e,e=c}return s(e);case O:return o=_a(o),b(e,r,o,c)}if(F(o))return h(e,r,o,c);if(M(o)){if(l=M(o),typeof l!=`function`)throw Error(i(150));return o=l.call(o),g(e,r,o,c)}if(typeof o.then==`function`)return b(e,r,Ca(o),c);if(o.$$typeof===C)return b(e,r,Gi(e,o),c);Ta(e,o)}return typeof o==`string`&&o!==``||typeof o==`number`||typeof o==`bigint`?(o=``+o,r!==null&&r.tag===6?(n(e,r.sibling),c=a(r,o),c.return=e,e=c):(n(e,r),c=ni(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{Sa=0;var i=b(e,t,n,r);return xa=null,i}catch(t){if(t===da||t===pa)throw t;var a=Xr(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var Da=Ea(!0),Oa=Ea(!1),ka=!1;function Aa(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function ja(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Ma(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Na(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Nl&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=qr(e),Kr(e,null,n),t}return Ur(e,r,t,n),qr(e)}function Pa(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ve(e,n)}}function Fa(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Ia=!1;function La(){if(Ia){var e=na;if(e!==null)throw e}}function Ra(e,t,n,r){Ia=!1;var i=e.updateQueue;ka=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane&-536870913,p=f!==s.lane;if(p?(Il&f)===f:(r&f)===f){f!==0&&f===ta&&(Ia=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var h=e,g=s;f=t;var _=n;switch(g.tag){case 1:if(h=g.payload,typeof h==`function`){d=h.call(_,d,f);break a}d=h;break a;case 3:h.flags=h.flags&-65537|128;case 0:if(h=g.payload,f=typeof h==`function`?h.call(_,d,f):h,f==null)break a;d=m({},d,f);break a;case 2:ka=!0}}f=s.callback,f!==null&&(e.flags|=64,p&&(e.flags|=8192),p=i.callbacks,p===null?i.callbacks=[f]:p.push(f))}else p={lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;p=s,s=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),Wl|=o,e.lanes=o,e.memoizedState=d}}function za(e,t){if(typeof e!=`function`)throw Error(i(191,e));e.call(t)}function Ba(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)za(n[e],t)}var Va=B(null),Ha=B(0);function Ua(e,t){e=Hl,H(Ha,e),H(Va,t),Hl=e|t.baseLanes}function Wa(){H(Ha,Hl),H(Va,Va.current)}function Ga(){Hl=Ha.current,V(Va),V(Ha)}var Ka=B(null),qa=null;function Ja(e){var t=e.alternate;H($a,$a.current&1),H(Ka,e),qa===null&&(t===null||Va.current!==null||t.memoizedState!==null)&&(qa=e)}function Ya(e){H($a,$a.current),H(Ka,e),qa===null&&(qa=e)}function Xa(e){e.tag===22?(H($a,$a.current),H(Ka,e),qa===null&&(qa=e)):Za(e)}function Za(){H($a,$a.current),H(Ka,Ka.current)}function Qa(e){V(Ka),qa===e&&(qa=null),V($a)}var $a=B(0);function eo(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||of(n)||sf(n)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder===`forwards`||t.memoizedProps.revealOrder===`backwards`||t.memoizedProps.revealOrder===`unstable_legacy-backwards`||t.memoizedProps.revealOrder===`together`)){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var to=0,no=null,ro=null,io=null,ao=!1,oo=!1,so=!1,co=0,lo=0,uo=null,fo=0;function po(){throw Error(i(321))}function mo(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!ur(e[n],t[n]))return!1;return!0}function ho(e,t,n,r,i,a){return to=a,no=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,I.H=e===null||e.memoizedState===null?Ms:Ns,so=!1,a=n(r,i),so=!1,oo&&(a=_o(t,n,r,i)),go(e),a}function go(e){I.H=js;var t=ro!==null&&ro.next!==null;if(to=0,io=ro=no=null,ao=!1,lo=0,uo=null,t)throw Error(i(300));e===null||Xs||(e=e.dependencies,e!==null&&Hi(e)&&(Xs=!0))}function _o(e,t,n,r){no=e;var a=0;do{if(oo&&(uo=null),lo=0,oo=!1,25<=a)throw Error(i(301));if(a+=1,io=ro=null,e.updateQueue!=null){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,o.memoCache!=null&&(o.memoCache.index=0)}I.H=Ps,o=t(n,r)}while(oo);return o}function vo(){var e=I.H,t=e.useState()[0];return t=typeof t.then==`function`?To(t):t,e=e.useState()[0],(ro===null?null:ro.memoizedState)!==e&&(no.flags|=1024),t}function yo(){var e=co!==0;return co=0,e}function bo(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function xo(e){if(ao){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}ao=!1}to=0,io=ro=no=null,oo=!1,lo=co=0,uo=null}function So(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return io===null?no.memoizedState=io=e:io=io.next=e,io}function Co(){if(ro===null){var e=no.alternate;e=e===null?null:e.memoizedState}else e=ro.next;var t=io===null?no.memoizedState:io.next;if(t!==null)io=t,ro=e;else{if(e===null)throw no.alternate===null?Error(i(467)):Error(i(310));ro=e,e={memoizedState:ro.memoizedState,baseState:ro.baseState,baseQueue:ro.baseQueue,queue:ro.queue,next:null},io===null?no.memoizedState=io=e:io=io.next=e}return io}function wo(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function To(e){var t=lo;return lo+=1,uo===null&&(uo=[]),e=ga(uo,e,t),t=no,(io===null?t.memoizedState:io.next)===null&&(t=t.alternate,I.H=t===null||t.memoizedState===null?Ms:Ns),e}function Eo(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return To(e);if(e.$$typeof===C)return Wi(e)}throw Error(i(438,String(e)))}function Do(e){var t=null,n=no.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=no.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(e){return e.slice()}),index:0})))}if(t??={data:[],index:0},n===null&&(n=wo(),no.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),r=0;r<e;r++)n[r]=A;return t.index++,n}function Oo(e,t){return typeof t==`function`?t(e):t}function ko(e){return Ao(Co(),ro,e)}function Ao(e,t,n){var r=e.queue;if(r===null)throw Error(i(311));r.lastRenderedReducer=n;var a=e.baseQueue,o=r.pending;if(o!==null){if(a!==null){var s=a.next;a.next=o.next,o.next=s}t.baseQueue=a=o,r.pending=null}if(o=e.baseState,a===null)e.memoizedState=o;else{t=a.next;var c=s=null,l=null,u=t,d=!1;do{var f=u.lane&-536870913;if(f===u.lane?(to&f)===f:(Il&f)===f){var p=u.revertLane;if(p===0)l!==null&&(l=l.next={lane:0,revertLane:0,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),f===ta&&(d=!0);else if((to&p)===p){u=u.next,p===ta&&(d=!0);continue}else f={lane:0,revertLane:u.revertLane,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=f,s=o):l=l.next=f,no.lanes|=p,Wl|=p;f=u.action,so&&n(o,f),o=u.hasEagerState?u.eagerState:n(o,f)}else p={lane:f,revertLane:u.revertLane,gesture:u.gesture,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=p,s=o):l=l.next=p,no.lanes|=f,Wl|=f;u=u.next}while(u!==null&&u!==t);if(l===null?s=o:l.next=c,!ur(o,e.memoizedState)&&(Xs=!0,d&&(n=na,n!==null)))throw n;e.memoizedState=o,e.baseState=s,e.baseQueue=l,r.lastRenderedState=o}return a===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function jo(e){var t=Co(),n=t.queue;if(n===null)throw Error(i(311));n.lastRenderedReducer=e;var r=n.dispatch,a=n.pending,o=t.memoizedState;if(a!==null){n.pending=null;var s=a=a.next;do o=e(o,s.action),s=s.next;while(s!==a);ur(o,t.memoizedState)||(Xs=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function Mo(e,t,n){var r=no,a=Co(),o=Ci;if(o){if(n===void 0)throw Error(i(407));n=n()}else n=t();var s=!ur((ro||a).memoizedState,n);if(s&&(a.memoizedState=n,Xs=!0),a=a.queue,rs(Fo.bind(null,r,a,e),[e]),a.getSnapshot!==t||s||io!==null&&io.memoizedState.tag&1){if(r.flags|=2048,Qo(9,{destroy:void 0},Po.bind(null,r,a,n,t),null),Pl===null)throw Error(i(349));o||to&127||No(r,t,n)}return n}function No(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=no.updateQueue,t===null?(t=wo(),no.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Po(e,t,n,r){t.value=n,t.getSnapshot=r,Io(t)&&Lo(e)}function Fo(e,t,n){return n(function(){Io(t)&&Lo(e)})}function Io(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!ur(e,n)}catch{return!0}}function Lo(e){var t=Gr(e,2);t!==null&&mu(t,e,2)}function Ro(e){var t=So();if(typeof e==`function`){var n=e;if(e=n(),so){Te(!0);try{n()}finally{Te(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Oo,lastRenderedState:e},t}function zo(e,t,n,r){return e.baseState=n,Ao(e,ro,typeof r==`function`?r:Oo)}function Bo(e,t,n,r,a){if(Os(e))throw Error(i(485));if(e=t.action,e!==null){var o={payload:a,action:e,next:null,isTransition:!0,status:`pending`,value:null,reason:null,listeners:[],then:function(e){o.listeners.push(e)}};I.T===null?o.isTransition=!1:n(!0),r(o),n=t.pending,n===null?(o.next=t.pending=o,Vo(t,o)):(o.next=n.next,t.pending=n.next=o)}}function Vo(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var a=I.T,o={};I.T=o;try{var s=n(i,r),c=I.S;c!==null&&c(o,s),Ho(e,t,s)}catch(n){Wo(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),I.T=a}}else try{a=n(i,r),Ho(e,t,a)}catch(n){Wo(e,t,n)}}function Ho(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){Uo(e,t,n)},function(n){return Wo(e,t,n)}):Uo(e,t,n)}function Uo(e,t,n){t.status=`fulfilled`,t.value=n,Go(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,Vo(e,n)))}function Wo(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,Go(t),t=t.next;while(t!==r)}e.action=null}function Go(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Ko(e,t){return t}function qo(e,t){if(Ci){var n=Pl.formState;if(n!==null){a:{var r=no;if(Ci){if(Si){b:{for(var i=Si,a=Ti;i.nodeType!==8;){if(!a){i=null;break b}if(i=lf(i.nextSibling),i===null){i=null;break b}}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){Si=lf(i.nextSibling),r=i.data===`F!`;break a}}Di(r)}r=!1}r&&(t=n[0])}}return n=So(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ko,lastRenderedState:t},n.queue=r,n=Ts.bind(null,no,r),r.dispatch=n,r=Ro(!1),a=Ds.bind(null,no,!1,r.queue),r=So(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=Bo.bind(null,no,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function Jo(e){return Yo(Co(),ro,e)}function Yo(e,t,n){if(t=Ao(e,t,Ko)[0],e=ko(Oo)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=To(t)}catch(e){throw e===da?pa:e}else r=t;t=Co();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(no.flags|=2048,Qo(9,{destroy:void 0},Xo.bind(null,i,n),null)),[r,a,e]}function Xo(e,t){e.action=t}function Zo(e){var t=Co(),n=ro;if(n!==null)return Yo(t,n,e);Co(),t=t.memoizedState,n=Co();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function Qo(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=no.updateQueue,t===null&&(t=wo(),no.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function $o(){return Co().memoizedState}function es(e,t,n,r){var i=So();no.flags|=e,i.memoizedState=Qo(1|t,{destroy:void 0},n,r===void 0?null:r)}function ts(e,t,n,r){var i=Co();r=r===void 0?null:r;var a=i.memoizedState.inst;ro!==null&&r!==null&&mo(r,ro.memoizedState.deps)?i.memoizedState=Qo(t,a,n,r):(no.flags|=e,i.memoizedState=Qo(1|t,a,n,r))}function ns(e,t){es(8390656,8,e,t)}function rs(e,t){ts(2048,8,e,t)}function is(e){no.flags|=4;var t=no.updateQueue;if(t===null)t=wo(),no.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function as(e){var t=Co().memoizedState;return is({ref:t,nextImpl:e}),function(){if(Nl&2)throw Error(i(440));return t.impl.apply(void 0,arguments)}}function os(e,t){return ts(4,2,e,t)}function ss(e,t){return ts(4,4,e,t)}function cs(e,t){if(typeof t==`function`){e=e();var n=t(e);return function(){typeof n==`function`?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function ls(e,t,n){n=n==null?null:n.concat([e]),ts(4,4,cs.bind(null,t,e),n)}function us(){}function ds(e,t){var n=Co();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&mo(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function fs(e,t){var n=Co();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&mo(t,r[1]))return r[0];if(r=e(),so){Te(!0);try{e()}finally{Te(!1)}}return n.memoizedState=[r,t],r}function ps(e,t,n){return n===void 0||to&1073741824&&!(Il&261930)?e.memoizedState=t:(e.memoizedState=n,e=pu(),no.lanes|=e,Wl|=e,n)}function ms(e,t,n,r){return ur(n,t)?n:Va.current===null?!(to&42)||to&1073741824&&!(Il&261930)?(Xs=!0,e.memoizedState=n):(e=pu(),no.lanes|=e,Wl|=e,t):(e=ps(e,n,r),ur(e,t)||(Xs=!0),e)}function hs(e,t,n,r,i){var a=L.p;L.p=a!==0&&8>a?a:8;var o=I.T,s={};I.T=s,Ds(e,!1,t,n);try{var c=i(),l=I.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?Es(e,t,aa(c,r),fu(e)):Es(e,t,r,fu(e))}catch(n){Es(e,t,{then:function(){},status:`rejected`,reason:n},fu())}finally{L.p=a,o!==null&&s.types!==null&&(o.types=s.types),I.T=o}}function gs(){}function _s(e,t,n,r){if(e.tag!==5)throw Error(i(476));var a=vs(e).queue;hs(e,a,t,R,n===null?gs:function(){return ys(e),n(r)})}function vs(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:R,baseState:R,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Oo,lastRenderedState:R},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Oo,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function ys(e){var t=vs(e);t.next===null&&(t=e.alternate.memoizedState),Es(e,t.next.queue,{},fu())}function bs(){return Wi($f)}function xs(){return Co().memoizedState}function Ss(){return Co().memoizedState}function Cs(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=fu();e=Ma(n);var r=Na(t,e,n);r!==null&&(mu(r,t,n),Pa(r,t,n)),t={cache:Zi()},e.payload=t;return}t=t.return}}function ws(e,t,n){var r=fu();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Os(e)?ks(t,n):(n=Wr(e,t,n,r),n!==null&&(mu(n,e,r),As(n,t,r)))}function Ts(e,t,n){Es(e,t,n,fu())}function Es(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Os(e))ks(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,ur(s,o))return Ur(e,t,i,0),Pl===null&&Hr(),!1}catch{}if(n=Wr(e,t,i,r),n!==null)return mu(n,e,r),As(n,t,r),!0}return!1}function Ds(e,t,n,r){if(r={lane:2,revertLane:dd(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Os(e)){if(t)throw Error(i(479))}else t=Wr(e,n,r,2),t!==null&&mu(t,e,2)}function Os(e){var t=e.alternate;return e===no||t!==null&&t===no}function ks(e,t){oo=ao=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function As(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ve(e,n)}}var js={readContext:Wi,use:Eo,useCallback:po,useContext:po,useEffect:po,useImperativeHandle:po,useLayoutEffect:po,useInsertionEffect:po,useMemo:po,useReducer:po,useRef:po,useState:po,useDebugValue:po,useDeferredValue:po,useTransition:po,useSyncExternalStore:po,useId:po,useHostTransitionStatus:po,useFormState:po,useActionState:po,useOptimistic:po,useMemoCache:po,useCacheRefresh:po};js.useEffectEvent=po;var Ms={readContext:Wi,use:Eo,useCallback:function(e,t){return So().memoizedState=[e,t===void 0?null:t],e},useContext:Wi,useEffect:ns,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),es(4194308,4,cs.bind(null,t,e),n)},useLayoutEffect:function(e,t){return es(4194308,4,e,t)},useInsertionEffect:function(e,t){es(4,2,e,t)},useMemo:function(e,t){var n=So();t=t===void 0?null:t;var r=e();if(so){Te(!0);try{e()}finally{Te(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=So();if(n!==void 0){var i=n(t);if(so){Te(!0);try{n(t)}finally{Te(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=ws.bind(null,no,e),[r.memoizedState,e]},useRef:function(e){var t=So();return e={current:e},t.memoizedState=e},useState:function(e){e=Ro(e);var t=e.queue,n=Ts.bind(null,no,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:us,useDeferredValue:function(e,t){return ps(So(),e,t)},useTransition:function(){var e=Ro(!1);return e=hs.bind(null,no,e.queue,!0,!1),So().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=no,a=So();if(Ci){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),Pl===null)throw Error(i(349));Il&127||No(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,ns(Fo.bind(null,r,o,e),[e]),r.flags|=2048,Qo(9,{destroy:void 0},Po.bind(null,r,o,n,t),null),n},useId:function(){var e=So(),t=Pl.identifierPrefix;if(Ci){var n=hi,r=mi;n=(r&~(1<<32-Ee(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=co++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=fo++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:bs,useFormState:qo,useActionState:qo,useOptimistic:function(e){var t=So();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=Ds.bind(null,no,!0,n),n.dispatch=t,[e,t]},useMemoCache:Do,useCacheRefresh:function(){return So().memoizedState=Cs.bind(null,no)},useEffectEvent:function(e){var t=So(),n={impl:e};return t.memoizedState=n,function(){if(Nl&2)throw Error(i(440));return n.impl.apply(void 0,arguments)}}},Ns={readContext:Wi,use:Eo,useCallback:ds,useContext:Wi,useEffect:rs,useImperativeHandle:ls,useInsertionEffect:os,useLayoutEffect:ss,useMemo:fs,useReducer:ko,useRef:$o,useState:function(){return ko(Oo)},useDebugValue:us,useDeferredValue:function(e,t){return ms(Co(),ro.memoizedState,e,t)},useTransition:function(){var e=ko(Oo)[0],t=Co().memoizedState;return[typeof e==`boolean`?e:To(e),t]},useSyncExternalStore:Mo,useId:xs,useHostTransitionStatus:bs,useFormState:Jo,useActionState:Jo,useOptimistic:function(e,t){return zo(Co(),ro,e,t)},useMemoCache:Do,useCacheRefresh:Ss};Ns.useEffectEvent=as;var Ps={readContext:Wi,use:Eo,useCallback:ds,useContext:Wi,useEffect:rs,useImperativeHandle:ls,useInsertionEffect:os,useLayoutEffect:ss,useMemo:fs,useReducer:jo,useRef:$o,useState:function(){return jo(Oo)},useDebugValue:us,useDeferredValue:function(e,t){var n=Co();return ro===null?ps(n,e,t):ms(n,ro.memoizedState,e,t)},useTransition:function(){var e=jo(Oo)[0],t=Co().memoizedState;return[typeof e==`boolean`?e:To(e),t]},useSyncExternalStore:Mo,useId:xs,useHostTransitionStatus:bs,useFormState:Zo,useActionState:Zo,useOptimistic:function(e,t){var n=Co();return ro===null?(n.baseState=e,[e,n.queue.dispatch]):zo(n,ro,e,t)},useMemoCache:Do,useCacheRefresh:Ss};Ps.useEffectEvent=as;function Fs(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:m({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Is={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=fu(),i=Ma(r);i.payload=t,n!=null&&(i.callback=n),t=Na(e,i,r),t!==null&&(mu(t,e,r),Pa(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=fu(),i=Ma(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=Na(e,i,r),t!==null&&(mu(t,e,r),Pa(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=fu(),r=Ma(n);r.tag=2,t!=null&&(r.callback=t),t=Na(e,r,n),t!==null&&(mu(t,e,n),Pa(t,e,n))}};function Ls(e,t,n,r,i,a,o){return e=e.stateNode,typeof e.shouldComponentUpdate==`function`?e.shouldComponentUpdate(r,a,o):t.prototype&&t.prototype.isPureReactComponent?!dr(n,r)||!dr(i,a):!0}function Rs(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps==`function`&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps==`function`&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&Is.enqueueReplaceState(t,t.state,null)}function zs(e,t){var n=t;if(`ref`in t)for(var r in n={},t)r!==`ref`&&(n[r]=t[r]);if(e=e.defaultProps)for(var i in n===t&&(n=m({},n)),e)n[i]===void 0&&(n[i]=e[i]);return n}function Bs(e){Rr(e)}function Vs(e){console.error(e)}function Hs(e){Rr(e)}function Us(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function Ws(e,t,n){try{var r=e.onCaughtError;r(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(e){setTimeout(function(){throw e})}}function Gs(e,t,n){return n=Ma(n),n.tag=3,n.payload={element:null},n.callback=function(){Us(e,t)},n}function Ks(e){return e=Ma(e),e.tag=3,e}function qs(e,t,n,r){var i=n.type.getDerivedStateFromError;if(typeof i==`function`){var a=r.value;e.payload=function(){return i(a)},e.callback=function(){Ws(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){Ws(t,n,r),typeof i!=`function`&&(nu===null?nu=new Set([this]):nu.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function Js(e,t,n,r,a){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&Vi(t,n,a,!0),n=Ka.current,n!==null){switch(n.tag){case 31:case 13:return qa===null?Eu():n.alternate===null&&Ul===0&&(Ul=3),n.flags&=-257,n.flags|=65536,n.lanes=a,r===ma?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),Gu(e,r,a)),!1;case 22:return n.flags|=65536,r===ma?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([r]):n.add(r)),Gu(e,r,a)),!1}throw Error(i(435,n.tag))}return Gu(e,r,a),Eu(),!1}if(Ci)return t=Ka.current,t===null?(r!==Ei&&(t=Error(i(423),{cause:r}),Ni(oi(t,n))),e=e.current.alternate,e.flags|=65536,a&=-a,e.lanes|=a,r=oi(r,n),a=Gs(e.stateNode,r,a),Fa(e,a),Ul!==4&&(Ul=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=a,r!==Ei&&(e=Error(i(422),{cause:r}),Ni(oi(e,n)))),!1;var o=Error(i(520),{cause:r});if(o=oi(o,n),Yl===null?Yl=[o]:Yl.push(o),Ul!==4&&(Ul=2),t===null)return!0;r=oi(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=a&-a,n.lanes|=e,e=Gs(n.stateNode,r,e),Fa(n,e),!1;case 1:if(t=n.type,o=n.stateNode,!(n.flags&128)&&(typeof t.getDerivedStateFromError==`function`||o!==null&&typeof o.componentDidCatch==`function`&&(nu===null||!nu.has(o))))return n.flags|=65536,a&=-a,n.lanes|=a,a=Ks(a),qs(a,e,n,r),Fa(n,a),!1}n=n.return}while(n!==null);return!1}var Ys=Error(i(461)),Xs=!1;function Zs(e,t,n,r){t.child=e===null?Oa(t,null,n,r):Da(t,e.child,n,r)}function Qs(e,t,n,r,i){n=n.render;var a=t.ref;if(`ref`in r){var o={};for(var s in r)s!==`ref`&&(o[s]=r[s])}else o=r;return Ui(t),r=ho(e,t,n,o,a,i),s=yo(),e!==null&&!Xs?(bo(e,t,i),Sc(e,t,i)):(Ci&&s&&vi(t),t.flags|=1,Zs(e,t,r,i),t.child)}function $s(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!Zr(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,ec(e,t,a,r,i)):(e=ei(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!Cc(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?dr:n,n(o,r)&&e.ref===t.ref)return Sc(e,t,i)}return t.flags|=1,e=Qr(a,r),e.ref=t.ref,e.return=t,t.child=e}function ec(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(dr(a,r)&&e.ref===t.ref){if(Xs=!1,t.pendingProps=r=a,Cc(e,i))e.flags&131072&&(Xs=!0);else return t.lanes=e.lanes,Sc(e,t,i)}}return cc(e,t,n,r,i)}function tc(e,t,n,r){var i=r.children,a=e===null?null:e.memoizedState;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode===`hidden`){if(t.flags&128){if(a=a===null?n:a.baseLanes|n,e!==null){for(r=t.child=e.child,i=0;r!==null;)i=i|r.lanes|r.childLanes,r=r.sibling;r=i&~a}else r=0,t.child=null;return rc(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&la(t,a===null?null:a.cachePool),a===null?Wa():Ua(t,a),Xa(t);else return r=t.lanes=536870912,rc(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&la(t,null),Wa(),Za(t)):(la(t,a.cachePool),Ua(t,a),Za(t),t.memoizedState=null);return Zs(e,t,i,n),t.child}function nc(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function rc(e,t,n,r,i){var a=ca();return a=a===null?null:{parent:Xi._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&la(t,null),Wa(),Xa(t),e!==null&&Vi(e,t,r,!0),t.childLanes=i,null}function ic(e,t){return t=_c({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function ac(e,t,n){return Da(t,e.child,null,n),e=ic(t,t.pendingProps),e.flags|=2,Qa(t),t.memoizedState=null,e}function oc(e,t,n){var r=t.pendingProps,a=!!(t.flags&128);if(t.flags&=-129,e===null){if(Ci){if(r.mode===`hidden`)return e=ic(t,r),t.lanes=536870912,nc(null,e);if(Ya(t),(e=Si)?(e=af(e,Ti),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:pi===null?null:{id:mi,overflow:hi},retryLane:536870912,hydrationErrors:null},n=ri(e),n.return=t,t.child=n,xi=t,Si=null)):e=null,e===null)throw Di(t);return t.lanes=536870912,null}return ic(t,r)}var o=e.memoizedState;if(o!==null){var s=o.dehydrated;if(Ya(t),a){if(t.flags&256)t.flags&=-257,t=ac(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(i(558))}else if(Xs||Vi(e,t,n,!1),a=(n&e.childLanes)!==0,Xs||a){if(r=Pl,r!==null&&(s=He(r,n),s!==0&&s!==o.retryLane))throw o.retryLane=s,Gr(e,s),mu(r,e,s),Ys;Eu(),t=ac(e,t,n)}else e=o.treeContext,Si=lf(s.nextSibling),xi=t,Ci=!0,wi=null,Ti=!1,e!==null&&bi(t,e),t=ic(t,r),t.flags|=4096;return t}return e=Qr(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function sc(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!=`function`&&typeof n!=`object`)throw Error(i(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function cc(e,t,n,r,i){return Ui(t),n=ho(e,t,n,r,void 0,i),r=yo(),e!==null&&!Xs?(bo(e,t,i),Sc(e,t,i)):(Ci&&r&&vi(t),t.flags|=1,Zs(e,t,n,i),t.child)}function lc(e,t,n,r,i,a){return Ui(t),t.updateQueue=null,n=_o(t,r,n,i),go(e),r=yo(),e!==null&&!Xs?(bo(e,t,a),Sc(e,t,a)):(Ci&&r&&vi(t),t.flags|=1,Zs(e,t,n,a),t.child)}function uc(e,t,n,r,i){if(Ui(t),t.stateNode===null){var a=Jr,o=n.contextType;typeof o==`object`&&o&&(a=Wi(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=Is,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},Aa(t),o=n.contextType,a.context=typeof o==`object`&&o?Wi(o):Jr,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(Fs(t,n,o,r),a.state=t.memoizedState),typeof n.getDerivedStateFromProps==`function`||typeof a.getSnapshotBeforeUpdate==`function`||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(o=a.state,typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount(),o!==a.state&&Is.enqueueReplaceState(a,a.state,null),Ra(t,r,a,i),La(),a.state=t.memoizedState),typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!0}else if(e===null){a=t.stateNode;var s=t.memoizedProps,c=zs(n,s);a.props=c;var l=a.context,u=n.contextType;o=Jr,typeof u==`object`&&u&&(o=Wi(u));var d=n.getDerivedStateFromProps;u=typeof d==`function`||typeof a.getSnapshotBeforeUpdate==`function`,s=t.pendingProps!==s,u||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(s||l!==o)&&Rs(t,a,r,o),ka=!1;var f=t.memoizedState;a.state=f,Ra(t,r,a,i),La(),l=t.memoizedState,s||f!==l||ka?(typeof d==`function`&&(Fs(t,n,d,r),l=t.memoizedState),(c=ka||Ls(t,n,c,r,f,l,o))?(u||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount==`function`&&(t.flags|=4194308)):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),a.props=r,a.state=l,a.context=o,r=c):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,ja(e,t),o=t.memoizedProps,u=zs(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=Jr,typeof l==`object`&&l&&(c=Wi(l)),s=n.getDerivedStateFromProps,(l=typeof s==`function`||typeof a.getSnapshotBeforeUpdate==`function`)||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(o!==d||f!==c)&&Rs(t,a,r,c),ka=!1,f=t.memoizedState,a.state=f,Ra(t,r,a,i),La();var p=t.memoizedState;o!==d||f!==p||ka||e!==null&&e.dependencies!==null&&Hi(e.dependencies)?(typeof s==`function`&&(Fs(t,n,s,r),p=t.memoizedState),(u=ka||Ls(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&Hi(e.dependencies))?(l||typeof a.UNSAFE_componentWillUpdate!=`function`&&typeof a.componentWillUpdate!=`function`||(typeof a.componentWillUpdate==`function`&&a.componentWillUpdate(r,p,c),typeof a.UNSAFE_componentWillUpdate==`function`&&a.UNSAFE_componentWillUpdate(r,p,c)),typeof a.componentDidUpdate==`function`&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),a.props=r,a.state=p,a.context=c,r=u):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return a=r,sc(e,t),r=!!(t.flags&128),a||r?(a=t.stateNode,n=r&&typeof n.getDerivedStateFromError!=`function`?null:a.render(),t.flags|=1,e!==null&&r?(t.child=Da(t,e.child,null,i),t.child=Da(t,null,n,i)):Zs(e,t,n,i),t.memoizedState=a.state,e=t.child):e=Sc(e,t,i),e}function dc(e,t,n,r){return ji(),t.flags|=256,Zs(e,t,n,r),t.child}var fc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function pc(e){return{baseLanes:e,cachePool:ua()}}function mc(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=ql),e}function hc(e,t,n){var r=t.pendingProps,a=!1,o=!!(t.flags&128),s;if((s=o)||(s=e!==null&&e.memoizedState===null?!1:!!($a.current&2)),s&&(a=!0,t.flags&=-129),s=!!(t.flags&32),t.flags&=-33,e===null){if(Ci){if(a?Ja(t):Za(t),(e=Si)?(e=af(e,Ti),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:pi===null?null:{id:mi,overflow:hi},retryLane:536870912,hydrationErrors:null},n=ri(e),n.return=t,t.child=n,xi=t,Si=null)):e=null,e===null)throw Di(t);return sf(e)?t.lanes=32:t.lanes=536870912,null}var c=r.children;return r=r.fallback,a?(Za(t),a=t.mode,c=_c({mode:`hidden`,children:c},a),r=ti(r,a,n,null),c.return=t,r.return=t,c.sibling=r,t.child=c,r=t.child,r.memoizedState=pc(n),r.childLanes=mc(e,s,n),t.memoizedState=fc,nc(null,r)):(Ja(t),gc(t,c))}var l=e.memoizedState;if(l!==null&&(c=l.dehydrated,c!==null)){if(o)t.flags&256?(Ja(t),t.flags&=-257,t=vc(e,t,n)):t.memoizedState===null?(Za(t),c=r.fallback,a=t.mode,r=_c({mode:`visible`,children:r.children},a),c=ti(c,a,n,null),c.flags|=2,r.return=t,c.return=t,r.sibling=c,t.child=r,Da(t,e.child,null,n),r=t.child,r.memoizedState=pc(n),r.childLanes=mc(e,s,n),t.memoizedState=fc,t=nc(null,r)):(Za(t),t.child=e.child,t.flags|=128,t=null);else if(Ja(t),sf(c)){if(s=c.nextSibling&&c.nextSibling.dataset,s)var u=s.dgst;s=u,r=Error(i(419)),r.stack=``,r.digest=s,Ni({value:r,source:null,stack:null}),t=vc(e,t,n)}else if(Xs||Vi(e,t,n,!1),s=(n&e.childLanes)!==0,Xs||s){if(s=Pl,s!==null&&(r=He(s,n),r!==0&&r!==l.retryLane))throw l.retryLane=r,Gr(e,r),mu(s,e,r),Ys;of(c)||Eu(),t=vc(e,t,n)}else of(c)?(t.flags|=192,t.child=e.child,t=null):(e=l.treeContext,Si=lf(c.nextSibling),xi=t,Ci=!0,wi=null,Ti=!1,e!==null&&bi(t,e),t=gc(t,r.children),t.flags|=4096);return t}return a?(Za(t),c=r.fallback,a=t.mode,l=e.child,u=l.sibling,r=Qr(l,{mode:`hidden`,children:r.children}),r.subtreeFlags=l.subtreeFlags&65011712,u===null?(c=ti(c,a,n,null),c.flags|=2):c=Qr(u,c),c.return=t,r.return=t,r.sibling=c,t.child=r,nc(null,r),r=t.child,c=e.child.memoizedState,c===null?c=pc(n):(a=c.cachePool,a===null?a=ua():(l=Xi._currentValue,a=a.parent===l?a:{parent:l,pool:l}),c={baseLanes:c.baseLanes|n,cachePool:a}),r.memoizedState=c,r.childLanes=mc(e,s,n),t.memoizedState=fc,nc(e.child,r)):(Ja(t),n=e.child,e=n.sibling,n=Qr(n,{mode:`visible`,children:r.children}),n.return=t,n.sibling=null,e!==null&&(s=t.deletions,s===null?(t.deletions=[e],t.flags|=16):s.push(e)),t.child=n,t.memoizedState=null,n)}function gc(e,t){return t=_c({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function _c(e,t){return e=Xr(22,e,null,t),e.lanes=0,e}function vc(e,t,n){return Da(t,e.child,null,n),e=gc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function yc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),zi(e.return,t,n)}function bc(e,t,n,r,i,a){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i,treeForkCount:a}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i,o.treeForkCount=a)}function xc(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=$a.current,s=!!(o&2);if(s?(o=o&1|2,t.flags|=128):o&=1,H($a,o),Zs(e,t,r,n),r=Ci?ui:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&yc(e,n,t);else if(e.tag===19)yc(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;e.sibling===null;){if(e.return===null||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(i){case`forwards`:for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&eo(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),bc(t,!1,i,n,a,r);break;case`backwards`:case`unstable_legacy-backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&eo(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}bc(t,!0,n,null,a,r);break;case`together`:bc(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function Sc(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Wl|=t.lanes,(n&t.childLanes)===0){if(e!==null){if(Vi(e,t,n,!1),(n&t.childLanes)===0)return null}else return null}if(e!==null&&t.child!==e.child)throw Error(i(153));if(t.child!==null){for(e=t.child,n=Qr(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Qr(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Cc(e,t){return(e.lanes&t)!==0||(e=e.dependencies,!!(e!==null&&Hi(e)))}function wc(e,t,n){switch(t.tag){case 3:q(t,t.stateNode.containerInfo),Li(t,Xi,e.memoizedState.cache),ji();break;case 27:case 5:Y(t);break;case 4:q(t,t.stateNode.containerInfo);break;case 10:Li(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Ya(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(Ja(t),e=Sc(e,t,n),e===null?null:e.sibling):hc(e,t,n):(Ja(t),t.flags|=128,null);Ja(t);break;case 19:var i=!!(e.flags&128);if(r=(n&t.childLanes)!==0,r||=(Vi(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return xc(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),H($a,$a.current),r)break;return null;case 22:return t.lanes=0,tc(e,t,n,t.pendingProps);case 24:Li(t,Xi,e.memoizedState.cache)}return Sc(e,t,n)}function Tc(e,t,n){if(e!==null){if(e.memoizedProps!==t.pendingProps)Xs=!0;else{if(!Cc(e,n)&&!(t.flags&128))return Xs=!1,wc(e,t,n);Xs=!!(e.flags&131072)}}else Xs=!1,Ci&&t.flags&1048576&&_i(t,ui,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=_a(t.elementType),t.type=e,typeof e==`function`)Zr(e)?(r=zs(e,r),t.tag=1,t=uc(null,t,e,r,n)):(t.tag=0,t=cc(null,t,e,r,n));else{if(e!=null){var a=e.$$typeof;if(a===w){t.tag=11,t=Qs(null,t,e,r,n);break a}if(a===D){t.tag=14,t=$s(null,t,e,r,n);break a}}throw t=P(e)||e,Error(i(306,t,``))}}return t;case 0:return cc(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,a=zs(r,t.pendingProps),uc(e,t,r,a,n);case 3:a:{if(q(t,t.stateNode.containerInfo),e===null)throw Error(i(387));r=t.pendingProps;var o=t.memoizedState;a=o.element,ja(e,t),Ra(t,r,null,n);var s=t.memoizedState;if(r=s.cache,Li(t,Xi,r),r!==o.cache&&Bi(t,[Xi],n,!0),La(),r=s.element,o.isDehydrated){if(o={element:r,isDehydrated:!1,cache:s.cache},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){t=dc(e,t,r,n);break a}if(r!==a){a=oi(Error(i(424)),t),Ni(a),t=dc(e,t,r,n);break a}switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName===`HTML`?e.ownerDocument.body:e}for(Si=lf(e.firstChild),xi=t,Ci=!0,wi=null,Ti=!0,n=Oa(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(ji(),r===a){t=Sc(e,t,n);break a}Zs(e,t,r,n)}t=t.child}return t;case 26:return sc(e,t),e===null?(n=Af(t.type,null,t.pendingProps,null))?t.memoizedState=n:Ci||(n=t.type,e=t.pendingProps,r=Vd(G.current).createElement(n),r[Je]=t,r[Ye]=e,Fd(r,n,e),st(r),t.stateNode=r):t.memoizedState=Af(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Y(t),e===null&&Ci&&(r=t.stateNode=pf(t.type,t.pendingProps,G.current),xi=t,Ti=!0,a=Si,Qd(t.type)?(uf=a,Si=lf(r.firstChild)):Si=a),Zs(e,t,t.pendingProps.children,n),sc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Ci&&((a=r=Si)&&(r=nf(r,t.type,t.pendingProps,Ti),r===null?a=!1:(t.stateNode=r,xi=t,Si=lf(r.firstChild),Ti=!1,a=!0)),a||Di(t)),Y(t),a=t.type,o=t.pendingProps,s=e===null?null:e.memoizedProps,r=o.children,Wd(a,o)?r=null:s!==null&&Wd(a,s)&&(t.flags|=32),t.memoizedState!==null&&(a=ho(e,t,vo,null,null,n),$f._currentValue=a),sc(e,t),Zs(e,t,r,n),t.child;case 6:return e===null&&Ci&&((e=n=Si)&&(n=rf(n,t.pendingProps,Ti),n===null?e=!1:(t.stateNode=n,xi=t,Si=null,e=!0)),e||Di(t)),null;case 13:return hc(e,t,n);case 4:return q(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Da(t,null,r,n):Zs(e,t,r,n),t.child;case 11:return Qs(e,t,t.type,t.pendingProps,n);case 7:return Zs(e,t,t.pendingProps,n),t.child;case 8:return Zs(e,t,t.pendingProps.children,n),t.child;case 12:return Zs(e,t,t.pendingProps.children,n),t.child;case 10:return r=t.pendingProps,Li(t,t.type,r.value),Zs(e,t,r.children,n),t.child;case 9:return a=t.type._context,r=t.pendingProps.children,Ui(t),a=Wi(a),r=r(a),t.flags|=1,Zs(e,t,r,n),t.child;case 14:return $s(e,t,t.type,t.pendingProps,n);case 15:return ec(e,t,t.type,t.pendingProps,n);case 19:return xc(e,t,n);case 31:return oc(e,t,n);case 22:return tc(e,t,n,t.pendingProps);case 24:return Ui(t),r=Wi(Xi),e===null?(a=ca(),a===null&&(a=Pl,o=Zi(),a.pooledCache=o,o.refCount++,o!==null&&(a.pooledCacheLanes|=n),a=o),t.memoizedState={parent:r,cache:a},Aa(t),Li(t,Xi,a)):((e.lanes&n)!==0&&(ja(e,t),Ra(t,null,null,n),La()),a=e.memoizedState,o=t.memoizedState,a.parent===r?(r=o.cache,Li(t,Xi,r),r!==a.cache&&Bi(t,[Xi],n,!0)):(a={parent:r,cache:r},t.memoizedState=a,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=a),Li(t,Xi,r))),Zs(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(i(156,t.tag))}function Ec(e){e.flags|=4}function Dc(e,t,n,r,i){if((t=!!(e.mode&32))&&(t=!1),t){if(e.flags|=16777216,(i&335544128)===i){if(e.stateNode.complete)e.flags|=8192;else if(Cu())e.flags|=8192;else throw va=ma,fa}}else e.flags&=-16777217}function Oc(e,t){if(t.type!==`stylesheet`||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!Gf(t)){if(Cu())e.flags|=8192;else throw va=ma,fa}}function kc(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:Ie(),e.lanes|=t,Jl|=t)}function Ac(e,t){if(!Ci)switch(e.tailMode){case`hidden`:t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case`collapsed`:n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function jc(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&65011712,r|=i.flags&65011712,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function Mc(e,t,n){var r=t.pendingProps;switch(yi(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return jc(t),null;case 1:return jc(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),Ri(Xi),J(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Ai(t)?Ec(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Mi())),jc(t),null;case 26:var a=t.type,o=t.memoizedState;return e===null?(Ec(t),o===null?(jc(t),Dc(t,a,null,r,n)):(jc(t),Oc(t,o))):o?o===e.memoizedState?(jc(t),t.flags&=-16777217):(Ec(t),jc(t),Oc(t,o)):(e=e.memoizedProps,e!==r&&Ec(t),jc(t),Dc(t,a,e,r,n)),null;case 27:if(te(t),n=G.current,a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Ec(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return jc(t),null}e=U.current,Ai(t)?Oi(t,e):(e=pf(a,r,n),t.stateNode=e,Ec(t))}return jc(t),null;case 5:if(te(t),a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Ec(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return jc(t),null}if(o=U.current,Ai(t))Oi(t,o);else{var s=Vd(G.current);switch(o){case 1:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case 2:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;default:switch(a){case`svg`:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case`math`:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;case`script`:o=s.createElement(`div`),o.innerHTML=`<script><\/script>`,o=o.removeChild(o.firstChild);break;case`select`:o=typeof r.is==`string`?s.createElement(`select`,{is:r.is}):s.createElement(`select`),r.multiple?o.multiple=!0:r.size&&(o.size=r.size);break;default:o=typeof r.is==`string`?s.createElement(a,{is:r.is}):s.createElement(a)}}o[Je]=t,o[Ye]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)o.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break a;for(;s.sibling===null;){if(s.return===null||s.return===t)break a;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=o;a:switch(Fd(o,a,r),a){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&Ec(t)}}return jc(t),Dc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Ec(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(i(166));if(e=G.current,Ai(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,a=xi,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}e[Je]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||Md(e.nodeValue,n)),e||Di(t,!0)}else e=Vd(e).createTextNode(r),e[Je]=t,t.stateNode=e}return jc(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=Ai(t),n!==null){if(e===null){if(!r)throw Error(i(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(557));e[Je]=t}else ji(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;jc(t),e=!1}else n=Mi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(Qa(t),t):(Qa(t),null);if(t.flags&128)throw Error(i(558))}return jc(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=Ai(t),r!==null&&r.dehydrated!==null){if(e===null){if(!a)throw Error(i(318));if(a=t.memoizedState,a=a===null?null:a.dehydrated,!a)throw Error(i(317));a[Je]=t}else ji(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;jc(t),a=!1}else a=Mi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(Qa(t),t):(Qa(t),null)}return Qa(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,a=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(a=r.alternate.memoizedState.cachePool.pool),o=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),o!==a&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),kc(t,t.updateQueue),jc(t),null);case 4:return J(),e===null&&Sd(t.stateNode.containerInfo),jc(t),null;case 10:return Ri(t.type),jc(t),null;case 19:if(V($a),r=t.memoizedState,r===null)return jc(t),null;if(a=!!(t.flags&128),o=r.rendering,o===null){if(a)Ac(r,!1);else{if(Ul!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=eo(e),o!==null){for(t.flags|=128,Ac(r,!1),e=o.updateQueue,t.updateQueue=e,kc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)$r(n,e),n=n.sibling;return H($a,$a.current&1|2),Ci&&gi(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&me()>eu&&(t.flags|=128,a=!0,Ac(r,!1),t.lanes=4194304)}}else{if(!a){if(e=eo(o),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,kc(t,e),Ac(r,!0),r.tail===null&&r.tailMode===`hidden`&&!o.alternate&&!Ci)return jc(t),null}else 2*me()-r.renderingStartTime>eu&&n!==536870912&&(t.flags|=128,a=!0,Ac(r,!1),t.lanes=4194304)}r.isBackwards?(o.sibling=t.child,t.child=o):(e=r.last,e===null?t.child=o:e.sibling=o,r.last=o)}return r.tail===null?(jc(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=me(),e.sibling=null,n=$a.current,H($a,a?n&1|2:n&1),Ci&&gi(t,r.treeForkCount),e);case 22:case 23:return Qa(t),Ga(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(jc(t),t.subtreeFlags&6&&(t.flags|=8192)):jc(t),n=t.updateQueue,n!==null&&kc(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&V(sa),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Ri(Xi),jc(t),null;case 25:return null;case 30:return null}throw Error(i(156,t.tag))}function Nc(e,t){switch(yi(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Ri(Xi),J(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return te(t),null;case 31:if(t.memoizedState!==null){if(Qa(t),t.alternate===null)throw Error(i(340));ji()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Qa(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));ji()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return V($a),null;case 4:return J(),null;case 10:return Ri(t.type),null;case 22:case 23:return Qa(t),Ga(),e!==null&&V(sa),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Ri(Xi),null;case 25:return null;default:return null}}function Pc(e,t){switch(yi(t),t.tag){case 3:Ri(Xi),J();break;case 26:case 27:case 5:te(t);break;case 4:J();break;case 31:t.memoizedState!==null&&Qa(t);break;case 13:Qa(t);break;case 19:V($a);break;case 10:Ri(t.type);break;case 22:case 23:Qa(t),Ga(),e!==null&&V(sa);break;case 24:Ri(Xi)}}function Fc(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){Wu(t,t.return,e)}}function Ic(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){Wu(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){Wu(t,t.return,e)}}function Lc(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Ba(t,n)}catch(t){Wu(e,e.return,t)}}}function Rc(e,t,n){n.props=zs(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){Wu(e,t,n)}}function zc(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){Wu(e,t,n)}}function Z(e,t){var n=e.ref,r=e.refCleanup;if(n!==null){if(typeof r==`function`)try{r()}catch(n){Wu(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){Wu(e,t,n)}else n.current=null}}function Bc(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){Wu(e,e.return,t)}}function Vc(e,t,n){try{var r=e.stateNode;Id(r,e.type,n,t),r[Ye]=t}catch(t){Wu(e,e.return,t)}}function Hc(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Qd(e.type)||e.tag===4}function Uc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Hc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Qd(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Wc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Vt));else if(r!==4&&(r===27&&Qd(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(Wc(e,t,n),e=e.sibling;e!==null;)Wc(e,t,n),e=e.sibling}function Gc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(r===27&&Qd(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(Gc(e,t,n),e=e.sibling;e!==null;)Gc(e,t,n),e=e.sibling}function Kc(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);Fd(t,r,n),t[Je]=e,t[Ye]=n}catch(t){Wu(e,e.return,t)}}var qc=!1,Jc=!1,Yc=!1,Xc=typeof WeakSet==`function`?WeakSet:Set,Zc=null;function Qc(e,t){if(e=e.containerInfo,zd=cp,e=hr(e),gr(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var a=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||a!==0&&f.nodeType!==3||(c=s+a),f!==o||r!==0&&f.nodeType!==3||(l=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===a&&(c=s),p===o&&++d===r&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(Bd={focusedElem:e,selectionRange:n},cp=!1,Zc=t;Zc!==null;)if(t=Zc,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,Zc=e;else for(;Zc!==null;){switch(t=Zc,o=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e===null?null:e.events,e!==null))for(n=0;n<e.length;n++)a=e[n],a.ref.impl=a.nextImpl;break;case 11:case 15:break;case 1:if(e&1024&&o!==null){e=void 0,n=t,a=o.memoizedProps,o=o.memoizedState,r=n.stateNode;try{var h=zs(n.type,a);e=r.getSnapshotBeforeUpdate(h,o),r.__reactInternalSnapshotBeforeUpdate=e}catch(e){Wu(n,n.return,e)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)tf(e);else if(n===1)switch(e.nodeName){case`HEAD`:case`HTML`:case`BODY`:tf(e);break;default:e.textContent=``}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if(e&1024)throw Error(i(163))}if(e=t.sibling,e!==null){e.return=t.return,Zc=e;break}Zc=t.return}}function $c(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:ml(e,n),r&4&&Fc(5,n);break;case 1:if(ml(e,n),r&4){if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){Wu(n,n.return,e)}else{var i=zs(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){Wu(n,n.return,e)}}}r&64&&Lc(n),r&512&&zc(n,n.return);break;case 3:if(ml(e,n),r&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{Ba(e,t)}catch(e){Wu(n,n.return,e)}}break;case 27:t===null&&r&4&&Kc(n);case 26:case 5:ml(e,n),t===null&&r&4&&Bc(n),r&512&&zc(n,n.return);break;case 12:ml(e,n);break;case 31:ml(e,n),r&4&&al(e,n);break;case 13:ml(e,n),r&4&&ol(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=Ju.bind(null,n),cf(e,n))));break;case 22:if(r=n.memoizedState!==null||qc,!r){t=t!==null&&t.memoizedState!==null||Jc,i=qc;var a=Jc;qc=r,(Jc=t)&&!a?gl(e,n,!!(n.subtreeFlags&8772)):ml(e,n),qc=i,Jc=a}break;case 30:break;default:ml(e,n)}}function el(e){var t=e.alternate;t!==null&&(e.alternate=null,el(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&nt(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var tl=null,nl=!1;function rl(e,t,n){for(n=n.child;n!==null;)il(e,t,n),n=n.sibling}function il(e,t,n){if(we&&typeof we.onCommitFiberUnmount==`function`)try{we.onCommitFiberUnmount(Ce,n)}catch{}switch(n.tag){case 26:Jc||Z(n,t),rl(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:Jc||Z(n,t);var r=tl,i=nl;Qd(n.type)&&(tl=n.stateNode,nl=!1),rl(e,t,n),mf(n.stateNode),tl=r,nl=i;break;case 5:Jc||Z(n,t);case 6:if(r=tl,i=nl,tl=null,rl(e,t,n),tl=r,nl=i,tl!==null){if(nl)try{(tl.nodeType===9?tl.body:tl.nodeName===`HTML`?tl.ownerDocument.body:tl).removeChild(n.stateNode)}catch(e){Wu(n,t,e)}else try{tl.removeChild(n.stateNode)}catch(e){Wu(n,t,e)}}break;case 18:tl!==null&&(nl?(e=tl,$d(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),Pp(e)):$d(tl,n.stateNode));break;case 4:r=tl,i=nl,tl=n.stateNode.containerInfo,nl=!0,rl(e,t,n),tl=r,nl=i;break;case 0:case 11:case 14:case 15:Ic(2,n,t),Jc||Ic(4,n,t),rl(e,t,n);break;case 1:Jc||(Z(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&Rc(n,t,r)),rl(e,t,n);break;case 21:rl(e,t,n);break;case 22:Jc=(r=Jc)||n.memoizedState!==null,rl(e,t,n),Jc=r;break;default:rl(e,t,n)}}function al(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Pp(e)}catch(e){Wu(t,t.return,e)}}}function ol(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Pp(e)}catch(e){Wu(t,t.return,e)}}function sl(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Xc),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Xc),t;default:throw Error(i(435,e.tag))}}function cl(e,t){var n=sl(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=Yu.bind(null,e,t);t.then(r,r)}})}function ll(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var a=n[r],o=e,s=t,c=s;a:for(;c!==null;){switch(c.tag){case 27:if(Qd(c.type)){tl=c.stateNode,nl=!1;break a}break;case 5:tl=c.stateNode,nl=!1;break a;case 3:case 4:tl=c.stateNode.containerInfo,nl=!0;break a}c=c.return}if(tl===null)throw Error(i(160));il(o,s,a),tl=null,nl=!1,o=a.alternate,o!==null&&(o.return=null),a.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)dl(t,e),t=t.sibling}var ul=null;function dl(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:ll(t,e),fl(e),r&4&&(Ic(3,e,e.return),Fc(3,e),Ic(5,e,e.return));break;case 1:ll(t,e),fl(e),r&512&&(Jc||n===null||Z(n,n.return)),r&64&&qc&&(e=e.updateQueue,e!==null&&(r=e.callbacks,r!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?r:n.concat(r))));break;case 26:var a=ul;if(ll(t,e),fl(e),r&512&&(Jc||n===null||Z(n,n.return)),r&4){var o=n===null?null:n.memoizedState;if(r=e.memoizedState,n===null){if(r===null){if(e.stateNode===null){a:{r=e.type,n=e.memoizedProps,a=a.ownerDocument||a;b:switch(r){case`title`:o=a.getElementsByTagName(`title`)[0],(!o||o[tt]||o[Je]||o.namespaceURI===`http://www.w3.org/2000/svg`||o.hasAttribute(`itemprop`))&&(o=a.createElement(r),a.head.insertBefore(o,a.querySelector(`head > title`))),Fd(o,r,n),o[Je]=e,st(o),r=o;break a;case`link`:var s=Hf(`link`,`href`,a).get(r+(n.href||``));if(s){for(var c=0;c<s.length;c++)if(o=s[c],o.getAttribute(`href`)===(n.href==null||n.href===``?null:n.href)&&o.getAttribute(`rel`)===(n.rel==null?null:n.rel)&&o.getAttribute(`title`)===(n.title==null?null:n.title)&&o.getAttribute(`crossorigin`)===(n.crossOrigin==null?null:n.crossOrigin)){s.splice(c,1);break b}}o=a.createElement(r),Fd(o,r,n),a.head.appendChild(o);break;case`meta`:if(s=Hf(`meta`,`content`,a).get(r+(n.content||``))){for(c=0;c<s.length;c++)if(o=s[c],o.getAttribute(`content`)===(n.content==null?null:``+n.content)&&o.getAttribute(`name`)===(n.name==null?null:n.name)&&o.getAttribute(`property`)===(n.property==null?null:n.property)&&o.getAttribute(`http-equiv`)===(n.httpEquiv==null?null:n.httpEquiv)&&o.getAttribute(`charset`)===(n.charSet==null?null:n.charSet)){s.splice(c,1);break b}}o=a.createElement(r),Fd(o,r,n),a.head.appendChild(o);break;default:throw Error(i(468,r))}o[Je]=e,st(o),r=o}e.stateNode=r}else Uf(a,e.type,e.stateNode)}else e.stateNode=Lf(a,r,e.memoizedProps)}else o===r?r===null&&e.stateNode!==null&&Vc(e,e.memoizedProps,n.memoizedProps):(o===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):o.count--,r===null?Uf(a,e.type,e.stateNode):Lf(a,r,e.memoizedProps))}break;case 27:ll(t,e),fl(e),r&512&&(Jc||n===null||Z(n,n.return)),n!==null&&r&4&&Vc(e,e.memoizedProps,n.memoizedProps);break;case 5:if(ll(t,e),fl(e),r&512&&(Jc||n===null||Z(n,n.return)),e.flags&32){a=e.stateNode;try{Nt(a,``)}catch(t){Wu(e,e.return,t)}}r&4&&e.stateNode!=null&&(a=e.memoizedProps,Vc(e,a,n===null?a:n.memoizedProps)),r&1024&&(Yc=!0);break;case 6:if(ll(t,e),fl(e),r&4){if(e.stateNode===null)throw Error(i(162));r=e.memoizedProps,n=e.stateNode;try{n.nodeValue=r}catch(t){Wu(e,e.return,t)}}break;case 3:if(Vf=null,a=ul,ul=_f(t.containerInfo),ll(t,e),ul=a,fl(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Pp(t.containerInfo)}catch(t){Wu(e,e.return,t)}Yc&&(Yc=!1,pl(e));break;case 4:r=ul,ul=_f(e.stateNode.containerInfo),ll(t,e),fl(e),ul=r;break;case 12:ll(t,e),fl(e);break;case 31:ll(t,e),fl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,cl(e,r)));break;case 13:ll(t,e),fl(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(Ql=me()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,cl(e,r)));break;case 22:a=e.memoizedState!==null;var l=n!==null&&n.memoizedState!==null,u=qc,d=Jc;if(qc=u||a,Jc=d||l,ll(t,e),Jc=d,qc=u,fl(e),r&8192)a:for(t=e.stateNode,t._visibility=a?t._visibility&-2:t._visibility|1,a&&(n===null||l||qc||Jc||hl(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){l=n=t;try{if(o=l.stateNode,a)s=o.style,typeof s.setProperty==`function`?s.setProperty(`display`,`none`,`important`):s.display=`none`;else{c=l.stateNode;var f=l.memoizedProps.style,p=f!=null&&f.hasOwnProperty(`display`)?f.display:null;c.style.display=p==null||typeof p==`boolean`?``:(``+p).trim()}}catch(e){Wu(l,l.return,e)}}}else if(t.tag===6){if(n===null){l=t;try{l.stateNode.nodeValue=a?``:l.memoizedProps}catch(e){Wu(l,l.return,e)}}}else if(t.tag===18){if(n===null){l=t;try{var m=l.stateNode;a?ef(m,!0):ef(l.stateNode,!1)}catch(e){Wu(l,l.return,e)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break a;for(;t.sibling===null;){if(t.return===null||t.return===e)break a;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}r&4&&(r=e.updateQueue,r!==null&&(n=r.retryQueue,n!==null&&(r.retryQueue=null,cl(e,n))));break;case 19:ll(t,e),fl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,cl(e,r)));break;case 30:break;case 21:break;default:ll(t,e),fl(e)}}function fl(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(Hc(r)){n=r;break}r=r.return}if(n==null)throw Error(i(160));switch(n.tag){case 27:var a=n.stateNode;Gc(e,Uc(e),a);break;case 5:var o=n.stateNode;n.flags&32&&(Nt(o,``),n.flags&=-33),Gc(e,Uc(e),o);break;case 3:case 4:var s=n.stateNode.containerInfo;Wc(e,Uc(e),s);break;default:throw Error(i(161))}}catch(t){Wu(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function pl(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;pl(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function ml(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)$c(e,t.alternate,t),t=t.sibling}function hl(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Ic(4,t,t.return),hl(t);break;case 1:Z(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount==`function`&&Rc(t,t.return,n),hl(t);break;case 27:mf(t.stateNode);case 26:case 5:Z(t,t.return),hl(t);break;case 22:t.memoizedState===null&&hl(t);break;case 30:hl(t);break;default:hl(t)}e=e.sibling}}function gl(e,t,n){for(n&&=!!(t.subtreeFlags&8772),t=t.child;t!==null;){var r=t.alternate,i=e,a=t,o=a.flags;switch(a.tag){case 0:case 11:case 15:gl(i,a,n),Fc(4,a);break;case 1:if(gl(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){Wu(r,r.return,e)}if(r=a,i=r.updateQueue,i!==null){var s=r.stateNode;try{var c=i.shared.hiddenCallbacks;if(c!==null)for(i.shared.hiddenCallbacks=null,i=0;i<c.length;i++)za(c[i],s)}catch(e){Wu(r,r.return,e)}}n&&o&64&&Lc(a),zc(a,a.return);break;case 27:Kc(a);case 26:case 5:gl(i,a,n),n&&r===null&&o&4&&Bc(a),zc(a,a.return);break;case 12:gl(i,a,n);break;case 31:gl(i,a,n),n&&o&4&&al(i,a);break;case 13:gl(i,a,n),n&&o&4&&ol(i,a);break;case 22:a.memoizedState===null&&gl(i,a,n),zc(a,a.return);break;case 30:break;default:gl(i,a,n)}t=t.sibling}}function _l(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&Qi(n))}function vl(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Qi(e))}function yl(e,t,n,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)bl(e,t,n,r),t=t.sibling}function bl(e,t,n,r){var i=t.flags;switch(t.tag){case 0:case 11:case 15:yl(e,t,n,r),i&2048&&Fc(9,t);break;case 1:yl(e,t,n,r);break;case 3:yl(e,t,n,r),i&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Qi(e)));break;case 12:if(i&2048){yl(e,t,n,r),e=t.stateNode;try{var a=t.memoizedProps,o=a.id,s=a.onPostCommit;typeof s==`function`&&s(o,t.alternate===null?`mount`:`update`,e.passiveEffectDuration,-0)}catch(e){Wu(t,t.return,e)}}else yl(e,t,n,r);break;case 31:yl(e,t,n,r);break;case 13:yl(e,t,n,r);break;case 23:break;case 22:a=t.stateNode,o=t.alternate,t.memoizedState===null?a._visibility&2?yl(e,t,n,r):(a._visibility|=2,xl(e,t,n,r,!!(t.subtreeFlags&10256)||!1)):a._visibility&2?yl(e,t,n,r):Sl(e,t),i&2048&&_l(o,t);break;case 24:yl(e,t,n,r),i&2048&&vl(t.alternate,t);break;default:yl(e,t,n,r)}}function xl(e,t,n,r,i){for(i&&=!!(t.subtreeFlags&10256)||!1,t=t.child;t!==null;){var a=e,o=t,s=n,c=r,l=o.flags;switch(o.tag){case 0:case 11:case 15:xl(a,o,s,c,i),Fc(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,xl(a,o,s,c,i)):u._visibility&2?xl(a,o,s,c,i):Sl(a,o),i&&l&2048&&_l(o.alternate,o);break;case 24:xl(a,o,s,c,i),i&&l&2048&&vl(o.alternate,o);break;default:xl(a,o,s,c,i)}t=t.sibling}}function Sl(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,r=t,i=r.flags;switch(r.tag){case 22:Sl(n,r),i&2048&&_l(r.alternate,r);break;case 24:Sl(n,r),i&2048&&vl(r.alternate,r);break;default:Sl(n,r)}t=t.sibling}}var Cl=8192;function wl(e,t,n){if(e.subtreeFlags&Cl)for(e=e.child;e!==null;)Tl(e,t,n),e=e.sibling}function Tl(e,t,n){switch(e.tag){case 26:wl(e,t,n),e.flags&Cl&&e.memoizedState!==null&&Kf(n,ul,e.memoizedState,e.memoizedProps);break;case 5:wl(e,t,n);break;case 3:case 4:var r=ul;ul=_f(e.stateNode.containerInfo),wl(e,t,n),ul=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=Cl,Cl=16777216,wl(e,t,n),Cl=r):wl(e,t,n));break;default:wl(e,t,n)}}function El(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function Dl(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];Zc=r,Al(r,e)}El(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Ol(e),e=e.sibling}function Ol(e){switch(e.tag){case 0:case 11:case 15:Dl(e),e.flags&2048&&Ic(9,e,e.return);break;case 3:Dl(e);break;case 12:Dl(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,kl(e)):Dl(e);break;default:Dl(e)}}function kl(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];Zc=r,Al(r,e)}El(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Ic(8,t,t.return),kl(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,kl(t));break;default:kl(t)}e=e.sibling}}function Al(e,t){for(;Zc!==null;){var n=Zc;switch(n.tag){case 0:case 11:case 15:Ic(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var r=n.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:Qi(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,Zc=r;else a:for(n=e;Zc!==null;){r=Zc;var i=r.sibling,a=r.return;if(el(r),r===n){Zc=null;break a}if(i!==null){i.return=a,Zc=i;break a}Zc=a}}}var jl={getCacheForType:function(e){var t=Wi(Xi),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return Wi(Xi).controller.signal}},Ml=typeof WeakMap==`function`?WeakMap:Map,Nl=0,Pl=null,Fl=null,Il=0,Ll=0,Rl=null,zl=!1,Bl=!1,Vl=!1,Hl=0,Ul=0,Wl=0,Gl=0,Kl=0,ql=0,Jl=0,Yl=null,Xl=null,Zl=!1,Ql=0,$l=0,eu=1/0,tu=null,nu=null,ru=0,iu=null,au=null,ou=0,su=0,cu=null,lu=null,uu=0,du=null;function fu(){return Nl&2&&Il!==0?Il&-Il:I.T===null?Ge():dd()}function pu(){if(ql===0){if(!(Il&536870912)||Ci){var e=Ae;Ae<<=1,!(Ae&3932160)&&(Ae=262144),ql=e}else ql=536870912}return e=Ka.current,e!==null&&(e.flags|=32),ql}function mu(e,t,n){(e===Pl&&(Ll===2||Ll===9)||e.cancelPendingCommit!==null)&&(xu(e,0),vu(e,Il,ql,!1)),Re(e,n),(!(Nl&2)||e!==Pl)&&(e===Pl&&(!(Nl&2)&&(Gl|=n),Ul===4&&vu(e,Il,ql,!1)),rd(e))}function hu(e,t,n){if(Nl&6)throw Error(i(327));var r=!n&&!(t&127)&&(t&e.expiredLanes)===0||Pe(e,t),a=r?ku(e,t):Du(e,t,!0),o=r;do{if(a===0){Bl&&!r&&vu(e,t,0,!1);break}if(n=e.current.alternate,o&&!_u(n)){a=Du(e,t,!1),o=!1;continue}if(a===2){if(o=t,e.errorRecoveryDisabledLanes&o)var s=0;else s=e.pendingLanes&-536870913,s=s===0?s&536870912?536870912:0:s;if(s!==0){t=s;a:{var c=e;a=Yl;var l=c.current.memoizedState.isDehydrated;if(l&&(xu(c,s).flags|=256),s=Du(c,s,!1),s!==2){if(Vl&&!l){c.errorRecoveryDisabledLanes|=o,Gl|=o,a=4;break a}o=Xl,Xl=a,o!==null&&(Xl===null?Xl=o:Xl.push.apply(Xl,o))}a=s}if(o=!1,a!==2)continue}}if(a===1){xu(e,0),vu(e,t,0,!0);break}a:{switch(r=e,o=a,o){case 0:case 1:throw Error(i(345));case 4:if((t&4194048)!==t)break;case 6:vu(r,t,ql,!zl);break a;case 2:Xl=null;break;case 3:case 5:break;default:throw Error(i(329))}if((t&62914560)===t&&(a=Ql+300-me(),10<a)){if(vu(r,t,ql,!zl),Ne(r,0,!0)!==0)break a;ou=t,r.timeoutHandle=qd(gu.bind(null,r,n,Xl,tu,Zl,t,ql,Gl,Jl,zl,o,`Throttled`,-0,0),a);break a}gu(r,n,Xl,tu,Zl,t,ql,Gl,Jl,zl,o,null,-0,0)}break}while(1);rd(e)}function gu(e,t,n,r,i,a,o,s,c,l,u,d,f,p){if(e.timeoutHandle=-1,d=t.subtreeFlags,d&8192||(d&16785408)==16785408){d={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Vt},Tl(t,a,d);var m=(a&62914560)===a?Ql-me():(a&4194048)===a?$l-me():0;if(m=Jf(d,m),m!==null){ou=a,e.cancelPendingCommit=m(Iu.bind(null,e,t,a,n,r,i,o,s,c,u,d,null,f,p)),vu(e,a,o,!l);return}}Iu(e,t,a,n,r,i,o,s,c)}function _u(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var r=0;r<n.length;r++){var i=n[r],a=i.getSnapshot;i=i.value;try{if(!ur(a(),i))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function vu(e,t,n,r){t&=~Kl,t&=~Gl,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-Ee(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&Be(e,n,t)}function yu(){return Nl&6?!0:(id(0,!1),!1)}function bu(){if(Fl!==null){if(Ll===0)var e=Fl.return;else e=Fl,Ii=Fi=null,xo(e),xa=null,Sa=0,e=Fl;for(;e!==null;)Pc(e.alternate,e),e=e.return;Fl=null}}function xu(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,Jd(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),ou=0,bu(),Pl=e,Fl=n=Qr(e.current,null),Il=t,Ll=0,Rl=null,zl=!1,Bl=Pe(e,t),Vl=!1,Jl=ql=Kl=Gl=Wl=Ul=0,Xl=Yl=null,Zl=!1,t&8&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var i=31-Ee(r),a=1<<i;t|=e[i],r&=~a}return Hl=t,Hr(),n}function Su(e,t){no=null,I.H=js,t===da||t===pa?(t=ya(),Ll=3):t===fa?(t=ya(),Ll=4):Ll=t===Ys?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,Rl=t,Fl===null&&(Ul=1,Us(e,oi(t,e.current)))}function Cu(){var e=Ka.current;return e===null?!0:(Il&4194048)===Il?qa===null:(Il&62914560)===Il||Il&536870912?e===qa:!1}function wu(){var e=I.H;return I.H=js,e===null?js:e}function Tu(){var e=I.A;return I.A=jl,e}function Eu(){Ul=4,zl||(Il&4194048)!==Il&&Ka.current!==null||(Bl=!0),!(Wl&134217727)&&!(Gl&134217727)||Pl===null||vu(Pl,Il,ql,!1)}function Du(e,t,n){var r=Nl;Nl|=2;var i=wu(),a=Tu();(Pl!==e||Il!==t)&&(tu=null,xu(e,t)),t=!1;var o=Ul;a:do try{if(Ll!==0&&Fl!==null){var s=Fl,c=Rl;switch(Ll){case 8:bu(),o=6;break a;case 3:case 2:case 9:case 6:Ka.current===null&&(t=!0);var l=Ll;if(Ll=0,Rl=null,Nu(e,s,c,l),n&&Bl){o=0;break a}break;default:l=Ll,Ll=0,Rl=null,Nu(e,s,c,l)}}Ou(),o=Ul;break}catch(t){Su(e,t)}while(1);return t&&e.shellSuspendCounter++,Ii=Fi=null,Nl=r,I.H=i,I.A=a,Fl===null&&(Pl=null,Il=0,Hr()),o}function Ou(){for(;Fl!==null;)ju(Fl)}function ku(e,t){var n=Nl;Nl|=2;var r=wu(),a=Tu();Pl!==e||Il!==t?(tu=null,eu=me()+500,xu(e,t)):Bl=Pe(e,t);a:do try{if(Ll!==0&&Fl!==null){t=Fl;var o=Rl;b:switch(Ll){case 1:Ll=0,Rl=null,Nu(e,t,o,1);break;case 2:case 9:if(ha(o)){Ll=0,Rl=null,Mu(t);break}t=function(){Ll!==2&&Ll!==9||Pl!==e||(Ll=7),rd(e)},o.then(t,t);break a;case 3:Ll=7;break a;case 4:Ll=5;break a;case 7:ha(o)?(Ll=0,Rl=null,Mu(t)):(Ll=0,Rl=null,Nu(e,t,o,7));break;case 5:var s=null;switch(Fl.tag){case 26:s=Fl.memoizedState;case 5:case 27:var c=Fl;if(s?Gf(s):c.stateNode.complete){Ll=0,Rl=null;var l=c.sibling;if(l!==null)Fl=l;else{var u=c.return;u===null?Fl=null:(Fl=u,Pu(u))}break b}}Ll=0,Rl=null,Nu(e,t,o,5);break;case 6:Ll=0,Rl=null,Nu(e,t,o,6);break;case 8:bu(),Ul=6;break a;default:throw Error(i(462))}}Au();break}catch(t){Su(e,t)}while(1);return Ii=Fi=null,I.H=r,I.A=a,Nl=n,Fl===null?(Pl=null,Il=0,Hr(),Ul):0}function Au(){for(;Fl!==null&&!fe();)ju(Fl)}function ju(e){var t=Tc(e.alternate,e,Hl);e.memoizedProps=e.pendingProps,t===null?Pu(e):Fl=t}function Mu(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=lc(n,t,t.pendingProps,t.type,void 0,Il);break;case 11:t=lc(n,t,t.pendingProps,t.type.render,t.ref,Il);break;case 5:xo(t);default:Pc(n,t),t=Fl=$r(t,Hl),t=Tc(n,t,Hl)}e.memoizedProps=e.pendingProps,t===null?Pu(e):Fl=t}function Nu(e,t,n,r){Ii=Fi=null,xo(t),xa=null,Sa=0;var i=t.return;try{if(Js(e,i,t,n,Il)){Ul=1,Us(e,oi(n,e.current)),Fl=null;return}}catch(t){if(i!==null)throw Fl=i,t;Ul=1,Us(e,oi(n,e.current)),Fl=null;return}t.flags&32768?(Ci||r===1?e=!0:Bl||Il&536870912?e=!1:(zl=e=!0,(r===2||r===9||r===3||r===6)&&(r=Ka.current,r!==null&&r.tag===13&&(r.flags|=16384))),Fu(t,e)):Pu(t)}function Pu(e){var t=e;do{if(t.flags&32768){Fu(t,zl);return}e=t.return;var n=Mc(t.alternate,t,Hl);if(n!==null){Fl=n;return}if(t=t.sibling,t!==null){Fl=t;return}Fl=t=e}while(t!==null);Ul===0&&(Ul=5)}function Fu(e,t){do{var n=Nc(e.alternate,e);if(n!==null){n.flags&=32767,Fl=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Fl=e;return}Fl=e=n}while(e!==null);Ul=6,Fl=null}function Iu(e,t,n,r,a,o,s,c,l){e.cancelPendingCommit=null;do Vu();while(ru!==0);if(Nl&6)throw Error(i(327));if(t!==null){if(t===e.current)throw Error(i(177));if(o=t.lanes|t.childLanes,o|=Vr,ze(e,n,o,s,c,l),e===Pl&&(Fl=Pl=null,Il=0),au=t,iu=e,ou=n,su=o,cu=a,lu=r,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,Xu(ve,function(){return Hu(),null})):(e.callbackNode=null,e.callbackPriority=0),r=!!(t.flags&13878),t.subtreeFlags&13878||r){r=I.T,I.T=null,a=L.p,L.p=2,s=Nl,Nl|=4;try{Qc(e,t,n)}finally{Nl=s,L.p=a,I.T=r}}ru=1,Lu(),Ru(),zu()}}function Lu(){if(ru===1){ru=0;var e=iu,t=au,n=!!(t.flags&13878);if(t.subtreeFlags&13878||n){n=I.T,I.T=null;var r=L.p;L.p=2;var i=Nl;Nl|=4;try{dl(t,e);var a=Bd,o=hr(e.containerInfo),s=a.focusedElem,c=a.selectionRange;if(o!==s&&s&&s.ownerDocument&&mr(s.ownerDocument.documentElement,s)){if(c!==null&&gr(s)){var l=c.start,u=c.end;if(u===void 0&&(u=l),`selectionStart`in s)s.selectionStart=l,s.selectionEnd=Math.min(u,s.value.length);else{var d=s.ownerDocument||document,f=d&&d.defaultView||window;if(f.getSelection){var p=f.getSelection(),m=s.textContent.length,h=Math.min(c.start,m),g=c.end===void 0?h:Math.min(c.end,m);!p.extend&&h>g&&(o=g,g=h,h=o);var _=pr(s,h),v=pr(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;s<d.length;s++){var b=d[s];b.element.scrollLeft=b.left,b.element.scrollTop=b.top}}cp=!!zd,Bd=zd=null}finally{Nl=i,L.p=r,I.T=n}}e.current=t,ru=2}}function Ru(){if(ru===2){ru=0;var e=iu,t=au,n=!!(t.flags&8772);if(t.subtreeFlags&8772||n){n=I.T,I.T=null;var r=L.p;L.p=2;var i=Nl;Nl|=4;try{$c(e,t.alternate,t)}finally{Nl=i,L.p=r,I.T=n}}ru=3}}function zu(){if(ru===4||ru===3){ru=0,pe();var e=iu,t=au,n=ou,r=lu;t.subtreeFlags&10256||t.flags&10256?ru=5:(ru=0,au=iu=null,Bu(e,e.pendingLanes));var i=e.pendingLanes;if(i===0&&(nu=null),We(n),t=t.stateNode,we&&typeof we.onCommitFiberRoot==`function`)try{we.onCommitFiberRoot(Ce,t,void 0,(t.current.flags&128)==128)}catch{}if(r!==null){t=I.T,i=L.p,L.p=2,I.T=null;try{for(var a=e.onRecoverableError,o=0;o<r.length;o++){var s=r[o];a(s.value,{componentStack:s.stack})}}finally{I.T=t,L.p=i}}ou&3&&Vu(),rd(e),i=e.pendingLanes,n&261930&&i&42?e===du?uu++:(uu=0,du=e):uu=0,id(0,!1)}}function Bu(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Qi(t)))}function Vu(){return Lu(),Ru(),zu(),Hu()}function Hu(){if(ru!==5)return!1;var e=iu,t=su;su=0;var n=We(ou),r=I.T,a=L.p;try{L.p=32>n?32:n,I.T=null,n=cu,cu=null;var o=iu,s=ou;if(ru=0,au=iu=null,ou=0,Nl&6)throw Error(i(331));var c=Nl;if(Nl|=4,Ol(o.current),bl(o,o.current,s,n),Nl=c,id(0,!1),we&&typeof we.onPostCommitFiberRoot==`function`)try{we.onPostCommitFiberRoot(Ce,o)}catch{}return!0}finally{L.p=a,I.T=r,Bu(e,t)}}function Uu(e,t,n){t=oi(n,t),t=Gs(e.stateNode,t,2),e=Na(e,t,2),e!==null&&(Re(e,2),rd(e))}function Wu(e,t,n){if(e.tag===3)Uu(e,e,n);else for(;t!==null;){if(t.tag===3){Uu(t,e,n);break}if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(nu===null||!nu.has(r))){e=oi(n,e),n=Ks(2),r=Na(t,n,2),r!==null&&(qs(n,r,t,e),Re(r,2),rd(r));break}}t=t.return}}function Gu(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Ml;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(Vl=!0,i.add(n),e=Ku.bind(null,e,t,n),t.then(e,e))}function Ku(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Pl===e&&(Il&n)===n&&(Ul===4||Ul===3&&(Il&62914560)===Il&&300>me()-Ql?!(Nl&2)&&xu(e,0):Kl|=n,Jl===Il&&(Jl=0)),rd(e)}function qu(e,t){t===0&&(t=Ie()),e=Gr(e,t),e!==null&&(Re(e,t),rd(e))}function Ju(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),qu(e,n)}function Yu(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(i(314))}r!==null&&r.delete(t),qu(e,n)}function Xu(e,t){return ue(e,t)}var Zu=null,Qu=null,$u=!1,ed=!1,td=!1,nd=0;function rd(e){e!==Qu&&e.next===null&&(Qu===null?Zu=Qu=e:Qu=Qu.next=e),ed=!0,$u||($u=!0,ud())}function id(e,t){if(!td&&ed){td=!0;do for(var n=!1,r=Zu;r!==null;){if(!t){if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-Ee(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,ld(r,a))}else a=Il,a=Ne(r,r===Pl?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||Pe(r,a)||(n=!0,ld(r,a))}r=r.next}while(n);td=!1}}function ad(){od()}function od(){ed=$u=!1;var e=0;nd!==0&&Kd()&&(e=nd);for(var t=me(),n=null,r=Zu;r!==null;){var i=r.next,a=sd(r,t);a===0?(r.next=null,n===null?Zu=i:n.next=i,i===null&&(Qu=n)):(n=r,(e!==0||a&3)&&(ed=!0)),r=i}ru!==0&&ru!==5||id(e,!1),nd!==0&&(nd=0)}function sd(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0<a;){var o=31-Ee(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=Fe(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=Pl,n=Il,n=Ne(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(Ll===2||Ll===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&de(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||Pe(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&de(r),We(n)){case 2:case 8:n=_e;break;case 32:n=ve;break;case 268435456:n=be;break;default:n=ve}return r=cd.bind(null,e),n=ue(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&de(r),e.callbackPriority=2,e.callbackNode=null,2}function cd(e,t){if(ru!==0&&ru!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(Vu()&&e.callbackNode!==n)return null;var r=Il;return r=Ne(e,e===Pl?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(hu(e,r,t),sd(e,me()),e.callbackNode!=null&&e.callbackNode===n?cd.bind(null,e):null)}function ld(e,t){if(Vu())return null;hu(e,t,!0)}function ud(){Xd(function(){Nl&6?ue(ge,ad):od()})}function dd(){if(nd===0){var e=ta;e===0&&(e=ke,ke<<=1,!(ke&261888)&&(ke=256)),nd=e}return nd}function fd(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:Bt(``+e)}function pd(e,t){var n=t.ownerDocument.createElement(`input`);return n.name=t.name,n.value=t.value,e.id&&n.setAttribute(`form`,e.id),t.parentNode.insertBefore(n,t),e=new FormData(e),n.parentNode.removeChild(n),e}function md(e,t,n,r,i){if(t===`submit`&&n&&n.stateNode===i){var a=fd((i[Ye]||null).action),o=r.submitter;o&&(t=(t=o[Ye]||null)?fd(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new ln(`action`,`action`,null,r,i);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(nd!==0){var e=o?pd(i,o):new FormData(i);_s(n,{pending:!0,data:e,method:i.method,action:a},null,e)}}else typeof a==`function`&&(s.preventDefault(),e=o?pd(i,o):new FormData(i),_s(n,{pending:!0,data:e,method:i.method,action:a},a,e))},currentTarget:i}]})}}for(var hd=0;hd<Ir.length;hd++){var gd=Ir[hd];Lr(gd.toLowerCase(),`on`+(gd[0].toUpperCase()+gd.slice(1)))}Lr(Or,`onAnimationEnd`),Lr(kr,`onAnimationIteration`),Lr(Ar,`onAnimationStart`),Lr(`dblclick`,`onDoubleClick`),Lr(`focusin`,`onFocus`),Lr(`focusout`,`onBlur`),Lr(jr,`onTransitionRun`),Lr(Mr,`onTransitionStart`),Lr(Nr,`onTransitionCancel`),Lr(Pr,`onTransitionEnd`),dt(`onMouseEnter`,[`mouseout`,`mouseover`]),dt(`onMouseLeave`,[`mouseout`,`mouseover`]),dt(`onPointerEnter`,[`pointerout`,`pointerover`]),dt(`onPointerLeave`,[`pointerout`,`pointerover`]),ut(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),ut(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),ut(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),ut(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),ut(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),ut(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var _d=`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(` `),vd=new Set(`beforetoggle cancel close invalid load scroll scrollend toggle`.split(` `).concat(_d));function yd(e,t){t=!!(t&4);for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;a:{var a=void 0;if(t)for(var o=r.length-1;0<=o;o--){var s=r[o],c=s.instance,l=s.currentTarget;if(s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Rr(e)}i.currentTarget=null,a=c}else for(o=0;o<r.length;o++){if(s=r[o],c=s.instance,l=s.currentTarget,s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Rr(e)}i.currentTarget=null,a=c}}}}function Q(e,t){var n=t[Ze];n===void 0&&(n=t[Ze]=new Set);var r=e+`__bubble`;n.has(r)||(Cd(t,e,2,!1),n.add(r))}function bd(e,t,n){var r=0;t&&(r|=4),Cd(n,e,r,t)}var xd=`_reactListening`+Math.random().toString(36).slice(2);function Sd(e){if(!e[xd]){e[xd]=!0,ct.forEach(function(t){t!==`selectionchange`&&(vd.has(t)||bd(t,!1,e),bd(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[xd]||(t[xd]=!0,bd(`selectionchange`,!1,t))}}function Cd(e,t,n,r){switch(hp(t)){case 2:var i=lp;break;case 8:i=up;break;default:i=dp}n=i.bind(null,t,n,e),i=void 0,!Zt||t!==`touchstart`&&t!==`touchmove`&&t!==`wheel`||(i=!0),r?i===void 0?e.addEventListener(t,n,!0):e.addEventListener(t,n,{capture:!0,passive:i}):i===void 0?e.addEventListener(t,n,!1):e.addEventListener(t,n,{passive:i})}function wd(e,t,n,r,i){var a=r;if(!(t&1)&&!(t&2)&&r!==null)a:for(;;){if(r===null)return;var s=r.tag;if(s===3||s===4){var c=r.stateNode.containerInfo;if(c===i)break;if(s===4)for(s=r.return;s!==null;){var l=s.tag;if((l===3||l===4)&&s.stateNode.containerInfo===i)return;s=s.return}for(;c!==null;){if(s=rt(c),s===null)return;if(l=s.tag,l===5||l===6||l===26||l===27){r=a=s;continue a}c=c.parentNode}}r=r.return}Jt(function(){var r=a,i=Ut(n),s=[];a:{var c=Fr.get(e);if(c!==void 0){var l=ln,u=e;switch(e){case`keypress`:if(rn(n)===0)break a;case`keydown`:case`keyup`:l=Dn;break;case`focusin`:u=`focus`,l=vn;break;case`focusout`:u=`blur`,l=vn;break;case`beforeblur`:case`afterblur`:l=vn;break;case`click`:if(n.button===2)break a;case`auxclick`:case`dblclick`:case`mousedown`:case`mousemove`:case`mouseup`:case`mouseout`:case`mouseover`:case`contextmenu`:l=gn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:l=_n;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:l=kn;break;case Or:case kr:case Ar:l=yn;break;case Pr:l=An;break;case`scroll`:case`scrollend`:l=dn;break;case`wheel`:l=jn;break;case`copy`:case`cut`:case`paste`:l=bn;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:l=On;break;case`toggle`:case`beforetoggle`:l=Mn}var d=!!(t&4),f=!d&&(e===`scroll`||e===`scrollend`),p=d?c===null?null:c+`Capture`:c;d=[];for(var m=r,h;m!==null;){var g=m;if(h=g.stateNode,g=g.tag,g!==5&&g!==26&&g!==27||h===null||p===null||(g=Yt(m,p),g!=null&&d.push(Td(m,g,h))),f)break;m=m.return}0<d.length&&(c=new l(c,u,null,n,i),s.push({event:c,listeners:d}))}}if(!(t&7)){a:{if(c=e===`mouseover`||e===`pointerover`,l=e===`mouseout`||e===`pointerout`,c&&n!==Ht&&(u=n.relatedTarget||n.fromElement)&&(rt(u)||u[Xe]))break a;if((l||c)&&(c=i.window===i?i:(c=i.ownerDocument)?c.defaultView||c.parentWindow:window,l?(u=n.relatedTarget||n.toElement,l=r,u=u?rt(u):null,u!==null&&(f=o(u),d=u.tag,u!==f||d!==5&&d!==27&&d!==6)&&(u=null)):(l=null,u=r),l!==u)){if(d=gn,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=On,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=l==null?c:at(l),h=u==null?c:at(u),c=new d(g,m+`leave`,l,n,i),c.target=f,c.relatedTarget=h,g=null,rt(i)===r&&(d=new d(p,m+`enter`,u,n,i),d.target=h,d.relatedTarget=f,g=d),f=g,l&&u)b:{for(d=Dd,p=l,m=u,h=0,g=p;g;g=d(g))h++;g=0;for(var _=m;_;_=d(_))g++;for(;0<h-g;)p=d(p),h--;for(;0<g-h;)m=d(m),g--;for(;h--;){if(p===m||m!==null&&p===m.alternate){d=p;break b}p=d(p),m=d(m)}d=null}else d=null;l!==null&&Od(s,c,l,d,!1),u!==null&&f!==null&&Od(s,f,u,d,!0)}}a:{if(c=r?at(r):window,l=c.nodeName&&c.nodeName.toLowerCase(),l===`select`||l===`input`&&c.type===`file`)var v=Qn;else if(Kn(c)){if($n)v=cr;else{v=or;var y=ar}}else l=c.nodeName,!l||l.toLowerCase()!==`input`||c.type!==`checkbox`&&c.type!==`radio`?r&&Lt(r.elementType)&&(v=Qn):v=sr;if(v&&=v(e,r)){qn(s,v,n,i);break a}y&&y(e,c,r),e===`focusout`&&r&&c.type===`number`&&r.memoizedProps.value!=null&&kt(c,`number`,c.value)}switch(y=r?at(r):window,e){case`focusin`:(Kn(y)||y.contentEditable===`true`)&&(vr=y,yr=r,br=null);break;case`focusout`:br=yr=vr=null;break;case`mousedown`:xr=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:xr=!1,Sr(s,n,i);break;case`selectionchange`:if(_r)break;case`keydown`:case`keyup`:Sr(s,n,i)}var b;if(Pn)b:{switch(e){case`compositionstart`:var x=`onCompositionStart`;break b;case`compositionend`:x=`onCompositionEnd`;break b;case`compositionupdate`:x=`onCompositionUpdate`;break b}x=void 0}else Hn?Bn(e,n)&&(x=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(x=`onCompositionStart`);x&&(Ln&&n.locale!==`ko`&&(Hn||x!==`onCompositionStart`?x===`onCompositionEnd`&&Hn&&(b=nn()):($t=i,en=`value`in $t?$t.value:$t.textContent,Hn=!0)),y=Ed(r,x),0<y.length&&(x=new xn(x,e,null,n,i),s.push({event:x,listeners:y}),b?x.data=b:(b=Vn(n),b!==null&&(x.data=b)))),(b=In?Un(e,n):Wn(e,n))&&(x=Ed(r,`onBeforeInput`),0<x.length&&(y=new xn(`onBeforeInput`,`beforeinput`,null,n,i),s.push({event:y,listeners:x}),y.data=b)),md(s,e,r,n,i)}yd(s,t)})}function Td(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Ed(e,t){for(var n=t+`Capture`,r=[];e!==null;){var i=e,a=i.stateNode;if(i=i.tag,i!==5&&i!==26&&i!==27||a===null||(i=Yt(e,n),i!=null&&r.unshift(Td(e,i,a)),i=Yt(e,t),i!=null&&r.push(Td(e,i,a))),e.tag===3)return r;e=e.return}return[]}function Dd(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Od(e,t,n,r,i){for(var a=t._reactName,o=[];n!==null&&n!==r;){var s=n,c=s.alternate,l=s.stateNode;if(s=s.tag,c!==null&&c===r)break;s!==5&&s!==26&&s!==27||l===null||(c=l,i?(l=Yt(n,a),l!=null&&o.unshift(Td(n,l,c))):i||(l=Yt(n,a),l!=null&&o.push(Td(n,l,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var kd=/\r\n?/g,Ad=/\u0000|\uFFFD/g;function jd(e){return(typeof e==`string`?e:``+e).replace(kd,`
9
+ `).replace(Ad,``)}function Md(e,t){return t=jd(t),jd(e)===t}function Nd(e,t,n,r,a,o){switch(n){case`children`:typeof r==`string`?t===`body`||t===`textarea`&&r===``||Nt(e,r):(typeof r==`number`||typeof r==`bigint`)&&t!==`body`&&Nt(e,``+r);break;case`className`:_t(e,`class`,r);break;case`tabIndex`:_t(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:_t(e,n,r);break;case`style`:It(e,r,o);break;case`data`:if(t!==`object`){_t(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)){e.removeAttribute(n);break}if(r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Bt(``+r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`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 o==`function`&&(n===`formAction`?(t!==`input`&&Nd(e,t,`name`,a.name,a,null),Nd(e,t,`formEncType`,a.formEncType,a,null),Nd(e,t,`formMethod`,a.formMethod,a,null),Nd(e,t,`formTarget`,a.formTarget,a,null)):(Nd(e,t,`encType`,a.encType,a,null),Nd(e,t,`method`,a.method,a,null),Nd(e,t,`target`,a.target,a,null))),r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Bt(``+r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=Vt);break;case`onScroll`:r!=null&&Q(`scroll`,e);break;case`onScrollEnd`:r!=null&&Q(`scrollend`,e);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));e.innerHTML=n}}break;case`multiple`:e.multiple=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`muted`:e.muted=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`ref`:break;case`autoFocus`:break;case`xlinkHref`:if(r==null||typeof r==`function`||typeof r==`boolean`||typeof r==`symbol`){e.removeAttribute(`xlink:href`);break}n=Bt(``+r),e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,n);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``+r):e.removeAttribute(n);break;case`inert`:case`allowFullScreen`:case`async`:case`autoPlay`:case`controls`: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`:r&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``):e.removeAttribute(n);break;case`capture`:case`download`:!0===r?e.setAttribute(n,``):!1!==r&&r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`cols`:case`rows`:case`size`:case`span`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case`rowSpan`:case`start`:r==null||typeof r==`function`||typeof r==`symbol`||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case`popover`:Q(`beforetoggle`,e),Q(`toggle`,e),gt(e,`popover`,r);break;case`xlinkActuate`:vt(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:vt(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:vt(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:vt(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:vt(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:vt(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:vt(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:vt(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:vt(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:gt(e,`is`,r);break;case`innerText`:case`textContent`:break;default:(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)&&(n=Rt.get(n)||n,gt(e,n,r))}}function Pd(e,t,n,r,a,o){switch(n){case`style`:It(e,r,o);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));e.innerHTML=n}}break;case`children`:typeof r==`string`?Nt(e,r):(typeof r==`number`||typeof r==`bigint`)&&Nt(e,``+r);break;case`onScroll`:r!=null&&Q(`scroll`,e);break;case`onScrollEnd`:r!=null&&Q(`scrollend`,e);break;case`onClick`:r!=null&&(e.onclick=Vt);break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:break;case`innerText`:case`textContent`:break;default:if(!lt.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(a=n.endsWith(`Capture`),t=n.slice(2,a?n.length-7:void 0),o=e[Ye]||null,o=o==null?null:o[n],typeof o==`function`&&e.removeEventListener(t,o,a),typeof r==`function`)){typeof o!=`function`&&o!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,r,a);break a}n in e?e[n]=r:!0===r?e.setAttribute(n,``):gt(e,n,r)}}}function Fd(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:Q(`error`,e),Q(`load`,e);var r=!1,a=!1,o;for(o in n)if(n.hasOwnProperty(o)){var s=n[o];if(s!=null)switch(o){case`src`:r=!0;break;case`srcSet`:a=!0;break;case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:Nd(e,t,o,s,n,null)}}a&&Nd(e,t,`srcSet`,n.srcSet,n,null),r&&Nd(e,t,`src`,n.src,n,null);return;case`input`:Q(`invalid`,e);var c=o=s=a=null,l=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case`name`:a=d;break;case`type`:s=d;break;case`checked`:l=d;break;case`defaultChecked`:u=d;break;case`value`:o=d;break;case`defaultValue`:c=d;break;case`children`:case`dangerouslySetInnerHTML`:if(d!=null)throw Error(i(137,t));break;default:Nd(e,t,r,d,n,null)}}Ot(e,o,c,l,u,s,a,!1);return;case`select`:for(a in Q(`invalid`,e),r=s=o=null,n)if(n.hasOwnProperty(a)&&(c=n[a],c!=null))switch(a){case`value`:o=c;break;case`defaultValue`:s=c;break;case`multiple`:r=c;default:Nd(e,t,a,c,n,null)}t=o,n=s,e.multiple=!!r,t==null?n!=null&&At(e,!!r,n,!0):At(e,!!r,t,!1);return;case`textarea`:for(s in Q(`invalid`,e),o=a=r=null,n)if(n.hasOwnProperty(s)&&(c=n[s],c!=null))switch(s){case`value`:r=c;break;case`defaultValue`:a=c;break;case`children`:o=c;break;case`dangerouslySetInnerHTML`:if(c!=null)throw Error(i(91));break;default:Nd(e,t,s,c,n,null)}Mt(e,r,a,o);return;case`option`:for(l in n)if(n.hasOwnProperty(l)&&(r=n[l],r!=null))switch(l){case`selected`:e.selected=r&&typeof r!=`function`&&typeof r!=`symbol`;break;default:Nd(e,t,l,r,n,null)}return;case`dialog`:Q(`beforetoggle`,e),Q(`toggle`,e),Q(`cancel`,e),Q(`close`,e);break;case`iframe`:case`object`:Q(`load`,e);break;case`video`:case`audio`:for(r=0;r<_d.length;r++)Q(_d[r],e);break;case`image`:Q(`error`,e),Q(`load`,e);break;case`details`:Q(`toggle`,e);break;case`embed`:case`source`:case`link`:Q(`error`,e),Q(`load`,e);case`area`:case`base`:case`br`:case`col`:case`hr`:case`keygen`:case`meta`:case`param`:case`track`:case`wbr`:case`menuitem`:for(u in n)if(n.hasOwnProperty(u)&&(r=n[u],r!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:Nd(e,t,u,r,n,null)}return;default:if(Lt(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&Pd(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&Nd(e,t,c,r,n,null))}function Id(e,t,n,r){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`input`:var a=null,o=null,s=null,c=null,l=null,u=null,d=null;for(m in n){var f=n[m];if(n.hasOwnProperty(m)&&f!=null)switch(m){case`checked`:break;case`value`:break;case`defaultValue`:l=f;default:r.hasOwnProperty(m)||Nd(e,t,m,null,r,f)}}for(var p in r){var m=r[p];if(f=n[p],r.hasOwnProperty(p)&&(m!=null||f!=null))switch(p){case`type`:o=m;break;case`name`:a=m;break;case`checked`:u=m;break;case`defaultChecked`:d=m;break;case`value`:s=m;break;case`defaultValue`:c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(i(137,t));break;default:m!==f&&Nd(e,t,p,m,r,f)}}Dt(e,s,c,l,u,d,o,a);return;case`select`:for(o in m=s=c=p=null,n)if(l=n[o],n.hasOwnProperty(o)&&l!=null)switch(o){case`value`:break;case`multiple`:m=l;default:r.hasOwnProperty(o)||Nd(e,t,o,null,r,l)}for(a in r)if(o=r[a],l=n[a],r.hasOwnProperty(a)&&(o!=null||l!=null))switch(a){case`value`:p=o;break;case`defaultValue`:c=o;break;case`multiple`:s=o;default:o!==l&&Nd(e,t,a,o,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?At(e,!!n,n?[]:``,!1):At(e,!!n,t,!0)):At(e,!!n,p,!1);return;case`textarea`:for(c in m=p=null,n)if(a=n[c],n.hasOwnProperty(c)&&a!=null&&!r.hasOwnProperty(c))switch(c){case`value`:break;case`children`:break;default:Nd(e,t,c,null,r,a)}for(s in r)if(a=r[s],o=n[s],r.hasOwnProperty(s)&&(a!=null||o!=null))switch(s){case`value`:p=a;break;case`defaultValue`:m=a;break;case`children`:break;case`dangerouslySetInnerHTML`:if(a!=null)throw Error(i(91));break;default:a!==o&&Nd(e,t,s,a,r,o)}jt(e,p,m);return;case`option`:for(var h in n)if(p=n[h],n.hasOwnProperty(h)&&p!=null&&!r.hasOwnProperty(h))switch(h){case`selected`:e.selected=!1;break;default:Nd(e,t,h,null,r,p)}for(l in r)if(p=r[l],m=n[l],r.hasOwnProperty(l)&&p!==m&&(p!=null||m!=null))switch(l){case`selected`:e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:Nd(e,t,l,p,r,m)}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 g in n)p=n[g],n.hasOwnProperty(g)&&p!=null&&!r.hasOwnProperty(g)&&Nd(e,t,g,null,r,p);for(u in r)if(p=r[u],m=n[u],r.hasOwnProperty(u)&&p!==m&&(p!=null||m!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:if(p!=null)throw Error(i(137,t));break;default:Nd(e,t,u,p,r,m)}return;default:if(Lt(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&Pd(e,t,_,void 0,r,p);for(d in r)p=r[d],m=n[d],!r.hasOwnProperty(d)||p===m||p===void 0&&m===void 0||Pd(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&Nd(e,t,v,null,r,p);for(f in r)p=r[f],m=n[f],!r.hasOwnProperty(f)||p===m||p==null&&m==null||Nd(e,t,f,p,r,m)}function Ld(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function Rd(){if(typeof performance.getEntriesByType==`function`){for(var e=0,t=0,n=performance.getEntriesByType(`resource`),r=0;r<n.length;r++){var i=n[r],a=i.transferSize,o=i.initiatorType,s=i.duration;if(a&&s&&Ld(o)){for(o=0,s=i.responseEnd,r+=1;r<n.length;r++){var c=n[r],l=c.startTime;if(l>s)break;var u=c.transferSize,d=c.initiatorType;u&&Ld(d)&&(c=c.responseEnd,o+=u*(c<s?1:(s-l)/(c-l)))}if(--r,t+=8*(a+o)/(i.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e==`number`)?e:5}var zd=null,Bd=null;function Vd(e){return e.nodeType===9?e:e.ownerDocument}function Hd(e){switch(e){case`http://www.w3.org/2000/svg`:return 1;case`http://www.w3.org/1998/Math/MathML`:return 2;default:return 0}}function Ud(e,t){if(e===0)switch(t){case`svg`:return 1;case`math`:return 2;default:return 0}return e===1&&t===`foreignObject`?0:e}function Wd(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.children==`bigint`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Gd=null;function Kd(){var e=window.event;return e&&e.type===`popstate`?e!==Gd&&(Gd=e,!0):(Gd=null,!1)}var qd=typeof setTimeout==`function`?setTimeout:void 0,Jd=typeof clearTimeout==`function`?clearTimeout:void 0,Yd=typeof Promise==`function`?Promise:void 0,Xd=typeof queueMicrotask==`function`?queueMicrotask:Yd===void 0?qd:function(e){return Yd.resolve(null).then(e).catch(Zd)};function Zd(e){setTimeout(function(){throw e})}function Qd(e){return e===`head`}function $d(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8){if(n=i.data,n===`/$`||n===`/&`){if(r===0){e.removeChild(i),Pp(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)mf(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,mf(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[tt]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&mf(e.ownerDocument.body)}n=i}while(n);Pp(t)}function ef(e,t){var n=e;e=0;do{var r=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display=`none`):(n.style.display=n._stashedDisplay||``,n.getAttribute(`style`)===``&&n.removeAttribute(`style`)):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=``):n.nodeValue=n._stashedText||``),r&&r.nodeType===8){if(n=r.data,n===`/$`){if(e===0)break;e--}else n!==`$`&&n!==`$?`&&n!==`$~`&&n!==`$!`||e++}n=r}while(n)}function tf(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case`HTML`:case`HEAD`:case`BODY`:tf(n),nt(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function nf(e,t,n,r){for(;e.nodeType===1;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!==`INPUT`||e.type!==`hidden`))break}else if(!r){if(t===`input`&&e.type===`hidden`){var a=i.name==null?null:``+i.name;if(i.type===`hidden`&&e.getAttribute(`name`)===a)return e}else return e}else if(!e[tt])switch(t){case`meta`:if(!e.hasAttribute(`itemprop`))break;return e;case`link`:if(a=e.getAttribute(`rel`),a===`stylesheet`&&e.hasAttribute(`data-precedence`)||a!==i.rel||e.getAttribute(`href`)!==(i.href==null||i.href===``?null:i.href)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute(`title`)!==(i.title==null?null:i.title))break;return e;case`style`:if(e.hasAttribute(`data-precedence`))break;return e;case`script`:if(a=e.getAttribute(`src`),(a!==(i.src==null?null:i.src)||e.getAttribute(`type`)!==(i.type==null?null:i.type)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin))&&a&&e.hasAttribute(`async`)&&!e.hasAttribute(`itemprop`))break;return e;default:return e}if(e=lf(e.nextSibling),e===null)break}return null}function rf(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=lf(e.nextSibling),e===null))return null;return e}function af(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=lf(e.nextSibling),e===null))return null;return e}function of(e){return e.data===`$?`||e.data===`$~`}function sf(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function cf(e,t){var n=e.ownerDocument;if(e.data===`$~`)e._reactRetry=t;else if(e.data!==`$?`||n.readyState!==`loading`)t();else{var r=function(){t(),n.removeEventListener(`DOMContentLoaded`,r)};n.addEventListener(`DOMContentLoaded`,r),e._reactRetry=r}}function lf(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t===`$`||t===`$!`||t===`$?`||t===`$~`||t===`&`||t===`F!`||t===`F`)break;if(t===`/$`||t===`/&`)return null}}return e}var uf=null;function df(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return lf(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function ff(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`||n===`$~`||n===`&`){if(t===0)return e;t--}else n!==`/$`&&n!==`/&`||t++}e=e.previousSibling}return null}function pf(e,t,n){switch(t=Vd(n),e){case`html`:if(e=t.documentElement,!e)throw Error(i(452));return e;case`head`:if(e=t.head,!e)throw Error(i(453));return e;case`body`:if(e=t.body,!e)throw Error(i(454));return e;default:throw Error(i(451))}}function mf(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);nt(e)}var hf=new Map,gf=new Set;function _f(e){return typeof e.getRootNode==`function`?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var vf=L.d;L.d={f:yf,r:bf,D:Cf,C:wf,L:Tf,m:Ef,X:Of,S:Df,M:kf};function yf(){var e=vf.f(),t=yu();return e||t}function bf(e){var t=it(e);t!==null&&t.tag===5&&t.type===`form`?ys(t):vf.r(e)}var xf=typeof document>`u`?null:document;function Sf(e,t,n){var r=xf;if(r&&typeof t==`string`&&t){var i=Et(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),gf.has(i)||(gf.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Fd(t,`link`,e),st(t),r.head.appendChild(t)))}}function Cf(e){vf.D(e),Sf(`dns-prefetch`,e,null)}function wf(e,t){vf.C(e,t),Sf(`preconnect`,e,t)}function Tf(e,t,n){vf.L(e,t,n);var r=xf;if(r&&e&&t){var i=`link[rel="preload"][as="`+Et(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Et(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Et(n.imageSizes)+`"]`)):i+=`[href="`+Et(e)+`"]`;var a=i;switch(t){case`style`:a=jf(e);break;case`script`:a=Ff(e)}hf.has(a)||(e=m({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),hf.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(Mf(a))||t===`script`&&r.querySelector(If(a))||(t=r.createElement(`link`),Fd(t,`link`,e),st(t),r.head.appendChild(t)))}}function Ef(e,t){vf.m(e,t);var n=xf;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+Et(r)+`"][href="`+Et(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Ff(e)}if(!hf.has(a)&&(e=m({rel:`modulepreload`,href:e},t),hf.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(If(a)))return}r=n.createElement(`link`),Fd(r,`link`,e),st(r),n.head.appendChild(r)}}}function Df(e,t,n){vf.S(e,t,n);var r=xf;if(r&&e){var i=ot(r).hoistableStyles,a=jf(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(Mf(a)))s.loading=5;else{e=m({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=hf.get(a))&&zf(e,n);var c=o=r.createElement(`link`);st(c),Fd(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Rf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Of(e,t){vf.X(e,t);var n=xf;if(n&&e){var r=ot(n).hoistableScripts,i=Ff(e),a=r.get(i);a||(a=n.querySelector(If(i)),a||(e=m({src:e,async:!0},t),(t=hf.get(i))&&Bf(e,t),a=n.createElement(`script`),st(a),Fd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function kf(e,t){vf.M(e,t);var n=xf;if(n&&e){var r=ot(n).hoistableScripts,i=Ff(e),a=r.get(i);a||(a=n.querySelector(If(i)),a||(e=m({src:e,async:!0,type:`module`},t),(t=hf.get(i))&&Bf(e,t),a=n.createElement(`script`),st(a),Fd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Af(e,t,n,r){var a=(a=G.current)?_f(a):null;if(!a)throw Error(i(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(t=jf(n.href),n=ot(a).hoistableStyles,r=n.get(t),r||(r={type:`style`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=jf(n.href);var o=ot(a).hoistableStyles,s=o.get(e);if(s||(a=a.ownerDocument||a,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=a.querySelector(Mf(e)))&&!o._p&&(s.instance=o,s.state.loading=5),hf.has(e)||(n={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},hf.set(e,n),o||Pf(a,e,n,s.state))),t&&r===null)throw Error(i(528,``));return s}if(t&&r!==null)throw Error(i(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(t=Ff(n),n=ot(a).hoistableScripts,r=n.get(t),r||(r={type:`script`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(i(444,e))}}function jf(e){return`href="`+Et(e)+`"`}function Mf(e){return`link[rel="stylesheet"][`+e+`]`}function Nf(e){return m({},e,{"data-precedence":e.precedence,precedence:null})}function Pf(e,t,n,r){e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)?r.loading=1:(t=e.createElement(`link`),r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2}),Fd(t,`link`,n),st(t),e.head.appendChild(t))}function Ff(e){return`[src="`+Et(e)+`"]`}function If(e){return`script[async]`+e}function Lf(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Et(n.href)+`"]`);if(r)return t.instance=r,st(r),r;var a=m({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),st(r),Fd(r,`style`,a),Rf(r,n.precedence,e),t.instance=r;case`stylesheet`:a=jf(n.href);var o=e.querySelector(Mf(a));if(o)return t.state.loading|=4,t.instance=o,st(o),o;r=Nf(n),(a=hf.get(a))&&zf(r,a),o=(e.ownerDocument||e).createElement(`link`),st(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),Fd(o,`link`,r),t.state.loading|=4,Rf(o,n.precedence,e),t.instance=o;case`script`:return o=Ff(n.src),(a=e.querySelector(If(o)))?(t.instance=a,st(a),a):(r=n,(a=hf.get(o))&&(r=m({},n),Bf(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),st(a),Fd(a,`link`,r),e.head.appendChild(a),t.instance=a);case`void`:return null;default:throw Error(i(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Rf(r,n.precedence,e));return t.instance}function Rf(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o<r.length;o++){var s=r[o];if(s.dataset.precedence===t)a=s;else if(a!==i)break}a?a.parentNode.insertBefore(e,a.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function zf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function Bf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var Vf=null;function Hf(e,t,n){if(Vf===null){var r=new Map,i=Vf=new Map;i.set(n,r)}else i=Vf,r=i.get(n),r||(r=new Map,i.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),i=0;i<n.length;i++){var a=n[i];if(!(a[tt]||a[Je]||e===`link`&&a.getAttribute(`rel`)===`stylesheet`)&&a.namespaceURI!==`http://www.w3.org/2000/svg`){var o=a.getAttribute(t)||``;o=e+o;var s=r.get(o);s?s.push(a):r.set(o,[a])}}return r}function Uf(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function Wf(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function Gf(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Kf(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=jf(r.href),a=t.querySelector(Mf(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=Yf.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,st(a);return}a=t.ownerDocument||t,r=Nf(r),(i=hf.get(i))&&zf(r,i),a=a.createElement(`link`),st(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Fd(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=Yf.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var qf=0;function Jf(e,t){return e.stylesheets&&e.count===0&&Zf(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&Zf(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&qf===0&&(qf=62500*Rd());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Zf(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>qf?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function Yf(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Zf(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Xf=null;function Zf(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Xf=new Map,t.forEach(Qf,e),Xf=null,Yf.call(e))}function Qf(e,t){if(!(t.state.loading&4)){var n=Xf.get(e);if(n)var r=n.get(null);else{n=new Map,Xf.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a<i.length;a++){var o=i[a];(o.nodeName===`LINK`||o.getAttribute(`media`)!==`not all`)&&(n.set(o.dataset.precedence,o),r=o)}r&&n.set(null,r)}i=t.instance,o=i.getAttribute(`data-precedence`),a=n.get(o)||r,a===r&&n.set(null,i),n.set(o,i),this.count++,r=Yf.bind(this),i.addEventListener(`load`,r),i.addEventListener(`error`,r),a?a.parentNode.insertBefore(i,a.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),t.state.loading|=4}}var $f={$$typeof:C,Provider:null,Consumer:null,_currentValue:R,_currentValue2:R,_threadCount:0};function ep(e,t,n,r,i,a,o,s,c){this.tag=1,this.containerInfo=e,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=Le(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Le(0),this.hiddenUpdates=Le(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.incompleteTransitions=new Map}function tp(e,t,n,r,i,a,o,s,c,l,u,d){return e=new ep(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=Xr(3,null,null,t),e.current=a,a.stateNode=e,t=Zi(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},Aa(a),e}function np(e){return e?(e=Jr,e):Jr}function rp(e,t,n,r,i,a){i=np(i),r.context===null?r.context=i:r.pendingContext=i,r=Ma(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=Na(e,r,t),n!==null&&(mu(n,e,t),Pa(n,e,t))}function ip(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function ap(e,t){ip(e,t),(e=e.alternate)&&ip(e,t)}function op(e){if(e.tag===13||e.tag===31){var t=Gr(e,67108864);t!==null&&mu(t,e,67108864),ap(e,67108864)}}function sp(e){if(e.tag===13||e.tag===31){var t=fu();t=Ue(t);var n=Gr(e,t);n!==null&&mu(n,e,t),ap(e,t)}}var cp=!0;function lp(e,t,n,r){var i=I.T;I.T=null;var a=L.p;try{L.p=2,dp(e,t,n,r)}finally{L.p=a,I.T=i}}function up(e,t,n,r){var i=I.T;I.T=null;var a=L.p;try{L.p=8,dp(e,t,n,r)}finally{L.p=a,I.T=i}}function dp(e,t,n,r){if(cp){var i=fp(r);if(i===null)wd(e,t,r,pp,n),wp(e,r);else if(Ep(i,e,t,n,r))r.stopPropagation();else if(wp(e,r),t&4&&-1<Cp.indexOf(e)){for(;i!==null;){var a=it(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=Me(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-Ee(o);s.entanglements[1]|=c,o&=~c}rd(a),!(Nl&6)&&(eu=me()+500,id(0,!1))}}break;case 31:case 13:s=Gr(a,2),s!==null&&mu(s,a,2),yu(),ap(a,2)}if(a=fp(r),a===null&&wd(e,t,r,pp,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else wd(e,t,r,null,n)}}function fp(e){return e=Ut(e),mp(e)}var pp=null;function mp(e){if(pp=null,e=rt(e),e!==null){var t=o(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=s(t),e!==null)return e;e=null}else if(n===31){if(e=c(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return pp=e,null}function hp(e){switch(e){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`resize`: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`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`scroll`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 8;case`message`:switch(he()){case ge:return 2;case _e:return 8;case ve:case ye:return 32;case be:return 268435456;default:return 32}default:return 32}}var gp=!1,_p=null,vp=null,yp=null,bp=new Map,xp=new Map,Sp=[],Cp=`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 wp(e,t){switch(e){case`focusin`:case`focusout`:_p=null;break;case`dragenter`:case`dragleave`:vp=null;break;case`mouseover`:case`mouseout`:yp=null;break;case`pointerover`:case`pointerout`:bp.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:xp.delete(t.pointerId)}}function Tp(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=it(t),t!==null&&op(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Ep(e,t,n,r,i){switch(t){case`focusin`:return _p=Tp(_p,e,t,n,r,i),!0;case`dragenter`:return vp=Tp(vp,e,t,n,r,i),!0;case`mouseover`:return yp=Tp(yp,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return bp.set(a,Tp(bp.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,xp.set(a,Tp(xp.get(a)||null,e,t,n,r,i)),!0}return!1}function Dp(e){var t=rt(e.target);if(t!==null){var n=o(t);if(n!==null){if(t=n.tag,t===13){if(t=s(n),t!==null){e.blockedOn=t,Ke(e.priority,function(){sp(n)});return}}else if(t===31){if(t=c(n),t!==null){e.blockedOn=t,Ke(e.priority,function(){sp(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Op(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=fp(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Ht=r,n.target.dispatchEvent(r),Ht=null}else return t=it(n),t!==null&&op(t),e.blockedOn=n,!1;t.shift()}return!0}function kp(e,t,n){Op(e)&&n.delete(t)}function Ap(){gp=!1,_p!==null&&Op(_p)&&(_p=null),vp!==null&&Op(vp)&&(vp=null),yp!==null&&Op(yp)&&(yp=null),bp.forEach(kp),xp.forEach(kp)}function jp(e,n){e.blockedOn===n&&(e.blockedOn=null,gp||(gp=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Ap)))}var Mp=null;function Np(e){Mp!==e&&(Mp=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Mp===e&&(Mp=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],i=e[t+2];if(typeof r!=`function`){if(mp(r||n)===null)continue;break}var a=it(n);a!==null&&(e.splice(t,3),t-=3,_s(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Pp(e){function t(t){return jp(t,e)}_p!==null&&jp(_p,e),vp!==null&&jp(vp,e),yp!==null&&jp(yp,e),bp.forEach(t),xp.forEach(t);for(var n=0;n<Sp.length;n++){var r=Sp[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<Sp.length&&(n=Sp[0],n.blockedOn===null);)Dp(n),n.blockedOn===null&&Sp.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var i=n[r],a=n[r+1],o=i[Ye]||null;if(typeof a==`function`)o||Np(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[Ye]||null)s=o.formAction;else if(mp(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Np(n)}}}function Fp(){function e(e){e.canIntercept&&e.info===`react-transition`&&e.intercept({handler:function(){return new Promise(function(e){return i=e})},focusReset:`manual`,scroll:`manual`})}function t(){i!==null&&(i(),i=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var e=navigation.currentEntry;e&&e.url!=null&&navigation.navigate(e.url,{state:e.getState(),info:`react-transition`,history:`replace`})}}if(typeof navigation==`object`){var r=!1,i=null;return navigation.addEventListener(`navigate`,e),navigation.addEventListener(`navigatesuccess`,t),navigation.addEventListener(`navigateerror`,t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener(`navigate`,e),navigation.removeEventListener(`navigatesuccess`,t),navigation.removeEventListener(`navigateerror`,t),i!==null&&(i(),i=null)}}}function Ip(e){this._internalRoot=e}Lp.prototype.render=Ip.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(i(409));var n=t.current;rp(n,fu(),e,t,null,null)},Lp.prototype.unmount=Ip.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;rp(e.current,2,null,e,null,null),yu(),t[Xe]=null}};function Lp(e){this._internalRoot=e}Lp.prototype.unstable_scheduleHydration=function(e){if(e){var t=Ge();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Sp.length&&t!==0&&t<Sp[n].priority;n++);Sp.splice(n,0,e),n===0&&Dp(e)}};var Rp=n.version;if(Rp!==`19.2.8`)throw Error(i(527,Rp,`19.2.8`));L.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(i(188)):(e=Object.keys(e).join(`,`),Error(i(268,e)));return e=u(t),e=e===null?null:f(e),e=e===null?null:e.stateNode,e};var zp={bundleType:0,version:`19.2.8`,rendererPackageName:`react-dom`,currentDispatcherRef:I,reconcilerVersion:`19.2.8`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var Bp=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Bp.isDisabled&&Bp.supportsFiber)try{Ce=Bp.inject(zp),we=Bp}catch{}}e.createRoot=function(e,t){if(!a(e))throw Error(i(299));var n=!1,r=``,o=Bs,s=Vs,c=Hs;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(o=t.onUncaughtError),t.onCaughtError!==void 0&&(s=t.onCaughtError),t.onRecoverableError!==void 0&&(c=t.onRecoverableError)),t=tp(e,1,!1,null,null,n,r,null,o,s,c,Fp),e[Xe]=t.current,Sd(e),new Ip(t)}})),_=o(((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(e){console.error(e)}}n(),t.exports=g()}))();function v(e){return new Worker(``+new URL(`elk-worker.min-D8OVqK8T.js`,import.meta.url).href,{type:`module`,name:e?.name})}var y=p();function b(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function x(e){if(Array.isArray(e))return e}function S(e){if(Array.isArray(e))return b(e)}function C(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function w(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,F(r.key),r)}}function T(e,t,n){return t&&w(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function E(e,t){var n=typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(!n){if(Array.isArray(e)||(n=L(e))||t){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw TypeError(`Invalid attempt to iterate non-iterable instance.
10
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a,o=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||n.return==null||n.return()}finally{if(s)throw a}}}}function D(e,t,n){return(t=F(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function O(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function k(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function A(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
11
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function j(){throw TypeError(`Invalid attempt to spread non-iterable instance.
12
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function M(e,t){return x(e)||k(e,t)||L(e,t)||A()}function N(e){return S(e)||O(e)||L(e)||j()}function P(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return String(e)}function F(e){var t=P(e,`string`);return typeof t==`symbol`?t:t+``}function I(e){"@babel/helpers - typeof";return I=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},I(e)}function L(e,t){if(e){if(typeof e==`string`)return b(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?b(e,t):void 0}}var R=typeof window>`u`?null:window,ee=R?R.navigator:null;R&&R.document;var z=I(``),B=I({}),V=I(function(){}),H=typeof HTMLElement>`u`?`undefined`:I(HTMLElement),U=function(e){return e&&e.instanceString&&G(e.instanceString)?e.instanceString():null},W=function(e){return e!=null&&I(e)==z},G=function(e){return e!=null&&I(e)===V},K=function(e){return!re(e)&&(Array.isArray?Array.isArray(e):e!=null&&e instanceof Array)},q=function(e){return e!=null&&I(e)===B&&!K(e)&&e.constructor===Object},J=function(e){return e!=null&&I(e)===B},Y=function(e){return e!=null&&I(e)===I(1)&&!isNaN(e)},te=function(e){return Y(e)&&Math.floor(e)===e},ne=function(e){if(H!==`undefined`)return e!=null&&e instanceof HTMLElement},re=function(e){return ie(e)||ae(e)},ie=function(e){return U(e)===`collection`&&e._private.single},ae=function(e){return U(e)===`collection`&&!e._private.single},oe=function(e){return U(e)===`core`},se=function(e){return U(e)===`stylesheet`},ce=function(e){return U(e)===`event`},le=function(e){return e==null||!!(e===``||e.match(/^\s+$/))},ue=function(e){return typeof HTMLElement>`u`?!1:e instanceof HTMLElement},de=function(e){return q(e)&&Y(e.x1)&&Y(e.x2)&&Y(e.y1)&&Y(e.y2)},fe=function(e){return J(e)&&G(e.then)},pe=function(){return ee&&ee.userAgent.match(/msie|trident|edge/i)},me=function(e,t){t||=function(){if(arguments.length===1)return arguments[0];if(arguments.length===0)return`undefined`;for(var e=[],t=0;t<arguments.length;t++)e.push(arguments[t]);return e.join(`$`)};var n=function(){var r=this,i=arguments,a,o=t.apply(r,i),s=n.cache;return(a=s[o])||(a=s[o]=e.apply(r,i)),a};return n.cache={},n},he=me(function(e){return e.replace(/([A-Z])/g,function(e){return`-`+e.toLowerCase()})}),ge=me(function(e){return e.replace(/(-\w)/g,function(e){return e[1].toUpperCase()})}),_e=me(function(e,t){return e+t[0].toUpperCase()+t.substring(1)},function(e,t){return e+`$`+t}),ve=function(e){return le(e)?e:e.charAt(0).toUpperCase()+e.substring(1)},ye=function(e,t){return e.slice(-1*t.length)===t},be=`(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))`,xe=`rgb[a]?\\((`+be+`[%]?)\\s*,\\s*(`+be+`[%]?)\\s*,\\s*(`+be+`[%]?)(?:\\s*,\\s*(`+be+`))?\\)`,Se=`rgb[a]?\\((?:`+be+`[%]?)\\s*,\\s*(?:`+be+`[%]?)\\s*,\\s*(?:`+be+`[%]?)(?:\\s*,\\s*(?:`+be+`))?\\)`,Ce=`hsl[a]?\\((`+be+`)\\s*,\\s*(`+be+`[%])\\s*,\\s*(`+be+`[%])(?:\\s*,\\s*(`+be+`))?\\)`,we=`hsl[a]?\\((?:`+be+`)\\s*,\\s*(?:`+be+`[%])\\s*,\\s*(?:`+be+`[%])(?:\\s*,\\s*(?:`+be+`))?\\)`,Te=`\\#[0-9a-fA-F]{3}`,Ee=`\\#[0-9a-fA-F]{6}`,De=function(e,t){return e<t?-1:+(e>t)},Oe=function(e,t){return-1*De(e,t)},X=Object.assign==null?function(e){for(var t=arguments,n=1;n<t.length;n++){var r=t[n];if(r!=null)for(var i=Object.keys(r),a=0;a<i.length;a++){var o=i[a];e[o]=r[o]}}return e}:Object.assign.bind(Object),ke=function(e){if(!(e.length!==4&&e.length!==7||e[0]!==`#`)){var t=e.length===4,n,r,i,a=16;return t?(n=parseInt(e[1]+e[1],a),r=parseInt(e[2]+e[2],a),i=parseInt(e[3]+e[3],a)):(n=parseInt(e[1]+e[2],a),r=parseInt(e[3]+e[4],a),i=parseInt(e[5]+e[6],a)),[n,r,i]}},Ae=function(e){var t,n,r,i,a,o,s,c;function l(e,t,n){return n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}var u=RegExp(`^`+Ce+`$`).exec(e);if(u){if(n=parseInt(u[1]),n<0?n=(360- -1*n%360)%360:n>360&&(n%=360),n/=360,r=parseFloat(u[2]),r<0||r>100||(r/=100,i=parseFloat(u[3]),i<0||i>100)||(i/=100,a=u[4],a!==void 0&&(a=parseFloat(a),a<0||a>1)))return;if(r===0)o=s=c=Math.round(i*255);else{var d=i<.5?i*(1+r):i+r-i*r,f=2*i-d;o=Math.round(255*l(f,d,n+1/3)),s=Math.round(255*l(f,d,n)),c=Math.round(255*l(f,d,n-1/3))}t=[o,s,c,a]}return t},je=function(e){var t,n=RegExp(`^`+xe+`$`).exec(e);if(n){t=[];for(var r=[],i=1;i<=3;i++){var a=n[i];if(a[a.length-1]===`%`&&(r[i]=!0),a=parseFloat(a),r[i]&&(a=a/100*255),a<0||a>255)return;t.push(Math.floor(a))}var o=r[1]||r[2]||r[3],s=r[1]&&r[2]&&r[3];if(o&&!s)return;var c=n[4];if(c!==void 0){if(c=parseFloat(c),c<0||c>1)return;t.push(c)}}return t},Me=function(e){return Pe[e.toLowerCase()]},Ne=function(e){return(K(e)?e:null)||Me(e)||ke(e)||je(e)||Ae(e)},Pe={transparent:[0,0,0,0],aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],grey:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},Fe=function(e){for(var t=e.map,n=e.keys,r=n.length,i=0;i<r;i++){var a=n[i];if(q(a))throw Error(`Tried to set map with object key`);i<n.length-1?(t[a]??(t[a]={}),t=t[a]):t[a]=e.value}},Ie=function(e){for(var t=e.map,n=e.keys,r=n.length,i=0;i<r;i++){var a=n[i];if(q(a))throw Error(`Tried to get map with object key`);if(t=t[a],t==null)return t}return t},Le=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};function Re(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,`default`)?e.default:e}var ze,Be;function Ve(){if(Be)return ze;Be=1;function e(e){var t=typeof e;return e!=null&&(t==`object`||t==`function`)}return ze=e,ze}var He,Ue;function We(){return Ue?He:(Ue=1,He=typeof Le==`object`&&Le&&Le.Object===Object&&Le,He)}var Ge,Ke;function qe(){if(Ke)return Ge;Ke=1;var e=We(),t=typeof self==`object`&&self&&self.Object===Object&&self;return Ge=e||t||Function(`return this`)(),Ge}var Je,Ye;function Xe(){if(Ye)return Je;Ye=1;var e=qe();return Je=function(){return e.Date.now()},Je}var Ze,Qe;function $e(){if(Qe)return Ze;Qe=1;var e=/\s/;function t(t){for(var n=t.length;n--&&e.test(t.charAt(n)););return n}return Ze=t,Ze}var et,tt;function nt(){if(tt)return et;tt=1;var e=$e(),t=/^\s+/;function n(n){return n&&n.slice(0,e(n)+1).replace(t,``)}return et=n,et}var rt,it;function at(){return it?rt:(it=1,rt=qe().Symbol,rt)}var ot,st;function ct(){if(st)return ot;st=1;var e=at(),t=Object.prototype,n=t.hasOwnProperty,r=t.toString,i=e?e.toStringTag:void 0;function a(e){var t=n.call(e,i),a=e[i];try{e[i]=void 0;var o=!0}catch{}var s=r.call(e);return o&&(t?e[i]=a:delete e[i]),s}return ot=a,ot}var lt,ut;function dt(){if(ut)return lt;ut=1;var e=Object.prototype.toString;function t(t){return e.call(t)}return lt=t,lt}var ft,pt;function mt(){if(pt)return ft;pt=1;var e=at(),t=ct(),n=dt(),r=`[object Null]`,i=`[object Undefined]`,a=e?e.toStringTag:void 0;function o(e){return e==null?e===void 0?i:r:a&&a in Object(e)?t(e):n(e)}return ft=o,ft}var ht,gt;function _t(){if(gt)return ht;gt=1;function e(e){return typeof e==`object`&&!!e}return ht=e,ht}var vt,yt;function bt(){if(yt)return vt;yt=1;var e=mt(),t=_t(),n=`[object Symbol]`;function r(r){return typeof r==`symbol`||t(r)&&e(r)==n}return vt=r,vt}var xt,St;function Ct(){if(St)return xt;St=1;var e=nt(),t=Ve(),n=bt(),r=NaN,i=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,o=/^0o[0-7]+$/i,s=parseInt;function c(c){if(typeof c==`number`)return c;if(n(c))return r;if(t(c)){var l=typeof c.valueOf==`function`?c.valueOf():c;c=t(l)?l+``:l}if(typeof c!=`string`)return c===0?c:+c;c=e(c);var u=a.test(c);return u||o.test(c)?s(c.slice(2),u?2:8):i.test(c)?r:+c}return xt=c,xt}var wt,Tt;function Et(){if(Tt)return wt;Tt=1;var e=Ve(),t=Xe(),n=Ct(),r=`Expected a function`,i=Math.max,a=Math.min;function o(o,s,c){var l,u,d,f,p,m,h=0,g=!1,_=!1,v=!0;if(typeof o!=`function`)throw TypeError(r);s=n(s)||0,e(c)&&(g=!!c.leading,_=`maxWait`in c,d=_?i(n(c.maxWait)||0,s):d,v=`trailing`in c?!!c.trailing:v);function y(e){var t=l,n=u;return l=u=void 0,h=e,f=o.apply(n,t),f}function b(e){return h=e,p=setTimeout(C,s),g?y(e):f}function x(e){var t=e-m,n=e-h,r=s-t;return _?a(r,d-n):r}function S(e){var t=e-m,n=e-h;return m===void 0||t>=s||t<0||_&&n>=d}function C(){var e=t();if(S(e))return w(e);p=setTimeout(C,x(e))}function w(e){return p=void 0,v&&l?y(e):(l=u=void 0,f)}function T(){p!==void 0&&clearTimeout(p),h=0,l=m=u=p=void 0}function E(){return p===void 0?f:w(t())}function D(){var e=t(),n=S(e);if(l=arguments,u=this,m=e,n){if(p===void 0)return b(m);if(_)return clearTimeout(p),p=setTimeout(C,s),y(m)}return p===void 0&&(p=setTimeout(C,s)),f}return D.cancel=T,D.flush=E,D}return wt=o,wt}var Dt=Re(Et()),Ot=R?R.performance:null,kt=Ot&&Ot.now?function(){return Ot.now()}:function(){return Date.now()},At=function(){if(R){if(R.requestAnimationFrame)return function(e){R.requestAnimationFrame(e)};if(R.mozRequestAnimationFrame)return function(e){R.mozRequestAnimationFrame(e)};if(R.webkitRequestAnimationFrame)return function(e){R.webkitRequestAnimationFrame(e)};if(R.msRequestAnimationFrame)return function(e){R.msRequestAnimationFrame(e)}}return function(e){e&&setTimeout(function(){e(kt())},1e3/60)}}(),jt=function(e){return At(e)},Mt=kt,Nt=9261,Pt=65599,Ft=5381,It=function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Nt,n;n=e.next(),!n.done;)t=t*Pt+n.value|0;return t},Lt=function(e){return(arguments.length>1&&arguments[1]!==void 0?arguments[1]:Nt)*Pt+e|0},Rt=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Ft;return(t<<5)+t+e|0},zt=function(e,t){return e*2097152+t},Bt=function(e){return e[0]*2097152+e[1]},Vt=function(e,t){return[Lt(e[0],t[0]),Rt(e[1],t[1])]},Ht=function(e,t){var n={value:0,done:!1},r=0,i=e.length;return It({next:function(){return r<i?n.value=e[r++]:n.done=!0,n}},t)},Ut=function(e,t){var n={value:0,done:!1},r=0,i=e.length;return It({next:function(){return r<i?n.value=e.charCodeAt(r++):n.done=!0,n}},t)},Wt=function(){return Gt(arguments)},Gt=function(e){for(var t,n=0;n<e.length;n++){var r=e[n];t=n===0?Ut(r):Ut(r,t)}return t};function Kt(e,t,n,r,i){var a=i*Math.PI/180;return{x:Math.cos(a)*(e-n)-Math.sin(a)*(t-r)+n,y:Math.sin(a)*(e-n)+Math.cos(a)*(t-r)+r}}var qt=function(e,t,n,r,i,a){return{x:(e-n)*i+n,y:(t-r)*a+r}};function Jt(e,t,n){if(n===0)return e;var r=(t.x1+t.x2)/2,i=(t.y1+t.y2)/2,a=t.w/t.h,o=1/a,s=Kt(e.x,e.y,r,i,n),c=qt(s.x,s.y,r,i,a,o);return{x:c.x,y:c.y}}var Yt=!0,Xt=console.warn!=null,Zt=console.trace!=null,Qt=2**53-1||9007199254740991,$t=function(){return!0},en=function(){return!1},tn=function(){return 0},nn=function(){},rn=function(e){throw Error(e)},an=function(e){if(e!==void 0)Yt=!!e;else return Yt},on=function(e){an()&&(Xt?console.warn(e):(console.log(e),Zt&&console.trace()))},sn=function(e){return X({},e)},cn=function(e){return e==null?e:K(e)?e.slice():q(e)?sn(e):e},ln=function(e){return e.slice()},un=function(e,t){for(t=e=``;e++<36;t+=e*51&52?(e^15?8^Math.random()*(e^20?16:4):4).toString(16):`-`);return t},dn={},fn=function(){return dn},pn=function(e){var t=Object.keys(e);return function(n){for(var r={},i=0;i<t.length;i++){var a=t[i],o=n?.[a];r[a]=o===void 0?e[a]:o}return r}},mn=function(e,t,n){for(var r=e.length-1;r>=0;r--)e[r]===t&&e.splice(r,1)},hn=function(e){e.splice(0,e.length)},gn=function(e,t){for(var n=0;n<t.length;n++){var r=t[n];e.push(r)}},_n=function(e,t,n){return n&&(t=_e(n,t)),e[t]},vn=function(e,t,n,r){n&&(t=_e(n,t)),e[t]=r},yn=typeof Map<`u`?Map:function(){function e(){C(this,e),this._obj={}}return T(e,[{key:`set`,value:function(e,t){return this._obj[e]=t,this}},{key:`delete`,value:function(e){return this._obj[e]=void 0,this}},{key:`clear`,value:function(){this._obj={}}},{key:`has`,value:function(e){return this._obj[e]!==void 0}},{key:`get`,value:function(e){return this._obj[e]}}])}(),bn=`undefined`,xn=function(){function e(t){if(C(this,e),this._obj=Object.create(null),this.size=0,t!=null)for(var n=t.instanceString!=null&&t.instanceString()===this.instanceString()?t.toArray():t,r=0;r<n.length;r++)this.add(n[r])}return T(e,[{key:`instanceString`,value:function(){return`set`}},{key:`add`,value:function(e){var t=this._obj;t[e]!==1&&(t[e]=1,this.size++)}},{key:`delete`,value:function(e){var t=this._obj;t[e]===1&&(t[e]=0,this.size--)}},{key:`clear`,value:function(){this._obj=Object.create(null)}},{key:`has`,value:function(e){return this._obj[e]===1}},{key:`toArray`,value:function(){var e=this;return Object.keys(this._obj).filter(function(t){return e.has(t)})}},{key:`forEach`,value:function(e,t){return this.toArray().forEach(e,t)}}])}(),Sn=(typeof Set>`u`?`undefined`:I(Set))===bn?xn:Set,Cn=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(e===void 0||t===void 0||!oe(e)){rn(`An element must have a core reference and parameters set`);return}var r=t.group;if(r??=t.data&&t.data.source!=null&&t.data.target!=null?`edges`:`nodes`,r!==`nodes`&&r!==`edges`){rn("An element must be of type `nodes` or `edges`; you specified `"+r+"`");return}this.length=1,this[0]=this;var i=this._private={cy:e,single:!0,data:t.data||{},position:t.position||{x:0,y:0},autoWidth:void 0,autoHeight:void 0,autoPadding:void 0,compoundBoundsClean:!1,listeners:[],group:r,style:{},rstyle:{},styleCxts:[],styleKeys:{},removed:!0,selected:!!t.selected,selectable:t.selectable===void 0||!!t.selectable,locked:!!t.locked,grabbed:!1,grabbable:t.grabbable===void 0||!!t.grabbable,pannable:t.pannable===void 0?r===`edges`:!!t.pannable,active:!1,classes:new Sn,animation:{current:[],queue:[]},rscratch:{},scratch:t.scratch||{},edges:[],children:[],parent:t.parent&&t.parent.isNode()?t.parent:null,traversalCache:{},backgrounding:!1,bbCache:null,bbCacheShift:{x:0,y:0},bodyBounds:null,overlayBounds:null,labelBounds:{all:null,source:null,target:null,main:null},arrowBounds:{source:null,target:null,"mid-source":null,"mid-target":null}};if(i.position.x??(i.position.x=0),i.position.y??(i.position.y=0),t.renderedPosition){var a=t.renderedPosition,o=e.pan(),s=e.zoom();i.position={x:(a.x-o.x)/s,y:(a.y-o.y)/s}}var c=[];K(t.classes)?c=t.classes:W(t.classes)&&(c=t.classes.split(/\s+/));for(var l=0,u=c.length;l<u;l++){var d=c[l];!d||d===``||i.classes.add(d)}this.createEmitter(),(n===void 0||n)&&this.restore();var f=t.style||t.css;f&&(on("Setting a `style` bypass at element creation should be done only when absolutely necessary. Try to use the stylesheet instead."),this.style(f))},wn=function(e){return e={bfs:e.bfs||!e.dfs,dfs:e.dfs||!e.bfs},function(t,n,r){var i;q(t)&&!re(t)&&(i=t,t=i.roots||i.root,n=i.visit,r=i.directed),r=arguments.length===2&&!G(n)?n:r,n=G(n)?n:function(){};for(var a=this._private.cy,o=t=W(t)?this.filter(t):t,s=[],c=[],l={},u={},d={},f=0,p,m=this.byGroup(),h=m.nodes,g=m.edges,_=0;_<o.length;_++){var v=o[_],y=v.id();v.isNode()&&(s.unshift(v),e.bfs&&(d[y]=!0,c.push(v)),u[y]=0)}for(var b=function(){var t=e.bfs?s.shift():s.pop(),i=t.id();if(e.dfs){if(d[i])return 0;d[i]=!0,c.push(t)}var a=u[i],o=l[i],m=o==null?null:o.source(),_=o==null?null:o.target(),v=o==null?void 0:t.same(m)?_[0]:m[0],y=n(t,o,v,f++,a);if(y===!0)return p=t,1;if(y===!1)return 1;for(var b=t.connectedEdges().filter(function(e){return(!r||e.source().same(t))&&g.has(e)}),x=0;x<b.length;x++){var S=b[x],C=S.connectedNodes().filter(function(e){return!e.same(t)&&h.has(e)}),w=C.id();C.length!==0&&!d[w]&&(C=C[0],s.push(C),e.bfs&&(d[w]=!0,c.push(C)),l[w]=S,u[w]=u[i]+1)}},x;s.length!==0&&(x=b(),x===0||x!==1););for(var S=a.collection(),C=0;C<c.length;C++){var w=c[C],T=l[w.id()];T!=null&&S.push(T),S.push(w)}return{path:a.collection(S),found:a.collection(p)}}},Tn={breadthFirstSearch:wn({bfs:!0}),depthFirstSearch:wn({dfs:!0})};Tn.bfs=Tn.breadthFirstSearch,Tn.dfs=Tn.depthFirstSearch;var En={exports:{}},Dn=En.exports,On;function kn(){return On?En.exports:(On=1,(function(e,t){(function(){var t,n,r=Math.floor,i,a,o,s,c,l,u=Math.min,d,f,p,m,h;n=function(e,t){return e<t?-1:+(e>t)},l=function(e,t,i,a,o){var s;if(i??=0,o??=n,i<0)throw Error(`lo must be non-negative`);for(a??=e.length;i<a;)s=r((i+a)/2),o(t,e[s])<0?a=s:i=s+1;return[].splice.apply(e,[i,i-i].concat(t)),t},o=function(e,t,r){return r??=n,e.push(t),m(e,0,e.length-1,r)},a=function(e,t){var r,i;return t??=n,r=e.pop(),e.length?(i=e[0],e[0]=r,h(e,0,t)):i=r,i},c=function(e,t,r){var i;return r??=n,i=e[0],e[0]=t,h(e,0,r),i},s=function(e,t,r){var i;return r??=n,e.length&&r(e[0],t)<0&&(i=[e[0],t],t=i[0],e[0]=i[1],h(e,0,r)),t},i=function(e,t){var i,a,o,s,c,l;for(t??=n,s=(function(){l=[];for(var t=0,n=r(e.length/2);0<=n?t<n:t>n;0<=n?t++:t--)l.push(t);return l}).apply(this).reverse(),c=[],a=0,o=s.length;a<o;a++)i=s[a],c.push(h(e,i,t));return c},p=function(e,t,r){var i;if(r??=n,i=e.indexOf(t),i!==-1)return m(e,0,i,r),h(e,i,r)},d=function(e,t,r){var a,o,c,l,u;if(r??=n,o=e.slice(0,t),!o.length)return o;for(i(o,r),u=e.slice(t),c=0,l=u.length;c<l;c++)a=u[c],s(o,a,r);return o.sort(r).reverse()},f=function(e,t,r){var o,s,c,d,f,p,m,h,g;if(r??=n,t*10<=e.length){if(c=e.slice(0,t).sort(r),!c.length)return c;for(s=c[c.length-1],m=e.slice(t),d=0,p=m.length;d<p;d++)o=m[d],r(o,s)<0&&(l(c,o,0,null,r),c.pop(),s=c[c.length-1]);return c}for(i(e,r),g=[],f=0,h=u(t,e.length);0<=h?f<h:f>h;0<=h?++f:--f)g.push(a(e,r));return g},m=function(e,t,r,i){var a,o,s;for(i??=n,a=e[r];r>t;){if(s=r-1>>1,o=e[s],i(a,o)<0){e[r]=o,r=s;continue}break}return e[r]=a},h=function(e,t,r){var i,a,o,s,c;for(r??=n,a=e.length,c=t,o=e[t],i=2*t+1;i<a;)s=i+1,s<a&&!(r(e[i],e[s])<0)&&(i=s),e[t]=e[i],t=i,i=2*t+1;return e[t]=o,m(e,c,t,r)},t=(function(){e.push=o,e.pop=a,e.replace=c,e.pushpop=s,e.heapify=i,e.updateItem=p,e.nlargest=d,e.nsmallest=f;function e(e){this.cmp=e??n,this.nodes=[]}return e.prototype.push=function(e){return o(this.nodes,e,this.cmp)},e.prototype.pop=function(){return a(this.nodes,this.cmp)},e.prototype.peek=function(){return this.nodes[0]},e.prototype.contains=function(e){return this.nodes.indexOf(e)!==-1},e.prototype.replace=function(e){return c(this.nodes,e,this.cmp)},e.prototype.pushpop=function(e){return s(this.nodes,e,this.cmp)},e.prototype.heapify=function(){return i(this.nodes,this.cmp)},e.prototype.updateItem=function(e){return p(this.nodes,e,this.cmp)},e.prototype.clear=function(){return this.nodes=[]},e.prototype.empty=function(){return this.nodes.length===0},e.prototype.size=function(){return this.nodes.length},e.prototype.clone=function(){var t=new e;return t.nodes=this.nodes.slice(0),t},e.prototype.toArray=function(){return this.nodes.slice(0)},e.prototype.insert=e.prototype.push,e.prototype.top=e.prototype.peek,e.prototype.front=e.prototype.peek,e.prototype.has=e.prototype.contains,e.prototype.copy=e.prototype.clone,e})(),(function(t,n){return e.exports=n()})(this,function(){return t})}).call(Dn)})(En),En.exports)}var An,jn;function Mn(){return jn?An:(jn=1,An=kn(),An)}var Nn=Re(Mn()),Pn=pn({root:null,weight:function(e){return 1},directed:!1}),Fn={dijkstra:function(e){if(!q(e)){var t=arguments;e={root:t[0],weight:t[1],directed:t[2]}}var n=Pn(e),r=n.root,i=n.weight,a=n.directed,o=this,s=i,c=W(r)?this.filter(r)[0]:r[0],l={},u={},d={},f=this.byGroup(),p=f.nodes,m=f.edges;m.unmergeBy(function(e){return e.isLoop()});for(var h=function(e){return l[e.id()]},g=function(e,t){l[e.id()]=t,_.updateItem(e)},_=new Nn(function(e,t){return h(e)-h(t)}),v=0;v<p.length;v++){var y=p[v];l[y.id()]=y.same(c)?0:1/0,_.push(y)}for(var b=function(e,t){for(var n=(a?e.edgesTo(t):e.edgesWith(t)).intersect(m),r=1/0,i,o=0;o<n.length;o++){var c=n[o],l=s(c);(l<r||!i)&&(r=l,i=c)}return{edge:i,dist:r}};_.size()>0;){var x=_.pop(),S=h(x),C=x.id();if(d[C]=S,S!==1/0)for(var w=x.neighborhood().intersect(p),T=0;T<w.length;T++){var E=w[T],D=E.id(),O=b(x,E),k=S+O.dist;k<h(E)&&(g(E,k),u[D]={node:x,edge:O.edge})}}return{distanceTo:function(e){return d[(W(e)?p.filter(e)[0]:e[0]).id()]},pathTo:function(e){var t=W(e)?p.filter(e)[0]:e[0],n=[],r=t,i=r.id();if(t.length>0)for(n.unshift(t);u[i];){var a=u[i];n.unshift(a.edge),n.unshift(a.node),r=a.node,i=r.id()}return o.spawn(n)}}}},In={kruskal:function(e){e||=function(e){return 1};for(var t=this.byGroup(),n=t.nodes,r=t.edges,i=n.length,a=Array(i),o=n,s=function(e){for(var t=0;t<a.length;t++)if(a[t].has(e))return t},c=0;c<i;c++)a[c]=this.spawn(n[c]);for(var l=r.sort(function(t,n){return e(t)-e(n)}),u=0;u<l.length;u++){var d=l[u],f=d.source()[0],p=d.target()[0],m=s(f),h=s(p),g=a[m],_=a[h];m!==h&&(o.merge(d),g.merge(_),a.splice(h,1))}return o}},Ln=pn({root:null,goal:null,weight:function(e){return 1},heuristic:function(e){return 0},directed:!1}),Rn={aStar:function(e){var t=this.cy(),n=Ln(e),r=n.root,i=n.goal,a=n.heuristic,o=n.directed,s=n.weight;r=t.collection(r)[0],i=t.collection(i)[0];var c=r.id(),l=i.id(),u={},d={},f={},p=new Nn(function(e,t){return d[e.id()]-d[t.id()]}),m=new Sn,h={},g={},_=function(e,t){p.push(e),m.add(t)},v,y,b=function(){v=p.pop(),y=v.id(),m.delete(y)},x=function(e){return m.has(e)};_(r,c),u[c]=0,d[c]=a(r);for(var S=0;p.size()>0;){if(b(),S++,y===l){for(var C=[],w=i,T=l,E=g[T];C.unshift(w),E!=null&&C.unshift(E),w=h[T],w!=null;)T=w.id(),E=g[T];return{found:!0,distance:u[y],path:this.spawn(C),steps:S}}f[y]=!0;for(var D=v._private.edges,O=0;O<D.length;O++){var k=D[O];if(this.hasElementWithId(k.id())&&!(o&&k.data(`source`)!==y)){var A=k.source(),j=k.target(),M=A.id()===y?j:A,N=M.id();if(this.hasElementWithId(N)&&!f[N]){var P=u[y]+s(k);if(!x(N)){u[N]=P,d[N]=P+a(M),_(M,N),h[N]=v,g[N]=k;continue}P<u[N]&&(u[N]=P,d[N]=P+a(M),p.updateItem(M),h[N]=v,g[N]=k)}}}}return{found:!1,distance:void 0,path:void 0,steps:S}}},zn=pn({weight:function(e){return 1},directed:!1}),Bn={floydWarshall:function(e){for(var t=this.cy(),n=zn(e),r=n.weight,i=n.directed,a=r,o=this.byGroup(),s=o.nodes,c=o.edges,l=s.length,u=l*l,d=function(e){return s.indexOf(e)},f=function(e){return s[e]},p=Array(u),m=0;m<u;m++){var h=m%l;(m-h)/l===h?p[m]=0:p[m]=1/0}for(var g=Array(u),_=Array(u),v=0;v<c.length;v++){var y=c[v],b=y.source()[0],x=y.target()[0];if(b!==x){var S=d(b),C=d(x),w=S*l+C,T=a(y);if(p[w]>T&&(p[w]=T,g[w]=C,_[w]=y),!i){var E=C*l+S;!i&&p[E]>T&&(p[E]=T,g[E]=S,_[E]=y)}}}for(var D=0;D<l;D++)for(var O=0;O<l;O++)for(var k=O*l+D,A=0;A<l;A++){var j=O*l+A,M=D*l+A;p[k]+p[M]<p[j]&&(p[j]=p[k]+p[M],g[j]=g[k])}var N=function(e){return(W(e)?t.filter(e):e)[0]},P=function(e){return d(N(e))};return{distance:function(e,t){var n=P(e),r=P(t);return p[n*l+r]},path:function(e,n){var r=P(e),i=P(n),a=f(r);if(r===i)return a.collection();if(g[r*l+i]==null)return t.collection();var o=t.collection(),s=r,c;for(o.merge(a);r!==i;)s=r,r=g[r*l+i],c=_[s*l+r],o.merge(c),o.merge(f(r));return o}}}},Vn=pn({weight:function(e){return 1},directed:!1,root:null}),Hn={bellmanFord:function(e){var t=this,n=Vn(e),r=n.weight,i=n.directed,a=n.root,o=r,s=this,c=this.cy(),l=this.byGroup(),u=l.edges,d=l.nodes,f=d.length,p=new yn,m=!1,h=[];a=c.collection(a)[0],u.unmergeBy(function(e){return e.isLoop()});for(var g=u.length,_=function(e){var t=p.get(e.id());return t||(t={},p.set(e.id(),t)),t},v=function(e){return(W(e)?c.$(e):e)[0]},y=function(e){return _(v(e)).dist},b=function(e){for(var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:a,r=v(e),i=[],o=r;;){if(o==null)return t.spawn();var c=_(o),l=c.edge,u=c.pred;if(i.unshift(o[0]),o.same(n)&&i.length>0)break;l!=null&&i.unshift(l),o=u}return s.spawn(i)},x=0;x<f;x++){var S=d[x],C=_(S);C.dist=S.same(a)?0:1/0,C.pred=null,C.edge=null}for(var w=!1,T=function(e,t,n,r,i,a){var o=r.dist+a;o<i.dist&&!n.same(r.edge)&&(i.dist=o,i.pred=e,i.edge=n,w=!0)},E=1;E<f;E++){w=!1;for(var D=0;D<g;D++){var O=u[D],k=O.source(),A=O.target(),j=o(O),M=_(k),N=_(A);T(k,A,O,M,N,j),i||T(A,k,O,N,M,j)}if(!w)break}if(w)for(var P=[],F=0;F<g;F++){var I=u[F],L=I.source(),R=I.target(),ee=o(I),z=_(L).dist,B=_(R).dist;if(z+ee<B||!i&&B+ee<z){if(m||=(on(`Graph contains a negative weight cycle for Bellman-Ford`),!0),e.findNegativeWeightCycles!==!1){var V=[];z+ee<B&&V.push(L),!i&&B+ee<z&&V.push(R);for(var H=V.length,U=0;U<H;U++){var G=V[U],K=[G];K.push(_(G).edge);for(var q=_(G).pred;K.indexOf(q)===-1;)K.push(q),K.push(_(q).edge),q=_(q).pred;K=K.slice(K.indexOf(q));for(var J=K[0].id(),Y=0,te=2;te<K.length;te+=2)K[te].id()<J&&(J=K[te].id(),Y=te);K=K.slice(Y).concat(K.slice(0,Y)),K.push(K[0]);var ne=K.map(function(e){return e.id()}).join(`,`);P.indexOf(ne)===-1&&(h.push(s.spawn(K)),P.push(ne))}}else break}}return{distanceTo:y,pathTo:b,hasNegativeWeightCycle:m,negativeWeightCycles:h}}},Un=Math.sqrt(2),Wn=function(e,t,n){n.length===0&&rn(`Karger-Stein must be run on a connected (sub)graph`);for(var r=n[e],i=r[1],a=r[2],o=t[i],s=t[a],c=n,l=c.length-1;l>=0;l--){var u=c[l],d=u[1],f=u[2];(t[d]===o&&t[f]===s||t[d]===s&&t[f]===o)&&c.splice(l,1)}for(var p=0;p<c.length;p++){var m=c[p];m[1]===s?(c[p]=m.slice(),c[p][1]=o):m[2]===s&&(c[p]=m.slice(),c[p][2]=o)}for(var h=0;h<t.length;h++)t[h]===s&&(t[h]=o);return c},Gn=function(e,t,n,r){for(;n>r;)t=Wn(Math.floor(Math.random()*t.length),e,t),n--;return t},Kn={kargerStein:function(){var e=this,t=this.byGroup(),n=t.nodes,r=t.edges;r.unmergeBy(function(e){return e.isLoop()});var i=n.length,a=r.length,o=Math.ceil((Math.log(i)/Math.LN2)**2),s=Math.floor(i/Un);if(i<2){rn(`At least 2 nodes are required for Karger-Stein algorithm`);return}for(var c=[],l=0;l<a;l++){var u=r[l];c.push([l,n.indexOf(u.source()),n.indexOf(u.target())])}for(var d=1/0,f=[],p=Array(i),m=Array(i),h=Array(i),g=function(e,t){for(var n=0;n<i;n++)t[n]=e[n]},_=0;_<=o;_++){for(var v=0;v<i;v++)m[v]=v;var y=Gn(m,c.slice(),i,s),b=y.slice();g(m,h);var x=Gn(m,y,s,2),S=Gn(h,b,s,2);x.length<=S.length&&x.length<d?(d=x.length,f=x,g(m,p)):S.length<=x.length&&S.length<d&&(d=S.length,f=S,g(h,p))}for(var C=this.spawn(f.map(function(e){return r[e[0]]})),w=this.spawn(),T=this.spawn(),E=p[0],D=0;D<p.length;D++){var O=p[D],k=n[D];O===E?w.merge(k):T.merge(k)}var A=function(t){var n=e.spawn();return t.forEach(function(t){n.merge(t),t.connectedEdges().forEach(function(t){e.contains(t)&&!C.contains(t)&&n.merge(t)})}),n};return{cut:C,components:[A(w),A(T)],partition1:w,partition2:T}}},qn=function(e){return{x:e.x,y:e.y}},Jn=function(e,t,n){return{x:e.x*t+n.x,y:e.y*t+n.y}},Yn=function(e,t,n){return{x:(e.x-n.x)/t,y:(e.y-n.y)/t}},Xn=function(e){return{x:e[0],y:e[1]}},Zn=function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,r=1/0,i=t;i<n;i++){var a=e[i];isFinite(a)&&(r=Math.min(a,r))}return r},Qn=function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,r=-1/0,i=t;i<n;i++){var a=e[i];isFinite(a)&&(r=Math.max(a,r))}return r},$n=function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,r=0,i=0,a=t;a<n;a++){var o=e[a];isFinite(o)&&(r+=o,i++)}return r/i},er=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0;r?e=e.slice(t,n):(n<e.length&&e.splice(n,e.length-n),t>0&&e.splice(0,t));for(var o=0,s=e.length-1;s>=0;s--){var c=e[s];a?isFinite(c)||(e[s]=-1/0,o++):e.splice(s,1)}i&&e.sort(function(e,t){return e-t});var l=e.length,u=Math.floor(l/2);return l%2==0?(e[u-1+o]+e[u+o])/2:e[u+1+o]},tr=function(e,t){return t===0?e:tr(t,e%t)},nr=function(e){for(var t=e[0],n=0;n<e.length;n++)if(te(e[n]))n>0&&(t=tr(t,e[n]));else return 0;return t},rr=function(e){return Math.PI*e/180},ir=function(e,t){return Math.atan2(t,e)-Math.PI/2},ar=Math.log2||function(e){return Math.log(e)/Math.log(2)},or=function(e){return e>0?1:e<0?-1:0},sr=function(e,t){return Math.sqrt(cr(e,t))},cr=function(e,t){var n=t.x-e.x,r=t.y-e.y;return n*n+r*r},lr=function(e){for(var t=e.length,n=0,r=0;r<t;r++)n+=e[r];for(var i=0;i<t;i++)e[i]=e[i]/n;return e},ur=function(e,t,n,r){return(1-r)*(1-r)*e+2*(1-r)*r*t+r*r*n},dr=function(e,t,n,r){return{x:ur(e.x,t.x,n.x,r),y:ur(e.y,t.y,n.y,r)}},fr=function(e,t,n,r){var i={x:t.x-e.x,y:t.y-e.y},a=sr(e,t),o={x:i.x/a,y:i.y/a};return n??=0,r??=n*a,{x:e.x+o.x*r,y:e.y+o.y*r}},pr=function(e,t,n){return Math.max(e,Math.min(n,t))},mr=function(e){if(e==null)return{x1:1/0,y1:1/0,x2:-1/0,y2:-1/0,w:0,h:0};if(e.x1!=null&&e.y1!=null){if(e.x2!=null&&e.y2!=null&&e.x2>=e.x1&&e.y2>=e.y1)return{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,w:e.x2-e.x1,h:e.y2-e.y1};if(e.w!=null&&e.h!=null&&e.w>=0&&e.h>=0)return{x1:e.x1,y1:e.y1,x2:e.x1+e.w,y2:e.y1+e.h,w:e.w,h:e.h}}},hr=function(e){return{x1:e.x1,x2:e.x2,w:e.w,y1:e.y1,y2:e.y2,h:e.h}},gr=function(e){e.x1=1/0,e.y1=1/0,e.x2=-1/0,e.y2=-1/0,e.w=0,e.h=0},_r=function(e,t){e.x1=Math.min(e.x1,t.x1),e.x2=Math.max(e.x2,t.x2),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,t.y1),e.y2=Math.max(e.y2,t.y2),e.h=e.y2-e.y1},vr=function(e,t,n){e.x1=Math.min(e.x1,t),e.x2=Math.max(e.x2,t),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,n),e.y2=Math.max(e.y2,n),e.h=e.y2-e.y1},yr=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return e.x1-=t,e.x2+=t,e.y1-=t,e.y2+=t,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},br=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[0],n,r,i,a;if(t.length===1)n=r=i=a=t[0];else if(t.length===2)n=i=t[0],a=r=t[1];else if(t.length===4){var o=M(t,4);n=o[0],r=o[1],i=o[2],a=o[3]}return e.x1-=a,e.x2+=r,e.y1-=n,e.y2+=i,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},xr=function(e,t){e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1},Sr=function(e,t){return!(e.x1>t.x2||t.x1>e.x2||e.x2<t.x1||t.x2<e.x1||e.y2<t.y1||t.y2<e.y1||e.y1>t.y2||t.y1>e.y2)},Cr=function(e,t,n){return e.x1<=t&&t<=e.x2&&e.y1<=n&&n<=e.y2},wr=function(e,t){return Cr(e,t.x,t.y)},Tr=function(e,t){return Cr(e,t.x1,t.y1)&&Cr(e,t.x2,t.y2)},Er=Math.hypot??function(e,t){return Math.sqrt(e*e+t*t)};function Dr(e,t){if(e.length<3)throw Error(`Need at least 3 vertices`);var n=function(e,t){return{x:e.x+t.x,y:e.y+t.y}},r=function(e,t){return{x:e.x-t.x,y:e.y-t.y}},i=function(e,t){return{x:e.x*t,y:e.y*t}},a=function(e,t){return e.x*t.y-e.y*t.x},o=function(e){var t=Er(e.x,e.y);return t===0?{x:0,y:0}:{x:e.x/t,y:e.y/t}},s=function(e){for(var t=0,n=0;n<e.length;n++){var r=e[n],i=e[(n+1)%e.length];t+=r.x*i.y-i.x*r.y}return t/2},c=function(e,t,o,s){var c=r(t,e),l=r(s,o),u=a(c,l);return Math.abs(u)<1e-9?n(e,i(c,.5)):n(e,i(c,a(r(o,e),l)/u))},l=e.map(function(e){return{x:e.x,y:e.y}});s(l)<0&&l.reverse();for(var u=l.length,d=[],f=0;f<u;f++){var p=l[f],m=l[(f+1)%u],h=r(m,p),g=o({x:h.y,y:-h.x});d.push(g)}for(var _=d.map(function(e,r){return{p1:n(l[r],i(e,t)),p2:n(l[(r+1)%u],i(e,t))}}),v=[],y=0;y<u;y++){var b=_[(y-1+u)%u],x=_[y],S=c(b.p1,b.p2,x.p1,x.p2);v.push(S)}return v}function Or(e,t,n,r,i,a){var o=Dr(Kr(e,t,n,r,i),a),s=mr();return o.forEach(function(e){return vr(s,e.x,e.y)}),s}var kr=function(e,t,n,r,i,a,o){var s=arguments.length>7&&arguments[7]!==void 0?arguments[7]:`auto`,c=s===`auto`?$r(i,a):s,l=i/2,u=a/2;c=Math.min(c,l,u);var d=c!==l,f=c!==u,p;if(d){var m=n-l+c-o,h=r-u-o;if(p=Gr(e,t,n,r,m,h,n+l-c+o,h,!1),p.length>0)return p}if(f){var g=n+l+o;if(p=Gr(e,t,n,r,g,r-u+c-o,g,r+u-c+o,!1),p.length>0)return p}if(d){var _=n-l+c-o,v=r+u+o;if(p=Gr(e,t,n,r,_,v,n+l-c+o,v,!1),p.length>0)return p}if(f){var y=n-l-o;if(p=Gr(e,t,n,r,y,r-u+c-o,y,r+u-c+o,!1),p.length>0)return p}var b,x=n-l+c,S=r-u+c;if(b=Ur(e,t,n,r,x,S,c+o),b.length>0&&b[0]<=x&&b[1]<=S)return[b[0],b[1]];var C=n+l-c,w=r-u+c;if(b=Ur(e,t,n,r,C,w,c+o),b.length>0&&b[0]>=C&&b[1]<=w)return[b[0],b[1]];var T=n+l-c,E=r+u-c;if(b=Ur(e,t,n,r,T,E,c+o),b.length>0&&b[0]>=T&&b[1]>=E)return[b[0],b[1]];var D=n-l+c,O=r+u-c;return b=Ur(e,t,n,r,D,O,c+o),b.length>0&&b[0]<=D&&b[1]>=O?[b[0],b[1]]:[]},Ar=function(e,t,n,r,i,a,o){var s=o,c=Math.min(n,i),l=Math.max(n,i),u=Math.min(r,a),d=Math.max(r,a);return c-s<=e&&e<=l+s&&u-s<=t&&t<=d+s},jr=function(e,t,n,r,i,a,o,s,c){var l={x1:Math.min(n,o,i)-c,x2:Math.max(n,o,i)+c,y1:Math.min(r,s,a)-c,y2:Math.max(r,s,a)+c};return!(e<l.x1||e>l.x2||t<l.y1||t>l.y2)},Mr=function(e,t,n,r){n-=r;var i=t*t-4*e*n;if(i<0)return[];var a=Math.sqrt(i),o=2*e;return[(-t+a)/o,(-t-a)/o]},Nr=function(e,t,n,r,i){e===0&&(e=1e-5),t/=e,n/=e,r/=e;var a,o=(3*n-t*t)/9,s=-(27*r)+t*(9*n-t*t*2),c,l,u,d,f;if(s/=54,a=o*o*o+s*s,i[1]=0,d=t/3,a>0){l=s+Math.sqrt(a),l=l<0?-((-l)**(1/3)):l**(1/3),u=s-Math.sqrt(a),u=u<0?-((-u)**(1/3)):u**(1/3),i[0]=-d+l+u,d+=(l+u)/2,i[4]=i[2]=-d,d=Math.sqrt(3)*(-u+l)/2,i[3]=d,i[5]=-d;return}if(i[5]=i[3]=0,a===0){f=s<0?-((-s)**(1/3)):s**(1/3),i[0]=-d+2*f,i[4]=i[2]=-(f+d);return}o=-o,c=o*o*o,c=Math.acos(s/Math.sqrt(c)),f=2*Math.sqrt(o),i[0]=-d+f*Math.cos(c/3),i[2]=-d+f*Math.cos((c+2*Math.PI)/3),i[4]=-d+f*Math.cos((c+4*Math.PI)/3)},Pr=function(e,t,n,r,i,a,o,s){var c=1*n*n-4*n*i+2*n*o+4*i*i-4*i*o+o*o+r*r-4*r*a+2*r*s+4*a*a-4*a*s+s*s,l=9*n*i-3*n*n-3*n*o-6*i*i+3*i*o+9*r*a-3*r*r-3*r*s-6*a*a+3*a*s,u=3*n*n-6*n*i+n*o-n*e+2*i*i+2*i*e-o*e+3*r*r-6*r*a+r*s-r*t+2*a*a+2*a*t-s*t,d=1*n*i-n*n+n*e-i*e+r*a-r*r+r*t-a*t,f=[];Nr(c,l,u,d,f);for(var p=1e-7,m=[],h=0;h<6;h+=2)Math.abs(f[h+1])<p&&f[h]>=0&&f[h]<=1&&m.push(f[h]);m.push(1),m.push(0);for(var g=-1,_,v,y,b=0;b<m.length;b++)_=(1-m[b])**2*n+2*(1-m[b])*m[b]*i+m[b]*m[b]*o,v=(1-m[b])**2*r+2*(1-m[b])*m[b]*a+m[b]*m[b]*s,y=(_-e)**2+(v-t)**2,g>=0?y<g&&(g=y):g=y;return g},Fr=function(e,t,n,r,i,a){var o=[e-n,t-r],s=[i-n,a-r],c=s[0]*s[0]+s[1]*s[1],l=o[0]*o[0]+o[1]*o[1],u=o[0]*s[0]+o[1]*s[1],d=u*u/c;return u<0?l:d>c?(e-i)*(e-i)+(t-a)*(t-a):l-d},Ir=function(e,t,n){for(var r,i,a,o,s,c=0,l=0;l<n.length/2;l++)if(r=n[l*2],i=n[l*2+1],l+1<n.length/2?(a=n[(l+1)*2],o=n[(l+1)*2+1]):(a=n[(l+1-n.length/2)*2],o=n[(l+1-n.length/2)*2+1]),r!=e||a!=e){if(r>=e&&e>=a||r<=e&&e<=a)s=(e-r)/(a-r)*(o-i)+i,s>t&&c++;else continue}return c%2!=0},Lr=function(e,t,n,r,i,a,o,s,c){var l=Array(n.length),u;s[0]==null?u=s:(u=Math.atan(s[1]/s[0]),s[0]<0?u+=Math.PI/2:u=-u-Math.PI/2);for(var d=Math.cos(-u),f=Math.sin(-u),p=0;p<l.length/2;p++)l[p*2]=a/2*(n[p*2]*d-n[p*2+1]*f),l[p*2+1]=o/2*(n[p*2+1]*d+n[p*2]*f),l[p*2]+=r,l[p*2+1]+=i;return Ir(e,t,c>0?zr(Br(l,-c)):l)},Rr=function(e,t,n,r,i,a,o,s){for(var c=Array(n.length*2),l=0;l<s.length;l++){var u=s[l];if(c[l*4+0]=u.startX,c[l*4+1]=u.startY,c[l*4+2]=u.stopX,c[l*4+3]=u.stopY,(u.cx-e)**2+(u.cy-t)**2<=u.radius**2)return!0}return Ir(e,t,c)},zr=function(e){for(var t=Array(e.length/2),n,r,i,a,o,s,c,l,u=0;u<e.length/4;u++){n=e[u*4],r=e[u*4+1],i=e[u*4+2],a=e[u*4+3],u<e.length/4-1?(o=e[(u+1)*4],s=e[(u+1)*4+1],c=e[(u+1)*4+2],l=e[(u+1)*4+3]):(o=e[0],s=e[1],c=e[2],l=e[3]);var d=Gr(n,r,i,a,o,s,c,l,!0);t[u*2]=d[0],t[u*2+1]=d[1]}return t},Br=function(e,t){for(var n=Array(e.length*2),r,i,a,o,s=0;s<e.length/2;s++){r=e[s*2],i=e[s*2+1],s<e.length/2-1?(a=e[(s+1)*2],o=e[(s+1)*2+1]):(a=e[0],o=e[1]);var c=o-i,l=-(a-r),u=Math.sqrt(c*c+l*l),d=c/u,f=l/u;n[s*4]=r+d*t,n[s*4+1]=i+f*t,n[s*4+2]=a+d*t,n[s*4+3]=o+f*t}return n},Vr=function(e,t,n,r,i,a){var o=n-e,s=r-t;o/=i,s/=a;var c=Math.sqrt(o*o+s*s),l=c-1;if(l<0)return[];var u=l/c;return[(n-e)*u+e,(r-t)*u+t]},Hr=function(e,t,n,r,i,a,o){return e-=i,t-=a,e/=n/2+o,t/=r/2+o,e*e+t*t<=1},Ur=function(e,t,n,r,i,a,o){var s=[n-e,r-t],c=[e-i,t-a],l=s[0]*s[0]+s[1]*s[1],u=2*(c[0]*s[0]+c[1]*s[1]),d=c[0]*c[0]+c[1]*c[1]-o*o,f=u*u-4*l*d;if(f<0)return[];var p=(-u+Math.sqrt(f))/(2*l),m=(-u-Math.sqrt(f))/(2*l),h=Math.min(p,m),g=Math.max(p,m),_=[];if(h>=0&&h<=1&&_.push(h),g>=0&&g<=1&&_.push(g),_.length===0)return[];var v=_[0]*s[0]+e,y=_[0]*s[1]+t;return _.length>1?_[0]==_[1]?[v,y]:[v,y,_[1]*s[0]+e,_[1]*s[1]+t]:[v,y]},Wr=function(e,t,n){return t<=e&&e<=n||n<=e&&e<=t?e:e<=t&&t<=n||n<=t&&t<=e?t:n},Gr=function(e,t,n,r,i,a,o,s,c){var l=e-i,u=n-e,d=o-i,f=t-a,p=r-t,m=s-a,h=d*f-m*l,g=u*f-p*l,_=m*u-d*p;if(_!==0){var v=h/_,y=g/_,b=.001,x=0-b,S=1+b;return x<=v&&v<=S&&x<=y&&y<=S||c?[e+v*u,t+v*p]:[]}return h===0||g===0?Wr(e,n,o)===o?[o,s]:Wr(e,n,i)===i?[i,a]:Wr(i,o,n)===n?[n,r]:[]:[]},Kr=function(e,t,n,r,i){var a=[],o=r/2,s=i/2,c=t,l=n;a.push({x:c+o*e[0],y:l+s*e[1]});for(var u=1;u<e.length/2;u++)a.push({x:c+o*e[u*2],y:l+s*e[u*2+1]});return a},qr=function(e,t,n,r,i,a,o,s){var c=[],l,u=Array(n.length),d=!0;a??(d=!1);var f;if(d){for(var p=0;p<u.length/2;p++)u[p*2]=n[p*2]*a+r,u[p*2+1]=n[p*2+1]*o+i;f=s>0?zr(Br(u,-s)):u}else f=n;for(var m,h,g,_,v=0;v<f.length/2;v++)m=f[v*2],h=f[v*2+1],v<f.length/2-1?(g=f[(v+1)*2],_=f[(v+1)*2+1]):(g=f[0],_=f[1]),l=Gr(e,t,r,i,m,h,g,_),l.length!==0&&c.push(l[0],l[1]);return c},Jr=function(e,t,n,r,i,a,o,s,c){var l=[],u,d=Array(n.length*2);c.forEach(function(n,a){a===0?(d[d.length-2]=n.startX,d[d.length-1]=n.startY):(d[a*4-2]=n.startX,d[a*4-1]=n.startY),d[a*4]=n.stopX,d[a*4+1]=n.stopY,u=Ur(e,t,r,i,n.cx,n.cy,n.radius),u.length!==0&&l.push(u[0],u[1])});for(var f=0;f<d.length/4;f++)u=Gr(e,t,r,i,d[f*4],d[f*4+1],d[f*4+2],d[f*4+3],!1),u.length!==0&&l.push(u[0],u[1]);if(l.length>2){for(var p=[l[0],l[1]],m=(p[0]-e)**2+(p[1]-t)**2,h=1;h<l.length/2;h++){var g=(l[h*2]-e)**2+(l[h*2+1]-t)**2;g<=m&&(p[0]=l[h*2],p[1]=l[h*2+1],m=g)}return p}return l},Yr=function(e,t,n){var r=[e[0]-t[0],e[1]-t[1]],i=Math.sqrt(r[0]*r[0]+r[1]*r[1]),a=(i-n)/i;return a<0&&(a=1e-5),[t[0]+a*r[0],t[1]+a*r[1]]},Xr=function(e,t){var n=Qr(e,t);return n=Zr(n),n},Zr=function(e){for(var t,n,r=e.length/2,i=1/0,a=1/0,o=-1/0,s=-1/0,c=0;c<r;c++)t=e[2*c],n=e[2*c+1],i=Math.min(i,t),o=Math.max(o,t),a=Math.min(a,n),s=Math.max(s,n);for(var l=2/(o-i),u=2/(s-a),d=0;d<r;d++)t=e[2*d]=e[2*d]*l,n=e[2*d+1]=e[2*d+1]*u,i=Math.min(i,t),o=Math.max(o,t),a=Math.min(a,n),s=Math.max(s,n);if(a<-1)for(var f=0;f<r;f++)n=e[2*f+1]=e[2*f+1]+(-1-a);return e},Qr=function(e,t){var n=1/e*2*Math.PI,r=e%2==0?Math.PI/2+n/2:Math.PI/2;r+=t;for(var i=Array(e*2),a,o=0;o<e;o++)a=o*n+r,i[2*o]=Math.cos(a),i[2*o+1]=Math.sin(-a);return i},$r=function(e,t){return Math.min(e/4,t/4,8)},ei=function(e,t){return Math.min(e/10,t/10,8)},ti=function(){return 8},ni=function(e,t,n){return[e-2*t+n,2*(t-e),e]},ri=function(e,t){return{heightOffset:Math.min(15,.05*t),widthOffset:Math.min(100,.25*e),ctrlPtOffsetPct:.05}};function ii(e,t){function n(e){for(var t=[],n=0;n<e.length;n++){var r=e[n],i=e[(n+1)%e.length],a={x:i.x-r.x,y:i.y-r.y},o={x:-a.y,y:a.x},s=Math.sqrt(o.x*o.x+o.y*o.y);t.push({x:o.x/s,y:o.y/s})}return t}function r(e,t){var n=1/0,r=-1/0,i=E(e),a;try{for(i.s();!(a=i.n()).done;){var o=a.value,s=o.x*t.x+o.y*t.y;n=Math.min(n,s),r=Math.max(r,s)}}catch(e){i.e(e)}finally{i.f()}return{min:n,max:r}}function i(e,t){return!(e.max<t.min||t.max<e.min)}var a=E([].concat(N(n(e)),N(n(t)))),o;try{for(a.s();!(o=a.n()).done;){var s=o.value;if(!i(r(e,s),r(t,s)))return!1}}catch(e){a.e(e)}finally{a.f()}return!0}var ai=pn({dampingFactor:.8,precision:1e-6,iterations:200,weight:function(e){return 1}}),oi={pageRank:function(e){for(var t=ai(e),n=t.dampingFactor,r=t.precision,i=t.iterations,a=t.weight,o=this._private.cy,s=this.byGroup(),c=s.nodes,l=s.edges,u=c.length,d=u*u,f=l.length,p=Array(d),m=Array(u),h=(1-n)/u,g=0;g<u;g++){for(var _=0;_<u;_++){var v=g*u+_;p[v]=0}m[g]=0}for(var y=0;y<f;y++){var b=l[y],x=b.data(`source`),S=b.data(`target`);if(x!==S){var C=c.indexOfId(x),w=c.indexOfId(S),T=a(b),E=w*u+C;p[E]+=T,m[C]+=T}}for(var D=1/u+h,O=0;O<u;O++)if(m[O]===0)for(var k=0;k<u;k++){var A=k*u+O;p[A]=D}else for(var j=0;j<u;j++){var M=j*u+O;p[M]=p[M]/m[O]+h}for(var N=Array(u),P=Array(u),F,I=0;I<u;I++)N[I]=1;for(var L=0;L<i;L++){for(var R=0;R<u;R++)P[R]=0;for(var ee=0;ee<u;ee++)for(var z=0;z<u;z++){var B=ee*u+z;P[ee]+=p[B]*N[z]}lr(P),F=N,N=P,P=F;for(var V=0,H=0;H<u;H++){var U=F[H]-N[H];V+=U*U}if(V<r)break}return{rank:function(e){return e=o.collection(e)[0],N[c.indexOf(e)]}}}},si=pn({root:null,weight:function(e){return 1},directed:!1,alpha:0}),ci={degreeCentralityNormalized:function(e){e=si(e);var t=this.cy(),n=this.nodes(),r=n.length;if(e.directed){for(var i={},a={},o=0,s=0,c=0;c<r;c++){var l=n[c],u=l.id();e.root=l;var d=this.degreeCentrality(e);o<d.indegree&&(o=d.indegree),s<d.outdegree&&(s=d.outdegree),i[u]=d.indegree,a[u]=d.outdegree}return{indegree:function(e){return o==0?0:(W(e)&&(e=t.filter(e)),i[e.id()]/o)},outdegree:function(e){return s===0?0:(W(e)&&(e=t.filter(e)),a[e.id()]/s)}}}for(var f={},p=0,m=0;m<r;m++){var h=n[m];e.root=h;var g=this.degreeCentrality(e);p<g.degree&&(p=g.degree),f[h.id()]=g.degree}return{degree:function(e){return p===0?0:(W(e)&&(e=t.filter(e)),f[e.id()]/p)}}},degreeCentrality:function(e){e=si(e);var t=this.cy(),n=this,r=e,i=r.root,a=r.weight,o=r.directed,s=r.alpha;if(i=t.collection(i)[0],o){for(var c=i.connectedEdges(),l=c.filter(function(e){return e.target().same(i)&&n.has(e)}),u=c.filter(function(e){return e.source().same(i)&&n.has(e)}),d=l.length,f=u.length,p=0,m=0,h=0;h<l.length;h++)p+=a(l[h]);for(var g=0;g<u.length;g++)m+=a(u[g]);return{indegree:d**(1-s)*p**+s,outdegree:f**(1-s)*m**+s}}for(var _=i.connectedEdges().intersection(n),v=_.length,y=0,b=0;b<_.length;b++)y+=a(_[b]);return{degree:v**(1-s)*y**+s}}};ci.dc=ci.degreeCentrality,ci.dcn=ci.degreeCentralityNormalised=ci.degreeCentralityNormalized;var li=pn({harmonic:!0,weight:function(){return 1},directed:!1,root:null}),ui={closenessCentralityNormalized:function(e){for(var t=li(e),n=t.harmonic,r=t.weight,i=t.directed,a=this.cy(),o={},s=0,c=this.nodes(),l=this.floydWarshall({weight:r,directed:i}),u=0;u<c.length;u++){for(var d=0,f=c[u],p=0;p<c.length;p++)if(u!==p){var m=l.distance(f,c[p]);d+=n?1/m:m}n||(d=1/d),s<d&&(s=d),o[f.id()]=d}return{closeness:function(e){return s==0?0:(e=W(e)?a.filter(e)[0].id():e.id(),o[e]/s)}}},closenessCentrality:function(e){var t=li(e),n=t.root,r=t.weight,i=t.directed,a=t.harmonic;n=this.filter(n)[0];for(var o=this.dijkstra({root:n,weight:r,directed:i}),s=0,c=this.nodes(),l=0;l<c.length;l++){var u=c[l];if(!u.same(n)){var d=o.distanceTo(u);s+=a?1/d:d}}return a?s:1/s}};ui.cc=ui.closenessCentrality,ui.ccn=ui.closenessCentralityNormalised=ui.closenessCentralityNormalized;var di=pn({weight:null,directed:!1}),fi={betweennessCentrality:function(e){for(var t=di(e),n=t.directed,r=t.weight,i=r!=null,a=this.cy(),o=this.nodes(),s={},c={},l=0,u={set:function(e,t){c[e]=t,t>l&&(l=t)},get:function(e){return c[e]}},d=0;d<o.length;d++){var f=o[d],p=f.id();s[p]=n?f.outgoers().nodes():f.openNeighborhood().nodes(),u.set(p,0)}for(var m=function(){for(var e=o[h].id(),t=[],n={},c={},l={},d=new Nn(function(e,t){return l[e]-l[t]}),f=0;f<o.length;f++){var p=o[f].id();n[p]=[],c[p]=0,l[p]=1/0}for(c[e]=1,l[e]=0,d.push(e);!d.empty();){var m=d.pop();if(t.push(m),i)for(var g=0;g<s[m].length;g++){var _=s[m][g],v=a.getElementById(m),y=void 0;y=v.edgesTo(_).length>0?v.edgesTo(_)[0]:_.edgesTo(v)[0];var b=r(y);_=_.id(),l[_]>l[m]+b&&(l[_]=l[m]+b,d.nodes.indexOf(_)<0?d.push(_):d.updateItem(_),c[_]=0,n[_]=[]),l[_]==l[m]+b&&(c[_]=c[_]+c[m],n[_].push(m))}else for(var x=0;x<s[m].length;x++){var S=s[m][x].id();l[S]==1/0&&(d.push(S),l[S]=l[m]+1),l[S]==l[m]+1&&(c[S]=c[S]+c[m],n[S].push(m))}}for(var C={},w=0;w<o.length;w++)C[o[w].id()]=0;for(;t.length>0;){for(var T=t.pop(),E=0;E<n[T].length;E++){var D=n[T][E];C[D]=C[D]+c[D]/c[T]*(1+C[T])}T!=o[h].id()&&u.set(T,u.get(T)+C[T])}},h=0;h<o.length;h++)m();var g={betweenness:function(e){var t=a.collection(e).id();return u.get(t)},betweennessNormalized:function(e){if(l==0)return 0;var t=a.collection(e).id();return u.get(t)/l}};return g.betweennessNormalised=g.betweennessNormalized,g}};fi.bc=fi.betweennessCentrality;var pi=pn({expandFactor:2,inflateFactor:2,multFactor:1,maxIterations:20,attributes:[function(e){return 1}]}),mi=function(e){return pi(e)},hi=function(e,t){for(var n=0,r=0;r<t.length;r++)n+=t[r](e);return n},gi=function(e,t,n){for(var r=0;r<t;r++)e[r*t+r]=n},_i=function(e,t){for(var n,r=0;r<t;r++){n=0;for(var i=0;i<t;i++)n+=e[i*t+r];for(var a=0;a<t;a++)e[a*t+r]=e[a*t+r]/n}},vi=function(e,t,n){for(var r=Array(n*n),i=0;i<n;i++){for(var a=0;a<n;a++)r[i*n+a]=0;for(var o=0;o<n;o++)for(var s=0;s<n;s++)r[i*n+s]+=e[i*n+o]*t[o*n+s]}return r},yi=function(e,t,n){for(var r=e.slice(0),i=1;i<n;i++)e=vi(e,r,t);return e},bi=function(e,t,n){for(var r=Array(t*t),i=0;i<t*t;i++)r[i]=e[i]**+n;return _i(r,t),r},xi=function(e,t,n,r){for(var i=0;i<n;i++)if(Math.round(e[i]*10**r)/10**r!=Math.round(t[i]*10**r)/10**r)return!1;return!0},Si=function(e,t,n,r){for(var i=[],a=0;a<t;a++){for(var o=[],s=0;s<t;s++)Math.round(e[a*t+s]*1e3)/1e3>0&&o.push(n[s]);o.length!==0&&i.push(r.collection(o))}return i},Ci=function(e,t){for(var n=0;n<e.length;n++)if(!t[n]||e[n].id()!==t[n].id())return!1;return!0},wi=function(e){for(var t=0;t<e.length;t++)for(var n=0;n<e.length;n++)t!=n&&Ci(e[t],e[n])&&e.splice(n,1);return e},Ti=function(e){for(var t=this.nodes(),n=this.edges(),r=this.cy(),i=mi(e),a={},o=0;o<t.length;o++)a[t[o].id()]=o;for(var s=t.length,c=s*s,l=Array(c),u,d=0;d<c;d++)l[d]=0;for(var f=0;f<n.length;f++){var p=n[f],m=a[p.source().id()],h=a[p.target().id()],g=hi(p,i.attributes);l[m*s+h]+=g,l[h*s+m]+=g}gi(l,s,i.multFactor),_i(l,s);for(var _=!0,v=0;_&&v<i.maxIterations;)_=!1,u=yi(l,s,i.expandFactor),l=bi(u,s,i.inflateFactor),xi(l,u,c,4)||(_=!0),v++;var y=Si(l,s,t,r);return y=wi(y),y},Ei={markovClustering:Ti,mcl:Ti},Di=function(e){return e},Oi=function(e,t){return Math.abs(t-e)},ki=function(e,t,n){return e+Oi(t,n)},Ai=function(e,t,n){return e+(n-t)**2},ji=function(e){return Math.sqrt(e)},Mi=function(e,t,n){return Math.max(e,Oi(t,n))},Ni=function(e,t,n,r,i){for(var a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:Di,o=r,s,c,l=0;l<e;l++)s=t(l),c=n(l),o=i(o,s,c);return a(o)},Pi={euclidean:function(e,t,n){return e>=2?Ni(e,t,n,0,Ai,ji):Ni(e,t,n,0,ki)},squaredEuclidean:function(e,t,n){return Ni(e,t,n,0,Ai)},manhattan:function(e,t,n){return Ni(e,t,n,0,ki)},max:function(e,t,n){return Ni(e,t,n,-1/0,Mi)}};Pi[`squared-euclidean`]=Pi.squaredEuclidean,Pi.squaredeuclidean=Pi.squaredEuclidean;function Fi(e,t,n,r,i,a){var o=G(e)?e:Pi[e]||Pi.euclidean;return t===0&&G(e)?o(i,a):o(t,n,r,i,a)}var Ii=pn({k:2,m:2,sensitivityThreshold:1e-4,distance:`euclidean`,maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),Li=function(e){return Ii(e)},Ri=function(e,t,n,r,i){var a=i===`kMedoids`?function(e){return r[e](n)}:function(e){return n[e]},o=function(e){return r[e](t)},s=n,c=t;return Fi(e,r.length,a,o,s,c)},zi=function(e,t,n){for(var r=n.length,i=Array(r),a=Array(r),o=Array(t),s=null,c=0;c<r;c++)i[c]=e.min(n[c]).value,a[c]=e.max(n[c]).value;for(var l=0;l<t;l++){s=[];for(var u=0;u<r;u++)s[u]=Math.random()*(a[u]-i[u])+i[u];o[l]=s}return o},Bi=function(e,t,n,r,i){for(var a=1/0,o=0,s=0;s<t.length;s++){var c=Ri(n,e,t[s],r,i);c<a&&(a=c,o=s)}return o},Vi=function(e,t,n){for(var r=[],i=null,a=0;a<t.length;a++)i=t[a],n[i.id()]===e&&r.push(i);return r},Hi=function(e,t,n){return Math.abs(t-e)<=n},Ui=function(e,t,n){for(var r=0;r<e.length;r++)for(var i=0;i<e[r].length;i++)if(Math.abs(e[r][i]-t[r][i])>n)return!1;return!0},Wi=function(e,t,n){for(var r=0;r<n;r++)if(e===t[r])return!0;return!1},Gi=function(e,t){var n=Array(t);if(e.length<50)for(var r=0;r<t;r++){for(var i=e[Math.floor(Math.random()*e.length)];Wi(i,n,r);)i=e[Math.floor(Math.random()*e.length)];n[r]=i}else for(var a=0;a<t;a++)n[a]=e[Math.floor(Math.random()*e.length)];return n},Ki=function(e,t,n){for(var r=0,i=0;i<t.length;i++)r+=Ri(`manhattan`,t[i],e,n,`kMedoids`);return r},qi=function(e){var t=this.cy(),n=this.nodes(),r=null,i=Li(e),a=Array(i.k),o={},s;i.testMode?typeof i.testCentroids==`number`?(i.testCentroids,s=zi(n,i.k,i.attributes)):s=I(i.testCentroids)===`object`?i.testCentroids:zi(n,i.k,i.attributes):s=zi(n,i.k,i.attributes);for(var c=!0,l=0;c&&l<i.maxIterations;){for(var u=0;u<n.length;u++)r=n[u],o[r.id()]=Bi(r,s,i.distance,i.attributes,`kMeans`);c=!1;for(var d=0;d<i.k;d++){var f=Vi(d,n,o);if(f.length!==0){for(var p=i.attributes.length,m=s[d],h=Array(p),g=Array(p),_=0;_<p;_++){g[_]=0;for(var v=0;v<f.length;v++)r=f[v],g[_]+=i.attributes[_](r);h[_]=g[_]/f.length,Hi(h[_],m[_],i.sensitivityThreshold)||(c=!0)}s[d]=h,a[d]=t.collection(f)}}l++}return a},Ji=function(e){var t=this.cy(),n=this.nodes(),r=null,i=Li(e),a=Array(i.k),o,s={},c,l=Array(i.k);i.testMode?typeof i.testCentroids==`number`||(o=I(i.testCentroids)===`object`?i.testCentroids:Gi(n,i.k)):o=Gi(n,i.k);for(var u=!0,d=0;u&&d<i.maxIterations;){for(var f=0;f<n.length;f++)r=n[f],s[r.id()]=Bi(r,o,i.distance,i.attributes,`kMedoids`);u=!1;for(var p=0;p<o.length;p++){var m=Vi(p,n,s);if(m.length!==0){l[p]=Ki(o[p],m,i.attributes);for(var h=0;h<m.length;h++)c=Ki(m[h],m,i.attributes),c<l[p]&&(l[p]=c,o[p]=m[h],u=!0);a[p]=t.collection(m)}}d++}return a},Yi=function(e,t,n,r,i){for(var a,o,s=0;s<t.length;s++)for(var c=0;c<e.length;c++)r[s][c]=n[s][c]**+i.m;for(var l=0;l<e.length;l++)for(var u=0;u<i.attributes.length;u++){a=0,o=0;for(var d=0;d<t.length;d++)a+=r[d][l]*i.attributes[u](t[d]),o+=r[d][l];e[l][u]=a/o}},Xi=function(e,t,n,r,i){for(var a=0;a<e.length;a++)t[a]=e[a].slice();for(var o,s,c,l=2/(i.m-1),u=0;u<n.length;u++)for(var d=0;d<r.length;d++){o=0;for(var f=0;f<n.length;f++)s=Ri(i.distance,r[d],n[u],i.attributes,`cmeans`),c=Ri(i.distance,r[d],n[f],i.attributes,`cmeans`),o+=(s/c)**+l;e[d][u]=1/o}},Zi=function(e,t,n,r){for(var i=Array(n.k),a=0;a<i.length;a++)i[a]=[];for(var o,s,c=0;c<t.length;c++){o=-1/0,s=-1;for(var l=0;l<t[0].length;l++)t[c][l]>o&&(o=t[c][l],s=l);i[s].push(e[c])}for(var u=0;u<i.length;u++)i[u]=r.collection(i[u]);return i},Qi=function(e){for(var t=this.cy(),n=this.nodes(),r=Li(e),i,a,o,s=Array(n.length),c,l=0;l<n.length;l++)s[l]=Array(r.k);o=Array(n.length);for(var u=0;u<n.length;u++)o[u]=Array(r.k);for(var d=0;d<n.length;d++){for(var f=0,p=0;p<r.k;p++)o[d][p]=Math.random(),f+=o[d][p];for(var m=0;m<r.k;m++)o[d][m]=o[d][m]/f}a=Array(r.k);for(var h=0;h<r.k;h++)a[h]=Array(r.attributes.length);c=Array(n.length);for(var g=0;g<n.length;g++)c[g]=Array(r.k);for(var _=!0,v=0;_&&v<r.maxIterations;)_=!1,Yi(a,n,o,c,r),Xi(o,s,a,n,r),Ui(o,s,r.sensitivityThreshold)||(_=!0),v++;return i=Zi(n,o,r,t),{clusters:i,degreeOfMembership:o}},$i={kMeans:qi,kMedoids:Ji,fuzzyCMeans:Qi,fcm:Qi},ea=pn({distance:`euclidean`,linkage:`min`,mode:`threshold`,threshold:1/0,addDendrogram:!1,dendrogramDepth:0,attributes:[]}),ta={single:`min`,complete:`max`},na=function(e){var t=ea(e),n=ta[t.linkage];return n!=null&&(t.linkage=n),t},ra=function(e,t,n,r,i){for(var a=0,o=1/0,s,c=i.attributes,l=function(e,t){return Fi(i.distance,c.length,function(t){return c[t](e)},function(e){return c[e](t)},e,t)},u=0;u<e.length;u++){var d=e[u].key,f=n[d][r[d]];f<o&&(a=d,o=f)}if(i.mode===`threshold`&&o>=i.threshold||i.mode===`dendrogram`&&e.length===1)return!1;var p=t[a],m=t[r[a]],h=i.mode===`dendrogram`?{left:p,right:m,key:p.key}:{value:p.value.concat(m.value),key:p.key};e[p.index]=h,e.splice(m.index,1),t[p.key]=h;for(var g=0;g<e.length;g++){var _=e[g];p.key===_.key?s=1/0:i.linkage===`min`?(s=n[p.key][_.key],n[p.key][_.key]>n[m.key][_.key]&&(s=n[m.key][_.key])):i.linkage===`max`?(s=n[p.key][_.key],n[p.key][_.key]<n[m.key][_.key]&&(s=n[m.key][_.key])):s=i.linkage===`mean`?(n[p.key][_.key]*p.size+n[m.key][_.key]*m.size)/(p.size+m.size):i.mode===`dendrogram`?l(_.value,p.value):l(_.value[0],p.value[0]),n[p.key][_.key]=n[_.key][p.key]=s}for(var v=0;v<e.length;v++){var y=e[v].key;if(r[y]===p.key||r[y]===m.key){for(var b=y,x=0;x<e.length;x++){var S=e[x].key;n[y][S]<n[y][b]&&(b=S)}r[y]=b}e[v].index=v}return p.key=m.key=p.index=m.index=null,!0},ia=function(e,t,n){e&&(e.value?t.push(e.value):(e.left&&ia(e.left,t),e.right&&ia(e.right,t)))},aa=function(e,t){if(!e)return``;if(e.left&&e.right){var n=aa(e.left,t),r=aa(e.right,t),i=t.add({group:`nodes`,data:{id:n+`,`+r}});return t.add({group:`edges`,data:{source:n,target:i.id()}}),t.add({group:`edges`,data:{source:r,target:i.id()}}),i.id()}if(e.value)return e.value.id()},oa=function(e,t,n){if(!e)return[];var r=[],i=[],a=[];return t===0?(e.left&&ia(e.left,r),e.right&&ia(e.right,i),a=r.concat(i),[n.collection(a)]):t===1?e.value?[n.collection(e.value)]:(e.left&&ia(e.left,r),e.right&&ia(e.right,i),[n.collection(r),n.collection(i)]):e.value?[n.collection(e.value)]:(e.left&&(r=oa(e.left,t-1,n)),e.right&&(i=oa(e.right,t-1,n)),r.concat(i))},sa=function(e){for(var t=this.cy(),n=this.nodes(),r=na(e),i=r.attributes,a=function(e,t){return Fi(r.distance,i.length,function(t){return i[t](e)},function(e){return i[e](t)},e,t)},o=[],s=[],c=[],l=[],u=0;u<n.length;u++){var d={value:r.mode===`dendrogram`?n[u]:[n[u]],key:u,index:u};o[u]=d,l[u]=d,s[u]=[],c[u]=0}for(var f=0;f<o.length;f++)for(var p=0;p<=f;p++){var m=void 0;m=r.mode===`dendrogram`?f===p?1/0:a(o[f].value,o[p].value):f===p?1/0:a(o[f].value[0],o[p].value[0]),s[f][p]=m,s[p][f]=m,m<s[f][c[f]]&&(c[f]=p)}for(var h=ra(o,l,s,c,r);h;)h=ra(o,l,s,c,r);var g;return r.mode===`dendrogram`?(g=oa(o[0],r.dendrogramDepth,t),r.addDendrogram&&aa(o[0],t)):(g=Array(o.length),o.forEach(function(e,n){e.key=e.index=null,g[n]=t.collection(e.value)})),g},ca={hierarchicalClustering:sa,hca:sa},la=pn({distance:`euclidean`,preference:`median`,damping:.8,maxIterations:1e3,minIterations:100,attributes:[]}),ua=function(e){var t=e.damping,n=e.preference;.5<=t&&t<1||rn(`Damping must range on [0.5, 1). Got: ${t}`);var r=[`median`,`mean`,`min`,`max`];return r.some(function(e){return e===n})||Y(n)||rn(`Preference must be one of [${r.map(function(e){return`'${e}'`}).join(`, `)}] or a number. Got: ${n}`),la(e)},da=function(e,t,n,r){var i=function(e,t){return r[t](e)};return-Fi(e,r.length,function(e){return i(t,e)},function(e){return i(n,e)},t,n)},fa=function(e,t){var n=null;return n=t===`median`?er(e):t===`mean`?$n(e):t===`min`?Zn(e):t===`max`?Qn(e):t,n},pa=function(e,t,n){for(var r=[],i=0;i<e;i++)t[i*e+i]+n[i*e+i]>0&&r.push(i);return r},ma=function(e,t,n){for(var r=[],i=0;i<e;i++){for(var a=-1,o=-1/0,s=0;s<n.length;s++){var c=n[s];t[i*e+c]>o&&(a=c,o=t[i*e+c])}a>0&&r.push(a)}for(var l=0;l<n.length;l++)r[n[l]]=n[l];return r},ha=function(e,t,n){for(var r=ma(e,t,n),i=0;i<n.length;i++){for(var a=[],o=0;o<r.length;o++)r[o]===n[i]&&a.push(o);for(var s=-1,c=-1/0,l=0;l<a.length;l++){for(var u=0,d=0;d<a.length;d++)u+=t[a[d]*e+a[l]];u>c&&(s=l,c=u)}n[i]=a[s]}return r=ma(e,t,n),r},ga=function(e){for(var t=this.cy(),n=this.nodes(),r=ua(e),i={},a=0;a<n.length;a++)i[n[a].id()]=a;for(var o=n.length,s=o*o,c=Array(s),l,u,d,f=0;f<s;f++)c[f]=-1/0;for(var p=0;p<o;p++)for(var m=0;m<o;m++)p!==m&&(c[p*o+m]=da(r.distance,n[p],n[m],r.attributes));l=fa(c,r.preference);for(var h=0;h<o;h++)c[h*o+h]=l;u=Array(s);for(var g=0;g<s;g++)u[g]=0;d=Array(s);for(var _=0;_<s;_++)d[_]=0;for(var v=Array(o),y=Array(o),b=Array(o),x=0;x<o;x++)v[x]=0,y[x]=0,b[x]=0;for(var S=Array(o*r.minIterations),C=0;C<S.length;C++)S[C]=0;var w;for(w=0;w<r.maxIterations;w++){for(var T=0;T<o;T++){for(var E=-1/0,D=-1/0,O=-1,k=0,A=0;A<o;A++)v[A]=u[T*o+A],k=d[T*o+A]+c[T*o+A],k>=E?(D=E,E=k,O=A):k>D&&(D=k);for(var j=0;j<o;j++)u[T*o+j]=(1-r.damping)*(c[T*o+j]-E)+r.damping*v[j];u[T*o+O]=(1-r.damping)*(c[T*o+O]-D)+r.damping*v[O]}for(var M=0;M<o;M++){for(var N=0,P=0;P<o;P++)v[P]=d[P*o+M],y[P]=Math.max(0,u[P*o+M]),N+=y[P];N-=y[M],y[M]=u[M*o+M],N+=y[M];for(var F=0;F<o;F++)d[F*o+M]=(1-r.damping)*Math.min(0,N-y[F])+r.damping*v[F];d[M*o+M]=(1-r.damping)*(N-y[M])+r.damping*v[M]}for(var I=0,L=0;L<o;L++){var R=+(d[L*o+L]+u[L*o+L]>0);S[w%r.minIterations*o+L]=R,I+=R}if(I>0&&(w>=r.minIterations-1||w==r.maxIterations-1)){for(var ee=0,z=0;z<o;z++){b[z]=0;for(var B=0;B<r.minIterations;B++)b[z]+=S[B*o+z];(b[z]===0||b[z]===r.minIterations)&&ee++}if(ee===o)break}}for(var V=pa(o,u,d),H=ha(o,c,V),U={},W=0;W<V.length;W++)U[V[W]]=[];for(var G=0;G<n.length;G++){var K=H[i[n[G].id()]];K!=null&&U[K].push(n[G])}for(var q=Array(V.length),J=0;J<V.length;J++)q[J]=t.collection(U[V[J]]);return q},_a={affinityPropagation:ga,ap:ga},va=pn({root:void 0,directed:!1}),ya={hierholzer:function(e){if(!q(e)){var t=arguments;e={root:t[0],directed:t[1]}}var n=va(e),r=n.root,i=n.directed,a=this,o=!1,s,c,l;r&&(l=W(r)?this.filter(r)[0].id():r[0].id());var u={},d={};i?a.forEach(function(e){var t=e.id();if(e.isNode()){var n=e.indegree(!0),r=e.outdegree(!0),i=n-r,a=r-n;i==1?s?o=!0:s=t:a==1?c?o=!0:c=t:(a>1||i>1)&&(o=!0),u[t]=[],e.outgoers().forEach(function(e){e.isEdge()&&u[t].push(e.id())})}else d[t]=[void 0,e.target().id()]}):a.forEach(function(e){var t=e.id();e.isNode()?(e.degree(!0)%2&&(s?c?o=!0:c=t:s=t),u[t]=[],e.connectedEdges().forEach(function(e){return u[t].push(e.id())})):d[t]=[e.source().id(),e.target().id()]});var f={found:!1,trail:void 0};if(o)return f;if(c&&s){if(i){if(l&&c!=l)return f;l=c}else if(l&&c!=l&&s!=l)return f;else l||=c}else l||=a[0].id();var p=function(e){for(var t=e,n=[e],r,a,o;u[t].length;)r=u[t].shift(),a=d[r][0],o=d[r][1],t==o?!i&&t!=a&&(u[a]=u[a].filter(function(e){return e!=r}),t=a):(u[o]=u[o].filter(function(e){return e!=r}),t=o),n.unshift(r),n.unshift(t);return n},m=[],h=[];for(h=p(l);h.length!=1;)u[h[0]].length==0?(m.unshift(a.getElementById(h.shift())),m.unshift(a.getElementById(h.shift()))):h=p(h.shift()).concat(h);for(var g in m.unshift(a.getElementById(h.shift())),u)if(u[g].length)return f;return f.found=!0,f.trail=this.spawn(m,!0),f}},ba=function(){var e=this,t={},n=0,r=0,i=[],a=[],o={},s=function(n,r){for(var o=a.length-1,s=[],c=e.spawn();a[o].x!=n||a[o].y!=r;)s.push(a.pop().edge),o--;s.push(a.pop().edge),s.forEach(function(n){var r=n.connectedNodes().intersection(e);c.merge(n),r.forEach(function(n){var r=n.id(),i=n.connectedEdges().intersection(e);c.merge(n),t[r].cutVertex?c.merge(i.filter(function(e){return e.isLoop()})):c.merge(i)})}),i.push(c)},c=function(l,u,d){l===d&&(r+=1),t[u]={id:n,low:n++,cutVertex:!1};var f=e.getElementById(u).connectedEdges().intersection(e);if(f.size()===0)i.push(e.spawn(e.getElementById(u)));else{var p,m,h,g;f.forEach(function(e){p=e.source().id(),m=e.target().id(),h=p===u?m:p,h!==d&&(g=e.id(),o[g]||(o[g]=!0,a.push({x:u,y:h,edge:e})),h in t?t[u].low=Math.min(t[u].low,t[h].id):(c(l,h,u),t[u].low=Math.min(t[u].low,t[h].low),t[u].id<=t[h].low&&(t[u].cutVertex=!0,s(u,h))))})}};e.forEach(function(e){if(e.isNode()){var n=e.id();n in t||(r=0,c(n,n),t[n].cutVertex=r>1)}});var l=Object.keys(t).filter(function(e){return t[e].cutVertex}).map(function(t){return e.getElementById(t)});return{cut:e.spawn(l),components:i}},xa={hopcroftTarjanBiconnected:ba,htbc:ba,htb:ba,hopcroftTarjanBiconnectedComponents:ba},Sa=function(){var e=this,t={},n=0,r=[],i=[],a=e.spawn(e),o=function(s){if(i.push(s),t[s]={index:n,low:n++,explored:!1},e.getElementById(s).connectedEdges().intersection(e).forEach(function(e){var n=e.target().id();n!==s&&(n in t||o(n),t[n].explored||(t[s].low=Math.min(t[s].low,t[n].low)))}),t[s].index===t[s].low){for(var c=e.spawn();;){var l=i.pop();if(c.merge(e.getElementById(l)),t[l].low=t[s].index,t[l].explored=!0,l===s)break}var u=c.edgesWith(c),d=c.merge(u);r.push(d),a=a.difference(d)}};return e.forEach(function(e){if(e.isNode()){var n=e.id();n in t||o(n)}}),{cut:a,components:r}},Ca={tarjanStronglyConnected:Sa,tsc:Sa,tscc:Sa,tarjanStronglyConnectedComponents:Sa},wa={};[Tn,Fn,In,Rn,Bn,Hn,Kn,oi,ci,ui,fi,Ei,$i,ca,_a,ya,xa,Ca].forEach(function(e){X(wa,e)});var Ta=0,Ea=1,Da=2,Oa=function(e){if(!(this instanceof Oa))return new Oa(e);this.id=`Thenable/1.0.7`,this.state=Ta,this.fulfillValue=void 0,this.rejectReason=void 0,this.onFulfilled=[],this.onRejected=[],this.proxy={then:this.then.bind(this)},typeof e==`function`&&e.call(this,this.fulfill.bind(this),this.reject.bind(this))};Oa.prototype={fulfill:function(e){return ka(this,Ea,`fulfillValue`,e)},reject:function(e){return ka(this,Da,`rejectReason`,e)},then:function(e,t){var n=this,r=new Oa;return n.onFulfilled.push(Ma(e,r,`fulfill`)),n.onRejected.push(Ma(t,r,`reject`)),Aa(n),r.proxy}};var ka=function(e,t,n,r){return e.state===Ta&&(e.state=t,e[n]=r,Aa(e)),e},Aa=function(e){e.state===Ea?ja(e,`onFulfilled`,e.fulfillValue):e.state===Da&&ja(e,`onRejected`,e.rejectReason)},ja=function(e,t,n){if(e[t].length!==0){var r=e[t];e[t]=[];var i=function(){for(var e=0;e<r.length;e++)r[e](n)};typeof setImmediate==`function`?setImmediate(i):setTimeout(i,0)}},Ma=function(e,t,n){return function(r){if(typeof e!=`function`)t[n].call(t,r);else{var i;try{i=e(r)}catch(e){t.reject(e);return}Na(t,i)}}},Na=function(e,t){if(e===t||e.proxy===t){e.reject(TypeError(`cannot resolve promise with itself`));return}var n;if(I(t)===`object`&&t!==null||typeof t==`function`)try{n=t.then}catch(t){e.reject(t);return}if(typeof n==`function`){var r=!1;try{n.call(t,function(n){r||(r=!0,n===t?e.reject(TypeError(`circular thenable chain`)):Na(e,n))},function(t){r||(r=!0,e.reject(t))})}catch(t){r||e.reject(t)}return}e.fulfill(t)};Oa.all=function(e){return new Oa(function(t,n){for(var r=Array(e.length),i=0,a=function(n,a){r[n]=a,i++,i===e.length&&t(r)},o=0;o<e.length;o++)(function(t){var r=e[t];r!=null&&r.then!=null?r.then(function(e){a(t,e)},function(e){n(e)}):a(t,r)})(o)})},Oa.resolve=function(e){return new Oa(function(t,n){t(e)})},Oa.reject=function(e){return new Oa(function(t,n){n(e)})};var Pa=typeof Promise<`u`?Promise:Oa,Fa=function(e,t,n){var r=oe(e),i=!r,a=this._private=X({duration:1e3},t,n);if(a.target=e,a.style=a.style||a.css,a.started=!1,a.playing=!1,a.hooked=!1,a.applying=!1,a.progress=0,a.completes=[],a.frames=[],a.complete&&G(a.complete)&&a.completes.push(a.complete),i){var o=e.position();a.startPosition=a.startPosition||{x:o.x,y:o.y},a.startStyle=a.startStyle||e.cy().style().getAnimationStartStyle(e,a.style)}if(r){var s=e.pan();a.startPan={x:s.x,y:s.y},a.startZoom=e.zoom()}this.length=1,this[0]=this},Ia=Fa.prototype;X(Ia,{instanceString:function(){return`animation`},hook:function(){var e=this._private;if(!e.hooked){var t,n=e.target._private.animation;t=e.queue?n.queue:n.current,t.push(this),re(e.target)&&e.target.cy().addToAnimationPool(e.target),e.hooked=!0}return this},play:function(){var e=this._private;return e.progress===1&&(e.progress=0),e.playing=!0,e.started=!1,e.stopped=!1,this.hook(),this},playing:function(){return this._private.playing},apply:function(){var e=this._private;return e.applying=!0,e.started=!1,e.stopped=!1,this.hook(),this},applying:function(){return this._private.applying},pause:function(){var e=this._private;return e.playing=!1,e.started=!1,this},stop:function(){var e=this._private;return e.playing=!1,e.started=!1,e.stopped=!0,this},rewind:function(){return this.progress(0)},fastforward:function(){return this.progress(1)},time:function(e){var t=this._private;return e===void 0?t.progress*t.duration:this.progress(e/t.duration)},progress:function(e){var t=this._private,n=t.playing;return e===void 0?t.progress:(n&&this.pause(),t.progress=e,t.started=!1,n&&this.play(),this)},completed:function(){return this._private.progress===1},reverse:function(){var e=this._private,t=e.playing;t&&this.pause(),e.progress=1-e.progress,e.started=!1;var n=function(t,n){var r=e[t];r!=null&&(e[t]=e[n],e[n]=r)};if(n(`zoom`,`startZoom`),n(`pan`,`startPan`),n(`position`,`startPosition`),e.style)for(var r=0;r<e.style.length;r++){var i=e.style[r],a=i.name,o=e.startStyle[a];e.startStyle[a]=i,e.style[r]=o}return t&&this.play(),this},promise:function(e){var t=this._private,n;switch(e){case`frame`:n=t.frames;break;default:case`complete`:case`completed`:n=t.completes}return new Pa(function(e,t){n.push(function(){e()})})}}),Ia.complete=Ia.completed,Ia.run=Ia.play,Ia.running=Ia.playing;var La={animated:function(){return function(){var e=this,t=e.length===void 0?[e]:e;if(!(this._private.cy||this).styleEnabled())return!1;var n=t[0];if(n)return n._private.animation.current.length>0}},clearQueue:function(){return function(){var e=this,t=e.length===void 0?[e]:e;if(!(this._private.cy||this).styleEnabled())return this;for(var n=0;n<t.length;n++){var r=t[n];r._private.animation.queue=[]}return this}},delay:function(){return function(e,t){return(this._private.cy||this).styleEnabled()?this.animate({delay:e,duration:e,complete:t}):this}},delayAnimation:function(){return function(e,t){return(this._private.cy||this).styleEnabled()?this.animation({delay:e,duration:e,complete:t}):this}},animation:function(){return function(e,t){var n=this,r=n.length!==void 0,i=r?n:[n],a=this._private.cy||this,o=!r,s=!o;if(!a.styleEnabled())return this;var c=a.style();if(e=X({},e,t),Object.keys(e).length===0)return new Fa(i[0],e);switch(e.duration===void 0&&(e.duration=400),e.duration){case`slow`:e.duration=600;break;case`fast`:e.duration=200}if(s&&(e.style=c.getPropsList(e.style||e.css),e.css=void 0),s&&e.renderedPosition!=null){var l=e.renderedPosition,u=a.pan(),d=a.zoom();e.position=Yn(l,d,u)}if(o&&e.panBy!=null){var f=e.panBy,p=a.pan();e.pan={x:p.x+f.x,y:p.y+f.y}}var m=e.center||e.centre;if(o&&m!=null){var h=a.getCenterPan(m.eles,e.zoom);h!=null&&(e.pan=h)}if(o&&e.fit!=null){var g=e.fit,_=a.getFitViewport(g.eles||g.boundingBox,g.padding);_!=null&&(e.pan=_.pan,e.zoom=_.zoom)}if(o&&q(e.zoom)){var v=a.getZoomedViewport(e.zoom);v==null?e.zoom=null:(v.zoomed&&(e.zoom=v.zoom),v.panned&&(e.pan=v.pan))}return new Fa(i[0],e)}},animate:function(){return function(e,t){var n=this,r=n.length===void 0?[n]:n;if(!(this._private.cy||this).styleEnabled())return this;t&&(e=X({},e,t));for(var i=0;i<r.length;i++){var a=r[i],o=a.animated()&&(e.queue===void 0||e.queue);a.animation(e,o?{queue:!0}:void 0).play()}return this}},stop:function(){return function(e,t){var n=this,r=n.length===void 0?[n]:n,i=this._private.cy||this;if(!i.styleEnabled())return this;for(var a=0;a<r.length;a++){for(var o=r[a]._private,s=o.animation.current,c=0;c<s.length;c++){var l=s[c]._private;t&&(l.duration=0)}e&&(o.animation.queue=[]),t||(o.animation.current=[])}return i.notify(`draw`),this}}},Ra,za;function Ba(){return za?Ra:(za=1,Ra=Array.isArray,Ra)}var Va,Ha;function Ua(){if(Ha)return Va;Ha=1;var e=Ba(),t=bt(),n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;function i(i,a){if(e(i))return!1;var o=typeof i;return o==`number`||o==`symbol`||o==`boolean`||i==null||t(i)?!0:r.test(i)||!n.test(i)||a!=null&&i in Object(a)}return Va=i,Va}var Wa,Ga;function Ka(){if(Ga)return Wa;Ga=1;var e=mt(),t=Ve(),n=`[object AsyncFunction]`,r=`[object Function]`,i=`[object GeneratorFunction]`,a=`[object Proxy]`;function o(o){if(!t(o))return!1;var s=e(o);return s==r||s==i||s==n||s==a}return Wa=o,Wa}var qa,Ja;function Ya(){return Ja?qa:(Ja=1,qa=qe()[`__core-js_shared__`],qa)}var Xa,Za;function Qa(){if(Za)return Xa;Za=1;var e=Ya(),t=function(){var t=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||``);return t?`Symbol(src)_1.`+t:``}();function n(e){return!!t&&t in e}return Xa=n,Xa}var $a,eo;function to(){if(eo)return $a;eo=1;var e=Function.prototype.toString;function t(t){if(t!=null){try{return e.call(t)}catch{}try{return t+``}catch{}}return``}return $a=t,$a}var no,ro;function io(){if(ro)return no;ro=1;var e=Ka(),t=Qa(),n=Ve(),r=to(),i=/[\\^$.*+?()[\]{}|]/g,a=/^\[object .+?Constructor\]$/,o=Function.prototype,s=Object.prototype,c=o.toString,l=s.hasOwnProperty,u=RegExp(`^`+c.call(l).replace(i,`\\$&`).replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,`$1.*?`)+`$`);function d(i){return!n(i)||t(i)?!1:(e(i)?u:a).test(r(i))}return no=d,no}var ao,oo;function so(){if(oo)return ao;oo=1;function e(e,t){return e?.[t]}return ao=e,ao}var co,lo;function uo(){if(lo)return co;lo=1;var e=io(),t=so();function n(n,r){var i=t(n,r);return e(i)?i:void 0}return co=n,co}var fo,po;function mo(){return po?fo:(po=1,fo=uo()(Object,`create`),fo)}var ho,go;function _o(){if(go)return ho;go=1;var e=mo();function t(){this.__data__=e?e(null):{},this.size=0}return ho=t,ho}var vo,yo;function bo(){if(yo)return vo;yo=1;function e(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=+!!t,t}return vo=e,vo}var xo,So;function Co(){if(So)return xo;So=1;var e=mo(),t=`__lodash_hash_undefined__`,n=Object.prototype.hasOwnProperty;function r(r){var i=this.__data__;if(e){var a=i[r];return a===t?void 0:a}return n.call(i,r)?i[r]:void 0}return xo=r,xo}var wo,To;function Eo(){if(To)return wo;To=1;var e=mo(),t=Object.prototype.hasOwnProperty;function n(n){var r=this.__data__;return e?r[n]!==void 0:t.call(r,n)}return wo=n,wo}var Do,Oo;function ko(){if(Oo)return Do;Oo=1;var e=mo(),t=`__lodash_hash_undefined__`;function n(n,r){var i=this.__data__;return this.size+=+!this.has(n),i[n]=e&&r===void 0?t:r,this}return Do=n,Do}var Ao,jo;function Mo(){if(jo)return Ao;jo=1;var e=_o(),t=bo(),n=Co(),r=Eo(),i=ko();function a(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=n,a.prototype.has=r,a.prototype.set=i,Ao=a,Ao}var No,Po;function Fo(){if(Po)return No;Po=1;function e(){this.__data__=[],this.size=0}return No=e,No}var Io,Lo;function Ro(){if(Lo)return Io;Lo=1;function e(e,t){return e===t||e!==e&&t!==t}return Io=e,Io}var zo,Bo;function Vo(){if(Bo)return zo;Bo=1;var e=Ro();function t(t,n){for(var r=t.length;r--;)if(e(t[r][0],n))return r;return-1}return zo=t,zo}var Ho,Uo;function Wo(){if(Uo)return Ho;Uo=1;var e=Vo(),t=Array.prototype.splice;function n(n){var r=this.__data__,i=e(r,n);return i<0?!1:(i==r.length-1?r.pop():t.call(r,i,1),--this.size,!0)}return Ho=n,Ho}var Go,Ko;function qo(){if(Ko)return Go;Ko=1;var e=Vo();function t(t){var n=this.__data__,r=e(n,t);return r<0?void 0:n[r][1]}return Go=t,Go}var Jo,Yo;function Xo(){if(Yo)return Jo;Yo=1;var e=Vo();function t(t){return e(this.__data__,t)>-1}return Jo=t,Jo}var Zo,Qo;function $o(){if(Qo)return Zo;Qo=1;var e=Vo();function t(t,n){var r=this.__data__,i=e(r,t);return i<0?(++this.size,r.push([t,n])):r[i][1]=n,this}return Zo=t,Zo}var es,ts;function ns(){if(ts)return es;ts=1;var e=Fo(),t=Wo(),n=qo(),r=Xo(),i=$o();function a(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=n,a.prototype.has=r,a.prototype.set=i,es=a,es}var rs,is;function as(){return is?rs:(is=1,rs=uo()(qe(),`Map`),rs)}var os,ss;function cs(){if(ss)return os;ss=1;var e=Mo(),t=ns(),n=as();function r(){this.size=0,this.__data__={hash:new e,map:new(n||t),string:new e}}return os=r,os}var ls,us;function ds(){if(us)return ls;us=1;function e(e){var t=typeof e;return t==`string`||t==`number`||t==`symbol`||t==`boolean`?e!==`__proto__`:e===null}return ls=e,ls}var fs,ps;function ms(){if(ps)return fs;ps=1;var e=ds();function t(t,n){var r=t.__data__;return e(n)?r[typeof n==`string`?`string`:`hash`]:r.map}return fs=t,fs}var hs,gs;function _s(){if(gs)return hs;gs=1;var e=ms();function t(t){var n=e(this,t).delete(t);return this.size-=+!!n,n}return hs=t,hs}var vs,ys;function bs(){if(ys)return vs;ys=1;var e=ms();function t(t){return e(this,t).get(t)}return vs=t,vs}var xs,Ss;function Cs(){if(Ss)return xs;Ss=1;var e=ms();function t(t){return e(this,t).has(t)}return xs=t,xs}var ws,Ts;function Es(){if(Ts)return ws;Ts=1;var e=ms();function t(t,n){var r=e(this,t),i=r.size;return r.set(t,n),this.size+=r.size==i?0:1,this}return ws=t,ws}var Ds,Os;function ks(){if(Os)return Ds;Os=1;var e=cs(),t=_s(),n=bs(),r=Cs(),i=Es();function a(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=n,a.prototype.has=r,a.prototype.set=i,Ds=a,Ds}var As,js;function Ms(){if(js)return As;js=1;var e=ks(),t=`Expected a function`;function n(r,i){if(typeof r!=`function`||i!=null&&typeof i!=`function`)throw TypeError(t);var a=function(){var e=arguments,t=i?i.apply(this,e):e[0],n=a.cache;if(n.has(t))return n.get(t);var o=r.apply(this,e);return a.cache=n.set(t,o)||n,o};return a.cache=new(n.Cache||e),a}return n.Cache=e,As=n,As}var Ns,Ps;function Fs(){if(Ps)return Ns;Ps=1;var e=Ms(),t=500;function n(n){var r=e(n,function(e){return i.size===t&&i.clear(),e}),i=r.cache;return r}return Ns=n,Ns}var Is,Ls;function Rs(){if(Ls)return Is;Ls=1;var e=Fs(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,n=/\\(\\)?/g;return Is=e(function(e){var r=[];return e.charCodeAt(0)===46&&r.push(``),e.replace(t,function(e,t,i,a){r.push(i?a.replace(n,`$1`):t||e)}),r}),Is}var zs,Bs;function Vs(){if(Bs)return zs;Bs=1;function e(e,t){for(var n=-1,r=e==null?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}return zs=e,zs}var Hs,Us;function Ws(){if(Us)return Hs;Us=1;var e=at(),t=Vs(),n=Ba(),r=bt(),i=e?e.prototype:void 0,a=i?i.toString:void 0;function o(e){if(typeof e==`string`)return e;if(n(e))return t(e,o)+``;if(r(e))return a?a.call(e):``;var i=e+``;return i==`0`&&1/e==-1/0?`-0`:i}return Hs=o,Hs}var Gs,Ks;function qs(){if(Ks)return Gs;Ks=1;var e=Ws();function t(t){return t==null?``:e(t)}return Gs=t,Gs}var Js,Ys;function Xs(){if(Ys)return Js;Ys=1;var e=Ba(),t=Ua(),n=Rs(),r=qs();function i(i,a){return e(i)?i:t(i,a)?[i]:n(r(i))}return Js=i,Js}var Zs,Qs;function $s(){if(Qs)return Zs;Qs=1;var e=bt();function t(t){if(typeof t==`string`||e(t))return t;var n=t+``;return n==`0`&&1/t==-1/0?`-0`:n}return Zs=t,Zs}var ec,tc;function nc(){if(tc)return ec;tc=1;var e=Xs(),t=$s();function n(n,r){r=e(r,n);for(var i=0,a=r.length;n!=null&&i<a;)n=n[t(r[i++])];return i&&i==a?n:void 0}return ec=n,ec}var rc,ic;function ac(){if(ic)return rc;ic=1;var e=nc();function t(t,n,r){var i=t==null?void 0:e(t,n);return i===void 0?r:i}return rc=t,rc}var oc=Re(ac()),sc,cc;function lc(){if(cc)return sc;cc=1;var e=uo();return sc=function(){try{var t=e(Object,`defineProperty`);return t({},``,{}),t}catch{}}(),sc}var uc,dc;function fc(){if(dc)return uc;dc=1;var e=lc();function t(t,n,r){n==`__proto__`&&e?e(t,n,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[n]=r}return uc=t,uc}var pc,mc;function hc(){if(mc)return pc;mc=1;var e=fc(),t=Ro(),n=Object.prototype.hasOwnProperty;function r(r,i,a){var o=r[i];(!(n.call(r,i)&&t(o,a))||a===void 0&&!(i in r))&&e(r,i,a)}return pc=r,pc}var gc,_c;function vc(){if(_c)return gc;_c=1;var e=9007199254740991,t=/^(?:0|[1-9]\d*)$/;function n(n,r){var i=typeof n;return r??=e,!!r&&(i==`number`||i!=`symbol`&&t.test(n))&&n>-1&&n%1==0&&n<r}return gc=n,gc}var yc,bc;function xc(){if(bc)return yc;bc=1;var e=hc(),t=Xs(),n=vc(),r=Ve(),i=$s();function a(a,o,s,c){if(!r(a))return a;o=t(o,a);for(var l=-1,u=o.length,d=u-1,f=a;f!=null&&++l<u;){var p=i(o[l]),m=s;if(p===`__proto__`||p===`constructor`||p===`prototype`)return a;if(l!=d){var h=f[p];m=c?c(h,p,f):void 0,m===void 0&&(m=r(h)?h:n(o[l+1])?[]:{})}e(f,p,m),f=f[p]}return a}return yc=a,yc}var Sc,Cc;function wc(){if(Cc)return Sc;Cc=1;var e=xc();function t(t,n,r){return t==null?t:e(t,n,r)}return Sc=t,Sc}var Tc=Re(wc()),Ec,Dc;function Oc(){if(Dc)return Ec;Dc=1;function e(e,t){var n=-1,r=e.length;for(t||=Array(r);++n<r;)t[n]=e[n];return t}return Ec=e,Ec}var kc,Ac;function jc(){if(Ac)return kc;Ac=1;var e=Vs(),t=Oc(),n=Ba(),r=bt(),i=Rs(),a=$s(),o=qs();function s(s){return n(s)?e(s,a):r(s)?[s]:t(i(o(s)))}return kc=s,kc}var Mc=Re(jc()),Nc={data:function(e){return e=X({},{field:`data`,bindingEvent:`data`,allowBinding:!1,allowSetting:!1,allowGetting:!1,settingEvent:`data`,settingTriggersEvent:!1,triggerFnName:`trigger`,immutableKeys:{},updateStyle:!1,beforeGet:function(e){},beforeSet:function(e,t){},onSet:function(e){},canSet:function(e){return!0}},e),function(t,n){var r=e,i=this,a=i.length!==void 0,o=a?i:[i],s=a?i[0]:i;if(W(t)){var c=t.indexOf(`.`)!==-1&&Mc(t);if(r.allowGetting&&n===void 0){var l;return s&&(r.beforeGet(s),l=c&&s._private[r.field][t]===void 0?oc(s._private[r.field],c):s._private[r.field][t]),l}if(r.allowSetting&&n!==void 0&&!r.immutableKeys[t]){var u=D({},t,n);r.beforeSet(i,u);for(var d=0,f=o.length;d<f;d++){var p=o[d];r.canSet(p)&&(c&&s._private[r.field][t]===void 0?Tc(p._private[r.field],c,n):p._private[r.field][t]=n)}r.updateStyle&&i.updateStyle(),r.onSet(i),r.settingTriggersEvent&&i[r.triggerFnName](r.settingEvent)}}else if(r.allowSetting&&q(t)){var m=t,h,g,_=Object.keys(m);r.beforeSet(i,m);for(var v=0;v<_.length;v++)if(h=_[v],g=m[h],!r.immutableKeys[h])for(var y=0;y<o.length;y++){var b=o[y];r.canSet(b)&&(b._private[r.field][h]=g)}r.updateStyle&&i.updateStyle(),r.onSet(i),r.settingTriggersEvent&&i[r.triggerFnName](r.settingEvent)}else if(r.allowBinding&&G(t)){var x=t;i.on(r.bindingEvent,x)}else if(r.allowGetting&&t===void 0){var S;return s&&(r.beforeGet(s),S=s._private[r.field]),S}return i}},removeData:function(e){return e=X({},{field:`data`,event:`data`,triggerFnName:`trigger`,triggerEvent:!1,immutableKeys:{}},e),function(t){var n=e,r=this,i=r.length===void 0?[r]:r;if(W(t)){for(var a=t.split(/\s+/),o=a.length,s=0;s<o;s++){var c=a[s];if(!le(c)&&!n.immutableKeys[c])for(var l=0,u=i.length;l<u;l++)i[l]._private[n.field][c]=void 0}n.triggerEvent&&r[n.triggerFnName](n.event)}else if(t===void 0){for(var d=0,f=i.length;d<f;d++)for(var p=i[d]._private[n.field],m=Object.keys(p),h=0;h<m.length;h++){var g=m[h];n.immutableKeys[g]||(p[g]=void 0)}n.triggerEvent&&r[n.triggerFnName](n.event)}return r}}},Pc={eventAliasesOn:function(e){var t=e;t.addListener=t.listen=t.bind=t.on,t.unlisten=t.unbind=t.off=t.removeListener,t.trigger=t.emit,t.pon=t.promiseOn=function(e,t){var n=this,r=Array.prototype.slice.call(arguments,0);return new Pa(function(e,t){var i=r.concat([function(t){n.off.apply(n,a),e(t)}]),a=i.concat([]);n.on.apply(n,i)})}}},Fc={};[La,Nc,Pc].forEach(function(e){X(Fc,e)});var Ic={animate:Fc.animate(),animation:Fc.animation(),animated:Fc.animated(),clearQueue:Fc.clearQueue(),delay:Fc.delay(),delayAnimation:Fc.delayAnimation(),stop:Fc.stop()},Lc={classes:function(e){var t=this;if(e===void 0){var n=[];return t[0]._private.classes.forEach(function(e){return n.push(e)}),n}K(e)||(e=(e||``).match(/\S+/g)||[]);for(var r=[],i=new Sn(e),a=0;a<t.length;a++){for(var o=t[a],s=o._private,c=s.classes,l=!1,u=0;u<e.length;u++){var d=e[u];if(!c.has(d)){l=!0;break}}l||=c.size!==e.length,l&&(s.classes=i,r.push(o))}return r.length>0&&this.spawn(r).updateStyle().emit(`class`),t},addClass:function(e){return this.toggleClass(e,!0)},hasClass:function(e){var t=this[0];return t!=null&&t._private.classes.has(e)},toggleClass:function(e,t){K(e)||(e=e.match(/\S+/g)||[]);for(var n=this,r=t===void 0,i=[],a=0,o=n.length;a<o;a++)for(var s=n[a],c=s._private.classes,l=!1,u=0;u<e.length;u++){var d=e[u],f=c.has(d),p=!1;t||r&&!f?(c.add(d),p=!0):(!t||r&&f)&&(c.delete(d),p=!0),!l&&p&&(i.push(s),l=!0)}return i.length>0&&this.spawn(i).updateStyle().emit(`class`),n},removeClass:function(e){return this.toggleClass(e,!1)},flashClass:function(e,t){var n=this;if(t==null)t=250;else if(t===0)return n;return n.addClass(e),setTimeout(function(){n.removeClass(e)},t),n}};Lc.className=Lc.classNames=Lc.classes;var Rc={metaChar:`[\\!\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\\`\\{\\|\\}\\~]`,comparatorOp:`=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=`,boolOp:`\\?|\\!|\\^`,string:`"(?:\\\\"|[^"])*"|'(?:\\\\'|[^'])*'`,number:be,meta:`degree|indegree|outdegree`,separator:`\\s*,\\s*`,descendant:`\\s+`,child:`\\s+>\\s+`,subject:`\\$`,group:`node|edge|\\*`,directedEdge:`\\s+->\\s+`,undirectedEdge:`\\s+<->\\s+`};Rc.variable=`(?:[\\w-.]|(?:\\\\`+Rc.metaChar+`))+`,Rc.className=`(?:[\\w-]|(?:\\\\`+Rc.metaChar+`))+`,Rc.value=Rc.string+`|`+Rc.number,Rc.id=Rc.variable,(function(){var e=Rc.comparatorOp.split(`|`),t,n;for(n=0;n<e.length;n++)t=e[n],Rc.comparatorOp+=`|@`+t;for(e=Rc.comparatorOp.split(`|`),n=0;n<e.length;n++)t=e[n],!(t.indexOf(`!`)>=0)&&t!==`=`&&(Rc.comparatorOp+=`|\\!`+t)})();var zc=function(){return{checks:[]}},Z={GROUP:0,COLLECTION:1,FILTER:2,DATA_COMPARE:3,DATA_EXIST:4,DATA_BOOL:5,META_COMPARE:6,STATE:7,ID:8,CLASS:9,UNDIRECTED_EDGE:10,DIRECTED_EDGE:11,NODE_SOURCE:12,NODE_TARGET:13,NODE_NEIGHBOR:14,CHILD:15,DESCENDANT:16,PARENT:17,ANCESTOR:18,COMPOUND_SPLIT:19,TRUE:20},Bc=[{selector:`:selected`,matches:function(e){return e.selected()}},{selector:`:unselected`,matches:function(e){return!e.selected()}},{selector:`:selectable`,matches:function(e){return e.selectable()}},{selector:`:unselectable`,matches:function(e){return!e.selectable()}},{selector:`:locked`,matches:function(e){return e.locked()}},{selector:`:unlocked`,matches:function(e){return!e.locked()}},{selector:`:visible`,matches:function(e){return e.visible()}},{selector:`:hidden`,matches:function(e){return!e.visible()}},{selector:`:transparent`,matches:function(e){return e.transparent()}},{selector:`:grabbed`,matches:function(e){return e.grabbed()}},{selector:`:free`,matches:function(e){return!e.grabbed()}},{selector:`:removed`,matches:function(e){return e.removed()}},{selector:`:inside`,matches:function(e){return!e.removed()}},{selector:`:grabbable`,matches:function(e){return e.grabbable()}},{selector:`:ungrabbable`,matches:function(e){return!e.grabbable()}},{selector:`:animated`,matches:function(e){return e.animated()}},{selector:`:unanimated`,matches:function(e){return!e.animated()}},{selector:`:parent`,matches:function(e){return e.isParent()}},{selector:`:childless`,matches:function(e){return e.isChildless()}},{selector:`:child`,matches:function(e){return e.isChild()}},{selector:`:orphan`,matches:function(e){return e.isOrphan()}},{selector:`:nonorphan`,matches:function(e){return e.isChild()}},{selector:`:compound`,matches:function(e){return e.isNode()?e.isParent():e.source().isParent()||e.target().isParent()}},{selector:`:loop`,matches:function(e){return e.isLoop()}},{selector:`:simple`,matches:function(e){return e.isSimple()}},{selector:`:active`,matches:function(e){return e.active()}},{selector:`:inactive`,matches:function(e){return!e.active()}},{selector:`:backgrounding`,matches:function(e){return e.backgrounding()}},{selector:`:nonbackgrounding`,matches:function(e){return!e.backgrounding()}}].sort(function(e,t){return Oe(e.selector,t.selector)}),Vc=function(){for(var e={},t,n=0;n<Bc.length;n++)t=Bc[n],e[t.selector]=t.matches;return e}(),Hc=function(e,t){return Vc[e](t)},Uc=`(`+Bc.map(function(e){return e.selector}).join(`|`)+`)`,Wc=function(e){return e.replace(RegExp(`\\\\(`+Rc.metaChar+`)`,`g`),function(e,t){return t})},Gc=function(e,t,n){e[e.length-1]=n},Kc=[{name:`group`,query:!0,regex:`(`+Rc.group+`)`,populate:function(e,t,n){var r=M(n,1)[0];t.checks.push({type:Z.GROUP,value:r===`*`?r:r+`s`})}},{name:`state`,query:!0,regex:Uc,populate:function(e,t,n){var r=M(n,1)[0];t.checks.push({type:Z.STATE,value:r})}},{name:`id`,query:!0,regex:`\\#(`+Rc.id+`)`,populate:function(e,t,n){var r=M(n,1)[0];t.checks.push({type:Z.ID,value:Wc(r)})}},{name:`className`,query:!0,regex:`\\.(`+Rc.className+`)`,populate:function(e,t,n){var r=M(n,1)[0];t.checks.push({type:Z.CLASS,value:Wc(r)})}},{name:`dataExists`,query:!0,regex:`\\[\\s*(`+Rc.variable+`)\\s*\\]`,populate:function(e,t,n){var r=M(n,1)[0];t.checks.push({type:Z.DATA_EXIST,field:Wc(r)})}},{name:`dataCompare`,query:!0,regex:`\\[\\s*(`+Rc.variable+`)\\s*(`+Rc.comparatorOp+`)\\s*(`+Rc.value+`)\\s*\\]`,populate:function(e,t,n){var r=M(n,3),i=r[0],a=r[1],o=r[2];o=RegExp(`^`+Rc.string+`$`).exec(o)==null?parseFloat(o):o.substring(1,o.length-1),t.checks.push({type:Z.DATA_COMPARE,field:Wc(i),operator:a,value:o})}},{name:`dataBool`,query:!0,regex:`\\[\\s*(`+Rc.boolOp+`)\\s*(`+Rc.variable+`)\\s*\\]`,populate:function(e,t,n){var r=M(n,2),i=r[0],a=r[1];t.checks.push({type:Z.DATA_BOOL,field:Wc(a),operator:i})}},{name:`metaCompare`,query:!0,regex:`\\[\\[\\s*(`+Rc.meta+`)\\s*(`+Rc.comparatorOp+`)\\s*(`+Rc.number+`)\\s*\\]\\]`,populate:function(e,t,n){var r=M(n,3),i=r[0],a=r[1],o=r[2];t.checks.push({type:Z.META_COMPARE,field:Wc(i),operator:a,value:parseFloat(o)})}},{name:`nextQuery`,separator:!0,regex:Rc.separator,populate:function(e,t){var n=e.currentSubject,r=e.edgeCount,i=e.compoundCount,a=e[e.length-1];return n!=null&&(a.subject=n,e.currentSubject=null),a.edgeCount=r,a.compoundCount=i,e.edgeCount=0,e.compoundCount=0,e[e.length++]=zc()}},{name:`directedEdge`,separator:!0,regex:Rc.directedEdge,populate:function(e,t){if(e.currentSubject==null){var n=zc(),r=t,i=zc();return n.checks.push({type:Z.DIRECTED_EDGE,source:r,target:i}),Gc(e,t,n),e.edgeCount++,i}var a=zc(),o=t,s=zc();return a.checks.push({type:Z.NODE_SOURCE,source:o,target:s}),Gc(e,t,a),e.edgeCount++,s}},{name:`undirectedEdge`,separator:!0,regex:Rc.undirectedEdge,populate:function(e,t){if(e.currentSubject==null){var n=zc(),r=t,i=zc();return n.checks.push({type:Z.UNDIRECTED_EDGE,nodes:[r,i]}),Gc(e,t,n),e.edgeCount++,i}var a=zc(),o=t,s=zc();return a.checks.push({type:Z.NODE_NEIGHBOR,node:o,neighbor:s}),Gc(e,t,a),s}},{name:`child`,separator:!0,regex:Rc.child,populate:function(e,t){if(e.currentSubject==null){var n=zc(),r=zc(),i=e[e.length-1];return n.checks.push({type:Z.CHILD,parent:i,child:r}),Gc(e,t,n),e.compoundCount++,r}if(e.currentSubject===t){var a=zc(),o=e[e.length-1],s=zc(),c=zc(),l=zc(),u=zc();return a.checks.push({type:Z.COMPOUND_SPLIT,left:o,right:s,subject:c}),c.checks=t.checks,t.checks=[{type:Z.TRUE}],u.checks.push({type:Z.TRUE}),s.checks.push({type:Z.PARENT,parent:u,child:l}),Gc(e,o,a),e.currentSubject=c,e.compoundCount++,l}var d=zc(),f=zc(),p=[{type:Z.PARENT,parent:d,child:f}];return d.checks=t.checks,t.checks=p,e.compoundCount++,f}},{name:`descendant`,separator:!0,regex:Rc.descendant,populate:function(e,t){if(e.currentSubject==null){var n=zc(),r=zc(),i=e[e.length-1];return n.checks.push({type:Z.DESCENDANT,ancestor:i,descendant:r}),Gc(e,t,n),e.compoundCount++,r}if(e.currentSubject===t){var a=zc(),o=e[e.length-1],s=zc(),c=zc(),l=zc(),u=zc();return a.checks.push({type:Z.COMPOUND_SPLIT,left:o,right:s,subject:c}),c.checks=t.checks,t.checks=[{type:Z.TRUE}],u.checks.push({type:Z.TRUE}),s.checks.push({type:Z.ANCESTOR,ancestor:u,descendant:l}),Gc(e,o,a),e.currentSubject=c,e.compoundCount++,l}var d=zc(),f=zc(),p=[{type:Z.ANCESTOR,ancestor:d,descendant:f}];return d.checks=t.checks,t.checks=p,e.compoundCount++,f}},{name:`subject`,modifier:!0,regex:Rc.subject,populate:function(e,t){if(e.currentSubject!=null&&e.currentSubject!==t)return on("Redefinition of subject in selector `"+e.toString()+"`"),!1;e.currentSubject=t;var n=e[e.length-1].checks[0],r=n==null?null:n.type;r===Z.DIRECTED_EDGE?n.type=Z.NODE_TARGET:r===Z.UNDIRECTED_EDGE&&(n.type=Z.NODE_NEIGHBOR,n.node=n.nodes[1],n.neighbor=n.nodes[0],n.nodes=null)}}];Kc.forEach(function(e){return e.regexObj=RegExp(`^`+e.regex)});var qc=function(e){for(var t,n,r,i=0;i<Kc.length;i++){var a=Kc[i],o=a.name,s=e.match(a.regexObj);if(s!=null){n=s,t=a,r=o;var c=s[0];e=e.substring(c.length);break}}return{expr:t,match:n,name:r,remaining:e}},Jc=function(e){var t=e.match(/^\s+/);if(t){var n=t[0];e=e.substring(n.length)}return e},Yc={parse:function(e){var t=this,n=t.inputText=e,r=t[0]=zc();for(t.length=1,n=Jc(n);;){var i=qc(n);if(i.expr==null)return on("The selector `"+e+"`is invalid"),!1;var a=i.match.slice(1),o=i.expr.populate(t,r,a);if(o===!1)return!1;if(o!=null&&(r=o),n=i.remaining,n.match(/^\s*$/))break}var s=t[t.length-1];t.currentSubject!=null&&(s.subject=t.currentSubject),s.edgeCount=t.edgeCount,s.compoundCount=t.compoundCount;for(var c=0;c<t.length;c++){var l=t[c];if(l.compoundCount>0&&l.edgeCount>0)return on("The selector `"+e+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(l.edgeCount>1)return on("The selector `"+e+"` is invalid because it uses multiple edge selectors"),!1;l.edgeCount===1&&on("The selector `"+e+"` is deprecated. Edge selectors do not take effect on changes to source and target nodes after an edge is added, for performance reasons. Use a class or data selector on edges instead, updating the class or data of an edge when your app detects a change in source or target nodes.")}return!0},toString:function(){if(this.toStringCache!=null)return this.toStringCache;for(var e=function(e){return e??``},t=function(t){return W(t)?`"`+t+`"`:e(t)},n=function(e){return` `+e+` `},r=function(r,a){var o=r.type,s=r.value;switch(o){case Z.GROUP:var c=e(s);return c.substring(0,c.length-1);case Z.DATA_COMPARE:var l=r.field,u=r.operator;return`[`+l+n(e(u))+t(s)+`]`;case Z.DATA_BOOL:var d=r.operator,f=r.field;return`[`+e(d)+f+`]`;case Z.DATA_EXIST:return`[`+r.field+`]`;case Z.META_COMPARE:var p=r.operator;return`[[`+r.field+n(e(p))+t(s)+`]]`;case Z.STATE:return s;case Z.ID:return`#`+s;case Z.CLASS:return`.`+s;case Z.PARENT:case Z.CHILD:return i(r.parent,a)+n(`>`)+i(r.child,a);case Z.ANCESTOR:case Z.DESCENDANT:return i(r.ancestor,a)+` `+i(r.descendant,a);case Z.COMPOUND_SPLIT:var m=i(r.left,a),h=i(r.subject,a),g=i(r.right,a);return m+(m.length>0?` `:``)+h+g;case Z.TRUE:return``}},i=function(e,t){return e.checks.reduce(function(n,i,a){return n+(t===e&&a===0?`$`:``)+r(i,t)},``)},a=``,o=0;o<this.length;o++){var s=this[o];a+=i(s,s.subject),this.length>1&&o<this.length-1&&(a+=`, `)}return this.toStringCache=a,a}},Xc=function(e,t,n){var r,i=W(e),a=Y(e),o=W(n),s,c,l=!1,u=!1,d=!1;switch(t.indexOf(`!`)>=0&&(t=t.replace(`!`,``),u=!0),t.indexOf(`@`)>=0&&(t=t.replace(`@`,``),l=!0),(i||o||l)&&(s=!i&&!a?``:``+e,c=``+n),l&&(e=s=s.toLowerCase(),n=c=c.toLowerCase()),t){case`*=`:r=s.indexOf(c)>=0;break;case`$=`:r=s.indexOf(c,s.length-c.length)>=0;break;case`^=`:r=s.indexOf(c)===0;break;case`=`:r=e===n;break;case`>`:d=!0,r=e>n;break;case`>=`:d=!0,r=e>=n;break;case`<`:d=!0,r=e<n;break;case`<=`:d=!0,r=e<=n;break;default:r=!1}return u&&(e!=null||!d)&&(r=!r),r},Zc=function(e,t){switch(t){case`?`:return!!e;case`!`:return!e;case`^`:return e===void 0}},Qc=function(e){return e!==void 0},$c=function(e,t){return e.data(t)},el=function(e,t){return e[t]()},tl=[],nl=function(e,t){return e.checks.every(function(e){return tl[e.type](e,t)})};tl[Z.GROUP]=function(e,t){var n=e.value;return n===`*`||n===t.group()},tl[Z.STATE]=function(e,t){var n=e.value;return Hc(n,t)},tl[Z.ID]=function(e,t){var n=e.value;return t.id()===n},tl[Z.CLASS]=function(e,t){var n=e.value;return t.hasClass(n)},tl[Z.META_COMPARE]=function(e,t){var n=e.field,r=e.operator,i=e.value;return Xc(el(t,n),r,i)},tl[Z.DATA_COMPARE]=function(e,t){var n=e.field,r=e.operator,i=e.value;return Xc($c(t,n),r,i)},tl[Z.DATA_BOOL]=function(e,t){var n=e.field,r=e.operator;return Zc($c(t,n),r)},tl[Z.DATA_EXIST]=function(e,t){var n=e.field;return e.operator,Qc($c(t,n))},tl[Z.UNDIRECTED_EDGE]=function(e,t){var n=e.nodes[0],r=e.nodes[1],i=t.source(),a=t.target();return nl(n,i)&&nl(r,a)||nl(r,i)&&nl(n,a)},tl[Z.NODE_NEIGHBOR]=function(e,t){return nl(e.node,t)&&t.neighborhood().some(function(t){return t.isNode()&&nl(e.neighbor,t)})},tl[Z.DIRECTED_EDGE]=function(e,t){return nl(e.source,t.source())&&nl(e.target,t.target())},tl[Z.NODE_SOURCE]=function(e,t){return nl(e.source,t)&&t.outgoers().some(function(t){return t.isNode()&&nl(e.target,t)})},tl[Z.NODE_TARGET]=function(e,t){return nl(e.target,t)&&t.incomers().some(function(t){return t.isNode()&&nl(e.source,t)})},tl[Z.CHILD]=function(e,t){return nl(e.child,t)&&nl(e.parent,t.parent())},tl[Z.PARENT]=function(e,t){return nl(e.parent,t)&&t.children().some(function(t){return nl(e.child,t)})},tl[Z.DESCENDANT]=function(e,t){return nl(e.descendant,t)&&t.ancestors().some(function(t){return nl(e.ancestor,t)})},tl[Z.ANCESTOR]=function(e,t){return nl(e.ancestor,t)&&t.descendants().some(function(t){return nl(e.descendant,t)})},tl[Z.COMPOUND_SPLIT]=function(e,t){return nl(e.subject,t)&&nl(e.left,t)&&nl(e.right,t)},tl[Z.TRUE]=function(){return!0},tl[Z.COLLECTION]=function(e,t){return e.value.has(t)},tl[Z.FILTER]=function(e,t){var n=e.value;return n(t)};var rl={matches:function(e){for(var t=this,n=0;n<t.length;n++){var r=t[n];if(nl(r,e))return!0}return!1},filter:function(e){var t=this;if(t.length===1&&t[0].checks.length===1&&t[0].checks[0].type===Z.ID)return e.getElementById(t[0].checks[0].value).collection();var n=function(e){for(var n=0;n<t.length;n++){var r=t[n];if(nl(r,e))return!0}return!1};return t.text()??(n=function(){return!0}),e.filter(n)}},il=function(e){this.inputText=e,this.currentSubject=null,this.compoundCount=0,this.edgeCount=0,this.length=0,e==null||W(e)&&e.match(/^\s*$/)||(re(e)?this.addQuery({checks:[{type:Z.COLLECTION,value:e.collection()}]}):G(e)?this.addQuery({checks:[{type:Z.FILTER,value:e}]}):W(e)?this.parse(e)||(this.invalid=!0):rn(`A selector must be created from a string; found `))},al=il.prototype;[Yc,rl].forEach(function(e){return X(al,e)}),al.text=function(){return this.inputText},al.size=function(){return this.length},al.eq=function(e){return this[e]},al.sameText=function(e){return!this.invalid&&!e.invalid&&this.text()===e.text()},al.addQuery=function(e){this[this.length++]=e},al.selector=al.toString;var ol={allAre:function(e){var t=new il(e);return this.every(function(e){return t.matches(e)})},is:function(e){var t=new il(e);return this.some(function(e){return t.matches(e)})},some:function(e,t){for(var n=0;n<this.length;n++)if(t?e.apply(t,[this[n],n,this]):e(this[n],n,this))return!0;return!1},every:function(e,t){for(var n=0;n<this.length;n++)if(!(t?e.apply(t,[this[n],n,this]):e(this[n],n,this)))return!1;return!0},same:function(e){if(this===e)return!0;e=this.cy().collection(e);var t=this.length;return t===e.length?t===1?this[0]===e[0]:this.every(function(t){return e.hasElementWithId(t.id())}):!1},anySame:function(e){return e=this.cy().collection(e),this.some(function(t){return e.hasElementWithId(t.id())})},allAreNeighbors:function(e){e=this.cy().collection(e);var t=this.neighborhood();return e.every(function(e){return t.hasElementWithId(e.id())})},contains:function(e){e=this.cy().collection(e);var t=this;return e.every(function(e){return t.hasElementWithId(e.id())})}};ol.allAreNeighbours=ol.allAreNeighbors,ol.has=ol.contains,ol.equal=ol.equals=ol.same;var sl=function(e,t){return function(n,r,i,a){var o=n,s=this,c;if(o==null?c=``:re(o)&&o.length===1&&(c=o.id()),s.length===1&&c){var l=s[0]._private,u=l.traversalCache=l.traversalCache||{},d=u[t]=u[t]||[],f=Ut(c);return d[f]||(d[f]=e.call(s,n,r,i,a))}return e.call(s,n,r,i,a)}},cl={parent:function(e){var t=[];if(this.length===1){var n=this[0]._private.parent;if(n)return n}for(var r=0;r<this.length;r++){var i=this[r]._private.parent;i&&t.push(i)}return this.spawn(t,!0).filter(e)},parents:function(e){for(var t=[],n=this.parent();n.nonempty();){for(var r=0;r<n.length;r++){var i=n[r];t.push(i)}n=n.parent()}return this.spawn(t,!0).filter(e)},commonAncestors:function(e){for(var t,n=0;n<this.length;n++){var r=this[n].parents();t||=r,t=t.intersect(r)}return t.filter(e)},orphans:function(e){return this.stdFilter(function(e){return e.isOrphan()}).filter(e)},nonorphans:function(e){return this.stdFilter(function(e){return e.isChild()}).filter(e)},children:sl(function(e){for(var t=[],n=0;n<this.length;n++)for(var r=this[n]._private.children,i=0;i<r.length;i++)t.push(r[i]);return this.spawn(t,!0).filter(e)},`children`),siblings:function(e){return this.parent().children().not(this).filter(e)},isParent:function(){var e=this[0];if(e)return e.isNode()&&e._private.children.length!==0},isChildless:function(){var e=this[0];if(e)return e.isNode()&&e._private.children.length===0},isChild:function(){var e=this[0];if(e)return e.isNode()&&e._private.parent!=null},isOrphan:function(){var e=this[0];if(e)return e.isNode()&&e._private.parent==null},descendants:function(e){var t=[];function n(e){for(var r=0;r<e.length;r++){var i=e[r];t.push(i),i.children().nonempty()&&n(i.children())}}return n(this.children()),this.spawn(t,!0).filter(e)}};function ll(e,t,n,r){for(var i=[],a=new Sn,o=e.cy().hasCompoundNodes(),s=0;s<e.length;s++){var c=e[s];n?i.push(c):o&&r(i,a,c)}for(;i.length>0;){var l=i.shift();t(l),a.add(l.id()),o&&r(i,a,l)}return e}function ul(e,t,n){if(n.isParent())for(var r=n._private.children,i=0;i<r.length;i++){var a=r[i];t.has(a.id())||e.push(a)}}cl.forEachDown=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return ll(this,e,t,ul)};function dl(e,t,n){if(n.isChild()){var r=n._private.parent;t.has(r.id())||e.push(r)}}cl.forEachUp=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return ll(this,e,t,dl)};function fl(e,t,n){dl(e,t,n),ul(e,t,n)}cl.forEachUpAndDown=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return ll(this,e,t,fl)},cl.ancestors=cl.parents;var pl=ml={data:Fc.data({field:`data`,bindingEvent:`data`,allowBinding:!0,allowSetting:!0,settingEvent:`data`,settingTriggersEvent:!0,triggerFnName:`trigger`,allowGetting:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),removeData:Fc.removeData({field:`data`,event:`data`,triggerFnName:`trigger`,triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:Fc.data({field:`scratch`,bindingEvent:`scratch`,allowBinding:!0,allowSetting:!0,settingEvent:`scratch`,settingTriggersEvent:!0,triggerFnName:`trigger`,allowGetting:!0,updateStyle:!0}),removeScratch:Fc.removeData({field:`scratch`,event:`scratch`,triggerFnName:`trigger`,triggerEvent:!0,updateStyle:!0}),rscratch:Fc.data({field:`rscratch`,allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:Fc.removeData({field:`rscratch`,triggerEvent:!1}),id:function(){var e=this[0];if(e)return e._private.data.id}},ml;pl.attr=pl.data,pl.removeAttr=pl.removeData;var hl=ml,gl={};function _l(e){return function(t){var n=this;if(t===void 0&&(t=!0),n.length!==0&&n.isNode()&&!n.removed()){for(var r=0,i=n[0],a=i._private.edges,o=0;o<a.length;o++){var s=a[o];!t&&s.isLoop()||(r+=e(i,s))}return r}}}X(gl,{degree:_l(function(e,t){return t.source().same(t.target())?2:1}),indegree:_l(function(e,t){return+!!t.target().same(e)}),outdegree:_l(function(e,t){return+!!t.source().same(e)})});function vl(e,t){return function(n){for(var r,i=this.nodes(),a=0;a<i.length;a++){var o=i[a][e](n);o!==void 0&&(r===void 0||t(o,r))&&(r=o)}return r}}X(gl,{minDegree:vl(`degree`,function(e,t){return e<t}),maxDegree:vl(`degree`,function(e,t){return e>t}),minIndegree:vl(`indegree`,function(e,t){return e<t}),maxIndegree:vl(`indegree`,function(e,t){return e>t}),minOutdegree:vl(`outdegree`,function(e,t){return e<t}),maxOutdegree:vl(`outdegree`,function(e,t){return e>t})}),X(gl,{totalDegree:function(e){for(var t=0,n=this.nodes(),r=0;r<n.length;r++)t+=n[r].degree(e);return t}});var yl,bl,xl=function(e,t,n){for(var r=0;r<e.length;r++){var i=e[r];if(!i.locked()){var a=i._private.position,o={x:t.x==null?0:t.x-a.x,y:t.y==null?0:t.y-a.y};i.isParent()&&(o.x!==0||o.y!==0)&&i.children().shift(o,n),i.dirtyBoundingBoxCache()}}},Sl={field:`position`,bindingEvent:`position`,allowBinding:!0,allowSetting:!0,settingEvent:`position`,settingTriggersEvent:!0,triggerFnName:`emitAndNotify`,allowGetting:!0,validKeys:[`x`,`y`],beforeGet:function(e){e.updateCompoundBounds()},beforeSet:function(e,t){xl(e,t,!1)},onSet:function(e){e.dirtyCompoundBoundsCache()},canSet:function(e){return!e.locked()}};yl=bl={position:Fc.data(Sl),silentPosition:Fc.data(X({},Sl,{allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!1,beforeSet:function(e,t){xl(e,t,!0)},onSet:function(e){e.dirtyCompoundBoundsCache()}})),positions:function(e,t){if(q(e))t?this.silentPosition(e):this.position(e);else if(G(e)){var n=e,r=this.cy();r.startBatch();for(var i=0;i<this.length;i++){var a=this[i],o=void 0;(o=n(a,i))&&(t?a.silentPosition(o):a.position(o))}r.endBatch()}return this},silentPositions:function(e){return this.positions(e,!0)},shift:function(e,t,n){var r;if(q(e)?(r={x:Y(e.x)?e.x:0,y:Y(e.y)?e.y:0},n=t):W(e)&&Y(t)&&(r={x:0,y:0},r[e]=t),r!=null){var i=this.cy();i.startBatch();for(var a=0;a<this.length;a++){var o=this[a];if(!(i.hasCompoundNodes()&&o.isChild()&&o.ancestors().anySame(this))){var s=o.position(),c={x:s.x+r.x,y:s.y+r.y};n?o.silentPosition(c):o.position(c)}}i.endBatch()}return this},silentShift:function(e,t){return q(e)?this.shift(e,!0):W(e)&&Y(t)&&this.shift(e,t,!0),this},renderedPosition:function(e,t){var n=this[0],r=this.cy(),i=r.zoom(),a=r.pan(),o=q(e)?e:void 0,s=o!==void 0||t!==void 0&&W(e);if(n&&n.isNode()){if(s)for(var c=0;c<this.length;c++){var l=this[c];t===void 0?o!==void 0&&l.position(Yn(o,i,a)):l.position(e,(t-a[e])/i)}else return o=Jn(n.position(),i,a),e===void 0?o:o[e]}else if(!s)return;return this},relativePosition:function(e,t){var n=this[0],r=this.cy(),i=q(e)?e:void 0,a=i!==void 0||t!==void 0&&W(e),o=r.hasCompoundNodes();if(n&&n.isNode()){if(a)for(var s=0;s<this.length;s++){var c=this[s],l=o?c.parent():null,u=l&&l.length>0,d=u;u&&(l=l[0]);var f=d?l.position():{x:0,y:0};t===void 0?i!==void 0&&c.position({x:i.x+f.x,y:i.y+f.y}):c.position(e,t+f[e])}else{var p=n.position(),m=o?n.parent():null,h=m&&m.length>0,g=h;h&&(m=m[0]);var _=g?m.position():{x:0,y:0};return i={x:p.x-_.x,y:p.y-_.y},e===void 0?i:i[e]}}else if(!a)return;return this}},yl.modelPosition=yl.point=yl.position,yl.modelPositions=yl.points=yl.positions,yl.renderedPoint=yl.renderedPosition,yl.relativePoint=yl.relativePosition;var Cl=bl,wl=function(e){switch(e){case`left`:case`right-inside`:return`left`;case`right`:case`left-inside`:return`right`;default:return`center`}},Tl=function(e){switch(e){case`top`:case`bottom-inside`:return`top`;case`bottom`:case`top-inside`:return`bottom`;default:return`center`}},El=function(e){switch(e){case`left`:return`right`;case`right`:return`left`;case`left-inside`:return`left`;case`right-inside`:return`right`;default:return`center`}},Dl=Ol={},Ol;Ol.renderedBoundingBox=function(e){var t=this.boundingBox(e),n=this.cy(),r=n.zoom(),i=n.pan(),a=t.x1*r+i.x,o=t.x2*r+i.x,s=t.y1*r+i.y,c=t.y2*r+i.y;return{x1:a,x2:o,y1:s,y2:c,w:o-a,h:c-s}},Ol.dirtyCompoundBoundsCache=function(){var e=arguments.length>0&&arguments[0]!==void 0&&arguments[0],t=this.cy();return!t.styleEnabled()||!t.hasCompoundNodes()||this.forEachUp(function(t){if(t.isParent()){var n=t._private;n.compoundBoundsClean=!1,n.bbCache=null,e||t.emitAndNotify(`bounds`)}}),this},Ol.updateCompoundBounds=function(){var e=arguments.length>0&&arguments[0]!==void 0&&arguments[0],t=this.cy();if(!t.styleEnabled()||!t.hasCompoundNodes()||!e&&t.batching())return this;function n(e){if(!e.isParent())return;var t=e._private,n=e.children(),r=e.pstyle(`compound-sizing-wrt-labels`).value===`include`,i={width:{val:e.pstyle(`min-width`).pfValue,left:e.pstyle(`min-width-bias-left`),right:e.pstyle(`min-width-bias-right`)},height:{val:e.pstyle(`min-height`).pfValue,top:e.pstyle(`min-height-bias-top`),bottom:e.pstyle(`min-height-bias-bottom`)}},a=n.boundingBox({includeLabels:r,includeOverlays:!1,useCache:!1}),o=t.position;(a.w===0||a.h===0)&&(a={w:e.pstyle(`width`).pfValue,h:e.pstyle(`height`).pfValue},a.x1=o.x-a.w/2,a.x2=o.x+a.w/2,a.y1=o.y-a.h/2,a.y2=o.y+a.h/2);function s(e,t,n){var r=0,i=0,a=t+n;return e>0&&a>0&&(r=t/a*e,i=n/a*e),{biasDiff:r,biasComplementDiff:i}}function c(e,t,n,r){if(n.units===`%`)switch(r){case`width`:return e>0?n.pfValue*e:0;case`height`:return t>0?n.pfValue*t:0;case`average`:return e>0&&t>0?n.pfValue*(e+t)/2:0;case`min`:return e>0&&t>0?e>t?n.pfValue*t:n.pfValue*e:0;case`max`:return e>0&&t>0?e>t?n.pfValue*e:n.pfValue*t:0;default:return 0}else if(n.units===`px`)return n.pfValue;else return 0}var l=i.width.left.value;i.width.left.units===`px`&&i.width.val>0&&(l=l*100/i.width.val);var u=i.width.right.value;i.width.right.units===`px`&&i.width.val>0&&(u=u*100/i.width.val);var d=i.height.top.value;i.height.top.units===`px`&&i.height.val>0&&(d=d*100/i.height.val);var f=i.height.bottom.value;i.height.bottom.units===`px`&&i.height.val>0&&(f=f*100/i.height.val);var p=s(i.width.val-a.w,l,u),m=p.biasDiff,h=p.biasComplementDiff,g=s(i.height.val-a.h,d,f),_=g.biasDiff,v=g.biasComplementDiff;t.autoPadding=c(a.w,a.h,e.pstyle(`padding`),e.pstyle(`padding-relative-to`).value),t.autoWidth=Math.max(a.w,i.width.val),o.x=(-m+a.x1+a.x2+h)/2,t.autoHeight=Math.max(a.h,i.height.val),o.y=(-_+a.y1+a.y2+v)/2}for(var r=0;r<this.length;r++){var i=this[r],a=i._private;(!a.compoundBoundsClean||e)&&(n(i),t.batching()||(a.compoundBoundsClean=!0))}return this};var kl=function(e){return e===1/0||e===-1/0?0:e},Al=function(e,t,n,r,i){r-t!==0&&i-n!==0&&t!=null&&n!=null&&r!=null&&i!=null&&(e.x1=t<e.x1?t:e.x1,e.x2=r>e.x2?r:e.x2,e.y1=n<e.y1?n:e.y1,e.y2=i>e.y2?i:e.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1)},jl=function(e,t){return t==null?e:Al(e,t.x1,t.y1,t.x2,t.y2)},Ml=function(e,t,n){return _n(e,t,n)},Nl=function(e,t,n){if(!t.cy().headless()){var r=t._private,i=r.rstyle,a=i.arrowWidth/2,o=t.pstyle(n+`-arrow-shape`).value,s,c;if(o!==`none`){n===`source`?(s=i.srcX,c=i.srcY):n===`target`?(s=i.tgtX,c=i.tgtY):(s=i.midX,c=i.midY);var l=r.arrowBounds=r.arrowBounds||{},u=l[n]=l[n]||{};u.x1=s-a,u.y1=c-a,u.x2=s+a,u.y2=c+a,u.w=u.x2-u.x1,u.h=u.y2-u.y1,yr(u,1),Al(e,u.x1,u.y1,u.x2,u.y2)}}},Pl=function(e,t,n){if(!t.cy().headless()){var r=n?n+`-`:``,i=t._private,a=i.rstyle;if(t.pstyle(r+`label`).strValue){var o=t.pstyle(`text-halign`),s=t.pstyle(`text-valign`),c=Ml(a,`labelWidth`,n),l=Ml(a,`labelHeight`,n),u=Ml(a,`labelX`,n),d=Ml(a,`labelY`,n),f=t.pstyle(r+`text-margin-x`).pfValue,p=t.pstyle(r+`text-margin-y`).pfValue,m=t.isEdge(),h=t.pstyle(r+`text-rotation`),g=t.pstyle(`text-outline-width`).pfValue,_=t.pstyle(`text-border-width`).pfValue/2,v=t.pstyle(`text-background-padding`).pfValue,y=2,b=l,x=c,S=x/2,C=b/2,w,T,E,D;if(m)w=u-S,T=u+S,E=d-C,D=d+C;else{switch(wl(o.value)){case`left`:w=u-x,T=u;break;case`center`:w=u-S,T=u+S;break;case`right`:w=u,T=u+x}switch(Tl(s.value)){case`top`:E=d-b,D=d;break;case`center`:E=d-C,D=d+C;break;case`bottom`:E=d,D=d+b}}var O=f-Math.max(g,_)-v-y,k=f+Math.max(g,_)+v+y,A=p-Math.max(g,_)-v-y,j=p+Math.max(g,_)+v+y;w+=O,T+=k,E+=A,D+=j;var M=n||`main`,N=i.labelBounds,P=N[M]=N[M]||{};P.x1=w,P.y1=E,P.x2=T,P.y2=D,P.w=T-w,P.h=D-E,P.leftPad=O,P.rightPad=k,P.topPad=A,P.botPad=j;var F=m&&h.strValue===`autorotate`,I=h.pfValue!=null&&h.pfValue!==0;if(F||I){var L=F?Ml(i.rstyle,`labelAngle`,n):h.pfValue,R=Math.cos(L),ee=Math.sin(L),z=(w+T)/2,B=(E+D)/2;if(!m){switch(wl(o.value)){case`left`:z=T;break;case`right`:z=w}switch(Tl(s.value)){case`top`:B=D;break;case`bottom`:B=E}}var V=function(e,t){return e-=z,t-=B,{x:e*R-t*ee+z,y:e*ee+t*R+B}},H=V(w,E),U=V(w,D),W=V(T,E),G=V(T,D);w=Math.min(H.x,U.x,W.x,G.x),T=Math.max(H.x,U.x,W.x,G.x),E=Math.min(H.y,U.y,W.y,G.y),D=Math.max(H.y,U.y,W.y,G.y)}var K=M+`Rot`,q=N[K]=N[K]||{};q.x1=w,q.y1=E,q.x2=T,q.y2=D,q.w=T-w,q.h=D-E,Al(e,w,E,T,D),Al(i.labelBounds.all,w,E,T,D)}return e}},Fl=function(e,t){if(!t.cy().headless()){var n=t.pstyle(`outline-opacity`).value,r=t.pstyle(`outline-width`).value+t.pstyle(`outline-offset`).value;Il(e,t,n,r,`outside`,r/2)}},Il=function(e,t,n,r,i,a){if(!(n===0||r<=0||i===`inside`)){var o=t.cy().renderer(),s=o.nodeShapes[o.getNodeShape(t)];if(s){var c=t.position(),l=c.x,u=c.y,d=t.width(),f=t.height();s.hasMiterBounds?(i===`center`&&(r/=2),jl(e,s.miterBounds(l,u,d,f,r))):a!=null&&a>0&&br(e,[a,a,a,a])}}},Ll=function(e,t){if(!t.cy().headless()){var n=t.pstyle(`border-opacity`).value,r=t.pstyle(`border-width`).pfValue,i=t.pstyle(`border-position`).value;Il(e,t,n,r,i)}},Rl=function(e,t){var n=e._private.cy,r=n.styleEnabled(),i=n.headless(),a=mr(),o=e._private,s=e.isNode(),c=e.isEdge(),l,u,d,f,p,m,h=o.rstyle,g=s&&r?e.pstyle(`bounds-expansion`).pfValue:[0],_=function(e){return e.pstyle(`display`).value!==`none`},v=!r||_(e)&&(!c||_(e.source())&&_(e.target()));if(v){var y=0,b=0;r&&t.includeOverlays&&(y=e.pstyle(`overlay-opacity`).value,y!==0&&(b=e.pstyle(`overlay-padding`).value));var x=0,S=0;r&&t.includeUnderlays&&(x=e.pstyle(`underlay-opacity`).value,x!==0&&(S=e.pstyle(`underlay-padding`).value));var C=Math.max(b,S),w=0,T=0;if(r&&(w=e.pstyle(`width`).pfValue,T=w/2),s&&t.includeNodes){var E=e.position();p=E.x,m=E.y;var D=e.outerWidth()/2,O=e.outerHeight()/2;l=p-D,u=p+D,d=m-O,f=m+O,Al(a,l,d,u,f),r&&Fl(a,e),r&&t.includeOutlines&&!i&&Fl(a,e),r&&Ll(a,e)}else if(c&&t.includeEdges){if(r&&!i){var k=e.pstyle(`curve-style`).strValue;if(l=Math.min(h.srcX,h.midX,h.tgtX),u=Math.max(h.srcX,h.midX,h.tgtX),d=Math.min(h.srcY,h.midY,h.tgtY),f=Math.max(h.srcY,h.midY,h.tgtY),l-=T,u+=T,d-=T,f+=T,Al(a,l,d,u,f),k===`haystack`){var A=h.haystackPts;if(A&&A.length===2){if(l=A[0].x,d=A[0].y,u=A[1].x,f=A[1].y,l>u){var j=l;l=u,u=j}if(d>f){var M=d;d=f,f=M}Al(a,l-T,d-T,u+T,f+T)}}else if(k===`bezier`||k===`unbundled-bezier`||ye(k,`segments`)||ye(k,`taxi`)){var N;switch(k){case`bezier`:case`unbundled-bezier`:N=h.bezierPts;break;case`segments`:case`taxi`:case`round-segments`:case`round-taxi`:N=h.linePts}if(N!=null)for(var P=0;P<N.length;P++){var F=N[P];l=F.x-T,u=F.x+T,d=F.y-T,f=F.y+T,Al(a,l,d,u,f)}}}else{var I=e.source().position(),L=e.target().position();if(l=I.x,u=L.x,d=I.y,f=L.y,l>u){var R=l;l=u,u=R}if(d>f){var ee=d;d=f,f=ee}l-=T,u+=T,d-=T,f+=T,Al(a,l,d,u,f)}}if(r&&t.includeEdges&&c&&(Nl(a,e,`mid-source`),Nl(a,e,`mid-target`),Nl(a,e,`source`),Nl(a,e,`target`)),r&&e.pstyle(`ghost`).value===`yes`){var z=e.pstyle(`ghost-offset-x`).pfValue,B=e.pstyle(`ghost-offset-y`).pfValue;Al(a,a.x1+z,a.y1+B,a.x2+z,a.y2+B)}var V=o.bodyBounds=o.bodyBounds||{};xr(V,a),br(V,g),yr(V,1),r&&(l=a.x1,u=a.x2,d=a.y1,f=a.y2,Al(a,l-C,d-C,u+C,f+C));var H=o.overlayBounds=o.overlayBounds||{};xr(H,a),br(H,g),yr(H,1);var U=o.labelBounds=o.labelBounds||{};U.all==null?U.all=mr():gr(U.all),r&&t.includeLabels&&(t.includeMainLabels&&Pl(a,e,null),c&&(t.includeSourceLabels&&Pl(a,e,`source`),t.includeTargetLabels&&Pl(a,e,`target`)))}return a.x1=kl(a.x1),a.y1=kl(a.y1),a.x2=kl(a.x2),a.y2=kl(a.y2),a.w=kl(a.x2-a.x1),a.h=kl(a.y2-a.y1),a.w>0&&a.h>0&&v&&(br(a,g),yr(a,1)),a},zl=function(e){var t=0,n=function(e){return+!!e<<t++},r=0;return r+=n(e.incudeNodes),r+=n(e.includeEdges),r+=n(e.includeLabels),r+=n(e.includeMainLabels),r+=n(e.includeSourceLabels),r+=n(e.includeTargetLabels),r+=n(e.includeOverlays),r+=n(e.includeOutlines),r},Bl=function(e){var t=function(e){return Math.round(e)};if(e.isEdge()){var n=e.source().position(),r=e.target().position();return Ht([t(n.x),t(n.y),t(r.x),t(r.y)])}var i=e.position();return Ht([t(i.x),t(i.y)])},Vl=function(e,t){var n=e._private,r,i=e.isEdge(),a=(t==null?Ul:zl(t))===Ul;if(n.bbCache==null?(r=Rl(e,Hl),n.bbCache=r,n.bbCachePosKey=Bl(e)):r=n.bbCache,!a){var o=e.isNode();r=mr(),(t.includeNodes&&o||t.includeEdges&&!o)&&(t.includeOverlays?jl(r,n.overlayBounds):jl(r,n.bodyBounds)),t.includeLabels&&(t.includeMainLabels&&(!i||t.includeSourceLabels&&t.includeTargetLabels)?jl(r,n.labelBounds.all):(t.includeMainLabels&&jl(r,n.labelBounds.mainRot),t.includeSourceLabels&&jl(r,n.labelBounds.sourceRot),t.includeTargetLabels&&jl(r,n.labelBounds.targetRot))),r.w=r.x2-r.x1,r.h=r.y2-r.y1}return r},Hl={includeNodes:!0,includeEdges:!0,includeLabels:!0,includeMainLabels:!0,includeSourceLabels:!0,includeTargetLabels:!0,includeOverlays:!0,includeUnderlays:!0,includeOutlines:!0,useCache:!0},Ul=zl(Hl),Wl=pn(Hl);Ol.boundingBox=function(e){var t,n=e===void 0||e.useCache===void 0||e.useCache===!0,r=me(function(e){var t=e._private;return t.bbCache==null||t.styleDirty||t.bbCachePosKey!==Bl(e)},function(e){return e.id()});if(n&&this.length===1&&!r(this[0]))e=e===void 0?Hl:Wl(e),t=Vl(this[0],e);else{t=mr(),e||=Hl;var i=Wl(e),a=this,o=a.cy().styleEnabled();this.edges().forEach(r),this.nodes().forEach(r),o&&this.recalculateRenderedStyle(n),this.updateCompoundBounds(!n);for(var s=0;s<a.length;s++){var c=a[s];r(c)&&c.dirtyBoundingBoxCache(),jl(t,Vl(c,i))}}return t.x1=kl(t.x1),t.y1=kl(t.y1),t.x2=kl(t.x2),t.y2=kl(t.y2),t.w=kl(t.x2-t.x1),t.h=kl(t.y2-t.y1),t},Ol.dirtyBoundingBoxCache=function(){for(var e=0;e<this.length;e++){var t=this[e]._private;t.bbCache=null,t.bbCachePosKey=null,t.bodyBounds=null,t.overlayBounds=null,t.labelBounds.all=null,t.labelBounds.source=null,t.labelBounds.target=null,t.labelBounds.main=null,t.labelBounds.sourceRot=null,t.labelBounds.targetRot=null,t.labelBounds.mainRot=null,t.arrowBounds.source=null,t.arrowBounds.target=null,t.arrowBounds[`mid-source`]=null,t.arrowBounds[`mid-target`]=null}return this.emitAndNotify(`bounds`),this},Ol.boundingBoxAt=function(e){var t=this.nodes(),n=this.cy(),r=n.hasCompoundNodes(),i=n.collection();if(r&&(i=t.filter(function(e){return e.isParent()}),t=t.not(i)),q(e)){var a=e;e=function(){return a}}var o=function(t,n){return t._private.bbAtOldPos=e(t,n)},s=function(e){return e._private.bbAtOldPos};n.startBatch(),t.forEach(o).silentPositions(e),r&&(i.dirtyCompoundBoundsCache(),i.dirtyBoundingBoxCache(),i.updateCompoundBounds(!0));var c=hr(this.boundingBox({useCache:!1}));return t.silentPositions(s),r&&(i.dirtyCompoundBoundsCache(),i.dirtyBoundingBoxCache(),i.updateCompoundBounds(!0)),n.endBatch(),c},Dl.boundingbox=Dl.bb=Dl.boundingBox,Dl.renderedBoundingbox=Dl.renderedBoundingBox;var Gl=Ol,Kl=ql={},ql,Jl=function(e){e.uppercaseName=ve(e.name),e.autoName=`auto`+e.uppercaseName,e.labelName=`label`+e.uppercaseName,e.outerName=`outer`+e.uppercaseName,e.uppercaseOuterName=ve(e.outerName),Kl[e.name]=function(){var t=this[0],n=t._private,r=n.cy._private.styleEnabled;if(t){if(r){if(t.isParent())return t.updateCompoundBounds(),n[e.autoName]||0;var i=t.pstyle(e.name);switch(i.strValue){case`label`:return t.recalculateRenderedStyle(),n.rstyle[e.labelName]||0;default:return i.pfValue}}else return 1}},Kl[`outer`+e.uppercaseName]=function(){var t=this[0],n=t._private.cy._private.styleEnabled;if(t){if(n){var r=t[e.name](),i=t.pstyle(`border-position`).value,a=i===`center`?t.pstyle(`border-width`).pfValue:i===`outside`?2*t.pstyle(`border-width`).pfValue:0,o=2*t.padding();return r+a+o}return 1}},Kl[`rendered`+e.uppercaseName]=function(){var t=this[0];if(t)return t[e.name]()*this.cy().zoom()},Kl[`rendered`+e.uppercaseOuterName]=function(){var t=this[0];if(t)return t[e.outerName]()*this.cy().zoom()}};Jl({name:`width`}),Jl({name:`height`}),ql.padding=function(){var e=this[0],t=e._private;return e.isParent()?(e.updateCompoundBounds(),t.autoPadding===void 0?e.pstyle(`padding`).pfValue:t.autoPadding):e.pstyle(`padding`).pfValue},ql.paddedHeight=function(){var e=this[0];return e.height()+2*e.padding()},ql.paddedWidth=function(){var e=this[0];return e.width()+2*e.padding()};var Yl=ql,Xl=function(e,t){if(e.isEdge()&&e.takesUpSpace())return t(e)},Zl=function(e,t){if(e.isEdge()&&e.takesUpSpace()){var n=e.cy();return Jn(t(e),n.zoom(),n.pan())}},Ql=function(e,t){if(e.isEdge()&&e.takesUpSpace()){var n=e.cy(),r=n.pan(),i=n.zoom();return t(e).map(function(e){return Jn(e,i,r)})}},$l={controlPoints:{get:function(e){return e.renderer().getControlPoints(e)},mult:!0},segmentPoints:{get:function(e){return e.renderer().getSegmentPoints(e)},mult:!0},sourceEndpoint:{get:function(e){return e.renderer().getSourceEndpoint(e)}},targetEndpoint:{get:function(e){return e.renderer().getTargetEndpoint(e)}},midpoint:{get:function(e){return e.renderer().getEdgeMidpoint(e)}}},eu=function(e){return`rendered`+e[0].toUpperCase()+e.substr(1)},tu=X({},Cl,Gl,Yl,Object.keys($l).reduce(function(e,t){var n=$l[t],r=eu(t);return e[t]=function(){return Xl(this,n.get)},e[r]=n.mult?function(){return Ql(this,n.get)}:function(){return Zl(this,n.get)},e},{})),nu=function(e,t){this.recycle(e,t)};function ru(){return!1}function iu(){return!0}nu.prototype={instanceString:function(){return`event`},recycle:function(e,t){if(this.isImmediatePropagationStopped=this.isPropagationStopped=this.isDefaultPrevented=ru,e!=null&&e.preventDefault?(this.type=e.type,this.isDefaultPrevented=e.defaultPrevented?iu:ru):e!=null&&e.type?t=e:this.type=e,t!=null&&(this.originalEvent=t.originalEvent,this.type=t.type==null?this.type:t.type,this.cy=t.cy,this.target=t.target,this.position=t.position,this.renderedPosition=t.renderedPosition,this.namespace=t.namespace,this.layout=t.layout),this.cy!=null&&this.position!=null&&this.renderedPosition==null){var n=this.position,r=this.cy.zoom(),i=this.cy.pan();this.renderedPosition={x:n.x*r+i.x,y:n.y*r+i.y}}this.timeStamp=e&&e.timeStamp||Date.now()},preventDefault:function(){this.isDefaultPrevented=iu;var e=this.originalEvent;e&&e.preventDefault&&e.preventDefault()},stopPropagation:function(){this.isPropagationStopped=iu;var e=this.originalEvent;e&&e.stopPropagation&&e.stopPropagation()},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=iu,this.stopPropagation()},isDefaultPrevented:ru,isPropagationStopped:ru,isImmediatePropagationStopped:ru};var au=/^([^.]+)(\.(?:[^.]+))?$/,ou=`.*`,su={qualifierCompare:function(e,t){return e===t},eventMatches:function(){return!0},addEventFields:function(){},callbackContext:function(e){return e},beforeEmit:function(){},afterEmit:function(){},bubble:function(){return!1},parent:function(){return null},context:null},cu=Object.keys(su),lu={};function uu(){for(var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:lu,t=arguments.length>1?arguments[1]:void 0,n=0;n<cu.length;n++){var r=cu[n];this[r]=e[r]||su[r]}this.context=t||this.context,this.listeners=[],this.emitting=0}var du=uu.prototype,fu=function(e,t,n,r,i,a,o){G(r)&&(i=r,r=null),o&&(a=a==null?o:X({},a,o));for(var s=K(n)?n:n.split(/\s+/),c=0;c<s.length;c++){var l=s[c];if(!le(l)){var u=l.match(au);if(u){var d=u[1];if(t(e,l,d,u[2]?u[2]:null,r,i,a)===!1)break}}}},pu=function(e,t){return e.addEventFields(e.context,t),new nu(t.type,t)},mu=function(e,t,n){if(ce(n)){t(e,n);return}if(q(n)){t(e,pu(e,n));return}for(var r=K(n)?n:n.split(/\s+/),i=0;i<r.length;i++){var a=r[i];if(!le(a)){var o=a.match(au);if(o){var s=o[1];t(e,pu(e,{type:s,namespace:o[2]?o[2]:null,target:e.context}))}}}};du.on=du.addListener=function(e,t,n,r,i){return fu(this,function(e,t,n,r,i,a,o){G(a)&&e.listeners.push({event:t,callback:a,type:n,namespace:r,qualifier:i,conf:o})},e,t,n,r,i),this},du.one=function(e,t,n,r){return this.on(e,t,n,r,{one:!0})},du.removeListener=du.off=function(e,t,n,r){var i=this;this.emitting!==0&&(this.listeners=ln(this.listeners));for(var a=this.listeners,o=function(o){var s=a[o];fu(i,function(t,n,r,i,c,l){if((s.type===r||e===`*`)&&(!i&&s.namespace!==`.*`||s.namespace===i)&&(!c||t.qualifierCompare(s.qualifier,c))&&(!l||s.callback===l))return a.splice(o,1),!1},e,t,n,r)},s=a.length-1;s>=0;s--)o(s);return this},du.removeAllListeners=function(){return this.removeListener(`*`)},du.emit=du.trigger=function(e,t,n){var r=this.listeners,i=r.length;return this.emitting++,K(t)||(t=[t]),mu(this,function(e,a){n!=null&&(r=[{event:a.event,type:a.type,namespace:a.namespace,callback:n}],i=r.length);for(var o=function(){var n=r[s];if(n.type===a.type&&(!n.namespace||n.namespace===a.namespace||n.namespace===ou)&&e.eventMatches(e.context,n,a)){var i=[a];t!=null&&gn(i,t),e.beforeEmit(e.context,n,a),n.conf&&n.conf.one&&(e.listeners=e.listeners.filter(function(e){return e!==n}));var o=e.callbackContext(e.context,n,a),c=n.callback.apply(o,i);e.afterEmit(e.context,n,a),c===!1&&(a.stopPropagation(),a.preventDefault())}},s=0;s<i;s++)o();e.bubble(e.context)&&!a.isPropagationStopped()&&e.parent(e.context).emit(a,t)},e),this.emitting--,this};var hu={qualifierCompare:function(e,t){return e==null||t==null?e==null&&t==null:e.sameText(t)},eventMatches:function(e,t,n){var r=t.qualifier;return r==null||e!==n.target&&ie(n.target)&&r.matches(n.target)},addEventFields:function(e,t){t.cy=e.cy(),t.target=e},callbackContext:function(e,t,n){return t.qualifier==null?e:n.target},beforeEmit:function(e,t){t.conf&&t.conf.once&&t.conf.onceCollection.removeListener(t.event,t.qualifier,t.callback)},bubble:function(){return!0},parent:function(e){return e.isChild()?e.parent():e.cy()}},gu=function(e){return W(e)?new il(e):e},_u={createEmitter:function(){for(var e=0;e<this.length;e++){var t=this[e],n=t._private;n.emitter||=new uu(hu,t)}return this},emitter:function(){return this._private.emitter},on:function(e,t,n){for(var r=gu(t),i=0;i<this.length;i++)this[i].emitter().on(e,r,n);return this},removeListener:function(e,t,n){for(var r=gu(t),i=0;i<this.length;i++)this[i].emitter().removeListener(e,r,n);return this},removeAllListeners:function(){for(var e=0;e<this.length;e++)this[e].emitter().removeAllListeners();return this},one:function(e,t,n){for(var r=gu(t),i=0;i<this.length;i++)this[i].emitter().one(e,r,n);return this},once:function(e,t,n){for(var r=gu(t),i=0;i<this.length;i++)this[i].emitter().on(e,r,n,{once:!0,onceCollection:this})},emit:function(e,t){for(var n=0;n<this.length;n++)this[n].emitter().emit(e,t);return this},emitAndNotify:function(e,t){if(this.length!==0)return this.cy().notify(e,this),this.emit(e,t),this}};Fc.eventAliasesOn(_u);var vu={nodes:function(e){return this.filter(function(e){return e.isNode()}).filter(e)},edges:function(e){return this.filter(function(e){return e.isEdge()}).filter(e)},byGroup:function(){for(var e=this.spawn(),t=this.spawn(),n=0;n<this.length;n++){var r=this[n];r.isNode()?e.push(r):t.push(r)}return{nodes:e,edges:t}},filter:function(e,t){if(e===void 0)return this;if(W(e)||re(e))return new il(e).filter(this);if(G(e)){for(var n=this.spawn(),r=this,i=0;i<r.length;i++){var a=r[i];(t?e.apply(t,[a,i,r]):e(a,i,r))&&n.push(a)}return n}return this.spawn()},not:function(e){if(e){W(e)&&(e=this.filter(e));for(var t=this.spawn(),n=0;n<this.length;n++){var r=this[n];e.has(r)||t.push(r)}return t}return this},absoluteComplement:function(){return this.cy().mutableElements().not(this)},intersect:function(e){if(W(e)){var t=e;return this.filter(t)}for(var n=this.spawn(),r=this,i=e,a=this.length<e.length,o=a?r:i,s=a?i:r,c=0;c<o.length;c++){var l=o[c];s.has(l)&&n.push(l)}return n},xor:function(e){var t=this._private.cy;W(e)&&(e=t.$(e));var n=this.spawn(),r=this,i=e,a=function(e,t){for(var r=0;r<e.length;r++){var i=e[r],a=i._private.data.id;t.hasElementWithId(a)||n.push(i)}};return a(r,i),a(i,r),n},diff:function(e){var t=this._private.cy;W(e)&&(e=t.$(e));var n=this.spawn(),r=this.spawn(),i=this.spawn(),a=this,o=e,s=function(e,t,n){for(var r=0;r<e.length;r++){var a=e[r],o=a._private.data.id;t.hasElementWithId(o)?i.merge(a):n.push(a)}};return s(a,o,n),s(o,a,r),{left:n,right:r,both:i}},add:function(e){var t=this._private.cy;if(!e)return this;if(W(e)){var n=e;e=t.mutableElements().filter(n)}for(var r=this.spawnSelf(),i=0;i<e.length;i++){var a=e[i];this.has(a)||r.push(a)}return r},merge:function(e){var t=this._private,n=t.cy;if(!e)return this;if(e&&W(e)){var r=e;e=n.mutableElements().filter(r)}for(var i=t.map,a=0;a<e.length;a++){var o=e[a],s=o._private.data.id;if(!i.has(s)){var c=this.length++;this[c]=o,i.set(s,{ele:o,index:c})}}return this},unmergeAt:function(e){var t=this[e].id(),n=this._private.map;this[e]=void 0,n.delete(t);var r=e===this.length-1;if(this.length>1&&!r){var i=this.length-1,a=this[i],o=a._private.data.id;this[i]=void 0,this[e]=a,n.set(o,{ele:a,index:e})}return this.length--,this},unmergeOne:function(e){e=e[0];var t=this._private,n=e._private.data.id,r=t.map.get(n);if(!r)return this;var i=r.index;return this.unmergeAt(i),this},unmerge:function(e){var t=this._private.cy;if(!e)return this;if(e&&W(e)){var n=e;e=t.mutableElements().filter(n)}for(var r=0;r<e.length;r++)this.unmergeOne(e[r]);return this},unmergeBy:function(e){for(var t=this.length-1;t>=0;t--){var n=this[t];e(n)&&this.unmergeAt(t)}return this},map:function(e,t){for(var n=[],r=this,i=0;i<r.length;i++){var a=r[i],o=t?e.apply(t,[a,i,r]):e(a,i,r);n.push(o)}return n},reduce:function(e,t){for(var n=t,r=this,i=0;i<r.length;i++)n=e(n,r[i],i,r);return n},max:function(e,t){for(var n=-1/0,r,i=this,a=0;a<i.length;a++){var o=i[a],s=t?e.apply(t,[o,a,i]):e(o,a,i);s>n&&(n=s,r=o)}return{value:n,ele:r}},min:function(e,t){for(var n=1/0,r,i=this,a=0;a<i.length;a++){var o=i[a],s=t?e.apply(t,[o,a,i]):e(o,a,i);s<n&&(n=s,r=o)}return{value:n,ele:r}}},yu=vu;yu.u=yu[`|`]=yu[`+`]=yu.union=yu.or=yu.add,yu[`\\`]=yu[`!`]=yu[`-`]=yu.difference=yu.relativeComplement=yu.subtract=yu.not,yu.n=yu[`&`]=yu[`.`]=yu.and=yu.intersection=yu.intersect,yu[`^`]=yu[`(+)`]=yu[`(-)`]=yu.symmetricDifference=yu.symdiff=yu.xor,yu.fnFilter=yu.filterFn=yu.stdFilter=yu.filter,yu.complement=yu.abscomp=yu.absoluteComplement;var bu={isNode:function(){return this.group()===`nodes`},isEdge:function(){return this.group()===`edges`},isLoop:function(){return this.isEdge()&&this.source()[0]===this.target()[0]},isSimple:function(){return this.isEdge()&&this.source()[0]!==this.target()[0]},group:function(){var e=this[0];if(e)return e._private.group}},xu=function(e,t){var n=e.cy().hasCompoundNodes();function r(e){var t=e.pstyle(`z-compound-depth`);return t.value===`auto`?n?e.zDepth():0:t.value===`bottom`?-1:t.value===`top`?Qt:0}var i=r(e)-r(t);if(i!==0)return i;function a(e){return e.pstyle(`z-index-compare`).value===`auto`?+!!e.isNode():0}var o=a(e)-a(t);if(o!==0)return o;var s=e.pstyle(`z-index`).value-t.pstyle(`z-index`).value;return s===0?e.poolIndex()-t.poolIndex():s},Su={forEach:function(e,t){if(G(e))for(var n=this.length,r=0;r<n;r++){var i=this[r];if((t?e.apply(t,[i,r,this]):e(i,r,this))===!1)break}return this},toArray:function(){for(var e=[],t=0;t<this.length;t++)e.push(this[t]);return e},slice:function(e,t){var n=[],r=this.length;t??=r,e??=0,e<0&&(e=r+e),t<0&&(t=r+t);for(var i=e;i>=0&&i<t&&i<r;i++)n.push(this[i]);return this.spawn(n)},size:function(){return this.length},eq:function(e){return this[e]||this.spawn()},first:function(){return this[0]||this.spawn()},last:function(){return this[this.length-1]||this.spawn()},empty:function(){return this.length===0},nonempty:function(){return!this.empty()},sort:function(e){if(!G(e))return this;var t=this.toArray().sort(e);return this.spawn(t)},sortByZIndex:function(){return this.sort(xu)},zDepth:function(){var e=this[0];if(e){var t=e._private;if(t.group===`nodes`){var n=t.data.parent?e.parents().size():0;return e.isParent()?n:Qt-1}var r=t.source,i=t.target,a=r.zDepth(),o=i.zDepth();return Math.max(a,o,0)}}};Su.each=Su.forEach,(function(){var e=`undefined`;(typeof Symbol>`u`?`undefined`:I(Symbol))!=e&&I(Symbol.iterator)!=e&&(Su[Symbol.iterator]=function(){var e=this,t={value:void 0,done:!1},n=0,r=this.length;return D({next:function(){return n<r?t.value=e[n++]:(t.value=void 0,t.done=!0),t}},Symbol.iterator,function(){return this})})})();var Cu=pn({nodeDimensionsIncludeLabels:!1}),wu={layoutDimensions:function(e){e=Cu(e);var t;if(!this.takesUpSpace())t={w:0,h:0};else if(e.nodeDimensionsIncludeLabels){var n=this.boundingBox();t={w:n.w,h:n.h}}else t={w:this.outerWidth(),h:this.outerHeight()};return(t.w===0||t.h===0)&&(t.w=t.h=1),t},layoutPositions:function(e,t,n){var r=this.nodes().filter(function(e){return!e.isParent()}),i=this.cy(),a=t.eles,o=function(e){return e.id()},s=me(n,o);e.emit({type:`layoutstart`,layout:e}),e.animations=[];var c=function(e,t,n){var r={x:t.x1+t.w/2,y:t.y1+t.h/2},i={x:(n.x-r.x)*e,y:(n.y-r.y)*e};return{x:r.x+i.x,y:r.y+i.y}},l=t.spacingFactor&&t.spacingFactor!==1,u=function(){if(!l)return null;for(var e=mr(),t=0;t<r.length;t++){var n=r[t],i=s(n,t);vr(e,i.x,i.y)}return e}(),d=me(function(e,n){var r=s(e,n);return l&&(r=c(Math.abs(t.spacingFactor),u,r)),t.transform!=null&&(r=t.transform(e,r)),r},o);if(t.animate){for(var f=0;f<r.length;f++){var p=r[f],m=d(p,f);if(t.animateFilter==null||t.animateFilter(p,f)){var h=p.animation({position:m,duration:t.animationDuration,easing:t.animationEasing});e.animations.push(h)}else p.position(m)}if(t.fit){var g=i.animation({fit:{boundingBox:a.boundingBoxAt(d),padding:t.padding},duration:t.animationDuration,easing:t.animationEasing});e.animations.push(g)}else if(t.zoom!==void 0&&t.pan!==void 0){var _=i.animation({zoom:t.zoom,pan:t.pan,duration:t.animationDuration,easing:t.animationEasing});e.animations.push(_)}e.animations.forEach(function(e){return e.play()}),e.one(`layoutready`,t.ready),e.emit({type:`layoutready`,layout:e}),Pa.all(e.animations.map(function(e){return e.promise()})).then(function(){e.one(`layoutstop`,t.stop),e.emit({type:`layoutstop`,layout:e})})}else r.positions(d),t.fit&&i.fit(t.eles,t.padding),t.zoom!=null&&i.zoom(t.zoom),t.pan&&i.pan(t.pan),e.one(`layoutready`,t.ready),e.emit({type:`layoutready`,layout:e}),e.one(`layoutstop`,t.stop),e.emit({type:`layoutstop`,layout:e});return this},layout:function(e){return this.cy().makeLayout(X({},e,{eles:this}))}};wu.createLayout=wu.makeLayout=wu.layout;function Tu(e,t,n){var r=n._private,i=r.styleCache=r.styleCache||[],a;return(a=i[e])??(a=i[e]=t(n)),a}function Eu(e,t){return e=Ut(e),function(n){return Tu(e,t,n)}}function Du(e,t){e=Ut(e);var n=function(e){return t.call(e)};return function(){var t=this[0];if(t)return Tu(e,n,t)}}var Ou={recalculateRenderedStyle:function(e){var t=this.cy(),n=t.renderer(),r=t.styleEnabled();return n&&r&&n.recalculateRenderedStyle(this,e),this},dirtyStyleCache:function(){var e=this.cy(),t=function(e){return e._private.styleCache=null};if(e.hasCompoundNodes()){var n=this.spawnSelf().merge(this.descendants()).merge(this.parents());n.merge(n.connectedEdges()),n.forEach(t)}else this.forEach(function(e){t(e),e.connectedEdges().forEach(t)});return this},updateStyle:function(e){var t=this._private.cy;if(!t.styleEnabled())return this;if(t.batching())return t._private.batchStyleEles.merge(this),this;var n=t.hasCompoundNodes(),r=this;e=!!(e||e===void 0),n&&(r=this.spawnSelf().merge(this.descendants()).merge(this.parents()));var i=r;return e?i.emitAndNotify(`style`):i.emit(`style`),r.forEach(function(e){return e._private.styleDirty=!0}),this},cleanStyle:function(){var e=this.cy();if(e.styleEnabled())for(var t=0;t<this.length;t++){var n=this[t];n._private.styleDirty&&(n._private.styleDirty=!1,e.style().apply(n))}},parsedStyle:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=this[0],r=n.cy();if(r.styleEnabled()&&n)return n._private.styleDirty&&(n._private.styleDirty=!1,r.style().apply(n)),n._private.style[e]??(t?r.style().getDefaultProperty(e):null)},numericStyle:function(e){var t=this[0];if(t.cy().styleEnabled()&&t){var n=t.pstyle(e);return n.pfValue===void 0?n.value:n.pfValue}},numericStyleUnits:function(e){var t=this[0];if(t.cy().styleEnabled()&&t)return t.pstyle(e).units},renderedStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var n=this[0];if(n)return t.style().getRenderedStyle(n,e)},style:function(e,t){var n=this.cy();if(!n.styleEnabled())return this;var r=!1,i=n.style();if(q(e)){var a=e;i.applyBypass(this,a,r),this.emitAndNotify(`style`)}else if(W(e)){if(t===void 0){var o=this[0];return o?i.getStylePropertyValue(o,e):void 0}i.applyBypass(this,e,t,r),this.emitAndNotify(`style`)}else if(e===void 0){var s=this[0];return s?i.getRawStyle(s):void 0}return this},removeStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var n=!1,r=t.style(),i=this;if(e===void 0)for(var a=0;a<i.length;a++){var o=i[a];r.removeAllBypasses(o,n)}else{e=e.split(/\s+/);for(var s=0;s<i.length;s++){var c=i[s];r.removeBypasses(c,e,n)}}return this.emitAndNotify(`style`),this},show:function(){return this.css(`display`,`element`),this},hide:function(){return this.css(`display`,`none`),this},effectiveOpacity:function(){var e=this.cy();if(!e.styleEnabled())return 1;var t=e.hasCompoundNodes(),n=this[0];if(n){var r=n._private,i=n.pstyle(`opacity`).value;if(!t)return i;var a=r.data.parent?n.parents():null;if(a)for(var o=0;o<a.length;o++)i=a[o].pstyle(`opacity`).value*i;return i}},transparent:function(){if(!this.cy().styleEnabled())return!1;var e=this[0],t=e.cy().hasCompoundNodes();if(e)return t?e.effectiveOpacity()===0:e.pstyle(`opacity`).value===0},backgrounding:function(){return this.cy().styleEnabled()?!!this[0]._private.backgrounding:!1}};function ku(e,t){var n=e._private.data.parent?e.parents():null;if(n)for(var r=0;r<n.length;r++){var i=n[r];if(!t(i))return!1}return!0}function Au(e){var t=e.ok,n=e.edgeOkViaNode||e.ok,r=e.parentOk||e.ok;return function(){var e=this.cy();if(!e.styleEnabled())return!0;var i=this[0],a=e.hasCompoundNodes();if(i){var o=i._private;if(!t(i))return!1;if(i.isNode())return!a||ku(i,r);var s=o.source,c=o.target;return n(s)&&(!a||ku(s,n))&&(s===c||n(c)&&(!a||ku(c,n)))}}}var ju=Eu(`eleTakesUpSpace`,function(e){return e.pstyle(`display`).value===`element`&&e.width()!==0&&(!e.isNode()||e.height()!==0)});Ou.takesUpSpace=Du(`takesUpSpace`,Au({ok:ju})),Ou.interactive=Du(`interactive`,Au({ok:Eu(`eleInteractive`,function(e){return e.pstyle(`events`).value===`yes`&&e.pstyle(`visibility`).value===`visible`&&ju(e)}),parentOk:Eu(`parentInteractive`,function(e){return e.pstyle(`visibility`).value===`visible`&&ju(e)}),edgeOkViaNode:ju})),Ou.noninteractive=function(){var e=this[0];if(e)return!e.interactive()},Ou.visible=Du(`visible`,Au({ok:Eu(`eleVisible`,function(e){return e.pstyle(`visibility`).value===`visible`&&e.pstyle(`opacity`).pfValue!==0&&ju(e)}),edgeOkViaNode:ju})),Ou.hidden=function(){var e=this[0];if(e)return!e.visible()},Ou.isBundledBezier=Du(`isBundledBezier`,function(){return this.cy().styleEnabled()?!this.removed()&&this.pstyle(`curve-style`).value===`bezier`&&this.takesUpSpace():!1}),Ou.bypass=Ou.css=Ou.style,Ou.renderedCss=Ou.renderedStyle,Ou.removeBypass=Ou.removeCss=Ou.removeStyle,Ou.pstyle=Ou.parsedStyle;var Mu={};function Nu(e){return function(){var t=arguments,n=[];if(t.length===2){var r=t[0],i=t[1];this.on(e.event,r,i)}else if(t.length===1&&G(t[0])){var a=t[0];this.on(e.event,a)}else if(t.length===0||t.length===1&&K(t[0])){for(var o=t.length===1?t[0]:null,s=0;s<this.length;s++){var c=this[s],l=!e.ableField||c._private[e.ableField],u=c._private[e.field]!=e.value;if(e.overrideAble){var d=e.overrideAble(c);if(d!==void 0&&(l=d,!d))return this}l&&(c._private[e.field]=e.value,u&&n.push(c))}var f=this.spawn(n);f.updateStyle(),f.emit(e.event),o&&f.emit(o)}return this}}function Pu(e){Mu[e.field]=function(){var t=this[0];if(t){if(e.overrideField){var n=e.overrideField(t);if(n!==void 0)return n}return t._private[e.field]}},Mu[e.on]=Nu({event:e.on,field:e.field,ableField:e.ableField,overrideAble:e.overrideAble,value:!0}),Mu[e.off]=Nu({event:e.off,field:e.field,ableField:e.ableField,overrideAble:e.overrideAble,value:!1})}Pu({field:`locked`,overrideField:function(e){return e.cy().autolock()?!0:void 0},on:`lock`,off:`unlock`}),Pu({field:`grabbable`,overrideField:function(e){return e.cy().autoungrabify()||e.pannable()?!1:void 0},on:`grabify`,off:`ungrabify`}),Pu({field:`selected`,ableField:`selectable`,overrideAble:function(e){return!e.cy().autounselectify()&&void 0},on:`select`,off:`unselect`}),Pu({field:`selectable`,overrideField:function(e){return!e.cy().autounselectify()&&void 0},on:`selectify`,off:`unselectify`}),Mu.deselect=Mu.unselect,Mu.grabbed=function(){var e=this[0];if(e)return e._private.grabbed},Pu({field:`active`,on:`activate`,off:`unactivate`}),Pu({field:`pannable`,on:`panify`,off:`unpanify`}),Mu.inactive=function(){var e=this[0];if(e)return!e._private.active};var Fu={},Iu=function(e){return function(t){for(var n=this,r=[],i=0;i<n.length;i++){var a=n[i];if(a.isNode()){for(var o=!1,s=a.connectedEdges(),c=0;c<s.length;c++){var l=s[c],u=l.source(),d=l.target();if(e.noIncomingEdges&&d===a&&u!==a||e.noOutgoingEdges&&u===a&&d!==a){o=!0;break}}o||r.push(a)}}return this.spawn(r,!0).filter(t)}},Lu=function(e){return function(t){for(var n=this,r=[],i=0;i<n.length;i++){var a=n[i];if(a.isNode())for(var o=a.connectedEdges(),s=0;s<o.length;s++){var c=o[s],l=c.source(),u=c.target();e.outgoing&&l===a?(r.push(c),r.push(u)):e.incoming&&u===a&&(r.push(c),r.push(l))}}return this.spawn(r,!0).filter(t)}},Ru=function(e){return function(t){for(var n=this,r=[],i={};;){var a=e.outgoing?n.outgoers():n.incomers();if(a.length===0)break;for(var o=!1,s=0;s<a.length;s++){var c=a[s],l=c.id();i[l]||(i[l]=!0,r.push(c),o=!0)}if(!o)break;n=a}return this.spawn(r,!0).filter(t)}};Fu.clearTraversalCache=function(){for(var e=0;e<this.length;e++)this[e]._private.traversalCache=null},X(Fu,{roots:Iu({noIncomingEdges:!0}),leaves:Iu({noOutgoingEdges:!0}),outgoers:sl(Lu({outgoing:!0}),`outgoers`),successors:Ru({outgoing:!0}),incomers:sl(Lu({incoming:!0}),`incomers`),predecessors:Ru({})}),X(Fu,{neighborhood:sl(function(e){for(var t=[],n=this.nodes(),r=0;r<n.length;r++)for(var i=n[r],a=i.connectedEdges(),o=0;o<a.length;o++){var s=a[o],c=s.source(),l=s.target(),u=i===c?l:c;u.length>0&&t.push(u[0]),t.push(s[0])}return this.spawn(t,!0).filter(e)},`neighborhood`),closedNeighborhood:function(e){return this.neighborhood().add(this).filter(e)},openNeighborhood:function(e){return this.neighborhood(e)}}),Fu.neighbourhood=Fu.neighborhood,Fu.closedNeighbourhood=Fu.closedNeighborhood,Fu.openNeighbourhood=Fu.openNeighborhood,X(Fu,{source:sl(function(e){var t=this[0],n;return t&&(n=t._private.source||t.cy().collection()),n&&e?n.filter(e):n},`source`),target:sl(function(e){var t=this[0],n;return t&&(n=t._private.target||t.cy().collection()),n&&e?n.filter(e):n},`target`),sources:zu({attr:`source`}),targets:zu({attr:`target`})});function zu(e){return function(t){for(var n=[],r=0;r<this.length;r++){var i=this[r]._private[e.attr];i&&n.push(i)}return this.spawn(n,!0).filter(t)}}X(Fu,{edgesWith:sl(Bu(),`edgesWith`),edgesTo:sl(Bu({thisIsSrc:!0}),`edgesTo`)});function Bu(e){return function(t){var n=[],r=this._private.cy,i=e||{};W(t)&&(t=r.$(t));for(var a=0;a<t.length;a++)for(var o=t[a]._private.edges,s=0;s<o.length;s++){var c=o[s],l=c._private.data,u=this.hasElementWithId(l.source)&&t.hasElementWithId(l.target),d=t.hasElementWithId(l.source)&&this.hasElementWithId(l.target);(u||d)&&((i.thisIsSrc||i.thisIsTgt)&&(i.thisIsSrc&&!u||i.thisIsTgt&&!d)||n.push(c))}return this.spawn(n,!0)}}X(Fu,{connectedEdges:sl(function(e){for(var t=[],n=this,r=0;r<n.length;r++){var i=n[r];if(i.isNode())for(var a=i._private.edges,o=0;o<a.length;o++){var s=a[o];t.push(s)}}return this.spawn(t,!0).filter(e)},`connectedEdges`),connectedNodes:sl(function(e){for(var t=[],n=this,r=0;r<n.length;r++){var i=n[r];i.isEdge()&&(t.push(i.source()[0]),t.push(i.target()[0]))}return this.spawn(t,!0).filter(e)},`connectedNodes`),parallelEdges:sl(Vu(),`parallelEdges`),codirectedEdges:sl(Vu({codirected:!0}),`codirectedEdges`)});function Vu(e){return e=X({},{codirected:!1},e),function(t){for(var n=[],r=this.edges(),i=e,a=0;a<r.length;a++)for(var o=r[a]._private,s=o.source,c=s._private.data.id,l=o.data.target,u=s._private.edges,d=0;d<u.length;d++){var f=u[d],p=f._private.data,m=p.target,h=p.source,g=m===l&&h===c,_=c===m&&l===h;(i.codirected&&g||!i.codirected&&(g||_))&&n.push(f)}return this.spawn(n,!0).filter(t)}}X(Fu,{components:function(e){var t=this,n=t.cy(),r=n.collection(),i=e==null?t.nodes():e.nodes(),a=[];e!=null&&i.empty()&&(i=e.sources());var o=function(e,t){r.merge(e),i.unmerge(e),t.merge(e)};if(i.empty())return t.spawn();var s=function(){var e=n.collection();a.push(e);var r=i[0];o(r,e),t.bfs({directed:!1,roots:r,visit:function(t){return o(t,e)}}),e.forEach(function(n){n.connectedEdges().forEach(function(n){t.has(n)&&e.has(n.source())&&e.has(n.target())&&e.merge(n)})})};do s();while(i.length>0);return a},component:function(){var e=this[0];return e.cy().mutableElements().components(e)[0]}}),Fu.componentsOf=Fu.components;var Hu=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0&&arguments[2],r=arguments.length>3&&arguments[3]!==void 0&&arguments[3];if(e===void 0){rn(`A collection must have a reference to the core`);return}var i=new yn,a=!1;if(!t)t=[];else if(t.length>0&&q(t[0])&&!ie(t[0])){a=!0;for(var o=[],s=new Sn,c=0,l=t.length;c<l;c++){var u=t[c];u.data??={};var d=u.data;if(d.id==null)d.id=un();else if(e.hasElementWithId(d.id)||s.has(d.id))continue;var f=new Cn(e,u,!1);o.push(f),s.add(d.id)}t=o}this.length=0;for(var p=0,m=t.length;p<m;p++){var h=t[p][0];if(h!=null){var g=h._private.data.id;(!n||!i.has(g))&&(n&&i.set(g,{index:this.length,ele:h}),this[this.length]=h,this.length++)}}this._private={eles:this,cy:e,get map(){return this.lazyMap??this.rebuildMap(),this.lazyMap},set map(e){this.lazyMap=e},rebuildMap:function(){for(var e=this.lazyMap=new yn,t=this.eles,n=0;n<t.length;n++){var r=t[n];e.set(r.id(),{index:n,ele:r})}}},n&&(this._private.map=i),a&&!r&&this.restore()},Uu=Cn.prototype=Hu.prototype=Object.create(Array.prototype);Uu.instanceString=function(){return`collection`},Uu.spawn=function(e,t){return new Hu(this.cy(),e,t)},Uu.spawnSelf=function(){return this.spawn(this)},Uu.cy=function(){return this._private.cy},Uu.renderer=function(){return this._private.cy.renderer()},Uu.element=function(){return this[0]},Uu.collection=function(){return ae(this)?this:new Hu(this._private.cy,[this])},Uu.unique=function(){return new Hu(this._private.cy,this,!0)},Uu.hasElementWithId=function(e){return e=``+e,this._private.map.has(e)},Uu.getElementById=function(e){e=``+e;var t=this._private.cy,n=this._private.map.get(e);return n?n.ele:new Hu(t)},Uu.$id=Uu.getElementById,Uu.poolIndex=function(){var e=this._private.cy._private.elements,t=this[0]._private.data.id;return e._private.map.get(t).index},Uu.indexOf=function(e){var t=e[0]._private.data.id;return this._private.map.get(t).index},Uu.indexOfId=function(e){return e=``+e,this._private.map.get(e).index},Uu.json=function(e){var t=this.element(),n=this.cy();if(t==null&&e)return this;if(t!=null){var r=t._private;if(q(e)){if(n.startBatch(),e.data){t.data(e.data);var i=r.data;if(t.isEdge()){var a=!1,o={},s=e.data.source,c=e.data.target;s!=null&&s!=i.source&&(o.source=``+s,a=!0),c!=null&&c!=i.target&&(o.target=``+c,a=!0),a&&(t=t.move(o))}else{var l=`parent`in e.data,u=e.data.parent;l&&(u!=null||i.parent!=null)&&u!=i.parent&&(u===void 0&&(u=null),u!=null&&(u=``+u),t=t.move({parent:u}))}}e.position&&t.position(e.position);var d=function(n,i,a){var o=e[n];o!=null&&o!==r[n]&&(o?t[i]():t[a]())};return d(`removed`,`remove`,`restore`),d(`selected`,`select`,`unselect`),d(`selectable`,`selectify`,`unselectify`),d(`locked`,`lock`,`unlock`),d(`grabbable`,`grabify`,`ungrabify`),d(`pannable`,`panify`,`unpanify`),e.classes!=null&&t.classes(e.classes),n.endBatch(),this}if(e===void 0){var f={data:cn(r.data),position:cn(r.position),group:r.group,removed:r.removed,selected:r.selected,selectable:r.selectable,locked:r.locked,grabbable:r.grabbable,pannable:r.pannable,classes:null};f.classes=``;var p=0;return r.classes.forEach(function(e){return f.classes+=p++===0?e:` `+e}),f}}},Uu.jsons=function(){for(var e=[],t=0;t<this.length;t++){var n=this[t].json();e.push(n)}return e},Uu.clone=function(){for(var e=this.cy(),t=[],n=0;n<this.length;n++){var r=new Cn(e,this[n].json(),!1);t.push(r)}return new Hu(e,t)},Uu.copy=Uu.clone,Uu.restore=function(){for(var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=this,r=n.cy(),i=r._private,a=[],o=[],s,c=0,l=n.length;c<l;c++){var u=n[c];t&&!u.removed()||(u.isNode()?a.push(u):o.push(u))}s=a.concat(o);var d,f=function(){s.splice(d,1),d--};for(d=0;d<s.length;d++){var p=s[d],m=p._private,h=m.data;if(p.clearTraversalCache(),!(!t&&!m.removed)){if(h.id===void 0)h.id=un();else if(Y(h.id))h.id=``+h.id;else if(le(h.id)||!W(h.id)){rn("Can not create element with invalid string ID `"+h.id+"`"),f();continue}else if(r.hasElementWithId(h.id)){rn("Can not create second element with ID `"+h.id+"`"),f();continue}}var g=h.id;if(p.isNode()){var _=m.position;_.x??=0,_.y??=0}if(p.isEdge()){for(var v=p,y=[`source`,`target`],b=y.length,x=!1,S=0;S<b;S++){var C=y[S],w=h[C];Y(w)&&(w=h[C]=``+h[C]),w==null||w===``?(rn("Can not create edge `"+g+"` with unspecified "+C),x=!0):r.hasElementWithId(w)||(rn("Can not create edge `"+g+"` with nonexistent "+C+" `"+w+"`"),x=!0)}if(x){f();continue}var T=r.getElementById(h.source),E=r.getElementById(h.target);T.same(E)?T._private.edges.push(v):(T._private.edges.push(v),E._private.edges.push(v)),v._private.source=T,v._private.target=E}m.map=new yn,m.map.set(g,{ele:p,index:0}),m.removed=!1,t&&r.addToPool(p)}for(var D=0;D<a.length;D++){var O=a[D],k=O._private.data;Y(k.parent)&&(k.parent=``+k.parent);var A=k.parent;if(A!=null||O._private.parent){var j=O._private.parent?r.collection().merge(O._private.parent):r.getElementById(A);if(j.empty())k.parent=void 0;else if(j[0].removed())on(`Node added with missing parent, reference to parent removed`),k.parent=void 0,O._private.parent=null;else{for(var M=!1,N=j;!N.empty();){if(O.same(N)){M=!0,k.parent=void 0;break}N=N.parent()}M||(j[0]._private.children.push(O),O._private.parent=j[0],i.hasCompoundNodes=!0)}}}if(s.length>0){for(var P=s.length===n.length?n:new Hu(r,s),F=0;F<P.length;F++){var I=P[F];I.isNode()||(I.parallelEdges().clearTraversalCache(),I.source().clearTraversalCache(),I.target().clearTraversalCache())}(i.hasCompoundNodes?r.collection().merge(P).merge(P.connectedNodes()).merge(P.parent()):P).dirtyCompoundBoundsCache().dirtyBoundingBoxCache().updateStyle(e),e?P.emitAndNotify(`add`):t&&P.emit(`add`)}return n},Uu.removed=function(){var e=this[0];return e&&e._private.removed},Uu.inside=function(){var e=this[0];return e&&!e._private.removed},Uu.remove=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=this,r=[],i={},a=n._private.cy;function o(e){for(var t=e._private.edges,n=0;n<t.length;n++)c(t[n])}function s(e){for(var t=e._private.children,n=0;n<t.length;n++)c(t[n])}function c(e){var n=i[e.id()];t&&e.removed()||n||(i[e.id()]=!0,e.isNode()?(r.push(e),o(e),s(e)):r.unshift(e))}for(var l=0,u=n.length;l<u;l++){var d=n[l];c(d)}function f(e,t){var n=e._private.edges;mn(n,t),e.clearTraversalCache()}function p(e){e.clearTraversalCache()}var m=[];m.ids={};function h(e,t){t=t[0],e=e[0];var n=e._private.children,r=e.id();mn(n,t),t._private.parent=null,m.ids[r]||(m.ids[r]=!0,m.push(e))}n.dirtyCompoundBoundsCache(),t&&a.removeFromPool(r);for(var g=0;g<r.length;g++){var _=r[g];if(_.isEdge()){var v=_.source()[0],y=_.target()[0];f(v,_),f(y,_);for(var b=_.parallelEdges(),x=0;x<b.length;x++){var S=b[x];p(S),S.isBundledBezier()&&S.dirtyBoundingBoxCache()}}else{var C=_.parent();C.length!==0&&h(C,_)}t&&(_._private.removed=!0)}var w=a._private.elements;a._private.hasCompoundNodes=!1;for(var T=0;T<w.length;T++)if(w[T].isParent()){a._private.hasCompoundNodes=!0;break}var E=new Hu(this.cy(),r);E.size()>0&&(e?E.emitAndNotify(`remove`):t&&E.emit(`remove`));for(var D=0;D<m.length;D++){var O=m[D];(!t||!O.removed())&&O.updateStyle()}return E},Uu.move=function(e){var t=this._private.cy,n=this,r=!1,i=!1,a=function(e){return e==null?e:``+e};if(e.source!==void 0||e.target!==void 0){var o=a(e.source),s=a(e.target),c=o!=null&&t.hasElementWithId(o),l=s!=null&&t.hasElementWithId(s);(c||l)&&(t.batch(function(){n.remove(r,i),n.emitAndNotify(`moveout`);for(var e=0;e<n.length;e++){var t=n[e],a=t._private.data;t.isEdge()&&(c&&(a.source=o),l&&(a.target=s))}n.restore(r,i)}),n.emitAndNotify(`move`))}else if(e.parent!==void 0){var u=a(e.parent);if(u===null||t.hasElementWithId(u)){var d=u===null?void 0:u;t.batch(function(){var e=n.remove(r,i);e.emitAndNotify(`moveout`);for(var t=0;t<n.length;t++){var a=n[t],o=a._private.data;a.isNode()&&(o.parent=d)}e.restore(r,i)}),n.emitAndNotify(`move`)}}return this},[wa,Ic,Lc,ol,cl,hl,gl,tu,_u,vu,bu,Su,wu,Ou,Mu,Fu].forEach(function(e){X(Uu,e)});var Wu={add:function(e){var t,n=this;if(re(e)){var r=e;if(r._private.cy===n)t=r.restore();else{for(var i=[],a=0;a<r.length;a++){var o=r[a];i.push(o.json())}t=new Hu(n,i)}}else if(K(e))t=new Hu(n,e);else if(q(e)&&(K(e.nodes)||K(e.edges))){for(var s=e,c=[],l=[`nodes`,`edges`],u=0,d=l.length;u<d;u++){var f=l[u],p=s[f];if(K(p))for(var m=0,h=p.length;m<h;m++){var g=X({group:f},p[m]);c.push(g)}}t=new Hu(n,c)}else t=new Cn(n,e).collection();return t},remove:function(e){if(!re(e)&&W(e)){var t=e;e=this.$(t)}return e.remove()}};function Gu(e,t,n,r){var i=11,a=1/(i-1),o=typeof Float32Array<`u`;if(arguments.length!==4)return!1;for(var s=0;s<4;++s)if(typeof arguments[s]!=`number`||isNaN(arguments[s])||!isFinite(arguments[s]))return!1;e=Math.min(e,1),n=Math.min(n,1),e=Math.max(e,0),n=Math.max(n,0);var c=o?new Float32Array(i):Array(i);function l(e,t){return 1-3*t+3*e}function u(e,t){return 3*t-6*e}function d(e){return 3*e}function f(e,t,n){return((l(t,n)*e+u(t,n))*e+d(t))*e}function p(e,t,n){return 3*l(t,n)*e*e+2*u(t,n)*e+d(t)}function m(t,r){for(var i=0;i<4;++i){var a=p(r,e,n);if(a===0)return r;var o=f(r,e,n)-t;r-=o/a}return r}function h(){for(var t=0;t<i;++t)c[t]=f(t*a,e,n)}function g(t,r,i){var a,o,s=0;do o=r+(i-r)/2,a=f(o,e,n)-t,a>0?i=o:r=o;while(Math.abs(a)>1e-7&&++s<10);return o}function _(t){for(var r=0,o=1,s=i-1;o!==s&&c[o]<=t;++o)r+=a;--o;var l=(t-c[o])/(c[o+1]-c[o]),u=r+l*a,d=p(u,e,n);return d>=.001?m(t,u):d===0?u:g(t,r,r+a)}var v=!1;function y(){v=!0,(e!==t||n!==r)&&h()}var b=function(i){return v||y(),e===t&&n===r?i:i===0?0:i===1?1:f(_(i),t,r)};b.getControlPoints=function(){return[{x:e,y:t},{x:n,y:r}]};var x=`generateBezier(`+[e,t,n,r]+`)`;return b.toString=function(){return x},b}var Ku=function(){function e(e){return-e.tension*e.x-e.friction*e.v}function t(t,n,r){var i={x:t.x+r.dx*n,v:t.v+r.dv*n,tension:t.tension,friction:t.friction};return{dx:i.v,dv:e(i)}}function n(n,r){var i={dx:n.v,dv:e(n)},a=t(n,r*.5,i),o=t(n,r*.5,a),s=t(n,r,o),c=1/6*(i.dx+2*(a.dx+o.dx)+s.dx),l=1/6*(i.dv+2*(a.dv+o.dv)+s.dv);return n.x+=c*r,n.v+=l*r,n}return function e(t,r,i){var a={x:-1,v:0,tension:null,friction:null},o=[0],s=0,c=1/1e4,l=16/1e3,u,d,f;for(t=parseFloat(t)||500,r=parseFloat(r)||20,i||=null,a.tension=t,a.friction=r,u=i!==null,u?(s=e(t,r),d=s/i*l):d=l;f=n(f||a,d),o.push(1+f.x),s+=16,Math.abs(f.x)>c&&Math.abs(f.v)>c;);return u?function(e){return o[e*(o.length-1)|0]}:s}}(),qu=function(e,t,n,r){var i=Gu(e,t,n,r);return function(e,t,n){return e+(t-e)*i(n)}},Ju={linear:function(e,t,n){return e+(t-e)*n},ease:qu(.25,.1,.25,1),"ease-in":qu(.42,0,1,1),"ease-out":qu(0,0,.58,1),"ease-in-out":qu(.42,0,.58,1),"ease-in-sine":qu(.47,0,.745,.715),"ease-out-sine":qu(.39,.575,.565,1),"ease-in-out-sine":qu(.445,.05,.55,.95),"ease-in-quad":qu(.55,.085,.68,.53),"ease-out-quad":qu(.25,.46,.45,.94),"ease-in-out-quad":qu(.455,.03,.515,.955),"ease-in-cubic":qu(.55,.055,.675,.19),"ease-out-cubic":qu(.215,.61,.355,1),"ease-in-out-cubic":qu(.645,.045,.355,1),"ease-in-quart":qu(.895,.03,.685,.22),"ease-out-quart":qu(.165,.84,.44,1),"ease-in-out-quart":qu(.77,0,.175,1),"ease-in-quint":qu(.755,.05,.855,.06),"ease-out-quint":qu(.23,1,.32,1),"ease-in-out-quint":qu(.86,0,.07,1),"ease-in-expo":qu(.95,.05,.795,.035),"ease-out-expo":qu(.19,1,.22,1),"ease-in-out-expo":qu(1,0,0,1),"ease-in-circ":qu(.6,.04,.98,.335),"ease-out-circ":qu(.075,.82,.165,1),"ease-in-out-circ":qu(.785,.135,.15,.86),spring:function(e,t,n){if(n===0)return Ju.linear;var r=Ku(e,t,n);return function(e,t,n){return e+(t-e)*r(n)}},"cubic-bezier":qu};function Yu(e,t,n,r,i){if(r===1||t===n)return n;var a=i(t,n,r);return e==null?a:((e.roundValue||e.color)&&(a=Math.round(a)),e.min!==void 0&&(a=Math.max(a,e.min)),e.max!==void 0&&(a=Math.min(a,e.max)),a)}function Xu(e,t){return e.pfValue!=null||e.value!=null?e.pfValue!=null&&(t==null||t.type.units!==`%`)?e.pfValue:e.value:e}function Zu(e,t,n,r,i){var a=i==null?null:i.type;n<0?n=0:n>1&&(n=1);var o=Xu(e,i),s=Xu(t,i);if(Y(o)&&Y(s))return Yu(a,o,s,n,r);if(K(o)&&K(s)){for(var c=[],l=0;l<s.length;l++){var u=o[l],d=s[l];if(u!=null&&d!=null){var f=Yu(a,u,d,n,r);c.push(f)}else c.push(d)}return c}}function Qu(e,t,n,r){var i=!r,a=e._private,o=t._private,s=o.easing,c=o.startTime,l=(r?e:e.cy()).style();if(!o.easingImpl){if(s==null)o.easingImpl=Ju.linear;else{var u=W(s)?l.parse(`transition-timing-function`,s).value:s,d,f;W(u)?(d=u,f=[]):(d=u[1],f=u.slice(2).map(function(e){return+e})),f.length>0?(d===`spring`&&f.push(o.duration),o.easingImpl=Ju[d].apply(null,f)):o.easingImpl=Ju[d]}}var p=o.easingImpl,m=o.duration===0?1:(n-c)/o.duration;if(o.applying&&(m=o.progress),m<0?m=0:m>1&&(m=1),o.delay==null){var h=o.startPosition,g=o.position;if(g&&i&&!e.locked()){var _={};$u(h.x,g.x)&&(_.x=Zu(h.x,g.x,m,p)),$u(h.y,g.y)&&(_.y=Zu(h.y,g.y,m,p)),e.position(_)}var v=o.startPan,y=o.pan,b=a.pan,x=y!=null&&r;x&&($u(v.x,y.x)&&(b.x=Zu(v.x,y.x,m,p)),$u(v.y,y.y)&&(b.y=Zu(v.y,y.y,m,p)),e.emit(`pan`));var S=o.startZoom,C=o.zoom,w=C!=null&&r;w&&($u(S,C)&&(a.zoom=pr(a.minZoom,Zu(S,C,m,p),a.maxZoom)),e.emit(`zoom`)),(x||w)&&e.emit(`viewport`);var T=o.style;if(T&&T.length>0&&i){for(var E=0;E<T.length;E++){var D=T[E],O=D.name,k=D,A=o.startStyle[O],j=l.properties[A.name],M=Zu(A,k,m,p,j);l.overrideBypass(e,O,M)}e.emit(`style`)}}return o.progress=m,m}function $u(e,t){return e==null||t==null?!1:Y(e)&&Y(t)?!0:!!(e&&t)}function ed(e,t,n,r){var i=t._private;i.started=!0,i.startTime=n-i.progress*i.duration}function td(e,t){var n=t._private.aniEles,r=[];function i(t,n){var i=t._private,a=i.animation.current,o=i.animation.queue,s=!1;if(a.length===0){var c=o.shift();c&&a.push(c)}for(var l=function(e){for(var t=e.length-1;t>=0;t--){var n=e[t];n()}e.splice(0,e.length)},u=a.length-1;u>=0;u--){var d=a[u],f=d._private;if(f.stopped){a.splice(u,1),f.hooked=!1,f.playing=!1,f.started=!1,l(f.frames);continue}!f.playing&&!f.applying||(f.playing&&f.applying&&(f.applying=!1),f.started||ed(t,d,e),Qu(t,d,e,n),f.applying&&=!1,l(f.frames),f.step!=null&&f.step(e),d.completed()&&(a.splice(u,1),f.hooked=!1,f.playing=!1,f.started=!1,l(f.completes)),s=!0)}return!n&&a.length===0&&o.length===0&&r.push(t),s}for(var a=!1,o=0;o<n.length;o++){var s=n[o],c=i(s);a||=c}var l=i(t,!0);(a||l)&&(n.length>0?t.notify(`draw`,n):t.notify(`draw`)),n.unmerge(r),t.emit(`step`)}var nd={animate:Fc.animate(),animation:Fc.animation(),animated:Fc.animated(),clearQueue:Fc.clearQueue(),delay:Fc.delay(),delayAnimation:Fc.delayAnimation(),stop:Fc.stop(),addToAnimationPool:function(e){var t=this;t.styleEnabled()&&t._private.aniEles.merge(e)},stopAnimationLoop:function(){this._private.animationsRunning=!1},startAnimationLoop:function(){var e=this;if(e._private.animationsRunning=!0,!e.styleEnabled())return;function t(){e._private.animationsRunning&&jt(function(n){td(n,e),t()})}var n=e.renderer();n&&n.beforeRender?n.beforeRender(function(t,n){td(n,e)},n.beforeRenderPriorities.animations):t()}},rd={qualifierCompare:function(e,t){return e==null||t==null?e==null&&t==null:e.sameText(t)},eventMatches:function(e,t,n){var r=t.qualifier;return r==null||e!==n.target&&ie(n.target)&&r.matches(n.target)},addEventFields:function(e,t){t.cy=e,t.target=e},callbackContext:function(e,t,n){return t.qualifier==null?e:n.target}},id=function(e){return W(e)?new il(e):e},ad={createEmitter:function(){var e=this._private;return e.emitter||=new uu(rd,this),this},emitter:function(){return this._private.emitter},on:function(e,t,n){return this.emitter().on(e,id(t),n),this},removeListener:function(e,t,n){return this.emitter().removeListener(e,id(t),n),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},one:function(e,t,n){return this.emitter().one(e,id(t),n),this},once:function(e,t,n){return this.emitter().one(e,id(t),n),this},emit:function(e,t){return this.emitter().emit(e,t),this},emitAndNotify:function(e,t){return this.emit(e),this.notify(e,t),this}};Fc.eventAliasesOn(ad);var od={png:function(e){var t=this._private.renderer;return e||={},t.png(e)},jpg:function(e){var t=this._private.renderer;return e||={},e.bg=e.bg||`#fff`,t.jpg(e)}};od.jpeg=od.jpg;var sd={layout:function(e){var t=this;if(e==null){rn(`Layout options must be specified to make a layout`);return}if(e.name==null){rn("A `name` must be specified to make a layout");return}var n=e.name,r=t.extension(`layout`,n);if(r==null){rn("No such layout `"+n+"` found. Did you forget to import it and `cytoscape.use()` it?");return}return new r(X({},e,{cy:t,eles:W(e.eles)?t.$(e.eles):e.eles==null?t.$():e.eles}))}};sd.createLayout=sd.makeLayout=sd.layout;var cd={notify:function(e,t){var n=this._private;if(this.batching()){n.batchNotifications=n.batchNotifications||{};var r=n.batchNotifications[e]=n.batchNotifications[e]||this.collection();t!=null&&r.merge(t);return}if(n.notificationsEnabled){var i=this.renderer();this.destroyed()||!i||i.notify(e,t)}},notifications:function(e){var t=this._private;return e===void 0?t.notificationsEnabled:(t.notificationsEnabled=!!e,this)},noNotifications:function(e){this.notifications(!1),e(),this.notifications(!0)},batching:function(){return this._private.batchCount>0},startBatch:function(){var e=this._private;return e.batchCount??=0,e.batchCount===0&&(e.batchStyleEles=this.collection(),e.batchNotifications={}),e.batchCount++,this},endBatch:function(){var e=this._private;if(e.batchCount===0)return this;if(e.batchCount--,e.batchCount===0){e.batchStyleEles.updateStyle();var t=this.renderer();Object.keys(e.batchNotifications).forEach(function(n){var r=e.batchNotifications[n];r.empty()?t.notify(n):t.notify(n,r)})}return this},batch:function(e){return this.startBatch(),e(),this.endBatch(),this},batchData:function(e){var t=this;return this.batch(function(){for(var n=Object.keys(e),r=0;r<n.length;r++){var i=n[r],a=e[i];t.getElementById(i).data(a)}})}},ld=pn({hideEdgesOnViewport:!1,textureOnViewport:!1,motionBlur:!1,motionBlurOpacity:.05,pixelRatio:void 0,desktopTapThreshold:4,touchTapThreshold:8,wheelSensitivity:1,debug:!1,showFps:!1,webgl:!1,webglDebug:!1,webglDebugShowAtlases:!1,webglTexSize:2048,webglTexRows:36,webglTexRowsNodes:18,webglBatchSize:2048,webglTexPerBatch:14,webglBgColor:[255,255,255]}),ud={renderTo:function(e,t,n,r){return this._private.renderer.renderTo(e,t,n,r),this},renderer:function(){return this._private.renderer},forceRender:function(){return this.notify(`draw`),this},resize:function(){return this.invalidateSize(),this.emitAndNotify(`resize`),this},initRenderer:function(e){var t=this,n=t.extension(`renderer`,e.name);if(n==null){rn(`Can not initialise: No such renderer \`${e.name}\` found. Did you forget to import it and \`cytoscape.use()\` it?`);return}e.wheelSensitivity!==void 0&&on(`You have set a custom wheel sensitivity. This will make your app zoom unnaturally when using mainstream mice. You should change this value from the default only if you can guarantee that all your users will use the same hardware and OS configuration as your current machine.`);var r=ld(e);r.cy=t,t._private.renderer=new n(r),this.notify(`init`)},destroyRenderer:function(){var e=this;e.notify(`destroy`);var t=e.container();if(t)for(t._cyreg=null;t.childNodes.length>0;)t.removeChild(t.childNodes[0]);e._private.renderer=null,e.mutableElements().forEach(function(e){var t=e._private;t.rscratch={},t.rstyle={},t.animation.current=[],t.animation.queue=[]})},onRender:function(e){return this.on(`render`,e)},offRender:function(e){return this.off(`render`,e)}};ud.invalidateDimensions=ud.resize;var dd={collection:function(e,t){return W(e)?this.$(e):re(e)?e.collection():K(e)?(t||={},new Hu(this,e,t.unique,t.removed)):new Hu(this)},nodes:function(e){var t=this.$(function(e){return e.isNode()});return e?t.filter(e):t},edges:function(e){var t=this.$(function(e){return e.isEdge()});return e?t.filter(e):t},$:function(e){var t=this._private.elements;return e?t.filter(e):t.spawnSelf()},mutableElements:function(){return this._private.elements}};dd.elements=dd.filter=dd.$;var fd={},pd=`t`,md=`f`;fd.apply=function(e){for(var t=this,n=t._private.cy.collection(),r=0;r<e.length;r++){var i=e[r],a=t.getContextMeta(i);if(!a.empty){var o=t.getContextStyle(a),s=t.applyContextStyle(a,o,i);i._private.appliedInitStyle?t.updateTransitions(i,s.diffProps):i._private.appliedInitStyle=!0,t.updateStyleHints(i)&&n.push(i)}}return n},fd.getPropertiesDiff=function(e,t){var n=this,r=n._private.propDiffs=n._private.propDiffs||{},i=e+`-`+t,a=r[i];if(a)return a;for(var o=[],s={},c=0;c<n.length;c++){var l=n[c],u=e[c]===pd,d=t[c]===pd,f=u!==d,p=l.mappedProperties.length>0;if(f||d&&p){var m=void 0;f&&p||f?m=l.properties:p&&(m=l.mappedProperties);for(var h=0;h<m.length;h++){for(var g=m[h],_=g.name,v=!1,y=c+1;y<n.length;y++){var b=n[y];if(t[y]===pd&&(v=b.properties[g.name]!=null,v))break}!s[_]&&!v&&(s[_]=!0,o.push(_))}}}return r[i]=o,o},fd.getContextMeta=function(e){for(var t=this,n=``,r,i=e._private.styleCxtKey||``,a=0;a<t.length;a++){var o=t[a];o.selector&&o.selector.matches(e)?n+=pd:n+=md}return r=t.getPropertiesDiff(i,n),e._private.styleCxtKey=n,{key:n,diffPropNames:r,empty:r.length===0}},fd.getContextStyle=function(e){var t=e.key,n=this,r=this._private.contextStyles=this._private.contextStyles||{};if(r[t])return r[t];for(var i={_private:{key:t}},a=0;a<n.length;a++){var o=n[a];if(t[a]===pd)for(var s=0;s<o.properties.length;s++){var c=o.properties[s];i[c.name]=c}}return r[t]=i,i},fd.applyContextStyle=function(e,t,n){for(var r=this,i=e.diffPropNames,a={},o=r.types,s=0;s<i.length;s++){var c=i[s],l=t[c],u=n.pstyle(c);if(!l){if(u)l=u.bypass?{name:c,deleteBypassed:!0}:{name:c,delete:!0};else continue}if(u!==l){if(l.mapped===o.fn&&u!=null&&u.mapping!=null&&u.mapping.value===l.value){var d=u.mapping;if((d.fnValue=l.value(n))===d.prevFnValue)continue}var f=a[c]={prev:u};r.applyParsedProperty(n,l),f.next=n.pstyle(c),f.next&&f.next.bypass&&(f.next=f.next.bypassed)}}return{diffProps:a}},fd.updateStyleHints=function(e){var t=e._private,n=this,r=n.propertyGroupNames,i=n.propertyGroupKeys,a=function(e,t,r){return n.getPropertiesHash(e,t,r)},o=t.styleKey;if(e.removed())return!1;var s=t.group===`nodes`,c=e._private.style;r=Object.keys(c);for(var l=0;l<i.length;l++){var u=i[l];t.styleKeys[u]=[Nt,Ft]}for(var d=function(e,n){return t.styleKeys[n][0]=Lt(e,t.styleKeys[n][0])},f=function(e,n){return t.styleKeys[n][1]=Rt(e,t.styleKeys[n][1])},p=function(e,t){d(e,t),f(e,t)},m=function(e,t){for(var n=0;n<e.length;n++){var r=e.charCodeAt(n);d(r,t),f(r,t)}},h=2e9,g=function(e){return-128<e&&e<128&&Math.floor(e)!==e?h-(e*1024|0):e},_=0;_<r.length;_++){var v=r[_],y=c[v];if(y!=null){var b=this.properties[v],x=b.type,S=b.groupKey,C=void 0;b.hashOverride==null?y.pfValue!=null&&(C=y.pfValue):C=b.hashOverride(e,y);var w=b.enums==null?y.value:null,T=C!=null,E=T||w!=null,D=y.units;x.number&&E&&!x.multiple?(p(g(T?C:w),S),!T&&D!=null&&m(D,S)):m(y.strValue,S)}}for(var O=[Nt,Ft],k=0;k<i.length;k++){var A=i[k],j=t.styleKeys[A];O[0]=Lt(j[0],O[0]),O[1]=Rt(j[1],O[1])}t.styleKey=zt(O[0],O[1]);var M=t.styleKeys;t.labelDimsKey=Bt(M.labelDimensions);var N=a(e,[`label`],M.labelDimensions);if(t.labelKey=Bt(N),t.labelStyleKey=Bt(Vt(M.commonLabel,N)),!s){var P=a(e,[`source-label`],M.labelDimensions);t.sourceLabelKey=Bt(P),t.sourceLabelStyleKey=Bt(Vt(M.commonLabel,P));var F=a(e,[`target-label`],M.labelDimensions);t.targetLabelKey=Bt(F),t.targetLabelStyleKey=Bt(Vt(M.commonLabel,F))}if(s){var I=t.styleKeys,L=I.nodeBody,R=I.nodeBorder,ee=I.nodeOutline,z=I.backgroundImage,B=I.compound,V=I.pie,H=I.stripe;t.nodeKey=Bt([L,R,ee,z,B,V,H].filter(function(e){return e!=null}).reduce(Vt,[Nt,Ft])),t.hasPie=V!=null&&V[0]!==Nt&&V[1]!==Ft,t.hasStripe=H!=null&&H[0]!==Nt&&H[1]!==Ft}return o!==t.styleKey},fd.clearStyleHints=function(e){var t=e._private;t.styleCxtKey=``,t.styleKeys={},t.styleKey=null,t.labelKey=null,t.labelStyleKey=null,t.sourceLabelKey=null,t.sourceLabelStyleKey=null,t.targetLabelKey=null,t.targetLabelStyleKey=null,t.nodeKey=null,t.hasPie=null,t.hasStripe=null},fd.applyParsedProperty=function(e,t){var n=this,r=t,i=e._private.style,a,o=n.types,s=n.properties[r.name].type,c=r.bypass,l=i[r.name],u=l&&l.bypass,d=e._private,f=`mapping`,p=function(e){return e==null?null:e.pfValue==null?e.value:e.pfValue},m=function(){var t=p(l),i=p(r);n.checkTriggers(e,r.name,t,i)};if(t.name===`curve-style`&&e.isEdge()&&(t.value!==`bezier`&&e.isLoop()||t.value===`haystack`&&(e.source().isParent()||e.target().isParent()))&&(r=t=this.parse(t.name,`bezier`,c)),r.delete)return i[r.name]=void 0,m(),!0;if(r.deleteBypassed)return l?l.bypass?(l.bypassed=void 0,m(),!0):!1:(m(),!0);if(r.deleteBypass)return l?l.bypass?(i[r.name]=l.bypassed,m(),!0):!1:(m(),!0);var h=function(){on("Do not assign mappings to elements without corresponding data (i.e. ele `"+e.id()+"` has no mapping for property `"+r.name+"` with data field `"+r.field+"`); try a `["+r.field+"]` selector to limit scope to elements with `"+r.field+"` defined")};switch(r.mapped){case o.mapData:for(var g=r.field.split(`.`),_=d.data,v=0;v<g.length&&_;v++){var y=g[v];_=_[y]}if(_==null)return h(),!1;var b;if(Y(_)){var x=r.fieldMax-r.fieldMin;b=x===0?0:(_-r.fieldMin)/x}else return on("Do not use continuous mappers without specifying numeric data (i.e. `"+r.field+`: `+_+"` for `"+e.id()+"` is non-numeric)"),!1;if(b<0?b=0:b>1&&(b=1),s.color){var S=r.valueMin[0],C=r.valueMax[0],w=r.valueMin[1],T=r.valueMax[1],E=r.valueMin[2],D=r.valueMax[2],O=r.valueMin[3]==null?1:r.valueMin[3],k=r.valueMax[3]==null?1:r.valueMax[3],A=[Math.round(S+(C-S)*b),Math.round(w+(T-w)*b),Math.round(E+(D-E)*b),Math.round(O+(k-O)*b)];a={bypass:r.bypass,name:r.name,value:A,strValue:`rgb(`+A[0]+`, `+A[1]+`, `+A[2]+`)`}}else if(s.number){var j=r.valueMin+(r.valueMax-r.valueMin)*b;a=this.parse(r.name,j,r.bypass,f)}else return!1;if(!a)return h(),!1;a.mapping=r,r=a;break;case o.data:for(var M=r.field.split(`.`),N=d.data,P=0;P<M.length&&N;P++){var F=M[P];N=N[F]}if(N!=null&&(a=this.parse(r.name,N,r.bypass,f)),!a)return h(),!1;a.mapping=r,r=a;break;case o.fn:var I=r.value,L=r.fnValue==null?I(e):r.fnValue;if(r.prevFnValue=L,L==null)return on("Custom function mappers may not return null (i.e. `"+r.name+"` for ele `"+e.id()+"` is null)"),!1;if(a=this.parse(r.name,L,r.bypass,f),!a)return on("Custom function mappers may not return invalid values for the property type (i.e. `"+r.name+"` for ele `"+e.id()+"` is invalid)"),!1;a.mapping=cn(r),r=a;break;case void 0:break;default:return!1}return c?(u?r.bypassed=l.bypassed:r.bypassed=l,i[r.name]=r):u?l.bypassed=r:i[r.name]=r,m(),!0},fd.cleanElements=function(e,t){for(var n=0;n<e.length;n++){var r=e[n];if(this.clearStyleHints(r),r.dirtyCompoundBoundsCache(),r.dirtyBoundingBoxCache(),!t)r._private.style={};else for(var i=r._private.style,a=Object.keys(i),o=0;o<a.length;o++){var s=a[o],c=i[s];c!=null&&(c.bypass?c.bypassed=null:i[s]=null)}}},fd.update=function(){this._private.cy.mutableElements().updateStyle()},fd.updateTransitions=function(e,t){var n=this,r=e._private,i=e.pstyle(`transition-property`).value,a=e.pstyle(`transition-duration`).pfValue,o=e.pstyle(`transition-delay`).pfValue;if(i.length>0&&a>0){for(var s={},c=!1,l=0;l<i.length;l++){var u=i[l],d=e.pstyle(u),f=t[u];if(f){var p=f.prev,m=f.next==null?d:f.next,h=!1,g=void 0,_=1e-6;p&&(Y(p.pfValue)&&Y(m.pfValue)?(h=m.pfValue-p.pfValue,g=p.pfValue+_*h):Y(p.value)&&Y(m.value)?(h=m.value-p.value,g=p.value+_*h):K(p.value)&&K(m.value)&&(h=p.value[0]!==m.value[0]||p.value[1]!==m.value[1]||p.value[2]!==m.value[2],g=p.strValue),h&&(s[u]=m.strValue,this.applyBypass(e,u,g),c=!0))}}if(!c)return;r.transitioning=!0,new Pa(function(t){o>0?e.delayAnimation(o).play().promise().then(t):t()}).then(function(){return e.animation({style:s,duration:a,easing:e.pstyle(`transition-timing-function`).value,queue:!1}).play().promise()}).then(function(){n.removeBypasses(e,i),e.emitAndNotify(`style`),r.transitioning=!1})}else r.transitioning&&=(this.removeBypasses(e,i),e.emitAndNotify(`style`),!1)},fd.checkTrigger=function(e,t,n,r,i,a){var o=this.properties[t],s=i(o);e.removed()||s!=null&&s(n,r,e)&&a(o)},fd.checkZOrderTrigger=function(e,t,n,r){var i=this;this.checkTrigger(e,t,n,r,function(e){return e.triggersZOrder},function(){i._private.cy.notify(`zorder`,e)})},fd.checkBoundsTrigger=function(e,t,n,r){this.checkTrigger(e,t,n,r,function(e){return e.triggersBounds},function(t){e.dirtyCompoundBoundsCache(),e.dirtyBoundingBoxCache()})},fd.checkConnectedEdgesBoundsTrigger=function(e,t,n,r){this.checkTrigger(e,t,n,r,function(e){return e.triggersBoundsOfConnectedEdges},function(t){e.connectedEdges().forEach(function(e){e.dirtyBoundingBoxCache()})})},fd.checkParallelEdgesBoundsTrigger=function(e,t,n,r){this.checkTrigger(e,t,n,r,function(e){return e.triggersBoundsOfParallelEdges},function(t){e.parallelEdges().forEach(function(e){e.dirtyBoundingBoxCache()})})},fd.checkTriggers=function(e,t,n,r){e.dirtyStyleCache(),this.checkZOrderTrigger(e,t,n,r),this.checkBoundsTrigger(e,t,n,r),this.checkConnectedEdgesBoundsTrigger(e,t,n,r),this.checkParallelEdgesBoundsTrigger(e,t,n,r)};var hd={};hd.applyBypass=function(e,t,n,r){var i=this,a=[],o=!0;if(t===`*`||t===`**`){if(n!==void 0)for(var s=0;s<i.properties.length;s++){var c=i.properties[s].name,l=this.parse(c,n,!0);l&&a.push(l)}}else if(W(t)){var u=this.parse(t,n,!0);u&&a.push(u)}else if(q(t)){var d=t;r=n;for(var f=Object.keys(d),p=0;p<f.length;p++){var m=f[p],h=d[m];if(h===void 0&&(h=d[ge(m)]),h!==void 0){var g=this.parse(m,h,!0);g&&a.push(g)}}}else return!1;if(a.length===0)return!1;for(var _=!1,v=0;v<e.length;v++){for(var y=e[v],b={},x=void 0,S=0;S<a.length;S++){var C=a[S];if(r){var w=y.pstyle(C.name);x=b[C.name]={prev:w}}_=this.applyParsedProperty(y,cn(C))||_,r&&(x.next=y.pstyle(C.name))}_&&this.updateStyleHints(y),r&&this.updateTransitions(y,b,o)}return _},hd.overrideBypass=function(e,t,n){t=he(t);for(var r=0;r<e.length;r++){var i=e[r],a=i._private.style[t],o=this.properties[t].type,s=o.color,c=o.mutiple,l=a?a.pfValue==null?a.value:a.pfValue:null;!a||!a.bypass?this.applyBypass(i,t,n):(a.value=n,a.pfValue!=null&&(a.pfValue=n),a.strValue=s?`rgb(`+n.join(`,`)+`)`:c?n.join(` `):``+n,this.updateStyleHints(i)),this.checkTriggers(i,t,l,n)}},hd.removeAllBypasses=function(e,t){return this.removeBypasses(e,this.propertyNames,t)},hd.removeBypasses=function(e,t,n){for(var r=!0,i=0;i<e.length;i++){for(var a=e[i],o={},s=0;s<t.length;s++){var c=t[s],l=this.properties[c],u=a.pstyle(l.name);if(!(!u||!u.bypass)){var d=this.parse(c,``,!0),f=o[l.name]={prev:u};this.applyParsedProperty(a,d),f.next=a.pstyle(l.name)}}this.updateStyleHints(a),n&&this.updateTransitions(a,o,r)}};var gd={};gd.getEmSizeInPixels=function(){var e=this.containerCss(`font-size`);return e==null?1:parseFloat(e)},gd.containerCss=function(e){var t=this._private.cy,n=t.container(),r=t.window();if(r&&n&&r.getComputedStyle)return r.getComputedStyle(n).getPropertyValue(e)};var _d={};_d.getRenderedStyle=function(e,t){return t?this.getStylePropertyValue(e,t,!0):this.getRawStyle(e,!0)},_d.getRawStyle=function(e,t){var n=this;if(e=e[0],e){for(var r={},i=0;i<n.properties.length;i++){var a=n.properties[i],o=n.getStylePropertyValue(e,a.name,t);o!=null&&(r[a.name]=o,r[ge(a.name)]=o)}return r}},_d.getIndexedStyle=function(e,t,n,r){return e.pstyle(t)[n][r]??e.cy().style().getDefaultProperty(t)[n][0]},_d.getStylePropertyValue=function(e,t,n){var r=this;if(e=e[0],e){var i=r.properties[t];i.alias&&(i=i.pointsTo);var a=i.type,o=e.pstyle(i.name);if(o){var s=o.value,c=o.units,l=o.strValue;if(n&&a.number&&s!=null&&Y(s)){var u=e.cy().zoom(),d=function(e){return e*u},f=function(e,t){return d(e)+t},p=K(s);return(p?c.every(function(e){return e!=null}):c!=null)?p?s.map(function(e,t){return f(e,c[t])}).join(` `):f(s,c):p?s.map(function(e){return W(e)?e:``+d(e)}).join(` `):``+d(s)}if(l!=null)return l}return null}},_d.getAnimationStartStyle=function(e,t){for(var n={},r=0;r<t.length;r++){var i=t[r].name,a=e.pstyle(i);a!==void 0&&(a=q(a)?this.parse(i,a.strValue):this.parse(i,a)),a&&(n[i]=a)}return n},_d.getPropsList=function(e){var t=this,n=[],r=e,i=t.properties;if(r)for(var a=Object.keys(r),o=0;o<a.length;o++){var s=a[o],c=r[s],l=i[s]||i[he(s)],u=this.parse(l.name,c);u&&n.push(u)}return n},_d.getNonDefaultPropertiesHash=function(e,t,n){var r=n.slice(),i,a,o,s,c,l;for(c=0;c<t.length;c++)if(i=t[c],a=e.pstyle(i,!1),a!=null){if(a.pfValue!=null)r[0]=Lt(s,r[0]),r[1]=Rt(s,r[1]);else for(o=a.strValue,l=0;l<o.length;l++)s=o.charCodeAt(l),r[0]=Lt(s,r[0]),r[1]=Rt(s,r[1])}return r},_d.getPropertiesHash=_d.getNonDefaultPropertiesHash;var vd={};vd.appendFromJson=function(e){for(var t=this,n=0;n<e.length;n++){var r=e[n],i=r.selector,a=r.style||r.css,o=Object.keys(a);t.selector(i);for(var s=0;s<o.length;s++){var c=o[s],l=a[c];t.css(c,l)}}return t},vd.fromJson=function(e){var t=this;return t.resetToDefault(),t.appendFromJson(e),t},vd.json=function(){for(var e=[],t=this.defaultLength;t<this.length;t++){for(var n=this[t],r=n.selector,i=n.properties,a={},o=0;o<i.length;o++){var s=i[o];a[s.name]=s.strValue}e.push({selector:r?r.toString():`core`,style:a})}return e};var yd={};yd.appendFromString=function(e){var t=this,n=this,r=``+e,i,a,o;r=r.replace(/[/][*](\s|.)+?[*][/]/g,``);function s(){r=r.length>i.length?r.substr(i.length):``}function c(){a=a.length>o.length?a.substr(o.length):``}for(;!r.match(/^\s*$/);){var l=r.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!l){on(`Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: `+r);break}i=l[0];var u=l[1];if(u!==`core`&&new il(u).invalid){on(`Skipping parsing of block: Invalid selector found in string stylesheet: `+u),s();continue}var d=l[2],f=!1;a=d;for(var p=[];!a.match(/^\s*$/);){var m=a.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);if(!m){on(`Skipping parsing of block: Invalid formatting of style property and value definitions found in:`+d),f=!0;break}o=m[0];var h=m[1],g=m[2];if(!t.properties[h]){on(`Skipping property: Invalid property name in: `+o),c();continue}if(!n.parse(h,g)){on(`Skipping property: Invalid property definition in: `+o),c();continue}p.push({name:h,val:g}),c()}if(f){s();break}n.selector(u);for(var _=0;_<p.length;_++){var v=p[_];n.css(v.name,v.val)}s()}return n},yd.fromString=function(e){var t=this;return t.resetToDefault(),t.appendFromString(e),t};var Q={};(function(){var e=be,t=Se,n=we,r=Te,i=Ee,a=function(e){return`^`+e+`\\s*\\(\\s*([\\w\\.]+)\\s*\\)$`},o=function(a){var o=e+`|\\w+|`+t+`|`+n+`|`+r+`|`+i;return`^`+a+`\\s*\\(([\\w\\.]+)\\s*\\,\\s*(`+e+`)\\s*\\,\\s*(`+e+`)\\s*,\\s*(`+o+`)\\s*\\,\\s*(`+o+`)\\)$`},s=[`^url\\s*\\(\\s*['"]?(.+?)['"]?\\s*\\)$`,`^(none)$`,`^(.+)$`];Q.types={time:{number:!0,min:0,units:`s|ms`,implicitUnits:`ms`},percent:{number:!0,min:0,max:100,units:`%`,implicitUnits:`%`},percentages:{number:!0,min:0,max:100,units:`%`,implicitUnits:`%`,multiple:!0},zeroOneNumber:{number:!0,min:0,max:1,unitless:!0},zeroOneNumbers:{number:!0,min:0,max:1,unitless:!0,multiple:!0},nOneOneNumber:{number:!0,min:-1,max:1,unitless:!0},nonNegativeInt:{number:!0,min:0,integer:!0,unitless:!0},nonNegativeNumber:{number:!0,min:0,unitless:!0},position:{enums:[`parent`,`origin`]},nodeSize:{number:!0,min:0,enums:[`label`]},number:{number:!0,unitless:!0},numbers:{number:!0,unitless:!0,multiple:!0},positiveNumber:{number:!0,unitless:!0,min:0,strictMin:!0},size:{number:!0,min:0},bidirectionalSize:{number:!0},bidirectionalSizeMaybePercent:{number:!0,allowPercent:!0},bidirectionalSizes:{number:!0,multiple:!0},sizeMaybePercent:{number:!0,min:0,allowPercent:!0},axisDirection:{enums:[`horizontal`,`leftward`,`rightward`,`vertical`,`upward`,`downward`,`auto`]},axisDirectionExplicit:{enums:[`leftward`,`rightward`,`upward`,`downward`]},axisDirectionPrimary:{enums:[`horizontal`,`vertical`]},paddingRelativeTo:{enums:[`width`,`height`,`average`,`min`,`max`]},bgWH:{number:!0,min:0,allowPercent:!0,enums:[`auto`],multiple:!0},bgPos:{number:!0,allowPercent:!0,multiple:!0},bgRelativeTo:{enums:[`inner`,`include-padding`],multiple:!0},bgRepeat:{enums:[`repeat`,`repeat-x`,`repeat-y`,`no-repeat`],multiple:!0},bgFit:{enums:[`none`,`contain`,`cover`],multiple:!0},bgCrossOrigin:{enums:[`anonymous`,`use-credentials`,`null`],multiple:!0},bgClip:{enums:[`none`,`node`],multiple:!0},bgContainment:{enums:[`inside`,`over`],multiple:!0},boxSelection:{enums:[`contain`,`overlap`,`none`]},color:{color:!0},colors:{color:!0,multiple:!0},fill:{enums:[`solid`,`linear-gradient`,`radial-gradient`]},bool:{enums:[`yes`,`no`]},bools:{enums:[`yes`,`no`],multiple:!0},lineStyle:{enums:[`solid`,`dotted`,`dashed`]},lineCap:{enums:[`butt`,`round`,`square`]},linePosition:{enums:[`center`,`inside`,`outside`]},lineJoin:{enums:[`round`,`bevel`,`miter`]},borderStyle:{enums:[`solid`,`dotted`,`dashed`,`double`]},curveStyle:{enums:[`bezier`,`unbundled-bezier`,`haystack`,`segments`,`straight`,`straight-triangle`,`taxi`,`round-segments`,`round-taxi`]},radiusType:{enums:[`arc-radius`,`influence-radius`],multiple:!0},fontFamily:{regex:`^([\\w- \\"]+(?:\\s*,\\s*[\\w- \\"]+)*)$`},fontStyle:{enums:[`italic`,`normal`,`oblique`]},fontWeight:{enums:[`normal`,`bold`,`bolder`,`lighter`,`100`,`200`,`300`,`400`,`500`,`600`,`800`,`900`,100,200,300,400,500,600,700,800,900]},textDecoration:{enums:[`none`,`underline`,`overline`,`line-through`]},textTransform:{enums:[`none`,`uppercase`,`lowercase`]},textWrap:{enums:[`none`,`wrap`,`ellipsis`]},textOverflowWrap:{enums:[`whitespace`,`anywhere`]},textBackgroundShape:{enums:[`rectangle`,`roundrectangle`,`round-rectangle`,`circle`]},nodeShape:{enums:`rectangle.roundrectangle.round-rectangle.cutrectangle.cut-rectangle.bottomroundrectangle.bottom-round-rectangle.barrel.ellipse.triangle.round-triangle.square.pentagon.round-pentagon.hexagon.round-hexagon.concavehexagon.concave-hexagon.heptagon.round-heptagon.octagon.round-octagon.tag.round-tag.star.diamond.round-diamond.vee.rhomboid.right-rhomboid.polygon`.split(`.`)},overlayShape:{enums:[`roundrectangle`,`round-rectangle`,`ellipse`]},cornerRadius:{number:!0,min:0,units:`px|em`,implicitUnits:`px`,enums:[`auto`]},compoundIncludeLabels:{enums:[`include`,`exclude`]},arrowShape:{enums:[`tee`,`triangle`,`triangle-tee`,`circle-triangle`,`triangle-cross`,`triangle-backcurve`,`vee`,`square`,`circle`,`diamond`,`chevron`,`none`]},arrowFill:{enums:[`filled`,`hollow`]},arrowWidth:{number:!0,units:`%|px|em`,implicitUnits:`px`,enums:[`match-line`]},display:{enums:[`element`,`none`]},visibility:{enums:[`hidden`,`visible`]},zCompoundDepth:{enums:[`bottom`,`orphan`,`auto`,`top`]},zIndexCompare:{enums:[`auto`,`manual`]},valign:{enums:[`top`,`top-inside`,`center`,`bottom`,`bottom-inside`]},halign:{enums:[`left`,`left-inside`,`center`,`right`,`right-inside`]},justification:{enums:[`left`,`center`,`right`,`auto`]},textMetrics:{enums:[`font`,`glyph`]},text:{string:!0},data:{mapping:!0,regex:a(`data`)},layoutData:{mapping:!0,regex:a(`layoutData`)},scratch:{mapping:!0,regex:a(`scratch`)},mapData:{mapping:!0,regex:o(`mapData`)},mapLayoutData:{mapping:!0,regex:o(`mapLayoutData`)},mapScratch:{mapping:!0,regex:o(`mapScratch`)},fn:{mapping:!0,fn:!0},url:{regexes:s,singleRegexMatchValue:!0},urls:{regexes:s,singleRegexMatchValue:!0,multiple:!0},propList:{propList:!0},angle:{number:!0,units:`deg|rad`,implicitUnits:`rad`},textRotation:{number:!0,units:`deg|rad`,implicitUnits:`rad`,enums:[`none`,`autorotate`]},polygonPointList:{number:!0,multiple:!0,evenMultiple:!0,min:-1,max:1,unitless:!0},edgeDistances:{enums:[`intersection`,`node-position`,`endpoints`]},edgeEndpoint:{number:!0,multiple:!0,units:`%|px|em|deg|rad`,implicitUnits:`px`,enums:[`inside-to-node`,`outside-to-node`,`outside-to-node-or-label`,`outside-to-line`,`outside-to-line-or-label`],singleEnum:!0,validate:function(e,t){switch(e.length){case 2:return t[0]!==`deg`&&t[0]!==`rad`&&t[1]!==`deg`&&t[1]!==`rad`;case 1:return W(e[0])||t[0]===`deg`||t[0]===`rad`;default:return!1}}},easing:{regexes:[`^(spring)\\s*\\(\\s*(`+e+`)\\s*,\\s*(`+e+`)\\s*\\)$`,`^(cubic-bezier)\\s*\\(\\s*(`+e+`)\\s*,\\s*(`+e+`)\\s*,\\s*(`+e+`)\\s*,\\s*(`+e+`)\\s*\\)$`],enums:`linear.ease.ease-in.ease-out.ease-in-out.ease-in-sine.ease-out-sine.ease-in-out-sine.ease-in-quad.ease-out-quad.ease-in-out-quad.ease-in-cubic.ease-out-cubic.ease-in-out-cubic.ease-in-quart.ease-out-quart.ease-in-out-quart.ease-in-quint.ease-out-quint.ease-in-out-quint.ease-in-expo.ease-out-expo.ease-in-out-expo.ease-in-circ.ease-out-circ.ease-in-out-circ`.split(`.`)},gradientDirection:{enums:[`to-bottom`,`to-top`,`to-left`,`to-right`,`to-bottom-right`,`to-bottom-left`,`to-top-right`,`to-top-left`,`to-right-bottom`,`to-left-bottom`,`to-right-top`,`to-left-top`]},boundsExpansion:{number:!0,multiple:!0,min:0,validate:function(e){var t=e.length;return t===1||t===2||t===4}}};var c={zeroNonZero:function(e,t){return(e==null||t==null)&&e!==t||e==0&&t!=0||e!=0&&t==0},any:function(e,t){return e!=t},emptyNonEmpty:function(e,t){var n=le(e),r=le(t);return n&&!r||!n&&r}},l=Q.types,u=[{name:`label`,type:l.text,triggersBounds:c.any,triggersZOrder:c.emptyNonEmpty},{name:`text-rotation`,type:l.textRotation,triggersBounds:c.any},{name:`text-margin-x`,type:l.bidirectionalSize,triggersBounds:c.any},{name:`text-margin-y`,type:l.bidirectionalSize,triggersBounds:c.any}],d=[{name:`source-label`,type:l.text,triggersBounds:c.any},{name:`source-text-rotation`,type:l.textRotation,triggersBounds:c.any},{name:`source-text-margin-x`,type:l.bidirectionalSize,triggersBounds:c.any},{name:`source-text-margin-y`,type:l.bidirectionalSize,triggersBounds:c.any},{name:`source-text-offset`,type:l.size,triggersBounds:c.any}],f=[{name:`target-label`,type:l.text,triggersBounds:c.any},{name:`target-text-rotation`,type:l.textRotation,triggersBounds:c.any},{name:`target-text-margin-x`,type:l.bidirectionalSize,triggersBounds:c.any},{name:`target-text-margin-y`,type:l.bidirectionalSize,triggersBounds:c.any},{name:`target-text-offset`,type:l.size,triggersBounds:c.any}],p=[{name:`font-family`,type:l.fontFamily,triggersBounds:c.any},{name:`font-style`,type:l.fontStyle,triggersBounds:c.any},{name:`font-weight`,type:l.fontWeight,triggersBounds:c.any},{name:`font-size`,type:l.size,triggersBounds:c.any},{name:`text-transform`,type:l.textTransform,triggersBounds:c.any},{name:`text-wrap`,type:l.textWrap,triggersBounds:c.any},{name:`text-overflow-wrap`,type:l.textOverflowWrap,triggersBounds:c.any},{name:`text-max-width`,type:l.size,triggersBounds:c.any},{name:`text-outline-width`,type:l.size,triggersBounds:c.any},{name:`line-height`,type:l.positiveNumber,triggersBounds:c.any}],m=[{name:`text-valign`,type:l.valign,triggersBounds:c.any},{name:`text-halign`,type:l.halign,triggersBounds:c.any},{name:`color`,type:l.color},{name:`text-outline-color`,type:l.color},{name:`text-outline-opacity`,type:l.zeroOneNumber},{name:`text-background-color`,type:l.color},{name:`text-background-opacity`,type:l.zeroOneNumber},{name:`text-background-padding`,type:l.size,triggersBounds:c.any},{name:`text-border-opacity`,type:l.zeroOneNumber},{name:`text-border-color`,type:l.color},{name:`text-border-width`,type:l.size,triggersBounds:c.any},{name:`text-border-style`,type:l.borderStyle,triggersBounds:c.any},{name:`text-background-shape`,type:l.textBackgroundShape,triggersBounds:c.any},{name:`text-justification`,type:l.justification},{name:`text-metrics`,type:l.textMetrics},{name:`box-select-labels`,type:l.bool,triggersBounds:c.any}],h=[{name:`events`,type:l.bool,triggersZOrder:c.any},{name:`text-events`,type:l.bool,triggersZOrder:c.any},{name:`box-selection`,type:l.boxSelection,triggersZOrder:c.any}],g=[{name:`display`,type:l.display,triggersZOrder:c.any,triggersBounds:c.any,triggersBoundsOfConnectedEdges:c.any,triggersBoundsOfParallelEdges:function(e,t,n){return e!==t&&n.pstyle(`curve-style`).value===`bezier`}},{name:`visibility`,type:l.visibility,triggersZOrder:c.any},{name:`opacity`,type:l.zeroOneNumber,triggersZOrder:c.zeroNonZero},{name:`text-opacity`,type:l.zeroOneNumber},{name:`min-zoomed-font-size`,type:l.size},{name:`z-compound-depth`,type:l.zCompoundDepth,triggersZOrder:c.any},{name:`z-index-compare`,type:l.zIndexCompare,triggersZOrder:c.any},{name:`z-index`,type:l.number,triggersZOrder:c.any}],_=[{name:`overlay-padding`,type:l.size,triggersBounds:c.any},{name:`overlay-color`,type:l.color},{name:`overlay-opacity`,type:l.zeroOneNumber,triggersBounds:c.zeroNonZero},{name:`overlay-shape`,type:l.overlayShape,triggersBounds:c.any},{name:`overlay-corner-radius`,type:l.cornerRadius}],v=[{name:`underlay-padding`,type:l.size,triggersBounds:c.any},{name:`underlay-color`,type:l.color},{name:`underlay-opacity`,type:l.zeroOneNumber,triggersBounds:c.zeroNonZero},{name:`underlay-shape`,type:l.overlayShape,triggersBounds:c.any},{name:`underlay-corner-radius`,type:l.cornerRadius}],y=[{name:`transition-property`,type:l.propList},{name:`transition-duration`,type:l.time},{name:`transition-delay`,type:l.time},{name:`transition-timing-function`,type:l.easing}],b=function(e,t){return t.value===`label`?-e.poolIndex():t.pfValue},x=[{name:`height`,type:l.nodeSize,triggersBounds:c.any,hashOverride:b},{name:`width`,type:l.nodeSize,triggersBounds:c.any,hashOverride:b},{name:`shape`,type:l.nodeShape,triggersBounds:c.any},{name:`shape-polygon-points`,type:l.polygonPointList,triggersBounds:c.any},{name:`corner-radius`,type:l.cornerRadius},{name:`background-color`,type:l.color},{name:`background-fill`,type:l.fill},{name:`background-opacity`,type:l.zeroOneNumber},{name:`background-blacken`,type:l.nOneOneNumber},{name:`background-gradient-stop-colors`,type:l.colors},{name:`background-gradient-stop-positions`,type:l.percentages},{name:`background-gradient-direction`,type:l.gradientDirection},{name:`padding`,type:l.sizeMaybePercent,triggersBounds:c.any},{name:`padding-relative-to`,type:l.paddingRelativeTo,triggersBounds:c.any},{name:`bounds-expansion`,type:l.boundsExpansion,triggersBounds:c.any}],S=[{name:`border-color`,type:l.color},{name:`border-opacity`,type:l.zeroOneNumber},{name:`border-width`,type:l.size,triggersBounds:c.any},{name:`border-style`,type:l.borderStyle},{name:`border-cap`,type:l.lineCap},{name:`border-join`,type:l.lineJoin},{name:`border-dash-pattern`,type:l.numbers},{name:`border-dash-offset`,type:l.number},{name:`border-position`,type:l.linePosition}],C=[{name:`outline-color`,type:l.color},{name:`outline-opacity`,type:l.zeroOneNumber},{name:`outline-width`,type:l.size,triggersBounds:c.any},{name:`outline-style`,type:l.borderStyle},{name:`outline-offset`,type:l.size,triggersBounds:c.any}],w=[{name:`background-image`,type:l.urls},{name:`background-image-crossorigin`,type:l.bgCrossOrigin},{name:`background-image-opacity`,type:l.zeroOneNumbers},{name:`background-image-containment`,type:l.bgContainment},{name:`background-image-smoothing`,type:l.bools},{name:`background-position-x`,type:l.bgPos},{name:`background-position-y`,type:l.bgPos},{name:`background-width-relative-to`,type:l.bgRelativeTo},{name:`background-height-relative-to`,type:l.bgRelativeTo},{name:`background-repeat`,type:l.bgRepeat},{name:`background-fit`,type:l.bgFit},{name:`background-clip`,type:l.bgClip},{name:`background-width`,type:l.bgWH},{name:`background-height`,type:l.bgWH},{name:`background-offset-x`,type:l.bgPos},{name:`background-offset-y`,type:l.bgPos}],T=[{name:`position`,type:l.position,triggersBounds:c.any},{name:`compound-sizing-wrt-labels`,type:l.compoundIncludeLabels,triggersBounds:c.any},{name:`min-width`,type:l.size,triggersBounds:c.any},{name:`min-width-bias-left`,type:l.sizeMaybePercent,triggersBounds:c.any},{name:`min-width-bias-right`,type:l.sizeMaybePercent,triggersBounds:c.any},{name:`min-height`,type:l.size,triggersBounds:c.any},{name:`min-height-bias-top`,type:l.sizeMaybePercent,triggersBounds:c.any},{name:`min-height-bias-bottom`,type:l.sizeMaybePercent,triggersBounds:c.any}],E=[{name:`line-style`,type:l.lineStyle},{name:`line-color`,type:l.color},{name:`line-fill`,type:l.fill},{name:`line-cap`,type:l.lineCap},{name:`line-opacity`,type:l.zeroOneNumber},{name:`line-dash-pattern`,type:l.numbers},{name:`line-dash-offset`,type:l.number},{name:`line-outline-width`,type:l.size},{name:`line-outline-color`,type:l.color},{name:`line-gradient-stop-colors`,type:l.colors},{name:`line-gradient-stop-positions`,type:l.percentages},{name:`curve-style`,type:l.curveStyle,triggersBounds:c.any,triggersBoundsOfParallelEdges:function(e,t){return e===t?!1:e===`bezier`||t===`bezier`}},{name:`haystack-radius`,type:l.zeroOneNumber,triggersBounds:c.any},{name:`source-endpoint`,type:l.edgeEndpoint,triggersBounds:c.any},{name:`target-endpoint`,type:l.edgeEndpoint,triggersBounds:c.any},{name:`control-point-step-size`,type:l.size,triggersBounds:c.any},{name:`control-point-distances`,type:l.bidirectionalSizes,triggersBounds:c.any},{name:`control-point-weights`,type:l.numbers,triggersBounds:c.any},{name:`segment-distances`,type:l.bidirectionalSizes,triggersBounds:c.any},{name:`segment-weights`,type:l.numbers,triggersBounds:c.any},{name:`segment-radii`,type:l.numbers,triggersBounds:c.any},{name:`radius-type`,type:l.radiusType,triggersBounds:c.any},{name:`taxi-turn`,type:l.bidirectionalSizeMaybePercent,triggersBounds:c.any},{name:`taxi-turn-min-distance`,type:l.size,triggersBounds:c.any},{name:`taxi-direction`,type:l.axisDirection,triggersBounds:c.any},{name:`taxi-radius`,type:l.number,triggersBounds:c.any},{name:`edge-distances`,type:l.edgeDistances,triggersBounds:c.any},{name:`arrow-scale`,type:l.positiveNumber,triggersBounds:c.any},{name:`loop-direction`,type:l.angle,triggersBounds:c.any},{name:`loop-sweep`,type:l.angle,triggersBounds:c.any},{name:`source-distance-from-node`,type:l.size,triggersBounds:c.any},{name:`target-distance-from-node`,type:l.size,triggersBounds:c.any}],D=[{name:`ghost`,type:l.bool,triggersBounds:c.any},{name:`ghost-offset-x`,type:l.bidirectionalSize,triggersBounds:c.any},{name:`ghost-offset-y`,type:l.bidirectionalSize,triggersBounds:c.any},{name:`ghost-opacity`,type:l.zeroOneNumber}],O=[{name:`selection-box-color`,type:l.color},{name:`selection-box-opacity`,type:l.zeroOneNumber},{name:`selection-box-border-color`,type:l.color},{name:`selection-box-border-width`,type:l.size},{name:`active-bg-color`,type:l.color},{name:`active-bg-opacity`,type:l.zeroOneNumber},{name:`active-bg-size`,type:l.size},{name:`outside-texture-bg-color`,type:l.color},{name:`outside-texture-bg-opacity`,type:l.zeroOneNumber}],k=[];Q.pieBackgroundN=16,k.push({name:`pie-size`,type:l.sizeMaybePercent}),k.push({name:`pie-hole`,type:l.sizeMaybePercent}),k.push({name:`pie-start-angle`,type:l.angle});for(var A=1;A<=Q.pieBackgroundN;A++)k.push({name:`pie-`+A+`-background-color`,type:l.color}),k.push({name:`pie-`+A+`-background-size`,type:l.percent}),k.push({name:`pie-`+A+`-background-opacity`,type:l.zeroOneNumber});var j=[];Q.stripeBackgroundN=16,j.push({name:`stripe-size`,type:l.sizeMaybePercent}),j.push({name:`stripe-direction`,type:l.axisDirectionPrimary});for(var M=1;M<=Q.stripeBackgroundN;M++)j.push({name:`stripe-`+M+`-background-color`,type:l.color}),j.push({name:`stripe-`+M+`-background-size`,type:l.percent}),j.push({name:`stripe-`+M+`-background-opacity`,type:l.zeroOneNumber});var N=[],P=Q.arrowPrefixes=[`source`,`mid-source`,`target`,`mid-target`];[{name:`arrow-shape`,type:l.arrowShape,triggersBounds:c.any},{name:`arrow-color`,type:l.color},{name:`arrow-fill`,type:l.arrowFill},{name:`arrow-width`,type:l.arrowWidth}].forEach(function(e){P.forEach(function(t){var n=t+`-`+e.name,r=e.type,i=e.triggersBounds;N.push({name:n,type:r,triggersBounds:i})})},{});var F=Q.properties=[].concat(h,y,g,_,v,D,m,p,u,d,f,x,S,C,w,k,j,T,E,N,O),I=Q.propertyGroups={behavior:h,transition:y,visibility:g,overlay:_,underlay:v,ghost:D,commonLabel:m,labelDimensions:p,mainLabel:u,sourceLabel:d,targetLabel:f,nodeBody:x,nodeBorder:S,nodeOutline:C,backgroundImage:w,pie:k,stripe:j,compound:T,edgeLine:E,edgeArrow:N,core:O},L=Q.propertyGroupNames={};(Q.propertyGroupKeys=Object.keys(I)).forEach(function(e){L[e]=I[e].map(function(e){return e.name}),I[e].forEach(function(t){return t.groupKey=e})});var R=Q.aliases=[{name:`content`,pointsTo:`label`},{name:`control-point-distance`,pointsTo:`control-point-distances`},{name:`control-point-weight`,pointsTo:`control-point-weights`},{name:`segment-distance`,pointsTo:`segment-distances`},{name:`segment-weight`,pointsTo:`segment-weights`},{name:`segment-radius`,pointsTo:`segment-radii`},{name:`edge-text-rotation`,pointsTo:`text-rotation`},{name:`padding-left`,pointsTo:`padding`},{name:`padding-right`,pointsTo:`padding`},{name:`padding-top`,pointsTo:`padding`},{name:`padding-bottom`,pointsTo:`padding`}];Q.propertyNames=F.map(function(e){return e.name});for(var ee=0;ee<F.length;ee++){var z=F[ee];F[z.name]=z}for(var B=0;B<R.length;B++){var V=R[B],H=F[V.pointsTo],U={name:V.name,alias:!0,pointsTo:H};F.push(U),F[V.name]=U}})(),Q.getDefaultProperty=function(e){return this.getDefaultProperties()[e]},Q.getDefaultProperties=function(){var e=this._private;if(e.defaultProperties!=null)return e.defaultProperties;for(var t=X({"selection-box-color":`#ddd`,"selection-box-opacity":.65,"selection-box-border-color":`#aaa`,"selection-box-border-width":1,"active-bg-color":`black`,"active-bg-opacity":.15,"active-bg-size":30,"outside-texture-bg-color":`#000`,"outside-texture-bg-opacity":.125,events:`yes`,"text-events":`no`,"text-valign":`top`,"text-halign":`center`,"text-justification":`auto`,"line-height":1,color:`#000`,"box-selection":`contain`,"text-outline-color":`#000`,"text-outline-width":0,"text-outline-opacity":1,"text-opacity":1,"text-decoration":`none`,"text-transform":`none`,"text-wrap":`none`,"text-overflow-wrap":`whitespace`,"text-max-width":9999,"text-background-color":`#000`,"text-background-opacity":0,"text-background-shape":`rectangle`,"text-background-padding":0,"text-border-opacity":0,"text-border-width":0,"text-border-style":`solid`,"text-border-color":`#000`,"font-family":`Helvetica Neue, Helvetica, sans-serif`,"font-style":`normal`,"font-weight":`normal`,"font-size":16,"min-zoomed-font-size":0,"text-rotation":`none`,"source-text-rotation":`none`,"target-text-rotation":`none`,visibility:`visible`,display:`element`,opacity:1,"z-compound-depth":`auto`,"z-index-compare":`auto`,"z-index":0,label:``,"text-margin-x":0,"text-margin-y":0,"source-label":``,"source-text-offset":0,"source-text-margin-x":0,"source-text-margin-y":0,"target-label":``,"target-text-offset":0,"target-text-margin-x":0,"target-text-margin-y":0,"overlay-opacity":0,"overlay-color":`#000`,"overlay-padding":10,"overlay-shape":`round-rectangle`,"overlay-corner-radius":`auto`,"underlay-opacity":0,"underlay-color":`#000`,"underlay-padding":10,"underlay-shape":`round-rectangle`,"underlay-corner-radius":`auto`,"text-metrics":`font`,"transition-property":`none`,"transition-duration":0,"transition-delay":0,"transition-timing-function":`linear`,"box-select-labels":`no`,"background-blacken":0,"background-color":`#999`,"background-fill":`solid`,"background-opacity":1,"background-image":`none`,"background-image-crossorigin":`anonymous`,"background-image-opacity":1,"background-image-containment":`inside`,"background-image-smoothing":`yes`,"background-position-x":`50%`,"background-position-y":`50%`,"background-offset-x":0,"background-offset-y":0,"background-width-relative-to":`include-padding`,"background-height-relative-to":`include-padding`,"background-repeat":`no-repeat`,"background-fit":`none`,"background-clip":`node`,"background-width":`auto`,"background-height":`auto`,"border-color":`#000`,"border-opacity":1,"border-width":0,"border-style":`solid`,"border-dash-pattern":[4,2],"border-dash-offset":0,"border-cap":`butt`,"border-join":`miter`,"border-position":`center`,"outline-color":`#999`,"outline-opacity":1,"outline-width":0,"outline-offset":0,"outline-style":`solid`,height:30,width:30,shape:`ellipse`,"shape-polygon-points":`-1, -1, 1, -1, 1, 1, -1, 1`,"corner-radius":`auto`,"bounds-expansion":0,"background-gradient-direction":`to-bottom`,"background-gradient-stop-colors":`#999`,"background-gradient-stop-positions":`0%`,ghost:`no`,"ghost-offset-y":0,"ghost-offset-x":0,"ghost-opacity":0,padding:0,"padding-relative-to":`width`,position:`origin`,"compound-sizing-wrt-labels":`include`,"min-width":0,"min-width-bias-left":0,"min-width-bias-right":0,"min-height":0,"min-height-bias-top":0,"min-height-bias-bottom":0},{"pie-size":`100%`,"pie-hole":0,"pie-start-angle":`0deg`},[{name:`pie-{{i}}-background-color`,value:`black`},{name:`pie-{{i}}-background-size`,value:`0%`},{name:`pie-{{i}}-background-opacity`,value:1}].reduce(function(e,t){for(var n=1;n<=Q.pieBackgroundN;n++){var r=t.name.replace(`{{i}}`,n);e[r]=t.value}return e},{}),{"stripe-size":`100%`,"stripe-direction":`horizontal`},[{name:`stripe-{{i}}-background-color`,value:`black`},{name:`stripe-{{i}}-background-size`,value:`0%`},{name:`stripe-{{i}}-background-opacity`,value:1}].reduce(function(e,t){for(var n=1;n<=Q.stripeBackgroundN;n++){var r=t.name.replace(`{{i}}`,n);e[r]=t.value}return e},{}),{"line-style":`solid`,"line-color":`#999`,"line-fill":`solid`,"line-cap":`butt`,"line-opacity":1,"line-outline-width":0,"line-outline-color":`#000`,"line-gradient-stop-colors":`#999`,"line-gradient-stop-positions":`0%`,"control-point-step-size":40,"control-point-weights":.5,"segment-weights":.5,"segment-distances":20,"segment-radii":15,"radius-type":`arc-radius`,"taxi-turn":`50%`,"taxi-radius":15,"taxi-turn-min-distance":10,"taxi-direction":`auto`,"edge-distances":`intersection`,"curve-style":`haystack`,"haystack-radius":0,"arrow-scale":1,"loop-direction":`-45deg`,"loop-sweep":`-90deg`,"source-distance-from-node":0,"target-distance-from-node":0,"source-endpoint":`outside-to-node`,"target-endpoint":`outside-to-node`,"line-dash-pattern":[6,3],"line-dash-offset":0},[{name:`arrow-shape`,value:`none`},{name:`arrow-color`,value:`#999`},{name:`arrow-fill`,value:`filled`},{name:`arrow-width`,value:1}].reduce(function(e,t){return Q.arrowPrefixes.forEach(function(n){var r=n+`-`+t.name;e[r]=t.value}),e},{})),n={},r=0;r<this.properties.length;r++){var i=this.properties[r];if(!i.pointsTo){var a=i.name,o=t[a];n[a]=this.parse(a,o)}}return e.defaultProperties=n,e.defaultProperties},Q.addDefaultStylesheet=function(){this.selector(`:parent`).css({shape:`rectangle`,padding:10,"background-color":`#eee`,"border-color":`#ccc`,"border-width":1}).selector(`edge`).css({width:3}).selector(`:loop`).css({"curve-style":`bezier`}).selector(`edge:compound`).css({"curve-style":`bezier`,"source-endpoint":`outside-to-line`,"target-endpoint":`outside-to-line`}).selector(`:selected`).css({"background-color":`#0169D9`,"line-color":`#0169D9`,"source-arrow-color":`#0169D9`,"target-arrow-color":`#0169D9`,"mid-source-arrow-color":`#0169D9`,"mid-target-arrow-color":`#0169D9`}).selector(`:parent:selected`).css({"background-color":`#CCE1F9`,"border-color":`#aec8e5`}).selector(`:active`).css({"overlay-color":`black`,"overlay-padding":10,"overlay-opacity":.25}),this.defaultLength=this.length};var bd={};bd.parse=function(e,t,n,r){var i=this;if(G(t))return i.parseImplWarn(e,t,n,r);var a=r===`mapping`||r===!0||r===!1||r==null?`dontcare`:r,o=n?`t`:`f`,s=Wt(e,``+t,o,a),c=i.propCache=i.propCache||[],l;return(l=c[s])||(l=c[s]=i.parseImplWarn(e,t,n,r)),(n||r===`mapping`)&&(l=cn(l),l&&(l.value=cn(l.value))),l},bd.parseImplWarn=function(e,t,n,r){var i=this.parseImpl(e,t,n,r);return!i&&t!=null&&on(`The style property \`${e}: ${t}\` is invalid`),i&&(i.name===`width`||i.name===`height`)&&t===`label`&&on("The style value of `label` is deprecated for `"+i.name+"`"),i},bd.parseImpl=function(e,t,n,r){var i=this;e=he(e);var a=i.properties[e],o=t,s=i.types;if(!a||t===void 0)return null;a.alias&&(a=a.pointsTo,e=a.name);var c=W(t);c&&(t=t.trim());var l=a.type;if(!l)return null;if(n&&(t===``||t===null))return{name:e,value:t,bypass:!0,deleteBypass:!0};if(G(t))return{name:e,value:t,strValue:`fn`,mapped:s.fn,bypass:n};var u,d;if(!(!c||r||t.length<7||t[1]!==`a`)){if(t.length>=7&&t[0]===`d`&&(u=new RegExp(s.data.regex).exec(t))){if(n)return!1;var f=s.data;return{name:e,value:u,strValue:``+t,mapped:f,field:u[1],bypass:n}}if(t.length>=10&&t[0]===`m`&&(d=new RegExp(s.mapData.regex).exec(t))){if(n||l.multiple)return!1;var p=s.mapData;if(!(l.color||l.number))return!1;var m=this.parse(e,d[4]);if(!m||m.mapped)return!1;var h=this.parse(e,d[5]);if(!h||h.mapped)return!1;if(m.pfValue===h.pfValue||m.strValue===h.strValue)return on("`"+e+`: `+t+"` is not a valid mapper because the output range is zero; converting to `"+e+`: `+m.strValue+"`"),this.parse(e,m.strValue);if(l.color){var g=m.value,_=h.value;if(g[0]===_[0]&&g[1]===_[1]&&g[2]===_[2]&&(g[3]===_[3]||(g[3]==null||g[3]===1)&&(_[3]==null||_[3]===1)))return!1}return{name:e,value:d,strValue:``+t,mapped:p,field:d[1],fieldMin:parseFloat(d[2]),fieldMax:parseFloat(d[3]),valueMin:m.value,valueMax:h.value,bypass:n}}}if(l.multiple&&r!==`multiple`){var v=c?t.split(/\s+/):K(t)?t:[t];if(l.evenMultiple&&v.length%2!=0)return null;for(var y=[],b=[],x=[],S=``,C=!1,w=0;w<v.length;w++){var T=i.parse(e,v[w],n,`multiple`);C||=W(T.value),y.push(T.value),x.push(T.pfValue==null?T.value:T.pfValue),b.push(T.units),S+=(w>0?` `:``)+T.strValue}return l.validate&&!l.validate(y,b)?null:l.singleEnum&&C?y.length===1&&W(y[0])?{name:e,value:y[0],strValue:y[0],bypass:n}:null:{name:e,value:y,pfValue:x,strValue:S,bypass:n,units:b}}var E=function(){for(var r=0;r<l.enums.length;r++)if(l.enums[r]===t)return{name:e,value:t,strValue:``+t,bypass:n};return null};if(l.number){var D,O=`px`;if(l.units&&(D=l.units),l.implicitUnits&&(O=l.implicitUnits),!l.unitless){if(c){var k=`px|em`+(l.allowPercent?`|\\%`:``);D&&(k=D);var A=t.match(`^(`+be+`)(`+k+`)?$`);A&&(t=A[1],D=A[2]||O)}else(!D||l.implicitUnits)&&(D=O)}if(t=parseFloat(t),isNaN(t)&&l.enums===void 0)return null;if(isNaN(t)&&l.enums!==void 0)return t=o,E();if(l.integer&&!te(t)||l.min!==void 0&&(t<l.min||l.strictMin&&t===l.min)||l.max!==void 0&&(t>l.max||l.strictMax&&t===l.max))return null;var j={name:e,value:t,strValue:``+t+(D||``),units:D,bypass:n};return j.pfValue=l.unitless||D!==`px`&&D!==`em`||D===`px`||!D?t:this.getEmSizeInPixels()*t,(D===`ms`||D===`s`)&&(j.pfValue=D===`ms`?t:1e3*t),(D===`deg`||D===`rad`)&&(j.pfValue=D===`rad`?t:rr(t)),D===`%`&&(j.pfValue=t/100),j}if(l.propList){var M=[],N=``+t;if(N!==`none`){for(var P=N.split(/\s*,\s*|\s+/),F=0;F<P.length;F++){var I=P[F].trim();i.properties[I]?M.push(I):on("`"+I+"` is not a valid property name")}if(M.length===0)return null}return{name:e,value:M,strValue:M.length===0?`none`:M.join(` `),bypass:n}}if(l.color){var L=Ne(t);return L?{name:e,value:L,pfValue:L,strValue:`rgb(`+L[0]+`,`+L[1]+`,`+L[2]+`)`,bypass:n}:null}if(l.regex||l.regexes){if(l.enums){var R=E();if(R)return R}for(var ee=l.regexes?l.regexes:[l.regex],z=0;z<ee.length;z++){var B=new RegExp(ee[z]).exec(t);if(B)return{name:e,value:l.singleRegexMatchValue?B[1]:B,strValue:``+t,bypass:n}}return null}return l.string?{name:e,value:``+t,strValue:``+t,bypass:n}:l.enums?E():null};var xd=function(e){if(!(this instanceof xd))return new xd(e);if(!oe(e)){rn(`A style must have a core reference`);return}this._private={cy:e,coreStyle:{}},this.length=0,this.resetToDefault()},Sd=xd.prototype;Sd.instanceString=function(){return`style`},Sd.clear=function(){for(var e=this._private,t=e.cy.elements(),n=0;n<this.length;n++)this[n]=void 0;return this.length=0,e.contextStyles={},e.propDiffs={},this.cleanElements(t,!0),t.forEach(function(e){var t=e[0]._private;t.styleDirty=!0,t.appliedInitStyle=!1}),this},Sd.resetToDefault=function(){return this.clear(),this.addDefaultStylesheet(),this},Sd.core=function(e){return this._private.coreStyle[e]||this.getDefaultProperty(e)},Sd.selector=function(e){var t=e===`core`?null:new il(e),n=this.length++;return this[n]={selector:t,properties:[],mappedProperties:[],index:n},this},Sd.css=function(){var e=this,t=arguments;if(t.length===1)for(var n=t[0],r=0;r<e.properties.length;r++){var i=e.properties[r],a=n[i.name];a===void 0&&(a=n[ge(i.name)]),a!==void 0&&this.cssRule(i.name,a)}else t.length===2&&this.cssRule(t[0],t[1]);return this},Sd.style=Sd.css,Sd.cssRule=function(e,t){var n=this.parse(e,t);if(n){var r=this.length-1;this[r].properties.push(n),this[r].properties[n.name]=n,n.name.match(/pie-(\d+)-background-size/)&&n.value&&(this._private.hasPie=!0),n.name.match(/stripe-(\d+)-background-size/)&&n.value&&(this._private.hasStripe=!0),n.mapped&&this[r].mappedProperties.push(n),this[r].selector||(this._private.coreStyle[n.name]=n)}return this},Sd.append=function(e){return se(e)?e.appendToStyle(this):K(e)?this.appendFromJson(e):W(e)&&this.appendFromString(e),this},xd.fromJson=function(e,t){var n=new xd(e);return n.fromJson(t),n},xd.fromString=function(e,t){return new xd(e).fromString(t)},[fd,hd,gd,_d,vd,yd,Q,bd].forEach(function(e){X(Sd,e)}),xd.types=Sd.types,xd.properties=Sd.properties,xd.propertyGroups=Sd.propertyGroups,xd.propertyGroupNames=Sd.propertyGroupNames,xd.propertyGroupKeys=Sd.propertyGroupKeys;var Cd={style:function(e){return e&&this.setStyle(e).update(),this._private.style},setStyle:function(e){var t=this._private;return t.style=se(e)?e.generateStyle(this):K(e)?xd.fromJson(this,e):W(e)?xd.fromString(this,e):xd(this),t.style},updateStyle:function(){this.mutableElements().updateStyle()}},wd=`single`,Td={autolock:function(e){if(e!==void 0)this._private.autolock=!!e;else return this._private.autolock;return this},autoungrabify:function(e){if(e!==void 0)this._private.autoungrabify=!!e;else return this._private.autoungrabify;return this},autounselectify:function(e){if(e!==void 0)this._private.autounselectify=!!e;else return this._private.autounselectify;return this},selectionType:function(e){var t=this._private;if(t.selectionType??=wd,e!==void 0)(e===`additive`||e===`single`)&&(t.selectionType=e);else return t.selectionType;return this},panningEnabled:function(e){if(e!==void 0)this._private.panningEnabled=!!e;else return this._private.panningEnabled;return this},userPanningEnabled:function(e){if(e!==void 0)this._private.userPanningEnabled=!!e;else return this._private.userPanningEnabled;return this},zoomingEnabled:function(e){if(e!==void 0)this._private.zoomingEnabled=!!e;else return this._private.zoomingEnabled;return this},userZoomingEnabled:function(e){if(e!==void 0)this._private.userZoomingEnabled=!!e;else return this._private.userZoomingEnabled;return this},boxSelectionEnabled:function(e){if(e!==void 0)this._private.boxSelectionEnabled=!!e;else return this._private.boxSelectionEnabled;return this},pan:function(){var e=arguments,t=this._private.pan,n,r,i,a,o;switch(e.length){case 0:return t;case 1:if(W(e[0]))return n=e[0],t[n];if(q(e[0])){if(!this._private.panningEnabled)return this;i=e[0],a=i.x,o=i.y,Y(a)&&(t.x=a),Y(o)&&(t.y=o),this.emit(`pan viewport`)}break;case 2:if(!this._private.panningEnabled)return this;n=e[0],r=e[1],(n===`x`||n===`y`)&&Y(r)&&(t[n]=r),this.emit(`pan viewport`)}return this.notify(`viewport`),this},panBy:function(e,t){var n=arguments,r=this._private.pan,i,a,o,s,c;if(!this._private.panningEnabled)return this;switch(n.length){case 1:q(e)&&(o=n[0],s=o.x,c=o.y,Y(s)&&(r.x+=s),Y(c)&&(r.y+=c),this.emit(`pan viewport`));break;case 2:i=e,a=t,(i===`x`||i===`y`)&&Y(a)&&(r[i]+=a),this.emit(`pan viewport`)}return this.notify(`viewport`),this},gc:function(){this.notify(`gc`)},fit:function(e,t){var n=this.getFitViewport(e,t);if(n){var r=this._private;r.zoom=n.zoom,r.pan=n.pan,this.emit(`pan zoom viewport`),this.notify(`viewport`)}return this},getFitViewport:function(e,t){if(Y(e)&&t===void 0&&(t=e,e=void 0),!(!this._private.panningEnabled||!this._private.zoomingEnabled)){var n;if(W(e)){var r=e;e=this.$(r)}else if(de(e)){var i=e;n={x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2},n.w=n.x2-n.x1,n.h=n.y2-n.y1}else re(e)||(e=this.mutableElements());if(!(re(e)&&e.empty())){n||=e.boundingBox();var a=this.width(),o=this.height(),s;if(t=Y(t)?t:0,!isNaN(a)&&!isNaN(o)&&a>0&&o>0&&!isNaN(n.w)&&!isNaN(n.h)&&n.w>0&&n.h>0){s=Math.min((a-2*t)/n.w,(o-2*t)/n.h),s=s>this._private.maxZoom?this._private.maxZoom:s,s=s<this._private.minZoom?this._private.minZoom:s;var c={x:(a-s*(n.x1+n.x2))/2,y:(o-s*(n.y1+n.y2))/2};return{zoom:s,pan:c}}}}},zoomRange:function(e,t){var n=this._private;if(t==null){var r=e;e=r.min,t=r.max}return Y(e)&&Y(t)&&e<=t?(n.minZoom=e,n.maxZoom=t):Y(e)&&t===void 0&&e<=n.maxZoom?n.minZoom=e:Y(t)&&e===void 0&&t>=n.minZoom&&(n.maxZoom=t),this},minZoom:function(e){return e===void 0?this._private.minZoom:this.zoomRange({min:e})},maxZoom:function(e){return e===void 0?this._private.maxZoom:this.zoomRange({max:e})},getZoomedViewport:function(e){var t=this._private,n=t.pan,r=t.zoom,i,a,o=!1;if(t.zoomingEnabled||(o=!0),Y(e)?a=e:q(e)&&(a=e.level,e.position==null?e.renderedPosition!=null&&(i=e.renderedPosition):i=Jn(e.position,r,n),i!=null&&!t.panningEnabled&&(o=!0)),a=a>t.maxZoom?t.maxZoom:a,a=a<t.minZoom?t.minZoom:a,o||!Y(a)||a===r||i!=null&&(!Y(i.x)||!Y(i.y)))return null;if(i!=null){var s=n,c=r,l=a;return{zoomed:!0,panned:!0,zoom:l,pan:{x:-l/c*(i.x-s.x)+i.x,y:-l/c*(i.y-s.y)+i.y}}}return{zoomed:!0,panned:!1,zoom:a,pan:n}},zoom:function(e){if(e===void 0)return this._private.zoom;var t=this.getZoomedViewport(e),n=this._private;return t==null||!t.zoomed?this:(n.zoom=t.zoom,t.panned&&(n.pan.x=t.pan.x,n.pan.y=t.pan.y),this.emit(`zoom`+(t.panned?` pan`:``)+` viewport`),this.notify(`viewport`),this)},viewport:function(e){var t=this._private,n=!0,r=!0,i=[],a=!1,o=!1;if(!e||(Y(e.zoom)||(n=!1),q(e.pan)||(r=!1),!n&&!r))return this;if(n){var s=e.zoom;s<t.minZoom||s>t.maxZoom||!t.zoomingEnabled?a=!0:(t.zoom=s,i.push(`zoom`))}if(r&&(!a||!e.cancelOnFailedZoom)&&t.panningEnabled){var c=e.pan;Y(c.x)&&(t.pan.x=c.x,o=!1),Y(c.y)&&(t.pan.y=c.y,o=!1),o||i.push(`pan`)}return i.length>0&&(i.push(`viewport`),this.emit(i.join(` `)),this.notify(`viewport`)),this},center:function(e){var t=this.getCenterPan(e);return t&&(this._private.pan=t,this.emit(`pan viewport`),this.notify(`viewport`)),this},getCenterPan:function(e,t){if(this._private.panningEnabled){if(W(e)){var n=e;e=this.mutableElements().filter(n)}else re(e)||(e=this.mutableElements());if(e.length!==0){var r=e.boundingBox(),i=this.width(),a=this.height();return t=t===void 0?this._private.zoom:t,{x:(i-t*(r.x1+r.x2))/2,y:(a-t*(r.y1+r.y2))/2}}}},reset:function(){return!this._private.panningEnabled||!this._private.zoomingEnabled||this.viewport({pan:{x:0,y:0},zoom:1}),this},invalidateSize:function(){this._private.sizeCache=null},size:function(){var e=this._private,t=e.container,n=this;return e.sizeCache=e.sizeCache||(t?function(){var e=n.window().getComputedStyle(t),r=function(t){return parseFloat(e.getPropertyValue(t))};return{width:t.clientWidth-r(`padding-left`)-r(`padding-right`),height:t.clientHeight-r(`padding-top`)-r(`padding-bottom`)}}():{width:1,height:1})},width:function(){return this.size().width},height:function(){return this.size().height},extent:function(){var e=this._private.pan,t=this._private.zoom,n=this.renderedExtent(),r={x1:(n.x1-e.x)/t,x2:(n.x2-e.x)/t,y1:(n.y1-e.y)/t,y2:(n.y2-e.y)/t};return r.w=r.x2-r.x1,r.h=r.y2-r.y1,r},renderedExtent:function(){var e=this.width(),t=this.height();return{x1:0,y1:0,x2:e,y2:t,w:e,h:t}},multiClickDebounceTime:function(e){if(e)this._private.multiClickDebounceTime=e;else return this._private.multiClickDebounceTime;return this}};Td.centre=Td.center,Td.autolockNodes=Td.autolock,Td.autoungrabifyNodes=Td.autoungrabify;var Ed={data:Fc.data({field:`data`,bindingEvent:`data`,allowBinding:!0,allowSetting:!0,settingEvent:`data`,settingTriggersEvent:!0,triggerFnName:`trigger`,allowGetting:!0,updateStyle:!0}),removeData:Fc.removeData({field:`data`,event:`data`,triggerFnName:`trigger`,triggerEvent:!0,updateStyle:!0}),scratch:Fc.data({field:`scratch`,bindingEvent:`scratch`,allowBinding:!0,allowSetting:!0,settingEvent:`scratch`,settingTriggersEvent:!0,triggerFnName:`trigger`,allowGetting:!0,updateStyle:!0}),removeScratch:Fc.removeData({field:`scratch`,event:`scratch`,triggerFnName:`trigger`,triggerEvent:!0,updateStyle:!0})};Ed.attr=Ed.data,Ed.removeAttr=Ed.removeData;var Dd=function(e){var t=this;e=X({},e);var n=e.container;n&&!ne(n)&&ne(n[0])&&(n=n[0]);var r=n?n._cyreg:null;r||={},r&&r.cy&&(r.cy.destroy(),r={});var i=r.readies=r.readies||[];n&&(n._cyreg=r),r.cy=t;var a=R!==void 0&&n!==void 0&&!e.headless,o=e;o.layout=X({name:a?`grid`:`null`},o.layout),o.renderer=X({name:a?`canvas`:`null`},o.renderer);var s=function(e,t,n){return t===void 0?n===void 0?e:n:t},c=this._private={container:n,ready:!1,options:o,elements:new Hu(this),listeners:[],aniEles:new Hu(this),data:o.data||{},scratch:{},layout:null,renderer:null,destroyed:!1,notificationsEnabled:!0,minZoom:1e-50,maxZoom:1e50,zoomingEnabled:s(!0,o.zoomingEnabled),userZoomingEnabled:s(!0,o.userZoomingEnabled),panningEnabled:s(!0,o.panningEnabled),userPanningEnabled:s(!0,o.userPanningEnabled),boxSelectionEnabled:s(!0,o.boxSelectionEnabled),autolock:s(!1,o.autolock,o.autolockNodes),autoungrabify:s(!1,o.autoungrabify,o.autoungrabifyNodes),autounselectify:s(!1,o.autounselectify),styleEnabled:o.styleEnabled===void 0?a:o.styleEnabled,zoom:Y(o.zoom)?o.zoom:1,pan:{x:q(o.pan)&&Y(o.pan.x)?o.pan.x:0,y:q(o.pan)&&Y(o.pan.y)?o.pan.y:0},animation:{current:[],queue:[]},hasCompoundNodes:!1,multiClickDebounceTime:s(250,o.multiClickDebounceTime)};this.createEmitter(),this.selectionType(o.selectionType),this.zoomRange({min:o.minZoom,max:o.maxZoom});var l=function(e,t){if(e.some(fe))return Pa.all(e).then(t);t(e)};c.styleEnabled&&t.setStyle([]);var u=X({},o,o.renderer);t.initRenderer(u);var d=function(e,n,r){t.notifications(!1);var i=t.mutableElements();i.length>0&&i.remove(),e!=null&&(q(e)||K(e))&&t.add(e),t.one(`layoutready`,function(e){t.notifications(!0),t.emit(e),t.one(`load`,n),t.emitAndNotify(`load`)}).one(`layoutstop`,function(){t.one(`done`,r),t.emit(`done`)});var a=X({},t._private.options.layout);a.eles=t.elements(),t.layout(a).run()};l([o.style,o.elements],function(e){var n=e[0],a=e[1];c.styleEnabled&&t.style().append(n),d(a,function(){t.startAnimationLoop(),c.ready=!0,G(o.ready)&&t.on(`ready`,o.ready);for(var e=0;e<i.length;e++){var n=i[e];t.on(`ready`,n)}r&&(r.readies=[]),t.emit(`ready`)},o.done)})},Od=Dd.prototype;X(Od,{instanceString:function(){return`core`},isReady:function(){return this._private.ready},destroyed:function(){return this._private.destroyed},ready:function(e){return this.isReady()?this.emitter().emit(`ready`,[],e):this.on(`ready`,e),this},destroy:function(){var e=this;if(!e.destroyed())return e.stopAnimationLoop(),e.destroyRenderer(),this.emit(`destroy`),e._private.destroyed=!0,e},hasElementWithId:function(e){return this._private.elements.hasElementWithId(e)},getElementById:function(e){return this._private.elements.getElementById(e)},hasCompoundNodes:function(){return this._private.hasCompoundNodes},headless:function(){return this._private.renderer.isHeadless()},styleEnabled:function(){return this._private.styleEnabled},addToPool:function(e){return this._private.elements.merge(e),this},removeFromPool:function(e){return this._private.elements.unmerge(e),this},container:function(){return this._private.container||null},window:function(){if(this._private.container==null)return R;var e=this._private.container.ownerDocument;return e===void 0||e==null?R:e.defaultView||R},mount:function(e){if(e!=null){var t=this,n=t._private,r=n.options;return!ne(e)&&ne(e[0])&&(e=e[0]),t.stopAnimationLoop(),t.destroyRenderer(),n.container=e,n.styleEnabled=!0,t.invalidateSize(),t.initRenderer(X({},r,r.renderer,{name:r.renderer.name===`null`?`canvas`:r.renderer.name})),t.startAnimationLoop(),t.style(r.style),t.emit(`mount`),t}},unmount:function(){var e=this;return e.stopAnimationLoop(),e.destroyRenderer(),e.initRenderer({name:`null`}),e.emit(`unmount`),e},options:function(){return cn(this._private.options)},json:function(e){var t=this,n=t._private,r=t.mutableElements(),i=function(e){return t.getElementById(e.id())};if(q(e)){if(t.startBatch(),e.elements){var a={},o=function(e,n){for(var r=[],i=[],o=0;o<e.length;o++){var s=e[o];if(!s.data.id){on(`cy.json() cannot handle elements without an ID attribute`);continue}var c=``+s.data.id,l=t.getElementById(c);a[c]=!0,l.length===0?(n&&(s.group=n),r.push(s)):i.push({ele:l,json:s})}t.add(r);for(var u=0;u<i.length;u++){var d=i[u],f=d.ele,p=d.json;f.json(p)}};if(K(e.elements))o(e.elements);else for(var s=[`nodes`,`edges`],c=0;c<s.length;c++){var l=s[c],u=e.elements[l];K(u)&&o(u,l)}var d=t.collection();r.filter(function(e){return!a[e.id()]}).forEach(function(e){e.isParent()?d.merge(e):e.remove()}),d.forEach(function(e){return e.children().move({parent:null})}),d.forEach(function(e){return i(e).remove()})}e.style&&t.style(e.style),e.zoom!=null&&e.zoom!==n.zoom&&t.zoom(e.zoom),e.pan&&(e.pan.x!==n.pan.x||e.pan.y!==n.pan.y)&&t.pan(e.pan),e.data&&t.data(e.data);for(var f=[`minZoom`,`maxZoom`,`zoomingEnabled`,`userZoomingEnabled`,`panningEnabled`,`userPanningEnabled`,`boxSelectionEnabled`,`autolock`,`autoungrabify`,`autounselectify`,`multiClickDebounceTime`],p=0;p<f.length;p++){var m=f[p];e[m]!=null&&t[m](e[m])}return t.endBatch(),this}var h=!!e,g={};h?g.elements=this.elements().map(function(e){return e.json()}):(g.elements={},r.forEach(function(e){var t=e.group();g.elements[t]||(g.elements[t]=[]),g.elements[t].push(e.json())})),this._private.styleEnabled&&(g.style=t.style().json()),g.data=cn(t.data());var _=n.options;return g.zoomingEnabled=n.zoomingEnabled,g.userZoomingEnabled=n.userZoomingEnabled,g.zoom=n.zoom,g.minZoom=n.minZoom,g.maxZoom=n.maxZoom,g.panningEnabled=n.panningEnabled,g.userPanningEnabled=n.userPanningEnabled,g.pan=cn(n.pan),g.boxSelectionEnabled=n.boxSelectionEnabled,g.renderer=cn(_.renderer),g.hideEdgesOnViewport=_.hideEdgesOnViewport,g.textureOnViewport=_.textureOnViewport,g.wheelSensitivity=_.wheelSensitivity,g.motionBlur=_.motionBlur,g.multiClickDebounceTime=_.multiClickDebounceTime,g}}),Od.$id=Od.getElementById,[Wu,nd,ad,od,sd,cd,ud,dd,Cd,Td,Ed].forEach(function(e){X(Od,e)});var kd={fit:!0,directed:!1,direction:`downward`,padding:30,circle:!1,grid:!1,spacingFactor:1.75,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,roots:void 0,depthSort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}},Ad={maximal:!1,acyclic:!1},jd=function(e){return e.scratch(`breadthfirst`)},Md=function(e,t){return e.scratch(`breadthfirst`,t)};function Nd(e){this.options=X({},kd,Ad,e)}Nd.prototype.run=function(){var e=this.options,t=e.cy,n=e.eles,r=n.nodes().filter(function(e){return e.isChildless()}),i=n,a=e.directed,o=e.acyclic||e.maximal||e.maximalAdjustments>0,s=!!e.boundingBox,c=mr(s?e.boundingBox:structuredClone(t.extent())),l;if(re(e.roots))l=e.roots;else if(K(e.roots)){for(var u=[],d=0;d<e.roots.length;d++){var f=e.roots[d],p=t.getElementById(f);u.push(p)}l=t.collection(u)}else if(W(e.roots))l=t.$(e.roots);else if(a)l=r.roots();else{var m=n.components();l=t.collection();for(var h=function(){var e=m[g],t=e.maxDegree(!1),n=e.filter(function(e){return e.degree(!1)===t});l=l.add(n)},g=0;g<m.length;g++)h()}var _=[],v={},y=function(e,t){_[t]??(_[t]=[]);var n=_[t].length;_[t].push(e),Md(e,{index:n,depth:t})},b=function(e,t){var n=jd(e),r=n.depth,i=n.index;_[r][i]=null,e.isChildless()&&y(e,t)};i.bfs({roots:l,directed:e.directed,visit:function(e,t,n,r,i){var a=e[0],o=a.id();a.isChildless()&&y(a,i),v[o]=!0}});for(var x=[],S=0;S<r.length;S++){var C=r[S];v[C.id()]||x.push(C)}var w=function(e){for(var t=_[e],n=0;n<t.length;n++){var r=t[n];if(r==null){t.splice(n,1),n--;continue}Md(r,{depth:e,index:n})}},T=function(t,r){for(var i=jd(t),a=t.incomers().filter(function(e){return e.isNode()&&n.has(e)}),o=-1,s=t.id(),c=0;c<a.length;c++){var l=a[c],u=jd(l);o=Math.max(o,u.depth)}if(i.depth<=o){if(!e.acyclic&&r[s])return null;var d=o+1;return b(t,d),r[s]=d,!0}return!1};if(a&&o){var E=[],D={},O=function(e){return E.push(e)},k=function(){return E.shift()};for(r.forEach(function(e){return E.push(e)});E.length>0;){var A=k(),j=T(A,D);if(j)A.outgoers().filter(function(e){return e.isNode()&&n.has(e)}).forEach(O);else if(j===null){on("Detected double maximal shift for node `"+A.id()+"`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs.");break}}}var M=0;if(e.avoidOverlap)for(var N=0;N<r.length;N++){var P=r[N].layoutDimensions(e),F=P.w,I=P.h;M=Math.max(M,F,I)}var L={},R=function(e){if(L[e.id()])return L[e.id()];for(var t=jd(e).depth,n=e.neighborhood(),i=0,a=0,o=0;o<n.length;o++){var s=n[o];if(!(s.isEdge()||s.isParent()||!r.has(s))){var c=jd(s);if(c!=null){var l=c.index,u=c.depth;if(l!=null&&u!=null){var d=_[u].length;u<t&&(i+=l/d,a++)}}}}return a=Math.max(1,a),i/=a,a===0&&(i=0),L[e.id()]=i,i},ee=function(e,t){var n=R(e)-R(t);return n===0?De(e.id(),t.id()):n};e.depthSort!==void 0&&(ee=e.depthSort);for(var z=_.length,B=0;B<z;B++)_[B].sort(ee),w(B);for(var V=[],H=0;H<x.length;H++)V.push(x[H]);V.length&&(_.unshift(V),z=_.length,function(){for(var e=0;e<z;e++)w(e)}());for(var U=0,G=0;G<z;G++)U=Math.max(_[G].length,U);var q={x:c.x1+c.w/2,y:c.y1+c.h/2},J=r.reduce(function(t,n){return function(e){return{w:t.w===-1?e.w:(t.w+e.w)/2,h:t.h===-1?e.h:(t.h+e.h)/2}}(n.boundingBox({includeLabels:e.nodeDimensionsIncludeLabels}))},{w:-1,h:-1}),Y=Math.max(z===1?0:s?(c.h-e.padding*2-J.h)/(z-1):(c.h-e.padding*2-J.h)/(z+1),M),te=_.reduce(function(e,t){return Math.max(e,t.length)},0),ne=function(t){var n=jd(t),r=n.depth,i=n.index;if(e.circle){var a=Math.min(c.w/2/z,c.h/2/z);a=Math.max(a,M);var o=a*r+a-(z>0&&_[0].length<=3?a/2:0),l=2*Math.PI/_[r].length*i;return r===0&&_[0].length===1&&(o=1),{x:q.x+o*Math.cos(l),y:q.y+o*Math.sin(l)}}var u=_[r].length,d=Math.max(u===1?0:s?(c.w-e.padding*2-J.w)/((e.grid?te:u)-1):(c.w-e.padding*2-J.w)/((e.grid?te:u)+1),M);return{x:q.x+(i+1-(u+1)/2)*d,y:q.y+(r+1-(z+1)/2)*Y}},ie={downward:0,leftward:90,upward:180,rightward:-90};return Object.keys(ie).indexOf(e.direction)===-1&&rn(`Invalid direction '${e.direction}' specified for breadthfirst layout. Valid values are: ${Object.keys(ie).join(`, `)}`),n.nodes().layoutPositions(this,e,function(t){return Jt(ne(t),c,ie[e.direction])}),this};var Pd={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,radius:void 0,startAngle:3/2*Math.PI,sweep:void 0,clockwise:!0,sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function Fd(e){this.options=X({},Pd,e)}Fd.prototype.run=function(){var e=this.options,t=e,n=e.cy,r=t.eles,i=t.counterclockwise===void 0?t.clockwise:!t.counterclockwise,a=r.nodes().not(`:parent`);t.sort&&(a=a.sort(t.sort));for(var o=mr(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()}),s={x:o.x1+o.w/2,y:o.y1+o.h/2},c=(t.sweep===void 0?2*Math.PI-2*Math.PI/a.length:t.sweep)/Math.max(1,a.length-1),l,u=0,d=0;d<a.length;d++){var f=a[d].layoutDimensions(t),p=f.w,m=f.h;u=Math.max(u,p,m)}if(l=Y(t.radius)?t.radius:a.length<=1?0:Math.min(o.h,o.w)/2-u,a.length>1&&t.avoidOverlap){u*=1.75;var h=Math.cos(c)-Math.cos(0),g=Math.sin(c)-Math.sin(0),_=Math.sqrt(u*u/(h*h+g*g));l=Math.max(_,l)}return r.nodes().layoutPositions(this,t,function(e,n){var r=t.startAngle+n*c*(i?1:-1),a=l*Math.cos(r),o=l*Math.sin(r);return{x:s.x+a,y:s.y+o}}),this};var Id={fit:!0,padding:30,startAngle:3/2*Math.PI,sweep:void 0,clockwise:!0,equidistant:!1,minNodeSpacing:10,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,height:void 0,width:void 0,spacingFactor:void 0,concentric:function(e){return e.degree()},levelWidth:function(e){return e.maxDegree()/4},animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function Ld(e){this.options=X({},Id,e)}Ld.prototype.run=function(){for(var e=this.options,t=e,n=t.counterclockwise===void 0?t.clockwise:!t.counterclockwise,r=e.cy,i=t.eles,a=i.nodes().not(`:parent`),o=mr(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()}),s={x:o.x1+o.w/2,y:o.y1+o.h/2},c=[],l=0,u=0;u<a.length;u++){var d=a[u],f=void 0;f=t.concentric(d),c.push({value:f,node:d}),d._private.scratch.concentric=f}a.updateStyle();for(var p=0;p<a.length;p++){var m=a[p].layoutDimensions(t);l=Math.max(l,m.w,m.h)}c.sort(function(e,t){return t.value-e.value});for(var h=t.levelWidth(a),g=[[]],_=g[0],v=0;v<c.length;v++){var y=c[v];_.length>0&&Math.abs(_[0].value-y.value)>=h&&(_=[],g.push(_)),_.push(y)}var b=l+t.minNodeSpacing;if(!t.avoidOverlap){var x=g.length>0&&g[0].length>1,S=(Math.min(o.w,o.h)/2-b)/(g.length+x?1:0);b=Math.min(b,S)}for(var C=0,w=0;w<g.length;w++){var T=g[w],E=T.dTheta=(t.sweep===void 0?2*Math.PI-2*Math.PI/T.length:t.sweep)/Math.max(1,T.length-1);if(T.length>1&&t.avoidOverlap){var D=Math.cos(E)-Math.cos(0),O=Math.sin(E)-Math.sin(0),k=Math.sqrt(b*b/(D*D+O*O));C=Math.max(k,C)}T.r=C,C+=b}if(t.equidistant){for(var A=0,j=0,M=0;M<g.length;M++){var N=g[M].r-j;A=Math.max(A,N)}j=0;for(var P=0;P<g.length;P++){var F=g[P];P===0&&(j=F.r),F.r=j,j+=A}}for(var I={},L=0;L<g.length;L++)for(var R=g[L],ee=R.dTheta,z=R.r,B=0;B<R.length;B++){var V=R[B],H=t.startAngle+(n?1:-1)*ee*B,U={x:s.x+z*Math.cos(H),y:s.y+z*Math.sin(H)};I[V.node.id()]=U}return i.nodes().layoutPositions(this,t,function(e){return I[e.id()]}),this};var Rd,zd={ready:function(){},stop:function(){},animate:!0,animationEasing:void 0,animationDuration:void 0,animateFilter:function(e,t){return!0},animationThreshold:250,refresh:20,fit:!0,padding:30,boundingBox:void 0,nodeDimensionsIncludeLabels:!1,randomize:!1,componentSpacing:40,nodeRepulsion:function(e){return 2048},nodeOverlap:4,idealEdgeLength:function(e){return 32},edgeElasticity:function(e){return 32},nestingFactor:1.2,gravity:1,numIter:1e3,initialTemp:1e3,coolingFactor:.99,minTemp:1};function Bd(e){this.options=X({},zd,e),this.options.layout=this;var t=this.options.eles.nodes(),n=this.options.eles.edges().filter(function(e){var n=e.source().data(`id`),r=e.target().data(`id`),i=t.some(function(e){return e.data(`id`)===n}),a=t.some(function(e){return e.data(`id`)===r});return!i||!a});this.options.eles=this.options.eles.not(n)}Bd.prototype.run=function(){var e=this.options,t=e.cy,n=this;n.stopped=!1,(e.animate===!0||e.animate===!1)&&n.emit({type:`layoutstart`,layout:n}),Rd=!0===e.debug;var r=Vd(t,n,e);Rd&&Wd(r),e.randomize&&Gd(r);var i=Mt(),a=function(){qd(r,t,e),!0===e.fit&&t.fit(e.padding)},o=function(t){return!(n.stopped||t>=e.numIter||(Jd(r,e),r.temperature*=e.coolingFactor,r.temperature<e.minTemp))},s=function(){if(e.animate===!0||e.animate===!1)a(),n.one(`layoutstop`,e.stop),n.emit({type:`layoutstop`,layout:n});else{var t=e.eles.nodes(),i=Kd(r,e,t);t.layoutPositions(n,e,i)}},c=0,l=!0;if(e.animate===!0){var u=function(){for(var t=0;l&&t<e.refresh;)l=o(c),c++,t++;l?(Mt()-i>=e.animationThreshold&&a(),jt(u)):(sf(r,e),s())};u()}else{for(;l;)l=o(c),c++;sf(r,e),s()}return this},Bd.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit(`layoutstop`),this},Bd.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var Vd=function(e,t,n){for(var r=n.eles.edges(),i=n.eles.nodes(),a=mr(n.boundingBox?n.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),o={isCompound:e.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:i.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:r.size(),temperature:n.initialTemp,clientWidth:a.w,clientHeight:a.h,boundingBox:a},s=n.eles.components(),c={},l=0;l<s.length;l++)for(var u=s[l],d=0;d<u.length;d++){var f=u[d];c[f.id()]=l}for(var l=0;l<o.nodeSize;l++){var p=i[l],m=p.layoutDimensions(n),h={};h.isLocked=p.locked(),h.id=p.data(`id`),h.parentId=p.data(`parent`),h.cmptId=c[p.id()],h.children=[],h.positionX=p.position(`x`),h.positionY=p.position(`y`),h.offsetX=0,h.offsetY=0,h.height=m.w,h.width=m.h,h.maxX=h.positionX+h.width/2,h.minX=h.positionX-h.width/2,h.maxY=h.positionY+h.height/2,h.minY=h.positionY-h.height/2,h.padLeft=parseFloat(p.style(`padding`)),h.padRight=parseFloat(p.style(`padding`)),h.padTop=parseFloat(p.style(`padding`)),h.padBottom=parseFloat(p.style(`padding`)),h.nodeRepulsion=G(n.nodeRepulsion)?n.nodeRepulsion(p):n.nodeRepulsion,o.layoutNodes.push(h),o.idToIndex[h.id]=l}for(var g=[],_=0,v=-1,y=[],l=0;l<o.nodeSize;l++){var p=o.layoutNodes[l],b=p.parentId;b==null?(g[++v]=p.id,y.push(p.id)):o.layoutNodes[o.idToIndex[b]].children.push(p.id)}for(o.graphSet.push(y);_<=v;){var x=g[_++],S=o.idToIndex[x],f=o.layoutNodes[S],C=f.children;if(C.length>0){o.graphSet.push(C);for(var l=0;l<C.length;l++)g[++v]=C[l]}}for(var l=0;l<o.graphSet.length;l++)for(var w=o.graphSet[l],d=0;d<w.length;d++){var T=o.idToIndex[w[d]];o.indexToGraph[T]=l}for(var l=0;l<o.edgeSize;l++){var E=r[l],D={};D.id=E.data(`id`),D.sourceId=E.data(`source`),D.targetId=E.data(`target`);var O=G(n.idealEdgeLength)?n.idealEdgeLength(E):n.idealEdgeLength,k=G(n.edgeElasticity)?n.edgeElasticity(E):n.edgeElasticity,A=o.idToIndex[D.sourceId],j=o.idToIndex[D.targetId];if(o.indexToGraph[A]!=o.indexToGraph[j]){for(var M=Hd(D.sourceId,D.targetId,o),N=o.graphSet[M],P=0,h=o.layoutNodes[A];N.indexOf(h.id)===-1;)h=o.layoutNodes[o.idToIndex[h.parentId]],P++;for(h=o.layoutNodes[j];N.indexOf(h.id)===-1;)h=o.layoutNodes[o.idToIndex[h.parentId]],P++;O*=P*n.nestingFactor}D.idealLength=O,D.elasticity=k,o.layoutEdges.push(D)}return o},Hd=function(e,t,n){var r=Ud(e,t,0,n);return 2>r.count?0:r.graph},Ud=function(e,t,n,r){var i=r.graphSet[n];if(-1<i.indexOf(e)&&-1<i.indexOf(t))return{count:2,graph:n};for(var a=0,o=0;o<i.length;o++){var s=i[o],c=r.idToIndex[s],l=r.layoutNodes[c].children;if(l.length!==0){var u=r.indexToGraph[r.idToIndex[l[0]]],d=Ud(e,t,u,r);if(d.count!==0){if(d.count===1){if(a++,a===2)break}else return d}}}return{count:a,graph:n}},Wd,Gd=function(e,t){for(var n=e.clientWidth,r=e.clientHeight,i=0;i<e.nodeSize;i++){var a=e.layoutNodes[i];a.children.length===0&&!a.isLocked&&(a.positionX=Math.random()*n,a.positionY=Math.random()*r)}},Kd=function(e,t,n){var r=e.boundingBox,i={x1:1/0,x2:-1/0,y1:1/0,y2:-1/0};return t.boundingBox&&(n.forEach(function(t){var n=e.layoutNodes[e.idToIndex[t.data(`id`)]];i.x1=Math.min(i.x1,n.positionX),i.x2=Math.max(i.x2,n.positionX),i.y1=Math.min(i.y1,n.positionY),i.y2=Math.max(i.y2,n.positionY)}),i.w=i.x2-i.x1,i.h=i.y2-i.y1),function(n,a){var o=e.layoutNodes[e.idToIndex[n.data(`id`)]];if(t.boundingBox){var s=i.w===0?.5:(o.positionX-i.x1)/i.w,c=i.h===0?.5:(o.positionY-i.y1)/i.h;return{x:r.x1+s*r.w,y:r.y1+c*r.h}}return{x:o.positionX,y:o.positionY}}},qd=function(e,t,n){var r=n.layout,i=n.eles.nodes(),a=Kd(e,n,i);i.positions(a),!0!==e.ready&&(e.ready=!0,r.one(`layoutready`,n.ready),r.emit({type:`layoutready`,layout:this}))},Jd=function(e,t,n){Yd(e,t),ef(e),tf(e,t),nf(e),rf(e)},Yd=function(e,t){for(var n=0;n<e.graphSet.length;n++)for(var r=e.graphSet[n],i=r.length,a=0;a<i;a++)for(var o=e.layoutNodes[e.idToIndex[r[a]]],s=a+1;s<i;s++){var c=e.layoutNodes[e.idToIndex[r[s]]];Zd(o,c,e,t)}},Xd=function(e){return-e+2*e*Math.random()},Zd=function(e,t,n,r){if(!(e.cmptId!==t.cmptId&&!n.isCompound)){var i=t.positionX-e.positionX,a=t.positionY-e.positionY,o=1;i===0&&a===0&&(i=Xd(o),a=Xd(o));var s=Qd(e,t,i,a);if(s>0)var c=r.nodeOverlap*s,l=Math.sqrt(i*i+a*a),u=c*i/l,d=c*a/l;else var f=$d(e,i,a),p=$d(t,-1*i,-1*a),m=p.x-f.x,h=p.y-f.y,g=m*m+h*h,l=Math.sqrt(g),c=(e.nodeRepulsion+t.nodeRepulsion)/g,u=c*m/l,d=c*h/l;e.isLocked||(e.offsetX-=u,e.offsetY-=d),t.isLocked||(t.offsetX+=u,t.offsetY+=d)}},Qd=function(e,t,n,r){if(n>0)var i=e.maxX-t.minX;else var i=t.maxX-e.minX;if(r>0)var a=e.maxY-t.minY;else var a=t.maxY-e.minY;return i>=0&&a>=0?Math.sqrt(i*i+a*a):0},$d=function(e,t,n){var r=e.positionX,i=e.positionY,a=e.height||1,o=e.width||1,s=n/t,c=a/o,l={};return t===0&&0<n||t===0&&0>n?(l.x=r,l.y=i+a/2,l):0<t&&-1*c<=s&&s<=c?(l.x=r+o/2,l.y=i+o*n/2/t,l):0>t&&-1*c<=s&&s<=c?(l.x=r-o/2,l.y=i-o*n/2/t,l):0<n&&(s<=-1*c||s>=c)?(l.x=r+a*t/2/n,l.y=i+a/2,l):0>n&&(s<=-1*c||s>=c)?(l.x=r-a*t/2/n,l.y=i-a/2,l):l},ef=function(e,t){for(var n=0;n<e.edgeSize;n++){var r=e.layoutEdges[n],i=e.idToIndex[r.sourceId],a=e.layoutNodes[i],o=e.idToIndex[r.targetId],s=e.layoutNodes[o],c=s.positionX-a.positionX,l=s.positionY-a.positionY;if(c!==0||l!==0){var u=$d(a,c,l),d=$d(s,-1*c,-1*l),f=d.x-u.x,p=d.y-u.y,m=Math.sqrt(f*f+p*p),h=(r.idealLength-m)**2/r.elasticity;if(m!==0)var g=h*f/m,_=h*p/m;else var g=0,_=0;a.isLocked||(a.offsetX+=g,a.offsetY+=_),s.isLocked||(s.offsetX-=g,s.offsetY-=_)}}},tf=function(e,t){if(t.gravity!==0)for(var n=1,r=0;r<e.graphSet.length;r++){var i=e.graphSet[r],a=i.length;if(r===0)var o=e.clientHeight/2,s=e.clientWidth/2;else var c=e.layoutNodes[e.idToIndex[i[0]]],l=e.layoutNodes[e.idToIndex[c.parentId]],o=l.positionX,s=l.positionY;for(var u=0;u<a;u++){var d=e.layoutNodes[e.idToIndex[i[u]]];if(!d.isLocked){var f=o-d.positionX,p=s-d.positionY,m=Math.sqrt(f*f+p*p);if(m>n){var h=t.gravity*f/m,g=t.gravity*p/m;d.offsetX+=h,d.offsetY+=g}}}}},nf=function(e,t){var n=[],r=0,i=-1;for(n.push.apply(n,e.graphSet[0]),i+=e.graphSet[0].length;r<=i;){var a=n[r++],o=e.idToIndex[a],s=e.layoutNodes[o],c=s.children;if(0<c.length&&!s.isLocked){for(var l=s.offsetX,u=s.offsetY,d=0;d<c.length;d++){var f=e.layoutNodes[e.idToIndex[c[d]]];f.offsetX+=l,f.offsetY+=u,n[++i]=c[d]}s.offsetX=0,s.offsetY=0}}},rf=function(e,t){for(var n=0;n<e.nodeSize;n++){var r=e.layoutNodes[n];0<r.children.length&&(r.maxX=void 0,r.minX=void 0,r.maxY=void 0,r.minY=void 0)}for(var n=0;n<e.nodeSize;n++){var r=e.layoutNodes[n];if(!(0<r.children.length||r.isLocked)){var i=af(r.offsetX,r.offsetY,e.temperature);r.positionX+=i.x,r.positionY+=i.y,r.offsetX=0,r.offsetY=0,r.minX=r.positionX-r.width,r.maxX=r.positionX+r.width,r.minY=r.positionY-r.height,r.maxY=r.positionY+r.height,of(r,e)}}for(var n=0;n<e.nodeSize;n++){var r=e.layoutNodes[n];0<r.children.length&&!r.isLocked&&(r.positionX=(r.maxX+r.minX)/2,r.positionY=(r.maxY+r.minY)/2,r.width=r.maxX-r.minX,r.height=r.maxY-r.minY)}},af=function(e,t,n){var r=Math.sqrt(e*e+t*t);if(r>n)var i={x:n*e/r,y:n*t/r};else var i={x:e,y:t};return i},of=function(e,t){var n=e.parentId;if(n!=null){var r=t.layoutNodes[t.idToIndex[n]],i=!1;if((r.maxX==null||e.maxX+r.padRight>r.maxX)&&(r.maxX=e.maxX+r.padRight,i=!0),(r.minX==null||e.minX-r.padLeft<r.minX)&&(r.minX=e.minX-r.padLeft,i=!0),(r.maxY==null||e.maxY+r.padBottom>r.maxY)&&(r.maxY=e.maxY+r.padBottom,i=!0),(r.minY==null||e.minY-r.padTop<r.minY)&&(r.minY=e.minY-r.padTop,i=!0),i)return of(r,t)}},sf=function(e,t){for(var n=e.layoutNodes,r=[],i=0;i<n.length;i++){var a=n[i],o=a.cmptId;(r[o]=r[o]||[]).push(a)}for(var s=0,i=0;i<r.length;i++){var c=r[i];if(c){c.x1=1/0,c.x2=-1/0,c.y1=1/0,c.y2=-1/0;for(var l=0;l<c.length;l++){var u=c[l];c.x1=Math.min(c.x1,u.positionX-u.width/2),c.x2=Math.max(c.x2,u.positionX+u.width/2),c.y1=Math.min(c.y1,u.positionY-u.height/2),c.y2=Math.max(c.y2,u.positionY+u.height/2)}c.w=c.x2-c.x1,c.h=c.y2-c.y1,s+=c.w*c.h}}r.sort(function(e,t){return t.w*t.h-e.w*e.h});for(var d=0,f=0,p=0,m=0,h=Math.sqrt(s)*e.clientWidth/e.clientHeight,i=0;i<r.length;i++){var c=r[i];if(c){for(var l=0;l<c.length;l++){var u=c[l];u.isLocked||(u.positionX+=d-c.x1,u.positionY+=f-c.y1)}d+=c.w+t.componentSpacing,p+=c.w+t.componentSpacing,m=Math.max(m,c.h),p>h&&(f+=m+t.componentSpacing,d=0,p=0,m=0)}}},cf={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,avoidOverlapPadding:10,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,condense:!1,rows:void 0,cols:void 0,position:function(e){},sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function lf(e){this.options=X({},cf,e)}lf.prototype.run=function(){var e=this.options,t=e,n=e.cy,r=t.eles,i=r.nodes().not(`:parent`);t.sort&&(i=i.sort(t.sort));var a=mr(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()});if(a.h===0||a.w===0)r.nodes().layoutPositions(this,t,function(e){return{x:a.x1,y:a.y1}});else{var o=i.size(),s=Math.sqrt(o*a.h/a.w),c=Math.round(s),l=Math.round(a.w/a.h*s),u=function(e){if(e==null)return Math.min(c,l);Math.min(c,l)==c?c=e:l=e},d=function(e){if(e==null)return Math.max(c,l);Math.max(c,l)==c?c=e:l=e},f=t.rows,p=t.cols==null?t.columns:t.cols;if(f!=null&&p!=null)c=f,l=p;else if(f!=null&&p==null)c=f,l=Math.ceil(o/c);else if(f==null&&p!=null)l=p,c=Math.ceil(o/l);else if(l*c>o){var m=u(),h=d();(m-1)*h>=o?u(m-1):(h-1)*m>=o&&d(h-1)}else for(;l*c<o;){var g=u(),_=d();(_+1)*g>=o?d(_+1):u(g+1)}var v=a.w/l,y=a.h/c;if(t.condense&&(v=0,y=0),t.avoidOverlap)for(var b=0;b<i.length;b++){var x=i[b],S=x._private.position;(S.x==null||S.y==null)&&(S.x=0,S.y=0);var C=x.layoutDimensions(t),w=t.avoidOverlapPadding,T=C.w+w,E=C.h+w;v=Math.max(v,T),y=Math.max(y,E)}for(var D={},O=function(e,t){return!!D[`c-`+e+`-`+t]},k=function(e,t){D[`c-`+e+`-`+t]=!0},A=0,j=0,M=function(){j++,j>=l&&(j=0,A++)},N={},P=0;P<i.length;P++){var F=i[P],I=t.position(F);if(I&&(I.row!==void 0||I.col!==void 0)){var L={row:I.row,col:I.col};if(L.col===void 0)for(L.col=0;O(L.row,L.col);)L.col++;else if(L.row===void 0)for(L.row=0;O(L.row,L.col);)L.row++;N[F.id()]=L,k(L.row,L.col)}}i.layoutPositions(this,t,function(e,t){var n,r;if(e.locked()||e.isParent())return!1;var i=N[e.id()];if(i)n=i.col*v+v/2+a.x1,r=i.row*y+y/2+a.y1;else{for(;O(A,j);)M();n=j*v+v/2+a.x1,r=A*y+y/2+a.y1,k(A,j),M()}return{x:n,y:r}})}return this};var uf={ready:function(){},stop:function(){}};function df(e){this.options=X({},uf,e)}df.prototype.run=function(){var e=this.options,t=e.eles,n=this;return e.cy,n.emit(`layoutstart`),t.nodes().positions(function(){return{x:0,y:0}}),n.one(`layoutready`,e.ready),n.emit(`layoutready`),n.one(`layoutstop`,e.stop),n.emit(`layoutstop`),this},df.prototype.stop=function(){return this};var ff={positions:void 0,zoom:void 0,pan:void 0,fit:!0,padding:30,spacingFactor:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function pf(e){this.options=X({},ff,e)}pf.prototype.run=function(){var e=this.options,t=e.eles.nodes(),n=G(e.positions);function r(t){return e.positions==null?qn(t.position()):n?e.positions(t):e.positions[t._private.data.id]??null}return t.layoutPositions(this,e,function(e,t){var n=r(e);return e.locked()||n==null?!1:n}),this};var mf={fit:!0,padding:30,boundingBox:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function hf(e){this.options=X({},mf,e)}hf.prototype.run=function(){var e=this.options,t=e.cy,n=e.eles,r=mr(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:t.width(),h:t.height()});return n.nodes().layoutPositions(this,e,function(e,t){return{x:r.x1+Math.round(Math.random()*r.w),y:r.y1+Math.round(Math.random()*r.h)}}),this};var gf=[{name:`breadthfirst`,impl:Nd},{name:`circle`,impl:Fd},{name:`concentric`,impl:Ld},{name:`cose`,impl:Bd},{name:`grid`,impl:lf},{name:`null`,impl:df},{name:`preset`,impl:pf},{name:`random`,impl:hf}];function _f(e){this.options=e,this.notifications=0}var vf=function(){},yf=function(){throw Error(`A headless instance can not render images`)};_f.prototype={recalculateRenderedStyle:vf,notify:function(){this.notifications++},init:vf,isHeadless:function(){return!0},png:yf,jpg:yf};var bf={};bf.arrowShapeWidth=.3,bf.registerArrowShapes=function(){var e=this.arrowShapes={},t=this,n=function(e,t,n,r,i,a,o){var s=i.x-n/2-o,c=i.x+n/2+o,l=i.y-n/2-o,u=i.y+n/2+o;return s<=e&&e<=c&&l<=t&&t<=u},r=function(e,t,n,r,i){var a=e*Math.cos(r)-t*Math.sin(r),o=e*Math.sin(r)+t*Math.cos(r),s=a*n,c=o*n;return{x:s+i.x,y:c+i.y}},i=function(e,t,n,i){for(var a=[],o=0;o<e.length;o+=2){var s=e[o],c=e[o+1];a.push(r(s,c,t,n,i))}return a},a=function(e){for(var t=[],n=0;n<e.length;n++){var r=e[n];t.push(r.x,r.y)}return t},o=function(e){return e.pstyle(`width`).pfValue*e.pstyle(`arrow-scale`).pfValue*2},s=function(r,s){W(s)&&(s=e[s]),e[r]=X({name:r,points:[-.15,-.3,.15,-.3,.15,.3,-.15,.3],collide:function(e,t,n,r,o,s){return Ir(e,t,a(i(this.points,n+2*s,r,o)))},roughCollide:n,draw:function(e,n,r,a){var o=i(this.points,n,r,a);t.arrowShapeImpl(`polygon`)(e,o)},spacing:function(e){return 0},gap:o},s)};s(`none`,{collide:en,roughCollide:en,draw:nn,spacing:tn,gap:tn}),s(`triangle`,{points:[-.15,-.3,0,0,.15,-.3]}),s(`arrow`,`triangle`),s(`triangle-backcurve`,{points:e.triangle.points,controlPoint:[0,-.15],roughCollide:n,draw:function(e,n,a,o,s){var c=i(this.points,n,a,o),l=this.controlPoint,u=r(l[0],l[1],n,a,o);t.arrowShapeImpl(this.name)(e,c,u)},gap:function(e){return o(e)*.8}}),s(`triangle-tee`,{points:[0,0,.15,-.3,-.15,-.3,0,0],pointsTee:[-.15,-.4,-.15,-.5,.15,-.5,.15,-.4],collide:function(e,t,n,r,o,s,c){var l=a(i(this.points,n+2*c,r,o)),u=a(i(this.pointsTee,n+2*c,r,o));return Ir(e,t,l)||Ir(e,t,u)},draw:function(e,n,r,a,o){var s=i(this.points,n,r,a),c=i(this.pointsTee,n,r,a);t.arrowShapeImpl(this.name)(e,s,c)}}),s(`circle-triangle`,{radius:.15,pointsTr:[0,-.15,.15,-.45,-.15,-.45,0,-.15],collide:function(e,t,n,r,o,s,c){var l=o,u=(l.x-e)**2+(l.y-t)**2<=((n+2*c)*this.radius)**2;return Ir(e,t,a(i(this.points,n+2*c,r,o)))||u},draw:function(e,n,r,a,o){var s=i(this.pointsTr,n,r,a);t.arrowShapeImpl(this.name)(e,s,a.x,a.y,this.radius*n)},spacing:function(e){return t.getArrowWidth(e.pstyle(`width`).pfValue,e.pstyle(`arrow-scale`).value)*this.radius}}),s(`triangle-cross`,{points:[0,0,.15,-.3,-.15,-.3,0,0],baseCrossLinePts:[-.15,-.4,-.15,-.4,.15,-.4,.15,-.4],crossLinePts:function(e,t){var n=this.baseCrossLinePts.slice(),r=t/e,i=3,a=5;return n[i]=n[i]-r,n[a]=n[a]-r,n},collide:function(e,t,n,r,o,s,c){var l=a(i(this.points,n+2*c,r,o)),u=a(i(this.crossLinePts(n,s),n+2*c,r,o));return Ir(e,t,l)||Ir(e,t,u)},draw:function(e,n,r,a,o){var s=i(this.points,n,r,a),c=i(this.crossLinePts(n,o),n,r,a);t.arrowShapeImpl(this.name)(e,s,c)}}),s(`vee`,{points:[-.15,-.3,0,0,.15,-.3,0,-.15],gap:function(e){return o(e)*.525}}),s(`circle`,{radius:.15,collide:function(e,t,n,r,i,a,o){var s=i;return(s.x-e)**2+(s.y-t)**2<=((n+2*o)*this.radius)**2},draw:function(e,n,r,i,a){t.arrowShapeImpl(this.name)(e,i.x,i.y,this.radius*n)},spacing:function(e){return t.getArrowWidth(e.pstyle(`width`).pfValue,e.pstyle(`arrow-scale`).value)*this.radius}}),s(`tee`,{points:[-.15,0,-.15,-.1,.15,-.1,.15,0],spacing:function(e){return 1},gap:function(e){return 1}}),s(`square`,{points:[-.15,0,.15,0,.15,-.3,-.15,-.3]}),s(`diamond`,{points:[-.15,-.15,0,-.3,.15,-.15,0,0],gap:function(e){return e.pstyle(`width`).pfValue*e.pstyle(`arrow-scale`).value}}),s(`chevron`,{points:[0,0,-.15,-.15,-.1,-.2,0,-.1,.1,-.2,.15,-.15],gap:function(e){return .95*e.pstyle(`width`).pfValue*e.pstyle(`arrow-scale`).value}})};var xf={};xf.projectIntoViewport=function(e,t){var n=this.cy,r=this.findContainerClientCoords(),i=r[0],a=r[1],o=r[4],s=n.pan(),c=n.zoom();return[((e-i)/o-s.x)/c,((t-a)/o-s.y)/c]},xf.findContainerClientCoords=function(){if(this.containerBB)return this.containerBB;var e=this.container,t=e.getBoundingClientRect(),n=this.cy.window().getComputedStyle(e),r=function(e){return parseFloat(n.getPropertyValue(e))},i={left:r(`padding-left`),right:r(`padding-right`),top:r(`padding-top`),bottom:r(`padding-bottom`)},a={left:r(`border-left-width`),right:r(`border-right-width`),top:r(`border-top-width`),bottom:r(`border-bottom-width`)},o=e.clientWidth,s=e.clientHeight,c=i.left+i.right,l=i.top+i.bottom,u=a.left+a.right,d=t.width/(o+u),f=o-c,p=s-l,m=t.left+i.left+a.left,h=t.top+i.top+a.top;return this.containerBB=[m,h,f,p,d]},xf.invalidateContainerClientCoordsCache=function(){this.containerBB=null},xf.findNearestElement=function(e,t,n,r){return this.findNearestElements(e,t,n,r)[0]},xf.findNearestElements=function(e,t,n,r){var i=this,a=this,o=a.getCachedZSortedEles(),s=[],c=a.cy.zoom(),l=a.cy.hasCompoundNodes(),u=(r?24:8)/c,d=(r?8:2)/c,f=(r?8:2)/c,p=1/0,m,h;n&&(o=o.interactive);function g(e,t){if(e.isNode()){if(h)return;h=e,s.push(e)}if(e.isEdge()&&(t==null||t<p)){if(m){if(m.pstyle(`z-compound-depth`).value===e.pstyle(`z-compound-depth`).value&&m.pstyle(`z-compound-depth`).value===e.pstyle(`z-compound-depth`).value){for(var n=0;n<s.length;n++)if(s[n].isEdge()){s[n]=e,m=e,p=t??p;break}}}else s.push(e),m=e,p=t??p}}function _(n){var r=n.outerWidth()+2*d,o=n.outerHeight()+2*d,s=r/2,c=o/2,l=n.position(),u=n.pstyle(`corner-radius`).value===`auto`?`auto`:n.pstyle(`corner-radius`).pfValue,f=n._private.rscratch;if(l.x-s<=e&&e<=l.x+s&&l.y-c<=t&&t<=l.y+c&&a.nodeShapes[i.getNodeShape(n)].checkPoint(e,t,0,r,o,l.x,l.y,u,f))return g(n,0),!0}function v(n){var r=n._private,o=r.rscratch,c=n.pstyle(`width`).pfValue,d=n.pstyle(`arrow-scale`).value,f=c/2+u,p=f*f,m=f*2,h=r.source,v=r.target,y;if(o.edgeType===`segments`||o.edgeType===`straight`||o.edgeType===`haystack`){for(var b=o.allpts,x=0;x+3<b.length;x+=2)if(Ar(e,t,b[x],b[x+1],b[x+2],b[x+3],m)&&p>(y=Fr(e,t,b[x],b[x+1],b[x+2],b[x+3])))return g(n,y),!0}else if(o.edgeType===`bezier`||o.edgeType===`multibezier`||o.edgeType===`self`||o.edgeType===`compound`){for(var b=o.allpts,x=0;x+5<o.allpts.length;x+=4)if(jr(e,t,b[x],b[x+1],b[x+2],b[x+3],b[x+4],b[x+5],m)&&p>(y=Pr(e,t,b[x],b[x+1],b[x+2],b[x+3],b[x+4],b[x+5])))return g(n,y),!0}for(var h=h||r.source,v=v||r.target,S=i.getArrowWidth(c,d),C=[{name:`source`,x:o.arrowStartX,y:o.arrowStartY,angle:o.srcArrowAngle},{name:`target`,x:o.arrowEndX,y:o.arrowEndY,angle:o.tgtArrowAngle},{name:`mid-source`,x:o.midX,y:o.midY,angle:o.midsrcArrowAngle},{name:`mid-target`,x:o.midX,y:o.midY,angle:o.midtgtArrowAngle}],x=0;x<C.length;x++){var w=C[x],T=a.arrowShapes[n.pstyle(w.name+`-arrow-shape`).value],E=n.pstyle(`width`).pfValue;if(T.roughCollide(e,t,S,w.angle,{x:w.x,y:w.y},E,u)&&T.collide(e,t,S,w.angle,{x:w.x,y:w.y},E,u))return g(n),!0}l&&s.length>0&&(_(h),_(v))}function y(e,t,n){return _n(e,t,n)}function b(n,r){var i=n._private,a=f,o=r?r+`-`:``;n.boundingBox();var s=i.labelBounds[r||`main`],c=n.pstyle(o+`label`).value;if(!(n.pstyle(`text-events`).strValue!==`yes`||!c)){var l=y(i.rscratch,`labelX`,r),u=y(i.rscratch,`labelY`,r),d=y(i.rscratch,`labelAngle`,r),p=n.pstyle(o+`text-margin-x`).pfValue,m=n.pstyle(o+`text-margin-y`).pfValue,h=s.x1-a-p,_=s.x2+a-p,v=s.y1-a-m,b=s.y2+a-m;if(d){var x=Math.cos(d),S=Math.sin(d),C=function(e,t){return e-=l,t-=u,{x:e*x-t*S+l,y:e*S+t*x+u}},w=C(h,v),T=C(h,b),E=C(_,v),D=C(_,b);if(Ir(e,t,[w.x+p,w.y+m,E.x+p,E.y+m,D.x+p,D.y+m,T.x+p,T.y+m]))return g(n),!0}else if(Cr(s,e,t))return g(n),!0}}for(var x=o.length-1;x>=0;x--){var S=o[x];S.isNode()?_(S)||b(S):v(S)||b(S)||b(S,`source`)||b(S,`target`)}return s},xf.getAllInBox=function(e,t,n,r){var i=this.getCachedZSortedEles().interactive,a=2/this.cy.zoom(),o=[],s=Math.min(e,n),c=Math.max(e,n),l=Math.min(t,r),u=Math.max(t,r);e=s,n=c,t=l,r=u;var d=mr({x1:e,y1:t,x2:n,y2:r}),f=[{x:d.x1,y:d.y1},{x:d.x2,y:d.y1},{x:d.x2,y:d.y2},{x:d.x1,y:d.y2}],p=[[f[0],f[1]],[f[1],f[2]],[f[2],f[3]],[f[3],f[0]]];function m(e,t,n){return _n(e,t,n)}function h(e,t){var n=e._private,r=a,i=``;e.boundingBox();var o=n.labelBounds.main;if(!o)return null;var s=m(n.rscratch,`labelX`,t),c=m(n.rscratch,`labelY`,t),l=m(n.rscratch,`labelAngle`,t),u=e.pstyle(i+`text-margin-x`).pfValue,d=e.pstyle(i+`text-margin-y`).pfValue,f=o.x1-r-u,p=o.x2+r-u,h=o.y1-r-d,g=o.y2+r-d;if(l){var _=Math.cos(l),v=Math.sin(l),y=function(e,t){return e-=s,t-=c,{x:e*_-t*v+s,y:e*v+t*_+c}};return[y(f,h),y(p,h),y(p,g),y(f,g)]}return[{x:f,y:h},{x:p,y:h},{x:p,y:g},{x:f,y:g}]}function g(e,t,n,r){function i(e,t,n){return(n.y-e.y)*(t.x-e.x)>(t.y-e.y)*(n.x-e.x)}return i(e,n,r)!==i(t,n,r)&&i(e,t,n)!==i(e,t,r)}for(var _=0;_<i.length;_++){var v=i[_];if(v.isNode()){var y=v,b=y.pstyle(`text-events`).strValue===`yes`,x=y.pstyle(`box-selection`).strValue,S=y.pstyle(`box-select-labels`).strValue===`yes`;if(x===`none`)continue;var C=(x===`overlap`||S)&&b,w=y.boundingBox({includeNodes:!0,includeEdges:!1,includeLabels:C});if(x===`contain`){var T=!1;if(S&&b){var E=h(y);E&&ii(E,f)&&(o.push(y),T=!0)}!T&&Tr(d,w)&&o.push(y)}else if(x===`overlap`&&Sr(d,w)){var D=y.boundingBox({includeNodes:!0,includeEdges:!0,includeLabels:!1,includeMainLabels:!1,includeSourceLabels:!1,includeTargetLabels:!1});if(ii([{x:D.x1,y:D.y1},{x:D.x2,y:D.y1},{x:D.x2,y:D.y2},{x:D.x1,y:D.y2}],f))o.push(y);else{var O=h(y);O&&ii(O,f)&&o.push(y)}}}else{var k=v,A=k._private,j=A.rscratch,N=k.pstyle(`box-selection`).strValue;if(N===`none`)continue;if(N===`contain`){if(j.startX!=null&&j.startY!=null&&!Cr(d,j.startX,j.startY)||j.endX!=null&&j.endY!=null&&!Cr(d,j.endX,j.endY))continue;if(j.edgeType===`bezier`||j.edgeType===`multibezier`||j.edgeType===`self`||j.edgeType===`compound`||j.edgeType===`segments`||j.edgeType===`haystack`){for(var P=A.rstyle.bezierPts||A.rstyle.linePts||A.rstyle.haystackPts,F=!0,I=0;I<P.length;I++)if(!wr(d,P[I])){F=!1;break}F&&o.push(k)}else j.edgeType===`straight`&&o.push(k)}else if(N===`overlap`){var L=!1;if(j.startX!=null&&j.startY!=null&&j.endX!=null&&j.endY!=null&&(Cr(d,j.startX,j.startY)||Cr(d,j.endX,j.endY)))o.push(k),L=!0;else if(!L&&j.edgeType===`haystack`){for(var R=A.rstyle.haystackPts,ee=0;ee<R.length;ee++)if(wr(d,R[ee])){o.push(k),L=!0;break}}if(!L){var z=A.rstyle.bezierPts||A.rstyle.linePts||A.rstyle.haystackPts;if((!z||z.length<2)&&j.edgeType===`straight`&&j.startX!=null&&j.startY!=null&&j.endX!=null&&j.endY!=null&&(z=[{x:j.startX,y:j.startY},{x:j.endX,y:j.endY}]),!z||z.length<2)continue;for(var B=0;B<z.length-1;B++){for(var V=z[B],H=z[B+1],U=0;U<p.length;U++){var W=M(p[U],2),G=W[0],K=W[1];if(g(V,H,G,K)){o.push(k),L=!0;break}}if(L)break}}}}}return o};var Sf={};Sf.calculateArrowAngles=function(e){var t=e._private.rscratch,n=t.edgeType===`haystack`,r=t.edgeType===`bezier`,i=t.edgeType===`multibezier`,a=t.edgeType===`segments`,o=t.edgeType===`compound`,s=t.edgeType===`self`,c,l,u,d,f,p,m,h;if(n?(u=t.haystackPts[0],d=t.haystackPts[1],f=t.haystackPts[2],p=t.haystackPts[3]):(u=t.arrowStartX,d=t.arrowStartY,f=t.arrowEndX,p=t.arrowEndY),m=t.midX,h=t.midY,a)c=u-t.segpts[0],l=d-t.segpts[1];else if(i||o||s||r){var g=t.allpts,_=ur(g[0],g[2],g[4],.1),v=ur(g[1],g[3],g[5],.1);c=u-_,l=d-v}else c=u-m,l=d-h;t.srcArrowAngle=ir(c,l);var m=t.midX,h=t.midY;if(n&&(m=(u+f)/2,h=(d+p)/2),c=f-u,l=p-d,a){var g=t.allpts;if(g.length/2%2==0){var y=g.length/2,b=y-2;c=g[y]-g[b],l=g[y+1]-g[b+1]}else if(t.isRound)c=t.midVector[1],l=-t.midVector[0];else{var y=g.length/2-1,b=y-2;c=g[y]-g[b],l=g[y+1]-g[b+1]}}else if(i||o||s){var g=t.allpts,x=t.ctrlpts,S,C,w,T;if(x.length/2%2==0){var E=g.length/2-1,D=E+2,O=D+2;S=ur(g[E],g[D],g[O],0),C=ur(g[E+1],g[D+1],g[O+1],0),w=ur(g[E],g[D],g[O],1e-4),T=ur(g[E+1],g[D+1],g[O+1],1e-4)}else{var D=g.length/2-1,E=D-2,O=D+2;S=ur(g[E],g[D],g[O],.4999),C=ur(g[E+1],g[D+1],g[O+1],.4999),w=ur(g[E],g[D],g[O],.5),T=ur(g[E+1],g[D+1],g[O+1],.5)}c=w-S,l=T-C}if(t.midtgtArrowAngle=ir(c,l),t.midDispX=c,t.midDispY=l,c*=-1,l*=-1,a){var g=t.allpts;if(g.length/2%2!=0&&!t.isRound){var y=g.length/2-1,k=y+2;c=-(g[k]-g[y]),l=-(g[k+1]-g[y+1])}}if(t.midsrcArrowAngle=ir(c,l),a)c=f-t.segpts[t.segpts.length-2],l=p-t.segpts[t.segpts.length-1];else if(i||o||s||r){var g=t.allpts,A=g.length,_=ur(g[A-6],g[A-4],g[A-2],.9),v=ur(g[A-5],g[A-3],g[A-1],.9);c=f-_,l=p-v}else c=f-m,l=p-h;t.tgtArrowAngle=ir(c,l)},Sf.getArrowWidth=Sf.getArrowHeight=function(e,t){var n=this.arrowWidthCache=this.arrowWidthCache||{},r=n[e+`, `+t];return r||(r=Math.max((e*13.37)**.9,29)*t,n[e+`, `+t]=r,r)};var Cf,wf,Tf={},Ef={},Df,Of,kf,Af,jf,Mf,Nf,Pf,Ff,If,Lf,Rf,zf,Bf,Vf,Hf=function(e,t,n){n.x=t.x-e.x,n.y=t.y-e.y,n.len=Math.sqrt(n.x*n.x+n.y*n.y),n.nx=n.x/n.len,n.ny=n.y/n.len,n.ang=Math.atan2(n.ny,n.nx)},Uf=function(e,t){t.x=e.x*-1,t.y=e.y*-1,t.nx=e.nx*-1,t.ny=e.ny*-1,t.ang=e.ang>0?-(Math.PI-e.ang):Math.PI+e.ang},Wf=function(e,t,n,r,i){if(e===Vf?Uf(Ef,Tf):Hf(t,e,Tf),Hf(t,n,Ef),Df=Tf.nx*Ef.ny-Tf.ny*Ef.nx,Of=Tf.nx*Ef.nx-Tf.ny*-Ef.ny,jf=Math.asin(Math.max(-1,Math.min(1,Df))),Math.abs(jf)<1e-6){Cf=t.x,wf=t.y,Nf=Ff=0;return}kf=1,Af=!1,Of<0?jf<0?jf=Math.PI+jf:(jf=Math.PI-jf,kf=-1,Af=!0):jf>0&&(kf=-1,Af=!0),Ff=t.radius===void 0?r:t.radius,Mf=jf/2,If=Math.min(Tf.len/2,Ef.len/2),i?(Pf=Math.abs(Math.cos(Mf)*Ff/Math.sin(Mf)),Pf>If?(Pf=If,Nf=Math.abs(Pf*Math.sin(Mf)/Math.cos(Mf))):Nf=Ff):(Pf=Math.min(If,Ff),Nf=Math.abs(Pf*Math.sin(Mf)/Math.cos(Mf))),zf=t.x+Ef.nx*Pf,Bf=t.y+Ef.ny*Pf,Cf=zf-Ef.ny*Nf*kf,wf=Bf+Ef.nx*Nf*kf,Lf=t.x+Tf.nx*Pf,Rf=t.y+Tf.ny*Pf,Vf=t};function Gf(e,t){t.radius===0?e.lineTo(t.cx,t.cy):e.arc(t.cx,t.cy,t.radius,t.startAngle,t.endAngle,t.counterClockwise)}function Kf(e,t,n,r){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0;return r===0||t.radius===0?{cx:t.x,cy:t.y,radius:0,startX:t.x,startY:t.y,stopX:t.x,stopY:t.y,startAngle:void 0,endAngle:void 0,counterClockwise:void 0}:(Wf(e,t,n,r,i),{cx:Cf,cy:wf,radius:Nf,startX:Lf,startY:Rf,stopX:zf,stopY:Bf,startAngle:Tf.ang+Math.PI/2*kf,endAngle:Ef.ang-Math.PI/2*kf,counterClockwise:Af})}var qf=.01,Jf=Math.sqrt(2*qf),Yf={};Yf.findMidptPtsEtc=function(e,t){var n=t.posPts,r=t.intersectionPts,i=t.vectorNormInverse,a,o=e.pstyle(`source-endpoint`),s=e.pstyle(`target-endpoint`),c=o.units!=null&&s.units!=null,l=function(e,t,n,r){var i=r-t,a=n-e,o=Math.sqrt(a*a+i*i);return{x:-i/o,y:a/o}};switch(e.pstyle(`edge-distances`).value){case`node-position`:a=n;break;case`intersection`:a=r;break;case`endpoints`:if(c){var u=M(this.manualEndptToPx(e.source()[0],o),2),d=u[0],f=u[1],p=M(this.manualEndptToPx(e.target()[0],s),2),m=p[0],h=p[1],g={x1:d,y1:f,x2:m,y2:h};i=l(d,f,m,h),a=g}else on(`Edge ${e.id()} has edge-distances:endpoints specified without manual endpoints specified via source-endpoint and target-endpoint. Falling back on edge-distances:intersection (default).`),a=r}return{midptPts:a,vectorNormInverse:i}},Yf.findHaystackPoints=function(e){for(var t=0;t<e.length;t++){var n=e[t],r=n._private,i=r.rscratch;if(!i.haystack){var a=Math.random()*2*Math.PI;i.source={x:Math.cos(a),y:Math.sin(a)},a=Math.random()*2*Math.PI,i.target={x:Math.cos(a),y:Math.sin(a)}}var o=r.source,s=r.target,c=o.position(),l=s.position(),u=o.width(),d=s.width(),f=o.height(),p=s.height(),m=n.pstyle(`haystack-radius`).value/2;i.haystackPts=i.allpts=[i.source.x*u*m+c.x,i.source.y*f*m+c.y,i.target.x*d*m+l.x,i.target.y*p*m+l.y],i.midX=(i.allpts[0]+i.allpts[2])/2,i.midY=(i.allpts[1]+i.allpts[3])/2,i.edgeType=`haystack`,i.haystack=!0,this.storeEdgeProjections(n),this.calculateArrowAngles(n),this.recalculateEdgeLabelProjections(n),this.calculateLabelAngles(n)}},Yf.findSegmentsPoints=function(e,t){var n=e._private.rscratch,r=e.pstyle(`segment-weights`),i=e.pstyle(`segment-distances`),a=e.pstyle(`segment-radii`),o=e.pstyle(`radius-type`),s=Math.min(r.pfValue.length,i.pfValue.length),c=a.pfValue[a.pfValue.length-1],l=o.pfValue[o.pfValue.length-1];n.edgeType=`segments`,n.segpts=[],n.radii=[],n.isArcRadius=[];for(var u=0;u<s;u++){var d=r.pfValue[u],f=i.pfValue[u],p=1-d,m=d,h=this.findMidptPtsEtc(e,t),g=h.midptPts,_=h.vectorNormInverse,v={x:g.x1*p+g.x2*m,y:g.y1*p+g.y2*m};n.segpts.push(v.x+_.x*f,v.y+_.y*f),n.radii.push(a.pfValue[u]===void 0?c:a.pfValue[u]),n.isArcRadius.push((o.pfValue[u]===void 0?l:o.pfValue[u])===`arc-radius`)}},Yf.findLoopPoints=function(e,t,n,r){var i=e._private.rscratch,a=t.dirCounts,o=t.srcPos,s=e.pstyle(`control-point-distances`),c=s?s.pfValue[0]:void 0,l=e.pstyle(`loop-direction`).pfValue,u=e.pstyle(`loop-sweep`).pfValue,d=e.pstyle(`control-point-step-size`).pfValue;i.edgeType=`self`;var f=n,p=d;r&&(f=0,p=c);var m=l-Math.PI/2,h=m-u/2,g=m+u/2,_=String(l+`_`+u);f=a[_]===void 0?a[_]=0:++a[_],i.ctrlpts=[o.x+Math.cos(h)*1.4*p*(f/3+1),o.y+Math.sin(h)*1.4*p*(f/3+1),o.x+Math.cos(g)*1.4*p*(f/3+1),o.y+Math.sin(g)*1.4*p*(f/3+1)]},Yf.findCompoundLoopPoints=function(e,t,n,r){var i=e._private.rscratch;i.edgeType=`compound`;var a=t.srcPos,o=t.tgtPos,s=t.srcW,c=t.srcH,l=t.tgtW,u=t.tgtH,d=e.pstyle(`control-point-step-size`).pfValue,f=e.pstyle(`control-point-distances`),p=f?f.pfValue[0]:void 0,m=n,h=d;r&&(m=0,h=p);var g=50,_={x:a.x-s/2,y:a.y-c/2},v={x:o.x-l/2,y:o.y-u/2},y={x:Math.min(_.x,v.x),y:Math.min(_.y,v.y)},b=.5,x=Math.max(b,Math.log(s*qf)),S=Math.max(b,Math.log(l*qf));i.ctrlpts=[y.x,y.y-(1+g**1.12/100)*h*(m/3+1)*x,y.x-(1+g**1.12/100)*h*(m/3+1)*S,y.y]},Yf.findStraightEdgePoints=function(e){e._private.rscratch.edgeType=`straight`},Yf.findBezierPoints=function(e,t,n,r,i){var a=e._private.rscratch,o=e.pstyle(`control-point-step-size`).pfValue,s=e.pstyle(`control-point-distances`),c=e.pstyle(`control-point-weights`),l=s&&c?Math.min(s.value.length,c.value.length):1,u=s?s.pfValue[0]:void 0,d=c.value[0],f=r;a.edgeType=f?`multibezier`:`bezier`,a.ctrlpts=[];for(var p=0;p<l;p++){var m=(.5-t.eles.length/2+n)*o*(i?-1:1),h=void 0,g=or(m);f&&(u=s?s.pfValue[p]:o,d=c.value[p]),h=r?u:u===void 0?void 0:g*u;var _=h===void 0?m:h,v=1-d,y=d,b=this.findMidptPtsEtc(e,t),x=b.midptPts,S=b.vectorNormInverse,C={x:x.x1*v+x.x2*y,y:x.y1*v+x.y2*y};a.ctrlpts.push(C.x+S.x*_,C.y+S.y*_)}},Yf.findTaxiPoints=function(e,t){var n=e._private.rscratch;n.edgeType=`segments`;var r=`vertical`,i=`horizontal`,a=`leftward`,o=`rightward`,s=`downward`,c=`upward`,l=`auto`,u=t.posPts,d=t.srcW,f=t.srcH,p=t.tgtW,m=t.tgtH,h=e.pstyle(`edge-distances`).value!==`node-position`,g=e.pstyle(`taxi-direction`).value,_=g,v=e.pstyle(`taxi-turn`),y=v.units===`%`,b=v.pfValue,x=b<0,S=e.pstyle(`taxi-turn-min-distance`).pfValue,C=h?(d+p)/2:0,w=h?(f+m)/2:0,T=u.x2-u.x1,E=u.y2-u.y1,D=function(e,t){return e>0?Math.max(e-t,0):Math.min(e+t,0)},O=D(T,C),k=D(E,w),A=!1;_===l?g=Math.abs(O)>Math.abs(k)?i:r:_===c||_===s?(g=r,A=!0):(_===a||_===o)&&(g=i,A=!0);var j=g===r,M=j?k:O,N=j?E:T,P=or(N),F=!1;!(A&&(y||x))&&(_===s&&N<0||_===c&&N>0||_===a&&N>0||_===o&&N<0)&&(P*=-1,M=P*Math.abs(M),F=!0);var I=y?(b<0?1+b:b)*M:(b<0?M:0)+b*P,L=function(e){return Math.abs(e)<S||Math.abs(e)>=Math.abs(M)},R=L(I),ee=L(Math.abs(M)-Math.abs(I));if((R||ee)&&!F){if(j){var z=Math.abs(N)<=f/2,B=Math.abs(T)<=p/2;if(z){var V=(u.x1+u.x2)/2;n.segpts=[V,u.y1,V,u.y2]}else if(B){var H=(u.y1+u.y2)/2;n.segpts=[u.x1,H,u.x2,H]}else n.segpts=[u.x1,u.y2]}else{var U=Math.abs(N)<=d/2,W=Math.abs(E)<=m/2;if(U){var G=(u.y1+u.y2)/2;n.segpts=[u.x1,G,u.x2,G]}else if(W){var K=(u.x1+u.x2)/2;n.segpts=[K,u.y1,K,u.y2]}else n.segpts=[u.x2,u.y1]}}else if(j){var q=u.y1+I+(h?f/2*P:0);n.segpts=[u.x1,q,u.x2,q]}else{var J=u.x1+I+(h?d/2*P:0);n.segpts=[J,u.y1,J,u.y2]}if(n.isRound){var Y=e.pstyle(`taxi-radius`).value,te=e.pstyle(`radius-type`).value[0]===`arc-radius`;n.radii=Array(n.segpts.length/2).fill(Y),n.isArcRadius=Array(n.segpts.length/2).fill(te)}},Yf.tryToCorrectInvalidPoints=function(e,t){var n=e._private.rscratch;if(n.edgeType===`bezier`){var r=t.srcPos,i=t.tgtPos,a=t.srcW,o=t.srcH,s=t.tgtW,c=t.tgtH,l=t.srcShape,u=t.tgtShape,d=t.srcCornerRadius,f=t.tgtCornerRadius,p=t.srcRs,m=t.tgtRs,h=!Y(n.startX)||!Y(n.startY),g=!Y(n.arrowStartX)||!Y(n.arrowStartY),_=!Y(n.endX)||!Y(n.endY),v=!Y(n.arrowEndX)||!Y(n.arrowEndY),y=3*(this.getArrowWidth(e.pstyle(`width`).pfValue,e.pstyle(`arrow-scale`).value)*this.arrowShapeWidth),b=sr({x:n.ctrlpts[0],y:n.ctrlpts[1]},{x:n.startX,y:n.startY}),x=b<y,S=sr({x:n.ctrlpts[0],y:n.ctrlpts[1]},{x:n.endX,y:n.endY}),C=S<y,w=!1;if(h||g||x){w=!0;var T={x:n.ctrlpts[0]-r.x,y:n.ctrlpts[1]-r.y},E=Math.sqrt(T.x*T.x+T.y*T.y),D={x:T.x/E,y:T.y/E},O=Math.max(a,o),k={x:n.ctrlpts[0]+D.x*2*O,y:n.ctrlpts[1]+D.y*2*O},A=l.intersectLine(r.x,r.y,a,o,k.x,k.y,0,d,p);x?(n.ctrlpts[0]=n.ctrlpts[0]+D.x*(y-b),n.ctrlpts[1]=n.ctrlpts[1]+D.y*(y-b)):(n.ctrlpts[0]=A[0]+D.x*y,n.ctrlpts[1]=A[1]+D.y*y)}if(_||v||C){w=!0;var j={x:n.ctrlpts[0]-i.x,y:n.ctrlpts[1]-i.y},M=Math.sqrt(j.x*j.x+j.y*j.y),N={x:j.x/M,y:j.y/M},P=Math.max(a,o),F={x:n.ctrlpts[0]+N.x*2*P,y:n.ctrlpts[1]+N.y*2*P},I=u.intersectLine(i.x,i.y,s,c,F.x,F.y,0,f,m);C?(n.ctrlpts[0]=n.ctrlpts[0]+N.x*(y-S),n.ctrlpts[1]=n.ctrlpts[1]+N.y*(y-S)):(n.ctrlpts[0]=I[0]+N.x*y,n.ctrlpts[1]=I[1]+N.y*y)}w&&this.findEndpoints(e)}},Yf.storeAllpts=function(e){var t=e._private.rscratch;if(t.edgeType===`multibezier`||t.edgeType===`bezier`||t.edgeType===`self`||t.edgeType===`compound`){t.allpts=[],t.allpts.push(t.startX,t.startY);for(var n=0;n+1<t.ctrlpts.length;n+=2)t.allpts.push(t.ctrlpts[n],t.ctrlpts[n+1]),n+3<t.ctrlpts.length&&t.allpts.push((t.ctrlpts[n]+t.ctrlpts[n+2])/2,(t.ctrlpts[n+1]+t.ctrlpts[n+3])/2);t.allpts.push(t.endX,t.endY);var r,i;t.ctrlpts.length/2%2==0?(r=t.allpts.length/2-1,t.midX=t.allpts[r],t.midY=t.allpts[r+1]):(r=t.allpts.length/2-3,i=.5,t.midX=ur(t.allpts[r],t.allpts[r+2],t.allpts[r+4],i),t.midY=ur(t.allpts[r+1],t.allpts[r+3],t.allpts[r+5],i))}else if(t.edgeType===`straight`)t.allpts=[t.startX,t.startY,t.endX,t.endY],t.midX=(t.startX+t.endX+t.arrowStartX+t.arrowEndX)/4,t.midY=(t.startY+t.endY+t.arrowStartY+t.arrowEndY)/4;else if(t.edgeType===`segments`){if(t.allpts=[],t.allpts.push(t.startX,t.startY),t.allpts.push.apply(t.allpts,t.segpts),t.allpts.push(t.endX,t.endY),t.isRound){t.roundCorners=[];for(var a=2;a+3<t.allpts.length;a+=2){var o=t.radii[a/2-1],s=t.isArcRadius[a/2-1];t.roundCorners.push(Kf({x:t.allpts[a-2],y:t.allpts[a-1]},{x:t.allpts[a],y:t.allpts[a+1],radius:o},{x:t.allpts[a+2],y:t.allpts[a+3]},o,s))}}if(t.segpts.length%4==0){var c=t.segpts.length/2,l=c-2;t.midX=(t.segpts[l]+t.segpts[c])/2,t.midY=(t.segpts[l+1]+t.segpts[c+1])/2}else{var u=t.segpts.length/2-1;if(!t.isRound)t.midX=t.segpts[u],t.midY=t.segpts[u+1];else{var d={x:t.segpts[u],y:t.segpts[u+1]},f=t.roundCorners[u/2];if(f.radius===0){var p={x:t.segpts[u+2],y:t.segpts[u+3]};t.midX=d.x,t.midY=d.y,t.midVector=[d.y-p.y,p.x-d.x]}else{var m=[d.x-f.cx,d.y-f.cy],h=f.radius/Math.sqrt(m[0]**2+m[1]**2);m=m.map(function(e){return e*h}),t.midX=f.cx+m[0],t.midY=f.cy+m[1],t.midVector=m}}}}},Yf.checkForInvalidEdgeWarning=function(e){var t=e[0]._private.rscratch;t.nodesOverlap||Y(t.startX)&&Y(t.startY)&&Y(t.endX)&&Y(t.endY)?t.loggedErr=!1:t.loggedErr||(t.loggedErr=!0,on("Edge `"+e.id()+"` has invalid endpoints and so it is impossible to draw. Adjust your edge style (e.g. control points) accordingly or use an alternative edge type. This is expected behaviour when the source node and the target node overlap."))},Yf.findEdgeControlPoints=function(e){var t=this;if(!(!e||e.length===0)){for(var n=this,r=n.cy.hasCompoundNodes(),i=new yn,a=function(e,t){return[].concat(N(e),[+!!t]).join(`-`)},o=[],s=[],c=0;c<e.length;c++){var l=e[c],u=l._private,d=l.pstyle(`curve-style`).value;if(!(l.removed()||!l.takesUpSpace())){if(d===`haystack`){s.push(l);continue}var f=d===`unbundled-bezier`||ye(d,`segments`)||d===`straight`||d===`straight-triangle`||ye(d,`taxi`),p=d===`unbundled-bezier`||d===`bezier`,m=u.source,h=u.target,g=[m.poolIndex(),h.poolIndex()].sort(),_=a(g,f),v=i.get(_);v??(v={eles:[]},o.push({pairId:g,edgeIsUnbundled:f}),i.set(_,v)),v.eles.push(l),f&&(v.hasUnbundled=!0),p&&(v.hasBezier=!0)}}for(var y=function(){var e=o[b],s=e.pairId,c=e.edgeIsUnbundled,l=a(s,c),u=i.get(l),d;if(!u.hasUnbundled){var f=u.eles[0].parallelEdges().filter(function(e){return e.isBundledBezier()});hn(u.eles),f.forEach(function(e){return u.eles.push(e)}),u.eles.sort(function(e,t){return e.poolIndex()-t.poolIndex()})}var p=u.eles[0],m=p.source(),h=p.target();if(m.poolIndex()>h.poolIndex()){var g=m;m=h,h=g}var _=u.srcPos=m.position(),v=u.tgtPos=h.position(),y=u.srcW=m.outerWidth(),x=u.srcH=m.outerHeight(),S=u.tgtW=h.outerWidth(),C=u.tgtH=h.outerHeight(),w=u.srcShape=n.nodeShapes[t.getNodeShape(m)],T=u.tgtShape=n.nodeShapes[t.getNodeShape(h)],E=u.srcCornerRadius=m.pstyle(`corner-radius`).value===`auto`?`auto`:m.pstyle(`corner-radius`).pfValue,D=u.tgtCornerRadius=h.pstyle(`corner-radius`).value===`auto`?`auto`:h.pstyle(`corner-radius`).pfValue,O=u.tgtRs=h._private.rscratch,k=u.srcRs=m._private.rscratch;u.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var A=0;A<u.eles.length;A++){var j=u.eles[A],M=j[0]._private.rscratch,N=j.pstyle(`curve-style`).value,P=N===`unbundled-bezier`||ye(N,`segments`)||ye(N,`taxi`),F=!m.same(j.source());if(!u.calculatedIntersection&&m!==h&&(u.hasBezier||u.hasUnbundled)){u.calculatedIntersection=!0;var I=w.intersectLine(_.x,_.y,y,x,v.x,v.y,0,E,k),L=u.srcIntn=I,R=T.intersectLine(v.x,v.y,S,C,_.x,_.y,0,D,O),ee=u.tgtIntn=R,z=u.intersectionPts={x1:I[0],x2:R[0],y1:I[1],y2:R[1]},B=u.posPts={x1:_.x,x2:v.x,y1:_.y,y2:v.y},V=R[1]-I[1],H=R[0]-I[0],U=Math.sqrt(H*H+V*V);Y(U)&&U>=Jf||(U=Math.sqrt(Math.max(H*H,qf)+Math.max(V*V,qf)));var W=u.vector={x:H,y:V},G=u.vectorNorm={x:W.x/U,y:W.y/U},K={x:-G.y,y:G.x};u.nodesOverlap=!Y(U)||T.checkPoint(I[0],I[1],0,S,C,v.x,v.y,D,O)||w.checkPoint(R[0],R[1],0,y,x,_.x,_.y,E,k),u.vectorNormInverse=K,d={nodesOverlap:u.nodesOverlap,dirCounts:u.dirCounts,calculatedIntersection:!0,hasBezier:u.hasBezier,hasUnbundled:u.hasUnbundled,eles:u.eles,srcPos:v,srcRs:O,tgtPos:_,tgtRs:k,srcW:S,srcH:C,tgtW:y,tgtH:x,srcIntn:ee,tgtIntn:L,srcShape:T,tgtShape:w,posPts:{x1:B.x2,y1:B.y2,x2:B.x1,y2:B.y1},intersectionPts:{x1:z.x2,y1:z.y2,x2:z.x1,y2:z.y1},vector:{x:-W.x,y:-W.y},vectorNorm:{x:-G.x,y:-G.y},vectorNormInverse:{x:-K.x,y:-K.y}}}var q=F?d:u;M.nodesOverlap=q.nodesOverlap,M.srcIntn=q.srcIntn,M.tgtIntn=q.tgtIntn,M.isRound=N.startsWith(`round`),r&&(m.isParent()||m.isChild()||h.isParent()||h.isChild())&&(m.parents().anySame(h)||h.parents().anySame(m)||m.same(h)&&m.isParent())?t.findCompoundLoopPoints(j,q,A,P):m===h?t.findLoopPoints(j,q,A,P):N.endsWith(`segments`)?t.findSegmentsPoints(j,q):N.endsWith(`taxi`)?t.findTaxiPoints(j,q):N===`straight`||!P&&u.eles.length%2==1&&A===Math.floor(u.eles.length/2)?t.findStraightEdgePoints(j):t.findBezierPoints(j,q,A,P,F),t.findEndpoints(j),t.tryToCorrectInvalidPoints(j,q),t.checkForInvalidEdgeWarning(j),t.storeAllpts(j),t.storeEdgeProjections(j),t.calculateArrowAngles(j),t.recalculateEdgeLabelProjections(j),t.calculateLabelAngles(j)}},b=0;b<o.length;b++)y();this.findHaystackPoints(s)}};function Xf(e){var t=[];if(e!=null){for(var n=0;n<e.length;n+=2){var r=e[n],i=e[n+1];t.push({x:r,y:i})}return t}}Yf.getSegmentPoints=function(e){var t=e[0]._private.rscratch;if(this.recalculateRenderedStyle(e),t.edgeType===`segments`)return Xf(t.segpts)},Yf.getControlPoints=function(e){var t=e[0]._private.rscratch;this.recalculateRenderedStyle(e);var n=t.edgeType;if(n===`bezier`||n===`multibezier`||n===`self`||n===`compound`)return Xf(t.ctrlpts)},Yf.getEdgeMidpoint=function(e){var t=e[0]._private.rscratch;return this.recalculateRenderedStyle(e),{x:t.midX,y:t.midY}};var Zf={};Zf.manualEndptToPx=function(e,t){var n=this,r=e.position(),i=e.outerWidth(),a=e.outerHeight(),o=e._private.rscratch;if(t.value.length===2){var s=[t.pfValue[0],t.pfValue[1]];return t.units[0]===`%`&&(s[0]*=i),t.units[1]===`%`&&(s[1]*=a),s[0]+=r.x,s[1]+=r.y,s}var c=t.pfValue[0];c=-Math.PI/2+c;var l=2*Math.max(i,a),u=[r.x+Math.cos(c)*l,r.y+Math.sin(c)*l];return n.nodeShapes[this.getNodeShape(e)].intersectLine(r.x,r.y,i,a,u[0],u[1],0,e.pstyle(`corner-radius`).value===`auto`?`auto`:e.pstyle(`corner-radius`).pfValue,o)},Zf.findEndpoints=function(e){var t,n,r=this,i,a=e.source()[0],o=e.target()[0],s=a.position(),c=o.position(),l=e.pstyle(`target-arrow-shape`).value,u=e.pstyle(`source-arrow-shape`).value,d=e.pstyle(`target-distance-from-node`).pfValue,f=e.pstyle(`source-distance-from-node`).pfValue,p=a._private.rscratch,m=o._private.rscratch,h=e.pstyle(`curve-style`).value,g=e._private.rscratch,_=g.edgeType,v=ye(h,`taxi`),y=_===`self`||_===`compound`,b=_===`bezier`||_===`multibezier`||y,x=_!==`bezier`,S=_===`straight`||_===`segments`,C=_===`segments`,w=b||x||S,T=y||v,E=e.pstyle(`source-endpoint`),D=T?`outside-to-node`:E.value,O=a.pstyle(`corner-radius`).value===`auto`?`auto`:a.pstyle(`corner-radius`).pfValue,k=e.pstyle(`target-endpoint`),A=T?`outside-to-node`:k.value,j=o.pstyle(`corner-radius`).value===`auto`?`auto`:o.pstyle(`corner-radius`).pfValue;g.srcManEndpt=E,g.tgtManEndpt=k;var M,N,P,F,I=((k==null||(t=k.pfValue)==null?void 0:t.length)===2?k.pfValue:null)??[0,0],L=((E==null||(n=E.pfValue)==null?void 0:n.length)===2?E.pfValue:null)??[0,0];if(b){var R=[g.ctrlpts[0],g.ctrlpts[1]];M=x?[g.ctrlpts[g.ctrlpts.length-2],g.ctrlpts[g.ctrlpts.length-1]]:R,N=R}else if(S){var ee=C?g.segpts.slice(0,2):[c.x+I[0],c.y+I[1]];M=C?g.segpts.slice(g.segpts.length-2):[s.x+L[0],s.y+L[1]],N=ee}if(A===`inside-to-node`)i=[c.x,c.y];else if(k.units)i=this.manualEndptToPx(o,k);else if(A===`outside-to-line`)i=g.tgtIntn;else if(A===`outside-to-node`||A===`outside-to-node-or-label`?P=M:(A===`outside-to-line`||A===`outside-to-line-or-label`)&&(P=[s.x,s.y]),i=r.nodeShapes[this.getNodeShape(o)].intersectLine(c.x,c.y,o.outerWidth(),o.outerHeight(),P[0],P[1],0,j,m),A===`outside-to-node-or-label`||A===`outside-to-line-or-label`){var z=o._private.rscratch,B=z.labelWidth,V=z.labelHeight,H=z.labelX,U=z.labelY,W=B/2,G=V/2,K=o.pstyle(`text-valign`).value;K=Tl(K),K===`top`?U-=G:K===`bottom`&&(U+=G);var q=o.pstyle(`text-halign`).value;q=wl(q),q===`left`?H-=W:q===`right`&&(H+=W);var J=qr(P[0],P[1],[H-W,U-G,H+W,U-G,H+W,U+G,H-W,U+G],c.x,c.y);if(J.length>0){var te=s,ne=cr(te,Xn(i)),re=cr(te,Xn(J)),ie=ne;re<ne&&(i=J,ie=re),J.length>2&&cr(te,{x:J[2],y:J[3]})<ie&&(i=[J[2],J[3]])}}var ae=Yr(i,M,r.arrowShapes[l].spacing(e)+d),oe=Yr(i,M,r.arrowShapes[l].gap(e)+d);if(g.endX=oe[0],g.endY=oe[1],g.arrowEndX=ae[0],g.arrowEndY=ae[1],D===`inside-to-node`)i=[s.x,s.y];else if(E.units)i=this.manualEndptToPx(a,E);else if(D===`outside-to-line`)i=g.srcIntn;else if(D===`outside-to-node`||D===`outside-to-node-or-label`?F=N:(D===`outside-to-line`||D===`outside-to-line-or-label`)&&(F=[c.x,c.y]),i=r.nodeShapes[this.getNodeShape(a)].intersectLine(s.x,s.y,a.outerWidth(),a.outerHeight(),F[0],F[1],0,O,p),D===`outside-to-node-or-label`||D===`outside-to-line-or-label`){var se=a._private.rscratch,ce=se.labelWidth,le=se.labelHeight,ue=se.labelX,de=se.labelY,fe=ce/2,pe=le/2,me=a.pstyle(`text-valign`).value;me=Tl(me),me===`top`?de-=pe:me===`bottom`&&(de+=pe);var he=a.pstyle(`text-halign`).value;he=wl(he),he===`left`?ue-=fe:he===`right`&&(ue+=fe);var ge=qr(F[0],F[1],[ue-fe,de-pe,ue+fe,de-pe,ue+fe,de+pe,ue-fe,de+pe],s.x,s.y);if(ge.length>0){var _e=c,ve=cr(_e,Xn(i)),be=cr(_e,Xn(ge)),xe=ve;be<ve&&(i=[ge[0],ge[1]],xe=be),ge.length>2&&cr(_e,{x:ge[2],y:ge[3]})<xe&&(i=[ge[2],ge[3]])}}var Se=Yr(i,N,r.arrowShapes[u].spacing(e)+f),Ce=Yr(i,N,r.arrowShapes[u].gap(e)+f);g.startX=Ce[0],g.startY=Ce[1],g.arrowStartX=Se[0],g.arrowStartY=Se[1],w&&(g.badLine=!Y(g.startX)||!Y(g.startY)||!Y(g.endX)||!Y(g.endY))},Zf.getSourceEndpoint=function(e){var t=e[0]._private.rscratch;switch(this.recalculateRenderedStyle(e),t.edgeType){case`haystack`:return{x:t.haystackPts[0],y:t.haystackPts[1]};default:return{x:t.arrowStartX,y:t.arrowStartY}}},Zf.getTargetEndpoint=function(e){var t=e[0]._private.rscratch;switch(this.recalculateRenderedStyle(e),t.edgeType){case`haystack`:return{x:t.haystackPts[2],y:t.haystackPts[3]};default:return{x:t.arrowEndX,y:t.arrowEndY}}};var Qf={};function $f(e,t,n){for(var r=function(e,t,n,r){return ur(e,t,n,r)},i=t._private.rstyle.bezierPts,a=0;a<e.bezierProjPcts.length;a++){var o=e.bezierProjPcts[a];i.push({x:r(n[0],n[2],n[4],o),y:r(n[1],n[3],n[5],o)})}}Qf.storeEdgeProjections=function(e){var t=e._private,n=t.rscratch,r=n.edgeType;if(t.rstyle.bezierPts=null,t.rstyle.linePts=null,t.rstyle.haystackPts=null,r===`multibezier`||r===`bezier`||r===`self`||r===`compound`){t.rstyle.bezierPts=[];for(var i=0;i+5<n.allpts.length;i+=4)$f(this,e,n.allpts.slice(i,i+6))}else if(r===`segments`)for(var a=t.rstyle.linePts=[],i=0;i+1<n.allpts.length;i+=2)a.push({x:n.allpts[i],y:n.allpts[i+1]});else if(r===`haystack`){var o=n.haystackPts;t.rstyle.haystackPts=[{x:o[0],y:o[1]},{x:o[2],y:o[3]}]}t.rstyle.arrowWidth=this.getArrowWidth(e.pstyle(`width`).pfValue,e.pstyle(`arrow-scale`).value)*this.arrowShapeWidth},Qf.recalculateEdgeProjections=function(e){this.findEdgeControlPoints(e)};var ep={};ep.recalculateNodeLabelProjection=function(e){var t=e.pstyle(`label`).strValue;if(!le(t)){var n,r,i=e._private,a=e.width(),o=e.height(),s=e.padding(),c=e.position(),l=e.pstyle(`text-halign`).strValue,u=e.pstyle(`text-valign`).strValue,d=i.rscratch,f=i.rstyle;switch(l){case`left`:n=c.x-a/2-s;break;case`left-inside`:n=c.x-a/2+s;break;case`right`:n=c.x+a/2+s;break;case`right-inside`:n=c.x+a/2-s;break;default:n=c.x}switch(u){case`top`:r=c.y-o/2-s;break;case`top-inside`:r=c.y-o/2+s;break;case`bottom`:r=c.y+o/2+s;break;case`bottom-inside`:r=c.y+o/2-s;break;default:r=c.y}d.labelX=n,d.labelY=r,f.labelX=n,f.labelY=r,this.calculateLabelAngles(e),this.applyLabelDimensions(e)}};var tp=function(e,t){var n=Math.atan(t/e);return e===0&&n<0&&(n*=-1),n},np=function(e,t){return tp(t.x-e.x,t.y-e.y)},rp=function(e,t,n,r){var i=pr(0,r-.001,1),a=pr(0,r+.001,1);return np(dr(e,t,n,i),dr(e,t,n,a))};ep.recalculateEdgeLabelProjections=function(e){var t,n=e._private,r=n.rscratch,i=this,a={mid:e.pstyle(`label`).strValue,source:e.pstyle(`source-label`).strValue,target:e.pstyle(`target-label`).strValue};if(a.mid||a.source||a.target){t={x:r.midX,y:r.midY};var o=function(e,t,r){vn(n.rscratch,e,t,r),vn(n.rstyle,e,t,r)};o(`labelX`,null,t.x),o(`labelY`,null,t.y),o(`labelAutoAngle`,null,tp(r.midDispX,r.midDispY));var s=function(){if(s.cache)return s.cache;for(var e=[],t=0;t+5<r.allpts.length;t+=4){var a={x:r.allpts[t],y:r.allpts[t+1]},o={x:r.allpts[t+2],y:r.allpts[t+3]},c={x:r.allpts[t+4],y:r.allpts[t+5]};e.push({p0:a,p1:o,p2:c,startDist:0,length:0,segments:[]})}var l=n.rstyle.bezierPts,u=i.bezierProjPcts.length;function d(e,t,n,r,i){var a=sr(t,n),o=e.segments[e.segments.length-1],s={p0:t,p1:n,t0:r,t1:i,startDist:o?o.startDist+o.length:0,length:a};e.segments.push(s),e.length+=a}for(var f=0;f<e.length;f++){var p=e[f],m=e[f-1];m&&(p.startDist=m.startDist+m.length),d(p,p.p0,l[f*u],0,i.bezierProjPcts[0]);for(var h=0;h<u-1;h++)d(p,l[f*u+h],l[f*u+h+1],i.bezierProjPcts[h],i.bezierProjPcts[h+1]);d(p,l[f*u+u-1],p.p2,i.bezierProjPcts[u-1],1)}return s.cache=e},c=function(n){var i,c=n===`source`;if(a[n]){var l=e.pstyle(n+`-text-offset`).pfValue;switch(r.edgeType){case`self`:case`compound`:case`bezier`:case`multibezier`:for(var u=s(),d,f=0,p=0,m=0;m<u.length;m++){for(var h=u[c?m:u.length-1-m],g=0;g<h.segments.length;g++){var _=h.segments[c?g:h.segments.length-1-g],v=m===u.length-1&&g===h.segments.length-1;if(f=p,p+=_.length,p>=l||v){d={cp:h,segment:_};break}}if(d)break}var y=d.cp,b=d.segment,x=(l-f)/b.length,S=b.t1-b.t0,C=c?b.t0+S*x:b.t1-S*x;C=pr(0,C,1),t=dr(y.p0,y.p1,y.p2,C),i=rp(y.p0,y.p1,y.p2,C);break;case`straight`:case`segments`:case`haystack`:for(var w=0,T,E,D,O,k=r.allpts.length,A=0;A+3<k&&(c?(D={x:r.allpts[A],y:r.allpts[A+1]},O={x:r.allpts[A+2],y:r.allpts[A+3]}):(D={x:r.allpts[k-2-A],y:r.allpts[k-1-A]},O={x:r.allpts[k-4-A],y:r.allpts[k-3-A]}),T=sr(D,O),E=w,w+=T,!(w>=l));A+=2);var j=(l-E)/T;j=pr(0,j,1),t=fr(D,O,j),i=np(D,O)}o(`labelX`,n,t.x),o(`labelY`,n,t.y),o(`labelAutoAngle`,n,i)}};c(`source`),c(`target`),this.applyLabelDimensions(e)}},ep.applyLabelDimensions=function(e){this.applyPrefixedLabelDimensions(e),e.isEdge()&&(this.applyPrefixedLabelDimensions(e,`source`),this.applyPrefixedLabelDimensions(e,`target`))},ep.applyPrefixedLabelDimensions=function(e,t){var n=e._private,r=this.getLabelText(e,t),i=Ut(r,e._private.labelDimsKey);if(_n(n.rscratch,`prefixedLabelDimsKey`,t)!==i){vn(n.rscratch,`prefixedLabelDimsKey`,t,i);var a=this.calculateLabelDimensions(e,r),o=e.pstyle(`line-height`).pfValue,s=e.pstyle(`font-size`).pfValue,c=e.pstyle(`text-wrap`).strValue,l=_n(n.rscratch,`labelWrapCachedLines`,t)||[],u=c===`wrap`?Math.max(l.length,1):1,d=s*o,f=a.width,p=a.height+(u-1)*(o-1)*s;vn(n.rstyle,`labelWidth`,t,f),vn(n.rscratch,`labelWidth`,t,f),vn(n.rstyle,`labelHeight`,t,p),vn(n.rscratch,`labelHeight`,t,p),vn(n.rscratch,`labelLineHeight`,t,d),vn(n.rscratch,`labelActualDescent`,t,a.labelActualDescent)}},ep.getLabelText=function(e,t){var n=e._private,r=t?t+`-`:``,i=e.pstyle(r+`label`).strValue,a=e.pstyle(`text-transform`).value,o=function(e,r){return r?(vn(n.rscratch,e,t,r),r):_n(n.rscratch,e,t)};if(!i)return``;a==`none`||(a==`uppercase`?i=i.toUpperCase():a==`lowercase`&&(i=i.toLowerCase()));var s=e.pstyle(`text-wrap`).value;if(s===`wrap`){var c=o(`labelKey`);if(c!=null&&o(`labelWrapKey`)===c)return o(`labelWrapCachedText`);for(var l=`​`,u=i.split(`
13
+ `),d=e.pstyle(`text-max-width`).pfValue,f=e.pstyle(`text-overflow-wrap`).value===`anywhere`,p=[],m=/[\s\u200b]+|$/g,h=0;h<u.length;h++){var g=u[h],_=this.calculateLabelDimensions(e,g).width;if(f&&(g=g.split(``).join(l)),_>d){var v=g.matchAll(m),y=``,b=0,x=E(v),S;try{for(x.s();!(S=x.n()).done;){var C=S.value,w=C[0],T=g.substring(b,C.index);b=C.index+w.length;var D=y.length===0?T:y+T+w;this.calculateLabelDimensions(e,D).width<=d?y+=T+w:(y&&p.push(y),y=T+w)}}catch(e){x.e(e)}finally{x.f()}y.match(/^[\s\u200b]+$/)||p.push(y)}else p.push(g)}o(`labelWrapCachedLines`,p),i=o(`labelWrapCachedText`,p.join(`
14
+ `)),o(`labelWrapKey`,c)}else if(s===`ellipsis`){var O=e.pstyle(`text-max-width`).pfValue,k=``,A=`…`,j=!1;if(this.calculateLabelDimensions(e,i).width<O)return i;for(var M=0;M<i.length&&!(this.calculateLabelDimensions(e,k+i[M]+A).width>O);M++)k+=i[M],M===i.length-1&&(j=!0);return j||(k+=A),k}return i},ep.getLabelJustification=function(e){var t=e.pstyle(`text-justification`).strValue,n=e.pstyle(`text-halign`).strValue;return t===`auto`?e.isNode()?El(n):`center`:t},ep.calculateLabelDimensions=function(e,t){var n=this.cy.window().document,r=0,i=e.pstyle(`font-style`).strValue,a=e.pstyle(`font-size`).pfValue,o=e.pstyle(`font-family`).strValue,s=e.pstyle(`font-weight`).strValue,c=e.pstyle(`text-metrics`).strValue||`font`,l=this.labelCalcCanvas,u=this.labelCalcCanvasContext;if(!l){l=this.labelCalcCanvas=n.createElement(`canvas`),u=this.labelCalcCanvasContext=l.getContext(`2d`);var d=l.style;d.position=`absolute`,d.left=`-9999px`,d.top=`-9999px`,d.zIndex=`-1`,d.visibility=`hidden`,d.pointerEvents=`none`}u.font=`${i} ${s} ${a}px ${o}`;for(var f=0,p=0,m=t.split(`
15
+ `),h=m.length,g=0,_=0,v=0;v<h;v++){var y=m[v],b=u.measureText(y),x=Math.ceil(b.width),S=a;c===`glyph`&&(v===0&&(_=b.actualBoundingBoxAscent),v===h-1&&(g=b.actualBoundingBoxDescent)),f=Math.max(x,f),p+=S}return c===`glyph`&&(p-=a-_-g),f+=r,p+=r,{width:f,height:p,labelActualAscent:_,labelActualDescent:g}},ep.calculateLabelAngle=function(e,t){var n=e._private.rscratch,r=e.isEdge(),i=t?t+`-`:``,a=e.pstyle(i+`text-rotation`),o=a.strValue;return o===`none`?0:r&&o===`autorotate`?n.labelAutoAngle:o===`autorotate`?0:a.pfValue},ep.calculateLabelAngles=function(e){var t=this,n=e.isEdge(),r=e._private.rscratch;r.labelAngle=t.calculateLabelAngle(e),n&&(r.sourceLabelAngle=t.calculateLabelAngle(e,`source`),r.targetLabelAngle=t.calculateLabelAngle(e,`target`))};var ip={},ap=28,op=!1;ip.getNodeShape=function(e){var t=this,n=e.pstyle(`shape`).value;if(n===`cutrectangle`&&(e.width()<ap||e.height()<ap))return op||=(on("The `cutrectangle` node shape can not be used at small sizes so `rectangle` is used instead"),!0),`rectangle`;if(e.isParent())return n===`rectangle`||n===`roundrectangle`||n===`round-rectangle`||n===`cutrectangle`||n===`cut-rectangle`||n===`barrel`?n:`rectangle`;if(n===`polygon`){var r=e.pstyle(`shape-polygon-points`).value;return t.nodeShapes.makePolygon(r).name}return n};var sp={};sp.registerCalculationListeners=function(){var e=this.cy,t=e.collection(),n=this,r=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(t.merge(e),n)for(var r=0;r<e.length;r++){var i=e[r]._private.rstyle;i.clean=!1,i.cleanConnected=!1}};n.binder(e).on(`bounds.* dirty.*`,function(e){var t=e.target;r(t)}).on(`style.* background.*`,function(e){var t=e.target;r(t,!1)});var i=function(i){if(i){var a=n.onUpdateEleCalcsFns;t.cleanStyle();for(var o=0;o<t.length;o++){var s=t[o],c=s._private.rstyle;s.isNode()&&!c.cleanConnected&&(r(s.connectedEdges()),c.cleanConnected=!0)}if(a)for(var l=0;l<a.length;l++){var u=a[l];u(i,t)}n.recalculateRenderedStyle(t),t=e.collection()}};n.flushRenderedStyleQueue=function(){i(!0)},n.beforeRender(i,n.beforeRenderPriorities.eleCalcs)},sp.onUpdateEleCalcs=function(e){(this.onUpdateEleCalcsFns=this.onUpdateEleCalcsFns||[]).push(e)},sp.recalculateRenderedStyle=function(e,t){var n=function(e){return e._private.rstyle.cleanConnected};if(e.length!==0){var r=[],i=[];if(!this.destroyed){t===void 0&&(t=!0);for(var a=0;a<e.length;a++){var o=e[a],s=o._private,c=s.rstyle;o.isEdge()&&(!n(o.source())||!n(o.target()))&&(c.clean=!1),o.isEdge()&&o.isBundledBezier()&&o.parallelEdges().some(function(e){return!e._private.rstyle.clean&&e.isBundledBezier()})&&(c.clean=!1),!(t&&c.clean||o.removed())&&o.pstyle(`display`).value!==`none`&&(s.group===`nodes`?i.push(o):r.push(o),c.clean=!0)}for(var l=0;l<i.length;l++){var u=i[l],d=u._private.rstyle,f=u.position();this.recalculateNodeLabelProjection(u),d.nodeX=f.x,d.nodeY=f.y,d.nodeW=u.pstyle(`width`).pfValue,d.nodeH=u.pstyle(`height`).pfValue}this.recalculateEdgeProjections(r);for(var p=0;p<r.length;p++){var m=r[p]._private,h=m.rstyle,g=m.rscratch;h.srcX=g.arrowStartX,h.srcY=g.arrowStartY,h.tgtX=g.arrowEndX,h.tgtY=g.arrowEndY,h.midX=g.midX,h.midY=g.midY,h.labelAngle=g.labelAngle,h.sourceLabelAngle=g.sourceLabelAngle,h.targetLabelAngle=g.targetLabelAngle}}}};var cp={};cp.updateCachedGrabbedEles=function(){var e=this.cachedZSortedEles;if(e){e.drag=[],e.nondrag=[];for(var t=[],n=0;n<e.length;n++){var r=e[n],i=r._private.rscratch;r.grabbed()&&!r.isParent()?t.push(r):i.inDragLayer?e.drag.push(r):e.nondrag.push(r)}for(var n=0;n<t.length;n++){var r=t[n];e.drag.push(r)}}},cp.invalidateCachedZSortedEles=function(){this.cachedZSortedEles=null},cp.getCachedZSortedEles=function(e){if(e||!this.cachedZSortedEles){var t=this.cy.mutableElements().toArray();t.sort(xu),t.interactive=t.filter(function(e){return e.interactive()}),this.cachedZSortedEles=t,this.updateCachedGrabbedEles()}else t=this.cachedZSortedEles;return t};var lp={};[xf,Sf,Yf,Zf,Qf,ep,ip,sp,cp].forEach(function(e){X(lp,e)});var up={};up.getCachedImage=function(e,t,n){var r=this,i=r.imageCache=r.imageCache||{},a=i[e];if(a)return a.image.complete||a.image.addEventListener(`load`,n),a.image;a=i[e]=i[e]||{};var o=a.image=new Image;o.addEventListener(`load`,n),o.addEventListener(`error`,function(){o.error=!0});var s=`data:`;return e.substring(0,s.length).toLowerCase()!==s&&(t=t===`null`?null:t,o.crossOrigin=t),o.src=e,o};var dp=function(e,t){var n=e[0];!n||n._private.grabbed===t||(n._private.grabbed=t,e.updateStyle(!1))},fp=function(e){dp(e,!0)},pp=function(e){dp(e,!1)},mp={};mp.registerBinding=function(e,t,n,r){var i=Array.prototype.slice.apply(arguments,[1]);if(Array.isArray(e)){for(var a=[],o=0;o<e.length;o++){var s=e[o];if(s!==void 0){var c=this.binder(s);a.push(c.on.apply(c,i))}}return a}var c=this.binder(e);return c.on.apply(c,i)},mp.binder=function(e){var t=this,n=t.cy.window(),r=e===n||e===n.document||e===n.document.body||ue(e);if(t.supportsPassiveEvents==null){var i=!1;try{var a=Object.defineProperty({},"passive",{get:function(){return i=!0,!0}});n.addEventListener(`test`,null,a)}catch{}t.supportsPassiveEvents=i}var o=function(n,i,a){var o=Array.prototype.slice.call(arguments);return r&&t.supportsPassiveEvents&&(o[2]={capture:a??!1,passive:!1,once:!1}),t.bindings.push({target:e,args:o}),(e.addEventListener||e.on).apply(e,o),this};return{on:o,addEventListener:o,addListener:o,bind:o}},mp.nodeIsDraggable=function(e){return e&&e.isNode()&&!e.locked()&&e.grabbable()},mp.nodeIsGrabbable=function(e){return this.nodeIsDraggable(e)&&e.interactive()},mp.load=function(){var e=this,t=e.cy.window(),n=function(e){return e.selected()},r=function(e){var t=e.getRootNode();if(t&&t.nodeType===11&&t.host!==void 0)return t},i=function(t,n,r,i){t??=e.cy;for(var a=0;a<n.length;a++){var o=n[a];t.emit({originalEvent:r,type:o,position:i})}},a=function(e){return e.shiftKey||e.metaKey||e.ctrlKey},o=function(t,n){var r=!0;if(e.cy.hasCompoundNodes()&&t&&t.pannable())for(var i=0;n&&i<n.length;i++){var t=n[i];if(t.isNode()&&t.isParent()&&!t.pannable()){r=!1;break}}else r=!0;return r},s=function(e){e[0]._private.rscratch.inDragLayer=!0},c=function(e){e[0]._private.rscratch.inDragLayer=!1},l=function(e){e[0]._private.rscratch.isGrabTarget=!0},u=function(e){e[0]._private.rscratch.isGrabTarget=!1},d=function(e,t){var n=t.addToList;!n.has(e)&&e.grabbable()&&!e.locked()&&(n.merge(e),fp(e))},f=function(e,t){if(e.cy().hasCompoundNodes()&&(t.inDragLayer!=null||t.addToList!=null)){var n=e.descendants();t.inDragLayer&&(n.forEach(s),n.connectedEdges().forEach(s)),t.addToList&&d(n,t)}},p=function(t,n){n||={};var r=t.cy().hasCompoundNodes();n.inDragLayer&&(t.forEach(s),t.neighborhood().stdFilter(function(e){return!r||e.isEdge()}).forEach(s)),n.addToList&&t.forEach(function(e){d(e,n)}),f(t,n),g(t,{inDragLayer:n.inDragLayer}),e.updateCachedGrabbedEles()},m=p,h=function(t){t&&(e.getCachedZSortedEles().forEach(function(e){pp(e),c(e),u(e)}),e.updateCachedGrabbedEles())},g=function(e,t){if((t.inDragLayer!=null||t.addToList!=null)&&e.cy().hasCompoundNodes()){var n=e.ancestors().orphans();if(!n.same(e)){var r=n.descendants().spawnSelf().merge(n).unmerge(e).unmerge(e.descendants()),i=r.connectedEdges();t.inDragLayer&&(i.forEach(s),r.forEach(s)),t.addToList&&r.forEach(function(e){d(e,t)})}}},_=function(){document.activeElement!=null&&document.activeElement.blur!=null&&document.activeElement.blur()},v=typeof MutationObserver<`u`,y=typeof ResizeObserver<`u`;v?(e.removeObserver=new MutationObserver(function(t){for(var n=0;n<t.length;n++){var r=t[n].removedNodes;if(r){for(var i=0;i<r.length;i++)if(r[i]===e.container){e.destroy();break}}}}),e.container.parentNode&&e.removeObserver.observe(e.container.parentNode,{childList:!0})):e.registerBinding(e.container,`DOMNodeRemoved`,function(t){e.destroy()});var b=Dt(function(){e.cy.resize()},100);v&&(e.styleObserver=new MutationObserver(b),e.styleObserver.observe(e.container,{attributes:!0})),e.registerBinding(t,`resize`,b),y&&(e.resizeObserver=new ResizeObserver(b),e.resizeObserver.observe(e.container));var x=function(e,t){for(;e!=null;)t(e),e=e.parentNode},S=function(){e.invalidateContainerClientCoordsCache()};x(e.container,function(t){e.registerBinding(t,`transitionend`,S),e.registerBinding(t,`animationend`,S),e.registerBinding(t,`scroll`,S)}),e.registerBinding(e.container,`contextmenu`,function(e){e.preventDefault()});var C=function(){return e.selection[4]!==0},w=function(t){for(var n=e.findContainerClientCoords(),r=n[0],i=n[1],a=n[2],o=n[3],s=t.touches?t.touches:[t],c=!1,l=0;l<s.length;l++){var u=s[l];if(r<=u.clientX&&u.clientX<=r+a&&i<=u.clientY&&u.clientY<=i+o){c=!0;break}}if(!c)return!1;for(var d=e.container,f=t.target.parentNode,p=!1;f;){if(f===d){p=!0;break}f=f.parentNode}return!!p};e.registerBinding(e.container,`mousedown`,function(t){if(w(t)&&(e.hoverData.which!==1||t.which===1)){t.preventDefault(),_(),e.hoverData.capture=!0,e.hoverData.which=t.which;var n=e.cy,r=[t.clientX,t.clientY],a=e.projectIntoViewport(r[0],r[1]),o=e.selection,s=e.findNearestElements(a[0],a[1],!0,!1),c=s[0],u=e.dragData.possibleDragElements;e.hoverData.mdownPos=a,e.hoverData.mdownGPos=r;var d=function(e){return{originalEvent:t,type:e,position:{x:a[0],y:a[1]}}},f=function(){e.hoverData.tapholdCancelled=!1,clearTimeout(e.hoverData.tapholdTimeout),e.hoverData.tapholdTimeout=setTimeout(function(){if(!e.hoverData.tapholdCancelled){var t=e.hoverData.down;t?t.emit(d(`taphold`)):n.emit(d(`taphold`))}},e.tapholdDuration)};if(t.which==3){e.hoverData.cxtStarted=!0;var h={originalEvent:t,type:`cxttapstart`,position:{x:a[0],y:a[1]}};c?(c.activate(),c.emit(h),e.hoverData.down=c):n.emit(h),e.hoverData.downTime=new Date().getTime(),e.hoverData.cxtDragged=!1}else if(t.which==1){if(c&&c.activate(),c!=null&&e.nodeIsGrabbable(c)){var g=function(e){e.emit(d(`grab`))};if(l(c),!c.selected())u=e.dragData.possibleDragElements=n.collection(),m(c,{addToList:u}),c.emit(d(`grabon`)).emit(d(`grab`));else{u=e.dragData.possibleDragElements=n.collection();var v=n.$(function(t){return t.isNode()&&t.selected()&&e.nodeIsGrabbable(t)});p(v,{addToList:u}),c.emit(d(`grabon`)),v.forEach(g)}e.redrawHint(`eles`,!0),e.redrawHint(`drag`,!0)}e.hoverData.down=c,e.hoverData.downs=s,e.hoverData.downTime=new Date().getTime(),i(c,[`mousedown`,`tapstart`,`vmousedown`],t,{x:a[0],y:a[1]}),c==null?(o[4]=1,e.data.bgActivePosistion={x:a[0],y:a[1]},e.redrawHint(`select`,!0),e.redraw()):c.pannable()&&(o[4]=1),f()}o[0]=o[2]=a[0],o[1]=o[3]=a[1]}},!1);var T=r(e.container);e.registerBinding([t,T],`mousemove`,function(t){if(!(!e.hoverData.capture&&!w(t))){var n=!1,r=e.cy,s=r.zoom(),c=[t.clientX,t.clientY],l=e.projectIntoViewport(c[0],c[1]),u=e.hoverData.mdownPos,d=e.hoverData.mdownGPos,f=e.selection,m=null;!e.hoverData.draggingEles&&!e.hoverData.dragging&&!e.hoverData.selecting&&(m=e.findNearestElement(l[0],l[1],!0,!1));var g=e.hoverData.last,_=e.hoverData.down,v=[l[0]-f[2],l[1]-f[3]],y=e.dragData.possibleDragElements,b;if(d){var x=c[0]-d[0],S=x*x,C=c[1]-d[1],T=S+C*C;e.hoverData.isOverThresholdDrag=b=T>=e.desktopTapThreshold2}var E=a(t);b&&(e.hoverData.tapholdCancelled=!0);var D=function(){var t=e.hoverData.dragDelta=e.hoverData.dragDelta||[];t.length===0?(t.push(v[0]),t.push(v[1])):(t[0]+=v[0],t[1]+=v[1])};n=!0,i(m,[`mousemove`,`vmousemove`,`tapdrag`],t,{x:l[0],y:l[1]});var O=function(e){return{originalEvent:t,type:e,position:{x:l[0],y:l[1]}}},k=function(){e.data.bgActivePosistion=void 0,e.hoverData.selecting||r.emit(O(`boxstart`)),f[4]=1,e.hoverData.selecting=!0,e.redrawHint(`select`,!0),e.redraw()};if(e.hoverData.which===3){if(b){var A=O(`cxtdrag`);_?_.emit(A):r.emit(A),e.hoverData.cxtDragged=!0,(!e.hoverData.cxtOver||m!==e.hoverData.cxtOver)&&(e.hoverData.cxtOver&&e.hoverData.cxtOver.emit(O(`cxtdragout`)),e.hoverData.cxtOver=m,m&&m.emit(O(`cxtdragover`)))}}else if(e.hoverData.dragging){if(n=!0,r.panningEnabled()&&r.userPanningEnabled()){var j;if(e.hoverData.justStartedPan){var M=e.hoverData.mdownPos;j={x:(l[0]-M[0])*s,y:(l[1]-M[1])*s},e.hoverData.justStartedPan=!1}else j={x:v[0]*s,y:v[1]*s};r.panBy(j),r.emit(O(`dragpan`)),e.hoverData.dragged=!0}l=e.projectIntoViewport(t.clientX,t.clientY)}else if(f[4]==1&&(_==null||_.pannable()))b&&(!e.hoverData.dragging&&r.boxSelectionEnabled()&&(E||!r.panningEnabled()||!r.userPanningEnabled())?k():!e.hoverData.selecting&&r.panningEnabled()&&r.userPanningEnabled()&&o(_,e.hoverData.downs)&&(e.hoverData.dragging=!0,e.hoverData.justStartedPan=!0,f[4]=0,e.data.bgActivePosistion=Xn(u),e.redrawHint(`select`,!0),e.redraw()),_&&_.pannable()&&_.active()&&_.unactivate());else{if(_&&_.pannable()&&_.active()&&_.unactivate(),(!_||!_.grabbed())&&m!=g&&(g&&i(g,[`mouseout`,`tapdragout`],t,{x:l[0],y:l[1]}),m&&i(m,[`mouseover`,`tapdragover`],t,{x:l[0],y:l[1]}),e.hoverData.last=m),_){if(b){if(r.boxSelectionEnabled()&&E)_&&_.grabbed()&&(h(y),_.emit(O(`freeon`)),y.emit(O(`free`)),e.dragData.didDrag&&(_.emit(O(`dragfreeon`)),y.emit(O(`dragfree`)))),k();else if(_&&_.grabbed()&&e.nodeIsDraggable(_)){var N=!e.dragData.didDrag;N&&e.redrawHint(`eles`,!0),e.dragData.didDrag=!0,e.hoverData.draggingEles||p(y,{inDragLayer:!0});var P={x:0,y:0};if(Y(v[0])&&Y(v[1])&&(P.x+=v[0],P.y+=v[1],N)){var F=e.hoverData.dragDelta;F&&Y(F[0])&&Y(F[1])&&(P.x+=F[0],P.y+=F[1])}e.hoverData.draggingEles=!0,y.silentShift(P).emit(O(`position`)).emit(O(`drag`)),e.redrawHint(`drag`,!0),e.redraw()}}else D()}n=!0}if(f[2]=l[0],f[3]=l[1],n)return t.stopPropagation&&t.stopPropagation(),t.preventDefault&&t.preventDefault(),!1}},!1);var E,D,O;e.registerBinding(t,`mouseup`,function(t){if(!(e.hoverData.which===1&&t.which!==1&&e.hoverData.capture)&&e.hoverData.capture){e.hoverData.capture=!1;var r=e.cy,o=e.projectIntoViewport(t.clientX,t.clientY),s=e.selection,c=e.findNearestElement(o[0],o[1],!0,!1),l=e.dragData.possibleDragElements,u=e.hoverData.down,d=a(t);e.data.bgActivePosistion&&(e.redrawHint(`select`,!0),e.redraw()),e.hoverData.tapholdCancelled=!0,e.data.bgActivePosistion=void 0,u&&u.unactivate();var f=function(e){return{originalEvent:t,type:e,position:{x:o[0],y:o[1]}}};if(e.hoverData.which===3){var p=f(`cxttapend`);if(u?u.emit(p):r.emit(p),!e.hoverData.cxtDragged){var m=f(`cxttap`);u?u.emit(m):r.emit(m)}e.hoverData.cxtDragged=!1,e.hoverData.which=null}else if(e.hoverData.which===1){if(i(c,[`mouseup`,`tapend`,`vmouseup`],t,{x:o[0],y:o[1]}),!e.dragData.didDrag&&!e.hoverData.dragged&&!e.hoverData.selecting&&!e.hoverData.isOverThresholdDrag&&(i(u,[`click`,`tap`,`vclick`],t,{x:o[0],y:o[1]}),D=!1,t.timeStamp-O<=r.multiClickDebounceTime()?(E&&clearTimeout(E),D=!0,O=null,i(u,[`dblclick`,`dbltap`,`vdblclick`],t,{x:o[0],y:o[1]})):(E=setTimeout(function(){D||i(u,[`oneclick`,`onetap`,`voneclick`],t,{x:o[0],y:o[1]})},r.multiClickDebounceTime()),O=t.timeStamp)),u==null&&!e.dragData.didDrag&&!e.hoverData.selecting&&!e.hoverData.dragged&&!a(t)&&(r.$(n).unselect([`tapunselect`]),l.length>0&&e.redrawHint(`eles`,!0),e.dragData.possibleDragElements=l=r.collection()),c==u&&!e.dragData.didDrag&&!e.hoverData.selecting&&c!=null&&c._private.selectable&&(e.hoverData.dragging||(r.selectionType()===`additive`||d?c.selected()?c.unselect([`tapunselect`]):c.select([`tapselect`]):d||(r.$(n).unmerge(c).unselect([`tapunselect`]),c.select([`tapselect`]))),e.redrawHint(`eles`,!0)),e.hoverData.selecting){var g=r.collection(e.getAllInBox(s[0],s[1],s[2],s[3]));e.redrawHint(`select`,!0),g.length>0&&e.redrawHint(`eles`,!0),r.emit(f(`boxend`)),r.selectionType()===`additive`||d||r.$(n).unmerge(g).unselect(),g.emit(f(`box`)).stdFilter(function(e){return e.selectable()&&!e.selected()}).select().emit(f(`boxselect`)),e.redraw()}if(e.hoverData.dragging&&(e.hoverData.dragging=!1,e.redrawHint(`select`,!0),e.redrawHint(`eles`,!0),e.redraw()),!s[4]){e.redrawHint(`drag`,!0),e.redrawHint(`eles`,!0);var _=u&&u.grabbed();h(l),_&&(u.emit(f(`freeon`)),l.emit(f(`free`)),e.dragData.didDrag&&(u.emit(f(`dragfreeon`)),l.emit(f(`dragfree`))))}}s[4]=0,e.hoverData.down=null,e.hoverData.cxtStarted=!1,e.hoverData.draggingEles=!1,e.hoverData.selecting=!1,e.hoverData.isOverThresholdDrag=!1,e.dragData.didDrag=!1,e.hoverData.dragged=!1,e.hoverData.dragDelta=[],e.hoverData.mdownPos=null,e.hoverData.mdownGPos=null,e.hoverData.which=null}},!1);var k=[],A=4,j,M=1e5,N=function(e){for(var t=Math.abs(e[0]),n=1;n<e.length;n++)if(Math.abs(e[n])!==t)return!1;return!0},P=function(t){var n=!1,r=t.deltaY;if(r??(t.wheelDeltaY==null?t.wheelDelta!=null&&(r=t.wheelDelta/4):r=t.wheelDeltaY/4),r!==0){if(j==null){if(k.length>=A){j=!1;var i=k;if(i[0]>=5){var a=N(i)?i[0]:nr(i);a>1&&(j=!0,M=a)}}else k.push(Math.abs(r)),n=!0}else j&&(M=Math.min(Math.abs(r),M));if(!e.scrollingPage){var o=e.cy,s=o.zoom(),c=o.pan(),l=e.projectIntoViewport(t.clientX,t.clientY),u=[l[0]*s+c.x,l[1]*s+c.y];if(e.hoverData.draggingEles||e.hoverData.dragging||e.hoverData.cxtStarted||C()){t.preventDefault();return}if(o.panningEnabled()&&o.userPanningEnabled()&&o.zoomingEnabled()&&o.userZoomingEnabled()){t.preventDefault(),e.data.wheelZooming=!0,clearTimeout(e.data.wheelTimeout),e.data.wheelTimeout=setTimeout(function(){e.data.wheelZooming=!1,e.redrawHint(`eles`,!0),e.redraw()},150);var d;n&&Math.abs(r)>5&&(r=or(r)*5),d=r/-250,j&&(d/=M,d*=3),d*=e.wheelSensitivity,t.deltaMode===1&&(d*=33);var f=o.zoom()*10**d;t.type===`gesturechange`&&(f=e.gestureStartZoom*t.scale),o.zoom({level:f,renderedPosition:{x:u[0],y:u[1]}}),o.emit({type:t.type===`gesturechange`?`pinchzoom`:`scrollzoom`,originalEvent:t,position:{x:l[0],y:l[1]}})}}}};e.registerBinding(e.container,`wheel`,P,!0),e.registerBinding(t,`scroll`,function(t){e.scrollingPage=!0,clearTimeout(e.scrollingPageTimeout),e.scrollingPageTimeout=setTimeout(function(){e.scrollingPage=!1},250)},!0),e.registerBinding(e.container,`gesturestart`,function(t){e.gestureStartZoom=e.cy.zoom(),e.hasTouchStarted||t.preventDefault()},!0),e.registerBinding(e.container,`gesturechange`,function(t){e.hasTouchStarted||P(t)},!0),e.registerBinding(e.container,`mouseout`,function(t){var n=e.projectIntoViewport(t.clientX,t.clientY);e.cy.emit({originalEvent:t,type:`mouseout`,position:{x:n[0],y:n[1]}})},!1),e.registerBinding(e.container,`mouseover`,function(t){var n=e.projectIntoViewport(t.clientX,t.clientY);e.cy.emit({originalEvent:t,type:`mouseover`,position:{x:n[0],y:n[1]}})},!1);var F,I,L,R,ee,z,B,V,H,U,W,G,K,q=function(e,t,n,r){return Math.sqrt((n-e)*(n-e)+(r-t)*(r-t))},J=function(e,t,n,r){return(n-e)*(n-e)+(r-t)*(r-t)},te;e.registerBinding(e.container,`touchstart`,te=function(t){if(e.hasTouchStarted=!0,w(t)){_(),e.touchData.capture=!0,e.data.bgActivePosistion=void 0;var n=e.cy,r=e.touchData.now,a=e.touchData.earlier;if(t.touches[0]){var o=e.projectIntoViewport(t.touches[0].clientX,t.touches[0].clientY);r[0]=o[0],r[1]=o[1]}if(t.touches[1]){var o=e.projectIntoViewport(t.touches[1].clientX,t.touches[1].clientY);r[2]=o[0],r[3]=o[1]}if(t.touches[2]){var o=e.projectIntoViewport(t.touches[2].clientX,t.touches[2].clientY);r[4]=o[0],r[5]=o[1]}var s=function(e){return{originalEvent:t,type:e,position:{x:r[0],y:r[1]}}};if(t.touches[1]){e.touchData.singleTouchMoved=!0,h(e.dragData.touchDragEles);var c=e.findContainerClientCoords();H=c[0],U=c[1],W=c[2],G=c[3],F=t.touches[0].clientX-H,I=t.touches[0].clientY-U,L=t.touches[1].clientX-H,R=t.touches[1].clientY-U,K=0<=F&&F<=W&&0<=L&&L<=W&&0<=I&&I<=G&&0<=R&&R<=G;var u=n.pan(),d=n.zoom();ee=q(F,I,L,R),z=J(F,I,L,R),B=[(F+L)/2,(I+R)/2],V=[(B[0]-u.x)/d,(B[1]-u.y)/d];var f=200,g=f*f;if(z<g&&!t.touches[2]){var v=e.findNearestElement(r[0],r[1],!0,!0),y=e.findNearestElement(r[2],r[3],!0,!0);v&&v.isNode()?(v.activate().emit(s(`cxttapstart`)),e.touchData.start=v):y&&y.isNode()?(y.activate().emit(s(`cxttapstart`)),e.touchData.start=y):n.emit(s(`cxttapstart`)),e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxt=!0,e.touchData.cxtDragged=!1,e.data.bgActivePosistion=void 0,e.redraw();return}}if(t.touches[2])n.boxSelectionEnabled()&&t.preventDefault();else if(!t.touches[1]&&t.touches[0]){var b=e.findNearestElements(r[0],r[1],!0,!0),x=b[0];if(x!=null&&(x.activate(),e.touchData.start=x,e.touchData.starts=b,e.nodeIsGrabbable(x))){var S=e.dragData.touchDragEles=n.collection(),C=null;e.redrawHint(`eles`,!0),e.redrawHint(`drag`,!0),x.selected()?(C=n.$(function(t){return t.selected()&&e.nodeIsGrabbable(t)}),p(C,{addToList:S})):m(x,{addToList:S}),l(x),x.emit(s(`grabon`)),C?C.forEach(function(e){e.emit(s(`grab`))}):x.emit(s(`grab`))}i(x,[`touchstart`,`tapstart`,`vmousedown`],t,{x:r[0],y:r[1]}),x??(e.data.bgActivePosistion={x:o[0],y:o[1]},e.redrawHint(`select`,!0),e.redraw()),e.touchData.singleTouchMoved=!1,e.touchData.singleTouchStartTime=+new Date,clearTimeout(e.touchData.tapholdTimeout),e.touchData.tapholdTimeout=setTimeout(function(){e.touchData.singleTouchMoved===!1&&!e.pinching&&!e.touchData.selecting&&i(e.touchData.start,[`taphold`],t,{x:r[0],y:r[1]})},e.tapholdDuration)}if(t.touches.length>=1){for(var T=e.touchData.startPosition=[null,null,null,null,null,null],E=0;E<r.length;E++)T[E]=a[E]=r[E];var D=t.touches[0];e.touchData.startGPosition=[D.clientX,D.clientY]}}},!1);var ne;e.registerBinding(t,`touchmove`,ne=function(t){var n=e.touchData.capture;if(!(!n&&!w(t))){var r=e.selection,a=e.cy,s=e.touchData.now,c=e.touchData.earlier,l=a.zoom();if(t.touches[0]){var u=e.projectIntoViewport(t.touches[0].clientX,t.touches[0].clientY);s[0]=u[0],s[1]=u[1]}if(t.touches[1]){var u=e.projectIntoViewport(t.touches[1].clientX,t.touches[1].clientY);s[2]=u[0],s[3]=u[1]}if(t.touches[2]){var u=e.projectIntoViewport(t.touches[2].clientX,t.touches[2].clientY);s[4]=u[0],s[5]=u[1]}var d=function(e){return{originalEvent:t,type:e,position:{x:s[0],y:s[1]}}},f=e.touchData.startGPosition,m;if(n&&t.touches[0]&&f){for(var g=[],_=0;_<s.length;_++)g[_]=s[_]-c[_];var v=t.touches[0].clientX-f[0],y=v*v,b=t.touches[0].clientY-f[1];m=y+b*b>=e.touchTapThreshold2}if(n&&e.touchData.cxt){t.preventDefault();var x=t.touches[0].clientX-H,S=t.touches[0].clientY-U,C=t.touches[1].clientX-H,T=t.touches[1].clientY-U,E=J(x,S,C,T),D=E/z,O=150,k=O*O,A=1.5;if(D>=A*A||E>=k){e.touchData.cxt=!1,e.data.bgActivePosistion=void 0,e.redrawHint(`select`,!0);var j=d(`cxttapend`);e.touchData.start?(e.touchData.start.unactivate().emit(j),e.touchData.start=null):a.emit(j)}}if(n&&e.touchData.cxt){var j=d(`cxtdrag`);e.data.bgActivePosistion=void 0,e.redrawHint(`select`,!0),e.touchData.start?e.touchData.start.emit(j):a.emit(j),e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxtDragged=!0;var M=e.findNearestElement(s[0],s[1],!0,!0);(!e.touchData.cxtOver||M!==e.touchData.cxtOver)&&(e.touchData.cxtOver&&e.touchData.cxtOver.emit(d(`cxtdragout`)),e.touchData.cxtOver=M,M&&M.emit(d(`cxtdragover`)))}else if(n&&t.touches[2]&&a.boxSelectionEnabled())t.preventDefault(),e.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,e.touchData.selecting||a.emit(d(`boxstart`)),e.touchData.selecting=!0,e.touchData.didSelect=!0,r[4]=1,!r||r.length===0||r[0]===void 0?(r[0]=(s[0]+s[2]+s[4])/3,r[1]=(s[1]+s[3]+s[5])/3,r[2]=(s[0]+s[2]+s[4])/3+1,r[3]=(s[1]+s[3]+s[5])/3+1):(r[2]=(s[0]+s[2]+s[4])/3,r[3]=(s[1]+s[3]+s[5])/3),e.redrawHint(`select`,!0),e.redraw();else if(n&&t.touches[1]&&!e.touchData.didSelect&&a.zoomingEnabled()&&a.panningEnabled()&&a.userZoomingEnabled()&&a.userPanningEnabled()){t.preventDefault(),e.data.bgActivePosistion=void 0,e.redrawHint(`select`,!0);var N=e.dragData.touchDragEles;if(N){e.redrawHint(`drag`,!0);for(var P=0;P<N.length;P++){var B=N[P]._private;B.grabbed=!1,B.rscratch.inDragLayer=!1}}var W=e.touchData.start,x=t.touches[0].clientX-H,S=t.touches[0].clientY-U,C=t.touches[1].clientX-H,T=t.touches[1].clientY-U,G=q(x,S,C,T),te=G/ee;if(K){var ne=x-F,re=S-I,ie=C-L,ae=T-R,oe=(ne+ie)/2,se=(re+ae)/2,ce=a.zoom(),le=ce*te,ue=a.pan(),de=V[0]*ce+ue.x,fe=V[1]*ce+ue.y,pe={x:-le/ce*(de-ue.x-oe)+de,y:-le/ce*(fe-ue.y-se)+fe};if(W&&W.active()){var N=e.dragData.touchDragEles;h(N),e.redrawHint(`drag`,!0),e.redrawHint(`eles`,!0),W.unactivate().emit(d(`freeon`)),N&&N.emit(d(`free`)),e.dragData.didDrag&&(W.emit(d(`dragfreeon`)),N&&N.emit(d(`dragfree`)))}a.viewport({zoom:le,pan:pe,cancelOnFailedZoom:!0}),a.emit(d(`pinchzoom`)),ee=G,F=x,I=S,L=C,R=T,e.pinching=!0}if(t.touches[0]){var u=e.projectIntoViewport(t.touches[0].clientX,t.touches[0].clientY);s[0]=u[0],s[1]=u[1]}if(t.touches[1]){var u=e.projectIntoViewport(t.touches[1].clientX,t.touches[1].clientY);s[2]=u[0],s[3]=u[1]}if(t.touches[2]){var u=e.projectIntoViewport(t.touches[2].clientX,t.touches[2].clientY);s[4]=u[0],s[5]=u[1]}}else if(t.touches[0]&&!e.touchData.didSelect){var me=e.touchData.start,he=e.touchData.last,M;if(!e.hoverData.draggingEles&&!e.swipePanning&&(M=e.findNearestElement(s[0],s[1],!0,!0)),n&&me!=null&&t.preventDefault(),n&&me!=null&&e.nodeIsDraggable(me)){if(m){var N=e.dragData.touchDragEles,ge=!e.dragData.didDrag;ge&&p(N,{inDragLayer:!0}),e.dragData.didDrag=!0;var _e={x:0,y:0};if(Y(g[0])&&Y(g[1])&&(_e.x+=g[0],_e.y+=g[1],ge)){e.redrawHint(`eles`,!0);var ve=e.touchData.dragDelta;ve&&Y(ve[0])&&Y(ve[1])&&(_e.x+=ve[0],_e.y+=ve[1])}e.hoverData.draggingEles=!0,N.silentShift(_e).emit(d(`position`)).emit(d(`drag`)),e.redrawHint(`drag`,!0),e.touchData.startPosition[0]==c[0]&&e.touchData.startPosition[1]==c[1]&&e.redrawHint(`eles`,!0),e.redraw()}else{var ve=e.touchData.dragDelta=e.touchData.dragDelta||[];ve.length===0?(ve.push(g[0]),ve.push(g[1])):(ve[0]+=g[0],ve[1]+=g[1])}}if(i(me||M,[`touchmove`,`tapdrag`,`vmousemove`],t,{x:s[0],y:s[1]}),(!me||!me.grabbed())&&M!=he&&(he&&he.emit(d(`tapdragout`)),M&&M.emit(d(`tapdragover`))),e.touchData.last=M,n)for(var P=0;P<s.length;P++)s[P]&&e.touchData.startPosition[P]&&m&&(e.touchData.singleTouchMoved=!0);if(n&&(me==null||me.pannable())&&a.panningEnabled()&&a.userPanningEnabled()){o(me,e.touchData.starts)&&(t.preventDefault(),e.data.bgActivePosistion||(e.data.bgActivePosistion=Xn(e.touchData.startPosition)),e.swipePanning?(a.panBy({x:g[0]*l,y:g[1]*l}),a.emit(d(`dragpan`))):m&&(e.swipePanning=!0,a.panBy({x:v*l,y:b*l}),a.emit(d(`dragpan`)),me&&(me.unactivate(),e.redrawHint(`select`,!0),e.touchData.start=null)));var u=e.projectIntoViewport(t.touches[0].clientX,t.touches[0].clientY);s[0]=u[0],s[1]=u[1]}}for(var _=0;_<s.length;_++)c[_]=s[_];n&&t.touches.length>0&&!e.hoverData.draggingEles&&!e.swipePanning&&e.data.bgActivePosistion!=null&&(e.data.bgActivePosistion=void 0,e.redrawHint(`select`,!0),e.redraw())}},!1);var re;e.registerBinding(t,`touchcancel`,re=function(t){var n=e.touchData.start;e.touchData.capture=!1,n&&n.unactivate()});var ie,ae,oe,se;if(e.registerBinding(t,`touchend`,ie=function(t){var r=e.touchData.start;if(e.touchData.capture)t.touches.length===0&&(e.touchData.capture=!1),t.preventDefault();else return;var a=e.selection;e.swipePanning=!1,e.hoverData.draggingEles=!1;var o=e.cy,s=o.zoom(),c=e.touchData.now,l=e.touchData.earlier;if(t.touches[0]){var u=e.projectIntoViewport(t.touches[0].clientX,t.touches[0].clientY);c[0]=u[0],c[1]=u[1]}if(t.touches[1]){var u=e.projectIntoViewport(t.touches[1].clientX,t.touches[1].clientY);c[2]=u[0],c[3]=u[1]}if(t.touches[2]){var u=e.projectIntoViewport(t.touches[2].clientX,t.touches[2].clientY);c[4]=u[0],c[5]=u[1]}var d=function(e){return{originalEvent:t,type:e,position:{x:c[0],y:c[1]}}};r&&r.unactivate();var f;if(e.touchData.cxt){if(f=d(`cxttapend`),r?r.emit(f):o.emit(f),!e.touchData.cxtDragged){var p=d(`cxttap`);r?r.emit(p):o.emit(p)}e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxt=!1,e.touchData.start=null,e.redraw();return}if(!t.touches[2]&&o.boxSelectionEnabled()&&e.touchData.selecting){e.touchData.selecting=!1;var m=o.collection(e.getAllInBox(a[0],a[1],a[2],a[3]));a[0]=void 0,a[1]=void 0,a[2]=void 0,a[3]=void 0,a[4]=0,e.redrawHint(`select`,!0),o.emit(d(`boxend`)),m.emit(d(`box`)).stdFilter(function(e){return e.selectable()&&!e.selected()}).select().emit(d(`boxselect`)),m.nonempty()&&e.redrawHint(`eles`,!0),e.redraw()}if(r?.unactivate(),t.touches[2])e.data.bgActivePosistion=void 0,e.redrawHint(`select`,!0);else if(!t.touches[1]&&!t.touches[0]&&!t.touches[0]){e.data.bgActivePosistion=void 0,e.redrawHint(`select`,!0);var g=e.dragData.touchDragEles;if(r!=null){var _=r._private.grabbed;h(g),e.redrawHint(`drag`,!0),e.redrawHint(`eles`,!0),_&&(r.emit(d(`freeon`)),g.emit(d(`free`)),e.dragData.didDrag&&(r.emit(d(`dragfreeon`)),g.emit(d(`dragfree`)))),i(r,[`touchend`,`tapend`,`vmouseup`,`tapdragout`],t,{x:c[0],y:c[1]}),r.unactivate(),e.touchData.start=null}else i(e.findNearestElement(c[0],c[1],!0,!0),[`touchend`,`tapend`,`vmouseup`,`tapdragout`],t,{x:c[0],y:c[1]});var v=e.touchData.startPosition[0]-c[0],y=v*v,b=e.touchData.startPosition[1]-c[1],x=(y+b*b)*s*s;e.touchData.singleTouchMoved||(r||o.$(`:selected`).unselect([`tapunselect`]),i(r,[`tap`,`vclick`],t,{x:c[0],y:c[1]}),ae=!1,t.timeStamp-se<=o.multiClickDebounceTime()?(oe&&clearTimeout(oe),ae=!0,se=null,i(r,[`dbltap`,`vdblclick`],t,{x:c[0],y:c[1]})):(oe=setTimeout(function(){ae||i(r,[`onetap`,`voneclick`],t,{x:c[0],y:c[1]})},o.multiClickDebounceTime()),se=t.timeStamp)),r!=null&&!e.dragData.didDrag&&r._private.selectable&&x<e.touchTapThreshold2&&!e.pinching&&(o.selectionType()===`single`?(o.$(n).unmerge(r).unselect([`tapunselect`]),r.select([`tapselect`])):r.selected()?r.unselect([`tapunselect`]):r.select([`tapselect`]),e.redrawHint(`eles`,!0)),e.touchData.singleTouchMoved=!0}for(var S=0;S<c.length;S++)l[S]=c[S];e.dragData.didDrag=!1,t.touches.length===0&&(e.touchData.dragDelta=[],e.touchData.startPosition=[null,null,null,null,null,null],e.touchData.startGPosition=null,e.touchData.didSelect=!1),t.touches.length<2&&(t.touches.length===1&&(e.touchData.startGPosition=[t.touches[0].clientX,t.touches[0].clientY]),e.pinching=!1,e.redrawHint(`eles`,!0),e.redraw())},!1),typeof TouchEvent>`u`){var ce=[],le=function(e){return{clientX:e.clientX,clientY:e.clientY,force:1,identifier:e.pointerId,pageX:e.pageX,pageY:e.pageY,radiusX:e.width/2,radiusY:e.height/2,screenX:e.screenX,screenY:e.screenY,target:e.target}},ue=function(e){return{event:e,touch:le(e)}},de=function(e){ce.push(ue(e))},fe=function(e){for(var t=0;t<ce.length;t++)if(ce[t].event.pointerId===e.pointerId){ce.splice(t,1);return}},pe=function(e){var t=ce.filter(function(t){return t.event.pointerId===e.pointerId})[0];t.event=e,t.touch=le(e)},me=function(e){e.touches=ce.map(function(e){return e.touch})},he=function(e){return e.pointerType===`mouse`||e.pointerType===4};e.registerBinding(e.container,`pointerdown`,function(e){he(e)||(e.preventDefault(),de(e),me(e),te(e))}),e.registerBinding(e.container,`pointerup`,function(e){he(e)||(fe(e),me(e),ie(e))}),e.registerBinding(e.container,`pointercancel`,function(e){he(e)||(fe(e),me(e),re(e))}),e.registerBinding(e.container,`pointermove`,function(e){he(e)||(e.preventDefault(),pe(e),me(e),ne(e))})}};var hp={};hp.generatePolygon=function(e,t){return this.nodeShapes[e]={renderer:this,name:e,points:t,draw:function(e,t,n,r,i,a){this.renderer.nodeShapeImpl(`polygon`,e,t,n,r,i,this.points)},intersectLine:function(e,t,n,r,i,a,o,s){return qr(i,a,this.points,e,t,n/2,r/2,o)},checkPoint:function(e,t,n,r,i,a,o,s){return Lr(e,t,this.points,a,o,r,i,[0,-1],n)},hasMiterBounds:e!==`rectangle`,miterBounds:function(e,t,n,r,i,a){return Or(this.points,e,t,n,r,i)}}},hp.generateEllipse=function(){return this.nodeShapes.ellipse={renderer:this,name:`ellipse`,draw:function(e,t,n,r,i,a){this.renderer.nodeShapeImpl(this.name,e,t,n,r,i)},intersectLine:function(e,t,n,r,i,a,o,s){return Vr(i,a,e,t,n/2+o,r/2+o)},checkPoint:function(e,t,n,r,i,a,o,s){return Hr(e,t,r,i,a,o,n)}}},hp.generateRoundPolygon=function(e,t){return this.nodeShapes[e]={renderer:this,name:e,points:t,getOrCreateCorners:function(e,n,r,i,a,o,s){if(o[s]!==void 0&&o[s+`-cx`]===e&&o[s+`-cy`]===n&&o[s+`-w`]===r&&o[s+`-h`]===i&&o[s+`-corner-radius`]===a)return o[s];o[s]=Array(t.length/2),o[s+`-cx`]=e,o[s+`-cy`]=n,o[s+`-w`]=r,o[s+`-h`]=i,o[s+`-corner-radius`]=a;var c=r/2,l=i/2;a=a===`auto`?ei(r,i):a;for(var u=Array(t.length/2),d=0;d<t.length/2;d++)u[d]={x:e+c*t[d*2],y:n+l*t[d*2+1]};var f,p,m,h,g=u.length;for(p=u[g-1],f=0;f<g;f++)m=u[f%g],h=u[(f+1)%g],o[s][f]=Kf(p,m,h,a),p=m,m=h;return o[s]},draw:function(e,t,n,r,i,a,o){this.renderer.nodeShapeImpl(`round-polygon`,e,t,n,r,i,this.points,this.getOrCreateCorners(t,n,r,i,a,o,`drawCorners`))},intersectLine:function(e,t,n,r,i,a,o,s,c){return Jr(i,a,this.points,e,t,n,r,o,this.getOrCreateCorners(e,t,n,r,s,c,`corners`))},checkPoint:function(e,t,n,r,i,a,o,s,c){return Rr(e,t,this.points,a,o,r,i,this.getOrCreateCorners(a,o,r,i,s,c,`corners`))}}},hp.generateRoundRectangle=function(){return this.nodeShapes[`round-rectangle`]=this.nodeShapes.roundrectangle={renderer:this,name:`round-rectangle`,points:Xr(4,0),draw:function(e,t,n,r,i,a){this.renderer.nodeShapeImpl(this.name,e,t,n,r,i,this.points,a)},intersectLine:function(e,t,n,r,i,a,o,s){return kr(i,a,e,t,n,r,o,s)},checkPoint:function(e,t,n,r,i,a,o,s){var c=r/2,l=i/2;s=s===`auto`?$r(r,i):s,s=Math.min(c,l,s);var u=s*2;return!!(Lr(e,t,this.points,a,o,r,i-u,[0,-1],n)||Lr(e,t,this.points,a,o,r-u,i,[0,-1],n)||Hr(e,t,u,u,a-c+s,o-l+s,n)||Hr(e,t,u,u,a+c-s,o-l+s,n)||Hr(e,t,u,u,a+c-s,o+l-s,n)||Hr(e,t,u,u,a-c+s,o+l-s,n))}}},hp.generateCutRectangle=function(){return this.nodeShapes[`cut-rectangle`]=this.nodeShapes.cutrectangle={renderer:this,name:`cut-rectangle`,cornerLength:ti(),points:Xr(4,0),draw:function(e,t,n,r,i,a){this.renderer.nodeShapeImpl(this.name,e,t,n,r,i,null,a)},generateCutTrianglePts:function(e,t,n,r,i){var a=i===`auto`?this.cornerLength:i,o=t/2,s=e/2,c=n-s,l=n+s,u=r-o,d=r+o;return{topLeft:[c,u+a,c+a,u,c+a,u+a],topRight:[l-a,u,l,u+a,l-a,u+a],bottomRight:[l,d-a,l-a,d,l-a,d-a],bottomLeft:[c+a,d,c,d-a,c+a,d-a]}},intersectLine:function(e,t,n,r,i,a,o,s){var c=this.generateCutTrianglePts(n+2*o,r+2*o,e,t,s);return qr(i,a,[].concat.apply([],[c.topLeft.splice(0,4),c.topRight.splice(0,4),c.bottomRight.splice(0,4),c.bottomLeft.splice(0,4)]),e,t)},checkPoint:function(e,t,n,r,i,a,o,s){var c=s===`auto`?this.cornerLength:s;if(Lr(e,t,this.points,a,o,r,i-2*c,[0,-1],n)||Lr(e,t,this.points,a,o,r-2*c,i,[0,-1],n))return!0;var l=this.generateCutTrianglePts(r,i,a,o);return Ir(e,t,l.topLeft)||Ir(e,t,l.topRight)||Ir(e,t,l.bottomRight)||Ir(e,t,l.bottomLeft)}}},hp.generateBarrel=function(){return this.nodeShapes.barrel={renderer:this,name:`barrel`,points:Xr(4,0),draw:function(e,t,n,r,i,a){this.renderer.nodeShapeImpl(this.name,e,t,n,r,i)},intersectLine:function(e,t,n,r,i,a,o,s){var c=this.generateBarrelBezierPts(n+2*o,r+2*o,e,t),l=function(e){var t=dr({x:e[0],y:e[1]},{x:e[2],y:e[3]},{x:e[4],y:e[5]},.15),n=dr({x:e[0],y:e[1]},{x:e[2],y:e[3]},{x:e[4],y:e[5]},.5),r=dr({x:e[0],y:e[1]},{x:e[2],y:e[3]},{x:e[4],y:e[5]},.85);return[e[0],e[1],t.x,t.y,n.x,n.y,r.x,r.y,e[4],e[5]]};return qr(i,a,[].concat(l(c.topLeft),l(c.topRight),l(c.bottomRight),l(c.bottomLeft)),e,t)},generateBarrelBezierPts:function(e,t,n,r){var i=t/2,a=e/2,o=n-a,s=n+a,c=r-i,l=r+i,u=ri(e,t),d=u.heightOffset,f=u.widthOffset,p=u.ctrlPtOffsetPct*e,m={topLeft:[o,c+d,o+p,c,o+f,c],topRight:[s-f,c,s-p,c,s,c+d],bottomRight:[s,l-d,s-p,l,s-f,l],bottomLeft:[o+f,l,o+p,l,o,l-d]};return m.topLeft.isTop=!0,m.topRight.isTop=!0,m.bottomLeft.isBottom=!0,m.bottomRight.isBottom=!0,m},checkPoint:function(e,t,n,r,i,a,o,s){var c=ri(r,i),l=c.heightOffset,u=c.widthOffset;if(Lr(e,t,this.points,a,o,r,i-2*l,[0,-1],n)||Lr(e,t,this.points,a,o,r-2*u,i,[0,-1],n))return!0;for(var d=this.generateBarrelBezierPts(r,i,a,o),f=function(e,t,n){var r=n[4],i=n[2],a=n[0],o=n[5],s=n[1];if(Math.min(r,a)<=e&&e<=Math.max(r,a)&&Math.min(o,s)<=t&&t<=Math.max(o,s)){var c=ni(r,i,a),l=Mr(c[0],c[1],c[2],e).filter(function(e){return 0<=e&&e<=1});if(l.length>0)return l[0]}return null},p=Object.keys(d),m=0;m<p.length;m++){var h=d[p[m]],g=f(e,t,h);if(g!=null){var _=h[5],v=h[3],y=h[1],b=ur(_,v,y,g);if(h.isTop&&b<=t||h.isBottom&&t<=b)return!0}}return!1}}},hp.generateBottomRoundrectangle=function(){return this.nodeShapes[`bottom-round-rectangle`]=this.nodeShapes.bottomroundrectangle={renderer:this,name:`bottom-round-rectangle`,points:Xr(4,0),draw:function(e,t,n,r,i,a){this.renderer.nodeShapeImpl(this.name,e,t,n,r,i,this.points,a)},intersectLine:function(e,t,n,r,i,a,o,s){var c=e-(n/2+o),l=t-(r/2+o),u=l,d=Gr(i,a,e,t,c,l,e+(n/2+o),u,!1);return d.length>0?d:kr(i,a,e,t,n,r,o,s)},checkPoint:function(e,t,n,r,i,a,o,s){s=s===`auto`?$r(r,i):s;var c=2*s;if(Lr(e,t,this.points,a,o,r,i-c,[0,-1],n)||Lr(e,t,this.points,a,o,r-c,i,[0,-1],n))return!0;var l=r/2+2*n,u=i/2+2*n;return!!(Ir(e,t,[a-l,o-u,a-l,o,a+l,o,a+l,o-u])||Hr(e,t,c,c,a+r/2-s,o+i/2-s,n)||Hr(e,t,c,c,a-r/2+s,o+i/2-s,n))}}},hp.registerNodeShapes=function(){var e=this.nodeShapes={},t=this;this.generateEllipse(),this.generatePolygon(`triangle`,Xr(3,0)),this.generateRoundPolygon(`round-triangle`,Xr(3,0)),this.generatePolygon(`rectangle`,Xr(4,0)),e.square=e.rectangle,this.generateRoundRectangle(),this.generateCutRectangle(),this.generateBarrel(),this.generateBottomRoundrectangle();var n=[0,1,1,0,0,-1,-1,0];this.generatePolygon(`diamond`,n),this.generateRoundPolygon(`round-diamond`,n),this.generatePolygon(`pentagon`,Xr(5,0)),this.generateRoundPolygon(`round-pentagon`,Xr(5,0)),this.generatePolygon(`hexagon`,Xr(6,0)),this.generateRoundPolygon(`round-hexagon`,Xr(6,0)),this.generatePolygon(`heptagon`,Xr(7,0)),this.generateRoundPolygon(`round-heptagon`,Xr(7,0)),this.generatePolygon(`octagon`,Xr(8,0)),this.generateRoundPolygon(`round-octagon`,Xr(8,0));var r=Array(20),i=Qr(5,0),a=Qr(5,Math.PI/5),o=.5*(3-Math.sqrt(5));o*=1.57;for(var s=0;s<a.length/2;s++)a[s*2]*=o,a[s*2+1]*=o;for(var s=0;s<5;s++)r[s*4]=i[s*2],r[s*4+1]=i[s*2+1],r[s*4+2]=a[s*2],r[s*4+3]=a[s*2+1];r=Zr(r),this.generatePolygon(`star`,r),this.generatePolygon(`vee`,[-1,-1,0,-.333,1,-1,0,1]),this.generatePolygon(`rhomboid`,[-1,-1,.333,-1,1,1,-.333,1]),this.generatePolygon(`right-rhomboid`,[-.333,-1,1,-1,.333,1,-1,1]),this.nodeShapes.concavehexagon=this.generatePolygon(`concave-hexagon`,[-1,-.95,-.75,0,-1,.95,1,.95,.75,0,1,-.95]);var c=[-1,-1,.25,-1,1,0,.25,1,-1,1];this.generatePolygon(`tag`,c),this.generateRoundPolygon(`round-tag`,c),e.makePolygon=function(e){var n=`polygon-`+e.join(`$`),r;return(r=this[n])?r:t.generatePolygon(n,e)}};var gp={};gp.timeToRender=function(){return this.redrawTotalTime/this.redrawCount},gp.redraw=function(e){e||=fn();var t=this;t.averageRedrawTime===void 0&&(t.averageRedrawTime=0),t.lastRedrawTime===void 0&&(t.lastRedrawTime=0),t.lastDrawTime===void 0&&(t.lastDrawTime=0),t.requestedFrame=!0,t.renderOptions=e},gp.beforeRender=function(e,t){if(!this.destroyed){t??rn(`Priority is not optional for beforeRender`);var n=this.beforeRenderCallbacks;n.push({fn:e,priority:t}),n.sort(function(e,t){return t.priority-e.priority})}};var _p=function(e,t,n){for(var r=e.beforeRenderCallbacks,i=0;i<r.length;i++)r[i].fn(t,n)};gp.startRenderLoop=function(){var e=this,t=e.cy;if(!e.renderLoopStarted){e.renderLoopStarted=!0;var n=function(r){if(!e.destroyed){if(!t.batching()){if(e.requestedFrame&&!e.skipFrame){_p(e,!0,r);var i=Mt();e.render(e.renderOptions);var a=e.lastDrawTime=Mt();e.averageRedrawTime===void 0&&(e.averageRedrawTime=a-i),e.redrawCount===void 0&&(e.redrawCount=0),e.redrawCount++,e.redrawTotalTime===void 0&&(e.redrawTotalTime=0);var o=a-i;e.redrawTotalTime+=o,e.lastRedrawTime=o,e.averageRedrawTime=e.averageRedrawTime/2+o/2,e.requestedFrame=!1}else _p(e,!1,r)}e.skipFrame=!1,jt(n)}};jt(n)}};var vp=function(e){this.init(e)},yp=vp.prototype;yp.clientFunctions=[`redrawHint`,`render`,`renderTo`,`matchCanvasSize`,`nodeShapeImpl`,`arrowShapeImpl`],yp.init=function(e){var t=this;t.options=e,t.cy=e.cy;var n=t.container=e.cy.container(),r=t.cy.window();if(r){var i=r.document,a=i.head,o=`__________cytoscape_stylesheet`,s=`__________cytoscape_container`,c=i.getElementById(o)!=null;if(n.className.indexOf(s)<0&&(n.className=(n.className||``)+` `+s),!c){var l=i.createElement(`style`);l.id=o,l.textContent=`.`+s+` { position: relative; }`,a.insertBefore(l,a.children[0])}r.getComputedStyle(n).getPropertyValue(`position`)===`static`&&on(`A Cytoscape container has style position:static and so can not use UI extensions properly`)}t.selection=[void 0,void 0,void 0,void 0,0],t.bezierProjPcts=[.05,.225,.4,.5,.6,.775,.95],t.hoverData={down:null,last:null,downTime:null,triggerMode:null,dragging:!1,initialPan:[null,null],capture:!1},t.dragData={possibleDragElements:[]},t.touchData={start:null,capture:!1,startPosition:[null,null,null,null,null,null],singleTouchStartTime:null,singleTouchMoved:!0,now:[null,null,null,null,null,null],earlier:[null,null,null,null,null,null]},t.redraws=0,t.showFps=e.showFps,t.debug=e.debug,t.webgl=e.webgl,t.hideEdgesOnViewport=e.hideEdgesOnViewport,t.textureOnViewport=e.textureOnViewport,t.wheelSensitivity=e.wheelSensitivity,t.motionBlurEnabled=e.motionBlur,t.forcedPixelRatio=Y(e.pixelRatio)?e.pixelRatio:null,t.motionBlur=e.motionBlur,t.motionBlurOpacity=e.motionBlurOpacity,t.motionBlurTransparency=1-t.motionBlurOpacity,t.motionBlurPxRatio=1,t.mbPxRBlurry=1,t.minMbLowQualFrames=4,t.fullQualityMb=!1,t.clearedForMotionBlur=[],t.desktopTapThreshold=e.desktopTapThreshold,t.desktopTapThreshold2=e.desktopTapThreshold*e.desktopTapThreshold,t.touchTapThreshold=e.touchTapThreshold,t.touchTapThreshold2=e.touchTapThreshold*e.touchTapThreshold,t.tapholdDuration=500,t.bindings=[],t.beforeRenderCallbacks=[],t.beforeRenderPriorities={animations:400,eleCalcs:300,eleTxrDeq:200,lyrTxrDeq:150,lyrTxrSkip:100},t.registerNodeShapes(),t.registerArrowShapes(),t.registerCalculationListeners()},yp.notify=function(e,t){var n=this,r=n.cy;if(!this.destroyed){if(e===`init`){n.load();return}if(e===`destroy`){n.destroy();return}(e===`add`||e===`remove`||e===`move`&&r.hasCompoundNodes()||e===`load`||e===`zorder`||e===`mount`)&&n.invalidateCachedZSortedEles(),e===`viewport`&&n.redrawHint(`select`,!0),e===`gc`&&n.redrawHint(`gc`,!0),(e===`load`||e===`resize`||e===`mount`)&&(n.invalidateContainerClientCoordsCache(),n.matchCanvasSize(n.container)),n.redrawHint(`eles`,!0),n.redrawHint(`drag`,!0),this.startRenderLoop(),this.redraw()}},yp.destroy=function(){var e=this;e.destroyed=!0,e.cy.stopAnimationLoop();for(var t=0;t<e.bindings.length;t++){var n=e.bindings[t],r=n.target;(r.off||r.removeEventListener).apply(r,n.args)}if(e.bindings=[],e.beforeRenderCallbacks=[],e.onUpdateEleCalcsFns=[],e.removeObserver&&e.removeObserver.disconnect(),e.styleObserver&&e.styleObserver.disconnect(),e.resizeObserver&&e.resizeObserver.disconnect(),e.labelCalcDiv)try{document.body.removeChild(e.labelCalcDiv)}catch{}},yp.isHeadless=function(){return!1},[bf,lp,up,mp,hp,gp].forEach(function(e){X(yp,e)});var bp=1e3/60,xp={setupDequeueing:function(e){return function(){var t=this,n=this.renderer;if(!t.dequeueingSetup){t.dequeueingSetup=!0;var r=Dt(function(){n.redrawHint(`eles`,!0),n.redrawHint(`drag`,!0),n.redraw()},e.deqRedrawThreshold),i=function(i,a){var o=Mt(),s=n.averageRedrawTime,c=n.lastRedrawTime,l=[],u=n.cy.extent(),d=n.getPixelRatio();for(i||n.flushRenderedStyleQueue();;){var f=Mt(),p=f-o,m=f-a;if(c<bp){var h=bp-(i?s:0);if(m>=e.deqFastCost*h)break}else if(i){if(p>=e.deqCost*c||p>=e.deqAvgCost*s)break}else if(m>=e.deqNoDrawCost*bp)break;var g=e.deq(t,d,u);if(g.length>0)for(var _=0;_<g.length;_++)l.push(g[_]);else break}l.length>0&&(e.onDeqd(t,l),!i&&e.shouldRedraw(t,l,d,u)&&r())},a=e.priority||nn;n.beforeRender(i,a(t))}}}},Sp=function(){function e(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:en;C(this,e),this.idsByKey=new yn,this.keyForId=new yn,this.cachesByLvl=new yn,this.lvls=[],this.getKey=t,this.doesEleInvalidateKey=n}return T(e,[{key:`getIdsFor`,value:function(e){e??rn(`Can not get id list for null key`);var t=this.idsByKey,n=this.idsByKey.get(e);return n||(n=new Sn,t.set(e,n)),n}},{key:`addIdForKey`,value:function(e,t){e!=null&&this.getIdsFor(e).add(t)}},{key:`deleteIdForKey`,value:function(e,t){e!=null&&this.getIdsFor(e).delete(t)}},{key:`getNumberOfIdsForKey`,value:function(e){return e==null?0:this.getIdsFor(e).size}},{key:`updateKeyMappingFor`,value:function(e){var t=e.id(),n=this.keyForId.get(t),r=this.getKey(e);this.deleteIdForKey(n,t),this.addIdForKey(r,t),this.keyForId.set(t,r)}},{key:`deleteKeyMappingFor`,value:function(e){var t=e.id(),n=this.keyForId.get(t);this.deleteIdForKey(n,t),this.keyForId.delete(t)}},{key:`keyHasChangedFor`,value:function(e){var t=e.id();return this.keyForId.get(t)!==this.getKey(e)}},{key:`isInvalid`,value:function(e){return this.keyHasChangedFor(e)||this.doesEleInvalidateKey(e)}},{key:`getCachesAt`,value:function(e){var t=this.cachesByLvl,n=this.lvls,r=t.get(e);return r||(r=new yn,t.set(e,r),n.push(e)),r}},{key:`getCache`,value:function(e,t){return this.getCachesAt(t).get(e)}},{key:`get`,value:function(e,t){var n=this.getKey(e),r=this.getCache(n,t);return r!=null&&this.updateKeyMappingFor(e),r}},{key:`getForCachedKey`,value:function(e,t){var n=this.keyForId.get(e.id());return this.getCache(n,t)}},{key:`hasCache`,value:function(e,t){return this.getCachesAt(t).has(e)}},{key:`has`,value:function(e,t){var n=this.getKey(e);return this.hasCache(n,t)}},{key:`setCache`,value:function(e,t,n){n.key=e,this.getCachesAt(t).set(e,n)}},{key:`set`,value:function(e,t,n){var r=this.getKey(e);this.setCache(r,t,n),this.updateKeyMappingFor(e)}},{key:`deleteCache`,value:function(e,t){this.getCachesAt(t).delete(e)}},{key:`delete`,value:function(e,t){var n=this.getKey(e);this.deleteCache(n,t)}},{key:`invalidateKey`,value:function(e){var t=this;this.lvls.forEach(function(n){return t.deleteCache(e,n)})}},{key:`invalidate`,value:function(e){var t=e.id(),n=this.keyForId.get(t);this.deleteKeyMappingFor(e);var r=this.doesEleInvalidateKey(e);return r&&this.invalidateKey(n),r||this.getNumberOfIdsForKey(n)===0}}])}(),Cp=25,wp=50,Tp=-4,Ep=3,Dp=7.99,Op=8,kp=1024,Ap=1024,jp=1024,Mp=.2,Np=.8,Pp=10,Fp=.15,Ip=.1,Lp=.9,Rp=.9,zp=100,Bp=1,Vp={dequeue:`dequeue`,downscale:`downscale`,highQuality:`highQuality`},Hp=pn({getKey:null,doesEleInvalidateKey:en,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:$t,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),Up=function(e,t){var n=this;n.renderer=e,n.onDequeues=[];var r=Hp(t);X(n,r),n.lookup=new Sp(r.getKey,r.doesEleInvalidateKey),n.setupDequeueing()},Wp=Up.prototype;Wp.reasons=Vp,Wp.getTextureQueue=function(e){var t=this;return t.eleImgCaches=t.eleImgCaches||{},t.eleImgCaches[e]=t.eleImgCaches[e]||[]},Wp.getRetiredTextureQueue=function(e){var t=this,n=t.eleImgCaches.retired=t.eleImgCaches.retired||{};return n[e]=n[e]||[]},Wp.getElementQueue=function(){var e=this;return e.eleCacheQueue=e.eleCacheQueue||new Nn(function(e,t){return t.reqs-e.reqs})},Wp.getElementKeyToQueue=function(){var e=this;return e.eleKeyToCacheQueue=e.eleKeyToCacheQueue||{}},Wp.getElement=function(e,t,n,r,i){var a=this,o=this.renderer,s=o.cy.zoom(),c=this.lookup;if(!t||t.w===0||t.h===0||isNaN(t.w)||isNaN(t.h)||!e.visible()||e.removed()||!a.allowEdgeTxrCaching&&e.isEdge()||!a.allowParentTxrCaching&&e.isParent())return null;if(r??=Math.ceil(ar(s*n)),r<Tp)r=Tp;else if(s>=Dp||r>Ep)return null;var l=2**r,u=t.h*l,d=t.w*l,f=o.eleTextBiggerThanMin(e,l);if(!this.isVisible(e,f))return null;var p=c.get(e,r);if(p&&p.invalidated&&(p.invalidated=!1,p.texture.invalidatedWidth-=p.width),p)return p;var m=u<=Cp?Cp:u<=wp?wp:Math.ceil(u/wp)*wp;if(u>jp||d>Ap)return null;var h=a.getTextureQueue(m),g=h[h.length-2],_=function(){return a.recycleTexture(m,d)||a.addTexture(m,d)};g||=h[h.length-1],g||=_(),g.width-g.usedWidth<d&&(g=_());for(var v=function(e){return e&&e.scaledLabelShown===f},y=i&&i===Vp.dequeue,b=i&&i===Vp.highQuality,x=i&&i===Vp.downscale,S,C=r+1;C<=Ep;C++){var w=c.get(e,C);if(w){S=w;break}}var T=S&&S.level===r+1?S:null,E=function(){g.context.drawImage(T.texture.canvas,T.x,0,T.width,T.height,g.usedWidth,0,d,u)};if(g.context.setTransform(1,0,0,1,0,0),g.context.clearRect(g.usedWidth,0,d,m),v(T))E();else if(v(S)){if(b){for(var D=S.level;D>r;D--)T=a.getElement(e,t,n,D,Vp.downscale);E()}else return a.queueElement(e,S.level-1),S}else{var O;if(!y&&!b&&!x)for(var k=r-1;k>=Tp;k--){var A=c.get(e,k);if(A){O=A;break}}if(v(O))return a.queueElement(e,r),O;g.context.translate(g.usedWidth,0),g.context.scale(l,l),this.drawElement(g.context,e,t,f,!1),g.context.scale(1/l,1/l),g.context.translate(-g.usedWidth,0)}return p={x:g.usedWidth,texture:g,level:r,scale:l,width:d,height:u,scaledLabelShown:f},g.usedWidth+=Math.ceil(d+Op),g.eleCaches.push(p),c.set(e,r,p),a.checkTextureFullness(g),p},Wp.invalidateElements=function(e){for(var t=0;t<e.length;t++)this.invalidateElement(e[t])},Wp.invalidateElement=function(e){var t=this,n=t.lookup,r=[];if(n.isInvalid(e)){for(var i=Tp;i<=Ep;i++){var a=n.getForCachedKey(e,i);a&&r.push(a)}if(n.invalidate(e))for(var o=0;o<r.length;o++){var s=r[o],c=s.texture;c.invalidatedWidth+=s.width,s.invalidated=!0,t.checkTextureUtility(c)}t.removeFromQueue(e)}},Wp.checkTextureUtility=function(e){e.invalidatedWidth>=Mp*e.width&&this.retireTexture(e)},Wp.checkTextureFullness=function(e){var t=this.getTextureQueue(e.height);e.usedWidth/e.width>Np&&e.fullnessChecks>=Pp?mn(t,e):e.fullnessChecks++},Wp.retireTexture=function(e){var t=this,n=e.height,r=t.getTextureQueue(n),i=this.lookup;mn(r,e),e.retired=!0;for(var a=e.eleCaches,o=0;o<a.length;o++){var s=a[o];i.deleteCache(s.key,s.level)}hn(a),t.getRetiredTextureQueue(n).push(e)},Wp.addTexture=function(e,t){var n=this,r=n.getTextureQueue(e),i={};return r.push(i),i.eleCaches=[],i.height=e,i.width=Math.max(kp,t),i.usedWidth=0,i.invalidatedWidth=0,i.fullnessChecks=0,i.canvas=n.renderer.makeOffscreenCanvas(i.width,i.height),i.context=i.canvas.getContext(`2d`),i},Wp.recycleTexture=function(e,t){for(var n=this,r=n.getTextureQueue(e),i=n.getRetiredTextureQueue(e),a=0;a<i.length;a++){var o=i[a];if(o.width>=t)return o.retired=!1,o.usedWidth=0,o.invalidatedWidth=0,o.fullnessChecks=0,hn(o.eleCaches),o.context.setTransform(1,0,0,1,0,0),o.context.clearRect(0,0,o.width,o.height),mn(i,o),r.push(o),o}},Wp.queueElement=function(e,t){var n=this,r=n.getElementQueue(),i=n.getElementKeyToQueue(),a=this.getKey(e),o=i[a];if(o)o.level=Math.max(o.level,t),o.eles.merge(e),o.reqs++,r.updateItem(o);else{var s={eles:e.spawn().merge(e),level:t,reqs:1,key:a};r.push(s),i[a]=s}},Wp.dequeue=function(e){for(var t=this,n=t.getElementQueue(),r=t.getElementKeyToQueue(),i=[],a=t.lookup,o=0;o<Bp&&n.size()>0;o++){var s=n.pop(),c=s.key,l=s.eles[0],u=a.hasCache(l,s.level);if(r[c]=null,!u){i.push(s);var d=t.getBoundingBox(l);t.getElement(l,d,e,s.level,Vp.dequeue)}}return i},Wp.removeFromQueue=function(e){var t=this,n=t.getElementQueue(),r=t.getElementKeyToQueue(),i=this.getKey(e),a=r[i];a!=null&&(a.eles.length===1?(a.reqs=Qt,n.updateItem(a),n.pop(),r[i]=null):a.eles.unmerge(e))},Wp.onDequeue=function(e){this.onDequeues.push(e)},Wp.offDequeue=function(e){mn(this.onDequeues,e)},Wp.setupDequeueing=xp.setupDequeueing({deqRedrawThreshold:zp,deqCost:Fp,deqAvgCost:Ip,deqNoDrawCost:Lp,deqFastCost:Rp,deq:function(e,t,n){return e.dequeue(t,n)},onDeqd:function(e,t){for(var n=0;n<e.onDequeues.length;n++){var r=e.onDequeues[n];r(t)}},shouldRedraw:function(e,t,n,r){for(var i=0;i<t.length;i++)for(var a=t[i].eles,o=0;o<a.length;o++)if(Sr(a[o].boundingBox(),r))return!0;return!1},priority:function(e){return e.renderer.beforeRenderPriorities.eleTxrDeq}});var Gp=1,Kp=-4,qp=2,Jp=3.99,Yp=50,Xp=50,Zp=.15,Qp=.1,$p=.9,em=.9,tm=1,nm=250,rm=16e6,im=32767,am=!0,om=function(e){var t=this,n=t.renderer=e,r=n.cy;t.layersByLevel={},t.firstGet=!0,t.lastInvalidationTime=Mt()-2*nm,t.skipping=!1,t.eleTxrDeqs=r.collection(),t.scheduleElementRefinement=Dt(function(){t.refineElementTextures(t.eleTxrDeqs),t.eleTxrDeqs.unmerge(t.eleTxrDeqs)},Xp),n.beforeRender(function(e,n){t.skipping=n-t.lastInvalidationTime<=nm},n.beforeRenderPriorities.lyrTxrSkip),t.layersQueue=new Nn(function(e,t){return t.reqs-e.reqs}),t.setupDequeueing()},sm=om.prototype,cm=0,lm=2**53-1;sm.makeLayer=function(e,t){var n=2**t,r=Math.ceil(e.w*n),i=Math.ceil(e.h*n),a=this.renderer.makeOffscreenCanvas(r,i),o={id:cm=++cm%lm,bb:e,level:t,width:r,height:i,canvas:a,context:a.getContext(`2d`),eles:[],elesQueue:[],reqs:0},s=o.context,c=-o.bb.x1,l=-o.bb.y1;return s.scale(n,n),s.translate(c,l),o},sm.getLayers=function(e,t,n){var r=this,i=r.renderer.cy.zoom(),a=r.firstGet;if(r.firstGet=!1,n==null){if(n=Math.ceil(ar(i*t)),n<Kp)n=Kp;else if(i>=Jp||n>qp)return null}r.validateLayersElesOrdering(n,e);var o=r.layersByLevel,s=2**n,c=o[n]=o[n]||[],l,u=r.levelIsComplete(n,e),d,f=function(){var t=function(t){if(r.validateLayersElesOrdering(t,e),r.levelIsComplete(t,e))return d=o[t],!0},i=function(e){if(!d)for(var r=n+e;Kp<=r&&r<=qp&&!t(r);r+=e);};i(1),i(-1);for(var a=c.length-1;a>=0;a--){var s=c[a];s.invalid&&mn(c,s)}};if(!u)f();else return c;var p=function(){if(!l){l=mr();for(var t=0;t<e.length;t++)_r(l,e[t].boundingBox())}return l},m=function(e){e||={};var t=e.after;p();var i=Math.ceil(l.w*s),a=Math.ceil(l.h*s);if(i>im||a>im||i*a>rm)return null;var o=r.makeLayer(l,n);if(t!=null){var u=c.indexOf(t)+1;c.splice(u,0,o)}else(e.insert===void 0||e.insert)&&c.unshift(o);return o};if(r.skipping&&!a)return null;for(var h=null,g=e.length/Gp,_=!a,v=0;v<e.length;v++){var y=e[v],b=y._private.rscratch,x=b.imgLayerCaches=b.imgLayerCaches||{},S=x[n];if(S){h=S;continue}if((!h||h.eles.length>=g||!Tr(h.bb,y.boundingBox()))&&(h=m({insert:!0,after:h}),!h))return null;d||_?r.queueLayer(h,y):r.drawEleInLayer(h,y,n,t),h.eles.push(y),x[n]=h}return d||(_?null:c)},sm.getEleLevelForLayerLevel=function(e,t){return e},sm.drawEleInLayer=function(e,t,n,r){var i=this,a=this.renderer,o=e.context,s=t.boundingBox();s.w===0||s.h===0||!t.visible()||(n=i.getEleLevelForLayerLevel(n,r),a.setImgSmoothing(o,!1),a.drawCachedElement(o,t,null,null,n,am),a.setImgSmoothing(o,!0))},sm.levelIsComplete=function(e,t){var n=this.layersByLevel[e];if(!n||n.length===0)return!1;for(var r=0,i=0;i<n.length;i++){var a=n[i];if(a.reqs>0||a.invalid)return!1;r+=a.eles.length}return r===t.length},sm.validateLayersElesOrdering=function(e,t){var n=this.layersByLevel[e];if(n)for(var r=0;r<n.length;r++){for(var i=n[r],a=-1,o=0;o<t.length;o++)if(i.eles[0]===t[o]){a=o;break}if(a<0){this.invalidateLayer(i);continue}for(var s=a,o=0;o<i.eles.length;o++)if(i.eles[o]!==t[s+o]){this.invalidateLayer(i);break}}},sm.updateElementsInLayers=function(e,t){for(var n=this,r=ie(e[0]),i=0;i<e.length;i++)for(var a=r?null:e[i],o=r?e[i]:e[i].ele,s=o._private.rscratch,c=s.imgLayerCaches=s.imgLayerCaches||{},l=Kp;l<=qp;l++){var u=c[l];u&&(a&&n.getEleLevelForLayerLevel(u.level)!==a.level||t(u,o,a))}},sm.haveLayers=function(){for(var e=this,t=!1,n=Kp;n<=qp;n++){var r=e.layersByLevel[n];if(r&&r.length>0){t=!0;break}}return t},sm.invalidateElements=function(e){var t=this;e.length!==0&&(t.lastInvalidationTime=Mt(),!(e.length===0||!t.haveLayers())&&t.updateElementsInLayers(e,function(e,n,r){t.invalidateLayer(e)}))},sm.invalidateLayer=function(e){if(this.lastInvalidationTime=Mt(),!e.invalid){var t=e.level,n=e.eles,r=this.layersByLevel[t];mn(r,e),e.elesQueue=[],e.invalid=!0,e.replacement&&(e.replacement.invalid=!0);for(var i=0;i<n.length;i++){var a=n[i]._private.rscratch.imgLayerCaches;a&&(a[t]=null)}}},sm.refineElementTextures=function(e){var t=this;t.updateElementsInLayers(e,function(e,n,r){var i=e.replacement;if(i||(i=e.replacement=t.makeLayer(e.bb,e.level),i.replaces=e,i.eles=e.eles),!i.reqs)for(var a=0;a<i.eles.length;a++)t.queueLayer(i,i.eles[a])})},sm.enqueueElementRefinement=function(e){this.eleTxrDeqs.merge(e),this.scheduleElementRefinement()},sm.queueLayer=function(e,t){var n=this.layersQueue,r=e.elesQueue,i=r.hasId=r.hasId||{};if(!e.replacement){if(t){if(i[t.id()])return;r.push(t),i[t.id()]=!0}e.reqs?(e.reqs++,n.updateItem(e)):(e.reqs=1,n.push(e))}},sm.dequeue=function(e){for(var t=this,n=t.layersQueue,r=[],i=0;i<tm&&n.size()!==0;){var a=n.peek();if(a.replacement){n.pop();continue}if(a.replaces&&a!==a.replaces.replacement){n.pop();continue}if(a.invalid){n.pop();continue}var o=a.elesQueue.shift();o&&(t.drawEleInLayer(a,o,a.level,e),i++),r.length===0&&r.push(!0),a.elesQueue.length===0&&(n.pop(),a.reqs=0,a.replaces&&t.applyLayerReplacement(a),t.requestRedraw())}return r},sm.applyLayerReplacement=function(e){var t=this,n=t.layersByLevel[e.level],r=e.replaces,i=n.indexOf(r);if(!(i<0||r.invalid)){n[i]=e;for(var a=0;a<e.eles.length;a++){var o=e.eles[a]._private,s=o.imgLayerCaches=o.imgLayerCaches||{};s&&(s[e.level]=e)}t.requestRedraw()}},sm.requestRedraw=Dt(function(){var e=this.renderer;e.redrawHint(`eles`,!0),e.redrawHint(`drag`,!0),e.redraw()},100),sm.setupDequeueing=xp.setupDequeueing({deqRedrawThreshold:Yp,deqCost:Zp,deqAvgCost:Qp,deqNoDrawCost:$p,deqFastCost:em,deq:function(e,t){return e.dequeue(t)},onDeqd:nn,shouldRedraw:$t,priority:function(e){return e.renderer.beforeRenderPriorities.lyrTxrDeq}});var um={},dm;function fm(e,t){for(var n=0;n<t.length;n++){var r=t[n];e.lineTo(r.x,r.y)}}function pm(e,t,n){for(var r,i=0;i<t.length;i++){var a=t[i];i===0&&(r=a),e.lineTo(a.x,a.y)}e.quadraticCurveTo(n.x,n.y,r.x,r.y)}function mm(e,t,n){e.beginPath&&e.beginPath();for(var r=t,i=0;i<r.length;i++){var a=r[i];e.lineTo(a.x,a.y)}var o=n,s=n[0];e.moveTo(s.x,s.y);for(var i=1;i<o.length;i++){var a=o[i];e.lineTo(a.x,a.y)}e.closePath&&e.closePath()}function hm(e,t,n,r,i){e.beginPath&&e.beginPath(),e.arc(n,r,i,0,Math.PI*2,!1);var a=t,o=a[0];e.moveTo(o.x,o.y);for(var s=0;s<a.length;s++){var c=a[s];e.lineTo(c.x,c.y)}e.closePath&&e.closePath()}function gm(e,t,n,r){e.arc(t,n,r,0,Math.PI*2,!1)}um.arrowShapeImpl=function(e){return(dm||={polygon:fm,"triangle-backcurve":pm,"triangle-tee":mm,"circle-triangle":hm,"triangle-cross":mm,circle:gm})[e]};var _m={};_m.drawElement=function(e,t,n,r,i,a){var o=this;t.isNode()?o.drawNode(e,t,n,r,i,a):o.drawEdge(e,t,n,r,i,a)},_m.drawElementOverlay=function(e,t){var n=this;t.isNode()?n.drawNodeOverlay(e,t):n.drawEdgeOverlay(e,t)},_m.drawElementUnderlay=function(e,t){var n=this;t.isNode()?n.drawNodeUnderlay(e,t):n.drawEdgeUnderlay(e,t)},_m.drawCachedElementPortion=function(e,t,n,r,i,a,o,s){var c=this,l=n.getBoundingBox(t);if(l.w!==0&&l.h!==0){var u=n.getElement(t,l,r,i,a);if(u!=null){var d=s(c,t);if(d===0)return;var f=o(c,t),p=l.x1,m=l.y1,h=l.w,g=l.h,_,v,y,b,x;if(f!==0){var S=n.getRotationPoint(t);y=S.x,b=S.y,e.translate(y,b),e.rotate(f),x=c.getImgSmoothing(e),x||c.setImgSmoothing(e,!0);var C=n.getRotationOffset(t);_=C.x,v=C.y}else _=p,v=m;var w;d!==1&&(w=e.globalAlpha,e.globalAlpha=w*d),e.drawImage(u.texture.canvas,u.x,0,u.width,u.height,_,v,h,g),d!==1&&(e.globalAlpha=w),f!==0&&(e.rotate(-f),e.translate(-y,-b),x||c.setImgSmoothing(e,!1))}else n.drawElement(e,t)}};var vm=function(){return 0},ym=function(e,t){return e.getTextAngle(t,null)},bm=function(e,t){return e.getTextAngle(t,`source`)},xm=function(e,t){return e.getTextAngle(t,`target`)},Sm=function(e,t){return t.effectiveOpacity()},Cm=function(e,t){return t.pstyle(`text-opacity`).pfValue*t.effectiveOpacity()};_m.drawCachedElement=function(e,t,n,r,i,a){var o=this,s=o.data,c=s.eleTxrCache,l=s.lblTxrCache,u=s.slbTxrCache,d=s.tlbTxrCache,f=t.boundingBox(),p=a===!0?c.reasons.highQuality:null;if(!(f.w===0||f.h===0||!t.visible())&&(!r||Sr(f,r))){var m=t.isEdge(),h=t.element()._private.rscratch.badLine;o.drawElementUnderlay(e,t),o.drawCachedElementPortion(e,t,c,n,i,p,vm,Sm),(!m||!h)&&o.drawCachedElementPortion(e,t,l,n,i,p,ym,Cm),m&&!h&&(o.drawCachedElementPortion(e,t,u,n,i,p,bm,Cm),o.drawCachedElementPortion(e,t,d,n,i,p,xm,Cm)),o.drawElementOverlay(e,t)}},_m.drawElements=function(e,t){for(var n=this,r=0;r<t.length;r++){var i=t[r];n.drawElement(e,i)}},_m.drawCachedElements=function(e,t,n,r){for(var i=this,a=0;a<t.length;a++){var o=t[a];i.drawCachedElement(e,o,n,r)}},_m.drawCachedNodes=function(e,t,n,r){for(var i=this,a=0;a<t.length;a++){var o=t[a];o.isNode()&&i.drawCachedElement(e,o,n,r)}},_m.drawLayeredElements=function(e,t,n,r){var i=this,a=i.data.lyrTxrCache.getLayers(t,n);if(a)for(var o=0;o<a.length;o++){var s=a[o],c=s.bb;c.w!==0&&c.h!==0&&e.drawImage(s.canvas,c.x1,c.y1,c.w,c.h)}else i.drawCachedElements(e,t,n,r)};var wm={};wm.drawEdge=function(e,t,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,o=this,s=t._private.rscratch;if(!(a&&!t.visible())&&!(s.badLine||s.allpts==null||isNaN(s.allpts[0]))){var c;n&&(c=n,e.translate(-c.x1,-c.y1));var l=a?t.pstyle(`opacity`).value:1,u=a?t.pstyle(`line-opacity`).value:1,d=t.pstyle(`curve-style`).value,f=t.pstyle(`line-style`).value,p=t.pstyle(`width`).pfValue,m=t.pstyle(`line-cap`).value,h=t.pstyle(`line-outline-width`).value,g=t.pstyle(`line-outline-color`).value,_=l*u,v=l*u,y=function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:_;d===`straight-triangle`?(o.eleStrokeStyle(e,t,n),o.drawEdgeTrianglePath(t,e,s.allpts)):(e.lineWidth=p,e.lineCap=m,o.eleStrokeStyle(e,t,n),o.drawEdgePath(t,e,s.allpts,f),e.lineCap=`butt`)},b=function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:_;if(e.lineWidth=p+h,e.lineCap=m,h>0)o.colorStrokeStyle(e,g[0],g[1],g[2],n);else{e.lineCap=`butt`;return}d===`straight-triangle`?o.drawEdgeTrianglePath(t,e,s.allpts):(o.drawEdgePath(t,e,s.allpts,f),e.lineCap=`butt`)},x=function(){i&&o.drawEdgeOverlay(e,t)},S=function(){i&&o.drawEdgeUnderlay(e,t)},C=function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:v;o.drawArrowheads(e,t,n)},w=function(){o.drawElementText(e,t,null,r)};if(e.lineJoin=`round`,t.pstyle(`ghost`).value===`yes`){var T=t.pstyle(`ghost-offset-x`).pfValue,E=t.pstyle(`ghost-offset-y`).pfValue,D=_*t.pstyle(`ghost-opacity`).value;e.translate(T,E),y(D),C(D),e.translate(-T,-E)}else b();S(),y(),C(),x(),w(),n&&e.translate(c.x1,c.y1)}};var Tm=function(e){if(![`overlay`,`underlay`].includes(e))throw Error(`Invalid state`);return function(t,n){if(n.visible()){var r=n.pstyle(`${e}-opacity`).value;if(r!==0){var i=this,a=i.usePaths(),o=n._private.rscratch,s=2*n.pstyle(`${e}-padding`).pfValue,c=n.pstyle(`${e}-color`).value;t.lineWidth=s,t.lineCap=o.edgeType===`self`&&!a?`butt`:`round`,i.colorStrokeStyle(t,c[0],c[1],c[2],r),i.drawEdgePath(n,t,o.allpts,`solid`)}}}};wm.drawEdgeOverlay=Tm(`overlay`),wm.drawEdgeUnderlay=Tm(`underlay`),wm.drawEdgePath=function(e,t,n,r){var i=e._private.rscratch,a=t,o,s=!1,c=this.usePaths(),l=e.pstyle(`line-dash-pattern`).pfValue,u=e.pstyle(`line-dash-offset`).pfValue;if(c){var d=n.join(`$`);i.pathCacheKey&&i.pathCacheKey===d?(o=t=i.pathCache,s=!0):(o=t=new Path2D,i.pathCacheKey=d,i.pathCache=o)}if(a.setLineDash)switch(r){case`dotted`:a.setLineDash([1,1]);break;case`dashed`:a.setLineDash(l),a.lineDashOffset=u;break;case`solid`:a.setLineDash([])}if(!s&&!i.badLine)switch(t.beginPath&&t.beginPath(),t.moveTo(n[0],n[1]),i.edgeType){case`bezier`:case`self`:case`compound`:case`multibezier`:for(var f=2;f+3<n.length;f+=4)t.quadraticCurveTo(n[f],n[f+1],n[f+2],n[f+3]);break;case`straight`:case`haystack`:for(var p=2;p+1<n.length;p+=2)t.lineTo(n[p],n[p+1]);break;case`segments`:if(i.isRound){var m=E(i.roundCorners),h;try{for(m.s();!(h=m.n()).done;){var g=h.value;Gf(t,g)}}catch(e){m.e(e)}finally{m.f()}t.lineTo(n[n.length-2],n[n.length-1])}else for(var _=2;_+1<n.length;_+=2)t.lineTo(n[_],n[_+1])}t=a,c?t.stroke(o):t.stroke(),t.setLineDash&&t.setLineDash([])},wm.drawEdgeTrianglePath=function(e,t,n){t.fillStyle=t.strokeStyle;for(var r=e.pstyle(`width`).pfValue,i=0;i+1<n.length;i+=2){var a=[n[i+2]-n[i],n[i+3]-n[i+1]],o=Math.sqrt(a[0]*a[0]+a[1]*a[1]),s=[a[1]/o,-a[0]/o],c=[s[0]*r/2,s[1]*r/2];t.beginPath(),t.moveTo(n[i]-c[0],n[i+1]-c[1]),t.lineTo(n[i]+c[0],n[i+1]+c[1]),t.lineTo(n[i+2],n[i+3]),t.closePath(),t.fill()}},wm.drawArrowheads=function(e,t,n){var r=t._private.rscratch,i=r.edgeType===`haystack`;i||this.drawArrowhead(e,t,`source`,r.arrowStartX,r.arrowStartY,r.srcArrowAngle,n),this.drawArrowhead(e,t,`mid-target`,r.midX,r.midY,r.midtgtArrowAngle,n),this.drawArrowhead(e,t,`mid-source`,r.midX,r.midY,r.midsrcArrowAngle,n),i||this.drawArrowhead(e,t,`target`,r.arrowEndX,r.arrowEndY,r.tgtArrowAngle,n)},wm.drawArrowhead=function(e,t,n,r,i,a,o){if(!(isNaN(r)||r==null||isNaN(i)||i==null||isNaN(a)||a==null)){var s=this,c=t.pstyle(n+`-arrow-shape`).value;if(c!==`none`){var l=t.pstyle(n+`-arrow-fill`).value===`hollow`?`both`:`filled`,u=t.pstyle(n+`-arrow-fill`).value,d=t.pstyle(`width`).pfValue,f=t.pstyle(n+`-arrow-width`),p=f.value===`match-line`?d:f.pfValue;f.units===`%`&&(p*=d);var m=t.pstyle(`opacity`).value;o===void 0&&(o=m);var h=e.globalCompositeOperation;(o!==1||u===`hollow`)&&(e.globalCompositeOperation=`destination-out`,s.colorFillStyle(e,255,255,255,1),s.colorStrokeStyle(e,255,255,255,1),s.drawArrowShape(t,e,l,d,c,p,r,i,a),e.globalCompositeOperation=h);var g=t.pstyle(n+`-arrow-color`).value;s.colorFillStyle(e,g[0],g[1],g[2],o),s.colorStrokeStyle(e,g[0],g[1],g[2],o),s.drawArrowShape(t,e,u,d,c,p,r,i,a)}}},wm.drawArrowShape=function(e,t,n,r,i,a,o,s,c){var l=this,u=this.usePaths()&&i!==`triangle-cross`,d=!1,f,p=t,m={x:o,y:s},h=e.pstyle(`arrow-scale`).value,g=this.getArrowWidth(r,h),_=l.arrowShapes[i];if(u){var v=l.arrowPathCache=l.arrowPathCache||[],y=Ut(i),b=v[y];b==null?(f=t=new Path2D,v[y]=f):(f=t=b,d=!0)}d||(t.beginPath&&t.beginPath(),u?_.draw(t,1,0,{x:0,y:0},1):_.draw(t,g,c,m,r),t.closePath&&t.closePath()),t=p,u&&(t.translate(o,s),t.rotate(c),t.scale(g,g)),(n===`filled`||n===`both`)&&(u?t.fill(f):t.fill()),(n===`hollow`||n===`both`)&&(t.lineWidth=a/(u?g:1),t.lineJoin=`miter`,u?t.stroke(f):t.stroke()),u&&(t.scale(1/g,1/g),t.rotate(-c),t.translate(-o,-s))};var Em={};Em.safeDrawImage=function(e,t,n,r,i,a,o,s,c,l){if(!(i<=0||a<=0||c<=0||l<=0))try{e.drawImage(t,n,r,i,a,o,s,c,l)}catch(e){on(e)}},Em.drawInscribedImage=function(e,t,n,r,i){var a=this,o=n.position(),s=o.x,c=o.y,l=n.cy().style(),u=l.getIndexedStyle.bind(l),d=u(n,`background-fit`,`value`,r),f=u(n,`background-repeat`,`value`,r),p=n.width(),m=n.height(),h=n.padding()*2,g=p+(u(n,`background-width-relative-to`,`value`,r)===`inner`?0:h),_=m+(u(n,`background-height-relative-to`,`value`,r)===`inner`?0:h),v=n._private.rscratch,y=u(n,`background-clip`,`value`,r)===`node`,b=u(n,`background-image-opacity`,`value`,r)*i,x=u(n,`background-image-smoothing`,`value`,r),S=n.pstyle(`corner-radius`).value;S!==`auto`&&(S=n.pstyle(`corner-radius`).pfValue);var C=t.width||t.cachedW,w=t.height||t.cachedH;(C==null||w==null)&&(document.body.appendChild(t),C=t.cachedW=t.width||t.offsetWidth,w=t.cachedH=t.height||t.offsetHeight,document.body.removeChild(t));var T=C,E=w;if(u(n,`background-width`,`value`,r)!==`auto`&&(T=u(n,`background-width`,`units`,r)===`%`?u(n,`background-width`,`pfValue`,r)*g:u(n,`background-width`,`pfValue`,r)),u(n,`background-height`,`value`,r)!==`auto`&&(E=u(n,`background-height`,`units`,r)===`%`?u(n,`background-height`,`pfValue`,r)*_:u(n,`background-height`,`pfValue`,r)),T!==0&&E!==0){if(d===`contain`){var D=Math.min(g/T,_/E);T*=D,E*=D}else if(d===`cover`){var D=Math.max(g/T,_/E);T*=D,E*=D}var O=s-g/2,k=u(n,`background-position-x`,`units`,r),A=u(n,`background-position-x`,`pfValue`,r);O+=k===`%`?(g-T)*A:A;var j=u(n,`background-offset-x`,`units`,r),M=u(n,`background-offset-x`,`pfValue`,r);O+=j===`%`?(g-T)*M:M;var N=c-_/2,P=u(n,`background-position-y`,`units`,r),F=u(n,`background-position-y`,`pfValue`,r);N+=P===`%`?(_-E)*F:F;var I=u(n,`background-offset-y`,`units`,r),L=u(n,`background-offset-y`,`pfValue`,r);N+=I===`%`?(_-E)*L:L,v.pathCache&&(O-=s,N-=c,s=0,c=0);var R=e.globalAlpha;e.globalAlpha=b;var ee=a.getImgSmoothing(e),z=!1;x===`no`&&ee?(a.setImgSmoothing(e,!1),z=!0):x===`yes`&&!ee&&(a.setImgSmoothing(e,!0),z=!0),f===`no-repeat`?(y&&(e.save(),v.pathCache?e.clip(v.pathCache):(a.nodeShapes[a.getNodeShape(n)].draw(e,s,c,g,_,S,v),e.clip())),a.safeDrawImage(e,t,0,0,C,w,O,N,T,E),y&&e.restore()):(e.fillStyle=e.createPattern(t,f),a.nodeShapes[a.getNodeShape(n)].draw(e,s,c,g,_,S,v),e.translate(O,N),e.fill(),e.translate(-O,-N)),e.globalAlpha=R,z&&a.setImgSmoothing(e,ee)}};var Dm={};Dm.eleTextBiggerThanMin=function(e,t){if(!t){var n=e.cy().zoom(),r=this.getPixelRatio();t=2**Math.ceil(ar(n*r))}return!(e.pstyle(`font-size`).pfValue*t<e.pstyle(`min-zoomed-font-size`).pfValue)},Dm.drawElementText=function(e,t,n,r,i){var a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,o=this;if(r==null){if(a&&!o.eleTextBiggerThanMin(t))return}else if(r===!1)return;if(t.isNode()){var s=t.pstyle(`label`);if(!s||!s.value)return;var c=o.getLabelJustification(t),l=t.pstyle(`text-metrics`).strValue===`glyph`;e.textAlign=c,e.textBaseline=l?`alphabetic`:`bottom`}else{var u=t.element()._private.rscratch.badLine,d=t.pstyle(`label`),f=t.pstyle(`source-label`),p=t.pstyle(`target-label`);if(u||(!d||!d.value)&&(!f||!f.value)&&(!p||!p.value))return;e.textAlign=`center`,e.textBaseline=`bottom`}var m=!n,h;n&&(h=n,e.translate(-h.x1,-h.y1)),i==null?(o.drawText(e,t,null,m,a),t.isEdge()&&(o.drawText(e,t,`source`,m,a),o.drawText(e,t,`target`,m,a))):o.drawText(e,t,i,m,a),n&&e.translate(h.x1,h.y1)},Dm.getFontCache=function(e){var t;this.fontCaches=this.fontCaches||[];for(var n=0;n<this.fontCaches.length;n++)if(t=this.fontCaches[n],t.context===e)return t;return t={context:e},this.fontCaches.push(t),t},Dm.setupTextStyle=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,r=t.pstyle(`font-style`).strValue,i=t.pstyle(`font-size`).pfValue+`px`,a=t.pstyle(`font-family`).strValue,o=t.pstyle(`font-weight`).strValue,s=n?t.effectiveOpacity()*t.pstyle(`text-opacity`).value:1,c=t.pstyle(`text-outline-opacity`).value*s,l=t.pstyle(`color`).value,u=t.pstyle(`text-outline-color`).value;e.font=r+` `+o+` `+i+` `+a,e.lineJoin=`round`,this.colorFillStyle(e,l[0],l[1],l[2],s),this.colorStrokeStyle(e,u[0],u[1],u[2],c)};function Om(e,t,n,r,i){var a=Math.min(r,i)/2,o=t+r/2,s=n+i/2;e.beginPath(),e.arc(o,s,a,0,Math.PI*2),e.closePath()}function km(e,t,n,r,i){var a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:5,o=Math.min(a,r/2,i/2);e.beginPath(),e.moveTo(t+o,n),e.lineTo(t+r-o,n),e.quadraticCurveTo(t+r,n,t+r,n+o),e.lineTo(t+r,n+i-o),e.quadraticCurveTo(t+r,n+i,t+r-o,n+i),e.lineTo(t+o,n+i),e.quadraticCurveTo(t,n+i,t,n+i-o),e.lineTo(t,n+o),e.quadraticCurveTo(t,n,t+o,n),e.closePath()}Dm.getTextAngle=function(e,t){var n,r=e._private.rscratch,i=t?t+`-`:``,a=e.pstyle(i+`text-rotation`);if(a.strValue===`autorotate`){var o=_n(r,`labelAngle`,t);n=e.isEdge()?o:0}else n=a.strValue===`none`?0:a.pfValue;return n},Dm.drawText=function(e,t,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,a=t._private.rscratch,o=i?t.effectiveOpacity():1;if(!(i&&(o===0||t.pstyle(`text-opacity`).value===0))){n===`main`&&(n=null);var s=_n(a,`labelX`,n),c=_n(a,`labelY`,n),l,u,d=this.getLabelText(t,n);if(d!=null&&d!==``&&!isNaN(s)&&!isNaN(c)){this.setupTextStyle(e,t,i);var f=n?n+`-`:``,p=_n(a,`labelWidth`,n),m=_n(a,`labelHeight`,n),h=_n(a,`labelActualDescent`,n),g=t.pstyle(f+`text-margin-x`).pfValue,_=t.pstyle(f+`text-margin-y`).pfValue,v=t.isEdge(),y=t.pstyle(`text-halign`).value,b=t.pstyle(`text-valign`).value;v&&(y=`center`,b=`center`),s+=g,c+=_;var x=r?this.getTextAngle(t,n):0;x!==0&&(l=s,u=c,e.translate(l,u),e.rotate(x),s=0,c=0);var S=wl(y),C=Tl(b);switch(C){case`top`:break;case`center`:c+=m/2;break;case`bottom`:c+=m}var w=t.pstyle(`text-background-opacity`).value,T=t.pstyle(`text-border-opacity`).value,E=t.pstyle(`text-border-width`).pfValue,D=t.pstyle(`text-background-padding`).pfValue,O=t.pstyle(`text-background-shape`).strValue,k=O===`round-rectangle`||O===`roundrectangle`,A=O===`circle`,j=2;if(w>0||E>0&&T>0){var M=e.fillStyle,N=e.strokeStyle,P=e.lineWidth,F=t.pstyle(`text-background-color`).value,I=t.pstyle(`text-border-color`).value,L=t.pstyle(`text-border-style`).value,R=w>0,ee=E>0&&T>0,z=s-D;switch(S){case`left`:z-=p;break;case`center`:z-=p/2}var B=c-m-D,V=p+2*D,H=m+2*D;if(R&&(e.fillStyle=`rgba(${F[0]},${F[1]},${F[2]},${w*o})`),ee&&(e.strokeStyle=`rgba(${I[0]},${I[1]},${I[2]},${T*o})`,e.lineWidth=E,e.setLineDash))switch(L){case`dotted`:e.setLineDash([1,1]);break;case`dashed`:e.setLineDash([4,2]);break;case`double`:e.lineWidth=E/4,e.setLineDash([]);break;default:e.setLineDash([])}if(k?(e.beginPath(),km(e,z,B,V,H,j)):A?(e.beginPath(),Om(e,z,B,V,H)):(e.beginPath(),e.rect(z,B,V,H)),R&&e.fill(),ee&&e.stroke(),ee&&L===`double`){var U=E/2;e.beginPath(),k?km(e,z+U,B+U,V-2*U,H-2*U,j):e.rect(z+U,B+U,V-2*U,H-2*U),e.stroke()}e.fillStyle=M,e.strokeStyle=N,e.lineWidth=P,e.setLineDash&&e.setLineDash([])}var W=2*t.pstyle(`text-outline-width`).pfValue;if(W>0&&(e.lineWidth=W),c-=h,t.pstyle(`text-wrap`).value===`wrap`){var G=_n(a,`labelWrapCachedLines`,n),K=_n(a,`labelLineHeight`,n),q=p/2,J=this.getLabelJustification(t);switch(J===`auto`||(S===`left`?J===`left`?s+=-p:J===`center`&&(s+=-q):S===`center`?J===`left`?s+=-q:J===`right`&&(s+=q):S===`right`&&(J===`center`?s+=q:J===`right`&&(s+=p))),C){case`top`:c-=(G.length-1)*K;break;case`center`:case`bottom`:c-=(G.length-1)*K}for(var Y=0;Y<G.length;Y++)W>0&&e.strokeText(G[Y],s,c),e.fillText(G[Y],s,c),c+=K}else W>0&&e.strokeText(d,s,c),e.fillText(d,s,c);x!==0&&(e.rotate(-x),e.translate(-l,-u))}}};var Am={};Am.drawNode=function(e,t,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,o=this,s,c,l=t._private,u=l.rscratch,d=t.position();if(!(!Y(d.x)||!Y(d.y))&&!(a&&!t.visible())){var f=a?t.effectiveOpacity():1,p=o.usePaths(),m,h=!1,g=t.padding();s=t.width()+2*g,c=t.height()+2*g;var _;n&&(_=n,e.translate(-_.x1,-_.y1));for(var v=t.pstyle(`background-image`).value,y=Array(v.length),b=Array(v.length),x=0,S=0;S<v.length;S++){var C=v[S];if(y[S]=C!=null&&C!==`none`){var w=t.cy().style().getIndexedStyle(t,`background-image-crossorigin`,`value`,S);x++,b[S]=o.getCachedImage(C,w,function(){l.backgroundTimestamp=Date.now(),t.emitAndNotify(`background`)})}}var T=t.pstyle(`background-blacken`).value,E=t.pstyle(`border-width`).pfValue,D=t.pstyle(`background-opacity`).value*f,O=t.pstyle(`border-color`).value,k=t.pstyle(`border-style`).value,A=t.pstyle(`border-join`).value,j=t.pstyle(`border-cap`).value,M=t.pstyle(`border-position`).value,N=t.pstyle(`border-dash-pattern`).pfValue,P=t.pstyle(`border-dash-offset`).pfValue,F=t.pstyle(`border-opacity`).value*f,I=t.pstyle(`outline-width`).pfValue,L=t.pstyle(`outline-color`).value,R=t.pstyle(`outline-style`).value,ee=t.pstyle(`outline-opacity`).value*f,z=t.pstyle(`outline-offset`).value,B=t.pstyle(`corner-radius`).value;B!==`auto`&&(B=t.pstyle(`corner-radius`).pfValue);var V=function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:D;o.eleFillStyle(e,t,n)},H=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:F;o.colorStrokeStyle(e,O[0],O[1],O[2],t)},U=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:ee;o.colorStrokeStyle(e,L[0],L[1],L[2],t)},W=function(e,t,n,r){var i=o.nodePathCache=o.nodePathCache||[],a=Wt(n===`polygon`?n+`,`+r.join(`,`):n,``+t,``+e,``+B),s=i[a],c,l=!1;return s==null?(c=new Path2D,i[a]=u.pathCache=c):(c=s,l=!0,u.pathCache=c),{path:c,cacheHit:l}},G=t.pstyle(`shape`).strValue,K=t.pstyle(`shape-polygon-points`).pfValue;if(p){e.translate(d.x,d.y);var q=W(s,c,G,K);m=q.path,h=q.cacheHit}var J=function(){if(!h){var n=d;p&&(n={x:0,y:0}),o.nodeShapes[o.getNodeShape(t)].draw(m||e,n.x,n.y,s,c,B,u)}p?e.fill(m):e.fill()},te=function(){for(var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:f,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,i=l.backgrounding,a=0,s=0;s<b.length;s++){var c=t.cy().style().getIndexedStyle(t,`background-image-containment`,`value`,s);if(r&&c===`over`||!r&&c===`inside`){a++;continue}y[s]&&b[s].complete&&!b[s].error&&(a++,o.drawInscribedImage(e,b[s],t,s,n))}l.backgrounding=a!==x,i!==l.backgrounding&&t.updateStyle(!1)},ne=function(){var n=arguments.length>0&&arguments[0]!==void 0&&arguments[0],r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:f;o.hasPie(t)&&(o.drawPie(e,t,r),n&&(p||o.nodeShapes[o.getNodeShape(t)].draw(e,d.x,d.y,s,c,B,u)))},re=function(){var n=arguments.length>0&&arguments[0]!==void 0&&arguments[0],r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:f;o.hasStripe(t)&&(e.save(),p?e.clip(u.pathCache):(o.nodeShapes[o.getNodeShape(t)].draw(e,d.x,d.y,s,c,B,u),e.clip()),o.drawStripe(e,t,r),e.restore(),n&&(p||o.nodeShapes[o.getNodeShape(t)].draw(e,d.x,d.y,s,c,B,u)))},ie=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:f,n=(T>0?T:-T)*t,r=T>0?0:255;T!==0&&(o.colorFillStyle(e,r,r,r,n),p?e.fill(m):e.fill())},ae=function(){if(E>0){if(e.lineWidth=E,e.lineCap=j,e.lineJoin=A,e.setLineDash)switch(k){case`dotted`:e.setLineDash([1,1]);break;case`dashed`:e.setLineDash(N),e.lineDashOffset=P;break;case`solid`:case`double`:e.setLineDash([])}if(M!==`center`){if(e.save(),e.lineWidth*=2,M===`inside`)p?e.clip(m):e.clip();else{var t=new Path2D;t.rect(-s/2-E,-c/2-E,s+2*E,c+2*E),t.addPath(m),e.clip(t,`evenodd`)}p?e.stroke(m):e.stroke(),e.restore()}else p?e.stroke(m):e.stroke();if(k===`double`){e.lineWidth=E/3;var n=e.globalCompositeOperation;e.globalCompositeOperation=`destination-out`,p?e.stroke(m):e.stroke(),e.globalCompositeOperation=n}e.setLineDash&&e.setLineDash([])}},oe=function(){if(I>0){if(e.lineWidth=I,e.lineCap=`butt`,e.setLineDash)switch(R){case`dotted`:e.setLineDash([1,1]);break;case`dashed`:e.setLineDash([4,2]);break;case`solid`:case`double`:e.setLineDash([])}var n=d;p&&(n={x:0,y:0});var r=o.getNodeShape(t),i=E;M===`inside`&&(i=0),M===`outside`&&(i*=2);var a=(s+i+(I+z))/s,l=(c+i+(I+z))/c,u=s*a,f=c*l,m=o.nodeShapes[r].points,h;if(p&&(h=W(u,f,r,m).path),r===`ellipse`)o.drawEllipsePath(h||e,n.x,n.y,u,f);else if([`round-diamond`,`round-heptagon`,`round-hexagon`,`round-octagon`,`round-pentagon`,`round-polygon`,`round-triangle`,`round-tag`].includes(r)){var g=0,_=0,v=0;r===`round-diamond`?g=(i+z+I)*1.4:r===`round-heptagon`?(g=(i+z+I)*1.075,v=-(i/2+z+I)/35):r===`round-hexagon`?g=(i+z+I)*1.12:r===`round-pentagon`?(g=(i+z+I)*1.13,v=-(i/2+z+I)/15):r===`round-tag`?(g=(i+z+I)*1.12,_=(i/2+I+z)*.07):r===`round-triangle`&&(g=(i+z+I)*(Math.PI/2),v=-(i+z/2+I)/Math.PI),g!==0&&(a=(s+g)/s,u=s*a,[`round-hexagon`,`round-tag`].includes(r)||(l=(c+g)/c,f=c*l)),B=B===`auto`?ei(u,f):B;for(var y=u/2,b=f/2,x=B+(i+I+z)/2,S=Array(m.length/2),C=Array(m.length/2),w=0;w<m.length/2;w++)S[w]={x:n.x+_+y*m[w*2],y:n.y+v+b*m[w*2+1]};var T,D,O,k,A=S.length;for(D=S[A-1],T=0;T<A;T++)O=S[T%A],k=S[(T+1)%A],C[T]=Kf(D,O,k,x),D=O,O=k;o.drawRoundPolygonPath(h||e,n.x+_,n.y+v,s*a,c*l,m,C)}else if([`roundrectangle`,`round-rectangle`].includes(r))B=B===`auto`?$r(u,f):B,o.drawRoundRectanglePath(h||e,n.x,n.y,u,f,B+(i+I+z)/2);else if([`cutrectangle`,`cut-rectangle`].includes(r))B=B===`auto`?ti():B,o.drawCutRectanglePath(h||e,n.x,n.y,u,f,null,B+(i+I+z)/4);else if([`bottomroundrectangle`,`bottom-round-rectangle`].includes(r))B=B===`auto`?$r(u,f):B,o.drawBottomRoundRectanglePath(h||e,n.x,n.y,u,f,B+(i+I+z)/2);else if(r===`barrel`)o.drawBarrelPath(h||e,n.x,n.y,u,f);else if(r.startsWith(`polygon`)||[`rhomboid`,`right-rhomboid`,`round-tag`,`tag`,`vee`].includes(r)){var j=(i+I+z)/s;m=zr(Br(m,j)),o.drawPolygonPath(h||e,n.x,n.y,s,c,m)}else{var N=(i+I+z)/s;m=zr(Br(m,-N)),o.drawPolygonPath(h||e,n.x,n.y,s,c,m)}if(p?e.stroke(h):e.stroke(),R===`double`){e.lineWidth=i/3;var P=e.globalCompositeOperation;e.globalCompositeOperation=`destination-out`,p?e.stroke(h):e.stroke(),e.globalCompositeOperation=P}e.setLineDash&&e.setLineDash([])}},se=function(){i&&o.drawNodeOverlay(e,t,d,s,c)},ce=function(){i&&o.drawNodeUnderlay(e,t,d,s,c)},le=function(){o.drawElementText(e,t,null,r)};if(t.pstyle(`ghost`).value===`yes`){var ue=t.pstyle(`ghost-offset-x`).pfValue,de=t.pstyle(`ghost-offset-y`).pfValue,fe=t.pstyle(`ghost-opacity`).value,pe=fe*f;e.translate(ue,de),U(),oe(),V(fe*D),J(),te(pe,!0),H(fe*F),ae(),ne(T!==0||E!==0),re(T!==0||E!==0),te(pe,!1),ie(pe),e.translate(-ue,-de)}p&&e.translate(-d.x,-d.y),ce(),p&&e.translate(d.x,d.y),U(),oe(),V(),J(),te(f,!0),H(),ae(),ne(T!==0||E!==0),re(T!==0||E!==0),te(f,!1),ie(),p&&e.translate(-d.x,-d.y),le(),se(),n&&e.translate(_.x1,_.y1)}};var jm=function(e){if(![`overlay`,`underlay`].includes(e))throw Error(`Invalid state`);return function(t,n,r,i,a){var o=this;if(n.visible()){var s=n.pstyle(`${e}-padding`).pfValue,c=n.pstyle(`${e}-opacity`).value,l=n.pstyle(`${e}-color`).value,u=n.pstyle(`${e}-shape`).value,d=n.pstyle(`${e}-corner-radius`).value;if(c>0){if(r||=n.position(),i==null||a==null){var f=n.padding();i=n.width()+2*f,a=n.height()+2*f}o.colorFillStyle(t,l[0],l[1],l[2],c),o.nodeShapes[u].draw(t,r.x,r.y,i+s*2,a+s*2,d),t.fill()}}}};Am.drawNodeOverlay=jm(`overlay`),Am.drawNodeUnderlay=jm(`underlay`),Am.hasPie=function(e){return e=e[0],e._private.hasPie},Am.hasStripe=function(e){return e=e[0],e._private.hasStripe},Am.drawPie=function(e,t,n,r){t=t[0],r||=t.position();var i=t.cy().style(),a=t.pstyle(`pie-size`),o=t.pstyle(`pie-hole`),s=t.pstyle(`pie-start-angle`).pfValue,c=r.x,l=r.y,u=t.width(),d=t.height(),f=Math.min(u,d)/2,p,m=0;if(this.usePaths()&&(c=0,l=0),a.units===`%`?f*=a.pfValue:a.pfValue!==void 0&&(f=a.pfValue/2),o.units===`%`?p=f*o.pfValue:o.pfValue!==void 0&&(p=o.pfValue/2),!(p>=f))for(var h=1;h<=i.pieBackgroundN;h++){var g=t.pstyle(`pie-`+h+`-background-size`).value,_=t.pstyle(`pie-`+h+`-background-color`).value,v=t.pstyle(`pie-`+h+`-background-opacity`).value*n,y=g/100;y+m>1&&(y=1-m);var b=1.5*Math.PI+2*Math.PI*m;b+=s;var x=2*Math.PI*y,S=b+x;g===0||m>=1||m+y>1||(p===0?(e.beginPath(),e.moveTo(c,l),e.arc(c,l,f,b,S),e.closePath()):(e.beginPath(),e.arc(c,l,f,b,S),e.arc(c,l,p,S,b,!0),e.closePath()),this.colorFillStyle(e,_[0],_[1],_[2],v),e.fill(),m+=y)}},Am.drawStripe=function(e,t,n,r){t=t[0],r||=t.position();var i=t.cy().style(),a=r.x,o=r.y,s=t.width(),c=t.height(),l=0,u=this.usePaths();e.save();var d=t.pstyle(`stripe-direction`).value,f=t.pstyle(`stripe-size`);switch(d){case`vertical`:break;case`righward`:e.rotate(-Math.PI/2)}var p=s,m=c;f.units===`%`?(p*=f.pfValue,m*=f.pfValue):f.pfValue!==void 0&&(p=f.pfValue,m=f.pfValue),u&&(a=0,o=0),o-=p/2,a-=m/2;for(var h=1;h<=i.stripeBackgroundN;h++){var g=t.pstyle(`stripe-`+h+`-background-size`).value,_=t.pstyle(`stripe-`+h+`-background-color`).value,v=t.pstyle(`stripe-`+h+`-background-opacity`).value*n,y=g/100;y+l>1&&(y=1-l),!(g===0||l>=1||l+y>1)&&(e.beginPath(),e.rect(a,o+m*l,p,m*y),e.closePath(),this.colorFillStyle(e,_[0],_[1],_[2],v),e.fill(),l+=y)}e.restore()};var Mm={},Nm=100;Mm.getPixelRatio=function(){var e=this.data.contexts[0];if(this.forcedPixelRatio!=null)return this.forcedPixelRatio;var t=this.cy.window(),n=e.backingStorePixelRatio||e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1;return(t.devicePixelRatio||1)/n},Mm.paintCache=function(e){for(var t=this.paintCaches=this.paintCaches||[],n=!0,r,i=0;i<t.length;i++)if(r=t[i],r.context===e){n=!1;break}return n&&(r={context:e},t.push(r)),r},Mm.createGradientStyleFor=function(e,t,n,r,i){var a,o=this.usePaths(),s=n.pstyle(t+`-gradient-stop-colors`).value,c=n.pstyle(t+`-gradient-stop-positions`).pfValue;if(r===`radial-gradient`){if(n.isEdge()){var l=n.sourceEndpoint(),u=n.targetEndpoint(),d=n.midpoint(),f=sr(l,d),p=sr(u,d);a=e.createRadialGradient(d.x,d.y,0,d.x,d.y,Math.max(f,p))}else{var m=o?{x:0,y:0}:n.position(),h=n.paddedWidth(),g=n.paddedHeight();a=e.createRadialGradient(m.x,m.y,0,m.x,m.y,Math.max(h,g))}}else if(n.isEdge()){var _=n.sourceEndpoint(),v=n.targetEndpoint();a=e.createLinearGradient(_.x,_.y,v.x,v.y)}else{var y=o?{x:0,y:0}:n.position(),b=n.paddedWidth(),x=n.paddedHeight(),S=b/2,C=x/2;switch(n.pstyle(`background-gradient-direction`).value){case`to-bottom`:a=e.createLinearGradient(y.x,y.y-C,y.x,y.y+C);break;case`to-top`:a=e.createLinearGradient(y.x,y.y+C,y.x,y.y-C);break;case`to-left`:a=e.createLinearGradient(y.x+S,y.y,y.x-S,y.y);break;case`to-right`:a=e.createLinearGradient(y.x-S,y.y,y.x+S,y.y);break;case`to-bottom-right`:case`to-right-bottom`:a=e.createLinearGradient(y.x-S,y.y-C,y.x+S,y.y+C);break;case`to-top-right`:case`to-right-top`:a=e.createLinearGradient(y.x-S,y.y+C,y.x+S,y.y-C);break;case`to-bottom-left`:case`to-left-bottom`:a=e.createLinearGradient(y.x+S,y.y-C,y.x-S,y.y+C);break;case`to-top-left`:case`to-left-top`:a=e.createLinearGradient(y.x+S,y.y+C,y.x-S,y.y-C)}}if(!a)return null;for(var w=c.length===s.length,T=s.length,E=0;E<T;E++)a.addColorStop(w?c[E]:E/(T-1),`rgba(`+s[E][0]+`,`+s[E][1]+`,`+s[E][2]+`,`+i+`)`);return a},Mm.gradientFillStyle=function(e,t,n,r){var i=this.createGradientStyleFor(e,`background`,t,n,r);if(!i)return null;e.fillStyle=i},Mm.colorFillStyle=function(e,t,n,r,i){e.fillStyle=`rgba(`+t+`,`+n+`,`+r+`,`+i+`)`},Mm.eleFillStyle=function(e,t,n){var r=t.pstyle(`background-fill`).value;if(r===`linear-gradient`||r===`radial-gradient`)this.gradientFillStyle(e,t,r,n);else{var i=t.pstyle(`background-color`).value;this.colorFillStyle(e,i[0],i[1],i[2],n)}},Mm.gradientStrokeStyle=function(e,t,n,r){var i=this.createGradientStyleFor(e,`line`,t,n,r);if(!i)return null;e.strokeStyle=i},Mm.colorStrokeStyle=function(e,t,n,r,i){e.strokeStyle=`rgba(`+t+`,`+n+`,`+r+`,`+i+`)`},Mm.eleStrokeStyle=function(e,t,n){var r=t.pstyle(`line-fill`).value;if(r===`linear-gradient`||r===`radial-gradient`)this.gradientStrokeStyle(e,t,r,n);else{var i=t.pstyle(`line-color`).value;this.colorStrokeStyle(e,i[0],i[1],i[2],n)}},Mm.matchCanvasSize=function(e){var t=this,n=t.data,r=t.findContainerClientCoords(),i=r[2],a=r[3],o=t.getPixelRatio(),s=t.motionBlurPxRatio;(e===t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_NODE]||e===t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_DRAG])&&(o=s);var c=i*o,l=a*o,u;if(c!==t.canvasWidth||l!==t.canvasHeight){t.fontCaches=null;var d=n.canvasContainer;d.style.width=i+`px`,d.style.height=a+`px`;for(var f=0;f<t.CANVAS_LAYERS;f++)u=n.canvases[f],u.width=c,u.height=l,u.style.width=i+`px`,u.style.height=a+`px`;for(var f=0;f<t.BUFFER_COUNT;f++)u=n.bufferCanvases[f],u.width=c,u.height=l,u.style.width=i+`px`,u.style.height=a+`px`;t.textureMult=1,o<=1&&(u=n.bufferCanvases[t.TEXTURE_BUFFER],t.textureMult=2,u.width=c*t.textureMult,u.height=l*t.textureMult),t.canvasWidth=c,t.canvasHeight=l,t.pixelRatio=o}},Mm.renderTo=function(e,t,n,r){this.render({forcedContext:e,forcedZoom:t,forcedPan:n,drawAllLayers:!0,forcedPxRatio:r})},Mm.clearCanvas=function(){var e=this,t=e.data;function n(t){t.clearRect(0,0,e.canvasWidth,e.canvasHeight)}n(t.contexts[e.NODE]),n(t.contexts[e.DRAG])},Mm.render=function(e){var t=this;e||=fn();var n=t.cy,r=e.forcedContext,i=e.drawAllLayers,a=e.drawOnlyNodeLayer,o=e.forcedZoom,s=e.forcedPan,c=e.forcedPxRatio===void 0?this.getPixelRatio():e.forcedPxRatio,l=t.data,u=l.canvasNeedsRedraw,d=t.textureOnViewport&&!r&&(t.pinching||t.hoverData.dragging||t.swipePanning||t.data.wheelZooming),f=e.motionBlur===void 0?t.motionBlur:e.motionBlur,p=t.motionBlurPxRatio,m=n.hasCompoundNodes(),h=t.hoverData.draggingEles,g=!!(t.hoverData.selecting||t.touchData.selecting);f=f&&!r&&t.motionBlurEnabled&&!g;var _=f;r||(t.prevPxRatio!==c&&(t.invalidateContainerClientCoordsCache(),t.matchCanvasSize(t.container),t.redrawHint(`eles`,!0),t.redrawHint(`drag`,!0)),t.prevPxRatio=c),!r&&t.motionBlurTimeout&&clearTimeout(t.motionBlurTimeout),f&&(t.mbFrames??=0,t.mbFrames++,t.mbFrames<3&&(_=!1),t.mbFrames>t.minMbLowQualFrames&&(t.motionBlurPxRatio=t.mbPxRBlurry)),t.clearingMotionBlur&&(t.motionBlurPxRatio=1),t.textureDrawLastFrame&&!d&&(u[t.NODE]=!0,u[t.SELECT_BOX]=!0);var v=n.style(),y=n.zoom(),b=o===void 0?y:o,x=n.pan(),S={x:x.x,y:x.y},C={zoom:y,pan:{x:x.x,y:x.y}},w=t.prevViewport;w!==void 0&&C.zoom===w.zoom&&C.pan.x===w.pan.x&&C.pan.y===w.pan.y&&!(h&&!m)&&(t.motionBlurPxRatio=1),s&&(S=s),b*=c,S.x*=c,S.y*=c;var T=t.getCachedZSortedEles();function E(e,n,r,i,a){var o=e.globalCompositeOperation;e.globalCompositeOperation=`destination-out`,t.colorFillStyle(e,255,255,255,t.motionBlurTransparency),e.fillRect(n,r,i,a),e.globalCompositeOperation=o}function D(e,n){var a,c,u,d;!t.clearingMotionBlur&&(e===l.bufferContexts[t.MOTIONBLUR_BUFFER_NODE]||e===l.bufferContexts[t.MOTIONBLUR_BUFFER_DRAG])?(a={x:x.x*p,y:x.y*p},c=y*p,u=t.canvasWidth*p,d=t.canvasHeight*p):(a=S,c=b,u=t.canvasWidth,d=t.canvasHeight),e.setTransform(1,0,0,1,0,0),n===`motionBlur`?E(e,0,0,u,d):!r&&(n===void 0||n)&&e.clearRect(0,0,u,d),i||(e.translate(a.x,a.y),e.scale(c,c)),s&&e.translate(s.x,s.y),o&&e.scale(o,o)}if(d||(t.textureDrawLastFrame=!1),d){if(t.textureDrawLastFrame=!0,!t.textureCache){t.textureCache={},t.textureCache.bb=n.mutableElements().boundingBox(),t.textureCache.texture=t.data.bufferCanvases[t.TEXTURE_BUFFER];var O=t.data.bufferContexts[t.TEXTURE_BUFFER];O.setTransform(1,0,0,1,0,0),O.clearRect(0,0,t.canvasWidth*t.textureMult,t.canvasHeight*t.textureMult),t.render({forcedContext:O,drawOnlyNodeLayer:!0,forcedPxRatio:c*t.textureMult});var C=t.textureCache.viewport={zoom:n.zoom(),pan:n.pan(),width:t.canvasWidth,height:t.canvasHeight};C.mpan={x:(0-C.pan.x)/C.zoom,y:(0-C.pan.y)/C.zoom}}u[t.DRAG]=!1,u[t.NODE]=!1;var k=l.contexts[t.NODE],A=t.textureCache.texture,C=t.textureCache.viewport;k.setTransform(1,0,0,1,0,0),f?E(k,0,0,C.width,C.height):k.clearRect(0,0,C.width,C.height);var j=v.core(`outside-texture-bg-color`).value,M=v.core(`outside-texture-bg-opacity`).value;t.colorFillStyle(k,j[0],j[1],j[2],M),k.fillRect(0,0,C.width,C.height);var y=n.zoom();D(k,!1),k.clearRect(C.mpan.x,C.mpan.y,C.width/C.zoom/c,C.height/C.zoom/c),k.drawImage(A,C.mpan.x,C.mpan.y,C.width/C.zoom/c,C.height/C.zoom/c)}else t.textureOnViewport&&!r&&(t.textureCache=null);var N=n.extent(),P=t.pinching||t.hoverData.dragging||t.swipePanning||t.data.wheelZooming||t.hoverData.draggingEles||t.cy.animated(),F=t.hideEdgesOnViewport&&P,I=[];if(I[t.NODE]=!u[t.NODE]&&f&&!t.clearedForMotionBlur[t.NODE]||t.clearingMotionBlur,I[t.NODE]&&(t.clearedForMotionBlur[t.NODE]=!0),I[t.DRAG]=!u[t.DRAG]&&f&&!t.clearedForMotionBlur[t.DRAG]||t.clearingMotionBlur,I[t.DRAG]&&(t.clearedForMotionBlur[t.DRAG]=!0),u[t.NODE]||i||a||I[t.NODE]){var L=f&&!I[t.NODE]&&p!==1,k=r||(L?t.data.bufferContexts[t.MOTIONBLUR_BUFFER_NODE]:l.contexts[t.NODE]);D(k,f&&!L?`motionBlur`:void 0),F?t.drawCachedNodes(k,T.nondrag,c,N):t.drawLayeredElements(k,T.nondrag,c,N),t.debug&&t.drawDebugPoints(k,T.nondrag),!i&&!f&&(u[t.NODE]=!1)}if(!a&&(u[t.DRAG]||i||I[t.DRAG])){var L=f&&!I[t.DRAG]&&p!==1,k=r||(L?t.data.bufferContexts[t.MOTIONBLUR_BUFFER_DRAG]:l.contexts[t.DRAG]);D(k,f&&!L?`motionBlur`:void 0),F?t.drawCachedNodes(k,T.drag,c,N):t.drawCachedElements(k,T.drag,c,N),t.debug&&t.drawDebugPoints(k,T.drag),!i&&!f&&(u[t.DRAG]=!1)}if(this.drawSelectionRectangle(e,D),f&&p!==1){var R=l.contexts[t.NODE],ee=t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_NODE],z=l.contexts[t.DRAG],B=t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_DRAG],V=function(e,n,r){e.setTransform(1,0,0,1,0,0),r||!_?e.clearRect(0,0,t.canvasWidth,t.canvasHeight):E(e,0,0,t.canvasWidth,t.canvasHeight);var i=p;e.drawImage(n,0,0,t.canvasWidth*i,t.canvasHeight*i,0,0,t.canvasWidth,t.canvasHeight)};(u[t.NODE]||I[t.NODE])&&(V(R,ee,I[t.NODE]),u[t.NODE]=!1),(u[t.DRAG]||I[t.DRAG])&&(V(z,B,I[t.DRAG]),u[t.DRAG]=!1)}t.prevViewport=C,t.clearingMotionBlur&&(t.clearingMotionBlur=!1,t.motionBlurCleared=!0,t.motionBlur=!0),f&&(t.motionBlurTimeout=setTimeout(function(){t.motionBlurTimeout=null,t.clearedForMotionBlur[t.NODE]=!1,t.clearedForMotionBlur[t.DRAG]=!1,t.motionBlur=!1,t.clearingMotionBlur=!d,t.mbFrames=0,u[t.NODE]=!0,u[t.DRAG]=!0,t.redraw()},Nm)),r||n.emit(`render`)};var Pm;Mm.drawSelectionRectangle=function(e,t){var n=this,r=n.cy,i=n.data,a=r.style(),o=e.drawOnlyNodeLayer,s=e.drawAllLayers,c=i.canvasNeedsRedraw,l=e.forcedContext;if(n.showFps||!o&&c[n.SELECT_BOX]&&!s){var u=l||i.contexts[n.SELECT_BOX];if(t(u),n.selection[4]==1&&(n.hoverData.selecting||n.touchData.selecting)){var d=n.cy.zoom(),f=a.core(`selection-box-border-width`).value/d;u.lineWidth=f,u.fillStyle=`rgba(`+a.core(`selection-box-color`).value[0]+`,`+a.core(`selection-box-color`).value[1]+`,`+a.core(`selection-box-color`).value[2]+`,`+a.core(`selection-box-opacity`).value+`)`,u.fillRect(n.selection[0],n.selection[1],n.selection[2]-n.selection[0],n.selection[3]-n.selection[1]),f>0&&(u.strokeStyle=`rgba(`+a.core(`selection-box-border-color`).value[0]+`,`+a.core(`selection-box-border-color`).value[1]+`,`+a.core(`selection-box-border-color`).value[2]+`,`+a.core(`selection-box-opacity`).value+`)`,u.strokeRect(n.selection[0],n.selection[1],n.selection[2]-n.selection[0],n.selection[3]-n.selection[1]))}if(i.bgActivePosistion&&!n.hoverData.selecting){var d=n.cy.zoom(),p=i.bgActivePosistion;u.fillStyle=`rgba(`+a.core(`active-bg-color`).value[0]+`,`+a.core(`active-bg-color`).value[1]+`,`+a.core(`active-bg-color`).value[2]+`,`+a.core(`active-bg-opacity`).value+`)`,u.beginPath(),u.arc(p.x,p.y,a.core(`active-bg-size`).pfValue/d,0,2*Math.PI),u.fill()}var m=n.lastRedrawTime;if(n.showFps&&m){m=Math.round(m);var h=Math.round(1e3/m),g=`1 frame = `+m+` ms = `+h+` fps`;u.setTransform(1,0,0,1,0,0),u.fillStyle=`rgba(255, 0, 0, 0.75)`,u.strokeStyle=`rgba(255, 0, 0, 0.75)`,u.font=`30px Arial`,Pm||=u.measureText(g).actualBoundingBoxAscent,u.fillText(g,0,Pm),u.strokeRect(0,Pm+10,250,20),u.fillRect(0,Pm+10,250*Math.min(h/60,1),20)}s||(c[n.SELECT_BOX]=!1)}};function Fm(e,t,n){var r=e.createShader(t);if(e.shaderSource(r,n),e.compileShader(r),!e.getShaderParameter(r,e.COMPILE_STATUS))throw Error(e.getShaderInfoLog(r));return r}function Im(e,t,n){var r=Fm(e,e.VERTEX_SHADER,t),i=Fm(e,e.FRAGMENT_SHADER,n),a=e.createProgram();if(e.attachShader(a,r),e.attachShader(a,i),e.linkProgram(a),!e.getProgramParameter(a,e.LINK_STATUS))throw Error(`Could not initialize shaders`);return a}function Lm(e,t,n){n===void 0&&(n=t);var r=e.makeOffscreenCanvas(t,n),i=r.context=r.getContext(`2d`);return r.clear=function(){return i.clearRect(0,0,r.width,r.height)},r.clear(),r}function Rm(e){var t=e.pixelRatio,n=e.cy.zoom(),r=e.cy.pan();return{zoom:n*t,pan:{x:r.x*t,y:r.y*t}}}function zm(e){var t=e.pixelRatio;return e.cy.zoom()*t}function Bm(e,t,n,r,i){var a=r*n+t.x,o=i*n+t.y;return o=Math.round(e.canvasHeight-o),[a,o]}function Vm(e,t){return t.picking?!0:e.pstyle(`background-fill`).value!==`solid`||e.pstyle(`background-image`).strValue!==`none`?!1:e.pstyle(`border-width`).value===0||e.pstyle(`border-opacity`).value===0||e.pstyle(`border-style`).value===`solid`}function Hm(e,t){if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Um(e,t,n){var r=e[0]/255,i=e[1]/255,a=e[2]/255,o=t,s=n||[,,,,];return s[0]=r*o,s[1]=i*o,s[2]=a*o,s[3]=o,s}function Wm(e,t){var n=t||[,,,,];return n[0]=(e>>0&255)/255,n[1]=(e>>8&255)/255,n[2]=(e>>16&255)/255,n[3]=(e>>24&255)/255,n}function Gm(e){return e[0]+(e[1]<<8)+(e[2]<<16)+(e[3]<<24)}function Km(e,t){var n=e.createTexture();return n.buffer=function(t){e.bindTexture(e.TEXTURE_2D,n),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR_MIPMAP_NEAREST),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,t),e.generateMipmap(e.TEXTURE_2D),e.bindTexture(e.TEXTURE_2D,null)},n.deleteTexture=function(){e.deleteTexture(n)},n}function qm(e,t){switch(t){case`float`:return[1,e.FLOAT,4];case`vec2`:return[2,e.FLOAT,4];case`vec3`:return[3,e.FLOAT,4];case`vec4`:return[4,e.FLOAT,4];case`int`:return[1,e.INT,4];case`ivec2`:return[2,e.INT,4]}}function Jm(e,t,n){switch(t){case e.FLOAT:return new Float32Array(n);case e.INT:return new Int32Array(n)}}function Ym(e,t,n,r,i,a){switch(t){case e.FLOAT:return new Float32Array(n.buffer,a*r,i);case e.INT:return new Int32Array(n.buffer,a*r,i)}}function Xm(e,t,n,r){var i=M(qm(e,t),2),a=i[0],o=i[1],s=Jm(e,o,r),c=e.createBuffer();return e.bindBuffer(e.ARRAY_BUFFER,c),e.bufferData(e.ARRAY_BUFFER,s,e.STATIC_DRAW),o===e.FLOAT?e.vertexAttribPointer(n,a,o,!1,0,0):o===e.INT&&e.vertexAttribIPointer(n,a,o,0,0),e.enableVertexAttribArray(n),e.bindBuffer(e.ARRAY_BUFFER,null),c}function Zm(e,t,n,r){var i=M(qm(e,n),3),a=i[0],o=i[1],s=i[2],c=Jm(e,o,t*a),l=a*s,u=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,u),e.bufferData(e.ARRAY_BUFFER,t*l,e.DYNAMIC_DRAW),e.enableVertexAttribArray(r),o===e.FLOAT?e.vertexAttribPointer(r,a,o,!1,l,0):o===e.INT&&e.vertexAttribIPointer(r,a,o,l,0),e.vertexAttribDivisor(r,1),e.bindBuffer(e.ARRAY_BUFFER,null);for(var d=Array(t),f=0;f<t;f++)d[f]=Ym(e,o,c,l,a,f);return u.dataArray=c,u.stride=l,u.size=a,u.getView=function(e){return d[e]},u.setPoint=function(e,t,n){var r=d[e];r[0]=t,r[1]=n},u.bufferSubData=function(t){e.bindBuffer(e.ARRAY_BUFFER,u),t?e.bufferSubData(e.ARRAY_BUFFER,0,c,0,t*a):e.bufferSubData(e.ARRAY_BUFFER,0,c)},u}function Qm(e,t,n){for(var r=9,i=new Float32Array(t*r),a=Array(t),o=0;o<t;o++){var s=o*r*4;a[o]=new Float32Array(i.buffer,s,r)}var c=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,c),e.bufferData(e.ARRAY_BUFFER,i.byteLength,e.DYNAMIC_DRAW);for(var l=0;l<3;l++){var u=n+l;e.enableVertexAttribArray(u),e.vertexAttribPointer(u,3,e.FLOAT,!1,36,l*12),e.vertexAttribDivisor(u,1)}return e.bindBuffer(e.ARRAY_BUFFER,null),c.getMatrixView=function(e){return a[e]},c.setData=function(e,t){a[t].set(e,0)},c.bufferSubData=function(){e.bindBuffer(e.ARRAY_BUFFER,c),e.bufferSubData(e.ARRAY_BUFFER,0,i)},c}function $m(e){var t=e.createFramebuffer();e.bindFramebuffer(e.FRAMEBUFFER,t);var n=e.createTexture();return e.bindTexture(e.TEXTURE_2D,n),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,n,0),e.bindFramebuffer(e.FRAMEBUFFER,null),t.setFramebufferAttachmentSizes=function(t,r){e.bindTexture(e.TEXTURE_2D,n),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,t,r,0,e.RGBA,e.UNSIGNED_BYTE,null)},t}var eh=typeof Float32Array<`u`?Float32Array:Array;Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});function th(){var e=new eh(9);return eh!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[5]=0,e[6]=0,e[7]=0),e[0]=1,e[4]=1,e[8]=1,e}function nh(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}function rh(e,t,n){var r=t[0],i=t[1],a=t[2],o=t[3],s=t[4],c=t[5],l=t[6],u=t[7],d=t[8],f=n[0],p=n[1],m=n[2],h=n[3],g=n[4],_=n[5],v=n[6],y=n[7],b=n[8];return e[0]=f*r+p*o+m*l,e[1]=f*i+p*s+m*u,e[2]=f*a+p*c+m*d,e[3]=h*r+g*o+_*l,e[4]=h*i+g*s+_*u,e[5]=h*a+g*c+_*d,e[6]=v*r+y*o+b*l,e[7]=v*i+y*s+b*u,e[8]=v*a+y*c+b*d,e}function ih(e,t,n){var r=t[0],i=t[1],a=t[2],o=t[3],s=t[4],c=t[5],l=t[6],u=t[7],d=t[8],f=n[0],p=n[1];return e[0]=r,e[1]=i,e[2]=a,e[3]=o,e[4]=s,e[5]=c,e[6]=f*r+p*o+l,e[7]=f*i+p*s+u,e[8]=f*a+p*c+d,e}function ah(e,t,n){var r=t[0],i=t[1],a=t[2],o=t[3],s=t[4],c=t[5],l=t[6],u=t[7],d=t[8],f=Math.sin(n),p=Math.cos(n);return e[0]=p*r+f*o,e[1]=p*i+f*s,e[2]=p*a+f*c,e[3]=p*o-f*r,e[4]=p*s-f*i,e[5]=p*c-f*a,e[6]=l,e[7]=u,e[8]=d,e}function oh(e,t,n){var r=n[0],i=n[1];return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=i*t[3],e[4]=i*t[4],e[5]=i*t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}function sh(e,t,n){return e[0]=2/t,e[1]=0,e[2]=0,e[3]=0,e[4]=-2/n,e[5]=0,e[6]=-1,e[7]=1,e[8]=1,e}var ch=function(){function e(t,n,r,i){C(this,e),this.debugID=Math.floor(Math.random()*1e4),this.r=t,this.texSize=n,this.texRows=r,this.texHeight=Math.floor(n/r),this.enableWrapping=!0,this.locked=!1,this.texture=null,this.needsBuffer=!0,this.freePointer={x:0,row:0},this.keyToLocation=new Map,this.canvas=i(t,n,n),this.scratch=i(t,n,this.texHeight,`scratch`)}return T(e,[{key:`lock`,value:function(){this.locked=!0}},{key:`getKeys`,value:function(){return new Set(this.keyToLocation.keys())}},{key:`getScale`,value:function(e){var t=e.w,n=e.h,r=this.texHeight,i=this.texSize,a=r/n,o=t*a,s=n*a;return o>i&&(a=i/t,o=t*a,s=n*a),{scale:a,texW:o,texH:s}}},{key:`draw`,value:function(e,t,n){var r=this;if(this.locked)throw Error(`can't draw, atlas is locked`);var i=this.texSize,a=this.texRows,o=this.texHeight,s=this.getScale(t),c=s.scale,l=s.texW,u=s.texH,d=function(e,r){if(n&&r){var i=r.context,a=e.x,s=e.row,l=a,u=o*s;i.save(),i.translate(l,u),i.scale(c,c),n(i,t),i.restore()}},f=[null,null],p=function(){d(r.freePointer,r.canvas),f[0]={x:r.freePointer.x,y:r.freePointer.row*o,w:l,h:u},f[1]={x:r.freePointer.x+l,y:r.freePointer.row*o,w:0,h:u},r.freePointer.x+=l,r.freePointer.x==i&&(r.freePointer.x=0,r.freePointer.row++)},m=function(){var e=r.scratch,t=r.canvas;e.clear(),d({x:0,row:0},e);var n=i-r.freePointer.x,a=l-n,s=o,c=r.freePointer.x,p=r.freePointer.row*o,m=n;t.context.drawImage(e,0,0,m,s,c,p,m,s),f[0]={x:c,y:p,w:m,h:u};var h=n,g=(r.freePointer.row+1)*o,_=a;t&&t.context.drawImage(e,h,0,_,s,0,g,_,s),f[1]={x:0,y:g,w:_,h:u},r.freePointer.x=a,r.freePointer.row++},h=function(){r.freePointer.x=0,r.freePointer.row++};if(this.freePointer.x+l<=i)p();else if(this.freePointer.row>=a-1)return!1;else this.freePointer.x===i?(h(),p()):this.enableWrapping?m():(h(),p());return this.keyToLocation.set(e,f),this.needsBuffer=!0,f}},{key:`getOffsets`,value:function(e){return this.keyToLocation.get(e)}},{key:`isEmpty`,value:function(){return this.freePointer.x===0&&this.freePointer.row===0}},{key:`canFit`,value:function(e){if(this.locked)return!1;var t=this.texSize,n=this.texRows,r=this.getScale(e).texW;return this.freePointer.x+r>t?this.freePointer.row<n-1:!0}},{key:`bufferIfNeeded`,value:function(e){this.texture||=Km(e,this.debugID),this.needsBuffer&&(this.texture.buffer(this.canvas),this.needsBuffer=!1,this.locked&&(this.canvas=null,this.scratch=null))}},{key:`dispose`,value:function(){this.texture&&=(this.texture.deleteTexture(),null),this.canvas=null,this.scratch=null,this.locked=!0}}])}(),lh=function(){function e(t,n,r,i){C(this,e),this.r=t,this.texSize=n,this.texRows=r,this.createTextureCanvas=i,this.atlases=[],this.styleKeyToAtlas=new Map,this.markedKeys=new Set}return T(e,[{key:`getKeys`,value:function(){return new Set(this.styleKeyToAtlas.keys())}},{key:`_createAtlas`,value:function(){var e=this.r,t=this.texSize,n=this.texRows,r=this.createTextureCanvas;return new ch(e,t,n,r)}},{key:`_getScratchCanvas`,value:function(){if(!this.scratch){var e=this.r,t=this.texSize,n=this.texRows,r=this.createTextureCanvas,i=Math.floor(t/n);this.scratch=r(e,t,i,`scratch`)}return this.scratch}},{key:`draw`,value:function(e,t,n){var r=this.styleKeyToAtlas.get(e);return r||(r=this.atlases[this.atlases.length-1],(!r||!r.canFit(t))&&(r&&r.lock(),r=this._createAtlas(),this.atlases.push(r)),r.draw(e,t,n),this.styleKeyToAtlas.set(e,r)),r}},{key:`getAtlas`,value:function(e){return this.styleKeyToAtlas.get(e)}},{key:`hasAtlas`,value:function(e){return this.styleKeyToAtlas.has(e)}},{key:`markKeyForGC`,value:function(e){this.markedKeys.add(e)}},{key:`gc`,value:function(){var e=this,t=this.markedKeys;if(t.size===0){console.log(`nothing to garbage collect`);return}var n=[],r=new Map,i=null,a=E(this.atlases),o;try{var s=function(){var a=o.value,s=a.getKeys(),c=uh(t,s);if(c.size===0)return n.push(a),s.forEach(function(e){return r.set(e,a)}),1;i||(i=e._createAtlas(),n.push(i));var l=E(s),u;try{for(l.s();!(u=l.n()).done;){var d=u.value;if(!c.has(d)){var f=M(a.getOffsets(d),2),p=f[0],m=f[1];i.canFit({w:p.w+m.w,h:p.h})||(i.lock(),i=e._createAtlas(),n.push(i)),a.canvas&&(e._copyTextureToNewAtlas(d,a,i),r.set(d,i))}}}catch(e){l.e(e)}finally{l.f()}a.dispose()};for(a.s();!(o=a.n()).done;)if(s())continue}catch(e){a.e(e)}finally{a.f()}this.atlases=n,this.styleKeyToAtlas=r,this.markedKeys=new Set}},{key:`_copyTextureToNewAtlas`,value:function(e,t,n){var r=M(t.getOffsets(e),2),i=r[0],a=r[1];if(a.w===0)n.draw(e,i,function(e){e.drawImage(t.canvas,i.x,i.y,i.w,i.h,0,0,i.w,i.h)});else{var o=this._getScratchCanvas();o.clear(),o.context.drawImage(t.canvas,i.x,i.y,i.w,i.h,0,0,i.w,i.h),o.context.drawImage(t.canvas,a.x,a.y,a.w,a.h,i.w,0,a.w,a.h);var s=i.w+a.w,c=i.h;n.draw(e,{w:s,h:c},function(e){e.drawImage(o,0,0,s,c,0,0,s,c)})}}},{key:`getCounts`,value:function(){return{keyCount:this.styleKeyToAtlas.size,atlasCount:new Set(this.styleKeyToAtlas.values()).size}}}])}();function uh(e,t){return e.intersection?e.intersection(t):new Set(N(e).filter(function(e){return t.has(e)}))}var dh=function(){function e(t,n){C(this,e),this.r=t,this.globalOptions=n,this.atlasSize=n.webglTexSize,this.maxAtlasesPerBatch=n.webglTexPerBatch,this.renderTypes=new Map,this.collections=new Map,this.typeAndIdToKey=new Map}return T(e,[{key:`getAtlasSize`,value:function(){return this.atlasSize}},{key:`addAtlasCollection`,value:function(e,t){var n=this.globalOptions,r=n.webglTexSize,i=n.createTextureCanvas,a=t.texRows,o=this._cacheScratchCanvas(i),s=new lh(this.r,r,a,o);this.collections.set(e,s)}},{key:`addRenderType`,value:function(e,t){var n=t.collection;if(!this.collections.has(n))throw Error(`invalid atlas collection name '${n}'`);var r=X({type:e,atlasCollection:this.collections.get(n)},t);this.renderTypes.set(e,r)}},{key:`getRenderTypeOpts`,value:function(e){return this.renderTypes.get(e)}},{key:`getAtlasCollection`,value:function(e){return this.collections.get(e)}},{key:`_cacheScratchCanvas`,value:function(e){var t=-1,n=-1,r=null;return function(i,a,o,s){return s?((!r||a!=t||o!=n)&&(t=a,n=o,r=e(i,a,o)),r):e(i,a,o)}}},{key:`_key`,value:function(e,t){return`${e}-${t}`}},{key:`invalidate`,value:function(e){var t=this,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=n.forceRedraw,i=r!==void 0&&r,a=n.filterEle,o=a===void 0?function(){return!0}:a,s=n.filterType,c=s===void 0?function(){return!0}:s,l=!1,u=!1,d=E(e),f;try{for(d.s();!(f=d.n()).done;){var p=f.value;if(o(p)){var m=E(this.renderTypes.values()),h;try{var g=function(){var e=h.value,n=e.type;if(c(n)){var r=t.collections.get(e.collection),a=e.getKey(p),o=Array.isArray(a)?a:[a];if(i)o.forEach(function(e){return r.markKeyForGC(e)}),u=!0;else{var s=e.getID?e.getID(p):p.id(),d=t._key(n,s),f=t.typeAndIdToKey.get(d);f!==void 0&&!Hm(o,f)&&(l=!0,t.typeAndIdToKey.delete(d),f.forEach(function(e){return r.markKeyForGC(e)}))}}};for(m.s();!(h=m.n()).done;)g()}catch(e){m.e(e)}finally{m.f()}}}}catch(e){d.e(e)}finally{d.f()}return u&&(this.gc(),l=!1),l}},{key:`gc`,value:function(){var e=E(this.collections.values()),t;try{for(e.s();!(t=e.n()).done;)t.value.gc()}catch(t){e.e(t)}finally{e.f()}}},{key:`getOrCreateAtlas`,value:function(e,t,n,r){var i=this.renderTypes.get(t),a=this.collections.get(i.collection),o=!1,s=a.draw(r,n,function(t){i.drawClipped?(t.save(),t.beginPath(),t.rect(0,0,n.w,n.h),t.clip(),i.drawElement(t,e,n,!0,!0),t.restore()):i.drawElement(t,e,n,!0,!0),o=!0});if(o){var c=i.getID?i.getID(e):e.id(),l=this._key(t,c);this.typeAndIdToKey.has(l)?this.typeAndIdToKey.get(l).push(r):this.typeAndIdToKey.set(l,[r])}return s}},{key:`getAtlasInfo`,value:function(e,t){var n=this,r=this.renderTypes.get(t),i=r.getKey(e);return(Array.isArray(i)?i:[i]).map(function(i){var a=r.getBoundingBox(e,i),o=n.getOrCreateAtlas(e,t,a,i),s=M(o.getOffsets(i),2),c=s[0];return{atlas:o,tex:c,tex1:c,tex2:s[1],bb:a}})}},{key:`getDebugInfo`,value:function(){var e=[],t=E(this.collections),n;try{for(t.s();!(n=t.n()).done;){var r=M(n.value,2),i=r[0],a=r[1].getCounts(),o=a.keyCount,s=a.atlasCount;e.push({type:i,keyCount:o,atlasCount:s})}}catch(e){t.e(e)}finally{t.f()}return e}}])}(),fh=function(){function e(t){C(this,e),this.globalOptions=t,this.atlasSize=t.webglTexSize,this.maxAtlasesPerBatch=t.webglTexPerBatch,this.batchAtlases=[]}return T(e,[{key:`getMaxAtlasesPerBatch`,value:function(){return this.maxAtlasesPerBatch}},{key:`getAtlasSize`,value:function(){return this.atlasSize}},{key:`getIndexArray`,value:function(){return Array.from({length:this.maxAtlasesPerBatch},function(e,t){return t})}},{key:`startBatch`,value:function(){this.batchAtlases=[]}},{key:`getAtlasCount`,value:function(){return this.batchAtlases.length}},{key:`getAtlases`,value:function(){return this.batchAtlases}},{key:`canAddToCurrentBatch`,value:function(e){return this.batchAtlases.length!==this.maxAtlasesPerBatch||this.batchAtlases.includes(e)}},{key:`getAtlasIndexForBatch`,value:function(e){var t=this.batchAtlases.indexOf(e);if(t<0){if(this.batchAtlases.length===this.maxAtlasesPerBatch)throw Error(`cannot add more atlases to batch`);this.batchAtlases.push(e),t=this.batchAtlases.length-1}return t}}])}(),ph=`
16
+ float circleSD(vec2 p, float r) {
17
+ return distance(vec2(0), p) - r; // signed distance
18
+ }
19
+ `,mh=`
20
+ float rectangleSD(vec2 p, vec2 b) {
21
+ vec2 d = abs(p)-b;
22
+ return distance(vec2(0),max(d,0.0)) + min(max(d.x,d.y),0.0);
23
+ }
24
+ `,hh=`
25
+ float roundRectangleSD(vec2 p, vec2 b, vec4 cr) {
26
+ cr.xy = (p.x > 0.0) ? cr.xy : cr.zw;
27
+ cr.x = (p.y > 0.0) ? cr.x : cr.y;
28
+ vec2 q = abs(p) - b + cr.x;
29
+ return min(max(q.x, q.y), 0.0) + distance(vec2(0), max(q, 0.0)) - cr.x;
30
+ }
31
+ `,gh=`
32
+ float ellipseSD(vec2 p, vec2 ab) {
33
+ p = abs( p ); // symmetry
34
+
35
+ // find root with Newton solver
36
+ vec2 q = ab*(p-ab);
37
+ float w = (q.x<q.y)? 1.570796327 : 0.0;
38
+ for( int i=0; i<5; i++ ) {
39
+ vec2 cs = vec2(cos(w),sin(w));
40
+ vec2 u = ab*vec2( cs.x,cs.y);
41
+ vec2 v = ab*vec2(-cs.y,cs.x);
42
+ w = w + dot(p-u,v)/(dot(p-u,u)+dot(v,v));
43
+ }
44
+
45
+ // compute final point and distance
46
+ float d = length(p-ab*vec2(cos(w),sin(w)));
47
+
48
+ // return signed distance
49
+ return (dot(p/ab,p/ab)>1.0) ? d : -d;
50
+ }
51
+ `,_h={SCREEN:{name:`screen`,screen:!0},PICKING:{name:`picking`,picking:!0}},vh={IGNORE:1,USE_BB:2},yh=0,bh=1,xh=2,Sh=3,Ch=4,wh=5,Th=6,Eh=7,Dh=function(){function e(t,n,r){C(this,e),this.r=t,this.gl=n,this.maxInstances=r.webglBatchSize,this.atlasSize=r.webglTexSize,this.bgColor=r.bgColor,this.debug=r.webglDebug,this.batchDebugInfo=[],r.enableWrapping=!0,r.createTextureCanvas=Lm,this.atlasManager=new dh(t,r),this.batchManager=new fh(r),this.simpleShapeOptions=new Map,this.program=this._createShaderProgram(_h.SCREEN),this.pickingProgram=this._createShaderProgram(_h.PICKING),this.vao=this._createVAO()}return T(e,[{key:`addAtlasCollection`,value:function(e,t){this.atlasManager.addAtlasCollection(e,t)}},{key:`addTextureAtlasRenderType`,value:function(e,t){this.atlasManager.addRenderType(e,t)}},{key:`addSimpleShapeRenderType`,value:function(e,t){this.simpleShapeOptions.set(e,t)}},{key:`invalidate`,value:function(e){var t=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:{}).type,n=this.atlasManager;return t?n.invalidate(e,{filterType:function(e){return e===t},forceRedraw:!0}):n.invalidate(e)}},{key:`gc`,value:function(){this.atlasManager.gc()}},{key:`_createShaderProgram`,value:function(e){var t=this.gl,n=`#version 300 es
52
+ precision highp float;
53
+
54
+ uniform mat3 uPanZoomMatrix;
55
+ uniform int uAtlasSize;
56
+
57
+ // instanced
58
+ in vec2 aPosition; // a vertex from the unit square
59
+
60
+ in mat3 aTransform; // used to transform verticies, eg into a bounding box
61
+ in int aVertType; // the type of thing we are rendering
62
+
63
+ // the z-index that is output when using picking mode
64
+ in vec4 aIndex;
65
+
66
+ // For textures
67
+ in int aAtlasId; // which shader unit/atlas to use
68
+ in vec4 aTex; // x/y/w/h of texture in atlas
69
+
70
+ // for edges
71
+ in vec4 aPointAPointB;
72
+ in vec4 aPointCPointD;
73
+ in vec2 aLineWidth; // also used for node border width
74
+
75
+ // simple shapes
76
+ in vec4 aCornerRadius; // for round-rectangle [top-right, bottom-right, top-left, bottom-left]
77
+ in vec4 aColor; // also used for edges
78
+ in vec4 aBorderColor; // aLineWidth is used for border width
79
+
80
+ // output values passed to the fragment shader
81
+ out vec2 vTexCoord;
82
+ out vec4 vColor;
83
+ out vec2 vPosition;
84
+ // flat values are not interpolated
85
+ flat out int vAtlasId;
86
+ flat out int vVertType;
87
+ flat out vec2 vTopRight;
88
+ flat out vec2 vBotLeft;
89
+ flat out vec4 vCornerRadius;
90
+ flat out vec4 vBorderColor;
91
+ flat out vec2 vBorderWidth;
92
+ flat out vec4 vIndex;
93
+
94
+ void main(void) {
95
+ int vid = gl_VertexID;
96
+ vec2 position = aPosition; // TODO make this a vec3, simplifies some code below
97
+
98
+ if(aVertType == ${yh}) {
99
+ float texX = aTex.x; // texture coordinates
100
+ float texY = aTex.y;
101
+ float texW = aTex.z;
102
+ float texH = aTex.w;
103
+
104
+ if(vid == 1 || vid == 2 || vid == 4) {
105
+ texX += texW;
106
+ }
107
+ if(vid == 2 || vid == 4 || vid == 5) {
108
+ texY += texH;
109
+ }
110
+
111
+ float d = float(uAtlasSize);
112
+ vTexCoord = vec2(texX / d, texY / d); // tex coords must be between 0 and 1
113
+
114
+ gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);
115
+ }
116
+ else if(aVertType == ${Ch} || aVertType == ${Eh}
117
+ || aVertType == ${wh} || aVertType == ${Th}) { // simple shapes
118
+
119
+ // the bounding box is needed by the fragment shader
120
+ vBotLeft = (aTransform * vec3(0, 0, 1)).xy; // flat
121
+ vTopRight = (aTransform * vec3(1, 1, 1)).xy; // flat
122
+ vPosition = (aTransform * vec3(position, 1)).xy; // will be interpolated
123
+
124
+ // calculations are done in the fragment shader, just pass these along
125
+ vColor = aColor;
126
+ vCornerRadius = aCornerRadius;
127
+ vBorderColor = aBorderColor;
128
+ vBorderWidth = aLineWidth;
129
+
130
+ gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);
131
+ }
132
+ else if(aVertType == ${bh}) {
133
+ vec2 source = aPointAPointB.xy;
134
+ vec2 target = aPointAPointB.zw;
135
+
136
+ // adjust the geometry so that the line is centered on the edge
137
+ position.y = position.y - 0.5;
138
+
139
+ // stretch the unit square into a long skinny rectangle
140
+ vec2 xBasis = target - source;
141
+ vec2 yBasis = normalize(vec2(-xBasis.y, xBasis.x));
142
+ vec2 point = source + xBasis * position.x + yBasis * aLineWidth[0] * position.y;
143
+
144
+ gl_Position = vec4(uPanZoomMatrix * vec3(point, 1.0), 1.0);
145
+ vColor = aColor;
146
+ }
147
+ else if(aVertType == ${xh}) {
148
+ vec2 pointA = aPointAPointB.xy;
149
+ vec2 pointB = aPointAPointB.zw;
150
+ vec2 pointC = aPointCPointD.xy;
151
+ vec2 pointD = aPointCPointD.zw;
152
+
153
+ // adjust the geometry so that the line is centered on the edge
154
+ position.y = position.y - 0.5;
155
+
156
+ vec2 p0, p1, p2, pos;
157
+ if(position.x == 0.0) { // The left side of the unit square
158
+ p0 = pointA;
159
+ p1 = pointB;
160
+ p2 = pointC;
161
+ pos = position;
162
+ } else { // The right side of the unit square, use same approach but flip the geometry upside down
163
+ p0 = pointD;
164
+ p1 = pointC;
165
+ p2 = pointB;
166
+ pos = vec2(0.0, -position.y);
167
+ }
168
+
169
+ vec2 p01 = p1 - p0;
170
+ vec2 p12 = p2 - p1;
171
+ vec2 p21 = p1 - p2;
172
+
173
+ // Find the normal vector.
174
+ vec2 tangent = normalize(normalize(p12) + normalize(p01));
175
+ vec2 normal = vec2(-tangent.y, tangent.x);
176
+
177
+ // Find the vector perpendicular to p0 -> p1.
178
+ vec2 p01Norm = normalize(vec2(-p01.y, p01.x));
179
+
180
+ // Determine the bend direction.
181
+ float sigma = sign(dot(p01 + p21, normal));
182
+ float width = aLineWidth[0];
183
+
184
+ if(sign(pos.y) == -sigma) {
185
+ // This is an intersecting vertex. Adjust the position so that there's no overlap.
186
+ vec2 point = 0.5 * width * normal * -sigma / dot(normal, p01Norm);
187
+ gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0);
188
+ } else {
189
+ // This is a non-intersecting vertex. Treat it like a mitre join.
190
+ vec2 point = 0.5 * width * normal * sigma * dot(normal, p01Norm);
191
+ gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0);
192
+ }
193
+
194
+ vColor = aColor;
195
+ }
196
+ else if(aVertType == ${Sh} && vid < 3) {
197
+ // massage the first triangle into an edge arrow
198
+ if(vid == 0)
199
+ position = vec2(-0.15, -0.3);
200
+ if(vid == 1)
201
+ position = vec2( 0.0, 0.0);
202
+ if(vid == 2)
203
+ position = vec2( 0.15, -0.3);
204
+
205
+ gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);
206
+ vColor = aColor;
207
+ }
208
+ else {
209
+ gl_Position = vec4(2.0, 0.0, 0.0, 1.0); // discard vertex by putting it outside webgl clip space
210
+ }
211
+
212
+ vAtlasId = aAtlasId;
213
+ vVertType = aVertType;
214
+ vIndex = aIndex;
215
+ }
216
+ `,r=this.batchManager.getIndexArray(),i=Im(t,n,`#version 300 es
217
+ precision highp float;
218
+
219
+ // declare texture unit for each texture atlas in the batch
220
+ ${r.map(function(e){return`uniform sampler2D uTexture${e};`}).join(`
221
+ `)}
222
+
223
+ uniform vec4 uBGColor;
224
+ uniform float uZoom;
225
+
226
+ in vec2 vTexCoord;
227
+ in vec4 vColor;
228
+ in vec2 vPosition; // model coordinates
229
+
230
+ flat in int vAtlasId;
231
+ flat in vec4 vIndex;
232
+ flat in int vVertType;
233
+ flat in vec2 vTopRight;
234
+ flat in vec2 vBotLeft;
235
+ flat in vec4 vCornerRadius;
236
+ flat in vec4 vBorderColor;
237
+ flat in vec2 vBorderWidth;
238
+
239
+ out vec4 outColor;
240
+
241
+ ${ph}
242
+ ${mh}
243
+ ${hh}
244
+ ${gh}
245
+
246
+ vec4 blend(vec4 top, vec4 bot) { // blend colors with premultiplied alpha
247
+ return vec4(
248
+ top.rgb + (bot.rgb * (1.0 - top.a)),
249
+ top.a + (bot.a * (1.0 - top.a))
250
+ );
251
+ }
252
+
253
+ vec4 distInterp(vec4 cA, vec4 cB, float d) { // interpolate color using Signed Distance
254
+ // scale to the zoom level so that borders don't look blurry when zoomed in
255
+ // note 1.5 is an aribitrary value chosen because it looks good
256
+ return mix(cA, cB, 1.0 - smoothstep(0.0, 1.5 / uZoom, abs(d)));
257
+ }
258
+
259
+ void main(void) {
260
+ if(vVertType == ${yh}) {
261
+ // look up the texel from the texture unit
262
+ ${r.map(function(e){return`if(vAtlasId == ${e}) outColor = texture(uTexture${e}, vTexCoord);`}).join(`
263
+ else `)}
264
+ }
265
+ else if(vVertType == ${Sh}) {
266
+ // mimics how canvas renderer uses context.globalCompositeOperation = 'destination-out';
267
+ outColor = blend(vColor, uBGColor);
268
+ outColor.a = 1.0; // make opaque, masks out line under arrow
269
+ }
270
+ else if(vVertType == ${Ch} && vBorderWidth == vec2(0.0)) { // simple rectangle with no border
271
+ outColor = vColor; // unit square is already transformed to the rectangle, nothing else needs to be done
272
+ }
273
+ else if(vVertType == ${Ch} || vVertType == ${Eh}
274
+ || vVertType == ${wh} || vVertType == ${Th}) { // use SDF
275
+
276
+ float outerBorder = vBorderWidth[0];
277
+ float innerBorder = vBorderWidth[1];
278
+ float borderPadding = outerBorder * 2.0;
279
+ float w = vTopRight.x - vBotLeft.x - borderPadding;
280
+ float h = vTopRight.y - vBotLeft.y - borderPadding;
281
+ vec2 b = vec2(w/2.0, h/2.0); // half width, half height
282
+ vec2 p = vPosition - vec2(vTopRight.x - b[0] - outerBorder, vTopRight.y - b[1] - outerBorder); // translate to center
283
+
284
+ float d; // signed distance
285
+ if(vVertType == ${Ch}) {
286
+ d = rectangleSD(p, b);
287
+ } else if(vVertType == ${Eh} && w == h) {
288
+ d = circleSD(p, b.x); // faster than ellipse
289
+ } else if(vVertType == ${Eh}) {
290
+ d = ellipseSD(p, b);
291
+ } else {
292
+ d = roundRectangleSD(p, b, vCornerRadius.wzyx);
293
+ }
294
+
295
+ // use the distance to interpolate a color to smooth the edges of the shape, doesn't need multisampling
296
+ // we must smooth colors inwards, because we can't change pixels outside the shape's bounding box
297
+ if(d > 0.0) {
298
+ if(d > outerBorder) {
299
+ discard;
300
+ } else {
301
+ outColor = distInterp(vBorderColor, vec4(0), d - outerBorder);
302
+ }
303
+ } else {
304
+ if(d > innerBorder) {
305
+ vec4 outerColor = outerBorder == 0.0 ? vec4(0) : vBorderColor;
306
+ vec4 innerBorderColor = blend(vBorderColor, vColor);
307
+ outColor = distInterp(innerBorderColor, outerColor, d);
308
+ }
309
+ else {
310
+ vec4 outerColor;
311
+ if(innerBorder == 0.0 && outerBorder == 0.0) {
312
+ outerColor = vec4(0);
313
+ } else if(innerBorder == 0.0) {
314
+ outerColor = vBorderColor;
315
+ } else {
316
+ outerColor = blend(vBorderColor, vColor);
317
+ }
318
+ outColor = distInterp(vColor, outerColor, d - innerBorder);
319
+ }
320
+ }
321
+ }
322
+ else {
323
+ outColor = vColor;
324
+ }
325
+
326
+ ${e.picking?`if(outColor.a == 0.0) discard;
327
+ else outColor = vIndex;`:``}
328
+ }
329
+ `);i.aPosition=t.getAttribLocation(i,`aPosition`),i.aIndex=t.getAttribLocation(i,`aIndex`),i.aVertType=t.getAttribLocation(i,`aVertType`),i.aTransform=t.getAttribLocation(i,`aTransform`),i.aAtlasId=t.getAttribLocation(i,`aAtlasId`),i.aTex=t.getAttribLocation(i,`aTex`),i.aPointAPointB=t.getAttribLocation(i,`aPointAPointB`),i.aPointCPointD=t.getAttribLocation(i,`aPointCPointD`),i.aLineWidth=t.getAttribLocation(i,`aLineWidth`),i.aColor=t.getAttribLocation(i,`aColor`),i.aCornerRadius=t.getAttribLocation(i,`aCornerRadius`),i.aBorderColor=t.getAttribLocation(i,`aBorderColor`),i.uPanZoomMatrix=t.getUniformLocation(i,`uPanZoomMatrix`),i.uAtlasSize=t.getUniformLocation(i,`uAtlasSize`),i.uBGColor=t.getUniformLocation(i,`uBGColor`),i.uZoom=t.getUniformLocation(i,`uZoom`),i.uTextures=[];for(var a=0;a<this.batchManager.getMaxAtlasesPerBatch();a++)i.uTextures.push(t.getUniformLocation(i,`uTexture${a}`));return i}},{key:`_createVAO`,value:function(){var e=[0,0,1,0,1,1,0,0,1,1,0,1];this.vertexCount=e.length/2;var t=this.maxInstances,n=this.gl,r=this.program,i=n.createVertexArray();return n.bindVertexArray(i),Xm(n,`vec2`,r.aPosition,e),this.transformBuffer=Qm(n,t,r.aTransform),this.indexBuffer=Zm(n,t,`vec4`,r.aIndex),this.vertTypeBuffer=Zm(n,t,`int`,r.aVertType),this.atlasIdBuffer=Zm(n,t,`int`,r.aAtlasId),this.texBuffer=Zm(n,t,`vec4`,r.aTex),this.pointAPointBBuffer=Zm(n,t,`vec4`,r.aPointAPointB),this.pointCPointDBuffer=Zm(n,t,`vec4`,r.aPointCPointD),this.lineWidthBuffer=Zm(n,t,`vec2`,r.aLineWidth),this.colorBuffer=Zm(n,t,`vec4`,r.aColor),this.cornerRadiusBuffer=Zm(n,t,`vec4`,r.aCornerRadius),this.borderColorBuffer=Zm(n,t,`vec4`,r.aBorderColor),n.bindVertexArray(null),i}},{key:`buffers`,get:function(){var e=this;return this._buffers||=Object.keys(this).filter(function(e){return ye(e,`Buffer`)}).map(function(t){return e[t]}),this._buffers}},{key:`startFrame`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:_h.SCREEN;this.panZoomMatrix=e,this.renderTarget=t,this.batchDebugInfo=[],this.wrappedCount=0,this.simpleCount=0,this.startBatch()}},{key:`startBatch`,value:function(){this.instanceCount=0,this.batchManager.startBatch()}},{key:`endFrame`,value:function(){this.endBatch()}},{key:`_isVisible`,value:function(e,t){return e.visible()?t&&t.isVisible?t.isVisible(e):!0:!1}},{key:`drawTexture`,value:function(e,t,n){var r=this.atlasManager,i=this.batchManager,a=r.getRenderTypeOpts(n);if(this._isVisible(e,a)&&!(e.isEdge()&&!this._isValidEdge(e))){if(this.renderTarget.picking&&a.getTexPickingMode){var o=a.getTexPickingMode(e);if(o===vh.IGNORE)return;if(o==vh.USE_BB){this.drawPickingRectangle(e,t,n);return}}var s=E(r.getAtlasInfo(e,n)),c;try{for(s.s();!(c=s.n()).done;){var l=c.value,u=l.atlas,d=l.tex1,f=l.tex2;i.canAddToCurrentBatch(u)||this.endBatch();for(var p=i.getAtlasIndexForBatch(u),m=0,h=[[d,!0],[f,!1]];m<h.length;m++){var g=M(h[m],2),_=g[0],v=g[1];if(_.w!=0){var y=this.instanceCount;this.vertTypeBuffer.getView(y)[0]=yh,Wm(t,this.indexBuffer.getView(y));var b=this.atlasIdBuffer.getView(y);b[0]=p;var x=this.texBuffer.getView(y);x[0]=_.x,x[1]=_.y,x[2]=_.w,x[3]=_.h;var S=this.transformBuffer.getMatrixView(y);this.setTransformMatrix(e,S,a,l,v),this.instanceCount++,v||this.wrappedCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}catch(e){s.e(e)}finally{s.f()}}}},{key:`setTransformMatrix`,value:function(e,t,n,r){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,a=0;if(n.shapeProps&&n.shapeProps.padding&&(a=e.pstyle(n.shapeProps.padding).pfValue),r){var o=r.bb,s=r.tex1,c=r.tex2,l=s.w/(s.w+c.w);i||(l=1-l);var u=this._getAdjustedBB(o,a,i,l);this._applyTransformMatrix(t,u,n,e)}else{var d=n.getBoundingBox(e),f=this._getAdjustedBB(d,a,!0,1);this._applyTransformMatrix(t,f,n,e)}}},{key:`_applyTransformMatrix`,value:function(e,t,n,r){var i,a;nh(e);var o=n.getRotation?n.getRotation(r):0;if(o!==0){var s=n.getRotationPoint(r),c=s.x,l=s.y;ih(e,e,[c,l]),ah(e,e,o);var u=n.getRotationOffset(r);i=u.x+(t.xOffset||0),a=u.y+(t.yOffset||0)}else i=t.x1,a=t.y1;ih(e,e,[i,a]),oh(e,e,[t.w,t.h])}},{key:`_getAdjustedBB`,value:function(e,t,n,r){var i=e.x1,a=e.y1,o=e.w,s=e.h,c=e.yOffset;t&&(i-=t,a-=t,o+=2*t,s+=2*t);var l=0,u=o*r;return n&&r<1?o=u:!n&&r<1&&(l=o-u,i+=l,o=u),{x1:i,y1:a,w:o,h:s,xOffset:l,yOffset:c}}},{key:`drawPickingRectangle`,value:function(e,t,n){var r=this.atlasManager.getRenderTypeOpts(n),i=this.instanceCount;this.vertTypeBuffer.getView(i)[0]=Ch,Wm(t,this.indexBuffer.getView(i)),Um([0,0,0],1,this.colorBuffer.getView(i));var a=this.transformBuffer.getMatrixView(i);this.setTransformMatrix(e,a,r),this.simpleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}},{key:`drawNode`,value:function(e,t,n){var r=this.simpleShapeOptions.get(n);if(this._isVisible(e,r)){var i=r.shapeProps,a=this._getVertTypeForShape(e,i.shape);if(a===void 0||r.isSimple&&!r.isSimple(e,this.renderTarget)){this.drawTexture(e,t,n);return}var o=this.instanceCount;if(this.vertTypeBuffer.getView(o)[0]=a,a===wh||a===Th){var s=r.getBoundingBox(e),c=this._getCornerRadius(e,i.radius,s),l=this.cornerRadiusBuffer.getView(o);l[0]=c,l[1]=c,l[2]=c,l[3]=c,a===Th&&(l[0]=0,l[2]=0)}Wm(t,this.indexBuffer.getView(o));var u=this.renderTarget.picking?1:n===`node-body`?e.effectiveOpacity():1,d=this.renderTarget.picking?1:e.pstyle(i.opacity).value*u,f=e.pstyle(i.color).value;Um(f,d,this.colorBuffer.getView(o));var p=this.lineWidthBuffer.getView(o);if(p[0]=0,p[1]=0,i.border){var m=e.pstyle(`border-width`).value;if(m>0){var h=e.pstyle(`border-color`).value;Um(h,u*e.pstyle(`border-opacity`).value,this.borderColorBuffer.getView(o));var g=e.pstyle(`border-position`).value;if(g===`inside`)p[0]=0,p[1]=-m;else if(g===`outside`)p[0]=m,p[1]=0;else{var _=m/2;p[0]=_,p[1]=-_}}}var v=this.transformBuffer.getMatrixView(o);this.setTransformMatrix(e,v,r),this.simpleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}},{key:`_getVertTypeForShape`,value:function(e,t){switch(e.pstyle(t).value){case`rectangle`:return Ch;case`ellipse`:return Eh;case`roundrectangle`:case`round-rectangle`:return wh;case`bottom-round-rectangle`:return Th;default:return}}},{key:`_getCornerRadius`,value:function(e,t,n){var r=n.w,i=n.h;if(e.pstyle(t).value===`auto`)return $r(r,i);var a=e.pstyle(t).pfValue,o=r/2,s=i/2;return Math.min(a,s,o)}},{key:`drawEdgeArrow`,value:function(e,t,n){if(e.visible()){var r=e._private.rscratch,i,a,o;if(n===`source`?(i=r.arrowStartX,a=r.arrowStartY,o=r.srcArrowAngle):(i=r.arrowEndX,a=r.arrowEndY,o=r.tgtArrowAngle),!(isNaN(i)||i==null||isNaN(a)||a==null||isNaN(o)||o==null)&&e.pstyle(n+`-arrow-shape`).value!==`none`){var s=e.pstyle(n+`-arrow-color`).value,c=e.pstyle(`opacity`).value*e.pstyle(`line-opacity`).value,l=e.pstyle(`width`).pfValue,u=e.pstyle(`arrow-scale`).value,d=this.r.getArrowWidth(l,u),f=this.instanceCount,p=this.transformBuffer.getMatrixView(f);nh(p),ih(p,p,[i,a]),oh(p,p,[d,d]),ah(p,p,o),this.vertTypeBuffer.getView(f)[0]=Sh,Wm(t,this.indexBuffer.getView(f)),Um(s,c,this.colorBuffer.getView(f)),this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}},{key:`drawEdgeLine`,value:function(e,t){if(e.visible()){var n=this._getEdgePoints(e);if(n){var r=e.pstyle(`opacity`).value,i=e.pstyle(`line-opacity`).value,a=e.pstyle(`width`).pfValue,o=e.pstyle(`line-color`).value,s=r*i;if(n.length/2+this.instanceCount>this.maxInstances&&this.endBatch(),n.length==4){var c=this.instanceCount;this.vertTypeBuffer.getView(c)[0]=bh,Wm(t,this.indexBuffer.getView(c)),Um(o,s,this.colorBuffer.getView(c));var l=this.lineWidthBuffer.getView(c);l[0]=a;var u=this.pointAPointBBuffer.getView(c);u[0]=n[0],u[1]=n[1],u[2]=n[2],u[3]=n[3],this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}else for(var d=0;d<n.length-2;d+=2){var f=this.instanceCount;this.vertTypeBuffer.getView(f)[0]=xh,Wm(t,this.indexBuffer.getView(f)),Um(o,s,this.colorBuffer.getView(f));var p=this.lineWidthBuffer.getView(f);p[0]=a;var m=n[d-2],h=n[d-1],g=n[d],_=n[d+1],v=n[d+2],y=n[d+3],b=n[d+4],x=n[d+5];d==0&&(m=2*g-v+.001,h=2*_-y+.001),d==n.length-4&&(b=2*v-g+.001,x=2*y-_+.001);var S=this.pointAPointBBuffer.getView(f);S[0]=m,S[1]=h,S[2]=g,S[3]=_;var C=this.pointCPointDBuffer.getView(f);C[0]=v,C[1]=y,C[2]=b,C[3]=x,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}},{key:`_isValidEdge`,value:function(e){var t=e._private.rscratch;return!(t.badLine||t.allpts==null||isNaN(t.allpts[0]))}},{key:`_getEdgePoints`,value:function(e){var t=e._private.rscratch;if(this._isValidEdge(e)){var n=t.allpts;if(n.length==4)return n;var r=this._getNumSegments(e);return this._getCurveSegmentPoints(n,r)}}},{key:`_getNumSegments`,value:function(e){return Math.min(15,this.maxInstances)}},{key:`_getCurveSegmentPoints`,value:function(e,t){if(e.length==4)return e;for(var n=Array((t+1)*2),r=0;r<=t;r++)if(r==0)n[0]=e[0],n[1]=e[1];else if(r==t)n[r*2]=e[e.length-2],n[r*2+1]=e[e.length-1];else{var i=r/t;this._setCurvePoint(e,i,n,r*2)}return n}},{key:`_setCurvePoint`,value:function(e,t,n,r){if(e.length<=2)n[r]=e[0],n[r+1]=e[1];else{for(var i=Array(e.length-2),a=0;a<i.length;a+=2){var o=(1-t)*e[a]+t*e[a+2],s=(1-t)*e[a+1]+t*e[a+3];i[a]=o,i[a+1]=s}return this._setCurvePoint(i,t,n,r)}}},{key:`endBatch`,value:function(){var e=this.gl,t=this.vao,n=this.vertexCount,r=this.instanceCount;if(r!==0){var i=this.renderTarget.picking?this.pickingProgram:this.program;e.useProgram(i),e.bindVertexArray(t);var a=E(this.buffers),o;try{for(a.s();!(o=a.n()).done;)o.value.bufferSubData(r)}catch(e){a.e(e)}finally{a.f()}for(var s=this.batchManager.getAtlases(),c=0;c<s.length;c++)s[c].bufferIfNeeded(e);for(var l=0;l<s.length;l++)e.activeTexture(e.TEXTURE0+l),e.bindTexture(e.TEXTURE_2D,s[l].texture),e.uniform1i(i.uTextures[l],l);e.uniform1f(i.uZoom,zm(this.r)),e.uniformMatrix3fv(i.uPanZoomMatrix,!1,this.panZoomMatrix),e.uniform1i(i.uAtlasSize,this.batchManager.getAtlasSize());var u=Um(this.bgColor,1);e.uniform4fv(i.uBGColor,u),e.drawArraysInstanced(e.TRIANGLES,0,n,r),e.bindVertexArray(null),e.bindTexture(e.TEXTURE_2D,null),this.debug&&this.batchDebugInfo.push({count:r,atlasCount:s.length}),this.startBatch()}}},{key:`getDebugInfo`,value:function(){var e=this.atlasManager.getDebugInfo(),t=e.reduce(function(e,t){return e+t.atlasCount},0),n=this.batchDebugInfo,r=n.reduce(function(e,t){return e+t.count},0);return{atlasInfo:e,totalAtlases:t,wrappedCount:this.wrappedCount,simpleCount:this.simpleCount,batchCount:n.length,batchInfo:n,totalInstances:r}}}])}(),Oh={};Oh.initWebgl=function(e,t){var n=this,r=n.data.contexts[n.WEBGL];e.bgColor=kh(n),e.webglTexSize=Math.min(e.webglTexSize,r.getParameter(r.MAX_TEXTURE_SIZE)),e.webglTexRows=Math.min(e.webglTexRows,54),e.webglTexRowsNodes=Math.min(e.webglTexRowsNodes,54),e.webglBatchSize=Math.min(e.webglBatchSize,16384),e.webglTexPerBatch=Math.min(e.webglTexPerBatch,r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS)),n.webglDebug=e.webglDebug,n.webglDebugShowAtlases=e.webglDebugShowAtlases,n.pickingFrameBuffer=$m(r),n.pickingFrameBuffer.needsDraw=!0,n.drawing=new Dh(n,r,e);var i=function(e){return function(t){return n.getTextAngle(t,e)}},a=function(e){return function(t){var n=t.pstyle(e);return n&&n.value}},o=function(e){return function(t){return t.pstyle(`${e}-opacity`).value>0}},s=function(e){return e.pstyle(`text-events`).strValue===`yes`?vh.USE_BB:vh.IGNORE},c=function(e){var t=e.position(),n=t.x,r=t.y,i=e.outerWidth(),a=e.outerHeight();return{w:i,h:a,x1:n-i/2,y1:r-a/2}};n.drawing.addAtlasCollection(`node`,{texRows:e.webglTexRowsNodes}),n.drawing.addAtlasCollection(`label`,{texRows:e.webglTexRows}),n.drawing.addTextureAtlasRenderType(`node-body`,{collection:`node`,getKey:t.getStyleKey,getBoundingBox:t.getElementBox,drawElement:t.drawElement}),n.drawing.addSimpleShapeRenderType(`node-body`,{getBoundingBox:c,isSimple:Vm,shapeProps:{shape:`shape`,color:`background-color`,opacity:`background-opacity`,radius:`corner-radius`,border:!0}}),n.drawing.addSimpleShapeRenderType(`node-overlay`,{getBoundingBox:c,isVisible:o(`overlay`),shapeProps:{shape:`overlay-shape`,color:`overlay-color`,opacity:`overlay-opacity`,padding:`overlay-padding`,radius:`overlay-corner-radius`}}),n.drawing.addSimpleShapeRenderType(`node-underlay`,{getBoundingBox:c,isVisible:o(`underlay`),shapeProps:{shape:`underlay-shape`,color:`underlay-color`,opacity:`underlay-opacity`,padding:`underlay-padding`,radius:`underlay-corner-radius`}}),n.drawing.addTextureAtlasRenderType(`label`,{collection:`label`,getTexPickingMode:s,getKey:jh(t.getLabelKey,null),getBoundingBox:Mh(t.getLabelBox,null),drawClipped:!0,drawElement:t.drawLabel,getRotation:i(null),getRotationPoint:t.getLabelRotationPoint,getRotationOffset:t.getLabelRotationOffset,isVisible:a(`label`)}),n.drawing.addTextureAtlasRenderType(`edge-source-label`,{collection:`label`,getTexPickingMode:s,getKey:jh(t.getSourceLabelKey,`source`),getBoundingBox:Mh(t.getSourceLabelBox,`source`),drawClipped:!0,drawElement:t.drawSourceLabel,getRotation:i(`source`),getRotationPoint:t.getSourceLabelRotationPoint,getRotationOffset:t.getSourceLabelRotationOffset,isVisible:a(`source-label`)}),n.drawing.addTextureAtlasRenderType(`edge-target-label`,{collection:`label`,getTexPickingMode:s,getKey:jh(t.getTargetLabelKey,`target`),getBoundingBox:Mh(t.getTargetLabelBox,`target`),drawClipped:!0,drawElement:t.drawTargetLabel,getRotation:i(`target`),getRotationPoint:t.getTargetLabelRotationPoint,getRotationOffset:t.getTargetLabelRotationOffset,isVisible:a(`target-label`)});var l=Dt(function(){console.log(`garbage collect flag set`),n.data.gc=!0},1e4);n.onUpdateEleCalcs(function(e,t){var r=!1;t&&t.length>0&&(r|=n.drawing.invalidate(t)),r&&l()}),Nh(n)};function kh(e){var t=e.cy.container();return Ne(t&&t.style&&t.style.backgroundColor||`white`)}function Ah(e,t){var n=e._private.rscratch;return _n(n,`labelWrapCachedLines`,t)||[]}var jh=function(e,t){return function(n){var r=e(n),i=Ah(n,t);return i.length>1?i.map(function(e,t){return`${r}_${t}`}):r}},Mh=function(e,t){return function(n,r){var i=e(n);if(typeof r==`string`){var a=r.indexOf(`_`);if(a>0){var o=Number(r.substring(a+1)),s=Ah(n,t),c=i.h/s.length,l=c*o,u=i.y1+l;return{x1:i.x1,w:i.w,y1:u,h:c,yOffset:l}}}return i}};function Nh(e){var t=e.render;e.render=function(n){n||={};var r=e.cy;e.webgl&&(r.zoom()>Dp?(Ph(e),t.call(e,n)):(Fh(e),Wh(e,n,_h.SCREEN)))};var n=e.matchCanvasSize;e.matchCanvasSize=function(t){n.call(e,t),e.pickingFrameBuffer.setFramebufferAttachmentSizes(e.canvasWidth,e.canvasHeight),e.pickingFrameBuffer.needsDraw=!0},e.findNearestElements=function(t,n,r,i){return Hh(e,t,n)};var r=e.invalidateCachedZSortedEles;e.invalidateCachedZSortedEles=function(){r.call(e),e.pickingFrameBuffer.needsDraw=!0};var i=e.notify;e.notify=function(t,n){i.call(e,t,n),t===`viewport`||t===`bounds`?e.pickingFrameBuffer.needsDraw=!0:t===`background`&&e.drawing.invalidate(n,{type:`node-body`})}}function Ph(e){var t=e.data.contexts[e.WEBGL];t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT)}function Fh(e){var t=function(t){t.save(),t.setTransform(1,0,0,1,0,0),t.clearRect(0,0,e.canvasWidth,e.canvasHeight),t.restore()};t(e.data.contexts[e.NODE]),t(e.data.contexts[e.DRAG])}function Ih(e){var t=e.canvasWidth,n=e.canvasHeight,r=Rm(e),i=r.pan,a=r.zoom,o=th();ih(o,o,[i.x,i.y]),oh(o,o,[a,a]);var s=th();sh(s,t,n);var c=th();return rh(c,s,o),c}function Lh(e,t){var n=e.canvasWidth,r=e.canvasHeight,i=Rm(e),a=i.pan,o=i.zoom;t.setTransform(1,0,0,1,0,0),t.clearRect(0,0,n,r),t.translate(a.x,a.y),t.scale(o,o)}function Rh(e,t){e.drawSelectionRectangle(t,function(t){return Lh(e,t)})}function zh(e){var t=e.data.contexts[e.NODE];t.save(),Lh(e,t),t.strokeStyle=`rgba(0, 0, 0, 0.3)`,t.beginPath(),t.moveTo(-1e3,0),t.lineTo(1e3,0),t.stroke(),t.beginPath(),t.moveTo(0,-1e3),t.lineTo(0,1e3),t.stroke(),t.restore()}function Bh(e){var t=function(t,n,r){for(var i=t.atlasManager.getAtlasCollection(n),a=e.data.contexts[e.NODE],o=i.atlases,s=0;s<o.length;s++){var c=o[s].canvas;if(c){var l=c.width,u=c.height,d=l*s,f=c.height*r,p=.4;a.save(),a.scale(p,p),a.drawImage(c,d,f),a.strokeStyle=`black`,a.rect(d,f,l,u),a.stroke(),a.restore()}}},n=0;t(e.drawing,`node`,n++),t(e.drawing,`label`,n++)}function Vh(e,t,n,r,i){var a,o,s,c,l=Rm(e),u=l.pan,d=l.zoom,f=M(Bm(e,u,d,t,n),2),p=f[0],m=f[1],h=6;if(a=p-h/2,o=m-h/2,s=h,c=h,s===0||c===0)return[];var g=e.data.contexts[e.WEBGL];g.bindFramebuffer(g.FRAMEBUFFER,e.pickingFrameBuffer),e.pickingFrameBuffer.needsDraw&&(g.viewport(0,0,g.canvas.width,g.canvas.height),Wh(e,null,_h.PICKING),e.pickingFrameBuffer.needsDraw=!1);var _=s*c,v=new Uint8Array(_*4);g.readPixels(a,o,s,c,g.RGBA,g.UNSIGNED_BYTE,v),g.bindFramebuffer(g.FRAMEBUFFER,null);for(var y=new Set,b=0;b<_;b++){var x=Gm(v.slice(b*4,b*4+4))-1;x>=0&&y.add(x)}return y}function Hh(e,t,n){var r=Vh(e,t,n),i=e.getCachedZSortedEles(),a,o,s=E(r),c;try{for(s.s();!(c=s.n()).done;){var l=i[c.value];if(!a&&l.isNode()&&(a=l),!o&&l.isEdge()&&(o=l),a&&o)break}}catch(e){s.e(e)}finally{s.f()}return[a,o].filter(Boolean)}function Uh(e,t,n){var r=e.drawing;t+=1,n.isNode()?(r.drawNode(n,t,`node-underlay`),r.drawNode(n,t,`node-body`),r.drawTexture(n,t,`label`),r.drawNode(n,t,`node-overlay`)):(r.drawEdgeLine(n,t),r.drawEdgeArrow(n,t,`source`),r.drawEdgeArrow(n,t,`target`),r.drawTexture(n,t,`label`),r.drawTexture(n,t,`edge-source-label`),r.drawTexture(n,t,`edge-target-label`))}function Wh(e,t,n){var r;e.webglDebug&&(r=performance.now());var i=e.drawing,a=0;if(n.screen&&e.data.canvasNeedsRedraw[e.SELECT_BOX]&&Rh(e,t),e.data.canvasNeedsRedraw[e.NODE]||n.picking){var o=e.data.contexts[e.WEBGL];n.screen?(o.clearColor(0,0,0,0),o.enable(o.BLEND),o.blendFunc(o.ONE,o.ONE_MINUS_SRC_ALPHA)):o.disable(o.BLEND),o.clear(o.COLOR_BUFFER_BIT|o.DEPTH_BUFFER_BIT),o.viewport(0,0,o.canvas.width,o.canvas.height);var s=Ih(e),c=e.getCachedZSortedEles();if(a=c.length,i.startFrame(s,n),n.screen){for(var l=0;l<c.nondrag.length;l++)Uh(e,l,c.nondrag[l]);for(var u=0;u<c.drag.length;u++)Uh(e,u,c.drag[u])}else if(n.picking)for(var d=0;d<c.length;d++)Uh(e,d,c[d]);i.endFrame(),n.screen&&e.webglDebugShowAtlases&&(zh(e),Bh(e)),e.data.canvasNeedsRedraw[e.NODE]=!1,e.data.canvasNeedsRedraw[e.DRAG]=!1}if(e.webglDebug){var f=performance.now(),p=Math.ceil(f-r),m=i.getDebugInfo(),h=[`${a} elements`,`${m.totalInstances} instances`,`${m.batchCount} batches`,`${m.totalAtlases} atlases`,`${m.wrappedCount} wrapped textures`,`${m.simpleCount} simple shapes`].join(`, `);console.log(`WebGL (${n.name}) - frame time ${p}ms`),console.log(`Totals:`),console.log(` ${h}`),console.log(`Texture Atlases Used:`);var g=m.atlasInfo,_=E(g),v;try{for(_.s();!(v=_.n()).done;){var y=v.value;console.log(` ${y.type}: ${y.keyCount} keys, ${y.atlasCount} atlases`)}}catch(e){_.e(e)}finally{_.f()}console.log(``)}e.data.gc&&(console.log(`Garbage Collect!`),e.data.gc=!1,i.gc())}var Gh={};Gh.drawPolygonPath=function(e,t,n,r,i,a){var o=r/2,s=i/2;e.beginPath&&e.beginPath(),e.moveTo(t+o*a[0],n+s*a[1]);for(var c=1;c<a.length/2;c++)e.lineTo(t+o*a[c*2],n+s*a[c*2+1]);e.closePath()},Gh.drawRoundPolygonPath=function(e,t,n,r,i,a,o){o.forEach(function(t){return Gf(e,t)}),e.closePath()},Gh.drawRoundRectanglePath=function(e,t,n,r,i,a){var o=r/2,s=i/2,c=a===`auto`?$r(r,i):Math.min(a,s,o);e.beginPath&&e.beginPath(),e.moveTo(t,n-s),e.arcTo(t+o,n-s,t+o,n,c),e.arcTo(t+o,n+s,t,n+s,c),e.arcTo(t-o,n+s,t-o,n,c),e.arcTo(t-o,n-s,t,n-s,c),e.lineTo(t,n-s),e.closePath()},Gh.drawBottomRoundRectanglePath=function(e,t,n,r,i,a){var o=r/2,s=i/2,c=a===`auto`?$r(r,i):a;e.beginPath&&e.beginPath(),e.moveTo(t,n-s),e.lineTo(t+o,n-s),e.lineTo(t+o,n),e.arcTo(t+o,n+s,t,n+s,c),e.arcTo(t-o,n+s,t-o,n,c),e.lineTo(t-o,n-s),e.lineTo(t,n-s),e.closePath()},Gh.drawCutRectanglePath=function(e,t,n,r,i,a,o){var s=r/2,c=i/2,l=o===`auto`?ti():o;e.beginPath&&e.beginPath(),e.moveTo(t-s+l,n-c),e.lineTo(t+s-l,n-c),e.lineTo(t+s,n-c+l),e.lineTo(t+s,n+c-l),e.lineTo(t+s-l,n+c),e.lineTo(t-s+l,n+c),e.lineTo(t-s,n+c-l),e.lineTo(t-s,n-c+l),e.closePath()},Gh.drawBarrelPath=function(e,t,n,r,i){var a=r/2,o=i/2,s=t-a,c=t+a,l=n-o,u=n+o,d=ri(r,i),f=d.widthOffset,p=d.heightOffset,m=d.ctrlPtOffsetPct*f;e.beginPath&&e.beginPath(),e.moveTo(s,l+p),e.lineTo(s,u-p),e.quadraticCurveTo(s+m,u,s+f,u),e.lineTo(c-f,u),e.quadraticCurveTo(c-m,u,c,u-p),e.lineTo(c,l+p),e.quadraticCurveTo(c-m,l,c-f,l),e.lineTo(s+f,l),e.quadraticCurveTo(s+m,l,s,l+p),e.closePath()};for(var Kh=Math.sin(0),qh=Math.cos(0),Jh={},Yh={},Xh=Math.PI/40,Zh=0*Math.PI;Zh<2*Math.PI;Zh+=Xh)Jh[Zh]=Math.sin(Zh),Yh[Zh]=Math.cos(Zh);Gh.drawEllipsePath=function(e,t,n,r,i){if(e.beginPath&&e.beginPath(),e.ellipse)e.ellipse(t,n,r/2,i/2,0,0,2*Math.PI);else for(var a,o,s=r/2,c=i/2,l=0*Math.PI;l<2*Math.PI;l+=Xh)a=t-s*Jh[l]*Kh+s*Yh[l]*qh,o=n+c*Yh[l]*Kh+c*Jh[l]*qh,l===0?e.moveTo(a,o):e.lineTo(a,o);e.closePath()};var Qh={};Qh.createBuffer=function(e,t){var n=document.createElement(`canvas`);return n.width=e,n.height=t,[n,n.getContext(`2d`)]},Qh.bufferCanvasImage=function(e){var t=this.cy,n=t.mutableElements().boundingBox(),r=this.findContainerClientCoords(),i=e.full?Math.ceil(n.w):r[2],a=e.full?Math.ceil(n.h):r[3],o=Y(e.maxWidth)||Y(e.maxHeight),s=this.getPixelRatio(),c=1;if(e.scale!==void 0)i*=e.scale,a*=e.scale,c=e.scale;else if(o){var l=1/0,u=1/0;Y(e.maxWidth)&&(l=c*e.maxWidth/i),Y(e.maxHeight)&&(u=c*e.maxHeight/a),c=Math.min(l,u),i*=c,a*=c}o||(i*=s,a*=s,c*=s);var d=document.createElement(`canvas`);d.width=i,d.height=a,d.style.width=i+`px`,d.style.height=a+`px`;var f=d.getContext(`2d`);if(i>0&&a>0){f.clearRect(0,0,i,a),f.globalCompositeOperation=`source-over`;var p=this.getCachedZSortedEles();if(e.full)f.translate(-n.x1*c,-n.y1*c),f.scale(c,c),this.drawElements(f,p),f.scale(1/c,1/c),f.translate(n.x1*c,n.y1*c);else{var m=t.pan(),h={x:m.x*c,y:m.y*c};c*=t.zoom(),f.translate(h.x,h.y),f.scale(c,c),this.drawElements(f,p),f.scale(1/c,1/c),f.translate(-h.x,-h.y)}e.bg&&(f.globalCompositeOperation=`destination-over`,f.fillStyle=e.bg,f.rect(0,0,i,a),f.fill())}return d};function $h(e,t){for(var n=atob(e),r=new ArrayBuffer(n.length),i=new Uint8Array(r),a=0;a<n.length;a++)i[a]=n.charCodeAt(a);return new Blob([r],{type:t})}function eg(e){var t=e.indexOf(`,`);return e.substr(t+1)}function tg(e,t,n){var r=function(){return t.toDataURL(n,e.quality)};switch(e.output){case`blob-promise`:return new Pa(function(r,i){try{t.toBlob(function(e){e==null?i(Error("`canvas.toBlob()` sent a null value in its callback")):r(e)},n,e.quality)}catch(e){i(e)}});case`blob`:return $h(eg(r()),n);case`base64`:return eg(r());default:return r()}}Qh.png=function(e){return tg(e,this.bufferCanvasImage(e),`image/png`)},Qh.jpg=function(e){return tg(e,this.bufferCanvasImage(e),`image/jpeg`)};var ng={};ng.nodeShapeImpl=function(e,t,n,r,i,a,o,s){switch(e){case`ellipse`:return this.drawEllipsePath(t,n,r,i,a);case`polygon`:return this.drawPolygonPath(t,n,r,i,a,o);case`round-polygon`:return this.drawRoundPolygonPath(t,n,r,i,a,o,s);case`roundrectangle`:case`round-rectangle`:return this.drawRoundRectanglePath(t,n,r,i,a,s);case`cutrectangle`:case`cut-rectangle`:return this.drawCutRectanglePath(t,n,r,i,a,o,s);case`bottomroundrectangle`:case`bottom-round-rectangle`:return this.drawBottomRoundRectanglePath(t,n,r,i,a,s);case`barrel`:return this.drawBarrelPath(t,n,r,i,a)}};var rg=ag,ig=ag.prototype;ig.CANVAS_LAYERS=3,ig.SELECT_BOX=0,ig.DRAG=1,ig.NODE=2,ig.WEBGL=3,ig.CANVAS_TYPES=[`2d`,`2d`,`2d`,`webgl2`],ig.BUFFER_COUNT=3,ig.TEXTURE_BUFFER=0,ig.MOTIONBLUR_BUFFER_NODE=1,ig.MOTIONBLUR_BUFFER_DRAG=2;function ag(e){var t=this,n=t.cy.window().document;e.webgl&&(ig.CANVAS_LAYERS=t.CANVAS_LAYERS=4,console.log(`webgl rendering enabled`)),t.data={canvases:Array(ig.CANVAS_LAYERS),contexts:Array(ig.CANVAS_LAYERS),canvasNeedsRedraw:Array(ig.CANVAS_LAYERS),bufferCanvases:Array(ig.BUFFER_COUNT),bufferContexts:Array(ig.CANVAS_LAYERS)};var r=`-webkit-tap-highlight-color`,i=`rgba(0,0,0,0)`;t.data.canvasContainer=n.createElement(`div`);var a=t.data.canvasContainer.style;t.data.canvasContainer.style[r]=i,a.position=`relative`,a.zIndex=`0`,a.overflow=`hidden`;var o=e.cy.container();o.appendChild(t.data.canvasContainer),o.style[r]=i;var s={"-webkit-user-select":`none`,"-moz-user-select":`-moz-none`,"user-select":`none`,"-webkit-tap-highlight-color":`rgba(0,0,0,0)`,"outline-style":`none`};pe()&&(s[`-ms-touch-action`]=`none`,s[`touch-action`]=`none`);for(var c=0;c<ig.CANVAS_LAYERS;c++){var l=t.data.canvases[c]=n.createElement(`canvas`),u=ig.CANVAS_TYPES[c];t.data.contexts[c]=l.getContext(u),t.data.contexts[c]||rn(`Could not create canvas of type `+u),Object.keys(s).forEach(function(e){l.style[e]=s[e]}),l.style.position=`absolute`,l.setAttribute(`data-id`,`layer`+c),l.style.zIndex=String(ig.CANVAS_LAYERS-c),t.data.canvasContainer.appendChild(l),t.data.canvasNeedsRedraw[c]=!1}t.data.topCanvas=t.data.canvases[0],t.data.canvases[ig.NODE].setAttribute(`data-id`,`layer`+ig.NODE+`-node`),t.data.canvases[ig.SELECT_BOX].setAttribute(`data-id`,`layer`+ig.SELECT_BOX+`-selectbox`),t.data.canvases[ig.DRAG].setAttribute(`data-id`,`layer`+ig.DRAG+`-drag`),t.data.canvases[ig.WEBGL]&&t.data.canvases[ig.WEBGL].setAttribute(`data-id`,`layer`+ig.WEBGL+`-webgl`);for(var c=0;c<ig.BUFFER_COUNT;c++)t.data.bufferCanvases[c]=n.createElement(`canvas`),t.data.bufferContexts[c]=t.data.bufferCanvases[c].getContext(`2d`),t.data.bufferCanvases[c].style.position=`absolute`,t.data.bufferCanvases[c].setAttribute(`data-id`,`buffer`+c),t.data.bufferCanvases[c].style.zIndex=String(-c-1),t.data.bufferCanvases[c].style.visibility=`hidden`;t.pathsEnabled=!0;var d=mr(),f=function(e){return{x:(e.x1+e.x2)/2,y:(e.y1+e.y2)/2}},p=function(e){return{x:-e.w/2,y:-e.h/2}},m=function(e){var t=e[0]._private;return t.oldBackgroundTimestamp!==t.backgroundTimestamp},h=function(e){return e[0]._private.nodeKey},g=function(e){return e[0]._private.labelStyleKey},_=function(e){return e[0]._private.sourceLabelStyleKey},v=function(e){return e[0]._private.targetLabelStyleKey},y=function(e,n,r,i,a){return t.drawElement(e,n,r,!1,!1,a)},b=function(e,n,r,i,a){return t.drawElementText(e,n,r,i,`main`,a)},x=function(e,n,r,i,a){return t.drawElementText(e,n,r,i,`source`,a)},S=function(e,n,r,i,a){return t.drawElementText(e,n,r,i,`target`,a)},C=function(e){return e.boundingBox(),e[0]._private.bodyBounds},w=function(e){return e.boundingBox(),e[0]._private.labelBounds.main||d},T=function(e){return e.boundingBox(),e[0]._private.labelBounds.source||d},E=function(e){return e.boundingBox(),e[0]._private.labelBounds.target||d},D=function(e,t){return t},O=function(e){return f(C(e))},k=function(e,t,n){var r=e?e+`-`:``;return{x:t.x+n.pstyle(r+`text-margin-x`).pfValue,y:t.y+n.pstyle(r+`text-margin-y`).pfValue}},A=function(e,t,n){var r=e[0]._private.rscratch;return{x:r[t],y:r[n]}},j=function(e){return k(``,A(e,`labelX`,`labelY`),e)},M=function(e){return k(`source`,A(e,`sourceLabelX`,`sourceLabelY`),e)},N=function(e){return k(`target`,A(e,`targetLabelX`,`targetLabelY`),e)},P=function(e){return p(C(e))},F=function(e){return p(T(e))},I=function(e){return p(E(e))},L=function(e){var t=w(e),n=p(w(e));if(e.isNode()){switch(wl(e.pstyle(`text-halign`).value)){case`left`:n.x=-t.w-(t.leftPad||0);break;case`right`:n.x=-(t.rightPad||0)}switch(Tl(e.pstyle(`text-valign`).value)){case`top`:n.y=-t.h-(t.topPad||0);break;case`bottom`:n.y=-(t.botPad||0)}}return n},R=t.data.eleTxrCache=new Up(t,{getKey:h,doesEleInvalidateKey:m,drawElement:y,getBoundingBox:C,getRotationPoint:O,getRotationOffset:P,allowEdgeTxrCaching:!1,allowParentTxrCaching:!1}),ee=t.data.lblTxrCache=new Up(t,{getKey:g,drawElement:b,getBoundingBox:w,getRotationPoint:j,getRotationOffset:L,isVisible:D}),z=t.data.slbTxrCache=new Up(t,{getKey:_,drawElement:x,getBoundingBox:T,getRotationPoint:M,getRotationOffset:F,isVisible:D}),B=t.data.tlbTxrCache=new Up(t,{getKey:v,drawElement:S,getBoundingBox:E,getRotationPoint:N,getRotationOffset:I,isVisible:D}),V=t.data.lyrTxrCache=new om(t);t.onUpdateEleCalcs(function(e,t){R.invalidateElements(t),ee.invalidateElements(t),z.invalidateElements(t),B.invalidateElements(t),V.invalidateElements(t);for(var n=0;n<t.length;n++){var r=t[n]._private;r.oldBackgroundTimestamp=r.backgroundTimestamp}});var H=function(e){for(var t=0;t<e.length;t++)V.enqueueElementRefinement(e[t].ele)};R.onDequeue(H),ee.onDequeue(H),z.onDequeue(H),B.onDequeue(H),e.webgl&&t.initWebgl(e,{getStyleKey:h,getLabelKey:g,getSourceLabelKey:_,getTargetLabelKey:v,drawElement:y,drawLabel:b,drawSourceLabel:x,drawTargetLabel:S,getElementBox:C,getLabelBox:w,getSourceLabelBox:T,getTargetLabelBox:E,getElementRotationPoint:O,getElementRotationOffset:P,getLabelRotationPoint:j,getSourceLabelRotationPoint:M,getTargetLabelRotationPoint:N,getLabelRotationOffset:L,getSourceLabelRotationOffset:F,getTargetLabelRotationOffset:I})}ig.redrawHint=function(e,t){var n=this;switch(e){case`eles`:n.data.canvasNeedsRedraw[ig.NODE]=t;break;case`drag`:n.data.canvasNeedsRedraw[ig.DRAG]=t;break;case`select`:n.data.canvasNeedsRedraw[ig.SELECT_BOX]=t;break;case`gc`:n.data.gc=!0}};var og=typeof Path2D<`u`;ig.path2dEnabled=function(e){if(e===void 0)return this.pathsEnabled;this.pathsEnabled=!!e},ig.usePaths=function(){return og&&this.pathsEnabled},ig.setImgSmoothing=function(e,t){e.imageSmoothingEnabled==null?(e.webkitImageSmoothingEnabled=t,e.mozImageSmoothingEnabled=t,e.msImageSmoothingEnabled=t):e.imageSmoothingEnabled=t},ig.getImgSmoothing=function(e){return e.imageSmoothingEnabled==null?e.webkitImageSmoothingEnabled||e.mozImageSmoothingEnabled||e.msImageSmoothingEnabled:e.imageSmoothingEnabled},ig.makeOffscreenCanvas=function(e,t){var n;return(typeof OffscreenCanvas>`u`?`undefined`:I(OffscreenCanvas))===`undefined`?(n=this.cy.window().document.createElement(`canvas`),n.width=e,n.height=t):n=new OffscreenCanvas(e,t),n},[um,_m,wm,Em,Dm,Am,Mm,Oh,Gh,Qh,ng].forEach(function(e){X(ig,e)});var sg=[{type:`layout`,extensions:gf},{type:`renderer`,extensions:[{name:`null`,impl:_f},{name:`base`,impl:vp},{name:`canvas`,impl:rg}]}],cg={},lg={};function ug(e,t,n){var r=n,i=function(n){on("Can not register `"+t+"` for `"+e+"` since `"+n+"` already exists in the prototype and can not be overridden")};if(e===`core`){if(Dd.prototype[t])return i(t);Dd.prototype[t]=n}else if(e===`collection`){if(Hu.prototype[t])return i(t);Hu.prototype[t]=n}else if(e===`layout`){for(var a=function(e){this.options=e,n.call(this,e),q(this._private)||(this._private={}),this._private.cy=e.cy,this._private.listeners=[],this.createEmitter()},o=a.prototype=Object.create(n.prototype),s=[],c=0;c<s.length;c++){var l=s[c];o[l]=o[l]||function(){return this}}o.start&&!o.run?o.run=function(){return this.start(),this}:!o.start&&o.run&&(o.start=function(){return this.run(),this});var u=n.prototype.stop;o.stop=function(){var e=this.options;if(e&&e.animate){var t=this.animations;if(t)for(var n=0;n<t.length;n++)t[n].stop()}return u?u.call(this):this.emit(`layoutstop`),this},o.destroy||=function(){return this},o.cy=function(){return this._private.cy};var d=function(e){return e._private.cy},f={addEventFields:function(e,t){t.layout=e,t.cy=d(e),t.target=e},bubble:function(){return!0},parent:function(e){return d(e)}};X(o,{createEmitter:function(){return this._private.emitter=new uu(f,this),this},emitter:function(){return this._private.emitter},on:function(e,t){return this.emitter().on(e,t),this},one:function(e,t){return this.emitter().one(e,t),this},once:function(e,t){return this.emitter().one(e,t),this},removeListener:function(e,t){return this.emitter().removeListener(e,t),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},emit:function(e,t){return this.emitter().emit(e,t),this}}),Fc.eventAliasesOn(o),r=a}else if(e===`renderer`&&t!==`null`&&t!==`base`){var p=dg(`renderer`,`base`),m=p.prototype,h=n,g=n.prototype,_=function(){p.apply(this,arguments),h.apply(this,arguments)},v=_.prototype;for(var y in m){var b=m[y];if(g[y]!=null)return i(y);v[y]=b}for(var x in g)v[x]=g[x];m.clientFunctions.forEach(function(e){v[e]=v[e]||function(){rn("Renderer does not implement `renderer."+e+"()` on its prototype")}}),r=_}else if(e===`__proto__`||e===`constructor`||e===`prototype`)return rn(e+` is an illegal type to be registered, possibly lead to prototype pollutions`);return Fe({map:cg,keys:[e,t],value:r})}function dg(e,t){return Ie({map:cg,keys:[e,t]})}function fg(e,t,n,r,i){return Fe({map:lg,keys:[e,t,n,r],value:i})}function pg(e,t,n,r){return Ie({map:lg,keys:[e,t,n,r]})}var mg=function(){if(arguments.length===2)return dg.apply(null,arguments);if(arguments.length===3)return ug.apply(null,arguments);if(arguments.length===4)return pg.apply(null,arguments);if(arguments.length===5)return fg.apply(null,arguments);rn(`Invalid extension access syntax`)};Dd.prototype.extension=mg,sg.forEach(function(e){e.extensions.forEach(function(t){ug(e.type,t.name,t.impl)})});var hg=function(){if(!(this instanceof hg))return new hg;this.length=0},gg=hg.prototype;gg.instanceString=function(){return`stylesheet`},gg.selector=function(e){var t=this.length++;return this[t]={selector:e,properties:[]},this},gg.css=function(e,t){var n=this.length-1;if(W(e))this[n].properties.push({name:e,value:t});else if(q(e))for(var r=e,i=Object.keys(r),a=0;a<i.length;a++){var o=i[a],s=r[o];if(s!=null){var c=xd.properties[o]||xd.properties[ge(o)];if(c!=null){var l=c.name,u=s;this[n].properties.push({name:l,value:u})}}}return this},gg.style=gg.css,gg.generateStyle=function(e){var t=new xd(e);return this.appendToStyle(t)},gg.appendToStyle=function(e){for(var t=0;t<this.length;t++){var n=this[t],r=n.selector,i=n.properties;e.selector(r);for(var a=0;a<i.length;a++){var o=i[a];e.css(o.name,o.value)}}return e};var _g=`3.34.2`,vg=function(e){if(e===void 0&&(e={}),q(e))return new Dd(e);if(W(e))return mg.apply(mg,arguments)};vg.use=function(e){var t=Array.prototype.slice.call(arguments,1);return t.unshift(vg),e.apply(null,t),this},vg.warnings=function(e){return an(e)},vg.version=_g,vg.stylesheet=vg.Stylesheet=hg;function yg(e,t,n){let r=(e,t)=>{let r=new Set,i=n.get(e);for(;i!==void 0&&!r.has(i);){if(i===t)return!0;r.add(i),i=n.get(i)}return!1};return r(e,t)||r(t,e)}var bg=`yarramate/core@0.1#composition`,xg=`yarramate/core@0.1#assignment`,Sg={composition:bg,assignment:xg},Cg=new Set([`constraint`]),wg=`none`,Tg=(e,t)=>!t(e.to).endsWith(`Service`)||t(e.from).endsWith(`Interface`);function Eg(e,t,n){let r=new Map(t.map((e,t)=>[Sg[e],t])),i=e.filter(e=>r.has(e.kind)&&(e.kind!==xg||Tg(e,n))),a=new Map;for(let e of i){let t=a.get(e.to);t===void 0?a.set(e.to,[e]):t.push(e)}let o=new Map,s=[];for(let[e,t]of a){let n=Math.min(...t.map(e=>r.get(e.kind))),i=t.filter(e=>r.get(e.kind)===n);new Set(i.map(e=>e.from)).size===1?o.set(e,i[0].from):s.push({child:e,claims:i.map(e=>({edgeId:e.id,kind:e.kind,from:e.from}))})}let c=Og(o),l=new Set;for(let e of i)o.get(e.to)===e.from&&l.add(e.id);return{parentOf:o,consumedEdgeIds:l,conflicts:s,cycleMembers:c}}var Dg=(e,t,n)=>{let r=new Set([e]),i=n.get(e);for(;i!==void 0&&!r.has(i);){if(i===t)return!0;r.add(i),i=n.get(i)}return!1};function Og(e){let t=new Set;for(let n of e.keys()){let r=[],i=new Map,a=n;for(;a!==void 0;){let n=i.get(a);if(n!==void 0){for(let e of r.slice(n))t.add(e);break}i.set(a,r.length),r.push(a),a=e.get(a)}}for(let n of t)e.delete(n);return[...t]}var kg=(e,t)=>{let n=e=>{let n=[],r=new Set,i=e;for(;i!==void 0&&!r.has(i);)r.add(i),n.push(i),i=t.get(i);return n},[r,...i]=e;if(r===void 0)return;let a=i.map(e=>new Set(n(e)));return n(r).find(e=>a.every(t=>t.has(e)))};function Ag(e){let t=new Map(e.nodes.map(e=>[e.id,e.coreKind])),n=e=>t.get(e)??``,r=Eg(e.edges,e.nesting,n),i=new Map;for(let t of e.memberships){let e=i.get(t.member);e===void 0?i.set(t.member,new Set([t.instance])):e.add(t.instance)}let a=new Set;for(let t of e.memberships)t.wiring!==`context`&&a.add(t.member);let o=new Map(r.parentOf),s=[...new Set(e.memberships.map(({member:e})=>e).filter(e=>!o.has(e)&&a.has(e)&&!Cg.has(n(e))&&t.has(e)&&i.get(e)?.has(e)!==!0))];for(;s.length>0;){let e=[],t=!1;for(let n of s){let r=[...i.get(n)??[]];if(r.some(e=>s.includes(e)&&e!==n)){e.push(n);continue}t=!0;let a=r.length===1?r[0]:kg(r,o);a!==void 0&&a!==n&&(r.some(e=>Dg(e,n,o))||o.set(n,a))}if(!t)break;s=e}let c=[...r.cycleMembers,...Og(o)];return{parentOf:o,consumedEdgeIds:r.consumedEdgeIds,conflicts:r.conflicts,cycleMembers:c}}var jg=(e,t,n)=>`lift:${e}|${t}|${n}`,Mg=(e,t,n)=>{let r=e,i=t.get(e),a=new Set([e]);for(;i!==void 0&&!a.has(i);)a.add(i),n.has(i)&&(r=i),i=t.get(i);return r};function Ng(e,t,n){let r=new Map;for(let i of e.nodes)r.set(i.id,Mg(i.id,t.parentOf,n));let i=new Map;for(let t of e.nodes){let e=r.get(t.id);if(e===t.id)continue;let n=i.get(e);n===void 0?i.set(e,[t.id]):n.push(t.id)}let a=e.nodes.filter(e=>r.get(e.id)===e.id).map(e=>({...e,folded:n.has(e.id),insideIds:i.get(e.id)??[]})),o=[],s=new Map;for(let t of e.edges){let e=r.get(t.from)??t.from,n=r.get(t.to)??t.to;if(e===t.from&&n===t.to){o.push(t);continue}if(e===n)continue;let i=jg(e,n,t.kind),a=s.get(i);a===void 0?s.set(i,{edge:{id:i,kind:t.kind,from:e,to:n,count:1,relationshipIds:[t.id]},ids:[t.id]}):a.ids.push(t.id)}for(let{edge:e,ids:t}of s.values())o.push({...e,count:t.length,relationshipIds:t});return{nodes:a,edges:o}}var Pg=[`layered`,`routed`,`served-by`,`bands`],Fg=`served-by`,Ig=e=>e!==`layered`,Lg=e=>e===`served-by`||e===`bands`,Rg=e=>e===`bands`,zg=new Set([`serving`,`realization`,`specialization`]),Bg={motivation:0,strategy:1,business:2,application:3,technology:4,physical:5,implementation:6},Vg=e=>e==null?void 0:Bg[e],Hg=[`current`,`drafting`,`ink`,`tinted`,`dark`],Ug=[{id:`current`,title:`Current`,blurb:`ArchiMate pastels, 2px borders, grey edges with boxed labels.`},{id:`drafting`,title:`Drafting`,blurb:`The shell's own vocabulary on the canvas: paper-tinted fills, hairline ink rules, the body face, monospace edge readings with a paper halo.`},{id:`ink`,title:`Ink`,blurb:`Line-first and print-ready: white subjects, the layer carried by a coloured 1.5px border, ink edges, no boxes anywhere.`},{id:`tinted`,title:`Tinted`,blurb:`A contemporary muted palette in place of the pastels, 8px corners, slate edges, edge readings on small pills.`},{id:`dark`,title:`Dark`,blurb:`A dark ground with deep layer tints, light ink and light glyphs.`,canvas:`#12161b`,glyph:`#e5e9ed`}],Wg=`current`,Gg=`yarramate-visual.style`,Kg=()=>{try{let e=globalThis.localStorage?.getItem(Gg);return Yg(e)?e:Wg}catch{return Wg}},qg=e=>{try{globalThis.localStorage?.setItem(Gg,e)}catch{}},Jg=e=>Ug.find(t=>t.id===e)??Ug[0],Yg=e=>typeof e==`string`&&Hg.includes(e),Xg=`'Avenir Next', Avenir, -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif`,Zg=`ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace`,Qg={motivation:{fill:`#dcd9ef`,border:`#6f6bb0`},strategy:{fill:`#ece2cd`,border:`#a2843f`},business:{fill:`#ecebc4`,border:`#9a9440`},application:{fill:`#cfe6e8`,border:`#3f8f8f`},technology:{fill:`#d3e6d3`,border:`#4f8f4f`},implementation:{fill:`#ebd9da`,border:`#b07a7a`},physical:{fill:`#e1e5e7`,border:`#7d868c`},composite:{fill:`#e1e5e7`,border:`#7d868c`}},$g={motivation:{fill:`#ffffff`,border:`#5b52c8`},strategy:{fill:`#ffffff`,border:`#b8862b`},business:{fill:`#ffffff`,border:`#a89a12`},application:{fill:`#ffffff`,border:`#1f8f8f`},technology:{fill:`#ffffff`,border:`#2f8f2f`},implementation:{fill:`#ffffff`,border:`#c2606a`},physical:{fill:`#ffffff`,border:`#6b7680`},composite:{fill:`#ffffff`,border:`#6b7680`}},e_={motivation:{fill:`#ede9fe`,border:`#7c3aed`},strategy:{fill:`#fef3c7`,border:`#b45309`},business:{fill:`#fef9c3`,border:`#a16207`},application:{fill:`#e0f2fe`,border:`#0369a1`},technology:{fill:`#d1fae5`,border:`#047857`},implementation:{fill:`#ffe4e6`,border:`#be123c`},physical:{fill:`#f1f5f9`,border:`#475569`},composite:{fill:`#f1f5f9`,border:`#475569`}},t_={motivation:{fill:`#2a2550`,border:`#8b7fe0`},strategy:{fill:`#3a2e14`,border:`#c9a355`},business:{fill:`#3a3a10`,border:`#c9c355`},application:{fill:`#10344a`,border:`#4fb8b8`},technology:{fill:`#10391f`,border:`#5fae5f`},implementation:{fill:`#3d1b22`,border:`#d89999`},physical:{fill:`#262c33`,border:`#6b7680`},composite:{fill:`#262c33`,border:`#6b7680`}},n_=(e,t=`16%`)=>[...Object.keys(e).map(t=>({selector:`node[layer = "${t}"]`,style:{"background-color":e[t].fill,"border-color":e[t].border}})),...Object.keys(e).map(n=>({selector:`node[layer = "${n}"][aspect = "passive-structure"]:childless`,style:{"background-fill":`linear-gradient`,"background-gradient-direction":`to-bottom`,"background-gradient-stop-colors":[e[n].border,e[n].fill],"background-gradient-stop-positions":[`0%`,t]}}))],r_=e=>[...n_(e.palette),{selector:`node`,style:{"border-width":e.nodeBorder,"corner-radius":`${e.corner}px`,"font-family":Xg,"font-size":12,"font-weight":500,color:e.ink}},{selector:`node:parent`,style:{...e.containerFill.color===null?{}:{"background-color":e.containerFill.color},"background-opacity":e.containerFill.opacity,...e.containerBorder.color===null?{}:{"border-color":e.containerBorder.color},"border-style":e.containerBorder.style,"border-width":1,"border-opacity":e.containerBorder.opacity,"corner-radius":`${e.corner+4}px`,"font-family":e.containerTitle.face,"font-size":e.containerTitle.size,"font-weight":e.containerTitle.weight,color:e.containerTitle.color,...e.containerTitle.upper?{"text-transform":`uppercase`}:{},"text-margin-y":-6}},{selector:`edge`,style:{"line-color":e.edge,"target-arrow-color":e.edge,"source-arrow-color":e.edge,width:e.edgeWidth,"line-cap":`round`,"arrow-scale":.85,"font-family":e.edgeLabelFace,"font-size":9.5,color:e.edgeLabelColor,"text-background-color":e.edgeLabelBackground.color,"text-background-opacity":e.edgeLabelBackground.opacity,"text-background-shape":e.edgeLabelBackground.shape,"text-background-padding":`2px`,...e.halo===null?{"text-outline-width":0}:{"text-outline-color":e.halo,"text-outline-width":2,"text-outline-opacity":1}}},{selector:`edge.lifted`,style:{"line-color":e.quiet,"target-arrow-color":e.quiet,width:e.edgeWidth+.5}},{selector:`node.selected`,style:{"border-color":e.select,"border-width":2,"overlay-color":e.select,"overlay-opacity":.12,"overlay-padding":6}},{selector:`edge.selected`,style:{"line-color":e.select,"target-arrow-color":e.select,width:e.edgeWidth+1}}],i_={current:()=>[],drafting:()=>r_({palette:Qg,ink:`#182228`,quiet:`#7d868c`,ground:`#e8eef0`,nodeBorder:1,corner:4,edge:`#6b7680`,edgeWidth:1.25,edgeLabelFace:Zg,edgeLabelColor:`#4a555e`,edgeLabelBackground:{color:`#e8eef0`,opacity:0,shape:`rectangle`},halo:`#e8eef0`,containerFill:{color:null,opacity:0},containerBorder:{color:`#182228`,style:`dashed`,opacity:.3},containerTitle:{face:Zg,size:10,weight:`500`,color:`#4a555e`,upper:!0},select:`#2457a6`}),ink:()=>r_({palette:$g,ink:`#182228`,quiet:`#6b7680`,ground:`#ffffff`,nodeBorder:1.5,corner:4,edge:`#182228`,edgeWidth:1.2,edgeLabelFace:Xg,edgeLabelColor:`#182228`,edgeLabelBackground:{color:`#ffffff`,opacity:0,shape:`rectangle`},halo:`#e8eef0`,containerFill:{color:`#182228`,opacity:.04},containerBorder:{color:`#182228`,style:`solid`,opacity:.35},containerTitle:{face:Xg,size:11,weight:`600`,color:`#182228`,upper:!0},select:`#2457a6`}),tinted:()=>r_({palette:e_,ink:`#0f172a`,quiet:`#94a3b8`,ground:`#e8eef0`,nodeBorder:1,corner:8,edge:`#64748b`,edgeWidth:1.5,edgeLabelFace:Xg,edgeLabelColor:`#475569`,edgeLabelBackground:{color:`#f8fafc`,opacity:1,shape:`roundrectangle`},halo:null,containerFill:{color:null,opacity:.35},containerBorder:{color:null,style:`solid`,opacity:.5},containerTitle:{face:Xg,size:11,weight:`600`,color:`#334155`,upper:!1},select:`#2563eb`}),dark:()=>r_({palette:t_,ink:`#e5e9ed`,quiet:`#97a3ae`,ground:`#12161b`,nodeBorder:1,corner:6,edge:`#7f8b96`,edgeWidth:1.25,edgeLabelFace:Xg,edgeLabelColor:`#b8c2cc`,edgeLabelBackground:{color:`#12161b`,opacity:0,shape:`rectangle`},halo:`#12161b`,containerFill:{color:`#1a2027`,opacity:.7},containerBorder:{color:`#3a444f`,style:`dashed`,opacity:1},containerTitle:{face:Xg,size:11,weight:`600`,color:`#97a3ae`,upper:!1},select:`#7ea6ec`})},a_=e=>i_[e]();function o_(e){return e===`planned`||e===`current`||e===`retired`}var s_=`#182228`,c_=`#416f65`,l_=`#a3403a`,u_=`#5f686d`,d_=[c_,`#8c4d18`,`#2457a6`,s_],f_=12;function p_(e){return`data:image/svg+xml;utf8,${encodeURIComponent(e)}`}function m_(e){return`<svg xmlns="http://www.w3.org/2000/svg" width="${f_}" height="${f_}" viewBox="0 0 12 12">${e}</svg>`}var h_={planned:m_(`<circle cx="6" cy="6" r="4" fill="none" stroke="${u_}" stroke-width="2"/>`),current:m_(`<circle cx="6" cy="6" r="5" fill="${c_}"/>`),retired:m_(`<circle cx="6" cy="6" r="5" fill="${l_}"/>`)},g_={planned:p_(h_.planned),current:p_(h_.current),retired:p_(h_.retired)},__=p_(m_(`<circle cx="6" cy="6" r="5" fill="${s_}"/><path d="M3.2 6.2 L5.2 8.2 L8.8 4.2" fill="none" stroke="#ffffff" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"/>`));function v_(e){let t=2166136261;for(let n=0;n<e.length;n++)t=Math.imul(t^e.charCodeAt(n),16777619);return t}function y_(e){if(e===null)return null;let t=v_(e);return d_[Math.abs(t)%d_.length]}function b_(e,t){return m_(`<circle cx="6" cy="6" r="5" fill="${y_(e)}"/><text x="6" y="7.5" font-size="8" font-weight="bold" fill="#ffffff" text-anchor="middle" dominant-baseline="middle">${t}</text>`)}function x_(e,t){return p_(b_(e,t))}function S_(e){let t=e>9?`9+`:String(e);return m_(`<circle cx="6" cy="6" r="5" fill="${u_}"/><text x="6" y="7.5" font-size="${t.length>1?6.5:8}" font-weight="bold" fill="#ffffff" text-anchor="middle" dominant-baseline="middle">${t}</text>`)}function C_(e){return p_(S_(e))}function w_(e){let t=e>99?`99+`:String(e),n=12+t.length*4;return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${n} 12" width="${n}" height="12"><rect x="0" y="0" width="${n}" height="12" rx="3" fill="${s_}"/><path d="M4 3.5 L7.5 6 L4 8.5 Z" fill="#ffffff"/><text x="${n-3}" y="6.5" font-size="7" font-weight="bold" fill="#ffffff" text-anchor="end" dominant-baseline="middle">${t}</text></svg>`}function T_(e){return p_(w_(e))}function E_(e){if(e===null)return null;let t=(e.includes(`#`)?e.slice(e.indexOf(`#`)+1):e).split(/[-_\s]+/).filter(e=>e.length>0);if(t.length===0)return null;let n=t.slice(0,2).map(e=>e[0].toUpperCase()).join(``);return n.length>0?n:null}var D_=[`motivation`,`strategy`,`business`,`application`,`technology`,`physical`,`implementation`,`composite`],O_=(e,t,n)=>n.map(([n,r,i])=>({id:n,name:r,layer:e,aspect:t,...i===void 0?{}:{rigidity:i},inspiredBy:`archimate:${r}`})),k_=[...O_(`motivation`,`motivation`,[[`stakeholder`,`Stakeholder`,`anti-rigid`],[`driver`,`Driver`],[`assessment`,`Assessment`],[`goal`,`Goal`],[`outcome`,`Outcome`],[`principle`,`Principle`],[`requirement`,`Requirement`],[`constraint`,`Constraint`],[`meaning`,`Meaning`],[`value`,`Value`]]),...O_(`strategy`,`active-structure`,[[`resource`,`Resource`]]),...O_(`strategy`,`behavior`,[[`capability`,`Capability`],[`valueStream`,`Value stream`],[`courseOfAction`,`Course of action`]]),...O_(`business`,`active-structure`,[[`businessActor`,`Business actor`],[`businessRole`,`Business role`,`anti-rigid`],[`businessCollaboration`,`Business collaboration`,`anti-rigid`],[`businessInterface`,`Business interface`]]),...O_(`business`,`behavior`,[[`businessProcess`,`Business process`],[`businessFunction`,`Business function`],[`businessInteraction`,`Business interaction`],[`businessEvent`,`Business event`],[`businessService`,`Business service`]]),...O_(`business`,`passive-structure`,[[`businessObject`,`Business object`],[`contract`,`Contract`],[`representation`,`Representation`]]),...O_(`business`,`composite`,[[`product`,`Product`]]),...O_(`application`,`active-structure`,[[`applicationComponent`,`Application component`],[`applicationCollaboration`,`Application collaboration`,`anti-rigid`],[`applicationInterface`,`Application interface`]]),...O_(`application`,`behavior`,[[`applicationFunction`,`Application function`],[`applicationInteraction`,`Application interaction`],[`applicationProcess`,`Application process`],[`applicationEvent`,`Application event`],[`applicationService`,`Application service`]]),...O_(`application`,`passive-structure`,[[`dataObject`,`Data object`]]),...O_(`technology`,`active-structure`,[[`node`,`Node`],[`device`,`Device`],[`systemSoftware`,`System software`],[`technologyCollaboration`,`Technology collaboration`,`anti-rigid`],[`technologyInterface`,`Technology interface`],[`path`,`Path`],[`communicationNetwork`,`Communication network`]]),...O_(`technology`,`behavior`,[[`technologyFunction`,`Technology function`],[`technologyProcess`,`Technology process`],[`technologyInteraction`,`Technology interaction`],[`technologyEvent`,`Technology event`],[`technologyService`,`Technology service`]]),...O_(`technology`,`passive-structure`,[[`artifact`,`Artifact`]]),...O_(`physical`,`active-structure`,[[`equipment`,`Equipment`],[`facility`,`Facility`],[`distributionNetwork`,`Distribution network`]]),...O_(`physical`,`passive-structure`,[[`material`,`Material`]]),...O_(`implementation`,`behavior`,[[`workPackage`,`Work package`],[`implementationEvent`,`Implementation event`]]),...O_(`implementation`,`passive-structure`,[[`deliverable`,`Deliverable`]]),...O_(`implementation`,`composite`,[[`plateau`,`Plateau`],[`gap`,`Gap`]]),...O_(`composite`,`composite`,[[`grouping`,`Grouping`],[`location`,`Location`],[`andJunction`,`AND junction`],[`orJunction`,`OR junction`]])],A_=[`composition`,`aggregation`,`assignment`,`realization`,`serving`,`access`,`influence`,`association`,`triggering`,`flow`,`specialization`],j_=`#182228`,M_={motivation:{fill:`#CCCCFF`,border:`#8F8FE0`},strategy:{fill:`#F5DEAA`,border:`#C9A355`},business:{fill:`#FFFF99`,border:`#C9C355`},application:{fill:`#CCFFFF`,border:`#4FB8B8`},technology:{fill:`#CCFFCC`,border:`#5FAE5F`},implementation:{fill:`#FFE0E0`,border:`#D89999`},physical:{fill:`#F0F0F0`,border:`#999999`},composite:{fill:`#F0F0F0`,border:`#999999`}},N_={motivation:{shape:`octagon`},"active-structure":{shape:`rectangle`},behavior:{shape:`round-rectangle`},"passive-structure":{shape:`rectangle`,accent:`top-band`},composite:{shape:`rectangle`}},P_={grouping:{borderStyle:`dashed`}};function F_(e,t=j_){return`<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 14 14"><g fill="none" stroke="${t}" stroke-width="1" stroke-linecap="round" stroke-linejoin="round">${e}</g></svg>`}function I_(e){return`data:image/svg+xml;utf8,${encodeURIComponent(e)}`}var L_={andJunction:`<circle cx="7" cy="7" r="2.6" fill="#182228"/>`,applicationCollaboration:`<circle cx="5.5" cy="7" r="4"/><circle cx="8.5" cy="7" r="4"/>`,applicationComponent:`<rect x="3" y="2" width="9" height="10"/><rect x="1" y="4" width="2.5" height="1.5"/><rect x="1" y="8" width="2.5" height="1.5"/>`,applicationEvent:`<path d="M3 3 H8 L11 7 L8 11 H3 Z"/>`,applicationFunction:`<rect x="2" y="3" width="10" height="8" rx="2"/><path d="M5.5 5 L8 7 L5.5 9"/>`,applicationInteraction:`<path d="M2 5 H9 M9 5 L7 3 M9 5 L7 7"/><path d="M12 9 H5 M5 9 L7 7 M5 9 L7 11"/>`,applicationInterface:`<line x1="1.5" y1="7" x2="6" y2="7"/><circle cx="9" cy="7" r="3"/>`,applicationProcess:`<path d="M2 7 H10 M10 7 L7.5 4.5 M10 7 L7.5 9.5"/>`,applicationService:`<rect x="1.5" y="4" width="11" height="6" rx="3"/>`,artifact:`<path d="M3 1.5 H9 L11 3.5 V12.5 H3 Z"/><path d="M9 1.5 V3.5 H11"/>`,assessment:`<circle cx="6" cy="6" r="3.5"/><path d="M8.5 8.5 L12 12"/>`,businessActor:`<circle cx="7" cy="3.5" r="1.8"/><path d="M7 5.3 V9 M4 7 H10 M7 9 L4.5 12.5 M7 9 L9.5 12.5"/>`,businessCollaboration:`<circle cx="5.5" cy="7" r="4"/><circle cx="8.5" cy="7" r="4"/>`,businessEvent:`<path d="M3 3 H8 L11 7 L8 11 H3 Z"/>`,businessFunction:`<rect x="2" y="3" width="10" height="8" rx="2"/><path d="M5 8 L7 5.5 L9 8"/>`,businessInteraction:`<path d="M2 5 H9 M9 5 L7 3 M9 5 L7 7"/><path d="M12 9 H5 M5 9 L7 7 M5 9 L7 11"/>`,businessInterface:`<line x1="1.5" y1="7" x2="6" y2="7"/><circle cx="9" cy="7" r="3"/>`,businessObject:`<rect x="2" y="3" width="10" height="8"/>`,businessProcess:`<path d="M2 7 H10 M10 7 L7.5 4.5 M10 7 L7.5 9.5"/>`,businessRole:`<circle cx="7" cy="6" r="4"/><path d="M5 9.5 L4 12.5 L7 11 L10 12.5 L9 9.5"/>`,businessService:`<rect x="1.5" y="4" width="11" height="6" rx="3"/>`,capability:`<rect x="2" y="2" width="10" height="10" rx="1"/><path d="M5 9 L9 5 M9 5 H6.5 M9 5 V7.5"/>`,communicationNetwork:`<circle cx="3.5" cy="4" r="1.2"/><circle cx="11" cy="4" r="1.2"/><circle cx="7" cy="10.5" r="1.2"/><path d="M3.5 4 L11 4 M3.5 4 L7 10.5 M11 4 L7 10.5"/>`,constraint:`<rect x="4" y="6.5" width="6" height="5.5" rx="0.5"/><path d="M5.2 6.5 V4.7 A1.8 1.8 0 0 1 8.8 4.7 V6.5"/>`,contract:`<rect x="2" y="2" width="10" height="10"/><path d="M2 4.5 H12 M2 6.5 H12"/>`,courseOfAction:`<path d="M7 2 V12.5"/><path d="M7 4 H11 L9.5 5.5 L11 7 H7 Z"/><path d="M7 8 H4 L5.5 9.5 L4 11 H7 Z"/>`,dataObject:`<rect x="2" y="2" width="10" height="10"/><path d="M2 5.5 H12"/>`,deliverable:`<path d="M3 1.5 H8 L11 4.5 V12.5 H3 Z"/><path d="M8 1.5 V4.5 H11"/><path d="M5 9.5 L7 12.5 L9 9.5"/>`,device:`<rect x="2" y="3" width="10" height="6" rx="0.5"/><path d="M4.5 9 V11 M9.5 9 V11 M3.5 11 H6 M8 11 H10.5"/>`,distributionNetwork:`<path d="M2 11 Q4 11 5 8 Q6 5 7 5 Q8 5 9 8 Q10 11 12 11"/><circle cx="2" cy="11" r="1"/><circle cx="12" cy="11" r="1"/><circle cx="7" cy="5" r="1"/>`,driver:`<circle cx="7" cy="7" r="5"/><path d="M7 2 V5 M7 9 V12 M2 7 H5 M9 7 H12"/>`,equipment:`<rect x="2" y="3" width="10" height="8"/><path d="M2 3 L7 6 L12 3 M7 6 V11"/>`,facility:`<path d="M2 12.5 V6 L7 2.5 L12 6 V12.5 Z"/><path d="M5.5 12.5 V8.5 H8.5 V12.5"/>`,gap:`<path d="M2 4 H6 M2 10 H6"/><path d="M8 4 H12 M8 10 H12"/><path d="M7 3 V11" stroke-dasharray="1.4 1.3"/>`,goal:`<circle cx="7" cy="7" r="5"/><circle cx="7" cy="7" r="2.2"/>`,grouping:`<rect x="2" y="2" width="10" height="10" rx="1" stroke-dasharray="2 1.4"/>`,implementationEvent:`<path d="M3 3 H8 L11 7 L8 11 H3 Z"/>`,location:`<path d="M7 12.5 C7 12.5 3 8 3 5.5 A4 4 0 0 1 11 5.5 C11 8 7 12.5 7 12.5 Z"/><circle cx="7" cy="5.5" r="1.3"/>`,material:`<rect x="2" y="8" width="4" height="4"/><rect x="6.5" y="6" width="4" height="6"/><rect x="4" y="2.5" width="4" height="4"/>`,meaning:`<path d="M2 3 H12 V9 H6 L4 11 V9 H2 Z"/><path d="M4.5 6 H9.5"/>`,node:`<path d="M2 5 L7 2.5 L12 5 L12 10 L7 12.5 L2 10 Z"/><path d="M2 5 L7 7.5 L12 5 M7 7.5 V12.5"/>`,orJunction:`<circle cx="7" cy="7" r="2.6"/>`,outcome:`<path d="M3 1.5 V12.5"/><path d="M3 2 H9 L7 4 L9 6 H3 Z"/>`,path:`<circle cx="3" cy="7" r="1.3"/><circle cx="11" cy="7" r="1.3"/><path d="M4.5 7 H9.5" stroke-dasharray="1.6 1.4"/>`,plateau:`<path d="M2 11 L4.5 4 H9.5 L12 11 Z"/><path d="M2 11 H12"/>`,principle:`<path d="M3 2.5 H11 V9 L7 11.5 L3 9 Z"/><path d="M5 6 L6.5 7.5 L9.5 4.5"/>`,product:`<rect x="2" y="5" width="10" height="7"/><path d="M2 5 L7 1.5 L12 5"/>`,representation:`<path d="M3 2 H11 V9 Q9.5 11 8 9.5 Q6.5 8 5 9.5 Q3.5 11 3 9 Z"/>`,requirement:`<path d="M3 2.5 H11 V9 L7 11.5 L3 9 Z"/><path d="M3 5 H11"/>`,resource:`<rect x="2" y="4.5" width="9" height="5" rx="1"/><rect x="11" y="6" width="1.5" height="2"/><path d="M4 6 V8 M6.5 6 V8 M9 6 V8"/>`,stakeholder:`<circle cx="7" cy="5" r="2.2"/><path d="M2.5 12.5 Q2.5 8 7 8 Q11.5 8 11.5 12.5"/>`,systemSoftware:`<rect x="2" y="2" width="10" height="10"/><rect x="4" y="4" width="4" height="3"/>`,technologyCollaboration:`<circle cx="5.5" cy="7" r="4"/><circle cx="8.5" cy="7" r="4"/>`,technologyEvent:`<path d="M3 3 H8 L11 7 L8 11 H3 Z"/>`,technologyFunction:`<circle cx="7" cy="7" r="4"/><path d="M7 2 V3.2 M7 10.8 V12 M2 7 H3.2 M10.8 7 H12 M3.5 3.5 L4.3 4.3 M9.7 9.7 L10.5 10.5 M3.5 10.5 L4.3 9.7 M9.7 4.3 L10.5 3.5"/>`,technologyInteraction:`<path d="M2 5 H9 M9 5 L7 3 M9 5 L7 7"/><path d="M12 9 H5 M5 9 L7 7 M5 9 L7 11"/>`,technologyInterface:`<line x1="1.5" y1="7" x2="6" y2="7"/><circle cx="9" cy="7" r="3"/>`,technologyProcess:`<path d="M2 7 H10 M10 7 L7.5 4.5 M10 7 L7.5 9.5"/>`,technologyService:`<rect x="1.5" y="4" width="11" height="6" rx="3"/>`,value:`<path d="M7 2 L11.5 7 L7 12 L2.5 7 Z"/>`,valueStream:`<path d="M2 5 H8 V3.5 L12 7 L8 10.5 V9 H2 Z"/>`,workPackage:`<rect x="2" y="5" width="10" height="7"/><path d="M5 5 V3.5 A1 1 0 0 1 6 2.5 H8 A1 1 0 0 1 9 3.5 V5"/>`},R_=k_.map(e=>({id:e.id,notation:e.name,layer:e.layer,aspect:e.aspect,...N_[e.aspect],...P_[e.id],glyph:L_[e.id]??null,colors:M_[e.layer]})),z_=Object.fromEntries(R_.map(e=>[e.id,e]));function B_(e,t=j_){let n=z_[e]?.glyph;return n==null?null:I_(F_(n,t))}var V_={composition:{lineStyle:`solid`,sourceArrow:{shape:`diamond`,fill:`filled`},targetArrow:{shape:`none`}},aggregation:{lineStyle:`solid`,sourceArrow:{shape:`diamond`,fill:`hollow`},targetArrow:{shape:`none`}},assignment:{lineStyle:`solid`,sourceArrow:{shape:`circle`,fill:`filled`},targetArrow:{shape:`triangle`,fill:`filled`}},realization:{lineStyle:`dotted`,sourceArrow:{shape:`none`},targetArrow:{shape:`triangle`,fill:`hollow`}},specialization:{lineStyle:`solid`,sourceArrow:{shape:`none`},targetArrow:{shape:`triangle`,fill:`hollow`}},serving:{lineStyle:`solid`,sourceArrow:{shape:`none`},targetArrow:{shape:`vee`}},access:{lineStyle:`dotted`,sourceArrow:{shape:`none`},targetArrow:{shape:`vee`}},influence:{lineStyle:`dashed`,sourceArrow:{shape:`none`},targetArrow:{shape:`vee`}},triggering:{lineStyle:`solid`,sourceArrow:{shape:`none`},targetArrow:{shape:`triangle`,fill:`filled`}},flow:{lineStyle:`dashed`,sourceArrow:{shape:`none`},targetArrow:{shape:`triangle`,fill:`filled`}},association:{lineStyle:`solid`,sourceArrow:{shape:`none`},targetArrow:{shape:`none`}}},H_=A_.map(e=>({id:e,...V_[e]}));Object.fromEntries(H_.map(e=>[e.id,e]));function U_(e,t){return B_(e,t)}var W_=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),$=o(((e,t)=>{t.exports=W_()}))(),G_=`application/x-yarramate-kind`,K_=`unlayered`,q_=`constraint`,J_=(e,t)=>{let n=e===1?`slot`:`slots`;return t===0?`${e} ${n}`:`${e} ${n}, ${t} required`},Y_=e=>e.slice(e.lastIndexOf(`/`)+1).replace(/\.ya?ml$/,``),X_=new Map(k_.map(e=>[e.id,e.layer])),Z_=(e=[])=>{let t=new Map;for(let n of e){let e=t.get(n.document);e===void 0?t.set(n.document,[n]):e.push(n)}return[...t].map(([e,t])=>({document:e,patterns:t}))},Q_=(e,t=[])=>{let n=new Set(t.flatMap(e=>e.slots.flatMap(e=>[...e.admits]))),r=e=>e.coreLabel===q_&&n.has(e.label),i=new Map,a=new Map;for(let t of e){let e=X_.get(t.coreLabel)??K_,n=r(t)?a:i,o=n.get(e);o===void 0?n.set(e,[t]):o.push(t)}return[...D_,K_].flatMap(e=>{let t=i.get(e),n=a.get(e);return t===void 0&&n===void 0?[]:[{layer:e,kinds:t??[],boundThroughSlot:n??[]}]})},$_=({kinds:e,patterns:t,onPick:n})=>{let[r,i]=(0,y.useState)(new Set),a=e=>i(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n});return(0,$.jsxs)(`div`,{className:`kind-palette`,children:[Z_(t).map(e=>{let t=r.has(e.document);return(0,$.jsxs)(`div`,{className:`kind-palette-layer`,children:[(0,$.jsxs)(`button`,{type:`button`,className:`kind-palette-layer-name`,"aria-expanded":!t,title:e.document,onClick:()=>a(e.document),children:[(0,$.jsx)(`span`,{className:`kind-palette-caret`,"aria-hidden":`true`,children:t?`▸`:`▾`}),`patterns \u00b7 ${Y_(e.document)}`]}),t?null:(0,$.jsx)(`ul`,{className:`kind-palette-rows`,children:e.patterns.map(e=>{let t=e.slots.filter(e=>e.required).length;return(0,$.jsx)(`li`,{children:(0,$.jsxs)(`button`,{type:`button`,className:`kind-palette-row kind-palette-pattern`,draggable:!0,"data-kind":e.label,"data-pattern":e.kind,onDragStart:t=>{t.dataTransfer.setData(G_,e.label),t.dataTransfer.effectAllowed=`copy`},onClick:()=>n(e.label),children:[(0,$.jsx)(`span`,{className:`kind-palette-stack`,"aria-hidden":`true`}),(0,$.jsx)(`span`,{children:e.name??e.label}),(0,$.jsx)(`span`,{className:`kind-palette-slots`,children:J_(e.slots.length,t)})]})},e.kind)})})]},`pattern:${e.document}`)}),Q_(e,t).map(e=>{let t=r.has(e.layer);return(0,$.jsxs)(`div`,{className:`kind-palette-layer`,children:[(0,$.jsxs)(`button`,{type:`button`,className:`kind-palette-layer-name`,"aria-expanded":!t,onClick:()=>a(e.layer),children:[(0,$.jsx)(`span`,{className:`kind-palette-caret`,"aria-hidden":`true`,children:t?`▸`:`▾`}),e.layer]}),t?null:(0,$.jsx)(`ul`,{className:`kind-palette-rows`,children:e.kinds.map(e=>{let t=U_(e.label)??U_(e.coreLabel);return(0,$.jsx)(`li`,{children:(0,$.jsxs)(`button`,{type:`button`,className:`kind-palette-row`,draggable:!0,"data-kind":e.label,onDragStart:t=>{t.dataTransfer.setData(G_,e.label),t.dataTransfer.effectAllowed=`copy`},onClick:()=>n(e.label),children:[t===null?null:(0,$.jsx)(`img`,{src:t,alt:``,width:14,height:14}),(0,$.jsx)(`span`,{children:e.label})]})},e.id)})}),t||e.boundThroughSlot.length===0?null:(0,$.jsx)(ev,{layer:e.layer,kinds:e.boundThroughSlot,onPick:n})]},e.layer)})]})},ev=({layer:e,kinds:t,onPick:n})=>{let[r,i]=(0,y.useState)(!1);return(0,$.jsxs)(`div`,{className:`kind-palette-bound`,children:[(0,$.jsxs)(`button`,{type:`button`,className:`kind-palette-layer-name kind-palette-bound-name`,"aria-expanded":r,onClick:()=>i(e=>!e),children:[(0,$.jsx)(`span`,{className:`kind-palette-caret`,"aria-hidden":`true`,children:r?`▾`:`▸`}),`${e} \u00b7 ${t.length} kinds bound through a slot`]}),r?(0,$.jsx)(`ul`,{className:`kind-palette-rows`,children:t.map(e=>(0,$.jsx)(`li`,{children:(0,$.jsx)(`button`,{type:`button`,className:`kind-palette-row`,draggable:!0,"data-kind":e.label,onDragStart:t=>{t.dataTransfer.setData(G_,e.label),t.dataTransfer.effectAllowed=`copy`},onClick:()=>n(e.label),children:(0,$.jsx)(`span`,{children:e.label})})},e.id))}):null]})},tv=e=>e.trim().toLowerCase();function nv(e,t,n,r){return e===``||t.toLowerCase().includes(e)||typeof n==`string`&&n.toLowerCase().includes(e)?!0:typeof r==`string`&&r.toLowerCase().includes(e)}var rv=(e,t)=>{let n=tv(t);return e.filter(e=>nv(n,e.id,e.name,e.kindLabel)).length},iv=c(o(((e,t)=>{(function(n){if(typeof e==`object`&&t!==void 0)t.exports=n();else if(typeof define==`function`&&define.amd)define([],n);else{var r=typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:this;r.ELK=n()}})(function(){return(function(){function e(t,n,r){function i(o,s){if(!n[o]){if(!t[o]){var c=typeof l==`function`&&l;if(!s&&c)return c(o,!0);if(a)return a(o,!0);var u=Error(`Cannot find module '`+o+`'`);throw u.code=`MODULE_NOT_FOUND`,u}var d=n[o]={exports:{}};t[o][0].call(d.exports,function(e){var n=t[o][1][e];return i(n||e)},d,d.exports,e,t,n,r)}return n[o].exports}for(var a=typeof l==`function`&&l,o=0;o<r.length;o++)i(r[o]);return i}return e})()({1:[function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;function r(e){"@babel/helpers - typeof";return r=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},r(e)}function i(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function a(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,s(r.key),r)}}function o(e,t,n){return t&&a(e.prototype,t),n&&a(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function s(e){var t=c(e,`string`);return r(t)==`symbol`?t:t+``}function c(e,t){if(r(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,t||`default`);if(r(i)!=`object`)return i;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}n.default=function(){function e(){var t=this,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=n.defaultLayoutOptions,a=r===void 0?{}:r,o=n.algorithms,s=o===void 0?[`layered`,`stress`,`mrtree`,`radial`,`force`,`disco`,`sporeOverlap`,`sporeCompaction`,`rectpacking`]:o,c=n.workerFactory,u=n.workerUrl;if(i(this,e),this.defaultLayoutOptions=a,this.initialized=!1,u===void 0&&c===void 0)throw Error(`Cannot construct an ELK without both 'workerUrl' and 'workerFactory'.`);var d=c;u!==void 0&&c===void 0&&(d=function(e){return new Worker(e)});var f=d(u);if(typeof f.postMessage!=`function`)throw TypeError(`Created worker does not provide the required 'postMessage' function.`);this.worker=new l(f),this.worker.postMessage({cmd:`register`,algorithms:s}).then(function(e){return t.initialized=!0}).catch(console.err)}return o(e,[{key:`layout`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=t.layoutOptions,r=n===void 0?this.defaultLayoutOptions:n,i=t.logging,a=i!==void 0&&i,o=t.measureExecutionTime,s=o!==void 0&&o;return e?this.worker.postMessage({cmd:`layout`,graph:e,layoutOptions:r,options:{logging:a,measureExecutionTime:s}}):Promise.reject(Error(`Missing mandatory parameter 'graph'.`))}},{key:`knownLayoutAlgorithms`,value:function(){return this.worker.postMessage({cmd:`algorithms`})}},{key:`knownLayoutOptions`,value:function(){return this.worker.postMessage({cmd:`options`})}},{key:`knownLayoutCategories`,value:function(){return this.worker.postMessage({cmd:`categories`})}},{key:`terminateWorker`,value:function(){this.worker&&this.worker.terminate()}}])}();var l=function(){function e(t){var n=this;if(i(this,e),t===void 0)throw Error(`Missing mandatory parameter 'worker'.`);this.resolvers={},this.worker=t,this.worker.onmessage=function(e){setTimeout(function(){n.receive(n,e)},0)}}return o(e,[{key:`postMessage`,value:function(e){var t=this.id||0;this.id=t+1,e.id=t;var n=this;return new Promise(function(r,i){n.resolvers[t]=function(e,t){e?(n.convertGwtStyleError(e),i(e)):r(t)},n.worker.postMessage(e)})}},{key:`receive`,value:function(e,t){var n=t.data,r=e.resolvers[n.id];r&&(delete e.resolvers[n.id],n.error?r(n.error):r(null,n.data))}},{key:`terminate`,value:function(){this.worker&&this.worker.terminate()}},{key:`convertGwtStyleError`,value:function(e){if(e){var t=e.__java$exception;t&&(t.cause&&t.cause.backingJsObject&&(e.cause=t.cause.backingJsObject,this.convertGwtStyleError(e.cause)),delete e.__java$exception)}}}])}()},{}],2:[function(e,t,n){var r=e("./elk-api.js").default;Object.defineProperty(t.exports,"__esModule",{value:!0}),t.exports=r,r.default=r},{"./elk-api.js":1}]},{},[2])(2)})}))(),1),av={serving:`serves`,access:`accesses`,realization:`realizes`,composition:`comprises`,aggregation:`aggregates`,assignment:`is assigned to`,triggering:`triggers`,flow:`flows to`,specialization:`specializes`,influence:`influences`,association:`is associated with`},ov={serving:`served by`,realization:`realized by`,specialization:`specialized by`},sv=e=>e.slice(e.indexOf(`#`)+1).replaceAll(/([a-z0-9])([A-Z])/g,`$1 $2`).replaceAll(`-`,` `).toLowerCase(),cv=(e,t=!1)=>(t?ov[e]:void 0)??av[e]??sv(e),lv=(function(){let e=typeof document<`u`&&document.createElement(`link`).relList;return e&&e.supports&&e.supports(`modulepreload`)?`modulepreload`:`preload`})(),uv=function(e,t){return new URL(e,t).href},dv={},fv=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=uv(t,n),t=s(t),t in dv)return;dv[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:lv,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},pv=2.5,mv={"top-down":`DOWN`,"left-right":`RIGHT`},hv={"elk.spacing.nodeNode":`60`,"elk.layered.spacing.nodeNodeBetweenLayers":`100`,"elk.spacing.edgeNode":`30`,"elk.layered.spacing.edgeNodeBetweenLayers":`30`,"elk.spacing.edgeEdge":`20`,"elk.layered.spacing.edgeEdgeBetweenLayers":`20`,"elk.spacing.componentComponent":`80`,"elk.padding":`[top=52,left=30,bottom=30,right=30]`},gv=e=>Ig(e)?{...hv,"elk.spacing.edgeEdge":`60`}:{...hv},_v=(e,t)=>({"elk.algorithm":`layered`,"elk.direction":mv[e],"elk.layered.nodePlacement.strategy":`NETWORK_SIMPLEX`,"elk.aspectRatio":String(pv),...gv(t),...Ig(t)?{"elk.hierarchyHandling":`INCLUDE_CHILDREN`,"elk.edgeRouting":`ORTHOGONAL`,"elk.edgeLabels.inline":`true`,"elk.layered.considerModelOrder.strategy":`NODES_AND_EDGES`}:{},...Rg(t)?{"elk.partitioning.activate":`true`}:{}}),vv=(e,t,n)=>{if(typeof e.name==`string`&&e.name!==``)return e.name;if(!n)return``;let r=e.coreKindLabel??``,i=e.kindLabel??r,a=i!==r&&i!==``?sv(i):cv(r,Lg(t)&&zg.has(r)),o=typeof e.liftedCount==`number`?e.liftedCount:0;return o>1?`${a} ×${o}`:a},yv=e=>{let t=e.length*5.6+8,n=Math.max(1,Math.ceil(t/110));return{width:Math.min(110,Math.round(t)),height:12*n+4}};function bv(e,t){let{direction:n,mode:r,showKindLabels:i}=t,a=e.nodes(),o=new Set(a.map(e=>e.id())),s=new Map,c=[];a.forEach(e=>{let t=e.parent(),n=t.nonempty()?t.first().id():null;if(n!==null&&o.has(n)){let t=s.get(n);t===void 0?s.set(n,[e]):t.push(e)}else c.push(e)});let l=e=>{let t=s.get(e.id());if(t===void 0||t.length===0)return Vg(e.data(`layer`));let n=t.map(l).filter(e=>e!==void 0);return n.length===0?void 0:Math.min(...n)},u=gv(r),d=e=>{let t=s.get(e.id())??[],n={id:e.id()};if(t.length>0)n.children=t.map(d),n.layoutOptions={...u};else{let t=e.layoutDimensions({nodeDimensionsIncludeLabels:!1});n.width=t.w,n.height=t.h}if(Rg(r)){let t=l(e);t!==void 0&&(n.layoutOptions={...n.layoutOptions??{},"elk.partitioning.partition":String(t)})}return n},f=new Set,p=[];return e.edges().forEach(e=>{let t=e.source().id(),n=e.target().id();if(!o.has(t)||!o.has(n))return;let a=String(e.data(`coreKindLabel`)??``),s=Lg(r)&&zg.has(a);s&&f.add(e.id());let c={id:e.id(),sources:[s?n:t],targets:[s?t:n]};if(Ig(r)){let t=vv(e.data(),r,i);t!==``&&(c.labels=[{text:t,...yv(t)}])}p.push(c)}),{graph:{id:`root`,layoutOptions:_v(n,r),children:c.map(d),edges:p},reversed:f}}var xv=(e,t)=>[e.startPoint,...e.bendPoints??[],e.endPoint].map(e=>({x:e.x+t.x,y:e.y+t.y})),Sv=e=>{let t=0;for(let n=1;n<e.length;n+=1)t+=Math.hypot(e[n].x-e[n-1].x,e[n].y-e[n-1].y);return t},Cv=(e,t)=>{let n=1/0,r=0,i=0;for(let a=1;a<e.length;a+=1){let o=e[a-1],s=e[a],c=s.x-o.x,l=s.y-o.y,u=Math.hypot(c,l)||1,d=Math.max(0,Math.min(1,((t.x-o.x)*c+(t.y-o.y)*l)/(u*u))),f=Math.hypot(t.x-(o.x+d*c),t.y-(o.y+d*l));f<n&&(n=f,r=i+d*u),i+=u}return r};function wv(e,t){let n=new Map([[e.id,{x:0,y:0}]]),r=new Map,i=(e,t,a)=>{for(let o of e.children??[]){let e=t+(o.x??0),s=a+(o.y??0);n.set(o.id,{x:e,y:s}),(o.children??[]).length===0&&r.set(o.id,{x:e+(o.width??0)/2,y:s+(o.height??0)/2}),i(o,e,s)}};i(e,0,0);let a=new Map,o=e=>{for(let r of e.edges??[]){let i=n.get(r.container??e.id)??{x:0,y:0},o=r.sections?.[0];if(o===void 0)continue;let s=xv(o,i),c=null,l=r.labels?.[0];if(l!==void 0&&l.x!==void 0&&l.y!==void 0&&(c=Cv(s,{x:l.x+i.x+(l.width??0)/2,y:l.y+i.y+(l.height??0)/2})),t.has(r.id)){let e=Sv(s);s=[...s].reverse(),c!==null&&(c=e-c)}a.set(r.id,{points:s,labelAt:c})}for(let t of e.children??[])o(t)};return o(e),{nodes:r,edges:a}}var Tv=e=>e.default??e,Ev=Tv(iv.default),Dv,Ov=()=>Dv??=fv(()=>import(`./elk.bundled-CsxJb9uf.js`).then(e=>c(e.default,1)).then(e=>new(Tv(e))),[],import.meta.url),kv;function Av(e){let t=new Ev({workerFactory:()=>e()});return{layout:e=>t.layout(e),terminate:()=>t.terminateWorker?.()}}function jv(e){kv=e}var Mv=async e=>(kv??await Ov()).layout(e),Nv=[`curve-style`,`edge-distances`,`source-endpoint`,`target-endpoint`,`segment-weights`,`segment-distances`,`source-text-offset`],Pv=e=>`${Math.round(e*10)/10}px`;function Fv(e,t,n,r){let i=e[0],a=e[e.length-1];if(i===void 0||a===void 0)return{};let o=e.slice(1,-1),s=a.x-i.x,c=a.y-i.y,l=Math.hypot(s,c)||1,u=-c/l,d=s/l,f=[],p=[];for(let e of o){let t=e.x-i.x,n=e.y-i.y;f.push(((t*s+n*c)/(l*l)).toFixed(4)),p.push((t*u+n*d).toFixed(2))}let m={"curve-style":o.length>0?`segments`:`straight`,"edge-distances":`endpoints`,"source-endpoint":`${Pv(i.x-t.x)} ${Pv(i.y-t.y)}`,"target-endpoint":`${Pv(a.x-n.x)} ${Pv(a.y-n.y)}`,"source-text-offset":r===null?0:Math.round(r)};return o.length>0&&(m[`segment-weights`]=f.join(` `),m[`segment-distances`]=p.join(` `)),m}var Iv=1e-6;function Lv(e,t){if(e.isParent()){let n=e.descendants().filter(e=>!e.isParent());return n.length>0&&n.every(e=>Lv(e,t))}let n=t.nodes.get(e.id());if(n===void 0)return!1;let r=e.position();return Math.abs(r.x-n.x)<Iv&&Math.abs(r.y-n.y)<Iv}function Rv(e,t,n){let r=0;e.startBatch();try{for(let[i,a]of t.edges){let t=e.getElementById(i);t.empty()||!t.isEdge()||!n(t)||(t.style(Fv(a.points,t.source().position(),t.target().position(),a.labelAt)),t.scratch(Bv,a),t.addClass(`routed`),r+=1)}}finally{e.endBatch()}return r}function zv(e){e.removeClass(`routed`),e.removeStyle(Nv.join(` `)),e.removeScratch(Bv)}var Bv=`_route`;function Vv(e){let t={};return e.forEach(e=>{if(!e.hasClass(`routed`))return;let n=e.scratch(Bv);n!==void 0&&(t[e.id()]={points:n.points.map(e=>({x:e.x,y:e.y})),labelAt:n.labelAt})}),t}function Hv(e,t,n){let r={nodes:new Map(Object.entries(n).map(([e,t])=>[e,{x:t.x,y:t.y}])),edges:new Map(Object.entries(t).map(([e,t])=>[e,{points:t.points.map(e=>({x:e.x,y:e.y})),labelAt:t.labelAt}]))};return Rv(e,r,e=>!e.hasClass(`routed`)&&Lv(e.source(),r)&&Lv(e.target(),r))}function Uv(e){let t=e=>{let t=e.target;zv(t.union(t.ancestors()).union(t.descendants()).connectedEdges(`.routed`))};return e.on(`dragfree`,`node`,t),()=>{e.off(`dragfree`,`node`,t)}}var Wv=`#F0F0F0`,Gv=`#999999`,Kv=170,qv=50,Jv=150,Yv=`​`;function Xv(e){return e.replace(/([/._-])/g,`$1${Yv}`)}var Zv=20,Qv=1.25,$v=.02,ey=10;function ty(e,t){let n=t===1?e*Qv:e/Qv;return Math.min(ey,Math.max($v,n))}var ny=12;function ry(e,t,n,r,i,a){let o=[],s=U_(String(e.data(`kindLabel`)),a)??U_(String(e.data(`coreKindLabel`)),a);s!==null&&o.push({image:s,positionX:`0%`,positionY:`0%`,size:14});let c=e.data(`status`);t&&o_(c)&&o.push({image:g_[c],positionX:`100%`,positionY:`0%`,size:ny}),n&&e.data(`hasAttestations`)===!0&&o.push({image:__,positionX:`0%`,positionY:`100%`,size:ny});let l=e.data(`owner`),u=e.data(`ownerInitials`),d=r&&l!==null&&u!==null;d&&o.push({image:x_(l,u),positionX:`100%`,positionY:`100%`,size:ny});let f=e.data(`openQuestions`);return i&&typeof f==`number`&&f>0&&o.push({image:C_(f),positionX:d?`84%`:`96%`,positionY:d?`100%`:`88%`,size:ny}),o}var iy=[`added`,`removed`,`changed`],ay=e=>`deco-${e}`,oy=iy.map(ay).join(` `),sy={added:`#416F65`,removed:`#677074`,changed:`#8C4D18`};function cy(e,t){e.elements().removeClass(oy);for(let[n,r]of Object.entries(t)){let t=e.getElementById(n);t.nonempty()&&t.addClass(ay(r))}}function ly(e,t,n,r,i=!0,a=Fg,o=Wg){let s=Jg(o).glyph,c=e=>Xv(vv(e.data(),a,i)),l=new Map,u=i=>{let a=`${String(i.data(`status`))}\u0000${String(i.data(`hasAttestations`))}\u0000${String(i.data(`owner`))}\u0000${String(i.data(`ownerInitials`))}\u0000${String(i.data(`kindLabel`))}\u0000${String(i.data(`openQuestions`))}`,o=l.get(a);if(o!==void 0)return o;let c=ry(i,e,t,n,r,s),u={images:c.map(e=>e.image),positionsX:c.map(e=>e.positionX),positionsY:c.map(e=>e.positionY),sizes:c.map(e=>e.size),containments:c.map(()=>`over`),clips:c.map(()=>`none`)};return l.set(a,u),u},d=[{selector:`node`,style:{"background-color":Wv,"border-color":Gv,"border-width":2,shape:`roundrectangle`,width:Kv,height:qv,padding:`8px`,label:`data(wrapLabel)`,"font-size":12,"text-wrap":`wrap`,"text-max-width":`${Jv}px`,"text-halign":`center`,"text-valign":`center`,color:`#333333`}},{selector:`node`,style:{"background-image":e=>u(e).images,"background-position-x":e=>u(e).positionsX,"background-position-y":e=>u(e).positionsY,"background-width":e=>u(e).sizes,"background-height":e=>u(e).sizes,"background-image-containment":e=>u(e).containments,"background-clip":e=>u(e).clips}},...Object.entries(M_).map(([e,t])=>({selector:`node[layer = "${e}"]`,style:{"background-color":t.fill,"border-color":t.border}})),{selector:`node:parent`,style:{shape:`roundrectangle`,"background-opacity":.25,"border-width":2,"border-style":`dashed`,padding:`30px`,label:`data(wrapLabel)`,"font-size":13,"font-weight":`bold`,"text-halign":`center`,"text-valign":`top`,"text-margin-y":-8,color:`#333333`,"text-background-color":`#FFFFFF`,"text-background-opacity":1,"text-background-padding":`3px`}},{selector:`node.selected`,style:{"border-color":`#FF6B6B`,"border-width":4}},{selector:`node.folded`,style:{ghost:`yes`,"ghost-offset-x":4,"ghost-offset-y":4,"ghost-opacity":.35,"border-width":2}},{selector:`node.folded[insideCount > 0]`,style:{"background-image":e=>T_(Number(e.data(`insideCount`)??0)),"background-image-containment":`over`,"background-clip":`none`,"background-fit":`none`,"background-width":26,"background-height":12,"background-position-x":`100%`,"background-position-y":`100%`,"background-offset-x":-4,"background-offset-y":-4}},{selector:`edge.lifted`,style:{"line-style":`dashed`,"line-dash-pattern":[6,3],width:2}},{selector:`edge`,style:{"line-color":`#999999`,width:1.5,"curve-style":`taxi`,"target-arrow-shape":`triangle`,"target-arrow-color":`#999999`,label:c,"font-size":10,"text-wrap":`wrap`,"text-max-width":`110px`,"text-background-color":`#FFFFFF`,"text-background-padding":`3px`,"text-background-opacity":1}},{selector:`edge.parallel`,style:{"curve-style":`bezier`,"control-point-step-size":40}},{selector:`edge.routed`,style:{label:``,"source-label":c,"text-wrap":`wrap`,"text-max-width":`110px`}},{selector:`edge.selected`,style:{"line-color":`#FF6B6B`,"target-arrow-color":`#FF6B6B`,width:2.5}}],f=Object.entries(N_).map(([e,t])=>{let n={shape:t.shape};return t.accent===`top-band`&&(n[`background-fill`]=`linear-gradient`,n[`background-gradient-direction`]=`to-bottom`,n[`background-gradient-stop-colors`]=[Gv,Wv],n[`background-gradient-stop-positions`]=[`0%`,`20%`]),t.borderStyle===`dashed`&&(n[`border-style`]=`dashed`),{selector:`node[aspect = "${e}"]:childless`,style:n}}),p=H_.map(e=>{let t={"line-style":e.lineStyle,"source-arrow-shape":e.sourceArrow.shape,"target-arrow-shape":e.targetArrow.shape};return e.sourceArrow.fill!==void 0&&(t[`source-arrow-fill`]=e.sourceArrow.fill),e.targetArrow.fill!==void 0&&(t[`target-arrow-fill`]=e.targetArrow.fill),{selector:`edge[coreKindLabel = "${e.id}"]`,style:t}}),m=[{selector:`node.deco-added, edge.deco-added`,style:{"border-color":sy.added,"border-width":3,"line-color":sy.added,"target-arrow-color":sy.added}},{selector:`node.deco-removed, edge.deco-removed`,style:{"border-color":sy.removed,"border-width":3,"border-style":`dashed`,"line-color":sy.removed,"target-arrow-color":sy.removed,"line-style":`dashed`}},{selector:`node.deco-changed, edge.deco-changed`,style:{"border-color":sy.changed,"border-width":3,"line-color":sy.changed,"target-arrow-color":sy.changed}},{selector:`node.faulted, edge.faulted`,style:{"border-color":`#A3403A`,"border-width":4,"line-color":`#A3403A`,"target-arrow-color":`#A3403A`}}];return[...d,...f,...p,...a_(o),...m]}function uy(e){for(let t of e.conflicts){let e=new Set(t.claims.map(e=>e.from));console.warn(`Nesting conflict: "${t.child}" is claimed by ${e.size} different parents at the same precedence (${t.claims.map(e=>`${dy(e.kind)} from ${e.from}`).join(`, `)}) - rendering it unnested; every claim stays drawn as a regular edge.`)}e.cycleMembers.length>0&&console.warn(`Nesting cycle detected among: ${e.cycleMembers.join(`, `)} - rendering them unnested.`)}var dy=e=>e.split(`#`)[1]??e;function fy(e,t,n,r){new Map(e.nodes.map(e=>[e.id,e.coreKindLabel]));let i=Ag({nodes:e.nodes.map(e=>({id:e.id,kind:e.kind,coreKind:e.coreKindLabel})),edges:e.edges,memberships:r?.memberships??[],nesting:t});uy(i);let a=i.consumedEdgeIds,o=new Map;for(let e of i.parentOf.keys()){let t=i.parentOf.get(e),n=new Set([e]);for(;t!==void 0&&!n.has(t);){n.add(t);let r=o.get(t);r===void 0?o.set(t,[e]):r.push(e),t=i.parentOf.get(t)}}let s=r?.folded??new Set,c=e.nodes.map(e=>{let t=i.parentOf.get(e.id),r=o.get(e.id)??[],a=s.has(e.id);return{data:{id:e.id,label:e.name,wrapLabel:Xv(e.name),kind:e.kind,kindLabel:e.kindLabel,coreKindLabel:e.coreKindLabel,aspect:e.aspect,layer:e.layer,status:e.status,hasAttestations:e.attestations.length>0,owner:e.owner,ownerInitials:E_(e.owner),openQuestions:a?[e.id,...r].reduce((e,t)=>e+(n.get(t)??0),0):n.get(e.id)??0,insideCount:r.length,insideIds:r,...t===void 0?{}:{parent:t,compositionParent:t}},group:`nodes`,...a?{classes:`folded`}:{}}}),l=e.edges.filter(e=>!a.has(e.id)),u=new Map,d=e=>e.from<e.to?`${e.from}\u0000${e.to}`:`${e.to}\u0000${e.from}`;for(let e of l){let t=d(e);u.set(t,(u.get(t)??0)+1)}let f=l.map(e=>({data:{id:e.id,source:e.from,target:e.to,name:e.name??null,kindLabel:e.kindLabel,label:e.name??e.kindLabel,wrapLabel:Xv(e.name??e.kindLabel),coreKindLabel:e.coreKindLabel},group:`edges`,...u.get(d(e))>1?{classes:`parallel`}:{}})),p=s.size===0?[]:Ng({nodes:e.nodes,edges:l},i,s).edges.filter(e=>`count`in e).map(e=>({data:{id:e.id,source:e.from,target:e.to,label:e.count===1?dy(e.kind):`${dy(e.kind)} \u00d7${e.count}`,wrapLabel:Xv(dy(e.kind)),name:null,kindLabel:dy(e.kind),coreKindLabel:dy(e.kind),lifted:!0,liftedCount:e.count,relationshipIds:e.relationshipIds},group:`edges`,classes:`lifted`}));return[...c,...f,...p]}function py(e,t,n){let r=n.trim().toLowerCase(),i=t===null?null:new Set(t);return e.filter(e=>(i===null||i.has(e.id))&&nv(r,e.id,e.name,e.kindLabel)).length}function my(e,t,n){let r=n.trim().toLowerCase(),i=t===null?e.nodes().map(e=>e.id()):t,a=new Set(r===``?i:i.filter(t=>{let n=e.getElementById(t);return nv(r,t,n.data(`label`),n.data(`kindLabel`))})),o=new Set(a),s=t=>{let n=e.getElementById(t).data(`compositionParent`);return typeof n==`string`?n:void 0};for(let e of[...a]){let t=new Set([e]),n=s(e);for(;n!==void 0&&!t.has(n);)t.add(n),a.add(n),n=s(n)}for(let t of[...a]){let n=new Set([t]),r=s(t);for(;r!==void 0&&!n.has(r);){if(n.add(r),e.getElementById(r).hasClass(`folded`)){a.delete(t);break}r=s(r)}}let c=[];for(let t of e.nodes()){let e=s(t.id());if(e===void 0)continue;let n=a.has(t.id())&&a.has(e)?e:null;(t.parent().nonempty()?t.parent().first().id():null)!==n&&c.push({node:t.id(),parent:n})}for(let{node:t,parent:n}of c)e.getElementById(t).move({parent:n});for(let t of e.nodes(`.folded`)){let n=t.data(`insideIds`),r=Array.isArray(n)?n:[];t.data(`insideCount`,r.filter(t=>e.getElementById(t).nonempty()&&o.has(t)).length)}let l=new Set(_y(e.elements()).map(e=>e.id())),u=new Set(a);for(let t of e.edges()){let e=t.data(`source`),n=t.data(`target`);a.has(e)&&a.has(n)&&u.add(t.id())}for(let e of l)u.delete(e);e.elements().style(`display`,`none`),e.elements().filter(e=>u.has(e.id())).style(`display`,`element`)}var hy=`_layoutGeneration`;async function gy(e,t,n,r,i){let a=`elements`in e?e:e.cy(),o=`elements`in e?e.elements():e;if(o.nodes().empty())return;let s=_y(o),c=s.empty()?o:o.difference(s);zv(a.edges());let l=(a.scratch(hy)??0)+1;a.scratch(hy,l);let{graph:u,reversed:d}=bv(c,{direction:t,mode:n,showKindLabels:r}),f=await Mv(u);if(a.destroyed()||a.scratch(hy)!==l)return;let p=wv(f,d);c.layout({name:`preset`,positions:e=>p.nodes.get(e.id())??null,fit:!0,padding:Zv,animate:!1}).run(),Ig(n)&&(a.nodes().updateCompoundBounds(!0),Rv(a,p,e=>Lv(e.source(),p)&&Lv(e.target(),p)),i?.routes!==void 0&&Hv(a,i.routes,i.positions??{}))}var _y=e=>{let t=new Map;return e.nodes().forEach(e=>{let n=e.parent();n.length>0&&t.set(e.id(),n.first().id())}),t.size===0?e.edges().filter(()=>!1):e.edges().filter(e=>yg(e.source().id(),e.target().id(),t))};function vy(e,t,n=Fg,r=!0,i){return gy(e.elements(`:visible`),t,n,r,i)}async function yy(e,t,n,r,i,a){let o=i===null?null:e.getElementById(i),s=o!==null&&o.nonempty()?{...o.position()}:null;if(await vy(e,t,n,r,a),e.destroyed())return!1;if(s!==null&&o!==null&&o.nonempty()){let t=o.position(),n=s.x-t.x,r=s.y-t.y;(n!==0||r!==0)&&e.nodes().forEach(e=>{let t=e.position();e.position({x:t.x+n,y:t.y+r})})}let c=e.elements(`:visible`);if(c.empty())return!1;let l=c.boundingBox(),u=e.extent();return l.x2<u.x1||l.x1>u.x2||l.y2<u.y1||l.y1>u.y2?(e.fit(c,40),!0):!1}function by(e){let t=e.elements(`:visible`);return!t.empty()&&(e.fit(t,Zv),!0)}function xy(e){let t={};return e.forEach(e=>{let{x:n,y:r}=e.position();t[e.id()]={x:n,y:r}}),t}function Sy(e,t){t!==void 0&&e.nodes().forEach(e=>{if(!e.visible()||e.isParent())return;let n=t[e.id()];n!==void 0&&e.position(n)})}function Cy(e,t,n){return n.has(t)?void 0:e}function wy(e,t,n){return n.has(t)?void 0:e}function Ty(e,t,n){return e!==void 0&&(n??t).some(t=>e[t]!==void 0)}function Ey(e,t,n){return{x:(e.x-t.x)/n,y:(e.y-t.y)/n}}function Dy(e,t,n){let r=null,i=()=>{r!==null&&(clearTimeout(r),r=null)},a=()=>{i(),r=setTimeout(()=>{r=null;let i=t();if(i===``)return;let a=Vv(e.edges());n({projectionId:i,positions:xy(e.nodes()),...Object.keys(a).length===0?{}:{routes:a}})},500)};return e.on(`dragfree`,`node`,a),{cancelPending:i,dispose:()=>{e.off(`dragfree`,`node`,a),i()}}}function Oy({graph:e,selectedId:t,onSelect:n,onContextMenu:r,matchedIds:i,quickFilterText:a,nesting:o,faultedIds:s,decorations:c,activeViewId:l,direction:u,layout:d,showKindLabels:f,stylePreset:p,savedPositions:m,savedRoutes:h,onSaveLayout:g,onKindDrop:_,onCanvasReady:v,showLifecycle:b,showEvidence:x,showOwnership:S,showNudges:C,openQuestionCounts:w,folded:T,memberships:E}){let D=(0,y.useRef)(null),O=(0,y.useRef)(null),[k,A]=(0,y.useState)(()=>new Set),j=Cy(m,l,k),M=wy(h,l,k),N=(0,y.useRef)(n),P=(0,y.useRef)(v);P.current=v;let F=(0,y.useRef)(_);F.current=_;let I=(0,y.useRef)(r),L=(0,y.useRef)(!0),R=(0,y.useRef)(!0),ee=(0,y.useRef)(l),z=(0,y.useRef)(u),B=(0,y.useRef)(d),V=(0,y.useRef)(!1),H=(0,y.useRef)(i),U=(0,y.useRef)(a),W=(0,y.useRef)(g),G=(0,y.useRef)(j),K=(0,y.useRef)(M),q=(0,y.useRef)(null),J=(0,y.useRef)(null);(0,y.useEffect)(()=>{N.current=n},[n]),(0,y.useEffect)(()=>{I.current=r},[r]),(0,y.useEffect)(()=>{W.current=g},[g]),(0,y.useEffect)(()=>{G.current=j},[j]),(0,y.useEffect)(()=>{K.current=M},[M]),(0,y.useEffect)(()=>{q.current?.cancelPending()},[l]),(0,y.useEffect)(()=>{if(!D.current)return;let t=vg({container:D.current,elements:fy(e,o,w,{folded:T??new Set,memberships:E}),selectionType:`additive`,boxSelectionEnabled:!0,style:ly(b,x,S,C,f,d,p),wheelSensitivity:.1,layout:{name:`null`}});O.current=t,P.current?.(()=>t.png({full:!0,scale:2,bg:`#ffffff`})),t.on(`tap`,`node`,e=>{let t=e.target.id();N.current(t,`node`)}),t.on(`tap`,`edge`,e=>{let t=e.target.id();N.current(t,`edge`)});let n=e=>{let n=e.originalEvent;if(n!=null)return{x:n.clientX,y:n.clientY};let r=t.container()?.getBoundingClientRect(),i=e.renderedPosition;return{x:(r?.left??0)+(i?.x??0),y:(r?.top??0)+(i?.y??0)}};t.on(`cxttap`,`node`,e=>{I.current({type:`node`,id:e.target.id()},n(e))}),t.on(`cxttap`,`edge`,e=>{I.current({type:`edge`,id:e.target.id()},n(e))}),t.on(`cxttap`,e=>{e.target===t&&I.current({type:`canvas`,id:null},n(e))}),q.current=Dy(t,()=>ee.current,e=>{A(t=>{if(!t.has(e.projectionId))return t;let n=new Set(t);return n.delete(e.projectionId),n}),W.current(e)});let r=Uv(t),i=()=>{J.current={zoom:t.zoom(),pan:{...t.pan()}}};t.on(`layoutstop`,()=>{Sy(t,G.current),i()});let a=D.current,s=0,c=new ResizeObserver(()=>{cancelAnimationFrame(s),s=requestAnimationFrame(()=>{t.resize();let e=J.current;if(e===null)return;let n=t.pan();if(!(Math.abs(t.zoom()-e.zoom)<1e-6&&Math.abs(n.x-e.pan.x)<.5&&Math.abs(n.y-e.pan.y)<.5))return;let r=t.elements(`:visible`);r.empty()||(t.fit(r,Zv),i())})});return c.observe(a),()=>{cancelAnimationFrame(s),c.disconnect(),r(),q.current?.dispose(),P.current?.(null),t.destroy(),O.current=null}},[]),(0,y.useEffect)(()=>{if(O.current){if(R.current){R.current=!1;return}O.current.style(ly(b,x,S,C,f,d,p))}},[b,x,S,C,f,d,p]),(0,y.useEffect)(()=>{if(O.current){if(L.current)L.current=!1;else{let t=fy(e,o,w,{folded:T??new Set,memberships:E});O.current.elements().remove(),O.current.add(t)}my(O.current,H.current,U.current),gy(O.current.elements(`:visible`),u,d,f,{positions:G.current,routes:K.current})}},[e,w,o,E]);let Y=(0,y.useRef)(null);(0,y.useEffect)(()=>{let t=O.current;if(t===null)return;let n=Y.current;if(Y.current=T??new Set,n===null)return;let r=T??new Set,s=[...[...r].filter(e=>!n.has(e)),...[...n].filter(e=>!r.has(e))];s.length!==0&&(t.elements().remove(),t.add(fy(e,o,w,{folded:r,memberships:E})),my(t,i,a),yy(t,u,d,f,s.length===1?s[0]:null,{positions:G.current,routes:K.current}))},[T]),(0,y.useEffect)(()=>{if(O.current){O.current.elements().removeClass(`faulted`);for(let e of s){let t=O.current.getElementById(e);t.nonempty()&&t.addClass(`faulted`)}}},[s,e]),(0,y.useEffect)(()=>{O.current&&cy(O.current,c)},[c,e]),(0,y.useEffect)(()=>{if(O.current&&(O.current.elements().removeClass(`selected`),t)){let e=O.current.getElementById(t);e.nonempty()&&e.addClass(`selected`)}},[t,e]),(0,y.useEffect)(()=>{(l!==ee.current||u!==z.current||d!==B.current)&&(ee.current=l,z.current=u,B.current=d,V.current=!0)},[l,u,d]),(0,y.useEffect)(()=>{if(!O.current)return;my(O.current,i,a);let e=i!==H.current;H.current=i;let t=a!==U.current;U.current=a,V.current||e?(V.current=!1,vy(O.current,u,d,f,{positions:G.current,routes:K.current})):t&&by(O.current)&&(J.current={zoom:O.current.zoom(),pan:{...O.current.pan()}})},[i,a,e,u,d]);let te=()=>{A(e=>new Set(e).add(l)),G.current=void 0,K.current=void 0,q.current?.cancelPending(),O.current!==null&&vy(O.current,u,d,f)},ne=e=>{let t=O.current;t!==null&&t.zoom({level:ty(t.zoom(),e),renderedPosition:{x:t.width()/2,y:t.height()/2}})},re=()=>{let e=O.current;e!==null&&by(e)&&(J.current={zoom:e.zoom(),pan:{...e.pan()}})},ie=Ty(j,e.nodes.map(e=>e.id),i);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{ref:D,style:{position:`relative`,width:`100%`,height:`100%`,...Jg(p).canvas===void 0?{}:{background:Jg(p).canvas}},onContextMenu:e=>e.preventDefault(),onDragOver:e=>{F.current!==void 0&&e.dataTransfer.types.includes(`application/x-yarramate-kind`)&&e.preventDefault()},onDrop:e=>{let t=e.dataTransfer.getData(G_);if(t===``||F.current===void 0)return;e.preventDefault();let n=e.currentTarget.getBoundingClientRect(),r=O.current;F.current(t,Ey({x:e.clientX-n.left,y:e.clientY-n.top},r?.pan()??{x:0,y:0},r?.zoom()??1))}}),ie?(0,$.jsxs)(`div`,{className:`saved-layout-pill`,role:`status`,children:[(0,$.jsx)(`span`,{children:`Saved layout in force`}),(0,$.jsx)(`button`,{type:`button`,onClick:te,children:`Discard`})]}):null,(0,$.jsxs)(`div`,{className:`zoom-controls`,role:`group`,"aria-label":`Zoom controls`,children:[(0,$.jsx)(`button`,{type:`button`,"aria-label":`Zoom in`,onClick:()=>ne(1),children:`+`}),(0,$.jsx)(`button`,{type:`button`,"aria-label":`Zoom out`,onClick:()=>ne(-1),children:`−`}),(0,$.jsx)(`button`,{type:`button`,"aria-label":`Fit diagram`,onClick:re,children:`Fit`})]})]})}var ky=Symbol.for(`yaml.alias`),Ay=Symbol.for(`yaml.document`),jy=Symbol.for(`yaml.map`),My=Symbol.for(`yaml.pair`),Ny=Symbol.for(`yaml.scalar`),Py=Symbol.for(`yaml.seq`),Fy=Symbol.for(`yaml.node.type`),Iy=e=>!!e&&typeof e==`object`&&e[Fy]===ky,Ly=e=>!!e&&typeof e==`object`&&e[Fy]===Ay,Ry=e=>!!e&&typeof e==`object`&&e[Fy]===jy,zy=e=>!!e&&typeof e==`object`&&e[Fy]===My,By=e=>!!e&&typeof e==`object`&&e[Fy]===Ny,Vy=e=>!!e&&typeof e==`object`&&e[Fy]===Py;function Hy(e){if(e&&typeof e==`object`)switch(e[Fy]){case jy:case Py:return!0}return!1}function Uy(e){if(e&&typeof e==`object`)switch(e[Fy]){case ky:case jy:case Ny:case Py:return!0}return!1}var Wy=e=>(By(e)||Hy(e))&&!!e.anchor,Gy=Symbol(`break visit`),Ky=Symbol(`skip children`),qy=Symbol(`remove node`);function Jy(e,t){let n=Xy(t);Ly(e)?Yy(null,e.contents,n,Object.freeze([e]))===qy&&(e.contents=null):Yy(null,e,n,Object.freeze([]))}Jy.BREAK=Gy,Jy.SKIP=Ky,Jy.REMOVE=qy;function Yy(e,t,n,r){let i=Zy(e,t,n,r);if(Uy(i)||zy(i))return Qy(e,r,i),Yy(e,i,n,r);if(typeof i!=`symbol`){if(Hy(t)){r=Object.freeze(r.concat(t));for(let e=0;e<t.items.length;++e){let i=Yy(e,t.items[e],n,r);if(typeof i==`number`)e=i-1;else if(i===Gy)return Gy;else i===qy&&(t.items.splice(e,1),--e)}}else if(zy(t)){r=Object.freeze(r.concat(t));let e=Yy(`key`,t.key,n,r);if(e===Gy)return Gy;e===qy&&(t.key=null);let i=Yy(`value`,t.value,n,r);if(i===Gy)return Gy;i===qy&&(t.value=null)}}return i}function Xy(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 Zy(e,t,n,r){if(typeof n==`function`)return n(e,t,r);if(Ry(t))return n.Map?.(e,t,r);if(Vy(t))return n.Seq?.(e,t,r);if(zy(t))return n.Pair?.(e,t,r);if(By(t))return n.Scalar?.(e,t,r);if(Iy(t))return n.Alias?.(e,t,r)}function Qy(e,t,n){let r=t[t.length-1];if(Hy(r))r.items[e]=n;else if(zy(r))e===`key`?r.key=n:r.value=n;else if(Ly(r))r.contents=n;else{let e=Iy(r)?`alias`:`scalar`;throw Error(`Cannot replace node with ${e} parent`)}}var $y={"!":`%21`,",":`%2C`,"[":`%5B`,"]":`%5D`,"{":`%7B`,"}":`%7D`},eb=e=>e.replace(/[!,[\]{}]/g,e=>$y[e]),tb=class e{constructor(t,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},e.defaultYaml,t),this.tags=Object.assign({},e.defaultTags,n)}clone(){let t=new e(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){let t=new e(this.yaml,this.tags);switch(this.yaml.version){case`1.1`:this.atNextDocument=!0;break;case`1.2`:this.atNextDocument=!1,this.yaml={explicit:e.defaultYaml.explicit,version:`1.2`},this.tags=Object.assign({},e.defaultTags)}return t}add(t,n){this.atNextDocument&&=(this.yaml={explicit:e.defaultYaml.explicit,version:`1.1`},this.tags=Object.assign({},e.defaultTags),!1);let r=t.trim().split(/[ \t]+/),i=r.shift();switch(i){case`%TAG`:{if(r.length!==2&&(n(0,`%TAG directive should contain exactly two parts`),r.length<2))return!1;let[e,t]=r;return this.tags[e]=t,!0}case`%YAML`:{if(this.yaml.explicit=!0,r.length!==1)return n(0,`%YAML directive should contain exactly one part`),!1;let[e]=r;if(e===`1.1`||e===`1.2`)return this.yaml.version=e,!0;{let t=/^\d+\.\d+$/.test(e);return n(6,`Unsupported YAML version ${e}`,t),!1}}default:return n(0,`Unknown directive ${i}`,!0),!1}}tagName(e,t){if(e===`!`)return`!`;if(e[0]!==`!`)return t(`Not a valid tag: ${e}`),null;if(e[1]===`<`){let n=e.slice(2,-1);return n===`!`||n===`!!`?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==`>`&&t(`Verbatim tags must end with a >`),n)}let[,n,r]=e.match(/^(.*!)([^!]*)$/s);r||t(`The ${e} tag has no suffix`);let i=this.tags[n];if(i)try{return i+decodeURIComponent(r)}catch(e){return t(String(e)),null}return n===`!`?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[t,n]of Object.entries(this.tags))if(e.startsWith(n))return t+eb(e.substring(n.length));return e[0]===`!`?e:`!<${e}>`}toString(e){let t=this.yaml.explicit?[`%YAML ${this.yaml.version||`1.2`}`]:[],n=Object.entries(this.tags),r;if(e&&n.length>0&&Uy(e.contents)){let t={};Jy(e.contents,(e,n)=>{Uy(n)&&n.tag&&(t[n.tag]=!0)}),r=Object.keys(t)}else r=[];for(let[i,a]of n)(i!==`!!`||a!==`tag:yaml.org,2002:`)&&(!e||r.some(e=>e.startsWith(a)))&&t.push(`%TAG ${i} ${a}`);return t.join(`
330
+ `)}};tb.defaultYaml={explicit:!1,version:`1.2`},tb.defaultTags={"!!":`tag:yaml.org,2002:`};function nb(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 rb(e){let t=new Set;return Jy(e,{Value(e,n){n.anchor&&t.add(n.anchor)}}),t}function ib(e,t){for(let n=1;;++n){let r=`${e}${n}`;if(!t.has(r))return r}}function ab(e,t){let n=[],r=new Map,i=null;return{onAnchor:r=>{n.push(r),i??=rb(e);let a=ib(t,i);return i.add(a),a},setAnchors:()=>{for(let e of n){let t=r.get(e);if(typeof t==`object`&&t.anchor&&(By(t.node)||Hy(t.node)))t.node.anchor=t.anchor;else{let t=Error(`Failed to resolve repeated object (this should not happen)`);throw t.source=e,t}}},sourceObjects:r}}function ob(e,t,n,r){if(r&&typeof r==`object`){if(Array.isArray(r))for(let t=0,n=r.length;t<n;++t){let n=r[t],i=ob(e,r,String(t),n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}else if(r instanceof Map)for(let t of Array.from(r.keys())){let n=r.get(t),i=ob(e,r,t,n);i===void 0?r.delete(t):i!==n&&r.set(t,i)}else if(r instanceof Set)for(let t of Array.from(r)){let n=ob(e,r,t,t);n===void 0?r.delete(t):n!==t&&(r.delete(t),r.add(n))}else for(let[t,n]of Object.entries(r)){let i=ob(e,r,t,n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}}return e.call(t,n,r)}function sb(e,t,n){if(Array.isArray(e))return e.map((e,t)=>sb(e,String(t),n));if(e&&typeof e.toJSON==`function`){if(!n||!Wy(e))return e.toJSON(t,n);let r={aliasCount:0,count:1,res:void 0};n.anchors.set(e,r),n.onCreate=e=>{r.res=e,delete n.onCreate};let i=e.toJSON(t,n);return n.onCreate&&n.onCreate(i),i}return typeof e==`bigint`&&!n?.keep?Number(e):e}var cb=class{constructor(e){Object.defineProperty(this,Fy,{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:i}={}){if(!Ly(e))throw TypeError(`A document argument is required`);let a={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof n==`number`?n:100},o=sb(this,``,a);if(typeof r==`function`)for(let{count:e,res:t}of a.anchors.values())r(t,e);return typeof i==`function`?ob(i,{"":o},``,o):o}},lb=class extends cb{constructor(e){super(ky),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=[],Jy(e,{Node:(e,t)=>{(Iy(t)||Wy(t))&&n.push(t)}}),t&&(t.aliasResolveCache=n));let r;for(let e of n){if(e===this)break;e.anchor===this.source&&(r=e)}return r}toJSON(e,t){if(!t)return{source:this.source};let{anchors:n,doc:r,maxAliasCount:i}=t,a=this.resolve(r,t);if(!a){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(e)}let o=n.get(a);if(o||=(sb(a,null,t),n.get(a)),o?.res===void 0)throw ReferenceError(`This should not happen: Alias anchor was not resolved?`);if(i>=0&&(o.count+=1,o.aliasCount===0&&(o.aliasCount=ub(r,a,n)),o.count*o.aliasCount>i))throw ReferenceError(`Excessive alias count indicates a resource exhaustion attack`);return o.res}toString(e,t,n){let r=`*${this.source}`;if(e){if(nb(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(e)}if(e.implicitKey)return`${r} `}return r}};function ub(e,t,n){if(Iy(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}if(Hy(t)){let r=0;for(let i of t.items){let t=ub(e,i,n);t>r&&(r=t)}return r}if(zy(t)){let r=ub(e,t.key,n),i=ub(e,t.value,n);return Math.max(r,i)}return 1}var db=e=>!e||typeof e!=`function`&&typeof e!=`object`,fb=class extends cb{constructor(e){super(Ny),this.value=e}toJSON(e,t){return t?.keep?this.value:sb(this.value,e,t)}toString(){return String(this.value)}};fb.BLOCK_FOLDED=`BLOCK_FOLDED`,fb.BLOCK_LITERAL=`BLOCK_LITERAL`,fb.PLAIN=`PLAIN`,fb.QUOTE_DOUBLE=`QUOTE_DOUBLE`,fb.QUOTE_SINGLE=`QUOTE_SINGLE`;var pb=`tag:yaml.org,2002:`;function mb(e,t,n){if(t){let e=n.filter(e=>e.tag===t),r=e.find(e=>!e.format)??e[0];if(!r)throw Error(`Tag ${t} not found`);return r}return n.find(t=>t.identify?.(e)&&!t.format)}function hb(e,t,n){if(Ly(e)&&(e=e.contents),Uy(e))return e;if(zy(e)){let t=n.schema[jy].createNode?.(n.schema,null,n);return t.items.push(e),t}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<`u`&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:r,onAnchor:i,onTagObj:a,schema:o,sourceObjects:s}=n,c;if(r&&e&&typeof e==`object`){if(c=s.get(e),c)return c.anchor??(c.anchor=i(e)),new lb(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith(`!!`)&&(t=pb+t.slice(2));let l=mb(e,t,o.tags);if(!l){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new fb(e);return c&&(c.node=t),t}l=e instanceof Map?o[jy]:Symbol.iterator in Object(e)?o[Py]:o[jy]}a&&(a(l),delete n.onTagObj);let u=l?.createNode?l.createNode(n.schema,e,n):typeof l?.nodeClass?.from==`function`?l.nodeClass.from(n.schema,e,n):new fb(e);return t?u.tag=t:l.default||(u.tag=l.tag),c&&(c.node=u),u}function gb(e,t,n){let r=n;for(let e=t.length-1;e>=0;--e){let n=t[e];if(typeof n==`number`&&Number.isInteger(n)&&n>=0){let e=[];e[n]=r,r=e}else r=new Map([[n,r]])}return hb(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error(`This should not happen, please report a bug.`)},schema:e,sourceObjects:new Map})}var _b=e=>e==null||typeof e==`object`&&!!e[Symbol.iterator]().next().done,vb=class extends cb{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(t=>Uy(t)||zy(t)?t.clone(e):t),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(_b(e))this.add(t);else{let[n,...r]=e,i=this.get(n,!0);if(Hy(i))i.addIn(r,t);else if(i===void 0&&this.schema)this.set(n,gb(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(Hy(r))return r.deleteIn(n);throw Error(`Expected YAML collection at ${t}. Remaining path: ${n}`)}getIn(e,t){let[n,...r]=e,i=this.get(n,!0);return r.length===0?!t&&By(i)?i.value:i:Hy(i)?i.getIn(r,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!zy(t))return!1;let n=t.value;return n==null||e&&By(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 Hy(r)?r.hasIn(n):!1}setIn(e,t){let[n,...r]=e;if(r.length===0)this.set(n,t);else{let e=this.get(n,!0);if(Hy(e))e.setIn(r,t);else if(e===void 0&&this.schema)this.set(n,gb(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}},yb=e=>e.replace(/^(?!$)(?: $)?/gm,`#`);function bb(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}var xb=(e,t,n)=>e.endsWith(`
331
+ `)?bb(n,t):n.includes(`
332
+ `)?`
333
+ `+bb(n,t):(e.endsWith(` `)?``:` `)+n,Sb=`flow`,Cb=`block`,wb=`quoted`;function Tb(e,t,n=`flow`,{indentAtStart:r,lineWidth:i=80,minContentWidth:a=20,onFold:o,onOverflow:s}={}){if(!i||i<0)return e;i<a&&(a=0);let c=Math.max(1+a,1+i-t.length);if(e.length<=c)return e;let l=[],u={},d=i-t.length;typeof r==`number`&&(r>i-Math.max(2,a)?l.push(0):d=i-r);let f,p,m=!1,h=-1,g=-1,_=-1;n===`block`&&(h=Eb(e,h,t.length),h!==-1&&(d=h+c));for(let r;r=e[h+=1];){if(n===`quoted`&&r===`\\`){switch(g=h,e[h+1]){case`x`:h+=3;break;case`u`:h+=5;break;case`U`:h+=9;break;default:h+=1}_=h}if(r===`
334
+ `)n===`block`&&(h=Eb(e,h,t.length)),d=h+t.length+c,f=void 0;else{if(r===` `&&p&&p!==` `&&p!==`
335
+ `&&p!==` `){let t=e[h+1];t&&t!==` `&&t!==`
336
+ `&&t!==` `&&(f=h)}if(h>=d){if(f)l.push(f),d=f+c,f=void 0;else if(n===`quoted`){for(;p===` `||p===` `;)p=r,r=e[h+=1],m=!0;let t=h>_+1?h-2:g-1;if(u[t])return e;l.push(t),u[t]=!0,d=t+c,f=void 0}else m=!0}}p=r}if(m&&s&&s(),l.length===0)return e;o&&o();let v=e.slice(0,l[0]);for(let r=0;r<l.length;++r){let i=l[r],a=l[r+1]||e.length;i===0?v=`\n${t}${e.slice(0,a)}`:(n===`quoted`&&u[i]&&(v+=`${e[i]}\\`),v+=`\n${t}${e.slice(i+1,a)}`)}return v}function Eb(e,t,n){let r=t,i=t+1,a=e[i];for(;a===` `||a===` `;)if(t<i+n)a=e[++t];else{do a=e[++t];while(a&&a!==`
337
+ `);r=t,i=t+1,a=e[i]}return r}var Db=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),Ob=e=>/^(%|---|\.\.\.)/m.test(e);function kb(e,t,n){if(!t||t<0)return!1;let r=t-n,i=e.length;if(i<=r)return!1;for(let t=0,n=0;t<i;++t)if(e[t]===`
338
+ `){if(t-n>r)return!0;if(n=t+1,i-n<=r)return!1}return!0}function Ab(e,t){let n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;let{implicitKey:r}=t,i=t.options.doubleQuotedMinMultiLineLength,a=t.indent||(Ob(e)?` `:``),o=``,s=0;for(let e=0,t=n[e];t;t=n[++e])if(t===` `&&n[e+1]===`\\`&&n[e+2]===`n`&&(o+=n.slice(s,e)+`\\ `,e+=1,s=e,t=`\\`),t===`\\`)switch(n[e+1]){case`u`:{o+=n.slice(s,e);let t=n.substr(e+2,4);switch(t){case`0000`:o+=`\\0`;break;case`0007`:o+=`\\a`;break;case`000b`:o+=`\\v`;break;case`001b`:o+=`\\e`;break;case`0085`:o+=`\\N`;break;case`00a0`:o+=`\\_`;break;case`2028`:o+=`\\L`;break;case`2029`:o+=`\\P`;break;default:t.substr(0,2)===`00`?o+=`\\x`+t.substr(2):o+=n.substr(e,6)}e+=5,s=e+1}break;case`n`:if(r||n[e+2]===`"`||n.length<i)e+=1;else{for(o+=n.slice(s,e)+`
339
+
340
+ `;n[e+2]===`\\`&&n[e+3]===`n`&&n[e+4]!==`"`;)o+=`
341
+ `,e+=2;o+=a,n[e+2]===` `&&(o+=`\\`),e+=1,s=e+1}break;default:e+=1}return o=s?o+n.slice(s):n,r?o:Tb(o,a,wb,Db(t,!1))}function jb(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
342
+ `)||/[ \t]\n|\n[ \t]/.test(e))return Ab(e,t);let n=t.indent||(Ob(e)?` `:``),r=`'`+e.replace(/'/g,`''`).replace(/\n+/g,`$&\n${n}`)+`'`;return t.implicitKey?r:Tb(r,n,Sb,Db(t,!1))}function Mb(e,t){let{singleQuote:n}=t.options,r;if(n===!1)r=Ab;else{let t=e.includes(`"`),i=e.includes(`'`);r=t&&!i?jb:i&&!t?Ab:n?jb:Ab}return r(e,t)}var Nb;try{Nb=RegExp(`(^|(?<!
343
+ ))
344
+ +(?!
345
+ |$)`,`g`)}catch{Nb=/\n+(?!\n|$)/g}function Pb({comment:e,type:t,value:n},r,i,a){let{blockQuote:o,commentString:s,lineWidth:c}=r.options;if(!o||/\n[\t ]+$/.test(n))return Mb(n,r);let l=r.indent||(r.forceBlockIndent||Ob(n)?` `:``),u=o===`literal`?!0:o===`folded`||t===fb.BLOCK_FOLDED?!1:t===fb.BLOCK_LITERAL||!kb(n,c,l.length);if(!n)return u?`|
346
+ `:`>
347
+ `;let d,f;for(f=n.length;f>0;--f){let e=n[f-1];if(e!==`
348
+ `&&e!==` `&&e!==` `)break}let p=n.substring(f),m=p.indexOf(`
349
+ `);m===-1?d=`-`:n===p||m!==p.length-1?(d=`+`,a&&a()):d=``,p&&=(n=n.slice(0,-p.length),p[p.length-1]===`
350
+ `&&(p=p.slice(0,-1)),p.replace(Nb,`$&${l}`));let h=!1,g,_=-1;for(g=0;g<n.length;++g){let e=n[g];if(e===` `)h=!0;else if(e===`
351
+ `)_=g;else break}let v=n.substring(0,_<g?_+1:g);v&&=(n=n.substring(v.length),v.replace(/\n+/g,`$&${l}`));let y=(h?l?`2`:`1`:``)+d;if(e&&(y+=` `+s(e.replace(/ ?[\r\n]+/g,` `)),i&&i()),!u){let e=n.replace(/\n+/g,`
352
+ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\n+/g,`$&${l}`),i=!1,a=Db(r,!0);o!==`folded`&&t!==fb.BLOCK_FOLDED&&(a.onOverflow=()=>{i=!0});let s=Tb(`${v}${e}${p}`,l,Cb,a);if(!i)return`>${y}\n${l}${s}`}return n=n.replace(/\n+/g,`$&${l}`),`|${y}\n${l}${v}${n}${p}`}function Fb(e,t,n,r){let{type:i,value:a}=e,{actualString:o,implicitKey:s,indent:c,indentStep:l,inFlow:u}=t;if(s&&a.includes(`
353
+ `)||u&&/[[\]{},]/.test(a))return Mb(a,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(a))return s||u||!a.includes(`
354
+ `)?Mb(a,t):Pb(e,t,n,r);if(!s&&!u&&i!==fb.PLAIN&&a.includes(`
355
+ `))return Pb(e,t,n,r);if(Ob(a)){if(c===``)return t.forceBlockIndent=!0,Pb(e,t,n,r);if(s&&c===l)return Mb(a,t)}let d=a.replace(/\n+/g,`$&\n${c}`);if(o){let e=e=>e.default&&e.tag!==`tag:yaml.org,2002:str`&&e.test?.test(d),{compat:n,tags:r}=t.doc.schema;if(r.some(e)||n?.some(e))return Mb(a,t)}return s?d:Tb(d,c,Sb,Db(t,!1))}function Ib(e,t,n,r){let{implicitKey:i,inFlow:a}=t,o=typeof e.value==`string`?e:Object.assign({},e,{value:String(e.value)}),{type:s}=e;s!==fb.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(s=fb.QUOTE_DOUBLE);let c=e=>{switch(e){case fb.BLOCK_FOLDED:case fb.BLOCK_LITERAL:return i||a?Mb(o.value,t):Pb(o,t,n,r);case fb.QUOTE_DOUBLE:return Ab(o.value,t);case fb.QUOTE_SINGLE:return jb(o.value,t);case fb.PLAIN:return Fb(o,t,n,r);default:return null}},l=c(s);if(l===null){let{defaultKeyType:e,defaultStringType:n}=t.options,r=i&&e||n;if(l=c(r),l===null)throw Error(`Unsupported default string type ${r}`)}return l}function Lb(e,t){let n=Object.assign({blockQuote:!0,commentString:yb,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 Rb(e,t){if(t.tag){let n=e.filter(e=>e.tag===t.tag);if(n.length>0)return n.find(e=>e.format===t.format)??n[0]}let n,r;if(By(t)){r=t.value;let i=e.filter(e=>e.identify?.(r));if(i.length>1){let e=i.filter(e=>e.test);e.length>0&&(i=e)}n=i.find(e=>e.format===t.format)??i.find(e=>!e.format)}else r=t,n=e.find(e=>e.nodeClass&&r instanceof e.nodeClass);if(!n){let e=r?.constructor?.name??(r===null?`null`:typeof r);throw Error(`Tag not resolved for ${e} value`)}return n}function zb(e,t,{anchors:n,doc:r}){if(!r.directives)return``;let i=[],a=(By(e)||Hy(e))&&e.anchor;a&&nb(a)&&(n.add(a),i.push(`&${a}`));let o=e.tag??(t.default?null:t.tag);return o&&i.push(r.directives.tagString(o)),i.join(` `)}function Bb(e,t,n,r){if(zy(e))return e.toString(t,n,r);if(Iy(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 i,a=Uy(e)?e:t.doc.createNode(e,{onTagObj:e=>i=e});i??=Rb(t.doc.schema.tags,a);let o=zb(a,i,t);o.length>0&&(t.indentAtStart=(t.indentAtStart??0)+o.length+1);let s=typeof i.stringify==`function`?i.stringify(a,t,n,r):By(a)?Ib(a,t,n,r):a.toString(t,n,r);return o?By(a)||s[0]===`{`||s[0]===`[`?`${o} ${s}`:`${o}\n${t.indent}${s}`:s}function Vb({key:e,value:t},n,r,i){let{allNullValues:a,doc:o,indent:s,indentStep:c,options:{commentString:l,indentSeq:u,simpleKeys:d}}=n,f=Uy(e)&&e.comment||null;if(d){if(f)throw Error(`With simple keys, key nodes cannot have comments`);if(Hy(e)||!Uy(e)&&typeof e==`object`)throw Error(`With simple keys, collection cannot be used as a key value`)}let p=!d&&(!e||f&&t==null&&!n.inFlow||Hy(e)||(By(e)?e.type===fb.BLOCK_FOLDED||e.type===fb.BLOCK_LITERAL:typeof e==`object`));n=Object.assign({},n,{allNullValues:!1,implicitKey:!p&&(d||!a),indent:s+c});let m=!1,h=!1,g=Bb(e,n,()=>m=!0,()=>h=!0);if(!p&&!n.inFlow&&g.length>1024){if(d)throw Error(`With simple keys, single line scalar must not span more than 1024 characters`);p=!0}if(n.inFlow){if(a||t==null)return m&&r&&r(),g===``?`?`:p?`? ${g}`:g}else if(a&&!d||t==null&&p)return g=`? ${g}`,f&&!m?g+=xb(g,n.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=xb(g,n.indent,l(f))),g=`? ${g}\n${s}:`):(g=`${g}:`,f&&(g+=xb(g,n.indent,l(f))));let _,v,y;Uy(t)?(_=!!t.spaceBefore,v=t.commentBefore,y=t.comment):(_=!1,v=null,y=null,t&&typeof t==`object`&&(t=o.createNode(t))),n.implicitKey=!1,!p&&!f&&By(t)&&(n.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!n.inFlow&&!p&&Vy(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let b=!1,x=Bb(t,n,()=>b=!0,()=>h=!0),S=` `;if(f||_||v){if(S=_?`
356
+ `:``,v){let e=l(v);S+=`\n${bb(e,n.indent)}`}x===``&&!n.inFlow?S===`
357
+ `&&y&&(S=`
358
+
359
+ `):S+=`\n${n.indent}`}else if(!p&&Hy(t)){let e=x[0],r=x.indexOf(`
360
+ `),i=r!==-1,a=n.inFlow??t.flow??t.items.length===0;if(i||!a){let t=!1;if(i&&(e===`&`||e===`!`)){let n=x.indexOf(` `);e===`&`&&n!==-1&&n<r&&x[n+1]===`!`&&(n=x.indexOf(` `,n+1)),(n===-1||r<n)&&(t=!0)}t||(S=`\n${n.indent}`)}}else(x===``||x[0]===`
361
+ `)&&(S=``);return g+=S+x,n.inFlow?b&&r&&r():y&&!b?g+=xb(g,n.indent,l(y)):h&&i&&i(),g}function Hb(e,t){(e===`debug`||e===`warn`)&&console.warn(t)}var Ub=`<<`,Wb={identify:e=>e===Ub||typeof e==`symbol`&&e.description===Ub,default:`key`,tag:`tag:yaml.org,2002:merge`,test:/^<<$/,resolve:()=>Object.assign(new fb(Symbol(Ub)),{addToJSMap:Kb}),stringify:()=>Ub},Gb=(e,t)=>(Wb.identify(t)||By(t)&&(!t.type||t.type===fb.PLAIN)&&Wb.identify(t.value))&&e?.doc.schema.tags.some(e=>e.tag===Wb.tag&&e.default);function Kb(e,t,n){let r=Jb(e,n);if(Vy(r))for(let n of r.items)qb(e,t,n);else if(Array.isArray(r))for(let n of r)qb(e,t,n);else qb(e,t,r)}function qb(e,t,n){let r=Jb(e,n);if(!Ry(r))throw Error(`Merge sources must be maps or map aliases`);let i=r.toJSON(null,e,Map);for(let[e,n]of i)t instanceof Map?t.has(e)||t.set(e,n):t instanceof Set?t.add(e):Object.prototype.hasOwnProperty.call(t,e)||Object.defineProperty(t,e,{value:n,writable:!0,enumerable:!0,configurable:!0});return t}function Jb(e,t){return e&&Iy(t)?t.resolve(e.doc,e):t}function Yb(e,t,{key:n,value:r}){if(Uy(n)&&n.addToJSMap)n.addToJSMap(e,t,r);else if(Gb(e,n))Kb(e,t,r);else{let i=sb(n,``,e);if(t instanceof Map)t.set(i,sb(r,i,e));else if(t instanceof Set)t.add(i);else{let a=Xb(n,i,e),o=sb(r,a,e);a in t?Object.defineProperty(t,a,{value:o,writable:!0,enumerable:!0,configurable:!0}):t[a]=o}}return t}function Xb(e,t,n){if(t===null)return``;if(typeof t!=`object`)return String(t);if(Uy(e)&&n?.doc){let t=Lb(n.doc,{});t.anchors=new Set;for(let e of n.anchors.keys())t.anchors.add(e.anchor);t.inFlow=!0,t.inStringifyKey=!0;let r=e.toString(t);if(!n.mapKeyWarned){let e=JSON.stringify(r);e.length>40&&(e=e.substring(0,36)+`..."`),Hb(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${e}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return r}return JSON.stringify(t)}function Zb(e,t,n){return new Qb(hb(e,void 0,n),hb(t,void 0,n))}var Qb=class e{constructor(e,t=null){Object.defineProperty(this,Fy,{value:My}),this.key=e,this.value=t}clone(t){let{key:n,value:r}=this;return Uy(n)&&(n=n.clone(t)),Uy(r)&&(r=r.clone(t)),new e(n,r)}toJSON(e,t){return Yb(t,t?.mapAsMap?new Map:{},this)}toString(e,t,n){return e?.doc?Vb(this,e,t,n):JSON.stringify(this)}};function $b(e,t,n){return(t.inFlow??e.flow?tx:ex)(e,t,n)}function ex({comment:e,items:t},n,{blockItemPrefix:r,flowChars:i,itemIndent:a,onChompKeep:o,onComment:s}){let{indent:c,options:{commentString:l}}=n,u=Object.assign({},n,{indent:a,type:null}),d=!1,f=[];for(let e=0;e<t.length;++e){let i=t[e],o=null;if(Uy(i))!d&&i.spaceBefore&&f.push(``),nx(n,f,i.commentBefore,d),i.comment&&(o=i.comment);else if(zy(i)){let e=Uy(i.key)?i.key:null;e&&(!d&&e.spaceBefore&&f.push(``),nx(n,f,e.commentBefore,d))}d=!1;let s=Bb(i,u,()=>o=null,()=>d=!0);o&&(s+=xb(s,a,l(o))),d&&o&&(d=!1),f.push(r+s)}let p;if(f.length===0)p=i.start+i.end;else{p=f[0];for(let e=1;e<f.length;++e){let t=f[e];p+=t?`\n${c}${t}`:`
362
+ `}}return e?(p+=`
363
+ `+bb(l(e),c),s&&s()):d&&o&&o(),p}function tx({items:e},t,{flowChars:n,itemIndent:r}){let{indent:i,indentStep:a,flowCollectionPadding:o,options:{commentString:s}}=t;r+=a;let c=Object.assign({},t,{indent:r,inFlow:!0,type:null}),l=!1,u=0,d=[];for(let n=0;n<e.length;++n){let i=e[n],a=null;if(Uy(i))i.spaceBefore&&d.push(``),nx(t,d,i.commentBefore,!1),i.comment&&(a=i.comment);else if(zy(i)){let e=Uy(i.key)?i.key:null;e&&(e.spaceBefore&&d.push(``),nx(t,d,e.commentBefore,!1),e.comment&&(l=!0));let n=Uy(i.value)?i.value:null;n?(n.comment&&(a=n.comment),n.commentBefore&&(l=!0)):i.value==null&&e?.comment&&(a=e.comment)}a&&(l=!0);let o=Bb(i,c,()=>a=null);l||=d.length>u||o.includes(`
364
+ `),n<e.length-1?o+=`,`:t.options.trailingComma&&(t.options.lineWidth>0&&(l||=d.reduce((e,t)=>e+t.length+2,2)+(o.length+2)>t.options.lineWidth),l&&(o+=`,`)),a&&(o+=xb(o,r,s(a))),d.push(o),u=d.length}let{start:f,end:p}=n;if(d.length===0)return f+p;if(!l){let e=d.reduce((e,t)=>e+t.length+2,2);l=t.options.lineWidth>0&&e>t.options.lineWidth}if(l){let e=f;for(let t of d)e+=t?`\n${a}${i}${t}`:`
365
+ `;return`${e}\n${i}${p}`}return`${f}${o}${d.join(` `)}${o}${p}`}function nx({indent:e,options:{commentString:t}},n,r,i){if(r&&i&&(r=r.replace(/^\n+/,``)),r){let i=bb(t(r),e);n.push(i.trimStart())}}function rx(e,t){let n=By(t)?t.value:t;for(let r of e)if(zy(r)&&(r.key===t||r.key===n||By(r.key)&&r.key.value===n))return r}var ix=class extends vb{static get tagName(){return`tag:yaml.org,2002:map`}constructor(e){super(jy,e),this.items=[]}static from(e,t,n){let{keepUndefined:r,replacer:i}=n,a=new this(e),o=(e,o)=>{if(typeof i==`function`)o=i.call(t,e,o);else if(Array.isArray(i)&&!i.includes(e))return;(o!==void 0||r)&&a.items.push(Zb(e,o,n))};if(t instanceof Map)for(let[e,n]of t)o(e,n);else if(t&&typeof t==`object`)for(let e of Object.keys(t))o(e,t[e]);return typeof e.sortMapEntries==`function`&&a.items.sort(e.sortMapEntries),a}add(e,t){let n;n=zy(e)?e:!e||typeof e!=`object`||!(`key`in e)?new Qb(e,e?.value):new Qb(e.key,e.value);let r=rx(this.items,n.key),i=this.schema?.sortMapEntries;if(r){if(!t)throw Error(`Key ${n.key} already set`);By(r.value)&&db(n.value)?r.value.value=n.value:r.value=n.value}else if(i){let e=this.items.findIndex(e=>i(n,e)<0);e===-1?this.items.push(n):this.items.splice(e,0,n)}else this.items.push(n)}delete(e){let t=rx(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let n=rx(this.items,e)?.value;return(!t&&By(n)?n.value:n)??void 0}has(e){return!!rx(this.items,e)}set(e,t){this.add(new Qb(e,t),!0)}toJSON(e,t,n){let r=n?new n:t?.mapAsMap?new Map:{};t?.onCreate&&t.onCreate(r);for(let e of this.items)Yb(t,r,e);return r}toString(e,t,n){if(!e)return JSON.stringify(this);for(let e of this.items)if(!zy(e))throw Error(`Map items must all be pairs; found ${JSON.stringify(e)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),$b(this,e,{blockItemPrefix:``,flowChars:{start:`{`,end:`}`},itemIndent:e.indent||``,onChompKeep:n,onComment:t})}},ax={collection:`map`,default:!0,nodeClass:ix,tag:`tag:yaml.org,2002:map`,resolve(e,t){return Ry(e)||t(`Expected a mapping for this tag`),e},createNode:(e,t,n)=>ix.from(e,t,n)},ox=class extends vb{static get tagName(){return`tag:yaml.org,2002:seq`}constructor(e){super(Py,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=sx(e);return typeof t==`number`&&this.items.splice(t,1).length>0}get(e,t){let n=sx(e);if(typeof n!=`number`)return;let r=this.items[n];return!t&&By(r)?r.value:r}has(e){let t=sx(e);return typeof t==`number`&&t<this.items.length}set(e,t){let n=sx(e);if(typeof n!=`number`)throw Error(`Expected a valid index, not ${e}.`);let r=this.items[n];By(r)&&db(t)?r.value=t:this.items[n]=t}toJSON(e,t){let n=[];t?.onCreate&&t.onCreate(n);let r=0;for(let e of this.items)n.push(sb(e,String(r++),t));return n}toString(e,t,n){return e?$b(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,i=new this(e);if(t&&Symbol.iterator in Object(t)){let e=0;for(let a of t){if(typeof r==`function`){let n=t instanceof Set?a:String(e++);a=r.call(t,n,a)}i.items.push(hb(a,void 0,n))}}return i}};function sx(e){let t=By(e)?e.value:e;return t&&typeof t==`string`&&(t=Number(t)),typeof t==`number`&&Number.isInteger(t)&&t>=0?t:null}var cx={collection:`seq`,default:!0,nodeClass:ox,tag:`tag:yaml.org,2002:seq`,resolve(e,t){return Vy(e)||t(`Expected a sequence for this tag`),e},createNode:(e,t,n)=>ox.from(e,t,n)},lx={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),Ib(e,t,n,r)}},ux={identify:e=>e==null,createNode:()=>new fb(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new fb(null),stringify:({source:e},t)=>typeof e==`string`&&ux.test.test(e)?e:t.options.nullStr},dx={identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new fb(e[0]===`t`||e[0]===`T`),stringify({source:e,value:t},n){return e&&dx.test.test(e)&&t===(e[0]===`t`||e[0]===`T`)?e:t?n.options.trueStr:n.options.falseStr}};function fx({format:e,minFractionDigits:t,tag:n,value:r}){if(typeof r==`bigint`)return String(r);let i=typeof r==`number`?r:Number(r);if(!isFinite(i))return isNaN(i)?`.nan`:i<0?`-.inf`:`.inf`;let a=Object.is(r,-0)?`-0`:JSON.stringify(r);if(!e&&t&&(!n||n===`tag:yaml.org,2002:float`)&&/^-?\d/.test(a)&&!a.includes(`e`)){let e=a.indexOf(`.`);e<0&&(e=a.length,a+=`.`);let n=t-(a.length-e-1);for(;n-->0;)a+=`0`}return a}var px={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:fx},mx={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():fx(e)}},hx={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 fb(parseFloat(e)),n=e.indexOf(`.`);return n!==-1&&e[e.length-1]===`0`&&(t.minFractionDigits=e.length-n-1),t},stringify:fx},gx=e=>typeof e==`bigint`||Number.isInteger(e),_x=(e,t,n,{intAsBigInt:r})=>r?BigInt(e):parseInt(e.substring(t),n);function vx(e,t,n){let{value:r}=e;return gx(r)&&r>=0?n+r.toString(t):fx(e)}var yx={identify:e=>gx(e)&&e>=0,default:!0,tag:`tag:yaml.org,2002:int`,format:`OCT`,test:/^0o[0-7]+$/,resolve:(e,t,n)=>_x(e,2,8,n),stringify:e=>vx(e,8,`0o`)},bx={identify:gx,default:!0,tag:`tag:yaml.org,2002:int`,test:/^[-+]?[0-9]+$/,resolve:(e,t,n)=>_x(e,0,10,n),stringify:fx},xx={identify:e=>gx(e)&&e>=0,default:!0,tag:`tag:yaml.org,2002:int`,format:`HEX`,test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,n)=>_x(e,2,16,n),stringify:e=>vx(e,16,`0x`)},Sx=[ax,cx,lx,ux,dx,yx,bx,xx,px,mx,hx];function Cx(e){return typeof e==`bigint`||Number.isInteger(e)}var wx=({value:e})=>JSON.stringify(e),Tx=[{identify:e=>typeof e==`string`,default:!0,tag:`tag:yaml.org,2002:str`,resolve:e=>e,stringify:wx},{identify:e=>e==null,createNode:()=>new fb(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^null$/,resolve:()=>null,stringify:wx},{identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^true$|^false$/,resolve:e=>e===`true`,stringify:wx},{identify:Cx,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})=>Cx(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:wx}],Ex=[ax,cx].concat(Tx,{default:!0,tag:``,test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}}),Dx={identify:e=>e instanceof Uint8Array,default:!1,tag:`tag:yaml.org,2002:binary`,resolve(e,t){if(typeof atob==`function`){let t=atob(e.replace(/[\n\r]/g,``)),n=new Uint8Array(t.length);for(let e=0;e<t.length;++e)n[e]=t.charCodeAt(e);return n}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,i,a){if(!n)return``;let o=n,s;if(typeof btoa==`function`){let e=``;for(let t=0;t<o.length;++t)e+=String.fromCharCode(o[t]);s=btoa(e)}else throw Error(`This environment does not support writing binary tags; either Buffer or btoa is required`);if(t??=fb.BLOCK_LITERAL,t!==fb.QUOTE_DOUBLE){let e=Math.max(r.options.lineWidth-r.indent.length,r.options.minContentWidth),n=Math.ceil(s.length/e),i=Array(n);for(let t=0,r=0;t<n;++t,r+=e)i[t]=s.substr(r,e);s=i.join(t===fb.BLOCK_LITERAL?`
366
+ `:` `)}return Ib({comment:e,type:t,value:s},r,i,a)}};function Ox(e,t){if(Vy(e))for(let n=0;n<e.items.length;++n){let r=e.items[n];if(!zy(r)){if(Ry(r)){r.items.length>1&&t(`Each pair must have its own sequence indicator`);let e=r.items[0]||new Qb(new fb(null));if(r.commentBefore&&(e.key.commentBefore=e.key.commentBefore?`${r.commentBefore}\n${e.key.commentBefore}`:r.commentBefore),r.comment){let t=e.value??e.key;t.comment=t.comment?`${r.comment}\n${t.comment}`:r.comment}r=e}e.items[n]=zy(r)?r:new Qb(r)}}else t(`Expected a sequence for this tag`);return e}function kx(e,t,n){let{replacer:r}=n,i=new ox(e);i.tag=`tag:yaml.org,2002:pairs`;let a=0;if(t&&Symbol.iterator in Object(t))for(let e of t){typeof r==`function`&&(e=r.call(t,String(a++),e));let o,s;if(Array.isArray(e)){if(e.length===2)o=e[0],s=e[1];else throw TypeError(`Expected [key, value] tuple: ${e}`)}else if(e&&e instanceof Object){let t=Object.keys(e);if(t.length===1)o=t[0],s=e[o];else throw TypeError(`Expected tuple with one key, not ${t.length} keys`)}else o=e;i.items.push(Zb(o,s,n))}return i}var Ax={collection:`seq`,default:!1,tag:`tag:yaml.org,2002:pairs`,resolve:Ox,createNode:kx},jx=class e extends ox{constructor(){super(),this.add=ix.prototype.add.bind(this),this.delete=ix.prototype.delete.bind(this),this.get=ix.prototype.get.bind(this),this.has=ix.prototype.has.bind(this),this.set=ix.prototype.set.bind(this),this.tag=e.tag}toJSON(e,t){if(!t)return super.toJSON(e);let n=new Map;t?.onCreate&&t.onCreate(n);for(let e of this.items){let r,i;if(zy(e)?(r=sb(e.key,``,t),i=sb(e.value,r,t)):r=sb(e,``,t),n.has(r))throw Error(`Ordered maps must not include duplicate keys`);n.set(r,i)}return n}static from(e,t,n){let r=kx(e,t,n),i=new this;return i.items=r.items,i}};jx.tag=`tag:yaml.org,2002:omap`;var Mx={collection:`seq`,identify:e=>e instanceof Map,nodeClass:jx,default:!1,tag:`tag:yaml.org,2002:omap`,resolve(e,t){let n=Ox(e,t),r=[];for(let{key:e}of n.items)By(e)&&(r.includes(e.value)?t(`Ordered maps must not include duplicate keys: ${e.value}`):r.push(e.value));return Object.assign(new jx,n)},createNode:(e,t,n)=>jx.from(e,t,n)};function Nx({value:e,source:t},n){return t&&(e?Px:Fx).test.test(t)?t:e?n.options.trueStr:n.options.falseStr}var Px={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 fb(!0),stringify:Nx},Fx={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 fb(!1),stringify:Nx},Ix={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:fx},Lx={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():fx(e)}},Rx={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 fb(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:fx},zx=e=>typeof e==`bigint`||Number.isInteger(e);function Bx(e,t,n,{intAsBigInt:r}){let i=e[0];if((i===`-`||i===`+`)&&(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 t=BigInt(e);return i===`-`?BigInt(-1)*t:t}let a=parseInt(e,n);return i===`-`?-1*a:a}function Vx(e,t,n){let{value:r}=e;if(zx(r)){let e=r.toString(t);return r<0?`-`+n+e.substr(1):n+e}return fx(e)}var Hx={identify:zx,default:!0,tag:`tag:yaml.org,2002:int`,format:`BIN`,test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>Bx(e,2,2,n),stringify:e=>Vx(e,2,`0b`)},Ux={identify:zx,default:!0,tag:`tag:yaml.org,2002:int`,format:`OCT`,test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>Bx(e,1,8,n),stringify:e=>Vx(e,8,`0`)},Wx={identify:zx,default:!0,tag:`tag:yaml.org,2002:int`,test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>Bx(e,0,10,n),stringify:fx},Gx={identify:zx,default:!0,tag:`tag:yaml.org,2002:int`,format:`HEX`,test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>Bx(e,2,16,n),stringify:e=>Vx(e,16,`0x`)},Kx=class e extends ix{constructor(t){super(t),this.tag=e.tag}add(e){let t;t=zy(e)?e:e&&typeof e==`object`&&`key`in e&&`value`in e&&e.value===null?new Qb(e.key,null):new Qb(e,null),rx(this.items,t.key)||this.items.push(t)}get(e,t){let n=rx(this.items,e);return!t&&zy(n)?By(n.key)?n.key.value:n.key:n}set(e,t){if(typeof t!=`boolean`)throw Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);let n=rx(this.items,e);n&&!t?this.items.splice(this.items.indexOf(n),1):!n&&t&&this.items.push(new Qb(e))}toJSON(e,t){return super.toJSON(e,t,Set)}toString(e,t,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),t,n);throw Error(`Set items must all have null values`)}static from(e,t,n){let{replacer:r}=n,i=new this(e);if(t&&Symbol.iterator in Object(t))for(let e of t)typeof r==`function`&&(e=r.call(t,e,e)),i.items.push(Zb(e,null,n));return i}};Kx.tag=`tag:yaml.org,2002:set`;var qx={collection:`map`,identify:e=>e instanceof Set,nodeClass:Kx,default:!1,tag:`tag:yaml.org,2002:set`,createNode:(e,t,n)=>Kx.from(e,t,n),resolve(e,t){if(Ry(e)){if(e.hasAllNullValues(!0))return Object.assign(new Kx,e);t(`Set items must all have null values`)}else t(`Expected a mapping for this tag`);return e}};function Jx(e,t){let n=e[0],r=n===`-`||n===`+`?e.substring(1):e,i=e=>t?BigInt(e):Number(e),a=r.replace(/_/g,``).split(`:`).reduce((e,t)=>e*i(60)+i(t),i(0));return n===`-`?i(-1)*a:a}function Yx(e){let{value:t}=e,n=e=>e;if(typeof t==`bigint`)n=e=>BigInt(e);else if(isNaN(t)||!isFinite(t))return fx(e);let r=``;t<0&&(r=`-`,t*=n(-1));let i=n(60),a=[t%i];return t<60?a.unshift(0):(t=(t-a[0])/i,a.unshift(t%i),t>=60&&(t=(t-a[0])/i,a.unshift(t))),r+a.map(e=>String(e).padStart(2,`0`)).join(`:`).replace(/000000\d*$/,``)}var Xx={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})=>Jx(e,n),stringify:Yx},Zx={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=>Jx(e,!1),stringify:Yx},Qx={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(Qx.test);if(!t)throw Error(`!!timestamp expects a date, starting with yyyy-mm-dd`);let[,n,r,i,a,o,s]=t.map(Number),c=t[7]?Number((t[7]+`00`).substr(1,3)):0,l=Date.UTC(n,r-1,i,a||0,o||0,s||0,c),u=t[8];if(u&&u!==`Z`){let e=Jx(u,!1);Math.abs(e)<30&&(e*=60),l-=6e4*e}return new Date(l)},stringify:({value:e})=>e?.toISOString().replace(/(T00:00:00)?\.000Z$/,``)??``},$x=[ax,cx,lx,ux,Px,Fx,Hx,Ux,Wx,Gx,Ix,Lx,Rx,Dx,Wb,Mx,Ax,qx,Xx,Zx,Qx],eS=new Map([[`core`,Sx],[`failsafe`,[ax,cx,lx]],[`json`,Ex],[`yaml11`,$x],[`yaml-1.1`,$x]]),tS={binary:Dx,bool:dx,float:hx,floatExp:mx,floatNaN:px,floatTime:Zx,int:bx,intHex:xx,intOct:yx,intTime:Xx,map:ax,merge:Wb,null:ux,omap:Mx,pairs:Ax,seq:cx,set:qx,timestamp:Qx},nS={"tag:yaml.org,2002:binary":Dx,"tag:yaml.org,2002:merge":Wb,"tag:yaml.org,2002:omap":Mx,"tag:yaml.org,2002:pairs":Ax,"tag:yaml.org,2002:set":qx,"tag:yaml.org,2002:timestamp":Qx};function rS(e,t,n){let r=eS.get(t);if(r&&!e)return n&&!r.includes(Wb)?r.concat(Wb):r.slice();let i=r;if(!i){if(Array.isArray(e))i=[];else{let e=Array.from(eS.keys()).filter(e=>e!==`yaml11`).map(e=>JSON.stringify(e)).join(`, `);throw Error(`Unknown schema "${t}"; use one of ${e} or define customTags array`)}}if(Array.isArray(e))for(let t of e)i=i.concat(t);else typeof e==`function`&&(i=e(i.slice()));return n&&(i=i.concat(Wb)),i.reduce((e,t)=>{let n=typeof t==`string`?tS[t]:t;if(!n){let e=JSON.stringify(t),n=Object.keys(tS).map(e=>JSON.stringify(e)).join(`, `);throw Error(`Unknown custom tag ${e}; use one of ${n}`)}return e.includes(n)||e.push(n),e},[])}var iS=(e,t)=>e.key<t.key?-1:+(e.key>t.key),aS=class e{constructor({compat:e,customTags:t,merge:n,resolveKnownTags:r,schema:i,sortMapEntries:a,toStringDefaults:o}){this.compat=Array.isArray(e)?rS(e,`compat`):e?rS(null,e):null,this.name=typeof i==`string`&&i||`core`,this.knownTags=r?nS:{},this.tags=rS(t,this.name,n),this.toStringOptions=o??null,Object.defineProperty(this,jy,{value:ax}),Object.defineProperty(this,Ny,{value:lx}),Object.defineProperty(this,Py,{value:cx}),this.sortMapEntries=typeof a==`function`?a:a===!0?iS:null}clone(){let t=Object.create(e.prototype,Object.getOwnPropertyDescriptors(this));return t.tags=this.tags.slice(),t}};function oS(e,t){let n=[],r=t.directives===!0;if(t.directives!==!1&&e.directives){let t=e.directives.toString(e);t?(n.push(t),r=!0):e.directives.docStart&&(r=!0)}r&&n.push(`---`);let i=Lb(e,t),{commentString:a}=i.options;if(e.commentBefore){n.length!==1&&n.unshift(``);let t=a(e.commentBefore);n.unshift(bb(t,``))}let o=!1,s=null;if(e.contents){if(Uy(e.contents)){if(e.contents.spaceBefore&&r&&n.push(``),e.contents.commentBefore){let t=a(e.contents.commentBefore);n.push(bb(t,``))}i.forceBlockIndent=!!e.comment,s=e.contents.comment}let t=s?void 0:()=>o=!0,c=Bb(e.contents,i,()=>s=null,t);s&&(c+=xb(c,``,a(s))),(c[0]===`|`||c[0]===`>`)&&n[n.length-1]===`---`?n[n.length-1]=`--- ${c}`:n.push(c)}else n.push(Bb(e.contents,i));if(e.directives?.docEnd){if(e.comment){let t=a(e.comment);t.includes(`
367
+ `)?(n.push(`...`),n.push(bb(t,``))):n.push(`... ${t}`)}else n.push(`...`)}else{let t=e.comment;t&&o&&(t=t.replace(/^\n+/,``)),t&&((!o||s)&&n[n.length-1]!==``&&n.push(``),n.push(bb(a(t),``)))}return n.join(`
368
+ `)+`
369
+ `}var sS=class e{constructor(e,t,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,Fy,{value:Ay});let r=null;typeof t==`function`||Array.isArray(t)?r=t:n===void 0&&t&&(n=t,t=void 0);let i=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:`warn`,prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:`1.2`},n);this.options=i;let{version:a}=i;n?._directives?(this.directives=n._directives.atDocument(),this.directives.yaml.explicit&&(a=this.directives.yaml.version)):this.directives=new tb({version:a}),this.setSchema(a,n),this.contents=e===void 0?null:this.createNode(e,r,n)}clone(){let t=Object.create(e.prototype,{[Fy]:{value:Ay}});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=Uy(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(e){cS(this.contents)&&this.contents.add(e)}addIn(e,t){cS(this.contents)&&this.contents.addIn(e,t)}createAlias(e,t){if(!e.anchor){let n=rb(this);e.anchor=!t||n.has(t)?ib(t||`a`,n):t}return new lb(e.anchor)}createNode(e,t,n){let r;if(typeof t==`function`)e=t.call({"":e},``,e),r=t;else if(Array.isArray(t)){let e=t.filter(e=>typeof e==`number`||e instanceof String||e instanceof Number).map(String);e.length>0&&(t=t.concat(e)),r=t}else n===void 0&&t&&(n=t,t=void 0);let{aliasDuplicateObjects:i,anchorPrefix:a,flow:o,keepUndefined:s,onTagObj:c,tag:l}=n??{},{onAnchor:u,setAnchors:d,sourceObjects:f}=ab(this,a||`a`),p={aliasDuplicateObjects:i??!0,keepUndefined:s??!1,onAnchor:u,onTagObj:c,replacer:r,schema:this.schema,sourceObjects:f},m=hb(e,l,p);return o&&Hy(m)&&(m.flow=!0),d(),m}createPair(e,t,n={}){return new Qb(this.createNode(e,null,n),this.createNode(t,null,n))}delete(e){return cS(this.contents)?this.contents.delete(e):!1}deleteIn(e){return _b(e)?this.contents!=null&&(this.contents=null,!0):cS(this.contents)?this.contents.deleteIn(e):!1}get(e,t){return Hy(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){return _b(e)?!t&&By(this.contents)?this.contents.value:this.contents:Hy(this.contents)?this.contents.getIn(e,t):void 0}has(e){return Hy(this.contents)?this.contents.has(e):!1}hasIn(e){return _b(e)?this.contents!==void 0:Hy(this.contents)?this.contents.hasIn(e):!1}set(e,t){this.contents==null?this.contents=gb(this.schema,[e],t):cS(this.contents)&&this.contents.set(e,t)}setIn(e,t){_b(e)?this.contents=t:this.contents==null?this.contents=gb(this.schema,Array.from(e),t):cS(this.contents)&&this.contents.setIn(e,t)}setSchema(e,t={}){typeof e==`number`&&(e=String(e));let n;switch(e){case`1.1`:this.directives?this.directives.yaml.version=`1.1`:this.directives=new tb({version:`1.1`}),n={resolveKnownTags:!1,schema:`yaml-1.1`};break;case`1.2`:case`next`:this.directives?this.directives.yaml.version=e:this.directives=new tb({version:e}),n={resolveKnownTags:!0,schema:`core`};break;case null:this.directives&&delete this.directives,n=null;break;default:{let t=JSON.stringify(e);throw Error(`Expected '1.1', '1.2' or null as first argument, but found: ${t}`)}}if(t.schema instanceof Object)this.schema=t.schema;else if(n)this.schema=new aS(Object.assign(n,t));else throw Error(`With a null YAML version, the { schema: Schema } option is required`)}toJS({json:e,jsonArg:t,mapAsMap:n,maxAliasCount:r,onAnchor:i,reviver:a}={}){let o={anchors:new Map,doc:this,keep:!e,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof r==`number`?r:100},s=sb(this.contents,t??``,o);if(typeof i==`function`)for(let{count:e,res:t}of o.anchors.values())i(t,e);return typeof a==`function`?ob(a,{"":s},``,s):s}toJSON(e,t){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:t})}toString(e={}){if(this.errors.length>0)throw Error(`Document with errors cannot be stringified`);if(`indent`in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let t=JSON.stringify(e.indent);throw Error(`"indent" option must be a positive integer, not ${t}`)}return oS(this,e)}};function cS(e){if(Hy(e))return!0;throw Error(`Expected a YAML collection as document contents`)}var lS=Symbol(`break visit`),uS=Symbol(`skip children`),dS=Symbol(`remove item`);function fS(e,t){`type`in e&&e.type===`document`&&(e={start:e.start,value:e.value}),pS(Object.freeze([]),e,t)}fS.BREAK=lS,fS.SKIP=uS,fS.REMOVE=dS,fS.itemAtPath=(e,t)=>{let n=e;for(let[e,r]of t){let t=n?.[e];if(t&&`items`in t)n=t.items[r];else return}return n},fS.parentCollection=(e,t)=>{let n=fS.itemAtPath(e,t.slice(0,-1)),r=t[t.length-1][0],i=n?.[r];if(i&&`items`in i)return i;throw Error(`Parent collection not found`)};function pS(e,t,n){let r=n(t,e);if(typeof r==`symbol`)return r;for(let i of[`key`,`value`]){let a=t[i];if(a&&`items`in a){for(let t=0;t<a.items.length;++t){let r=pS(Object.freeze(e.concat([[i,t]])),a.items[t],n);if(typeof r==`number`)t=r-1;else if(r===lS)return lS;else r===dS&&(a.items.splice(t,1),--t)}typeof r==`function`&&i===`key`&&(r=r(t,e))}}return typeof r==`function`?r(t,e):r}function mS(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 e=Math.round(n);n=e<1?void 0:e>8?{indent:8}:{indent:e}}if(e===void 0){let{keepUndefined:e}=n??t??{};if(!e)return}return Ly(e)&&!r?e.toString(n):new sS(e,r,n).toString(n)}var hS=e=>mS(e,{version:`1.1`})!==mS(e,{version:`1.2`}),gS=(e,t={})=>{let n=new sS(e);return Jy(n,{Scalar(e,t){typeof t.value==`string`&&hS(t.value)&&(t.type=fb.QUOTE_DOUBLE)}}),n.toString(t)},_S=`.yarramate/projections`,vS=e=>{let t=e.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``);return t.length===0?`view`:/^[a-z]/.test(t)?t:`view-${t}`},yS=(e,t)=>{if(!t.has(e))return e;let n=2;for(;t.has(`${e}-${n}`);)n+=1;return`${e}-${n}`},bS=(e,t)=>yS(vS(e),t),xS=e=>`${_S}/${e}.yaml`,SS=e=>e.presentation?.folder??``,CS=(e,t)=>({path:e.path,projection:TS({id:e.id,title:t,description:e.description,query:e.query,presentation:e.presentation})}),wS=(e,t)=>{let n=`${e.title} copy`,r=bS(n,t);return{path:xS(r),projection:TS({id:r,title:n,description:e.description,query:e.query,presentation:e.presentation})}},TS=e=>{let{title:t,description:n,...r}=e.presentation??{};return{format:`yarramate/projection/v1`,id:e.id,version:`1.0`,query:e.query,presentation:{...r,...e.title.trim()===``?{}:{title:e.title},...e.description.trim()===``?{}:{description:e.description}}}},ES=e=>e.subjects!==void 0,DS=(e,t,n)=>{if(!ES(e.query))return OS(e,t,n);let r=e.query.subjects,i=r.includes(t);return(n===`add`?i:!i)?null:{...e,query:{...e.query,subjects:n===`add`?[...r,t]:r.filter(e=>e!==t)}}},OS=(e,t,n)=>{let r=e.query.exclude??[],i=r.includes(t);if(n===`add`?!i:i)return null;let a=n===`add`?r.filter(e=>e!==t):[...r,t],{exclude:o,...s}=e.query;return{...e,query:a.length===0?s:{...s,exclude:a}}},kS=(e,t)=>{if(!ES(e)&&!ES(t)){let n=e.exclude??[],r=t.exclude??[];return[...n.filter(e=>!r.includes(e)).map(e=>`+${e}`),...r.filter(e=>!n.includes(e)).map(e=>`-${e}`)]}return!ES(e)||!ES(t)?[]:[...t.subjects.filter(t=>!e.subjects.includes(t)).map(e=>`+${e}`),...e.subjects.filter(e=>!t.subjects.includes(e)).map(e=>`-${e}`)]},AS=(e,t)=>jS(e)===jS(t),jS=e=>Array.isArray(e)?`[${e.map(jS).join(`,`)}]`:typeof e==`object`&&e?`{${Object.entries(e).filter(([,e])=>e!==void 0).sort(([e],[t])=>e<t?-1:1).map(([e,t])=>`${JSON.stringify(e)}:${jS(t)}`).join(`,`)}}`:JSON.stringify(e)??`null`,MS={subjects:[],documents:[],kinds:[],layers:[],statuses:[],excludeStatuses:[],states:[],owners:[],constraints:[],relationshipKinds:[],kindMatching:``,relationships:``,isolatedConcepts:``},NS=[`planned`,`current`,`retired`],PS=e=>e===null?MS:{subjects:e.subjects??[],documents:e.documents??[],kinds:e.kinds??[],layers:e.layers??[],statuses:e.statuses??[],excludeStatuses:e.excludeStatuses??[],states:e.states??[],owners:e.owners??[],constraints:e.constraints??[],relationshipKinds:e.relationshipKinds??[],kindMatching:e.kindMatching??``,relationships:e.relationships??``,isolatedConcepts:e.isolatedConcepts??``},FS=e=>({...e.subjects.length>0?{subjects:e.subjects}:{},...e.documents.length>0?{documents:e.documents}:{},...e.kinds.length>0?{kinds:e.kinds}:{},...e.layers.length>0?{layers:e.layers}:{},...e.statuses.length>0?{statuses:e.statuses}:{},...e.excludeStatuses.length>0?{excludeStatuses:e.excludeStatuses}:{},...e.states.length>0?{states:e.states}:{},...e.owners.length>0?{owners:e.owners}:{},...e.constraints.length>0?{constraints:e.constraints}:{},...e.relationshipKinds.length>0?{relationshipKinds:e.relationshipKinds}:{},...e.kindMatching===``?{}:{kindMatching:e.kindMatching},...e.relationships===``?{}:{relationships:e.relationships},...e.isolatedConcepts===``?{}:{isolatedConcepts:e.isolatedConcepts}}),IS=({id:e,label:t,values:n,onChange:r})=>{let[i,a]=(0,y.useState)(``),o=()=>{let e=i.trim();a(``),!(e===``||n.includes(e))&&r([...n,e])};return(0,$.jsxs)(`div`,{className:`filter-field`,children:[(0,$.jsx)(`label`,{htmlFor:e,children:t}),(0,$.jsxs)(`div`,{className:`tag-input`,children:[n.map(e=>(0,$.jsxs)(`span`,{className:`tag-chip`,children:[e,(0,$.jsx)(`button`,{type:`button`,"aria-label":`Remove ${e}`,onClick:()=>r(n.filter(t=>t!==e)),children:`×`})]},e)),(0,$.jsx)(`input`,{id:e,type:`text`,value:i,placeholder:`Add…`,onChange:e=>a(e.target.value),onKeyDown:e=>{e.key===`Enter`||e.key===`,`?(e.preventDefault(),o()):e.key===`Backspace`&&i===``&&n.length>0&&r(n.slice(0,-1))},onBlur:o})]})]})},LS=({legend:e,values:t,onChange:n})=>(0,$.jsxs)(`fieldset`,{className:`filter-field filter-checkbox-group`,children:[(0,$.jsx)(`legend`,{children:e}),NS.map(e=>(0,$.jsxs)(`label`,{className:`filter-checkbox-option`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:t.includes(e),onChange:r=>n(r.target.checked?[...t,e]:t.filter(t=>t!==e))}),e]},e))]}),RS=({id:e,label:t,value:n,options:r,onChange:i})=>(0,$.jsxs)(`div`,{className:`filter-field`,children:[(0,$.jsx)(`label`,{htmlFor:e,children:t}),(0,$.jsxs)(`select`,{id:e,value:n,onChange:e=>i(e.target.value),children:[(0,$.jsx)(`option`,{value:``,children:`Any`}),r.map(e=>(0,$.jsx)(`option`,{value:e,children:e},e))]})]}),zS=(e,t)=>n=>e(t,n);function BS({fields:e,onChange:t}){return(0,$.jsxs)(`div`,{className:`filter-grid`,children:[(0,$.jsx)(IS,{id:`filter-subjects`,label:`Subjects`,values:e.subjects,onChange:e=>t(`subjects`,e)}),(0,$.jsx)(IS,{id:`filter-documents`,label:`Documents`,values:e.documents,onChange:e=>t(`documents`,e)}),(0,$.jsx)(IS,{id:`filter-kinds`,label:`Kinds`,values:e.kinds,onChange:e=>t(`kinds`,e)}),(0,$.jsx)(IS,{id:`filter-layers`,label:`Layers`,values:e.layers,onChange:e=>t(`layers`,e)}),(0,$.jsx)(IS,{id:`filter-states`,label:`States`,values:e.states,onChange:e=>t(`states`,e)}),(0,$.jsx)(IS,{id:`filter-owners`,label:`Owners`,values:e.owners,onChange:e=>t(`owners`,e)}),(0,$.jsx)(IS,{id:`filter-constraints`,label:`Constraints`,values:e.constraints,onChange:e=>t(`constraints`,e)}),(0,$.jsx)(IS,{id:`filter-relationship-kinds`,label:`Relationship kinds`,values:e.relationshipKinds,onChange:e=>t(`relationshipKinds`,e)}),(0,$.jsx)(LS,{legend:`Statuses`,values:e.statuses,onChange:e=>t(`statuses`,e)}),(0,$.jsx)(LS,{legend:`Exclude statuses`,values:e.excludeStatuses,onChange:e=>t(`excludeStatuses`,e)}),(0,$.jsx)(RS,{id:`filter-kind-matching`,label:`Kind matching`,value:e.kindMatching,options:[`exact`,`descendants`],onChange:e=>t(`kindMatching`,e)}),(0,$.jsx)(RS,{id:`filter-relationships`,label:`Relationships`,value:e.relationships,options:[`between`,`connected`,`none`],onChange:e=>t(`relationships`,e)}),(0,$.jsx)(RS,{id:`filter-isolated-concepts`,label:`Isolated concepts`,value:e.isolatedConcepts,options:[`include`,`exclude`],onChange:e=>t(`isolatedConcepts`,e)})]})}function VS({showLifecycle:e,showEvidence:t,showOwnership:n,showKindLabels:r,showNudges:i,onTogglePresentation:a}){return(0,$.jsxs)(`fieldset`,{className:`filter-field filter-presentation-group`,children:[(0,$.jsx)(`legend`,{children:`Presentation`}),(0,$.jsxs)(`label`,{className:`filter-checkbox-option`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:e,onChange:e=>zS(a,`showLifecycle`)(e.currentTarget.checked)}),`Lifecycle badges`]}),(0,$.jsxs)(`label`,{className:`filter-checkbox-option`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:t,onChange:e=>zS(a,`showEvidence`)(e.currentTarget.checked)}),`Evidence badges`]}),(0,$.jsxs)(`label`,{className:`filter-checkbox-option`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:n,onChange:e=>zS(a,`showOwnership`)(e.currentTarget.checked)}),`Ownership badges`]}),(0,$.jsxs)(`label`,{className:`filter-checkbox-option`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:r,onChange:e=>zS(a,`showKindLabels`)(e.currentTarget.checked)}),`Kind labels`]}),(0,$.jsxs)(`label`,{className:`filter-checkbox-option`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:i,onChange:e=>zS(a,`showNudges`)(e.currentTarget.checked)}),`Open-question badges`]})]})}var HS=[{id:`view-query`,label:`View query`}],US=e=>JSON.stringify(Object.entries(e??{}).sort(([e],[t])=>e<t?-1:1)),WS=(e,t)=>US(e)===US(t),GS={exclude:`Taken out of this view`,states:`States`,subjects:`Subjects`,instances:`Not inside a named instance`,documents:`Documents`,kinds:`Kinds`,layers:`Layers`,statuses:`Statuses`,excludeStatuses:`Excluded statuses`,owners:`Owners`,constraints:`Constraints`,isolatedConcepts:`Isolated concepts`,unreported:`Not reported`},KS=Object.keys(GS),qS=(e,t,n)=>{if(t===null)return[];let r=new Set(t),i=n===null?null:new Map(n.map(({id:e,facet:t})=>[e,t])),a=new Map;for(let t of e){if(r.has(t.id))continue;let e=i===null?`unreported`:i.get(t.id)??`isolatedConcepts`,n=a.get(e)??[];n.push({id:t.id,title:t.name}),a.set(e,n)}return KS.flatMap(e=>{let t=a.get(e);return t===void 0?[]:[{reason:e,label:GS[e],subjects:t}]})},JS=(e,t)=>{if(t===null)return e.length;let n=new Set(t);return e.filter(e=>n.has(e.id)).length},YS=(e,t)=>{if(e===null||t===null)return 0;let n=new Set(e);return t.filter(({id:e})=>n.has(e)).length},XS=(e,t,n)=>{let r=e.presentation??{},i=e=>r[e]!==void 0||t[e]!==n[e]?{[e]:t[e]}:{};return{...r,...i(`showLifecycle`),...i(`showEvidence`),...i(`showOwnership`),...i(`showKindLabels`)}},ZS=({view:e,query:t,badges:n,opened:r})=>TS({id:e.id,title:e.title,description:e.description,query:t,presentation:XS(e,n,r)}),QS=e=>({op:`write-view`,path:e.view.path,projection:ZS(e)}),$S=e=>{let t=ZS(e),n=TS({id:e.view.id,title:e.view.title,description:e.view.description,query:e.view.query,presentation:e.view.presentation});return US(t.query)!==US(n.query)||US(t.presentation)!==US(n.presentation)};function eC({nodes:e,activeFilter:t,view:n,open:r,tab:i,showLifecycle:a,showEvidence:o,showOwnership:s,showKindLabels:c,showNudges:l,onTogglePresentation:u,onToggleOpen:d,onSelectTab:f,onApply:p,onStage:m,readOnly:h=!1}){let g=(0,y.useRef)(null),[_,v]=(0,y.useState)(()=>PS(n?.query??t?.query??null)),[b,x]=(0,y.useState)(!1),[S]=(0,y.useState)(()=>({showLifecycle:a,showEvidence:o,showOwnership:s,showKindLabels:c})),C=e=>{g.current!==null&&window.clearTimeout(g.current),g.current=window.setTimeout(()=>{g.current=null,p(FS(e))},300)},w=(e,t)=>{x(!1),v(n=>{let r={...n,[e]:t};return C(r),r})},T=FS(_),E=t?.matchedIds??null,D=JS(e,E),O=qS(e,E,t?.excluded??null),k=YS(E,t?.excluded??null),A=t===null?Object.keys(T).length===0:WS(T,t.query),j=n===null?null:{view:n,query:T,badges:{showLifecycle:a,showEvidence:o,showOwnership:s,showKindLabels:c},opened:S};return(0,$.jsxs)(`section`,{className:`bottom-panel`,"aria-label":`Canvas panels`,children:[(0,$.jsxs)(`div`,{className:`bottom-panel-tabs`,role:`tablist`,"aria-label":`Canvas panels`,children:[HS.map(e=>(0,$.jsx)(`button`,{type:`button`,role:`tab`,id:`bottom-tab-${e.id}`,className:`bottom-panel-tab`,"aria-selected":r&&i===e.id,"aria-controls":`bottom-panel-${e.id}`,onClick:()=>{if(r&&i===e.id){d();return}f(e.id)},children:e.label},e.id)),(0,$.jsxs)(`span`,{className:`bottom-panel-summary`,role:`status`,children:[D,` `,D===1?`subject`:`subjects`,O.length===0?``:` · ${O.reduce((e,t)=>e+t.subjects.length,0)} excluded`]}),(0,$.jsx)(`button`,{type:`button`,className:`bottom-panel-collapse`,"aria-expanded":r,"aria-controls":`bottom-panel-${i}`,"aria-label":r?`Collapse panel`:`Expand panel`,onClick:d,children:r?`▾`:`▴`})]}),r?(0,$.jsx)(`div`,{className:`bottom-panel-body`,id:`bottom-panel-${i}`,role:`tabpanel`,"aria-labelledby":`bottom-tab-${i}`,children:(0,$.jsxs)(`div`,{className:`query-tab`,children:[(0,$.jsxs)(`div`,{className:`query-tab-fields`,children:[(0,$.jsx)(BS,{fields:_,onChange:w}),(0,$.jsx)(VS,{showLifecycle:a,showEvidence:o,showOwnership:s,showKindLabels:c,showNudges:l,onTogglePresentation:u})]}),(0,$.jsxs)(`div`,{className:`query-tab-outcome`,children:[(0,$.jsx)(`h3`,{children:`Matches`}),(0,$.jsxs)(`p`,{className:`query-match-count`,children:[(0,$.jsx)(`strong`,{children:D}),` `,D===1?`subject`:`subjects`,` of `,e.length]}),A?null:(0,$.jsx)(`p`,{className:`query-outcome-stale`,children:`Describing the query on the canvas, not the edit in progress.`}),D===0&&E!==null?(0,$.jsx)(`p`,{className:`query-outcome-empty`,children:`This query selects nothing.`}):null,k===0?null:(0,$.jsxs)(`p`,{className:`query-outcome-note`,children:[k,` a facet dropped `,k===1?`is`:`are`,` drawn anyway: `,(0,$.jsx)(`code`,{children:`relationships: connected`}),` takes the other end of a relationship with it.`]}),(0,$.jsx)(`h3`,{children:`Excluded, and why`}),O.length===0?(0,$.jsx)(`p`,{className:`query-outcome-note`,children:`Nothing is left out of this view.`}):(0,$.jsx)(`ul`,{className:`query-exclusions`,children:O.map(e=>(0,$.jsxs)(`li`,{children:[(0,$.jsx)(`span`,{className:`query-exclusion-facet`,children:e.label}),` `,(0,$.jsx)(`span`,{className:`query-exclusion-count`,children:e.subjects.length}),(0,$.jsxs)(`ul`,{children:[e.subjects.slice(0,12).map(e=>(0,$.jsx)(`li`,{title:e.id,children:e.title},e.id)),e.subjects.length>12?(0,$.jsxs)(`li`,{className:`query-exclusion-more`,children:[`and `,e.subjects.length-12,` more`]}):null]})]},e.reason))})]}),(0,$.jsxs)(`div`,{className:`query-tab-document`,children:[(0,$.jsx)(`h3`,{children:`Document`}),j===null?(0,$.jsx)(`p`,{className:`query-outcome-note`,children:h?`No view is active, so this query has no document. Pick one in the tree.`:`No view is active, so this query has no document yet. Pick one in the tree, or save this query as a new view.`}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`pre`,{className:`query-document`,children:gS(ZS(j))}),h?null:(0,$.jsxs)(`div`,{className:`query-tab-actions`,children:[(0,$.jsx)(`button`,{type:`button`,disabled:!$S(j),onClick:()=>{m(QS(j)),x(!0)},children:`Stage view change`}),(0,$.jsx)(`span`,{role:`status`,className:`query-stage-status`,children:b?`Staged. It lands when the changeset is committed.`:``})]})]})]})]})}):null]})}function tC({value:e,onChange:t}){return(0,$.jsx)(`input`,{type:`search`,name:`quick-filter`,className:`quick-filter`,value:e,onChange:e=>t(e.currentTarget.value),placeholder:`Filter by name or id…`,"aria-label":`Quick filter`})}var nC=`views`,rC=`model`,iC=e=>`view-folder:${e}`,aC=e=>`model-layer:${e}`,oC=e=>`model-folder:${e}`,sC=`unlayered`,cC=(e,t)=>t===``||e.toLowerCase().includes(t),lC=(e,t)=>cC(e,tv(t)),uC=e=>e.presentation?.folder??``,dC=({views:e,stagedOperations:t,activeViewId:n,activeSubjects:r,filterText:i})=>{let a=tv(i),o=a!==``,s=r===null?null:rv(r,i),c=new Map,l=(e,t)=>{let n=c.get(e);n===void 0?c.set(e,[t]):n.push(t)},u=new Map;for(let e of t)u.set(e.path,e);for(let t of e){let e=u.get(t.path);u.delete(t.path);let r=e?.op===`write-view`?e.projection:null,i=e===void 0?null:r===null?`delete`:`overwrite`,c=r===null?t.title:r.presentation?.title??r.id,d=r===null?uC(t):r.presentation?.folder??``,f=t.id===n;!cC(c,a)&&!cC(d,a)||l(d,{id:t.id,title:c,path:t.path,subjectCount:f&&s!==null?s:o?null:t.subjectCount,active:f,staged:i})}for(let e of u.values()){if(e.op!==`write-view`)continue;let{projection:t}=e,n=t.presentation?.title??t.id,r=t.presentation?.folder??``;!cC(n,a)&&!cC(r,a)||l(r,{id:t.id,title:n,path:e.path,subjectCount:null,active:!1,staged:`new`})}let d=(e,t)=>e.title.localeCompare(t.title),f=[...c.get(``)??[]].sort(d),p=[...c.entries()].filter(([e])=>e!==``).sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>({key:iC(e),name:e,views:[...t].sort(d)}));return{folders:p,loose:f,matched:f.length+p.reduce((e,t)=>e+t.views.length,0)}},fC=({nodes:e,inViewIds:t,filterText:n,folded:r,insideCounts:i})=>{let a=tv(n),o=new Map,s=new Map;for(let n of e){let e=n.layer,c=n.folder,l=c??e??`unlayered`;if(!nv(a,n.id,n.name,n.kindLabel)&&!cC(l,a))continue;let u={id:n.id,name:n.name,kindLabel:n.kindLabel,layer:e,folder:c,inView:t===null||t.has(n.id),foldedCount:r?.has(n.id)===!0?i?.get(n.id)??0:null},d=c===null?s:o,f=d.get(l);f===void 0?d.set(l,[u]):f.push(u)}let c=(e,t)=>e.name.localeCompare(t.name),l=[...o.entries()].sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>({key:oC(e),label:e,grouping:`folder`,subjects:[...t].sort(c)})),u=[...D_,sC];return[...l,...u.flatMap(e=>{let t=s.get(e);return t===void 0||t.length===0?[]:[{key:aC(e),label:e,grouping:`layer`,subjects:[...t].sort(c)}]})]},pC=`All subjects`,mC=`M2 3.5 5 6.5 8 3.5`,hC=`M3.5 2 6.5 5 3.5 8`;function gC({open:e}){return(0,$.jsx)(`svg`,{width:`10`,height:`10`,viewBox:`0 0 10 10`,fill:`none`,"aria-hidden":!0,children:(0,$.jsx)(`path`,{d:e?mC:hC,stroke:`currentColor`,strokeWidth:`1.2`,strokeLinecap:`round`,strokeLinejoin:`round`})})}function _C(){return(0,$.jsxs)(`svg`,{width:`12`,height:`12`,viewBox:`0 0 12 12`,fill:`none`,"aria-hidden":!0,children:[(0,$.jsx)(`rect`,{x:`1.5`,y:`2.5`,width:`9`,height:`7`,stroke:`currentColor`,strokeWidth:`1.2`}),(0,$.jsx)(`path`,{d:`M1.5 5h9`,stroke:`currentColor`,strokeWidth:`1.2`})]})}function vC({layer:e}){let t=e===null?null:M_[e];return(0,$.jsx)(`span`,{className:`tree-swatch`,style:t==null?void 0:{background:t.fill,borderColor:t.border},"aria-hidden":!0})}var yC=(e,t)=>n=>{n.preventDefault(),t(e,{x:n.clientX,y:n.clientY})};function bC({row:e,depth:t,onSelect:n,onMenu:r}){let i=e.staged!==`new`;return(0,$.jsx)(`li`,{children:(0,$.jsxs)(`button`,{type:`button`,className:`tree-row tree-view tree-depth-${t}${e.active?` tree-row-active`:``}${e.staged===null?``:` tree-row-staged`}${e.staged===`delete`?` tree-row-staged-delete`:``}`,title:e.title,"aria-current":e.active?`true`:void 0,onClick:i?()=>n(e.id):void 0,onContextMenu:i?yC({kind:`view`,id:e.id},r):void 0,children:[(0,$.jsx)(_C,{}),(0,$.jsx)(`span`,{className:`tree-label`,children:e.title}),e.staged===null?null:(0,$.jsx)(`span`,{className:`tree-staged`,children:e.staged===`delete`?`staged delete`:`staged`}),e.subjectCount===null?null:(0,$.jsx)(`span`,{className:`tree-count`,children:e.subjectCount})]})})}function xC({label:e,open:t,count:n,depth:r,onToggle:i}){return(0,$.jsxs)(`button`,{type:`button`,className:`tree-row tree-branch tree-depth-${r}`,"aria-expanded":t,onClick:i,children:[(0,$.jsx)(gC,{open:t}),(0,$.jsx)(`span`,{className:`tree-label`,children:e}),n===void 0?null:(0,$.jsx)(`span`,{className:`tree-count`,children:n})]})}function SC({views:e,stagedViewOperations:t,activeViewId:n,nodes:r,inViewIds:i,folded:a,insideCounts:o,filterText:s,collapsed:c,onFilterChange:l,onToggle:u,onSelectView:d,onClearView:f,onNewView:p,onSelectSubject:m,onRowMenu:h,readOnly:g=!1,onHide:_}){let v=dC({views:e,stagedOperations:t,activeViewId:n,activeSubjects:i===null?null:r.filter(e=>i.has(e.id)),filterText:s}),y=fC({nodes:r,inViewIds:i,filterText:s,folded:a,insideCounts:o}),b=!c.has(nC),x=!c.has(rC),S=s.trim()!==``,C=n===``&&i===null,w=lC(pC,s);return(0,$.jsxs)(`aside`,{className:`view-tree`,"aria-label":`Views and model`,children:[(0,$.jsxs)(`div`,{className:`view-tree-head`,children:[(0,$.jsx)(`input`,{type:`search`,name:`view-tree-filter`,className:`view-tree-filter`,placeholder:`Filter tree`,"aria-label":`Filter views and subjects`,value:s,onChange:e=>l(e.currentTarget.value)}),_===void 0?null:(0,$.jsx)(`button`,{type:`button`,className:`rail-hide`,title:`Hide the view tree`,"aria-label":`Hide the view tree`,onClick:_,children:`«`}),g?null:(0,$.jsx)(`button`,{type:`button`,className:`view-tree-new`,title:`New view`,"aria-label":`New view`,onClick:p,children:(0,$.jsx)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 14 14`,fill:`none`,"aria-hidden":!0,children:(0,$.jsx)(`path`,{d:`M7 3v8M3 7h8`,stroke:`currentColor`,strokeWidth:`1.3`,strokeLinecap:`round`})})})]}),(0,$.jsxs)(`div`,{className:`view-tree-body`,children:[(0,$.jsx)(xC,{label:`Views`,open:b,depth:0,onToggle:()=>u(nC)}),b?(0,$.jsxs)(`ul`,{className:`tree-list`,children:[w?(0,$.jsx)(`li`,{children:(0,$.jsxs)(`button`,{type:`button`,className:`tree-row tree-view tree-depth-1${C?` tree-row-active`:``}`,"aria-current":C?`true`:void 0,onClick:f,onContextMenu:yC({kind:`view`,id:``},h),children:[(0,$.jsx)(_C,{}),(0,$.jsx)(`span`,{className:`tree-label`,children:pC}),(0,$.jsx)(`span`,{className:`tree-count`,children:rv(r,s)})]})}):null,v.loose.map(e=>(0,$.jsx)(bC,{row:e,depth:1,onSelect:d,onMenu:h},e.id)),v.folders.map(e=>{let t=S||!c.has(e.key);return(0,$.jsxs)(`li`,{children:[(0,$.jsx)(xC,{label:e.name,open:t,count:t?void 0:e.views.length,depth:1,onToggle:()=>u(e.key)}),t?(0,$.jsx)(`ul`,{className:`tree-list`,children:e.views.map(e=>(0,$.jsx)(bC,{row:e,depth:2,onSelect:d,onMenu:h},e.id))}):null]},e.key)}),!S||v.matched!==0||w?null:(0,$.jsx)(`li`,{className:`tree-empty`,children:`No view matches that.`})]}):null,(0,$.jsx)(xC,{label:`Model`,open:x,depth:0,onToggle:()=>u(rC)}),x?(0,$.jsxs)(`ul`,{className:`tree-list`,children:[y.map(e=>{let t=S||!c.has(e.key);return(0,$.jsxs)(`li`,{children:[(0,$.jsx)(xC,{label:e.label,open:t,count:t?void 0:e.subjects.length,depth:1,onToggle:()=>u(e.key)}),t?(0,$.jsx)(`ul`,{className:`tree-list`,children:e.subjects.map(e=>(0,$.jsx)(`li`,{children:(0,$.jsxs)(`button`,{type:`button`,className:`tree-row tree-subject tree-depth-2${e.inView?``:` tree-row-quiet`}`,title:e.foldedCount===null?`${e.name} — ${e.kindLabel}`:`${e.name} — ${e.kindLabel}, folded over ${e.foldedCount} ${e.foldedCount===1?`subject`:`subjects`}`,onClick:()=>m(e.id),onContextMenu:yC({kind:`subject`,id:e.id},h),children:[(0,$.jsx)(vC,{layer:e.layer}),e.foldedCount===null?null:(0,$.jsx)(`span`,{className:`tree-fold`,"aria-hidden":`true`,children:`▸`}),(0,$.jsx)(`span`,{className:`tree-label`,children:e.name}),e.foldedCount===null||e.foldedCount===0?null:(0,$.jsx)(`span`,{className:`tree-count`,children:e.foldedCount}),e.inView?null:(0,$.jsx)(`span`,{className:`tree-count`,children:`not in view`})]})},e.id))}):null]},e.key)}),y.length!==0||!S?null:(0,$.jsx)(`li`,{className:`tree-empty`,children:`No subject matches that.`})]}):null]})]})}var CC=({id:e,taken:t,path:n,declared:r,folder:i,title:a,description:o,query:s,layout:c,direction:l,showLifecycle:u,showEvidence:d,showOwnership:f,showKindLabels:p})=>{let m=e??bS(a,t);return{op:`write-view`,path:n??xS(m),projection:TS({id:m,title:a,description:o,query:s??{},presentation:{...r??{},layout:c,direction:l,...i===void 0||i===``?{}:{folder:i},showLifecycle:u,showEvidence:d,showOwnership:f,showKindLabels:p}})}};function wC({activeView:e,presetFolder:t,onSubmit:n,onCancel:r}){let[i,a]=(0,y.useState)(e?.title??``),[o,s]=(0,y.useState)(e?.description??``),c=i.trim()===``||o.trim()===``,l=t!==void 0;return(0,$.jsx)(`div`,{className:`save-view-panel`,children:(0,$.jsx)(`div`,{id:`save-view-panel-body`,className:`save-view-panel-body`,children:(0,$.jsxs)(`form`,{className:`save-view-form`,onSubmit:t=>{t.preventDefault(),!c&&n(l?void 0:e?.id,i,o)},children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`label`,{htmlFor:`save-view-title`,children:`Title`}),(0,$.jsx)(`input`,{id:`save-view-title`,type:`text`,value:i,onChange:e=>a(e.currentTarget.value),required:!0})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`label`,{htmlFor:`save-view-description`,children:`Description`}),(0,$.jsx)(`textarea`,{id:`save-view-description`,value:o,onChange:e=>s(e.currentTarget.value),required:!0})]}),(0,$.jsxs)(`div`,{className:`save-view-actions`,children:[(0,$.jsx)(`button`,{type:`submit`,disabled:e===null||c||l,title:l?`Save overwrites the active view and keeps its own folder — Save As New puts the first view in "${t}".`:void 0,children:`Save`}),(0,$.jsx)(`button`,{type:`button`,disabled:c,onClick:()=>{c||n(void 0,i,o)},children:`Save As New`}),(0,$.jsx)(`button`,{type:`button`,onClick:r,children:`Cancel`})]})]})})})}function TC({views:e,activeViewId:t,query:n,layout:r,direction:i,showLifecycle:a,showEvidence:o,showOwnership:s,showKindLabels:c,open:l,folder:u,onClose:d,onStage:f}){let p=e.find(e=>e.id===t)??null,m=(t,l,d)=>{f(CC({id:t,taken:new Set(e.map(e=>e.id)),path:t===void 0?void 0:p?.path,declared:t===void 0?void 0:p?.presentation,folder:t===void 0?u:p?.presentation?.folder,title:l,description:d,query:n,layout:r,direction:i,showLifecycle:a,showEvidence:o,showOwnership:s,showKindLabels:c}))};return l?(0,$.jsx)(`div`,{className:`save-view-control`,children:(0,$.jsx)(wC,{activeView:p,presetFolder:u,onSubmit:(e,t,n)=>{m(e,t,n),d()},onCancel:d},t)}):null}function EC(e){if((e.relationships===`connected`||e.relationships===`between`)&&e.subjects!==void 0&&e.subjects.length>0){let t=`${e.relationships===`connected`?`connected to`:`between`} ${e.subjects.join(`, `)}`;return e.exclude===void 0||e.exclude.length===0?t:`${t} · except: ${e.exclude.join(`, `)}`}let t=[],n=(e,n)=>{n!==void 0&&n.length>0&&t.push(`${e}: ${n.join(`, `)}`)};return n(`subjects`,e.subjects),n(`documents`,e.documents),n(`layers`,e.layers),n(e.kindMatching===`descendants`?`kinds (and descendants)`:`kinds`,e.kinds),n(`statuses`,e.statuses),n(`excluding statuses`,e.excludeStatuses),n(`states`,e.states),n(`owners`,e.owners),n(`constraints`,e.constraints),n(`relationship kinds`,e.relationshipKinds),n(`except`,e.exclude),e.isolatedConcepts===`exclude`&&t.push(`connected concepts only`),e.isolatedConcepts===`include`&&t.push(`including isolated concepts`),t.length>0?t.join(` · `):`all`}var DC=(e,t)=>{if(!e.nodes.some(({id:e})=>e===t))return[];let n=new Set([t]);for(let r of e.edges)r.from===t?n.add(r.to):r.to===t&&n.add(r.from);return[...n]},OC=(e,t)=>{let n=e.edges.find(({id:e})=>e===t);return n===void 0?[]:[n.from,n.to]},kC=(e,t)=>{let n=new Set(t.nodes.map(e=>e.id));for(let e of t.edges)n.add(e.id);let r=0;for(let t of e)(t.subjects??[]).some(e=>n.has(e))&&(r+=1);return{total:e.length,onCanvas:r,elsewhere:e.length-r}},AC=e=>{let t=new Set;for(let n of e)for(let e of n.subjects??[])t.add(e);return t},jC=(e,t,n)=>{let r=n=>n.document===e&&n.localId===t,i=n?.nodes.find(r);if(i!==void 0)return i.name;let a=n?.edges.find(r);return a?.name!==void 0&&a.name!==null?a.name:t},MC=(e,t,n)=>[...e.operations.map(e=>PC(e,t)),...e.viewOperations.map(e=>NC(e,n))],NC=(e,t)=>{if(e.op===`delete-view`)return{verb:e.op,subjectName:e.path,fields:[],removedFields:[],scope:`view`};let n=t.find(t=>t.path===e.path),r=n===void 0?[]:kS(n.query,e.projection.query);return{verb:e.op,subjectName:e.projection.presentation?.title??e.projection.id,fields:r.length>0?r:[e.path],removedFields:[],scope:`view`}},PC=(e,t)=>{let n=e.op===`update-concept`||e.op===`update-relationship`||e.op===`update-observation`?e.remove??[]:[];if(`observation`in e){let{subject:r,claim:i,key:a,...o}=e.observation,s=jC(e.document,r??i,t);return{verb:e.op,subjectName:a===void 0?s:`${s} (${a})`,fields:Object.keys(o),removedFields:n,scope:`model`}}let r=`concept`in e?e.concept:e.relationship;return{verb:e.op,subjectName:jC(e.document,r.id,t),fields:Object.keys(r).filter(e=>e!==`id`),removedFields:n,scope:`model`}},FC=e=>{let t=[...e.fields,...e.removedFields.map(e=>`remove: ${e}`)];return t.length===0?`${e.verb} · ${e.subjectName}`:`${e.verb} · ${e.subjectName} · ${t.join(`, `)}`},IC=/^\/operations\/(\d+)(\/|$)/,LC=e=>{let t=new Map,n=[];for(let r of e){let e=IC.exec(r.pointer);if(e===null){n.push(r);continue}let i=Number(e[1]),a=t.get(i);a===void 0?t.set(i,[r]):a.push(r)}return{byRow:t,batch:n}},RC=(e,t,n)=>{let r=t[e];if(r===void 0)return null;let i=n?.sourceDigests[e]??n?.projectionDigests[e];return i===void 0||i===r?null:e},zC=({diagnostic:e})=>(0,$.jsxs)(`li`,{children:[(0,$.jsx)(`span`,{className:`code`,children:e.code}),` `,e.message,e.path===``?null:(0,$.jsxs)(`span`,{className:`where`,children:[e.path,`:`,e.line,`:`,e.column]})]}),BC=({index:e,row:t,diagnostics:n,conflict:r,onDiscard:i})=>(0,$.jsxs)(`li`,{className:r===null?`changeset-row`:`changeset-row conflicted`,children:[(0,$.jsxs)(`div`,{className:`changeset-row-line`,children:[(0,$.jsx)(`span`,{className:`changeset-row-label`,children:FC(t)}),(0,$.jsx)(`span`,{className:`changeset-row-scope changeset-scope-${t.scope}`,children:t.scope}),(0,$.jsx)(`button`,{type:`button`,className:`changeset-row-discard`,onClick:i,children:`Discard`})]}),r===null?null:(0,$.jsxs)(`p`,{className:`changeset-row-conflict`,role:`status`,children:[r,` changed after this edit was staged`]}),n.length===0?null:(0,$.jsx)(`ul`,{className:`changeset-row-diagnostics`,children:n.map(e=>(0,$.jsx)(zC,{diagnostic:e},`${e.code}-${e.pointer}`))})]}),VC=({state:e,onDiscardChange:t,onClearChangeset:n,onUndoChangeset:r,onRedoChangeset:i,onCommitChangeset:a})=>{let o=e.model?.graph??null,s=MC(e.pendingChangeset,o,e.views);if(s.length===0&&e.commitNotice===null&&e.commitDiagnostics===null&&e.undoStack.length===0&&e.redoStack.length===0)return null;let{byRow:c,batch:l}=LC(e.commitDiagnostics??[]),u=e.commitStatus===`committing`;return(0,$.jsxs)(`section`,{className:`changeset-tray`,"aria-labelledby":`changeset-heading`,children:[(0,$.jsxs)(`div`,{className:`changeset-heading-row`,children:[(0,$.jsx)(`h2`,{id:`changeset-heading`,children:`Pending changes`}),(0,$.jsxs)(`div`,{className:`changeset-history-controls`,children:[(0,$.jsx)(`button`,{type:`button`,className:`changeset-undo`,disabled:e.undoStack.length===0,onClick:r,children:`Undo`}),(0,$.jsx)(`button`,{type:`button`,className:`changeset-redo`,disabled:e.redoStack.length===0,onClick:i,children:`Redo`}),s.length===0?null:(0,$.jsx)(`button`,{type:`button`,className:`changeset-discard-all`,onClick:n,children:`Discard all`})]})]}),e.commitDiagnostics===null||e.commitDiagnostics.length===0||o===null?null:(0,$.jsx)(`p`,{className:`changeset-fault-summary`,role:`status`,children:(()=>{let t=kC(e.commitDiagnostics,o);return`${t.total} problem${t.total===1?``:`s`}: ${t.onCanvas} marked on the diagram, ${t.elsewhere} not on it.`})()}),l.length===0?null:(0,$.jsx)(`ul`,{className:`changeset-batch-diagnostics`,role:`alert`,children:l.map(e=>(0,$.jsx)(zC,{diagnostic:e},`${e.code}-${e.pointer}`))}),s.length===0?null:(0,$.jsx)(`ol`,{className:`changeset-rows`,children:s.map((n,r)=>(0,$.jsx)(BC,{index:r,row:n,diagnostics:c.get(r)??[],conflict:RC(r<e.pendingChangeset.operations.length?e.pendingChangeset.operations[r].document:e.pendingChangeset.viewOperations[r-e.pendingChangeset.operations.length].path,e.pendingChangeset.sourceDigests,e.model),onDiscard:()=>t(r)},r))}),(0,$.jsx)(`div`,{className:`changeset-actions`,children:(0,$.jsx)(`button`,{type:`button`,className:`changeset-commit`,disabled:s.length===0||u,"aria-busy":u,onClick:a,children:u?`Committing…`:`Commit changes`})}),e.commitNotice===null?null:(0,$.jsxs)(`div`,{className:`changeset-notice`,role:`status`,children:[(0,$.jsxs)(`p`,{children:[`Committed · `,e.commitNotice.length,` `,e.commitNotice.length===1?`file`:`files`]}),(0,$.jsx)(`ul`,{children:e.commitNotice.map(e=>(0,$.jsx)(`li`,{children:e},e))})]})]})},HC=e=>e.slice(e.lastIndexOf(`#`)+1),UC=e=>e.name===void 0||e.name===e.label?e.label:`${e.name} (${e.label})`,WC={a:`access`,c:`composition`,f:`flow`,g:`aggregation`,i:`assignment`,n:`influence`,o:`association`,r:`realization`,s:`specialization`,t:`triggering`,v:`serving`},GC=`applicationCollaboration.applicationComponent.applicationEvent.applicationFunction.applicationInteraction.applicationInterface.applicationProcess.applicationService.artifact.assessment.businessActor.businessCollaboration.businessEvent.businessFunction.businessInteraction.businessInterface.businessObject.businessProcess.businessRole.businessService.capability.communicationNetwork.constraint.contract.courseOfAction.dataObject.deliverable.device.distributionNetwork.driver.equipment.facility.gap.goal.grouping.implementationEvent.andJunction.orJunction.location.material.meaning.node.outcome.path.plateau.principle.product.representation.requirement.resource.stakeholder.systemSoftware.technologyCollaboration.technologyEvent.technologyFunction.technologyInteraction.technologyInterface.technologyProcess.technologyService.value.valueStream.workPackage`.split(`.`),KC={applicationCollaboration:`cfgostv fgortv fiortv fiortv fiortv cfgortv fiortv fiortv ao no fotv fotv fortv fortv fortv fortv ao fortv fotv fortv or fotv nor ao or ao o fotv fotv no fotv fotv o nor acfginorstv o acfginorstv acfginorstv fotv ao no fotv nor fotv o nor fotv ao nor or no fotv fotv fotv fotv fotv fotv fotv fotv no or o`,applicationComponent:`fotv cfgorstv fiortv fiortv fiortv cfgortv fiortv fiortv ao no fotv fotv fortv fortv fortv fortv ao fortv fotv fortv or fotv nor ao or ao o fotv fotv no fotv fotv o nor acfginorstv o acfginorstv acfginorstv fotv ao no fotv nor fotv o nor fotv ao nor or no fotv fotv fotv fotv fotv fotv fotv fotv no or o`,applicationEvent:`fotv fotv cfgostv fotv fotv fotv fotv fotv ao no fotv fotv fortv fotv fotv fotv ao fotv fotv fotv o fotv nor ao o ao o fotv fotv no fotv fotv o nor acfgnorstv o acfginorstv acfginorstv fotv ao no fotv nor fotv o nor fotv ao nor o no fotv fotv fotv fotv fotv fotv fotv fotv no o o`,applicationFunction:`fotv fotv fotv cfgostv cfgotv fotv cfgotv fortv ao no fotv fotv fotv fortv fortv fotv ao fortv fotv fortv or fotv nor ao or ao o fotv fotv no fotv fotv o nor acfgnorstv o acfginorstv acfginorstv fotv ao no fotv nor fotv o nor fotv ao nor o no fotv fotv fotv fotv fotv fotv fotv fotv no or o`,applicationInteraction:`fotv fotv fotv cfgotv cfgostv fotv cfgotv fortv ao no fotv fotv fotv fortv fortv fotv ao fortv fotv fortv or fotv nor ao or ao o fotv fotv no fotv fotv o nor acfgnorstv o acfginorstv acfginorstv fotv ao no fotv nor fotv o nor fotv ao nor o no fotv fotv fotv fotv fotv fotv fotv fotv no or o`,applicationInterface:`fotv fotv fotv fotv fotv cfgostv fotv fiotv ao no fotv fotv fotv fotv fotv fortv ao fotv fotv fortv or fotv nor ao or ao o fotv fotv no fotv fotv o nor acfginorstv o acfginorstv acfginorstv fotv ao no fotv nor fotv o nor fotv ao nor or no fotv fotv fotv fotv fotv fotv fotv fotv no or o`,applicationProcess:`fotv fotv fotv cfgotv cfgotv fotv cfgostv fortv ao no fotv fotv fotv fortv fortv fotv ao fortv fotv fortv or fotv nor ao or ao o fotv fotv no fotv fotv o nor acfgnorstv o acfginorstv acfginorstv fotv ao no fotv nor fotv o nor fotv ao nor o no fotv fotv fotv fotv fotv fotv fotv fotv no or o`,applicationService:`fotv fotv fotv fotv fotv fotv fotv cfgostv ao no fotv fotv fotv fotv fotv fotv ao fotv fotv fortv or fotv nor ao or ao o fotv fotv no fotv fotv o nor acfgnorstv o acfginorstv acfginorstv fotv ao no fotv nor fotv o nor fotv ao nor o no fotv fotv fotv fotv fotv fotv fotv fotv no or o`,artifact:`or or or or or or or or cgors no o o or or or or or or o or or o nor or or or o o o no o o o nor cgnors o acfginorstv acfginorstv o o no o nor o o nor o o nor or no or o or or or or or or no or o`,assessment:`o o o o o o o o o cgnos o o o o o o o o o o o o no o o o o o o no o o o no cgnos o acfginorstv acfginorstv o o no o no o o no o o no o no o o o o o o o o no o o`,businessActor:`fotv fotv fotv fotv fotv fotv fotv fotv ao no cfgostv fotv fiotv fiotv fiotv cfgiotv ao fiotv fiotv fiortv or fotv nor ao or ao o fotv fotv no fotv fotv o nor acfginorstv io acfginorstv acfginorstv fotv ao no fotv nor fotv o nor fotv ao nor or ino fotv fotv fotv fotv fotv fotv fotv fotv no or io`,businessCollaboration:`fotv fotv fotv fotv fotv fotv fotv fotv ao no fgotv cfgostv fiotv fiotv fiotv cfgiotv ao fiotv fgiotv fiortv or fotv nor ao or ao o fotv fotv no fotv fotv o nor acfginorstv io acfginorstv acfginorstv fotv ao no fotv nor fotv o nor fotv ao nor or ino fotv fotv fotv fotv fotv fotv fotv fotv no or io`,businessEvent:`fotv fotv fotv fotv fotv fotv fotv fotv ao no fotv fotv cfgostv fotv fotv fotv ao fotv fotv fotv o fotv nor ao o ao o fotv fotv no fotv fotv o nor acfgnorstv o acfginorstv acfginorstv fotv ao no fotv nor fotv o nor fotv ao nor o no fotv fotv fotv fotv fotv fotv fotv fotv no o o`,businessFunction:`fotv fotv fotv fotv fotv fotv fotv fotv ao no fotv fotv fotv cfgostv cfgotv fotv ao cfgotv fotv fortv or fotv nor ao or ao o fotv fotv no fotv fotv o nor acfgnorstv o acfginorstv acfginorstv fotv ao no fotv nor fotv o nor fotv ao nor o no fotv fotv fotv fotv fotv fotv fotv fotv no or o`,businessInteraction:`fotv fotv fotv fotv fotv fotv fotv fotv ao no fotv fotv fotv cfgotv cfgostv fotv ao cfgotv fotv fortv or fotv nor ao or ao o fotv fotv no fotv fotv o nor acfgnorstv o acfginorstv acfginorstv fotv ao no fotv nor fotv o nor fotv ao nor o no fotv fotv fotv fotv fotv fotv fotv fotv no or o`,businessInterface:`fotv fotv fotv fotv fotv fotv fotv fotv ao no fotv fotv fotv fotv fotv cfgostv ao fotv fotv fiotv or fotv nor ao or ao o fotv fotv no fotv fotv o nor acfginorstv o acfginorstv acfginorstv fotv ao no fotv nor fotv o nor fotv ao nor or no fotv fotv fotv fotv fotv fotv fotv fotv no or o`,businessObject:`o o o o o o o o o no o o o o o o cgos o o o or o nor cgos or o o o o no o o o nor cgnors o acfginorstv acfginorstv o o no o nor o o nor o o nor or no o o o o o o o o no or o`,businessProcess:`fotv fotv fotv fotv fotv fotv fotv fotv ao no fotv fotv fotv cfgotv cfgotv fotv ao cfgostv fotv fortv or fotv nor ao or ao o fotv fotv no fotv fotv o nor acfgnorstv o acfginorstv acfginorstv fotv ao no fotv nor fotv o nor fotv ao nor o no fotv fotv fotv fotv fotv fotv fotv fotv no or o`,businessRole:`fotv fotv fotv fotv fotv fotv fotv fotv ao no fotv fotv fiotv fiotv fiotv cfgotv ao fiotv cfgostv fiortv or fotv nor ao or ao o fotv fotv no fotv fotv o nor acfginorstv io acfginorstv acfginorstv fotv ao no fotv nor fotv o nor fotv ao nor or ino fotv fotv fotv fotv fotv fotv fotv fotv no or io`,businessService:`fotv fotv fotv fotv fotv fotv fotv fotv ao no fotv fotv fotv fotv fotv fotv ao fotv fotv cfgostv or fotv nor ao or ao o fotv fotv no fotv fotv o nor acfgnorstv o acfginorstv acfginorstv fotv ao no fotv nor fotv o nor fotv ao nor o no fotv fotv fotv fotv fotv fotv fotv fotv no or o`,capability:`o o o o o o o o o no o o o o o o o o o o cfgostv o nor o fortv o o o o no o o o nor cfgnorstv o acfginorstv acfginorstv o o no o nor o o nor o o nor fotv no o o o o o o o o no fotv o`,communicationNetwork:`fortv fortv fortv fortv fortv fortv fortv fortv aio no fortv fortv fortv fortv fortv fortv ao fortv fortv fortv or cfgostv nor ao or ao o fgortv fotv no fortv fortv o nor acfginorstv o acfginorstv acfginorstv fotv ao no fortv nor fortv o nor fotv ao nor or nor fgiortv fortv fiortv fiortv fiortv fgiortv fiortv fiortv no or o`,constraint:`o o o o o o o o o no o o o o o o o o o o o o cgnos o o o o o o no o o o nor cgnors o acfginorstv acfginorstv o o no o nor o o nor o o cgnos o no o o o o o o o o no o o`,contract:`o o o o o o o o o no o o o o o o cgos o o o or o nor cgos or o o o o no o o o nor cgnors o acfginorstv acfginorstv o o no o nor o o nor o o nor or no o o o o o o o o no or o`,courseOfAction:`o o o o o o o o o no o o o o o o o o o o fotv o nor o cfgostv o o o o no o o o nor cfgnorstv o acfginorstv acfginorstv o o no o nor o o nor o o nor fotv no o o o o o o o o no fotv o`,dataObject:`o o o o o o o o o no o o o o o o or o o o or o nor or or cgos o o o no o o o nor cgnors o acfginorstv acfginorstv o o no o nor o o nor o o nor or no o o o o o o o o no or o`,deliverable:`or or or or or or or or or no or or or or or or or or or or or or nor or or or cgos or or no or or o nor cgnors o acfginorstv acfginorstv or or no or nor or or nor or or nor or nor or or or or or or or or no or o`,device:`fortv fortv fortv fortv fortv fortv fortv fortv aio no fotv fotv fortv fortv fortv fortv ao fortv fotv fortv or fotv nor ao or ao o cfgostv fotv no fotv fotv o nor acfginorstv o acfginorstv acfginorstv fotv ao no fotv nor fotv o nor fotv ao nor or no cfgiortv fotv fiortv fiortv fiortv cfgiortv fiortv fiortv no or o`,distributionNetwork:`fortv fortv fortv fortv fortv fortv fortv fortv aio no fiortv fiortv fiortv fiortv fiortv fiortv ao fiortv fiortv fiortv or fotv nor ao or ao o fgiortv cfgostv no fgiortv fgiortv o nor acfginorstv io acfginorstv acfginorstv fotv aio no fgiortv nor fortv o nor fotv ao nor or inor fgiortv fortv fiortv fiortv fiortv fgiortv fiortv fiortv no or io`,driver:`o o o o o o o o o no o o o o o o o o o o o o no o o o o o o cgnos o o o no cgnos o acfginorstv acfginorstv o o no o no o o no o o no o no o o o o o o o o no o o`,equipment:`fortv fortv fortv fortv fortv fortv fortv fortv aio no fotv fotv fortv fortv fortv fortv ao fortv fotv fortv or fotv nor ao or ao o cfgortv fotv no cfgorstv fotv o nor acfginorstv o acfginorstv acfginorstv fotv aio no fotv nor fotv o nor fotv ao nor or no cfgiortv fotv fiortv fiortv fiortv cfgiortv fiortv fiortv no or o`,facility:`fortv fortv fortv fortv fortv fortv fortv fortv aio no fiotv fiotv fiortv fiortv fiortv fiortv ao fiortv fiotv fiortv or fotv nor ao or ao o cfgiortv fotv no cfgiortv cfgiostv o nor acfginorstv io acfginorstv acfginorstv fotv aio no cfgiotv nor fotv o nor fotv ao nor or ino cfgiortv fotv fiortv fiortv fiortv cfgiortv fiortv fiortv no or io`,gap:`o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o cgos o cgos o acfginorstv acfginorstv o o o o o o o o o o o o o o o o o o o o o o o o`,goal:`o o o o o o o o o no o o o o o o o o o o o o no o o o o o o no o o o cgnos cgnos o acfginorstv acfginorstv o o no o no o o no o o no o no o o o o o o o o no o o`,grouping:`cfgorstv cfgorstv cfgiorstv cfgiorstv cfgiorstv cfgorstv cfgiorstv cfgiorstv acgiors cgnos cfgiorstv cfgiorstv cfgiorstv cfgiorstv cfgiorstv cfgiorstv acgors cfgiorstv cfgiorstv cfgiorstv cfgiorstv cfgorstv cgnors acgors cfgorstv acgors acgors cfgiorstv cfgorstv cgnos cfgiorstv cfgiorstv cgos cgnors acfginorstv cfgiost acfginorstv acfginorstv cfgorstv acgiors cgnos cfgiorstv cgnors cfgorstv cfgorst cgnors cfgorstv acgors cgnors cfgorstv cginors cfgiorstv cfgorstv cfgiorstv cfgiorstv cfgiorstv cfgiorstv cfgiorstv cfgiorstv cgnos cfgiorstv cfgiost`,implementationEvent:`o o o o o o o o o no o o o o o o o o o o o o no o o o ao o o no o o o no acfgnost cfgost acfginorstv acfginorstv o o no o no o fot no o o no o no o o o o o o o o no o fot`,andJunction:`fortv fortv fiortv fiortv fiortv fortv fiortv fiortv aior no fiortv fiortv fiortv fiortv fiortv fiortv aor fiortv fiortv fiortv fiortv fortv nor aor fortv aor aor fiortv fortv no fiortv fiortv o nor afinortv fiot acfginorstv acfginorstv fortv aior no fiortv nor fortv fort nor fortv aor nor fortv inor fiortv fortv fiortv fiortv fiortv fiortv fiortv fiortv no fiortv fiot`,orJunction:`fortv fortv fiortv fiortv fiortv fortv fiortv fiortv aior no fiortv fiortv fiortv fiortv fiortv fiortv aor fiortv fiortv fiortv fiortv fortv nor aor fortv aor aor fiortv fortv no fiortv fiortv o nor afinortv fiot acfginorstv acfginorstv fortv aior no fiortv nor fortv fort nor fortv aor nor fortv inor fiortv fortv fiortv fiortv fiortv fiortv fiortv fiortv no fiortv fiot`,location:`cfgortv cfgortv cfgiortv cfgiortv cfgiortv cfgortv cfgiortv cfgiortv acgio cgno cfgiortv cfgiortv cfgiortv cfgiortv cfgiortv cfgiortv acgo cfgiortv cfgiortv cfgiortv cgor cfgotv cgnor acgo cgor acgo cgo cfgiortv cfgotv cgno cfgiortv cfgiortv cgo cgnor acfginorstv cgio acfginorstv acfginorstv cfgostv acgio cgno cfgiortv cgnor cfgortv cgo cgnor cfgotv acgo cgnor cgor cginor cfgiortv cfgortv cfgiortv cfgiortv cfgiortv cfgiortv cfgiortv cfgiortv cgno cgor cgio`,material:`or or or or or or or or or no o o or or or or or or o or or o nor or or or o or o no or o o nor cgnors o acfginorstv acfginorstv o cgors no o nor o o nor o o nor or no or o or or or or or or no or o`,meaning:`o o o o o o o o o no o o o o o o o o o o o o no o o o o o o no o o o no cgnos o acfginorstv acfginorstv o o cgnos o no o o no o o no o no o o o o o o o o no o o`,node:`fortv fortv fortv fortv fortv fortv fortv fortv aio no fiotv fiotv fiortv fiortv fiortv fiortv ao fiortv fiotv fiortv or fotv nor ao or ao o cfgiortv fotv no cfgiortv cfgiotv o nor acfginorstv io acfginorstv acfginorstv fotv aio no cfgiostv nor fotv o nor fotv ao nor or ino cfgiortv fotv fiortv fiortv fiortv cfgiortv fiortv fiortv no or io`,outcome:`o o o o o o o o o no o o o o o o o o o o o o no o o o o o o no o o o nor cgnors o acfginorstv acfginorstv o o no o cgnos o o no o o no o no o o o o o o o o no o o`,path:`fortv fortv fortv fortv fortv fortv fortv fortv aio no fiotv fiotv fiortv fiortv fiortv fiortv ao fiortv fiotv fiortv or fotv nor ao or ao o fgiortv fotv no fgiortv fgiotv o nor acfginorstv io acfginorstv acfginorstv fotv aio no fgiotv nor cfgostv o nor fotv ao nor or ino fgiortv fgotv fiortv fiortv fiortv fgiortv fiortv fiortv no or io`,plateau:`cgor cgor cgor cgor cgor cgor cgor cgor cgor no cgor cgor cgor cgor cgor cgor cgor cgor cgor cgor cgor cgor cgnor cgor cgor cgor ao cgor cgor no cgor cgor o cgnor acfginorst fot acfginorstv acfginorstv cgor cgor no cgor cgnor cgor cfgost nor cgor cgor cgnor cgor inor cgor cgor cgor cgor cgor cgor cgor cgor no cgor fot`,principle:`o o o o o o o o o no o o o o o o o o o o o o no o o o o o o no o o o nor cgnors o acfginorstv acfginorstv o o no o nor o o cgnos o o no o no o o o o o o o o no o o`,product:`fortv fortv fortv fortv fortv fortv fortv cfgortv acgo no fotv fotv fortv fortv fortv fortv acgo fortv fotv cfgortv or fotv nor acgo or acgo o fortv fotv no fortv fotv o nor acfgnorstv o acfginorstv acfginorstv fotv acgo no fotv nor fotv o nor cfgostv acgo nor or no fortv fotv fortv fortv fortv fortv fortv cfgortv no or o`,representation:`o o o o o o o o o no o o o o o o or o o o or o nor or or o o o o no o o o nor cgnors o acfginorstv acfginorstv o o no o nor o o nor o cgos nor or no o o o o o o o o no or o`,requirement:`o o o o o o o o o no o o o o o o o o o o o o cgnos o o o o o o no o o o nor cgnors o acfginorstv acfginorstv o o no o nor o o nor o o cgnos o no o o o o o o o o no o o`,resource:`o o o o o o o o o no o o o o o o o o o o fiotv o nor o fortv o o o o no o o o nor cfginorstv o acfginorstv acfginorstv o o no o nor o o nor o o nor cfgostv no o o o o o o o o no fiotv o`,stakeholder:`o o o o o o o o o no o o o o o o o o o o o o no o o o o o o no o o o no cgnos o acfginorstv acfginorstv o o no o no o o no o o no o cgnos o o o o o o o o no o o`,systemSoftware:`fortv fortv fortv fortv fortv fortv fortv fortv aio no fotv fotv fortv fortv fortv fortv ao fortv fotv fortv or fotv nor ao or ao o fotv fotv no fotv fotv o nor acfginorstv o acfginorstv acfginorstv fotv ao no fotv nor fotv o nor fotv ao nor or no cfgiorstv fotv fiortv fiortv fiortv cfgiortv fiortv fiortv no or o`,technologyCollaboration:`fortv fortv fortv fortv fortv fortv fortv fortv aio no fiotv fiotv fiortv fiortv fiortv fiortv ao fiortv fiotv fiortv or fotv nor ao or ao o fgiortv fotv no fgiortv fgiotv o nor acfginorstv io acfginorstv acfginorstv fotv aio no fgiotv nor fotv o nor fotv ao nor or ino fgiortv cfgostv fiortv fiortv fiortv cfgiortv fiortv fiortv no or io`,technologyEvent:`fotv fotv fortv fotv fotv fotv fotv fotv ao no fotv fotv fortv fotv fotv fotv ao fotv fotv fotv o fotv nor ao o ao o fotv fotv no fotv fotv o nor acfgnorstv o acfginorstv acfginorstv fotv ao no fotv nor fotv o nor fotv ao nor o no fotv fotv cfgostv fotv fotv fotv fotv fotv no o o`,technologyFunction:`fotv fotv fotv fortv fortv fotv fortv fortv ao no fotv fotv fotv fortv fortv fotv ao fortv fotv fortv or fotv nor ao or ao o fotv fotv no fotv fotv o nor acfgnorstv o acfginorstv acfginorstv fotv ao no fotv nor fotv o nor fotv ao nor o no fotv fotv fotv cfgostv cfgotv fotv cfgotv fortv no or o`,technologyInteraction:`fotv fotv fotv fortv fortv fotv fortv fortv ao no fotv fotv fotv fortv fortv fotv ao fortv fotv fortv or fotv nor ao or ao o fotv fotv no fotv fotv o nor acfgnorstv o acfginorstv acfginorstv fotv ao no fotv nor fotv o nor fotv ao nor o no fotv fotv fotv cfgotv cfgostv fotv cfgotv fortv no or o`,technologyInterface:`fotv fotv fotv fotv fotv fortv fotv fortv ao no fotv fotv fotv fotv fotv fortv ao fotv fotv fortv or fotv nor ao or ao o fotv fotv no fotv fotv o nor acfginorstv o acfginorstv acfginorstv fotv ao no fotv nor fotv o nor fotv ao nor or no fotv fotv fotv fotv fotv cfgostv fotv fiotv no or o`,technologyProcess:`fotv fotv fotv fortv fortv fotv fortv fortv ao no fotv fotv fotv fortv fortv fotv ao fortv fotv fortv or fotv nor ao or ao o fotv fotv no fotv fotv o nor acfgnorstv o acfginorstv acfginorstv fotv ao no fotv nor fotv o nor fotv ao nor o no fotv fotv fotv cfgotv cfgotv fotv cfgostv fortv no or o`,technologyService:`fotv fotv fotv fotv fotv fotv fotv fortv ao no fotv fotv fotv fotv fotv fotv ao fotv fotv fortv or fotv nor ao or ao o fotv fotv no fotv fotv o nor acfgnorstv o acfginorstv acfginorstv fotv ao no fotv nor fotv o nor fotv ao nor o no fotv fotv fotv fotv fotv fotv fotv cfgostv no or o`,value:`o o o o o o o o o no o o o o o o o o o o o o no o o o o o o no o o o no cgnos o acfginorstv acfginorstv o o no o no o o no o o no o no o o o o o o o o cgnos o o`,valueStream:`o o o o o o o o o no o o o o o o o o o o fotv o nor o fortv o o o o no o o o nor cfgnorstv o acfginorstv acfginorstv o o no o nor o o nor o o nor fotv no o o o o o o o o no cfgostv o`,workPackage:`or or or or or or or or or no or or or or or or or or or or or or nor or or or aor or or no or or o nor acfgnorst fot acfginorstv acfginorstv or or no or nor or fort nor or or nor or nor or or or or or or or or no or cfgost`},qC=new Map(GC.map((e,t)=>[e,t])),JC=new Map(Object.entries(WC)),YC=new Map;for(let e of GC){let t=KC[e].split(` `);for(let[n,r]of GC.entries()){let i=t[n]??`-`,a=new Set;for(let e of i){let t=JC.get(e);t!==void 0&&a.add(t)}YC.set(`${e}>${r}`,a)}}var XC=new Set,ZC=e=>qC.has(e),QC=(e,t)=>YC.get(`${e}>${t}`)??XC;new Map(k_.map(e=>[e.id,e.aspect])),new Set(GC),new Set(A_);var $C=A_,ew=(e,t,n)=>{let r=e.nodes.find(e=>e.id===t),i=e.nodes.find(e=>e.id===n);if(r===void 0||i===void 0||!ZC(r.coreKindLabel)||!ZC(i.coreKindLabel))return[];let a=[...QC(r.coreKindLabel,i.coreKindLabel)].sort();if(r.portKinds.length===0||i.portKinds.length===0)return a;let o=new Set(i.portKinds),s=a.filter(e=>r.portKinds.includes(e)&&o.has(e));return s.length===0?a:s},tw=(e,t,n,r,i=[])=>{let a=new Set([...e.nodes.map(e=>e.id),...e.edges.map(e=>e.id),...i]),o=`${t}-${n}-${r}`;if(!a.has(o))return o;for(let e=2;;e+=1){let t=`${o}-${e}`;if(!a.has(t))return t}},nw=(e,t,n,r,i=[])=>{if(!ew(e,t,r).includes(n))return null;let a=e.nodes.find(e=>e.id===t);return a===void 0?null:{op:`add-relationship`,document:a.document,relationship:{id:tw(e,t,n,r,i),kind:n,from:t,to:r}}},rw=e=>e.flatMap(e=>{let t=e.op===`rename-concept`||e.op===`rename-relationship`?[e.to]:[];return`relationship`in e?[e.relationship.id,...t]:`concept`in e?[e.concept.id,...t]:t}),iw=(e,t,n,r)=>{let i=new Set(ew(e,t.from,t.to));if(i.size===0)return{options:n,narrowed:!1};let a=new Set($C);return{options:n.filter(e=>i.has(e.coreLabel)||!a.has(e.coreLabel)||e.label===r),narrowed:!0}},aw=[`kind`,`name`,`description`,`status`,`owner`],ow=[`aka`,`constraints`,`references`,`presentIn`,`attestations`,`distinctFrom`,`supersedes`],sw=[`kind`,`from`,`to`,`name`,`description`,`status`,`mode`,`content`],cw=[`references`,`presentIn`],lw=(e,t)=>{if(e===t)return!0;if(e===null||t===null||typeof e!=`object`||typeof t!=`object`)return!1;if(Array.isArray(e)||Array.isArray(t))return!Array.isArray(e)||!Array.isArray(t)||e.length!==t.length?!1:e.every((e,n)=>lw(e,t[n]));let n=e,r=t,i=Object.keys(n),a=Object.keys(r);return i.length===a.length&&i.every(e=>lw(n[e],r[e]))},uw=(e,t)=>t===(e??``)?{kind:`none`}:t===``?{kind:`remove`}:{kind:`set`,value:t},dw=(e,t)=>lw(e,t)?{kind:`none`}:t.length>=e.length&&e.every((e,n)=>lw(e,t[n]))?{kind:`append`,added:t.slice(e.length)}:{kind:`replace`,next:t},fw=(e,t,n,r,i)=>r?{op:`update-concept`,document:e,concept:{id:t,[n]:i}}:{op:`update-concept`,document:e,concept:{id:t},remove:[n]},pw=(e,t,n,r)=>r===null?{op:`update-concept`,document:e,concept:{id:t},remove:[n]}:{op:`update-concept`,document:e,concept:{id:t,[n]:r}},mw=(e,t,n,r,i)=>r?{op:`update-relationship`,document:e,relationship:{id:t,[n]:i}}:{op:`update-relationship`,document:e,relationship:{id:t},remove:[n]},hw=(e,t,n,r)=>r===null?{op:`update-relationship`,document:e,relationship:{id:t},remove:[n]}:{op:`update-relationship`,document:e,relationship:{id:t,[n]:r}},gw=(e,t,n,r,i)=>{let a=uw(r,i);return a.kind===`none`?[]:a.kind===`remove`?[fw(e,t,n,!1,``)]:[fw(e,t,n,!0,a.value)]},_w=(e,t,n,r,i)=>{let a=uw(r,i);return a.kind===`none`?[]:a.kind===`remove`?[mw(e,t,n,!1,``)]:[mw(e,t,n,!0,a.value)]},vw=(e,t,n,r,i)=>{let a=dw(r,i);if(a.kind===`none`)return[];if(a.kind===`append`)return a.added.length===0?[]:[pw(e,t,n,a.added)];let o=[pw(e,t,n,null)];return a.next.length>0&&o.push(pw(e,t,n,a.next)),o},yw=(e,t,n,r,i)=>{let a=dw(r,i);if(a.kind===`none`)return[];if(a.kind===`append`)return a.added.length===0?[]:[hw(e,t,n,a.added)];let o=[hw(e,t,n,null)];return a.next.length>0&&o.push(hw(e,t,n,a.next)),o},bw=e=>e.expects===null?{id:e.id,ref:e.ref}:{id:e.id,ref:e.ref,expects:e.expects},xw=(e,t,n,r)=>{let i=dw(n,r);if(i.kind===`none`)return[];if(i.kind===`append`)return i.added.length===0?[]:[pw(e,t,`constraints`,i.added.map(bw))];let a=[pw(e,t,`constraints`,null)];return i.next.length>0&&a.push(pw(e,t,`constraints`,i.next.map(bw))),a},Sw=e=>({topic:e.topic,by:e.by,recordedBy:e.recordedBy??``,on:e.on}),Cw=(e,t,n,r)=>{let i=dw(n,r);if(i.kind===`none`)return[];if(i.kind===`append`)return i.added.length===0?[]:[pw(e,t,`attestations`,i.added.map(Sw))];let a=[pw(e,t,`attestations`,null)];return i.next.length>0&&a.push(pw(e,t,`attestations`,i.next.map(Sw))),a},ww=(e,t)=>{let n={...e},r=t.concept;for(let e of aw)r[e]!==void 0&&(n[e]=r[e]);for(let e of ow){let t=r[e];t!==void 0&&t.length>0&&(n[e]=[...n[e],...t])}for(let e of t.remove??[])n[e]=ow.includes(e)?[]:null;return n},Tw=(e,t)=>{let n=e;for(let r of t)r.op===`update-concept`&&r.document===e.document&&r.concept.id===e.localId&&(n=ww(n,r));return n},Ew=(e,t)=>{let n={...e},r=t.relationship;for(let e of sw)r[e]!==void 0&&(n[e]=r[e]);for(let e of cw){let t=r[e];t!==void 0&&t.length>0&&(n[e]=[...n[e],...t])}for(let e of t.remove??[])n[e]=cw.includes(e)?[]:null;return n},Dw=(e,t)=>{let n=e;for(let r of t)r.op===`update-relationship`&&r.document===e.document&&r.relationship.id===e.localId&&(n=Ew(n,r));return n},Ow=e=>`subject-${e.toLowerCase().replace(/[^a-z0-9]+/g,`-`)}`,kw=({label:e,value:t,options:n,onCommit:r})=>(0,$.jsxs)(`label`,{className:`subject-form-field`,children:[(0,$.jsx)(`span`,{className:`subject-form-label`,children:e}),(0,$.jsx)(`select`,{name:Ow(e),value:t,onChange:e=>r(e.target.value),children:n.map(e=>(0,$.jsx)(`option`,{value:e.value,children:e.label},e.value))})]}),Aw=({label:e,value:t,onCommit:n})=>{let[r,i]=(0,y.useState)(t);return(0,y.useEffect)(()=>i(t),[t]),(0,$.jsxs)(`label`,{className:`subject-form-field`,children:[(0,$.jsx)(`span`,{className:`subject-form-label`,children:e}),(0,$.jsx)(`input`,{type:`text`,name:Ow(e),value:r,onChange:e=>i(e.target.value),onBlur:()=>n(r)})]})},jw=({label:e,values:t,emptyRow:n,isRowFilled:r,renderRow:i,onCommit:a})=>{let[o,s]=(0,y.useState)(t);(0,y.useEffect)(()=>s(t),[t]);let c=e=>{s(e),a(e.filter(r))};return(0,$.jsxs)(`div`,{className:`subject-form-field subject-form-list`,children:[(0,$.jsx)(`span`,{className:`subject-form-label`,children:e}),(0,$.jsxs)(`div`,{className:`subject-form-list-body`,children:[o.map((e,t)=>(0,$.jsxs)(`div`,{className:`subject-form-row`,children:[i(e,{set:e=>s(o.map((n,r)=>r===t?e:n)),commit:()=>c(o),replace:e=>c(o.map((n,r)=>r===t?e:n))}),(0,$.jsx)(`button`,{type:`button`,className:`subject-form-row-remove`,onClick:()=>c(o.filter((e,n)=>n!==t)),children:`Remove`})]},t)),(0,$.jsxs)(`button`,{type:`button`,className:`subject-form-row-add`,onClick:()=>s([...o,n]),children:[`Add `,e]})]})]})},Mw=({label:e,values:t,onCommit:n})=>(0,$.jsx)(jw,{label:e,values:t,emptyRow:``,isRowFilled:e=>e.trim()!==``,onCommit:n,renderRow:(e,{set:t,commit:n})=>(0,$.jsx)(`input`,{type:`text`,value:e,onChange:e=>t(e.target.value),onBlur:n})}),Nw={id:``,ref:``},Pw=({label:e,values:t,onCommit:n})=>(0,$.jsx)(jw,{label:e,values:t,emptyRow:Nw,isRowFilled:e=>e.id.trim()!==``&&e.ref.trim()!==``,onCommit:n,renderRow:(e,{set:t,commit:n})=>(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`input`,{type:`text`,placeholder:`id`,value:e.id,onChange:n=>t({...e,id:n.target.value}),onBlur:n}),(0,$.jsx)(`input`,{type:`text`,placeholder:`ref`,value:e.ref,onChange:n=>t({...e,ref:n.target.value}),onBlur:n})]})}),Fw={id:``,ref:``,expects:null},Iw=({label:e,values:t,onCommit:n})=>(0,$.jsx)(jw,{label:e,values:t,emptyRow:Fw,isRowFilled:e=>e.id.trim()!==``&&e.ref.trim()!==``,onCommit:n,renderRow:(e,{set:t,commit:n,replace:r})=>(0,$.jsxs)(`div`,{className:`subject-form-row-body`,children:[(0,$.jsx)(`input`,{type:`text`,placeholder:`id`,value:e.id,onChange:n=>t({...e,id:n.target.value}),onBlur:n}),(0,$.jsx)(`input`,{type:`text`,placeholder:`ref`,value:e.ref,onChange:n=>t({...e,ref:n.target.value}),onBlur:n}),(0,$.jsxs)(`label`,{className:`subject-form-toggle`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:e.expects!==null,onChange:t=>r({...e,expects:t.target.checked?{provider:``,key:``,value:``}:null})}),`Expects`]}),e.expects===null?null:(0,$.jsxs)(`div`,{className:`subject-form-row-body`,children:[(0,$.jsx)(`input`,{type:`text`,placeholder:`provider`,value:e.expects.provider,onChange:n=>e.expects!==null&&t({...e,expects:{...e.expects,provider:n.target.value}}),onBlur:n}),(0,$.jsx)(`input`,{type:`text`,placeholder:`key`,value:e.expects.key,onChange:n=>e.expects!==null&&t({...e,expects:{...e.expects,key:n.target.value}}),onBlur:n}),(0,$.jsx)(`input`,{type:`text`,placeholder:`value`,value:e.expects.value,onChange:n=>e.expects!==null&&t({...e,expects:{...e.expects,value:n.target.value}}),onBlur:n})]})]})}),Lw={topic:``,by:``,on:``,recordedBy:null},Rw=({label:e,values:t,onCommit:n})=>(0,$.jsx)(jw,{label:e,values:t,emptyRow:Lw,isRowFilled:e=>e.topic.trim()!==``&&e.by.trim()!==``&&e.on.trim()!==``,onCommit:n,renderRow:(e,{set:t,commit:n})=>(0,$.jsxs)(`div`,{className:`subject-form-row-body`,children:[(0,$.jsx)(`input`,{type:`text`,placeholder:`topic`,value:e.topic,onChange:n=>t({...e,topic:n.target.value}),onBlur:n}),(0,$.jsx)(`input`,{type:`text`,placeholder:`by`,value:e.by,onChange:n=>t({...e,by:n.target.value}),onBlur:n}),(0,$.jsx)(`input`,{type:`text`,placeholder:`on`,value:e.on,onChange:n=>t({...e,on:n.target.value}),onBlur:n}),(0,$.jsx)(`input`,{type:`text`,placeholder:`recorded by`,value:e.recordedBy??``,onChange:n=>t({...e,recordedBy:n.target.value}),onBlur:n})]})}),zw={value:``,label:`— unset —`},Bw=[zw,{value:`planned`,label:`planned`},{value:`current`,label:`current`},{value:`retired`,label:`retired`}],Vw=[zw,{value:`read`,label:`read`},{value:`write`,label:`write`},{value:`read-write`,label:`read-write`},{value:`unspecified`,label:`unspecified`}],Hw=(e,t)=>t.find(t=>t.id===e)?.label??HC(e),Uw=(e,t)=>{let n=t.find(t=>t.id===e);return n===void 0?HC(e):UC(n)},Ww=({node:e,model:t,operations:n,onStageChange:r})=>{let i=Tw(e,n),a=e.document,o=e.localId,s=e=>e.forEach(r),c=t.vocabulary.conceptKinds.map(e=>({value:e.label,label:UC(e)})),l=Hw(i.kind,t.vocabulary.conceptKinds);return(0,$.jsxs)(`div`,{className:`subject-form`,children:[(0,$.jsxs)(`div`,{className:`subject-form-field`,children:[(0,$.jsx)(`span`,{className:`subject-form-label`,children:`Identity`}),(0,$.jsx)(`code`,{children:e.id})]}),(0,$.jsx)(kw,{label:`Kind`,value:l,options:c,onCommit:e=>s(gw(a,o,`kind`,l,e))}),(0,$.jsx)(Aw,{label:`Name`,value:i.name,onCommit:e=>s(gw(a,o,`name`,i.name,e))}),(0,$.jsx)(Aw,{label:`Description`,value:i.description??``,onCommit:e=>s(gw(a,o,`description`,i.description,e))}),(0,$.jsx)(kw,{label:`Status`,value:i.status??``,options:Bw,onCommit:e=>s(gw(a,o,`status`,i.status,e))}),(0,$.jsx)(Aw,{label:`Owner`,value:i.owner??``,onCommit:e=>s(gw(a,o,`owner`,i.owner,e))}),(0,$.jsx)(Mw,{label:`Aka`,values:i.aka,onCommit:e=>s(vw(a,o,`aka`,i.aka,e))}),(0,$.jsx)(Mw,{label:`Distinct from`,values:i.distinctFrom,onCommit:e=>s(vw(a,o,`distinctFrom`,i.distinctFrom,e))}),(0,$.jsx)(Mw,{label:`Supersedes`,values:i.supersedes,onCommit:e=>s(vw(a,o,`supersedes`,i.supersedes,e))}),(0,$.jsx)(Mw,{label:`Present in`,values:i.presentIn,onCommit:e=>s(vw(a,o,`presentIn`,i.presentIn,e))}),(0,$.jsx)(Pw,{label:`References`,values:i.references,onCommit:e=>s(vw(a,o,`references`,i.references,e))}),(0,$.jsx)(Iw,{label:`Constraints`,values:i.constraints,onCommit:e=>s(xw(a,o,i.constraints,e))}),(0,$.jsx)(Rw,{label:`Attestations`,values:i.attestations,onCommit:e=>s(Cw(a,o,i.attestations,e))})]})},Gw=({label:e,value:t})=>t===``?null:(0,$.jsxs)(`div`,{className:`subject-form-field`,children:[(0,$.jsx)(`span`,{className:`subject-form-label`,children:e}),(0,$.jsx)(`span`,{className:`subject-fact-value`,children:t})]}),Kw=({node:e,model:t})=>(0,$.jsxs)(`div`,{className:`subject-form subject-facts`,children:[(0,$.jsxs)(`div`,{className:`subject-form-field`,children:[(0,$.jsx)(`span`,{className:`subject-form-label`,children:`Identity`}),(0,$.jsx)(`code`,{children:e.id})]}),(0,$.jsx)(Gw,{label:`Kind`,value:Uw(e.kind,t.vocabulary.conceptKinds)}),(0,$.jsx)(Gw,{label:`Name`,value:e.name}),(0,$.jsx)(Gw,{label:`Status`,value:e.status??``}),(0,$.jsx)(Gw,{label:`Owner`,value:e.owner??``}),(0,$.jsx)(Gw,{label:`Aka`,value:e.aka.join(`, `)}),(0,$.jsx)(Gw,{label:`Distinct from`,value:e.distinctFrom.join(`, `)}),(0,$.jsx)(Gw,{label:`Supersedes`,value:e.supersedes.join(`, `)}),(0,$.jsx)(Gw,{label:`Present in`,value:e.presentIn.join(`, `)}),(0,$.jsx)(Gw,{label:`References`,value:e.references.map(e=>`${e.id}: ${e.ref}`).join(`; `)}),(0,$.jsx)(Gw,{label:`Constraints`,value:e.constraints.map(e=>`${e.id}: ${e.ref}`).join(`; `)}),(0,$.jsx)(Gw,{label:`Attestations`,value:e.attestations.map(e=>`${e.topic} by ${e.by} on ${e.on}`).join(`; `)})]}),qw=({edge:e,model:t})=>{let n=e=>t.graph.nodes.find(t=>t.id===e)?.name??e;return(0,$.jsxs)(`div`,{className:`subject-form subject-facts`,children:[(0,$.jsxs)(`div`,{className:`subject-form-field`,children:[(0,$.jsx)(`span`,{className:`subject-form-label`,children:`Identity`}),(0,$.jsx)(`code`,{children:e.id})]}),(0,$.jsx)(Gw,{label:`Kind`,value:Uw(e.kind,t.vocabulary.relationshipKinds)}),(0,$.jsx)(Gw,{label:`From`,value:n(e.from)}),(0,$.jsx)(Gw,{label:`To`,value:n(e.to)}),(0,$.jsx)(Gw,{label:`Name`,value:e.name??``}),(0,$.jsx)(Gw,{label:`Mode`,value:e.mode??``}),(0,$.jsx)(Gw,{label:`Content`,value:e.content??``}),(0,$.jsx)(Gw,{label:`Status`,value:e.status??``}),(0,$.jsx)(Gw,{label:`References`,value:e.references.map(e=>`${e.id}: ${e.ref}`).join(`; `)}),(0,$.jsx)(Gw,{label:`Present in`,value:e.presentIn.join(`, `)})]})},Jw=({edge:e,model:t,operations:n,onStageChange:r})=>{let i=Dw(e,n),a=e.document,o=e.localId,s=e=>e.forEach(r),c=Hw(i.kind,t.vocabulary.relationshipKinds),l=iw(t.graph,{from:i.from,to:i.to},t.vocabulary.relationshipKinds,c).options.map(e=>({value:e.label,label:UC(e)})),u=t.graph.nodes.map(e=>({value:e.id,label:e.name}));return(0,$.jsxs)(`div`,{className:`subject-form`,children:[(0,$.jsxs)(`div`,{className:`subject-form-field`,children:[(0,$.jsx)(`span`,{className:`subject-form-label`,children:`Identity`}),(0,$.jsx)(`code`,{children:e.id})]}),(0,$.jsx)(kw,{label:`Kind`,value:c,options:l,onCommit:e=>s(_w(a,o,`kind`,c,e))}),(0,$.jsx)(kw,{label:`From`,value:i.from,options:u,onCommit:e=>s(_w(a,o,`from`,i.from,e))}),(0,$.jsx)(kw,{label:`To`,value:i.to,options:u,onCommit:e=>s(_w(a,o,`to`,i.to,e))}),(0,$.jsx)(Aw,{label:`Name`,value:i.name??``,onCommit:e=>s(_w(a,o,`name`,i.name,e))}),(0,$.jsx)(Aw,{label:`Description`,value:i.description??``,onCommit:e=>s(_w(a,o,`description`,i.description,e))}),(0,$.jsx)(kw,{label:`Mode`,value:i.mode??``,options:Vw,onCommit:e=>s(_w(a,o,`mode`,i.mode,e))}),(0,$.jsx)(Aw,{label:`Content`,value:i.content??``,onCommit:e=>s(_w(a,o,`content`,i.content,e))}),(0,$.jsx)(kw,{label:`Status`,value:i.status??``,options:Bw,onCommit:e=>s(_w(a,o,`status`,i.status,e))}),(0,$.jsx)(Pw,{label:`References`,values:i.references,onCommit:e=>s(yw(a,o,`references`,i.references,e))}),(0,$.jsx)(Mw,{label:`Present in`,values:i.presentIn,onCommit:e=>s(yw(a,o,`presentIn`,i.presentIn,e))})]})},Yw={realization:{out:`realizes`,in:`realizes it`},influence:{out:`influences`,in:`influences it`},serving:{out:`serves`,in:`serves it`},assignment:{out:`is assigned to`,in:`is assigned to it`},composition:{out:`composes`,in:`it is part of`},aggregation:{out:`aggregates`,in:`it belongs to`},access:{out:`accesses`,in:`accesses it`},flow:{out:`flows to`,in:`flows to it`},triggering:{out:`triggers`,in:`triggers it`},association:{out:`is associated with`,in:`is associated with it`},specialization:{out:`specializes`,in:`specializes it`}},Xw=(e,t)=>{let n=HC(e),r=Yw[n];return r===void 0?t===`incoming`?`${n} to it`:`${n}`:t===`incoming`?r.in:r.out},Zw=(e,t)=>e.map(e=>Xw(e,t)).join(` or `),Qw=e=>{for(let t of e.trigger??[]){let n=$w(t,e);if(n!==null)return n}return null},$w=(e,t)=>{switch(e.condition){case`missing-relationship`:case`missing-linkage`:{let t=e.direction===`incoming`,n=e.kinds,r=t?`incoming`:`outgoing`;return{kind:`connect`,label:t?`Connect what ${Zw(n,r)}…`:`Connect what it ${Zw(n,r)}…`,kinds:n,direction:r}}case`isolated`:return{kind:`connect`,label:`Connect it to something…`,kinds:[],direction:`outgoing`};case`no-subject-of-kind`:{let t=e.kinds[0];if(t===void 0)return null;let n=HC(t);return{kind:`add`,label:`Add ${eT(n)} ${n}…`,subjectKind:n}}case`missing-claim`:case`missing-reference`:case`missing-constraint`:case`missing-attestation`:case`missing-part`:return t.scope===`workspace`?null:{kind:`describe`,label:`Fill it in under properties…`};default:return null}},eT=e=>/^[aeiou]/i.test(e)?`an`:`a`,tT=(e,t)=>{let n=[`A question from the architecture record, asked by yarramate.`,``,`Question: ${e.question}`];t!==null&&n.push(`About: ${t.name} (${t.id})`),e.materiality!==void 0&&n.push(`Why it matters: ${e.materiality}`),e.resolution!==void 0&&n.push(`What closes it: ${e.resolution}`);let r=nT(e,t);return r!==null&&n.push(``,`Answer as a yarramate/operations/v1 document I can apply. The shape the question implies:`,``,r),n.push(``,`If the question does not apply here, say so in one sentence instead.`),n.join(`
370
+ `)},nT=(e,t)=>{let n=e.trigger?.[0];if(n===void 0)return null;let r=`.yarramate/architecture/<document>.yaml`;switch(n.condition){case`no-subject-of-kind`:{let e=n.kinds[0];return e===void 0?null:[`format: yarramate/operations/v1`,`operations:`,` - op: add-concept`,` document: ${r}`,` concept:`,` id: <local-id>`,` kind: ${HC(e)}`,` name: <name>`,` description: <one sentence>`].join(`
371
+ `)}case`missing-relationship`:case`missing-linkage`:{if(t===null)return null;let e=n.kinds[0],i=n.direction===`incoming`;return[`format: yarramate/operations/v1`,`operations:`,` - op: add-relationship`,` document: ${r}`,` relationship:`,` id: <local-id>`,` kind: ${e===void 0?`<kind>`:HC(e)}`,` from: ${i?`<the other subject>`:t.id}`,` to: ${i?t.id:`<the other subject>`}`].join(`
372
+ `)}case`missing-claim`:case`missing-reference`:case`missing-constraint`:case`missing-attestation`:case`missing-part`:return t===null?null:[`format: yarramate/operations/v1`,`operations:`,` - op: update-concept`,` document: ${r}`,` concept:`,` id: ${t.id}`,` <the field the question names>: <value>`].join(`
373
+ `);default:return null}};function rT({overlay:e,selectedId:t,readOnly:n=!1,onVerb:r,onDelegate:i,delegateLabel:a}){let o=t===null?e.workspace:e.subjects[t]??[],s=t===null?`Whole-model questions. Select a subject to see what names it.`:null;return(0,$.jsxs)(`div`,{className:`open-questions`,children:[s===null?null:(0,$.jsx)(`p`,{className:`open-questions-scope`,children:s}),o.length===0?(0,$.jsx)(`p`,{className:`section-empty`,children:t===null?`Nothing open at the whole-model level.`:`No open questions name this subject.`}):(0,$.jsx)(`ul`,{className:`question-list`,children:o.map(e=>(0,$.jsx)(iT,{entry:e,verb:n||r===void 0?null:Qw(e),onVerb:n=>r?.(e,n,t),delegateLabel:n||i===void 0?null:a??`Answer via agent`,onDelegate:()=>i?.(e,t)},e.questionId))}),(0,$.jsxs)(`p`,{className:`open-questions-catalogue`,children:[`Catalogue `,e.catalogue,` · answers land through the changeset, never here.`]})]})}var iT=({entry:e,verb:t,onVerb:n,delegateLabel:r,onDelegate:i})=>(0,$.jsxs)(`li`,{className:`question-row`,children:[(0,$.jsx)(`span`,{className:`question-text`,title:e.materiality,children:e.question}),(0,$.jsxs)(`span`,{className:`question-meta`,children:[(0,$.jsx)(`span`,{className:`question-authority question-authority-${e.authority}`,children:e.authority}),e.since===void 0?null:(0,$.jsxs)(`span`,{className:`question-since`,children:[`since `,e.since]}),t===null?null:(0,$.jsx)(`button`,{type:`button`,className:`question-verb question-verb-${t.kind}`,onClick:()=>n(t),children:t.label}),r===null?null:(0,$.jsx)(`button`,{type:`button`,className:`question-verb question-verb-delegate`,onClick:i,children:r})]})]}),aT={layered:`Layered`,routed:`Routed`,"served-by":`Served-by`,bands:`Layer bands`},oT=[`top-down`,`left-right`],sT={"top-down":`Top-down`,"left-right":`Left-right`};function cT({layout:e,direction:t,onLayoutChange:n,onDirectionChange:r,stylePreset:i,onStyleChange:a}){return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`select`,{className:`canvas-select`,"aria-label":`Layout`,value:e,onChange:e=>n(e.currentTarget.value),children:Pg.map(e=>(0,$.jsx)(`option`,{value:e,children:aT[e]},e))}),(0,$.jsx)(`select`,{className:`canvas-select`,"aria-label":`Direction`,value:t,onChange:e=>r(e.currentTarget.value),children:oT.map(e=>(0,$.jsx)(`option`,{value:e,children:sT[e]},e))}),(0,$.jsx)(`select`,{className:`canvas-select`,"aria-label":`Style`,value:i,onChange:e=>a(e.currentTarget.value),children:Ug.map(e=>(0,$.jsx)(`option`,{value:e.id,children:e.title},e.id))})]})}var lT=[`composition`],uT=`top-down`,dT=e=>{let t=e?.trim()??``;return t===``?null:t},fT=e=>({type:`element`,id:e.id,title:e.name,kind:e.kindLabel,description:dT(e.description)}),pT=(e,t)=>{let n=e.from,r=e.to;return{type:`relationship`,id:e.id,sourceId:n,sourceTitle:t.get(n)??n,targetId:r,targetTitle:t.get(r)??r,label:dT(e.name),description:dT(e.description),kind:e.kindLabel}},mT=e=>new Map(e.nodes.map(e=>[e.id,e.name])),hT=(e,t)=>{let n=e.nodes.find(e=>e.id===t);return n===void 0?null:fT(n)},gT=(e,t)=>{let n=e.edges.find(e=>e.id===t);return n===void 0?null:pT(n,mT(e))},_T=(e,t,n,r,i)=>({showView:t=>{let{views:n}=e();return n.some(e=>e.id===t)?(i(t),!0):!1},select:n=>{let{graph:r}=e();if(r===null)return!1;let i=hT(r,n)??gT(r,n);return i!==null&&(t({type:`subject.selected`,subject:i}),!0)},openDraft:r=>{let{graph:i,readOnly:a}=e();return a||i===null?!1:(n(r?.kind),t({type:`subject.draft.opened`}),!0)},startConnection:n=>{let{graph:r,readOnly:i}=e();return i||r===null||!r.nodes.some(e=>e.id===n)?!1:(t({type:`connection.started`,from:n}),!0)},stagedPins:()=>e().stagedPins,setDecorations:e=>(r(e),!0)}),vT=[`palette`,`properties`,`questions`,`changes`,`chat`],yT=e=>({min:96,max:Math.max(96,e-160)}),bT=(e,t)=>{let{min:n,max:r}=yT(t);return Math.min(r,Math.max(n,e))},xT=.45,ST=(e,t)=>e.length===t.length&&new Set([...e,...t]).size===new Set(e).size,CT=(e,t)=>e.length===t.length&&e.every((e,n)=>e===t[n]),wT=e=>{let t=[];return t.push({type:`layout.set`,layout:e?.layout??`served-by`}),t.push({type:`nesting.set`,nesting:e?.nesting??lT}),t.push({type:`fold.set`,mode:e?.fold??`none`,folded:[],unfolded:[]}),t.push({type:`direction.set`,direction:e?.direction??`top-down`}),e?.showLifecycle!==void 0&&t.push({type:`presentation.toggled`,flag:`showLifecycle`,value:e.showLifecycle}),e?.showEvidence!==void 0&&t.push({type:`presentation.toggled`,flag:`showEvidence`,value:e.showEvidence}),e?.showOwnership!==void 0&&t.push({type:`presentation.toggled`,flag:`showOwnership`,value:e.showOwnership}),e?.showKindLabels!==void 0&&t.push({type:`presentation.toggled`,flag:`showKindLabels`,value:e.showKindLabels}),t},TT=(e,t,n,r)=>!r||e===``||e===n?null:t.find(t=>t.id===e)??null,ET=e=>({min:320,max:Math.max(320,Math.min(640,e*xT))}),DT=(e,t)=>{let{min:n,max:r}=ET(t);return Math.min(r,Math.max(n,e))},OT=480,kT=(e,t)=>{let{min:n,max:r}=ET(t);return Math.min(Math.min(r,OT),Math.max(n,e))},AT=(e,t=0)=>({railHidden:!1,conversation:{width:kT(e*.28,e),hidden:!1,unread:0,collapsed:[],changesHeight:200,chatHeight:300},viewportWidth:e,viewportHeight:t,selectedSubject:null,descriptionExpanded:!1,detailsOpen:!1,bottomPanel:{open:!1,tab:`view-query`},tree:{filterText:``,collapsed:[]},connection:null,draftingSubject:!1,pendingDeletion:null,pendingViewDeletion:null,pendingViewRename:null,contextMenu:null,nesting:lT,foldMode:wg,folded:[],unfolded:[],direction:uT,layout:Fg,showLifecycle:!0,showEvidence:!0,showKindLabels:!0,showOwnership:!1,showNudges:!0,stylePreset:Kg()}),jT=(e,t)=>{switch(t.type){case`section.toggled`:{let n=e.conversation.collapsed.includes(t.section);return{...e,conversation:{...e.conversation,collapsed:n?e.conversation.collapsed.filter(e=>e!==t.section):[...e.conversation.collapsed,t.section],unread:t.section===`chat`&&n?0:e.conversation.unread}}}case`section.resized`:{let n=bT(t.height,e.viewportHeight),r=t.section===`chat`?`chatHeight`:`changesHeight`;return e.conversation[r]===n?e:{...e,conversation:{...e.conversation,[r]:n}}}case`conversation.resized`:{if(e.conversation.hidden)return e;let n=DT(t.width,e.viewportWidth);return n===e.conversation.width?e:{...e,conversation:{...e.conversation,width:n}}}case`rail.toggled`:return{...e,railHidden:!e.railHidden};case`conversation.toggled`:{let t=!e.conversation.hidden;return{...e,conversation:{...e.conversation,hidden:t,unread:!t&&!e.conversation.collapsed.includes(`chat`)?0:e.conversation.unread}}}case`viewport.resized`:{let n=DT(e.conversation.width,t.viewportWidth),r=t.viewportHeight??e.viewportHeight,i=bT(e.conversation.changesHeight,r),a=bT(e.conversation.chatHeight,r);return n===e.conversation.width&&i===e.conversation.changesHeight&&a===e.conversation.chatHeight&&t.viewportWidth===e.viewportWidth&&r===e.viewportHeight?e:{...e,conversation:{...e.conversation,width:n,changesHeight:i,chatHeight:a},viewportWidth:t.viewportWidth,viewportHeight:r}}case`attention.received`:return e.conversation.hidden||e.conversation.collapsed.includes(`chat`)?{...e,conversation:{...e.conversation,unread:e.conversation.unread+1}}:e;case`menu.opened`:return{...e,contextMenu:{target:t.target,x:t.x,y:t.y}};case`menu.dismissed`:return e.contextMenu===null?e:{...e,contextMenu:null};case`connection.started`:return{...e,connection:{from:t.from,to:null,...t.kinds===void 0?{}:{kinds:t.kinds},...t.direction===void 0?{}:{direction:t.direction}},draftingSubject:!1,contextMenu:null};case`connection.targeted`:return e.connection===null?e:t.to===e.connection.from?{...e,connection:null}:{...e,connection:{...e.connection,to:t.to}};case`connection.cancelled`:return e.connection===null?e:{...e,connection:null};case`subject.draft.opened`:return{...e,draftingSubject:!0,connection:null,contextMenu:null};case`subject.draft.closed`:return e.draftingSubject?{...e,draftingSubject:!1}:e;case`deletion.asked`:return{...e,pendingDeletion:t.id,connection:null,draftingSubject:!1,contextMenu:null};case`deletion.dismissed`:return e.pendingDeletion===null?e:{...e,pendingDeletion:null};case`viewDeletion.asked`:return{...e,pendingViewDeletion:t.id,contextMenu:null};case`viewDeletion.dismissed`:return e.pendingViewDeletion===null?e:{...e,pendingViewDeletion:null};case`viewRename.asked`:return{...e,pendingViewRename:t.id,contextMenu:null};case`viewRename.dismissed`:return e.pendingViewRename===null?e:{...e,pendingViewRename:null};case`subject.selected`:return{...e,conversation:{...e.conversation,collapsed:e.conversation.collapsed.filter(e=>e!==`properties`)},selectedSubject:t.subject,descriptionExpanded:!1,contextMenu:null};case`subject.cleared`:return e.selectedSubject===null?e:{...e,selectedSubject:null,descriptionExpanded:!1};case`description.toggled`:return e.selectedSubject===null?e:{...e,descriptionExpanded:!e.descriptionExpanded};case`details.toggled`:return{...e,detailsOpen:!e.detailsOpen};case`bottomPanel.toggled`:return{...e,bottomPanel:{...e.bottomPanel,open:!e.bottomPanel.open}};case`bottomPanel.tabSelected`:return e.bottomPanel.open&&e.bottomPanel.tab===t.tab?e:{...e,bottomPanel:{open:!0,tab:t.tab}};case`tree.filtered`:return e.tree.filterText===t.filterText?e:{...e,tree:{...e.tree,filterText:t.filterText}};case`tree.toggled`:{let n=e.tree.collapsed.includes(t.key);return{...e,tree:{...e.tree,collapsed:n?e.tree.collapsed.filter(e=>e!==t.key):[...e.tree.collapsed,t.key]}}}case`nesting.set`:return CT(e.nesting,t.nesting)?e:{...e,nesting:t.nesting};case`fold.set`:return e.foldMode===t.mode&&ST(e.folded,t.folded)&&ST(e.unfolded,t.unfolded)?e:{...e,foldMode:t.mode,folded:t.folded,unfolded:t.unfolded};case`fold.toggled`:{let n=e.folded.includes(t.id)||e.foldMode===`instances`&&!e.unfolded.includes(t.id);return{...e,folded:n?e.folded.filter(e=>e!==t.id):[...e.folded.filter(e=>e!==t.id),t.id],unfolded:n?[...e.unfolded.filter(e=>e!==t.id),t.id]:e.unfolded.filter(e=>e!==t.id)}}case`fold.all`:return t.folded?{...e,folded:[...t.ids],unfolded:[]}:{...e,folded:[],unfolded:[...t.ids]};case`direction.set`:return e.direction===t.direction?e:{...e,direction:t.direction};case`layout.set`:return e.layout===t.layout?e:{...e,layout:t.layout};case`presentation.toggled`:return{...e,[t.flag]:t.value};case`style.set`:return e.stylePreset===t.preset?e:{...e,stylePreset:t.preset};case`model.replaced`:{let n=e.contextMenu===null?e:{...e,contextMenu:null},r=n.selectedSubject;if(r===null)return n;let i=t.graph,a=i===null?null:r.type===`element`?hT(i,r.id):gT(i,r.id);return a===null?{...n,selectedSubject:null,descriptionExpanded:!1}:{...n,selectedSubject:a}}}},MT=(e,t)=>{let n=e.trim();if(t===null)return n;if(t.type===`element`)return`About element “${t.title}” (${t.id}): ${n}`;let r=`${t.sourceTitle} → ${t.targetTitle}`;return`About relationship “${t.label===null?r:`${r} — ${t.label}`}”: ${n}`};function NT({id:e,label:t,meta:n,open:r,onToggle:i,children:a}){return(0,$.jsxs)(`section`,{className:`stack-section stack-section-${e}`,children:[(0,$.jsxs)(`h2`,{className:`section-head`,children:[(0,$.jsxs)(`button`,{type:`button`,className:`section-toggle`,"aria-expanded":r,"aria-controls":`section-${e}`,onClick:i,children:[(0,$.jsx)(`span`,{className:`section-chevron`,"aria-hidden":`true`,children:r?`▾`:`▸`}),(0,$.jsx)(`span`,{className:`section-label`,children:t})]}),n===void 0?null:(0,$.jsx)(`span`,{className:`section-meta`,children:n})]}),(0,$.jsx)(`div`,{className:`section-body`,id:`section-${e}`,hidden:!r,children:a})]})}function PT({label:e,height:t,viewportHeight:n,onResize:r}){let i=yT(n),a=(0,y.useRef)(null),o=e=>{let t=a.current;t?.pointerId===e.pointerId&&r(t.startHeight+t.startY-e.clientY)},s=e=>{a.current={pointerId:e.pointerId,startY:e.clientY,startHeight:t},e.currentTarget.setPointerCapture(e.pointerId)},c=e=>{a.current?.pointerId===e.pointerId&&(a.current=null,e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId))};return(0,$.jsx)(`div`,{className:`section-splitter`,role:`separator`,"aria-label":e,"aria-orientation":`horizontal`,"aria-valuenow":Math.round(t),"aria-valuemin":i.min,"aria-valuemax":Math.round(i.max),tabIndex:0,onPointerDown:s,onPointerMove:o,onPointerUp:c,onPointerCancel:c,onKeyDown:e=>{if(e.key!==`ArrowUp`&&e.key!==`ArrowDown`)return;e.preventDefault();let n=e.shiftKey?32:8;r(t+(e.key===`ArrowUp`?n:-n))}})}var FT=(e,t,n)=>vT.filter(t=>e.includes(t)).flatMap((e,r)=>{let i=r===0?void 0:n[e];return[...i===void 0?[]:[(0,$.jsx)(y.Fragment,{children:i},`splitter-${e}`)],(0,$.jsx)(y.Fragment,{children:t[e]},e)]}),IT={messageBytes:65536,modelBytes:5242880,transcriptBytes:5242880,pendingEvents:32,reconnectMs:3e5,staleSessionMs:864e5}.reconnectMs,LT=`Returning control to the main agent`,RT={operations:[],viewOperations:[],sourceDigests:{}},zT=e=>e.operations.length===0&&e.viewOperations.length===0,BT={lifecycle:`connecting`,authority:`canonical`,title:``,description:``,chatEnabled:!1,model:null,styleNonce:``,activeView:``,transcript:[],views:[],choices:null,agentStatus:null,diagnostics:[],handoff:null,composerEnabled:!1,awaitingAgent:!1,localRecords:0,lastSequence:0,frozen:!1,activeFilter:null,focusReturn:null,quickFilterText:``,closedReason:null,pendingChangeset:RT,undoStack:[],redoStack:[],commitStatus:`idle`,commitDiagnostics:null,commitNotice:null,layoutNotice:null},VT=e=>({authority:e.authority,title:e.title,description:e.description,chatEnabled:e.chatEnabled,model:e.model,transcript:e.transcript,agentTurnOpen:e.agentTurnOpen,choices:e.pendingChoice,styleNonce:e.styleNonce,lastSequence:e.lastSequence,frozen:e.frozen,views:e.views}),HT=(e,t)=>t-e<IT,UT=(e,t,n)=>({id:`local-${e.localRecords}`,speaker:t,text:n}),WT=(e,t)=>e.transcript.some(e=>e.id===t.id)?e.transcript:[...e.transcript,t],GT=e=>e.initialView,KT={awaitingAgent:!1,agentStatus:null},qT=e=>{let t=(e,t)=>Object.keys(e).filter(e=>!t.includes(e)).sort().join(`:`);if(`concept`in e){let n=e.concept;return`${e.op}:${e.document}:concept:${n.id}:${t(n,[`id`])}`}if(`relationship`in e){let n=e.relationship;return`${e.op}:${e.document}:relationship:${n.id}:${t(n,[`id`])}`}let n=e.observation,r=`${n.subject??n.claim}:${n.key??``}`;return`${e.op}:${e.document}:observation:${r}:${t(n,[`subject`,`claim`,`key`])}`},JT=(e,t,n,r)=>{let i={},a=(e,t)=>{if(i[e]!==void 0)return;let r=n[e]??t;r!==void 0&&(i[e]=r)};for(let t of e)a(t.document,r?.sourceDigests[t.document]);for(let e of t)a(e.path,r?.projectionDigests[e.path]);return i},YT=(e,t,n)=>{let r=n.operations??e.operations,i=n.viewOperations??e.viewOperations;return{operations:r,viewOperations:i,sourceDigests:JT(r,i,e.sourceDigests,t)}},XT=(e,t)=>{switch(t.type){case`session.loaded`:return{...e,...t.snapshot,lifecycle:e.lifecycle===`ending`?`ending`:`active`,activeView:GT(t.snapshot.model),transcript:[...t.snapshot.transcript,...e.transcript.filter(e=>e.speaker===`session`)],awaitingAgent:t.snapshot.agentTurnOpen,agentStatus:t.snapshot.agentTurnOpen?e.agentStatus:null,lastSequence:Math.max(e.lastSequence,t.snapshot.lastSequence)};case`model.received`:return{...e,model:t.model,views:t.views,diagnostics:[]};case`diagnostic.received`:return{...e,diagnostics:t.diagnostics,...KT};case`chat.sent`:return{...e,transcript:WT(e,UT(e,`reviewer`,t.text)),localRecords:e.localRecords+1,choices:null,awaitingAgent:!0};case`chat.received`:return{...e,transcript:WT(e,{id:t.id,speaker:`agent`,text:t.text}),...KT};case`status.received`:return{...e,agentStatus:t.status};case`choice.presented`:return{...e,choices:t.choice,...KT};case`choice.sent`:{let n=e.choices?.options.find(e=>e.id===t.optionId);return n===void 0?e:{...e,transcript:WT(e,UT(e,`reviewer`,n.label)),localRecords:e.localRecords+1,choices:null,awaitingAgent:!0}}case`view.navigated`:return e.activeView===t.viewId?e:{...e,activeView:t.viewId,focusReturn:null};case`handoff.received`:return{...e,handoff:t.handoff,transcript:WT(e,{id:t.id,speaker:`agent`,text:t.handoff.summary}),...KT};case`event.acknowledged`:return{...e,lastSequence:Math.max(e.lastSequence,t.sequence)};case`input.refused`:{let n=e=>t.refused===void 0||t.refused===e;return{...e,diagnostics:t.diagnostics,frozen:e.frozen||t.frozen,...n(`changeset.commit`)?{commitStatus:`idle`,commitDiagnostics:t.diagnostics}:{},...n(`chat.message`)||n(`choice.selected`)?KT:{}}}case`end.requested`:return{...e,lifecycle:`ending`,choices:null,transcript:WT(e,UT(e,`session`,LT)),localRecords:e.localRecords+1};case`connection.lost`:return{...e,lifecycle:`disconnected`};case`session.closed`:return{...e,lifecycle:`closed`,closedReason:t.reason};case`filter.applied`:return{...e,focusReturn:t.source===`focus`?e.activeFilter?.source===`focus`?e.focusReturn:{activeView:e.activeView,activeFilter:e.activeFilter}:null,activeFilter:{query:t.query,matchedIds:t.matchedIds,excluded:t.excluded,source:t.source},activeView:t.source===`view`||t.source===`editor`?e.activeView:``};case`filter.cleared`:return e.focusReturn===null?{...e,activeFilter:null,activeView:``,focusReturn:null}:{...e,activeFilter:e.focusReturn.activeFilter,activeView:e.focusReturn.activeView,focusReturn:null};case`quickFilter.changed`:return e.quickFilterText===t.text?e:{...e,quickFilterText:t.text};case`changeset.staged`:{let n=qT(t.operation),r=[...e.pendingChangeset.operations.filter(e=>qT(e)!==n),t.operation];return{...e,pendingChangeset:YT(e.pendingChangeset,e.model,{operations:r}),undoStack:[...e.undoStack,e.pendingChangeset],redoStack:[],commitDiagnostics:null,commitNotice:null}}case`changeset.viewStaged`:{let n=e.pendingChangeset.viewOperations.filter(e=>e.path!==t.operation.path);return{...e,pendingChangeset:YT(e.pendingChangeset,e.model,{viewOperations:[...n,t.operation]}),undoStack:[...e.undoStack,e.pendingChangeset],redoStack:[],commitDiagnostics:null,commitNotice:null}}case`changeset.viewMembership`:{let n=e.views.find(({id:e})=>e===t.viewId);if(n===void 0)return e;let r=e.pendingChangeset.viewOperations.find(e=>e.path===n.path),i=TS({id:n.id,title:n.title,description:n.description,query:n.query,presentation:n.presentation}),a=DS(r?.op===`write-view`?r.projection:i,t.subjectId,t.membership);if(a===null)return e;let o=e.pendingChangeset.viewOperations.filter(e=>e.path!==n.path),s=AS(a,i);return{...e,pendingChangeset:YT(e.pendingChangeset,e.model,{viewOperations:s?o:[...o,{op:`write-view`,path:n.path,projection:a}]}),undoStack:[...e.undoStack,e.pendingChangeset],redoStack:[],commitDiagnostics:null,commitNotice:null}}case`changeset.discarded`:{let{index:n}=t,r=e.pendingChangeset.operations.length,i=r+e.pendingChangeset.viewOperations.length;if(n<0||n>=i)return e;let a=n<r?{operations:e.pendingChangeset.operations.filter((e,t)=>t!==n)}:{viewOperations:e.pendingChangeset.viewOperations.filter((e,t)=>t!==n-r)};return{...e,pendingChangeset:YT(e.pendingChangeset,e.model,a),undoStack:[...e.undoStack,e.pendingChangeset],redoStack:[],commitDiagnostics:null}}case`changeset.cleared`:{let t=zT(e.pendingChangeset);return{...e,pendingChangeset:RT,undoStack:t?e.undoStack:[...e.undoStack,e.pendingChangeset],redoStack:t?e.redoStack:[],commitDiagnostics:null}}case`changeset.undone`:{let t=e.undoStack.at(-1);return t===void 0?e:{...e,pendingChangeset:t,undoStack:e.undoStack.slice(0,-1),redoStack:[...e.redoStack,e.pendingChangeset],commitDiagnostics:null}}case`changeset.redone`:{let t=e.redoStack.at(-1);return t===void 0?e:{...e,pendingChangeset:t,redoStack:e.redoStack.slice(0,-1),undoStack:[...e.undoStack,e.pendingChangeset],commitDiagnostics:null}}case`changeset.commit.sent`:return{...e,commitStatus:`committing`,commitDiagnostics:null};case`changeset.committed`:return{...e,pendingChangeset:RT,undoStack:[],redoStack:[],commitStatus:`idle`,commitDiagnostics:null,commitNotice:t.documents};case`apply.failed`:return{...e,commitStatus:`idle`,commitDiagnostics:t.diagnostics};case`layout.saved`:{let n=t.result.ok?`Layout saved`:t.result.message;return{...e,layoutNotice:n}}}},ZT=e=>e.lifecycle===`active`&&e.chatEnabled&&!e.frozen&&!e.awaitingAgent;function QT(e,t){if(e.lifecycle===`closed`)return e;let n=XT(e,t);return n===e?e:{...n,composerEnabled:ZT(n)}}var $T=(e,t)=>{let n=t.lastSequence;switch(e.kind){case`chat`:return{type:`chat.message`,lastAcknowledgedSequence:n,payload:{text:e.text}};case`choice`:return{type:`choice.selected`,lastAcknowledgedSequence:n,payload:{choiceId:e.choiceId,optionId:e.optionId}};case`navigate`:return{type:`view.navigate`,lastAcknowledgedSequence:n,payload:{viewId:e.viewId,requiresAttention:!1}};case`end`:return{type:`session.end`,lastAcknowledgedSequence:n,payload:{reason:`user-ended`}};case`delegate`:return{type:`question.delegate`,lastAcknowledgedSequence:n,payload:e.payload};case`filter`:return{type:`filter.query`,lastAcknowledgedSequence:n,payload:{query:e.query,...e.nesting===void 0?{}:{nesting:e.nesting}}};case`commit-changeset`:return{type:`changeset.commit`,lastAcknowledgedSequence:n,payload:t.pendingChangeset};case`save-layout`:return{type:`layout.save`,lastAcknowledgedSequence:n,payload:e.payload}}},eE=e=>{if(e.focusReturn===null)return;let t=e.focusReturn.activeView;return e.views.find(({id:e})=>e===t)?.title},tE=e=>{let t=e.views.find(({id:t})=>t===e.activeView);if(t===void 0)return null;let n=e.pendingChangeset.viewOperations.find(e=>e.path===t.path),r=n?.op===`write-view`?n.projection.query:t.query;return ES(r)?{kind:`enumerated`,subjects:r.subjects}:{kind:`faceted`,excluded:r.exclude??[]}},nE=(e,t)=>{if(e.kind!==`model`||t.activeFilter===null)return null;let n=t.activeFilter.source===`view`||t.activeFilter.source===`editor`,r=e.views.find(({id:e})=>e===t.activeView);return{query:n&&r!==void 0?r.query:t.activeFilter.query,source:t.activeFilter.source}},rE=(e,t=`panel`)=>{switch(e.kind){case`ready`:return[{type:`session.loaded`,snapshot:VT(e.snapshot)}];case`accepted`:return[{type:`event.acknowledged`,sequence:e.sequence}];case`rejected`:return[{type:`input.refused`,...e.refused===void 0?{}:{refused:e.refused},diagnostics:e.diagnostics,frozen:e.frozen!==void 0}];case`model`:return[{type:`model.received`,model:e.model,views:e.views}];case`closing`:return[{type:`session.closed`,reason:e.reason}];case`filter-result`:return[{type:`filter.applied`,query:e.result.query,matchedIds:e.result.matchedIds,excluded:e.result.excluded,source:t}];case`response`:switch(e.response.type){case`chat.response`:{let t=[{type:`chat.received`,id:e.response.responseId,text:e.response.payload.text}],n=e.response.payload.appliedQuery;return n&&t.push({type:`filter.applied`,query:n.query,matchedIds:n.matchedIds??[],excluded:null,source:`chat`}),t}case`agent.status`:return[{type:`status.received`,status:e.response.payload}];case`choice.present`:return[{type:`choice.presented`,choice:e.response.payload}];case`operations.propose`:return[{type:`chat.received`,id:e.response.responseId,text:e.response.payload.note},...e.response.payload.operations.map(e=>({type:`changeset.staged`,operation:e}))];case`handoff.complete`:return[{type:`handoff.received`,id:e.response.responseId,handoff:e.response.payload}];case`diagnostic`:return[{type:`diagnostic.received`,diagnostics:e.response.payload.diagnostics}]}case`apply-result`:{let t=[];return e.result.ok?t.push({type:`changeset.committed`,documents:e.result.result.documents}):t.push({type:`apply.failed`,diagnostics:e.result.diagnostics}),t}case`layout-save-result`:return[{type:`layout.saved`,result:e.result}]}},iE=e=>{let[t,n]=(0,y.useReducer)(QT,BT),[r,i]=(0,y.useState)(!1),a=(0,y.useRef)(t);a.current=t;let o=(0,y.useRef)(`panel`),s=(0,y.useRef)(e);s.current=e,(0,y.useEffect)(()=>s.current.open({frame:e=>{for(let t of rE(e,o.current))n(t);let t=nE(e,a.current);t!==null&&(o.current=t.source,s.current.send($T({kind:`filter`,query:t.query},a.current)))},connected:i,lost:()=>n({type:`connection.lost`}),session:()=>({lastSequence:a.current.lastSequence,closed:a.current.lifecycle===`closed`})}),[]);let c=(0,y.useCallback)(e=>{s.current.send($T(e,a.current))},[]),l=(0,y.useCallback)(e=>{n({type:`chat.sent`,text:e}),c({kind:`chat`,text:e})},[c]),u=(0,y.useCallback)(e=>{n({type:`chat.sent`,text:`Answer via your agent: ${e.question}`}),c({kind:`delegate`,payload:e})},[c]),d=(0,y.useCallback)(e=>{let t=a.current.choices?.choiceId;t!==void 0&&(n({type:`choice.sent`,optionId:e}),c({kind:`choice`,choiceId:t,optionId:e}))},[c]),f=(0,y.useCallback)(e=>{n({type:`view.navigated`,viewId:e}),c({kind:`navigate`,viewId:e})},[c]),p=(0,y.useCallback)((e,t=`panel`,n)=>{o.current=t,c({kind:`filter`,query:e,...n===void 0?{}:{nesting:n}})},[c]),m=(0,y.useCallback)(()=>{n({type:`filter.cleared`})},[]),h=(0,y.useCallback)(e=>{n({type:`quickFilter.changed`,text:e})},[]),g=(0,y.useCallback)(e=>{n({type:`changeset.staged`,operation:e})},[]);return{state:t,connected:r,ask:l,choose:d,delegate:u,navigate:f,filter:p,clearFilter:m,setQuickFilterText:h,stageViewChange:(0,y.useCallback)(e=>{n({type:`changeset.viewStaged`,operation:e})},[]),stageViewMembership:(0,y.useCallback)((e,t,r)=>{n({type:`changeset.viewMembership`,viewId:e,subjectId:t,membership:r})},[]),stageChange:g,discardChange:(0,y.useCallback)(e=>{n({type:`changeset.discarded`,index:e})},[]),clearChangeset:(0,y.useCallback)(()=>{n({type:`changeset.cleared`})},[]),undoChangeset:(0,y.useCallback)(()=>{n({type:`changeset.undone`})},[]),redoChangeset:(0,y.useCallback)(()=>{n({type:`changeset.redone`})},[]),commitChangeset:(0,y.useCallback)(()=>{zT(a.current.pendingChangeset)||(n({type:`changeset.commit.sent`}),c({kind:`commit-changeset`}))},[c]),saveLayout:(0,y.useCallback)(e=>{c({kind:`save-layout`,payload:e})},[c]),end:(0,y.useCallback)(()=>{n({type:`end.requested`}),c({kind:`end`})},[c])}},aE=(e,t,n,r=8)=>{let i=n.trim().toLowerCase();if(i===``)return{matches:[],more:0};let a=e.nodes.filter(e=>e.id!==t).filter(e=>e.name.toLowerCase().includes(i)||e.id.toLowerCase().includes(i)).map(e=>({id:e.id,name:e.name})).sort((e,t)=>e.name.localeCompare(t.name)||e.id.localeCompare(t.id));return{matches:a.slice(0,r),more:Math.max(0,a.length-r)}},oE=({graph:e,from:t,onTarget:n})=>{let[r,i]=(0,y.useState)(``),{matches:a,more:o}=aE(e,t,r);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`label`,{className:`connection-search-label`,htmlFor:`connection-target-search`,children:`Search targets`}),(0,$.jsx)(`input`,{id:`connection-target-search`,className:`connection-search`,type:`search`,autoComplete:`off`,placeholder:`Target name or id`,value:r,onChange:e=>i(e.currentTarget.value)}),r.trim()===``?null:a.length===0?(0,$.jsx)(`p`,{className:`connection-empty`,children:`No subject matches.`}):(0,$.jsxs)(`ul`,{className:`connection-targets`,children:[a.map(e=>(0,$.jsx)(`li`,{children:(0,$.jsxs)(`button`,{type:`button`,onClick:()=>n(e.id),children:[e.name,(0,$.jsxs)(`span`,{className:`connection-target-id`,children:[` `,e.id]})]})},e.id)),o===0?null:(0,$.jsxs)(`li`,{className:`connection-targets-more`,children:[o,` more match`]})]})]})},sE=({draft:e,graph:t,reservedIds:n,onTarget:r,onStage:i,onCancel:a})=>{let o=e=>t.nodes.find(t=>t.id===e)?.name??e;if(e.to===null)return(0,$.jsxs)(`section`,{className:`connection-panel`,"aria-label":`Connect subjects`,children:[(0,$.jsxs)(`p`,{className:`connection-prompt`,children:[`Connecting from `,(0,$.jsx)(`strong`,{children:o(e.from)}),`. Choose a target on the diagram, or search for one.`]}),(0,$.jsx)(oE,{graph:t,from:e.from,onTarget:r}),(0,$.jsx)(`button`,{type:`button`,onClick:a,children:`Cancel`})]});let s=e.to,c=e.direction===`incoming`,l=c?s:e.from,u=c?e.from:s,d=ew(t,l,u),f=new Set((e.kinds??[]).map(HC)),p=d.filter(e=>f.has(e)),m=d.filter(e=>!f.has(e)),h=p.length===0?d:p,g=e=>{let r=nw(t,l,e,u,n);r!==null&&i(r),a()};return(0,$.jsxs)(`section`,{className:`connection-panel`,"aria-label":`Connect subjects`,children:[(0,$.jsxs)(`p`,{className:`connection-prompt`,children:[(0,$.jsx)(`strong`,{children:o(l)}),` to`,` `,(0,$.jsx)(`strong`,{children:o(u)})]}),f.size>0&&p.length===0&&d.length>0?(0,$.jsxs)(`p`,{className:`connection-note`,children:[`The question asked for `,[...f].join(` or `),`, which the table does not permit between these two. What it does permit:`]}):null,h.length===0?(0,$.jsx)(`p`,{className:`connection-empty`,children:`No relationship is defined between these kinds. One of them is outside the ArchiMate vocabulary the table covers.`}):(0,$.jsx)(`ul`,{className:`connection-kinds`,children:h.map(e=>(0,$.jsx)(`li`,{children:(0,$.jsx)(`button`,{type:`button`,onClick:()=>g(e),children:e})},e))}),p.length>0&&m.length>0?(0,$.jsxs)(`details`,{className:`connection-others`,children:[(0,$.jsx)(`summary`,{children:`Other relationships the table permits`}),(0,$.jsx)(`ul`,{className:`connection-kinds`,children:m.map(e=>(0,$.jsx)(`li`,{children:(0,$.jsx)(`button`,{type:`button`,onClick:()=>g(e),children:e})},e))})]}):null,(0,$.jsx)(`button`,{type:`button`,onClick:a,children:`Cancel`})]})},cE=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,lE=(e,t,n=[])=>{let r=t.normalize(`NFKD`).replace(/[\u0300-\u036f]/g,``).replace(/[^a-zA-Z0-9]+/g,`-`).replace(/^-+|-+$/g,``).toLowerCase();if(r===``||!cE.test(r))return null;let i=new Set([...e.nodes.map(e=>e.id),...e.edges.map(e=>e.id),...n]);if(!i.has(r))return r;for(let e=2;;e+=1){let t=`${r}-${e}`;if(!i.has(t))return t}},uE=(e,t,n,r=[])=>{if(t.document===``||!n.includes(t.kind))return null;let i=t.name.trim();if(i===``)return null;let a=lE(e,i,r);return a===null?null:{op:`add-concept`,document:t.document,concept:{id:a,kind:t.kind,name:i}}},dE=(e,t,n,r=[])=>{if(t.document===``)return null;let i=t.name.trim();if(i===``)return null;let a=new Set(r),o=[],s={};for(let r of t.slots){let i=n.get(r.name)??null;if(i===null){if(r.required)return null;continue}if(i.mode===`existing`){if(i.subject===``)return null;s[r.name]=i.subject;continue}if(!r.admits.includes(i.kind))return null;let c=i.name.trim();if(c===``)return null;let l=lE(e,c,a);if(l===null)return null;a.add(l),o.push({op:`add-concept`,document:t.document,concept:{id:l,kind:i.kind,name:c}}),s[r.name]=l}let c=lE(e,i,a);return c===null?null:[...o,{op:`add-concept`,document:t.document,concept:{id:c,kind:t.kind,name:i,...Object.keys(s).length===0?{}:{parts:s}}}]},fE=(e,t,n,r=[])=>{if(n===null||t.document===``||t.slot===``)return null;if(n.mode===`existing`)return n.subject===``?null:[{op:`update-concept`,document:t.document,concept:{id:t.instance,parts:{[t.slot]:n.subject}}}];if(!t.admits.includes(n.kind))return null;let i=n.name.trim();if(i===``)return null;let a=lE(e,i,r);return a===null?null:[{op:`add-concept`,document:t.document,concept:{id:a,kind:n.kind,name:i}},{op:`update-concept`,document:t.document,concept:{id:t.instance,parts:{[t.slot]:a}}}]},pE=({graph:e,pattern:t,documents:n,defaultDocument:r,reservedIds:i,onStage:a,onCancel:o})=>{let[s,c]=(0,y.useState)(``),[l,u]=(0,y.useState)(r),[d,f]=(0,y.useState)(new Map),p=(e,t)=>f(n=>{let r=new Map(n);return t===null?r.delete(e):r.set(e,t),r}),m=t=>e.nodes.filter(e=>t.includes(e.kindLabel)),h=dE(e,{name:s,document:l,kind:t.label,slots:t.slots.map(e=>({name:e.name,required:e.required,admits:e.admits}))},d,i);return(0,$.jsxs)(`section`,{className:`subject-draft instance-draft`,"aria-label":`Add an instance`,children:[(0,$.jsx)(`h3`,{children:t.name??t.label}),(0,$.jsxs)(`label`,{className:`subject-draft-field`,htmlFor:`instance-draft-name`,children:[(0,$.jsx)(`span`,{children:`Name`}),(0,$.jsx)(`input`,{id:`instance-draft-name`,value:s,onChange:e=>c(e.target.value)})]}),(0,$.jsxs)(`label`,{className:`subject-draft-field`,htmlFor:`instance-draft-document`,children:[(0,$.jsx)(`span`,{children:`Document`}),(0,$.jsx)(`select`,{id:`instance-draft-document`,value:l,onChange:e=>u(e.target.value),children:n.map(e=>(0,$.jsx)(`option`,{value:e,children:e},e))})]}),(0,$.jsx)(`ul`,{className:`instance-draft-slots`,children:t.slots.map(e=>{let t=d.get(e.name)??null,n=m(e.admits),r=t===null?``:t.mode===`new`?`__new__`:t.subject;return(0,$.jsxs)(`li`,{className:`instance-draft-slot`,children:[(0,$.jsxs)(`label`,{htmlFor:`instance-slot-${e.name}`,children:[(0,$.jsx)(`span`,{className:`instance-draft-slot-name`,children:e.name}),e.required?(0,$.jsx)(`span`,{className:`instance-draft-required`,children:`required`}):null,e.wiring===`context`?(0,$.jsx)(`span`,{className:`instance-draft-context`,children:`context`}):null]}),(0,$.jsxs)(`select`,{id:`instance-slot-${e.name}`,value:r,onChange:t=>{let n=t.target.value;if(n===``)return p(e.name,null);if(n===`__new__`)return p(e.name,{mode:`new`,name:``,kind:e.admits[0]??``});p(e.name,{mode:`existing`,subject:n})},children:[(0,$.jsx)(`option`,{value:``,children:e.required?`Choose one`:`Leave for later`}),n.map(e=>(0,$.jsx)(`option`,{value:e.id,children:e.name},e.id)),(0,$.jsx)(`option`,{value:`__new__`,children:`New…`})]}),t?.mode===`new`?(0,$.jsxs)(`div`,{className:`instance-draft-new`,children:[(0,$.jsx)(`input`,{"aria-label":`New ${e.name} name`,value:t.name,onChange:n=>p(e.name,{...t,name:n.target.value})}),e.admits.length<2?null:(0,$.jsx)(`select`,{"aria-label":`New ${e.name} kind`,value:t.kind,onChange:n=>p(e.name,{...t,kind:n.target.value}),children:e.admits.map(e=>(0,$.jsx)(`option`,{value:e,children:e},e))})]}):null]},e.name)})}),t.wiring.length===0?null:(0,$.jsxs)(`div`,{className:`instance-draft-wiring`,children:[(0,$.jsx)(`h4`,{children:`The compiler will mint`}),(0,$.jsx)(`ul`,{children:t.wiring.map(e=>(0,$.jsx)(`li`,{children:(0,$.jsx)(`code`,{children:`${e.from} ${e.kind} ${e.to}`})},`${e.from}-${e.kind}-${e.to}`))})]}),(0,$.jsx)(`button`,{type:`button`,disabled:h===null,onClick:()=>{if(h!==null){for(let e of h)a(e);o()}},children:`Add instance`}),(0,$.jsx)(`button`,{type:`button`,onClick:o,children:`Cancel`})]})},mE=({graph:e,kinds:t,documents:n,defaultDocument:r,initialKind:i,reservedIds:a,onStage:o,onCancel:s})=>{let[c,l]=(0,y.useState)(``),[u,d]=(0,y.useState)(i??``),[f,p]=(0,y.useState)(r),m=c.trim()===``?null:lE(e,c,a),h=m===null?null:uE(e,{name:c,kind:u,document:f},t.map(e=>e.label),a);return(0,$.jsxs)(`section`,{className:`subject-draft-panel`,"aria-label":`Add a subject`,children:[(0,$.jsxs)(`label`,{className:`subject-draft-field`,htmlFor:`subject-draft-name`,children:[(0,$.jsx)(`span`,{children:`Name`}),(0,$.jsx)(`input`,{id:`subject-draft-name`,type:`text`,value:c,onChange:e=>l(e.target.value)})]}),(0,$.jsxs)(`label`,{className:`subject-draft-field`,htmlFor:`subject-draft-kind`,children:[(0,$.jsx)(`span`,{children:`Kind`}),(0,$.jsxs)(`select`,{id:`subject-draft-kind`,value:u,onChange:e=>d(e.target.value),children:[(0,$.jsx)(`option`,{value:``,children:`Choose a kind`}),t.map(e=>(0,$.jsx)(`option`,{value:e.label,children:UC(e)},e.id))]})]}),(0,$.jsxs)(`label`,{className:`subject-draft-field`,htmlFor:`subject-draft-document`,children:[(0,$.jsx)(`span`,{children:`Document`}),(0,$.jsx)(`select`,{id:`subject-draft-document`,value:f,onChange:e=>p(e.target.value),children:n.map(e=>(0,$.jsx)(`option`,{value:e,children:e},e))})]}),(0,$.jsx)(`p`,{className:`subject-draft-id`,children:u===``?`Choose a kind.`:c.trim()===``?`Give it a name.`:m===null?`That name makes no id. An id starts with a letter and is made of letters, digits and hyphens.`:(0,$.jsxs)($.Fragment,{children:[`Id: `,(0,$.jsx)(`code`,{children:m})]})}),(0,$.jsx)(`button`,{type:`button`,disabled:h===null,onClick:()=>{h!==null&&(o(h),s())},children:`Add`}),(0,$.jsx)(`button`,{type:`button`,onClick:s,children:`Cancel`})]})};function hE({title:e,message:t,confirmLabel:n,cancelLabel:r,onConfirm:i,onCancel:a}){return(0,$.jsx)(`div`,{className:`confirm-dialog-backdrop`,role:`presentation`,onClick:a,children:(0,$.jsxs)(`div`,{className:`confirm-dialog`,role:`alertdialog`,"aria-modal":`true`,"aria-labelledby":`confirm-dialog-title`,onClick:e=>e.stopPropagation(),children:[(0,$.jsx)(`h2`,{id:`confirm-dialog-title`,children:e}),(0,$.jsx)(`p`,{children:t}),(0,$.jsxs)(`div`,{className:`confirm-dialog-actions`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:a,children:r}),(0,$.jsx)(`button`,{type:`button`,onClick:i,children:n})]})]})})}function gE({title:e,label:t,initialValue:n,confirmLabel:r,cancelLabel:i,onConfirm:a,onCancel:o}){let[s,c]=(0,y.useState)(n),l=s.trim()===``;return(0,$.jsx)(`div`,{className:`confirm-dialog-backdrop`,role:`presentation`,onClick:o,children:(0,$.jsxs)(`div`,{className:`confirm-dialog`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`prompt-dialog-title`,onClick:e=>e.stopPropagation(),children:[(0,$.jsx)(`h2`,{id:`prompt-dialog-title`,children:e}),(0,$.jsxs)(`form`,{className:`prompt-dialog-form`,onSubmit:e=>{e.preventDefault(),!l&&a(s.trim())},children:[(0,$.jsx)(`label`,{htmlFor:`prompt-dialog-value`,children:t}),(0,$.jsx)(`input`,{id:`prompt-dialog-value`,type:`text`,value:s,autoFocus:!0,onChange:e=>c(e.currentTarget.value),onKeyDown:e=>{e.key===`Escape`&&o()}}),(0,$.jsxs)(`div`,{className:`confirm-dialog-actions`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:o,children:i}),(0,$.jsx)(`button`,{type:`submit`,disabled:l,children:r})]})]})]})})}var _E=new Set([`subject.inspect`,`relationship.inspect`,`view.open`,`view.clear`,`subject.focus`,`subject.focus-instance`,`relationship.focus`,`subject.fold`,`subject.unfold`,`subject.unfold-all`,`selection.fold`,`selection.unfold`,`canvas.fold-all`,`canvas.unfold-all`,`view.copy-path`,`canvas.export-png`]),vE=(e,t)=>t.membership===null?[]:[{key:`view`,scope:`view`,label:`View`,destructive:!1,items:[(t.membership.kind===`enumerated`?t.membership.subjects.includes(e):!t.membership.excluded.includes(e))?{key:`view.remove-subject`,label:`Remove from view`,intent:{type:`view.remove-subject`,id:e}}:{key:`view.add-subject`,label:`Add to this view`,intent:{type:`view.add-subject`,id:e}}]}],yE={key:`view.new`,label:`New view…`,intent:{type:`view.new`}},bE={key:`view.new-folder`,label:`New folder…`,intent:{type:`view.new-folder`}},xE={key:`view.clear`,label:`Show all subjects`,intent:{type:`view.clear`}},SE=e=>e.focusReturnLabel===void 0?xE:{key:`view.clear`,label:`Back to ${e.focusReturnLabel}`,intent:{type:`view.clear`}},CE=(e,t)=>({key:`delete`,scope:`model`,label:null,destructive:!0,items:[{key:`delete`,label:t,intent:e}]}),wE=(e,t)=>t.instanceIds?.has(e)===!0?[{key:`focus-instance`,label:`Focus on this instance`,intent:{type:`subject.focus-instance`,id:e}}]:[],TE=(e,t,n)=>[{key:`view`,scope:`view`,label:`View`,destructive:!1,items:[{key:`focus`,label:`Focus on this`,intent:e},...e.type===`subject.focus`?wE(e.id,n):[],...t.flatMap(e=>e.items),...n.filtered?[SE(n)]:[]]}],EE=(e,t)=>{if(t.containerIds?.has(e)!==!0)return[];let n=t.selectedIds??[],r=n.length>1&&n.includes(e),i=t.folded?.has(e)===!0;return[{key:`fold`,scope:`view`,label:`Fold`,destructive:!1,items:r?[{key:`selection-fold`,label:`Fold ${n.length} selected`,intent:{type:`selection.fold`,ids:n}},{key:`selection-unfold`,label:`Unfold ${n.length} selected`,intent:{type:`selection.unfold`,ids:n}}]:i?[{key:`unfold`,label:`Unfold`,intent:{type:`subject.unfold`,id:e}},{key:`unfold-all`,label:`Unfold everything inside`,intent:{type:`subject.unfold-all`,id:e}}]:[{key:`fold`,label:`Fold`,intent:{type:`subject.fold`,id:e}}]}]},DE=(e,t)=>{let n=e.split(/(?<=[.?!])\s/)[0]??e;return n.length<=t?n:`${n.slice(0,t-1).trimEnd()}…`},OE=(e,t,n)=>{if(e.length===0)return[];let r=e[0];return[{key:`questions`,scope:`model`,label:`Questions · ${e.length} open`,destructive:!1,items:[...e.map(e=>({key:`question:${e.questionId}`,label:DE(e.question,72),intent:{type:`question.answer`,questionId:e.questionId,subjectId:t,verb:Qw(e)}})),...n.delegateLabel===void 0?[]:[{key:`question-delegate`,label:`${n.delegateLabel}: ${DE(r.question,40)}`,intent:{type:`question.delegate`,questionId:r.questionId,subjectId:t,question:r.question}}]]}]},kE=(e,t)=>t.graph?.nodes.find(t=>t.id===e)===void 0?[]:[...TE({type:`subject.focus`,id:e},vE(e,t),t),...EE(e,t),...OE(t.questions?.subjects[e]??[],e,t),{key:`model`,scope:`model`,label:`Model`,destructive:!1,items:[{key:`inspect`,label:`Properties`,intent:{type:`subject.inspect`,id:e}},{key:`connect`,label:`Connect from here…`,intent:{type:`subject.connect`,from:e}}]},CE({type:`subject.delete`,id:e},`Delete from model…`)],AE=(e,t)=>{let n=t.graph,r=n?.edges.find(t=>t.id===e);if(n==null||r===void 0)return[];let i=iw(n,{from:r.from,to:r.to},t.relationshipKinds,r.kindLabel),a=[...TE({type:`relationship.focus`,id:e},[],t),{key:`model`,scope:`model`,label:`Model`,destructive:!1,items:[{key:`inspect`,label:`Properties`,intent:{type:`relationship.inspect`,id:e}}]}];return i.options.length>1&&a.push({key:`kind`,scope:`model`,label:`Change kind`,destructive:!1,items:i.options.map(t=>({key:`kind:${t.label}`,label:t.label,intent:{type:`relationship.retype`,id:e,kind:t.label},...t.label===r.kindLabel?{current:!0}:{}}))}),a.push(CE({type:`relationship.delete`,id:e},`Delete from model…`)),a},jE=e=>e.graph===null?[]:[{key:`view`,scope:`view`,label:`View`,destructive:!1,items:[yE,bE,...e.filtered?[xE]:[],{key:`canvas.export-png`,label:`Export PNG`,intent:{type:`canvas.export-png`}},...e.containerIds!==void 0&&e.containerIds.size>0?[{key:`canvas.fold-all`,label:`Fold every instance`,intent:{type:`canvas.fold-all`}},{key:`canvas.unfold-all`,label:`Unfold everything`,intent:{type:`canvas.unfold-all`}}]:[]]},...OE(e.questions?.workspace??[],null,e),{key:`model`,scope:`model`,label:`Model`,destructive:!1,items:[{key:`add`,label:`Add subject…`,intent:{type:`canvas.draft-subject`}}]}],ME=(e,t)=>{let n=[{key:`view`,scope:`view`,label:`View`,destructive:!1,items:e===``?[xE,yE,bE]:[{key:`view.open`,label:`Open view`,intent:{type:`view.open`,id:e},...e===t.activeViewId?{current:!0}:{}},{key:`view.rename`,label:`Rename…`,intent:{type:`view.rename`,id:e}},{key:`view.duplicate`,label:`Duplicate`,intent:{type:`view.duplicate`,id:e}},{key:`view.new-in-folder`,label:`New view in this folder…`,intent:{type:`view.new-in-folder`,id:e}},yE,bE,{key:`view.copy-path`,label:`Copy projection path`,intent:{type:`view.copy-path`,id:e}}]}];return e!==``&&n.push({key:`delete`,scope:`view`,label:null,destructive:!0,items:[{key:`delete`,label:`Delete view…`,intent:{type:`view.delete`,id:e}}]}),n},NE=(e,t)=>t.graph?.nodes.find(t=>t.id===e)===void 0?[]:[...vE(e,t),...wE(e,t).length===0?[]:[{key:`view`,scope:`view`,label:`View`,destructive:!1,items:wE(e,t)}],...EE(e,t),...OE(t.questions?.subjects[e]??[],e,t),{key:`model`,scope:`model`,label:`Model`,destructive:!1,items:[{key:`inspect`,label:`Properties`,intent:{type:`subject.inspect`,id:e}}]},CE({type:`subject.delete`,id:e},`Delete from model…`)],PE=(e,t)=>{let n=(()=>{switch(e.kind){case`subject`:return kE(e.id,t);case`relationship`:return AE(e.id,t);case`canvas`:return jE(t);case`view-row`:return ME(e.id,t);case`model-row`:return NE(e.id,t)}})();return t.readOnly===!0?n.flatMap(e=>{let t=e.items.filter(e=>_E.has(e.intent.type));return t.length===0?[]:[{...e,items:t}]}):n},FE=(e,t,n)=>({left:Math.max(0,e.x+t.width<=n.width?e.x:Math.min(e.x-t.width,n.width-t.width)),top:Math.max(0,e.y+t.height<=n.height?e.y:Math.min(e.y-t.height,n.height-t.height))});function IE({groups:e,x:t,y:n,onChoose:r,onDismiss:i}){let a=(0,y.useRef)(null),[o,s]=(0,y.useState)(null);return(0,y.useLayoutEffect)(()=>{let e=a.current;if(e===null)return;let r=e.getBoundingClientRect();s(FE({x:t,y:n},{width:r.width,height:r.height},{width:window.innerWidth,height:window.innerHeight})),e.focus()},[t,n,e]),(0,y.useEffect)(()=>{let e=e=>{e.key===`Escape`&&i()},t=e=>{let t=e.target;a.current!==null&&t instanceof Node&&a.current.contains(t)||i()};return window.addEventListener(`keydown`,e),window.addEventListener(`pointerdown`,t,!0),window.addEventListener(`contextmenu`,t,!0),window.addEventListener(`resize`,i),()=>{window.removeEventListener(`keydown`,e),window.removeEventListener(`pointerdown`,t,!0),window.removeEventListener(`contextmenu`,t,!0),window.removeEventListener(`resize`,i)}},[i]),e.length===0?null:(0,$.jsx)(`div`,{ref:a,className:`context-menu`,role:`dialog`,"aria-label":`Actions`,tabIndex:-1,style:o===null?{left:0,top:0,visibility:`hidden`}:{left:`${o.left}px`,top:`${o.top}px`},children:e.map(e=>(0,$.jsxs)(`div`,{className:`context-menu-group context-menu-${e.scope}${e.destructive?` context-menu-destructive`:``}`,role:e.label===null?void 0:`group`,"aria-label":e.label??void 0,children:[e.label===null?null:(0,$.jsx)(`p`,{className:`context-menu-heading`,children:e.label}),(0,$.jsx)(`ul`,{children:e.items.map(e=>(0,$.jsx)(`li`,{children:(0,$.jsxs)(`button`,{type:`button`,className:`context-menu-item`,"aria-current":e.current===!0?`true`:void 0,onClick:()=>r(e.intent),children:[(0,$.jsx)(`span`,{className:`context-menu-tick`,"aria-hidden":!0,children:e.current===!0?`•`:``}),(0,$.jsx)(`span`,{className:`context-menu-label`,children:e.label})]})},e.key))})]},e.key))})}function LE(e,t=[],n=[],r=[]){let i=t.filter(({instance:t})=>t===e),a=n.filter(({instance:t})=>t===e);if(i.length===0&&a.length===0)return null;let o=new Map;for(let t of r){let n=t.op===`update-concept`||t.op===`add-concept`?t.concept:void 0;if(n===void 0)continue;let r=e.slice(e.lastIndexOf(`#`)+1);if(n.id===r||n.id===e)for(let[e,t]of Object.entries(n.parts??{}))typeof t==`string`&&o.set(e,t)}let s=new Map;for(let e of t){let t=s.get(e.member);t===void 0?s.set(e.member,new Set([e.instance])):t.add(e.instance)}let c=(e,t)=>e.slot.localeCompare(t.slot),l=[...[...i].sort(c).map(e=>({slot:e.slot,member:e.member,wiring:e.wiring,required:!1,sharedWith:(s.get(e.member)?.size??1)-1})),...[...a].sort(c).map(e=>{let t=o.get(e.slot);return t===void 0?{slot:e.slot,member:null,wiring:void 0,required:e.required,sharedWith:0}:{slot:e.slot,member:t,wiring:void 0,required:e.required,sharedWith:0,staged:!0}})],u=l.filter(e=>e.staged===!0).length;return{pattern:i[0]?.pattern??a[0]?.pattern??``,rows:l,boundCount:i.length+u,vacantCount:a.length-u}}function RE(e){if(e.member===null)return e.required?`to decide — required`:`to decide`;let t=[];return e.staged===!0&&t.push(`staged`),e.wiring===`context`&&t.push(`context`),e.sharedWith>0&&t.push(e.sharedWith===1?`shared with 1 other`:`shared with ${e.sharedWith} others`),t.length===0?e.member:`${e.member} (${t.join(`, `)})`}var zE=(e,t)=>{let n=[];for(let r of e.nodes)r.id!==t&&(r.owner===t&&n.push({by:r.id,field:`owner`}),r.distinctFrom.includes(t)&&n.push({by:r.id,field:`distinctFrom`}),r.supersedes.includes(t)&&n.push({by:r.id,field:`supersedes`}),r.constraints.some(e=>e.ref===t)&&n.push({by:r.id,field:`constraint`}),r.references.some(e=>e.ref===t)&&n.push({by:r.id,field:`reference`}));return n},BE=(e,t)=>{let n=e.edges.find(e=>e.id===t);if(n!==void 0)return[{op:`delete-relationship`,document:n.document,relationship:{id:n.id}}];let r=e.nodes.find(e=>e.id===t);return r===void 0?[]:[...e.edges.filter(e=>e.from===t||e.to===t).map(e=>({op:`delete-relationship`,document:e.document,relationship:{id:e.id}})),{op:`delete-concept`,document:r.document,concept:{id:r.id}}]},VE=(e,t)=>{let n=e.edges.find(e=>e.id===t);if(n!==void 0)return`Delete the ${n.kindLabel} relationship from "${e.nodes.find(e=>e.id===n.from)?.name??n.from}" to "${e.nodes.find(e=>e.id===n.to)?.name??n.to}"?`;let r=e.nodes.find(e=>e.id===t);if(r===void 0)return null;let i=e.edges.filter(e=>e.from===t||e.to===t).length,a=zE(e,t),o=i===0?`Delete "${r.name}"?`:`Delete "${r.name}" and the ${i} ${i===1?`relationship that names`:`relationships that name`} it?`;if(a.length===0)return o;let s=[...new Set(a.map(t=>e.nodes.find(e=>e.id===t.by)?.name??t.by))],c=s.slice(0,3),l=s.length>c.length?` and others`:``;return`${o} It is still named by ${c.join(`, `)}${l}, so this may be refused.`},HE={reviewer:`You`,agent:`Agent`,session:`Session`},UE={thinking:`Agent is thinking`,compiling:`Agent is compiling the model`,waiting:`Agent is waiting`,idle:`Agent is idle`},WE=(e,t)=>{switch(e.lifecycle){case`connecting`:return`Opening`;case`active`:return t?`Live`:`Reconnecting`;case`ending`:return`Ending`;case`disconnected`:return`Reconnecting`;case`closed`:return`Closed`}},GE=e=>e.lifecycle===`closed`?`Visual conversation ended. Continue in the main agent.`:e.lifecycle===`ending`?e.handoff===null?`Ending conversation — preparing a handoff for the main agent.`:`Handoff ready — returning control to the main agent.`:``,KE=({state:e,connection:t})=>(0,$.jsxs)(`header`,{className:`command-strip`,children:[(0,$.jsxs)(`div`,{className:`command-identity`,children:[(0,$.jsx)(`h1`,{children:e.title===``?`Opening the session`:e.title}),(0,$.jsx)(`span`,{className:`beta-badge`,children:`Beta`}),(0,$.jsx)(`span`,{className:`authority`,children:`Checked YarraMate model`}),(0,$.jsx)(`span`,{className:`connection-state`,role:`status`,children:t})]}),e.description===``?null:(0,$.jsx)(`p`,{className:`session-description`,title:e.description,children:e.description})]}),qE=({choices:e,disabled:t,onChoice:n})=>(0,$.jsxs)(`div`,{className:`choices`,children:[(0,$.jsx)(`p`,{className:`question`,children:e.question}),(0,$.jsx)(`ul`,{children:e.options.map(e=>(0,$.jsx)(`li`,{children:(0,$.jsxs)(`button`,{type:`button`,onClick:()=>n(e.id),disabled:t,children:[(0,$.jsx)(`span`,{className:`label`,children:e.label}),e.description===void 0?null:(0,$.jsx)(`span`,{className:`detail`,children:e.description})]})},e.id))})]}),JE=({diagnostics:e})=>e.length===0?null:(0,$.jsxs)(`div`,{className:`faults`,role:`alert`,children:[(0,$.jsx)(`p`,{className:`faults-title`,children:`The workspace did not compile. The diagram still shows the model that did.`}),(0,$.jsx)(`ul`,{children:e.map(e=>(0,$.jsxs)(`li`,{children:[(0,$.jsx)(`span`,{className:`code`,children:e.code}),` `,e.message,(0,$.jsxs)(`span`,{className:`where`,children:[e.path,`:`,e.line]})]},`${e.code}-${e.pointer}`))})]}),YE=({state:e,selectedId:t,waiting:n,layout:r,nesting:i,folded:a,memberships:o,direction:s,onLayoutChange:c,onDirectionChange:l,stylePreset:u,onStyleChange:d,showLifecycle:f,showEvidence:p,showOwnership:m,showKindLabels:h,showNudges:g,openQuestionCounts:_,decorations:v,connection:b,onConnectTarget:x,onConnectCancel:S,onConnectStage:C,onDraftStage:w,draftingSubject:T,draftInitialKind:E,draftPattern:D,onKindDrop:O,onDraftSubject:k,onDraftSubjectClose:A,pendingDeletion:j,onDeletionDismiss:M,onSelect:N,onCanvasMenu:P,onClearFilter:F,onSaveLayout:I,onCanvasReady:L,onQuickFilterChange:R,view:ee,bottomPanel:z,onTogglePresentation:B,onToggleBottomPanel:V,onSelectBottomTab:H,onApplyFilter:U,onStageView:W,readOnly:G,paletteReachable:K})=>{let q=(0,y.useMemo)(()=>new Map((e.model?.graph.nodes??[]).map(e=>[e.id,e.name])),[e.model]),J=e.model?.graph.nodes??[],Y=eE(e),te=e.activeFilter?.matchedIds??null,ne=J.length>0&&(e.activeFilter!==null||e.quickFilterText.trim()!==``)&&py(J,te,e.quickFilterText)===0,re=e.activeFilter!==null&&py(J,te,``)===0;return(0,$.jsxs)(`section`,{className:`diagram-workspace`,"aria-label":`Architecture diagram`,children:[e.activeFilter!==null&&e.activeFilter.source!==`view`&&e.activeFilter.source!==`editor`?(0,$.jsxs)(`div`,{className:`filter-pill`,role:`status`,children:[(0,$.jsxs)(`span`,{children:[`Filtered by `,e.activeFilter.source,`:`,` `,(0,$.jsx)(`code`,{children:EC(e.activeFilter.query)})]}),(0,$.jsx)(`button`,{type:`button`,onClick:F,children:Y===void 0?`Show all`:`Back to ${Y}`})]}):null,(0,$.jsxs)(`div`,{className:`canvas`,children:[e.model===null?null:(0,$.jsxs)(`div`,{className:`canvas-controls`,children:[(0,$.jsx)(tC,{value:e.quickFilterText,onChange:R}),(0,$.jsx)(cT,{layout:r,direction:s,onLayoutChange:c,onDirectionChange:l,stylePreset:u,onStyleChange:d}),G||K?null:(0,$.jsx)(`button`,{type:`button`,className:`subject-draft-open`,onClick:k,children:`Add subject`})]}),!T||e.model===null||D===void 0?null:(0,$.jsx)(pE,{graph:e.model.graph,pattern:D,documents:e.model.documents,reservedIds:rw(e.pendingChangeset.operations),defaultDocument:(t===null?void 0:e.model.graph.nodes.find(e=>e.id===t)?.document)??e.model.documents[0]??``,onStage:w,onCancel:A},`pattern:${D.kind}`),!T||e.model===null||D!==void 0?null:(0,$.jsx)(mE,{initialKind:E,graph:e.model.graph,kinds:e.model.vocabulary.conceptKinds,documents:e.model.documents,reservedIds:rw(e.pendingChangeset.operations),defaultDocument:(t===null?void 0:e.model.graph.nodes.find(e=>e.id===t)?.document)??e.model.documents[0]??``,onStage:w,onCancel:A},E??``),j===null||e.model===null?null:(0,$.jsx)(hE,{title:`Delete`,message:VE(e.model.graph,j)??`That subject is no longer on the diagram.`,confirmLabel:`Delete`,cancelLabel:`Keep`,onConfirm:()=>{for(let t of BE(e.model.graph,j))C(t);M()},onCancel:M}),b===null||e.model===null?null:(0,$.jsx)(sE,{draft:b,graph:e.model.graph,reservedIds:rw(e.pendingChangeset.operations),onTarget:x,onStage:C,onCancel:S}),e.model===null?null:(0,$.jsx)(Oy,{graph:e.model.graph,selectedId:t,onSelect:(t,n)=>{let r=e.model.graph;if(n===`node`){if(b!==null){x(t);return}let e=r.nodes.find(e=>e.id===t);e!==void 0&&N(fT(e))}else{let e=r.edges.find(e=>e.id===t);e!==void 0&&N(pT(e,q))}},onContextMenu:P,matchedIds:e.activeFilter?.matchedIds??null,quickFilterText:e.quickFilterText,nesting:i,folded:a,memberships:o,faultedIds:AC(e.commitDiagnostics??[]),decorations:v,showLifecycle:f,showEvidence:p,showOwnership:m,showNudges:g,openQuestionCounts:_,activeViewId:e.activeView,direction:s,layout:r,showKindLabels:h,stylePreset:u,savedPositions:e.model.layouts[e.activeView],savedRoutes:e.model.routes?.[e.activeView],onSaveLayout:G?()=>void 0:I,onKindDrop:G?void 0:O,onCanvasReady:L}),ne?(0,$.jsx)(`div`,{className:`filter-empty-pill`,role:`status`,children:re&&e.activeFilter!==null?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`span`,{children:[`Nothing matches this filter:`,` `,(0,$.jsx)(`code`,{children:EC(e.activeFilter.query)})]}),(0,$.jsx)(`button`,{type:`button`,onClick:F,children:`Show all`})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`span`,{children:[`Nothing matches “`,e.quickFilterText.trim(),`”`]}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>R(``),children:`Clear filter`})]})}):null,e.layoutNotice===null?null:(0,$.jsx)(`div`,{className:`layout-notice-pill`,role:`status`,children:(0,$.jsx)(`span`,{children:e.layoutNotice})}),n===null?null:(0,$.jsx)(`p`,{className:`waiting`,children:n})]}),(0,$.jsx)(eC,{nodes:e.model?.graph.nodes??[],activeFilter:e.activeFilter,view:ee,open:z.open,tab:z.tab,showLifecycle:f,showEvidence:p,showOwnership:m,showKindLabels:h,showNudges:g,onTogglePresentation:B,onToggleOpen:V,onSelectTab:H,onApply:U,onStage:W,readOnly:G},e.activeView),(0,$.jsx)(JE,{diagnostics:e.diagnostics})]})},XE=({text:e,expanded:t,onToggle:n})=>{let r=e??`No description declared in this model`,i=(0,y.useRef)(null),[a,o]=(0,y.useState)(!1);return(0,y.useLayoutEffect)(()=>{let e=i.current;if(e===null||t)return;let n=()=>o(e.scrollHeight>e.clientHeight+1);n();let r=new ResizeObserver(n);return r.observe(e),()=>r.disconnect()},[r,t]),(0,$.jsxs)(`div`,{className:`subject-description`,children:[(0,$.jsx)(`p`,{ref:i,className:t?`description-expanded`:`description-clamped`,children:r}),a||t?(0,$.jsx)(`button`,{type:`button`,"aria-expanded":t,onClick:n,children:t?`Show less`:`Show more`}):null]})},ZE=({subject:e,model:t,operations:n,expanded:r,onToggleDescription:i,onClear:a,onConnect:o,onDelete:s,onStageChange:c,readOnly:l})=>{let u=e.type===`element`?t.graph.nodes.find(t=>t.id===e.id):void 0,d=e.type===`relationship`?t.graph.edges.find(t=>t.id===e.id):void 0;return(0,$.jsxs)(`section`,{className:`subject-inspector`,"aria-labelledby":`subject-heading`,children:[(0,$.jsxs)(`div`,{className:`subject-heading-row`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{className:`subject-type`,children:e.type===`element`?`Selected element`:`Selected relationship`}),(0,$.jsx)(`h2`,{id:`subject-heading`,children:e.type===`element`?e.title:`${e.sourceTitle} → ${e.targetTitle}`})]}),e.type===`element`&&!l?(0,$.jsx)(`button`,{type:`button`,className:`subject-connect`,onClick:()=>o(e.id),children:`Connect`}):null,l?null:(0,$.jsx)(`button`,{type:`button`,className:`subject-delete`,onClick:()=>s(e.id),children:`Delete`}),(0,$.jsx)(`button`,{type:`button`,className:`subject-clear`,onClick:a,children:`Clear`})]}),u===void 0?null:l?(0,$.jsx)(Kw,{node:u,model:t}):(0,$.jsx)(Ww,{node:u,model:t,operations:n,onStageChange:c}),d===void 0?null:l?(0,$.jsx)(qw,{edge:d,model:t}):(0,$.jsx)(Jw,{edge:d,model:t,operations:n,onStageChange:c}),u===void 0?null:(0,$.jsx)($E,{id:u.id,model:t,operations:n,reservedIds:rw(n),onStage:c,readOnly:l}),(0,$.jsx)(XE,{text:e.description,expanded:r,onToggle:i})]})},QE=({graph:e,instance:t,slot:n,document:r,admits:i,reservedIds:a,onStage:o,fallback:s})=>{let[c,l]=(0,y.useState)(!1),[u,d]=(0,y.useState)(``),f=e.nodes.filter(e=>i.includes(e.kindLabel));if(i.length===0)return(0,$.jsx)($.Fragment,{children:s});let p=s=>{let c=fE(e,{instance:t,slot:n,document:r,admits:i},s,a);if(c!==null){for(let e of c)o(e);l(!1),d(``)}};return(0,$.jsxs)(`span`,{className:`subject-slot-filler`,children:[(0,$.jsxs)(`select`,{"aria-label":`Fill ${n}`,value:``,onChange:e=>{let t=e.target.value;if(t!==``){if(t===`__new__`)return l(!0);p({mode:`existing`,subject:t})}},children:[(0,$.jsx)(`option`,{value:``,children:`to decide`}),f.map(e=>(0,$.jsx)(`option`,{value:e.id,children:e.name},e.id)),(0,$.jsx)(`option`,{value:`__new__`,children:`New…`})]}),c?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`input`,{"aria-label":`New ${n} name`,value:u,onChange:e=>d(e.target.value)}),(0,$.jsx)(`button`,{type:`button`,disabled:u.trim()===``,onClick:()=>p({mode:`new`,name:u,kind:i[0]??``}),children:`Add`})]}):null]})},$E=({id:e,model:t,operations:n,reservedIds:r,onStage:i,readOnly:a})=>{let o=LE(e,t.memberships,t.vacancies,n);if(o===null)return null;let s=t.graph.nodes.find(t=>t.id===e),c=(t.vocabulary.patterns??[]).find(e=>e.kind===s?.kind);return(0,$.jsxs)(`section`,{className:`subject-slots`,"aria-labelledby":`slots-heading`,children:[(0,$.jsxs)(`h3`,{id:`slots-heading`,className:`subject-slots-heading`,children:[`Slots`,(0,$.jsx)(`span`,{className:`tree-count`,children:o.vacantCount===0?`${o.boundCount}`:`${o.boundCount} of ${o.boundCount+o.vacantCount}`})]}),(0,$.jsx)(`dl`,{className:`subject-slots-list`,children:o.rows.map(n=>(0,$.jsxs)(`div`,{className:`subject-slot-row`,children:[(0,$.jsx)(`dt`,{className:`subject-slot-name`,children:n.slot}),(0,$.jsx)(`dd`,{className:n.member===null?`subject-slot-value subject-slot-vacant`:`subject-slot-value`,children:n.member!==null||a||c===void 0||s===void 0?RE(n):(0,$.jsx)(QE,{graph:t.graph,instance:e,slot:n.slot,document:s.document,admits:c.slots.find(e=>e.name===n.slot)?.admits??[],reservedIds:r,onStage:i,fallback:RE(n)})})]},n.slot))})]})},eD=e=>e.lifecycle===`active`?e.awaitingAgent?UE[e.agentStatus?.state??`thinking`]??`working`:`agent idle`:`closed`,tD=({state:e,disabled:t,selectedSubject:n,onSend:r,onChoice:i,onClearSubject:a,onEnd:o})=>{let[s,c]=(0,y.useState)(``),l=e.lifecycle===`active`&&e.awaitingAgent,u=e.lifecycle===`active`?e.agentStatus:null;return(0,$.jsxs)(`div`,{className:`talk`,children:[(0,$.jsxs)(`div`,{className:`conversation-scroll`,children:[(0,$.jsx)(`ol`,{className:`ledger`,role:`log`,"aria-live":`polite`,children:e.transcript.length===0?(0,$.jsx)(`li`,{className:`empty`,children:(0,$.jsx)(`p`,{children:`Nothing asked yet. Question anything on the diagram.`})}):e.transcript.map(e=>(0,$.jsxs)(`li`,{className:`said said-${e.speaker}`,children:[(0,$.jsx)(`p`,{className:`who`,children:HE[e.speaker]}),(0,$.jsx)(`p`,{className:`words`,children:e.text})]},e.id))}),e.choices===null?null:(0,$.jsx)(qE,{choices:e.choices,disabled:t,onChoice:i})]}),(0,$.jsxs)(`form`,{className:`composer`,onSubmit:e=>{e.preventDefault();let n=s.trim();n===``||t||(r(n),c(``))},children:[n===null?null:(0,$.jsxs)(`div`,{className:`subject-chip`,children:[(0,$.jsx)(`span`,{children:n.type===`element`?n.title:`${n.sourceTitle} → ${n.targetTitle}`}),(0,$.jsx)(`button`,{type:`button`,"aria-label":`Remove selected diagram context`,onClick:a,children:`Remove`})]}),(0,$.jsx)(`label`,{className:`offscreen`,htmlFor:`composer-text`,children:`Ask about this design`}),(0,$.jsx)(`textarea`,{id:`composer-text`,name:`question`,rows:3,value:s,disabled:t,placeholder:e.chatEnabled?n?.type===`element`?`Ask about this element`:n?.type===`relationship`?`Ask about this relationship`:`Ask about this design`:`This session is read-only`,onChange:e=>c(e.target.value),onKeyDown:e=>{e.key!==`Enter`||e.shiftKey||(e.preventDefault(),e.currentTarget.form?.requestSubmit())}}),(0,$.jsxs)(`div`,{className:`composer-foot`,children:[(0,$.jsxs)(`p`,{className:`agent-status`,role:`status`,"aria-live":`polite`,"aria-busy":l,children:[l?(0,$.jsx)(`span`,{className:`agent-spinner`,"aria-hidden":`true`}):null,(0,$.jsx)(`span`,{children:u===null?l?`Awaiting agent response`:`\xA0`:UE[u.state]??`\xA0`})]}),(0,$.jsx)(`button`,{type:`submit`,disabled:t||s.trim()===``,children:`Send`})]}),(0,$.jsxs)(`div`,{className:`session-foot`,children:[(0,$.jsx)(`span`,{className:`end-transition-status`,role:`status`,"aria-live":`polite`,"aria-atomic":`true`,children:GE(e)}),(0,$.jsx)(`button`,{type:`button`,className:`end-session`,onClick:o,disabled:e.lifecycle!==`active`,children:e.lifecycle===`ending`||e.lifecycle===`closed`?`Returning…`:`Return to agent`})]})]})]})},nD=({width:e,viewportWidth:t,onResize:n})=>{let r=ET(t),i=(0,y.useRef)(null),a=e=>{let t=i.current;t?.pointerId===e.pointerId&&n(t.startWidth+t.startX-e.clientX)},o=t=>{i.current={pointerId:t.pointerId,startX:t.clientX,startWidth:e},t.currentTarget.setPointerCapture(t.pointerId)},s=e=>{i.current?.pointerId===e.pointerId&&(i.current=null,e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId))};return(0,$.jsx)(`div`,{className:`conversation-separator`,role:`separator`,"aria-label":`Resize conversation`,"aria-orientation":`vertical`,"aria-valuemin":r.min,"aria-valuemax":r.max,"aria-valuenow":Math.round(e),tabIndex:0,onPointerDown:o,onPointerMove:a,onPointerUp:s,onPointerCancel:s,onKeyDown:t=>{if(t.key!==`ArrowLeft`&&t.key!==`ArrowRight`)return;t.preventDefault();let r=t.shiftKey?32:8;n(e+(t.key===`ArrowLeft`?r:-r))}})},rD=({host:e,sections:t=vT,readOnly:n=!1,decorations:r,onDelegateQuestion:i,onReady:a,initialView:o})=>{let{state:s,connected:c,ask:l,choose:u,delegate:d,navigate:f,filter:p,clearFilter:m,setQuickFilterText:h,stageViewChange:g,stageViewMembership:_,saveLayout:v,discardChange:b,stageChange:x,clearChangeset:S,undoChangeset:C,redoChangeset:w,commitChangeset:T,end:E}=iE(e),[D,O]=(0,y.useReducer)(jT,{width:window.innerWidth,height:window.innerHeight},({width:e,height:t})=>AT(e,t)),[k,A]=(0,y.useState)(null),[j,M]=(0,y.useState)(!1),[N,P]=(0,y.useState)(!1),[F,I]=(0,y.useState)(void 0),[L,R]=(0,y.useState)(void 0),[ee,z]=(0,y.useState)(r??{}),B=(0,y.useRef)(null),V=(0,y.useRef)({graph:null,readOnly:n,stagedPins:{},views:[]});V.current={graph:s.model?.graph??null,readOnly:n,stagedPins:s.pendingChangeset.sourceDigests,views:s.views},(0,y.useEffect)(()=>{a?.(_T(()=>V.current,O,R,z,f))},[a,f]);let H=(0,y.useRef)(!1);(0,y.useEffect)(()=>{H.current||o===void 0||s.model!==null&&(H.current=!0,s.views.some(e=>e.id===o)&&f(o))},[o,s.model,s.views,f]),(0,y.useEffect)(()=>{let e=()=>O({type:`viewport.resized`,viewportWidth:window.innerWidth,viewportHeight:window.innerHeight});return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]);let U=(0,y.useRef)(null);(0,y.useEffect)(()=>{if(s.activeView===``){U.current=null;return}let e=TT(s.activeView,s.views,U.current,c);if(e!==null){U.current=e.id,p(e.query,`view`,e.presentation?.nesting);for(let t of wT(e.presentation))O(t)}},[s.activeView,s.views,c,p]);let W=(0,y.useRef)({transcriptLength:s.transcript.length,choices:s.choices,diagnostics:s.diagnostics});(0,y.useEffect)(()=>{let e=W.current,t=!1;for(let n=e.transcriptLength;n<s.transcript.length;n+=1)if(s.transcript[n]?.speaker===`agent`){t=!0;break}let n=t||s.choices!==null&&s.choices!==e.choices||s.diagnostics.length>0&&s.diagnostics!==e.diagnostics;W.current={transcriptLength:s.transcript.length,choices:s.choices,diagnostics:s.diagnostics},n&&O({type:`attention.received`})},[s.transcript.length,s.choices,s.diagnostics]);let G=(0,y.useRef)(s.model);(0,y.useEffect)(()=>{s.model!==G.current&&(G.current=s.model,O({type:`model.replaced`,graph:s.model?.graph??null}))},[s.model]);let K=s.model===null?s.lifecycle===`connecting`?`Reading the session`:`No model to draw`:k,q=s.pendingChangeset.operations.length+s.pendingChangeset.viewOperations.length,J=e=>!D.conversation.collapsed.includes(e),Y=s.model?.interrogation,te=(0,y.useMemo)(()=>new Map(Object.entries(Y?.subjects??{}).map(([e,t])=>[e,t.length])),[Y]),ne=(0,y.useMemo)(()=>{let e=s.model?.graph;if(e===void 0)return{folded:new Set,insideCounts:new Map,insideIds:new Map};let t=Ag({nodes:e.nodes.map(e=>({id:e.id,kind:e.kind,coreKind:e.coreKindLabel})),edges:e.edges,memberships:s.model?.memberships??[],nesting:D.nesting}),n=new Map,r=new Map;for(let e of t.parentOf.keys()){let i=t.parentOf.get(e),a=new Set([e]);for(;i!==void 0&&!a.has(i);){a.add(i),n.set(i,(n.get(i)??0)+1);let o=r.get(i);o===void 0?r.set(i,[e]):o.push(e),i=t.parentOf.get(i)}}let i=new Set;for(let e of n.keys()){let t=D.folded.includes(e),n=D.unfolded.includes(e);(t||D.foldMode===`instances`&&!n)&&i.add(e)}return{folded:i,insideCounts:n,insideIds:r}},[s.model,D.nesting,D.foldMode,D.folded,D.unfolded]),re=ne.folded,ie=n?t.filter(e=>e!==`palette`&&e!==`changes`):t,ae=Y===void 0?ie.filter(e=>e!==`questions`):ie,oe=D.selectedSubject?.type===`element`?D.selectedSubject.id:null,se=Y===void 0?void 0:oe===null?Y.workspace.length:te.get(oe)??0,ce=s.model?.vocabulary.conceptKinds??[],le=s.model?.vocabulary.patterns,ue=(0,y.useMemo)(()=>new Set(D.tree.collapsed),[D.tree.collapsed]),de=D.conversation.hidden,fe={"--conversation-width":de?`0px`:`${D.conversation.width}px`,"--changes-height":J(`changes`)?`${D.conversation.changesHeight}px`:`auto`,"--chat-height":J(`chat`)?`${D.conversation.chatHeight}px`:`auto`},pe=e=>{R(e),O({type:`subject.draft.opened`})},me=(e,t)=>O({type:`menu.opened`,target:e,x:t.x,y:t.y}),he=s.views.find(({id:e})=>e===s.activeView)?.title,ge=s.chatEnabled?`Answer via agent`:i===void 0?`Copy for my assistant`:`Answer via assistant`,_e=D.contextMenu===null?[]:PE(D.contextMenu.target,{graph:s.model?.graph??null,relationshipKinds:s.model?.vocabulary.relationshipKinds??[],activeViewId:s.activeView,filtered:s.activeFilter!==null,membership:tE(s),folded:re,containerIds:new Set(ne.insideCounts.keys()),instanceIds:new Set((s.model?.memberships??[]).map(({instance:e})=>e)),selectedIds:D.selectedSubject===null?[]:[D.selectedSubject.id],...eE(s)===void 0?{}:{focusReturnLabel:eE(s)},readOnly:n,...Y===void 0?{}:{questions:Y},delegateLabel:ge}),ve=(e,t)=>{if(e?.kind===`connect`&&t!==null){O({type:`connection.started`,from:t,kinds:e.kinds,direction:e.direction});return}if(e?.kind===`add`){R(e.subjectKind),O({type:`subject.draft.opened`});return}if(t!==null){let e=s.model?.graph.nodes.find(e=>e.id===t);e!==void 0&&O({type:`subject.selected`,subject:fT(e)})}J(`properties`)||O({type:`section.toggled`,section:`properties`})},ye=(e,t)=>{if(s.chatEnabled){d(e);return}if(i!==void 0){i(e);return}let n=(e.subjectId===null?Y?.workspace:Y?.subjects[e.subjectId])?.find(t=>t.questionId===e.questionId),r=e.subjectId===null?null:{id:e.subjectId,name:t??e.subjectId};navigator.clipboard?.writeText(tT(n??{questionId:e.questionId,question:e.question,authority:`human`},r))},be=e=>{let t=s.model?.graph??null;switch(e.type){case`question.answer`:ve(e.verb,e.subjectId);return;case`question.delegate`:{let n=t?.nodes.find(t=>t.id===e.subjectId);ye({questionId:e.questionId,subjectId:e.subjectId,question:e.question},n?.name??null);return}case`subject.inspect`:{let n=t?.nodes.find(t=>t.id===e.id);if(n===void 0)return;O({type:`subject.selected`,subject:fT(n)});return}case`relationship.inspect`:{let n=t?.edges.find(t=>t.id===e.id);if(n===void 0||t===null)return;O({type:`subject.selected`,subject:pT(n,new Map(t.nodes.map(e=>[e.id,e.name])))});return}case`subject.connect`:O({type:`connection.started`,from:e.from});return;case`subject.delete`:case`relationship.delete`:O({type:`deletion.asked`,id:e.id});return;case`relationship.retype`:{let n=t?.edges.find(t=>t.id===e.id);if(n===void 0)return;for(let t of _w(n.document,n.localId,`kind`,n.kindLabel,e.kind))x(t);O({type:`menu.dismissed`});return}case`canvas.draft-subject`:R(void 0),O({type:`subject.draft.opened`});return;case`view.add-subject`:case`view.remove-subject`:_(s.activeView,e.id,e.type===`view.add-subject`?`add`:`remove`),O({type:`menu.dismissed`});return;case`view.open`:f(e.id),O({type:`menu.dismissed`});return;case`view.clear`:m(),O({type:`menu.dismissed`});return;case`subject.fold`:case`subject.unfold`:O({type:`fold.toggled`,id:e.id}),O({type:`menu.dismissed`});return;case`subject.unfold-all`:{let t=ne.insideIds.get(e.id)??[];O({type:`fold.all`,folded:!1,ids:[e.id,...t]}),O({type:`menu.dismissed`});return}case`selection.fold`:case`selection.unfold`:for(let t of e.ids)re.has(t)!==(e.type===`selection.fold`)&&O({type:`fold.toggled`,id:t});O({type:`menu.dismissed`});return;case`canvas.fold-all`:case`canvas.unfold-all`:O({type:`fold.all`,folded:e.type===`canvas.fold-all`,ids:[...ne.insideCounts.keys()]}),O({type:`menu.dismissed`});return;case`subject.focus-instance`:p({instances:[e.id],relationships:`between`},`focus`,D.nesting),O({type:`menu.dismissed`});return;case`subject.focus`:case`relationship.focus`:{let t=s.model?.graph??null;if(t===null){O({type:`menu.dismissed`});return}let n=e.type===`subject.focus`?DC(t,e.id):OC(t,e.id);if(n.length===0){O({type:`menu.dismissed`});return}p({subjects:[...n],relationships:`between`},`focus`,D.nesting),O({type:`menu.dismissed`});return}case`view.new`:I(void 0),M(!0),O({type:`menu.dismissed`});return;case`view.delete`:O({type:`viewDeletion.asked`,id:e.id});return;case`view.rename`:O({type:`viewRename.asked`,id:e.id});return;case`view.new-folder`:P(!0),O({type:`menu.dismissed`});return;case`view.duplicate`:{let t=s.views.find(t=>t.id===e.id);if(t===void 0)return;let n=wS(t,new Set(s.views.map(e=>e.id)));g({op:`write-view`,...n}),O({type:`menu.dismissed`});return}case`view.new-in-folder`:{let t=s.views.find(t=>t.id===e.id);if(t===void 0)return;I(SS(t)),M(!0),O({type:`menu.dismissed`});return}case`view.copy-path`:{let t=s.views.find(t=>t.id===e.id);if(t===void 0)return;navigator.clipboard?.writeText(t.path),O({type:`menu.dismissed`});return}case`canvas.export-png`:{let e=B.current;if(e===null)return;let t=document.createElement(`a`);t.href=e(),t.download=`${s.activeView===``?`all-subjects`:s.activeView}.png`,t.click(),O({type:`menu.dismissed`});return}}},xe=D.pendingViewDeletion===null?null:s.views.find(e=>e.id===D.pendingViewDeletion)??null,Se=D.pendingViewRename===null?null:s.views.find(e=>e.id===D.pendingViewRename)??null,Ce=[`Show the session panel`,...D.conversation.unread===0?[]:[`${D.conversation.unread} unread`],...s.choices===null?[]:[`the agent is waiting on a choice`]].join(`, `);return(0,$.jsxs)(`main`,{className:`visual-shell`,style:fe,children:[(0,$.jsx)(KE,{state:s,connection:WE(s,c)}),(0,$.jsxs)(`div`,{className:`workspace`,"data-rail":D.railHidden?`hidden`:void 0,children:[D.railHidden?(0,$.jsx)(`button`,{type:`button`,className:`rail-reopen`,title:`Show the view tree`,"aria-label":he===void 0?`Show the view tree`:`Show the view tree, showing ${he}`,onClick:()=>O({type:`rail.toggled`}),children:(0,$.jsx)(`span`,{"aria-hidden":`true`,children:`»`})}):(0,$.jsx)(SC,{views:s.views,stagedViewOperations:s.pendingChangeset.viewOperations,activeViewId:s.activeView,nodes:s.model?.graph.nodes??[],folded:re,insideCounts:ne.insideCounts,inViewIds:s.activeFilter===null?null:new Set(s.activeFilter.matchedIds),filterText:D.tree.filterText,collapsed:ue,onFilterChange:e=>O({type:`tree.filtered`,filterText:e}),onToggle:e=>O({type:`tree.toggled`,key:e}),onSelectView:e=>f(e),onClearView:m,onNewView:()=>{I(void 0),M(!0)},onSelectSubject:e=>{let t=s.model?.graph.nodes.find(t=>t.id===e);t!==void 0&&O({type:`subject.selected`,subject:fT(t)})},onRowMenu:(e,t)=>me(e.kind===`view`?{kind:`view-row`,id:e.id}:{kind:`model-row`,id:e.id},t),readOnly:n,onHide:()=>O({type:`rail.toggled`})}),(0,$.jsx)(YE,{state:s,selectedId:D.selectedSubject?.id??null,waiting:K,layout:D.layout,nesting:D.nesting,folded:re,memberships:s.model?.memberships,direction:D.direction,onLayoutChange:e=>O({type:`layout.set`,layout:e}),onDirectionChange:e=>O({type:`direction.set`,direction:e}),stylePreset:D.stylePreset,onStyleChange:e=>{qg(e),O({type:`style.set`,preset:e})},decorations:ee,connection:D.connection,onConnectTarget:e=>O({type:`connection.targeted`,to:e}),onConnectCancel:()=>O({type:`connection.cancelled`}),onConnectStage:x,onDraftStage:e=>{x(e),e.op===`add-concept`&&_(s.activeView,e.concept.id,`add`)},draftingSubject:D.draftingSubject,draftInitialKind:L,draftPattern:(s.model?.vocabulary.patterns??[]).find(e=>e.label===L),onKindDrop:e=>pe(e),onDraftSubject:()=>{R(void 0),O({type:`subject.draft.opened`})},onDraftSubjectClose:()=>O({type:`subject.draft.closed`}),pendingDeletion:D.pendingDeletion,onDeletionDismiss:()=>O({type:`deletion.dismissed`}),showLifecycle:D.showLifecycle,showEvidence:D.showEvidence,showOwnership:D.showOwnership,showKindLabels:D.showKindLabels,showNudges:D.showNudges,openQuestionCounts:te,onSelect:e=>O({type:`subject.selected`,subject:e}),onCanvasMenu:(e,t)=>me(e.type===`node`?{kind:`subject`,id:e.id??``}:e.type===`edge`?{kind:`relationship`,id:e.id??``}:{kind:`canvas`},t),onClearFilter:m,onSaveLayout:e=>v({...e,folded:[...D.folded],unfolded:[...D.unfolded]}),onCanvasReady:e=>{B.current=e},onQuickFilterChange:h,view:s.views.find(e=>e.id===s.activeView)??null,bottomPanel:D.bottomPanel,onTogglePresentation:(e,t)=>O({type:`presentation.toggled`,flag:e,value:t}),onToggleBottomPanel:()=>O({type:`bottomPanel.toggled`}),onSelectBottomTab:e=>O({type:`bottomPanel.tabSelected`,tab:e}),onApplyFilter:e=>p(e,`editor`,D.nesting),onStageView:g,readOnly:n,paletteReachable:ie.includes(`palette`)}),de?(0,$.jsxs)(`button`,{type:`button`,className:`conversation-reopen`,title:`Show the session panel`,"aria-label":Ce,onClick:()=>O({type:`conversation.toggled`}),children:[(0,$.jsx)(`span`,{className:`reopen-chevron`,"aria-hidden":`true`,children:`«`}),D.conversation.unread===0?null:(0,$.jsx)(`span`,{className:`attention-count`,children:D.conversation.unread}),s.choices===null?null:(0,$.jsx)(`span`,{className:`attention-choice`,title:`The agent is waiting on a choice`,children:`?`})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(nD,{width:D.conversation.width,viewportWidth:D.viewportWidth,onResize:e=>O({type:`conversation.resized`,width:e})}),(0,$.jsxs)(`aside`,{className:`section-stack`,"aria-label":`Session`,children:[(0,$.jsx)(`div`,{className:`stack-rim`,children:(0,$.jsx)(`button`,{type:`button`,className:`conversation-hide`,title:`Hide the session panel`,"aria-label":`Hide the session panel`,onClick:()=>O({type:`conversation.toggled`}),children:`»`})}),FT(ae,{palette:(0,$.jsx)(NT,{id:`palette`,label:`Kind palette`,meta:ce.length===0?void 0:ce.length===1?`1 kind`:`${ce.length} kinds`,open:J(`palette`),onToggle:()=>O({type:`section.toggled`,section:`palette`}),children:ce.length===0?(0,$.jsx)(`p`,{className:`section-empty`,children:`No model yet. The kinds arrive with it.`}):(0,$.jsx)($_,{kinds:ce,patterns:le,onPick:pe})}),properties:(0,$.jsx)(NT,{id:`properties`,label:`Element properties`,meta:D.selectedSubject?.id,open:J(`properties`),onToggle:()=>O({type:`section.toggled`,section:`properties`}),children:D.selectedSubject===null||s.model===null?(0,$.jsx)(`p`,{className:`section-empty`,children:`Nothing selected. Pick a subject on the canvas or in the rail.`}):(0,$.jsx)(ZE,{subject:D.selectedSubject,model:s.model,operations:s.pendingChangeset.operations,expanded:D.descriptionExpanded,onToggleDescription:()=>O({type:`description.toggled`}),onClear:()=>O({type:`subject.cleared`}),onConnect:e=>O({type:`connection.started`,from:e}),onDelete:e=>O({type:`deletion.asked`,id:e}),onStageChange:x,readOnly:n})}),questions:(0,$.jsx)(NT,{id:`questions`,label:`Open questions`,meta:se===void 0?void 0:se===0?`nothing open`:`${se} open`,open:J(`questions`),onToggle:()=>O({type:`section.toggled`,section:`questions`}),children:Y===void 0?null:(0,$.jsx)(rT,{overlay:Y,selectedId:oe,readOnly:n,onVerb:(e,t,n)=>ve(t,n),delegateLabel:ge,onDelegate:(e,t)=>ye({questionId:e.questionId,subjectId:t,question:e.question},D.selectedSubject?.type===`element`?D.selectedSubject.title:null)})}),changes:(0,$.jsx)(NT,{id:`changes`,label:`Changes`,meta:q===0?`nothing staged`:`${q} staged`,open:J(`changes`),onToggle:()=>O({type:`section.toggled`,section:`changes`}),children:(0,$.jsx)(VC,{state:s,onDiscardChange:b,onClearChangeset:S,onUndoChangeset:C,onRedoChangeset:w,onCommitChangeset:T})}),chat:(0,$.jsx)(NT,{id:`chat`,label:`Chat`,meta:D.conversation.unread===0?eD(s):(0,$.jsx)(`span`,{className:`attention-count`,children:D.conversation.unread}),open:J(`chat`),onToggle:()=>O({type:`section.toggled`,section:`chat`}),children:(0,$.jsx)(tD,{state:s,disabled:!s.composerEnabled,selectedSubject:D.selectedSubject,onSend:e=>l(MT(e,D.selectedSubject)),onChoice:u,onClearSubject:()=>O({type:`subject.cleared`}),onEnd:E})})},{changes:(0,$.jsx)(PT,{label:`Resize the changes section`,height:D.conversation.changesHeight,viewportHeight:D.viewportHeight,onResize:e=>O({type:`section.resized`,section:`changes`,height:e})}),chat:(0,$.jsx)(PT,{label:`Resize the chat section`,height:D.conversation.chatHeight,viewportHeight:D.viewportHeight,onResize:e=>O({type:`section.resized`,section:`chat`,height:e})})})]})]})]}),D.contextMenu===null?null:(0,$.jsx)(IE,{groups:_e,x:D.contextMenu.x,y:D.contextMenu.y,onChoose:be,onDismiss:()=>O({type:`menu.dismissed`})}),(0,$.jsx)(TC,{views:s.views,activeViewId:s.activeView,query:s.activeFilter?.query??null,layout:D.layout,direction:D.direction,showLifecycle:D.showLifecycle,showEvidence:D.showEvidence,showOwnership:D.showOwnership,showKindLabels:D.showKindLabels,open:j,folder:F,onClose:()=>M(!1),onStage:g}),N?(0,$.jsx)(gE,{title:`New folder`,label:`Folder`,initialValue:``,confirmLabel:`Continue`,cancelLabel:`Cancel`,onConfirm:e=>{P(!1);let t=e.trim();t!==``&&(I(t),M(!0))},onCancel:()=>P(!1)}):null,Se===null?null:(0,$.jsx)(gE,{title:`Rename view`,label:`Title`,initialValue:Se.title,confirmLabel:`Rename`,cancelLabel:`Cancel`,onConfirm:e=>{g({op:`write-view`,...CS(Se,e)}),O({type:`viewRename.dismissed`})},onCancel:()=>O({type:`viewRename.dismissed`})}),xe===null?null:(0,$.jsx)(hE,{title:`Delete view`,message:`Stage the removal of "${xe.title}"? The projection document goes when the changeset is committed; no subject is touched.`,confirmLabel:`Delete`,cancelLabel:`Keep`,onConfirm:()=>{g({op:`delete-view`,path:xe.path}),O({type:`viewDeletion.dismissed`})},onCancel:()=>O({type:`viewDeletion.dismissed`})})]})},iD=`/api/session`,aD=`/socket`,oD=1e3,sD=()=>{let e=null;return{open:t=>{let n=!1,r,i=null,a=()=>{let e=new URL(aD,window.location.href);return e.protocol=e.protocol===`https:`?`wss:`:`ws:`,e.searchParams.set(`after`,String(t.session().lastSequence)),e},o=()=>{if(!n){if(i??=Date.now(),!HT(i,Date.now())){t.frame({kind:`closing`,reason:`browser-timeout`});return}r=setTimeout(s,oD)}},s=()=>{if(n)return;let r=new WebSocket(a());e=r,r.addEventListener(`open`,()=>{i=null,t.connected(!0)}),r.addEventListener(`message`,e=>{if(typeof e.data==`string`)try{t.frame(JSON.parse(e.data))}catch{}}),r.addEventListener(`close`,()=>{t.connected(!1),e=null,!(n||t.session().closed)&&(t.lost(),o())}),r.addEventListener(`error`,()=>r.close())};return(async()=>{let e=await fetch(iD,{credentials:`same-origin`,headers:{Accept:`application/json`}});if(!e.ok)throw Error(`Session request answered ${e.status}`);let r=await e.json();n||(t.frame({kind:`ready`,snapshot:r}),s())})().catch(()=>{n||(t.lost(),o())}),()=>{n=!0,r!==void 0&&clearTimeout(r),e?.close()}},send:t=>{e!==null&&e.readyState===WebSocket.OPEN&&e.send(JSON.stringify(t))}}},cD=document.getElementById(`visual-session`);if(cD===null)throw Error(`The visual session page has no mount point`);jv(Av(()=>new v)),(0,_.createRoot)(cD).render((0,$.jsx)(rD,{host:sD()}));export{l as n,o as t};