@wairon/cli 5.1.1-dev.11 → 5.1.1-dev.110
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CONTRIBUTING.md +193 -0
- package/README.md +154 -41
- package/dist/cli/index.js +66474 -29775
- package/dist/cli/index.js.map +1 -1
- package/dist/index.d.ts +43671 -0
- package/dist/index.js +53581 -21797
- package/dist/index.js.map +1 -1
- package/dist/templates/architect.yaml +15 -13
- package/dist/templates/domain-owner.yaml +5 -4
- package/dist/templates/skills/sdd-architect.md +44 -26
- package/dist/templates/skills/sdd-auditor.md +5 -4
- package/dist/templates/skills/sdd-delegate.md +43 -4
- package/dist/templates/skills/sdd-implement.md +83 -13
- package/dist/templates/skills/sdd-narrative.md +7 -4
- package/dist/templates/variants/logic-shapes.yaml +59 -0
- package/dist/templates/variants/portal-shapes.yaml +13 -0
- package/dist/webapp.html +771 -0
- package/docs/architecture.md +83 -0
- package/docs/cli.md +1208 -0
- package/docs/design/approval-baseline.md +257 -0
- package/docs/design/connecting-agent-entrypoint.md +167 -0
- package/docs/design/execution-budgets.md +199 -0
- package/docs/design/pack-scoping.md +581 -0
- package/docs/design/supervisor-doctrine.md +110 -0
- package/docs/design-export.md +313 -0
- package/docs/extending-wairon.md +616 -0
- package/docs/network.md +109 -0
- package/docs/requirements.md +65 -0
- package/docs/roadmap.md +133 -0
- package/docs/standards/INDEX.md +23 -0
- package/docs/standards/architecture.md +1042 -0
- package/docs/standards/language-bindings.md +120 -0
- package/docs/templates.md +61 -0
- package/docs/vision.md +59 -0
- package/docs/wairon-feature-requests-hosted-mcp.md +74 -0
- package/package.json +18 -5
- package/schemas/design-export-2.json +1186 -0
package/dist/webapp.html
ADDED
|
@@ -0,0 +1,771 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
|
+
<title>wairon</title>
|
|
7
|
+
<script type="module" crossorigin>function Qj(t,e){for(var n=0;n<e.length;n++){const r=e[n];if(typeof r!="string"&&!Array.isArray(r)){for(const a in r)if(a!=="default"&&!(a in t)){const i=Object.getOwnPropertyDescriptor(r,a);i&&Object.defineProperty(t,a,i.get?i:{enumerable:!0,get:()=>r[a]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))r(a);new MutationObserver(a=>{for(const i of a)if(i.type==="childList")for(const s of i.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&r(s)}).observe(document,{childList:!0,subtree:!0});function n(a){const i={};return a.integrity&&(i.integrity=a.integrity),a.referrerPolicy&&(i.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?i.credentials="include":a.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(a){if(a.ep)return;a.ep=!0;const i=n(a);fetch(a.href,i)}})();function Zj(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var j1={exports:{}},af={},T1={exports:{}},zt={};/**
|
|
8
|
+
* @license React
|
|
9
|
+
* react.production.min.js
|
|
10
|
+
*
|
|
11
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
12
|
+
*
|
|
13
|
+
* This source code is licensed under the MIT license found in the
|
|
14
|
+
* LICENSE file in the root directory of this source tree.
|
|
15
|
+
*/var Pu=Symbol.for("react.element"),Jj=Symbol.for("react.portal"),e2=Symbol.for("react.fragment"),t2=Symbol.for("react.strict_mode"),n2=Symbol.for("react.profiler"),r2=Symbol.for("react.provider"),a2=Symbol.for("react.context"),i2=Symbol.for("react.forward_ref"),s2=Symbol.for("react.suspense"),o2=Symbol.for("react.memo"),l2=Symbol.for("react.lazy"),r0=Symbol.iterator;function u2(t){return t===null||typeof t!="object"?null:(t=r0&&t[r0]||t["@@iterator"],typeof t=="function"?t:null)}var N1={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},P1=Object.assign,R1={};function Yo(t,e,n){this.props=t,this.context=e,this.refs=R1,this.updater=n||N1}Yo.prototype.isReactComponent={};Yo.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,t,e,"setState")};Yo.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function I1(){}I1.prototype=Yo.prototype;function Zg(t,e,n){this.props=t,this.context=e,this.refs=R1,this.updater=n||N1}var Jg=Zg.prototype=new I1;Jg.constructor=Zg;P1(Jg,Yo.prototype);Jg.isPureReactComponent=!0;var a0=Array.isArray,L1=Object.prototype.hasOwnProperty,em={current:null},A1={key:!0,ref:!0,__self:!0,__source:!0};function D1(t,e,n){var r,a={},i=null,s=null;if(e!=null)for(r in e.ref!==void 0&&(s=e.ref),e.key!==void 0&&(i=""+e.key),e)L1.call(e,r)&&!A1.hasOwnProperty(r)&&(a[r]=e[r]);var o=arguments.length-2;if(o===1)a.children=n;else if(1<o){for(var l=Array(o),u=0;u<o;u++)l[u]=arguments[u+2];a.children=l}if(t&&t.defaultProps)for(r in o=t.defaultProps,o)a[r]===void 0&&(a[r]=o[r]);return{$$typeof:Pu,type:t,key:i,ref:s,props:a,_owner:em.current}}function c2(t,e){return{$$typeof:Pu,type:t.type,key:e,ref:t.ref,props:t.props,_owner:t._owner}}function tm(t){return typeof t=="object"&&t!==null&&t.$$typeof===Pu}function d2(t){var e={"=":"=0",":":"=2"};return"$"+t.replace(/[=:]/g,function(n){return e[n]})}var i0=/\/+/g;function yh(t,e){return typeof t=="object"&&t!==null&&t.key!=null?d2(""+t.key):e.toString(36)}function $c(t,e,n,r,a){var i=typeof t;(i==="undefined"||i==="boolean")&&(t=null);var s=!1;if(t===null)s=!0;else switch(i){case"string":case"number":s=!0;break;case"object":switch(t.$$typeof){case Pu:case Jj:s=!0}}if(s)return s=t,a=a(s),t=r===""?"."+yh(s,0):r,a0(a)?(n="",t!=null&&(n=t.replace(i0,"$&/")+"/"),$c(a,e,n,"",function(u){return u})):a!=null&&(tm(a)&&(a=c2(a,n+(!a.key||s&&s.key===a.key?"":(""+a.key).replace(i0,"$&/")+"/")+t)),e.push(a)),1;if(s=0,r=r===""?".":r+":",a0(t))for(var o=0;o<t.length;o++){i=t[o];var l=r+yh(i,o);s+=$c(i,e,n,l,a)}else if(l=u2(t),typeof l=="function")for(t=l.call(t),o=0;!(i=t.next()).done;)i=i.value,l=r+yh(i,o++),s+=$c(i,e,n,l,a);else if(i==="object")throw e=String(t),Error("Objects are not valid as a React child (found: "+(e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)+"). If you meant to render a collection of children, use an array instead.");return s}function cc(t,e,n){if(t==null)return t;var r=[],a=0;return $c(t,r,"","",function(i){return e.call(n,i,a++)}),r}function f2(t){if(t._status===-1){var e=t._result;e=e(),e.then(function(n){(t._status===0||t._status===-1)&&(t._status=1,t._result=n)},function(n){(t._status===0||t._status===-1)&&(t._status=2,t._result=n)}),t._status===-1&&(t._status=0,t._result=e)}if(t._status===1)return t._result.default;throw t._result}var Tr={current:null},Vc={transition:null},h2={ReactCurrentDispatcher:Tr,ReactCurrentBatchConfig:Vc,ReactCurrentOwner:em};function B1(){throw Error("act(...) is not supported in production builds of React.")}zt.Children={map:cc,forEach:function(t,e,n){cc(t,function(){e.apply(this,arguments)},n)},count:function(t){var e=0;return cc(t,function(){e++}),e},toArray:function(t){return cc(t,function(e){return e})||[]},only:function(t){if(!tm(t))throw Error("React.Children.only expected to receive a single React element child.");return t}};zt.Component=Yo;zt.Fragment=e2;zt.Profiler=n2;zt.PureComponent=Zg;zt.StrictMode=t2;zt.Suspense=s2;zt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=h2;zt.act=B1;zt.cloneElement=function(t,e,n){if(t==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+t+".");var r=P1({},t.props),a=t.key,i=t.ref,s=t._owner;if(e!=null){if(e.ref!==void 0&&(i=e.ref,s=em.current),e.key!==void 0&&(a=""+e.key),t.type&&t.type.defaultProps)var o=t.type.defaultProps;for(l in e)L1.call(e,l)&&!A1.hasOwnProperty(l)&&(r[l]=e[l]===void 0&&o!==void 0?o[l]:e[l])}var l=arguments.length-2;if(l===1)r.children=n;else if(1<l){o=Array(l);for(var u=0;u<l;u++)o[u]=arguments[u+2];r.children=o}return{$$typeof:Pu,type:t.type,key:a,ref:i,props:r,_owner:s}};zt.createContext=function(t){return t={$$typeof:a2,_currentValue:t,_currentValue2:t,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},t.Provider={$$typeof:r2,_context:t},t.Consumer=t};zt.createElement=D1;zt.createFactory=function(t){var e=D1.bind(null,t);return e.type=t,e};zt.createRef=function(){return{current:null}};zt.forwardRef=function(t){return{$$typeof:i2,render:t}};zt.isValidElement=tm;zt.lazy=function(t){return{$$typeof:l2,_payload:{_status:-1,_result:t},_init:f2}};zt.memo=function(t,e){return{$$typeof:o2,type:t,compare:e===void 0?null:e}};zt.startTransition=function(t){var e=Vc.transition;Vc.transition={};try{t()}finally{Vc.transition=e}};zt.unstable_act=B1;zt.useCallback=function(t,e){return Tr.current.useCallback(t,e)};zt.useContext=function(t){return Tr.current.useContext(t)};zt.useDebugValue=function(){};zt.useDeferredValue=function(t){return Tr.current.useDeferredValue(t)};zt.useEffect=function(t,e){return Tr.current.useEffect(t,e)};zt.useId=function(){return Tr.current.useId()};zt.useImperativeHandle=function(t,e,n){return Tr.current.useImperativeHandle(t,e,n)};zt.useInsertionEffect=function(t,e){return Tr.current.useInsertionEffect(t,e)};zt.useLayoutEffect=function(t,e){return Tr.current.useLayoutEffect(t,e)};zt.useMemo=function(t,e){return Tr.current.useMemo(t,e)};zt.useReducer=function(t,e,n){return Tr.current.useReducer(t,e,n)};zt.useRef=function(t){return Tr.current.useRef(t)};zt.useState=function(t){return Tr.current.useState(t)};zt.useSyncExternalStore=function(t,e,n){return Tr.current.useSyncExternalStore(t,e,n)};zt.useTransition=function(){return Tr.current.useTransition()};zt.version="18.3.1";T1.exports=zt;var A=T1.exports;const v2=Zj(A),p2=Qj({__proto__:null,default:v2},[A]);/**
|
|
16
|
+
* @license React
|
|
17
|
+
* react-jsx-runtime.production.min.js
|
|
18
|
+
*
|
|
19
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
20
|
+
*
|
|
21
|
+
* This source code is licensed under the MIT license found in the
|
|
22
|
+
* LICENSE file in the root directory of this source tree.
|
|
23
|
+
*/var g2=A,m2=Symbol.for("react.element"),y2=Symbol.for("react.fragment"),b2=Object.prototype.hasOwnProperty,x2=g2.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,w2={key:!0,ref:!0,__self:!0,__source:!0};function M1(t,e,n){var r,a={},i=null,s=null;n!==void 0&&(i=""+n),e.key!==void 0&&(i=""+e.key),e.ref!==void 0&&(s=e.ref);for(r in e)b2.call(e,r)&&!w2.hasOwnProperty(r)&&(a[r]=e[r]);if(t&&t.defaultProps)for(r in e=t.defaultProps,e)a[r]===void 0&&(a[r]=e[r]);return{$$typeof:m2,type:t,key:i,ref:s,props:a,_owner:x2.current}}af.Fragment=y2;af.jsx=M1;af.jsxs=M1;j1.exports=af;var c=j1.exports,O1={exports:{}},Zr={},z1={exports:{}},F1={};/**
|
|
24
|
+
* @license React
|
|
25
|
+
* scheduler.production.min.js
|
|
26
|
+
*
|
|
27
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
28
|
+
*
|
|
29
|
+
* This source code is licensed under the MIT license found in the
|
|
30
|
+
* LICENSE file in the root directory of this source tree.
|
|
31
|
+
*/(function(t){function e(F,G){var z=F.length;F.push(G);e:for(;0<z;){var _=z-1>>>1,K=F[_];if(0<a(K,G))F[_]=G,F[z]=K,z=_;else break e}}function n(F){return F.length===0?null:F[0]}function r(F){if(F.length===0)return null;var G=F[0],z=F.pop();if(z!==G){F[0]=z;e:for(var _=0,K=F.length,ie=K>>>1;_<ie;){var M=2*(_+1)-1,oe=F[M],ve=M+1,ye=F[ve];if(0>a(oe,z))ve<K&&0>a(ye,oe)?(F[_]=ye,F[ve]=z,_=ve):(F[_]=oe,F[M]=z,_=M);else if(ve<K&&0>a(ye,z))F[_]=ye,F[ve]=z,_=ve;else break e}}return G}function a(F,G){var z=F.sortIndex-G.sortIndex;return z!==0?z:F.id-G.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;t.unstable_now=function(){return i.now()}}else{var s=Date,o=s.now();t.unstable_now=function(){return s.now()-o}}var l=[],u=[],d=1,f=null,h=3,v=!1,p=!1,y=!1,b=typeof setTimeout=="function"?setTimeout:null,m=typeof clearTimeout=="function"?clearTimeout:null,g=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function w(F){for(var G=n(u);G!==null;){if(G.callback===null)r(u);else if(G.startTime<=F)r(u),G.sortIndex=G.expirationTime,e(l,G);else break;G=n(u)}}function x(F){if(y=!1,w(F),!p)if(n(l)!==null)p=!0,V(E);else{var G=n(u);G!==null&&U(x,G.startTime-F)}}function E(F,G){p=!1,y&&(y=!1,m(T),T=-1),v=!0;var z=h;try{for(w(G),f=n(l);f!==null&&(!(f.expirationTime>G)||F&&!R());){var _=f.callback;if(typeof _=="function"){f.callback=null,h=f.priorityLevel;var K=_(f.expirationTime<=G);G=t.unstable_now(),typeof K=="function"?f.callback=K:f===n(l)&&r(l),w(G)}else r(l);f=n(l)}if(f!==null)var ie=!0;else{var M=n(u);M!==null&&U(x,M.startTime-G),ie=!1}return ie}finally{f=null,h=z,v=!1}}var S=!1,C=null,T=-1,N=5,P=-1;function R(){return!(t.unstable_now()-P<N)}function I(){if(C!==null){var F=t.unstable_now();P=F;var G=!0;try{G=C(!0,F)}finally{G?D():(S=!1,C=null)}}else S=!1}var D;if(typeof g=="function")D=function(){g(I)};else if(typeof MessageChannel<"u"){var $=new MessageChannel,H=$.port2;$.port1.onmessage=I,D=function(){H.postMessage(null)}}else D=function(){b(I,0)};function V(F){C=F,S||(S=!0,D())}function U(F,G){T=b(function(){F(t.unstable_now())},G)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(F){F.callback=null},t.unstable_continueExecution=function(){p||v||(p=!0,V(E))},t.unstable_forceFrameRate=function(F){0>F||125<F?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):N=0<F?Math.floor(1e3/F):5},t.unstable_getCurrentPriorityLevel=function(){return h},t.unstable_getFirstCallbackNode=function(){return n(l)},t.unstable_next=function(F){switch(h){case 1:case 2:case 3:var G=3;break;default:G=h}var z=h;h=G;try{return F()}finally{h=z}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(F,G){switch(F){case 1:case 2:case 3:case 4:case 5:break;default:F=3}var z=h;h=F;try{return G()}finally{h=z}},t.unstable_scheduleCallback=function(F,G,z){var _=t.unstable_now();switch(typeof z=="object"&&z!==null?(z=z.delay,z=typeof z=="number"&&0<z?_+z:_):z=_,F){case 1:var K=-1;break;case 2:K=250;break;case 5:K=1073741823;break;case 4:K=1e4;break;default:K=5e3}return K=z+K,F={id:d++,callback:G,priorityLevel:F,startTime:z,expirationTime:K,sortIndex:-1},z>_?(F.sortIndex=z,e(u,F),n(l)===null&&F===n(u)&&(y?(m(T),T=-1):y=!0,U(x,z-_))):(F.sortIndex=K,e(l,F),p||v||(p=!0,V(E))),F},t.unstable_shouldYield=R,t.unstable_wrapCallback=function(F){var G=h;return function(){var z=h;h=G;try{return F.apply(this,arguments)}finally{h=z}}}})(F1);z1.exports=F1;var k2=z1.exports;/**
|
|
32
|
+
* @license React
|
|
33
|
+
* react-dom.production.min.js
|
|
34
|
+
*
|
|
35
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
36
|
+
*
|
|
37
|
+
* This source code is licensed under the MIT license found in the
|
|
38
|
+
* LICENSE file in the root directory of this source tree.
|
|
39
|
+
*/var E2=A,Qr=k2;function Pe(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,n=1;n<arguments.length;n++)e+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+t+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var _1=new Set,Xl={};function Fs(t,e){Do(t,e),Do(t+"Capture",e)}function Do(t,e){for(Xl[t]=e,t=0;t<e.length;t++)_1.add(e[t])}var Za=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Pp=Object.prototype.hasOwnProperty,C2=/^[: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]*$/,s0={},o0={};function S2(t){return Pp.call(o0,t)?!0:Pp.call(s0,t)?!1:C2.test(t)?o0[t]=!0:(s0[t]=!0,!1)}function j2(t,e,n,r){if(n!==null&&n.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function T2(t,e,n,r){if(e===null||typeof e>"u"||j2(t,e,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function Nr(t,e,n,r,a,i,s){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=r,this.attributeNamespace=a,this.mustUseProperty=n,this.propertyName=t,this.type=e,this.sanitizeURL=i,this.removeEmptyString=s}var lr={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){lr[t]=new Nr(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];lr[e]=new Nr(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){lr[t]=new Nr(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){lr[t]=new Nr(t,2,!1,t,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(t){lr[t]=new Nr(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){lr[t]=new Nr(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){lr[t]=new Nr(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){lr[t]=new Nr(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){lr[t]=new Nr(t,5,!1,t.toLowerCase(),null,!1,!1)});var nm=/[\-:]([a-z])/g;function rm(t){return t[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(t){var e=t.replace(nm,rm);lr[e]=new Nr(e,1,!1,t,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace(nm,rm);lr[e]=new Nr(e,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(nm,rm);lr[e]=new Nr(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){lr[t]=new Nr(t,1,!1,t.toLowerCase(),null,!1,!1)});lr.xlinkHref=new Nr("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){lr[t]=new Nr(t,1,!1,t.toLowerCase(),null,!0,!0)});function am(t,e,n,r){var a=lr.hasOwnProperty(e)?lr[e]:null;(a!==null?a.type!==0:r||!(2<e.length)||e[0]!=="o"&&e[0]!=="O"||e[1]!=="n"&&e[1]!=="N")&&(T2(e,n,a,r)&&(n=null),r||a===null?S2(e)&&(n===null?t.removeAttribute(e):t.setAttribute(e,""+n)):a.mustUseProperty?t[a.propertyName]=n===null?a.type===3?!1:"":n:(e=a.attributeName,r=a.attributeNamespace,n===null?t.removeAttribute(e):(a=a.type,n=a===3||a===4&&n===!0?"":""+n,r?t.setAttributeNS(r,e,n):t.setAttribute(e,n))))}var ai=E2.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,dc=Symbol.for("react.element"),io=Symbol.for("react.portal"),so=Symbol.for("react.fragment"),im=Symbol.for("react.strict_mode"),Rp=Symbol.for("react.profiler"),$1=Symbol.for("react.provider"),V1=Symbol.for("react.context"),sm=Symbol.for("react.forward_ref"),Ip=Symbol.for("react.suspense"),Lp=Symbol.for("react.suspense_list"),om=Symbol.for("react.memo"),yi=Symbol.for("react.lazy"),U1=Symbol.for("react.offscreen"),l0=Symbol.iterator;function hl(t){return t===null||typeof t!="object"?null:(t=l0&&t[l0]||t["@@iterator"],typeof t=="function"?t:null)}var Cn=Object.assign,bh;function Rl(t){if(bh===void 0)try{throw Error()}catch(n){var e=n.stack.trim().match(/\n( *(at )?)/);bh=e&&e[1]||""}return`
|
|
40
|
+
`+bh+t}var xh=!1;function wh(t,e){if(!t||xh)return"";xh=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(e)if(e=function(){throw Error()},Object.defineProperty(e.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(e,[])}catch(u){var r=u}Reflect.construct(t,[],e)}else{try{e.call()}catch(u){r=u}t.call(e.prototype)}else{try{throw Error()}catch(u){r=u}t()}}catch(u){if(u&&r&&typeof u.stack=="string"){for(var a=u.stack.split(`
|
|
41
|
+
`),i=r.stack.split(`
|
|
42
|
+
`),s=a.length-1,o=i.length-1;1<=s&&0<=o&&a[s]!==i[o];)o--;for(;1<=s&&0<=o;s--,o--)if(a[s]!==i[o]){if(s!==1||o!==1)do if(s--,o--,0>o||a[s]!==i[o]){var l=`
|
|
43
|
+
`+a[s].replace(" at new "," at ");return t.displayName&&l.includes("<anonymous>")&&(l=l.replace("<anonymous>",t.displayName)),l}while(1<=s&&0<=o);break}}}finally{xh=!1,Error.prepareStackTrace=n}return(t=t?t.displayName||t.name:"")?Rl(t):""}function N2(t){switch(t.tag){case 5:return Rl(t.type);case 16:return Rl("Lazy");case 13:return Rl("Suspense");case 19:return Rl("SuspenseList");case 0:case 2:case 15:return t=wh(t.type,!1),t;case 11:return t=wh(t.type.render,!1),t;case 1:return t=wh(t.type,!0),t;default:return""}}function Ap(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case so:return"Fragment";case io:return"Portal";case Rp:return"Profiler";case im:return"StrictMode";case Ip:return"Suspense";case Lp:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case V1:return(t.displayName||"Context")+".Consumer";case $1:return(t._context.displayName||"Context")+".Provider";case sm:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case om:return e=t.displayName||null,e!==null?e:Ap(t.type)||"Memo";case yi:e=t._payload,t=t._init;try{return Ap(t(e))}catch{}}return null}function P2(t){var e=t.type;switch(t.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Ap(e);case 8:return e===im?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function $i(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function q1(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function R2(t){var e=q1(t)?"checked":"value",n=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),r=""+t[e];if(!t.hasOwnProperty(e)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var a=n.get,i=n.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return a.call(this)},set:function(s){r=""+s,i.call(this,s)}}),Object.defineProperty(t,e,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(s){r=""+s},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function fc(t){t._valueTracker||(t._valueTracker=R2(t))}function H1(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),r="";return t&&(r=q1(t)?t.checked?"true":"false":t.value),t=r,t!==n?(e.setValue(t),!0):!1}function dd(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function Dp(t,e){var n=e.checked;return Cn({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??t._wrapperState.initialChecked})}function u0(t,e){var n=e.defaultValue==null?"":e.defaultValue,r=e.checked!=null?e.checked:e.defaultChecked;n=$i(e.value!=null?e.value:n),t._wrapperState={initialChecked:r,initialValue:n,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function W1(t,e){e=e.checked,e!=null&&am(t,"checked",e,!1)}function Bp(t,e){W1(t,e);var n=$i(e.value),r=e.type;if(n!=null)r==="number"?(n===0&&t.value===""||t.value!=n)&&(t.value=""+n):t.value!==""+n&&(t.value=""+n);else if(r==="submit"||r==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?Mp(t,e.type,n):e.hasOwnProperty("defaultValue")&&Mp(t,e.type,$i(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function c0(t,e,n){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var r=e.type;if(!(r!=="submit"&&r!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+t._wrapperState.initialValue,n||e===t.value||(t.value=e),t.defaultValue=e}n=t.name,n!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,n!==""&&(t.name=n)}function Mp(t,e,n){(e!=="number"||dd(t.ownerDocument)!==t)&&(n==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+n&&(t.defaultValue=""+n))}var Il=Array.isArray;function Eo(t,e,n,r){if(t=t.options,e){e={};for(var a=0;a<n.length;a++)e["$"+n[a]]=!0;for(n=0;n<t.length;n++)a=e.hasOwnProperty("$"+t[n].value),t[n].selected!==a&&(t[n].selected=a),a&&r&&(t[n].defaultSelected=!0)}else{for(n=""+$i(n),e=null,a=0;a<t.length;a++){if(t[a].value===n){t[a].selected=!0,r&&(t[a].defaultSelected=!0);return}e!==null||t[a].disabled||(e=t[a])}e!==null&&(e.selected=!0)}}function Op(t,e){if(e.dangerouslySetInnerHTML!=null)throw Error(Pe(91));return Cn({},e,{value:void 0,defaultValue:void 0,children:""+t._wrapperState.initialValue})}function d0(t,e){var n=e.value;if(n==null){if(n=e.children,e=e.defaultValue,n!=null){if(e!=null)throw Error(Pe(92));if(Il(n)){if(1<n.length)throw Error(Pe(93));n=n[0]}e=n}e==null&&(e=""),n=e}t._wrapperState={initialValue:$i(n)}}function K1(t,e){var n=$i(e.value),r=$i(e.defaultValue);n!=null&&(n=""+n,n!==t.value&&(t.value=n),e.defaultValue==null&&t.defaultValue!==n&&(t.defaultValue=n)),r!=null&&(t.defaultValue=""+r)}function f0(t){var e=t.textContent;e===t._wrapperState.initialValue&&e!==""&&e!==null&&(t.value=e)}function G1(t){switch(t){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function zp(t,e){return t==null||t==="http://www.w3.org/1999/xhtml"?G1(e):t==="http://www.w3.org/2000/svg"&&e==="foreignObject"?"http://www.w3.org/1999/xhtml":t}var hc,Y1=function(t){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(e,n,r,a){MSApp.execUnsafeLocalFunction(function(){return t(e,n,r,a)})}:t}(function(t,e){if(t.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in t)t.innerHTML=e;else{for(hc=hc||document.createElement("div"),hc.innerHTML="<svg>"+e.valueOf().toString()+"</svg>",e=hc.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function Ql(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=e;return}}t.textContent=e}var Ol={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},I2=["Webkit","ms","Moz","O"];Object.keys(Ol).forEach(function(t){I2.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),Ol[e]=Ol[t]})});function X1(t,e,n){return e==null||typeof e=="boolean"||e===""?"":n||typeof e!="number"||e===0||Ol.hasOwnProperty(t)&&Ol[t]?(""+e).trim():e+"px"}function Q1(t,e){t=t.style;for(var n in e)if(e.hasOwnProperty(n)){var r=n.indexOf("--")===0,a=X1(n,e[n],r);n==="float"&&(n="cssFloat"),r?t.setProperty(n,a):t[n]=a}}var L2=Cn({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Fp(t,e){if(e){if(L2[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(Pe(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(Pe(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(Pe(61))}if(e.style!=null&&typeof e.style!="object")throw Error(Pe(62))}}function _p(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){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 $p=null;function lm(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var Vp=null,Co=null,So=null;function h0(t){if(t=Lu(t)){if(typeof Vp!="function")throw Error(Pe(280));var e=t.stateNode;e&&(e=cf(e),Vp(t.stateNode,t.type,e))}}function Z1(t){Co?So?So.push(t):So=[t]:Co=t}function J1(){if(Co){var t=Co,e=So;if(So=Co=null,h0(t),e)for(t=0;t<e.length;t++)h0(e[t])}}function ek(t,e){return t(e)}function tk(){}var kh=!1;function nk(t,e,n){if(kh)return t(e,n);kh=!0;try{return ek(t,e,n)}finally{kh=!1,(Co!==null||So!==null)&&(tk(),J1())}}function Zl(t,e){var n=t.stateNode;if(n===null)return null;var r=cf(n);if(r===null)return null;n=r[e];e:switch(e){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)||(t=t.type,r=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!r;break e;default:t=!1}if(t)return null;if(n&&typeof n!="function")throw Error(Pe(231,e,typeof n));return n}var Up=!1;if(Za)try{var vl={};Object.defineProperty(vl,"passive",{get:function(){Up=!0}}),window.addEventListener("test",vl,vl),window.removeEventListener("test",vl,vl)}catch{Up=!1}function A2(t,e,n,r,a,i,s,o,l){var u=Array.prototype.slice.call(arguments,3);try{e.apply(n,u)}catch(d){this.onError(d)}}var zl=!1,fd=null,hd=!1,qp=null,D2={onError:function(t){zl=!0,fd=t}};function B2(t,e,n,r,a,i,s,o,l){zl=!1,fd=null,A2.apply(D2,arguments)}function M2(t,e,n,r,a,i,s,o,l){if(B2.apply(this,arguments),zl){if(zl){var u=fd;zl=!1,fd=null}else throw Error(Pe(198));hd||(hd=!0,qp=u)}}function _s(t){var e=t,n=t;if(t.alternate)for(;e.return;)e=e.return;else{t=e;do e=t,e.flags&4098&&(n=e.return),t=e.return;while(t)}return e.tag===3?n:null}function rk(t){if(t.tag===13){var e=t.memoizedState;if(e===null&&(t=t.alternate,t!==null&&(e=t.memoizedState)),e!==null)return e.dehydrated}return null}function v0(t){if(_s(t)!==t)throw Error(Pe(188))}function O2(t){var e=t.alternate;if(!e){if(e=_s(t),e===null)throw Error(Pe(188));return e!==t?null:t}for(var n=t,r=e;;){var a=n.return;if(a===null)break;var i=a.alternate;if(i===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===i.child){for(i=a.child;i;){if(i===n)return v0(a),t;if(i===r)return v0(a),e;i=i.sibling}throw Error(Pe(188))}if(n.return!==r.return)n=a,r=i;else{for(var s=!1,o=a.child;o;){if(o===n){s=!0,n=a,r=i;break}if(o===r){s=!0,r=a,n=i;break}o=o.sibling}if(!s){for(o=i.child;o;){if(o===n){s=!0,n=i,r=a;break}if(o===r){s=!0,r=i,n=a;break}o=o.sibling}if(!s)throw Error(Pe(189))}}if(n.alternate!==r)throw Error(Pe(190))}if(n.tag!==3)throw Error(Pe(188));return n.stateNode.current===n?t:e}function ak(t){return t=O2(t),t!==null?ik(t):null}function ik(t){if(t.tag===5||t.tag===6)return t;for(t=t.child;t!==null;){var e=ik(t);if(e!==null)return e;t=t.sibling}return null}var sk=Qr.unstable_scheduleCallback,p0=Qr.unstable_cancelCallback,z2=Qr.unstable_shouldYield,F2=Qr.unstable_requestPaint,Dn=Qr.unstable_now,_2=Qr.unstable_getCurrentPriorityLevel,um=Qr.unstable_ImmediatePriority,ok=Qr.unstable_UserBlockingPriority,vd=Qr.unstable_NormalPriority,$2=Qr.unstable_LowPriority,lk=Qr.unstable_IdlePriority,sf=null,za=null;function V2(t){if(za&&typeof za.onCommitFiberRoot=="function")try{za.onCommitFiberRoot(sf,t,void 0,(t.current.flags&128)===128)}catch{}}var xa=Math.clz32?Math.clz32:H2,U2=Math.log,q2=Math.LN2;function H2(t){return t>>>=0,t===0?32:31-(U2(t)/q2|0)|0}var vc=64,pc=4194304;function Ll(t){switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function pd(t,e){var n=t.pendingLanes;if(n===0)return 0;var r=0,a=t.suspendedLanes,i=t.pingedLanes,s=n&268435455;if(s!==0){var o=s&~a;o!==0?r=Ll(o):(i&=s,i!==0&&(r=Ll(i)))}else s=n&~a,s!==0?r=Ll(s):i!==0&&(r=Ll(i));if(r===0)return 0;if(e!==0&&e!==r&&!(e&a)&&(a=r&-r,i=e&-e,a>=i||a===16&&(i&4194240)!==0))return e;if(r&4&&(r|=n&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=r;0<e;)n=31-xa(e),a=1<<n,r|=t[n],e&=~a;return r}function W2(t,e){switch(t){case 1:case 2:case 4:return e+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function K2(t,e){for(var n=t.suspendedLanes,r=t.pingedLanes,a=t.expirationTimes,i=t.pendingLanes;0<i;){var s=31-xa(i),o=1<<s,l=a[s];l===-1?(!(o&n)||o&r)&&(a[s]=W2(o,e)):l<=e&&(t.expiredLanes|=o),i&=~o}}function Hp(t){return t=t.pendingLanes&-1073741825,t!==0?t:t&1073741824?1073741824:0}function uk(){var t=vc;return vc<<=1,!(vc&4194240)&&(vc=64),t}function Eh(t){for(var e=[],n=0;31>n;n++)e.push(t);return e}function Ru(t,e,n){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-xa(e),t[e]=n}function G2(t,e){var n=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var r=t.eventTimes;for(t=t.expirationTimes;0<n;){var a=31-xa(n),i=1<<a;e[a]=0,r[a]=-1,t[a]=-1,n&=~i}}function cm(t,e){var n=t.entangledLanes|=e;for(t=t.entanglements;n;){var r=31-xa(n),a=1<<r;a&e|t[r]&e&&(t[r]|=e),n&=~a}}var tn=0;function ck(t){return t&=-t,1<t?4<t?t&268435455?16:536870912:4:1}var dk,dm,fk,hk,vk,Wp=!1,gc=[],Ri=null,Ii=null,Li=null,Jl=new Map,eu=new Map,wi=[],Y2="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function g0(t,e){switch(t){case"focusin":case"focusout":Ri=null;break;case"dragenter":case"dragleave":Ii=null;break;case"mouseover":case"mouseout":Li=null;break;case"pointerover":case"pointerout":Jl.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":eu.delete(e.pointerId)}}function pl(t,e,n,r,a,i){return t===null||t.nativeEvent!==i?(t={blockedOn:e,domEventName:n,eventSystemFlags:r,nativeEvent:i,targetContainers:[a]},e!==null&&(e=Lu(e),e!==null&&dm(e)),t):(t.eventSystemFlags|=r,e=t.targetContainers,a!==null&&e.indexOf(a)===-1&&e.push(a),t)}function X2(t,e,n,r,a){switch(e){case"focusin":return Ri=pl(Ri,t,e,n,r,a),!0;case"dragenter":return Ii=pl(Ii,t,e,n,r,a),!0;case"mouseover":return Li=pl(Li,t,e,n,r,a),!0;case"pointerover":var i=a.pointerId;return Jl.set(i,pl(Jl.get(i)||null,t,e,n,r,a)),!0;case"gotpointercapture":return i=a.pointerId,eu.set(i,pl(eu.get(i)||null,t,e,n,r,a)),!0}return!1}function pk(t){var e=xs(t.target);if(e!==null){var n=_s(e);if(n!==null){if(e=n.tag,e===13){if(e=rk(n),e!==null){t.blockedOn=e,vk(t.priority,function(){fk(n)});return}}else if(e===3&&n.stateNode.current.memoizedState.isDehydrated){t.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}t.blockedOn=null}function Uc(t){if(t.blockedOn!==null)return!1;for(var e=t.targetContainers;0<e.length;){var n=Kp(t.domEventName,t.eventSystemFlags,e[0],t.nativeEvent);if(n===null){n=t.nativeEvent;var r=new n.constructor(n.type,n);$p=r,n.target.dispatchEvent(r),$p=null}else return e=Lu(n),e!==null&&dm(e),t.blockedOn=n,!1;e.shift()}return!0}function m0(t,e,n){Uc(t)&&n.delete(e)}function Q2(){Wp=!1,Ri!==null&&Uc(Ri)&&(Ri=null),Ii!==null&&Uc(Ii)&&(Ii=null),Li!==null&&Uc(Li)&&(Li=null),Jl.forEach(m0),eu.forEach(m0)}function gl(t,e){t.blockedOn===e&&(t.blockedOn=null,Wp||(Wp=!0,Qr.unstable_scheduleCallback(Qr.unstable_NormalPriority,Q2)))}function tu(t){function e(a){return gl(a,t)}if(0<gc.length){gl(gc[0],t);for(var n=1;n<gc.length;n++){var r=gc[n];r.blockedOn===t&&(r.blockedOn=null)}}for(Ri!==null&&gl(Ri,t),Ii!==null&&gl(Ii,t),Li!==null&&gl(Li,t),Jl.forEach(e),eu.forEach(e),n=0;n<wi.length;n++)r=wi[n],r.blockedOn===t&&(r.blockedOn=null);for(;0<wi.length&&(n=wi[0],n.blockedOn===null);)pk(n),n.blockedOn===null&&wi.shift()}var jo=ai.ReactCurrentBatchConfig,gd=!0;function Z2(t,e,n,r){var a=tn,i=jo.transition;jo.transition=null;try{tn=1,fm(t,e,n,r)}finally{tn=a,jo.transition=i}}function J2(t,e,n,r){var a=tn,i=jo.transition;jo.transition=null;try{tn=4,fm(t,e,n,r)}finally{tn=a,jo.transition=i}}function fm(t,e,n,r){if(gd){var a=Kp(t,e,n,r);if(a===null)Ah(t,e,r,md,n),g0(t,r);else if(X2(a,t,e,n,r))r.stopPropagation();else if(g0(t,r),e&4&&-1<Y2.indexOf(t)){for(;a!==null;){var i=Lu(a);if(i!==null&&dk(i),i=Kp(t,e,n,r),i===null&&Ah(t,e,r,md,n),i===a)break;a=i}a!==null&&r.stopPropagation()}else Ah(t,e,r,null,n)}}var md=null;function Kp(t,e,n,r){if(md=null,t=lm(r),t=xs(t),t!==null)if(e=_s(t),e===null)t=null;else if(n=e.tag,n===13){if(t=rk(e),t!==null)return t;t=null}else if(n===3){if(e.stateNode.current.memoizedState.isDehydrated)return e.tag===3?e.stateNode.containerInfo:null;t=null}else e!==t&&(t=null);return md=t,null}function gk(t){switch(t){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(_2()){case um:return 1;case ok:return 4;case vd:case $2:return 16;case lk:return 536870912;default:return 16}default:return 16}}var Ci=null,hm=null,qc=null;function mk(){if(qc)return qc;var t,e=hm,n=e.length,r,a="value"in Ci?Ci.value:Ci.textContent,i=a.length;for(t=0;t<n&&e[t]===a[t];t++);var s=n-t;for(r=1;r<=s&&e[n-r]===a[i-r];r++);return qc=a.slice(t,1<r?1-r:void 0)}function Hc(t){var e=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&e===13&&(t=13)):t=e,t===10&&(t=13),32<=t||t===13?t:0}function mc(){return!0}function y0(){return!1}function Jr(t){function e(n,r,a,i,s){this._reactName=n,this._targetInst=a,this.type=r,this.nativeEvent=i,this.target=s,this.currentTarget=null;for(var o in t)t.hasOwnProperty(o)&&(n=t[o],this[o]=n?n(i):i[o]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?mc:y0,this.isPropagationStopped=y0,this}return Cn(e.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=mc)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=mc)},persist:function(){},isPersistent:mc}),e}var Xo={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},vm=Jr(Xo),Iu=Cn({},Xo,{view:0,detail:0}),eT=Jr(Iu),Ch,Sh,ml,of=Cn({},Iu,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:pm,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==ml&&(ml&&t.type==="mousemove"?(Ch=t.screenX-ml.screenX,Sh=t.screenY-ml.screenY):Sh=Ch=0,ml=t),Ch)},movementY:function(t){return"movementY"in t?t.movementY:Sh}}),b0=Jr(of),tT=Cn({},of,{dataTransfer:0}),nT=Jr(tT),rT=Cn({},Iu,{relatedTarget:0}),jh=Jr(rT),aT=Cn({},Xo,{animationName:0,elapsedTime:0,pseudoElement:0}),iT=Jr(aT),sT=Cn({},Xo,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),oT=Jr(sT),lT=Cn({},Xo,{data:0}),x0=Jr(lT),uT={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},cT={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"},dT={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function fT(t){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(t):(t=dT[t])?!!e[t]:!1}function pm(){return fT}var hT=Cn({},Iu,{key:function(t){if(t.key){var e=uT[t.key]||t.key;if(e!=="Unidentified")return e}return t.type==="keypress"?(t=Hc(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?cT[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:pm,charCode:function(t){return t.type==="keypress"?Hc(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?Hc(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),vT=Jr(hT),pT=Cn({},of,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),w0=Jr(pT),gT=Cn({},Iu,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:pm}),mT=Jr(gT),yT=Cn({},Xo,{propertyName:0,elapsedTime:0,pseudoElement:0}),bT=Jr(yT),xT=Cn({},of,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),wT=Jr(xT),kT=[9,13,27,32],gm=Za&&"CompositionEvent"in window,Fl=null;Za&&"documentMode"in document&&(Fl=document.documentMode);var ET=Za&&"TextEvent"in window&&!Fl,yk=Za&&(!gm||Fl&&8<Fl&&11>=Fl),k0=" ",E0=!1;function bk(t,e){switch(t){case"keyup":return kT.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function xk(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var oo=!1;function CT(t,e){switch(t){case"compositionend":return xk(e);case"keypress":return e.which!==32?null:(E0=!0,k0);case"textInput":return t=e.data,t===k0&&E0?null:t;default:return null}}function ST(t,e){if(oo)return t==="compositionend"||!gm&&bk(t,e)?(t=mk(),qc=hm=Ci=null,oo=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1<e.char.length)return e.char;if(e.which)return String.fromCharCode(e.which)}return null;case"compositionend":return yk&&e.locale!=="ko"?null:e.data;default:return null}}var jT={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 C0(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e==="input"?!!jT[t.type]:e==="textarea"}function wk(t,e,n,r){Z1(r),e=yd(e,"onChange"),0<e.length&&(n=new vm("onChange","change",null,n,r),t.push({event:n,listeners:e}))}var _l=null,nu=null;function TT(t){Lk(t,0)}function lf(t){var e=co(t);if(H1(e))return t}function NT(t,e){if(t==="change")return e}var kk=!1;if(Za){var Th;if(Za){var Nh="oninput"in document;if(!Nh){var S0=document.createElement("div");S0.setAttribute("oninput","return;"),Nh=typeof S0.oninput=="function"}Th=Nh}else Th=!1;kk=Th&&(!document.documentMode||9<document.documentMode)}function j0(){_l&&(_l.detachEvent("onpropertychange",Ek),nu=_l=null)}function Ek(t){if(t.propertyName==="value"&&lf(nu)){var e=[];wk(e,nu,t,lm(t)),nk(TT,e)}}function PT(t,e,n){t==="focusin"?(j0(),_l=e,nu=n,_l.attachEvent("onpropertychange",Ek)):t==="focusout"&&j0()}function RT(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return lf(nu)}function IT(t,e){if(t==="click")return lf(e)}function LT(t,e){if(t==="input"||t==="change")return lf(e)}function AT(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var Ea=typeof Object.is=="function"?Object.is:AT;function ru(t,e){if(Ea(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;var n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var a=n[r];if(!Pp.call(e,a)||!Ea(t[a],e[a]))return!1}return!0}function T0(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function N0(t,e){var n=T0(t);t=0;for(var r;n;){if(n.nodeType===3){if(r=t+n.textContent.length,t<=e&&r>=e)return{node:n,offset:e-t};t=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=T0(n)}}function Ck(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?Ck(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function Sk(){for(var t=window,e=dd();e instanceof t.HTMLIFrameElement;){try{var n=typeof e.contentWindow.location.href=="string"}catch{n=!1}if(n)t=e.contentWindow;else break;e=dd(t.document)}return e}function mm(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function DT(t){var e=Sk(),n=t.focusedElem,r=t.selectionRange;if(e!==n&&n&&n.ownerDocument&&Ck(n.ownerDocument.documentElement,n)){if(r!==null&&mm(n)){if(e=r.start,t=r.end,t===void 0&&(t=e),"selectionStart"in n)n.selectionStart=e,n.selectionEnd=Math.min(t,n.value.length);else if(t=(e=n.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var a=n.textContent.length,i=Math.min(r.start,a);r=r.end===void 0?i:Math.min(r.end,a),!t.extend&&i>r&&(a=r,r=i,i=a),a=N0(n,i);var s=N0(n,r);a&&s&&(t.rangeCount!==1||t.anchorNode!==a.node||t.anchorOffset!==a.offset||t.focusNode!==s.node||t.focusOffset!==s.offset)&&(e=e.createRange(),e.setStart(a.node,a.offset),t.removeAllRanges(),i>r?(t.addRange(e),t.extend(s.node,s.offset)):(e.setEnd(s.node,s.offset),t.addRange(e)))}}for(e=[],t=n;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<e.length;n++)t=e[n],t.element.scrollLeft=t.left,t.element.scrollTop=t.top}}var BT=Za&&"documentMode"in document&&11>=document.documentMode,lo=null,Gp=null,$l=null,Yp=!1;function P0(t,e,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Yp||lo==null||lo!==dd(r)||(r=lo,"selectionStart"in r&&mm(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}),$l&&ru($l,r)||($l=r,r=yd(Gp,"onSelect"),0<r.length&&(e=new vm("onSelect","select",null,e,n),t.push({event:e,listeners:r}),e.target=lo)))}function yc(t,e){var n={};return n[t.toLowerCase()]=e.toLowerCase(),n["Webkit"+t]="webkit"+e,n["Moz"+t]="moz"+e,n}var uo={animationend:yc("Animation","AnimationEnd"),animationiteration:yc("Animation","AnimationIteration"),animationstart:yc("Animation","AnimationStart"),transitionend:yc("Transition","TransitionEnd")},Ph={},jk={};Za&&(jk=document.createElement("div").style,"AnimationEvent"in window||(delete uo.animationend.animation,delete uo.animationiteration.animation,delete uo.animationstart.animation),"TransitionEvent"in window||delete uo.transitionend.transition);function uf(t){if(Ph[t])return Ph[t];if(!uo[t])return t;var e=uo[t],n;for(n in e)if(e.hasOwnProperty(n)&&n in jk)return Ph[t]=e[n];return t}var Tk=uf("animationend"),Nk=uf("animationiteration"),Pk=uf("animationstart"),Rk=uf("transitionend"),Ik=new Map,R0="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function Qi(t,e){Ik.set(t,e),Fs(e,[t])}for(var Rh=0;Rh<R0.length;Rh++){var Ih=R0[Rh],MT=Ih.toLowerCase(),OT=Ih[0].toUpperCase()+Ih.slice(1);Qi(MT,"on"+OT)}Qi(Tk,"onAnimationEnd");Qi(Nk,"onAnimationIteration");Qi(Pk,"onAnimationStart");Qi("dblclick","onDoubleClick");Qi("focusin","onFocus");Qi("focusout","onBlur");Qi(Rk,"onTransitionEnd");Do("onMouseEnter",["mouseout","mouseover"]);Do("onMouseLeave",["mouseout","mouseover"]);Do("onPointerEnter",["pointerout","pointerover"]);Do("onPointerLeave",["pointerout","pointerover"]);Fs("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Fs("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Fs("onBeforeInput",["compositionend","keypress","textInput","paste"]);Fs("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Fs("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Fs("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Al="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(" "),zT=new Set("cancel close invalid load scroll toggle".split(" ").concat(Al));function I0(t,e,n){var r=t.type||"unknown-event";t.currentTarget=n,M2(r,e,void 0,t),t.currentTarget=null}function Lk(t,e){e=(e&4)!==0;for(var n=0;n<t.length;n++){var r=t[n],a=r.event;r=r.listeners;e:{var i=void 0;if(e)for(var s=r.length-1;0<=s;s--){var o=r[s],l=o.instance,u=o.currentTarget;if(o=o.listener,l!==i&&a.isPropagationStopped())break e;I0(a,o,u),i=l}else for(s=0;s<r.length;s++){if(o=r[s],l=o.instance,u=o.currentTarget,o=o.listener,l!==i&&a.isPropagationStopped())break e;I0(a,o,u),i=l}}}if(hd)throw t=qp,hd=!1,qp=null,t}function hn(t,e){var n=e[eg];n===void 0&&(n=e[eg]=new Set);var r=t+"__bubble";n.has(r)||(Ak(e,t,2,!1),n.add(r))}function Lh(t,e,n){var r=0;e&&(r|=4),Ak(n,t,r,e)}var bc="_reactListening"+Math.random().toString(36).slice(2);function au(t){if(!t[bc]){t[bc]=!0,_1.forEach(function(n){n!=="selectionchange"&&(zT.has(n)||Lh(n,!1,t),Lh(n,!0,t))});var e=t.nodeType===9?t:t.ownerDocument;e===null||e[bc]||(e[bc]=!0,Lh("selectionchange",!1,e))}}function Ak(t,e,n,r){switch(gk(e)){case 1:var a=Z2;break;case 4:a=J2;break;default:a=fm}n=a.bind(null,e,n,t),a=void 0,!Up||e!=="touchstart"&&e!=="touchmove"&&e!=="wheel"||(a=!0),r?a!==void 0?t.addEventListener(e,n,{capture:!0,passive:a}):t.addEventListener(e,n,!0):a!==void 0?t.addEventListener(e,n,{passive:a}):t.addEventListener(e,n,!1)}function Ah(t,e,n,r,a){var i=r;if(!(e&1)&&!(e&2)&&r!==null)e:for(;;){if(r===null)return;var s=r.tag;if(s===3||s===4){var o=r.stateNode.containerInfo;if(o===a||o.nodeType===8&&o.parentNode===a)break;if(s===4)for(s=r.return;s!==null;){var l=s.tag;if((l===3||l===4)&&(l=s.stateNode.containerInfo,l===a||l.nodeType===8&&l.parentNode===a))return;s=s.return}for(;o!==null;){if(s=xs(o),s===null)return;if(l=s.tag,l===5||l===6){r=i=s;continue e}o=o.parentNode}}r=r.return}nk(function(){var u=i,d=lm(n),f=[];e:{var h=Ik.get(t);if(h!==void 0){var v=vm,p=t;switch(t){case"keypress":if(Hc(n)===0)break e;case"keydown":case"keyup":v=vT;break;case"focusin":p="focus",v=jh;break;case"focusout":p="blur",v=jh;break;case"beforeblur":case"afterblur":v=jh;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":v=b0;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":v=nT;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":v=mT;break;case Tk:case Nk:case Pk:v=iT;break;case Rk:v=bT;break;case"scroll":v=eT;break;case"wheel":v=wT;break;case"copy":case"cut":case"paste":v=oT;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":v=w0}var y=(e&4)!==0,b=!y&&t==="scroll",m=y?h!==null?h+"Capture":null:h;y=[];for(var g=u,w;g!==null;){w=g;var x=w.stateNode;if(w.tag===5&&x!==null&&(w=x,m!==null&&(x=Zl(g,m),x!=null&&y.push(iu(g,x,w)))),b)break;g=g.return}0<y.length&&(h=new v(h,p,null,n,d),f.push({event:h,listeners:y}))}}if(!(e&7)){e:{if(h=t==="mouseover"||t==="pointerover",v=t==="mouseout"||t==="pointerout",h&&n!==$p&&(p=n.relatedTarget||n.fromElement)&&(xs(p)||p[Ja]))break e;if((v||h)&&(h=d.window===d?d:(h=d.ownerDocument)?h.defaultView||h.parentWindow:window,v?(p=n.relatedTarget||n.toElement,v=u,p=p?xs(p):null,p!==null&&(b=_s(p),p!==b||p.tag!==5&&p.tag!==6)&&(p=null)):(v=null,p=u),v!==p)){if(y=b0,x="onMouseLeave",m="onMouseEnter",g="mouse",(t==="pointerout"||t==="pointerover")&&(y=w0,x="onPointerLeave",m="onPointerEnter",g="pointer"),b=v==null?h:co(v),w=p==null?h:co(p),h=new y(x,g+"leave",v,n,d),h.target=b,h.relatedTarget=w,x=null,xs(d)===u&&(y=new y(m,g+"enter",p,n,d),y.target=w,y.relatedTarget=b,x=y),b=x,v&&p)t:{for(y=v,m=p,g=0,w=y;w;w=Gs(w))g++;for(w=0,x=m;x;x=Gs(x))w++;for(;0<g-w;)y=Gs(y),g--;for(;0<w-g;)m=Gs(m),w--;for(;g--;){if(y===m||m!==null&&y===m.alternate)break t;y=Gs(y),m=Gs(m)}y=null}else y=null;v!==null&&L0(f,h,v,y,!1),p!==null&&b!==null&&L0(f,b,p,y,!0)}}e:{if(h=u?co(u):window,v=h.nodeName&&h.nodeName.toLowerCase(),v==="select"||v==="input"&&h.type==="file")var E=NT;else if(C0(h))if(kk)E=LT;else{E=RT;var S=PT}else(v=h.nodeName)&&v.toLowerCase()==="input"&&(h.type==="checkbox"||h.type==="radio")&&(E=IT);if(E&&(E=E(t,u))){wk(f,E,n,d);break e}S&&S(t,h,u),t==="focusout"&&(S=h._wrapperState)&&S.controlled&&h.type==="number"&&Mp(h,"number",h.value)}switch(S=u?co(u):window,t){case"focusin":(C0(S)||S.contentEditable==="true")&&(lo=S,Gp=u,$l=null);break;case"focusout":$l=Gp=lo=null;break;case"mousedown":Yp=!0;break;case"contextmenu":case"mouseup":case"dragend":Yp=!1,P0(f,n,d);break;case"selectionchange":if(BT)break;case"keydown":case"keyup":P0(f,n,d)}var C;if(gm)e:{switch(t){case"compositionstart":var T="onCompositionStart";break e;case"compositionend":T="onCompositionEnd";break e;case"compositionupdate":T="onCompositionUpdate";break e}T=void 0}else oo?bk(t,n)&&(T="onCompositionEnd"):t==="keydown"&&n.keyCode===229&&(T="onCompositionStart");T&&(yk&&n.locale!=="ko"&&(oo||T!=="onCompositionStart"?T==="onCompositionEnd"&&oo&&(C=mk()):(Ci=d,hm="value"in Ci?Ci.value:Ci.textContent,oo=!0)),S=yd(u,T),0<S.length&&(T=new x0(T,t,null,n,d),f.push({event:T,listeners:S}),C?T.data=C:(C=xk(n),C!==null&&(T.data=C)))),(C=ET?CT(t,n):ST(t,n))&&(u=yd(u,"onBeforeInput"),0<u.length&&(d=new x0("onBeforeInput","beforeinput",null,n,d),f.push({event:d,listeners:u}),d.data=C))}Lk(f,e)})}function iu(t,e,n){return{instance:t,listener:e,currentTarget:n}}function yd(t,e){for(var n=e+"Capture",r=[];t!==null;){var a=t,i=a.stateNode;a.tag===5&&i!==null&&(a=i,i=Zl(t,n),i!=null&&r.unshift(iu(t,i,a)),i=Zl(t,e),i!=null&&r.push(iu(t,i,a))),t=t.return}return r}function Gs(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5);return t||null}function L0(t,e,n,r,a){for(var i=e._reactName,s=[];n!==null&&n!==r;){var o=n,l=o.alternate,u=o.stateNode;if(l!==null&&l===r)break;o.tag===5&&u!==null&&(o=u,a?(l=Zl(n,i),l!=null&&s.unshift(iu(n,l,o))):a||(l=Zl(n,i),l!=null&&s.push(iu(n,l,o)))),n=n.return}s.length!==0&&t.push({event:e,listeners:s})}var FT=/\r\n?/g,_T=/\u0000|\uFFFD/g;function A0(t){return(typeof t=="string"?t:""+t).replace(FT,`
|
|
44
|
+
`).replace(_T,"")}function xc(t,e,n){if(e=A0(e),A0(t)!==e&&n)throw Error(Pe(425))}function bd(){}var Xp=null,Qp=null;function Zp(t,e){return t==="textarea"||t==="noscript"||typeof e.children=="string"||typeof e.children=="number"||typeof e.dangerouslySetInnerHTML=="object"&&e.dangerouslySetInnerHTML!==null&&e.dangerouslySetInnerHTML.__html!=null}var Jp=typeof setTimeout=="function"?setTimeout:void 0,$T=typeof clearTimeout=="function"?clearTimeout:void 0,D0=typeof Promise=="function"?Promise:void 0,VT=typeof queueMicrotask=="function"?queueMicrotask:typeof D0<"u"?function(t){return D0.resolve(null).then(t).catch(UT)}:Jp;function UT(t){setTimeout(function(){throw t})}function Dh(t,e){var n=e,r=0;do{var a=n.nextSibling;if(t.removeChild(n),a&&a.nodeType===8)if(n=a.data,n==="/$"){if(r===0){t.removeChild(a),tu(e);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=a}while(n);tu(e)}function Ai(t){for(;t!=null;t=t.nextSibling){var e=t.nodeType;if(e===1||e===3)break;if(e===8){if(e=t.data,e==="$"||e==="$!"||e==="$?")break;if(e==="/$")return null}}return t}function B0(t){t=t.previousSibling;for(var e=0;t;){if(t.nodeType===8){var n=t.data;if(n==="$"||n==="$!"||n==="$?"){if(e===0)return t;e--}else n==="/$"&&e++}t=t.previousSibling}return null}var Qo=Math.random().toString(36).slice(2),Ma="__reactFiber$"+Qo,su="__reactProps$"+Qo,Ja="__reactContainer$"+Qo,eg="__reactEvents$"+Qo,qT="__reactListeners$"+Qo,HT="__reactHandles$"+Qo;function xs(t){var e=t[Ma];if(e)return e;for(var n=t.parentNode;n;){if(e=n[Ja]||n[Ma]){if(n=e.alternate,e.child!==null||n!==null&&n.child!==null)for(t=B0(t);t!==null;){if(n=t[Ma])return n;t=B0(t)}return e}t=n,n=t.parentNode}return null}function Lu(t){return t=t[Ma]||t[Ja],!t||t.tag!==5&&t.tag!==6&&t.tag!==13&&t.tag!==3?null:t}function co(t){if(t.tag===5||t.tag===6)return t.stateNode;throw Error(Pe(33))}function cf(t){return t[su]||null}var tg=[],fo=-1;function Zi(t){return{current:t}}function vn(t){0>fo||(t.current=tg[fo],tg[fo]=null,fo--)}function un(t,e){fo++,tg[fo]=t.current,t.current=e}var Vi={},mr=Zi(Vi),$r=Zi(!1),Ps=Vi;function Bo(t,e){var n=t.type.contextTypes;if(!n)return Vi;var r=t.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===e)return r.__reactInternalMemoizedMaskedChildContext;var a={},i;for(i in n)a[i]=e[i];return r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=a),a}function Vr(t){return t=t.childContextTypes,t!=null}function xd(){vn($r),vn(mr)}function M0(t,e,n){if(mr.current!==Vi)throw Error(Pe(168));un(mr,e),un($r,n)}function Dk(t,e,n){var r=t.stateNode;if(e=e.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var a in r)if(!(a in e))throw Error(Pe(108,P2(t)||"Unknown",a));return Cn({},n,r)}function wd(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||Vi,Ps=mr.current,un(mr,t),un($r,$r.current),!0}function O0(t,e,n){var r=t.stateNode;if(!r)throw Error(Pe(169));n?(t=Dk(t,e,Ps),r.__reactInternalMemoizedMergedChildContext=t,vn($r),vn(mr),un(mr,t)):vn($r),un($r,n)}var Ka=null,df=!1,Bh=!1;function Bk(t){Ka===null?Ka=[t]:Ka.push(t)}function WT(t){df=!0,Bk(t)}function Ji(){if(!Bh&&Ka!==null){Bh=!0;var t=0,e=tn;try{var n=Ka;for(tn=1;t<n.length;t++){var r=n[t];do r=r(!0);while(r!==null)}Ka=null,df=!1}catch(a){throw Ka!==null&&(Ka=Ka.slice(t+1)),sk(um,Ji),a}finally{tn=e,Bh=!1}}return null}var ho=[],vo=0,kd=null,Ed=0,ia=[],sa=0,Rs=null,Ga=1,Ya="";function vs(t,e){ho[vo++]=Ed,ho[vo++]=kd,kd=t,Ed=e}function Mk(t,e,n){ia[sa++]=Ga,ia[sa++]=Ya,ia[sa++]=Rs,Rs=t;var r=Ga;t=Ya;var a=32-xa(r)-1;r&=~(1<<a),n+=1;var i=32-xa(e)+a;if(30<i){var s=a-a%5;i=(r&(1<<s)-1).toString(32),r>>=s,a-=s,Ga=1<<32-xa(e)+a|n<<a|r,Ya=i+t}else Ga=1<<i|n<<a|r,Ya=t}function ym(t){t.return!==null&&(vs(t,1),Mk(t,1,0))}function bm(t){for(;t===kd;)kd=ho[--vo],ho[vo]=null,Ed=ho[--vo],ho[vo]=null;for(;t===Rs;)Rs=ia[--sa],ia[sa]=null,Ya=ia[--sa],ia[sa]=null,Ga=ia[--sa],ia[sa]=null}var Yr=null,Gr=null,mn=!1,ba=null;function Ok(t,e){var n=la(5,null,null,0);n.elementType="DELETED",n.stateNode=e,n.return=t,e=t.deletions,e===null?(t.deletions=[n],t.flags|=16):e.push(n)}function z0(t,e){switch(t.tag){case 5:var n=t.type;return e=e.nodeType!==1||n.toLowerCase()!==e.nodeName.toLowerCase()?null:e,e!==null?(t.stateNode=e,Yr=t,Gr=Ai(e.firstChild),!0):!1;case 6:return e=t.pendingProps===""||e.nodeType!==3?null:e,e!==null?(t.stateNode=e,Yr=t,Gr=null,!0):!1;case 13:return e=e.nodeType!==8?null:e,e!==null?(n=Rs!==null?{id:Ga,overflow:Ya}:null,t.memoizedState={dehydrated:e,treeContext:n,retryLane:1073741824},n=la(18,null,null,0),n.stateNode=e,n.return=t,t.child=n,Yr=t,Gr=null,!0):!1;default:return!1}}function ng(t){return(t.mode&1)!==0&&(t.flags&128)===0}function rg(t){if(mn){var e=Gr;if(e){var n=e;if(!z0(t,e)){if(ng(t))throw Error(Pe(418));e=Ai(n.nextSibling);var r=Yr;e&&z0(t,e)?Ok(r,n):(t.flags=t.flags&-4097|2,mn=!1,Yr=t)}}else{if(ng(t))throw Error(Pe(418));t.flags=t.flags&-4097|2,mn=!1,Yr=t}}}function F0(t){for(t=t.return;t!==null&&t.tag!==5&&t.tag!==3&&t.tag!==13;)t=t.return;Yr=t}function wc(t){if(t!==Yr)return!1;if(!mn)return F0(t),mn=!0,!1;var e;if((e=t.tag!==3)&&!(e=t.tag!==5)&&(e=t.type,e=e!=="head"&&e!=="body"&&!Zp(t.type,t.memoizedProps)),e&&(e=Gr)){if(ng(t))throw zk(),Error(Pe(418));for(;e;)Ok(t,e),e=Ai(e.nextSibling)}if(F0(t),t.tag===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(Pe(317));e:{for(t=t.nextSibling,e=0;t;){if(t.nodeType===8){var n=t.data;if(n==="/$"){if(e===0){Gr=Ai(t.nextSibling);break e}e--}else n!=="$"&&n!=="$!"&&n!=="$?"||e++}t=t.nextSibling}Gr=null}}else Gr=Yr?Ai(t.stateNode.nextSibling):null;return!0}function zk(){for(var t=Gr;t;)t=Ai(t.nextSibling)}function Mo(){Gr=Yr=null,mn=!1}function xm(t){ba===null?ba=[t]:ba.push(t)}var KT=ai.ReactCurrentBatchConfig;function yl(t,e,n){if(t=n.ref,t!==null&&typeof t!="function"&&typeof t!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(Pe(309));var r=n.stateNode}if(!r)throw Error(Pe(147,t));var a=r,i=""+t;return e!==null&&e.ref!==null&&typeof e.ref=="function"&&e.ref._stringRef===i?e.ref:(e=function(s){var o=a.refs;s===null?delete o[i]:o[i]=s},e._stringRef=i,e)}if(typeof t!="string")throw Error(Pe(284));if(!n._owner)throw Error(Pe(290,t))}return t}function kc(t,e){throw t=Object.prototype.toString.call(e),Error(Pe(31,t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t))}function _0(t){var e=t._init;return e(t._payload)}function Fk(t){function e(m,g){if(t){var w=m.deletions;w===null?(m.deletions=[g],m.flags|=16):w.push(g)}}function n(m,g){if(!t)return null;for(;g!==null;)e(m,g),g=g.sibling;return null}function r(m,g){for(m=new Map;g!==null;)g.key!==null?m.set(g.key,g):m.set(g.index,g),g=g.sibling;return m}function a(m,g){return m=Oi(m,g),m.index=0,m.sibling=null,m}function i(m,g,w){return m.index=w,t?(w=m.alternate,w!==null?(w=w.index,w<g?(m.flags|=2,g):w):(m.flags|=2,g)):(m.flags|=1048576,g)}function s(m){return t&&m.alternate===null&&(m.flags|=2),m}function o(m,g,w,x){return g===null||g.tag!==6?(g=Vh(w,m.mode,x),g.return=m,g):(g=a(g,w),g.return=m,g)}function l(m,g,w,x){var E=w.type;return E===so?d(m,g,w.props.children,x,w.key):g!==null&&(g.elementType===E||typeof E=="object"&&E!==null&&E.$$typeof===yi&&_0(E)===g.type)?(x=a(g,w.props),x.ref=yl(m,g,w),x.return=m,x):(x=Zc(w.type,w.key,w.props,null,m.mode,x),x.ref=yl(m,g,w),x.return=m,x)}function u(m,g,w,x){return g===null||g.tag!==4||g.stateNode.containerInfo!==w.containerInfo||g.stateNode.implementation!==w.implementation?(g=Uh(w,m.mode,x),g.return=m,g):(g=a(g,w.children||[]),g.return=m,g)}function d(m,g,w,x,E){return g===null||g.tag!==7?(g=js(w,m.mode,x,E),g.return=m,g):(g=a(g,w),g.return=m,g)}function f(m,g,w){if(typeof g=="string"&&g!==""||typeof g=="number")return g=Vh(""+g,m.mode,w),g.return=m,g;if(typeof g=="object"&&g!==null){switch(g.$$typeof){case dc:return w=Zc(g.type,g.key,g.props,null,m.mode,w),w.ref=yl(m,null,g),w.return=m,w;case io:return g=Uh(g,m.mode,w),g.return=m,g;case yi:var x=g._init;return f(m,x(g._payload),w)}if(Il(g)||hl(g))return g=js(g,m.mode,w,null),g.return=m,g;kc(m,g)}return null}function h(m,g,w,x){var E=g!==null?g.key:null;if(typeof w=="string"&&w!==""||typeof w=="number")return E!==null?null:o(m,g,""+w,x);if(typeof w=="object"&&w!==null){switch(w.$$typeof){case dc:return w.key===E?l(m,g,w,x):null;case io:return w.key===E?u(m,g,w,x):null;case yi:return E=w._init,h(m,g,E(w._payload),x)}if(Il(w)||hl(w))return E!==null?null:d(m,g,w,x,null);kc(m,w)}return null}function v(m,g,w,x,E){if(typeof x=="string"&&x!==""||typeof x=="number")return m=m.get(w)||null,o(g,m,""+x,E);if(typeof x=="object"&&x!==null){switch(x.$$typeof){case dc:return m=m.get(x.key===null?w:x.key)||null,l(g,m,x,E);case io:return m=m.get(x.key===null?w:x.key)||null,u(g,m,x,E);case yi:var S=x._init;return v(m,g,w,S(x._payload),E)}if(Il(x)||hl(x))return m=m.get(w)||null,d(g,m,x,E,null);kc(g,x)}return null}function p(m,g,w,x){for(var E=null,S=null,C=g,T=g=0,N=null;C!==null&&T<w.length;T++){C.index>T?(N=C,C=null):N=C.sibling;var P=h(m,C,w[T],x);if(P===null){C===null&&(C=N);break}t&&C&&P.alternate===null&&e(m,C),g=i(P,g,T),S===null?E=P:S.sibling=P,S=P,C=N}if(T===w.length)return n(m,C),mn&&vs(m,T),E;if(C===null){for(;T<w.length;T++)C=f(m,w[T],x),C!==null&&(g=i(C,g,T),S===null?E=C:S.sibling=C,S=C);return mn&&vs(m,T),E}for(C=r(m,C);T<w.length;T++)N=v(C,m,T,w[T],x),N!==null&&(t&&N.alternate!==null&&C.delete(N.key===null?T:N.key),g=i(N,g,T),S===null?E=N:S.sibling=N,S=N);return t&&C.forEach(function(R){return e(m,R)}),mn&&vs(m,T),E}function y(m,g,w,x){var E=hl(w);if(typeof E!="function")throw Error(Pe(150));if(w=E.call(w),w==null)throw Error(Pe(151));for(var S=E=null,C=g,T=g=0,N=null,P=w.next();C!==null&&!P.done;T++,P=w.next()){C.index>T?(N=C,C=null):N=C.sibling;var R=h(m,C,P.value,x);if(R===null){C===null&&(C=N);break}t&&C&&R.alternate===null&&e(m,C),g=i(R,g,T),S===null?E=R:S.sibling=R,S=R,C=N}if(P.done)return n(m,C),mn&&vs(m,T),E;if(C===null){for(;!P.done;T++,P=w.next())P=f(m,P.value,x),P!==null&&(g=i(P,g,T),S===null?E=P:S.sibling=P,S=P);return mn&&vs(m,T),E}for(C=r(m,C);!P.done;T++,P=w.next())P=v(C,m,T,P.value,x),P!==null&&(t&&P.alternate!==null&&C.delete(P.key===null?T:P.key),g=i(P,g,T),S===null?E=P:S.sibling=P,S=P);return t&&C.forEach(function(I){return e(m,I)}),mn&&vs(m,T),E}function b(m,g,w,x){if(typeof w=="object"&&w!==null&&w.type===so&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case dc:e:{for(var E=w.key,S=g;S!==null;){if(S.key===E){if(E=w.type,E===so){if(S.tag===7){n(m,S.sibling),g=a(S,w.props.children),g.return=m,m=g;break e}}else if(S.elementType===E||typeof E=="object"&&E!==null&&E.$$typeof===yi&&_0(E)===S.type){n(m,S.sibling),g=a(S,w.props),g.ref=yl(m,S,w),g.return=m,m=g;break e}n(m,S);break}else e(m,S);S=S.sibling}w.type===so?(g=js(w.props.children,m.mode,x,w.key),g.return=m,m=g):(x=Zc(w.type,w.key,w.props,null,m.mode,x),x.ref=yl(m,g,w),x.return=m,m=x)}return s(m);case io:e:{for(S=w.key;g!==null;){if(g.key===S)if(g.tag===4&&g.stateNode.containerInfo===w.containerInfo&&g.stateNode.implementation===w.implementation){n(m,g.sibling),g=a(g,w.children||[]),g.return=m,m=g;break e}else{n(m,g);break}else e(m,g);g=g.sibling}g=Uh(w,m.mode,x),g.return=m,m=g}return s(m);case yi:return S=w._init,b(m,g,S(w._payload),x)}if(Il(w))return p(m,g,w,x);if(hl(w))return y(m,g,w,x);kc(m,w)}return typeof w=="string"&&w!==""||typeof w=="number"?(w=""+w,g!==null&&g.tag===6?(n(m,g.sibling),g=a(g,w),g.return=m,m=g):(n(m,g),g=Vh(w,m.mode,x),g.return=m,m=g),s(m)):n(m,g)}return b}var Oo=Fk(!0),_k=Fk(!1),Cd=Zi(null),Sd=null,po=null,wm=null;function km(){wm=po=Sd=null}function Em(t){var e=Cd.current;vn(Cd),t._currentValue=e}function ag(t,e,n){for(;t!==null;){var r=t.alternate;if((t.childLanes&e)!==e?(t.childLanes|=e,r!==null&&(r.childLanes|=e)):r!==null&&(r.childLanes&e)!==e&&(r.childLanes|=e),t===n)break;t=t.return}}function To(t,e){Sd=t,wm=po=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&e&&(Fr=!0),t.firstContext=null)}function da(t){var e=t._currentValue;if(wm!==t)if(t={context:t,memoizedValue:e,next:null},po===null){if(Sd===null)throw Error(Pe(308));po=t,Sd.dependencies={lanes:0,firstContext:t}}else po=po.next=t;return e}var ws=null;function Cm(t){ws===null?ws=[t]:ws.push(t)}function $k(t,e,n,r){var a=e.interleaved;return a===null?(n.next=n,Cm(e)):(n.next=a.next,a.next=n),e.interleaved=n,ei(t,r)}function ei(t,e){t.lanes|=e;var n=t.alternate;for(n!==null&&(n.lanes|=e),n=t,t=t.return;t!==null;)t.childLanes|=e,n=t.alternate,n!==null&&(n.childLanes|=e),n=t,t=t.return;return n.tag===3?n.stateNode:null}var bi=!1;function Sm(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Vk(t,e){t=t.updateQueue,e.updateQueue===t&&(e.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function Qa(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function Di(t,e,n){var r=t.updateQueue;if(r===null)return null;if(r=r.shared,Ht&2){var a=r.pending;return a===null?e.next=e:(e.next=a.next,a.next=e),r.pending=e,ei(t,n)}return a=r.interleaved,a===null?(e.next=e,Cm(r)):(e.next=a.next,a.next=e),r.interleaved=e,ei(t,n)}function Wc(t,e,n){if(e=e.updateQueue,e!==null&&(e=e.shared,(n&4194240)!==0)){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,cm(t,n)}}function $0(t,e){var n=t.updateQueue,r=t.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var a=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var s={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?a=i=s:i=i.next=s,n=n.next}while(n!==null);i===null?a=i=e:i=i.next=e}else a=i=e;n={baseState:r.baseState,firstBaseUpdate:a,lastBaseUpdate:i,shared:r.shared,effects:r.effects},t.updateQueue=n;return}t=n.lastBaseUpdate,t===null?n.firstBaseUpdate=e:t.next=e,n.lastBaseUpdate=e}function jd(t,e,n,r){var a=t.updateQueue;bi=!1;var i=a.firstBaseUpdate,s=a.lastBaseUpdate,o=a.shared.pending;if(o!==null){a.shared.pending=null;var l=o,u=l.next;l.next=null,s===null?i=u:s.next=u,s=l;var d=t.alternate;d!==null&&(d=d.updateQueue,o=d.lastBaseUpdate,o!==s&&(o===null?d.firstBaseUpdate=u:o.next=u,d.lastBaseUpdate=l))}if(i!==null){var f=a.baseState;s=0,d=u=l=null,o=i;do{var h=o.lane,v=o.eventTime;if((r&h)===h){d!==null&&(d=d.next={eventTime:v,lane:0,tag:o.tag,payload:o.payload,callback:o.callback,next:null});e:{var p=t,y=o;switch(h=e,v=n,y.tag){case 1:if(p=y.payload,typeof p=="function"){f=p.call(v,f,h);break e}f=p;break e;case 3:p.flags=p.flags&-65537|128;case 0:if(p=y.payload,h=typeof p=="function"?p.call(v,f,h):p,h==null)break e;f=Cn({},f,h);break e;case 2:bi=!0}}o.callback!==null&&o.lane!==0&&(t.flags|=64,h=a.effects,h===null?a.effects=[o]:h.push(o))}else v={eventTime:v,lane:h,tag:o.tag,payload:o.payload,callback:o.callback,next:null},d===null?(u=d=v,l=f):d=d.next=v,s|=h;if(o=o.next,o===null){if(o=a.shared.pending,o===null)break;h=o,o=h.next,h.next=null,a.lastBaseUpdate=h,a.shared.pending=null}}while(!0);if(d===null&&(l=f),a.baseState=l,a.firstBaseUpdate=u,a.lastBaseUpdate=d,e=a.shared.interleaved,e!==null){a=e;do s|=a.lane,a=a.next;while(a!==e)}else i===null&&(a.shared.lanes=0);Ls|=s,t.lanes=s,t.memoizedState=f}}function V0(t,e,n){if(t=e.effects,e.effects=null,t!==null)for(e=0;e<t.length;e++){var r=t[e],a=r.callback;if(a!==null){if(r.callback=null,r=n,typeof a!="function")throw Error(Pe(191,a));a.call(r)}}}var Au={},Fa=Zi(Au),ou=Zi(Au),lu=Zi(Au);function ks(t){if(t===Au)throw Error(Pe(174));return t}function jm(t,e){switch(un(lu,e),un(ou,t),un(Fa,Au),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:zp(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=zp(e,t)}vn(Fa),un(Fa,e)}function zo(){vn(Fa),vn(ou),vn(lu)}function Uk(t){ks(lu.current);var e=ks(Fa.current),n=zp(e,t.type);e!==n&&(un(ou,t),un(Fa,n))}function Tm(t){ou.current===t&&(vn(Fa),vn(ou))}var xn=Zi(0);function Td(t){for(var e=t;e!==null;){if(e.tag===13){var n=e.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return e}else if(e.tag===19&&e.memoizedProps.revealOrder!==void 0){if(e.flags&128)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var Mh=[];function Nm(){for(var t=0;t<Mh.length;t++)Mh[t]._workInProgressVersionPrimary=null;Mh.length=0}var Kc=ai.ReactCurrentDispatcher,Oh=ai.ReactCurrentBatchConfig,Is=0,wn=null,Hn=null,Qn=null,Nd=!1,Vl=!1,uu=0,GT=0;function vr(){throw Error(Pe(321))}function Pm(t,e){if(e===null)return!1;for(var n=0;n<e.length&&n<t.length;n++)if(!Ea(t[n],e[n]))return!1;return!0}function Rm(t,e,n,r,a,i){if(Is=i,wn=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,Kc.current=t===null||t.memoizedState===null?ZT:JT,t=n(r,a),Vl){i=0;do{if(Vl=!1,uu=0,25<=i)throw Error(Pe(301));i+=1,Qn=Hn=null,e.updateQueue=null,Kc.current=eN,t=n(r,a)}while(Vl)}if(Kc.current=Pd,e=Hn!==null&&Hn.next!==null,Is=0,Qn=Hn=wn=null,Nd=!1,e)throw Error(Pe(300));return t}function Im(){var t=uu!==0;return uu=0,t}function Da(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Qn===null?wn.memoizedState=Qn=t:Qn=Qn.next=t,Qn}function fa(){if(Hn===null){var t=wn.alternate;t=t!==null?t.memoizedState:null}else t=Hn.next;var e=Qn===null?wn.memoizedState:Qn.next;if(e!==null)Qn=e,Hn=t;else{if(t===null)throw Error(Pe(310));Hn=t,t={memoizedState:Hn.memoizedState,baseState:Hn.baseState,baseQueue:Hn.baseQueue,queue:Hn.queue,next:null},Qn===null?wn.memoizedState=Qn=t:Qn=Qn.next=t}return Qn}function cu(t,e){return typeof e=="function"?e(t):e}function zh(t){var e=fa(),n=e.queue;if(n===null)throw Error(Pe(311));n.lastRenderedReducer=t;var r=Hn,a=r.baseQueue,i=n.pending;if(i!==null){if(a!==null){var s=a.next;a.next=i.next,i.next=s}r.baseQueue=a=i,n.pending=null}if(a!==null){i=a.next,r=r.baseState;var o=s=null,l=null,u=i;do{var d=u.lane;if((Is&d)===d)l!==null&&(l=l.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),r=u.hasEagerState?u.eagerState:t(r,u.action);else{var f={lane:d,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};l===null?(o=l=f,s=r):l=l.next=f,wn.lanes|=d,Ls|=d}u=u.next}while(u!==null&&u!==i);l===null?s=r:l.next=o,Ea(r,e.memoizedState)||(Fr=!0),e.memoizedState=r,e.baseState=s,e.baseQueue=l,n.lastRenderedState=r}if(t=n.interleaved,t!==null){a=t;do i=a.lane,wn.lanes|=i,Ls|=i,a=a.next;while(a!==t)}else a===null&&(n.lanes=0);return[e.memoizedState,n.dispatch]}function Fh(t){var e=fa(),n=e.queue;if(n===null)throw Error(Pe(311));n.lastRenderedReducer=t;var r=n.dispatch,a=n.pending,i=e.memoizedState;if(a!==null){n.pending=null;var s=a=a.next;do i=t(i,s.action),s=s.next;while(s!==a);Ea(i,e.memoizedState)||(Fr=!0),e.memoizedState=i,e.baseQueue===null&&(e.baseState=i),n.lastRenderedState=i}return[i,r]}function qk(){}function Hk(t,e){var n=wn,r=fa(),a=e(),i=!Ea(r.memoizedState,a);if(i&&(r.memoizedState=a,Fr=!0),r=r.queue,Lm(Gk.bind(null,n,r,t),[t]),r.getSnapshot!==e||i||Qn!==null&&Qn.memoizedState.tag&1){if(n.flags|=2048,du(9,Kk.bind(null,n,r,a,e),void 0,null),Zn===null)throw Error(Pe(349));Is&30||Wk(n,e,a)}return a}function Wk(t,e,n){t.flags|=16384,t={getSnapshot:e,value:n},e=wn.updateQueue,e===null?(e={lastEffect:null,stores:null},wn.updateQueue=e,e.stores=[t]):(n=e.stores,n===null?e.stores=[t]:n.push(t))}function Kk(t,e,n,r){e.value=n,e.getSnapshot=r,Yk(e)&&Xk(t)}function Gk(t,e,n){return n(function(){Yk(e)&&Xk(t)})}function Yk(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!Ea(t,n)}catch{return!0}}function Xk(t){var e=ei(t,1);e!==null&&wa(e,t,1,-1)}function U0(t){var e=Da();return typeof t=="function"&&(t=t()),e.memoizedState=e.baseState=t,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:cu,lastRenderedState:t},e.queue=t,t=t.dispatch=QT.bind(null,wn,t),[e.memoizedState,t]}function du(t,e,n,r){return t={tag:t,create:e,destroy:n,deps:r,next:null},e=wn.updateQueue,e===null?(e={lastEffect:null,stores:null},wn.updateQueue=e,e.lastEffect=t.next=t):(n=e.lastEffect,n===null?e.lastEffect=t.next=t:(r=n.next,n.next=t,t.next=r,e.lastEffect=t)),t}function Qk(){return fa().memoizedState}function Gc(t,e,n,r){var a=Da();wn.flags|=t,a.memoizedState=du(1|e,n,void 0,r===void 0?null:r)}function ff(t,e,n,r){var a=fa();r=r===void 0?null:r;var i=void 0;if(Hn!==null){var s=Hn.memoizedState;if(i=s.destroy,r!==null&&Pm(r,s.deps)){a.memoizedState=du(e,n,i,r);return}}wn.flags|=t,a.memoizedState=du(1|e,n,i,r)}function q0(t,e){return Gc(8390656,8,t,e)}function Lm(t,e){return ff(2048,8,t,e)}function Zk(t,e){return ff(4,2,t,e)}function Jk(t,e){return ff(4,4,t,e)}function eE(t,e){if(typeof e=="function")return t=t(),e(t),function(){e(null)};if(e!=null)return t=t(),e.current=t,function(){e.current=null}}function tE(t,e,n){return n=n!=null?n.concat([t]):null,ff(4,4,eE.bind(null,e,t),n)}function Am(){}function nE(t,e){var n=fa();e=e===void 0?null:e;var r=n.memoizedState;return r!==null&&e!==null&&Pm(e,r[1])?r[0]:(n.memoizedState=[t,e],t)}function rE(t,e){var n=fa();e=e===void 0?null:e;var r=n.memoizedState;return r!==null&&e!==null&&Pm(e,r[1])?r[0]:(t=t(),n.memoizedState=[t,e],t)}function aE(t,e,n){return Is&21?(Ea(n,e)||(n=uk(),wn.lanes|=n,Ls|=n,t.baseState=!0),e):(t.baseState&&(t.baseState=!1,Fr=!0),t.memoizedState=n)}function YT(t,e){var n=tn;tn=n!==0&&4>n?n:4,t(!0);var r=Oh.transition;Oh.transition={};try{t(!1),e()}finally{tn=n,Oh.transition=r}}function iE(){return fa().memoizedState}function XT(t,e,n){var r=Mi(t);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},sE(t))oE(e,n);else if(n=$k(t,e,n,r),n!==null){var a=Sr();wa(n,t,r,a),lE(n,e,r)}}function QT(t,e,n){var r=Mi(t),a={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(sE(t))oE(e,a);else{var i=t.alternate;if(t.lanes===0&&(i===null||i.lanes===0)&&(i=e.lastRenderedReducer,i!==null))try{var s=e.lastRenderedState,o=i(s,n);if(a.hasEagerState=!0,a.eagerState=o,Ea(o,s)){var l=e.interleaved;l===null?(a.next=a,Cm(e)):(a.next=l.next,l.next=a),e.interleaved=a;return}}catch{}finally{}n=$k(t,e,a,r),n!==null&&(a=Sr(),wa(n,t,r,a),lE(n,e,r))}}function sE(t){var e=t.alternate;return t===wn||e!==null&&e===wn}function oE(t,e){Vl=Nd=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function lE(t,e,n){if(n&4194240){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,cm(t,n)}}var Pd={readContext:da,useCallback:vr,useContext:vr,useEffect:vr,useImperativeHandle:vr,useInsertionEffect:vr,useLayoutEffect:vr,useMemo:vr,useReducer:vr,useRef:vr,useState:vr,useDebugValue:vr,useDeferredValue:vr,useTransition:vr,useMutableSource:vr,useSyncExternalStore:vr,useId:vr,unstable_isNewReconciler:!1},ZT={readContext:da,useCallback:function(t,e){return Da().memoizedState=[t,e===void 0?null:e],t},useContext:da,useEffect:q0,useImperativeHandle:function(t,e,n){return n=n!=null?n.concat([t]):null,Gc(4194308,4,eE.bind(null,e,t),n)},useLayoutEffect:function(t,e){return Gc(4194308,4,t,e)},useInsertionEffect:function(t,e){return Gc(4,2,t,e)},useMemo:function(t,e){var n=Da();return e=e===void 0?null:e,t=t(),n.memoizedState=[t,e],t},useReducer:function(t,e,n){var r=Da();return e=n!==void 0?n(e):e,r.memoizedState=r.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},r.queue=t,t=t.dispatch=XT.bind(null,wn,t),[r.memoizedState,t]},useRef:function(t){var e=Da();return t={current:t},e.memoizedState=t},useState:U0,useDebugValue:Am,useDeferredValue:function(t){return Da().memoizedState=t},useTransition:function(){var t=U0(!1),e=t[0];return t=YT.bind(null,t[1]),Da().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,n){var r=wn,a=Da();if(mn){if(n===void 0)throw Error(Pe(407));n=n()}else{if(n=e(),Zn===null)throw Error(Pe(349));Is&30||Wk(r,e,n)}a.memoizedState=n;var i={value:n,getSnapshot:e};return a.queue=i,q0(Gk.bind(null,r,i,t),[t]),r.flags|=2048,du(9,Kk.bind(null,r,i,n,e),void 0,null),n},useId:function(){var t=Da(),e=Zn.identifierPrefix;if(mn){var n=Ya,r=Ga;n=(r&~(1<<32-xa(r)-1)).toString(32)+n,e=":"+e+"R"+n,n=uu++,0<n&&(e+="H"+n.toString(32)),e+=":"}else n=GT++,e=":"+e+"r"+n.toString(32)+":";return t.memoizedState=e},unstable_isNewReconciler:!1},JT={readContext:da,useCallback:nE,useContext:da,useEffect:Lm,useImperativeHandle:tE,useInsertionEffect:Zk,useLayoutEffect:Jk,useMemo:rE,useReducer:zh,useRef:Qk,useState:function(){return zh(cu)},useDebugValue:Am,useDeferredValue:function(t){var e=fa();return aE(e,Hn.memoizedState,t)},useTransition:function(){var t=zh(cu)[0],e=fa().memoizedState;return[t,e]},useMutableSource:qk,useSyncExternalStore:Hk,useId:iE,unstable_isNewReconciler:!1},eN={readContext:da,useCallback:nE,useContext:da,useEffect:Lm,useImperativeHandle:tE,useInsertionEffect:Zk,useLayoutEffect:Jk,useMemo:rE,useReducer:Fh,useRef:Qk,useState:function(){return Fh(cu)},useDebugValue:Am,useDeferredValue:function(t){var e=fa();return Hn===null?e.memoizedState=t:aE(e,Hn.memoizedState,t)},useTransition:function(){var t=Fh(cu)[0],e=fa().memoizedState;return[t,e]},useMutableSource:qk,useSyncExternalStore:Hk,useId:iE,unstable_isNewReconciler:!1};function ga(t,e){if(t&&t.defaultProps){e=Cn({},e),t=t.defaultProps;for(var n in t)e[n]===void 0&&(e[n]=t[n]);return e}return e}function ig(t,e,n,r){e=t.memoizedState,n=n(r,e),n=n==null?e:Cn({},e,n),t.memoizedState=n,t.lanes===0&&(t.updateQueue.baseState=n)}var hf={isMounted:function(t){return(t=t._reactInternals)?_s(t)===t:!1},enqueueSetState:function(t,e,n){t=t._reactInternals;var r=Sr(),a=Mi(t),i=Qa(r,a);i.payload=e,n!=null&&(i.callback=n),e=Di(t,i,a),e!==null&&(wa(e,t,a,r),Wc(e,t,a))},enqueueReplaceState:function(t,e,n){t=t._reactInternals;var r=Sr(),a=Mi(t),i=Qa(r,a);i.tag=1,i.payload=e,n!=null&&(i.callback=n),e=Di(t,i,a),e!==null&&(wa(e,t,a,r),Wc(e,t,a))},enqueueForceUpdate:function(t,e){t=t._reactInternals;var n=Sr(),r=Mi(t),a=Qa(n,r);a.tag=2,e!=null&&(a.callback=e),e=Di(t,a,r),e!==null&&(wa(e,t,r,n),Wc(e,t,r))}};function H0(t,e,n,r,a,i,s){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(r,i,s):e.prototype&&e.prototype.isPureReactComponent?!ru(n,r)||!ru(a,i):!0}function uE(t,e,n){var r=!1,a=Vi,i=e.contextType;return typeof i=="object"&&i!==null?i=da(i):(a=Vr(e)?Ps:mr.current,r=e.contextTypes,i=(r=r!=null)?Bo(t,a):Vi),e=new e(n,i),t.memoizedState=e.state!==null&&e.state!==void 0?e.state:null,e.updater=hf,t.stateNode=e,e._reactInternals=t,r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=a,t.__reactInternalMemoizedMaskedChildContext=i),e}function W0(t,e,n,r){t=e.state,typeof e.componentWillReceiveProps=="function"&&e.componentWillReceiveProps(n,r),typeof e.UNSAFE_componentWillReceiveProps=="function"&&e.UNSAFE_componentWillReceiveProps(n,r),e.state!==t&&hf.enqueueReplaceState(e,e.state,null)}function sg(t,e,n,r){var a=t.stateNode;a.props=n,a.state=t.memoizedState,a.refs={},Sm(t);var i=e.contextType;typeof i=="object"&&i!==null?a.context=da(i):(i=Vr(e)?Ps:mr.current,a.context=Bo(t,i)),a.state=t.memoizedState,i=e.getDerivedStateFromProps,typeof i=="function"&&(ig(t,e,i,n),a.state=t.memoizedState),typeof e.getDerivedStateFromProps=="function"||typeof a.getSnapshotBeforeUpdate=="function"||typeof a.UNSAFE_componentWillMount!="function"&&typeof a.componentWillMount!="function"||(e=a.state,typeof a.componentWillMount=="function"&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount=="function"&&a.UNSAFE_componentWillMount(),e!==a.state&&hf.enqueueReplaceState(a,a.state,null),jd(t,n,a,r),a.state=t.memoizedState),typeof a.componentDidMount=="function"&&(t.flags|=4194308)}function Fo(t,e){try{var n="",r=e;do n+=N2(r),r=r.return;while(r);var a=n}catch(i){a=`
|
|
45
|
+
Error generating stack: `+i.message+`
|
|
46
|
+
`+i.stack}return{value:t,source:e,stack:a,digest:null}}function _h(t,e,n){return{value:t,source:null,stack:n??null,digest:e??null}}function og(t,e){try{console.error(e.value)}catch(n){setTimeout(function(){throw n})}}var tN=typeof WeakMap=="function"?WeakMap:Map;function cE(t,e,n){n=Qa(-1,n),n.tag=3,n.payload={element:null};var r=e.value;return n.callback=function(){Id||(Id=!0,mg=r),og(t,e)},n}function dE(t,e,n){n=Qa(-1,n),n.tag=3;var r=t.type.getDerivedStateFromError;if(typeof r=="function"){var a=e.value;n.payload=function(){return r(a)},n.callback=function(){og(t,e)}}var i=t.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){og(t,e),typeof r!="function"&&(Bi===null?Bi=new Set([this]):Bi.add(this));var s=e.stack;this.componentDidCatch(e.value,{componentStack:s!==null?s:""})}),n}function K0(t,e,n){var r=t.pingCache;if(r===null){r=t.pingCache=new tN;var a=new Set;r.set(e,a)}else a=r.get(e),a===void 0&&(a=new Set,r.set(e,a));a.has(n)||(a.add(n),t=pN.bind(null,t,e,n),e.then(t,t))}function G0(t){do{var e;if((e=t.tag===13)&&(e=t.memoizedState,e=e!==null?e.dehydrated!==null:!0),e)return t;t=t.return}while(t!==null);return null}function Y0(t,e,n,r,a){return t.mode&1?(t.flags|=65536,t.lanes=a,t):(t===e?t.flags|=65536:(t.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(e=Qa(-1,1),e.tag=2,Di(n,e,1))),n.lanes|=1),t)}var nN=ai.ReactCurrentOwner,Fr=!1;function Er(t,e,n,r){e.child=t===null?_k(e,null,n,r):Oo(e,t.child,n,r)}function X0(t,e,n,r,a){n=n.render;var i=e.ref;return To(e,a),r=Rm(t,e,n,r,i,a),n=Im(),t!==null&&!Fr?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~a,ti(t,e,a)):(mn&&n&&ym(e),e.flags|=1,Er(t,e,r,a),e.child)}function Q0(t,e,n,r,a){if(t===null){var i=n.type;return typeof i=="function"&&!$m(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(e.tag=15,e.type=i,fE(t,e,i,r,a)):(t=Zc(n.type,null,r,e,e.mode,a),t.ref=e.ref,t.return=e,e.child=t)}if(i=t.child,!(t.lanes&a)){var s=i.memoizedProps;if(n=n.compare,n=n!==null?n:ru,n(s,r)&&t.ref===e.ref)return ti(t,e,a)}return e.flags|=1,t=Oi(i,r),t.ref=e.ref,t.return=e,e.child=t}function fE(t,e,n,r,a){if(t!==null){var i=t.memoizedProps;if(ru(i,r)&&t.ref===e.ref)if(Fr=!1,e.pendingProps=r=i,(t.lanes&a)!==0)t.flags&131072&&(Fr=!0);else return e.lanes=t.lanes,ti(t,e,a)}return lg(t,e,n,r,a)}function hE(t,e,n){var r=e.pendingProps,a=r.children,i=t!==null?t.memoizedState:null;if(r.mode==="hidden")if(!(e.mode&1))e.memoizedState={baseLanes:0,cachePool:null,transitions:null},un(mo,Kr),Kr|=n;else{if(!(n&1073741824))return t=i!==null?i.baseLanes|n:n,e.lanes=e.childLanes=1073741824,e.memoizedState={baseLanes:t,cachePool:null,transitions:null},e.updateQueue=null,un(mo,Kr),Kr|=t,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=i!==null?i.baseLanes:n,un(mo,Kr),Kr|=r}else i!==null?(r=i.baseLanes|n,e.memoizedState=null):r=n,un(mo,Kr),Kr|=r;return Er(t,e,a,n),e.child}function vE(t,e){var n=e.ref;(t===null&&n!==null||t!==null&&t.ref!==n)&&(e.flags|=512,e.flags|=2097152)}function lg(t,e,n,r,a){var i=Vr(n)?Ps:mr.current;return i=Bo(e,i),To(e,a),n=Rm(t,e,n,r,i,a),r=Im(),t!==null&&!Fr?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~a,ti(t,e,a)):(mn&&r&&ym(e),e.flags|=1,Er(t,e,n,a),e.child)}function Z0(t,e,n,r,a){if(Vr(n)){var i=!0;wd(e)}else i=!1;if(To(e,a),e.stateNode===null)Yc(t,e),uE(e,n,r),sg(e,n,r,a),r=!0;else if(t===null){var s=e.stateNode,o=e.memoizedProps;s.props=o;var l=s.context,u=n.contextType;typeof u=="object"&&u!==null?u=da(u):(u=Vr(n)?Ps:mr.current,u=Bo(e,u));var d=n.getDerivedStateFromProps,f=typeof d=="function"||typeof s.getSnapshotBeforeUpdate=="function";f||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(o!==r||l!==u)&&W0(e,s,r,u),bi=!1;var h=e.memoizedState;s.state=h,jd(e,r,s,a),l=e.memoizedState,o!==r||h!==l||$r.current||bi?(typeof d=="function"&&(ig(e,n,d,r),l=e.memoizedState),(o=bi||H0(e,n,o,r,h,l,u))?(f||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount()),typeof s.componentDidMount=="function"&&(e.flags|=4194308)):(typeof s.componentDidMount=="function"&&(e.flags|=4194308),e.memoizedProps=r,e.memoizedState=l),s.props=r,s.state=l,s.context=u,r=o):(typeof s.componentDidMount=="function"&&(e.flags|=4194308),r=!1)}else{s=e.stateNode,Vk(t,e),o=e.memoizedProps,u=e.type===e.elementType?o:ga(e.type,o),s.props=u,f=e.pendingProps,h=s.context,l=n.contextType,typeof l=="object"&&l!==null?l=da(l):(l=Vr(n)?Ps:mr.current,l=Bo(e,l));var v=n.getDerivedStateFromProps;(d=typeof v=="function"||typeof s.getSnapshotBeforeUpdate=="function")||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(o!==f||h!==l)&&W0(e,s,r,l),bi=!1,h=e.memoizedState,s.state=h,jd(e,r,s,a);var p=e.memoizedState;o!==f||h!==p||$r.current||bi?(typeof v=="function"&&(ig(e,n,v,r),p=e.memoizedState),(u=bi||H0(e,n,u,r,h,p,l)||!1)?(d||typeof s.UNSAFE_componentWillUpdate!="function"&&typeof s.componentWillUpdate!="function"||(typeof s.componentWillUpdate=="function"&&s.componentWillUpdate(r,p,l),typeof s.UNSAFE_componentWillUpdate=="function"&&s.UNSAFE_componentWillUpdate(r,p,l)),typeof s.componentDidUpdate=="function"&&(e.flags|=4),typeof s.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof s.componentDidUpdate!="function"||o===t.memoizedProps&&h===t.memoizedState||(e.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||o===t.memoizedProps&&h===t.memoizedState||(e.flags|=1024),e.memoizedProps=r,e.memoizedState=p),s.props=r,s.state=p,s.context=l,r=u):(typeof s.componentDidUpdate!="function"||o===t.memoizedProps&&h===t.memoizedState||(e.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||o===t.memoizedProps&&h===t.memoizedState||(e.flags|=1024),r=!1)}return ug(t,e,n,r,i,a)}function ug(t,e,n,r,a,i){vE(t,e);var s=(e.flags&128)!==0;if(!r&&!s)return a&&O0(e,n,!1),ti(t,e,i);r=e.stateNode,nN.current=e;var o=s&&typeof n.getDerivedStateFromError!="function"?null:r.render();return e.flags|=1,t!==null&&s?(e.child=Oo(e,t.child,null,i),e.child=Oo(e,null,o,i)):Er(t,e,o,i),e.memoizedState=r.state,a&&O0(e,n,!0),e.child}function pE(t){var e=t.stateNode;e.pendingContext?M0(t,e.pendingContext,e.pendingContext!==e.context):e.context&&M0(t,e.context,!1),jm(t,e.containerInfo)}function J0(t,e,n,r,a){return Mo(),xm(a),e.flags|=256,Er(t,e,n,r),e.child}var cg={dehydrated:null,treeContext:null,retryLane:0};function dg(t){return{baseLanes:t,cachePool:null,transitions:null}}function gE(t,e,n){var r=e.pendingProps,a=xn.current,i=!1,s=(e.flags&128)!==0,o;if((o=s)||(o=t!==null&&t.memoizedState===null?!1:(a&2)!==0),o?(i=!0,e.flags&=-129):(t===null||t.memoizedState!==null)&&(a|=1),un(xn,a&1),t===null)return rg(e),t=e.memoizedState,t!==null&&(t=t.dehydrated,t!==null)?(e.mode&1?t.data==="$!"?e.lanes=8:e.lanes=1073741824:e.lanes=1,null):(s=r.children,t=r.fallback,i?(r=e.mode,i=e.child,s={mode:"hidden",children:s},!(r&1)&&i!==null?(i.childLanes=0,i.pendingProps=s):i=gf(s,r,0,null),t=js(t,r,n,null),i.return=e,t.return=e,i.sibling=t,e.child=i,e.child.memoizedState=dg(n),e.memoizedState=cg,t):Dm(e,s));if(a=t.memoizedState,a!==null&&(o=a.dehydrated,o!==null))return rN(t,e,s,r,o,a,n);if(i){i=r.fallback,s=e.mode,a=t.child,o=a.sibling;var l={mode:"hidden",children:r.children};return!(s&1)&&e.child!==a?(r=e.child,r.childLanes=0,r.pendingProps=l,e.deletions=null):(r=Oi(a,l),r.subtreeFlags=a.subtreeFlags&14680064),o!==null?i=Oi(o,i):(i=js(i,s,n,null),i.flags|=2),i.return=e,r.return=e,r.sibling=i,e.child=r,r=i,i=e.child,s=t.child.memoizedState,s=s===null?dg(n):{baseLanes:s.baseLanes|n,cachePool:null,transitions:s.transitions},i.memoizedState=s,i.childLanes=t.childLanes&~n,e.memoizedState=cg,r}return i=t.child,t=i.sibling,r=Oi(i,{mode:"visible",children:r.children}),!(e.mode&1)&&(r.lanes=n),r.return=e,r.sibling=null,t!==null&&(n=e.deletions,n===null?(e.deletions=[t],e.flags|=16):n.push(t)),e.child=r,e.memoizedState=null,r}function Dm(t,e){return e=gf({mode:"visible",children:e},t.mode,0,null),e.return=t,t.child=e}function Ec(t,e,n,r){return r!==null&&xm(r),Oo(e,t.child,null,n),t=Dm(e,e.pendingProps.children),t.flags|=2,e.memoizedState=null,t}function rN(t,e,n,r,a,i,s){if(n)return e.flags&256?(e.flags&=-257,r=_h(Error(Pe(422))),Ec(t,e,s,r)):e.memoizedState!==null?(e.child=t.child,e.flags|=128,null):(i=r.fallback,a=e.mode,r=gf({mode:"visible",children:r.children},a,0,null),i=js(i,a,s,null),i.flags|=2,r.return=e,i.return=e,r.sibling=i,e.child=r,e.mode&1&&Oo(e,t.child,null,s),e.child.memoizedState=dg(s),e.memoizedState=cg,i);if(!(e.mode&1))return Ec(t,e,s,null);if(a.data==="$!"){if(r=a.nextSibling&&a.nextSibling.dataset,r)var o=r.dgst;return r=o,i=Error(Pe(419)),r=_h(i,r,void 0),Ec(t,e,s,r)}if(o=(s&t.childLanes)!==0,Fr||o){if(r=Zn,r!==null){switch(s&-s){case 4:a=2;break;case 16:a=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:a=32;break;case 536870912:a=268435456;break;default:a=0}a=a&(r.suspendedLanes|s)?0:a,a!==0&&a!==i.retryLane&&(i.retryLane=a,ei(t,a),wa(r,t,a,-1))}return _m(),r=_h(Error(Pe(421))),Ec(t,e,s,r)}return a.data==="$?"?(e.flags|=128,e.child=t.child,e=gN.bind(null,t),a._reactRetry=e,null):(t=i.treeContext,Gr=Ai(a.nextSibling),Yr=e,mn=!0,ba=null,t!==null&&(ia[sa++]=Ga,ia[sa++]=Ya,ia[sa++]=Rs,Ga=t.id,Ya=t.overflow,Rs=e),e=Dm(e,r.children),e.flags|=4096,e)}function eb(t,e,n){t.lanes|=e;var r=t.alternate;r!==null&&(r.lanes|=e),ag(t.return,e,n)}function $h(t,e,n,r,a){var i=t.memoizedState;i===null?t.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:a}:(i.isBackwards=e,i.rendering=null,i.renderingStartTime=0,i.last=r,i.tail=n,i.tailMode=a)}function mE(t,e,n){var r=e.pendingProps,a=r.revealOrder,i=r.tail;if(Er(t,e,r.children,n),r=xn.current,r&2)r=r&1|2,e.flags|=128;else{if(t!==null&&t.flags&128)e:for(t=e.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&eb(t,n,e);else if(t.tag===19)eb(t,n,e);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}r&=1}if(un(xn,r),!(e.mode&1))e.memoizedState=null;else switch(a){case"forwards":for(n=e.child,a=null;n!==null;)t=n.alternate,t!==null&&Td(t)===null&&(a=n),n=n.sibling;n=a,n===null?(a=e.child,e.child=null):(a=n.sibling,n.sibling=null),$h(e,!1,a,n,i);break;case"backwards":for(n=null,a=e.child,e.child=null;a!==null;){if(t=a.alternate,t!==null&&Td(t)===null){e.child=a;break}t=a.sibling,a.sibling=n,n=a,a=t}$h(e,!0,n,null,i);break;case"together":$h(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function Yc(t,e){!(e.mode&1)&&t!==null&&(t.alternate=null,e.alternate=null,e.flags|=2)}function ti(t,e,n){if(t!==null&&(e.dependencies=t.dependencies),Ls|=e.lanes,!(n&e.childLanes))return null;if(t!==null&&e.child!==t.child)throw Error(Pe(153));if(e.child!==null){for(t=e.child,n=Oi(t,t.pendingProps),e.child=n,n.return=e;t.sibling!==null;)t=t.sibling,n=n.sibling=Oi(t,t.pendingProps),n.return=e;n.sibling=null}return e.child}function aN(t,e,n){switch(e.tag){case 3:pE(e),Mo();break;case 5:Uk(e);break;case 1:Vr(e.type)&&wd(e);break;case 4:jm(e,e.stateNode.containerInfo);break;case 10:var r=e.type._context,a=e.memoizedProps.value;un(Cd,r._currentValue),r._currentValue=a;break;case 13:if(r=e.memoizedState,r!==null)return r.dehydrated!==null?(un(xn,xn.current&1),e.flags|=128,null):n&e.child.childLanes?gE(t,e,n):(un(xn,xn.current&1),t=ti(t,e,n),t!==null?t.sibling:null);un(xn,xn.current&1);break;case 19:if(r=(n&e.childLanes)!==0,t.flags&128){if(r)return mE(t,e,n);e.flags|=128}if(a=e.memoizedState,a!==null&&(a.rendering=null,a.tail=null,a.lastEffect=null),un(xn,xn.current),r)break;return null;case 22:case 23:return e.lanes=0,hE(t,e,n)}return ti(t,e,n)}var yE,fg,bE,xE;yE=function(t,e){for(var n=e.child;n!==null;){if(n.tag===5||n.tag===6)t.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};fg=function(){};bE=function(t,e,n,r){var a=t.memoizedProps;if(a!==r){t=e.stateNode,ks(Fa.current);var i=null;switch(n){case"input":a=Dp(t,a),r=Dp(t,r),i=[];break;case"select":a=Cn({},a,{value:void 0}),r=Cn({},r,{value:void 0}),i=[];break;case"textarea":a=Op(t,a),r=Op(t,r),i=[];break;default:typeof a.onClick!="function"&&typeof r.onClick=="function"&&(t.onclick=bd)}Fp(n,r);var s;n=null;for(u in a)if(!r.hasOwnProperty(u)&&a.hasOwnProperty(u)&&a[u]!=null)if(u==="style"){var o=a[u];for(s in o)o.hasOwnProperty(s)&&(n||(n={}),n[s]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(Xl.hasOwnProperty(u)?i||(i=[]):(i=i||[]).push(u,null));for(u in r){var l=r[u];if(o=a!=null?a[u]:void 0,r.hasOwnProperty(u)&&l!==o&&(l!=null||o!=null))if(u==="style")if(o){for(s in o)!o.hasOwnProperty(s)||l&&l.hasOwnProperty(s)||(n||(n={}),n[s]="");for(s in l)l.hasOwnProperty(s)&&o[s]!==l[s]&&(n||(n={}),n[s]=l[s])}else n||(i||(i=[]),i.push(u,n)),n=l;else u==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,o=o?o.__html:void 0,l!=null&&o!==l&&(i=i||[]).push(u,l)):u==="children"?typeof l!="string"&&typeof l!="number"||(i=i||[]).push(u,""+l):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&(Xl.hasOwnProperty(u)?(l!=null&&u==="onScroll"&&hn("scroll",t),i||o===l||(i=[])):(i=i||[]).push(u,l))}n&&(i=i||[]).push("style",n);var u=i;(e.updateQueue=u)&&(e.flags|=4)}};xE=function(t,e,n,r){n!==r&&(e.flags|=4)};function bl(t,e){if(!mn)switch(t.tailMode){case"hidden":e=t.tail;for(var n=null;e!==null;)e.alternate!==null&&(n=e),e=e.sibling;n===null?t.tail=null:n.sibling=null;break;case"collapsed":n=t.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?e||t.tail===null?t.tail=null:t.tail.sibling=null:r.sibling=null}}function pr(t){var e=t.alternate!==null&&t.alternate.child===t.child,n=0,r=0;if(e)for(var a=t.child;a!==null;)n|=a.lanes|a.childLanes,r|=a.subtreeFlags&14680064,r|=a.flags&14680064,a.return=t,a=a.sibling;else for(a=t.child;a!==null;)n|=a.lanes|a.childLanes,r|=a.subtreeFlags,r|=a.flags,a.return=t,a=a.sibling;return t.subtreeFlags|=r,t.childLanes=n,e}function iN(t,e,n){var r=e.pendingProps;switch(bm(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return pr(e),null;case 1:return Vr(e.type)&&xd(),pr(e),null;case 3:return r=e.stateNode,zo(),vn($r),vn(mr),Nm(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(t===null||t.child===null)&&(wc(e)?e.flags|=4:t===null||t.memoizedState.isDehydrated&&!(e.flags&256)||(e.flags|=1024,ba!==null&&(xg(ba),ba=null))),fg(t,e),pr(e),null;case 5:Tm(e);var a=ks(lu.current);if(n=e.type,t!==null&&e.stateNode!=null)bE(t,e,n,r,a),t.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!r){if(e.stateNode===null)throw Error(Pe(166));return pr(e),null}if(t=ks(Fa.current),wc(e)){r=e.stateNode,n=e.type;var i=e.memoizedProps;switch(r[Ma]=e,r[su]=i,t=(e.mode&1)!==0,n){case"dialog":hn("cancel",r),hn("close",r);break;case"iframe":case"object":case"embed":hn("load",r);break;case"video":case"audio":for(a=0;a<Al.length;a++)hn(Al[a],r);break;case"source":hn("error",r);break;case"img":case"image":case"link":hn("error",r),hn("load",r);break;case"details":hn("toggle",r);break;case"input":u0(r,i),hn("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!i.multiple},hn("invalid",r);break;case"textarea":d0(r,i),hn("invalid",r)}Fp(n,i),a=null;for(var s in i)if(i.hasOwnProperty(s)){var o=i[s];s==="children"?typeof o=="string"?r.textContent!==o&&(i.suppressHydrationWarning!==!0&&xc(r.textContent,o,t),a=["children",o]):typeof o=="number"&&r.textContent!==""+o&&(i.suppressHydrationWarning!==!0&&xc(r.textContent,o,t),a=["children",""+o]):Xl.hasOwnProperty(s)&&o!=null&&s==="onScroll"&&hn("scroll",r)}switch(n){case"input":fc(r),c0(r,i,!0);break;case"textarea":fc(r),f0(r);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(r.onclick=bd)}r=a,e.updateQueue=r,r!==null&&(e.flags|=4)}else{s=a.nodeType===9?a:a.ownerDocument,t==="http://www.w3.org/1999/xhtml"&&(t=G1(n)),t==="http://www.w3.org/1999/xhtml"?n==="script"?(t=s.createElement("div"),t.innerHTML="<script><\/script>",t=t.removeChild(t.firstChild)):typeof r.is=="string"?t=s.createElement(n,{is:r.is}):(t=s.createElement(n),n==="select"&&(s=t,r.multiple?s.multiple=!0:r.size&&(s.size=r.size))):t=s.createElementNS(t,n),t[Ma]=e,t[su]=r,yE(t,e,!1,!1),e.stateNode=t;e:{switch(s=_p(n,r),n){case"dialog":hn("cancel",t),hn("close",t),a=r;break;case"iframe":case"object":case"embed":hn("load",t),a=r;break;case"video":case"audio":for(a=0;a<Al.length;a++)hn(Al[a],t);a=r;break;case"source":hn("error",t),a=r;break;case"img":case"image":case"link":hn("error",t),hn("load",t),a=r;break;case"details":hn("toggle",t),a=r;break;case"input":u0(t,r),a=Dp(t,r),hn("invalid",t);break;case"option":a=r;break;case"select":t._wrapperState={wasMultiple:!!r.multiple},a=Cn({},r,{value:void 0}),hn("invalid",t);break;case"textarea":d0(t,r),a=Op(t,r),hn("invalid",t);break;default:a=r}Fp(n,a),o=a;for(i in o)if(o.hasOwnProperty(i)){var l=o[i];i==="style"?Q1(t,l):i==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,l!=null&&Y1(t,l)):i==="children"?typeof l=="string"?(n!=="textarea"||l!=="")&&Ql(t,l):typeof l=="number"&&Ql(t,""+l):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(Xl.hasOwnProperty(i)?l!=null&&i==="onScroll"&&hn("scroll",t):l!=null&&am(t,i,l,s))}switch(n){case"input":fc(t),c0(t,r,!1);break;case"textarea":fc(t),f0(t);break;case"option":r.value!=null&&t.setAttribute("value",""+$i(r.value));break;case"select":t.multiple=!!r.multiple,i=r.value,i!=null?Eo(t,!!r.multiple,i,!1):r.defaultValue!=null&&Eo(t,!!r.multiple,r.defaultValue,!0);break;default:typeof a.onClick=="function"&&(t.onclick=bd)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(e.flags|=4)}e.ref!==null&&(e.flags|=512,e.flags|=2097152)}return pr(e),null;case 6:if(t&&e.stateNode!=null)xE(t,e,t.memoizedProps,r);else{if(typeof r!="string"&&e.stateNode===null)throw Error(Pe(166));if(n=ks(lu.current),ks(Fa.current),wc(e)){if(r=e.stateNode,n=e.memoizedProps,r[Ma]=e,(i=r.nodeValue!==n)&&(t=Yr,t!==null))switch(t.tag){case 3:xc(r.nodeValue,n,(t.mode&1)!==0);break;case 5:t.memoizedProps.suppressHydrationWarning!==!0&&xc(r.nodeValue,n,(t.mode&1)!==0)}i&&(e.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[Ma]=e,e.stateNode=r}return pr(e),null;case 13:if(vn(xn),r=e.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(mn&&Gr!==null&&e.mode&1&&!(e.flags&128))zk(),Mo(),e.flags|=98560,i=!1;else if(i=wc(e),r!==null&&r.dehydrated!==null){if(t===null){if(!i)throw Error(Pe(318));if(i=e.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(Pe(317));i[Ma]=e}else Mo(),!(e.flags&128)&&(e.memoizedState=null),e.flags|=4;pr(e),i=!1}else ba!==null&&(xg(ba),ba=null),i=!0;if(!i)return e.flags&65536?e:null}return e.flags&128?(e.lanes=n,e):(r=r!==null,r!==(t!==null&&t.memoizedState!==null)&&r&&(e.child.flags|=8192,e.mode&1&&(t===null||xn.current&1?Wn===0&&(Wn=3):_m())),e.updateQueue!==null&&(e.flags|=4),pr(e),null);case 4:return zo(),fg(t,e),t===null&&au(e.stateNode.containerInfo),pr(e),null;case 10:return Em(e.type._context),pr(e),null;case 17:return Vr(e.type)&&xd(),pr(e),null;case 19:if(vn(xn),i=e.memoizedState,i===null)return pr(e),null;if(r=(e.flags&128)!==0,s=i.rendering,s===null)if(r)bl(i,!1);else{if(Wn!==0||t!==null&&t.flags&128)for(t=e.child;t!==null;){if(s=Td(t),s!==null){for(e.flags|=128,bl(i,!1),r=s.updateQueue,r!==null&&(e.updateQueue=r,e.flags|=4),e.subtreeFlags=0,r=n,n=e.child;n!==null;)i=n,t=r,i.flags&=14680066,s=i.alternate,s===null?(i.childLanes=0,i.lanes=t,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=s.childLanes,i.lanes=s.lanes,i.child=s.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=s.memoizedProps,i.memoizedState=s.memoizedState,i.updateQueue=s.updateQueue,i.type=s.type,t=s.dependencies,i.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),n=n.sibling;return un(xn,xn.current&1|2),e.child}t=t.sibling}i.tail!==null&&Dn()>_o&&(e.flags|=128,r=!0,bl(i,!1),e.lanes=4194304)}else{if(!r)if(t=Td(s),t!==null){if(e.flags|=128,r=!0,n=t.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),bl(i,!0),i.tail===null&&i.tailMode==="hidden"&&!s.alternate&&!mn)return pr(e),null}else 2*Dn()-i.renderingStartTime>_o&&n!==1073741824&&(e.flags|=128,r=!0,bl(i,!1),e.lanes=4194304);i.isBackwards?(s.sibling=e.child,e.child=s):(n=i.last,n!==null?n.sibling=s:e.child=s,i.last=s)}return i.tail!==null?(e=i.tail,i.rendering=e,i.tail=e.sibling,i.renderingStartTime=Dn(),e.sibling=null,n=xn.current,un(xn,r?n&1|2:n&1),e):(pr(e),null);case 22:case 23:return Fm(),r=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==r&&(e.flags|=8192),r&&e.mode&1?Kr&1073741824&&(pr(e),e.subtreeFlags&6&&(e.flags|=8192)):pr(e),null;case 24:return null;case 25:return null}throw Error(Pe(156,e.tag))}function sN(t,e){switch(bm(e),e.tag){case 1:return Vr(e.type)&&xd(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return zo(),vn($r),vn(mr),Nm(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return Tm(e),null;case 13:if(vn(xn),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(Pe(340));Mo()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return vn(xn),null;case 4:return zo(),null;case 10:return Em(e.type._context),null;case 22:case 23:return Fm(),null;case 24:return null;default:return null}}var Cc=!1,gr=!1,oN=typeof WeakSet=="function"?WeakSet:Set,Qe=null;function go(t,e){var n=t.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Tn(t,e,r)}else n.current=null}function hg(t,e,n){try{n()}catch(r){Tn(t,e,r)}}var tb=!1;function lN(t,e){if(Xp=gd,t=Sk(),mm(t)){if("selectionStart"in t)var n={start:t.selectionStart,end:t.selectionEnd};else e:{n=(n=t.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var a=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var s=0,o=-1,l=-1,u=0,d=0,f=t,h=null;t:for(;;){for(var v;f!==n||a!==0&&f.nodeType!==3||(o=s+a),f!==i||r!==0&&f.nodeType!==3||(l=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(v=f.firstChild)!==null;)h=f,f=v;for(;;){if(f===t)break t;if(h===n&&++u===a&&(o=s),h===i&&++d===r&&(l=s),(v=f.nextSibling)!==null)break;f=h,h=f.parentNode}f=v}n=o===-1||l===-1?null:{start:o,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(Qp={focusedElem:t,selectionRange:n},gd=!1,Qe=e;Qe!==null;)if(e=Qe,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,Qe=t;else for(;Qe!==null;){e=Qe;try{var p=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(p!==null){var y=p.memoizedProps,b=p.memoizedState,m=e.stateNode,g=m.getSnapshotBeforeUpdate(e.elementType===e.type?y:ga(e.type,y),b);m.__reactInternalSnapshotBeforeUpdate=g}break;case 3:var w=e.stateNode.containerInfo;w.nodeType===1?w.textContent="":w.nodeType===9&&w.documentElement&&w.removeChild(w.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Pe(163))}}catch(x){Tn(e,e.return,x)}if(t=e.sibling,t!==null){t.return=e.return,Qe=t;break}Qe=e.return}return p=tb,tb=!1,p}function Ul(t,e,n){var r=e.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var a=r=r.next;do{if((a.tag&t)===t){var i=a.destroy;a.destroy=void 0,i!==void 0&&hg(e,n,i)}a=a.next}while(a!==r)}}function vf(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var n=e=e.next;do{if((n.tag&t)===t){var r=n.create;n.destroy=r()}n=n.next}while(n!==e)}}function vg(t){var e=t.ref;if(e!==null){var n=t.stateNode;switch(t.tag){case 5:t=n;break;default:t=n}typeof e=="function"?e(t):e.current=t}}function wE(t){var e=t.alternate;e!==null&&(t.alternate=null,wE(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[Ma],delete e[su],delete e[eg],delete e[qT],delete e[HT])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function kE(t){return t.tag===5||t.tag===3||t.tag===4}function nb(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||kE(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function pg(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.nodeType===8?n.parentNode.insertBefore(t,e):n.insertBefore(t,e):(n.nodeType===8?(e=n.parentNode,e.insertBefore(t,n)):(e=n,e.appendChild(t)),n=n._reactRootContainer,n!=null||e.onclick!==null||(e.onclick=bd));else if(r!==4&&(t=t.child,t!==null))for(pg(t,e,n),t=t.sibling;t!==null;)pg(t,e,n),t=t.sibling}function gg(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.insertBefore(t,e):n.appendChild(t);else if(r!==4&&(t=t.child,t!==null))for(gg(t,e,n),t=t.sibling;t!==null;)gg(t,e,n),t=t.sibling}var rr=null,ma=!1;function pi(t,e,n){for(n=n.child;n!==null;)EE(t,e,n),n=n.sibling}function EE(t,e,n){if(za&&typeof za.onCommitFiberUnmount=="function")try{za.onCommitFiberUnmount(sf,n)}catch{}switch(n.tag){case 5:gr||go(n,e);case 6:var r=rr,a=ma;rr=null,pi(t,e,n),rr=r,ma=a,rr!==null&&(ma?(t=rr,n=n.stateNode,t.nodeType===8?t.parentNode.removeChild(n):t.removeChild(n)):rr.removeChild(n.stateNode));break;case 18:rr!==null&&(ma?(t=rr,n=n.stateNode,t.nodeType===8?Dh(t.parentNode,n):t.nodeType===1&&Dh(t,n),tu(t)):Dh(rr,n.stateNode));break;case 4:r=rr,a=ma,rr=n.stateNode.containerInfo,ma=!0,pi(t,e,n),rr=r,ma=a;break;case 0:case 11:case 14:case 15:if(!gr&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){a=r=r.next;do{var i=a,s=i.destroy;i=i.tag,s!==void 0&&(i&2||i&4)&&hg(n,e,s),a=a.next}while(a!==r)}pi(t,e,n);break;case 1:if(!gr&&(go(n,e),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(o){Tn(n,e,o)}pi(t,e,n);break;case 21:pi(t,e,n);break;case 22:n.mode&1?(gr=(r=gr)||n.memoizedState!==null,pi(t,e,n),gr=r):pi(t,e,n);break;default:pi(t,e,n)}}function rb(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var n=t.stateNode;n===null&&(n=t.stateNode=new oN),e.forEach(function(r){var a=mN.bind(null,t,r);n.has(r)||(n.add(r),r.then(a,a))})}}function pa(t,e){var n=e.deletions;if(n!==null)for(var r=0;r<n.length;r++){var a=n[r];try{var i=t,s=e,o=s;e:for(;o!==null;){switch(o.tag){case 5:rr=o.stateNode,ma=!1;break e;case 3:rr=o.stateNode.containerInfo,ma=!0;break e;case 4:rr=o.stateNode.containerInfo,ma=!0;break e}o=o.return}if(rr===null)throw Error(Pe(160));EE(i,s,a),rr=null,ma=!1;var l=a.alternate;l!==null&&(l.return=null),a.return=null}catch(u){Tn(a,e,u)}}if(e.subtreeFlags&12854)for(e=e.child;e!==null;)CE(e,t),e=e.sibling}function CE(t,e){var n=t.alternate,r=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:if(pa(e,t),Ra(t),r&4){try{Ul(3,t,t.return),vf(3,t)}catch(y){Tn(t,t.return,y)}try{Ul(5,t,t.return)}catch(y){Tn(t,t.return,y)}}break;case 1:pa(e,t),Ra(t),r&512&&n!==null&&go(n,n.return);break;case 5:if(pa(e,t),Ra(t),r&512&&n!==null&&go(n,n.return),t.flags&32){var a=t.stateNode;try{Ql(a,"")}catch(y){Tn(t,t.return,y)}}if(r&4&&(a=t.stateNode,a!=null)){var i=t.memoizedProps,s=n!==null?n.memoizedProps:i,o=t.type,l=t.updateQueue;if(t.updateQueue=null,l!==null)try{o==="input"&&i.type==="radio"&&i.name!=null&&W1(a,i),_p(o,s);var u=_p(o,i);for(s=0;s<l.length;s+=2){var d=l[s],f=l[s+1];d==="style"?Q1(a,f):d==="dangerouslySetInnerHTML"?Y1(a,f):d==="children"?Ql(a,f):am(a,d,f,u)}switch(o){case"input":Bp(a,i);break;case"textarea":K1(a,i);break;case"select":var h=a._wrapperState.wasMultiple;a._wrapperState.wasMultiple=!!i.multiple;var v=i.value;v!=null?Eo(a,!!i.multiple,v,!1):h!==!!i.multiple&&(i.defaultValue!=null?Eo(a,!!i.multiple,i.defaultValue,!0):Eo(a,!!i.multiple,i.multiple?[]:"",!1))}a[su]=i}catch(y){Tn(t,t.return,y)}}break;case 6:if(pa(e,t),Ra(t),r&4){if(t.stateNode===null)throw Error(Pe(162));a=t.stateNode,i=t.memoizedProps;try{a.nodeValue=i}catch(y){Tn(t,t.return,y)}}break;case 3:if(pa(e,t),Ra(t),r&4&&n!==null&&n.memoizedState.isDehydrated)try{tu(e.containerInfo)}catch(y){Tn(t,t.return,y)}break;case 4:pa(e,t),Ra(t);break;case 13:pa(e,t),Ra(t),a=t.child,a.flags&8192&&(i=a.memoizedState!==null,a.stateNode.isHidden=i,!i||a.alternate!==null&&a.alternate.memoizedState!==null||(Om=Dn())),r&4&&rb(t);break;case 22:if(d=n!==null&&n.memoizedState!==null,t.mode&1?(gr=(u=gr)||d,pa(e,t),gr=u):pa(e,t),Ra(t),r&8192){if(u=t.memoizedState!==null,(t.stateNode.isHidden=u)&&!d&&t.mode&1)for(Qe=t,d=t.child;d!==null;){for(f=Qe=d;Qe!==null;){switch(h=Qe,v=h.child,h.tag){case 0:case 11:case 14:case 15:Ul(4,h,h.return);break;case 1:go(h,h.return);var p=h.stateNode;if(typeof p.componentWillUnmount=="function"){r=h,n=h.return;try{e=r,p.props=e.memoizedProps,p.state=e.memoizedState,p.componentWillUnmount()}catch(y){Tn(r,n,y)}}break;case 5:go(h,h.return);break;case 22:if(h.memoizedState!==null){ib(f);continue}}v!==null?(v.return=h,Qe=v):ib(f)}d=d.sibling}e:for(d=null,f=t;;){if(f.tag===5){if(d===null){d=f;try{a=f.stateNode,u?(i=a.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none"):(o=f.stateNode,l=f.memoizedProps.style,s=l!=null&&l.hasOwnProperty("display")?l.display:null,o.style.display=X1("display",s))}catch(y){Tn(t,t.return,y)}}}else if(f.tag===6){if(d===null)try{f.stateNode.nodeValue=u?"":f.memoizedProps}catch(y){Tn(t,t.return,y)}}else if((f.tag!==22&&f.tag!==23||f.memoizedState===null||f===t)&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===t)break e;for(;f.sibling===null;){if(f.return===null||f.return===t)break e;d===f&&(d=null),f=f.return}d===f&&(d=null),f.sibling.return=f.return,f=f.sibling}}break;case 19:pa(e,t),Ra(t),r&4&&rb(t);break;case 21:break;default:pa(e,t),Ra(t)}}function Ra(t){var e=t.flags;if(e&2){try{e:{for(var n=t.return;n!==null;){if(kE(n)){var r=n;break e}n=n.return}throw Error(Pe(160))}switch(r.tag){case 5:var a=r.stateNode;r.flags&32&&(Ql(a,""),r.flags&=-33);var i=nb(t);gg(t,i,a);break;case 3:case 4:var s=r.stateNode.containerInfo,o=nb(t);pg(t,o,s);break;default:throw Error(Pe(161))}}catch(l){Tn(t,t.return,l)}t.flags&=-3}e&4096&&(t.flags&=-4097)}function uN(t,e,n){Qe=t,SE(t)}function SE(t,e,n){for(var r=(t.mode&1)!==0;Qe!==null;){var a=Qe,i=a.child;if(a.tag===22&&r){var s=a.memoizedState!==null||Cc;if(!s){var o=a.alternate,l=o!==null&&o.memoizedState!==null||gr;o=Cc;var u=gr;if(Cc=s,(gr=l)&&!u)for(Qe=a;Qe!==null;)s=Qe,l=s.child,s.tag===22&&s.memoizedState!==null?sb(a):l!==null?(l.return=s,Qe=l):sb(a);for(;i!==null;)Qe=i,SE(i),i=i.sibling;Qe=a,Cc=o,gr=u}ab(t)}else a.subtreeFlags&8772&&i!==null?(i.return=a,Qe=i):ab(t)}}function ab(t){for(;Qe!==null;){var e=Qe;if(e.flags&8772){var n=e.alternate;try{if(e.flags&8772)switch(e.tag){case 0:case 11:case 15:gr||vf(5,e);break;case 1:var r=e.stateNode;if(e.flags&4&&!gr)if(n===null)r.componentDidMount();else{var a=e.elementType===e.type?n.memoizedProps:ga(e.type,n.memoizedProps);r.componentDidUpdate(a,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var i=e.updateQueue;i!==null&&V0(e,i,r);break;case 3:var s=e.updateQueue;if(s!==null){if(n=null,e.child!==null)switch(e.child.tag){case 5:n=e.child.stateNode;break;case 1:n=e.child.stateNode}V0(e,s,n)}break;case 5:var o=e.stateNode;if(n===null&&e.flags&4){n=o;var l=e.memoizedProps;switch(e.type){case"button":case"input":case"select":case"textarea":l.autoFocus&&n.focus();break;case"img":l.src&&(n.src=l.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(e.memoizedState===null){var u=e.alternate;if(u!==null){var d=u.memoizedState;if(d!==null){var f=d.dehydrated;f!==null&&tu(f)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(Pe(163))}gr||e.flags&512&&vg(e)}catch(h){Tn(e,e.return,h)}}if(e===t){Qe=null;break}if(n=e.sibling,n!==null){n.return=e.return,Qe=n;break}Qe=e.return}}function ib(t){for(;Qe!==null;){var e=Qe;if(e===t){Qe=null;break}var n=e.sibling;if(n!==null){n.return=e.return,Qe=n;break}Qe=e.return}}function sb(t){for(;Qe!==null;){var e=Qe;try{switch(e.tag){case 0:case 11:case 15:var n=e.return;try{vf(4,e)}catch(l){Tn(e,n,l)}break;case 1:var r=e.stateNode;if(typeof r.componentDidMount=="function"){var a=e.return;try{r.componentDidMount()}catch(l){Tn(e,a,l)}}var i=e.return;try{vg(e)}catch(l){Tn(e,i,l)}break;case 5:var s=e.return;try{vg(e)}catch(l){Tn(e,s,l)}}}catch(l){Tn(e,e.return,l)}if(e===t){Qe=null;break}var o=e.sibling;if(o!==null){o.return=e.return,Qe=o;break}Qe=e.return}}var cN=Math.ceil,Rd=ai.ReactCurrentDispatcher,Bm=ai.ReactCurrentOwner,ca=ai.ReactCurrentBatchConfig,Ht=0,Zn=null,_n=null,ir=0,Kr=0,mo=Zi(0),Wn=0,fu=null,Ls=0,pf=0,Mm=0,ql=null,Or=null,Om=0,_o=1/0,Wa=null,Id=!1,mg=null,Bi=null,Sc=!1,Si=null,Ld=0,Hl=0,yg=null,Xc=-1,Qc=0;function Sr(){return Ht&6?Dn():Xc!==-1?Xc:Xc=Dn()}function Mi(t){return t.mode&1?Ht&2&&ir!==0?ir&-ir:KT.transition!==null?(Qc===0&&(Qc=uk()),Qc):(t=tn,t!==0||(t=window.event,t=t===void 0?16:gk(t.type)),t):1}function wa(t,e,n,r){if(50<Hl)throw Hl=0,yg=null,Error(Pe(185));Ru(t,n,r),(!(Ht&2)||t!==Zn)&&(t===Zn&&(!(Ht&2)&&(pf|=n),Wn===4&&ki(t,ir)),Ur(t,r),n===1&&Ht===0&&!(e.mode&1)&&(_o=Dn()+500,df&&Ji()))}function Ur(t,e){var n=t.callbackNode;K2(t,e);var r=pd(t,t===Zn?ir:0);if(r===0)n!==null&&p0(n),t.callbackNode=null,t.callbackPriority=0;else if(e=r&-r,t.callbackPriority!==e){if(n!=null&&p0(n),e===1)t.tag===0?WT(ob.bind(null,t)):Bk(ob.bind(null,t)),VT(function(){!(Ht&6)&&Ji()}),n=null;else{switch(ck(r)){case 1:n=um;break;case 4:n=ok;break;case 16:n=vd;break;case 536870912:n=lk;break;default:n=vd}n=AE(n,jE.bind(null,t))}t.callbackPriority=e,t.callbackNode=n}}function jE(t,e){if(Xc=-1,Qc=0,Ht&6)throw Error(Pe(327));var n=t.callbackNode;if(No()&&t.callbackNode!==n)return null;var r=pd(t,t===Zn?ir:0);if(r===0)return null;if(r&30||r&t.expiredLanes||e)e=Ad(t,r);else{e=r;var a=Ht;Ht|=2;var i=NE();(Zn!==t||ir!==e)&&(Wa=null,_o=Dn()+500,Ss(t,e));do try{hN();break}catch(o){TE(t,o)}while(!0);km(),Rd.current=i,Ht=a,_n!==null?e=0:(Zn=null,ir=0,e=Wn)}if(e!==0){if(e===2&&(a=Hp(t),a!==0&&(r=a,e=bg(t,a))),e===1)throw n=fu,Ss(t,0),ki(t,r),Ur(t,Dn()),n;if(e===6)ki(t,r);else{if(a=t.current.alternate,!(r&30)&&!dN(a)&&(e=Ad(t,r),e===2&&(i=Hp(t),i!==0&&(r=i,e=bg(t,i))),e===1))throw n=fu,Ss(t,0),ki(t,r),Ur(t,Dn()),n;switch(t.finishedWork=a,t.finishedLanes=r,e){case 0:case 1:throw Error(Pe(345));case 2:ps(t,Or,Wa);break;case 3:if(ki(t,r),(r&130023424)===r&&(e=Om+500-Dn(),10<e)){if(pd(t,0)!==0)break;if(a=t.suspendedLanes,(a&r)!==r){Sr(),t.pingedLanes|=t.suspendedLanes&a;break}t.timeoutHandle=Jp(ps.bind(null,t,Or,Wa),e);break}ps(t,Or,Wa);break;case 4:if(ki(t,r),(r&4194240)===r)break;for(e=t.eventTimes,a=-1;0<r;){var s=31-xa(r);i=1<<s,s=e[s],s>a&&(a=s),r&=~i}if(r=a,r=Dn()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*cN(r/1960))-r,10<r){t.timeoutHandle=Jp(ps.bind(null,t,Or,Wa),r);break}ps(t,Or,Wa);break;case 5:ps(t,Or,Wa);break;default:throw Error(Pe(329))}}}return Ur(t,Dn()),t.callbackNode===n?jE.bind(null,t):null}function bg(t,e){var n=ql;return t.current.memoizedState.isDehydrated&&(Ss(t,e).flags|=256),t=Ad(t,e),t!==2&&(e=Or,Or=n,e!==null&&xg(e)),t}function xg(t){Or===null?Or=t:Or.push.apply(Or,t)}function dN(t){for(var e=t;;){if(e.flags&16384){var n=e.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var a=n[r],i=a.getSnapshot;a=a.value;try{if(!Ea(i(),a))return!1}catch{return!1}}}if(n=e.child,e.subtreeFlags&16384&&n!==null)n.return=e,e=n;else{if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return!0;e=e.return}e.sibling.return=e.return,e=e.sibling}}return!0}function ki(t,e){for(e&=~Mm,e&=~pf,t.suspendedLanes|=e,t.pingedLanes&=~e,t=t.expirationTimes;0<e;){var n=31-xa(e),r=1<<n;t[n]=-1,e&=~r}}function ob(t){if(Ht&6)throw Error(Pe(327));No();var e=pd(t,0);if(!(e&1))return Ur(t,Dn()),null;var n=Ad(t,e);if(t.tag!==0&&n===2){var r=Hp(t);r!==0&&(e=r,n=bg(t,r))}if(n===1)throw n=fu,Ss(t,0),ki(t,e),Ur(t,Dn()),n;if(n===6)throw Error(Pe(345));return t.finishedWork=t.current.alternate,t.finishedLanes=e,ps(t,Or,Wa),Ur(t,Dn()),null}function zm(t,e){var n=Ht;Ht|=1;try{return t(e)}finally{Ht=n,Ht===0&&(_o=Dn()+500,df&&Ji())}}function As(t){Si!==null&&Si.tag===0&&!(Ht&6)&&No();var e=Ht;Ht|=1;var n=ca.transition,r=tn;try{if(ca.transition=null,tn=1,t)return t()}finally{tn=r,ca.transition=n,Ht=e,!(Ht&6)&&Ji()}}function Fm(){Kr=mo.current,vn(mo)}function Ss(t,e){t.finishedWork=null,t.finishedLanes=0;var n=t.timeoutHandle;if(n!==-1&&(t.timeoutHandle=-1,$T(n)),_n!==null)for(n=_n.return;n!==null;){var r=n;switch(bm(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&xd();break;case 3:zo(),vn($r),vn(mr),Nm();break;case 5:Tm(r);break;case 4:zo();break;case 13:vn(xn);break;case 19:vn(xn);break;case 10:Em(r.type._context);break;case 22:case 23:Fm()}n=n.return}if(Zn=t,_n=t=Oi(t.current,null),ir=Kr=e,Wn=0,fu=null,Mm=pf=Ls=0,Or=ql=null,ws!==null){for(e=0;e<ws.length;e++)if(n=ws[e],r=n.interleaved,r!==null){n.interleaved=null;var a=r.next,i=n.pending;if(i!==null){var s=i.next;i.next=a,r.next=s}n.pending=r}ws=null}return t}function TE(t,e){do{var n=_n;try{if(km(),Kc.current=Pd,Nd){for(var r=wn.memoizedState;r!==null;){var a=r.queue;a!==null&&(a.pending=null),r=r.next}Nd=!1}if(Is=0,Qn=Hn=wn=null,Vl=!1,uu=0,Bm.current=null,n===null||n.return===null){Wn=1,fu=e,_n=null;break}e:{var i=t,s=n.return,o=n,l=e;if(e=ir,o.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){var u=l,d=o,f=d.tag;if(!(d.mode&1)&&(f===0||f===11||f===15)){var h=d.alternate;h?(d.updateQueue=h.updateQueue,d.memoizedState=h.memoizedState,d.lanes=h.lanes):(d.updateQueue=null,d.memoizedState=null)}var v=G0(s);if(v!==null){v.flags&=-257,Y0(v,s,o,i,e),v.mode&1&&K0(i,u,e),e=v,l=u;var p=e.updateQueue;if(p===null){var y=new Set;y.add(l),e.updateQueue=y}else p.add(l);break e}else{if(!(e&1)){K0(i,u,e),_m();break e}l=Error(Pe(426))}}else if(mn&&o.mode&1){var b=G0(s);if(b!==null){!(b.flags&65536)&&(b.flags|=256),Y0(b,s,o,i,e),xm(Fo(l,o));break e}}i=l=Fo(l,o),Wn!==4&&(Wn=2),ql===null?ql=[i]:ql.push(i),i=s;do{switch(i.tag){case 3:i.flags|=65536,e&=-e,i.lanes|=e;var m=cE(i,l,e);$0(i,m);break e;case 1:o=l;var g=i.type,w=i.stateNode;if(!(i.flags&128)&&(typeof g.getDerivedStateFromError=="function"||w!==null&&typeof w.componentDidCatch=="function"&&(Bi===null||!Bi.has(w)))){i.flags|=65536,e&=-e,i.lanes|=e;var x=dE(i,o,e);$0(i,x);break e}}i=i.return}while(i!==null)}RE(n)}catch(E){e=E,_n===n&&n!==null&&(_n=n=n.return);continue}break}while(!0)}function NE(){var t=Rd.current;return Rd.current=Pd,t===null?Pd:t}function _m(){(Wn===0||Wn===3||Wn===2)&&(Wn=4),Zn===null||!(Ls&268435455)&&!(pf&268435455)||ki(Zn,ir)}function Ad(t,e){var n=Ht;Ht|=2;var r=NE();(Zn!==t||ir!==e)&&(Wa=null,Ss(t,e));do try{fN();break}catch(a){TE(t,a)}while(!0);if(km(),Ht=n,Rd.current=r,_n!==null)throw Error(Pe(261));return Zn=null,ir=0,Wn}function fN(){for(;_n!==null;)PE(_n)}function hN(){for(;_n!==null&&!z2();)PE(_n)}function PE(t){var e=LE(t.alternate,t,Kr);t.memoizedProps=t.pendingProps,e===null?RE(t):_n=e,Bm.current=null}function RE(t){var e=t;do{var n=e.alternate;if(t=e.return,e.flags&32768){if(n=sN(n,e),n!==null){n.flags&=32767,_n=n;return}if(t!==null)t.flags|=32768,t.subtreeFlags=0,t.deletions=null;else{Wn=6,_n=null;return}}else if(n=iN(n,e,Kr),n!==null){_n=n;return}if(e=e.sibling,e!==null){_n=e;return}_n=e=t}while(e!==null);Wn===0&&(Wn=5)}function ps(t,e,n){var r=tn,a=ca.transition;try{ca.transition=null,tn=1,vN(t,e,n,r)}finally{ca.transition=a,tn=r}return null}function vN(t,e,n,r){do No();while(Si!==null);if(Ht&6)throw Error(Pe(327));n=t.finishedWork;var a=t.finishedLanes;if(n===null)return null;if(t.finishedWork=null,t.finishedLanes=0,n===t.current)throw Error(Pe(177));t.callbackNode=null,t.callbackPriority=0;var i=n.lanes|n.childLanes;if(G2(t,i),t===Zn&&(_n=Zn=null,ir=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||Sc||(Sc=!0,AE(vd,function(){return No(),null})),i=(n.flags&15990)!==0,n.subtreeFlags&15990||i){i=ca.transition,ca.transition=null;var s=tn;tn=1;var o=Ht;Ht|=4,Bm.current=null,lN(t,n),CE(n,t),DT(Qp),gd=!!Xp,Qp=Xp=null,t.current=n,uN(n),F2(),Ht=o,tn=s,ca.transition=i}else t.current=n;if(Sc&&(Sc=!1,Si=t,Ld=a),i=t.pendingLanes,i===0&&(Bi=null),V2(n.stateNode),Ur(t,Dn()),e!==null)for(r=t.onRecoverableError,n=0;n<e.length;n++)a=e[n],r(a.value,{componentStack:a.stack,digest:a.digest});if(Id)throw Id=!1,t=mg,mg=null,t;return Ld&1&&t.tag!==0&&No(),i=t.pendingLanes,i&1?t===yg?Hl++:(Hl=0,yg=t):Hl=0,Ji(),null}function No(){if(Si!==null){var t=ck(Ld),e=ca.transition,n=tn;try{if(ca.transition=null,tn=16>t?16:t,Si===null)var r=!1;else{if(t=Si,Si=null,Ld=0,Ht&6)throw Error(Pe(331));var a=Ht;for(Ht|=4,Qe=t.current;Qe!==null;){var i=Qe,s=i.child;if(Qe.flags&16){var o=i.deletions;if(o!==null){for(var l=0;l<o.length;l++){var u=o[l];for(Qe=u;Qe!==null;){var d=Qe;switch(d.tag){case 0:case 11:case 15:Ul(8,d,i)}var f=d.child;if(f!==null)f.return=d,Qe=f;else for(;Qe!==null;){d=Qe;var h=d.sibling,v=d.return;if(wE(d),d===u){Qe=null;break}if(h!==null){h.return=v,Qe=h;break}Qe=v}}}var p=i.alternate;if(p!==null){var y=p.child;if(y!==null){p.child=null;do{var b=y.sibling;y.sibling=null,y=b}while(y!==null)}}Qe=i}}if(i.subtreeFlags&2064&&s!==null)s.return=i,Qe=s;else e:for(;Qe!==null;){if(i=Qe,i.flags&2048)switch(i.tag){case 0:case 11:case 15:Ul(9,i,i.return)}var m=i.sibling;if(m!==null){m.return=i.return,Qe=m;break e}Qe=i.return}}var g=t.current;for(Qe=g;Qe!==null;){s=Qe;var w=s.child;if(s.subtreeFlags&2064&&w!==null)w.return=s,Qe=w;else e:for(s=g;Qe!==null;){if(o=Qe,o.flags&2048)try{switch(o.tag){case 0:case 11:case 15:vf(9,o)}}catch(E){Tn(o,o.return,E)}if(o===s){Qe=null;break e}var x=o.sibling;if(x!==null){x.return=o.return,Qe=x;break e}Qe=o.return}}if(Ht=a,Ji(),za&&typeof za.onPostCommitFiberRoot=="function")try{za.onPostCommitFiberRoot(sf,t)}catch{}r=!0}return r}finally{tn=n,ca.transition=e}}return!1}function lb(t,e,n){e=Fo(n,e),e=cE(t,e,1),t=Di(t,e,1),e=Sr(),t!==null&&(Ru(t,1,e),Ur(t,e))}function Tn(t,e,n){if(t.tag===3)lb(t,t,n);else for(;e!==null;){if(e.tag===3){lb(e,t,n);break}else if(e.tag===1){var r=e.stateNode;if(typeof e.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(Bi===null||!Bi.has(r))){t=Fo(n,t),t=dE(e,t,1),e=Di(e,t,1),t=Sr(),e!==null&&(Ru(e,1,t),Ur(e,t));break}}e=e.return}}function pN(t,e,n){var r=t.pingCache;r!==null&&r.delete(e),e=Sr(),t.pingedLanes|=t.suspendedLanes&n,Zn===t&&(ir&n)===n&&(Wn===4||Wn===3&&(ir&130023424)===ir&&500>Dn()-Om?Ss(t,0):Mm|=n),Ur(t,e)}function IE(t,e){e===0&&(t.mode&1?(e=pc,pc<<=1,!(pc&130023424)&&(pc=4194304)):e=1);var n=Sr();t=ei(t,e),t!==null&&(Ru(t,e,n),Ur(t,n))}function gN(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),IE(t,n)}function mN(t,e){var n=0;switch(t.tag){case 13:var r=t.stateNode,a=t.memoizedState;a!==null&&(n=a.retryLane);break;case 19:r=t.stateNode;break;default:throw Error(Pe(314))}r!==null&&r.delete(e),IE(t,n)}var LE;LE=function(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps||$r.current)Fr=!0;else{if(!(t.lanes&n)&&!(e.flags&128))return Fr=!1,aN(t,e,n);Fr=!!(t.flags&131072)}else Fr=!1,mn&&e.flags&1048576&&Mk(e,Ed,e.index);switch(e.lanes=0,e.tag){case 2:var r=e.type;Yc(t,e),t=e.pendingProps;var a=Bo(e,mr.current);To(e,n),a=Rm(null,e,r,t,a,n);var i=Im();return e.flags|=1,typeof a=="object"&&a!==null&&typeof a.render=="function"&&a.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,Vr(r)?(i=!0,wd(e)):i=!1,e.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,Sm(e),a.updater=hf,e.stateNode=a,a._reactInternals=e,sg(e,r,t,n),e=ug(null,e,r,!0,i,n)):(e.tag=0,mn&&i&&ym(e),Er(null,e,a,n),e=e.child),e;case 16:r=e.elementType;e:{switch(Yc(t,e),t=e.pendingProps,a=r._init,r=a(r._payload),e.type=r,a=e.tag=bN(r),t=ga(r,t),a){case 0:e=lg(null,e,r,t,n);break e;case 1:e=Z0(null,e,r,t,n);break e;case 11:e=X0(null,e,r,t,n);break e;case 14:e=Q0(null,e,r,ga(r.type,t),n);break e}throw Error(Pe(306,r,""))}return e;case 0:return r=e.type,a=e.pendingProps,a=e.elementType===r?a:ga(r,a),lg(t,e,r,a,n);case 1:return r=e.type,a=e.pendingProps,a=e.elementType===r?a:ga(r,a),Z0(t,e,r,a,n);case 3:e:{if(pE(e),t===null)throw Error(Pe(387));r=e.pendingProps,i=e.memoizedState,a=i.element,Vk(t,e),jd(e,r,null,n);var s=e.memoizedState;if(r=s.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},e.updateQueue.baseState=i,e.memoizedState=i,e.flags&256){a=Fo(Error(Pe(423)),e),e=J0(t,e,r,n,a);break e}else if(r!==a){a=Fo(Error(Pe(424)),e),e=J0(t,e,r,n,a);break e}else for(Gr=Ai(e.stateNode.containerInfo.firstChild),Yr=e,mn=!0,ba=null,n=_k(e,null,r,n),e.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Mo(),r===a){e=ti(t,e,n);break e}Er(t,e,r,n)}e=e.child}return e;case 5:return Uk(e),t===null&&rg(e),r=e.type,a=e.pendingProps,i=t!==null?t.memoizedProps:null,s=a.children,Zp(r,a)?s=null:i!==null&&Zp(r,i)&&(e.flags|=32),vE(t,e),Er(t,e,s,n),e.child;case 6:return t===null&&rg(e),null;case 13:return gE(t,e,n);case 4:return jm(e,e.stateNode.containerInfo),r=e.pendingProps,t===null?e.child=Oo(e,null,r,n):Er(t,e,r,n),e.child;case 11:return r=e.type,a=e.pendingProps,a=e.elementType===r?a:ga(r,a),X0(t,e,r,a,n);case 7:return Er(t,e,e.pendingProps,n),e.child;case 8:return Er(t,e,e.pendingProps.children,n),e.child;case 12:return Er(t,e,e.pendingProps.children,n),e.child;case 10:e:{if(r=e.type._context,a=e.pendingProps,i=e.memoizedProps,s=a.value,un(Cd,r._currentValue),r._currentValue=s,i!==null)if(Ea(i.value,s)){if(i.children===a.children&&!$r.current){e=ti(t,e,n);break e}}else for(i=e.child,i!==null&&(i.return=e);i!==null;){var o=i.dependencies;if(o!==null){s=i.child;for(var l=o.firstContext;l!==null;){if(l.context===r){if(i.tag===1){l=Qa(-1,n&-n),l.tag=2;var u=i.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?l.next=l:(l.next=d.next,d.next=l),u.pending=l}}i.lanes|=n,l=i.alternate,l!==null&&(l.lanes|=n),ag(i.return,n,e),o.lanes|=n;break}l=l.next}}else if(i.tag===10)s=i.type===e.type?null:i.child;else if(i.tag===18){if(s=i.return,s===null)throw Error(Pe(341));s.lanes|=n,o=s.alternate,o!==null&&(o.lanes|=n),ag(s,n,e),s=i.sibling}else s=i.child;if(s!==null)s.return=i;else for(s=i;s!==null;){if(s===e){s=null;break}if(i=s.sibling,i!==null){i.return=s.return,s=i;break}s=s.return}i=s}Er(t,e,a.children,n),e=e.child}return e;case 9:return a=e.type,r=e.pendingProps.children,To(e,n),a=da(a),r=r(a),e.flags|=1,Er(t,e,r,n),e.child;case 14:return r=e.type,a=ga(r,e.pendingProps),a=ga(r.type,a),Q0(t,e,r,a,n);case 15:return fE(t,e,e.type,e.pendingProps,n);case 17:return r=e.type,a=e.pendingProps,a=e.elementType===r?a:ga(r,a),Yc(t,e),e.tag=1,Vr(r)?(t=!0,wd(e)):t=!1,To(e,n),uE(e,r,a),sg(e,r,a,n),ug(null,e,r,!0,t,n);case 19:return mE(t,e,n);case 22:return hE(t,e,n)}throw Error(Pe(156,e.tag))};function AE(t,e){return sk(t,e)}function yN(t,e,n,r){this.tag=t,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,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 la(t,e,n,r){return new yN(t,e,n,r)}function $m(t){return t=t.prototype,!(!t||!t.isReactComponent)}function bN(t){if(typeof t=="function")return $m(t)?1:0;if(t!=null){if(t=t.$$typeof,t===sm)return 11;if(t===om)return 14}return 2}function Oi(t,e){var n=t.alternate;return n===null?(n=la(t.tag,e,t.key,t.mode),n.elementType=t.elementType,n.type=t.type,n.stateNode=t.stateNode,n.alternate=t,t.alternate=n):(n.pendingProps=e,n.type=t.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=t.flags&14680064,n.childLanes=t.childLanes,n.lanes=t.lanes,n.child=t.child,n.memoizedProps=t.memoizedProps,n.memoizedState=t.memoizedState,n.updateQueue=t.updateQueue,e=t.dependencies,n.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},n.sibling=t.sibling,n.index=t.index,n.ref=t.ref,n}function Zc(t,e,n,r,a,i){var s=2;if(r=t,typeof t=="function")$m(t)&&(s=1);else if(typeof t=="string")s=5;else e:switch(t){case so:return js(n.children,a,i,e);case im:s=8,a|=8;break;case Rp:return t=la(12,n,e,a|2),t.elementType=Rp,t.lanes=i,t;case Ip:return t=la(13,n,e,a),t.elementType=Ip,t.lanes=i,t;case Lp:return t=la(19,n,e,a),t.elementType=Lp,t.lanes=i,t;case U1:return gf(n,a,i,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case $1:s=10;break e;case V1:s=9;break e;case sm:s=11;break e;case om:s=14;break e;case yi:s=16,r=null;break e}throw Error(Pe(130,t==null?t:typeof t,""))}return e=la(s,n,e,a),e.elementType=t,e.type=r,e.lanes=i,e}function js(t,e,n,r){return t=la(7,t,r,e),t.lanes=n,t}function gf(t,e,n,r){return t=la(22,t,r,e),t.elementType=U1,t.lanes=n,t.stateNode={isHidden:!1},t}function Vh(t,e,n){return t=la(6,t,null,e),t.lanes=n,t}function Uh(t,e,n){return e=la(4,t.children!==null?t.children:[],t.key,e),e.lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function xN(t,e,n,r,a){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Eh(0),this.expirationTimes=Eh(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Eh(0),this.identifierPrefix=r,this.onRecoverableError=a,this.mutableSourceEagerHydrationData=null}function Vm(t,e,n,r,a,i,s,o,l){return t=new xN(t,e,n,o,l),e===1?(e=1,i===!0&&(e|=8)):e=0,i=la(3,null,null,e),t.current=i,i.stateNode=t,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Sm(i),t}function wN(t,e,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:io,key:r==null?null:""+r,children:t,containerInfo:e,implementation:n}}function DE(t){if(!t)return Vi;t=t._reactInternals;e:{if(_s(t)!==t||t.tag!==1)throw Error(Pe(170));var e=t;do{switch(e.tag){case 3:e=e.stateNode.context;break e;case 1:if(Vr(e.type)){e=e.stateNode.__reactInternalMemoizedMergedChildContext;break e}}e=e.return}while(e!==null);throw Error(Pe(171))}if(t.tag===1){var n=t.type;if(Vr(n))return Dk(t,n,e)}return e}function BE(t,e,n,r,a,i,s,o,l){return t=Vm(n,r,!0,t,a,i,s,o,l),t.context=DE(null),n=t.current,r=Sr(),a=Mi(n),i=Qa(r,a),i.callback=e??null,Di(n,i,a),t.current.lanes=a,Ru(t,a,r),Ur(t,r),t}function mf(t,e,n,r){var a=e.current,i=Sr(),s=Mi(a);return n=DE(n),e.context===null?e.context=n:e.pendingContext=n,e=Qa(i,s),e.payload={element:t},r=r===void 0?null:r,r!==null&&(e.callback=r),t=Di(a,e,s),t!==null&&(wa(t,a,s,i),Wc(t,a,s)),s}function Dd(t){if(t=t.current,!t.child)return null;switch(t.child.tag){case 5:return t.child.stateNode;default:return t.child.stateNode}}function ub(t,e){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var n=t.retryLane;t.retryLane=n!==0&&n<e?n:e}}function Um(t,e){ub(t,e),(t=t.alternate)&&ub(t,e)}function kN(){return null}var ME=typeof reportError=="function"?reportError:function(t){console.error(t)};function qm(t){this._internalRoot=t}yf.prototype.render=qm.prototype.render=function(t){var e=this._internalRoot;if(e===null)throw Error(Pe(409));mf(t,e,null,null)};yf.prototype.unmount=qm.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var e=t.containerInfo;As(function(){mf(null,t,null,null)}),e[Ja]=null}};function yf(t){this._internalRoot=t}yf.prototype.unstable_scheduleHydration=function(t){if(t){var e=hk();t={blockedOn:null,target:t,priority:e};for(var n=0;n<wi.length&&e!==0&&e<wi[n].priority;n++);wi.splice(n,0,t),n===0&&pk(t)}};function Hm(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function bf(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11&&(t.nodeType!==8||t.nodeValue!==" react-mount-point-unstable "))}function cb(){}function EN(t,e,n,r,a){if(a){if(typeof r=="function"){var i=r;r=function(){var u=Dd(s);i.call(u)}}var s=BE(e,r,t,0,null,!1,!1,"",cb);return t._reactRootContainer=s,t[Ja]=s.current,au(t.nodeType===8?t.parentNode:t),As(),s}for(;a=t.lastChild;)t.removeChild(a);if(typeof r=="function"){var o=r;r=function(){var u=Dd(l);o.call(u)}}var l=Vm(t,0,!1,null,null,!1,!1,"",cb);return t._reactRootContainer=l,t[Ja]=l.current,au(t.nodeType===8?t.parentNode:t),As(function(){mf(e,l,n,r)}),l}function xf(t,e,n,r,a){var i=n._reactRootContainer;if(i){var s=i;if(typeof a=="function"){var o=a;a=function(){var l=Dd(s);o.call(l)}}mf(e,s,t,a)}else s=EN(n,e,t,a,r);return Dd(s)}dk=function(t){switch(t.tag){case 3:var e=t.stateNode;if(e.current.memoizedState.isDehydrated){var n=Ll(e.pendingLanes);n!==0&&(cm(e,n|1),Ur(e,Dn()),!(Ht&6)&&(_o=Dn()+500,Ji()))}break;case 13:As(function(){var r=ei(t,1);if(r!==null){var a=Sr();wa(r,t,1,a)}}),Um(t,1)}};dm=function(t){if(t.tag===13){var e=ei(t,134217728);if(e!==null){var n=Sr();wa(e,t,134217728,n)}Um(t,134217728)}};fk=function(t){if(t.tag===13){var e=Mi(t),n=ei(t,e);if(n!==null){var r=Sr();wa(n,t,e,r)}Um(t,e)}};hk=function(){return tn};vk=function(t,e){var n=tn;try{return tn=t,e()}finally{tn=n}};Vp=function(t,e,n){switch(e){case"input":if(Bp(t,n),e=n.name,n.type==="radio"&&e!=null){for(n=t;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+e)+'][type="radio"]'),e=0;e<n.length;e++){var r=n[e];if(r!==t&&r.form===t.form){var a=cf(r);if(!a)throw Error(Pe(90));H1(r),Bp(r,a)}}}break;case"textarea":K1(t,n);break;case"select":e=n.value,e!=null&&Eo(t,!!n.multiple,e,!1)}};ek=zm;tk=As;var CN={usingClientEntryPoint:!1,Events:[Lu,co,cf,Z1,J1,zm]},xl={findFiberByHostInstance:xs,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},SN={bundleType:xl.bundleType,version:xl.version,rendererPackageName:xl.rendererPackageName,rendererConfig:xl.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:ai.ReactCurrentDispatcher,findHostInstanceByFiber:function(t){return t=ak(t),t===null?null:t.stateNode},findFiberByHostInstance:xl.findFiberByHostInstance||kN,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var jc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!jc.isDisabled&&jc.supportsFiber)try{sf=jc.inject(SN),za=jc}catch{}}Zr.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=CN;Zr.createPortal=function(t,e){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Hm(e))throw Error(Pe(200));return wN(t,e,null,n)};Zr.createRoot=function(t,e){if(!Hm(t))throw Error(Pe(299));var n=!1,r="",a=ME;return e!=null&&(e.unstable_strictMode===!0&&(n=!0),e.identifierPrefix!==void 0&&(r=e.identifierPrefix),e.onRecoverableError!==void 0&&(a=e.onRecoverableError)),e=Vm(t,1,!1,null,null,n,!1,r,a),t[Ja]=e.current,au(t.nodeType===8?t.parentNode:t),new qm(e)};Zr.findDOMNode=function(t){if(t==null)return null;if(t.nodeType===1)return t;var e=t._reactInternals;if(e===void 0)throw typeof t.render=="function"?Error(Pe(188)):(t=Object.keys(t).join(","),Error(Pe(268,t)));return t=ak(e),t=t===null?null:t.stateNode,t};Zr.flushSync=function(t){return As(t)};Zr.hydrate=function(t,e,n){if(!bf(e))throw Error(Pe(200));return xf(null,t,e,!0,n)};Zr.hydrateRoot=function(t,e,n){if(!Hm(t))throw Error(Pe(405));var r=n!=null&&n.hydratedSources||null,a=!1,i="",s=ME;if(n!=null&&(n.unstable_strictMode===!0&&(a=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onRecoverableError!==void 0&&(s=n.onRecoverableError)),e=BE(e,null,t,1,n??null,a,!1,i,s),t[Ja]=e.current,au(t),r)for(t=0;t<r.length;t++)n=r[t],a=n._getVersion,a=a(n._source),e.mutableSourceEagerHydrationData==null?e.mutableSourceEagerHydrationData=[n,a]:e.mutableSourceEagerHydrationData.push(n,a);return new yf(e)};Zr.render=function(t,e,n){if(!bf(e))throw Error(Pe(200));return xf(null,t,e,!1,n)};Zr.unmountComponentAtNode=function(t){if(!bf(t))throw Error(Pe(40));return t._reactRootContainer?(As(function(){xf(null,null,t,!1,function(){t._reactRootContainer=null,t[Ja]=null})}),!0):!1};Zr.unstable_batchedUpdates=zm;Zr.unstable_renderSubtreeIntoContainer=function(t,e,n,r){if(!bf(n))throw Error(Pe(200));if(t==null||t._reactInternals===void 0)throw Error(Pe(38));return xf(t,e,n,!1,r)};Zr.version="18.3.1-next-f1338f8080-20240426";function OE(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(OE)}catch(t){console.error(t)}}OE(),O1.exports=Zr;var zE=O1.exports,FE,db=zE;FE=db.createRoot,db.hydrateRoot;/**
|
|
47
|
+
* @remix-run/router v1.23.3
|
|
48
|
+
*
|
|
49
|
+
* Copyright (c) Remix Software Inc.
|
|
50
|
+
*
|
|
51
|
+
* This source code is licensed under the MIT license found in the
|
|
52
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
53
|
+
*
|
|
54
|
+
* @license MIT
|
|
55
|
+
*/function hu(){return hu=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},hu.apply(null,arguments)}var ji;(function(t){t.Pop="POP",t.Push="PUSH",t.Replace="REPLACE"})(ji||(ji={}));const fb="popstate";function jN(t){t===void 0&&(t={});function e(r,a){let{pathname:i,search:s,hash:o}=r.location;return wg("",{pathname:i,search:s,hash:o},a.state&&a.state.usr||null,a.state&&a.state.key||"default")}function n(r,a){return typeof a=="string"?a:Bd(a)}return NN(e,n,null,t)}function kn(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function Wm(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function TN(){return Math.random().toString(36).substr(2,8)}function hb(t,e){return{usr:t.state,key:t.key,idx:e}}function wg(t,e,n,r){return n===void 0&&(n=null),hu({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?Zo(e):e,{state:n,key:e&&e.key||r||TN()})}function Bd(t){let{pathname:e="/",search:n="",hash:r=""}=t;return n&&n!=="?"&&(e+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}function Zo(t){let e={};if(t){let n=t.indexOf("#");n>=0&&(e.hash=t.substr(n),t=t.substr(0,n));let r=t.indexOf("?");r>=0&&(e.search=t.substr(r),t=t.substr(0,r)),t&&(e.pathname=t)}return e}function NN(t,e,n,r){r===void 0&&(r={});let{window:a=document.defaultView,v5Compat:i=!1}=r,s=a.history,o=ji.Pop,l=null,u=d();u==null&&(u=0,s.replaceState(hu({},s.state,{idx:u}),""));function d(){return(s.state||{idx:null}).idx}function f(){o=ji.Pop;let b=d(),m=b==null?null:b-u;u=b,l&&l({action:o,location:y.location,delta:m})}function h(b,m){o=ji.Push;let g=wg(y.location,b,m);u=d()+1;let w=hb(g,u),x=y.createHref(g);try{s.pushState(w,"",x)}catch(E){if(E instanceof DOMException&&E.name==="DataCloneError")throw E;a.location.assign(x)}i&&l&&l({action:o,location:y.location,delta:1})}function v(b,m){o=ji.Replace;let g=wg(y.location,b,m);u=d();let w=hb(g,u),x=y.createHref(g);s.replaceState(w,"",x),i&&l&&l({action:o,location:y.location,delta:0})}function p(b){let m=a.location.origin!=="null"?a.location.origin:a.location.href,g=typeof b=="string"?b:Bd(b);return g=g.replace(/ $/,"%20"),kn(m,"No window.location.(origin|href) available to create URL for href: "+g),new URL(g,m)}let y={get action(){return o},get location(){return t(a,s)},listen(b){if(l)throw new Error("A history only accepts one active listener");return a.addEventListener(fb,f),l=b,()=>{a.removeEventListener(fb,f),l=null}},createHref(b){return e(a,b)},createURL:p,encodeLocation(b){let m=p(b);return{pathname:m.pathname,search:m.search,hash:m.hash}},push:h,replace:v,go(b){return s.go(b)}};return y}var vb;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(vb||(vb={}));function PN(t,e,n){return n===void 0&&(n="/"),RN(t,e,n)}function RN(t,e,n,r){let a=typeof e=="string"?Zo(e):e,i=$o(a.pathname||"/",n);if(i==null)return null;let s=_E(t);IN(s);let o=null,l=VN(i);for(let u=0;o==null&&u<s.length;++u)o=_N(s[u],l);return o}function _E(t,e,n,r){e===void 0&&(e=[]),n===void 0&&(n=[]),r===void 0&&(r="");let a=(i,s,o)=>{let l={relativePath:o===void 0?i.path||"":o,caseSensitive:i.caseSensitive===!0,childrenIndex:s,route:i};l.relativePath.startsWith("/")&&(kn(l.relativePath.startsWith(r),'Absolute route path "'+l.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),l.relativePath=l.relativePath.slice(r.length));let u=zi([r,l.relativePath]),d=n.concat(l);i.children&&i.children.length>0&&(kn(i.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),_E(i.children,e,d,u)),!(i.path==null&&!i.index)&&e.push({path:u,score:zN(u,i.index),routesMeta:d})};return t.forEach((i,s)=>{var o;if(i.path===""||!((o=i.path)!=null&&o.includes("?")))a(i,s);else for(let l of $E(i.path))a(i,s,l)}),e}function $E(t){let e=t.split("/");if(e.length===0)return[];let[n,...r]=e,a=n.endsWith("?"),i=n.replace(/\?$/,"");if(r.length===0)return a?[i,""]:[i];let s=$E(r.join("/")),o=[];return o.push(...s.map(l=>l===""?i:[i,l].join("/"))),a&&o.push(...s),o.map(l=>t.startsWith("/")&&l===""?"/":l)}function IN(t){t.sort((e,n)=>e.score!==n.score?n.score-e.score:FN(e.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const LN=/^:[\w-]+$/,AN=3,DN=2,BN=1,MN=10,ON=-2,pb=t=>t==="*";function zN(t,e){let n=t.split("/"),r=n.length;return n.some(pb)&&(r+=ON),e&&(r+=DN),n.filter(a=>!pb(a)).reduce((a,i)=>a+(LN.test(i)?AN:i===""?BN:MN),r)}function FN(t,e){return t.length===e.length&&t.slice(0,-1).every((r,a)=>r===e[a])?t[t.length-1]-e[e.length-1]:0}function _N(t,e,n){let{routesMeta:r}=t,a={},i="/",s=[];for(let o=0;o<r.length;++o){let l=r[o],u=o===r.length-1,d=i==="/"?e:e.slice(i.length)||"/",f=kg({path:l.relativePath,caseSensitive:l.caseSensitive,end:u},d),h=l.route;if(!f)return null;Object.assign(a,f.params),s.push({params:a,pathname:zi([i,f.pathname]),pathnameBase:KN(zi([i,f.pathnameBase])),route:h}),f.pathnameBase!=="/"&&(i=zi([i,f.pathnameBase]))}return s}function kg(t,e){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[n,r]=$N(t.path,t.caseSensitive,t.end),a=e.match(n);if(!a)return null;let i=a[0],s=i.replace(/(.)\/+$/,"$1"),o=a.slice(1);return{params:r.reduce((u,d,f)=>{let{paramName:h,isOptional:v}=d;if(h==="*"){let y=o[f]||"";s=i.slice(0,i.length-y.length).replace(/(.)\/+$/,"$1")}const p=o[f];return v&&!p?u[h]=void 0:u[h]=(p||"").replace(/%2F/g,"/"),u},{}),pathname:i,pathnameBase:s,pattern:t}}function $N(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!0),Wm(t==="*"||!t.endsWith("*")||t.endsWith("/*"),'Route path "'+t+'" will be treated as if it were '+('"'+t.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+t.replace(/\*$/,"/*")+'".'));let r=[],a="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(s,o,l)=>(r.push({paramName:o,isOptional:l!=null}),l?"/?([^\\/]+)?":"/([^\\/]+)"));return t.endsWith("*")?(r.push({paramName:"*"}),a+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?a+="\\/*$":t!==""&&t!=="/"&&(a+="(?:(?=\\/|$))"),[new RegExp(a,e?void 0:"i"),r]}function VN(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return Wm(!1,'The URL path "'+t+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+e+").")),t}}function $o(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let n=e.endsWith("/")?e.length-1:e.length,r=t.charAt(n);return r&&r!=="/"?null:t.slice(n)||"/"}const UN=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,qN=t=>UN.test(t);function HN(t,e){e===void 0&&(e="/");let{pathname:n,search:r="",hash:a=""}=typeof t=="string"?Zo(t):t,i;if(n)if(qN(n))i=n;else{if(n.includes("//")){let s=n;n=VE(n),Wm(!1,"Pathnames cannot have embedded double slashes - normalizing "+(s+" -> "+n))}n.startsWith("/")?i=gb(n.substring(1),"/"):i=gb(n,e)}else i=e;return{pathname:i,search:GN(r),hash:YN(a)}}function gb(t,e){let n=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(a=>{a===".."?n.length>1&&n.pop():a!=="."&&n.push(a)}),n.length>1?n.join("/"):"/"}function qh(t,e,n,r){return"Cannot include a '"+t+"' character in a manually specified "+("`to."+e+"` field ["+JSON.stringify(r)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in <Link to="..."> and the router will parse it for you.'}function WN(t){return t.filter((e,n)=>n===0||e.route.path&&e.route.path.length>0)}function Km(t,e){let n=WN(t);return e?n.map((r,a)=>a===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function Gm(t,e,n,r){r===void 0&&(r=!1);let a;typeof t=="string"?a=Zo(t):(a=hu({},t),kn(!a.pathname||!a.pathname.includes("?"),qh("?","pathname","search",a)),kn(!a.pathname||!a.pathname.includes("#"),qh("#","pathname","hash",a)),kn(!a.search||!a.search.includes("#"),qh("#","search","hash",a)));let i=t===""||a.pathname==="",s=i?"/":a.pathname,o;if(s==null)o=n;else{let f=e.length-1;if(!r&&s.startsWith("..")){let h=s.split("/");for(;h[0]==="..";)h.shift(),f-=1;a.pathname=h.join("/")}o=f>=0?e[f]:"/"}let l=HN(a,o),u=s&&s!=="/"&&s.endsWith("/"),d=(i||s===".")&&n.endsWith("/");return!l.pathname.endsWith("/")&&(u||d)&&(l.pathname+="/"),l}const VE=t=>t.replace(/\/\/+/g,"/"),zi=t=>VE(t.join("/")),KN=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),GN=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,YN=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function XN(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const UE=["post","put","patch","delete"];new Set(UE);const QN=["get",...UE];new Set(QN);/**
|
|
56
|
+
* React Router v6.30.4
|
|
57
|
+
*
|
|
58
|
+
* Copyright (c) Remix Software Inc.
|
|
59
|
+
*
|
|
60
|
+
* This source code is licensed under the MIT license found in the
|
|
61
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
62
|
+
*
|
|
63
|
+
* @license MIT
|
|
64
|
+
*/function vu(){return vu=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},vu.apply(null,arguments)}const wf=A.createContext(null),qE=A.createContext(null),ii=A.createContext(null),kf=A.createContext(null),si=A.createContext({outlet:null,matches:[],isDataRoute:!1}),HE=A.createContext(null);function ZN(t,e){let{relative:n}=e===void 0?{}:e;Jo()||kn(!1);let{basename:r,navigator:a}=A.useContext(ii),{hash:i,pathname:s,search:o}=Cf(t,{relative:n}),l=s;return r!=="/"&&(l=s==="/"?r:zi([r,s])),a.createHref({pathname:l,search:o,hash:i})}function Jo(){return A.useContext(kf)!=null}function oi(){return Jo()||kn(!1),A.useContext(kf).location}function WE(t){A.useContext(ii).static||A.useLayoutEffect(t)}function Pr(){let{isDataRoute:t}=A.useContext(si);return t?dP():JN()}function JN(){Jo()||kn(!1);let t=A.useContext(wf),{basename:e,future:n,navigator:r}=A.useContext(ii),{matches:a}=A.useContext(si),{pathname:i}=oi(),s=JSON.stringify(Km(a,n.v7_relativeSplatPath)),o=A.useRef(!1);return WE(()=>{o.current=!0}),A.useCallback(function(u,d){if(d===void 0&&(d={}),!o.current)return;if(typeof u=="number"){r.go(u);return}let f=Gm(u,JSON.parse(s),i,d.relative==="path");t==null&&e!=="/"&&(f.pathname=f.pathname==="/"?e:zi([e,f.pathname])),(d.replace?r.replace:r.push)(f,d.state,d)},[e,r,s,i,t])}function Ef(){let{matches:t}=A.useContext(si),e=t[t.length-1];return e?e.params:{}}function Cf(t,e){let{relative:n}=e===void 0?{}:e,{future:r}=A.useContext(ii),{matches:a}=A.useContext(si),{pathname:i}=oi(),s=JSON.stringify(Km(a,r.v7_relativeSplatPath));return A.useMemo(()=>Gm(t,JSON.parse(s),i,n==="path"),[t,s,i,n])}function eP(t,e){return tP(t,e)}function tP(t,e,n,r){Jo()||kn(!1);let{navigator:a}=A.useContext(ii),{matches:i}=A.useContext(si),s=i[i.length-1],o=s?s.params:{};s&&s.pathname;let l=s?s.pathnameBase:"/";s&&s.route;let u=oi(),d;if(e){var f;let b=typeof e=="string"?Zo(e):e;l==="/"||(f=b.pathname)!=null&&f.startsWith(l)||kn(!1),d=b}else d=u;let h=d.pathname||"/",v=h;if(l!=="/"){let b=l.replace(/^\//,"").split("/");v="/"+h.replace(/^\//,"").split("/").slice(b.length).join("/")}let p=PN(t,{pathname:v}),y=sP(p&&p.map(b=>Object.assign({},b,{params:Object.assign({},o,b.params),pathname:zi([l,a.encodeLocation?a.encodeLocation(b.pathname).pathname:b.pathname]),pathnameBase:b.pathnameBase==="/"?l:zi([l,a.encodeLocation?a.encodeLocation(b.pathnameBase).pathname:b.pathnameBase])})),i,n,r);return e&&y?A.createElement(kf.Provider,{value:{location:vu({pathname:"/",search:"",hash:"",state:null,key:"default"},d),navigationType:ji.Pop}},y):y}function nP(){let t=cP(),e=XN(t)?t.status+" "+t.statusText:t instanceof Error?t.message:JSON.stringify(t),n=t instanceof Error?t.stack:null,a={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return A.createElement(A.Fragment,null,A.createElement("h2",null,"Unexpected Application Error!"),A.createElement("h3",{style:{fontStyle:"italic"}},e),n?A.createElement("pre",{style:a},n):null,null)}const rP=A.createElement(nP,null);class aP extends A.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,n){return n.location!==e.location||n.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:n.error,location:n.location,revalidation:e.revalidation||n.revalidation}}componentDidCatch(e,n){console.error("React Router caught the following error during render",e,n)}render(){return this.state.error!==void 0?A.createElement(si.Provider,{value:this.props.routeContext},A.createElement(HE.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function iP(t){let{routeContext:e,match:n,children:r}=t,a=A.useContext(wf);return a&&a.static&&a.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=n.route.id),A.createElement(si.Provider,{value:e},r)}function sP(t,e,n,r){var a;if(e===void 0&&(e=[]),n===void 0&&(n=null),r===void 0&&(r=null),t==null){var i;if(!n)return null;if(n.errors)t=n.matches;else if((i=r)!=null&&i.v7_partialHydration&&e.length===0&&!n.initialized&&n.matches.length>0)t=n.matches;else return null}let s=t,o=(a=n)==null?void 0:a.errors;if(o!=null){let d=s.findIndex(f=>f.route.id&&(o==null?void 0:o[f.route.id])!==void 0);d>=0||kn(!1),s=s.slice(0,Math.min(s.length,d+1))}let l=!1,u=-1;if(n&&r&&r.v7_partialHydration)for(let d=0;d<s.length;d++){let f=s[d];if((f.route.HydrateFallback||f.route.hydrateFallbackElement)&&(u=d),f.route.id){let{loaderData:h,errors:v}=n,p=f.route.loader&&h[f.route.id]===void 0&&(!v||v[f.route.id]===void 0);if(f.route.lazy||p){l=!0,u>=0?s=s.slice(0,u+1):s=[s[0]];break}}}return s.reduceRight((d,f,h)=>{let v,p=!1,y=null,b=null;n&&(v=o&&f.route.id?o[f.route.id]:void 0,y=f.route.errorElement||rP,l&&(u<0&&h===0?(fP("route-fallback"),p=!0,b=null):u===h&&(p=!0,b=f.route.hydrateFallbackElement||null)));let m=e.concat(s.slice(0,h+1)),g=()=>{let w;return v?w=y:p?w=b:f.route.Component?w=A.createElement(f.route.Component,null):f.route.element?w=f.route.element:w=d,A.createElement(iP,{match:f,routeContext:{outlet:d,matches:m,isDataRoute:n!=null},children:w})};return n&&(f.route.ErrorBoundary||f.route.errorElement||h===0)?A.createElement(aP,{location:n.location,revalidation:n.revalidation,component:y,error:v,children:g(),routeContext:{outlet:null,matches:m,isDataRoute:!0}}):g()},null)}var KE=function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t}(KE||{}),GE=function(t){return t.UseBlocker="useBlocker",t.UseLoaderData="useLoaderData",t.UseActionData="useActionData",t.UseRouteError="useRouteError",t.UseNavigation="useNavigation",t.UseRouteLoaderData="useRouteLoaderData",t.UseMatches="useMatches",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t.UseRouteId="useRouteId",t}(GE||{});function oP(t){let e=A.useContext(wf);return e||kn(!1),e}function lP(t){let e=A.useContext(qE);return e||kn(!1),e}function uP(t){let e=A.useContext(si);return e||kn(!1),e}function YE(t){let e=uP(),n=e.matches[e.matches.length-1];return n.route.id||kn(!1),n.route.id}function cP(){var t;let e=A.useContext(HE),n=lP(),r=YE();return e!==void 0?e:(t=n.errors)==null?void 0:t[r]}function dP(){let{router:t}=oP(KE.UseNavigateStable),e=YE(GE.UseNavigateStable),n=A.useRef(!1);return WE(()=>{n.current=!0}),A.useCallback(function(a,i){i===void 0&&(i={}),n.current&&(typeof a=="number"?t.navigate(a):t.navigate(a,vu({fromRouteId:e},i)))},[t,e])}const mb={};function fP(t,e,n){mb[t]||(mb[t]=!0)}function hP(t,e){t==null||t.v7_startTransition,t==null||t.v7_relativeSplatPath}function Eg(t){let{to:e,replace:n,state:r,relative:a}=t;Jo()||kn(!1);let{future:i,static:s}=A.useContext(ii),{matches:o}=A.useContext(si),{pathname:l}=oi(),u=Pr(),d=Gm(e,Km(o,i.v7_relativeSplatPath),l,a==="path"),f=JSON.stringify(d);return A.useEffect(()=>u(JSON.parse(f),{replace:n,state:r,relative:a}),[u,f,a,n,r]),null}function An(t){kn(!1)}function vP(t){let{basename:e="/",children:n=null,location:r,navigationType:a=ji.Pop,navigator:i,static:s=!1,future:o}=t;Jo()&&kn(!1);let l=e.replace(/^\/*/,"/"),u=A.useMemo(()=>({basename:l,navigator:i,static:s,future:vu({v7_relativeSplatPath:!1},o)}),[l,o,i,s]);typeof r=="string"&&(r=Zo(r));let{pathname:d="/",search:f="",hash:h="",state:v=null,key:p="default"}=r,y=A.useMemo(()=>{let b=$o(d,l);return b==null?null:{location:{pathname:b,search:f,hash:h,state:v,key:p},navigationType:a}},[l,d,f,h,v,p,a]);return y==null?null:A.createElement(ii.Provider,{value:u},A.createElement(kf.Provider,{children:n,value:y}))}function XE(t){let{children:e,location:n}=t;return eP(Cg(e),n)}new Promise(()=>{});function Cg(t,e){e===void 0&&(e=[]);let n=[];return A.Children.forEach(t,(r,a)=>{if(!A.isValidElement(r))return;let i=[...e,a];if(r.type===A.Fragment){n.push.apply(n,Cg(r.props.children,i));return}r.type!==An&&kn(!1),!r.props.index||!r.props.children||kn(!1);let s={id:r.props.id||i.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(s.children=Cg(r.props.children,i)),n.push(s)}),n}/**
|
|
65
|
+
* React Router DOM v6.30.4
|
|
66
|
+
*
|
|
67
|
+
* Copyright (c) Remix Software Inc.
|
|
68
|
+
*
|
|
69
|
+
* This source code is licensed under the MIT license found in the
|
|
70
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
71
|
+
*
|
|
72
|
+
* @license MIT
|
|
73
|
+
*/function Md(){return Md=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Md.apply(null,arguments)}function QE(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}function pP(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function gP(t,e){return t.button===0&&(!e||e==="_self")&&!pP(t)}function Sg(t){return t===void 0&&(t=""),new URLSearchParams(typeof t=="string"||Array.isArray(t)||t instanceof URLSearchParams?t:Object.keys(t).reduce((e,n)=>{let r=t[n];return e.concat(Array.isArray(r)?r.map(a=>[n,a]):[[n,r]])},[]))}function mP(t,e){let n=Sg(t);return e&&e.forEach((r,a)=>{n.has(a)||e.getAll(a).forEach(i=>{n.append(a,i)})}),n}const yP=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],bP=["aria-current","caseSensitive","className","end","style","to","viewTransition","children"],xP="6";try{window.__reactRouterVersion=xP}catch{}const wP=A.createContext({isTransitioning:!1}),kP="startTransition",yb=p2[kP];function EP(t){let{basename:e,children:n,future:r,window:a}=t,i=A.useRef();i.current==null&&(i.current=jN({window:a,v5Compat:!0}));let s=i.current,[o,l]=A.useState({action:s.action,location:s.location}),{v7_startTransition:u}=r||{},d=A.useCallback(f=>{u&&yb?yb(()=>l(f)):l(f)},[l,u]);return A.useLayoutEffect(()=>s.listen(d),[s,d]),A.useEffect(()=>hP(r),[r]),A.createElement(vP,{basename:e,children:n,location:o.location,navigationType:o.action,navigator:s,future:r})}const CP=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",SP=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,jP=A.forwardRef(function(e,n){let{onClick:r,relative:a,reloadDocument:i,replace:s,state:o,target:l,to:u,preventScrollReset:d,viewTransition:f}=e,h=QE(e,yP),{basename:v}=A.useContext(ii),p,y=!1;if(typeof u=="string"&&SP.test(u)&&(p=u,CP))try{let w=new URL(window.location.href),x=u.startsWith("//")?new URL(w.protocol+u):new URL(u),E=$o(x.pathname,v);x.origin===w.origin&&E!=null?u=E+x.search+x.hash:y=!0}catch{}let b=ZN(u,{relative:a}),m=PP(u,{replace:s,state:o,target:l,preventScrollReset:d,relative:a,viewTransition:f});function g(w){r&&r(w),w.defaultPrevented||m(w)}return A.createElement("a",Md({},h,{href:p||b,onClick:y||i?r:g,ref:n,target:l}))}),TP=A.forwardRef(function(e,n){let{"aria-current":r="page",caseSensitive:a=!1,className:i="",end:s=!1,style:o,to:l,viewTransition:u,children:d}=e,f=QE(e,bP),h=Cf(l,{relative:f.relative}),v=oi(),p=A.useContext(qE),{navigator:y,basename:b}=A.useContext(ii),m=p!=null&&IP(h)&&u===!0,g=y.encodeLocation?y.encodeLocation(h).pathname:h.pathname,w=v.pathname,x=p&&p.navigation&&p.navigation.location?p.navigation.location.pathname:null;a||(w=w.toLowerCase(),x=x?x.toLowerCase():null,g=g.toLowerCase()),x&&b&&(x=$o(x,b)||x);const E=g!=="/"&&g.endsWith("/")?g.length-1:g.length;let S=w===g||!s&&w.startsWith(g)&&w.charAt(E)==="/",C=x!=null&&(x===g||!s&&x.startsWith(g)&&x.charAt(g.length)==="/"),T={isActive:S,isPending:C,isTransitioning:m},N=S?r:void 0,P;typeof i=="function"?P=i(T):P=[i,S?"active":null,C?"pending":null,m?"transitioning":null].filter(Boolean).join(" ");let R=typeof o=="function"?o(T):o;return A.createElement(jP,Md({},f,{"aria-current":N,className:P,ref:n,style:R,to:l,viewTransition:u}),typeof d=="function"?d(T):d)});var jg;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})(jg||(jg={}));var bb;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(bb||(bb={}));function NP(t){let e=A.useContext(wf);return e||kn(!1),e}function PP(t,e){let{target:n,replace:r,state:a,preventScrollReset:i,relative:s,viewTransition:o}=e===void 0?{}:e,l=Pr(),u=oi(),d=Cf(t,{relative:s});return A.useCallback(f=>{if(gP(f,n)){f.preventDefault();let h=r!==void 0?r:Bd(u)===Bd(d);l(t,{replace:h,state:a,preventScrollReset:i,relative:s,viewTransition:o})}},[u,l,d,r,a,n,t,i,s,o])}function RP(t){let e=A.useRef(Sg(t)),n=A.useRef(!1),r=oi(),a=A.useMemo(()=>mP(r.search,n.current?null:e.current),[r.search]),i=Pr(),s=A.useCallback((o,l)=>{const u=Sg(typeof o=="function"?o(a):o);n.current=!0,i("?"+u,l)},[i,a]);return[a,s]}function IP(t,e){e===void 0&&(e={});let n=A.useContext(wP);n==null&&kn(!1);let{basename:r}=NP(jg.useViewTransitionState),a=Cf(t,{relative:e.relative});if(!n.isTransitioning)return!1;let i=$o(n.currentLocation.pathname,r)||n.currentLocation.pathname,s=$o(n.nextLocation.pathname,r)||n.nextLocation.pathname;return kg(a.pathname,s)!=null||kg(a.pathname,i)!=null}const LP={"X-Wairon-Web":"1"};class Du extends Error{constructor(e,n){super(e),this.status=n,this.name="ApiError"}}async function el(t,e={}){return fetch(t,{...e,credentials:"same-origin",headers:{...LP,...e.headers??{}}})}async function Et(t){const e=await el(t);return Qm(e,t)}async function yt(t,e){const n=await el(t,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e??{})});return Qm(n,t)}async function Ym(t,e,n={}){const r=await el(t,{method:"POST",headers:{"content-type":"application/zip",...n},body:e});return Qm(r,t)}async function AP(t,e){const n=await el(t);if(!n.ok){let l=`${t} failed (${n.status})`;try{const u=await n.text(),d=u?JSON.parse(u):null;d&&typeof d.error=="string"?l=d.error:u&&(l=u)}catch{}throw new Du(l,n.status)}const r=n.headers.get("content-disposition")??"",a=/filename="?([^";]+)"?/i.exec(r),i=await n.blob(),s=URL.createObjectURL(i),o=document.createElement("a");o.href=s,o.download=(a==null?void 0:a[1])??e,document.body.appendChild(o),o.click(),o.remove(),setTimeout(()=>URL.revokeObjectURL(s),0)}function ZE(t,e={}){return el(t,e)}async function Xm(t,e,n){var u;const r=await el("/mcp",{method:"POST",headers:{"content-type":"application/json",accept:"application/json, text/event-stream","X-Wairon-Project":t},body:JSON.stringify({jsonrpc:"2.0",id:1,method:"tools/call",params:{name:e,arguments:n}})}),a=await r.text();let i;try{i=a?JSON.parse(a):{}}catch{throw new Error(`${e}: unexpected non-JSON response (${r.status})`)}if(!r.ok){const d=i.error,f=typeof d=="string"?d:(d==null?void 0:d.message)??`${e} failed (${r.status})`;throw new Du(f,r.status)}if(i.error!==void 0&&i.error!==null){const d=i.error;throw new Error(typeof d=="string"?d:d.message??`${e} failed`)}const s=i.result,o=(u=s==null?void 0:s.content)==null?void 0:u[0],l=o&&o.type==="text"?o.text??"":"";if(s!=null&&s.isError)throw new Error(l||`${e} failed`);if(o)try{return JSON.parse(l)}catch{return l}}function Vo(t,e){if(Array.isArray(t))return t;const n=t==null?void 0:t[e];return Array.isArray(n)?n:[]}async function Qm(t,e){if(t.ok){const r=await t.text();return r?JSON.parse(r):void 0}let n=`${e} failed (${t.status})`;try{const r=await t.text(),a=r?JSON.parse(r):null;a&&typeof a.error=="string"?n=a.error:r&&(n=r)}catch{}throw new Du(n,t.status)}const JE=A.createContext(null);function DP({children:t}){const[e,n]=A.useState("loading"),[r,a]=A.useState(null),[i,s]=A.useState(!1),[o,l]=A.useState(),u=A.useCallback(()=>{n("loading"),Et("/web/context").then(async d=>{if(a(d),n("authenticated"),d.isAdmin)s(!0);else try{s((await ZE("/web/admin/roles")).ok)}catch{s(!1)}}).catch(d=>{d instanceof Du&&d.status===401?n("anonymous"):(l(d instanceof Error?d.message:String(d)),n("error"))})},[]);return A.useEffect(u,[u]),c.jsx(JE.Provider,{value:{status:e,ctx:r,adminVisible:i,error:o,reload:u},children:t})}function Zm(){const t=A.useContext(JE);if(!t)throw new Error("useSession must be used within a SessionProvider");return t}function Ui(t){const e=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);return e?{r:parseInt(e[1],16),g:parseInt(e[2],16),b:parseInt(e[3],16)}:null}function Bu(t,e,n){const r=a=>Math.min(255,Math.max(0,Math.round(a)));return"#"+[r(t),r(e),r(n)].map(a=>a.toString(16).padStart(2,"0")).join("")}function Tg(t){const e=Ui(t);if(!e)return 0;const[n,r,a]=[e.r,e.g,e.b].map(i=>(i/=255,i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4)));return .2126*n+.7152*r+.0722*a}function pu(t,e){const n=Tg(t),r=Tg(e);return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}function Od(t,e,n){t/=255,e/=255,n/=255;const r=Math.max(t,e,n),a=Math.min(t,e,n);let i=0,s=0;const o=(r+a)/2;if(r!==a){const l=r-a;switch(s=o>.5?l/(2-r-a):l/(r+a),r){case t:i=(e-n)/l+(e<n?6:0);break;case e:i=(n-t)/l+2;break;default:i=(t-e)/l+4;break}i/=6}return{h:i,s,l:o}}function Sf(t,e,n){if(e===0){const s=Math.round(n*255);return{r:s,g:s,b:s}}const r=(s,o,l)=>(l<0&&(l+=1),l>1&&(l-=1),l<1/6?s+(o-s)*6*l:l<1/2?o:l<2/3?s+(o-s)*(2/3-l)*6:s),a=n<.5?n*(1+e):n+e-n*e,i=2*n-a;return{r:Math.round(r(i,a,t+1/3)*255),g:Math.round(r(i,a,t)*255),b:Math.round(r(i,a,t-1/3)*255)}}const Po=t=>Math.min(1,Math.max(0,t));function gu(t,e){const n=Ui(t);if(!n)return t;const{h:r,s:a,l:i}=Od(n.r,n.g,n.b),s=((r*360+e)%360+360)%360/360,o=Sf(s,a,i);return Bu(o.r,o.g,o.b)}function xb(t,e){const n=Ui(t);if(!n)return t;const{h:r,s:a,l:i}=Od(n.r,n.g,n.b),s=Sf(r,a,Po(i+e));return Bu(s.r,s.g,s.b)}function Wr(t,e,n){const r=Ui(t),a=Ui(e);if(!r||!a)return t;const i=Po(n);return Bu(r.r*i+a.r*(1-i),r.g*i+a.g*(1-i),r.b*i+a.b*(1-i))}function ra(t,e){const n=Ui(t);return n?`rgba(${n.r}, ${n.g}, ${n.b}, ${e})`:`rgba(255,255,255,${e})`}function zd(t){const e=Ui(t);return e?`${e.r}, ${e.g}, ${e.b}`:"34, 221, 255"}function Ng(t){const e=t.trim(),n=e.replace(/^#/,"");if(e.startsWith("#")||/^[0-9a-fA-F]{3}$|^[0-9a-fA-F]{6}$/.test(n))return/^[0-9a-fA-F]{3}$/.test(n)?{r:parseInt(n[0]+n[0],16),g:parseInt(n[1]+n[1],16),b:parseInt(n[2]+n[2],16),a:1}:/^[0-9a-fA-F]{6}$/.test(n)?{r:parseInt(n.slice(0,2),16),g:parseInt(n.slice(2,4),16),b:parseInt(n.slice(4,6),16),a:1}:null;const r=e.match(/^rgba?\(([^)]+)\)$/i);if(r){const i=r[1].split(",").map(l=>Number(l.trim()));if(i.length<3||i.slice(0,3).some(Number.isNaN))return null;const s=i[3]!==void 0&&!Number.isNaN(i[3])?Math.min(1,Math.max(0,i[3])):1,o=l=>Math.min(255,Math.max(0,Math.round(l)));return{r:o(i[0]),g:o(i[1]),b:o(i[2]),a:s}}const a=e.match(/^hsla?\(([^)]+)\)$/i);if(a){const i=a[1].split(",").map(f=>Number(f.trim().replace(/%$/,"")));if(i.length<3||i.slice(0,3).some(Number.isNaN))return null;const s=(i[0]%360+360)%360/360,o=Po(i[1]/100),l=Po(i[2]/100),u=i[3]!==void 0&&!Number.isNaN(i[3])?Po(i[3]):1;return{...Sf(s,o,l),a:u}}return null}function ar(t,e){const n=t?Ng(t):null;return n?Bu(n.r,n.g,n.b):e}function yo(t,e,n=4.5){const r=Ui(t);if(!r)return t;let{l:a}=Od(r.r,r.g,r.b);const{h:i,s}=Od(r.r,r.g,r.b);let o=t,l=pu(o,e);if(l>=n)return o;const u=Tg(e)<.5;for(;l<n&&a>0&&a<1;){a+=u?.01:-.01;const d=Sf(i,s,Po(a));o=Bu(d.r,d.g,d.b),l=pu(o,e)}return o}const BP=["--wairon-page-bg","--wairon-app-bg","--wairon-panel-bg","--wairon-panel-bg-strong","--wairon-panel-bg-soft","--wairon-panel-bg-hover","--wairon-header-bg","--wairon-sidebar-bg","--wairon-menu-bg","--wairon-section-bg","--wairon-primary","--wairon-primary-strong","--wairon-primary-contrast","--wairon-primary-rgb","--wairon-secondary","--wairon-secondary-rgb","--wairon-accent","--wairon-brand-text-bg","--wairon-text","--wairon-text-muted","--wairon-text-subtle","--wairon-text-inverse","--wairon-border","--wairon-border-strong","--wairon-border-muted","--wairon-shadow","--wairon-shell-shadow","--wairon-focus-ring","--wairon-ok","--wairon-warn","--wairon-bad"];function Pg(t){return t.custom===!0}const Mu=[{id:"waffler",label:"Waffler",description:"Cyan, violet, and pink brand palette.",swatches:["#22ddff","#8b5cf6","#ec4899"],defaultMode:"dark"},{id:"syw-apps",label:"SYW Apps",description:"SYW blue with complementary accents.",swatches:["#0256b8","#02b864","#b85f02"],defaultMode:"dark"},{id:"neutral",label:"Neutral",description:"Work-focused blue and gray.",swatches:["#2563eb","#111827","#f9fafb"],defaultMode:"light"}],MP=[{id:"system",label:"System"},{id:"light",label:"Light"},{id:"dark",label:"Dark"},{id:"high-contrast",label:"Contrast"}],eC="waffler",OP="dark";function tC(t=[]){return[...Mu,...t]}function mu(t,e=[]){return tC(e).find(n=>n.id===t)??Mu[0]}function Uo(t){var n;return t!=="system"?t:typeof window<"u"&&((n=window.matchMedia)==null?void 0:n.call(window,"(prefers-color-scheme: dark)").matches)?"dark":"light"}function wb(t,e){const n=e==="high-contrast",r=e==="light",a=gu(t,180),i=gu(t,120),s=r?Wr("#ffffff",t,.965):n?"#000000":Wr("#0b1120",t,.94),o=r?Wr("#ffffff",t,.985):n?"#000000":Wr("#111827",t,.92),l=r?Wr("#f1f5f9",t,.975):n?"#050505":Wr("#0f172a",t,.9),u=r?ra(t,.055):n?"rgba(255,255,255,0.08)":ra(t,.08),d=r?ra(t,.085):n?"rgba(255,255,255,0.16)":ra(t,.12),f=r?"#111827":"#f9fafb",h=r?Wr("#475569",t,.88):Wr("#cbd5e1",t,.95),v=r?Wr("#64748b",t,.82):Wr("#94a3b8",t,.92),p=r?"rgba(15, 23, 42, 0.16)":n?"#ffffff":ra(t,.24),y=r?"rgba(15, 23, 42, 0.34)":n?"#ffffff":ra(t,.58),b=r?"rgba(15, 23, 42, 0.10)":n?"rgba(255,255,255,0.46)":"rgba(148,163,184,0.16)",m=n?"none":r?"0 12px 28px rgba(15, 23, 42, 0.12)":"0 14px 32px rgba(0,0,0,0.34)",g=n?"1px 0 0 #ffffff":r?"1px 0 0 rgba(15, 23, 42, 0.10)":`1px 0 0 ${ra(t,.16)}`,w=n?"0 0 0 3px #ffffff":`0 0 0 3px ${ra(t,r?.24:.34)}`;return{"--wairon-page-bg":s,"--wairon-app-bg":s,"--wairon-panel-bg":o,"--wairon-panel-bg-strong":l,"--wairon-panel-bg-soft":u,"--wairon-panel-bg-hover":d,"--wairon-header-bg":r?"linear-gradient(180deg, rgba(255,255,255,0.96), rgba(241,245,249,0.98))":n?"#000000":`linear-gradient(135deg, ${l} 0%, ${o} 100%)`,"--wairon-sidebar-bg":r?"linear-gradient(180deg, rgba(255,255,255,0.96), rgba(241,245,249,0.98))":n?"#000000":`linear-gradient(180deg, ${ra(t,.12)} 0%, ${ra("#0b1120",.98)} 100%)`,"--wairon-menu-bg":r?"linear-gradient(135deg, #ffffff, #f8fafc)":n?"#000000":`linear-gradient(135deg, ${l}, ${o})`,"--wairon-section-bg":`linear-gradient(135deg, ${ra(t,r?.08:.1)}, ${ra(a,r?.08:.1)})`,"--wairon-primary":t,"--wairon-primary-strong":r?xb(t,-.08):xb(t,.14),"--wairon-primary-contrast":yo("#ffffff",t,4.5),"--wairon-primary-rgb":zd(t),"--wairon-secondary":a,"--wairon-secondary-rgb":zd(a),"--wairon-accent":i,"--wairon-brand-text-bg":`linear-gradient(135deg, ${t} 0%, ${i} 60%, ${a} 100%)`,"--wairon-text":f,"--wairon-text-muted":h,"--wairon-text-subtle":v,"--wairon-text-inverse":r?"#ffffff":"#0b1120","--wairon-border":p,"--wairon-border-strong":y,"--wairon-border-muted":b,"--wairon-shadow":m,"--wairon-shell-shadow":g,"--wairon-focus-ring":w,"--wairon-ok":"#34d399","--wairon-warn":"#fbbf24","--wairon-bad":"#f43f5e"}}function Fd(t,e){var i;if(!Pg(t))return wb(t.swatches[0],e);const n={...t.variables,...((i=t.modeVariables)==null?void 0:i[e])??{}},r=ar(n["--wairon-primary"]??t.swatches[0],Mu[0].swatches[0]),a={...wb(r,e),...n};return a["--wairon-primary-rgb"]=zd(ar(a["--wairon-primary"],r)),a["--wairon-secondary-rgb"]=zd(ar(a["--wairon-secondary"],gu(r,180))),n["--wairon-primary-contrast"]||(a["--wairon-primary-contrast"]=yo("#ffffff",ar(a["--wairon-primary"],r),4.5)),a}function kb(t,e,n=[]){const r=mu(t,n),a=Uo(e),i=Fd(r,a),s=document.documentElement;for(const[o,l]of Object.entries(i))s.style.setProperty(o,l);s.dataset.mode=a,s.dataset.theme=r.id}function nC(){return`custom:${typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`}`}function rC(t,e){return Es({id:nC(),label:`${t.label} Custom`,description:"Locally stored custom palette.",swatches:[...t.swatches],defaultMode:e,custom:!0,variables:Pg(t)?{...t.variables}:{},modeVariables:Pg(t)?Object.fromEntries(Object.entries(t.modeVariables??{}).map(([n,r])=>[n,{...r}])):{}})}function zP(t){return Es({...t,id:nC(),label:`${t.label} Copy`,swatches:[...t.swatches],variables:{...t.variables},modeVariables:Object.fromEntries(Object.entries(t.modeVariables??{}).map(([e,n])=>[e,{...n}]))})}const Eb=t=>{const e={...t};delete e["--wairon-primary-rgb"],delete e["--wairon-secondary-rgb"];for(const n of Object.keys(e))e[n]||delete e[n];return e};function Es(t){var i;const e=Eb(t.variables??{}),n=ar(e["--wairon-primary"]??((i=t.swatches)==null?void 0:i[0]),Mu[0].swatches[0]),r=[n,ar(e["--wairon-secondary"],gu(n,180)),ar(e["--wairon-accent"],gu(n,120))],a=Object.fromEntries(Object.entries(t.modeVariables??{}).map(([s,o])=>[s,Eb(o??{})]).filter(([,s])=>Object.keys(s).length>0));return{...t,custom:!0,swatches:r,variables:e,modeVariables:a}}function FP(t){if(!Array.isArray(t))return[];const e=[];for(const n of t){if(!n||typeof n!="object")continue;const r=n;if(typeof r.id!="string"||!r.id.startsWith("custom:"))continue;const a=o=>{if(!o||typeof o!="object")return{};const l={};for(const u of BP){const d=o[u];typeof d=="string"&&d&&(l[u]=d)}return l},i={};if(r.modeVariables&&typeof r.modeVariables=="object")for(const o of["light","dark","high-contrast"]){const l=r.modeVariables[o];l&&(i[o]=a(l))}const s=Array.isArray(r.swatches)?r.swatches.filter(o=>typeof o=="string"):[];e.push(Es({id:r.id,label:typeof r.label=="string"&&r.label?r.label:"Custom theme",description:typeof r.description=="string"?r.description:"",swatches:[s[0]??Mu[0].swatches[0],s[1]??"",s[2]??""],defaultMode:r.defaultMode==="light"||r.defaultMode==="dark"||r.defaultMode==="high-contrast"?r.defaultMode:"dark",custom:!0,variables:a(r.variables),modeVariables:i}))}return e}const aC="wairon-ui-settings";function _P(){const t={themeId:eC,appearance:OP,sidebarCollapsed:!1,customThemes:[]};try{const e=localStorage.getItem(aC);if(!e)return t;const n={...t,...JSON.parse(e)};return n.customThemes=FP(n.customThemes),n}catch{return t}}const iC=A.createContext(null),Ou=()=>{const t=A.useContext(iC);if(!t)throw new Error("useSettings outside SettingsProvider");return t};function $P({children:t}){const[e,n]=A.useState(_P);A.useEffect(()=>{kb(e.themeId,e.appearance,e.customThemes)},[e.themeId,e.appearance,e.customThemes]),A.useEffect(()=>{if(e.appearance!=="system"||!window.matchMedia)return;const o=window.matchMedia("(prefers-color-scheme: dark)"),l=()=>kb(e.themeId,e.appearance,e.customThemes);return o.addEventListener("change",l),()=>o.removeEventListener("change",l)},[e.appearance,e.themeId,e.customThemes]),A.useEffect(()=>{try{localStorage.setItem(aC,JSON.stringify(e))}catch{}},[e]);const r=A.useCallback(o=>n(l=>({...l,themeId:o})),[]),a=A.useCallback(o=>n(l=>({...l,appearance:o})),[]),i=A.useCallback(()=>n(o=>({...o,sidebarCollapsed:!o.sidebarCollapsed})),[]),s=A.useCallback(o=>n(l=>({...l,customThemes:o})),[]);return c.jsx(iC.Provider,{value:{...e,setThemeId:r,setAppearance:a,toggleSidebar:i,setCustomThemes:s},children:t})}const sC=A.createContext({subscribe:()=>()=>{}}),oC=A.createContext("connecting"),VP=()=>A.useContext(sC),UP=()=>A.useContext(oC),qP=2e4,HP=3;function WP(t){const e=A.useRef(new Map),n=A.useRef(null),r=A.useRef(0),a=A.useRef(!1),[i,s]=A.useState("connecting"),o=A.useCallback(()=>[...e.current.entries()].filter(([,f])=>f.size>0).map(([f])=>f),[]),l=A.useCallback(()=>{const f=n.current;f&&f.readyState===WebSocket.OPEN&&f.send(JSON.stringify({type:"subscribe",channels:o()}))},[o]);A.useEffect(()=>{a.current=!1;let f,h,v=!1;const p=()=>{h&&clearInterval(h),h=void 0,v=!1},y=()=>{if(a.current)return;const m=r.current++;s(m>=HP?"offline":"connecting");const g=Math.min(3e4,1e3*2**m);f=setTimeout(b,g)},b=()=>{if(a.current)return;const m=window.location.protocol==="https:"?"wss":"ws";let g;try{g=new WebSocket(`${m}://${window.location.host}/web/ws`)}catch{y();return}n.current=g,g.onopen=()=>{r.current=0,v=!1,s("connected"),l(),p(),h=setInterval(()=>{if(g.readyState===WebSocket.OPEN){if(v){try{g.close()}catch{}return}try{g.send(JSON.stringify({type:"ping"})),v=!0}catch{}}},qP)},g.onmessage=w=>{var E;v=!1;let x;try{x=JSON.parse(String(w.data))}catch{return}x.type==="change"&&typeof x.channel=="string"&&((E=e.current.get(x.channel))==null||E.forEach(S=>S()))},g.onclose=()=>{p(),n.current===g&&(n.current=null),!a.current&&y()},g.onerror=()=>{try{g.close()}catch{}}};return b(),()=>{var m;a.current=!0,f&&clearTimeout(f),p();try{(m=n.current)==null||m.close()}catch{}}},[l]);const u=A.useCallback((f,h)=>{for(const v of f){let p=e.current.get(v);p||(p=new Set,e.current.set(v,p)),p.add(h)}return l(),()=>{for(const v of f){const p=e.current.get(v);p&&(p.delete(h),p.size===0&&e.current.delete(v))}l()}},[l]),d=A.useMemo(()=>({subscribe:u}),[u]);return c.jsx(sC.Provider,{value:d,children:c.jsx(oC.Provider,{value:i,children:t.children})})}function lC(t){const[e,n]=A.useState(!1),[r,a]=A.useState(!1),i=A.useRef(null),[s,o]=A.useState(null),l=A.useRef(void 0),u=e||r;function d(){l.current&&clearTimeout(l.current),n(!0)}function f(){l.current&&clearTimeout(l.current),l.current=setTimeout(()=>n(!1),140)}return A.useLayoutEffect(()=>{if(!u||!i.current)return;const h=()=>{const v=i.current;if(!v)return;const p=v.getBoundingClientRect(),y=340,b=Math.max(8,Math.min(p.right-y,window.innerWidth-y-8));o({top:p.bottom+8,left:b})};return h(),window.addEventListener("scroll",h,!0),window.addEventListener("resize",h),()=>{window.removeEventListener("scroll",h,!0),window.removeEventListener("resize",h)}},[u]),A.useEffect(()=>{if(!r)return;function h(v){v.key==="Escape"&&(a(!1),v.stopPropagation())}return document.addEventListener("keydown",h,!0),()=>document.removeEventListener("keydown",h,!0)},[r]),A.useEffect(()=>()=>{l.current&&clearTimeout(l.current)},[]),c.jsxs("span",{className:"infotip",children:[c.jsx("button",{ref:i,type:"button",className:"infotip-icon","aria-label":t.label??"More information","aria-expanded":u,onMouseEnter:d,onMouseLeave:f,onFocus:d,onBlur:f,onClick:h=>{h.preventDefault(),a(v=>!v)},children:"i"}),u&&s&&zE.createPortal(c.jsx("span",{className:"infotip-bubble",role:"tooltip",style:{top:s.top,left:s.left},onMouseEnter:d,onMouseLeave:f,onMouseDown:h=>h.stopPropagation(),children:t.children}),document.body)]})}function St(t,e,n){const[r,a]=A.useState(void 0),[i,s]=A.useState(!0),[o,l]=A.useState(void 0),[u,d]=A.useState(0),f=A.useCallback(()=>d(p=>p+1),[]),h=VP();A.useEffect(()=>{let p=!0;return s(!0),l(void 0),t().then(y=>{p&&a(y)}).catch(y=>{p&&l(y instanceof Error?y.message:String(y))}).finally(()=>{p&&s(!1)}),()=>{p=!1}},[...e,u]);const v=(n??[]).join("|");return A.useEffect(()=>{if(!v)return;let p;const y=()=>{p&&clearTimeout(p),p=setTimeout(f,150)},b=h.subscribe(v.split("|"),y);return()=>{p&&clearTimeout(p),b()}},[v,h,f]),{data:r,loading:i,error:o,reload:f}}function ct(t){const{children:e,onClick:n,variant:r="default",disabled:a,type:i="button",title:s,size:o="md"}=t;return c.jsx("button",{type:i,className:`btn btn-${r} btn-${o}`,onClick:n,disabled:a,title:s,children:e})}function Tt(t){const{children:e,action:n,variant:r="default",disabled:a,onError:i,size:s="md"}=t,[o,l]=A.useState(!1);async function u(){l(!0);try{await n()}catch(d){i==null||i(d instanceof Error?d.message:String(d))}finally{l(!1)}}return c.jsx(ct,{variant:r,disabled:a||o,onClick:u,size:s,children:o?c.jsx(Tf,{inline:!0}):e})}function X(t){return c.jsxs("label",{className:`field${t.highlight?` field-flag field-flag-${t.highlight}`:""}`,"data-field":t.fieldKey,children:[c.jsxs("span",{className:"field-label",children:[t.label,t.info!=null&&c.jsx(lC,{children:t.info})]}),t.children,t.hint&&c.jsx("span",{className:"hint",children:t.hint})]})}function Be(t){return c.jsx("input",{className:"input",type:t.type??"text",value:t.value,placeholder:t.placeholder,disabled:t.disabled,onChange:e=>t.onChange(e.target.value)})}function yu(t){return c.jsxs("label",{className:"checkbox",children:[c.jsx("input",{type:"checkbox",checked:t.checked,disabled:t.disabled,onChange:e=>t.onChange(e.target.checked)}),c.jsxs("span",{className:"checkbox-body",children:[c.jsx("span",{className:"checkbox-label",children:t.label}),t.hint&&c.jsx("span",{className:"hint",children:t.hint})]})]})}function en(t){return c.jsx("select",{className:"input",value:t.value,disabled:t.disabled,onChange:e=>t.onChange(e.target.value),children:t.options.map(e=>c.jsx("option",{value:e.value,children:e.label},e.value))})}function wl(t){const{options:e,selected:n,onChange:r,placeholder:a="Select…",emptyLabel:i="No options available.",disabled:s}=t,[o,l]=A.useState(!1),[u,d]=A.useState(""),f=A.useRef(null);A.useEffect(()=>{if(!o)return;function g(x){f.current&&!f.current.contains(x.target)&&l(!1)}function w(x){x.key==="Escape"&&(l(!1),x.stopPropagation())}return document.addEventListener("mousedown",g),document.addEventListener("keydown",w,!0),()=>{document.removeEventListener("mousedown",g),document.removeEventListener("keydown",w,!0)}},[o]);const h=new Set(n),v=A.useMemo(()=>new Map(e.map(g=>[g.value,g])),[e]);function p(g){h.has(g)?r(n.filter(w=>w!==g)):r([...n,g])}const y=A.useMemo(()=>{const g=[],w=new Map;for(const x of e){const E=x.group??"";w.has(E)||(w.set(E,[]),g.push(E)),w.get(E).push(x)}return g.map(x=>({group:x,options:w.get(x)}))},[e]),b=u.trim().toLowerCase(),m=g=>!b||g.label.toLowerCase().includes(b)||g.value.toLowerCase().includes(b)||(g.group??"").toLowerCase().includes(b);return c.jsxs("div",{className:"msel",ref:f,children:[c.jsxs("button",{type:"button",className:"input msel-trigger",disabled:s,"aria-haspopup":"listbox","aria-expanded":o,onClick:()=>l(g=>!g),children:[n.length===0?c.jsx("span",{className:"msel-ph",children:a}):c.jsx("span",{className:"msel-chips",children:n.map(g=>{var w,x;return c.jsxs("span",{className:"msel-chip",children:[((w=v.get(g))==null?void 0:w.label)??g,!s&&c.jsx("span",{className:"msel-chip-x",role:"button","aria-label":`Remove ${((x=v.get(g))==null?void 0:x.label)??g}`,onClick:E=>{E.stopPropagation(),p(g)},children:"×"})]},g)})}),c.jsx("span",{className:"msel-caret","aria-hidden":!0,children:"▾"})]}),o&&!s&&c.jsxs("div",{className:"msel-pop",role:"listbox","aria-multiselectable":"true",children:[e.length>8&&c.jsx("input",{className:"input msel-search",autoFocus:!0,placeholder:"Filter…",value:u,onChange:g=>d(g.target.value)}),c.jsx("div",{className:"msel-list",children:e.length===0?c.jsx("div",{className:"msel-empty",children:i}):y.map(({group:g,options:w})=>{const x=w.filter(m);return x.length===0?null:c.jsxs("div",{className:"msel-group",children:[g&&c.jsx("div",{className:"msel-group-head",children:g}),x.map(E=>c.jsxs("label",{className:`msel-opt ${h.has(E.value)?"sel":""}`,children:[c.jsx("input",{type:"checkbox",checked:h.has(E.value),onChange:()=>p(E.value)}),c.jsxs("span",{className:"msel-opt-body",children:[c.jsx("span",{className:"msel-opt-label",children:E.label}),E.hint&&c.jsx("span",{className:"msel-opt-hint",children:E.hint})]})]},E.value))]},g||"_ungrouped")})})]})]})}function rt(t){return c.jsx("span",{className:`badge badge-${t.tone??"neutral"}`,children:t.children})}function jf(t){return c.jsx("div",{className:"tabstrip",role:"tablist",children:t.tabs.map(e=>c.jsx("button",{role:"tab","aria-selected":e.id===t.active,className:`tab ${e.id===t.active?"tab-active":""}`,onClick:()=>t.onSelect(e.id),children:e.label},e.id))})}function Vn(t){return t.rows.length===0?c.jsx(Nf,{children:t.empty??"Nothing here yet."}):c.jsx("div",{className:"table-wrap",children:c.jsxs("table",{className:"table",children:[c.jsx("thead",{children:c.jsx("tr",{children:t.columns.map(e=>c.jsx("th",{style:e.width?{width:e.width}:void 0,children:e.header},e.key))})}),c.jsx("tbody",{children:t.rows.map(e=>c.jsx("tr",{children:t.columns.map(n=>c.jsx("td",{children:n.cell(e)},n.key))},t.rowKey(e)))})]})})}function $n(t){return A.useEffect(()=>{function e(r){r.key==="Escape"&&t.onClose()}document.addEventListener("keydown",e);const n=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",e),document.body.style.overflow=n}},[t]),c.jsx("div",{className:"scrim",onMouseDown:t.onClose,children:c.jsxs("div",{className:`modal ${t.wide?"modal-wide":""}`,role:"dialog","aria-modal":"true",onMouseDown:e=>e.stopPropagation(),children:[c.jsxs("div",{className:"modal-head",children:[c.jsx("h3",{children:t.title}),c.jsx("button",{className:"icon-btn","aria-label":"Close",onClick:t.onClose,children:"×"})]}),c.jsx("div",{className:"modal-body",children:t.children}),t.footer&&c.jsx("div",{className:"modal-foot",children:t.footer})]})})}function li(t){const[e,n]=A.useState(!1);return c.jsxs(c.Fragment,{children:[c.jsx(ct,{variant:"danger",size:"sm",onClick:()=>n(!0),children:t.label}),e&&c.jsx($n,{title:t.title,onClose:()=>n(!1),footer:c.jsxs(c.Fragment,{children:[c.jsx(ct,{variant:"ghost",onClick:()=>n(!1),children:"Cancel"}),c.jsx(Tt,{variant:"danger",onError:t.onError,action:async()=>{var r;await t.action(),n(!1),(r=t.onDone)==null||r.call(t)},children:t.confirmLabel??"Delete"})]}),children:t.message})]})}function Tf(t){return c.jsx("span",{className:`spinner ${t.inline?"spinner-inline":""}`,"aria-label":"Loading"})}function Nf(t){return c.jsx("div",{className:"empty-state",children:t.children})}function uC(t){return c.jsxs("div",{className:"error-note",children:[c.jsx("span",{children:t.children}),t.onRetry&&c.jsx(ct,{size:"sm",variant:"ghost",onClick:t.onRetry,children:"Retry"})]})}function Xt(t){return t.state.loading&&t.state.data===void 0?c.jsx("div",{className:"pad",children:c.jsx(Tf,{})}):t.state.error&&t.state.data===void 0?c.jsx("div",{className:"pad",children:c.jsx(uC,{onRetry:t.state.reload,children:t.state.error})}):t.state.data===void 0?null:c.jsx(c.Fragment,{children:t.children(t.state.data)})}const cC=A.createContext({ok:()=>{},bad:()=>{}}),Dt=()=>A.useContext(cC);function KP(t){const[e,n]=A.useState([]),r=A.useRef(1),a=A.useCallback((s,o)=>{const l=r.current++;n(u=>[...u,{id:l,message:s,tone:o}]),setTimeout(()=>n(u=>u.filter(d=>d.id!==l)),4e3)},[]),i={ok:s=>a(s,"ok"),bad:s=>a(s,"bad")};return c.jsxs(cC.Provider,{value:i,children:[t.children,c.jsx("div",{className:"toast-stack",children:e.map(s=>c.jsx("div",{className:`toast toast-${s.tone}`,children:s.message},s.id))})]})}function dC(){const t=UP(),e=Dt(),n=A.useRef(!1);A.useEffect(()=>{t==="offline"&&!n.current?(n.current=!0,e.bad("Realtime updates are offline — views won't auto-refresh. If this instance is behind a reverse proxy, it must forward WebSocket upgrades to /web/ws.")):t==="connected"&&n.current&&(n.current=!1,e.ok("Realtime updates reconnected."))},[t,e]);const r=t==="connected"?"Live":t==="connecting"?"Connecting…":"Offline",a=t==="offline"?"Realtime updates are offline — the view will not auto-refresh. If this instance is behind a reverse proxy (e.g. NGINX), ensure it forwards the WebSocket Upgrade/Connection headers to /web/ws.":t==="connecting"?"Connecting to realtime updates…":"Realtime updates are live.";return c.jsxs("span",{className:`rt-status rt-${t}`,title:a,role:"status","aria-live":"polite",children:[c.jsx("span",{className:"rt-dot","aria-hidden":"true"}),c.jsx("span",{className:"rt-label",children:r})]})}function Cb({swatches:t}){return c.jsx("span",{className:"tmenu-pill",children:t.map((e,n)=>c.jsx("span",{style:{background:e}},`${n}-${e}`))})}function GP(t){const[e,n]=A.useState(!1),r=A.useRef(null);A.useEffect(()=>{if(!e)return;const i=o=>{var l;(l=r.current)!=null&&l.contains(o.target)||n(!1)},s=o=>o.key==="Escape"&&n(!1);return document.addEventListener("mousedown",i),document.addEventListener("keydown",s),()=>{document.removeEventListener("mousedown",i),document.removeEventListener("keydown",s)}},[e]);const a=t.options.find(i=>i.id===t.themeId)??t.options[0];return c.jsxs("div",{className:"tmenu",children:[c.jsxs("div",{className:"tmenu-head",children:[c.jsx("span",{className:"tmenu-label",children:t.label??"Appearance"}),t.onManageThemes&&c.jsx("button",{className:"tmenu-manage",onClick:t.onManageThemes,children:"Theme builder ↗"})]}),t.hint&&c.jsx("span",{className:"tmenu-hint",children:t.hint}),c.jsxs("div",{className:"tmenu-picker",ref:r,children:[c.jsxs("button",{className:`tmenu-trigger ${e?"is-open":""}`,onClick:()=>n(i=>!i),"aria-haspopup":"listbox","aria-expanded":e,children:[a&&c.jsx(Cb,{swatches:a.swatches}),c.jsxs("span",{className:"tmenu-opt-text",children:[c.jsx("span",{className:"tmenu-opt-name",children:(a==null?void 0:a.label)??"—"}),(a==null?void 0:a.description)&&c.jsx("span",{className:"tmenu-opt-desc",children:a.description})]}),c.jsx("span",{className:"tmenu-caret",children:"▾"})]}),e&&c.jsxs("div",{className:"tmenu-panel",role:"listbox",children:[t.options.map(i=>c.jsxs("button",{className:`tmenu-row ${i.id===t.themeId?"is-active":""}`,role:"option","aria-selected":i.id===t.themeId,onClick:()=>{t.onSelectTheme(i.id),n(!1)},children:[c.jsx(Cb,{swatches:i.swatches}),c.jsxs("span",{className:"tmenu-opt-text",children:[c.jsx("span",{className:"tmenu-opt-name",children:i.label}),i.description&&c.jsx("span",{className:"tmenu-opt-desc",children:i.description})]}),i.id===t.themeId&&c.jsx("span",{className:"tmenu-check",children:"✓"})]},i.id)),t.onCreateTheme&&c.jsx("button",{className:"tmenu-create",onClick:()=>{var i;n(!1),(i=t.onCreateTheme)==null||i.call(t)},children:"Create custom theme"})]})]}),c.jsx("div",{className:"tmenu-modes",children:t.modes.map(i=>c.jsx("button",{className:`tmenu-mode ${i.id===t.appearance?"is-active":""}`,title:i.description,onClick:()=>t.onSelectMode(i.id),children:i.label},i.id))})]})}function fC(t){const{themeId:e,appearance:n,customThemes:r,setThemeId:a,setAppearance:i,setCustomThemes:s}=Ou(),o=()=>{var u;const l=rC(mu(e,r),Uo(n));s([...r,l]),a(l.id),(u=t.onOpenBuilder)==null||u.call(t)};return c.jsx("div",{className:"hmenu-section",children:c.jsx(GP,{themeId:e,appearance:n,options:tC(r).map(l=>({...l,description:l.description||"Custom theme"})),modes:MP,onSelectTheme:a,onSelectMode:l=>i(l),onCreateTheme:t.onOpenBuilder?o:void 0,onManageThemes:t.onOpenBuilder})})}function hC(){const[t,e]=A.useState(!1),n=A.useRef(null);return A.useEffect(()=>{if(!t)return;const r=i=>{var s;(s=n.current)!=null&&s.contains(i.target)||e(!1)},a=i=>i.key==="Escape"&&e(!1);return document.addEventListener("mousedown",r),document.addEventListener("keydown",a),()=>{document.removeEventListener("mousedown",r),document.removeEventListener("keydown",a)}},[t]),c.jsxs("div",{className:"hmenu theme-cog",ref:n,children:[c.jsx("button",{className:`hmenu-trigger ${t?"is-open":""}`,onClick:()=>e(r=>!r),"aria-label":"Theme settings",title:"Theme settings",children:c.jsx("span",{className:"cog",children:"⚙"})}),t&&c.jsx("div",{className:"hmenu-pop",role:"menu",children:c.jsx(fC,{})})]})}const Ts=["project:read","project:create","project:write","project:admin","approval:decide","share:create"],vC=["inherit","yes","approval","no"];function Pf(t){if(t.displayName&&t.displayName.trim())return t.displayName;if(t.email&&t.email.trim())return t.email;const e=t.userId??"";return e.length>24?e.slice(0,10)+"…"+e.slice(-6):e||"unknown"}function Ns(t){var e;return Pf({displayName:t.displayName,email:t.email,userId:((e=t.subject)==null?void 0:e.userId)??t.id})}function YP(t){const[e,n]=A.useState(!1),r=A.useRef(null),a=Pr();A.useEffect(()=>{if(!e)return;const o=u=>{var d;(d=r.current)!=null&&d.contains(u.target)||n(!1)},l=u=>u.key==="Escape"&&n(!1);return document.addEventListener("mousedown",o),document.addEventListener("keydown",l),()=>{document.removeEventListener("mousedown",o),document.removeEventListener("keydown",l)}},[e]);const i=Pf(t.ctx.subject),s=i.charAt(0).toUpperCase();return c.jsxs("div",{className:"hmenu",ref:r,children:[c.jsxs("button",{className:`hmenu-trigger ${e?"is-open":""}`,onClick:()=>n(o=>!o),"aria-label":"Account & settings",children:[c.jsx("span",{className:"avatar",children:s}),c.jsx("span",{className:"hmenu-who",children:i}),t.ctx.isAdmin&&c.jsx("span",{className:"badge badge-accent",children:"admin"}),c.jsx("span",{className:"chevron",children:"▾"})]}),e&&c.jsxs("div",{className:"hmenu-pop",role:"menu",children:[c.jsxs("div",{className:"hmenu-head",children:[c.jsx("span",{className:"avatar avatar-lg",children:s}),c.jsxs("div",{className:"cell-stack",children:[c.jsx("strong",{children:i}),t.ctx.subject.email&&c.jsx("span",{className:"hint",children:t.ctx.subject.email}),c.jsxs("code",{className:"subtle",children:[t.ctx.subject.issuer,":",t.ctx.subject.kind]})]})]}),c.jsx(fC,{onOpenBuilder:()=>{n(!1),a("/themes")}}),c.jsx("div",{className:"hmenu-foot",children:c.jsx("button",{className:"btn btn-ghost btn-sm",onClick:t.onSignOut,children:"Sign out"})})]})]})}function XP({onSignedIn:t}){const[e,n]=A.useState(null),[r,a]=A.useState(""),[i,s]=A.useState(""),[o,l]=A.useState(""),[u,d]=A.useState(!1);A.useEffect(()=>{Et("/web/login-options").then(n).catch(()=>n({passwordLogin:!1,providers:[]}))},[]);async function f(){d(!0),l("");try{await yt("/web/login",{user:r,password:i}),t()}catch(p){l(p instanceof Error?p.message:"Sign-in failed."),d(!1)}}async function h(p){d(!0),l("");try{const{url:y}=await yt("/web/sso/start",{providerId:p,redirectUri:window.location.origin+"/web/sso/callback"});window.location.href=y}catch(y){l(y instanceof Error?y.message:"Sign-in failed."),d(!1)}}const v=e&&!e.passwordLogin&&e.providers.length===0;return c.jsxs("div",{className:"login-wrap",children:[c.jsx(hC,{}),c.jsxs("div",{className:"login-card",children:[c.jsx("div",{className:"brand",children:"wairon"}),!e&&c.jsx("p",{className:"hint",children:"Loading sign-in options…"}),v&&c.jsx("p",{className:"hint",children:"No sign-in method is configured on this instance."}),(e==null?void 0:e.passwordLogin)&&c.jsxs("div",{className:"stack",children:[c.jsx("input",{className:"input",placeholder:"Admin username",value:r,onChange:p=>a(p.target.value)}),c.jsx("input",{className:"input",type:"password",placeholder:"Password",value:i,onChange:p=>s(p.target.value),onKeyDown:p=>p.key==="Enter"&&f()}),c.jsx("button",{className:"btn btn-primary",disabled:u,onClick:f,children:"Sign in"})]}),e&&e.providers.length>0&&c.jsxs("div",{className:"stack",children:[e.passwordLogin&&c.jsx("div",{className:"or",children:"or"}),e.providers.map(p=>c.jsxs("button",{className:"btn",disabled:u,onClick:()=>h(p.id),children:["Sign in with ",p.displayName]},p.id))]}),o&&c.jsx("p",{className:"err",children:o})]})]})}function pC(t){return Uo(t)==="light"?"light":"syw"}function gC(t,e,n=[]){const r=Uo(e),a=mu(t,n),i=a.swatches[0],s=Fd(a,r),o=a.swatches[1],l=r==="light"||r==="high-contrast"?"none":`linear-gradient(135deg, ${Wr("#0b1120",i,.95)} 0%, ${Wr("#0b1120",o,.85)} 50%, ${Wr("#0b1120",o,.7)} 100%)`;return{"--bg":s["--wairon-page-bg"],"--chrome":s["--wairon-panel-bg"],"--chrome-border":s["--wairon-border"],"--ink":s["--wairon-text"],"--dim":s["--wairon-text-muted"],"--line":s["--wairon-border-muted"],"--input-bg":s["--wairon-panel-bg-soft"],"--hover-bg":s["--wairon-panel-bg-hover"],"--accent":s["--wairon-primary"],"--card":s["--wairon-panel-bg-soft"],"--danger":s["--wairon-bad"],"--warn":s["--wairon-warn"],"--syw-bg":s["--wairon-page-bg"],"--syw-deep-space":l,"--syw-deep-shadow":s["--wairon-shadow"],"--syw-glow":s["--wairon-focus-ring"],"--syw-primary-gradient":s["--wairon-brand-text-bg"]}}function Rg(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function QP(t){if(Array.isArray(t))return t}function ZP(t){if(Array.isArray(t))return Rg(t)}function es(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function JP(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,yC(r.key),r)}}function ts(t,e,n){return e&&JP(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function _r(t,e){var n=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=Jm(t))||e){n&&(t=n);var r=0,a=function(){};return{s:a,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(l){throw l},f:a}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
74
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i,s=!0,o=!1;return{s:function(){n=n.call(t)},n:function(){var l=n.next();return s=l.done,l},e:function(l){o=!0,i=l},f:function(){try{s||n.return==null||n.return()}finally{if(o)throw i}}}}function mC(t,e,n){return(e=yC(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function eR(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function tR(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,a,i,s,o=[],l=!0,u=!1;try{if(i=(n=n.call(t)).next,e===0){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(o.push(r.value),o.length!==e);l=!0);}catch(d){u=!0,a=d}finally{try{if(!l&&n.return!=null&&(s=n.return(),Object(s)!==s))return}finally{if(u)throw a}}return o}}function nR(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
75
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function rR(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
76
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Fn(t,e){return QP(t)||tR(t,e)||Jm(t,e)||nR()}function _d(t){return ZP(t)||eR(t)||Jm(t)||rR()}function aR(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}function yC(t){var e=aR(t,"string");return typeof e=="symbol"?e:e+""}function Gn(t){"@babel/helpers - typeof";return Gn=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},Gn(t)}function Jm(t,e){if(t){if(typeof t=="string")return Rg(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Rg(t,e):void 0}}var qn=typeof window>"u"?null:window,Sb=qn?qn.navigator:null;qn&&qn.document;var iR=Gn(""),bC=Gn({}),sR=Gn(function(){}),oR=typeof HTMLElement>"u"?"undefined":Gn(HTMLElement),zu=function(e){return e&&e.instanceString&&En(e.instanceString)?e.instanceString():null},ft=function(e){return e!=null&&Gn(e)==iR},En=function(e){return e!=null&&Gn(e)===sR},an=function(e){return!Xr(e)&&(Array.isArray?Array.isArray(e):e!=null&&e instanceof Array)},Wt=function(e){return e!=null&&Gn(e)===bC&&!an(e)&&e.constructor===Object},lR=function(e){return e!=null&&Gn(e)===bC},_e=function(e){return e!=null&&Gn(e)===Gn(1)&&!isNaN(e)},uR=function(e){return _e(e)&&Math.floor(e)===e},$d=function(e){if(oR!=="undefined")return e!=null&&e instanceof HTMLElement},Xr=function(e){return Fu(e)||xC(e)},Fu=function(e){return zu(e)==="collection"&&e._private.single},xC=function(e){return zu(e)==="collection"&&!e._private.single},ey=function(e){return zu(e)==="core"},wC=function(e){return zu(e)==="stylesheet"},cR=function(e){return zu(e)==="event"},qi=function(e){return e==null?!0:!!(e===""||e.match(/^\s+$/))},dR=function(e){return typeof HTMLElement>"u"?!1:e instanceof HTMLElement},fR=function(e){return Wt(e)&&_e(e.x1)&&_e(e.x2)&&_e(e.y1)&&_e(e.y2)},hR=function(e){return lR(e)&&En(e.then)},vR=function(){return Sb&&Sb.userAgent.match(/msie|trident|edge/i)},qo=function(e,n){n||(n=function(){if(arguments.length===1)return arguments[0];if(arguments.length===0)return"undefined";for(var i=[],s=0;s<arguments.length;s++)i.push(arguments[s]);return i.join("$")});var r=function(){var i=this,s=arguments,o,l=n.apply(i,s),u=r.cache;return(o=u[l])||(o=u[l]=e.apply(i,s)),o};return r.cache={},r},ty=qo(function(t){return t.replace(/([A-Z])/g,function(e){return"-"+e.toLowerCase()})}),Rf=qo(function(t){return t.replace(/(-\w)/g,function(e){return e[1].toUpperCase()})}),kC=qo(function(t,e){return t+e[0].toUpperCase()+e.substring(1)},function(t,e){return t+"$"+e}),jb=function(e){return qi(e)?e:e.charAt(0).toUpperCase()+e.substring(1)},Ti=function(e,n){return e.slice(-1*n.length)===n},Kn="(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))",pR="rgb[a]?\\(("+Kn+"[%]?)\\s*,\\s*("+Kn+"[%]?)\\s*,\\s*("+Kn+"[%]?)(?:\\s*,\\s*("+Kn+"))?\\)",gR="rgb[a]?\\((?:"+Kn+"[%]?)\\s*,\\s*(?:"+Kn+"[%]?)\\s*,\\s*(?:"+Kn+"[%]?)(?:\\s*,\\s*(?:"+Kn+"))?\\)",mR="hsl[a]?\\(("+Kn+")\\s*,\\s*("+Kn+"[%])\\s*,\\s*("+Kn+"[%])(?:\\s*,\\s*("+Kn+"))?\\)",yR="hsl[a]?\\((?:"+Kn+")\\s*,\\s*(?:"+Kn+"[%])\\s*,\\s*(?:"+Kn+"[%])(?:\\s*,\\s*(?:"+Kn+"))?\\)",bR="\\#[0-9a-fA-F]{3}",xR="\\#[0-9a-fA-F]{6}",EC=function(e,n){return e<n?-1:e>n?1:0},wR=function(e,n){return-1*EC(e,n)},pt=Object.assign!=null?Object.assign.bind(Object):function(t){for(var e=arguments,n=1;n<e.length;n++){var r=e[n];if(r!=null)for(var a=Object.keys(r),i=0;i<a.length;i++){var s=a[i];t[s]=r[s]}}return t},kR=function(e){if(!(!(e.length===4||e.length===7)||e[0]!=="#")){var n=e.length===4,r,a,i,s=16;return n?(r=parseInt(e[1]+e[1],s),a=parseInt(e[2]+e[2],s),i=parseInt(e[3]+e[3],s)):(r=parseInt(e[1]+e[2],s),a=parseInt(e[3]+e[4],s),i=parseInt(e[5]+e[6],s)),[r,a,i]}},ER=function(e){var n,r,a,i,s,o,l,u;function d(p,y,b){return b<0&&(b+=1),b>1&&(b-=1),b<1/6?p+(y-p)*6*b:b<1/2?y:b<2/3?p+(y-p)*(2/3-b)*6:p}var f=new RegExp("^"+mR+"$").exec(e);if(f){if(r=parseInt(f[1]),r<0?r=(360- -1*r%360)%360:r>360&&(r=r%360),r/=360,a=parseFloat(f[2]),a<0||a>100||(a=a/100,i=parseFloat(f[3]),i<0||i>100)||(i=i/100,s=f[4],s!==void 0&&(s=parseFloat(s),s<0||s>1)))return;if(a===0)o=l=u=Math.round(i*255);else{var h=i<.5?i*(1+a):i+a-i*a,v=2*i-h;o=Math.round(255*d(v,h,r+1/3)),l=Math.round(255*d(v,h,r)),u=Math.round(255*d(v,h,r-1/3))}n=[o,l,u,s]}return n},CR=function(e){var n,r=new RegExp("^"+pR+"$").exec(e);if(r){n=[];for(var a=[],i=1;i<=3;i++){var s=r[i];if(s[s.length-1]==="%"&&(a[i]=!0),s=parseFloat(s),a[i]&&(s=s/100*255),s<0||s>255)return;n.push(Math.floor(s))}var o=a[1]||a[2]||a[3],l=a[1]&&a[2]&&a[3];if(o&&!l)return;var u=r[4];if(u!==void 0){if(u=parseFloat(u),u<0||u>1)return;n.push(u)}}return n},SR=function(e){return jR[e.toLowerCase()]},CC=function(e){return(an(e)?e:null)||SR(e)||kR(e)||CR(e)||ER(e)},jR={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]},SC=function(e){for(var n=e.map,r=e.keys,a=r.length,i=0;i<a;i++){var s=r[i];if(Wt(s))throw Error("Tried to set map with object key");i<r.length-1?(n[s]==null&&(n[s]={}),n=n[s]):n[s]=e.value}},jC=function(e){for(var n=e.map,r=e.keys,a=r.length,i=0;i<a;i++){var s=r[i];if(Wt(s))throw Error("Tried to get map with object key");if(n=n[s],n==null)return n}return n},Tc=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function _u(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Hh,Tb;function $u(){if(Tb)return Hh;Tb=1;function t(e){var n=typeof e;return e!=null&&(n=="object"||n=="function")}return Hh=t,Hh}var Wh,Nb;function TR(){if(Nb)return Wh;Nb=1;var t=typeof Tc=="object"&&Tc&&Tc.Object===Object&&Tc;return Wh=t,Wh}var Kh,Pb;function If(){if(Pb)return Kh;Pb=1;var t=TR(),e=typeof self=="object"&&self&&self.Object===Object&&self,n=t||e||Function("return this")();return Kh=n,Kh}var Gh,Rb;function NR(){if(Rb)return Gh;Rb=1;var t=If(),e=function(){return t.Date.now()};return Gh=e,Gh}var Yh,Ib;function PR(){if(Ib)return Yh;Ib=1;var t=/\s/;function e(n){for(var r=n.length;r--&&t.test(n.charAt(r)););return r}return Yh=e,Yh}var Xh,Lb;function RR(){if(Lb)return Xh;Lb=1;var t=PR(),e=/^\s+/;function n(r){return r&&r.slice(0,t(r)+1).replace(e,"")}return Xh=n,Xh}var Qh,Ab;function ny(){if(Ab)return Qh;Ab=1;var t=If(),e=t.Symbol;return Qh=e,Qh}var Zh,Db;function IR(){if(Db)return Zh;Db=1;var t=ny(),e=Object.prototype,n=e.hasOwnProperty,r=e.toString,a=t?t.toStringTag:void 0;function i(s){var o=n.call(s,a),l=s[a];try{s[a]=void 0;var u=!0}catch{}var d=r.call(s);return u&&(o?s[a]=l:delete s[a]),d}return Zh=i,Zh}var Jh,Bb;function LR(){if(Bb)return Jh;Bb=1;var t=Object.prototype,e=t.toString;function n(r){return e.call(r)}return Jh=n,Jh}var ev,Mb;function TC(){if(Mb)return ev;Mb=1;var t=ny(),e=IR(),n=LR(),r="[object Null]",a="[object Undefined]",i=t?t.toStringTag:void 0;function s(o){return o==null?o===void 0?a:r:i&&i in Object(o)?e(o):n(o)}return ev=s,ev}var tv,Ob;function AR(){if(Ob)return tv;Ob=1;function t(e){return e!=null&&typeof e=="object"}return tv=t,tv}var nv,zb;function Vu(){if(zb)return nv;zb=1;var t=TC(),e=AR(),n="[object Symbol]";function r(a){return typeof a=="symbol"||e(a)&&t(a)==n}return nv=r,nv}var rv,Fb;function DR(){if(Fb)return rv;Fb=1;var t=RR(),e=$u(),n=Vu(),r=NaN,a=/^[-+]0x[0-9a-f]+$/i,i=/^0b[01]+$/i,s=/^0o[0-7]+$/i,o=parseInt;function l(u){if(typeof u=="number")return u;if(n(u))return r;if(e(u)){var d=typeof u.valueOf=="function"?u.valueOf():u;u=e(d)?d+"":d}if(typeof u!="string")return u===0?u:+u;u=t(u);var f=i.test(u);return f||s.test(u)?o(u.slice(2),f?2:8):a.test(u)?r:+u}return rv=l,rv}var av,_b;function BR(){if(_b)return av;_b=1;var t=$u(),e=NR(),n=DR(),r="Expected a function",a=Math.max,i=Math.min;function s(o,l,u){var d,f,h,v,p,y,b=0,m=!1,g=!1,w=!0;if(typeof o!="function")throw new TypeError(r);l=n(l)||0,t(u)&&(m=!!u.leading,g="maxWait"in u,h=g?a(n(u.maxWait)||0,l):h,w="trailing"in u?!!u.trailing:w);function x(D){var $=d,H=f;return d=f=void 0,b=D,v=o.apply(H,$),v}function E(D){return b=D,p=setTimeout(T,l),m?x(D):v}function S(D){var $=D-y,H=D-b,V=l-$;return g?i(V,h-H):V}function C(D){var $=D-y,H=D-b;return y===void 0||$>=l||$<0||g&&H>=h}function T(){var D=e();if(C(D))return N(D);p=setTimeout(T,S(D))}function N(D){return p=void 0,w&&d?x(D):(d=f=void 0,v)}function P(){p!==void 0&&clearTimeout(p),b=0,d=y=f=p=void 0}function R(){return p===void 0?v:N(e())}function I(){var D=e(),$=C(D);if(d=arguments,f=this,y=D,$){if(p===void 0)return E(y);if(g)return clearTimeout(p),p=setTimeout(T,l),x(y)}return p===void 0&&(p=setTimeout(T,l)),v}return I.cancel=P,I.flush=R,I}return av=s,av}var MR=BR(),Uu=_u(MR),iv=qn?qn.performance:null,NC=iv&&iv.now?function(){return iv.now()}:function(){return Date.now()},OR=function(){if(qn){if(qn.requestAnimationFrame)return function(t){qn.requestAnimationFrame(t)};if(qn.mozRequestAnimationFrame)return function(t){qn.mozRequestAnimationFrame(t)};if(qn.webkitRequestAnimationFrame)return function(t){qn.webkitRequestAnimationFrame(t)};if(qn.msRequestAnimationFrame)return function(t){qn.msRequestAnimationFrame(t)}}return function(t){t&&setTimeout(function(){t(NC())},1e3/60)}}(),Vd=function(e){return OR(e)},ni=NC,ys=9261,PC=65599,ao=5381,RC=function(e){for(var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ys,r=n,a;a=e.next(),!a.done;)r=r*PC+a.value|0;return r},bu=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ys;return n*PC+e|0},xu=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ao;return(n<<5)+n+e|0},zR=function(e,n){return e*2097152+n},gi=function(e){return e[0]*2097152+e[1]},Nc=function(e,n){return[bu(e[0],n[0]),xu(e[1],n[1])]},$b=function(e,n){var r={value:0,done:!1},a=0,i=e.length,s={next:function(){return a<i?r.value=e[a++]:r.done=!0,r}};return RC(s,n)},Ds=function(e,n){var r={value:0,done:!1},a=0,i=e.length,s={next:function(){return a<i?r.value=e.charCodeAt(a++):r.done=!0,r}};return RC(s,n)},IC=function(){return FR(arguments)},FR=function(e){for(var n,r=0;r<e.length;r++){var a=e[r];r===0?n=Ds(a):n=Ds(a,n)}return n};function _R(t,e,n,r,a){var i=a*Math.PI/180,s=Math.cos(i)*(t-n)-Math.sin(i)*(e-r)+n,o=Math.sin(i)*(t-n)+Math.cos(i)*(e-r)+r;return{x:s,y:o}}var $R=function(e,n,r,a,i,s){return{x:(e-r)*i+r,y:(n-a)*s+a}};function VR(t,e,n){if(n===0)return t;var r=(e.x1+e.x2)/2,a=(e.y1+e.y2)/2,i=e.w/e.h,s=1/i,o=_R(t.x,t.y,r,a,n),l=$R(o.x,o.y,r,a,i,s);return{x:l.x,y:l.y}}var Vb=!0,UR=console.warn!=null,qR=console.trace!=null,ry=Number.MAX_SAFE_INTEGER||9007199254740991,LC=function(){return!0},Ud=function(){return!1},Ub=function(){return 0},ay=function(){},yn=function(e){throw new Error(e)},AC=function(e){if(e!==void 0)Vb=!!e;else return Vb},Jt=function(e){AC()&&(UR?console.warn(e):(console.log(e),qR&&console.trace()))},HR=function(e){return pt({},e)},Oa=function(e){return e==null?e:an(e)?e.slice():Wt(e)?HR(e):e},WR=function(e){return e.slice()},DC=function(e,n){for(n=e="";e++<36;n+=e*51&52?(e^15?8^Math.random()*(e^20?16:4):4).toString(16):"-");return n},KR={},BC=function(){return KR},ur=function(e){var n=Object.keys(e);return function(r){for(var a={},i=0;i<n.length;i++){var s=n[i],o=r==null?void 0:r[s];a[s]=o===void 0?e[s]:o}return a}},Hi=function(e,n,r){for(var a=e.length-1;a>=0;a--)e[a]===n&&e.splice(a,1)},iy=function(e){e.splice(0,e.length)},GR=function(e,n){for(var r=0;r<n.length;r++){var a=n[r];e.push(a)}},Cr=function(e,n,r){return r&&(n=kC(r,n)),e[n]},Ba=function(e,n,r,a){r&&(n=kC(r,n)),e[n]=a},YR=function(){function t(){es(this,t),this._obj={}}return ts(t,[{key:"set",value:function(n,r){return this._obj[n]=r,this}},{key:"delete",value:function(n){return this._obj[n]=void 0,this}},{key:"clear",value:function(){this._obj={}}},{key:"has",value:function(n){return this._obj[n]!==void 0}},{key:"get",value:function(n){return this._obj[n]}}])}(),Xa=typeof Map<"u"?Map:YR,XR="undefined",QR=function(){function t(e){if(es(this,t),this._obj=Object.create(null),this.size=0,e!=null){var n;e.instanceString!=null&&e.instanceString()===this.instanceString()?n=e.toArray():n=e;for(var r=0;r<n.length;r++)this.add(n[r])}}return ts(t,[{key:"instanceString",value:function(){return"set"}},{key:"add",value:function(n){var r=this._obj;r[n]!==1&&(r[n]=1,this.size++)}},{key:"delete",value:function(n){var r=this._obj;r[n]===1&&(r[n]=0,this.size--)}},{key:"clear",value:function(){this._obj=Object.create(null)}},{key:"has",value:function(n){return this._obj[n]===1}},{key:"toArray",value:function(){var n=this;return Object.keys(this._obj).filter(function(r){return n.has(r)})}},{key:"forEach",value:function(n,r){return this.toArray().forEach(n,r)}}])}(),tl=(typeof Set>"u"?"undefined":Gn(Set))!==XR?Set:QR,Lf=function(e,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(e===void 0||n===void 0||!ey(e)){yn("An element must have a core reference and parameters set");return}var a=n.group;if(a==null&&(n.data&&n.data.source!=null&&n.data.target!=null?a="edges":a="nodes"),a!=="nodes"&&a!=="edges"){yn("An element must be of type `nodes` or `edges`; you specified `"+a+"`");return}this.length=1,this[0]=this;var i=this._private={cy:e,single:!0,data:n.data||{},position:n.position||{x:0,y:0},autoWidth:void 0,autoHeight:void 0,autoPadding:void 0,compoundBoundsClean:!1,listeners:[],group:a,style:{},rstyle:{},styleCxts:[],styleKeys:{},removed:!0,selected:!!n.selected,selectable:n.selectable===void 0?!0:!!n.selectable,locked:!!n.locked,grabbed:!1,grabbable:n.grabbable===void 0?!0:!!n.grabbable,pannable:n.pannable===void 0?a==="edges":!!n.pannable,active:!1,classes:new tl,animation:{current:[],queue:[]},rscratch:{},scratch:n.scratch||{},edges:[],children:[],parent:n.parent&&n.parent.isNode()?n.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==null&&(i.position.x=0),i.position.y==null&&(i.position.y=0),n.renderedPosition){var s=n.renderedPosition,o=e.pan(),l=e.zoom();i.position={x:(s.x-o.x)/l,y:(s.y-o.y)/l}}var u=[];an(n.classes)?u=n.classes:ft(n.classes)&&(u=n.classes.split(/\s+/));for(var d=0,f=u.length;d<f;d++){var h=u[d];!h||h===""||i.classes.add(h)}this.createEmitter(),(r===void 0||r)&&this.restore();var v=n.style||n.css;v&&(Jt("Setting a `style` bypass at element creation should be done only when absolutely necessary. Try to use the stylesheet instead."),this.style(v))},qb=function(e){return e={bfs:e.bfs||!e.dfs,dfs:e.dfs||!e.bfs},function(r,a,i){var s;Wt(r)&&!Xr(r)&&(s=r,r=s.roots||s.root,a=s.visit,i=s.directed),i=arguments.length===2&&!En(a)?a:i,a=En(a)?a:function(){};for(var o=this._private.cy,l=r=ft(r)?this.filter(r):r,u=[],d=[],f={},h={},v={},p=0,y,b=this.byGroup(),m=b.nodes,g=b.edges,w=0;w<l.length;w++){var x=l[w],E=x.id();x.isNode()&&(u.unshift(x),e.bfs&&(v[E]=!0,d.push(x)),h[E]=0)}for(var S=function(){var D=e.bfs?u.shift():u.pop(),$=D.id();if(e.dfs){if(v[$])return 0;v[$]=!0,d.push(D)}var H=h[$],V=f[$],U=V!=null?V.source():null,F=V!=null?V.target():null,G=V==null?void 0:D.same(U)?F[0]:U[0],z;if(z=a(D,V,G,p++,H),z===!0)return y=D,1;if(z===!1)return 1;for(var _=D.connectedEdges().filter(function(ve){return(!i||ve.source().same(D))&&g.has(ve)}),K=0;K<_.length;K++){var ie=_[K],M=ie.connectedNodes().filter(function(ve){return!ve.same(D)&&m.has(ve)}),oe=M.id();M.length!==0&&!v[oe]&&(M=M[0],u.push(M),e.bfs&&(v[oe]=!0,d.push(M)),f[oe]=ie,h[oe]=h[$]+1)}},C;u.length!==0&&(C=S(),!(C!==0&&C===1)););for(var T=o.collection(),N=0;N<d.length;N++){var P=d[N],R=f[P.id()];R!=null&&T.push(R),T.push(P)}return{path:o.collection(T),found:o.collection(y)}}},wu={breadthFirstSearch:qb({bfs:!0}),depthFirstSearch:qb({dfs:!0})};wu.bfs=wu.breadthFirstSearch;wu.dfs=wu.depthFirstSearch;var Jc={exports:{}},ZR=Jc.exports,Hb;function JR(){return Hb||(Hb=1,function(t,e){(function(){var n,r,a,i,s,o,l,u,d,f,h,v,p,y,b;a=Math.floor,f=Math.min,r=function(m,g){return m<g?-1:m>g?1:0},d=function(m,g,w,x,E){var S;if(w==null&&(w=0),E==null&&(E=r),w<0)throw new Error("lo must be non-negative");for(x==null&&(x=m.length);w<x;)S=a((w+x)/2),E(g,m[S])<0?x=S:w=S+1;return[].splice.apply(m,[w,w-w].concat(g)),g},o=function(m,g,w){return w==null&&(w=r),m.push(g),y(m,0,m.length-1,w)},s=function(m,g){var w,x;return g==null&&(g=r),w=m.pop(),m.length?(x=m[0],m[0]=w,b(m,0,g)):x=w,x},u=function(m,g,w){var x;return w==null&&(w=r),x=m[0],m[0]=g,b(m,0,w),x},l=function(m,g,w){var x;return w==null&&(w=r),m.length&&w(m[0],g)<0&&(x=[m[0],g],g=x[0],m[0]=x[1],b(m,0,w)),g},i=function(m,g){var w,x,E,S,C,T;for(g==null&&(g=r),S=(function(){T=[];for(var N=0,P=a(m.length/2);0<=P?N<P:N>P;0<=P?N++:N--)T.push(N);return T}).apply(this).reverse(),C=[],x=0,E=S.length;x<E;x++)w=S[x],C.push(b(m,w,g));return C},p=function(m,g,w){var x;if(w==null&&(w=r),x=m.indexOf(g),x!==-1)return y(m,0,x,w),b(m,x,w)},h=function(m,g,w){var x,E,S,C,T;if(w==null&&(w=r),E=m.slice(0,g),!E.length)return E;for(i(E,w),T=m.slice(g),S=0,C=T.length;S<C;S++)x=T[S],l(E,x,w);return E.sort(w).reverse()},v=function(m,g,w){var x,E,S,C,T,N,P,R,I;if(w==null&&(w=r),g*10<=m.length){if(S=m.slice(0,g).sort(w),!S.length)return S;for(E=S[S.length-1],P=m.slice(g),C=0,N=P.length;C<N;C++)x=P[C],w(x,E)<0&&(d(S,x,0,null,w),S.pop(),E=S[S.length-1]);return S}for(i(m,w),I=[],T=0,R=f(g,m.length);0<=R?T<R:T>R;0<=R?++T:--T)I.push(s(m,w));return I},y=function(m,g,w,x){var E,S,C;for(x==null&&(x=r),E=m[w];w>g;){if(C=w-1>>1,S=m[C],x(E,S)<0){m[w]=S,w=C;continue}break}return m[w]=E},b=function(m,g,w){var x,E,S,C,T;for(w==null&&(w=r),E=m.length,T=g,S=m[g],x=2*g+1;x<E;)C=x+1,C<E&&!(w(m[x],m[C])<0)&&(x=C),m[g]=m[x],g=x,x=2*g+1;return m[g]=S,y(m,T,g,w)},n=function(){m.push=o,m.pop=s,m.replace=u,m.pushpop=l,m.heapify=i,m.updateItem=p,m.nlargest=h,m.nsmallest=v;function m(g){this.cmp=g??r,this.nodes=[]}return m.prototype.push=function(g){return o(this.nodes,g,this.cmp)},m.prototype.pop=function(){return s(this.nodes,this.cmp)},m.prototype.peek=function(){return this.nodes[0]},m.prototype.contains=function(g){return this.nodes.indexOf(g)!==-1},m.prototype.replace=function(g){return u(this.nodes,g,this.cmp)},m.prototype.pushpop=function(g){return l(this.nodes,g,this.cmp)},m.prototype.heapify=function(){return i(this.nodes,this.cmp)},m.prototype.updateItem=function(g){return p(this.nodes,g,this.cmp)},m.prototype.clear=function(){return this.nodes=[]},m.prototype.empty=function(){return this.nodes.length===0},m.prototype.size=function(){return this.nodes.length},m.prototype.clone=function(){var g;return g=new m,g.nodes=this.nodes.slice(0),g},m.prototype.toArray=function(){return this.nodes.slice(0)},m.prototype.insert=m.prototype.push,m.prototype.top=m.prototype.peek,m.prototype.front=m.prototype.peek,m.prototype.has=m.prototype.contains,m.prototype.copy=m.prototype.clone,m}(),function(m,g){return t.exports=g()}(this,function(){return n})}).call(ZR)}(Jc)),Jc.exports}var sv,Wb;function eI(){return Wb||(Wb=1,sv=JR()),sv}var tI=eI(),qu=_u(tI),nI=ur({root:null,weight:function(e){return 1},directed:!1}),rI={dijkstra:function(e){if(!Wt(e)){var n=arguments;e={root:n[0],weight:n[1],directed:n[2]}}var r=nI(e),a=r.root,i=r.weight,s=r.directed,o=this,l=i,u=ft(a)?this.filter(a)[0]:a[0],d={},f={},h={},v=this.byGroup(),p=v.nodes,y=v.edges;y.unmergeBy(function(H){return H.isLoop()});for(var b=function(V){return d[V.id()]},m=function(V,U){d[V.id()]=U,g.updateItem(V)},g=new qu(function(H,V){return b(H)-b(V)}),w=0;w<p.length;w++){var x=p[w];d[x.id()]=x.same(u)?0:1/0,g.push(x)}for(var E=function(V,U){for(var F=(s?V.edgesTo(U):V.edgesWith(U)).intersect(y),G=1/0,z,_=0;_<F.length;_++){var K=F[_],ie=l(K);(ie<G||!z)&&(G=ie,z=K)}return{edge:z,dist:G}};g.size()>0;){var S=g.pop(),C=b(S),T=S.id();if(h[T]=C,C!==1/0)for(var N=S.neighborhood().intersect(p),P=0;P<N.length;P++){var R=N[P],I=R.id(),D=E(S,R),$=C+D.dist;$<b(R)&&(m(R,$),f[I]={node:S,edge:D.edge})}}return{distanceTo:function(V){var U=ft(V)?p.filter(V)[0]:V[0];return h[U.id()]},pathTo:function(V){var U=ft(V)?p.filter(V)[0]:V[0],F=[],G=U,z=G.id();if(U.length>0)for(F.unshift(U);f[z];){var _=f[z];F.unshift(_.edge),F.unshift(_.node),G=_.node,z=G.id()}return o.spawn(F)}}}},aI={kruskal:function(e){e=e||function(w){return 1};for(var n=this.byGroup(),r=n.nodes,a=n.edges,i=r.length,s=new Array(i),o=r,l=function(x){for(var E=0;E<s.length;E++){var S=s[E];if(S.has(x))return E}},u=0;u<i;u++)s[u]=this.spawn(r[u]);for(var d=a.sort(function(w,x){return e(w)-e(x)}),f=0;f<d.length;f++){var h=d[f],v=h.source()[0],p=h.target()[0],y=l(v),b=l(p),m=s[y],g=s[b];y!==b&&(o.merge(h),m.merge(g),s.splice(b,1))}return o}},iI=ur({root:null,goal:null,weight:function(e){return 1},heuristic:function(e){return 0},directed:!1}),sI={aStar:function(e){var n=this.cy(),r=iI(e),a=r.root,i=r.goal,s=r.heuristic,o=r.directed,l=r.weight;a=n.collection(a)[0],i=n.collection(i)[0];var u=a.id(),d=i.id(),f={},h={},v={},p=new qu(function(z,_){return h[z.id()]-h[_.id()]}),y=new tl,b={},m={},g=function(_,K){p.push(_),y.add(K)},w,x,E=function(){w=p.pop(),x=w.id(),y.delete(x)},S=function(_){return y.has(_)};g(a,u),f[u]=0,h[u]=s(a);for(var C=0;p.size()>0;){if(E(),C++,x===d){for(var T=[],N=i,P=d,R=m[P];T.unshift(N),R!=null&&T.unshift(R),N=b[P],N!=null;)P=N.id(),R=m[P];return{found:!0,distance:f[x],path:this.spawn(T),steps:C}}v[x]=!0;for(var I=w._private.edges,D=0;D<I.length;D++){var $=I[D];if(this.hasElementWithId($.id())&&!(o&&$.data("source")!==x)){var H=$.source(),V=$.target(),U=H.id()!==x?H:V,F=U.id();if(this.hasElementWithId(F)&&!v[F]){var G=f[x]+l($);if(!S(F)){f[F]=G,h[F]=G+s(U),g(U,F),b[F]=w,m[F]=$;continue}G<f[F]&&(f[F]=G,h[F]=G+s(U),b[F]=w,m[F]=$)}}}}return{found:!1,distance:void 0,path:void 0,steps:C}}},oI=ur({weight:function(e){return 1},directed:!1}),lI={floydWarshall:function(e){for(var n=this.cy(),r=oI(e),a=r.weight,i=r.directed,s=a,o=this.byGroup(),l=o.nodes,u=o.edges,d=l.length,f=d*d,h=function(ie){return l.indexOf(ie)},v=function(ie){return l[ie]},p=new Array(f),y=0;y<f;y++){var b=y%d,m=(y-b)/d;m===b?p[y]=0:p[y]=1/0}for(var g=new Array(f),w=new Array(f),x=0;x<u.length;x++){var E=u[x],S=E.source()[0],C=E.target()[0];if(S!==C){var T=h(S),N=h(C),P=T*d+N,R=s(E);if(p[P]>R&&(p[P]=R,g[P]=N,w[P]=E),!i){var I=N*d+T;!i&&p[I]>R&&(p[I]=R,g[I]=T,w[I]=E)}}}for(var D=0;D<d;D++)for(var $=0;$<d;$++)for(var H=$*d+D,V=0;V<d;V++){var U=$*d+V,F=D*d+V;p[H]+p[F]<p[U]&&(p[U]=p[H]+p[F],g[U]=g[H])}var G=function(ie){return(ft(ie)?n.filter(ie):ie)[0]},z=function(ie){return h(G(ie))},_={distance:function(ie,M){var oe=z(ie),ve=z(M);return p[oe*d+ve]},path:function(ie,M){var oe=z(ie),ve=z(M),ye=v(oe);if(oe===ve)return ye.collection();if(g[oe*d+ve]==null)return n.collection();var Te=n.collection(),fe=oe,Z;for(Te.merge(ye);oe!==ve;)fe=oe,oe=g[oe*d+ve],Z=w[fe*d+oe],Te.merge(Z),Te.merge(v(oe));return Te}};return _}},uI=ur({weight:function(e){return 1},directed:!1,root:null}),cI={bellmanFord:function(e){var n=this,r=uI(e),a=r.weight,i=r.directed,s=r.root,o=a,l=this,u=this.cy(),d=this.byGroup(),f=d.edges,h=d.nodes,v=h.length,p=new Xa,y=!1,b=[];s=u.collection(s)[0],f.unmergeBy(function(wt){return wt.isLoop()});for(var m=f.length,g=function(at){var it=p.get(at.id());return it||(it={},p.set(at.id(),it)),it},w=function(at){return(ft(at)?u.$(at):at)[0]},x=function(at){return g(w(at)).dist},E=function(at){for(var it=arguments.length>1&&arguments[1]!==void 0?arguments[1]:s,$e=w(at),et=[],nt=$e;;){if(nt==null)return n.spawn();var bt=g(nt),ht=bt.edge,Pt=bt.pred;if(et.unshift(nt[0]),nt.same(it)&&et.length>0)break;ht!=null&&et.unshift(ht),nt=Pt}return l.spawn(et)},S=0;S<v;S++){var C=h[S],T=g(C);C.same(s)?T.dist=0:T.dist=1/0,T.pred=null,T.edge=null}for(var N=!1,P=function(at,it,$e,et,nt,bt){var ht=et.dist+bt;ht<nt.dist&&!$e.same(et.edge)&&(nt.dist=ht,nt.pred=at,nt.edge=$e,N=!0)},R=1;R<v;R++){N=!1;for(var I=0;I<m;I++){var D=f[I],$=D.source(),H=D.target(),V=o(D),U=g($),F=g(H);P($,H,D,U,F,V),i||P(H,$,D,F,U,V)}if(!N)break}if(N)for(var G=[],z=0;z<m;z++){var _=f[z],K=_.source(),ie=_.target(),M=o(_),oe=g(K).dist,ve=g(ie).dist;if(oe+M<ve||!i&&ve+M<oe)if(y||(Jt("Graph contains a negative weight cycle for Bellman-Ford"),y=!0),e.findNegativeWeightCycles!==!1){var ye=[];oe+M<ve&&ye.push(K),!i&&ve+M<oe&&ye.push(ie);for(var Te=ye.length,fe=0;fe<Te;fe++){var Z=ye[fe],ee=[Z];ee.push(g(Z).edge);for(var ne=g(Z).pred;ee.indexOf(ne)===-1;)ee.push(ne),ee.push(g(ne).edge),ne=g(ne).pred;ee=ee.slice(ee.indexOf(ne));for(var de=ee[0].id(),Re=0,Ge=2;Ge<ee.length;Ge+=2)ee[Ge].id()<de&&(de=ee[Ge].id(),Re=Ge);ee=ee.slice(Re).concat(ee.slice(0,Re)),ee.push(ee[0]);var Nt=ee.map(function(wt){return wt.id()}).join(",");G.indexOf(Nt)===-1&&(b.push(l.spawn(ee)),G.push(Nt))}}else break}return{distanceTo:x,pathTo:E,hasNegativeWeightCycle:y,negativeWeightCycles:b}}},dI=Math.sqrt(2),fI=function(e,n,r){r.length===0&&yn("Karger-Stein must be run on a connected (sub)graph");for(var a=r[e],i=a[1],s=a[2],o=n[i],l=n[s],u=r,d=u.length-1;d>=0;d--){var f=u[d],h=f[1],v=f[2];(n[h]===o&&n[v]===l||n[h]===l&&n[v]===o)&&u.splice(d,1)}for(var p=0;p<u.length;p++){var y=u[p];y[1]===l?(u[p]=y.slice(),u[p][1]=o):y[2]===l&&(u[p]=y.slice(),u[p][2]=o)}for(var b=0;b<n.length;b++)n[b]===l&&(n[b]=o);return u},ov=function(e,n,r,a){for(;r>a;){var i=Math.floor(Math.random()*n.length);n=fI(i,e,n),r--}return n},hI={kargerStein:function(){var e=this,n=this.byGroup(),r=n.nodes,a=n.edges;a.unmergeBy(function(F){return F.isLoop()});var i=r.length,s=a.length,o=Math.ceil(Math.pow(Math.log(i)/Math.LN2,2)),l=Math.floor(i/dI);if(i<2){yn("At least 2 nodes are required for Karger-Stein algorithm");return}for(var u=[],d=0;d<s;d++){var f=a[d];u.push([d,r.indexOf(f.source()),r.indexOf(f.target())])}for(var h=1/0,v=[],p=new Array(i),y=new Array(i),b=new Array(i),m=function(G,z){for(var _=0;_<i;_++)z[_]=G[_]},g=0;g<=o;g++){for(var w=0;w<i;w++)y[w]=w;var x=ov(y,u.slice(),i,l),E=x.slice();m(y,b);var S=ov(y,x,l,2),C=ov(b,E,l,2);S.length<=C.length&&S.length<h?(h=S.length,v=S,m(y,p)):C.length<=S.length&&C.length<h&&(h=C.length,v=C,m(b,p))}for(var T=this.spawn(v.map(function(F){return a[F[0]]})),N=this.spawn(),P=this.spawn(),R=p[0],I=0;I<p.length;I++){var D=p[I],$=r[I];D===R?N.merge($):P.merge($)}var H=function(G){var z=e.spawn();return G.forEach(function(_){z.merge(_),_.connectedEdges().forEach(function(K){e.contains(K)&&!T.contains(K)&&z.merge(K)})}),z},V=[H(N),H(P)],U={cut:T,components:V,partition1:N,partition2:P};return U}},lv,vI=function(e){return{x:e.x,y:e.y}},Af=function(e,n,r){return{x:e.x*n+r.x,y:e.y*n+r.y}},MC=function(e,n,r){return{x:(e.x-r.x)/n,y:(e.y-r.y)/n}},bo=function(e){return{x:e[0],y:e[1]}},pI=function(e){for(var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,a=1/0,i=n;i<r;i++){var s=e[i];isFinite(s)&&(a=Math.min(s,a))}return a},gI=function(e){for(var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,a=-1/0,i=n;i<r;i++){var s=e[i];isFinite(s)&&(a=Math.max(s,a))}return a},mI=function(e){for(var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,a=0,i=0,s=n;s<r;s++){var o=e[s];isFinite(o)&&(a+=o,i++)}return a/i},yI=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0;a?e=e.slice(n,r):(r<e.length&&e.splice(r,e.length-r),n>0&&e.splice(0,n));for(var o=0,l=e.length-1;l>=0;l--){var u=e[l];s?isFinite(u)||(e[l]=-1/0,o++):e.splice(l,1)}i&&e.sort(function(h,v){return h-v});var d=e.length,f=Math.floor(d/2);return d%2!==0?e[f+1+o]:(e[f-1+o]+e[f+o])/2},bI=function(e){return Math.PI*e/180},Pc=function(e,n){return Math.atan2(n,e)-Math.PI/2},sy=Math.log2||function(t){return Math.log(t)/Math.log(2)},oy=function(e){return e>0?1:e<0?-1:0},Bs=function(e,n){return Math.sqrt(gs(e,n))},gs=function(e,n){var r=n.x-e.x,a=n.y-e.y;return r*r+a*a},xI=function(e){for(var n=e.length,r=0,a=0;a<n;a++)r+=e[a];for(var i=0;i<n;i++)e[i]=e[i]/r;return e},Xn=function(e,n,r,a){return(1-a)*(1-a)*e+2*(1-a)*a*n+a*a*r},Ro=function(e,n,r,a){return{x:Xn(e.x,n.x,r.x,a),y:Xn(e.y,n.y,r.y,a)}},wI=function(e,n,r,a){var i={x:n.x-e.x,y:n.y-e.y},s=Bs(e,n),o={x:i.x/s,y:i.y/s};return r=r??0,a=a??r*s,{x:e.x+o.x*a,y:e.y+o.y*a}},ku=function(e,n,r){return Math.max(e,Math.min(r,n))},jr=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}}},kI=function(e){return{x1:e.x1,x2:e.x2,w:e.w,y1:e.y1,y2:e.y2,h:e.h}},EI=function(e){e.x1=1/0,e.y1=1/0,e.x2=-1/0,e.y2=-1/0,e.w=0,e.h=0},CI=function(e,n){e.x1=Math.min(e.x1,n.x1),e.x2=Math.max(e.x2,n.x2),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,n.y1),e.y2=Math.max(e.y2,n.y2),e.h=e.y2-e.y1},OC=function(e,n,r){e.x1=Math.min(e.x1,n),e.x2=Math.max(e.x2,n),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,r),e.y2=Math.max(e.y2,r),e.h=e.y2-e.y1},ed=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return e.x1-=n,e.x2+=n,e.y1-=n,e.y2+=n,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},td=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[0],r,a,i,s;if(n.length===1)r=a=i=s=n[0];else if(n.length===2)r=i=n[0],s=a=n[1];else if(n.length===4){var o=Fn(n,4);r=o[0],a=o[1],i=o[2],s=o[3]}return e.x1-=s,e.x2+=a,e.y1-=r,e.y2+=i,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},Kb=function(e,n){e.x1=n.x1,e.y1=n.y1,e.x2=n.x2,e.y2=n.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1},ly=function(e,n){return!(e.x1>n.x2||n.x1>e.x2||e.x2<n.x1||n.x2<e.x1||e.y2<n.y1||n.y2<e.y1||e.y1>n.y2||n.y1>e.y2)},Ni=function(e,n,r){return e.x1<=n&&n<=e.x2&&e.y1<=r&&r<=e.y2},Gb=function(e,n){return Ni(e,n.x,n.y)},zC=function(e,n){return Ni(e,n.x1,n.y1)&&Ni(e,n.x2,n.y2)},SI=(lv=Math.hypot)!==null&&lv!==void 0?lv:function(t,e){return Math.sqrt(t*t+e*e)};function jI(t,e){if(t.length<3)throw new Error("Need at least 3 vertices");var n=function(T,N){return{x:T.x+N.x,y:T.y+N.y}},r=function(T,N){return{x:T.x-N.x,y:T.y-N.y}},a=function(T,N){return{x:T.x*N,y:T.y*N}},i=function(T,N){return T.x*N.y-T.y*N.x},s=function(T){var N=SI(T.x,T.y);return N===0?{x:0,y:0}:{x:T.x/N,y:T.y/N}},o=function(T){for(var N=0,P=0;P<T.length;P++){var R=T[P],I=T[(P+1)%T.length];N+=R.x*I.y-I.x*R.y}return N/2},l=function(T,N,P,R){var I=r(N,T),D=r(R,P),$=i(I,D);if(Math.abs($)<1e-9)return n(T,a(I,.5));var H=i(r(P,T),D)/$;return n(T,a(I,H))},u=t.map(function(C){return{x:C.x,y:C.y}});o(u)<0&&u.reverse();for(var d=u.length,f=[],h=0;h<d;h++){var v=u[h],p=u[(h+1)%d],y=r(p,v),b=s({x:y.y,y:-y.x});f.push(b)}for(var m=f.map(function(C,T){var N=n(u[T],a(C,e)),P=n(u[(T+1)%d],a(C,e));return{p1:N,p2:P}}),g=[],w=0;w<d;w++){var x=m[(w-1+d)%d],E=m[w],S=l(x.p1,x.p2,E.p1,E.p2);g.push(S)}return g}function TI(t,e,n,r,a,i){var s=MI(t,e,n,r,a),o=jI(s,i),l=jr();return o.forEach(function(u){return OC(l,u.x,u.y)}),l}var FC=function(e,n,r,a,i,s,o){var l=arguments.length>7&&arguments[7]!==void 0?arguments[7]:"auto",u=l==="auto"?Wi(i,s):l,d=i/2,f=s/2;u=Math.min(u,d,f);var h=u!==d,v=u!==f,p;if(h){var y=r-d+u-o,b=a-f-o,m=r+d-u+o,g=b;if(p=Pi(e,n,r,a,y,b,m,g,!1),p.length>0)return p}if(v){var w=r+d+o,x=a-f+u-o,E=w,S=a+f-u+o;if(p=Pi(e,n,r,a,w,x,E,S,!1),p.length>0)return p}if(h){var C=r-d+u-o,T=a+f+o,N=r+d-u+o,P=T;if(p=Pi(e,n,r,a,C,T,N,P,!1),p.length>0)return p}if(v){var R=r-d-o,I=a-f+u-o,D=R,$=a+f-u+o;if(p=Pi(e,n,r,a,R,I,D,$,!1),p.length>0)return p}var H;{var V=r-d+u,U=a-f+u;if(H=Dl(e,n,r,a,V,U,u+o),H.length>0&&H[0]<=V&&H[1]<=U)return[H[0],H[1]]}{var F=r+d-u,G=a-f+u;if(H=Dl(e,n,r,a,F,G,u+o),H.length>0&&H[0]>=F&&H[1]<=G)return[H[0],H[1]]}{var z=r+d-u,_=a+f-u;if(H=Dl(e,n,r,a,z,_,u+o),H.length>0&&H[0]>=z&&H[1]>=_)return[H[0],H[1]]}{var K=r-d+u,ie=a+f-u;if(H=Dl(e,n,r,a,K,ie,u+o),H.length>0&&H[0]<=K&&H[1]>=ie)return[H[0],H[1]]}return[]},NI=function(e,n,r,a,i,s,o){var l=o,u=Math.min(r,i),d=Math.max(r,i),f=Math.min(a,s),h=Math.max(a,s);return u-l<=e&&e<=d+l&&f-l<=n&&n<=h+l},PI=function(e,n,r,a,i,s,o,l,u){var d={x1:Math.min(r,o,i)-u,x2:Math.max(r,o,i)+u,y1:Math.min(a,l,s)-u,y2:Math.max(a,l,s)+u};return!(e<d.x1||e>d.x2||n<d.y1||n>d.y2)},RI=function(e,n,r,a){r-=a;var i=n*n-4*e*r;if(i<0)return[];var s=Math.sqrt(i),o=2*e,l=(-n+s)/o,u=(-n-s)/o;return[l,u]},II=function(e,n,r,a,i){var s=1e-5;e===0&&(e=s),n/=e,r/=e,a/=e;var o,l,u,d,f,h,v,p;if(l=(3*r-n*n)/9,u=-(27*a)+n*(9*r-2*(n*n)),u/=54,o=l*l*l+u*u,i[1]=0,v=n/3,o>0){f=u+Math.sqrt(o),f=f<0?-Math.pow(-f,1/3):Math.pow(f,1/3),h=u-Math.sqrt(o),h=h<0?-Math.pow(-h,1/3):Math.pow(h,1/3),i[0]=-v+f+h,v+=(f+h)/2,i[4]=i[2]=-v,v=Math.sqrt(3)*(-h+f)/2,i[3]=v,i[5]=-v;return}if(i[5]=i[3]=0,o===0){p=u<0?-Math.pow(-u,1/3):Math.pow(u,1/3),i[0]=-v+2*p,i[4]=i[2]=-(p+v);return}l=-l,d=l*l*l,d=Math.acos(u/Math.sqrt(d)),p=2*Math.sqrt(l),i[0]=-v+p*Math.cos(d/3),i[2]=-v+p*Math.cos((d+2*Math.PI)/3),i[4]=-v+p*Math.cos((d+4*Math.PI)/3)},LI=function(e,n,r,a,i,s,o,l){var u=1*r*r-4*r*i+2*r*o+4*i*i-4*i*o+o*o+a*a-4*a*s+2*a*l+4*s*s-4*s*l+l*l,d=1*9*r*i-3*r*r-3*r*o-6*i*i+3*i*o+9*a*s-3*a*a-3*a*l-6*s*s+3*s*l,f=1*3*r*r-6*r*i+r*o-r*e+2*i*i+2*i*e-o*e+3*a*a-6*a*s+a*l-a*n+2*s*s+2*s*n-l*n,h=1*r*i-r*r+r*e-i*e+a*s-a*a+a*n-s*n,v=[];II(u,d,f,h,v);for(var p=1e-7,y=[],b=0;b<6;b+=2)Math.abs(v[b+1])<p&&v[b]>=0&&v[b]<=1&&y.push(v[b]);y.push(1),y.push(0);for(var m=-1,g,w,x,E=0;E<y.length;E++)g=Math.pow(1-y[E],2)*r+2*(1-y[E])*y[E]*i+y[E]*y[E]*o,w=Math.pow(1-y[E],2)*a+2*(1-y[E])*y[E]*s+y[E]*y[E]*l,x=Math.pow(g-e,2)+Math.pow(w-n,2),m>=0?x<m&&(m=x):m=x;return m},AI=function(e,n,r,a,i,s){var o=[e-r,n-a],l=[i-r,s-a],u=l[0]*l[0]+l[1]*l[1],d=o[0]*o[0]+o[1]*o[1],f=o[0]*l[0]+o[1]*l[1],h=f*f/u;return f<0?d:h>u?(e-i)*(e-i)+(n-s)*(n-s):d-h},zr=function(e,n,r){for(var a,i,s,o,l,u=0,d=0;d<r.length/2;d++)if(a=r[d*2],i=r[d*2+1],d+1<r.length/2?(s=r[(d+1)*2],o=r[(d+1)*2+1]):(s=r[(d+1-r.length/2)*2],o=r[(d+1-r.length/2)*2+1]),!(a==e&&s==e))if(a>=e&&e>=s||a<=e&&e<=s)l=(e-a)/(s-a)*(o-i)+i,l>n&&u++;else continue;return u%2!==0},ri=function(e,n,r,a,i,s,o,l,u){var d=new Array(r.length),f;l[0]!=null?(f=Math.atan(l[1]/l[0]),l[0]<0?f=f+Math.PI/2:f=-f-Math.PI/2):f=l;for(var h=Math.cos(-f),v=Math.sin(-f),p=0;p<d.length/2;p++)d[p*2]=s/2*(r[p*2]*h-r[p*2+1]*v),d[p*2+1]=o/2*(r[p*2+1]*h+r[p*2]*v),d[p*2]+=a,d[p*2+1]+=i;var y;if(u>0){var b=Hd(d,-u);y=qd(b)}else y=d;return zr(e,n,y)},DI=function(e,n,r,a,i,s,o,l){for(var u=new Array(r.length*2),d=0;d<l.length;d++){var f=l[d];u[d*4+0]=f.startX,u[d*4+1]=f.startY,u[d*4+2]=f.stopX,u[d*4+3]=f.stopY;var h=Math.pow(f.cx-e,2)+Math.pow(f.cy-n,2);if(h<=Math.pow(f.radius,2))return!0}return zr(e,n,u)},qd=function(e){for(var n=new Array(e.length/2),r,a,i,s,o,l,u,d,f=0;f<e.length/4;f++){r=e[f*4],a=e[f*4+1],i=e[f*4+2],s=e[f*4+3],f<e.length/4-1?(o=e[(f+1)*4],l=e[(f+1)*4+1],u=e[(f+1)*4+2],d=e[(f+1)*4+3]):(o=e[0],l=e[1],u=e[2],d=e[3]);var h=Pi(r,a,i,s,o,l,u,d,!0);n[f*2]=h[0],n[f*2+1]=h[1]}return n},Hd=function(e,n){for(var r=new Array(e.length*2),a,i,s,o,l=0;l<e.length/2;l++){a=e[l*2],i=e[l*2+1],l<e.length/2-1?(s=e[(l+1)*2],o=e[(l+1)*2+1]):(s=e[0],o=e[1]);var u=o-i,d=-(s-a),f=Math.sqrt(u*u+d*d),h=u/f,v=d/f;r[l*4]=a+h*n,r[l*4+1]=i+v*n,r[l*4+2]=s+h*n,r[l*4+3]=o+v*n}return r},BI=function(e,n,r,a,i,s){var o=r-e,l=a-n;o/=i,l/=s;var u=Math.sqrt(o*o+l*l),d=u-1;if(d<0)return[];var f=d/u;return[(r-e)*f+e,(a-n)*f+n]},Cs=function(e,n,r,a,i,s,o){return e-=i,n-=s,e/=r/2+o,n/=a/2+o,e*e+n*n<=1},Dl=function(e,n,r,a,i,s,o){var l=[r-e,a-n],u=[e-i,n-s],d=l[0]*l[0]+l[1]*l[1],f=2*(u[0]*l[0]+u[1]*l[1]),h=u[0]*u[0]+u[1]*u[1]-o*o,v=f*f-4*d*h;if(v<0)return[];var p=(-f+Math.sqrt(v))/(2*d),y=(-f-Math.sqrt(v))/(2*d),b=Math.min(p,y),m=Math.max(p,y),g=[];if(b>=0&&b<=1&&g.push(b),m>=0&&m<=1&&g.push(m),g.length===0)return[];var w=g[0]*l[0]+e,x=g[0]*l[1]+n;if(g.length>1){if(g[0]==g[1])return[w,x];var E=g[1]*l[0]+e,S=g[1]*l[1]+n;return[w,x,E,S]}else return[w,x]},uv=function(e,n,r){return n<=e&&e<=r||r<=e&&e<=n?e:e<=n&&n<=r||r<=n&&n<=e?n:r},Pi=function(e,n,r,a,i,s,o,l,u){var d=e-i,f=r-e,h=o-i,v=n-s,p=a-n,y=l-s,b=h*v-y*d,m=f*v-p*d,g=y*f-h*p;if(g!==0){var w=b/g,x=m/g,E=.001,S=0-E,C=1+E;return S<=w&&w<=C&&S<=x&&x<=C?[e+w*f,n+w*p]:u?[e+w*f,n+w*p]:[]}else return b===0||m===0?uv(e,r,o)===o?[o,l]:uv(e,r,i)===i?[i,s]:uv(i,o,r)===r?[r,a]:[]:[]},MI=function(e,n,r,a,i){var s=[],o=a/2,l=i/2,u=n,d=r;s.push({x:u+o*e[0],y:d+l*e[1]});for(var f=1;f<e.length/2;f++)s.push({x:u+o*e[f*2],y:d+l*e[f*2+1]});return s},Eu=function(e,n,r,a,i,s,o,l){var u=[],d,f=new Array(r.length),h=!0;s==null&&(h=!1);var v;if(h){for(var p=0;p<f.length/2;p++)f[p*2]=r[p*2]*s+a,f[p*2+1]=r[p*2+1]*o+i;if(l>0){var y=Hd(f,-l);v=qd(y)}else v=f}else v=r;for(var b,m,g,w,x=0;x<v.length/2;x++)b=v[x*2],m=v[x*2+1],x<v.length/2-1?(g=v[(x+1)*2],w=v[(x+1)*2+1]):(g=v[0],w=v[1]),d=Pi(e,n,a,i,b,m,g,w),d.length!==0&&u.push(d[0],d[1]);return u},OI=function(e,n,r,a,i,s,o,l,u){var d=[],f,h=new Array(r.length*2);u.forEach(function(g,w){w===0?(h[h.length-2]=g.startX,h[h.length-1]=g.startY):(h[w*4-2]=g.startX,h[w*4-1]=g.startY),h[w*4]=g.stopX,h[w*4+1]=g.stopY,f=Dl(e,n,a,i,g.cx,g.cy,g.radius),f.length!==0&&d.push(f[0],f[1])});for(var v=0;v<h.length/4;v++)f=Pi(e,n,a,i,h[v*4],h[v*4+1],h[v*4+2],h[v*4+3],!1),f.length!==0&&d.push(f[0],f[1]);if(d.length>2){for(var p=[d[0],d[1]],y=Math.pow(p[0]-e,2)+Math.pow(p[1]-n,2),b=1;b<d.length/2;b++){var m=Math.pow(d[b*2]-e,2)+Math.pow(d[b*2+1]-n,2);m<=y&&(p[0]=d[b*2],p[1]=d[b*2+1],y=m)}return p}return d},Rc=function(e,n,r){var a=[e[0]-n[0],e[1]-n[1]],i=Math.sqrt(a[0]*a[0]+a[1]*a[1]),s=(i-r)/i;return s<0&&(s=1e-5),[n[0]+s*a[0],n[1]+s*a[1]]},kr=function(e,n){var r=Ig(e,n);return r=_C(r),r},_C=function(e){for(var n,r,a=e.length/2,i=1/0,s=1/0,o=-1/0,l=-1/0,u=0;u<a;u++)n=e[2*u],r=e[2*u+1],i=Math.min(i,n),o=Math.max(o,n),s=Math.min(s,r),l=Math.max(l,r);for(var d=2/(o-i),f=2/(l-s),h=0;h<a;h++)n=e[2*h]=e[2*h]*d,r=e[2*h+1]=e[2*h+1]*f,i=Math.min(i,n),o=Math.max(o,n),s=Math.min(s,r),l=Math.max(l,r);if(s<-1)for(var v=0;v<a;v++)r=e[2*v+1]=e[2*v+1]+(-1-s);return e},Ig=function(e,n){var r=1/e*2*Math.PI,a=e%2===0?Math.PI/2+r/2:Math.PI/2;a+=n;for(var i=new Array(e*2),s,o=0;o<e;o++)s=o*r+a,i[2*o]=Math.cos(s),i[2*o+1]=Math.sin(-s);return i},Wi=function(e,n){return Math.min(e/4,n/4,8)},$C=function(e,n){return Math.min(e/10,n/10,8)},uy=function(){return 8},zI=function(e,n,r){return[e-2*n+r,2*(n-e),e]},Lg=function(e,n){return{heightOffset:Math.min(15,.05*n),widthOffset:Math.min(100,.25*e),ctrlPtOffsetPct:.05}};function cv(t,e){function n(f){for(var h=[],v=0;v<f.length;v++){var p=f[v],y=f[(v+1)%f.length],b={x:y.x-p.x,y:y.y-p.y},m={x:-b.y,y:b.x},g=Math.sqrt(m.x*m.x+m.y*m.y);h.push({x:m.x/g,y:m.y/g})}return h}function r(f,h){var v=1/0,p=-1/0,y=_r(f),b;try{for(y.s();!(b=y.n()).done;){var m=b.value,g=m.x*h.x+m.y*h.y;v=Math.min(v,g),p=Math.max(p,g)}}catch(w){y.e(w)}finally{y.f()}return{min:v,max:p}}function a(f,h){return!(f.max<h.min||h.max<f.min)}var i=[].concat(_d(n(t)),_d(n(e))),s=_r(i),o;try{for(s.s();!(o=s.n()).done;){var l=o.value,u=r(t,l),d=r(e,l);if(!a(u,d))return!1}}catch(f){s.e(f)}finally{s.f()}return!0}var FI=ur({dampingFactor:.8,precision:1e-6,iterations:200,weight:function(e){return 1}}),_I={pageRank:function(e){for(var n=FI(e),r=n.dampingFactor,a=n.precision,i=n.iterations,s=n.weight,o=this._private.cy,l=this.byGroup(),u=l.nodes,d=l.edges,f=u.length,h=f*f,v=d.length,p=new Array(h),y=new Array(f),b=(1-r)/f,m=0;m<f;m++){for(var g=0;g<f;g++){var w=m*f+g;p[w]=0}y[m]=0}for(var x=0;x<v;x++){var E=d[x],S=E.data("source"),C=E.data("target");if(S!==C){var T=u.indexOfId(S),N=u.indexOfId(C),P=s(E),R=N*f+T;p[R]+=P,y[T]+=P}}for(var I=1/f+b,D=0;D<f;D++)if(y[D]===0)for(var $=0;$<f;$++){var H=$*f+D;p[H]=I}else for(var V=0;V<f;V++){var U=V*f+D;p[U]=p[U]/y[D]+b}for(var F=new Array(f),G=new Array(f),z,_=0;_<f;_++)F[_]=1;for(var K=0;K<i;K++){for(var ie=0;ie<f;ie++)G[ie]=0;for(var M=0;M<f;M++)for(var oe=0;oe<f;oe++){var ve=M*f+oe;G[M]+=p[ve]*F[oe]}xI(G),z=F,F=G,G=z;for(var ye=0,Te=0;Te<f;Te++){var fe=z[Te]-F[Te];ye+=fe*fe}if(ye<a)break}var Z={rank:function(ne){return ne=o.collection(ne)[0],F[u.indexOf(ne)]}};return Z}},Yb=ur({root:null,weight:function(e){return 1},directed:!1,alpha:0}),Io={degreeCentralityNormalized:function(e){e=Yb(e);var n=this.cy(),r=this.nodes(),a=r.length;if(e.directed){for(var d={},f={},h=0,v=0,p=0;p<a;p++){var y=r[p],b=y.id();e.root=y;var m=this.degreeCentrality(e);h<m.indegree&&(h=m.indegree),v<m.outdegree&&(v=m.outdegree),d[b]=m.indegree,f[b]=m.outdegree}return{indegree:function(w){return h==0?0:(ft(w)&&(w=n.filter(w)),d[w.id()]/h)},outdegree:function(w){return v===0?0:(ft(w)&&(w=n.filter(w)),f[w.id()]/v)}}}else{for(var i={},s=0,o=0;o<a;o++){var l=r[o];e.root=l;var u=this.degreeCentrality(e);s<u.degree&&(s=u.degree),i[l.id()]=u.degree}return{degree:function(w){return s===0?0:(ft(w)&&(w=n.filter(w)),i[w.id()]/s)}}}},degreeCentrality:function(e){e=Yb(e);var n=this.cy(),r=this,a=e,i=a.root,s=a.weight,o=a.directed,l=a.alpha;if(i=n.collection(i)[0],o){for(var v=i.connectedEdges(),p=v.filter(function(S){return S.target().same(i)&&r.has(S)}),y=v.filter(function(S){return S.source().same(i)&&r.has(S)}),b=p.length,m=y.length,g=0,w=0,x=0;x<p.length;x++)g+=s(p[x]);for(var E=0;E<y.length;E++)w+=s(y[E]);return{indegree:Math.pow(b,1-l)*Math.pow(g,l),outdegree:Math.pow(m,1-l)*Math.pow(w,l)}}else{for(var u=i.connectedEdges().intersection(r),d=u.length,f=0,h=0;h<u.length;h++)f+=s(u[h]);return{degree:Math.pow(d,1-l)*Math.pow(f,l)}}}};Io.dc=Io.degreeCentrality;Io.dcn=Io.degreeCentralityNormalised=Io.degreeCentralityNormalized;var Xb=ur({harmonic:!0,weight:function(){return 1},directed:!1,root:null}),Lo={closenessCentralityNormalized:function(e){for(var n=Xb(e),r=n.harmonic,a=n.weight,i=n.directed,s=this.cy(),o={},l=0,u=this.nodes(),d=this.floydWarshall({weight:a,directed:i}),f=0;f<u.length;f++){for(var h=0,v=u[f],p=0;p<u.length;p++)if(f!==p){var y=d.distance(v,u[p]);r?h+=1/y:h+=y}r||(h=1/h),l<h&&(l=h),o[v.id()]=h}return{closeness:function(m){return l==0?0:(ft(m)?m=s.filter(m)[0].id():m=m.id(),o[m]/l)}}},closenessCentrality:function(e){var n=Xb(e),r=n.root,a=n.weight,i=n.directed,s=n.harmonic;r=this.filter(r)[0];for(var o=this.dijkstra({root:r,weight:a,directed:i}),l=0,u=this.nodes(),d=0;d<u.length;d++){var f=u[d];if(!f.same(r)){var h=o.distanceTo(f);s?l+=1/h:l+=h}}return s?l:1/l}};Lo.cc=Lo.closenessCentrality;Lo.ccn=Lo.closenessCentralityNormalised=Lo.closenessCentralityNormalized;var $I=ur({weight:null,directed:!1}),Ag={betweennessCentrality:function(e){for(var n=$I(e),r=n.directed,a=n.weight,i=a!=null,s=this.cy(),o=this.nodes(),l={},u={},d=0,f={set:function(w,x){u[w]=x,x>d&&(d=x)},get:function(w){return u[w]}},h=0;h<o.length;h++){var v=o[h],p=v.id();r?l[p]=v.outgoers().nodes():l[p]=v.openNeighborhood().nodes(),f.set(p,0)}for(var y=function(){for(var w=o[b].id(),x=[],E={},S={},C={},T=new qu(function(M,oe){return C[M]-C[oe]}),N=0;N<o.length;N++){var P=o[N].id();E[P]=[],S[P]=0,C[P]=1/0}for(S[w]=1,C[w]=0,T.push(w);!T.empty();){var R=T.pop();if(x.push(R),i)for(var I=0;I<l[R].length;I++){var D=l[R][I],$=s.getElementById(R),H=void 0;$.edgesTo(D).length>0?H=$.edgesTo(D)[0]:H=D.edgesTo($)[0];var V=a(H);D=D.id(),C[D]>C[R]+V&&(C[D]=C[R]+V,T.nodes.indexOf(D)<0?T.push(D):T.updateItem(D),S[D]=0,E[D]=[]),C[D]==C[R]+V&&(S[D]=S[D]+S[R],E[D].push(R))}else for(var U=0;U<l[R].length;U++){var F=l[R][U].id();C[F]==1/0&&(T.push(F),C[F]=C[R]+1),C[F]==C[R]+1&&(S[F]=S[F]+S[R],E[F].push(R))}}for(var G={},z=0;z<o.length;z++)G[o[z].id()]=0;for(;x.length>0;){for(var _=x.pop(),K=0;K<E[_].length;K++){var ie=E[_][K];G[ie]=G[ie]+S[ie]/S[_]*(1+G[_])}_!=o[b].id()&&f.set(_,f.get(_)+G[_])}},b=0;b<o.length;b++)y();var m={betweenness:function(w){var x=s.collection(w).id();return f.get(x)},betweennessNormalized:function(w){if(d==0)return 0;var x=s.collection(w).id();return f.get(x)/d}};return m.betweennessNormalised=m.betweennessNormalized,m}};Ag.bc=Ag.betweennessCentrality;var VI=ur({expandFactor:2,inflateFactor:2,multFactor:1,maxIterations:20,attributes:[function(t){return 1}]}),UI=function(e){return VI(e)},qI=function(e,n){for(var r=0,a=0;a<n.length;a++)r+=n[a](e);return r},HI=function(e,n,r){for(var a=0;a<n;a++)e[a*n+a]=r},VC=function(e,n){for(var r,a=0;a<n;a++){r=0;for(var i=0;i<n;i++)r+=e[i*n+a];for(var s=0;s<n;s++)e[s*n+a]=e[s*n+a]/r}},WI=function(e,n,r){for(var a=new Array(r*r),i=0;i<r;i++){for(var s=0;s<r;s++)a[i*r+s]=0;for(var o=0;o<r;o++)for(var l=0;l<r;l++)a[i*r+l]+=e[i*r+o]*n[o*r+l]}return a},KI=function(e,n,r){for(var a=e.slice(0),i=1;i<r;i++)e=WI(e,a,n);return e},GI=function(e,n,r){for(var a=new Array(n*n),i=0;i<n*n;i++)a[i]=Math.pow(e[i],r);return VC(a,n),a},YI=function(e,n,r,a){for(var i=0;i<r;i++){var s=Math.round(e[i]*Math.pow(10,a))/Math.pow(10,a),o=Math.round(n[i]*Math.pow(10,a))/Math.pow(10,a);if(s!==o)return!1}return!0},XI=function(e,n,r,a){for(var i=[],s=0;s<n;s++){for(var o=[],l=0;l<n;l++)Math.round(e[s*n+l]*1e3)/1e3>0&&o.push(r[l]);o.length!==0&&i.push(a.collection(o))}return i},QI=function(e,n){for(var r=0;r<e.length;r++)if(!n[r]||e[r].id()!==n[r].id())return!1;return!0},ZI=function(e){for(var n=0;n<e.length;n++)for(var r=0;r<e.length;r++)n!=r&&QI(e[n],e[r])&&e.splice(r,1);return e},Qb=function(e){for(var n=this.nodes(),r=this.edges(),a=this.cy(),i=UI(e),s={},o=0;o<n.length;o++)s[n[o].id()]=o;for(var l=n.length,u=l*l,d=new Array(u),f,h=0;h<u;h++)d[h]=0;for(var v=0;v<r.length;v++){var p=r[v],y=s[p.source().id()],b=s[p.target().id()],m=qI(p,i.attributes);d[y*l+b]+=m,d[b*l+y]+=m}HI(d,l,i.multFactor),VC(d,l);for(var g=!0,w=0;g&&w<i.maxIterations;)g=!1,f=KI(d,l,i.expandFactor),d=GI(f,l,i.inflateFactor),YI(d,f,u,4)||(g=!0),w++;var x=XI(d,l,n,a);return x=ZI(x),x},JI={markovClustering:Qb,mcl:Qb},eL=function(e){return e},UC=function(e,n){return Math.abs(n-e)},Zb=function(e,n,r){return e+UC(n,r)},Jb=function(e,n,r){return e+Math.pow(r-n,2)},tL=function(e){return Math.sqrt(e)},nL=function(e,n,r){return Math.max(e,UC(n,r))},kl=function(e,n,r,a,i){for(var s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:eL,o=a,l,u,d=0;d<e;d++)l=n(d),u=r(d),o=i(o,l,u);return s(o)},Ho={euclidean:function(e,n,r){return e>=2?kl(e,n,r,0,Jb,tL):kl(e,n,r,0,Zb)},squaredEuclidean:function(e,n,r){return kl(e,n,r,0,Jb)},manhattan:function(e,n,r){return kl(e,n,r,0,Zb)},max:function(e,n,r){return kl(e,n,r,-1/0,nL)}};Ho["squared-euclidean"]=Ho.squaredEuclidean;Ho.squaredeuclidean=Ho.squaredEuclidean;function Df(t,e,n,r,a,i){var s;return En(t)?s=t:s=Ho[t]||Ho.euclidean,e===0&&En(t)?s(a,i):s(e,n,r,a,i)}var rL=ur({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),cy=function(e){return rL(e)},Wd=function(e,n,r,a,i){var s=i!=="kMedoids",o=s?function(f){return r[f]}:function(f){return a[f](r)},l=function(h){return a[h](n)},u=r,d=n;return Df(e,a.length,o,l,u,d)},dv=function(e,n,r){for(var a=r.length,i=new Array(a),s=new Array(a),o=new Array(n),l=null,u=0;u<a;u++)i[u]=e.min(r[u]).value,s[u]=e.max(r[u]).value;for(var d=0;d<n;d++){l=[];for(var f=0;f<a;f++)l[f]=Math.random()*(s[f]-i[f])+i[f];o[d]=l}return o},qC=function(e,n,r,a,i){for(var s=1/0,o=0,l=0;l<n.length;l++){var u=Wd(r,e,n[l],a,i);u<s&&(s=u,o=l)}return o},HC=function(e,n,r){for(var a=[],i=null,s=0;s<n.length;s++)i=n[s],r[i.id()]===e&&a.push(i);return a},aL=function(e,n,r){return Math.abs(n-e)<=r},iL=function(e,n,r){for(var a=0;a<e.length;a++)for(var i=0;i<e[a].length;i++){var s=Math.abs(e[a][i]-n[a][i]);if(s>r)return!1}return!0},sL=function(e,n,r){for(var a=0;a<r;a++)if(e===n[a])return!0;return!1},ex=function(e,n){var r=new Array(n);if(e.length<50)for(var a=0;a<n;a++){for(var i=e[Math.floor(Math.random()*e.length)];sL(i,r,a);)i=e[Math.floor(Math.random()*e.length)];r[a]=i}else for(var s=0;s<n;s++)r[s]=e[Math.floor(Math.random()*e.length)];return r},tx=function(e,n,r){for(var a=0,i=0;i<n.length;i++)a+=Wd("manhattan",n[i],e,r,"kMedoids");return a},oL=function(e){var n=this.cy(),r=this.nodes(),a=null,i=cy(e),s=new Array(i.k),o={},l;i.testMode?typeof i.testCentroids=="number"?(i.testCentroids,l=dv(r,i.k,i.attributes)):Gn(i.testCentroids)==="object"?l=i.testCentroids:l=dv(r,i.k,i.attributes):l=dv(r,i.k,i.attributes);for(var u=!0,d=0;u&&d<i.maxIterations;){for(var f=0;f<r.length;f++)a=r[f],o[a.id()]=qC(a,l,i.distance,i.attributes,"kMeans");u=!1;for(var h=0;h<i.k;h++){var v=HC(h,r,o);if(v.length!==0){for(var p=i.attributes.length,y=l[h],b=new Array(p),m=new Array(p),g=0;g<p;g++){m[g]=0;for(var w=0;w<v.length;w++)a=v[w],m[g]+=i.attributes[g](a);b[g]=m[g]/v.length,aL(b[g],y[g],i.sensitivityThreshold)||(u=!0)}l[h]=b,s[h]=n.collection(v)}}d++}return s},lL=function(e){var n=this.cy(),r=this.nodes(),a=null,i=cy(e),s=new Array(i.k),o,l={},u,d=new Array(i.k);i.testMode?typeof i.testCentroids=="number"||(Gn(i.testCentroids)==="object"?o=i.testCentroids:o=ex(r,i.k)):o=ex(r,i.k);for(var f=!0,h=0;f&&h<i.maxIterations;){for(var v=0;v<r.length;v++)a=r[v],l[a.id()]=qC(a,o,i.distance,i.attributes,"kMedoids");f=!1;for(var p=0;p<o.length;p++){var y=HC(p,r,l);if(y.length!==0){d[p]=tx(o[p],y,i.attributes);for(var b=0;b<y.length;b++)u=tx(y[b],y,i.attributes),u<d[p]&&(d[p]=u,o[p]=y[b],f=!0);s[p]=n.collection(y)}}h++}return s},uL=function(e,n,r,a,i){for(var s,o,l=0;l<n.length;l++)for(var u=0;u<e.length;u++)a[l][u]=Math.pow(r[l][u],i.m);for(var d=0;d<e.length;d++)for(var f=0;f<i.attributes.length;f++){s=0,o=0;for(var h=0;h<n.length;h++)s+=a[h][d]*i.attributes[f](n[h]),o+=a[h][d];e[d][f]=s/o}},cL=function(e,n,r,a,i){for(var s=0;s<e.length;s++)n[s]=e[s].slice();for(var o,l,u,d=2/(i.m-1),f=0;f<r.length;f++)for(var h=0;h<a.length;h++){o=0;for(var v=0;v<r.length;v++)l=Wd(i.distance,a[h],r[f],i.attributes,"cmeans"),u=Wd(i.distance,a[h],r[v],i.attributes,"cmeans"),o+=Math.pow(l/u,d);e[h][f]=1/o}},dL=function(e,n,r,a){for(var i=new Array(r.k),s=0;s<i.length;s++)i[s]=[];for(var o,l,u=0;u<n.length;u++){o=-1/0,l=-1;for(var d=0;d<n[0].length;d++)n[u][d]>o&&(o=n[u][d],l=d);i[l].push(e[u])}for(var f=0;f<i.length;f++)i[f]=a.collection(i[f]);return i},nx=function(e){var n=this.cy(),r=this.nodes(),a=cy(e),i,s,o,l,u;l=new Array(r.length);for(var d=0;d<r.length;d++)l[d]=new Array(a.k);o=new Array(r.length);for(var f=0;f<r.length;f++)o[f]=new Array(a.k);for(var h=0;h<r.length;h++){for(var v=0,p=0;p<a.k;p++)o[h][p]=Math.random(),v+=o[h][p];for(var y=0;y<a.k;y++)o[h][y]=o[h][y]/v}s=new Array(a.k);for(var b=0;b<a.k;b++)s[b]=new Array(a.attributes.length);u=new Array(r.length);for(var m=0;m<r.length;m++)u[m]=new Array(a.k);for(var g=!0,w=0;g&&w<a.maxIterations;)g=!1,uL(s,r,o,u,a),cL(o,l,s,r,a),iL(o,l,a.sensitivityThreshold)||(g=!0),w++;return i=dL(r,o,a,n),{clusters:i,degreeOfMembership:o}},fL={kMeans:oL,kMedoids:lL,fuzzyCMeans:nx,fcm:nx},hL=ur({distance:"euclidean",linkage:"min",mode:"threshold",threshold:1/0,addDendrogram:!1,dendrogramDepth:0,attributes:[]}),vL={single:"min",complete:"max"},pL=function(e){var n=hL(e),r=vL[n.linkage];return r!=null&&(n.linkage=r),n},rx=function(e,n,r,a,i){for(var s=0,o=1/0,l,u=i.attributes,d=function(N,P){return Df(i.distance,u.length,function(R){return u[R](N)},function(R){return u[R](P)},N,P)},f=0;f<e.length;f++){var h=e[f].key,v=r[h][a[h]];v<o&&(s=h,o=v)}if(i.mode==="threshold"&&o>=i.threshold||i.mode==="dendrogram"&&e.length===1)return!1;var p=n[s],y=n[a[s]],b;i.mode==="dendrogram"?b={left:p,right:y,key:p.key}:b={value:p.value.concat(y.value),key:p.key},e[p.index]=b,e.splice(y.index,1),n[p.key]=b;for(var m=0;m<e.length;m++){var g=e[m];p.key===g.key?l=1/0:i.linkage==="min"?(l=r[p.key][g.key],r[p.key][g.key]>r[y.key][g.key]&&(l=r[y.key][g.key])):i.linkage==="max"?(l=r[p.key][g.key],r[p.key][g.key]<r[y.key][g.key]&&(l=r[y.key][g.key])):i.linkage==="mean"?l=(r[p.key][g.key]*p.size+r[y.key][g.key]*y.size)/(p.size+y.size):i.mode==="dendrogram"?l=d(g.value,p.value):l=d(g.value[0],p.value[0]),r[p.key][g.key]=r[g.key][p.key]=l}for(var w=0;w<e.length;w++){var x=e[w].key;if(a[x]===p.key||a[x]===y.key){for(var E=x,S=0;S<e.length;S++){var C=e[S].key;r[x][C]<r[x][E]&&(E=C)}a[x]=E}e[w].index=w}return p.key=y.key=p.index=y.index=null,!0},xo=function(e,n,r){e&&(e.value?n.push(e.value):(e.left&&xo(e.left,n),e.right&&xo(e.right,n)))},Dg=function(e,n){if(!e)return"";if(e.left&&e.right){var r=Dg(e.left,n),a=Dg(e.right,n),i=n.add({group:"nodes",data:{id:r+","+a}});return n.add({group:"edges",data:{source:r,target:i.id()}}),n.add({group:"edges",data:{source:a,target:i.id()}}),i.id()}else if(e.value)return e.value.id()},Bg=function(e,n,r){if(!e)return[];var a=[],i=[],s=[];return n===0?(e.left&&xo(e.left,a),e.right&&xo(e.right,i),s=a.concat(i),[r.collection(s)]):n===1?e.value?[r.collection(e.value)]:(e.left&&xo(e.left,a),e.right&&xo(e.right,i),[r.collection(a),r.collection(i)]):e.value?[r.collection(e.value)]:(e.left&&(a=Bg(e.left,n-1,r)),e.right&&(i=Bg(e.right,n-1,r)),a.concat(i))},ax=function(e){for(var n=this.cy(),r=this.nodes(),a=pL(e),i=a.attributes,s=function(w,x){return Df(a.distance,i.length,function(E){return i[E](w)},function(E){return i[E](x)},w,x)},o=[],l=[],u=[],d=[],f=0;f<r.length;f++){var h={value:a.mode==="dendrogram"?r[f]:[r[f]],key:f,index:f};o[f]=h,d[f]=h,l[f]=[],u[f]=0}for(var v=0;v<o.length;v++)for(var p=0;p<=v;p++){var y=void 0;a.mode==="dendrogram"?y=v===p?1/0:s(o[v].value,o[p].value):y=v===p?1/0:s(o[v].value[0],o[p].value[0]),l[v][p]=y,l[p][v]=y,y<l[v][u[v]]&&(u[v]=p)}for(var b=rx(o,d,l,u,a);b;)b=rx(o,d,l,u,a);var m;return a.mode==="dendrogram"?(m=Bg(o[0],a.dendrogramDepth,n),a.addDendrogram&&Dg(o[0],n)):(m=new Array(o.length),o.forEach(function(g,w){g.key=g.index=null,m[w]=n.collection(g.value)})),m},gL={hierarchicalClustering:ax,hca:ax},mL=ur({distance:"euclidean",preference:"median",damping:.8,maxIterations:1e3,minIterations:100,attributes:[]}),yL=function(e){var n=e.damping,r=e.preference;.5<=n&&n<1||yn("Damping must range on [0.5, 1). Got: ".concat(n));var a=["median","mean","min","max"];return a.some(function(i){return i===r})||_e(r)||yn("Preference must be one of [".concat(a.map(function(i){return"'".concat(i,"'")}).join(", "),"] or a number. Got: ").concat(r)),mL(e)},bL=function(e,n,r,a){var i=function(o,l){return a[l](o)};return-Df(e,a.length,function(s){return i(n,s)},function(s){return i(r,s)},n,r)},xL=function(e,n){var r=null;return n==="median"?r=yI(e):n==="mean"?r=mI(e):n==="min"?r=pI(e):n==="max"?r=gI(e):r=n,r},wL=function(e,n,r){for(var a=[],i=0;i<e;i++)n[i*e+i]+r[i*e+i]>0&&a.push(i);return a},ix=function(e,n,r){for(var a=[],i=0;i<e;i++){for(var s=-1,o=-1/0,l=0;l<r.length;l++){var u=r[l];n[i*e+u]>o&&(s=u,o=n[i*e+u])}s>0&&a.push(s)}for(var d=0;d<r.length;d++)a[r[d]]=r[d];return a},kL=function(e,n,r){for(var a=ix(e,n,r),i=0;i<r.length;i++){for(var s=[],o=0;o<a.length;o++)a[o]===r[i]&&s.push(o);for(var l=-1,u=-1/0,d=0;d<s.length;d++){for(var f=0,h=0;h<s.length;h++)f+=n[s[h]*e+s[d]];f>u&&(l=d,u=f)}r[i]=s[l]}return a=ix(e,n,r),a},sx=function(e){for(var n=this.cy(),r=this.nodes(),a=yL(e),i={},s=0;s<r.length;s++)i[r[s].id()]=s;var o,l,u,d,f,h;o=r.length,l=o*o,u=new Array(l);for(var v=0;v<l;v++)u[v]=-1/0;for(var p=0;p<o;p++)for(var y=0;y<o;y++)p!==y&&(u[p*o+y]=bL(a.distance,r[p],r[y],a.attributes));d=xL(u,a.preference);for(var b=0;b<o;b++)u[b*o+b]=d;f=new Array(l);for(var m=0;m<l;m++)f[m]=0;h=new Array(l);for(var g=0;g<l;g++)h[g]=0;for(var w=new Array(o),x=new Array(o),E=new Array(o),S=0;S<o;S++)w[S]=0,x[S]=0,E[S]=0;for(var C=new Array(o*a.minIterations),T=0;T<C.length;T++)C[T]=0;var N;for(N=0;N<a.maxIterations;N++){for(var P=0;P<o;P++){for(var R=-1/0,I=-1/0,D=-1,$=0,H=0;H<o;H++)w[H]=f[P*o+H],$=h[P*o+H]+u[P*o+H],$>=R?(I=R,R=$,D=H):$>I&&(I=$);for(var V=0;V<o;V++)f[P*o+V]=(1-a.damping)*(u[P*o+V]-R)+a.damping*w[V];f[P*o+D]=(1-a.damping)*(u[P*o+D]-I)+a.damping*w[D]}for(var U=0;U<o;U++){for(var F=0,G=0;G<o;G++)w[G]=h[G*o+U],x[G]=Math.max(0,f[G*o+U]),F+=x[G];F-=x[U],x[U]=f[U*o+U],F+=x[U];for(var z=0;z<o;z++)h[z*o+U]=(1-a.damping)*Math.min(0,F-x[z])+a.damping*w[z];h[U*o+U]=(1-a.damping)*(F-x[U])+a.damping*w[U]}for(var _=0,K=0;K<o;K++){var ie=h[K*o+K]+f[K*o+K]>0?1:0;C[N%a.minIterations*o+K]=ie,_+=ie}if(_>0&&(N>=a.minIterations-1||N==a.maxIterations-1)){for(var M=0,oe=0;oe<o;oe++){E[oe]=0;for(var ve=0;ve<a.minIterations;ve++)E[oe]+=C[ve*o+oe];(E[oe]===0||E[oe]===a.minIterations)&&M++}if(M===o)break}}for(var ye=wL(o,f,h),Te=kL(o,u,ye),fe={},Z=0;Z<ye.length;Z++)fe[ye[Z]]=[];for(var ee=0;ee<r.length;ee++){var ne=i[r[ee].id()],de=Te[ne];de!=null&&fe[de].push(r[ee])}for(var Re=new Array(ye.length),Ge=0;Ge<ye.length;Ge++)Re[Ge]=n.collection(fe[ye[Ge]]);return Re},EL={affinityPropagation:sx,ap:sx},CL=ur({root:void 0,directed:!1}),SL={hierholzer:function(e){if(!Wt(e)){var n=arguments;e={root:n[0],directed:n[1]}}var r=CL(e),a=r.root,i=r.directed,s=this,o=!1,l,u,d;a&&(d=ft(a)?this.filter(a)[0].id():a[0].id());var f={},h={};i?s.forEach(function(g){var w=g.id();if(g.isNode()){var x=g.indegree(!0),E=g.outdegree(!0),S=x-E,C=E-x;S==1?l?o=!0:l=w:C==1?u?o=!0:u=w:(C>1||S>1)&&(o=!0),f[w]=[],g.outgoers().forEach(function(T){T.isEdge()&&f[w].push(T.id())})}else h[w]=[void 0,g.target().id()]}):s.forEach(function(g){var w=g.id();if(g.isNode()){var x=g.degree(!0);x%2&&(l?u?o=!0:u=w:l=w),f[w]=[],g.connectedEdges().forEach(function(E){return f[w].push(E.id())})}else h[w]=[g.source().id(),g.target().id()]});var v={found:!1,trail:void 0};if(o)return v;if(u&&l)if(i){if(d&&u!=d)return v;d=u}else{if(d&&u!=d&&l!=d)return v;d||(d=u)}else d||(d=s[0].id());var p=function(w){for(var x=w,E=[w],S,C,T;f[x].length;)S=f[x].shift(),C=h[S][0],T=h[S][1],x!=T?(f[T]=f[T].filter(function(N){return N!=S}),x=T):!i&&x!=C&&(f[C]=f[C].filter(function(N){return N!=S}),x=C),E.unshift(S),E.unshift(x);return E},y=[],b=[];for(b=p(d);b.length!=1;)f[b[0]].length==0?(y.unshift(s.getElementById(b.shift())),y.unshift(s.getElementById(b.shift()))):b=p(b.shift()).concat(b);y.unshift(s.getElementById(b.shift()));for(var m in f)if(f[m].length)return v;return v.found=!0,v.trail=this.spawn(y,!0),v}},Ic=function(){var e=this,n={},r=0,a=0,i=[],s=[],o={},l=function(h,v){for(var p=s.length-1,y=[],b=e.spawn();s[p].x!=h||s[p].y!=v;)y.push(s.pop().edge),p--;y.push(s.pop().edge),y.forEach(function(m){var g=m.connectedNodes().intersection(e);b.merge(m),g.forEach(function(w){var x=w.id(),E=w.connectedEdges().intersection(e);b.merge(w),n[x].cutVertex?b.merge(E.filter(function(S){return S.isLoop()})):b.merge(E)})}),i.push(b)},u=function(h,v,p){h===p&&(a+=1),n[v]={id:r,low:r++,cutVertex:!1};var y=e.getElementById(v).connectedEdges().intersection(e);if(y.size()===0)i.push(e.spawn(e.getElementById(v)));else{var b,m,g,w;y.forEach(function(x){b=x.source().id(),m=x.target().id(),g=b===v?m:b,g!==p&&(w=x.id(),o[w]||(o[w]=!0,s.push({x:v,y:g,edge:x})),g in n?n[v].low=Math.min(n[v].low,n[g].id):(u(h,g,v),n[v].low=Math.min(n[v].low,n[g].low),n[v].id<=n[g].low&&(n[v].cutVertex=!0,l(v,g))))})}};e.forEach(function(f){if(f.isNode()){var h=f.id();h in n||(a=0,u(h,h),n[h].cutVertex=a>1)}});var d=Object.keys(n).filter(function(f){return n[f].cutVertex}).map(function(f){return e.getElementById(f)});return{cut:e.spawn(d),components:i}},jL={hopcroftTarjanBiconnected:Ic,htbc:Ic,htb:Ic,hopcroftTarjanBiconnectedComponents:Ic},Lc=function(){var e=this,n={},r=0,a=[],i=[],s=e.spawn(e),o=function(u){i.push(u),n[u]={index:r,low:r++,explored:!1};var d=e.getElementById(u).connectedEdges().intersection(e);if(d.forEach(function(y){var b=y.target().id();b!==u&&(b in n||o(b),n[b].explored||(n[u].low=Math.min(n[u].low,n[b].low)))}),n[u].index===n[u].low){for(var f=e.spawn();;){var h=i.pop();if(f.merge(e.getElementById(h)),n[h].low=n[u].index,n[h].explored=!0,h===u)break}var v=f.edgesWith(f),p=f.merge(v);a.push(p),s=s.difference(p)}};return e.forEach(function(l){if(l.isNode()){var u=l.id();u in n||o(u)}}),{cut:s,components:a}},TL={tarjanStronglyConnected:Lc,tsc:Lc,tscc:Lc,tarjanStronglyConnectedComponents:Lc},WC={};[wu,rI,aI,sI,lI,cI,hI,_I,Io,Lo,Ag,JI,fL,gL,EL,SL,jL,TL].forEach(function(t){pt(WC,t)});/*!
|
|
77
|
+
Embeddable Minimum Strictly-Compliant Promises/A+ 1.1.1 Thenable
|
|
78
|
+
Copyright (c) 2013-2014 Ralf S. Engelschall (http://engelschall.com)
|
|
79
|
+
Licensed under The MIT License (http://opensource.org/licenses/MIT)
|
|
80
|
+
*/var KC=0,GC=1,YC=2,Ca=function(e){if(!(this instanceof Ca))return new Ca(e);this.id="Thenable/1.0.7",this.state=KC,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))};Ca.prototype={fulfill:function(e){return ox(this,GC,"fulfillValue",e)},reject:function(e){return ox(this,YC,"rejectReason",e)},then:function(e,n){var r=this,a=new Ca;return r.onFulfilled.push(ux(e,a,"fulfill")),r.onRejected.push(ux(n,a,"reject")),XC(r),a.proxy}};var ox=function(e,n,r,a){return e.state===KC&&(e.state=n,e[r]=a,XC(e)),e},XC=function(e){e.state===GC?lx(e,"onFulfilled",e.fulfillValue):e.state===YC&&lx(e,"onRejected",e.rejectReason)},lx=function(e,n,r){if(e[n].length!==0){var a=e[n];e[n]=[];var i=function(){for(var o=0;o<a.length;o++)a[o](r)};typeof setImmediate=="function"?setImmediate(i):setTimeout(i,0)}},ux=function(e,n,r){return function(a){if(typeof e!="function")n[r].call(n,a);else{var i;try{i=e(a)}catch(s){n.reject(s);return}QC(n,i)}}},QC=function(e,n){if(e===n||e.proxy===n){e.reject(new TypeError("cannot resolve promise with itself"));return}var r;if(Gn(n)==="object"&&n!==null||typeof n=="function")try{r=n.then}catch(i){e.reject(i);return}if(typeof r=="function"){var a=!1;try{r.call(n,function(i){a||(a=!0,i===n?e.reject(new TypeError("circular thenable chain")):QC(e,i))},function(i){a||(a=!0,e.reject(i))})}catch(i){a||e.reject(i)}return}e.fulfill(n)};Ca.all=function(t){return new Ca(function(e,n){for(var r=new Array(t.length),a=0,i=function(l,u){r[l]=u,a++,a===t.length&&e(r)},s=0;s<t.length;s++)(function(o){var l=t[o],u=l!=null&&l.then!=null;if(u)l.then(function(f){i(o,f)},function(f){n(f)});else{var d=l;i(o,d)}})(s)})};Ca.resolve=function(t){return new Ca(function(e,n){e(t)})};Ca.reject=function(t){return new Ca(function(e,n){n(t)})};var nl=typeof Promise<"u"?Promise:Ca,Mg=function(e,n,r){var a=ey(e),i=!a,s=this._private=pt({duration:1e3},n,r);if(s.target=e,s.style=s.style||s.css,s.started=!1,s.playing=!1,s.hooked=!1,s.applying=!1,s.progress=0,s.completes=[],s.frames=[],s.complete&&En(s.complete)&&s.completes.push(s.complete),i){var o=e.position();s.startPosition=s.startPosition||{x:o.x,y:o.y},s.startStyle=s.startStyle||e.cy().style().getAnimationStartStyle(e,s.style)}if(a){var l=e.pan();s.startPan={x:l.x,y:l.y},s.startZoom=e.zoom()}this.length=1,this[0]=this},Ms=Mg.prototype;pt(Ms,{instanceString:function(){return"animation"},hook:function(){var e=this._private;if(!e.hooked){var n,r=e.target._private.animation;e.queue?n=r.queue:n=r.current,n.push(this),Xr(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 n=this._private;return e===void 0?n.progress*n.duration:this.progress(e/n.duration)},progress:function(e){var n=this._private,r=n.playing;return e===void 0?n.progress:(r&&this.pause(),n.progress=e,n.started=!1,r&&this.play(),this)},completed:function(){return this._private.progress===1},reverse:function(){var e=this._private,n=e.playing;n&&this.pause(),e.progress=1-e.progress,e.started=!1;var r=function(u,d){var f=e[u];f!=null&&(e[u]=e[d],e[d]=f)};if(r("zoom","startZoom"),r("pan","startPan"),r("position","startPosition"),e.style)for(var a=0;a<e.style.length;a++){var i=e.style[a],s=i.name,o=e.startStyle[s];e.startStyle[s]=i,e.style[a]=o}return n&&this.play(),this},promise:function(e){var n=this._private,r;switch(e){case"frame":r=n.frames;break;default:case"complete":case"completed":r=n.completes}return new nl(function(a,i){r.push(function(){a()})})}});Ms.complete=Ms.completed;Ms.run=Ms.play;Ms.running=Ms.playing;var NL={animated:function(){return function(){var n=this,r=n.length!==void 0,a=r?n:[n],i=this._private.cy||this;if(!i.styleEnabled())return!1;var s=a[0];if(s)return s._private.animation.current.length>0}},clearQueue:function(){return function(){var n=this,r=n.length!==void 0,a=r?n:[n],i=this._private.cy||this;if(!i.styleEnabled())return this;for(var s=0;s<a.length;s++){var o=a[s];o._private.animation.queue=[]}return this}},delay:function(){return function(n,r){var a=this._private.cy||this;return a.styleEnabled()?this.animate({delay:n,duration:n,complete:r}):this}},delayAnimation:function(){return function(n,r){var a=this._private.cy||this;return a.styleEnabled()?this.animation({delay:n,duration:n,complete:r}):this}},animation:function(){return function(n,r){var a=this,i=a.length!==void 0,s=i?a:[a],o=this._private.cy||this,l=!i,u=!l;if(!o.styleEnabled())return this;var d=o.style();n=pt({},n,r);var f=Object.keys(n).length===0;if(f)return new Mg(s[0],n);switch(n.duration===void 0&&(n.duration=400),n.duration){case"slow":n.duration=600;break;case"fast":n.duration=200;break}if(u&&(n.style=d.getPropsList(n.style||n.css),n.css=void 0),u&&n.renderedPosition!=null){var h=n.renderedPosition,v=o.pan(),p=o.zoom();n.position=MC(h,p,v)}if(l&&n.panBy!=null){var y=n.panBy,b=o.pan();n.pan={x:b.x+y.x,y:b.y+y.y}}var m=n.center||n.centre;if(l&&m!=null){var g=o.getCenterPan(m.eles,n.zoom);g!=null&&(n.pan=g)}if(l&&n.fit!=null){var w=n.fit,x=o.getFitViewport(w.eles||w.boundingBox,w.padding);x!=null&&(n.pan=x.pan,n.zoom=x.zoom)}if(l&&Wt(n.zoom)){var E=o.getZoomedViewport(n.zoom);E!=null?(E.zoomed&&(n.zoom=E.zoom),E.panned&&(n.pan=E.pan)):n.zoom=null}return new Mg(s[0],n)}},animate:function(){return function(n,r){var a=this,i=a.length!==void 0,s=i?a:[a],o=this._private.cy||this;if(!o.styleEnabled())return this;r&&(n=pt({},n,r));for(var l=0;l<s.length;l++){var u=s[l],d=u.animated()&&(n.queue===void 0||n.queue),f=u.animation(n,d?{queue:!0}:void 0);f.play()}return this}},stop:function(){return function(n,r){var a=this,i=a.length!==void 0,s=i?a:[a],o=this._private.cy||this;if(!o.styleEnabled())return this;for(var l=0;l<s.length;l++){for(var u=s[l],d=u._private,f=d.animation.current,h=0;h<f.length;h++){var v=f[h],p=v._private;r&&(p.duration=0)}n&&(d.animation.queue=[]),r||(d.animation.current=[])}return o.notify("draw"),this}}},fv,cx;function Bf(){if(cx)return fv;cx=1;var t=Array.isArray;return fv=t,fv}var hv,dx;function PL(){if(dx)return hv;dx=1;var t=Bf(),e=Vu(),n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;function a(i,s){if(t(i))return!1;var o=typeof i;return o=="number"||o=="symbol"||o=="boolean"||i==null||e(i)?!0:r.test(i)||!n.test(i)||s!=null&&i in Object(s)}return hv=a,hv}var vv,fx;function RL(){if(fx)return vv;fx=1;var t=TC(),e=$u(),n="[object AsyncFunction]",r="[object Function]",a="[object GeneratorFunction]",i="[object Proxy]";function s(o){if(!e(o))return!1;var l=t(o);return l==r||l==a||l==n||l==i}return vv=s,vv}var pv,hx;function IL(){if(hx)return pv;hx=1;var t=If(),e=t["__core-js_shared__"];return pv=e,pv}var gv,vx;function LL(){if(vx)return gv;vx=1;var t=IL(),e=function(){var r=/[^.]+$/.exec(t&&t.keys&&t.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""}();function n(r){return!!e&&e in r}return gv=n,gv}var mv,px;function AL(){if(px)return mv;px=1;var t=Function.prototype,e=t.toString;function n(r){if(r!=null){try{return e.call(r)}catch{}try{return r+""}catch{}}return""}return mv=n,mv}var yv,gx;function DL(){if(gx)return yv;gx=1;var t=RL(),e=LL(),n=$u(),r=AL(),a=/[\\^$.*+?()[\]{}|]/g,i=/^\[object .+?Constructor\]$/,s=Function.prototype,o=Object.prototype,l=s.toString,u=o.hasOwnProperty,d=RegExp("^"+l.call(u).replace(a,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function f(h){if(!n(h)||e(h))return!1;var v=t(h)?d:i;return v.test(r(h))}return yv=f,yv}var bv,mx;function BL(){if(mx)return bv;mx=1;function t(e,n){return e==null?void 0:e[n]}return bv=t,bv}var xv,yx;function dy(){if(yx)return xv;yx=1;var t=DL(),e=BL();function n(r,a){var i=e(r,a);return t(i)?i:void 0}return xv=n,xv}var wv,bx;function Mf(){if(bx)return wv;bx=1;var t=dy(),e=t(Object,"create");return wv=e,wv}var kv,xx;function ML(){if(xx)return kv;xx=1;var t=Mf();function e(){this.__data__=t?t(null):{},this.size=0}return kv=e,kv}var Ev,wx;function OL(){if(wx)return Ev;wx=1;function t(e){var n=this.has(e)&&delete this.__data__[e];return this.size-=n?1:0,n}return Ev=t,Ev}var Cv,kx;function zL(){if(kx)return Cv;kx=1;var t=Mf(),e="__lodash_hash_undefined__",n=Object.prototype,r=n.hasOwnProperty;function a(i){var s=this.__data__;if(t){var o=s[i];return o===e?void 0:o}return r.call(s,i)?s[i]:void 0}return Cv=a,Cv}var Sv,Ex;function FL(){if(Ex)return Sv;Ex=1;var t=Mf(),e=Object.prototype,n=e.hasOwnProperty;function r(a){var i=this.__data__;return t?i[a]!==void 0:n.call(i,a)}return Sv=r,Sv}var jv,Cx;function _L(){if(Cx)return jv;Cx=1;var t=Mf(),e="__lodash_hash_undefined__";function n(r,a){var i=this.__data__;return this.size+=this.has(r)?0:1,i[r]=t&&a===void 0?e:a,this}return jv=n,jv}var Tv,Sx;function $L(){if(Sx)return Tv;Sx=1;var t=ML(),e=OL(),n=zL(),r=FL(),a=_L();function i(s){var o=-1,l=s==null?0:s.length;for(this.clear();++o<l;){var u=s[o];this.set(u[0],u[1])}}return i.prototype.clear=t,i.prototype.delete=e,i.prototype.get=n,i.prototype.has=r,i.prototype.set=a,Tv=i,Tv}var Nv,jx;function VL(){if(jx)return Nv;jx=1;function t(){this.__data__=[],this.size=0}return Nv=t,Nv}var Pv,Tx;function ZC(){if(Tx)return Pv;Tx=1;function t(e,n){return e===n||e!==e&&n!==n}return Pv=t,Pv}var Rv,Nx;function Of(){if(Nx)return Rv;Nx=1;var t=ZC();function e(n,r){for(var a=n.length;a--;)if(t(n[a][0],r))return a;return-1}return Rv=e,Rv}var Iv,Px;function UL(){if(Px)return Iv;Px=1;var t=Of(),e=Array.prototype,n=e.splice;function r(a){var i=this.__data__,s=t(i,a);if(s<0)return!1;var o=i.length-1;return s==o?i.pop():n.call(i,s,1),--this.size,!0}return Iv=r,Iv}var Lv,Rx;function qL(){if(Rx)return Lv;Rx=1;var t=Of();function e(n){var r=this.__data__,a=t(r,n);return a<0?void 0:r[a][1]}return Lv=e,Lv}var Av,Ix;function HL(){if(Ix)return Av;Ix=1;var t=Of();function e(n){return t(this.__data__,n)>-1}return Av=e,Av}var Dv,Lx;function WL(){if(Lx)return Dv;Lx=1;var t=Of();function e(n,r){var a=this.__data__,i=t(a,n);return i<0?(++this.size,a.push([n,r])):a[i][1]=r,this}return Dv=e,Dv}var Bv,Ax;function KL(){if(Ax)return Bv;Ax=1;var t=VL(),e=UL(),n=qL(),r=HL(),a=WL();function i(s){var o=-1,l=s==null?0:s.length;for(this.clear();++o<l;){var u=s[o];this.set(u[0],u[1])}}return i.prototype.clear=t,i.prototype.delete=e,i.prototype.get=n,i.prototype.has=r,i.prototype.set=a,Bv=i,Bv}var Mv,Dx;function GL(){if(Dx)return Mv;Dx=1;var t=dy(),e=If(),n=t(e,"Map");return Mv=n,Mv}var Ov,Bx;function YL(){if(Bx)return Ov;Bx=1;var t=$L(),e=KL(),n=GL();function r(){this.size=0,this.__data__={hash:new t,map:new(n||e),string:new t}}return Ov=r,Ov}var zv,Mx;function XL(){if(Mx)return zv;Mx=1;function t(e){var n=typeof e;return n=="string"||n=="number"||n=="symbol"||n=="boolean"?e!=="__proto__":e===null}return zv=t,zv}var Fv,Ox;function zf(){if(Ox)return Fv;Ox=1;var t=XL();function e(n,r){var a=n.__data__;return t(r)?a[typeof r=="string"?"string":"hash"]:a.map}return Fv=e,Fv}var _v,zx;function QL(){if(zx)return _v;zx=1;var t=zf();function e(n){var r=t(this,n).delete(n);return this.size-=r?1:0,r}return _v=e,_v}var $v,Fx;function ZL(){if(Fx)return $v;Fx=1;var t=zf();function e(n){return t(this,n).get(n)}return $v=e,$v}var Vv,_x;function JL(){if(_x)return Vv;_x=1;var t=zf();function e(n){return t(this,n).has(n)}return Vv=e,Vv}var Uv,$x;function eA(){if($x)return Uv;$x=1;var t=zf();function e(n,r){var a=t(this,n),i=a.size;return a.set(n,r),this.size+=a.size==i?0:1,this}return Uv=e,Uv}var qv,Vx;function tA(){if(Vx)return qv;Vx=1;var t=YL(),e=QL(),n=ZL(),r=JL(),a=eA();function i(s){var o=-1,l=s==null?0:s.length;for(this.clear();++o<l;){var u=s[o];this.set(u[0],u[1])}}return i.prototype.clear=t,i.prototype.delete=e,i.prototype.get=n,i.prototype.has=r,i.prototype.set=a,qv=i,qv}var Hv,Ux;function nA(){if(Ux)return Hv;Ux=1;var t=tA(),e="Expected a function";function n(r,a){if(typeof r!="function"||a!=null&&typeof a!="function")throw new TypeError(e);var i=function(){var s=arguments,o=a?a.apply(this,s):s[0],l=i.cache;if(l.has(o))return l.get(o);var u=r.apply(this,s);return i.cache=l.set(o,u)||l,u};return i.cache=new(n.Cache||t),i}return n.Cache=t,Hv=n,Hv}var Wv,qx;function rA(){if(qx)return Wv;qx=1;var t=nA(),e=500;function n(r){var a=t(r,function(s){return i.size===e&&i.clear(),s}),i=a.cache;return a}return Wv=n,Wv}var Kv,Hx;function JC(){if(Hx)return Kv;Hx=1;var t=rA(),e=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,n=/\\(\\)?/g,r=t(function(a){var i=[];return a.charCodeAt(0)===46&&i.push(""),a.replace(e,function(s,o,l,u){i.push(l?u.replace(n,"$1"):o||s)}),i});return Kv=r,Kv}var Gv,Wx;function eS(){if(Wx)return Gv;Wx=1;function t(e,n){for(var r=-1,a=e==null?0:e.length,i=Array(a);++r<a;)i[r]=n(e[r],r,e);return i}return Gv=t,Gv}var Yv,Kx;function aA(){if(Kx)return Yv;Kx=1;var t=ny(),e=eS(),n=Bf(),r=Vu(),a=t?t.prototype:void 0,i=a?a.toString:void 0;function s(o){if(typeof o=="string")return o;if(n(o))return e(o,s)+"";if(r(o))return i?i.call(o):"";var l=o+"";return l=="0"&&1/o==-1/0?"-0":l}return Yv=s,Yv}var Xv,Gx;function tS(){if(Gx)return Xv;Gx=1;var t=aA();function e(n){return n==null?"":t(n)}return Xv=e,Xv}var Qv,Yx;function nS(){if(Yx)return Qv;Yx=1;var t=Bf(),e=PL(),n=JC(),r=tS();function a(i,s){return t(i)?i:e(i,s)?[i]:n(r(i))}return Qv=a,Qv}var Zv,Xx;function fy(){if(Xx)return Zv;Xx=1;var t=Vu();function e(n){if(typeof n=="string"||t(n))return n;var r=n+"";return r=="0"&&1/n==-1/0?"-0":r}return Zv=e,Zv}var Jv,Qx;function iA(){if(Qx)return Jv;Qx=1;var t=nS(),e=fy();function n(r,a){a=t(a,r);for(var i=0,s=a.length;r!=null&&i<s;)r=r[e(a[i++])];return i&&i==s?r:void 0}return Jv=n,Jv}var ep,Zx;function sA(){if(Zx)return ep;Zx=1;var t=iA();function e(n,r,a){var i=n==null?void 0:t(n,r);return i===void 0?a:i}return ep=e,ep}var oA=sA(),lA=_u(oA),tp,Jx;function uA(){if(Jx)return tp;Jx=1;var t=dy(),e=function(){try{var n=t(Object,"defineProperty");return n({},"",{}),n}catch{}}();return tp=e,tp}var np,ew;function cA(){if(ew)return np;ew=1;var t=uA();function e(n,r,a){r=="__proto__"&&t?t(n,r,{configurable:!0,enumerable:!0,value:a,writable:!0}):n[r]=a}return np=e,np}var rp,tw;function dA(){if(tw)return rp;tw=1;var t=cA(),e=ZC(),n=Object.prototype,r=n.hasOwnProperty;function a(i,s,o){var l=i[s];(!(r.call(i,s)&&e(l,o))||o===void 0&&!(s in i))&&t(i,s,o)}return rp=a,rp}var ap,nw;function fA(){if(nw)return ap;nw=1;var t=9007199254740991,e=/^(?:0|[1-9]\d*)$/;function n(r,a){var i=typeof r;return a=a??t,!!a&&(i=="number"||i!="symbol"&&e.test(r))&&r>-1&&r%1==0&&r<a}return ap=n,ap}var ip,rw;function hA(){if(rw)return ip;rw=1;var t=dA(),e=nS(),n=fA(),r=$u(),a=fy();function i(s,o,l,u){if(!r(s))return s;o=e(o,s);for(var d=-1,f=o.length,h=f-1,v=s;v!=null&&++d<f;){var p=a(o[d]),y=l;if(p==="__proto__"||p==="constructor"||p==="prototype")return s;if(d!=h){var b=v[p];y=u?u(b,p,v):void 0,y===void 0&&(y=r(b)?b:n(o[d+1])?[]:{})}t(v,p,y),v=v[p]}return s}return ip=i,ip}var sp,aw;function vA(){if(aw)return sp;aw=1;var t=hA();function e(n,r,a){return n==null?n:t(n,r,a)}return sp=e,sp}var pA=vA(),gA=_u(pA),op,iw;function mA(){if(iw)return op;iw=1;function t(e,n){var r=-1,a=e.length;for(n||(n=Array(a));++r<a;)n[r]=e[r];return n}return op=t,op}var lp,sw;function yA(){if(sw)return lp;sw=1;var t=eS(),e=mA(),n=Bf(),r=Vu(),a=JC(),i=fy(),s=tS();function o(l){return n(l)?t(l,i):r(l)?[l]:e(a(s(l)))}return lp=o,lp}var bA=yA(),xA=_u(bA),wA={data:function(e){var n={field:"data",bindingEvent:"data",allowBinding:!1,allowSetting:!1,allowGetting:!1,settingEvent:"data",settingTriggersEvent:!1,triggerFnName:"trigger",immutableKeys:{},updateStyle:!1,beforeGet:function(a){},beforeSet:function(a,i){},onSet:function(a){},canSet:function(a){return!0}};return e=pt({},n,e),function(a,i){var s=e,o=this,l=o.length!==void 0,u=l?o:[o],d=l?o[0]:o;if(ft(a)){var f=a.indexOf(".")!==-1,h=f&&xA(a);if(s.allowGetting&&i===void 0){var v;return d&&(s.beforeGet(d),h&&d._private[s.field][a]===void 0?v=lA(d._private[s.field],h):v=d._private[s.field][a]),v}else if(s.allowSetting&&i!==void 0){var p=!s.immutableKeys[a];if(p){var y=mC({},a,i);s.beforeSet(o,y);for(var b=0,m=u.length;b<m;b++){var g=u[b];s.canSet(g)&&(h&&d._private[s.field][a]===void 0?gA(g._private[s.field],h,i):g._private[s.field][a]=i)}s.updateStyle&&o.updateStyle(),s.onSet(o),s.settingTriggersEvent&&o[s.triggerFnName](s.settingEvent)}}}else if(s.allowSetting&&Wt(a)){var w=a,x,E,S=Object.keys(w);s.beforeSet(o,w);for(var C=0;C<S.length;C++){x=S[C],E=w[x];var T=!s.immutableKeys[x];if(T)for(var N=0;N<u.length;N++){var P=u[N];s.canSet(P)&&(P._private[s.field][x]=E)}}s.updateStyle&&o.updateStyle(),s.onSet(o),s.settingTriggersEvent&&o[s.triggerFnName](s.settingEvent)}else if(s.allowBinding&&En(a)){var R=a;o.on(s.bindingEvent,R)}else if(s.allowGetting&&a===void 0){var I;return d&&(s.beforeGet(d),I=d._private[s.field]),I}return o}},removeData:function(e){var n={field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!1,immutableKeys:{}};return e=pt({},n,e),function(a){var i=e,s=this,o=s.length!==void 0,l=o?s:[s];if(ft(a)){for(var u=a.split(/\s+/),d=u.length,f=0;f<d;f++){var h=u[f];if(!qi(h)){var v=!i.immutableKeys[h];if(v)for(var p=0,y=l.length;p<y;p++)l[p]._private[i.field][h]=void 0}}i.triggerEvent&&s[i.triggerFnName](i.event)}else if(a===void 0){for(var b=0,m=l.length;b<m;b++)for(var g=l[b]._private[i.field],w=Object.keys(g),x=0;x<w.length;x++){var E=w[x],S=!i.immutableKeys[E];S&&(g[E]=void 0)}i.triggerEvent&&s[i.triggerFnName](i.event)}return s}}},kA={eventAliasesOn:function(e){var n=e;n.addListener=n.listen=n.bind=n.on,n.unlisten=n.unbind=n.off=n.removeListener,n.trigger=n.emit,n.pon=n.promiseOn=function(r,a){var i=this,s=Array.prototype.slice.call(arguments,0);return new nl(function(o,l){var u=function(v){i.off.apply(i,f),o(v)},d=s.concat([u]),f=d.concat([]);i.on.apply(i,d)})}}},Zt={};[NL,wA,kA].forEach(function(t){pt(Zt,t)});var EA={animate:Zt.animate(),animation:Zt.animation(),animated:Zt.animated(),clearQueue:Zt.clearQueue(),delay:Zt.delay(),delayAnimation:Zt.delayAnimation(),stop:Zt.stop()},nd={classes:function(e){var n=this;if(e===void 0){var r=[];return n[0]._private.classes.forEach(function(p){return r.push(p)}),r}else an(e)||(e=(e||"").match(/\S+/g)||[]);for(var a=[],i=new tl(e),s=0;s<n.length;s++){for(var o=n[s],l=o._private,u=l.classes,d=!1,f=0;f<e.length;f++){var h=e[f],v=u.has(h);if(!v){d=!0;break}}d||(d=u.size!==e.length),d&&(l.classes=i,a.push(o))}return a.length>0&&this.spawn(a).updateStyle().emit("class"),n},addClass:function(e){return this.toggleClass(e,!0)},hasClass:function(e){var n=this[0];return n!=null&&n._private.classes.has(e)},toggleClass:function(e,n){an(e)||(e=e.match(/\S+/g)||[]);for(var r=this,a=n===void 0,i=[],s=0,o=r.length;s<o;s++)for(var l=r[s],u=l._private.classes,d=!1,f=0;f<e.length;f++){var h=e[f],v=u.has(h),p=!1;n||a&&!v?(u.add(h),p=!0):(!n||a&&v)&&(u.delete(h),p=!0),!d&&p&&(i.push(l),d=!0)}return i.length>0&&this.spawn(i).updateStyle().emit("class"),r},removeClass:function(e){return this.toggleClass(e,!1)},flashClass:function(e,n){var r=this;if(n==null)n=250;else if(n===0)return r;return r.addClass(e),setTimeout(function(){r.removeClass(e)},n),r}};nd.className=nd.classNames=nd.classes;var qt={metaChar:"[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:`"(?:\\\\"|[^"])*"|'(?:\\\\'|[^'])*'`,number:Kn,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"};qt.variable="(?:[\\w-.]|(?:\\\\"+qt.metaChar+"))+";qt.className="(?:[\\w-]|(?:\\\\"+qt.metaChar+"))+";qt.value=qt.string+"|"+qt.number;qt.id=qt.variable;(function(){var t,e,n;for(t=qt.comparatorOp.split("|"),n=0;n<t.length;n++)e=t[n],qt.comparatorOp+="|@"+e;for(t=qt.comparatorOp.split("|"),n=0;n<t.length;n++)e=t[n],!(e.indexOf("!")>=0)&&e!=="="&&(qt.comparatorOp+="|\\!"+e)})();var nn=function(){return{checks:[]}},Ze={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},Og=[{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(t,e){return wR(t.selector,e.selector)}),CA=function(){for(var t={},e,n=0;n<Og.length;n++)e=Og[n],t[e.selector]=e.matches;return t}(),SA=function(e,n){return CA[e](n)},jA="("+Og.map(function(t){return t.selector}).join("|")+")",Ys=function(e){return e.replace(new RegExp("\\\\("+qt.metaChar+")","g"),function(n,r){return r})},mi=function(e,n,r){e[e.length-1]=r},zg=[{name:"group",query:!0,regex:"("+qt.group+")",populate:function(e,n,r){var a=Fn(r,1),i=a[0];n.checks.push({type:Ze.GROUP,value:i==="*"?i:i+"s"})}},{name:"state",query:!0,regex:jA,populate:function(e,n,r){var a=Fn(r,1),i=a[0];n.checks.push({type:Ze.STATE,value:i})}},{name:"id",query:!0,regex:"\\#("+qt.id+")",populate:function(e,n,r){var a=Fn(r,1),i=a[0];n.checks.push({type:Ze.ID,value:Ys(i)})}},{name:"className",query:!0,regex:"\\.("+qt.className+")",populate:function(e,n,r){var a=Fn(r,1),i=a[0];n.checks.push({type:Ze.CLASS,value:Ys(i)})}},{name:"dataExists",query:!0,regex:"\\[\\s*("+qt.variable+")\\s*\\]",populate:function(e,n,r){var a=Fn(r,1),i=a[0];n.checks.push({type:Ze.DATA_EXIST,field:Ys(i)})}},{name:"dataCompare",query:!0,regex:"\\[\\s*("+qt.variable+")\\s*("+qt.comparatorOp+")\\s*("+qt.value+")\\s*\\]",populate:function(e,n,r){var a=Fn(r,3),i=a[0],s=a[1],o=a[2],l=new RegExp("^"+qt.string+"$").exec(o)!=null;l?o=o.substring(1,o.length-1):o=parseFloat(o),n.checks.push({type:Ze.DATA_COMPARE,field:Ys(i),operator:s,value:o})}},{name:"dataBool",query:!0,regex:"\\[\\s*("+qt.boolOp+")\\s*("+qt.variable+")\\s*\\]",populate:function(e,n,r){var a=Fn(r,2),i=a[0],s=a[1];n.checks.push({type:Ze.DATA_BOOL,field:Ys(s),operator:i})}},{name:"metaCompare",query:!0,regex:"\\[\\[\\s*("+qt.meta+")\\s*("+qt.comparatorOp+")\\s*("+qt.number+")\\s*\\]\\]",populate:function(e,n,r){var a=Fn(r,3),i=a[0],s=a[1],o=a[2];n.checks.push({type:Ze.META_COMPARE,field:Ys(i),operator:s,value:parseFloat(o)})}},{name:"nextQuery",separator:!0,regex:qt.separator,populate:function(e,n){var r=e.currentSubject,a=e.edgeCount,i=e.compoundCount,s=e[e.length-1];r!=null&&(s.subject=r,e.currentSubject=null),s.edgeCount=a,s.compoundCount=i,e.edgeCount=0,e.compoundCount=0;var o=e[e.length++]=nn();return o}},{name:"directedEdge",separator:!0,regex:qt.directedEdge,populate:function(e,n){if(e.currentSubject==null){var r=nn(),a=n,i=nn();return r.checks.push({type:Ze.DIRECTED_EDGE,source:a,target:i}),mi(e,n,r),e.edgeCount++,i}else{var s=nn(),o=n,l=nn();return s.checks.push({type:Ze.NODE_SOURCE,source:o,target:l}),mi(e,n,s),e.edgeCount++,l}}},{name:"undirectedEdge",separator:!0,regex:qt.undirectedEdge,populate:function(e,n){if(e.currentSubject==null){var r=nn(),a=n,i=nn();return r.checks.push({type:Ze.UNDIRECTED_EDGE,nodes:[a,i]}),mi(e,n,r),e.edgeCount++,i}else{var s=nn(),o=n,l=nn();return s.checks.push({type:Ze.NODE_NEIGHBOR,node:o,neighbor:l}),mi(e,n,s),l}}},{name:"child",separator:!0,regex:qt.child,populate:function(e,n){if(e.currentSubject==null){var r=nn(),a=nn(),i=e[e.length-1];return r.checks.push({type:Ze.CHILD,parent:i,child:a}),mi(e,n,r),e.compoundCount++,a}else if(e.currentSubject===n){var s=nn(),o=e[e.length-1],l=nn(),u=nn(),d=nn(),f=nn();return s.checks.push({type:Ze.COMPOUND_SPLIT,left:o,right:l,subject:u}),u.checks=n.checks,n.checks=[{type:Ze.TRUE}],f.checks.push({type:Ze.TRUE}),l.checks.push({type:Ze.PARENT,parent:f,child:d}),mi(e,o,s),e.currentSubject=u,e.compoundCount++,d}else{var h=nn(),v=nn(),p=[{type:Ze.PARENT,parent:h,child:v}];return h.checks=n.checks,n.checks=p,e.compoundCount++,v}}},{name:"descendant",separator:!0,regex:qt.descendant,populate:function(e,n){if(e.currentSubject==null){var r=nn(),a=nn(),i=e[e.length-1];return r.checks.push({type:Ze.DESCENDANT,ancestor:i,descendant:a}),mi(e,n,r),e.compoundCount++,a}else if(e.currentSubject===n){var s=nn(),o=e[e.length-1],l=nn(),u=nn(),d=nn(),f=nn();return s.checks.push({type:Ze.COMPOUND_SPLIT,left:o,right:l,subject:u}),u.checks=n.checks,n.checks=[{type:Ze.TRUE}],f.checks.push({type:Ze.TRUE}),l.checks.push({type:Ze.ANCESTOR,ancestor:f,descendant:d}),mi(e,o,s),e.currentSubject=u,e.compoundCount++,d}else{var h=nn(),v=nn(),p=[{type:Ze.ANCESTOR,ancestor:h,descendant:v}];return h.checks=n.checks,n.checks=p,e.compoundCount++,v}}},{name:"subject",modifier:!0,regex:qt.subject,populate:function(e,n){if(e.currentSubject!=null&&e.currentSubject!==n)return Jt("Redefinition of subject in selector `"+e.toString()+"`"),!1;e.currentSubject=n;var r=e[e.length-1],a=r.checks[0],i=a==null?null:a.type;i===Ze.DIRECTED_EDGE?a.type=Ze.NODE_TARGET:i===Ze.UNDIRECTED_EDGE&&(a.type=Ze.NODE_NEIGHBOR,a.node=a.nodes[1],a.neighbor=a.nodes[0],a.nodes=null)}}];zg.forEach(function(t){return t.regexObj=new RegExp("^"+t.regex)});var TA=function(e){for(var n,r,a,i=0;i<zg.length;i++){var s=zg[i],o=s.name,l=e.match(s.regexObj);if(l!=null){r=l,n=s,a=o;var u=l[0];e=e.substring(u.length);break}}return{expr:n,match:r,name:a,remaining:e}},NA=function(e){var n=e.match(/^\s+/);if(n){var r=n[0];e=e.substring(r.length)}return e},PA=function(e){var n=this,r=n.inputText=e,a=n[0]=nn();for(n.length=1,r=NA(r);;){var i=TA(r);if(i.expr==null)return Jt("The selector `"+e+"`is invalid"),!1;var s=i.match.slice(1),o=i.expr.populate(n,a,s);if(o===!1)return!1;if(o!=null&&(a=o),r=i.remaining,r.match(/^\s*$/))break}var l=n[n.length-1];n.currentSubject!=null&&(l.subject=n.currentSubject),l.edgeCount=n.edgeCount,l.compoundCount=n.compoundCount;for(var u=0;u<n.length;u++){var d=n[u];if(d.compoundCount>0&&d.edgeCount>0)return Jt("The selector `"+e+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(d.edgeCount>1)return Jt("The selector `"+e+"` is invalid because it uses multiple edge selectors"),!1;d.edgeCount===1&&Jt("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},RA=function(){if(this.toStringCache!=null)return this.toStringCache;for(var e=function(d){return d??""},n=function(d){return ft(d)?'"'+d+'"':e(d)},r=function(d){return" "+d+" "},a=function(d,f){var h=d.type,v=d.value;switch(h){case Ze.GROUP:{var p=e(v);return p.substring(0,p.length-1)}case Ze.DATA_COMPARE:{var y=d.field,b=d.operator;return"["+y+r(e(b))+n(v)+"]"}case Ze.DATA_BOOL:{var m=d.operator,g=d.field;return"["+e(m)+g+"]"}case Ze.DATA_EXIST:{var w=d.field;return"["+w+"]"}case Ze.META_COMPARE:{var x=d.operator,E=d.field;return"[["+E+r(e(x))+n(v)+"]]"}case Ze.STATE:return v;case Ze.ID:return"#"+v;case Ze.CLASS:return"."+v;case Ze.PARENT:case Ze.CHILD:return i(d.parent,f)+r(">")+i(d.child,f);case Ze.ANCESTOR:case Ze.DESCENDANT:return i(d.ancestor,f)+" "+i(d.descendant,f);case Ze.COMPOUND_SPLIT:{var S=i(d.left,f),C=i(d.subject,f),T=i(d.right,f);return S+(S.length>0?" ":"")+C+T}case Ze.TRUE:return""}},i=function(d,f){return d.checks.reduce(function(h,v,p){return h+(f===d&&p===0?"$":"")+a(v,f)},"")},s="",o=0;o<this.length;o++){var l=this[o];s+=i(l,l.subject),this.length>1&&o<this.length-1&&(s+=", ")}return this.toStringCache=s,s},IA={parse:PA,toString:RA},rS=function(e,n,r){var a,i=ft(e),s=_e(e),o=ft(r),l,u,d=!1,f=!1,h=!1;switch(n.indexOf("!")>=0&&(n=n.replace("!",""),f=!0),n.indexOf("@")>=0&&(n=n.replace("@",""),d=!0),(i||o||d)&&(l=!i&&!s?"":""+e,u=""+r),d&&(e=l=l.toLowerCase(),r=u=u.toLowerCase()),n){case"*=":a=l.indexOf(u)>=0;break;case"$=":a=l.indexOf(u,l.length-u.length)>=0;break;case"^=":a=l.indexOf(u)===0;break;case"=":a=e===r;break;case">":h=!0,a=e>r;break;case">=":h=!0,a=e>=r;break;case"<":h=!0,a=e<r;break;case"<=":h=!0,a=e<=r;break;default:a=!1;break}return f&&(e!=null||!h)&&(a=!a),a},LA=function(e,n){switch(n){case"?":return!!e;case"!":return!e;case"^":return e===void 0}},AA=function(e){return e!==void 0},hy=function(e,n){return e.data(n)},DA=function(e,n){return e[n]()},Nn=[],pn=function(e,n){return e.checks.every(function(r){return Nn[r.type](r,n)})};Nn[Ze.GROUP]=function(t,e){var n=t.value;return n==="*"||n===e.group()};Nn[Ze.STATE]=function(t,e){var n=t.value;return SA(n,e)};Nn[Ze.ID]=function(t,e){var n=t.value;return e.id()===n};Nn[Ze.CLASS]=function(t,e){var n=t.value;return e.hasClass(n)};Nn[Ze.META_COMPARE]=function(t,e){var n=t.field,r=t.operator,a=t.value;return rS(DA(e,n),r,a)};Nn[Ze.DATA_COMPARE]=function(t,e){var n=t.field,r=t.operator,a=t.value;return rS(hy(e,n),r,a)};Nn[Ze.DATA_BOOL]=function(t,e){var n=t.field,r=t.operator;return LA(hy(e,n),r)};Nn[Ze.DATA_EXIST]=function(t,e){var n=t.field;return t.operator,AA(hy(e,n))};Nn[Ze.UNDIRECTED_EDGE]=function(t,e){var n=t.nodes[0],r=t.nodes[1],a=e.source(),i=e.target();return pn(n,a)&&pn(r,i)||pn(r,a)&&pn(n,i)};Nn[Ze.NODE_NEIGHBOR]=function(t,e){return pn(t.node,e)&&e.neighborhood().some(function(n){return n.isNode()&&pn(t.neighbor,n)})};Nn[Ze.DIRECTED_EDGE]=function(t,e){return pn(t.source,e.source())&&pn(t.target,e.target())};Nn[Ze.NODE_SOURCE]=function(t,e){return pn(t.source,e)&&e.outgoers().some(function(n){return n.isNode()&&pn(t.target,n)})};Nn[Ze.NODE_TARGET]=function(t,e){return pn(t.target,e)&&e.incomers().some(function(n){return n.isNode()&&pn(t.source,n)})};Nn[Ze.CHILD]=function(t,e){return pn(t.child,e)&&pn(t.parent,e.parent())};Nn[Ze.PARENT]=function(t,e){return pn(t.parent,e)&&e.children().some(function(n){return pn(t.child,n)})};Nn[Ze.DESCENDANT]=function(t,e){return pn(t.descendant,e)&&e.ancestors().some(function(n){return pn(t.ancestor,n)})};Nn[Ze.ANCESTOR]=function(t,e){return pn(t.ancestor,e)&&e.descendants().some(function(n){return pn(t.descendant,n)})};Nn[Ze.COMPOUND_SPLIT]=function(t,e){return pn(t.subject,e)&&pn(t.left,e)&&pn(t.right,e)};Nn[Ze.TRUE]=function(){return!0};Nn[Ze.COLLECTION]=function(t,e){var n=t.value;return n.has(e)};Nn[Ze.FILTER]=function(t,e){var n=t.value;return n(e)};var BA=function(e){var n=this;if(n.length===1&&n[0].checks.length===1&&n[0].checks[0].type===Ze.ID)return e.getElementById(n[0].checks[0].value).collection();var r=function(i){for(var s=0;s<n.length;s++){var o=n[s];if(pn(o,i))return!0}return!1};return n.text()==null&&(r=function(){return!0}),e.filter(r)},MA=function(e){for(var n=this,r=0;r<n.length;r++){var a=n[r];if(pn(a,e))return!0}return!1},OA={matches:MA,filter:BA},Ki=function(e){this.inputText=e,this.currentSubject=null,this.compoundCount=0,this.edgeCount=0,this.length=0,e==null||ft(e)&&e.match(/^\s*$/)||(Xr(e)?this.addQuery({checks:[{type:Ze.COLLECTION,value:e.collection()}]}):En(e)?this.addQuery({checks:[{type:Ze.FILTER,value:e}]}):ft(e)?this.parse(e)||(this.invalid=!0):yn("A selector must be created from a string; found "))},Gi=Ki.prototype;[IA,OA].forEach(function(t){return pt(Gi,t)});Gi.text=function(){return this.inputText};Gi.size=function(){return this.length};Gi.eq=function(t){return this[t]};Gi.sameText=function(t){return!this.invalid&&!t.invalid&&this.text()===t.text()};Gi.addQuery=function(t){this[this.length++]=t};Gi.selector=Gi.toString;var Fi={allAre:function(e){var n=new Ki(e);return this.every(function(r){return n.matches(r)})},is:function(e){var n=new Ki(e);return this.some(function(r){return n.matches(r)})},some:function(e,n){for(var r=0;r<this.length;r++){var a=n?e.apply(n,[this[r],r,this]):e(this[r],r,this);if(a)return!0}return!1},every:function(e,n){for(var r=0;r<this.length;r++){var a=n?e.apply(n,[this[r],r,this]):e(this[r],r,this);if(!a)return!1}return!0},same:function(e){if(this===e)return!0;e=this.cy().collection(e);var n=this.length,r=e.length;return n!==r?!1:n===1?this[0]===e[0]:this.every(function(a){return e.hasElementWithId(a.id())})},anySame:function(e){return e=this.cy().collection(e),this.some(function(n){return e.hasElementWithId(n.id())})},allAreNeighbors:function(e){e=this.cy().collection(e);var n=this.neighborhood();return e.every(function(r){return n.hasElementWithId(r.id())})},contains:function(e){e=this.cy().collection(e);var n=this;return e.every(function(r){return n.hasElementWithId(r.id())})}};Fi.allAreNeighbours=Fi.allAreNeighbors;Fi.has=Fi.contains;Fi.equal=Fi.equals=Fi.same;var ua=function(e,n){return function(a,i,s,o){var l=a,u=this,d;if(l==null?d="":Xr(l)&&l.length===1&&(d=l.id()),u.length===1&&d){var f=u[0]._private,h=f.traversalCache=f.traversalCache||{},v=h[n]=h[n]||[],p=Ds(d),y=v[p];return y||(v[p]=e.call(u,a,i,s,o))}else return e.call(u,a,i,s,o)}},Wo={parent:function(e){var n=[];if(this.length===1){var r=this[0]._private.parent;if(r)return r}for(var a=0;a<this.length;a++){var i=this[a],s=i._private.parent;s&&n.push(s)}return this.spawn(n,!0).filter(e)},parents:function(e){for(var n=[],r=this.parent();r.nonempty();){for(var a=0;a<r.length;a++){var i=r[a];n.push(i)}r=r.parent()}return this.spawn(n,!0).filter(e)},commonAncestors:function(e){for(var n,r=0;r<this.length;r++){var a=this[r],i=a.parents();n=n||i,n=n.intersect(i)}return n.filter(e)},orphans:function(e){return this.stdFilter(function(n){return n.isOrphan()}).filter(e)},nonorphans:function(e){return this.stdFilter(function(n){return n.isChild()}).filter(e)},children:ua(function(t){for(var e=[],n=0;n<this.length;n++)for(var r=this[n],a=r._private.children,i=0;i<a.length;i++)e.push(a[i]);return this.spawn(e,!0).filter(t)},"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 n=[];function r(a){for(var i=0;i<a.length;i++){var s=a[i];n.push(s),s.children().nonempty()&&r(s.children())}}return r(this.children()),this.spawn(n,!0).filter(e)}};function vy(t,e,n,r){for(var a=[],i=new tl,s=t.cy(),o=s.hasCompoundNodes(),l=0;l<t.length;l++){var u=t[l];n?a.push(u):o&&r(a,i,u)}for(;a.length>0;){var d=a.shift();e(d),i.add(d.id()),o&&r(a,i,d)}return t}function aS(t,e,n){if(n.isParent())for(var r=n._private.children,a=0;a<r.length;a++){var i=r[a];e.has(i.id())||t.push(i)}}Wo.forEachDown=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return vy(this,t,e,aS)};function iS(t,e,n){if(n.isChild()){var r=n._private.parent;e.has(r.id())||t.push(r)}}Wo.forEachUp=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return vy(this,t,e,iS)};function zA(t,e,n){iS(t,e,n),aS(t,e,n)}Wo.forEachUpAndDown=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return vy(this,t,e,zA)};Wo.ancestors=Wo.parents;var Cu,sS;Cu=sS={data:Zt.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:Zt.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:Zt.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:Zt.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:Zt.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:Zt.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var e=this[0];if(e)return e._private.data.id}};Cu.attr=Cu.data;Cu.removeAttr=Cu.removeData;var FA=sS,Ff={};function up(t){return function(e){var n=this;if(e===void 0&&(e=!0),n.length!==0)if(n.isNode()&&!n.removed()){for(var r=0,a=n[0],i=a._private.edges,s=0;s<i.length;s++){var o=i[s];!e&&o.isLoop()||(r+=t(a,o))}return r}else return}}pt(Ff,{degree:up(function(t,e){return e.source().same(e.target())?2:1}),indegree:up(function(t,e){return e.target().same(t)?1:0}),outdegree:up(function(t,e){return e.source().same(t)?1:0})});function Xs(t,e){return function(n){for(var r,a=this.nodes(),i=0;i<a.length;i++){var s=a[i],o=s[t](n);o!==void 0&&(r===void 0||e(o,r))&&(r=o)}return r}}pt(Ff,{minDegree:Xs("degree",function(t,e){return t<e}),maxDegree:Xs("degree",function(t,e){return t>e}),minIndegree:Xs("indegree",function(t,e){return t<e}),maxIndegree:Xs("indegree",function(t,e){return t>e}),minOutdegree:Xs("outdegree",function(t,e){return t<e}),maxOutdegree:Xs("outdegree",function(t,e){return t>e})});pt(Ff,{totalDegree:function(e){for(var n=0,r=this.nodes(),a=0;a<r.length;a++)n+=r[a].degree(e);return n}});var ka,oS,lS=function(e,n,r){for(var a=0;a<e.length;a++){var i=e[a];if(!i.locked()){var s=i._private.position,o={x:n.x!=null?n.x-s.x:0,y:n.y!=null?n.y-s.y:0};i.isParent()&&!(o.x===0&&o.y===0)&&i.children().shift(o,r),i.dirtyBoundingBoxCache()}}},ow={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,n){lS(e,n,!1)},onSet:function(e){e.dirtyCompoundBoundsCache()},canSet:function(e){return!e.locked()}};ka=oS={position:Zt.data(ow),silentPosition:Zt.data(pt({},ow,{allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!1,beforeSet:function(e,n){lS(e,n,!0)},onSet:function(e){e.dirtyCompoundBoundsCache()}})),positions:function(e,n){if(Wt(e))n?this.silentPosition(e):this.position(e);else if(En(e)){var r=e,a=this.cy();a.startBatch();for(var i=0;i<this.length;i++){var s=this[i],o=void 0;(o=r(s,i))&&(n?s.silentPosition(o):s.position(o))}a.endBatch()}return this},silentPositions:function(e){return this.positions(e,!0)},shift:function(e,n,r){var a;if(Wt(e)?(a={x:_e(e.x)?e.x:0,y:_e(e.y)?e.y:0},r=n):ft(e)&&_e(n)&&(a={x:0,y:0},a[e]=n),a!=null){var i=this.cy();i.startBatch();for(var s=0;s<this.length;s++){var o=this[s];if(!(i.hasCompoundNodes()&&o.isChild()&&o.ancestors().anySame(this))){var l=o.position(),u={x:l.x+a.x,y:l.y+a.y};r?o.silentPosition(u):o.position(u)}}i.endBatch()}return this},silentShift:function(e,n){return Wt(e)?this.shift(e,!0):ft(e)&&_e(n)&&this.shift(e,n,!0),this},renderedPosition:function(e,n){var r=this[0],a=this.cy(),i=a.zoom(),s=a.pan(),o=Wt(e)?e:void 0,l=o!==void 0||n!==void 0&&ft(e);if(r&&r.isNode())if(l)for(var u=0;u<this.length;u++){var d=this[u];n!==void 0?d.position(e,(n-s[e])/i):o!==void 0&&d.position(MC(o,i,s))}else{var f=r.position();return o=Af(f,i,s),e===void 0?o:o[e]}else if(!l)return;return this},relativePosition:function(e,n){var r=this[0],a=this.cy(),i=Wt(e)?e:void 0,s=i!==void 0||n!==void 0&&ft(e),o=a.hasCompoundNodes();if(r&&r.isNode())if(s)for(var l=0;l<this.length;l++){var u=this[l],d=o?u.parent():null,f=d&&d.length>0,h=f;f&&(d=d[0]);var v=h?d.position():{x:0,y:0};n!==void 0?u.position(e,n+v[e]):i!==void 0&&u.position({x:i.x+v.x,y:i.y+v.y})}else{var p=r.position(),y=o?r.parent():null,b=y&&y.length>0,m=b;b&&(y=y[0]);var g=m?y.position():{x:0,y:0};return i={x:p.x-g.x,y:p.y-g.y},e===void 0?i:i[e]}else if(!s)return;return this}};ka.modelPosition=ka.point=ka.position;ka.modelPositions=ka.points=ka.positions;ka.renderedPoint=ka.renderedPosition;ka.relativePoint=ka.relativePosition;var _A=oS,Ko=function(e){switch(e){case"left":case"right-inside":return"left";case"right":case"left-inside":return"right";default:return"center"}},Go=function(e){switch(e){case"top":case"bottom-inside":return"top";case"bottom":case"top-inside":return"bottom";default:return"center"}},$A=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"}},Ao,ns;Ao=ns={};ns.renderedBoundingBox=function(t){var e=this.boundingBox(t),n=this.cy(),r=n.zoom(),a=n.pan(),i=e.x1*r+a.x,s=e.x2*r+a.x,o=e.y1*r+a.y,l=e.y2*r+a.y;return{x1:i,x2:s,y1:o,y2:l,w:s-i,h:l-o}};ns.dirtyCompoundBoundsCache=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,e=this.cy();return!e.styleEnabled()||!e.hasCompoundNodes()?this:(this.forEachUp(function(n){if(n.isParent()){var r=n._private;r.compoundBoundsClean=!1,r.bbCache=null,t||n.emitAndNotify("bounds")}}),this)};ns.updateCompoundBounds=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,e=this.cy();if(!e.styleEnabled()||!e.hasCompoundNodes())return this;if(!t&&e.batching())return this;function n(s){if(!s.isParent())return;var o=s._private,l=s.children(),u=s.pstyle("compound-sizing-wrt-labels").value==="include",d={width:{val:s.pstyle("min-width").pfValue,left:s.pstyle("min-width-bias-left"),right:s.pstyle("min-width-bias-right")},height:{val:s.pstyle("min-height").pfValue,top:s.pstyle("min-height-bias-top"),bottom:s.pstyle("min-height-bias-bottom")}},f=l.boundingBox({includeLabels:u,includeOverlays:!1,useCache:!1}),h=o.position;(f.w===0||f.h===0)&&(f={w:s.pstyle("width").pfValue,h:s.pstyle("height").pfValue},f.x1=h.x-f.w/2,f.x2=h.x+f.w/2,f.y1=h.y-f.h/2,f.y2=h.y+f.h/2);function v(N,P,R){var I=0,D=0,$=P+R;return N>0&&$>0&&(I=P/$*N,D=R/$*N),{biasDiff:I,biasComplementDiff:D}}function p(N,P,R,I){if(R.units==="%")switch(I){case"width":return N>0?R.pfValue*N:0;case"height":return P>0?R.pfValue*P:0;case"average":return N>0&&P>0?R.pfValue*(N+P)/2:0;case"min":return N>0&&P>0?N>P?R.pfValue*P:R.pfValue*N:0;case"max":return N>0&&P>0?N>P?R.pfValue*N:R.pfValue*P:0;default:return 0}else return R.units==="px"?R.pfValue:0}var y=d.width.left.value;d.width.left.units==="px"&&d.width.val>0&&(y=y*100/d.width.val);var b=d.width.right.value;d.width.right.units==="px"&&d.width.val>0&&(b=b*100/d.width.val);var m=d.height.top.value;d.height.top.units==="px"&&d.height.val>0&&(m=m*100/d.height.val);var g=d.height.bottom.value;d.height.bottom.units==="px"&&d.height.val>0&&(g=g*100/d.height.val);var w=v(d.width.val-f.w,y,b),x=w.biasDiff,E=w.biasComplementDiff,S=v(d.height.val-f.h,m,g),C=S.biasDiff,T=S.biasComplementDiff;o.autoPadding=p(f.w,f.h,s.pstyle("padding"),s.pstyle("padding-relative-to").value),o.autoWidth=Math.max(f.w,d.width.val),h.x=(-x+f.x1+f.x2+E)/2,o.autoHeight=Math.max(f.h,d.height.val),h.y=(-C+f.y1+f.y2+T)/2}for(var r=0;r<this.length;r++){var a=this[r],i=a._private;(!i.compoundBoundsClean||t)&&(n(a),e.batching()||(i.compoundBoundsClean=!0))}return this};var oa=function(e){return e===1/0||e===-1/0?0:e},ya=function(e,n,r,a,i){a-n===0||i-r===0||n==null||r==null||a==null||i==null||(e.x1=n<e.x1?n:e.x1,e.x2=a>e.x2?a:e.x2,e.y1=r<e.y1?r:e.y1,e.y2=i>e.y2?i:e.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1)},xi=function(e,n){return n==null?e:ya(e,n.x1,n.y1,n.x2,n.y2)},El=function(e,n,r){return Cr(e,n,r)},Ac=function(e,n,r){if(!n.cy().headless()){var a=n._private,i=a.rstyle,s=i.arrowWidth/2,o=n.pstyle(r+"-arrow-shape").value,l,u;if(o!=="none"){r==="source"?(l=i.srcX,u=i.srcY):r==="target"?(l=i.tgtX,u=i.tgtY):(l=i.midX,u=i.midY);var d=a.arrowBounds=a.arrowBounds||{},f=d[r]=d[r]||{};f.x1=l-s,f.y1=u-s,f.x2=l+s,f.y2=u+s,f.w=f.x2-f.x1,f.h=f.y2-f.y1,ed(f,1),ya(e,f.x1,f.y1,f.x2,f.y2)}}},cp=function(e,n,r){if(!n.cy().headless()){var a;r?a=r+"-":a="";var i=n._private,s=i.rstyle,o=n.pstyle(a+"label").strValue;if(o){var l=n.pstyle("text-halign"),u=n.pstyle("text-valign"),d=El(s,"labelWidth",r),f=El(s,"labelHeight",r),h=El(s,"labelX",r),v=El(s,"labelY",r),p=n.pstyle(a+"text-margin-x").pfValue,y=n.pstyle(a+"text-margin-y").pfValue,b=n.isEdge(),m=n.pstyle(a+"text-rotation"),g=n.pstyle("text-outline-width").pfValue,w=n.pstyle("text-border-width").pfValue,x=w/2,E=n.pstyle("text-background-padding").pfValue,S=2,C=f,T=d,N=T/2,P=C/2,R,I,D,$;if(b)R=h-N,I=h+N,D=v-P,$=v+P;else{switch(Ko(l.value)){case"left":R=h-T,I=h;break;case"center":R=h-N,I=h+N;break;case"right":R=h,I=h+T;break}switch(Go(u.value)){case"top":D=v-C,$=v;break;case"center":D=v-P,$=v+P;break;case"bottom":D=v,$=v+C;break}}var H=p-Math.max(g,x)-E-S,V=p+Math.max(g,x)+E+S,U=y-Math.max(g,x)-E-S,F=y+Math.max(g,x)+E+S;R+=H,I+=V,D+=U,$+=F;var G=r||"main",z=i.labelBounds,_=z[G]=z[G]||{};_.x1=R,_.y1=D,_.x2=I,_.y2=$,_.w=I-R,_.h=$-D,_.leftPad=H,_.rightPad=V,_.topPad=U,_.botPad=F;var K=b&&m.strValue==="autorotate",ie=m.pfValue!=null&&m.pfValue!==0;if(K||ie){var M=K?El(i.rstyle,"labelAngle",r):m.pfValue,oe=Math.cos(M),ve=Math.sin(M),ye=(R+I)/2,Te=(D+$)/2;if(!b){switch(Ko(l.value)){case"left":ye=I;break;case"right":ye=R;break}switch(Go(u.value)){case"top":Te=$;break;case"bottom":Te=D;break}}var fe=function(wt,at){return wt=wt-ye,at=at-Te,{x:wt*oe-at*ve+ye,y:wt*ve+at*oe+Te}},Z=fe(R,D),ee=fe(R,$),ne=fe(I,D),de=fe(I,$);R=Math.min(Z.x,ee.x,ne.x,de.x),I=Math.max(Z.x,ee.x,ne.x,de.x),D=Math.min(Z.y,ee.y,ne.y,de.y),$=Math.max(Z.y,ee.y,ne.y,de.y)}var Re=G+"Rot",Ge=z[Re]=z[Re]||{};Ge.x1=R,Ge.y1=D,Ge.x2=I,Ge.y2=$,Ge.w=I-R,Ge.h=$-D,ya(e,R,D,I,$),ya(i.labelBounds.all,R,D,I,$)}return e}},lw=function(e,n){if(!n.cy().headless()){var r=n.pstyle("outline-opacity").value,a=n.pstyle("outline-width").value,i=n.pstyle("outline-offset").value,s=a+i;uS(e,n,r,s,"outside",s/2)}},uS=function(e,n,r,a,i,s){if(!(r===0||a<=0||i==="inside")){var o=n.cy(),l=o.renderer(),u=l.nodeShapes[l.getNodeShape(n)];if(u){var d=n.position(),f=d.x,h=d.y,v=n.width(),p=n.height();if(u.hasMiterBounds){i==="center"&&(a/=2);var y=u.miterBounds(f,h,v,p,a);xi(e,y)}else s!=null&&s>0&&td(e,[s,s,s,s])}}},VA=function(e,n){if(!n.cy().headless()){var r=n.pstyle("border-opacity").value,a=n.pstyle("border-width").pfValue,i=n.pstyle("border-position").value;uS(e,n,r,a,i)}},UA=function(e,n){var r=e._private.cy,a=r.styleEnabled(),i=r.headless(),s=jr(),o=e._private,l=e.isNode(),u=e.isEdge(),d,f,h,v,p,y,b=o.rstyle,m=l&&a?e.pstyle("bounds-expansion").pfValue:[0],g=function(Nt){return Nt.pstyle("display").value!=="none"},w=!a||g(e)&&(!u||g(e.source())&&g(e.target()));if(w){var x=0,E=0;a&&n.includeOverlays&&(x=e.pstyle("overlay-opacity").value,x!==0&&(E=e.pstyle("overlay-padding").value));var S=0,C=0;a&&n.includeUnderlays&&(S=e.pstyle("underlay-opacity").value,S!==0&&(C=e.pstyle("underlay-padding").value));var T=Math.max(E,C),N=0,P=0;if(a&&(N=e.pstyle("width").pfValue,P=N/2),l&&n.includeNodes){var R=e.position();p=R.x,y=R.y;var I=e.outerWidth(),D=I/2,$=e.outerHeight(),H=$/2;d=p-D,f=p+D,h=y-H,v=y+H,ya(s,d,h,f,v),a&&lw(s,e),a&&n.includeOutlines&&!i&&lw(s,e),a&&VA(s,e)}else if(u&&n.includeEdges)if(a&&!i){var V=e.pstyle("curve-style").strValue;if(d=Math.min(b.srcX,b.midX,b.tgtX),f=Math.max(b.srcX,b.midX,b.tgtX),h=Math.min(b.srcY,b.midY,b.tgtY),v=Math.max(b.srcY,b.midY,b.tgtY),d-=P,f+=P,h-=P,v+=P,ya(s,d,h,f,v),V==="haystack"){var U=b.haystackPts;if(U&&U.length===2){if(d=U[0].x,h=U[0].y,f=U[1].x,v=U[1].y,d>f){var F=d;d=f,f=F}if(h>v){var G=h;h=v,v=G}ya(s,d-P,h-P,f+P,v+P)}}else if(V==="bezier"||V==="unbundled-bezier"||Ti(V,"segments")||Ti(V,"taxi")){var z;switch(V){case"bezier":case"unbundled-bezier":z=b.bezierPts;break;case"segments":case"taxi":case"round-segments":case"round-taxi":z=b.linePts;break}if(z!=null)for(var _=0;_<z.length;_++){var K=z[_];d=K.x-P,f=K.x+P,h=K.y-P,v=K.y+P,ya(s,d,h,f,v)}}}else{var ie=e.source(),M=ie.position(),oe=e.target(),ve=oe.position();if(d=M.x,f=ve.x,h=M.y,v=ve.y,d>f){var ye=d;d=f,f=ye}if(h>v){var Te=h;h=v,v=Te}d-=P,f+=P,h-=P,v+=P,ya(s,d,h,f,v)}if(a&&n.includeEdges&&u&&(Ac(s,e,"mid-source"),Ac(s,e,"mid-target"),Ac(s,e,"source"),Ac(s,e,"target")),a){var fe=e.pstyle("ghost").value==="yes";if(fe){var Z=e.pstyle("ghost-offset-x").pfValue,ee=e.pstyle("ghost-offset-y").pfValue;ya(s,s.x1+Z,s.y1+ee,s.x2+Z,s.y2+ee)}}var ne=o.bodyBounds=o.bodyBounds||{};Kb(ne,s),td(ne,m),ed(ne,1),a&&(d=s.x1,f=s.x2,h=s.y1,v=s.y2,ya(s,d-T,h-T,f+T,v+T));var de=o.overlayBounds=o.overlayBounds||{};Kb(de,s),td(de,m),ed(de,1);var Re=o.labelBounds=o.labelBounds||{};Re.all!=null?EI(Re.all):Re.all=jr(),a&&n.includeLabels&&(n.includeMainLabels&&cp(s,e,null),u&&(n.includeSourceLabels&&cp(s,e,"source"),n.includeTargetLabels&&cp(s,e,"target")))}return s.x1=oa(s.x1),s.y1=oa(s.y1),s.x2=oa(s.x2),s.y2=oa(s.y2),s.w=oa(s.x2-s.x1),s.h=oa(s.y2-s.y1),s.w>0&&s.h>0&&w&&(td(s,m),ed(s,1)),s},cS=function(e){var n=0,r=function(s){return(s?1:0)<<n++},a=0;return a+=r(e.incudeNodes),a+=r(e.includeEdges),a+=r(e.includeLabels),a+=r(e.includeMainLabels),a+=r(e.includeSourceLabels),a+=r(e.includeTargetLabels),a+=r(e.includeOverlays),a+=r(e.includeOutlines),a},dS=function(e){var n=function(o){return Math.round(o)};if(e.isEdge()){var r=e.source().position(),a=e.target().position();return $b([n(r.x),n(r.y),n(a.x),n(a.y)])}else{var i=e.position();return $b([n(i.x),n(i.y)])}},uw=function(e,n){var r=e._private,a,i=e.isEdge(),s=n==null?cw:cS(n),o=s===cw;if(r.bbCache==null?(a=UA(e,Su),r.bbCache=a,r.bbCachePosKey=dS(e)):a=r.bbCache,!o){var l=e.isNode();a=jr(),(n.includeNodes&&l||n.includeEdges&&!l)&&(n.includeOverlays?xi(a,r.overlayBounds):xi(a,r.bodyBounds)),n.includeLabels&&(n.includeMainLabels&&(!i||n.includeSourceLabels&&n.includeTargetLabels)?xi(a,r.labelBounds.all):(n.includeMainLabels&&xi(a,r.labelBounds.mainRot),n.includeSourceLabels&&xi(a,r.labelBounds.sourceRot),n.includeTargetLabels&&xi(a,r.labelBounds.targetRot))),a.w=a.x2-a.x1,a.h=a.y2-a.y1}return a},Su={includeNodes:!0,includeEdges:!0,includeLabels:!0,includeMainLabels:!0,includeSourceLabels:!0,includeTargetLabels:!0,includeOverlays:!0,includeUnderlays:!0,includeOutlines:!0,useCache:!0},cw=cS(Su),dw=ur(Su);ns.boundingBox=function(t){var e,n=t===void 0||t.useCache===void 0||t.useCache===!0,r=qo(function(d){var f=d._private;return f.bbCache==null||f.styleDirty||f.bbCachePosKey!==dS(d)},function(d){return d.id()});if(n&&this.length===1&&!r(this[0]))t===void 0?t=Su:t=dw(t),e=uw(this[0],t);else{e=jr(),t=t||Su;var a=dw(t),i=this,s=i.cy(),o=s.styleEnabled();this.edges().forEach(r),this.nodes().forEach(r),o&&this.recalculateRenderedStyle(n),this.updateCompoundBounds(!n);for(var l=0;l<i.length;l++){var u=i[l];r(u)&&u.dirtyBoundingBoxCache(),xi(e,uw(u,a))}}return e.x1=oa(e.x1),e.y1=oa(e.y1),e.x2=oa(e.x2),e.y2=oa(e.y2),e.w=oa(e.x2-e.x1),e.h=oa(e.y2-e.y1),e};ns.dirtyBoundingBoxCache=function(){for(var t=0;t<this.length;t++){var e=this[t]._private;e.bbCache=null,e.bbCachePosKey=null,e.bodyBounds=null,e.overlayBounds=null,e.labelBounds.all=null,e.labelBounds.source=null,e.labelBounds.target=null,e.labelBounds.main=null,e.labelBounds.sourceRot=null,e.labelBounds.targetRot=null,e.labelBounds.mainRot=null,e.arrowBounds.source=null,e.arrowBounds.target=null,e.arrowBounds["mid-source"]=null,e.arrowBounds["mid-target"]=null}return this.emitAndNotify("bounds"),this};ns.boundingBoxAt=function(t){var e=this.nodes(),n=this.cy(),r=n.hasCompoundNodes(),a=n.collection();if(r&&(a=e.filter(function(u){return u.isParent()}),e=e.not(a)),Wt(t)){var i=t;t=function(){return i}}var s=function(d,f){return d._private.bbAtOldPos=t(d,f)},o=function(d){return d._private.bbAtOldPos};n.startBatch(),e.forEach(s).silentPositions(t),r&&(a.dirtyCompoundBoundsCache(),a.dirtyBoundingBoxCache(),a.updateCompoundBounds(!0));var l=kI(this.boundingBox({useCache:!1}));return e.silentPositions(o),r&&(a.dirtyCompoundBoundsCache(),a.dirtyBoundingBoxCache(),a.updateCompoundBounds(!0)),n.endBatch(),l};Ao.boundingbox=Ao.bb=Ao.boundingBox;Ao.renderedBoundingbox=Ao.renderedBoundingBox;var qA=ns,Bl,Hu;Bl=Hu={};var fS=function(e){e.uppercaseName=jb(e.name),e.autoName="auto"+e.uppercaseName,e.labelName="label"+e.uppercaseName,e.outerName="outer"+e.uppercaseName,e.uppercaseOuterName=jb(e.outerName),Bl[e.name]=function(){var r=this[0],a=r._private,i=a.cy,s=i._private.styleEnabled;if(r)if(s){if(r.isParent())return r.updateCompoundBounds(),a[e.autoName]||0;var o=r.pstyle(e.name);switch(o.strValue){case"label":return r.recalculateRenderedStyle(),a.rstyle[e.labelName]||0;default:return o.pfValue}}else return 1},Bl["outer"+e.uppercaseName]=function(){var r=this[0],a=r._private,i=a.cy,s=i._private.styleEnabled;if(r)if(s){var o=r[e.name](),l=r.pstyle("border-position").value,u;l==="center"?u=r.pstyle("border-width").pfValue:l==="outside"?u=2*r.pstyle("border-width").pfValue:u=0;var d=2*r.padding();return o+u+d}else return 1},Bl["rendered"+e.uppercaseName]=function(){var r=this[0];if(r){var a=r[e.name]();return a*this.cy().zoom()}},Bl["rendered"+e.uppercaseOuterName]=function(){var r=this[0];if(r){var a=r[e.outerName]();return a*this.cy().zoom()}}};fS({name:"width"});fS({name:"height"});Hu.padding=function(){var t=this[0],e=t._private;return t.isParent()?(t.updateCompoundBounds(),e.autoPadding!==void 0?e.autoPadding:t.pstyle("padding").pfValue):t.pstyle("padding").pfValue};Hu.paddedHeight=function(){var t=this[0];return t.height()+2*t.padding()};Hu.paddedWidth=function(){var t=this[0];return t.width()+2*t.padding()};var HA=Hu,WA=function(e,n){if(e.isEdge()&&e.takesUpSpace())return n(e)},KA=function(e,n){if(e.isEdge()&&e.takesUpSpace()){var r=e.cy();return Af(n(e),r.zoom(),r.pan())}},GA=function(e,n){if(e.isEdge()&&e.takesUpSpace()){var r=e.cy(),a=r.pan(),i=r.zoom();return n(e).map(function(s){return Af(s,i,a)})}},YA=function(e){return e.renderer().getControlPoints(e)},XA=function(e){return e.renderer().getSegmentPoints(e)},QA=function(e){return e.renderer().getSourceEndpoint(e)},ZA=function(e){return e.renderer().getTargetEndpoint(e)},JA=function(e){return e.renderer().getEdgeMidpoint(e)},fw={controlPoints:{get:YA,mult:!0},segmentPoints:{get:XA,mult:!0},sourceEndpoint:{get:QA},targetEndpoint:{get:ZA},midpoint:{get:JA}},eD=function(e){return"rendered"+e[0].toUpperCase()+e.substr(1)},tD=Object.keys(fw).reduce(function(t,e){var n=fw[e],r=eD(e);return t[e]=function(){return WA(this,n.get)},n.mult?t[r]=function(){return GA(this,n.get)}:t[r]=function(){return KA(this,n.get)},t},{}),nD=pt({},_A,qA,HA,tD);/*!
|
|
81
|
+
Event object based on jQuery events, MIT license
|
|
82
|
+
|
|
83
|
+
https://jquery.org/license/
|
|
84
|
+
https://tldrlegal.com/license/mit-license
|
|
85
|
+
https://github.com/jquery/jquery/blob/master/src/event.js
|
|
86
|
+
*/var hS=function(e,n){this.recycle(e,n)};function Cl(){return!1}function Dc(){return!0}hS.prototype={instanceString:function(){return"event"},recycle:function(e,n){if(this.isImmediatePropagationStopped=this.isPropagationStopped=this.isDefaultPrevented=Cl,e!=null&&e.preventDefault?(this.type=e.type,this.isDefaultPrevented=e.defaultPrevented?Dc:Cl):e!=null&&e.type?n=e:this.type=e,n!=null&&(this.originalEvent=n.originalEvent,this.type=n.type!=null?n.type:this.type,this.cy=n.cy,this.target=n.target,this.position=n.position,this.renderedPosition=n.renderedPosition,this.namespace=n.namespace,this.layout=n.layout),this.cy!=null&&this.position!=null&&this.renderedPosition==null){var r=this.position,a=this.cy.zoom(),i=this.cy.pan();this.renderedPosition={x:r.x*a+i.x,y:r.y*a+i.y}}this.timeStamp=e&&e.timeStamp||Date.now()},preventDefault:function(){this.isDefaultPrevented=Dc;var e=this.originalEvent;e&&e.preventDefault&&e.preventDefault()},stopPropagation:function(){this.isPropagationStopped=Dc;var e=this.originalEvent;e&&e.stopPropagation&&e.stopPropagation()},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=Dc,this.stopPropagation()},isDefaultPrevented:Cl,isPropagationStopped:Cl,isImmediatePropagationStopped:Cl};var vS=/^([^.]+)(\.(?:[^.]+))?$/,rD=".*",pS={qualifierCompare:function(e,n){return e===n},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},hw=Object.keys(pS),aD={};function _f(){for(var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:aD,e=arguments.length>1?arguments[1]:void 0,n=0;n<hw.length;n++){var r=hw[n];this[r]=t[r]||pS[r]}this.context=e||this.context,this.listeners=[],this.emitting=0}var Yi=_f.prototype,gS=function(e,n,r,a,i,s,o){En(a)&&(i=a,a=null),o&&(s==null?s=o:s=pt({},s,o));for(var l=an(r)?r:r.split(/\s+/),u=0;u<l.length;u++){var d=l[u];if(!qi(d)){var f=d.match(vS);if(f){var h=f[1],v=f[2]?f[2]:null,p=n(e,d,h,v,a,i,s);if(p===!1)break}}}},vw=function(e,n){return e.addEventFields(e.context,n),new hS(n.type,n)},iD=function(e,n,r){if(cR(r)){n(e,r);return}else if(Wt(r)){n(e,vw(e,r));return}for(var a=an(r)?r:r.split(/\s+/),i=0;i<a.length;i++){var s=a[i];if(!qi(s)){var o=s.match(vS);if(o){var l=o[1],u=o[2]?o[2]:null,d=vw(e,{type:l,namespace:u,target:e.context});n(e,d)}}}};Yi.on=Yi.addListener=function(t,e,n,r,a){return gS(this,function(i,s,o,l,u,d,f){En(d)&&i.listeners.push({event:s,callback:d,type:o,namespace:l,qualifier:u,conf:f})},t,e,n,r,a),this};Yi.one=function(t,e,n,r){return this.on(t,e,n,r,{one:!0})};Yi.removeListener=Yi.off=function(t,e,n,r){var a=this;this.emitting!==0&&(this.listeners=WR(this.listeners));for(var i=this.listeners,s=function(u){var d=i[u];gS(a,function(f,h,v,p,y,b){if((d.type===v||t==="*")&&(!p&&d.namespace!==".*"||d.namespace===p)&&(!y||f.qualifierCompare(d.qualifier,y))&&(!b||d.callback===b))return i.splice(u,1),!1},t,e,n,r)},o=i.length-1;o>=0;o--)s(o);return this};Yi.removeAllListeners=function(){return this.removeListener("*")};Yi.emit=Yi.trigger=function(t,e,n){var r=this.listeners,a=r.length;return this.emitting++,an(e)||(e=[e]),iD(this,function(i,s){n!=null&&(r=[{event:s.event,type:s.type,namespace:s.namespace,callback:n}],a=r.length);for(var o=function(){var d=r[l];if(d.type===s.type&&(!d.namespace||d.namespace===s.namespace||d.namespace===rD)&&i.eventMatches(i.context,d,s)){var f=[s];e!=null&&GR(f,e),i.beforeEmit(i.context,d,s),d.conf&&d.conf.one&&(i.listeners=i.listeners.filter(function(p){return p!==d}));var h=i.callbackContext(i.context,d,s),v=d.callback.apply(h,f);i.afterEmit(i.context,d,s),v===!1&&(s.stopPropagation(),s.preventDefault())}},l=0;l<a;l++)o();i.bubble(i.context)&&!s.isPropagationStopped()&&i.parent(i.context).emit(s,e)},t),this.emitting--,this};var sD={qualifierCompare:function(e,n){return e==null||n==null?e==null&&n==null:e.sameText(n)},eventMatches:function(e,n,r){var a=n.qualifier;return a!=null?e!==r.target&&Fu(r.target)&&a.matches(r.target):!0},addEventFields:function(e,n){n.cy=e.cy(),n.target=e},callbackContext:function(e,n,r){return n.qualifier!=null?r.target:e},beforeEmit:function(e,n){n.conf&&n.conf.once&&n.conf.onceCollection.removeListener(n.event,n.qualifier,n.callback)},bubble:function(){return!0},parent:function(e){return e.isChild()?e.parent():e.cy()}},Bc=function(e){return ft(e)?new Ki(e):e},mS={createEmitter:function(){for(var e=0;e<this.length;e++){var n=this[e],r=n._private;r.emitter||(r.emitter=new _f(sD,n))}return this},emitter:function(){return this._private.emitter},on:function(e,n,r){for(var a=Bc(n),i=0;i<this.length;i++){var s=this[i];s.emitter().on(e,a,r)}return this},removeListener:function(e,n,r){for(var a=Bc(n),i=0;i<this.length;i++){var s=this[i];s.emitter().removeListener(e,a,r)}return this},removeAllListeners:function(){for(var e=0;e<this.length;e++){var n=this[e];n.emitter().removeAllListeners()}return this},one:function(e,n,r){for(var a=Bc(n),i=0;i<this.length;i++){var s=this[i];s.emitter().one(e,a,r)}return this},once:function(e,n,r){for(var a=Bc(n),i=0;i<this.length;i++){var s=this[i];s.emitter().on(e,a,r,{once:!0,onceCollection:this})}},emit:function(e,n){for(var r=0;r<this.length;r++){var a=this[r];a.emitter().emit(e,n)}return this},emitAndNotify:function(e,n){if(this.length!==0)return this.cy().notify(e,this),this.emit(e,n),this}};Zt.eventAliasesOn(mS);var yS={nodes:function(e){return this.filter(function(n){return n.isNode()}).filter(e)},edges:function(e){return this.filter(function(n){return n.isEdge()}).filter(e)},byGroup:function(){for(var e=this.spawn(),n=this.spawn(),r=0;r<this.length;r++){var a=this[r];a.isNode()?e.push(a):n.push(a)}return{nodes:e,edges:n}},filter:function(e,n){if(e===void 0)return this;if(ft(e)||Xr(e))return new Ki(e).filter(this);if(En(e)){for(var r=this.spawn(),a=this,i=0;i<a.length;i++){var s=a[i],o=n?e.apply(n,[s,i,a]):e(s,i,a);o&&r.push(s)}return r}return this.spawn()},not:function(e){if(e){ft(e)&&(e=this.filter(e));for(var n=this.spawn(),r=0;r<this.length;r++){var a=this[r],i=e.has(a);i||n.push(a)}return n}else return this},absoluteComplement:function(){var e=this.cy();return e.mutableElements().not(this)},intersect:function(e){if(ft(e)){var n=e;return this.filter(n)}for(var r=this.spawn(),a=this,i=e,s=this.length<e.length,o=s?a:i,l=s?i:a,u=0;u<o.length;u++){var d=o[u];l.has(d)&&r.push(d)}return r},xor:function(e){var n=this._private.cy;ft(e)&&(e=n.$(e));var r=this.spawn(),a=this,i=e,s=function(l,u){for(var d=0;d<l.length;d++){var f=l[d],h=f._private.data.id,v=u.hasElementWithId(h);v||r.push(f)}};return s(a,i),s(i,a),r},diff:function(e){var n=this._private.cy;ft(e)&&(e=n.$(e));var r=this.spawn(),a=this.spawn(),i=this.spawn(),s=this,o=e,l=function(d,f,h){for(var v=0;v<d.length;v++){var p=d[v],y=p._private.data.id,b=f.hasElementWithId(y);b?i.merge(p):h.push(p)}};return l(s,o,r),l(o,s,a),{left:r,right:a,both:i}},add:function(e){var n=this._private.cy;if(!e)return this;if(ft(e)){var r=e;e=n.mutableElements().filter(r)}for(var a=this.spawnSelf(),i=0;i<e.length;i++){var s=e[i],o=!this.has(s);o&&a.push(s)}return a},merge:function(e){var n=this._private,r=n.cy;if(!e)return this;if(e&&ft(e)){var a=e;e=r.mutableElements().filter(a)}for(var i=n.map,s=0;s<e.length;s++){var o=e[s],l=o._private.data.id,u=!i.has(l);if(u){var d=this.length++;this[d]=o,i.set(l,{ele:o,index:d})}}return this},unmergeAt:function(e){var n=this[e],r=n.id(),a=this._private,i=a.map;this[e]=void 0,i.delete(r);var s=e===this.length-1;if(this.length>1&&!s){var o=this.length-1,l=this[o],u=l._private.data.id;this[o]=void 0,this[e]=l,i.set(u,{ele:l,index:e})}return this.length--,this},unmergeOne:function(e){e=e[0];var n=this._private,r=e._private.data.id,a=n.map,i=a.get(r);if(!i)return this;var s=i.index;return this.unmergeAt(s),this},unmerge:function(e){var n=this._private.cy;if(!e)return this;if(e&&ft(e)){var r=e;e=n.mutableElements().filter(r)}for(var a=0;a<e.length;a++)this.unmergeOne(e[a]);return this},unmergeBy:function(e){for(var n=this.length-1;n>=0;n--){var r=this[n];e(r)&&this.unmergeAt(n)}return this},map:function(e,n){for(var r=[],a=this,i=0;i<a.length;i++){var s=a[i],o=n?e.apply(n,[s,i,a]):e(s,i,a);r.push(o)}return r},reduce:function(e,n){for(var r=n,a=this,i=0;i<a.length;i++)r=e(r,a[i],i,a);return r},max:function(e,n){for(var r=-1/0,a,i=this,s=0;s<i.length;s++){var o=i[s],l=n?e.apply(n,[o,s,i]):e(o,s,i);l>r&&(r=l,a=o)}return{value:r,ele:a}},min:function(e,n){for(var r=1/0,a,i=this,s=0;s<i.length;s++){var o=i[s],l=n?e.apply(n,[o,s,i]):e(o,s,i);l<r&&(r=l,a=o)}return{value:r,ele:a}}},Gt=yS;Gt.u=Gt["|"]=Gt["+"]=Gt.union=Gt.or=Gt.add;Gt["\\"]=Gt["!"]=Gt["-"]=Gt.difference=Gt.relativeComplement=Gt.subtract=Gt.not;Gt.n=Gt["&"]=Gt["."]=Gt.and=Gt.intersection=Gt.intersect;Gt["^"]=Gt["(+)"]=Gt["(-)"]=Gt.symmetricDifference=Gt.symdiff=Gt.xor;Gt.fnFilter=Gt.filterFn=Gt.stdFilter=Gt.filter;Gt.complement=Gt.abscomp=Gt.absoluteComplement;var oD={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}},bS=function(e,n){var r=e.cy(),a=r.hasCompoundNodes();function i(d){var f=d.pstyle("z-compound-depth");return f.value==="auto"?a?d.zDepth():0:f.value==="bottom"?-1:f.value==="top"?ry:0}var s=i(e)-i(n);if(s!==0)return s;function o(d){var f=d.pstyle("z-index-compare");return f.value==="auto"&&d.isNode()?1:0}var l=o(e)-o(n);if(l!==0)return l;var u=e.pstyle("z-index").value-n.pstyle("z-index").value;return u!==0?u:e.poolIndex()-n.poolIndex()},Kd={forEach:function(e,n){if(En(e))for(var r=this.length,a=0;a<r;a++){var i=this[a],s=n?e.apply(n,[i,a,this]):e(i,a,this);if(s===!1)break}return this},toArray:function(){for(var e=[],n=0;n<this.length;n++)e.push(this[n]);return e},slice:function(e,n){var r=[],a=this.length;n==null&&(n=a),e==null&&(e=0),e<0&&(e=a+e),n<0&&(n=a+n);for(var i=e;i>=0&&i<n&&i<a;i++)r.push(this[i]);return this.spawn(r)},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(!En(e))return this;var n=this.toArray().sort(e);return this.spawn(n)},sortByZIndex:function(){return this.sort(bS)},zDepth:function(){var e=this[0];if(e){var n=e._private,r=n.group;if(r==="nodes"){var a=n.data.parent?e.parents().size():0;return e.isParent()?a:ry-1}else{var i=n.source,s=n.target,o=i.zDepth(),l=s.zDepth();return Math.max(o,l,0)}}}};Kd.each=Kd.forEach;var lD=function(){var e="undefined",n=(typeof Symbol>"u"?"undefined":Gn(Symbol))!=e&&Gn(Symbol.iterator)!=e;n&&(Kd[Symbol.iterator]=function(){var r=this,a={value:void 0,done:!1},i=0,s=this.length;return mC({next:function(){return i<s?a.value=r[i++]:(a.value=void 0,a.done=!0),a}},Symbol.iterator,function(){return this})})};lD();var uD=ur({nodeDimensionsIncludeLabels:!1}),rd={layoutDimensions:function(e){e=uD(e);var n;if(!this.takesUpSpace())n={w:0,h:0};else if(e.nodeDimensionsIncludeLabels){var r=this.boundingBox();n={w:r.w,h:r.h}}else n={w:this.outerWidth(),h:this.outerHeight()};return(n.w===0||n.h===0)&&(n.w=n.h=1),n},layoutPositions:function(e,n,r){var a=this.nodes().filter(function(E){return!E.isParent()}),i=this.cy(),s=n.eles,o=function(S){return S.id()},l=qo(r,o);e.emit({type:"layoutstart",layout:e}),e.animations=[];var u=function(S,C,T){var N={x:C.x1+C.w/2,y:C.y1+C.h/2},P={x:(T.x-N.x)*S,y:(T.y-N.y)*S};return{x:N.x+P.x,y:N.y+P.y}},d=n.spacingFactor&&n.spacingFactor!==1,f=function(){if(!d)return null;for(var S=jr(),C=0;C<a.length;C++){var T=a[C],N=l(T,C);OC(S,N.x,N.y)}return S},h=f(),v=qo(function(E,S){var C=l(E,S);if(d){var T=Math.abs(n.spacingFactor);C=u(T,h,C)}return n.transform!=null&&(C=n.transform(E,C)),C},o);if(n.animate){for(var p=0;p<a.length;p++){var y=a[p],b=v(y,p),m=n.animateFilter==null||n.animateFilter(y,p);if(m){var g=y.animation({position:b,duration:n.animationDuration,easing:n.animationEasing});e.animations.push(g)}else y.position(b)}if(n.fit){var w=i.animation({fit:{boundingBox:s.boundingBoxAt(v),padding:n.padding},duration:n.animationDuration,easing:n.animationEasing});e.animations.push(w)}else if(n.zoom!==void 0&&n.pan!==void 0){var x=i.animation({zoom:n.zoom,pan:n.pan,duration:n.animationDuration,easing:n.animationEasing});e.animations.push(x)}e.animations.forEach(function(E){return E.play()}),e.one("layoutready",n.ready),e.emit({type:"layoutready",layout:e}),nl.all(e.animations.map(function(E){return E.promise()})).then(function(){e.one("layoutstop",n.stop),e.emit({type:"layoutstop",layout:e})})}else a.positions(v),n.fit&&i.fit(n.eles,n.padding),n.zoom!=null&&i.zoom(n.zoom),n.pan&&i.pan(n.pan),e.one("layoutready",n.ready),e.emit({type:"layoutready",layout:e}),e.one("layoutstop",n.stop),e.emit({type:"layoutstop",layout:e});return this},layout:function(e){var n=this.cy();return n.makeLayout(pt({},e,{eles:this}))}};rd.createLayout=rd.makeLayout=rd.layout;function xS(t,e,n){var r=n._private,a=r.styleCache=r.styleCache||[],i;return(i=a[t])!=null||(i=a[t]=e(n)),i}function $f(t,e){return t=Ds(t),function(r){return xS(t,e,r)}}function Vf(t,e){t=Ds(t);var n=function(a){return e.call(a)};return function(){var a=this[0];if(a)return xS(t,n,a)}}var sr={recalculateRenderedStyle:function(e){var n=this.cy(),r=n.renderer(),a=n.styleEnabled();return r&&a&&r.recalculateRenderedStyle(this,e),this},dirtyStyleCache:function(){var e=this.cy(),n=function(i){return i._private.styleCache=null};if(e.hasCompoundNodes()){var r;r=this.spawnSelf().merge(this.descendants()).merge(this.parents()),r.merge(r.connectedEdges()),r.forEach(n)}else this.forEach(function(a){n(a),a.connectedEdges().forEach(n)});return this},updateStyle:function(e){var n=this._private.cy;if(!n.styleEnabled())return this;if(n.batching()){var r=n._private.batchStyleEles;return r.merge(this),this}var a=n.hasCompoundNodes(),i=this;e=!!(e||e===void 0),a&&(i=this.spawnSelf().merge(this.descendants()).merge(this.parents()));var s=i;return e?s.emitAndNotify("style"):s.emit("style"),i.forEach(function(o){return o._private.styleDirty=!0}),this},cleanStyle:function(){var e=this.cy();if(e.styleEnabled())for(var n=0;n<this.length;n++){var r=this[n];r._private.styleDirty&&(r._private.styleDirty=!1,e.style().apply(r))}},parsedStyle:function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,r=this[0],a=r.cy();if(a.styleEnabled()&&r){r._private.styleDirty&&(r._private.styleDirty=!1,a.style().apply(r));var i=r._private.style[e];return i??(n?a.style().getDefaultProperty(e):null)}},numericStyle:function(e){var n=this[0];if(n.cy().styleEnabled()&&n){var r=n.pstyle(e);return r.pfValue!==void 0?r.pfValue:r.value}},numericStyleUnits:function(e){var n=this[0];if(n.cy().styleEnabled()&&n)return n.pstyle(e).units},renderedStyle:function(e){var n=this.cy();if(!n.styleEnabled())return this;var r=this[0];if(r)return n.style().getRenderedStyle(r,e)},style:function(e,n){var r=this.cy();if(!r.styleEnabled())return this;var a=!1,i=r.style();if(Wt(e)){var s=e;i.applyBypass(this,s,a),this.emitAndNotify("style")}else if(ft(e))if(n===void 0){var o=this[0];return o?i.getStylePropertyValue(o,e):void 0}else i.applyBypass(this,e,n,a),this.emitAndNotify("style");else if(e===void 0){var l=this[0];return l?i.getRawStyle(l):void 0}return this},removeStyle:function(e){var n=this.cy();if(!n.styleEnabled())return this;var r=!1,a=n.style(),i=this;if(e===void 0)for(var s=0;s<i.length;s++){var o=i[s];a.removeAllBypasses(o,r)}else{e=e.split(/\s+/);for(var l=0;l<i.length;l++){var u=i[l];a.removeBypasses(u,e,r)}}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 n=e.hasCompoundNodes(),r=this[0];if(r){var a=r._private,i=r.pstyle("opacity").value;if(!n)return i;var s=a.data.parent?r.parents():null;if(s)for(var o=0;o<s.length;o++){var l=s[o],u=l.pstyle("opacity").value;i=u*i}return i}},transparent:function(){var e=this.cy();if(!e.styleEnabled())return!1;var n=this[0],r=n.cy().hasCompoundNodes();if(n)return r?n.effectiveOpacity()===0:n.pstyle("opacity").value===0},backgrounding:function(){var e=this.cy();if(!e.styleEnabled())return!1;var n=this[0];return!!n._private.backgrounding}};function dp(t,e){var n=t._private,r=n.data.parent?t.parents():null;if(r)for(var a=0;a<r.length;a++){var i=r[a];if(!e(i))return!1}return!0}function py(t){var e=t.ok,n=t.edgeOkViaNode||t.ok,r=t.parentOk||t.ok;return function(){var a=this.cy();if(!a.styleEnabled())return!0;var i=this[0],s=a.hasCompoundNodes();if(i){var o=i._private;if(!e(i))return!1;if(i.isNode())return!s||dp(i,r);var l=o.source,u=o.target;return n(l)&&(!s||dp(l,n))&&(l===u||n(u)&&(!s||dp(u,n)))}}}var rl=$f("eleTakesUpSpace",function(t){return t.pstyle("display").value==="element"&&t.width()!==0&&(t.isNode()?t.height()!==0:!0)});sr.takesUpSpace=Vf("takesUpSpace",py({ok:rl}));var cD=$f("eleInteractive",function(t){return t.pstyle("events").value==="yes"&&t.pstyle("visibility").value==="visible"&&rl(t)}),dD=$f("parentInteractive",function(t){return t.pstyle("visibility").value==="visible"&&rl(t)});sr.interactive=Vf("interactive",py({ok:cD,parentOk:dD,edgeOkViaNode:rl}));sr.noninteractive=function(){var t=this[0];if(t)return!t.interactive()};var fD=$f("eleVisible",function(t){return t.pstyle("visibility").value==="visible"&&t.pstyle("opacity").pfValue!==0&&rl(t)}),hD=rl;sr.visible=Vf("visible",py({ok:fD,edgeOkViaNode:hD}));sr.hidden=function(){var t=this[0];if(t)return!t.visible()};sr.isBundledBezier=Vf("isBundledBezier",function(){return this.cy().styleEnabled()?!this.removed()&&this.pstyle("curve-style").value==="bezier"&&this.takesUpSpace():!1});sr.bypass=sr.css=sr.style;sr.renderedCss=sr.renderedStyle;sr.removeBypass=sr.removeCss=sr.removeStyle;sr.pstyle=sr.parsedStyle;var _i={};function pw(t){return function(){var e=arguments,n=[];if(e.length===2){var r=e[0],a=e[1];this.on(t.event,r,a)}else if(e.length===1&&En(e[0])){var i=e[0];this.on(t.event,i)}else if(e.length===0||e.length===1&&an(e[0])){for(var s=e.length===1?e[0]:null,o=0;o<this.length;o++){var l=this[o],u=!t.ableField||l._private[t.ableField],d=l._private[t.field]!=t.value;if(t.overrideAble){var f=t.overrideAble(l);if(f!==void 0&&(u=f,!f))return this}u&&(l._private[t.field]=t.value,d&&n.push(l))}var h=this.spawn(n);h.updateStyle(),h.emit(t.event),s&&h.emit(s)}return this}}function al(t){_i[t.field]=function(){var e=this[0];if(e){if(t.overrideField){var n=t.overrideField(e);if(n!==void 0)return n}return e._private[t.field]}},_i[t.on]=pw({event:t.on,field:t.field,ableField:t.ableField,overrideAble:t.overrideAble,value:!0}),_i[t.off]=pw({event:t.off,field:t.field,ableField:t.ableField,overrideAble:t.overrideAble,value:!1})}al({field:"locked",overrideField:function(e){return e.cy().autolock()?!0:void 0},on:"lock",off:"unlock"});al({field:"grabbable",overrideField:function(e){return e.cy().autoungrabify()||e.pannable()?!1:void 0},on:"grabify",off:"ungrabify"});al({field:"selected",ableField:"selectable",overrideAble:function(e){return e.cy().autounselectify()?!1:void 0},on:"select",off:"unselect"});al({field:"selectable",overrideField:function(e){return e.cy().autounselectify()?!1:void 0},on:"selectify",off:"unselectify"});_i.deselect=_i.unselect;_i.grabbed=function(){var t=this[0];if(t)return t._private.grabbed};al({field:"active",on:"activate",off:"unactivate"});al({field:"pannable",on:"panify",off:"unpanify"});_i.inactive=function(){var t=this[0];if(t)return!t._private.active};var yr={},gw=function(e){return function(r){for(var a=this,i=[],s=0;s<a.length;s++){var o=a[s];if(o.isNode()){for(var l=!1,u=o.connectedEdges(),d=0;d<u.length;d++){var f=u[d],h=f.source(),v=f.target();if(e.noIncomingEdges&&v===o&&h!==o||e.noOutgoingEdges&&h===o&&v!==o){l=!0;break}}l||i.push(o)}}return this.spawn(i,!0).filter(r)}},mw=function(e){return function(n){for(var r=this,a=[],i=0;i<r.length;i++){var s=r[i];if(s.isNode())for(var o=s.connectedEdges(),l=0;l<o.length;l++){var u=o[l],d=u.source(),f=u.target();e.outgoing&&d===s?(a.push(u),a.push(f)):e.incoming&&f===s&&(a.push(u),a.push(d))}}return this.spawn(a,!0).filter(n)}},yw=function(e){return function(n){for(var r=this,a=[],i={};;){var s=e.outgoing?r.outgoers():r.incomers();if(s.length===0)break;for(var o=!1,l=0;l<s.length;l++){var u=s[l],d=u.id();i[d]||(i[d]=!0,a.push(u),o=!0)}if(!o)break;r=s}return this.spawn(a,!0).filter(n)}};yr.clearTraversalCache=function(){for(var t=0;t<this.length;t++)this[t]._private.traversalCache=null};pt(yr,{roots:gw({noIncomingEdges:!0}),leaves:gw({noOutgoingEdges:!0}),outgoers:ua(mw({outgoing:!0}),"outgoers"),successors:yw({outgoing:!0}),incomers:ua(mw({incoming:!0}),"incomers"),predecessors:yw({})});pt(yr,{neighborhood:ua(function(t){for(var e=[],n=this.nodes(),r=0;r<n.length;r++)for(var a=n[r],i=a.connectedEdges(),s=0;s<i.length;s++){var o=i[s],l=o.source(),u=o.target(),d=a===l?u:l;d.length>0&&e.push(d[0]),e.push(o[0])}return this.spawn(e,!0).filter(t)},"neighborhood"),closedNeighborhood:function(e){return this.neighborhood().add(this).filter(e)},openNeighborhood:function(e){return this.neighborhood(e)}});yr.neighbourhood=yr.neighborhood;yr.closedNeighbourhood=yr.closedNeighborhood;yr.openNeighbourhood=yr.openNeighborhood;pt(yr,{source:ua(function(e){var n=this[0],r;return n&&(r=n._private.source||n.cy().collection()),r&&e?r.filter(e):r},"source"),target:ua(function(e){var n=this[0],r;return n&&(r=n._private.target||n.cy().collection()),r&&e?r.filter(e):r},"target"),sources:bw({attr:"source"}),targets:bw({attr:"target"})});function bw(t){return function(n){for(var r=[],a=0;a<this.length;a++){var i=this[a],s=i._private[t.attr];s&&r.push(s)}return this.spawn(r,!0).filter(n)}}pt(yr,{edgesWith:ua(xw(),"edgesWith"),edgesTo:ua(xw({thisIsSrc:!0}),"edgesTo")});function xw(t){return function(n){var r=[],a=this._private.cy,i=t||{};ft(n)&&(n=a.$(n));for(var s=0;s<n.length;s++)for(var o=n[s]._private.edges,l=0;l<o.length;l++){var u=o[l],d=u._private.data,f=this.hasElementWithId(d.source)&&n.hasElementWithId(d.target),h=n.hasElementWithId(d.source)&&this.hasElementWithId(d.target),v=f||h;v&&((i.thisIsSrc||i.thisIsTgt)&&(i.thisIsSrc&&!f||i.thisIsTgt&&!h)||r.push(u))}return this.spawn(r,!0)}}pt(yr,{connectedEdges:ua(function(t){for(var e=[],n=this,r=0;r<n.length;r++){var a=n[r];if(a.isNode())for(var i=a._private.edges,s=0;s<i.length;s++){var o=i[s];e.push(o)}}return this.spawn(e,!0).filter(t)},"connectedEdges"),connectedNodes:ua(function(t){for(var e=[],n=this,r=0;r<n.length;r++){var a=n[r];a.isEdge()&&(e.push(a.source()[0]),e.push(a.target()[0]))}return this.spawn(e,!0).filter(t)},"connectedNodes"),parallelEdges:ua(ww(),"parallelEdges"),codirectedEdges:ua(ww({codirected:!0}),"codirectedEdges")});function ww(t){var e={codirected:!1};return t=pt({},e,t),function(r){for(var a=[],i=this.edges(),s=t,o=0;o<i.length;o++)for(var l=i[o],u=l._private,d=u.source,f=d._private.data.id,h=u.data.target,v=d._private.edges,p=0;p<v.length;p++){var y=v[p],b=y._private.data,m=b.target,g=b.source,w=m===h&&g===f,x=f===m&&h===g;(s.codirected&&w||!s.codirected&&(w||x))&&a.push(y)}return this.spawn(a,!0).filter(r)}}pt(yr,{components:function(e){var n=this,r=n.cy(),a=r.collection(),i=e==null?n.nodes():e.nodes(),s=[];e!=null&&i.empty()&&(i=e.sources());var o=function(d,f){a.merge(d),i.unmerge(d),f.merge(d)};if(i.empty())return n.spawn();var l=function(){var d=r.collection();s.push(d);var f=i[0];o(f,d),n.bfs({directed:!1,roots:f,visit:function(v){return o(v,d)}}),d.forEach(function(h){h.connectedEdges().forEach(function(v){n.has(v)&&d.has(v.source())&&d.has(v.target())&&d.merge(v)})})};do l();while(i.length>0);return s},component:function(){var e=this[0];return e.cy().mutableElements().components(e)[0]}});yr.componentsOf=yr.components;var or=function(e,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(e===void 0){yn("A collection must have a reference to the core");return}var i=new Xa,s=!1;if(!n)n=[];else if(n.length>0&&Wt(n[0])&&!Fu(n[0])){s=!0;for(var o=[],l=new tl,u=0,d=n.length;u<d;u++){var f=n[u];f.data==null&&(f.data={});var h=f.data;if(h.id==null)h.id=DC();else if(e.hasElementWithId(h.id)||l.has(h.id))continue;var v=new Lf(e,f,!1);o.push(v),l.add(h.id)}n=o}this.length=0;for(var p=0,y=n.length;p<y;p++){var b=n[p][0];if(b!=null){var m=b._private.data.id;(!r||!i.has(m))&&(r&&i.set(m,{index:this.length,ele:b}),this[this.length]=b,this.length++)}}this._private={eles:this,cy:e,get map(){return this.lazyMap==null&&this.rebuildMap(),this.lazyMap},set map(g){this.lazyMap=g},rebuildMap:function(){for(var w=this.lazyMap=new Xa,x=this.eles,E=0;E<x.length;E++){var S=x[E];w.set(S.id(),{index:E,ele:S})}}},r&&(this._private.map=i),s&&!a&&this.restore()},cn=Lf.prototype=or.prototype=Object.create(Array.prototype);cn.instanceString=function(){return"collection"};cn.spawn=function(t,e){return new or(this.cy(),t,e)};cn.spawnSelf=function(){return this.spawn(this)};cn.cy=function(){return this._private.cy};cn.renderer=function(){return this._private.cy.renderer()};cn.element=function(){return this[0]};cn.collection=function(){return xC(this)?this:new or(this._private.cy,[this])};cn.unique=function(){return new or(this._private.cy,this,!0)};cn.hasElementWithId=function(t){return t=""+t,this._private.map.has(t)};cn.getElementById=function(t){t=""+t;var e=this._private.cy,n=this._private.map.get(t);return n?n.ele:new or(e)};cn.$id=cn.getElementById;cn.poolIndex=function(){var t=this._private.cy,e=t._private.elements,n=this[0]._private.data.id;return e._private.map.get(n).index};cn.indexOf=function(t){var e=t[0]._private.data.id;return this._private.map.get(e).index};cn.indexOfId=function(t){return t=""+t,this._private.map.get(t).index};cn.json=function(t){var e=this.element(),n=this.cy();if(e==null&&t)return this;if(e!=null){var r=e._private;if(Wt(t)){if(n.startBatch(),t.data){e.data(t.data);var a=r.data;if(e.isEdge()){var i=!1,s={},o=t.data.source,l=t.data.target;o!=null&&o!=a.source&&(s.source=""+o,i=!0),l!=null&&l!=a.target&&(s.target=""+l,i=!0),i&&(e=e.move(s))}else{var u="parent"in t.data,d=t.data.parent;u&&(d!=null||a.parent!=null)&&d!=a.parent&&(d===void 0&&(d=null),d!=null&&(d=""+d),e=e.move({parent:d}))}}t.position&&e.position(t.position);var f=function(y,b,m){var g=t[y];g!=null&&g!==r[y]&&(g?e[b]():e[m]())};return f("removed","remove","restore"),f("selected","select","unselect"),f("selectable","selectify","unselectify"),f("locked","lock","unlock"),f("grabbable","grabify","ungrabify"),f("pannable","panify","unpanify"),t.classes!=null&&e.classes(t.classes),n.endBatch(),this}else if(t===void 0){var h={data:Oa(r.data),position:Oa(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};h.classes="";var v=0;return r.classes.forEach(function(p){return h.classes+=v++===0?p:" "+p}),h}}};cn.jsons=function(){for(var t=[],e=0;e<this.length;e++){var n=this[e],r=n.json();t.push(r)}return t};cn.clone=function(){for(var t=this.cy(),e=[],n=0;n<this.length;n++){var r=this[n],a=r.json(),i=new Lf(t,a,!1);e.push(i)}return new or(t,e)};cn.copy=cn.clone;cn.restore=function(){for(var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=this,r=n.cy(),a=r._private,i=[],s=[],o,l=0,u=n.length;l<u;l++){var d=n[l];e&&!d.removed()||(d.isNode()?i.push(d):s.push(d))}o=i.concat(s);var f,h=function(){o.splice(f,1),f--};for(f=0;f<o.length;f++){var v=o[f],p=v._private,y=p.data;if(v.clearTraversalCache(),!(!e&&!p.removed)){if(y.id===void 0)y.id=DC();else if(_e(y.id))y.id=""+y.id;else if(qi(y.id)||!ft(y.id)){yn("Can not create element with invalid string ID `"+y.id+"`"),h();continue}else if(r.hasElementWithId(y.id)){yn("Can not create second element with ID `"+y.id+"`"),h();continue}}var b=y.id;if(v.isNode()){var m=p.position;m.x==null&&(m.x=0),m.y==null&&(m.y=0)}if(v.isEdge()){for(var g=v,w=["source","target"],x=w.length,E=!1,S=0;S<x;S++){var C=w[S],T=y[C];_e(T)&&(T=y[C]=""+y[C]),T==null||T===""?(yn("Can not create edge `"+b+"` with unspecified "+C),E=!0):r.hasElementWithId(T)||(yn("Can not create edge `"+b+"` with nonexistent "+C+" `"+T+"`"),E=!0)}if(E){h();continue}var N=r.getElementById(y.source),P=r.getElementById(y.target);N.same(P)?N._private.edges.push(g):(N._private.edges.push(g),P._private.edges.push(g)),g._private.source=N,g._private.target=P}p.map=new Xa,p.map.set(b,{ele:v,index:0}),p.removed=!1,e&&r.addToPool(v)}for(var R=0;R<i.length;R++){var I=i[R],D=I._private.data;_e(D.parent)&&(D.parent=""+D.parent);var $=D.parent,H=$!=null;if(H||I._private.parent){var V=I._private.parent?r.collection().merge(I._private.parent):r.getElementById($);if(V.empty())D.parent=void 0;else if(V[0].removed())Jt("Node added with missing parent, reference to parent removed"),D.parent=void 0,I._private.parent=null;else{for(var U=!1,F=V;!F.empty();){if(I.same(F)){U=!0,D.parent=void 0;break}F=F.parent()}U||(V[0]._private.children.push(I),I._private.parent=V[0],a.hasCompoundNodes=!0)}}}if(o.length>0){for(var G=o.length===n.length?n:new or(r,o),z=0;z<G.length;z++){var _=G[z];_.isNode()||(_.parallelEdges().clearTraversalCache(),_.source().clearTraversalCache(),_.target().clearTraversalCache())}var K;a.hasCompoundNodes?K=r.collection().merge(G).merge(G.connectedNodes()).merge(G.parent()):K=G,K.dirtyCompoundBoundsCache().dirtyBoundingBoxCache().updateStyle(t),t?G.emitAndNotify("add"):e&&G.emit("add")}return n};cn.removed=function(){var t=this[0];return t&&t._private.removed};cn.inside=function(){var t=this[0];return t&&!t._private.removed};cn.remove=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=this,r=[],a={},i=n._private.cy;function s($){for(var H=$._private.edges,V=0;V<H.length;V++)l(H[V])}function o($){for(var H=$._private.children,V=0;V<H.length;V++)l(H[V])}function l($){var H=a[$.id()];e&&$.removed()||H||(a[$.id()]=!0,$.isNode()?(r.push($),s($),o($)):r.unshift($))}for(var u=0,d=n.length;u<d;u++){var f=n[u];l(f)}function h($,H){var V=$._private.edges;Hi(V,H),$.clearTraversalCache()}function v($){$.clearTraversalCache()}var p=[];p.ids={};function y($,H){H=H[0],$=$[0];var V=$._private.children,U=$.id();Hi(V,H),H._private.parent=null,p.ids[U]||(p.ids[U]=!0,p.push($))}n.dirtyCompoundBoundsCache(),e&&i.removeFromPool(r);for(var b=0;b<r.length;b++){var m=r[b];if(m.isEdge()){var g=m.source()[0],w=m.target()[0];h(g,m),h(w,m);for(var x=m.parallelEdges(),E=0;E<x.length;E++){var S=x[E];v(S),S.isBundledBezier()&&S.dirtyBoundingBoxCache()}}else{var C=m.parent();C.length!==0&&y(C,m)}e&&(m._private.removed=!0)}var T=i._private.elements;i._private.hasCompoundNodes=!1;for(var N=0;N<T.length;N++){var P=T[N];if(P.isParent()){i._private.hasCompoundNodes=!0;break}}var R=new or(this.cy(),r);R.size()>0&&(t?R.emitAndNotify("remove"):e&&R.emit("remove"));for(var I=0;I<p.length;I++){var D=p[I];(!e||!D.removed())&&D.updateStyle()}return R};cn.move=function(t){var e=this._private.cy,n=this,r=!1,a=!1,i=function(p){return p==null?p:""+p};if(t.source!==void 0||t.target!==void 0){var s=i(t.source),o=i(t.target),l=s!=null&&e.hasElementWithId(s),u=o!=null&&e.hasElementWithId(o);(l||u)&&(e.batch(function(){n.remove(r,a),n.emitAndNotify("moveout");for(var v=0;v<n.length;v++){var p=n[v],y=p._private.data;p.isEdge()&&(l&&(y.source=s),u&&(y.target=o))}n.restore(r,a)}),n.emitAndNotify("move"))}else if(t.parent!==void 0){var d=i(t.parent),f=d===null||e.hasElementWithId(d);if(f){var h=d===null?void 0:d;e.batch(function(){var v=n.remove(r,a);v.emitAndNotify("moveout");for(var p=0;p<n.length;p++){var y=n[p],b=y._private.data;y.isNode()&&(b.parent=h)}v.restore(r,a)}),n.emitAndNotify("move")}}return this};[WC,EA,nd,Fi,Wo,FA,Ff,nD,mS,yS,oD,Kd,rd,sr,_i,yr].forEach(function(t){pt(cn,t)});var vD={add:function(e){var n,r=this;if(Xr(e)){var a=e;if(a._private.cy===r)n=a.restore();else{for(var i=[],s=0;s<a.length;s++){var o=a[s];i.push(o.json())}n=new or(r,i)}}else if(an(e)){var l=e;n=new or(r,l)}else if(Wt(e)&&(an(e.nodes)||an(e.edges))){for(var u=e,d=[],f=["nodes","edges"],h=0,v=f.length;h<v;h++){var p=f[h],y=u[p];if(an(y))for(var b=0,m=y.length;b<m;b++){var g=pt({group:p},y[b]);d.push(g)}}n=new or(r,d)}else{var w=e;n=new Lf(r,w).collection()}return n},remove:function(e){if(!Xr(e)){if(ft(e)){var n=e;e=this.$(n)}}return e.remove()}};/*! Bezier curve function generator. Copyright Gaetan Renaudeau. MIT License: http://en.wikipedia.org/wiki/MIT_License */function pD(t,e,n,r){var a=4,i=.001,s=1e-7,o=10,l=11,u=1/(l-1),d=typeof Float32Array<"u";if(arguments.length!==4)return!1;for(var f=0;f<4;++f)if(typeof arguments[f]!="number"||isNaN(arguments[f])||!isFinite(arguments[f]))return!1;t=Math.min(t,1),n=Math.min(n,1),t=Math.max(t,0),n=Math.max(n,0);var h=d?new Float32Array(l):new Array(l);function v(P,R){return 1-3*R+3*P}function p(P,R){return 3*R-6*P}function y(P){return 3*P}function b(P,R,I){return((v(R,I)*P+p(R,I))*P+y(R))*P}function m(P,R,I){return 3*v(R,I)*P*P+2*p(R,I)*P+y(R)}function g(P,R){for(var I=0;I<a;++I){var D=m(R,t,n);if(D===0)return R;var $=b(R,t,n)-P;R-=$/D}return R}function w(){for(var P=0;P<l;++P)h[P]=b(P*u,t,n)}function x(P,R,I){var D,$,H=0;do $=R+(I-R)/2,D=b($,t,n)-P,D>0?I=$:R=$;while(Math.abs(D)>s&&++H<o);return $}function E(P){for(var R=0,I=1,D=l-1;I!==D&&h[I]<=P;++I)R+=u;--I;var $=(P-h[I])/(h[I+1]-h[I]),H=R+$*u,V=m(H,t,n);return V>=i?g(P,H):V===0?H:x(P,R,R+u)}var S=!1;function C(){S=!0,(t!==e||n!==r)&&w()}var T=function(R){return S||C(),t===e&&n===r?R:R===0?0:R===1?1:b(E(R),e,r)};T.getControlPoints=function(){return[{x:t,y:e},{x:n,y:r}]};var N="generateBezier("+[t,e,n,r]+")";return T.toString=function(){return N},T}/*! Runge-Kutta spring physics function generator. Adapted from Framer.js, copyright Koen Bok. MIT License: http://en.wikipedia.org/wiki/MIT_License */var gD=function(){function t(r){return-r.tension*r.x-r.friction*r.v}function e(r,a,i){var s={x:r.x+i.dx*a,v:r.v+i.dv*a,tension:r.tension,friction:r.friction};return{dx:s.v,dv:t(s)}}function n(r,a){var i={dx:r.v,dv:t(r)},s=e(r,a*.5,i),o=e(r,a*.5,s),l=e(r,a,o),u=1/6*(i.dx+2*(s.dx+o.dx)+l.dx),d=1/6*(i.dv+2*(s.dv+o.dv)+l.dv);return r.x=r.x+u*a,r.v=r.v+d*a,r}return function r(a,i,s){var o={x:-1,v:0,tension:null,friction:null},l=[0],u=0,d=1/1e4,f=16/1e3,h,v,p;for(a=parseFloat(a)||500,i=parseFloat(i)||20,s=s||null,o.tension=a,o.friction=i,h=s!==null,h?(u=r(a,i),v=u/s*f):v=f;p=n(p||o,v),l.push(1+p.x),u+=16,Math.abs(p.x)>d&&Math.abs(p.v)>d;);return h?function(y){return l[y*(l.length-1)|0]}:u}}(),ln=function(e,n,r,a){var i=pD(e,n,r,a);return function(s,o,l){return s+(o-s)*i(l)}},ad={linear:function(e,n,r){return e+(n-e)*r},ease:ln(.25,.1,.25,1),"ease-in":ln(.42,0,1,1),"ease-out":ln(0,0,.58,1),"ease-in-out":ln(.42,0,.58,1),"ease-in-sine":ln(.47,0,.745,.715),"ease-out-sine":ln(.39,.575,.565,1),"ease-in-out-sine":ln(.445,.05,.55,.95),"ease-in-quad":ln(.55,.085,.68,.53),"ease-out-quad":ln(.25,.46,.45,.94),"ease-in-out-quad":ln(.455,.03,.515,.955),"ease-in-cubic":ln(.55,.055,.675,.19),"ease-out-cubic":ln(.215,.61,.355,1),"ease-in-out-cubic":ln(.645,.045,.355,1),"ease-in-quart":ln(.895,.03,.685,.22),"ease-out-quart":ln(.165,.84,.44,1),"ease-in-out-quart":ln(.77,0,.175,1),"ease-in-quint":ln(.755,.05,.855,.06),"ease-out-quint":ln(.23,1,.32,1),"ease-in-out-quint":ln(.86,0,.07,1),"ease-in-expo":ln(.95,.05,.795,.035),"ease-out-expo":ln(.19,1,.22,1),"ease-in-out-expo":ln(1,0,0,1),"ease-in-circ":ln(.6,.04,.98,.335),"ease-out-circ":ln(.075,.82,.165,1),"ease-in-out-circ":ln(.785,.135,.15,.86),spring:function(e,n,r){if(r===0)return ad.linear;var a=gD(e,n,r);return function(i,s,o){return i+(s-i)*a(o)}},"cubic-bezier":ln};function kw(t,e,n,r,a){if(r===1||e===n)return n;var i=a(e,n,r);return t==null||((t.roundValue||t.color)&&(i=Math.round(i)),t.min!==void 0&&(i=Math.max(i,t.min)),t.max!==void 0&&(i=Math.min(i,t.max))),i}function Ew(t,e){return t.pfValue!=null||t.value!=null?t.pfValue!=null&&(e==null||e.type.units!=="%")?t.pfValue:t.value:t}function Qs(t,e,n,r,a){var i=a!=null?a.type:null;n<0?n=0:n>1&&(n=1);var s=Ew(t,a),o=Ew(e,a);if(_e(s)&&_e(o))return kw(i,s,o,n,r);if(an(s)&&an(o)){for(var l=[],u=0;u<o.length;u++){var d=s[u],f=o[u];if(d!=null&&f!=null){var h=kw(i,d,f,n,r);l.push(h)}else l.push(f)}return l}}function mD(t,e,n,r){var a=!r,i=t._private,s=e._private,o=s.easing,l=s.startTime,u=r?t:t.cy(),d=u.style();if(!s.easingImpl)if(o==null)s.easingImpl=ad.linear;else{var f;if(ft(o)){var h=d.parse("transition-timing-function",o);f=h.value}else f=o;var v,p;ft(f)?(v=f,p=[]):(v=f[1],p=f.slice(2).map(function(G){return+G})),p.length>0?(v==="spring"&&p.push(s.duration),s.easingImpl=ad[v].apply(null,p)):s.easingImpl=ad[v]}var y=s.easingImpl,b;if(s.duration===0?b=1:b=(n-l)/s.duration,s.applying&&(b=s.progress),b<0?b=0:b>1&&(b=1),s.delay==null){var m=s.startPosition,g=s.position;if(g&&a&&!t.locked()){var w={};Sl(m.x,g.x)&&(w.x=Qs(m.x,g.x,b,y)),Sl(m.y,g.y)&&(w.y=Qs(m.y,g.y,b,y)),t.position(w)}var x=s.startPan,E=s.pan,S=i.pan,C=E!=null&&r;C&&(Sl(x.x,E.x)&&(S.x=Qs(x.x,E.x,b,y)),Sl(x.y,E.y)&&(S.y=Qs(x.y,E.y,b,y)),t.emit("pan"));var T=s.startZoom,N=s.zoom,P=N!=null&&r;P&&(Sl(T,N)&&(i.zoom=ku(i.minZoom,Qs(T,N,b,y),i.maxZoom)),t.emit("zoom")),(C||P)&&t.emit("viewport");var R=s.style;if(R&&R.length>0&&a){for(var I=0;I<R.length;I++){var D=R[I],$=D.name,H=D,V=s.startStyle[$],U=d.properties[V.name],F=Qs(V,H,b,y,U);d.overrideBypass(t,$,F)}t.emit("style")}}return s.progress=b,b}function Sl(t,e){return t==null||e==null?!1:_e(t)&&_e(e)?!0:!!(t&&e)}function yD(t,e,n,r){var a=e._private;a.started=!0,a.startTime=n-a.progress*a.duration}function Cw(t,e){var n=e._private.aniEles,r=[];function a(d,f){var h=d._private,v=h.animation.current,p=h.animation.queue,y=!1;if(v.length===0){var b=p.shift();b&&v.push(b)}for(var m=function(S){for(var C=S.length-1;C>=0;C--){var T=S[C];T()}S.splice(0,S.length)},g=v.length-1;g>=0;g--){var w=v[g],x=w._private;if(x.stopped){v.splice(g,1),x.hooked=!1,x.playing=!1,x.started=!1,m(x.frames);continue}!x.playing&&!x.applying||(x.playing&&x.applying&&(x.applying=!1),x.started||yD(d,w,t),mD(d,w,t,f),x.applying&&(x.applying=!1),m(x.frames),x.step!=null&&x.step(t),w.completed()&&(v.splice(g,1),x.hooked=!1,x.playing=!1,x.started=!1,m(x.completes)),y=!0)}return!f&&v.length===0&&p.length===0&&r.push(d),y}for(var i=!1,s=0;s<n.length;s++){var o=n[s],l=a(o);i=i||l}var u=a(e,!0);(i||u)&&(n.length>0?e.notify("draw",n):e.notify("draw")),n.unmerge(r),e.emit("step")}var bD={animate:Zt.animate(),animation:Zt.animation(),animated:Zt.animated(),clearQueue:Zt.clearQueue(),delay:Zt.delay(),delayAnimation:Zt.delayAnimation(),stop:Zt.stop(),addToAnimationPool:function(e){var n=this;n.styleEnabled()&&n._private.aniEles.merge(e)},stopAnimationLoop:function(){this._private.animationsRunning=!1},startAnimationLoop:function(){var e=this;if(e._private.animationsRunning=!0,!e.styleEnabled())return;function n(){e._private.animationsRunning&&Vd(function(i){Cw(i,e),n()})}var r=e.renderer();r&&r.beforeRender?r.beforeRender(function(i,s){Cw(s,e)},r.beforeRenderPriorities.animations):n()}},xD={qualifierCompare:function(e,n){return e==null||n==null?e==null&&n==null:e.sameText(n)},eventMatches:function(e,n,r){var a=n.qualifier;return a!=null?e!==r.target&&Fu(r.target)&&a.matches(r.target):!0},addEventFields:function(e,n){n.cy=e,n.target=e},callbackContext:function(e,n,r){return n.qualifier!=null?r.target:e}},Mc=function(e){return ft(e)?new Ki(e):e},wS={createEmitter:function(){var e=this._private;return e.emitter||(e.emitter=new _f(xD,this)),this},emitter:function(){return this._private.emitter},on:function(e,n,r){return this.emitter().on(e,Mc(n),r),this},removeListener:function(e,n,r){return this.emitter().removeListener(e,Mc(n),r),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},one:function(e,n,r){return this.emitter().one(e,Mc(n),r),this},once:function(e,n,r){return this.emitter().one(e,Mc(n),r),this},emit:function(e,n){return this.emitter().emit(e,n),this},emitAndNotify:function(e,n){return this.emit(e),this.notify(e,n),this}};Zt.eventAliasesOn(wS);var Fg={png:function(e){var n=this._private.renderer;return e=e||{},n.png(e)},jpg:function(e){var n=this._private.renderer;return e=e||{},e.bg=e.bg||"#fff",n.jpg(e)}};Fg.jpeg=Fg.jpg;var id={layout:function(e){var n=this;if(e==null){yn("Layout options must be specified to make a layout");return}if(e.name==null){yn("A `name` must be specified to make a layout");return}var r=e.name,a=n.extension("layout",r);if(a==null){yn("No such layout `"+r+"` found. Did you forget to import it and `cytoscape.use()` it?");return}var i;ft(e.eles)?i=n.$(e.eles):i=e.eles!=null?e.eles:n.$();var s=new a(pt({},e,{cy:n,eles:i}));return s}};id.createLayout=id.makeLayout=id.layout;var wD={notify:function(e,n){var r=this._private;if(this.batching()){r.batchNotifications=r.batchNotifications||{};var a=r.batchNotifications[e]=r.batchNotifications[e]||this.collection();n!=null&&a.merge(n);return}if(r.notificationsEnabled){var i=this.renderer();this.destroyed()||!i||i.notify(e,n)}},notifications:function(e){var n=this._private;return e===void 0?n.notificationsEnabled:(n.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==null&&(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 n=this.renderer();Object.keys(e.batchNotifications).forEach(function(r){var a=e.batchNotifications[r];a.empty()?n.notify(r):n.notify(r,a)})}return this},batch:function(e){return this.startBatch(),e(),this.endBatch(),this},batchData:function(e){var n=this;return this.batch(function(){for(var r=Object.keys(e),a=0;a<r.length;a++){var i=r[a],s=e[i],o=n.getElementById(i);o.data(s)}})}},kD=ur({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]}),_g={renderTo:function(e,n,r,a){var i=this._private.renderer;return i.renderTo(e,n,r,a),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 n=this,r=n.extension("renderer",e.name);if(r==null){yn("Can not initialise: No such renderer `".concat(e.name,"` found. Did you forget to import it and `cytoscape.use()` it?"));return}e.wheelSensitivity!==void 0&&Jt("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 a=kD(e);a.cy=n,n._private.renderer=new r(a),this.notify("init")},destroyRenderer:function(){var e=this;e.notify("destroy");var n=e.container();if(n)for(n._cyreg=null;n.childNodes.length>0;)n.removeChild(n.childNodes[0]);e._private.renderer=null,e.mutableElements().forEach(function(r){var a=r._private;a.rscratch={},a.rstyle={},a.animation.current=[],a.animation.queue=[]})},onRender:function(e){return this.on("render",e)},offRender:function(e){return this.off("render",e)}};_g.invalidateDimensions=_g.resize;var sd={collection:function(e,n){return ft(e)?this.$(e):Xr(e)?e.collection():an(e)?(n||(n={}),new or(this,e,n.unique,n.removed)):new or(this)},nodes:function(e){var n=this.$(function(r){return r.isNode()});return e?n.filter(e):n},edges:function(e){var n=this.$(function(r){return r.isEdge()});return e?n.filter(e):n},$:function(e){var n=this._private.elements;return e?n.filter(e):n.spawnSelf()},mutableElements:function(){return this._private.elements}};sd.elements=sd.filter=sd.$;var er={},Wl="t",ED="f";er.apply=function(t){for(var e=this,n=e._private,r=n.cy,a=r.collection(),i=0;i<t.length;i++){var s=t[i],o=e.getContextMeta(s);if(!o.empty){var l=e.getContextStyle(o),u=e.applyContextStyle(o,l,s);s._private.appliedInitStyle?e.updateTransitions(s,u.diffProps):s._private.appliedInitStyle=!0;var d=e.updateStyleHints(s);d&&a.push(s)}}return a};er.getPropertiesDiff=function(t,e){var n=this,r=n._private.propDiffs=n._private.propDiffs||{},a=t+"-"+e,i=r[a];if(i)return i;for(var s=[],o={},l=0;l<n.length;l++){var u=n[l],d=t[l]===Wl,f=e[l]===Wl,h=d!==f,v=u.mappedProperties.length>0;if(h||f&&v){var p=void 0;h&&v||h?p=u.properties:v&&(p=u.mappedProperties);for(var y=0;y<p.length;y++){for(var b=p[y],m=b.name,g=!1,w=l+1;w<n.length;w++){var x=n[w],E=e[w]===Wl;if(E&&(g=x.properties[b.name]!=null,g))break}!o[m]&&!g&&(o[m]=!0,s.push(m))}}}return r[a]=s,s};er.getContextMeta=function(t){for(var e=this,n="",r,a=t._private.styleCxtKey||"",i=0;i<e.length;i++){var s=e[i],o=s.selector&&s.selector.matches(t);o?n+=Wl:n+=ED}return r=e.getPropertiesDiff(a,n),t._private.styleCxtKey=n,{key:n,diffPropNames:r,empty:r.length===0}};er.getContextStyle=function(t){var e=t.key,n=this,r=this._private.contextStyles=this._private.contextStyles||{};if(r[e])return r[e];for(var a={_private:{key:e}},i=0;i<n.length;i++){var s=n[i],o=e[i]===Wl;if(o)for(var l=0;l<s.properties.length;l++){var u=s.properties[l];a[u.name]=u}}return r[e]=a,a};er.applyContextStyle=function(t,e,n){for(var r=this,a=t.diffPropNames,i={},s=r.types,o=0;o<a.length;o++){var l=a[o],u=e[l],d=n.pstyle(l);if(!u)if(d)d.bypass?u={name:l,deleteBypassed:!0}:u={name:l,delete:!0};else continue;if(d!==u){if(u.mapped===s.fn&&d!=null&&d.mapping!=null&&d.mapping.value===u.value){var f=d.mapping,h=f.fnValue=u.value(n);if(h===f.prevFnValue)continue}var v=i[l]={prev:d};r.applyParsedProperty(n,u),v.next=n.pstyle(l),v.next&&v.next.bypass&&(v.next=v.next.bypassed)}}return{diffProps:i}};er.updateStyleHints=function(t){var e=t._private,n=this,r=n.propertyGroupNames,a=n.propertyGroupKeys,i=function(ne,de,Re){return n.getPropertiesHash(ne,de,Re)},s=e.styleKey;if(t.removed())return!1;var o=e.group==="nodes",l=t._private.style;r=Object.keys(l);for(var u=0;u<a.length;u++){var d=a[u];e.styleKeys[d]=[ys,ao]}for(var f=function(ne,de){return e.styleKeys[de][0]=bu(ne,e.styleKeys[de][0])},h=function(ne,de){return e.styleKeys[de][1]=xu(ne,e.styleKeys[de][1])},v=function(ne,de){f(ne,de),h(ne,de)},p=function(ne,de){for(var Re=0;Re<ne.length;Re++){var Ge=ne.charCodeAt(Re);f(Ge,de),h(Ge,de)}},y=2e9,b=function(ne){return-128<ne&&ne<128&&Math.floor(ne)!==ne?y-(ne*1024|0):ne},m=0;m<r.length;m++){var g=r[m],w=l[g];if(w!=null){var x=this.properties[g],E=x.type,S=x.groupKey,C=void 0;x.hashOverride!=null?C=x.hashOverride(t,w):w.pfValue!=null&&(C=w.pfValue);var T=x.enums==null?w.value:null,N=C!=null,P=T!=null,R=N||P,I=w.units;if(E.number&&R&&!E.multiple){var D=N?C:T;v(b(D),S),!N&&I!=null&&p(I,S)}else p(w.strValue,S)}}for(var $=[ys,ao],H=0;H<a.length;H++){var V=a[H],U=e.styleKeys[V];$[0]=bu(U[0],$[0]),$[1]=xu(U[1],$[1])}e.styleKey=zR($[0],$[1]);var F=e.styleKeys;e.labelDimsKey=gi(F.labelDimensions);var G=i(t,["label"],F.labelDimensions);if(e.labelKey=gi(G),e.labelStyleKey=gi(Nc(F.commonLabel,G)),!o){var z=i(t,["source-label"],F.labelDimensions);e.sourceLabelKey=gi(z),e.sourceLabelStyleKey=gi(Nc(F.commonLabel,z));var _=i(t,["target-label"],F.labelDimensions);e.targetLabelKey=gi(_),e.targetLabelStyleKey=gi(Nc(F.commonLabel,_))}if(o){var K=e.styleKeys,ie=K.nodeBody,M=K.nodeBorder,oe=K.nodeOutline,ve=K.backgroundImage,ye=K.compound,Te=K.pie,fe=K.stripe,Z=[ie,M,oe,ve,ye,Te,fe].filter(function(ee){return ee!=null}).reduce(Nc,[ys,ao]);e.nodeKey=gi(Z),e.hasPie=Te!=null&&Te[0]!==ys&&Te[1]!==ao,e.hasStripe=fe!=null&&fe[0]!==ys&&fe[1]!==ao}return s!==e.styleKey};er.clearStyleHints=function(t){var e=t._private;e.styleCxtKey="",e.styleKeys={},e.styleKey=null,e.labelKey=null,e.labelStyleKey=null,e.sourceLabelKey=null,e.sourceLabelStyleKey=null,e.targetLabelKey=null,e.targetLabelStyleKey=null,e.nodeKey=null,e.hasPie=null,e.hasStripe=null};er.applyParsedProperty=function(t,e){var n=this,r=e,a=t._private.style,i,s=n.types,o=n.properties[r.name].type,l=r.bypass,u=a[r.name],d=u&&u.bypass,f=t._private,h="mapping",v=function(ie){return ie==null?null:ie.pfValue!=null?ie.pfValue:ie.value},p=function(){var ie=v(u),M=v(r);n.checkTriggers(t,r.name,ie,M)};if(e.name==="curve-style"&&t.isEdge()&&(e.value!=="bezier"&&t.isLoop()||e.value==="haystack"&&(t.source().isParent()||t.target().isParent()))&&(r=e=this.parse(e.name,"bezier",l)),r.delete)return a[r.name]=void 0,p(),!0;if(r.deleteBypassed)return u?u.bypass?(u.bypassed=void 0,p(),!0):!1:(p(),!0);if(r.deleteBypass)return u?u.bypass?(a[r.name]=u.bypassed,p(),!0):!1:(p(),!0);var y=function(){Jt("Do not assign mappings to elements without corresponding data (i.e. ele `"+t.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 s.mapData:{for(var b=r.field.split("."),m=f.data,g=0;g<b.length&&m;g++){var w=b[g];m=m[w]}if(m==null)return y(),!1;var x;if(_e(m)){var E=r.fieldMax-r.fieldMin;E===0?x=0:x=(m-r.fieldMin)/E}else return Jt("Do not use continuous mappers without specifying numeric data (i.e. `"+r.field+": "+m+"` for `"+t.id()+"` is non-numeric)"),!1;if(x<0?x=0:x>1&&(x=1),o.color){var S=r.valueMin[0],C=r.valueMax[0],T=r.valueMin[1],N=r.valueMax[1],P=r.valueMin[2],R=r.valueMax[2],I=r.valueMin[3]==null?1:r.valueMin[3],D=r.valueMax[3]==null?1:r.valueMax[3],$=[Math.round(S+(C-S)*x),Math.round(T+(N-T)*x),Math.round(P+(R-P)*x),Math.round(I+(D-I)*x)];i={bypass:r.bypass,name:r.name,value:$,strValue:"rgb("+$[0]+", "+$[1]+", "+$[2]+")"}}else if(o.number){var H=r.valueMin+(r.valueMax-r.valueMin)*x;i=this.parse(r.name,H,r.bypass,h)}else return!1;if(!i)return y(),!1;i.mapping=r,r=i;break}case s.data:{for(var V=r.field.split("."),U=f.data,F=0;F<V.length&&U;F++){var G=V[F];U=U[G]}if(U!=null&&(i=this.parse(r.name,U,r.bypass,h)),!i)return y(),!1;i.mapping=r,r=i;break}case s.fn:{var z=r.value,_=r.fnValue!=null?r.fnValue:z(t);if(r.prevFnValue=_,_==null)return Jt("Custom function mappers may not return null (i.e. `"+r.name+"` for ele `"+t.id()+"` is null)"),!1;if(i=this.parse(r.name,_,r.bypass,h),!i)return Jt("Custom function mappers may not return invalid values for the property type (i.e. `"+r.name+"` for ele `"+t.id()+"` is invalid)"),!1;i.mapping=Oa(r),r=i;break}case void 0:break;default:return!1}return l?(d?r.bypassed=u.bypassed:r.bypassed=u,a[r.name]=r):d?u.bypassed=r:a[r.name]=r,p(),!0};er.cleanElements=function(t,e){for(var n=0;n<t.length;n++){var r=t[n];if(this.clearStyleHints(r),r.dirtyCompoundBoundsCache(),r.dirtyBoundingBoxCache(),!e)r._private.style={};else for(var a=r._private.style,i=Object.keys(a),s=0;s<i.length;s++){var o=i[s],l=a[o];l!=null&&(l.bypass?l.bypassed=null:a[o]=null)}}};er.update=function(){var t=this._private.cy,e=t.mutableElements();e.updateStyle()};er.updateTransitions=function(t,e){var n=this,r=t._private,a=t.pstyle("transition-property").value,i=t.pstyle("transition-duration").pfValue,s=t.pstyle("transition-delay").pfValue;if(a.length>0&&i>0){for(var o={},l=!1,u=0;u<a.length;u++){var d=a[u],f=t.pstyle(d),h=e[d];if(h){var v=h.prev,p=v,y=h.next!=null?h.next:f,b=!1,m=void 0,g=1e-6;p&&(_e(p.pfValue)&&_e(y.pfValue)?(b=y.pfValue-p.pfValue,m=p.pfValue+g*b):_e(p.value)&&_e(y.value)?(b=y.value-p.value,m=p.value+g*b):an(p.value)&&an(y.value)&&(b=p.value[0]!==y.value[0]||p.value[1]!==y.value[1]||p.value[2]!==y.value[2],m=p.strValue),b&&(o[d]=y.strValue,this.applyBypass(t,d,m),l=!0))}}if(!l)return;r.transitioning=!0,new nl(function(w){s>0?t.delayAnimation(s).play().promise().then(w):w()}).then(function(){return t.animation({style:o,duration:i,easing:t.pstyle("transition-timing-function").value,queue:!1}).play().promise()}).then(function(){n.removeBypasses(t,a),t.emitAndNotify("style"),r.transitioning=!1})}else r.transitioning&&(this.removeBypasses(t,a),t.emitAndNotify("style"),r.transitioning=!1)};er.checkTrigger=function(t,e,n,r,a,i){var s=this.properties[e],o=a(s);t.removed()||o!=null&&o(n,r,t)&&i(s)};er.checkZOrderTrigger=function(t,e,n,r){var a=this;this.checkTrigger(t,e,n,r,function(i){return i.triggersZOrder},function(){a._private.cy.notify("zorder",t)})};er.checkBoundsTrigger=function(t,e,n,r){this.checkTrigger(t,e,n,r,function(a){return a.triggersBounds},function(a){t.dirtyCompoundBoundsCache(),t.dirtyBoundingBoxCache()})};er.checkConnectedEdgesBoundsTrigger=function(t,e,n,r){this.checkTrigger(t,e,n,r,function(a){return a.triggersBoundsOfConnectedEdges},function(a){t.connectedEdges().forEach(function(i){i.dirtyBoundingBoxCache()})})};er.checkParallelEdgesBoundsTrigger=function(t,e,n,r){this.checkTrigger(t,e,n,r,function(a){return a.triggersBoundsOfParallelEdges},function(a){t.parallelEdges().forEach(function(i){i.dirtyBoundingBoxCache()})})};er.checkTriggers=function(t,e,n,r){t.dirtyStyleCache(),this.checkZOrderTrigger(t,e,n,r),this.checkBoundsTrigger(t,e,n,r),this.checkConnectedEdgesBoundsTrigger(t,e,n,r),this.checkParallelEdgesBoundsTrigger(t,e,n,r)};var Wu={};Wu.applyBypass=function(t,e,n,r){var a=this,i=[],s=!0;if(e==="*"||e==="**"){if(n!==void 0)for(var o=0;o<a.properties.length;o++){var l=a.properties[o],u=l.name,d=this.parse(u,n,!0);d&&i.push(d)}}else if(ft(e)){var f=this.parse(e,n,!0);f&&i.push(f)}else if(Wt(e)){var h=e;r=n;for(var v=Object.keys(h),p=0;p<v.length;p++){var y=v[p],b=h[y];if(b===void 0&&(b=h[Rf(y)]),b!==void 0){var m=this.parse(y,b,!0);m&&i.push(m)}}}else return!1;if(i.length===0)return!1;for(var g=!1,w=0;w<t.length;w++){for(var x=t[w],E={},S=void 0,C=0;C<i.length;C++){var T=i[C];if(r){var N=x.pstyle(T.name);S=E[T.name]={prev:N}}g=this.applyParsedProperty(x,Oa(T))||g,r&&(S.next=x.pstyle(T.name))}g&&this.updateStyleHints(x),r&&this.updateTransitions(x,E,s)}return g};Wu.overrideBypass=function(t,e,n){e=ty(e);for(var r=0;r<t.length;r++){var a=t[r],i=a._private.style[e],s=this.properties[e].type,o=s.color,l=s.mutiple,u=i?i.pfValue!=null?i.pfValue:i.value:null;!i||!i.bypass?this.applyBypass(a,e,n):(i.value=n,i.pfValue!=null&&(i.pfValue=n),o?i.strValue="rgb("+n.join(",")+")":l?i.strValue=n.join(" "):i.strValue=""+n,this.updateStyleHints(a)),this.checkTriggers(a,e,u,n)}};Wu.removeAllBypasses=function(t,e){return this.removeBypasses(t,this.propertyNames,e)};Wu.removeBypasses=function(t,e,n){for(var r=!0,a=0;a<t.length;a++){for(var i=t[a],s={},o=0;o<e.length;o++){var l=e[o],u=this.properties[l],d=i.pstyle(u.name);if(!(!d||!d.bypass)){var f="",h=this.parse(l,f,!0),v=s[u.name]={prev:d};this.applyParsedProperty(i,h),v.next=i.pstyle(u.name)}}this.updateStyleHints(i),n&&this.updateTransitions(i,s,r)}};var gy={};gy.getEmSizeInPixels=function(){var t=this.containerCss("font-size");return t!=null?parseFloat(t):1};gy.containerCss=function(t){var e=this._private.cy,n=e.container(),r=e.window();if(r&&n&&r.getComputedStyle)return r.getComputedStyle(n).getPropertyValue(t)};var _a={};_a.getRenderedStyle=function(t,e){return e?this.getStylePropertyValue(t,e,!0):this.getRawStyle(t,!0)};_a.getRawStyle=function(t,e){var n=this;if(t=t[0],t){for(var r={},a=0;a<n.properties.length;a++){var i=n.properties[a],s=n.getStylePropertyValue(t,i.name,e);s!=null&&(r[i.name]=s,r[Rf(i.name)]=s)}return r}};_a.getIndexedStyle=function(t,e,n,r){var a=t.pstyle(e)[n][r];return a??t.cy().style().getDefaultProperty(e)[n][0]};_a.getStylePropertyValue=function(t,e,n){var r=this;if(t=t[0],t){var a=r.properties[e];a.alias&&(a=a.pointsTo);var i=a.type,s=t.pstyle(a.name);if(s){var o=s.value,l=s.units,u=s.strValue;if(n&&i.number&&o!=null&&_e(o)){var d=t.cy().zoom(),f=function(b){return b*d},h=function(b,m){return f(b)+m},v=an(o),p=v?l.every(function(y){return y!=null}):l!=null;return p?v?o.map(function(y,b){return h(y,l[b])}).join(" "):h(o,l):v?o.map(function(y){return ft(y)?y:""+f(y)}).join(" "):""+f(o)}else if(u!=null)return u}return null}};_a.getAnimationStartStyle=function(t,e){for(var n={},r=0;r<e.length;r++){var a=e[r],i=a.name,s=t.pstyle(i);s!==void 0&&(Wt(s)?s=this.parse(i,s.strValue):s=this.parse(i,s)),s&&(n[i]=s)}return n};_a.getPropsList=function(t){var e=this,n=[],r=t,a=e.properties;if(r)for(var i=Object.keys(r),s=0;s<i.length;s++){var o=i[s],l=r[o],u=a[o]||a[ty(o)],d=this.parse(u.name,l);d&&n.push(d)}return n};_a.getNonDefaultPropertiesHash=function(t,e,n){var r=n.slice(),a,i,s,o,l,u;for(l=0;l<e.length;l++)if(a=e[l],i=t.pstyle(a,!1),i!=null)if(i.pfValue!=null)r[0]=bu(o,r[0]),r[1]=xu(o,r[1]);else for(s=i.strValue,u=0;u<s.length;u++)o=s.charCodeAt(u),r[0]=bu(o,r[0]),r[1]=xu(o,r[1]);return r};_a.getPropertiesHash=_a.getNonDefaultPropertiesHash;var Uf={};Uf.appendFromJson=function(t){for(var e=this,n=0;n<t.length;n++){var r=t[n],a=r.selector,i=r.style||r.css,s=Object.keys(i);e.selector(a);for(var o=0;o<s.length;o++){var l=s[o],u=i[l];e.css(l,u)}}return e};Uf.fromJson=function(t){var e=this;return e.resetToDefault(),e.appendFromJson(t),e};Uf.json=function(){for(var t=[],e=this.defaultLength;e<this.length;e++){for(var n=this[e],r=n.selector,a=n.properties,i={},s=0;s<a.length;s++){var o=a[s];i[o.name]=o.strValue}t.push({selector:r?r.toString():"core",style:i})}return t};var my={};my.appendFromString=function(t){var e=this,n=this,r=""+t,a,i,s;r=r.replace(/[/][*](\s|.)+?[*][/]/g,"");function o(){r.length>a.length?r=r.substr(a.length):r=""}function l(){i.length>s.length?i=i.substr(s.length):i=""}for(;;){var u=r.match(/^\s*$/);if(u)break;var d=r.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!d){Jt("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+r);break}a=d[0];var f=d[1];if(f!=="core"){var h=new Ki(f);if(h.invalid){Jt("Skipping parsing of block: Invalid selector found in string stylesheet: "+f),o();continue}}var v=d[2],p=!1;i=v;for(var y=[];;){var b=i.match(/^\s*$/);if(b)break;var m=i.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);if(!m){Jt("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+v),p=!0;break}s=m[0];var g=m[1],w=m[2],x=e.properties[g];if(!x){Jt("Skipping property: Invalid property name in: "+s),l();continue}var E=n.parse(g,w);if(!E){Jt("Skipping property: Invalid property definition in: "+s),l();continue}y.push({name:g,val:w}),l()}if(p){o();break}n.selector(f);for(var S=0;S<y.length;S++){var C=y[S];n.css(C.name,C.val)}o()}return n};my.fromString=function(t){var e=this;return e.resetToDefault(),e.appendFromString(t),e};var zn={};(function(){var t=Kn,e=gR,n=yR,r=bR,a=xR,i=function(ee){return"^"+ee+"\\s*\\(\\s*([\\w\\.]+)\\s*\\)$"},s=function(ee){var ne=t+"|\\w+|"+e+"|"+n+"|"+r+"|"+a;return"^"+ee+"\\s*\\(([\\w\\.]+)\\s*\\,\\s*("+t+")\\s*\\,\\s*("+t+")\\s*,\\s*("+ne+")\\s*\\,\\s*("+ne+")\\)$"},o=[`^url\\s*\\(\\s*['"]?(.+?)['"]?\\s*\\)$`,"^(none)$","^(.+)$"];zn.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"]},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:i("data")},layoutData:{mapping:!0,regex:i("layoutData")},scratch:{mapping:!0,regex:i("scratch")},mapData:{mapping:!0,regex:s("mapData")},mapLayoutData:{mapping:!0,regex:s("mapLayoutData")},mapScratch:{mapping:!0,regex:s("mapScratch")},fn:{mapping:!0,fn:!0},url:{regexes:o,singleRegexMatchValue:!0},urls:{regexes:o,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(ee,ne){switch(ee.length){case 2:return ne[0]!=="deg"&&ne[0]!=="rad"&&ne[1]!=="deg"&&ne[1]!=="rad";case 1:return ft(ee[0])||ne[0]==="deg"||ne[0]==="rad";default:return!1}}},easing:{regexes:["^(spring)\\s*\\(\\s*("+t+")\\s*,\\s*("+t+")\\s*\\)$","^(cubic-bezier)\\s*\\(\\s*("+t+")\\s*,\\s*("+t+")\\s*,\\s*("+t+")\\s*,\\s*("+t+")\\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"]},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(ee){var ne=ee.length;return ne===1||ne===2||ne===4}}};var l={zeroNonZero:function(ee,ne){return(ee==null||ne==null)&&ee!==ne||ee==0&&ne!=0?!0:ee!=0&&ne==0},any:function(ee,ne){return ee!=ne},emptyNonEmpty:function(ee,ne){var de=qi(ee),Re=qi(ne);return de&&!Re||!de&&Re}},u=zn.types,d=[{name:"label",type:u.text,triggersBounds:l.any,triggersZOrder:l.emptyNonEmpty},{name:"text-rotation",type:u.textRotation,triggersBounds:l.any},{name:"text-margin-x",type:u.bidirectionalSize,triggersBounds:l.any},{name:"text-margin-y",type:u.bidirectionalSize,triggersBounds:l.any}],f=[{name:"source-label",type:u.text,triggersBounds:l.any},{name:"source-text-rotation",type:u.textRotation,triggersBounds:l.any},{name:"source-text-margin-x",type:u.bidirectionalSize,triggersBounds:l.any},{name:"source-text-margin-y",type:u.bidirectionalSize,triggersBounds:l.any},{name:"source-text-offset",type:u.size,triggersBounds:l.any}],h=[{name:"target-label",type:u.text,triggersBounds:l.any},{name:"target-text-rotation",type:u.textRotation,triggersBounds:l.any},{name:"target-text-margin-x",type:u.bidirectionalSize,triggersBounds:l.any},{name:"target-text-margin-y",type:u.bidirectionalSize,triggersBounds:l.any},{name:"target-text-offset",type:u.size,triggersBounds:l.any}],v=[{name:"font-family",type:u.fontFamily,triggersBounds:l.any},{name:"font-style",type:u.fontStyle,triggersBounds:l.any},{name:"font-weight",type:u.fontWeight,triggersBounds:l.any},{name:"font-size",type:u.size,triggersBounds:l.any},{name:"text-transform",type:u.textTransform,triggersBounds:l.any},{name:"text-wrap",type:u.textWrap,triggersBounds:l.any},{name:"text-overflow-wrap",type:u.textOverflowWrap,triggersBounds:l.any},{name:"text-max-width",type:u.size,triggersBounds:l.any},{name:"text-outline-width",type:u.size,triggersBounds:l.any},{name:"line-height",type:u.positiveNumber,triggersBounds:l.any}],p=[{name:"text-valign",type:u.valign,triggersBounds:l.any},{name:"text-halign",type:u.halign,triggersBounds:l.any},{name:"color",type:u.color},{name:"text-outline-color",type:u.color},{name:"text-outline-opacity",type:u.zeroOneNumber},{name:"text-background-color",type:u.color},{name:"text-background-opacity",type:u.zeroOneNumber},{name:"text-background-padding",type:u.size,triggersBounds:l.any},{name:"text-border-opacity",type:u.zeroOneNumber},{name:"text-border-color",type:u.color},{name:"text-border-width",type:u.size,triggersBounds:l.any},{name:"text-border-style",type:u.borderStyle,triggersBounds:l.any},{name:"text-background-shape",type:u.textBackgroundShape,triggersBounds:l.any},{name:"text-justification",type:u.justification},{name:"text-metrics",type:u.textMetrics},{name:"box-select-labels",type:u.bool,triggersBounds:l.any}],y=[{name:"events",type:u.bool,triggersZOrder:l.any},{name:"text-events",type:u.bool,triggersZOrder:l.any},{name:"box-selection",type:u.boxSelection,triggersZOrder:l.any}],b=[{name:"display",type:u.display,triggersZOrder:l.any,triggersBounds:l.any,triggersBoundsOfConnectedEdges:l.any,triggersBoundsOfParallelEdges:function(ee,ne,de){return ee===ne?!1:de.pstyle("curve-style").value==="bezier"}},{name:"visibility",type:u.visibility,triggersZOrder:l.any},{name:"opacity",type:u.zeroOneNumber,triggersZOrder:l.zeroNonZero},{name:"text-opacity",type:u.zeroOneNumber},{name:"min-zoomed-font-size",type:u.size},{name:"z-compound-depth",type:u.zCompoundDepth,triggersZOrder:l.any},{name:"z-index-compare",type:u.zIndexCompare,triggersZOrder:l.any},{name:"z-index",type:u.number,triggersZOrder:l.any}],m=[{name:"overlay-padding",type:u.size,triggersBounds:l.any},{name:"overlay-color",type:u.color},{name:"overlay-opacity",type:u.zeroOneNumber,triggersBounds:l.zeroNonZero},{name:"overlay-shape",type:u.overlayShape,triggersBounds:l.any},{name:"overlay-corner-radius",type:u.cornerRadius}],g=[{name:"underlay-padding",type:u.size,triggersBounds:l.any},{name:"underlay-color",type:u.color},{name:"underlay-opacity",type:u.zeroOneNumber,triggersBounds:l.zeroNonZero},{name:"underlay-shape",type:u.overlayShape,triggersBounds:l.any},{name:"underlay-corner-radius",type:u.cornerRadius}],w=[{name:"transition-property",type:u.propList},{name:"transition-duration",type:u.time},{name:"transition-delay",type:u.time},{name:"transition-timing-function",type:u.easing}],x=function(ee,ne){return ne.value==="label"?-ee.poolIndex():ne.pfValue},E=[{name:"height",type:u.nodeSize,triggersBounds:l.any,hashOverride:x},{name:"width",type:u.nodeSize,triggersBounds:l.any,hashOverride:x},{name:"shape",type:u.nodeShape,triggersBounds:l.any},{name:"shape-polygon-points",type:u.polygonPointList,triggersBounds:l.any},{name:"corner-radius",type:u.cornerRadius},{name:"background-color",type:u.color},{name:"background-fill",type:u.fill},{name:"background-opacity",type:u.zeroOneNumber},{name:"background-blacken",type:u.nOneOneNumber},{name:"background-gradient-stop-colors",type:u.colors},{name:"background-gradient-stop-positions",type:u.percentages},{name:"background-gradient-direction",type:u.gradientDirection},{name:"padding",type:u.sizeMaybePercent,triggersBounds:l.any},{name:"padding-relative-to",type:u.paddingRelativeTo,triggersBounds:l.any},{name:"bounds-expansion",type:u.boundsExpansion,triggersBounds:l.any}],S=[{name:"border-color",type:u.color},{name:"border-opacity",type:u.zeroOneNumber},{name:"border-width",type:u.size,triggersBounds:l.any},{name:"border-style",type:u.borderStyle},{name:"border-cap",type:u.lineCap},{name:"border-join",type:u.lineJoin},{name:"border-dash-pattern",type:u.numbers},{name:"border-dash-offset",type:u.number},{name:"border-position",type:u.linePosition}],C=[{name:"outline-color",type:u.color},{name:"outline-opacity",type:u.zeroOneNumber},{name:"outline-width",type:u.size,triggersBounds:l.any},{name:"outline-style",type:u.borderStyle},{name:"outline-offset",type:u.size,triggersBounds:l.any}],T=[{name:"background-image",type:u.urls},{name:"background-image-crossorigin",type:u.bgCrossOrigin},{name:"background-image-opacity",type:u.zeroOneNumbers},{name:"background-image-containment",type:u.bgContainment},{name:"background-image-smoothing",type:u.bools},{name:"background-position-x",type:u.bgPos},{name:"background-position-y",type:u.bgPos},{name:"background-width-relative-to",type:u.bgRelativeTo},{name:"background-height-relative-to",type:u.bgRelativeTo},{name:"background-repeat",type:u.bgRepeat},{name:"background-fit",type:u.bgFit},{name:"background-clip",type:u.bgClip},{name:"background-width",type:u.bgWH},{name:"background-height",type:u.bgWH},{name:"background-offset-x",type:u.bgPos},{name:"background-offset-y",type:u.bgPos}],N=[{name:"position",type:u.position,triggersBounds:l.any},{name:"compound-sizing-wrt-labels",type:u.compoundIncludeLabels,triggersBounds:l.any},{name:"min-width",type:u.size,triggersBounds:l.any},{name:"min-width-bias-left",type:u.sizeMaybePercent,triggersBounds:l.any},{name:"min-width-bias-right",type:u.sizeMaybePercent,triggersBounds:l.any},{name:"min-height",type:u.size,triggersBounds:l.any},{name:"min-height-bias-top",type:u.sizeMaybePercent,triggersBounds:l.any},{name:"min-height-bias-bottom",type:u.sizeMaybePercent,triggersBounds:l.any}],P=[{name:"line-style",type:u.lineStyle},{name:"line-color",type:u.color},{name:"line-fill",type:u.fill},{name:"line-cap",type:u.lineCap},{name:"line-opacity",type:u.zeroOneNumber},{name:"line-dash-pattern",type:u.numbers},{name:"line-dash-offset",type:u.number},{name:"line-outline-width",type:u.size},{name:"line-outline-color",type:u.color},{name:"line-gradient-stop-colors",type:u.colors},{name:"line-gradient-stop-positions",type:u.percentages},{name:"curve-style",type:u.curveStyle,triggersBounds:l.any,triggersBoundsOfParallelEdges:function(ee,ne){return ee===ne?!1:ee==="bezier"||ne==="bezier"}},{name:"haystack-radius",type:u.zeroOneNumber,triggersBounds:l.any},{name:"source-endpoint",type:u.edgeEndpoint,triggersBounds:l.any},{name:"target-endpoint",type:u.edgeEndpoint,triggersBounds:l.any},{name:"control-point-step-size",type:u.size,triggersBounds:l.any},{name:"control-point-distances",type:u.bidirectionalSizes,triggersBounds:l.any},{name:"control-point-weights",type:u.numbers,triggersBounds:l.any},{name:"segment-distances",type:u.bidirectionalSizes,triggersBounds:l.any},{name:"segment-weights",type:u.numbers,triggersBounds:l.any},{name:"segment-radii",type:u.numbers,triggersBounds:l.any},{name:"radius-type",type:u.radiusType,triggersBounds:l.any},{name:"taxi-turn",type:u.bidirectionalSizeMaybePercent,triggersBounds:l.any},{name:"taxi-turn-min-distance",type:u.size,triggersBounds:l.any},{name:"taxi-direction",type:u.axisDirection,triggersBounds:l.any},{name:"taxi-radius",type:u.number,triggersBounds:l.any},{name:"edge-distances",type:u.edgeDistances,triggersBounds:l.any},{name:"arrow-scale",type:u.positiveNumber,triggersBounds:l.any},{name:"loop-direction",type:u.angle,triggersBounds:l.any},{name:"loop-sweep",type:u.angle,triggersBounds:l.any},{name:"source-distance-from-node",type:u.size,triggersBounds:l.any},{name:"target-distance-from-node",type:u.size,triggersBounds:l.any}],R=[{name:"ghost",type:u.bool,triggersBounds:l.any},{name:"ghost-offset-x",type:u.bidirectionalSize,triggersBounds:l.any},{name:"ghost-offset-y",type:u.bidirectionalSize,triggersBounds:l.any},{name:"ghost-opacity",type:u.zeroOneNumber}],I=[{name:"selection-box-color",type:u.color},{name:"selection-box-opacity",type:u.zeroOneNumber},{name:"selection-box-border-color",type:u.color},{name:"selection-box-border-width",type:u.size},{name:"active-bg-color",type:u.color},{name:"active-bg-opacity",type:u.zeroOneNumber},{name:"active-bg-size",type:u.size},{name:"outside-texture-bg-color",type:u.color},{name:"outside-texture-bg-opacity",type:u.zeroOneNumber}],D=[];zn.pieBackgroundN=16,D.push({name:"pie-size",type:u.sizeMaybePercent}),D.push({name:"pie-hole",type:u.sizeMaybePercent}),D.push({name:"pie-start-angle",type:u.angle});for(var $=1;$<=zn.pieBackgroundN;$++)D.push({name:"pie-"+$+"-background-color",type:u.color}),D.push({name:"pie-"+$+"-background-size",type:u.percent}),D.push({name:"pie-"+$+"-background-opacity",type:u.zeroOneNumber});var H=[];zn.stripeBackgroundN=16,H.push({name:"stripe-size",type:u.sizeMaybePercent}),H.push({name:"stripe-direction",type:u.axisDirectionPrimary});for(var V=1;V<=zn.stripeBackgroundN;V++)H.push({name:"stripe-"+V+"-background-color",type:u.color}),H.push({name:"stripe-"+V+"-background-size",type:u.percent}),H.push({name:"stripe-"+V+"-background-opacity",type:u.zeroOneNumber});var U=[],F=zn.arrowPrefixes=["source","mid-source","target","mid-target"];[{name:"arrow-shape",type:u.arrowShape,triggersBounds:l.any},{name:"arrow-color",type:u.color},{name:"arrow-fill",type:u.arrowFill},{name:"arrow-width",type:u.arrowWidth}].forEach(function(Z){F.forEach(function(ee){var ne=ee+"-"+Z.name,de=Z.type,Re=Z.triggersBounds;U.push({name:ne,type:de,triggersBounds:Re})})},{});var G=zn.properties=[].concat(y,w,b,m,g,R,p,v,d,f,h,E,S,C,T,D,H,N,P,U,I),z=zn.propertyGroups={behavior:y,transition:w,visibility:b,overlay:m,underlay:g,ghost:R,commonLabel:p,labelDimensions:v,mainLabel:d,sourceLabel:f,targetLabel:h,nodeBody:E,nodeBorder:S,nodeOutline:C,backgroundImage:T,pie:D,stripe:H,compound:N,edgeLine:P,edgeArrow:U,core:I},_=zn.propertyGroupNames={},K=zn.propertyGroupKeys=Object.keys(z);K.forEach(function(Z){_[Z]=z[Z].map(function(ee){return ee.name}),z[Z].forEach(function(ee){return ee.groupKey=Z})});var ie=zn.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"}];zn.propertyNames=G.map(function(Z){return Z.name});for(var M=0;M<G.length;M++){var oe=G[M];G[oe.name]=oe}for(var ve=0;ve<ie.length;ve++){var ye=ie[ve],Te=G[ye.pointsTo],fe={name:ye.name,alias:!0,pointsTo:Te};G.push(fe),G[ye.name]=fe}})();zn.getDefaultProperty=function(t){return this.getDefaultProperties()[t]};zn.getDefaultProperties=function(){var t=this._private;if(t.defaultProperties!=null)return t.defaultProperties;for(var e=pt({"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(l,u){for(var d=1;d<=zn.pieBackgroundN;d++){var f=u.name.replace("{{i}}",d),h=u.value;l[f]=h}return l},{}),{"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(l,u){for(var d=1;d<=zn.stripeBackgroundN;d++){var f=u.name.replace("{{i}}",d),h=u.value;l[f]=h}return l},{}),{"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(l,u){return zn.arrowPrefixes.forEach(function(d){var f=d+"-"+u.name,h=u.value;l[f]=h}),l},{})),n={},r=0;r<this.properties.length;r++){var a=this.properties[r];if(!a.pointsTo){var i=a.name,s=e[i],o=this.parse(i,s);n[i]=o}}return t.defaultProperties=n,t.defaultProperties};zn.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 qf={};qf.parse=function(t,e,n,r){var a=this;if(En(e))return a.parseImplWarn(t,e,n,r);var i=r==="mapping"||r===!0||r===!1||r==null?"dontcare":r,s=n?"t":"f",o=""+e,l=IC(t,o,s,i),u=a.propCache=a.propCache||[],d;return(d=u[l])||(d=u[l]=a.parseImplWarn(t,e,n,r)),(n||r==="mapping")&&(d=Oa(d),d&&(d.value=Oa(d.value))),d};qf.parseImplWarn=function(t,e,n,r){var a=this.parseImpl(t,e,n,r);return!a&&e!=null&&Jt("The style property `".concat(t,": ").concat(e,"` is invalid")),a&&(a.name==="width"||a.name==="height")&&e==="label"&&Jt("The style value of `label` is deprecated for `"+a.name+"`"),a};qf.parseImpl=function(t,e,n,r){var a=this;t=ty(t);var i=a.properties[t],s=e,o=a.types;if(!i||e===void 0)return null;i.alias&&(i=i.pointsTo,t=i.name);var l=ft(e);l&&(e=e.trim());var u=i.type;if(!u)return null;if(n&&(e===""||e===null))return{name:t,value:e,bypass:!0,deleteBypass:!0};if(En(e))return{name:t,value:e,strValue:"fn",mapped:o.fn,bypass:n};var d,f;if(!(!l||r||e.length<7||e[1]!=="a")){if(e.length>=7&&e[0]==="d"&&(d=new RegExp(o.data.regex).exec(e))){if(n)return!1;var h=o.data;return{name:t,value:d,strValue:""+e,mapped:h,field:d[1],bypass:n}}else if(e.length>=10&&e[0]==="m"&&(f=new RegExp(o.mapData.regex).exec(e))){if(n||u.multiple)return!1;var v=o.mapData;if(!(u.color||u.number))return!1;var p=this.parse(t,f[4]);if(!p||p.mapped)return!1;var y=this.parse(t,f[5]);if(!y||y.mapped)return!1;if(p.pfValue===y.pfValue||p.strValue===y.strValue)return Jt("`"+t+": "+e+"` is not a valid mapper because the output range is zero; converting to `"+t+": "+p.strValue+"`"),this.parse(t,p.strValue);if(u.color){var b=p.value,m=y.value,g=b[0]===m[0]&&b[1]===m[1]&&b[2]===m[2]&&(b[3]===m[3]||(b[3]==null||b[3]===1)&&(m[3]==null||m[3]===1));if(g)return!1}return{name:t,value:f,strValue:""+e,mapped:v,field:f[1],fieldMin:parseFloat(f[2]),fieldMax:parseFloat(f[3]),valueMin:p.value,valueMax:y.value,bypass:n}}}if(u.multiple&&r!=="multiple"){var w;if(l?w=e.split(/\s+/):an(e)?w=e:w=[e],u.evenMultiple&&w.length%2!==0)return null;for(var x=[],E=[],S=[],C="",T=!1,N=0;N<w.length;N++){var P=a.parse(t,w[N],n,"multiple");T=T||ft(P.value),x.push(P.value),S.push(P.pfValue!=null?P.pfValue:P.value),E.push(P.units),C+=(N>0?" ":"")+P.strValue}return u.validate&&!u.validate(x,E)?null:u.singleEnum&&T?x.length===1&&ft(x[0])?{name:t,value:x[0],strValue:x[0],bypass:n}:null:{name:t,value:x,pfValue:S,strValue:C,bypass:n,units:E}}var R=function(){for(var fe=0;fe<u.enums.length;fe++){var Z=u.enums[fe];if(Z===e)return{name:t,value:e,strValue:""+e,bypass:n}}return null};if(u.number){var I,D="px";if(u.units&&(I=u.units),u.implicitUnits&&(D=u.implicitUnits),!u.unitless)if(l){var $="px|em"+(u.allowPercent?"|\\%":"");I&&($=I);var H=e.match("^("+Kn+")("+$+")?$");H&&(e=H[1],I=H[2]||D)}else(!I||u.implicitUnits)&&(I=D);if(e=parseFloat(e),isNaN(e)&&u.enums===void 0)return null;if(isNaN(e)&&u.enums!==void 0)return e=s,R();if(u.integer&&!uR(e)||u.min!==void 0&&(e<u.min||u.strictMin&&e===u.min)||u.max!==void 0&&(e>u.max||u.strictMax&&e===u.max))return null;var V={name:t,value:e,strValue:""+e+(I||""),units:I,bypass:n};return u.unitless||I!=="px"&&I!=="em"?V.pfValue=e:V.pfValue=I==="px"||!I?e:this.getEmSizeInPixels()*e,(I==="ms"||I==="s")&&(V.pfValue=I==="ms"?e:1e3*e),(I==="deg"||I==="rad")&&(V.pfValue=I==="rad"?e:bI(e)),I==="%"&&(V.pfValue=e/100),V}else if(u.propList){var U=[],F=""+e;if(F!=="none"){for(var G=F.split(/\s*,\s*|\s+/),z=0;z<G.length;z++){var _=G[z].trim();a.properties[_]?U.push(_):Jt("`"+_+"` is not a valid property name")}if(U.length===0)return null}return{name:t,value:U,strValue:U.length===0?"none":U.join(" "),bypass:n}}else if(u.color){var K=CC(e);return K?{name:t,value:K,pfValue:K,strValue:"rgb("+K[0]+","+K[1]+","+K[2]+")",bypass:n}:null}else if(u.regex||u.regexes){if(u.enums){var ie=R();if(ie)return ie}for(var M=u.regexes?u.regexes:[u.regex],oe=0;oe<M.length;oe++){var ve=new RegExp(M[oe]),ye=ve.exec(e);if(ye)return{name:t,value:u.singleRegexMatchValue?ye[1]:ye,strValue:""+e,bypass:n}}return null}else return u.string?{name:t,value:""+e,strValue:""+e,bypass:n}:u.enums?R():null};var Jn=function(e){if(!(this instanceof Jn))return new Jn(e);if(!ey(e)){yn("A style must have a core reference");return}this._private={cy:e,coreStyle:{}},this.length=0,this.resetToDefault()},br=Jn.prototype;br.instanceString=function(){return"style"};br.clear=function(){for(var t=this._private,e=t.cy,n=e.elements(),r=0;r<this.length;r++)this[r]=void 0;return this.length=0,t.contextStyles={},t.propDiffs={},this.cleanElements(n,!0),n.forEach(function(a){var i=a[0]._private;i.styleDirty=!0,i.appliedInitStyle=!1}),this};br.resetToDefault=function(){return this.clear(),this.addDefaultStylesheet(),this};br.core=function(t){return this._private.coreStyle[t]||this.getDefaultProperty(t)};br.selector=function(t){var e=t==="core"?null:new Ki(t),n=this.length++;return this[n]={selector:e,properties:[],mappedProperties:[],index:n},this};br.css=function(){var t=this,e=arguments;if(e.length===1)for(var n=e[0],r=0;r<t.properties.length;r++){var a=t.properties[r],i=n[a.name];i===void 0&&(i=n[Rf(a.name)]),i!==void 0&&this.cssRule(a.name,i)}else e.length===2&&this.cssRule(e[0],e[1]);return this};br.style=br.css;br.cssRule=function(t,e){var n=this.parse(t,e);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);var a=!this[r].selector;a&&(this._private.coreStyle[n.name]=n)}return this};br.append=function(t){return wC(t)?t.appendToStyle(this):an(t)?this.appendFromJson(t):ft(t)&&this.appendFromString(t),this};Jn.fromJson=function(t,e){var n=new Jn(t);return n.fromJson(e),n};Jn.fromString=function(t,e){return new Jn(t).fromString(e)};[er,Wu,gy,_a,Uf,my,zn,qf].forEach(function(t){pt(br,t)});Jn.types=br.types;Jn.properties=br.properties;Jn.propertyGroups=br.propertyGroups;Jn.propertyGroupNames=br.propertyGroupNames;Jn.propertyGroupKeys=br.propertyGroupKeys;var CD={style:function(e){if(e){var n=this.setStyle(e);n.update()}return this._private.style},setStyle:function(e){var n=this._private;return wC(e)?n.style=e.generateStyle(this):an(e)?n.style=Jn.fromJson(this,e):ft(e)?n.style=Jn.fromString(this,e):n.style=Jn(this),n.style},updateStyle:function(){this.mutableElements().updateStyle()}},SD="single",Os={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 n=this._private;if(n.selectionType==null&&(n.selectionType=SD),e!==void 0)(e==="additive"||e==="single")&&(n.selectionType=e);else return n.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,n=this._private.pan,r,a,i,s,o;switch(e.length){case 0:return n;case 1:if(ft(e[0]))return r=e[0],n[r];if(Wt(e[0])){if(!this._private.panningEnabled)return this;i=e[0],s=i.x,o=i.y,_e(s)&&(n.x=s),_e(o)&&(n.y=o),this.emit("pan viewport")}break;case 2:if(!this._private.panningEnabled)return this;r=e[0],a=e[1],(r==="x"||r==="y")&&_e(a)&&(n[r]=a),this.emit("pan viewport");break}return this.notify("viewport"),this},panBy:function(e,n){var r=arguments,a=this._private.pan,i,s,o,l,u;if(!this._private.panningEnabled)return this;switch(r.length){case 1:Wt(e)&&(o=r[0],l=o.x,u=o.y,_e(l)&&(a.x+=l),_e(u)&&(a.y+=u),this.emit("pan viewport"));break;case 2:i=e,s=n,(i==="x"||i==="y")&&_e(s)&&(a[i]+=s),this.emit("pan viewport");break}return this.notify("viewport"),this},gc:function(){this.notify("gc")},fit:function(e,n){var r=this.getFitViewport(e,n);if(r){var a=this._private;a.zoom=r.zoom,a.pan=r.pan,this.emit("pan zoom viewport"),this.notify("viewport")}return this},getFitViewport:function(e,n){if(_e(e)&&n===void 0&&(n=e,e=void 0),!(!this._private.panningEnabled||!this._private.zoomingEnabled)){var r;if(ft(e)){var a=e;e=this.$(a)}else if(fR(e)){var i=e;r={x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2},r.w=r.x2-r.x1,r.h=r.y2-r.y1}else Xr(e)||(e=this.mutableElements());if(!(Xr(e)&&e.empty())){r=r||e.boundingBox();var s=this.width(),o=this.height(),l;if(n=_e(n)?n:0,!isNaN(s)&&!isNaN(o)&&s>0&&o>0&&!isNaN(r.w)&&!isNaN(r.h)&&r.w>0&&r.h>0){l=Math.min((s-2*n)/r.w,(o-2*n)/r.h),l=l>this._private.maxZoom?this._private.maxZoom:l,l=l<this._private.minZoom?this._private.minZoom:l;var u={x:(s-l*(r.x1+r.x2))/2,y:(o-l*(r.y1+r.y2))/2};return{zoom:l,pan:u}}}}},zoomRange:function(e,n){var r=this._private;if(n==null){var a=e;e=a.min,n=a.max}return _e(e)&&_e(n)&&e<=n?(r.minZoom=e,r.maxZoom=n):_e(e)&&n===void 0&&e<=r.maxZoom?r.minZoom=e:_e(n)&&e===void 0&&n>=r.minZoom&&(r.maxZoom=n),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 n=this._private,r=n.pan,a=n.zoom,i,s,o=!1;if(n.zoomingEnabled||(o=!0),_e(e)?s=e:Wt(e)&&(s=e.level,e.position!=null?i=Af(e.position,a,r):e.renderedPosition!=null&&(i=e.renderedPosition),i!=null&&!n.panningEnabled&&(o=!0)),s=s>n.maxZoom?n.maxZoom:s,s=s<n.minZoom?n.minZoom:s,o||!_e(s)||s===a||i!=null&&(!_e(i.x)||!_e(i.y)))return null;if(i!=null){var l=r,u=a,d=s,f={x:-d/u*(i.x-l.x)+i.x,y:-d/u*(i.y-l.y)+i.y};return{zoomed:!0,panned:!0,zoom:d,pan:f}}else return{zoomed:!0,panned:!1,zoom:s,pan:r}},zoom:function(e){if(e===void 0)return this._private.zoom;var n=this.getZoomedViewport(e),r=this._private;return n==null||!n.zoomed?this:(r.zoom=n.zoom,n.panned&&(r.pan.x=n.pan.x,r.pan.y=n.pan.y),this.emit("zoom"+(n.panned?" pan":"")+" viewport"),this.notify("viewport"),this)},viewport:function(e){var n=this._private,r=!0,a=!0,i=[],s=!1,o=!1;if(!e)return this;if(_e(e.zoom)||(r=!1),Wt(e.pan)||(a=!1),!r&&!a)return this;if(r){var l=e.zoom;l<n.minZoom||l>n.maxZoom||!n.zoomingEnabled?s=!0:(n.zoom=l,i.push("zoom"))}if(a&&(!s||!e.cancelOnFailedZoom)&&n.panningEnabled){var u=e.pan;_e(u.x)&&(n.pan.x=u.x,o=!1),_e(u.y)&&(n.pan.y=u.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 n=this.getCenterPan(e);return n&&(this._private.pan=n,this.emit("pan viewport"),this.notify("viewport")),this},getCenterPan:function(e,n){if(this._private.panningEnabled){if(ft(e)){var r=e;e=this.mutableElements().filter(r)}else Xr(e)||(e=this.mutableElements());if(e.length!==0){var a=e.boundingBox(),i=this.width(),s=this.height();n=n===void 0?this._private.zoom:n;var o={x:(i-n*(a.x1+a.x2))/2,y:(s-n*(a.y1+a.y2))/2};return o}}},reset:function(){return!this._private.panningEnabled||!this._private.zoomingEnabled?this:(this.viewport({pan:{x:0,y:0},zoom:1}),this)},invalidateSize:function(){this._private.sizeCache=null},size:function(){var e=this._private,n=e.container,r=this;return e.sizeCache=e.sizeCache||(n?function(){var a=r.window().getComputedStyle(n),i=function(o){return parseFloat(a.getPropertyValue(o))};return{width:n.clientWidth-i("padding-left")-i("padding-right"),height:n.clientHeight-i("padding-top")-i("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,n=this._private.zoom,r=this.renderedExtent(),a={x1:(r.x1-e.x)/n,x2:(r.x2-e.x)/n,y1:(r.y1-e.y)/n,y2:(r.y2-e.y)/n};return a.w=a.x2-a.x1,a.h=a.y2-a.y1,a},renderedExtent:function(){var e=this.width(),n=this.height();return{x1:0,y1:0,x2:e,y2:n,w:e,h:n}},multiClickDebounceTime:function(e){if(e)this._private.multiClickDebounceTime=e;else return this._private.multiClickDebounceTime;return this}};Os.centre=Os.center;Os.autolockNodes=Os.autolock;Os.autoungrabifyNodes=Os.autoungrabify;var ju={data:Zt.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeData:Zt.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),scratch:Zt.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:Zt.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0})};ju.attr=ju.data;ju.removeAttr=ju.removeData;var Tu=function(e){var n=this;e=pt({},e);var r=e.container;r&&!$d(r)&&$d(r[0])&&(r=r[0]);var a=r?r._cyreg:null;a=a||{},a&&a.cy&&(a.cy.destroy(),a={});var i=a.readies=a.readies||[];r&&(r._cyreg=a),a.cy=n;var s=qn!==void 0&&r!==void 0&&!e.headless,o=e;o.layout=pt({name:s?"grid":"null"},o.layout),o.renderer=pt({name:s?"canvas":"null"},o.renderer);var l=function(p,y,b){return y!==void 0?y:b!==void 0?b:p},u=this._private={container:r,ready:!1,options:o,elements:new or(this),listeners:[],aniEles:new or(this),data:o.data||{},scratch:{},layout:null,renderer:null,destroyed:!1,notificationsEnabled:!0,minZoom:1e-50,maxZoom:1e50,zoomingEnabled:l(!0,o.zoomingEnabled),userZoomingEnabled:l(!0,o.userZoomingEnabled),panningEnabled:l(!0,o.panningEnabled),userPanningEnabled:l(!0,o.userPanningEnabled),boxSelectionEnabled:l(!0,o.boxSelectionEnabled),autolock:l(!1,o.autolock,o.autolockNodes),autoungrabify:l(!1,o.autoungrabify,o.autoungrabifyNodes),autounselectify:l(!1,o.autounselectify),styleEnabled:o.styleEnabled===void 0?s:o.styleEnabled,zoom:_e(o.zoom)?o.zoom:1,pan:{x:Wt(o.pan)&&_e(o.pan.x)?o.pan.x:0,y:Wt(o.pan)&&_e(o.pan.y)?o.pan.y:0},animation:{current:[],queue:[]},hasCompoundNodes:!1,multiClickDebounceTime:l(250,o.multiClickDebounceTime)};this.createEmitter(),this.selectionType(o.selectionType),this.zoomRange({min:o.minZoom,max:o.maxZoom});var d=function(p,y){var b=p.some(hR);if(b)return nl.all(p).then(y);y(p)};u.styleEnabled&&n.setStyle([]);var f=pt({},o,o.renderer);n.initRenderer(f);var h=function(p,y,b){n.notifications(!1);var m=n.mutableElements();m.length>0&&m.remove(),p!=null&&(Wt(p)||an(p))&&n.add(p),n.one("layoutready",function(w){n.notifications(!0),n.emit(w),n.one("load",y),n.emitAndNotify("load")}).one("layoutstop",function(){n.one("done",b),n.emit("done")});var g=pt({},n._private.options.layout);g.eles=n.elements(),n.layout(g).run()};d([o.style,o.elements],function(v){var p=v[0],y=v[1];u.styleEnabled&&n.style().append(p),h(y,function(){n.startAnimationLoop(),u.ready=!0,En(o.ready)&&n.on("ready",o.ready);for(var b=0;b<i.length;b++){var m=i[b];n.on("ready",m)}a&&(a.readies=[]),n.emit("ready")},o.done)})},Gd=Tu.prototype;pt(Gd,{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(){var e=this._private.container;if(e==null)return qn;var n=this._private.container.ownerDocument;return n===void 0||n==null?qn:n.defaultView||qn},mount:function(e){if(e!=null){var n=this,r=n._private,a=r.options;return!$d(e)&&$d(e[0])&&(e=e[0]),n.stopAnimationLoop(),n.destroyRenderer(),r.container=e,r.styleEnabled=!0,n.invalidateSize(),n.initRenderer(pt({},a,a.renderer,{name:a.renderer.name==="null"?"canvas":a.renderer.name})),n.startAnimationLoop(),n.style(a.style),n.emit("mount"),n}},unmount:function(){var e=this;return e.stopAnimationLoop(),e.destroyRenderer(),e.initRenderer({name:"null"}),e.emit("unmount"),e},options:function(){return Oa(this._private.options)},json:function(e){var n=this,r=n._private,a=n.mutableElements(),i=function(x){return n.getElementById(x.id())};if(Wt(e)){if(n.startBatch(),e.elements){var s={},o=function(x,E){for(var S=[],C=[],T=0;T<x.length;T++){var N=x[T];if(!N.data.id){Jt("cy.json() cannot handle elements without an ID attribute");continue}var P=""+N.data.id,R=n.getElementById(P);s[P]=!0,R.length!==0?C.push({ele:R,json:N}):(E&&(N.group=E),S.push(N))}n.add(S);for(var I=0;I<C.length;I++){var D=C[I],$=D.ele,H=D.json;$.json(H)}};if(an(e.elements))o(e.elements);else for(var l=["nodes","edges"],u=0;u<l.length;u++){var d=l[u],f=e.elements[d];an(f)&&o(f,d)}var h=n.collection();a.filter(function(w){return!s[w.id()]}).forEach(function(w){w.isParent()?h.merge(w):w.remove()}),h.forEach(function(w){return w.children().move({parent:null})}),h.forEach(function(w){return i(w).remove()})}e.style&&n.style(e.style),e.zoom!=null&&e.zoom!==r.zoom&&n.zoom(e.zoom),e.pan&&(e.pan.x!==r.pan.x||e.pan.y!==r.pan.y)&&n.pan(e.pan),e.data&&n.data(e.data);for(var v=["minZoom","maxZoom","zoomingEnabled","userZoomingEnabled","panningEnabled","userPanningEnabled","boxSelectionEnabled","autolock","autoungrabify","autounselectify","multiClickDebounceTime"],p=0;p<v.length;p++){var y=v[p];e[y]!=null&&n[y](e[y])}return n.endBatch(),this}else{var b=!!e,m={};b?m.elements=this.elements().map(function(w){return w.json()}):(m.elements={},a.forEach(function(w){var x=w.group();m.elements[x]||(m.elements[x]=[]),m.elements[x].push(w.json())})),this._private.styleEnabled&&(m.style=n.style().json()),m.data=Oa(n.data());var g=r.options;return m.zoomingEnabled=r.zoomingEnabled,m.userZoomingEnabled=r.userZoomingEnabled,m.zoom=r.zoom,m.minZoom=r.minZoom,m.maxZoom=r.maxZoom,m.panningEnabled=r.panningEnabled,m.userPanningEnabled=r.userPanningEnabled,m.pan=Oa(r.pan),m.boxSelectionEnabled=r.boxSelectionEnabled,m.renderer=Oa(g.renderer),m.hideEdgesOnViewport=g.hideEdgesOnViewport,m.textureOnViewport=g.textureOnViewport,m.wheelSensitivity=g.wheelSensitivity,m.motionBlur=g.motionBlur,m.multiClickDebounceTime=g.multiClickDebounceTime,m}}});Gd.$id=Gd.getElementById;[vD,bD,wS,Fg,id,wD,_g,sd,CD,Os,ju].forEach(function(t){pt(Gd,t)});var jD={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,n){return!0},ready:void 0,stop:void 0,transform:function(e,n){return n}},TD={maximal:!1,acyclic:!1},Zs=function(e){return e.scratch("breadthfirst")},Sw=function(e,n){return e.scratch("breadthfirst",n)};function kS(t){this.options=pt({},jD,TD,t)}kS.prototype.run=function(){var t=this.options,e=t.cy,n=t.eles,r=n.nodes().filter(function(it){return it.isChildless()}),a=n,i=t.directed,s=t.acyclic||t.maximal||t.maximalAdjustments>0,o=!!t.boundingBox,l=jr(o?t.boundingBox:structuredClone(e.extent())),u;if(Xr(t.roots))u=t.roots;else if(an(t.roots)){for(var d=[],f=0;f<t.roots.length;f++){var h=t.roots[f],v=e.getElementById(h);d.push(v)}u=e.collection(d)}else if(ft(t.roots))u=e.$(t.roots);else if(i)u=r.roots();else{var p=n.components();u=e.collection();for(var y=function(){var $e=p[b],et=$e.maxDegree(!1),nt=$e.filter(function(bt){return bt.degree(!1)===et});u=u.add(nt)},b=0;b<p.length;b++)y()}var m=[],g={},w=function($e,et){m[et]==null&&(m[et]=[]);var nt=m[et].length;m[et].push($e),Sw($e,{index:nt,depth:et})},x=function($e,et){var nt=Zs($e),bt=nt.depth,ht=nt.index;m[bt][ht]=null,$e.isChildless()&&w($e,et)};a.bfs({roots:u,directed:t.directed,visit:function($e,et,nt,bt,ht){var Pt=$e[0],Bt=Pt.id();Pt.isChildless()&&w(Pt,ht),g[Bt]=!0}});for(var E=[],S=0;S<r.length;S++){var C=r[S];g[C.id()]||E.push(C)}var T=function($e){for(var et=m[$e],nt=0;nt<et.length;nt++){var bt=et[nt];if(bt==null){et.splice(nt,1),nt--;continue}Sw(bt,{depth:$e,index:nt})}},N=function($e,et){for(var nt=Zs($e),bt=$e.incomers().filter(function(pe){return pe.isNode()&&n.has(pe)}),ht=-1,Pt=$e.id(),Bt=0;Bt<bt.length;Bt++){var Kt=bt[Bt],_t=Zs(Kt);ht=Math.max(ht,_t.depth)}if(nt.depth<=ht){if(!t.acyclic&&et[Pt])return null;var Mt=ht+1;return x($e,Mt),et[Pt]=Mt,!0}return!1};if(i&&s){var P=[],R={},I=function($e){return P.push($e)},D=function(){return P.shift()};for(r.forEach(function(it){return P.push(it)});P.length>0;){var $=D(),H=N($,R);if(H)$.outgoers().filter(function(it){return it.isNode()&&n.has(it)}).forEach(I);else if(H===null){Jt("Detected double maximal shift for node `"+$.id()+"`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs.");break}}}var V=0;if(t.avoidOverlap)for(var U=0;U<r.length;U++){var F=r[U],G=F.layoutDimensions(t),z=G.w,_=G.h;V=Math.max(V,z,_)}var K={},ie=function($e){if(K[$e.id()])return K[$e.id()];for(var et=Zs($e).depth,nt=$e.neighborhood(),bt=0,ht=0,Pt=0;Pt<nt.length;Pt++){var Bt=nt[Pt];if(!(Bt.isEdge()||Bt.isParent()||!r.has(Bt))){var Kt=Zs(Bt);if(Kt!=null){var _t=Kt.index,Mt=Kt.depth;if(!(_t==null||Mt==null)){var pe=m[Mt].length;Mt<et&&(bt+=_t/pe,ht++)}}}}return ht=Math.max(1,ht),bt=bt/ht,ht===0&&(bt=0),K[$e.id()]=bt,bt},M=function($e,et){var nt=ie($e),bt=ie(et),ht=nt-bt;return ht===0?EC($e.id(),et.id()):ht};t.depthSort!==void 0&&(M=t.depthSort);for(var oe=m.length,ve=0;ve<oe;ve++)m[ve].sort(M),T(ve);for(var ye=[],Te=0;Te<E.length;Te++)ye.push(E[Te]);var fe=function(){for(var $e=0;$e<oe;$e++)T($e)};ye.length&&(m.unshift(ye),oe=m.length,fe());for(var Z=0,ee=0;ee<oe;ee++)Z=Math.max(m[ee].length,Z);var ne={x:l.x1+l.w/2,y:l.y1+l.h/2},de=r.reduce(function(it,$e){return function(et){return{w:it.w===-1?et.w:(it.w+et.w)/2,h:it.h===-1?et.h:(it.h+et.h)/2}}($e.boundingBox({includeLabels:t.nodeDimensionsIncludeLabels}))},{w:-1,h:-1}),Re=Math.max(oe===1?0:o?(l.h-t.padding*2-de.h)/(oe-1):(l.h-t.padding*2-de.h)/(oe+1),V),Ge=m.reduce(function(it,$e){return Math.max(it,$e.length)},0),Nt=function($e){var et=Zs($e),nt=et.depth,bt=et.index;if(t.circle){var ht=Math.min(l.w/2/oe,l.h/2/oe);ht=Math.max(ht,V);var Pt=ht*nt+ht-(oe>0&&m[0].length<=3?ht/2:0),Bt=2*Math.PI/m[nt].length*bt;return nt===0&&m[0].length===1&&(Pt=1),{x:ne.x+Pt*Math.cos(Bt),y:ne.y+Pt*Math.sin(Bt)}}else{var Kt=m[nt].length,_t=Math.max(Kt===1?0:o?(l.w-t.padding*2-de.w)/((t.grid?Ge:Kt)-1):(l.w-t.padding*2-de.w)/((t.grid?Ge:Kt)+1),V),Mt={x:ne.x+(bt+1-(Kt+1)/2)*_t,y:ne.y+(nt+1-(oe+1)/2)*Re};return Mt}},wt={downward:0,leftward:90,upward:180,rightward:-90};Object.keys(wt).indexOf(t.direction)===-1&&yn("Invalid direction '".concat(t.direction,"' specified for breadthfirst layout. Valid values are: ").concat(Object.keys(wt).join(", ")));var at=function($e){return VR(Nt($e),l,wt[t.direction])};return n.nodes().layoutPositions(this,t,at),this};var ND={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,n){return!0},ready:void 0,stop:void 0,transform:function(e,n){return n}};function ES(t){this.options=pt({},ND,t)}ES.prototype.run=function(){var t=this.options,e=t,n=t.cy,r=e.eles,a=e.counterclockwise!==void 0?!e.counterclockwise:e.clockwise,i=r.nodes().not(":parent");e.sort&&(i=i.sort(e.sort));for(var s=jr(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()}),o={x:s.x1+s.w/2,y:s.y1+s.h/2},l=e.sweep===void 0?2*Math.PI-2*Math.PI/i.length:e.sweep,u=l/Math.max(1,i.length-1),d,f=0,h=0;h<i.length;h++){var v=i[h],p=v.layoutDimensions(e),y=p.w,b=p.h;f=Math.max(f,y,b)}if(_e(e.radius)?d=e.radius:i.length<=1?d=0:d=Math.min(s.h,s.w)/2-f,i.length>1&&e.avoidOverlap){f*=1.75;var m=Math.cos(u)-Math.cos(0),g=Math.sin(u)-Math.sin(0),w=Math.sqrt(f*f/(m*m+g*g));d=Math.max(w,d)}var x=function(S,C){var T=e.startAngle+C*u*(a?1:-1),N=d*Math.cos(T),P=d*Math.sin(T),R={x:o.x+N,y:o.y+P};return R};return r.nodes().layoutPositions(this,e,x),this};var PD={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,n){return!0},ready:void 0,stop:void 0,transform:function(e,n){return n}};function CS(t){this.options=pt({},PD,t)}CS.prototype.run=function(){for(var t=this.options,e=t,n=e.counterclockwise!==void 0?!e.counterclockwise:e.clockwise,r=t.cy,a=e.eles,i=a.nodes().not(":parent"),s=jr(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()}),o={x:s.x1+s.w/2,y:s.y1+s.h/2},l=[],u=0,d=0;d<i.length;d++){var f=i[d],h=void 0;h=e.concentric(f),l.push({value:h,node:f}),f._private.scratch.concentric=h}i.updateStyle();for(var v=0;v<i.length;v++){var p=i[v],y=p.layoutDimensions(e);u=Math.max(u,y.w,y.h)}l.sort(function(Re,Ge){return Ge.value-Re.value});for(var b=e.levelWidth(i),m=[[]],g=m[0],w=0;w<l.length;w++){var x=l[w];if(g.length>0){var E=Math.abs(g[0].value-x.value);E>=b&&(g=[],m.push(g))}g.push(x)}var S=u+e.minNodeSpacing;if(!e.avoidOverlap){var C=m.length>0&&m[0].length>1,T=Math.min(s.w,s.h)/2-S,N=T/(m.length+C?1:0);S=Math.min(S,N)}for(var P=0,R=0;R<m.length;R++){var I=m[R],D=e.sweep===void 0?2*Math.PI-2*Math.PI/I.length:e.sweep,$=I.dTheta=D/Math.max(1,I.length-1);if(I.length>1&&e.avoidOverlap){var H=Math.cos($)-Math.cos(0),V=Math.sin($)-Math.sin(0),U=Math.sqrt(S*S/(H*H+V*V));P=Math.max(U,P)}I.r=P,P+=S}if(e.equidistant){for(var F=0,G=0,z=0;z<m.length;z++){var _=m[z],K=_.r-G;F=Math.max(F,K)}G=0;for(var ie=0;ie<m.length;ie++){var M=m[ie];ie===0&&(G=M.r),M.r=G,G+=F}}for(var oe={},ve=0;ve<m.length;ve++)for(var ye=m[ve],Te=ye.dTheta,fe=ye.r,Z=0;Z<ye.length;Z++){var ee=ye[Z],ne=e.startAngle+(n?1:-1)*Te*Z,de={x:o.x+fe*Math.cos(ne),y:o.y+fe*Math.sin(ne)};oe[ee.node.id()]=de}return a.nodes().layoutPositions(this,e,function(Re){var Ge=Re.id();return oe[Ge]}),this};var fp,RD={ready:function(){},stop:function(){},animate:!0,animationEasing:void 0,animationDuration:void 0,animateFilter:function(e,n){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 Hf(t){this.options=pt({},RD,t),this.options.layout=this;var e=this.options.eles.nodes(),n=this.options.eles.edges(),r=n.filter(function(a){var i=a.source().data("id"),s=a.target().data("id"),o=e.some(function(u){return u.data("id")===i}),l=e.some(function(u){return u.data("id")===s});return!o||!l});this.options.eles=this.options.eles.not(r)}Hf.prototype.run=function(){var t=this.options,e=t.cy,n=this;n.stopped=!1,(t.animate===!0||t.animate===!1)&&n.emit({type:"layoutstart",layout:n}),t.debug===!0?fp=!0:fp=!1;var r=ID(e,n,t);fp&&AD(r),t.randomize&&DD(r);var a=ni(),i=function(){BD(r,e,t),t.fit===!0&&e.fit(t.padding)},s=function(h){return!(n.stopped||h>=t.numIter||(MD(r,t),r.temperature=r.temperature*t.coolingFactor,r.temperature<t.minTemp))},o=function(){if(t.animate===!0||t.animate===!1)i(),n.one("layoutstop",t.stop),n.emit({type:"layoutstop",layout:n});else{var h=t.eles.nodes(),v=jS(r,t,h);h.layoutPositions(n,t,v)}},l=0,u=!0;if(t.animate===!0){var d=function(){for(var h=0;u&&h<t.refresh;)u=s(l),l++,h++;if(!u)Tw(r,t),o();else{var v=ni();v-a>=t.animationThreshold&&i(),Vd(d)}};d()}else{for(;u;)u=s(l),l++;Tw(r,t),o()}return this};Hf.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this};Hf.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var ID=function(e,n,r){for(var a=r.eles.edges(),i=r.eles.nodes(),s=jr(r.boundingBox?r.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),o={isCompound:e.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:i.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:a.size(),temperature:r.initialTemp,clientWidth:s.w,clientHeight:s.h,boundingBox:s},l=r.eles.components(),u={},d=0;d<l.length;d++)for(var f=l[d],h=0;h<f.length;h++){var v=f[h];u[v.id()]=d}for(var d=0;d<o.nodeSize;d++){var p=i[d],y=p.layoutDimensions(r),b={};b.isLocked=p.locked(),b.id=p.data("id"),b.parentId=p.data("parent"),b.cmptId=u[p.id()],b.children=[],b.positionX=p.position("x"),b.positionY=p.position("y"),b.offsetX=0,b.offsetY=0,b.height=y.w,b.width=y.h,b.maxX=b.positionX+b.width/2,b.minX=b.positionX-b.width/2,b.maxY=b.positionY+b.height/2,b.minY=b.positionY-b.height/2,b.padLeft=parseFloat(p.style("padding")),b.padRight=parseFloat(p.style("padding")),b.padTop=parseFloat(p.style("padding")),b.padBottom=parseFloat(p.style("padding")),b.nodeRepulsion=En(r.nodeRepulsion)?r.nodeRepulsion(p):r.nodeRepulsion,o.layoutNodes.push(b),o.idToIndex[b.id]=d}for(var m=[],g=0,w=-1,x=[],d=0;d<o.nodeSize;d++){var p=o.layoutNodes[d],E=p.parentId;E!=null?o.layoutNodes[o.idToIndex[E]].children.push(p.id):(m[++w]=p.id,x.push(p.id))}for(o.graphSet.push(x);g<=w;){var S=m[g++],C=o.idToIndex[S],v=o.layoutNodes[C],T=v.children;if(T.length>0){o.graphSet.push(T);for(var d=0;d<T.length;d++)m[++w]=T[d]}}for(var d=0;d<o.graphSet.length;d++)for(var N=o.graphSet[d],h=0;h<N.length;h++){var P=o.idToIndex[N[h]];o.indexToGraph[P]=d}for(var d=0;d<o.edgeSize;d++){var R=a[d],I={};I.id=R.data("id"),I.sourceId=R.data("source"),I.targetId=R.data("target");var D=En(r.idealEdgeLength)?r.idealEdgeLength(R):r.idealEdgeLength,$=En(r.edgeElasticity)?r.edgeElasticity(R):r.edgeElasticity,H=o.idToIndex[I.sourceId],V=o.idToIndex[I.targetId],U=o.indexToGraph[H],F=o.indexToGraph[V];if(U!=F){for(var G=LD(I.sourceId,I.targetId,o),z=o.graphSet[G],_=0,b=o.layoutNodes[H];z.indexOf(b.id)===-1;)b=o.layoutNodes[o.idToIndex[b.parentId]],_++;for(b=o.layoutNodes[V];z.indexOf(b.id)===-1;)b=o.layoutNodes[o.idToIndex[b.parentId]],_++;D*=_*r.nestingFactor}I.idealLength=D,I.elasticity=$,o.layoutEdges.push(I)}return o},LD=function(e,n,r){var a=SS(e,n,0,r);return 2>a.count?0:a.graph},SS=function(e,n,r,a){var i=a.graphSet[r];if(-1<i.indexOf(e)&&-1<i.indexOf(n))return{count:2,graph:r};for(var s=0,o=0;o<i.length;o++){var l=i[o],u=a.idToIndex[l],d=a.layoutNodes[u].children;if(d.length!==0){var f=a.indexToGraph[a.idToIndex[d[0]]],h=SS(e,n,f,a);if(h.count!==0)if(h.count===1){if(s++,s===2)break}else return h}}return{count:s,graph:r}},AD,DD=function(e,n){for(var r=e.clientWidth,a=e.clientHeight,i=0;i<e.nodeSize;i++){var s=e.layoutNodes[i];s.children.length===0&&!s.isLocked&&(s.positionX=Math.random()*r,s.positionY=Math.random()*a)}},jS=function(e,n,r){var a=e.boundingBox,i={x1:1/0,x2:-1/0,y1:1/0,y2:-1/0};return n.boundingBox&&(r.forEach(function(s){var o=e.layoutNodes[e.idToIndex[s.data("id")]];i.x1=Math.min(i.x1,o.positionX),i.x2=Math.max(i.x2,o.positionX),i.y1=Math.min(i.y1,o.positionY),i.y2=Math.max(i.y2,o.positionY)}),i.w=i.x2-i.x1,i.h=i.y2-i.y1),function(s,o){var l=e.layoutNodes[e.idToIndex[s.data("id")]];if(n.boundingBox){var u=i.w===0?.5:(l.positionX-i.x1)/i.w,d=i.h===0?.5:(l.positionY-i.y1)/i.h;return{x:a.x1+u*a.w,y:a.y1+d*a.h}}else return{x:l.positionX,y:l.positionY}}},BD=function(e,n,r){var a=r.layout,i=r.eles.nodes(),s=jS(e,r,i);i.positions(s),e.ready!==!0&&(e.ready=!0,a.one("layoutready",r.ready),a.emit({type:"layoutready",layout:this}))},MD=function(e,n,r){OD(e,n),_D(e),$D(e,n),VD(e),UD(e)},OD=function(e,n){for(var r=0;r<e.graphSet.length;r++)for(var a=e.graphSet[r],i=a.length,s=0;s<i;s++)for(var o=e.layoutNodes[e.idToIndex[a[s]]],l=s+1;l<i;l++){var u=e.layoutNodes[e.idToIndex[a[l]]];zD(o,u,e,n)}},jw=function(e){return-e+2*e*Math.random()},zD=function(e,n,r,a){var i=e.cmptId,s=n.cmptId;if(!(i!==s&&!r.isCompound)){var o=n.positionX-e.positionX,l=n.positionY-e.positionY,u=1;o===0&&l===0&&(o=jw(u),l=jw(u));var d=FD(e,n,o,l);if(d>0)var f=a.nodeOverlap*d,h=Math.sqrt(o*o+l*l),v=f*o/h,p=f*l/h;else var y=Yd(e,o,l),b=Yd(n,-1*o,-1*l),m=b.x-y.x,g=b.y-y.y,w=m*m+g*g,h=Math.sqrt(w),f=(e.nodeRepulsion+n.nodeRepulsion)/w,v=f*m/h,p=f*g/h;e.isLocked||(e.offsetX-=v,e.offsetY-=p),n.isLocked||(n.offsetX+=v,n.offsetY+=p)}},FD=function(e,n,r,a){if(r>0)var i=e.maxX-n.minX;else var i=n.maxX-e.minX;if(a>0)var s=e.maxY-n.minY;else var s=n.maxY-e.minY;return i>=0&&s>=0?Math.sqrt(i*i+s*s):0},Yd=function(e,n,r){var a=e.positionX,i=e.positionY,s=e.height||1,o=e.width||1,l=r/n,u=s/o,d={};return n===0&&0<r||n===0&&0>r?(d.x=a,d.y=i+s/2,d):0<n&&-1*u<=l&&l<=u?(d.x=a+o/2,d.y=i+o*r/2/n,d):0>n&&-1*u<=l&&l<=u?(d.x=a-o/2,d.y=i-o*r/2/n,d):0<r&&(l<=-1*u||l>=u)?(d.x=a+s*n/2/r,d.y=i+s/2,d):(0>r&&(l<=-1*u||l>=u)&&(d.x=a-s*n/2/r,d.y=i-s/2),d)},_D=function(e,n){for(var r=0;r<e.edgeSize;r++){var a=e.layoutEdges[r],i=e.idToIndex[a.sourceId],s=e.layoutNodes[i],o=e.idToIndex[a.targetId],l=e.layoutNodes[o],u=l.positionX-s.positionX,d=l.positionY-s.positionY;if(!(u===0&&d===0)){var f=Yd(s,u,d),h=Yd(l,-1*u,-1*d),v=h.x-f.x,p=h.y-f.y,y=Math.sqrt(v*v+p*p),b=Math.pow(a.idealLength-y,2)/a.elasticity;if(y!==0)var m=b*v/y,g=b*p/y;else var m=0,g=0;s.isLocked||(s.offsetX+=m,s.offsetY+=g),l.isLocked||(l.offsetX-=m,l.offsetY-=g)}}},$D=function(e,n){if(n.gravity!==0)for(var r=1,a=0;a<e.graphSet.length;a++){var i=e.graphSet[a],s=i.length;if(a===0)var o=e.clientHeight/2,l=e.clientWidth/2;else var u=e.layoutNodes[e.idToIndex[i[0]]],d=e.layoutNodes[e.idToIndex[u.parentId]],o=d.positionX,l=d.positionY;for(var f=0;f<s;f++){var h=e.layoutNodes[e.idToIndex[i[f]]];if(!h.isLocked){var v=o-h.positionX,p=l-h.positionY,y=Math.sqrt(v*v+p*p);if(y>r){var b=n.gravity*v/y,m=n.gravity*p/y;h.offsetX+=b,h.offsetY+=m}}}}},VD=function(e,n){var r=[],a=0,i=-1;for(r.push.apply(r,e.graphSet[0]),i+=e.graphSet[0].length;a<=i;){var s=r[a++],o=e.idToIndex[s],l=e.layoutNodes[o],u=l.children;if(0<u.length&&!l.isLocked){for(var d=l.offsetX,f=l.offsetY,h=0;h<u.length;h++){var v=e.layoutNodes[e.idToIndex[u[h]]];v.offsetX+=d,v.offsetY+=f,r[++i]=u[h]}l.offsetX=0,l.offsetY=0}}},UD=function(e,n){for(var r=0;r<e.nodeSize;r++){var a=e.layoutNodes[r];0<a.children.length&&(a.maxX=void 0,a.minX=void 0,a.maxY=void 0,a.minY=void 0)}for(var r=0;r<e.nodeSize;r++){var a=e.layoutNodes[r];if(!(0<a.children.length||a.isLocked)){var i=qD(a.offsetX,a.offsetY,e.temperature);a.positionX+=i.x,a.positionY+=i.y,a.offsetX=0,a.offsetY=0,a.minX=a.positionX-a.width,a.maxX=a.positionX+a.width,a.minY=a.positionY-a.height,a.maxY=a.positionY+a.height,TS(a,e)}}for(var r=0;r<e.nodeSize;r++){var a=e.layoutNodes[r];0<a.children.length&&!a.isLocked&&(a.positionX=(a.maxX+a.minX)/2,a.positionY=(a.maxY+a.minY)/2,a.width=a.maxX-a.minX,a.height=a.maxY-a.minY)}},qD=function(e,n,r){var a=Math.sqrt(e*e+n*n);if(a>r)var i={x:r*e/a,y:r*n/a};else var i={x:e,y:n};return i},TS=function(e,n){var r=e.parentId;if(r!=null){var a=n.layoutNodes[n.idToIndex[r]],i=!1;if((a.maxX==null||e.maxX+a.padRight>a.maxX)&&(a.maxX=e.maxX+a.padRight,i=!0),(a.minX==null||e.minX-a.padLeft<a.minX)&&(a.minX=e.minX-a.padLeft,i=!0),(a.maxY==null||e.maxY+a.padBottom>a.maxY)&&(a.maxY=e.maxY+a.padBottom,i=!0),(a.minY==null||e.minY-a.padTop<a.minY)&&(a.minY=e.minY-a.padTop,i=!0),i)return TS(a,n)}},Tw=function(e,n){for(var r=e.layoutNodes,a=[],i=0;i<r.length;i++){var s=r[i],o=s.cmptId,l=a[o]=a[o]||[];l.push(s)}for(var u=0,i=0;i<a.length;i++){var d=a[i];if(d){d.x1=1/0,d.x2=-1/0,d.y1=1/0,d.y2=-1/0;for(var f=0;f<d.length;f++){var h=d[f];d.x1=Math.min(d.x1,h.positionX-h.width/2),d.x2=Math.max(d.x2,h.positionX+h.width/2),d.y1=Math.min(d.y1,h.positionY-h.height/2),d.y2=Math.max(d.y2,h.positionY+h.height/2)}d.w=d.x2-d.x1,d.h=d.y2-d.y1,u+=d.w*d.h}}a.sort(function(g,w){return w.w*w.h-g.w*g.h});for(var v=0,p=0,y=0,b=0,m=Math.sqrt(u)*e.clientWidth/e.clientHeight,i=0;i<a.length;i++){var d=a[i];if(d){for(var f=0;f<d.length;f++){var h=d[f];h.isLocked||(h.positionX+=v-d.x1,h.positionY+=p-d.y1)}v+=d.w+n.componentSpacing,y+=d.w+n.componentSpacing,b=Math.max(b,d.h),y>m&&(p+=b+n.componentSpacing,v=0,y=0,b=0)}}},HD={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,n){return!0},ready:void 0,stop:void 0,transform:function(e,n){return n}};function NS(t){this.options=pt({},HD,t)}NS.prototype.run=function(){var t=this.options,e=t,n=t.cy,r=e.eles,a=r.nodes().not(":parent");e.sort&&(a=a.sort(e.sort));var i=jr(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()});if(i.h===0||i.w===0)r.nodes().layoutPositions(this,e,function(ie){return{x:i.x1,y:i.y1}});else{var s=a.size(),o=Math.sqrt(s*i.h/i.w),l=Math.round(o),u=Math.round(i.w/i.h*o),d=function(M){if(M==null)return Math.min(l,u);var oe=Math.min(l,u);oe==l?l=M:u=M},f=function(M){if(M==null)return Math.max(l,u);var oe=Math.max(l,u);oe==l?l=M:u=M},h=e.rows,v=e.cols!=null?e.cols:e.columns;if(h!=null&&v!=null)l=h,u=v;else if(h!=null&&v==null)l=h,u=Math.ceil(s/l);else if(h==null&&v!=null)u=v,l=Math.ceil(s/u);else if(u*l>s){var p=d(),y=f();(p-1)*y>=s?d(p-1):(y-1)*p>=s&&f(y-1)}else for(;u*l<s;){var b=d(),m=f();(m+1)*b>=s?f(m+1):d(b+1)}var g=i.w/u,w=i.h/l;if(e.condense&&(g=0,w=0),e.avoidOverlap)for(var x=0;x<a.length;x++){var E=a[x],S=E._private.position;(S.x==null||S.y==null)&&(S.x=0,S.y=0);var C=E.layoutDimensions(e),T=e.avoidOverlapPadding,N=C.w+T,P=C.h+T;g=Math.max(g,N),w=Math.max(w,P)}for(var R={},I=function(M,oe){return!!R["c-"+M+"-"+oe]},D=function(M,oe){R["c-"+M+"-"+oe]=!0},$=0,H=0,V=function(){H++,H>=u&&(H=0,$++)},U={},F=0;F<a.length;F++){var G=a[F],z=e.position(G);if(z&&(z.row!==void 0||z.col!==void 0)){var _={row:z.row,col:z.col};if(_.col===void 0)for(_.col=0;I(_.row,_.col);)_.col++;else if(_.row===void 0)for(_.row=0;I(_.row,_.col);)_.row++;U[G.id()]=_,D(_.row,_.col)}}var K=function(M,oe){var ve,ye;if(M.locked()||M.isParent())return!1;var Te=U[M.id()];if(Te)ve=Te.col*g+g/2+i.x1,ye=Te.row*w+w/2+i.y1;else{for(;I($,H);)V();ve=H*g+g/2+i.x1,ye=$*w+w/2+i.y1,D($,H),V()}return{x:ve,y:ye}};a.layoutPositions(this,e,K)}return this};var WD={ready:function(){},stop:function(){}};function yy(t){this.options=pt({},WD,t)}yy.prototype.run=function(){var t=this.options,e=t.eles,n=this;return t.cy,n.emit("layoutstart"),e.nodes().positions(function(){return{x:0,y:0}}),n.one("layoutready",t.ready),n.emit("layoutready"),n.one("layoutstop",t.stop),n.emit("layoutstop"),this};yy.prototype.stop=function(){return this};var KD={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,n){return!0},ready:void 0,stop:void 0,transform:function(e,n){return n}};function PS(t){this.options=pt({},KD,t)}PS.prototype.run=function(){var t=this.options,e=t.eles,n=e.nodes(),r=En(t.positions);function a(i){if(t.positions==null)return vI(i.position());if(r)return t.positions(i);var s=t.positions[i._private.data.id];return s??null}return n.layoutPositions(this,t,function(i,s){var o=a(i);return i.locked()||o==null?!1:o}),this};var GD={fit:!0,padding:30,boundingBox:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,n){return!0},ready:void 0,stop:void 0,transform:function(e,n){return n}};function RS(t){this.options=pt({},GD,t)}RS.prototype.run=function(){var t=this.options,e=t.cy,n=t.eles,r=jr(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),a=function(s,o){return{x:r.x1+Math.round(Math.random()*r.w),y:r.y1+Math.round(Math.random()*r.h)}};return n.nodes().layoutPositions(this,t,a),this};var YD=[{name:"breadthfirst",impl:kS},{name:"circle",impl:ES},{name:"concentric",impl:CS},{name:"cose",impl:Hf},{name:"grid",impl:NS},{name:"null",impl:yy},{name:"preset",impl:PS},{name:"random",impl:RS}];function IS(t){this.options=t,this.notifications=0}var Nw=function(){},Pw=function(){throw new Error("A headless instance can not render images")};IS.prototype={recalculateRenderedStyle:Nw,notify:function(){this.notifications++},init:Nw,isHeadless:function(){return!0},png:Pw,jpg:Pw};var by={};by.arrowShapeWidth=.3;by.registerArrowShapes=function(){var t=this.arrowShapes={},e=this,n=function(u,d,f,h,v,p,y){var b=v.x-f/2-y,m=v.x+f/2+y,g=v.y-f/2-y,w=v.y+f/2+y,x=b<=u&&u<=m&&g<=d&&d<=w;return x},r=function(u,d,f,h,v){var p=u*Math.cos(h)-d*Math.sin(h),y=u*Math.sin(h)+d*Math.cos(h),b=p*f,m=y*f,g=b+v.x,w=m+v.y;return{x:g,y:w}},a=function(u,d,f,h){for(var v=[],p=0;p<u.length;p+=2){var y=u[p],b=u[p+1];v.push(r(y,b,d,f,h))}return v},i=function(u){for(var d=[],f=0;f<u.length;f++){var h=u[f];d.push(h.x,h.y)}return d},s=function(u){return u.pstyle("width").pfValue*u.pstyle("arrow-scale").pfValue*2},o=function(u,d){ft(d)&&(d=t[d]),t[u]=pt({name:u,points:[-.15,-.3,.15,-.3,.15,.3,-.15,.3],collide:function(h,v,p,y,b,m){var g=i(a(this.points,p+2*m,y,b)),w=zr(h,v,g);return w},roughCollide:n,draw:function(h,v,p,y){var b=a(this.points,v,p,y);e.arrowShapeImpl("polygon")(h,b)},spacing:function(h){return 0},gap:s},d)};o("none",{collide:Ud,roughCollide:Ud,draw:ay,spacing:Ub,gap:Ub}),o("triangle",{points:[-.15,-.3,0,0,.15,-.3]}),o("arrow","triangle"),o("triangle-backcurve",{points:t.triangle.points,controlPoint:[0,-.15],roughCollide:n,draw:function(u,d,f,h,v){var p=a(this.points,d,f,h),y=this.controlPoint,b=r(y[0],y[1],d,f,h);e.arrowShapeImpl(this.name)(u,p,b)},gap:function(u){return s(u)*.8}}),o("triangle-tee",{points:[0,0,.15,-.3,-.15,-.3,0,0],pointsTee:[-.15,-.4,-.15,-.5,.15,-.5,.15,-.4],collide:function(u,d,f,h,v,p,y){var b=i(a(this.points,f+2*y,h,v)),m=i(a(this.pointsTee,f+2*y,h,v)),g=zr(u,d,b)||zr(u,d,m);return g},draw:function(u,d,f,h,v){var p=a(this.points,d,f,h),y=a(this.pointsTee,d,f,h);e.arrowShapeImpl(this.name)(u,p,y)}}),o("circle-triangle",{radius:.15,pointsTr:[0,-.15,.15,-.45,-.15,-.45,0,-.15],collide:function(u,d,f,h,v,p,y){var b=v,m=Math.pow(b.x-u,2)+Math.pow(b.y-d,2)<=Math.pow((f+2*y)*this.radius,2),g=i(a(this.points,f+2*y,h,v));return zr(u,d,g)||m},draw:function(u,d,f,h,v){var p=a(this.pointsTr,d,f,h);e.arrowShapeImpl(this.name)(u,p,h.x,h.y,this.radius*d)},spacing:function(u){return e.getArrowWidth(u.pstyle("width").pfValue,u.pstyle("arrow-scale").value)*this.radius}}),o("triangle-cross",{points:[0,0,.15,-.3,-.15,-.3,0,0],baseCrossLinePts:[-.15,-.4,-.15,-.4,.15,-.4,.15,-.4],crossLinePts:function(u,d){var f=this.baseCrossLinePts.slice(),h=d/u,v=3,p=5;return f[v]=f[v]-h,f[p]=f[p]-h,f},collide:function(u,d,f,h,v,p,y){var b=i(a(this.points,f+2*y,h,v)),m=i(a(this.crossLinePts(f,p),f+2*y,h,v)),g=zr(u,d,b)||zr(u,d,m);return g},draw:function(u,d,f,h,v){var p=a(this.points,d,f,h),y=a(this.crossLinePts(d,v),d,f,h);e.arrowShapeImpl(this.name)(u,p,y)}}),o("vee",{points:[-.15,-.3,0,0,.15,-.3,0,-.15],gap:function(u){return s(u)*.525}}),o("circle",{radius:.15,collide:function(u,d,f,h,v,p,y){var b=v,m=Math.pow(b.x-u,2)+Math.pow(b.y-d,2)<=Math.pow((f+2*y)*this.radius,2);return m},draw:function(u,d,f,h,v){e.arrowShapeImpl(this.name)(u,h.x,h.y,this.radius*d)},spacing:function(u){return e.getArrowWidth(u.pstyle("width").pfValue,u.pstyle("arrow-scale").value)*this.radius}}),o("tee",{points:[-.15,0,-.15,-.1,.15,-.1,.15,0],spacing:function(u){return 1},gap:function(u){return 1}}),o("square",{points:[-.15,0,.15,0,.15,-.3,-.15,-.3]}),o("diamond",{points:[-.15,-.15,0,-.3,.15,-.15,0,0],gap:function(u){return u.pstyle("width").pfValue*u.pstyle("arrow-scale").value}}),o("chevron",{points:[0,0,-.15,-.15,-.1,-.2,0,-.1,.1,-.2,.15,-.15],gap:function(u){return .95*u.pstyle("width").pfValue*u.pstyle("arrow-scale").value}})};var $s={};$s.projectIntoViewport=function(t,e){var n=this.cy,r=this.findContainerClientCoords(),a=r[0],i=r[1],s=r[4],o=n.pan(),l=n.zoom(),u=((t-a)/s-o.x)/l,d=((e-i)/s-o.y)/l;return[u,d]};$s.findContainerClientCoords=function(){if(this.containerBB)return this.containerBB;var t=this.container,e=t.getBoundingClientRect(),n=this.cy.window().getComputedStyle(t),r=function(m){return parseFloat(n.getPropertyValue(m))},a={left:r("padding-left"),right:r("padding-right"),top:r("padding-top"),bottom:r("padding-bottom")},i={left:r("border-left-width"),right:r("border-right-width"),top:r("border-top-width"),bottom:r("border-bottom-width")},s=t.clientWidth,o=t.clientHeight,l=a.left+a.right,u=a.top+a.bottom,d=i.left+i.right,f=e.width/(s+d),h=s-l,v=o-u,p=e.left+a.left+i.left,y=e.top+a.top+i.top;return this.containerBB=[p,y,h,v,f]};$s.invalidateContainerClientCoordsCache=function(){this.containerBB=null};$s.findNearestElement=function(t,e,n,r){return this.findNearestElements(t,e,n,r)[0]};$s.findNearestElements=function(t,e,n,r){var a=this,i=this,s=i.getCachedZSortedEles(),o=[],l=i.cy.zoom(),u=i.cy.hasCompoundNodes(),d=(r?24:8)/l,f=(r?8:2)/l,h=(r?8:2)/l,v=1/0,p,y;n&&(s=s.interactive);function b(C,T){if(C.isNode()){if(y)return;y=C,o.push(C)}if(C.isEdge()&&(T==null||T<v))if(p){if(p.pstyle("z-compound-depth").value===C.pstyle("z-compound-depth").value&&p.pstyle("z-compound-depth").value===C.pstyle("z-compound-depth").value){for(var N=0;N<o.length;N++)if(o[N].isEdge()){o[N]=C,p=C,v=T??v;break}}}else o.push(C),p=C,v=T??v}function m(C){var T=C.outerWidth()+2*f,N=C.outerHeight()+2*f,P=T/2,R=N/2,I=C.position(),D=C.pstyle("corner-radius").value==="auto"?"auto":C.pstyle("corner-radius").pfValue,$=C._private.rscratch;if(I.x-P<=t&&t<=I.x+P&&I.y-R<=e&&e<=I.y+R){var H=i.nodeShapes[a.getNodeShape(C)];if(H.checkPoint(t,e,0,T,N,I.x,I.y,D,$))return b(C,0),!0}}function g(C){var T=C._private,N=T.rscratch,P=C.pstyle("width").pfValue,R=C.pstyle("arrow-scale").value,I=P/2+d,D=I*I,$=I*2,F=T.source,G=T.target,H;if(N.edgeType==="segments"||N.edgeType==="straight"||N.edgeType==="haystack"){for(var V=N.allpts,U=0;U+3<V.length;U+=2)if(NI(t,e,V[U],V[U+1],V[U+2],V[U+3],$)&&D>(H=AI(t,e,V[U],V[U+1],V[U+2],V[U+3])))return b(C,H),!0}else if(N.edgeType==="bezier"||N.edgeType==="multibezier"||N.edgeType==="self"||N.edgeType==="compound"){for(var V=N.allpts,U=0;U+5<N.allpts.length;U+=4)if(PI(t,e,V[U],V[U+1],V[U+2],V[U+3],V[U+4],V[U+5],$)&&D>(H=LI(t,e,V[U],V[U+1],V[U+2],V[U+3],V[U+4],V[U+5])))return b(C,H),!0}for(var F=F||T.source,G=G||T.target,z=a.getArrowWidth(P,R),_=[{name:"source",x:N.arrowStartX,y:N.arrowStartY,angle:N.srcArrowAngle},{name:"target",x:N.arrowEndX,y:N.arrowEndY,angle:N.tgtArrowAngle},{name:"mid-source",x:N.midX,y:N.midY,angle:N.midsrcArrowAngle},{name:"mid-target",x:N.midX,y:N.midY,angle:N.midtgtArrowAngle}],U=0;U<_.length;U++){var K=_[U],ie=i.arrowShapes[C.pstyle(K.name+"-arrow-shape").value],M=C.pstyle("width").pfValue;if(ie.roughCollide(t,e,z,K.angle,{x:K.x,y:K.y},M,d)&&ie.collide(t,e,z,K.angle,{x:K.x,y:K.y},M,d))return b(C),!0}u&&o.length>0&&(m(F),m(G))}function w(C,T,N){return Cr(C,T,N)}function x(C,T){var N=C._private,P=h,R;T?R=T+"-":R="",C.boundingBox();var I=N.labelBounds[T||"main"],D=C.pstyle(R+"label").value,$=C.pstyle("text-events").strValue==="yes";if(!(!$||!D)){var H=w(N.rscratch,"labelX",T),V=w(N.rscratch,"labelY",T),U=w(N.rscratch,"labelAngle",T),F=C.pstyle(R+"text-margin-x").pfValue,G=C.pstyle(R+"text-margin-y").pfValue,z=I.x1-P-F,_=I.x2+P-F,K=I.y1-P-G,ie=I.y2+P-G;if(U){var M=Math.cos(U),oe=Math.sin(U),ve=function(de,Re){return de=de-H,Re=Re-V,{x:de*M-Re*oe+H,y:de*oe+Re*M+V}},ye=ve(z,K),Te=ve(z,ie),fe=ve(_,K),Z=ve(_,ie),ee=[ye.x+F,ye.y+G,fe.x+F,fe.y+G,Z.x+F,Z.y+G,Te.x+F,Te.y+G];if(zr(t,e,ee))return b(C),!0}else if(Ni(I,t,e))return b(C),!0}}for(var E=s.length-1;E>=0;E--){var S=s[E];S.isNode()?m(S)||x(S):g(S)||x(S)||x(S,"source")||x(S,"target")}return o};$s.getAllInBox=function(t,e,n,r){var a=this.getCachedZSortedEles().interactive,i=this.cy.zoom(),s=2/i,o=[],l=Math.min(t,n),u=Math.max(t,n),d=Math.min(e,r),f=Math.max(e,r);t=l,n=u,e=d,r=f;var h=jr({x1:t,y1:e,x2:n,y2:r}),v=[{x:h.x1,y:h.y1},{x:h.x2,y:h.y1},{x:h.x2,y:h.y2},{x:h.x1,y:h.y2}],p=[[v[0],v[1]],[v[1],v[2]],[v[2],v[3]],[v[3],v[0]]];function y(de,Re,Ge){return Cr(de,Re,Ge)}function b(de,Re){var Ge=de._private,Nt=s,wt="";de.boundingBox();var at=Ge.labelBounds.main;if(!at)return null;var it=y(Ge.rscratch,"labelX",Re),$e=y(Ge.rscratch,"labelY",Re),et=y(Ge.rscratch,"labelAngle",Re),nt=de.pstyle(wt+"text-margin-x").pfValue,bt=de.pstyle(wt+"text-margin-y").pfValue,ht=at.x1-Nt-nt,Pt=at.x2+Nt-nt,Bt=at.y1-Nt-bt,Kt=at.y2+Nt-bt;if(et){var _t=Math.cos(et),Mt=Math.sin(et),pe=function(Y,te){return Y=Y-it,te=te-$e,{x:Y*_t-te*Mt+it,y:Y*Mt+te*_t+$e}};return[pe(ht,Bt),pe(Pt,Bt),pe(Pt,Kt),pe(ht,Kt)]}else return[{x:ht,y:Bt},{x:Pt,y:Bt},{x:Pt,y:Kt},{x:ht,y:Kt}]}function m(de,Re,Ge,Nt){function wt(at,it,$e){return($e.y-at.y)*(it.x-at.x)>(it.y-at.y)*($e.x-at.x)}return wt(de,Ge,Nt)!==wt(Re,Ge,Nt)&&wt(de,Re,Ge)!==wt(de,Re,Nt)}for(var g=0;g<a.length;g++){var w=a[g];if(w.isNode()){var x=w,E=x.pstyle("text-events").strValue==="yes",S=x.pstyle("box-selection").strValue,C=x.pstyle("box-select-labels").strValue==="yes";if(S==="none")continue;var T=(S==="overlap"||C)&&E,N=x.boundingBox({includeNodes:!0,includeEdges:!1,includeLabels:T});if(S==="contain"){var P=!1;if(C&&E){var R=b(x);R&&cv(R,v)&&(o.push(x),P=!0)}!P&&zC(h,N)&&o.push(x)}else if(S==="overlap"&&ly(h,N)){var I=x.boundingBox({includeNodes:!0,includeEdges:!0,includeLabels:!1,includeMainLabels:!1,includeSourceLabels:!1,includeTargetLabels:!1}),D=[{x:I.x1,y:I.y1},{x:I.x2,y:I.y1},{x:I.x2,y:I.y2},{x:I.x1,y:I.y2}];if(cv(D,v))o.push(x);else{var $=b(x);$&&cv($,v)&&o.push(x)}}}else{var H=w,V=H._private,U=V.rscratch,F=H.pstyle("box-selection").strValue;if(F==="none")continue;if(F==="contain"){if(U.startX!=null&&U.startY!=null&&!Ni(h,U.startX,U.startY)||U.endX!=null&&U.endY!=null&&!Ni(h,U.endX,U.endY))continue;if(U.edgeType==="bezier"||U.edgeType==="multibezier"||U.edgeType==="self"||U.edgeType==="compound"||U.edgeType==="segments"||U.edgeType==="haystack"){for(var G=V.rstyle.bezierPts||V.rstyle.linePts||V.rstyle.haystackPts,z=!0,_=0;_<G.length;_++)if(!Gb(h,G[_])){z=!1;break}z&&o.push(H)}else U.edgeType==="straight"&&o.push(H)}else if(F==="overlap"){var K=!1;if(U.startX!=null&&U.startY!=null&&U.endX!=null&&U.endY!=null&&(Ni(h,U.startX,U.startY)||Ni(h,U.endX,U.endY)))o.push(H),K=!0;else if(!K&&U.edgeType==="haystack"){for(var ie=V.rstyle.haystackPts,M=0;M<ie.length;M++)if(Gb(h,ie[M])){o.push(H),K=!0;break}}if(!K){var oe=V.rstyle.bezierPts||V.rstyle.linePts||V.rstyle.haystackPts;if((!oe||oe.length<2)&&U.edgeType==="straight"&&U.startX!=null&&U.startY!=null&&U.endX!=null&&U.endY!=null&&(oe=[{x:U.startX,y:U.startY},{x:U.endX,y:U.endY}]),!oe||oe.length<2)continue;for(var ve=0;ve<oe.length-1;ve++){for(var ye=oe[ve],Te=oe[ve+1],fe=0;fe<p.length;fe++){var Z=Fn(p[fe],2),ee=Z[0],ne=Z[1];if(m(ye,Te,ee,ne)){o.push(H),K=!0;break}}if(K)break}}}}}return o};var Xd={};Xd.calculateArrowAngles=function(t){var e=t._private.rscratch,n=e.edgeType==="haystack",r=e.edgeType==="bezier",a=e.edgeType==="multibezier",i=e.edgeType==="segments",s=e.edgeType==="compound",o=e.edgeType==="self",l,u,d,f,h,v,m,g;if(n?(d=e.haystackPts[0],f=e.haystackPts[1],h=e.haystackPts[2],v=e.haystackPts[3]):(d=e.arrowStartX,f=e.arrowStartY,h=e.arrowEndX,v=e.arrowEndY),m=e.midX,g=e.midY,i)l=d-e.segpts[0],u=f-e.segpts[1];else if(a||s||o||r){var p=e.allpts,y=Xn(p[0],p[2],p[4],.1),b=Xn(p[1],p[3],p[5],.1);l=d-y,u=f-b}else l=d-m,u=f-g;e.srcArrowAngle=Pc(l,u);var m=e.midX,g=e.midY;if(n&&(m=(d+h)/2,g=(f+v)/2),l=h-d,u=v-f,i){var p=e.allpts;if(p.length/2%2===0){var w=p.length/2,x=w-2;l=p[w]-p[x],u=p[w+1]-p[x+1]}else if(e.isRound)l=e.midVector[1],u=-e.midVector[0];else{var w=p.length/2-1,x=w-2;l=p[w]-p[x],u=p[w+1]-p[x+1]}}else if(a||s||o){var p=e.allpts,E=e.ctrlpts,S,C,T,N;if(E.length/2%2===0){var P=p.length/2-1,R=P+2,I=R+2;S=Xn(p[P],p[R],p[I],0),C=Xn(p[P+1],p[R+1],p[I+1],0),T=Xn(p[P],p[R],p[I],1e-4),N=Xn(p[P+1],p[R+1],p[I+1],1e-4)}else{var R=p.length/2-1,P=R-2,I=R+2;S=Xn(p[P],p[R],p[I],.4999),C=Xn(p[P+1],p[R+1],p[I+1],.4999),T=Xn(p[P],p[R],p[I],.5),N=Xn(p[P+1],p[R+1],p[I+1],.5)}l=T-S,u=N-C}if(e.midtgtArrowAngle=Pc(l,u),e.midDispX=l,e.midDispY=u,l*=-1,u*=-1,i){var p=e.allpts;if(p.length/2%2!==0){if(!e.isRound){var w=p.length/2-1,D=w+2;l=-(p[D]-p[w]),u=-(p[D+1]-p[w+1])}}}if(e.midsrcArrowAngle=Pc(l,u),i)l=h-e.segpts[e.segpts.length-2],u=v-e.segpts[e.segpts.length-1];else if(a||s||o||r){var p=e.allpts,$=p.length,y=Xn(p[$-6],p[$-4],p[$-2],.9),b=Xn(p[$-5],p[$-3],p[$-1],.9);l=h-y,u=v-b}else l=h-m,u=v-g;e.tgtArrowAngle=Pc(l,u)};Xd.getArrowWidth=Xd.getArrowHeight=function(t,e){var n=this.arrowWidthCache=this.arrowWidthCache||{},r=n[t+", "+e];return r||(r=Math.max(Math.pow(t*13.37,.9),29)*e,n[t+", "+e]=r,r)};var $g,Vg,Aa={},aa={},Rw,Iw,bs,od,Ha,fs,ms,Ia,Js,Oc,LS,AS,Ug,qg,Lw,Aw=function(e,n,r){r.x=n.x-e.x,r.y=n.y-e.y,r.len=Math.sqrt(r.x*r.x+r.y*r.y),r.nx=r.x/r.len,r.ny=r.y/r.len,r.ang=Math.atan2(r.ny,r.nx)},XD=function(e,n){n.x=e.x*-1,n.y=e.y*-1,n.nx=e.nx*-1,n.ny=e.ny*-1,n.ang=e.ang>0?-(Math.PI-e.ang):Math.PI+e.ang},QD=function(e,n,r,a,i){if(e!==Lw?Aw(n,e,Aa):XD(aa,Aa),Aw(n,r,aa),Rw=Aa.nx*aa.ny-Aa.ny*aa.nx,Iw=Aa.nx*aa.nx-Aa.ny*-aa.ny,Ha=Math.asin(Math.max(-1,Math.min(1,Rw))),Math.abs(Ha)<1e-6){$g=n.x,Vg=n.y,ms=Js=0;return}bs=1,od=!1,Iw<0?Ha<0?Ha=Math.PI+Ha:(Ha=Math.PI-Ha,bs=-1,od=!0):Ha>0&&(bs=-1,od=!0),n.radius!==void 0?Js=n.radius:Js=a,fs=Ha/2,Oc=Math.min(Aa.len/2,aa.len/2),i?(Ia=Math.abs(Math.cos(fs)*Js/Math.sin(fs)),Ia>Oc?(Ia=Oc,ms=Math.abs(Ia*Math.sin(fs)/Math.cos(fs))):ms=Js):(Ia=Math.min(Oc,Js),ms=Math.abs(Ia*Math.sin(fs)/Math.cos(fs))),Ug=n.x+aa.nx*Ia,qg=n.y+aa.ny*Ia,$g=Ug-aa.ny*ms*bs,Vg=qg+aa.nx*ms*bs,LS=n.x+Aa.nx*Ia,AS=n.y+Aa.ny*Ia,Lw=n};function DS(t,e){e.radius===0?t.lineTo(e.cx,e.cy):t.arc(e.cx,e.cy,e.radius,e.startAngle,e.endAngle,e.counterClockwise)}function xy(t,e,n,r){var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0;return r===0||e.radius===0?{cx:e.x,cy:e.y,radius:0,startX:e.x,startY:e.y,stopX:e.x,stopY:e.y,startAngle:void 0,endAngle:void 0,counterClockwise:void 0}:(QD(t,e,n,r,a),{cx:$g,cy:Vg,radius:ms,startX:LS,startY:AS,stopX:Ug,stopY:qg,startAngle:Aa.ang+Math.PI/2*bs,endAngle:aa.ang-Math.PI/2*bs,counterClockwise:od})}var Nu=.01,ZD=Math.sqrt(2*Nu),xr={};xr.findMidptPtsEtc=function(t,e){var n=e.posPts,r=e.intersectionPts,a=e.vectorNormInverse,i,s=t.pstyle("source-endpoint"),o=t.pstyle("target-endpoint"),l=s.units!=null&&o.units!=null,u=function(E,S,C,T){var N=T-S,P=C-E,R=Math.sqrt(P*P+N*N);return{x:-N/R,y:P/R}},d=t.pstyle("edge-distances").value;switch(d){case"node-position":i=n;break;case"intersection":i=r;break;case"endpoints":{if(l){var f=this.manualEndptToPx(t.source()[0],s),h=Fn(f,2),v=h[0],p=h[1],y=this.manualEndptToPx(t.target()[0],o),b=Fn(y,2),m=b[0],g=b[1],w={x1:v,y1:p,x2:m,y2:g};a=u(v,p,m,g),i=w}else Jt("Edge ".concat(t.id()," has edge-distances:endpoints specified without manual endpoints specified via source-endpoint and target-endpoint. Falling back on edge-distances:intersection (default).")),i=r;break}}return{midptPts:i,vectorNormInverse:a}};xr.findHaystackPoints=function(t){for(var e=0;e<t.length;e++){var n=t[e],r=n._private,a=r.rscratch;if(!a.haystack){var i=Math.random()*2*Math.PI;a.source={x:Math.cos(i),y:Math.sin(i)},i=Math.random()*2*Math.PI,a.target={x:Math.cos(i),y:Math.sin(i)}}var s=r.source,o=r.target,l=s.position(),u=o.position(),d=s.width(),f=o.width(),h=s.height(),v=o.height(),p=n.pstyle("haystack-radius").value,y=p/2;a.haystackPts=a.allpts=[a.source.x*d*y+l.x,a.source.y*h*y+l.y,a.target.x*f*y+u.x,a.target.y*v*y+u.y],a.midX=(a.allpts[0]+a.allpts[2])/2,a.midY=(a.allpts[1]+a.allpts[3])/2,a.edgeType="haystack",a.haystack=!0,this.storeEdgeProjections(n),this.calculateArrowAngles(n),this.recalculateEdgeLabelProjections(n),this.calculateLabelAngles(n)}};xr.findSegmentsPoints=function(t,e){var n=t._private.rscratch,r=t.pstyle("segment-weights"),a=t.pstyle("segment-distances"),i=t.pstyle("segment-radii"),s=t.pstyle("radius-type"),o=Math.min(r.pfValue.length,a.pfValue.length),l=i.pfValue[i.pfValue.length-1],u=s.pfValue[s.pfValue.length-1];n.edgeType="segments",n.segpts=[],n.radii=[],n.isArcRadius=[];for(var d=0;d<o;d++){var f=r.pfValue[d],h=a.pfValue[d],v=1-f,p=f,y=this.findMidptPtsEtc(t,e),b=y.midptPts,m=y.vectorNormInverse,g={x:b.x1*v+b.x2*p,y:b.y1*v+b.y2*p};n.segpts.push(g.x+m.x*h,g.y+m.y*h),n.radii.push(i.pfValue[d]!==void 0?i.pfValue[d]:l),n.isArcRadius.push((s.pfValue[d]!==void 0?s.pfValue[d]:u)==="arc-radius")}};xr.findLoopPoints=function(t,e,n,r){var a=t._private.rscratch,i=e.dirCounts,s=e.srcPos,o=t.pstyle("control-point-distances"),l=o?o.pfValue[0]:void 0,u=t.pstyle("loop-direction").pfValue,d=t.pstyle("loop-sweep").pfValue,f=t.pstyle("control-point-step-size").pfValue;a.edgeType="self";var h=n,v=f;r&&(h=0,v=l);var p=u-Math.PI/2,y=p-d/2,b=p+d/2,m=u+"_"+d;h=i[m]===void 0?i[m]=0:++i[m],a.ctrlpts=[s.x+Math.cos(y)*1.4*v*(h/3+1),s.y+Math.sin(y)*1.4*v*(h/3+1),s.x+Math.cos(b)*1.4*v*(h/3+1),s.y+Math.sin(b)*1.4*v*(h/3+1)]};xr.findCompoundLoopPoints=function(t,e,n,r){var a=t._private.rscratch;a.edgeType="compound";var i=e.srcPos,s=e.tgtPos,o=e.srcW,l=e.srcH,u=e.tgtW,d=e.tgtH,f=t.pstyle("control-point-step-size").pfValue,h=t.pstyle("control-point-distances"),v=h?h.pfValue[0]:void 0,p=n,y=f;r&&(p=0,y=v);var b=50,m={x:i.x-o/2,y:i.y-l/2},g={x:s.x-u/2,y:s.y-d/2},w={x:Math.min(m.x,g.x),y:Math.min(m.y,g.y)},x=.5,E=Math.max(x,Math.log(o*Nu)),S=Math.max(x,Math.log(u*Nu));a.ctrlpts=[w.x,w.y-(1+Math.pow(b,1.12)/100)*y*(p/3+1)*E,w.x-(1+Math.pow(b,1.12)/100)*y*(p/3+1)*S,w.y]};xr.findStraightEdgePoints=function(t){t._private.rscratch.edgeType="straight"};xr.findBezierPoints=function(t,e,n,r,a){var i=t._private.rscratch,s=t.pstyle("control-point-step-size").pfValue,o=t.pstyle("control-point-distances"),l=t.pstyle("control-point-weights"),u=o&&l?Math.min(o.value.length,l.value.length):1,d=o?o.pfValue[0]:void 0,f=l.value[0],h=r;i.edgeType=h?"multibezier":"bezier",i.ctrlpts=[];for(var v=0;v<u;v++){var p=(.5-e.eles.length/2+n)*s*(a?-1:1),y=void 0,b=oy(p);h&&(d=o?o.pfValue[v]:s,f=l.value[v]),r?y=d:y=d!==void 0?b*d:void 0;var m=y!==void 0?y:p,g=1-f,w=f,x=this.findMidptPtsEtc(t,e),E=x.midptPts,S=x.vectorNormInverse,C={x:E.x1*g+E.x2*w,y:E.y1*g+E.y2*w};i.ctrlpts.push(C.x+S.x*m,C.y+S.y*m)}};xr.findTaxiPoints=function(t,e){var n=t._private.rscratch;n.edgeType="segments";var r="vertical",a="horizontal",i="leftward",s="rightward",o="downward",l="upward",u="auto",d=e.posPts,f=e.srcW,h=e.srcH,v=e.tgtW,p=e.tgtH,y=t.pstyle("edge-distances").value,b=y!=="node-position",m=t.pstyle("taxi-direction").value,g=m,w=t.pstyle("taxi-turn"),x=w.units==="%",E=w.pfValue,S=E<0,C=t.pstyle("taxi-turn-min-distance").pfValue,T=b?(f+v)/2:0,N=b?(h+p)/2:0,P=d.x2-d.x1,R=d.y2-d.y1,I=function(te,le){return te>0?Math.max(te-le,0):Math.min(te+le,0)},D=I(P,T),$=I(R,N),H=!1;g===u?m=Math.abs(D)>Math.abs($)?a:r:g===l||g===o?(m=r,H=!0):(g===i||g===s)&&(m=a,H=!0);var V=m===r,U=V?$:D,F=V?R:P,G=oy(F),z=!1;!(H&&(x||S))&&(g===o&&F<0||g===l&&F>0||g===i&&F>0||g===s&&F<0)&&(G*=-1,U=G*Math.abs(U),z=!0);var _;if(x){var K=E<0?1+E:E;_=K*U}else{var ie=E<0?U:0;_=ie+E*G}var M=function(te){return Math.abs(te)<C||Math.abs(te)>=Math.abs(U)},oe=M(_),ve=M(Math.abs(U)-Math.abs(_)),ye=oe||ve;if(ye&&!z)if(V){var Te=Math.abs(F)<=h/2,fe=Math.abs(P)<=v/2;if(Te){var Z=(d.x1+d.x2)/2,ee=d.y1,ne=d.y2;n.segpts=[Z,ee,Z,ne]}else if(fe){var de=(d.y1+d.y2)/2,Re=d.x1,Ge=d.x2;n.segpts=[Re,de,Ge,de]}else n.segpts=[d.x1,d.y2]}else{var Nt=Math.abs(F)<=f/2,wt=Math.abs(R)<=p/2;if(Nt){var at=(d.y1+d.y2)/2,it=d.x1,$e=d.x2;n.segpts=[it,at,$e,at]}else if(wt){var et=(d.x1+d.x2)/2,nt=d.y1,bt=d.y2;n.segpts=[et,nt,et,bt]}else n.segpts=[d.x2,d.y1]}else if(V){var ht=d.y1+_+(b?h/2*G:0),Pt=d.x1,Bt=d.x2;n.segpts=[Pt,ht,Bt,ht]}else{var Kt=d.x1+_+(b?f/2*G:0),_t=d.y1,Mt=d.y2;n.segpts=[Kt,_t,Kt,Mt]}if(n.isRound){var pe=t.pstyle("taxi-radius").value,B=t.pstyle("radius-type").value[0]==="arc-radius";n.radii=new Array(n.segpts.length/2).fill(pe),n.isArcRadius=new Array(n.segpts.length/2).fill(B)}};xr.tryToCorrectInvalidPoints=function(t,e){var n=t._private.rscratch;if(n.edgeType==="bezier"){var r=e.srcPos,a=e.tgtPos,i=e.srcW,s=e.srcH,o=e.tgtW,l=e.tgtH,u=e.srcShape,d=e.tgtShape,f=e.srcCornerRadius,h=e.tgtCornerRadius,v=e.srcRs,p=e.tgtRs,y=!_e(n.startX)||!_e(n.startY),b=!_e(n.arrowStartX)||!_e(n.arrowStartY),m=!_e(n.endX)||!_e(n.endY),g=!_e(n.arrowEndX)||!_e(n.arrowEndY),w=3,x=this.getArrowWidth(t.pstyle("width").pfValue,t.pstyle("arrow-scale").value)*this.arrowShapeWidth,E=w*x,S=Bs({x:n.ctrlpts[0],y:n.ctrlpts[1]},{x:n.startX,y:n.startY}),C=S<E,T=Bs({x:n.ctrlpts[0],y:n.ctrlpts[1]},{x:n.endX,y:n.endY}),N=T<E,P=!1;if(y||b||C){P=!0;var R={x:n.ctrlpts[0]-r.x,y:n.ctrlpts[1]-r.y},I=Math.sqrt(R.x*R.x+R.y*R.y),D={x:R.x/I,y:R.y/I},$=Math.max(i,s),H={x:n.ctrlpts[0]+D.x*2*$,y:n.ctrlpts[1]+D.y*2*$},V=u.intersectLine(r.x,r.y,i,s,H.x,H.y,0,f,v);C?(n.ctrlpts[0]=n.ctrlpts[0]+D.x*(E-S),n.ctrlpts[1]=n.ctrlpts[1]+D.y*(E-S)):(n.ctrlpts[0]=V[0]+D.x*E,n.ctrlpts[1]=V[1]+D.y*E)}if(m||g||N){P=!0;var U={x:n.ctrlpts[0]-a.x,y:n.ctrlpts[1]-a.y},F=Math.sqrt(U.x*U.x+U.y*U.y),G={x:U.x/F,y:U.y/F},z=Math.max(i,s),_={x:n.ctrlpts[0]+G.x*2*z,y:n.ctrlpts[1]+G.y*2*z},K=d.intersectLine(a.x,a.y,o,l,_.x,_.y,0,h,p);N?(n.ctrlpts[0]=n.ctrlpts[0]+G.x*(E-T),n.ctrlpts[1]=n.ctrlpts[1]+G.y*(E-T)):(n.ctrlpts[0]=K[0]+G.x*E,n.ctrlpts[1]=K[1]+G.y*E)}P&&this.findEndpoints(t)}};xr.storeAllpts=function(t){var e=t._private.rscratch;if(e.edgeType==="multibezier"||e.edgeType==="bezier"||e.edgeType==="self"||e.edgeType==="compound"){e.allpts=[],e.allpts.push(e.startX,e.startY);for(var n=0;n+1<e.ctrlpts.length;n+=2)e.allpts.push(e.ctrlpts[n],e.ctrlpts[n+1]),n+3<e.ctrlpts.length&&e.allpts.push((e.ctrlpts[n]+e.ctrlpts[n+2])/2,(e.ctrlpts[n+1]+e.ctrlpts[n+3])/2);e.allpts.push(e.endX,e.endY);var r,a;e.ctrlpts.length/2%2===0?(r=e.allpts.length/2-1,e.midX=e.allpts[r],e.midY=e.allpts[r+1]):(r=e.allpts.length/2-3,a=.5,e.midX=Xn(e.allpts[r],e.allpts[r+2],e.allpts[r+4],a),e.midY=Xn(e.allpts[r+1],e.allpts[r+3],e.allpts[r+5],a))}else if(e.edgeType==="straight")e.allpts=[e.startX,e.startY,e.endX,e.endY],e.midX=(e.startX+e.endX+e.arrowStartX+e.arrowEndX)/4,e.midY=(e.startY+e.endY+e.arrowStartY+e.arrowEndY)/4;else if(e.edgeType==="segments"){if(e.allpts=[],e.allpts.push(e.startX,e.startY),e.allpts.push.apply(e.allpts,e.segpts),e.allpts.push(e.endX,e.endY),e.isRound){e.roundCorners=[];for(var i=2;i+3<e.allpts.length;i+=2){var s=e.radii[i/2-1],o=e.isArcRadius[i/2-1];e.roundCorners.push(xy({x:e.allpts[i-2],y:e.allpts[i-1]},{x:e.allpts[i],y:e.allpts[i+1],radius:s},{x:e.allpts[i+2],y:e.allpts[i+3]},s,o))}}if(e.segpts.length%4===0){var l=e.segpts.length/2,u=l-2;e.midX=(e.segpts[u]+e.segpts[l])/2,e.midY=(e.segpts[u+1]+e.segpts[l+1])/2}else{var d=e.segpts.length/2-1;if(!e.isRound)e.midX=e.segpts[d],e.midY=e.segpts[d+1];else{var f={x:e.segpts[d],y:e.segpts[d+1]},h=e.roundCorners[d/2];if(h.radius===0){var v={x:e.segpts[d+2],y:e.segpts[d+3]};e.midX=f.x,e.midY=f.y,e.midVector=[f.y-v.y,v.x-f.x]}else{var p=[f.x-h.cx,f.y-h.cy],y=h.radius/Math.sqrt(Math.pow(p[0],2)+Math.pow(p[1],2));p=p.map(function(b){return b*y}),e.midX=h.cx+p[0],e.midY=h.cy+p[1],e.midVector=p}}}}};xr.checkForInvalidEdgeWarning=function(t){var e=t[0]._private.rscratch;e.nodesOverlap||_e(e.startX)&&_e(e.startY)&&_e(e.endX)&&_e(e.endY)?e.loggedErr=!1:e.loggedErr||(e.loggedErr=!0,Jt("Edge `"+t.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."))};xr.findEdgeControlPoints=function(t){var e=this;if(!(!t||t.length===0)){for(var n=this,r=n.cy,a=r.hasCompoundNodes(),i=new Xa,s=function(N,P){return[].concat(_d(N),[P?1:0]).join("-")},o=[],l=[],u=0;u<t.length;u++){var d=t[u],f=d._private,h=d.pstyle("curve-style").value;if(!(d.removed()||!d.takesUpSpace())){if(h==="haystack"){l.push(d);continue}var v=h==="unbundled-bezier"||Ti(h,"segments")||h==="straight"||h==="straight-triangle"||Ti(h,"taxi"),p=h==="unbundled-bezier"||h==="bezier",y=f.source,b=f.target,m=y.poolIndex(),g=b.poolIndex(),w=[m,g].sort(),x=s(w,v),E=i.get(x);E==null&&(E={eles:[]},o.push({pairId:w,edgeIsUnbundled:v}),i.set(x,E)),E.eles.push(d),v&&(E.hasUnbundled=!0),p&&(E.hasBezier=!0)}}for(var S=function(){var N=o[C],P=N.pairId,R=N.edgeIsUnbundled,I=s(P,R),D=i.get(I),$;if(!D.hasUnbundled){var H=D.eles[0].parallelEdges().filter(function(B){return B.isBundledBezier()});iy(D.eles),H.forEach(function(B){return D.eles.push(B)}),D.eles.sort(function(B,Y){return B.poolIndex()-Y.poolIndex()})}var V=D.eles[0],U=V.source(),F=V.target();if(U.poolIndex()>F.poolIndex()){var G=U;U=F,F=G}var z=D.srcPos=U.position(),_=D.tgtPos=F.position(),K=D.srcW=U.outerWidth(),ie=D.srcH=U.outerHeight(),M=D.tgtW=F.outerWidth(),oe=D.tgtH=F.outerHeight(),ve=D.srcShape=n.nodeShapes[e.getNodeShape(U)],ye=D.tgtShape=n.nodeShapes[e.getNodeShape(F)],Te=D.srcCornerRadius=U.pstyle("corner-radius").value==="auto"?"auto":U.pstyle("corner-radius").pfValue,fe=D.tgtCornerRadius=F.pstyle("corner-radius").value==="auto"?"auto":F.pstyle("corner-radius").pfValue,Z=D.tgtRs=F._private.rscratch,ee=D.srcRs=U._private.rscratch;D.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var ne=0;ne<D.eles.length;ne++){var de=D.eles[ne],Re=de[0]._private.rscratch,Ge=de.pstyle("curve-style").value,Nt=Ge==="unbundled-bezier"||Ti(Ge,"segments")||Ti(Ge,"taxi"),wt=!U.same(de.source());if(!D.calculatedIntersection&&U!==F&&(D.hasBezier||D.hasUnbundled)){D.calculatedIntersection=!0;var at=ve.intersectLine(z.x,z.y,K,ie,_.x,_.y,0,Te,ee),it=D.srcIntn=at,$e=ye.intersectLine(_.x,_.y,M,oe,z.x,z.y,0,fe,Z),et=D.tgtIntn=$e,nt=D.intersectionPts={x1:at[0],x2:$e[0],y1:at[1],y2:$e[1]},bt=D.posPts={x1:z.x,x2:_.x,y1:z.y,y2:_.y},ht=$e[1]-at[1],Pt=$e[0]-at[0],Bt=Math.sqrt(Pt*Pt+ht*ht);_e(Bt)&&Bt>=ZD||(Bt=Math.sqrt(Math.max(Pt*Pt,Nu)+Math.max(ht*ht,Nu)));var Kt=D.vector={x:Pt,y:ht},_t=D.vectorNorm={x:Kt.x/Bt,y:Kt.y/Bt},Mt={x:-_t.y,y:_t.x};D.nodesOverlap=!_e(Bt)||ye.checkPoint(at[0],at[1],0,M,oe,_.x,_.y,fe,Z)||ve.checkPoint($e[0],$e[1],0,K,ie,z.x,z.y,Te,ee),D.vectorNormInverse=Mt,$={nodesOverlap:D.nodesOverlap,dirCounts:D.dirCounts,calculatedIntersection:!0,hasBezier:D.hasBezier,hasUnbundled:D.hasUnbundled,eles:D.eles,srcPos:_,srcRs:Z,tgtPos:z,tgtRs:ee,srcW:M,srcH:oe,tgtW:K,tgtH:ie,srcIntn:et,tgtIntn:it,srcShape:ye,tgtShape:ve,posPts:{x1:bt.x2,y1:bt.y2,x2:bt.x1,y2:bt.y1},intersectionPts:{x1:nt.x2,y1:nt.y2,x2:nt.x1,y2:nt.y1},vector:{x:-Kt.x,y:-Kt.y},vectorNorm:{x:-_t.x,y:-_t.y},vectorNormInverse:{x:-Mt.x,y:-Mt.y}}}var pe=wt?$:D;Re.nodesOverlap=pe.nodesOverlap,Re.srcIntn=pe.srcIntn,Re.tgtIntn=pe.tgtIntn,Re.isRound=Ge.startsWith("round"),a&&(U.isParent()||U.isChild()||F.isParent()||F.isChild())&&(U.parents().anySame(F)||F.parents().anySame(U)||U.same(F)&&U.isParent())?e.findCompoundLoopPoints(de,pe,ne,Nt):U===F?e.findLoopPoints(de,pe,ne,Nt):Ge.endsWith("segments")?e.findSegmentsPoints(de,pe):Ge.endsWith("taxi")?e.findTaxiPoints(de,pe):Ge==="straight"||!Nt&&D.eles.length%2===1&&ne===Math.floor(D.eles.length/2)?e.findStraightEdgePoints(de):e.findBezierPoints(de,pe,ne,Nt,wt),e.findEndpoints(de),e.tryToCorrectInvalidPoints(de,pe),e.checkForInvalidEdgeWarning(de),e.storeAllpts(de),e.storeEdgeProjections(de),e.calculateArrowAngles(de),e.recalculateEdgeLabelProjections(de),e.calculateLabelAngles(de)}},C=0;C<o.length;C++)S();this.findHaystackPoints(l)}};function BS(t){var e=[];if(t!=null){for(var n=0;n<t.length;n+=2){var r=t[n],a=t[n+1];e.push({x:r,y:a})}return e}}xr.getSegmentPoints=function(t){var e=t[0]._private.rscratch;this.recalculateRenderedStyle(t);var n=e.edgeType;if(n==="segments")return BS(e.segpts)};xr.getControlPoints=function(t){var e=t[0]._private.rscratch;this.recalculateRenderedStyle(t);var n=e.edgeType;if(n==="bezier"||n==="multibezier"||n==="self"||n==="compound")return BS(e.ctrlpts)};xr.getEdgeMidpoint=function(t){var e=t[0]._private.rscratch;return this.recalculateRenderedStyle(t),{x:e.midX,y:e.midY}};var Ku={};Ku.manualEndptToPx=function(t,e){var n=this,r=t.position(),a=t.outerWidth(),i=t.outerHeight(),s=t._private.rscratch;if(e.value.length===2){var o=[e.pfValue[0],e.pfValue[1]];return e.units[0]==="%"&&(o[0]=o[0]*a),e.units[1]==="%"&&(o[1]=o[1]*i),o[0]+=r.x,o[1]+=r.y,o}else{var l=e.pfValue[0];l=-Math.PI/2+l;var u=2*Math.max(a,i),d=[r.x+Math.cos(l)*u,r.y+Math.sin(l)*u];return n.nodeShapes[this.getNodeShape(t)].intersectLine(r.x,r.y,a,i,d[0],d[1],0,t.pstyle("corner-radius").value==="auto"?"auto":t.pstyle("corner-radius").pfValue,s)}};Ku.findEndpoints=function(t){var e,n,r,a,i=this,s,o=t.source()[0],l=t.target()[0],u=o.position(),d=l.position(),f=t.pstyle("target-arrow-shape").value,h=t.pstyle("source-arrow-shape").value,v=t.pstyle("target-distance-from-node").pfValue,p=t.pstyle("source-distance-from-node").pfValue,y=o._private.rscratch,b=l._private.rscratch,m=t.pstyle("curve-style").value,g=t._private.rscratch,w=g.edgeType,x=Ti(m,"taxi"),E=w==="self"||w==="compound",S=w==="bezier"||w==="multibezier"||E,C=w!=="bezier",T=w==="straight"||w==="segments",N=w==="segments",P=S||C||T,R=E||x,I=t.pstyle("source-endpoint"),D=R?"outside-to-node":I.value,$=o.pstyle("corner-radius").value==="auto"?"auto":o.pstyle("corner-radius").pfValue,H=t.pstyle("target-endpoint"),V=R?"outside-to-node":H.value,U=l.pstyle("corner-radius").value==="auto"?"auto":l.pstyle("corner-radius").pfValue;g.srcManEndpt=I,g.tgtManEndpt=H;var F,G,z,_,K=(e=(H==null||(n=H.pfValue)===null||n===void 0?void 0:n.length)===2?H.pfValue:null)!==null&&e!==void 0?e:[0,0],ie=(r=(I==null||(a=I.pfValue)===null||a===void 0?void 0:a.length)===2?I.pfValue:null)!==null&&r!==void 0?r:[0,0];if(S){var M=[g.ctrlpts[0],g.ctrlpts[1]],oe=C?[g.ctrlpts[g.ctrlpts.length-2],g.ctrlpts[g.ctrlpts.length-1]]:M;F=oe,G=M}else if(T){var ve=N?g.segpts.slice(0,2):[d.x+K[0],d.y+K[1]],ye=N?g.segpts.slice(g.segpts.length-2):[u.x+ie[0],u.y+ie[1]];F=ye,G=ve}if(V==="inside-to-node")s=[d.x,d.y];else if(H.units)s=this.manualEndptToPx(l,H);else if(V==="outside-to-line")s=g.tgtIntn;else if(V==="outside-to-node"||V==="outside-to-node-or-label"?z=F:(V==="outside-to-line"||V==="outside-to-line-or-label")&&(z=[u.x,u.y]),s=i.nodeShapes[this.getNodeShape(l)].intersectLine(d.x,d.y,l.outerWidth(),l.outerHeight(),z[0],z[1],0,U,b),V==="outside-to-node-or-label"||V==="outside-to-line-or-label"){var Te=l._private.rscratch,fe=Te.labelWidth,Z=Te.labelHeight,ee=Te.labelX,ne=Te.labelY,de=fe/2,Re=Z/2,Ge=l.pstyle("text-valign").value;Ge=Go(Ge),Ge==="top"?ne-=Re:Ge==="bottom"&&(ne+=Re);var Nt=l.pstyle("text-halign").value;Nt=Ko(Nt),Nt==="left"?ee-=de:Nt==="right"&&(ee+=de);var wt=Eu(z[0],z[1],[ee-de,ne-Re,ee+de,ne-Re,ee+de,ne+Re,ee-de,ne+Re],d.x,d.y);if(wt.length>0){var at=u,it=gs(at,bo(s)),$e=gs(at,bo(wt)),et=it;if($e<it&&(s=wt,et=$e),wt.length>2){var nt=gs(at,{x:wt[2],y:wt[3]});nt<et&&(s=[wt[2],wt[3]])}}}var bt=Rc(s,F,i.arrowShapes[f].spacing(t)+v),ht=Rc(s,F,i.arrowShapes[f].gap(t)+v);if(g.endX=ht[0],g.endY=ht[1],g.arrowEndX=bt[0],g.arrowEndY=bt[1],D==="inside-to-node")s=[u.x,u.y];else if(I.units)s=this.manualEndptToPx(o,I);else if(D==="outside-to-line")s=g.srcIntn;else if(D==="outside-to-node"||D==="outside-to-node-or-label"?_=G:(D==="outside-to-line"||D==="outside-to-line-or-label")&&(_=[d.x,d.y]),s=i.nodeShapes[this.getNodeShape(o)].intersectLine(u.x,u.y,o.outerWidth(),o.outerHeight(),_[0],_[1],0,$,y),D==="outside-to-node-or-label"||D==="outside-to-line-or-label"){var Pt=o._private.rscratch,Bt=Pt.labelWidth,Kt=Pt.labelHeight,_t=Pt.labelX,Mt=Pt.labelY,pe=Bt/2,B=Kt/2,Y=o.pstyle("text-valign").value;Y=Go(Y),Y==="top"?Mt-=B:Y==="bottom"&&(Mt+=B);var te=o.pstyle("text-halign").value;te=Ko(te),te==="left"?_t-=pe:te==="right"&&(_t+=pe);var le=Eu(_[0],_[1],[_t-pe,Mt-B,_t+pe,Mt-B,_t+pe,Mt+B,_t-pe,Mt+B],u.x,u.y);if(le.length>0){var ce=d,Ye=gs(ce,bo(s)),be=gs(ce,bo(le)),Me=Ye;if(be<Ye&&(s=[le[0],le[1]],Me=be),le.length>2){var Ke=gs(ce,{x:le[2],y:le[3]});Ke<Me&&(s=[le[2],le[3]])}}}var dt=Rc(s,G,i.arrowShapes[h].spacing(t)+p),kt=Rc(s,G,i.arrowShapes[h].gap(t)+p);g.startX=kt[0],g.startY=kt[1],g.arrowStartX=dt[0],g.arrowStartY=dt[1],P&&(!_e(g.startX)||!_e(g.startY)||!_e(g.endX)||!_e(g.endY)?g.badLine=!0:g.badLine=!1)};Ku.getSourceEndpoint=function(t){var e=t[0]._private.rscratch;switch(this.recalculateRenderedStyle(t),e.edgeType){case"haystack":return{x:e.haystackPts[0],y:e.haystackPts[1]};default:return{x:e.arrowStartX,y:e.arrowStartY}}};Ku.getTargetEndpoint=function(t){var e=t[0]._private.rscratch;switch(this.recalculateRenderedStyle(t),e.edgeType){case"haystack":return{x:e.haystackPts[2],y:e.haystackPts[3]};default:return{x:e.arrowEndX,y:e.arrowEndY}}};var wy={};function JD(t,e,n){for(var r=function(u,d,f,h){return Xn(u,d,f,h)},a=e._private,i=a.rstyle.bezierPts,s=0;s<t.bezierProjPcts.length;s++){var o=t.bezierProjPcts[s];i.push({x:r(n[0],n[2],n[4],o),y:r(n[1],n[3],n[5],o)})}}wy.storeEdgeProjections=function(t){var e=t._private,n=e.rscratch,r=n.edgeType;if(e.rstyle.bezierPts=null,e.rstyle.linePts=null,e.rstyle.haystackPts=null,r==="multibezier"||r==="bezier"||r==="self"||r==="compound"){e.rstyle.bezierPts=[];for(var a=0;a+5<n.allpts.length;a+=4)JD(this,t,n.allpts.slice(a,a+6))}else if(r==="segments")for(var i=e.rstyle.linePts=[],a=0;a+1<n.allpts.length;a+=2)i.push({x:n.allpts[a],y:n.allpts[a+1]});else if(r==="haystack"){var s=n.haystackPts;e.rstyle.haystackPts=[{x:s[0],y:s[1]},{x:s[2],y:s[3]}]}e.rstyle.arrowWidth=this.getArrowWidth(t.pstyle("width").pfValue,t.pstyle("arrow-scale").value)*this.arrowShapeWidth};wy.recalculateEdgeProjections=function(t){this.findEdgeControlPoints(t)};var $a={};$a.recalculateNodeLabelProjection=function(t){var e=t.pstyle("label").strValue;if(!qi(e)){var n,r,a=t._private,i=t.width(),s=t.height(),o=t.padding(),l=t.position(),u=t.pstyle("text-halign").strValue,d=t.pstyle("text-valign").strValue,f=a.rscratch,h=a.rstyle;switch(u){case"left":n=l.x-i/2-o;break;case"left-inside":n=l.x-i/2+o;break;case"right":n=l.x+i/2+o;break;case"right-inside":n=l.x+i/2-o;break;default:n=l.x}switch(d){case"top":r=l.y-s/2-o;break;case"top-inside":r=l.y-s/2+o;break;case"bottom":r=l.y+s/2+o;break;case"bottom-inside":r=l.y+s/2-o;break;default:r=l.y}f.labelX=n,f.labelY=r,h.labelX=n,h.labelY=r,this.calculateLabelAngles(t),this.applyLabelDimensions(t)}};var MS=function(e,n){var r=Math.atan(n/e);return e===0&&r<0&&(r=r*-1),r},OS=function(e,n){var r=n.x-e.x,a=n.y-e.y;return MS(r,a)},eB=function(e,n,r,a){var i=ku(0,a-.001,1),s=ku(0,a+.001,1),o=Ro(e,n,r,i),l=Ro(e,n,r,s);return OS(o,l)};$a.recalculateEdgeLabelProjections=function(t){var e,n=t._private,r=n.rscratch,a=this,i={mid:t.pstyle("label").strValue,source:t.pstyle("source-label").strValue,target:t.pstyle("target-label").strValue};if(i.mid||i.source||i.target){e={x:r.midX,y:r.midY};var s=function(f,h,v){Ba(n.rscratch,f,h,v),Ba(n.rstyle,f,h,v)};s("labelX",null,e.x),s("labelY",null,e.y);var o=MS(r.midDispX,r.midDispY);s("labelAutoAngle",null,o);var l=function(){if(l.cache)return l.cache;for(var f=[],h=0;h+5<r.allpts.length;h+=4){var v={x:r.allpts[h],y:r.allpts[h+1]},p={x:r.allpts[h+2],y:r.allpts[h+3]},y={x:r.allpts[h+4],y:r.allpts[h+5]};f.push({p0:v,p1:p,p2:y,startDist:0,length:0,segments:[]})}var b=n.rstyle.bezierPts,m=a.bezierProjPcts.length;function g(C,T,N,P,R){var I=Bs(T,N),D=C.segments[C.segments.length-1],$={p0:T,p1:N,t0:P,t1:R,startDist:D?D.startDist+D.length:0,length:I};C.segments.push($),C.length+=I}for(var w=0;w<f.length;w++){var x=f[w],E=f[w-1];E&&(x.startDist=E.startDist+E.length),g(x,x.p0,b[w*m],0,a.bezierProjPcts[0]);for(var S=0;S<m-1;S++)g(x,b[w*m+S],b[w*m+S+1],a.bezierProjPcts[S],a.bezierProjPcts[S+1]);g(x,b[w*m+m-1],x.p2,a.bezierProjPcts[m-1],1)}return l.cache=f},u=function(f){var h,v=f==="source";if(i[f]){var p=t.pstyle(f+"-text-offset").pfValue;switch(r.edgeType){case"self":case"compound":case"bezier":case"multibezier":{for(var y=l(),b,m=0,g=0,w=0;w<y.length;w++){for(var x=y[v?w:y.length-1-w],E=0;E<x.segments.length;E++){var S=x.segments[v?E:x.segments.length-1-E],C=w===y.length-1&&E===x.segments.length-1;if(m=g,g+=S.length,g>=p||C){b={cp:x,segment:S};break}}if(b)break}var T=b.cp,N=b.segment,P=(p-m)/N.length,R=N.t1-N.t0,I=v?N.t0+R*P:N.t1-R*P;I=ku(0,I,1),e=Ro(T.p0,T.p1,T.p2,I),h=eB(T.p0,T.p1,T.p2,I);break}case"straight":case"segments":case"haystack":{for(var D=0,$,H,V,U,F=r.allpts.length,G=0;G+3<F&&(v?(V={x:r.allpts[G],y:r.allpts[G+1]},U={x:r.allpts[G+2],y:r.allpts[G+3]}):(V={x:r.allpts[F-2-G],y:r.allpts[F-1-G]},U={x:r.allpts[F-4-G],y:r.allpts[F-3-G]}),$=Bs(V,U),H=D,D+=$,!(D>=p));G+=2);var z=p-H,_=z/$;_=ku(0,_,1),e=wI(V,U,_),h=OS(V,U);break}}s("labelX",f,e.x),s("labelY",f,e.y),s("labelAutoAngle",f,h)}};u("source"),u("target"),this.applyLabelDimensions(t)}};$a.applyLabelDimensions=function(t){this.applyPrefixedLabelDimensions(t),t.isEdge()&&(this.applyPrefixedLabelDimensions(t,"source"),this.applyPrefixedLabelDimensions(t,"target"))};$a.applyPrefixedLabelDimensions=function(t,e){var n=t._private,r=this.getLabelText(t,e),a=Ds(r,t._private.labelDimsKey);if(Cr(n.rscratch,"prefixedLabelDimsKey",e)!==a){Ba(n.rscratch,"prefixedLabelDimsKey",e,a);var i=this.calculateLabelDimensions(t,r),s=t.pstyle("line-height").pfValue,o=t.pstyle("font-size").pfValue,l=t.pstyle("text-wrap").strValue,u=Cr(n.rscratch,"labelWrapCachedLines",e)||[],d=l!=="wrap"?1:Math.max(u.length,1),f=o*s,h=i.width,v=i.height+(d-1)*(s-1)*o;Ba(n.rstyle,"labelWidth",e,h),Ba(n.rscratch,"labelWidth",e,h),Ba(n.rstyle,"labelHeight",e,v),Ba(n.rscratch,"labelHeight",e,v),Ba(n.rscratch,"labelLineHeight",e,f),Ba(n.rscratch,"labelActualDescent",e,i.labelActualDescent)}};$a.getLabelText=function(t,e){var n=t._private,r=e?e+"-":"",a=t.pstyle(r+"label").strValue,i=t.pstyle("text-transform").value,s=function(ie,M){return M?(Ba(n.rscratch,ie,e,M),M):Cr(n.rscratch,ie,e)};if(!a)return"";i=="none"||(i=="uppercase"?a=a.toUpperCase():i=="lowercase"&&(a=a.toLowerCase()));var o=t.pstyle("text-wrap").value;if(o==="wrap"){var l=s("labelKey");if(l!=null&&s("labelWrapKey")===l)return s("labelWrapCachedText");for(var u="",d=a.split(`
|
|
87
|
+
`),f=t.pstyle("text-max-width").pfValue,h=t.pstyle("text-overflow-wrap").value,v=h==="anywhere",p=[],y=/[\s\u200b]+|$/g,b=0;b<d.length;b++){var m=d[b],g=this.calculateLabelDimensions(t,m),w=g.width;if(v){var x=m.split("").join(u);m=x}if(w>f){var E=m.matchAll(y),S="",C=0,T=_r(E),N;try{for(T.s();!(N=T.n()).done;){var P=N.value,R=P[0],I=m.substring(C,P.index);C=P.index+R.length;var D=S.length===0?I:S+I+R,$=this.calculateLabelDimensions(t,D),H=$.width;H<=f?S+=I+R:(S&&p.push(S),S=I+R)}}catch(K){T.e(K)}finally{T.f()}S.match(/^[\s\u200b]+$/)||p.push(S)}else p.push(m)}s("labelWrapCachedLines",p),a=s("labelWrapCachedText",p.join(`
|
|
88
|
+
`)),s("labelWrapKey",l)}else if(o==="ellipsis"){var V=t.pstyle("text-max-width").pfValue,U="",F="…",G=!1;if(this.calculateLabelDimensions(t,a).width<V)return a;for(var z=0;z<a.length;z++){var _=this.calculateLabelDimensions(t,U+a[z]+F).width;if(_>V)break;U+=a[z],z===a.length-1&&(G=!0)}return G||(U+=F),U}return a};$a.getLabelJustification=function(t){var e=t.pstyle("text-justification").strValue,n=t.pstyle("text-halign").strValue;return e==="auto"?t.isNode()?$A(n):"center":e};$a.calculateLabelDimensions=function(t,e){var n=this,r=n.cy.window(),a=r.document,i=0,s=t.pstyle("font-style").strValue,o=t.pstyle("font-size").pfValue,l=t.pstyle("font-family").strValue,u=t.pstyle("font-weight").strValue,d=t.pstyle("text-metrics").strValue||"font",f=this.labelCalcCanvas,h=this.labelCalcCanvasContext;if(!f){f=this.labelCalcCanvas=a.createElement("canvas"),h=this.labelCalcCanvasContext=f.getContext("2d");var v=f.style;v.position="absolute",v.left="-9999px",v.top="-9999px",v.zIndex="-1",v.visibility="hidden",v.pointerEvents="none"}h.font="".concat(s," ").concat(u," ").concat(o,"px ").concat(l);for(var p=0,y=0,b=e.split(`
|
|
89
|
+
`),m=b.length,g=0,w=0,x=0;x<m;x++){var E=b[x],S=h.measureText(E),C=Math.ceil(S.width),T=o;d==="glyph"&&(x===0&&(w=S.actualBoundingBoxAscent),x===m-1&&(g=S.actualBoundingBoxDescent)),p=Math.max(C,p),y+=T}return d==="glyph"&&(y-=o-w-g),p+=i,y+=i,{width:p,height:y,labelActualAscent:w,labelActualDescent:g}};$a.calculateLabelAngle=function(t,e){var n=t._private,r=n.rscratch,a=t.isEdge(),i=e?e+"-":"",s=t.pstyle(i+"text-rotation"),o=s.strValue;return o==="none"?0:a&&o==="autorotate"?r.labelAutoAngle:o==="autorotate"?0:s.pfValue};$a.calculateLabelAngles=function(t){var e=this,n=t.isEdge(),r=t._private,a=r.rscratch;a.labelAngle=e.calculateLabelAngle(t),n&&(a.sourceLabelAngle=e.calculateLabelAngle(t,"source"),a.targetLabelAngle=e.calculateLabelAngle(t,"target"))};var zS={},Dw=28,Bw=!1;zS.getNodeShape=function(t){var e=this,n=t.pstyle("shape").value;if(n==="cutrectangle"&&(t.width()<Dw||t.height()<Dw))return Bw||(Jt("The `cutrectangle` node shape can not be used at small sizes so `rectangle` is used instead"),Bw=!0),"rectangle";if(t.isParent())return n==="rectangle"||n==="roundrectangle"||n==="round-rectangle"||n==="cutrectangle"||n==="cut-rectangle"||n==="barrel"?n:"rectangle";if(n==="polygon"){var r=t.pstyle("shape-polygon-points").value;return e.nodeShapes.makePolygon(r).name}return n};var Wf={};Wf.registerCalculationListeners=function(){var t=this.cy,e=t.collection(),n=this,r=function(s){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(e.merge(s),o)for(var l=0;l<s.length;l++){var u=s[l],d=u._private,f=d.rstyle;f.clean=!1,f.cleanConnected=!1}};n.binder(t).on("bounds.* dirty.*",function(s){var o=s.target;r(o)}).on("style.* background.*",function(s){var o=s.target;r(o,!1)});var a=function(s){if(s){var o=n.onUpdateEleCalcsFns;e.cleanStyle();for(var l=0;l<e.length;l++){var u=e[l],d=u._private.rstyle;u.isNode()&&!d.cleanConnected&&(r(u.connectedEdges()),d.cleanConnected=!0)}if(o)for(var f=0;f<o.length;f++){var h=o[f];h(s,e)}n.recalculateRenderedStyle(e),e=t.collection()}};n.flushRenderedStyleQueue=function(){a(!0)},n.beforeRender(a,n.beforeRenderPriorities.eleCalcs)};Wf.onUpdateEleCalcs=function(t){var e=this.onUpdateEleCalcsFns=this.onUpdateEleCalcsFns||[];e.push(t)};Wf.recalculateRenderedStyle=function(t,e){var n=function(x){return x._private.rstyle.cleanConnected};if(t.length!==0){var r=[],a=[];if(!this.destroyed){e===void 0&&(e=!0);for(var i=0;i<t.length;i++){var s=t[i],o=s._private,l=o.rstyle;s.isEdge()&&(!n(s.source())||!n(s.target()))&&(l.clean=!1),s.isEdge()&&s.isBundledBezier()&&s.parallelEdges().some(function(w){return!w._private.rstyle.clean&&w.isBundledBezier()})&&(l.clean=!1),!(e&&l.clean||s.removed())&&s.pstyle("display").value!=="none"&&(o.group==="nodes"?a.push(s):r.push(s),l.clean=!0)}for(var u=0;u<a.length;u++){var d=a[u],f=d._private,h=f.rstyle,v=d.position();this.recalculateNodeLabelProjection(d),h.nodeX=v.x,h.nodeY=v.y,h.nodeW=d.pstyle("width").pfValue,h.nodeH=d.pstyle("height").pfValue}this.recalculateEdgeProjections(r);for(var p=0;p<r.length;p++){var y=r[p],b=y._private,m=b.rstyle,g=b.rscratch;m.srcX=g.arrowStartX,m.srcY=g.arrowStartY,m.tgtX=g.arrowEndX,m.tgtY=g.arrowEndY,m.midX=g.midX,m.midY=g.midY,m.labelAngle=g.labelAngle,m.sourceLabelAngle=g.sourceLabelAngle,m.targetLabelAngle=g.targetLabelAngle}}}};var Kf={};Kf.updateCachedGrabbedEles=function(){var t=this.cachedZSortedEles;if(t){t.drag=[],t.nondrag=[];for(var e=[],n=0;n<t.length;n++){var r=t[n],a=r._private.rscratch;r.grabbed()&&!r.isParent()?e.push(r):a.inDragLayer?t.drag.push(r):t.nondrag.push(r)}for(var n=0;n<e.length;n++){var r=e[n];t.drag.push(r)}}};Kf.invalidateCachedZSortedEles=function(){this.cachedZSortedEles=null};Kf.getCachedZSortedEles=function(t){if(t||!this.cachedZSortedEles){var e=this.cy.mutableElements().toArray();e.sort(bS),e.interactive=e.filter(function(n){return n.interactive()}),this.cachedZSortedEles=e,this.updateCachedGrabbedEles()}else e=this.cachedZSortedEles;return e};var FS={};[$s,Xd,xr,Ku,wy,$a,zS,Wf,Kf].forEach(function(t){pt(FS,t)});var _S={};_S.getCachedImage=function(t,e,n){var r=this,a=r.imageCache=r.imageCache||{},i=a[t];if(i)return i.image.complete||i.image.addEventListener("load",n),i.image;i=a[t]=a[t]||{};var s=i.image=new Image;s.addEventListener("load",n),s.addEventListener("error",function(){s.error=!0});var o="data:",l=t.substring(0,o.length).toLowerCase()===o;return l||(e=e==="null"?null:e,s.crossOrigin=e),s.src=t,s};var $S=function(e,n){var r=e[0];!r||r._private.grabbed===n||(r._private.grabbed=n,e.updateStyle(!1))},tB=function(e){$S(e,!0)},nB=function(e){$S(e,!1)},il={};il.registerBinding=function(t,e,n,r){var a=Array.prototype.slice.apply(arguments,[1]);if(Array.isArray(t)){for(var i=[],s=0;s<t.length;s++){var o=t[s];if(o!==void 0){var l=this.binder(o);i.push(l.on.apply(l,a))}}return i}var l=this.binder(t);return l.on.apply(l,a)};il.binder=function(t){var e=this,n=e.cy.window(),r=t===n||t===n.document||t===n.document.body||dR(t);if(e.supportsPassiveEvents==null){var a=!1;try{var i=Object.defineProperty({},"passive",{get:function(){return a=!0,!0}});n.addEventListener("test",null,i)}catch{}e.supportsPassiveEvents=a}var s=function(l,u,d){var f=Array.prototype.slice.call(arguments);return r&&e.supportsPassiveEvents&&(f[2]={capture:d??!1,passive:!1,once:!1}),e.bindings.push({target:t,args:f}),(t.addEventListener||t.on).apply(t,f),this};return{on:s,addEventListener:s,addListener:s,bind:s}};il.nodeIsDraggable=function(t){return t&&t.isNode()&&!t.locked()&&t.grabbable()};il.nodeIsGrabbable=function(t){return this.nodeIsDraggable(t)&&t.interactive()};il.load=function(){var t=this,e=t.cy.window(),n=function(B){return B.selected()},r=function(B){var Y=B.getRootNode();if(Y&&Y.nodeType===11&&Y.host!==void 0)return Y},a=function(B,Y,te,le){B==null&&(B=t.cy);for(var ce=0;ce<Y.length;ce++){var Ye=Y[ce];B.emit({originalEvent:te,type:Ye,position:le})}},i=function(B){return B.shiftKey||B.metaKey||B.ctrlKey},s=function(B,Y){var te=!0;if(t.cy.hasCompoundNodes()&&B&&B.pannable())for(var le=0;Y&&le<Y.length;le++){var B=Y[le];if(B.isNode()&&B.isParent()&&!B.pannable()){te=!1;break}}else te=!0;return te},o=function(B){B[0]._private.rscratch.inDragLayer=!0},l=function(B){B[0]._private.rscratch.inDragLayer=!1},u=function(B){B[0]._private.rscratch.isGrabTarget=!0},d=function(B){B[0]._private.rscratch.isGrabTarget=!1},f=function(B,Y){var te=Y.addToList,le=te.has(B);!le&&B.grabbable()&&!B.locked()&&(te.merge(B),tB(B))},h=function(B,Y){if(B.cy().hasCompoundNodes()&&!(Y.inDragLayer==null&&Y.addToList==null)){var te=B.descendants();Y.inDragLayer&&(te.forEach(o),te.connectedEdges().forEach(o)),Y.addToList&&f(te,Y)}},v=function(B,Y){Y=Y||{};var te=B.cy().hasCompoundNodes();Y.inDragLayer&&(B.forEach(o),B.neighborhood().stdFilter(function(le){return!te||le.isEdge()}).forEach(o)),Y.addToList&&B.forEach(function(le){f(le,Y)}),h(B,Y),b(B,{inDragLayer:Y.inDragLayer}),t.updateCachedGrabbedEles()},p=v,y=function(B){B&&(t.getCachedZSortedEles().forEach(function(Y){nB(Y),l(Y),d(Y)}),t.updateCachedGrabbedEles())},b=function(B,Y){if(!(Y.inDragLayer==null&&Y.addToList==null)&&B.cy().hasCompoundNodes()){var te=B.ancestors().orphans();if(!te.same(B)){var le=te.descendants().spawnSelf().merge(te).unmerge(B).unmerge(B.descendants()),ce=le.connectedEdges();Y.inDragLayer&&(ce.forEach(o),le.forEach(o)),Y.addToList&&le.forEach(function(Ye){f(Ye,Y)})}}},m=function(){document.activeElement!=null&&document.activeElement.blur!=null&&document.activeElement.blur()},g=typeof MutationObserver<"u",w=typeof ResizeObserver<"u";g?(t.removeObserver=new MutationObserver(function(pe){for(var B=0;B<pe.length;B++){var Y=pe[B],te=Y.removedNodes;if(te)for(var le=0;le<te.length;le++){var ce=te[le];if(ce===t.container){t.destroy();break}}}}),t.container.parentNode&&t.removeObserver.observe(t.container.parentNode,{childList:!0})):t.registerBinding(t.container,"DOMNodeRemoved",function(pe){t.destroy()});var x=Uu(function(){t.cy.resize()},100);g&&(t.styleObserver=new MutationObserver(x),t.styleObserver.observe(t.container,{attributes:!0})),t.registerBinding(e,"resize",x),w&&(t.resizeObserver=new ResizeObserver(x),t.resizeObserver.observe(t.container));var E=function(B,Y){for(;B!=null;)Y(B),B=B.parentNode},S=function(){t.invalidateContainerClientCoordsCache()};E(t.container,function(pe){t.registerBinding(pe,"transitionend",S),t.registerBinding(pe,"animationend",S),t.registerBinding(pe,"scroll",S)}),t.registerBinding(t.container,"contextmenu",function(pe){pe.preventDefault()});var C=function(){return t.selection[4]!==0},T=function(B){for(var Y=t.findContainerClientCoords(),te=Y[0],le=Y[1],ce=Y[2],Ye=Y[3],be=B.touches?B.touches:[B],Me=!1,Ke=0;Ke<be.length;Ke++){var dt=be[Ke];if(te<=dt.clientX&&dt.clientX<=te+ce&&le<=dt.clientY&&dt.clientY<=le+Ye){Me=!0;break}}if(!Me)return!1;for(var kt=t.container,ot=B.target,Ve=ot.parentNode,vt=!1;Ve;){if(Ve===kt){vt=!0;break}Ve=Ve.parentNode}return!!vt};t.registerBinding(t.container,"mousedown",function(B){if(T(B)&&!(t.hoverData.which===1&&B.which!==1)){B.preventDefault(),m(),t.hoverData.capture=!0,t.hoverData.which=B.which;var Y=t.cy,te=[B.clientX,B.clientY],le=t.projectIntoViewport(te[0],te[1]),ce=t.selection,Ye=t.findNearestElements(le[0],le[1],!0,!1),be=Ye[0],Me=t.dragData.possibleDragElements;t.hoverData.mdownPos=le,t.hoverData.mdownGPos=te;var Ke=function(jt){return{originalEvent:B,type:jt,position:{x:le[0],y:le[1]}}},dt=function(){t.hoverData.tapholdCancelled=!1,clearTimeout(t.hoverData.tapholdTimeout),t.hoverData.tapholdTimeout=setTimeout(function(){if(!t.hoverData.tapholdCancelled){var jt=t.hoverData.down;jt?jt.emit(Ke("taphold")):Y.emit(Ke("taphold"))}},t.tapholdDuration)};if(B.which==3){t.hoverData.cxtStarted=!0;var kt={originalEvent:B,type:"cxttapstart",position:{x:le[0],y:le[1]}};be?(be.activate(),be.emit(kt),t.hoverData.down=be):Y.emit(kt),t.hoverData.downTime=new Date().getTime(),t.hoverData.cxtDragged=!1}else if(B.which==1){be&&be.activate();{if(be!=null&&t.nodeIsGrabbable(be)){var ot=function(jt){jt.emit(Ke("grab"))};if(u(be),!be.selected())Me=t.dragData.possibleDragElements=Y.collection(),p(be,{addToList:Me}),be.emit(Ke("grabon")).emit(Ke("grab"));else{Me=t.dragData.possibleDragElements=Y.collection();var Ve=Y.$(function(vt){return vt.isNode()&&vt.selected()&&t.nodeIsGrabbable(vt)});v(Ve,{addToList:Me}),be.emit(Ke("grabon")),Ve.forEach(ot)}t.redrawHint("eles",!0),t.redrawHint("drag",!0)}t.hoverData.down=be,t.hoverData.downs=Ye,t.hoverData.downTime=new Date().getTime()}a(be,["mousedown","tapstart","vmousedown"],B,{x:le[0],y:le[1]}),be==null?(ce[4]=1,t.data.bgActivePosistion={x:le[0],y:le[1]},t.redrawHint("select",!0),t.redraw()):be.pannable()&&(ce[4]=1),dt()}ce[0]=ce[2]=le[0],ce[1]=ce[3]=le[1]}},!1);var N=r(t.container);t.registerBinding([e,N],"mousemove",function(B){var Y=t.hoverData.capture;if(!(!Y&&!T(B))){var te=!1,le=t.cy,ce=le.zoom(),Ye=[B.clientX,B.clientY],be=t.projectIntoViewport(Ye[0],Ye[1]),Me=t.hoverData.mdownPos,Ke=t.hoverData.mdownGPos,dt=t.selection,kt=null;!t.hoverData.draggingEles&&!t.hoverData.dragging&&!t.hoverData.selecting&&(kt=t.findNearestElement(be[0],be[1],!0,!1));var ot=t.hoverData.last,Ve=t.hoverData.down,vt=[be[0]-dt[2],be[1]-dt[3]],jt=t.dragData.possibleDragElements,Vt;if(Ke){var Ft=Ye[0]-Ke[0],Ir=Ft*Ft,sn=Ye[1]-Ke[1],gn=sn*sn,Sn=Ir+gn;t.hoverData.isOverThresholdDrag=Vt=Sn>=t.desktopTapThreshold2}var Un=i(B);Vt&&(t.hoverData.tapholdCancelled=!0);var ea=function(){var tr=t.hoverData.dragDelta=t.hoverData.dragDelta||[];tr.length===0?(tr.push(vt[0]),tr.push(vt[1])):(tr[0]+=vt[0],tr[1]+=vt[1])};te=!0,a(kt,["mousemove","vmousemove","tapdrag"],B,{x:be[0],y:be[1]});var dn=function(tr){return{originalEvent:B,type:tr,position:{x:be[0],y:be[1]}}},ha=function(){t.data.bgActivePosistion=void 0,t.hoverData.selecting||le.emit(dn("boxstart")),dt[4]=1,t.hoverData.selecting=!0,t.redrawHint("select",!0),t.redraw()};if(t.hoverData.which===3){if(Vt){var Lr=dn("cxtdrag");Ve?Ve.emit(Lr):le.emit(Lr),t.hoverData.cxtDragged=!0,(!t.hoverData.cxtOver||kt!==t.hoverData.cxtOver)&&(t.hoverData.cxtOver&&t.hoverData.cxtOver.emit(dn("cxtdragout")),t.hoverData.cxtOver=kt,kt&&kt.emit(dn("cxtdragover")))}}else if(t.hoverData.dragging){if(te=!0,le.panningEnabled()&&le.userPanningEnabled()){var ta;if(t.hoverData.justStartedPan){var di=t.hoverData.mdownPos;ta={x:(be[0]-di[0])*ce,y:(be[1]-di[1])*ce},t.hoverData.justStartedPan=!1}else ta={x:vt[0]*ce,y:vt[1]*ce};le.panBy(ta),le.emit(dn("dragpan")),t.hoverData.dragged=!0}be=t.projectIntoViewport(B.clientX,B.clientY)}else if(dt[4]==1&&(Ve==null||Ve.pannable())){if(Vt){if(!t.hoverData.dragging&&le.boxSelectionEnabled()&&(Un||!le.panningEnabled()||!le.userPanningEnabled()))ha();else if(!t.hoverData.selecting&&le.panningEnabled()&&le.userPanningEnabled()){var Ua=s(Ve,t.hoverData.downs);Ua&&(t.hoverData.dragging=!0,t.hoverData.justStartedPan=!0,dt[4]=0,t.data.bgActivePosistion=bo(Me),t.redrawHint("select",!0),t.redraw())}Ve&&Ve.pannable()&&Ve.active()&&Ve.unactivate()}}else{if(Ve&&Ve.pannable()&&Ve.active()&&Ve.unactivate(),(!Ve||!Ve.grabbed())&&kt!=ot&&(ot&&a(ot,["mouseout","tapdragout"],B,{x:be[0],y:be[1]}),kt&&a(kt,["mouseover","tapdragover"],B,{x:be[0],y:be[1]}),t.hoverData.last=kt),Ve)if(Vt){if(le.boxSelectionEnabled()&&Un)Ve&&Ve.grabbed()&&(y(jt),Ve.emit(dn("freeon")),jt.emit(dn("free")),t.dragData.didDrag&&(Ve.emit(dn("dragfreeon")),jt.emit(dn("dragfree")))),ha();else if(Ve&&Ve.grabbed()&&t.nodeIsDraggable(Ve)){var dr=!t.dragData.didDrag;dr&&t.redrawHint("eles",!0),t.dragData.didDrag=!0,t.hoverData.draggingEles||v(jt,{inDragLayer:!0});var Bn={x:0,y:0};if(_e(vt[0])&&_e(vt[1])&&(Bn.x+=vt[0],Bn.y+=vt[1],dr)){var fr=t.hoverData.dragDelta;fr&&_e(fr[0])&&_e(fr[1])&&(Bn.x+=fr[0],Bn.y+=fr[1])}t.hoverData.draggingEles=!0,jt.silentShift(Bn).emit(dn("position")).emit(dn("drag")),t.redrawHint("drag",!0),t.redraw()}}else ea();te=!0}if(dt[2]=be[0],dt[3]=be[1],te)return B.stopPropagation&&B.stopPropagation(),B.preventDefault&&B.preventDefault(),!1}},!1);var P,R,I;t.registerBinding(e,"mouseup",function(B){if(!(t.hoverData.which===1&&B.which!==1&&t.hoverData.capture)){var Y=t.hoverData.capture;if(Y){t.hoverData.capture=!1;var te=t.cy,le=t.projectIntoViewport(B.clientX,B.clientY),ce=t.selection,Ye=t.findNearestElement(le[0],le[1],!0,!1),be=t.dragData.possibleDragElements,Me=t.hoverData.down,Ke=i(B);t.data.bgActivePosistion&&(t.redrawHint("select",!0),t.redraw()),t.hoverData.tapholdCancelled=!0,t.data.bgActivePosistion=void 0,Me&&Me.unactivate();var dt=function(Ft){return{originalEvent:B,type:Ft,position:{x:le[0],y:le[1]}}};if(t.hoverData.which===3){var kt=dt("cxttapend");if(Me?Me.emit(kt):te.emit(kt),!t.hoverData.cxtDragged){var ot=dt("cxttap");Me?Me.emit(ot):te.emit(ot)}t.hoverData.cxtDragged=!1,t.hoverData.which=null}else if(t.hoverData.which===1){if(a(Ye,["mouseup","tapend","vmouseup"],B,{x:le[0],y:le[1]}),!t.dragData.didDrag&&!t.hoverData.dragged&&!t.hoverData.selecting&&!t.hoverData.isOverThresholdDrag&&(a(Me,["click","tap","vclick"],B,{x:le[0],y:le[1]}),R=!1,B.timeStamp-I<=te.multiClickDebounceTime()?(P&&clearTimeout(P),R=!0,I=null,a(Me,["dblclick","dbltap","vdblclick"],B,{x:le[0],y:le[1]})):(P=setTimeout(function(){R||a(Me,["oneclick","onetap","voneclick"],B,{x:le[0],y:le[1]})},te.multiClickDebounceTime()),I=B.timeStamp)),Me==null&&!t.dragData.didDrag&&!t.hoverData.selecting&&!t.hoverData.dragged&&!i(B)&&(te.$(n).unselect(["tapunselect"]),be.length>0&&t.redrawHint("eles",!0),t.dragData.possibleDragElements=be=te.collection()),Ye==Me&&!t.dragData.didDrag&&!t.hoverData.selecting&&Ye!=null&&Ye._private.selectable&&(t.hoverData.dragging||(te.selectionType()==="additive"||Ke?Ye.selected()?Ye.unselect(["tapunselect"]):Ye.select(["tapselect"]):Ke||(te.$(n).unmerge(Ye).unselect(["tapunselect"]),Ye.select(["tapselect"]))),t.redrawHint("eles",!0)),t.hoverData.selecting){var Ve=te.collection(t.getAllInBox(ce[0],ce[1],ce[2],ce[3]));t.redrawHint("select",!0),Ve.length>0&&t.redrawHint("eles",!0),te.emit(dt("boxend"));var vt=function(Ft){return Ft.selectable()&&!Ft.selected()};te.selectionType()==="additive"||Ke||te.$(n).unmerge(Ve).unselect(),Ve.emit(dt("box")).stdFilter(vt).select().emit(dt("boxselect")),t.redraw()}if(t.hoverData.dragging&&(t.hoverData.dragging=!1,t.redrawHint("select",!0),t.redrawHint("eles",!0),t.redraw()),!ce[4]){t.redrawHint("drag",!0),t.redrawHint("eles",!0);var jt=Me&&Me.grabbed();y(be),jt&&(Me.emit(dt("freeon")),be.emit(dt("free")),t.dragData.didDrag&&(Me.emit(dt("dragfreeon")),be.emit(dt("dragfree"))))}}ce[4]=0,t.hoverData.down=null,t.hoverData.cxtStarted=!1,t.hoverData.draggingEles=!1,t.hoverData.selecting=!1,t.hoverData.isOverThresholdDrag=!1,t.dragData.didDrag=!1,t.hoverData.dragged=!1,t.hoverData.dragDelta=[],t.hoverData.mdownPos=null,t.hoverData.mdownGPos=null,t.hoverData.which=null}}},!1);var D=[],$=4,H,V=1e5,U=function(B,Y){for(var te=0;te<B.length;te++)if(B[te]%Y!==0)return!1;return!0},F=function(B){for(var Y=Math.abs(B[0]),te=1;te<B.length;te++)if(Math.abs(B[te])!==Y)return!1;return!0},G=function(B){var Y=!1,te=B.deltaY;if(te==null&&(B.wheelDeltaY!=null?te=B.wheelDeltaY/4:B.wheelDelta!=null&&(te=B.wheelDelta/4)),te!==0){if(H==null)if(D.length>=$){var le=D;if(H=U(le,5),!H){var ce=Math.abs(le[0]);H=F(le)&&ce>5}if(H)for(var Ye=0;Ye<le.length;Ye++)V=Math.min(Math.abs(le[Ye]),V)}else D.push(te),Y=!0;else H&&(V=Math.min(Math.abs(te),V));if(!t.scrollingPage){var be=t.cy,Me=be.zoom(),Ke=be.pan(),dt=t.projectIntoViewport(B.clientX,B.clientY),kt=[dt[0]*Me+Ke.x,dt[1]*Me+Ke.y];if(t.hoverData.draggingEles||t.hoverData.dragging||t.hoverData.cxtStarted||C()){B.preventDefault();return}if(be.panningEnabled()&&be.userPanningEnabled()&&be.zoomingEnabled()&&be.userZoomingEnabled()){B.preventDefault(),t.data.wheelZooming=!0,clearTimeout(t.data.wheelTimeout),t.data.wheelTimeout=setTimeout(function(){t.data.wheelZooming=!1,t.redrawHint("eles",!0),t.redraw()},150);var ot;Y&&Math.abs(te)>5&&(te=oy(te)*5),ot=te/-250,H&&(ot/=V,ot*=3),ot=ot*t.wheelSensitivity;var Ve=B.deltaMode===1;Ve&&(ot*=33);var vt=be.zoom()*Math.pow(10,ot);B.type==="gesturechange"&&(vt=t.gestureStartZoom*B.scale),be.zoom({level:vt,renderedPosition:{x:kt[0],y:kt[1]}}),be.emit({type:B.type==="gesturechange"?"pinchzoom":"scrollzoom",originalEvent:B,position:{x:dt[0],y:dt[1]}})}}}};t.registerBinding(t.container,"wheel",G,!0),t.registerBinding(e,"scroll",function(B){t.scrollingPage=!0,clearTimeout(t.scrollingPageTimeout),t.scrollingPageTimeout=setTimeout(function(){t.scrollingPage=!1},250)},!0),t.registerBinding(t.container,"gesturestart",function(B){t.gestureStartZoom=t.cy.zoom(),t.hasTouchStarted||B.preventDefault()},!0),t.registerBinding(t.container,"gesturechange",function(pe){t.hasTouchStarted||G(pe)},!0),t.registerBinding(t.container,"mouseout",function(B){var Y=t.projectIntoViewport(B.clientX,B.clientY);t.cy.emit({originalEvent:B,type:"mouseout",position:{x:Y[0],y:Y[1]}})},!1),t.registerBinding(t.container,"mouseover",function(B){var Y=t.projectIntoViewport(B.clientX,B.clientY);t.cy.emit({originalEvent:B,type:"mouseover",position:{x:Y[0],y:Y[1]}})},!1);var z,_,K,ie,M,oe,ve,ye,Te,fe,Z,ee,ne,de=function(B,Y,te,le){return Math.sqrt((te-B)*(te-B)+(le-Y)*(le-Y))},Re=function(B,Y,te,le){return(te-B)*(te-B)+(le-Y)*(le-Y)},Ge;t.registerBinding(t.container,"touchstart",Ge=function(B){if(t.hasTouchStarted=!0,!!T(B)){m(),t.touchData.capture=!0,t.data.bgActivePosistion=void 0;var Y=t.cy,te=t.touchData.now,le=t.touchData.earlier;if(B.touches[0]){var ce=t.projectIntoViewport(B.touches[0].clientX,B.touches[0].clientY);te[0]=ce[0],te[1]=ce[1]}if(B.touches[1]){var ce=t.projectIntoViewport(B.touches[1].clientX,B.touches[1].clientY);te[2]=ce[0],te[3]=ce[1]}if(B.touches[2]){var ce=t.projectIntoViewport(B.touches[2].clientX,B.touches[2].clientY);te[4]=ce[0],te[5]=ce[1]}var Ye=function(Un){return{originalEvent:B,type:Un,position:{x:te[0],y:te[1]}}};if(B.touches[1]){t.touchData.singleTouchMoved=!0,y(t.dragData.touchDragEles);var be=t.findContainerClientCoords();Te=be[0],fe=be[1],Z=be[2],ee=be[3],z=B.touches[0].clientX-Te,_=B.touches[0].clientY-fe,K=B.touches[1].clientX-Te,ie=B.touches[1].clientY-fe,ne=0<=z&&z<=Z&&0<=K&&K<=Z&&0<=_&&_<=ee&&0<=ie&&ie<=ee;var Me=Y.pan(),Ke=Y.zoom();M=de(z,_,K,ie),oe=Re(z,_,K,ie),ve=[(z+K)/2,(_+ie)/2],ye=[(ve[0]-Me.x)/Ke,(ve[1]-Me.y)/Ke];var dt=200,kt=dt*dt;if(oe<kt&&!B.touches[2]){var ot=t.findNearestElement(te[0],te[1],!0,!0),Ve=t.findNearestElement(te[2],te[3],!0,!0);ot&&ot.isNode()?(ot.activate().emit(Ye("cxttapstart")),t.touchData.start=ot):Ve&&Ve.isNode()?(Ve.activate().emit(Ye("cxttapstart")),t.touchData.start=Ve):Y.emit(Ye("cxttapstart")),t.touchData.start&&(t.touchData.start._private.grabbed=!1),t.touchData.cxt=!0,t.touchData.cxtDragged=!1,t.data.bgActivePosistion=void 0,t.redraw();return}}if(B.touches[2])Y.boxSelectionEnabled()&&B.preventDefault();else if(!B.touches[1]){if(B.touches[0]){var vt=t.findNearestElements(te[0],te[1],!0,!0),jt=vt[0];if(jt!=null&&(jt.activate(),t.touchData.start=jt,t.touchData.starts=vt,t.nodeIsGrabbable(jt))){var Vt=t.dragData.touchDragEles=Y.collection(),Ft=null;t.redrawHint("eles",!0),t.redrawHint("drag",!0),jt.selected()?(Ft=Y.$(function(Sn){return Sn.selected()&&t.nodeIsGrabbable(Sn)}),v(Ft,{addToList:Vt})):p(jt,{addToList:Vt}),u(jt),jt.emit(Ye("grabon")),Ft?Ft.forEach(function(Sn){Sn.emit(Ye("grab"))}):jt.emit(Ye("grab"))}a(jt,["touchstart","tapstart","vmousedown"],B,{x:te[0],y:te[1]}),jt==null&&(t.data.bgActivePosistion={x:ce[0],y:ce[1]},t.redrawHint("select",!0),t.redraw()),t.touchData.singleTouchMoved=!1,t.touchData.singleTouchStartTime=+new Date,clearTimeout(t.touchData.tapholdTimeout),t.touchData.tapholdTimeout=setTimeout(function(){t.touchData.singleTouchMoved===!1&&!t.pinching&&!t.touchData.selecting&&a(t.touchData.start,["taphold"],B,{x:te[0],y:te[1]})},t.tapholdDuration)}}if(B.touches.length>=1){for(var Ir=t.touchData.startPosition=[null,null,null,null,null,null],sn=0;sn<te.length;sn++)Ir[sn]=le[sn]=te[sn];var gn=B.touches[0];t.touchData.startGPosition=[gn.clientX,gn.clientY]}}},!1);var Nt;t.registerBinding(e,"touchmove",Nt=function(B){var Y=t.touchData.capture;if(!(!Y&&!T(B))){var te=t.selection,le=t.cy,ce=t.touchData.now,Ye=t.touchData.earlier,be=le.zoom();if(B.touches[0]){var Me=t.projectIntoViewport(B.touches[0].clientX,B.touches[0].clientY);ce[0]=Me[0],ce[1]=Me[1]}if(B.touches[1]){var Me=t.projectIntoViewport(B.touches[1].clientX,B.touches[1].clientY);ce[2]=Me[0],ce[3]=Me[1]}if(B.touches[2]){var Me=t.projectIntoViewport(B.touches[2].clientX,B.touches[2].clientY);ce[4]=Me[0],ce[5]=Me[1]}var Ke=function(ja){return{originalEvent:B,type:ja,position:{x:ce[0],y:ce[1]}}},dt=t.touchData.startGPosition,kt;if(Y&&B.touches[0]&&dt){for(var ot=[],Ve=0;Ve<ce.length;Ve++)ot[Ve]=ce[Ve]-Ye[Ve];var vt=B.touches[0].clientX-dt[0],jt=vt*vt,Vt=B.touches[0].clientY-dt[1],Ft=Vt*Vt,Ir=jt+Ft;kt=Ir>=t.touchTapThreshold2}if(Y&&t.touchData.cxt){B.preventDefault();var sn=B.touches[0].clientX-Te,gn=B.touches[0].clientY-fe,Sn=B.touches[1].clientX-Te,Un=B.touches[1].clientY-fe,ea=Re(sn,gn,Sn,Un),dn=ea/oe,ha=150,Lr=ha*ha,ta=1.5,di=ta*ta;if(dn>=di||ea>=Lr){t.touchData.cxt=!1,t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);var Ua=Ke("cxttapend");t.touchData.start?(t.touchData.start.unactivate().emit(Ua),t.touchData.start=null):le.emit(Ua)}}if(Y&&t.touchData.cxt){var Ua=Ke("cxtdrag");t.data.bgActivePosistion=void 0,t.redrawHint("select",!0),t.touchData.start?t.touchData.start.emit(Ua):le.emit(Ua),t.touchData.start&&(t.touchData.start._private.grabbed=!1),t.touchData.cxtDragged=!0;var dr=t.findNearestElement(ce[0],ce[1],!0,!0);(!t.touchData.cxtOver||dr!==t.touchData.cxtOver)&&(t.touchData.cxtOver&&t.touchData.cxtOver.emit(Ke("cxtdragout")),t.touchData.cxtOver=dr,dr&&dr.emit(Ke("cxtdragover")))}else if(Y&&B.touches[2]&&le.boxSelectionEnabled())B.preventDefault(),t.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,t.touchData.selecting||le.emit(Ke("boxstart")),t.touchData.selecting=!0,t.touchData.didSelect=!0,te[4]=1,!te||te.length===0||te[0]===void 0?(te[0]=(ce[0]+ce[2]+ce[4])/3,te[1]=(ce[1]+ce[3]+ce[5])/3,te[2]=(ce[0]+ce[2]+ce[4])/3+1,te[3]=(ce[1]+ce[3]+ce[5])/3+1):(te[2]=(ce[0]+ce[2]+ce[4])/3,te[3]=(ce[1]+ce[3]+ce[5])/3),t.redrawHint("select",!0),t.redraw();else if(Y&&B.touches[1]&&!t.touchData.didSelect&&le.zoomingEnabled()&&le.panningEnabled()&&le.userZoomingEnabled()&&le.userPanningEnabled()){B.preventDefault(),t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);var Bn=t.dragData.touchDragEles;if(Bn){t.redrawHint("drag",!0);for(var fr=0;fr<Bn.length;fr++){var is=Bn[fr]._private;is.grabbed=!1,is.rscratch.inDragLayer=!1}}var tr=t.touchData.start,sn=B.touches[0].clientX-Te,gn=B.touches[0].clientY-fe,Sn=B.touches[1].clientX-Te,Un=B.touches[1].clientY-fe,Qu=de(sn,gn,Sn,Un),Gf=Qu/M;if(ne){var Zu=sn-z,Fe=gn-_,Ar=Sn-K,Yf=Un-ie,Xf=(Zu+Ar)/2,Qf=(Fe+Yf)/2,ss=le.zoom(),ol=ss*Gf,os=le.pan(),nr=ye[0]*ss+os.x,Ju=ye[1]*ss+os.y,ll={x:-ol/ss*(nr-os.x-Xf)+nr,y:-ol/ss*(Ju-os.y-Qf)+Ju};if(tr&&tr.active()){var Bn=t.dragData.touchDragEles;y(Bn),t.redrawHint("drag",!0),t.redrawHint("eles",!0),tr.unactivate().emit(Ke("freeon")),Bn.emit(Ke("free")),t.dragData.didDrag&&(tr.emit(Ke("dragfreeon")),Bn.emit(Ke("dragfree")))}le.viewport({zoom:ol,pan:ll,cancelOnFailedZoom:!0}),le.emit(Ke("pinchzoom")),M=Qu,z=sn,_=gn,K=Sn,ie=Un,t.pinching=!0}if(B.touches[0]){var Me=t.projectIntoViewport(B.touches[0].clientX,B.touches[0].clientY);ce[0]=Me[0],ce[1]=Me[1]}if(B.touches[1]){var Me=t.projectIntoViewport(B.touches[1].clientX,B.touches[1].clientY);ce[2]=Me[0],ce[3]=Me[1]}if(B.touches[2]){var Me=t.projectIntoViewport(B.touches[2].clientX,B.touches[2].clientY);ce[4]=Me[0],ce[5]=Me[1]}}else if(B.touches[0]&&!t.touchData.didSelect){var qr=t.touchData.start,Sa=t.touchData.last,dr;if(!t.hoverData.draggingEles&&!t.swipePanning&&(dr=t.findNearestElement(ce[0],ce[1],!0,!0)),Y&&qr!=null&&B.preventDefault(),Y&&qr!=null&&t.nodeIsDraggable(qr))if(kt){var Bn=t.dragData.touchDragEles,ul=!t.dragData.didDrag;ul&&v(Bn,{inDragLayer:!0}),t.dragData.didDrag=!0;var qa={x:0,y:0};if(_e(ot[0])&&_e(ot[1])&&(qa.x+=ot[0],qa.y+=ot[1],ul)){t.redrawHint("eles",!0);var Dr=t.touchData.dragDelta;Dr&&_e(Dr[0])&&_e(Dr[1])&&(qa.x+=Dr[0],qa.y+=Dr[1])}t.hoverData.draggingEles=!0,Bn.silentShift(qa).emit(Ke("position")).emit(Ke("drag")),t.redrawHint("drag",!0),t.touchData.startPosition[0]==Ye[0]&&t.touchData.startPosition[1]==Ye[1]&&t.redrawHint("eles",!0),t.redraw()}else{var Dr=t.touchData.dragDelta=t.touchData.dragDelta||[];Dr.length===0?(Dr.push(ot[0]),Dr.push(ot[1])):(Dr[0]+=ot[0],Dr[1]+=ot[1])}if(a(qr||dr,["touchmove","tapdrag","vmousemove"],B,{x:ce[0],y:ce[1]}),(!qr||!qr.grabbed())&&dr!=Sa&&(Sa&&Sa.emit(Ke("tapdragout")),dr&&dr.emit(Ke("tapdragover"))),t.touchData.last=dr,Y)for(var fr=0;fr<ce.length;fr++)ce[fr]&&t.touchData.startPosition[fr]&&kt&&(t.touchData.singleTouchMoved=!0);if(Y&&(qr==null||qr.pannable())&&le.panningEnabled()&&le.userPanningEnabled()){var Us=s(qr,t.touchData.starts);Us&&(B.preventDefault(),t.data.bgActivePosistion||(t.data.bgActivePosistion=bo(t.touchData.startPosition)),t.swipePanning?(le.panBy({x:ot[0]*be,y:ot[1]*be}),le.emit(Ke("dragpan"))):kt&&(t.swipePanning=!0,le.panBy({x:vt*be,y:Vt*be}),le.emit(Ke("dragpan")),qr&&(qr.unactivate(),t.redrawHint("select",!0),t.touchData.start=null)));var Me=t.projectIntoViewport(B.touches[0].clientX,B.touches[0].clientY);ce[0]=Me[0],ce[1]=Me[1]}}for(var Ve=0;Ve<ce.length;Ve++)Ye[Ve]=ce[Ve];Y&&B.touches.length>0&&!t.hoverData.draggingEles&&!t.swipePanning&&t.data.bgActivePosistion!=null&&(t.data.bgActivePosistion=void 0,t.redrawHint("select",!0),t.redraw())}},!1);var wt;t.registerBinding(e,"touchcancel",wt=function(B){var Y=t.touchData.start;t.touchData.capture=!1,Y&&Y.unactivate()});var at,it,$e,et;if(t.registerBinding(e,"touchend",at=function(B){var Y=t.touchData.start,te=t.touchData.capture;if(te)B.touches.length===0&&(t.touchData.capture=!1),B.preventDefault();else return;var le=t.selection;t.swipePanning=!1,t.hoverData.draggingEles=!1;var ce=t.cy,Ye=ce.zoom(),be=t.touchData.now,Me=t.touchData.earlier;if(B.touches[0]){var Ke=t.projectIntoViewport(B.touches[0].clientX,B.touches[0].clientY);be[0]=Ke[0],be[1]=Ke[1]}if(B.touches[1]){var Ke=t.projectIntoViewport(B.touches[1].clientX,B.touches[1].clientY);be[2]=Ke[0],be[3]=Ke[1]}if(B.touches[2]){var Ke=t.projectIntoViewport(B.touches[2].clientX,B.touches[2].clientY);be[4]=Ke[0],be[5]=Ke[1]}var dt=function(Lr){return{originalEvent:B,type:Lr,position:{x:be[0],y:be[1]}}};Y&&Y.unactivate();var kt;if(t.touchData.cxt){if(kt=dt("cxttapend"),Y?Y.emit(kt):ce.emit(kt),!t.touchData.cxtDragged){var ot=dt("cxttap");Y?Y.emit(ot):ce.emit(ot)}t.touchData.start&&(t.touchData.start._private.grabbed=!1),t.touchData.cxt=!1,t.touchData.start=null,t.redraw();return}if(!B.touches[2]&&ce.boxSelectionEnabled()&&t.touchData.selecting){t.touchData.selecting=!1;var Ve=ce.collection(t.getAllInBox(le[0],le[1],le[2],le[3]));le[0]=void 0,le[1]=void 0,le[2]=void 0,le[3]=void 0,le[4]=0,t.redrawHint("select",!0),ce.emit(dt("boxend"));var vt=function(Lr){return Lr.selectable()&&!Lr.selected()};Ve.emit(dt("box")).stdFilter(vt).select().emit(dt("boxselect")),Ve.nonempty()&&t.redrawHint("eles",!0),t.redraw()}if(Y!=null&&Y.unactivate(),B.touches[2])t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);else if(!B.touches[1]){if(!B.touches[0]){if(!B.touches[0]){t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);var jt=t.dragData.touchDragEles;if(Y!=null){var Vt=Y._private.grabbed;y(jt),t.redrawHint("drag",!0),t.redrawHint("eles",!0),Vt&&(Y.emit(dt("freeon")),jt.emit(dt("free")),t.dragData.didDrag&&(Y.emit(dt("dragfreeon")),jt.emit(dt("dragfree")))),a(Y,["touchend","tapend","vmouseup","tapdragout"],B,{x:be[0],y:be[1]}),Y.unactivate(),t.touchData.start=null}else{var Ft=t.findNearestElement(be[0],be[1],!0,!0);a(Ft,["touchend","tapend","vmouseup","tapdragout"],B,{x:be[0],y:be[1]})}var Ir=t.touchData.startPosition[0]-be[0],sn=Ir*Ir,gn=t.touchData.startPosition[1]-be[1],Sn=gn*gn,Un=sn+Sn,ea=Un*Ye*Ye;t.touchData.singleTouchMoved||(Y||ce.$(":selected").unselect(["tapunselect"]),a(Y,["tap","vclick"],B,{x:be[0],y:be[1]}),it=!1,B.timeStamp-et<=ce.multiClickDebounceTime()?($e&&clearTimeout($e),it=!0,et=null,a(Y,["dbltap","vdblclick"],B,{x:be[0],y:be[1]})):($e=setTimeout(function(){it||a(Y,["onetap","voneclick"],B,{x:be[0],y:be[1]})},ce.multiClickDebounceTime()),et=B.timeStamp)),Y!=null&&!t.dragData.didDrag&&Y._private.selectable&&ea<t.touchTapThreshold2&&!t.pinching&&(ce.selectionType()==="single"?(ce.$(n).unmerge(Y).unselect(["tapunselect"]),Y.select(["tapselect"])):Y.selected()?Y.unselect(["tapunselect"]):Y.select(["tapselect"]),t.redrawHint("eles",!0)),t.touchData.singleTouchMoved=!0}}}for(var dn=0;dn<be.length;dn++)Me[dn]=be[dn];t.dragData.didDrag=!1,B.touches.length===0&&(t.touchData.dragDelta=[],t.touchData.startPosition=[null,null,null,null,null,null],t.touchData.startGPosition=null,t.touchData.didSelect=!1),B.touches.length<2&&(B.touches.length===1&&(t.touchData.startGPosition=[B.touches[0].clientX,B.touches[0].clientY]),t.pinching=!1,t.redrawHint("eles",!0),t.redraw())},!1),typeof TouchEvent>"u"){var nt=[],bt=function(B){return{clientX:B.clientX,clientY:B.clientY,force:1,identifier:B.pointerId,pageX:B.pageX,pageY:B.pageY,radiusX:B.width/2,radiusY:B.height/2,screenX:B.screenX,screenY:B.screenY,target:B.target}},ht=function(B){return{event:B,touch:bt(B)}},Pt=function(B){nt.push(ht(B))},Bt=function(B){for(var Y=0;Y<nt.length;Y++){var te=nt[Y];if(te.event.pointerId===B.pointerId){nt.splice(Y,1);return}}},Kt=function(B){var Y=nt.filter(function(te){return te.event.pointerId===B.pointerId})[0];Y.event=B,Y.touch=bt(B)},_t=function(B){B.touches=nt.map(function(Y){return Y.touch})},Mt=function(B){return B.pointerType==="mouse"||B.pointerType===4};t.registerBinding(t.container,"pointerdown",function(pe){Mt(pe)||(pe.preventDefault(),Pt(pe),_t(pe),Ge(pe))}),t.registerBinding(t.container,"pointerup",function(pe){Mt(pe)||(Bt(pe),_t(pe),at(pe))}),t.registerBinding(t.container,"pointercancel",function(pe){Mt(pe)||(Bt(pe),_t(pe),wt(pe))}),t.registerBinding(t.container,"pointermove",function(pe){Mt(pe)||(pe.preventDefault(),Kt(pe),_t(pe),Nt(pe))})}};var ui={};ui.generatePolygon=function(t,e){return this.nodeShapes[t]={renderer:this,name:t,points:e,draw:function(r,a,i,s,o,l){this.renderer.nodeShapeImpl("polygon",r,a,i,s,o,this.points)},intersectLine:function(r,a,i,s,o,l,u,d){return Eu(o,l,this.points,r,a,i/2,s/2,u)},checkPoint:function(r,a,i,s,o,l,u,d){return ri(r,a,this.points,l,u,s,o,[0,-1],i)},hasMiterBounds:t!=="rectangle",miterBounds:function(r,a,i,s,o,l){return TI(this.points,r,a,i,s,o)}}};ui.generateEllipse=function(){return this.nodeShapes.ellipse={renderer:this,name:"ellipse",draw:function(e,n,r,a,i,s){this.renderer.nodeShapeImpl(this.name,e,n,r,a,i)},intersectLine:function(e,n,r,a,i,s,o,l){return BI(i,s,e,n,r/2+o,a/2+o)},checkPoint:function(e,n,r,a,i,s,o,l){return Cs(e,n,a,i,s,o,r)}}};ui.generateRoundPolygon=function(t,e){return this.nodeShapes[t]={renderer:this,name:t,points:e,getOrCreateCorners:function(r,a,i,s,o,l,u){if(l[u]!==void 0&&l[u+"-cx"]===r&&l[u+"-cy"]===a)return l[u];l[u]=new Array(e.length/2),l[u+"-cx"]=r,l[u+"-cy"]=a;var d=i/2,f=s/2;o=o==="auto"?$C(i,s):o;for(var h=new Array(e.length/2),v=0;v<e.length/2;v++)h[v]={x:r+d*e[v*2],y:a+f*e[v*2+1]};var p,y,b,m,g=h.length;for(y=h[g-1],p=0;p<g;p++)b=h[p%g],m=h[(p+1)%g],l[u][p]=xy(y,b,m,o),y=b,b=m;return l[u]},draw:function(r,a,i,s,o,l,u){this.renderer.nodeShapeImpl("round-polygon",r,a,i,s,o,this.points,this.getOrCreateCorners(a,i,s,o,l,u,"drawCorners"))},intersectLine:function(r,a,i,s,o,l,u,d,f){return OI(o,l,this.points,r,a,i,s,u,this.getOrCreateCorners(r,a,i,s,d,f,"corners"))},checkPoint:function(r,a,i,s,o,l,u,d,f){return DI(r,a,this.points,l,u,s,o,this.getOrCreateCorners(l,u,s,o,d,f,"corners"))}}};ui.generateRoundRectangle=function(){return this.nodeShapes["round-rectangle"]=this.nodeShapes.roundrectangle={renderer:this,name:"round-rectangle",points:kr(4,0),draw:function(e,n,r,a,i,s){this.renderer.nodeShapeImpl(this.name,e,n,r,a,i,this.points,s)},intersectLine:function(e,n,r,a,i,s,o,l){return FC(i,s,e,n,r,a,o,l)},checkPoint:function(e,n,r,a,i,s,o,l){var u=a/2,d=i/2;l=l==="auto"?Wi(a,i):l,l=Math.min(u,d,l);var f=l*2;return!!(ri(e,n,this.points,s,o,a,i-f,[0,-1],r)||ri(e,n,this.points,s,o,a-f,i,[0,-1],r)||Cs(e,n,f,f,s-u+l,o-d+l,r)||Cs(e,n,f,f,s+u-l,o-d+l,r)||Cs(e,n,f,f,s+u-l,o+d-l,r)||Cs(e,n,f,f,s-u+l,o+d-l,r))}}};ui.generateCutRectangle=function(){return this.nodeShapes["cut-rectangle"]=this.nodeShapes.cutrectangle={renderer:this,name:"cut-rectangle",cornerLength:uy(),points:kr(4,0),draw:function(e,n,r,a,i,s){this.renderer.nodeShapeImpl(this.name,e,n,r,a,i,null,s)},generateCutTrianglePts:function(e,n,r,a,i){var s=i==="auto"?this.cornerLength:i,o=n/2,l=e/2,u=r-l,d=r+l,f=a-o,h=a+o;return{topLeft:[u,f+s,u+s,f,u+s,f+s],topRight:[d-s,f,d,f+s,d-s,f+s],bottomRight:[d,h-s,d-s,h,d-s,h-s],bottomLeft:[u+s,h,u,h-s,u+s,h-s]}},intersectLine:function(e,n,r,a,i,s,o,l){var u=this.generateCutTrianglePts(r+2*o,a+2*o,e,n,l),d=[].concat.apply([],[u.topLeft.splice(0,4),u.topRight.splice(0,4),u.bottomRight.splice(0,4),u.bottomLeft.splice(0,4)]);return Eu(i,s,d,e,n)},checkPoint:function(e,n,r,a,i,s,o,l){var u=l==="auto"?this.cornerLength:l;if(ri(e,n,this.points,s,o,a,i-2*u,[0,-1],r)||ri(e,n,this.points,s,o,a-2*u,i,[0,-1],r))return!0;var d=this.generateCutTrianglePts(a,i,s,o);return zr(e,n,d.topLeft)||zr(e,n,d.topRight)||zr(e,n,d.bottomRight)||zr(e,n,d.bottomLeft)}}};ui.generateBarrel=function(){return this.nodeShapes.barrel={renderer:this,name:"barrel",points:kr(4,0),draw:function(e,n,r,a,i,s){this.renderer.nodeShapeImpl(this.name,e,n,r,a,i)},intersectLine:function(e,n,r,a,i,s,o,l){var u=.15,d=.5,f=.85,h=this.generateBarrelBezierPts(r+2*o,a+2*o,e,n),v=function(b){var m=Ro({x:b[0],y:b[1]},{x:b[2],y:b[3]},{x:b[4],y:b[5]},u),g=Ro({x:b[0],y:b[1]},{x:b[2],y:b[3]},{x:b[4],y:b[5]},d),w=Ro({x:b[0],y:b[1]},{x:b[2],y:b[3]},{x:b[4],y:b[5]},f);return[b[0],b[1],m.x,m.y,g.x,g.y,w.x,w.y,b[4],b[5]]},p=[].concat(v(h.topLeft),v(h.topRight),v(h.bottomRight),v(h.bottomLeft));return Eu(i,s,p,e,n)},generateBarrelBezierPts:function(e,n,r,a){var i=n/2,s=e/2,o=r-s,l=r+s,u=a-i,d=a+i,f=Lg(e,n),h=f.heightOffset,v=f.widthOffset,p=f.ctrlPtOffsetPct*e,y={topLeft:[o,u+h,o+p,u,o+v,u],topRight:[l-v,u,l-p,u,l,u+h],bottomRight:[l,d-h,l-p,d,l-v,d],bottomLeft:[o+v,d,o+p,d,o,d-h]};return y.topLeft.isTop=!0,y.topRight.isTop=!0,y.bottomLeft.isBottom=!0,y.bottomRight.isBottom=!0,y},checkPoint:function(e,n,r,a,i,s,o,l){var u=Lg(a,i),d=u.heightOffset,f=u.widthOffset;if(ri(e,n,this.points,s,o,a,i-2*d,[0,-1],r)||ri(e,n,this.points,s,o,a-2*f,i,[0,-1],r))return!0;for(var h=this.generateBarrelBezierPts(a,i,s,o),v=function(T,N,P){var R=P[4],I=P[2],D=P[0],$=P[5],H=P[1],V=Math.min(R,D),U=Math.max(R,D),F=Math.min($,H),G=Math.max($,H);if(V<=T&&T<=U&&F<=N&&N<=G){var z=zI(R,I,D),_=RI(z[0],z[1],z[2],T),K=_.filter(function(ie){return 0<=ie&&ie<=1});if(K.length>0)return K[0]}return null},p=Object.keys(h),y=0;y<p.length;y++){var b=p[y],m=h[b],g=v(e,n,m);if(g!=null){var w=m[5],x=m[3],E=m[1],S=Xn(w,x,E,g);if(m.isTop&&S<=n||m.isBottom&&n<=S)return!0}}return!1}}};ui.generateBottomRoundrectangle=function(){return this.nodeShapes["bottom-round-rectangle"]=this.nodeShapes.bottomroundrectangle={renderer:this,name:"bottom-round-rectangle",points:kr(4,0),draw:function(e,n,r,a,i,s){this.renderer.nodeShapeImpl(this.name,e,n,r,a,i,this.points,s)},intersectLine:function(e,n,r,a,i,s,o,l){var u=e-(r/2+o),d=n-(a/2+o),f=d,h=e+(r/2+o),v=Pi(i,s,e,n,u,d,h,f,!1);return v.length>0?v:FC(i,s,e,n,r,a,o,l)},checkPoint:function(e,n,r,a,i,s,o,l){l=l==="auto"?Wi(a,i):l;var u=2*l;if(ri(e,n,this.points,s,o,a,i-u,[0,-1],r)||ri(e,n,this.points,s,o,a-u,i,[0,-1],r))return!0;var d=a/2+2*r,f=i/2+2*r,h=[s-d,o-f,s-d,o,s+d,o,s+d,o-f];return!!(zr(e,n,h)||Cs(e,n,u,u,s+a/2-l,o+i/2-l,r)||Cs(e,n,u,u,s-a/2+l,o+i/2-l,r))}}};ui.registerNodeShapes=function(){var t=this.nodeShapes={},e=this;this.generateEllipse(),this.generatePolygon("triangle",kr(3,0)),this.generateRoundPolygon("round-triangle",kr(3,0)),this.generatePolygon("rectangle",kr(4,0)),t.square=t.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",kr(5,0)),this.generateRoundPolygon("round-pentagon",kr(5,0)),this.generatePolygon("hexagon",kr(6,0)),this.generateRoundPolygon("round-hexagon",kr(6,0)),this.generatePolygon("heptagon",kr(7,0)),this.generateRoundPolygon("round-heptagon",kr(7,0)),this.generatePolygon("octagon",kr(8,0)),this.generateRoundPolygon("round-octagon",kr(8,0));var r=new Array(20);{var a=Ig(5,0),i=Ig(5,Math.PI/5),s=.5*(3-Math.sqrt(5));s*=1.57;for(var o=0;o<i.length/2;o++)i[o*2]*=s,i[o*2+1]*=s;for(var o=0;o<20/4;o++)r[o*4]=a[o*2],r[o*4+1]=a[o*2+1],r[o*4+2]=i[o*2],r[o*4+3]=i[o*2+1]}r=_C(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 l=[-1,-1,.25,-1,1,0,.25,1,-1,1];this.generatePolygon("tag",l),this.generateRoundPolygon("round-tag",l)}t.makePolygon=function(u){var d=u.join("$"),f="polygon-"+d,h;return(h=this[f])?h:e.generatePolygon(f,u)}};var Gu={};Gu.timeToRender=function(){return this.redrawTotalTime/this.redrawCount};Gu.redraw=function(t){t=t||BC();var e=this;e.averageRedrawTime===void 0&&(e.averageRedrawTime=0),e.lastRedrawTime===void 0&&(e.lastRedrawTime=0),e.lastDrawTime===void 0&&(e.lastDrawTime=0),e.requestedFrame=!0,e.renderOptions=t};Gu.beforeRender=function(t,e){if(!this.destroyed){e==null&&yn("Priority is not optional for beforeRender");var n=this.beforeRenderCallbacks;n.push({fn:t,priority:e}),n.sort(function(r,a){return a.priority-r.priority})}};var Mw=function(e,n,r){for(var a=e.beforeRenderCallbacks,i=0;i<a.length;i++)a[i].fn(n,r)};Gu.startRenderLoop=function(){var t=this,e=t.cy;if(!t.renderLoopStarted){t.renderLoopStarted=!0;var n=function(a){if(!t.destroyed){if(!e.batching())if(t.requestedFrame&&!t.skipFrame){Mw(t,!0,a);var i=ni();t.render(t.renderOptions);var s=t.lastDrawTime=ni();t.averageRedrawTime===void 0&&(t.averageRedrawTime=s-i),t.redrawCount===void 0&&(t.redrawCount=0),t.redrawCount++,t.redrawTotalTime===void 0&&(t.redrawTotalTime=0);var o=s-i;t.redrawTotalTime+=o,t.lastRedrawTime=o,t.averageRedrawTime=t.averageRedrawTime/2+o/2,t.requestedFrame=!1}else Mw(t,!1,a);t.skipFrame=!1,Vd(n)}};Vd(n)}};var rB=function(e){this.init(e)},VS=rB,sl=VS.prototype;sl.clientFunctions=["redrawHint","render","renderTo","matchCanvasSize","nodeShapeImpl","arrowShapeImpl"];sl.init=function(t){var e=this;e.options=t,e.cy=t.cy;var n=e.container=t.cy.container(),r=e.cy.window();if(r){var a=r.document,i=a.head,s="__________cytoscape_stylesheet",o="__________cytoscape_container",l=a.getElementById(s)!=null;if(n.className.indexOf(o)<0&&(n.className=(n.className||"")+" "+o),!l){var u=a.createElement("style");u.id=s,u.textContent="."+o+" { position: relative; }",i.insertBefore(u,i.children[0])}var d=r.getComputedStyle(n),f=d.getPropertyValue("position");f==="static"&&Jt("A Cytoscape container has style position:static and so can not use UI extensions properly")}e.selection=[void 0,void 0,void 0,void 0,0],e.bezierProjPcts=[.05,.225,.4,.5,.6,.775,.95],e.hoverData={down:null,last:null,downTime:null,triggerMode:null,dragging:!1,initialPan:[null,null],capture:!1},e.dragData={possibleDragElements:[]},e.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]},e.redraws=0,e.showFps=t.showFps,e.debug=t.debug,e.webgl=t.webgl,e.hideEdgesOnViewport=t.hideEdgesOnViewport,e.textureOnViewport=t.textureOnViewport,e.wheelSensitivity=t.wheelSensitivity,e.motionBlurEnabled=t.motionBlur,e.forcedPixelRatio=_e(t.pixelRatio)?t.pixelRatio:null,e.motionBlur=t.motionBlur,e.motionBlurOpacity=t.motionBlurOpacity,e.motionBlurTransparency=1-e.motionBlurOpacity,e.motionBlurPxRatio=1,e.mbPxRBlurry=1,e.minMbLowQualFrames=4,e.fullQualityMb=!1,e.clearedForMotionBlur=[],e.desktopTapThreshold=t.desktopTapThreshold,e.desktopTapThreshold2=t.desktopTapThreshold*t.desktopTapThreshold,e.touchTapThreshold=t.touchTapThreshold,e.touchTapThreshold2=t.touchTapThreshold*t.touchTapThreshold,e.tapholdDuration=500,e.bindings=[],e.beforeRenderCallbacks=[],e.beforeRenderPriorities={animations:400,eleCalcs:300,eleTxrDeq:200,lyrTxrDeq:150,lyrTxrSkip:100},e.registerNodeShapes(),e.registerArrowShapes(),e.registerCalculationListeners()};sl.notify=function(t,e){var n=this,r=n.cy;if(!this.destroyed){if(t==="init"){n.load();return}if(t==="destroy"){n.destroy();return}(t==="add"||t==="remove"||t==="move"&&r.hasCompoundNodes()||t==="load"||t==="zorder"||t==="mount")&&n.invalidateCachedZSortedEles(),t==="viewport"&&n.redrawHint("select",!0),t==="gc"&&n.redrawHint("gc",!0),(t==="load"||t==="resize"||t==="mount")&&(n.invalidateContainerClientCoordsCache(),n.matchCanvasSize(n.container)),n.redrawHint("eles",!0),n.redrawHint("drag",!0),this.startRenderLoop(),this.redraw()}};sl.destroy=function(){var t=this;t.destroyed=!0,t.cy.stopAnimationLoop();for(var e=0;e<t.bindings.length;e++){var n=t.bindings[e],r=n,a=r.target;(a.off||a.removeEventListener).apply(a,r.args)}if(t.bindings=[],t.beforeRenderCallbacks=[],t.onUpdateEleCalcsFns=[],t.removeObserver&&t.removeObserver.disconnect(),t.styleObserver&&t.styleObserver.disconnect(),t.resizeObserver&&t.resizeObserver.disconnect(),t.labelCalcDiv)try{document.body.removeChild(t.labelCalcDiv)}catch{}};sl.isHeadless=function(){return!1};[by,FS,_S,il,ui,Gu].forEach(function(t){pt(sl,t)});var hp=1e3/60,US={setupDequeueing:function(e){return function(){var r=this,a=this.renderer;if(!r.dequeueingSetup){r.dequeueingSetup=!0;var i=Uu(function(){a.redrawHint("eles",!0),a.redrawHint("drag",!0),a.redraw()},e.deqRedrawThreshold),s=function(u,d){var f=ni(),h=a.averageRedrawTime,v=a.lastRedrawTime,p=[],y=a.cy.extent(),b=a.getPixelRatio();for(u||a.flushRenderedStyleQueue();;){var m=ni(),g=m-f,w=m-d;if(v<hp){var x=hp-(u?h:0);if(w>=e.deqFastCost*x)break}else if(u){if(g>=e.deqCost*v||g>=e.deqAvgCost*h)break}else if(w>=e.deqNoDrawCost*hp)break;var E=e.deq(r,b,y);if(E.length>0)for(var S=0;S<E.length;S++)p.push(E[S]);else break}p.length>0&&(e.onDeqd(r,p),!u&&e.shouldRedraw(r,p,b,y)&&i())},o=e.priority||ay;a.beforeRender(s,o(r))}}}},aB=function(){function t(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Ud;es(this,t),this.idsByKey=new Xa,this.keyForId=new Xa,this.cachesByLvl=new Xa,this.lvls=[],this.getKey=e,this.doesEleInvalidateKey=n}return ts(t,[{key:"getIdsFor",value:function(n){n==null&&yn("Can not get id list for null key");var r=this.idsByKey,a=this.idsByKey.get(n);return a||(a=new tl,r.set(n,a)),a}},{key:"addIdForKey",value:function(n,r){n!=null&&this.getIdsFor(n).add(r)}},{key:"deleteIdForKey",value:function(n,r){n!=null&&this.getIdsFor(n).delete(r)}},{key:"getNumberOfIdsForKey",value:function(n){return n==null?0:this.getIdsFor(n).size}},{key:"updateKeyMappingFor",value:function(n){var r=n.id(),a=this.keyForId.get(r),i=this.getKey(n);this.deleteIdForKey(a,r),this.addIdForKey(i,r),this.keyForId.set(r,i)}},{key:"deleteKeyMappingFor",value:function(n){var r=n.id(),a=this.keyForId.get(r);this.deleteIdForKey(a,r),this.keyForId.delete(r)}},{key:"keyHasChangedFor",value:function(n){var r=n.id(),a=this.keyForId.get(r),i=this.getKey(n);return a!==i}},{key:"isInvalid",value:function(n){return this.keyHasChangedFor(n)||this.doesEleInvalidateKey(n)}},{key:"getCachesAt",value:function(n){var r=this.cachesByLvl,a=this.lvls,i=r.get(n);return i||(i=new Xa,r.set(n,i),a.push(n)),i}},{key:"getCache",value:function(n,r){return this.getCachesAt(r).get(n)}},{key:"get",value:function(n,r){var a=this.getKey(n),i=this.getCache(a,r);return i!=null&&this.updateKeyMappingFor(n),i}},{key:"getForCachedKey",value:function(n,r){var a=this.keyForId.get(n.id()),i=this.getCache(a,r);return i}},{key:"hasCache",value:function(n,r){return this.getCachesAt(r).has(n)}},{key:"has",value:function(n,r){var a=this.getKey(n);return this.hasCache(a,r)}},{key:"setCache",value:function(n,r,a){a.key=n,this.getCachesAt(r).set(n,a)}},{key:"set",value:function(n,r,a){var i=this.getKey(n);this.setCache(i,r,a),this.updateKeyMappingFor(n)}},{key:"deleteCache",value:function(n,r){this.getCachesAt(r).delete(n)}},{key:"delete",value:function(n,r){var a=this.getKey(n);this.deleteCache(a,r)}},{key:"invalidateKey",value:function(n){var r=this;this.lvls.forEach(function(a){return r.deleteCache(n,a)})}},{key:"invalidate",value:function(n){var r=n.id(),a=this.keyForId.get(r);this.deleteKeyMappingFor(n);var i=this.doesEleInvalidateKey(n);return i&&this.invalidateKey(a),i||this.getNumberOfIdsForKey(a)===0}}])}(),Ow=25,zc=50,ld=-4,Hg=3,qS=7.99,iB=8,sB=1024,oB=1024,lB=1024,uB=.2,cB=.8,dB=10,fB=.15,hB=.1,vB=.9,pB=.9,gB=100,mB=1,wo={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},yB=ur({getKey:null,doesEleInvalidateKey:Ud,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:LC,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),Ml=function(e,n){var r=this;r.renderer=e,r.onDequeues=[];var a=yB(n);pt(r,a),r.lookup=new aB(a.getKey,a.doesEleInvalidateKey),r.setupDequeueing()},Yn=Ml.prototype;Yn.reasons=wo;Yn.getTextureQueue=function(t){var e=this;return e.eleImgCaches=e.eleImgCaches||{},e.eleImgCaches[t]=e.eleImgCaches[t]||[]};Yn.getRetiredTextureQueue=function(t){var e=this,n=e.eleImgCaches.retired=e.eleImgCaches.retired||{},r=n[t]=n[t]||[];return r};Yn.getElementQueue=function(){var t=this,e=t.eleCacheQueue=t.eleCacheQueue||new qu(function(n,r){return r.reqs-n.reqs});return e};Yn.getElementKeyToQueue=function(){var t=this,e=t.eleKeyToCacheQueue=t.eleKeyToCacheQueue||{};return e};Yn.getElement=function(t,e,n,r,a){var i=this,s=this.renderer,o=s.cy.zoom(),l=this.lookup;if(!e||e.w===0||e.h===0||isNaN(e.w)||isNaN(e.h)||!t.visible()||t.removed()||!i.allowEdgeTxrCaching&&t.isEdge()||!i.allowParentTxrCaching&&t.isParent())return null;if(r==null&&(r=Math.ceil(sy(o*n))),r<ld)r=ld;else if(o>=qS||r>Hg)return null;var u=Math.pow(2,r),d=e.h*u,f=e.w*u,h=s.eleTextBiggerThanMin(t,u);if(!this.isVisible(t,h))return null;var v=l.get(t,r);if(v&&v.invalidated&&(v.invalidated=!1,v.texture.invalidatedWidth-=v.width),v)return v;var p;if(d<=Ow?p=Ow:d<=zc?p=zc:p=Math.ceil(d/zc)*zc,d>lB||f>oB)return null;var y=i.getTextureQueue(p),b=y[y.length-2],m=function(){return i.recycleTexture(p,f)||i.addTexture(p,f)};b||(b=y[y.length-1]),b||(b=m()),b.width-b.usedWidth<f&&(b=m());for(var g=function(V){return V&&V.scaledLabelShown===h},w=a&&a===wo.dequeue,x=a&&a===wo.highQuality,E=a&&a===wo.downscale,S,C=r+1;C<=Hg;C++){var T=l.get(t,C);if(T){S=T;break}}var N=S&&S.level===r+1?S:null,P=function(){b.context.drawImage(N.texture.canvas,N.x,0,N.width,N.height,b.usedWidth,0,f,d)};if(b.context.setTransform(1,0,0,1,0,0),b.context.clearRect(b.usedWidth,0,f,p),g(N))P();else if(g(S))if(x){for(var R=S.level;R>r;R--)N=i.getElement(t,e,n,R,wo.downscale);P()}else return i.queueElement(t,S.level-1),S;else{var I;if(!w&&!x&&!E)for(var D=r-1;D>=ld;D--){var $=l.get(t,D);if($){I=$;break}}if(g(I))return i.queueElement(t,r),I;b.context.translate(b.usedWidth,0),b.context.scale(u,u),this.drawElement(b.context,t,e,h,!1),b.context.scale(1/u,1/u),b.context.translate(-b.usedWidth,0)}return v={x:b.usedWidth,texture:b,level:r,scale:u,width:f,height:d,scaledLabelShown:h},b.usedWidth+=Math.ceil(f+iB),b.eleCaches.push(v),l.set(t,r,v),i.checkTextureFullness(b),v};Yn.invalidateElements=function(t){for(var e=0;e<t.length;e++)this.invalidateElement(t[e])};Yn.invalidateElement=function(t){var e=this,n=e.lookup,r=[],a=n.isInvalid(t);if(a){for(var i=ld;i<=Hg;i++){var s=n.getForCachedKey(t,i);s&&r.push(s)}var o=n.invalidate(t);if(o)for(var l=0;l<r.length;l++){var u=r[l],d=u.texture;d.invalidatedWidth+=u.width,u.invalidated=!0,e.checkTextureUtility(d)}e.removeFromQueue(t)}};Yn.checkTextureUtility=function(t){t.invalidatedWidth>=uB*t.width&&this.retireTexture(t)};Yn.checkTextureFullness=function(t){var e=this,n=e.getTextureQueue(t.height);t.usedWidth/t.width>cB&&t.fullnessChecks>=dB?Hi(n,t):t.fullnessChecks++};Yn.retireTexture=function(t){var e=this,n=t.height,r=e.getTextureQueue(n),a=this.lookup;Hi(r,t),t.retired=!0;for(var i=t.eleCaches,s=0;s<i.length;s++){var o=i[s];a.deleteCache(o.key,o.level)}iy(i);var l=e.getRetiredTextureQueue(n);l.push(t)};Yn.addTexture=function(t,e){var n=this,r=n.getTextureQueue(t),a={};return r.push(a),a.eleCaches=[],a.height=t,a.width=Math.max(sB,e),a.usedWidth=0,a.invalidatedWidth=0,a.fullnessChecks=0,a.canvas=n.renderer.makeOffscreenCanvas(a.width,a.height),a.context=a.canvas.getContext("2d"),a};Yn.recycleTexture=function(t,e){for(var n=this,r=n.getTextureQueue(t),a=n.getRetiredTextureQueue(t),i=0;i<a.length;i++){var s=a[i];if(s.width>=e)return s.retired=!1,s.usedWidth=0,s.invalidatedWidth=0,s.fullnessChecks=0,iy(s.eleCaches),s.context.setTransform(1,0,0,1,0,0),s.context.clearRect(0,0,s.width,s.height),Hi(a,s),r.push(s),s}};Yn.queueElement=function(t,e){var n=this,r=n.getElementQueue(),a=n.getElementKeyToQueue(),i=this.getKey(t),s=a[i];if(s)s.level=Math.max(s.level,e),s.eles.merge(t),s.reqs++,r.updateItem(s);else{var o={eles:t.spawn().merge(t),level:e,reqs:1,key:i};r.push(o),a[i]=o}};Yn.dequeue=function(t){for(var e=this,n=e.getElementQueue(),r=e.getElementKeyToQueue(),a=[],i=e.lookup,s=0;s<mB&&n.size()>0;s++){var o=n.pop(),l=o.key,u=o.eles[0],d=i.hasCache(u,o.level);if(r[l]=null,d)continue;a.push(o);var f=e.getBoundingBox(u);e.getElement(u,f,t,o.level,wo.dequeue)}return a};Yn.removeFromQueue=function(t){var e=this,n=e.getElementQueue(),r=e.getElementKeyToQueue(),a=this.getKey(t),i=r[a];i!=null&&(i.eles.length===1?(i.reqs=ry,n.updateItem(i),n.pop(),r[a]=null):i.eles.unmerge(t))};Yn.onDequeue=function(t){this.onDequeues.push(t)};Yn.offDequeue=function(t){Hi(this.onDequeues,t)};Yn.setupDequeueing=US.setupDequeueing({deqRedrawThreshold:gB,deqCost:fB,deqAvgCost:hB,deqNoDrawCost:vB,deqFastCost:pB,deq:function(e,n,r){return e.dequeue(n,r)},onDeqd:function(e,n){for(var r=0;r<e.onDequeues.length;r++){var a=e.onDequeues[r];a(n)}},shouldRedraw:function(e,n,r,a){for(var i=0;i<n.length;i++)for(var s=n[i].eles,o=0;o<s.length;o++){var l=s[o].boundingBox();if(ly(l,a))return!0}return!1},priority:function(e){return e.renderer.beforeRenderPriorities.eleTxrDeq}});var bB=1,Kl=-4,Qd=2,xB=3.99,wB=50,kB=50,EB=.15,CB=.1,SB=.9,jB=.9,TB=1,zw=250,NB=4e3*4e3,Fw=32767,PB=!0,HS=function(e){var n=this,r=n.renderer=e,a=r.cy;n.layersByLevel={},n.firstGet=!0,n.lastInvalidationTime=ni()-2*zw,n.skipping=!1,n.eleTxrDeqs=a.collection(),n.scheduleElementRefinement=Uu(function(){n.refineElementTextures(n.eleTxrDeqs),n.eleTxrDeqs.unmerge(n.eleTxrDeqs)},kB),r.beforeRender(function(s,o){o-n.lastInvalidationTime<=zw?n.skipping=!0:n.skipping=!1},r.beforeRenderPriorities.lyrTxrSkip);var i=function(o,l){return l.reqs-o.reqs};n.layersQueue=new qu(i),n.setupDequeueing()},cr=HS.prototype,_w=0,RB=Math.pow(2,53)-1;cr.makeLayer=function(t,e){var n=Math.pow(2,e),r=Math.ceil(t.w*n),a=Math.ceil(t.h*n),i=this.renderer.makeOffscreenCanvas(r,a),s={id:_w=++_w%RB,bb:t,level:e,width:r,height:a,canvas:i,context:i.getContext("2d"),eles:[],elesQueue:[],reqs:0},o=s.context,l=-s.bb.x1,u=-s.bb.y1;return o.scale(n,n),o.translate(l,u),s};cr.getLayers=function(t,e,n){var r=this,a=r.renderer,i=a.cy,s=i.zoom(),o=r.firstGet;if(r.firstGet=!1,n==null){if(n=Math.ceil(sy(s*e)),n<Kl)n=Kl;else if(s>=xB||n>Qd)return null}r.validateLayersElesOrdering(n,t);var l=r.layersByLevel,u=Math.pow(2,n),d=l[n]=l[n]||[],f,h=r.levelIsComplete(n,t),v,p=function(){var P=function(H){if(r.validateLayersElesOrdering(H,t),r.levelIsComplete(H,t))return v=l[H],!0},R=function(H){if(!v)for(var V=n+H;Kl<=V&&V<=Qd&&!P(V);V+=H);};R(1),R(-1);for(var I=d.length-1;I>=0;I--){var D=d[I];D.invalid&&Hi(d,D)}};if(!h)p();else return d;var y=function(){if(!f){f=jr();for(var P=0;P<t.length;P++)CI(f,t[P].boundingBox())}return f},b=function(P){P=P||{};var R=P.after;y();var I=Math.ceil(f.w*u),D=Math.ceil(f.h*u);if(I>Fw||D>Fw)return null;var $=I*D;if($>NB)return null;var H=r.makeLayer(f,n);if(R!=null){var V=d.indexOf(R)+1;d.splice(V,0,H)}else(P.insert===void 0||P.insert)&&d.unshift(H);return H};if(r.skipping&&!o)return null;for(var m=null,g=t.length/bB,w=!o,x=0;x<t.length;x++){var E=t[x],S=E._private.rscratch,C=S.imgLayerCaches=S.imgLayerCaches||{},T=C[n];if(T){m=T;continue}if((!m||m.eles.length>=g||!zC(m.bb,E.boundingBox()))&&(m=b({insert:!0,after:m}),!m))return null;v||w?r.queueLayer(m,E):r.drawEleInLayer(m,E,n,e),m.eles.push(E),C[n]=m}return v||(w?null:d)};cr.getEleLevelForLayerLevel=function(t,e){return t};cr.drawEleInLayer=function(t,e,n,r){var a=this,i=this.renderer,s=t.context,o=e.boundingBox();o.w===0||o.h===0||!e.visible()||(n=a.getEleLevelForLayerLevel(n,r),i.setImgSmoothing(s,!1),i.drawCachedElement(s,e,null,null,n,PB),i.setImgSmoothing(s,!0))};cr.levelIsComplete=function(t,e){var n=this,r=n.layersByLevel[t];if(!r||r.length===0)return!1;for(var a=0,i=0;i<r.length;i++){var s=r[i];if(s.reqs>0||s.invalid)return!1;a+=s.eles.length}return a===e.length};cr.validateLayersElesOrdering=function(t,e){var n=this.layersByLevel[t];if(n)for(var r=0;r<n.length;r++){for(var a=n[r],i=-1,s=0;s<e.length;s++)if(a.eles[0]===e[s]){i=s;break}if(i<0){this.invalidateLayer(a);continue}for(var o=i,s=0;s<a.eles.length;s++)if(a.eles[s]!==e[o+s]){this.invalidateLayer(a);break}}};cr.updateElementsInLayers=function(t,e){for(var n=this,r=Fu(t[0]),a=0;a<t.length;a++)for(var i=r?null:t[a],s=r?t[a]:t[a].ele,o=s._private.rscratch,l=o.imgLayerCaches=o.imgLayerCaches||{},u=Kl;u<=Qd;u++){var d=l[u];d&&(i&&n.getEleLevelForLayerLevel(d.level)!==i.level||e(d,s,i))}};cr.haveLayers=function(){for(var t=this,e=!1,n=Kl;n<=Qd;n++){var r=t.layersByLevel[n];if(r&&r.length>0){e=!0;break}}return e};cr.invalidateElements=function(t){var e=this;t.length!==0&&(e.lastInvalidationTime=ni(),!(t.length===0||!e.haveLayers())&&e.updateElementsInLayers(t,function(r,a,i){e.invalidateLayer(r)}))};cr.invalidateLayer=function(t){if(this.lastInvalidationTime=ni(),!t.invalid){var e=t.level,n=t.eles,r=this.layersByLevel[e];Hi(r,t),t.elesQueue=[],t.invalid=!0,t.replacement&&(t.replacement.invalid=!0);for(var a=0;a<n.length;a++){var i=n[a]._private.rscratch.imgLayerCaches;i&&(i[e]=null)}}};cr.refineElementTextures=function(t){var e=this;e.updateElementsInLayers(t,function(r,a,i){var s=r.replacement;if(s||(s=r.replacement=e.makeLayer(r.bb,r.level),s.replaces=r,s.eles=r.eles),!s.reqs)for(var o=0;o<s.eles.length;o++)e.queueLayer(s,s.eles[o])})};cr.enqueueElementRefinement=function(t){this.eleTxrDeqs.merge(t),this.scheduleElementRefinement()};cr.queueLayer=function(t,e){var n=this,r=n.layersQueue,a=t.elesQueue,i=a.hasId=a.hasId||{};if(!t.replacement){if(e){if(i[e.id()])return;a.push(e),i[e.id()]=!0}t.reqs?(t.reqs++,r.updateItem(t)):(t.reqs=1,r.push(t))}};cr.dequeue=function(t){for(var e=this,n=e.layersQueue,r=[],a=0;a<TB&&n.size()!==0;){var i=n.peek();if(i.replacement){n.pop();continue}if(i.replaces&&i!==i.replaces.replacement){n.pop();continue}if(i.invalid){n.pop();continue}var s=i.elesQueue.shift();s&&(e.drawEleInLayer(i,s,i.level,t),a++),r.length===0&&r.push(!0),i.elesQueue.length===0&&(n.pop(),i.reqs=0,i.replaces&&e.applyLayerReplacement(i),e.requestRedraw())}return r};cr.applyLayerReplacement=function(t){var e=this,n=e.layersByLevel[t.level],r=t.replaces,a=n.indexOf(r);if(!(a<0||r.invalid)){n[a]=t;for(var i=0;i<t.eles.length;i++){var s=t.eles[i]._private,o=s.imgLayerCaches=s.imgLayerCaches||{};o&&(o[t.level]=t)}e.requestRedraw()}};cr.requestRedraw=Uu(function(){var t=this.renderer;t.redrawHint("eles",!0),t.redrawHint("drag",!0),t.redraw()},100);cr.setupDequeueing=US.setupDequeueing({deqRedrawThreshold:wB,deqCost:EB,deqAvgCost:CB,deqNoDrawCost:SB,deqFastCost:jB,deq:function(e,n){return e.dequeue(n)},onDeqd:ay,shouldRedraw:LC,priority:function(e){return e.renderer.beforeRenderPriorities.lyrTxrDeq}});var WS={},$w;function IB(t,e){for(var n=0;n<e.length;n++){var r=e[n];t.lineTo(r.x,r.y)}}function LB(t,e,n){for(var r,a=0;a<e.length;a++){var i=e[a];a===0&&(r=i),t.lineTo(i.x,i.y)}t.quadraticCurveTo(n.x,n.y,r.x,r.y)}function Vw(t,e,n){t.beginPath&&t.beginPath();for(var r=e,a=0;a<r.length;a++){var i=r[a];t.lineTo(i.x,i.y)}var s=n,o=n[0];t.moveTo(o.x,o.y);for(var a=1;a<s.length;a++){var i=s[a];t.lineTo(i.x,i.y)}t.closePath&&t.closePath()}function AB(t,e,n,r,a){t.beginPath&&t.beginPath(),t.arc(n,r,a,0,Math.PI*2,!1);var i=e,s=i[0];t.moveTo(s.x,s.y);for(var o=0;o<i.length;o++){var l=i[o];t.lineTo(l.x,l.y)}t.closePath&&t.closePath()}function DB(t,e,n,r){t.arc(e,n,r,0,Math.PI*2,!1)}WS.arrowShapeImpl=function(t){return($w||($w={polygon:IB,"triangle-backcurve":LB,"triangle-tee":Vw,"circle-triangle":AB,"triangle-cross":Vw,circle:DB}))[t]};var Va={};Va.drawElement=function(t,e,n,r,a,i){var s=this;e.isNode()?s.drawNode(t,e,n,r,a,i):s.drawEdge(t,e,n,r,a,i)};Va.drawElementOverlay=function(t,e){var n=this;e.isNode()?n.drawNodeOverlay(t,e):n.drawEdgeOverlay(t,e)};Va.drawElementUnderlay=function(t,e){var n=this;e.isNode()?n.drawNodeUnderlay(t,e):n.drawEdgeUnderlay(t,e)};Va.drawCachedElementPortion=function(t,e,n,r,a,i,s,o){var l=this,u=n.getBoundingBox(e);if(!(u.w===0||u.h===0)){var d=n.getElement(e,u,r,a,i);if(d!=null){var f=o(l,e);if(f===0)return;var h=s(l,e),v=u.x1,p=u.y1,y=u.w,b=u.h,m,g,w,x,E;if(h!==0){var S=n.getRotationPoint(e);w=S.x,x=S.y,t.translate(w,x),t.rotate(h),E=l.getImgSmoothing(t),E||l.setImgSmoothing(t,!0);var C=n.getRotationOffset(e);m=C.x,g=C.y}else m=v,g=p;var T;f!==1&&(T=t.globalAlpha,t.globalAlpha=T*f),t.drawImage(d.texture.canvas,d.x,0,d.width,d.height,m,g,y,b),f!==1&&(t.globalAlpha=T),h!==0&&(t.rotate(-h),t.translate(-w,-x),E||l.setImgSmoothing(t,!1))}else n.drawElement(t,e)}};var BB=function(){return 0},MB=function(e,n){return e.getTextAngle(n,null)},OB=function(e,n){return e.getTextAngle(n,"source")},zB=function(e,n){return e.getTextAngle(n,"target")},FB=function(e,n){return n.effectiveOpacity()},vp=function(e,n){return n.pstyle("text-opacity").pfValue*n.effectiveOpacity()};Va.drawCachedElement=function(t,e,n,r,a,i){var s=this,o=s.data,l=o.eleTxrCache,u=o.lblTxrCache,d=o.slbTxrCache,f=o.tlbTxrCache,h=e.boundingBox(),v=i===!0?l.reasons.highQuality:null;if(!(h.w===0||h.h===0||!e.visible())&&(!r||ly(h,r))){var p=e.isEdge(),y=e.element()._private.rscratch.badLine;s.drawElementUnderlay(t,e),s.drawCachedElementPortion(t,e,l,n,a,v,BB,FB),(!p||!y)&&s.drawCachedElementPortion(t,e,u,n,a,v,MB,vp),p&&!y&&(s.drawCachedElementPortion(t,e,d,n,a,v,OB,vp),s.drawCachedElementPortion(t,e,f,n,a,v,zB,vp)),s.drawElementOverlay(t,e)}};Va.drawElements=function(t,e){for(var n=this,r=0;r<e.length;r++){var a=e[r];n.drawElement(t,a)}};Va.drawCachedElements=function(t,e,n,r){for(var a=this,i=0;i<e.length;i++){var s=e[i];a.drawCachedElement(t,s,n,r)}};Va.drawCachedNodes=function(t,e,n,r){for(var a=this,i=0;i<e.length;i++){var s=e[i];s.isNode()&&a.drawCachedElement(t,s,n,r)}};Va.drawLayeredElements=function(t,e,n,r){var a=this,i=a.data.lyrTxrCache.getLayers(e,n);if(i)for(var s=0;s<i.length;s++){var o=i[s],l=o.bb;l.w===0||l.h===0||t.drawImage(o.canvas,l.x1,l.y1,l.w,l.h)}else a.drawCachedElements(t,e,n,r)};var ci={};ci.drawEdge=function(t,e,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,s=this,o=e._private.rscratch;if(!(i&&!e.visible())&&!(o.badLine||o.allpts==null||isNaN(o.allpts[0]))){var l;n&&(l=n,t.translate(-l.x1,-l.y1));var u=i?e.pstyle("opacity").value:1,d=i?e.pstyle("line-opacity").value:1,f=e.pstyle("curve-style").value,h=e.pstyle("line-style").value,v=e.pstyle("width").pfValue,p=e.pstyle("line-cap").value,y=e.pstyle("line-outline-width").value,b=e.pstyle("line-outline-color").value,m=u*d,g=u*d,w=function(){var H=arguments.length>0&&arguments[0]!==void 0?arguments[0]:m;f==="straight-triangle"?(s.eleStrokeStyle(t,e,H),s.drawEdgeTrianglePath(e,t,o.allpts)):(t.lineWidth=v,t.lineCap=p,s.eleStrokeStyle(t,e,H),s.drawEdgePath(e,t,o.allpts,h),t.lineCap="butt")},x=function(){var H=arguments.length>0&&arguments[0]!==void 0?arguments[0]:m;if(t.lineWidth=v+y,t.lineCap=p,y>0)s.colorStrokeStyle(t,b[0],b[1],b[2],H);else{t.lineCap="butt";return}f==="straight-triangle"?s.drawEdgeTrianglePath(e,t,o.allpts):(s.drawEdgePath(e,t,o.allpts,h),t.lineCap="butt")},E=function(){a&&s.drawEdgeOverlay(t,e)},S=function(){a&&s.drawEdgeUnderlay(t,e)},C=function(){var H=arguments.length>0&&arguments[0]!==void 0?arguments[0]:g;s.drawArrowheads(t,e,H)},T=function(){s.drawElementText(t,e,null,r)};t.lineJoin="round";var N=e.pstyle("ghost").value==="yes";if(N){var P=e.pstyle("ghost-offset-x").pfValue,R=e.pstyle("ghost-offset-y").pfValue,I=e.pstyle("ghost-opacity").value,D=m*I;t.translate(P,R),w(D),C(D),t.translate(-P,-R)}else x();S(),w(),C(),E(),T(),n&&t.translate(l.x1,l.y1)}};var KS=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(n,r){if(r.visible()){var a=r.pstyle("".concat(e,"-opacity")).value;if(a!==0){var i=this,s=i.usePaths(),o=r._private.rscratch,l=r.pstyle("".concat(e,"-padding")).pfValue,u=2*l,d=r.pstyle("".concat(e,"-color")).value;n.lineWidth=u,o.edgeType==="self"&&!s?n.lineCap="butt":n.lineCap="round",i.colorStrokeStyle(n,d[0],d[1],d[2],a),i.drawEdgePath(r,n,o.allpts,"solid")}}}};ci.drawEdgeOverlay=KS("overlay");ci.drawEdgeUnderlay=KS("underlay");ci.drawEdgePath=function(t,e,n,r){var a=t._private.rscratch,i=e,s,o=!1,l=this.usePaths(),u=t.pstyle("line-dash-pattern").pfValue,d=t.pstyle("line-dash-offset").pfValue;if(l){var f=n.join("$"),h=a.pathCacheKey&&a.pathCacheKey===f;h?(s=e=a.pathCache,o=!0):(s=e=new Path2D,a.pathCacheKey=f,a.pathCache=s)}if(i.setLineDash)switch(r){case"dotted":i.setLineDash([1,1]);break;case"dashed":i.setLineDash(u),i.lineDashOffset=d;break;case"solid":i.setLineDash([]);break}if(!o&&!a.badLine)switch(e.beginPath&&e.beginPath(),e.moveTo(n[0],n[1]),a.edgeType){case"bezier":case"self":case"compound":case"multibezier":for(var v=2;v+3<n.length;v+=4)e.quadraticCurveTo(n[v],n[v+1],n[v+2],n[v+3]);break;case"straight":case"haystack":for(var p=2;p+1<n.length;p+=2)e.lineTo(n[p],n[p+1]);break;case"segments":if(a.isRound){var y=_r(a.roundCorners),b;try{for(y.s();!(b=y.n()).done;){var m=b.value;DS(e,m)}}catch(w){y.e(w)}finally{y.f()}e.lineTo(n[n.length-2],n[n.length-1])}else for(var g=2;g+1<n.length;g+=2)e.lineTo(n[g],n[g+1]);break}e=i,l?e.stroke(s):e.stroke(),e.setLineDash&&e.setLineDash([])};ci.drawEdgeTrianglePath=function(t,e,n){e.fillStyle=e.strokeStyle;for(var r=t.pstyle("width").pfValue,a=0;a+1<n.length;a+=2){var i=[n[a+2]-n[a],n[a+3]-n[a+1]],s=Math.sqrt(i[0]*i[0]+i[1]*i[1]),o=[i[1]/s,-i[0]/s],l=[o[0]*r/2,o[1]*r/2];e.beginPath(),e.moveTo(n[a]-l[0],n[a+1]-l[1]),e.lineTo(n[a]+l[0],n[a+1]+l[1]),e.lineTo(n[a+2],n[a+3]),e.closePath(),e.fill()}};ci.drawArrowheads=function(t,e,n){var r=e._private.rscratch,a=r.edgeType==="haystack";a||this.drawArrowhead(t,e,"source",r.arrowStartX,r.arrowStartY,r.srcArrowAngle,n),this.drawArrowhead(t,e,"mid-target",r.midX,r.midY,r.midtgtArrowAngle,n),this.drawArrowhead(t,e,"mid-source",r.midX,r.midY,r.midsrcArrowAngle,n),a||this.drawArrowhead(t,e,"target",r.arrowEndX,r.arrowEndY,r.tgtArrowAngle,n)};ci.drawArrowhead=function(t,e,n,r,a,i,s){if(!(isNaN(r)||r==null||isNaN(a)||a==null||isNaN(i)||i==null)){var o=this,l=e.pstyle(n+"-arrow-shape").value;if(l!=="none"){var u=e.pstyle(n+"-arrow-fill").value==="hollow"?"both":"filled",d=e.pstyle(n+"-arrow-fill").value,f=e.pstyle("width").pfValue,h=e.pstyle(n+"-arrow-width"),v=h.value==="match-line"?f:h.pfValue;h.units==="%"&&(v*=f);var p=e.pstyle("opacity").value;s===void 0&&(s=p);var y=t.globalCompositeOperation;(s!==1||d==="hollow")&&(t.globalCompositeOperation="destination-out",o.colorFillStyle(t,255,255,255,1),o.colorStrokeStyle(t,255,255,255,1),o.drawArrowShape(e,t,u,f,l,v,r,a,i),t.globalCompositeOperation=y);var b=e.pstyle(n+"-arrow-color").value;o.colorFillStyle(t,b[0],b[1],b[2],s),o.colorStrokeStyle(t,b[0],b[1],b[2],s),o.drawArrowShape(e,t,d,f,l,v,r,a,i)}}};ci.drawArrowShape=function(t,e,n,r,a,i,s,o,l){var u=this,d=this.usePaths()&&a!=="triangle-cross",f=!1,h,v=e,p={x:s,y:o},y=t.pstyle("arrow-scale").value,b=this.getArrowWidth(r,y),m=u.arrowShapes[a];if(d){var g=u.arrowPathCache=u.arrowPathCache||[],w=Ds(a),x=g[w];x!=null?(h=e=x,f=!0):(h=e=new Path2D,g[w]=h)}f||(e.beginPath&&e.beginPath(),d?m.draw(e,1,0,{x:0,y:0},1):m.draw(e,b,l,p,r),e.closePath&&e.closePath()),e=v,d&&(e.translate(s,o),e.rotate(l),e.scale(b,b)),(n==="filled"||n==="both")&&(d?e.fill(h):e.fill()),(n==="hollow"||n==="both")&&(e.lineWidth=i/(d?b:1),e.lineJoin="miter",d?e.stroke(h):e.stroke()),d&&(e.scale(1/b,1/b),e.rotate(-l),e.translate(-s,-o))};var ky={};ky.safeDrawImage=function(t,e,n,r,a,i,s,o,l,u){if(!(a<=0||i<=0||l<=0||u<=0))try{t.drawImage(e,n,r,a,i,s,o,l,u)}catch(d){Jt(d)}};ky.drawInscribedImage=function(t,e,n,r,a){var i=this,s=n.position(),o=s.x,l=s.y,u=n.cy().style(),d=u.getIndexedStyle.bind(u),f=d(n,"background-fit","value",r),h=d(n,"background-repeat","value",r),v=n.width(),p=n.height(),y=n.padding()*2,b=v+(d(n,"background-width-relative-to","value",r)==="inner"?0:y),m=p+(d(n,"background-height-relative-to","value",r)==="inner"?0:y),g=n._private.rscratch,w=d(n,"background-clip","value",r),x=w==="node",E=d(n,"background-image-opacity","value",r)*a,S=d(n,"background-image-smoothing","value",r),C=n.pstyle("corner-radius").value;C!=="auto"&&(C=n.pstyle("corner-radius").pfValue);var T=e.width||e.cachedW,N=e.height||e.cachedH;(T==null||N==null)&&(document.body.appendChild(e),T=e.cachedW=e.width||e.offsetWidth,N=e.cachedH=e.height||e.offsetHeight,document.body.removeChild(e));var P=T,R=N;if(d(n,"background-width","value",r)!=="auto"&&(d(n,"background-width","units",r)==="%"?P=d(n,"background-width","pfValue",r)*b:P=d(n,"background-width","pfValue",r)),d(n,"background-height","value",r)!=="auto"&&(d(n,"background-height","units",r)==="%"?R=d(n,"background-height","pfValue",r)*m:R=d(n,"background-height","pfValue",r)),!(P===0||R===0)){if(f==="contain"){var I=Math.min(b/P,m/R);P*=I,R*=I}else if(f==="cover"){var I=Math.max(b/P,m/R);P*=I,R*=I}var D=o-b/2,$=d(n,"background-position-x","units",r),H=d(n,"background-position-x","pfValue",r);$==="%"?D+=(b-P)*H:D+=H;var V=d(n,"background-offset-x","units",r),U=d(n,"background-offset-x","pfValue",r);V==="%"?D+=(b-P)*U:D+=U;var F=l-m/2,G=d(n,"background-position-y","units",r),z=d(n,"background-position-y","pfValue",r);G==="%"?F+=(m-R)*z:F+=z;var _=d(n,"background-offset-y","units",r),K=d(n,"background-offset-y","pfValue",r);_==="%"?F+=(m-R)*K:F+=K,g.pathCache&&(D-=o,F-=l,o=0,l=0);var ie=t.globalAlpha;t.globalAlpha=E;var M=i.getImgSmoothing(t),oe=!1;if(S==="no"&&M?(i.setImgSmoothing(t,!1),oe=!0):S==="yes"&&!M&&(i.setImgSmoothing(t,!0),oe=!0),h==="no-repeat")x&&(t.save(),g.pathCache?t.clip(g.pathCache):(i.nodeShapes[i.getNodeShape(n)].draw(t,o,l,b,m,C,g),t.clip())),i.safeDrawImage(t,e,0,0,T,N,D,F,P,R),x&&t.restore();else{var ve=t.createPattern(e,h);t.fillStyle=ve,i.nodeShapes[i.getNodeShape(n)].draw(t,o,l,b,m,C,g),t.translate(D,F),t.fill(),t.translate(-D,-F)}t.globalAlpha=ie,oe&&i.setImgSmoothing(t,M)}};var Vs={};Vs.eleTextBiggerThanMin=function(t,e){if(!e){var n=t.cy().zoom(),r=this.getPixelRatio(),a=Math.ceil(sy(n*r));e=Math.pow(2,a)}var i=t.pstyle("font-size").pfValue*e,s=t.pstyle("min-zoomed-font-size").pfValue;return!(i<s)};Vs.drawElementText=function(t,e,n,r,a){var i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,s=this;if(r==null){if(i&&!s.eleTextBiggerThanMin(e))return}else if(r===!1)return;if(e.isNode()){var o=e.pstyle("label");if(!o||!o.value)return;var l=s.getLabelJustification(e),u=e.pstyle("text-metrics").strValue==="glyph";t.textAlign=l,t.textBaseline=u?"alphabetic":"bottom"}else{var d=e.element()._private.rscratch.badLine,f=e.pstyle("label"),h=e.pstyle("source-label"),v=e.pstyle("target-label");if(d||(!f||!f.value)&&(!h||!h.value)&&(!v||!v.value))return;t.textAlign="center",t.textBaseline="bottom"}var p=!n,y;n&&(y=n,t.translate(-y.x1,-y.y1)),a==null?(s.drawText(t,e,null,p,i),e.isEdge()&&(s.drawText(t,e,"source",p,i),s.drawText(t,e,"target",p,i))):s.drawText(t,e,a,p,i),n&&t.translate(y.x1,y.y1)};Vs.getFontCache=function(t){var e;this.fontCaches=this.fontCaches||[];for(var n=0;n<this.fontCaches.length;n++)if(e=this.fontCaches[n],e.context===t)return e;return e={context:t},this.fontCaches.push(e),e};Vs.setupTextStyle=function(t,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,r=e.pstyle("font-style").strValue,a=e.pstyle("font-size").pfValue+"px",i=e.pstyle("font-family").strValue,s=e.pstyle("font-weight").strValue,o=n?e.effectiveOpacity()*e.pstyle("text-opacity").value:1,l=e.pstyle("text-outline-opacity").value*o,u=e.pstyle("color").value,d=e.pstyle("text-outline-color").value;t.font=r+" "+s+" "+a+" "+i,t.lineJoin="round",this.colorFillStyle(t,u[0],u[1],u[2],o),this.colorStrokeStyle(t,d[0],d[1],d[2],l)};function _B(t,e,n,r,a){var i=Math.min(r,a),s=i/2,o=e+r/2,l=n+a/2;t.beginPath(),t.arc(o,l,s,0,Math.PI*2),t.closePath()}function Uw(t,e,n,r,a){var i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:5,s=Math.min(i,r/2,a/2);t.beginPath(),t.moveTo(e+s,n),t.lineTo(e+r-s,n),t.quadraticCurveTo(e+r,n,e+r,n+s),t.lineTo(e+r,n+a-s),t.quadraticCurveTo(e+r,n+a,e+r-s,n+a),t.lineTo(e+s,n+a),t.quadraticCurveTo(e,n+a,e,n+a-s),t.lineTo(e,n+s),t.quadraticCurveTo(e,n,e+s,n),t.closePath()}Vs.getTextAngle=function(t,e){var n,r=t._private,a=r.rscratch,i=e?e+"-":"",s=t.pstyle(i+"text-rotation");if(s.strValue==="autorotate"){var o=Cr(a,"labelAngle",e);n=t.isEdge()?o:0}else s.strValue==="none"?n=0:n=s.pfValue;return n};Vs.drawText=function(t,e,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=e._private,s=i.rscratch,o=a?e.effectiveOpacity():1;if(!(a&&(o===0||e.pstyle("text-opacity").value===0))){n==="main"&&(n=null);var l=Cr(s,"labelX",n),u=Cr(s,"labelY",n),d,f,h=this.getLabelText(e,n);if(h!=null&&h!==""&&!isNaN(l)&&!isNaN(u)){this.setupTextStyle(t,e,a);var v=n?n+"-":"",p=Cr(s,"labelWidth",n),y=Cr(s,"labelHeight",n),b=Cr(s,"labelActualDescent",n),m=e.pstyle(v+"text-margin-x").pfValue,g=e.pstyle(v+"text-margin-y").pfValue,w=e.isEdge(),x=e.pstyle("text-halign").value,E=e.pstyle("text-valign").value;w&&(x="center",E="center"),l+=m,u+=g;var S;r?S=this.getTextAngle(e,n):S=0,S!==0&&(d=l,f=u,t.translate(d,f),t.rotate(S),l=0,u=0);var C=Ko(x),T=Go(E);switch(T){case"top":break;case"center":u+=y/2;break;case"bottom":u+=y;break}var N=e.pstyle("text-background-opacity").value,P=e.pstyle("text-border-opacity").value,R=e.pstyle("text-border-width").pfValue,I=e.pstyle("text-background-padding").pfValue,D=e.pstyle("text-background-shape").strValue,$=D==="round-rectangle"||D==="roundrectangle",H=D==="circle",V=2;if(N>0||R>0&&P>0){var U=t.fillStyle,F=t.strokeStyle,G=t.lineWidth,z=e.pstyle("text-background-color").value,_=e.pstyle("text-border-color").value,K=e.pstyle("text-border-style").value,ie=N>0,M=R>0&&P>0,oe=l-I;switch(C){case"left":oe-=p;break;case"center":oe-=p/2;break}var ve=u-y-I,ye=p+2*I,Te=y+2*I;if(ie&&(t.fillStyle="rgba(".concat(z[0],",").concat(z[1],",").concat(z[2],",").concat(N*o,")")),M&&(t.strokeStyle="rgba(".concat(_[0],",").concat(_[1],",").concat(_[2],",").concat(P*o,")"),t.lineWidth=R,t.setLineDash))switch(K){case"dotted":t.setLineDash([1,1]);break;case"dashed":t.setLineDash([4,2]);break;case"double":t.lineWidth=R/4,t.setLineDash([]);break;case"solid":default:t.setLineDash([]);break}if($?(t.beginPath(),Uw(t,oe,ve,ye,Te,V)):H?(t.beginPath(),_B(t,oe,ve,ye,Te)):(t.beginPath(),t.rect(oe,ve,ye,Te)),ie&&t.fill(),M&&t.stroke(),M&&K==="double"){var fe=R/2;t.beginPath(),$?Uw(t,oe+fe,ve+fe,ye-2*fe,Te-2*fe,V):t.rect(oe+fe,ve+fe,ye-2*fe,Te-2*fe),t.stroke()}t.fillStyle=U,t.strokeStyle=F,t.lineWidth=G,t.setLineDash&&t.setLineDash([])}var Z=2*e.pstyle("text-outline-width").pfValue;if(Z>0&&(t.lineWidth=Z),u-=b,e.pstyle("text-wrap").value==="wrap"){var ee=Cr(s,"labelWrapCachedLines",n),ne=Cr(s,"labelLineHeight",n),de=p/2,Re=this.getLabelJustification(e);switch(Re==="auto"||(C==="left"?Re==="left"?l+=-p:Re==="center"&&(l+=-de):C==="center"?Re==="left"?l+=-de:Re==="right"&&(l+=de):C==="right"&&(Re==="center"?l+=de:Re==="right"&&(l+=p))),T){case"top":u-=(ee.length-1)*ne;break;case"center":case"bottom":u-=(ee.length-1)*ne;break}for(var Ge=0;Ge<ee.length;Ge++)Z>0&&t.strokeText(ee[Ge],l,u),t.fillText(ee[Ge],l,u),u+=ne}else Z>0&&t.strokeText(h,l,u),t.fillText(h,l,u);S!==0&&(t.rotate(-S),t.translate(-d,-f))}}};var rs={};rs.drawNode=function(t,e,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,s=this,o,l,u=e._private,d=u.rscratch,f=e.position();if(!(!_e(f.x)||!_e(f.y))&&!(i&&!e.visible())){var h=i?e.effectiveOpacity():1,v=s.usePaths(),p,y=!1,b=e.padding();o=e.width()+2*b,l=e.height()+2*b;var m;n&&(m=n,t.translate(-m.x1,-m.y1));for(var g=e.pstyle("background-image"),w=g.value,x=new Array(w.length),E=new Array(w.length),S=0,C=0;C<w.length;C++){var T=w[C],N=x[C]=T!=null&&T!=="none";if(N){var P=e.cy().style().getIndexedStyle(e,"background-image-crossorigin","value",C);S++,E[C]=s.getCachedImage(T,P,function(){u.backgroundTimestamp=Date.now(),e.emitAndNotify("background")})}}var R=e.pstyle("background-blacken").value,I=e.pstyle("border-width").pfValue,D=e.pstyle("background-opacity").value*h,$=e.pstyle("border-color").value,H=e.pstyle("border-style").value,V=e.pstyle("border-join").value,U=e.pstyle("border-cap").value,F=e.pstyle("border-position").value,G=e.pstyle("border-dash-pattern").pfValue,z=e.pstyle("border-dash-offset").pfValue,_=e.pstyle("border-opacity").value*h,K=e.pstyle("outline-width").pfValue,ie=e.pstyle("outline-color").value,M=e.pstyle("outline-style").value,oe=e.pstyle("outline-opacity").value*h,ve=e.pstyle("outline-offset").value,ye=e.pstyle("corner-radius").value;ye!=="auto"&&(ye=e.pstyle("corner-radius").pfValue);var Te=function(){var B=arguments.length>0&&arguments[0]!==void 0?arguments[0]:D;s.eleFillStyle(t,e,B)},fe=function(){var B=arguments.length>0&&arguments[0]!==void 0?arguments[0]:_;s.colorStrokeStyle(t,$[0],$[1],$[2],B)},Z=function(){var B=arguments.length>0&&arguments[0]!==void 0?arguments[0]:oe;s.colorStrokeStyle(t,ie[0],ie[1],ie[2],B)},ee=function(B,Y,te,le){var ce=s.nodePathCache=s.nodePathCache||[],Ye=IC(te==="polygon"?te+","+le.join(","):te,""+Y,""+B,""+ye),be=ce[Ye],Me,Ke=!1;return be!=null?(Me=be,Ke=!0,d.pathCache=Me):(Me=new Path2D,ce[Ye]=d.pathCache=Me),{path:Me,cacheHit:Ke}},ne=e.pstyle("shape").strValue,de=e.pstyle("shape-polygon-points").pfValue;if(v){t.translate(f.x,f.y);var Re=ee(o,l,ne,de);p=Re.path,y=Re.cacheHit}var Ge=function(){if(!y){var B=f;v&&(B={x:0,y:0}),s.nodeShapes[s.getNodeShape(e)].draw(p||t,B.x,B.y,o,l,ye,d)}v?t.fill(p):t.fill()},Nt=function(){for(var B=arguments.length>0&&arguments[0]!==void 0?arguments[0]:h,Y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,te=u.backgrounding,le=0,ce=0;ce<E.length;ce++){var Ye=e.cy().style().getIndexedStyle(e,"background-image-containment","value",ce);if(Y&&Ye==="over"||!Y&&Ye==="inside"){le++;continue}x[ce]&&E[ce].complete&&!E[ce].error&&(le++,s.drawInscribedImage(t,E[ce],e,ce,B))}u.backgrounding=le!==S,te!==u.backgrounding&&e.updateStyle(!1)},wt=function(){var B=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,Y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:h;s.hasPie(e)&&(s.drawPie(t,e,Y),B&&(v||s.nodeShapes[s.getNodeShape(e)].draw(t,f.x,f.y,o,l,ye,d)))},at=function(){var B=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,Y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:h;s.hasStripe(e)&&(t.save(),v?t.clip(d.pathCache):(s.nodeShapes[s.getNodeShape(e)].draw(t,f.x,f.y,o,l,ye,d),t.clip()),s.drawStripe(t,e,Y),t.restore(),B&&(v||s.nodeShapes[s.getNodeShape(e)].draw(t,f.x,f.y,o,l,ye,d)))},it=function(){var B=arguments.length>0&&arguments[0]!==void 0?arguments[0]:h,Y=(R>0?R:-R)*B,te=R>0?0:255;R!==0&&(s.colorFillStyle(t,te,te,te,Y),v?t.fill(p):t.fill())},$e=function(){if(I>0){if(t.lineWidth=I,t.lineCap=U,t.lineJoin=V,t.setLineDash)switch(H){case"dotted":t.setLineDash([1,1]);break;case"dashed":t.setLineDash(G),t.lineDashOffset=z;break;case"solid":case"double":t.setLineDash([]);break}if(F!=="center"){if(t.save(),t.lineWidth*=2,F==="inside")v?t.clip(p):t.clip();else{var B=new Path2D;B.rect(-o/2-I,-l/2-I,o+2*I,l+2*I),B.addPath(p),t.clip(B,"evenodd")}v?t.stroke(p):t.stroke(),t.restore()}else v?t.stroke(p):t.stroke();if(H==="double"){t.lineWidth=I/3;var Y=t.globalCompositeOperation;t.globalCompositeOperation="destination-out",v?t.stroke(p):t.stroke(),t.globalCompositeOperation=Y}t.setLineDash&&t.setLineDash([])}},et=function(){if(K>0){if(t.lineWidth=K,t.lineCap="butt",t.setLineDash)switch(M){case"dotted":t.setLineDash([1,1]);break;case"dashed":t.setLineDash([4,2]);break;case"solid":case"double":t.setLineDash([]);break}var B=f;v&&(B={x:0,y:0});var Y=s.getNodeShape(e),te=I;F==="inside"&&(te=0),F==="outside"&&(te*=2);var le=(o+te+(K+ve))/o,ce=(l+te+(K+ve))/l,Ye=o*le,be=l*ce,Me=s.nodeShapes[Y].points,Ke;if(v){var dt=ee(Ye,be,Y,Me);Ke=dt.path}if(Y==="ellipse")s.drawEllipsePath(Ke||t,B.x,B.y,Ye,be);else if(["round-diamond","round-heptagon","round-hexagon","round-octagon","round-pentagon","round-polygon","round-triangle","round-tag"].includes(Y)){var kt=0,ot=0,Ve=0;Y==="round-diamond"?kt=(te+ve+K)*1.4:Y==="round-heptagon"?(kt=(te+ve+K)*1.075,Ve=-(te/2+ve+K)/35):Y==="round-hexagon"?kt=(te+ve+K)*1.12:Y==="round-pentagon"?(kt=(te+ve+K)*1.13,Ve=-(te/2+ve+K)/15):Y==="round-tag"?(kt=(te+ve+K)*1.12,ot=(te/2+K+ve)*.07):Y==="round-triangle"&&(kt=(te+ve+K)*(Math.PI/2),Ve=-(te+ve/2+K)/Math.PI),kt!==0&&(le=(o+kt)/o,Ye=o*le,["round-hexagon","round-tag"].includes(Y)||(ce=(l+kt)/l,be=l*ce)),ye=ye==="auto"?$C(Ye,be):ye;for(var vt=Ye/2,jt=be/2,Vt=ye+(te+K+ve)/2,Ft=new Array(Me.length/2),Ir=new Array(Me.length/2),sn=0;sn<Me.length/2;sn++)Ft[sn]={x:B.x+ot+vt*Me[sn*2],y:B.y+Ve+jt*Me[sn*2+1]};var gn,Sn,Un,ea,dn=Ft.length;for(Sn=Ft[dn-1],gn=0;gn<dn;gn++)Un=Ft[gn%dn],ea=Ft[(gn+1)%dn],Ir[gn]=xy(Sn,Un,ea,Vt),Sn=Un,Un=ea;s.drawRoundPolygonPath(Ke||t,B.x+ot,B.y+Ve,o*le,l*ce,Me,Ir)}else if(["roundrectangle","round-rectangle"].includes(Y))ye=ye==="auto"?Wi(Ye,be):ye,s.drawRoundRectanglePath(Ke||t,B.x,B.y,Ye,be,ye+(te+K+ve)/2);else if(["cutrectangle","cut-rectangle"].includes(Y))ye=ye==="auto"?uy():ye,s.drawCutRectanglePath(Ke||t,B.x,B.y,Ye,be,null,ye+(te+K+ve)/4);else if(["bottomroundrectangle","bottom-round-rectangle"].includes(Y))ye=ye==="auto"?Wi(Ye,be):ye,s.drawBottomRoundRectanglePath(Ke||t,B.x,B.y,Ye,be,ye+(te+K+ve)/2);else if(Y==="barrel")s.drawBarrelPath(Ke||t,B.x,B.y,Ye,be);else if(Y.startsWith("polygon")||["rhomboid","right-rhomboid","round-tag","tag","vee"].includes(Y)){var ha=(te+K+ve)/o;Me=qd(Hd(Me,ha)),s.drawPolygonPath(Ke||t,B.x,B.y,o,l,Me)}else{var Lr=(te+K+ve)/o;Me=qd(Hd(Me,-Lr)),s.drawPolygonPath(Ke||t,B.x,B.y,o,l,Me)}if(v?t.stroke(Ke):t.stroke(),M==="double"){t.lineWidth=te/3;var ta=t.globalCompositeOperation;t.globalCompositeOperation="destination-out",v?t.stroke(Ke):t.stroke(),t.globalCompositeOperation=ta}t.setLineDash&&t.setLineDash([])}},nt=function(){a&&s.drawNodeOverlay(t,e,f,o,l)},bt=function(){a&&s.drawNodeUnderlay(t,e,f,o,l)},ht=function(){s.drawElementText(t,e,null,r)},Pt=e.pstyle("ghost").value==="yes";if(Pt){var Bt=e.pstyle("ghost-offset-x").pfValue,Kt=e.pstyle("ghost-offset-y").pfValue,_t=e.pstyle("ghost-opacity").value,Mt=_t*h;t.translate(Bt,Kt),Z(),et(),Te(_t*D),Ge(),Nt(Mt,!0),fe(_t*_),$e(),wt(R!==0||I!==0),at(R!==0||I!==0),Nt(Mt,!1),it(Mt),t.translate(-Bt,-Kt)}v&&t.translate(-f.x,-f.y),bt(),v&&t.translate(f.x,f.y),Z(),et(),Te(),Ge(),Nt(h,!0),fe(),$e(),wt(R!==0||I!==0),at(R!==0||I!==0),Nt(h,!1),it(),v&&t.translate(-f.x,-f.y),ht(),nt(),n&&t.translate(m.x1,m.y1)}};var GS=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(n,r,a,i,s){var o=this;if(r.visible()){var l=r.pstyle("".concat(e,"-padding")).pfValue,u=r.pstyle("".concat(e,"-opacity")).value,d=r.pstyle("".concat(e,"-color")).value,f=r.pstyle("".concat(e,"-shape")).value,h=r.pstyle("".concat(e,"-corner-radius")).value;if(u>0){if(a=a||r.position(),i==null||s==null){var v=r.padding();i=r.width()+2*v,s=r.height()+2*v}o.colorFillStyle(n,d[0],d[1],d[2],u),o.nodeShapes[f].draw(n,a.x,a.y,i+l*2,s+l*2,h),n.fill()}}}};rs.drawNodeOverlay=GS("overlay");rs.drawNodeUnderlay=GS("underlay");rs.hasPie=function(t){return t=t[0],t._private.hasPie};rs.hasStripe=function(t){return t=t[0],t._private.hasStripe};rs.drawPie=function(t,e,n,r){e=e[0],r=r||e.position();var a=e.cy().style(),i=e.pstyle("pie-size"),s=e.pstyle("pie-hole"),o=e.pstyle("pie-start-angle").pfValue,l=r.x,u=r.y,d=e.width(),f=e.height(),h=Math.min(d,f)/2,v,p=0,y=this.usePaths();if(y&&(l=0,u=0),i.units==="%"?h=h*i.pfValue:i.pfValue!==void 0&&(h=i.pfValue/2),s.units==="%"?v=h*s.pfValue:s.pfValue!==void 0&&(v=s.pfValue/2),!(v>=h))for(var b=1;b<=a.pieBackgroundN;b++){var m=e.pstyle("pie-"+b+"-background-size").value,g=e.pstyle("pie-"+b+"-background-color").value,w=e.pstyle("pie-"+b+"-background-opacity").value*n,x=m/100;x+p>1&&(x=1-p);var E=1.5*Math.PI+2*Math.PI*p;E+=o;var S=2*Math.PI*x,C=E+S;m===0||p>=1||p+x>1||(v===0?(t.beginPath(),t.moveTo(l,u),t.arc(l,u,h,E,C),t.closePath()):(t.beginPath(),t.arc(l,u,h,E,C),t.arc(l,u,v,C,E,!0),t.closePath()),this.colorFillStyle(t,g[0],g[1],g[2],w),t.fill(),p+=x)}};rs.drawStripe=function(t,e,n,r){e=e[0],r=r||e.position();var a=e.cy().style(),i=r.x,s=r.y,o=e.width(),l=e.height(),u=0,d=this.usePaths();t.save();var f=e.pstyle("stripe-direction").value,h=e.pstyle("stripe-size");switch(f){case"vertical":break;case"righward":t.rotate(-Math.PI/2);break}var v=o,p=l;h.units==="%"?(v=v*h.pfValue,p=p*h.pfValue):h.pfValue!==void 0&&(v=h.pfValue,p=h.pfValue),d&&(i=0,s=0),s-=v/2,i-=p/2;for(var y=1;y<=a.stripeBackgroundN;y++){var b=e.pstyle("stripe-"+y+"-background-size").value,m=e.pstyle("stripe-"+y+"-background-color").value,g=e.pstyle("stripe-"+y+"-background-opacity").value*n,w=b/100;w+u>1&&(w=1-u),!(b===0||u>=1||u+w>1)&&(t.beginPath(),t.rect(i,s+p*u,v,p*w),t.closePath(),this.colorFillStyle(t,m[0],m[1],m[2],g),t.fill(),u+=w)}t.restore()};var Rr={},$B=100;Rr.getPixelRatio=function(){var t=this.data.contexts[0];if(this.forcedPixelRatio!=null)return this.forcedPixelRatio;var e=this.cy.window(),n=t.backingStorePixelRatio||t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1;return(e.devicePixelRatio||1)/n};Rr.paintCache=function(t){for(var e=this.paintCaches=this.paintCaches||[],n=!0,r,a=0;a<e.length;a++)if(r=e[a],r.context===t){n=!1;break}return n&&(r={context:t},e.push(r)),r};Rr.createGradientStyleFor=function(t,e,n,r,a){var i,s=this.usePaths(),o=n.pstyle(e+"-gradient-stop-colors").value,l=n.pstyle(e+"-gradient-stop-positions").pfValue;if(r==="radial-gradient")if(n.isEdge()){var u=n.sourceEndpoint(),d=n.targetEndpoint(),f=n.midpoint(),h=Bs(u,f),v=Bs(d,f);i=t.createRadialGradient(f.x,f.y,0,f.x,f.y,Math.max(h,v))}else{var p=s?{x:0,y:0}:n.position(),y=n.paddedWidth(),b=n.paddedHeight();i=t.createRadialGradient(p.x,p.y,0,p.x,p.y,Math.max(y,b))}else if(n.isEdge()){var m=n.sourceEndpoint(),g=n.targetEndpoint();i=t.createLinearGradient(m.x,m.y,g.x,g.y)}else{var w=s?{x:0,y:0}:n.position(),x=n.paddedWidth(),E=n.paddedHeight(),S=x/2,C=E/2,T=n.pstyle("background-gradient-direction").value;switch(T){case"to-bottom":i=t.createLinearGradient(w.x,w.y-C,w.x,w.y+C);break;case"to-top":i=t.createLinearGradient(w.x,w.y+C,w.x,w.y-C);break;case"to-left":i=t.createLinearGradient(w.x+S,w.y,w.x-S,w.y);break;case"to-right":i=t.createLinearGradient(w.x-S,w.y,w.x+S,w.y);break;case"to-bottom-right":case"to-right-bottom":i=t.createLinearGradient(w.x-S,w.y-C,w.x+S,w.y+C);break;case"to-top-right":case"to-right-top":i=t.createLinearGradient(w.x-S,w.y+C,w.x+S,w.y-C);break;case"to-bottom-left":case"to-left-bottom":i=t.createLinearGradient(w.x+S,w.y-C,w.x-S,w.y+C);break;case"to-top-left":case"to-left-top":i=t.createLinearGradient(w.x+S,w.y+C,w.x-S,w.y-C);break}}if(!i)return null;for(var N=l.length===o.length,P=o.length,R=0;R<P;R++)i.addColorStop(N?l[R]:R/(P-1),"rgba("+o[R][0]+","+o[R][1]+","+o[R][2]+","+a+")");return i};Rr.gradientFillStyle=function(t,e,n,r){var a=this.createGradientStyleFor(t,"background",e,n,r);if(!a)return null;t.fillStyle=a};Rr.colorFillStyle=function(t,e,n,r,a){t.fillStyle="rgba("+e+","+n+","+r+","+a+")"};Rr.eleFillStyle=function(t,e,n){var r=e.pstyle("background-fill").value;if(r==="linear-gradient"||r==="radial-gradient")this.gradientFillStyle(t,e,r,n);else{var a=e.pstyle("background-color").value;this.colorFillStyle(t,a[0],a[1],a[2],n)}};Rr.gradientStrokeStyle=function(t,e,n,r){var a=this.createGradientStyleFor(t,"line",e,n,r);if(!a)return null;t.strokeStyle=a};Rr.colorStrokeStyle=function(t,e,n,r,a){t.strokeStyle="rgba("+e+","+n+","+r+","+a+")"};Rr.eleStrokeStyle=function(t,e,n){var r=e.pstyle("line-fill").value;if(r==="linear-gradient"||r==="radial-gradient")this.gradientStrokeStyle(t,e,r,n);else{var a=e.pstyle("line-color").value;this.colorStrokeStyle(t,a[0],a[1],a[2],n)}};Rr.matchCanvasSize=function(t){var e=this,n=e.data,r=e.findContainerClientCoords(),a=r[2],i=r[3],s=e.getPixelRatio(),o=e.motionBlurPxRatio;(t===e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_NODE]||t===e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_DRAG])&&(s=o);var l=a*s,u=i*s,d;if(!(l===e.canvasWidth&&u===e.canvasHeight)){e.fontCaches=null;var f=n.canvasContainer;f.style.width=a+"px",f.style.height=i+"px";for(var h=0;h<e.CANVAS_LAYERS;h++)d=n.canvases[h],d.width=l,d.height=u,d.style.width=a+"px",d.style.height=i+"px";for(var h=0;h<e.BUFFER_COUNT;h++)d=n.bufferCanvases[h],d.width=l,d.height=u,d.style.width=a+"px",d.style.height=i+"px";e.textureMult=1,s<=1&&(d=n.bufferCanvases[e.TEXTURE_BUFFER],e.textureMult=2,d.width=l*e.textureMult,d.height=u*e.textureMult),e.canvasWidth=l,e.canvasHeight=u,e.pixelRatio=s}};Rr.renderTo=function(t,e,n,r){this.render({forcedContext:t,forcedZoom:e,forcedPan:n,drawAllLayers:!0,forcedPxRatio:r})};Rr.clearCanvas=function(){var t=this,e=t.data;function n(r){r.clearRect(0,0,t.canvasWidth,t.canvasHeight)}n(e.contexts[t.NODE]),n(e.contexts[t.DRAG])};Rr.render=function(t){var e=this;t=t||BC();var n=e.cy,r=t.forcedContext,a=t.drawAllLayers,i=t.drawOnlyNodeLayer,s=t.forcedZoom,o=t.forcedPan,l=t.forcedPxRatio===void 0?this.getPixelRatio():t.forcedPxRatio,u=e.data,d=u.canvasNeedsRedraw,f=e.textureOnViewport&&!r&&(e.pinching||e.hoverData.dragging||e.swipePanning||e.data.wheelZooming),h=t.motionBlur!==void 0?t.motionBlur:e.motionBlur,v=e.motionBlurPxRatio,p=n.hasCompoundNodes(),y=e.hoverData.draggingEles,b=!!(e.hoverData.selecting||e.touchData.selecting);h=h&&!r&&e.motionBlurEnabled&&!b;var m=h;r||(e.prevPxRatio!==l&&(e.invalidateContainerClientCoordsCache(),e.matchCanvasSize(e.container),e.redrawHint("eles",!0),e.redrawHint("drag",!0)),e.prevPxRatio=l),!r&&e.motionBlurTimeout&&clearTimeout(e.motionBlurTimeout),h&&(e.mbFrames==null&&(e.mbFrames=0),e.mbFrames++,e.mbFrames<3&&(m=!1),e.mbFrames>e.minMbLowQualFrames&&(e.motionBlurPxRatio=e.mbPxRBlurry)),e.clearingMotionBlur&&(e.motionBlurPxRatio=1),e.textureDrawLastFrame&&!f&&(d[e.NODE]=!0,d[e.SELECT_BOX]=!0);var g=n.style(),w=n.zoom(),x=s!==void 0?s:w,E=n.pan(),S={x:E.x,y:E.y},C={zoom:w,pan:{x:E.x,y:E.y}},T=e.prevViewport,N=T===void 0||C.zoom!==T.zoom||C.pan.x!==T.pan.x||C.pan.y!==T.pan.y;!N&&!(y&&!p)&&(e.motionBlurPxRatio=1),o&&(S=o),x*=l,S.x*=l,S.y*=l;var P=e.getCachedZSortedEles();function R(fe,Z,ee,ne,de){var Re=fe.globalCompositeOperation;fe.globalCompositeOperation="destination-out",e.colorFillStyle(fe,255,255,255,e.motionBlurTransparency),fe.fillRect(Z,ee,ne,de),fe.globalCompositeOperation=Re}function I(fe,Z){var ee,ne,de,Re;!e.clearingMotionBlur&&(fe===u.bufferContexts[e.MOTIONBLUR_BUFFER_NODE]||fe===u.bufferContexts[e.MOTIONBLUR_BUFFER_DRAG])?(ee={x:E.x*v,y:E.y*v},ne=w*v,de=e.canvasWidth*v,Re=e.canvasHeight*v):(ee=S,ne=x,de=e.canvasWidth,Re=e.canvasHeight),fe.setTransform(1,0,0,1,0,0),Z==="motionBlur"?R(fe,0,0,de,Re):!r&&(Z===void 0||Z)&&fe.clearRect(0,0,de,Re),a||(fe.translate(ee.x,ee.y),fe.scale(ne,ne)),o&&fe.translate(o.x,o.y),s&&fe.scale(s,s)}if(f||(e.textureDrawLastFrame=!1),f){if(e.textureDrawLastFrame=!0,!e.textureCache){e.textureCache={},e.textureCache.bb=n.mutableElements().boundingBox(),e.textureCache.texture=e.data.bufferCanvases[e.TEXTURE_BUFFER];var D=e.data.bufferContexts[e.TEXTURE_BUFFER];D.setTransform(1,0,0,1,0,0),D.clearRect(0,0,e.canvasWidth*e.textureMult,e.canvasHeight*e.textureMult),e.render({forcedContext:D,drawOnlyNodeLayer:!0,forcedPxRatio:l*e.textureMult});var C=e.textureCache.viewport={zoom:n.zoom(),pan:n.pan(),width:e.canvasWidth,height:e.canvasHeight};C.mpan={x:(0-C.pan.x)/C.zoom,y:(0-C.pan.y)/C.zoom}}d[e.DRAG]=!1,d[e.NODE]=!1;var $=u.contexts[e.NODE],H=e.textureCache.texture,C=e.textureCache.viewport;$.setTransform(1,0,0,1,0,0),h?R($,0,0,C.width,C.height):$.clearRect(0,0,C.width,C.height);var V=g.core("outside-texture-bg-color").value,U=g.core("outside-texture-bg-opacity").value;e.colorFillStyle($,V[0],V[1],V[2],U),$.fillRect(0,0,C.width,C.height);var w=n.zoom();I($,!1),$.clearRect(C.mpan.x,C.mpan.y,C.width/C.zoom/l,C.height/C.zoom/l),$.drawImage(H,C.mpan.x,C.mpan.y,C.width/C.zoom/l,C.height/C.zoom/l)}else e.textureOnViewport&&!r&&(e.textureCache=null);var F=n.extent(),G=e.pinching||e.hoverData.dragging||e.swipePanning||e.data.wheelZooming||e.hoverData.draggingEles||e.cy.animated(),z=e.hideEdgesOnViewport&&G,_=[];if(_[e.NODE]=!d[e.NODE]&&h&&!e.clearedForMotionBlur[e.NODE]||e.clearingMotionBlur,_[e.NODE]&&(e.clearedForMotionBlur[e.NODE]=!0),_[e.DRAG]=!d[e.DRAG]&&h&&!e.clearedForMotionBlur[e.DRAG]||e.clearingMotionBlur,_[e.DRAG]&&(e.clearedForMotionBlur[e.DRAG]=!0),d[e.NODE]||a||i||_[e.NODE]){var K=h&&!_[e.NODE]&&v!==1,$=r||(K?e.data.bufferContexts[e.MOTIONBLUR_BUFFER_NODE]:u.contexts[e.NODE]),ie=h&&!K?"motionBlur":void 0;I($,ie),z?e.drawCachedNodes($,P.nondrag,l,F):e.drawLayeredElements($,P.nondrag,l,F),e.debug&&e.drawDebugPoints($,P.nondrag),!a&&!h&&(d[e.NODE]=!1)}if(!i&&(d[e.DRAG]||a||_[e.DRAG])){var K=h&&!_[e.DRAG]&&v!==1,$=r||(K?e.data.bufferContexts[e.MOTIONBLUR_BUFFER_DRAG]:u.contexts[e.DRAG]);I($,h&&!K?"motionBlur":void 0),z?e.drawCachedNodes($,P.drag,l,F):e.drawCachedElements($,P.drag,l,F),e.debug&&e.drawDebugPoints($,P.drag),!a&&!h&&(d[e.DRAG]=!1)}if(this.drawSelectionRectangle(t,I),h&&v!==1){var M=u.contexts[e.NODE],oe=e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_NODE],ve=u.contexts[e.DRAG],ye=e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_DRAG],Te=function(Z,ee,ne){Z.setTransform(1,0,0,1,0,0),ne||!m?Z.clearRect(0,0,e.canvasWidth,e.canvasHeight):R(Z,0,0,e.canvasWidth,e.canvasHeight);var de=v;Z.drawImage(ee,0,0,e.canvasWidth*de,e.canvasHeight*de,0,0,e.canvasWidth,e.canvasHeight)};(d[e.NODE]||_[e.NODE])&&(Te(M,oe,_[e.NODE]),d[e.NODE]=!1),(d[e.DRAG]||_[e.DRAG])&&(Te(ve,ye,_[e.DRAG]),d[e.DRAG]=!1)}e.prevViewport=C,e.clearingMotionBlur&&(e.clearingMotionBlur=!1,e.motionBlurCleared=!0,e.motionBlur=!0),h&&(e.motionBlurTimeout=setTimeout(function(){e.motionBlurTimeout=null,e.clearedForMotionBlur[e.NODE]=!1,e.clearedForMotionBlur[e.DRAG]=!1,e.motionBlur=!1,e.clearingMotionBlur=!f,e.mbFrames=0,d[e.NODE]=!0,d[e.DRAG]=!0,e.redraw()},$B)),r||n.emit("render")};var jl;Rr.drawSelectionRectangle=function(t,e){var n=this,r=n.cy,a=n.data,i=r.style(),s=t.drawOnlyNodeLayer,o=t.drawAllLayers,l=a.canvasNeedsRedraw,u=t.forcedContext;if(n.showFps||!s&&l[n.SELECT_BOX]&&!o){var d=u||a.contexts[n.SELECT_BOX];if(e(d),n.selection[4]==1&&(n.hoverData.selecting||n.touchData.selecting)){var f=n.cy.zoom(),h=i.core("selection-box-border-width").value/f;d.lineWidth=h,d.fillStyle="rgba("+i.core("selection-box-color").value[0]+","+i.core("selection-box-color").value[1]+","+i.core("selection-box-color").value[2]+","+i.core("selection-box-opacity").value+")",d.fillRect(n.selection[0],n.selection[1],n.selection[2]-n.selection[0],n.selection[3]-n.selection[1]),h>0&&(d.strokeStyle="rgba("+i.core("selection-box-border-color").value[0]+","+i.core("selection-box-border-color").value[1]+","+i.core("selection-box-border-color").value[2]+","+i.core("selection-box-opacity").value+")",d.strokeRect(n.selection[0],n.selection[1],n.selection[2]-n.selection[0],n.selection[3]-n.selection[1]))}if(a.bgActivePosistion&&!n.hoverData.selecting){var f=n.cy.zoom(),v=a.bgActivePosistion;d.fillStyle="rgba("+i.core("active-bg-color").value[0]+","+i.core("active-bg-color").value[1]+","+i.core("active-bg-color").value[2]+","+i.core("active-bg-opacity").value+")",d.beginPath(),d.arc(v.x,v.y,i.core("active-bg-size").pfValue/f,0,2*Math.PI),d.fill()}var p=n.lastRedrawTime;if(n.showFps&&p){p=Math.round(p);var y=Math.round(1e3/p),b="1 frame = "+p+" ms = "+y+" fps";if(d.setTransform(1,0,0,1,0,0),d.fillStyle="rgba(255, 0, 0, 0.75)",d.strokeStyle="rgba(255, 0, 0, 0.75)",d.font="30px Arial",!jl){var m=d.measureText(b);jl=m.actualBoundingBoxAscent}d.fillText(b,0,jl);var g=60;d.strokeRect(0,jl+10,250,20),d.fillRect(0,jl+10,250*Math.min(y/g,1),20)}o||(l[n.SELECT_BOX]=!1)}};function qw(t,e,n){var r=t.createShader(e);if(t.shaderSource(r,n),t.compileShader(r),!t.getShaderParameter(r,t.COMPILE_STATUS))throw new Error(t.getShaderInfoLog(r));return r}function VB(t,e,n){var r=qw(t,t.VERTEX_SHADER,e),a=qw(t,t.FRAGMENT_SHADER,n),i=t.createProgram();if(t.attachShader(i,r),t.attachShader(i,a),t.linkProgram(i),!t.getProgramParameter(i,t.LINK_STATUS))throw new Error("Could not initialize shaders");return i}function UB(t,e,n){n===void 0&&(n=e);var r=t.makeOffscreenCanvas(e,n),a=r.context=r.getContext("2d");return r.clear=function(){return a.clearRect(0,0,r.width,r.height)},r.clear(),r}function Ey(t){var e=t.pixelRatio,n=t.cy.zoom(),r=t.cy.pan();return{zoom:n*e,pan:{x:r.x*e,y:r.y*e}}}function qB(t){var e=t.pixelRatio,n=t.cy.zoom();return n*e}function HB(t,e,n,r,a){var i=r*n+e.x,s=a*n+e.y;return s=Math.round(t.canvasHeight-s),[i,s]}function WB(t,e){return e.picking?!0:t.pstyle("background-fill").value!=="solid"||t.pstyle("background-image").strValue!=="none"?!1:t.pstyle("border-width").value===0||t.pstyle("border-opacity").value===0?!0:t.pstyle("border-style").value==="solid"}function KB(t,e){if(t.length!==e.length)return!1;for(var n=0;n<t.length;n++)if(t[n]!==e[n])return!1;return!0}function hs(t,e,n){var r=t[0]/255,a=t[1]/255,i=t[2]/255,s=e,o=n||new Array(4);return o[0]=r*s,o[1]=a*s,o[2]=i*s,o[3]=s,o}function eo(t,e){var n=e||new Array(4);return n[0]=(t>>0&255)/255,n[1]=(t>>8&255)/255,n[2]=(t>>16&255)/255,n[3]=(t>>24&255)/255,n}function GB(t){return t[0]+(t[1]<<8)+(t[2]<<16)+(t[3]<<24)}function YB(t,e){var n=t.createTexture();return n.buffer=function(r){t.bindTexture(t.TEXTURE_2D,n),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR_MIPMAP_NEAREST),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,r),t.generateMipmap(t.TEXTURE_2D),t.bindTexture(t.TEXTURE_2D,null)},n.deleteTexture=function(){t.deleteTexture(n)},n}function YS(t,e){switch(e){case"float":return[1,t.FLOAT,4];case"vec2":return[2,t.FLOAT,4];case"vec3":return[3,t.FLOAT,4];case"vec4":return[4,t.FLOAT,4];case"int":return[1,t.INT,4];case"ivec2":return[2,t.INT,4]}}function XS(t,e,n){switch(e){case t.FLOAT:return new Float32Array(n);case t.INT:return new Int32Array(n)}}function XB(t,e,n,r,a,i){switch(e){case t.FLOAT:return new Float32Array(n.buffer,i*r,a);case t.INT:return new Int32Array(n.buffer,i*r,a)}}function QB(t,e,n,r){var a=YS(t,e),i=Fn(a,2),s=i[0],o=i[1],l=XS(t,o,r),u=t.createBuffer();return t.bindBuffer(t.ARRAY_BUFFER,u),t.bufferData(t.ARRAY_BUFFER,l,t.STATIC_DRAW),o===t.FLOAT?t.vertexAttribPointer(n,s,o,!1,0,0):o===t.INT&&t.vertexAttribIPointer(n,s,o,0,0),t.enableVertexAttribArray(n),t.bindBuffer(t.ARRAY_BUFFER,null),u}function La(t,e,n,r){var a=YS(t,n),i=Fn(a,3),s=i[0],o=i[1],l=i[2],u=XS(t,o,e*s),d=s*l,f=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,f),t.bufferData(t.ARRAY_BUFFER,e*d,t.DYNAMIC_DRAW),t.enableVertexAttribArray(r),o===t.FLOAT?t.vertexAttribPointer(r,s,o,!1,d,0):o===t.INT&&t.vertexAttribIPointer(r,s,o,d,0),t.vertexAttribDivisor(r,1),t.bindBuffer(t.ARRAY_BUFFER,null);for(var h=new Array(e),v=0;v<e;v++)h[v]=XB(t,o,u,d,s,v);return f.dataArray=u,f.stride=d,f.size=s,f.getView=function(p){return h[p]},f.setPoint=function(p,y,b){var m=h[p];m[0]=y,m[1]=b},f.bufferSubData=function(p){t.bindBuffer(t.ARRAY_BUFFER,f),p?t.bufferSubData(t.ARRAY_BUFFER,0,u,0,p*s):t.bufferSubData(t.ARRAY_BUFFER,0,u)},f}function ZB(t,e,n){for(var r=9,a=new Float32Array(e*r),i=new Array(e),s=0;s<e;s++){var o=s*r*4;i[s]=new Float32Array(a.buffer,o,r)}var l=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,l),t.bufferData(t.ARRAY_BUFFER,a.byteLength,t.DYNAMIC_DRAW);for(var u=0;u<3;u++){var d=n+u;t.enableVertexAttribArray(d),t.vertexAttribPointer(d,3,t.FLOAT,!1,3*12,u*12),t.vertexAttribDivisor(d,1)}return t.bindBuffer(t.ARRAY_BUFFER,null),l.getMatrixView=function(f){return i[f]},l.setData=function(f,h){i[h].set(f,0)},l.bufferSubData=function(){t.bindBuffer(t.ARRAY_BUFFER,l),t.bufferSubData(t.ARRAY_BUFFER,0,a)},l}function JB(t){var e=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,e);var n=t.createTexture();return t.bindTexture(t.TEXTURE_2D,n),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,n,0),t.bindFramebuffer(t.FRAMEBUFFER,null),e.setFramebufferAttachmentSizes=function(r,a){t.bindTexture(t.TEXTURE_2D,n),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,r,a,0,t.RGBA,t.UNSIGNED_BYTE,null)},e}var Hw=typeof Float32Array<"u"?Float32Array:Array;Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)});function pp(){var t=new Hw(9);return Hw!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t}function Ww(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t}function eM(t,e,n){var r=e[0],a=e[1],i=e[2],s=e[3],o=e[4],l=e[5],u=e[6],d=e[7],f=e[8],h=n[0],v=n[1],p=n[2],y=n[3],b=n[4],m=n[5],g=n[6],w=n[7],x=n[8];return t[0]=h*r+v*s+p*u,t[1]=h*a+v*o+p*d,t[2]=h*i+v*l+p*f,t[3]=y*r+b*s+m*u,t[4]=y*a+b*o+m*d,t[5]=y*i+b*l+m*f,t[6]=g*r+w*s+x*u,t[7]=g*a+w*o+x*d,t[8]=g*i+w*l+x*f,t}function ud(t,e,n){var r=e[0],a=e[1],i=e[2],s=e[3],o=e[4],l=e[5],u=e[6],d=e[7],f=e[8],h=n[0],v=n[1];return t[0]=r,t[1]=a,t[2]=i,t[3]=s,t[4]=o,t[5]=l,t[6]=h*r+v*s+u,t[7]=h*a+v*o+d,t[8]=h*i+v*l+f,t}function Kw(t,e,n){var r=e[0],a=e[1],i=e[2],s=e[3],o=e[4],l=e[5],u=e[6],d=e[7],f=e[8],h=Math.sin(n),v=Math.cos(n);return t[0]=v*r+h*s,t[1]=v*a+h*o,t[2]=v*i+h*l,t[3]=v*s-h*r,t[4]=v*o-h*a,t[5]=v*l-h*i,t[6]=u,t[7]=d,t[8]=f,t}function Wg(t,e,n){var r=n[0],a=n[1];return t[0]=r*e[0],t[1]=r*e[1],t[2]=r*e[2],t[3]=a*e[3],t[4]=a*e[4],t[5]=a*e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t}function tM(t,e,n){return t[0]=2/e,t[1]=0,t[2]=0,t[3]=0,t[4]=-2/n,t[5]=0,t[6]=-1,t[7]=1,t[8]=1,t}var nM=function(){function t(e,n,r,a){es(this,t),this.debugID=Math.floor(Math.random()*1e4),this.r=e,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=a(e,n,n),this.scratch=a(e,n,this.texHeight,"scratch")}return ts(t,[{key:"lock",value:function(){this.locked=!0}},{key:"getKeys",value:function(){return new Set(this.keyToLocation.keys())}},{key:"getScale",value:function(n){var r=n.w,a=n.h,i=this.texHeight,s=this.texSize,o=i/a,l=r*o,u=a*o;return l>s&&(o=s/r,l=r*o,u=a*o),{scale:o,texW:l,texH:u}}},{key:"draw",value:function(n,r,a){var i=this;if(this.locked)throw new Error("can't draw, atlas is locked");var s=this.texSize,o=this.texRows,l=this.texHeight,u=this.getScale(r),d=u.scale,f=u.texW,h=u.texH,v=function(w,x){if(a&&x){var E=x.context,S=w.x,C=w.row,T=S,N=l*C;E.save(),E.translate(T,N),E.scale(d,d),a(E,r),E.restore()}},p=[null,null],y=function(){v(i.freePointer,i.canvas),p[0]={x:i.freePointer.x,y:i.freePointer.row*l,w:f,h},p[1]={x:i.freePointer.x+f,y:i.freePointer.row*l,w:0,h},i.freePointer.x+=f,i.freePointer.x==s&&(i.freePointer.x=0,i.freePointer.row++)},b=function(){var w=i.scratch,x=i.canvas;w.clear(),v({x:0,row:0},w);var E=s-i.freePointer.x,S=f-E,C=l;{var T=i.freePointer.x,N=i.freePointer.row*l,P=E;x.context.drawImage(w,0,0,P,C,T,N,P,C),p[0]={x:T,y:N,w:P,h}}{var R=E,I=(i.freePointer.row+1)*l,D=S;x&&x.context.drawImage(w,R,0,D,C,0,I,D,C),p[1]={x:0,y:I,w:D,h}}i.freePointer.x=S,i.freePointer.row++},m=function(){i.freePointer.x=0,i.freePointer.row++};if(this.freePointer.x+f<=s)y();else{if(this.freePointer.row>=o-1)return!1;this.freePointer.x===s?(m(),y()):this.enableWrapping?b():(m(),y())}return this.keyToLocation.set(n,p),this.needsBuffer=!0,p}},{key:"getOffsets",value:function(n){return this.keyToLocation.get(n)}},{key:"isEmpty",value:function(){return this.freePointer.x===0&&this.freePointer.row===0}},{key:"canFit",value:function(n){if(this.locked)return!1;var r=this.texSize,a=this.texRows,i=this.getScale(n),s=i.texW;return this.freePointer.x+s>r?this.freePointer.row<a-1:!0}},{key:"bufferIfNeeded",value:function(n){this.texture||(this.texture=YB(n,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(),this.texture=null),this.canvas=null,this.scratch=null,this.locked=!0}}])}(),rM=function(){function t(e,n,r,a){es(this,t),this.r=e,this.texSize=n,this.texRows=r,this.createTextureCanvas=a,this.atlases=[],this.styleKeyToAtlas=new Map,this.markedKeys=new Set}return ts(t,[{key:"getKeys",value:function(){return new Set(this.styleKeyToAtlas.keys())}},{key:"_createAtlas",value:function(){var n=this.r,r=this.texSize,a=this.texRows,i=this.createTextureCanvas;return new nM(n,r,a,i)}},{key:"_getScratchCanvas",value:function(){if(!this.scratch){var n=this.r,r=this.texSize,a=this.texRows,i=this.createTextureCanvas,s=Math.floor(r/a);this.scratch=i(n,r,s,"scratch")}return this.scratch}},{key:"draw",value:function(n,r,a){var i=this.styleKeyToAtlas.get(n);return i||(i=this.atlases[this.atlases.length-1],(!i||!i.canFit(r))&&(i&&i.lock(),i=this._createAtlas(),this.atlases.push(i)),i.draw(n,r,a),this.styleKeyToAtlas.set(n,i)),i}},{key:"getAtlas",value:function(n){return this.styleKeyToAtlas.get(n)}},{key:"hasAtlas",value:function(n){return this.styleKeyToAtlas.has(n)}},{key:"markKeyForGC",value:function(n){this.markedKeys.add(n)}},{key:"gc",value:function(){var n=this,r=this.markedKeys;if(r.size===0){console.log("nothing to garbage collect");return}var a=[],i=new Map,s=null,o=_r(this.atlases),l;try{var u=function(){var f=l.value,h=f.getKeys(),v=aM(r,h);if(v.size===0)return a.push(f),h.forEach(function(E){return i.set(E,f)}),1;s||(s=n._createAtlas(),a.push(s));var p=_r(h),y;try{for(p.s();!(y=p.n()).done;){var b=y.value;if(!v.has(b)){var m=f.getOffsets(b),g=Fn(m,2),w=g[0],x=g[1];s.canFit({w:w.w+x.w,h:w.h})||(s.lock(),s=n._createAtlas(),a.push(s)),f.canvas&&(n._copyTextureToNewAtlas(b,f,s),i.set(b,s))}}}catch(E){p.e(E)}finally{p.f()}f.dispose()};for(o.s();!(l=o.n()).done;)u()}catch(d){o.e(d)}finally{o.f()}this.atlases=a,this.styleKeyToAtlas=i,this.markedKeys=new Set}},{key:"_copyTextureToNewAtlas",value:function(n,r,a){var i=r.getOffsets(n),s=Fn(i,2),o=s[0],l=s[1];if(l.w===0)a.draw(n,o,function(h){h.drawImage(r.canvas,o.x,o.y,o.w,o.h,0,0,o.w,o.h)});else{var u=this._getScratchCanvas();u.clear(),u.context.drawImage(r.canvas,o.x,o.y,o.w,o.h,0,0,o.w,o.h),u.context.drawImage(r.canvas,l.x,l.y,l.w,l.h,o.w,0,l.w,l.h);var d=o.w+l.w,f=o.h;a.draw(n,{w:d,h:f},function(h){h.drawImage(u,0,0,d,f,0,0,d,f)})}}},{key:"getCounts",value:function(){return{keyCount:this.styleKeyToAtlas.size,atlasCount:new Set(this.styleKeyToAtlas.values()).size}}}])}();function aM(t,e){return t.intersection?t.intersection(e):new Set(_d(t).filter(function(n){return e.has(n)}))}var iM=function(){function t(e,n){es(this,t),this.r=e,this.globalOptions=n,this.atlasSize=n.webglTexSize,this.maxAtlasesPerBatch=n.webglTexPerBatch,this.renderTypes=new Map,this.collections=new Map,this.typeAndIdToKey=new Map}return ts(t,[{key:"getAtlasSize",value:function(){return this.atlasSize}},{key:"addAtlasCollection",value:function(n,r){var a=this.globalOptions,i=a.webglTexSize,s=a.createTextureCanvas,o=r.texRows,l=this._cacheScratchCanvas(s),u=new rM(this.r,i,o,l);this.collections.set(n,u)}},{key:"addRenderType",value:function(n,r){var a=r.collection;if(!this.collections.has(a))throw new Error("invalid atlas collection name '".concat(a,"'"));var i=this.collections.get(a),s=pt({type:n,atlasCollection:i},r);this.renderTypes.set(n,s)}},{key:"getRenderTypeOpts",value:function(n){return this.renderTypes.get(n)}},{key:"getAtlasCollection",value:function(n){return this.collections.get(n)}},{key:"_cacheScratchCanvas",value:function(n){var r=-1,a=-1,i=null;return function(s,o,l,u){return u?((!i||o!=r||l!=a)&&(r=o,a=l,i=n(s,o,l)),i):n(s,o,l)}}},{key:"_key",value:function(n,r){return"".concat(n,"-").concat(r)}},{key:"invalidate",value:function(n){var r=this,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=a.forceRedraw,s=i===void 0?!1:i,o=a.filterEle,l=o===void 0?function(){return!0}:o,u=a.filterType,d=u===void 0?function(){return!0}:u,f=!1,h=!1,v=_r(n),p;try{for(v.s();!(p=v.n()).done;){var y=p.value;if(l(y)){var b=_r(this.renderTypes.values()),m;try{var g=function(){var x=m.value,E=x.type;if(d(E)){var S=r.collections.get(x.collection),C=x.getKey(y),T=Array.isArray(C)?C:[C];if(s)T.forEach(function(I){return S.markKeyForGC(I)}),h=!0;else{var N=x.getID?x.getID(y):y.id(),P=r._key(E,N),R=r.typeAndIdToKey.get(P);R!==void 0&&!KB(T,R)&&(f=!0,r.typeAndIdToKey.delete(P),R.forEach(function(I){return S.markKeyForGC(I)}))}}};for(b.s();!(m=b.n()).done;)g()}catch(w){b.e(w)}finally{b.f()}}}}catch(w){v.e(w)}finally{v.f()}return h&&(this.gc(),f=!1),f}},{key:"gc",value:function(){var n=_r(this.collections.values()),r;try{for(n.s();!(r=n.n()).done;){var a=r.value;a.gc()}}catch(i){n.e(i)}finally{n.f()}}},{key:"getOrCreateAtlas",value:function(n,r,a,i){var s=this.renderTypes.get(r),o=this.collections.get(s.collection),l=!1,u=o.draw(i,a,function(h){s.drawClipped?(h.save(),h.beginPath(),h.rect(0,0,a.w,a.h),h.clip(),s.drawElement(h,n,a,!0,!0),h.restore()):s.drawElement(h,n,a,!0,!0),l=!0});if(l){var d=s.getID?s.getID(n):n.id(),f=this._key(r,d);this.typeAndIdToKey.has(f)?this.typeAndIdToKey.get(f).push(i):this.typeAndIdToKey.set(f,[i])}return u}},{key:"getAtlasInfo",value:function(n,r){var a=this,i=this.renderTypes.get(r),s=i.getKey(n),o=Array.isArray(s)?s:[s];return o.map(function(l){var u=i.getBoundingBox(n,l),d=a.getOrCreateAtlas(n,r,u,l),f=d.getOffsets(l),h=Fn(f,2),v=h[0],p=h[1];return{atlas:d,tex:v,tex1:v,tex2:p,bb:u}})}},{key:"getDebugInfo",value:function(){var n=[],r=_r(this.collections),a;try{for(r.s();!(a=r.n()).done;){var i=Fn(a.value,2),s=i[0],o=i[1],l=o.getCounts(),u=l.keyCount,d=l.atlasCount;n.push({type:s,keyCount:u,atlasCount:d})}}catch(f){r.e(f)}finally{r.f()}return n}}])}(),sM=function(){function t(e){es(this,t),this.globalOptions=e,this.atlasSize=e.webglTexSize,this.maxAtlasesPerBatch=e.webglTexPerBatch,this.batchAtlases=[]}return ts(t,[{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(n,r){return r})}},{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(n){return this.batchAtlases.length===this.maxAtlasesPerBatch?this.batchAtlases.includes(n):!0}},{key:"getAtlasIndexForBatch",value:function(n){var r=this.batchAtlases.indexOf(n);if(r<0){if(this.batchAtlases.length===this.maxAtlasesPerBatch)throw new Error("cannot add more atlases to batch");this.batchAtlases.push(n),r=this.batchAtlases.length-1}return r}}])}(),oM=`
|
|
90
|
+
float circleSD(vec2 p, float r) {
|
|
91
|
+
return distance(vec2(0), p) - r; // signed distance
|
|
92
|
+
}
|
|
93
|
+
`,lM=`
|
|
94
|
+
float rectangleSD(vec2 p, vec2 b) {
|
|
95
|
+
vec2 d = abs(p)-b;
|
|
96
|
+
return distance(vec2(0),max(d,0.0)) + min(max(d.x,d.y),0.0);
|
|
97
|
+
}
|
|
98
|
+
`,uM=`
|
|
99
|
+
float roundRectangleSD(vec2 p, vec2 b, vec4 cr) {
|
|
100
|
+
cr.xy = (p.x > 0.0) ? cr.xy : cr.zw;
|
|
101
|
+
cr.x = (p.y > 0.0) ? cr.x : cr.y;
|
|
102
|
+
vec2 q = abs(p) - b + cr.x;
|
|
103
|
+
return min(max(q.x, q.y), 0.0) + distance(vec2(0), max(q, 0.0)) - cr.x;
|
|
104
|
+
}
|
|
105
|
+
`,cM=`
|
|
106
|
+
float ellipseSD(vec2 p, vec2 ab) {
|
|
107
|
+
p = abs( p ); // symmetry
|
|
108
|
+
|
|
109
|
+
// find root with Newton solver
|
|
110
|
+
vec2 q = ab*(p-ab);
|
|
111
|
+
float w = (q.x<q.y)? 1.570796327 : 0.0;
|
|
112
|
+
for( int i=0; i<5; i++ ) {
|
|
113
|
+
vec2 cs = vec2(cos(w),sin(w));
|
|
114
|
+
vec2 u = ab*vec2( cs.x,cs.y);
|
|
115
|
+
vec2 v = ab*vec2(-cs.y,cs.x);
|
|
116
|
+
w = w + dot(p-u,v)/(dot(p-u,u)+dot(v,v));
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// compute final point and distance
|
|
120
|
+
float d = length(p-ab*vec2(cos(w),sin(w)));
|
|
121
|
+
|
|
122
|
+
// return signed distance
|
|
123
|
+
return (dot(p/ab,p/ab)>1.0) ? d : -d;
|
|
124
|
+
}
|
|
125
|
+
`,Gl={SCREEN:{name:"screen",screen:!0},PICKING:{name:"picking",picking:!0}},Zd={IGNORE:1,USE_BB:2},gp=0,Gw=1,Yw=2,mp=3,to=4,Fc=5,Tl=6,Nl=7,dM=function(){function t(e,n,r){es(this,t),this.r=e,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=UB,this.atlasManager=new iM(e,r),this.batchManager=new sM(r),this.simpleShapeOptions=new Map,this.program=this._createShaderProgram(Gl.SCREEN),this.pickingProgram=this._createShaderProgram(Gl.PICKING),this.vao=this._createVAO()}return ts(t,[{key:"addAtlasCollection",value:function(n,r){this.atlasManager.addAtlasCollection(n,r)}},{key:"addTextureAtlasRenderType",value:function(n,r){this.atlasManager.addRenderType(n,r)}},{key:"addSimpleShapeRenderType",value:function(n,r){this.simpleShapeOptions.set(n,r)}},{key:"invalidate",value:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=r.type,i=this.atlasManager;return a?i.invalidate(n,{filterType:function(o){return o===a},forceRedraw:!0}):i.invalidate(n)}},{key:"gc",value:function(){this.atlasManager.gc()}},{key:"_createShaderProgram",value:function(n){var r=this.gl,a=`#version 300 es
|
|
126
|
+
precision highp float;
|
|
127
|
+
|
|
128
|
+
uniform mat3 uPanZoomMatrix;
|
|
129
|
+
uniform int uAtlasSize;
|
|
130
|
+
|
|
131
|
+
// instanced
|
|
132
|
+
in vec2 aPosition; // a vertex from the unit square
|
|
133
|
+
|
|
134
|
+
in mat3 aTransform; // used to transform verticies, eg into a bounding box
|
|
135
|
+
in int aVertType; // the type of thing we are rendering
|
|
136
|
+
|
|
137
|
+
// the z-index that is output when using picking mode
|
|
138
|
+
in vec4 aIndex;
|
|
139
|
+
|
|
140
|
+
// For textures
|
|
141
|
+
in int aAtlasId; // which shader unit/atlas to use
|
|
142
|
+
in vec4 aTex; // x/y/w/h of texture in atlas
|
|
143
|
+
|
|
144
|
+
// for edges
|
|
145
|
+
in vec4 aPointAPointB;
|
|
146
|
+
in vec4 aPointCPointD;
|
|
147
|
+
in vec2 aLineWidth; // also used for node border width
|
|
148
|
+
|
|
149
|
+
// simple shapes
|
|
150
|
+
in vec4 aCornerRadius; // for round-rectangle [top-right, bottom-right, top-left, bottom-left]
|
|
151
|
+
in vec4 aColor; // also used for edges
|
|
152
|
+
in vec4 aBorderColor; // aLineWidth is used for border width
|
|
153
|
+
|
|
154
|
+
// output values passed to the fragment shader
|
|
155
|
+
out vec2 vTexCoord;
|
|
156
|
+
out vec4 vColor;
|
|
157
|
+
out vec2 vPosition;
|
|
158
|
+
// flat values are not interpolated
|
|
159
|
+
flat out int vAtlasId;
|
|
160
|
+
flat out int vVertType;
|
|
161
|
+
flat out vec2 vTopRight;
|
|
162
|
+
flat out vec2 vBotLeft;
|
|
163
|
+
flat out vec4 vCornerRadius;
|
|
164
|
+
flat out vec4 vBorderColor;
|
|
165
|
+
flat out vec2 vBorderWidth;
|
|
166
|
+
flat out vec4 vIndex;
|
|
167
|
+
|
|
168
|
+
void main(void) {
|
|
169
|
+
int vid = gl_VertexID;
|
|
170
|
+
vec2 position = aPosition; // TODO make this a vec3, simplifies some code below
|
|
171
|
+
|
|
172
|
+
if(aVertType == `.concat(gp,`) {
|
|
173
|
+
float texX = aTex.x; // texture coordinates
|
|
174
|
+
float texY = aTex.y;
|
|
175
|
+
float texW = aTex.z;
|
|
176
|
+
float texH = aTex.w;
|
|
177
|
+
|
|
178
|
+
if(vid == 1 || vid == 2 || vid == 4) {
|
|
179
|
+
texX += texW;
|
|
180
|
+
}
|
|
181
|
+
if(vid == 2 || vid == 4 || vid == 5) {
|
|
182
|
+
texY += texH;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
float d = float(uAtlasSize);
|
|
186
|
+
vTexCoord = vec2(texX / d, texY / d); // tex coords must be between 0 and 1
|
|
187
|
+
|
|
188
|
+
gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);
|
|
189
|
+
}
|
|
190
|
+
else if(aVertType == `).concat(to," || aVertType == ").concat(Nl,`
|
|
191
|
+
|| aVertType == `).concat(Fc," || aVertType == ").concat(Tl,`) { // simple shapes
|
|
192
|
+
|
|
193
|
+
// the bounding box is needed by the fragment shader
|
|
194
|
+
vBotLeft = (aTransform * vec3(0, 0, 1)).xy; // flat
|
|
195
|
+
vTopRight = (aTransform * vec3(1, 1, 1)).xy; // flat
|
|
196
|
+
vPosition = (aTransform * vec3(position, 1)).xy; // will be interpolated
|
|
197
|
+
|
|
198
|
+
// calculations are done in the fragment shader, just pass these along
|
|
199
|
+
vColor = aColor;
|
|
200
|
+
vCornerRadius = aCornerRadius;
|
|
201
|
+
vBorderColor = aBorderColor;
|
|
202
|
+
vBorderWidth = aLineWidth;
|
|
203
|
+
|
|
204
|
+
gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);
|
|
205
|
+
}
|
|
206
|
+
else if(aVertType == `).concat(Gw,`) {
|
|
207
|
+
vec2 source = aPointAPointB.xy;
|
|
208
|
+
vec2 target = aPointAPointB.zw;
|
|
209
|
+
|
|
210
|
+
// adjust the geometry so that the line is centered on the edge
|
|
211
|
+
position.y = position.y - 0.5;
|
|
212
|
+
|
|
213
|
+
// stretch the unit square into a long skinny rectangle
|
|
214
|
+
vec2 xBasis = target - source;
|
|
215
|
+
vec2 yBasis = normalize(vec2(-xBasis.y, xBasis.x));
|
|
216
|
+
vec2 point = source + xBasis * position.x + yBasis * aLineWidth[0] * position.y;
|
|
217
|
+
|
|
218
|
+
gl_Position = vec4(uPanZoomMatrix * vec3(point, 1.0), 1.0);
|
|
219
|
+
vColor = aColor;
|
|
220
|
+
}
|
|
221
|
+
else if(aVertType == `).concat(Yw,`) {
|
|
222
|
+
vec2 pointA = aPointAPointB.xy;
|
|
223
|
+
vec2 pointB = aPointAPointB.zw;
|
|
224
|
+
vec2 pointC = aPointCPointD.xy;
|
|
225
|
+
vec2 pointD = aPointCPointD.zw;
|
|
226
|
+
|
|
227
|
+
// adjust the geometry so that the line is centered on the edge
|
|
228
|
+
position.y = position.y - 0.5;
|
|
229
|
+
|
|
230
|
+
vec2 p0, p1, p2, pos;
|
|
231
|
+
if(position.x == 0.0) { // The left side of the unit square
|
|
232
|
+
p0 = pointA;
|
|
233
|
+
p1 = pointB;
|
|
234
|
+
p2 = pointC;
|
|
235
|
+
pos = position;
|
|
236
|
+
} else { // The right side of the unit square, use same approach but flip the geometry upside down
|
|
237
|
+
p0 = pointD;
|
|
238
|
+
p1 = pointC;
|
|
239
|
+
p2 = pointB;
|
|
240
|
+
pos = vec2(0.0, -position.y);
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
vec2 p01 = p1 - p0;
|
|
244
|
+
vec2 p12 = p2 - p1;
|
|
245
|
+
vec2 p21 = p1 - p2;
|
|
246
|
+
|
|
247
|
+
// Find the normal vector.
|
|
248
|
+
vec2 tangent = normalize(normalize(p12) + normalize(p01));
|
|
249
|
+
vec2 normal = vec2(-tangent.y, tangent.x);
|
|
250
|
+
|
|
251
|
+
// Find the vector perpendicular to p0 -> p1.
|
|
252
|
+
vec2 p01Norm = normalize(vec2(-p01.y, p01.x));
|
|
253
|
+
|
|
254
|
+
// Determine the bend direction.
|
|
255
|
+
float sigma = sign(dot(p01 + p21, normal));
|
|
256
|
+
float width = aLineWidth[0];
|
|
257
|
+
|
|
258
|
+
if(sign(pos.y) == -sigma) {
|
|
259
|
+
// This is an intersecting vertex. Adjust the position so that there's no overlap.
|
|
260
|
+
vec2 point = 0.5 * width * normal * -sigma / dot(normal, p01Norm);
|
|
261
|
+
gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0);
|
|
262
|
+
} else {
|
|
263
|
+
// This is a non-intersecting vertex. Treat it like a mitre join.
|
|
264
|
+
vec2 point = 0.5 * width * normal * sigma * dot(normal, p01Norm);
|
|
265
|
+
gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0);
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
vColor = aColor;
|
|
269
|
+
}
|
|
270
|
+
else if(aVertType == `).concat(mp,` && vid < 3) {
|
|
271
|
+
// massage the first triangle into an edge arrow
|
|
272
|
+
if(vid == 0)
|
|
273
|
+
position = vec2(-0.15, -0.3);
|
|
274
|
+
if(vid == 1)
|
|
275
|
+
position = vec2( 0.0, 0.0);
|
|
276
|
+
if(vid == 2)
|
|
277
|
+
position = vec2( 0.15, -0.3);
|
|
278
|
+
|
|
279
|
+
gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);
|
|
280
|
+
vColor = aColor;
|
|
281
|
+
}
|
|
282
|
+
else {
|
|
283
|
+
gl_Position = vec4(2.0, 0.0, 0.0, 1.0); // discard vertex by putting it outside webgl clip space
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
vAtlasId = aAtlasId;
|
|
287
|
+
vVertType = aVertType;
|
|
288
|
+
vIndex = aIndex;
|
|
289
|
+
}
|
|
290
|
+
`),i=this.batchManager.getIndexArray(),s=`#version 300 es
|
|
291
|
+
precision highp float;
|
|
292
|
+
|
|
293
|
+
// declare texture unit for each texture atlas in the batch
|
|
294
|
+
`.concat(i.map(function(u){return"uniform sampler2D uTexture".concat(u,";")}).join(`
|
|
295
|
+
`),`
|
|
296
|
+
|
|
297
|
+
uniform vec4 uBGColor;
|
|
298
|
+
uniform float uZoom;
|
|
299
|
+
|
|
300
|
+
in vec2 vTexCoord;
|
|
301
|
+
in vec4 vColor;
|
|
302
|
+
in vec2 vPosition; // model coordinates
|
|
303
|
+
|
|
304
|
+
flat in int vAtlasId;
|
|
305
|
+
flat in vec4 vIndex;
|
|
306
|
+
flat in int vVertType;
|
|
307
|
+
flat in vec2 vTopRight;
|
|
308
|
+
flat in vec2 vBotLeft;
|
|
309
|
+
flat in vec4 vCornerRadius;
|
|
310
|
+
flat in vec4 vBorderColor;
|
|
311
|
+
flat in vec2 vBorderWidth;
|
|
312
|
+
|
|
313
|
+
out vec4 outColor;
|
|
314
|
+
|
|
315
|
+
`).concat(oM,`
|
|
316
|
+
`).concat(lM,`
|
|
317
|
+
`).concat(uM,`
|
|
318
|
+
`).concat(cM,`
|
|
319
|
+
|
|
320
|
+
vec4 blend(vec4 top, vec4 bot) { // blend colors with premultiplied alpha
|
|
321
|
+
return vec4(
|
|
322
|
+
top.rgb + (bot.rgb * (1.0 - top.a)),
|
|
323
|
+
top.a + (bot.a * (1.0 - top.a))
|
|
324
|
+
);
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
vec4 distInterp(vec4 cA, vec4 cB, float d) { // interpolate color using Signed Distance
|
|
328
|
+
// scale to the zoom level so that borders don't look blurry when zoomed in
|
|
329
|
+
// note 1.5 is an aribitrary value chosen because it looks good
|
|
330
|
+
return mix(cA, cB, 1.0 - smoothstep(0.0, 1.5 / uZoom, abs(d)));
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
void main(void) {
|
|
334
|
+
if(vVertType == `).concat(gp,`) {
|
|
335
|
+
// look up the texel from the texture unit
|
|
336
|
+
`).concat(i.map(function(u){return"if(vAtlasId == ".concat(u,") outColor = texture(uTexture").concat(u,", vTexCoord);")}).join(`
|
|
337
|
+
else `),`
|
|
338
|
+
}
|
|
339
|
+
else if(vVertType == `).concat(mp,`) {
|
|
340
|
+
// mimics how canvas renderer uses context.globalCompositeOperation = 'destination-out';
|
|
341
|
+
outColor = blend(vColor, uBGColor);
|
|
342
|
+
outColor.a = 1.0; // make opaque, masks out line under arrow
|
|
343
|
+
}
|
|
344
|
+
else if(vVertType == `).concat(to,` && vBorderWidth == vec2(0.0)) { // simple rectangle with no border
|
|
345
|
+
outColor = vColor; // unit square is already transformed to the rectangle, nothing else needs to be done
|
|
346
|
+
}
|
|
347
|
+
else if(vVertType == `).concat(to," || vVertType == ").concat(Nl,`
|
|
348
|
+
|| vVertType == `).concat(Fc," || vVertType == ").concat(Tl,`) { // use SDF
|
|
349
|
+
|
|
350
|
+
float outerBorder = vBorderWidth[0];
|
|
351
|
+
float innerBorder = vBorderWidth[1];
|
|
352
|
+
float borderPadding = outerBorder * 2.0;
|
|
353
|
+
float w = vTopRight.x - vBotLeft.x - borderPadding;
|
|
354
|
+
float h = vTopRight.y - vBotLeft.y - borderPadding;
|
|
355
|
+
vec2 b = vec2(w/2.0, h/2.0); // half width, half height
|
|
356
|
+
vec2 p = vPosition - vec2(vTopRight.x - b[0] - outerBorder, vTopRight.y - b[1] - outerBorder); // translate to center
|
|
357
|
+
|
|
358
|
+
float d; // signed distance
|
|
359
|
+
if(vVertType == `).concat(to,`) {
|
|
360
|
+
d = rectangleSD(p, b);
|
|
361
|
+
} else if(vVertType == `).concat(Nl,` && w == h) {
|
|
362
|
+
d = circleSD(p, b.x); // faster than ellipse
|
|
363
|
+
} else if(vVertType == `).concat(Nl,`) {
|
|
364
|
+
d = ellipseSD(p, b);
|
|
365
|
+
} else {
|
|
366
|
+
d = roundRectangleSD(p, b, vCornerRadius.wzyx);
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
// use the distance to interpolate a color to smooth the edges of the shape, doesn't need multisampling
|
|
370
|
+
// we must smooth colors inwards, because we can't change pixels outside the shape's bounding box
|
|
371
|
+
if(d > 0.0) {
|
|
372
|
+
if(d > outerBorder) {
|
|
373
|
+
discard;
|
|
374
|
+
} else {
|
|
375
|
+
outColor = distInterp(vBorderColor, vec4(0), d - outerBorder);
|
|
376
|
+
}
|
|
377
|
+
} else {
|
|
378
|
+
if(d > innerBorder) {
|
|
379
|
+
vec4 outerColor = outerBorder == 0.0 ? vec4(0) : vBorderColor;
|
|
380
|
+
vec4 innerBorderColor = blend(vBorderColor, vColor);
|
|
381
|
+
outColor = distInterp(innerBorderColor, outerColor, d);
|
|
382
|
+
}
|
|
383
|
+
else {
|
|
384
|
+
vec4 outerColor;
|
|
385
|
+
if(innerBorder == 0.0 && outerBorder == 0.0) {
|
|
386
|
+
outerColor = vec4(0);
|
|
387
|
+
} else if(innerBorder == 0.0) {
|
|
388
|
+
outerColor = vBorderColor;
|
|
389
|
+
} else {
|
|
390
|
+
outerColor = blend(vBorderColor, vColor);
|
|
391
|
+
}
|
|
392
|
+
outColor = distInterp(vColor, outerColor, d - innerBorder);
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
else {
|
|
397
|
+
outColor = vColor;
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
`).concat(n.picking?`if(outColor.a == 0.0) discard;
|
|
401
|
+
else outColor = vIndex;`:"",`
|
|
402
|
+
}
|
|
403
|
+
`),o=VB(r,a,s);o.aPosition=r.getAttribLocation(o,"aPosition"),o.aIndex=r.getAttribLocation(o,"aIndex"),o.aVertType=r.getAttribLocation(o,"aVertType"),o.aTransform=r.getAttribLocation(o,"aTransform"),o.aAtlasId=r.getAttribLocation(o,"aAtlasId"),o.aTex=r.getAttribLocation(o,"aTex"),o.aPointAPointB=r.getAttribLocation(o,"aPointAPointB"),o.aPointCPointD=r.getAttribLocation(o,"aPointCPointD"),o.aLineWidth=r.getAttribLocation(o,"aLineWidth"),o.aColor=r.getAttribLocation(o,"aColor"),o.aCornerRadius=r.getAttribLocation(o,"aCornerRadius"),o.aBorderColor=r.getAttribLocation(o,"aBorderColor"),o.uPanZoomMatrix=r.getUniformLocation(o,"uPanZoomMatrix"),o.uAtlasSize=r.getUniformLocation(o,"uAtlasSize"),o.uBGColor=r.getUniformLocation(o,"uBGColor"),o.uZoom=r.getUniformLocation(o,"uZoom"),o.uTextures=[];for(var l=0;l<this.batchManager.getMaxAtlasesPerBatch();l++)o.uTextures.push(r.getUniformLocation(o,"uTexture".concat(l)));return o}},{key:"_createVAO",value:function(){var n=[0,0,1,0,1,1,0,0,1,1,0,1];this.vertexCount=n.length/2;var r=this.maxInstances,a=this.gl,i=this.program,s=a.createVertexArray();return a.bindVertexArray(s),QB(a,"vec2",i.aPosition,n),this.transformBuffer=ZB(a,r,i.aTransform),this.indexBuffer=La(a,r,"vec4",i.aIndex),this.vertTypeBuffer=La(a,r,"int",i.aVertType),this.atlasIdBuffer=La(a,r,"int",i.aAtlasId),this.texBuffer=La(a,r,"vec4",i.aTex),this.pointAPointBBuffer=La(a,r,"vec4",i.aPointAPointB),this.pointCPointDBuffer=La(a,r,"vec4",i.aPointCPointD),this.lineWidthBuffer=La(a,r,"vec2",i.aLineWidth),this.colorBuffer=La(a,r,"vec4",i.aColor),this.cornerRadiusBuffer=La(a,r,"vec4",i.aCornerRadius),this.borderColorBuffer=La(a,r,"vec4",i.aBorderColor),a.bindVertexArray(null),s}},{key:"buffers",get:function(){var n=this;return this._buffers||(this._buffers=Object.keys(this).filter(function(r){return Ti(r,"Buffer")}).map(function(r){return n[r]})),this._buffers}},{key:"startFrame",value:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Gl.SCREEN;this.panZoomMatrix=n,this.renderTarget=r,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(n,r){return n.visible()?r&&r.isVisible?r.isVisible(n):!0:!1}},{key:"drawTexture",value:function(n,r,a){var i=this.atlasManager,s=this.batchManager,o=i.getRenderTypeOpts(a);if(this._isVisible(n,o)&&!(n.isEdge()&&!this._isValidEdge(n))){if(this.renderTarget.picking&&o.getTexPickingMode){var l=o.getTexPickingMode(n);if(l===Zd.IGNORE)return;if(l==Zd.USE_BB){this.drawPickingRectangle(n,r,a);return}}var u=i.getAtlasInfo(n,a),d=_r(u),f;try{for(d.s();!(f=d.n()).done;){var h=f.value,v=h.atlas,p=h.tex1,y=h.tex2;s.canAddToCurrentBatch(v)||this.endBatch();for(var b=s.getAtlasIndexForBatch(v),m=0,g=[[p,!0],[y,!1]];m<g.length;m++){var w=Fn(g[m],2),x=w[0],E=w[1];if(x.w!=0){var S=this.instanceCount;this.vertTypeBuffer.getView(S)[0]=gp;var C=this.indexBuffer.getView(S);eo(r,C);var T=this.atlasIdBuffer.getView(S);T[0]=b;var N=this.texBuffer.getView(S);N[0]=x.x,N[1]=x.y,N[2]=x.w,N[3]=x.h;var P=this.transformBuffer.getMatrixView(S);this.setTransformMatrix(n,P,o,h,E),this.instanceCount++,E||this.wrappedCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}catch(R){d.e(R)}finally{d.f()}}}},{key:"setTransformMatrix",value:function(n,r,a,i){var s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,o=0;if(a.shapeProps&&a.shapeProps.padding&&(o=n.pstyle(a.shapeProps.padding).pfValue),i){var l=i.bb,u=i.tex1,d=i.tex2,f=u.w/(u.w+d.w);s||(f=1-f);var h=this._getAdjustedBB(l,o,s,f);this._applyTransformMatrix(r,h,a,n)}else{var v=a.getBoundingBox(n),p=this._getAdjustedBB(v,o,!0,1);this._applyTransformMatrix(r,p,a,n)}}},{key:"_applyTransformMatrix",value:function(n,r,a,i){var s,o;Ww(n);var l=a.getRotation?a.getRotation(i):0;if(l!==0){var u=a.getRotationPoint(i),d=u.x,f=u.y;ud(n,n,[d,f]),Kw(n,n,l);var h=a.getRotationOffset(i);s=h.x+(r.xOffset||0),o=h.y+(r.yOffset||0)}else s=r.x1,o=r.y1;ud(n,n,[s,o]),Wg(n,n,[r.w,r.h])}},{key:"_getAdjustedBB",value:function(n,r,a,i){var s=n.x1,o=n.y1,l=n.w,u=n.h,d=n.yOffset;r&&(s-=r,o-=r,l+=2*r,u+=2*r);var f=0,h=l*i;return a&&i<1?l=h:!a&&i<1&&(f=l-h,s+=f,l=h),{x1:s,y1:o,w:l,h:u,xOffset:f,yOffset:d}}},{key:"drawPickingRectangle",value:function(n,r,a){var i=this.atlasManager.getRenderTypeOpts(a),s=this.instanceCount;this.vertTypeBuffer.getView(s)[0]=to;var o=this.indexBuffer.getView(s);eo(r,o);var l=this.colorBuffer.getView(s);hs([0,0,0],1,l);var u=this.transformBuffer.getMatrixView(s);this.setTransformMatrix(n,u,i),this.simpleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}},{key:"drawNode",value:function(n,r,a){var i=this.simpleShapeOptions.get(a);if(this._isVisible(n,i)){var s=i.shapeProps,o=this._getVertTypeForShape(n,s.shape);if(o===void 0||i.isSimple&&!i.isSimple(n,this.renderTarget)){this.drawTexture(n,r,a);return}var l=this.instanceCount;if(this.vertTypeBuffer.getView(l)[0]=o,o===Fc||o===Tl){var u=i.getBoundingBox(n),d=this._getCornerRadius(n,s.radius,u),f=this.cornerRadiusBuffer.getView(l);f[0]=d,f[1]=d,f[2]=d,f[3]=d,o===Tl&&(f[0]=0,f[2]=0)}var h=this.indexBuffer.getView(l);eo(r,h);var v=this.renderTarget.picking?1:a==="node-body"?n.effectiveOpacity():1,p=this.renderTarget.picking?1:n.pstyle(s.opacity).value*v,y=n.pstyle(s.color).value,b=this.colorBuffer.getView(l);hs(y,p,b);var m=this.lineWidthBuffer.getView(l);if(m[0]=0,m[1]=0,s.border){var g=n.pstyle("border-width").value;if(g>0){var w=n.pstyle("border-color").value,x=v*n.pstyle("border-opacity").value,E=this.borderColorBuffer.getView(l);hs(w,x,E);var S=n.pstyle("border-position").value;if(S==="inside")m[0]=0,m[1]=-g;else if(S==="outside")m[0]=g,m[1]=0;else{var C=g/2;m[0]=C,m[1]=-C}}}var T=this.transformBuffer.getMatrixView(l);this.setTransformMatrix(n,T,i),this.simpleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}},{key:"_getVertTypeForShape",value:function(n,r){var a=n.pstyle(r).value;switch(a){case"rectangle":return to;case"ellipse":return Nl;case"roundrectangle":case"round-rectangle":return Fc;case"bottom-round-rectangle":return Tl;default:return}}},{key:"_getCornerRadius",value:function(n,r,a){var i=a.w,s=a.h;if(n.pstyle(r).value==="auto")return Wi(i,s);var o=n.pstyle(r).pfValue,l=i/2,u=s/2;return Math.min(o,u,l)}},{key:"drawEdgeArrow",value:function(n,r,a){if(n.visible()){var i=n._private.rscratch,s,o,l;if(a==="source"?(s=i.arrowStartX,o=i.arrowStartY,l=i.srcArrowAngle):(s=i.arrowEndX,o=i.arrowEndY,l=i.tgtArrowAngle),!(isNaN(s)||s==null||isNaN(o)||o==null||isNaN(l)||l==null)){var u=n.pstyle(a+"-arrow-shape").value;if(u!=="none"){var d=n.pstyle(a+"-arrow-color").value,f=n.pstyle("opacity").value,h=n.pstyle("line-opacity").value,v=f*h,p=n.pstyle("width").pfValue,y=n.pstyle("arrow-scale").value,b=this.r.getArrowWidth(p,y),m=this.instanceCount,g=this.transformBuffer.getMatrixView(m);Ww(g),ud(g,g,[s,o]),Wg(g,g,[b,b]),Kw(g,g,l),this.vertTypeBuffer.getView(m)[0]=mp;var w=this.indexBuffer.getView(m);eo(r,w);var x=this.colorBuffer.getView(m);hs(d,v,x),this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}},{key:"drawEdgeLine",value:function(n,r){if(n.visible()){var a=this._getEdgePoints(n);if(a){var i=n.pstyle("opacity").value,s=n.pstyle("line-opacity").value,o=n.pstyle("width").pfValue,l=n.pstyle("line-color").value,u=i*s;if(a.length/2+this.instanceCount>this.maxInstances&&this.endBatch(),a.length==4){var d=this.instanceCount;this.vertTypeBuffer.getView(d)[0]=Gw;var f=this.indexBuffer.getView(d);eo(r,f);var h=this.colorBuffer.getView(d);hs(l,u,h);var v=this.lineWidthBuffer.getView(d);v[0]=o;var p=this.pointAPointBBuffer.getView(d);p[0]=a[0],p[1]=a[1],p[2]=a[2],p[3]=a[3],this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}else for(var y=0;y<a.length-2;y+=2){var b=this.instanceCount;this.vertTypeBuffer.getView(b)[0]=Yw;var m=this.indexBuffer.getView(b);eo(r,m);var g=this.colorBuffer.getView(b);hs(l,u,g);var w=this.lineWidthBuffer.getView(b);w[0]=o;var x=a[y-2],E=a[y-1],S=a[y],C=a[y+1],T=a[y+2],N=a[y+3],P=a[y+4],R=a[y+5];y==0&&(x=2*S-T+.001,E=2*C-N+.001),y==a.length-4&&(P=2*T-S+.001,R=2*N-C+.001);var I=this.pointAPointBBuffer.getView(b);I[0]=x,I[1]=E,I[2]=S,I[3]=C;var D=this.pointCPointDBuffer.getView(b);D[0]=T,D[1]=N,D[2]=P,D[3]=R,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}},{key:"_isValidEdge",value:function(n){var r=n._private.rscratch;return!(r.badLine||r.allpts==null||isNaN(r.allpts[0]))}},{key:"_getEdgePoints",value:function(n){var r=n._private.rscratch;if(this._isValidEdge(n)){var a=r.allpts;if(a.length==4)return a;var i=this._getNumSegments(n);return this._getCurveSegmentPoints(a,i)}}},{key:"_getNumSegments",value:function(n){var r=15;return Math.min(Math.max(r,5),this.maxInstances)}},{key:"_getCurveSegmentPoints",value:function(n,r){if(n.length==4)return n;for(var a=Array((r+1)*2),i=0;i<=r;i++)if(i==0)a[0]=n[0],a[1]=n[1];else if(i==r)a[i*2]=n[n.length-2],a[i*2+1]=n[n.length-1];else{var s=i/r;this._setCurvePoint(n,s,a,i*2)}return a}},{key:"_setCurvePoint",value:function(n,r,a,i){if(n.length<=2)a[i]=n[0],a[i+1]=n[1];else{for(var s=Array(n.length-2),o=0;o<s.length;o+=2){var l=(1-r)*n[o]+r*n[o+2],u=(1-r)*n[o+1]+r*n[o+3];s[o]=l,s[o+1]=u}return this._setCurvePoint(s,r,a,i)}}},{key:"endBatch",value:function(){var n=this.gl,r=this.vao,a=this.vertexCount,i=this.instanceCount;if(i!==0){var s=this.renderTarget.picking?this.pickingProgram:this.program;n.useProgram(s),n.bindVertexArray(r);var o=_r(this.buffers),l;try{for(o.s();!(l=o.n()).done;){var u=l.value;u.bufferSubData(i)}}catch(p){o.e(p)}finally{o.f()}for(var d=this.batchManager.getAtlases(),f=0;f<d.length;f++)d[f].bufferIfNeeded(n);for(var h=0;h<d.length;h++)n.activeTexture(n.TEXTURE0+h),n.bindTexture(n.TEXTURE_2D,d[h].texture),n.uniform1i(s.uTextures[h],h);n.uniform1f(s.uZoom,qB(this.r)),n.uniformMatrix3fv(s.uPanZoomMatrix,!1,this.panZoomMatrix),n.uniform1i(s.uAtlasSize,this.batchManager.getAtlasSize());var v=hs(this.bgColor,1);n.uniform4fv(s.uBGColor,v),n.drawArraysInstanced(n.TRIANGLES,0,a,i),n.bindVertexArray(null),n.bindTexture(n.TEXTURE_2D,null),this.debug&&this.batchDebugInfo.push({count:i,atlasCount:d.length}),this.startBatch()}}},{key:"getDebugInfo",value:function(){var n=this.atlasManager.getDebugInfo(),r=n.reduce(function(s,o){return s+o.atlasCount},0),a=this.batchDebugInfo,i=a.reduce(function(s,o){return s+o.count},0);return{atlasInfo:n,totalAtlases:r,wrappedCount:this.wrappedCount,simpleCount:this.simpleCount,batchCount:a.length,batchInfo:a,totalInstances:i}}}])}(),QS={};QS.initWebgl=function(t,e){var n=this,r=n.data.contexts[n.WEBGL];t.bgColor=fM(n),t.webglTexSize=Math.min(t.webglTexSize,r.getParameter(r.MAX_TEXTURE_SIZE)),t.webglTexRows=Math.min(t.webglTexRows,54),t.webglTexRowsNodes=Math.min(t.webglTexRowsNodes,54),t.webglBatchSize=Math.min(t.webglBatchSize,16384),t.webglTexPerBatch=Math.min(t.webglTexPerBatch,r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS)),n.webglDebug=t.webglDebug,n.webglDebugShowAtlases=t.webglDebugShowAtlases,n.pickingFrameBuffer=JB(r),n.pickingFrameBuffer.needsDraw=!0,n.drawing=new dM(n,r,t);var a=function(f){return function(h){return n.getTextAngle(h,f)}},i=function(f){return function(h){var v=h.pstyle(f);return v&&v.value}},s=function(f){return function(h){return h.pstyle("".concat(f,"-opacity")).value>0}},o=function(f){var h=f.pstyle("text-events").strValue==="yes";return h?Zd.USE_BB:Zd.IGNORE},l=function(f){var h=f.position(),v=h.x,p=h.y,y=f.outerWidth(),b=f.outerHeight();return{w:y,h:b,x1:v-y/2,y1:p-b/2}};n.drawing.addAtlasCollection("node",{texRows:t.webglTexRowsNodes}),n.drawing.addAtlasCollection("label",{texRows:t.webglTexRows}),n.drawing.addTextureAtlasRenderType("node-body",{collection:"node",getKey:e.getStyleKey,getBoundingBox:e.getElementBox,drawElement:e.drawElement}),n.drawing.addSimpleShapeRenderType("node-body",{getBoundingBox:l,isSimple:WB,shapeProps:{shape:"shape",color:"background-color",opacity:"background-opacity",radius:"corner-radius",border:!0}}),n.drawing.addSimpleShapeRenderType("node-overlay",{getBoundingBox:l,isVisible:s("overlay"),shapeProps:{shape:"overlay-shape",color:"overlay-color",opacity:"overlay-opacity",padding:"overlay-padding",radius:"overlay-corner-radius"}}),n.drawing.addSimpleShapeRenderType("node-underlay",{getBoundingBox:l,isVisible:s("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:o,getKey:yp(e.getLabelKey,null),getBoundingBox:bp(e.getLabelBox,null),drawClipped:!0,drawElement:e.drawLabel,getRotation:a(null),getRotationPoint:e.getLabelRotationPoint,getRotationOffset:e.getLabelRotationOffset,isVisible:i("label")}),n.drawing.addTextureAtlasRenderType("edge-source-label",{collection:"label",getTexPickingMode:o,getKey:yp(e.getSourceLabelKey,"source"),getBoundingBox:bp(e.getSourceLabelBox,"source"),drawClipped:!0,drawElement:e.drawSourceLabel,getRotation:a("source"),getRotationPoint:e.getSourceLabelRotationPoint,getRotationOffset:e.getSourceLabelRotationOffset,isVisible:i("source-label")}),n.drawing.addTextureAtlasRenderType("edge-target-label",{collection:"label",getTexPickingMode:o,getKey:yp(e.getTargetLabelKey,"target"),getBoundingBox:bp(e.getTargetLabelBox,"target"),drawClipped:!0,drawElement:e.drawTargetLabel,getRotation:a("target"),getRotationPoint:e.getTargetLabelRotationPoint,getRotationOffset:e.getTargetLabelRotationOffset,isVisible:i("target-label")});var u=Uu(function(){console.log("garbage collect flag set"),n.data.gc=!0},1e4);n.onUpdateEleCalcs(function(d,f){var h=!1;f&&f.length>0&&(h|=n.drawing.invalidate(f)),h&&u()}),hM(n)};function fM(t){var e=t.cy.container(),n=e&&e.style&&e.style.backgroundColor||"white";return CC(n)}function ZS(t,e){var n=t._private.rscratch;return Cr(n,"labelWrapCachedLines",e)||[]}var yp=function(e,n){return function(r){var a=e(r),i=ZS(r,n);return i.length>1?i.map(function(s,o){return"".concat(a,"_").concat(o)}):a}},bp=function(e,n){return function(r,a){var i=e(r);if(typeof a=="string"){var s=a.indexOf("_");if(s>0){var o=Number(a.substring(s+1)),l=ZS(r,n),u=i.h/l.length,d=u*o,f=i.y1+d;return{x1:i.x1,w:i.w,y1:f,h:u,yOffset:d}}}return i}};function hM(t){{var e=t.render;t.render=function(i){i=i||{};var s=t.cy;t.webgl&&(s.zoom()>qS?(vM(t),e.call(t,i)):(pM(t),ej(t,i,Gl.SCREEN)))}}{var n=t.matchCanvasSize;t.matchCanvasSize=function(i){n.call(t,i),t.pickingFrameBuffer.setFramebufferAttachmentSizes(t.canvasWidth,t.canvasHeight),t.pickingFrameBuffer.needsDraw=!0}}t.findNearestElements=function(i,s,o,l){return wM(t,i,s)};{var r=t.invalidateCachedZSortedEles;t.invalidateCachedZSortedEles=function(){r.call(t),t.pickingFrameBuffer.needsDraw=!0}}{var a=t.notify;t.notify=function(i,s){a.call(t,i,s),i==="viewport"||i==="bounds"?t.pickingFrameBuffer.needsDraw=!0:i==="background"&&t.drawing.invalidate(s,{type:"node-body"})}}}function vM(t){var e=t.data.contexts[t.WEBGL];e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT)}function pM(t){var e=function(r){r.save(),r.setTransform(1,0,0,1,0,0),r.clearRect(0,0,t.canvasWidth,t.canvasHeight),r.restore()};e(t.data.contexts[t.NODE]),e(t.data.contexts[t.DRAG])}function gM(t){var e=t.canvasWidth,n=t.canvasHeight,r=Ey(t),a=r.pan,i=r.zoom,s=pp();ud(s,s,[a.x,a.y]),Wg(s,s,[i,i]);var o=pp();tM(o,e,n);var l=pp();return eM(l,o,s),l}function JS(t,e){var n=t.canvasWidth,r=t.canvasHeight,a=Ey(t),i=a.pan,s=a.zoom;e.setTransform(1,0,0,1,0,0),e.clearRect(0,0,n,r),e.translate(i.x,i.y),e.scale(s,s)}function mM(t,e){t.drawSelectionRectangle(e,function(n){return JS(t,n)})}function yM(t){var e=t.data.contexts[t.NODE];e.save(),JS(t,e),e.strokeStyle="rgba(0, 0, 0, 0.3)",e.beginPath(),e.moveTo(-1e3,0),e.lineTo(1e3,0),e.stroke(),e.beginPath(),e.moveTo(0,-1e3),e.lineTo(0,1e3),e.stroke(),e.restore()}function bM(t){var e=function(a,i,s){for(var o=a.atlasManager.getAtlasCollection(i),l=t.data.contexts[t.NODE],u=o.atlases,d=0;d<u.length;d++){var f=u[d],h=f.canvas;if(h){var v=h.width,p=h.height,y=v*d,b=h.height*s,m=.4;l.save(),l.scale(m,m),l.drawImage(h,y,b),l.strokeStyle="black",l.rect(y,b,v,p),l.stroke(),l.restore()}}},n=0;e(t.drawing,"node",n++),e(t.drawing,"label",n++)}function xM(t,e,n,r,a){var i,s,o,l,u=Ey(t),d=u.pan,f=u.zoom;{var h=HB(t,d,f,e,n),v=Fn(h,2),p=v[0],y=v[1],b=6;i=p-b/2,s=y-b/2,o=b,l=b}if(o===0||l===0)return[];var m=t.data.contexts[t.WEBGL];m.bindFramebuffer(m.FRAMEBUFFER,t.pickingFrameBuffer),t.pickingFrameBuffer.needsDraw&&(m.viewport(0,0,m.canvas.width,m.canvas.height),ej(t,null,Gl.PICKING),t.pickingFrameBuffer.needsDraw=!1);var g=o*l,w=new Uint8Array(g*4);m.readPixels(i,s,o,l,m.RGBA,m.UNSIGNED_BYTE,w),m.bindFramebuffer(m.FRAMEBUFFER,null);for(var x=new Set,E=0;E<g;E++){var S=w.slice(E*4,E*4+4),C=GB(S)-1;C>=0&&x.add(C)}return x}function wM(t,e,n){var r=xM(t,e,n),a=t.getCachedZSortedEles(),i,s,o=_r(r),l;try{for(o.s();!(l=o.n()).done;){var u=l.value,d=a[u];if(!i&&d.isNode()&&(i=d),!s&&d.isEdge()&&(s=d),i&&s)break}}catch(f){o.e(f)}finally{o.f()}return[i,s].filter(Boolean)}function xp(t,e,n){var r=t.drawing;e+=1,n.isNode()?(r.drawNode(n,e,"node-underlay"),r.drawNode(n,e,"node-body"),r.drawTexture(n,e,"label"),r.drawNode(n,e,"node-overlay")):(r.drawEdgeLine(n,e),r.drawEdgeArrow(n,e,"source"),r.drawEdgeArrow(n,e,"target"),r.drawTexture(n,e,"label"),r.drawTexture(n,e,"edge-source-label"),r.drawTexture(n,e,"edge-target-label"))}function ej(t,e,n){var r;t.webglDebug&&(r=performance.now());var a=t.drawing,i=0;if(n.screen&&t.data.canvasNeedsRedraw[t.SELECT_BOX]&&mM(t,e),t.data.canvasNeedsRedraw[t.NODE]||n.picking){var s=t.data.contexts[t.WEBGL];n.screen?(s.clearColor(0,0,0,0),s.enable(s.BLEND),s.blendFunc(s.ONE,s.ONE_MINUS_SRC_ALPHA)):s.disable(s.BLEND),s.clear(s.COLOR_BUFFER_BIT|s.DEPTH_BUFFER_BIT),s.viewport(0,0,s.canvas.width,s.canvas.height);var o=gM(t),l=t.getCachedZSortedEles();if(i=l.length,a.startFrame(o,n),n.screen){for(var u=0;u<l.nondrag.length;u++)xp(t,u,l.nondrag[u]);for(var d=0;d<l.drag.length;d++)xp(t,d,l.drag[d])}else if(n.picking)for(var f=0;f<l.length;f++)xp(t,f,l[f]);a.endFrame(),n.screen&&t.webglDebugShowAtlases&&(yM(t),bM(t)),t.data.canvasNeedsRedraw[t.NODE]=!1,t.data.canvasNeedsRedraw[t.DRAG]=!1}if(t.webglDebug){var h=performance.now(),v=!1,p=Math.ceil(h-r),y=a.getDebugInfo(),b=["".concat(i," elements"),"".concat(y.totalInstances," instances"),"".concat(y.batchCount," batches"),"".concat(y.totalAtlases," atlases"),"".concat(y.wrappedCount," wrapped textures"),"".concat(y.simpleCount," simple shapes")].join(", ");if(v)console.log("WebGL (".concat(n.name,") - time ").concat(p,"ms, ").concat(b));else{console.log("WebGL (".concat(n.name,") - frame time ").concat(p,"ms")),console.log("Totals:"),console.log(" ".concat(b)),console.log("Texture Atlases Used:");var m=y.atlasInfo,g=_r(m),w;try{for(g.s();!(w=g.n()).done;){var x=w.value;console.log(" ".concat(x.type,": ").concat(x.keyCount," keys, ").concat(x.atlasCount," atlases"))}}catch(E){g.e(E)}finally{g.f()}console.log("")}}t.data.gc&&(console.log("Garbage Collect!"),t.data.gc=!1,a.gc())}var as={};as.drawPolygonPath=function(t,e,n,r,a,i){var s=r/2,o=a/2;t.beginPath&&t.beginPath(),t.moveTo(e+s*i[0],n+o*i[1]);for(var l=1;l<i.length/2;l++)t.lineTo(e+s*i[l*2],n+o*i[l*2+1]);t.closePath()};as.drawRoundPolygonPath=function(t,e,n,r,a,i,s){s.forEach(function(o){return DS(t,o)}),t.closePath()};as.drawRoundRectanglePath=function(t,e,n,r,a,i){var s=r/2,o=a/2,l=i==="auto"?Wi(r,a):Math.min(i,o,s);t.beginPath&&t.beginPath(),t.moveTo(e,n-o),t.arcTo(e+s,n-o,e+s,n,l),t.arcTo(e+s,n+o,e,n+o,l),t.arcTo(e-s,n+o,e-s,n,l),t.arcTo(e-s,n-o,e,n-o,l),t.lineTo(e,n-o),t.closePath()};as.drawBottomRoundRectanglePath=function(t,e,n,r,a,i){var s=r/2,o=a/2,l=i==="auto"?Wi(r,a):i;t.beginPath&&t.beginPath(),t.moveTo(e,n-o),t.lineTo(e+s,n-o),t.lineTo(e+s,n),t.arcTo(e+s,n+o,e,n+o,l),t.arcTo(e-s,n+o,e-s,n,l),t.lineTo(e-s,n-o),t.lineTo(e,n-o),t.closePath()};as.drawCutRectanglePath=function(t,e,n,r,a,i,s){var o=r/2,l=a/2,u=s==="auto"?uy():s;t.beginPath&&t.beginPath(),t.moveTo(e-o+u,n-l),t.lineTo(e+o-u,n-l),t.lineTo(e+o,n-l+u),t.lineTo(e+o,n+l-u),t.lineTo(e+o-u,n+l),t.lineTo(e-o+u,n+l),t.lineTo(e-o,n+l-u),t.lineTo(e-o,n-l+u),t.closePath()};as.drawBarrelPath=function(t,e,n,r,a){var i=r/2,s=a/2,o=e-i,l=e+i,u=n-s,d=n+s,f=Lg(r,a),h=f.widthOffset,v=f.heightOffset,p=f.ctrlPtOffsetPct*h;t.beginPath&&t.beginPath(),t.moveTo(o,u+v),t.lineTo(o,d-v),t.quadraticCurveTo(o+p,d,o+h,d),t.lineTo(l-h,d),t.quadraticCurveTo(l-p,d,l,d-v),t.lineTo(l,u+v),t.quadraticCurveTo(l-p,u,l-h,u),t.lineTo(o+h,u),t.quadraticCurveTo(o+p,u,o,u+v),t.closePath()};var Xw=Math.sin(0),Qw=Math.cos(0),Kg={},Gg={},tj=Math.PI/40;for(var no=0*Math.PI;no<2*Math.PI;no+=tj)Kg[no]=Math.sin(no),Gg[no]=Math.cos(no);as.drawEllipsePath=function(t,e,n,r,a){if(t.beginPath&&t.beginPath(),t.ellipse)t.ellipse(e,n,r/2,a/2,0,0,2*Math.PI);else for(var i,s,o=r/2,l=a/2,u=0*Math.PI;u<2*Math.PI;u+=tj)i=e-o*Kg[u]*Xw+o*Gg[u]*Qw,s=n+l*Gg[u]*Xw+l*Kg[u]*Qw,u===0?t.moveTo(i,s):t.lineTo(i,s);t.closePath()};var Yu={};Yu.createBuffer=function(t,e){var n=document.createElement("canvas");return n.width=t,n.height=e,[n,n.getContext("2d")]};Yu.bufferCanvasImage=function(t){var e=this.cy,n=e.mutableElements(),r=n.boundingBox(),a=this.findContainerClientCoords(),i=t.full?Math.ceil(r.w):a[2],s=t.full?Math.ceil(r.h):a[3],o=_e(t.maxWidth)||_e(t.maxHeight),l=this.getPixelRatio(),u=1;if(t.scale!==void 0)i*=t.scale,s*=t.scale,u=t.scale;else if(o){var d=1/0,f=1/0;_e(t.maxWidth)&&(d=u*t.maxWidth/i),_e(t.maxHeight)&&(f=u*t.maxHeight/s),u=Math.min(d,f),i*=u,s*=u}o||(i*=l,s*=l,u*=l);var h=document.createElement("canvas");h.width=i,h.height=s,h.style.width=i+"px",h.style.height=s+"px";var v=h.getContext("2d");if(i>0&&s>0){v.clearRect(0,0,i,s),v.globalCompositeOperation="source-over";var p=this.getCachedZSortedEles();if(t.full)v.translate(-r.x1*u,-r.y1*u),v.scale(u,u),this.drawElements(v,p),v.scale(1/u,1/u),v.translate(r.x1*u,r.y1*u);else{var y=e.pan(),b={x:y.x*u,y:y.y*u};u*=e.zoom(),v.translate(b.x,b.y),v.scale(u,u),this.drawElements(v,p),v.scale(1/u,1/u),v.translate(-b.x,-b.y)}t.bg&&(v.globalCompositeOperation="destination-over",v.fillStyle=t.bg,v.rect(0,0,i,s),v.fill())}return h};function kM(t,e){for(var n=atob(t),r=new ArrayBuffer(n.length),a=new Uint8Array(r),i=0;i<n.length;i++)a[i]=n.charCodeAt(i);return new Blob([r],{type:e})}function Zw(t){var e=t.indexOf(",");return t.substr(e+1)}function nj(t,e,n){var r=function(){return e.toDataURL(n,t.quality)};switch(t.output){case"blob-promise":return new nl(function(a,i){try{e.toBlob(function(s){s!=null?a(s):i(new Error("`canvas.toBlob()` sent a null value in its callback"))},n,t.quality)}catch(s){i(s)}});case"blob":return kM(Zw(r()),n);case"base64":return Zw(r());case"base64uri":default:return r()}}Yu.png=function(t){return nj(t,this.bufferCanvasImage(t),"image/png")};Yu.jpg=function(t){return nj(t,this.bufferCanvasImage(t),"image/jpeg")};var rj={};rj.nodeShapeImpl=function(t,e,n,r,a,i,s,o){switch(t){case"ellipse":return this.drawEllipsePath(e,n,r,a,i);case"polygon":return this.drawPolygonPath(e,n,r,a,i,s);case"round-polygon":return this.drawRoundPolygonPath(e,n,r,a,i,s,o);case"roundrectangle":case"round-rectangle":return this.drawRoundRectanglePath(e,n,r,a,i,o);case"cutrectangle":case"cut-rectangle":return this.drawCutRectanglePath(e,n,r,a,i,s,o);case"bottomroundrectangle":case"bottom-round-rectangle":return this.drawBottomRoundRectanglePath(e,n,r,a,i,o);case"barrel":return this.drawBarrelPath(e,n,r,a,i)}};var EM=aj,At=aj.prototype;At.CANVAS_LAYERS=3;At.SELECT_BOX=0;At.DRAG=1;At.NODE=2;At.WEBGL=3;At.CANVAS_TYPES=["2d","2d","2d","webgl2"];At.BUFFER_COUNT=3;At.TEXTURE_BUFFER=0;At.MOTIONBLUR_BUFFER_NODE=1;At.MOTIONBLUR_BUFFER_DRAG=2;function aj(t){var e=this,n=e.cy.window(),r=n.document;t.webgl&&(At.CANVAS_LAYERS=e.CANVAS_LAYERS=4,console.log("webgl rendering enabled")),e.data={canvases:new Array(At.CANVAS_LAYERS),contexts:new Array(At.CANVAS_LAYERS),canvasNeedsRedraw:new Array(At.CANVAS_LAYERS),bufferCanvases:new Array(At.BUFFER_COUNT),bufferContexts:new Array(At.CANVAS_LAYERS)};var a="-webkit-tap-highlight-color",i="rgba(0,0,0,0)";e.data.canvasContainer=r.createElement("div");var s=e.data.canvasContainer.style;e.data.canvasContainer.style[a]=i,s.position="relative",s.zIndex="0",s.overflow="hidden";var o=t.cy.container();o.appendChild(e.data.canvasContainer),o.style[a]=i;var l={"-webkit-user-select":"none","-moz-user-select":"-moz-none","user-select":"none","-webkit-tap-highlight-color":"rgba(0,0,0,0)","outline-style":"none"};vR()&&(l["-ms-touch-action"]="none",l["touch-action"]="none");for(var u=0;u<At.CANVAS_LAYERS;u++){var d=e.data.canvases[u]=r.createElement("canvas"),f=At.CANVAS_TYPES[u];e.data.contexts[u]=d.getContext(f),e.data.contexts[u]||yn("Could not create canvas of type "+f),Object.keys(l).forEach(function(fe){d.style[fe]=l[fe]}),d.style.position="absolute",d.setAttribute("data-id","layer"+u),d.style.zIndex=String(At.CANVAS_LAYERS-u),e.data.canvasContainer.appendChild(d),e.data.canvasNeedsRedraw[u]=!1}e.data.topCanvas=e.data.canvases[0],e.data.canvases[At.NODE].setAttribute("data-id","layer"+At.NODE+"-node"),e.data.canvases[At.SELECT_BOX].setAttribute("data-id","layer"+At.SELECT_BOX+"-selectbox"),e.data.canvases[At.DRAG].setAttribute("data-id","layer"+At.DRAG+"-drag"),e.data.canvases[At.WEBGL]&&e.data.canvases[At.WEBGL].setAttribute("data-id","layer"+At.WEBGL+"-webgl");for(var u=0;u<At.BUFFER_COUNT;u++)e.data.bufferCanvases[u]=r.createElement("canvas"),e.data.bufferContexts[u]=e.data.bufferCanvases[u].getContext("2d"),e.data.bufferCanvases[u].style.position="absolute",e.data.bufferCanvases[u].setAttribute("data-id","buffer"+u),e.data.bufferCanvases[u].style.zIndex=String(-u-1),e.data.bufferCanvases[u].style.visibility="hidden";e.pathsEnabled=!0;var h=jr(),v=function(Z){return{x:(Z.x1+Z.x2)/2,y:(Z.y1+Z.y2)/2}},p=function(Z){return{x:-Z.w/2,y:-Z.h/2}},y=function(Z){var ee=Z[0]._private,ne=ee.oldBackgroundTimestamp===ee.backgroundTimestamp;return!ne},b=function(Z){return Z[0]._private.nodeKey},m=function(Z){return Z[0]._private.labelStyleKey},g=function(Z){return Z[0]._private.sourceLabelStyleKey},w=function(Z){return Z[0]._private.targetLabelStyleKey},x=function(Z,ee,ne,de,Re){return e.drawElement(Z,ee,ne,!1,!1,Re)},E=function(Z,ee,ne,de,Re){return e.drawElementText(Z,ee,ne,de,"main",Re)},S=function(Z,ee,ne,de,Re){return e.drawElementText(Z,ee,ne,de,"source",Re)},C=function(Z,ee,ne,de,Re){return e.drawElementText(Z,ee,ne,de,"target",Re)},T=function(Z){return Z.boundingBox(),Z[0]._private.bodyBounds},N=function(Z){return Z.boundingBox(),Z[0]._private.labelBounds.main||h},P=function(Z){return Z.boundingBox(),Z[0]._private.labelBounds.source||h},R=function(Z){return Z.boundingBox(),Z[0]._private.labelBounds.target||h},I=function(Z,ee){return ee},D=function(Z){return v(T(Z))},$=function(Z,ee,ne){var de=Z?Z+"-":"";return{x:ee.x+ne.pstyle(de+"text-margin-x").pfValue,y:ee.y+ne.pstyle(de+"text-margin-y").pfValue}},H=function(Z,ee,ne){var de=Z[0]._private.rscratch;return{x:de[ee],y:de[ne]}},V=function(Z){return $("",H(Z,"labelX","labelY"),Z)},U=function(Z){return $("source",H(Z,"sourceLabelX","sourceLabelY"),Z)},F=function(Z){return $("target",H(Z,"targetLabelX","targetLabelY"),Z)},G=function(Z){return p(T(Z))},z=function(Z){return p(P(Z))},_=function(Z){return p(R(Z))},K=function(Z){var ee=N(Z),ne=p(N(Z));if(Z.isNode()){switch(Ko(Z.pstyle("text-halign").value)){case"left":ne.x=-ee.w-(ee.leftPad||0);break;case"right":ne.x=-(ee.rightPad||0);break}switch(Go(Z.pstyle("text-valign").value)){case"top":ne.y=-ee.h-(ee.topPad||0);break;case"bottom":ne.y=-(ee.botPad||0);break}}return ne},ie=e.data.eleTxrCache=new Ml(e,{getKey:b,doesEleInvalidateKey:y,drawElement:x,getBoundingBox:T,getRotationPoint:D,getRotationOffset:G,allowEdgeTxrCaching:!1,allowParentTxrCaching:!1}),M=e.data.lblTxrCache=new Ml(e,{getKey:m,drawElement:E,getBoundingBox:N,getRotationPoint:V,getRotationOffset:K,isVisible:I}),oe=e.data.slbTxrCache=new Ml(e,{getKey:g,drawElement:S,getBoundingBox:P,getRotationPoint:U,getRotationOffset:z,isVisible:I}),ve=e.data.tlbTxrCache=new Ml(e,{getKey:w,drawElement:C,getBoundingBox:R,getRotationPoint:F,getRotationOffset:_,isVisible:I}),ye=e.data.lyrTxrCache=new HS(e);e.onUpdateEleCalcs(function(Z,ee){ie.invalidateElements(ee),M.invalidateElements(ee),oe.invalidateElements(ee),ve.invalidateElements(ee),ye.invalidateElements(ee);for(var ne=0;ne<ee.length;ne++){var de=ee[ne]._private;de.oldBackgroundTimestamp=de.backgroundTimestamp}});var Te=function(Z){for(var ee=0;ee<Z.length;ee++)ye.enqueueElementRefinement(Z[ee].ele)};ie.onDequeue(Te),M.onDequeue(Te),oe.onDequeue(Te),ve.onDequeue(Te),t.webgl&&e.initWebgl(t,{getStyleKey:b,getLabelKey:m,getSourceLabelKey:g,getTargetLabelKey:w,drawElement:x,drawLabel:E,drawSourceLabel:S,drawTargetLabel:C,getElementBox:T,getLabelBox:N,getSourceLabelBox:P,getTargetLabelBox:R,getElementRotationPoint:D,getElementRotationOffset:G,getLabelRotationPoint:V,getSourceLabelRotationPoint:U,getTargetLabelRotationPoint:F,getLabelRotationOffset:K,getSourceLabelRotationOffset:z,getTargetLabelRotationOffset:_})}At.redrawHint=function(t,e){var n=this;switch(t){case"eles":n.data.canvasNeedsRedraw[At.NODE]=e;break;case"drag":n.data.canvasNeedsRedraw[At.DRAG]=e;break;case"select":n.data.canvasNeedsRedraw[At.SELECT_BOX]=e;break;case"gc":n.data.gc=!0;break}};var CM=typeof Path2D<"u";At.path2dEnabled=function(t){if(t===void 0)return this.pathsEnabled;this.pathsEnabled=!!t};At.usePaths=function(){return CM&&this.pathsEnabled};At.setImgSmoothing=function(t,e){t.imageSmoothingEnabled!=null?t.imageSmoothingEnabled=e:(t.webkitImageSmoothingEnabled=e,t.mozImageSmoothingEnabled=e,t.msImageSmoothingEnabled=e)};At.getImgSmoothing=function(t){return t.imageSmoothingEnabled!=null?t.imageSmoothingEnabled:t.webkitImageSmoothingEnabled||t.mozImageSmoothingEnabled||t.msImageSmoothingEnabled};At.makeOffscreenCanvas=function(t,e){var n;if((typeof OffscreenCanvas>"u"?"undefined":Gn(OffscreenCanvas))!=="undefined")n=new OffscreenCanvas(t,e);else{var r=this.cy.window(),a=r.document;n=a.createElement("canvas"),n.width=t,n.height=e}return n};[WS,Va,ci,ky,Vs,rs,Rr,QS,as,Yu,rj].forEach(function(t){pt(At,t)});var SM=[{name:"null",impl:IS},{name:"base",impl:VS},{name:"canvas",impl:EM}],jM=[{type:"layout",extensions:YD},{type:"renderer",extensions:SM}],ij={},sj={};function oj(t,e,n){var r=n,a=function(T){Jt("Can not register `"+e+"` for `"+t+"` since `"+T+"` already exists in the prototype and can not be overridden")};if(t==="core"){if(Tu.prototype[e])return a(e);Tu.prototype[e]=n}else if(t==="collection"){if(or.prototype[e])return a(e);or.prototype[e]=n}else if(t==="layout"){for(var i=function(T){this.options=T,n.call(this,T),Wt(this._private)||(this._private={}),this._private.cy=T.cy,this._private.listeners=[],this.createEmitter()},s=i.prototype=Object.create(n.prototype),o=[],l=0;l<o.length;l++){var u=o[l];s[u]=s[u]||function(){return this}}s.start&&!s.run?s.run=function(){return this.start(),this}:!s.start&&s.run&&(s.start=function(){return this.run(),this});var d=n.prototype.stop;s.stop=function(){var C=this.options;if(C&&C.animate){var T=this.animations;if(T)for(var N=0;N<T.length;N++)T[N].stop()}return d?d.call(this):this.emit("layoutstop"),this},s.destroy||(s.destroy=function(){return this}),s.cy=function(){return this._private.cy};var f=function(T){return T._private.cy},h={addEventFields:function(T,N){N.layout=T,N.cy=f(T),N.target=T},bubble:function(){return!0},parent:function(T){return f(T)}};pt(s,{createEmitter:function(){return this._private.emitter=new _f(h,this),this},emitter:function(){return this._private.emitter},on:function(T,N){return this.emitter().on(T,N),this},one:function(T,N){return this.emitter().one(T,N),this},once:function(T,N){return this.emitter().one(T,N),this},removeListener:function(T,N){return this.emitter().removeListener(T,N),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},emit:function(T,N){return this.emitter().emit(T,N),this}}),Zt.eventAliasesOn(s),r=i}else if(t==="renderer"&&e!=="null"&&e!=="base"){var v=lj("renderer","base"),p=v.prototype,y=n,b=n.prototype,m=function(){v.apply(this,arguments),y.apply(this,arguments)},g=m.prototype;for(var w in p){var x=p[w],E=b[w]!=null;if(E)return a(w);g[w]=x}for(var S in b)g[S]=b[S];p.clientFunctions.forEach(function(C){g[C]=g[C]||function(){yn("Renderer does not implement `renderer."+C+"()` on its prototype")}}),r=m}else if(t==="__proto__"||t==="constructor"||t==="prototype")return yn(t+" is an illegal type to be registered, possibly lead to prototype pollutions");return SC({map:ij,keys:[t,e],value:r})}function lj(t,e){return jC({map:ij,keys:[t,e]})}function TM(t,e,n,r,a){return SC({map:sj,keys:[t,e,n,r],value:a})}function NM(t,e,n,r){return jC({map:sj,keys:[t,e,n,r]})}var Yg=function(){if(arguments.length===2)return lj.apply(null,arguments);if(arguments.length===3)return oj.apply(null,arguments);if(arguments.length===4)return NM.apply(null,arguments);if(arguments.length===5)return TM.apply(null,arguments);yn("Invalid extension access syntax")};Tu.prototype.extension=Yg;jM.forEach(function(t){t.extensions.forEach(function(e){oj(t.type,e.name,e.impl)})});var Jd=function(){if(!(this instanceof Jd))return new Jd;this.length=0},zs=Jd.prototype;zs.instanceString=function(){return"stylesheet"};zs.selector=function(t){var e=this.length++;return this[e]={selector:t,properties:[]},this};zs.css=function(t,e){var n=this.length-1;if(ft(t))this[n].properties.push({name:t,value:e});else if(Wt(t))for(var r=t,a=Object.keys(r),i=0;i<a.length;i++){var s=a[i],o=r[s];if(o!=null){var l=Jn.properties[s]||Jn.properties[Rf(s)];if(l!=null){var u=l.name,d=o;this[n].properties.push({name:u,value:d})}}}return this};zs.style=zs.css;zs.generateStyle=function(t){var e=new Jn(t);return this.appendToStyle(e)};zs.appendToStyle=function(t){for(var e=0;e<this.length;e++){var n=this[e],r=n.selector,a=n.properties;t.selector(r);for(var i=0;i<a.length;i++){var s=a[i];t.css(s.name,s.value)}}return t};var PM="3.34.0",Xi=function(e){if(e===void 0&&(e={}),Wt(e))return new Tu(e);if(ft(e))return Yg.apply(Yg,arguments)};Xi.use=function(t){var e=Array.prototype.slice.call(arguments,1);return e.unshift(Xi),t.apply(null,e),this};Xi.warnings=function(t){return AC(t)};Xi.version=PM;Xi.stylesheet=Xi.Stylesheet=Jd;function Jw(t,e){const n={Repository:1,FeatureComponent:1,RouterComponent:1},r={entry:{fill:"#eef4ff",stroke:"#4a7dcf"},logic:{fill:"#f4effd",stroke:"#8a5cf6"},data:{fill:"#fdf6e3",stroke:"#c9963f"},query:{fill:"#fbeee4",stroke:"#b0643a"},adapter:{fill:"#eef8f1",stroke:"#4f9e6b"},pattern:{fill:"#f6f8fa",stroke:"#6a737d"},retired:{fill:"#efedeb",stroke:"#8a817c"}};function a(d){return d==="Specialist"||d==="Gateway"?"retired":d==="Portal"||d==="Observer"?"entry":d==="Query"?"query":d==="Store"||d==="Index"||d==="Registry"?"data":d==="Adapter"?"adapter":n[d]?"pattern":"logic"}function i(d){return String(d).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}const s=[],o=Object.create(null);t.components.forEach(function(d){o[d.id]=d});function l(d,f,h,v,p,y){const b=y?p.x-y.x:p.x,m=y?p.y-y.y:p.y;s.push(' <mxCell id="'+i(d)+'" value="'+i(h)+'" style="'+i(v)+'" vertex="1" parent="'+i(f)+'"><mxGeometry x="'+b+'" y="'+m+'" width="'+p.w+'" height="'+p.h+'" as="geometry"/></mxCell>')}t.subsystems.forEach(function(d){const f=e.subs[d.id];f&&l("sub_"+d.id,"1",d.name,"rounded=1;arcSize=4;fillColor=#ffffff;strokeColor=#b6c0cc;verticalAlign=top;fontStyle=1;fontSize=13;container=1;collapsible=1;whiteSpace=wrap;",f)}),t.components.forEach(function(d){const f=e.boxes[d.id];if(!f)return;const h=!!n[d.componentType]&&d.owns.length>0,v=d.owner?o[d.owner]:void 0,p=!!(v&&e.boxes[v.id]),y=p?"comp_"+v.id:"sub_"+d.subsystem,b=p?e.boxes[v.id]:e.subs[d.subsystem],m=r[a(d.componentType)],g=d.name+`
|
|
404
|
+
«`+d.componentType+(d.transport?"/"+d.transport:"")+"»",w=h?"rounded=1;fillColor="+m.fill+";strokeColor="+m.stroke+";dashed=1;verticalAlign=top;fontStyle=1;container=1;collapsible=1;whiteSpace=wrap;":"rounded=1;fillColor="+m.fill+";strokeColor="+m.stroke+";whiteSpace=wrap;fontSize=11;"+(d.public?"strokeWidth=3;":"");l("comp_"+d.id,y,g,w,f,b)});let u=0;return t.edges.forEach(function(d){if(!e.boxes[d.from]||!e.boxes[d.to])return;const f=d.cross?"edgeStyle=orthogonalEdgeStyle;rounded=1;strokeColor=#c26767;strokeWidth=2;endArrow=block;endFill=1;":"edgeStyle=orthogonalEdgeStyle;rounded=1;strokeColor=#8d97a5;endArrow=block;endFill=1;";s.push(' <mxCell id="edge_'+u+++'" style="'+i(f)+'" edge="1" parent="1" source="'+i("comp_"+d.from)+'" target="'+i("comp_"+d.to)+'"><mxGeometry relative="1" as="geometry"/></mxCell>')}),['<mxfile host="wairon" agent="wairon" modified="'+i(t.generatedAt)+'">',' <diagram id="architecture" name="'+i(t.system.name)+' architecture">',' <mxGraphModel dx="1000" dy="700" grid="0" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="0" pageScale="1" math="0" shadow="0">'," <root>",' <mxCell id="0"/>',' <mxCell id="1" parent="0"/>'].concat(s,[" </root>"," </mxGraphModel>"," </diagram>","</mxfile>",""]).join(`
|
|
405
|
+
`)}function e1(t,e){const n={Repository:1,FeatureComponent:1,RouterComponent:1},r={entry:{fill:"#eef4ff",stroke:"#4a7dcf"},logic:{fill:"#f4effd",stroke:"#8a5cf6"},data:{fill:"#fdf6e3",stroke:"#c9963f"},query:{fill:"#fbeee4",stroke:"#b0643a"},adapter:{fill:"#eef8f1",stroke:"#4f9e6b"},pattern:{fill:"#f6f8fa",stroke:"#6a737d"},retired:{fill:"#efedeb",stroke:"#8a817c"}};function a(f){return f==="Specialist"||f==="Gateway"?"retired":f==="Portal"||f==="Observer"?"entry":f==="Query"?"query":f==="Store"||f==="Index"||f==="Registry"?"data":f==="Adapter"?"adapter":n[f]?"pattern":"logic"}function i(f){let h=2166136261;for(let v=0;v<f.length;v++)h^=f.charCodeAt(v),h=Math.imul(h,16777619);return Math.abs(h)||1}function s(f,h,v){return{id:f,type:h,x:v.x,y:v.y,width:v.w,height:v.h,angle:0,strokeColor:"#1f2328",backgroundColor:"transparent",fillStyle:"solid",strokeWidth:1,strokeStyle:"solid",roughness:0,opacity:100,groupIds:[],frameId:null,roundness:{type:3},seed:i(f),version:1,versionNonce:i(f+"#n"),isDeleted:!1,boundElements:[],updated:1,link:null,locked:!1}}function o(f,h,v,p){const y=f.id+"-label",b=s(y,"text",{x:f.x+8,y:f.y+6,w:f.width-16,h:20});return b.roundness=null,b.text=h,b.originalText=h,b.fontSize=v,b.fontFamily=1,b.textAlign="center",b.verticalAlign=p,b.containerId=f.id,b.autoResize=!0,b.lineHeight=1.25,f.boundElements.push({id:y,type:"text"}),b}const l=[],u=Object.create(null);t.subsystems.forEach(function(f){const h=e.subs[f.id];if(!h)return;const v=s("sub-"+f.id,"rectangle",h);v.backgroundColor="#ffffff",v.strokeColor="#b6c0cc",l.push(v),l.push(o(v,f.name,14,"top"))}),t.components.forEach(function(f){const h=e.boxes[f.id];if(!h)return;const v=!!n[f.componentType]&&f.owns.length>0,p=r[a(f.componentType)],y=s("comp-"+f.id,"rectangle",h);y.backgroundColor=p.fill,y.strokeColor=p.stroke,y.strokeWidth=f.public?3:1,y.strokeStyle=v||a(f.componentType)==="pattern"?"dashed":"solid",l.push(y),u[f.id]=y;const b=f.name+`
|
|
406
|
+
«`+f.componentType+(f.transport?"/"+f.transport:"")+"»";l.push(o(y,b,11,v?"top":"middle"))});let d=0;return t.edges.forEach(function(f){const h=e.boxes[f.from],v=e.boxes[f.to],p=u[f.from],y=u[f.to];if(!h||!v||!p||!y)return;const b=v.x>=h.x+h.w,m=b?{x:h.x+h.w,y:h.y+h.h/2}:{x:h.x,y:h.y+h.h/2},g=b?{x:v.x,y:v.y+v.h/2}:{x:v.x+v.w,y:v.y+v.h/2},w="edge-"+d++,x=s(w,"arrow",{x:m.x,y:m.y,w:Math.abs(g.x-m.x),h:Math.abs(g.y-m.y)});x.roundness={type:2},x.strokeColor=f.cross?"#c26767":"#8d97a5",x.strokeWidth=f.cross?2:1,x.points=[[0,0],[g.x-m.x,g.y-m.y]],x.lastCommittedPoint=null,x.startBinding={elementId:p.id,focus:0,gap:4},x.endBinding={elementId:y.id,focus:0,gap:4},x.startArrowhead=null,x.endArrowhead="arrow",p.boundElements.push({id:w,type:"arrow"}),y.boundElements.push({id:w,type:"arrow"}),l.push(x)}),JSON.stringify({type:"excalidraw",version:2,source:"wairon",elements:l,appState:{viewBackgroundColor:"#fafbfc",gridSize:null},files:{}},null,2)}const RM=`/* GENERATED from src/core/canvas.ts by scripts/gen-canvas-engine.mjs — do not edit. */
|
|
407
|
+
:host { display:block; width:100%; height:100%; }
|
|
408
|
+
.cbody { display:flex; flex-direction:column; width:100%; height:100%; overflow:hidden; }
|
|
409
|
+
/* SYW Apps Standardized Global CSS (inlined for offline use) */
|
|
410
|
+
:host, .cbody {
|
|
411
|
+
--syw-cyan: #22ddff;
|
|
412
|
+
--syw-purple: #8b5cf6;
|
|
413
|
+
--syw-yellow: #ddff22;
|
|
414
|
+
--syw-amber: #f59e0b;
|
|
415
|
+
--syw-bg: #0a0a0f;
|
|
416
|
+
--syw-deep-space: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #312e81 100%);
|
|
417
|
+
--syw-surface: rgba(13, 27, 42, 0.95);
|
|
418
|
+
--syw-primary-gradient: linear-gradient(135deg, #22ddff 0%, #8b5cf6 100%);
|
|
419
|
+
--syw-secondary-gradient: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
|
|
420
|
+
--syw-surface-gradient: linear-gradient(135deg, rgba(13, 27, 42, 0.95) 0%, rgba(27, 38, 59, 0.98) 100%);
|
|
421
|
+
--syw-glow: 0 0 20px rgba(34, 221, 255, 0.3);
|
|
422
|
+
--syw-deep-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
|
|
423
|
+
}
|
|
424
|
+
.syw-gradient-text { background: var(--syw-primary-gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; display: inline-block; }
|
|
425
|
+
* { box-sizing: border-box; }
|
|
426
|
+
|
|
427
|
+
.cbody[data-theme="syw"] {
|
|
428
|
+
--bg: var(--syw-bg);
|
|
429
|
+
--chrome: #0e1a2b;
|
|
430
|
+
--chrome-border: rgba(34, 221, 255, 0.22);
|
|
431
|
+
--ink: #e8ecf3;
|
|
432
|
+
--dim: #9db0c7;
|
|
433
|
+
--line: rgba(255,255,255,0.12);
|
|
434
|
+
--input-bg: rgba(255,255,255,0.07);
|
|
435
|
+
--hover-bg: rgba(34, 221, 255, 0.12);
|
|
436
|
+
--accent: var(--syw-cyan);
|
|
437
|
+
--card: rgba(255,255,255,0.05);
|
|
438
|
+
--danger: #ff6b81; --warn: #f59e0b;
|
|
439
|
+
}
|
|
440
|
+
.cbody[data-theme="light"] {
|
|
441
|
+
--bg: #f2f5f8;
|
|
442
|
+
--chrome: #ffffff;
|
|
443
|
+
--chrome-border: #cfd8e1;
|
|
444
|
+
--ink: #1f2328;
|
|
445
|
+
--dim: #4d5761;
|
|
446
|
+
--line: #dde4ea;
|
|
447
|
+
--input-bg: #f1f4f7;
|
|
448
|
+
--hover-bg: rgba(74, 125, 207, 0.10);
|
|
449
|
+
--accent: #3465b4;
|
|
450
|
+
--card: #f7fafc;
|
|
451
|
+
--danger: #c22f3e; --warn: #9a6a00;
|
|
452
|
+
}
|
|
453
|
+
.cbody { margin:0; position:relative; background:var(--bg); color:var(--ink); font:13px/1.45 "Inter", system-ui, "Segoe UI", sans-serif; overflow:hidden; }
|
|
454
|
+
.cbody[data-theme="syw"] { background-image: var(--syw-deep-space); background-attachment: fixed; }
|
|
455
|
+
|
|
456
|
+
/* Floating header: the toolbar hovers over a FULL-BLEED canvas (blueprint-
|
|
457
|
+
designer style) instead of reserving a solid top bar. It anchors to the .cbody
|
|
458
|
+
(position:relative there) and yields to the details panel when that is open. */
|
|
459
|
+
header { flex:0 0 auto; display:flex; align-items:center; gap:10px; padding:0 14px; height:52px; background:var(--chrome); border:1px solid var(--chrome-border); border-radius:12px; box-shadow:var(--syw-deep-shadow); position:absolute; top:10px; left:12px; right:12px; z-index:20; overflow-x:auto; scrollbar-width:thin; }
|
|
460
|
+
.cbody:not(.panel-closed) header { right:calc(var(--panel-width, 380px) + 19px); }
|
|
461
|
+
/* Responsive overflow: on a narrow header the toolbar buttons must stay
|
|
462
|
+
REACHABLE (scroll) rather than wrapping off the right edge. Groups keep their
|
|
463
|
+
own shape; nothing shrinks below its content width. */
|
|
464
|
+
header > * { flex:0 0 auto; }
|
|
465
|
+
header .toolbar, header .tabs, header .grp { display:flex; align-items:center; gap:6px; flex:0 0 auto; }
|
|
466
|
+
header .brand { font-weight:800; font-size:17px; letter-spacing:.02em; }
|
|
467
|
+
#crumbs { display:flex; align-items:center; gap:4px; max-width:34vw; overflow-x:auto; white-space:nowrap; scrollbar-width:thin; }
|
|
468
|
+
#crumbs .crumb { border:none; background:transparent; color:var(--dim); cursor:pointer; font:inherit; font-size:12.5px; padding:4px 7px; border-radius:7px; }
|
|
469
|
+
#crumbs .crumb:hover { background:var(--hover-bg); color:var(--ink); }
|
|
470
|
+
#crumbs .crumb.cur { color:var(--ink); font-weight:700; cursor:default; }
|
|
471
|
+
#crumbs .sep { color:var(--dim); font-size:11px; }
|
|
472
|
+
header .divider { width:1px; height:24px; background:var(--line); margin:0 2px; }
|
|
473
|
+
header input[type="search"] { padding:6px 10px; border:1px solid var(--chrome-border); border-radius:8px; width:170px; font:inherit; background:var(--input-bg); color:var(--ink); }
|
|
474
|
+
header input[type="search"]::placeholder { color:var(--dim); }
|
|
475
|
+
.switch { display:inline-flex; align-items:center; gap:6px; cursor:pointer; color:var(--dim); font-size:12px; white-space:nowrap; user-select:none; padding:5px 8px; border-radius:8px; }
|
|
476
|
+
.switch:hover { background:var(--hover-bg); color:var(--ink); }
|
|
477
|
+
.switch input { accent-color:var(--accent); margin:0; }
|
|
478
|
+
.tbtn { border:1px solid var(--chrome-border); background:var(--input-bg); color:var(--ink); padding:6px 11px; border-radius:8px; cursor:pointer; font:inherit; font-size:12px; white-space:nowrap; }
|
|
479
|
+
.tbtn:hover { background:var(--hover-bg); border-color:var(--accent); }
|
|
480
|
+
.spacer { flex:1; }
|
|
481
|
+
.seg { display:flex; border:1px solid var(--chrome-border); border-radius:8px; overflow:hidden; }
|
|
482
|
+
.seg button { border:none; background:transparent; color:var(--dim); padding:5px 11px; cursor:pointer; font:inherit; font-size:12px; }
|
|
483
|
+
.seg button.active { background:var(--accent); color:#fff; font-weight:700; }
|
|
484
|
+
|
|
485
|
+
.dropdown { position:relative; }
|
|
486
|
+
/* Fixed (viewport-anchored) + JS-positioned on open, so the menu overlays the
|
|
487
|
+
whole page and is NEVER clipped by the header's overflow-x:auto (or, in the
|
|
488
|
+
embedded canvas, the app's scroll container) — which would otherwise trap it
|
|
489
|
+
inside the canvas and force a scrollbar. Position is set in wireDropdown. */
|
|
490
|
+
.dropdown .menu { display:none; position:fixed; max-height:calc(100vh - 80px); overflow-y:auto; background:var(--chrome); border:1px solid var(--chrome-border); border-radius:10px; box-shadow:var(--syw-deep-shadow); min-width:200px; padding:6px; z-index:120; }
|
|
491
|
+
/* Child combinator, deliberately: a dropdown moved INTO the "⋯" overflow menu
|
|
492
|
+
must not auto-open when the More dropdown opens (a descendant selector would
|
|
493
|
+
match every nested menu under .dropdown.open). */
|
|
494
|
+
.dropdown.open > .menu { display:block; }
|
|
495
|
+
.dropdown .menu button { display:block; width:100%; text-align:left; border:none; background:transparent; color:var(--ink); padding:8px 10px; border-radius:7px; cursor:pointer; font:inherit; font-size:12.5px; }
|
|
496
|
+
.dropdown .menu button:hover { background:var(--hover-bg); }
|
|
497
|
+
.dropdown .menu .hint { display:block; color:var(--dim); font-size:10.5px; }
|
|
498
|
+
/* Header controls collapsed into the "⋯" overflow menu: whole items (buttons
|
|
499
|
+
or nested dropdowns) stack vertically; a nested dropdown's own menu still
|
|
500
|
+
opens fixed-positioned over the page. */
|
|
501
|
+
#moreMenu .dropdown { display:block; width:100%; }
|
|
502
|
+
#moreMenu .dropdown > .tbtn, #moreMenu > .tbtn { display:block; width:100%; text-align:left; border:none; background:transparent; margin:2px 0; }
|
|
503
|
+
#moreMenu .dropdown > .tbtn:hover, #moreMenu > .tbtn:hover { background:var(--hover-bg); }
|
|
504
|
+
/* Staged header compaction (responsive only, never persisted): compact
|
|
505
|
+
stand-ins for the search input, the mode tabs, and the ancestor crumbs.
|
|
506
|
+
All hidden at full width, so a roomy header renders exactly as before. */
|
|
507
|
+
#searchBtn { position:relative; }
|
|
508
|
+
#searchBtn.hasq::after { content:''; position:absolute; top:3px; right:3px; width:7px; height:7px; border-radius:50%; background:var(--accent); }
|
|
509
|
+
.search-menu { min-width:210px; padding:8px; }
|
|
510
|
+
.search-menu input[type="search"] { width:100%; }
|
|
511
|
+
#modeMenu button.active { background:var(--accent); color:#fff; font-weight:700; }
|
|
512
|
+
#crumbs .dropdown { display:inline-flex; }
|
|
513
|
+
#crumbs .crumbmore { font-weight:700; }
|
|
514
|
+
|
|
515
|
+
/* Settings panel — toggle switches */
|
|
516
|
+
.settings-menu { min-width:266px; }
|
|
517
|
+
.swrow { display:flex; align-items:center; justify-content:space-between; gap:16px; padding:7px 9px; border-radius:8px; cursor:pointer; user-select:none; }
|
|
518
|
+
.swrow:hover { background:var(--hover-bg); }
|
|
519
|
+
.swrow .lbl { font-size:12.5px; color:var(--ink); line-height:1.3; }
|
|
520
|
+
.swrow .lbl .sub { display:block; color:var(--dim); font-size:10.5px; font-weight:400; }
|
|
521
|
+
.selectWrap { position:relative; width:100%; }
|
|
522
|
+
.selectWrap::after { content:'\\25BE'; position:absolute; right:10px; top:50%; transform:translateY(-50%); color:var(--dim); pointer-events:none; font-size:10px; }
|
|
523
|
+
.selectControl { width:100%; appearance:none; -webkit-appearance:none; background:var(--input-bg); color:var(--ink); border:1px solid var(--chrome-border); border-radius:7px; padding:6px 30px 6px 9px; font-size:11.5px; font-family:inherit; outline:none; color-scheme:dark; }
|
|
524
|
+
.selectControl:hover { border-color:var(--accent); background:var(--hover-bg); }
|
|
525
|
+
.selectControl:focus { border-color:var(--accent); box-shadow:0 0 0 2px color-mix(in srgb, var(--accent) 28%, transparent); }
|
|
526
|
+
.selectControl option { background:var(--chrome); color:var(--ink); }
|
|
527
|
+
.cbody[data-theme="light"] .selectControl { color-scheme:light; }
|
|
528
|
+
.toggle { position:relative; display:inline-block; width:36px; height:20px; flex:0 0 auto; }
|
|
529
|
+
.toggle input { position:absolute; opacity:0; width:0; height:0; margin:0; }
|
|
530
|
+
.toggle .track { position:absolute; inset:0; background:var(--input-bg); border:1px solid var(--chrome-border); border-radius:20px; transition:background .15s, border-color .15s; }
|
|
531
|
+
.toggle .track::after { content:''; position:absolute; top:2px; left:2px; width:14px; height:14px; background:var(--dim); border-radius:50%; transition:transform .15s, background .15s; }
|
|
532
|
+
.toggle input:checked + .track { background:var(--accent); border-color:var(--accent); }
|
|
533
|
+
.toggle input:checked + .track::after { transform:translateX(16px); background:#fff; }
|
|
534
|
+
|
|
535
|
+
#wrap { display:flex; height:100%; }
|
|
536
|
+
#stage { flex:1; min-width:0; position:relative; }
|
|
537
|
+
#cy { position:absolute; inset:0; }
|
|
538
|
+
.legend { position:absolute; left:12px; bottom:12px; background:var(--chrome); border:1px solid var(--chrome-border); border-radius:10px; padding:8px 12px; font-size:11px; color:var(--dim); z-index:5; pointer-events:none; }
|
|
539
|
+
.legend .sw { display:inline-block; width:10px; height:10px; border-radius:3px; margin-right:4px; vertical-align:-1px; border:1.5px solid; }
|
|
540
|
+
.reltip { position:absolute; display:none; background:var(--chrome); border:1px solid var(--chrome-border); border-radius:8px; padding:6px 10px; font-size:11px; color:var(--dim); white-space:pre; z-index:6; pointer-events:none; max-width:520px; overflow:hidden; }
|
|
541
|
+
/* Stage overlays clear the floating header (52px + 10px top + 10px gap). The
|
|
542
|
+
header hides in presentation mode, where they return to the top edge. */
|
|
543
|
+
.viewhint { position:absolute; top:72px; left:12px; color:var(--dim); font-size:11px; background:var(--chrome); border:1px solid var(--chrome-border); border-radius:9px; padding:5px 10px; z-index:5; pointer-events:none; }
|
|
544
|
+
.cbody.presentation .viewhint { top:10px; }
|
|
545
|
+
#typesWarn { position:absolute; top:72px; left:50%; transform:translateX(-50%); color:var(--ink); font-size:12px; background:var(--chrome); border:1px solid var(--warn); border-radius:9px; padding:6px 12px; z-index:6; max-width:72vw; box-shadow:var(--syw-deep-shadow); display:none; }
|
|
546
|
+
#typesWarn button { margin-left:8px; }
|
|
547
|
+
|
|
548
|
+
#panelResizer { flex:0 0 7px; cursor:col-resize; background:var(--chrome); border-left:1px solid var(--chrome-border); border-right:1px solid var(--line); z-index:11; position:relative; }
|
|
549
|
+
#panelResizer::after { content:''; position:absolute; top:50%; left:50%; width:2px; height:48px; transform:translate(-50%, -50%); border-radius:2px; background:var(--dim); opacity:.45; }
|
|
550
|
+
#panelResizer:hover::after, .cbody.resizing-panel #panelResizer::after { background:var(--accent); opacity:1; }
|
|
551
|
+
#panel { width:var(--panel-width, 380px); flex:0 0 var(--panel-width, 380px); border-left:1px solid var(--chrome-border); background:var(--chrome); overflow-y:auto; z-index:10; }
|
|
552
|
+
.cbody.panel-closed #panel, .cbody.panel-closed #panelResizer { display:none; }
|
|
553
|
+
.cbody.resizing-panel { cursor:col-resize; user-select:none; }
|
|
554
|
+
.cbody.resizing-panel #cy { pointer-events:none; }
|
|
555
|
+
.cbody:not(.panel-closed) #panelToggle { background:var(--accent); color:#fff; border-color:var(--accent); font-weight:700; }
|
|
556
|
+
#panel .head { padding:16px 18px 10px; border-bottom:1px solid var(--line); }
|
|
557
|
+
#panel .head h2 { font-size:16px; margin:0 0 6px; }
|
|
558
|
+
#panel .body { padding:12px 18px 30px; }
|
|
559
|
+
#panel .chip { display:inline-block; padding:2px 9px; border-radius:11px; font-size:11px; border:1px solid var(--chrome-border); margin:0 4px 5px 0; background:var(--input-bg); color:var(--ink); }
|
|
560
|
+
#panel .chip[data-kind] { cursor:pointer; }
|
|
561
|
+
#panel .chip[data-kind]:hover { border-color:var(--accent); background:var(--hover-bg); }
|
|
562
|
+
#panel .desc { color:var(--dim); margin:8px 0 2px; }
|
|
563
|
+
#panel .openbtn { margin:6px 0 0; }
|
|
564
|
+
#panel details { border:1px solid var(--line); border-radius:10px; margin:10px 0; background:var(--card); overflow:hidden; }
|
|
565
|
+
#panel summary { cursor:pointer; padding:9px 12px; font-size:11.5px; font-weight:700; text-transform:uppercase; letter-spacing:.05em; color:var(--dim); user-select:none; display:flex; align-items:center; gap:8px; }
|
|
566
|
+
#panel summary:hover { color:var(--ink); background:var(--hover-bg); }
|
|
567
|
+
#panel summary .count { margin-left:auto; font-weight:600; background:var(--input-bg); border:1px solid var(--line); border-radius:9px; padding:0 7px; font-size:10.5px; }
|
|
568
|
+
#panel details > .inner { padding:4px 12px 12px; }
|
|
569
|
+
#panel .method { border:1px solid var(--line); border-radius:8px; padding:8px 10px; margin:8px 0; background:var(--chrome); }
|
|
570
|
+
#panel .method .mname { font-weight:700; display:flex; align-items:center; gap:6px; flex-wrap:wrap; }
|
|
571
|
+
#panel .method .mname .grow { flex:1; }
|
|
572
|
+
#panel .method code { font-size:11px; word-break:break-all; color:var(--dim); display:block; margin-top:3px; }
|
|
573
|
+
#panel .method .mdesc { color:var(--dim); font-size:12px; margin-top:3px; }
|
|
574
|
+
#panel .flowbtn { border:1px solid var(--chrome-border); background:var(--input-bg); color:var(--accent); font-size:10.5px; padding:2px 8px; border-radius:7px; cursor:pointer; }
|
|
575
|
+
#panel .flowbtn:hover { background:var(--hover-bg); }
|
|
576
|
+
#panel .issue { border-left:3px solid var(--danger); padding:6px 9px; margin:6px 0; background:var(--card); font-size:12px; border-radius:0 7px 7px 0; }
|
|
577
|
+
#panel .issue.warning { border-left-color:var(--warn); }
|
|
578
|
+
#panel .issue.notice { border-left-color:var(--accent); }
|
|
579
|
+
#panel .issue .sev { font-size:10px; color:var(--dim); text-transform:uppercase; letter-spacing:.04em; margin-left:6px; }
|
|
580
|
+
#panel .issue code { font-size:10.5px; color:var(--dim); }
|
|
581
|
+
|
|
582
|
+
/* Presentation mode = the canvas page, focused: the header chrome and legend
|
|
583
|
+
are hidden, but the details panel stays TOGGLE-ABLE (the current settings are
|
|
584
|
+
still applied). It does NOT force browser fullscreen (F11) — exiting is one
|
|
585
|
+
step, not two. */
|
|
586
|
+
.cbody.presentation header, .cbody.presentation .legend { display:none; }
|
|
587
|
+
/* Embed mode (?_embed=true): the canvas is rendered inside the wairon web app's
|
|
588
|
+
own chrome, so its redundant brand mark is hidden — the interactive toolbar
|
|
589
|
+
(views, search, settings) stays. Keeps the iframe from showing a second logo. */
|
|
590
|
+
.cbody.embed header .brand { display:none; }
|
|
591
|
+
/* Embedded in the web UI: the app owns the brand + theme, so hide the canvas's
|
|
592
|
+
own brand mark and Theme toggle (the host drives the canvas theme). */
|
|
593
|
+
.cbody.embed #themeBtn { display:none; }
|
|
594
|
+
/* The details panel hides by default in presentation, but the floating details
|
|
595
|
+
toggle brings it back without leaving presentation mode. */
|
|
596
|
+
.cbody.presentation #panel, .cbody.presentation #panelResizer { display:none; }
|
|
597
|
+
.cbody.presentation.show-details #panel { display:block; }
|
|
598
|
+
.cbody.presentation.show-details #panelResizer { display:block; }
|
|
599
|
+
.cbody.presentation #wrap { height:100%; }
|
|
600
|
+
#exitPresent, #presentDetails { display:none; position:fixed; top:10px; z-index:100; border:1px solid var(--chrome-border); background:var(--chrome); color:var(--ink); border-radius:9px; padding:7px 13px; cursor:pointer; opacity:0.06; transition:opacity .15s ease; font:inherit; }
|
|
601
|
+
#exitPresent { right:10px; }
|
|
602
|
+
#presentDetails { right:190px; }
|
|
603
|
+
#exitPresent:hover, #presentDetails:hover { opacity:1; box-shadow:var(--syw-glow); }
|
|
604
|
+
.cbody.presentation #exitPresent, .cbody.presentation #presentDetails { display:block; }
|
|
605
|
+
|
|
606
|
+
@media (max-width: 860px) {
|
|
607
|
+
#wrap { position:relative; }
|
|
608
|
+
#panel { position:absolute; top:0; right:0; bottom:0; width:min(var(--panel-width, 360px), calc(100vw - 44px)); flex-basis:auto; box-shadow:var(--syw-deep-shadow); }
|
|
609
|
+
#panelResizer { position:absolute; top:0; bottom:0; right:min(var(--panel-width, 360px), calc(100vw - 44px)); width:7px; flex-basis:auto; box-shadow:-3px 0 10px rgba(0,0,0,.18); }
|
|
610
|
+
/* The panel overlays the stage here, so the floating header keeps full width. */
|
|
611
|
+
.cbody:not(.panel-closed) header { right:12px; }
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
#flowModal { display:none; position:fixed; inset:0; background:rgba(4,6,12,0.6); backdrop-filter:blur(3px); z-index:80; align-items:center; justify-content:center; }
|
|
615
|
+
#flowModal.open { display:flex; }
|
|
616
|
+
#flowModal .box { width:min(880px, 92vw); height:min(660px, 88vh); background:var(--chrome); border:1px solid var(--chrome-border); border-radius:14px; box-shadow:var(--syw-deep-shadow); display:flex; flex-direction:column; overflow:hidden; }
|
|
617
|
+
#flowModal .bar { display:flex; align-items:center; gap:10px; padding:10px 14px; border-bottom:1px solid var(--line); }
|
|
618
|
+
#flowModal .bar .crumbf { font-weight:700; font-size:13px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
|
|
619
|
+
#flowModal .bar .crumbf .dimc { color:var(--dim); font-weight:400; }
|
|
620
|
+
#flowCy { flex:1; }
|
|
621
|
+
#flowSteps { flex:1; display:none; overflow-y:auto; padding:16px 22px; }
|
|
622
|
+
#flowModal.steps #flowCy { display:none; }
|
|
623
|
+
#flowModal.steps #flowSteps { display:block; }
|
|
624
|
+
#flowSteps .fstep { border:1px solid var(--line); border-radius:9px; background:var(--card); padding:9px 12px; margin:8px 0; font-size:12.5px; }
|
|
625
|
+
#flowSteps .fstep .num { display:inline-block; min-width:22px; font-weight:700; color:var(--accent); }
|
|
626
|
+
#flowSteps .fstep .call { color:var(--dim); }
|
|
627
|
+
#flowSteps .fstep .call.drillstep { color:var(--accent); cursor:pointer; text-decoration:underline; }
|
|
628
|
+
#flowSteps .fstep .call.drillstep:hover { opacity:.82; }
|
|
629
|
+
#flowModal .hintbar { padding:6px 14px; color:var(--dim); font-size:11px; border-top:1px solid var(--line); }`,IM=`<header id="hdr">
|
|
630
|
+
<span class="brand syw-gradient-text">wairon</span>
|
|
631
|
+
<div class="seg" id="modeSeg" title="Switch between the component architecture, the type ERD, or the database schemas">
|
|
632
|
+
<button data-vm="components" class="active">Components</button>
|
|
633
|
+
<button data-vm="types">Types</button>
|
|
634
|
+
<button data-vm="databases">Databases</button>
|
|
635
|
+
<button data-vm="network" style="display:none" title="The derived network view: declared networks, gateways, outside and the allowed flows">Network</button>
|
|
636
|
+
</div>
|
|
637
|
+
<div class="dropdown" id="modeDd" style="display:none">
|
|
638
|
+
<button class="tbtn" id="modeBtn" title="Switch between the component architecture, the type ERD, or the database schemas">Components ▾</button>
|
|
639
|
+
<div class="menu" id="modeMenu"></div>
|
|
640
|
+
</div>
|
|
641
|
+
<nav id="crumbs"></nav>
|
|
642
|
+
<span class="divider"></span>
|
|
643
|
+
<input id="search" type="search" placeholder="Search this view…">
|
|
644
|
+
<div class="dropdown" id="searchDd" style="display:none">
|
|
645
|
+
<button class="tbtn" id="searchBtn" title="Search this view">🔍</button>
|
|
646
|
+
<div class="menu search-menu" id="searchMenu"></div>
|
|
647
|
+
</div>
|
|
648
|
+
<div class="seg" id="typesDetailSeg" style="display:none" title="ERD detail level">
|
|
649
|
+
<button data-td="full">Full</button>
|
|
650
|
+
<button data-td="fields">Fields</button>
|
|
651
|
+
<button data-td="keys">Keys</button>
|
|
652
|
+
<button data-td="names">Names</button>
|
|
653
|
+
</div>
|
|
654
|
+
<span class="spacer"></span>
|
|
655
|
+
<div class="dropdown" id="settingsDd">
|
|
656
|
+
<button class="tbtn" id="settingsBtn" title="View options">⚙ View ▾</button>
|
|
657
|
+
<div class="menu settings-menu" id="settingsMenu">
|
|
658
|
+
<label class="swrow">
|
|
659
|
+
<span class="lbl">Internals<span class="sub">preview each box's children + relations</span></span>
|
|
660
|
+
<span class="toggle"><input type="checkbox" id="internalsToggle"><span class="track"></span></span>
|
|
661
|
+
</label>
|
|
662
|
+
<label class="swrow">
|
|
663
|
+
<span class="lbl">Externals<span class="sub">out-of-scope dependencies as ghosts</span></span>
|
|
664
|
+
<span class="toggle"><input type="checkbox" id="externalsToggle" checked><span class="track"></span></span>
|
|
665
|
+
</label>
|
|
666
|
+
<label class="swrow">
|
|
667
|
+
<span class="lbl">Data coupling<span class="sub">who uses another subsystem's types (dashed)</span></span>
|
|
668
|
+
<span class="toggle"><input type="checkbox" id="dataCouplingToggle"><span class="track"></span></span>
|
|
669
|
+
</label>
|
|
670
|
+
<label class="swrow">
|
|
671
|
+
<span class="lbl">Issues (<span id="issueCount"></span>)<span class="sub">overlay validation findings</span></span>
|
|
672
|
+
<span class="toggle"><input type="checkbox" id="issuesToggle"><span class="track"></span></span>
|
|
673
|
+
</label>
|
|
674
|
+
<label class="swrow">
|
|
675
|
+
<span class="lbl">Rearrange<span class="sub">drag boxes to fine-tune the layout</span></span>
|
|
676
|
+
<span class="toggle"><input type="checkbox" id="dragToggle"><span class="track"></span></span>
|
|
677
|
+
</label>
|
|
678
|
+
<div class="swrow" style="flex-direction:column;align-items:flex-start;gap:6px;padding:8px 12px 10px;border-top:1px solid var(--line);">
|
|
679
|
+
<span class="lbl" style="padding:0">Line Style<span class="sub" style="margin-top:2px">Choose how relationship lines are routed</span></span>
|
|
680
|
+
<span class="selectWrap">
|
|
681
|
+
<select id="lineStyleSelect" class="selectControl">
|
|
682
|
+
<option value="bezier">Curved Bezier</option>
|
|
683
|
+
<option value="straight">Straight Lines</option>
|
|
684
|
+
<option value="taxi">Orthogonal Corners</option>
|
|
685
|
+
</select>
|
|
686
|
+
</span>
|
|
687
|
+
</div>
|
|
688
|
+
</div>
|
|
689
|
+
</div>
|
|
690
|
+
<button class="tbtn" id="fitBtn" title="Fit graph to view">Fit</button>
|
|
691
|
+
<button class="tbtn" id="resetBtn" title="Discard this view's saved rearrangement">Reset layout</button>
|
|
692
|
+
<button class="tbtn" id="panelToggle" title="Show or hide the details sidebar">Details</button>
|
|
693
|
+
<div class="dropdown" id="layoutDd">
|
|
694
|
+
<button class="tbtn" id="layoutBtn" title="Choose the auto-layout algorithm">Layout: Layered ▾</button>
|
|
695
|
+
<div class="menu">
|
|
696
|
+
<button id="layoutLayered">Layered <span class="hint">dependency columns (default)</span></button>
|
|
697
|
+
<button id="layoutForce">Force <span class="hint">physics relaxation — untangles crossings</span></button>
|
|
698
|
+
<button id="layoutConcentric">Concentric <span class="hint">most-referenced in the centre, rings outward</span></button>
|
|
699
|
+
<button id="layoutGrid">Grid <span class="hint">compact wrapped rows</span></button>
|
|
700
|
+
</div>
|
|
701
|
+
</div>
|
|
702
|
+
<div class="dropdown" id="exportDd">
|
|
703
|
+
<button class="tbtn" id="exportBtn">Export ▾</button>
|
|
704
|
+
<div class="menu">
|
|
705
|
+
<button id="expPng">PNG image <span class="hint">this view, high-res</span></button>
|
|
706
|
+
<button id="expDrawio">draw.io file <span class="hint">this view, editable, current layout</span></button>
|
|
707
|
+
<button id="expExcalidraw">Excalidraw file <span class="hint">this view, editable, current layout</span></button>
|
|
708
|
+
</div>
|
|
709
|
+
</div>
|
|
710
|
+
<button class="tbtn" id="themeBtn" title="Toggle theme">◐ Theme</button>
|
|
711
|
+
<button class="tbtn" id="presentBtn" title="Presentation mode (hides menus)">⛶ Present</button>
|
|
712
|
+
<div class="dropdown" id="moreDd" style="display:none">
|
|
713
|
+
<button class="tbtn" id="moreBtn" title="More options">⋯</button>
|
|
714
|
+
<div class="menu" id="moreMenu"></div>
|
|
715
|
+
</div>
|
|
716
|
+
</header>
|
|
717
|
+
<div id="wrap">
|
|
718
|
+
<div id="stage">
|
|
719
|
+
<div id="cy"></div>
|
|
720
|
+
<div class="viewhint" id="viewHint"></div>
|
|
721
|
+
<div id="typesWarn"></div>
|
|
722
|
+
<div class="legend" id="legend"></div>
|
|
723
|
+
<div class="reltip" id="relTip"></div>
|
|
724
|
+
</div>
|
|
725
|
+
<div id="panelResizer" title="Drag to resize details sidebar"></div>
|
|
726
|
+
<div id="panel"></div>
|
|
727
|
+
</div>
|
|
728
|
+
<button id="presentDetails">Details</button>
|
|
729
|
+
<button id="exitPresent">✕ Exit presentation</button>
|
|
730
|
+
<div id="flowModal">
|
|
731
|
+
<div class="box">
|
|
732
|
+
<div class="bar">
|
|
733
|
+
<button class="tbtn" id="flowBack" title="Back to the calling narrative">← Back</button>
|
|
734
|
+
<span class="crumbf" id="flowCrumb"></span>
|
|
735
|
+
<span class="spacer"></span>
|
|
736
|
+
<div class="seg" id="flowModeSeg">
|
|
737
|
+
<button data-fm="flow" class="active">Flow</button>
|
|
738
|
+
<button data-fm="steps">Steps</button>
|
|
739
|
+
</div>
|
|
740
|
+
<button class="tbtn" id="flowErrToggle" title="Hide the paths only reachable through error handling (catch regions, propagated throws)">Hide error paths</button>
|
|
741
|
+
<div class="dropdown" id="flowExportDd">
|
|
742
|
+
<button class="tbtn" id="flowExportBtn">Export ▾</button>
|
|
743
|
+
<div class="menu">
|
|
744
|
+
<button id="flowExpPng">PNG image</button>
|
|
745
|
+
<button id="flowExpDrawio">draw.io file</button>
|
|
746
|
+
<button id="flowExpExcalidraw">Excalidraw file</button>
|
|
747
|
+
</div>
|
|
748
|
+
</div>
|
|
749
|
+
<button class="tbtn" id="flowClose">✕</button>
|
|
750
|
+
</div>
|
|
751
|
+
<div id="flowCy"></div>
|
|
752
|
+
<div id="flowSteps"></div>`;function uj(t,e,n={}){const r=n.shadow!==!1,a=r?t.shadowRoot||t.attachShadow({mode:"open"}):t;a.innerHTML="";const i=document.createElement("style");i.textContent=RM,a.appendChild(i);const s=document.createElement("div");s.className="cbody"+(n.embed?" embed":""),s.setAttribute("data-theme",n.theme||"syw"),s.innerHTML=IM,a.appendChild(s);let o=[];function l(k){for(const j of o)s.style.removeProperty(j);if(o=[],k)for(const j of Object.keys(k))s.style.setProperty(j,k[j]),o.push(j)}l(n.vars);var u=r?a:document,d=s,f=e,h=typeof localStorage<"u"?localStorage:null,v=typeof window<"u",p="wairon:canvas2:"+f.system.name;v&&d&&new URLSearchParams(window.location.search).get("_embed")==="true"&&d.classList.add("embed");var y={};f.components.forEach(function(k){y[k.id]=k});var b={};f.subsystems.forEach(function(k){b[k.id]=k});var m={};f.issues.forEach(function(k){k.specId&&(m[k.specId]=m[k.specId]||[]).push(k)}),u.getElementById("issueCount").textContent=f.issues.filter(function(k){return k.severity==="error"}).length+"e/"+f.issues.filter(function(k){return k.severity==="warning"}).length+"w/"+f.issues.filter(function(k){return k.severity==="notice"}).length+"n";function g(k){var j=M.showIssues&&m[k];return j?j.some(function(L){return L.severity!=="notice"})?" hasIssue":" hasNotice":""}var w={Repository:1,FeatureComponent:1,RouterComponent:1};function x(k){return k==="Specialist"||k==="Gateway"?"retired":k==="Portal"||k==="Observer"?"entry":k==="Query"?"query":k==="Store"||k==="Index"||k==="Registry"?"data":k==="Adapter"?"adapter":w[k]?"patternLeaf":"logic"}var E=function(k){return"c~"+k},S=function(k){return"s~"+k},C=function(k,j){return"i~"+k+"~"+j};function T(){return f.subsystems.filter(function(k){return k.id.indexOf("::")<0})}function N(k){var j=k+"::";return f.subsystems.filter(function(L){return L.id.indexOf(j)===0&&L.id.slice(j.length).indexOf("::")<0})}function P(k){return f.components.filter(function(j){return j.subsystem===k&&!j.owner})}function R(k){var j=y[k];return j&&w[j.componentType]?j.owns.map(function(L){return y[L]}).filter(Boolean):[]}function I(k){var j=[];return k.kind==="system"?T().forEach(function(L){j.push({kind:"subsystem",id:L.id})}):k.kind==="subsystem"?(N(k.id).forEach(function(L){j.push({kind:"subsystem",id:L.id})}),P(k.id).forEach(function(L){j.push({kind:"component",id:L.id})})):k.kind==="component"&&R(k.id).forEach(function(L){j.push({kind:"component",id:L.id})}),j.forEach(function(L){L.hasKids=L.kind==="subsystem"?N(L.id).length+P(L.id).length>0:R(L.id).length>0}),j}function D(k){for(var j=k.subsystem.split("::"),L=[],O=1;O<=j.length;O++)L.push(j.slice(0,O).join("::"));return L}function $(k){for(var j=[],L=k;L&&L.owner;)j.unshift(L.owner),L=y[L.owner];return j}function H(k,j){var L=y[k];if(!L)return j.kind==="system"&&b[k]?{kind:"subsystem",id:k}:null;var O=D(L),W=$(L);if(j.kind==="system")return{kind:"subsystem",id:O[0]};if(j.kind==="subsystem"){var q=O.indexOf(j.id);return q<0?null:q<O.length-1?{kind:"subsystem",id:O[q+1]}:{kind:"component",id:W.length?W[0]:L.id}}var he=W.concat([L.id]),xe=he.indexOf(j.id);return xe<0||xe===he.length-1?null:{kind:"component",id:he[xe+1]}}function V(k){return k.kind==="subsystem"?S(k.id):E(k.id)}function U(k){if(k.kind==="subsystem"){var j=b[k.id];return j?j.name+(j.storage?`
|
|
753
|
+
⧉ `+j.storage:""):k.id}var L=y[k.id];return L?L.name:k.id}var F={positionsByView:{},theme:"syw"};try{h&&h.getItem(p)&&(F=JSON.parse(h.getItem(p))||F)}catch{}var G=f.system.diagram||{},z=G.showDatabases!==!1,_=["bezier","straight","taxi"].indexOf(G.lineStyle)>=0?G.lineStyle:"bezier",K=G.defaultView==="types"?"types":G.defaultView==="databases"&&z?"databases":"system",ie={kind:K,id:null};typeof n<"u"&&n&&typeof n.initialRoute=="string"&&n.initialRoute.length&&(ie=Cy(n.initialRoute));var M={view:ie,internals:typeof F.internals=="boolean"?F.internals:!1,externals:typeof F.externals=="boolean"?F.externals:!0,dataCoupling:typeof F.dataCoupling=="boolean"?F.dataCoupling:!1,showIssues:typeof F.showIssues=="boolean"?F.showIssues:!1,query:"",selected:null,selectedKind:null,theme:typeof n<"u"&&n&&n.theme?n.theme==="light"?"light":"syw":F.theme==="light"?"light":"syw",typesDetail:["full","fields","keys","names"].indexOf(F.typesDetail)>=0?F.typesDetail:"full",typesRenderAll:!1,layout:["layered","force","concentric","grid"].indexOf(F.layout)>=0?F.layout:"layered",lineStyle:["bezier","straight","taxi"].indexOf(F.lineStyle)>=0?F.lineStyle:_,panelOpen:typeof F.panelOpen=="boolean"?F.panelOpen:!(v&&window.innerWidth<900),panelWidth:typeof F.panelWidth=="number"?F.panelWidth:380},oe="",ve=!1;function ye(){return M.view.kind==="types"||M.view.kind==="databases"?"types2:"+(M.view.id||"root")+":"+M.typesDetail+":"+M.layout:M.view.kind+":"+(M.view.id||"root")+(M.internals?"+i":"")+":"+M.layout}function Te(){if(h)try{h.setItem(p,JSON.stringify({positionsByView:F.positionsByView||{},theme:M.theme,typesDetail:M.typesDetail,layout:M.layout,lineStyle:M.lineStyle,panelOpen:M.panelOpen,panelWidth:M.panelWidth,internals:M.internals,externals:M.externals,dataCoupling:M.dataCoupling,showIssues:M.showIssues}))}catch{}}var fe=260,Z=620,ee=u.getElementById("panelToggle"),ne=u.getElementById("panelResizer");function de(){if(!v)return Z;var k=window.innerWidth<=860?window.innerWidth-44:window.innerWidth-320;return Math.max(fe,Math.min(Z,k))}function Re(k){return Math.max(fe,Math.min(de(),Math.round(k||380)))}function Ge(){setTimeout(function(){typeof Fe<"u"&&Fe&&Fe.resize&&Fe.resize()},60)}function Nt(k){M.panelWidth=Re(M.panelWidth),d&&d.style&&d.style.setProperty("--panel-width",M.panelWidth+"px"),d.classList&&d.classList[M.panelOpen?"remove":"add"]("panel-closed"),ee&&(ee.setAttribute&&ee.setAttribute("aria-expanded",M.panelOpen?"true":"false"),ee.title=M.panelOpen?"Hide the details sidebar":"Show the details sidebar"),k||Te(),Ge()}Nt(!0),ee&&ee.addEventListener&&ee.addEventListener("click",function(){M.panelOpen=!M.panelOpen,Nt(!1)}),ne&&ne.addEventListener&&ne.addEventListener("mousedown",function(k){k&&k.preventDefault&&k.preventDefault(),M.panelOpen=!0,Nt(!1),d.classList&&d.classList.add("resizing-panel");function j(O){var W=v?window.innerWidth-O.clientX:M.panelWidth;M.panelWidth=Re(W),d&&d.style&&d.style.setProperty("--panel-width",M.panelWidth+"px"),Ge()}function L(){d.classList&&d.classList.remove("resizing-panel"),document.removeEventListener("mousemove",j),document.removeEventListener("mouseup",L),Te()}document.addEventListener("mousemove",j),document.addEventListener("mouseup",L)}),v&&window.addEventListener&&window.addEventListener("resize",function(){Nt(!1)});function wt(k){if(!M.query)return!0;var j=M.query.toLowerCase();return k.id.toLowerCase().indexOf(j)>=0||U(k).toLowerCase().indexOf(j)>=0}var at={light:{pageEdge:"#5f6b78",edgeText:"#3d4650",cross:"#b3261e",ink:"#1a1f24",subFill:"#e9eef4",subStroke:"#8195aa",subText:"#122a44",patFill:"#eef1f5",patStroke:"#5f6b78",innerFill:"#dbe3ec",innerStroke:"#8195aa",innerText:"#1a1f24",ghostFill:"#eceff2",ghostStroke:"#7d8a97",ghostText:"#414b55",typeE:{fill:"#e6efd8",stroke:"#4e6b23",text:"#22300d"},typeV:{fill:"#ecdff3",stroke:"#6e4288",text:"#2d1740"},proxyIn:{fill:"#d5eef8",stroke:"#14708f"},proxyOut:{fill:"#f7e8cd",stroke:"#8a6116"},stereo:{entry:{fill:"#dcebff",stroke:"#2f5fa8",text:"#0f2a4d"},logic:{fill:"#ece2fb",stroke:"#6d3fbf",text:"#2a1650"},data:{fill:"#f7ecd0",stroke:"#8a6116",text:"#3d2c05"},query:{fill:"#f3dcc8",stroke:"#a0521d",text:"#3b1d08"},adapter:{fill:"#dcf2e4",stroke:"#2e7d4f",text:"#0e3320"},patternLeaf:{fill:"#eef1f5",stroke:"#5f6b78",text:"#1a1f24"},retired:{fill:"#ebe8e4",stroke:"#857b73",text:"#35302b"}},issue:"#b3261e",selGlow:"#3465b4",bgLabel:"#f2f5f8",png:"#f2f5f8",relOk:"#2e7d4f",relDrift:"#8a6116",relBad:"#b3261e",relUnknown:"#5f6b78"},syw:{pageEdge:"#7c8ca3",edgeText:"#aebdd2",cross:"#ff6b81",ink:"#eef2f8",subFill:"#101f33",subStroke:"#3ec5e8",subText:"#7fe7ff",patFill:"#1b2740",patStroke:"#93a1b8",innerFill:"#243a5c",innerStroke:"#6b7c96",innerText:"#eef2f8",ghostFill:"#16202f",ghostStroke:"#5d6b80",ghostText:"#aab8cc",typeE:{fill:"#1e3317",stroke:"#8fd14f",text:"#e2f5cf"},typeV:{fill:"#321a3d",stroke:"#c084fc",text:"#f0dcff"},proxyIn:{fill:"#0d3b4a",stroke:"#22ddff"},proxyOut:{fill:"#3b2a10",stroke:"#f59e0b"},stereo:{entry:{fill:"#0d2b4d",stroke:"#22ddff",text:"#d8f6ff"},logic:{fill:"#2a2052",stroke:"#a78bfa",text:"#eae2ff"},data:{fill:"#3a2c10",stroke:"#f59e0b",text:"#ffe9c2"},query:{fill:"#3f2418",stroke:"#fdba74",text:"#ffedd5"},adapter:{fill:"#0f3323",stroke:"#34d399",text:"#d3f8e6"},patternLeaf:{fill:"#1b2740",stroke:"#93a1b8",text:"#eef2f8"},retired:{fill:"#24211f",stroke:"#a8a29e",text:"#e7e5e4"}},issue:"#ff6b81",selGlow:"#22ddff",bgLabel:"#0a0a0f",png:"#0a0a0f",relOk:"#34d399",relDrift:"#f59e0b",relBad:"#ff6b81",relUnknown:"#93a1b8"}};function it(k){var j=M.lineStyle==="taxi"?{"curve-style":"taxi","taxi-direction":"horizontal","taxi-turn":54,"taxi-turn-min-distance":34}:M.lineStyle==="straight"?{"curve-style":"straight"}:{"curve-style":"unbundled-bezier","control-point-distances":[78],"control-point-weights":[.48]},L=M.lineStyle==="bezier"?{"control-point-distances":"data(cpDist)","control-point-weights":"data(cpWeight)"}:M.lineStyle==="taxi"?{"taxi-turn":"data(taxiTurn)"}:{};return[{selector:"node",style:{shape:"round-rectangle",width:"data(w)",height:"data(h)",label:"data(label)","text-wrap":"wrap","text-max-width":"data(tw)","font-family":"Inter, system-ui, sans-serif","font-size":11,color:k.ink,"text-valign":"center","text-halign":"center","border-width":1.5}},{selector:".entry",style:{"background-color":k.stereo.entry.fill,"border-color":k.stereo.entry.stroke,color:k.stereo.entry.text}},{selector:".logic",style:{"background-color":k.stereo.logic.fill,"border-color":k.stereo.logic.stroke,color:k.stereo.logic.text}},{selector:".data",style:{"background-color":k.stereo.data.fill,"border-color":k.stereo.data.stroke,color:k.stereo.data.text}},{selector:".query",style:{"background-color":k.stereo.query.fill,"border-color":k.stereo.query.stroke,color:k.stereo.query.text}},{selector:".adapter",style:{"background-color":k.stereo.adapter.fill,"border-color":k.stereo.adapter.stroke,color:k.stereo.adapter.text}},{selector:".patternLeaf",style:{"background-color":k.stereo.patternLeaf.fill,"border-color":k.stereo.patternLeaf.stroke,color:k.stereo.patternLeaf.text,"border-style":"dashed"}},{selector:".retired",style:{"background-color":k.stereo.retired.fill,"border-color":k.stereo.retired.stroke,color:k.stereo.retired.text,"border-style":"double","border-width":4}},{selector:".subsysBox",style:{"background-color":k.subFill,"border-color":k.subStroke,color:k.subText,"font-weight":"bold","font-size":12.5}},{selector:"node.public",style:{"border-width":3.5}},{selector:":parent",style:{"text-valign":"top","text-halign":"center","font-size":12,"font-weight":"bold","text-margin-y":-5,padding:"10px","background-opacity":1}},{selector:".inner",style:{"background-color":k.innerFill,"border-color":k.innerStroke,"border-width":1.2,"font-size":9.5,color:k.innerText}},{selector:".ghost",style:{"background-color":k.ghostFill,"border-color":k.ghostStroke,"border-style":"dotted",color:k.ghostText,"font-size":10}},{selector:".typeEntity",style:{"background-color":k.typeE.fill,"border-color":k.typeE.stroke,color:k.typeE.text,"text-halign":"center","font-size":10.5}},{selector:".typeValue",style:{"background-color":k.typeV.fill,"border-color":k.typeV.stroke,color:k.typeV.text,"border-style":"dashed","font-size":10.5}},{selector:".typeBox",style:{"background-opacity":.18,padding:"0px","border-width":1.8}},{selector:".typeHead",style:{"font-weight":"bold","font-size":11}},{selector:".typeRow",style:{"background-color":k.innerFill,"border-color":k.innerStroke,"border-width":.5,color:k.innerText,"font-size":10,"text-justification":"left",shape:"rectangle"}},{selector:".typePlain",style:{"font-weight":"bold"}},{selector:"edge.typeref",style:{width:1.4,"line-style":"solid"}},{selector:"edge.erd",style:{"source-label":"1","target-label":"data(tcard)","source-text-offset":16,"target-text-offset":22,"font-size":9.5,color:k.edgeText}},{selector:"edge.fieldhl",style:{"line-color":k.selGlow,"target-arrow-color":k.selGlow,width:2.6}},{selector:".proxyExt",style:{"font-size":12,"border-width":1.6}},{selector:".proxyIn",style:{"background-color":k.proxyIn.fill,"border-color":k.proxyIn.stroke,color:k.proxyIn.stroke}},{selector:".proxyOut",style:{"background-color":k.proxyOut.fill,"border-color":k.proxyOut.stroke,color:k.proxyOut.stroke}},{selector:"edge.revealEdge",style:{"line-color":k.selGlow,"target-arrow-color":k.selGlow,"line-style":"dashed",width:2.4,opacity:.95}},{selector:"edge",style:Object.assign({},j,{width:1.8,"line-color":k.pageEdge,"target-arrow-shape":"triangle","target-arrow-color":k.pageEdge,"arrow-scale":.9,label:"data(lbl)","font-size":10,color:k.edgeText,"text-background-color":k.bgLabel,"text-background-opacity":.85,"text-rotation":"autorotate"})},{selector:"edge.routed",style:L},{selector:"edge.cross",style:{"line-color":k.cross,"target-arrow-color":k.cross,width:2.6}},{selector:"edge.datacoupling",style:{"line-color":k.typeV.stroke,"target-arrow-color":k.typeV.stroke,"line-style":"dashed",width:1.8,"arrow-scale":.85,label:"data(lbl)","font-size":9,color:k.typeV.stroke,"text-background-color":k.bgLabel,"text-background-opacity":.85,"text-rotation":"autorotate"}},{selector:"edge.bundle",style:{width:4.5,opacity:.7}},{selector:"edge.toghost",style:{"line-style":"dashed",opacity:.75}},{selector:"edge.inneredge",style:{width:1.1,"arrow-scale":.6,opacity:.8}},{selector:"edge.rel-unchecked",style:{"line-color":k.pageEdge,"target-arrow-color":k.pageEdge}},{selector:"edge.rel-ok",style:{"line-color":k.relOk,"target-arrow-color":k.relOk}},{selector:"edge.rel-drifted",style:{"line-color":k.relDrift,"target-arrow-color":k.relDrift}},{selector:"edge.rel-incompatible",style:{"line-color":k.relBad,"target-arrow-color":k.relBad}},{selector:"edge.rel-unavailable",style:{"line-color":k.relUnknown,"target-arrow-color":k.relUnknown,"line-style":"dotted"}},{selector:".extProject",style:{"border-style":"dashed"}},{selector:"edge.stubHover",style:{"line-color":k.selGlow,"target-arrow-color":k.selGlow,width:2.6,opacity:1,"z-compound-depth":"top"}},{selector:".dimmed",style:{opacity:.13}},{selector:".hasIssue",style:{"border-color":k.issue,"border-style":"dashed","border-width":3}},{selector:".hasNotice",style:{"border-style":"dotted"}},{selector:".sel",style:{"overlay-color":k.selGlow,"overlay-opacity":.34,"overlay-padding":6}},{selector:".hoverhl",style:{"overlay-color":k.selGlow,"overlay-opacity":.2,"overlay-padding":6}},{selector:".defocus",style:{opacity:.08}},{selector:"edge.edgeFocus",style:{"line-color":k.selGlow,"target-arrow-color":k.selGlow,"source-arrow-color":k.selGlow,width:3.6,opacity:1,"z-compound-depth":"top","z-index":9999,"text-background-opacity":1}},{selector:"edge.edgeOut",style:{"line-color":k.selGlow,"target-arrow-color":k.selGlow,"source-arrow-color":k.selGlow,width:3.6,opacity:1,"z-compound-depth":"top","z-index":9999,"text-background-opacity":1}},{selector:"edge.edgeIn",style:{"line-color":k.warn,"target-arrow-color":k.warn,"source-arrow-color":k.warn,width:3.6,opacity:1,"z-compound-depth":"top","z-index":9998,"text-background-opacity":1}},{selector:"node.typeCluster",style:{"background-color":k.subFill,"border-color":k.subStroke,color:k.subText,"font-weight":"bold","font-size":12,"border-width":2,"text-wrap":"wrap"}}]}var $e=Array.isArray(f.relations),et={};(f.relations||[]).forEach(function(k){et[k.id]=k});var nt={ok:1,drifted:2,unavailable:3,incompatible:4},bt={ok:"✓",drifted:"Δ",incompatible:"✕",unavailable:"?"},ht=f.edges.some(function(k){return!!k.consumption});function Pt(k){var j=k.relation?et[k.relation]:null;return j?j.health:$e?"unavailable":null}function Bt(k,j){return k?j&&nt[j]>nt[k]?j:k:j}function Kt(){var k=null;return(f.relations||[]).forEach(function(j){(!k||j.comparedAt<k)&&(k=j.comparedAt)}),k}function _t(k){return k.pinnedCommit?k.pinnedCommit.slice(0,7):k.pinnedDigest?k.pinnedDigest.replace(/^[a-z0-9-]+:/,"").slice(0,12):""}function Mt(k){return(k.consumer||"this project")+" → "+k.producer}function pe(k){var j=[Mt(k)+": "+bt[k.health]+" "+k.health];k.uses.forEach(function(O){j.push(" "+O.name+" — "+O.state+(O.detail?": "+O.detail:""))}),k.unchanged&&j.push(" "+k.unchanged+" use"+(k.unchanged===1?"":"s")+" unchanged"),k.detail&&j.push(" "+k.detail);var L=_t(k);return j.push((L?"pinned "+L+" · ":"")+"compared "+k.comparedAt),j.join(`
|
|
754
|
+
`)}function B(k){var j=_t(k);return'<div class="method"><div class="mname">'+Je(Mt(k))+'<span class="grow"></span><span class="chip">'+bt[k.health]+" "+Je(k.health)+"</span></div>"+k.uses.map(function(L){return'<div class="mdesc">'+Je(L.name)+" — "+Je(L.state)+(L.detail?": "+Je(L.detail):"")+"</div>"}).join("")+(k.unchanged?'<div class="mdesc">'+k.unchanged+" use"+(k.unchanged===1?"":"s")+" unchanged</div>":"")+(k.detail?'<div class="mdesc">'+Je(k.detail)+"</div>":"")+'<div class="mdesc">'+(j?"pinned "+Je(j)+" · ":"")+"compared "+Je(k.comparedAt)+"</div></div>"}function Y(k){var j={},L=[],O=function(W){var q=y[W];return W===k||W.indexOf(k+"::")===0||!!(q&&(q.subsystem===k||q.subsystem.indexOf(k+"::")===0))};return f.edges.forEach(function(W){!W.relation||j[W.relation]||!(O(W.to)||O(W.from))||(j[W.relation]=!0,et[W.relation]&&L.push(et[W.relation]))}),L}function te(k){if(!ht)return"";if(!$e)return'<br>relations: <span style="color:'+k.pageEdge+'">health not checked</span>';var j=Kt();return'<br>relations: <span style="color:'+k.relOk+'">✓ ok</span> <span style="color:'+k.relDrift+'">Δ drifted</span> <span style="color:'+k.relBad+'">✕ incompatible</span> <span style="color:'+k.relUnknown+'">? unavailable (dotted)</span>'+(j?" · as of "+Je(j):"")}function le(k){return!k.recordId||typeof n>"u"||!n||typeof n.onOpenProject!="function"?"":'<div class="openbtn"><button class="tbtn" data-openproject-id="'+Je(k.recordId)+'">Open project ↗</button></div>'}function ce(){var k=at[M.theme],j=function(L){return'<span class="sw" style="background:'+L.fill+";border-color:"+L.stroke+'"></span>'};u.getElementById("legend").innerHTML=j({fill:k.subFill,stroke:k.subStroke})+"Subsystem "+j(k.stereo.entry)+"Portal/Observer "+j(k.stereo.logic)+"Logic "+j(k.stereo.data)+"Data "+j(k.stereo.query)+"Query "+j(k.stereo.adapter)+"Adapter "+j(k.stereo.patternLeaf)+"Pattern "+j(k.stereo.retired)+"«Specialist»/«Gateway» retired, shown until migrated "+j({fill:k.ghostFill,stroke:k.ghostStroke})+"External "+j(k.proxyIn)+"⇠ in-port "+j(k.proxyOut)+'⇢ out-port — bold border = published · <span style="color:'+k.cross+'">red</span> = boundary hop · double-click = open<br>on select: <span style="color:'+k.selGlow+'">→ depends on</span> <span style="color:'+k.warn+'">← used by</span>'+(M.dataCoupling?' · <span style="color:'+k.typeV.stroke+'">- - ▸ uses models</span>':"")+te(k)}var Ye=200,be=56,Me=230,Ke=84,dt=110,kt=34,ot=130,Ve=36,vt=26,jt=12,Vt=34,Ft=14,Ir=6;function sn(k){var j=b[k];return!!(j&&j.deepInternals)}function gn(k,j){for(var L=j,O=1;;){var W=H(k,{kind:"subsystem",id:L});if(!W)return null;if(W.kind==="subsystem"&&sn(W.id)&&O<Ir){L=W.id,O+=1;continue}return W}}function Sn(k,j){var L=I({kind:"subsystem",id:k});if(!L.length)return{tiles:[],w:ot+2*Ft,h:Vt+Ft};var O={kind:"subsystem",id:k},W=function(ke){return ke.kind+":"+ke.id},q={};L.forEach(function(ke){if(ke.kind==="subsystem"&&sn(ke.id)&&j<Ir){var we=Sn(ke.id,j+1);q[W(ke)]={w:we.w,h:we.h,sub:we}}else q[W(ke)]={w:ot,h:Ve,sub:null}});var he={};f.edges.forEach(function(ke){var we=H(ke.from,O),ge=H(ke.to,O);if(!(!we||!ge)){var tt=we.kind+":"+we.id,xt=ge.kind+":"+ge.id;!q[tt]||!q[xt]||tt===xt||(he[tt+"=>"+xt]=1)}});var xe={};function De(ke,we){var ge=W(ke);if(xe[ge]!==void 0)return xe[ge];if(we[ge])return 0;we[ge]=1;var tt=0;if(ke.kind==="component"){var xt=y[ke.id];if(xt&&(xt.componentType==="Portal"||xt.componentType==="Observer"))return xe[ge]=0,delete we[ge],0}return Object.keys(he).forEach(function(Rt){var In=Rt.indexOf("=>");if(Rt.slice(In+2)===ge){var on=L.filter(function(Ln){return W(Ln)===Rt.slice(0,In)})[0];on&&(tt=Math.max(tt,De(on,we)+1))}}),delete we[ge],xe[ge]=tt,tt}L.forEach(function(ke){De(ke,{})});var Ue=[],Se=0,J=0;if(M.layout==="grid"){var je=L.slice().sort(function(ke,we){return ke.id<we.id?-1:1}),ze=Math.max(1,Math.ceil(Math.sqrt(L.length)))*(ot+vt);L.forEach(function(ke){var we=q[W(ke)];we.w>ze&&(ze=we.w)});var Ie=0,lt=0,We=0;je.forEach(function(ke){var we=q[W(ke)];Ie>0&&Ie+we.w>ze&&(Ie=0,lt+=We+jt,We=0),Ue.push({kid:ke,x:Ie+we.w/2,y:lt+we.h/2,w:we.w,h:we.h,sub:we.sub}),Ie+=we.w+vt,we.h>We&&(We=we.h),Ie-vt>Se&&(Se=Ie-vt),lt+We>J&&(J=lt+We)})}else if(M.layout==="concentric"||M.layout==="force"){var Le={};L.forEach(function(ke){Le[W(ke)]=0}),Object.keys(he).forEach(function(ke){var we=ke.indexOf("=>"),ge=ke.slice(0,we),tt=ke.slice(we+2);Le[ge]!==void 0&&Le[ge]++,Le[tt]!==void 0&&Le[tt]++});var ut=tr(L.map(W),function(ke){return Le[ke]||0},function(ke){return{w:q[ke].w,h:q[ke].h}}),Ae=1/0,Ee=1/0;L.forEach(function(ke){var we=q[W(ke)],ge=ut[W(ke)]||{x:0,y:0};ge.x-we.w/2<Ae&&(Ae=ge.x-we.w/2),ge.y-we.h/2<Ee&&(Ee=ge.y-we.h/2)}),Ae===1/0&&(Ae=0,Ee=0),L.forEach(function(ke){var we=q[W(ke)],ge=ut[W(ke)]||{x:0,y:0},tt=ge.x-Ae,xt=ge.y-Ee;Ue.push({kid:ke,x:tt,y:xt,w:we.w,h:we.h,sub:we.sub}),tt+we.w/2>Se&&(Se=tt+we.w/2),xt+we.h/2>J&&(J=xt+we.h/2)})}else{var Q={};L.forEach(function(ke){var we=xe[W(ke)]||0;(Q[we]=Q[we]||[]).push(ke)});var Ce=Object.keys(Q).map(Number).sort(function(ke,we){return ke-we}),st=0;Ce.forEach(function(ke){var we=Q[ke].sort(function(xt,Rt){return xt.id<Rt.id?-1:1}),ge=0,tt=0;we.forEach(function(xt){var Rt=q[W(xt)];Rt.w>ge&&(ge=Rt.w)}),we.forEach(function(xt){var Rt=q[W(xt)];Ue.push({kid:xt,x:st+ge/2,y:tt+Rt.h/2,w:Rt.w,h:Rt.h,sub:Rt.sub}),tt+=Rt.h+jt}),tt-jt>J&&(J=tt-jt),st+=ge+vt}),Se=st-vt}return Ue.forEach(function(ke){ke.x+=Ft,ke.y+=Vt}),{tiles:Ue,w:Se+2*Ft,h:Vt+J+Ft}}function Un(k,j){var L=Sn(k.id,1),O=V(k),W="p~in~"+O+"~",q="p~out~"+O+"~",he=j?j.extIn:{},xe=j?j.extOut:{},De=Object.keys(he).sort(),Ue=Object.keys(xe).sort(),Se=De.length>0,J=Ue.length>0,je=22,ze=22,Ie=8,lt=Se?je+vt:0,We=L.tiles;lt&&We.forEach(function(Ce){Ce.x+=lt});var Le=L.w+lt+(J?je+vt:0);Le<Me&&(Le=Me);var ut=Math.max(De.length,Ue.length),Ae=Math.max(L.h,Vt+ut*ze+Math.max(0,ut-1)*Ie+Ft),Ee=Vt+Math.max(0,(Ae-Vt-Ft)/2);function Q(Ce,st,ke,we,ge){var tt=Ce.length*ze+Math.max(0,Ce.length-1)*Ie,xt=Math.max(Vt+ze/2,Ee-tt/2+ze/2);return Ce.map(function(Rt,In){var on=st[Rt].kids,Ln=[];return Object.keys(on).forEach(function(On){Ln.push(on[On])}),{id:ke+Rt,extId:Rt,dir:ge,kids:Ln,raws:Object.keys(st[Rt].raws),x:we,y:xt+In*(ze+Ie),w:je,h:ze}})}return{deep:!0,tiles:We,edges:j?Object.keys(j.stubs).map(function(Ce){return j.stubs[Ce]}):[],proxies:Q(De,he,W,Ft+je/2,"in").concat(Q(Ue,xe,q,Le-Ft-je/2,"out")),w:Le,h:Ae}}function ea(k,j){if(!M.internals)return null;var L={},O=!1;if(j.forEach(function(Se){Se.kind==="subsystem"&&sn(Se.id)&&(L[V(Se)]=Se,O=!0)}),!O)return null;var W={};j.forEach(function(Se){W[Se.kind+":"+Se.id]=Se});function q(Se){var J=H(Se,k),je=J&&W[J.kind+":"+J.id];if(!je)return null;var ze=V(je);if(L[ze]){var Ie=gn(Se,je.id);return Ie?{node:C(Ie.kind,Ie.id),top:ze,deep:!0}:null}return je.kind==="component"&&je.id===Se?{node:ze,top:ze,deep:!1}:null}var he={},xe={},De={};function Ue(Se){return De[Se]=De[Se]||{extIn:{},extOut:{},stubs:{}}}return f.edges.forEach(function(Se){var J=q(Se.from),je=q(Se.to);if(J&&je&&(J.deep||je.deep)&&J.node!==je.node){var ze=J.node+"=>"+je.node;if(he[ze]||(he[ze]={src:J.node,tgt:je.node,cross:!1,aTop:J.top,bTop:je.top}),Se.cross&&(he[ze].cross=!0),J.top!==je.top){var Ie=J.top+"=>"+je.top;xe[Ie]=(xe[Ie]||0)+1}return}var lt=H(Se.from,k),We=H(Se.to,k),Le=lt&&W[lt.kind+":"+lt.id],ut=We&&W[We.kind+":"+We.id],Ae=Le?V(Le):null,Ee=ut?V(ut):null;if(Ae!==Ee){if(Ae&&L[Ae]){var Q=gn(Se.from,Le.id);if(Q){var Ce=Ue(Ae),st=Ce.extOut[Se.to]=Ce.extOut[Se.to]||{kids:{},raws:{}};st.kids[Q.kind+":"+Q.id]=Q,st.raws[Se.from]=1;var ke="p~out~"+Ae+"~"+Se.to;Ce.stubs[C(Q.kind,Q.id)+"=>"+ke]={src:C(Q.kind,Q.id),tgt:ke,stub:!0}}}if(Ee&&L[Ee]){var we=gn(Se.to,ut.id);if(we){var ge=Ue(Ee),tt=ge.extIn[Se.from]=ge.extIn[Se.from]||{kids:{},raws:{}};tt.kids[we.kind+":"+we.id]=we,tt.raws[Se.to]=1;var xt="p~in~"+Ee+"~"+Se.from;ge.stubs[xt+"=>"+C(we.kind,we.id)]={src:xt,tgt:C(we.kind,we.id),stub:!0}}}}}),{deepByAnchor:L,direct:he,directTopCount:xe,ports:De}}function dn(k,j){if(j&&k.kind==="subsystem"&&j.deepByAnchor[V(k)])return Un(k,j.ports[V(k)]);var L=M.internals&&k.hasKids?I({kind:k.kind,id:k.id}):[];if(!L.length)return null;var O={kind:k.kind,id:k.id},W={};L.forEach(function(Oe){W[Oe.kind+":"+Oe.id]=Oe});var q=V(k),he="p~in~"+q+"~",xe="p~out~"+q+"~",De={},Ue={},Se={};f.edges.forEach(function(Oe){var Ne=H(Oe.from,O),gt=H(Oe.to,O),It=Ne&&W[Ne.kind+":"+Ne.id],$t=gt&&W[gt.kind+":"+gt.id];if(It&&$t){if(Ne.kind===gt.kind&&Ne.id===gt.id)return;De[C(Ne.kind,Ne.id)+"=>"+C(gt.kind,gt.id)]={src:C(Ne.kind,Ne.id),tgt:C(gt.kind,gt.id)}}else if(It&&!$t){var re=Se[Oe.to]=Se[Oe.to]||{kids:{},raws:{}};re.kids[Ne.kind+":"+Ne.id]=Ne,re.raws[Oe.from]=1,De[C(Ne.kind,Ne.id)+"=>"+xe+Oe.to]={src:C(Ne.kind,Ne.id),tgt:xe+Oe.to,stub:!0}}else if(!It&&$t){var Xe=Ue[Oe.from]=Ue[Oe.from]||{kids:{},raws:{}};Xe.kids[gt.kind+":"+gt.id]=gt,Xe.raws[Oe.to]=1,De[he+Oe.from+"=>"+C(gt.kind,gt.id)]={src:he+Oe.from,tgt:C(gt.kind,gt.id),stub:!0}}});var J={};function je(Oe,Ne){var gt=C(Oe.kind,Oe.id);if(J[gt]!==void 0)return J[gt];if(Ne[gt])return 0;Ne[gt]=1;var It=0;if(Oe.kind==="component"){var $t=y[Oe.id];if($t&&($t.componentType==="Portal"||$t.componentType==="Observer"))return J[gt]=0,delete Ne[gt],0}return Object.keys(De).forEach(function(re){var Xe=De[re];if(Xe.tgt===gt){var Lt=L.filter(function(Ut){return C(Ut.kind,Ut.id)===Xe.src})[0];Lt&&(It=Math.max(It,je(Lt,Ne)+1))}}),delete Ne[gt],J[gt]=It,It}L.forEach(function(Oe){je(Oe,{})});var ze={};L.forEach(function(Oe){var Ne=J[C(Oe.kind,Oe.id)]||0;(ze[Ne]=ze[Ne]||[]).push(Oe)});var Ie=Object.keys(ze).map(Number).sort(function(Oe,Ne){return Oe-Ne}),lt=Object.keys(Ue).sort(),We=Object.keys(Se).sort(),Le=lt.length>0,ut=We.length>0,Ae=22,Ee=22,Q=8,Ce=Ft+(Le?Ae+vt:0),st=[],ke,we,ge=function(Oe){return C(Oe.kind,Oe.id)};if(M.layout==="grid"||M.layout==="concentric"||M.layout==="force"){var tt=L.map(ge),xt={};L.forEach(function(Oe){xt[ge(Oe)]=Oe});var Rt;if(M.layout==="grid"){Rt={};var In=Math.max(1,Math.ceil(Math.sqrt(tt.length)));tt.slice().sort().forEach(function(Oe,Ne){Rt[Oe]={x:Ne%In*(ot+vt),y:Math.floor(Ne/In)*(Ve+jt)}})}else{var on={};tt.forEach(function(Oe){on[Oe]=0}),Object.keys(De).forEach(function(Oe){var Ne=De[Oe];on[Ne.src]!==void 0&&on[Ne.src]++,on[Ne.tgt]!==void 0&&on[Ne.tgt]++}),Rt=tr(tt,function(Oe){return on[Oe]||0},function(){return{w:ot,h:Ve}})}var Ln=1/0,On=1/0;tt.forEach(function(Oe){var Ne=Rt[Oe]||{x:0,y:0};Ne.x<Ln&&(Ln=Ne.x),Ne.y<On&&(On=Ne.y)}),Ln===1/0&&(Ln=0,On=0),st=tt.map(function(Oe){var Ne=Rt[Oe]||{x:0,y:0};return{kid:xt[Oe],x:Ce+(Ne.x-Ln)+ot/2,y:Vt+(Ne.y-On)+Ve/2}});var Br=Ce+ot,Mr=Vt+Ve;st.forEach(function(Oe){Br=Math.max(Br,Oe.x+ot/2),Mr=Math.max(Mr,Oe.y+Ve/2)}),ke=Br+vt,we=Mr+jt}else ke=Ce,we=0,Ie.forEach(function(Oe){var Ne=ze[Oe].sort(function(It,$t){return It.id<$t.id?-1:1}),gt=Vt;Ne.forEach(function(It){st.push({kid:It,x:ke+ot/2,y:gt+Ve/2}),gt+=Ve+jt}),we=Math.max(we,gt),ke+=ot+vt});var na=Math.max(lt.length,We.length);we=Math.max(we,Vt+na*Ee+Math.max(0,na-1)*Q+jt);var ue=Vt+Math.max(0,(we-Vt-jt)/2),qe=ke;ut&&(ke+=Ae+vt);function Yt(Oe,Ne,gt,It,$t){var re=Oe.length*Ee+Math.max(0,Oe.length-1)*Q,Xe=Math.max(Vt+Ee/2,ue-re/2+Ee/2);return Oe.map(function(Lt,Ut){var wr=Ne[Lt].kids,vi=[];return Object.keys(wr).forEach(function(Na){vi.push(wr[Na])}),{id:gt+Lt,extId:Lt,dir:$t,kids:vi,raws:Object.keys(Ne[Lt].raws),x:It,y:Xe+Ut*(Ee+Q),w:Ae,h:Ee}})}return{tiles:st,edges:Object.keys(De).map(function(Oe){return De[Oe]}),proxies:Yt(lt,Ue,he,Ft+Ae/2,"in").concat(Yt(We,Se,xe,qe+Ae/2,"out")),w:Math.max(ke-vt+Ft,k.kind==="subsystem"?Me:Ye),h:we-jt+Ft}}function ha(k,j){return j?{w:j.w,h:j.h}:k.kind==="subsystem"?{w:Me,h:Ke}:{w:Ye,h:be}}function Lr(k,j,L){L=L||f.edges;var O={};j.forEach(function(he){O[he.kind+":"+he.id]=he});var W={},q={};return L.forEach(function(he){var xe=H(he.from,k),De=H(he.to,k),Ue=xe&&O[xe.kind+":"+xe.id],Se=De&&O[De.kind+":"+De.id];if(!(!Ue&&!Se)){var J,je,ze=!1;if(Ue&&Se){if(xe.kind===De.kind&&xe.id===De.id)return;J=V(xe),je=V(De)}else if(M.externals)if(ze=!0,Ue){var Ie=ta(he.to,k);if(!Ie)return;q[Ie.gid]=Ie,J=V(xe),je=Ie.gid}else{var lt=ta(he.from,k);if(!lt)return;q[lt.gid]=lt,J=lt.gid,je=V(De)}else return;var We=J+"=>"+je;if(W[We]||(W[We]={src:J,tgt:je,n:0,cross:!1,ghost:ze}),W[We].n++,he.cross&&(W[We].cross=!0),he.consumption&&(W[We].consumption=!0,W[We].health=Bt(W[We].health,Pt(he)),he.relation)){var Le=W[We].rels||(W[We].rels=[]);Le.indexOf(he.relation)<0&&Le.push(he.relation)}}}),{agg:W,ghosts:q}}function ta(k,j){var L=y[k];if(!L)return null;var O=[];if(j.kind==="component"){for(var W=y[j.id],q=W?$(W):[],he=q.length-1;he>=0;he--)O.push({kind:"component",id:q[he]});W&&D(W).reverse().forEach(function(J){O.push({kind:"subsystem",id:J})})}else if(j.kind==="subsystem")for(var xe=j.id.split("::"),De=xe.length-1;De>=1;De--)O.push({kind:"subsystem",id:xe.slice(0,De).join("::")});O.push({kind:"system",id:null});for(var Ue=0;Ue<O.length;Ue++){var Se=H(k,O[Ue]);if(Se)return{gid:"x~"+Se.kind+"~"+Se.id,kind:Se.kind,id:Se.id,label:U(Se)}}return null}function di(k){if(!M.query)return!0;var j=M.query.toLowerCase();return k.id.toLowerCase().indexOf(j)>=0||k.name.toLowerCase().indexOf(j)>=0}var Ua="— shared —";function dr(k){if(!k.database)return!1;if(!f.system.databases||!f.system.databases.length)return!0;var j=f.system.databases.find(function(L){return L.id===k.database});return!j||!j.tables||!j.tables.length?!0:j.tables.indexOf(k.id)>=0||j.tables.indexOf(k.table||k.id)>=0}function Bn(){var k=M.view.id;if(M.view.kind==="databases")return f.types.filter(function(O){return dr(O)?k?O.database===k||O.subsystem===k||O.subsystem&&O.subsystem.indexOf(k+"::")===0:!0:!1});if(!k)return f.types;if(k===Ua)return f.types.filter(function(O){return!O.subsystem});var j={};f.types.forEach(function(O){(O.subsystem===k||O.subsystem&&O.subsystem.indexOf(k+"::")===0)&&(j[O.id]=1)});var L={};return f.typeEdges.forEach(function(O){j[O.from]&&!j[O.to]&&(L[O.to]=1),j[O.to]&&!j[O.from]&&(L[O.from]=1)}),f.types.filter(function(O){return j[O.id]||!O.subsystem&&L[O.id]})}var fr=400,is=120;function tr(k,j,L,O,W){if(O=O||1,!k.length)return{};var q=k.slice().sort(function(lt,We){return j(We)-j(lt)||(lt<We?-1:1)}),he=[],xe=0;(q.length===1||j(q[0])>j(q[1]))&&(he.push([q[0]]),xe=1);for(var De=he.length;xe<q.length;){var Ue=Math.max(6,De*8);he.push(q.slice(xe,xe+Ue)),xe+=Ue,De++}var Se={},J=0,je=0,ze=80,Ie=70;return he.forEach(function(lt,We){var Le=0,ut=0;lt.forEach(function(we){var ge=L(we);Math.max(ge.w,ge.h)>Le&&(Le=Math.max(ge.w,ge.h)),ge.w>ut&&(ut=ge.w)});var Ae=lt.length,Ee;if(We===0&&Ae===1)Ee=0;else{var Q=Ae>=2?(ut+Ie)/(2*Math.sin(Math.PI/Ae)):0;Ee=Math.max(Q,J+je/2+Le/2+ze)}if(Ee===0)lt.forEach(function(we){Se[we]={x:0,y:0}});else if(W){var Ce=lt.slice().sort(function(we,ge){return W(we)-W(ge)||(we<ge?-1:1)}),st=Math.ceil(Ae/2),ke=Ae-st;Ce.forEach(function(we,ge){var tt=ge%2===0?-Math.PI/2-(ge/2+.5)/st*Math.PI:-Math.PI/2+((ge-1)/2+.5)/Math.max(1,ke)*Math.PI;Se[we]={x:Math.cos(tt)*Ee*O,y:Math.sin(tt)*Ee}})}else lt.forEach(function(we,ge){var tt=Ae===1?-Math.PI/2:ge/Ae*2*Math.PI-Math.PI/2;Se[we]={x:Math.cos(tt)*Ee*O,y:Math.sin(tt)*Ee}});J=Ee,je=Le}),Se}function Qu(k){var j=M.view.id;function L(J){var je=J.subsystem||"";return je?j?je===j?j:je.indexOf(j+"::")===0?j+"::"+je.slice(j.length+2).split("::")[0]:je.split("::")[0]:je.split("::")[0]:"— shared —"}var O={},W=[],q={};if(k.forEach(function(J){var je=L(J);q[J.id]=je,O[je]||(O[je]=0,W.push(je)),O[je]++}),W.length<2)return null;var he={};f.typeEdges.forEach(function(J){var je=q[J.from],ze=q[J.to];if(!(je===void 0||ze===void 0||je===ze)){var Ie=je+"=>"+ze;he[Ie]=(he[Ie]||0)+1}});var xe=[],De=W.slice().sort(),Ue=Math.max(1,Math.ceil(Math.sqrt(De.length)));De.forEach(function(J,je){var ze=b[J]?b[J].name:J;xe.push({data:{id:"TC~"+J,label:ze+`
|
|
755
|
+
`+O[J]+" types",w:210,h:66,tw:192,clusterKey:J},position:{x:je%Ue*300,y:Math.floor(je/Ue)*150},classes:"typeCluster"})});var Se=0;return Object.keys(he).forEach(function(J){var je=J.split("=>");xe.push({data:{id:"tc"+Se++,source:"TC~"+je[0],target:"TC~"+je[1],lbl:he[J]>1?String(he[J]):""},classes:"typeref"})}),xe}function Gf(){var k=[],j=M.typesDetail,L=Bn();if(oe="",!M.typesRenderAll){if(L.length>fr){var O=Qu(L);if(O)return oe="cluster:"+L.length,O}L.length>is&&j!=="names"&&(j="names",oe="names:"+L.length)}var W={};L.forEach(function(ue){W[ue.id]=1});var q={1:0,"0..1":1,"*":2},he={},xe={};f.typeEdges.forEach(function(ue){if(!(!W[ue.from]||!W[ue.to])){(he[ue.from]=he[ue.from]||{})[ue.field]=ue;var qe=ue.from+"=>"+ue.to;xe[qe]?q[ue.card]>q[xe[qe].card]&&(xe[qe].card=ue.card):xe[qe]={from:ue.from,to:ue.to,card:ue.card||"1"}}});function De(ue,qe){return qe.key==="primary"?"PK":qe.key==="unique"?"U":he[ue.id]&&he[ue.id][qe.name]?"FK":""}function Ue(ue){return j==="names"||ue.values||ue.holds?[]:j==="keys"?ue.fields.filter(function(qe){return De(ue,qe)!==""}):ue.fields}function Se(ue,qe){var Yt=De(ue,qe);return(Yt?"["+Yt+"] ":"")+qe.name+(qe.optional?"?":"")+": "+qe.type}var J={},je=[];L.forEach(function(ue){var qe=ue.subsystem||"— shared —";J[qe]||(J[qe]=[],je.push(qe)),J[qe].push(ue)}),je.sort();var ze=je.length>1,Ie={};function lt(ue,qe){if(Ie[ue]!==void 0)return Ie[ue];if(qe[ue])return 0;qe[ue]=1;var Yt=0;return Object.keys(xe).forEach(function(Oe){var Ne=xe[Oe];Ne.to===ue&&(Yt=Math.max(Yt,lt(Ne.from,qe)+1))}),delete qe[ue],Ie[ue]=Yt,Yt}L.forEach(function(ue){lt(ue.id,{})});var We=20,Le=26,ut=170,Ae=60,Ee=130,Q={};function Ce(ue){var qe=Ue(ue),Yt=j==="full"?ue.methods:[],Oe=ue.signature&&j!=="names"?ue.signature:"",Ne=ue.values&&j!=="names"?ue.values:[],gt=ue.name+(ue.holds?" = "+ue.holds:"")+" «"+ue.kind+"»",It=(Oe?[Oe]:[]).concat(Ne.map(function(Ut){return"• "+Ut.name})).concat(qe.map(function(Ut){return Se(ue,Ut)})).concat(Yt.map(function(Ut){return"ƒ "+Ut.name+"(): "+Ut.returns})),$t=gt.length+4;It.forEach(function(Ut){Ut.length>$t&&($t=Ut.length)});var re=It.length===0,Xe=Math.max(170,gt.length*6.8+26),Lt=Math.max(210,Math.min(400,$t*6.6+30));return{fields:qe,meths:Yt,sig:Oe,vals:Ne,head:gt,plain:re,w:re?Xe:Lt,h:re?40:Le+(Oe?We:0)+Ne.length*We+qe.length*We+Yt.length*We}}function st(ue,qe,Yt,Oe){var Ne=Ce(ue),gt=ue.kind==="entity"?"typeEntity":"typeValue",It=!di(ue),$t=(It?" dimmed":"")+g(ue.id)+(M.selectedKind==="type"&&M.selected===ue.id?" sel":"");if(Ne.plain)return k.push({data:{id:"T~"+ue.id,parent:Oe,label:Ne.head,w:Ne.w,h:40,tw:Ne.w-12},position:{x:qe+Ne.w/2,y:Yt+20},classes:"typePlain "+gt+$t}),Ne;k.push({data:{id:"T~"+ue.id,parent:Oe,label:""},classes:"typeBox "+gt+$t}),k.push({data:{id:"TH~"+ue.id,parent:"T~"+ue.id,label:Ne.head,w:Ne.w,h:Le,tw:Ne.w-12},position:{x:qe+Ne.w/2,y:Yt+Le/2},classes:"typeHead "+gt+(It?" dimmed":""),grabbable:!1});var re=Yt+Le;return Ne.sig&&(k.push({data:{id:"TS~"+ue.id,parent:"T~"+ue.id,label:Ne.sig,w:Ne.w,h:We,tw:Ne.w-14},position:{x:qe+Ne.w/2,y:re+We/2},classes:"typeRow methRow"+(It?" dimmed":""),grabbable:!1}),re+=We),Ne.vals.forEach(function(Xe,Lt){k.push({data:{id:"TV~"+ue.id+"~"+Lt,parent:"T~"+ue.id,label:"• "+Xe.name,w:Ne.w,h:We,tw:Ne.w-14},position:{x:qe+Ne.w/2,y:re+We/2},classes:"typeRow"+(It?" dimmed":""),grabbable:!1}),re+=We}),Ne.fields.forEach(function(Xe){var Lt="TF~"+ue.id+"~"+Xe.name;Q[Lt]=1,k.push({data:{id:Lt,parent:"T~"+ue.id,label:Se(ue,Xe),w:Ne.w,h:We,tw:Ne.w-14},position:{x:qe+Ne.w/2,y:re+We/2},classes:"typeRow"+(he[ue.id]&&he[ue.id][Xe.name]?" fkRow":"")+(It?" dimmed":""),grabbable:!1}),re+=We}),Ne.meths.forEach(function(Xe,Lt){k.push({data:{id:"TM~"+ue.id+"~"+Lt,parent:"T~"+ue.id,label:"ƒ "+Xe.name+"(): "+Xe.returns,w:Ne.w,h:We,tw:Ne.w-14},position:{x:qe+Ne.w/2,y:re+We/2},classes:"typeRow methRow"+(It?" dimmed":""),grabbable:!1}),re+=We}),Ne}var ke={};L.forEach(function(ue){ke[ue.id]=0}),Object.keys(xe).forEach(function(ue){var qe=xe[ue];ke[qe.from]!==void 0&&ke[qe.from]++,ke[qe.to]!==void 0&&ke[qe.to]++});var we=function(ue,qe){return ke[qe.id]-ke[ue.id]||(ue.id<qe.id?-1:1)},ge=M.layout==="grid"?"grid":M.layout==="concentric"||M.layout==="force"?"concentric":"layered";if(ge==="grid"){var tt=Math.max(1e3,Math.ceil(Math.sqrt(L.length))*300),xt=0,Rt=0,In=0;L.slice().sort(we).forEach(function(ue){var qe=Ce(ue);xt>0&&xt+qe.w>tt&&(xt=0,Rt+=In+Ae,In=0),st(ue,xt,Rt,void 0),xt+=qe.w+ut,qe.h>In&&(In=qe.h)})}else if(ge==="concentric"){var on={};L.forEach(function(ue){on[ue.id]=Ce(ue)});var Ln=tr(L.map(function(ue){return ue.id}),function(ue){return ke[ue]||0},function(ue){return on[ue]},1.7,function(ue){return Ie[ue]||0});L.forEach(function(ue){var qe=on[ue.id],Yt=Ln[ue.id]||{x:0,y:0};st(ue,Yt.x-qe.w/2,Yt.y-qe.h/2,void 0)})}else{var On=0;je.forEach(function(ue){var qe="TG~"+ue;ze&&k.push({data:{id:qe,label:ue},classes:"subsysBox"});var Yt={};J[ue].forEach(function(It){var $t=Ie[It.id]||0;(Yt[$t]=Yt[$t]||[]).push(It)});var Oe=Object.keys(Yt).map(Number).sort(function(It,$t){return It-$t}),Ne=0,gt=0;Oe.forEach(function(It){var $t=Yt[It].sort(function(Lt,Ut){return Lt.id<Ut.id?-1:1}),re=On,Xe=230;$t.forEach(function(Lt){var Ut=st(Lt,Ne,re,ze?qe:void 0);re+=Ut.h+Ae,Ut.w>Xe&&(Xe=Ut.w)}),gt=Math.max(gt,re-On),Ne+=Xe+ut}),On+=gt+Ee})}var Br=0,Mr={};f.types.forEach(function(ue){Mr[ue.id]=ue});var na=function(ue,qe){return M.query&&(!di(Mr[ue]||{id:ue,name:""})||!di(Mr[qe]||{id:qe,name:""}))};return j==="names"?Object.keys(xe).forEach(function(ue){var qe=xe[ue];k.push({data:{id:"te"+Br++,source:"T~"+qe.from,target:"T~"+qe.to,lbl:""},classes:"typeref plain"+(na(qe.from,qe.to)?" dimmed":"")})}):f.typeEdges.forEach(function(ue){if(!(!W[ue.from]||!W[ue.to])){var qe="TF~"+ue.from+"~"+ue.field;k.push({data:{id:"te"+Br++,source:Q[qe]?qe:"T~"+ue.from,target:"T~"+ue.to,lbl:"",tcard:ue.card||"1",ffrom:ue.from,ffield:ue.field},classes:"typeref erd"+(na(ue.from,ue.to)?" dimmed":"")})}}),k}function Zu(){var k=M.view;if(k.kind==="types"||k.kind==="databases")return Gf();var j=I(k),L=[],O=ea(k,j),W=Lr(k,j),q=M.dataCoupling?Lr(k,j,f.dataEdges):{agg:{},ghosts:{}};Object.keys(q.ghosts).forEach(function(se){W.ghosts[se]||(W.ghosts[se]=q.ghosts[se])});var he={};j.forEach(function(se){he[V(se)]=dn(se,O)});function xe(se,ae,me,He,Ct){se.forEach(function(mt){var Ot=me+mt.x,fn=He+mt.y;if(mt.sub){var bn=S(mt.kid.id),va=M.selectedKind==="subsystem"&&M.selected===mt.kid.id?" sel":"",Qt={data:{id:bn,parent:ae,label:U(mt.kid),w:mt.w,h:mt.h,tw:mt.w-16},classes:"subsysBox"+(mt.sub.tiles.length?" drillable":"")+Ct+va};mt.sub.tiles.length||(Qt.position={x:Ot,y:fn}),L.push(Qt),xe(mt.sub.tiles,bn,Ot-mt.w/2,fn-mt.h/2,Ct)}else L.push({data:{id:C(mt.kid.kind,mt.kid.id),parent:ae,label:U(mt.kid),w:ot,h:Ve,tw:ot-10},position:{x:Ot,y:fn},classes:"inner"+Ct})})}var De={};j.forEach(function(se){De[V(se)]=1});function Ue(se){var ae=H(se.extId,k);if(ae&&De[V(ae)]){var me=V(ae),He=he[me];if(He&&He.proxies){var Ct=(se.dir==="out"?"p~in~":"p~out~")+me+"~",mt={};He.proxies.forEach(function(bn){mt[bn.id]=1});var Ot=[];if((se.raws||[]).forEach(function(bn){mt[Ct+bn]&&Ot.push(Ct+bn)}),Ot.length)return Ot}return[me]}if(M.externals){var fn=ta(se.extId,k);if(fn&&W.ghosts[fn.gid])return[fn.gid]}return[]}var Se={};function J(se,ae){var me=V(se);if(Se[me]!==void 0)return Se[me];if(ae[me])return 0;ae[me]=1;var He=0;if(se.kind==="component"){var Ct=y[se.id];if(Ct&&(Ct.componentType==="Portal"||Ct.componentType==="Observer"))return Se[me]=0,delete ae[me],0}return Object.keys(W.agg).forEach(function(mt){var Ot=W.agg[mt];if(Ot.tgt===me){var fn=j.filter(function(bn){return V(bn)===Ot.src})[0];fn&&(He=Math.max(He,J(fn,ae)+1))}}),delete ae[me],Se[me]=He,He}var je={},ze={};j.forEach(function(se){var ae=V(se);je[ae]=ha(se,he[ae]),ze[ae]=0}),Object.keys(W.agg).forEach(function(se){var ae=W.agg[se];ze[ae.src]!==void 0&&ze[ae.src]++,ze[ae.tgt]!==void 0&&ze[ae.tgt]++});var Ie={},lt=0;if(M.layout==="concentric"){j.forEach(function(se){J(se,{})});var We=tr(j.map(function(se){return V(se)}),function(se){return ze[se]||0},function(se){return je[se]},1.7,function(se){return Se[se]||0});j.forEach(function(se){var ae=V(se),me=je[ae],He=We[ae]||{x:0,y:0};Ie[ae]={x:He.x,y:He.y,w:me.w,h:me.h},He.x+me.w/2>lt&&(lt=He.x+me.w/2)})}else if(M.layout==="grid"){var Le=j.slice().sort(function(se,ae){return ze[V(ae)]-ze[V(se)]||(se.id<ae.id?-1:1)}),ut=Math.max(900,Math.ceil(Math.sqrt(j.length))*320),Ae=0,Ee=0,Q=0;Le.forEach(function(se){var ae=V(se),me=je[ae];Ae>0&&Ae+me.w>ut&&(Ae=0,Ee+=Q+kt,Q=0),Ie[ae]={x:Ae+me.w/2,y:Ee+me.h/2,w:me.w,h:me.h},Ae+=me.w+dt,me.h>Q&&(Q=me.h),Ae>lt&&(lt=Ae)})}else{j.forEach(function(se){J(se,{})});var Ce={};j.forEach(function(se){var ae=Se[V(se)]||0;(Ce[ae]=Ce[ae]||[]).push(se)});var st=Object.keys(Ce).map(Number).sort(function(se,ae){return se-ae}),ke=M.layout==="force"?130:0,we=0;st.forEach(function(se){var ae=Ce[se].sort(function(Ct,mt){return Ct.id<mt.id?-1:1}),me=0,He=we*ke;ae.forEach(function(Ct){me=Math.max(me,je[V(Ct)].w)}),ae.forEach(function(Ct){var mt=V(Ct),Ot=je[mt];Ie[mt]={x:lt+me/2,y:He+Ot.h/2,w:Ot.w,h:Ot.h},He+=Ot.h+kt}),lt+=me+dt,we++})}j.forEach(function(se){var ae=V(se),me=Ie[ae],He=he[ae],Ct=M.query&&!wt(se),mt,Ot,fn=se.kind==="component"&&y[se.id]&&y[se.id].public;if(se.kind==="subsystem")mt="subsysBox"+(b[se.id]&&b[se.id].external?" extProject":""),Ot=U(se)+(se.hasKids&&!He?`
|
|
756
|
+
▸ open`:"");else{var bn=y[se.id];mt=x(bn.componentType),Ot=bn.name+`
|
|
757
|
+
«`+bn.componentType+(bn.transport?"/"+bn.transport:"")+"»"+(se.hasKids&&!He?" ▸":"")}if(mt+=(se.hasKids?" drillable":"")+(fn?" public":"")+(Ct?" dimmed":"")+g(se.id)+(M.selectedKind===se.kind&&M.selected===se.id?" sel":""),He){var va={data:{id:ae,label:(se.kind==="subsystem",U(se)),w:me.w,h:me.h,tw:me.w-16},classes:mt};He.deep&&!He.tiles.length&&!(He.proxies&&He.proxies.length)&&(va.position={x:me.x,y:me.y}),L.push(va),He.deep?xe(He.tiles,ae,me.x-me.w/2,me.y-me.h/2,Ct?" dimmed":""):He.tiles.forEach(function(Qt){L.push({data:{id:C(Qt.kid.kind,Qt.kid.id),parent:ae,label:U(Qt.kid),w:ot,h:Ve,tw:ot-10},position:{x:me.x-me.w/2+Qt.x,y:me.y-me.h/2+Qt.y},classes:"inner"+(Ct?" dimmed":"")})}),(He.proxies||[]).forEach(function(Qt){L.push({data:{id:Qt.id,parent:ae,label:Qt.dir==="in"?"⇠":"⇢",w:Qt.w,h:Qt.h,tw:Qt.w,extId:Qt.extId,dir:Qt.dir,rvTargets:Ue(Qt),rvDir:Qt.dir,viaKids:Qt.kids.map(function(ds){return{kind:ds.kind,id:ds.id,label:U(ds)}})},position:{x:me.x-me.w/2+Qt.x,y:me.y-me.h/2+Qt.y},classes:"proxyExt "+(Qt.dir==="in"?"proxyIn":"proxyOut")+(Ct?" dimmed":"")+(M.selectedKind==="external"&&M.selected===Qt.id?" sel":"")})}),He.edges.forEach(function(Qt,ds){L.push({data:{id:ae+"-ie"+ds,source:Qt.src,target:Qt.tgt,lbl:""},classes:"inneredge"+(Qt.stub?" toghost":"")+(Ct?" dimmed":"")})})}else L.push({data:{id:ae,label:Ot,w:me.w,h:me.h,tw:me.w-14},position:{x:me.x,y:me.y},classes:mt})});var ge={},tt={},xt=function(se,ae){var me=Ie[ae];if(me){var He=tt[se]=tt[se]||{sx:0,sy:0,n:0};He.sx+=me.x,He.sy+=me.y,He.n++}};[W.agg,q.agg].forEach(function(se){Object.keys(se).forEach(function(ae){var me=se[ae];W.ghosts[me.src]&&(ge[me.src]=(ge[me.src]||0)|1,xt(me.src,me.tgt)),W.ghosts[me.tgt]&&(ge[me.tgt]=(ge[me.tgt]||0)|2,xt(me.tgt,me.src))})});var Rt=1/0,In=-1/0,on=1/0,Ln=-1/0;Object.keys(Ie).forEach(function(se){var ae=Ie[se];ae.x-ae.w/2<Rt&&(Rt=ae.x-ae.w/2),ae.x+ae.w/2>In&&(In=ae.x+ae.w/2),ae.y-ae.h/2<on&&(on=ae.y-ae.h/2),ae.y+ae.h/2>Ln&&(Ln=ae.y+ae.h/2)}),Rt===1/0&&(Rt=0,In=0,on=0,Ln=0);var On=170,Br=46,Mr=90,na=(Rt+In)/2,ue=(on+Ln)/2,qe=(In-Rt)/2+On/2+Mr,Yt=(Ln-on)/2+Br/2+Mr,Oe=[];Object.keys(W.ghosts).sort().forEach(function(se){var ae=W.ghosts[se],me=(ge[se]||2)&1,He=tt[se],Ct=He&&He.n?He.sx/He.n-na:0,mt=He&&He.n?He.sy/He.n-ue:0;Ct===0&&mt===0&&(Ct=me?-1:1,mt=0);var Ot=Math.sqrt(Ct*Ct+mt*mt)||1,fn=Ct/Ot,bn=mt/Ot,va=Math.min(fn!==0?qe/Math.abs(fn):1/0,bn!==0?Yt/Math.abs(bn):1/0);Oe.push({gid:se,g:ae,x:na+fn*va,y:ue+bn*va})});for(var Ne=0;Ne<40;Ne++){for(var gt=!1,It=0;It<Oe.length;It++)for(var $t=It+1;$t<Oe.length;$t++){var re=Oe[It],Xe=Oe[$t],Lt=Xe.x-re.x,Ut=Xe.y-re.y,wr=On+24-Math.abs(Lt),vi=Br+14-Math.abs(Ut);if(wr>0&&vi>0){if(wr<=vi){var Na=(Lt===0?It<$t?-1:1:Lt>0?1:-1)*wr/2;re.x-=Na,Xe.x+=Na}else{var Zy=(Ut===0?-1:Ut>0?1:-1)*vi/2;re.y-=Zy,Xe.y+=Zy}gt=!0}}if(!gt)break}Oe.forEach(function(se){Ie[se.gid]={x:se.x,y:se.y,w:On,h:Br},L.push({data:{id:se.gid,label:se.g.label+`
|
|
758
|
+
(external)`,w:On,h:Br,tw:On-14,extKind:se.g.kind,extId:se.g.id},position:{x:se.x,y:se.y},classes:"ghost"})});function Jy(se,ae){return se.x>=ae.l&&se.x<=ae.r&&se.y>=ae.t&&se.y<=ae.b}function ic(se,ae,me){var He=(ae.y-se.y)*(me.x-ae.x)-(ae.x-se.x)*(me.y-ae.y);return Math.abs(He)<1e-4?0:He>0?1:2}function sc(se,ae,me){return ae.x<=Math.max(se.x,me.x)&&ae.x>=Math.min(se.x,me.x)&&ae.y<=Math.max(se.y,me.y)&&ae.y>=Math.min(se.y,me.y)}function oc(se,ae,me,He){var Ct=ic(se,ae,me),mt=ic(se,ae,He),Ot=ic(me,He,se),fn=ic(me,He,ae);return Ct!==mt&&Ot!==fn?!0:Ct===0&&sc(se,me,ae)||mt===0&&sc(se,He,ae)||Ot===0&&sc(me,se,He)||fn===0&&sc(me,ae,He)}function Uj(se,ae,me){if(Jy(se,me)||Jy(ae,me))return!0;var He={x:me.l,y:me.t},Ct={x:me.r,y:me.t},mt={x:me.r,y:me.b},Ot={x:me.l,y:me.b};return oc(se,ae,He,Ct)||oc(se,ae,Ct,mt)||oc(se,ae,mt,Ot)||oc(se,ae,Ot,He)}function qj(se){for(var ae=0,me=0;me<se.length;me++)ae=(ae<<5)-ae+se.charCodeAt(me)|0;return Math.abs(ae)}function e0(se,ae,me){var He=Ie[se],Ct=Ie[ae],mt=qj(me||se+">"+ae),Ot=mt%4,fn=mt%8<4?1:-1;if(!He||!Ct)return{cpDist:fn*(78+Ot*8),cpWeight:.48,taxiTurn:fn*(54+Ot*20)};var bn=Ct.x-He.x,va=Ct.y-He.y,Qt=Math.sqrt(bn*bn+va*va)||1,ds=-va/Qt,Gj=bn/Qt,t0={x:(He.x+Ct.x)/2,y:(He.y+Ct.y)/2},lc=0,gh=0,uc=54;if(Object.keys(Ie).forEach(function(mh){if(!(mh===se||mh===ae)){var Pa=Ie[mh],Yj={l:Pa.x-Pa.w/2-uc,r:Pa.x+Pa.w/2+uc,t:Pa.y-Pa.h/2-uc,b:Pa.y+Pa.h/2+uc};if(Uj({x:He.x,y:He.y},{x:Ct.x,y:Ct.y},Yj)){lc++;var Xj=(Pa.x-t0.x)*ds+(Pa.y-t0.y)*Gj>=0?-1:1;gh+=Xj}}}),!lc)return{cpDist:fn*(78+Ot*8),cpWeight:.48,taxiTurn:fn*(54+Ot*20)};var n0=gh===0?fn:gh>0?1:-1;return{cpDist:n0*Math.min(280,132+lc*44+Ot*10),cpWeight:.5,taxiTurn:n0*Math.min(170,74+lc*22+Ot*20)}}var cs={};if(j.forEach(function(se){M.query&&!wt(se)&&(cs[V(se)]=!0)}),O){var Hj=0;Object.keys(O.direct).sort().forEach(function(se){var ae=O.direct[se],me=M.query&&(cs[ae.aTop]||cs[ae.bTop]);L.push({data:{id:"dd"+Hj++,source:ae.src,target:ae.tgt,lbl:""},classes:"inneredge"+(ae.cross?" cross":"")+(me?" dimmed":"")})})}var Wj=0;if(Object.keys(W.agg).forEach(function(se){var ae=W.agg[se];if(!(O&&O.directTopCount[se]>=ae.n)){var me=ae.n>1,He=M.query&&(cs[ae.src]||cs[ae.tgt]),Ct=e0(ae.src,ae.tgt,se),mt=ae.health?bt[ae.health]:"",Ot=ae.consumption?"rel rel-"+(ae.health||"unchecked")+" ":"";L.push({data:{id:"e"+Wj++,source:ae.src,target:ae.tgt,lbl:(me?ae.n+" links":"")+(mt?(me?" ":"")+mt:""),rels:(ae.rels||[]).join("|"),cpDist:Ct.cpDist,cpWeight:Ct.cpWeight,taxiTurn:Ct.taxiTurn},classes:"routed "+(ae.cross?"cross ":"")+(me?"bundle ":"")+(ae.ghost?"toghost ":"")+Ot+(He?"dimmed":"")})}}),M.dataCoupling){var Kj=0;Object.keys(q.agg).forEach(function(se){if(!W.agg[se]){var ae=q.agg[se],me=M.query&&(cs[ae.src]||cs[ae.tgt]),He=e0(ae.src,ae.tgt,se);L.push({data:{id:"de"+Kj++,source:ae.src,target:ae.tgt,lbl:ae.n>1?ae.n+" × models":"models",cpDist:He.cpDist,cpWeight:He.cpWeight,taxiTurn:He.taxiTurn},classes:"routed datacoupling"+(ae.ghost?" toghost":"")+(me?" dimmed":"")})}})}return L}d.setAttribute("data-theme",M.theme),ce();var Fe=Xi({container:u.getElementById("cy"),elements:Zu(),style:it(at[M.theme]),layout:{name:"preset"},minZoom:.05,maxZoom:4,boxSelectionEnabled:!1,autounselectify:!0});Fe.autolock(!0);var Ar=null;os(!0),Us(),Zf();function Yf(){var k=(F.positionsByView||{})[ye()]||{},j=Fe.autolock();j&&Fe.autolock(!1),Fe.nodes().forEach(function(L){!L.isParent()&&k[L.id()]&&L.position(k[L.id()])}),j&&Fe.autolock(!0)}function Xf(){var k=F.positionsByView||{},j=k[ye()]||{};Fe.nodes().forEach(function(L){L.isParent()||(j[L.id()]={x:L.position("x"),y:L.position("y")})}),k[ye()]=j,F.positionsByView=k,Te()}function Qf(){return{name:"cose",animate:!1,randomize:!1,padding:60,nodeDimensionsIncludeLabels:!0,nodeRepulsion:function(){return 4e5},nodeOverlap:80,idealEdgeLength:function(){return 200},edgeElasticity:function(){return 120},gravity:.15,componentSpacing:200,nestingFactor:1.2,numIter:1500,coolingFactor:.96,initialTemp:240}}function ss(k,j){for(var L=Fe.nodes().orphans().toArray(),O=0;O<80;O++){for(var W=!1,q=0;q<L.length;q++)for(var he=q+1;he<L.length;he++){var xe=L[q],De=L[he],Ue=xe.boundingBox(),Se=De.boundingBox(),J=(Se.x1+Se.x2)/2-(Ue.x1+Ue.x2)/2,je=(Se.y1+Se.y2)/2-(Ue.y1+Ue.y2)/2,ze=(Ue.w+Se.w)/2+k-Math.abs(J),Ie=(Ue.h+Se.h)/2+j-Math.abs(je);if(ze>0&&Ie>0){if(ze<=Ie){var lt=(J===0?q<he?-1:1:J>0?1:-1)*ze/2;xe.position("x",xe.position("x")-lt),De.position("x",De.position("x")+lt)}else{var We=(je===0?-1:je>0?1:-1)*Ie/2;xe.position("y",xe.position("y")-We),De.position("y",De.position("y")+We)}W=!0}}if(!W)break}}function ol(){if(M.layout==="force"){var k=Fe.autolock();k&&Fe.autolock(!1);try{Fe.layout(Qf()).run(),ss(56,20);var j=Fe.nodes().orphans();if(j.length>1){var L=j.boundingBox(),O=(L.x1+L.x2)/2;j.forEach(function(W){W.position("x",O+(W.position("x")-O)*1.6)})}}catch{}k&&Fe.autolock(!0)}}function os(k){var j=(F.positionsByView||{})[ye()],L=j&&Object.keys(j).length>0;M.view.kind!=="types"&&M.layout!=="layered"&&!L&&ol(),Yf(),k&&Fe.fit(void 0,60)}function nr(k){if(Ar=null,Fe.batch(function(){Fe.elements().remove(),Fe.add(Zu())}),os(k),M.selectedKind==="external"&&(Fe.getElementById(M.selected).length?(Ar=M.selected,th()):(M.selectedKind=null,M.selected=null,Ks())),Us(),Zf(),Pj(),Iy(),M.selectedKind&&M.selectedKind!=="external"){var j=ll(M.selectedKind,M.selected);j.length&&Yy(j)}}function Ju(){var k={},j={};return Fe.nodes().forEach(function(L){var O=L.id(),W=L.boundingBox({includeLabels:!1,includeOverlays:!1}),q={x:W.x1,y:W.y1,w:W.w,h:W.h};O.indexOf("s~")===0?j[O.slice(2)]={x:q.x,y:q.y,w:q.w,h:q.h,collapsed:!0}:O.indexOf("c~")===0&&(k[O.slice(2)]=q)}),{boxes:k,subs:j}}function ll(k,j){if(k==="type")return Fe.getElementById("T~"+j);if(k==="external")return Fe.getElementById(j);var L=Fe.getElementById(k==="subsystem"?S(j):E(j));if(L.length)return L;var O=Fe.getElementById(C(k,j));if(O.length)return O;if(k==="component"){var W=H(j,M.view);if(W){var q=Fe.getElementById(V(W));if(q.length)return q}var he=Fe.getElementById("x~component~"+j);if(he.length)return he}else{var xe=Fe.getElementById("x~subsystem~"+j);if(xe.length)return xe}return Fe.collection()}function qr(){var k=[{kind:"system",id:null,label:f.system.name}],j=M.view;if(j.kind==="databases"){var L=[{kind:"databases",id:null,label:f.system.name}];if(j.id)for(var O=j.id.split("::"),W=1;W<=O.length;W++){var q=O.slice(0,W).join("::");L.push({kind:"databases",id:q,label:U({kind:"subsystem",id:q})})}return L[L.length-1].label+=" · Databases",L}if(j.kind==="types"){var he=[{kind:"types",id:null,label:f.system.name}];if(j.id)for(var xe=j.id.split("::"),De=1;De<=xe.length;De++){var Ue=xe.slice(0,De).join("::");he.push({kind:"types",id:Ue,label:U({kind:"subsystem",id:Ue})})}return he[he.length-1].label+=" · Types (ERD)",he}if(j.kind==="subsystem")for(var Se=j.id.split("::"),J=1;J<=Se.length;J++){var je=Se.slice(0,J).join("::");k.push({kind:"subsystem",id:je,label:U({kind:"subsystem",id:je})})}else if(j.kind==="component"){var ze=y[j.id];ze&&(D(ze).forEach(function(Ie){k.push({kind:"subsystem",id:Ie,label:U({kind:"subsystem",id:Ie})})}),$(ze).forEach(function(Ie){k.push({kind:"component",id:Ie,label:U({kind:"component",id:Ie})})}),k.push({kind:"component",id:ze.id,label:ze.name}))}return k}var Sa=!1,ul,qa=null;function Dr(k,j){return'<button class="crumb'+(j?" cur":"")+'" data-ck="'+k.kind+'" data-ci="'+(k.id||"")+'">'+k.label+"</button>"}function Us(){var k=u.getElementById("crumbs"),j=qr(),L;if(Sa&&j.length>1?L='<span class="dropdown" id="crumbDd"><button class="crumb crumbmore" id="crumbMoreBtn" title="Show the collapsed ancestor path">…</button><span class="menu" id="crumbMenu">'+j.slice(0,j.length-1).map(function(q){return'<button data-ck="'+q.kind+'" data-ci="'+(q.id||"")+'">'+q.label+"</button>"}).join("")+'</span></span><span class="sep">›</span>'+Dr(j[j.length-1],!0):L=j.map(function(q,he){var xe=he===j.length-1;return Dr(q,xe)+(xe?"":'<span class="sep">›</span>')}).join(""),L!==ul){ul=L,k.innerHTML=L;for(var O=k.querySelectorAll("button"),W=0;W<O.length;W++)(function(q){q.getAttribute("data-ck")&&q.addEventListener("click",function(){ja(q.getAttribute("data-ck"),q.getAttribute("data-ci")||null)})})(O[W]);Sa&&j.length>1&&fi("crumbDd","crumbMoreBtn"),qa&&qa()}}function Zf(){if(M.view.kind==="types"||M.view.kind==="databases"){var k=Bn().length,j=M.view.kind==="databases"?"database tables":"types (ERD";u.getElementById("viewHint").textContent="View: "+k+" "+j+(M.view.id?", "+M.view.id+" + shared":"")+(M.view.kind==="databases"?"":")")+" · "+(M.typesDetail==="names"?"dependency lines":"relation lines anchor at their field · double-click an FK row to jump to its type");return}var L=I(M.view).length,O=M.view.kind==="system"?"top-level subsystems":M.view.kind==="subsystem"?"children of this subsystem":"members of this pattern";u.getElementById("viewHint").textContent="View: "+L+" "+O+" · double-click a box to open it"}function ja(k,j){M.view.kind===k&&M.view.id===j||(M.view={kind:k,id:j},M.selected=null,M.selectedKind=null,M.typesRenderAll=!1,nr(!0),Ks(),ec())}function Jf(k){return encodeURIComponent(String(k))}function Nj(k){if(!k)return"";var j=k.kind;if(j==="system")return"";if(j==="types"||j==="databases")return k.id?j+"/"+k.id.split("::").map(Jf).join("/"):j;if(j==="subsystem")return k.id?k.id.split("::").map(Jf).join("/"):"";if(j==="component"){var L=y[k.id],O=L?L.id:k.id;return O.split("::").map(Jf).join("/")}return""}function Cy(k){var j=String(k||"").split("/").filter(function(O){return O.length>0}).map(decodeURIComponent);if(!j.length)return{kind:"system",id:null};if(j[0]==="types")return{kind:"types",id:j.length>1?j.slice(1).join("::"):null};if(j[0]==="databases")return z?{kind:"databases",id:j.length>1?j.slice(1).join("::"):null}:{kind:"system",id:null};var L=j.join("::");return b[L]?{kind:"subsystem",id:L}:y[L]?{kind:"component",id:L}:{kind:"system",id:null}}function Sy(k){var j=Cy(k);if(!(M.view.kind===j.kind&&M.view.id===j.id)){ve=!0;try{M.view={kind:j.kind,id:j.id},M.selected=null,M.selectedKind=null,M.typesRenderAll=!1,nr(!0),Ks()}finally{ve=!1}}}function ec(){if(!ve&&typeof n<"u"&&n&&typeof n.onViewChange=="function")try{n.onViewChange(Nj(M.view))}catch{}}function Pj(){var k=u.getElementById("typesWarn");if(k){if(M.view.kind!=="types"&&M.view.kind!=="databases"||!oe){k.style.display="none",k.innerHTML="";return}var j=oe.indexOf(":"),L=oe.slice(0,j),O=oe.slice(j+1),W=L==="cluster"?"⚠ "+O+" types — showing a subsystem overview so it stays fast. Double-click a group to open its types.":"⚠ "+O+" types — showing names only so it stays fast. Drill into a subsystem for fields, or";k.innerHTML=W+'<button class="tbtn" id="typesAllBtn">Render full detail anyway</button>',k.style.display="block";var q=u.getElementById("typesAllBtn");q&&q.addEventListener("click",function(){M.typesRenderAll=!0,nr(!0)})}}function eh(k){var j=k.id();if(j.indexOf("p~")===0)return{proxy:!0,id:j};if(j.indexOf("x~")===0)return{ghost:!0,kind:k.data("extKind"),id:k.data("extId")};if(j.indexOf("TC~")===0)return{cluster:!0,id:j.slice(3)};if(j.indexOf("TG~")===0)return{group:!0,id:j};if(j.indexOf("TH~")===0)return{kind:"type",id:j.slice(3)};if(j.indexOf("TM~")===0)return{kind:"type",id:j.slice(3,j.lastIndexOf("~"))};if(j.indexOf("TF~")===0){var L=j.slice(3),O=L.lastIndexOf("~");return{kind:"type",id:L.slice(0,O),field:L.slice(O+1)}}if(j.indexOf("T~")===0)return{kind:"type",id:j.slice(2)};if(j.indexOf("i~")===0){var W=j.slice(2),q=W.indexOf("~");return{inner:!0,kind:W.slice(0,q),id:W.slice(q+1)}}return{kind:j.charAt(0)==="s"?"subsystem":"component",id:j.slice(2)}}function jy(k,j){var L=k.data("rvTargets")||[],O=k.data("rvDir"),W=[];L.forEach(function(q){if(Fe.getElementById(q).length){var he=O==="out"?k.id():q,xe=O==="out"?q:k.id(),De="rv~"+j+"~"+he+"~"+xe;Fe.getElementById(De).length||j==="revealHover"&&Fe.getElementById("rv~revealPin~"+he+"~"+xe).length||W.push({group:"edges",data:{id:De,source:he,target:xe},classes:"revealEdge "+j})}}),W.length&&Fe.add(W)}function th(){if(Fe.remove(".revealPin"),!!Ar){var k=Fe.getElementById(Ar);k.length&&jy(k,"revealPin")}}function Ty(){Fe.remove(".revealEdge")}Fe.on("mouseover","node.proxyExt",function(k){Fe.remove(".revealHover"),k.target.id()!==Ar&&jy(k.target,"revealHover")}),Fe.on("mouseout","node.proxyExt",function(){Fe.remove(".revealHover")});var Ta=null;function Ny(k){var j=k&&k.length?k.id():null;if((Ta?Ta.id():null)!==j&&(Ta&&Ta.length&&(Ta.removeClass("hoverhl"),Ta.connectedEdges(".inneredge").removeClass("stubHover")),Ta=null,k&&k.length&&!k.isParent())){var L=eh(k);L.group||L.cluster||(k.addClass("hoverhl"),k.connectedEdges(".inneredge").addClass("stubHover"),Ta=k)}}Fe.on("mouseover","node",function(k){Ny(k.target)}),Fe.on("mouseout","node",function(k){Ta&&Ta.id()===k.target.id()&&Ny(null)});function Rj(k){return(k.data("rels")||"").split("|").filter(Boolean).map(function(j){return et[j]}).filter(Boolean)}Fe.on("mouseover","edge.rel",function(k){var j=u.getElementById("relTip"),L=Rj(k.target);j.textContent=L.length?L.map(pe).join(`
|
|
759
|
+
|
|
760
|
+
`):"relation health not checked";var O=k.renderedPosition||{x:0,y:0};j.style.left=O.x+12+"px",j.style.top=O.y+12+"px",j.style.display="block"}),Fe.on("mouseout","edge.rel",function(){u.getElementById("relTip").style.display="none"}),Fe.on("tap","edge.rel",function(k){var j=k.target.data("rels")||"";j&&Hr("relation",j,!1)}),Fe.on("tap","node",function(k){var j=eh(k.target);if(!j.group){if(j.cluster){Hr(null,null,!1);return}if(j.proxy){Fe.remove(".revealHover"),Ar===j.id?(Ar=null,th(),Hr(null,null,!1)):(Ar=j.id,th(),Hr("external",j.id,!1));return}Ar&&(Ar=null,Ty()),Hr(j.kind,j.id,!1),j.kind==="type"&&j.field&&(Fe.edges().removeClass("fieldhl"),Fe.edges().filter(function(L){return L.data("ffrom")===j.id&&L.data("ffield")===j.field}).addClass("fieldhl"))}}),Fe.on("tap",function(k){k.target===Fe&&(Ar&&(Ar=null,Ty()),Hr(null,null,!1))}),Fe.on("dbltap","node",function(k){var j=eh(k.target);if(!(j.proxy||j.group)){if(typeof n<"u"&&n&&n.onNodeOpen&&j.kind==="component"){n.onNodeOpen("component",j.id);return}if(j.cluster){ja("types",j.id);return}if(j.kind==="type"){if(j.field){var L=null;f.typeEdges.forEach(function(q){!L&&q.from===j.id&&q.field===j.field&&(L=q)}),L&&Hr("type",L.to,!0)}return}if(j.ghost){M.view=Ij(j.kind,j.id),nr(!0),ec(),Hr(j.kind,j.id,!0);return}var O=j.kind==="subsystem"?N(j.id).length+P(j.id).length>0:R(j.id).length>0;if(O){ja(j.kind,j.id);return}var W=j.kind==="subsystem"?b[j.id]:null;if(W&&W.project){if(W.recordId&&typeof n<"u"&&n&&typeof n.onOpenProject=="function"){n.onOpenProject(W.recordId);return}Hr("subsystem",j.id,!1)}}}),Fe.on("dragfree","node",function(){Xf()});function Ij(k,j){if(k==="subsystem"){var L=j.split("::");return L.length>1?{kind:"subsystem",id:L.slice(0,-1).join("::")}:{kind:"system",id:null}}var O=y[j];return O&&O.owner?{kind:"component",id:O.owner}:O?{kind:"subsystem",id:O.subsystem}:{kind:"system",id:null}}function Py(){var k=u.getElementById("searchBtn");k&&k.classList&&k.classList[M.query?"add":"remove"]("hasq")}u.getElementById("search").addEventListener("input",function(k){M.query=k.target.value.trim(),Py(),nr(!1)}),Py(),u.getElementById("internalsToggle").checked=M.internals,u.getElementById("internalsToggle").addEventListener("change",function(k){M.internals=k.target.checked,Te(),nr(!0)}),u.getElementById("externalsToggle").checked=M.externals,u.getElementById("externalsToggle").addEventListener("change",function(k){M.externals=k.target.checked,Te(),nr(!0)}),u.getElementById("dataCouplingToggle").checked=M.dataCoupling,u.getElementById("dataCouplingToggle").addEventListener("change",function(k){M.dataCoupling=k.target.checked,Te(),ce(),nr(!0)}),u.getElementById("issuesToggle").checked=M.showIssues,u.getElementById("issuesToggle").addEventListener("change",function(k){M.showIssues=k.target.checked,Te(),nr(!1),Ks()}),u.getElementById("dragToggle").addEventListener("change",function(k){Fe.autolock(!k.target.checked)});function nh(){if(M.view.kind==="subsystem")return M.view.id;if(M.view.kind==="component"){var k=y[M.view.id];return k?k.subsystem:null}return M.view.kind==="types"||M.view.kind==="databases"?M.view.id:null}(function(){for(var k=u.getElementById("modeSeg"),j=k.querySelectorAll("button"),L=0;L<j.length;L++)(function(O){O.getAttribute("data-vm")==="databases"&&!z&&(O.style.display="none");var W=typeof n<"u"&&n&&typeof n.onOpenNetwork=="function";O.getAttribute("data-vm")==="network"&&W&&(O.style.display=""),O.addEventListener("click",function(){var q=O.getAttribute("data-vm");q==="network"&&W?n.onOpenNetwork():q==="databases"&&z?ja("databases",nh()):q==="types"?ja("types",nh()):q==="components"&&ja(M.view.id?"subsystem":"system",M.view.id||null)})})(j[L])})(),function(){for(var k=u.getElementById("typesDetailSeg"),j=k.querySelectorAll("button"),L=0;L<j.length;L++)(function(O){O.addEventListener("click",function(){M.typesDetail=O.getAttribute("data-td"),Te(),M.view.kind==="types"||M.view.kind==="databases"?nr(!0):Iy()})})(j[L])}();function Ry(){var k=u.getElementById("modeBtn");if(k){var j=M.view.kind==="types"?"Types":M.view.kind==="databases"?"Databases":"Components";k.textContent=j+" ▾"}}function Iy(){var k=u.getElementById("modeSeg"),j=k.querySelectorAll("button");if(!j.length){var L=u.getElementById("modeMenu");L&&L.querySelectorAll&&(j=L.querySelectorAll("button"))}for(var O=0;O<j.length;O++){var W=j[O].getAttribute("data-vm"),q=W==="components"?M.view.kind!=="types"&&M.view.kind!=="databases":W===M.view.kind;j[O].classList&&j[O].classList[q?"add":"remove"]("active")}Ry();var he=u.getElementById("typesDetailSeg");he.style.display=M.view.kind==="types"||M.view.kind==="databases"?"":"none";for(var xe=he.querySelectorAll("button"),De=0;De<xe.length;De++)xe[De].classList&&xe[De].classList[xe[De].getAttribute("data-td")===M.typesDetail?"add":"remove"]("active")}(function(){var k=u.getElementById("lineStyleSelect");k&&(k.value=M.lineStyle,k.addEventListener("change",function(j){M.lineStyle=j.target.value,Te(),Fe.style(it(at[M.theme]))}))})(),u.getElementById("fitBtn").addEventListener("click",function(){Fe.fit(void 0,60)}),u.getElementById("resetBtn").addEventListener("click",function(){var k=F.positionsByView||{};delete k[ye()],F.positionsByView=k,Te(),nr(!0)}),u.getElementById("themeBtn").addEventListener("click",function(){M.theme=M.theme==="syw"?"light":"syw",d.setAttribute("data-theme",M.theme),Fe.style(it(at[M.theme])),ce(),Te()});function rh(k){d.classList&&(d.classList[k?"add":"remove"]("presentation"),k||d.classList.remove("show-details")),setTimeout(function(){Fe.resize(),Fe.fit(void 0,40)},60)}u.getElementById("presentBtn").addEventListener("click",function(){rh(!0)}),u.getElementById("exitPresent").addEventListener("click",function(){rh(!1)}),u.getElementById("presentDetails").addEventListener("click",function(){d.classList&&d.classList.toggle("show-details"),setTimeout(function(){Fe.resize(),Fe.fit(void 0,40)},60)});function Ly(k,j){var L=k.querySelector?k.querySelector(".menu"):null;if(!(!L||!j.getBoundingClientRect||typeof window>"u")){var O=j.getBoundingClientRect();L.style.top=O.bottom+6+"px",L.style.left="auto";var W=Math.max(6,window.innerWidth-O.right),q=L.getBoundingClientRect?L.getBoundingClientRect().width:0;q&&window.innerWidth-W-q<6&&(W=Math.max(6,window.innerWidth-q-6)),L.style.right=W+"px"}}function fi(k,j){var L=u.getElementById(k),O=u.getElementById(j);return O.addEventListener("click",function(W){if(W&&W.stopPropagation&&W.stopPropagation(),!!L.classList){var q=!L.classList.contains("open");L.classList.toggle("open"),q&&Ly(L,O)}}),L}var tc=fi("exportDd","exportBtn"),Ay=fi("flowExportDd","flowExportBtn"),qs=fi("layoutDd","layoutBtn"),Dy=fi("settingsDd","settingsBtn"),ah=fi("moreDd","moreBtn"),ls=fi("searchDd","searchBtn"),Hs=fi("modeDd","modeBtn");u.getElementById("searchBtn").addEventListener("click",function(){if(String(ls.className||"").indexOf("open")>=0){var k=u.getElementById("search");k&&k.focus&&k.focus()}}),function(){var k=u.getElementById("settingsMenu");k&&k.addEventListener&&k.addEventListener("click",function(L){L&&L.stopPropagation&&L.stopPropagation()});var j=u.getElementById("searchMenu");j&&j.addEventListener&&j.addEventListener("click",function(L){L&&L.stopPropagation&&L.stopPropagation()})}();var ih={layered:"Layered",force:"Force",concentric:"Concentric",grid:"Grid"};function By(){var k=u.getElementById("layoutBtn");k&&(k.textContent="Layout: "+(ih[M.layout]||"Layered")+" ▾")}function Lj(k){if(!ih[k]||M.layout===k){qs.classList&&qs.classList.remove("open");return}M.layout=k,Te(),By(),qs.classList&&qs.classList.remove("open"),nr(!0)}Object.keys(ih).forEach(function(k){var j=u.getElementById("layout"+k.charAt(0).toUpperCase()+k.slice(1));j&&j.addEventListener&&j.addEventListener("click",function(){Lj(k)})}),By();function My(){var k=u.getElementById("crumbDd");k&&k.classList&&k.classList.remove("open")}document.addEventListener&&(document.addEventListener("click",function(){tc.classList&&tc.classList.remove("open"),Ay.classList&&Ay.classList.remove("open"),qs.classList&&qs.classList.remove("open"),Dy.classList&&Dy.classList.remove("open"),ah&&ah.classList&&ah.classList.remove("open"),ls&&ls.classList&&ls.classList.remove("open"),Hs&&Hs.classList&&Hs.classList.remove("open"),My()}),document.addEventListener("keydown",function(k){if(k.key==="Escape"){var j=u.getElementById("flowModal");if(j.classList&&String(j.className).indexOf("open")>=0){Hy();return}rh(!1),tc.classList&&tc.classList.remove("open"),ls&&ls.classList&&ls.classList.remove("open"),Hs&&Hs.classList&&Hs.classList.remove("open"),My()}})),function(){if(typeof window>"u")return;var k=u.getElementById("hdr"),j=u.getElementById("moreDd"),L=u.getElementById("moreMenu");if(!k||!j||!L||!k.getBoundingClientRect)return;var O=["themeBtn","resetBtn","exportBtn","layoutBtn","presentBtn","fitBtn","panelToggle"],W={};function q(ut){var Ae=u.getElementById(ut);if(!Ae)return null;var Ee=Ae.parentNode;return Ee&&Ee.className&&String(Ee.className).indexOf("dropdown")>=0&&Ee!==L?Ee:Ae}function he(ut,Ae){if(!W[ut]){var Ee=document.createElement("span");Ee.style.display="none",Ae.parentNode.insertBefore(Ee,Ae),W[ut]=Ee}return W[ut]}function xe(ut){var Ae=[];return{apply:function(){for(;Ae.length<ut.length;){var Ee=ut[Ae.length],Q=q(Ee);if(!Q||Q===j||Q.parentNode===L){Ae.push({el:null,marker:null});continue}var Ce=he(Ee,Q);return Q.classList&&Q.classList.remove("open"),j.style.display="",L.appendChild(Q),Ae.push({el:Q,marker:Ce}),!0}return!1},restore:function(){for(var Ee=Ae.length-1;Ee>=0;Ee--){var Q=Ae[Ee];Q.el&&Q.marker&&Q.marker.parentNode&&Q.marker.parentNode.insertBefore(Q.el,Q.marker)}Ae=[]}}}function De(){var ut=!1;return{apply:function(){if(ut)return!1;var Ae=u.getElementById("search"),Ee=u.getElementById("searchDd"),Q=u.getElementById("searchMenu");return!Ae||!Ee||!Q?!1:(Q.appendChild(Ae),Ee.style.display="",ut=!0,!0)},restore:function(){if(ut){ut=!1;var Ae=u.getElementById("search"),Ee=u.getElementById("searchDd");Ae&&Ee&&Ee.parentNode&&Ee.parentNode.insertBefore(Ae,Ee),Ee&&(Ee.style.display="none",Ee.classList&&Ee.classList.remove("open"))}}}}function Ue(){var ut=[];return{apply:function(){if(ut.length)return!1;var Ae=u.getElementById("modeSeg"),Ee=u.getElementById("modeDd"),Q=u.getElementById("modeMenu");if(!Ae||!Ee||!Q)return!1;var Ce=Ae.querySelectorAll("button");if(!Ce.length)return!1;for(var st=0;st<Ce.length;st++)ut.push(Ce[st]);for(var ke=0;ke<ut.length;ke++)Q.appendChild(ut[ke]);return Ae.style.display="none",Ee.style.display="",Ry(),!0},restore:function(){if(ut.length){for(var Ae=u.getElementById("modeSeg"),Ee=u.getElementById("modeDd"),Q=0;Q<ut.length;Q++)Ae.appendChild(ut[Q]);ut=[],Ae.style.display="",Ee&&(Ee.style.display="none",Ee.classList&&Ee.classList.remove("open"))}}}}function Se(){return{apply:function(){return Sa?!1:(Sa=!0,Us(),!0)},restore:function(){Sa&&(Sa=!1,Us())}}}var J=[xe(O),xe(["settingsBtn"]),De(),Ue(),Se()];function je(){var ut=k.querySelector(".spacer"),Ae=ut?ut.getBoundingClientRect().width:0;return k.scrollWidth-k.clientWidth-Ae}var ze=!1;function Ie(){var ut=k.getBoundingClientRect();if(!(!ut||ut.width<=0)){ze=!0;try{var Ae=u.getElementById("searchDd"),Ee=u.getElementById("search"),Q=!!(Ae&&String(Ae.className||"").indexOf("open")>=0),Ce=!1;try{var st=(typeof u<"u"&&u?u:document).activeElement;Ce=!!(st&&Ee&&st===Ee)}catch{}for(var ke=J.length-1;ke>=0;ke--)J[ke].restore();j.style.display="none",k.scrollLeft=0;for(var we=0,ge=0,tt=O.length+J.length+8;je()>-8&&we<J.length&&ge<tt;)ge++,J[we].apply()||we++;if(Q||Ce){var xt=Ae&&Ae.style&&Ae.style.display!=="none";xt&&Q&&(Ae.classList&&Ae.classList.add("open"),Ly(Ae,u.getElementById("searchBtn"))),Ce&&Ee&&Ee.focus&&Ee.focus()}}finally{ze=!1}}}var lt=null,We=window.requestAnimationFrame?window.requestAnimationFrame.bind(window):window.setTimeout.bind(window);function Le(){lt===null&&(lt=We(function(){lt=null,Ie()}))}qa=function(){ze||Le()},typeof ResizeObserver<"u"?new ResizeObserver(Le).observe(k):window.addEventListener&&window.addEventListener("resize",Le),Le()}();function sh(){var k=M.view.kind==="types"?"types":M.view.id?M.view.id.replace(/::/g,"-"):"system";return(String(f.system.name)+"-"+k).replace(/\s+/g,"-").toLowerCase()}function nc(k,j,L){if(v){var O=new Blob([j],{type:L}),W=document.createElement("a");W.href=URL.createObjectURL(O),W.download=k,d.appendChild(W),W.click(),W.remove(),setTimeout(function(){URL.revokeObjectURL(W.href)},5e3)}}function Oy(k,j){if(v){var L=k.png({full:!0,scale:2,bg:at[M.theme].png}),O=document.createElement("a");O.href=L,O.download=j,d.appendChild(O),O.click(),O.remove()}}function Aj(){var k=Bn(),j={};k.forEach(function(q){j[q.id]=1});var L=k.map(function(q){return{id:q.id,name:q.name,subsystem:"types",componentType:q.kind==="entity"?"Entity":"ValueObject",public:!1,owns:[]}}),O={},W=[];return f.typeEdges.forEach(function(q){if(!(!j[q.from]||!j[q.to])){var he=q.from+"=>"+q.to;O[he]||(O[he]=1,W.push({from:q.from,to:q.to,cross:!1}))}}),{system:{name:f.system.name},generatedAt:f.generatedAt,subsystems:[{id:"types",name:f.system.name+" — types"}],components:L,edges:W}}function Dj(){var k={},j=1/0,L=1/0,O=-1/0,W=-1/0;return Fe.nodes().forEach(function(q){if(q.id().indexOf("T~")===0){var he=q.boundingBox({includeLabels:!1,includeOverlays:!1});k[q.id().slice(2)]={x:he.x1,y:he.y1,w:he.w,h:he.h},j=Math.min(j,he.x1),L=Math.min(L,he.y1),O=Math.max(O,he.x2),W=Math.max(W,he.y2)}}),{boxes:k,subs:{types:{x:j-24,y:L-42,w:O-j+48,h:W-L+66,collapsed:!1}}}}function zy(){return M.view.kind==="types"?{model:Aj(),layout:Dj()}:{model:f,layout:Ju()}}u.getElementById("expPng").addEventListener("click",function(){Oy(Fe,sh()+".png")}),u.getElementById("expDrawio").addEventListener("click",function(){var k=zy();nc(sh()+".drawio",Jw(k.model,k.layout),"application/xml")}),u.getElementById("expExcalidraw").addEventListener("click",function(){var k=zy();nc(sh()+".excalidraw",e1(k.model,k.layout),"application/json")});var jn=null,hr=[],cl="flow",dl=!1;function fl(k,j){var L=y[k];if(!L)return null;for(var O=0;O<L.narratives.length;O++)if(L.narratives[O].method===j)return L.narratives[O];return null}function oh(k,j){var L=y[k];if(!L||!L.intents)return null;for(var O=0;O<L.intents.length;O++)if(L.intents[O].method===j)return L.intents[O].text;return null}function lh(k,j){var L=y[k];if(!L)return null;for(var O=0;O<L.interfaces.length;O++)for(var W=L.interfaces[O].methods,q=0;q<W.length;q++)if(W[q].name===j)return{intf:L.interfaces[O],m:W[q]};return null}function uh(k,j){return!!(fl(k,j)||oh(k,j)||lh(k,j))}function ch(){var k=hr[hr.length-1];return k.comp+"."+k.method}function Bj(){u.getElementById("flowCrumb").innerHTML=hr.map(function(k,j){var L=k.comp+"."+k.method+"()";return j===hr.length-1?L:'<span class="dimc">'+L+" → </span>"}).join(""),u.getElementById("flowBack").style.display=hr.length>1?"":"none"}function Fy(k,j){hr.push({comp:k,method:j}),rc()}function _y(k){var j=(k?k.steps.slice():[]).sort(function(Q,Ce){return Q.n-Ce.n}),L={},O=[];j.forEach(function(Q){L[Q.n]=Q,O.push(Q.n)});var W={};O.forEach(function(Q,Ce){W[Q]=Ce});function q(Q){var Ce=W[Q];return Ce!==void 0&&Ce+1<O.length?O[Ce+1]:null}var he={},xe=[],De={};j.forEach(function(Q){for(;xe.length&&xe[xe.length-1]<Q.n;)xe.pop();he[Q.n]=xe.length,(Q.kind==="loop"||Q.kind==="try"||Q.kind==="parallel")&&Q.end!==void 0&&xe.push(Q.end),Q.kind==="loop"&&Q.end!==void 0&&(De[Q.end]=Q.n)});var Ue=[],Se={},J={},je={};function ze(Q){return J[Q]!==void 0?J[Q]:q(Q)}j.forEach(function(Q){if(!(Q.kind!=="parallel"||Q.end===void 0||!(Q.branches&&Q.branches.length>=2))){var Ce="j"+Q.n,st=Q.branches.map(function(ge){return ge.step}).sort(function(ge,tt){return ge-tt});je[Ce]=ze(Q.end),Ue.push({id:Ce,header:Q.n,end:Q.end,arms:st.length}),Se[Ce]=1;for(var ke=0;ke<st.length;ke++){var we=ke+1<st.length?We(st[ke+1]):Q.end;we!==null&&we>=st[ke]&&(J[we]=Ce)}}});var Ie=[];j.forEach(function(Q){if(!(!Q.detach||!(Q.kind==="call"||Q.kind==="dispatch")||!Q.call)){var Ce="d"+Q.n;Ie.push({id:Ce,from:Q.n,comp:Q.call.component,method:Q.call.method}),Se[Ce]=1}});var lt=O.map(function(){return 0});function We(Q){var Ce=W[Q];return Ce!==void 0&&Ce>0?O[Ce-1]:null}function Le(Q,Ce,st){if(!(Q==null||Ce===null||Ce===void 0)){var ke=W[Q],we=W[Ce];if(!(ke===void 0||we===void 0||we<ke))for(var ge=ke;ge<=we;ge++)lt[ge]+=st}}j.forEach(function(Q){if((Q.kind==="loop"||Q.kind==="try")&&Q.end!==void 0&&Le(q(Q.n),Q.end,1),Q.kind==="branch"&&Q.onFalse!==void 0&&Q.onFalse>Q.n){var Ce=Q.onTrue!==void 0?Q.onTrue:q(Q.n);Ce!==null&&Ce>Q.n&&Ce<Q.onFalse&&Le(Ce,We(Q.onFalse),1)}if(Q.kind==="switch"){var st=(Q.cases||[]).map(function(ge){return ge.step}).filter(function(ge){return ge>Q.n&&L[ge]}).sort(function(ge,tt){return ge-tt}),ke=Q.defaultStep!==void 0&&Q.defaultStep>Q.n?Q.defaultStep:null;st.forEach(function(ge,tt){var xt=tt+1<st.length?We(st[tt+1]):ke!==null&&ke>ge?We(ke):null;xt!==null&&xt>=ge&&Le(ge,xt,tt+1)})}if(Q.kind==="parallel"&&Q.end!==void 0&&Q.branches&&Q.branches.length>=2){var we=Q.branches.map(function(ge){return ge.step}).filter(function(ge){return L[ge]}).sort(function(ge,tt){return ge-tt});we.forEach(function(ge,tt){if(tt!==0){var xt=tt+1<we.length?We(we[tt+1]):Q.end;xt!==null&&xt>=ge&&Le(ge,xt,tt)}})}});var ut={};O.forEach(function(Q,Ce){ut[Q]=lt[Ce]});var Ae=[];function Ee(Q,Ce,st,ke){Ce!=null&&(L[Ce]||Se[Ce])&&Ae.push({from:Q,to:Ce,kind:st,label:ke||""})}return j.forEach(function(Q){var Ce=Q.n;switch(Q.kind){case"branch":Ee(Ce,Q.onTrue!==void 0?Q.onTrue:ze(Ce),"true","true"),Ee(Ce,Q.onFalse,"false","false");break;case"switch":(Q.cases||[]).forEach(function(st){Ee(Ce,st.step,"case",st.value)}),Ee(Ce,Q.defaultStep!==void 0?Q.defaultStep:ze(Ce),"default","default");break;case"loop":Ee(Ce,q(Ce),"enter",Q.loopKind==="doWhile"?"do":""),Q.end!==void 0&&(Ee(Q.end,Ce,"back",Q.loopKind==="doWhile"?"while "+(Q.cond||""):"⟳"),Ee(Ce,ze(Q.end),"exit","done"));break;case"try":Ee(Ce,q(Ce),"seq"),(Q.catches||[]).forEach(function(st){Ee(Ce,st.step,"error",st.error)}),Q.fin!==void 0&&Ee(Ce,Q.fin,"finally","finally");break;case"parallel":(Q.branches||[]).forEach(function(st){Ee(Ce,st.step,"fork",st.name||"")});break;case"jump":Ee(Ce,Q.to,"jump");break;case"return":case"throw":break;default:De[Ce]===void 0&&Ee(Ce,ze(Ce),J[Ce]!==void 0?"join":"seq")}}),Ue.forEach(function(Q){Ee(Q.id,je[Q.id],"seq")}),Ie.forEach(function(Q){Ee(Q.from,Q.id,"detached","detached")}),{steps:j,edges:Ae,depth:he,lane:ut,first:O.length?O[0]:null,joins:Ue,detached:Ie}}function $y(k){if(k.first===null)return k;var j={};k.edges.forEach(function(q){q.kind!=="error"&&(j[q.from]=j[q.from]||[]).push(q.to)});for(var L={},O=[k.first];O.length;){var W=O.pop();L[W]||(L[W]=1,(j[W]||[]).forEach(function(q){L[q]||O.push(q)}))}return{steps:k.steps.filter(function(q){return L[q.n]}),edges:k.edges.filter(function(q){return q.kind!=="error"&&L[q.from]&&L[q.to]}),depth:k.depth,lane:k.lane,first:k.first,joins:(k.joins||[]).filter(function(q){return L[q.id]}),detached:(k.detached||[]).filter(function(q){return L[q.id]})}}function Vy(k){switch(k.kind){case"branch":return k.n+". ◇ "+(k.cond||k.text);case"switch":return k.n+". ◇ switch "+(k.on||k.text);case"loop":return k.n+". ⟳ "+(k.loopKind==="doWhile"?"do":k.loopKind||"forEach")+(k.over?" "+k.over:k.cond?" while "+k.cond:"");case"try":return k.n+". ⛨ try — "+k.text;case"parallel":return k.n+". ∥ "+k.text;case"jump":return k.n+". ↷ "+k.text;case"register":return k.n+". ⟲ register — "+k.text;case"return":return k.n+". ⏎ return"+(k.outcome?" — "+k.outcome:"");case"throw":return k.n+". ⚡ throw"+(k.err?" "+k.err:"");default:return k.n+". "+k.text}}function Uy(){var k=hr[hr.length-1],j=y[k.comp],L=fl(k.comp,k.method),O=at[M.theme],W=_y(L);dl&&(W=$y(W));var q=[];q.push({data:{id:"start",label:(j?j.name:k.comp)+"."+k.method+"()",w:280,h:44,tw:260},position:{x:0,y:0},classes:"flowstart"});var he={};W.steps.forEach(function(J,je){he[J.n]=je+1});var xe={};if((W.joins||[]).forEach(function(J){xe[J.header]=J}),W.steps.forEach(function(J,je){var ze="n"+J.n,Ie=(J.kind==="call"||J.kind==="dispatch"||J.kind==="register")&&!!J.call,lt=Ie&&!!J.detach,We=Ie&&!lt&&uh(J.call.component,J.call.method),Le=J.kind==="branch"||J.kind==="switch"||J.kind==="loop",ut=Vy(J)+(Ie&&!lt?`
|
|
761
|
+
→ `+J.call.component+"."+J.call.method+"()"+(We?" ↴":""):""),Ae=J.kind==="branch"||J.kind==="switch"?"flowcond":J.kind==="loop"?"flowloop":J.kind==="try"?"flowtry":J.kind==="parallel"?"flowfork":J.kind==="return"?"flowend":J.kind==="throw"?"flowthrow":J.kind==="jump"?"flowjumpn":Ie?"flowcall":"flowlocal",Ee=J.kind==="parallel"?xe[J.n]:void 0,Q=W.lane[J.n]||0;q.push({data:{id:ze,label:ut,w:Ee?344*(Ee.arms-1)+320:Le?320:300,h:Ee?16:Ie?58:Le?64:46,tw:Ee?344*(Ee.arms-1)+280:Le?210:280,callComp:Ie?J.call.component:"",callMethod:Ie?J.call.method:""},position:{x:Ee?(Q+(Ee.arms-1)/2)*344:Q*344,y:(je+1)*92},classes:Ae+(We?" drill":"")})}),(W.joins||[]).forEach(function(J){var je=he[J.end]!==void 0?he[J.end]:W.steps.length,ze=W.lane[J.header]||0,Ie=344*(J.arms-1)+320;q.push({data:{id:"n"+J.id,label:"join — all "+J.arms+" arms",w:Ie,h:16,tw:Ie-40},position:{x:(ze+(J.arms-1)/2)*344,y:je*92+46},classes:"flowjoin"})}),(W.detached||[]).forEach(function(J){if(he[J.from]!==void 0){var je=uh(J.comp,J.method);q.push({data:{id:"n"+J.id,label:J.comp+"."+J.method+"()"+(je?" ↴":"")+`
|
|
762
|
+
detached — fire & forget`,w:260,h:52,tw:240,callComp:J.comp,callMethod:J.method},position:{x:(W.lane[J.from]||0)*344+330,y:he[J.from]*92},classes:"flowdetach"+(je?" drill":"")})}}),!L){var De=oh(k.comp,k.method),Ue=lh(k.comp,k.method);!De&&Ue&&(De=Ue.m.description+(Ue.m.returns?" → returns "+Ue.m.returns:"")),q.push({data:{id:"intentNote",label:De||"No narrative or intent recorded for this method.",w:380,h:120,tw:340},position:{x:0,y:120},classes:"flowintent"}),q.push({data:{id:"fe-intent",source:"start",target:"intentNote",lbl:""}})}W.first!==null&&q.push({data:{id:"fe-start",source:"start",target:"n"+W.first,lbl:""}}),W.edges.forEach(function(J,je){var ze=J.kind==="error"?"fErr":J.kind==="back"?"fBack":J.kind==="false"?"fAlt":J.kind==="jump"||J.kind==="finally"?"fJump":J.kind==="case"||J.kind==="default"?"fAlt":J.kind==="fork"?"fFork":J.kind==="join"?"fJoin":J.kind==="detached"?"fDetach":J.kind==="exit"?"fAlt":"";q.push({data:{id:"fe"+je,source:"n"+J.from,target:"n"+J.to,lbl:J.label},classes:ze})});var Se=[{selector:"node",style:{shape:"round-rectangle",width:"data(w)",height:"data(h)",label:"data(label)","text-wrap":"wrap","text-max-width":"data(tw)","font-size":11,"font-family":"Inter, system-ui, sans-serif",color:O.ink,"text-valign":"center","border-width":1.5}},{selector:".flowstart",style:{"background-color":O.stereo.entry.fill,"border-color":O.stereo.entry.stroke,color:O.stereo.entry.text,"font-weight":"bold"}},{selector:".flowlocal",style:{"background-color":O.innerFill,"border-color":O.innerStroke,color:O.innerText}},{selector:".flowcall",style:{"background-color":O.stereo.logic.fill,"border-color":O.stereo.logic.stroke,color:O.stereo.logic.text}},{selector:".flowcond",style:{shape:"round-diamond","background-color":O.stereo.data.fill,"border-color":O.stereo.data.stroke,color:O.stereo.data.text}},{selector:".flowloop",style:{shape:"round-diamond","background-color":O.stereo.adapter.fill,"border-color":O.stereo.adapter.stroke,color:O.stereo.adapter.text}},{selector:".flowtry",style:{"background-color":O.innerFill,"border-color":O.issue,"border-style":"dashed",color:O.innerText}},{selector:".flowend",style:{shape:"round-rectangle","background-color":O.stereo.entry.fill,"border-color":O.stereo.entry.stroke,color:O.stereo.entry.text,"border-width":2.5}},{selector:".flowthrow",style:{shape:"round-rectangle","background-color":O.ghostFill,"border-color":O.issue,color:O.issue,"border-width":2.5}},{selector:".flowjumpn",style:{"background-color":O.ghostFill,"border-color":O.ghostStroke,"border-style":"dotted",color:O.ghostText}},{selector:".flowfork",style:{"background-color":O.ink,"border-color":O.ink,color:O.ink,"text-valign":"top","text-margin-y":-6,"font-weight":"bold"}},{selector:".flowjoin",style:{"background-color":O.ink,"border-color":O.ink,color:O.edgeText,"text-valign":"bottom","text-margin-y":6,"font-size":9.5}},{selector:".flowdetach",style:{"background-color":O.ghostFill,"border-color":O.ghostStroke,"border-style":"dashed",color:O.ghostText,"font-style":"italic"}},{selector:".flowintent",style:{shape:"round-rectangle",width:"label",height:"label",padding:"16px","background-color":O.ghostFill,"border-color":O.ghostStroke,"border-style":"dashed",color:O.innerText,"text-max-width":340,"text-wrap":"wrap","font-size":11.5,"text-valign":"center","text-halign":"center","font-style":"italic"}},{selector:".drill",style:{"border-width":2.5}},{selector:"edge",style:{"curve-style":"bezier",width:1.6,"line-color":O.pageEdge,"target-arrow-shape":"triangle","target-arrow-color":O.pageEdge,label:"data(lbl)","font-size":9.5,color:O.edgeText,"text-background-color":O.bgLabel,"text-background-opacity":.85,"text-rotation":"autorotate"}},{selector:"edge.fAlt",style:{"line-style":"dashed","curve-style":"taxi","taxi-direction":"downward","taxi-turn":-34,"taxi-turn-min-distance":10}},{selector:"edge.fBack",style:{"line-style":"dashed","curve-style":"unbundled-bezier","control-point-distances":[-70],"control-point-weights":[.5]}},{selector:"edge.fErr",style:{"line-style":"dashed","curve-style":"taxi","taxi-direction":"downward","taxi-turn":-34,"taxi-turn-min-distance":10,"line-color":O.issue,"target-arrow-color":O.issue,color:O.issue}},{selector:"edge.fJump",style:{"line-style":"dotted","curve-style":"taxi","taxi-direction":"downward","taxi-turn":-34,"taxi-turn-min-distance":10}},{selector:"edge.fFork",style:{width:2.2}},{selector:"edge.fJoin",style:{width:2.2,"curve-style":"taxi","taxi-direction":"downward","taxi-turn":-34,"taxi-turn-min-distance":10}},{selector:"edge.fDetach",style:{"line-style":"dashed","target-arrow-shape":"vee"}}];jn?(jn.batch(function(){jn.elements().remove(),jn.add(q)}),jn.style(Se)):(jn=Xi({container:u.getElementById("flowCy"),elements:q,style:Se,layout:{name:"preset"},boxSelectionEnabled:!1,autounselectify:!0}),jn.autolock(!0),jn.on("dbltap","node.drill",function(J){var je=J.target.data();Fy(je.callComp,je.callMethod)})),jn.fit(void 0,30)}function Mj(k){switch(k.kind){case"branch":return"◇ if "+(k.cond||k.text)+(k.onFalse!==void 0?" — else → "+k.onFalse:"");case"switch":return"◇ switch on "+(k.on||k.text)+" — "+(k.cases||[]).map(function(j){return j.value+" → "+j.step}).join(", ")+(k.defaultStep!==void 0?", default → "+k.defaultStep:"");case"loop":return"⟳ "+(k.loopKind||"forEach")+(k.over?" "+k.over:"")+(k.cond?" while "+k.cond:"")+(k.end!==void 0?" (body → "+k.end+")":"");case"try":return"⛨ try (body → "+k.end+")"+(k.catches||[]).map(function(j){return" — on "+j.error+" → "+j.step}).join("")+(k.fin!==void 0?" — finally → "+k.fin:"");case"parallel":return"∥ parallel — arms "+(k.branches||[]).map(function(j){return(j.name?j.name+" ":"")+"→ "+j.step}).join(", ")+(k.end!==void 0?" (join after "+k.end+")":"");case"jump":return"↷ → step "+k.to+(k.text?" — "+k.text:"");case"return":return"⏎ return"+(k.outcome?" — "+k.outcome:"")+(k.text?" ("+k.text+")":"");case"throw":return"⚡ throw"+(k.err?" "+k.err:"")+(k.text?" — "+k.text:"");default:return k.text}}function Oj(){var k=hr[hr.length-1],j=fl(k.comp,k.method),L=u.getElementById("flowSteps");if(!j){var O=oh(k.comp,k.method),W=lh(k.comp,k.method),q=['<div class="fstep" style="opacity:.7">No step-by-step narrative — showing intent / contract:</div>'];W&&(q.push('<div class="fstep"><code>'+Ws(W.m.signature)+"</code>"+(W.m.signatureFrom?" from <code>"+Ws(W.m.signatureFrom)+"</code>":"")+"</div>"),q.push('<div class="fstep">'+Ws(W.m.description)+(W.m.returns?" — returns "+Ws(W.m.returns):"")+"</div>")),O&&q.push('<div class="fstep" style="font-style:italic">'+Ws(O)+"</div>"),!W&&!O&&q.push('<div class="fstep">No intent or contract recorded for this method.</div>'),L.innerHTML=q.join("");return}var he=j.steps.map(function(Ue){var Se="";if(Ue.call){var J=uh(Ue.call.component,Ue.call.method);Se=' → <span class="call'+(J?" drillstep":"")+'" data-dc="'+Ue.call.component+'" data-dm="'+Ue.call.method+'">'+Ue.call.component+"."+Ue.call.method+"()"+(J?" ↴":"")+"</span>"+(Ue.detach?' <span style="opacity:.72">⇢ detached — fire & forget</span>':"")}return'<div class="fstep"><span class="num">'+Ue.n+".</span> "+Ws(Mj(Ue))+Se+"</div>"}).join("");L.innerHTML=he;for(var xe=L.querySelectorAll(".drillstep"),De=0;De<xe.length;De++)(function(Ue){Ue.addEventListener("click",function(){Fy(Ue.getAttribute("data-dc"),Ue.getAttribute("data-dm"))})})(xe[De])}function Ws(k){var j=document.createElement("div");return j.textContent=String(k),j.innerHTML}function rc(){Bj(),Uy(),Oj();var k=u.getElementById("flowModal");k.classList&&k.classList[cl==="steps"?"add":"remove"]("steps")}function qy(k,j,L){hr=[{comp:k,method:j}],cl=L||"flow";for(var O=u.getElementById("flowModeSeg"),W=O.querySelectorAll("button"),q=0;q<W.length;q++)W[q].classList&&W[q].classList[W[q].getAttribute("data-fm")===cl?"add":"remove"]("active");var he=u.getElementById("flowModal");he.classList&&he.classList.add("open"),rc(),setTimeout(function(){jn&&(jn.resize(),jn.fit(void 0,30))},60)}function Hy(){var k=u.getElementById("flowModal");k.classList&&(k.classList.remove("open"),k.classList.remove("steps"))}u.getElementById("flowClose").addEventListener("click",Hy),u.getElementById("flowBack").addEventListener("click",function(){hr.length>1&&(hr.pop(),rc())}),u.getElementById("flowErrToggle").addEventListener("click",function(){dl=!dl;var k=u.getElementById("flowErrToggle");k.textContent=dl?"Show error paths":"Hide error paths",hr.length&&(Uy(),jn&&jn.fit(void 0,30))}),function(){for(var k=u.getElementById("flowModeSeg"),j=k.querySelectorAll("button"),L=0;L<j.length;L++)(function(O){O.addEventListener("click",function(){cl=O.getAttribute("data-fm");for(var W=0;W<j.length;W++)j[W].classList&&j[W].classList[j[W]===O?"add":"remove"]("active");rc(),setTimeout(function(){jn&&cl==="flow"&&(jn.resize(),jn.fit(void 0,30))},60)})})(j[L])}();function Wy(){var k=hr[hr.length-1],j=fl(k.comp,k.method)||{steps:[]},L=_y(j);dl&&(L=$y(L));var O=[],W=[];return O.push({id:"start",name:ch()+"()",subsystem:"flow",componentType:"Start",public:!1,owns:[]}),L.steps.forEach(function(q){var he=Vy(q)+(q.call&&!q.detach?" → "+q.call.component+"."+q.call.method+"()":"");O.push({id:"n"+q.n,name:he,subsystem:"flow",componentType:q.kind==="call"||q.kind==="dispatch"||q.kind==="register"?"Call":"Step",public:!1,owns:[]})}),(L.joins||[]).forEach(function(q){O.push({id:"n"+q.id,name:"∥ join — all "+q.arms+" arms",subsystem:"flow",componentType:"Step",public:!1,owns:[]})}),(L.detached||[]).forEach(function(q){O.push({id:"n"+q.id,name:q.comp+"."+q.method+"() — detached",subsystem:"flow",componentType:"Call",public:!1,owns:[]})}),L.first!==null&&W.push({from:"start",to:"n"+L.first,cross:!1}),L.edges.forEach(function(q){W.push({from:"n"+q.from,to:"n"+q.to,cross:q.kind==="error"})}),{system:{name:f.system.name},generatedAt:f.generatedAt,subsystems:[{id:"flow",name:ch()+"()"}],components:O,edges:W}}function Ky(){var k={},j=1/0,L=1/0,O=-1/0,W=-1/0;jn.nodes().forEach(function(he){var xe=he.boundingBox({includeLabels:!1,includeOverlays:!1});k[he.id()]={x:xe.x1,y:xe.y1,w:xe.w,h:xe.h},j=Math.min(j,xe.x1),L=Math.min(L,xe.y1),O=Math.max(O,xe.x2),W=Math.max(W,xe.y2)});var q={flow:{x:j-24,y:L-42,w:O-j+48,h:W-L+66,collapsed:!1}};return{boxes:k,subs:q}}function dh(){return ch().replace(/[^a-zA-Z0-9_.-]/g,"-")+"-flow"}u.getElementById("flowExpPng").addEventListener("click",function(){jn&&Oy(jn,dh()+".png")}),u.getElementById("flowExpDrawio").addEventListener("click",function(){jn&&nc(dh()+".drawio",Jw(Wy(),Ky()),"application/xml")}),u.getElementById("flowExpExcalidraw").addEventListener("click",function(){jn&&nc(dh()+".excalidraw",e1(Wy(),Ky()),"application/json")});var hi=u.getElementById("panel");function Je(k){var j=document.createElement("div");return j.textContent=String(k),j.innerHTML}function Mn(k,j,L){return'<span class="chip" data-kind="'+j+'" data-id="'+Je(L)+'">'+Je(k)+"</span>"}function Pn(k){return'<span class="chip">'+Je(k)+"</span>"}function zj(k){if(!k)return null;for(var j=String(k).toLowerCase(),L=0;L<f.types.length;L++){var O=f.types[L];if(j===O.id.toLowerCase()||j===O.name.toLowerCase())return O.id}for(var W=0;W<f.types.length;W++){var q=f.types[W];if(q.name.length>2&&j.indexOf(q.name.toLowerCase())>=0)return q.id}return null}function Gy(k){var j=zj(k);return j?Mn(k,"type",j):Je(k)}function Rn(k,j,L,O){return"<details open><summary>"+Je(k)+(j!==null?'<span class="count">'+j+"</span>":"")+'</summary><div class="inner">'+L+"</div></details>"}function ac(k){return k.map(function(j){return'<div class="issue '+Je(j.severity)+'"><code>'+Je(j.code)+'</code><span class="sev">'+Je(j.severity)+"</span><br>"+Je(j.message)+"</div>"}).join("")}function fh(){Fe.elements().removeClass("defocus edgeFocus edgeOut edgeIn")}function Yy(k){if(fh(),!(!k||!k.length)){var j=k;k.isParent&&k.isParent()&&(j=j.union(k.descendants()));var L=j.connectedEdges();if(k.isChild&&k.isChild()||(L=L.not(".inneredge")),!!L.length){var O=L.filter(".revealEdge"),W=L.not(".revealEdge"),q=j.union(L).union(L.connectedNodes());q=q.union(q.ancestors()),Fe.elements().addClass("defocus"),q.removeClass("defocus");var he=W.filter(function(De){return j.contains(De.source())&&!j.contains(De.target())}),xe=W.filter(function(De){return j.contains(De.target())&&!j.contains(De.source())});he.addClass("edgeOut").removeClass("defocus"),xe.addClass("edgeIn").removeClass("defocus"),W.not(he).not(xe).addClass("edgeFocus").removeClass("defocus"),O.removeClass("defocus")}}}function Hr(k,j,L){if(k==="type"&&M.view.kind!=="types"&&M.view.kind!=="databases")M.view={kind:"types",id:nh()},nr(!0),ec();else if(k==="component"&&(M.view.kind==="types"||M.view.kind==="databases")){var O=y[j];M.view={kind:"subsystem",id:O?O.subsystem:null},nr(!0),ec()}if(M.selectedKind=k,M.selected=j,Fe.nodes().removeClass("sel"),Fe.edges().removeClass("fieldhl"),j){var W=k==="relation"?Fe.collection():ll(k,j);W.length?(W.addClass("sel"),Yy(W),L&&Fe.animate({center:{eles:W},duration:250})):fh()}else fh();Ks()}function Xy(k,j,L){return L?'<div class="openbtn"><button class="tbtn" data-open-kind="'+k+'" data-open-id="'+Je(j)+'">▸ Open as view</button></div>':""}function hh(k){return(k.interfaces||[]).some(function(j){return(j.methods||[]).some(function(L){return L.endpoint&&L.endpoint.transport==="HTTP"})})}function Qy(){return typeof window>"u"||!/^https?:$/.test(window.location.protocol)?null:window.location.pathname.replace(/\/$/,"")+"/openapi"}function Fj(){return typeof n<"u"&&n&&n.onOpenApi||Qy()!==null}function _j(k){return f.components.some(function(j){return(j.subsystem===k||(j.subsystem||"").indexOf(k+"::")===0)&&hh(j)})}function $j(){return f.components.some(hh)}function vh(k,j){return!k||!Fj()?"":'<div class="openbtn"><button class="tbtn" data-openapi-tag="'+Je(j||"")+'">▤ View OpenAPI ↗</button></div>'}function ph(k,j){return typeof n>"u"||!n||typeof n.onOpenSpec!="function"?"":'<div class="openbtn"><button class="tbtn" data-openspec-kind="'+k+'" data-openspec-id="'+Je(j)+'">✎ Open in Specs ↗</button></div>'}function Ks(){var k="",j="",L=M.selectedKind,O=M.selected,W=!1;if(L||(W=!0,M.view.kind==="subsystem"?(L="subsystem",O=M.view.id):M.view.kind==="component"?(L="component",O=M.view.id):M.view.kind==="types"&&M.view.id&&(L="subsystem",O=M.view.id)),L==="component"&&y[O]){var q=y[O];k="<h2>"+Je(q.name)+"</h2>"+Pn("«"+q.componentType+(q.transport?"/"+q.transport:"")+"»")+(q.public?Pn("published"):"")+(q.status?Pn(q.status):"")+(W?Pn("current view"):"")+Mn(q.subsystem,"subsystem",q.subsystem)+(W?"":Xy("component",q.id,q.owns.length>0))+vh(hh(q),q.id)+ph("component",q.id);var he=f.types.filter(function(re){return re.componentClass===q.id});he.length&&(k+='<div style="margin-top:6px"><b style="font-size:11px">Linked System Entity:</b> '+he.map(function(re){return Mn(re.id,"type",re.id)}).join(" ")+"</div>"),j+='<p class="desc">'+Je(q.description)+"</p>",q.externalLinks&&q.externalLinks.length&&(j+=Rn("External links",q.externalLinks.length,q.externalLinks.map(function(re){var Xe=re.label||re.url,Lt=re.type==="implementation"?Pn("source"):"";return'<div class="method">'+Lt+'<a href="'+Je(re.url)+'" target="_blank" rel="noopener" style="color:var(--accent);word-break:break-all">'+Je(Xe)+" ↗</a></div>"}).join("")));var xe=(q.dependsOn.length?q.dependsOn.map(function(re){return Mn(re,"component",re)}).join(""):'<span class="desc">none</span>')+(q.owns.length?'<div style="margin-top:8px"><b style="font-size:11px">Owns:</b><br>'+q.owns.map(function(re){return Mn(re,"component",re)}).join("")+"</div>":"");j+=Rn("Dependencies",q.dependsOn.length+q.owns.length,xe);var De=0,Ue=q.interfaces.map(function(re){return De+=re.methods.length,'<div style="margin:6px 0 2px"><b>'+Je(re.name)+'</b> <code style="font-size:10.5px;display:inline">'+Je(re.id)+"</code></div>"+re.methods.map(function(Xe){var Lt=!!fl(q.id,Xe.name),Ut=null;return(q.intents||[]).forEach(function(wr){wr.method===Xe.name&&(Ut=wr.text)}),'<div class="method"><div class="mname">'+Je(Xe.name)+'<span class="grow"></span>'+(Lt?'<button class="flowbtn" data-flow-comp="'+Je(q.id)+'" data-flow-method="'+Je(Xe.name)+'" data-flow-mode="flow">flow ◷</button><button class="flowbtn" data-flow-comp="'+Je(q.id)+'" data-flow-method="'+Je(Xe.name)+'" data-flow-mode="steps">steps</button>':Ut?'<span class="chip">intent</span>':'<span class="chip" style="opacity:.6">no narrative</span>')+"</div><code>"+Je(Xe.signature)+"</code>"+(Xe.signatureFrom?'<div class="mdesc">signature from <code style="display:inline">'+Je(Xe.signatureFrom)+"</code></div>":"")+'<div class="mdesc">'+Je(Xe.description)+" — returns "+Gy(Xe.returns)+"</div>"+(Ut&&!Lt?'<div class="mdesc" style="font-style:italic">'+Je(Ut)+"</div>":"")+(Xe.params?'<div class="mdesc">params: '+Xe.params.map(function(wr){return Je(wr.name)+": "+Gy(wr.type)}).join(", ")+"</div>":"")+(Xe.endpoint?"<code>"+Je(JSON.stringify(Xe.endpoint))+"</code>":"")+(Xe.guarantees?'<div style="margin-top:4px">'+Xe.guarantees.map(Pn).join("")+"</div>":"")+"</div>"}).join("")}).join(""),Se=q.narratives.filter(function(re){return!q.interfaces.some(function(Xe){return Xe.methods.some(function(Lt){return Lt.name===re.method})})});Se.length&&(Ue+=Se.map(function(re){return'<div class="method"><div class="mname">'+Je(re.method)+'() <span class="grow"></span><button class="flowbtn" data-flow-comp="'+Je(q.id)+'" data-flow-method="'+Je(re.method)+'" data-flow-mode="flow">flow ◷</button><button class="flowbtn" data-flow-comp="'+Je(q.id)+'" data-flow-method="'+Je(re.method)+'" data-flow-mode="steps">steps</button></div><div class="mdesc">narrative without a contract method</div></div>'}).join("")),(q.interfaces.length||Se.length)&&(j+=Rn("Methods",De+Se.length,Ue));var J=m[q.id];J&&(j+=Rn("Validation issues",J.length,ac(J)))}else if(L==="external"){var je=Fe.getElementById(M.selected),ze=je.length?je.data():null;if(ze){var Ie=y[ze.extId];k="<h2>"+Je(Ie?Ie.name:ze.extId)+"</h2>"+Pn(ze.dir==="in"?"⇠ external caller":"external dependency ⇢")+(Ie?Pn("«"+Ie.componentType+(Ie.transport?"/"+Ie.transport:"")+"»"):"")+(Ie?Mn(Ie.subsystem,"subsystem",Ie.subsystem):""),j+='<p class="desc">'+(ze.dir==="in"?"Lives outside this box and depends on something inside it. The dashed line shows the actual cross-boundary link while this port is selected.":"A dependency of this box’s internals that lives outside it. The dashed line shows the actual cross-boundary link while this port is selected.")+"</p>",Ie&&(j+=Rn("External component",null,Mn(Ie.id,"component",Ie.id)+'<div class="mdesc">'+Je(Ie.description)+"</div>"));var lt=ze.viaKids||[];lt.length&&(j+=Rn(ze.dir==="in"?"Enters through":"Used by (inside this box)",lt.length,lt.map(function(re){return Mn(re.label,re.kind,re.id)}).join("")))}}else if(L==="relation"){var We=String(O).split("|").map(function(re){return et[re]}).filter(Boolean);k="<h2>"+Je(We.length===1?Mt(We[0]):We.length+" relations")+"</h2>"+Pn("relation"),j+=We.map(B).join("")}else if(L==="type"){var Le=null;if(f.types.forEach(function(re){re.id===O&&(Le=re)}),Le){if(k="<h2>"+Je(Le.name)+"</h2>"+Pn("«"+Le.kind+"»")+(Le.subsystem?Mn(Le.subsystem,"subsystem",Le.subsystem):Pn("system-level shared"))+ph("type",Le.id),Le.componentClass&&(k+='<div style="margin-top:6px"><b style="font-size:11px">Class Component:</b> '+Mn(Le.componentClass,"component",Le.componentClass)+"</div>"),Le.database){var ut=Le.database;if(f.system.databases){var Ae=f.system.databases.find(function(re){return re.id===Le.database});Ae&&(ut=Ae.name)}k+='<div style="margin-top:6px"><b style="font-size:11px">Database Table:</b> '+Pn(ut+"."+(Le.table||Le.id))+"</div>"}Le.linkedEntity&&(k+='<div style="margin-top:6px"><b style="font-size:11px">Linked System Entity:</b> '+Mn(Le.linkedEntity,"type",Le.linkedEntity)+"</div>");var Ee=f.types.filter(function(re){return re.linkedEntity===Le.id});Ee.length&&(k+='<div style="margin-top:6px"><b style="font-size:11px">Database Table Mapping:</b> '+Ee.map(function(re){return Mn(re.id,"type",re.id)}).join(" ")+"</div>");var Q=Le.fields.length?Le.fields.map(function(re){var Xe=null;f.typeEdges.forEach(function(Na){!Xe&&Na.from===Le.id&&Na.field===re.name&&(Xe=Na)});var Lt=re.key==="primary"?"PK":re.key==="unique"?"unique":re.key==="foreign"?"FK":"";!Lt&&re.references&&(Lt="FK");var Ut="";if(re.references){var wr=re.references.split(".")[0],vi=f.types.some(function(Na){return Na.id===wr});Ut='<div class="mdesc">References: '+(vi?Mn(re.references,"type",wr):Je(re.references))+"</div>"}else Xe&&(Ut='<div class="mdesc">FK → '+Mn(Xe.to+" ["+(Xe.card||"1")+"]","type",Xe.to)+"</div>");return'<div class="method"><div class="mname">'+Je(re.name)+(Lt?' <span class="chip">'+Lt+"</span>":"")+(re.optional?' <span class="chip" style="opacity:.7">optional</span>':"")+"</div><code>"+Je(re.type)+"</code>"+Ut+"</div>"}).join(""):'<span class="desc">no fields</span>';Le.signature?j+=Rn("Signature",1,'<div class="method"><code>'+Je(Le.signature)+"</code></div>"):Le.holds?j+=Rn("Holds",1,'<div class="method"><code>'+Je(Le.holds)+'</code><div class="mdesc">A named scalar: one '+Je(Le.holds)+" under this name.</div></div>"):Le.values?j+=Rn("Values",Le.values.length,Le.values.length?Le.values.map(function(re){return'<div class="method"><div class="mname">'+Je(re.name)+"</div>"+(re.description?'<div class="mdesc">'+Je(re.description)+"</div>":"")+"</div>"}).join(""):'<span class="desc">no values</span>'):j+=Rn("Fields",Le.fields.length,Q),Le.usedBy&&Le.usedBy.length&&(j+=Rn("Used by methods",Le.usedBy.length,Le.usedBy.map(function(re){return Mn(re.component+"."+re.method+"()","component",re.component)}).join(""))),Le.methods.length&&(j+=Rn("Methods (pure intrinsic)",Le.methods.length,Le.methods.map(function(re){return'<div class="method"><div class="mname">'+Je(re.name)+"</div><code>"+Je(re.signature)+'</code><div class="mdesc">'+Je(re.description||"")+' — returns <code style="display:inline">'+Je(re.returns)+"</code></div></div>"}).join("")));var Ce=f.typeEdges.filter(function(re){return re.from===Le.id}),st=f.typeEdges.filter(function(re){return re.to===Le.id});if(Ce.length||st.length){var ke=(Ce.length?'<div class="mdesc"><b>References:</b></div>'+Ce.map(function(re){return Mn(re.to+" · "+re.field+" ["+(re.card||"1")+"]","type",re.to)}).join(""):"")+(st.length?'<div class="mdesc" style="margin-top:6px"><b>Referenced by:</b></div>'+st.map(function(re){return Mn(re.from+" · "+re.field+" ["+(re.card||"1")+"]","type",re.from)}).join(""):"");j+=Rn("Relations",Ce.length+st.length,ke)}var we=m[Le.id];we&&(j+=Rn("Validation issues",we.length,ac(we)))}}else if(L==="subsystem"&&b[O]){var ge=b[O],tt=N(ge.id).length+P(ge.id).length;k="<h2>"+Je(ge.name)+"</h2>"+Pn("subsystem")+(ge.targetLanguage?Pn(ge.targetLanguage):"")+(ge.status?Pn(ge.status):"")+(W?Pn("current view"):"")+(W?"":Xy("subsystem",ge.id,tt>0))+vh(_j(ge.id),"")+ph("subsystem",ge.id)+(ge.project?Pn(ge.external?"external project":"project"):"")+(ge.storage?Pn(ge.storage):"")+le(ge),j+='<p class="desc">'+Je(ge.description)+"</p>";var xt=Y(ge.id);xt.length?j+=Rn("Relations",xt.length,xt.map(B).join("")):ge.project&&ht&&!$e&&(j+=Rn("Relations",null,'<span class="desc">relation health was not checked</span>')),ge.trustedLinks.length&&(j+=Rn("Trusted links (fast lanes)",ge.trustedLinks.length,ge.trustedLinks.map(function(re){return'<div class="method">'+Mn(re.subsystem,"subsystem",re.subsystem)+'<div class="mdesc">'+Je(re.reason)+"</div></div>"}).join("")));var Rt=N(ge.id);Rt.length&&(j+=Rn("Nested subsystems",Rt.length,Rt.map(function(re){return Mn(re.id,"subsystem",re.id)}).join("")));var In=P(ge.id);j+=Rn("Components",In.length,In.map(function(re){return Mn(re.id,"component",re.id)}).join(""));var on=m[ge.id];on&&(j+=Rn("Validation issues",on.length,ac(on)))}else k="<h2>"+Je(f.system.name)+"</h2>"+(f.system.targetLanguage?Pn(f.system.targetLanguage):"")+Pn(f.subsystems.length+" subsystems")+Pn(f.components.length+" components")+(f.types.length?'<div class="openbtn"><button class="tbtn" id="openTypesBtn">▸ Types (ERD) — '+f.types.length+"</button></div>":"")+vh($j(),""),f.system.vision&&(j+='<p class="desc">'+Je(f.system.vision)+"</p>"),j+='<p class="desc">Each view shows one scope’s direct children — double-click a box (or use “Open as view”) to drill in, and the breadcrumb to come back. Derived from <code style="display:inline">.wai/specs/</code>.</p>',M.showIssues&&f.issues.length&&(j+=Rn("All validation issues",f.issues.length,ac(f.issues)));hi.innerHTML='<div class="head">'+k+'</div><div class="body">'+j+"</div>";for(var Ln=hi.querySelectorAll("[data-kind]"),On=0;On<Ln.length;On++)(function(re){re.addEventListener("click",function(){Hr(re.getAttribute("data-kind"),re.getAttribute("data-id"),!0)}),re.addEventListener("mouseenter",function(){var Xe=ll(re.getAttribute("data-kind"),re.getAttribute("data-id"));Xe.length&&Xe.addClass("hoverhl")}),re.addEventListener("mouseleave",function(){Fe.nodes().removeClass("hoverhl")})})(Ln[On]);for(var Br=hi.querySelectorAll("[data-open-kind]"),Mr=0;Mr<Br.length;Mr++)(function(re){re.addEventListener("click",function(){ja(re.getAttribute("data-open-kind"),re.getAttribute("data-open-id"))})})(Br[Mr]);var na=u.getElementById("openTypesBtn");na&&na.addEventListener&&hi.innerHTML.indexOf("openTypesBtn")>=0&&na.addEventListener("click",function(){ja("types",null)});for(var ue=hi.querySelectorAll("[data-openapi-tag]"),qe=0;qe<ue.length;qe++)(function(re){re.addEventListener("click",function(){var Xe=re.getAttribute("data-openapi-tag")||"";if(typeof n<"u"&&n&&n.onOpenApi){n.onOpenApi(Xe);return}var Lt=Qy();Lt&&window.open(Lt+(Xe?"#/"+Xe:""),"_blank","noopener")})})(ue[qe]);for(var Yt=hi.querySelectorAll("[data-openspec-kind]"),Oe=0;Oe<Yt.length;Oe++)(function(re){re.addEventListener("click",function(){typeof n<"u"&&n&&typeof n.onOpenSpec=="function"&&n.onOpenSpec(re.getAttribute("data-openspec-kind"),re.getAttribute("data-openspec-id")||"")})})(Yt[Oe]);for(var Ne=hi.querySelectorAll("[data-openproject-id]"),gt=0;gt<Ne.length;gt++)(function(re){re.addEventListener("click",function(){typeof n<"u"&&n&&typeof n.onOpenProject=="function"&&n.onOpenProject(re.getAttribute("data-openproject-id"))})})(Ne[gt]);for(var It=hi.querySelectorAll("[data-flow-comp]"),$t=0;$t<It.length;$t++)(function(re){re.addEventListener("click",function(Xe){Xe&&Xe.stopPropagation&&Xe.stopPropagation(),qy(re.getAttribute("data-flow-comp"),re.getAttribute("data-flow-method"),re.getAttribute("data-flow-mode")||"flow")})})(It[$t])}Ks(),function(){if(!(typeof n>"u"||!n)){var k=n.initialFlow,j=n.initialSelect,L=k&&k.comp||j&&j.comp;if(L&&y[L])try{Hr("component",L,!0)}catch{}if(k&&k.comp&&k.method&&y[k.comp])try{qy(k.comp,k.method,k.mode==="steps"?"steps":"flow")}catch{}}}();try{var us=t.__waironLastSel;if(us&&typeof Hr=="function"){var Vj=us.kind==="component"&&typeof y<"u"&&y[us.id]||us.kind==="subsystem"&&typeof b<"u"&&b[us.id];Vj&&Hr(us.kind,us.id,!1)}}catch{}return{destroy(){try{typeof M<"u"&&M&&M.selectedKind&&M.selected?t.__waironLastSel={kind:M.selectedKind,id:M.selected}:delete t.__waironLastSel}catch{}try{typeof Fe<"u"&&Fe&&Fe.destroy()}catch{}a.innerHTML=""},setTheme(k,j){var L=k==="light"?"light":"syw";typeof M<"u"&&M&&(M.theme=L),s.setAttribute("data-theme",L),j!==void 0&&l(j);try{typeof Fe<"u"&&Fe&&Fe.style(it(at[L])),typeof ce=="function"&&ce(),typeof Te=="function"&&Te()}catch{}},openRoute(k){try{typeof Sy=="function"&&Sy(k)}catch{}}}}function LM(t){const e=new Map(t.nodes.map(v=>[v.id,v.kind])),n=v=>v.replace(/\./g,"::"),r=v=>v.projectId??v.id.replace(/^project:/,""),a=t.nodes.filter(v=>v.kind==="unit"),i=t.nodes.filter(v=>v.kind==="project"),s=new Map(i.map(v=>[v.id,v])),o=new Map;for(const v of t.edges)e.get(v.from)==="unit"&&e.get(v.to)==="project"&&(!o.has(v.to)||v.edgeKind==="owns")&&o.set(v.to,v.from);const l=a.map(v=>({id:n(v.id),name:v.actionable===!1?v.label+" ◇":v.label,description:v.actionable===!1?"Organization unit (browse-only — shown as the path to a scope you can act on)":"Organization unit",trustedLinks:[],deepInternals:!0}));i.some(v=>!o.has(v.id))&&l.push({id:"__unassigned__",name:"(unassigned)",description:"Projects not placed in a unit",trustedLinks:[],deepInternals:!0});const d=new Map,f=[];for(const v of t.edges){if(e.get(v.from)!=="project"||e.get(v.to)!=="project")continue;const p=r(s.get(v.from)),y=r(s.get(v.to));(d.get(p)??d.set(p,[]).get(p)).push(y),f.push({from:p,to:y,cross:o.get(v.from)!==o.get(v.to)})}const h=i.map(v=>{const p=o.get(v.id),y=r(v);return{id:y,name:v.label,description:v.status?"Project · "+v.status:"Project",subsystem:p?n(p):"__unassigned__",componentType:"project",public:!1,owns:[],dependsOn:d.get(y)??[],interfaces:[],narratives:[],intents:[]}});return{system:{name:"Environment",diagram:{defaultView:"architecture",showDatabases:!1}},generatedAt:new Date().toISOString(),subsystems:l,components:h,edges:f,types:[],typeEdges:[],dataEdges:[],issues:[]}}function cj({initialUnitRoute:t=""}){const e=St(()=>Et("/web/graph?tier=landscape&level=1"),[],["landscape"]),{themeId:n,appearance:r,customThemes:a}=Ou(),i=Pr(),s=pC(r),o=A.useMemo(()=>gC(n,r,a),[n,r,a]),l=A.useRef(null),u=A.useRef(null),d=e.data,f=p=>{if(!p)return"";if(p==="unassigned")return"__unassigned__";const y=p.split("/");return y[0]==="types"||y[0]==="databases"?p:(y[0]="unit:"+y[0],y.map(encodeURIComponent).join("/"))},h=A.useRef(f(t)),v=A.useRef(t);return v.current=t,A.useEffect(()=>{const p=l.current;if(!p||!d||d.nodes.length===0)return;h.current=f(v.current);const y=new Map(d.nodes.map(S=>[S.id,S.kind])),b=S=>S.projectId??S.id.replace(/^project:/,""),m=new Set(d.nodes.filter(S=>S.kind==="project").map(b)),g=new Map;for(const S of d.edges)y.get(S.from)==="unit"&&y.get(S.to)==="project"&&(!g.has(S.to)||S.edgeKind==="owns")&&g.set(S.to,S.from);const w=new Map;for(const S of d.nodes){if(S.kind!=="project")continue;const C=g.get(S.id);C&&w.set(b(S),C.replace(/^unit:/,""))}const x=new Set(d.nodes.filter(S=>S.kind==="project"&&S.actionable!==!1).map(b)),E=uj(p,LM(d),{shadow:!0,theme:s,vars:o,embed:!0,initialRoute:f(v.current),onViewChange:S=>{const C=S.split("/").map(decodeURIComponent);if(C[0]&&m.has(C[0]))return;let T="";C[0]==="__unassigned__"?T="unassigned":C[0]&&(C[0].startsWith("unit:")&&(C[0]=C[0].slice(5)),T=C.map(encodeURIComponent).join("/"));const N="/canvas"+(T?"/"+T:"");h.current=S,N!==window.location.pathname&&i(N)},onNodeOpen:(S,C)=>{if(!x.has(C))return;const T=w.get(C),N=T?T.split(".").map(encodeURIComponent).join("/")+"/":"";i("/canvas/"+N+encodeURIComponent(C))}});return u.current=E,()=>{E.destroy(),u.current=null}},[d]),A.useEffect(()=>{var y;const p=f(t);p!==h.current&&(h.current=p,(y=u.current)==null||y.openRoute(p))},[t]),A.useEffect(()=>{var p;(p=u.current)==null||p.setTheme(s,o)},[s,o]),c.jsx(Xt,{state:e,children:p=>p.nodes.length===0?c.jsx("div",{className:"empty-state",children:"No organization units or projects in your scope yet."}):c.jsx("div",{ref:l,className:"canvas-host"})})}function AM(){const[t]=RP(),e=t.get("project")??t.get("projectId"),n=Pr();return A.useEffect(()=>{e&&n("/canvas/"+encodeURIComponent(e),{replace:!0})},[e,n]),e?null:c.jsx(cj,{})}function DM(t,e){const n=[{key:"instance:",kind:"instance",id:"",label:"Instance (everywhere)"}];for(const r of[...t].sort((a,i)=>a.id.localeCompare(i.id)))n.push({key:`unit:${r.id}`,kind:"unit",id:r.id,label:`Unit · ${r.name} (${r.id})`});for(const r of[...e].sort((a,i)=>a.id.localeCompare(i.id)))n.push({key:`project:${r.id}`,kind:"project",id:r.id,label:`Project · ${r.id}`});return n}function ef(t,e){return t==="instance"?"instance":`${t}:${e??""}`}function BM(t){var f,h;const e=Dt(),[n,r]=A.useState(((f=t.roles[0])==null?void 0:f.id)??""),[a,i]=A.useState(((h=t.scopes[0])==null?void 0:h.key)??"instance:"),s=t.user.roleBindings??[],o=v=>{var p;return((p=t.roles.find(y=>y.id===v))==null?void 0:p.name)??v},l=t.scopes.find(v=>v.key===a)??t.scopes[0];async function u(){n&&(await yt("/web/admin/roles/bind",{userId:t.user.id,roleId:n,scopeKind:l.kind,scopeId:l.kind==="instance"?void 0:l.id}),e.ok(`Assigned “${o(n)}” at ${ef(l.kind,l.id)}`),t.onChanged())}async function d(v){await yt("/web/admin/roles/unbind",{userId:t.user.id,roleId:v.roleId,scopeKind:v.scopeKind??"instance",scopeId:v.scopeId}),e.ok("Role removed"),t.onChanged()}return c.jsxs("div",{className:"stack-lg",children:[c.jsxs("div",{className:"panel",children:[c.jsx("h4",{children:"Current roles"}),s.length===0?c.jsx("p",{className:"hint",children:"No roles assigned. Roles grant capabilities at the scope you bind them to."}):c.jsx(Vn,{rowKey:v=>`${v.roleId}@${v.scopeKind??"instance"}:${v.scopeId??""}`,rows:s,columns:[{key:"role",header:"Role",cell:v=>c.jsx("strong",{children:o(v.roleId)})},{key:"scope",header:"Scope",cell:v=>c.jsx("code",{children:ef(v.scopeKind??"instance",v.scopeId)})},{key:"act",header:"",width:"1%",cell:v=>c.jsx(Tt,{size:"sm",variant:"ghost",action:()=>d(v),onError:e.bad,children:"Remove"})}]})]}),c.jsxs("div",{className:"panel",children:[c.jsx("h4",{children:"Assign a role"}),c.jsxs("div",{className:"row-form",children:[c.jsx(X,{label:"Role",children:c.jsx(en,{value:n,onChange:r,options:t.roles.map(v=>({value:v.id,label:v.name}))})}),c.jsx(X,{label:"Scope",children:c.jsx(en,{value:a,onChange:i,options:t.scopes.map(v=>({value:v.key,label:v.label}))})}),c.jsx("div",{className:"row-form-action",children:c.jsx(Tt,{variant:"primary",action:u,onError:e.bad,disabled:!n,children:"Assign"})})]})]})]})}function MM(t){var p,y;const e=Dt(),n=St(()=>Et(`/web/admin/permissions?subjectKind=user&subjectId=${encodeURIComponent(t.user.id)}`),[t.user.id]),[r,a]=A.useState(((p=t.scopes[0])==null?void 0:p.key)??"instance:"),[i,s]=A.useState(Ts[0]),[o,l]=A.useState("yes"),u=t.scopes.find(b=>b.key===r)??t.scopes[0];async function d(){await yt("/web/admin/permissions",{subjectKind:"user",subjectId:t.user.id,scopeKind:u.kind,scopeId:u.kind==="instance"?void 0:u.id,capability:i,value:o}),e.ok(`${i} = ${o} at ${ef(u.kind,u.id)}`),n.reload()}async function f(b){await yt("/web/admin/permissions/remove",{id:b}),e.ok("Override removed"),n.reload()}const h=(y=t.user.subject)==null?void 0:y.userId,v=!!h&&h!==t.user.id;return c.jsxs("div",{className:"stack-lg",children:[c.jsxs("p",{className:"hint",children:["Direct overrides win over roles for this user. Use them to grant or explicitly deny a single capability at one scope — ",c.jsx("code",{children:"no"})," denies even when a role would allow."]}),v&&c.jsxs("p",{className:"hint",children:["Grid key: ",c.jsx("code",{children:h})," (this user's record id ",c.jsx("code",{children:t.user.id})," differs; assignments are keyed canonically by the subject id)."]}),c.jsx(Xt,{state:n,children:b=>c.jsx(Vn,{rowKey:m=>m.id,empty:"No direct overrides — this user's access comes entirely from roles.",rows:b.assignments,columns:[{key:"cap",header:"Capability",cell:m=>c.jsx("code",{children:m.capability})},{key:"scope",header:"Scope",cell:m=>c.jsx("code",{children:ef(m.scopeKind,m.scopeId)})},{key:"val",header:"Value",cell:m=>c.jsx(OM,{value:m.value})},{key:"act",header:"",width:"1%",cell:m=>c.jsx(Tt,{size:"sm",variant:"ghost",action:()=>f(m.id),onError:e.bad,children:"Remove"})}]})}),c.jsxs("div",{className:"panel",children:[c.jsx("h4",{children:"Add / change an override"}),c.jsxs("div",{className:"row-form",children:[c.jsx(X,{label:"Scope",children:c.jsx(en,{value:r,onChange:a,options:t.scopes.map(b=>({value:b.key,label:b.label}))})}),c.jsx(X,{label:"Capability",children:c.jsx(en,{value:i,onChange:s,options:Ts.map(b=>({value:b,label:b}))})}),c.jsx(X,{label:"Value",children:c.jsx(en,{value:o,onChange:l,options:vC.map(b=>({value:b,label:b}))})}),c.jsx("div",{className:"row-form-action",children:c.jsx(Tt,{variant:"primary",action:d,onError:e.bad,children:"Apply"})})]})]})]})}function OM(t){const e=t.value==="yes"?"ok":t.value==="no"?"bad":t.value==="approval"?"warn":"neutral";return c.jsx(rt,{tone:e,children:t.value})}function zM(t){const[e,n]=A.useState("roles");return c.jsxs($n,{wide:!0,title:`Access · ${Ns(t.user)}`,onClose:t.onClose,footer:c.jsx(ct,{onClick:t.onClose,children:"Done"}),children:[c.jsx(jf,{active:e,onSelect:n,tabs:[{id:"roles",label:"Roles"},{id:"permissions",label:"Direct permissions"}]}),c.jsx("div",{className:"tab-panel",children:e==="roles"?c.jsx(BM,{user:t.user,roles:t.roles,scopes:t.scopes,onChanged:t.onChanged}):c.jsx(MM,{user:t.user,scopes:t.scopes})})]})}function FM(){var h,v;const t=Dt(),e=St(()=>Et("/web/admin/users"),[],["users"]),n=St(()=>Et("/web/admin/roles"),[],["roles"]),r=St(()=>Et("/web/admin/org/units"),[]),a=St(()=>Et("/web/projects"),[]),[i,s]=A.useState(null),o=i?((h=e.data)==null?void 0:h.users.find(p=>p.id===i))??null:null,l=A.useMemo(()=>{var p,y;return DM(((p=r.data)==null?void 0:p.units)??[],((y=a.data)==null?void 0:y.projects)??[])},[r.data,a.data]),u=((v=n.data)==null?void 0:v.roles)??[],d=p=>{var y,b;return p?((b=(y=r.data)==null?void 0:y.units.find(m=>m.id===p))==null?void 0:b.name)??p:"—"};async function f(p,y){await yt("/web/admin/users/status",{userId:p.id,status:y}),t.ok(`${Ns(p)} → ${y}`),e.reload()}return c.jsxs("div",{className:"view-pad",children:[c.jsxs("div",{className:"view-head",children:[c.jsxs("div",{children:[c.jsx("h2",{children:"Users"}),c.jsx("p",{className:"hint",children:"People with accounts on this instance. Assign roles and per-scope permission overrides here."})]}),c.jsx(ct,{variant:"ghost",onClick:e.reload,children:"Refresh"})]}),c.jsx(Xt,{state:e,children:p=>c.jsx(Vn,{rowKey:y=>y.id,empty:"No users yet. Users are provisioned when they first sign in via SSO.",rows:p.users,columns:[{key:"name",header:"User",cell:y=>{var b,m;return c.jsxs("div",{className:"cell-stack",children:[c.jsx("strong",{children:Ns(y)}),y.email&&c.jsx("span",{className:"hint",children:y.email}),c.jsxs("code",{className:"subtle",children:[(b=y.subject)==null?void 0:b.issuer,":",(m=y.subject)==null?void 0:m.kind]})]})}},{key:"status",header:"Status",cell:y=>c.jsx(rt,{tone:y.status==="active"?"ok":"neutral",children:y.status})},{key:"unit",header:"Home unit",cell:y=>c.jsx("span",{children:d(y.unitId)})},{key:"roles",header:"Roles",cell:y=>(y.roleBindings??[]).length===0?c.jsx("span",{className:"hint",children:"none"}):c.jsx("div",{className:"chip-row",children:(y.roleBindings??[]).map((b,m)=>{var g;return c.jsxs(rt,{tone:"accent",children:[((g=u.find(w=>w.id===b.roleId))==null?void 0:g.name)??b.roleId,b.scopeKind&&b.scopeKind!=="instance"?` · ${b.scopeId}`:""]},m)})})},{key:"act",header:"",width:"1%",cell:y=>c.jsxs("div",{className:"row-actions",children:[c.jsx(ct,{size:"sm",variant:"primary",onClick:()=>s(y.id),children:"Manage access"}),y.status==="active"?c.jsx(li,{label:"Deactivate",title:"Deactivate user",message:`Deactivate ${Ns(y)}? They keep their audit history but can no longer act.`,confirmLabel:"Deactivate",action:()=>f(y,"inactive"),onError:t.bad}):c.jsx(Tt,{size:"sm",action:()=>f(y,"active"),onError:t.bad,children:"Reactivate"})]})}]})}),o&&c.jsx(zM,{user:o,roles:u,scopes:l,onClose:()=>s(null),onChanged:e.reload})]})}const _M=["inherit","approval","yes"];function t1(t){return t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function n1(t){var d,f;const e=Dt(),n=t.mode==="edit",[r,a]=A.useState(((d=t.existing)==null?void 0:d.name)??""),[i,s]=A.useState(((f=t.existing)==null?void 0:f.description)??""),[o,l]=A.useState(()=>{var v;const h=Object.fromEntries(Ts.map(p=>[p,"inherit"]));for(const p of((v=t.existing)==null?void 0:v.permissions)??[])h[p.capability]=p.value;return h});async function u(){const h=Ts.filter(p=>o[p]!=="inherit").map(p=>({capability:p,value:o[p]})),v=n?{...t.existing,name:r,description:i,permissions:h}:{id:t1(r),name:r,description:i,permissions:h};await yt(n?"/web/admin/roles/update":"/web/admin/roles",v),e.ok(n?"Role updated":`Role “${r}” created`),t.onSaved(),t.onClose()}return c.jsx($n,{title:n?`Edit role · ${t.existing.name}`:"New role",onClose:t.onClose,footer:c.jsxs(c.Fragment,{children:[c.jsx(ct,{variant:"ghost",onClick:t.onClose,children:"Cancel"}),c.jsx(Tt,{variant:"primary",action:u,onError:e.bad,disabled:!r,children:n?"Save":"Create"})]}),children:c.jsxs("div",{className:"stack-lg",children:[c.jsx(X,{label:"Name",children:c.jsx(Be,{value:r,onChange:a,placeholder:"Project owner"})}),!n&&c.jsx(X,{label:"Id (computed)",children:c.jsx("code",{className:"preview-id",children:t1(r)||"—"})}),c.jsx(X,{label:"Description",children:c.jsx(Be,{value:i,onChange:s,placeholder:"Full control of assigned projects"})}),c.jsxs("div",{className:"panel",children:[c.jsx("h4",{children:"Granted capabilities"}),c.jsx("p",{className:"hint",children:"Roles grant only — leave a capability on “inherit” to not confer it."}),Ts.map(h=>c.jsxs("div",{className:"row-form",children:[c.jsx("code",{className:"cap-name",children:h}),c.jsx(en,{value:o[h],onChange:v=>l(p=>({...p,[h]:v})),options:_M.map(v=>({value:v,label:v}))})]},h))]})]})})}function $M(){const t=Dt(),e=St(()=>Et("/web/admin/roles"),[],["roles"]),[n,r]=A.useState(!1),[a,i]=A.useState(null);async function s(o){await yt("/web/admin/roles/remove",{id:o}),t.ok("Role deleted"),e.reload()}return c.jsxs("div",{className:"view-pad",children:[c.jsxs("div",{className:"view-head",children:[c.jsxs("div",{children:[c.jsx("h2",{children:"Roles"}),c.jsx("p",{className:"hint",children:"Reusable permission templates. Assign them to users per scope from the Users page."})]}),c.jsx(ct,{variant:"primary",onClick:()=>r(!0),children:"+ New role"})]}),c.jsx(Xt,{state:e,children:o=>c.jsx(Vn,{rowKey:l=>l.id,rows:o.roles,columns:[{key:"name",header:"Role",cell:l=>c.jsxs("div",{className:"cell-stack",children:[c.jsxs("strong",{children:[l.name," ",l.builtin&&c.jsx(rt,{tone:"accent",children:"built-in"})]}),l.description&&c.jsx("span",{className:"hint",children:l.description}),c.jsx("code",{className:"subtle",children:l.id})]})},{key:"perms",header:"Grants",cell:l=>l.permissions.length===0?c.jsx("span",{className:"hint",children:"none"}):c.jsx("div",{className:"chip-row",children:l.permissions.map(u=>c.jsxs(rt,{tone:u.value==="yes"?"ok":"warn",children:[u.capability,"=",u.value]},u.capability))})},{key:"act",header:"",width:"1%",cell:l=>l.builtin?c.jsx("span",{className:"hint",children:"locked"}):c.jsxs("div",{className:"row-actions",children:[c.jsx(ct,{size:"sm",variant:"ghost",onClick:()=>i(l),children:"Edit"}),c.jsx(li,{label:"Delete",title:"Delete role",message:`Delete role “${l.name}”? Existing bindings to it become inert.`,action:()=>s(l.id),onError:t.bad})]})}]})}),n&&c.jsx(n1,{mode:"create",onClose:()=>r(!1),onSaved:e.reload}),a&&c.jsx(n1,{mode:"edit",existing:a,onClose:()=>i(null),onSaved:e.reload})]})}function VM(t,e){const n=[{key:"instance:",kind:"instance",id:"",label:"Instance (everywhere)"}];for(const r of[...t].sort((a,i)=>a.id.localeCompare(i.id)))n.push({key:`unit:${r.id}`,kind:"unit",id:r.id,label:`Unit · ${r.name} (${r.id})`});for(const r of[...e].sort((a,i)=>a.id.localeCompare(i.id)))n.push({key:`project:${r.id}`,kind:"project",id:r.id,label:`Project · ${r.id}`});return n}function tf(t,e){if(t==="instance")return"instance";if(t==="subsystem"){const n=(e??"").indexOf("/");return n>0?`Subsystem · ${(e??"").slice(0,n)} › ${(e??"").slice(n+1)}`:`subsystem:${e??""}`}return`${t}:${e??""}`}const r1=["inherit","yes","no"];function UM(t){return St(()=>t?Et(`/web/graph?tier=project&projectId=${encodeURIComponent(t)}&level=1`).then(e=>e.nodes.filter(n=>n.kind==="subsystem"&&!n.id.includes("::")).map(n=>n.id).sort()).catch(()=>[]):Promise.resolve([]),[t])}function qM(t){const e={"instance-admin":"the instance-admin bypass",user:"a user setting",role:"a role","everyone-default":"the everyone-default","instance-default":"the instance default"}[t.source];return t.source==="instance-admin"||t.source==="instance-default"||!t.decidedScopeKind?e:`${e} at ${tf(t.decidedScopeKind,t.decidedScopeId)}`}function HM(t,e){return t.find(n=>{var r;return((r=n.subject)==null?void 0:r.userId)===e})??t.find(n=>n.id===e)}function WM(t){var i;const e=t.assignment;if(e.subjectKind==="everyone")return c.jsxs("div",{className:"cell-stack",children:[c.jsx("strong",{children:"Everyone"}),c.jsx("span",{className:"hint",children:"scope default"})]});const n=e.subjectId??"",r=HM(t.users,n),a=!!r&&((i=r.subject)==null?void 0:i.userId)!==n;return c.jsxs("div",{className:"cell-stack",children:[c.jsx("strong",{children:r?Ns(r):"Unknown subject"}),c.jsx("code",{className:"subtle",children:n}),a&&c.jsx(rt,{tone:"warn",children:"legacy key"})]})}function dj(t){const e=t.value==="yes"?"ok":t.value==="no"?"bad":t.value==="approval"?"warn":"neutral";return c.jsx(rt,{tone:e,children:t.value})}function KM(t){var N,P;const e=Dt(),[n,r]=A.useState("user"),[a,i]=A.useState(""),s=a||(((N=t.users[0])==null?void 0:N.id)??""),[o,l]=A.useState(((P=t.scopes[0])==null?void 0:P.key)??"instance:"),[u,d]=A.useState(""),[f,h]=A.useState(Ts[0]),[v,p]=A.useState("yes"),[y,b]=A.useState(null),m=t.scopes.find(R=>R.key===o)??t.scopes[0],g=UM(m.kind==="project"?m.id:null),w=m.kind==="project"&&u!=="",x=w?{kind:"subsystem",id:`${m.id}/${u}`}:{kind:m.kind,id:m.id},E=w?"project:write":f,S=w&&!r1.includes(v)?"yes":v;async function C(){await yt("/web/admin/permissions",{subjectKind:n,...n==="user"?{subjectId:s}:{},scopeKind:x.kind,scopeId:x.kind==="instance"?void 0:x.id,capability:E,value:S}),e.ok(`${n==="everyone"?"Everyone":"User"}: ${E} = ${S} at ${tf(x.kind,x.id)}`),t.onSaved()}async function T(){const R=new URLSearchParams({userId:s,capability:E,scopeKind:x.kind,scopeId:x.id});b(await Et(`/web/admin/permissions/explain?${R.toString()}`))}return c.jsxs("div",{className:"panel",children:[c.jsx("h4",{children:"Set an assignment"}),c.jsx("p",{className:"hint",children:"One cell of the grid: subject × scope × capability → value. “Everyone” sets the scope's default for all users; a direct user row wins over roles and defaults at the same scope."}),c.jsxs("div",{className:"row-form",children:[c.jsx(X,{label:"Subject",children:c.jsx(en,{value:n,onChange:R=>r(R),options:[{value:"user",label:"A user"},{value:"everyone",label:"Everyone (scope default)"}]})}),n==="user"&&c.jsx(X,{label:"User",children:c.jsx(en,{value:s,onChange:i,options:t.users.map(R=>({value:R.id,label:Ns(R)}))})}),c.jsx(X,{label:"Scope",children:c.jsx(en,{value:o,onChange:R=>{l(R),d(""),b(null)},options:t.scopes.map(R=>({value:R.key,label:R.label}))})}),m.kind==="project"&&c.jsx(X,{label:"Subsystem",children:c.jsx(en,{value:u,onChange:R=>{d(R),b(null)},options:[{value:"",label:"(the whole project)"},...(g.data??[]).map(R=>({value:R,label:`Subsystem · ${m.id} › ${R}`}))]})}),c.jsx(X,{label:"Capability",children:c.jsx(en,{value:E,onChange:R=>{h(R),b(null)},options:(w?["project:write"]:Ts).map(R=>({value:R,label:R}))})}),c.jsx(X,{label:"Value",children:c.jsx(en,{value:S,onChange:R=>p(R),options:(w?r1:vC).map(R=>({value:R,label:R}))})}),c.jsxs("div",{className:"row-form-action",children:[c.jsx(Tt,{variant:"primary",action:C,onError:e.bad,disabled:n==="user"&&!s,children:"Apply"}),n==="user"&&c.jsx(Tt,{variant:"ghost",action:T,onError:e.bad,disabled:!s,children:"Check"})]})]}),y&&c.jsxs("p",{className:"hint",children:["Effective ",c.jsx("code",{children:E})," at ",tf(x.kind,x.id),":"," ",c.jsx(dj,{value:y.value})," — decided by ",qM(y),".",y.scopeNote&&c.jsx(rt,{tone:"warn",children:y.scopeNote})]})]})}function GM(){var y;const t=Dt(),e=St(()=>Et("/web/admin/permissions"),[],["roles","users"]),n=St(()=>Et("/web/admin/users"),[],["users"]),r=St(()=>Et("/web/admin/org/units"),[],["units"]),a=St(()=>Et("/web/projects"),[],["projects"]),[i,s]=A.useState("all"),[o,l]=A.useState("all"),u=((y=n.data)==null?void 0:y.users)??[],d=A.useMemo(()=>{var b,m;return VM(((b=r.data)==null?void 0:b.units)??[],((m=a.data)==null?void 0:m.projects)??[])},[r.data,a.data]),f=A.useMemo(()=>{var m;return(((m=e.data)==null?void 0:m.assignments)??[]).filter(g=>{var w;if(i!=="all"){const x=d.find(E=>E.key===i);if(!x||g.scopeKind!==x.kind||(g.scopeId??"")!==x.id)return!1}if(o==="everyone"){if(g.subjectKind!=="everyone")return!1}else if(o!=="all"){if(g.subjectKind!=="user")return!1;const x=u.find(S=>S.id===o);if(!new Set([o,(w=x==null?void 0:x.subject)==null?void 0:w.userId].filter(Boolean)).has(g.subjectId??""))return!1}return!0})},[e.data,i,o,d,u]),h=A.useMemo(()=>{var b;return(((b=e.data)==null?void 0:b.assignments)??[]).filter(m=>m.subjectKind==="everyone")},[e.data]);async function v(b){await yt("/web/admin/permissions/remove",{id:b}),t.ok("Assignment removed"),e.reload()}const p=[{key:"subject",header:"Subject",cell:b=>c.jsx(WM,{assignment:b,users:u})},{key:"scope",header:"Scope",cell:b=>c.jsxs("div",{className:"cell-stack",children:[c.jsx("code",{children:tf(b.scopeKind,b.scopeId)}),b.scopeNote&&c.jsx(rt,{tone:"warn",children:b.scopeNote})]})},{key:"cap",header:"Capability",cell:b=>c.jsx("code",{children:b.capability})},{key:"val",header:"Value",cell:b=>c.jsx(dj,{value:b.value})},{key:"act",header:"",width:"1%",cell:b=>c.jsx(Tt,{size:"sm",variant:"ghost",action:()=>v(b.id),onError:t.bad,children:"Remove"})}];return c.jsxs("div",{className:"view-pad",children:[c.jsxs("div",{className:"view-head",children:[c.jsxs("div",{children:[c.jsx("h2",{children:"Permissions"}),c.jsx("p",{className:"hint",children:"The assignment grid: subject × scope × capability → value. Resolution walks the target's ancestor chain leaf→root and stops at the nearest decisive scope; within a scope, direct user > role > everyone-default."})]}),c.jsx(ct,{variant:"ghost",onClick:e.reload,children:"Refresh"})]}),c.jsx(KM,{users:u,scopes:d,onSaved:e.reload}),c.jsxs("div",{className:"panel",children:[c.jsx("h4",{children:"Scope defaults (everyone)"}),c.jsxs("p",{className:"hint",children:["What every authenticated user gets at a scope unless a nearer decision applies. No defaults means the instance root falls back to ",c.jsx("code",{children:"no"})," for non-admins."]}),c.jsx(Xt,{state:e,children:()=>c.jsx(Vn,{rowKey:b=>b.id,empty:"No scope defaults set — access comes entirely from roles and direct user assignments.",rows:h,columns:p.filter(b=>b.key!=="subject")})})]}),c.jsxs("div",{className:"panel",children:[c.jsxs("div",{className:"view-head",children:[c.jsx("h4",{children:"All assignments"}),c.jsxs("div",{className:"row-form",children:[c.jsx(X,{label:"Scope",children:c.jsx(en,{value:i,onChange:s,options:[{value:"all",label:"All scopes"},...d.map(b=>({value:b.key,label:b.label}))]})}),c.jsx(X,{label:"Subject",children:c.jsx(en,{value:o,onChange:l,options:[{value:"all",label:"All subjects"},{value:"everyone",label:"Everyone (defaults)"},...u.map(b=>({value:b.id,label:Ns(b)}))]})})]})]}),c.jsx(Xt,{state:e,children:()=>c.jsx(Vn,{rowKey:b=>b.id,empty:"No assignments match the filter.",rows:f,columns:p})})]})]})}function YM(t,e){let n=t;if(e){const s=new Set([e]);let o=!0;for(;o;){o=!1;for(const l of t)l.parentId&&s.has(l.parentId)&&!s.has(l.id)&&(s.add(l.id),o=!0)}n=t.filter(l=>!s.has(l.id))}const r=new Map;for(const s of n)r.set(s.id,{unit:s,children:[]});const a=[];for(const s of r.values()){const o=s.unit.parentId?r.get(s.unit.parentId):void 0;o?o.children.push(s):a.push(s)}const i=s=>{s.sort((o,l)=>(o.unit.slug||o.unit.name).localeCompare(l.unit.slug||l.unit.name)),s.forEach(o=>i(o.children))};return i(a),a}function Xu(t){const{units:e,value:n,onChange:r,placeholder:a="Select a unit…",allowEmpty:i=!0,emptyLabel:s="(none)",excludeSubtreeOf:o,disabled:l}=t,[u,d]=A.useState(!1),[f,h]=A.useState(""),[v,p]=A.useState(new Set),y=A.useRef(null),b=A.useMemo(()=>YM(e,o),[e,o]),m=e.find(T=>T.id===n);A.useEffect(()=>{if(!u)return;function T(P){y.current&&!y.current.contains(P.target)&&d(!1)}function N(P){P.key==="Escape"&&(d(!1),P.stopPropagation())}return document.addEventListener("mousedown",T),document.addEventListener("keydown",N,!0),()=>{document.removeEventListener("mousedown",T),document.removeEventListener("keydown",N,!0)}},[u]);function g(T){p(N=>{const P=new Set(N);return P.has(T)?P.delete(T):P.add(T),P})}function w(T){r(T),d(!1),h("")}const x=f.trim().toLowerCase(),E=T=>!x||T.name.toLowerCase().includes(x)||T.id.toLowerCase().includes(x),S=T=>E(T.unit)||T.children.some(S);function C(T,N){const P=[];for(const R of T){if(x&&!S(R))continue;const I=R.children.length>0,D=v.has(R.unit.id)&&!x;P.push(c.jsxs("div",{className:`unitsel-row ${R.unit.id===n?"sel":""}`,style:{paddingLeft:6+N*18},children:[c.jsx("button",{type:"button",className:"unitsel-twist",onClick:$=>{$.stopPropagation(),I&&g(R.unit.id)},"aria-label":I?D?"Expand":"Collapse":void 0,children:I?D?"▸":"▾":"·"}),c.jsxs("button",{type:"button",className:"unitsel-label",onClick:()=>w(R.unit.id),children:[c.jsx("span",{className:"unitsel-name",children:R.unit.name}),c.jsx("span",{className:"unitsel-kind",children:R.unit.kind}),c.jsx("code",{className:"unitsel-id",children:R.unit.id})]})]},R.unit.id)),I&&!D&&P.push(...C(R.children,N+1))}return P}return c.jsxs("div",{className:"unitsel",ref:y,children:[c.jsxs("button",{type:"button",className:"input unitsel-trigger",disabled:l,"aria-expanded":u,onClick:()=>d(T=>!T),children:[m?c.jsxs("span",{className:"unitsel-current",children:[c.jsx("span",{className:"unitsel-name",children:m.name}),c.jsx("code",{className:"unitsel-id",children:m.id})]}):n?c.jsx("code",{className:"unitsel-id",children:n}):c.jsx("span",{className:"unitsel-ph",children:i?s:a}),c.jsx("span",{className:"unitsel-caret","aria-hidden":!0,children:"▾"})]}),u&&c.jsxs("div",{className:"unitsel-pop",children:[c.jsx("input",{className:"input unitsel-search",autoFocus:!0,placeholder:"Filter units…",value:f,onChange:T=>h(T.target.value)}),c.jsxs("div",{className:"unitsel-list",children:[i&&!x&&c.jsxs("div",{className:`unitsel-row ${n?"":"sel"}`,children:[c.jsx("span",{className:"unitsel-twist",children:"·"}),c.jsx("button",{type:"button",className:"unitsel-label",onClick:()=>w(""),children:c.jsx("span",{className:"unitsel-ph",children:s})})]}),b.length===0?c.jsx("div",{className:"unitsel-empty",children:"No units available."}):C(b,0)]})]})]})}function XM(t){const e=new Map;for(const i of t)e.set(i.id,{unit:i,children:[]});const n=[];for(const i of e.values()){const s=i.unit.parentId?e.get(i.unit.parentId):void 0;s?s.children.push(i):n.push(i)}const r=i=>i.unit.slug||i.unit.id||i.unit.name||"",a=i=>{i.sort((s,o)=>r(s).localeCompare(r(o))),i.forEach(s=>a(s.children))};return a(n),n}const fj=["business_entity","department","team","group"],QM={business_entity:["business_entity"],department:["business_entity","department"],team:["business_entity","department"],group:["team","group"]},a1={business_entity:"Business entity",department:"Department",team:"Team",group:"Group"};function wp(t){return t===null?["business_entity"]:fj.filter(e=>QM[e].includes(t))}function i1(t){var w,x,E,S,C;const e=Dt(),n=t.mode==="edit",r=((w=t.existing)==null?void 0:w.parentId)??t.defaultParentId??"",a=T=>{var N;return T?((N=t.units.find(P=>P.id===T))==null?void 0:N.kind)??null:null},[i,s]=A.useState(((x=t.existing)==null?void 0:x.name)??""),[o,l]=A.useState(((E=t.existing)==null?void 0:E.slug)??""),[u,d]=A.useState(r),[f,h]=A.useState(((S=t.existing)==null?void 0:S.kind)??wp(a(r))[0]),[v,p]=A.useState(((C=t.existing)==null?void 0:C.visibility)??"inherit"),y=n?[...fj]:wp(a(u));function b(T){d(T);const N=wp(a(T));N.includes(f)||h(N[0])}const m=n?t.existing.id:u?`${u}.${o}`:o;async function g(){const T=n?{id:t.existing.id,name:i,kind:f,slug:t.existing.slug,parentId:t.existing.parentId,visibility:v}:{name:i,kind:f,slug:o,parentId:u||void 0,visibility:v};await yt("/web/admin/org/units",T),e.ok(n?"Unit updated":`Unit “${i}” created`),t.onSaved(),t.onClose()}return c.jsx($n,{title:n?`Edit unit · ${t.existing.name}`:"New organization unit",onClose:t.onClose,footer:c.jsxs(c.Fragment,{children:[c.jsx(ct,{variant:"ghost",onClick:t.onClose,children:"Cancel"}),c.jsx(Tt,{variant:"primary",action:g,onError:e.bad,disabled:!i||!n&&!o,children:n?"Save":"Create"})]}),children:c.jsxs("div",{className:"stack-lg",children:[c.jsx(X,{label:"Display name",children:c.jsx(Be,{value:i,onChange:s,placeholder:"Platform Team"})}),!n&&c.jsx(X,{label:"Parent unit",hint:"A top-level unit must be a business entity.",children:c.jsx(Xu,{units:t.units.filter(T=>{var N;return T.id!==((N=t.existing)==null?void 0:N.id)}),value:u,onChange:b,allowEmpty:!0,emptyLabel:"(top-level — a business entity)"})}),c.jsx(X,{label:"Kind",hint:n?void 0:`Allowed here: ${y.map(T=>a1[T]??T).join(", ")}`,children:c.jsx(en,{value:f,onChange:h,options:y.map(T=>({value:T,label:a1[T]??T}))})}),!n&&c.jsxs(c.Fragment,{children:[c.jsx(X,{label:"Slug",hint:"Lowercase [a-z0-9-], no dots. Unique among siblings.",children:c.jsx(Be,{value:o,onChange:T=>l(T.toLowerCase()),placeholder:"platform"})}),c.jsx(X,{label:"Qualified id (computed)",children:c.jsx("code",{className:"preview-id",children:m||"—"})})]}),c.jsx(X,{label:"Visibility",hint:"'inherit' takes the parent's posture; 'closed' hides placements outside this subtree.",children:c.jsx(en,{value:v,onChange:p,options:["inherit","open","closed"].map(T=>({value:T,label:T}))})})]})})}function ZM(t){const e=Dt(),[n,r]=A.useState("absorb"),[a,i]=A.useState(""),[s,o]=A.useState(""),l=!t.unit.parentId;async function u(){const f={kind:n};n==="migrate"&&(f.targetUnitId=a),n==="alternative"&&(f.newSlug=s),await yt("/web/admin/org/units/remove",{unitId:t.unit.id,disposition:f}),e.ok(`Removed unit ${t.unit.id} (${n})`),t.onDone(),t.onClose()}const d=n==="absorb"||n==="cascade"||n==="migrate"&&a||n==="alternative"&&s;return c.jsx($n,{title:`Remove unit · ${t.unit.name}`,onClose:t.onClose,footer:c.jsxs(c.Fragment,{children:[c.jsx(ct,{variant:"ghost",onClick:t.onClose,children:"Cancel"}),c.jsx(Tt,{variant:"danger",action:u,onError:e.bad,disabled:!d,children:"Remove"})]}),children:c.jsxs("div",{className:"stack-lg",children:[c.jsx("p",{className:"hint",children:"A unit is never silently cascade-deleted. Choose what happens to its child units, placements, and the permission scopes anchored to it."}),c.jsx(X,{label:"Disposition",children:c.jsx(en,{value:n,onChange:f=>r(f),options:[{value:"absorb",label:"Absorb — move content up to the parent"},{value:"migrate",label:"Migrate — move content to another existing unit"},{value:"alternative",label:"Alternative — create a replacement sibling"},{value:"cascade",label:"Cascade — delete this unit and its whole subtree"}].filter(f=>!(f.value==="absorb"&&l))})}),n==="migrate"&&c.jsx(X,{label:"Destination unit",children:c.jsx(Xu,{units:t.units,value:a,onChange:i,excludeSubtreeOf:t.unit.id,allowEmpty:!0,emptyLabel:"(choose…)"})}),n==="alternative"&&c.jsx(X,{label:"Replacement slug",hint:"A fresh sibling under the same parent; content moves into it.",children:c.jsx(Be,{value:s,onChange:f=>o(f.toLowerCase()),placeholder:"platform-v2"})}),n==="cascade"&&c.jsx("p",{className:"error-note",children:"This permanently deletes the subtree, its placements, and permission assignments scoped into it."})]})})}function hj(t){const[e,n]=A.useState(!0),{unit:r,children:a}=t.node,i=a.length>0;return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"tree-row",style:{paddingLeft:8+t.depth*20},children:[c.jsx("button",{className:"twist",onClick:()=>n(s=>!s),"aria-label":e?"Collapse":"Expand",children:i?e?"▾":"▸":"·"}),c.jsxs("div",{className:"tree-main",children:[c.jsx("strong",{children:r.name}),c.jsx(rt,{tone:"neutral",children:r.kind}),r.visibility&&r.visibility!=="inherit"&&c.jsx(rt,{tone:"warn",children:r.visibility}),c.jsx("code",{className:"subtle",children:r.id})]}),c.jsxs("div",{className:"row-actions",children:[c.jsx(ct,{size:"sm",variant:"ghost",onClick:()=>t.onAddChild(r.id),children:"+ Sub-unit"}),c.jsx(ct,{size:"sm",variant:"ghost",onClick:()=>t.onEdit(r),children:"Edit"}),c.jsx(ct,{size:"sm",variant:"ghost",onClick:()=>t.onRemove(r),children:"Remove"})]})]}),e&&a.map(s=>c.jsx(hj,{node:s,depth:t.depth+1,onEdit:t.onEdit,onRemove:t.onRemove,onAddChild:t.onAddChild},s.unit.id))]})}function JM(){var u;const t=St(()=>Et("/web/admin/org/units"),[],["units"]),[e,n]=A.useState(null),[r,a]=A.useState(null),[i,s]=A.useState(null),o=((u=t.data)==null?void 0:u.units)??[],l=A.useMemo(()=>XM(o),[o]);return c.jsxs("div",{className:"view-pad",children:[c.jsxs("div",{className:"view-head",children:[c.jsxs("div",{children:[c.jsx("h2",{children:"Organization units"}),c.jsx("p",{className:"hint",children:"Hierarchical grouping of projects and the scopes permissions anchor to. Rows are collapsible."})]}),c.jsx(ct,{variant:"primary",onClick:()=>n({}),children:"+ New unit"})]}),c.jsx(Xt,{state:t,children:()=>l.length===0?c.jsx("div",{className:"empty-state",children:"No organization units yet. Create one to start grouping projects."}):c.jsx("div",{className:"tree",children:l.map(d=>c.jsx(hj,{node:d,depth:0,onEdit:a,onRemove:s,onAddChild:f=>n({parentId:f})},d.unit.id))})}),e&&c.jsx(i1,{mode:"create",units:o,defaultParentId:e.parentId,onClose:()=>n(null),onSaved:t.reload}),r&&c.jsx(i1,{mode:"edit",existing:r,units:o,onClose:()=>a(null),onSaved:t.reload}),i&&c.jsx(ZM,{unit:i,units:o,onClose:()=>s(null),onDone:t.reload})]})}function vj(){var l;const t=Dt(),e=St(()=>Et("/web/admin/secrets").catch(()=>({refs:[]})),[]),[n,r]=A.useState(""),[a,i]=A.useState(!1),s=((l=e.data)==null?void 0:l.refs.includes("git-token"))??!1;async function o(){await yt("/web/admin/secrets",{key:"git-token",value:n}),t.ok("Git access token saved"),r(""),e.reload()}return c.jsxs("div",{className:"panel",children:[c.jsxs("h4",{children:["Shared git access token ",s?c.jsx(rt,{tone:"ok",children:"set"}):c.jsx(rt,{tone:"warn",children:"not set"})]}),c.jsxs("p",{className:"hint",children:["The ",c.jsx("strong",{children:"fallback"})," token for HTTPS git remotes: any connection (backup binding or per-project backing) that has no PAT of its own uses this one, injected as ",c.jsx("code",{children:"x-access-token"}),". Give a connection its own PAT when it lives in a different org or account; otherwise this shared token covers it. Set once (requires instance admin); the value is write-only and never mirrored into any repo. Re-set to rotate."]}),c.jsxs("div",{className:"row-form",children:[c.jsx(X,{label:"Personal access token",children:c.jsx(Be,{type:"password",value:n,onChange:r,placeholder:"github_pat_… / ghp_… / glpat-…"})}),c.jsx("div",{className:"row-form-action",children:c.jsx(Tt,{variant:"primary",action:o,onError:t.bad,disabled:!n,children:s?"Rotate token":"Save token"})})]}),c.jsx(ct,{variant:"ghost",size:"sm",onClick:()=>i(u=>!u),children:a?"Hide token setup":"Which permissions does the token need?"}),a&&c.jsx(eO,{})]})}function pj(){return c.jsxs(c.Fragment,{children:[c.jsx("p",{children:c.jsx("strong",{children:"Grant the least privilege — repository “Contents: Read and write”, on this repo only."})}),c.jsxs("ul",{children:[c.jsxs("li",{children:[c.jsx("strong",{children:"GitHub fine-grained:"})," Repository access → only this repo → Permissions →"," ",c.jsx("code",{children:"Contents: Read and write"})," (Metadata is added automatically)."]}),c.jsxs("li",{children:[c.jsx("strong",{children:"GitHub classic:"})," ",c.jsx("code",{children:"repo"})," (or ",c.jsx("code",{children:"public_repo"})," if the repo is public)."]}),c.jsxs("li",{children:[c.jsx("strong",{children:"GitLab:"})," ",c.jsx("code",{children:"write_repository"}),". ",c.jsx("strong",{children:"Bitbucket:"})," Repositories Read + Write."]})]}),c.jsx("p",{children:"A brand-new empty repo is fine — wairon creates the branch on the first sync. Leave the field blank to use the shared fallback token instead."})]})}function eO(){return c.jsxs("div",{className:"token-help",children:[c.jsxs("p",{className:"token-help-note",children:["The token only needs to ",c.jsx("strong",{children:"read and write repository contents"})," (clone, commit, push). Grant nothing else — no admin, workflows, packages, or org scopes. A brand-new ",c.jsx("em",{children:"empty"})," repo is fine — wairon creates the branch on the first sync."]}),c.jsx("h5",{children:"GitHub — fine-grained token (recommended)"}),c.jsxs("ol",{children:[c.jsxs("li",{children:[c.jsx("a",{href:"https://github.com/settings/personal-access-tokens",target:"_blank",rel:"noreferrer",children:"Settings → Developer settings → Fine-grained tokens"})," ","→ ",c.jsx("strong",{children:"Generate new token"}),"."]}),c.jsxs("li",{children:[c.jsx("strong",{children:"Resource owner"}),": the user or org that owns the backup repo."]}),c.jsxs("li",{children:[c.jsx("strong",{children:"Repository access"}),": “Only select repositories” → pick the backup repo(s)."]}),c.jsxs("li",{children:[c.jsx("strong",{children:"Repository permissions"})," → ",c.jsx("code",{children:"Contents"}),": ",c.jsx("strong",{children:"Read and write"}),". That is the only permission required. (",c.jsx("code",{children:"Metadata: Read-only"})," is added automatically.)"]}),c.jsxs("li",{children:["Set an expiry, generate, and paste the ",c.jsx("code",{children:"github_pat_…"})," value above."]})]}),c.jsx("h5",{children:"GitHub — classic token"}),c.jsx("ul",{children:c.jsxs("li",{children:["Scope ",c.jsx("code",{children:"repo"})," (Full control of private repositories) for private repos, or just"," ",c.jsx("code",{children:"public_repo"})," if the backup repo is public. No other scopes."]})}),c.jsx("h5",{children:"GitLab"}),c.jsx("ul",{children:c.jsxs("li",{children:["Project or personal access token with scope ",c.jsx("code",{children:"write_repository"})," (includes read), role"," ",c.jsx("strong",{children:"Developer"})," or above."]})}),c.jsx("h5",{children:"Bitbucket"}),c.jsx("ul",{children:c.jsxs("li",{children:["App password with ",c.jsx("strong",{children:"Repositories: Read"})," + ",c.jsx("strong",{children:"Write"}),"."]})}),c.jsx("p",{className:"token-help-note",children:"If the target branch is protected, allow this token to push to it (or back up to an unprotected branch)."})]})}const tO=t=>`${window.location.origin}/share/${t}`,s1=t=>!!t.expiresAt&&Date.parse(t.expiresAt)<=Date.now();function nO({projectId:t}){const e=Dt(),n=St(()=>Et(`/web/admin/share?projectId=${encodeURIComponent(t)}`),[t],["share"]),[r,a]=A.useState(!1),[i,s]=A.useState(null),[o,l]=A.useState(null);async function u(h,v){await yt("/web/admin/share/update",{linkId:h.id,changes:{enabled:v}}),e.ok(v?"Link enabled":"Link disabled"),n.reload()}async function d(h){await yt("/web/admin/share/refresh",{linkId:h}),e.ok("Snapshot refreshed"),n.reload()}async function f(h){await yt("/web/admin/share/remove",{linkId:h}),e.ok("Link revoked"),n.reload()}return c.jsxs("div",{className:"stack-lg",children:[c.jsxs("div",{className:"view-head",children:[c.jsxs("p",{className:"hint",children:["Public, read-only share links to this project's canvas — a point-in-time snapshot, revocable, with every access logged. Requires the ",c.jsx("code",{children:"share:create"})," permission. The link is shown once on creation."]}),c.jsx(ct,{variant:"primary",onClick:()=>a(!0),children:"+ Create share link"})]}),c.jsx(Xt,{state:n,children:h=>c.jsx(Vn,{rowKey:v=>v.id,empty:"No share links for this project yet.",rows:h.links,columns:[{key:"created",header:"Created",cell:v=>c.jsx("span",{className:"hint",children:new Date(v.createdAt).toLocaleDateString()})},{key:"status",header:"Status",cell:v=>s1(v)?c.jsx(rt,{tone:"bad",children:"expired"}):v.enabled?c.jsx(rt,{tone:"ok",children:"active"}):c.jsx(rt,{tone:"warn",children:"disabled"})},{key:"downloads",header:"Downloads",cell:v=>c.jsxs("span",{className:"cell-inline",children:[v.allowDownloadHtml&&c.jsx(rt,{tone:"neutral",children:"HTML"}),v.allowDownloadOpenapi&&c.jsx(rt,{tone:"neutral",children:"OpenAPI"}),v.frameAncestors.length>0&&c.jsx(rt,{tone:"accent",children:"embeddable"}),!v.allowDownloadHtml&&!v.allowDownloadOpenapi&&v.frameAncestors.length===0&&c.jsx("span",{className:"hint",children:"—"})]})},{key:"expiry",header:"Expires",cell:v=>c.jsx("span",{className:"hint",children:v.expiresAt?new Date(v.expiresAt).toLocaleDateString():"never"})},{key:"act",header:"",cell:v=>c.jsxs("div",{className:"row-actions",children:[c.jsx(ct,{size:"sm",variant:"ghost",onClick:()=>l(v),children:"Access log"}),c.jsx(Tt,{size:"sm",action:()=>d(v.id),onError:e.bad,children:"Refresh"}),s1(v)?null:v.enabled?c.jsx(Tt,{size:"sm",action:()=>u(v,!1),onError:e.bad,children:"Disable"}):c.jsx(Tt,{size:"sm",action:()=>u(v,!0),onError:e.bad,children:"Enable"}),c.jsx(li,{label:"Revoke",title:"Revoke share link",message:"Permanently revoke this link? Its URL will stop working immediately.",confirmLabel:"Revoke",action:()=>f(v.id),onError:e.bad})]})}]})}),r&&c.jsx(rO,{projectId:t,onClose:()=>a(!1),onCreated:h=>{a(!1),s(h),n.reload()}}),i&&c.jsx(aO,{created:i,onClose:()=>s(null)}),o&&c.jsx(sO,{link:o,onClose:()=>l(null)})]})}function rO(t){const e=Dt(),[n,r]=A.useState(""),[a,i]=A.useState(!1),[s,o]=A.useState(!1),[l,u]=A.useState("");async function d(){const f=await yt("/web/admin/share",{projectId:t.projectId,view:"canvas",mode:"snapshot",artifacts:["canvas","html",...s?["openapi"]:[]],expiresAt:n?new Date(n).toISOString():void 0,allowDownloadHtml:a,allowDownloadOpenapi:s,frameAncestors:l.split(",").map(h=>h.trim()).filter(Boolean)});t.onCreated(f)}return c.jsx($n,{title:"Create share link",onClose:t.onClose,footer:c.jsxs(c.Fragment,{children:[c.jsx(ct,{variant:"ghost",onClick:t.onClose,children:"Cancel"}),c.jsx(Tt,{variant:"primary",action:d,onError:e.bad,children:"Create"})]}),children:c.jsxs("div",{className:"stack-lg",children:[c.jsx("p",{className:"hint",children:"Shares the whole interactive project canvas (all views + drill-down) as a point-in-time snapshot."}),c.jsx(X,{label:"Expires (optional)",hint:"Leave blank for no expiry. The link stops working after this date.",children:c.jsx(Be,{type:"date",value:n,onChange:r})}),c.jsx(yu,{checked:a,onChange:i,label:"Allow downloading the standalone HTML canvas"}),c.jsx(yu,{checked:s,onChange:o,label:"Include the OpenAPI document (viewer + download)",hint:"Generated from the project's EXTERNAL public surface (L0 interfaces marked audience 'external'). Empty if the project publishes none."}),c.jsx(X,{label:"Embedding allowlist (optional)",info:c.jsx(c.Fragment,{children:c.jsxs("p",{children:["Domains permitted to embed this view in an ",c.jsx("code",{children:"<iframe>"})," (CSP"," ",c.jsx("code",{children:"frame-ancestors"}),"). Comma-separated, e.g. ",c.jsx("code",{children:"https://www.notion.so"}),". Blank = not embeddable anywhere."]})}),hint:"Comma-separated origins, e.g. https://www.notion.so",children:c.jsx(Be,{value:l,onChange:u,placeholder:"https://www.notion.so"})}),c.jsxs("p",{className:"hint",children:["The snapshot is captured now and never changes. Use ",c.jsx("strong",{children:"Refresh"})," later to re-capture the current view."]})]})})}function aO(t){const e=Dt(),n=tO(t.created.token);return c.jsx($n,{title:"Share link created",onClose:t.onClose,footer:c.jsx(ct,{variant:"primary",onClick:t.onClose,children:"Done"}),children:c.jsxs("div",{className:"stack-lg",children:[c.jsxs("p",{className:"hint",children:["Copy this link now — it is shown ",c.jsx("strong",{children:"once"})," and cannot be recovered (only its hash is stored). You can revoke it any time."]}),c.jsxs("div",{className:"row-form",children:[c.jsx(X,{label:"Share URL",children:c.jsx(Be,{value:n,onChange:()=>{}})}),c.jsx("div",{className:"row-form-action",children:c.jsx(ct,{variant:"primary",onClick:()=>{var r;(r=navigator.clipboard)==null||r.writeText(n).then(()=>e.ok("Copied"),()=>e.bad("Copy failed"))},children:"Copy"})})]})]})})}const iO={served:"ok","denied-disabled":"warn","denied-expired":"warn","denied-download":"warn","not-found":"bad"};function sO(t){const e=St(()=>Et(`/web/admin/share/access?linkId=${encodeURIComponent(t.link.id)}&limit=200`),[t.link.id]);return c.jsxs($n,{title:"Share link access log",onClose:t.onClose,wide:!0,footer:c.jsx(ct,{variant:"primary",onClick:t.onClose,children:"Close"}),children:[c.jsx("p",{className:"hint",children:"Every access to this link — watch for unfamiliar IPs or a burst of activity."}),c.jsx(Xt,{state:e,children:n=>c.jsx(Vn,{rowKey:r=>r.id,empty:"No accesses recorded yet.",rows:n.entries,columns:[{key:"at",header:"When",cell:r=>c.jsx("span",{className:"hint",children:new Date(r.at).toLocaleString()})},{key:"ip",header:"IP",cell:r=>c.jsx("code",{children:r.ip})},{key:"outcome",header:"Outcome",cell:r=>c.jsx(rt,{tone:iO[r.outcome]??"neutral",children:r.outcome})},{key:"ua",header:"User agent",cell:r=>c.jsx("span",{className:"subtle",style:{fontSize:11},children:r.userAgent||"—"})},{key:"ref",header:"Referer",cell:r=>c.jsx("span",{className:"subtle",style:{fontSize:11},children:r.referer||"—"})}]})})]})}const kp=["draft","design","complete"],oO=["Portal","Orchestrator","Supervisor","Actor","Store","Index","Query","Registry","Adapter","Observer","View","Repository","FeatureComponent","RouterComponent"],lO=["Specialist","Gateway"],uO=["HTTP","gRPC","GraphQL","MessageBus","CLI","NamedPipe","IPC","JSONRPC","InProcess","Custom"],cO=["ram-projection","durable","read-through","cache"],dO=["components","interfaces","implementations","narratives"],fO=["none","read","write","lifecycle","io"],hO=["HTTP","gRPC","GraphQL","MessageBus","NamedPipe","IPC","CLI","JSONRPC","Custom"],vO=["GET","POST","PUT","DELETE","PATCH","OPTIONS","HEAD"],pO=["query","mutation","subscription"],gO=["subscribe","publish"],o1=["REST","GraphQL","MessageBus","RPC","Custom"],mO=["project","department","instance","partner","external"],l1=["full","calls-only","intent"],u1=["declared","anchored","off"],yO=["implementation","informative"],bO=["none","apiKey","bearer","basic","oauth2","openIdConnect","custom"],c1=["header","query","cookie"],xO=["authorizationCode","clientCredentials","implicit","password"],wO=["entity","value-object","enum"],kO=["primary","unique","foreign"],EO=["string","int","float","bool","bytes","date","datetime","duration"],CO=["idempotent","atomic","transactional","exactly-once"],SO=["fullstack","system-of-systems","monorepo"],jO=["backend","frontend-reactive","frontend-controller","lowlevel-os","game-ecs","realtime-embedded","plc-cyclic"],TO=["string","int","float","bool","bytes","date","datetime","duration","void","any","list<string>","map<string, string>","string?","async void"],NO={system:["vision"],subsystem:["name","description","status","profile","designDepth","targetLanguage"],component:["name","description","status","componentType","transport","basePath","durability"],interface:["name","description"],implementation:["name","description","status","detail","conformance"],type:["name","description","kind"]},PO=new Set(["profile","designDepth","transport","durability","detail","conformance"]),cd={DESCRIPTION_TOO_SHORT:"description",MISSING_DESCRIPTION:"description",PROFILE_FORBIDDEN_STEREOTYPE:"componentType",PROFILE_DISCOURAGED_STEREOTYPE:"componentType",FRONTEND_STEREOTYPE_IN_BACKEND:"componentType",BACKEND_STEREOTYPE_IN_FRONTEND:"componentType",PLC_CYCLIC_CONCURRENCY_VIOLATION:"componentType",MISSING_DURABILITY:"durability",UNKNOWN_PROFILE:"profile",PUBLIC_INTERFACE_UNBOUND:"publicInterfaces",PUBLIC_INTERFACE_INVALID_COMPONENT:"publicInterfaces",PUBLIC_INTERFACE_FOREIGN_COMPONENT:"publicInterfaces",PUBLIC_INTERFACE_TYPE_MISMATCH:"publicInterfaces",PUBLIC_INTERFACE_INVALID_INTERFACE:"publicInterfaces",PUBLIC_INTERFACE_EVENT_MISTYPED:"publicInterfaces"},RO=new Map,ko=(t,e)=>t.label.localeCompare(e.label),Ei=(t,e)=>JSON.stringify(t??null)===JSON.stringify(e??null),d1=t=>JSON.parse(JSON.stringify(t));function rn(t){const e=[...t.allowNone?[{value:"",label:t.noneLabel??"— none —"}]:[],...t.options.map(n=>({value:n,label:n}))];return c.jsx(en,{value:t.value??"",onChange:t.onChange,options:e,disabled:t.disabled})}function IO(t){const e=oO.map(n=>({value:n,label:n}));return t&&lO.includes(t)&&e.push({value:t,label:`${t} (retired)`}),e}let LO=0;function Ep(t){const e=A.useMemo(()=>`dl-${++LO}`,[]);return c.jsxs(c.Fragment,{children:[c.jsx("input",{className:"input",list:e,value:t.value??"",placeholder:t.placeholder,disabled:t.disabled,onChange:n=>t.onChange(n.target.value)}),c.jsx("datalist",{id:e,children:t.suggestions.map(n=>c.jsx("option",{value:n},n))})]})}function f1(t){const[e,n]=A.useState(""),r=t.values??[],a=o=>{const l=o.trim();l&&!r.includes(l)&&t.onChange([...r,l]),n("")},i=o=>t.onChange(r.filter(l=>l!==o)),s=(t.suggestions??[]).filter(o=>!r.includes(o));return c.jsxs("div",{className:"taginput",children:[r.length>0&&c.jsx("span",{className:"msel-chips",children:r.map(o=>c.jsxs("span",{className:"msel-chip",children:[o,!t.disabled&&c.jsx("span",{className:"msel-chip-x",role:"button","aria-label":`Remove ${o}`,onClick:()=>i(o),children:"×"})]},o))}),c.jsx("input",{className:"input",value:e,placeholder:t.placeholder??"Type and press Enter…",disabled:t.disabled,onChange:o=>n(o.target.value),onKeyDown:o=>{o.key==="Enter"&&(o.preventDefault(),a(e))}}),s.length>0&&!t.disabled&&c.jsx("div",{className:"chip-row",children:s.map(o=>c.jsxs("button",{type:"button",className:"btn btn-ghost btn-sm",onClick:()=>a(o),children:["+ ",o]},o))})]})}function h1(t){const e=t.items??[],n=(a,i)=>t.onChange(e.map((s,o)=>o===a?t.setText(s,i):s)),r=a=>t.onChange(e.filter((i,s)=>s!==a));return c.jsxs("div",{className:"stack-sm",children:[e.map((a,i)=>c.jsxs("div",{className:"list-line",children:[c.jsx("input",{className:"input",value:t.getText(a),placeholder:t.placeholder,disabled:t.disabled,onChange:s=>n(i,s.target.value)}),!t.disabled&&c.jsx("button",{type:"button",className:"icon-btn","aria-label":"Remove",title:"Remove",onClick:()=>r(i),children:"×"})]},i)),!t.disabled&&c.jsxs("button",{type:"button",className:"btn btn-ghost btn-sm",onClick:()=>t.onChange([...e,""]),children:["+ ",t.addLabel??"Add"]})]})}function AO(t){const e=t.links??[],n=(a,i)=>t.onChange(e.map((s,o)=>o===a?{...s,...i}:s)),r=a=>t.onChange(e.filter((i,s)=>s!==a));return c.jsxs("div",{className:"stack-sm",children:[e.map((a,i)=>c.jsx("div",{className:"sub-card",children:c.jsxs("div",{className:"row-form",children:[c.jsx(X,{label:"URL",children:c.jsx(Be,{value:a.url??"",onChange:s=>n(i,{url:s}),placeholder:"https://…"})}),c.jsx(X,{label:"Type",info:"An 'implementation' link is the external source-of-record (it satisfies the source requirement); 'informative' is context only.",children:c.jsx(rn,{value:a.type??"informative",onChange:s=>n(i,{type:s}),options:yO})}),c.jsx(X,{label:"Label",children:c.jsx(Be,{value:a.label??"",onChange:s=>n(i,{label:s}),placeholder:"(optional)"})}),c.jsx("div",{className:"row-form-action",children:c.jsx("button",{type:"button",className:"icon-btn","aria-label":"Remove link",title:"Remove",onClick:()=>r(i),children:"×"})})]})},i)),c.jsx("button",{type:"button",className:"btn btn-ghost btn-sm",onClick:()=>t.onChange([...e,{url:"",type:"informative"}]),children:"+ external link"})]})}function DO(t){const e=t.auth??{scheme:"none"},n=e.scheme??"none",r=s=>t.onChange({...e,...s}),a=e.scopes??[],i=s=>r({scopes:s});return c.jsxs("div",{className:"stack-sm",children:[c.jsx(X,{label:"Auth scheme",hint:"Default 'none' → no security. Portals with different auth must be separate components.",children:c.jsx(rn,{value:n,onChange:s=>t.onChange(s==="none"?{scheme:"none"}:{...e,scheme:s}),options:bO})}),n==="apiKey"&&c.jsxs("div",{className:"row-form",children:[c.jsx(X,{label:"In",children:c.jsx(rn,{value:e.in??"header",onChange:s=>r({in:s}),options:c1})}),c.jsx(X,{label:"Name",children:c.jsx(Be,{value:e.name??"",onChange:s=>r({name:s}),placeholder:"X-API-Key"})})]}),n==="bearer"&&c.jsx(X,{label:"Bearer format",children:c.jsx(Be,{value:e.bearerFormat??"",onChange:s=>r({bearerFormat:s}),placeholder:"JWT"})}),n==="oauth2"&&c.jsxs(c.Fragment,{children:[c.jsx(X,{label:"Flow",children:c.jsx(rn,{value:e.flow??"authorizationCode",onChange:s=>r({flow:s}),options:xO})}),c.jsx(X,{label:"Authorization URL",children:c.jsx(Be,{value:e.authorizationUrl??"",onChange:s=>r({authorizationUrl:s}),placeholder:"https://…/authorize"})}),c.jsx(X,{label:"Token URL",children:c.jsx(Be,{value:e.tokenUrl??"",onChange:s=>r({tokenUrl:s}),placeholder:"https://…/token"})}),c.jsx(X,{label:"Refresh URL",children:c.jsx(Be,{value:e.refreshUrl??"",onChange:s=>r({refreshUrl:s}),placeholder:"(optional)"})}),c.jsx("span",{className:"field-label",children:"Scopes"}),a.map((s,o)=>c.jsxs("div",{className:"row-form",children:[c.jsx(X,{label:"Scope",children:c.jsx(Be,{value:s.name??"",onChange:l=>i(a.map((u,d)=>d===o?{...u,name:l}:u))})}),c.jsx(X,{label:"Description",children:c.jsx(Be,{value:s.description??"",onChange:l=>i(a.map((u,d)=>d===o?{...u,description:l}:u))})}),c.jsx("div",{className:"row-form-action",children:c.jsx("button",{type:"button",className:"icon-btn","aria-label":"Remove scope",onClick:()=>i(a.filter((l,u)=>u!==o)),children:"×"})})]},o)),c.jsx("button",{type:"button",className:"btn btn-ghost btn-sm",onClick:()=>i([...a,{name:"",description:""}]),children:"+ scope"})]}),n==="openIdConnect"&&c.jsx(X,{label:"OpenID Connect URL",children:c.jsx(Be,{value:e.openIdConnectUrl??"",onChange:s=>r({openIdConnectUrl:s}),placeholder:"https://…/.well-known/openid-configuration"})}),n==="custom"&&c.jsxs("div",{className:"row-form",children:[c.jsx(X,{label:"In",children:c.jsx(rn,{value:e.in??"header",onChange:s=>r({in:s}),options:c1})}),c.jsx(X,{label:"Name",children:c.jsx(Be,{value:e.name??"",onChange:s=>r({name:s}),placeholder:"Authorization"})})]}),n!=="none"&&c.jsxs("div",{className:"row-form",children:[c.jsx(X,{label:"Description",children:c.jsx(Be,{value:e.description??"",onChange:s=>r({description:s}),placeholder:"(optional)"})}),c.jsx(X,{label:"Format example",children:c.jsx(Be,{value:e.example??"",onChange:s=>r({example:s}),placeholder:"e.g. Bearer <token>"})})]})]})}function BO(t,e){if(!t)return!1;if(e.ids.has(t))return!0;const n=t.lastIndexOf(".");return n>0&&e.ids.has(t.slice(0,n))}function MO(t,e){const n=i=>i==="project"?"system":i,r=e.find(i=>i.id===t);if(r)return{kind:n(r.kind),id:r.id,label:r.label};const a=t.lastIndexOf(".");if(a>0){const i=e.find(s=>s.id===t.slice(0,a));if(i)return{kind:n(i.kind),id:i.id,label:i.label,suffix:t.slice(a+1)}}return null}function OO(t){const e=MO(t.specId,t.nodes);return e?c.jsxs("button",{type:"button",className:"badge badge-accent finding-chip",title:t.specId,onClick:()=>t.onSelectSpec({kind:e.kind,id:e.id}),children:[e.kind," · ",e.label,e.suffix?` · ${e.suffix}`:""]}):c.jsxs("span",{className:"badge badge-neutral finding-chip-unresolved",title:t.specId,children:["id · ",t.specId]})}const v1={component:"component",subsystem:"subsystem",type:"type",system:"system"};function zO(t){const e=Dt(),n=t.validation,r=n?n.errors.length+n.warnings.length+n.notices.length:0,a=b=>!t.scope||BO(b.specId,t.scope),i=n?n.errors.filter(a):[],s=n?n.warnings.filter(a):[],o=n?n.notices.filter(a):[],l=i.length+s.length+o.length,u=r-l,d=!t.scope||t.showAll,f=d?(n==null?void 0:n.errors)??[]:i,h=d?(n==null?void 0:n.warnings)??[]:s,v=d?(n==null?void 0:n.notices)??[]:o,p={error:"err",warn:"badge-warn",notice:"finding-notice-label"},y=(b,m,g)=>{const w=cd[b.code],x=!!w&&!!t.openSpecId&&b.specId===t.openSpecId;return c.jsxs("li",{className:`finding f-${m}`,children:[c.jsxs("div",{className:"finding-row",children:[c.jsx("span",{className:p[m],style:m==="warn"?{padding:0}:void 0,children:m}),b.code?c.jsx("code",{className:"subtle",children:b.code}):null]}),c.jsx("div",{className:x?"finding-msg finding-msg-clickable":"finding-msg",role:x?"button":void 0,onClick:x?()=>t.onRequestScroll(w):void 0,title:x?"Jump to this field":void 0,children:b.message}),b.specId&&c.jsx("div",{className:"finding-chip-row",children:c.jsx(OO,{specId:b.specId,nodes:t.nodes,onSelectSpec:t.onSelectSpec})})]},g)};return c.jsxs("aside",{className:"spec-validation",children:[c.jsxs("div",{className:"spec-validation-head",children:[c.jsx("span",{className:"field-label",children:"Validation"}),c.jsx(Tt,{variant:"ghost",action:t.onValidate,onError:e.bad,children:"Validate tree"})]}),!n&&c.jsx("p",{className:"hint",children:"Run a tree validation to list this project's errors, warnings and notices here."}),n&&r===0&&c.jsx(rt,{tone:"ok",children:"clean — no errors, warnings or notices"}),n&&r>0&&c.jsxs(c.Fragment,{children:[t.scope&&c.jsxs("div",{className:"spec-validation-scope",children:[c.jsxs("span",{className:"hint",children:[l," on this ",v1[t.scope.noun]," · ",u," elsewhere"]}),c.jsx("button",{type:"button",className:"btn btn-ghost btn-sm",onClick:t.onToggleShowAll,children:t.showAll?"Show scoped":"Show all"})]}),c.jsxs("div",{className:"spec-validation-counts",children:[f.length>0&&c.jsxs(rt,{tone:"bad",children:[f.length," errors"]})," ",h.length>0&&c.jsxs(rt,{tone:"warn",children:[h.length," warnings"]})," ",v.length>0&&c.jsxs(rt,{tone:"neutral",children:[v.length," notices"]}),f.length===0&&h.length===0&&c.jsx(rt,{tone:"ok",children:v.length>0?"no errors or warnings":`clean — no issues on this ${v1[t.scope.noun]}`})]}),v.length>0&&c.jsx("p",{className:"hint",children:"Notices are informational: they never make the tree invalid and never fail CI."}),c.jsxs("ul",{className:"finding-list",children:[f.map((b,m)=>y(b,"error",`e${m}`)),h.map((b,m)=>y(b,"warn",`w${m}`)),v.map((b,m)=>y(b,"notice",`n${m}`))]})]})]})}function gj(t){return c.jsxs("select",{className:"input",value:t.value,disabled:t.disabled,onChange:e=>t.onChange(e.target.value),children:[t.includeNone&&c.jsx("option",{value:"",children:t.noneLabel??"(none)"}),t.groups.map(e=>c.jsx("optgroup",{label:e.label,children:e.options.map(n=>c.jsx("option",{value:n.value,children:n.label},n.value))},e.label))]})}function mj(t){const e=new Map,n=[];for(const r of[...t].sort((a,i)=>a.id.localeCompare(i.id))){const a=r.source==="builtin"?"Built-in":r.source;e.has(a)||(e.set(a,[]),n.push(a)),e.get(a).push({value:r.id,label:r.family?`${r.id} (${r.family})`:r.id})}return n.sort((r,a)=>r==="Built-in"?-1:a==="Built-in"?1:r.localeCompare(a)),n.map(r=>({label:r,options:e.get(r)}))}function yj(t,e){const n=new Set(e.filter(r=>r.installed===!1).map(r=>r.id));return t.map(r=>({...r,options:r.options.map(a=>n.has(a.value)?{...a,label:`${a.label} — adopts pack`}:a)}))}function bj(t,e){return e?t.some(r=>r.options.some(a=>a.value===e))?t:[{label:"Current",options:[{value:e,label:e}]},...t]:t}function FO(t,e,n){const r={};for(const a of NO[t]){const i=n[a],s=e[a];i!==s&&((i===""||i===void 0)&&s===void 0||i!==void 0&&(i===""&&PO.has(a)||(r[a]=i)))}return r}function _O(t,e){const n=[];for(const r of e.methods??[]){const a=(t.methods??[]).find(s=>s.name===r.name);if(!a)continue;const i={};if(r.description!==a.description&&(i.description=r.description),r.signature!==a.signature&&!r.signatureFrom&&!(r.params??[]).length&&(i.signature=r.signature),r.returns!==a.returns&&!r.signatureFrom&&(i.returns=r.returns),(r.signatureFrom??"")!==(a.signatureFrom??""))if(r.signatureFrom)i.signatureFrom=r.signatureFrom,a.signatureFrom||(i.unset=["params","returns","signature"]);else{const s=(e.resolvedSignatures??[]).find(o=>o.method===r.name);i.unset=["signatureFrom"],s!=null&&s.params&&(i.params=s.params),i.returns=(s==null?void 0:s.returns)??r.returns??"unknown",s!=null&&s.params||(i.signature=(s==null?void 0:s.signature)??`${r.name}(): ${i.returns}`)}(r.effect??"")!==(a.effect??"")&&r.effect&&(i.effect=r.effect),Ei(r.guarantees??[],a.guarantees??[])||(i.guarantees=r.guarantees??[]),!r.signatureFrom&&!a.signatureFrom&&!Ei(r.params??[],a.params??[])&&(i.params=r.params??[]),Ei(r.endpoint,a.endpoint)||(i.endpoint=r.endpoint),Object.keys(i).length&&n.push({name:r.name,...i})}return n}function $O(t,e){const n=[];for(const r of e.methods??[]){const a=(t.methods??[]).find(s=>s.name===r.name);if(!a)continue;const i={};(r.detail??"")!==(a.detail??"")&&r.detail&&(i.detail=r.detail),(r.conformance??"")!==(a.conformance??"")&&r.conformance&&(i.conformance=r.conformance),(r.intent??"")!==(a.intent??"")&&(i.intent=r.intent??""),Object.keys(i).length&&n.push({name:r.name,...i})}return n}function VO(t,e){const n=[];for(const r of e.values??[]){const a=(t.values??[]).find(i=>i.name===r.name);a&&(r.description??"")!==(a.description??"")&&n.push({name:r.name,description:r.description??""})}return n}function UO(t,e){const n=[];for(const r of e.fields??[]){const a=(t.fields??[]).find(s=>s.name===r.name);if(!a)continue;const i={};r.type!==a.type&&(i.type=r.type),(r.description??"")!==(a.description??"")&&(i.description=r.description??""),!!r.optional!=!!a.optional&&(i.optional=!!r.optional),(r.key??"")!==(a.key??"")&&r.key&&(i.key=r.key),(r.references??"")!==(a.references??"")&&(i.references=r.references??""),Object.keys(i).length&&n.push({name:r.name,...i})}return n}function qO(t,e,n){const r=[],a=e.publicInterfaces??[];for(let i=0;i<a.length;i++){const s=a[i],o=(t.publicInterfaces??[])[i];if(!o)continue;const l={};(s.type??"")!==(o.type??"")&&s.type&&(l.type=s.type),(s.details??"")!==(o.details??"")&&(l.details=s.details??""),n==="system"&&((s.name??"")!==(o.name??"")&&(l.name=s.name??""),(s.audience??"")!==(o.audience??"")&&s.audience&&(l.audience=s.audience)),Object.keys(l).length&&r.push({...o.from!==void 0?{from:o.from}:{},...o.component!==void 0?{component:o.component}:{},...o.typeDef!==void 0?{typeDef:o.typeDef}:{},...o.interface!==void 0?{interface:o.interface}:{},...o.as!==void 0?{as:o.as}:{},...l})}return r}function HO(t,e){const n=[],r=e.lifecycle??[];for(let a=0;a<r.length;a++){const i=r[a],s=(t.lifecycle??[])[a];s&&(i.description??"")!==(s.description??"")&&n.push({phase:s.phase,component:s.component,method:s.method,description:i.description??""})}return n}function WO(t,e,n){const r=FO(t,e,n);if(t==="component"&&!Ei(n.externalLinks??[],e.externalLinks??[])&&(r.externalLinks=n.externalLinks??[]),t==="component"&&!Ei(n.auth??null,e.auth??null)&&(r.auth=n.auth??{scheme:"none"}),t==="implementation"&&!Ei(n.technologies??[],e.technologies??[])&&(r.technologies=n.technologies??[]),t==="interface"){const a=_O(e,n);a.length&&(r.methods=a)}if(t==="implementation"){const a=$O(e,n);a.length&&(r.methods=a)}if(t==="type"){(n.holds??"")!==(e.holds??"")&&(n.holds?r.holds=n.holds:r.unset=["holds"]);const a=UO(e,n);a.length&&(r.fields=a);const i=VO(e,n);i.length&&(r.values=i)}if(t==="subsystem"||t==="system"){const a=qO(e,n,t);a.length&&(r.publicInterfaces=a)}if(t==="system"&&(Ei(n.boundaries??[],e.boundaries??[])||(r.boundaries=n.boundaries??[]),Ei(n.globalRequirements??[],e.globalRequirements??[])||(r.globalRequirements=n.globalRequirements??[])),t==="subsystem"){const a=HO(e,n);a.length&&(r.lifecycle=a)}return r}function KO(t){const e=t.endpoint??{},n=e.transport??"HTTP",r=i=>t.onChange({...e,...i}),a=i=>t.onChange({transport:i});return c.jsxs("div",{className:"row-form",children:[c.jsx(X,{label:"Transport",children:c.jsx(rn,{value:n,onChange:a,options:hO,disabled:t.disabled})}),n==="HTTP"&&c.jsxs(c.Fragment,{children:[c.jsx(X,{label:"HTTP method",children:c.jsx(rn,{value:e.method,onChange:i=>r({method:i}),options:vO,disabled:t.disabled})}),c.jsx(X,{label:"Path",children:c.jsx(Be,{value:e.path??"",onChange:i=>r({path:i}),placeholder:"/v1/checkout",disabled:t.disabled})})]}),n==="gRPC"&&c.jsxs(c.Fragment,{children:[c.jsx(X,{label:"Service",children:c.jsx(Be,{value:e.service??"",onChange:i=>r({service:i}),disabled:t.disabled})}),c.jsx(X,{label:"RPC method",children:c.jsx(Be,{value:e.method??"",onChange:i=>r({method:i}),disabled:t.disabled})})]}),n==="GraphQL"&&c.jsxs(c.Fragment,{children:[c.jsx(X,{label:"Operation",children:c.jsx(rn,{value:e.operation,onChange:i=>r({operation:i}),options:pO,disabled:t.disabled})}),c.jsx(X,{label:"Field",children:c.jsx(Be,{value:e.field??"",onChange:i=>r({field:i}),disabled:t.disabled})})]}),n==="MessageBus"&&c.jsxs(c.Fragment,{children:[c.jsx(X,{label:"Topic",children:c.jsx(Be,{value:e.topic??"",onChange:i=>r({topic:i}),disabled:t.disabled})}),c.jsx(X,{label:"Event",children:c.jsx(Be,{value:e.event??"",onChange:i=>r({event:i}),disabled:t.disabled})}),c.jsx(X,{label:"Queue (optional)",children:c.jsx(Be,{value:e.queue??"",onChange:i=>r({queue:i}),disabled:t.disabled})}),c.jsx(X,{label:"Direction",children:c.jsx(rn,{value:e.direction??"subscribe",onChange:i=>r({direction:i}),options:gO,disabled:t.disabled})})]}),n==="NamedPipe"&&c.jsx(X,{label:"Pipe",children:c.jsx(Be,{value:e.pipe??"",onChange:i=>r({pipe:i}),disabled:t.disabled})}),n==="IPC"&&c.jsx(X,{label:"Channel",children:c.jsx(Be,{value:e.channel??"",onChange:i=>r({channel:i}),disabled:t.disabled})}),n==="CLI"&&c.jsx(X,{label:"Command",children:c.jsx(Be,{value:e.command??"",onChange:i=>r({command:i}),disabled:t.disabled})}),n==="JSONRPC"&&c.jsx(X,{label:"JSON-RPC method",children:c.jsx(Be,{value:e.method??"",onChange:i=>r({method:i}),disabled:t.disabled})}),n==="Custom"&&c.jsx(X,{label:"Address",children:c.jsx(Be,{value:e.address??"",onChange:i=>r({address:i}),disabled:t.disabled})})]})}function GO(t){const{projectId:e,sel:n,spec:r,typeSuggestions:a}=t,i=Dt(),[s,o]=A.useState(()=>d1(r)),l=A.useRef(null),u=t.fieldFlags??RO,d=x=>u.get(x);A.useEffect(()=>{o(d1(r))},[r]),A.useEffect(()=>{var E;if(!t.scrollRequest)return;const x=(E=l.current)==null?void 0:E.querySelector(`[data-field="${CSS.escape(t.scrollRequest.field)}"]`);x==null||x.scrollIntoView({behavior:"smooth",block:"center"})},[t.scrollRequest]);const f=A.useMemo(()=>JSON.stringify(s)!==JSON.stringify(r),[s,r]),h=(x,E)=>o(S=>({...S,[x]:E})),v=(x,E,S)=>o(C=>({...C,[x]:(C[x]??[]).map((T,N)=>N===E?{...T,...S}:T)})),p=(x,E,S)=>o(C=>({...C,methods:C.methods.map((T,N)=>N===x?{...T,params:(T.params??[]).map((P,R)=>R===E?{...P,...S}:P)}:T)}));async function y(){const x=WO(n.kind,r,s);if(Object.keys(x).length===0){i.ok("No value changes to save.");return}let E;if(n.kind==="subsystem"&&typeof x.profile=="string"&&x.profile){const S=t.profiles.find(C=>C.id===x.profile);if((S==null?void 0:S.installed)===!1)try{await yt("/web/projects/packs/adopt",{projectId:e,name:S.source}),E=S.source}catch(C){throw C instanceof Du&&C.status===403?new Error(`Can't save — profile “${S.id}” needs pack “${S.source}”, and adopting a pack requires project admin access. Ask a project admin to add the pack, or choose an already-installed profile.`):C}}await Xm(e,"sdd_update_spec",{kind:n.kind,id:n.id,delta:x}),i.ok(E?`Saved ${n.kind} “${n.label}” — adopted pack “${E}” so this profile applies.`:`Saved ${n.kind} “${n.label}”`),t.onSaved()}const b=A.useMemo(()=>bj(yj(mj(t.profiles),t.profiles),s.profile??""),[t.profiles,s.profile]),m=t.profiles.find(x=>x.id===s.profile),g=(m==null?void 0:m.installed)===!1?`Not yet installed in this project — saving will adopt the “${m.source}” pack so this profile applies.`:"Architectural profile (built-in or pack-provided).",w=A.useMemo(()=>[...TO,...a],[a]);return c.jsxs("div",{className:"stack-lg",ref:l,children:[c.jsxs("div",{className:"view-head",children:[c.jsxs("div",{className:"cell-stack",children:[c.jsxs("div",{children:[c.jsx(rt,{tone:"accent",children:n.kind})," ",c.jsx("strong",{children:s.name??n.label})]}),c.jsx("code",{className:"subtle",children:n.id})]}),c.jsx("div",{className:"row-actions",children:c.jsx(Tt,{variant:"primary",action:y,onError:i.bad,disabled:!f,children:"Save changes"})})]}),n.kind==="system"&&c.jsxs("div",{className:"panel stack-lg",children:[c.jsx(X,{label:"Vision",hint:"The system's vision, mission, and core goals.",children:c.jsx("textarea",{className:"input",rows:4,value:s.vision??"",onChange:x=>h("vision",x.target.value)})}),c.jsx(X,{label:"Boundaries",hint:"In / out-of-scope statements that bound the system.",children:c.jsx(h1,{items:s.boundaries??[],onChange:x=>h("boundaries",x),getText:x=>typeof x=="string"?x:(x==null?void 0:x.name)??"",setText:(x,E)=>typeof x=="string"?E:{...x,name:E},placeholder:"e.g. Out of scope: billing & invoicing",addLabel:"boundary"})}),c.jsx(X,{label:"Global requirements",hint:"System-wide requirements every subsystem must honor.",children:c.jsx(h1,{items:s.globalRequirements??[],onChange:x=>h("globalRequirements",x),getText:x=>typeof x=="string"?x:(x==null?void 0:x.description)??"",setText:(x,E)=>typeof x=="string"?E:{...x,description:E},placeholder:"e.g. All PII encrypted at rest",addLabel:"requirement"})}),(s.publicInterfaces??[]).length>0&&c.jsxs("div",{className:"stack-lg",children:[c.jsx("span",{className:"field-label",children:"Public surface entries"}),s.publicInterfaces.map((x,E)=>c.jsxs("div",{className:"sub-card",children:[c.jsx("code",{className:"subtle",children:x.id??x.component??`entry ${E+1}`}),c.jsxs("div",{className:"row-form",children:[c.jsx(X,{label:"Name",children:c.jsx(Be,{value:x.name??"",onChange:S=>v("publicInterfaces",E,{name:S})})}),c.jsx(X,{label:"Type",children:c.jsx(rn,{value:x.type,onChange:S=>v("publicInterfaces",E,{type:S}),options:o1,allowNone:!0})}),c.jsx(X,{label:"Audience",children:c.jsx(rn,{value:x.audience,onChange:S=>v("publicInterfaces",E,{audience:S}),options:mO,allowNone:!0})})]}),c.jsx(X,{label:"Details",children:c.jsx(Be,{value:x.details??"",onChange:S=>v("publicInterfaces",E,{details:S})})})]},E))]})]}),n.kind==="subsystem"&&c.jsxs("div",{className:"panel stack-lg",children:[c.jsxs("div",{className:"row-form",children:[c.jsx(X,{label:"Name",children:c.jsx(Be,{value:s.name??"",onChange:x=>h("name",x)})}),c.jsx(X,{label:"Status",children:c.jsx(rn,{value:s.status,onChange:x=>h("status",x),options:kp})})]}),c.jsx(X,{label:"Description",fieldKey:"description",highlight:d("description"),children:c.jsx("textarea",{className:"input",rows:3,value:s.description??"",onChange:x=>h("description",x.target.value)})}),c.jsxs("div",{className:"row-form",children:[c.jsx(X,{label:"Profile",hint:g,fieldKey:"profile",highlight:d("profile"),children:c.jsx(gj,{value:s.profile??"",onChange:x=>h("profile",x),groups:b,includeNone:!0,noneLabel:"(inherit)"})}),c.jsx(X,{label:"Design depth",children:c.jsx(rn,{value:s.designDepth,onChange:x=>h("designDepth",x),options:dO,allowNone:!0,noneLabel:"(project default)"})}),c.jsx(X,{label:"Target language",children:c.jsx(Be,{value:s.targetLanguage??"",onChange:x=>h("targetLanguage",x),placeholder:"(inherit system)"})})]}),(s.publicInterfaces??[]).length>0&&c.jsxs("div",{className:`stack-lg${d("publicInterfaces")?` field-flag field-flag-${d("publicInterfaces")}`:""}`,"data-field":"publicInterfaces",children:[c.jsx("span",{className:"field-label",children:"Public interfaces"}),s.publicInterfaces.map((x,E)=>c.jsxs("div",{className:"sub-card",children:[c.jsx("code",{className:"subtle",children:x.component?`${x.component}${x.interface?` · ${x.interface}`:""}`:`entry ${E+1}`}),c.jsxs("div",{className:"row-form",children:[c.jsx(X,{label:"Type",children:c.jsx(rn,{value:x.type,onChange:S=>v("publicInterfaces",E,{type:S}),options:o1})}),c.jsx(X,{label:"Details",children:c.jsx(Be,{value:x.details??"",onChange:S=>v("publicInterfaces",E,{details:S})})})]})]},E))]}),(s.lifecycle??[]).length>0&&c.jsxs("div",{className:"stack-lg",children:[c.jsx("span",{className:"field-label",children:"Lifecycle entrypoints"}),s.lifecycle.map((x,E)=>c.jsxs("div",{className:"sub-card",children:[c.jsxs("div",{className:"row-form",children:[c.jsx(X,{label:"Phase",hint:"Identity — read-only.",children:c.jsx(rn,{value:x.phase,onChange:()=>{},options:["init","shutdown","cyclic","interrupt","scheduled"],disabled:!0})}),c.jsx(X,{label:"Component · method",children:c.jsxs("code",{className:"preview-id",children:[x.component,".",x.method]})})]}),c.jsx(X,{label:"Description",children:c.jsx(Be,{value:x.description??"",onChange:S=>v("lifecycle",E,{description:S})})})]},E))]})]}),n.kind==="component"&&c.jsxs("div",{className:"panel stack-lg",children:[c.jsxs("div",{className:"row-form",children:[c.jsx(X,{label:"Name",children:c.jsx(Be,{value:s.name??"",onChange:x=>h("name",x)})}),c.jsx(X,{label:"Status",children:c.jsx(rn,{value:s.status,onChange:x=>h("status",x),options:kp})})]}),c.jsx(X,{label:"Description",fieldKey:"description",highlight:d("description"),children:c.jsx("textarea",{className:"input",rows:3,value:s.description??"",onChange:x=>h("description",x.target.value)})}),c.jsxs("div",{className:"row-form",children:[c.jsx(X,{label:"Component type",fieldKey:"componentType",highlight:d("componentType"),children:c.jsx(en,{value:s.componentType??"",onChange:x=>h("componentType",x),options:IO(s.componentType)})}),s.componentType==="Portal"&&c.jsx(X,{label:"Transport",children:c.jsx(rn,{value:s.transport,onChange:x=>h("transport",x),options:uO,allowNone:!0})}),s.componentType==="Store"&&c.jsx(X,{label:"Durability",fieldKey:"durability",highlight:d("durability"),children:c.jsx(rn,{value:s.durability,onChange:x=>h("durability",x),options:cO,allowNone:!0})})]}),s.componentType==="Portal"&&c.jsx(X,{label:"Base path",hint:"Prefix all this portal's endpoints mount under (the OpenAPI server url).",children:c.jsx(Be,{value:s.basePath??"",onChange:x=>h("basePath",x),placeholder:"/v1"})}),s.componentType==="Portal"&&c.jsx(X,{label:"Authentication",hint:"This portal's API auth — projected into its OpenAPI securitySchemes/security. Each public portal becomes its own named OpenAPI spec.",children:c.jsx(DO,{auth:s.auth,onChange:x=>h("auth",x)})}),c.jsx(X,{label:"External links",hint:"Opaque URLs wairon does not fetch. An 'implementation' link is the external source-of-record (a Make scenario, cloud console, GitHub file) and satisfies the source requirement — no MISSING_SOURCE_PATH.",children:c.jsx(AO,{links:s.externalLinks??[],onChange:x=>h("externalLinks",x)})})]}),n.kind==="interface"&&c.jsxs("div",{className:"panel stack-lg",children:[c.jsx("div",{className:"row-form",children:c.jsx(X,{label:"Name",children:c.jsx(Be,{value:s.name??"",onChange:x=>h("name",x)})})}),c.jsx(X,{label:"Description",fieldKey:"description",highlight:d("description"),children:c.jsx("textarea",{className:"input",rows:3,value:s.description??"",onChange:x=>h("description",x.target.value)})}),(s.methods??[]).length>0&&c.jsxs("div",{className:"stack-lg",children:[c.jsx("span",{className:"field-label",children:"Methods"}),s.methods.map((x,E)=>{var S;return c.jsxs("div",{className:"sub-card",children:[c.jsx("code",{className:"subtle",children:x.name}),c.jsx(X,{label:"Description",children:c.jsx(Be,{value:x.description??"",onChange:C=>v("methods",E,{description:C})})}),c.jsx(X,{label:"Signature from",hint:"A signature type, or a component.method this component reaches — the method then states no params or returns of its own.",children:c.jsx(Be,{value:x.signatureFrom??"",onChange:C=>v("methods",E,{signatureFrom:C}),placeholder:"e.g. billing_registry.create"})}),c.jsxs("div",{className:"row-form",children:[x.signatureFrom?c.jsx(X,{label:"Signature (from its source)",children:c.jsx(Be,{value:((S=(s.resolvedSignatures??[]).find(C=>C.method===x.name))==null?void 0:S.signature)??"",onChange:()=>{},disabled:!0})}):c.jsx(X,{label:(x.params??[]).length>0?"Signature (derived from params)":"Signature",children:c.jsx(Be,{value:x.signature??"",onChange:C=>v("methods",E,{signature:C}),disabled:(x.params??[]).length>0})}),!x.signatureFrom&&c.jsx(X,{label:"Returns",children:c.jsx(Be,{value:x.returns??"",onChange:C=>v("methods",E,{returns:C})})}),c.jsx(X,{label:"Effect",children:c.jsx(rn,{value:x.effect,onChange:C=>v("methods",E,{effect:C}),options:fO,allowNone:!0})})]}),c.jsx(X,{label:"Guarantees",hint:"Builtin tokens plus any pack-declared ones.",children:c.jsx(f1,{values:x.guarantees??[],onChange:C=>v("methods",E,{guarantees:C}),suggestions:CO})}),!x.signatureFrom&&(x.params??[]).length>0&&c.jsxs("div",{className:"stack-lg",children:[c.jsx("span",{className:"hint",children:"Parameters"}),x.params.map((C,T)=>c.jsxs("div",{className:"row-form",children:[c.jsx(X,{label:`Param · ${C.name}`,children:c.jsx(Ep,{value:C.type,onChange:N=>p(E,T,{type:N}),suggestions:w,placeholder:"type"})}),c.jsx(X,{label:"Description",children:c.jsx(Be,{value:C.description??"",onChange:N=>p(E,T,{description:N})})}),c.jsx(X,{label:"Optional",children:c.jsx(yu,{checked:!!C.optional,onChange:N=>p(E,T,{optional:N}),label:""})})]},C.name))]}),x.endpoint!==void 0&&c.jsx(X,{label:"Endpoint",children:c.jsx(KO,{endpoint:x.endpoint,onChange:C=>v("methods",E,{endpoint:C})})})]},x.name)})]})]}),n.kind==="implementation"&&c.jsxs("div",{className:"panel stack-lg",children:[c.jsxs("div",{className:"row-form",children:[c.jsx(X,{label:"Name",children:c.jsx(Be,{value:s.name??"",onChange:x=>h("name",x)})}),c.jsx(X,{label:"Status",children:c.jsx(rn,{value:s.status,onChange:x=>h("status",x),options:kp})})]}),c.jsx(X,{label:"Description",fieldKey:"description",highlight:d("description"),children:c.jsx("textarea",{className:"input",rows:3,value:s.description??"",onChange:x=>h("description",x.target.value)})}),c.jsxs("div",{className:"row-form",children:[c.jsx(X,{label:"Narrative detail (default)",children:c.jsx(rn,{value:s.detail,onChange:x=>h("detail",x),options:l1,allowNone:!0,noneLabel:"(stereotype default)"})}),c.jsx(X,{label:"Conformance (default)",children:c.jsx(rn,{value:s.conformance,onChange:x=>h("conformance",x),options:u1,allowNone:!0,noneLabel:"(stereotype default)"})})]}),c.jsx(X,{label:"Technologies",hint:"External technologies this implementation binds to.",children:c.jsx(f1,{values:(s.technologies??[]).map(p1),onChange:x=>h("technologies",x.map(E=>(s.technologies??[]).find(S=>p1(S)===E)??E)),placeholder:"e.g. mysql, sendgrid…"})}),(s.methods??[]).length>0&&c.jsxs("div",{className:"stack-lg",children:[c.jsx("span",{className:"field-label",children:"Methods"}),s.methods.map((x,E)=>{var S;return c.jsxs("div",{className:"sub-card",children:[c.jsxs("div",{className:"method-head",children:[c.jsx("code",{className:"subtle",children:x.name}),t.onViewFlow&&(((S=x.narrative)==null?void 0:S.length)??0)>0&&c.jsx("button",{type:"button",className:"btn btn-ghost btn-sm",onClick:()=>t.onViewFlow(x.name),title:"Open this method's narrative flow in the canvas",children:"flow ↗"})]}),c.jsxs("div",{className:"row-form",children:[c.jsx(X,{label:"Detail",children:c.jsx(rn,{value:x.detail,onChange:C=>v("methods",E,{detail:C}),options:l1,allowNone:!0,noneLabel:"(spec default)"})}),c.jsx(X,{label:"Conformance",children:c.jsx(rn,{value:x.conformance,onChange:C=>v("methods",E,{conformance:C}),options:u1,allowNone:!0,noneLabel:"(spec default)"})})]}),c.jsx(X,{label:"Intent",hint:"Behavioral prose — the narrative substitute at detail: intent.",children:c.jsx("textarea",{className:"input",rows:2,value:x.intent??"",onChange:C=>v("methods",E,{intent:C.target.value})})})]},x.name)})]})]}),n.kind==="type"&&c.jsxs("div",{className:"panel stack-lg",children:[c.jsxs("div",{className:"row-form",children:[c.jsx(X,{label:"Name",children:c.jsx(Be,{value:s.name??"",onChange:x=>h("name",x)})}),c.jsx(X,{label:"Kind",children:c.jsx(rn,{value:s.kind,onChange:x=>h("kind",x),options:s.kind==="signature"?["signature"]:wO,disabled:s.kind==="signature"})})]}),s.kind==="signature"&&c.jsx(X,{label:"Signature (derived from params and returns)",children:c.jsx(Be,{value:`(${(s.params??[]).map(x=>`${x.name}${x.optional?"?":""}: ${x.type}`).join(", ")}): ${s.returns??"any"}`,onChange:()=>{},disabled:!0})}),c.jsx(X,{label:"Description",fieldKey:"description",highlight:d("description"),children:c.jsx("textarea",{className:"input",rows:3,value:s.description??"",onChange:x=>h("description",x.target.value)})}),s.kind==="value-object"&&(s.fields??[]).length===0&&c.jsx(X,{label:"Holds",fieldKey:"holds",highlight:d("holds"),hint:"A named scalar: one primitive under this name, in place of fields (a newtype or type alias in every language).",children:c.jsx(rn,{value:s.holds,onChange:x=>h("holds",x||void 0),options:EO,allowNone:!0,noneLabel:"(not a named scalar)"})}),s.kind==="enum"&&(s.values??[]).length>0&&c.jsxs("div",{className:"stack-lg",children:[c.jsx("span",{className:"field-label",children:"Values (in declared order)"}),s.values.map((x,E)=>c.jsxs("div",{className:"sub-card",children:[c.jsx("code",{className:"subtle",children:x.name}),c.jsx("div",{className:"row-form",children:c.jsx(X,{label:"Description",children:c.jsx(Be,{value:x.description??"",onChange:S=>v("values",E,{description:S})})})})]},x.name))]}),(s.fields??[]).length>0&&c.jsxs("div",{className:"stack-lg",children:[c.jsx("span",{className:"field-label",children:"Fields"}),s.fields.map((x,E)=>c.jsxs("div",{className:"sub-card",children:[c.jsx("code",{className:"subtle",children:x.name}),c.jsxs("div",{className:"row-form",children:[c.jsx(X,{label:"Type",children:c.jsx(Ep,{value:x.type,onChange:S=>v("fields",E,{type:S}),suggestions:w})}),c.jsx(X,{label:"Key",children:c.jsx(rn,{value:x.key,onChange:S=>v("fields",E,{key:S}),options:kO,allowNone:!0})}),c.jsx(X,{label:"Optional",children:c.jsx(yu,{checked:!!x.optional,onChange:S=>v("fields",E,{optional:S}),label:""})})]}),c.jsxs("div",{className:"row-form",children:[c.jsx(X,{label:"Description",children:c.jsx(Be,{value:x.description??"",onChange:S=>v("fields",E,{description:S})})}),c.jsx(X,{label:"References (FK)",children:c.jsx(Ep,{value:x.references,onChange:S=>v("fields",E,{references:S}),suggestions:a,placeholder:"e.g. billing.Invoice.id"})})]})]},x.name))]})]})]})}function xj(t){const{projectId:e,sel:n}=t,r=St(()=>Xm(e,"sdd_get_spec",{kind:n.kind,id:n.id}),[e,n.kind,n.id]);return c.jsx(Xt,{state:r,children:a=>c.jsx(GO,{projectId:e,sel:n,spec:a,typeSuggestions:t.typeSuggestions,profiles:t.profiles,onViewFlow:t.onViewFlow,fieldFlags:t.fieldFlags,scrollRequest:t.scrollRequest,onSaved:()=>{r.reload(),t.onGraphChange()}},`${n.kind}:${n.id}`)})}function YO(t){const{graph:e,activeComponentId:n,selected:r,onSelect:a}=t,[i,s]=A.useState(new Set),o=e.nodes??[],l=o.find(E=>E.kind==="project"),u=o.filter(E=>E.kind==="subsystem").sort(ko),d=o.filter(E=>E.kind==="type").sort(ko),f=o.filter(E=>E.kind==="component"),h=new Set(f.map(E=>E.id)),v=new Map,p=new Map;for(const E of e.edges??[]){if(E.edgeKind!=="owns"||!h.has(E.from)||!h.has(E.to))continue;v.set(E.to,E.from);const S=f.find(C=>C.id===E.to);S&&p.set(E.from,[...p.get(E.from)??[],S])}const y=E=>f.filter(S=>S.parentId===E&&!v.has(S.id)).sort(ko),b=E=>(p.get(E)??[]).slice().sort(ko),m=E=>s(S=>{const C=new Set(S);return C.has(E)?C.delete(E):C.add(E),C}),g=E=>a({kind:"component",id:E.id,label:E.label}),w=E=>c.jsxs("div",{className:"tree-row",style:{paddingLeft:6+E.depth*14},children:[E.hasKids?c.jsx("button",{className:"tree-caret","aria-label":"expand",onClick:()=>m(E.id),children:i.has(E.id)?"▸":"▾"}):c.jsx("span",{className:"tree-caret-spacer"}),c.jsxs("button",{className:`tree-label ${(r==null?void 0:r.kind)===E.kind&&(r==null?void 0:r.id)===E.id?"sel":""}`,onClick:()=>a({kind:E.kind,id:E.id,label:E.label}),title:E.id,children:[c.jsx("span",{className:`tree-kind k-${E.kind}`,children:E.kind[0].toUpperCase()}),c.jsx("span",{className:"tree-name",children:E.label})]})]}),x=(E,S)=>{const C=b(E.id),T=!i.has(E.id);return c.jsxs("div",{children:[c.jsxs("div",{className:"tree-row",style:{paddingLeft:6+S*14},children:[C.length?c.jsx("button",{className:"tree-caret","aria-label":"expand",onClick:()=>m(E.id),children:T?"▾":"▸"}):c.jsx("span",{className:"tree-caret-spacer"}),c.jsxs("button",{className:`tree-label ${n===E.id?"sel":""}`,onClick:()=>g(E),title:E.id,children:[c.jsx("span",{className:"tree-kind k-component",children:"C"}),c.jsx("span",{className:"tree-name",children:E.label})]})]}),T&&C.map(N=>x(N,S+1))]},E.id)};return c.jsx("div",{className:"spec-picker",children:c.jsxs("div",{className:"spec-tree",children:[l&&c.jsx(w,{kind:"system",id:l.id,label:l.label,depth:0}),u.map(E=>{const S=y(E.id);return c.jsxs("div",{children:[c.jsx(w,{kind:"subsystem",id:E.id,label:E.label,depth:0,hasKids:S.length>0}),!i.has(E.id)&&S.map(C=>x(C,1))]},E.id)}),d.length>0&&c.jsxs("div",{className:"tree-section",children:[c.jsx("span",{className:"tree-section-head",children:"Types"}),d.map(E=>c.jsx(w,{kind:"type",id:E.id,label:E.label,depth:0},E.id))]})]})})}function XO(t){var v;const{componentId:e,selection:n,nodes:r}=t,a=Pr(),i=r.find(p=>p.id===e),s=i!=null&&i.parentId?i.parentId.split("::").map(encodeURIComponent).join("/"):"",o=`/canvas/${encodeURIComponent(t.projectId)}${s?"/"+s:""}`,l=r.filter(p=>p.kind==="interface"&&p.parentId===e).sort(ko),u=r.filter(p=>p.kind==="implementation"&&p.parentId===e).sort(ko),d=[{key:"component",label:"Component",sel:{kind:"component",id:e}},...l.map(p=>({key:`i:${p.id}`,label:l.length>1?p.label:"Interface",sel:{kind:"interface",id:p.id}})),...u.length?u.map(p=>({key:`m:${p.id}`,label:u.length>1?p.label:"Implementation",sel:{kind:"implementation",id:p.id}})):[{key:"no-impl",label:"Implementation",disabled:!0}]],f=n.kind==="interface"?`i:${n.id}`:n.kind==="implementation"?`m:${n.id}`:"component",h=(v=d.find(p=>p.key===f))==null?void 0:v.disabled;return c.jsxs("div",{className:"stack-lg",children:[c.jsxs("div",{className:"unit-head",children:[c.jsx(rt,{tone:"accent",children:"component"})," ",c.jsx("strong",{children:(i==null?void 0:i.label)??e}),c.jsx("code",{className:"subtle",children:e}),c.jsx("button",{type:"button",className:"btn btn-ghost btn-sm",onClick:()=>a(`${o}#focus=${e}`),title:"View this component in the canvas (in its subsystem)",children:"Open in canvas ↗"})]}),c.jsx("div",{className:"tabstrip",role:"tablist",children:d.map(p=>c.jsx("button",{role:"tab","aria-selected":p.key===f,className:`tab ${p.key===f?"tab-active":""}`,disabled:p.disabled,title:p.disabled?"No implementation defined yet":void 0,onClick:()=>p.sel&&t.onSelectSpec(p.sel),children:p.label},p.key))}),h?c.jsx(Nf,{children:"No implementation is defined for this component yet."}):c.jsx(xj,{projectId:t.projectId,sel:n,typeSuggestions:t.typeSuggestions,profiles:t.profiles,onViewFlow:p=>a(`${o}#flow=${e}~${p}`),onGraphChange:t.onGraphChange,fieldFlags:t.fieldFlags,scrollRequest:t.scrollRequest},`${n.kind}:${n.id}`)]})}function QO(t){var f,h,v,p;const e=Dt(),n=t.config.data,[r,a]=A.useState((n==null?void 0:n.projectType)??"backend");if(A.useEffect(()=>a((n==null?void 0:n.projectType)??"backend"),[n==null?void 0:n.projectType]),!n)return null;const i=!!n.locked,s=yj([...mj(t.profiles),{label:"Project kinds",options:SO.map(y=>({value:y,label:y}))}],t.profiles),o=bj(s,r),l=t.profiles.find(y=>y.id===r),u=(l==null?void 0:l.installed)===!1?`Not yet installed in this project — saving will adopt the “${l.source}” pack so this profile applies.`:"Configures targeted rules/templates for the whole project.";async function d(){const y=await yt("/web/projects/config",{projectId:t.projectId,projectType:r});e.ok(y.adoptedPackName?`Project type saved — adopted pack “${y.adoptedPackName}” so this profile applies.`:"Project type saved"),t.config.reload()}return c.jsxs("div",{className:"panel stack-lg",children:[i&&c.jsx("div",{className:"lock-banner",children:"This project is approved — saving a spec change puts this spec back in flux until it is approved again."}),n.profileResolvable===!1&&c.jsxs("div",{className:"lock-banner",children:["The recorded project type “",n.projectType,"” doesn't resolve to a loaded profile, so its rules aren't being applied. Pick a profile from the list below to fix this."]}),c.jsxs("div",{className:"row-form",children:[c.jsx(X,{label:"Project type",hint:u,children:c.jsx(gj,{value:r,onChange:a,groups:o})}),c.jsx("div",{className:"row-form-action",children:c.jsx(Tt,{variant:"primary",action:d,onError:e.bad,disabled:r===(n.projectType??"backend"),children:"Save type"})})]}),(!!((f=n.unappliedProfileIds)!=null&&f.length)||!!((h=n.overridingSubsystemIds)!=null&&h.length))&&c.jsxs("div",{className:"stack-sm",children:[!!((v=n.unappliedProfileIds)!=null&&v.length)&&c.jsxs("span",{className:"hint",children:["Also recorded but not applied at the project level (these govern individual subsystems instead): ",n.unappliedProfileIds.join(", "),"."]}),!!((p=n.overridingSubsystemIds)!=null&&p.length)&&c.jsxs("span",{className:"hint",children:[n.overridingSubsystemIds.length," subsystem",n.overridingSubsystemIds.length===1?" declares its":"s declare their"," own profile and ",n.overridingSubsystemIds.length===1?"isn't":"aren't"," governed by the project type: ",n.overridingSubsystemIds.join(", "),"."]})]})]})}function wj({projectId:t,selection:e,onSelectSpec:n}){const r=encodeURIComponent(t),[a,i]=A.useState(null),s=St(()=>Et(`/web/graph?tier=project&projectId=${r}&level=4`),[t],[`project:${t}`]),o=St(()=>Et(`/web/projects/config?projectId=${r}`).catch(()=>null),[t]),l=St(()=>Et(`/web/projects/profiles?projectId=${r}`).then(E=>Vo(E,"profiles")).catch(()=>jO.map(E=>({id:E,source:"builtin",installed:!0}))),[t]),u=A.useMemo(()=>{var E;return(((E=s.data)==null?void 0:E.nodes)??[]).filter(S=>S.kind==="type").map(S=>S.id)},[s.data]),d=A.useMemo(()=>{var S;if(!e)return null;const E=(((S=s.data)==null?void 0:S.nodes)??[]).find(C=>C.id===e.id);return{kind:e.kind,id:e.id,label:(E==null?void 0:E.label)??e.id}},[e,s.data]),f=A.useMemo(()=>{var E,S;return e?e.kind==="component"?e.id:e.kind==="interface"||e.kind==="implementation"?((S=(((E=s.data)==null?void 0:E.nodes)??[]).find(C=>C.id===e.id))==null?void 0:S.parentId)??null:null:null},[e,s.data]),h=A.useMemo(()=>{var E;if(!d)return null;if(d.kind==="component"||d.kind==="interface"||d.kind==="implementation"){const S=new Set([d.id]);if(f){S.add(f);for(const C of((E=s.data)==null?void 0:E.nodes)??[])(C.kind==="interface"||C.kind==="implementation")&&C.parentId===f&&S.add(C.id)}return{ids:S,noun:"component"}}return{ids:new Set([d.id]),noun:d.kind}},[d,f,s.data]),[v,p]=A.useState(!1),y=h?[...h.ids].sort().join("|"):null;A.useEffect(()=>{p(!1)},[y]);const[b,m]=A.useState(null),g=E=>m(S=>({field:E,nonce:((S==null?void 0:S.nonce)??0)+1})),w=A.useMemo(()=>{const E=new Map;if(!a||!d)return E;for(const S of a.errors){if(S.specId!==d.id)continue;const C=cd[S.code];C&&E.set(C,"error")}for(const S of a.warnings){if(S.specId!==d.id)continue;const C=cd[S.code];C&&E.get(C)!=="error"&&E.set(C,"warning")}for(const S of a.notices){if(S.specId!==d.id)continue;const C=cd[S.code];C&&!E.has(C)&&E.set(C,"notice")}return E},[a,d]);async function x(){const E=await Xm(t,"sdd_validate_tree",{});i({errors:E.errors??[],warnings:E.warnings??[],notices:E.notices??[]})}return c.jsxs("div",{className:"stack-lg",children:[c.jsx(QO,{projectId:t,config:o,profiles:l.data??[]}),c.jsx(Xt,{state:s,children:E=>c.jsxs("div",{className:"spec-layout",children:[c.jsx(YO,{graph:E,activeComponentId:f,selected:d,onSelect:S=>n({kind:S.kind,id:S.id})}),c.jsx("div",{className:"spec-detail",children:d?["component","interface","implementation"].includes(d.kind)&&f?c.jsx(XO,{projectId:t,componentId:f,selection:d,nodes:E.nodes??[],typeSuggestions:u,profiles:l.data??[],onSelectSpec:n,onGraphChange:()=>{s.reload(),i(null),l.reload()},fieldFlags:w,scrollRequest:b}):c.jsx(xj,{projectId:t,sel:d,typeSuggestions:u,profiles:l.data??[],onGraphChange:()=>{s.reload(),i(null),l.reload()},fieldFlags:w,scrollRequest:b}):c.jsx(Nf,{children:l.loading?c.jsx(Tf,{}):"Select a component on the left to view and edit its specs."})}),c.jsx(zO,{validation:a,onValidate:x,nodes:E.nodes??[],onSelectSpec:n,scope:h,showAll:v,onToggleShowAll:()=>p(S=>!S),openSpecId:(d==null?void 0:d.id)??null,onRequestScroll:g})]})})]})}function p1(t){return typeof t=="string"?t:String((t==null?void 0:t.name)??"")}const nf=t=>`${t.errors} errors · ${t.warnings} warnings · ${t.notices} notices`;function g1({changes:t}){if(t.length===0)return c.jsx("p",{className:"hint",children:"No changes against wairon's defaults."});const e=new Map;for(const n of t)e.set(n.profile??"",[...e.get(n.profile??"")??[],n]);return c.jsx("div",{className:"stack-sm",children:[...e].map(([n,r])=>c.jsxs("div",{className:"cell-stack",children:[c.jsx("strong",{children:n===""?"Pack-wide":c.jsxs(c.Fragment,{children:["Profile ",c.jsx("code",{children:n})]})}),c.jsx("ul",{className:"finding-list",children:r.map((a,i)=>c.jsxs("li",{children:[c.jsxs(rt,{tone:a.axis==="rule"?"neutral":"accent",children:[a.axis," ",a.change]})," ",c.jsx("code",{children:a.subject}),(a.from!==void 0||a.to!==void 0)&&c.jsxs("span",{className:"hint",children:[" (",a.from??"—"," → ",a.to??"—",")"]}),a.reason&&c.jsxs("span",{className:"hint",children:[" — ",a.reason]})]},i))})]},n||"(pack-wide)"))})}function Cp({mark:t,finding:e,note:n}){const r=e.severity==="error"?"bad":e.severity==="warning"?"warn":"neutral";return c.jsxs("li",{children:[c.jsx("code",{children:t})," ",c.jsx(rt,{tone:r,children:e.severity})," ",c.jsx("code",{children:e.code}),e.specId&&c.jsxs("span",{className:"subtle",children:[" ",e.specId]})," ",n?c.jsx("span",{className:"hint",children:n}):e.message]})}function kj({impact:t}){const e=t.direction==="remove",n=t.findings;return c.jsxs("div",{className:"stack-lg",children:[c.jsxs("div",{className:"cell-stack",children:[c.jsxs("strong",{children:[t.pack,t.version?` v${t.version}`:"",t.replaces?` (replaces v${t.replaces})`:""]}),c.jsx("span",{className:"hint",children:e?"Measured as removed: the findings are what the pack accounts for on this project now.":"Measured as applied. Nothing has been written. Changes are stated, never judged."})]}),c.jsxs("div",{className:"panel",children:[c.jsx("h4",{children:"What it changes against wairon's defaults"}),c.jsx(g1,{changes:t.doctrine}),t.previousDoctrine&&c.jsxs("details",{children:[c.jsxs("summary",{className:"hint",children:["What the replaced version",t.replaces?` v${t.replaces}`:""," changed"]}),c.jsx(g1,{changes:t.previousDoctrine})]})]}),c.jsxs("dl",{className:"kv",children:[c.jsx("dt",{children:"Governs here"}),c.jsx("dd",{children:t.governing.length>0?t.governing.map(r=>c.jsxs("code",{children:[r," "]},r)):c.jsx("span",{className:"hint",children:"none of its profiles"})}),c.jsx("dt",{children:"Before"}),c.jsx("dd",{children:nf(t.before)}),c.jsx("dt",{children:"After"}),c.jsx("dd",{children:nf(t.after)})]}),c.jsxs("div",{className:"panel",children:[c.jsxs("h4",{children:["Findings on this project",e?" once it no longer applies":"",": ",n.introduced.length," introduced, ",n.resolved.length," resolved,"," ",n.regraded.length," regraded"]}),n.introduced.length+n.resolved.length+n.regraded.length===0?c.jsx("p",{className:"hint",children:"No finding changes."}):c.jsxs("ul",{className:"finding-list",children:[n.introduced.map((r,a)=>c.jsx(Cp,{mark:"+",finding:r},`i${a}`)),n.resolved.map((r,a)=>c.jsx(Cp,{mark:"−",finding:r},`r${a}`)),n.regraded.map((r,a)=>c.jsx(Cp,{mark:"~",finding:r.finding,note:`was ${r.from}`},`g${a}`))]})]})]})}function rf({impact:t}){const e=t.findings;return c.jsxs("details",{className:"panel",children:[c.jsxs("summary",{children:[c.jsxs("strong",{children:[t.pack,t.version?` v${t.version}`:""]}),c.jsxs("span",{className:"hint",children:[" ","— ",t.doctrine.length," doctrine change(s); findings ",e.introduced.length," introduced, ",e.resolved.length," resolved,"," ",e.regraded.length," regraded; ",nf(t.before)," → ",nf(t.after)]})]}),c.jsx(kj,{impact:t})]})}function ZO(t){const[e,n]=A.useState(null),[r,a]=A.useState(null),[i,s]=A.useState(0),{measure:o}=t;A.useEffect(()=>{if(!o)return;let u=!0;return n(null),a(null),o().then(d=>u&&n(d)).catch(d=>u&&a(d instanceof Error?d.message:String(d))),()=>{u=!1}},[i]);const l=!o||e!==null;return c.jsx($n,{title:t.title,wide:!0,onClose:t.onClose,footer:c.jsxs(c.Fragment,{children:[c.jsx(ct,{variant:"ghost",onClick:t.onClose,children:"Cancel"}),c.jsx(Tt,{variant:"primary",disabled:!l,onError:t.onError,action:async()=>{await t.apply(),t.onClose()},children:t.confirmLabel})]}),children:o?r?c.jsxs(uC,{onRetry:()=>s(u=>u+1),children:["Could not measure the impact: ",r,". Nothing was written."]}):e?c.jsx(kj,{impact:e}):c.jsxs("div",{className:"pad",children:[c.jsx(Tf,{})," ",c.jsx("span",{className:"hint",children:"Measuring what this would change…"})]}):c.jsx("p",{className:"hint",children:t.unavailable??"Impact not available for this write."})})}const JO=t=>{var e;return((e=t.profileIds)==null?void 0:e.length)??t.profiles??0},e5=t=>{var e;return((e=t.languageIds)==null?void 0:e.length)??t.languages??0},t5=t=>{var e;return((e=t.ruleIds)==null?void 0:e.length)??t.rules??0},m1=t=>`${JO(t)} profiles · ${e5(t)} langs · ${t5(t)} rules`;function n5({projectId:t}){const e=Dt(),n=encodeURIComponent(t),r=St(()=>Et(`/web/projects/packs?projectId=${n}`).then(I=>Vo(I,"packs")),[t]),a=St(()=>Et(`/web/projects/packs/adoptable?projectId=${n}`).then(I=>Vo(I,"packs")),[t]),[i,s]=A.useState(!1),[o,l]=A.useState(!1),[u,d]=A.useState(!1),[f,h]=A.useState(null),[v,p]=A.useState(""),[y,b]=A.useState(""),[m,g]=A.useState(""),[w,x]=A.useState(null),E=new Set((r.data??[]).map(I=>I.name)),S=(a.data??[]).filter(I=>!E.has(I.name));function C(){r.reload(),a.reload()}function T(I){s(!1),x({title:`Adopt “${I}” into ${t}?`,confirmLabel:"Adopt",measure:()=>yt("/web/projects/packs/impact",{projectId:t,name:I}),apply:async()=>{await yt("/web/projects/packs/adopt",{projectId:t,name:I}),e.ok(`Added “${I}”`),C()}})}function N(){const I=y.trim(),D=m;x({title:`Install “${I}” into ${t}?`,confirmLabel:"Install",measure:()=>yt("/web/projects/packs/impact",{projectId:t,name:I,content:D}),apply:async()=>{const $=await yt("/web/projects/packs",{projectId:t,name:I,content:D});e.ok(`Installed pack “${$.name}”`),d(!1),b(""),g(""),C()}})}function P(){const I=f;I&&x({title:`Install ${I.name} into ${t}?`,confirmLabel:"Install",unavailable:"Impact not available for an archive; install its YAML or adopt it from the catalog to preview.",apply:async()=>{const D=v.trim()?{"X-Wairon-Pack-Name":v.trim()}:{},$=await Ym(`/web/projects/packs/upload?projectId=${n}`,I,D);e.ok(`Installed pack “${$.name}”`),l(!1),h(null),p(""),C()}})}function R(I){x({title:`Remove “${I}” from ${t}?`,confirmLabel:"Remove",measure:()=>yt("/web/projects/packs/removal-impact",{projectId:t,name:I}),apply:async()=>{await yt("/web/projects/packs/remove",{projectId:t,name:I}),e.ok("Pack removed"),C()}})}return c.jsxs("div",{className:"stack-lg",children:[c.jsxs("div",{className:"view-head",children:[c.jsx("p",{className:"hint",children:"Declarative extension packs registered on this project. Every install, adoption and removal shows what it would change first."}),c.jsxs("div",{className:"row-actions",children:[c.jsx(ct,{variant:"ghost",onClick:()=>l(!0),title:"Upload a .wpack archive",children:"Advanced: upload .wpack"}),c.jsx(ct,{variant:"ghost",onClick:()=>d(!0),title:"Install a declarative pack from its YAML",children:"Install from YAML"}),c.jsx(ct,{variant:"primary",onClick:()=>s(!0),children:"+ Add from available"})]})]}),c.jsx(Xt,{state:r,children:I=>c.jsx(Vn,{rowKey:D=>D.name,empty:c.jsxs("div",{className:"cell-stack",children:[c.jsx("span",{children:"No packs installed on this project."}),c.jsx("span",{className:"hint",children:"Use “Add from available” to adopt a server-global pack, or upload a .wpack."})]}),rows:I,columns:[{key:"name",header:"Pack",cell:D=>c.jsxs("div",{className:"cell-stack",children:[c.jsx("strong",{children:D.name}),c.jsx("code",{className:"subtle",children:D.ref}),D.error&&c.jsx("span",{className:"err",children:D.error})]})},{key:"scope",header:"Scope",cell:D=>c.jsx(rt,{tone:D.scope==="global"?"accent":"neutral",children:D.tier??D.scope})},{key:"counts",header:"Contents",cell:D=>c.jsx("span",{className:"hint",children:m1(D)})},{key:"act",header:"",width:"1%",cell:D=>D.scope==="project"?c.jsx(ct,{size:"sm",variant:"ghost",onClick:()=>R(D.name),children:"Remove"}):c.jsx("span",{className:"hint",children:"inherited"})}]})}),i&&c.jsx($n,{title:"Add a pack from the catalog",wide:!0,onClose:()=>s(!1),footer:c.jsx(ct,{variant:"ghost",onClick:()=>s(!1),children:"Done"}),children:c.jsxs("div",{className:"stack-lg",children:[c.jsx("p",{className:"hint",children:"Server-global packs this project can adopt directly — no upload needed."}),c.jsx(Xt,{state:a,children:()=>c.jsx(Vn,{rowKey:I=>I.name,empty:"No more packs available to adopt.",rows:S,columns:[{key:"name",header:"Pack",cell:I=>c.jsxs("div",{className:"cell-stack",children:[c.jsx("strong",{children:I.name}),c.jsx("code",{className:"subtle",children:I.ref})]})},{key:"tier",header:"Tier",cell:I=>c.jsx(rt,{tone:I.scope==="global"?"accent":"neutral",children:I.tier??I.scope})},{key:"counts",header:"Contents",cell:I=>c.jsx("span",{className:"hint",children:m1(I)})},{key:"act",header:"",width:"1%",cell:I=>c.jsx(ct,{size:"sm",variant:"primary",onClick:()=>T(I.name),children:"Add…"})}]})})]})}),o&&c.jsx($n,{title:"Advanced: upload a .wpack",onClose:()=>l(!1),footer:c.jsxs(c.Fragment,{children:[c.jsx(ct,{variant:"ghost",onClick:()=>l(!1),children:"Cancel"}),c.jsx(ct,{variant:"primary",onClick:P,disabled:!f,children:"Install…"})]}),children:c.jsxs("div",{className:"stack-lg",children:[c.jsx("p",{className:"hint",children:"Prefer “Add from available” for catalog packs. Upload is for a pack not yet on this server."}),c.jsx(X,{label:"Pack archive (.wpack)",hint:"Declarative packs only — code packs are installed via the filesystem tier.",children:c.jsx("input",{className:"input",type:"file",accept:".wpack,.zip,application/zip",onChange:I=>{var D;return h(((D=I.target.files)==null?void 0:D[0])??null)}})}),c.jsx(X,{label:"Name override (optional)",hint:"Defaults to the pack name in the archive's manifest.",children:c.jsx(Be,{value:v,onChange:p,placeholder:"my-org-conventions"})})]})}),u&&c.jsx($n,{title:"Install a pack from YAML",wide:!0,onClose:()=>d(!1),footer:c.jsxs(c.Fragment,{children:[c.jsx(ct,{variant:"ghost",onClick:()=>d(!1),children:"Cancel"}),c.jsx(ct,{variant:"primary",onClick:N,disabled:!y.trim()||!m.trim(),children:"Preview impact…"})]}),children:c.jsxs("div",{className:"stack-lg",children:[c.jsx("p",{className:"hint",children:"A declarative pack (profiles, language and platform tables, assertions). You will see what it changes on this project before anything is written."}),c.jsx(X,{label:"Pack name",hint:"Letters, digits, dot, underscore, hyphen — the file it is vendored as.",children:c.jsx(Be,{value:y,onChange:b,placeholder:"my-org-conventions"})}),c.jsx(X,{label:"Pack YAML",children:c.jsx("textarea",{className:"input",rows:12,value:m,onChange:I=>g(I.target.value),placeholder:`name: my-org-conventions
|
|
763
|
+
profiles:
|
|
764
|
+
backend:
|
|
765
|
+
rules: {}`})})]})}),w&&c.jsx(ZO,{title:w.title,confirmLabel:w.confirmLabel,measure:w.measure,unavailable:w.unavailable,apply:w.apply,onClose:()=>x(null),onError:e.bad},w.title)]})}function r5({projectId:t}){const e=Dt(),n=St(()=>Et(`/web/projects/policy?projectId=${encodeURIComponent(t)}`),[t]),[r,a]=A.useState(null);async function i(){const s=await yt("/web/projects/policy/reconcile",{projectId:t});a(s),e.ok(s.impacts&&s.impacts.length>0?`Reconciled — applied ${s.impacts.length} pack(s)`:"Reconciled to policy"),n.reload()}return c.jsx(Xt,{state:n,children:s=>c.jsxs("div",{className:"stack-lg",children:[c.jsxs("div",{className:"view-head",children:[c.jsx("div",{className:"cell-stack",children:c.jsxs("div",{children:[s.compliant?c.jsx(rt,{tone:"ok",children:"compliant"}):c.jsx(rt,{tone:"bad",children:"non-compliant"}),c.jsxs("span",{className:"hint",children:[" · mode: ",s.mode]})]})}),c.jsx(Tt,{variant:"primary",action:i,onError:e.bad,children:"Reconcile to policy"})]}),s.impacts&&s.impacts.length>0&&c.jsxs("div",{className:"panel",children:[c.jsx("h4",{children:"Reconcile would apply"}),c.jsx("p",{className:"hint",children:"The instance policy's required and default packs this project does not have yet, each measured against the project as it stands. Nothing has been written."}),c.jsx("div",{className:"stack-sm",children:s.impacts.map(o=>c.jsx(rf,{impact:o},o.pack))})]}),r&&c.jsxs("div",{className:"panel",children:[c.jsx("h4",{children:"Last reconcile applied"}),r.impacts&&r.impacts.length>0?c.jsx("div",{className:"stack-sm",children:r.impacts.map(o=>c.jsx(rf,{impact:o},o.pack))}):c.jsx("p",{className:"hint",children:"No pack — the project already had every pack the policy requires."})]}),s.messages.length>0?c.jsxs("div",{className:"panel",children:[c.jsx("h4",{children:"Findings"}),c.jsx("ul",{className:"finding-list",children:s.messages.map((o,l)=>c.jsx("li",{children:o},l))})]}):c.jsx("div",{className:"empty-state",children:"No policy findings — this project matches its pack/profile policy."}),(s.missingPackNames.length>0||s.blockedPackNames.length>0||s.missingProfileIds.length>0)&&c.jsxs("div",{className:"chip-row",children:[s.missingPackNames.map(o=>c.jsxs(rt,{tone:"warn",children:["missing pack: ",o]},`m${o}`)),s.blockedPackNames.map(o=>c.jsxs(rt,{tone:"bad",children:["blocked pack: ",o]},`b${o}`)),s.missingProfileIds.map(o=>c.jsxs(rt,{tone:"warn",children:["missing profile: ",o]},`p${o}`))]})]})})}function a5({projectId:t}){const e=Dt(),n=St(()=>Et(`/web/projects/producers?projectId=${encodeURIComponent(t)}`),[t]),[r,a]=A.useState("notion"),[i,s]=A.useState("");async function o(){await yt("/web/projects/producers",{projectId:t,target:r,parentPageId:i}),e.ok(`Configured ${r}`),s(""),n.reload()}async function l(d){await yt("/web/projects/producers/run",{projectId:t,target:d}),e.ok(`Published to ${d}`)}async function u(d){await yt("/web/projects/producers/remove",{projectId:t,target:d}),e.ok("Producer removed"),n.reload()}return c.jsxs("div",{className:"stack-lg",children:[c.jsx("p",{className:"hint",children:"One-way projections of this project's spec tree into external docs (Notion, Miro)."}),c.jsx(Xt,{state:n,children:d=>c.jsx(Vn,{rowKey:f=>f.target,empty:"No producers configured.",rows:d.producers,columns:[{key:"target",header:"Target",cell:f=>c.jsx("strong",{children:f.target})},{key:"page",header:"Parent page",cell:f=>c.jsx("code",{className:"subtle",children:f.parentPageId})},{key:"act",header:"",cell:f=>c.jsxs("div",{className:"row-actions",children:[c.jsx(Tt,{size:"sm",action:()=>l(f.target),onError:e.bad,children:"Publish now"}),c.jsx(Tt,{size:"sm",variant:"ghost",action:()=>u(f.target),onError:e.bad,children:"Remove"})]})}]})}),c.jsxs("div",{className:"panel",children:[c.jsx("h4",{children:"Configure a producer"}),c.jsxs("div",{className:"row-form",children:[c.jsx(X,{label:"Target",children:c.jsx(en,{value:r,onChange:a,options:[{value:"notion",label:"Notion"},{value:"miro",label:"Miro"}]})}),c.jsx(X,{label:"Parent page / board id",children:c.jsx(Be,{value:i,onChange:s,placeholder:"notion page id"})}),c.jsx("div",{className:"row-form-action",children:c.jsx(Tt,{variant:"primary",action:o,onError:e.bad,disabled:!i,children:"Save"})})]})]})]})}function i5({projectId:t}){const e=Dt(),n=St(()=>Et(`/web/projects/git?projectId=${encodeURIComponent(t)}`),[t]),[r,a]=A.useState(""),[i,s]=A.useState("main"),[o,l]=A.useState(""),[u,d]=A.useState("");async function f(){await yt("/web/projects/git",{projectId:t,remote:r,branch:i,pat:o.trim()||void 0}),e.ok("Git backing enabled"),l(""),n.reload()}async function h(){await yt("/web/projects/git/disconnect",{projectId:t}),e.ok("Git backing disabled"),n.reload()}async function v(){await yt("/web/projects/git/commit",{projectId:t,message:u||void 0}),e.ok("Committed & pushed .wai/"),d(""),n.reload()}return c.jsx(Xt,{state:n,children:p=>c.jsxs("div",{className:"stack-lg",children:[c.jsx(vj,{}),p.enabled?c.jsxs("div",{className:"panel",children:[c.jsxs("h4",{children:["Backing repository ",c.jsx(rt,{tone:"ok",children:"enabled"})," ",p.dirty&&c.jsx(rt,{tone:"warn",children:".wai/ dirty"})," ",p.credentialRef?c.jsx(rt,{tone:"ok",children:"own PAT"}):c.jsx(rt,{tone:"neutral",children:"shared token"})]}),c.jsxs("dl",{className:"kv",children:[c.jsx("dt",{children:"Remote"}),c.jsx("dd",{children:c.jsx("code",{children:p.remote})}),c.jsx("dt",{children:"Branch"}),c.jsxs("dd",{children:[c.jsx("code",{children:p.branch}),p.workingBranch&&p.workingBranch!==p.branch?c.jsxs(c.Fragment,{children:[" (working: ",c.jsx("code",{children:p.workingBranch}),")"]}):null]}),c.jsx("dt",{children:"Last sync"}),c.jsx("dd",{children:p.lastSyncAt?new Date(p.lastSyncAt).toLocaleString():c.jsx("span",{className:"hint",children:"never"})}),c.jsx("dt",{children:"Periodic"}),c.jsx("dd",{children:p.periodicSyncMinutes?`every ${p.periodicSyncMinutes} min${p.skipIfClean===!1?"":" (skip if clean)"}`:c.jsx("span",{className:"hint",children:"off"})})]}),c.jsxs("p",{className:"hint",children:["wairon only ever stages the ",c.jsx("code",{children:".wai/"})," tree — never ",c.jsx("code",{children:"git add -A"})," — so this repo is safe to share with the project's own code."]}),c.jsxs("div",{className:"row-form",children:[c.jsx(X,{label:"Commit message (optional)",children:c.jsx(Be,{value:u,onChange:d,placeholder:"Update specs"})}),c.jsx("div",{className:"row-form-action",children:c.jsx(Tt,{variant:"primary",action:v,onError:e.bad,children:"Commit & push .wai/"})})]}),c.jsx("div",{className:"row-actions",children:c.jsx(li,{label:"Disconnect",title:"Disconnect git backing",message:"Stop backing this project's .wai/ to git? The remote repository is left untouched.",confirmLabel:"Disconnect",action:h,onError:e.bad})})]}):c.jsxs("div",{className:"panel",children:[c.jsx("h4",{children:"Bind the project repository"}),c.jsxs("p",{children:[c.jsx(rt,{tone:"warn",children:"not git-backed"})," ",c.jsx("span",{className:"hint",children:"No git binding of its own. A member commits through its family root's repository; a top-level project — a detached member included — needs one enabled here."})]}),c.jsxs("p",{className:"hint",children:["wairon manages only the ",c.jsx("code",{children:".wai/"})," tree inside your existing repository."]}),c.jsxs("div",{className:"row-form",children:[c.jsx(X,{label:"Remote URL",children:c.jsx(Be,{value:r,onChange:a,placeholder:"https://github.com/org/repo.git"})}),c.jsx(X,{label:"Branch",children:c.jsx(Be,{value:i,onChange:s,placeholder:"main"})}),c.jsx(X,{label:"Access token (optional)",info:c.jsx(pj,{}),hint:"A PAT for this repo's org/account. Leave blank to use the shared fallback token. Stored write-only.",children:c.jsx(Be,{type:"password",value:o,onChange:l,placeholder:"github_pat_… / glpat-…"})}),c.jsx("div",{className:"row-form-action",children:c.jsx(Tt,{variant:"primary",action:f,onError:e.bad,disabled:!r,children:"Enable git backing"})})]})]})]})})}function s5({projectId:t}){const e=Dt(),n=encodeURIComponent(t),[r,a]=A.useState(null),[i,s]=A.useState(!1),[o,l]=A.useState(!1),[u,d]=A.useState(null);async function f(){await AP(`/web/projects/tree/export?projectId=${n}${o?"&includeDerived=1":""}`,`${t}.waitree`),e.ok("Spec tree exported")}async function h(){if(!r)return;const v=await Ym(`/web/projects/tree/import?projectId=${n}${i?"&replace=1":""}`,r);d(v),a(null),e.ok(`Imported “${v.projectName}” — ${v.fileCount} file(s)`)}return c.jsxs("div",{className:"stack-lg",children:[c.jsxs("p",{className:"hint",children:["Move this project's whole spec tree — its own ",c.jsx("code",{children:".wai/"})," plus every chained subproject — as a single",c.jsx("code",{children:" .waitree"})," archive. This is the migration path between a local checkout and this instance."]}),c.jsxs("div",{className:"panel",children:[c.jsx("h4",{children:"Export"}),c.jsx("p",{className:"hint",children:"Downloads the authored design: specs, lock, rules, variants, surfaces and packs. Regenerable artifacts (diagrams, generated topology) are rebuilt at the destination and left out by default."}),c.jsxs("label",{className:"toggle-row",children:[c.jsx("input",{type:"checkbox",checked:o,onChange:v=>l(v.target.checked)}),c.jsxs("span",{className:"cell-stack",children:[c.jsx("strong",{children:"Include generated artifacts"}),c.jsx("span",{className:"hint",children:"A larger archive; rarely needed, since the destination regenerates them."})]})]}),c.jsx("div",{className:"row-actions",children:c.jsx(Tt,{variant:"primary",action:f,onError:e.bad,children:"Download .waitree"})})]}),c.jsxs("div",{className:"panel",children:[c.jsx("h4",{children:"Import"}),c.jsxs("p",{className:"hint",children:["Replaces this project's spec tree from an archive. Requires ",c.jsx("code",{children:"project:admin"}),". Executable content is always refused, and the previous tree is moved aside to a backup you can restore by hand."]}),c.jsx(X,{label:"Spec-tree archive (.waitree)",hint:"Produced by an export here, or by `wairon remote pull`.",children:c.jsx("input",{className:"input",type:"file",accept:".waitree,.zip,application/zip",onChange:v=>{var p;return a(((p=v.target.files)==null?void 0:p[0])??null)}})}),c.jsxs("label",{className:"toggle-row",children:[c.jsx("input",{type:"checkbox",checked:i,onChange:v=>s(v.target.checked)}),c.jsxs("span",{className:"cell-stack",children:[c.jsx("strong",{children:"Replace the existing spec tree"}),c.jsx("span",{className:"hint",children:"Required once this project holds authored specs — a freshly created project imports without it."})]})]}),c.jsx("div",{className:"row-actions",children:c.jsx(Tt,{variant:"primary",action:h,onError:e.bad,disabled:!r,children:"Import archive"})}),u&&c.jsxs("dl",{className:"kv",children:[c.jsx("dt",{children:"Imported"}),c.jsxs("dd",{children:[c.jsx("strong",{children:u.projectName})," — ",u.fileCount," file(s)"]}),c.jsx("dt",{children:"Roots"}),c.jsx("dd",{children:u.roots.map(v=>c.jsxs("code",{className:"subtle",children:[v," "]},v))}),c.jsx("dt",{children:"Previous tree"}),c.jsx("dd",{children:u.backupPath?c.jsx("code",{className:"subtle",children:u.backupPath}):c.jsx("span",{className:"hint",children:"none — the project was empty"})})]})]})]})}function o5(t){const e=new Set(t.map(i=>i.id)),n=[],r=new Set,a=(i,s)=>{if(!r.has(i.id)){r.add(i.id),n.push({project:i,depth:s});for(const o of t.filter(l=>l.parentProjectId===i.id))a(o,s+1)}};for(const i of t.filter(s=>!s.parentProjectId||!e.has(s.parentProjectId)))a(i,0);for(const i of t)a(i,0);return n}function l5(t){const e=Pr(),n=t.project.parentProjectId;return n?t.projects.some(a=>a.id===n)?c.jsxs("button",{className:"btn btn-ghost btn-sm back-link",onClick:()=>e(`/projects/${encodeURIComponent(n)}`),children:["↑ member of ",n]}):c.jsx("span",{className:"hint",children:"↑ member of a project outside your view"}):null}function u5(t){const e=Pr(),n=t.projects.filter(r=>r.parentProjectId===t.projectId);return n.length===0?null:c.jsxs("div",{className:"row-actions",style:{justifyContent:"flex-start"},children:[c.jsx("span",{className:"hint",children:"Members:"}),n.map(r=>c.jsxs("button",{className:"btn btn-ghost btn-sm",onClick:()=>e(`/projects/${encodeURIComponent(r.id)}`),children:[r.id,r.memberPath?c.jsxs("code",{className:"subtle",children:[" ",r.memberPath]}):null]},r.id))]})}function c5(t){return t.reachable?t.stale?{tone:"bad",label:"stale"}:t.drifted?{tone:"warn",label:"drifted"}:t.pinned?t.uses.some(e=>e.state==="unavailable")?{tone:"neutral",label:"pinned · not comparable here"}:{tone:"ok",label:"current"}:{tone:"warn",label:"not pinned"}:{tone:"warn",label:t.outOfReach?"out of reach":"unavailable"}}function d5(t){const e=encodeURIComponent(t.projectId),n=St(()=>Et(`/web/projects/externals?projectId=${e}`),[t.projectId],[`project:${t.projectId}`,"projects"]);return c.jsx(Xt,{state:n,children:r=>r.externals.length===0?c.jsx("p",{className:"hint",children:"This project declares no externals."}):c.jsx("div",{className:"stack-sm",children:r.externals.map(a=>{const i=c5(a);return c.jsxs("details",{className:"panel",children:[c.jsxs("summary",{children:[c.jsx("strong",{children:a.alias})," ",c.jsxs("span",{className:"subtle",children:["→ ",a.project]})," ",c.jsx(rt,{tone:i.tone,children:i.label})," ",c.jsx("span",{className:"hint",children:a.sourceKind})]}),a.detail&&c.jsx("p",{className:"hint",children:a.detail}),a.uses.length>0&&c.jsx("ul",{className:"finding-list",children:a.uses.map((s,o)=>c.jsxs("li",{children:[c.jsx("code",{children:[s.publicName,s.member].filter(Boolean).join(".")||"(the external)"})," — ",s.state,s.detail?c.jsxs("span",{className:"hint",children:[" — ",s.detail]}):null]},o))})]},a.alias)})})})}const y1=[{id:"specs",label:"Specs"},{id:"packs",label:"Packs"},{id:"policy",label:"Policy"},{id:"producers",label:"Producers"},{id:"git",label:"Git"},{id:"transfer",label:"Transfer"},{id:"sharing",label:"Sharing"},{id:"relations",label:"Relations"}];function f5(){var v;const t=Ef(),e=t.projectId??"",n=t["*"]??"",r=Pr(),a=`/projects/${encodeURIComponent(e)}`,s=((v=St(()=>Et("/web/projects"),[],["projects"]).data)==null?void 0:v.projects)??[],o=s.find(p=>p.id===e),l=n.split("/").filter(Boolean),u=l[0]&&y1.some(p=>p.id===l[0])?l[0]:"specs",d=A.useMemo(()=>u!=="specs"||l.length<3?null:{kind:l[1],id:l.slice(2).map(decodeURIComponent).join("::")},[n]),f=p=>r(p==="specs"?`${a}/specs`:`${a}/${p}`),h=p=>{if(!p)return r(`${a}/specs`);const y=p.id.split("::").map(encodeURIComponent).join("/");r(`${a}/specs/${p.kind}/${y}`)};return c.jsxs("div",{className:`view-pad ${u==="specs"?"view-pad-wide":""}`,children:[c.jsxs("div",{className:"view-head",children:[c.jsxs("div",{className:"cell-stack",children:[c.jsx("button",{className:"btn btn-ghost btn-sm back-link",onClick:()=>r("/projects"),children:"← Projects"}),o&&c.jsx(l5,{project:o,projects:s}),c.jsxs("h2",{children:[e," · operations"]}),c.jsx(u5,{projectId:e,projects:s})]}),c.jsx(ct,{variant:"ghost",onClick:()=>r(`/canvas/${encodeURIComponent(e)}`),children:"Open canvas"})]}),c.jsx(jf,{tabs:y1,active:u,onSelect:f}),c.jsxs("div",{className:"tab-panel",children:[u==="specs"&&c.jsx(wj,{projectId:e,selection:d,onSelectSpec:h}),u==="packs"&&c.jsx(n5,{projectId:e}),u==="policy"&&c.jsx(r5,{projectId:e}),u==="producers"&&c.jsx(a5,{projectId:e}),u==="git"&&c.jsx(i5,{projectId:e}),u==="transfer"&&c.jsx(s5,{projectId:e}),u==="sharing"&&c.jsx(nO,{projectId:e}),u==="relations"&&c.jsx(d5,{projectId:e})]})]})}function h5(t){return t==="ready"?"ok":t==="locked"?"warn":"neutral"}function v5(t){var u;const e=Dt(),[n,r]=A.useState(""),[a,i]=A.useState(((u=t.units[0])==null?void 0:u.id)??""),[s,o]=A.useState(null);async function l(){var h;const d=await yt("/web/projects",{id:n,unitId:a});e.ok(`Project “${n}” created`),t.onCreated(),(((h=d.packImpacts)==null?void 0:h.length)??0)>0||d.profileImpact!==void 0?o(d):t.onClose()}return s?c.jsx($n,{title:`Project “${s.record.id}” created`,wide:!0,onClose:t.onClose,footer:c.jsx(ct,{variant:"primary",onClick:t.onClose,children:"Done"}),children:c.jsxs("div",{className:"stack-lg",children:[c.jsx("p",{className:"hint",children:"The instance pack policy applied these at creation, each measured before it was written. Changes are stated, never judged — packs exist to adjust wairon's checks."}),s.packImpacts.length>0&&c.jsxs("div",{className:"stack-sm",children:[c.jsx("strong",{children:"Packs applied"}),s.packImpacts.map(d=>c.jsx(rf,{impact:d},d.pack))]}),s.profileImpact&&c.jsxs("div",{className:"stack-sm",children:[c.jsx("strong",{children:"Governing profile"}),c.jsx(rf,{impact:s.profileImpact})]})]})}):c.jsx($n,{title:"New project",onClose:t.onClose,footer:c.jsxs(c.Fragment,{children:[c.jsx(ct,{variant:"ghost",onClick:t.onClose,children:"Cancel"}),c.jsx(Tt,{variant:"primary",action:l,onError:e.bad,disabled:!n||!a,children:"Create"})]}),children:c.jsxs("div",{className:"stack-lg",children:[c.jsx(X,{label:"Project id",hint:"Lowercase identifier, unique on this instance.",children:c.jsx(Be,{value:n,onChange:d=>r(d.toLowerCase()),placeholder:"billing"})}),c.jsx(X,{label:"Owner unit",hint:"Every project belongs to an organization unit.",children:t.units.length===0?c.jsx("span",{className:"hint",children:"No units exist yet — create one under Organization first."}):c.jsx(Xu,{units:t.units,value:a,onChange:i,allowEmpty:!1,placeholder:"Choose the owner unit…"})})]})})}function p5(){var d,f;const t=Dt(),e=Pr(),n=St(()=>Et("/web/projects"),[],["projects"]),r=St(()=>Et("/web/admin/org/units").catch(()=>({units:[]})),[]),[a,i]=A.useState(!1),[s,o]=A.useState(null);async function l(h){await yt("/web/projects/lock",{projectId:h}),t.ok(`Locked ${h}`),n.reload()}async function u(h){await yt("/web/projects/destroy",{id:h}),t.ok(`Destroyed ${h}`),n.reload()}return c.jsxs("div",{className:"view-pad",children:[c.jsxs("div",{className:"view-head",children:[c.jsxs("div",{children:[c.jsx("h2",{children:"Projects"}),c.jsx("p",{className:"hint",children:"Every project you can read, write, or administer. Open one to see its architecture canvas."})]}),c.jsx(ct,{variant:"primary",onClick:()=>i(!0),children:"+ New project"})]}),c.jsx(Xt,{state:n,children:h=>c.jsx(Vn,{rowKey:v=>v.project.id,empty:"No projects in your scope yet.",rows:o5(h.projects),columns:[{key:"id",header:"Project",cell:({project:v,depth:p})=>c.jsxs("div",{className:"cell-stack",style:{paddingLeft:p*18},children:[c.jsxs("strong",{children:[p>0?"↳ ":"",v.id]}),v.parentProjectId&&c.jsxs("span",{className:"hint",children:["member of ",h.projects.some(y=>y.id===v.parentProjectId)?v.parentProjectId:"a project outside your view",v.memberPath?c.jsxs(c.Fragment,{children:[" at ",c.jsx("code",{className:"subtle",children:v.memberPath})]}):null]})]})},{key:"status",header:"Status",cell:({project:v})=>c.jsxs(c.Fragment,{children:[c.jsx(rt,{tone:h5(v.status),children:v.status}),v.status==="disabled"&&v.disabledReason?c.jsxs("span",{className:"hint",children:[" ",v.disabledReason]}):null]})},{key:"unit",header:"Unit",cell:({project:v})=>v.parentProjectId?c.jsx("span",{className:"hint",children:"from its family root"}):c.jsx("button",{className:"btn btn-ghost btn-sm",onClick:()=>o(v),title:"Place this project in an organization unit",children:v.unitId?c.jsx("code",{className:"subtle",children:v.unitId}):c.jsx("span",{className:"hint",children:"— set unit"})})},{key:"act",header:"",cell:({project:v})=>c.jsxs("div",{className:"row-actions",children:[c.jsx(ct,{size:"sm",variant:"primary",onClick:()=>e(`/canvas/${encodeURIComponent(v.id)}`),children:"Open canvas"}),c.jsx(ct,{size:"sm",onClick:()=>e(`/projects/${encodeURIComponent(v.id)}`),children:"Ops"}),c.jsx(Tt,{size:"sm",action:()=>l(v.id),onError:t.bad,children:"Lock"}),c.jsx(li,{label:"Destroy",title:"Destroy project",message:`Deregister project “${v.id}”? This removes it from the instance.`,confirmLabel:"Destroy",action:()=>u(v.id),onError:t.bad})]})}]})}),a&&c.jsx(v5,{units:((d=r.data)==null?void 0:d.units)??[],onClose:()=>i(!1),onCreated:n.reload}),s&&c.jsx(g5,{project:s,units:((f=r.data)==null?void 0:f.units)??[],onClose:()=>o(null),onPlaced:()=>{o(null),n.reload()}})]})}function g5(t){var i;const e=Dt(),[n,r]=A.useState(t.project.unitId??((i=t.units[0])==null?void 0:i.id)??"");async function a(){await yt("/web/admin/org/placements",{projectId:t.project.id,unitId:n}),e.ok(`Placed “${t.project.id}” in ${n}`),t.onPlaced()}return c.jsx($n,{title:`Place · ${t.project.id}`,onClose:t.onClose,footer:c.jsxs(c.Fragment,{children:[c.jsx(ct,{variant:"ghost",onClick:t.onClose,children:"Cancel"}),c.jsx(Tt,{variant:"primary",action:a,onError:e.bad,disabled:!n,children:"Place"})]}),children:c.jsx("div",{className:"stack-lg",children:c.jsx(X,{label:"Organization unit",hint:"Requires admin. Placing a project in a unit makes it visible in that unit's scope.",children:t.units.length===0?c.jsx("span",{className:"hint",children:"No units exist (or you can't list them). Create one under Organization first."}):c.jsx(Xu,{units:t.units,value:n,onChange:r,allowEmpty:!1,placeholder:"Choose a unit…"})})})})}function Ej({projectId:t,route:e="",unitPrefix:n=""}){const r=St(()=>Et("/web/canvas-model?projectId="+encodeURIComponent(t)),[t],[`project:${t}`,"projects"]),{themeId:a,appearance:i,customThemes:s}=Ou(),{ctx:o}=Zm(),l=!!(o!=null&&o.local),u=pC(i),d=A.useMemo(()=>gC(a,i,s),[a,i,s]),f=Pr(),h=A.useRef(null),v=A.useRef(null),p=r.data,y=A.useRef(e),b=A.useRef(e),m=A.useRef(t),g=A.useRef(n);b.current=e,m.current=t,g.current=n;const w=oi(),x=A.useMemo(()=>{const C=w.hash||"";let T=/^#flow=(.+?)~(.+)$/.exec(C);return T?{flow:{comp:T[1],method:T[2],mode:"flow"}}:(T=/^#focus=(.+)$/.exec(C),T?{select:{comp:T[1]}}:{})},[w.hash]),E=A.useRef(x);E.current=x;const S=()=>{const C=g.current;return"/canvas/"+(C?C+"/":"")+encodeURIComponent(m.current)+"/network"};return A.useEffect(()=>{var N,P;const C=(N=p==null?void 0:p.system)==null?void 0:N.diagram,T=(P=w.state)==null?void 0:P.components;(C==null?void 0:C.defaultView)==="network"&&e===""&&!T&&f(S(),{replace:!0})},[p]),A.useEffect(()=>{const C=h.current;if(!C||p===void 0)return;y.current=b.current;const T=uj(C,p,{shadow:!0,theme:u,vars:d,embed:!0,initialRoute:b.current,onViewChange:N=>{const P=g.current,R="/canvas/"+(P?P+"/":"")+encodeURIComponent(m.current)+(N?"/"+N:"");y.current=N,R!==window.location.pathname&&f(R)},onOpenApi:N=>window.open(`/web/openapi?projectId=${encodeURIComponent(m.current)}`+(N?`&spec=${encodeURIComponent(N)}`:""),"_blank","noopener"),onOpenSpec:(N,P)=>{const R=P?P.split("::").map(encodeURIComponent).join("/"):"",I=N+(R?"/"+R:"");f(l?"/specs/"+I:"/projects/"+encodeURIComponent(m.current)+"/specs/"+I)},onOpenProject:N=>f("/projects/"+encodeURIComponent(N)),onOpenNetwork:()=>f(S()),initialFlow:E.current.flow,initialSelect:E.current.select});return v.current=T,()=>{T.destroy(),v.current=null}},[p]),A.useEffect(()=>{var C;e!==y.current&&(y.current=e,(C=v.current)==null||C.openRoute(e))},[e]),A.useEffect(()=>{var C;(C=v.current)==null||C.setTheme(u,d)},[u,d]),c.jsx(Xt,{state:r,children:()=>c.jsx("div",{ref:h,className:"canvas-host"})})}function m5(t){return t.scope==="outside"?"outside":t.scope==="network"?t.network?`network:${t.network}`:"network":t.project||t.subsystem||t.component||""}function Cj(t,e){return!!t.component&&e.some(n=>n.id===t.network&&n.gateways.includes(t.component))}function Yl(t,e){return Cj(t,e)?t.component:m5(t)}function y5(t){return t.id===""?"root network":`network ${t.id}`}function Sj({party:t,networks:e}){const n=Cj(t,e);return c.jsxs("span",{className:`net-chip${n?" net-gateway":""}${t.scope?" net-scope":""}`,title:n?"Gateway: the only Portal callers from outside this network may enter":void 0,children:[n?"⬡ ":"",Yl(t,e)]})}function jj({network:t,vm:e}){const n=e.workloads.filter(a=>a.network===t.id&&a.scope!=="outside"),r=e.networks.filter(a=>a.parent===t.id);return c.jsxs("fieldset",{className:"net-boundary",children:[c.jsxs("legend",{children:[c.jsx("strong",{children:y5(t)}),t.description?c.jsxs("span",{className:"hint",children:[" — ",t.description]}):null]}),c.jsxs("div",{className:"net-row",children:[n.map(a=>c.jsx(Sj,{party:a,networks:e.networks},Yl(a,e.networks))),n.length===0&&c.jsx("span",{className:"hint",children:"no workload sends or receives a flow here"})]}),r.map(a=>c.jsx(jj,{network:a,vm:e},a.id))]})}function b5({projectId:t,onComponents:e}){const n=St(()=>Et("/web/projects/network?projectId="+encodeURIComponent(t)),[t],[`project:${t}`,"projects"]);return c.jsxs("div",{className:"net-view",children:[c.jsxs("div",{className:"canvas-bar",children:[c.jsx("button",{className:"btn btn-ghost btn-sm",onClick:e,title:"Back to the component architecture",children:"← Components"}),c.jsx("span",{className:"crumb-sep",children:"/"}),c.jsx("strong",{children:"Network"}),c.jsx("span",{className:"hint",children:" derived from the design: who may reach whom, over which transport, through which gateway"})]}),c.jsx(Xt,{state:n,children:r=>r.edges.length===0?c.jsx(x5,{}):c.jsx(w5,{vm:r})})]})}function x5(){return c.jsx(Nf,{children:"No network-transport flows: every verb of this design is in-process or local (CLI, IPC, JSON-RPC over stdio, a library). Flows appear for HTTP, gRPC, GraphQL, MessageBus and Custom Portals reached by a modelled call or a declared entry."})}function w5({vm:t}){const e=t.workloads.filter(n=>n.scope==="outside"||n.network===void 0||!t.networks.some(r=>r.id===n.network));return c.jsxs("div",{className:"stack-sm net-picture",children:[c.jsx("div",{className:"net-row",children:e.map(n=>c.jsx(Sj,{party:n,networks:t.networks},Yl(n,t.networks)))}),t.networks.filter(n=>n.parent===void 0).map(n=>c.jsx(jj,{network:n,vm:t},n.id)),c.jsxs("h3",{children:["Flows (",t.edges.length,")"]}),t.edges.map((n,r)=>{var a;return c.jsxs("details",{className:"panel",children:[c.jsxs("summary",{children:[c.jsx("strong",{children:Yl(n.from,t.networks)})," → ",c.jsx("strong",{children:Yl(n.to,t.networks)})," ",c.jsx(rt,{tone:"accent",children:n.transport})," ",c.jsxs("span",{className:"subtle",children:[((a=n.verbs)==null?void 0:a.length)??1," verb(s)"]}),n.crosses.length>0&&c.jsxs("span",{className:"hint",children:[" ","· enters ",n.crosses.map(i=>i===""?"root network":i).join(" › "),n.via?` through ${n.via}`:" — no gateway"]})]}),c.jsx("ul",{className:"finding-list",children:(n.verbs??[]).map(i=>c.jsx("li",{children:c.jsx("code",{children:i})},i))}),c.jsxs("p",{className:"hint",children:["Evidence: ",n.evidence.join(" · ")]})]},r)})]})}function k5(){const e=(Ef()["*"]??"").split("/").filter(Boolean).map(decodeURIComponent),n=Pr(),r=St(()=>Et("/web/graph?tier=landscape&level=1"),[],["landscape"]);return c.jsx(Xt,{state:r,children:a=>{const i=h=>h.projectId??h.id.replace(/^project:/,""),s=new Set(a.nodes.filter(h=>h.kind==="project").map(i));let o=-1;for(let h=0;h<e.length;h++)if(s.has(e[h])){o=h;break}if(o===-1)return c.jsx(cj,{initialUnitRoute:e.join("/")});const l=e.slice(0,o).join("/"),u=e[o],d=e.slice(o+1).join("/"),f="/canvas/"+(l?l+"/":"")+encodeURIComponent(u);return d==="network"?c.jsx("div",{className:"canvas-view",children:c.jsx(b5,{projectId:u,onComponents:()=>n(f,{state:{components:!0}})})}):c.jsxs("div",{className:"canvas-view",children:[c.jsxs("div",{className:"canvas-bar",children:[c.jsx("button",{className:"btn btn-ghost btn-sm",onClick:()=>n("/canvas"+(l?"/"+l:"")),title:"Back to the environment",children:"← Environment"}),c.jsx("span",{className:"crumb-sep",children:"/"}),c.jsx("strong",{children:u})]}),c.jsx(Ej,{projectId:u,route:d,unitPrefix:l},u)]})}})}function E5(){var l;const t=Dt(),e=St(()=>Et("/web/tokens"),[],["tokens"]),n=St(()=>Et("/web/projects"),[]),[r,a]=A.useState(!1),[i,s]=A.useState(null);async function o(u){await yt("/web/tokens/revoke",{id:u}),t.ok("Token revoked"),e.reload()}return c.jsxs("div",{className:"view-pad",children:[c.jsxs("div",{className:"view-head",children:[c.jsxs("div",{children:[c.jsx("h2",{children:"Connect an agent"}),c.jsx("p",{className:"hint",children:"Mint a single-project MCP token for an AI coding agent. A token can never exceed your own access to that project, and dies if your account is deactivated."})]}),c.jsx(ct,{variant:"primary",onClick:()=>a(!0),children:"+ New token"})]}),c.jsx(Xt,{state:e,children:u=>c.jsx(Vn,{rowKey:d=>d.id,empty:"No tokens yet. Mint one to connect an agent to a project.",rows:u.tokens,columns:[{key:"label",header:"Token",cell:d=>c.jsx("strong",{children:d.label||d.id})},{key:"projects",header:"Projects",cell:d=>c.jsx("div",{className:"chip-row",children:d.projects.map(f=>c.jsx(rt,{tone:"accent",children:f==="*"?"all your projects":f},f))})},{key:"created",header:"Created",cell:d=>c.jsx("span",{className:"hint",children:new Date(d.createdAt).toLocaleDateString()})},{key:"status",header:"",width:"1%",cell:d=>d.revokedAt?c.jsx(rt,{tone:"neutral",children:"revoked"}):c.jsx(li,{label:"Revoke",title:"Revoke token",message:"Revoke this token? Any agent using it loses access immediately.",confirmLabel:"Revoke",action:()=>o(d.id),onError:t.bad})}]})}),r&&c.jsx(C5,{projects:((l=n.data)==null?void 0:l.projects)??[],onClose:()=>a(!1),onMinted:u=>{s(u),a(!1),e.reload()}}),i&&c.jsx(S5,{token:i,onClose:()=>s(null)})]})}function C5(t){var u;const e=Dt(),[n,r]=A.useState(((u=t.projects[0])==null?void 0:u.id)??""),[a,i]=A.useState(!1),[s,o]=A.useState("");async function l(){const d=s.trim(),f=d?`${n}::${d}`:n,h=await yt("/web/tokens",{projectId:f,write:a});t.onMinted(h.token)}return c.jsx($n,{title:"Mint an agent token",onClose:t.onClose,footer:c.jsxs(c.Fragment,{children:[c.jsx(ct,{variant:"ghost",onClick:t.onClose,children:"Cancel"}),c.jsx(Tt,{variant:"primary",action:l,onError:e.bad,disabled:!n,children:"Mint"})]}),children:c.jsxs("div",{className:"stack-lg",children:[c.jsx(X,{label:"Project",children:t.projects.length===0?c.jsx("span",{className:"hint",children:"You have no projects to scope a token to yet."}):c.jsx(en,{value:n,onChange:r,options:t.projects.map(d=>({value:d.id,label:d.id}))})}),c.jsx(X,{label:"Subproject (optional)",hint:"Scope the token into a chained subproject: the subsystem id mounting it (e.g. billing, or nested billing::payments). Leave empty for the whole project. Validated on mint — an unknown or non-chained subsystem is rejected.",children:c.jsx(Be,{value:s,onChange:o,placeholder:"subsystem id, e.g. billing or billing::payments",disabled:!n})}),c.jsx(X,{label:"Access",children:c.jsx(en,{value:a?"write":"read",onChange:d=>i(d==="write"),options:[{value:"read",label:"Read only"},{value:"write",label:"Read + write"}]})})]})})}function S5(t){const e=Dt();return c.jsx($n,{title:"Your new token",onClose:t.onClose,footer:c.jsx(ct,{onClick:t.onClose,children:"Done"}),children:c.jsxs("div",{className:"stack-lg",children:[c.jsx("p",{className:"hint",children:"Copy it now — it is shown only once and cannot be retrieved again."}),c.jsx("code",{className:"token-box",children:t.token}),c.jsx(ct,{onClick:()=>{var n;(n=navigator.clipboard)==null||n.writeText(t.token).then(()=>e.ok("Copied to clipboard"),()=>e.bad("Copy failed — select and copy manually"))},children:"Copy"})]})})}const j5=["oidc","keycloak","authentik","google_workspace","entra_id"],Sp=t=>t.split(",").map(e=>e.trim()).filter(Boolean),jp=t=>(t??[]).join(", ");function b1(t){var y,b,m;const e=Dt(),n=!!t.existing,[r,a]=A.useState(t.existing??{id:"",providerType:"oidc",displayName:"",issuerUrl:"",clientId:"",clientSecretRef:"",enabled:!0}),[i,s]=A.useState(jp((y=t.existing)==null?void 0:y.allowedDomains)),[o,l]=A.useState(jp((b=t.existing)==null?void 0:b.adminGroupClaims)),[u,d]=A.useState(jp((m=t.existing)==null?void 0:m.allowedRedirectUris)),[f,h]=A.useState(!1),v=g=>a(w=>({...w,...g}));async function p(){const g={...r,allowedDomains:Sp(i),adminGroupClaims:Sp(o),allowedRedirectUris:Sp(u)};await yt("/web/admin/providers",g),e.ok(n?"Provider updated":`Provider “${r.id}” added`),t.onSaved(),t.onClose()}return c.jsx($n,{wide:!0,title:n?`Edit provider · ${t.existing.id}`:"Add identity provider",onClose:t.onClose,footer:c.jsxs(c.Fragment,{children:[c.jsx(ct,{variant:"ghost",onClick:t.onClose,children:"Cancel"}),c.jsx(Tt,{variant:"primary",action:p,onError:e.bad,disabled:!r.id||!r.clientId,children:n?"Save":"Add"})]}),children:c.jsxs("div",{className:"stack-lg",children:[c.jsxs("div",{className:"row-form",children:[c.jsx(X,{label:"Provider id",children:c.jsx(Be,{value:r.id,onChange:g=>v({id:g}),disabled:n,placeholder:"corp-sso"})}),c.jsx(X,{label:"Type",children:c.jsx(en,{value:r.providerType,onChange:g=>v({providerType:g}),options:j5.map(g=>({value:g,label:g}))})}),c.jsx(X,{label:"Sign-in label",children:c.jsx(Be,{value:r.displayName??"",onChange:g=>v({displayName:g}),placeholder:"Company SSO"})})]}),c.jsx(X,{label:"Issuer URL",hint:"OIDC discovery base — endpoints resolve from /.well-known unless overridden below.",children:c.jsx(Be,{value:r.issuerUrl??"",onChange:g=>v({issuerUrl:g}),placeholder:"https://sso.example.com/realms/main"})}),c.jsxs("div",{className:"row-form",children:[c.jsx(X,{label:"Client id",children:c.jsx(Be,{value:r.clientId??"",onChange:g=>v({clientId:g})})}),c.jsx(X,{label:"Client secret ref",hint:"Name of a secret set on the Secrets card below.",children:c.jsx(Be,{value:r.clientSecretRef??"",onChange:g=>v({clientSecretRef:g}),placeholder:"corp-sso-secret"})})]}),c.jsx(X,{label:"Allowed email domains",hint:"Comma-separated. First-login provisioning is limited to these.",children:c.jsx(Be,{value:i,onChange:s,placeholder:"example.com, corp.example.com"})}),c.jsx(X,{label:"Admin group claims",hint:"Comma-separated. Members of these groups become instance admins.",children:c.jsx(Be,{value:o,onChange:l,placeholder:"wairon-admins"})}),c.jsx(X,{label:"Allowed redirect URIs",hint:"Comma-separated exact-match allowlist. Empty = accept any.",children:c.jsx(Be,{value:u,onChange:d})}),c.jsxs("button",{className:"btn btn-ghost btn-sm",onClick:()=>h(g=>!g),children:[f?"▾":"▸"," Split-horizon endpoint overrides"]}),f&&c.jsxs("div",{className:"panel stack-lg",children:[c.jsx("p",{className:"hint",children:"Front-channel (browser) vs back-channel (server) endpoints — set these when the token/JWKS endpoints live on a VPC-internal address the browser can't reach."}),c.jsx(X,{label:"Authorization endpoint (front-channel)",children:c.jsx(Be,{value:r.authorizationEndpoint??"",onChange:g=>v({authorizationEndpoint:g})})}),c.jsx(X,{label:"Token endpoint (back-channel)",children:c.jsx(Be,{value:r.tokenEndpoint??"",onChange:g=>v({tokenEndpoint:g})})}),c.jsx(X,{label:"JWKS URI (back-channel)",children:c.jsx(Be,{value:r.jwksUri??"",onChange:g=>v({jwksUri:g})})}),c.jsx(X,{label:"Userinfo endpoint (back-channel)",children:c.jsx(Be,{value:r.userinfoEndpoint??"",onChange:g=>v({userinfoEndpoint:g})})})]}),c.jsx(X,{label:"Enabled",children:c.jsx(en,{value:r.enabled?"yes":"no",onChange:g=>v({enabled:g==="yes"}),options:[{value:"yes",label:"Enabled (shown on the login screen)"},{value:"no",label:"Disabled"}]})})]})})}function T5(){const t=Dt(),e=St(()=>Et("/web/admin/secrets"),[]),[n,r]=A.useState(""),[a,i]=A.useState("");async function s(){await yt("/web/admin/secrets",{key:n,value:a}),t.ok(`Secret “${n}” saved`),i(""),e.reload()}return c.jsxs("div",{className:"panel",children:[c.jsx("h4",{children:"Secrets"}),c.jsx("p",{className:"hint",children:"Client secrets and tokens are write-only — set them here and reference them by name (never shown again)."}),c.jsx(Xt,{state:e,children:o=>c.jsx("div",{className:"chip-row",style:{marginBottom:12},children:o.refs.length===0?c.jsx("span",{className:"hint",children:"No secrets set."}):o.refs.map(l=>c.jsx(rt,{tone:"neutral",children:l},l))})}),c.jsxs("div",{className:"row-form",children:[c.jsx(X,{label:"Secret name",children:c.jsx(Be,{value:n,onChange:r,placeholder:"corp-sso-secret"})}),c.jsx(X,{label:"Value",children:c.jsx(Be,{type:"password",value:a,onChange:i})}),c.jsx("div",{className:"row-form-action",children:c.jsx(Tt,{variant:"primary",action:s,onError:t.bad,disabled:!n||!a,children:"Save secret"})})]})]})}function N5(){const t=Dt(),e=St(()=>Et("/web/admin/providers"),[],["providers"]),[n,r]=A.useState(!1),[a,i]=A.useState(null);async function s(o){await yt("/web/admin/providers/remove",{id:o}),t.ok("Provider removed"),e.reload()}return c.jsxs("div",{className:"view-pad",children:[c.jsxs("div",{className:"view-head",children:[c.jsxs("div",{children:[c.jsx("h2",{children:"Sign-in (SSO)"}),c.jsx("p",{className:"hint",children:"Identity providers users can sign in with. OIDC, Keycloak, Authentik, Google, Entra."})]}),c.jsx(ct,{variant:"primary",onClick:()=>r(!0),children:"+ Add provider"})]}),c.jsx(Xt,{state:e,children:o=>c.jsx(Vn,{rowKey:l=>l.id,empty:"No identity providers configured. Add one so users can sign in with SSO.",rows:o.providers,columns:[{key:"id",header:"Provider",cell:l=>c.jsxs("div",{className:"cell-stack",children:[c.jsx("strong",{children:l.displayName||l.id}),c.jsxs("code",{className:"subtle",children:[l.providerType," · ",l.id]})]})},{key:"issuer",header:"Issuer",cell:l=>c.jsx("code",{className:"subtle",children:l.issuerUrl||"—"})},{key:"enabled",header:"Status",cell:l=>c.jsx(rt,{tone:l.enabled?"ok":"neutral",children:l.enabled?"enabled":"disabled"})},{key:"act",header:"",width:"1%",cell:l=>c.jsxs("div",{className:"row-actions",children:[c.jsx(ct,{size:"sm",variant:"ghost",onClick:()=>i(l),children:"Edit"}),c.jsx(li,{label:"Remove",title:"Remove provider",message:`Remove “${l.displayName||l.id}”? Users can no longer sign in with it.`,confirmLabel:"Remove",action:()=>s(l.id),onError:t.bad})]})}]})}),c.jsx("div",{style:{marginTop:20},children:c.jsx(T5,{})}),n&&c.jsx(b1,{onClose:()=>r(!1),onSaved:e.reload}),a&&c.jsx(b1,{existing:a,onClose:()=>i(null),onSaved:e.reload})]})}function P5(){const t=Dt(),e=St(()=>Et("/web/admin/approvals"),[],["approvals"]);async function n(r,a){await yt("/web/admin/approvals/decide",{requestId:r,approved:a}),t.ok(a?"Approved":"Denied"),e.reload()}return c.jsxs("div",{className:"view-pad",children:[c.jsx("div",{className:"view-head",children:c.jsxs("div",{children:[c.jsx("h2",{children:"Approvals"}),c.jsx("p",{className:"hint",children:"Actions awaiting a decision. You can't approve your own requests."})]})}),c.jsx(Xt,{state:e,children:r=>c.jsx(Vn,{rowKey:a=>a.id,empty:"Nothing awaiting approval.",rows:r.requests,columns:[{key:"summary",header:"Request",cell:a=>c.jsxs("div",{className:"cell-stack",children:[c.jsx("strong",{children:a.summary}),c.jsxs("span",{className:"hint",children:[c.jsx(rt,{tone:"neutral",children:a.kind})," ",a.projectId&&c.jsxs(c.Fragment,{children:["· ",a.projectId]})]})]})},{key:"by",header:"Requested by",cell:a=>c.jsx("span",{children:Pf(a.requestedBy)})},{key:"when",header:"When",cell:a=>c.jsx("span",{className:"hint",children:new Date(a.createdAt).toLocaleString()})},{key:"act",header:"",cell:a=>c.jsxs("div",{className:"row-actions",children:[c.jsx(Tt,{size:"sm",variant:"primary",action:()=>n(a.id,!0),onError:t.bad,children:"Approve"}),c.jsx(li,{label:"Deny",title:"Deny request",message:`Deny “${a.summary}”?`,confirmLabel:"Deny",action:()=>n(a.id,!1),onError:t.bad})]})}]})})]})}const R5=["","info","warning","error","security"];function I5(t){return t==="success"?"ok":t==="denied"||t==="failed"?"bad":t==="skipped"?"warn":"neutral"}function L5(){const[t,e]=A.useState(""),[n,r]=A.useState(""),[a,i]=A.useState("100"),[s,o]=A.useState({projectId:"",minimumLevel:"",limit:"100"}),l=new URLSearchParams;s.projectId&&l.set("projectId",s.projectId),s.minimumLevel&&l.set("minimumLevel",s.minimumLevel),s.limit&&l.set("limit",s.limit);const u=St(()=>Et(`/web/admin/audit?${l.toString()}`).then(d=>d),[s.projectId,s.minimumLevel,s.limit]);return c.jsxs("div",{className:"view-pad",style:{maxWidth:1320},children:[c.jsxs("div",{className:"view-head",children:[c.jsxs("div",{children:[c.jsx("h2",{children:"Audit log"}),c.jsx("p",{className:"hint",children:"Redacted security & activity events in your scope."})]}),c.jsx(ct,{variant:"ghost",onClick:u.reload,children:"Refresh"})]}),c.jsx("div",{className:"panel",style:{marginBottom:16},children:c.jsxs("div",{className:"row-form",children:[c.jsx(X,{label:"Project id",children:c.jsx(Be,{value:t,onChange:e,placeholder:"(all)"})}),c.jsx(X,{label:"Minimum level",children:c.jsx(en,{value:n,onChange:r,options:R5.map(d=>({value:d,label:d||"(any)"}))})}),c.jsx(X,{label:"Limit",children:c.jsx(Be,{value:a,onChange:i})}),c.jsx("div",{className:"row-form-action",children:c.jsx(ct,{variant:"primary",onClick:()=>o({projectId:t,minimumLevel:n,limit:a}),children:"Apply"})})]})}),c.jsx(Xt,{state:u,children:d=>c.jsx(Vn,{rowKey:f=>f.id,empty:"No audit events match.",rows:d.events??[],columns:[{key:"ts",header:"Time",cell:f=>c.jsx("span",{className:"hint",children:new Date(f.timestamp).toLocaleString()})},{key:"lvl",header:"Level",cell:f=>c.jsx(rt,{tone:f.level==="security"?"accent":f.level==="error"?"bad":f.level==="warning"?"warn":"neutral",children:f.level})},{key:"action",header:"Action",cell:f=>c.jsx("code",{children:f.action})},{key:"outcome",header:"Outcome",cell:f=>c.jsx(rt,{tone:I5(f.outcome),children:f.outcome})},{key:"actor",header:"Actor",cell:f=>c.jsx("span",{children:Pf(f.actor)})},{key:"target",header:"Target",cell:f=>c.jsxs("code",{className:"subtle",children:[f.projectId?`${f.projectId} · `:"",f.target??"—"]})}]})})]})}const A5={ok:"ok",pass:"ok",degraded:"warn",warn:"warn",unhealthy:"bad",fail:"bad"},x1=t=>A5[t]??"neutral",D5=t=>{if(t===void 0)return"—";if(t<1024)return`${t} B`;const e=["KB","MB","GB","TB"];let n=t/1024,r=0;for(;n>=1024&&r<e.length-1;)n/=1024,r++;return`${n.toFixed(1)} ${e[r]}`};function B5(){const t=St(()=>Et("/web/admin/health"),[]);return c.jsxs("div",{className:"view-pad",children:[c.jsxs("div",{className:"view-head",children:[c.jsxs("div",{children:[c.jsx("h2",{children:"Health & diagnostics"}),c.jsx("p",{className:"hint",children:"Instance status, diagnostic checks, and resource usage across the projects in your scope."})]}),c.jsx(ct,{variant:"ghost",onClick:t.reload,children:"Refresh"})]}),c.jsx(Xt,{state:t,children:e=>c.jsxs("div",{className:"stack-lg",children:[c.jsxs("div",{className:"panel",children:[c.jsxs("h4",{children:["Instance status ",c.jsx(rt,{tone:x1(e.status),children:e.status})]}),c.jsxs("p",{className:"hint",children:["Generated ",new Date(e.generatedAt).toLocaleString(),"."]})]}),c.jsx(Vn,{rowKey:n=>n.id,empty:"No diagnostic checks reported.",rows:e.checks,columns:[{key:"check",header:"Check",cell:n=>c.jsx("code",{className:"subtle",children:n.id})},{key:"status",header:"Status",cell:n=>c.jsx(rt,{tone:x1(n.status),children:n.status})},{key:"message",header:"Detail",cell:n=>c.jsxs("span",{children:[n.message,n.details&&c.jsxs("span",{className:"hint",children:[" — ",n.details]})]})}]}),e.usage&&e.usage.length>0&&c.jsxs("div",{children:[c.jsx("h4",{style:{margin:"4px 0 10px"},children:"Resource usage"}),c.jsx(Vn,{rowKey:n=>n.scope,empty:"No usage snapshots.",rows:e.usage,columns:[{key:"scope",header:"Scope",cell:n=>c.jsx("code",{children:n.scope})},{key:"projects",header:"Projects",cell:n=>n.projectCount??"—"},{key:"bytes",header:"Size",cell:n=>D5(n.projectBytes)},{key:"mcp",header:"MCP req/min",cell:n=>n.mcpRequestsLastMinute??"—"},{key:"audit",header:"Audit today",cell:n=>n.auditEventsToday??"—"},{key:"quota",header:"Quota notes",cell:n=>n.quotaMessages.length?c.jsx("span",{className:"cell-inline",children:n.quotaMessages.map((r,a)=>c.jsx(rt,{tone:"warn",children:r},a))}):c.jsx("span",{className:"hint",children:"—"})}]})]})]})})]})}const Tj=t=>{var e;return((e=t.profileIds)==null?void 0:e.length)??t.profiles??0},M5=t=>{var e;return((e=t.languageIds)==null?void 0:e.length)??t.languages??0},O5=t=>{var e;return((e=t.ruleIds)==null?void 0:e.length)??t.rules??0};function z5({pack:t}){const[e,n]=A.useState(!1),r=t.profileIds??[],a=t.languageIds??[],i=t.ruleIds??[],s=`${Tj(t)}p · ${M5(t)}l · ${O5(t)}r`;return r.length+a.length+i.length>0?c.jsxs("div",{className:"cell-stack",children:[c.jsxs("button",{type:"button",className:"pack-toggle","aria-expanded":e,onClick:()=>n(l=>!l),children:[c.jsx("span",{"aria-hidden":!0,children:e?"▾":"▸"})," ",s]}),e&&c.jsxs("div",{className:"pack-contents",children:[r.length>0&&c.jsxs("div",{className:"pack-contents-row",children:[c.jsx("span",{className:"pack-contents-k",children:"Profiles"}),c.jsx("div",{className:"chip-row",children:r.map(l=>c.jsx(rt,{tone:"accent",children:l},l))})]}),a.length>0&&c.jsxs("div",{className:"pack-contents-row",children:[c.jsx("span",{className:"pack-contents-k",children:"Languages"}),c.jsx("div",{className:"chip-row",children:a.map(l=>c.jsx(rt,{tone:"neutral",children:l},l))})]}),i.length>0&&c.jsxs("div",{className:"pack-contents-row",children:[c.jsx("span",{className:"pack-contents-k",children:"Rules"}),c.jsx("div",{className:"chip-row",children:i.map(l=>c.jsx(rt,{tone:"neutral",children:l},l))})]})]})]}):c.jsx("span",{className:"hint",children:s})}function F5(){const t=Dt(),e=St(()=>Et("/web/admin/packs").then(d=>Vo(d,"packs")),[]),[n,r]=A.useState(!1),[a,i]=A.useState(null),[s,o]=A.useState("");async function l(){if(!a)return;const d=s.trim()?{"X-Wairon-Pack-Name":s.trim()}:{},f=await Ym("/web/admin/packs/upload",a,d);t.ok(`Installed “${f.name}”`),r(!1),i(null),o(""),e.reload()}async function u(d){await yt("/web/admin/packs/remove",{name:d}),t.ok("Pack removed"),e.reload()}return c.jsxs("div",{className:"stack-lg",children:[c.jsxs("div",{className:"view-head",children:[c.jsx("p",{className:"hint",children:"Instance-tier declarative packs, available to every project."}),c.jsx(ct,{variant:"primary",onClick:()=>r(!0),children:"+ Install pack"})]}),c.jsx(Xt,{state:e,children:d=>c.jsx(Vn,{rowKey:f=>f.name,empty:"No instance packs installed.",rows:d,columns:[{key:"name",header:"Pack",cell:f=>c.jsxs("div",{className:"cell-stack",children:[c.jsx("strong",{children:f.name}),c.jsx("code",{className:"subtle",children:f.ref})]})},{key:"tier",header:"Tier",cell:f=>c.jsx(rt,{tone:f.tier==="image"?"accent":"neutral",children:f.tier??"instance"})},{key:"counts",header:"Contents",cell:f=>c.jsx(z5,{pack:f})},{key:"act",header:"",width:"1%",cell:f=>f.tier==="image"?c.jsx("span",{className:"hint",children:"baked in"}):c.jsx(Tt,{size:"sm",variant:"ghost",action:()=>u(f.name),onError:t.bad,children:"Remove"})}]})}),n&&c.jsx($n,{title:"Install an instance pack",onClose:()=>r(!1),footer:c.jsxs(c.Fragment,{children:[c.jsx(ct,{variant:"ghost",onClick:()=>r(!1),children:"Cancel"}),c.jsx(Tt,{variant:"primary",action:l,onError:t.bad,disabled:!a,children:"Install"})]}),children:c.jsxs("div",{className:"stack-lg",children:[c.jsxs("p",{className:"hint",children:["Upload a ",c.jsx("code",{children:".wpack"})," archive. Only declarative packs (profiles + language/platform tables) install here; code packs stay filesystem-only."]}),c.jsx(X,{label:"Pack archive (.wpack)",children:c.jsx("input",{className:"input",type:"file",accept:".wpack,.zip,application/zip",onChange:d=>{var f;return i(((f=d.target.files)==null?void 0:f[0])??null)}})}),c.jsx(X,{label:"Name override (optional)",hint:"Defaults to the pack name in the archive's manifest.",children:c.jsx(Be,{value:s,onChange:o})})]})})]})}function _5(){const t=Dt(),e=St(()=>Et("/web/admin/policy"),[]);return c.jsx(Xt,{state:e,children:n=>c.jsx($5,{policy:n,onSaved:e.reload,onError:t.bad,onOk:t.ok})})}function Pl(t,e,n){const r=new Set(t.map(i=>i.value)),a=e.filter(i=>!r.has(i)).map(i=>({value:i,label:i,hint:n}));return a.length?[...t,...a]:t}function $5(t){const e=St(()=>Et("/web/admin/packs").then(S=>Vo(S,"packs")),[]),n=St(()=>Et("/web/admin/profiles").then(S=>Vo(S,"profiles")),[]),[r,a]=A.useState(t.policy.requiredGlobalPacks??[]),[i,s]=A.useState(t.policy.defaultProjectPacks??[]),[o,l]=A.useState(t.policy.blockedPackNames??[]),[u,d]=A.useState(t.policy.allowedProfileIds??[]),[f,h]=A.useState(t.policy.requiredProfileIds??[]),[v,p]=A.useState(t.policy.enforcementMode||"warn"),[y,b]=A.useState(t.policy.requireProfileSelection),m=(e.data??[]).map(S=>({value:S.name,label:S.name,hint:`${S.tier?S.tier+" · ":""}${Tj(S)} profiles`})),g=e.loading?"Loading packs…":e.error?"Could not load packs.":"No packs installed.",w=[...n.data??[]].sort((S,C)=>{const T=S.source==="builtin"?0:1,N=C.source==="builtin"?0:1;return T!==N?T-N:S.source!==C.source?S.source.localeCompare(C.source):S.id.localeCompare(C.id)}).map(S=>({value:S.id,label:S.id,hint:S.family,group:S.source==="builtin"?"Built-in":S.source})),x=n.loading?"Loading profiles…":n.error?"Could not load profiles.":"No profiles available.";async function E(){const S={...t.policy,requiredGlobalPacks:r,defaultProjectPacks:i,blockedPackNames:o,allowedProfileIds:u,requiredProfileIds:f,enforcementMode:v,requireProfileSelection:y};await yt("/web/admin/policy",S),t.onOk("Policy saved"),t.onSaved()}return c.jsxs("div",{className:"panel stack-lg",children:[c.jsx(X,{label:"Every project must carry",hint:"Packs required on every project. Enforced per the mode below.",children:c.jsx(wl,{options:Pl(m,r,"not installed"),selected:r,onChange:a,placeholder:"Choose packs…",emptyLabel:g})}),c.jsx(X,{label:"New projects start with",hint:"Packs installed by default when a project is created.",children:c.jsx(wl,{options:Pl(m,i,"not installed"),selected:i,onChange:s,placeholder:"Choose packs…",emptyLabel:g})}),c.jsx(X,{label:"Never allowed",hint:"Packs projects may not install.",children:c.jsx(wl,{options:Pl(m,o,"not installed"),selected:o,onChange:l,placeholder:"Choose packs…",emptyLabel:g})}),c.jsx(X,{label:"Profiles — selectable",hint:"Profiles projects may choose from. Leave empty to allow all.",children:c.jsx(wl,{options:Pl(w,u,"unknown source"),selected:u,onChange:d,placeholder:"Choose profiles…",emptyLabel:x})}),c.jsx(X,{label:"Profiles — always applied",hint:"Profiles enforced on every project regardless of the project's own selection.",children:c.jsx(wl,{options:Pl(w,f,"unknown source"),selected:f,onChange:h,placeholder:"Choose profiles…",emptyLabel:x})}),c.jsxs("div",{className:"row-form",children:[c.jsx(X,{label:"Enforcement",children:c.jsx(en,{value:v,onChange:p,options:[{value:"warn",label:"Warn — findings surface, actions proceed"},{value:"block",label:"Block — violations reject"},{value:"auto_reconcile",label:"Auto-reconcile — install missing packs"}]})}),c.jsx(X,{label:"Require profile selection",children:c.jsx(en,{value:y?"yes":"no",onChange:S=>b(S==="yes"),options:[{value:"no",label:"Optional"},{value:"yes",label:"Required"}]})})]}),c.jsx("div",{children:c.jsx(Tt,{variant:"primary",action:E,onError:t.onError,children:"Save policy"})})]})}const V5=[{key:"webUiEnabled",label:"Web UI",hint:"Serve this browser app on the data-plane listener."},{key:"adminUiEnabled",label:"Admin UI (legacy)",hint:"Serve the legacy browser admin UI."},{key:"requireTls",label:"Require TLS",hint:"Externally exposed control surfaces must sit behind TLS."},{key:"identityApiEnabled",label:"Identity API",hint:"Serve the identity/audit control-plane API over HTTP."},{key:"landscapeApiEnabled",label:"Landscape API",hint:"Serve the landscape control-plane API over HTTP."},{key:"projectPolicyApiEnabled",label:"Project-policy API",hint:"Serve the project-policy control-plane API over HTTP."},{key:"operationsApiEnabled",label:"Operations API",hint:"Serve health/usage/quota over HTTP."},{key:"cliControlEnabled",label:"CLI control",hint:"Allow local CLI/container control workflows."}];function U5(){const t=Dt(),e=St(()=>Et("/web/admin/exposure"),[]);return c.jsx(Xt,{state:e,children:n=>c.jsx(q5,{policy:n,onSaved:e.reload,onOk:t.ok,onError:t.bad})})}function q5(t){const[e,n]=A.useState(t.policy),r=i=>n(s=>({...s,...i}));async function a(){await yt("/web/admin/exposure",e),t.onOk("Exposure policy saved"),t.onSaved()}return c.jsxs("div",{className:"panel stack-lg",children:[c.jsx("p",{className:"hint",children:"Which control-plane surfaces this instance serves. Changing these affects what is reachable over HTTP — take care."}),c.jsx(X,{label:"Admin API mode",children:c.jsx(en,{value:e.adminApiMode,onChange:i=>r({adminApiMode:i}),options:["disabled","enabled"].map(i=>({value:i,label:i}))})}),c.jsx("div",{className:"toggle-grid",children:V5.map(i=>c.jsxs("label",{className:"toggle-row",children:[c.jsx("input",{type:"checkbox",checked:!!e[i.key],onChange:s=>r({[i.key]:s.target.checked})}),c.jsxs("span",{className:"cell-stack",children:[c.jsx("strong",{children:i.label}),c.jsx("span",{className:"hint",children:i.hint})]})]},i.key))}),c.jsx("div",{children:c.jsx(Tt,{variant:"primary",action:a,onError:t.onError,children:"Save exposure policy"})})]})}function H5(){var o;const t=Dt(),e=St(()=>Et("/web/admin/git-backing"),[]),n=St(()=>Et("/web/admin/org/units").catch(()=>({units:[]})),[]),[r,a]=A.useState(void 0);async function i(l){await yt("/web/admin/git-backing/sync",{id:l}),t.ok("Sync run"),e.reload()}async function s(l){await yt("/web/admin/git-backing/remove",{id:l}),t.ok("Binding removed"),e.reload()}return c.jsxs("div",{className:"stack-lg",children:[c.jsxs("div",{className:"view-head",children:[c.jsx("p",{className:"hint",children:"Container-level backup repos: mirror a unit's subtree or the whole instance structure to git. Never mirrors secrets or live sessions."}),c.jsx(ct,{variant:"primary",onClick:()=>a(null),children:"+ Bind backup repo"})]}),c.jsx(vj,{}),c.jsx(Xt,{state:e,children:l=>c.jsx(Vn,{rowKey:u=>u.id,empty:"No backup repos bound.",rows:l.bindings,columns:[{key:"scope",header:"Scope",cell:u=>c.jsxs("span",{className:"cell-inline",children:[c.jsxs("code",{children:[u.scopeKind,u.scopeId?`:${u.scopeId}`:""]}),u.includeCredentials&&c.jsx(rt,{tone:"warn",children:"+cred hashes"})]})},{key:"remote",header:"Remote",cell:u=>c.jsx("code",{className:"subtle",children:u.remote})},{key:"auth",header:"Auth",cell:u=>u.credentialRef?c.jsx(rt,{tone:"ok",children:"own PAT"}):c.jsx(rt,{tone:"neutral",children:"shared token"})},{key:"sync",header:"Last sync",cell:u=>c.jsx("span",{className:"hint",children:u.lastSyncAt?new Date(u.lastSyncAt).toLocaleString():"never"})},{key:"act",header:"",cell:u=>c.jsxs("div",{className:"row-actions",children:[c.jsx(Tt,{size:"sm",action:()=>i(u.id),onError:t.bad,children:"Sync now"}),c.jsx(ct,{size:"sm",variant:"ghost",onClick:()=>a(u),children:"Edit"}),c.jsx(li,{label:"Unbind",title:"Unbind backup",message:"Stop backing up this scope? The remote repo is left untouched.",confirmLabel:"Unbind",action:()=>s(u.id),onError:t.bad})]})}]})}),r!==void 0&&c.jsx(W5,{existing:r,units:((o=n.data)==null?void 0:o.units)??[],onClose:()=>a(void 0),onDone:()=>{a(void 0),e.reload()}})]})}function W5(t){var m,g,w,x,E,S;const e=Dt(),n=!!t.existing,[r,a]=A.useState(((m=t.existing)==null?void 0:m.scopeKind)??"unit"),[i,s]=A.useState(((g=t.existing)==null?void 0:g.scopeId)??""),[o,l]=A.useState(((w=t.existing)==null?void 0:w.remote)??""),[u,d]=A.useState(((x=t.existing)==null?void 0:x.branch)??"main"),[f,h]=A.useState(""),[v,p]=A.useState(((E=t.existing)==null?void 0:E.includeCredentials)??!1);async function y(){var C;await yt("/web/admin/git-backing",{scopeKind:r,scopeId:r==="instance"?void 0:i,remote:o,branch:u,pat:f.trim()||void 0,includeCredentials:r==="instance"?v:void 0,credentialRef:(C=t.existing)==null?void 0:C.credentialRef}),e.ok(n?"Backup updated":"Backup repo bound"),t.onDone()}const b=`${r}${i?`:${i}`:""}`;return c.jsx($n,{title:n?`Edit backup · ${b}`:"Bind a backup repository",onClose:t.onClose,footer:c.jsxs(c.Fragment,{children:[c.jsx(ct,{variant:"ghost",onClick:t.onClose,children:"Cancel"}),c.jsx(Tt,{variant:"primary",action:y,onError:e.bad,disabled:!o||r!=="instance"&&!i,children:n?"Save":"Bind"})]}),children:c.jsxs("div",{className:"stack-lg",children:[n?c.jsx(X,{label:"Scope",children:c.jsx("code",{className:"preview-id",children:b})}):c.jsx(X,{label:"Scope",children:c.jsx(en,{value:r,onChange:a,options:[{value:"unit",label:"Organization unit subtree"},{value:"instance",label:"Whole instance structure"}]})}),!n&&r!=="instance"&&c.jsx(X,{label:"Unit subtree",hint:"The unit whose subtree is mirrored. Backs up structure only — never secrets or sessions.",children:c.jsx(Xu,{units:t.units,value:i,onChange:s,allowEmpty:!1,placeholder:"Choose a unit…"})}),r==="instance"&&c.jsx(yu,{checked:v,onChange:p,label:c.jsxs(c.Fragment,{children:["Include credential hashes",c.jsxs(lC,{label:"About backing up credential hashes",children:[c.jsxs("p",{children:[c.jsx("strong",{children:"Off (default):"})," the backup carries the org structure, project registry, and all project specs — but ",c.jsx("strong",{children:"not"})," ",c.jsx("code",{children:"auth/credentials.json"}),". Safer: no password or agent-token hashes leave the box."]}),c.jsxs("p",{children:[c.jsx("strong",{children:"On:"})," also mirrors the ",c.jsx("em",{children:"hashed"})," credential records, so a full restore keeps local logins and agent tokens. The hashes then live in the remote repo (still never plaintext, and the secret store is never mirrored either way)."]}),c.jsx("p",{children:"SSO users re-authenticate via your IdP regardless, so most instances can leave this off."})]})]}),hint:"Turn on only if you need to restore local passwords / agent tokens from this backup. Turning it off removes the hashes from the repo on the next sync."}),c.jsx(X,{label:"Remote URL",children:c.jsx(Be,{value:o,onChange:l,placeholder:"https://github.com/org/backup.git"})}),c.jsx(X,{label:"Branch",children:c.jsx(Be,{value:u,onChange:d})}),c.jsx(X,{label:n?"Access token":"Access token for this connection (optional)",info:c.jsx(pj,{}),hint:n?(S=t.existing)!=null&&S.credentialRef?"A per-connection PAT is set. Leave blank to keep it, or type a new one to rotate.":"Uses the shared fallback token. Type a PAT here to give this connection its own.":"A PAT for this repo's org/account. Leave blank to use the shared fallback token above. Stored write-only; never mirrored.",children:c.jsx(Be,{type:"password",value:f,onChange:h,placeholder:"github_pat_… / ghp_… / glpat-…"})})]})})}const K5=[{id:"packs",label:"Global packs"},{id:"policy",label:"Policy"},{id:"exposure",label:"Exposure"},{id:"backups",label:"Backups"}];function G5(){const[t,e]=A.useState("packs");return c.jsxs("div",{className:"view-pad",children:[c.jsx("div",{className:"view-head",children:c.jsxs("div",{children:[c.jsx("h2",{children:"Instance settings"}),c.jsx("p",{className:"hint",children:"Instance-wide packs, project policy, control-plane exposure, and backup repositories."})]})}),c.jsx(jf,{tabs:K5,active:t,onSelect:e}),c.jsxs("div",{className:"tab-panel",children:[t==="packs"&&c.jsx(F5,{}),t==="policy"&&c.jsx(_5,{}),t==="exposure"&&c.jsx(U5,{}),t==="backups"&&c.jsx(H5,{})]})]})}const Xg=[{key:"--wairon-primary",label:"Primary",kind:"color",group:"Brand"},{key:"--wairon-primary-strong",label:"Primary strong",kind:"color",group:"Brand"},{key:"--wairon-primary-contrast",label:"Primary contrast",kind:"color",group:"Brand"},{key:"--wairon-secondary",label:"Secondary",kind:"color",group:"Brand"},{key:"--wairon-accent",label:"Accent",kind:"color",group:"Brand"},{key:"--wairon-brand-text-bg",label:"Brand gradient",kind:"text",group:"Brand"},{key:"--wairon-page-bg",label:"Page background",kind:"color",group:"Surfaces"},{key:"--wairon-app-bg",label:"App background",kind:"color",group:"Surfaces"},{key:"--wairon-panel-bg",label:"Panel",kind:"color",group:"Surfaces"},{key:"--wairon-panel-bg-strong",label:"Panel strong",kind:"color",group:"Surfaces"},{key:"--wairon-panel-bg-soft",label:"Panel soft",kind:"color",group:"Surfaces"},{key:"--wairon-panel-bg-hover",label:"Panel hover",kind:"color",group:"Surfaces"},{key:"--wairon-header-bg",label:"Header background",kind:"text",group:"Surfaces"},{key:"--wairon-sidebar-bg",label:"Sidebar background",kind:"text",group:"Surfaces"},{key:"--wairon-menu-bg",label:"Menu background",kind:"text",group:"Surfaces"},{key:"--wairon-section-bg",label:"Section background",kind:"text",group:"Surfaces"},{key:"--wairon-text",label:"Text",kind:"color",group:"Text"},{key:"--wairon-text-muted",label:"Text muted",kind:"color",group:"Text"},{key:"--wairon-text-subtle",label:"Text subtle",kind:"color",group:"Text"},{key:"--wairon-text-inverse",label:"Text inverse",kind:"color",group:"Text"},{key:"--wairon-border",label:"Border",kind:"color",group:"Borders & effects"},{key:"--wairon-border-strong",label:"Border strong",kind:"color",group:"Borders & effects"},{key:"--wairon-border-muted",label:"Border muted",kind:"color",group:"Borders & effects"},{key:"--wairon-shadow",label:"Shadow",kind:"shadow",group:"Borders & effects"},{key:"--wairon-shell-shadow",label:"Shell shadow",kind:"shadow",group:"Borders & effects"},{key:"--wairon-focus-ring",label:"Focus ring",kind:"shadow",group:"Borders & effects"},{key:"--wairon-ok",label:"OK",kind:"color",group:"Status"},{key:"--wairon-warn",label:"Warning",kind:"color",group:"Status"},{key:"--wairon-bad",label:"Error",kind:"color",group:"Status"}],Y5=Array.from(new Set(Xg.map(t=>t.group))),Tp=[{id:"light",label:"Light"},{id:"dark",label:"Dark"},{id:"high-contrast",label:"Contrast"}],X5=["--wairon-page-bg","--wairon-app-bg","--wairon-panel-bg","--wairon-panel-bg-strong","--wairon-panel-bg-soft","--wairon-panel-bg-hover","--wairon-header-bg","--wairon-sidebar-bg","--wairon-menu-bg","--wairon-section-bg","--wairon-text","--wairon-text-muted","--wairon-text-subtle","--wairon-text-inverse","--wairon-border","--wairon-border-strong","--wairon-border-muted"],_c={none:"none",subtle:"0 1px 2px rgba(0, 0, 0, 0.14)",soft:"0 4px 14px rgba(0, 0, 0, 0.18)",medium:"0 8px 24px rgba(0, 0, 0, 0.24)",strong:"0 16px 40px rgba(0, 0, 0, 0.32)",glow:"0 0 0 1px rgba(var(--wairon-primary-rgb), 0.35), 0 0 24px rgba(var(--wairon-primary-rgb), 0.22)"},w1=t=>({...t,swatches:[...t.swatches],variables:{...t.variables},modeVariables:Object.fromEntries(Object.entries(t.modeVariables??{}).map(([e,n])=>[e,{...n}]))}),k1=t=>Object.fromEntries(Object.entries(t??{}).sort(([e],[n])=>e.localeCompare(n))),E1=t=>JSON.stringify(t.map(e=>({...e,variables:k1(e.variables),modeVariables:Object.fromEntries(Object.entries(e.modeVariables??{}).map(([n,r])=>[n,k1(r)]))})));function Q5(t){const e=Ng(t.value)??{r:0,g:0,b:0,a:1},n=ar(t.value,"#000000"),r=i=>{const s=Ng(i);s&&t.onChange(e.a<1?`rgba(${s.r}, ${s.g}, ${s.b}, ${e.a.toFixed(2)})`:i)},a=i=>{const s=Math.min(1,Math.max(0,i));t.onChange(s>=1?n:`rgba(${e.r}, ${e.g}, ${e.b}, ${s.toFixed(2)})`)};return c.jsxs("div",{className:"tb-color",children:[c.jsx("input",{type:"color",className:"tb-color-pick",value:n,onChange:i=>r(i.target.value)}),c.jsxs("div",{className:"tb-color-body",children:[c.jsx("input",{className:"tb-input tb-mono",value:t.value,onChange:i=>t.onChange(i.target.value),placeholder:"HEX, rgba(), or hsl()"}),c.jsxs("div",{className:"tb-alpha",children:[c.jsx("input",{type:"range",min:"0",max:"1",step:"0.01",value:e.a,onChange:i=>a(Number.parseFloat(i.target.value))}),c.jsxs("span",{className:"hint",children:[Math.round(e.a*100),"%"]})]})]})]})}function Z5(t){var i;const e=(i=Object.entries(_c).find(([,s])=>s===t.value))==null?void 0:i[0],[n,r]=A.useState(!e),a=n?"custom":e??"custom";return c.jsxs("div",{className:"tb-shadow",children:[c.jsxs("select",{className:"tb-input",value:a,onChange:s=>{const o=s.target.value;r(o==="custom"),o!=="custom"&&t.onChange(_c[o])},children:[Object.keys(_c).map(s=>c.jsx("option",{value:s,children:s[0].toUpperCase()+s.slice(1)},s)),c.jsx("option",{value:"custom",children:"Custom"})]}),c.jsx("input",{className:"tb-input tb-mono",value:t.value,onChange:s=>{r(!0),t.onChange(s.target.value)},placeholder:"box-shadow CSS",style:{boxShadow:t.value||_c.soft}})]})}function C1(t){return c.jsxs("div",{className:"tb-field",children:[c.jsxs("div",{className:"tb-field-head",children:[c.jsx("span",{className:"tb-field-label",children:t.label}),t.overridden?c.jsx("button",{className:"tb-clear",onClick:t.onClear,title:"Remove the override — derive from the primary again",children:"custom ↺"}):c.jsx("span",{className:"tb-derived",children:"derived"})]}),t.kind==="color"&&c.jsx(Q5,{value:t.value,onChange:t.onChange}),t.kind==="shadow"&&c.jsx(Z5,{value:t.value,onChange:t.onChange}),t.kind==="text"&&c.jsx("input",{className:"tb-input tb-mono",value:t.value,onChange:e=>t.onChange(e.target.value)})]})}function Np(t){const e=pu(ar(t.text,"#ffffff"),ar(t.background,"#000000"));return c.jsxs("div",{className:"tb-sample",style:{background:t.background,color:t.text},children:[c.jsx("div",{className:"tb-sample-label",children:t.label}),c.jsx("div",{className:"tb-sample-main",children:"Primary text sample"}),c.jsxs("div",{className:"tb-sample-sub",children:["Secondary text sample — ",e.toFixed(1),":1 ",e>=4.5?"✓ AA":"✕ below AA"]})]})}function J5(){const{themeId:t,appearance:e,customThemes:n,setThemeId:r,setCustomThemes:a}=Ou(),i=Dt(),s=A.useMemo(()=>n.map(w1).map(Es),[n]),o=A.useMemo(()=>E1(s),[s]),[l,u]=A.useState(()=>s),[d,f]=A.useState(()=>{var z;return((z=s[0])==null?void 0:z.id)??null}),h=A.useRef(o);A.useEffect(()=>{h.current!==o&&(h.current=o,u(s),f(z=>{var _;return z&&s.some(K=>K.id===z)?z:((_=s[0])==null?void 0:_.id)??null}))},[s,o]);const v=A.useMemo(()=>l.find(z=>z.id===d)??l[0]??null,[l,d]),[p,y]=A.useState(Uo(e)),[b,m]=A.useState("light"),[g,w]=A.useState("#22ddff");A.useEffect(()=>{v&&(y(v.defaultMode),m(v.defaultMode),w(v.swatches[0]))},[v==null?void 0:v.id]);const E=A.useMemo(()=>E1(l.map(Es)),[l])!==o,S=A.useMemo(()=>v?Fd(v,p):null,[v,p]),C=z=>{v&&u(_=>_.map(K=>K.id===v.id?Es(z(w1(K))):K))},T=(z,_)=>C(K=>({...K,variables:{...K.variables,[z]:_}})),N=z=>C(_=>{const K={..._.variables};return delete K[z],{..._,variables:K}}),P=(z,_)=>C(K=>{var ie;return{...K,modeVariables:{...K.modeVariables??{},[z]:{...((ie=K.modeVariables)==null?void 0:ie[z])??{},..._}}}}),R=(z,_)=>C(K=>{var M;const ie={...((M=K.modeVariables)==null?void 0:M[z])??{}};return delete ie[_],{...K,modeVariables:{...K.modeVariables??{},[z]:ie}}}),I=()=>{const z=rC(mu(t,l),Uo(e));u(_=>[..._,z]),f(z.id)},D=()=>{if(!v)return;const z=zP(v);u(_=>[..._,z]),f(z.id)},$=()=>{v&&u(z=>{const _=z.filter(K=>K.id!==v.id);return f(K=>{var ie;return K===v.id?((ie=_[0])==null?void 0:ie.id)??null:K}),_})},H=()=>C(z=>({...z,swatches:[g,z.swatches[1],z.swatches[2]],variables:{},modeVariables:{}})),V=()=>{if(!v||!S)return;const z=ar(S["--wairon-page-bg"],"#0b1120"),_=ar(S["--wairon-panel-bg"],z),K=ar(S["--wairon-primary"],"#22ddff"),ie=pu("#ffffff",K)>=pu("#000000",K)?"#ffffff":"#000000";P(p,{"--wairon-text":yo(ar(S["--wairon-text"],"#f9fafb"),z,4.5),"--wairon-text-muted":yo(ar(S["--wairon-text-muted"],"#cbd5e1"),_,4.5),"--wairon-text-subtle":yo(ar(S["--wairon-text-subtle"],"#94a3b8"),_,4.5),"--wairon-primary-contrast":yo(ie,K,4.5)})},U=()=>{const z=l.map(Es);a(z),t.startsWith("custom:")&&!z.some(_=>_.id===t)&&r(eC),i.ok("Custom themes saved")},F=()=>{u(s),f(z=>{var _;return z&&s.some(K=>K.id===z)?z:((_=s[0])==null?void 0:_.id)??null})},G=mu(t,l);return c.jsxs("div",{className:"view-pad tb-view",children:[c.jsx("div",{className:"view-head",children:c.jsxs("div",{children:[c.jsx("h2",{children:"Theme builder"}),c.jsx("p",{className:"hint",children:"Custom themes are stored in this browser and layer your edits over the palette derived from the primary color. Changes stage locally until you save."})]})}),c.jsxs("div",{className:"tb-layout",children:[c.jsxs("aside",{className:"panel tb-side",children:[c.jsxs("div",{className:"tb-side-head",children:[c.jsx("strong",{children:"Custom themes"}),c.jsxs("span",{className:"hint",children:[l.length," local ",l.length===1?"draft":"drafts"]})]}),c.jsx("button",{className:"btn tb-new",onClick:I,children:"+ New from active theme"}),c.jsxs("div",{className:"tb-list",children:[l.length===0&&c.jsx("div",{className:"tb-empty hint",children:"No custom themes yet."}),l.map(z=>c.jsxs("button",{className:`theme-opt ${z.id===(v==null?void 0:v.id)?"is-active":""}`,onClick:()=>f(z.id),children:[c.jsx("span",{className:"swatches",children:z.swatches.map((_,K)=>c.jsx("span",{style:{background:_}},`${K}-${_}`))}),c.jsxs("span",{className:"cell-stack",children:[c.jsx("span",{className:"theme-name",children:z.label}),c.jsxs("span",{className:"hint",children:[z.defaultMode," mode"]})]}),z.id===t&&c.jsx("span",{className:"check",children:"✓"})]},z.id))]})]}),c.jsx("section",{className:"panel tb-main",children:v?c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"tb-head",children:[c.jsxs("div",{className:"tb-head-fields",children:[c.jsxs("label",{className:"tb-field",children:[c.jsx("span",{className:"tb-field-label",children:"Name"}),c.jsx("input",{className:"tb-input",value:v.label,onChange:z=>C(_=>({..._,label:z.target.value}))})]}),c.jsxs("label",{className:"tb-field",children:[c.jsx("span",{className:"tb-field-label",children:"Description"}),c.jsx("input",{className:"tb-input",value:v.description,onChange:z=>C(_=>({..._,description:z.target.value}))})]}),c.jsxs("div",{className:"tb-field",children:[c.jsx("span",{className:"tb-field-label",children:"Default mode"}),c.jsx("div",{className:"seg",children:Tp.map(z=>c.jsx("button",{className:`seg-btn ${v.defaultMode===z.id?"is-active":""}`,onClick:()=>C(_=>({..._,defaultMode:z.id})),children:z.label},z.id))})]})]}),c.jsxs("div",{className:"tb-head-actions",children:[c.jsx("button",{className:"btn",onClick:()=>r(v.id),disabled:t===v.id,children:t===v.id?"✓ Active":"Use theme"}),c.jsx("button",{className:"btn btn-ghost",onClick:D,children:"Duplicate"}),c.jsx("button",{className:"btn btn-danger",onClick:$,children:"Delete"})]})]}),c.jsxs("section",{className:"tb-block",children:[c.jsx("div",{className:"tb-block-head",children:c.jsxs("div",{children:[c.jsx("div",{className:"tb-block-title",children:"Seed"}),c.jsx("p",{className:"hint",children:"Derive the whole palette from one primary color. This clears every override so all tokens follow the seed again."})]})}),c.jsxs("div",{className:"tb-seed",children:[c.jsx("input",{type:"color",className:"tb-seed-pick",value:ar(g,"#22ddff"),onChange:z=>w(z.target.value)}),c.jsx("button",{className:"btn btn-primary",onClick:H,children:"Derive full palette"})]})]}),c.jsx("section",{className:"tb-block",children:c.jsxs("div",{className:"tb-block-head",children:[c.jsxs("div",{children:[c.jsx("div",{className:"tb-block-title",children:"Preview mode"}),c.jsx("p",{className:"hint",children:"Editors and previews below resolve the theme in this appearance mode."})]}),c.jsx("div",{className:"seg tb-seg",children:Tp.map(z=>c.jsx("button",{className:`seg-btn ${p===z.id?"is-active":""}`,onClick:()=>y(z.id),children:z.label},z.id))})]})}),Y5.map(z=>c.jsxs("section",{className:"tb-block",children:[c.jsx("div",{className:"tb-block-title",children:z}),c.jsx("div",{className:"tb-grid",children:Xg.filter(_=>_.group===z).map(_=>c.jsx(C1,{label:_.label,kind:_.kind,value:v.variables[_.key]??(S==null?void 0:S[_.key])??"",overridden:v.variables[_.key]!==void 0,onChange:K=>T(_.key,K),onClear:()=>N(_.key)},`${v.id}:${_.key}`))}),z==="Surfaces"&&S&&c.jsx("div",{className:"tb-strip",children:["--wairon-page-bg","--wairon-panel-bg","--wairon-header-bg"].map(_=>c.jsx("div",{className:"tb-strip-swatch",style:{background:S[_]},title:_},_))}),z==="Text"&&S&&c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"tb-block-head tb-acc-head",children:[c.jsx("p",{className:"hint",children:"Pin WCAG-AA (4.5:1) text colors for the previewed mode against its resolved backgrounds, stored as mode overrides."}),c.jsx("button",{className:"btn btn-ghost btn-sm",onClick:V,children:"Generate accessible text set"})]}),c.jsxs("div",{className:"tb-strip",children:[c.jsx(Np,{label:"Page text",text:S["--wairon-text"],background:S["--wairon-page-bg"]}),c.jsx(Np,{label:"Panel text",text:S["--wairon-text-muted"],background:S["--wairon-panel-bg"]}),c.jsx(Np,{label:"Primary button",text:S["--wairon-primary-contrast"],background:S["--wairon-primary"]})]})]})]},z)),c.jsxs("section",{className:"tb-block",children:[c.jsxs("div",{className:"tb-block-head",children:[c.jsxs("div",{children:[c.jsx("div",{className:"tb-block-title",children:"Mode overrides"}),c.jsx("p",{className:"hint",children:"Pin surface, text, and border tokens for one appearance mode; anything left derived keeps following the primary per mode."})]}),c.jsx("div",{className:"seg tb-seg",children:Tp.map(z=>c.jsx("button",{className:`seg-btn ${b===z.id?"is-active":""}`,onClick:()=>m(z.id),children:z.label},z.id))})]}),c.jsx("div",{className:"tb-grid",children:X5.map(z=>{var M,oe;const _=Xg.find(ve=>ve.key===z),K=(oe=(M=v.modeVariables)==null?void 0:M[b])==null?void 0:oe[z],ie=K??Fd(v,b)[z]??"";return c.jsx(C1,{label:(_==null?void 0:_.label)??z,kind:(_==null?void 0:_.kind)??"color",value:ie,overridden:K!==void 0,onChange:ve=>P(b,{[z]:ve}),onClear:()=>R(b,z)},`${v.id}:${b}:${z}`)})})]}),c.jsxs("div",{className:"tb-foot",children:[c.jsxs("span",{className:"hint",children:["Active theme: ",G.label]}),c.jsx("button",{className:"btn btn-primary",onClick:()=>r(v.id),children:"Set active theme"})]})]}):c.jsx("div",{className:"tb-empty-main hint",children:"Create a custom theme to edit its palette here."})})]}),E&&c.jsxs("div",{className:"savebar",children:[c.jsx("span",{className:"savebar-icon",children:"⚠"}),c.jsxs("div",{className:"cell-stack",children:[c.jsx("strong",{children:"Unsaved theme changes"}),c.jsx("span",{className:"hint",children:"Staged locally until you save."})]}),c.jsx("span",{className:"spacer"}),c.jsx("button",{className:"btn btn-ghost",onClick:F,children:"Reset"}),c.jsx("button",{className:"btn btn-primary",onClick:U,children:"Save changes"})]})]})}const Qg="local",ez=[{to:"/canvas",label:"Canvas",icon:"◈"},{to:"/projects",label:"Projects",icon:"▦"},{to:"/agents",label:"Agents",icon:"⌁"}],tz=[{to:"/admin/users",label:"Users",icon:"⦿"},{to:"/admin/roles",label:"Roles",icon:"⛨"},{to:"/admin/permissions",label:"Permissions",icon:"⚖"},{to:"/admin/units",label:"Organization",icon:"⌂"},{to:"/admin/providers",label:"Sign-in (SSO)",icon:"⚿"},{to:"/admin/approvals",label:"Approvals",icon:"✓"},{to:"/admin/audit",label:"Audit",icon:"☰"},{to:"/admin/health",label:"Health",icon:"♥"},{to:"/admin/instance",label:"Instance",icon:"⚙"}];function S1(t){return c.jsx("nav",{className:"nav-group",children:t.items.map(e=>c.jsxs(TP,{to:e.to,end:e.end,className:"nav-item",title:t.collapsed?e.label:void 0,children:[c.jsx("span",{className:"nav-icon",children:e.icon}),!t.collapsed&&c.jsx("span",{className:"nav-text",children:e.label})]},e.to))})}function nz(t){return c.jsxs("aside",{className:"sidebar",children:[c.jsxs("div",{className:"sidebar-top",children:[!t.collapsed&&c.jsx("span",{className:"brand syw-gradient-text",children:"wairon"}),c.jsx("button",{className:"icon-btn sidebar-toggle",onClick:t.onToggle,"aria-label":t.collapsed?"Expand sidebar":"Collapse sidebar",title:t.collapsed?"Expand":"Collapse",children:"☰"})]}),c.jsx(S1,{items:ez,collapsed:t.collapsed}),t.adminVisible&&c.jsxs(c.Fragment,{children:[!t.collapsed&&c.jsx("div",{className:"nav-label",children:"Administration"}),t.collapsed&&c.jsx("div",{className:"nav-divider"}),c.jsx(S1,{items:tz,collapsed:t.collapsed})]})]})}const rz=[{id:"canvas",label:"Canvas"},{id:"specs",label:"Specs"}];function az(){const e=(Ef()["*"]??"").split("/").filter(Boolean),n=(e[0]===Qg?e.slice(1):e).join("/");return c.jsx("div",{className:"canvas-view",children:c.jsx(Ej,{projectId:Qg,route:n})})}function iz(){const t=Ef()["*"]??"",e=Pr(),n=t.split("/").filter(Boolean),r=A.useMemo(()=>n.length>=2?{kind:n[0],id:n.slice(1).map(decodeURIComponent).join("::")}:null,[t]),a=i=>{if(!i)return e("/specs");const s=i.id.split("::").map(encodeURIComponent).join("/");e(`/specs/${i.kind}/${s}`)};return c.jsx("div",{className:"view-pad view-pad-wide",children:c.jsx(wj,{projectId:Qg,selection:r,onSelectSpec:a})})}function sz(){const t=Pr(),{pathname:e}=oi(),n=e.startsWith("/specs")?"specs":"canvas";return c.jsx("div",{className:"shell",children:c.jsxs("div",{className:"main-col",children:[c.jsxs("header",{className:"topbar dev-bar",children:[c.jsx("span",{className:"brand syw-gradient-text",children:"wairon"}),c.jsx("span",{className:"dev-tag",title:"Local developer server — this project only",children:"dev"}),c.jsx(jf,{tabs:rz,active:n,onSelect:r=>t(r==="specs"?"/specs":"/canvas")}),c.jsx("span",{className:"spacer"}),c.jsx(dC,{}),c.jsx(hC,{})]}),c.jsx("main",{className:"view",children:c.jsxs(XE,{children:[c.jsx(An,{path:"/canvas/*",element:c.jsx(az,{})}),c.jsx(An,{path:"/specs/*",element:c.jsx(iz,{})}),c.jsx(An,{path:"*",element:c.jsx(Eg,{to:"/canvas",replace:!0})})]})})]})})}function oz(){const{ctx:t,adminVisible:e}=Zm(),{sidebarCollapsed:n,toggleSidebar:r}=Ou();async function a(){try{await yt("/web/logout")}finally{window.location.reload()}}return t!=null&&t.local?c.jsx(sz,{}):c.jsxs("div",{className:`shell ${n?"is-collapsed":""}`,children:[c.jsx(nz,{adminVisible:e,collapsed:n,onToggle:r}),c.jsxs("div",{className:"main-col",children:[c.jsxs("header",{className:"topbar",children:[c.jsx("span",{className:"spacer"}),c.jsx(dC,{}),t&&c.jsx(YP,{ctx:t,onSignOut:a})]}),c.jsx("main",{className:"view",children:c.jsxs(XE,{children:[c.jsx(An,{path:"/",element:c.jsx(AM,{})}),c.jsx(An,{path:"/canvas/*",element:c.jsx(k5,{})}),c.jsx(An,{path:"/projects",element:c.jsx(p5,{})}),c.jsx(An,{path:"/projects/:projectId/*",element:c.jsx(f5,{})}),c.jsx(An,{path:"/agents",element:c.jsx(E5,{})}),c.jsx(An,{path:"/themes",element:c.jsx(J5,{})}),c.jsx(An,{path:"/admin/users",element:c.jsx(FM,{})}),c.jsx(An,{path:"/admin/roles",element:c.jsx($M,{})}),c.jsx(An,{path:"/admin/permissions",element:c.jsx(GM,{})}),c.jsx(An,{path:"/admin/units",element:c.jsx(JM,{})}),c.jsx(An,{path:"/admin/providers",element:c.jsx(N5,{})}),c.jsx(An,{path:"/admin/approvals",element:c.jsx(P5,{})}),c.jsx(An,{path:"/admin/audit",element:c.jsx(L5,{})}),c.jsx(An,{path:"/admin/health",element:c.jsx(B5,{})}),c.jsx(An,{path:"/admin/instance",element:c.jsx(G5,{})}),c.jsx(An,{path:"/admin",element:c.jsx(Eg,{to:"/admin/users",replace:!0})}),c.jsx(An,{path:"*",element:c.jsx(Eg,{to:"/",replace:!0})})]})})]})]})}let ro=null;function lz({onSignedIn:t}){const[e,n]=A.useState(ro===null?"probing":ro==="dev"?"dev-failed":"hosted");return A.useEffect(()=>{if(ro!==null)return;let r=!0;return ZE("/web/dev-login",{redirect:"manual"}).then(a=>{ro=a.status===404?"hosted":"dev",r&&(ro==="dev"?t():n("hosted"))}).catch(()=>{ro="hosted",r&&n("hosted")}),()=>{r=!1}},[t]),e==="probing"?c.jsx("div",{className:"boot",children:"Connecting…"}):e==="dev-failed"?c.jsxs("div",{className:"boot",children:[c.jsx("p",{className:"err",children:"Could not start the local developer session."}),c.jsxs("p",{className:"hint",children:["This is a local ",c.jsx("code",{children:"wairon dev"})," server — it has no sign-in. Stop it, clear this site's cookies, and run ",c.jsx("code",{children:"wairon dev"})," again."]}),c.jsx("button",{className:"btn",onClick:t,children:"Retry"})]}):c.jsx(XP,{onSignedIn:t})}function uz(){const{status:t,error:e,reload:n}=Zm();return t==="loading"?c.jsx("div",{className:"boot",children:"Loading…"}):t==="anonymous"?c.jsx(lz,{onSignedIn:n}):t==="error"?c.jsxs("div",{className:"boot",children:[c.jsx("p",{className:"err",children:"Could not reach the server."}),c.jsx("button",{className:"btn",onClick:n,children:"Retry"}),e&&c.jsx("p",{className:"hint",children:e})]}):c.jsx(WP,{children:c.jsx(oz,{})})}function cz(){return c.jsx($P,{children:c.jsx(EP,{children:c.jsx(DP,{children:c.jsx(KP,{children:c.jsx(uz,{})})})})})}FE(document.getElementById("root")).render(c.jsx(A.StrictMode,{children:c.jsx(cz,{})}));</script>
|
|
766
|
+
<style rel="stylesheet" crossorigin>:root{--syw-cyan: #22ddff;--syw-purple: #8b5cf6;--syw-yellow: #ddff22;--syw-amber: #f59e0b;--syw-primary-gradient: linear-gradient(135deg, #22ddff 0%, #8b5cf6 100%);--syw-secondary-gradient: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);--syw-glow: 0 0 20px rgba(34, 221, 255, .3)}:root{--bg: var(--wairon-page-bg, #0a0a0f);--chrome: var(--wairon-panel-bg-strong, #0e0e16);--chrome-2: var(--wairon-panel-bg-strong, #12121a);--header-bg: var(--wairon-header-bg, #0e0e16);--sidebar-bg: var(--wairon-sidebar-bg, #0e0e16);--menu-bg: var(--wairon-menu-bg, #14141d);--border: var(--wairon-border, #23232e);--border-strong: var(--wairon-border-strong, rgba(34, 221, 255, .5));--border-soft: var(--wairon-border-muted, #1b1b25);--card: var(--wairon-panel-bg, #14141d);--panel: var(--wairon-panel-bg, #16161f);--panel-soft: var(--wairon-panel-bg-soft, rgba(34, 221, 255, .06));--ink: var(--wairon-text, #e8e8f0);--ink-dim: var(--wairon-text-muted, #9a9aab);--ink-subtle: var(--wairon-text-subtle, #64646f);--accent: var(--wairon-primary, #22ddff);--accent-strong: var(--wairon-primary-strong, #22ddff);--on-accent: var(--wairon-primary-contrast, #08080c);--accent-purple: var(--wairon-secondary, #8b5cf6);--ok: var(--wairon-ok, #34d399);--warn: var(--wairon-warn, #fbbf24);--bad: var(--wairon-bad, #f43f5e);--hover: var(--wairon-panel-bg-hover, #1d1d28);--shadow: var(--wairon-shadow, 0 12px 40px rgba(0, 0, 0, .5));--focus: var(--wairon-focus-ring, 0 0 0 3px rgba(34, 221, 255, .34));--brand-gradient: var(--wairon-brand-text-bg, var(--syw-primary-gradient));--radius: 10px;--radius-sm: 7px;--sidebar-w: 236px;--rail-w: 62px;--header-h: 54px}*{box-sizing:border-box}html,body,#root{height:100%;margin:0}body{background:var(--bg);color:var(--ink);font:14px/1.5 Inter,system-ui,-apple-system,Segoe UI,Roboto,sans-serif;-webkit-font-smoothing:antialiased;overflow:hidden}h2,h3,h4{margin:0;font-weight:700}code{font-family:ui-monospace,SF Mono,Cascadia Code,Menlo,monospace;font-size:.86em}.subtle{color:var(--ink-subtle)}.hint{color:var(--ink-dim);font-size:12.5px}.err{color:var(--bad)}.pad{padding:24px}.spacer{flex:1}.stack-lg{display:flex;flex-direction:column;gap:16px}.syw-gradient-text{background:var(--brand-gradient);-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent;color:transparent}.btn{font:inherit;cursor:pointer;border:1px solid var(--border);background:var(--chrome-2);color:var(--ink);border-radius:var(--radius-sm);padding:7px 13px;display:inline-flex;align-items:center;gap:6px;white-space:nowrap;transition:background .12s,border-color .12s,box-shadow .12s}.btn:hover:not(:disabled){background:var(--hover)}.btn:focus-visible{outline:none;box-shadow:var(--focus)}.btn:disabled{opacity:.5;cursor:default}.btn-sm{padding:4px 9px;font-size:12.5px}.btn-primary{background:var(--brand-gradient);border:none;color:var(--on-accent);font-weight:700}.btn-primary:hover:not(:disabled){box-shadow:var(--syw-glow);transform:translateY(-1px);background:var(--brand-gradient)}.btn-ghost{background:transparent;border-color:var(--border);color:var(--ink-dim)}.btn-ghost:hover:not(:disabled){background:var(--hover);color:var(--ink);border-color:var(--border-strong)}.btn-danger{background:transparent;border-color:#f43f5e80;color:var(--bad)}.btn-danger:hover:not(:disabled){background:#f43f5e1f}.icon-btn{background:transparent;border:none;color:var(--ink-dim);cursor:pointer;font-size:18px;line-height:1;padding:6px 8px;border-radius:var(--radius-sm)}.icon-btn:hover{background:var(--hover);color:var(--ink)}.input{font:inherit;background:var(--wairon-panel-bg-soft, #0b0b12);color:var(--ink);border:1px solid var(--border);border-radius:var(--radius-sm);padding:7px 10px;width:100%}.input:focus{outline:none;border-color:var(--accent);box-shadow:var(--focus)}select.input{background-color:var(--panel);-webkit-appearance:none;-moz-appearance:none;appearance:none;padding-right:30px;background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239a9aab' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");background-repeat:no-repeat;background-position:right 10px center;cursor:pointer}select.input option,select.input optgroup{background-color:var(--panel);color:var(--ink)}.field{display:flex;flex-direction:column;gap:5px}.field-label{font-size:12.5px;font-weight:600;color:var(--ink-dim);display:inline-flex;align-items:center}.checkbox{display:flex;gap:9px;align-items:flex-start;cursor:pointer}.checkbox>input{margin:2px 0 0;width:15px;height:15px;flex:none;accent-color:var(--accent);cursor:pointer}.checkbox-body{display:flex;flex-direction:column;gap:3px;min-width:0}.checkbox-label{font-size:13px;color:var(--ink);display:inline-flex;align-items:center}.cell-inline{display:inline-flex;align-items:center;gap:8px;flex-wrap:wrap}.preview-id{display:inline-block;padding:6px 10px;background:var(--panel-soft);border:1px dashed var(--border);border-radius:var(--radius-sm);color:var(--accent)}.unitsel{position:relative}.unitsel-trigger{display:flex;align-items:center;gap:8px;text-align:left;cursor:pointer;padding-right:30px}.unitsel-trigger .unitsel-caret{margin-left:auto;color:var(--ink-dim);font-size:10px}.unitsel-current{display:inline-flex;align-items:baseline;gap:8px;min-width:0}.unitsel-current .unitsel-name{font-weight:600;color:var(--ink)}.unitsel-ph{color:var(--ink-subtle)}.unitsel-id{font-size:11px;color:var(--ink-subtle)}.unitsel-pop{margin-top:6px;border:1px solid var(--border);border-radius:var(--radius-sm);background:var(--panel);box-shadow:var(--wairon-shadow, 0 10px 24px rgba(0,0,0,.3));overflow:hidden}.unitsel-search{border:none;border-bottom:1px solid var(--border-soft);border-radius:0}.unitsel-search:focus{box-shadow:none;border-color:var(--border-soft)}.unitsel-list{max-height:260px;overflow-y:auto;padding:5px}.unitsel-empty{padding:12px;color:var(--ink-dim);font-size:12.5px}.unitsel-row{display:flex;align-items:center;gap:4px;border-radius:var(--radius-sm)}.unitsel-row.sel{background:var(--panel-soft)}.unitsel-row:hover{background:var(--hover)}.unitsel-twist{flex:none;width:20px;height:24px;border:none;background:transparent;color:var(--ink-subtle);cursor:pointer;font-size:10px;line-height:1}.unitsel-label{flex:1;display:flex;align-items:baseline;gap:8px;min-width:0;border:none;background:transparent;cursor:pointer;text-align:left;padding:5px 6px;color:var(--ink);font:inherit}.unitsel-label .unitsel-name{font-size:13px;font-weight:500;white-space:nowrap}.unitsel-kind{font-size:10.5px;color:var(--ink-dim);border:1px solid var(--border);border-radius:999px;padding:0 6px}.unitsel-label .unitsel-id{margin-left:auto;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.msel{position:relative}.msel-trigger{display:flex;align-items:center;gap:8px;text-align:left;cursor:pointer;min-height:34px;padding-right:30px;flex-wrap:wrap}.msel-trigger .msel-caret{margin-left:auto;color:var(--ink-dim);font-size:10px}.msel-ph{color:var(--ink-subtle)}.msel-chips{display:inline-flex;flex-wrap:wrap;gap:4px;min-width:0}.msel-chip{display:inline-flex;align-items:center;gap:5px;font-size:12px;font-weight:600;color:var(--accent);background:var(--panel-soft);border:1px solid var(--border-strong);border-radius:6px;padding:1px 4px 1px 7px}.msel-chip-x{cursor:pointer;color:var(--ink-dim);font-size:13px;line-height:1;padding:0 2px}.msel-chip-x:hover{color:var(--bad)}.msel-pop{position:absolute;left:0;right:0;z-index:60;margin-top:6px;border:1px solid var(--border);border-radius:var(--radius-sm);background:var(--panel);box-shadow:var(--wairon-shadow, 0 10px 24px rgba(0,0,0,.3));overflow:hidden}.msel-search{border:none;border-bottom:1px solid var(--border-soft);border-radius:0}.msel-search:focus{box-shadow:none;border-color:var(--border-soft)}.msel-list{max-height:280px;overflow-y:auto;padding:5px}.msel-empty{padding:12px;color:var(--ink-dim);font-size:12.5px}.msel-group-head{font-size:10.5px;text-transform:uppercase;letter-spacing:.06em;color:var(--ink-subtle);font-weight:700;padding:8px 8px 4px}.msel-opt{display:flex;align-items:flex-start;gap:9px;cursor:pointer;padding:6px 8px;border-radius:var(--radius-sm)}.msel-opt:hover{background:var(--hover)}.msel-opt.sel{background:var(--panel-soft)}.msel-opt>input{margin:2px 0 0;width:15px;height:15px;flex:none;accent-color:var(--accent);cursor:pointer}.msel-opt-body{display:flex;flex-direction:column;gap:2px;min-width:0}.msel-opt-label{font-size:13px;color:var(--ink)}.msel-opt-hint{font-size:11px;color:var(--ink-dim)}.pack-contents{display:flex;flex-direction:column;gap:8px;padding:8px 0 2px}.pack-contents-row{display:flex;flex-direction:column;gap:4px}.pack-contents-k{font-size:10.5px;text-transform:uppercase;letter-spacing:.05em;color:var(--ink-subtle);font-weight:700}.pack-toggle{align-self:flex-start;background:transparent;border:none;cursor:pointer;color:var(--ink-dim);font:inherit;font-size:12.5px;padding:0;display:inline-flex;gap:6px;align-items:center}.pack-toggle:hover{color:var(--ink)}.infotip{position:relative;display:inline-flex;vertical-align:middle;margin-left:6px}.infotip-icon{width:16px;height:16px;padding:0;border-radius:50%;border:1px solid var(--border-strong);background:transparent;color:var(--ink-dim);font-size:10px;font-style:italic;font-weight:700;font-family:Georgia,serif;line-height:1;cursor:help;display:inline-flex;align-items:center;justify-content:center}.infotip-icon:hover{color:var(--accent);border-color:var(--accent)}.infotip-bubble{position:fixed;z-index:500;width:340px;max-width:92vw;max-height:320px;overflow-y:auto;padding:12px 14px;border:1px solid var(--border);border-radius:var(--radius-sm);background:var(--panel);color:var(--ink-dim);font-size:12.5px;font-weight:400;line-height:1.5;text-align:left;white-space:normal;box-shadow:var(--wairon-shadow, 0 12px 28px rgba(0,0,0,.34));animation:infotip-in .12s ease}@keyframes infotip-in{0%{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:translateY(0)}}.infotip-bubble strong{color:var(--ink)}.infotip-bubble code{color:var(--accent)}.infotip-bubble ul{margin:6px 0 0;padding-left:16px;display:flex;flex-direction:column;gap:3px}.infotip-bubble a{color:var(--accent)}.infotip-bubble p{margin:0 0 6px}.infotip-bubble p:last-child{margin-bottom:0}.token-help{margin-top:12px;padding:12px 14px;border:1px solid var(--border-soft);border-left:3px solid var(--accent);border-radius:var(--radius-sm);background:var(--panel-soft);font-size:12.5px;color:var(--ink-dim)}.token-help h5{margin:12px 0 4px;color:var(--ink);font-size:12.5px}.token-help h5:first-of-type{margin-top:4px}.token-help ol,.token-help ul{margin:0;padding-left:18px;display:flex;flex-direction:column;gap:3px}.token-help li{line-height:1.5}.token-help strong{color:var(--ink)}.token-help code,.token-help a{color:var(--accent)}.token-help-note{margin:0 0 8px;line-height:1.5}.token-help-note:last-child{margin:10px 0 0}.badge{display:inline-flex;align-items:center;font-size:11px;font-weight:700;border-radius:6px;padding:2px 7px;border:1px solid transparent}.badge-neutral{color:var(--ink-dim);border-color:var(--border)}.badge-ok{color:var(--ok);border-color:#34d39966;background:#34d39914}.badge-warn{color:var(--warn);border-color:#fbbf2466;background:#fbbf2414}.badge-bad{color:var(--bad);border-color:#f43f5e66;background:#f43f5e14}.badge-accent{color:var(--accent);border-color:var(--border-strong);background:var(--panel-soft)}.shell{display:flex;height:100%}.main-col{flex:1;min-width:0;display:flex;flex-direction:column}.view-full{height:100%}.sidebar{width:var(--sidebar-w);flex:0 0 var(--sidebar-w);background:var(--sidebar-bg);border-right:1px solid var(--border);box-shadow:var(--wairon-shell-shadow, none);padding:10px;display:flex;flex-direction:column;gap:6px;overflow-x:hidden;overflow-y:auto;transition:width .18s ease,flex-basis .18s ease}.shell.is-collapsed .sidebar{width:var(--rail-w);flex-basis:var(--rail-w)}.sidebar-top{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:4px 6px 10px;min-height:42px}.shell.is-collapsed .sidebar-top{justify-content:center}.brand{font-weight:800;font-size:18px}.sidebar-toggle{flex:0 0 auto}.nav-group{display:flex;flex-direction:column;gap:2px}.nav-label{font-size:10.5px;text-transform:uppercase;letter-spacing:.08em;color:var(--ink-subtle);padding:14px 10px 6px;font-weight:700}.nav-divider{height:1px;background:var(--border);margin:10px 8px}.nav-item{display:flex;align-items:center;gap:12px;text-decoration:none;color:var(--ink-dim);padding:9px 11px;border-radius:var(--radius-sm);font-size:13.5px;font-weight:600}.shell.is-collapsed .nav-item{justify-content:center;padding:9px 0}.nav-item:hover{background:var(--hover);color:var(--ink)}.nav-item.active{background:var(--panel-soft);color:var(--accent)}.nav-icon{width:18px;text-align:center;font-size:16px;flex:0 0 auto}.topbar{display:flex;align-items:center;gap:12px;height:var(--header-h);padding:0 14px;background:var(--header-bg);border-bottom:1px solid var(--border);flex:0 0 auto}.view{flex:1;min-height:0;overflow:auto}.dev-bar{gap:10px}.dev-bar .tabstrip{border-bottom:none;margin-left:6px}.dev-bar .tab{padding:7px 13px}.dev-bar .theme-cog{position:static}.dev-tag{font-size:10px;font-weight:800;letter-spacing:.09em;text-transform:uppercase;color:var(--accent);border:1px solid var(--border);border-radius:var(--radius-sm);padding:2px 6px}.hmenu{position:relative}.hmenu-trigger{display:flex;align-items:center;gap:8px;background:transparent;border:1px solid transparent;border-radius:var(--radius-sm);padding:5px 8px;cursor:pointer;color:var(--ink);font:inherit}.hmenu-trigger:hover,.hmenu-trigger.is-open{background:var(--hover);border-color:var(--border)}.hmenu-who{font-size:13px;color:var(--ink-dim);max-width:180px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.chevron{color:var(--ink-subtle);font-size:11px}.avatar{display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;border-radius:50%;background:var(--brand-gradient);color:var(--on-accent);font-weight:800;font-size:13px;flex:0 0 auto}.avatar-lg{width:40px;height:40px;font-size:17px}.hmenu-pop{position:absolute;right:0;top:calc(100% + 8px);width:300px;max-width:90vw;background:var(--menu-bg);border:1px solid var(--border);border-radius:14px;box-shadow:var(--shadow);z-index:300;overflow:visible}.hmenu-head{display:flex;gap:12px;align-items:center;padding:16px;border-bottom:1px solid var(--border)}.hmenu-section{padding:12px 14px;border-bottom:1px solid var(--border)}.hmenu-label{font-size:10.5px;text-transform:uppercase;letter-spacing:.06em;color:var(--ink-subtle);font-weight:700;margin-bottom:8px}.hmenu-foot{padding:12px 14px;display:flex;justify-content:flex-end}.theme-cog{position:fixed;top:14px;right:16px;z-index:80}.theme-cog .hmenu-trigger{padding:8px 10px}.theme-cog .cog{font-size:16px;line-height:1;color:var(--ink-dim)}.theme-cog .hmenu-trigger:hover .cog,.theme-cog .hmenu-trigger.is-open .cog{color:var(--ink)}.tmenu{display:flex;flex-direction:column;gap:8px}.tmenu-head{display:flex;align-items:baseline;justify-content:space-between;gap:8px}.tmenu-label{font-size:10.5px;text-transform:uppercase;letter-spacing:.06em;color:var(--ink-subtle);font-weight:700}.tmenu-manage{font:inherit;font-size:11px;font-weight:700;color:var(--accent);background:none;border:none;cursor:pointer;padding:0}.tmenu-manage:hover{text-decoration:underline}.tmenu-hint{font-size:11px;color:var(--ink-subtle)}.tmenu-picker{position:relative}.tmenu-trigger{width:100%;min-height:38px;display:flex;align-items:center;gap:10px;padding:8px 10px;border-radius:var(--radius-sm);border:1px solid var(--border);background:var(--panel);color:var(--ink);cursor:pointer;text-align:left;font:inherit}.tmenu-trigger:hover{border-color:var(--border-strong)}.tmenu-trigger.is-open{border-color:var(--border-strong);box-shadow:var(--focus)}.tmenu-pill{display:flex;width:42px;height:16px;border-radius:999px;overflow:hidden;border:1px solid var(--border-soft);flex:0 0 auto}.tmenu-pill span{flex:1}.tmenu-opt-text{display:flex;flex-direction:column;gap:1px;min-width:0;flex:1}.tmenu-opt-name{font-size:13px;font-weight:800;line-height:1.1}.tmenu-opt-desc{font-size:11px;line-height:1.15;color:var(--ink-subtle);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.tmenu-caret{color:var(--ink-dim);font-size:10px;transition:transform .16s}.tmenu-trigger.is-open .tmenu-caret{transform:rotate(180deg)}.tmenu-panel{position:absolute;left:0;right:0;top:calc(100% + 6px);z-index:40;padding:4px;border-radius:var(--radius);border:1px solid var(--border);background:var(--menu-bg);box-shadow:var(--shadow);max-height:320px;overflow-y:auto}.tmenu-row{width:100%;display:flex;align-items:center;gap:10px;padding:8px;border-radius:var(--radius-sm);border:none;background:transparent;color:var(--ink);cursor:pointer;text-align:left;font:inherit}.tmenu-row:hover{background:var(--hover)}.tmenu-row.is-active{background:var(--panel-soft);color:var(--accent)}.tmenu-row .tmenu-pill{width:38px;height:14px}.tmenu-check{font-size:11px;color:var(--accent)}.tmenu-create{width:100%;min-height:34px;margin-top:4px;border-radius:var(--radius-sm);border:1px dashed var(--border-strong);background:var(--panel-soft);color:var(--accent);font:inherit;font-size:11px;font-weight:800;letter-spacing:.4px;text-transform:uppercase;cursor:pointer}.tmenu-create:hover{background:var(--hover)}.tmenu-modes{display:flex;gap:4px;padding:3px;border-radius:var(--radius-sm);background:var(--panel-soft);border:1px solid var(--border-soft)}.tmenu-mode{flex:1;min-height:28px;padding:5px 6px;border-radius:5px;border:1px solid transparent;background:transparent;color:var(--ink-dim);font:inherit;font-size:11px;font-weight:800;white-space:nowrap;cursor:pointer}.tmenu-mode:hover{color:var(--ink)}.tmenu-mode.is-active{border-color:var(--border-strong);background:var(--panel-soft);color:var(--accent)}.theme-list{display:flex;flex-direction:column;gap:4px}.theme-opt{display:flex;align-items:center;gap:10px;padding:8px;border-radius:var(--radius-sm);border:1px solid transparent;background:transparent;cursor:pointer;text-align:left;color:var(--ink);font:inherit}.theme-opt:hover{background:var(--hover)}.theme-opt.is-active{background:var(--panel-soft);border-color:var(--border-strong)}.theme-opt .swatches{display:flex;width:40px;height:15px;border-radius:999px;overflow:hidden;border:1px solid var(--border);flex:0 0 auto}.theme-opt .swatches span{flex:1}.theme-opt .theme-name{font-weight:800;font-size:13px}.theme-opt .check{margin-left:auto;color:var(--accent)}.seg{display:flex;gap:3px;padding:3px;border-radius:var(--radius-sm);background:var(--panel-soft);border:1px solid var(--border-soft)}.seg-btn{flex:1;padding:6px 4px;border-radius:5px;border:1px solid transparent;background:transparent;color:var(--ink-dim);font:inherit;font-size:11.5px;font-weight:700;cursor:pointer}.seg-btn:hover{color:var(--ink)}.seg-btn.is-active{background:var(--panel-soft);border-color:var(--border-strong);color:var(--accent)}.view-pad{padding:22px 26px;max-width:1180px}.view-head{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;margin-bottom:18px}.view-head h2{font-size:20px;margin-bottom:3px}.cell-stack{display:flex;flex-direction:column;gap:2px}.chip-row{display:flex;flex-wrap:wrap;gap:4px}.row-actions{display:flex;gap:6px;justify-content:flex-end;flex-wrap:wrap}.table-wrap{overflow-x:auto;border:1px solid var(--border);border-radius:var(--radius)}.table{width:100%;border-collapse:collapse;font-size:13.5px}.table th{text-align:left;font-size:11px;text-transform:uppercase;letter-spacing:.05em;color:var(--ink-subtle);padding:10px 14px;border-bottom:1px solid var(--border);background:var(--chrome-2);white-space:nowrap}.table td{padding:11px 14px;border-bottom:1px solid var(--border-soft);vertical-align:middle}.table tr:last-child td{border-bottom:none}.table tbody tr:hover{background:var(--panel-soft)}.panel{background:var(--panel);border:1px solid var(--border);border-radius:var(--radius);padding:16px}.panel h4{margin-bottom:8px;font-size:13.5px}.row-form{display:flex;gap:12px;align-items:flex-end;flex-wrap:wrap}.row-form .field{flex:1;min-width:150px}.row-form-action{display:flex;align-items:flex-end}.cap-name{min-width:150px;display:inline-block}.inline-field{display:flex;align-items:center;gap:8px;font-size:13px;color:var(--ink-dim)}.inline-field .input{width:auto}textarea.input{resize:vertical;font-family:ui-monospace,SF Mono,Cascadia Code,Menlo,monospace;font-size:12.5px;line-height:1.45}.back-link{align-self:flex-start;padding-left:0;margin-bottom:4px}.finding-list{margin:0;padding-left:18px;font-size:13px;display:flex;flex-direction:column;gap:4px}.kv{display:grid;grid-template-columns:max-content 1fr;gap:6px 16px;margin:6px 0 12px;font-size:13px}.kv dt{color:var(--ink-dim);font-weight:600}.kv dd{margin:0}.token-box{display:block;padding:12px 14px;background:var(--wairon-panel-bg-soft, #0b0b12);border:1px solid var(--border);border-radius:var(--radius-sm);color:var(--accent);word-break:break-all;font-size:12.5px}.toggle-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(240px,1fr));gap:10px}.toggle-row{display:flex;align-items:flex-start;gap:10px;padding:10px 12px;border:1px solid var(--border);border-radius:var(--radius-sm);background:var(--panel);cursor:pointer}.toggle-row input{margin-top:3px}.tabstrip{display:flex;gap:2px;border-bottom:1px solid var(--border)}.tab{font:inherit;cursor:pointer;background:transparent;border:none;border-bottom:2px solid transparent;color:var(--ink-dim);padding:9px 15px;font-weight:600;font-size:13px;margin-bottom:-1px}.tab:hover{color:var(--ink)}.tab-active{color:var(--accent);border-bottom-color:var(--accent)}.tab-panel{padding-top:16px}.tree{border:1px solid var(--border);border-radius:var(--radius);overflow:hidden}.tree-row{display:flex;align-items:center;gap:10px;padding:9px 12px;border-bottom:1px solid var(--border-soft)}.tree-row:last-child{border-bottom:none}.tree-row:hover{background:var(--panel-soft)}.twist{background:transparent;border:none;color:var(--ink-dim);cursor:pointer;width:18px;font-size:12px}.tree-main{flex:1;display:flex;align-items:center;gap:8px;min-width:0;flex-wrap:wrap}.scrim{position:fixed;top:0;right:0;bottom:0;left:0;background:#040408a8;-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px);display:flex;align-items:center;justify-content:center;padding:24px;z-index:100}.modal{width:min(560px,100%);max-height:88vh;background:var(--card);border:1px solid var(--border);border-radius:14px;box-shadow:var(--shadow);display:flex;flex-direction:column;overflow:hidden}.modal-wide{width:min(760px,100%)}.modal-head{display:flex;align-items:center;justify-content:space-between;padding:16px 18px;border-bottom:1px solid var(--border)}.modal-head h3{font-size:15.5px}.modal-body{padding:18px;overflow-y:auto}.modal-foot{display:flex;justify-content:flex-end;gap:8px;padding:14px 18px;border-top:1px solid var(--border)}.empty-state{padding:44px 24px;text-align:center;color:var(--ink-dim);border:1px dashed var(--border);border-radius:var(--radius)}.error-note{display:flex;align-items:center;gap:12px;padding:12px 14px;border:1px solid rgba(244,63,94,.4);background:#f43f5e14;color:var(--bad);border-radius:var(--radius);font-size:13px}.spinner{display:inline-block;width:20px;height:20px;border:2px solid var(--border);border-top-color:var(--accent);border-radius:50%;animation:spin .7s linear infinite}.spinner-inline{width:13px;height:13px;border-width:2px}@keyframes spin{to{transform:rotate(360deg)}}.toast-stack{position:fixed;bottom:20px;right:20px;display:flex;flex-direction:column;gap:8px;z-index:400}.toast{padding:11px 16px;border-radius:var(--radius-sm);font-size:13px;font-weight:600;box-shadow:var(--shadow);border:1px solid var(--border);background:var(--card);max-width:360px}.toast-ok{border-left:3px solid var(--ok)}.toast-bad{border-left:3px solid var(--bad)}.canvas-view{display:flex;flex-direction:column;height:100%}.canvas-bar{display:flex;align-items:center;gap:12px;padding:10px 16px;border-bottom:1px solid var(--border);flex:0 0 auto}.crumb-sep{color:var(--ink-subtle)}.canvas-frame{flex:1;border:none;width:100%;background:var(--bg)}.canvas-host{flex:1;min-height:0;width:100%;display:flex}.net-view{display:flex;flex-direction:column;height:100%;overflow:auto}.net-picture{padding:16px}.net-row{display:flex;flex-wrap:wrap;gap:8px;margin:6px 0}.net-boundary{border:2px dashed var(--border-strong);border-radius:10px;padding:8px 12px 12px;margin:8px 0}.net-boundary>legend{padding:0 6px}.net-chip{display:inline-flex;align-items:center;padding:4px 10px;border:1px solid var(--border);border-radius:6px;font-family:var(--mono, monospace);font-size:12.5px}.net-gateway{border-color:var(--accent);color:var(--accent);font-weight:600}.net-scope{border-radius:999px;border-style:dotted}.env-view{display:flex;flex-direction:column;height:100%}.env-canvas{flex:1;min-height:0;width:100%;background:var(--bg)}.boot,.login-wrap{height:100%;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px}.login-card{width:min(360px,90vw);background:var(--card);border:1px solid var(--border);border-radius:14px;padding:26px;display:flex;flex-direction:column;gap:14px;box-shadow:var(--shadow)}.login-card .brand{font-size:24px;text-align:center;background:var(--brand-gradient);-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent;color:transparent}.stack{display:flex;flex-direction:column;gap:8px}.or{text-align:center;color:var(--ink-dim);font-size:12px}.rt-status{display:inline-flex;align-items:center;gap:6px;font-size:12px;line-height:1;padding:4px 10px;border-radius:999px;border:1px solid transparent;color:var(--ink-dim);white-space:nowrap;-webkit-user-select:none;user-select:none}.rt-status .rt-dot{width:7px;height:7px;border-radius:50%;background:currentColor;flex:0 0 auto}.rt-connected{color:var(--ok)}.rt-connecting{color:var(--warn)}.rt-connecting .rt-dot{animation:rt-pulse 1.2s ease-in-out infinite}.rt-offline{color:var(--bad);border-color:#f43f5e66;background:#f43f5e14}@keyframes rt-pulse{0%,to{opacity:1}50%{opacity:.3}}.spec-layout{display:grid;grid-template-columns:minmax(200px,240px) minmax(0,1.4fr) minmax(340px,1fr);gap:16px;align-items:start}.view-pad.view-pad-wide{max-width:1520px}.spec-picker{border:1px solid var(--border);border-radius:var(--radius);background:var(--panel);overflow:hidden;position:sticky;top:8px}.spec-tree{max-height:calc(100vh - 220px);overflow-y:auto;padding:8px 6px}.tree-row{display:flex;align-items:center;gap:2px}.tree-caret{flex:0 0 auto;width:16px;height:22px;border:none;background:none;color:var(--ink-subtle);cursor:pointer;font-size:10px;line-height:1;padding:0}.tree-caret:hover{color:var(--ink)}.tree-caret-spacer{flex:0 0 auto;width:16px}.tree-label{flex:1 1 auto;display:flex;align-items:center;gap:7px;min-width:0;border:none;background:none;text-align:left;cursor:pointer;padding:4px 6px;border-radius:var(--radius-sm);color:var(--ink-dim);font-size:12.5px}.tree-label:hover{background:var(--hover);color:var(--ink)}.tree-label.sel{background:var(--panel-soft);color:var(--accent);border:1px solid var(--border-strong);padding:3px 5px}.tree-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.tree-kind{flex:0 0 auto;width:16px;height:16px;border-radius:4px;font-size:9.5px;font-weight:700;display:inline-flex;align-items:center;justify-content:center;background:var(--panel-soft);border:1px solid var(--border);color:var(--ink-subtle)}.tree-kind.k-system,.tree-kind.k-subsystem{color:var(--accent);border-color:var(--border-strong)}.tree-kind.k-type{color:var(--accent-purple)}.tree-section{margin-top:8px;padding-top:6px;border-top:1px solid var(--border-soft)}.tree-section-head{display:block;padding:2px 8px 4px;font-size:11px;font-weight:700;color:var(--ink-subtle);text-transform:uppercase;letter-spacing:.04em}.spec-impl-open{border-top:1px solid var(--border-soft);padding:12px;display:flex;flex-direction:column;gap:8px}.spec-detail{min-width:0}.sub-card{border:1px solid var(--border-soft);border-radius:var(--radius-sm);background:var(--panel-soft);padding:12px;display:flex;flex-direction:column;gap:10px}.taginput,.stack-sm{display:flex;flex-direction:column;gap:8px}.list-line{display:flex;align-items:center;gap:6px}.list-line>.input{flex:1 1 auto;min-width:0}.lock-banner{padding:10px 14px;border-radius:var(--radius-sm);border:1px solid rgba(251,191,36,.4);background:#fbbf2414;color:var(--warn);font-size:13px}.spec-validation{border:1px solid var(--border);border-radius:var(--radius);background:var(--panel);padding:12px 14px;position:sticky;top:8px;max-height:calc(100vh - 220px);overflow-y:auto;display:flex;flex-direction:column;gap:10px}.spec-validation-head{display:flex;align-items:center;justify-content:space-between;gap:8px}.spec-validation-scope{display:flex;align-items:center;justify-content:space-between;gap:8px;flex-wrap:wrap}.spec-validation-counts{display:flex;gap:6px;flex-wrap:wrap}.spec-validation .finding-list{padding-left:0;list-style:none;gap:0}.spec-validation .finding{padding:6px 0;border-top:1px solid var(--border-soft);line-height:1.5;word-break:break-word}.spec-validation .finding:first-child{border-top:none}.finding-row{display:flex;align-items:center;gap:6px;margin-bottom:2px}.finding-msg{color:var(--ink)}.finding-msg-clickable{cursor:pointer}.finding-msg-clickable:hover{text-decoration:underline dotted}.finding-chip-row{margin-top:4px}.finding-notice-label{color:var(--ink-dim)}.finding-chip{cursor:pointer;font:inherit;border:1px solid var(--border-strong)}.finding-chip:hover{background:var(--hover)}.finding-chip-unresolved{cursor:default}.field-flag{border-left:3px solid var(--warn);background:var(--panel-soft);padding:8px 10px;border-radius:var(--radius-sm)}.field-flag-error{border-left-color:var(--bad)}.field-flag-notice{border-left-color:var(--border-strong)}.unit-head{display:flex;align-items:center;gap:8px;flex-wrap:wrap}.unit-head .btn{margin-left:auto}.method-head{display:flex;align-items:center;gap:8px}.method-head .btn{margin-left:auto}.tabstrip .tab:disabled{opacity:.45;cursor:default}@media (max-width: 980px){.spec-layout{grid-template-columns:minmax(200px,260px) minmax(0,1fr)}.spec-validation{grid-column:1 / -1;position:static;max-height:none}}@media (max-width: 720px){.view-pad{padding:16px}.hmenu-who,.rt-status .rt-label{display:none}.spec-layout{grid-template-columns:1fr}.spec-picker{position:static}}.tb-view{max-width:1280px;padding-bottom:140px}.tb-layout{display:grid;grid-template-columns:280px minmax(0,1fr);gap:18px;align-items:start}.tb-side,.tb-main{background:var(--panel);border:1px solid var(--border);border-radius:var(--radius);padding:16px}.tb-side{position:sticky;top:0}.tb-side-head{display:flex;flex-direction:column;gap:2px;margin-bottom:12px}.tb-new{width:100%;justify-content:center;border-style:dashed;border-color:var(--border-strong);color:var(--accent);background:var(--panel-soft);margin-bottom:10px}.tb-list{display:flex;flex-direction:column;gap:4px}.tb-empty{padding:10px;border-radius:var(--radius-sm);background:var(--panel-soft)}.tb-empty-main{padding:42px;text-align:center}.tb-head{display:flex;justify-content:space-between;gap:16px;align-items:flex-start;flex-wrap:wrap;margin-bottom:16px}.tb-head-fields{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:12px;flex:1;min-width:260px}.tb-head-actions{display:flex;gap:8px;flex-wrap:wrap}.tb-block{border:1px solid var(--border-soft);border-radius:var(--radius);background:var(--panel-soft);padding:14px;margin-bottom:14px}.tb-block-head{display:flex;justify-content:space-between;align-items:flex-start;gap:12px;flex-wrap:wrap;margin-bottom:10px}.tb-block-head .hint{margin:2px 0 0;max-width:560px}.tb-block-title{font-size:10.5px;text-transform:uppercase;letter-spacing:.06em;color:var(--ink-subtle);font-weight:700;margin-bottom:8px}.tb-seg{flex:0 0 auto}.tb-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:12px}.tb-field{display:flex;flex-direction:column;gap:6px;min-width:0}.tb-field-head{display:flex;align-items:center;justify-content:space-between;gap:8px}.tb-field-label{font-size:11px;font-weight:700;color:var(--ink-dim)}.tb-derived{font-size:10px;color:var(--ink-subtle)}.tb-clear{font:inherit;font-size:10px;font-weight:700;color:var(--accent);background:var(--panel-soft);border:1px solid var(--border);border-radius:999px;padding:1px 7px;cursor:pointer}.tb-clear:hover{border-color:var(--border-strong)}.tb-input{font:inherit;width:100%;padding:7px 9px;border-radius:var(--radius-sm);border:1px solid var(--border);background:var(--chrome-2);color:var(--ink)}.tb-input:focus-visible{outline:none;box-shadow:var(--focus)}.tb-mono{font-family:ui-monospace,SF Mono,Cascadia Code,Menlo,monospace;font-size:12px}.tb-color{display:flex;gap:8px;align-items:flex-start}.tb-color-pick{width:40px;height:34px;padding:0;border:1px solid var(--border);border-radius:var(--radius-sm);background:transparent;cursor:pointer;flex:none}.tb-color-body{display:flex;flex-direction:column;gap:6px;flex:1;min-width:0}.tb-alpha{display:flex;align-items:center;gap:8px}.tb-alpha input[type=range]{flex:1;accent-color:var(--accent)}.tb-alpha .hint{width:38px;text-align:right}.tb-shadow{display:flex;flex-direction:column;gap:6px}.tb-seed{display:flex;align-items:center;gap:12px;flex-wrap:wrap}.tb-seed-pick{width:120px;height:38px;padding:0;border:1px solid var(--border);border-radius:var(--radius-sm);background:transparent;cursor:pointer}.tb-strip{display:grid;grid-template-columns:repeat(auto-fit,minmax(160px,1fr));gap:10px;margin-top:12px}.tb-strip-swatch{min-height:64px;border-radius:var(--radius-sm);border:1px solid var(--border-soft)}.tb-acc-head{margin-top:12px;margin-bottom:0;align-items:center}.tb-sample{min-height:76px;border-radius:var(--radius-sm);border:1px solid var(--border-soft);padding:12px}.tb-sample-label{font-size:10.5px;font-weight:800;text-transform:uppercase;letter-spacing:.05em;opacity:.82}.tb-sample-main{margin-top:8px;font-size:14px;font-weight:700}.tb-sample-sub{margin-top:4px;font-size:12px;opacity:.86}.tb-foot{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-top:4px}.savebar{position:fixed;left:50%;bottom:24px;transform:translate(-50%);z-index:120;display:flex;align-items:center;gap:14px;width:min(92vw,640px);padding:12px 18px;border-radius:12px;background:var(--menu-bg);border:1px solid var(--border);box-shadow:var(--shadow);animation:savebar-in .4s cubic-bezier(.68,-.55,.265,1.55)}.savebar-icon{width:34px;height:34px;border-radius:10px;background:#f59e0b26;color:var(--warn);display:flex;align-items:center;justify-content:center;font-size:17px;flex:none}@keyframes savebar-in{0%{transform:translate(-50%,150px);opacity:0}70%{transform:translate(-50%,-10px);opacity:1}to{transform:translate(-50%);opacity:1}}@media (max-width: 980px){.tb-layout{grid-template-columns:1fr}.tb-side{position:static}}</style>
|
|
767
|
+
</head>
|
|
768
|
+
<body>
|
|
769
|
+
<div id="root"></div>
|
|
770
|
+
</body>
|
|
771
|
+
</html>
|