From ecb3fb7576f4540fb6da86c95f227f2ad11e4d1b Mon Sep 17 00:00:00 2001 From: forhappy Date: Tue, 18 Aug 2026 20:17:36 -0700 Subject: [PATCH] Stabilize code graph interactions --- CHANGELOG.md | 5 +- crates/compass-output/assets/viewer/graph.js | 56 +++++++++---------- .../assets/viewer/manifest.json | 4 +- .../compass-viewer/src/graph/CompassGraph.tsx | 6 ++ .../VisNetworkCanvas.interaction.test.tsx | 29 ++++++++++ .../src/graph/VisNetworkCanvas.tsx | 12 ++++ .../src/graph/networkEvents.test.ts | 3 + .../compass-viewer/src/graph/networkEvents.ts | 3 + tests/viewer/graph-parity.spec.ts | 28 ++++++++++ 9 files changed, 115 insertions(+), 31 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 01f3c81a..6237f0eb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -279,7 +279,10 @@ labels. Add bounded 1–4-hop selection isolation with incoming/outgoing edge filtering, layout spacing, a navigable minimap, and discoverable keyboard shortcuts. Resuming a settled nested community graph now reheats its layout - so pause/resume produces visible physics movement. Consolidate workbench + so pause/resume produces visible physics movement. Freeze the force layout + before the canvas becomes interactive and automatically pause it when a user + hovers a node or starts dragging, keeping click targets stable in both HTML + exports and VS Code. Consolidate workbench filters into the top graph-control rail, allow neighborhood settings to be prepared before selection, keep filters scoped to the visible overview or community detail, fit newly isolated neighborhoods, and scale layout reheating diff --git a/crates/compass-output/assets/viewer/graph.js b/crates/compass-output/assets/viewer/graph.js index 3917e101..01db93ae 100644 --- a/crates/compass-output/assets/viewer/graph.js +++ b/crates/compass-output/assets/viewer/graph.js @@ -1,14 +1,14 @@ -(function(){"use strict";function FO(n,e){for(var t=0;ti[o]})}}}return Object.freeze(Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}))}function VO(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var jl={exports:{}},Tr={};var pp;function UO(){if(pp)return Tr;pp=1;var n=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function t(i,o,r){var A=null;if(r!==void 0&&(A=""+r),o.key!==void 0&&(A=""+o.key),"key"in o){r={};for(var I in o)I!=="key"&&(r[I]=o[I])}else r=o;return o=r.ref,{$$typeof:n,type:i,key:A,ref:o!==void 0?o:null,props:r}}return Tr.Fragment=e,Tr.jsx=t,Tr.jsxs=t,Tr}var mp;function YO(){return mp||(mp=1,jl.exports=UO()),jl.exports}var f=YO(),Zl={exports:{}},Or={},Bl={exports:{}},Pl={};var vp;function HO(){return vp||(vp=1,(function(n){function e(M,U){var K=M.length;M.push(U);e:for(;0>>1,ee=M[re];if(0>>1;reo(te,K))aeo(ue,te)?(M[re]=ue,M[ae]=K,re=ae):(M[re]=te,M[L]=K,re=L);else if(aeo(ue,K))M[re]=ue,M[ae]=K,re=ae;else break e}}return U}function o(M,U){var K=M.sortIndex-U.sortIndex;return K!==0?K:M.id-U.id}if(n.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var r=performance;n.unstable_now=function(){return r.now()}}else{var A=Date,I=A.now();n.unstable_now=function(){return A.now()-I}}var l=[],c=[],h=1,p=null,m=3,y=!1,w=!1,S=!1,x=!1,O=typeof setTimeout=="function"?setTimeout:null,E=typeof clearTimeout=="function"?clearTimeout:null,_=typeof setImmediate<"u"?setImmediate:null;function P(M){for(var U=t(c);U!==null;){if(U.callback===null)i(c);else if(U.startTime<=M)i(c),U.sortIndex=U.expirationTime,e(l,U);else break;U=t(c)}}function Q(M){if(S=!1,P(M),!w)if(t(l)!==null)w=!0,ne||(ne=!0,Ee());else{var U=t(c);U!==null&&Ae(Q,U.startTime-M)}}var ne=!1,j=-1,V=5,de=-1;function le(){return x?!0:!(n.unstable_now()-deM&&le());){var re=p.callback;if(typeof re=="function"){p.callback=null,m=p.priorityLevel;var ee=re(p.expirationTime<=M);if(M=n.unstable_now(),typeof ee=="function"){p.callback=ee,P(M),U=!0;break t}p===t(l)&&i(l),P(M)}else i(l);p=t(l)}if(p!==null)U=!0;else{var T=t(c);T!==null&&Ae(Q,T.startTime-M),U=!1}}break e}finally{p=null,m=K,y=!1}U=void 0}}finally{U?Ee():ne=!1}}}var Ee;if(typeof _=="function")Ee=function(){_(Ze)};else if(typeof MessageChannel<"u"){var Ue=new MessageChannel,We=Ue.port2;Ue.port1.onmessage=Ze,Ee=function(){We.postMessage(null)}}else Ee=function(){O(Ze,0)};function Ae(M,U){j=O(function(){M(n.unstable_now())},U)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(M){M.callback=null},n.unstable_forceFrameRate=function(M){0>M||125re?(M.sortIndex=K,e(c,M),t(l)===null&&M===t(c)&&(S?(E(j),j=-1):S=!0,Ae(Q,K-re))):(M.sortIndex=ee,e(l,M),w||y||(w=!0,ne||(ne=!0,Ee()))),M},n.unstable_shouldYield=le,n.unstable_wrapCallback=function(M){var U=m;return function(){var K=m;m=U;try{return M.apply(this,arguments)}finally{m=K}}}})(Pl)),Pl}var yp;function KO(){return yp||(yp=1,Bl.exports=HO()),Bl.exports}var Ll={exports:{}},je={};var bp;function WO(){if(bp)return je;bp=1;var n=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),t=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),r=Symbol.for("react.consumer"),A=Symbol.for("react.context"),I=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),c=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),p=Symbol.for("react.activity"),m=Symbol.iterator;function y(T){return T===null||typeof T!="object"?null:(T=m&&T[m]||T["@@iterator"],typeof T=="function"?T:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},S=Object.assign,x={};function O(T,L,te){this.props=T,this.context=L,this.refs=x,this.updater=te||w}O.prototype.isReactComponent={},O.prototype.setState=function(T,L){if(typeof T!="object"&&typeof T!="function"&&T!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,T,L,"setState")},O.prototype.forceUpdate=function(T){this.updater.enqueueForceUpdate(this,T,"forceUpdate")};function E(){}E.prototype=O.prototype;function _(T,L,te){this.props=T,this.context=L,this.refs=x,this.updater=te||w}var P=_.prototype=new E;P.constructor=_,S(P,O.prototype),P.isPureReactComponent=!0;var Q=Array.isArray;function ne(){}var j={H:null,A:null,T:null,S:null},V=Object.prototype.hasOwnProperty;function de(T,L,te){var ae=te.ref;return{$$typeof:n,type:T,key:L,ref:ae!==void 0?ae:null,props:te}}function le(T,L){return de(T.type,L,T.props)}function Ze(T){return typeof T=="object"&&T!==null&&T.$$typeof===n}function Ee(T){var L={"=":"=0",":":"=2"};return"$"+T.replace(/[=:]/g,function(te){return L[te]})}var Ue=/\/+/g;function We(T,L){return typeof T=="object"&&T!==null&&T.key!=null?Ee(""+T.key):L.toString(36)}function Ae(T){switch(T.status){case"fulfilled":return T.value;case"rejected":throw T.reason;default:switch(typeof T.status=="string"?T.then(ne,ne):(T.status="pending",T.then(function(L){T.status==="pending"&&(T.status="fulfilled",T.value=L)},function(L){T.status==="pending"&&(T.status="rejected",T.reason=L)})),T.status){case"fulfilled":return T.value;case"rejected":throw T.reason}}throw T}function M(T,L,te,ae,ue){var ye=typeof T;(ye==="undefined"||ye==="boolean")&&(T=null);var Be=!1;if(T===null)Be=!0;else switch(ye){case"bigint":case"string":case"number":Be=!0;break;case"object":switch(T.$$typeof){case n:case e:Be=!0;break;case h:return Be=T._init,M(Be(T._payload),L,te,ae,ue)}}if(Be)return ue=ue(T),Be=ae===""?"."+We(T,0):ae,Q(ue)?(te="",Be!=null&&(te=Be.replace(Ue,"$&/")+"/"),M(ue,L,te,"",function(sn){return sn})):ue!=null&&(Ze(ue)&&(ue=le(ue,te+(ue.key==null||T&&T.key===ue.key?"":(""+ue.key).replace(Ue,"$&/")+"/")+Be)),L.push(ue)),1;Be=0;var ct=ae===""?".":ae+":";if(Q(T))for(var he=0;he"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}return n(),Fl.exports=QO(),Fl.exports}var Ep;function $O(){if(Ep)return Or;Ep=1;var n=KO(),e=Gl(),t=XO();function i(g){var s="https://react.dev/errors/"+g;if(1ee||(g.current=re[ee],re[ee]=null,ee--)}function te(g,s){ee++,re[ee]=g.current,g.current=s}var ae=T(null),ue=T(null),ye=T(null),Be=T(null);function ct(g,s){switch(te(ye,s),te(ue,g),te(ae,null),s.nodeType){case 9:case 11:g=(g=s.documentElement)&&(g=g.namespaceURI)?IO(g):0;break;default:if(g=s.tagName,s=s.namespaceURI)s=IO(s),g=lO(s,g);else switch(g){case"svg":g=1;break;case"math":g=2;break;default:g=0}}L(ae),te(ae,g)}function he(){L(ae),L(ue),L(ye)}function sn(g){g.memoizedState!==null&&te(Be,g);var s=ae.current,a=lO(s,g.type);s!==a&&(te(ue,g),te(ae,a))}function z(g){ue.current===g&&(L(ae),L(ue)),Be.current===g&&(L(Be),OA._currentValue=K)}var me,_e;function ke(g){if(me===void 0)try{throw Error()}catch(a){var s=a.stack.trim().match(/\n( *(at )?)/);me=s&&s[1]||"",_e=-1i[o]})}}}return Object.freeze(Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}))}function VO(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Zl={exports:{}},Or={};var mp;function UO(){if(mp)return Or;mp=1;var n=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function t(i,o,r){var A=null;if(r!==void 0&&(A=""+r),o.key!==void 0&&(A=""+o.key),"key"in o){r={};for(var I in o)I!=="key"&&(r[I]=o[I])}else r=o;return o=r.ref,{$$typeof:n,type:i,key:A,ref:o!==void 0?o:null,props:r}}return Or.Fragment=e,Or.jsx=t,Or.jsxs=t,Or}var vp;function YO(){return vp||(vp=1,Zl.exports=UO()),Zl.exports}var f=YO(),Bl={exports:{}},Nr={},Pl={exports:{}},Ll={};var yp;function HO(){return yp||(yp=1,(function(n){function e(M,W){var V=M.length;M.push(W);e:for(;0>>1,ee=M[se];if(0>>1;seo(te,V))aeo(Ie,te)?(M[se]=Ie,M[ae]=V,se=ae):(M[se]=te,M[U]=V,se=U);else if(aeo(Ie,V))M[se]=Ie,M[ae]=V,se=ae;else break e}}return W}function o(M,W){var V=M.sortIndex-W.sortIndex;return V!==0?V:M.id-W.id}if(n.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var r=performance;n.unstable_now=function(){return r.now()}}else{var A=Date,I=A.now();n.unstable_now=function(){return A.now()-I}}var l=[],c=[],h=1,p=null,m=3,y=!1,w=!1,S=!1,x=!1,O=typeof setTimeout=="function"?setTimeout:null,E=typeof clearTimeout=="function"?clearTimeout:null,_=typeof setImmediate<"u"?setImmediate:null;function P(M){for(var W=t(c);W!==null;){if(W.callback===null)i(c);else if(W.startTime<=M)i(c),W.sortIndex=W.expirationTime,e(l,W);else break;W=t(c)}}function Q(M){if(S=!1,P(M),!w)if(t(l)!==null)w=!0,ne||(ne=!0,Ne());else{var W=t(c);W!==null&&Ae(Q,W.startTime-M)}}var ne=!1,F=-1,Z=5,de=-1;function fe(){return x?!0:!(n.unstable_now()-deM&&fe());){var se=p.callback;if(typeof se=="function"){p.callback=null,m=p.priorityLevel;var ee=se(p.expirationTime<=M);if(M=n.unstable_now(),typeof ee=="function"){p.callback=ee,P(M),W=!0;break t}p===t(l)&&i(l),P(M)}else i(l);p=t(l)}if(p!==null)W=!0;else{var T=t(c);T!==null&&Ae(Q,T.startTime-M),W=!1}}break e}finally{p=null,m=V,y=!1}W=void 0}}finally{W?Ne():ne=!1}}}var Ne;if(typeof _=="function")Ne=function(){_(ke)};else if(typeof MessageChannel<"u"){var je=new MessageChannel,qe=je.port2;je.port1.onmessage=ke,Ne=function(){qe.postMessage(null)}}else Ne=function(){O(ke,0)};function Ae(M,W){F=O(function(){M(n.unstable_now())},W)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(M){M.callback=null},n.unstable_forceFrameRate=function(M){0>M||125se?(M.sortIndex=V,e(c,M),t(l)===null&&M===t(c)&&(S?(E(F),F=-1):S=!0,Ae(Q,V-se))):(M.sortIndex=ee,e(l,M),w||y||(w=!0,ne||(ne=!0,Ne()))),M},n.unstable_shouldYield=fe,n.unstable_wrapCallback=function(M){var W=m;return function(){var V=m;m=W;try{return M.apply(this,arguments)}finally{m=V}}}})(Ll)),Ll}var bp;function KO(){return bp||(bp=1,Pl.exports=HO()),Pl.exports}var Gl={exports:{}},Be={};var wp;function WO(){if(wp)return Be;wp=1;var n=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),t=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),r=Symbol.for("react.consumer"),A=Symbol.for("react.context"),I=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),c=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),p=Symbol.for("react.activity"),m=Symbol.iterator;function y(T){return T===null||typeof T!="object"?null:(T=m&&T[m]||T["@@iterator"],typeof T=="function"?T:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},S=Object.assign,x={};function O(T,U,te){this.props=T,this.context=U,this.refs=x,this.updater=te||w}O.prototype.isReactComponent={},O.prototype.setState=function(T,U){if(typeof T!="object"&&typeof T!="function"&&T!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,T,U,"setState")},O.prototype.forceUpdate=function(T){this.updater.enqueueForceUpdate(this,T,"forceUpdate")};function E(){}E.prototype=O.prototype;function _(T,U,te){this.props=T,this.context=U,this.refs=x,this.updater=te||w}var P=_.prototype=new E;P.constructor=_,S(P,O.prototype),P.isPureReactComponent=!0;var Q=Array.isArray;function ne(){}var F={H:null,A:null,T:null,S:null},Z=Object.prototype.hasOwnProperty;function de(T,U,te){var ae=te.ref;return{$$typeof:n,type:T,key:U,ref:ae!==void 0?ae:null,props:te}}function fe(T,U){return de(T.type,U,T.props)}function ke(T){return typeof T=="object"&&T!==null&&T.$$typeof===n}function Ne(T){var U={"=":"=0",":":"=2"};return"$"+T.replace(/[=:]/g,function(te){return U[te]})}var je=/\/+/g;function qe(T,U){return typeof T=="object"&&T!==null&&T.key!=null?Ne(""+T.key):U.toString(36)}function Ae(T){switch(T.status){case"fulfilled":return T.value;case"rejected":throw T.reason;default:switch(typeof T.status=="string"?T.then(ne,ne):(T.status="pending",T.then(function(U){T.status==="pending"&&(T.status="fulfilled",T.value=U)},function(U){T.status==="pending"&&(T.status="rejected",T.reason=U)})),T.status){case"fulfilled":return T.value;case"rejected":throw T.reason}}throw T}function M(T,U,te,ae,Ie){var me=typeof T;(me==="undefined"||me==="boolean")&&(T=null);var Pe=!1;if(T===null)Pe=!0;else switch(me){case"bigint":case"string":case"number":Pe=!0;break;case"object":switch(T.$$typeof){case n:case e:Pe=!0;break;case h:return Pe=T._init,M(Pe(T._payload),U,te,ae,Ie)}}if(Pe)return Ie=Ie(T),Pe=ae===""?"."+qe(T,0):ae,Q(Ie)?(te="",Pe!=null&&(te=Pe.replace(je,"$&/")+"/"),M(Ie,U,te,"",function(tt){return tt})):Ie!=null&&(ke(Ie)&&(Ie=fe(Ie,te+(Ie.key==null||T&&T.key===Ie.key?"":(""+Ie.key).replace(je,"$&/")+"/")+Pe)),U.push(Ie)),1;Pe=0;var wt=ae===""?".":ae+":";if(Q(T))for(var ze=0;ze"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}return n(),Vl.exports=QO(),Vl.exports}var Tp;function $O(){if(Tp)return Nr;Tp=1;var n=KO(),e=Fl(),t=XO();function i(g){var s="https://react.dev/errors/"+g;if(1ee||(g.current=se[ee],se[ee]=null,ee--)}function te(g,s){ee++,se[ee]=g.current,g.current=s}var ae=T(null),Ie=T(null),me=T(null),Pe=T(null);function wt(g,s){switch(te(me,s),te(Ie,g),te(ae,null),s.nodeType){case 9:case 11:g=(g=s.documentElement)&&(g=g.namespaceURI)?IO(g):0;break;default:if(g=s.tagName,s=s.namespaceURI)s=IO(s),g=lO(s,g);else switch(g){case"svg":g=1;break;case"math":g=2;break;default:g=0}}U(ae),te(ae,g)}function ze(){U(ae),U(Ie),U(me)}function tt(g){g.memoizedState!==null&&te(Pe,g);var s=ae.current,a=lO(s,g.type);s!==a&&(te(Ie,g),te(ae,a))}function z(g){Ie.current===g&&(U(ae),U(Ie)),Pe.current===g&&(U(Pe),DA._currentValue=V)}var ve,Re;function Ze(g){if(ve===void 0)try{throw Error()}catch(a){var s=a.stack.trim().match(/\n( *(at )?)/);ve=s&&s[1]||"",Re=-1)":-1d||N[C]!==B[d]){var X=` -`+N[C].replace(" at new "," at ");return g.displayName&&X.includes("")&&(X=X.replace("",g.displayName)),X}while(1<=C&&0<=d);break}}}finally{Nt=!1,Error.prepareStackTrace=a}return(a=g?g.displayName||g.name:"")?ke(a):""}function ie(g,s){switch(g.tag){case 26:case 27:case 5:return ke(g.type);case 16:return ke("Lazy");case 13:return g.child!==s&&s!==null?ke("Suspense Fallback"):ke("Suspense");case 19:return ke("SuspenseList");case 0:case 15:return Dt(g.type,!1);case 11:return Dt(g.type.render,!1);case 1:return Dt(g.type,!0);case 31:return ke("Activity");default:return""}}function Te(g){try{var s="",a=null;do s+=ie(g,a),a=g,g=g.return;while(g);return s}catch(C){return` +`+N[C].replace(" at new "," at ");return g.displayName&&X.includes("")&&(X=X.replace("",g.displayName)),X}while(1<=C&&0<=d);break}}}finally{Dt=!1,Error.prepareStackTrace=a}return(a=g?g.displayName||g.name:"")?Ze(a):""}function dn(g,s){switch(g.tag){case 26:case 27:case 5:return Ze(g.type);case 16:return Ze("Lazy");case 13:return g.child!==s&&s!==null?Ze("Suspense Fallback"):Ze("Suspense");case 19:return Ze("SuspenseList");case 0:case 15:return Ut(g.type,!1);case 11:return Ut(g.type.render,!1);case 1:return Ut(g.type,!0);case 31:return Ze("Activity");default:return""}}function ie(g){try{var s="",a=null;do s+=dn(g,a),a=g,g=g.return;while(g);return s}catch(C){return` Error generating stack: `+C.message+` -`+C.stack}}var R=Object.prototype.hasOwnProperty,Ce=n.unstable_scheduleCallback,Qe=n.unstable_cancelCallback,xt=n.unstable_shouldYield,bt=n.unstable_requestPaint,Bt=n.unstable_now,pI=n.unstable_getCurrentPriorityLevel,V2=n.unstable_ImmediatePriority,U2=n.unstable_UserBlockingPriority,mI=n.unstable_NormalPriority,lte=n.unstable_LowPriority,Y2=n.unstable_IdlePriority,cte=n.log,dte=n.unstable_setDisableYieldValue,La=null,Vn=null;function Fg(g){if(typeof cte=="function"&&dte(g),Vn&&typeof Vn.setStrictMode=="function")try{Vn.setStrictMode(La,g)}catch{}}var Un=Math.clz32?Math.clz32:fte,ute=Math.log,hte=Math.LN2;function fte(g){return g>>>=0,g===0?32:31-(ute(g)/hte|0)|0}var vI=256,yI=262144,bI=4194304;function Bo(g){var s=g&42;if(s!==0)return s;switch(g&-g){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return g&261888;case 262144:case 524288:case 1048576:case 2097152:return g&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return g&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return g}}function wI(g,s,a){var C=g.pendingLanes;if(C===0)return 0;var d=0,u=g.suspendedLanes,v=g.pingedLanes;g=g.warmLanes;var b=C&134217727;return b!==0?(C=b&~u,C!==0?d=Bo(C):(v&=b,v!==0?d=Bo(v):a||(a=b&~g,a!==0&&(d=Bo(a))))):(b=C&~u,b!==0?d=Bo(b):v!==0?d=Bo(v):a||(a=C&~g,a!==0&&(d=Bo(a)))),d===0?0:s!==0&&s!==d&&(s&u)===0&&(u=d&-d,a=s&-s,u>=a||u===32&&(a&4194048)!==0)?s:d}function Ga(g,s){return(g.pendingLanes&~(g.suspendedLanes&~g.pingedLanes)&s)===0}function pte(g,s){switch(g){case 1:case 2:case 4:case 8:case 64:return s+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return s+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function H2(){var g=bI;return bI<<=1,(bI&62914560)===0&&(bI=4194304),g}function oh(g){for(var s=[],a=0;31>a;a++)s.push(g);return s}function Fa(g,s){g.pendingLanes|=s,s!==268435456&&(g.suspendedLanes=0,g.pingedLanes=0,g.warmLanes=0)}function mte(g,s,a,C,d,u){var v=g.pendingLanes;g.pendingLanes=a,g.suspendedLanes=0,g.pingedLanes=0,g.warmLanes=0,g.expiredLanes&=a,g.entangledLanes&=a,g.errorRecoveryDisabledLanes&=a,g.shellSuspendCounter=0;var b=g.entanglements,N=g.expirationTimes,B=g.hiddenUpdates;for(a=v&~a;0"u")return null;try{return g.activeElement||g.body}catch{return g.body}}var Ste=/[\n"\\]/g;function si(g){return g.replace(Ste,function(s){return"\\"+s.charCodeAt(0).toString(16)+" "})}function Ih(g,s,a,C,d,u,v,b){g.name="",v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"?g.type=v:g.removeAttribute("type"),s!=null?v==="number"?(s===0&&g.value===""||g.value!=s)&&(g.value=""+oi(s)):g.value!==""+oi(s)&&(g.value=""+oi(s)):v!=="submit"&&v!=="reset"||g.removeAttribute("value"),s!=null?lh(g,v,oi(s)):a!=null?lh(g,v,oi(a)):C!=null&&g.removeAttribute("value"),d==null&&u!=null&&(g.defaultChecked=!!u),d!=null&&(g.checked=d&&typeof d!="function"&&typeof d!="symbol"),b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"?g.name=""+oi(b):g.removeAttribute("name")}function oS(g,s,a,C,d,u,v,b){if(u!=null&&typeof u!="function"&&typeof u!="symbol"&&typeof u!="boolean"&&(g.type=u),s!=null||a!=null){if(!(u!=="submit"&&u!=="reset"||s!=null)){Ch(g);return}a=a!=null?""+oi(a):"",s=s!=null?""+oi(s):a,b||s===g.value||(g.value=s),g.defaultValue=s}C=C??d,C=typeof C!="function"&&typeof C!="symbol"&&!!C,g.checked=b?g.checked:!!C,g.defaultChecked=!!C,v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"&&(g.name=v),Ch(g)}function lh(g,s,a){s==="number"&&EI(g.ownerDocument)===g||g.defaultValue===""+a||(g.defaultValue=""+a)}function Ws(g,s,a,C){if(g=g.options,s){s={};for(var d=0;d"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),fh=!1;if(gg)try{var Ha={};Object.defineProperty(Ha,"passive",{get:function(){fh=!0}}),window.addEventListener("test",Ha,Ha),window.removeEventListener("test",Ha,Ha)}catch{fh=!1}var Ug=null,ph=null,OI=null;function lS(){if(OI)return OI;var g,s=ph,a=s.length,C,d="value"in Ug?Ug.value:Ug.textContent,u=d.length;for(g=0;g=Qa),pS=" ",mS=!1;function vS(g,s){switch(g){case"keyup":return Jte.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function yS(g){return g=g.detail,typeof g=="object"&&"data"in g?g.data:null}var qs=!1;function tne(g,s){switch(g){case"compositionend":return yS(s);case"keypress":return s.which!==32?null:(mS=!0,pS);case"textInput":return g=s.data,g===pS&&mS?null:g;default:return null}}function nne(g,s){if(qs)return g==="compositionend"||!wh&&vS(g,s)?(g=lS(),OI=ph=Ug=null,qs=!1,g):null;switch(g){case"paste":return null;case"keypress":if(!(s.ctrlKey||s.altKey||s.metaKey)||s.ctrlKey&&s.altKey){if(s.char&&1=s)return{node:a,offset:s-g};g=C}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=NS(a)}}function MS(g,s){return g&&s?g===s?!0:g&&g.nodeType===3?!1:s&&s.nodeType===3?MS(g,s.parentNode):"contains"in g?g.contains(s):g.compareDocumentPosition?!!(g.compareDocumentPosition(s)&16):!1:!1}function zS(g){g=g!=null&&g.ownerDocument!=null&&g.ownerDocument.defaultView!=null?g.ownerDocument.defaultView:window;for(var s=EI(g.document);s instanceof g.HTMLIFrameElement;){try{var a=typeof s.contentWindow.location.href=="string"}catch{a=!1}if(a)g=s.contentWindow;else break;s=EI(g.document)}return s}function Eh(g){var s=g&&g.nodeName&&g.nodeName.toLowerCase();return s&&(s==="input"&&(g.type==="text"||g.type==="search"||g.type==="tel"||g.type==="url"||g.type==="password")||s==="textarea"||g.contentEditable==="true")}var Cne=gg&&"documentMode"in document&&11>=document.documentMode,Js=null,Th=null,Ja=null,Oh=!1;function kS(g,s,a){var C=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;Oh||Js==null||Js!==EI(C)||(C=Js,"selectionStart"in C&&Eh(C)?C={start:C.selectionStart,end:C.selectionEnd}:(C=(C.ownerDocument&&C.ownerDocument.defaultView||window).getSelection(),C={anchorNode:C.anchorNode,anchorOffset:C.anchorOffset,focusNode:C.focusNode,focusOffset:C.focusOffset}),Ja&&qa(Ja,C)||(Ja=C,C=yl(Th,"onSelect"),0>=v,d-=v,Pi=1<<32-Un(s)+d|a<Le?($e=be,be=null):$e=be.sibling;var nt=G(k,be,Z[Le],q);if(nt===null){be===null&&(be=$e);break}g&&be&&nt.alternate===null&&s(k,be),D=u(nt,D,Le),tt===null?Oe=nt:tt.sibling=nt,tt=nt,be=$e}if(Le===Z.length)return a(k,be),qe&&sg(k,Le),Oe;if(be===null){for(;LeLe?($e=be,be=null):$e=be.sibling;var lo=G(k,be,nt.value,q);if(lo===null){be===null&&(be=$e);break}g&&be&&lo.alternate===null&&s(k,be),D=u(lo,D,Le),tt===null?Oe=lo:tt.sibling=lo,tt=lo,be=$e}if(nt.done)return a(k,be),qe&&sg(k,Le),Oe;if(be===null){for(;!nt.done;Le++,nt=Z.next())nt=J(k,nt.value,q),nt!==null&&(D=u(nt,D,Le),tt===null?Oe=nt:tt.sibling=nt,tt=nt);return qe&&sg(k,Le),Oe}for(be=C(be);!nt.done;Le++,nt=Z.next())nt=Y(be,k,Le,nt.value,q),nt!==null&&(g&&nt.alternate!==null&&be.delete(nt.key===null?Le:nt.key),D=u(nt,D,Le),tt===null?Oe=nt:tt.sibling=nt,tt=nt);return g&&be.forEach(function(Die){return s(k,Die)}),qe&&sg(k,Le),Oe}function ht(k,D,Z,q){if(typeof Z=="object"&&Z!==null&&Z.type===S&&Z.key===null&&(Z=Z.props.children),typeof Z=="object"&&Z!==null){switch(Z.$$typeof){case y:e:{for(var Oe=Z.key;D!==null;){if(D.key===Oe){if(Oe=Z.type,Oe===S){if(D.tag===7){a(k,D.sibling),q=d(D,Z.props.children),q.return=k,k=q;break e}}else if(D.elementType===Oe||typeof Oe=="object"&&Oe!==null&&Oe.$$typeof===V&&Qo(Oe)===D.type){a(k,D.sibling),q=d(D,Z.props),oA(q,Z),q.return=k,k=q;break e}a(k,D);break}else s(k,D);D=D.sibling}Z.type===S?(q=Uo(Z.props.children,k.mode,q,Z.key),q.return=k,k=q):(q=BI(Z.type,Z.key,Z.props,null,k.mode,q),oA(q,Z),q.return=k,k=q)}return v(k);case w:e:{for(Oe=Z.key;D!==null;){if(D.key===Oe)if(D.tag===4&&D.stateNode.containerInfo===Z.containerInfo&&D.stateNode.implementation===Z.implementation){a(k,D.sibling),q=d(D,Z.children||[]),q.return=k,k=q;break e}else{a(k,D);break}else s(k,D);D=D.sibling}q=_h(Z,k.mode,q),q.return=k,k=q}return v(k);case V:return Z=Qo(Z),ht(k,D,Z,q)}if(Ae(Z))return fe(k,D,Z,q);if(Ee(Z)){if(Oe=Ee(Z),typeof Oe!="function")throw Error(i(150));return Z=Oe.call(Z),Me(k,D,Z,q)}if(typeof Z.then=="function")return ht(k,D,YI(Z),q);if(Z.$$typeof===_)return ht(k,D,GI(k,Z),q);HI(k,Z)}return typeof Z=="string"&&Z!==""||typeof Z=="number"||typeof Z=="bigint"?(Z=""+Z,D!==null&&D.tag===6?(a(k,D.sibling),q=d(D,Z),q.return=k,k=q):(a(k,D),q=Rh(Z,k.mode,q),q.return=k,k=q),v(k)):a(k,D)}return function(k,D,Z,q){try{gA=0;var Oe=ht(k,D,Z,q);return Cr=null,Oe}catch(be){if(be===Ar||be===VI)throw be;var tt=Hn(29,be,null,k.mode);return tt.lanes=q,tt.return=k,tt}}}var $o=nE(!0),iE=nE(!1),Qg=!1;function Kh(g){g.updateQueue={baseState:g.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Wh(g,s){g=g.updateQueue,s.updateQueue===g&&(s.updateQueue={baseState:g.baseState,firstBaseUpdate:g.firstBaseUpdate,lastBaseUpdate:g.lastBaseUpdate,shared:g.shared,callbacks:null})}function Xg(g){return{lane:g,tag:0,payload:null,callback:null,next:null}}function $g(g,s,a){var C=g.updateQueue;if(C===null)return null;if(C=C.shared,(ot&2)!==0){var d=C.pending;return d===null?s.next=s:(s.next=d.next,d.next=s),C.pending=s,s=ZI(g),LS(g,null,a),s}return jI(g,C,s,a),ZI(g)}function sA(g,s,a){if(s=s.updateQueue,s!==null&&(s=s.shared,(a&4194048)!==0)){var C=s.lanes;C&=g.pendingLanes,a|=C,s.lanes=a,W2(g,a)}}function Qh(g,s){var a=g.updateQueue,C=g.alternate;if(C!==null&&(C=C.updateQueue,a===C)){var d=null,u=null;if(a=a.firstBaseUpdate,a!==null){do{var v={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};u===null?d=u=v:u=u.next=v,a=a.next}while(a!==null);u===null?d=u=s:u=u.next=s}else d=u=s;a={baseState:C.baseState,firstBaseUpdate:d,lastBaseUpdate:u,shared:C.shared,callbacks:C.callbacks},g.updateQueue=a;return}g=a.lastBaseUpdate,g===null?a.firstBaseUpdate=s:g.next=s,a.lastBaseUpdate=s}var Xh=!1;function rA(){if(Xh){var g=ar;if(g!==null)throw g}}function aA(g,s,a,C){Xh=!1;var d=g.updateQueue;Qg=!1;var u=d.firstBaseUpdate,v=d.lastBaseUpdate,b=d.shared.pending;if(b!==null){d.shared.pending=null;var N=b,B=N.next;N.next=null,v===null?u=B:v.next=B,v=N;var X=g.alternate;X!==null&&(X=X.updateQueue,b=X.lastBaseUpdate,b!==v&&(b===null?X.firstBaseUpdate=B:b.next=B,X.lastBaseUpdate=N))}if(u!==null){var J=d.baseState;v=0,X=B=N=null,b=u;do{var G=b.lane&-536870913,Y=G!==b.lane;if(Y?(Xe&G)===G:(C&G)===G){G!==0&&G===rr&&(Xh=!0),X!==null&&(X=X.next={lane:0,tag:b.tag,payload:b.payload,callback:null,next:null});e:{var fe=g,Me=b;G=s;var ht=a;switch(Me.tag){case 1:if(fe=Me.payload,typeof fe=="function"){J=fe.call(ht,J,G);break e}J=fe;break e;case 3:fe.flags=fe.flags&-65537|128;case 0:if(fe=Me.payload,G=typeof fe=="function"?fe.call(ht,J,G):fe,G==null)break e;J=p({},J,G);break e;case 2:Qg=!0}}G=b.callback,G!==null&&(g.flags|=64,Y&&(g.flags|=8192),Y=d.callbacks,Y===null?d.callbacks=[G]:Y.push(G))}else Y={lane:G,tag:b.tag,payload:b.payload,callback:b.callback,next:null},X===null?(B=X=Y,N=J):X=X.next=Y,v|=G;if(b=b.next,b===null){if(b=d.shared.pending,b===null)break;Y=b,b=Y.next,Y.next=null,d.lastBaseUpdate=Y,d.shared.pending=null}}while(!0);X===null&&(N=J),d.baseState=N,d.firstBaseUpdate=B,d.lastBaseUpdate=X,u===null&&(d.shared.lanes=0),no|=v,g.lanes=v,g.memoizedState=J}}function gE(g,s){if(typeof g!="function")throw Error(i(191,g));g.call(s)}function oE(g,s){var a=g.callbacks;if(a!==null)for(g.callbacks=null,g=0;gu?u:8;var v=M.T,b={};M.T=b,hf(g,!1,s,a);try{var N=d(),B=M.S;if(B!==null&&B(b,N),N!==null&&typeof N=="object"&&typeof N.then=="function"){var X=mne(N,C);IA(g,s,X,$n(g))}else IA(g,s,C,$n(g))}catch(J){IA(g,s,{then:function(){},status:"rejected",reason:J},$n())}finally{U.p=u,v!==null&&b.types!==null&&(v.types=b.types),M.T=v}}function Sne(){}function df(g,s,a,C){if(g.tag!==5)throw Error(i(476));var d=ZE(g).queue;jE(g,d,s,K,a===null?Sne:function(){return BE(g),a(C)})}function ZE(g){var s=g.memoizedState;if(s!==null)return s;s={memoizedState:K,baseState:K,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Cg,lastRenderedState:K},next:null};var a={};return s.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Cg,lastRenderedState:a},next:null},g.memoizedState=s,g=g.alternate,g!==null&&(g.memoizedState=s),s}function BE(g){var s=ZE(g);s.next===null&&(s=g.alternate.memoizedState),IA(g,s.next.queue,{},$n())}function uf(){return fn(OA)}function PE(){return Ht().memoizedState}function LE(){return Ht().memoizedState}function Ene(g){for(var s=g.return;s!==null;){switch(s.tag){case 24:case 3:var a=$n();g=Xg(a);var C=$g(s,g,a);C!==null&&(Pn(C,s,a),sA(C,s,a)),s={cache:Vh()},g.payload=s;return}s=s.return}}function Tne(g,s,a){var C=$n();a={lane:C,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},nl(g)?FE(s,a):(a=zh(g,s,a,C),a!==null&&(Pn(a,g,C),VE(a,s,C)))}function GE(g,s,a){var C=$n();IA(g,s,a,C)}function IA(g,s,a,C){var d={lane:C,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(nl(g))FE(s,d);else{var u=g.alternate;if(g.lanes===0&&(u===null||u.lanes===0)&&(u=s.lastRenderedReducer,u!==null))try{var v=s.lastRenderedState,b=u(v,a);if(d.hasEagerState=!0,d.eagerState=b,Yn(b,v))return jI(g,s,d,0),ft===null&&_I(),!1}catch{}if(a=zh(g,s,d,C),a!==null)return Pn(a,g,C),VE(a,s,C),!0}return!1}function hf(g,s,a,C){if(C={lane:2,revertLane:Wf(),gesture:null,action:C,hasEagerState:!1,eagerState:null,next:null},nl(g)){if(s)throw Error(i(479))}else s=zh(g,a,C,2),s!==null&&Pn(s,g,2)}function nl(g){var s=g.alternate;return g===Pe||s!==null&&s===Pe}function FE(g,s){lr=QI=!0;var a=g.pending;a===null?s.next=s:(s.next=a.next,a.next=s),g.pending=s}function VE(g,s,a){if((a&4194048)!==0){var C=s.lanes;C&=g.pendingLanes,a|=C,s.lanes=a,W2(g,a)}}var lA={readContext:fn,use:qI,useCallback:Pt,useContext:Pt,useEffect:Pt,useImperativeHandle:Pt,useLayoutEffect:Pt,useInsertionEffect:Pt,useMemo:Pt,useReducer:Pt,useRef:Pt,useState:Pt,useDebugValue:Pt,useDeferredValue:Pt,useTransition:Pt,useSyncExternalStore:Pt,useId:Pt,useHostTransitionStatus:Pt,useFormState:Pt,useActionState:Pt,useOptimistic:Pt,useMemoCache:Pt,useCacheRefresh:Pt};lA.useEffectEvent=Pt;var UE={readContext:fn,use:qI,useCallback:function(g,s){return On().memoizedState=[g,s===void 0?null:s],g},useContext:fn,useEffect:TE,useImperativeHandle:function(g,s,a){a=a!=null?a.concat([g]):null,el(4194308,4,ME.bind(null,s,g),a)},useLayoutEffect:function(g,s){return el(4194308,4,g,s)},useInsertionEffect:function(g,s){el(4,2,g,s)},useMemo:function(g,s){var a=On();s=s===void 0?null:s;var C=g();if(qo){Fg(!0);try{g()}finally{Fg(!1)}}return a.memoizedState=[C,s],C},useReducer:function(g,s,a){var C=On();if(a!==void 0){var d=a(s);if(qo){Fg(!0);try{a(s)}finally{Fg(!1)}}}else d=s;return C.memoizedState=C.baseState=d,g={pending:null,lanes:0,dispatch:null,lastRenderedReducer:g,lastRenderedState:d},C.queue=g,g=g.dispatch=Tne.bind(null,Pe,g),[C.memoizedState,g]},useRef:function(g){var s=On();return g={current:g},s.memoizedState=g},useState:function(g){g=Af(g);var s=g.queue,a=GE.bind(null,Pe,s);return s.dispatch=a,[g.memoizedState,a]},useDebugValue:lf,useDeferredValue:function(g,s){var a=On();return cf(a,g,s)},useTransition:function(){var g=Af(!1);return g=jE.bind(null,Pe,g.queue,!0,!1),On().memoizedState=g,[!1,g]},useSyncExternalStore:function(g,s,a){var C=Pe,d=On();if(qe){if(a===void 0)throw Error(i(407));a=a()}else{if(a=s(),ft===null)throw Error(i(349));(Xe&127)!==0||IE(C,s,a)}d.memoizedState=a;var u={value:a,getSnapshot:s};return d.queue=u,TE(cE.bind(null,C,u,g),[g]),C.flags|=2048,dr(9,{destroy:void 0},lE.bind(null,C,u,a,s),null),a},useId:function(){var g=On(),s=ft.identifierPrefix;if(qe){var a=Li,C=Pi;a=(C&~(1<<32-Un(C)-1)).toString(32)+a,s="_"+s+"R_"+a,a=XI++,0<\/script>",u=u.removeChild(u.firstChild);break;case"select":u=typeof C.is=="string"?v.createElement("select",{is:C.is}):v.createElement("select"),C.multiple?u.multiple=!0:C.size&&(u.size=C.size);break;default:u=typeof C.is=="string"?v.createElement(d,{is:C.is}):v.createElement(d)}}u[un]=s,u[kn]=C;e:for(v=s.child;v!==null;){if(v.tag===5||v.tag===6)u.appendChild(v.stateNode);else if(v.tag!==4&&v.tag!==27&&v.child!==null){v.child.return=v,v=v.child;continue}if(v===s)break e;for(;v.sibling===null;){if(v.return===null||v.return===s)break e;v=v.return}v.sibling.return=v.return,v=v.sibling}s.stateNode=u;e:switch(mn(u,d,C),d){case"button":case"input":case"select":case"textarea":C=!!C.autoFocus;break e;case"img":C=!0;break e;default:C=!1}C&&lg(s)}}return Et(s),Df(s,s.type,g===null?null:g.memoizedProps,s.pendingProps,a),null;case 6:if(g&&s.stateNode!=null)g.memoizedProps!==C&&lg(s);else{if(typeof C!="string"&&s.stateNode===null)throw Error(i(166));if(g=ye.current,or(s)){if(g=s.stateNode,a=s.memoizedProps,C=null,d=hn,d!==null)switch(d.tag){case 27:case 5:C=d.memoizedProps}g[un]=s,g=!!(g.nodeValue===a||C!==null&&C.suppressHydrationWarning===!0||AO(g.nodeValue,a)),g||Kg(s,!0)}else g=bl(g).createTextNode(C),g[un]=s,s.stateNode=g}return Et(s),null;case 31:if(a=s.memoizedState,g===null||g.memoizedState!==null){if(C=or(s),a!==null){if(g===null){if(!C)throw Error(i(318));if(g=s.memoizedState,g=g!==null?g.dehydrated:null,!g)throw Error(i(557));g[un]=s}else Yo(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;Et(s),g=!1}else a=Ph(),g!==null&&g.memoizedState!==null&&(g.memoizedState.hydrationErrors=a),g=!0;if(!g)return s.flags&256?(Wn(s),s):(Wn(s),null);if((s.flags&128)!==0)throw Error(i(558))}return Et(s),null;case 13:if(C=s.memoizedState,g===null||g.memoizedState!==null&&g.memoizedState.dehydrated!==null){if(d=or(s),C!==null&&C.dehydrated!==null){if(g===null){if(!d)throw Error(i(318));if(d=s.memoizedState,d=d!==null?d.dehydrated:null,!d)throw Error(i(317));d[un]=s}else Yo(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;Et(s),d=!1}else d=Ph(),g!==null&&g.memoizedState!==null&&(g.memoizedState.hydrationErrors=d),d=!0;if(!d)return s.flags&256?(Wn(s),s):(Wn(s),null)}return Wn(s),(s.flags&128)!==0?(s.lanes=a,s):(a=C!==null,g=g!==null&&g.memoizedState!==null,a&&(C=s.child,d=null,C.alternate!==null&&C.alternate.memoizedState!==null&&C.alternate.memoizedState.cachePool!==null&&(d=C.alternate.memoizedState.cachePool.pool),u=null,C.memoizedState!==null&&C.memoizedState.cachePool!==null&&(u=C.memoizedState.cachePool.pool),u!==d&&(C.flags|=2048)),a!==g&&a&&(s.child.flags|=8192),rl(s,s.updateQueue),Et(s),null);case 4:return he(),g===null&&qf(s.stateNode.containerInfo),Et(s),null;case 10:return ag(s.type),Et(s),null;case 19:if(L(Yt),C=s.memoizedState,C===null)return Et(s),null;if(d=(s.flags&128)!==0,u=C.rendering,u===null)if(d)dA(C,!1);else{if(Lt!==0||g!==null&&(g.flags&128)!==0)for(g=s.child;g!==null;){if(u=WI(g),u!==null){for(s.flags|=128,dA(C,!1),g=u.updateQueue,s.updateQueue=g,rl(s,g),s.subtreeFlags=0,g=a,a=s.child;a!==null;)GS(a,g),a=a.sibling;return te(Yt,Yt.current&1|2),qe&&sg(s,C.treeForkCount),s.child}g=g.sibling}C.tail!==null&&Bt()>ll&&(s.flags|=128,d=!0,dA(C,!1),s.lanes=4194304)}else{if(!d)if(g=WI(u),g!==null){if(s.flags|=128,d=!0,g=g.updateQueue,s.updateQueue=g,rl(s,g),dA(C,!0),C.tail===null&&C.tailMode==="hidden"&&!u.alternate&&!qe)return Et(s),null}else 2*Bt()-C.renderingStartTime>ll&&a!==536870912&&(s.flags|=128,d=!0,dA(C,!1),s.lanes=4194304);C.isBackwards?(u.sibling=s.child,s.child=u):(g=C.last,g!==null?g.sibling=u:s.child=u,C.last=u)}return C.tail!==null?(g=C.tail,C.rendering=g,C.tail=g.sibling,C.renderingStartTime=Bt(),g.sibling=null,a=Yt.current,te(Yt,d?a&1|2:a&1),qe&&sg(s,C.treeForkCount),g):(Et(s),null);case 22:case 23:return Wn(s),qh(),C=s.memoizedState!==null,g!==null?g.memoizedState!==null!==C&&(s.flags|=8192):C&&(s.flags|=8192),C?(a&536870912)!==0&&(s.flags&128)===0&&(Et(s),s.subtreeFlags&6&&(s.flags|=8192)):Et(s),a=s.updateQueue,a!==null&&rl(s,a.retryQueue),a=null,g!==null&&g.memoizedState!==null&&g.memoizedState.cachePool!==null&&(a=g.memoizedState.cachePool.pool),C=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(C=s.memoizedState.cachePool.pool),C!==a&&(s.flags|=2048),g!==null&&L(Wo),null;case 24:return a=null,g!==null&&(a=g.memoizedState.cache),s.memoizedState.cache!==a&&(s.flags|=2048),ag(qt),Et(s),null;case 25:return null;case 30:return null}throw Error(i(156,s.tag))}function zne(g,s){switch(Zh(s),s.tag){case 1:return g=s.flags,g&65536?(s.flags=g&-65537|128,s):null;case 3:return ag(qt),he(),g=s.flags,(g&65536)!==0&&(g&128)===0?(s.flags=g&-65537|128,s):null;case 26:case 27:case 5:return z(s),null;case 31:if(s.memoizedState!==null){if(Wn(s),s.alternate===null)throw Error(i(340));Yo()}return g=s.flags,g&65536?(s.flags=g&-65537|128,s):null;case 13:if(Wn(s),g=s.memoizedState,g!==null&&g.dehydrated!==null){if(s.alternate===null)throw Error(i(340));Yo()}return g=s.flags,g&65536?(s.flags=g&-65537|128,s):null;case 19:return L(Yt),null;case 4:return he(),null;case 10:return ag(s.type),null;case 22:case 23:return Wn(s),qh(),g!==null&&L(Wo),g=s.flags,g&65536?(s.flags=g&-65537|128,s):null;case 24:return ag(qt),null;case 25:return null;default:return null}}function dT(g,s){switch(Zh(s),s.tag){case 3:ag(qt),he();break;case 26:case 27:case 5:z(s);break;case 4:he();break;case 31:s.memoizedState!==null&&Wn(s);break;case 13:Wn(s);break;case 19:L(Yt);break;case 10:ag(s.type);break;case 22:case 23:Wn(s),qh(),g!==null&&L(Wo);break;case 24:ag(qt)}}function uA(g,s){try{var a=s.updateQueue,C=a!==null?a.lastEffect:null;if(C!==null){var d=C.next;a=d;do{if((a.tag&g)===g){C=void 0;var u=a.create,v=a.inst;C=u(),v.destroy=C}a=a.next}while(a!==d)}}catch(b){Ct(s,s.return,b)}}function eo(g,s,a){try{var C=s.updateQueue,d=C!==null?C.lastEffect:null;if(d!==null){var u=d.next;C=u;do{if((C.tag&g)===g){var v=C.inst,b=v.destroy;if(b!==void 0){v.destroy=void 0,d=s;var N=a,B=b;try{B()}catch(X){Ct(d,N,X)}}}C=C.next}while(C!==u)}}catch(X){Ct(s,s.return,X)}}function uT(g){var s=g.updateQueue;if(s!==null){var a=g.stateNode;try{oE(s,a)}catch(C){Ct(g,g.return,C)}}}function hT(g,s,a){a.props=Jo(g.type,g.memoizedProps),a.state=g.memoizedState;try{a.componentWillUnmount()}catch(C){Ct(g,s,C)}}function hA(g,s){try{var a=g.ref;if(a!==null){switch(g.tag){case 26:case 27:case 5:var C=g.stateNode;break;case 30:C=g.stateNode;break;default:C=g.stateNode}typeof a=="function"?g.refCleanup=a(C):a.current=C}}catch(d){Ct(g,s,d)}}function Gi(g,s){var a=g.ref,C=g.refCleanup;if(a!==null)if(typeof C=="function")try{C()}catch(d){Ct(g,s,d)}finally{g.refCleanup=null,g=g.alternate,g!=null&&(g.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(d){Ct(g,s,d)}else a.current=null}function fT(g){var s=g.type,a=g.memoizedProps,C=g.stateNode;try{e:switch(s){case"button":case"input":case"select":case"textarea":a.autoFocus&&C.focus();break e;case"img":a.src?C.src=a.src:a.srcSet&&(C.srcset=a.srcSet)}}catch(d){Ct(g,g.return,d)}}function Mf(g,s,a){try{var C=g.stateNode;eie(C,g.type,a,s),C[kn]=s}catch(d){Ct(g,g.return,d)}}function pT(g){return g.tag===5||g.tag===3||g.tag===26||g.tag===27&&ro(g.type)||g.tag===4}function zf(g){e:for(;;){for(;g.sibling===null;){if(g.return===null||pT(g.return))return null;g=g.return}for(g.sibling.return=g.return,g=g.sibling;g.tag!==5&&g.tag!==6&&g.tag!==18;){if(g.tag===27&&ro(g.type)||g.flags&2||g.child===null||g.tag===4)continue e;g.child.return=g,g=g.child}if(!(g.flags&2))return g.stateNode}}function kf(g,s,a){var C=g.tag;if(C===5||C===6)g=g.stateNode,s?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(g,s):(s=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,s.appendChild(g),a=a._reactRootContainer,a!=null||s.onclick!==null||(s.onclick=ig));else if(C!==4&&(C===27&&ro(g.type)&&(a=g.stateNode,s=null),g=g.child,g!==null))for(kf(g,s,a),g=g.sibling;g!==null;)kf(g,s,a),g=g.sibling}function al(g,s,a){var C=g.tag;if(C===5||C===6)g=g.stateNode,s?a.insertBefore(g,s):a.appendChild(g);else if(C!==4&&(C===27&&ro(g.type)&&(a=g.stateNode),g=g.child,g!==null))for(al(g,s,a),g=g.sibling;g!==null;)al(g,s,a),g=g.sibling}function mT(g){var s=g.stateNode,a=g.memoizedProps;try{for(var C=g.type,d=s.attributes;d.length;)s.removeAttributeNode(d[0]);mn(s,C,a),s[un]=g,s[kn]=a}catch(u){Ct(g,g.return,u)}}var cg=!1,tn=!1,Rf=!1,vT=typeof WeakSet=="function"?WeakSet:Set,In=null;function kne(g,s){if(g=g.containerInfo,tp=Nl,g=zS(g),Eh(g)){if("selectionStart"in g)var a={start:g.selectionStart,end:g.selectionEnd};else e:{a=(a=g.ownerDocument)&&a.defaultView||window;var C=a.getSelection&&a.getSelection();if(C&&C.rangeCount!==0){a=C.anchorNode;var d=C.anchorOffset,u=C.focusNode;C=C.focusOffset;try{a.nodeType,u.nodeType}catch{a=null;break e}var v=0,b=-1,N=-1,B=0,X=0,J=g,G=null;t:for(;;){for(var Y;J!==a||d!==0&&J.nodeType!==3||(b=v+d),J!==u||C!==0&&J.nodeType!==3||(N=v+C),J.nodeType===3&&(v+=J.nodeValue.length),(Y=J.firstChild)!==null;)G=J,J=Y;for(;;){if(J===g)break t;if(G===a&&++B===d&&(b=v),G===u&&++X===C&&(N=v),(Y=J.nextSibling)!==null)break;J=G,G=J.parentNode}J=Y}a=b===-1||N===-1?null:{start:b,end:N}}else a=null}a=a||{start:0,end:0}}else a=null;for(np={focusedElem:g,selectionRange:a},Nl=!1,In=s;In!==null;)if(s=In,g=s.child,(s.subtreeFlags&1028)!==0&&g!==null)g.return=s,In=g;else for(;In!==null;){switch(s=In,u=s.alternate,g=s.flags,s.tag){case 0:if((g&4)!==0&&(g=s.updateQueue,g=g!==null?g.events:null,g!==null))for(a=0;a title"))),mn(u,C,a),u[un]=g,Cn(u),C=u;break e;case"link":var v=EO("link","href",d).get(C+(a.href||""));if(v){for(var b=0;bht&&(v=ht,ht=Me,Me=v);var k=DS(b,Me),D=DS(b,ht);if(k&&D&&(Y.rangeCount!==1||Y.anchorNode!==k.node||Y.anchorOffset!==k.offset||Y.focusNode!==D.node||Y.focusOffset!==D.offset)){var Z=J.createRange();Z.setStart(k.node,k.offset),Y.removeAllRanges(),Me>ht?(Y.addRange(Z),Y.extend(D.node,D.offset)):(Z.setEnd(D.node,D.offset),Y.addRange(Z))}}}}for(J=[],Y=b;Y=Y.parentNode;)Y.nodeType===1&&J.push({element:Y,left:Y.scrollLeft,top:Y.scrollTop});for(typeof b.focus=="function"&&b.focus(),b=0;ba?32:a,M.T=null,a=Gf,Gf=null;var u=go,v=pg;if(rn=0,mr=go=null,pg=0,(ot&6)!==0)throw Error(i(331));var b=ot;if(ot|=4,MT(u.current),OT(u,u.current,v,a),ot=b,bA(0,!1),Vn&&typeof Vn.onPostCommitFiberRoot=="function")try{Vn.onPostCommitFiberRoot(La,u)}catch{}return!0}finally{U.p=d,M.T=C,QT(g,s)}}function $T(g,s,a){s=ai(a,s),s=vf(g.stateNode,s,2),g=$g(g,s,2),g!==null&&(Fa(g,2),Fi(g))}function Ct(g,s,a){if(g.tag===3)$T(g,g,a);else for(;s!==null;){if(s.tag===3){$T(s,g,a);break}else if(s.tag===1){var C=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof C.componentDidCatch=="function"&&(io===null||!io.has(C))){g=ai(a,g),a=qE(2),C=$g(s,a,2),C!==null&&(JE(a,C,s,g),Fa(C,2),Fi(C));break}}s=s.return}}function Yf(g,s,a){var C=g.pingCache;if(C===null){C=g.pingCache=new jne;var d=new Set;C.set(s,d)}else d=C.get(s),d===void 0&&(d=new Set,C.set(s,d));d.has(a)||(Zf=!0,d.add(a),g=Gne.bind(null,g,s,a),s.then(g,g))}function Gne(g,s,a){var C=g.pingCache;C!==null&&C.delete(s),g.pingedLanes|=g.suspendedLanes&a,g.warmLanes&=~a,ft===g&&(Xe&a)===a&&(Lt===4||Lt===3&&(Xe&62914560)===Xe&&300>Bt()-Il?(ot&2)===0&&vr(g,0):Bf|=a,pr===Xe&&(pr=0)),Fi(g)}function qT(g,s){s===0&&(s=H2()),g=Vo(g,s),g!==null&&(Fa(g,s),Fi(g))}function Fne(g){var s=g.memoizedState,a=0;s!==null&&(a=s.retryLane),qT(g,a)}function Vne(g,s){var a=0;switch(g.tag){case 31:case 13:var C=g.stateNode,d=g.memoizedState;d!==null&&(a=d.retryLane);break;case 19:C=g.stateNode;break;case 22:C=g.stateNode._retryCache;break;default:throw Error(i(314))}C!==null&&C.delete(s),qT(g,a)}function Une(g,s){return Ce(g,s)}var pl=null,br=null,Hf=!1,ml=!1,Kf=!1,so=0;function Fi(g){g!==br&&g.next===null&&(br===null?pl=br=g:br=br.next=g),ml=!0,Hf||(Hf=!0,Hne())}function bA(g,s){if(!Kf&&ml){Kf=!0;do for(var a=!1,C=pl;C!==null;){if(g!==0){var d=C.pendingLanes;if(d===0)var u=0;else{var v=C.suspendedLanes,b=C.pingedLanes;u=(1<<31-Un(42|g)+1)-1,u&=d&~(v&~b),u=u&201326741?u&201326741|1:u?u|2:0}u!==0&&(a=!0,nO(C,u))}else u=Xe,u=wI(C,C===ft?u:0,C.cancelPendingCommit!==null||C.timeoutHandle!==-1),(u&3)===0||Ga(C,u)||(a=!0,nO(C,u));C=C.next}while(a);Kf=!1}}function Yne(){JT()}function JT(){ml=Hf=!1;var g=0;so!==0&&nie()&&(g=so);for(var s=Bt(),a=null,C=pl;C!==null;){var d=C.next,u=eO(C,s);u===0?(C.next=null,a===null?pl=d:a.next=d,d===null&&(br=a)):(a=C,(g!==0||(u&3)!==0)&&(ml=!0)),C=d}rn!==0&&rn!==5||bA(g),so!==0&&(so=0)}function eO(g,s){for(var a=g.suspendedLanes,C=g.pingedLanes,d=g.expirationTimes,u=g.pendingLanes&-62914561;0b)break;var X=N.transferSize,J=N.initiatorType;X&&CO(J)&&(N=N.responseEnd,v+=X*(N"u"?null:document;function bO(g,s,a){var C=wr;if(C&&typeof s=="string"&&s){var d=si(s);d='link[rel="'+g+'"][href="'+d+'"]',typeof a=="string"&&(d+='[crossorigin="'+a+'"]'),yO.has(d)||(yO.add(d),g={rel:g,crossOrigin:a,href:s},C.querySelector(d)===null&&(s=C.createElement("link"),mn(s,"link",g),Cn(s),C.head.appendChild(s)))}}function Iie(g){mg.D(g),bO("dns-prefetch",g,null)}function lie(g,s){mg.C(g,s),bO("preconnect",g,s)}function cie(g,s,a){mg.L(g,s,a);var C=wr;if(C&&g&&s){var d='link[rel="preload"][as="'+si(s)+'"]';s==="image"&&a&&a.imageSrcSet?(d+='[imagesrcset="'+si(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(d+='[imagesizes="'+si(a.imageSizes)+'"]')):d+='[href="'+si(g)+'"]';var u=d;switch(s){case"style":u=xr(g);break;case"script":u=Sr(g)}di.has(u)||(g=p({rel:"preload",href:s==="image"&&a&&a.imageSrcSet?void 0:g,as:s},a),di.set(u,g),C.querySelector(d)!==null||s==="style"&&C.querySelector(EA(u))||s==="script"&&C.querySelector(TA(u))||(s=C.createElement("link"),mn(s,"link",g),Cn(s),C.head.appendChild(s)))}}function die(g,s){mg.m(g,s);var a=wr;if(a&&g){var C=s&&typeof s.as=="string"?s.as:"script",d='link[rel="modulepreload"][as="'+si(C)+'"][href="'+si(g)+'"]',u=d;switch(C){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":u=Sr(g)}if(!di.has(u)&&(g=p({rel:"modulepreload",href:g},s),di.set(u,g),a.querySelector(d)===null)){switch(C){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(TA(u)))return}C=a.createElement("link"),mn(C,"link",g),Cn(C),a.head.appendChild(C)}}}function uie(g,s,a){mg.S(g,s,a);var C=wr;if(C&&g){var d=Hs(C).hoistableStyles,u=xr(g);s=s||"default";var v=d.get(u);if(!v){var b={loading:0,preload:null};if(v=C.querySelector(EA(u)))b.loading=5;else{g=p({rel:"stylesheet",href:g,"data-precedence":s},a),(a=di.get(u))&&Ap(g,a);var N=v=C.createElement("link");Cn(N),mn(N,"link",g),N._p=new Promise(function(B,X){N.onload=B,N.onerror=X}),N.addEventListener("load",function(){b.loading|=1}),N.addEventListener("error",function(){b.loading|=2}),b.loading|=4,xl(v,s,C)}v={type:"stylesheet",instance:v,count:1,state:b},d.set(u,v)}}}function hie(g,s){mg.X(g,s);var a=wr;if(a&&g){var C=Hs(a).hoistableScripts,d=Sr(g),u=C.get(d);u||(u=a.querySelector(TA(d)),u||(g=p({src:g,async:!0},s),(s=di.get(d))&&Cp(g,s),u=a.createElement("script"),Cn(u),mn(u,"link",g),a.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},C.set(d,u))}}function fie(g,s){mg.M(g,s);var a=wr;if(a&&g){var C=Hs(a).hoistableScripts,d=Sr(g),u=C.get(d);u||(u=a.querySelector(TA(d)),u||(g=p({src:g,async:!0,type:"module"},s),(s=di.get(d))&&Cp(g,s),u=a.createElement("script"),Cn(u),mn(u,"link",g),a.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},C.set(d,u))}}function wO(g,s,a,C){var d=(d=ye.current)?wl(d):null;if(!d)throw Error(i(446));switch(g){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(s=xr(a.href),a=Hs(d).hoistableStyles,C=a.get(s),C||(C={type:"style",instance:null,count:0,state:null},a.set(s,C)),C):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){g=xr(a.href);var u=Hs(d).hoistableStyles,v=u.get(g);if(v||(d=d.ownerDocument||d,v={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},u.set(g,v),(u=d.querySelector(EA(g)))&&!u._p&&(v.instance=u,v.state.loading=5),di.has(g)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},di.set(g,a),u||pie(d,g,a,v.state))),s&&C===null)throw Error(i(528,""));return v}if(s&&C!==null)throw Error(i(529,""));return null;case"script":return s=a.async,a=a.src,typeof a=="string"&&s&&typeof s!="function"&&typeof s!="symbol"?(s=Sr(a),a=Hs(d).hoistableScripts,C=a.get(s),C||(C={type:"script",instance:null,count:0,state:null},a.set(s,C)),C):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,g))}}function xr(g){return'href="'+si(g)+'"'}function EA(g){return'link[rel="stylesheet"]['+g+"]"}function xO(g){return p({},g,{"data-precedence":g.precedence,precedence:null})}function pie(g,s,a,C){g.querySelector('link[rel="preload"][as="style"]['+s+"]")?C.loading=1:(s=g.createElement("link"),C.preload=s,s.addEventListener("load",function(){return C.loading|=1}),s.addEventListener("error",function(){return C.loading|=2}),mn(s,"link",a),Cn(s),g.head.appendChild(s))}function Sr(g){return'[src="'+si(g)+'"]'}function TA(g){return"script[async]"+g}function SO(g,s,a){if(s.count++,s.instance===null)switch(s.type){case"style":var C=g.querySelector('style[data-href~="'+si(a.href)+'"]');if(C)return s.instance=C,Cn(C),C;var d=p({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return C=(g.ownerDocument||g).createElement("style"),Cn(C),mn(C,"style",d),xl(C,a.precedence,g),s.instance=C;case"stylesheet":d=xr(a.href);var u=g.querySelector(EA(d));if(u)return s.state.loading|=4,s.instance=u,Cn(u),u;C=xO(a),(d=di.get(d))&&Ap(C,d),u=(g.ownerDocument||g).createElement("link"),Cn(u);var v=u;return v._p=new Promise(function(b,N){v.onload=b,v.onerror=N}),mn(u,"link",C),s.state.loading|=4,xl(u,a.precedence,g),s.instance=u;case"script":return u=Sr(a.src),(d=g.querySelector(TA(u)))?(s.instance=d,Cn(d),d):(C=a,(d=di.get(u))&&(C=p({},a),Cp(C,d)),g=g.ownerDocument||g,d=g.createElement("script"),Cn(d),mn(d,"link",C),g.head.appendChild(d),s.instance=d);case"void":return null;default:throw Error(i(443,s.type))}else s.type==="stylesheet"&&(s.state.loading&4)===0&&(C=s.instance,s.state.loading|=4,xl(C,a.precedence,g));return s.instance}function xl(g,s,a){for(var C=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),d=C.length?C[C.length-1]:null,u=d,v=0;v title"):null)}function mie(g,s,a){if(a===1||s.itemProp!=null)return!1;switch(g){case"meta":case"title":return!0;case"style":if(typeof s.precedence!="string"||typeof s.href!="string"||s.href==="")break;return!0;case"link":if(typeof s.rel!="string"||typeof s.href!="string"||s.href===""||s.onLoad||s.onError)break;return s.rel==="stylesheet"?(g=s.disabled,typeof s.precedence=="string"&&g==null):!0;case"script":if(s.async&&typeof s.async!="function"&&typeof s.async!="symbol"&&!s.onLoad&&!s.onError&&s.src&&typeof s.src=="string")return!0}return!1}function OO(g){return!(g.type==="stylesheet"&&(g.state.loading&3)===0)}function vie(g,s,a,C){if(a.type==="stylesheet"&&(typeof C.media!="string"||matchMedia(C.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var d=xr(C.href),u=s.querySelector(EA(d));if(u){s=u._p,s!==null&&typeof s=="object"&&typeof s.then=="function"&&(g.count++,g=El.bind(g),s.then(g,g)),a.state.loading|=4,a.instance=u,Cn(u);return}u=s.ownerDocument||s,C=xO(C),(d=di.get(d))&&Ap(C,d),u=u.createElement("link"),Cn(u);var v=u;v._p=new Promise(function(b,N){v.onload=b,v.onerror=N}),mn(u,"link",C),a.instance=u}g.stylesheets===null&&(g.stylesheets=new Map),g.stylesheets.set(a,s),(s=a.state.preload)&&(a.state.loading&3)===0&&(g.count++,a=El.bind(g),s.addEventListener("load",a),s.addEventListener("error",a))}}var Ip=0;function yie(g,s){return g.stylesheets&&g.count===0&&Ol(g,g.stylesheets),0Ip?50:800)+s);return g.unsuspend=a,function(){g.unsuspend=null,clearTimeout(C),clearTimeout(d)}}:null}function El(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Ol(this,this.stylesheets);else if(this.unsuspend){var g=this.unsuspend;this.unsuspend=null,g()}}}var Tl=null;function Ol(g,s){g.stylesheets=null,g.unsuspend!==null&&(g.count++,Tl=new Map,s.forEach(bie,g),Tl=null,El.call(g))}function bie(g,s){if(!(s.state.loading&4)){var a=Tl.get(g);if(a)var C=a.get(null);else{a=new Map,Tl.set(g,a);for(var d=g.querySelectorAll("link[data-precedence],style[data-precedence]"),u=0;u"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}return n(),Zl.exports=$O(),Zl.exports}var JO=qO(),Op;function $(n,e,t){function i(I,l){if(I._zod||Object.defineProperty(I,"_zod",{value:{def:l,constr:A,traits:new Set},enumerable:!1}),I._zod.traits.has(n))return;I._zod.traits.add(n),e(I,l);const c=A.prototype,h=Object.keys(c);for(let p=0;pt?.Parent&&I instanceof t.Parent?!0:I?._zod?.traits?.has(n)}),Object.defineProperty(A,"name",{value:n}),A}class ns extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Np extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}(Op=globalThis).__zod_globalConfig??(Op.__zod_globalConfig={});const Vl=globalThis.__zod_globalConfig;function Vi(n){return Vl}function Dp(n){const e=Object.values(n).filter(i=>typeof i=="number");return Object.entries(n).filter(([i,o])=>e.indexOf(+i)===-1).map(([i,o])=>o)}function Ul(n,e){return typeof e=="bigint"?e.toString():e}function zA(n){return{get value(){{const e=n();return Object.defineProperty(this,"value",{value:e}),e}}}}function Yl(n){return n==null}function Hl(n){const e=n.startsWith("^")?1:0,t=n.endsWith("$")?n.length-1:n.length;return n.slice(e,t)}function eN(n,e){const t=n/e,i=Math.round(t),o=Number.EPSILON*Math.max(Math.abs(t),1);return Math.abs(t-i){};function Nr(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}const nN=zA(()=>{if(Vl.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const n=Function;return new n(""),!0}catch{return!1}});function is(n){if(Nr(n)===!1)return!1;const e=n.constructor;if(e===void 0||typeof e!="function")return!0;const t=e.prototype;return!(Nr(t)===!1||Object.prototype.hasOwnProperty.call(t,"isPrototypeOf")===!1)}function Rp(n){return is(n)?{...n}:Array.isArray(n)?[...n]:n instanceof Map?new Map(n):n instanceof Set?new Set(n):n}const iN=new Set(["string","number","symbol"]);function gs(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function yg(n,e,t){const i=new n._zod.constr(e??n._zod.def);return(!e||t?.parent)&&(i._zod.parent=n),i}function we(n){const e=n;if(!e)return{};if(typeof e=="string")return{error:()=>e};if(e?.message!==void 0){if(e?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function gN(n){return Object.keys(n).filter(e=>n[e]._zod.optin==="optional"&&n[e]._zod.optout==="optional")}const oN={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function sN(n,e){const t=n._zod.def,i=t.checks;if(i&&i.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const r=vg(n._zod.def,{get shape(){const A={};for(const I in e){if(!(I in t.shape))throw new Error(`Unrecognized key: "${I}"`);e[I]&&(A[I]=t.shape[I])}return co(this,"shape",A),A},checks:[]});return yg(n,r)}function rN(n,e){const t=n._zod.def,i=t.checks;if(i&&i.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const r=vg(n._zod.def,{get shape(){const A={...n._zod.def.shape};for(const I in e){if(!(I in t.shape))throw new Error(`Unrecognized key: "${I}"`);e[I]&&delete A[I]}return co(this,"shape",A),A},checks:[]});return yg(n,r)}function aN(n,e){if(!is(e))throw new Error("Invalid input to extend: expected a plain object");const t=n._zod.def.checks;if(t&&t.length>0){const r=n._zod.def.shape;for(const A in e)if(Object.getOwnPropertyDescriptor(r,A)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const o=vg(n._zod.def,{get shape(){const r={...n._zod.def.shape,...e};return co(this,"shape",r),r}});return yg(n,o)}function AN(n,e){if(!is(e))throw new Error("Invalid input to safeExtend: expected a plain object");const t=vg(n._zod.def,{get shape(){const i={...n._zod.def.shape,...e};return co(this,"shape",i),i}});return yg(n,t)}function CN(n,e){if(n._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");const t=vg(n._zod.def,{get shape(){const i={...n._zod.def.shape,...e._zod.def.shape};return co(this,"shape",i),i},get catchall(){return e._zod.def.catchall},checks:e._zod.def.checks??[]});return yg(n,t)}function IN(n,e,t){const o=e._zod.def.checks;if(o&&o.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const A=vg(e._zod.def,{get shape(){const I=e._zod.def.shape,l={...I};if(t)for(const c in t){if(!(c in I))throw new Error(`Unrecognized key: "${c}"`);t[c]&&(l[c]=n?new n({type:"optional",innerType:I[c]}):I[c])}else for(const c in I)l[c]=n?new n({type:"optional",innerType:I[c]}):I[c];return co(this,"shape",l),l},checks:[]});return yg(e,A)}function lN(n,e,t){const i=vg(e._zod.def,{get shape(){const o=e._zod.def.shape,r={...o};if(t)for(const A in t){if(!(A in r))throw new Error(`Unrecognized key: "${A}"`);t[A]&&(r[A]=new n({type:"nonoptional",innerType:o[A]}))}else for(const A in o)r[A]=new n({type:"nonoptional",innerType:o[A]});return co(this,"shape",r),r}});return yg(e,i)}function os(n,e=0){if(n.aborted===!0)return!0;for(let t=e;t{var i;return(i=t).path??(i.path=[]),t.path.unshift(n),t})}function kA(n){return typeof n=="string"?n:n?.message}function Ui(n,e,t){const i=n.message?n.message:kA(n.inst?._zod.def?.error?.(n))??kA(e?.error?.(n))??kA(t.customError?.(n))??kA(t.localeError?.(n))??"Invalid input",{inst:o,continue:r,input:A,...I}=n;return I.path??(I.path=[]),I.message=i,e?.reportInput&&(I.input=A),I}function Kl(n){return Array.isArray(n)?"array":typeof n=="string"?"string":"unknown"}function Dr(...n){const[e,t,i]=n;return typeof e=="string"?{message:e,code:"custom",input:t,inst:i}:{...e}}const _p=(n,e)=>{n.name="$ZodError",Object.defineProperty(n,"_zod",{value:n._zod,enumerable:!1}),Object.defineProperty(n,"issues",{value:e,enumerable:!1}),n.message=JSON.stringify(e,Ul,2),Object.defineProperty(n,"toString",{value:()=>n.message,enumerable:!1})},jp=$("$ZodError",_p),Zp=$("$ZodError",_p,{Parent:Error});function dN(n,e=t=>t.message){const t={},i=[];for(const o of n.issues)o.path.length>0?(t[o.path[0]]=t[o.path[0]]||[],t[o.path[0]].push(e(o))):i.push(e(o));return{formErrors:i,fieldErrors:t}}function uN(n,e=t=>t.message){const t={_errors:[]},i=(o,r=[])=>{for(const A of o.issues)if(A.code==="invalid_union"&&A.errors.length)A.errors.map(I=>i({issues:I},[...r,...A.path]));else if(A.code==="invalid_key")i({issues:A.issues},[...r,...A.path]);else if(A.code==="invalid_element")i({issues:A.issues},[...r,...A.path]);else{const I=[...r,...A.path];if(I.length===0)t._errors.push(e(A));else{let l=t,c=0;for(;c(e,t,i,o)=>{const r=i?{...i,async:!1}:{async:!1},A=e._zod.run({value:t,issues:[]},r);if(A instanceof Promise)throw new ns;if(A.issues.length){const I=new(o?.Err??n)(A.issues.map(l=>Ui(l,r,Vi())));throw kp(I,o?.callee),I}return A.value},Ql=n=>async(e,t,i,o)=>{const r=i?{...i,async:!0}:{async:!0};let A=e._zod.run({value:t,issues:[]},r);if(A instanceof Promise&&(A=await A),A.issues.length){const I=new(o?.Err??n)(A.issues.map(l=>Ui(l,r,Vi())));throw kp(I,o?.callee),I}return A.value},RA=n=>(e,t,i)=>{const o=i?{...i,async:!1}:{async:!1},r=e._zod.run({value:t,issues:[]},o);if(r instanceof Promise)throw new ns;return r.issues.length?{success:!1,error:new(n??jp)(r.issues.map(A=>Ui(A,o,Vi())))}:{success:!0,data:r.value}},hN=RA(Zp),_A=n=>async(e,t,i)=>{const o=i?{...i,async:!0}:{async:!0};let r=e._zod.run({value:t,issues:[]},o);return r instanceof Promise&&(r=await r),r.issues.length?{success:!1,error:new n(r.issues.map(A=>Ui(A,o,Vi())))}:{success:!0,data:r.value}},fN=_A(Zp),pN=n=>(e,t,i)=>{const o=i?{...i,direction:"backward"}:{direction:"backward"};return Wl(n)(e,t,o)},mN=n=>(e,t,i)=>Wl(n)(e,t,i),vN=n=>async(e,t,i)=>{const o=i?{...i,direction:"backward"}:{direction:"backward"};return Ql(n)(e,t,o)},yN=n=>async(e,t,i)=>Ql(n)(e,t,i),bN=n=>(e,t,i)=>{const o=i?{...i,direction:"backward"}:{direction:"backward"};return RA(n)(e,t,o)},wN=n=>(e,t,i)=>RA(n)(e,t,i),xN=n=>async(e,t,i)=>{const o=i?{...i,direction:"backward"}:{direction:"backward"};return _A(n)(e,t,o)},SN=n=>async(e,t,i)=>_A(n)(e,t,i),EN=/^[cC][0-9a-z]{6,}$/,TN=/^[0-9a-z]+$/,ON=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,NN=/^[0-9a-vA-V]{20}$/,DN=/^[A-Za-z0-9]{27}$/,MN=/^[a-zA-Z0-9_-]{21}$/,zN=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,kN=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Bp=n=>n?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${n}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,RN=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,_N="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function jN(){return new RegExp(_N,"u")}const ZN=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,BN=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,PN=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,LN=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,GN=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Pp=/^[A-Za-z0-9_-]*$/,FN=/^https?$/,VN=/^\+[1-9]\d{6,14}$/,Lp="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",UN=new RegExp(`^${Lp}$`);function Gp(n){const e="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof n.precision=="number"?n.precision===-1?`${e}`:n.precision===0?`${e}:[0-5]\\d`:`${e}:[0-5]\\d\\.\\d{${n.precision}}`:`${e}(?::[0-5]\\d(?:\\.\\d+)?)?`}function YN(n){return new RegExp(`^${Gp(n)}$`)}function HN(n){const e=Gp({precision:n.precision}),t=["Z"];n.local&&t.push(""),n.offset&&t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const i=`${e}(?:${t.join("|")})`;return new RegExp(`^${Lp}T(?:${i})$`)}const KN=n=>{const e=n?`[\\s\\S]{${n?.minimum??0},${n?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)},WN=/^-?\d+$/,Fp=/^-?\d+(?:\.\d+)?$/,QN=/^(?:true|false)$/i,XN=/^[^A-Z]*$/,$N=/^[^a-z]*$/,Nn=$("$ZodCheck",(n,e)=>{var t;n._zod??(n._zod={}),n._zod.def=e,(t=n._zod).onattach??(t.onattach=[])}),Vp={number:"number",bigint:"bigint",object:"date"},Up=$("$ZodCheckLessThan",(n,e)=>{Nn.init(n,e);const t=Vp[typeof e.value];n._zod.onattach.push(i=>{const o=i._zod.bag,r=(e.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;e.value{(e.inclusive?i.value<=e.value:i.value{Nn.init(n,e);const t=Vp[typeof e.value];n._zod.onattach.push(i=>{const o=i._zod.bag,r=(e.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>r&&(e.inclusive?o.minimum=e.value:o.exclusiveMinimum=e.value)}),n._zod.check=i=>{(e.inclusive?i.value>=e.value:i.value>e.value)||i.issues.push({origin:t,code:"too_small",minimum:typeof e.value=="object"?e.value.getTime():e.value,input:i.value,inclusive:e.inclusive,inst:n,continue:!e.abort})}}),qN=$("$ZodCheckMultipleOf",(n,e)=>{Nn.init(n,e),n._zod.onattach.push(t=>{var i;(i=t._zod.bag).multipleOf??(i.multipleOf=e.value)}),n._zod.check=t=>{if(typeof t.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof t.value=="bigint"?t.value%e.value===BigInt(0):eN(t.value,e.value)===0)||t.issues.push({origin:typeof t.value,code:"not_multiple_of",divisor:e.value,input:t.value,inst:n,continue:!e.abort})}}),JN=$("$ZodCheckNumberFormat",(n,e)=>{Nn.init(n,e),e.format=e.format||"float64";const t=e.format?.includes("int"),i=t?"int":"number",[o,r]=oN[e.format];n._zod.onattach.push(A=>{const I=A._zod.bag;I.format=e.format,I.minimum=o,I.maximum=r,t&&(I.pattern=WN)}),n._zod.check=A=>{const I=A.value;if(t){if(!Number.isInteger(I)){A.issues.push({expected:i,format:e.format,code:"invalid_type",continue:!1,input:I,inst:n});return}if(!Number.isSafeInteger(I)){I>0?A.issues.push({input:I,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:n,origin:i,inclusive:!0,continue:!e.abort}):A.issues.push({input:I,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:n,origin:i,inclusive:!0,continue:!e.abort});return}}Ir&&A.issues.push({origin:"number",input:I,code:"too_big",maximum:r,inclusive:!0,inst:n,continue:!e.abort})}}),eD=$("$ZodCheckMaxLength",(n,e)=>{var t;Nn.init(n,e),(t=n._zod.def).when??(t.when=i=>{const o=i.value;return!Yl(o)&&o.length!==void 0}),n._zod.onattach.push(i=>{const o=i._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum{const o=i.value;if(o.length<=e.maximum)return;const A=Kl(o);i.issues.push({origin:A,code:"too_big",maximum:e.maximum,inclusive:!0,input:o,inst:n,continue:!e.abort})}}),tD=$("$ZodCheckMinLength",(n,e)=>{var t;Nn.init(n,e),(t=n._zod.def).when??(t.when=i=>{const o=i.value;return!Yl(o)&&o.length!==void 0}),n._zod.onattach.push(i=>{const o=i._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>o&&(i._zod.bag.minimum=e.minimum)}),n._zod.check=i=>{const o=i.value;if(o.length>=e.minimum)return;const A=Kl(o);i.issues.push({origin:A,code:"too_small",minimum:e.minimum,inclusive:!0,input:o,inst:n,continue:!e.abort})}}),nD=$("$ZodCheckLengthEquals",(n,e)=>{var t;Nn.init(n,e),(t=n._zod.def).when??(t.when=i=>{const o=i.value;return!Yl(o)&&o.length!==void 0}),n._zod.onattach.push(i=>{const o=i._zod.bag;o.minimum=e.length,o.maximum=e.length,o.length=e.length}),n._zod.check=i=>{const o=i.value,r=o.length;if(r===e.length)return;const A=Kl(o),I=r>e.length;i.issues.push({origin:A,...I?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:i.value,inst:n,continue:!e.abort})}}),jA=$("$ZodCheckStringFormat",(n,e)=>{var t,i;Nn.init(n,e),n._zod.onattach.push(o=>{const r=o._zod.bag;r.format=e.format,e.pattern&&(r.patterns??(r.patterns=new Set),r.patterns.add(e.pattern))}),e.pattern?(t=n._zod).check??(t.check=o=>{e.pattern.lastIndex=0,!e.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:e.format,input:o.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:n,continue:!e.abort})}):(i=n._zod).check??(i.check=()=>{})}),iD=$("$ZodCheckRegex",(n,e)=>{jA.init(n,e),n._zod.check=t=>{e.pattern.lastIndex=0,!e.pattern.test(t.value)&&t.issues.push({origin:"string",code:"invalid_format",format:"regex",input:t.value,pattern:e.pattern.toString(),inst:n,continue:!e.abort})}}),gD=$("$ZodCheckLowerCase",(n,e)=>{e.pattern??(e.pattern=XN),jA.init(n,e)}),oD=$("$ZodCheckUpperCase",(n,e)=>{e.pattern??(e.pattern=$N),jA.init(n,e)}),sD=$("$ZodCheckIncludes",(n,e)=>{Nn.init(n,e);const t=gs(e.includes),i=new RegExp(typeof e.position=="number"?`^.{${e.position}}${t}`:t);e.pattern=i,n._zod.onattach.push(o=>{const r=o._zod.bag;r.patterns??(r.patterns=new Set),r.patterns.add(i)}),n._zod.check=o=>{o.value.includes(e.includes,e.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:o.value,inst:n,continue:!e.abort})}}),rD=$("$ZodCheckStartsWith",(n,e)=>{Nn.init(n,e);const t=new RegExp(`^${gs(e.prefix)}.*`);e.pattern??(e.pattern=t),n._zod.onattach.push(i=>{const o=i._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(t)}),n._zod.check=i=>{i.value.startsWith(e.prefix)||i.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:i.value,inst:n,continue:!e.abort})}}),aD=$("$ZodCheckEndsWith",(n,e)=>{Nn.init(n,e);const t=new RegExp(`.*${gs(e.suffix)}$`);e.pattern??(e.pattern=t),n._zod.onattach.push(i=>{const o=i._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(t)}),n._zod.check=i=>{i.value.endsWith(e.suffix)||i.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:i.value,inst:n,continue:!e.abort})}}),AD=$("$ZodCheckOverwrite",(n,e)=>{Nn.init(n,e),n._zod.check=t=>{t.value=e.tx(t.value)}});class CD{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}const i=e.split(` +`+C.stack}}var De=Object.prototype.hasOwnProperty,R=n.unstable_scheduleCallback,Ce=n.unstable_cancelCallback,Je=n.unstable_shouldYield,St=n.unstable_requestPaint,He=n.unstable_now,Pi=n.unstable_getCurrentPriorityLevel,Ga=n.unstable_ImmediatePriority,U2=n.unstable_UserBlockingPriority,vI=n.unstable_NormalPriority,lte=n.unstable_LowPriority,Y2=n.unstable_IdlePriority,cte=n.log,dte=n.unstable_setDisableYieldValue,Fa=null,Vn=null;function Vg(g){if(typeof cte=="function"&&dte(g),Vn&&typeof Vn.setStrictMode=="function")try{Vn.setStrictMode(Fa,g)}catch{}}var Un=Math.clz32?Math.clz32:fte,ute=Math.log,hte=Math.LN2;function fte(g){return g>>>=0,g===0?32:31-(ute(g)/hte|0)|0}var yI=256,bI=262144,wI=4194304;function Po(g){var s=g&42;if(s!==0)return s;switch(g&-g){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return g&261888;case 262144:case 524288:case 1048576:case 2097152:return g&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return g&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return g}}function xI(g,s,a){var C=g.pendingLanes;if(C===0)return 0;var d=0,u=g.suspendedLanes,v=g.pingedLanes;g=g.warmLanes;var b=C&134217727;return b!==0?(C=b&~u,C!==0?d=Po(C):(v&=b,v!==0?d=Po(v):a||(a=b&~g,a!==0&&(d=Po(a))))):(b=C&~u,b!==0?d=Po(b):v!==0?d=Po(v):a||(a=C&~g,a!==0&&(d=Po(a)))),d===0?0:s!==0&&s!==d&&(s&u)===0&&(u=d&-d,a=s&-s,u>=a||u===32&&(a&4194048)!==0)?s:d}function Va(g,s){return(g.pendingLanes&~(g.suspendedLanes&~g.pingedLanes)&s)===0}function pte(g,s){switch(g){case 1:case 2:case 4:case 8:case 64:return s+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return s+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function H2(){var g=wI;return wI<<=1,(wI&62914560)===0&&(wI=4194304),g}function sh(g){for(var s=[],a=0;31>a;a++)s.push(g);return s}function Ua(g,s){g.pendingLanes|=s,s!==268435456&&(g.suspendedLanes=0,g.pingedLanes=0,g.warmLanes=0)}function mte(g,s,a,C,d,u){var v=g.pendingLanes;g.pendingLanes=a,g.suspendedLanes=0,g.pingedLanes=0,g.warmLanes=0,g.expiredLanes&=a,g.entangledLanes&=a,g.errorRecoveryDisabledLanes&=a,g.shellSuspendCounter=0;var b=g.entanglements,N=g.expirationTimes,B=g.hiddenUpdates;for(a=v&~a;0"u")return null;try{return g.activeElement||g.body}catch{return g.body}}var Ste=/[\n"\\]/g;function si(g){return g.replace(Ste,function(s){return"\\"+s.charCodeAt(0).toString(16)+" "})}function lh(g,s,a,C,d,u,v,b){g.name="",v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"?g.type=v:g.removeAttribute("type"),s!=null?v==="number"?(s===0&&g.value===""||g.value!=s)&&(g.value=""+oi(s)):g.value!==""+oi(s)&&(g.value=""+oi(s)):v!=="submit"&&v!=="reset"||g.removeAttribute("value"),s!=null?ch(g,v,oi(s)):a!=null?ch(g,v,oi(a)):C!=null&&g.removeAttribute("value"),d==null&&u!=null&&(g.defaultChecked=!!u),d!=null&&(g.checked=d&&typeof d!="function"&&typeof d!="symbol"),b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"?g.name=""+oi(b):g.removeAttribute("name")}function oS(g,s,a,C,d,u,v,b){if(u!=null&&typeof u!="function"&&typeof u!="symbol"&&typeof u!="boolean"&&(g.type=u),s!=null||a!=null){if(!(u!=="submit"&&u!=="reset"||s!=null)){Ih(g);return}a=a!=null?""+oi(a):"",s=s!=null?""+oi(s):a,b||s===g.value||(g.value=s),g.defaultValue=s}C=C??d,C=typeof C!="function"&&typeof C!="symbol"&&!!C,g.checked=b?g.checked:!!C,g.defaultChecked=!!C,v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"&&(g.name=v),Ih(g)}function ch(g,s,a){s==="number"&&TI(g.ownerDocument)===g||g.defaultValue===""+a||(g.defaultValue=""+a)}function Qs(g,s,a,C){if(g=g.options,s){s={};for(var d=0;d"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ph=!1;if(og)try{var Wa={};Object.defineProperty(Wa,"passive",{get:function(){ph=!0}}),window.addEventListener("test",Wa,Wa),window.removeEventListener("test",Wa,Wa)}catch{ph=!1}var Yg=null,mh=null,NI=null;function lS(){if(NI)return NI;var g,s=mh,a=s.length,C,d="value"in Yg?Yg.value:Yg.textContent,u=d.length;for(g=0;g=$a),pS=" ",mS=!1;function vS(g,s){switch(g){case"keyup":return Jte.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function yS(g){return g=g.detail,typeof g=="object"&&"data"in g?g.data:null}var Js=!1;function tne(g,s){switch(g){case"compositionend":return yS(s);case"keypress":return s.which!==32?null:(mS=!0,pS);case"textInput":return g=s.data,g===pS&&mS?null:g;default:return null}}function nne(g,s){if(Js)return g==="compositionend"||!xh&&vS(g,s)?(g=lS(),NI=mh=Yg=null,Js=!1,g):null;switch(g){case"paste":return null;case"keypress":if(!(s.ctrlKey||s.altKey||s.metaKey)||s.ctrlKey&&s.altKey){if(s.char&&1=s)return{node:a,offset:s-g};g=C}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=NS(a)}}function MS(g,s){return g&&s?g===s?!0:g&&g.nodeType===3?!1:s&&s.nodeType===3?MS(g,s.parentNode):"contains"in g?g.contains(s):g.compareDocumentPosition?!!(g.compareDocumentPosition(s)&16):!1:!1}function zS(g){g=g!=null&&g.ownerDocument!=null&&g.ownerDocument.defaultView!=null?g.ownerDocument.defaultView:window;for(var s=TI(g.document);s instanceof g.HTMLIFrameElement;){try{var a=typeof s.contentWindow.location.href=="string"}catch{a=!1}if(a)g=s.contentWindow;else break;s=TI(g.document)}return s}function Th(g){var s=g&&g.nodeName&&g.nodeName.toLowerCase();return s&&(s==="input"&&(g.type==="text"||g.type==="search"||g.type==="tel"||g.type==="url"||g.type==="password")||s==="textarea"||g.contentEditable==="true")}var Cne=og&&"documentMode"in document&&11>=document.documentMode,er=null,Oh=null,tA=null,Nh=!1;function kS(g,s,a){var C=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;Nh||er==null||er!==TI(C)||(C=er,"selectionStart"in C&&Th(C)?C={start:C.selectionStart,end:C.selectionEnd}:(C=(C.ownerDocument&&C.ownerDocument.defaultView||window).getSelection(),C={anchorNode:C.anchorNode,anchorOffset:C.anchorOffset,focusNode:C.focusNode,focusOffset:C.focusOffset}),tA&&eA(tA,C)||(tA=C,C=bl(Oh,"onSelect"),0>=v,d-=v,Li=1<<32-Un(s)+d|a<Ge?(Xe=ye,ye=null):Xe=ye.sibling;var gt=G(k,ye,j[Ge],q);if(gt===null){ye===null&&(ye=Xe);break}g&&ye&>.alternate===null&&s(k,ye),D=u(gt,D,Ge),it===null?Se=gt:it.sibling=gt,it=gt,ye=Xe}if(Ge===j.length)return a(k,ye),$e&&rg(k,Ge),Se;if(ye===null){for(;GeGe?(Xe=ye,ye=null):Xe=ye.sibling;var co=G(k,ye,gt.value,q);if(co===null){ye===null&&(ye=Xe);break}g&&ye&&co.alternate===null&&s(k,ye),D=u(co,D,Ge),it===null?Se=co:it.sibling=co,it=co,ye=Xe}if(gt.done)return a(k,ye),$e&&rg(k,Ge),Se;if(ye===null){for(;!gt.done;Ge++,gt=j.next())gt=J(k,gt.value,q),gt!==null&&(D=u(gt,D,Ge),it===null?Se=gt:it.sibling=gt,it=gt);return $e&&rg(k,Ge),Se}for(ye=C(ye);!gt.done;Ge++,gt=j.next())gt=Y(ye,k,Ge,gt.value,q),gt!==null&&(g&>.alternate!==null&&ye.delete(gt.key===null?Ge:gt.key),D=u(gt,D,Ge),it===null?Se=gt:it.sibling=gt,it=gt);return g&&ye.forEach(function(Die){return s(k,Die)}),$e&&rg(k,Ge),Se}function ft(k,D,j,q){if(typeof j=="object"&&j!==null&&j.type===S&&j.key===null&&(j=j.props.children),typeof j=="object"&&j!==null){switch(j.$$typeof){case y:e:{for(var Se=j.key;D!==null;){if(D.key===Se){if(Se=j.type,Se===S){if(D.tag===7){a(k,D.sibling),q=d(D,j.props.children),q.return=k,k=q;break e}}else if(D.elementType===Se||typeof Se=="object"&&Se!==null&&Se.$$typeof===Z&&Xo(Se)===D.type){a(k,D.sibling),q=d(D,j.props),rA(q,j),q.return=k,k=q;break e}a(k,D);break}else s(k,D);D=D.sibling}j.type===S?(q=Yo(j.props.children,k.mode,q,j.key),q.return=k,k=q):(q=PI(j.type,j.key,j.props,null,k.mode,q),rA(q,j),q.return=k,k=q)}return v(k);case w:e:{for(Se=j.key;D!==null;){if(D.key===Se)if(D.tag===4&&D.stateNode.containerInfo===j.containerInfo&&D.stateNode.implementation===j.implementation){a(k,D.sibling),q=d(D,j.children||[]),q.return=k,k=q;break e}else{a(k,D);break}else s(k,D);D=D.sibling}q=jh(j,k.mode,q),q.return=k,k=q}return v(k);case Z:return j=Xo(j),ft(k,D,j,q)}if(Ae(j))return ue(k,D,j,q);if(Ne(j)){if(Se=Ne(j),typeof Se!="function")throw Error(i(150));return j=Se.call(j),Oe(k,D,j,q)}if(typeof j.then=="function")return ft(k,D,HI(j),q);if(j.$$typeof===_)return ft(k,D,FI(k,j),q);KI(k,j)}return typeof j=="string"&&j!==""||typeof j=="number"||typeof j=="bigint"?(j=""+j,D!==null&&D.tag===6?(a(k,D.sibling),q=d(D,j),q.return=k,k=q):(a(k,D),q=_h(j,k.mode,q),q.return=k,k=q),v(k)):a(k,D)}return function(k,D,j,q){try{sA=0;var Se=ft(k,D,j,q);return Ir=null,Se}catch(ye){if(ye===Cr||ye===UI)throw ye;var it=Hn(29,ye,null,k.mode);return it.lanes=q,it.return=k,it}}}var qo=nE(!0),iE=nE(!1),Xg=!1;function Wh(g){g.updateQueue={baseState:g.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Qh(g,s){g=g.updateQueue,s.updateQueue===g&&(s.updateQueue={baseState:g.baseState,firstBaseUpdate:g.firstBaseUpdate,lastBaseUpdate:g.lastBaseUpdate,shared:g.shared,callbacks:null})}function $g(g){return{lane:g,tag:0,payload:null,callback:null,next:null}}function qg(g,s,a){var C=g.updateQueue;if(C===null)return null;if(C=C.shared,(rt&2)!==0){var d=C.pending;return d===null?s.next=s:(s.next=d.next,d.next=s),C.pending=s,s=BI(g),LS(g,null,a),s}return ZI(g,C,s,a),BI(g)}function aA(g,s,a){if(s=s.updateQueue,s!==null&&(s=s.shared,(a&4194048)!==0)){var C=s.lanes;C&=g.pendingLanes,a|=C,s.lanes=a,W2(g,a)}}function Xh(g,s){var a=g.updateQueue,C=g.alternate;if(C!==null&&(C=C.updateQueue,a===C)){var d=null,u=null;if(a=a.firstBaseUpdate,a!==null){do{var v={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};u===null?d=u=v:u=u.next=v,a=a.next}while(a!==null);u===null?d=u=s:u=u.next=s}else d=u=s;a={baseState:C.baseState,firstBaseUpdate:d,lastBaseUpdate:u,shared:C.shared,callbacks:C.callbacks},g.updateQueue=a;return}g=a.lastBaseUpdate,g===null?a.firstBaseUpdate=s:g.next=s,a.lastBaseUpdate=s}var $h=!1;function AA(){if($h){var g=Ar;if(g!==null)throw g}}function CA(g,s,a,C){$h=!1;var d=g.updateQueue;Xg=!1;var u=d.firstBaseUpdate,v=d.lastBaseUpdate,b=d.shared.pending;if(b!==null){d.shared.pending=null;var N=b,B=N.next;N.next=null,v===null?u=B:v.next=B,v=N;var X=g.alternate;X!==null&&(X=X.updateQueue,b=X.lastBaseUpdate,b!==v&&(b===null?X.firstBaseUpdate=B:b.next=B,X.lastBaseUpdate=N))}if(u!==null){var J=d.baseState;v=0,X=B=N=null,b=u;do{var G=b.lane&-536870913,Y=G!==b.lane;if(Y?(Qe&G)===G:(C&G)===G){G!==0&&G===ar&&($h=!0),X!==null&&(X=X.next={lane:0,tag:b.tag,payload:b.payload,callback:null,next:null});e:{var ue=g,Oe=b;G=s;var ft=a;switch(Oe.tag){case 1:if(ue=Oe.payload,typeof ue=="function"){J=ue.call(ft,J,G);break e}J=ue;break e;case 3:ue.flags=ue.flags&-65537|128;case 0:if(ue=Oe.payload,G=typeof ue=="function"?ue.call(ft,J,G):ue,G==null)break e;J=p({},J,G);break e;case 2:Xg=!0}}G=b.callback,G!==null&&(g.flags|=64,Y&&(g.flags|=8192),Y=d.callbacks,Y===null?d.callbacks=[G]:Y.push(G))}else Y={lane:G,tag:b.tag,payload:b.payload,callback:b.callback,next:null},X===null?(B=X=Y,N=J):X=X.next=Y,v|=G;if(b=b.next,b===null){if(b=d.shared.pending,b===null)break;Y=b,b=Y.next,Y.next=null,d.lastBaseUpdate=Y,d.shared.pending=null}}while(!0);X===null&&(N=J),d.baseState=N,d.firstBaseUpdate=B,d.lastBaseUpdate=X,u===null&&(d.shared.lanes=0),io|=v,g.lanes=v,g.memoizedState=J}}function gE(g,s){if(typeof g!="function")throw Error(i(191,g));g.call(s)}function oE(g,s){var a=g.callbacks;if(a!==null)for(g.callbacks=null,g=0;gu?u:8;var v=M.T,b={};M.T=b,ff(g,!1,s,a);try{var N=d(),B=M.S;if(B!==null&&B(b,N),N!==null&&typeof N=="object"&&typeof N.then=="function"){var X=mne(N,C);cA(g,s,X,$n(g))}else cA(g,s,C,$n(g))}catch(J){cA(g,s,{then:function(){},status:"rejected",reason:J},$n())}finally{W.p=u,v!==null&&b.types!==null&&(v.types=b.types),M.T=v}}function Sne(){}function uf(g,s,a,C){if(g.tag!==5)throw Error(i(476));var d=ZE(g).queue;jE(g,d,s,V,a===null?Sne:function(){return BE(g),a(C)})}function ZE(g){var s=g.memoizedState;if(s!==null)return s;s={memoizedState:V,baseState:V,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ig,lastRenderedState:V},next:null};var a={};return s.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ig,lastRenderedState:a},next:null},g.memoizedState=s,g=g.alternate,g!==null&&(g.memoizedState=s),s}function BE(g){var s=ZE(g);s.next===null&&(s=g.alternate.memoizedState),cA(g,s.next.queue,{},$n())}function hf(){return fn(DA)}function PE(){return Ht().memoizedState}function LE(){return Ht().memoizedState}function Ene(g){for(var s=g.return;s!==null;){switch(s.tag){case 24:case 3:var a=$n();g=$g(a);var C=qg(s,g,a);C!==null&&(Pn(C,s,a),aA(C,s,a)),s={cache:Uh()},g.payload=s;return}s=s.return}}function Tne(g,s,a){var C=$n();a={lane:C,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},il(g)?FE(s,a):(a=kh(g,s,a,C),a!==null&&(Pn(a,g,C),VE(a,s,C)))}function GE(g,s,a){var C=$n();cA(g,s,a,C)}function cA(g,s,a,C){var d={lane:C,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(il(g))FE(s,d);else{var u=g.alternate;if(g.lanes===0&&(u===null||u.lanes===0)&&(u=s.lastRenderedReducer,u!==null))try{var v=s.lastRenderedState,b=u(v,a);if(d.hasEagerState=!0,d.eagerState=b,Yn(b,v))return ZI(g,s,d,0),pt===null&&jI(),!1}catch{}if(a=kh(g,s,d,C),a!==null)return Pn(a,g,C),VE(a,s,C),!0}return!1}function ff(g,s,a,C){if(C={lane:2,revertLane:Qf(),gesture:null,action:C,hasEagerState:!1,eagerState:null,next:null},il(g)){if(s)throw Error(i(479))}else s=kh(g,a,C,2),s!==null&&Pn(s,g,2)}function il(g){var s=g.alternate;return g===Le||s!==null&&s===Le}function FE(g,s){cr=XI=!0;var a=g.pending;a===null?s.next=s:(s.next=a.next,a.next=s),g.pending=s}function VE(g,s,a){if((a&4194048)!==0){var C=s.lanes;C&=g.pendingLanes,a|=C,s.lanes=a,W2(g,a)}}var dA={readContext:fn,use:JI,useCallback:Bt,useContext:Bt,useEffect:Bt,useImperativeHandle:Bt,useLayoutEffect:Bt,useInsertionEffect:Bt,useMemo:Bt,useReducer:Bt,useRef:Bt,useState:Bt,useDebugValue:Bt,useDeferredValue:Bt,useTransition:Bt,useSyncExternalStore:Bt,useId:Bt,useHostTransitionStatus:Bt,useFormState:Bt,useActionState:Bt,useOptimistic:Bt,useMemoCache:Bt,useCacheRefresh:Bt};dA.useEffectEvent=Bt;var UE={readContext:fn,use:JI,useCallback:function(g,s){return On().memoizedState=[g,s===void 0?null:s],g},useContext:fn,useEffect:TE,useImperativeHandle:function(g,s,a){a=a!=null?a.concat([g]):null,tl(4194308,4,ME.bind(null,s,g),a)},useLayoutEffect:function(g,s){return tl(4194308,4,g,s)},useInsertionEffect:function(g,s){tl(4,2,g,s)},useMemo:function(g,s){var a=On();s=s===void 0?null:s;var C=g();if(Jo){Vg(!0);try{g()}finally{Vg(!1)}}return a.memoizedState=[C,s],C},useReducer:function(g,s,a){var C=On();if(a!==void 0){var d=a(s);if(Jo){Vg(!0);try{a(s)}finally{Vg(!1)}}}else d=s;return C.memoizedState=C.baseState=d,g={pending:null,lanes:0,dispatch:null,lastRenderedReducer:g,lastRenderedState:d},C.queue=g,g=g.dispatch=Tne.bind(null,Le,g),[C.memoizedState,g]},useRef:function(g){var s=On();return g={current:g},s.memoizedState=g},useState:function(g){g=Cf(g);var s=g.queue,a=GE.bind(null,Le,s);return s.dispatch=a,[g.memoizedState,a]},useDebugValue:cf,useDeferredValue:function(g,s){var a=On();return df(a,g,s)},useTransition:function(){var g=Cf(!1);return g=jE.bind(null,Le,g.queue,!0,!1),On().memoizedState=g,[!1,g]},useSyncExternalStore:function(g,s,a){var C=Le,d=On();if($e){if(a===void 0)throw Error(i(407));a=a()}else{if(a=s(),pt===null)throw Error(i(349));(Qe&127)!==0||IE(C,s,a)}d.memoizedState=a;var u={value:a,getSnapshot:s};return d.queue=u,TE(cE.bind(null,C,u,g),[g]),C.flags|=2048,ur(9,{destroy:void 0},lE.bind(null,C,u,a,s),null),a},useId:function(){var g=On(),s=pt.identifierPrefix;if($e){var a=Gi,C=Li;a=(C&~(1<<32-Un(C)-1)).toString(32)+a,s="_"+s+"R_"+a,a=$I++,0<\/script>",u=u.removeChild(u.firstChild);break;case"select":u=typeof C.is=="string"?v.createElement("select",{is:C.is}):v.createElement("select"),C.multiple?u.multiple=!0:C.size&&(u.size=C.size);break;default:u=typeof C.is=="string"?v.createElement(d,{is:C.is}):v.createElement(d)}}u[un]=s,u[kn]=C;e:for(v=s.child;v!==null;){if(v.tag===5||v.tag===6)u.appendChild(v.stateNode);else if(v.tag!==4&&v.tag!==27&&v.child!==null){v.child.return=v,v=v.child;continue}if(v===s)break e;for(;v.sibling===null;){if(v.return===null||v.return===s)break e;v=v.return}v.sibling.return=v.return,v=v.sibling}s.stateNode=u;e:switch(mn(u,d,C),d){case"button":case"input":case"select":case"textarea":C=!!C.autoFocus;break e;case"img":C=!0;break e;default:C=!1}C&&cg(s)}}return Tt(s),Mf(s,s.type,g===null?null:g.memoizedProps,s.pendingProps,a),null;case 6:if(g&&s.stateNode!=null)g.memoizedProps!==C&&cg(s);else{if(typeof C!="string"&&s.stateNode===null)throw Error(i(166));if(g=me.current,sr(s)){if(g=s.stateNode,a=s.memoizedProps,C=null,d=hn,d!==null)switch(d.tag){case 27:case 5:C=d.memoizedProps}g[un]=s,g=!!(g.nodeValue===a||C!==null&&C.suppressHydrationWarning===!0||AO(g.nodeValue,a)),g||Wg(s,!0)}else g=wl(g).createTextNode(C),g[un]=s,s.stateNode=g}return Tt(s),null;case 31:if(a=s.memoizedState,g===null||g.memoizedState!==null){if(C=sr(s),a!==null){if(g===null){if(!C)throw Error(i(318));if(g=s.memoizedState,g=g!==null?g.dehydrated:null,!g)throw Error(i(557));g[un]=s}else Ho(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;Tt(s),g=!1}else a=Lh(),g!==null&&g.memoizedState!==null&&(g.memoizedState.hydrationErrors=a),g=!0;if(!g)return s.flags&256?(Wn(s),s):(Wn(s),null);if((s.flags&128)!==0)throw Error(i(558))}return Tt(s),null;case 13:if(C=s.memoizedState,g===null||g.memoizedState!==null&&g.memoizedState.dehydrated!==null){if(d=sr(s),C!==null&&C.dehydrated!==null){if(g===null){if(!d)throw Error(i(318));if(d=s.memoizedState,d=d!==null?d.dehydrated:null,!d)throw Error(i(317));d[un]=s}else Ho(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;Tt(s),d=!1}else d=Lh(),g!==null&&g.memoizedState!==null&&(g.memoizedState.hydrationErrors=d),d=!0;if(!d)return s.flags&256?(Wn(s),s):(Wn(s),null)}return Wn(s),(s.flags&128)!==0?(s.lanes=a,s):(a=C!==null,g=g!==null&&g.memoizedState!==null,a&&(C=s.child,d=null,C.alternate!==null&&C.alternate.memoizedState!==null&&C.alternate.memoizedState.cachePool!==null&&(d=C.alternate.memoizedState.cachePool.pool),u=null,C.memoizedState!==null&&C.memoizedState.cachePool!==null&&(u=C.memoizedState.cachePool.pool),u!==d&&(C.flags|=2048)),a!==g&&a&&(s.child.flags|=8192),al(s,s.updateQueue),Tt(s),null);case 4:return ze(),g===null&&Jf(s.stateNode.containerInfo),Tt(s),null;case 10:return Ag(s.type),Tt(s),null;case 19:if(U(Yt),C=s.memoizedState,C===null)return Tt(s),null;if(d=(s.flags&128)!==0,u=C.rendering,u===null)if(d)hA(C,!1);else{if(Pt!==0||g!==null&&(g.flags&128)!==0)for(g=s.child;g!==null;){if(u=QI(g),u!==null){for(s.flags|=128,hA(C,!1),g=u.updateQueue,s.updateQueue=g,al(s,g),s.subtreeFlags=0,g=a,a=s.child;a!==null;)GS(a,g),a=a.sibling;return te(Yt,Yt.current&1|2),$e&&rg(s,C.treeForkCount),s.child}g=g.sibling}C.tail!==null&&He()>cl&&(s.flags|=128,d=!0,hA(C,!1),s.lanes=4194304)}else{if(!d)if(g=QI(u),g!==null){if(s.flags|=128,d=!0,g=g.updateQueue,s.updateQueue=g,al(s,g),hA(C,!0),C.tail===null&&C.tailMode==="hidden"&&!u.alternate&&!$e)return Tt(s),null}else 2*He()-C.renderingStartTime>cl&&a!==536870912&&(s.flags|=128,d=!0,hA(C,!1),s.lanes=4194304);C.isBackwards?(u.sibling=s.child,s.child=u):(g=C.last,g!==null?g.sibling=u:s.child=u,C.last=u)}return C.tail!==null?(g=C.tail,C.rendering=g,C.tail=g.sibling,C.renderingStartTime=He(),g.sibling=null,a=Yt.current,te(Yt,d?a&1|2:a&1),$e&&rg(s,C.treeForkCount),g):(Tt(s),null);case 22:case 23:return Wn(s),Jh(),C=s.memoizedState!==null,g!==null?g.memoizedState!==null!==C&&(s.flags|=8192):C&&(s.flags|=8192),C?(a&536870912)!==0&&(s.flags&128)===0&&(Tt(s),s.subtreeFlags&6&&(s.flags|=8192)):Tt(s),a=s.updateQueue,a!==null&&al(s,a.retryQueue),a=null,g!==null&&g.memoizedState!==null&&g.memoizedState.cachePool!==null&&(a=g.memoizedState.cachePool.pool),C=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(C=s.memoizedState.cachePool.pool),C!==a&&(s.flags|=2048),g!==null&&U(Qo),null;case 24:return a=null,g!==null&&(a=g.memoizedState.cache),s.memoizedState.cache!==a&&(s.flags|=2048),Ag(qt),Tt(s),null;case 25:return null;case 30:return null}throw Error(i(156,s.tag))}function zne(g,s){switch(Bh(s),s.tag){case 1:return g=s.flags,g&65536?(s.flags=g&-65537|128,s):null;case 3:return Ag(qt),ze(),g=s.flags,(g&65536)!==0&&(g&128)===0?(s.flags=g&-65537|128,s):null;case 26:case 27:case 5:return z(s),null;case 31:if(s.memoizedState!==null){if(Wn(s),s.alternate===null)throw Error(i(340));Ho()}return g=s.flags,g&65536?(s.flags=g&-65537|128,s):null;case 13:if(Wn(s),g=s.memoizedState,g!==null&&g.dehydrated!==null){if(s.alternate===null)throw Error(i(340));Ho()}return g=s.flags,g&65536?(s.flags=g&-65537|128,s):null;case 19:return U(Yt),null;case 4:return ze(),null;case 10:return Ag(s.type),null;case 22:case 23:return Wn(s),Jh(),g!==null&&U(Qo),g=s.flags,g&65536?(s.flags=g&-65537|128,s):null;case 24:return Ag(qt),null;case 25:return null;default:return null}}function dT(g,s){switch(Bh(s),s.tag){case 3:Ag(qt),ze();break;case 26:case 27:case 5:z(s);break;case 4:ze();break;case 31:s.memoizedState!==null&&Wn(s);break;case 13:Wn(s);break;case 19:U(Yt);break;case 10:Ag(s.type);break;case 22:case 23:Wn(s),Jh(),g!==null&&U(Qo);break;case 24:Ag(qt)}}function fA(g,s){try{var a=s.updateQueue,C=a!==null?a.lastEffect:null;if(C!==null){var d=C.next;a=d;do{if((a.tag&g)===g){C=void 0;var u=a.create,v=a.inst;C=u(),v.destroy=C}a=a.next}while(a!==d)}}catch(b){lt(s,s.return,b)}}function to(g,s,a){try{var C=s.updateQueue,d=C!==null?C.lastEffect:null;if(d!==null){var u=d.next;C=u;do{if((C.tag&g)===g){var v=C.inst,b=v.destroy;if(b!==void 0){v.destroy=void 0,d=s;var N=a,B=b;try{B()}catch(X){lt(d,N,X)}}}C=C.next}while(C!==u)}}catch(X){lt(s,s.return,X)}}function uT(g){var s=g.updateQueue;if(s!==null){var a=g.stateNode;try{oE(s,a)}catch(C){lt(g,g.return,C)}}}function hT(g,s,a){a.props=es(g.type,g.memoizedProps),a.state=g.memoizedState;try{a.componentWillUnmount()}catch(C){lt(g,s,C)}}function pA(g,s){try{var a=g.ref;if(a!==null){switch(g.tag){case 26:case 27:case 5:var C=g.stateNode;break;case 30:C=g.stateNode;break;default:C=g.stateNode}typeof a=="function"?g.refCleanup=a(C):a.current=C}}catch(d){lt(g,s,d)}}function Fi(g,s){var a=g.ref,C=g.refCleanup;if(a!==null)if(typeof C=="function")try{C()}catch(d){lt(g,s,d)}finally{g.refCleanup=null,g=g.alternate,g!=null&&(g.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(d){lt(g,s,d)}else a.current=null}function fT(g){var s=g.type,a=g.memoizedProps,C=g.stateNode;try{e:switch(s){case"button":case"input":case"select":case"textarea":a.autoFocus&&C.focus();break e;case"img":a.src?C.src=a.src:a.srcSet&&(C.srcset=a.srcSet)}}catch(d){lt(g,g.return,d)}}function zf(g,s,a){try{var C=g.stateNode;eie(C,g.type,a,s),C[kn]=s}catch(d){lt(g,g.return,d)}}function pT(g){return g.tag===5||g.tag===3||g.tag===26||g.tag===27&&ao(g.type)||g.tag===4}function kf(g){e:for(;;){for(;g.sibling===null;){if(g.return===null||pT(g.return))return null;g=g.return}for(g.sibling.return=g.return,g=g.sibling;g.tag!==5&&g.tag!==6&&g.tag!==18;){if(g.tag===27&&ao(g.type)||g.flags&2||g.child===null||g.tag===4)continue e;g.child.return=g,g=g.child}if(!(g.flags&2))return g.stateNode}}function Rf(g,s,a){var C=g.tag;if(C===5||C===6)g=g.stateNode,s?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(g,s):(s=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,s.appendChild(g),a=a._reactRootContainer,a!=null||s.onclick!==null||(s.onclick=gg));else if(C!==4&&(C===27&&ao(g.type)&&(a=g.stateNode,s=null),g=g.child,g!==null))for(Rf(g,s,a),g=g.sibling;g!==null;)Rf(g,s,a),g=g.sibling}function Al(g,s,a){var C=g.tag;if(C===5||C===6)g=g.stateNode,s?a.insertBefore(g,s):a.appendChild(g);else if(C!==4&&(C===27&&ao(g.type)&&(a=g.stateNode),g=g.child,g!==null))for(Al(g,s,a),g=g.sibling;g!==null;)Al(g,s,a),g=g.sibling}function mT(g){var s=g.stateNode,a=g.memoizedProps;try{for(var C=g.type,d=s.attributes;d.length;)s.removeAttributeNode(d[0]);mn(s,C,a),s[un]=g,s[kn]=a}catch(u){lt(g,g.return,u)}}var dg=!1,tn=!1,_f=!1,vT=typeof WeakSet=="function"?WeakSet:Set,Cn=null;function kne(g,s){if(g=g.containerInfo,np=Dl,g=zS(g),Th(g)){if("selectionStart"in g)var a={start:g.selectionStart,end:g.selectionEnd};else e:{a=(a=g.ownerDocument)&&a.defaultView||window;var C=a.getSelection&&a.getSelection();if(C&&C.rangeCount!==0){a=C.anchorNode;var d=C.anchorOffset,u=C.focusNode;C=C.focusOffset;try{a.nodeType,u.nodeType}catch{a=null;break e}var v=0,b=-1,N=-1,B=0,X=0,J=g,G=null;t:for(;;){for(var Y;J!==a||d!==0&&J.nodeType!==3||(b=v+d),J!==u||C!==0&&J.nodeType!==3||(N=v+C),J.nodeType===3&&(v+=J.nodeValue.length),(Y=J.firstChild)!==null;)G=J,J=Y;for(;;){if(J===g)break t;if(G===a&&++B===d&&(b=v),G===u&&++X===C&&(N=v),(Y=J.nextSibling)!==null)break;J=G,G=J.parentNode}J=Y}a=b===-1||N===-1?null:{start:b,end:N}}else a=null}a=a||{start:0,end:0}}else a=null;for(ip={focusedElem:g,selectionRange:a},Dl=!1,Cn=s;Cn!==null;)if(s=Cn,g=s.child,(s.subtreeFlags&1028)!==0&&g!==null)g.return=s,Cn=g;else for(;Cn!==null;){switch(s=Cn,u=s.alternate,g=s.flags,s.tag){case 0:if((g&4)!==0&&(g=s.updateQueue,g=g!==null?g.events:null,g!==null))for(a=0;a title"))),mn(u,C,a),u[un]=g,An(u),C=u;break e;case"link":var v=EO("link","href",d).get(C+(a.href||""));if(v){for(var b=0;bft&&(v=ft,ft=Oe,Oe=v);var k=DS(b,Oe),D=DS(b,ft);if(k&&D&&(Y.rangeCount!==1||Y.anchorNode!==k.node||Y.anchorOffset!==k.offset||Y.focusNode!==D.node||Y.focusOffset!==D.offset)){var j=J.createRange();j.setStart(k.node,k.offset),Y.removeAllRanges(),Oe>ft?(Y.addRange(j),Y.extend(D.node,D.offset)):(j.setEnd(D.node,D.offset),Y.addRange(j))}}}}for(J=[],Y=b;Y=Y.parentNode;)Y.nodeType===1&&J.push({element:Y,left:Y.scrollLeft,top:Y.scrollTop});for(typeof b.focus=="function"&&b.focus(),b=0;ba?32:a,M.T=null,a=Ff,Ff=null;var u=oo,v=mg;if(sn=0,vr=oo=null,mg=0,(rt&6)!==0)throw Error(i(331));var b=rt;if(rt|=4,MT(u.current),OT(u,u.current,v,a),rt=b,xA(0,!1),Vn&&typeof Vn.onPostCommitFiberRoot=="function")try{Vn.onPostCommitFiberRoot(Fa,u)}catch{}return!0}finally{W.p=d,M.T=C,QT(g,s)}}function $T(g,s,a){s=ai(a,s),s=yf(g.stateNode,s,2),g=qg(g,s,2),g!==null&&(Ua(g,2),Vi(g))}function lt(g,s,a){if(g.tag===3)$T(g,g,a);else for(;s!==null;){if(s.tag===3){$T(s,g,a);break}else if(s.tag===1){var C=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof C.componentDidCatch=="function"&&(go===null||!go.has(C))){g=ai(a,g),a=qE(2),C=qg(s,a,2),C!==null&&(JE(a,C,s,g),Ua(C,2),Vi(C));break}}s=s.return}}function Hf(g,s,a){var C=g.pingCache;if(C===null){C=g.pingCache=new jne;var d=new Set;C.set(s,d)}else d=C.get(s),d===void 0&&(d=new Set,C.set(s,d));d.has(a)||(Bf=!0,d.add(a),g=Gne.bind(null,g,s,a),s.then(g,g))}function Gne(g,s,a){var C=g.pingCache;C!==null&&C.delete(s),g.pingedLanes|=g.suspendedLanes&a,g.warmLanes&=~a,pt===g&&(Qe&a)===a&&(Pt===4||Pt===3&&(Qe&62914560)===Qe&&300>He()-ll?(rt&2)===0&&yr(g,0):Pf|=a,mr===Qe&&(mr=0)),Vi(g)}function qT(g,s){s===0&&(s=H2()),g=Uo(g,s),g!==null&&(Ua(g,s),Vi(g))}function Fne(g){var s=g.memoizedState,a=0;s!==null&&(a=s.retryLane),qT(g,a)}function Vne(g,s){var a=0;switch(g.tag){case 31:case 13:var C=g.stateNode,d=g.memoizedState;d!==null&&(a=d.retryLane);break;case 19:C=g.stateNode;break;case 22:C=g.stateNode._retryCache;break;default:throw Error(i(314))}C!==null&&C.delete(s),qT(g,a)}function Une(g,s){return R(g,s)}var ml=null,wr=null,Kf=!1,vl=!1,Wf=!1,ro=0;function Vi(g){g!==wr&&g.next===null&&(wr===null?ml=wr=g:wr=wr.next=g),vl=!0,Kf||(Kf=!0,Hne())}function xA(g,s){if(!Wf&&vl){Wf=!0;do for(var a=!1,C=ml;C!==null;){if(g!==0){var d=C.pendingLanes;if(d===0)var u=0;else{var v=C.suspendedLanes,b=C.pingedLanes;u=(1<<31-Un(42|g)+1)-1,u&=d&~(v&~b),u=u&201326741?u&201326741|1:u?u|2:0}u!==0&&(a=!0,nO(C,u))}else u=Qe,u=xI(C,C===pt?u:0,C.cancelPendingCommit!==null||C.timeoutHandle!==-1),(u&3)===0||Va(C,u)||(a=!0,nO(C,u));C=C.next}while(a);Wf=!1}}function Yne(){JT()}function JT(){vl=Kf=!1;var g=0;ro!==0&&nie()&&(g=ro);for(var s=He(),a=null,C=ml;C!==null;){var d=C.next,u=eO(C,s);u===0?(C.next=null,a===null?ml=d:a.next=d,d===null&&(wr=a)):(a=C,(g!==0||(u&3)!==0)&&(vl=!0)),C=d}sn!==0&&sn!==5||xA(g),ro!==0&&(ro=0)}function eO(g,s){for(var a=g.suspendedLanes,C=g.pingedLanes,d=g.expirationTimes,u=g.pendingLanes&-62914561;0b)break;var X=N.transferSize,J=N.initiatorType;X&&CO(J)&&(N=N.responseEnd,v+=X*(N"u"?null:document;function bO(g,s,a){var C=xr;if(C&&typeof s=="string"&&s){var d=si(s);d='link[rel="'+g+'"][href="'+d+'"]',typeof a=="string"&&(d+='[crossorigin="'+a+'"]'),yO.has(d)||(yO.add(d),g={rel:g,crossOrigin:a,href:s},C.querySelector(d)===null&&(s=C.createElement("link"),mn(s,"link",g),An(s),C.head.appendChild(s)))}}function Iie(g){vg.D(g),bO("dns-prefetch",g,null)}function lie(g,s){vg.C(g,s),bO("preconnect",g,s)}function cie(g,s,a){vg.L(g,s,a);var C=xr;if(C&&g&&s){var d='link[rel="preload"][as="'+si(s)+'"]';s==="image"&&a&&a.imageSrcSet?(d+='[imagesrcset="'+si(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(d+='[imagesizes="'+si(a.imageSizes)+'"]')):d+='[href="'+si(g)+'"]';var u=d;switch(s){case"style":u=Sr(g);break;case"script":u=Er(g)}di.has(u)||(g=p({rel:"preload",href:s==="image"&&a&&a.imageSrcSet?void 0:g,as:s},a),di.set(u,g),C.querySelector(d)!==null||s==="style"&&C.querySelector(OA(u))||s==="script"&&C.querySelector(NA(u))||(s=C.createElement("link"),mn(s,"link",g),An(s),C.head.appendChild(s)))}}function die(g,s){vg.m(g,s);var a=xr;if(a&&g){var C=s&&typeof s.as=="string"?s.as:"script",d='link[rel="modulepreload"][as="'+si(C)+'"][href="'+si(g)+'"]',u=d;switch(C){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":u=Er(g)}if(!di.has(u)&&(g=p({rel:"modulepreload",href:g},s),di.set(u,g),a.querySelector(d)===null)){switch(C){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(NA(u)))return}C=a.createElement("link"),mn(C,"link",g),An(C),a.head.appendChild(C)}}}function uie(g,s,a){vg.S(g,s,a);var C=xr;if(C&&g){var d=Ks(C).hoistableStyles,u=Sr(g);s=s||"default";var v=d.get(u);if(!v){var b={loading:0,preload:null};if(v=C.querySelector(OA(u)))b.loading=5;else{g=p({rel:"stylesheet",href:g,"data-precedence":s},a),(a=di.get(u))&&Cp(g,a);var N=v=C.createElement("link");An(N),mn(N,"link",g),N._p=new Promise(function(B,X){N.onload=B,N.onerror=X}),N.addEventListener("load",function(){b.loading|=1}),N.addEventListener("error",function(){b.loading|=2}),b.loading|=4,Sl(v,s,C)}v={type:"stylesheet",instance:v,count:1,state:b},d.set(u,v)}}}function hie(g,s){vg.X(g,s);var a=xr;if(a&&g){var C=Ks(a).hoistableScripts,d=Er(g),u=C.get(d);u||(u=a.querySelector(NA(d)),u||(g=p({src:g,async:!0},s),(s=di.get(d))&&Ip(g,s),u=a.createElement("script"),An(u),mn(u,"link",g),a.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},C.set(d,u))}}function fie(g,s){vg.M(g,s);var a=xr;if(a&&g){var C=Ks(a).hoistableScripts,d=Er(g),u=C.get(d);u||(u=a.querySelector(NA(d)),u||(g=p({src:g,async:!0,type:"module"},s),(s=di.get(d))&&Ip(g,s),u=a.createElement("script"),An(u),mn(u,"link",g),a.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},C.set(d,u))}}function wO(g,s,a,C){var d=(d=me.current)?xl(d):null;if(!d)throw Error(i(446));switch(g){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(s=Sr(a.href),a=Ks(d).hoistableStyles,C=a.get(s),C||(C={type:"style",instance:null,count:0,state:null},a.set(s,C)),C):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){g=Sr(a.href);var u=Ks(d).hoistableStyles,v=u.get(g);if(v||(d=d.ownerDocument||d,v={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},u.set(g,v),(u=d.querySelector(OA(g)))&&!u._p&&(v.instance=u,v.state.loading=5),di.has(g)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},di.set(g,a),u||pie(d,g,a,v.state))),s&&C===null)throw Error(i(528,""));return v}if(s&&C!==null)throw Error(i(529,""));return null;case"script":return s=a.async,a=a.src,typeof a=="string"&&s&&typeof s!="function"&&typeof s!="symbol"?(s=Er(a),a=Ks(d).hoistableScripts,C=a.get(s),C||(C={type:"script",instance:null,count:0,state:null},a.set(s,C)),C):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,g))}}function Sr(g){return'href="'+si(g)+'"'}function OA(g){return'link[rel="stylesheet"]['+g+"]"}function xO(g){return p({},g,{"data-precedence":g.precedence,precedence:null})}function pie(g,s,a,C){g.querySelector('link[rel="preload"][as="style"]['+s+"]")?C.loading=1:(s=g.createElement("link"),C.preload=s,s.addEventListener("load",function(){return C.loading|=1}),s.addEventListener("error",function(){return C.loading|=2}),mn(s,"link",a),An(s),g.head.appendChild(s))}function Er(g){return'[src="'+si(g)+'"]'}function NA(g){return"script[async]"+g}function SO(g,s,a){if(s.count++,s.instance===null)switch(s.type){case"style":var C=g.querySelector('style[data-href~="'+si(a.href)+'"]');if(C)return s.instance=C,An(C),C;var d=p({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return C=(g.ownerDocument||g).createElement("style"),An(C),mn(C,"style",d),Sl(C,a.precedence,g),s.instance=C;case"stylesheet":d=Sr(a.href);var u=g.querySelector(OA(d));if(u)return s.state.loading|=4,s.instance=u,An(u),u;C=xO(a),(d=di.get(d))&&Cp(C,d),u=(g.ownerDocument||g).createElement("link"),An(u);var v=u;return v._p=new Promise(function(b,N){v.onload=b,v.onerror=N}),mn(u,"link",C),s.state.loading|=4,Sl(u,a.precedence,g),s.instance=u;case"script":return u=Er(a.src),(d=g.querySelector(NA(u)))?(s.instance=d,An(d),d):(C=a,(d=di.get(u))&&(C=p({},a),Ip(C,d)),g=g.ownerDocument||g,d=g.createElement("script"),An(d),mn(d,"link",C),g.head.appendChild(d),s.instance=d);case"void":return null;default:throw Error(i(443,s.type))}else s.type==="stylesheet"&&(s.state.loading&4)===0&&(C=s.instance,s.state.loading|=4,Sl(C,a.precedence,g));return s.instance}function Sl(g,s,a){for(var C=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),d=C.length?C[C.length-1]:null,u=d,v=0;v title"):null)}function mie(g,s,a){if(a===1||s.itemProp!=null)return!1;switch(g){case"meta":case"title":return!0;case"style":if(typeof s.precedence!="string"||typeof s.href!="string"||s.href==="")break;return!0;case"link":if(typeof s.rel!="string"||typeof s.href!="string"||s.href===""||s.onLoad||s.onError)break;return s.rel==="stylesheet"?(g=s.disabled,typeof s.precedence=="string"&&g==null):!0;case"script":if(s.async&&typeof s.async!="function"&&typeof s.async!="symbol"&&!s.onLoad&&!s.onError&&s.src&&typeof s.src=="string")return!0}return!1}function OO(g){return!(g.type==="stylesheet"&&(g.state.loading&3)===0)}function vie(g,s,a,C){if(a.type==="stylesheet"&&(typeof C.media!="string"||matchMedia(C.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var d=Sr(C.href),u=s.querySelector(OA(d));if(u){s=u._p,s!==null&&typeof s=="object"&&typeof s.then=="function"&&(g.count++,g=Tl.bind(g),s.then(g,g)),a.state.loading|=4,a.instance=u,An(u);return}u=s.ownerDocument||s,C=xO(C),(d=di.get(d))&&Cp(C,d),u=u.createElement("link"),An(u);var v=u;v._p=new Promise(function(b,N){v.onload=b,v.onerror=N}),mn(u,"link",C),a.instance=u}g.stylesheets===null&&(g.stylesheets=new Map),g.stylesheets.set(a,s),(s=a.state.preload)&&(a.state.loading&3)===0&&(g.count++,a=Tl.bind(g),s.addEventListener("load",a),s.addEventListener("error",a))}}var lp=0;function yie(g,s){return g.stylesheets&&g.count===0&&Nl(g,g.stylesheets),0lp?50:800)+s);return g.unsuspend=a,function(){g.unsuspend=null,clearTimeout(C),clearTimeout(d)}}:null}function Tl(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Nl(this,this.stylesheets);else if(this.unsuspend){var g=this.unsuspend;this.unsuspend=null,g()}}}var Ol=null;function Nl(g,s){g.stylesheets=null,g.unsuspend!==null&&(g.count++,Ol=new Map,s.forEach(bie,g),Ol=null,Tl.call(g))}function bie(g,s){if(!(s.state.loading&4)){var a=Ol.get(g);if(a)var C=a.get(null);else{a=new Map,Ol.set(g,a);for(var d=g.querySelectorAll("link[data-precedence],style[data-precedence]"),u=0;u"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}return n(),Bl.exports=$O(),Bl.exports}var JO=qO(),Np;function $(n,e,t){function i(I,l){if(I._zod||Object.defineProperty(I,"_zod",{value:{def:l,constr:A,traits:new Set},enumerable:!1}),I._zod.traits.has(n))return;I._zod.traits.add(n),e(I,l);const c=A.prototype,h=Object.keys(c);for(let p=0;pt?.Parent&&I instanceof t.Parent?!0:I?._zod?.traits?.has(n)}),Object.defineProperty(A,"name",{value:n}),A}class is extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Dp extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}(Np=globalThis).__zod_globalConfig??(Np.__zod_globalConfig={});const Ul=globalThis.__zod_globalConfig;function Ui(n){return Ul}function Mp(n){const e=Object.values(n).filter(i=>typeof i=="number");return Object.entries(n).filter(([i,o])=>e.indexOf(+i)===-1).map(([i,o])=>o)}function Yl(n,e){return typeof e=="bigint"?e.toString():e}function RA(n){return{get value(){{const e=n();return Object.defineProperty(this,"value",{value:e}),e}}}}function Hl(n){return n==null}function Kl(n){const e=n.startsWith("^")?1:0,t=n.endsWith("$")?n.length-1:n.length;return n.slice(e,t)}function eN(n,e){const t=n/e,i=Math.round(t),o=Number.EPSILON*Math.max(Math.abs(t),1);return Math.abs(t-i){};function Dr(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}const nN=RA(()=>{if(Ul.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const n=Function;return new n(""),!0}catch{return!1}});function gs(n){if(Dr(n)===!1)return!1;const e=n.constructor;if(e===void 0||typeof e!="function")return!0;const t=e.prototype;return!(Dr(t)===!1||Object.prototype.hasOwnProperty.call(t,"isPrototypeOf")===!1)}function _p(n){return gs(n)?{...n}:Array.isArray(n)?[...n]:n instanceof Map?new Map(n):n instanceof Set?new Set(n):n}const iN=new Set(["string","number","symbol"]);function os(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function bg(n,e,t){const i=new n._zod.constr(e??n._zod.def);return(!e||t?.parent)&&(i._zod.parent=n),i}function be(n){const e=n;if(!e)return{};if(typeof e=="string")return{error:()=>e};if(e?.message!==void 0){if(e?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function gN(n){return Object.keys(n).filter(e=>n[e]._zod.optin==="optional"&&n[e]._zod.optout==="optional")}const oN={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function sN(n,e){const t=n._zod.def,i=t.checks;if(i&&i.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const r=yg(n._zod.def,{get shape(){const A={};for(const I in e){if(!(I in t.shape))throw new Error(`Unrecognized key: "${I}"`);e[I]&&(A[I]=t.shape[I])}return uo(this,"shape",A),A},checks:[]});return bg(n,r)}function rN(n,e){const t=n._zod.def,i=t.checks;if(i&&i.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const r=yg(n._zod.def,{get shape(){const A={...n._zod.def.shape};for(const I in e){if(!(I in t.shape))throw new Error(`Unrecognized key: "${I}"`);e[I]&&delete A[I]}return uo(this,"shape",A),A},checks:[]});return bg(n,r)}function aN(n,e){if(!gs(e))throw new Error("Invalid input to extend: expected a plain object");const t=n._zod.def.checks;if(t&&t.length>0){const r=n._zod.def.shape;for(const A in e)if(Object.getOwnPropertyDescriptor(r,A)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const o=yg(n._zod.def,{get shape(){const r={...n._zod.def.shape,...e};return uo(this,"shape",r),r}});return bg(n,o)}function AN(n,e){if(!gs(e))throw new Error("Invalid input to safeExtend: expected a plain object");const t=yg(n._zod.def,{get shape(){const i={...n._zod.def.shape,...e};return uo(this,"shape",i),i}});return bg(n,t)}function CN(n,e){if(n._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");const t=yg(n._zod.def,{get shape(){const i={...n._zod.def.shape,...e._zod.def.shape};return uo(this,"shape",i),i},get catchall(){return e._zod.def.catchall},checks:e._zod.def.checks??[]});return bg(n,t)}function IN(n,e,t){const o=e._zod.def.checks;if(o&&o.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const A=yg(e._zod.def,{get shape(){const I=e._zod.def.shape,l={...I};if(t)for(const c in t){if(!(c in I))throw new Error(`Unrecognized key: "${c}"`);t[c]&&(l[c]=n?new n({type:"optional",innerType:I[c]}):I[c])}else for(const c in I)l[c]=n?new n({type:"optional",innerType:I[c]}):I[c];return uo(this,"shape",l),l},checks:[]});return bg(e,A)}function lN(n,e,t){const i=yg(e._zod.def,{get shape(){const o=e._zod.def.shape,r={...o};if(t)for(const A in t){if(!(A in r))throw new Error(`Unrecognized key: "${A}"`);t[A]&&(r[A]=new n({type:"nonoptional",innerType:o[A]}))}else for(const A in o)r[A]=new n({type:"nonoptional",innerType:o[A]});return uo(this,"shape",r),r}});return bg(e,i)}function ss(n,e=0){if(n.aborted===!0)return!0;for(let t=e;t{var i;return(i=t).path??(i.path=[]),t.path.unshift(n),t})}function _A(n){return typeof n=="string"?n:n?.message}function Yi(n,e,t){const i=n.message?n.message:_A(n.inst?._zod.def?.error?.(n))??_A(e?.error?.(n))??_A(t.customError?.(n))??_A(t.localeError?.(n))??"Invalid input",{inst:o,continue:r,input:A,...I}=n;return I.path??(I.path=[]),I.message=i,e?.reportInput&&(I.input=A),I}function Wl(n){return Array.isArray(n)?"array":typeof n=="string"?"string":"unknown"}function Mr(...n){const[e,t,i]=n;return typeof e=="string"?{message:e,code:"custom",input:t,inst:i}:{...e}}const jp=(n,e)=>{n.name="$ZodError",Object.defineProperty(n,"_zod",{value:n._zod,enumerable:!1}),Object.defineProperty(n,"issues",{value:e,enumerable:!1}),n.message=JSON.stringify(e,Yl,2),Object.defineProperty(n,"toString",{value:()=>n.message,enumerable:!1})},Zp=$("$ZodError",jp),Bp=$("$ZodError",jp,{Parent:Error});function dN(n,e=t=>t.message){const t={},i=[];for(const o of n.issues)o.path.length>0?(t[o.path[0]]=t[o.path[0]]||[],t[o.path[0]].push(e(o))):i.push(e(o));return{formErrors:i,fieldErrors:t}}function uN(n,e=t=>t.message){const t={_errors:[]},i=(o,r=[])=>{for(const A of o.issues)if(A.code==="invalid_union"&&A.errors.length)A.errors.map(I=>i({issues:I},[...r,...A.path]));else if(A.code==="invalid_key")i({issues:A.issues},[...r,...A.path]);else if(A.code==="invalid_element")i({issues:A.issues},[...r,...A.path]);else{const I=[...r,...A.path];if(I.length===0)t._errors.push(e(A));else{let l=t,c=0;for(;c(e,t,i,o)=>{const r=i?{...i,async:!1}:{async:!1},A=e._zod.run({value:t,issues:[]},r);if(A instanceof Promise)throw new is;if(A.issues.length){const I=new(o?.Err??n)(A.issues.map(l=>Yi(l,r,Ui())));throw Rp(I,o?.callee),I}return A.value},Xl=n=>async(e,t,i,o)=>{const r=i?{...i,async:!0}:{async:!0};let A=e._zod.run({value:t,issues:[]},r);if(A instanceof Promise&&(A=await A),A.issues.length){const I=new(o?.Err??n)(A.issues.map(l=>Yi(l,r,Ui())));throw Rp(I,o?.callee),I}return A.value},jA=n=>(e,t,i)=>{const o=i?{...i,async:!1}:{async:!1},r=e._zod.run({value:t,issues:[]},o);if(r instanceof Promise)throw new is;return r.issues.length?{success:!1,error:new(n??Zp)(r.issues.map(A=>Yi(A,o,Ui())))}:{success:!0,data:r.value}},hN=jA(Bp),ZA=n=>async(e,t,i)=>{const o=i?{...i,async:!0}:{async:!0};let r=e._zod.run({value:t,issues:[]},o);return r instanceof Promise&&(r=await r),r.issues.length?{success:!1,error:new n(r.issues.map(A=>Yi(A,o,Ui())))}:{success:!0,data:r.value}},fN=ZA(Bp),pN=n=>(e,t,i)=>{const o=i?{...i,direction:"backward"}:{direction:"backward"};return Ql(n)(e,t,o)},mN=n=>(e,t,i)=>Ql(n)(e,t,i),vN=n=>async(e,t,i)=>{const o=i?{...i,direction:"backward"}:{direction:"backward"};return Xl(n)(e,t,o)},yN=n=>async(e,t,i)=>Xl(n)(e,t,i),bN=n=>(e,t,i)=>{const o=i?{...i,direction:"backward"}:{direction:"backward"};return jA(n)(e,t,o)},wN=n=>(e,t,i)=>jA(n)(e,t,i),xN=n=>async(e,t,i)=>{const o=i?{...i,direction:"backward"}:{direction:"backward"};return ZA(n)(e,t,o)},SN=n=>async(e,t,i)=>ZA(n)(e,t,i),EN=/^[cC][0-9a-z]{6,}$/,TN=/^[0-9a-z]+$/,ON=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,NN=/^[0-9a-vA-V]{20}$/,DN=/^[A-Za-z0-9]{27}$/,MN=/^[a-zA-Z0-9_-]{21}$/,zN=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,kN=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Pp=n=>n?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${n}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,RN=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,_N="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function jN(){return new RegExp(_N,"u")}const ZN=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,BN=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,PN=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,LN=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,GN=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Lp=/^[A-Za-z0-9_-]*$/,FN=/^https?$/,VN=/^\+[1-9]\d{6,14}$/,Gp="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",UN=new RegExp(`^${Gp}$`);function Fp(n){const e="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof n.precision=="number"?n.precision===-1?`${e}`:n.precision===0?`${e}:[0-5]\\d`:`${e}:[0-5]\\d\\.\\d{${n.precision}}`:`${e}(?::[0-5]\\d(?:\\.\\d+)?)?`}function YN(n){return new RegExp(`^${Fp(n)}$`)}function HN(n){const e=Fp({precision:n.precision}),t=["Z"];n.local&&t.push(""),n.offset&&t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const i=`${e}(?:${t.join("|")})`;return new RegExp(`^${Gp}T(?:${i})$`)}const KN=n=>{const e=n?`[\\s\\S]{${n?.minimum??0},${n?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)},WN=/^-?\d+$/,Vp=/^-?\d+(?:\.\d+)?$/,QN=/^(?:true|false)$/i,XN=/^[^A-Z]*$/,$N=/^[^a-z]*$/,Nn=$("$ZodCheck",(n,e)=>{var t;n._zod??(n._zod={}),n._zod.def=e,(t=n._zod).onattach??(t.onattach=[])}),Up={number:"number",bigint:"bigint",object:"date"},Yp=$("$ZodCheckLessThan",(n,e)=>{Nn.init(n,e);const t=Up[typeof e.value];n._zod.onattach.push(i=>{const o=i._zod.bag,r=(e.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;e.value{(e.inclusive?i.value<=e.value:i.value{Nn.init(n,e);const t=Up[typeof e.value];n._zod.onattach.push(i=>{const o=i._zod.bag,r=(e.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>r&&(e.inclusive?o.minimum=e.value:o.exclusiveMinimum=e.value)}),n._zod.check=i=>{(e.inclusive?i.value>=e.value:i.value>e.value)||i.issues.push({origin:t,code:"too_small",minimum:typeof e.value=="object"?e.value.getTime():e.value,input:i.value,inclusive:e.inclusive,inst:n,continue:!e.abort})}}),qN=$("$ZodCheckMultipleOf",(n,e)=>{Nn.init(n,e),n._zod.onattach.push(t=>{var i;(i=t._zod.bag).multipleOf??(i.multipleOf=e.value)}),n._zod.check=t=>{if(typeof t.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof t.value=="bigint"?t.value%e.value===BigInt(0):eN(t.value,e.value)===0)||t.issues.push({origin:typeof t.value,code:"not_multiple_of",divisor:e.value,input:t.value,inst:n,continue:!e.abort})}}),JN=$("$ZodCheckNumberFormat",(n,e)=>{Nn.init(n,e),e.format=e.format||"float64";const t=e.format?.includes("int"),i=t?"int":"number",[o,r]=oN[e.format];n._zod.onattach.push(A=>{const I=A._zod.bag;I.format=e.format,I.minimum=o,I.maximum=r,t&&(I.pattern=WN)}),n._zod.check=A=>{const I=A.value;if(t){if(!Number.isInteger(I)){A.issues.push({expected:i,format:e.format,code:"invalid_type",continue:!1,input:I,inst:n});return}if(!Number.isSafeInteger(I)){I>0?A.issues.push({input:I,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:n,origin:i,inclusive:!0,continue:!e.abort}):A.issues.push({input:I,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:n,origin:i,inclusive:!0,continue:!e.abort});return}}Ir&&A.issues.push({origin:"number",input:I,code:"too_big",maximum:r,inclusive:!0,inst:n,continue:!e.abort})}}),eD=$("$ZodCheckMaxLength",(n,e)=>{var t;Nn.init(n,e),(t=n._zod.def).when??(t.when=i=>{const o=i.value;return!Hl(o)&&o.length!==void 0}),n._zod.onattach.push(i=>{const o=i._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum{const o=i.value;if(o.length<=e.maximum)return;const A=Wl(o);i.issues.push({origin:A,code:"too_big",maximum:e.maximum,inclusive:!0,input:o,inst:n,continue:!e.abort})}}),tD=$("$ZodCheckMinLength",(n,e)=>{var t;Nn.init(n,e),(t=n._zod.def).when??(t.when=i=>{const o=i.value;return!Hl(o)&&o.length!==void 0}),n._zod.onattach.push(i=>{const o=i._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>o&&(i._zod.bag.minimum=e.minimum)}),n._zod.check=i=>{const o=i.value;if(o.length>=e.minimum)return;const A=Wl(o);i.issues.push({origin:A,code:"too_small",minimum:e.minimum,inclusive:!0,input:o,inst:n,continue:!e.abort})}}),nD=$("$ZodCheckLengthEquals",(n,e)=>{var t;Nn.init(n,e),(t=n._zod.def).when??(t.when=i=>{const o=i.value;return!Hl(o)&&o.length!==void 0}),n._zod.onattach.push(i=>{const o=i._zod.bag;o.minimum=e.length,o.maximum=e.length,o.length=e.length}),n._zod.check=i=>{const o=i.value,r=o.length;if(r===e.length)return;const A=Wl(o),I=r>e.length;i.issues.push({origin:A,...I?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:i.value,inst:n,continue:!e.abort})}}),BA=$("$ZodCheckStringFormat",(n,e)=>{var t,i;Nn.init(n,e),n._zod.onattach.push(o=>{const r=o._zod.bag;r.format=e.format,e.pattern&&(r.patterns??(r.patterns=new Set),r.patterns.add(e.pattern))}),e.pattern?(t=n._zod).check??(t.check=o=>{e.pattern.lastIndex=0,!e.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:e.format,input:o.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:n,continue:!e.abort})}):(i=n._zod).check??(i.check=()=>{})}),iD=$("$ZodCheckRegex",(n,e)=>{BA.init(n,e),n._zod.check=t=>{e.pattern.lastIndex=0,!e.pattern.test(t.value)&&t.issues.push({origin:"string",code:"invalid_format",format:"regex",input:t.value,pattern:e.pattern.toString(),inst:n,continue:!e.abort})}}),gD=$("$ZodCheckLowerCase",(n,e)=>{e.pattern??(e.pattern=XN),BA.init(n,e)}),oD=$("$ZodCheckUpperCase",(n,e)=>{e.pattern??(e.pattern=$N),BA.init(n,e)}),sD=$("$ZodCheckIncludes",(n,e)=>{Nn.init(n,e);const t=os(e.includes),i=new RegExp(typeof e.position=="number"?`^.{${e.position}}${t}`:t);e.pattern=i,n._zod.onattach.push(o=>{const r=o._zod.bag;r.patterns??(r.patterns=new Set),r.patterns.add(i)}),n._zod.check=o=>{o.value.includes(e.includes,e.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:o.value,inst:n,continue:!e.abort})}}),rD=$("$ZodCheckStartsWith",(n,e)=>{Nn.init(n,e);const t=new RegExp(`^${os(e.prefix)}.*`);e.pattern??(e.pattern=t),n._zod.onattach.push(i=>{const o=i._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(t)}),n._zod.check=i=>{i.value.startsWith(e.prefix)||i.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:i.value,inst:n,continue:!e.abort})}}),aD=$("$ZodCheckEndsWith",(n,e)=>{Nn.init(n,e);const t=new RegExp(`.*${os(e.suffix)}$`);e.pattern??(e.pattern=t),n._zod.onattach.push(i=>{const o=i._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(t)}),n._zod.check=i=>{i.value.endsWith(e.suffix)||i.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:i.value,inst:n,continue:!e.abort})}}),AD=$("$ZodCheckOverwrite",(n,e)=>{Nn.init(n,e),n._zod.check=t=>{t.value=e.tx(t.value)}});class CD{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}const i=e.split(` `).filter(A=>A),o=Math.min(...i.map(A=>A.length-A.trimStart().length)),r=i.map(A=>A.slice(o)).map(A=>" ".repeat(this.indent*2)+A);for(const A of r)this.content.push(A)}compile(){const e=Function,t=this?.args,o=[...(this?.content??[""]).map(r=>` ${r}`)];return new e(...t,o.join(` -`))}}const ID={major:4,minor:4,patch:3},zt=$("$ZodType",(n,e)=>{var t;n??(n={}),n._zod.def=e,n._zod.bag=n._zod.bag||{},n._zod.version=ID;const i=[...n._zod.def.checks??[]];n._zod.traits.has("$ZodCheck")&&i.unshift(n);for(const o of i)for(const r of o._zod.onattach)r(n);if(i.length===0)(t=n._zod).deferred??(t.deferred=[]),n._zod.deferred?.push(()=>{n._zod.run=n._zod.parse});else{const o=(A,I,l)=>{let c=os(A),h;for(const p of I){if(p._zod.def.when){if(cN(A)||!p._zod.def.when(A))continue}else if(c)continue;const m=A.issues.length,y=p._zod.check(A);if(y instanceof Promise&&l?.async===!1)throw new ns;if(h||y instanceof Promise)h=(h??Promise.resolve()).then(async()=>{await y,A.issues.length!==m&&(c||(c=os(A,m)))});else{if(A.issues.length===m)continue;c||(c=os(A,m))}}return h?h.then(()=>A):A},r=(A,I,l)=>{if(os(A))return A.aborted=!0,A;const c=o(I,i,l);if(c instanceof Promise){if(l.async===!1)throw new ns;return c.then(h=>n._zod.parse(h,l))}return n._zod.parse(c,l)};n._zod.run=(A,I)=>{if(I.skipChecks)return n._zod.parse(A,I);if(I.direction==="backward"){const c=n._zod.parse({value:A.value,issues:[]},{...I,skipChecks:!0});return c instanceof Promise?c.then(h=>r(h,A,I)):r(c,A,I)}const l=n._zod.parse(A,I);if(l instanceof Promise){if(I.async===!1)throw new ns;return l.then(c=>o(c,i,I))}return o(l,i,I)}}rt(n,"~standard",()=>({validate:o=>{try{const r=hN(n,o);return r.success?{value:r.data}:{issues:r.error?.issues}}catch{return fN(n,o).then(A=>A.success?{value:A.data}:{issues:A.error?.issues})}},vendor:"zod",version:1}))}),Xl=$("$ZodString",(n,e)=>{zt.init(n,e),n._zod.pattern=[...n?._zod.bag?.patterns??[]].pop()??KN(n._zod.bag),n._zod.parse=(t,i)=>{if(e.coerce)try{t.value=String(t.value)}catch{}return typeof t.value=="string"||t.issues.push({expected:"string",code:"invalid_type",input:t.value,inst:n}),t}}),Tt=$("$ZodStringFormat",(n,e)=>{jA.init(n,e),Xl.init(n,e)}),lD=$("$ZodGUID",(n,e)=>{e.pattern??(e.pattern=kN),Tt.init(n,e)}),cD=$("$ZodUUID",(n,e)=>{if(e.version){const i={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[e.version];if(i===void 0)throw new Error(`Invalid UUID version: "${e.version}"`);e.pattern??(e.pattern=Bp(i))}else e.pattern??(e.pattern=Bp());Tt.init(n,e)}),dD=$("$ZodEmail",(n,e)=>{e.pattern??(e.pattern=RN),Tt.init(n,e)}),uD=$("$ZodURL",(n,e)=>{Tt.init(n,e),n._zod.check=t=>{try{const i=t.value.trim();if(!e.normalize&&e.protocol?.source===FN.source&&!/^https?:\/\//i.test(i)){t.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:t.value,inst:n,continue:!e.abort});return}const o=new URL(i);e.hostname&&(e.hostname.lastIndex=0,e.hostname.test(o.hostname)||t.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:e.hostname.source,input:t.value,inst:n,continue:!e.abort})),e.protocol&&(e.protocol.lastIndex=0,e.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||t.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:e.protocol.source,input:t.value,inst:n,continue:!e.abort})),e.normalize?t.value=o.href:t.value=i;return}catch{t.issues.push({code:"invalid_format",format:"url",input:t.value,inst:n,continue:!e.abort})}}}),hD=$("$ZodEmoji",(n,e)=>{e.pattern??(e.pattern=jN()),Tt.init(n,e)}),fD=$("$ZodNanoID",(n,e)=>{e.pattern??(e.pattern=MN),Tt.init(n,e)}),pD=$("$ZodCUID",(n,e)=>{e.pattern??(e.pattern=EN),Tt.init(n,e)}),mD=$("$ZodCUID2",(n,e)=>{e.pattern??(e.pattern=TN),Tt.init(n,e)}),vD=$("$ZodULID",(n,e)=>{e.pattern??(e.pattern=ON),Tt.init(n,e)}),yD=$("$ZodXID",(n,e)=>{e.pattern??(e.pattern=NN),Tt.init(n,e)}),bD=$("$ZodKSUID",(n,e)=>{e.pattern??(e.pattern=DN),Tt.init(n,e)}),wD=$("$ZodISODateTime",(n,e)=>{e.pattern??(e.pattern=HN(e)),Tt.init(n,e)}),xD=$("$ZodISODate",(n,e)=>{e.pattern??(e.pattern=UN),Tt.init(n,e)}),SD=$("$ZodISOTime",(n,e)=>{e.pattern??(e.pattern=YN(e)),Tt.init(n,e)}),ED=$("$ZodISODuration",(n,e)=>{e.pattern??(e.pattern=zN),Tt.init(n,e)}),TD=$("$ZodIPv4",(n,e)=>{e.pattern??(e.pattern=ZN),Tt.init(n,e),n._zod.bag.format="ipv4"}),OD=$("$ZodIPv6",(n,e)=>{e.pattern??(e.pattern=BN),Tt.init(n,e),n._zod.bag.format="ipv6",n._zod.check=t=>{try{new URL(`http://[${t.value}]`)}catch{t.issues.push({code:"invalid_format",format:"ipv6",input:t.value,inst:n,continue:!e.abort})}}}),ND=$("$ZodCIDRv4",(n,e)=>{e.pattern??(e.pattern=PN),Tt.init(n,e)}),DD=$("$ZodCIDRv6",(n,e)=>{e.pattern??(e.pattern=LN),Tt.init(n,e),n._zod.check=t=>{const i=t.value.split("/");try{if(i.length!==2)throw new Error;const[o,r]=i;if(!r)throw new Error;const A=Number(r);if(`${A}`!==r)throw new Error;if(A<0||A>128)throw new Error;new URL(`http://[${o}]`)}catch{t.issues.push({code:"invalid_format",format:"cidrv6",input:t.value,inst:n,continue:!e.abort})}}});function Hp(n){if(n==="")return!0;if(/\s/.test(n)||n.length%4!==0)return!1;try{return atob(n),!0}catch{return!1}}const MD=$("$ZodBase64",(n,e)=>{e.pattern??(e.pattern=GN),Tt.init(n,e),n._zod.bag.contentEncoding="base64",n._zod.check=t=>{Hp(t.value)||t.issues.push({code:"invalid_format",format:"base64",input:t.value,inst:n,continue:!e.abort})}});function zD(n){if(!Pp.test(n))return!1;const e=n.replace(/[-_]/g,i=>i==="-"?"+":"/"),t=e.padEnd(Math.ceil(e.length/4)*4,"=");return Hp(t)}const kD=$("$ZodBase64URL",(n,e)=>{e.pattern??(e.pattern=Pp),Tt.init(n,e),n._zod.bag.contentEncoding="base64url",n._zod.check=t=>{zD(t.value)||t.issues.push({code:"invalid_format",format:"base64url",input:t.value,inst:n,continue:!e.abort})}}),RD=$("$ZodE164",(n,e)=>{e.pattern??(e.pattern=VN),Tt.init(n,e)});function _D(n,e=null){try{const t=n.split(".");if(t.length!==3)return!1;const[i]=t;if(!i)return!1;const o=JSON.parse(atob(i));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||e&&(!("alg"in o)||o.alg!==e))}catch{return!1}}const jD=$("$ZodJWT",(n,e)=>{Tt.init(n,e),n._zod.check=t=>{_D(t.value,e.alg)||t.issues.push({code:"invalid_format",format:"jwt",input:t.value,inst:n,continue:!e.abort})}}),Kp=$("$ZodNumber",(n,e)=>{zt.init(n,e),n._zod.pattern=n._zod.bag.pattern??Fp,n._zod.parse=(t,i)=>{if(e.coerce)try{t.value=Number(t.value)}catch{}const o=t.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return t;const r=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return t.issues.push({expected:"number",code:"invalid_type",input:o,inst:n,...r?{received:r}:{}}),t}}),ZD=$("$ZodNumberFormat",(n,e)=>{JN.init(n,e),Kp.init(n,e)}),BD=$("$ZodBoolean",(n,e)=>{zt.init(n,e),n._zod.pattern=QN,n._zod.parse=(t,i)=>{if(e.coerce)try{t.value=!!t.value}catch{}const o=t.value;return typeof o=="boolean"||t.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:n}),t}}),PD=$("$ZodUnknown",(n,e)=>{zt.init(n,e),n._zod.parse=t=>t}),LD=$("$ZodNever",(n,e)=>{zt.init(n,e),n._zod.parse=(t,i)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:n}),t)});function Wp(n,e,t){n.issues.length&&e.issues.push(...ss(t,n.issues)),e.value[t]=n.value}const GD=$("$ZodArray",(n,e)=>{zt.init(n,e),n._zod.parse=(t,i)=>{const o=t.value;if(!Array.isArray(o))return t.issues.push({expected:"array",code:"invalid_type",input:o,inst:n}),t;t.value=Array(o.length);const r=[];for(let A=0;AWp(c,t,A))):Wp(l,t,A)}return r.length?Promise.all(r).then(()=>t):t}});function ZA(n,e,t,i,o,r){const A=t in i;if(n.issues.length){if(o&&r&&!A)return;e.issues.push(...ss(t,n.issues))}if(!A&&!o){n.issues.length||e.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[t]});return}n.value===void 0?A&&(e.value[t]=void 0):e.value[t]=n.value}function Qp(n){const e=Object.keys(n.shape);for(const i of e)if(!n.shape?.[i]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${i}": expected a Zod schema`);const t=gN(n.shape);return{...n,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(t)}}function Xp(n,e,t,i,o,r){const A=[],I=o.keySet,l=o.catchall._zod,c=l.def.type,h=l.optin==="optional",p=l.optout==="optional";for(const m in e){if(m==="__proto__"||I.has(m))continue;if(c==="never"){A.push(m);continue}const y=l.run({value:e[m],issues:[]},i);y instanceof Promise?n.push(y.then(w=>ZA(w,t,m,e,h,p))):ZA(y,t,m,e,h,p)}return A.length&&t.issues.push({code:"unrecognized_keys",keys:A,input:e,inst:r}),n.length?Promise.all(n).then(()=>t):t}const FD=$("$ZodObject",(n,e)=>{if(zt.init(n,e),!Object.getOwnPropertyDescriptor(e,"shape")?.get){const I=e.shape;Object.defineProperty(e,"shape",{get:()=>{const l={...I};return Object.defineProperty(e,"shape",{value:l}),l}})}const i=zA(()=>Qp(e));rt(n._zod,"propValues",()=>{const I=e.shape,l={};for(const c in I){const h=I[c]._zod;if(h.values){l[c]??(l[c]=new Set);for(const p of h.values)l[c].add(p)}}return l});const o=Nr,r=e.catchall;let A;n._zod.parse=(I,l)=>{A??(A=i.value);const c=I.value;if(!o(c))return I.issues.push({expected:"object",code:"invalid_type",input:c,inst:n}),I;I.value={};const h=[],p=A.shape;for(const m of A.keys){const y=p[m],w=y._zod.optin==="optional",S=y._zod.optout==="optional",x=y._zod.run({value:c[m],issues:[]},l);x instanceof Promise?h.push(x.then(O=>ZA(O,I,m,c,w,S))):ZA(x,I,m,c,w,S)}return r?Xp(h,c,I,l,i.value,n):h.length?Promise.all(h).then(()=>I):I}}),VD=$("$ZodObjectJIT",(n,e)=>{FD.init(n,e);const t=n._zod.parse,i=zA(()=>Qp(e)),o=m=>{const y=new CD(["shape","payload","ctx"]),w=i.value,S=_=>{const P=zp(_);return`shape[${P}]._zod.run({ value: input[${P}], issues: [] }, ctx)`};y.write("const input = payload.value;");const x=Object.create(null);let O=0;for(const _ of w.keys)x[_]=`key_${O++}`;y.write("const newResult = {};");for(const _ of w.keys){const P=x[_],Q=zp(_),ne=m[_],j=ne?._zod?.optin==="optional",V=ne?._zod?.optout==="optional";y.write(`const ${P} = ${S(_)};`),j&&V?y.write(` +`))}}const ID={major:4,minor:4,patch:3},zt=$("$ZodType",(n,e)=>{var t;n??(n={}),n._zod.def=e,n._zod.bag=n._zod.bag||{},n._zod.version=ID;const i=[...n._zod.def.checks??[]];n._zod.traits.has("$ZodCheck")&&i.unshift(n);for(const o of i)for(const r of o._zod.onattach)r(n);if(i.length===0)(t=n._zod).deferred??(t.deferred=[]),n._zod.deferred?.push(()=>{n._zod.run=n._zod.parse});else{const o=(A,I,l)=>{let c=ss(A),h;for(const p of I){if(p._zod.def.when){if(cN(A)||!p._zod.def.when(A))continue}else if(c)continue;const m=A.issues.length,y=p._zod.check(A);if(y instanceof Promise&&l?.async===!1)throw new is;if(h||y instanceof Promise)h=(h??Promise.resolve()).then(async()=>{await y,A.issues.length!==m&&(c||(c=ss(A,m)))});else{if(A.issues.length===m)continue;c||(c=ss(A,m))}}return h?h.then(()=>A):A},r=(A,I,l)=>{if(ss(A))return A.aborted=!0,A;const c=o(I,i,l);if(c instanceof Promise){if(l.async===!1)throw new is;return c.then(h=>n._zod.parse(h,l))}return n._zod.parse(c,l)};n._zod.run=(A,I)=>{if(I.skipChecks)return n._zod.parse(A,I);if(I.direction==="backward"){const c=n._zod.parse({value:A.value,issues:[]},{...I,skipChecks:!0});return c instanceof Promise?c.then(h=>r(h,A,I)):r(c,A,I)}const l=n._zod.parse(A,I);if(l instanceof Promise){if(I.async===!1)throw new is;return l.then(c=>o(c,i,I))}return o(l,i,I)}}At(n,"~standard",()=>({validate:o=>{try{const r=hN(n,o);return r.success?{value:r.data}:{issues:r.error?.issues}}catch{return fN(n,o).then(A=>A.success?{value:A.data}:{issues:A.error?.issues})}},vendor:"zod",version:1}))}),$l=$("$ZodString",(n,e)=>{zt.init(n,e),n._zod.pattern=[...n?._zod.bag?.patterns??[]].pop()??KN(n._zod.bag),n._zod.parse=(t,i)=>{if(e.coerce)try{t.value=String(t.value)}catch{}return typeof t.value=="string"||t.issues.push({expected:"string",code:"invalid_type",input:t.value,inst:n}),t}}),Ot=$("$ZodStringFormat",(n,e)=>{BA.init(n,e),$l.init(n,e)}),lD=$("$ZodGUID",(n,e)=>{e.pattern??(e.pattern=kN),Ot.init(n,e)}),cD=$("$ZodUUID",(n,e)=>{if(e.version){const i={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[e.version];if(i===void 0)throw new Error(`Invalid UUID version: "${e.version}"`);e.pattern??(e.pattern=Pp(i))}else e.pattern??(e.pattern=Pp());Ot.init(n,e)}),dD=$("$ZodEmail",(n,e)=>{e.pattern??(e.pattern=RN),Ot.init(n,e)}),uD=$("$ZodURL",(n,e)=>{Ot.init(n,e),n._zod.check=t=>{try{const i=t.value.trim();if(!e.normalize&&e.protocol?.source===FN.source&&!/^https?:\/\//i.test(i)){t.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:t.value,inst:n,continue:!e.abort});return}const o=new URL(i);e.hostname&&(e.hostname.lastIndex=0,e.hostname.test(o.hostname)||t.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:e.hostname.source,input:t.value,inst:n,continue:!e.abort})),e.protocol&&(e.protocol.lastIndex=0,e.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||t.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:e.protocol.source,input:t.value,inst:n,continue:!e.abort})),e.normalize?t.value=o.href:t.value=i;return}catch{t.issues.push({code:"invalid_format",format:"url",input:t.value,inst:n,continue:!e.abort})}}}),hD=$("$ZodEmoji",(n,e)=>{e.pattern??(e.pattern=jN()),Ot.init(n,e)}),fD=$("$ZodNanoID",(n,e)=>{e.pattern??(e.pattern=MN),Ot.init(n,e)}),pD=$("$ZodCUID",(n,e)=>{e.pattern??(e.pattern=EN),Ot.init(n,e)}),mD=$("$ZodCUID2",(n,e)=>{e.pattern??(e.pattern=TN),Ot.init(n,e)}),vD=$("$ZodULID",(n,e)=>{e.pattern??(e.pattern=ON),Ot.init(n,e)}),yD=$("$ZodXID",(n,e)=>{e.pattern??(e.pattern=NN),Ot.init(n,e)}),bD=$("$ZodKSUID",(n,e)=>{e.pattern??(e.pattern=DN),Ot.init(n,e)}),wD=$("$ZodISODateTime",(n,e)=>{e.pattern??(e.pattern=HN(e)),Ot.init(n,e)}),xD=$("$ZodISODate",(n,e)=>{e.pattern??(e.pattern=UN),Ot.init(n,e)}),SD=$("$ZodISOTime",(n,e)=>{e.pattern??(e.pattern=YN(e)),Ot.init(n,e)}),ED=$("$ZodISODuration",(n,e)=>{e.pattern??(e.pattern=zN),Ot.init(n,e)}),TD=$("$ZodIPv4",(n,e)=>{e.pattern??(e.pattern=ZN),Ot.init(n,e),n._zod.bag.format="ipv4"}),OD=$("$ZodIPv6",(n,e)=>{e.pattern??(e.pattern=BN),Ot.init(n,e),n._zod.bag.format="ipv6",n._zod.check=t=>{try{new URL(`http://[${t.value}]`)}catch{t.issues.push({code:"invalid_format",format:"ipv6",input:t.value,inst:n,continue:!e.abort})}}}),ND=$("$ZodCIDRv4",(n,e)=>{e.pattern??(e.pattern=PN),Ot.init(n,e)}),DD=$("$ZodCIDRv6",(n,e)=>{e.pattern??(e.pattern=LN),Ot.init(n,e),n._zod.check=t=>{const i=t.value.split("/");try{if(i.length!==2)throw new Error;const[o,r]=i;if(!r)throw new Error;const A=Number(r);if(`${A}`!==r)throw new Error;if(A<0||A>128)throw new Error;new URL(`http://[${o}]`)}catch{t.issues.push({code:"invalid_format",format:"cidrv6",input:t.value,inst:n,continue:!e.abort})}}});function Kp(n){if(n==="")return!0;if(/\s/.test(n)||n.length%4!==0)return!1;try{return atob(n),!0}catch{return!1}}const MD=$("$ZodBase64",(n,e)=>{e.pattern??(e.pattern=GN),Ot.init(n,e),n._zod.bag.contentEncoding="base64",n._zod.check=t=>{Kp(t.value)||t.issues.push({code:"invalid_format",format:"base64",input:t.value,inst:n,continue:!e.abort})}});function zD(n){if(!Lp.test(n))return!1;const e=n.replace(/[-_]/g,i=>i==="-"?"+":"/"),t=e.padEnd(Math.ceil(e.length/4)*4,"=");return Kp(t)}const kD=$("$ZodBase64URL",(n,e)=>{e.pattern??(e.pattern=Lp),Ot.init(n,e),n._zod.bag.contentEncoding="base64url",n._zod.check=t=>{zD(t.value)||t.issues.push({code:"invalid_format",format:"base64url",input:t.value,inst:n,continue:!e.abort})}}),RD=$("$ZodE164",(n,e)=>{e.pattern??(e.pattern=VN),Ot.init(n,e)});function _D(n,e=null){try{const t=n.split(".");if(t.length!==3)return!1;const[i]=t;if(!i)return!1;const o=JSON.parse(atob(i));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||e&&(!("alg"in o)||o.alg!==e))}catch{return!1}}const jD=$("$ZodJWT",(n,e)=>{Ot.init(n,e),n._zod.check=t=>{_D(t.value,e.alg)||t.issues.push({code:"invalid_format",format:"jwt",input:t.value,inst:n,continue:!e.abort})}}),Wp=$("$ZodNumber",(n,e)=>{zt.init(n,e),n._zod.pattern=n._zod.bag.pattern??Vp,n._zod.parse=(t,i)=>{if(e.coerce)try{t.value=Number(t.value)}catch{}const o=t.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return t;const r=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return t.issues.push({expected:"number",code:"invalid_type",input:o,inst:n,...r?{received:r}:{}}),t}}),ZD=$("$ZodNumberFormat",(n,e)=>{JN.init(n,e),Wp.init(n,e)}),BD=$("$ZodBoolean",(n,e)=>{zt.init(n,e),n._zod.pattern=QN,n._zod.parse=(t,i)=>{if(e.coerce)try{t.value=!!t.value}catch{}const o=t.value;return typeof o=="boolean"||t.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:n}),t}}),PD=$("$ZodUnknown",(n,e)=>{zt.init(n,e),n._zod.parse=t=>t}),LD=$("$ZodNever",(n,e)=>{zt.init(n,e),n._zod.parse=(t,i)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:n}),t)});function Qp(n,e,t){n.issues.length&&e.issues.push(...rs(t,n.issues)),e.value[t]=n.value}const GD=$("$ZodArray",(n,e)=>{zt.init(n,e),n._zod.parse=(t,i)=>{const o=t.value;if(!Array.isArray(o))return t.issues.push({expected:"array",code:"invalid_type",input:o,inst:n}),t;t.value=Array(o.length);const r=[];for(let A=0;AQp(c,t,A))):Qp(l,t,A)}return r.length?Promise.all(r).then(()=>t):t}});function PA(n,e,t,i,o,r){const A=t in i;if(n.issues.length){if(o&&r&&!A)return;e.issues.push(...rs(t,n.issues))}if(!A&&!o){n.issues.length||e.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[t]});return}n.value===void 0?A&&(e.value[t]=void 0):e.value[t]=n.value}function Xp(n){const e=Object.keys(n.shape);for(const i of e)if(!n.shape?.[i]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${i}": expected a Zod schema`);const t=gN(n.shape);return{...n,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(t)}}function $p(n,e,t,i,o,r){const A=[],I=o.keySet,l=o.catchall._zod,c=l.def.type,h=l.optin==="optional",p=l.optout==="optional";for(const m in e){if(m==="__proto__"||I.has(m))continue;if(c==="never"){A.push(m);continue}const y=l.run({value:e[m],issues:[]},i);y instanceof Promise?n.push(y.then(w=>PA(w,t,m,e,h,p))):PA(y,t,m,e,h,p)}return A.length&&t.issues.push({code:"unrecognized_keys",keys:A,input:e,inst:r}),n.length?Promise.all(n).then(()=>t):t}const FD=$("$ZodObject",(n,e)=>{if(zt.init(n,e),!Object.getOwnPropertyDescriptor(e,"shape")?.get){const I=e.shape;Object.defineProperty(e,"shape",{get:()=>{const l={...I};return Object.defineProperty(e,"shape",{value:l}),l}})}const i=RA(()=>Xp(e));At(n._zod,"propValues",()=>{const I=e.shape,l={};for(const c in I){const h=I[c]._zod;if(h.values){l[c]??(l[c]=new Set);for(const p of h.values)l[c].add(p)}}return l});const o=Dr,r=e.catchall;let A;n._zod.parse=(I,l)=>{A??(A=i.value);const c=I.value;if(!o(c))return I.issues.push({expected:"object",code:"invalid_type",input:c,inst:n}),I;I.value={};const h=[],p=A.shape;for(const m of A.keys){const y=p[m],w=y._zod.optin==="optional",S=y._zod.optout==="optional",x=y._zod.run({value:c[m],issues:[]},l);x instanceof Promise?h.push(x.then(O=>PA(O,I,m,c,w,S))):PA(x,I,m,c,w,S)}return r?$p(h,c,I,l,i.value,n):h.length?Promise.all(h).then(()=>I):I}}),VD=$("$ZodObjectJIT",(n,e)=>{FD.init(n,e);const t=n._zod.parse,i=RA(()=>Xp(e)),o=m=>{const y=new CD(["shape","payload","ctx"]),w=i.value,S=_=>{const P=kp(_);return`shape[${P}]._zod.run({ value: input[${P}], issues: [] }, ctx)`};y.write("const input = payload.value;");const x=Object.create(null);let O=0;for(const _ of w.keys)x[_]=`key_${O++}`;y.write("const newResult = {};");for(const _ of w.keys){const P=x[_],Q=kp(_),ne=m[_],F=ne?._zod?.optin==="optional",Z=ne?._zod?.optout==="optional";y.write(`const ${P} = ${S(_)};`),F&&Z?y.write(` if (${P}.issues.length) { if (${Q} in input) { payload.issues = payload.issues.concat(${P}.issues.map(iss => ({ @@ -26,7 +26,7 @@ Error generating stack: `+C.message+` newResult[${Q}] = ${P}.value; } - `):j?y.write(` + `):F?y.write(` if (${P}.issues.length) { payload.issues = payload.issues.concat(${P}.issues.map(iss => ({ ...iss, @@ -67,9 +67,9 @@ Error generating stack: `+C.message+` } } - `)}y.write("payload.value = newResult;"),y.write("return payload;");const E=y.compile();return(_,P)=>E(m,_,P)};let r;const A=Nr,I=!Vl.jitless,c=I&&nN.value,h=e.catchall;let p;n._zod.parse=(m,y)=>{p??(p=i.value);const w=m.value;return A(w)?I&&c&&y?.async===!1&&y.jitless!==!0?(r||(r=o(e.shape)),m=r(m,y),h?Xp([],w,m,y,p,n):m):t(m,y):(m.issues.push({expected:"object",code:"invalid_type",input:w,inst:n}),m)}});function $p(n,e,t,i){for(const r of n)if(r.issues.length===0)return e.value=r.value,e;const o=n.filter(r=>!os(r));return o.length===1?(e.value=o[0].value,o[0]):(e.issues.push({code:"invalid_union",input:e.value,inst:t,errors:n.map(r=>r.issues.map(A=>Ui(A,i,Vi())))}),e)}const qp=$("$ZodUnion",(n,e)=>{zt.init(n,e),rt(n._zod,"optin",()=>e.options.some(i=>i._zod.optin==="optional")?"optional":void 0),rt(n._zod,"optout",()=>e.options.some(i=>i._zod.optout==="optional")?"optional":void 0),rt(n._zod,"values",()=>{if(e.options.every(i=>i._zod.values))return new Set(e.options.flatMap(i=>Array.from(i._zod.values)))}),rt(n._zod,"pattern",()=>{if(e.options.every(i=>i._zod.pattern)){const i=e.options.map(o=>o._zod.pattern);return new RegExp(`^(${i.map(o=>Hl(o.source)).join("|")})$`)}});const t=e.options.length===1?e.options[0]._zod.run:null;n._zod.parse=(i,o)=>{if(t)return t(i,o);let r=!1;const A=[];for(const I of e.options){const l=I._zod.run({value:i.value,issues:[]},o);if(l instanceof Promise)A.push(l),r=!0;else{if(l.issues.length===0)return l;A.push(l)}}return r?Promise.all(A).then(I=>$p(I,i,n,o)):$p(A,i,n,o)}}),UD=$("$ZodDiscriminatedUnion",(n,e)=>{e.inclusive=!1,qp.init(n,e);const t=n._zod.parse;rt(n._zod,"propValues",()=>{const o={};for(const r of e.options){const A=r._zod.propValues;if(!A||Object.keys(A).length===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(r)}"`);for(const[I,l]of Object.entries(A)){o[I]||(o[I]=new Set);for(const c of l)o[I].add(c)}}return o});const i=zA(()=>{const o=e.options,r=new Map;for(const A of o){const I=A._zod.propValues?.[e.discriminator];if(!I||I.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(A)}"`);for(const l of I){if(r.has(l))throw new Error(`Duplicate discriminator value "${String(l)}"`);r.set(l,A)}}return r});n._zod.parse=(o,r)=>{const A=o.value;if(!Nr(A))return o.issues.push({code:"invalid_type",expected:"object",input:A,inst:n}),o;const I=i.value.get(A?.[e.discriminator]);return I?I._zod.run(o,r):e.unionFallback||r.direction==="backward"?t(o,r):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:e.discriminator,options:Array.from(i.value.keys()),input:A,path:[e.discriminator],inst:n}),o)}}),YD=$("$ZodIntersection",(n,e)=>{zt.init(n,e),n._zod.parse=(t,i)=>{const o=t.value,r=e.left._zod.run({value:o,issues:[]},i),A=e.right._zod.run({value:o,issues:[]},i);return r instanceof Promise||A instanceof Promise?Promise.all([r,A]).then(([l,c])=>Jp(t,l,c)):Jp(t,r,A)}});function $l(n,e){if(n===e)return{valid:!0,data:n};if(n instanceof Date&&e instanceof Date&&+n==+e)return{valid:!0,data:n};if(is(n)&&is(e)){const t=Object.keys(e),i=Object.keys(n).filter(r=>t.indexOf(r)!==-1),o={...n,...e};for(const r of i){const A=$l(n[r],e[r]);if(!A.valid)return{valid:!1,mergeErrorPath:[r,...A.mergeErrorPath]};o[r]=A.data}return{valid:!0,data:o}}if(Array.isArray(n)&&Array.isArray(e)){if(n.length!==e.length)return{valid:!1,mergeErrorPath:[]};const t=[];for(let i=0;iI.l&&I.r).map(([I])=>I);if(r.length&&o&&n.issues.push({...o,keys:r}),os(n))return n;const A=$l(e.value,t.value);if(!A.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(A.mergeErrorPath)}`);return n.value=A.data,n}const HD=$("$ZodRecord",(n,e)=>{zt.init(n,e),n._zod.parse=(t,i)=>{const o=t.value;if(!is(o))return t.issues.push({expected:"record",code:"invalid_type",input:o,inst:n}),t;const r=[],A=e.keyType._zod.values;if(A){t.value={};const I=new Set;for(const c of A)if(typeof c=="string"||typeof c=="number"||typeof c=="symbol"){I.add(typeof c=="number"?c.toString():c);const h=e.keyType._zod.run({value:c,issues:[]},i);if(h instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(h.issues.length){t.issues.push({code:"invalid_key",origin:"record",issues:h.issues.map(y=>Ui(y,i,Vi())),input:c,path:[c],inst:n});continue}const p=h.value,m=e.valueType._zod.run({value:o[c],issues:[]},i);m instanceof Promise?r.push(m.then(y=>{y.issues.length&&t.issues.push(...ss(c,y.issues)),t.value[p]=y.value})):(m.issues.length&&t.issues.push(...ss(c,m.issues)),t.value[p]=m.value)}let l;for(const c in o)I.has(c)||(l=l??[],l.push(c));l&&l.length>0&&t.issues.push({code:"unrecognized_keys",input:o,inst:n,keys:l})}else{t.value={};for(const I of Reflect.ownKeys(o)){if(I==="__proto__"||!Object.prototype.propertyIsEnumerable.call(o,I))continue;let l=e.keyType._zod.run({value:I,issues:[]},i);if(l instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof I=="string"&&Fp.test(I)&&l.issues.length){const p=e.keyType._zod.run({value:Number(I),issues:[]},i);if(p instanceof Promise)throw new Error("Async schemas not supported in object keys currently");p.issues.length===0&&(l=p)}if(l.issues.length){e.mode==="loose"?t.value[I]=o[I]:t.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(p=>Ui(p,i,Vi())),input:I,path:[I],inst:n});continue}const h=e.valueType._zod.run({value:o[I],issues:[]},i);h instanceof Promise?r.push(h.then(p=>{p.issues.length&&t.issues.push(...ss(I,p.issues)),t.value[l.value]=p.value})):(h.issues.length&&t.issues.push(...ss(I,h.issues)),t.value[l.value]=h.value)}}return r.length?Promise.all(r).then(()=>t):t}}),KD=$("$ZodEnum",(n,e)=>{zt.init(n,e);const t=Dp(e.entries),i=new Set(t);n._zod.values=i,n._zod.pattern=new RegExp(`^(${t.filter(o=>iN.has(typeof o)).map(o=>typeof o=="string"?gs(o):o.toString()).join("|")})$`),n._zod.parse=(o,r)=>{const A=o.value;return i.has(A)||o.issues.push({code:"invalid_value",values:t,input:A,inst:n}),o}}),WD=$("$ZodLiteral",(n,e)=>{if(zt.init(n,e),e.values.length===0)throw new Error("Cannot create literal schema with no valid values");const t=new Set(e.values);n._zod.values=t,n._zod.pattern=new RegExp(`^(${e.values.map(i=>typeof i=="string"?gs(i):i?gs(i.toString()):String(i)).join("|")})$`),n._zod.parse=(i,o)=>{const r=i.value;return t.has(r)||i.issues.push({code:"invalid_value",values:e.values,input:r,inst:n}),i}}),QD=$("$ZodTransform",(n,e)=>{zt.init(n,e),n._zod.optin="optional",n._zod.parse=(t,i)=>{if(i.direction==="backward")throw new Np(n.constructor.name);const o=e.transform(t.value,t);if(i.async)return(o instanceof Promise?o:Promise.resolve(o)).then(A=>(t.value=A,t.fallback=!0,t));if(o instanceof Promise)throw new ns;return t.value=o,t.fallback=!0,t}});function em(n,e){return e===void 0&&(n.issues.length||n.fallback)?{issues:[],value:void 0}:n}const tm=$("$ZodOptional",(n,e)=>{zt.init(n,e),n._zod.optin="optional",n._zod.optout="optional",rt(n._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),rt(n._zod,"pattern",()=>{const t=e.innerType._zod.pattern;return t?new RegExp(`^(${Hl(t.source)})?$`):void 0}),n._zod.parse=(t,i)=>{if(e.innerType._zod.optin==="optional"){const o=t.value,r=e.innerType._zod.run(t,i);return r instanceof Promise?r.then(A=>em(A,o)):em(r,o)}return t.value===void 0?t:e.innerType._zod.run(t,i)}}),XD=$("$ZodExactOptional",(n,e)=>{tm.init(n,e),rt(n._zod,"values",()=>e.innerType._zod.values),rt(n._zod,"pattern",()=>e.innerType._zod.pattern),n._zod.parse=(t,i)=>e.innerType._zod.run(t,i)}),$D=$("$ZodNullable",(n,e)=>{zt.init(n,e),rt(n._zod,"optin",()=>e.innerType._zod.optin),rt(n._zod,"optout",()=>e.innerType._zod.optout),rt(n._zod,"pattern",()=>{const t=e.innerType._zod.pattern;return t?new RegExp(`^(${Hl(t.source)}|null)$`):void 0}),rt(n._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,null]):void 0),n._zod.parse=(t,i)=>t.value===null?t:e.innerType._zod.run(t,i)}),qD=$("$ZodDefault",(n,e)=>{zt.init(n,e),n._zod.optin="optional",rt(n._zod,"values",()=>e.innerType._zod.values),n._zod.parse=(t,i)=>{if(i.direction==="backward")return e.innerType._zod.run(t,i);if(t.value===void 0)return t.value=e.defaultValue,t;const o=e.innerType._zod.run(t,i);return o instanceof Promise?o.then(r=>nm(r,e)):nm(o,e)}});function nm(n,e){return n.value===void 0&&(n.value=e.defaultValue),n}const JD=$("$ZodPrefault",(n,e)=>{zt.init(n,e),n._zod.optin="optional",rt(n._zod,"values",()=>e.innerType._zod.values),n._zod.parse=(t,i)=>(i.direction==="backward"||t.value===void 0&&(t.value=e.defaultValue),e.innerType._zod.run(t,i))}),eM=$("$ZodNonOptional",(n,e)=>{zt.init(n,e),rt(n._zod,"values",()=>{const t=e.innerType._zod.values;return t?new Set([...t].filter(i=>i!==void 0)):void 0}),n._zod.parse=(t,i)=>{const o=e.innerType._zod.run(t,i);return o instanceof Promise?o.then(r=>im(r,n)):im(o,n)}});function im(n,e){return!n.issues.length&&n.value===void 0&&n.issues.push({code:"invalid_type",expected:"nonoptional",input:n.value,inst:e}),n}const tM=$("$ZodCatch",(n,e)=>{zt.init(n,e),n._zod.optin="optional",rt(n._zod,"optout",()=>e.innerType._zod.optout),rt(n._zod,"values",()=>e.innerType._zod.values),n._zod.parse=(t,i)=>{if(i.direction==="backward")return e.innerType._zod.run(t,i);const o=e.innerType._zod.run(t,i);return o instanceof Promise?o.then(r=>(t.value=r.value,r.issues.length&&(t.value=e.catchValue({...t,error:{issues:r.issues.map(A=>Ui(A,i,Vi()))},input:t.value}),t.issues=[],t.fallback=!0),t)):(t.value=o.value,o.issues.length&&(t.value=e.catchValue({...t,error:{issues:o.issues.map(r=>Ui(r,i,Vi()))},input:t.value}),t.issues=[],t.fallback=!0),t)}}),nM=$("$ZodPipe",(n,e)=>{zt.init(n,e),rt(n._zod,"values",()=>e.in._zod.values),rt(n._zod,"optin",()=>e.in._zod.optin),rt(n._zod,"optout",()=>e.out._zod.optout),rt(n._zod,"propValues",()=>e.in._zod.propValues),n._zod.parse=(t,i)=>{if(i.direction==="backward"){const r=e.out._zod.run(t,i);return r instanceof Promise?r.then(A=>BA(A,e.in,i)):BA(r,e.in,i)}const o=e.in._zod.run(t,i);return o instanceof Promise?o.then(r=>BA(r,e.out,i)):BA(o,e.out,i)}});function BA(n,e,t){return n.issues.length?(n.aborted=!0,n):e._zod.run({value:n.value,issues:n.issues,fallback:n.fallback},t)}const iM=$("$ZodReadonly",(n,e)=>{zt.init(n,e),rt(n._zod,"propValues",()=>e.innerType._zod.propValues),rt(n._zod,"values",()=>e.innerType._zod.values),rt(n._zod,"optin",()=>e.innerType?._zod?.optin),rt(n._zod,"optout",()=>e.innerType?._zod?.optout),n._zod.parse=(t,i)=>{if(i.direction==="backward")return e.innerType._zod.run(t,i);const o=e.innerType._zod.run(t,i);return o instanceof Promise?o.then(gm):gm(o)}});function gm(n){return n.value=Object.freeze(n.value),n}const gM=$("$ZodCustom",(n,e)=>{Nn.init(n,e),zt.init(n,e),n._zod.parse=(t,i)=>t,n._zod.check=t=>{const i=t.value,o=e.fn(i);if(o instanceof Promise)return o.then(r=>om(r,t,i,n));om(o,t,i,n)}});function om(n,e,t,i){if(!n){const o={code:"custom",input:t,inst:i,path:[...i._zod.def.path??[]],continue:!i._zod.def.abort};i._zod.def.params&&(o.params=i._zod.def.params),e.issues.push(Dr(o))}}var sm;class oM{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){const i=t[0];return this._map.set(e,i),i&&typeof i=="object"&&"id"in i&&this._idmap.set(i.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){const t=this._map.get(e);return t&&typeof t=="object"&&"id"in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){const t=e._zod.parent;if(t){const i={...this.get(t)??{}};delete i.id;const o={...i,...this._map.get(e)};return Object.keys(o).length?o:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function sM(){return new oM}(sm=globalThis).__zod_globalRegistry??(sm.__zod_globalRegistry=sM());const Mr=globalThis.__zod_globalRegistry;function rM(n,e){return new n({type:"string",...we(e)})}function aM(n,e){return new n({type:"string",format:"email",check:"string_format",abort:!1,...we(e)})}function rm(n,e){return new n({type:"string",format:"guid",check:"string_format",abort:!1,...we(e)})}function AM(n,e){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,...we(e)})}function CM(n,e){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...we(e)})}function IM(n,e){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...we(e)})}function lM(n,e){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...we(e)})}function cM(n,e){return new n({type:"string",format:"url",check:"string_format",abort:!1,...we(e)})}function dM(n,e){return new n({type:"string",format:"emoji",check:"string_format",abort:!1,...we(e)})}function uM(n,e){return new n({type:"string",format:"nanoid",check:"string_format",abort:!1,...we(e)})}function hM(n,e){return new n({type:"string",format:"cuid",check:"string_format",abort:!1,...we(e)})}function fM(n,e){return new n({type:"string",format:"cuid2",check:"string_format",abort:!1,...we(e)})}function pM(n,e){return new n({type:"string",format:"ulid",check:"string_format",abort:!1,...we(e)})}function mM(n,e){return new n({type:"string",format:"xid",check:"string_format",abort:!1,...we(e)})}function vM(n,e){return new n({type:"string",format:"ksuid",check:"string_format",abort:!1,...we(e)})}function yM(n,e){return new n({type:"string",format:"ipv4",check:"string_format",abort:!1,...we(e)})}function bM(n,e){return new n({type:"string",format:"ipv6",check:"string_format",abort:!1,...we(e)})}function wM(n,e){return new n({type:"string",format:"cidrv4",check:"string_format",abort:!1,...we(e)})}function xM(n,e){return new n({type:"string",format:"cidrv6",check:"string_format",abort:!1,...we(e)})}function SM(n,e){return new n({type:"string",format:"base64",check:"string_format",abort:!1,...we(e)})}function EM(n,e){return new n({type:"string",format:"base64url",check:"string_format",abort:!1,...we(e)})}function TM(n,e){return new n({type:"string",format:"e164",check:"string_format",abort:!1,...we(e)})}function OM(n,e){return new n({type:"string",format:"jwt",check:"string_format",abort:!1,...we(e)})}function NM(n,e){return new n({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...we(e)})}function DM(n,e){return new n({type:"string",format:"date",check:"string_format",...we(e)})}function MM(n,e){return new n({type:"string",format:"time",check:"string_format",precision:null,...we(e)})}function zM(n,e){return new n({type:"string",format:"duration",check:"string_format",...we(e)})}function kM(n,e){return new n({type:"number",checks:[],...we(e)})}function RM(n,e){return new n({type:"number",check:"number_format",abort:!1,format:"safeint",...we(e)})}function _M(n,e){return new n({type:"boolean",...we(e)})}function jM(n){return new n({type:"unknown"})}function ZM(n,e){return new n({type:"never",...we(e)})}function am(n,e){return new Up({check:"less_than",...we(e),value:n,inclusive:!1})}function ql(n,e){return new Up({check:"less_than",...we(e),value:n,inclusive:!0})}function Am(n,e){return new Yp({check:"greater_than",...we(e),value:n,inclusive:!1})}function Jl(n,e){return new Yp({check:"greater_than",...we(e),value:n,inclusive:!0})}function Cm(n,e){return new qN({check:"multiple_of",...we(e),value:n})}function Im(n,e){return new eD({check:"max_length",...we(e),maximum:n})}function PA(n,e){return new tD({check:"min_length",...we(e),minimum:n})}function lm(n,e){return new nD({check:"length_equals",...we(e),length:n})}function BM(n,e){return new iD({check:"string_format",format:"regex",...we(e),pattern:n})}function PM(n){return new gD({check:"string_format",format:"lowercase",...we(n)})}function LM(n){return new oD({check:"string_format",format:"uppercase",...we(n)})}function GM(n,e){return new sD({check:"string_format",format:"includes",...we(e),includes:n})}function FM(n,e){return new rD({check:"string_format",format:"starts_with",...we(e),prefix:n})}function VM(n,e){return new aD({check:"string_format",format:"ends_with",...we(e),suffix:n})}function rs(n){return new AD({check:"overwrite",tx:n})}function UM(n){return rs(e=>e.normalize(n))}function YM(){return rs(n=>n.trim())}function HM(){return rs(n=>n.toLowerCase())}function KM(){return rs(n=>n.toUpperCase())}function WM(){return rs(n=>tN(n))}function QM(n,e,t){return new n({type:"array",element:e,...we(t)})}function XM(n,e,t){return new n({type:"custom",check:"custom",fn:e,...we(t)})}function $M(n,e){const t=qM(i=>(i.addIssue=o=>{if(typeof o=="string")i.issues.push(Dr(o,i.value,t._zod.def));else{const r=o;r.fatal&&(r.continue=!1),r.code??(r.code="custom"),r.input??(r.input=i.value),r.inst??(r.inst=t),r.continue??(r.continue=!t._zod.def.abort),i.issues.push(Dr(r))}},n(i.value,i)),e);return t}function qM(n,e){const t=new Nn({check:"custom",...we(e)});return t._zod.check=n,t}function cm(n){let e=n?.target??"draft-2020-12";return e==="draft-4"&&(e="draft-04"),e==="draft-7"&&(e="draft-07"),{processors:n.processors??{},metadataRegistry:n?.metadata??Mr,target:e,unrepresentable:n?.unrepresentable??"throw",override:n?.override??(()=>{}),io:n?.io??"output",counter:0,seen:new Map,cycles:n?.cycles??"ref",reused:n?.reused??"inline",external:n?.external??void 0}}function Kt(n,e,t={path:[],schemaPath:[]}){var i;const o=n._zod.def,r=e.seen.get(n);if(r)return r.count++,t.schemaPath.includes(n)&&(r.cycle=t.path),r.schema;const A={schema:{},count:1,cycle:void 0,path:t.path};e.seen.set(n,A);const I=n._zod.toJSONSchema?.();if(I)A.schema=I;else{const h={...t,schemaPath:[...t.schemaPath,n],path:t.path};if(n._zod.processJSONSchema)n._zod.processJSONSchema(e,A.schema,h);else{const m=A.schema,y=e.processors[o.type];if(!y)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);y(n,e,m,h)}const p=n._zod.parent;p&&(A.ref||(A.ref=p),Kt(p,e,h),e.seen.get(p).isParent=!0)}const l=e.metadataRegistry.get(n);return l&&Object.assign(A.schema,l),e.io==="input"&&bn(n)&&(delete A.schema.examples,delete A.schema.default),e.io==="input"&&"_prefault"in A.schema&&((i=A.schema).default??(i.default=A.schema._prefault)),delete A.schema._prefault,e.seen.get(n).schema}function dm(n,e){const t=n.seen.get(e);if(!t)throw new Error("Unprocessed schema. This is a bug in Zod.");const i=new Map;for(const A of n.seen.entries()){const I=n.metadataRegistry.get(A[0])?.id;if(I){const l=i.get(I);if(l&&l!==A[0])throw new Error(`Duplicate schema id "${I}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);i.set(I,A[0])}}const o=A=>{const I=n.target==="draft-2020-12"?"$defs":"definitions";if(n.external){const p=n.external.registry.get(A[0])?.id,m=n.external.uri??(w=>w);if(p)return{ref:m(p)};const y=A[1].defId??A[1].schema.id??`schema${n.counter++}`;return A[1].defId=y,{defId:y,ref:`${m("__shared")}#/${I}/${y}`}}if(A[1]===t)return{ref:"#"};const c=`#/${I}/`,h=A[1].schema.id??`__schema${n.counter++}`;return{defId:h,ref:c+h}},r=A=>{if(A[1].schema.$ref)return;const I=A[1],{ref:l,defId:c}=o(A);I.def={...I.schema},c&&(I.defId=c);const h=I.schema;for(const p in h)delete h[p];h.$ref=l};if(n.cycles==="throw")for(const A of n.seen.entries()){const I=A[1];if(I.cycle)throw new Error(`Cycle detected: #/${I.cycle?.join("/")}/ + `)}y.write("payload.value = newResult;"),y.write("return payload;");const E=y.compile();return(_,P)=>E(m,_,P)};let r;const A=Dr,I=!Ul.jitless,c=I&&nN.value,h=e.catchall;let p;n._zod.parse=(m,y)=>{p??(p=i.value);const w=m.value;return A(w)?I&&c&&y?.async===!1&&y.jitless!==!0?(r||(r=o(e.shape)),m=r(m,y),h?$p([],w,m,y,p,n):m):t(m,y):(m.issues.push({expected:"object",code:"invalid_type",input:w,inst:n}),m)}});function qp(n,e,t,i){for(const r of n)if(r.issues.length===0)return e.value=r.value,e;const o=n.filter(r=>!ss(r));return o.length===1?(e.value=o[0].value,o[0]):(e.issues.push({code:"invalid_union",input:e.value,inst:t,errors:n.map(r=>r.issues.map(A=>Yi(A,i,Ui())))}),e)}const Jp=$("$ZodUnion",(n,e)=>{zt.init(n,e),At(n._zod,"optin",()=>e.options.some(i=>i._zod.optin==="optional")?"optional":void 0),At(n._zod,"optout",()=>e.options.some(i=>i._zod.optout==="optional")?"optional":void 0),At(n._zod,"values",()=>{if(e.options.every(i=>i._zod.values))return new Set(e.options.flatMap(i=>Array.from(i._zod.values)))}),At(n._zod,"pattern",()=>{if(e.options.every(i=>i._zod.pattern)){const i=e.options.map(o=>o._zod.pattern);return new RegExp(`^(${i.map(o=>Kl(o.source)).join("|")})$`)}});const t=e.options.length===1?e.options[0]._zod.run:null;n._zod.parse=(i,o)=>{if(t)return t(i,o);let r=!1;const A=[];for(const I of e.options){const l=I._zod.run({value:i.value,issues:[]},o);if(l instanceof Promise)A.push(l),r=!0;else{if(l.issues.length===0)return l;A.push(l)}}return r?Promise.all(A).then(I=>qp(I,i,n,o)):qp(A,i,n,o)}}),UD=$("$ZodDiscriminatedUnion",(n,e)=>{e.inclusive=!1,Jp.init(n,e);const t=n._zod.parse;At(n._zod,"propValues",()=>{const o={};for(const r of e.options){const A=r._zod.propValues;if(!A||Object.keys(A).length===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(r)}"`);for(const[I,l]of Object.entries(A)){o[I]||(o[I]=new Set);for(const c of l)o[I].add(c)}}return o});const i=RA(()=>{const o=e.options,r=new Map;for(const A of o){const I=A._zod.propValues?.[e.discriminator];if(!I||I.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(A)}"`);for(const l of I){if(r.has(l))throw new Error(`Duplicate discriminator value "${String(l)}"`);r.set(l,A)}}return r});n._zod.parse=(o,r)=>{const A=o.value;if(!Dr(A))return o.issues.push({code:"invalid_type",expected:"object",input:A,inst:n}),o;const I=i.value.get(A?.[e.discriminator]);return I?I._zod.run(o,r):e.unionFallback||r.direction==="backward"?t(o,r):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:e.discriminator,options:Array.from(i.value.keys()),input:A,path:[e.discriminator],inst:n}),o)}}),YD=$("$ZodIntersection",(n,e)=>{zt.init(n,e),n._zod.parse=(t,i)=>{const o=t.value,r=e.left._zod.run({value:o,issues:[]},i),A=e.right._zod.run({value:o,issues:[]},i);return r instanceof Promise||A instanceof Promise?Promise.all([r,A]).then(([l,c])=>em(t,l,c)):em(t,r,A)}});function ql(n,e){if(n===e)return{valid:!0,data:n};if(n instanceof Date&&e instanceof Date&&+n==+e)return{valid:!0,data:n};if(gs(n)&&gs(e)){const t=Object.keys(e),i=Object.keys(n).filter(r=>t.indexOf(r)!==-1),o={...n,...e};for(const r of i){const A=ql(n[r],e[r]);if(!A.valid)return{valid:!1,mergeErrorPath:[r,...A.mergeErrorPath]};o[r]=A.data}return{valid:!0,data:o}}if(Array.isArray(n)&&Array.isArray(e)){if(n.length!==e.length)return{valid:!1,mergeErrorPath:[]};const t=[];for(let i=0;iI.l&&I.r).map(([I])=>I);if(r.length&&o&&n.issues.push({...o,keys:r}),ss(n))return n;const A=ql(e.value,t.value);if(!A.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(A.mergeErrorPath)}`);return n.value=A.data,n}const HD=$("$ZodRecord",(n,e)=>{zt.init(n,e),n._zod.parse=(t,i)=>{const o=t.value;if(!gs(o))return t.issues.push({expected:"record",code:"invalid_type",input:o,inst:n}),t;const r=[],A=e.keyType._zod.values;if(A){t.value={};const I=new Set;for(const c of A)if(typeof c=="string"||typeof c=="number"||typeof c=="symbol"){I.add(typeof c=="number"?c.toString():c);const h=e.keyType._zod.run({value:c,issues:[]},i);if(h instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(h.issues.length){t.issues.push({code:"invalid_key",origin:"record",issues:h.issues.map(y=>Yi(y,i,Ui())),input:c,path:[c],inst:n});continue}const p=h.value,m=e.valueType._zod.run({value:o[c],issues:[]},i);m instanceof Promise?r.push(m.then(y=>{y.issues.length&&t.issues.push(...rs(c,y.issues)),t.value[p]=y.value})):(m.issues.length&&t.issues.push(...rs(c,m.issues)),t.value[p]=m.value)}let l;for(const c in o)I.has(c)||(l=l??[],l.push(c));l&&l.length>0&&t.issues.push({code:"unrecognized_keys",input:o,inst:n,keys:l})}else{t.value={};for(const I of Reflect.ownKeys(o)){if(I==="__proto__"||!Object.prototype.propertyIsEnumerable.call(o,I))continue;let l=e.keyType._zod.run({value:I,issues:[]},i);if(l instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof I=="string"&&Vp.test(I)&&l.issues.length){const p=e.keyType._zod.run({value:Number(I),issues:[]},i);if(p instanceof Promise)throw new Error("Async schemas not supported in object keys currently");p.issues.length===0&&(l=p)}if(l.issues.length){e.mode==="loose"?t.value[I]=o[I]:t.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(p=>Yi(p,i,Ui())),input:I,path:[I],inst:n});continue}const h=e.valueType._zod.run({value:o[I],issues:[]},i);h instanceof Promise?r.push(h.then(p=>{p.issues.length&&t.issues.push(...rs(I,p.issues)),t.value[l.value]=p.value})):(h.issues.length&&t.issues.push(...rs(I,h.issues)),t.value[l.value]=h.value)}}return r.length?Promise.all(r).then(()=>t):t}}),KD=$("$ZodEnum",(n,e)=>{zt.init(n,e);const t=Mp(e.entries),i=new Set(t);n._zod.values=i,n._zod.pattern=new RegExp(`^(${t.filter(o=>iN.has(typeof o)).map(o=>typeof o=="string"?os(o):o.toString()).join("|")})$`),n._zod.parse=(o,r)=>{const A=o.value;return i.has(A)||o.issues.push({code:"invalid_value",values:t,input:A,inst:n}),o}}),WD=$("$ZodLiteral",(n,e)=>{if(zt.init(n,e),e.values.length===0)throw new Error("Cannot create literal schema with no valid values");const t=new Set(e.values);n._zod.values=t,n._zod.pattern=new RegExp(`^(${e.values.map(i=>typeof i=="string"?os(i):i?os(i.toString()):String(i)).join("|")})$`),n._zod.parse=(i,o)=>{const r=i.value;return t.has(r)||i.issues.push({code:"invalid_value",values:e.values,input:r,inst:n}),i}}),QD=$("$ZodTransform",(n,e)=>{zt.init(n,e),n._zod.optin="optional",n._zod.parse=(t,i)=>{if(i.direction==="backward")throw new Dp(n.constructor.name);const o=e.transform(t.value,t);if(i.async)return(o instanceof Promise?o:Promise.resolve(o)).then(A=>(t.value=A,t.fallback=!0,t));if(o instanceof Promise)throw new is;return t.value=o,t.fallback=!0,t}});function tm(n,e){return e===void 0&&(n.issues.length||n.fallback)?{issues:[],value:void 0}:n}const nm=$("$ZodOptional",(n,e)=>{zt.init(n,e),n._zod.optin="optional",n._zod.optout="optional",At(n._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),At(n._zod,"pattern",()=>{const t=e.innerType._zod.pattern;return t?new RegExp(`^(${Kl(t.source)})?$`):void 0}),n._zod.parse=(t,i)=>{if(e.innerType._zod.optin==="optional"){const o=t.value,r=e.innerType._zod.run(t,i);return r instanceof Promise?r.then(A=>tm(A,o)):tm(r,o)}return t.value===void 0?t:e.innerType._zod.run(t,i)}}),XD=$("$ZodExactOptional",(n,e)=>{nm.init(n,e),At(n._zod,"values",()=>e.innerType._zod.values),At(n._zod,"pattern",()=>e.innerType._zod.pattern),n._zod.parse=(t,i)=>e.innerType._zod.run(t,i)}),$D=$("$ZodNullable",(n,e)=>{zt.init(n,e),At(n._zod,"optin",()=>e.innerType._zod.optin),At(n._zod,"optout",()=>e.innerType._zod.optout),At(n._zod,"pattern",()=>{const t=e.innerType._zod.pattern;return t?new RegExp(`^(${Kl(t.source)}|null)$`):void 0}),At(n._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,null]):void 0),n._zod.parse=(t,i)=>t.value===null?t:e.innerType._zod.run(t,i)}),qD=$("$ZodDefault",(n,e)=>{zt.init(n,e),n._zod.optin="optional",At(n._zod,"values",()=>e.innerType._zod.values),n._zod.parse=(t,i)=>{if(i.direction==="backward")return e.innerType._zod.run(t,i);if(t.value===void 0)return t.value=e.defaultValue,t;const o=e.innerType._zod.run(t,i);return o instanceof Promise?o.then(r=>im(r,e)):im(o,e)}});function im(n,e){return n.value===void 0&&(n.value=e.defaultValue),n}const JD=$("$ZodPrefault",(n,e)=>{zt.init(n,e),n._zod.optin="optional",At(n._zod,"values",()=>e.innerType._zod.values),n._zod.parse=(t,i)=>(i.direction==="backward"||t.value===void 0&&(t.value=e.defaultValue),e.innerType._zod.run(t,i))}),eM=$("$ZodNonOptional",(n,e)=>{zt.init(n,e),At(n._zod,"values",()=>{const t=e.innerType._zod.values;return t?new Set([...t].filter(i=>i!==void 0)):void 0}),n._zod.parse=(t,i)=>{const o=e.innerType._zod.run(t,i);return o instanceof Promise?o.then(r=>gm(r,n)):gm(o,n)}});function gm(n,e){return!n.issues.length&&n.value===void 0&&n.issues.push({code:"invalid_type",expected:"nonoptional",input:n.value,inst:e}),n}const tM=$("$ZodCatch",(n,e)=>{zt.init(n,e),n._zod.optin="optional",At(n._zod,"optout",()=>e.innerType._zod.optout),At(n._zod,"values",()=>e.innerType._zod.values),n._zod.parse=(t,i)=>{if(i.direction==="backward")return e.innerType._zod.run(t,i);const o=e.innerType._zod.run(t,i);return o instanceof Promise?o.then(r=>(t.value=r.value,r.issues.length&&(t.value=e.catchValue({...t,error:{issues:r.issues.map(A=>Yi(A,i,Ui()))},input:t.value}),t.issues=[],t.fallback=!0),t)):(t.value=o.value,o.issues.length&&(t.value=e.catchValue({...t,error:{issues:o.issues.map(r=>Yi(r,i,Ui()))},input:t.value}),t.issues=[],t.fallback=!0),t)}}),nM=$("$ZodPipe",(n,e)=>{zt.init(n,e),At(n._zod,"values",()=>e.in._zod.values),At(n._zod,"optin",()=>e.in._zod.optin),At(n._zod,"optout",()=>e.out._zod.optout),At(n._zod,"propValues",()=>e.in._zod.propValues),n._zod.parse=(t,i)=>{if(i.direction==="backward"){const r=e.out._zod.run(t,i);return r instanceof Promise?r.then(A=>LA(A,e.in,i)):LA(r,e.in,i)}const o=e.in._zod.run(t,i);return o instanceof Promise?o.then(r=>LA(r,e.out,i)):LA(o,e.out,i)}});function LA(n,e,t){return n.issues.length?(n.aborted=!0,n):e._zod.run({value:n.value,issues:n.issues,fallback:n.fallback},t)}const iM=$("$ZodReadonly",(n,e)=>{zt.init(n,e),At(n._zod,"propValues",()=>e.innerType._zod.propValues),At(n._zod,"values",()=>e.innerType._zod.values),At(n._zod,"optin",()=>e.innerType?._zod?.optin),At(n._zod,"optout",()=>e.innerType?._zod?.optout),n._zod.parse=(t,i)=>{if(i.direction==="backward")return e.innerType._zod.run(t,i);const o=e.innerType._zod.run(t,i);return o instanceof Promise?o.then(om):om(o)}});function om(n){return n.value=Object.freeze(n.value),n}const gM=$("$ZodCustom",(n,e)=>{Nn.init(n,e),zt.init(n,e),n._zod.parse=(t,i)=>t,n._zod.check=t=>{const i=t.value,o=e.fn(i);if(o instanceof Promise)return o.then(r=>sm(r,t,i,n));sm(o,t,i,n)}});function sm(n,e,t,i){if(!n){const o={code:"custom",input:t,inst:i,path:[...i._zod.def.path??[]],continue:!i._zod.def.abort};i._zod.def.params&&(o.params=i._zod.def.params),e.issues.push(Mr(o))}}var rm;class oM{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){const i=t[0];return this._map.set(e,i),i&&typeof i=="object"&&"id"in i&&this._idmap.set(i.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){const t=this._map.get(e);return t&&typeof t=="object"&&"id"in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){const t=e._zod.parent;if(t){const i={...this.get(t)??{}};delete i.id;const o={...i,...this._map.get(e)};return Object.keys(o).length?o:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function sM(){return new oM}(rm=globalThis).__zod_globalRegistry??(rm.__zod_globalRegistry=sM());const zr=globalThis.__zod_globalRegistry;function rM(n,e){return new n({type:"string",...be(e)})}function aM(n,e){return new n({type:"string",format:"email",check:"string_format",abort:!1,...be(e)})}function am(n,e){return new n({type:"string",format:"guid",check:"string_format",abort:!1,...be(e)})}function AM(n,e){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,...be(e)})}function CM(n,e){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...be(e)})}function IM(n,e){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...be(e)})}function lM(n,e){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...be(e)})}function cM(n,e){return new n({type:"string",format:"url",check:"string_format",abort:!1,...be(e)})}function dM(n,e){return new n({type:"string",format:"emoji",check:"string_format",abort:!1,...be(e)})}function uM(n,e){return new n({type:"string",format:"nanoid",check:"string_format",abort:!1,...be(e)})}function hM(n,e){return new n({type:"string",format:"cuid",check:"string_format",abort:!1,...be(e)})}function fM(n,e){return new n({type:"string",format:"cuid2",check:"string_format",abort:!1,...be(e)})}function pM(n,e){return new n({type:"string",format:"ulid",check:"string_format",abort:!1,...be(e)})}function mM(n,e){return new n({type:"string",format:"xid",check:"string_format",abort:!1,...be(e)})}function vM(n,e){return new n({type:"string",format:"ksuid",check:"string_format",abort:!1,...be(e)})}function yM(n,e){return new n({type:"string",format:"ipv4",check:"string_format",abort:!1,...be(e)})}function bM(n,e){return new n({type:"string",format:"ipv6",check:"string_format",abort:!1,...be(e)})}function wM(n,e){return new n({type:"string",format:"cidrv4",check:"string_format",abort:!1,...be(e)})}function xM(n,e){return new n({type:"string",format:"cidrv6",check:"string_format",abort:!1,...be(e)})}function SM(n,e){return new n({type:"string",format:"base64",check:"string_format",abort:!1,...be(e)})}function EM(n,e){return new n({type:"string",format:"base64url",check:"string_format",abort:!1,...be(e)})}function TM(n,e){return new n({type:"string",format:"e164",check:"string_format",abort:!1,...be(e)})}function OM(n,e){return new n({type:"string",format:"jwt",check:"string_format",abort:!1,...be(e)})}function NM(n,e){return new n({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...be(e)})}function DM(n,e){return new n({type:"string",format:"date",check:"string_format",...be(e)})}function MM(n,e){return new n({type:"string",format:"time",check:"string_format",precision:null,...be(e)})}function zM(n,e){return new n({type:"string",format:"duration",check:"string_format",...be(e)})}function kM(n,e){return new n({type:"number",checks:[],...be(e)})}function RM(n,e){return new n({type:"number",check:"number_format",abort:!1,format:"safeint",...be(e)})}function _M(n,e){return new n({type:"boolean",...be(e)})}function jM(n){return new n({type:"unknown"})}function ZM(n,e){return new n({type:"never",...be(e)})}function Am(n,e){return new Yp({check:"less_than",...be(e),value:n,inclusive:!1})}function Jl(n,e){return new Yp({check:"less_than",...be(e),value:n,inclusive:!0})}function Cm(n,e){return new Hp({check:"greater_than",...be(e),value:n,inclusive:!1})}function ec(n,e){return new Hp({check:"greater_than",...be(e),value:n,inclusive:!0})}function Im(n,e){return new qN({check:"multiple_of",...be(e),value:n})}function lm(n,e){return new eD({check:"max_length",...be(e),maximum:n})}function GA(n,e){return new tD({check:"min_length",...be(e),minimum:n})}function cm(n,e){return new nD({check:"length_equals",...be(e),length:n})}function BM(n,e){return new iD({check:"string_format",format:"regex",...be(e),pattern:n})}function PM(n){return new gD({check:"string_format",format:"lowercase",...be(n)})}function LM(n){return new oD({check:"string_format",format:"uppercase",...be(n)})}function GM(n,e){return new sD({check:"string_format",format:"includes",...be(e),includes:n})}function FM(n,e){return new rD({check:"string_format",format:"starts_with",...be(e),prefix:n})}function VM(n,e){return new aD({check:"string_format",format:"ends_with",...be(e),suffix:n})}function as(n){return new AD({check:"overwrite",tx:n})}function UM(n){return as(e=>e.normalize(n))}function YM(){return as(n=>n.trim())}function HM(){return as(n=>n.toLowerCase())}function KM(){return as(n=>n.toUpperCase())}function WM(){return as(n=>tN(n))}function QM(n,e,t){return new n({type:"array",element:e,...be(t)})}function XM(n,e,t){return new n({type:"custom",check:"custom",fn:e,...be(t)})}function $M(n,e){const t=qM(i=>(i.addIssue=o=>{if(typeof o=="string")i.issues.push(Mr(o,i.value,t._zod.def));else{const r=o;r.fatal&&(r.continue=!1),r.code??(r.code="custom"),r.input??(r.input=i.value),r.inst??(r.inst=t),r.continue??(r.continue=!t._zod.def.abort),i.issues.push(Mr(r))}},n(i.value,i)),e);return t}function qM(n,e){const t=new Nn({check:"custom",...be(e)});return t._zod.check=n,t}function dm(n){let e=n?.target??"draft-2020-12";return e==="draft-4"&&(e="draft-04"),e==="draft-7"&&(e="draft-07"),{processors:n.processors??{},metadataRegistry:n?.metadata??zr,target:e,unrepresentable:n?.unrepresentable??"throw",override:n?.override??(()=>{}),io:n?.io??"output",counter:0,seen:new Map,cycles:n?.cycles??"ref",reused:n?.reused??"inline",external:n?.external??void 0}}function Kt(n,e,t={path:[],schemaPath:[]}){var i;const o=n._zod.def,r=e.seen.get(n);if(r)return r.count++,t.schemaPath.includes(n)&&(r.cycle=t.path),r.schema;const A={schema:{},count:1,cycle:void 0,path:t.path};e.seen.set(n,A);const I=n._zod.toJSONSchema?.();if(I)A.schema=I;else{const h={...t,schemaPath:[...t.schemaPath,n],path:t.path};if(n._zod.processJSONSchema)n._zod.processJSONSchema(e,A.schema,h);else{const m=A.schema,y=e.processors[o.type];if(!y)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);y(n,e,m,h)}const p=n._zod.parent;p&&(A.ref||(A.ref=p),Kt(p,e,h),e.seen.get(p).isParent=!0)}const l=e.metadataRegistry.get(n);return l&&Object.assign(A.schema,l),e.io==="input"&&bn(n)&&(delete A.schema.examples,delete A.schema.default),e.io==="input"&&"_prefault"in A.schema&&((i=A.schema).default??(i.default=A.schema._prefault)),delete A.schema._prefault,e.seen.get(n).schema}function um(n,e){const t=n.seen.get(e);if(!t)throw new Error("Unprocessed schema. This is a bug in Zod.");const i=new Map;for(const A of n.seen.entries()){const I=n.metadataRegistry.get(A[0])?.id;if(I){const l=i.get(I);if(l&&l!==A[0])throw new Error(`Duplicate schema id "${I}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);i.set(I,A[0])}}const o=A=>{const I=n.target==="draft-2020-12"?"$defs":"definitions";if(n.external){const p=n.external.registry.get(A[0])?.id,m=n.external.uri??(w=>w);if(p)return{ref:m(p)};const y=A[1].defId??A[1].schema.id??`schema${n.counter++}`;return A[1].defId=y,{defId:y,ref:`${m("__shared")}#/${I}/${y}`}}if(A[1]===t)return{ref:"#"};const c=`#/${I}/`,h=A[1].schema.id??`__schema${n.counter++}`;return{defId:h,ref:c+h}},r=A=>{if(A[1].schema.$ref)return;const I=A[1],{ref:l,defId:c}=o(A);I.def={...I.schema},c&&(I.defId=c);const h=I.schema;for(const p in h)delete h[p];h.$ref=l};if(n.cycles==="throw")for(const A of n.seen.entries()){const I=A[1];if(I.cycle)throw new Error(`Cycle detected: #/${I.cycle?.join("/")}/ -Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const A of n.seen.entries()){const I=A[1];if(e===A[0]){r(A);continue}if(n.external){const c=n.external.registry.get(A[0])?.id;if(e!==A[0]&&c){r(A);continue}}if(n.metadataRegistry.get(A[0])?.id){r(A);continue}if(I.cycle){r(A);continue}if(I.count>1&&n.reused==="ref"){r(A);continue}}}function um(n,e){const t=n.seen.get(e);if(!t)throw new Error("Unprocessed schema. This is a bug in Zod.");const i=I=>{const l=n.seen.get(I);if(l.ref===null)return;const c=l.def??l.schema,h={...c},p=l.ref;if(l.ref=null,p){i(p);const y=n.seen.get(p),w=y.schema;if(w.$ref&&(n.target==="draft-07"||n.target==="draft-04"||n.target==="openapi-3.0")?(c.allOf=c.allOf??[],c.allOf.push(w)):Object.assign(c,w),Object.assign(c,h),I._zod.parent===p)for(const x in c)x==="$ref"||x==="allOf"||x in h||delete c[x];if(w.$ref&&y.def)for(const x in c)x==="$ref"||x==="allOf"||x in y.def&&JSON.stringify(c[x])===JSON.stringify(y.def[x])&&delete c[x]}const m=I._zod.parent;if(m&&m!==p){i(m);const y=n.seen.get(m);if(y?.schema.$ref&&(c.$ref=y.schema.$ref,y.def))for(const w in c)w==="$ref"||w==="allOf"||w in y.def&&JSON.stringify(c[w])===JSON.stringify(y.def[w])&&delete c[w]}n.override({zodSchema:I,jsonSchema:c,path:l.path??[]})};for(const I of[...n.seen.entries()].reverse())i(I[0]);const o={};if(n.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":n.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":n.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":n.target,n.external?.uri){const I=n.external.registry.get(e)?.id;if(!I)throw new Error("Schema is missing an `id` property");o.$id=n.external.uri(I)}Object.assign(o,t.def??t.schema);const r=n.metadataRegistry.get(e)?.id;r!==void 0&&o.id===r&&delete o.id;const A=n.external?.defs??{};for(const I of n.seen.entries()){const l=I[1];l.def&&l.defId&&(l.def.id===l.defId&&delete l.def.id,A[l.defId]=l.def)}n.external||Object.keys(A).length>0&&(n.target==="draft-2020-12"?o.$defs=A:o.definitions=A);try{const I=JSON.parse(JSON.stringify(o));return Object.defineProperty(I,"~standard",{value:{...e["~standard"],jsonSchema:{input:LA(e,"input",n.processors),output:LA(e,"output",n.processors)}},enumerable:!1,writable:!1}),I}catch{throw new Error("Error converting schema to JSON.")}}function bn(n,e){const t=e??{seen:new Set};if(t.seen.has(n))return!1;t.seen.add(n);const i=n._zod.def;if(i.type==="transform")return!0;if(i.type==="array")return bn(i.element,t);if(i.type==="set")return bn(i.valueType,t);if(i.type==="lazy")return bn(i.getter(),t);if(i.type==="promise"||i.type==="optional"||i.type==="nonoptional"||i.type==="nullable"||i.type==="readonly"||i.type==="default"||i.type==="prefault")return bn(i.innerType,t);if(i.type==="intersection")return bn(i.left,t)||bn(i.right,t);if(i.type==="record"||i.type==="map")return bn(i.keyType,t)||bn(i.valueType,t);if(i.type==="pipe")return n._zod.traits.has("$ZodCodec")?!0:bn(i.in,t)||bn(i.out,t);if(i.type==="object"){for(const o in i.shape)if(bn(i.shape[o],t))return!0;return!1}if(i.type==="union"){for(const o of i.options)if(bn(o,t))return!0;return!1}if(i.type==="tuple"){for(const o of i.items)if(bn(o,t))return!0;return!!(i.rest&&bn(i.rest,t))}return!1}const JM=(n,e={})=>t=>{const i=cm({...t,processors:e});return Kt(n,i),dm(i,n),um(i,n)},LA=(n,e,t={})=>i=>{const{libraryOptions:o,target:r}=i??{},A=cm({...o??{},target:r,io:e,processors:t});return Kt(n,A),dm(A,n),um(A,n)},ez={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},tz=(n,e,t,i)=>{const o=t;o.type="string";const{minimum:r,maximum:A,format:I,patterns:l,contentEncoding:c}=n._zod.bag;if(typeof r=="number"&&(o.minLength=r),typeof A=="number"&&(o.maxLength=A),I&&(o.format=ez[I]??I,o.format===""&&delete o.format,I==="time"&&delete o.format),c&&(o.contentEncoding=c),l&&l.size>0){const h=[...l];h.length===1?o.pattern=h[0].source:h.length>1&&(o.allOf=[...h.map(p=>({...e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"?{type:"string"}:{},pattern:p.source}))])}},nz=(n,e,t,i)=>{const o=t,{minimum:r,maximum:A,format:I,multipleOf:l,exclusiveMaximum:c,exclusiveMinimum:h}=n._zod.bag;typeof I=="string"&&I.includes("int")?o.type="integer":o.type="number";const p=typeof h=="number"&&h>=(r??Number.NEGATIVE_INFINITY),m=typeof c=="number"&&c<=(A??Number.POSITIVE_INFINITY),y=e.target==="draft-04"||e.target==="openapi-3.0";p?y?(o.minimum=h,o.exclusiveMinimum=!0):o.exclusiveMinimum=h:typeof r=="number"&&(o.minimum=r),m?y?(o.maximum=c,o.exclusiveMaximum=!0):o.exclusiveMaximum=c:typeof A=="number"&&(o.maximum=A),typeof l=="number"&&(o.multipleOf=l)},iz=(n,e,t,i)=>{t.type="boolean"},gz=(n,e,t,i)=>{t.not={}},oz=(n,e,t,i)=>{},sz=(n,e,t,i)=>{const o=n._zod.def,r=Dp(o.entries);r.every(A=>typeof A=="number")&&(t.type="number"),r.every(A=>typeof A=="string")&&(t.type="string"),t.enum=r},rz=(n,e,t,i)=>{const o=n._zod.def,r=[];for(const A of o.values)if(A===void 0){if(e.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof A=="bigint"){if(e.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");r.push(Number(A))}else r.push(A);if(r.length!==0)if(r.length===1){const A=r[0];t.type=A===null?"null":typeof A,e.target==="draft-04"||e.target==="openapi-3.0"?t.enum=[A]:t.const=A}else r.every(A=>typeof A=="number")&&(t.type="number"),r.every(A=>typeof A=="string")&&(t.type="string"),r.every(A=>typeof A=="boolean")&&(t.type="boolean"),r.every(A=>A===null)&&(t.type="null"),t.enum=r},az=(n,e,t,i)=>{if(e.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},Az=(n,e,t,i)=>{if(e.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},Cz=(n,e,t,i)=>{const o=t,r=n._zod.def,{minimum:A,maximum:I}=n._zod.bag;typeof A=="number"&&(o.minItems=A),typeof I=="number"&&(o.maxItems=I),o.type="array",o.items=Kt(r.element,e,{...i,path:[...i.path,"items"]})},Iz=(n,e,t,i)=>{const o=t,r=n._zod.def;o.type="object",o.properties={};const A=r.shape;for(const c in A)o.properties[c]=Kt(A[c],e,{...i,path:[...i.path,"properties",c]});const I=new Set(Object.keys(A)),l=new Set([...I].filter(c=>{const h=r.shape[c]._zod;return e.io==="input"?h.optin===void 0:h.optout===void 0}));l.size>0&&(o.required=Array.from(l)),r.catchall?._zod.def.type==="never"?o.additionalProperties=!1:r.catchall?r.catchall&&(o.additionalProperties=Kt(r.catchall,e,{...i,path:[...i.path,"additionalProperties"]})):e.io==="output"&&(o.additionalProperties=!1)},lz=(n,e,t,i)=>{const o=n._zod.def,r=o.inclusive===!1,A=o.options.map((I,l)=>Kt(I,e,{...i,path:[...i.path,r?"oneOf":"anyOf",l]}));r?t.oneOf=A:t.anyOf=A},cz=(n,e,t,i)=>{const o=n._zod.def,r=Kt(o.left,e,{...i,path:[...i.path,"allOf",0]}),A=Kt(o.right,e,{...i,path:[...i.path,"allOf",1]}),I=c=>"allOf"in c&&Object.keys(c).length===1,l=[...I(r)?r.allOf:[r],...I(A)?A.allOf:[A]];t.allOf=l},dz=(n,e,t,i)=>{const o=t,r=n._zod.def;o.type="object";const A=r.keyType,l=A._zod.bag?.patterns;if(r.mode==="loose"&&l&&l.size>0){const h=Kt(r.valueType,e,{...i,path:[...i.path,"patternProperties","*"]});o.patternProperties={};for(const p of l)o.patternProperties[p.source]=h}else(e.target==="draft-07"||e.target==="draft-2020-12")&&(o.propertyNames=Kt(r.keyType,e,{...i,path:[...i.path,"propertyNames"]})),o.additionalProperties=Kt(r.valueType,e,{...i,path:[...i.path,"additionalProperties"]});const c=A._zod.values;if(c){const h=[...c].filter(p=>typeof p=="string"||typeof p=="number");h.length>0&&(o.required=h)}},uz=(n,e,t,i)=>{const o=n._zod.def,r=Kt(o.innerType,e,i),A=e.seen.get(n);e.target==="openapi-3.0"?(A.ref=o.innerType,t.nullable=!0):t.anyOf=[r,{type:"null"}]},hz=(n,e,t,i)=>{const o=n._zod.def;Kt(o.innerType,e,i);const r=e.seen.get(n);r.ref=o.innerType},fz=(n,e,t,i)=>{const o=n._zod.def;Kt(o.innerType,e,i);const r=e.seen.get(n);r.ref=o.innerType,t.default=JSON.parse(JSON.stringify(o.defaultValue))},pz=(n,e,t,i)=>{const o=n._zod.def;Kt(o.innerType,e,i);const r=e.seen.get(n);r.ref=o.innerType,e.io==="input"&&(t._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},mz=(n,e,t,i)=>{const o=n._zod.def;Kt(o.innerType,e,i);const r=e.seen.get(n);r.ref=o.innerType;let A;try{A=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}t.default=A},vz=(n,e,t,i)=>{const o=n._zod.def,r=o.in._zod.traits.has("$ZodTransform"),A=e.io==="input"?r?o.out:o.in:o.out;Kt(A,e,i);const I=e.seen.get(n);I.ref=A},yz=(n,e,t,i)=>{const o=n._zod.def;Kt(o.innerType,e,i);const r=e.seen.get(n);r.ref=o.innerType,t.readOnly=!0},hm=(n,e,t,i)=>{const o=n._zod.def;Kt(o.innerType,e,i);const r=e.seen.get(n);r.ref=o.innerType},bz=$("ZodISODateTime",(n,e)=>{wD.init(n,e),Rt.init(n,e)});function wz(n){return NM(bz,n)}const xz=$("ZodISODate",(n,e)=>{xD.init(n,e),Rt.init(n,e)});function Sz(n){return DM(xz,n)}const Ez=$("ZodISOTime",(n,e)=>{SD.init(n,e),Rt.init(n,e)});function Tz(n){return MM(Ez,n)}const Oz=$("ZodISODuration",(n,e)=>{ED.init(n,e),Rt.init(n,e)});function Nz(n){return zM(Oz,n)}const qn=$("ZodError",(n,e)=>{jp.init(n,e),n.name="ZodError",Object.defineProperties(n,{format:{value:t=>uN(n,t)},flatten:{value:t=>dN(n,t)},addIssue:{value:t=>{n.issues.push(t),n.message=JSON.stringify(n.issues,Ul,2)}},addIssues:{value:t=>{n.issues.push(...t),n.message=JSON.stringify(n.issues,Ul,2)}},isEmpty:{get(){return n.issues.length===0}}})},{Parent:Error}),Dz=Wl(qn),Mz=Ql(qn),zz=RA(qn),kz=_A(qn),Rz=pN(qn),_z=mN(qn),jz=vN(qn),Zz=yN(qn),Bz=bN(qn),Pz=wN(qn),Lz=xN(qn),Gz=SN(qn),fm=new WeakMap;function zr(n,e,t){const i=Object.getPrototypeOf(n);let o=fm.get(i);if(o||(o=new Set,fm.set(i,o)),!o.has(e)){o.add(e);for(const r in t){const A=t[r];Object.defineProperty(i,r,{configurable:!0,enumerable:!1,get(){const I=A.bind(this);return Object.defineProperty(this,r,{configurable:!0,writable:!0,enumerable:!0,value:I}),I},set(I){Object.defineProperty(this,r,{configurable:!0,writable:!0,enumerable:!0,value:I})}})}}}const kt=$("ZodType",(n,e)=>(zt.init(n,e),Object.assign(n["~standard"],{jsonSchema:{input:LA(n,"input"),output:LA(n,"output")}}),n.toJSONSchema=JM(n,{}),n.def=e,n.type=e.type,Object.defineProperty(n,"_def",{value:e}),n.parse=(t,i)=>Dz(n,t,i,{callee:n.parse}),n.safeParse=(t,i)=>zz(n,t,i),n.parseAsync=async(t,i)=>Mz(n,t,i,{callee:n.parseAsync}),n.safeParseAsync=async(t,i)=>kz(n,t,i),n.spa=n.safeParseAsync,n.encode=(t,i)=>Rz(n,t,i),n.decode=(t,i)=>_z(n,t,i),n.encodeAsync=async(t,i)=>jz(n,t,i),n.decodeAsync=async(t,i)=>Zz(n,t,i),n.safeEncode=(t,i)=>Bz(n,t,i),n.safeDecode=(t,i)=>Pz(n,t,i),n.safeEncodeAsync=async(t,i)=>Lz(n,t,i),n.safeDecodeAsync=async(t,i)=>Gz(n,t,i),zr(n,"ZodType",{check(...t){const i=this.def;return this.clone(vg(i,{checks:[...i.checks??[],...t.map(o=>typeof o=="function"?{_zod:{check:o,def:{check:"custom"},onattach:[]}}:o)]}),{parent:!0})},with(...t){return this.check(...t)},clone(t,i){return yg(this,t,i)},brand(){return this},register(t,i){return t.add(this,i),this},refine(t,i){return this.check(Mk(t,i))},superRefine(t,i){return this.check(zk(t,i))},overwrite(t){return this.check(rs(t))},optional(){return Om(this)},exactOptional(){return pk(this)},nullable(){return Nm(this)},nullish(){return Om(Nm(this))},nonoptional(t){return xk(this,t)},array(){return Ge(this)},or(t){return Sm([this,t])},and(t){return ck(this,t)},transform(t){return Mm(this,hk(t))},default(t){return yk(this,t)},prefault(t){return wk(this,t)},catch(t){return Ek(this,t)},pipe(t){return Mm(this,t)},readonly(){return Nk(this)},describe(t){const i=this.clone();return Mr.add(i,{description:t}),i},meta(...t){if(t.length===0)return Mr.get(this);const i=this.clone();return Mr.add(i,t[0]),i},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(t){return t(this)}}),Object.defineProperty(n,"description",{get(){return Mr.get(n)?.description},configurable:!0}),n)),pm=$("_ZodString",(n,e)=>{Xl.init(n,e),kt.init(n,e),n._zod.processJSONSchema=(i,o,r)=>tz(n,i,o);const t=n._zod.bag;n.format=t.format??null,n.minLength=t.minimum??null,n.maxLength=t.maximum??null,zr(n,"_ZodString",{regex(...i){return this.check(BM(...i))},includes(...i){return this.check(GM(...i))},startsWith(...i){return this.check(FM(...i))},endsWith(...i){return this.check(VM(...i))},min(...i){return this.check(PA(...i))},max(...i){return this.check(Im(...i))},length(...i){return this.check(lm(...i))},nonempty(...i){return this.check(PA(1,...i))},lowercase(i){return this.check(PM(i))},uppercase(i){return this.check(LM(i))},trim(){return this.check(YM())},normalize(...i){return this.check(UM(...i))},toLowerCase(){return this.check(HM())},toUpperCase(){return this.check(KM())},slugify(){return this.check(WM())}})}),Fz=$("ZodString",(n,e)=>{Xl.init(n,e),pm.init(n,e),n.email=t=>n.check(aM(Vz,t)),n.url=t=>n.check(cM(Uz,t)),n.jwt=t=>n.check(OM(ok,t)),n.emoji=t=>n.check(dM(Yz,t)),n.guid=t=>n.check(rm(mm,t)),n.uuid=t=>n.check(AM(GA,t)),n.uuidv4=t=>n.check(CM(GA,t)),n.uuidv6=t=>n.check(IM(GA,t)),n.uuidv7=t=>n.check(lM(GA,t)),n.nanoid=t=>n.check(uM(Hz,t)),n.guid=t=>n.check(rm(mm,t)),n.cuid=t=>n.check(hM(Kz,t)),n.cuid2=t=>n.check(fM(Wz,t)),n.ulid=t=>n.check(pM(Qz,t)),n.base64=t=>n.check(SM(nk,t)),n.base64url=t=>n.check(EM(ik,t)),n.xid=t=>n.check(mM(Xz,t)),n.ksuid=t=>n.check(vM($z,t)),n.ipv4=t=>n.check(yM(qz,t)),n.ipv6=t=>n.check(bM(Jz,t)),n.cidrv4=t=>n.check(wM(ek,t)),n.cidrv6=t=>n.check(xM(tk,t)),n.e164=t=>n.check(TM(gk,t)),n.datetime=t=>n.check(wz(t)),n.date=t=>n.check(Sz(t)),n.time=t=>n.check(Tz(t)),n.duration=t=>n.check(Nz(t))});function H(n){return rM(Fz,n)}const Rt=$("ZodStringFormat",(n,e)=>{Tt.init(n,e),pm.init(n,e)}),Vz=$("ZodEmail",(n,e)=>{dD.init(n,e),Rt.init(n,e)}),mm=$("ZodGUID",(n,e)=>{lD.init(n,e),Rt.init(n,e)}),GA=$("ZodUUID",(n,e)=>{cD.init(n,e),Rt.init(n,e)}),Uz=$("ZodURL",(n,e)=>{uD.init(n,e),Rt.init(n,e)}),Yz=$("ZodEmoji",(n,e)=>{hD.init(n,e),Rt.init(n,e)}),Hz=$("ZodNanoID",(n,e)=>{fD.init(n,e),Rt.init(n,e)}),Kz=$("ZodCUID",(n,e)=>{pD.init(n,e),Rt.init(n,e)}),Wz=$("ZodCUID2",(n,e)=>{mD.init(n,e),Rt.init(n,e)}),Qz=$("ZodULID",(n,e)=>{vD.init(n,e),Rt.init(n,e)}),Xz=$("ZodXID",(n,e)=>{yD.init(n,e),Rt.init(n,e)}),$z=$("ZodKSUID",(n,e)=>{bD.init(n,e),Rt.init(n,e)}),qz=$("ZodIPv4",(n,e)=>{TD.init(n,e),Rt.init(n,e)}),Jz=$("ZodIPv6",(n,e)=>{OD.init(n,e),Rt.init(n,e)}),ek=$("ZodCIDRv4",(n,e)=>{ND.init(n,e),Rt.init(n,e)}),tk=$("ZodCIDRv6",(n,e)=>{DD.init(n,e),Rt.init(n,e)}),nk=$("ZodBase64",(n,e)=>{MD.init(n,e),Rt.init(n,e)}),ik=$("ZodBase64URL",(n,e)=>{kD.init(n,e),Rt.init(n,e)}),gk=$("ZodE164",(n,e)=>{RD.init(n,e),Rt.init(n,e)}),ok=$("ZodJWT",(n,e)=>{jD.init(n,e),Rt.init(n,e)}),vm=$("ZodNumber",(n,e)=>{Kp.init(n,e),kt.init(n,e),n._zod.processJSONSchema=(i,o,r)=>nz(n,i,o),zr(n,"ZodNumber",{gt(i,o){return this.check(Am(i,o))},gte(i,o){return this.check(Jl(i,o))},min(i,o){return this.check(Jl(i,o))},lt(i,o){return this.check(am(i,o))},lte(i,o){return this.check(ql(i,o))},max(i,o){return this.check(ql(i,o))},int(i){return this.check(ym(i))},safe(i){return this.check(ym(i))},positive(i){return this.check(Am(0,i))},nonnegative(i){return this.check(Jl(0,i))},negative(i){return this.check(am(0,i))},nonpositive(i){return this.check(ql(0,i))},multipleOf(i,o){return this.check(Cm(i,o))},step(i,o){return this.check(Cm(i,o))},finite(){return this}});const t=n._zod.bag;n.minValue=Math.max(t.minimum??Number.NEGATIVE_INFINITY,t.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,n.maxValue=Math.min(t.maximum??Number.POSITIVE_INFINITY,t.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,n.isInt=(t.format??"").includes("int")||Number.isSafeInteger(t.multipleOf??.5),n.isFinite=!0,n.format=t.format??null});function pe(n){return kM(vm,n)}const sk=$("ZodNumberFormat",(n,e)=>{ZD.init(n,e),vm.init(n,e)});function ym(n){return RM(sk,n)}const rk=$("ZodBoolean",(n,e)=>{BD.init(n,e),kt.init(n,e),n._zod.processJSONSchema=(t,i,o)=>iz(n,t,i)});function Ln(n){return _M(rk,n)}const ak=$("ZodUnknown",(n,e)=>{PD.init(n,e),kt.init(n,e),n._zod.processJSONSchema=(t,i,o)=>oz()});function uo(){return jM(ak)}const Ak=$("ZodNever",(n,e)=>{LD.init(n,e),kt.init(n,e),n._zod.processJSONSchema=(t,i,o)=>gz(n,t,i)});function bm(n){return ZM(Ak,n)}const Ck=$("ZodArray",(n,e)=>{GD.init(n,e),kt.init(n,e),n._zod.processJSONSchema=(t,i,o)=>Cz(n,t,i,o),n.element=e.element,zr(n,"ZodArray",{min(t,i){return this.check(PA(t,i))},nonempty(t){return this.check(PA(1,t))},max(t,i){return this.check(Im(t,i))},length(t,i){return this.check(lm(t,i))},unwrap(){return this.element}})});function Ge(n,e){return QM(Ck,n,e)}const wm=$("ZodObject",(n,e)=>{VD.init(n,e),kt.init(n,e),n._zod.processJSONSchema=(t,i,o)=>Iz(n,t,i,o),rt(n,"shape",()=>e.shape),zr(n,"ZodObject",{keyof(){return It(Object.keys(this._zod.def.shape))},catchall(t){return this.clone({...this._zod.def,catchall:t})},passthrough(){return this.clone({...this._zod.def,catchall:uo()})},loose(){return this.clone({...this._zod.def,catchall:uo()})},strict(){return this.clone({...this._zod.def,catchall:bm()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(t){return aN(this,t)},safeExtend(t){return AN(this,t)},merge(t){return CN(this,t)},pick(t){return sN(this,t)},omit(t){return rN(this,t)},partial(...t){return IN(Tm,this,t[0])},required(...t){return lN(Dm,this,t[0])}})});function pt(n,e){const t={type:"object",shape:n??{},...we(e)};return new wm(t)}function Se(n,e){return new wm({type:"object",shape:n,catchall:bm(),...we(e)})}const xm=$("ZodUnion",(n,e)=>{qp.init(n,e),kt.init(n,e),n._zod.processJSONSchema=(t,i,o)=>lz(n,t,i,o),n.options=e.options});function Sm(n,e){return new xm({type:"union",options:n,...we(e)})}const Ik=$("ZodDiscriminatedUnion",(n,e)=>{xm.init(n,e),UD.init(n,e)});function ec(n,e,t){return new Ik({type:"union",options:e,discriminator:n,...we(t)})}const lk=$("ZodIntersection",(n,e)=>{YD.init(n,e),kt.init(n,e),n._zod.processJSONSchema=(t,i,o)=>cz(n,t,i,o)});function ck(n,e){return new lk({type:"intersection",left:n,right:e})}const Em=$("ZodRecord",(n,e)=>{HD.init(n,e),kt.init(n,e),n._zod.processJSONSchema=(t,i,o)=>dz(n,t,i,o),n.keyType=e.keyType,n.valueType=e.valueType});function tc(n,e,t){return!e||!e._zod?new Em({type:"record",keyType:H(),valueType:n,...we(e)}):new Em({type:"record",keyType:n,valueType:e,...we(t)})}const nc=$("ZodEnum",(n,e)=>{KD.init(n,e),kt.init(n,e),n._zod.processJSONSchema=(i,o,r)=>sz(n,i,o),n.enum=e.entries,n.options=Object.values(e.entries);const t=new Set(Object.keys(e.entries));n.extract=(i,o)=>{const r={};for(const A of i)if(t.has(A))r[A]=e.entries[A];else throw new Error(`Key ${A} not found in enum`);return new nc({...e,checks:[],...we(o),entries:r})},n.exclude=(i,o)=>{const r={...e.entries};for(const A of i)if(t.has(A))delete r[A];else throw new Error(`Key ${A} not found in enum`);return new nc({...e,checks:[],...we(o),entries:r})}});function It(n,e){const t=Array.isArray(n)?Object.fromEntries(n.map(i=>[i,i])):n;return new nc({type:"enum",entries:t,...we(e)})}const dk=$("ZodLiteral",(n,e)=>{WD.init(n,e),kt.init(n,e),n._zod.processJSONSchema=(t,i,o)=>rz(n,t,i),n.values=new Set(e.values),Object.defineProperty(n,"value",{get(){if(e.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return e.values[0]}})});function lt(n,e){return new dk({type:"literal",values:Array.isArray(n)?n:[n],...we(e)})}const uk=$("ZodTransform",(n,e)=>{QD.init(n,e),kt.init(n,e),n._zod.processJSONSchema=(t,i,o)=>Az(n,t),n._zod.parse=(t,i)=>{if(i.direction==="backward")throw new Np(n.constructor.name);t.addIssue=r=>{if(typeof r=="string")t.issues.push(Dr(r,t.value,e));else{const A=r;A.fatal&&(A.continue=!1),A.code??(A.code="custom"),A.input??(A.input=t.value),A.inst??(A.inst=n),t.issues.push(Dr(A))}};const o=e.transform(t.value,t);return o instanceof Promise?o.then(r=>(t.value=r,t.fallback=!0,t)):(t.value=o,t.fallback=!0,t)}});function hk(n){return new uk({type:"transform",transform:n})}const Tm=$("ZodOptional",(n,e)=>{tm.init(n,e),kt.init(n,e),n._zod.processJSONSchema=(t,i,o)=>hm(n,t,i,o),n.unwrap=()=>n._zod.def.innerType});function Om(n){return new Tm({type:"optional",innerType:n})}const fk=$("ZodExactOptional",(n,e)=>{XD.init(n,e),kt.init(n,e),n._zod.processJSONSchema=(t,i,o)=>hm(n,t,i,o),n.unwrap=()=>n._zod.def.innerType});function pk(n){return new fk({type:"optional",innerType:n})}const mk=$("ZodNullable",(n,e)=>{$D.init(n,e),kt.init(n,e),n._zod.processJSONSchema=(t,i,o)=>uz(n,t,i,o),n.unwrap=()=>n._zod.def.innerType});function Nm(n){return new mk({type:"nullable",innerType:n})}const vk=$("ZodDefault",(n,e)=>{qD.init(n,e),kt.init(n,e),n._zod.processJSONSchema=(t,i,o)=>fz(n,t,i,o),n.unwrap=()=>n._zod.def.innerType,n.removeDefault=n.unwrap});function yk(n,e){return new vk({type:"default",innerType:n,get defaultValue(){return typeof e=="function"?e():Rp(e)}})}const bk=$("ZodPrefault",(n,e)=>{JD.init(n,e),kt.init(n,e),n._zod.processJSONSchema=(t,i,o)=>pz(n,t,i,o),n.unwrap=()=>n._zod.def.innerType});function wk(n,e){return new bk({type:"prefault",innerType:n,get defaultValue(){return typeof e=="function"?e():Rp(e)}})}const Dm=$("ZodNonOptional",(n,e)=>{eM.init(n,e),kt.init(n,e),n._zod.processJSONSchema=(t,i,o)=>hz(n,t,i,o),n.unwrap=()=>n._zod.def.innerType});function xk(n,e){return new Dm({type:"nonoptional",innerType:n,...we(e)})}const Sk=$("ZodCatch",(n,e)=>{tM.init(n,e),kt.init(n,e),n._zod.processJSONSchema=(t,i,o)=>mz(n,t,i,o),n.unwrap=()=>n._zod.def.innerType,n.removeCatch=n.unwrap});function Ek(n,e){return new Sk({type:"catch",innerType:n,catchValue:typeof e=="function"?e:()=>e})}const Tk=$("ZodPipe",(n,e)=>{nM.init(n,e),kt.init(n,e),n._zod.processJSONSchema=(t,i,o)=>vz(n,t,i,o),n.in=e.in,n.out=e.out});function Mm(n,e){return new Tk({type:"pipe",in:n,out:e})}const Ok=$("ZodReadonly",(n,e)=>{iM.init(n,e),kt.init(n,e),n._zod.processJSONSchema=(t,i,o)=>yz(n,t,i,o),n.unwrap=()=>n._zod.def.innerType});function Nk(n){return new Ok({type:"readonly",innerType:n})}const Dk=$("ZodCustom",(n,e)=>{gM.init(n,e),kt.init(n,e),n._zod.processJSONSchema=(t,i,o)=>az(n,t)});function Mk(n,e={}){return XM(Dk,n,e)}function zk(n,e){return $M(n,e)}const kk="compass.query/1",Rk=["file","module","package","namespace","class","struct","interface","trait","protocol","enum","enum_member","type_alias","function","method","constructor","property","field","variable","constant","parameter","import","export","macro","annotation","route","component","event","message","topic","queue","job","resource","schema","query","migration","config_key","database","database_schema","database_table","database_view","database_column","database_index","database_constraint","database_procedure","database_trigger"],_k=["contains","calls","imports","exports","extends","implements","references","type_of","returns","instantiates","overrides","decorates","routes_to","reads","writes","aliases","registers","handles","publishes","subscribes","produces","consumes","schedules","triggers","tests","depends_on","documents","maps_to"],jk=["controller","route_handler","middleware","service","resolver","consumer","producer","subscriber","repository","model","test","fixture","generated"],Zk=["search","callers","callees","impact","explore","node_trail"],ic=H().min(1).refine(n=>n.includes("\\")||n.startsWith("/")||/^[A-Za-z]:/.test(n)?!1:n.split("/").every(e=>e!==""&&e!=="."&&e!==".."),"source path must be a safe repository-relative path"),kr=Se({file:ic,startByte:pe().int().nonnegative(),endByte:pe().int().nonnegative(),startLine:pe().int().positive(),startColumn:pe().int().nonnegative(),endLine:pe().int().positive(),endColumn:pe().int().nonnegative()}).refine(n=>n.endByte>=n.startByte&&(n.endLine>n.startLine||n.endLine===n.startLine&&n.endColumn>=n.startColumn),"source anchor must be ordered"),Bk=It(Rk),Pk=It(_k),Lk=It(jk),Gk=It(Zk),Fk=It(["structural_graph","program_ir"]),Vk=It(["ast","config","convention","artifact","heuristic"]),gc=It(["exact","inferred","ambiguous"]),oc=It(["exact","ambiguous","unresolved"]),Uk=Se({nodeId:H().min(1),reason:H().min(1),confidence:gc,score:pe().finite().nullable().optional(),anchor:kr.nullable().optional()}),FA=Se({layer:Fk,origin:Vk,extractor:H().min(1),confidence:gc,anchor:kr.nullable(),rule:H().min(1).nullable(),wiringSite:kr.nullable(),resolution:oc,candidates:Ge(Uk).max(20).default([])}),Yk=Se({type:lt("file"),data:Se({contentDigest:H().min(1),byteSize:pe().int().nonnegative(),generated:Ln()})}),Hk=Se({type:lt("symbol"),data:Se({signature:H().nullable().optional(),modifiers:Ge(H()).default([]),overloadDiscriminator:H().nullable().optional(),declaringType:H().nullable().optional(),signatureDigest:H().nullable().optional(),implementationDigest:H().nullable().optional(),sourceDigest:H().nullable().optional()})}),Kk=Se({type:lt("import_export"),data:Se({specifier:H(),importedName:H().nullable().optional(),localName:H().nullable().optional(),typeOnly:Ln()})}),Wk=Se({type:lt("route"),data:Se({operation:H(),path:H(),originalPath:H().nullable().optional(),declaringScope:H(),resolution:oc,middlewareCount:pe().int().nonnegative()})}),Qk=Se({type:lt("component"),data:Se({componentType:H()})}),Xk=Se({type:lt("resource"),data:Se({resourceKind:It(["document","paper","image","concept","rationale"]),uri:H().nullable().optional(),mediaType:H().nullable().optional()})}),$k=Se({type:lt("messaging"),data:Se({transport:H(),subject:H(),declaringScope:H()})}),qk=Se({type:lt("job"),data:Se({schedule:H().nullable().optional(),queue:H().nullable().optional()})}),Jk=Se({type:lt("schema"),data:Se({dialect:H().nullable().optional(),logicalDatabase:H().nullable().optional(),namespace:H().nullable().optional()})}),eR=Se({type:lt("query"),data:Se({dialect:H().nullable().optional(),operation:H().nullable().optional(),textDigest:H().nullable().optional()})}),tR=Se({type:lt("config"),data:Se({format:H(),keyPath:H()})}),nR=Se({type:lt("database"),data:Se({logicalDatabase:H(),databaseSchema:H().nullable().optional()})}),iR=ec("type",[Yk,Hk,Kk,Wk,Qk,Xk,$k,qk,Jk,eR,tR,nR]),gR=Se({type:lt("call"),data:Se({dispatch:It(["static","virtual","dynamic"]),receiverType:H().nullable().optional(),argumentCount:pe().int().nonnegative().nullable().optional()})}),oR=Se({type:lt("route"),data:Se({stage:It(["middleware","handler"]),position:pe().int().nonnegative().nullable().optional(),operation:H().nullable().optional()})}),sR=Se({type:lt("messaging"),data:Se({transport:H(),subject:H()})}),rR=Se({type:lt("schedule"),data:Se({expression:H().nullable().optional()})}),aR=Se({type:lt("mapping"),data:Se({mappingKind:H()})}),zm=ec("type",[gR,oR,sR,rR,aR]),AR=Se({maxDepth:pe().int().positive(),maxNodes:pe().int().positive(),maxEdges:pe().int().positive(),maxPaths:pe().int().positive(),maxCandidates:pe().int().positive(),maxSourceBytes:pe().int().positive(),maxResponseBytes:pe().int().positive()}),CR=Se({nodeId:H().min(1),score:pe().finite(),matchedFields:Ge(H())}),IR=Se({id:H().min(1),kind:Bk,roles:Ge(Lk),name:H().min(1),qualifiedName:H().min(1),language:H().nullable(),framework:H().nullable(),source:kr.nullable(),details:iR.nullable(),evidence:Ge(FA)}),lR=Se({id:H().min(1),source:H().min(1),target:H().min(1),kind:Pk,relationshipSite:kr.nullable(),details:zm.nullable(),evidence:Ge(FA)}),cR=Se({path:ic,contentDigest:H().min(1),source:H().nullable(),truncated:Ln()}),dR=Se({id:H().min(1),nodeIds:Ge(H().min(1)),edgeIds:Ge(H().min(1)),weakestResolution:oc,weakestConfidence:gc}),uR=Se({code:It(["no_match","ambiguous_match","direction_mismatch","unresolved_handler","incomplete_coverage","stale_source_digest","bounded_truncation","program_orphan","program_conflict","program_unavailable"]),message:H().min(1),nodeId:H().nullable(),path:ic.nullable()}),hR=Se({schema:lt(kk),operation:Gk,results:Ge(CR),nodes:Ge(IR),edges:Ge(lR),files:Ge(cR),paths:Ge(dR),diagnostics:Ge(uR),limits:AR,truncated:Ln()}),fR="compass.viewer.graph/1",sc=pt({file:H(),startLine:pe().int().positive().optional(),endLine:pe().int().positive().optional(),startByte:pe().int().nonnegative().optional(),endByte:pe().int().nonnegative().optional()}).passthrough(),pR=pt({field:H().min(1),before:uo().optional(),after:uo().optional()}),km=pt({before:tc(H(),uo()).optional(),after:tc(H(),uo()).optional(),fields:Ge(pR)}),mR=pt({id:H().min(1),label:H(),kind:H().optional(),community:pe().int(),communityName:H().optional(),degree:pe().int().nonnegative().optional(),language:H().optional(),signature:H().optional(),size:pe().positive().optional(),memberCount:pe().int().nonnegative().optional(),detailAvailable:Ln().optional(),learningStatus:H().optional(),learningStale:Ln().optional(),depth:pe().int().nonnegative().optional(),root:Ln().optional(),change:It(["added","removed","changed","unchanged"]).optional(),evidence:km.optional(),codeEvidence:Ge(FA).optional(),source:sc.optional(),color:pt({background:H(),border:H()}).passthrough().optional()}).passthrough(),vR=pt({id:H().min(1),source:H().min(1),target:H().min(1),relation:H(),weight:pe().int().positive().optional(),change:It(["added","removed","changed","unchanged"]).optional(),evidence:km.optional(),codeEvidence:Ge(FA).optional(),details:zm.nullable().optional(),relationshipSite:sc.optional(),confidence:It(["extracted","inferred","ambiguous","aggregated"]).optional()}).passthrough(),yR=pt({id:pe().int(),label:H(),color:H(),hidden:Ln().default(!1)}).passthrough(),bg=pt({schema:lt(fR),title:H(),stats:pt({nodes:pe().int().nonnegative(),edges:pe().int().nonnegative(),communities:pe().int().nonnegative(),aggregated:Ln()}).passthrough(),nodes:Ge(mR),edges:Ge(vR),communities:Ge(yR),hyperedges:Ge(uo()).default([])}).passthrough(),bR=It(["resolved","inferred","ambiguous","unresolved"]),Rm=pt({source_file:H(),start_byte:pe().int().nonnegative(),end_byte:pe().int().nonnegative()}),wR=pt({id:H(),symbol:H().nullable(),name:H(),file:H().nullable(),anchor:Rm.nullable().optional(),startLine:pe().int().positive().nullable().optional(),endLine:pe().int().positive().nullable().optional(),startByte:pe().int().nonnegative().nullable().optional(),endByte:pe().int().nonnegative().nullable().optional(),graphNodeId:H().nullable(),unresolved:Ln(),evidenceLayer:It(["structural_graph","program_ir","combined"]).optional()}),xR=Sm([pt({anchor:Rm,evidence:Ge(H())}),pt({sourceFile:H().nullable(),line:pe().int().positive().nullable(),startByte:pe().int().nonnegative().nullable(),endByte:pe().int().nonnegative().nullable(),evidence:Ge(H())})]),SR=pt({id:H(),source:H(),target:H(),callee:H(),resolution:bR,confidence:H().nullable().optional(),callSites:Ge(xR),evidenceLayer:It(["structural_graph","program_ir","combined"]).optional()}),ER=pt({schema:It(["compass.program.call_graph/1","compass.call_graph/1"]),rootSymbol:H(),direction:It(["callers","callees","both"]),depth:pe().int().positive(),nodes:Ge(wR),edges:Ge(SR),truncated:Ln(),continuations:Ge(pt({symbol:H(),direction:It(["callers","callees","both"]),nextDepth:pe().int().positive()})),coverage:pt({resolved:pe().int().nonnegative(),inferred:pe().int().nonnegative(),ambiguous:pe().int().nonnegative(),unresolved:pe().int().nonnegative(),evidenceLayer:It(["structural_graph","program_ir","combined"]).optional(),partial:Ln().optional(),limitations:Ge(H()).optional(),warning:H()})}),_m=It(["extracted","inferred","ambiguous"]),TR=It(["production","test","generated","vendor","unknown"]),OR=pt({schema:lt("compass.viewer.callflow/1"),title:H(),sections:Ge(pt({id:H(),name:H(),communities:Ge(H()),nodeCount:pe().int().nonnegative(),internalCallCount:pe().int().nonnegative(),nodes:Ge(pt({id:H(),label:H(),kind:H(),sourceFile:H().nullable(),scope:TR})),edges:Ge(pt({source:H(),target:H(),relation:H(),confidence:_m}))})),overviewLinks:Ge(pt({sourceSection:H(),targetSection:H(),calls:pe().int().nonnegative()})),crossSectionCalls:Ge(pt({source:H(),target:H(),sourceSection:H(),targetSection:H(),relation:H(),confidence:_m})),coverage:pt({internal:pe().int().nonnegative(),crossSection:pe().int().nonnegative(),unassigned:pe().int().nonnegative()}),reportHighlights:Ge(H()),statistics:pt({nodes:pe().int().nonnegative(),edges:pe().int().nonnegative(),communities:pe().int().nonnegative(),hyperedges:pe().int().nonnegative(),extracted:pe().int().nonnegative(),inferred:pe().int().nonnegative(),ambiguous:pe().int().nonnegative()}),provenance:pt({projectName:H(),builtAtCommit:H().nullable(),generatedAt:H().nullable()})}),NR="compass.viewer.workbench/1",DR=Se({status:It(["complete","summary","partial"]),truncated:Ln(),nodes:pe().int().nonnegative(),edges:pe().int().nonnegative(),limitations:Ge(H()).default([])}),ho={id:H().min(1),title:H().min(1),description:H(),coverage:DR},MR=It(["dependencies","routes","data","messaging","tests","provenance"]),zR=ec("kind",[Se({...ho,kind:lt("code"),model:bg,communityDetails:tc(H(),bg).default({})}),Se({...ho,kind:lt("call"),root:H(),graph:ER}),Se({...ho,kind:lt("impact"),root:H(),result:hR}),Se({...ho,kind:lt("architecture"),model:OR}),Se({...ho,kind:lt("history"),baseRevision:H(),targetRevision:H(),before:bg,after:bg}),Se({...ho,kind:lt("affected"),root:H(),relations:Ge(H()),depth:pe().int().nonnegative(),model:bg}),Se({...ho,kind:lt("artifact"),lens:MR,relations:Ge(H()),model:bg})]),kR=Se({schema:lt(NR),title:H(),graphIdentity:H().min(1),defaultView:H(),views:Ge(zR).min(1)}).superRefine((n,e)=>{const t=new Set;for(const[i,o]of n.views.entries())t.has(o.id)&&e.addIssue({code:"custom",path:["views",i,"id"],message:`duplicate workbench view id '${o.id}'`}),t.add(o.id);t.has(n.defaultView)||e.addIssue({code:"custom",path:["defaultView"],message:"defaultView must identify one included view"})});var F=Gl();const RR=FO({__proto__:null,default:VO(F)},[F]);const _R=n=>n.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),jR=n=>n.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,i)=>i?i.toUpperCase():t.toLowerCase()),jm=n=>{const e=jR(n);return e.charAt(0).toUpperCase()+e.slice(1)},Zm=(...n)=>n.filter((e,t,i)=>!!e&&e.trim()!==""&&i.indexOf(e)===t).join(" ").trim(),ZR=n=>{for(const e in n)if(e.startsWith("aria-")||e==="role"||e==="title")return!0};var BR={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const PR=F.forwardRef(({color:n="currentColor",size:e=24,strokeWidth:t=2,absoluteStrokeWidth:i,className:o="",children:r,iconNode:A,...I},l)=>F.createElement("svg",{ref:l,...BR,width:e,height:e,stroke:n,strokeWidth:i?Number(t)*24/Number(e):t,className:Zm("lucide",o),...!r&&!ZR(I)&&{"aria-hidden":"true"},...I},[...A.map(([c,h])=>F.createElement(c,h)),...Array.isArray(r)?r:[r]]));const Re=(n,e)=>{const t=F.forwardRef(({className:i,...o},r)=>F.createElement(PR,{ref:r,iconNode:e,className:Zm(`lucide-${_R(jm(n))}`,`lucide-${n}`,i),...o}));return t.displayName=jm(n),t};const LR=Re("arrow-down",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);const GR=Re("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);const FR=Re("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);const VR=Re("arrow-up",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);const UR=Re("badge-check",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);const YR=Re("boxes",[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]]);const HR=Re("braces",[["path",{d:"M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1",key:"ezmyqa"}],["path",{d:"M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1",key:"e1hn23"}]]);const KR=Re("circle-dot-dashed",[["path",{d:"M10.1 2.18a9.93 9.93 0 0 1 3.8 0",key:"1qdqn0"}],["path",{d:"M17.6 3.71a9.95 9.95 0 0 1 2.69 2.7",key:"1bq7p6"}],["path",{d:"M21.82 10.1a9.93 9.93 0 0 1 0 3.8",key:"1rlaqf"}],["path",{d:"M20.29 17.6a9.95 9.95 0 0 1-2.7 2.69",key:"1xk03u"}],["path",{d:"M13.9 21.82a9.94 9.94 0 0 1-3.8 0",key:"l7re25"}],["path",{d:"M6.4 20.29a9.95 9.95 0 0 1-2.69-2.7",key:"1v18p6"}],["path",{d:"M2.18 13.9a9.93 9.93 0 0 1 0-3.8",key:"xdo6bj"}],["path",{d:"M3.71 6.4a9.95 9.95 0 0 1 2.7-2.69",key:"1jjmaz"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]]);const Bm=Re("circle-question-mark",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);const WR=Re("compass",[["path",{d:"m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z",key:"9ktpf1"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);const VA=Re("external-link",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);const QR=Re("file-code-2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m5 12-3 3 3 3",key:"oke12k"}],["path",{d:"m9 18 3-3-3-3",key:"112psh"}]]);const XR=Re("file-cog",[["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m2.305 15.53.923-.382",key:"yfp9st"}],["path",{d:"m3.228 12.852-.924-.383",key:"bckynb"}],["path",{d:"M4.677 21.5a2 2 0 0 0 1.313.5H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v2.5",key:"1yo3oz"}],["path",{d:"m4.852 11.228-.383-.923",key:"1j88i9"}],["path",{d:"m4.852 16.772-.383.924",key:"sag1dv"}],["path",{d:"m7.148 11.228.383-.923",key:"rj39hk"}],["path",{d:"m7.53 17.696-.382-.924",key:"1uu5cs"}],["path",{d:"m8.772 12.852.923-.383",key:"13811l"}],["path",{d:"m8.772 15.148.923.383",key:"z1a5l0"}],["circle",{cx:"6",cy:"14",r:"3",key:"a1xfv6"}]]);const $R=Re("focus",[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}]]);const Pm=Re("git-branch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]);const Lm=Re("git-compare-arrows",[["circle",{cx:"5",cy:"6",r:"3",key:"1qnov2"}],["path",{d:"M12 6h5a2 2 0 0 1 2 2v7",key:"1yj91y"}],["path",{d:"m15 9-3-3 3-3",key:"1lwv8l"}],["circle",{cx:"19",cy:"18",r:"3",key:"1qljk2"}],["path",{d:"M12 18H7a2 2 0 0 1-2-2V9",key:"16sdep"}],["path",{d:"m9 15 3 3-3 3",key:"1m3kbl"}]]);const rc=Re("git-fork",[["circle",{cx:"12",cy:"18",r:"3",key:"1mpf1b"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["path",{d:"M18 9v2c0 .6-.4 1-1 1H7c-.6 0-1-.4-1-1V9",key:"1uq4wg"}],["path",{d:"M12 12v3",key:"158kv8"}]]);const qR=Re("keyboard",[["path",{d:"M10 8h.01",key:"1r9ogq"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M14 8h.01",key:"1primd"}],["path",{d:"M16 12h.01",key:"1l6xoz"}],["path",{d:"M18 8h.01",key:"emo2bl"}],["path",{d:"M6 8h.01",key:"x9i8wu"}],["path",{d:"M7 16h10",key:"wp8him"}],["path",{d:"M8 12h.01",key:"czm47f"}],["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}]]);const JR=Re("layout-grid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]);const e3=Re("map",[["path",{d:"M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z",key:"169xi5"}],["path",{d:"M15 5.764v15",key:"1pn4in"}],["path",{d:"M9 3.236v15",key:"1uimfh"}]]);const Gm=Re("maximize-2",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]]);const t3=Re("minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);const n3=Re("move",[["path",{d:"M12 2v20",key:"t6zp3m"}],["path",{d:"m15 19-3 3-3-3",key:"11eu04"}],["path",{d:"m19 9 3 3-3 3",key:"1mg7y2"}],["path",{d:"M2 12h20",key:"9i4pu4"}],["path",{d:"m5 9-3 3 3 3",key:"j64kie"}],["path",{d:"m9 5 3-3 3 3",key:"l8vdw6"}]]);const ac=Re("network",[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]);const i3=Re("panel-left-close",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]]);const g3=Re("panel-left-open",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m14 9 3 3-3 3",key:"8010ee"}]]);const Fm=Re("panel-right-close",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m8 9 3 3-3 3",key:"12hl5m"}]]);const o3=Re("panel-right-open",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m10 15-3-3 3-3",key:"1pgupc"}]]);const Vm=Re("pause",[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]]);const s3=Re("play",[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]]);const Um=Re("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);const Ym=Re("rotate-ccw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);const Hm=Re("route",[["circle",{cx:"6",cy:"19",r:"3",key:"1kj8tv"}],["path",{d:"M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15",key:"1d8sl"}],["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}]]);const Km=Re("scan-search",[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["path",{d:"m16 16-1.9-1.9",key:"1dq9hf"}]]);const r3=Re("search-code",[["path",{d:"m13 13.5 2-2.5-2-2.5",key:"1rvxrh"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}],["path",{d:"M9 8.5 7 11l2 2.5",key:"6ffwbx"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]);const Wm=Re("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]);const a3=Re("settings",[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);const A3=Re("shield-check",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);const C3=Re("signpost",[["path",{d:"M12 13v8",key:"1l5pq0"}],["path",{d:"M12 3v3",key:"1n5kay"}],["path",{d:"M18 6a2 2 0 0 1 1.387.56l2.307 2.22a1 1 0 0 1 0 1.44l-2.307 2.22A2 2 0 0 1 18 13H6a2 2 0 0 1-1.387-.56l-2.306-2.22a1 1 0 0 1 0-1.44l2.306-2.22A2 2 0 0 1 6 6z",key:"gqqp9m"}]]);const I3=Re("sliders-horizontal",[["path",{d:"M10 5H3",key:"1qgfaw"}],["path",{d:"M12 19H3",key:"yhmn1j"}],["path",{d:"M14 3v4",key:"1sua03"}],["path",{d:"M16 17v4",key:"1q0r14"}],["path",{d:"M21 12h-9",key:"1o4lsq"}],["path",{d:"M21 19h-5",key:"1rlt1p"}],["path",{d:"M21 5h-7",key:"1oszz2"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M8 12H3",key:"a7s4jb"}]]);const l3=Re("tags",[["path",{d:"M13.172 2a2 2 0 0 1 1.414.586l6.71 6.71a2.4 2.4 0 0 1 0 3.408l-4.592 4.592a2.4 2.4 0 0 1-3.408 0l-6.71-6.71A2 2 0 0 1 6 9.172V3a1 1 0 0 1 1-1z",key:"16rjxf"}],["path",{d:"M2 7v6.172a2 2 0 0 0 .586 1.414l6.71 6.71a2.4 2.4 0 0 0 3.191.193",key:"178nd4"}],["circle",{cx:"10.5",cy:"6.5",r:".5",fill:"currentColor",key:"12ikhr"}]]);const UA=Re("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);const c3=Re("waypoints",[["circle",{cx:"12",cy:"4.5",r:"2.5",key:"r5ysbb"}],["path",{d:"m10.2 6.3-3.9 3.9",key:"1nzqf6"}],["circle",{cx:"4.5",cy:"12",r:"2.5",key:"jydg6v"}],["path",{d:"M7 12h10",key:"b7w52i"}],["circle",{cx:"19.5",cy:"12",r:"2.5",key:"1piiel"}],["path",{d:"m13.8 17.7 3.9-3.9",key:"1wyg1y"}],["circle",{cx:"12",cy:"19.5",r:"2.5",key:"13o1pw"}]]);const d3=Re("zoom-in",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]);const u3=Re("zoom-out",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]),Qm=new Set(["color","change","evidence"]),h3=new Set(["anchor","anchors","columnEnd","columnStart","community","communityName","community_name","degree","endByte","endColumn","endLine","lineEnd","lineStart","line_end","line_start","location","normLabel","norm_label","relationshipSite","relationship_site","size","sourceDigest","sourceFile","sourceHash","source_digest","source_file","source_hash","startByte","startColumn","startLine","wiringSite","wiring_site"]);function YA(n,e){const t=HA(n),i=HA(e);return{...t?{before:t}:{},...i?{after:i}:{},fields:Cc(t,i)}}function Xm(n,e,t){const i=HA(n),o=HA(e),r=Ac(n,t),A=Ac(e,t);return{...i?{before:i}:{},...o?{after:o}:{},fields:Cc(r,A)}}function f3(n,e){return Ac(n,e)??{}}function p3(n,e=240){const t=n===void 0?"Not recorded":typeof n=="string"?n:JSON.stringify(n,null,Rr(n)?2:void 0)??String(n);return t.length<=e?{text:t,truncated:!1}:{text:`${t.slice(0,Math.max(0,e-1)).trimEnd()}…`,truncated:!0}}function HA(n){if(n)return Jm(n)}function Ac(n,e){return n?qm(n,e==="node"?new Set(["source"]):new Set(["id","key"])):void 0}function $m(n){return Array.isArray(n)?n.map($m):Rr(n)?qm(n):n}function qm(n,e=new Set){return Object.fromEntries(Object.keys(n).filter(t=>!Qm.has(t)&&!h3.has(t)&&!e.has(t)).sort((t,i)=>t.localeCompare(i)).map(t=>[t,$m(n[t])]))}function KA(n){return Array.isArray(n)?n.map(KA):Rr(n)?Jm(n):n}function Jm(n){return Object.fromEntries(Object.keys(n).filter(e=>!Qm.has(e)).sort((e,t)=>e.localeCompare(t)).map(e=>[e,KA(n[e])]))}function Cc(n,e,t=""){const i=new Set([...Object.keys(n??{}),...Object.keys(e??{})]),o=[];for(const r of[...i].sort((A,I)=>A.localeCompare(I))){const A=t?`${t}.${r}`:r,I=n?.[r],l=e?.[r];Rr(I)&&Rr(l)?o.push(...Cc(I,l,A)):m3(I,l)||o.push({field:A,...I!==void 0?{before:I}:{},...l!==void 0?{after:l}:{}})}return o}function m3(n,e){return JSON.stringify(KA(n))===JSON.stringify(KA(e))}function Rr(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}function v3({node:n,edges:e,nodes:t,sourceRevisions:i,onFocus:o,onOpenSource:r}){const A=nv(n.evidence?.before),I=nv(n.evidence?.after);return f.jsxs(f.Fragment,{children:[n.evidence?.fields.length?f.jsxs("section",{className:"compass-record-evidence","aria-labelledby":"compass-node-changes-title",children:[f.jsxs("div",{className:"compass-evidence-heading",children:[f.jsx("h3",{id:"compass-node-changes-title",children:y3(n.change)}),f.jsxs("span",{children:[n.evidence.fields.length," fields"]})]}),f.jsx(ev,{fields:n.evidence.fields}),n.change==="changed"&&(A||I)&&f.jsxs("div",{className:"compass-evidence-source-actions",children:[A&&f.jsxs("button",{type:"button",onClick:()=>r(A,i?.before),children:[f.jsx(VA,{"aria-hidden":"true"}),"Open before"]}),I&&f.jsxs("button",{type:"button",onClick:()=>r(I,i?.after),children:[f.jsx(VA,{"aria-hidden":"true"}),"Open after"]})]})]}):null,f.jsxs("section",{className:"compass-relationship-evidence","aria-labelledby":"compass-relationships-title",children:[f.jsxs("div",{className:"compass-neighbors-heading",children:[f.jsx("span",{id:"compass-relationships-title",children:"Relationships"}),f.jsx("strong",{children:e.length})]}),e.length?f.jsx("div",{className:"compass-relationship-list",children:e.map(l=>{const c=l.source===n.id?l.target:l.source,h=t.get(c);return f.jsxs("details",{children:[f.jsxs("summary",{children:[f.jsx("span",{className:"compass-change-badge","data-change":l.change,children:iv(l.change)}),f.jsx("span",{className:"compass-relationship-target",children:h?.label??c}),f.jsx("small",{children:l.relation}),l.confidence&&f.jsx("i",{children:l.confidence})]}),f.jsxs("div",{className:"compass-relationship-detail",children:[l.change==="changed"&&l.evidence?.fields.length?f.jsx(ev,{fields:l.evidence.fields}):f.jsxs("p",{children:[iv(l.change)," relationship: ",l.source," → ",l.target]}),f.jsxs("button",{type:"button",onClick:()=>o(c),children:["Focus ",h?.label??c]})]})]},l.id)})}):f.jsx("span",{className:"compass-empty",children:"No connected relationships"})]})]})}function ev({fields:n}){return f.jsx("div",{className:"compass-field-table-wrap",children:f.jsxs("table",{className:"compass-field-table",children:[f.jsx("thead",{children:f.jsxs("tr",{children:[f.jsx("th",{children:"Field"}),f.jsx("th",{children:"Before"}),f.jsx("th",{children:"After"})]})}),f.jsx("tbody",{children:n.map(e=>f.jsxs("tr",{children:[f.jsx("th",{scope:"row",children:e.field}),f.jsx(tv,{value:e.before}),f.jsx(tv,{value:e.after})]},e.field))})]})})}function tv({value:n}){const e=p3(n);return f.jsxs("td",{children:[f.jsx("code",{children:e.text}),e.truncated&&f.jsx("span",{className:"compass-value-truncated",children:"Value shortened"})]})}function nv(n){const e=sc.safeParse(n?.source);return e.success?e.data:void 0}function iv(n){return!n||n==="unchanged"?"Context":`${n[0]?.toLocaleUpperCase()}${n.slice(1)}`}function y3(n){return n==="added"?"Added symbol metadata":n==="removed"?"Removed symbol metadata":"What changed"}const gv=100,ov={changed:0,added:1,removed:2,unchanged:3};function b3({nodes:n,query:e,selectedId:t,onFocus:i}){const[o,r]=F.useState(!1),A=e.trim().toLocaleLowerCase(),I=n.filter(c=>c.change&&c.change!=="unchanged").filter(c=>!A||c.label.toLocaleLowerCase().includes(A)||c.kind?.toLocaleLowerCase().includes(A)||c.source?.file.toLocaleLowerCase().includes(A)).sort((c,h)=>ov[c.change??"unchanged"]-ov[h.change??"unchanged"]||c.label.localeCompare(h.label)||c.id.localeCompare(h.id)),l=o?I:I.slice(0,gv);return f.jsxs("section",{className:"compass-changed-symbols","aria-labelledby":"compass-changed-symbols-title",children:[f.jsxs("div",{className:"compass-section-heading",children:[f.jsx("h2",{id:"compass-changed-symbols-title",children:"Changed symbols"}),f.jsx("span",{children:I.length})]}),l.length?f.jsx("div",{className:"compass-changed-symbol-list",children:l.map(c=>f.jsxs("button",{type:"button","aria-pressed":c.id===t,"data-change":c.change,onClick:()=>i(c.id),children:[f.jsx("span",{className:"compass-changed-symbol-status",children:w3(c.change)}),f.jsx("strong",{children:c.label}),f.jsx("small",{children:c.source?.file??c.kind??"Graph symbol"})]},c.id))}):f.jsx("p",{className:"compass-empty",children:A?"No affected symbols match this search.":"No symbol changes."}),!o&&I.length>gv&&f.jsxs("button",{className:"compass-changed-symbol-expand",type:"button",onClick:()=>r(!0),children:["Show all ",I.length.toLocaleString()," affected symbols"]})]})}function w3(n){return!n||n==="unchanged"?"Context":`${n[0]?.toLocaleUpperCase()}${n.slice(1)}`}function sv({evidence:n,diagnostics:e=[],truncated:t=!1,title:i="Trust evidence",onOpenSource:o}){return!n.length&&!e.length&&!t?null:f.jsxs("section",{className:"compass-code-evidence","aria-label":i,children:[f.jsxs("div",{className:"compass-evidence-heading",children:[f.jsx("h3",{children:i}),f.jsxs("span",{children:[n.length," ",n.length===1?"record":"records"]})]}),t&&f.jsxs("p",{className:"compass-code-diagnostic","data-severity":"warning",role:"status",children:[f.jsx(UA,{"aria-hidden":"true"}),"Results reached a configured limit. Narrow the query or raise one bound."]}),e.map(r=>f.jsxs("p",{className:"compass-code-diagnostic","data-severity":r.code==="no_match"?"info":"warning",role:"status",children:[r.code==="no_match"?f.jsx(Bm,{"aria-hidden":"true"}):f.jsx(UA,{"aria-hidden":"true"}),f.jsxs("span",{children:[f.jsx("strong",{children:E3(r.code)}),r.message]})]},`${r.code}:${r.message}`)),f.jsx("div",{className:"compass-code-evidence-ledger",children:n.map((r,A)=>{const I=S3(r),l=r.wiringSite??r.anchor;return f.jsxs("article",{className:"compass-code-evidence-entry","data-status":I.key,children:[f.jsx("span",{className:"compass-code-evidence-icon","aria-hidden":"true",children:f.jsx(x3,{item:r})}),f.jsxs("div",{className:"compass-code-evidence-copy",children:[f.jsxs("div",{className:"compass-code-evidence-status",children:[f.jsx("strong",{children:I.label}),f.jsx("span",{children:r.layer==="program_ir"?"Program IR":"Code graph"})]}),f.jsxs("dl",{children:[f.jsxs("div",{children:[f.jsx("dt",{children:"Extractor"}),f.jsx("dd",{children:r.extractor})]}),f.jsxs("div",{children:[f.jsx("dt",{children:"Confidence"}),f.jsx("dd",{children:r.confidence})]}),r.rule&&f.jsxs("div",{children:[f.jsx("dt",{children:"Rule"}),f.jsx("dd",{children:r.rule})]})]}),l&&(o?f.jsxs("button",{className:"compass-code-evidence-source",type:"button",onClick:()=>o(l),children:[f.jsx(VA,{"aria-hidden":"true"}),rv(r,l)]}):f.jsx("span",{className:"compass-code-evidence-source",children:rv(r,l)})),r.candidates.length>0&&f.jsxs("div",{className:"compass-code-candidates",children:[f.jsx("span",{children:"Retained candidates"}),f.jsx("ul",{children:r.candidates.map(c=>f.jsxs("li",{children:[f.jsx("code",{children:c.nodeId}),f.jsx("span",{children:c.reason}),f.jsx("small",{children:c.confidence})]},`${c.nodeId}:${c.reason}`))})]})]})]},`${r.layer}:${r.extractor}:${A}`)})})]})}function x3({item:n}){return n.resolution==="unresolved"?f.jsx(Bm,{}):n.resolution==="ambiguous"||n.confidence==="ambiguous"?f.jsx(UA,{}):n.origin==="heuristic"?f.jsx(rc,{}):n.origin==="config"?f.jsx(XR,{}):n.origin==="convention"?f.jsx(C3,{}):f.jsx(UR,{})}function S3(n){return n.resolution==="unresolved"?{key:"unresolved",label:"Unresolved"}:n.resolution==="ambiguous"||n.confidence==="ambiguous"?{key:"ambiguous",label:"Ambiguous"}:n.origin==="heuristic"?{key:"heuristic",label:"Heuristic"}:n.origin==="config"?{key:"config",label:"Configuration"}:n.origin==="convention"?{key:"convention",label:"Convention"}:{key:"exact",label:"Exact"}}function rv(n,e){return`${n.origin==="heuristic"?"Wired at":"Evidence at"} ${e.file}:${e.startLine}`}function E3(n){return`${n.replaceAll("_"," ")}: `}function av(n){return Cv(n.source)}function Av(n){return Cv(n.relationshipSite)}function Cv(n){return n?.file.trim()&&(n.startLine!==void 0||n.endLine!==void 0||n.startByte!==void 0||n.endByte!==void 0)?n:void 0}const Iv=200;function T3(n,e){const t=e.trim().toLocaleLowerCase();return(t?n.filter(o=>o.label.toLocaleLowerCase().includes(t)||String(o.id).includes(t)):n).slice(0,Iv)}function O3(n){const e=n.source?.startLine,t=n.source?.endLine;if(e!==void 0)return t!==void 0&&t!==e?`${e}–${t}`:String(e)}function lv(n){const e=n.source?.startLine,t=n.source?.endLine;if(e!==void 0)return t!==void 0&&t!==e?{text:`Lines ${e}–${t}`,action:`at lines ${e}–${t}`}:{text:`Line ${e}`,action:`at line ${e}`};const i=n.source?.startByte,o=n.source?.endByte;if(i!==void 0)return o!==void 0&&o!==i?{text:`Bytes ${i}–${o}`,action:`at bytes ${i}–${o}`}:{text:`Byte ${i}`,action:`at byte ${i}`}}function cv(n,e){const t=lv(n);return`Open source ${e.file}${t?` ${t.action}`:""}`}function dv(n){return n==="unchanged"?"Context":n?`${n[0]?.toLocaleUpperCase()}${n.slice(1)}`:void 0}function N3(n){if(n)return{added:"var(--vscode-gitDecoration-addedResourceForeground, #2ea043)",removed:"var(--vscode-gitDecoration-deletedResourceForeground, #f85149)",changed:"var(--vscode-gitDecoration-modifiedResourceForeground, #d29922)",unchanged:"var(--vscode-descriptionForeground, #6e7781)"}[n]}function D3({model:n,selected:e,neighbors:t,connectedEdges:i,query:o,matches:r,hiddenCommunities:A,comparisonMode:I,sourceRevisions:l,queryResult:c,renderedEdgeCount:h,showHeader:p,onQueryChange:m,onFocus:y,onOpenSource:w,onOpenCommunity:S,onQueryNode:x,onToggleCommunity:O,onSetAllVisible:E,collapsed:_,onToggleCollapsed:P}){const[Q,ne]=F.useState(0),j=e?av(e):void 0,V=e?O3(e):void 0,de=e?lv(e):void 0,le=F.useMemo(()=>{const K=new Map;for(const re of n.nodes)K.set(re.community,(K.get(re.community)??0)+1);return K},[n.nodes]),Ze=A.size===0,Ee=F.useMemo(()=>new Map(n.nodes.map(K=>[K.id,K])),[n.nodes]),We=(e?c?.nodes.find(K=>K.id===e.id):void 0)?.evidence??e?.codeEvidence??[],Ae=e?c?c.edges.filter(K=>K.source===e.id||K.target===e.id).flatMap(K=>K.evidence):i.flatMap(K=>K.codeEvidence??[]):[],M=K=>{y(K.id),m(""),ne(0)},U=K=>{!r.length&&K.key!=="Escape"||(K.key==="ArrowDown"?(K.preventDefault(),ne((Q+1)%r.length)):K.key==="ArrowUp"?(K.preventDefault(),ne((Q-1+r.length)%r.length)):K.key==="Enter"&&r[Q]?(K.preventDefault(),M(r[Q])):K.key==="Escape"&&(m(""),ne(0)))};return _?f.jsxs("aside",{className:"compass-graph-inspector compass-graph-inspector-collapsed","aria-label":"Graph inspector",children:[f.jsx("button",{className:"compass-inspector-disclosure compass-inspector-expand",type:"button","aria-label":"Expand graph inspector",title:"Expand graph inspector",onClick:P,children:f.jsx(o3,{"aria-hidden":"true"})}),f.jsx("span",{className:"compass-inspector-rail-label","aria-hidden":"true",children:"Inspector"})]}):f.jsxs("aside",{className:"compass-graph-inspector","aria-label":"Graph inspector",children:[p&&f.jsxs("header",{className:"compass-inspector-header",children:[f.jsx("span",{className:"compass-product-mark","aria-hidden":"true",children:f.jsx(WR,{})}),f.jsxs("span",{className:"compass-inspector-title",children:[f.jsx("strong",{children:"Compass"}),f.jsx("small",{children:n.title})]}),f.jsx("button",{className:"compass-inspector-disclosure",type:"button","aria-label":"Collapse graph inspector",title:"Collapse graph inspector",onClick:P,children:f.jsx(Fm,{"aria-hidden":"true"})})]}),f.jsxs("div",{className:"compass-inspector-search",role:"search",children:[f.jsx("label",{className:"sr-only",htmlFor:"compass-node-search",children:"Search graph nodes"}),f.jsxs("div",{className:"compass-inspector-search-row",children:[f.jsxs("div",{className:"compass-search-field",children:[f.jsx(Wm,{"aria-hidden":"true"}),f.jsx("input",{id:"compass-node-search",type:"search",role:"combobox",value:o,placeholder:"Search nodes and files",autoComplete:"off","aria-controls":"compass-search-results","aria-autocomplete":"list","aria-expanded":r.length>0,"aria-activedescendant":r[Q]?`compass-search-result-${Q}`:void 0,onChange:K=>{m(K.target.value),ne(0)},onKeyDown:U})]}),!p&&f.jsx("button",{className:"compass-inspector-disclosure compass-inspector-search-disclosure",type:"button","aria-label":"Collapse graph inspector",title:"Collapse graph inspector",onClick:P,children:f.jsx(Fm,{"aria-hidden":"true"})})]}),r.length>0&&f.jsx("div",{id:"compass-search-results",className:"compass-search-results",role:"listbox","aria-label":"Matching nodes",children:r.map((K,re)=>f.jsxs("button",{id:`compass-search-result-${re}`,type:"button",role:"option","aria-selected":re===Q,className:"compass-search-item",onMouseEnter:()=>ne(re),onClick:()=>M(K),children:[f.jsx("strong",{children:K.label}),f.jsx("span",{children:K.source?.file??K.kind??"Graph node"})]},K.id))})]}),f.jsxs("section",{className:"compass-info-panel","aria-labelledby":"compass-info-title",children:[f.jsxs("div",{className:"compass-section-heading",children:[f.jsx("h2",{id:"compass-info-title",children:"Inspector"}),f.jsx("span",{children:e?"Pinned":"Node details"})]}),e?f.jsxs("div",{className:"compass-info-content",children:[f.jsxs("div",{className:"compass-node-identity",children:[f.jsx("span",{className:"compass-node-swatch","aria-hidden":"true",style:{background:N3(e.change)??e.color?.background??n.communities.find(K=>K.id===e.community)?.color}}),f.jsxs("span",{children:[f.jsx("strong",{children:e.label}),f.jsx("small",{children:e.kind??"Symbol"})]}),dv(e.change)&&f.jsx("span",{className:"compass-change-badge","data-change":e.change,children:dv(e.change)})]}),f.jsxs("dl",{className:"compass-metadata-grid",children:[f.jsxs("div",{children:[f.jsx("dt",{children:"Community"}),f.jsx("dd",{children:e.communityName??n.communities.find(K=>K.id===e.community)?.label??e.community})]}),f.jsxs("div",{children:[f.jsx("dt",{children:"Degree"}),f.jsx("dd",{children:e.degree??t.length})]}),e.language&&f.jsxs("div",{children:[f.jsx("dt",{children:"Language"}),f.jsx("dd",{children:e.language})]}),V&&f.jsxs("div",{children:[f.jsx("dt",{children:"Lines"}),f.jsx("dd",{children:V})]}),f.jsx("div",{className:"compass-metadata-wide compass-source-metadata","data-interactive":j!==void 0,children:j?f.jsxs(f.Fragment,{children:[f.jsx("dt",{className:"sr-only",children:"Source"}),f.jsx("dd",{children:f.jsxs("button",{className:"compass-source-card",type:"button","aria-label":cv(e,j),title:cv(e,j),onClick:()=>w(j,e.change==="removed"?l?.before:l?.after),children:[f.jsxs("span",{className:"compass-source-copy",children:[f.jsx("span",{className:"compass-source-eyebrow","aria-hidden":"true",children:"Source"}),f.jsx("span",{className:"compass-source-path",children:j.file}),de&&f.jsx("span",{className:"compass-source-range",children:de.text})]}),f.jsx(VA,{"aria-hidden":"true"})]})})]}):f.jsxs(f.Fragment,{children:[f.jsx("dt",{children:"Source"}),f.jsx("dd",{title:e.source?.file??"Not recorded",children:e.source?.file??"Not recorded"})]})})]}),e.signature&&f.jsx("code",{className:"compass-signature-block",children:e.signature}),x&&f.jsxs("div",{className:"compass-code-query-actions","aria-label":"Code graph queries",children:[f.jsx("button",{type:"button",onClick:()=>x("callers",e.id),children:"Callers"}),f.jsx("button",{type:"button",onClick:()=>x("callees",e.id),children:"Callees"}),f.jsx("button",{type:"button",onClick:()=>x("impact",e.id),children:"Impact"})]}),f.jsx(sv,{evidence:We,diagnostics:c?.diagnostics,truncated:c?.truncated,title:"Node evidence",onOpenSource:w}),f.jsx(sv,{evidence:Ae,title:"Relationship evidence",onOpenSource:w}),n.stats.aggregated&&e.memberCount!==void 0&&e.detailAvailable!==!1&&S&&f.jsxs("button",{className:"compass-inspector-action",type:"button",onClick:()=>S(e.community),children:[I?"Inspect changes":"Open community",f.jsxs("span",{children:[e.memberCount.toLocaleString()," ",I?"current symbols":"members"]})]}),n.stats.aggregated&&e.memberCount!==void 0&&e.detailAvailable===!1&&f.jsx("p",{className:"compass-empty",children:"This community detail was omitted to keep the standalone HTML export bounded. Open the graph in VS Code or export this community as JSON for full inspection."}),I?f.jsx(v3,{node:e,edges:i,nodes:Ee,sourceRevisions:l,onFocus:y,onOpenSource:w}):f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:"compass-neighbors-heading",children:[f.jsx("span",{children:"Connected nodes"}),f.jsx("strong",{children:t.length})]}),f.jsx("div",{className:"compass-neighbors-list",children:t.length?t.map(K=>f.jsxs("button",{type:"button",className:"compass-neighbor-link",title:K.label,onClick:()=>y(K.id),children:[f.jsx("span",{className:"compass-neighbor-dot","aria-hidden":"true",style:{background:K.color?.background??n.communities.find(re=>re.id===K.community)?.color??"var(--border)"}}),f.jsx("span",{className:"compass-neighbor-label",children:K.label})]},K.id)):f.jsx("span",{className:"compass-empty",children:"No connected nodes"})})]})]}):f.jsx("p",{className:"compass-empty",children:"Select a node to inspect its relationships."})]}),I&&!n.stats.aggregated&&f.jsx(b3,{nodes:n.nodes,query:o,selectedId:e?.id,onFocus:y}),f.jsx("section",{className:"compass-community-panel","aria-labelledby":"compass-communities-title","data-secondary":I,children:I?f.jsxs("details",{children:[f.jsxs("summary",{id:"compass-communities-title",children:["Communities",f.jsx("span",{children:n.communities.length})]}),f.jsx(uv,{model:n,communityCounts:le,hiddenCommunities:A,allVisible:Ze,onSetAllVisible:E,onToggleCommunity:O})]}):f.jsxs(f.Fragment,{children:[f.jsx("h2",{id:"compass-communities-title",children:"Communities"}),f.jsx(uv,{model:n,communityCounts:le,hiddenCommunities:A,allVisible:Ze,onSetAllVisible:E,onToggleCommunity:O})]})}),f.jsxs("footer",{className:"compass-graph-stats",children:[n.stats.nodes.toLocaleString()," nodes · ",n.stats.edges.toLocaleString()," edges",hT3(n.communities,A),[n.communities,A]),c=F.useMemo(()=>{const h=A.trim().toLocaleLowerCase();return h?n.communities.filter(p=>p.label.toLocaleLowerCase().includes(h)||String(p.id).includes(h)).length:n.communities.length},[n.communities,A]);return f.jsxs("div",{className:"compass-community-controls",children:[f.jsxs("label",{className:"compass-community-control",children:[f.jsx("input",{type:"checkbox",checked:i,onChange:h=>o(h.target.checked)}),f.jsx("span",{children:"Select all"})]}),n.communities.length>Iv&&f.jsxs("label",{className:"compass-community-search",children:[f.jsx("span",{className:"sr-only",children:"Filter communities"}),f.jsx(Wm,{"aria-hidden":"true"}),f.jsx("input",{type:"search",value:A,placeholder:"Filter communities",onChange:h=>I(h.target.value)})]}),f.jsx("div",{className:"compass-community-list",children:l.map(h=>{const p=!t.has(h.id);return f.jsxs("label",{className:"compass-community-item","data-hidden":!p,children:[f.jsx("input",{type:"checkbox",checked:p,onChange:()=>r(h.id)}),f.jsx("span",{className:"compass-community-dot","aria-hidden":"true",style:{background:h.color}}),f.jsx("span",{className:"compass-community-label",children:h.label}),f.jsx("small",{children:e.get(h.id)??0})]},h.id)})}),c>l.length&&f.jsxs("p",{className:"compass-community-limit",role:"status",children:["Showing ",l.length.toLocaleString()," of"," ",c.toLocaleString()," communities. Filter to find another community."]})]})}function M3({className:n="compass-load-logo"}){return f.jsx("svg",{className:n,viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:f.jsx("path",{fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd",d:"M3.554 21.529c1.797 1.221 4.943-.038 11.236-2.554 1.342-.537 2.013-.806 2.54-1.267q.201-.177.378-.378c.461-.527.73-1.198 1.267-2.54 2.515-6.293 3.775-9.44 2.554-11.236a4.1 4.1 0 0 0-1.083-1.083c-1.797-1.221-4.944.037-11.236 2.554-1.342.537-2.013.806-2.54 1.267q-.201.177-.378.378c-.461.527-.73 1.198-1.267 2.54-2.517 6.292-3.775 9.439-2.554 11.236.29.426.657.793 1.083 1.083M8.25 12a3.75 3.75 0 1 1 7.5 0 3.75 3.75 0 0 1-7.5 0m1.5 0a2.25 2.25 0 1 1 4.5 0 2.25 2.25 0 0 1-4.5 0"})})}const z3=1e4;function hv(n){const[e,t]=F.useState(!1);F.useEffect(()=>{if(n.kind!=="layout"){t(!1);return}const A=window.setTimeout(()=>{t(!0)},z3);return()=>window.clearTimeout(A)},[n.kind]);const i=n.kind==="community",o=i?`Opening ${n.communityLabel}`:e?"Still arranging this graph":"Arranging graph layout",r=i?"Fetching symbols and relationships for this community.":e?"This graph is taking longer than expected. You can open the current layout now.":"Positioning nodes and relationships for a readable first view.";return f.jsxs("section",{className:"compass-graph-transition","data-kind":n.kind,role:"status","aria-live":"polite","aria-atomic":"true",children:[f.jsxs("div",{className:"compass-load-visual","data-state":"loading","aria-hidden":"true",children:[f.jsx("span",{className:"compass-load-mark",children:f.jsx(M3,{})}),f.jsx("span",{className:"compass-load-progress",children:f.jsx("i",{})})]}),f.jsxs("div",{className:"compass-load-copy",children:[f.jsx("span",{className:"compass-load-eyebrow",children:"Compass graph"}),f.jsx("h1",{children:o}),f.jsx("p",{className:"compass-graph-transition-description",children:r}),!i&&e&&f.jsx("div",{className:"compass-load-actions",children:f.jsx("button",{className:"compass-load-action compass-load-action-primary",type:"button",onClick:n.onShowGraph,children:"Show graph now"})})]})]})}function k3(n){return n instanceof HTMLElement&&(n.isContentEditable||n.tagName==="INPUT"||n.tagName==="TEXTAREA"||n.tagName==="SELECT")}function R3({status:n,physicsRunning:e,layoutStyle:t,forceLabels:i,showEdgeLabels:o,hasSelection:r,isolateSelection:A,neighborhoodDepth:I,edgeDirection:l,layoutSpacing:c,showMinimap:h,leadingControls:p,leadingPanel:m,leadingPanelOpen:y,onLeadingPanelClose:w,onTogglePhysics:S,onLayoutChange:x,onZoomOut:O,onResetZoom:E,onZoomIn:_,onFit:P,onFitSelection:Q,onReset:ne,onToggleLabels:j,onToggleEdgeLabels:V,onToggleIsolation:de,onNeighborhoodDepthChange:le,onEdgeDirectionChange:Ze,onLayoutSpacingChange:Ee,onToggleMinimap:Ue,onBack:We}){const[Ae,M]=F.useState(!1),U=F.useId(),K=F.useRef(null),re=F.useRef(null),ee=F.useRef(!1);return F.useEffect(()=>{y&&M(!1)},[y]),F.useEffect(()=>{Ae||!ee.current||(ee.current=!1,re.current?.focus())},[Ae]),F.useEffect(()=>{const T=te=>{if(te.key==="Escape"){Ae&&(ee.current=!0,M(!1));return}te.key!=="?"||k3(te.target)||(te.preventDefault(),w?.(),M(!0))},L=te=>{K.current?.contains(te.target)||M(!1)};return document.addEventListener("keydown",T),document.addEventListener("pointerdown",L),()=>{document.removeEventListener("keydown",T),document.removeEventListener("pointerdown",L)}},[w,Ae]),f.jsxs("div",{ref:K,className:"compass-graph-toolbar compass-glass-panel",role:"toolbar","aria-label":"Graph controls",children:[f.jsxs("div",{className:"compass-viewer-status","data-state":e?"running":"paused",role:"status","aria-live":"polite",children:[f.jsx("span",{className:"compass-viewer-status-dot","aria-hidden":"true"}),f.jsx("span",{className:"compass-viewer-status-text",children:n})]}),f.jsxs("div",{className:"compass-toolbar-actions",children:[We&&f.jsxs("button",{className:"compass-tool-button",type:"button","aria-label":"Back to community overview",onClick:We,children:[f.jsx(GR,{}),f.jsx("span",{children:"Overview"})]}),f.jsxs("label",{className:"compass-layout-picker",children:[f.jsx(JR,{"aria-hidden":"true"}),f.jsx("span",{className:"sr-only",children:"Graph layout"}),f.jsxs("select",{"aria-label":"Graph layout",value:t,onChange:T=>x(T.target.value),children:[f.jsx("option",{value:"automatic",children:"Automatic"}),f.jsx("option",{value:"circle",children:"Circle"}),f.jsx("option",{value:"concentric",children:"Concentric"}),f.jsx("option",{value:"spiral",children:"Spiral"}),f.jsx("option",{value:"grid",children:"Square grid"})]})]}),f.jsxs("button",{className:"compass-tool-button compass-physics-button",type:"button","aria-label":e?"Stop layout":t==="automatic"?"Run layout":"Fixed layout","aria-pressed":e,disabled:t!=="automatic",title:t==="automatic"?e?"Stop layout":"Run layout":"Physics is available in Automatic layout",onClick:S,children:[e?f.jsx(Vm,{}):t==="automatic"?f.jsx(s3,{}):f.jsx(Vm,{}),f.jsx("span",{children:e?"Stop":t==="automatic"?"Layout":"Fixed"})]}),f.jsx("span",{className:"compass-toolbar-separator","aria-hidden":"true"}),f.jsxs("div",{className:"compass-zoom-controls",role:"group","aria-label":"Zoom controls",children:[f.jsx("button",{className:"compass-tool-button compass-tool-icon-button",type:"button","aria-label":"Zoom out",title:"Zoom out",onClick:O,children:f.jsx(u3,{})}),f.jsx("button",{className:"compass-tool-button compass-zoom-reset",type:"button","aria-label":"Reset zoom to 100%",title:"Reset zoom to 100%",onClick:E,children:"100%"}),f.jsx("button",{className:"compass-tool-button compass-tool-icon-button",type:"button","aria-label":"Zoom in",title:"Zoom in",onClick:_,children:f.jsx(d3,{})})]}),f.jsx("button",{className:"compass-tool-button compass-tool-icon-button",type:"button","aria-label":"Fit graph in view",title:"Fit graph in view",onClick:P,children:f.jsx(Gm,{})}),f.jsx("button",{className:"compass-tool-button compass-tool-icon-button",type:"button","aria-label":"Fit selected neighborhood",title:r?`Fit the selected node and its ${I}-hop neighborhood`:"Select a node to fit its neighborhood",disabled:!r,onClick:Q,children:f.jsx($R,{})}),f.jsx("button",{className:"compass-tool-button compass-tool-icon-button",type:"button","aria-label":"Reset graph view",title:"Reset graph view",onClick:ne,children:f.jsx(Ym,{})}),f.jsx("button",{className:"compass-tool-button compass-tool-icon-button",type:"button","aria-label":i?"Hide labels":"Show labels","aria-pressed":i,title:i?"Hide node labels":"Show all node labels",onClick:j,children:f.jsx(l3,{})}),f.jsx("button",{className:"compass-tool-button compass-tool-icon-button",type:"button","aria-label":o?"Hide relationship labels":"Show relationship labels","aria-pressed":o,title:o?"Hide relationship labels":"Show relationship labels",onClick:V,children:f.jsx(Hm,{})}),f.jsx("button",{ref:re,className:"compass-tool-button compass-tool-icon-button",type:"button","aria-label":"Graph settings","aria-expanded":Ae,"aria-controls":U,title:"Graph settings (?)",onClick:()=>M(T=>{const L=!T;return L&&w?.(),L}),children:f.jsx(a3,{})}),p?f.jsx("div",{className:"compass-toolbar-leading",children:p}):null]}),m,Ae?f.jsxs("div",{id:U,className:"compass-explore-panel compass-glass-panel",role:"region","aria-label":"Graph exploration controls",children:[f.jsxs("div",{className:"compass-explore-heading",children:[f.jsxs("div",{children:[f.jsx("strong",{children:"Graph settings"}),f.jsx("span",{children:r?"Tune the selected neighborhood and canvas":"Set the next neighborhood, then select a node"})]}),f.jsx("kbd",{children:"?"})]}),r?null:f.jsxs("div",{className:"compass-selection-prompt",role:"note",children:[f.jsx(Km,{"aria-hidden":"true"}),f.jsxs("span",{children:[f.jsx("strong",{children:"Select a node to isolate it"}),f.jsx("small",{children:"Use the canvas or node search. Depth and direction can be set now."})]})]}),f.jsxs("button",{className:"compass-explore-toggle",type:"button","aria-label":"Isolate selection","aria-pressed":A,disabled:!r,onClick:de,children:[f.jsx(Km,{"aria-hidden":"true"}),f.jsxs("span",{children:[f.jsx("strong",{children:"Isolate selection"}),f.jsx("small",{children:"Hide everything outside the traversal"})]}),f.jsx("i",{"aria-hidden":"true"})]}),f.jsxs("fieldset",{className:"compass-explore-field",children:[f.jsx("legend",{children:"Neighborhood depth"}),f.jsx("div",{className:"compass-segmented-control","aria-label":"Neighborhood depth",children:[1,2,3,4].map(T=>f.jsx("button",{type:"button","aria-label":`${T} hop${T===1?"":"s"}`,"aria-pressed":I===T,onClick:()=>le(T),children:T},T))})]}),f.jsxs("fieldset",{className:"compass-explore-field",children:[f.jsx("legend",{children:"Edge direction"}),f.jsx("div",{className:"compass-segmented-control","aria-label":"Edge direction",children:[["both","Both"],["outgoing","Out"],["incoming","In"]].map(([T,L])=>f.jsx("button",{type:"button","aria-label":`${L==="Both"?"Both directions":L==="Out"?"Outgoing edges":"Incoming edges"}`,"aria-pressed":l===T,onClick:()=>Ze(T),children:L},T))})]}),f.jsxs("label",{className:"compass-explore-select",children:[f.jsx("span",{children:"Layout spacing"}),f.jsxs("select",{"aria-label":"Layout spacing",value:c,onChange:T=>Ee(Number(T.target.value)),children:[f.jsx("option",{value:.75,children:"Compact · 75%"}),f.jsx("option",{value:1,children:"Default · 100%"}),f.jsx("option",{value:1.25,children:"Airy · 125%"}),f.jsx("option",{value:1.5,children:"Wide · 150%"})]})]}),f.jsxs("button",{className:"compass-explore-toggle",type:"button","aria-label":"Show minimap","aria-pressed":h,onClick:Ue,children:[f.jsx(e3,{"aria-hidden":"true"}),f.jsxs("span",{children:[f.jsx("strong",{children:"Show minimap"}),f.jsx("small",{children:"Track and reposition the visible viewport"})]}),f.jsx("i",{"aria-hidden":"true"})]}),f.jsxs("div",{className:"compass-shortcut-guide","aria-label":"Graph keyboard shortcuts",children:[f.jsxs("div",{className:"compass-shortcut-title",children:[f.jsx(qR,{"aria-hidden":"true"}),f.jsx("strong",{children:"Keyboard"})]}),f.jsxs("dl",{children:[f.jsxs("div",{children:[f.jsx("dt",{children:f.jsx("kbd",{children:"F"})}),f.jsx("dd",{children:"Fit graph"})]}),f.jsxs("div",{children:[f.jsx("dt",{children:f.jsx("kbd",{children:"⇧ F"})}),f.jsx("dd",{children:"Fit selection"})]}),f.jsxs("div",{children:[f.jsxs("dt",{children:[f.jsx("kbd",{children:"+"})," ",f.jsx("kbd",{children:"−"})]}),f.jsx("dd",{children:"Zoom"})]}),f.jsxs("div",{children:[f.jsx("dt",{children:f.jsx("kbd",{children:"0"})}),f.jsx("dd",{children:"100% zoom"})]}),f.jsxs("div",{children:[f.jsx("dt",{children:f.jsx("kbd",{children:"I"})}),f.jsx("dd",{children:"Isolate"})]}),f.jsxs("div",{children:[f.jsxs("dt",{children:[f.jsx("kbd",{children:"["})," ",f.jsx("kbd",{children:"]"})]}),f.jsx("dd",{children:"Depth"})]}),f.jsxs("div",{children:[f.jsx("dt",{children:f.jsx("kbd",{children:"D"})}),f.jsx("dd",{children:"Direction"})]}),f.jsxs("div",{children:[f.jsx("dt",{children:f.jsx("kbd",{children:"M"})}),f.jsx("dd",{children:"Minimap"})]})]})]})]}):null]})}const fv=280,pv=560,mv=24,Ic={width:340,collapsed:!1};function _r(n){return Number.isFinite(n)?Math.min(pv,Math.max(fv,Math.round(n))):Ic.width}function vv(n){return{width:_r(n?.width??Ic.width),collapsed:n?.collapsed??Ic.collapsed}}function _3(n,e){return _r(n-e)}function j3(n,e){return _r(e==="ArrowLeft"?n+mv:e==="ArrowRight"?n-mv:n)}function Z3({width:n,onResize:e}){const t=F.useRef(!1),i=o=>{t.current=!1,o.currentTarget.hasPointerCapture(o.pointerId)&&o.currentTarget.releasePointerCapture(o.pointerId)};return f.jsx("div",{className:"compass-inspector-resizer",role:"separator","aria-label":"Resize graph inspector","aria-orientation":"vertical","aria-valuemin":fv,"aria-valuemax":pv,"aria-valuenow":n,tabIndex:0,onPointerDown:o=>{t.current=!0,o.currentTarget.setPointerCapture(o.pointerId)},onPointerMove:o=>{if(!t.current)return;const r=o.currentTarget.parentElement;r&&e(_3(r.getBoundingClientRect().right,o.clientX))},onPointerUp:i,onPointerCancel:i,onKeyDown:o=>{o.key!=="ArrowLeft"&&o.key!=="ArrowRight"||(o.preventDefault(),e(j3(n,o.key)))},children:f.jsx("span",{"aria-hidden":"true"})})}function yv(n,e,t){if(t===void 0&&n.stats.aggregated&&e.memberCount!==void 0&&e.detailAvailable!==!1)return{type:"community",communityId:e.community};const i=av(e);return i?{type:"source",source:i}:{type:"none"}}function B3(n){const e=n.source?.startLine,t=n.source?.endLine;if(e!==void 0)return t!==void 0&&t!==e?`${e}–${t}`:String(e)}function P3({node:n,hover:e,activation:t}){const i={"--compass-hover-x":`${e.x+18}px`,"--compass-hover-y":`${e.y-42}px`},o=B3(n);return f.jsxs("div",{className:"compass-node-hover-card",role:"tooltip",style:i,children:[f.jsxs("div",{className:"compass-hover-heading",children:[f.jsx("strong",{children:n.label}),f.jsx("span",{children:(n.kind??"symbol").toLocaleUpperCase()})]}),n.change&&f.jsx("span",{className:"compass-change-badge","data-change":n.change,children:n.change==="unchanged"?"Context":`${n.change[0]?.toLocaleUpperCase()}${n.change.slice(1)}`}),n.memberCount!==void 0?f.jsxs("p",{children:[n.memberCount.toLocaleString()," symbols"]}):f.jsxs(f.Fragment,{children:[n.language&&f.jsxs("p",{children:["Language: ",n.language]}),n.source?.file&&f.jsx("p",{className:"compass-hover-source",children:n.source.file}),o&&f.jsxs("p",{children:["Lines: ",o]}),n.signature&&f.jsx("code",{children:n.signature})]}),t.type!=="none"&&f.jsxs("p",{className:"compass-hover-hint",children:[t.type==="community"?f.jsx(ac,{"aria-hidden":"true"}):f.jsx(QR,{"aria-hidden":"true"}),f.jsxs("span",{children:[f.jsx("strong",{children:"Double-click"})," ",t.type==="community"?"to open community subgraph":"to open source code"]})]})]})}const L3={routes_to:"routes to",publishes:"publishes",subscribes:"subscribes",produces:"produces",consumes:"consumes",schedules:"schedules",triggers:"triggers",handles:"handles",registers:"registers",reads:"reads",writes:"writes",maps_to:"maps to",depends_on:"depends on"};function G3(n){const e=n.relation.trim(),t=L3[e]??e,i=n.details?.type==="route"?n.details.data:void 0,o=i?`${i.stage}${i.position===null||i.position===void 0?"":` ${i.position+1}`}`:void 0;return[t,o,i?.operation].filter(r=>r!==void 0&&r!=="").join(" · ")}function F3(n){if(!n?.file.trim())return"";const e=n.startLine,t=n.endLine;if(e!==void 0){const i=t!==void 0&&t!==e?`${e}–${t}`:String(e);return`${n.file}:${i}`}return n.startByte!==void 0?`${n.file}:byte ${n.startByte}`:n.file}function V3(n){const e=n.confidence;return e?`${e[0]?.toLocaleUpperCase()}${e.slice(1)}`:"Unspecified"}function U3(n){if(n)return n==="unchanged"?"Context":`${n[0]?.toLocaleUpperCase()}${n.slice(1)}`}function Y3({edge:n,sourceNode:e,targetNode:t,hover:i}){const o={"--compass-hover-x":`${i.x+18}px`,"--compass-hover-y":`${i.y-52}px`},r=F3(n.relationshipSite),A=n.codeEvidence?.[0],I=U3(n.change),l=Av(n)!==void 0;return f.jsxs("div",{className:"compass-edge-hover-card",role:"tooltip",style:o,children:[f.jsxs("div",{className:"compass-edge-hover-heading",children:[f.jsxs("span",{className:"compass-edge-hover-eyebrow",children:[f.jsx(Pm,{"aria-hidden":"true"}),"Relationship"]}),f.jsx("span",{className:"compass-edge-confidence","data-confidence":n.confidence??"unspecified",children:V3(n)})]}),f.jsxs("div",{className:"compass-edge-trace","aria-label":`${e.label} to ${t.label}`,children:[f.jsx("strong",{children:e.label}),f.jsx("span",{"aria-hidden":"true",children:f.jsx(FR,{})}),f.jsx("strong",{children:t.label})]}),f.jsxs("div",{className:"compass-edge-relation-row",children:[f.jsx("strong",{children:G3(n)||"Relationship"}),I&&f.jsx("span",{className:"compass-change-badge","data-change":n.change,children:I})]}),(A||r)&&f.jsxs("div",{className:"compass-edge-metadata",children:[A&&f.jsxs("p",{children:[f.jsx("span",{children:"Evidence"}),f.jsx("code",{children:A.rule??A.origin})]}),r&&f.jsxs("p",{children:[f.jsx("span",{children:"Source"}),f.jsx("code",{children:r})]})]}),l&&f.jsxs("p",{className:"compass-hover-hint",children:[f.jsx(Pm,{"aria-hidden":"true"}),f.jsxs("span",{children:[f.jsx("strong",{children:"Double-click"})," to open relationship source"]})]})]})}var lc=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ne(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var WA=function(n){return n&&n.Math===Math&&n},_t=WA(typeof globalThis=="object"&&globalThis)||WA(typeof window=="object"&&window)||WA(typeof self=="object"&&self)||WA(typeof lc=="object"&&lc)||(function(){return this})()||lc||Function("return this")(),it=function(n){try{return!!n()}catch{return!0}},H3=it,jr=!H3(function(){var n=(function(){}).bind();return typeof n!="function"||n.hasOwnProperty("prototype")}),K3=jr,bv=Function.prototype,wv=bv.apply,xv=bv.call,QA=typeof Reflect=="object"&&Reflect.apply||(K3?xv.bind(wv):function(){return xv.apply(wv,arguments)}),Sv=jr,Ev=Function.prototype,cc=Ev.call,W3=Sv&&Ev.bind.bind(cc,cc),gt=Sv?W3:function(n){return function(){return cc.apply(n,arguments)}},Tv=gt,Q3=Tv({}.toString),X3=Tv("".slice),Yi=function(n){return X3(Q3(n),8,-1)},$3=Yi,q3=gt,dc=function(n){if($3(n)==="Function")return q3(n)},uc=typeof document=="object"&&document.all,J3=typeof uc>"u"&&uc!==void 0,Ov={all:uc,IS_HTMLDDA:J3},Nv=Ov,e_=Nv.all,ln=Nv.IS_HTMLDDA?function(n){return typeof n=="function"||n===e_}:function(n){return typeof n=="function"},Zr={},t_=it,nn=!t_(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7}),n_=jr,XA=Function.prototype.call,ui=n_?XA.bind(XA):function(){return XA.apply(XA,arguments)},Br={},Dv={}.propertyIsEnumerable,Mv=Object.getOwnPropertyDescriptor,i_=Mv&&!Dv.call({1:2},1);Br.f=i_?function(e){var t=Mv(this,e);return!!t&&t.enumerable}:Dv;var Pr=function(n,e){return{enumerable:!(n&1),configurable:!(n&2),writable:!(n&4),value:e}},g_=gt,o_=it,s_=Yi,hc=Object,r_=g_("".split),$A=o_(function(){return!hc("z").propertyIsEnumerable(0)})?function(n){return s_(n)==="String"?r_(n,""):hc(n)}:hc,as=function(n){return n==null},a_=as,A_=TypeError,Lr=function(n){if(a_(n))throw new A_("Can't call method on "+n);return n},C_=$A,I_=Lr,hi=function(n){return C_(I_(n))},zv=ln,kv=Ov,l_=kv.all,yn=kv.IS_HTMLDDA?function(n){return typeof n=="object"?n!==null:zv(n)||n===l_}:function(n){return typeof n=="object"?n!==null:zv(n)},st={},fc=st,pc=_t,c_=ln,Rv=function(n){return c_(n)?n:void 0},fi=function(n,e){return arguments.length<2?Rv(fc[n])||Rv(pc[n]):fc[n]&&fc[n][e]||pc[n]&&pc[n][e]},d_=gt,jt=d_({}.isPrototypeOf),Gr=typeof navigator<"u"&&String(navigator.userAgent)||"",_v=_t,mc=Gr,jv=_v.process,Zv=_v.Deno,Bv=jv&&jv.versions||Zv&&Zv.version,Pv=Bv&&Bv.v8,pi,qA;Pv&&(pi=Pv.split("."),qA=pi[0]>0&&pi[0]<4?1:+(pi[0]+pi[1])),!qA&&mc&&(pi=mc.match(/Edge\/(\d+)/),(!pi||pi[1]>=74)&&(pi=mc.match(/Chrome\/(\d+)/),pi&&(qA=+pi[1])));var Fr=qA,Lv=Fr,u_=it,h_=_t,f_=h_.String,As=!!Object.getOwnPropertySymbols&&!u_(function(){var n=Symbol("symbol detection");return!f_(n)||!(Object(n)instanceof Symbol)||!Symbol.sham&&Lv&&Lv<41}),p_=As,Gv=p_&&!Symbol.sham&&typeof Symbol.iterator=="symbol",m_=fi,v_=ln,y_=jt,b_=Gv,w_=Object,Vr=b_?function(n){return typeof n=="symbol"}:function(n){var e=m_("Symbol");return v_(e)&&y_(e.prototype,w_(n))},x_=String,Ur=function(n){try{return x_(n)}catch{return"Object"}},S_=ln,E_=Ur,T_=TypeError,fo=function(n){if(S_(n))return n;throw new T_(E_(n)+" is not a function")},O_=fo,N_=as,vc=function(n,e){var t=n[e];return N_(t)?void 0:O_(t)},yc=ui,bc=ln,wc=yn,D_=TypeError,M_=function(n,e){var t,i;if(e==="string"&&bc(t=n.toString)&&!wc(i=yc(t,n))||bc(t=n.valueOf)&&!wc(i=yc(t,n))||e!=="string"&&bc(t=n.toString)&&!wc(i=yc(t,n)))return i;throw new D_("Can't convert object to primitive value")},Fv={exports:{}},Vv=_t,z_=Object.defineProperty,k_=function(n,e){try{z_(Vv,n,{value:e,configurable:!0,writable:!0})}catch{Vv[n]=e}return e},R_=_t,__=k_,Uv="__core-js_shared__",j_=R_[Uv]||__(Uv,{}),xc=j_,Yv=xc;(Fv.exports=function(n,e){return Yv[n]||(Yv[n]=e!==void 0?e:{})})("versions",[]).push({version:"3.33.0",mode:"pure",copyright:"© 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.33.0/LICENSE",source:"https://github.com/zloirock/core-js"});var Cs=Fv.exports,Z_=Lr,B_=Object,Gn=function(n){return B_(Z_(n))},P_=gt,L_=Gn,G_=P_({}.hasOwnProperty),gn=Object.hasOwn||function(e,t){return G_(L_(e),t)},F_=gt,V_=0,U_=Math.random(),Y_=F_(1 .toString),JA=function(n){return"Symbol("+(n===void 0?"":n)+")_"+Y_(++V_+U_,36)},H_=_t,K_=Cs,Hv=gn,W_=JA,Q_=As,X_=Gv,Is=H_.Symbol,Sc=K_("wks"),$_=X_?Is.for||Is:Is&&Is.withoutSetter||W_,Ft=function(n){return Hv(Sc,n)||(Sc[n]=Q_&&Hv(Is,n)?Is[n]:$_("Symbol."+n)),Sc[n]},q_=ui,Kv=yn,Wv=Vr,J_=vc,e5=M_,t5=Ft,n5=TypeError,i5=t5("toPrimitive"),g5=function(n,e){if(!Kv(n)||Wv(n))return n;var t=J_(n,i5),i;if(t){if(e===void 0&&(e="default"),i=q_(t,n,e),!Kv(i)||Wv(i))return i;throw new n5("Can't convert object to primitive value")}return e===void 0&&(e="number"),e5(n,e)},o5=g5,s5=Vr,eC=function(n){var e=o5(n,"string");return s5(e)?e:e+""},r5=_t,Qv=yn,Ec=r5.document,a5=Qv(Ec)&&Qv(Ec.createElement),Xv=function(n){return a5?Ec.createElement(n):{}},A5=nn,C5=it,I5=Xv,$v=!A5&&!C5(function(){return Object.defineProperty(I5("div"),"a",{get:function(){return 7}}).a!==7}),l5=nn,c5=ui,d5=Br,u5=Pr,h5=hi,f5=eC,p5=gn,m5=$v,qv=Object.getOwnPropertyDescriptor;Zr.f=l5?qv:function(e,t){if(e=h5(e),t=f5(t),m5)try{return qv(e,t)}catch{}if(p5(e,t))return u5(!c5(d5.f,e,t),e[t])};var v5=it,y5=ln,b5=/#|\.prototype\./,Yr=function(n,e){var t=x5[w5(n)];return t===E5?!0:t===S5?!1:y5(e)?v5(e):!!e},w5=Yr.normalize=function(n){return String(n).replace(b5,".").toLowerCase()},x5=Yr.data={},S5=Yr.NATIVE="N",E5=Yr.POLYFILL="P",T5=Yr,Jv=dc,O5=fo,N5=jr,D5=Jv(Jv.bind),Hr=function(n,e){return O5(n),e===void 0?n:N5?D5(n,e):function(){return n.apply(e,arguments)}},Fn={},M5=nn,z5=it,ey=M5&&z5(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42}),k5=yn,R5=String,_5=TypeError,Hi=function(n){if(k5(n))return n;throw new _5(R5(n)+" is not an object")},j5=nn,Z5=$v,B5=ey,tC=Hi,ty=eC,P5=TypeError,Tc=Object.defineProperty,L5=Object.getOwnPropertyDescriptor,Oc="enumerable",Nc="configurable",Dc="writable";Fn.f=j5?B5?function(e,t,i){if(tC(e),t=ty(t),tC(i),typeof e=="function"&&t==="prototype"&&"value"in i&&Dc in i&&!i[Dc]){var o=L5(e,t);o&&o[Dc]&&(e[t]=i.value,i={configurable:Nc in i?i[Nc]:o[Nc],enumerable:Oc in i?i[Oc]:o[Oc],writable:!1})}return Tc(e,t,i)}:Tc:function(e,t,i){if(tC(e),t=ty(t),tC(i),Z5)try{return Tc(e,t,i)}catch{}if("get"in i||"set"in i)throw new P5("Accessors not supported");return"value"in i&&(e[t]=i.value),e};var G5=nn,F5=Fn,V5=Pr,ls=G5?function(n,e,t){return F5.f(n,e,V5(1,t))}:function(n,e,t){return n[e]=t,n},nC=_t,U5=QA,Y5=dc,H5=ln,K5=Zr.f,W5=T5,cs=st,Q5=Hr,ds=ls,ny=gn,X5=function(n){var e=function(t,i,o){if(this instanceof e){switch(arguments.length){case 0:return new n;case 1:return new n(t);case 2:return new n(t,i)}return new n(t,i,o)}return U5(n,this,arguments)};return e.prototype=n.prototype,e},ze=function(n,e){var t=n.target,i=n.global,o=n.stat,r=n.proto,A=i?nC:o?nC[t]:(nC[t]||{}).prototype,I=i?cs:cs[t]||ds(cs,t,{})[t],l=I.prototype,c,h,p,m,y,w,S,x,O;for(m in e)c=W5(i?m:t+(o?".":"#")+m,n.forced),h=!c&&A&&ny(A,m),w=I[m],h&&(n.dontCallGetSet?(O=K5(A,m),S=O&&O.value):S=A[m]),y=h&&S?S:e[m],!(h&&typeof w==typeof y)&&(n.bind&&h?x=Q5(y,nC):n.wrap&&h?x=X5(y):r&&H5(y)?x=Y5(y):x=y,(n.sham||y&&y.sham||w&&w.sham)&&ds(x,"sham",!0),ds(I,m,x),r&&(p=t+"Prototype",ny(cs,p)||ds(cs,p,{}),ds(cs[p],m,y),n.real&&l&&(c||!l[m])&&ds(l,m,y)))},$5=Math.ceil,q5=Math.floor,J5=Math.trunc||function(e){var t=+e;return(t>0?q5:$5)(t)},ej=J5,iC=function(n){var e=+n;return e!==e||e===0?0:ej(e)},tj=iC,nj=Math.max,ij=Math.min,Kr=function(n,e){var t=tj(n);return t<0?nj(t+e,0):ij(t,e)},gj=iC,oj=Math.min,sj=function(n){return n>0?oj(gj(n),9007199254740991):0},rj=sj,Jn=function(n){return rj(n.length)},aj=hi,Aj=Kr,Cj=Jn,iy=function(n){return function(e,t,i){var o=aj(e),r=Cj(o),A=Aj(i,r),I;if(n&&t!==t){for(;r>A;)if(I=o[A++],I!==I)return!0}else for(;r>A;A++)if((n||A in o)&&o[A]===t)return n||A||0;return!n&&-1}},Mc={includes:iy(!0),indexOf:iy(!1)},Wr={},Ij=gt,zc=gn,lj=hi,cj=Mc.indexOf,dj=Wr,gy=Ij([].push),oy=function(n,e){var t=lj(n),i=0,o=[],r;for(r in t)!zc(dj,r)&&zc(t,r)&&gy(o,r);for(;e.length>i;)zc(t,r=e[i++])&&(~cj(o,r)||gy(o,r));return o},kc=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],uj=oy,hj=kc,Qr=Object.keys||function(e){return uj(e,hj)},Xr={};Xr.f=Object.getOwnPropertySymbols;var sy=nn,fj=gt,pj=ui,mj=it,Rc=Qr,vj=Xr,yj=Br,bj=Gn,wj=$A,us=Object.assign,ry=Object.defineProperty,xj=fj([].concat),Sj=!us||mj(function(){if(sy&&us({b:1},us(ry({},"a",{enumerable:!0,get:function(){ry(this,"b",{value:3,enumerable:!1})}}),{b:2})).b!==1)return!0;var n={},e={},t=Symbol("assign detection"),i="abcdefghijklmnopqrst";return n[t]=7,i.split("").forEach(function(o){e[o]=o}),us({},n)[t]!==7||Rc(us({},e)).join("")!==i})?function(e,t){for(var i=bj(e),o=arguments.length,r=1,A=vj.f,I=yj.f;o>r;)for(var l=wj(arguments[r++]),c=A?xj(Rc(l),A(l)):Rc(l),h=c.length,p=0,m;h>p;)m=c[p++],(!sy||pj(I,l,m))&&(i[m]=l[m]);return i}:us,Ej=ze,ay=Sj;Ej({target:"Object",stat:!0,forced:Object.assign!==ay},{assign:ay});var Tj=st,Oj=Tj.Object.assign,Nj=Oj,Dj=Nj,Mj=Dj,Vt=Ne(Mj),zj=gt,gC=zj([].slice),Ay=gt,kj=fo,Rj=yn,_j=gn,Cy=gC,jj=jr,Iy=Function,Zj=Ay([].concat),Bj=Ay([].join),_c={},Pj=function(n,e,t){if(!_j(_c,e)){for(var i=[],o=0;o=.1;)w=+r[p++%A],w>h&&(w=h),y=Math.sqrt(w*w/(1+c*c)),y=I<0?-y:y,e+=y,t+=c*y,m===!0?n.lineTo(e,t):n.moveTo(e,t),h-=w,m=!m}function n4(n,e,t,i){n.beginPath();const o=6,r=Math.PI*2/o;n.moveTo(e+i,t);for(let A=1;A1?t-1:0),o=1;o"u")){var i=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css",t==="top"&&i.firstChild?i.insertBefore(o,i.firstChild):i.appendChild(o),o.styleSheet?o.styleSheet.cssText=n:o.appendChild(document.createTextNode(n))}}var g4=`.vis-overlay { +Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const A of n.seen.entries()){const I=A[1];if(e===A[0]){r(A);continue}if(n.external){const c=n.external.registry.get(A[0])?.id;if(e!==A[0]&&c){r(A);continue}}if(n.metadataRegistry.get(A[0])?.id){r(A);continue}if(I.cycle){r(A);continue}if(I.count>1&&n.reused==="ref"){r(A);continue}}}function hm(n,e){const t=n.seen.get(e);if(!t)throw new Error("Unprocessed schema. This is a bug in Zod.");const i=I=>{const l=n.seen.get(I);if(l.ref===null)return;const c=l.def??l.schema,h={...c},p=l.ref;if(l.ref=null,p){i(p);const y=n.seen.get(p),w=y.schema;if(w.$ref&&(n.target==="draft-07"||n.target==="draft-04"||n.target==="openapi-3.0")?(c.allOf=c.allOf??[],c.allOf.push(w)):Object.assign(c,w),Object.assign(c,h),I._zod.parent===p)for(const x in c)x==="$ref"||x==="allOf"||x in h||delete c[x];if(w.$ref&&y.def)for(const x in c)x==="$ref"||x==="allOf"||x in y.def&&JSON.stringify(c[x])===JSON.stringify(y.def[x])&&delete c[x]}const m=I._zod.parent;if(m&&m!==p){i(m);const y=n.seen.get(m);if(y?.schema.$ref&&(c.$ref=y.schema.$ref,y.def))for(const w in c)w==="$ref"||w==="allOf"||w in y.def&&JSON.stringify(c[w])===JSON.stringify(y.def[w])&&delete c[w]}n.override({zodSchema:I,jsonSchema:c,path:l.path??[]})};for(const I of[...n.seen.entries()].reverse())i(I[0]);const o={};if(n.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":n.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":n.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":n.target,n.external?.uri){const I=n.external.registry.get(e)?.id;if(!I)throw new Error("Schema is missing an `id` property");o.$id=n.external.uri(I)}Object.assign(o,t.def??t.schema);const r=n.metadataRegistry.get(e)?.id;r!==void 0&&o.id===r&&delete o.id;const A=n.external?.defs??{};for(const I of n.seen.entries()){const l=I[1];l.def&&l.defId&&(l.def.id===l.defId&&delete l.def.id,A[l.defId]=l.def)}n.external||Object.keys(A).length>0&&(n.target==="draft-2020-12"?o.$defs=A:o.definitions=A);try{const I=JSON.parse(JSON.stringify(o));return Object.defineProperty(I,"~standard",{value:{...e["~standard"],jsonSchema:{input:FA(e,"input",n.processors),output:FA(e,"output",n.processors)}},enumerable:!1,writable:!1}),I}catch{throw new Error("Error converting schema to JSON.")}}function bn(n,e){const t=e??{seen:new Set};if(t.seen.has(n))return!1;t.seen.add(n);const i=n._zod.def;if(i.type==="transform")return!0;if(i.type==="array")return bn(i.element,t);if(i.type==="set")return bn(i.valueType,t);if(i.type==="lazy")return bn(i.getter(),t);if(i.type==="promise"||i.type==="optional"||i.type==="nonoptional"||i.type==="nullable"||i.type==="readonly"||i.type==="default"||i.type==="prefault")return bn(i.innerType,t);if(i.type==="intersection")return bn(i.left,t)||bn(i.right,t);if(i.type==="record"||i.type==="map")return bn(i.keyType,t)||bn(i.valueType,t);if(i.type==="pipe")return n._zod.traits.has("$ZodCodec")?!0:bn(i.in,t)||bn(i.out,t);if(i.type==="object"){for(const o in i.shape)if(bn(i.shape[o],t))return!0;return!1}if(i.type==="union"){for(const o of i.options)if(bn(o,t))return!0;return!1}if(i.type==="tuple"){for(const o of i.items)if(bn(o,t))return!0;return!!(i.rest&&bn(i.rest,t))}return!1}const JM=(n,e={})=>t=>{const i=dm({...t,processors:e});return Kt(n,i),um(i,n),hm(i,n)},FA=(n,e,t={})=>i=>{const{libraryOptions:o,target:r}=i??{},A=dm({...o??{},target:r,io:e,processors:t});return Kt(n,A),um(A,n),hm(A,n)},ez={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},tz=(n,e,t,i)=>{const o=t;o.type="string";const{minimum:r,maximum:A,format:I,patterns:l,contentEncoding:c}=n._zod.bag;if(typeof r=="number"&&(o.minLength=r),typeof A=="number"&&(o.maxLength=A),I&&(o.format=ez[I]??I,o.format===""&&delete o.format,I==="time"&&delete o.format),c&&(o.contentEncoding=c),l&&l.size>0){const h=[...l];h.length===1?o.pattern=h[0].source:h.length>1&&(o.allOf=[...h.map(p=>({...e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"?{type:"string"}:{},pattern:p.source}))])}},nz=(n,e,t,i)=>{const o=t,{minimum:r,maximum:A,format:I,multipleOf:l,exclusiveMaximum:c,exclusiveMinimum:h}=n._zod.bag;typeof I=="string"&&I.includes("int")?o.type="integer":o.type="number";const p=typeof h=="number"&&h>=(r??Number.NEGATIVE_INFINITY),m=typeof c=="number"&&c<=(A??Number.POSITIVE_INFINITY),y=e.target==="draft-04"||e.target==="openapi-3.0";p?y?(o.minimum=h,o.exclusiveMinimum=!0):o.exclusiveMinimum=h:typeof r=="number"&&(o.minimum=r),m?y?(o.maximum=c,o.exclusiveMaximum=!0):o.exclusiveMaximum=c:typeof A=="number"&&(o.maximum=A),typeof l=="number"&&(o.multipleOf=l)},iz=(n,e,t,i)=>{t.type="boolean"},gz=(n,e,t,i)=>{t.not={}},oz=(n,e,t,i)=>{},sz=(n,e,t,i)=>{const o=n._zod.def,r=Mp(o.entries);r.every(A=>typeof A=="number")&&(t.type="number"),r.every(A=>typeof A=="string")&&(t.type="string"),t.enum=r},rz=(n,e,t,i)=>{const o=n._zod.def,r=[];for(const A of o.values)if(A===void 0){if(e.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof A=="bigint"){if(e.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");r.push(Number(A))}else r.push(A);if(r.length!==0)if(r.length===1){const A=r[0];t.type=A===null?"null":typeof A,e.target==="draft-04"||e.target==="openapi-3.0"?t.enum=[A]:t.const=A}else r.every(A=>typeof A=="number")&&(t.type="number"),r.every(A=>typeof A=="string")&&(t.type="string"),r.every(A=>typeof A=="boolean")&&(t.type="boolean"),r.every(A=>A===null)&&(t.type="null"),t.enum=r},az=(n,e,t,i)=>{if(e.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},Az=(n,e,t,i)=>{if(e.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},Cz=(n,e,t,i)=>{const o=t,r=n._zod.def,{minimum:A,maximum:I}=n._zod.bag;typeof A=="number"&&(o.minItems=A),typeof I=="number"&&(o.maxItems=I),o.type="array",o.items=Kt(r.element,e,{...i,path:[...i.path,"items"]})},Iz=(n,e,t,i)=>{const o=t,r=n._zod.def;o.type="object",o.properties={};const A=r.shape;for(const c in A)o.properties[c]=Kt(A[c],e,{...i,path:[...i.path,"properties",c]});const I=new Set(Object.keys(A)),l=new Set([...I].filter(c=>{const h=r.shape[c]._zod;return e.io==="input"?h.optin===void 0:h.optout===void 0}));l.size>0&&(o.required=Array.from(l)),r.catchall?._zod.def.type==="never"?o.additionalProperties=!1:r.catchall?r.catchall&&(o.additionalProperties=Kt(r.catchall,e,{...i,path:[...i.path,"additionalProperties"]})):e.io==="output"&&(o.additionalProperties=!1)},lz=(n,e,t,i)=>{const o=n._zod.def,r=o.inclusive===!1,A=o.options.map((I,l)=>Kt(I,e,{...i,path:[...i.path,r?"oneOf":"anyOf",l]}));r?t.oneOf=A:t.anyOf=A},cz=(n,e,t,i)=>{const o=n._zod.def,r=Kt(o.left,e,{...i,path:[...i.path,"allOf",0]}),A=Kt(o.right,e,{...i,path:[...i.path,"allOf",1]}),I=c=>"allOf"in c&&Object.keys(c).length===1,l=[...I(r)?r.allOf:[r],...I(A)?A.allOf:[A]];t.allOf=l},dz=(n,e,t,i)=>{const o=t,r=n._zod.def;o.type="object";const A=r.keyType,l=A._zod.bag?.patterns;if(r.mode==="loose"&&l&&l.size>0){const h=Kt(r.valueType,e,{...i,path:[...i.path,"patternProperties","*"]});o.patternProperties={};for(const p of l)o.patternProperties[p.source]=h}else(e.target==="draft-07"||e.target==="draft-2020-12")&&(o.propertyNames=Kt(r.keyType,e,{...i,path:[...i.path,"propertyNames"]})),o.additionalProperties=Kt(r.valueType,e,{...i,path:[...i.path,"additionalProperties"]});const c=A._zod.values;if(c){const h=[...c].filter(p=>typeof p=="string"||typeof p=="number");h.length>0&&(o.required=h)}},uz=(n,e,t,i)=>{const o=n._zod.def,r=Kt(o.innerType,e,i),A=e.seen.get(n);e.target==="openapi-3.0"?(A.ref=o.innerType,t.nullable=!0):t.anyOf=[r,{type:"null"}]},hz=(n,e,t,i)=>{const o=n._zod.def;Kt(o.innerType,e,i);const r=e.seen.get(n);r.ref=o.innerType},fz=(n,e,t,i)=>{const o=n._zod.def;Kt(o.innerType,e,i);const r=e.seen.get(n);r.ref=o.innerType,t.default=JSON.parse(JSON.stringify(o.defaultValue))},pz=(n,e,t,i)=>{const o=n._zod.def;Kt(o.innerType,e,i);const r=e.seen.get(n);r.ref=o.innerType,e.io==="input"&&(t._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},mz=(n,e,t,i)=>{const o=n._zod.def;Kt(o.innerType,e,i);const r=e.seen.get(n);r.ref=o.innerType;let A;try{A=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}t.default=A},vz=(n,e,t,i)=>{const o=n._zod.def,r=o.in._zod.traits.has("$ZodTransform"),A=e.io==="input"?r?o.out:o.in:o.out;Kt(A,e,i);const I=e.seen.get(n);I.ref=A},yz=(n,e,t,i)=>{const o=n._zod.def;Kt(o.innerType,e,i);const r=e.seen.get(n);r.ref=o.innerType,t.readOnly=!0},fm=(n,e,t,i)=>{const o=n._zod.def;Kt(o.innerType,e,i);const r=e.seen.get(n);r.ref=o.innerType},bz=$("ZodISODateTime",(n,e)=>{wD.init(n,e),Rt.init(n,e)});function wz(n){return NM(bz,n)}const xz=$("ZodISODate",(n,e)=>{xD.init(n,e),Rt.init(n,e)});function Sz(n){return DM(xz,n)}const Ez=$("ZodISOTime",(n,e)=>{SD.init(n,e),Rt.init(n,e)});function Tz(n){return MM(Ez,n)}const Oz=$("ZodISODuration",(n,e)=>{ED.init(n,e),Rt.init(n,e)});function Nz(n){return zM(Oz,n)}const qn=$("ZodError",(n,e)=>{Zp.init(n,e),n.name="ZodError",Object.defineProperties(n,{format:{value:t=>uN(n,t)},flatten:{value:t=>dN(n,t)},addIssue:{value:t=>{n.issues.push(t),n.message=JSON.stringify(n.issues,Yl,2)}},addIssues:{value:t=>{n.issues.push(...t),n.message=JSON.stringify(n.issues,Yl,2)}},isEmpty:{get(){return n.issues.length===0}}})},{Parent:Error}),Dz=Ql(qn),Mz=Xl(qn),zz=jA(qn),kz=ZA(qn),Rz=pN(qn),_z=mN(qn),jz=vN(qn),Zz=yN(qn),Bz=bN(qn),Pz=wN(qn),Lz=xN(qn),Gz=SN(qn),pm=new WeakMap;function kr(n,e,t){const i=Object.getPrototypeOf(n);let o=pm.get(i);if(o||(o=new Set,pm.set(i,o)),!o.has(e)){o.add(e);for(const r in t){const A=t[r];Object.defineProperty(i,r,{configurable:!0,enumerable:!1,get(){const I=A.bind(this);return Object.defineProperty(this,r,{configurable:!0,writable:!0,enumerable:!0,value:I}),I},set(I){Object.defineProperty(this,r,{configurable:!0,writable:!0,enumerable:!0,value:I})}})}}}const kt=$("ZodType",(n,e)=>(zt.init(n,e),Object.assign(n["~standard"],{jsonSchema:{input:FA(n,"input"),output:FA(n,"output")}}),n.toJSONSchema=JM(n,{}),n.def=e,n.type=e.type,Object.defineProperty(n,"_def",{value:e}),n.parse=(t,i)=>Dz(n,t,i,{callee:n.parse}),n.safeParse=(t,i)=>zz(n,t,i),n.parseAsync=async(t,i)=>Mz(n,t,i,{callee:n.parseAsync}),n.safeParseAsync=async(t,i)=>kz(n,t,i),n.spa=n.safeParseAsync,n.encode=(t,i)=>Rz(n,t,i),n.decode=(t,i)=>_z(n,t,i),n.encodeAsync=async(t,i)=>jz(n,t,i),n.decodeAsync=async(t,i)=>Zz(n,t,i),n.safeEncode=(t,i)=>Bz(n,t,i),n.safeDecode=(t,i)=>Pz(n,t,i),n.safeEncodeAsync=async(t,i)=>Lz(n,t,i),n.safeDecodeAsync=async(t,i)=>Gz(n,t,i),kr(n,"ZodType",{check(...t){const i=this.def;return this.clone(yg(i,{checks:[...i.checks??[],...t.map(o=>typeof o=="function"?{_zod:{check:o,def:{check:"custom"},onattach:[]}}:o)]}),{parent:!0})},with(...t){return this.check(...t)},clone(t,i){return bg(this,t,i)},brand(){return this},register(t,i){return t.add(this,i),this},refine(t,i){return this.check(Mk(t,i))},superRefine(t,i){return this.check(zk(t,i))},overwrite(t){return this.check(as(t))},optional(){return Nm(this)},exactOptional(){return pk(this)},nullable(){return Dm(this)},nullish(){return Nm(Dm(this))},nonoptional(t){return xk(this,t)},array(){return Fe(this)},or(t){return Em([this,t])},and(t){return ck(this,t)},transform(t){return zm(this,hk(t))},default(t){return yk(this,t)},prefault(t){return wk(this,t)},catch(t){return Ek(this,t)},pipe(t){return zm(this,t)},readonly(){return Nk(this)},describe(t){const i=this.clone();return zr.add(i,{description:t}),i},meta(...t){if(t.length===0)return zr.get(this);const i=this.clone();return zr.add(i,t[0]),i},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(t){return t(this)}}),Object.defineProperty(n,"description",{get(){return zr.get(n)?.description},configurable:!0}),n)),mm=$("_ZodString",(n,e)=>{$l.init(n,e),kt.init(n,e),n._zod.processJSONSchema=(i,o,r)=>tz(n,i,o);const t=n._zod.bag;n.format=t.format??null,n.minLength=t.minimum??null,n.maxLength=t.maximum??null,kr(n,"_ZodString",{regex(...i){return this.check(BM(...i))},includes(...i){return this.check(GM(...i))},startsWith(...i){return this.check(FM(...i))},endsWith(...i){return this.check(VM(...i))},min(...i){return this.check(GA(...i))},max(...i){return this.check(lm(...i))},length(...i){return this.check(cm(...i))},nonempty(...i){return this.check(GA(1,...i))},lowercase(i){return this.check(PM(i))},uppercase(i){return this.check(LM(i))},trim(){return this.check(YM())},normalize(...i){return this.check(UM(...i))},toLowerCase(){return this.check(HM())},toUpperCase(){return this.check(KM())},slugify(){return this.check(WM())}})}),Fz=$("ZodString",(n,e)=>{$l.init(n,e),mm.init(n,e),n.email=t=>n.check(aM(Vz,t)),n.url=t=>n.check(cM(Uz,t)),n.jwt=t=>n.check(OM(ok,t)),n.emoji=t=>n.check(dM(Yz,t)),n.guid=t=>n.check(am(vm,t)),n.uuid=t=>n.check(AM(VA,t)),n.uuidv4=t=>n.check(CM(VA,t)),n.uuidv6=t=>n.check(IM(VA,t)),n.uuidv7=t=>n.check(lM(VA,t)),n.nanoid=t=>n.check(uM(Hz,t)),n.guid=t=>n.check(am(vm,t)),n.cuid=t=>n.check(hM(Kz,t)),n.cuid2=t=>n.check(fM(Wz,t)),n.ulid=t=>n.check(pM(Qz,t)),n.base64=t=>n.check(SM(nk,t)),n.base64url=t=>n.check(EM(ik,t)),n.xid=t=>n.check(mM(Xz,t)),n.ksuid=t=>n.check(vM($z,t)),n.ipv4=t=>n.check(yM(qz,t)),n.ipv6=t=>n.check(bM(Jz,t)),n.cidrv4=t=>n.check(wM(ek,t)),n.cidrv6=t=>n.check(xM(tk,t)),n.e164=t=>n.check(TM(gk,t)),n.datetime=t=>n.check(wz(t)),n.date=t=>n.check(Sz(t)),n.time=t=>n.check(Tz(t)),n.duration=t=>n.check(Nz(t))});function H(n){return rM(Fz,n)}const Rt=$("ZodStringFormat",(n,e)=>{Ot.init(n,e),mm.init(n,e)}),Vz=$("ZodEmail",(n,e)=>{dD.init(n,e),Rt.init(n,e)}),vm=$("ZodGUID",(n,e)=>{lD.init(n,e),Rt.init(n,e)}),VA=$("ZodUUID",(n,e)=>{cD.init(n,e),Rt.init(n,e)}),Uz=$("ZodURL",(n,e)=>{uD.init(n,e),Rt.init(n,e)}),Yz=$("ZodEmoji",(n,e)=>{hD.init(n,e),Rt.init(n,e)}),Hz=$("ZodNanoID",(n,e)=>{fD.init(n,e),Rt.init(n,e)}),Kz=$("ZodCUID",(n,e)=>{pD.init(n,e),Rt.init(n,e)}),Wz=$("ZodCUID2",(n,e)=>{mD.init(n,e),Rt.init(n,e)}),Qz=$("ZodULID",(n,e)=>{vD.init(n,e),Rt.init(n,e)}),Xz=$("ZodXID",(n,e)=>{yD.init(n,e),Rt.init(n,e)}),$z=$("ZodKSUID",(n,e)=>{bD.init(n,e),Rt.init(n,e)}),qz=$("ZodIPv4",(n,e)=>{TD.init(n,e),Rt.init(n,e)}),Jz=$("ZodIPv6",(n,e)=>{OD.init(n,e),Rt.init(n,e)}),ek=$("ZodCIDRv4",(n,e)=>{ND.init(n,e),Rt.init(n,e)}),tk=$("ZodCIDRv6",(n,e)=>{DD.init(n,e),Rt.init(n,e)}),nk=$("ZodBase64",(n,e)=>{MD.init(n,e),Rt.init(n,e)}),ik=$("ZodBase64URL",(n,e)=>{kD.init(n,e),Rt.init(n,e)}),gk=$("ZodE164",(n,e)=>{RD.init(n,e),Rt.init(n,e)}),ok=$("ZodJWT",(n,e)=>{jD.init(n,e),Rt.init(n,e)}),ym=$("ZodNumber",(n,e)=>{Wp.init(n,e),kt.init(n,e),n._zod.processJSONSchema=(i,o,r)=>nz(n,i,o),kr(n,"ZodNumber",{gt(i,o){return this.check(Cm(i,o))},gte(i,o){return this.check(ec(i,o))},min(i,o){return this.check(ec(i,o))},lt(i,o){return this.check(Am(i,o))},lte(i,o){return this.check(Jl(i,o))},max(i,o){return this.check(Jl(i,o))},int(i){return this.check(bm(i))},safe(i){return this.check(bm(i))},positive(i){return this.check(Cm(0,i))},nonnegative(i){return this.check(ec(0,i))},negative(i){return this.check(Am(0,i))},nonpositive(i){return this.check(Jl(0,i))},multipleOf(i,o){return this.check(Im(i,o))},step(i,o){return this.check(Im(i,o))},finite(){return this}});const t=n._zod.bag;n.minValue=Math.max(t.minimum??Number.NEGATIVE_INFINITY,t.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,n.maxValue=Math.min(t.maximum??Number.POSITIVE_INFINITY,t.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,n.isInt=(t.format??"").includes("int")||Number.isSafeInteger(t.multipleOf??.5),n.isFinite=!0,n.format=t.format??null});function he(n){return kM(ym,n)}const sk=$("ZodNumberFormat",(n,e)=>{ZD.init(n,e),ym.init(n,e)});function bm(n){return RM(sk,n)}const rk=$("ZodBoolean",(n,e)=>{BD.init(n,e),kt.init(n,e),n._zod.processJSONSchema=(t,i,o)=>iz(n,t,i)});function Ln(n){return _M(rk,n)}const ak=$("ZodUnknown",(n,e)=>{PD.init(n,e),kt.init(n,e),n._zod.processJSONSchema=(t,i,o)=>oz()});function ho(){return jM(ak)}const Ak=$("ZodNever",(n,e)=>{LD.init(n,e),kt.init(n,e),n._zod.processJSONSchema=(t,i,o)=>gz(n,t,i)});function wm(n){return ZM(Ak,n)}const Ck=$("ZodArray",(n,e)=>{GD.init(n,e),kt.init(n,e),n._zod.processJSONSchema=(t,i,o)=>Cz(n,t,i,o),n.element=e.element,kr(n,"ZodArray",{min(t,i){return this.check(GA(t,i))},nonempty(t){return this.check(GA(1,t))},max(t,i){return this.check(lm(t,i))},length(t,i){return this.check(cm(t,i))},unwrap(){return this.element}})});function Fe(n,e){return QM(Ck,n,e)}const xm=$("ZodObject",(n,e)=>{VD.init(n,e),kt.init(n,e),n._zod.processJSONSchema=(t,i,o)=>Iz(n,t,i,o),At(n,"shape",()=>e.shape),kr(n,"ZodObject",{keyof(){return ct(Object.keys(this._zod.def.shape))},catchall(t){return this.clone({...this._zod.def,catchall:t})},passthrough(){return this.clone({...this._zod.def,catchall:ho()})},loose(){return this.clone({...this._zod.def,catchall:ho()})},strict(){return this.clone({...this._zod.def,catchall:wm()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(t){return aN(this,t)},safeExtend(t){return AN(this,t)},merge(t){return CN(this,t)},pick(t){return sN(this,t)},omit(t){return rN(this,t)},partial(...t){return IN(Om,this,t[0])},required(...t){return lN(Mm,this,t[0])}})});function mt(n,e){const t={type:"object",shape:n??{},...be(e)};return new xm(t)}function xe(n,e){return new xm({type:"object",shape:n,catchall:wm(),...be(e)})}const Sm=$("ZodUnion",(n,e)=>{Jp.init(n,e),kt.init(n,e),n._zod.processJSONSchema=(t,i,o)=>lz(n,t,i,o),n.options=e.options});function Em(n,e){return new Sm({type:"union",options:n,...be(e)})}const Ik=$("ZodDiscriminatedUnion",(n,e)=>{Sm.init(n,e),UD.init(n,e)});function tc(n,e,t){return new Ik({type:"union",options:e,discriminator:n,...be(t)})}const lk=$("ZodIntersection",(n,e)=>{YD.init(n,e),kt.init(n,e),n._zod.processJSONSchema=(t,i,o)=>cz(n,t,i,o)});function ck(n,e){return new lk({type:"intersection",left:n,right:e})}const Tm=$("ZodRecord",(n,e)=>{HD.init(n,e),kt.init(n,e),n._zod.processJSONSchema=(t,i,o)=>dz(n,t,i,o),n.keyType=e.keyType,n.valueType=e.valueType});function nc(n,e,t){return!e||!e._zod?new Tm({type:"record",keyType:H(),valueType:n,...be(e)}):new Tm({type:"record",keyType:n,valueType:e,...be(t)})}const ic=$("ZodEnum",(n,e)=>{KD.init(n,e),kt.init(n,e),n._zod.processJSONSchema=(i,o,r)=>sz(n,i,o),n.enum=e.entries,n.options=Object.values(e.entries);const t=new Set(Object.keys(e.entries));n.extract=(i,o)=>{const r={};for(const A of i)if(t.has(A))r[A]=e.entries[A];else throw new Error(`Key ${A} not found in enum`);return new ic({...e,checks:[],...be(o),entries:r})},n.exclude=(i,o)=>{const r={...e.entries};for(const A of i)if(t.has(A))delete r[A];else throw new Error(`Key ${A} not found in enum`);return new ic({...e,checks:[],...be(o),entries:r})}});function ct(n,e){const t=Array.isArray(n)?Object.fromEntries(n.map(i=>[i,i])):n;return new ic({type:"enum",entries:t,...be(e)})}const dk=$("ZodLiteral",(n,e)=>{WD.init(n,e),kt.init(n,e),n._zod.processJSONSchema=(t,i,o)=>rz(n,t,i),n.values=new Set(e.values),Object.defineProperty(n,"value",{get(){if(e.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return e.values[0]}})});function dt(n,e){return new dk({type:"literal",values:Array.isArray(n)?n:[n],...be(e)})}const uk=$("ZodTransform",(n,e)=>{QD.init(n,e),kt.init(n,e),n._zod.processJSONSchema=(t,i,o)=>Az(n,t),n._zod.parse=(t,i)=>{if(i.direction==="backward")throw new Dp(n.constructor.name);t.addIssue=r=>{if(typeof r=="string")t.issues.push(Mr(r,t.value,e));else{const A=r;A.fatal&&(A.continue=!1),A.code??(A.code="custom"),A.input??(A.input=t.value),A.inst??(A.inst=n),t.issues.push(Mr(A))}};const o=e.transform(t.value,t);return o instanceof Promise?o.then(r=>(t.value=r,t.fallback=!0,t)):(t.value=o,t.fallback=!0,t)}});function hk(n){return new uk({type:"transform",transform:n})}const Om=$("ZodOptional",(n,e)=>{nm.init(n,e),kt.init(n,e),n._zod.processJSONSchema=(t,i,o)=>fm(n,t,i,o),n.unwrap=()=>n._zod.def.innerType});function Nm(n){return new Om({type:"optional",innerType:n})}const fk=$("ZodExactOptional",(n,e)=>{XD.init(n,e),kt.init(n,e),n._zod.processJSONSchema=(t,i,o)=>fm(n,t,i,o),n.unwrap=()=>n._zod.def.innerType});function pk(n){return new fk({type:"optional",innerType:n})}const mk=$("ZodNullable",(n,e)=>{$D.init(n,e),kt.init(n,e),n._zod.processJSONSchema=(t,i,o)=>uz(n,t,i,o),n.unwrap=()=>n._zod.def.innerType});function Dm(n){return new mk({type:"nullable",innerType:n})}const vk=$("ZodDefault",(n,e)=>{qD.init(n,e),kt.init(n,e),n._zod.processJSONSchema=(t,i,o)=>fz(n,t,i,o),n.unwrap=()=>n._zod.def.innerType,n.removeDefault=n.unwrap});function yk(n,e){return new vk({type:"default",innerType:n,get defaultValue(){return typeof e=="function"?e():_p(e)}})}const bk=$("ZodPrefault",(n,e)=>{JD.init(n,e),kt.init(n,e),n._zod.processJSONSchema=(t,i,o)=>pz(n,t,i,o),n.unwrap=()=>n._zod.def.innerType});function wk(n,e){return new bk({type:"prefault",innerType:n,get defaultValue(){return typeof e=="function"?e():_p(e)}})}const Mm=$("ZodNonOptional",(n,e)=>{eM.init(n,e),kt.init(n,e),n._zod.processJSONSchema=(t,i,o)=>hz(n,t,i,o),n.unwrap=()=>n._zod.def.innerType});function xk(n,e){return new Mm({type:"nonoptional",innerType:n,...be(e)})}const Sk=$("ZodCatch",(n,e)=>{tM.init(n,e),kt.init(n,e),n._zod.processJSONSchema=(t,i,o)=>mz(n,t,i,o),n.unwrap=()=>n._zod.def.innerType,n.removeCatch=n.unwrap});function Ek(n,e){return new Sk({type:"catch",innerType:n,catchValue:typeof e=="function"?e:()=>e})}const Tk=$("ZodPipe",(n,e)=>{nM.init(n,e),kt.init(n,e),n._zod.processJSONSchema=(t,i,o)=>vz(n,t,i,o),n.in=e.in,n.out=e.out});function zm(n,e){return new Tk({type:"pipe",in:n,out:e})}const Ok=$("ZodReadonly",(n,e)=>{iM.init(n,e),kt.init(n,e),n._zod.processJSONSchema=(t,i,o)=>yz(n,t,i,o),n.unwrap=()=>n._zod.def.innerType});function Nk(n){return new Ok({type:"readonly",innerType:n})}const Dk=$("ZodCustom",(n,e)=>{gM.init(n,e),kt.init(n,e),n._zod.processJSONSchema=(t,i,o)=>az(n,t)});function Mk(n,e={}){return XM(Dk,n,e)}function zk(n,e){return $M(n,e)}const kk="compass.query/1",Rk=["file","module","package","namespace","class","struct","interface","trait","protocol","enum","enum_member","type_alias","function","method","constructor","property","field","variable","constant","parameter","import","export","macro","annotation","route","component","event","message","topic","queue","job","resource","schema","query","migration","config_key","database","database_schema","database_table","database_view","database_column","database_index","database_constraint","database_procedure","database_trigger"],_k=["contains","calls","imports","exports","extends","implements","references","type_of","returns","instantiates","overrides","decorates","routes_to","reads","writes","aliases","registers","handles","publishes","subscribes","produces","consumes","schedules","triggers","tests","depends_on","documents","maps_to"],jk=["controller","route_handler","middleware","service","resolver","consumer","producer","subscriber","repository","model","test","fixture","generated"],Zk=["search","callers","callees","impact","explore","node_trail"],gc=H().min(1).refine(n=>n.includes("\\")||n.startsWith("/")||/^[A-Za-z]:/.test(n)?!1:n.split("/").every(e=>e!==""&&e!=="."&&e!==".."),"source path must be a safe repository-relative path"),Rr=xe({file:gc,startByte:he().int().nonnegative(),endByte:he().int().nonnegative(),startLine:he().int().positive(),startColumn:he().int().nonnegative(),endLine:he().int().positive(),endColumn:he().int().nonnegative()}).refine(n=>n.endByte>=n.startByte&&(n.endLine>n.startLine||n.endLine===n.startLine&&n.endColumn>=n.startColumn),"source anchor must be ordered"),Bk=ct(Rk),Pk=ct(_k),Lk=ct(jk),Gk=ct(Zk),Fk=ct(["structural_graph","program_ir"]),Vk=ct(["ast","config","convention","artifact","heuristic"]),oc=ct(["exact","inferred","ambiguous"]),sc=ct(["exact","ambiguous","unresolved"]),Uk=xe({nodeId:H().min(1),reason:H().min(1),confidence:oc,score:he().finite().nullable().optional(),anchor:Rr.nullable().optional()}),UA=xe({layer:Fk,origin:Vk,extractor:H().min(1),confidence:oc,anchor:Rr.nullable(),rule:H().min(1).nullable(),wiringSite:Rr.nullable(),resolution:sc,candidates:Fe(Uk).max(20).default([])}),Yk=xe({type:dt("file"),data:xe({contentDigest:H().min(1),byteSize:he().int().nonnegative(),generated:Ln()})}),Hk=xe({type:dt("symbol"),data:xe({signature:H().nullable().optional(),modifiers:Fe(H()).default([]),overloadDiscriminator:H().nullable().optional(),declaringType:H().nullable().optional(),signatureDigest:H().nullable().optional(),implementationDigest:H().nullable().optional(),sourceDigest:H().nullable().optional()})}),Kk=xe({type:dt("import_export"),data:xe({specifier:H(),importedName:H().nullable().optional(),localName:H().nullable().optional(),typeOnly:Ln()})}),Wk=xe({type:dt("route"),data:xe({operation:H(),path:H(),originalPath:H().nullable().optional(),declaringScope:H(),resolution:sc,middlewareCount:he().int().nonnegative()})}),Qk=xe({type:dt("component"),data:xe({componentType:H()})}),Xk=xe({type:dt("resource"),data:xe({resourceKind:ct(["document","paper","image","concept","rationale"]),uri:H().nullable().optional(),mediaType:H().nullable().optional()})}),$k=xe({type:dt("messaging"),data:xe({transport:H(),subject:H(),declaringScope:H()})}),qk=xe({type:dt("job"),data:xe({schedule:H().nullable().optional(),queue:H().nullable().optional()})}),Jk=xe({type:dt("schema"),data:xe({dialect:H().nullable().optional(),logicalDatabase:H().nullable().optional(),namespace:H().nullable().optional()})}),eR=xe({type:dt("query"),data:xe({dialect:H().nullable().optional(),operation:H().nullable().optional(),textDigest:H().nullable().optional()})}),tR=xe({type:dt("config"),data:xe({format:H(),keyPath:H()})}),nR=xe({type:dt("database"),data:xe({logicalDatabase:H(),databaseSchema:H().nullable().optional()})}),iR=tc("type",[Yk,Hk,Kk,Wk,Qk,Xk,$k,qk,Jk,eR,tR,nR]),gR=xe({type:dt("call"),data:xe({dispatch:ct(["static","virtual","dynamic"]),receiverType:H().nullable().optional(),argumentCount:he().int().nonnegative().nullable().optional()})}),oR=xe({type:dt("route"),data:xe({stage:ct(["middleware","handler"]),position:he().int().nonnegative().nullable().optional(),operation:H().nullable().optional()})}),sR=xe({type:dt("messaging"),data:xe({transport:H(),subject:H()})}),rR=xe({type:dt("schedule"),data:xe({expression:H().nullable().optional()})}),aR=xe({type:dt("mapping"),data:xe({mappingKind:H()})}),km=tc("type",[gR,oR,sR,rR,aR]),AR=xe({maxDepth:he().int().positive(),maxNodes:he().int().positive(),maxEdges:he().int().positive(),maxPaths:he().int().positive(),maxCandidates:he().int().positive(),maxSourceBytes:he().int().positive(),maxResponseBytes:he().int().positive()}),CR=xe({nodeId:H().min(1),score:he().finite(),matchedFields:Fe(H())}),IR=xe({id:H().min(1),kind:Bk,roles:Fe(Lk),name:H().min(1),qualifiedName:H().min(1),language:H().nullable(),framework:H().nullable(),source:Rr.nullable(),details:iR.nullable(),evidence:Fe(UA)}),lR=xe({id:H().min(1),source:H().min(1),target:H().min(1),kind:Pk,relationshipSite:Rr.nullable(),details:km.nullable(),evidence:Fe(UA)}),cR=xe({path:gc,contentDigest:H().min(1),source:H().nullable(),truncated:Ln()}),dR=xe({id:H().min(1),nodeIds:Fe(H().min(1)),edgeIds:Fe(H().min(1)),weakestResolution:sc,weakestConfidence:oc}),uR=xe({code:ct(["no_match","ambiguous_match","direction_mismatch","unresolved_handler","incomplete_coverage","stale_source_digest","bounded_truncation","program_orphan","program_conflict","program_unavailable"]),message:H().min(1),nodeId:H().nullable(),path:gc.nullable()}),hR=xe({schema:dt(kk),operation:Gk,results:Fe(CR),nodes:Fe(IR),edges:Fe(lR),files:Fe(cR),paths:Fe(dR),diagnostics:Fe(uR),limits:AR,truncated:Ln()}),fR="compass.viewer.graph/1",rc=mt({file:H(),startLine:he().int().positive().optional(),endLine:he().int().positive().optional(),startByte:he().int().nonnegative().optional(),endByte:he().int().nonnegative().optional()}).passthrough(),pR=mt({field:H().min(1),before:ho().optional(),after:ho().optional()}),Rm=mt({before:nc(H(),ho()).optional(),after:nc(H(),ho()).optional(),fields:Fe(pR)}),mR=mt({id:H().min(1),label:H(),kind:H().optional(),community:he().int(),communityName:H().optional(),degree:he().int().nonnegative().optional(),language:H().optional(),signature:H().optional(),size:he().positive().optional(),memberCount:he().int().nonnegative().optional(),detailAvailable:Ln().optional(),learningStatus:H().optional(),learningStale:Ln().optional(),depth:he().int().nonnegative().optional(),root:Ln().optional(),change:ct(["added","removed","changed","unchanged"]).optional(),evidence:Rm.optional(),codeEvidence:Fe(UA).optional(),source:rc.optional(),color:mt({background:H(),border:H()}).passthrough().optional()}).passthrough(),vR=mt({id:H().min(1),source:H().min(1),target:H().min(1),relation:H(),weight:he().int().positive().optional(),change:ct(["added","removed","changed","unchanged"]).optional(),evidence:Rm.optional(),codeEvidence:Fe(UA).optional(),details:km.nullable().optional(),relationshipSite:rc.optional(),confidence:ct(["extracted","inferred","ambiguous","aggregated"]).optional()}).passthrough(),yR=mt({id:he().int(),label:H(),color:H(),hidden:Ln().default(!1)}).passthrough(),wg=mt({schema:dt(fR),title:H(),stats:mt({nodes:he().int().nonnegative(),edges:he().int().nonnegative(),communities:he().int().nonnegative(),aggregated:Ln()}).passthrough(),nodes:Fe(mR),edges:Fe(vR),communities:Fe(yR),hyperedges:Fe(ho()).default([])}).passthrough(),bR=ct(["resolved","inferred","ambiguous","unresolved"]),_m=mt({source_file:H(),start_byte:he().int().nonnegative(),end_byte:he().int().nonnegative()}),wR=mt({id:H(),symbol:H().nullable(),name:H(),file:H().nullable(),anchor:_m.nullable().optional(),startLine:he().int().positive().nullable().optional(),endLine:he().int().positive().nullable().optional(),startByte:he().int().nonnegative().nullable().optional(),endByte:he().int().nonnegative().nullable().optional(),graphNodeId:H().nullable(),unresolved:Ln(),evidenceLayer:ct(["structural_graph","program_ir","combined"]).optional()}),xR=Em([mt({anchor:_m,evidence:Fe(H())}),mt({sourceFile:H().nullable(),line:he().int().positive().nullable(),startByte:he().int().nonnegative().nullable(),endByte:he().int().nonnegative().nullable(),evidence:Fe(H())})]),SR=mt({id:H(),source:H(),target:H(),callee:H(),resolution:bR,confidence:H().nullable().optional(),callSites:Fe(xR),evidenceLayer:ct(["structural_graph","program_ir","combined"]).optional()}),ER=mt({schema:ct(["compass.program.call_graph/1","compass.call_graph/1"]),rootSymbol:H(),direction:ct(["callers","callees","both"]),depth:he().int().positive(),nodes:Fe(wR),edges:Fe(SR),truncated:Ln(),continuations:Fe(mt({symbol:H(),direction:ct(["callers","callees","both"]),nextDepth:he().int().positive()})),coverage:mt({resolved:he().int().nonnegative(),inferred:he().int().nonnegative(),ambiguous:he().int().nonnegative(),unresolved:he().int().nonnegative(),evidenceLayer:ct(["structural_graph","program_ir","combined"]).optional(),partial:Ln().optional(),limitations:Fe(H()).optional(),warning:H()})}),jm=ct(["extracted","inferred","ambiguous"]),TR=ct(["production","test","generated","vendor","unknown"]),OR=mt({schema:dt("compass.viewer.callflow/1"),title:H(),sections:Fe(mt({id:H(),name:H(),communities:Fe(H()),nodeCount:he().int().nonnegative(),internalCallCount:he().int().nonnegative(),nodes:Fe(mt({id:H(),label:H(),kind:H(),sourceFile:H().nullable(),scope:TR})),edges:Fe(mt({source:H(),target:H(),relation:H(),confidence:jm}))})),overviewLinks:Fe(mt({sourceSection:H(),targetSection:H(),calls:he().int().nonnegative()})),crossSectionCalls:Fe(mt({source:H(),target:H(),sourceSection:H(),targetSection:H(),relation:H(),confidence:jm})),coverage:mt({internal:he().int().nonnegative(),crossSection:he().int().nonnegative(),unassigned:he().int().nonnegative()}),reportHighlights:Fe(H()),statistics:mt({nodes:he().int().nonnegative(),edges:he().int().nonnegative(),communities:he().int().nonnegative(),hyperedges:he().int().nonnegative(),extracted:he().int().nonnegative(),inferred:he().int().nonnegative(),ambiguous:he().int().nonnegative()}),provenance:mt({projectName:H(),builtAtCommit:H().nullable(),generatedAt:H().nullable()})}),NR="compass.viewer.workbench/1",DR=xe({status:ct(["complete","summary","partial"]),truncated:Ln(),nodes:he().int().nonnegative(),edges:he().int().nonnegative(),limitations:Fe(H()).default([])}),fo={id:H().min(1),title:H().min(1),description:H(),coverage:DR},MR=ct(["dependencies","routes","data","messaging","tests","provenance"]),zR=tc("kind",[xe({...fo,kind:dt("code"),model:wg,communityDetails:nc(H(),wg).default({})}),xe({...fo,kind:dt("call"),root:H(),graph:ER}),xe({...fo,kind:dt("impact"),root:H(),result:hR}),xe({...fo,kind:dt("architecture"),model:OR}),xe({...fo,kind:dt("history"),baseRevision:H(),targetRevision:H(),before:wg,after:wg}),xe({...fo,kind:dt("affected"),root:H(),relations:Fe(H()),depth:he().int().nonnegative(),model:wg}),xe({...fo,kind:dt("artifact"),lens:MR,relations:Fe(H()),model:wg})]),kR=xe({schema:dt(NR),title:H(),graphIdentity:H().min(1),defaultView:H(),views:Fe(zR).min(1)}).superRefine((n,e)=>{const t=new Set;for(const[i,o]of n.views.entries())t.has(o.id)&&e.addIssue({code:"custom",path:["views",i,"id"],message:`duplicate workbench view id '${o.id}'`}),t.add(o.id);t.has(n.defaultView)||e.addIssue({code:"custom",path:["defaultView"],message:"defaultView must identify one included view"})});var L=Fl();const RR=FO({__proto__:null,default:VO(L)},[L]);const _R=n=>n.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),jR=n=>n.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,i)=>i?i.toUpperCase():t.toLowerCase()),Zm=n=>{const e=jR(n);return e.charAt(0).toUpperCase()+e.slice(1)},Bm=(...n)=>n.filter((e,t,i)=>!!e&&e.trim()!==""&&i.indexOf(e)===t).join(" ").trim(),ZR=n=>{for(const e in n)if(e.startsWith("aria-")||e==="role"||e==="title")return!0};var BR={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const PR=L.forwardRef(({color:n="currentColor",size:e=24,strokeWidth:t=2,absoluteStrokeWidth:i,className:o="",children:r,iconNode:A,...I},l)=>L.createElement("svg",{ref:l,...BR,width:e,height:e,stroke:n,strokeWidth:i?Number(t)*24/Number(e):t,className:Bm("lucide",o),...!r&&!ZR(I)&&{"aria-hidden":"true"},...I},[...A.map(([c,h])=>L.createElement(c,h)),...Array.isArray(r)?r:[r]]));const _e=(n,e)=>{const t=L.forwardRef(({className:i,...o},r)=>L.createElement(PR,{ref:r,iconNode:e,className:Bm(`lucide-${_R(Zm(n))}`,`lucide-${n}`,i),...o}));return t.displayName=Zm(n),t};const LR=_e("arrow-down",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);const GR=_e("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);const FR=_e("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);const VR=_e("arrow-up",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);const UR=_e("badge-check",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);const YR=_e("boxes",[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]]);const HR=_e("braces",[["path",{d:"M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1",key:"ezmyqa"}],["path",{d:"M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1",key:"e1hn23"}]]);const KR=_e("circle-dot-dashed",[["path",{d:"M10.1 2.18a9.93 9.93 0 0 1 3.8 0",key:"1qdqn0"}],["path",{d:"M17.6 3.71a9.95 9.95 0 0 1 2.69 2.7",key:"1bq7p6"}],["path",{d:"M21.82 10.1a9.93 9.93 0 0 1 0 3.8",key:"1rlaqf"}],["path",{d:"M20.29 17.6a9.95 9.95 0 0 1-2.7 2.69",key:"1xk03u"}],["path",{d:"M13.9 21.82a9.94 9.94 0 0 1-3.8 0",key:"l7re25"}],["path",{d:"M6.4 20.29a9.95 9.95 0 0 1-2.69-2.7",key:"1v18p6"}],["path",{d:"M2.18 13.9a9.93 9.93 0 0 1 0-3.8",key:"xdo6bj"}],["path",{d:"M3.71 6.4a9.95 9.95 0 0 1 2.7-2.69",key:"1jjmaz"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]]);const Pm=_e("circle-question-mark",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);const WR=_e("compass",[["path",{d:"m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z",key:"9ktpf1"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);const YA=_e("external-link",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);const QR=_e("file-code-2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m5 12-3 3 3 3",key:"oke12k"}],["path",{d:"m9 18 3-3-3-3",key:"112psh"}]]);const XR=_e("file-cog",[["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m2.305 15.53.923-.382",key:"yfp9st"}],["path",{d:"m3.228 12.852-.924-.383",key:"bckynb"}],["path",{d:"M4.677 21.5a2 2 0 0 0 1.313.5H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v2.5",key:"1yo3oz"}],["path",{d:"m4.852 11.228-.383-.923",key:"1j88i9"}],["path",{d:"m4.852 16.772-.383.924",key:"sag1dv"}],["path",{d:"m7.148 11.228.383-.923",key:"rj39hk"}],["path",{d:"m7.53 17.696-.382-.924",key:"1uu5cs"}],["path",{d:"m8.772 12.852.923-.383",key:"13811l"}],["path",{d:"m8.772 15.148.923.383",key:"z1a5l0"}],["circle",{cx:"6",cy:"14",r:"3",key:"a1xfv6"}]]);const $R=_e("focus",[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}]]);const Lm=_e("git-branch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]);const Gm=_e("git-compare-arrows",[["circle",{cx:"5",cy:"6",r:"3",key:"1qnov2"}],["path",{d:"M12 6h5a2 2 0 0 1 2 2v7",key:"1yj91y"}],["path",{d:"m15 9-3-3 3-3",key:"1lwv8l"}],["circle",{cx:"19",cy:"18",r:"3",key:"1qljk2"}],["path",{d:"M12 18H7a2 2 0 0 1-2-2V9",key:"16sdep"}],["path",{d:"m9 15 3 3-3 3",key:"1m3kbl"}]]);const ac=_e("git-fork",[["circle",{cx:"12",cy:"18",r:"3",key:"1mpf1b"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["path",{d:"M18 9v2c0 .6-.4 1-1 1H7c-.6 0-1-.4-1-1V9",key:"1uq4wg"}],["path",{d:"M12 12v3",key:"158kv8"}]]);const qR=_e("keyboard",[["path",{d:"M10 8h.01",key:"1r9ogq"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M14 8h.01",key:"1primd"}],["path",{d:"M16 12h.01",key:"1l6xoz"}],["path",{d:"M18 8h.01",key:"emo2bl"}],["path",{d:"M6 8h.01",key:"x9i8wu"}],["path",{d:"M7 16h10",key:"wp8him"}],["path",{d:"M8 12h.01",key:"czm47f"}],["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}]]);const JR=_e("layout-grid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]);const e3=_e("map",[["path",{d:"M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z",key:"169xi5"}],["path",{d:"M15 5.764v15",key:"1pn4in"}],["path",{d:"M9 3.236v15",key:"1uimfh"}]]);const Fm=_e("maximize-2",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]]);const t3=_e("minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);const n3=_e("move",[["path",{d:"M12 2v20",key:"t6zp3m"}],["path",{d:"m15 19-3 3-3-3",key:"11eu04"}],["path",{d:"m19 9 3 3-3 3",key:"1mg7y2"}],["path",{d:"M2 12h20",key:"9i4pu4"}],["path",{d:"m5 9-3 3 3 3",key:"j64kie"}],["path",{d:"m9 5 3-3 3 3",key:"l8vdw6"}]]);const Ac=_e("network",[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]);const i3=_e("panel-left-close",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]]);const g3=_e("panel-left-open",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m14 9 3 3-3 3",key:"8010ee"}]]);const Vm=_e("panel-right-close",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m8 9 3 3-3 3",key:"12hl5m"}]]);const o3=_e("panel-right-open",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m10 15-3-3 3-3",key:"1pgupc"}]]);const Um=_e("pause",[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]]);const s3=_e("play",[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]]);const Ym=_e("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);const Hm=_e("rotate-ccw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);const Km=_e("route",[["circle",{cx:"6",cy:"19",r:"3",key:"1kj8tv"}],["path",{d:"M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15",key:"1d8sl"}],["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}]]);const Wm=_e("scan-search",[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["path",{d:"m16 16-1.9-1.9",key:"1dq9hf"}]]);const r3=_e("search-code",[["path",{d:"m13 13.5 2-2.5-2-2.5",key:"1rvxrh"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}],["path",{d:"M9 8.5 7 11l2 2.5",key:"6ffwbx"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]);const Qm=_e("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]);const a3=_e("settings",[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);const A3=_e("shield-check",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);const C3=_e("signpost",[["path",{d:"M12 13v8",key:"1l5pq0"}],["path",{d:"M12 3v3",key:"1n5kay"}],["path",{d:"M18 6a2 2 0 0 1 1.387.56l2.307 2.22a1 1 0 0 1 0 1.44l-2.307 2.22A2 2 0 0 1 18 13H6a2 2 0 0 1-1.387-.56l-2.306-2.22a1 1 0 0 1 0-1.44l2.306-2.22A2 2 0 0 1 6 6z",key:"gqqp9m"}]]);const I3=_e("sliders-horizontal",[["path",{d:"M10 5H3",key:"1qgfaw"}],["path",{d:"M12 19H3",key:"yhmn1j"}],["path",{d:"M14 3v4",key:"1sua03"}],["path",{d:"M16 17v4",key:"1q0r14"}],["path",{d:"M21 12h-9",key:"1o4lsq"}],["path",{d:"M21 19h-5",key:"1rlt1p"}],["path",{d:"M21 5h-7",key:"1oszz2"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M8 12H3",key:"a7s4jb"}]]);const l3=_e("tags",[["path",{d:"M13.172 2a2 2 0 0 1 1.414.586l6.71 6.71a2.4 2.4 0 0 1 0 3.408l-4.592 4.592a2.4 2.4 0 0 1-3.408 0l-6.71-6.71A2 2 0 0 1 6 9.172V3a1 1 0 0 1 1-1z",key:"16rjxf"}],["path",{d:"M2 7v6.172a2 2 0 0 0 .586 1.414l6.71 6.71a2.4 2.4 0 0 0 3.191.193",key:"178nd4"}],["circle",{cx:"10.5",cy:"6.5",r:".5",fill:"currentColor",key:"12ikhr"}]]);const HA=_e("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);const c3=_e("waypoints",[["circle",{cx:"12",cy:"4.5",r:"2.5",key:"r5ysbb"}],["path",{d:"m10.2 6.3-3.9 3.9",key:"1nzqf6"}],["circle",{cx:"4.5",cy:"12",r:"2.5",key:"jydg6v"}],["path",{d:"M7 12h10",key:"b7w52i"}],["circle",{cx:"19.5",cy:"12",r:"2.5",key:"1piiel"}],["path",{d:"m13.8 17.7 3.9-3.9",key:"1wyg1y"}],["circle",{cx:"12",cy:"19.5",r:"2.5",key:"13o1pw"}]]);const d3=_e("zoom-in",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]);const u3=_e("zoom-out",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]),Xm=new Set(["color","change","evidence"]),h3=new Set(["anchor","anchors","columnEnd","columnStart","community","communityName","community_name","degree","endByte","endColumn","endLine","lineEnd","lineStart","line_end","line_start","location","normLabel","norm_label","relationshipSite","relationship_site","size","sourceDigest","sourceFile","sourceHash","source_digest","source_file","source_hash","startByte","startColumn","startLine","wiringSite","wiring_site"]);function KA(n,e){const t=WA(n),i=WA(e);return{...t?{before:t}:{},...i?{after:i}:{},fields:Ic(t,i)}}function $m(n,e,t){const i=WA(n),o=WA(e),r=Cc(n,t),A=Cc(e,t);return{...i?{before:i}:{},...o?{after:o}:{},fields:Ic(r,A)}}function f3(n,e){return Cc(n,e)??{}}function p3(n,e=240){const t=n===void 0?"Not recorded":typeof n=="string"?n:JSON.stringify(n,null,_r(n)?2:void 0)??String(n);return t.length<=e?{text:t,truncated:!1}:{text:`${t.slice(0,Math.max(0,e-1)).trimEnd()}…`,truncated:!0}}function WA(n){if(n)return ev(n)}function Cc(n,e){return n?Jm(n,e==="node"?new Set(["source"]):new Set(["id","key"])):void 0}function qm(n){return Array.isArray(n)?n.map(qm):_r(n)?Jm(n):n}function Jm(n,e=new Set){return Object.fromEntries(Object.keys(n).filter(t=>!Xm.has(t)&&!h3.has(t)&&!e.has(t)).sort((t,i)=>t.localeCompare(i)).map(t=>[t,qm(n[t])]))}function QA(n){return Array.isArray(n)?n.map(QA):_r(n)?ev(n):n}function ev(n){return Object.fromEntries(Object.keys(n).filter(e=>!Xm.has(e)).sort((e,t)=>e.localeCompare(t)).map(e=>[e,QA(n[e])]))}function Ic(n,e,t=""){const i=new Set([...Object.keys(n??{}),...Object.keys(e??{})]),o=[];for(const r of[...i].sort((A,I)=>A.localeCompare(I))){const A=t?`${t}.${r}`:r,I=n?.[r],l=e?.[r];_r(I)&&_r(l)?o.push(...Ic(I,l,A)):m3(I,l)||o.push({field:A,...I!==void 0?{before:I}:{},...l!==void 0?{after:l}:{}})}return o}function m3(n,e){return JSON.stringify(QA(n))===JSON.stringify(QA(e))}function _r(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}function v3({node:n,edges:e,nodes:t,sourceRevisions:i,onFocus:o,onOpenSource:r}){const A=iv(n.evidence?.before),I=iv(n.evidence?.after);return f.jsxs(f.Fragment,{children:[n.evidence?.fields.length?f.jsxs("section",{className:"compass-record-evidence","aria-labelledby":"compass-node-changes-title",children:[f.jsxs("div",{className:"compass-evidence-heading",children:[f.jsx("h3",{id:"compass-node-changes-title",children:y3(n.change)}),f.jsxs("span",{children:[n.evidence.fields.length," fields"]})]}),f.jsx(tv,{fields:n.evidence.fields}),n.change==="changed"&&(A||I)&&f.jsxs("div",{className:"compass-evidence-source-actions",children:[A&&f.jsxs("button",{type:"button",onClick:()=>r(A,i?.before),children:[f.jsx(YA,{"aria-hidden":"true"}),"Open before"]}),I&&f.jsxs("button",{type:"button",onClick:()=>r(I,i?.after),children:[f.jsx(YA,{"aria-hidden":"true"}),"Open after"]})]})]}):null,f.jsxs("section",{className:"compass-relationship-evidence","aria-labelledby":"compass-relationships-title",children:[f.jsxs("div",{className:"compass-neighbors-heading",children:[f.jsx("span",{id:"compass-relationships-title",children:"Relationships"}),f.jsx("strong",{children:e.length})]}),e.length?f.jsx("div",{className:"compass-relationship-list",children:e.map(l=>{const c=l.source===n.id?l.target:l.source,h=t.get(c);return f.jsxs("details",{children:[f.jsxs("summary",{children:[f.jsx("span",{className:"compass-change-badge","data-change":l.change,children:gv(l.change)}),f.jsx("span",{className:"compass-relationship-target",children:h?.label??c}),f.jsx("small",{children:l.relation}),l.confidence&&f.jsx("i",{children:l.confidence})]}),f.jsxs("div",{className:"compass-relationship-detail",children:[l.change==="changed"&&l.evidence?.fields.length?f.jsx(tv,{fields:l.evidence.fields}):f.jsxs("p",{children:[gv(l.change)," relationship: ",l.source," → ",l.target]}),f.jsxs("button",{type:"button",onClick:()=>o(c),children:["Focus ",h?.label??c]})]})]},l.id)})}):f.jsx("span",{className:"compass-empty",children:"No connected relationships"})]})]})}function tv({fields:n}){return f.jsx("div",{className:"compass-field-table-wrap",children:f.jsxs("table",{className:"compass-field-table",children:[f.jsx("thead",{children:f.jsxs("tr",{children:[f.jsx("th",{children:"Field"}),f.jsx("th",{children:"Before"}),f.jsx("th",{children:"After"})]})}),f.jsx("tbody",{children:n.map(e=>f.jsxs("tr",{children:[f.jsx("th",{scope:"row",children:e.field}),f.jsx(nv,{value:e.before}),f.jsx(nv,{value:e.after})]},e.field))})]})})}function nv({value:n}){const e=p3(n);return f.jsxs("td",{children:[f.jsx("code",{children:e.text}),e.truncated&&f.jsx("span",{className:"compass-value-truncated",children:"Value shortened"})]})}function iv(n){const e=rc.safeParse(n?.source);return e.success?e.data:void 0}function gv(n){return!n||n==="unchanged"?"Context":`${n[0]?.toLocaleUpperCase()}${n.slice(1)}`}function y3(n){return n==="added"?"Added symbol metadata":n==="removed"?"Removed symbol metadata":"What changed"}const ov=100,sv={changed:0,added:1,removed:2,unchanged:3};function b3({nodes:n,query:e,selectedId:t,onFocus:i}){const[o,r]=L.useState(!1),A=e.trim().toLocaleLowerCase(),I=n.filter(c=>c.change&&c.change!=="unchanged").filter(c=>!A||c.label.toLocaleLowerCase().includes(A)||c.kind?.toLocaleLowerCase().includes(A)||c.source?.file.toLocaleLowerCase().includes(A)).sort((c,h)=>sv[c.change??"unchanged"]-sv[h.change??"unchanged"]||c.label.localeCompare(h.label)||c.id.localeCompare(h.id)),l=o?I:I.slice(0,ov);return f.jsxs("section",{className:"compass-changed-symbols","aria-labelledby":"compass-changed-symbols-title",children:[f.jsxs("div",{className:"compass-section-heading",children:[f.jsx("h2",{id:"compass-changed-symbols-title",children:"Changed symbols"}),f.jsx("span",{children:I.length})]}),l.length?f.jsx("div",{className:"compass-changed-symbol-list",children:l.map(c=>f.jsxs("button",{type:"button","aria-pressed":c.id===t,"data-change":c.change,onClick:()=>i(c.id),children:[f.jsx("span",{className:"compass-changed-symbol-status",children:w3(c.change)}),f.jsx("strong",{children:c.label}),f.jsx("small",{children:c.source?.file??c.kind??"Graph symbol"})]},c.id))}):f.jsx("p",{className:"compass-empty",children:A?"No affected symbols match this search.":"No symbol changes."}),!o&&I.length>ov&&f.jsxs("button",{className:"compass-changed-symbol-expand",type:"button",onClick:()=>r(!0),children:["Show all ",I.length.toLocaleString()," affected symbols"]})]})}function w3(n){return!n||n==="unchanged"?"Context":`${n[0]?.toLocaleUpperCase()}${n.slice(1)}`}function rv({evidence:n,diagnostics:e=[],truncated:t=!1,title:i="Trust evidence",onOpenSource:o}){return!n.length&&!e.length&&!t?null:f.jsxs("section",{className:"compass-code-evidence","aria-label":i,children:[f.jsxs("div",{className:"compass-evidence-heading",children:[f.jsx("h3",{children:i}),f.jsxs("span",{children:[n.length," ",n.length===1?"record":"records"]})]}),t&&f.jsxs("p",{className:"compass-code-diagnostic","data-severity":"warning",role:"status",children:[f.jsx(HA,{"aria-hidden":"true"}),"Results reached a configured limit. Narrow the query or raise one bound."]}),e.map(r=>f.jsxs("p",{className:"compass-code-diagnostic","data-severity":r.code==="no_match"?"info":"warning",role:"status",children:[r.code==="no_match"?f.jsx(Pm,{"aria-hidden":"true"}):f.jsx(HA,{"aria-hidden":"true"}),f.jsxs("span",{children:[f.jsx("strong",{children:E3(r.code)}),r.message]})]},`${r.code}:${r.message}`)),f.jsx("div",{className:"compass-code-evidence-ledger",children:n.map((r,A)=>{const I=S3(r),l=r.wiringSite??r.anchor;return f.jsxs("article",{className:"compass-code-evidence-entry","data-status":I.key,children:[f.jsx("span",{className:"compass-code-evidence-icon","aria-hidden":"true",children:f.jsx(x3,{item:r})}),f.jsxs("div",{className:"compass-code-evidence-copy",children:[f.jsxs("div",{className:"compass-code-evidence-status",children:[f.jsx("strong",{children:I.label}),f.jsx("span",{children:r.layer==="program_ir"?"Program IR":"Code graph"})]}),f.jsxs("dl",{children:[f.jsxs("div",{children:[f.jsx("dt",{children:"Extractor"}),f.jsx("dd",{children:r.extractor})]}),f.jsxs("div",{children:[f.jsx("dt",{children:"Confidence"}),f.jsx("dd",{children:r.confidence})]}),r.rule&&f.jsxs("div",{children:[f.jsx("dt",{children:"Rule"}),f.jsx("dd",{children:r.rule})]})]}),l&&(o?f.jsxs("button",{className:"compass-code-evidence-source",type:"button",onClick:()=>o(l),children:[f.jsx(YA,{"aria-hidden":"true"}),av(r,l)]}):f.jsx("span",{className:"compass-code-evidence-source",children:av(r,l)})),r.candidates.length>0&&f.jsxs("div",{className:"compass-code-candidates",children:[f.jsx("span",{children:"Retained candidates"}),f.jsx("ul",{children:r.candidates.map(c=>f.jsxs("li",{children:[f.jsx("code",{children:c.nodeId}),f.jsx("span",{children:c.reason}),f.jsx("small",{children:c.confidence})]},`${c.nodeId}:${c.reason}`))})]})]})]},`${r.layer}:${r.extractor}:${A}`)})})]})}function x3({item:n}){return n.resolution==="unresolved"?f.jsx(Pm,{}):n.resolution==="ambiguous"||n.confidence==="ambiguous"?f.jsx(HA,{}):n.origin==="heuristic"?f.jsx(ac,{}):n.origin==="config"?f.jsx(XR,{}):n.origin==="convention"?f.jsx(C3,{}):f.jsx(UR,{})}function S3(n){return n.resolution==="unresolved"?{key:"unresolved",label:"Unresolved"}:n.resolution==="ambiguous"||n.confidence==="ambiguous"?{key:"ambiguous",label:"Ambiguous"}:n.origin==="heuristic"?{key:"heuristic",label:"Heuristic"}:n.origin==="config"?{key:"config",label:"Configuration"}:n.origin==="convention"?{key:"convention",label:"Convention"}:{key:"exact",label:"Exact"}}function av(n,e){return`${n.origin==="heuristic"?"Wired at":"Evidence at"} ${e.file}:${e.startLine}`}function E3(n){return`${n.replaceAll("_"," ")}: `}function Av(n){return Iv(n.source)}function Cv(n){return Iv(n.relationshipSite)}function Iv(n){return n?.file.trim()&&(n.startLine!==void 0||n.endLine!==void 0||n.startByte!==void 0||n.endByte!==void 0)?n:void 0}const lv=200;function T3(n,e){const t=e.trim().toLocaleLowerCase();return(t?n.filter(o=>o.label.toLocaleLowerCase().includes(t)||String(o.id).includes(t)):n).slice(0,lv)}function O3(n){const e=n.source?.startLine,t=n.source?.endLine;if(e!==void 0)return t!==void 0&&t!==e?`${e}–${t}`:String(e)}function cv(n){const e=n.source?.startLine,t=n.source?.endLine;if(e!==void 0)return t!==void 0&&t!==e?{text:`Lines ${e}–${t}`,action:`at lines ${e}–${t}`}:{text:`Line ${e}`,action:`at line ${e}`};const i=n.source?.startByte,o=n.source?.endByte;if(i!==void 0)return o!==void 0&&o!==i?{text:`Bytes ${i}–${o}`,action:`at bytes ${i}–${o}`}:{text:`Byte ${i}`,action:`at byte ${i}`}}function dv(n,e){const t=cv(n);return`Open source ${e.file}${t?` ${t.action}`:""}`}function uv(n){return n==="unchanged"?"Context":n?`${n[0]?.toLocaleUpperCase()}${n.slice(1)}`:void 0}function N3(n){if(n)return{added:"var(--vscode-gitDecoration-addedResourceForeground, #2ea043)",removed:"var(--vscode-gitDecoration-deletedResourceForeground, #f85149)",changed:"var(--vscode-gitDecoration-modifiedResourceForeground, #d29922)",unchanged:"var(--vscode-descriptionForeground, #6e7781)"}[n]}function D3({model:n,selected:e,neighbors:t,connectedEdges:i,query:o,matches:r,hiddenCommunities:A,comparisonMode:I,sourceRevisions:l,queryResult:c,renderedEdgeCount:h,showHeader:p,onQueryChange:m,onFocus:y,onOpenSource:w,onOpenCommunity:S,onQueryNode:x,onToggleCommunity:O,onSetAllVisible:E,collapsed:_,onToggleCollapsed:P}){const[Q,ne]=L.useState(0),F=e?Av(e):void 0,Z=e?O3(e):void 0,de=e?cv(e):void 0,fe=L.useMemo(()=>{const V=new Map;for(const se of n.nodes)V.set(se.community,(V.get(se.community)??0)+1);return V},[n.nodes]),ke=A.size===0,Ne=L.useMemo(()=>new Map(n.nodes.map(V=>[V.id,V])),[n.nodes]),qe=(e?c?.nodes.find(V=>V.id===e.id):void 0)?.evidence??e?.codeEvidence??[],Ae=e?c?c.edges.filter(V=>V.source===e.id||V.target===e.id).flatMap(V=>V.evidence):i.flatMap(V=>V.codeEvidence??[]):[],M=V=>{y(V.id),m(""),ne(0)},W=V=>{!r.length&&V.key!=="Escape"||(V.key==="ArrowDown"?(V.preventDefault(),ne((Q+1)%r.length)):V.key==="ArrowUp"?(V.preventDefault(),ne((Q-1+r.length)%r.length)):V.key==="Enter"&&r[Q]?(V.preventDefault(),M(r[Q])):V.key==="Escape"&&(m(""),ne(0)))};return _?f.jsxs("aside",{className:"compass-graph-inspector compass-graph-inspector-collapsed","aria-label":"Graph inspector",children:[f.jsx("button",{className:"compass-inspector-disclosure compass-inspector-expand",type:"button","aria-label":"Expand graph inspector",title:"Expand graph inspector",onClick:P,children:f.jsx(o3,{"aria-hidden":"true"})}),f.jsx("span",{className:"compass-inspector-rail-label","aria-hidden":"true",children:"Inspector"})]}):f.jsxs("aside",{className:"compass-graph-inspector","aria-label":"Graph inspector",children:[p&&f.jsxs("header",{className:"compass-inspector-header",children:[f.jsx("span",{className:"compass-product-mark","aria-hidden":"true",children:f.jsx(WR,{})}),f.jsxs("span",{className:"compass-inspector-title",children:[f.jsx("strong",{children:"Compass"}),f.jsx("small",{children:n.title})]}),f.jsx("button",{className:"compass-inspector-disclosure",type:"button","aria-label":"Collapse graph inspector",title:"Collapse graph inspector",onClick:P,children:f.jsx(Vm,{"aria-hidden":"true"})})]}),f.jsxs("div",{className:"compass-inspector-search",role:"search",children:[f.jsx("label",{className:"sr-only",htmlFor:"compass-node-search",children:"Search graph nodes"}),f.jsxs("div",{className:"compass-inspector-search-row",children:[f.jsxs("div",{className:"compass-search-field",children:[f.jsx(Qm,{"aria-hidden":"true"}),f.jsx("input",{id:"compass-node-search",type:"search",role:"combobox",value:o,placeholder:"Search nodes and files",autoComplete:"off","aria-controls":"compass-search-results","aria-autocomplete":"list","aria-expanded":r.length>0,"aria-activedescendant":r[Q]?`compass-search-result-${Q}`:void 0,onChange:V=>{m(V.target.value),ne(0)},onKeyDown:W})]}),!p&&f.jsx("button",{className:"compass-inspector-disclosure compass-inspector-search-disclosure",type:"button","aria-label":"Collapse graph inspector",title:"Collapse graph inspector",onClick:P,children:f.jsx(Vm,{"aria-hidden":"true"})})]}),r.length>0&&f.jsx("div",{id:"compass-search-results",className:"compass-search-results",role:"listbox","aria-label":"Matching nodes",children:r.map((V,se)=>f.jsxs("button",{id:`compass-search-result-${se}`,type:"button",role:"option","aria-selected":se===Q,className:"compass-search-item",onMouseEnter:()=>ne(se),onClick:()=>M(V),children:[f.jsx("strong",{children:V.label}),f.jsx("span",{children:V.source?.file??V.kind??"Graph node"})]},V.id))})]}),f.jsxs("section",{className:"compass-info-panel","aria-labelledby":"compass-info-title",children:[f.jsxs("div",{className:"compass-section-heading",children:[f.jsx("h2",{id:"compass-info-title",children:"Inspector"}),f.jsx("span",{children:e?"Pinned":"Node details"})]}),e?f.jsxs("div",{className:"compass-info-content",children:[f.jsxs("div",{className:"compass-node-identity",children:[f.jsx("span",{className:"compass-node-swatch","aria-hidden":"true",style:{background:N3(e.change)??e.color?.background??n.communities.find(V=>V.id===e.community)?.color}}),f.jsxs("span",{children:[f.jsx("strong",{children:e.label}),f.jsx("small",{children:e.kind??"Symbol"})]}),uv(e.change)&&f.jsx("span",{className:"compass-change-badge","data-change":e.change,children:uv(e.change)})]}),f.jsxs("dl",{className:"compass-metadata-grid",children:[f.jsxs("div",{children:[f.jsx("dt",{children:"Community"}),f.jsx("dd",{children:e.communityName??n.communities.find(V=>V.id===e.community)?.label??e.community})]}),f.jsxs("div",{children:[f.jsx("dt",{children:"Degree"}),f.jsx("dd",{children:e.degree??t.length})]}),e.language&&f.jsxs("div",{children:[f.jsx("dt",{children:"Language"}),f.jsx("dd",{children:e.language})]}),Z&&f.jsxs("div",{children:[f.jsx("dt",{children:"Lines"}),f.jsx("dd",{children:Z})]}),f.jsx("div",{className:"compass-metadata-wide compass-source-metadata","data-interactive":F!==void 0,children:F?f.jsxs(f.Fragment,{children:[f.jsx("dt",{className:"sr-only",children:"Source"}),f.jsx("dd",{children:f.jsxs("button",{className:"compass-source-card",type:"button","aria-label":dv(e,F),title:dv(e,F),onClick:()=>w(F,e.change==="removed"?l?.before:l?.after),children:[f.jsxs("span",{className:"compass-source-copy",children:[f.jsx("span",{className:"compass-source-eyebrow","aria-hidden":"true",children:"Source"}),f.jsx("span",{className:"compass-source-path",children:F.file}),de&&f.jsx("span",{className:"compass-source-range",children:de.text})]}),f.jsx(YA,{"aria-hidden":"true"})]})})]}):f.jsxs(f.Fragment,{children:[f.jsx("dt",{children:"Source"}),f.jsx("dd",{title:e.source?.file??"Not recorded",children:e.source?.file??"Not recorded"})]})})]}),e.signature&&f.jsx("code",{className:"compass-signature-block",children:e.signature}),x&&f.jsxs("div",{className:"compass-code-query-actions","aria-label":"Code graph queries",children:[f.jsx("button",{type:"button",onClick:()=>x("callers",e.id),children:"Callers"}),f.jsx("button",{type:"button",onClick:()=>x("callees",e.id),children:"Callees"}),f.jsx("button",{type:"button",onClick:()=>x("impact",e.id),children:"Impact"})]}),f.jsx(rv,{evidence:qe,diagnostics:c?.diagnostics,truncated:c?.truncated,title:"Node evidence",onOpenSource:w}),f.jsx(rv,{evidence:Ae,title:"Relationship evidence",onOpenSource:w}),n.stats.aggregated&&e.memberCount!==void 0&&e.detailAvailable!==!1&&S&&f.jsxs("button",{className:"compass-inspector-action",type:"button",onClick:()=>S(e.community),children:[I?"Inspect changes":"Open community",f.jsxs("span",{children:[e.memberCount.toLocaleString()," ",I?"current symbols":"members"]})]}),n.stats.aggregated&&e.memberCount!==void 0&&e.detailAvailable===!1&&f.jsx("p",{className:"compass-empty",children:"This community detail was omitted to keep the standalone HTML export bounded. Open the graph in VS Code or export this community as JSON for full inspection."}),I?f.jsx(v3,{node:e,edges:i,nodes:Ne,sourceRevisions:l,onFocus:y,onOpenSource:w}):f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:"compass-neighbors-heading",children:[f.jsx("span",{children:"Connected nodes"}),f.jsx("strong",{children:t.length})]}),f.jsx("div",{className:"compass-neighbors-list",children:t.length?t.map(V=>f.jsxs("button",{type:"button",className:"compass-neighbor-link",title:V.label,onClick:()=>y(V.id),children:[f.jsx("span",{className:"compass-neighbor-dot","aria-hidden":"true",style:{background:V.color?.background??n.communities.find(se=>se.id===V.community)?.color??"var(--border)"}}),f.jsx("span",{className:"compass-neighbor-label",children:V.label})]},V.id)):f.jsx("span",{className:"compass-empty",children:"No connected nodes"})})]})]}):f.jsx("p",{className:"compass-empty",children:"Select a node to inspect its relationships."})]}),I&&!n.stats.aggregated&&f.jsx(b3,{nodes:n.nodes,query:o,selectedId:e?.id,onFocus:y}),f.jsx("section",{className:"compass-community-panel","aria-labelledby":"compass-communities-title","data-secondary":I,children:I?f.jsxs("details",{children:[f.jsxs("summary",{id:"compass-communities-title",children:["Communities",f.jsx("span",{children:n.communities.length})]}),f.jsx(hv,{model:n,communityCounts:fe,hiddenCommunities:A,allVisible:ke,onSetAllVisible:E,onToggleCommunity:O})]}):f.jsxs(f.Fragment,{children:[f.jsx("h2",{id:"compass-communities-title",children:"Communities"}),f.jsx(hv,{model:n,communityCounts:fe,hiddenCommunities:A,allVisible:ke,onSetAllVisible:E,onToggleCommunity:O})]})}),f.jsxs("footer",{className:"compass-graph-stats",children:[n.stats.nodes.toLocaleString()," nodes · ",n.stats.edges.toLocaleString()," edges",hT3(n.communities,A),[n.communities,A]),c=L.useMemo(()=>{const h=A.trim().toLocaleLowerCase();return h?n.communities.filter(p=>p.label.toLocaleLowerCase().includes(h)||String(p.id).includes(h)).length:n.communities.length},[n.communities,A]);return f.jsxs("div",{className:"compass-community-controls",children:[f.jsxs("label",{className:"compass-community-control",children:[f.jsx("input",{type:"checkbox",checked:i,onChange:h=>o(h.target.checked)}),f.jsx("span",{children:"Select all"})]}),n.communities.length>lv&&f.jsxs("label",{className:"compass-community-search",children:[f.jsx("span",{className:"sr-only",children:"Filter communities"}),f.jsx(Qm,{"aria-hidden":"true"}),f.jsx("input",{type:"search",value:A,placeholder:"Filter communities",onChange:h=>I(h.target.value)})]}),f.jsx("div",{className:"compass-community-list",children:l.map(h=>{const p=!t.has(h.id);return f.jsxs("label",{className:"compass-community-item","data-hidden":!p,children:[f.jsx("input",{type:"checkbox",checked:p,onChange:()=>r(h.id)}),f.jsx("span",{className:"compass-community-dot","aria-hidden":"true",style:{background:h.color}}),f.jsx("span",{className:"compass-community-label",children:h.label}),f.jsx("small",{children:e.get(h.id)??0})]},h.id)})}),c>l.length&&f.jsxs("p",{className:"compass-community-limit",role:"status",children:["Showing ",l.length.toLocaleString()," of"," ",c.toLocaleString()," communities. Filter to find another community."]})]})}function M3({className:n="compass-load-logo"}){return f.jsx("svg",{className:n,viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:f.jsx("path",{fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd",d:"M3.554 21.529c1.797 1.221 4.943-.038 11.236-2.554 1.342-.537 2.013-.806 2.54-1.267q.201-.177.378-.378c.461-.527.73-1.198 1.267-2.54 2.515-6.293 3.775-9.44 2.554-11.236a4.1 4.1 0 0 0-1.083-1.083c-1.797-1.221-4.944.037-11.236 2.554-1.342.537-2.013.806-2.54 1.267q-.201.177-.378.378c-.461.527-.73 1.198-1.267 2.54-2.517 6.292-3.775 9.439-2.554 11.236.29.426.657.793 1.083 1.083M8.25 12a3.75 3.75 0 1 1 7.5 0 3.75 3.75 0 0 1-7.5 0m1.5 0a2.25 2.25 0 1 1 4.5 0 2.25 2.25 0 0 1-4.5 0"})})}const z3=1e4;function fv(n){const[e,t]=L.useState(!1);L.useEffect(()=>{if(n.kind!=="layout"){t(!1);return}const A=window.setTimeout(()=>{t(!0)},z3);return()=>window.clearTimeout(A)},[n.kind]);const i=n.kind==="community",o=i?`Opening ${n.communityLabel}`:e?"Still arranging this graph":"Arranging graph layout",r=i?"Fetching symbols and relationships for this community.":e?"This graph is taking longer than expected. You can open the current layout now.":"Positioning nodes and relationships for a readable first view.";return f.jsxs("section",{className:"compass-graph-transition","data-kind":n.kind,role:"status","aria-live":"polite","aria-atomic":"true",children:[f.jsxs("div",{className:"compass-load-visual","data-state":"loading","aria-hidden":"true",children:[f.jsx("span",{className:"compass-load-mark",children:f.jsx(M3,{})}),f.jsx("span",{className:"compass-load-progress",children:f.jsx("i",{})})]}),f.jsxs("div",{className:"compass-load-copy",children:[f.jsx("span",{className:"compass-load-eyebrow",children:"Compass graph"}),f.jsx("h1",{children:o}),f.jsx("p",{className:"compass-graph-transition-description",children:r}),!i&&e&&f.jsx("div",{className:"compass-load-actions",children:f.jsx("button",{className:"compass-load-action compass-load-action-primary",type:"button",onClick:n.onShowGraph,children:"Show graph now"})})]})]})}function k3(n){return n instanceof HTMLElement&&(n.isContentEditable||n.tagName==="INPUT"||n.tagName==="TEXTAREA"||n.tagName==="SELECT")}function R3({status:n,physicsRunning:e,layoutStyle:t,forceLabels:i,showEdgeLabels:o,hasSelection:r,isolateSelection:A,neighborhoodDepth:I,edgeDirection:l,layoutSpacing:c,showMinimap:h,leadingControls:p,leadingPanel:m,leadingPanelOpen:y,onLeadingPanelClose:w,onTogglePhysics:S,onLayoutChange:x,onZoomOut:O,onResetZoom:E,onZoomIn:_,onFit:P,onFitSelection:Q,onReset:ne,onToggleLabels:F,onToggleEdgeLabels:Z,onToggleIsolation:de,onNeighborhoodDepthChange:fe,onEdgeDirectionChange:ke,onLayoutSpacingChange:Ne,onToggleMinimap:je,onBack:qe}){const[Ae,M]=L.useState(!1),W=L.useId(),V=L.useRef(null),se=L.useRef(null),ee=L.useRef(!1);return L.useEffect(()=>{y&&M(!1)},[y]),L.useEffect(()=>{Ae||!ee.current||(ee.current=!1,se.current?.focus())},[Ae]),L.useEffect(()=>{const T=te=>{if(te.key==="Escape"){Ae&&(ee.current=!0,M(!1));return}te.key!=="?"||k3(te.target)||(te.preventDefault(),w?.(),M(!0))},U=te=>{V.current?.contains(te.target)||M(!1)};return document.addEventListener("keydown",T),document.addEventListener("pointerdown",U),()=>{document.removeEventListener("keydown",T),document.removeEventListener("pointerdown",U)}},[w,Ae]),f.jsxs("div",{ref:V,className:"compass-graph-toolbar compass-glass-panel",role:"toolbar","aria-label":"Graph controls",children:[f.jsxs("div",{className:"compass-viewer-status","data-state":e?"running":"paused",role:"status","aria-live":"polite",children:[f.jsx("span",{className:"compass-viewer-status-dot","aria-hidden":"true"}),f.jsx("span",{className:"compass-viewer-status-text",children:n})]}),f.jsxs("div",{className:"compass-toolbar-actions",children:[qe&&f.jsxs("button",{className:"compass-tool-button",type:"button","aria-label":"Back to community overview",onClick:qe,children:[f.jsx(GR,{}),f.jsx("span",{children:"Overview"})]}),f.jsxs("label",{className:"compass-layout-picker",children:[f.jsx(JR,{"aria-hidden":"true"}),f.jsx("span",{className:"sr-only",children:"Graph layout"}),f.jsxs("select",{"aria-label":"Graph layout",value:t,onChange:T=>x(T.target.value),children:[f.jsx("option",{value:"automatic",children:"Automatic"}),f.jsx("option",{value:"circle",children:"Circle"}),f.jsx("option",{value:"concentric",children:"Concentric"}),f.jsx("option",{value:"spiral",children:"Spiral"}),f.jsx("option",{value:"grid",children:"Square grid"})]})]}),f.jsxs("button",{className:"compass-tool-button compass-physics-button",type:"button","aria-label":e?"Stop layout":t==="automatic"?"Run layout":"Fixed layout","aria-pressed":e,disabled:t!=="automatic",title:t==="automatic"?e?"Stop layout":"Run layout":"Physics is available in Automatic layout",onClick:S,children:[e?f.jsx(Um,{}):t==="automatic"?f.jsx(s3,{}):f.jsx(Um,{}),f.jsx("span",{children:e?"Stop":t==="automatic"?"Layout":"Fixed"})]}),f.jsx("span",{className:"compass-toolbar-separator","aria-hidden":"true"}),f.jsxs("div",{className:"compass-zoom-controls",role:"group","aria-label":"Zoom controls",children:[f.jsx("button",{className:"compass-tool-button compass-tool-icon-button",type:"button","aria-label":"Zoom out",title:"Zoom out",onClick:O,children:f.jsx(u3,{})}),f.jsx("button",{className:"compass-tool-button compass-zoom-reset",type:"button","aria-label":"Reset zoom to 100%",title:"Reset zoom to 100%",onClick:E,children:"100%"}),f.jsx("button",{className:"compass-tool-button compass-tool-icon-button",type:"button","aria-label":"Zoom in",title:"Zoom in",onClick:_,children:f.jsx(d3,{})})]}),f.jsx("button",{className:"compass-tool-button compass-tool-icon-button",type:"button","aria-label":"Fit graph in view",title:"Fit graph in view",onClick:P,children:f.jsx(Fm,{})}),f.jsx("button",{className:"compass-tool-button compass-tool-icon-button",type:"button","aria-label":"Fit selected neighborhood",title:r?`Fit the selected node and its ${I}-hop neighborhood`:"Select a node to fit its neighborhood",disabled:!r,onClick:Q,children:f.jsx($R,{})}),f.jsx("button",{className:"compass-tool-button compass-tool-icon-button",type:"button","aria-label":"Reset graph view",title:"Reset graph view",onClick:ne,children:f.jsx(Hm,{})}),f.jsx("button",{className:"compass-tool-button compass-tool-icon-button",type:"button","aria-label":i?"Hide labels":"Show labels","aria-pressed":i,title:i?"Hide node labels":"Show all node labels",onClick:F,children:f.jsx(l3,{})}),f.jsx("button",{className:"compass-tool-button compass-tool-icon-button",type:"button","aria-label":o?"Hide relationship labels":"Show relationship labels","aria-pressed":o,title:o?"Hide relationship labels":"Show relationship labels",onClick:Z,children:f.jsx(Km,{})}),f.jsx("button",{ref:se,className:"compass-tool-button compass-tool-icon-button",type:"button","aria-label":"Graph settings","aria-expanded":Ae,"aria-controls":W,title:"Graph settings (?)",onClick:()=>M(T=>{const U=!T;return U&&w?.(),U}),children:f.jsx(a3,{})}),p?f.jsx("div",{className:"compass-toolbar-leading",children:p}):null]}),m,Ae?f.jsxs("div",{id:W,className:"compass-explore-panel compass-glass-panel",role:"region","aria-label":"Graph exploration controls",children:[f.jsxs("div",{className:"compass-explore-heading",children:[f.jsxs("div",{children:[f.jsx("strong",{children:"Graph settings"}),f.jsx("span",{children:r?"Tune the selected neighborhood and canvas":"Set the next neighborhood, then select a node"})]}),f.jsx("kbd",{children:"?"})]}),r?null:f.jsxs("div",{className:"compass-selection-prompt",role:"note",children:[f.jsx(Wm,{"aria-hidden":"true"}),f.jsxs("span",{children:[f.jsx("strong",{children:"Select a node to isolate it"}),f.jsx("small",{children:"Use the canvas or node search. Depth and direction can be set now."})]})]}),f.jsxs("button",{className:"compass-explore-toggle",type:"button","aria-label":"Isolate selection","aria-pressed":A,disabled:!r,onClick:de,children:[f.jsx(Wm,{"aria-hidden":"true"}),f.jsxs("span",{children:[f.jsx("strong",{children:"Isolate selection"}),f.jsx("small",{children:"Hide everything outside the traversal"})]}),f.jsx("i",{"aria-hidden":"true"})]}),f.jsxs("fieldset",{className:"compass-explore-field",children:[f.jsx("legend",{children:"Neighborhood depth"}),f.jsx("div",{className:"compass-segmented-control","aria-label":"Neighborhood depth",children:[1,2,3,4].map(T=>f.jsx("button",{type:"button","aria-label":`${T} hop${T===1?"":"s"}`,"aria-pressed":I===T,onClick:()=>fe(T),children:T},T))})]}),f.jsxs("fieldset",{className:"compass-explore-field",children:[f.jsx("legend",{children:"Edge direction"}),f.jsx("div",{className:"compass-segmented-control","aria-label":"Edge direction",children:[["both","Both"],["outgoing","Out"],["incoming","In"]].map(([T,U])=>f.jsx("button",{type:"button","aria-label":`${U==="Both"?"Both directions":U==="Out"?"Outgoing edges":"Incoming edges"}`,"aria-pressed":l===T,onClick:()=>ke(T),children:U},T))})]}),f.jsxs("label",{className:"compass-explore-select",children:[f.jsx("span",{children:"Layout spacing"}),f.jsxs("select",{"aria-label":"Layout spacing",value:c,onChange:T=>Ne(Number(T.target.value)),children:[f.jsx("option",{value:.75,children:"Compact · 75%"}),f.jsx("option",{value:1,children:"Default · 100%"}),f.jsx("option",{value:1.25,children:"Airy · 125%"}),f.jsx("option",{value:1.5,children:"Wide · 150%"})]})]}),f.jsxs("button",{className:"compass-explore-toggle",type:"button","aria-label":"Show minimap","aria-pressed":h,onClick:je,children:[f.jsx(e3,{"aria-hidden":"true"}),f.jsxs("span",{children:[f.jsx("strong",{children:"Show minimap"}),f.jsx("small",{children:"Track and reposition the visible viewport"})]}),f.jsx("i",{"aria-hidden":"true"})]}),f.jsxs("div",{className:"compass-shortcut-guide","aria-label":"Graph keyboard shortcuts",children:[f.jsxs("div",{className:"compass-shortcut-title",children:[f.jsx(qR,{"aria-hidden":"true"}),f.jsx("strong",{children:"Keyboard"})]}),f.jsxs("dl",{children:[f.jsxs("div",{children:[f.jsx("dt",{children:f.jsx("kbd",{children:"F"})}),f.jsx("dd",{children:"Fit graph"})]}),f.jsxs("div",{children:[f.jsx("dt",{children:f.jsx("kbd",{children:"⇧ F"})}),f.jsx("dd",{children:"Fit selection"})]}),f.jsxs("div",{children:[f.jsxs("dt",{children:[f.jsx("kbd",{children:"+"})," ",f.jsx("kbd",{children:"−"})]}),f.jsx("dd",{children:"Zoom"})]}),f.jsxs("div",{children:[f.jsx("dt",{children:f.jsx("kbd",{children:"0"})}),f.jsx("dd",{children:"100% zoom"})]}),f.jsxs("div",{children:[f.jsx("dt",{children:f.jsx("kbd",{children:"I"})}),f.jsx("dd",{children:"Isolate"})]}),f.jsxs("div",{children:[f.jsxs("dt",{children:[f.jsx("kbd",{children:"["})," ",f.jsx("kbd",{children:"]"})]}),f.jsx("dd",{children:"Depth"})]}),f.jsxs("div",{children:[f.jsx("dt",{children:f.jsx("kbd",{children:"D"})}),f.jsx("dd",{children:"Direction"})]}),f.jsxs("div",{children:[f.jsx("dt",{children:f.jsx("kbd",{children:"M"})}),f.jsx("dd",{children:"Minimap"})]})]})]})]}):null]})}const pv=280,mv=560,vv=24,lc={width:340,collapsed:!1};function jr(n){return Number.isFinite(n)?Math.min(mv,Math.max(pv,Math.round(n))):lc.width}function yv(n){return{width:jr(n?.width??lc.width),collapsed:n?.collapsed??lc.collapsed}}function _3(n,e){return jr(n-e)}function j3(n,e){return jr(e==="ArrowLeft"?n+vv:e==="ArrowRight"?n-vv:n)}function Z3({width:n,onResize:e}){const t=L.useRef(!1),i=o=>{t.current=!1,o.currentTarget.hasPointerCapture(o.pointerId)&&o.currentTarget.releasePointerCapture(o.pointerId)};return f.jsx("div",{className:"compass-inspector-resizer",role:"separator","aria-label":"Resize graph inspector","aria-orientation":"vertical","aria-valuemin":pv,"aria-valuemax":mv,"aria-valuenow":n,tabIndex:0,onPointerDown:o=>{t.current=!0,o.currentTarget.setPointerCapture(o.pointerId)},onPointerMove:o=>{if(!t.current)return;const r=o.currentTarget.parentElement;r&&e(_3(r.getBoundingClientRect().right,o.clientX))},onPointerUp:i,onPointerCancel:i,onKeyDown:o=>{o.key!=="ArrowLeft"&&o.key!=="ArrowRight"||(o.preventDefault(),e(j3(n,o.key)))},children:f.jsx("span",{"aria-hidden":"true"})})}function bv(n,e,t){if(t===void 0&&n.stats.aggregated&&e.memberCount!==void 0&&e.detailAvailable!==!1)return{type:"community",communityId:e.community};const i=Av(e);return i?{type:"source",source:i}:{type:"none"}}function B3(n){const e=n.source?.startLine,t=n.source?.endLine;if(e!==void 0)return t!==void 0&&t!==e?`${e}–${t}`:String(e)}function P3({node:n,hover:e,activation:t}){const i={"--compass-hover-x":`${e.x+18}px`,"--compass-hover-y":`${e.y-42}px`},o=B3(n);return f.jsxs("div",{className:"compass-node-hover-card",role:"tooltip",style:i,children:[f.jsxs("div",{className:"compass-hover-heading",children:[f.jsx("strong",{children:n.label}),f.jsx("span",{children:(n.kind??"symbol").toLocaleUpperCase()})]}),n.change&&f.jsx("span",{className:"compass-change-badge","data-change":n.change,children:n.change==="unchanged"?"Context":`${n.change[0]?.toLocaleUpperCase()}${n.change.slice(1)}`}),n.memberCount!==void 0?f.jsxs("p",{children:[n.memberCount.toLocaleString()," symbols"]}):f.jsxs(f.Fragment,{children:[n.language&&f.jsxs("p",{children:["Language: ",n.language]}),n.source?.file&&f.jsx("p",{className:"compass-hover-source",children:n.source.file}),o&&f.jsxs("p",{children:["Lines: ",o]}),n.signature&&f.jsx("code",{children:n.signature})]}),t.type!=="none"&&f.jsxs("p",{className:"compass-hover-hint",children:[t.type==="community"?f.jsx(Ac,{"aria-hidden":"true"}):f.jsx(QR,{"aria-hidden":"true"}),f.jsxs("span",{children:[f.jsx("strong",{children:"Double-click"})," ",t.type==="community"?"to open community subgraph":"to open source code"]})]})]})}const L3={routes_to:"routes to",publishes:"publishes",subscribes:"subscribes",produces:"produces",consumes:"consumes",schedules:"schedules",triggers:"triggers",handles:"handles",registers:"registers",reads:"reads",writes:"writes",maps_to:"maps to",depends_on:"depends on"};function G3(n){const e=n.relation.trim(),t=L3[e]??e,i=n.details?.type==="route"?n.details.data:void 0,o=i?`${i.stage}${i.position===null||i.position===void 0?"":` ${i.position+1}`}`:void 0;return[t,o,i?.operation].filter(r=>r!==void 0&&r!=="").join(" · ")}function F3(n){if(!n?.file.trim())return"";const e=n.startLine,t=n.endLine;if(e!==void 0){const i=t!==void 0&&t!==e?`${e}–${t}`:String(e);return`${n.file}:${i}`}return n.startByte!==void 0?`${n.file}:byte ${n.startByte}`:n.file}function V3(n){const e=n.confidence;return e?`${e[0]?.toLocaleUpperCase()}${e.slice(1)}`:"Unspecified"}function U3(n){if(n)return n==="unchanged"?"Context":`${n[0]?.toLocaleUpperCase()}${n.slice(1)}`}function Y3({edge:n,sourceNode:e,targetNode:t,hover:i}){const o={"--compass-hover-x":`${i.x+18}px`,"--compass-hover-y":`${i.y-52}px`},r=F3(n.relationshipSite),A=n.codeEvidence?.[0],I=U3(n.change),l=Cv(n)!==void 0;return f.jsxs("div",{className:"compass-edge-hover-card",role:"tooltip",style:o,children:[f.jsxs("div",{className:"compass-edge-hover-heading",children:[f.jsxs("span",{className:"compass-edge-hover-eyebrow",children:[f.jsx(Lm,{"aria-hidden":"true"}),"Relationship"]}),f.jsx("span",{className:"compass-edge-confidence","data-confidence":n.confidence??"unspecified",children:V3(n)})]}),f.jsxs("div",{className:"compass-edge-trace","aria-label":`${e.label} to ${t.label}`,children:[f.jsx("strong",{children:e.label}),f.jsx("span",{"aria-hidden":"true",children:f.jsx(FR,{})}),f.jsx("strong",{children:t.label})]}),f.jsxs("div",{className:"compass-edge-relation-row",children:[f.jsx("strong",{children:G3(n)||"Relationship"}),I&&f.jsx("span",{className:"compass-change-badge","data-change":n.change,children:I})]}),(A||r)&&f.jsxs("div",{className:"compass-edge-metadata",children:[A&&f.jsxs("p",{children:[f.jsx("span",{children:"Evidence"}),f.jsx("code",{children:A.rule??A.origin})]}),r&&f.jsxs("p",{children:[f.jsx("span",{children:"Source"}),f.jsx("code",{children:r})]})]}),l&&f.jsxs("p",{className:"compass-hover-hint",children:[f.jsx(Lm,{"aria-hidden":"true"}),f.jsxs("span",{children:[f.jsx("strong",{children:"Double-click"})," to open relationship source"]})]})]})}var cc=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ee(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var XA=function(n){return n&&n.Math===Math&&n},_t=XA(typeof globalThis=="object"&&globalThis)||XA(typeof window=="object"&&window)||XA(typeof self=="object"&&self)||XA(typeof cc=="object"&&cc)||(function(){return this})()||cc||Function("return this")(),ot=function(n){try{return!!n()}catch{return!0}},H3=ot,Zr=!H3(function(){var n=(function(){}).bind();return typeof n!="function"||n.hasOwnProperty("prototype")}),K3=Zr,wv=Function.prototype,xv=wv.apply,Sv=wv.call,$A=typeof Reflect=="object"&&Reflect.apply||(K3?Sv.bind(xv):function(){return Sv.apply(xv,arguments)}),Ev=Zr,Tv=Function.prototype,dc=Tv.call,W3=Ev&&Tv.bind.bind(dc,dc),st=Ev?W3:function(n){return function(){return dc.apply(n,arguments)}},Ov=st,Q3=Ov({}.toString),X3=Ov("".slice),Hi=function(n){return X3(Q3(n),8,-1)},$3=Hi,q3=st,uc=function(n){if($3(n)==="Function")return q3(n)},hc=typeof document=="object"&&document.all,J3=typeof hc>"u"&&hc!==void 0,Nv={all:hc,IS_HTMLDDA:J3},Dv=Nv,e_=Dv.all,In=Dv.IS_HTMLDDA?function(n){return typeof n=="function"||n===e_}:function(n){return typeof n=="function"},Br={},t_=ot,nn=!t_(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7}),n_=Zr,qA=Function.prototype.call,ui=n_?qA.bind(qA):function(){return qA.apply(qA,arguments)},Pr={},Mv={}.propertyIsEnumerable,zv=Object.getOwnPropertyDescriptor,i_=zv&&!Mv.call({1:2},1);Pr.f=i_?function(e){var t=zv(this,e);return!!t&&t.enumerable}:Mv;var Lr=function(n,e){return{enumerable:!(n&1),configurable:!(n&2),writable:!(n&4),value:e}},g_=st,o_=ot,s_=Hi,fc=Object,r_=g_("".split),JA=o_(function(){return!fc("z").propertyIsEnumerable(0)})?function(n){return s_(n)==="String"?r_(n,""):fc(n)}:fc,As=function(n){return n==null},a_=As,A_=TypeError,Gr=function(n){if(a_(n))throw new A_("Can't call method on "+n);return n},C_=JA,I_=Gr,hi=function(n){return C_(I_(n))},kv=In,Rv=Nv,l_=Rv.all,yn=Rv.IS_HTMLDDA?function(n){return typeof n=="object"?n!==null:kv(n)||n===l_}:function(n){return typeof n=="object"?n!==null:kv(n)},at={},pc=at,mc=_t,c_=In,_v=function(n){return c_(n)?n:void 0},fi=function(n,e){return arguments.length<2?_v(pc[n])||_v(mc[n]):pc[n]&&pc[n][e]||mc[n]&&mc[n][e]},d_=st,jt=d_({}.isPrototypeOf),Fr=typeof navigator<"u"&&String(navigator.userAgent)||"",jv=_t,vc=Fr,Zv=jv.process,Bv=jv.Deno,Pv=Zv&&Zv.versions||Bv&&Bv.version,Lv=Pv&&Pv.v8,pi,eC;Lv&&(pi=Lv.split("."),eC=pi[0]>0&&pi[0]<4?1:+(pi[0]+pi[1])),!eC&&vc&&(pi=vc.match(/Edge\/(\d+)/),(!pi||pi[1]>=74)&&(pi=vc.match(/Chrome\/(\d+)/),pi&&(eC=+pi[1])));var Vr=eC,Gv=Vr,u_=ot,h_=_t,f_=h_.String,Cs=!!Object.getOwnPropertySymbols&&!u_(function(){var n=Symbol("symbol detection");return!f_(n)||!(Object(n)instanceof Symbol)||!Symbol.sham&&Gv&&Gv<41}),p_=Cs,Fv=p_&&!Symbol.sham&&typeof Symbol.iterator=="symbol",m_=fi,v_=In,y_=jt,b_=Fv,w_=Object,Ur=b_?function(n){return typeof n=="symbol"}:function(n){var e=m_("Symbol");return v_(e)&&y_(e.prototype,w_(n))},x_=String,Yr=function(n){try{return x_(n)}catch{return"Object"}},S_=In,E_=Yr,T_=TypeError,po=function(n){if(S_(n))return n;throw new T_(E_(n)+" is not a function")},O_=po,N_=As,yc=function(n,e){var t=n[e];return N_(t)?void 0:O_(t)},bc=ui,wc=In,xc=yn,D_=TypeError,M_=function(n,e){var t,i;if(e==="string"&&wc(t=n.toString)&&!xc(i=bc(t,n))||wc(t=n.valueOf)&&!xc(i=bc(t,n))||e!=="string"&&wc(t=n.toString)&&!xc(i=bc(t,n)))return i;throw new D_("Can't convert object to primitive value")},Vv={exports:{}},Uv=_t,z_=Object.defineProperty,k_=function(n,e){try{z_(Uv,n,{value:e,configurable:!0,writable:!0})}catch{Uv[n]=e}return e},R_=_t,__=k_,Yv="__core-js_shared__",j_=R_[Yv]||__(Yv,{}),Sc=j_,Hv=Sc;(Vv.exports=function(n,e){return Hv[n]||(Hv[n]=e!==void 0?e:{})})("versions",[]).push({version:"3.33.0",mode:"pure",copyright:"© 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.33.0/LICENSE",source:"https://github.com/zloirock/core-js"});var Is=Vv.exports,Z_=Gr,B_=Object,Gn=function(n){return B_(Z_(n))},P_=st,L_=Gn,G_=P_({}.hasOwnProperty),gn=Object.hasOwn||function(e,t){return G_(L_(e),t)},F_=st,V_=0,U_=Math.random(),Y_=F_(1 .toString),tC=function(n){return"Symbol("+(n===void 0?"":n)+")_"+Y_(++V_+U_,36)},H_=_t,K_=Is,Kv=gn,W_=tC,Q_=Cs,X_=Fv,ls=H_.Symbol,Ec=K_("wks"),$_=X_?ls.for||ls:ls&&ls.withoutSetter||W_,Gt=function(n){return Kv(Ec,n)||(Ec[n]=Q_&&Kv(ls,n)?ls[n]:$_("Symbol."+n)),Ec[n]},q_=ui,Wv=yn,Qv=Ur,J_=yc,e5=M_,t5=Gt,n5=TypeError,i5=t5("toPrimitive"),g5=function(n,e){if(!Wv(n)||Qv(n))return n;var t=J_(n,i5),i;if(t){if(e===void 0&&(e="default"),i=q_(t,n,e),!Wv(i)||Qv(i))return i;throw new n5("Can't convert object to primitive value")}return e===void 0&&(e="number"),e5(n,e)},o5=g5,s5=Ur,nC=function(n){var e=o5(n,"string");return s5(e)?e:e+""},r5=_t,Xv=yn,Tc=r5.document,a5=Xv(Tc)&&Xv(Tc.createElement),$v=function(n){return a5?Tc.createElement(n):{}},A5=nn,C5=ot,I5=$v,qv=!A5&&!C5(function(){return Object.defineProperty(I5("div"),"a",{get:function(){return 7}}).a!==7}),l5=nn,c5=ui,d5=Pr,u5=Lr,h5=hi,f5=nC,p5=gn,m5=qv,Jv=Object.getOwnPropertyDescriptor;Br.f=l5?Jv:function(e,t){if(e=h5(e),t=f5(t),m5)try{return Jv(e,t)}catch{}if(p5(e,t))return u5(!c5(d5.f,e,t),e[t])};var v5=ot,y5=In,b5=/#|\.prototype\./,Hr=function(n,e){var t=x5[w5(n)];return t===E5?!0:t===S5?!1:y5(e)?v5(e):!!e},w5=Hr.normalize=function(n){return String(n).replace(b5,".").toLowerCase()},x5=Hr.data={},S5=Hr.NATIVE="N",E5=Hr.POLYFILL="P",T5=Hr,ey=uc,O5=po,N5=Zr,D5=ey(ey.bind),Kr=function(n,e){return O5(n),e===void 0?n:N5?D5(n,e):function(){return n.apply(e,arguments)}},Fn={},M5=nn,z5=ot,ty=M5&&z5(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42}),k5=yn,R5=String,_5=TypeError,Ki=function(n){if(k5(n))return n;throw new _5(R5(n)+" is not an object")},j5=nn,Z5=qv,B5=ty,iC=Ki,ny=nC,P5=TypeError,Oc=Object.defineProperty,L5=Object.getOwnPropertyDescriptor,Nc="enumerable",Dc="configurable",Mc="writable";Fn.f=j5?B5?function(e,t,i){if(iC(e),t=ny(t),iC(i),typeof e=="function"&&t==="prototype"&&"value"in i&&Mc in i&&!i[Mc]){var o=L5(e,t);o&&o[Mc]&&(e[t]=i.value,i={configurable:Dc in i?i[Dc]:o[Dc],enumerable:Nc in i?i[Nc]:o[Nc],writable:!1})}return Oc(e,t,i)}:Oc:function(e,t,i){if(iC(e),t=ny(t),iC(i),Z5)try{return Oc(e,t,i)}catch{}if("get"in i||"set"in i)throw new P5("Accessors not supported");return"value"in i&&(e[t]=i.value),e};var G5=nn,F5=Fn,V5=Lr,cs=G5?function(n,e,t){return F5.f(n,e,V5(1,t))}:function(n,e,t){return n[e]=t,n},gC=_t,U5=$A,Y5=uc,H5=In,K5=Br.f,W5=T5,ds=at,Q5=Kr,us=cs,iy=gn,X5=function(n){var e=function(t,i,o){if(this instanceof e){switch(arguments.length){case 0:return new n;case 1:return new n(t);case 2:return new n(t,i)}return new n(t,i,o)}return U5(n,this,arguments)};return e.prototype=n.prototype,e},Me=function(n,e){var t=n.target,i=n.global,o=n.stat,r=n.proto,A=i?gC:o?gC[t]:(gC[t]||{}).prototype,I=i?ds:ds[t]||us(ds,t,{})[t],l=I.prototype,c,h,p,m,y,w,S,x,O;for(m in e)c=W5(i?m:t+(o?".":"#")+m,n.forced),h=!c&&A&&iy(A,m),w=I[m],h&&(n.dontCallGetSet?(O=K5(A,m),S=O&&O.value):S=A[m]),y=h&&S?S:e[m],!(h&&typeof w==typeof y)&&(n.bind&&h?x=Q5(y,gC):n.wrap&&h?x=X5(y):r&&H5(y)?x=Y5(y):x=y,(n.sham||y&&y.sham||w&&w.sham)&&us(x,"sham",!0),us(I,m,x),r&&(p=t+"Prototype",iy(ds,p)||us(ds,p,{}),us(ds[p],m,y),n.real&&l&&(c||!l[m])&&us(l,m,y)))},$5=Math.ceil,q5=Math.floor,J5=Math.trunc||function(e){var t=+e;return(t>0?q5:$5)(t)},ej=J5,oC=function(n){var e=+n;return e!==e||e===0?0:ej(e)},tj=oC,nj=Math.max,ij=Math.min,Wr=function(n,e){var t=tj(n);return t<0?nj(t+e,0):ij(t,e)},gj=oC,oj=Math.min,sj=function(n){return n>0?oj(gj(n),9007199254740991):0},rj=sj,Jn=function(n){return rj(n.length)},aj=hi,Aj=Wr,Cj=Jn,gy=function(n){return function(e,t,i){var o=aj(e),r=Cj(o),A=Aj(i,r),I;if(n&&t!==t){for(;r>A;)if(I=o[A++],I!==I)return!0}else for(;r>A;A++)if((n||A in o)&&o[A]===t)return n||A||0;return!n&&-1}},zc={includes:gy(!0),indexOf:gy(!1)},Qr={},Ij=st,kc=gn,lj=hi,cj=zc.indexOf,dj=Qr,oy=Ij([].push),sy=function(n,e){var t=lj(n),i=0,o=[],r;for(r in t)!kc(dj,r)&&kc(t,r)&&oy(o,r);for(;e.length>i;)kc(t,r=e[i++])&&(~cj(o,r)||oy(o,r));return o},Rc=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],uj=sy,hj=Rc,Xr=Object.keys||function(e){return uj(e,hj)},$r={};$r.f=Object.getOwnPropertySymbols;var ry=nn,fj=st,pj=ui,mj=ot,_c=Xr,vj=$r,yj=Pr,bj=Gn,wj=JA,hs=Object.assign,ay=Object.defineProperty,xj=fj([].concat),Sj=!hs||mj(function(){if(ry&&hs({b:1},hs(ay({},"a",{enumerable:!0,get:function(){ay(this,"b",{value:3,enumerable:!1})}}),{b:2})).b!==1)return!0;var n={},e={},t=Symbol("assign detection"),i="abcdefghijklmnopqrst";return n[t]=7,i.split("").forEach(function(o){e[o]=o}),hs({},n)[t]!==7||_c(hs({},e)).join("")!==i})?function(e,t){for(var i=bj(e),o=arguments.length,r=1,A=vj.f,I=yj.f;o>r;)for(var l=wj(arguments[r++]),c=A?xj(_c(l),A(l)):_c(l),h=c.length,p=0,m;h>p;)m=c[p++],(!ry||pj(I,l,m))&&(i[m]=l[m]);return i}:hs,Ej=Me,Ay=Sj;Ej({target:"Object",stat:!0,forced:Object.assign!==Ay},{assign:Ay});var Tj=at,Oj=Tj.Object.assign,Nj=Oj,Dj=Nj,Mj=Dj,Ft=Ee(Mj),zj=st,sC=zj([].slice),Cy=st,kj=po,Rj=yn,_j=gn,Iy=sC,jj=Zr,ly=Function,Zj=Cy([].concat),Bj=Cy([].join),jc={},Pj=function(n,e,t){if(!_j(jc,e)){for(var i=[],o=0;o=.1;)w=+r[p++%A],w>h&&(w=h),y=Math.sqrt(w*w/(1+c*c)),y=I<0?-y:y,e+=y,t+=c*y,m===!0?n.lineTo(e,t):n.moveTo(e,t),h-=w,m=!m}function n4(n,e,t,i){n.beginPath();const o=6,r=Math.PI*2/o;n.moveTo(e+i,t);for(let A=1;A1?t-1:0),o=1;o"u")){var i=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css",t==="top"&&i.firstChild?i.insertBefore(o,i.firstChild):i.appendChild(o),o.styleSheet?o.styleSheet.cssText=n:o.appendChild(document.createTextNode(n))}}var g4=`.vis-overlay { position: absolute; top: 0px; right: 0px; @@ -83,13 +83,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs. .vis-active { box-shadow: 0 0 10px #86d5f8; } -`;po(g4);var o4=`/* override some bootstrap styles screwing up the timelines css */ +`;mo(g4);var o4=`/* override some bootstrap styles screwing up the timelines css */ .vis [class*="span"] { min-height: 0; width: auto; } -`;po(o4);var s4=`div.vis-color-picker { +`;mo(o4);var s4=`div.vis-color-picker { position: absolute; top: 0px; left: 30px; @@ -334,7 +334,7 @@ div.vis-color-picker input.vis-range-brightness { div.vis-color-picker input.vis-saturation-range { width: 289px !important; }*/ -`;po(s4);var r4=`div.vis-configuration { +`;mo(s4);var r4=`div.vis-configuration { position: relative; display: block; float: left; @@ -677,7 +677,7 @@ input.vis-configuration.vis-config-range:focus::-ms-fill-upper { border-width: 12px; margin-top: -12px; } -`;po(r4);var a4=`div.vis-tooltip { +`;mo(r4);var a4=`div.vis-tooltip { position: absolute; visibility: hidden; padding: 5px; @@ -698,12 +698,12 @@ input.vis-configuration.vis-config-range:focus::-ms-fill-upper { z-index: 5; } -`;po(a4);var fy={exports:{}};(function(n){n.exports=e;function e(i){if(i)return t(i)}function t(i){for(var o in e.prototype)i[o]=e.prototype[o];return i}e.prototype.on=e.prototype.addEventListener=function(i,o){return this._callbacks=this._callbacks||{},(this._callbacks["$"+i]=this._callbacks["$"+i]||[]).push(o),this},e.prototype.once=function(i,o){function r(){this.off(i,r),o.apply(this,arguments)}return r.fn=o,this.on(i,r),this},e.prototype.off=e.prototype.removeListener=e.prototype.removeAllListeners=e.prototype.removeEventListener=function(i,o){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var r=this._callbacks["$"+i];if(!r)return this;if(arguments.length==1)return delete this._callbacks["$"+i],this;for(var A,I=0;Il4)throw I4("Maximum allowed index exceeded");return n},c4=eC,d4=Fn,u4=Pr,$r=function(n,e,t){var i=c4(e);i in n?d4.f(n,i,u4(0,t)):n[i]=t},h4=Ft,f4=h4("toStringTag"),my={};my[f4]="z";var Lc=String(my)==="[object z]",p4=Lc,m4=ln,oC=Yi,v4=Ft,y4=v4("toStringTag"),b4=Object,w4=oC((function(){return arguments})())==="Arguments",x4=function(n,e){try{return n[e]}catch{}},Ki=p4?oC:function(n){var e,t,i;return n===void 0?"Undefined":n===null?"Null":typeof(t=x4(e=b4(n),y4))=="string"?t:w4?oC(e):(i=oC(e))==="Object"&&m4(e.callee)?"Arguments":i},S4=gt,E4=ln,Gc=xc,T4=S4(Function.toString);E4(Gc.inspectSource)||(Gc.inspectSource=function(n){return T4(n)});var O4=Gc.inspectSource,N4=gt,D4=it,vy=ln,M4=Ki,z4=fi,k4=O4,yy=function(){},R4=[],by=z4("Reflect","construct"),Fc=/^\s*(?:class|function)\b/,_4=N4(Fc.exec),j4=!Fc.test(yy),qr=function(e){if(!vy(e))return!1;try{return by(yy,R4,e),!0}catch{return!1}},wy=function(e){if(!vy(e))return!1;switch(M4(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return j4||!!_4(Fc,k4(e))}catch{return!0}};wy.sham=!0;var xy=!by||D4(function(){var n;return qr(qr.call)||!qr(Object)||!qr(function(){n=!0})||n})?wy:qr,Sy=wg,Z4=xy,B4=yn,P4=Ft,L4=P4("species"),Ey=Array,G4=function(n){var e;return Sy(n)&&(e=n.constructor,Z4(e)&&(e===Ey||Sy(e.prototype))?e=void 0:B4(e)&&(e=e[L4],e===null&&(e=void 0))),e===void 0?Ey:e},F4=G4,sC=function(n,e){return new(F4(n))(e===0?0:e)},V4=it,U4=Ft,Y4=Fr,H4=U4("species"),Jr=function(n){return Y4>=51||!V4(function(){var e=[],t=e.constructor={};return t[H4]=function(){return{foo:1}},e[n](Boolean).foo!==1})},K4=ze,W4=it,Q4=wg,X4=yn,$4=Gn,q4=Jn,Ty=Pc,Oy=$r,J4=sC,eZ=Jr,tZ=Ft,nZ=Fr,Ny=tZ("isConcatSpreadable"),iZ=nZ>=51||!W4(function(){var n=[];return n[Ny]=!1,n.concat()[0]!==n}),gZ=function(n){if(!X4(n))return!1;var e=n[Ny];return e!==void 0?!!e:Q4(n)},oZ=!iZ||!eZ("concat");K4({target:"Array",proto:!0,forced:oZ},{concat:function(e){var t=$4(this),i=J4(t,0),o=0,r,A,I,l,c;for(r=-1,I=arguments.length;rA;)CZ.f(e,I=o[A++],i[I]);return e};var dZ=fi,uZ=dZ("document","documentElement"),hZ=Cs,fZ=JA,Dy=hZ("keys"),aC=function(n){return Dy[n]||(Dy[n]=fZ(n))},pZ=Hi,mZ=rC,My=kc,vZ=Wr,yZ=uZ,bZ=Xv,wZ=aC,zy=">",ky="<",Vc="prototype",Uc="script",Ry=wZ("IE_PROTO"),Yc=function(){},_y=function(n){return ky+Uc+zy+n+ky+"/"+Uc+zy},jy=function(n){n.write(_y("")),n.close();var e=n.parentWindow.Object;return n=null,e},xZ=function(){var n=bZ("iframe"),e="java"+Uc+":",t;return n.style.display="none",yZ.appendChild(n),n.src=String(e),t=n.contentWindow.document,t.open(),t.write(_y("document.F=Object")),t.close(),t.F},AC,CC=function(){try{AC=new ActiveXObject("htmlfile")}catch{}CC=typeof document<"u"?document.domain&&AC?jy(AC):xZ():jy(AC);for(var n=My.length;n--;)delete CC[Vc][My[n]];return CC()};vZ[Ry]=!0;var ea=Object.create||function(e,t){var i;return e!==null?(Yc[Vc]=pZ(e),i=new Yc,Yc[Vc]=null,i[Ry]=e):i=CC(),t===void 0?i:mZ.f(i,t)},ta={},SZ=oy,EZ=kc,TZ=EZ.concat("length","prototype");ta.f=Object.getOwnPropertyNames||function(e){return SZ(e,TZ)};var IC={},Zy=Kr,OZ=Jn,NZ=$r,DZ=Array,MZ=Math.max,By=function(n,e,t){for(var i=OZ(n),o=Zy(e,i),r=Zy(t===void 0?i:t,i),A=DZ(MZ(r-o,0)),I=0;ox;x++)if((I||x in y)&&(_=y[x],P=w(_,x,m),n))if(e)E[x]=P;else if(P)switch(n){case 3:return!0;case 5:return _;case 6:return x;case 2:Wy(E,_)}else switch(n){case 4:return!1;case 7:Wy(E,_)}return r?-1:i||o?o:E}},xg={forEach:vo(0),map:vo(1),filter:vo(2),some:vo(3),every:vo(4),find:vo(5),findIndex:vo(6)},dC=ze,uC=_t,Xc=ui,fB=gt,ps=nn,ms=As,pB=it,an=gn,mB=jt,$c=Hi,hC=hi,qc=eC,vB=Oi,Jc=Pr,oa=ea,Qy=Qr,yB=ta,Xy=IC,bB=Xr,$y=Zr,qy=Fn,wB=rC,Jy=Br,eb=na,xB=Hc,ed=Cs,SB=aC,tb=Wr,nb=JA,EB=Ft,TB=ia,OB=Zt,NB=Fy,DB=hs,ib=mo,fC=xg.forEach,Dn=SB("hidden"),pC="Symbol",sa="prototype",MB=ib.set,gb=ib.getterFor(pC),mi=Object[sa],yo=uC.Symbol,ra=yo&&yo[sa],zB=uC.RangeError,kB=uC.TypeError,td=uC.QObject,ob=$y.f,bo=qy.f,sb=Xy.f,RB=Jy.f,rb=fB([].push),Wi=ed("symbols"),aa=ed("op-symbols"),_B=ed("wks"),nd=!td||!td[sa]||!td[sa].findChild,ab=function(n,e,t){var i=ob(mi,e);i&&delete mi[e],bo(n,e,t),i&&n!==mi&&bo(mi,e,i)},id=ps&&pB(function(){return oa(bo({},"a",{get:function(){return bo(this,"a",{value:7}).a}})).a!==7})?ab:bo,gd=function(n,e){var t=Wi[n]=oa(ra);return MB(t,{type:pC,tag:n,description:e}),ps||(t.description=e),t},mC=function(e,t,i){e===mi&&mC(aa,t,i),$c(e);var o=qc(t);return $c(i),an(Wi,o)?(i.enumerable?(an(e,Dn)&&e[Dn][o]&&(e[Dn][o]=!1),i=oa(i,{enumerable:Jc(0,!1)})):(an(e,Dn)||bo(e,Dn,Jc(1,{})),e[Dn][o]=!0),id(e,o,i)):bo(e,o,i)},od=function(e,t){$c(e);var i=hC(t),o=Qy(i).concat(lb(i));return fC(o,function(r){(!ps||Xc(Ab,i,r))&&mC(e,r,i[r])}),e},jB=function(e,t){return t===void 0?oa(e):od(oa(e),t)},Ab=function(e){var t=qc(e),i=Xc(RB,this,t);return this===mi&&an(Wi,t)&&!an(aa,t)?!1:i||!an(this,t)||!an(Wi,t)||an(this,Dn)&&this[Dn][t]?i:!0},Cb=function(e,t){var i=hC(e),o=qc(t);if(!(i===mi&&an(Wi,o)&&!an(aa,o))){var r=ob(i,o);return r&&an(Wi,o)&&!(an(i,Dn)&&i[Dn][o])&&(r.enumerable=!0),r}},Ib=function(e){var t=sb(hC(e)),i=[];return fC(t,function(o){!an(Wi,o)&&!an(tb,o)&&rb(i,o)}),i},lb=function(n){var e=n===mi,t=sb(e?aa:hC(n)),i=[];return fC(t,function(o){an(Wi,o)&&(!e||an(mi,o))&&rb(i,Wi[o])}),i};ms||(yo=function(){if(mB(ra,this))throw new kB("Symbol is not a constructor");var e=!arguments.length||arguments[0]===void 0?void 0:vB(arguments[0]),t=nb(e),i=function(o){this===mi&&Xc(i,aa,o),an(this,Dn)&&an(this[Dn],t)&&(this[Dn][t]=!1);var r=Jc(1,o);try{id(this,t,r)}catch(A){if(!(A instanceof zB))throw A;ab(this,t,r)}};return ps&&nd&&id(mi,t,{configurable:!0,set:i}),gd(t,e)},ra=yo[sa],eb(ra,"toString",function(){return gb(this).tag}),eb(yo,"withoutSetter",function(n){return gd(nb(n),n)}),Jy.f=Ab,qy.f=mC,wB.f=od,$y.f=Cb,yB.f=Xy.f=Ib,bB.f=lb,TB.f=function(n){return gd(EB(n),n)},ps&&xB(ra,"description",{configurable:!0,get:function(){return gb(this).description}})),dC({global:!0,wrap:!0,forced:!ms,sham:!ms},{Symbol:yo}),fC(Qy(_B),function(n){OB(n)}),dC({target:pC,stat:!0,forced:!ms},{useSetter:function(){nd=!0},useSimple:function(){nd=!1}}),dC({target:"Object",stat:!0,forced:!ms,sham:!ps},{create:jB,defineProperty:mC,defineProperties:od,getOwnPropertyDescriptor:Cb}),dC({target:"Object",stat:!0,forced:!ms},{getOwnPropertyNames:Ib}),NB(),DB(yo,pC),tb[Dn]=!0;var ZB=As,cb=ZB&&!!Symbol.for&&!!Symbol.keyFor,BB=ze,PB=fi,LB=gn,GB=Oi,db=Cs,FB=cb,sd=db("string-to-symbol-registry"),VB=db("symbol-to-string-registry");BB({target:"Symbol",stat:!0,forced:!FB},{for:function(n){var e=GB(n);if(LB(sd,e))return sd[e];var t=PB("Symbol")(e);return sd[e]=t,VB[t]=e,t}});var UB=ze,YB=gn,HB=Vr,KB=Ur,WB=Cs,QB=cb,ub=WB("symbol-to-string-registry");UB({target:"Symbol",stat:!0,forced:!QB},{keyFor:function(e){if(!HB(e))throw new TypeError(KB(e)+" is not a symbol");if(YB(ub,e))return ub[e]}});var XB=gt,hb=wg,$B=ln,fb=Yi,qB=Oi,pb=XB([].push),JB=function(n){if($B(n))return n;if(hb(n)){for(var e=n.length,t=[],i=0;i=e.length)return n.target=void 0,xC(void 0,!0);switch(t){case"keys":return xC(i,!1);case"values":return xC(e[i],!1)}return xC([i,e[i]],!1)},"values"),Fb.Arguments=Fb.Array;var yL={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},bL=yL,wL=_t,xL=Ki,SL=ls,Yb=vs,EL=Ft,Hb=EL("toStringTag");for(var ud in bL){var Kb=wL[ud],hd=Kb&&Kb.prototype;hd&&xL(hd)!==Hb&&SL(hd,Hb,ud),Yb[ud]=Yb.Array}var TL=_P,Wb=TL,OL=Wb,NL=Ne(OL),DL=ze,Qb=wg,ML=xy,zL=yn,Xb=Kr,kL=Jn,RL=hi,_L=$r,jL=Ft,ZL=Jr,BL=gC,PL=ZL("slice"),LL=jL("species"),fd=Array,GL=Math.max;DL({target:"Array",proto:!0,forced:!PL},{slice:function(e,t){var i=RL(this),o=kL(i),r=Xb(e,o),A=Xb(t===void 0?o:t,o),I,l,c;if(Qb(i)&&(I=i.constructor,ML(I)&&(I===fd||Qb(I.prototype))?I=void 0:zL(I)&&(I=I[LL],I===null&&(I=void 0)),I===fd||I===void 0))return BL(i,r,A);for(l=new(I===void 0?fd:I)(GL(A-r,0)),c=0;r1?arguments[1]:void 0)}});var y8=Wt,b8=y8("Array").map,w8=jt,x8=b8,md=Array.prototype,S8=function(n){var e=n.map;return n===md||w8(md,n)&&e===md.map?x8:e},E8=S8,T8=E8,O8=T8,cn=Ne(O8),N8=ze,D8=Gn,qb=Qr,M8=it,z8=M8(function(){qb(1)});N8({target:"Object",stat:!0,forced:z8},{keys:function(e){return qb(D8(e))}});var k8=st,R8=k8.Object.keys,_8=R8,j8=_8,Z8=j8,wt=Ne(Z8),B8=ze,P8=gt,Jb=Date,L8=P8(Jb.prototype.getTime);B8({target:"Date",stat:!0},{now:function(){return L8(new Jb)}});var G8=st,F8=G8.Date.now,V8=F8,U8=V8,Y8=U8,SC=Ne(Y8),H8=it,ys=function(n,e){var t=[][n];return!!t&&H8(function(){t.call(null,e||function(){return 1},1)})},K8=xg.forEach,W8=ys,Q8=W8("forEach"),X8=Q8?[].forEach:function(e){return K8(this,e,arguments.length>1?arguments[1]:void 0)},$8=ze,e0=X8;$8({target:"Array",proto:!0,forced:[].forEach!==e0},{forEach:e0});var q8=Wt,J8=q8("Array").forEach,e6=J8,t6=e6,n6=Ki,i6=gn,g6=jt,o6=t6,vd=Array.prototype,s6={DOMTokenList:!0,NodeList:!0},r6=function(n){var e=n.forEach;return n===vd||g6(vd,n)&&e===vd.forEach||i6(s6,n6(n))?o6:e},a6=r6,Je=Ne(a6),A6=ze,C6=gt,I6=wg,l6=C6([].reverse),t0=[1,2];A6({target:"Array",proto:!0,forced:String(t0)===String(t0.reverse())},{reverse:function(){return I6(this)&&(this.length=this.length),l6(this)}});var c6=Wt,d6=c6("Array").reverse,u6=jt,h6=d6,yd=Array.prototype,f6=function(n){var e=n.reverse;return n===yd||u6(yd,n)&&e===yd.reverse?h6:e},p6=f6,m6=p6,v6=m6,wo=Ne(v6),y6=nn,b6=wg,w6=TypeError,x6=Object.getOwnPropertyDescriptor,S6=y6&&!(function(){if(this!==void 0)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(n){return n instanceof TypeError}})(),E6=S6?function(n,e){if(b6(n)&&!x6(n,"length").writable)throw new w6("Cannot set read only .length");return n.length=e}:function(n,e){return n.length=e},n0=Ur,T6=TypeError,i0=function(n,e){if(!delete n[e])throw new T6("Cannot delete property "+n0(e)+" of "+n0(n))},O6=ze,N6=Gn,D6=Kr,M6=iC,z6=Jn,k6=E6,R6=Pc,_6=sC,j6=$r,bd=i0,Z6=Jr,B6=Z6("splice"),P6=Math.max,L6=Math.min;O6({target:"Array",proto:!0,forced:!B6},{splice:function(e,t){var i=N6(this),o=z6(i),r=D6(e,o),A=arguments.length,I,l,c,h,p,m;for(A===0?I=l=0:A===1?(I=0,l=o-r):(I=A-2,l=L6(P6(M6(t),0),o-r)),R6(o+I-l),c=_6(i,l),h=0;ho-l+I;h--)bd(i,h-1)}else if(I>l)for(h=o-l;h>r;h--)p=h+l-1,m=h+I-1,p in i?i[m]=i[p]:bd(i,m);for(h=0;h1?arguments[1]:void 0)}});var J6=Wt,e9=J6("Array").includes,t9=yn,n9=Yi,i9=Ft,g9=i9("match"),o9=function(n){var e;return t9(n)&&((e=n[g9])!==void 0?!!e:n9(n)==="RegExp")},s9=o9,r9=TypeError,a9=function(n){if(s9(n))throw new r9("The method doesn't accept regular expressions");return n},A9=Ft,C9=A9("match"),I9=function(n){var e=/./;try{"/./"[n](e)}catch{try{return e[C9]=!1,"/./"[n](e)}catch{}}return!1},l9=ze,c9=gt,d9=a9,u9=Lr,g0=Oi,h9=I9,f9=c9("".indexOf);l9({target:"String",proto:!0,forced:!h9("includes")},{includes:function(e){return!!~f9(g0(u9(this)),g0(d9(e)),arguments.length>1?arguments[1]:void 0)}});var p9=Wt,m9=p9("String").includes,o0=jt,v9=e9,y9=m9,xd=Array.prototype,Sd=String.prototype,b9=function(n){var e=n.includes;return n===xd||o0(xd,n)&&e===xd.includes?v9:typeof n=="string"||n===Sd||o0(Sd,n)&&e===Sd.includes?y9:e},w9=b9,x9=w9,S9=x9,Eg=Ne(S9),E9=ze,T9=it,O9=Gn,s0=yC,N9=kb,D9=T9(function(){s0(1)});E9({target:"Object",stat:!0,forced:D9,sham:!N9},{getPrototypeOf:function(e){return s0(O9(e))}});var M9=st,z9=M9.Object.getPrototypeOf,k9=z9,R9=k9,_9=R9,r0=Ne(_9),j9=Wt,Z9=j9("Array").concat,B9=jt,P9=Z9,Ed=Array.prototype,L9=function(n){var e=n.concat;return n===Ed||B9(Ed,n)&&e===Ed.concat?P9:e},G9=L9,F9=G9,V9=F9,a0=Ne(V9),U9=ze,Y9=xg.filter,H9=Jr,K9=H9("filter");U9({target:"Array",proto:!0,forced:!K9},{filter:function(e){return Y9(this,e,arguments.length>1?arguments[1]:void 0)}});var W9=Wt,Q9=W9("Array").filter,X9=jt,$9=Q9,Td=Array.prototype,q9=function(n){var e=n.filter;return n===Td||X9(Td,n)&&e===Td.filter?$9:e},J9=q9,eG=J9,tG=eG,Qt=Ne(tG),A0=nn,nG=it,C0=gt,iG=yC,gG=Qr,oG=hi,sG=Br.f,I0=C0(sG),rG=C0([].push),aG=A0&&nG(function(){var n=Object.create(null);return n[2]=2,!I0(n,2)}),AG=function(n){return function(e){for(var t=oG(e),i=gG(t),o=aG&&iG(t)===null,r=i.length,A=0,I=[],l;r>A;)l=i[A++],(!A0||(o?l in t:I0(t,l)))&&rG(I,n?[l,t[l]]:t[l]);return I}},CG={values:AG(!1)},IG=ze,lG=CG.values;IG({target:"Object",stat:!0},{values:function(e){return lG(e)}});var cG=st,dG=cG.Object.values,uG=dG,hG=uG,fG=hG,pG=Ne(fG),Od=` -\v\f\r                 \u2028\u2029\uFEFF`,mG=gt,vG=Lr,yG=Oi,Nd=Od,l0=mG("".replace),bG=RegExp("^["+Nd+"]+"),wG=RegExp("(^|[^"+Nd+"])["+Nd+"]+$"),xG=function(n){return function(e){var t=yG(vG(e));return n&1&&(t=l0(t,bG,"")),n&2&&(t=l0(t,wG,"$1")),t}},c0={trim:xG(3)},d0=_t,SG=it,EG=gt,TG=Oi,OG=c0.trim,u0=Od,Ca=d0.parseInt,h0=d0.Symbol,f0=h0&&h0.iterator,p0=/^[+-]?0x/i,NG=EG(p0.exec),DG=Ca(u0+"08")!==8||Ca(u0+"0x16")!==22||f0&&!SG(function(){Ca(Object(f0))}),MG=DG?function(e,t){var i=OG(TG(e));return Ca(i,t>>>0||(NG(p0,i)?16:10))}:Ca,zG=ze,m0=MG;zG({global:!0,forced:parseInt!==m0},{parseInt:m0});var kG=st,RG=kG.parseInt,_G=RG,jG=_G,ZG=jG,yi=Ne(ZG),BG=ze,PG=dc,LG=Mc.indexOf,GG=ys,Dd=PG([].indexOf),v0=!!Dd&&1/Dd([1],1,-0)<0,FG=v0||!GG("indexOf");BG({target:"Array",proto:!0,forced:FG},{indexOf:function(e){var t=arguments.length>1?arguments[1]:void 0;return v0?Dd(this,e,t)||0:LG(this,e,t)}});var VG=Wt,UG=VG("Array").indexOf,YG=jt,HG=UG,Md=Array.prototype,KG=function(n){var e=n.indexOf;return n===Md||YG(Md,n)&&e===Md.indexOf?HG:e},WG=KG,QG=WG,XG=QG,at=Ne(XG),$G=ze,qG=nn,JG=ea;$G({target:"Object",stat:!0,sham:!qG},{create:JG});var eF=st,tF=eF.Object,nF=function(e,t){return tF.create(e,t)},iF=nF,gF=iF,oF=gF,Tg=Ne(oF),zd=st,sF=QA;zd.JSON||(zd.JSON={stringify:JSON.stringify});var rF=function(e,t,i){return sF(zd.JSON.stringify,null,arguments)},aF=rF,AF=aF,CF=AF,bs=Ne(CF),IF=typeof Bun=="function"&&Bun&&typeof Bun.version=="string",lF=TypeError,cF=function(n,e){if(nt,A=uF(i)?i:vF(i),I=r?pF(arguments,t):[],l=r?function(){dF(A,this,I)}:A;return e?n(l,o):n(l)}:n},bF=ze,w0=_t,wF=b0,x0=wF(w0.setInterval,!0);bF({global:!0,bind:!0,forced:w0.setInterval!==x0},{setInterval:x0});var xF=ze,S0=_t,SF=b0,E0=SF(S0.setTimeout,!0);xF({global:!0,bind:!0,forced:S0.setTimeout!==E0},{setTimeout:E0});var EF=st,TF=EF.setTimeout,OF=TF,Mi=Ne(OF),NF=Gn,T0=Kr,DF=Jn,MF=function(e){for(var t=NF(this),i=DF(t),o=arguments.length,r=T0(o>1?arguments[1]:void 0,i),A=o>2?arguments[2]:void 0,I=A===void 0?i:T0(A,i);I>r;)t[r++]=e;return t},zF=ze,kF=MF;zF({target:"Array",proto:!0},{fill:kF});var RF=Wt,_F=RF("Array").fill,jF=jt,ZF=_F,kd=Array.prototype,BF=function(n){var e=n.fill;return n===kd||jF(kd,n)&&e===kd.fill?ZF:e},PF=BF,LF=PF,GF=LF,Ia=Ne(GF);function bi(){return bi=Object.assign||function(n){for(var e=1;e"u"?{style:{}}:document.createElement("div"),VF="function",ws=Math.round,So=Math.abs,_d=Date.now;function TC(n,e){for(var t,i,o=e[0].toUpperCase()+e.slice(1),r=0;r"u"?Xi={}:Xi=window;var N0=TC(FF.style,"touchAction"),D0=N0!==void 0;function UF(){if(!D0)return!1;var n={},e=Xi.CSS&&Xi.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach(function(t){return n[t]=e?Xi.CSS.supports("touch-action",t):!0}),n}var M0="compute",z0="auto",jd="manipulation",Eo="none",la="pan-x",ca="pan-y",OC=UF(),YF=/mobile|tablet|ip(ad|hone|od)|android/i,k0="ontouchstart"in Xi,HF=TC(Xi,"PointerEvent")!==void 0,KF=k0&&YF.test(navigator.userAgent),da="touch",WF="pen",Zd="mouse",QF="kinect",XF=25,wn=1,To=2,Xt=4,Mn=8,NC=1,ua=2,ha=4,fa=8,xs=16,zi=ua|ha,Oo=fa|xs,R0=zi|Oo,_0=["x","y"],DC=["clientX","clientY"];function $i(n,e,t){var i;if(n)if(n.forEach)n.forEach(e,t);else if(n.length!==void 0)for(i=0;i-1}function $F(n){if(No(n,Eo))return Eo;var e=No(n,la),t=No(n,ca);return e&&t?Eo:e||t?e?la:ca:No(n,jd)?jd:z0}var j0=(function(){function n(t,i){this.manager=t,this.set(i)}var e=n.prototype;return e.set=function(i){i===M0&&(i=this.compute()),D0&&this.manager.element.style&&OC[i]&&(this.manager.element.style[N0]=i),this.actions=i.toLowerCase().trim()},e.update=function(){this.set(this.manager.options.touchAction)},e.compute=function(){var i=[];return $i(this.manager.recognizers,function(o){MC(o.options.enable,[o])&&(i=i.concat(o.getTouchAction()))}),$F(i.join(" "))},e.preventDefaults=function(i){var o=i.srcEvent,r=i.offsetDirection;if(this.manager.session.prevented){o.preventDefault();return}var A=this.actions,I=No(A,Eo)&&!OC[Eo],l=No(A,ca)&&!OC[ca],c=No(A,la)&&!OC[la];if(I){var h=i.pointers.length===1,p=i.distance<2,m=i.deltaTime<250;if(h&&p&&m)return}if(!(c&&l)&&(I||l&&r&zi||c&&r&Oo))return this.preventSrc(o)},e.preventSrc=function(i){this.manager.session.prevented=!0,i.preventDefault()},n})();function Bd(n,e){for(;n;){if(n===e)return!0;n=n.parentNode}return!1}function Z0(n){var e=n.length;if(e===1)return{x:ws(n[0].clientX),y:ws(n[0].clientY)};for(var t=0,i=0,o=0;o=So(e)?n<0?ua:ha:e<0?fa:xs}function qF(n,e){var t=e.center,i=n.offsetDelta||{},o=n.prevDelta||{},r=n.prevInput||{};(e.eventType===wn||r.eventType===Xt)&&(o=n.prevDelta={x:r.deltaX||0,y:r.deltaY||0},i=n.offsetDelta={x:t.x,y:t.y}),e.deltaX=o.x+(t.x-i.x),e.deltaY=o.y+(t.y-i.y)}function L0(n,e,t){return{x:e/n||0,y:t/n||0}}function JF(n,e){return zC(e[0],e[1],DC)/zC(n[0],n[1],DC)}function eV(n,e){return Pd(e[1],e[0],DC)+Pd(n[1],n[0],DC)}function tV(n,e){var t=n.lastInterval||e,i=e.timeStamp-t.timeStamp,o,r,A,I;if(e.eventType!==Mn&&(i>XF||t.velocity===void 0)){var l=e.deltaX-t.deltaX,c=e.deltaY-t.deltaY,h=L0(i,l,c);r=h.x,A=h.y,o=So(h.x)>So(h.y)?h.x:h.y,I=P0(l,c),n.lastInterval=e}else o=t.velocity,r=t.velocityX,A=t.velocityY,I=t.direction;e.velocity=o,e.velocityX=r,e.velocityY=A,e.direction=I}function nV(n,e){var t=n.session,i=e.pointers,o=i.length;t.firstInput||(t.firstInput=B0(e)),o>1&&!t.firstMultiple?t.firstMultiple=B0(e):o===1&&(t.firstMultiple=!1);var r=t.firstInput,A=t.firstMultiple,I=A?A.center:r.center,l=e.center=Z0(i);e.timeStamp=_d(),e.deltaTime=e.timeStamp-r.timeStamp,e.angle=Pd(I,l),e.distance=zC(I,l),qF(t,e),e.offsetDirection=P0(e.deltaX,e.deltaY);var c=L0(e.deltaTime,e.deltaX,e.deltaY);e.overallVelocityX=c.x,e.overallVelocityY=c.y,e.overallVelocity=So(c.x)>So(c.y)?c.x:c.y,e.scale=A?JF(A.pointers,i):1,e.rotation=A?eV(A.pointers,i):0,e.maxPointers=t.prevInput?e.pointers.length>t.prevInput.maxPointers?e.pointers.length:t.prevInput.maxPointers:e.pointers.length,tV(t,e);var h=n.element,p=e.srcEvent,m;p.composedPath?m=p.composedPath()[0]:p.path?m=p.path[0]:m=p.target,Bd(m,h)&&(h=m),e.target=h}function iV(n,e,t){var i=t.pointers.length,o=t.changedPointers.length,r=e&wn&&i-o===0,A=e&(Xt|Mn)&&i-o===0;t.isFirst=!!r,t.isFinal=!!A,r&&(n.session={}),t.eventType=e,nV(n,t),n.emit("hammer.input",t),n.recognize(t),n.session.prevInput=t}function pa(n){return n.trim().split(/\s+/g)}function ma(n,e,t){$i(pa(e),function(i){n.addEventListener(i,t,!1)})}function va(n,e,t){$i(pa(e),function(i){n.removeEventListener(i,t,!1)})}function G0(n){var e=n.ownerDocument||n;return e.defaultView||e.parentWindow||window}var Ss=(function(){function n(t,i){var o=this;this.manager=t,this.callback=i,this.element=t.element,this.target=t.options.inputTarget,this.domHandler=function(r){MC(t.options.enable,[t])&&o.handler(r)},this.init()}var e=n.prototype;return e.handler=function(){},e.init=function(){this.evEl&&ma(this.element,this.evEl,this.domHandler),this.evTarget&&ma(this.target,this.evTarget,this.domHandler),this.evWin&&ma(G0(this.element),this.evWin,this.domHandler)},e.destroy=function(){this.evEl&&va(this.element,this.evEl,this.domHandler),this.evTarget&&va(this.target,this.evTarget,this.domHandler),this.evWin&&va(G0(this.element),this.evWin,this.domHandler)},n})();function Do(n,e,t){if(n.indexOf&&!t)return n.indexOf(e);for(var i=0;il[e]}):i=i.sort()),i}var sV={touchstart:wn,touchmove:To,touchend:Xt,touchcancel:Mn},rV="touchstart touchmove touchend touchcancel",Gd=(function(n){ei(e,n);function e(){var i;return e.prototype.evTarget=rV,i=n.apply(this,arguments)||this,i.targetIds={},i}var t=e.prototype;return t.handler=function(o){var r=sV[o.type],A=aV.call(this,o,r);A&&this.callback(this.manager,r,{pointers:A[0],changedPointers:A[1],pointerType:da,srcEvent:o})},e})(Ss);function aV(n,e){var t=ya(n.touches),i=this.targetIds;if(e&(wn|To)&&t.length===1)return i[t[0].identifier]=!0,[t,t];var o,r,A=ya(n.changedTouches),I=[],l=this.target;if(r=t.filter(function(c){return Bd(c.target,l)}),e===wn)for(o=0;o-1&&o.splice(I,1)};setTimeout(r,lV)}}function cV(n,e){n&wn?(this.primaryTouch=e.changedPointers[0].identifier,H0.call(this,e)):n&(Xt|Mn)&&H0.call(this,e)}function dV(n){for(var e=n.srcEvent.clientX,t=n.srcEvent.clientY,i=0;i-1&&this.requireFail.splice(o,1),this},e.hasRequireFailures=function(){return this.requireFail.length>0},e.canRecognizeWith=function(i){return!!this.simultaneous[i.id]},e.emit=function(i){var o=this,r=this.state;function A(I){o.manager.emit(I,i)}r=Og&&A(o.options.event+W0(r))},e.tryEmit=function(i){if(this.canEmit())return this.emit(i);this.state=ki},e.canEmit=function(){for(var i=0;ir.threshold&&l&r.direction},t.attrTest=function(o){return Os.prototype.attrTest.call(this,o)&&(this.state&ti||!(this.state&ti)&&this.directionTest(o))},t.emit=function(o){this.pX=o.deltaX,this.pY=o.deltaY;var r=Q0(o.direction);r&&(o.additionalEvent=this.options.event+r),n.prototype.emit.call(this,o)},e})(Os),X0=(function(n){ei(e,n);function e(i){return i===void 0&&(i={}),n.call(this,bi({event:"swipe",threshold:10,velocity:.3,direction:zi|Oo,pointers:1},i))||this}var t=e.prototype;return t.getTouchAction=function(){return Ud.prototype.getTouchAction.call(this)},t.attrTest=function(o){var r=this.options.direction,A;return r&(zi|Oo)?A=o.overallVelocity:r&zi?A=o.overallVelocityX:r&Oo&&(A=o.overallVelocityY),n.prototype.attrTest.call(this,o)&&r&o.offsetDirection&&o.distance>this.options.threshold&&o.maxPointers===this.options.pointers&&So(A)>this.options.velocity&&o.eventType&Xt},t.emit=function(o){var r=Q0(o.offsetDirection);r&&this.manager.emit(this.options.event+r,o),this.manager.emit(this.options.event,o)},e})(Os),$0=(function(n){ei(e,n);function e(i){return i===void 0&&(i={}),n.call(this,bi({event:"pinch",threshold:0,pointers:2},i))||this}var t=e.prototype;return t.getTouchAction=function(){return[Eo]},t.attrTest=function(o){return n.prototype.attrTest.call(this,o)&&(Math.abs(o.scale-1)>this.options.threshold||this.state&ti)},t.emit=function(o){if(o.scale!==1){var r=o.scale<1?"in":"out";o.additionalEvent=this.options.event+r}n.prototype.emit.call(this,o)},e})(Os),q0=(function(n){ei(e,n);function e(i){return i===void 0&&(i={}),n.call(this,bi({event:"rotate",threshold:0,pointers:2},i))||this}var t=e.prototype;return t.getTouchAction=function(){return[Eo]},t.attrTest=function(o){return n.prototype.attrTest.call(this,o)&&(Math.abs(o.rotation)>this.options.threshold||this.state&ti)},e})(Os),J0=(function(n){ei(e,n);function e(i){var o;return i===void 0&&(i={}),o=n.call(this,bi({event:"press",pointers:1,time:251,threshold:9},i))||this,o._timer=null,o._input=null,o}var t=e.prototype;return t.getTouchAction=function(){return[z0]},t.process=function(o){var r=this,A=this.options,I=o.pointers.length===A.pointers,l=o.distanceA.time;if(this._input=o,!l||!I||o.eventType&(Xt|Mn)&&!c)this.reset();else if(o.eventType&wn)this.reset(),this._timer=setTimeout(function(){r.state=qi,r.tryEmit()},A.time);else if(o.eventType&Xt)return qi;return ki},t.reset=function(){clearTimeout(this._timer)},t.emit=function(o){this.state===qi&&(o&&o.eventType&Xt?this.manager.emit(this.options.event+"up",o):(this._input.timeStamp=_d(),this.manager.emit(this.options.event,this._input)))},e})(wa),e1={domEvents:!1,touchAction:M0,enable:!0,inputTarget:null,inputClass:null,cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}},t1=[[q0,{enable:!1}],[$0,{enable:!1},["rotate"]],[X0,{direction:zi}],[Ud,{direction:zi},["swipe"]],[Vd],[Vd,{event:"doubletap",taps:2},["tap"]],[J0]],pV=1,n1=2;function i1(n,e){var t=n.element;if(t.style){var i;$i(n.options.cssProps,function(o,r){i=TC(t.style,r),e?(n.oldCssProps[i]=t.style[i],t.style[i]=o):t.style[i]=n.oldCssProps[i]||""}),e||(n.oldCssProps={})}}function mV(n,e){var t=document.createEvent("Event");t.initEvent(n,!0,!0),t.gesture=e,e.target.dispatchEvent(t)}var g1=(function(){function n(t,i){var o=this;this.options=xo({},e1,i||{}),this.options.inputTarget=this.options.inputTarget||t,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=t,this.input=uV(this),this.touchAction=new j0(this,this.options.touchAction),i1(this,!0),$i(this.options.recognizers,function(r){var A=o.add(new r[0](r[1]));r[2]&&A.recognizeWith(r[2]),r[3]&&A.requireFailure(r[3])},this)}var e=n.prototype;return e.set=function(i){return xo(this.options,i),i.touchAction&&this.touchAction.update(),i.inputTarget&&(this.input.destroy(),this.input.target=i.inputTarget,this.input.init()),this},e.stop=function(i){this.session.stopped=i?n1:pV},e.recognize=function(i){var o=this.session;if(!o.stopped){this.touchAction.preventDefaults(i);var r,A=this.recognizers,I=o.curRecognizer;(!I||I&&I.state&qi)&&(o.curRecognizer=null,I=null);for(var l=0;ll4)throw I4("Maximum allowed index exceeded");return n},c4=nC,d4=Fn,u4=Lr,qr=function(n,e,t){var i=c4(e);i in n?d4.f(n,i,u4(0,t)):n[i]=t},h4=Gt,f4=h4("toStringTag"),vy={};vy[f4]="z";var Gc=String(vy)==="[object z]",p4=Gc,m4=In,rC=Hi,v4=Gt,y4=v4("toStringTag"),b4=Object,w4=rC((function(){return arguments})())==="Arguments",x4=function(n,e){try{return n[e]}catch{}},Wi=p4?rC:function(n){var e,t,i;return n===void 0?"Undefined":n===null?"Null":typeof(t=x4(e=b4(n),y4))=="string"?t:w4?rC(e):(i=rC(e))==="Object"&&m4(e.callee)?"Arguments":i},S4=st,E4=In,Fc=Sc,T4=S4(Function.toString);E4(Fc.inspectSource)||(Fc.inspectSource=function(n){return T4(n)});var O4=Fc.inspectSource,N4=st,D4=ot,yy=In,M4=Wi,z4=fi,k4=O4,by=function(){},R4=[],wy=z4("Reflect","construct"),Vc=/^\s*(?:class|function)\b/,_4=N4(Vc.exec),j4=!Vc.test(by),Jr=function(e){if(!yy(e))return!1;try{return wy(by,R4,e),!0}catch{return!1}},xy=function(e){if(!yy(e))return!1;switch(M4(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return j4||!!_4(Vc,k4(e))}catch{return!0}};xy.sham=!0;var Sy=!wy||D4(function(){var n;return Jr(Jr.call)||!Jr(Object)||!Jr(function(){n=!0})||n})?xy:Jr,Ey=xg,Z4=Sy,B4=yn,P4=Gt,L4=P4("species"),Ty=Array,G4=function(n){var e;return Ey(n)&&(e=n.constructor,Z4(e)&&(e===Ty||Ey(e.prototype))?e=void 0:B4(e)&&(e=e[L4],e===null&&(e=void 0))),e===void 0?Ty:e},F4=G4,aC=function(n,e){return new(F4(n))(e===0?0:e)},V4=ot,U4=Gt,Y4=Vr,H4=U4("species"),ea=function(n){return Y4>=51||!V4(function(){var e=[],t=e.constructor={};return t[H4]=function(){return{foo:1}},e[n](Boolean).foo!==1})},K4=Me,W4=ot,Q4=xg,X4=yn,$4=Gn,q4=Jn,Oy=Lc,Ny=qr,J4=aC,eZ=ea,tZ=Gt,nZ=Vr,Dy=tZ("isConcatSpreadable"),iZ=nZ>=51||!W4(function(){var n=[];return n[Dy]=!1,n.concat()[0]!==n}),gZ=function(n){if(!X4(n))return!1;var e=n[Dy];return e!==void 0?!!e:Q4(n)},oZ=!iZ||!eZ("concat");K4({target:"Array",proto:!0,forced:oZ},{concat:function(e){var t=$4(this),i=J4(t,0),o=0,r,A,I,l,c;for(r=-1,I=arguments.length;rA;)CZ.f(e,I=o[A++],i[I]);return e};var dZ=fi,uZ=dZ("document","documentElement"),hZ=Is,fZ=tC,My=hZ("keys"),CC=function(n){return My[n]||(My[n]=fZ(n))},pZ=Ki,mZ=AC,zy=Rc,vZ=Qr,yZ=uZ,bZ=$v,wZ=CC,ky=">",Ry="<",Uc="prototype",Yc="script",_y=wZ("IE_PROTO"),Hc=function(){},jy=function(n){return Ry+Yc+ky+n+Ry+"/"+Yc+ky},Zy=function(n){n.write(jy("")),n.close();var e=n.parentWindow.Object;return n=null,e},xZ=function(){var n=bZ("iframe"),e="java"+Yc+":",t;return n.style.display="none",yZ.appendChild(n),n.src=String(e),t=n.contentWindow.document,t.open(),t.write(jy("document.F=Object")),t.close(),t.F},IC,lC=function(){try{IC=new ActiveXObject("htmlfile")}catch{}lC=typeof document<"u"?document.domain&&IC?Zy(IC):xZ():Zy(IC);for(var n=zy.length;n--;)delete lC[Uc][zy[n]];return lC()};vZ[_y]=!0;var ta=Object.create||function(e,t){var i;return e!==null?(Hc[Uc]=pZ(e),i=new Hc,Hc[Uc]=null,i[_y]=e):i=lC(),t===void 0?i:mZ.f(i,t)},na={},SZ=sy,EZ=Rc,TZ=EZ.concat("length","prototype");na.f=Object.getOwnPropertyNames||function(e){return SZ(e,TZ)};var cC={},By=Wr,OZ=Jn,NZ=qr,DZ=Array,MZ=Math.max,Py=function(n,e,t){for(var i=OZ(n),o=By(e,i),r=By(t===void 0?i:t,i),A=DZ(MZ(r-o,0)),I=0;ox;x++)if((I||x in y)&&(_=y[x],P=w(_,x,m),n))if(e)E[x]=P;else if(P)switch(n){case 3:return!0;case 5:return _;case 6:return x;case 2:Qy(E,_)}else switch(n){case 4:return!1;case 7:Qy(E,_)}return r?-1:i||o?o:E}},Sg={forEach:yo(0),map:yo(1),filter:yo(2),some:yo(3),every:yo(4),find:yo(5),findIndex:yo(6)},hC=Me,fC=_t,$c=ui,fB=st,ms=nn,vs=Cs,pB=ot,rn=gn,mB=jt,qc=Ki,pC=hi,Jc=nC,vB=Oi,ed=Lr,sa=ta,Xy=Xr,yB=na,$y=cC,bB=$r,qy=Br,Jy=Fn,wB=AC,eb=Pr,tb=ia,xB=Kc,td=Is,SB=CC,nb=Qr,ib=tC,EB=Gt,TB=ga,OB=Zt,NB=Vy,DB=fs,gb=vo,mC=Sg.forEach,Dn=SB("hidden"),vC="Symbol",ra="prototype",MB=gb.set,ob=gb.getterFor(vC),mi=Object[ra],bo=fC.Symbol,aa=bo&&bo[ra],zB=fC.RangeError,kB=fC.TypeError,nd=fC.QObject,sb=qy.f,wo=Jy.f,rb=$y.f,RB=eb.f,ab=fB([].push),Qi=td("symbols"),Aa=td("op-symbols"),_B=td("wks"),id=!nd||!nd[ra]||!nd[ra].findChild,Ab=function(n,e,t){var i=sb(mi,e);i&&delete mi[e],wo(n,e,t),i&&n!==mi&&wo(mi,e,i)},gd=ms&&pB(function(){return sa(wo({},"a",{get:function(){return wo(this,"a",{value:7}).a}})).a!==7})?Ab:wo,od=function(n,e){var t=Qi[n]=sa(aa);return MB(t,{type:vC,tag:n,description:e}),ms||(t.description=e),t},yC=function(e,t,i){e===mi&&yC(Aa,t,i),qc(e);var o=Jc(t);return qc(i),rn(Qi,o)?(i.enumerable?(rn(e,Dn)&&e[Dn][o]&&(e[Dn][o]=!1),i=sa(i,{enumerable:ed(0,!1)})):(rn(e,Dn)||wo(e,Dn,ed(1,{})),e[Dn][o]=!0),gd(e,o,i)):wo(e,o,i)},sd=function(e,t){qc(e);var i=pC(t),o=Xy(i).concat(cb(i));return mC(o,function(r){(!ms||$c(Cb,i,r))&&yC(e,r,i[r])}),e},jB=function(e,t){return t===void 0?sa(e):sd(sa(e),t)},Cb=function(e){var t=Jc(e),i=$c(RB,this,t);return this===mi&&rn(Qi,t)&&!rn(Aa,t)?!1:i||!rn(this,t)||!rn(Qi,t)||rn(this,Dn)&&this[Dn][t]?i:!0},Ib=function(e,t){var i=pC(e),o=Jc(t);if(!(i===mi&&rn(Qi,o)&&!rn(Aa,o))){var r=sb(i,o);return r&&rn(Qi,o)&&!(rn(i,Dn)&&i[Dn][o])&&(r.enumerable=!0),r}},lb=function(e){var t=rb(pC(e)),i=[];return mC(t,function(o){!rn(Qi,o)&&!rn(nb,o)&&ab(i,o)}),i},cb=function(n){var e=n===mi,t=rb(e?Aa:pC(n)),i=[];return mC(t,function(o){rn(Qi,o)&&(!e||rn(mi,o))&&ab(i,Qi[o])}),i};vs||(bo=function(){if(mB(aa,this))throw new kB("Symbol is not a constructor");var e=!arguments.length||arguments[0]===void 0?void 0:vB(arguments[0]),t=ib(e),i=function(o){this===mi&&$c(i,Aa,o),rn(this,Dn)&&rn(this[Dn],t)&&(this[Dn][t]=!1);var r=ed(1,o);try{gd(this,t,r)}catch(A){if(!(A instanceof zB))throw A;Ab(this,t,r)}};return ms&&id&&gd(mi,t,{configurable:!0,set:i}),od(t,e)},aa=bo[ra],tb(aa,"toString",function(){return ob(this).tag}),tb(bo,"withoutSetter",function(n){return od(ib(n),n)}),eb.f=Cb,Jy.f=yC,wB.f=sd,qy.f=Ib,yB.f=$y.f=lb,bB.f=cb,TB.f=function(n){return od(EB(n),n)},ms&&xB(aa,"description",{configurable:!0,get:function(){return ob(this).description}})),hC({global:!0,wrap:!0,forced:!vs,sham:!vs},{Symbol:bo}),mC(Xy(_B),function(n){OB(n)}),hC({target:vC,stat:!0,forced:!vs},{useSetter:function(){id=!0},useSimple:function(){id=!1}}),hC({target:"Object",stat:!0,forced:!vs,sham:!ms},{create:jB,defineProperty:yC,defineProperties:sd,getOwnPropertyDescriptor:Ib}),hC({target:"Object",stat:!0,forced:!vs},{getOwnPropertyNames:lb}),NB(),DB(bo,vC),nb[Dn]=!0;var ZB=Cs,db=ZB&&!!Symbol.for&&!!Symbol.keyFor,BB=Me,PB=fi,LB=gn,GB=Oi,ub=Is,FB=db,rd=ub("string-to-symbol-registry"),VB=ub("symbol-to-string-registry");BB({target:"Symbol",stat:!0,forced:!FB},{for:function(n){var e=GB(n);if(LB(rd,e))return rd[e];var t=PB("Symbol")(e);return rd[e]=t,VB[t]=e,t}});var UB=Me,YB=gn,HB=Ur,KB=Yr,WB=Is,QB=db,hb=WB("symbol-to-string-registry");UB({target:"Symbol",stat:!0,forced:!QB},{keyFor:function(e){if(!HB(e))throw new TypeError(KB(e)+" is not a symbol");if(YB(hb,e))return hb[e]}});var XB=st,fb=xg,$B=In,pb=Hi,qB=Oi,mb=XB([].push),JB=function(n){if($B(n))return n;if(fb(n)){for(var e=n.length,t=[],i=0;i=e.length)return n.target=void 0,EC(void 0,!0);switch(t){case"keys":return EC(i,!1);case"values":return EC(e[i],!1)}return EC([i,e[i]],!1)},"values"),Vb.Arguments=Vb.Array;var yL={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},bL=yL,wL=_t,xL=Wi,SL=cs,Hb=ys,EL=Gt,Kb=EL("toStringTag");for(var hd in bL){var Wb=wL[hd],fd=Wb&&Wb.prototype;fd&&xL(fd)!==Kb&&SL(fd,Kb,hd),Hb[hd]=Hb.Array}var TL=_P,Qb=TL,OL=Qb,NL=Ee(OL),DL=Me,Xb=xg,ML=Sy,zL=yn,$b=Wr,kL=Jn,RL=hi,_L=qr,jL=Gt,ZL=ea,BL=sC,PL=ZL("slice"),LL=jL("species"),pd=Array,GL=Math.max;DL({target:"Array",proto:!0,forced:!PL},{slice:function(e,t){var i=RL(this),o=kL(i),r=$b(e,o),A=$b(t===void 0?o:t,o),I,l,c;if(Xb(i)&&(I=i.constructor,ML(I)&&(I===pd||Xb(I.prototype))?I=void 0:zL(I)&&(I=I[LL],I===null&&(I=void 0)),I===pd||I===void 0))return BL(i,r,A);for(l=new(I===void 0?pd:I)(GL(A-r,0)),c=0;r1?arguments[1]:void 0)}});var y8=Wt,b8=y8("Array").map,w8=jt,x8=b8,vd=Array.prototype,S8=function(n){var e=n.map;return n===vd||w8(vd,n)&&e===vd.map?x8:e},E8=S8,T8=E8,O8=T8,ln=Ee(O8),N8=Me,D8=Gn,Jb=Xr,M8=ot,z8=M8(function(){Jb(1)});N8({target:"Object",stat:!0,forced:z8},{keys:function(e){return Jb(D8(e))}});var k8=at,R8=k8.Object.keys,_8=R8,j8=_8,Z8=j8,xt=Ee(Z8),B8=Me,P8=st,e0=Date,L8=P8(e0.prototype.getTime);B8({target:"Date",stat:!0},{now:function(){return L8(new e0)}});var G8=at,F8=G8.Date.now,V8=F8,U8=V8,Y8=U8,TC=Ee(Y8),H8=ot,bs=function(n,e){var t=[][n];return!!t&&H8(function(){t.call(null,e||function(){return 1},1)})},K8=Sg.forEach,W8=bs,Q8=W8("forEach"),X8=Q8?[].forEach:function(e){return K8(this,e,arguments.length>1?arguments[1]:void 0)},$8=Me,t0=X8;$8({target:"Array",proto:!0,forced:[].forEach!==t0},{forEach:t0});var q8=Wt,J8=q8("Array").forEach,e6=J8,t6=e6,n6=Wi,i6=gn,g6=jt,o6=t6,yd=Array.prototype,s6={DOMTokenList:!0,NodeList:!0},r6=function(n){var e=n.forEach;return n===yd||g6(yd,n)&&e===yd.forEach||i6(s6,n6(n))?o6:e},a6=r6,et=Ee(a6),A6=Me,C6=st,I6=xg,l6=C6([].reverse),n0=[1,2];A6({target:"Array",proto:!0,forced:String(n0)===String(n0.reverse())},{reverse:function(){return I6(this)&&(this.length=this.length),l6(this)}});var c6=Wt,d6=c6("Array").reverse,u6=jt,h6=d6,bd=Array.prototype,f6=function(n){var e=n.reverse;return n===bd||u6(bd,n)&&e===bd.reverse?h6:e},p6=f6,m6=p6,v6=m6,xo=Ee(v6),y6=nn,b6=xg,w6=TypeError,x6=Object.getOwnPropertyDescriptor,S6=y6&&!(function(){if(this!==void 0)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(n){return n instanceof TypeError}})(),E6=S6?function(n,e){if(b6(n)&&!x6(n,"length").writable)throw new w6("Cannot set read only .length");return n.length=e}:function(n,e){return n.length=e},i0=Yr,T6=TypeError,g0=function(n,e){if(!delete n[e])throw new T6("Cannot delete property "+i0(e)+" of "+i0(n))},O6=Me,N6=Gn,D6=Wr,M6=oC,z6=Jn,k6=E6,R6=Lc,_6=aC,j6=qr,wd=g0,Z6=ea,B6=Z6("splice"),P6=Math.max,L6=Math.min;O6({target:"Array",proto:!0,forced:!B6},{splice:function(e,t){var i=N6(this),o=z6(i),r=D6(e,o),A=arguments.length,I,l,c,h,p,m;for(A===0?I=l=0:A===1?(I=0,l=o-r):(I=A-2,l=L6(P6(M6(t),0),o-r)),R6(o+I-l),c=_6(i,l),h=0;ho-l+I;h--)wd(i,h-1)}else if(I>l)for(h=o-l;h>r;h--)p=h+l-1,m=h+I-1,p in i?i[m]=i[p]:wd(i,m);for(h=0;h1?arguments[1]:void 0)}});var J6=Wt,e9=J6("Array").includes,t9=yn,n9=Hi,i9=Gt,g9=i9("match"),o9=function(n){var e;return t9(n)&&((e=n[g9])!==void 0?!!e:n9(n)==="RegExp")},s9=o9,r9=TypeError,a9=function(n){if(s9(n))throw new r9("The method doesn't accept regular expressions");return n},A9=Gt,C9=A9("match"),I9=function(n){var e=/./;try{"/./"[n](e)}catch{try{return e[C9]=!1,"/./"[n](e)}catch{}}return!1},l9=Me,c9=st,d9=a9,u9=Gr,o0=Oi,h9=I9,f9=c9("".indexOf);l9({target:"String",proto:!0,forced:!h9("includes")},{includes:function(e){return!!~f9(o0(u9(this)),o0(d9(e)),arguments.length>1?arguments[1]:void 0)}});var p9=Wt,m9=p9("String").includes,s0=jt,v9=e9,y9=m9,Sd=Array.prototype,Ed=String.prototype,b9=function(n){var e=n.includes;return n===Sd||s0(Sd,n)&&e===Sd.includes?v9:typeof n=="string"||n===Ed||s0(Ed,n)&&e===Ed.includes?y9:e},w9=b9,x9=w9,S9=x9,Tg=Ee(S9),E9=Me,T9=ot,O9=Gn,r0=wC,N9=Rb,D9=T9(function(){r0(1)});E9({target:"Object",stat:!0,forced:D9,sham:!N9},{getPrototypeOf:function(e){return r0(O9(e))}});var M9=at,z9=M9.Object.getPrototypeOf,k9=z9,R9=k9,_9=R9,a0=Ee(_9),j9=Wt,Z9=j9("Array").concat,B9=jt,P9=Z9,Td=Array.prototype,L9=function(n){var e=n.concat;return n===Td||B9(Td,n)&&e===Td.concat?P9:e},G9=L9,F9=G9,V9=F9,A0=Ee(V9),U9=Me,Y9=Sg.filter,H9=ea,K9=H9("filter");U9({target:"Array",proto:!0,forced:!K9},{filter:function(e){return Y9(this,e,arguments.length>1?arguments[1]:void 0)}});var W9=Wt,Q9=W9("Array").filter,X9=jt,$9=Q9,Od=Array.prototype,q9=function(n){var e=n.filter;return n===Od||X9(Od,n)&&e===Od.filter?$9:e},J9=q9,eG=J9,tG=eG,Qt=Ee(tG),C0=nn,nG=ot,I0=st,iG=wC,gG=Xr,oG=hi,sG=Pr.f,l0=I0(sG),rG=I0([].push),aG=C0&&nG(function(){var n=Object.create(null);return n[2]=2,!l0(n,2)}),AG=function(n){return function(e){for(var t=oG(e),i=gG(t),o=aG&&iG(t)===null,r=i.length,A=0,I=[],l;r>A;)l=i[A++],(!C0||(o?l in t:l0(t,l)))&&rG(I,n?[l,t[l]]:t[l]);return I}},CG={values:AG(!1)},IG=Me,lG=CG.values;IG({target:"Object",stat:!0},{values:function(e){return lG(e)}});var cG=at,dG=cG.Object.values,uG=dG,hG=uG,fG=hG,pG=Ee(fG),Nd=` +\v\f\r                 \u2028\u2029\uFEFF`,mG=st,vG=Gr,yG=Oi,Dd=Nd,c0=mG("".replace),bG=RegExp("^["+Dd+"]+"),wG=RegExp("(^|[^"+Dd+"])["+Dd+"]+$"),xG=function(n){return function(e){var t=yG(vG(e));return n&1&&(t=c0(t,bG,"")),n&2&&(t=c0(t,wG,"$1")),t}},d0={trim:xG(3)},u0=_t,SG=ot,EG=st,TG=Oi,OG=d0.trim,h0=Nd,Ia=u0.parseInt,f0=u0.Symbol,p0=f0&&f0.iterator,m0=/^[+-]?0x/i,NG=EG(m0.exec),DG=Ia(h0+"08")!==8||Ia(h0+"0x16")!==22||p0&&!SG(function(){Ia(Object(p0))}),MG=DG?function(e,t){var i=OG(TG(e));return Ia(i,t>>>0||(NG(m0,i)?16:10))}:Ia,zG=Me,v0=MG;zG({global:!0,forced:parseInt!==v0},{parseInt:v0});var kG=at,RG=kG.parseInt,_G=RG,jG=_G,ZG=jG,yi=Ee(ZG),BG=Me,PG=uc,LG=zc.indexOf,GG=bs,Md=PG([].indexOf),y0=!!Md&&1/Md([1],1,-0)<0,FG=y0||!GG("indexOf");BG({target:"Array",proto:!0,forced:FG},{indexOf:function(e){var t=arguments.length>1?arguments[1]:void 0;return y0?Md(this,e,t)||0:LG(this,e,t)}});var VG=Wt,UG=VG("Array").indexOf,YG=jt,HG=UG,zd=Array.prototype,KG=function(n){var e=n.indexOf;return n===zd||YG(zd,n)&&e===zd.indexOf?HG:e},WG=KG,QG=WG,XG=QG,Ct=Ee(XG),$G=Me,qG=nn,JG=ta;$G({target:"Object",stat:!0,sham:!qG},{create:JG});var eF=at,tF=eF.Object,nF=function(e,t){return tF.create(e,t)},iF=nF,gF=iF,oF=gF,Og=Ee(oF),kd=at,sF=$A;kd.JSON||(kd.JSON={stringify:JSON.stringify});var rF=function(e,t,i){return sF(kd.JSON.stringify,null,arguments)},aF=rF,AF=aF,CF=AF,ws=Ee(CF),IF=typeof Bun=="function"&&Bun&&typeof Bun.version=="string",lF=TypeError,cF=function(n,e){if(nt,A=uF(i)?i:vF(i),I=r?pF(arguments,t):[],l=r?function(){dF(A,this,I)}:A;return e?n(l,o):n(l)}:n},bF=Me,x0=_t,wF=w0,S0=wF(x0.setInterval,!0);bF({global:!0,bind:!0,forced:x0.setInterval!==S0},{setInterval:S0});var xF=Me,E0=_t,SF=w0,T0=SF(E0.setTimeout,!0);xF({global:!0,bind:!0,forced:E0.setTimeout!==T0},{setTimeout:T0});var EF=at,TF=EF.setTimeout,OF=TF,Mi=Ee(OF),NF=Gn,O0=Wr,DF=Jn,MF=function(e){for(var t=NF(this),i=DF(t),o=arguments.length,r=O0(o>1?arguments[1]:void 0,i),A=o>2?arguments[2]:void 0,I=A===void 0?i:O0(A,i);I>r;)t[r++]=e;return t},zF=Me,kF=MF;zF({target:"Array",proto:!0},{fill:kF});var RF=Wt,_F=RF("Array").fill,jF=jt,ZF=_F,Rd=Array.prototype,BF=function(n){var e=n.fill;return n===Rd||jF(Rd,n)&&e===Rd.fill?ZF:e},PF=BF,LF=PF,GF=LF,la=Ee(GF);function bi(){return bi=Object.assign||function(n){for(var e=1;e"u"?{style:{}}:document.createElement("div"),VF="function",xs=Math.round,Eo=Math.abs,jd=Date.now;function NC(n,e){for(var t,i,o=e[0].toUpperCase()+e.slice(1),r=0;r"u"?$i={}:$i=window;var D0=NC(FF.style,"touchAction"),M0=D0!==void 0;function UF(){if(!M0)return!1;var n={},e=$i.CSS&&$i.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach(function(t){return n[t]=e?$i.CSS.supports("touch-action",t):!0}),n}var z0="compute",k0="auto",Zd="manipulation",To="none",ca="pan-x",da="pan-y",DC=UF(),YF=/mobile|tablet|ip(ad|hone|od)|android/i,R0="ontouchstart"in $i,HF=NC($i,"PointerEvent")!==void 0,KF=R0&&YF.test(navigator.userAgent),ua="touch",WF="pen",Bd="mouse",QF="kinect",XF=25,wn=1,Oo=2,Xt=4,Mn=8,MC=1,ha=2,fa=4,pa=8,Ss=16,zi=ha|fa,No=pa|Ss,_0=zi|No,j0=["x","y"],zC=["clientX","clientY"];function qi(n,e,t){var i;if(n)if(n.forEach)n.forEach(e,t);else if(n.length!==void 0)for(i=0;i-1}function $F(n){if(Do(n,To))return To;var e=Do(n,ca),t=Do(n,da);return e&&t?To:e||t?e?ca:da:Do(n,Zd)?Zd:k0}var Z0=(function(){function n(t,i){this.manager=t,this.set(i)}var e=n.prototype;return e.set=function(i){i===z0&&(i=this.compute()),M0&&this.manager.element.style&&DC[i]&&(this.manager.element.style[D0]=i),this.actions=i.toLowerCase().trim()},e.update=function(){this.set(this.manager.options.touchAction)},e.compute=function(){var i=[];return qi(this.manager.recognizers,function(o){kC(o.options.enable,[o])&&(i=i.concat(o.getTouchAction()))}),$F(i.join(" "))},e.preventDefaults=function(i){var o=i.srcEvent,r=i.offsetDirection;if(this.manager.session.prevented){o.preventDefault();return}var A=this.actions,I=Do(A,To)&&!DC[To],l=Do(A,da)&&!DC[da],c=Do(A,ca)&&!DC[ca];if(I){var h=i.pointers.length===1,p=i.distance<2,m=i.deltaTime<250;if(h&&p&&m)return}if(!(c&&l)&&(I||l&&r&zi||c&&r&No))return this.preventSrc(o)},e.preventSrc=function(i){this.manager.session.prevented=!0,i.preventDefault()},n})();function Pd(n,e){for(;n;){if(n===e)return!0;n=n.parentNode}return!1}function B0(n){var e=n.length;if(e===1)return{x:xs(n[0].clientX),y:xs(n[0].clientY)};for(var t=0,i=0,o=0;o=Eo(e)?n<0?ha:fa:e<0?pa:Ss}function qF(n,e){var t=e.center,i=n.offsetDelta||{},o=n.prevDelta||{},r=n.prevInput||{};(e.eventType===wn||r.eventType===Xt)&&(o=n.prevDelta={x:r.deltaX||0,y:r.deltaY||0},i=n.offsetDelta={x:t.x,y:t.y}),e.deltaX=o.x+(t.x-i.x),e.deltaY=o.y+(t.y-i.y)}function G0(n,e,t){return{x:e/n||0,y:t/n||0}}function JF(n,e){return RC(e[0],e[1],zC)/RC(n[0],n[1],zC)}function eV(n,e){return Ld(e[1],e[0],zC)+Ld(n[1],n[0],zC)}function tV(n,e){var t=n.lastInterval||e,i=e.timeStamp-t.timeStamp,o,r,A,I;if(e.eventType!==Mn&&(i>XF||t.velocity===void 0)){var l=e.deltaX-t.deltaX,c=e.deltaY-t.deltaY,h=G0(i,l,c);r=h.x,A=h.y,o=Eo(h.x)>Eo(h.y)?h.x:h.y,I=L0(l,c),n.lastInterval=e}else o=t.velocity,r=t.velocityX,A=t.velocityY,I=t.direction;e.velocity=o,e.velocityX=r,e.velocityY=A,e.direction=I}function nV(n,e){var t=n.session,i=e.pointers,o=i.length;t.firstInput||(t.firstInput=P0(e)),o>1&&!t.firstMultiple?t.firstMultiple=P0(e):o===1&&(t.firstMultiple=!1);var r=t.firstInput,A=t.firstMultiple,I=A?A.center:r.center,l=e.center=B0(i);e.timeStamp=jd(),e.deltaTime=e.timeStamp-r.timeStamp,e.angle=Ld(I,l),e.distance=RC(I,l),qF(t,e),e.offsetDirection=L0(e.deltaX,e.deltaY);var c=G0(e.deltaTime,e.deltaX,e.deltaY);e.overallVelocityX=c.x,e.overallVelocityY=c.y,e.overallVelocity=Eo(c.x)>Eo(c.y)?c.x:c.y,e.scale=A?JF(A.pointers,i):1,e.rotation=A?eV(A.pointers,i):0,e.maxPointers=t.prevInput?e.pointers.length>t.prevInput.maxPointers?e.pointers.length:t.prevInput.maxPointers:e.pointers.length,tV(t,e);var h=n.element,p=e.srcEvent,m;p.composedPath?m=p.composedPath()[0]:p.path?m=p.path[0]:m=p.target,Pd(m,h)&&(h=m),e.target=h}function iV(n,e,t){var i=t.pointers.length,o=t.changedPointers.length,r=e&wn&&i-o===0,A=e&(Xt|Mn)&&i-o===0;t.isFirst=!!r,t.isFinal=!!A,r&&(n.session={}),t.eventType=e,nV(n,t),n.emit("hammer.input",t),n.recognize(t),n.session.prevInput=t}function ma(n){return n.trim().split(/\s+/g)}function va(n,e,t){qi(ma(e),function(i){n.addEventListener(i,t,!1)})}function ya(n,e,t){qi(ma(e),function(i){n.removeEventListener(i,t,!1)})}function F0(n){var e=n.ownerDocument||n;return e.defaultView||e.parentWindow||window}var Es=(function(){function n(t,i){var o=this;this.manager=t,this.callback=i,this.element=t.element,this.target=t.options.inputTarget,this.domHandler=function(r){kC(t.options.enable,[t])&&o.handler(r)},this.init()}var e=n.prototype;return e.handler=function(){},e.init=function(){this.evEl&&va(this.element,this.evEl,this.domHandler),this.evTarget&&va(this.target,this.evTarget,this.domHandler),this.evWin&&va(F0(this.element),this.evWin,this.domHandler)},e.destroy=function(){this.evEl&&ya(this.element,this.evEl,this.domHandler),this.evTarget&&ya(this.target,this.evTarget,this.domHandler),this.evWin&&ya(F0(this.element),this.evWin,this.domHandler)},n})();function Mo(n,e,t){if(n.indexOf&&!t)return n.indexOf(e);for(var i=0;il[e]}):i=i.sort()),i}var sV={touchstart:wn,touchmove:Oo,touchend:Xt,touchcancel:Mn},rV="touchstart touchmove touchend touchcancel",Fd=(function(n){ei(e,n);function e(){var i;return e.prototype.evTarget=rV,i=n.apply(this,arguments)||this,i.targetIds={},i}var t=e.prototype;return t.handler=function(o){var r=sV[o.type],A=aV.call(this,o,r);A&&this.callback(this.manager,r,{pointers:A[0],changedPointers:A[1],pointerType:ua,srcEvent:o})},e})(Es);function aV(n,e){var t=ba(n.touches),i=this.targetIds;if(e&(wn|Oo)&&t.length===1)return i[t[0].identifier]=!0,[t,t];var o,r,A=ba(n.changedTouches),I=[],l=this.target;if(r=t.filter(function(c){return Pd(c.target,l)}),e===wn)for(o=0;o-1&&o.splice(I,1)};setTimeout(r,lV)}}function cV(n,e){n&wn?(this.primaryTouch=e.changedPointers[0].identifier,K0.call(this,e)):n&(Xt|Mn)&&K0.call(this,e)}function dV(n){for(var e=n.srcEvent.clientX,t=n.srcEvent.clientY,i=0;i-1&&this.requireFail.splice(o,1),this},e.hasRequireFailures=function(){return this.requireFail.length>0},e.canRecognizeWith=function(i){return!!this.simultaneous[i.id]},e.emit=function(i){var o=this,r=this.state;function A(I){o.manager.emit(I,i)}r=Ng&&A(o.options.event+Q0(r))},e.tryEmit=function(i){if(this.canEmit())return this.emit(i);this.state=ki},e.canEmit=function(){for(var i=0;ir.threshold&&l&r.direction},t.attrTest=function(o){return Ns.prototype.attrTest.call(this,o)&&(this.state&ti||!(this.state&ti)&&this.directionTest(o))},t.emit=function(o){this.pX=o.deltaX,this.pY=o.deltaY;var r=X0(o.direction);r&&(o.additionalEvent=this.options.event+r),n.prototype.emit.call(this,o)},e})(Ns),$0=(function(n){ei(e,n);function e(i){return i===void 0&&(i={}),n.call(this,bi({event:"swipe",threshold:10,velocity:.3,direction:zi|No,pointers:1},i))||this}var t=e.prototype;return t.getTouchAction=function(){return Yd.prototype.getTouchAction.call(this)},t.attrTest=function(o){var r=this.options.direction,A;return r&(zi|No)?A=o.overallVelocity:r&zi?A=o.overallVelocityX:r&No&&(A=o.overallVelocityY),n.prototype.attrTest.call(this,o)&&r&o.offsetDirection&&o.distance>this.options.threshold&&o.maxPointers===this.options.pointers&&Eo(A)>this.options.velocity&&o.eventType&Xt},t.emit=function(o){var r=X0(o.offsetDirection);r&&this.manager.emit(this.options.event+r,o),this.manager.emit(this.options.event,o)},e})(Ns),q0=(function(n){ei(e,n);function e(i){return i===void 0&&(i={}),n.call(this,bi({event:"pinch",threshold:0,pointers:2},i))||this}var t=e.prototype;return t.getTouchAction=function(){return[To]},t.attrTest=function(o){return n.prototype.attrTest.call(this,o)&&(Math.abs(o.scale-1)>this.options.threshold||this.state&ti)},t.emit=function(o){if(o.scale!==1){var r=o.scale<1?"in":"out";o.additionalEvent=this.options.event+r}n.prototype.emit.call(this,o)},e})(Ns),J0=(function(n){ei(e,n);function e(i){return i===void 0&&(i={}),n.call(this,bi({event:"rotate",threshold:0,pointers:2},i))||this}var t=e.prototype;return t.getTouchAction=function(){return[To]},t.attrTest=function(o){return n.prototype.attrTest.call(this,o)&&(Math.abs(o.rotation)>this.options.threshold||this.state&ti)},e})(Ns),e1=(function(n){ei(e,n);function e(i){var o;return i===void 0&&(i={}),o=n.call(this,bi({event:"press",pointers:1,time:251,threshold:9},i))||this,o._timer=null,o._input=null,o}var t=e.prototype;return t.getTouchAction=function(){return[k0]},t.process=function(o){var r=this,A=this.options,I=o.pointers.length===A.pointers,l=o.distanceA.time;if(this._input=o,!l||!I||o.eventType&(Xt|Mn)&&!c)this.reset();else if(o.eventType&wn)this.reset(),this._timer=setTimeout(function(){r.state=Ji,r.tryEmit()},A.time);else if(o.eventType&Xt)return Ji;return ki},t.reset=function(){clearTimeout(this._timer)},t.emit=function(o){this.state===Ji&&(o&&o.eventType&Xt?this.manager.emit(this.options.event+"up",o):(this._input.timeStamp=jd(),this.manager.emit(this.options.event,this._input)))},e})(xa),t1={domEvents:!1,touchAction:z0,enable:!0,inputTarget:null,inputClass:null,cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}},n1=[[J0,{enable:!1}],[q0,{enable:!1},["rotate"]],[$0,{direction:zi}],[Yd,{direction:zi},["swipe"]],[Ud],[Ud,{event:"doubletap",taps:2},["tap"]],[e1]],pV=1,i1=2;function g1(n,e){var t=n.element;if(t.style){var i;qi(n.options.cssProps,function(o,r){i=NC(t.style,r),e?(n.oldCssProps[i]=t.style[i],t.style[i]=o):t.style[i]=n.oldCssProps[i]||""}),e||(n.oldCssProps={})}}function mV(n,e){var t=document.createEvent("Event");t.initEvent(n,!0,!0),t.gesture=e,e.target.dispatchEvent(t)}var o1=(function(){function n(t,i){var o=this;this.options=So({},t1,i||{}),this.options.inputTarget=this.options.inputTarget||t,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=t,this.input=uV(this),this.touchAction=new Z0(this,this.options.touchAction),g1(this,!0),qi(this.options.recognizers,function(r){var A=o.add(new r[0](r[1]));r[2]&&A.recognizeWith(r[2]),r[3]&&A.requireFailure(r[3])},this)}var e=n.prototype;return e.set=function(i){return So(this.options,i),i.touchAction&&this.touchAction.update(),i.inputTarget&&(this.input.destroy(),this.input.target=i.inputTarget,this.input.init()),this},e.stop=function(i){this.session.stopped=i?i1:pV},e.recognize=function(i){var o=this.session;if(!o.stopped){this.touchAction.preventDefaults(i);var r,A=this.recognizers,I=o.curRecognizer;(!I||I&&I.state&Ji)&&(o.curRecognizer=null,I=null);for(var l=0;l\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",A=window.console&&(window.console.warn||window.console.log);return A&&A.call(window.console,i,r),n.apply(this,arguments)}}var s1=o1(function(n,e,t){for(var i=Object.keys(e),o=0;o1?e-1:0),i=1;i2)return _C(C1(e[0],e[1]),...vi(e).call(e,2));const i=e[0],o=e[1];if(i instanceof Date&&o instanceof Date)return i.setTime(o.getTime()),i;for(const r of A8(o))Object.prototype.propertyIsEnumerable.call(o,r)&&(o[r]===A1?delete i[r]:i[r]!==null&&o[r]!==null&&typeof i[r]=="object"&&typeof o[r]=="object"&&!et(i[r])&&!et(o[r])?i[r]=_C(i[r],o[r]):i[r]=I1(o[r]));return i}function I1(n){return et(n)?cn(n).call(n,e=>I1(e)):typeof n=="object"&&n!==null?n instanceof Date?new Date(n.getTime()):_C({},n):n}function l1(n){for(const e of wt(n))n[e]===A1?delete n[e]:typeof n[e]=="object"&&n[e]!==null&&l1(n[e])}function jC(){for(var n=arguments.length,e=new Array(n),t=0;t{const A=2091639*e+o*23283064365386963e-26;return e=t,t=i,i=A-(o=A|0)};return r.uint32=()=>r()*4294967296,r.fract53=()=>r()+(r()*2097152|0)*11102230246251565e-32,r.algorithm="Alea",r.seed=n,r.version="0.9",r}function DV(){const n=MV();let e=n(" "),t=n(" "),i=n(" ");for(let o=0;o>>0,o-=n,o*=n,n=o>>>0,o-=n,n+=o*4294967296}return(n>>>0)*23283064365386963e-26}}function zV(){const n=()=>{};return{on:n,off:n,destroy:n,emit:n,get(){return{set:n}}}}const Yd=typeof window<"u"?window.Hammer||TV:function(){return zV()};function Ri(n){var e;this._cleanupQueue=[],this.active=!1,this._dom={container:n,overlay:document.createElement("div")},this._dom.overlay.classList.add("vis-overlay"),this._dom.container.appendChild(this._dom.overlay),this._cleanupQueue.push(()=>{this._dom.overlay.parentNode.removeChild(this._dom.overlay)});const t=Yd(this._dom.overlay);t.on("tap",ge(e=this._onTapOverlay).call(e,this)),this._cleanupQueue.push(()=>{t.destroy()});const i=["tap","doubletap","press","pinch","pan","panstart","panmove","panend"];Je(i).call(i,o=>{t.on(o,r=>{r.srcEvent.stopPropagation()})}),document&&document.body&&(this._onClick=o=>{kV(o.target,n)||this.deactivate()},document.body.addEventListener("click",this._onClick),this._cleanupQueue.push(()=>{document.body.removeEventListener("click",this._onClick)})),this._escListener=o=>{("key"in o?o.key==="Escape":o.keyCode===27)&&this.deactivate()}}py(Ri.prototype),Ri.current=null,Ri.prototype.destroy=function(){this.deactivate();for(const t of wo(n=Di(e=this._cleanupQueue).call(e,0)).call(n)){var n,e;t()}},Ri.prototype.activate=function(){Ri.current&&Ri.current.deactivate(),Ri.current=this,this.active=!0,this._dom.overlay.style.display="none",this._dom.container.classList.add("vis-active"),this.emit("change"),this.emit("activate"),document.body.addEventListener("keydown",this._escListener)},Ri.prototype.deactivate=function(){this.active=!1,this._dom.overlay.style.display="block",this._dom.container.classList.remove("vis-active"),document.body.removeEventListener("keydown",this._escListener),this.emit("change"),this.emit("deactivate")},Ri.prototype._onTapOverlay=function(n){this.activate(),n.srcEvent.stopPropagation()};function kV(n,e){for(;n;){if(n===e)return!0;n=n.parentNode}return!1}const RV=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i,_V=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,jV=/^rgb\( *(1?\d{1,2}|2[0-4]\d|25[0-5]) *, *(1?\d{1,2}|2[0-4]\d|25[0-5]) *, *(1?\d{1,2}|2[0-4]\d|25[0-5]) *\)$/i,ZV=/^rgba\( *(1?\d{1,2}|2[0-4]\d|25[0-5]) *, *(1?\d{1,2}|2[0-4]\d|25[0-5]) *, *(1?\d{1,2}|2[0-4]\d|25[0-5]) *, *([01]|0?\.\d+) *\)$/i;function Ng(n){if(n)for(;n.hasChildNodes()===!0;){const e=n.firstChild;e&&(Ng(e),n.removeChild(e))}}function Ns(n){return n instanceof String||typeof n=="string"}function c1(n){return typeof n=="object"&&n!==null}function Mo(n,e,t,i){let o=!1;i===!0&&(o=e[t]===null&&n[t]!==void 0),o?delete n[t]:n[t]=e[t]}function d1(n,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;for(const i in n)if(e[i]!==void 0)if(e[i]===null||typeof e[i]!="object")Mo(n,e,i,t);else{const o=n[i],r=e[i];c1(o)&&c1(r)&&d1(o,r,t)}}function Ds(n,e,t){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(et(t))throw new TypeError("Arrays are not supported by deepExtend");for(let o=0;o3&&arguments[3]!==void 0?arguments[3]:!1;if(et(t))throw new TypeError("Arrays are not supported by deepExtend");for(const o in t)if(Object.prototype.hasOwnProperty.call(t,o)&&!Eg(n).call(n,o))if(t[o]&&t[o].constructor===Object)e[o]===void 0&&(e[o]={}),e[o].constructor===Object?mt(e[o],t[o]):Mo(e,t,o,i);else if(et(t[o])){e[o]=[];for(let r=0;r2&&arguments[2]!==void 0?arguments[2]:!1,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)||t===!0)if(typeof e[r]=="object"&&e[r]!==null&&r0(e[r])===Object.prototype)n[r]===void 0?n[r]=mt({},e[r],t):typeof n[r]=="object"&&n[r]!==null&&r0(n[r])===Object.prototype?mt(n[r],e[r],t):Mo(n,e,r,i);else if(et(e[r])){var o;n[r]=vi(o=e[r]).call(o)}else Mo(n,e,r,i);return n}function BC(n,e){return[...n,e]}function BV(n){return vi(n).call(n)}function PV(n){return n.getBoundingClientRect().left}function LV(n){return n.getBoundingClientRect().top}function Ye(n,e){if(et(n)){const t=n.length;for(let i=0;i3&&arguments[3]!==void 0?arguments[3]:{};const o=function(y){return y!=null},r=function(y){return y!==null&&typeof y=="object"},A=function(y){for(const w in y)if(Object.prototype.hasOwnProperty.call(y,w))return!1;return!0};if(!r(n))throw new Error("Parameter mergeTarget must be an object");if(!r(e))throw new Error("Parameter options must be an object");if(!o(t))throw new Error("Parameter option must have a value");if(!r(i))throw new Error("Parameter globalOptions must be an object");const I=function(y,w,S){r(y[S])||(y[S]={});const x=w[S],O=y[S];for(const E in x)Object.prototype.hasOwnProperty.call(x,E)&&(O[E]=x[E])},l=e[t],h=r(i)&&!A(i)?i[t]:void 0,p=h?h.enabled:void 0;if(l===void 0)return;if(typeof l=="boolean"){r(n[t])||(n[t]={}),n[t].enabled=l;return}if(l===null&&!r(n[t]))if(o(h))n[t]=Tg(h);else return;if(!r(l))return;let m=!0;l.enabled!==void 0?m=l.enabled:p!==void 0&&(m=h.enabled),I(n,e,t),n[t].enabled=m}const VV={linear(n){return n},easeInQuad(n){return n*n},easeOutQuad(n){return n*(2-n)},easeInOutQuad(n){return n<.5?2*n*n:-1+(4-2*n)*n},easeInCubic(n){return n*n*n},easeOutCubic(n){return--n*n*n+1},easeInOutCubic(n){return n<.5?4*n*n*n:(n-1)*(2*n-2)*(2*n-2)+1},easeInQuart(n){return n*n*n*n},easeOutQuart(n){return 1- --n*n*n*n},easeInOutQuart(n){return n<.5?8*n*n*n*n:1-8*--n*n*n*n},easeInQuint(n){return n*n*n*n*n},easeOutQuint(n){return 1+--n*n*n*n*n},easeInOutQuint(n){return n<.5?16*n*n*n*n*n:1+16*--n*n*n*n*n}};function Mg(n,e){let t;et(e)||(e=[e]);for(const i of n)if(i){t=i[e[0]];for(let o=1;o0&&arguments[0]!==void 0?arguments[0]:1;this.pixelRatio=e,this.generated=!1,this.centerCoordinates={x:289/2,y:289/2},this.r=289*.49,this.color={r:255,g:255,b:255,a:1},this.hueCircle=void 0,this.initialColor={r:255,g:255,b:255,a:1},this.previousColor=void 0,this.applied=!1,this.updateCallback=()=>{},this.closeCallback=()=>{},this._create()}insertTo(e){this.hammer!==void 0&&(this.hammer.destroy(),this.hammer=void 0),this.container=e,this.container.appendChild(this.frame),this._bindHammer(),this._setSize()}setUpdateCallback(e){if(typeof e=="function")this.updateCallback=e;else throw new Error("Function attempted to set as colorPicker update callback is not a function.")}setCloseCallback(e){if(typeof e=="function")this.closeCallback=e;else throw new Error("Function attempted to set as colorPicker closing callback is not a function.")}_isColorString(e){if(typeof e=="string")return UV[e]}setColor(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(e==="none")return;let i;const o=this._isColorString(e);if(o!==void 0&&(e=o),Ns(e)===!0){if(f1(e)===!0){const r=e.substr(4).substr(0,e.length-5).split(",");i={r:r[0],g:r[1],b:r[2],a:1}}else if(FV(e)===!0){const r=e.substr(5).substr(0,e.length-6).split(",");i={r:r[0],g:r[1],b:r[2],a:r[3]}}else if(h1(e)===!0){const r=Hd(e);i={r:r.r,g:r.g,b:r.b,a:1}}}else if(e instanceof Object&&e.r!==void 0&&e.g!==void 0&&e.b!==void 0){const r=e.a!==void 0?e.a:"1.0";i={r:e.r,g:e.g,b:e.b,a:r}}if(i===void 0)throw new Error("Unknown color passed to the colorPicker. Supported are strings: rgb, hex, rgba. Object: rgb ({r:r,g:g,b:b,[a:a]}). Supplied: "+bs(e));this._setColor(i,t)}show(){this.closeCallback!==void 0&&(this.closeCallback(),this.closeCallback=void 0),this.applied=!1,this.frame.style.display="block",this._generateHueCircle()}_hide(){(arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0)===!0&&(this.previousColor=Vt({},this.color)),this.applied===!0&&this.updateCallback(this.initialColor),this.frame.style.display="none",Mi(()=>{this.closeCallback!==void 0&&(this.closeCallback(),this.closeCallback=void 0)},0)}_save(){this.updateCallback(this.color),this.applied=!1,this._hide()}_apply(){this.applied=!0,this.updateCallback(this.color),this._updatePicker(this.color)}_loadLast(){this.previousColor!==void 0?this.setColor(this.previousColor,!1):alert("There is no last color to load...")}_setColor(e){(arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0)===!0&&(this.initialColor=Vt({},e)),this.color=e;const i=xa(e.r,e.g,e.b),o=2*Math.PI,r=this.r*i.s,A=this.centerCoordinates.x+r*Math.sin(o*i.h),I=this.centerCoordinates.y+r*Math.cos(o*i.h);this.colorPickerSelector.style.left=A-.5*this.colorPickerSelector.clientWidth+"px",this.colorPickerSelector.style.top=I-.5*this.colorPickerSelector.clientHeight+"px",this._updatePicker(e)}_setOpacity(e){this.color.a=e/100,this._updatePicker(this.color)}_setBrightness(e){const t=xa(this.color.r,this.color.g,this.color.b);t.v=e/100;const i=PC(t.h,t.s,t.v);i.a=this.color.a,this.color=i,this._updatePicker()}_updatePicker(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.color;const t=xa(e.r,e.g,e.b),i=this.colorPickerCanvas.getContext("2d");this.pixelRation===void 0&&(this.pixelRatio=(window.devicePixelRatio||1)/(i.webkitBackingStorePixelRatio||i.mozBackingStorePixelRatio||i.msBackingStorePixelRatio||i.oBackingStorePixelRatio||i.backingStorePixelRatio||1)),i.setTransform(this.pixelRatio,0,0,this.pixelRatio,0,0);const o=this.colorPickerCanvas.clientWidth,r=this.colorPickerCanvas.clientHeight;i.clearRect(0,0,o,r),i.putImageData(this.hueCircle,0,0),i.fillStyle="rgba(0,0,0,"+(1-t.v)+")",i.circle(this.centerCoordinates.x,this.centerCoordinates.y,this.r),Ia(i).call(i),this.brightnessRange.value=100*t.v,this.opacityRange.value=100*e.a,this.initialColorDiv.style.backgroundColor="rgba("+this.initialColor.r+","+this.initialColor.g+","+this.initialColor.b+","+this.initialColor.a+")",this.newColorDiv.style.backgroundColor="rgba("+this.color.r+","+this.color.g+","+this.color.b+","+this.color.a+")"}_setSize(){this.colorPickerCanvas.style.width="100%",this.colorPickerCanvas.style.height="100%",this.colorPickerCanvas.width=289*this.pixelRatio,this.colorPickerCanvas.height=289*this.pixelRatio}_create(){var e,t,i,o;if(this.frame=document.createElement("div"),this.frame.className="vis-color-picker",this.colorPickerDiv=document.createElement("div"),this.colorPickerSelector=document.createElement("div"),this.colorPickerSelector.className="vis-selector",this.colorPickerDiv.appendChild(this.colorPickerSelector),this.colorPickerCanvas=document.createElement("canvas"),this.colorPickerDiv.appendChild(this.colorPickerCanvas),this.colorPickerCanvas.getContext){const A=this.colorPickerCanvas.getContext("2d");this.pixelRatio=(window.devicePixelRatio||1)/(A.webkitBackingStorePixelRatio||A.mozBackingStorePixelRatio||A.msBackingStorePixelRatio||A.oBackingStorePixelRatio||A.backingStorePixelRatio||1),this.colorPickerCanvas.getContext("2d").setTransform(this.pixelRatio,0,0,this.pixelRatio,0,0)}else{const A=document.createElement("DIV");A.style.color="red",A.style.fontWeight="bold",A.style.padding="10px",A.innerText="Error: your browser does not support HTML canvas",this.colorPickerCanvas.appendChild(A)}this.colorPickerDiv.className="vis-color",this.opacityDiv=document.createElement("div"),this.opacityDiv.className="vis-opacity",this.brightnessDiv=document.createElement("div"),this.brightnessDiv.className="vis-brightness",this.arrowDiv=document.createElement("div"),this.arrowDiv.className="vis-arrow",this.opacityRange=document.createElement("input");try{this.opacityRange.type="range",this.opacityRange.min="0",this.opacityRange.max="100"}catch{}this.opacityRange.value="100",this.opacityRange.className="vis-range",this.brightnessRange=document.createElement("input");try{this.brightnessRange.type="range",this.brightnessRange.min="0",this.brightnessRange.max="100"}catch{}this.brightnessRange.value="100",this.brightnessRange.className="vis-range",this.opacityDiv.appendChild(this.opacityRange),this.brightnessDiv.appendChild(this.brightnessRange);const r=this;this.opacityRange.onchange=function(){r._setOpacity(this.value)},this.opacityRange.oninput=function(){r._setOpacity(this.value)},this.brightnessRange.onchange=function(){r._setBrightness(this.value)},this.brightnessRange.oninput=function(){r._setBrightness(this.value)},this.brightnessLabel=document.createElement("div"),this.brightnessLabel.className="vis-label vis-brightness",this.brightnessLabel.innerText="brightness:",this.opacityLabel=document.createElement("div"),this.opacityLabel.className="vis-label vis-opacity",this.opacityLabel.innerText="opacity:",this.newColorDiv=document.createElement("div"),this.newColorDiv.className="vis-new-color",this.newColorDiv.innerText="new",this.initialColorDiv=document.createElement("div"),this.initialColorDiv.className="vis-initial-color",this.initialColorDiv.innerText="initial",this.cancelButton=document.createElement("div"),this.cancelButton.className="vis-button vis-cancel",this.cancelButton.innerText="cancel",this.cancelButton.onclick=ge(e=this._hide).call(e,this,!1),this.applyButton=document.createElement("div"),this.applyButton.className="vis-button vis-apply",this.applyButton.innerText="apply",this.applyButton.onclick=ge(t=this._apply).call(t,this),this.saveButton=document.createElement("div"),this.saveButton.className="vis-button vis-save",this.saveButton.innerText="save",this.saveButton.onclick=ge(i=this._save).call(i,this),this.loadButton=document.createElement("div"),this.loadButton.className="vis-button vis-load",this.loadButton.innerText="load last",this.loadButton.onclick=ge(o=this._loadLast).call(o,this),this.frame.appendChild(this.colorPickerDiv),this.frame.appendChild(this.arrowDiv),this.frame.appendChild(this.brightnessLabel),this.frame.appendChild(this.brightnessDiv),this.frame.appendChild(this.opacityLabel),this.frame.appendChild(this.opacityDiv),this.frame.appendChild(this.newColorDiv),this.frame.appendChild(this.initialColorDiv),this.frame.appendChild(this.cancelButton),this.frame.appendChild(this.applyButton),this.frame.appendChild(this.saveButton),this.frame.appendChild(this.loadButton)}_bindHammer(){this.drag={},this.pinch={},this.hammer=new Yd(this.colorPickerCanvas),this.hammer.get("pinch").set({enable:!0}),this.hammer.on("hammer.input",e=>{e.isFirst&&this._moveSelector(e)}),this.hammer.on("tap",e=>{this._moveSelector(e)}),this.hammer.on("panstart",e=>{this._moveSelector(e)}),this.hammer.on("panmove",e=>{this._moveSelector(e)}),this.hammer.on("panend",e=>{this._moveSelector(e)})}_generateHueCircle(){if(this.generated===!1){const e=this.colorPickerCanvas.getContext("2d");this.pixelRation===void 0&&(this.pixelRatio=(window.devicePixelRatio||1)/(e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1)),e.setTransform(this.pixelRatio,0,0,this.pixelRatio,0,0);const t=this.colorPickerCanvas.clientWidth,i=this.colorPickerCanvas.clientHeight;e.clearRect(0,0,t,i);let o,r,A,I;this.centerCoordinates={x:t*.5,y:i*.5},this.r=.49*t;const l=2*Math.PI/360,c=1/360,h=1/this.r;let p;for(A=0;A<360;A++)for(I=0;I3&&arguments[3]!==void 0?arguments[3]:1,r=arguments.length>4&&arguments[4]!==void 0?arguments[4]:()=>!1;this.parent=e,this.changedOptions=[],this.container=t,this.allowCreation=!1,this.hideOption=r,this.options={},this.initialized=!1,this.popupCounter=0,this.defaultOptions={enabled:!1,filter:!0,container:void 0,showButton:!0},Vt(this.options,this.defaultOptions),this.configureOptions=i,this.moduleOptions={},this.domElements=[],this.popupDiv={},this.popupLimit=5,this.popupHistory={},this.colorPicker=new YV(o),this.wrapper=void 0}setOptions(e){if(e!==void 0){this.popupHistory={},this._removePopup();let t=!0;if(typeof e=="string")this.options.filter=e;else if(et(e))this.options.filter=e.join();else if(typeof e=="object"){if(e==null)throw new TypeError("options cannot be null");e.container!==void 0&&(this.options.container=e.container),Qt(e)!==void 0&&(this.options.filter=Qt(e)),e.showButton!==void 0&&(this.options.showButton=e.showButton),e.enabled!==void 0&&(t=e.enabled)}else typeof e=="boolean"?(this.options.filter=!0,t=e):typeof e=="function"&&(this.options.filter=e,t=!0);Qt(this.options)===!1&&(t=!1),this.options.enabled=t}this._clean()}setModuleOptions(e){this.moduleOptions=e,this.options.enabled===!0&&(this._clean(),this.options.container!==void 0&&(this.container=this.options.container),this._create())}_create(){this._clean(),this.changedOptions=[];const e=Qt(this.options);let t=0,i=!1;for(const o in this.configureOptions)Object.prototype.hasOwnProperty.call(this.configureOptions,o)&&(this.allowCreation=!1,i=!1,typeof e=="function"?(i=e(o,[]),i=i||this._handleObject(this.configureOptions[o],[o],!0)):(e===!0||at(e).call(e,o)!==-1)&&(i=!0),i!==!1&&(this.allowCreation=!0,t>0&&this._makeItem([]),this._makeHeader(o),this._handleObject(this.configureOptions[o],[o])),t++);this._makeButton(),this._push()}_push(){this.wrapper=document.createElement("div"),this.wrapper.className="vis-configuration-wrapper",this.container.appendChild(this.wrapper);for(let e=0;e1?t-1:0),o=1;o{r.appendChild(A)}),this.domElements.push(r),this.domElements.length}return 0}_makeHeader(e){const t=document.createElement("div");t.className="vis-configuration vis-config-header",t.innerText=e,this._makeItem([],t)}_makeLabel(e,t){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;const o=document.createElement("div");if(o.className="vis-configuration vis-config-label vis-config-s"+t.length,i===!0){for(;o.firstChild;)o.removeChild(o.firstChild);o.appendChild(Qd("i","b",e))}else o.innerText=e+":";return o}_makeDropdown(e,t,i){const o=document.createElement("select");o.className="vis-configuration vis-config-select";let r=0;t!==void 0&&at(e).call(e,t)!==-1&&(r=at(e).call(e,t));for(let l=0;lA&&A!==1&&(l.max=Math.ceil(t*1.2),h=l.max,c="range increased"),l.value=t):l.value=o;const p=document.createElement("input");p.className="vis-configuration vis-config-rangeinput",p.value=l.value;const m=this;l.onchange=function(){p.value=this.value,m._update(Number(this.value),i)},l.oninput=function(){p.value=this.value};const y=this._makeLabel(i[i.length-1],i),w=this._makeItem(i,y,l,p);c!==""&&this.popupHistory[w]!==h&&(this.popupHistory[w]=h,this._setupPopup(c,w))}_makeButton(){if(this.options.showButton===!0){const e=document.createElement("div");e.className="vis-configuration vis-config-button",e.innerText="generate options",e.onclick=()=>{this._printOptions()},e.onmouseover=()=>{e.className="vis-configuration vis-config-button hover"},e.onmouseout=()=>{e.className="vis-configuration vis-config-button"},this.optionsContainer=document.createElement("div"),this.optionsContainer.className="vis-configuration vis-config-option-container",this.domElements.push(this.optionsContainer),this.domElements.push(e)}}_setupPopup(e,t){if(this.initialized===!0&&this.allowCreation===!0&&this.popupCounter{this._removePopup()},this.popupCounter+=1,this.popupDiv={html:i,index:t}}}_removePopup(){this.popupDiv.html!==void 0&&(this.popupDiv.html.parentNode.removeChild(this.popupDiv.html),clearTimeout(this.popupDiv.hideTimeout),clearTimeout(this.popupDiv.deleteTimeout),this.popupDiv={})}_showPopupIfNeeded(){if(this.popupDiv.html!==void 0){const t=this.domElements[this.popupDiv.index].getBoundingClientRect();this.popupDiv.html.style.left=t.left+"px",this.popupDiv.html.style.top=t.top-30+"px",document.body.appendChild(this.popupDiv.html),this.popupDiv.hideTimeout=Mi(()=>{this.popupDiv.html.style.opacity=0},1500),this.popupDiv.deleteTimeout=Mi(()=>{this._removePopup()},1800)}}_makeCheckbox(e,t,i){const o=document.createElement("input");o.type="checkbox",o.className="vis-configuration vis-config-checkbox",o.checked=e,t!==void 0&&(o.checked=t,t!==e&&(typeof e=="object"?t!==e.enabled&&this.changedOptions.push({path:i,value:t}):this.changedOptions.push({path:i,value:t})));const r=this;o.onchange=function(){r._update(this.checked,i)};const A=this._makeLabel(i[i.length-1],i);this._makeItem(i,A,o)}_makeTextInput(e,t,i){const o=document.createElement("input");o.type="text",o.className="vis-configuration vis-config-text",o.value=t,t!==e&&this.changedOptions.push({path:i,value:t});const r=this;o.onchange=function(){r._update(this.value,i)};const A=this._makeLabel(i[i.length-1],i);this._makeItem(i,A,o)}_makeColorField(e,t,i){const o=e[1],r=document.createElement("div");t=t===void 0?o:t,t!=="none"?(r.className="vis-configuration vis-config-colorBlock",r.style.backgroundColor=t):r.className="vis-configuration vis-config-colorBlock none",t=t===void 0?o:t,r.onclick=()=>{this._showColorPicker(t,r,i)};const A=this._makeLabel(i[i.length-1],i);this._makeItem(i,A,r)}_showColorPicker(e,t,i){t.onclick=function(){},this.colorPicker.insertTo(t),this.colorPicker.show(),this.colorPicker.setColor(e),this.colorPicker.setUpdateCallback(o=>{const r="rgba("+o.r+","+o.g+","+o.b+","+o.a+")";t.style.backgroundColor=r,this._update(r,i)}),this.colorPicker.setCloseCallback(()=>{t.onclick=()=>{this._showColorPicker(e,t,i)}})}_handleObject(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,o=!1;const r=Qt(this.options);let A=!1;for(const I in e)if(Object.prototype.hasOwnProperty.call(e,I)){o=!0;const l=e[I],c=BC(t,I);if(typeof r=="function"&&(o=r(I,t),o===!1&&!et(l)&&typeof l!="string"&&typeof l!="boolean"&&l instanceof Object&&(this.allowCreation=!1,o=this._handleObject(l,c,!0),this.allowCreation=i===!1)),o!==!1){A=!0;const h=this._getValue(c);if(et(l))this._handleArray(l,h,c);else if(typeof l=="string")this._makeTextInput(l,h,c);else if(typeof l=="boolean")this._makeCheckbox(l,h,c);else if(l instanceof Object){if(!this.hideOption(t,I,this.moduleOptions))if(l.enabled!==void 0){const p=BC(c,"enabled"),m=this._getValue(p);if(m===!0){const y=this._makeLabel(I,c,!0);this._makeItem(c,y),A=this._handleObject(l,c)||A}else this._makeCheckbox(l,m,c)}else{const p=this._makeLabel(I,c,!0);this._makeItem(c,p),A=this._handleObject(l,c)||A}}else console.error("dont know how to handle",l,I,c)}}return A}_handleArray(e,t,i){typeof e[0]=="string"&&e[0]==="color"?(this._makeColorField(e,t,i),e[1]!==t&&this.changedOptions.push({path:i,value:t})):typeof e[0]=="string"?(this._makeDropdown(e,t,i),e[0]!==t&&this.changedOptions.push({path:i,value:t})):typeof e[0]=="number"&&(this._makeRange(e,t,i),e[0]!==t&&this.changedOptions.push({path:i,value:Number(t)}))}_update(e,t){const i=this._constructOptions(e,t);this.parent.body&&this.parent.body.emitter&&this.parent.body.emitter.emit&&this.parent.body.emitter.emit("configChange",i),this.initialized=!0,this.parent.setOptions(i)}_constructOptions(e,t){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},o=i;e=e==="true"?!0:e,e=e==="false"?!1:e;for(let r=0;rr-this.padding&&(l=!0),l?A=this.x-i:A=this.x,c?I=this.y-t:I=this.y}else I=this.y-t,I+t+this.padding>o&&(I=o-t-this.padding),Ir&&(A=r-i-this.padding),A\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",A=window.console&&(window.console.warn||window.console.log);return A&&A.call(window.console,i,r),n.apply(this,arguments)}}var r1=s1(function(n,e,t){for(var i=Object.keys(e),o=0;o1?e-1:0),i=1;i2)return ZC(I1(e[0],e[1]),...vi(e).call(e,2));const i=e[0],o=e[1];if(i instanceof Date&&o instanceof Date)return i.setTime(o.getTime()),i;for(const r of A8(o))Object.prototype.propertyIsEnumerable.call(o,r)&&(o[r]===C1?delete i[r]:i[r]!==null&&o[r]!==null&&typeof i[r]=="object"&&typeof o[r]=="object"&&!nt(i[r])&&!nt(o[r])?i[r]=ZC(i[r],o[r]):i[r]=l1(o[r]));return i}function l1(n){return nt(n)?ln(n).call(n,e=>l1(e)):typeof n=="object"&&n!==null?n instanceof Date?new Date(n.getTime()):ZC({},n):n}function c1(n){for(const e of xt(n))n[e]===C1?delete n[e]:typeof n[e]=="object"&&n[e]!==null&&c1(n[e])}function BC(){for(var n=arguments.length,e=new Array(n),t=0;t{const A=2091639*e+o*23283064365386963e-26;return e=t,t=i,i=A-(o=A|0)};return r.uint32=()=>r()*4294967296,r.fract53=()=>r()+(r()*2097152|0)*11102230246251565e-32,r.algorithm="Alea",r.seed=n,r.version="0.9",r}function DV(){const n=MV();let e=n(" "),t=n(" "),i=n(" ");for(let o=0;o>>0,o-=n,o*=n,n=o>>>0,o-=n,n+=o*4294967296}return(n>>>0)*23283064365386963e-26}}function zV(){const n=()=>{};return{on:n,off:n,destroy:n,emit:n,get(){return{set:n}}}}const Hd=typeof window<"u"?window.Hammer||TV:function(){return zV()};function Ri(n){var e;this._cleanupQueue=[],this.active=!1,this._dom={container:n,overlay:document.createElement("div")},this._dom.overlay.classList.add("vis-overlay"),this._dom.container.appendChild(this._dom.overlay),this._cleanupQueue.push(()=>{this._dom.overlay.parentNode.removeChild(this._dom.overlay)});const t=Hd(this._dom.overlay);t.on("tap",ge(e=this._onTapOverlay).call(e,this)),this._cleanupQueue.push(()=>{t.destroy()});const i=["tap","doubletap","press","pinch","pan","panstart","panmove","panend"];et(i).call(i,o=>{t.on(o,r=>{r.srcEvent.stopPropagation()})}),document&&document.body&&(this._onClick=o=>{kV(o.target,n)||this.deactivate()},document.body.addEventListener("click",this._onClick),this._cleanupQueue.push(()=>{document.body.removeEventListener("click",this._onClick)})),this._escListener=o=>{("key"in o?o.key==="Escape":o.keyCode===27)&&this.deactivate()}}my(Ri.prototype),Ri.current=null,Ri.prototype.destroy=function(){this.deactivate();for(const t of xo(n=Di(e=this._cleanupQueue).call(e,0)).call(n)){var n,e;t()}},Ri.prototype.activate=function(){Ri.current&&Ri.current.deactivate(),Ri.current=this,this.active=!0,this._dom.overlay.style.display="none",this._dom.container.classList.add("vis-active"),this.emit("change"),this.emit("activate"),document.body.addEventListener("keydown",this._escListener)},Ri.prototype.deactivate=function(){this.active=!1,this._dom.overlay.style.display="block",this._dom.container.classList.remove("vis-active"),document.body.removeEventListener("keydown",this._escListener),this.emit("change"),this.emit("deactivate")},Ri.prototype._onTapOverlay=function(n){this.activate(),n.srcEvent.stopPropagation()};function kV(n,e){for(;n;){if(n===e)return!0;n=n.parentNode}return!1}const RV=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i,_V=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,jV=/^rgb\( *(1?\d{1,2}|2[0-4]\d|25[0-5]) *, *(1?\d{1,2}|2[0-4]\d|25[0-5]) *, *(1?\d{1,2}|2[0-4]\d|25[0-5]) *\)$/i,ZV=/^rgba\( *(1?\d{1,2}|2[0-4]\d|25[0-5]) *, *(1?\d{1,2}|2[0-4]\d|25[0-5]) *, *(1?\d{1,2}|2[0-4]\d|25[0-5]) *, *([01]|0?\.\d+) *\)$/i;function Dg(n){if(n)for(;n.hasChildNodes()===!0;){const e=n.firstChild;e&&(Dg(e),n.removeChild(e))}}function Ds(n){return n instanceof String||typeof n=="string"}function d1(n){return typeof n=="object"&&n!==null}function zo(n,e,t,i){let o=!1;i===!0&&(o=e[t]===null&&n[t]!==void 0),o?delete n[t]:n[t]=e[t]}function u1(n,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;for(const i in n)if(e[i]!==void 0)if(e[i]===null||typeof e[i]!="object")zo(n,e,i,t);else{const o=n[i],r=e[i];d1(o)&&d1(r)&&u1(o,r,t)}}function Ms(n,e,t){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(nt(t))throw new TypeError("Arrays are not supported by deepExtend");for(let o=0;o3&&arguments[3]!==void 0?arguments[3]:!1;if(nt(t))throw new TypeError("Arrays are not supported by deepExtend");for(const o in t)if(Object.prototype.hasOwnProperty.call(t,o)&&!Tg(n).call(n,o))if(t[o]&&t[o].constructor===Object)e[o]===void 0&&(e[o]={}),e[o].constructor===Object?vt(e[o],t[o]):zo(e,t,o,i);else if(nt(t[o])){e[o]=[];for(let r=0;r2&&arguments[2]!==void 0?arguments[2]:!1,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)||t===!0)if(typeof e[r]=="object"&&e[r]!==null&&a0(e[r])===Object.prototype)n[r]===void 0?n[r]=vt({},e[r],t):typeof n[r]=="object"&&n[r]!==null&&a0(n[r])===Object.prototype?vt(n[r],e[r],t):zo(n,e,r,i);else if(nt(e[r])){var o;n[r]=vi(o=e[r]).call(o)}else zo(n,e,r,i);return n}function LC(n,e){return[...n,e]}function BV(n){return vi(n).call(n)}function PV(n){return n.getBoundingClientRect().left}function LV(n){return n.getBoundingClientRect().top}function Ye(n,e){if(nt(n)){const t=n.length;for(let i=0;i3&&arguments[3]!==void 0?arguments[3]:{};const o=function(y){return y!=null},r=function(y){return y!==null&&typeof y=="object"},A=function(y){for(const w in y)if(Object.prototype.hasOwnProperty.call(y,w))return!1;return!0};if(!r(n))throw new Error("Parameter mergeTarget must be an object");if(!r(e))throw new Error("Parameter options must be an object");if(!o(t))throw new Error("Parameter option must have a value");if(!r(i))throw new Error("Parameter globalOptions must be an object");const I=function(y,w,S){r(y[S])||(y[S]={});const x=w[S],O=y[S];for(const E in x)Object.prototype.hasOwnProperty.call(x,E)&&(O[E]=x[E])},l=e[t],h=r(i)&&!A(i)?i[t]:void 0,p=h?h.enabled:void 0;if(l===void 0)return;if(typeof l=="boolean"){r(n[t])||(n[t]={}),n[t].enabled=l;return}if(l===null&&!r(n[t]))if(o(h))n[t]=Og(h);else return;if(!r(l))return;let m=!0;l.enabled!==void 0?m=l.enabled:p!==void 0&&(m=h.enabled),I(n,e,t),n[t].enabled=m}const VV={linear(n){return n},easeInQuad(n){return n*n},easeOutQuad(n){return n*(2-n)},easeInOutQuad(n){return n<.5?2*n*n:-1+(4-2*n)*n},easeInCubic(n){return n*n*n},easeOutCubic(n){return--n*n*n+1},easeInOutCubic(n){return n<.5?4*n*n*n:(n-1)*(2*n-2)*(2*n-2)+1},easeInQuart(n){return n*n*n*n},easeOutQuart(n){return 1- --n*n*n*n},easeInOutQuart(n){return n<.5?8*n*n*n*n:1-8*--n*n*n*n},easeInQuint(n){return n*n*n*n*n},easeOutQuint(n){return 1+--n*n*n*n*n},easeInOutQuint(n){return n<.5?16*n*n*n*n*n:1+16*--n*n*n*n*n}};function zg(n,e){let t;nt(e)||(e=[e]);for(const i of n)if(i){t=i[e[0]];for(let o=1;o0&&arguments[0]!==void 0?arguments[0]:1;this.pixelRatio=e,this.generated=!1,this.centerCoordinates={x:289/2,y:289/2},this.r=289*.49,this.color={r:255,g:255,b:255,a:1},this.hueCircle=void 0,this.initialColor={r:255,g:255,b:255,a:1},this.previousColor=void 0,this.applied=!1,this.updateCallback=()=>{},this.closeCallback=()=>{},this._create()}insertTo(e){this.hammer!==void 0&&(this.hammer.destroy(),this.hammer=void 0),this.container=e,this.container.appendChild(this.frame),this._bindHammer(),this._setSize()}setUpdateCallback(e){if(typeof e=="function")this.updateCallback=e;else throw new Error("Function attempted to set as colorPicker update callback is not a function.")}setCloseCallback(e){if(typeof e=="function")this.closeCallback=e;else throw new Error("Function attempted to set as colorPicker closing callback is not a function.")}_isColorString(e){if(typeof e=="string")return UV[e]}setColor(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(e==="none")return;let i;const o=this._isColorString(e);if(o!==void 0&&(e=o),Ds(e)===!0){if(p1(e)===!0){const r=e.substr(4).substr(0,e.length-5).split(",");i={r:r[0],g:r[1],b:r[2],a:1}}else if(FV(e)===!0){const r=e.substr(5).substr(0,e.length-6).split(",");i={r:r[0],g:r[1],b:r[2],a:r[3]}}else if(f1(e)===!0){const r=Kd(e);i={r:r.r,g:r.g,b:r.b,a:1}}}else if(e instanceof Object&&e.r!==void 0&&e.g!==void 0&&e.b!==void 0){const r=e.a!==void 0?e.a:"1.0";i={r:e.r,g:e.g,b:e.b,a:r}}if(i===void 0)throw new Error("Unknown color passed to the colorPicker. Supported are strings: rgb, hex, rgba. Object: rgb ({r:r,g:g,b:b,[a:a]}). Supplied: "+ws(e));this._setColor(i,t)}show(){this.closeCallback!==void 0&&(this.closeCallback(),this.closeCallback=void 0),this.applied=!1,this.frame.style.display="block",this._generateHueCircle()}_hide(){(arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0)===!0&&(this.previousColor=Ft({},this.color)),this.applied===!0&&this.updateCallback(this.initialColor),this.frame.style.display="none",Mi(()=>{this.closeCallback!==void 0&&(this.closeCallback(),this.closeCallback=void 0)},0)}_save(){this.updateCallback(this.color),this.applied=!1,this._hide()}_apply(){this.applied=!0,this.updateCallback(this.color),this._updatePicker(this.color)}_loadLast(){this.previousColor!==void 0?this.setColor(this.previousColor,!1):alert("There is no last color to load...")}_setColor(e){(arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0)===!0&&(this.initialColor=Ft({},e)),this.color=e;const i=Sa(e.r,e.g,e.b),o=2*Math.PI,r=this.r*i.s,A=this.centerCoordinates.x+r*Math.sin(o*i.h),I=this.centerCoordinates.y+r*Math.cos(o*i.h);this.colorPickerSelector.style.left=A-.5*this.colorPickerSelector.clientWidth+"px",this.colorPickerSelector.style.top=I-.5*this.colorPickerSelector.clientHeight+"px",this._updatePicker(e)}_setOpacity(e){this.color.a=e/100,this._updatePicker(this.color)}_setBrightness(e){const t=Sa(this.color.r,this.color.g,this.color.b);t.v=e/100;const i=GC(t.h,t.s,t.v);i.a=this.color.a,this.color=i,this._updatePicker()}_updatePicker(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.color;const t=Sa(e.r,e.g,e.b),i=this.colorPickerCanvas.getContext("2d");this.pixelRation===void 0&&(this.pixelRatio=(window.devicePixelRatio||1)/(i.webkitBackingStorePixelRatio||i.mozBackingStorePixelRatio||i.msBackingStorePixelRatio||i.oBackingStorePixelRatio||i.backingStorePixelRatio||1)),i.setTransform(this.pixelRatio,0,0,this.pixelRatio,0,0);const o=this.colorPickerCanvas.clientWidth,r=this.colorPickerCanvas.clientHeight;i.clearRect(0,0,o,r),i.putImageData(this.hueCircle,0,0),i.fillStyle="rgba(0,0,0,"+(1-t.v)+")",i.circle(this.centerCoordinates.x,this.centerCoordinates.y,this.r),la(i).call(i),this.brightnessRange.value=100*t.v,this.opacityRange.value=100*e.a,this.initialColorDiv.style.backgroundColor="rgba("+this.initialColor.r+","+this.initialColor.g+","+this.initialColor.b+","+this.initialColor.a+")",this.newColorDiv.style.backgroundColor="rgba("+this.color.r+","+this.color.g+","+this.color.b+","+this.color.a+")"}_setSize(){this.colorPickerCanvas.style.width="100%",this.colorPickerCanvas.style.height="100%",this.colorPickerCanvas.width=289*this.pixelRatio,this.colorPickerCanvas.height=289*this.pixelRatio}_create(){var e,t,i,o;if(this.frame=document.createElement("div"),this.frame.className="vis-color-picker",this.colorPickerDiv=document.createElement("div"),this.colorPickerSelector=document.createElement("div"),this.colorPickerSelector.className="vis-selector",this.colorPickerDiv.appendChild(this.colorPickerSelector),this.colorPickerCanvas=document.createElement("canvas"),this.colorPickerDiv.appendChild(this.colorPickerCanvas),this.colorPickerCanvas.getContext){const A=this.colorPickerCanvas.getContext("2d");this.pixelRatio=(window.devicePixelRatio||1)/(A.webkitBackingStorePixelRatio||A.mozBackingStorePixelRatio||A.msBackingStorePixelRatio||A.oBackingStorePixelRatio||A.backingStorePixelRatio||1),this.colorPickerCanvas.getContext("2d").setTransform(this.pixelRatio,0,0,this.pixelRatio,0,0)}else{const A=document.createElement("DIV");A.style.color="red",A.style.fontWeight="bold",A.style.padding="10px",A.innerText="Error: your browser does not support HTML canvas",this.colorPickerCanvas.appendChild(A)}this.colorPickerDiv.className="vis-color",this.opacityDiv=document.createElement("div"),this.opacityDiv.className="vis-opacity",this.brightnessDiv=document.createElement("div"),this.brightnessDiv.className="vis-brightness",this.arrowDiv=document.createElement("div"),this.arrowDiv.className="vis-arrow",this.opacityRange=document.createElement("input");try{this.opacityRange.type="range",this.opacityRange.min="0",this.opacityRange.max="100"}catch{}this.opacityRange.value="100",this.opacityRange.className="vis-range",this.brightnessRange=document.createElement("input");try{this.brightnessRange.type="range",this.brightnessRange.min="0",this.brightnessRange.max="100"}catch{}this.brightnessRange.value="100",this.brightnessRange.className="vis-range",this.opacityDiv.appendChild(this.opacityRange),this.brightnessDiv.appendChild(this.brightnessRange);const r=this;this.opacityRange.onchange=function(){r._setOpacity(this.value)},this.opacityRange.oninput=function(){r._setOpacity(this.value)},this.brightnessRange.onchange=function(){r._setBrightness(this.value)},this.brightnessRange.oninput=function(){r._setBrightness(this.value)},this.brightnessLabel=document.createElement("div"),this.brightnessLabel.className="vis-label vis-brightness",this.brightnessLabel.innerText="brightness:",this.opacityLabel=document.createElement("div"),this.opacityLabel.className="vis-label vis-opacity",this.opacityLabel.innerText="opacity:",this.newColorDiv=document.createElement("div"),this.newColorDiv.className="vis-new-color",this.newColorDiv.innerText="new",this.initialColorDiv=document.createElement("div"),this.initialColorDiv.className="vis-initial-color",this.initialColorDiv.innerText="initial",this.cancelButton=document.createElement("div"),this.cancelButton.className="vis-button vis-cancel",this.cancelButton.innerText="cancel",this.cancelButton.onclick=ge(e=this._hide).call(e,this,!1),this.applyButton=document.createElement("div"),this.applyButton.className="vis-button vis-apply",this.applyButton.innerText="apply",this.applyButton.onclick=ge(t=this._apply).call(t,this),this.saveButton=document.createElement("div"),this.saveButton.className="vis-button vis-save",this.saveButton.innerText="save",this.saveButton.onclick=ge(i=this._save).call(i,this),this.loadButton=document.createElement("div"),this.loadButton.className="vis-button vis-load",this.loadButton.innerText="load last",this.loadButton.onclick=ge(o=this._loadLast).call(o,this),this.frame.appendChild(this.colorPickerDiv),this.frame.appendChild(this.arrowDiv),this.frame.appendChild(this.brightnessLabel),this.frame.appendChild(this.brightnessDiv),this.frame.appendChild(this.opacityLabel),this.frame.appendChild(this.opacityDiv),this.frame.appendChild(this.newColorDiv),this.frame.appendChild(this.initialColorDiv),this.frame.appendChild(this.cancelButton),this.frame.appendChild(this.applyButton),this.frame.appendChild(this.saveButton),this.frame.appendChild(this.loadButton)}_bindHammer(){this.drag={},this.pinch={},this.hammer=new Hd(this.colorPickerCanvas),this.hammer.get("pinch").set({enable:!0}),this.hammer.on("hammer.input",e=>{e.isFirst&&this._moveSelector(e)}),this.hammer.on("tap",e=>{this._moveSelector(e)}),this.hammer.on("panstart",e=>{this._moveSelector(e)}),this.hammer.on("panmove",e=>{this._moveSelector(e)}),this.hammer.on("panend",e=>{this._moveSelector(e)})}_generateHueCircle(){if(this.generated===!1){const e=this.colorPickerCanvas.getContext("2d");this.pixelRation===void 0&&(this.pixelRatio=(window.devicePixelRatio||1)/(e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1)),e.setTransform(this.pixelRatio,0,0,this.pixelRatio,0,0);const t=this.colorPickerCanvas.clientWidth,i=this.colorPickerCanvas.clientHeight;e.clearRect(0,0,t,i);let o,r,A,I;this.centerCoordinates={x:t*.5,y:i*.5},this.r=.49*t;const l=2*Math.PI/360,c=1/360,h=1/this.r;let p;for(A=0;A<360;A++)for(I=0;I3&&arguments[3]!==void 0?arguments[3]:1,r=arguments.length>4&&arguments[4]!==void 0?arguments[4]:()=>!1;this.parent=e,this.changedOptions=[],this.container=t,this.allowCreation=!1,this.hideOption=r,this.options={},this.initialized=!1,this.popupCounter=0,this.defaultOptions={enabled:!1,filter:!0,container:void 0,showButton:!0},Ft(this.options,this.defaultOptions),this.configureOptions=i,this.moduleOptions={},this.domElements=[],this.popupDiv={},this.popupLimit=5,this.popupHistory={},this.colorPicker=new YV(o),this.wrapper=void 0}setOptions(e){if(e!==void 0){this.popupHistory={},this._removePopup();let t=!0;if(typeof e=="string")this.options.filter=e;else if(nt(e))this.options.filter=e.join();else if(typeof e=="object"){if(e==null)throw new TypeError("options cannot be null");e.container!==void 0&&(this.options.container=e.container),Qt(e)!==void 0&&(this.options.filter=Qt(e)),e.showButton!==void 0&&(this.options.showButton=e.showButton),e.enabled!==void 0&&(t=e.enabled)}else typeof e=="boolean"?(this.options.filter=!0,t=e):typeof e=="function"&&(this.options.filter=e,t=!0);Qt(this.options)===!1&&(t=!1),this.options.enabled=t}this._clean()}setModuleOptions(e){this.moduleOptions=e,this.options.enabled===!0&&(this._clean(),this.options.container!==void 0&&(this.container=this.options.container),this._create())}_create(){this._clean(),this.changedOptions=[];const e=Qt(this.options);let t=0,i=!1;for(const o in this.configureOptions)Object.prototype.hasOwnProperty.call(this.configureOptions,o)&&(this.allowCreation=!1,i=!1,typeof e=="function"?(i=e(o,[]),i=i||this._handleObject(this.configureOptions[o],[o],!0)):(e===!0||Ct(e).call(e,o)!==-1)&&(i=!0),i!==!1&&(this.allowCreation=!0,t>0&&this._makeItem([]),this._makeHeader(o),this._handleObject(this.configureOptions[o],[o])),t++);this._makeButton(),this._push()}_push(){this.wrapper=document.createElement("div"),this.wrapper.className="vis-configuration-wrapper",this.container.appendChild(this.wrapper);for(let e=0;e1?t-1:0),o=1;o{r.appendChild(A)}),this.domElements.push(r),this.domElements.length}return 0}_makeHeader(e){const t=document.createElement("div");t.className="vis-configuration vis-config-header",t.innerText=e,this._makeItem([],t)}_makeLabel(e,t){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;const o=document.createElement("div");if(o.className="vis-configuration vis-config-label vis-config-s"+t.length,i===!0){for(;o.firstChild;)o.removeChild(o.firstChild);o.appendChild(Xd("i","b",e))}else o.innerText=e+":";return o}_makeDropdown(e,t,i){const o=document.createElement("select");o.className="vis-configuration vis-config-select";let r=0;t!==void 0&&Ct(e).call(e,t)!==-1&&(r=Ct(e).call(e,t));for(let l=0;lA&&A!==1&&(l.max=Math.ceil(t*1.2),h=l.max,c="range increased"),l.value=t):l.value=o;const p=document.createElement("input");p.className="vis-configuration vis-config-rangeinput",p.value=l.value;const m=this;l.onchange=function(){p.value=this.value,m._update(Number(this.value),i)},l.oninput=function(){p.value=this.value};const y=this._makeLabel(i[i.length-1],i),w=this._makeItem(i,y,l,p);c!==""&&this.popupHistory[w]!==h&&(this.popupHistory[w]=h,this._setupPopup(c,w))}_makeButton(){if(this.options.showButton===!0){const e=document.createElement("div");e.className="vis-configuration vis-config-button",e.innerText="generate options",e.onclick=()=>{this._printOptions()},e.onmouseover=()=>{e.className="vis-configuration vis-config-button hover"},e.onmouseout=()=>{e.className="vis-configuration vis-config-button"},this.optionsContainer=document.createElement("div"),this.optionsContainer.className="vis-configuration vis-config-option-container",this.domElements.push(this.optionsContainer),this.domElements.push(e)}}_setupPopup(e,t){if(this.initialized===!0&&this.allowCreation===!0&&this.popupCounter{this._removePopup()},this.popupCounter+=1,this.popupDiv={html:i,index:t}}}_removePopup(){this.popupDiv.html!==void 0&&(this.popupDiv.html.parentNode.removeChild(this.popupDiv.html),clearTimeout(this.popupDiv.hideTimeout),clearTimeout(this.popupDiv.deleteTimeout),this.popupDiv={})}_showPopupIfNeeded(){if(this.popupDiv.html!==void 0){const t=this.domElements[this.popupDiv.index].getBoundingClientRect();this.popupDiv.html.style.left=t.left+"px",this.popupDiv.html.style.top=t.top-30+"px",document.body.appendChild(this.popupDiv.html),this.popupDiv.hideTimeout=Mi(()=>{this.popupDiv.html.style.opacity=0},1500),this.popupDiv.deleteTimeout=Mi(()=>{this._removePopup()},1800)}}_makeCheckbox(e,t,i){const o=document.createElement("input");o.type="checkbox",o.className="vis-configuration vis-config-checkbox",o.checked=e,t!==void 0&&(o.checked=t,t!==e&&(typeof e=="object"?t!==e.enabled&&this.changedOptions.push({path:i,value:t}):this.changedOptions.push({path:i,value:t})));const r=this;o.onchange=function(){r._update(this.checked,i)};const A=this._makeLabel(i[i.length-1],i);this._makeItem(i,A,o)}_makeTextInput(e,t,i){const o=document.createElement("input");o.type="text",o.className="vis-configuration vis-config-text",o.value=t,t!==e&&this.changedOptions.push({path:i,value:t});const r=this;o.onchange=function(){r._update(this.value,i)};const A=this._makeLabel(i[i.length-1],i);this._makeItem(i,A,o)}_makeColorField(e,t,i){const o=e[1],r=document.createElement("div");t=t===void 0?o:t,t!=="none"?(r.className="vis-configuration vis-config-colorBlock",r.style.backgroundColor=t):r.className="vis-configuration vis-config-colorBlock none",t=t===void 0?o:t,r.onclick=()=>{this._showColorPicker(t,r,i)};const A=this._makeLabel(i[i.length-1],i);this._makeItem(i,A,r)}_showColorPicker(e,t,i){t.onclick=function(){},this.colorPicker.insertTo(t),this.colorPicker.show(),this.colorPicker.setColor(e),this.colorPicker.setUpdateCallback(o=>{const r="rgba("+o.r+","+o.g+","+o.b+","+o.a+")";t.style.backgroundColor=r,this._update(r,i)}),this.colorPicker.setCloseCallback(()=>{t.onclick=()=>{this._showColorPicker(e,t,i)}})}_handleObject(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,o=!1;const r=Qt(this.options);let A=!1;for(const I in e)if(Object.prototype.hasOwnProperty.call(e,I)){o=!0;const l=e[I],c=LC(t,I);if(typeof r=="function"&&(o=r(I,t),o===!1&&!nt(l)&&typeof l!="string"&&typeof l!="boolean"&&l instanceof Object&&(this.allowCreation=!1,o=this._handleObject(l,c,!0),this.allowCreation=i===!1)),o!==!1){A=!0;const h=this._getValue(c);if(nt(l))this._handleArray(l,h,c);else if(typeof l=="string")this._makeTextInput(l,h,c);else if(typeof l=="boolean")this._makeCheckbox(l,h,c);else if(l instanceof Object){if(!this.hideOption(t,I,this.moduleOptions))if(l.enabled!==void 0){const p=LC(c,"enabled"),m=this._getValue(p);if(m===!0){const y=this._makeLabel(I,c,!0);this._makeItem(c,y),A=this._handleObject(l,c)||A}else this._makeCheckbox(l,m,c)}else{const p=this._makeLabel(I,c,!0);this._makeItem(c,p),A=this._handleObject(l,c)||A}}else console.error("dont know how to handle",l,I,c)}}return A}_handleArray(e,t,i){typeof e[0]=="string"&&e[0]==="color"?(this._makeColorField(e,t,i),e[1]!==t&&this.changedOptions.push({path:i,value:t})):typeof e[0]=="string"?(this._makeDropdown(e,t,i),e[0]!==t&&this.changedOptions.push({path:i,value:t})):typeof e[0]=="number"&&(this._makeRange(e,t,i),e[0]!==t&&this.changedOptions.push({path:i,value:Number(t)}))}_update(e,t){const i=this._constructOptions(e,t);this.parent.body&&this.parent.body.emitter&&this.parent.body.emitter.emit&&this.parent.body.emitter.emit("configChange",i),this.initialized=!0,this.parent.setOptions(i)}_constructOptions(e,t){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},o=i;e=e==="true"?!0:e,e=e==="false"?!1:e;for(let r=0;rr-this.padding&&(l=!0),l?A=this.x-i:A=this.x,c?I=this.y-t:I=this.y}else I=this.y-t,I+t+this.padding>o&&(I=o-t-this.padding),Ir&&(A=r-i-this.padding),Ar.distance?l=" in "+Gt.printLocation(o.path,e,"")+"Perhaps it was misplaced? Matching option found at: "+Gt.printLocation(r.path,r.closestMatch,""):o.distance<=A?l='. Did you mean "'+o.closestMatch+'"?'+Gt.printLocation(o.path,e):l=". Did you mean one of these: "+Gt.print(wt(t))+Gt.printLocation(i,e),console.error('%cUnknown option detected: "'+e+'"'+l,Xd),Sa=!0}static findInOptions(e,t,i){let o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,r=1e9,A="",I=[];const l=e.toLowerCase();let c;for(const p in t){let m;if(t[p].__type__!==void 0&&o===!0){const y=Gt.findInOptions(e,t[p],BC(i,p));r>y.distance&&(A=y.closestMatch,I=y.path,r=y.distance,c=y.indexMatch)}else{var h;at(h=p.toLowerCase()).call(h,l)!==-1&&(c=p),m=Gt.levenshteinDistance(e,p),r>m&&(A=p,I=BV(i),r=m)}}return{closestMatch:A,path:I,distance:r,indexMatch:c}}static printLocation(e,t){let o=` +`:r.distance<=I&&o.distance>r.distance?l=" in "+Lt.printLocation(o.path,e,"")+"Perhaps it was misplaced? Matching option found at: "+Lt.printLocation(r.path,r.closestMatch,""):o.distance<=A?l='. Did you mean "'+o.closestMatch+'"?'+Lt.printLocation(o.path,e):l=". Did you mean one of these: "+Lt.print(xt(t))+Lt.printLocation(i,e),console.error('%cUnknown option detected: "'+e+'"'+l,$d),Ea=!0}static findInOptions(e,t,i){let o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,r=1e9,A="",I=[];const l=e.toLowerCase();let c;for(const p in t){let m;if(t[p].__type__!==void 0&&o===!0){const y=Lt.findInOptions(e,t[p],LC(i,p));r>y.distance&&(A=y.closestMatch,I=y.path,r=y.distance,c=y.indexMatch)}else{var h;Ct(h=p.toLowerCase()).call(h,l)!==-1&&(c=p),m=Lt.levenshteinDistance(e,p),r>m&&(A=p,I=BV(i),r=m)}}return{closestMatch:A,path:I,distance:r,indexMatch:c}}static printLocation(e,t){let o=` `+(arguments.length>2&&arguments[2]!==void 0?arguments[2]:`Problem value found at: `)+`options = { @@ -712,16 +712,16 @@ input.vis-configuration.vis-config-range:focus::-ms-fill-upper { `;for(let r=0;r":!0,"--":!0},zg="",zs=0,Fe="",De="",zn=xn.NULL;function eU(){zs=0,Fe=zg.charAt(0)}function An(){zs++,Fe=zg.charAt(zs)}function ks(){return zg.charAt(zs+1)}function b1(n){var e=n.charCodeAt(0);return e<47?e===35||e===46:e<59?e>47:e<91?e>64:e<96?e===95:e<123?e>96:!1}function kg(n,e){if(n||(n={}),e)for(var t in e)e.hasOwnProperty(t)&&(n[t]=e[t]);return n}function tU(n,e,t){for(var i=e.split("."),o=n;i.length;){var r=i.shift();i.length?(o[r]||(o[r]={}),o=o[r]):o[r]=t}}function w1(n,e){for(var t,i,o=null,r=[n],A=n;A.parent;)r.push(A.parent),A=A.parent;if(A.nodes){for(t=0,i=A.nodes.length;t=0;t--){var I,l=r[t];l.nodes||(l.nodes=[]),at(I=l.nodes).call(I,o)===-1&&l.nodes.push(o)}e.attr&&(o.attr=kg(o.attr,e.attr))}function nU(n,e){if(n.edges||(n.edges=[]),n.edges.push(e),n.edge){var t=kg({},n.edge);e.attr=kg(t,e.attr)}}function x1(n,e,t,i,o){var r={from:e,to:t,type:i};return n.edge&&(r.attr=kg({},n.edge)),r.attr=kg(r.attr||{},o),o!=null&&o.hasOwnProperty("arrows")&&o.arrows!=null&&(r.arrows={to:{enabled:!0,type:o.arrows.type}},o.arrows=null),r}function vt(){for(zn=xn.NULL,De="";Fe===" "||Fe===" "||Fe===` -`||Fe==="\r";)An();do{var n=!1;if(Fe==="#"){for(var e=zs-1;zg.charAt(e)===" "||zg.charAt(e)===" ";)e--;if(zg.charAt(e)===` -`||zg.charAt(e)===""){for(;Fe!=""&&Fe!=` -`;)An();n=!0}}if(Fe==="/"&&ks()==="/"){for(;Fe!=""&&Fe!=` -`;)An();n=!0}if(Fe==="/"&&ks()==="*"){for(;Fe!="";)if(Fe==="*"&&ks()==="/"){An(),An();break}else An();n=!0}for(;Fe===" "||Fe===" "||Fe===` -`||Fe==="\r";)An()}while(n);if(Fe===""){zn=xn.DELIMITER;return}var t=Fe+ks();if(y1[t]){zn=xn.DELIMITER,De=t,An(),An();return}if(y1[Fe]){zn=xn.DELIMITER,De=Fe,An();return}if(b1(Fe)||Fe==="-"){for(De+=Fe,An();b1(Fe);)De+=Fe,An();De==="false"?De=!1:De==="true"?De=!0:isNaN(Number(De))||(De=Number(De)),zn=xn.IDENTIFIER;return}if(Fe==='"'){for(An();Fe!=""&&(Fe!='"'||Fe==='"'&&ks()==='"');)Fe==='"'?(De+=Fe,An()):Fe==="\\"&&ks()==="n"?(De+=` -`,An()):De+=Fe,An();if(Fe!='"')throw Sn('End of string " expected');An(),zn=xn.IDENTIFIER;return}for(zn=xn.UNKNOWN;Fe!="";)De+=Fe,An();throw new SyntaxError('Syntax error in part "'+O1(De,30)+'"')}function iU(){var n={};if(eU(),vt(),De==="strict"&&(n.strict=!0,vt()),(De==="graph"||De==="digraph")&&(n.type=De,vt()),zn===xn.IDENTIFIER&&(n.id=De,vt()),De!="{")throw Sn("Angle bracket { expected");if(vt(),S1(n),De!="}")throw Sn("Angle bracket } expected");if(vt(),De!=="")throw Sn("End of file expected");return vt(),delete n.node,delete n.edge,delete n.graph,n}function S1(n){for(;De!==""&&De!="}";)gU(n),De===";"&&vt()}function gU(n){var e=E1(n);if(e){T1(n,e);return}var t=oU(n);if(!t){if(zn!=xn.IDENTIFIER)throw Sn("Identifier expected");var i=De;if(vt(),De==="="){if(vt(),zn!=xn.IDENTIFIER)throw Sn("Identifier expected");n[i]=De,vt()}else sU(n,i)}}function E1(n){var e=null;if(De==="subgraph"&&(e={},e.type="subgraph",vt(),zn===xn.IDENTIFIER&&(e.id=De,vt())),De==="{"){if(vt(),e||(e={}),e.parent=n,e.node=n.node,e.edge=n.edge,e.graph=n.graph,S1(e),De!="}")throw Sn("Angle bracket } expected");vt(),delete e.node,delete e.edge,delete e.graph,delete e.parent,n.subgraphs||(n.subgraphs=[]),n.subgraphs.push(e)}return e}function oU(n){return De==="node"?(vt(),n.node=Ea(),"node"):De==="edge"?(vt(),n.edge=Ea(),"edge"):De==="graph"?(vt(),n.graph=Ea(),"graph"):null}function sU(n,e){var t={id:e},i=Ea();i&&(t.attr=i),w1(n,t),T1(n,e)}function T1(n,e){for(;De==="->"||De==="--";){var t,i=De;vt();var o=E1(n);if(o)t=o;else{if(zn!=xn.IDENTIFIER)throw Sn("Identifier or subgraph expected");t=De,w1(n,{id:t}),vt()}var r=Ea(),A=x1(n,e,t,i,r);nU(n,A),e=t}}function Ea(){for(var n,e=null,t={dashed:!0,solid:!1,dotted:[1,5]},i={dot:"circle",box:"box",crow:"crow",curve:"curve",icurve:"inv_curve",normal:"triangle",inv:"inv_triangle",diamond:"diamond",tee:"bar",vee:"vee"},o=new Array,r=new Array;De==="[";){for(vt(),e={};De!==""&&De!="]";){if(zn!=xn.IDENTIFIER)throw Sn("Attribute name expected");var A=De;if(vt(),De!="=")throw Sn("Equal sign = expected");if(vt(),zn!=xn.IDENTIFIER)throw Sn("Attribute value expected");var I=De;A==="style"&&(I=t[I]);var l;A==="arrowhead"&&(l=i[I],A="arrows",I={to:{enabled:!0,type:l}}),A==="arrowtail"&&(l=i[I],A="arrows",I={from:{enabled:!0,type:l}}),o.push({attr:e,name:A,value:I}),r.push(A),vt(),De==","&&vt()}if(De!="]")throw Sn("Bracket ] expected");vt()}if(Eg(r).call(r,"dir")){var c={};for(c.arrows={},n=0;n"&&(I.arrows="to"),I};Je(o=e.edges).call(o,function(A){var I,l;if(A.from instanceof Object?I=A.from.nodes:I={id:A.from},A.to instanceof Object?l=A.to.nodes:l={id:A.to},A.from instanceof Object&&A.from.edges){var c;Je(c=A.from.edges).call(c,function(p){var m=r(p);t.edges.push(m)})}if(rU(I,l,function(p,m){var y=x1(t,p.id,m.id,A.type,A.attr),w=r(y);t.edges.push(w)}),A.to instanceof Object&&A.to.edges){var h;Je(h=A.to.edges).call(h,function(p){var m=r(p);t.edges.push(m)})}})}return e.attr&&(t.options=e.attr),t}function AU(n,e){var t;const i={edges:{inheritColor:!1},nodes:{fixed:!1,parseColor:!1}};e!=null&&(e.fixed!=null&&(i.nodes.fixed=e.fixed),e.parseColor!=null&&(i.nodes.parseColor=e.parseColor),e.inheritColor!=null&&(i.edges.inheritColor=e.inheritColor));const o=n.edges,r=cn(o).call(o,I=>{const l={from:I.source,id:I.id,to:I.target};return I.attributes!=null&&(l.attributes=I.attributes),I.label!=null&&(l.label=I.label),I.attributes!=null&&I.attributes.title!=null&&(l.title=I.attributes.title),I.type==="Directed"&&(l.arrows="to"),I.color&&i.edges.inheritColor===!1&&(l.color=I.color),l});return{nodes:cn(t=n.nodes).call(t,I=>{const l={id:I.id,fixed:i.nodes.fixed&&I.x!=null&&I.y!=null};return I.attributes!=null&&(l.attributes=I.attributes),I.label!=null&&(l.label=I.label),I.size!=null&&(l.size=I.size),I.attributes!=null&&I.attributes.title!=null&&(l.title=I.attributes.title),I.title!=null&&(l.title=I.title),I.x!=null&&(l.x=I.x),I.y!=null&&(l.y=I.y),I.color!=null&&(i.nodes.parseColor===!0?l.color=I.color:l.color={background:I.color,border:I.color,highlight:{background:I.color,border:I.color},hover:{background:I.color,border:I.color}}),l}),edges:r}}var CU=Object.freeze({__proto__:null,cn:{addDescription:"单击空白处放置新节点。",addEdge:"添加连接线",addNode:"添加节点",back:"返回",close:"關閉",createEdgeError:"无法将连接线连接到群集。",del:"删除选定",deleteClusterError:"无法删除群集。",edgeDescription:"单击某个节点并将该连接线拖动到另一个节点以连接它们。",edit:"编辑",editClusterError:"无法编辑群集。",editEdge:"编辑连接线",editEdgeDescription:"单击控制节点并将它们拖到节点上连接。",editNode:"编辑节点"},cs:{addDescription:"Kluknutím do prázdného prostoru můžete přidat nový vrchol.",addEdge:"Přidat hranu",addNode:"Přidat vrchol",back:"Zpět",close:"Zavřít",createEdgeError:"Nelze připojit hranu ke shluku.",del:"Smazat výběr",deleteClusterError:"Nelze mazat shluky.",edgeDescription:"Přetažením z jednoho vrcholu do druhého můžete spojit tyto vrcholy novou hranou.",edit:"Upravit",editClusterError:"Nelze upravovat shluky.",editEdge:"Upravit hranu",editEdgeDescription:"Přetažením kontrolního vrcholu hrany ji můžete připojit k jinému vrcholu.",editNode:"Upravit vrchol"},de:{addDescription:"Klicke auf eine freie Stelle, um einen neuen Knoten zu plazieren.",addEdge:"Kante hinzufügen",addNode:"Knoten hinzufügen",back:"Zurück",close:"Schließen",createEdgeError:"Es ist nicht möglich, Kanten mit Clustern zu verbinden.",del:"Lösche Auswahl",deleteClusterError:"Cluster können nicht gelöscht werden.",edgeDescription:"Klicke auf einen Knoten und ziehe die Kante zu einem anderen Knoten, um diese zu verbinden.",edit:"Editieren",editClusterError:"Cluster können nicht editiert werden.",editEdge:"Kante editieren",editEdgeDescription:"Klicke auf die Verbindungspunkte und ziehe diese auf einen Knoten, um sie zu verbinden.",editNode:"Knoten editieren"},en:{addDescription:"Click in an empty space to place a new node.",addEdge:"Add Edge",addNode:"Add Node",back:"Back",close:"Close",createEdgeError:"Cannot link edges to a cluster.",del:"Delete selected",deleteClusterError:"Clusters cannot be deleted.",edgeDescription:"Click on a node and drag the edge to another node to connect them.",edit:"Edit",editClusterError:"Clusters cannot be edited.",editEdge:"Edit Edge",editEdgeDescription:"Click on the control points and drag them to a node to connect to it.",editNode:"Edit Node"},es:{addDescription:"Haga clic en un lugar vacío para colocar un nuevo nodo.",addEdge:"Añadir arista",addNode:"Añadir nodo",back:"Atrás",close:"Cerrar",createEdgeError:"No se puede conectar una arista a un grupo.",del:"Eliminar selección",deleteClusterError:"No es posible eliminar grupos.",edgeDescription:"Haga clic en un nodo y arrastre la arista hacia otro nodo para conectarlos.",edit:"Editar",editClusterError:"No es posible editar grupos.",editEdge:"Editar arista",editEdgeDescription:"Haga clic en un punto de control y arrastrelo a un nodo para conectarlo.",editNode:"Editar nodo"},fr:{addDescription:"Cliquez dans un endroit vide pour placer un nœud.",addEdge:"Ajouter un lien",addNode:"Ajouter un nœud",back:"Retour",close:"Fermer",createEdgeError:"Impossible de créer un lien vers un cluster.",del:"Effacer la sélection",deleteClusterError:"Les clusters ne peuvent pas être effacés.",edgeDescription:"Cliquez sur un nœud et glissez le lien vers un autre nœud pour les connecter.",edit:"Éditer",editClusterError:"Les clusters ne peuvent pas être édités.",editEdge:"Éditer le lien",editEdgeDescription:"Cliquez sur les points de contrôle et glissez-les pour connecter un nœud.",editNode:"Éditer le nœud"},it:{addDescription:"Clicca per aggiungere un nuovo nodo",addEdge:"Aggiungi un vertice",addNode:"Aggiungi un nodo",back:"Indietro",close:"Chiudere",createEdgeError:"Non si possono collegare vertici ad un cluster",del:"Cancella la selezione",deleteClusterError:"I cluster non possono essere cancellati",edgeDescription:"Clicca su un nodo e trascinalo ad un altro nodo per connetterli.",edit:"Modifica",editClusterError:"I clusters non possono essere modificati.",editEdge:"Modifica il vertice",editEdgeDescription:"Clicca sui Punti di controllo e trascinali ad un nodo per connetterli.",editNode:"Modifica il nodo"},nl:{addDescription:"Klik op een leeg gebied om een nieuwe node te maken.",addEdge:"Link toevoegen",addNode:"Node toevoegen",back:"Terug",close:"Sluiten",createEdgeError:"Kan geen link maken naar een cluster.",del:"Selectie verwijderen",deleteClusterError:"Clusters kunnen niet worden verwijderd.",edgeDescription:"Klik op een node en sleep de link naar een andere node om ze te verbinden.",edit:"Wijzigen",editClusterError:"Clusters kunnen niet worden aangepast.",editEdge:"Link wijzigen",editEdgeDescription:"Klik op de verbindingspunten en sleep ze naar een node om daarmee te verbinden.",editNode:"Node wijzigen"},pt:{addDescription:"Clique em um espaço em branco para adicionar um novo nó",addEdge:"Adicionar aresta",addNode:"Adicionar nó",back:"Voltar",close:"Fechar",createEdgeError:"Não foi possível linkar arestas a um cluster.",del:"Remover selecionado",deleteClusterError:"Clusters não puderam ser removidos.",edgeDescription:"Clique em um nó e arraste a aresta até outro nó para conectá-los",edit:"Editar",editClusterError:"Clusters não puderam ser editados.",editEdge:"Editar aresta",editEdgeDescription:"Clique nos pontos de controle e os arraste para um nó para conectá-los",editNode:"Editar nó"},ru:{addDescription:"Кликните в свободное место, чтобы добавить новый узел.",addEdge:"Добавить ребро",addNode:"Добавить узел",back:"Назад",close:"Закрывать",createEdgeError:"Невозможно соединить ребра в кластер.",del:"Удалить выбранное",deleteClusterError:"Кластеры не могут быть удалены",edgeDescription:"Кликните на узел и протяните ребро к другому узлу, чтобы соединить их.",edit:"Редактировать",editClusterError:"Кластеры недоступны для редактирования.",editEdge:"Редактировать ребро",editEdgeDescription:"Кликните на контрольные точки и перетащите их в узел, чтобы подключиться к нему.",editNode:"Редактировать узел"},uk:{addDescription:"Kлікніть на вільне місце, щоб додати новий вузол.",addEdge:"Додати край",addNode:"Додати вузол",back:"Назад",close:"Закрити",createEdgeError:"Не можливо об'єднати краї в групу.",del:"Видалити обране",deleteClusterError:"Групи не можуть бути видалені.",edgeDescription:"Клікніть на вузол і перетягніть край до іншого вузла, щоб їх з'єднати.",edit:"Редагувати",editClusterError:"Групи недоступні для редагування.",editEdge:"Редагувати край",editEdgeDescription:"Клікніть на контрольні точки і перетягніть їх у вузол, щоб підключитися до нього.",editNode:"Редагувати вузол"}});function IU(n,e){try{const[i,o]=e.split(/[-_ /]/,2),r=i!=null?i.toLowerCase():null,A=o!=null?o.toUpperCase():null;if(r&&A){const I=r+"-"+A;if(Object.prototype.hasOwnProperty.call(n,I))return I;var t;console.warn(a0(t="Unknown variant ".concat(A," of language ")).call(t,r,"."))}if(r){const I=r;if(Object.prototype.hasOwnProperty.call(n,I))return I;console.warn("Unknown language ".concat(r))}return console.warn("Unknown locale ".concat(e,", falling back to English.")),"en"}catch(i){return console.error(i),console.warn("Unexpected error while normalizing locale ".concat(e,", falling back to English.")),"en"}}class lU{constructor(){this.NUM_ITERATIONS=4,this.image=new Image,this.canvas=document.createElement("canvas")}init(){if(this.initialized())return;this.src=this.image.src;const e=this.image.width,t=this.image.height;this.width=e,this.height=t;const i=Math.floor(t/2),o=Math.floor(t/4),r=Math.floor(t/8),A=Math.floor(t/16),I=Math.floor(e/2),l=Math.floor(e/4),c=Math.floor(e/8),h=Math.floor(e/16);this.canvas.width=3*l,this.canvas.height=i,this.coordinates=[[0,0,I,i],[I,0,l,o],[I,o,c,r],[5*c,o,h,A]],this._fillMipMap()}initialized(){return this.coordinates!==void 0}_fillMipMap(){const e=this.canvas.getContext("2d"),t=this.coordinates[0];e.drawImage(this.image,t[0],t[1],t[2],t[3]);for(let i=1;i2){t*=.5;let I=0;for(;t>2&&I=this.NUM_ITERATIONS&&(I=this.NUM_ITERATIONS-1);const l=this.coordinates[I];e.drawImage(this.canvas,l[0],l[1],l[2],l[3],i,o,r,A)}else e.drawImage(this.image,i,o,r,A)}}class cU{constructor(e){this.images={},this.imageBroken={},this.callback=e}_tryloadBrokenUrl(e,t,i){if(!(e===void 0||i===void 0)){if(t===void 0){console.warn("No broken url image defined");return}i.image.onerror=()=>{console.error("Could not load brokenImage:",t)},i.image.src=t}}_redrawWithImage(e){this.callback&&this.callback(e)}load(e,t){const i=this.images[e];if(i)return i;const o=new lU;return this.images[e]=o,o.image.onload=()=>{this._fixImageCoordinates(o.image),o.init(),this._redrawWithImage(o)},o.image.onerror=()=>{console.error("Could not load image:",e),this._tryloadBrokenUrl(e,t,o)},o.image.src=e,o}_fixImageCoordinates(e){e.width===0&&(document.body.appendChild(e),e.width=e.offsetWidth,e.height=e.offsetHeight,document.body.removeChild(e))}}var D1={exports:{}},dU=it,uU=dU(function(){if(typeof ArrayBuffer=="function"){var n=new ArrayBuffer(8);Object.isExtensible(n)&&Object.defineProperty(n,"a",{value:8})}}),hU=it,fU=yn,pU=Yi,M1=uU,LC=Object.isExtensible,mU=hU(function(){LC(1)}),vU=mU||M1?function(e){return!fU(e)||M1&&pU(e)==="ArrayBuffer"?!1:LC?LC(e):!0}:LC,yU=it,z1=!yU(function(){return Object.isExtensible(Object.preventExtensions({}))}),bU=ze,wU=gt,xU=Wr,SU=yn,Jd=gn,EU=Fn.f,k1=ta,TU=IC,eu=vU,OU=JA,NU=z1,R1=!1,Ji=OU("meta"),DU=0,tu=function(n){EU(n,Ji,{value:{objectID:"O"+DU++,weakData:{}}})},MU=function(n,e){if(!SU(n))return typeof n=="symbol"?n:(typeof n=="string"?"S":"P")+n;if(!Jd(n,Ji)){if(!eu(n))return"F";if(!e)return"E";tu(n)}return n[Ji].objectID},zU=function(n,e){if(!Jd(n,Ji)){if(!eu(n))return!0;if(!e)return!1;tu(n)}return n[Ji].weakData},kU=function(n){return NU&&R1&&eu(n)&&!Jd(n,Ji)&&tu(n),n},RU=function(){_U.enable=function(){},R1=!0;var n=k1.f,e=wU([].splice),t={};t[Ji]=1,n(t).length&&(k1.f=function(i){for(var o=n(i),r=0,A=o.length;rp;p++)if(y=O(n[p]),y&&P1(G1,y))return y;return new FC(!1)}c=rY(n,h)}for(w=r?n.next:c.next;!(S=nY(w,c)).done;){try{y=O(S.value)}catch(E){L1(c,"throw",E)}if(typeof y=="object"&&y&&P1(G1,y))return y}return new FC(!1)},CY=jt,IY=TypeError,iu=function(n,e){if(CY(e,n))return n;throw new IY("Incorrect invocation")},lY=ze,cY=_t,dY=GC,uY=it,hY=ls,fY=nu,pY=iu,mY=ln,vY=yn,yY=as,bY=hs,wY=Fn.f,xY=xg.forEach,SY=nn,F1=mo,EY=F1.set,TY=F1.getterFor,gu=function(n,e,t){var i=n.indexOf("Map")!==-1,o=n.indexOf("Weak")!==-1,r=i?"set":"add",A=cY[n],I=A&&A.prototype,l={},c;if(!SY||!mY(A)||!(o||I.forEach&&!uY(function(){new A().entries().next()})))c=t.getConstructor(e,n,i,r),dY.enable();else{c=e(function(m,y){EY(pY(m,h),{type:n,collection:new A}),yY(y)||fY(y,m[r],{that:m,AS_ENTRIES:i})});var h=c.prototype,p=TY(n);xY(["add","clear","delete","forEach","get","has","set","keys","values","entries"],function(m){var y=m==="add"||m==="set";m in I&&!(o&&m==="clear")&&hY(h,m,function(w,S){var x=p(this).collection;if(!y&&o&&!vY(w))return m==="get"?void 0:!1;var O=x[m](w===0?0:w,S);return y?this:O})}),o||wY(h,"size",{configurable:!0,get:function(){return p(this).collection.size}})}return bY(c,n,!1,!0),l[n]=c,lY({global:!0,forced:!0},l),o||t.setStrong(c,n,i),c},OY=na,ou=function(n,e,t){for(var i in e)t&&t.unsafe&&n[i]?n[i]=e[i]:OY(n,i,e[i],t);return n},NY=fi,DY=Hc,MY=Ft,zY=nn,V1=MY("species"),kY=function(n){var e=NY(n);zY&&e&&!e[V1]&&DY(e,V1,{configurable:!0,get:function(){return this}})},RY=ea,_Y=Hc,U1=ou,jY=Hr,ZY=iu,BY=as,PY=nu,LY=cd,VC=dd,GY=kY,Ta=nn,Y1=GC.fastKey,H1=mo,K1=H1.set,su=H1.getterFor,W1={getConstructor:function(n,e,t,i){var o=n(function(c,h){ZY(c,r),K1(c,{type:e,index:RY(null),first:void 0,last:void 0,size:0}),Ta||(c.size=0),BY(h)||PY(h,c[i],{that:c,AS_ENTRIES:t})}),r=o.prototype,A=su(e),I=function(c,h,p){var m=A(c),y=l(c,h),w,S;return y?y.value=p:(m.last=y={index:S=Y1(h,!0),key:h,value:p,previous:w=m.last,next:void 0,removed:!1},m.first||(m.first=y),w&&(w.next=y),Ta?m.size++:c.size++,S!=="F"&&(m.index[S]=y)),c},l=function(c,h){var p=A(c),m=Y1(h),y;if(m!=="F")return p.index[m];for(y=p.first;y;y=y.next)if(y.key===h)return y};return U1(r,{clear:function(){for(var h=this,p=A(h),m=p.index,y=p.first;y;)y.removed=!0,y.previous&&(y.previous=y.previous.next=void 0),delete m[y.index],y=y.next;p.first=p.last=void 0,Ta?p.size=0:h.size=0},delete:function(c){var h=this,p=A(h),m=l(h,c);if(m){var y=m.next,w=m.previous;delete p.index[m.index],m.removed=!0,w&&(w.next=y),y&&(y.previous=w),p.first===m&&(p.first=y),p.last===m&&(p.last=w),Ta?p.size--:h.size--}return!!m},forEach:function(h){for(var p=A(this),m=jY(h,arguments.length>1?arguments[1]:void 0),y;y=y?y.next:p.first;)for(m(y.value,y.key,this);y&&y.removed;)y=y.previous},has:function(h){return!!l(this,h)}}),U1(r,t?{get:function(h){var p=l(this,h);return p&&p.value},set:function(h,p){return I(this,h===0?0:h,p)}}:{add:function(h){return I(this,h=h===0?0:h,h)}}),Ta&&_Y(r,"size",{configurable:!0,get:function(){return A(this).size}}),o},setStrong:function(n,e,t){var i=e+" Iterator",o=su(e),r=su(i);LY(n,e,function(A,I){K1(this,{type:i,target:A,state:o(A),kind:I,last:void 0})},function(){for(var A=r(this),I=A.kind,l=A.last;l&&l.removed;)l=l.previous;return!A.target||!(A.last=l=l?l.next:A.state.first)?(A.target=void 0,VC(void 0,!0)):VC(I==="keys"?l.key:I==="values"?l.value:[l.key,l.value],!1)},t?"entries":"values",!t,!0),GY(e)}},FY=gu,VY=W1;FY("Map",function(n){return function(){return n(this,arguments.length?arguments[0]:void 0)}},VY);var ru=gt,UY=iC,YY=Oi,HY=Lr,KY=ru("".charAt),Q1=ru("".charCodeAt),WY=ru("".slice),QY=function(n){return function(e,t){var i=YY(HY(e)),o=UY(t),r=i.length,A,I;return o<0||o>=r?n?"":void 0:(A=Q1(i,o),A<55296||A>56319||o+1===r||(I=Q1(i,o+1))<56320||I>57343?n?KY(i,o):A:n?WY(i,o,o+2):(A-55296<<10)+(I-56320)+65536)}},XY={charAt:QY(!0)},$Y=XY.charAt,qY=Oi,X1=mo,JY=cd,$1=dd,q1="String Iterator",eH=X1.set,tH=X1.getterFor(q1);JY(String,"String",function(n){eH(this,{type:q1,string:qY(n),index:0})},function(){var e=tH(this),t=e.string,i=e.index,o;return i>=t.length?$1(void 0,!0):(o=$Y(t,i),e.index+=o.length,$1(o,!1))});var nH=st,iH=nH.Map,gH=iH,oH=gH,sH=oH,Oa=Ne(sH);class rH{constructor(){this.clear(),this._defaultIndex=0,this._groupIndex=0,this._defaultGroups=[{border:"#2B7CE9",background:"#97C2FC",highlight:{border:"#2B7CE9",background:"#D2E5FF"},hover:{border:"#2B7CE9",background:"#D2E5FF"}},{border:"#FFA500",background:"#FFFF00",highlight:{border:"#FFA500",background:"#FFFFA3"},hover:{border:"#FFA500",background:"#FFFFA3"}},{border:"#FA0A10",background:"#FB7E81",highlight:{border:"#FA0A10",background:"#FFAFB1"},hover:{border:"#FA0A10",background:"#FFAFB1"}},{border:"#41A906",background:"#7BE141",highlight:{border:"#41A906",background:"#A1EC76"},hover:{border:"#41A906",background:"#A1EC76"}},{border:"#E129F0",background:"#EB7DF4",highlight:{border:"#E129F0",background:"#F0B3F5"},hover:{border:"#E129F0",background:"#F0B3F5"}},{border:"#7C29F0",background:"#AD85E4",highlight:{border:"#7C29F0",background:"#D3BDF0"},hover:{border:"#7C29F0",background:"#D3BDF0"}},{border:"#C37F00",background:"#FFA807",highlight:{border:"#C37F00",background:"#FFCA66"},hover:{border:"#C37F00",background:"#FFCA66"}},{border:"#4220FB",background:"#6E6EFD",highlight:{border:"#4220FB",background:"#9B9BFD"},hover:{border:"#4220FB",background:"#9B9BFD"}},{border:"#FD5A77",background:"#FFC0CB",highlight:{border:"#FD5A77",background:"#FFD1D9"},hover:{border:"#FD5A77",background:"#FFD1D9"}},{border:"#4AD63A",background:"#C2FABC",highlight:{border:"#4AD63A",background:"#E6FFE3"},hover:{border:"#4AD63A",background:"#E6FFE3"}},{border:"#990000",background:"#EE0000",highlight:{border:"#BB0000",background:"#FF3333"},hover:{border:"#BB0000",background:"#FF3333"}},{border:"#FF6000",background:"#FF6000",highlight:{border:"#FF6000",background:"#FF6000"},hover:{border:"#FF6000",background:"#FF6000"}},{border:"#97C2FC",background:"#2B7CE9",highlight:{border:"#D2E5FF",background:"#2B7CE9"},hover:{border:"#D2E5FF",background:"#2B7CE9"}},{border:"#399605",background:"#255C03",highlight:{border:"#399605",background:"#255C03"},hover:{border:"#399605",background:"#255C03"}},{border:"#B70054",background:"#FF007E",highlight:{border:"#B70054",background:"#FF007E"},hover:{border:"#B70054",background:"#FF007E"}},{border:"#AD85E4",background:"#7C29F0",highlight:{border:"#D3BDF0",background:"#7C29F0"},hover:{border:"#D3BDF0",background:"#7C29F0"}},{border:"#4557FA",background:"#000EA1",highlight:{border:"#6E6EFD",background:"#000EA1"},hover:{border:"#6E6EFD",background:"#000EA1"}},{border:"#FFC0CB",background:"#FD5A77",highlight:{border:"#FFD1D9",background:"#FD5A77"},hover:{border:"#FFD1D9",background:"#FD5A77"}},{border:"#C2FABC",background:"#74D66A",highlight:{border:"#E6FFE3",background:"#74D66A"},hover:{border:"#E6FFE3",background:"#74D66A"}},{border:"#EE0000",background:"#990000",highlight:{border:"#FF3333",background:"#BB0000"},hover:{border:"#FF3333",background:"#BB0000"}}],this.options={},this.defaultOptions={useDefaultGroups:!0},Vt(this.options,this.defaultOptions)}setOptions(e){const t=["useDefaultGroups"];if(e!==void 0){for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)&&at(t).call(t,i)===-1){const o=e[i];this.add(i,o)}}}clear(){this._groups=new Oa,this._groupNames=[]}get(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,i=this._groups.get(e);if(i===void 0&&t)if(this.options.useDefaultGroups===!1&&this._groupNames.length>0){const o=this._groupIndex%this._groupNames.length;++this._groupIndex,i={},i.color=this._groups.get(this._groupNames[o]),this._groups.set(e,i)}else{const o=this._defaultIndex%this._defaultGroups.length;this._defaultIndex++,i={},i.color=this._defaultGroups[o],this._groups.set(e,i)}return i}add(e,t){return this._groups.has(e)||this._groupNames.push(e),this._groups.set(e,t),t}}var aH=ze;aH({target:"Number",stat:!0},{isNaN:function(e){return e!==e}});var AH=st,CH=AH.Number.isNaN,IH=CH,lH=IH,cH=lH,au=Ne(cH),dH=_t,uH=dH.isFinite,hH=Number.isFinite||function(e){return typeof e=="number"&&uH(e)},fH=ze,pH=hH;fH({target:"Number",stat:!0},{isFinite:pH});var mH=st,vH=mH.Number.isFinite,yH=vH,bH=yH,wH=bH,zo=Ne(wH),xH=ze,SH=xg.some,EH=ys,TH=EH("some");xH({target:"Array",proto:!0,forced:!TH},{some:function(e){return SH(this,e,arguments.length>1?arguments[1]:void 0)}});var OH=Wt,NH=OH("Array").some,DH=jt,MH=NH,Au=Array.prototype,zH=function(n){var e=n.some;return n===Au||DH(Au,n)&&e===Au.some?MH:e},kH=zH,RH=kH,_H=RH,J1=Ne(_H),jH=st,ZH=jH.Object.getOwnPropertySymbols,BH=ZH,PH=BH,LH=PH,_i=Ne(LH),ew={exports:{}},GH=ze,FH=it,VH=hi,tw=Zr.f,nw=nn,UH=!nw||FH(function(){tw(1)});GH({target:"Object",stat:!0,forced:UH,sham:!nw},{getOwnPropertyDescriptor:function(e,t){return tw(VH(e),t)}});var YH=st,iw=YH.Object,HH=ew.exports=function(e,t){return iw.getOwnPropertyDescriptor(e,t)};iw.getOwnPropertyDescriptor.sham&&(HH.sham=!0);var KH=ew.exports,WH=KH,QH=WH,XH=QH,ji=Ne(XH),$H=ze,qH=nn,JH=$b,e7=hi,t7=Zr,n7=$r;$H({target:"Object",stat:!0,sham:!qH},{getOwnPropertyDescriptors:function(e){for(var t=e7(e),i=t7.f,o=JH(t),r={},A=0,I,l;o.length>A;)l=i(t,I=o[A++]),l!==void 0&&n7(r,I,l);return r}});var i7=st,g7=i7.Object.getOwnPropertyDescriptors,o7=g7,s7=o7,r7=s7,Zi=Ne(r7),gw={exports:{}},a7=ze,A7=nn,ow=rC.f;a7({target:"Object",stat:!0,forced:Object.defineProperties!==ow,sham:!A7},{defineProperties:ow});var C7=st,sw=C7.Object,I7=gw.exports=function(e,t){return sw.defineProperties(e,t)};sw.defineProperties.sham&&(I7.sham=!0);var l7=gw.exports,c7=l7,d7=c7,u7=d7,Na=Ne(u7),rw={exports:{}},h7=ze,f7=nn,aw=Fn.f;h7({target:"Object",stat:!0,forced:Object.defineProperty!==aw,sham:!f7},{defineProperty:aw});var p7=st,Aw=p7.Object,m7=rw.exports=function(e,t,i){return Aw.defineProperty(e,t,i)};Aw.defineProperty.sham&&(m7.sham=!0);var v7=rw.exports,y7=v7,Cw=y7,b7=Cw,w7=b7,x7=w7,S7=x7,E7=S7,T7=Ne(E7),O7=Ft,N7=Fn.f,Iw=O7("metadata"),lw=Function.prototype;lw[Iw]===void 0&&N7(lw,Iw,{value:null});var D7=Zt;D7("asyncDispose");var M7=Zt;M7("dispose");var z7=Zt;z7("metadata");var k7=Wb,R7=k7,_7=fi,j7=gt,Cu=_7("Symbol"),Z7=Cu.keyFor,B7=j7(Cu.prototype.valueOf),cw=Cu.isRegisteredSymbol||function(e){try{return Z7(B7(e))!==void 0}catch{return!1}},P7=ze,L7=cw;P7({target:"Symbol",stat:!0},{isRegisteredSymbol:L7});for(var G7=Cs,dw=fi,F7=gt,V7=Vr,U7=Ft,UC=dw("Symbol"),uw=UC.isWellKnownSymbol,hw=dw("Object","getOwnPropertyNames"),Y7=F7(UC.prototype.valueOf),fw=G7("wks"),Iu=0,pw=hw(UC),H7=pw.length;Iu=0:I>l;l+=c)l in A&&(o=t(o,A[l],l,r));return o}},RK={left:kK(!1)},_K=_t,jK=Yi,ZK=jK(_K.process)==="process",BK=ze,PK=RK.left,LK=ys,bw=Fr,GK=ZK,FK=!GK&&bw>79&&bw<83,VK=FK||!LK("reduce");BK({target:"Array",proto:!0,forced:VK},{reduce:function(e){var t=arguments.length;return PK(this,e,t,t>1?arguments[1]:void 0)}});var UK=Wt,YK=UK("Array").reduce,HK=jt,KK=YK,lu=Array.prototype,WK=function(n){var e=n.reduce;return n===lu||HK(lu,n)&&e===lu.reduce?KK:e},QK=WK,XK=QK,$K=XK,cu=Ne($K),qK=wg,JK=Jn,eW=Pc,tW=Hr,ww=function(n,e,t,i,o,r,A,I){for(var l=o,c=0,h=A?tW(A,I):!1,p,m;c0&&qK(p)?(m=JK(p),l=ww(n,e,p,m,l,r-1)-1):(eW(l+1),n[l]=p),l++),c++;return l},nW=ww,iW=ze,gW=nW,oW=fo,sW=Gn,rW=Jn,aW=sC;iW({target:"Array",proto:!0},{flatMap:function(e){var t=sW(this),i=rW(t),o;return oW(e),o=aW(t,0),o.length=gW(o,t,t,i,0,1,e,arguments.length>1?arguments[1]:void 0),o}});var AW=Wt;AW("Array").flatMap;var CW=yw,Rs=Ne(CW),IW=gu,lW=W1;IW("Set",function(n){return function(){return n(this,arguments.length?arguments[0]:void 0)}},lW);var cW=st,dW=cW.Set,uW=dW,hW=uW,fW=hW,wi=Ne(fW),pW=Z1,mW=pW,vW=mW,yW=vW,bW=yW,wW=bW,xW=wW,SW=xW,EW=SW,TW=EW,du=Ne(TW),xw=By,OW=Math.floor,uu=function(n,e){var t=n.length,i=OW(t/2);return t<8?NW(n,e):DW(n,uu(xw(n,0,i),e),uu(xw(n,i),e),e)},NW=function(n,e){for(var t=n.length,i=1,o,r;i0;)n[r]=n[--r];r!==i++&&(n[r]=o)}return n},DW=function(n,e,t,i){for(var o=e.length,r=t.length,A=0,I=0;A3)){if(UW)return!0;if(zw)return zw<603;var n="",e,t,i,o;for(e=65;e<76;e++){switch(t=String.fromCharCode(e),e){case 66:case 69:case 70:case 72:i=3;break;case 68:case 71:i=4;break;default:i=2}for(o=0;o<47;o++)Rg.push({k:t+o,v:i})}for(Rg.sort(function(r,A){return A.v-r.v}),o=0;oNw(t)?1:-1}};BW({target:"Array",proto:!0,forced:QW},{sort:function(e){e!==void 0&&PW(e);var t=LW(this);if(Rw)return e===void 0?kw(t):kw(t,e);var i=[],o=Ow(t),r,A;for(A=0;A{i.flush()};const o=[{name:"flush",original:void 0}];if(t&&t.replace)for(let r=0;rthis.max&&this.flush(),this._timeout!=null&&(clearTimeout(this._timeout),this._timeout=null),this.queue.length>0&&typeof this.delay=="number"&&(this._timeout=Mi(()=>{this.flush()},this.delay))}flush(){var e,t;Je(e=Di(t=this._queue).call(t,0)).call(e,i=>{i.fn.apply(i.context||i.fn,i.args||[])})}}class WC{constructor(){$t(this,"_subscribers",{"*":[],add:[],remove:[],update:[]}),$t(this,"subscribe",WC.prototype.on),$t(this,"unsubscribe",WC.prototype.off)}_trigger(e,t,i){var o;if(e==="*")throw new Error("Cannot trigger event *");Je(o=[...this._subscribers[e],...this._subscribers["*"]]).call(o,r=>{r(e,t,i??null)})}on(e,t){typeof t=="function"&&this._subscribers[e].push(t)}off(e,t){var i;this._subscribers[e]=Qt(i=this._subscribers[e]).call(i,o=>o!==t)}}class ko{constructor(e){$t(this,"_pairs",void 0),this._pairs=e}*[Rs](){for(const[e,t]of this._pairs)yield[e,t]}*entries(){for(const[e,t]of this._pairs)yield[e,t]}*keys(){for(const[e]of this._pairs)yield e}*values(){for(const[,e]of this._pairs)yield e}toIdArray(){var e;return cn(e=[...this._pairs]).call(e,t=>t[0])}toItemArray(){var e;return cn(e=[...this._pairs]).call(e,t=>t[1])}toEntryArray(){return[...this._pairs]}toObjectMap(){const e=Tg(null);for(const[t,i]of this._pairs)e[t]=i;return e}toMap(){return new Oa(this._pairs)}toIdSet(){return new wi(this.toIdArray())}toItemSet(){return new wi(this.toItemArray())}cache(){return new ko([...this._pairs])}distinct(e){const t=new wi;for(const[i,o]of this._pairs)t.add(e(o,i));return t}filter(e){const t=this._pairs;return new ko({*[Rs](){for(const[i,o]of t)e(o,i)&&(yield[i,o])}})}forEach(e){for(const[t,i]of this._pairs)e(i,t)}map(e){const t=this._pairs;return new ko({*[Rs](){for(const[i,o]of t)yield[i,e(o,i)]}})}max(e){const t=du(this._pairs);let i=t.next();if(i.done)return null;let o=i.value[1],r=e(i.value[1],i.value[0]);for(;!(i=t.next()).done;){const[A,I]=i.value,l=e(I,A);l>r&&(r=l,o=I)}return o}min(e){const t=du(this._pairs);let i=t.next();if(i.done)return null;let o=i.value[1],r=e(i.value[1],i.value[0]);for(;!(i=t.next()).done;){const[A,I]=i.value,l=e(I,A);l{var t;return du(eg(t=[...this._pairs]).call(t,(i,o)=>{let[r,A]=i,[I,l]=o;return e(A,l,r,I)}))}})}}function VQ(n,e){return n[e]==null&&(n[e]=js()),n}class Zs extends WC{get idProp(){return this._idProp}constructor(e,t){super(),$t(this,"flush",void 0),$t(this,"length",void 0),$t(this,"_options",void 0),$t(this,"_data",void 0),$t(this,"_idProp",void 0),$t(this,"_queue",null),e&&!et(e)&&(t=e,e=[]),this._options=t||{},this._data=new Oa,this.length=0,this._idProp=this._options.fieldId||"id",e&&e.length&&this.add(e),this.setOptions(t)}setOptions(e){e&&e.queue!==void 0&&(e.queue===!1?this._queue&&(this._queue.destroy(),this._queue=null):(this._queue||(this._queue=yu.extend(this,{replace:["add","update","remove"]})),e.queue&&typeof e.queue=="object"&&this._queue.setOptions(e.queue)))}add(e,t){const i=[];let o;if(et(e)){const r=cn(e).call(e,A=>A[this._idProp]);if(J1(r).call(r,A=>this._data.has(A)))throw new Error("A duplicate id was found in the parameter array.");for(let A=0,I=e.length;A{const h=c[I];if(h!=null&&this._data.has(h)){const p=c,m=Vt({},this._data.get(h)),y=this._updateItem(p);o.push(y),A.push(p),r.push(m)}else{const p=this._addItem(c);i.push(p)}};if(et(e))for(let c=0,h=e.length;c{const A=this._data.get(r[this._idProp]);if(A==null)throw new Error("Updating non-existent items is not allowed.");return{oldData:A,update:r}})).call(i,r=>{let{oldData:A,update:I}=r;const l=A[this._idProp],c=OV(A,I);return this._data.set(l,c),{id:l,oldData:A,updatedData:c}});if(o.length){const r={items:cn(o).call(o,A=>A.id),oldData:cn(o).call(o,A=>A.oldData),data:cn(o).call(o,A=>A.updatedData)};return this._trigger("update",r,t),r.items}else return[]}get(e,t){let i,o,r;Bw(e)?(i=e,r=t):et(e)?(o=e,r=t):r=e;const A=r&&r.returnType==="Object"?"Object":"Array",I=r&&Qt(r),l=[];let c,h,p;if(i!=null)c=this._data.get(i),c&&I&&!I(c)&&(c=void 0);else if(o!=null)for(let w=0,S=o.length;w(o[r]=e[r],o),{})}_sort(e,t){if(typeof t=="string"){const i=t;eg(e).call(e,(o,r)=>{const A=o[i],I=r[i];return A>I?1:Ai)&&(t=r,i=A)}return t||null}min(e){let t=null,i=null;for(const r of HC(o=this._data).call(o)){var o;const A=r[e];typeof A=="number"&&(i==null||Ae.x&&n.tope.y}function XC(n){return typeof n=="string"&&n!==""}function Yw(n,e,t,i){let o=i.x,r=i.y;if(typeof i.distanceToBorder=="function"){const A=i.distanceToBorder(n,e),I=Math.sin(e)*A,l=Math.cos(e)*A;l===A?(o+=A,r=i.y):I===A?(o=i.x,r-=A):(o+=l,r-=I)}else i.shape.width>i.shape.height?(o=i.x+i.shape.width*.5,r=i.y-t):(o=i.x+t,r=i.y-i.shape.height*.5);return{x:o,y:r}}class hX{constructor(e){this.measureText=e,this.current=0,this.width=0,this.height=0,this.lines=[]}_add(e,t){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"normal";this.lines[e]===void 0&&(this.lines[e]={width:0,height:0,blocks:[]});let o=t;(t===void 0||t==="")&&(o=" ");const r=this.measureText(o,i),A=Vt({},HC(r));A.text=t,A.width=r.width,A.mod=i,(t===void 0||t==="")&&(A.width=0),this.lines[e].blocks.push(A),this.lines[e].width+=A.width}curWidth(){const e=this.lines[this.current];return e===void 0?0:e.width}append(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"normal";this._add(this.current,e,t)}newLine(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"normal";this._add(this.current,e,t),this.current++}determineLineHeights(){for(let e=0;ee&&(e=o.width),t+=o.height}this.width=e,this.height=t}removeEmptyBlocks(){const e=[];for(let t=0;t"://,""://,""://,"":/<\/b>/,"":/<\/i>/,"":/<\/code>/,"*":/\*/,_:/_/,"`":/`/,afterBold:/[^*]/,afterItal:/[^_]/,afterMono:/[^`]/};class Hw{constructor(e){this.text=e,this.bold=!1,this.ital=!1,this.mono=!1,this.spacing=!1,this.position=0,this.buffer="",this.modStack=[],this.blocks=[]}mod(){return this.modStack.length===0?"normal":this.modStack[0]}modName(){if(this.modStack.length===0)return"normal";if(this.modStack[0]==="mono")return"mono";if(this.bold&&this.ital)return"boldital";if(this.bold)return"bold";if(this.ital)return"ital"}emitBlock(){this.spacing&&(this.add(" "),this.spacing=!1),this.buffer.length>0&&(this.blocks.push({text:this.buffer,mod:this.modName()}),this.buffer="")}add(e){e===" "&&(this.spacing=!0),this.spacing&&(this.buffer+=" ",this.spacing=!1),e!=" "&&(this.buffer+=e)}parseWS(e){return/[ \t]/.test(e)?(this.mono?this.add(e):this.spacing=!0,!0):!1}setTag(e){this.emitBlock(),this[e]=!0,this.modStack.unshift(e)}unsetTag(e){this.emitBlock(),this[e]=!1,this.modStack.shift()}parseStartTag(e,t){return!this.mono&&!this[e]&&this.match(t)?(this.setTag(e),!0):!1}match(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;const[i,o]=this.prepareRegExp(e),r=i.test(this.text.substr(this.position,o));return r&&t&&(this.position+=o-1),r}parseEndTag(e,t,i){let o=this.mod()===e;return e==="mono"?o=o&&this.mono:o=o&&!this.mono,o&&this.match(t)?(i!==void 0?(this.position===this.text.length-1||this.match(i,!1))&&this.unsetTag(e):this.unsetTag(e),!0):!1}replace(e,t){return this.match(e)?(this.add(t),this.position+=length-1,!0):!1}prepareRegExp(e){let t,i;if(e instanceof RegExp)i=e,t=1;else{const o=fX[e];o!==void 0?i=o:i=new RegExp(e),t=e.length}return[i,t]}}class pX{constructor(e,t,i,o){this.ctx=e,this.parent=t,this.selected=i,this.hover=o;const r=(A,I)=>{if(A===void 0)return 0;const l=this.parent.getFormattingValues(e,i,o,I);let c=0;return A!==""&&(c=this.ctx.measureText(A).width),{width:c,values:l}};this.lines=new hX(r)}process(e){if(!XC(e))return this.lines.finalize();const t=this.parent.fontOptions;e=e.replace(/\r\n/g,` +`}static print(e){return ws(e).replace(/(")|(\[)|(\])|(,"__type__")/g,"").replace(/(,)/g,", ")}static levenshteinDistance(e,t){if(e.length===0)return t.length;if(t.length===0)return e.length;const i=[];let o;for(o=0;o<=t.length;o++)i[o]=[o];let r;for(r=0;r<=e.length;r++)i[0][r]=r;for(o=1;o<=t.length;o++)for(r=1;r<=e.length;r++)t.charAt(o-1)==e.charAt(r-1)?i[o][r]=i[o-1][r-1]:i[o][r]=Math.min(i[o-1][r-1]+1,Math.min(i[o][r-1]+1,i[o-1][r]+1));return i[t.length][e.length]}};const QV=Ri,XV=HV,zs=Hd,$V=KV,v1=$d,qV=WV;function JV(n){return kg=n,iU()}var y1={fontsize:"font.size",fontcolor:"font.color",labelfontcolor:"font.color",fontname:"font.face",color:["color.border","color.background"],fillcolor:"color.background",tooltip:"title",labeltooltip:"title"},qd=Og(y1);qd.color="color.color",qd.style="dashes";var xn={NULL:0,DELIMITER:1,IDENTIFIER:2,UNKNOWN:3},b1={"{":!0,"}":!0,"[":!0,"]":!0,";":!0,"=":!0,",":!0,"->":!0,"--":!0},kg="",ks=0,Ve="",Te="",zn=xn.NULL;function eU(){ks=0,Ve=kg.charAt(0)}function an(){ks++,Ve=kg.charAt(ks)}function Rs(){return kg.charAt(ks+1)}function w1(n){var e=n.charCodeAt(0);return e<47?e===35||e===46:e<59?e>47:e<91?e>64:e<96?e===95:e<123?e>96:!1}function Rg(n,e){if(n||(n={}),e)for(var t in e)e.hasOwnProperty(t)&&(n[t]=e[t]);return n}function tU(n,e,t){for(var i=e.split("."),o=n;i.length;){var r=i.shift();i.length?(o[r]||(o[r]={}),o=o[r]):o[r]=t}}function x1(n,e){for(var t,i,o=null,r=[n],A=n;A.parent;)r.push(A.parent),A=A.parent;if(A.nodes){for(t=0,i=A.nodes.length;t=0;t--){var I,l=r[t];l.nodes||(l.nodes=[]),Ct(I=l.nodes).call(I,o)===-1&&l.nodes.push(o)}e.attr&&(o.attr=Rg(o.attr,e.attr))}function nU(n,e){if(n.edges||(n.edges=[]),n.edges.push(e),n.edge){var t=Rg({},n.edge);e.attr=Rg(t,e.attr)}}function S1(n,e,t,i,o){var r={from:e,to:t,type:i};return n.edge&&(r.attr=Rg({},n.edge)),r.attr=Rg(r.attr||{},o),o!=null&&o.hasOwnProperty("arrows")&&o.arrows!=null&&(r.arrows={to:{enabled:!0,type:o.arrows.type}},o.arrows=null),r}function yt(){for(zn=xn.NULL,Te="";Ve===" "||Ve===" "||Ve===` +`||Ve==="\r";)an();do{var n=!1;if(Ve==="#"){for(var e=ks-1;kg.charAt(e)===" "||kg.charAt(e)===" ";)e--;if(kg.charAt(e)===` +`||kg.charAt(e)===""){for(;Ve!=""&&Ve!=` +`;)an();n=!0}}if(Ve==="/"&&Rs()==="/"){for(;Ve!=""&&Ve!=` +`;)an();n=!0}if(Ve==="/"&&Rs()==="*"){for(;Ve!="";)if(Ve==="*"&&Rs()==="/"){an(),an();break}else an();n=!0}for(;Ve===" "||Ve===" "||Ve===` +`||Ve==="\r";)an()}while(n);if(Ve===""){zn=xn.DELIMITER;return}var t=Ve+Rs();if(b1[t]){zn=xn.DELIMITER,Te=t,an(),an();return}if(b1[Ve]){zn=xn.DELIMITER,Te=Ve,an();return}if(w1(Ve)||Ve==="-"){for(Te+=Ve,an();w1(Ve);)Te+=Ve,an();Te==="false"?Te=!1:Te==="true"?Te=!0:isNaN(Number(Te))||(Te=Number(Te)),zn=xn.IDENTIFIER;return}if(Ve==='"'){for(an();Ve!=""&&(Ve!='"'||Ve==='"'&&Rs()==='"');)Ve==='"'?(Te+=Ve,an()):Ve==="\\"&&Rs()==="n"?(Te+=` +`,an()):Te+=Ve,an();if(Ve!='"')throw Sn('End of string " expected');an(),zn=xn.IDENTIFIER;return}for(zn=xn.UNKNOWN;Ve!="";)Te+=Ve,an();throw new SyntaxError('Syntax error in part "'+N1(Te,30)+'"')}function iU(){var n={};if(eU(),yt(),Te==="strict"&&(n.strict=!0,yt()),(Te==="graph"||Te==="digraph")&&(n.type=Te,yt()),zn===xn.IDENTIFIER&&(n.id=Te,yt()),Te!="{")throw Sn("Angle bracket { expected");if(yt(),E1(n),Te!="}")throw Sn("Angle bracket } expected");if(yt(),Te!=="")throw Sn("End of file expected");return yt(),delete n.node,delete n.edge,delete n.graph,n}function E1(n){for(;Te!==""&&Te!="}";)gU(n),Te===";"&&yt()}function gU(n){var e=T1(n);if(e){O1(n,e);return}var t=oU(n);if(!t){if(zn!=xn.IDENTIFIER)throw Sn("Identifier expected");var i=Te;if(yt(),Te==="="){if(yt(),zn!=xn.IDENTIFIER)throw Sn("Identifier expected");n[i]=Te,yt()}else sU(n,i)}}function T1(n){var e=null;if(Te==="subgraph"&&(e={},e.type="subgraph",yt(),zn===xn.IDENTIFIER&&(e.id=Te,yt())),Te==="{"){if(yt(),e||(e={}),e.parent=n,e.node=n.node,e.edge=n.edge,e.graph=n.graph,E1(e),Te!="}")throw Sn("Angle bracket } expected");yt(),delete e.node,delete e.edge,delete e.graph,delete e.parent,n.subgraphs||(n.subgraphs=[]),n.subgraphs.push(e)}return e}function oU(n){return Te==="node"?(yt(),n.node=Ta(),"node"):Te==="edge"?(yt(),n.edge=Ta(),"edge"):Te==="graph"?(yt(),n.graph=Ta(),"graph"):null}function sU(n,e){var t={id:e},i=Ta();i&&(t.attr=i),x1(n,t),O1(n,e)}function O1(n,e){for(;Te==="->"||Te==="--";){var t,i=Te;yt();var o=T1(n);if(o)t=o;else{if(zn!=xn.IDENTIFIER)throw Sn("Identifier or subgraph expected");t=Te,x1(n,{id:t}),yt()}var r=Ta(),A=S1(n,e,t,i,r);nU(n,A),e=t}}function Ta(){for(var n,e=null,t={dashed:!0,solid:!1,dotted:[1,5]},i={dot:"circle",box:"box",crow:"crow",curve:"curve",icurve:"inv_curve",normal:"triangle",inv:"inv_triangle",diamond:"diamond",tee:"bar",vee:"vee"},o=new Array,r=new Array;Te==="[";){for(yt(),e={};Te!==""&&Te!="]";){if(zn!=xn.IDENTIFIER)throw Sn("Attribute name expected");var A=Te;if(yt(),Te!="=")throw Sn("Equal sign = expected");if(yt(),zn!=xn.IDENTIFIER)throw Sn("Attribute value expected");var I=Te;A==="style"&&(I=t[I]);var l;A==="arrowhead"&&(l=i[I],A="arrows",I={to:{enabled:!0,type:l}}),A==="arrowtail"&&(l=i[I],A="arrows",I={from:{enabled:!0,type:l}}),o.push({attr:e,name:A,value:I}),r.push(A),yt(),Te==","&&yt()}if(Te!="]")throw Sn("Bracket ] expected");yt()}if(Tg(r).call(r,"dir")){var c={};for(c.arrows={},n=0;n"&&(I.arrows="to"),I};et(o=e.edges).call(o,function(A){var I,l;if(A.from instanceof Object?I=A.from.nodes:I={id:A.from},A.to instanceof Object?l=A.to.nodes:l={id:A.to},A.from instanceof Object&&A.from.edges){var c;et(c=A.from.edges).call(c,function(p){var m=r(p);t.edges.push(m)})}if(rU(I,l,function(p,m){var y=S1(t,p.id,m.id,A.type,A.attr),w=r(y);t.edges.push(w)}),A.to instanceof Object&&A.to.edges){var h;et(h=A.to.edges).call(h,function(p){var m=r(p);t.edges.push(m)})}})}return e.attr&&(t.options=e.attr),t}function AU(n,e){var t;const i={edges:{inheritColor:!1},nodes:{fixed:!1,parseColor:!1}};e!=null&&(e.fixed!=null&&(i.nodes.fixed=e.fixed),e.parseColor!=null&&(i.nodes.parseColor=e.parseColor),e.inheritColor!=null&&(i.edges.inheritColor=e.inheritColor));const o=n.edges,r=ln(o).call(o,I=>{const l={from:I.source,id:I.id,to:I.target};return I.attributes!=null&&(l.attributes=I.attributes),I.label!=null&&(l.label=I.label),I.attributes!=null&&I.attributes.title!=null&&(l.title=I.attributes.title),I.type==="Directed"&&(l.arrows="to"),I.color&&i.edges.inheritColor===!1&&(l.color=I.color),l});return{nodes:ln(t=n.nodes).call(t,I=>{const l={id:I.id,fixed:i.nodes.fixed&&I.x!=null&&I.y!=null};return I.attributes!=null&&(l.attributes=I.attributes),I.label!=null&&(l.label=I.label),I.size!=null&&(l.size=I.size),I.attributes!=null&&I.attributes.title!=null&&(l.title=I.attributes.title),I.title!=null&&(l.title=I.title),I.x!=null&&(l.x=I.x),I.y!=null&&(l.y=I.y),I.color!=null&&(i.nodes.parseColor===!0?l.color=I.color:l.color={background:I.color,border:I.color,highlight:{background:I.color,border:I.color},hover:{background:I.color,border:I.color}}),l}),edges:r}}var CU=Object.freeze({__proto__:null,cn:{addDescription:"单击空白处放置新节点。",addEdge:"添加连接线",addNode:"添加节点",back:"返回",close:"關閉",createEdgeError:"无法将连接线连接到群集。",del:"删除选定",deleteClusterError:"无法删除群集。",edgeDescription:"单击某个节点并将该连接线拖动到另一个节点以连接它们。",edit:"编辑",editClusterError:"无法编辑群集。",editEdge:"编辑连接线",editEdgeDescription:"单击控制节点并将它们拖到节点上连接。",editNode:"编辑节点"},cs:{addDescription:"Kluknutím do prázdného prostoru můžete přidat nový vrchol.",addEdge:"Přidat hranu",addNode:"Přidat vrchol",back:"Zpět",close:"Zavřít",createEdgeError:"Nelze připojit hranu ke shluku.",del:"Smazat výběr",deleteClusterError:"Nelze mazat shluky.",edgeDescription:"Přetažením z jednoho vrcholu do druhého můžete spojit tyto vrcholy novou hranou.",edit:"Upravit",editClusterError:"Nelze upravovat shluky.",editEdge:"Upravit hranu",editEdgeDescription:"Přetažením kontrolního vrcholu hrany ji můžete připojit k jinému vrcholu.",editNode:"Upravit vrchol"},de:{addDescription:"Klicke auf eine freie Stelle, um einen neuen Knoten zu plazieren.",addEdge:"Kante hinzufügen",addNode:"Knoten hinzufügen",back:"Zurück",close:"Schließen",createEdgeError:"Es ist nicht möglich, Kanten mit Clustern zu verbinden.",del:"Lösche Auswahl",deleteClusterError:"Cluster können nicht gelöscht werden.",edgeDescription:"Klicke auf einen Knoten und ziehe die Kante zu einem anderen Knoten, um diese zu verbinden.",edit:"Editieren",editClusterError:"Cluster können nicht editiert werden.",editEdge:"Kante editieren",editEdgeDescription:"Klicke auf die Verbindungspunkte und ziehe diese auf einen Knoten, um sie zu verbinden.",editNode:"Knoten editieren"},en:{addDescription:"Click in an empty space to place a new node.",addEdge:"Add Edge",addNode:"Add Node",back:"Back",close:"Close",createEdgeError:"Cannot link edges to a cluster.",del:"Delete selected",deleteClusterError:"Clusters cannot be deleted.",edgeDescription:"Click on a node and drag the edge to another node to connect them.",edit:"Edit",editClusterError:"Clusters cannot be edited.",editEdge:"Edit Edge",editEdgeDescription:"Click on the control points and drag them to a node to connect to it.",editNode:"Edit Node"},es:{addDescription:"Haga clic en un lugar vacío para colocar un nuevo nodo.",addEdge:"Añadir arista",addNode:"Añadir nodo",back:"Atrás",close:"Cerrar",createEdgeError:"No se puede conectar una arista a un grupo.",del:"Eliminar selección",deleteClusterError:"No es posible eliminar grupos.",edgeDescription:"Haga clic en un nodo y arrastre la arista hacia otro nodo para conectarlos.",edit:"Editar",editClusterError:"No es posible editar grupos.",editEdge:"Editar arista",editEdgeDescription:"Haga clic en un punto de control y arrastrelo a un nodo para conectarlo.",editNode:"Editar nodo"},fr:{addDescription:"Cliquez dans un endroit vide pour placer un nœud.",addEdge:"Ajouter un lien",addNode:"Ajouter un nœud",back:"Retour",close:"Fermer",createEdgeError:"Impossible de créer un lien vers un cluster.",del:"Effacer la sélection",deleteClusterError:"Les clusters ne peuvent pas être effacés.",edgeDescription:"Cliquez sur un nœud et glissez le lien vers un autre nœud pour les connecter.",edit:"Éditer",editClusterError:"Les clusters ne peuvent pas être édités.",editEdge:"Éditer le lien",editEdgeDescription:"Cliquez sur les points de contrôle et glissez-les pour connecter un nœud.",editNode:"Éditer le nœud"},it:{addDescription:"Clicca per aggiungere un nuovo nodo",addEdge:"Aggiungi un vertice",addNode:"Aggiungi un nodo",back:"Indietro",close:"Chiudere",createEdgeError:"Non si possono collegare vertici ad un cluster",del:"Cancella la selezione",deleteClusterError:"I cluster non possono essere cancellati",edgeDescription:"Clicca su un nodo e trascinalo ad un altro nodo per connetterli.",edit:"Modifica",editClusterError:"I clusters non possono essere modificati.",editEdge:"Modifica il vertice",editEdgeDescription:"Clicca sui Punti di controllo e trascinali ad un nodo per connetterli.",editNode:"Modifica il nodo"},nl:{addDescription:"Klik op een leeg gebied om een nieuwe node te maken.",addEdge:"Link toevoegen",addNode:"Node toevoegen",back:"Terug",close:"Sluiten",createEdgeError:"Kan geen link maken naar een cluster.",del:"Selectie verwijderen",deleteClusterError:"Clusters kunnen niet worden verwijderd.",edgeDescription:"Klik op een node en sleep de link naar een andere node om ze te verbinden.",edit:"Wijzigen",editClusterError:"Clusters kunnen niet worden aangepast.",editEdge:"Link wijzigen",editEdgeDescription:"Klik op de verbindingspunten en sleep ze naar een node om daarmee te verbinden.",editNode:"Node wijzigen"},pt:{addDescription:"Clique em um espaço em branco para adicionar um novo nó",addEdge:"Adicionar aresta",addNode:"Adicionar nó",back:"Voltar",close:"Fechar",createEdgeError:"Não foi possível linkar arestas a um cluster.",del:"Remover selecionado",deleteClusterError:"Clusters não puderam ser removidos.",edgeDescription:"Clique em um nó e arraste a aresta até outro nó para conectá-los",edit:"Editar",editClusterError:"Clusters não puderam ser editados.",editEdge:"Editar aresta",editEdgeDescription:"Clique nos pontos de controle e os arraste para um nó para conectá-los",editNode:"Editar nó"},ru:{addDescription:"Кликните в свободное место, чтобы добавить новый узел.",addEdge:"Добавить ребро",addNode:"Добавить узел",back:"Назад",close:"Закрывать",createEdgeError:"Невозможно соединить ребра в кластер.",del:"Удалить выбранное",deleteClusterError:"Кластеры не могут быть удалены",edgeDescription:"Кликните на узел и протяните ребро к другому узлу, чтобы соединить их.",edit:"Редактировать",editClusterError:"Кластеры недоступны для редактирования.",editEdge:"Редактировать ребро",editEdgeDescription:"Кликните на контрольные точки и перетащите их в узел, чтобы подключиться к нему.",editNode:"Редактировать узел"},uk:{addDescription:"Kлікніть на вільне місце, щоб додати новий вузол.",addEdge:"Додати край",addNode:"Додати вузол",back:"Назад",close:"Закрити",createEdgeError:"Не можливо об'єднати краї в групу.",del:"Видалити обране",deleteClusterError:"Групи не можуть бути видалені.",edgeDescription:"Клікніть на вузол і перетягніть край до іншого вузла, щоб їх з'єднати.",edit:"Редагувати",editClusterError:"Групи недоступні для редагування.",editEdge:"Редагувати край",editEdgeDescription:"Клікніть на контрольні точки і перетягніть їх у вузол, щоб підключитися до нього.",editNode:"Редагувати вузол"}});function IU(n,e){try{const[i,o]=e.split(/[-_ /]/,2),r=i!=null?i.toLowerCase():null,A=o!=null?o.toUpperCase():null;if(r&&A){const I=r+"-"+A;if(Object.prototype.hasOwnProperty.call(n,I))return I;var t;console.warn(A0(t="Unknown variant ".concat(A," of language ")).call(t,r,"."))}if(r){const I=r;if(Object.prototype.hasOwnProperty.call(n,I))return I;console.warn("Unknown language ".concat(r))}return console.warn("Unknown locale ".concat(e,", falling back to English.")),"en"}catch(i){return console.error(i),console.warn("Unexpected error while normalizing locale ".concat(e,", falling back to English.")),"en"}}class lU{constructor(){this.NUM_ITERATIONS=4,this.image=new Image,this.canvas=document.createElement("canvas")}init(){if(this.initialized())return;this.src=this.image.src;const e=this.image.width,t=this.image.height;this.width=e,this.height=t;const i=Math.floor(t/2),o=Math.floor(t/4),r=Math.floor(t/8),A=Math.floor(t/16),I=Math.floor(e/2),l=Math.floor(e/4),c=Math.floor(e/8),h=Math.floor(e/16);this.canvas.width=3*l,this.canvas.height=i,this.coordinates=[[0,0,I,i],[I,0,l,o],[I,o,c,r],[5*c,o,h,A]],this._fillMipMap()}initialized(){return this.coordinates!==void 0}_fillMipMap(){const e=this.canvas.getContext("2d"),t=this.coordinates[0];e.drawImage(this.image,t[0],t[1],t[2],t[3]);for(let i=1;i2){t*=.5;let I=0;for(;t>2&&I=this.NUM_ITERATIONS&&(I=this.NUM_ITERATIONS-1);const l=this.coordinates[I];e.drawImage(this.canvas,l[0],l[1],l[2],l[3],i,o,r,A)}else e.drawImage(this.image,i,o,r,A)}}class cU{constructor(e){this.images={},this.imageBroken={},this.callback=e}_tryloadBrokenUrl(e,t,i){if(!(e===void 0||i===void 0)){if(t===void 0){console.warn("No broken url image defined");return}i.image.onerror=()=>{console.error("Could not load brokenImage:",t)},i.image.src=t}}_redrawWithImage(e){this.callback&&this.callback(e)}load(e,t){const i=this.images[e];if(i)return i;const o=new lU;return this.images[e]=o,o.image.onload=()=>{this._fixImageCoordinates(o.image),o.init(),this._redrawWithImage(o)},o.image.onerror=()=>{console.error("Could not load image:",e),this._tryloadBrokenUrl(e,t,o)},o.image.src=e,o}_fixImageCoordinates(e){e.width===0&&(document.body.appendChild(e),e.width=e.offsetWidth,e.height=e.offsetHeight,document.body.removeChild(e))}}var M1={exports:{}},dU=ot,uU=dU(function(){if(typeof ArrayBuffer=="function"){var n=new ArrayBuffer(8);Object.isExtensible(n)&&Object.defineProperty(n,"a",{value:8})}}),hU=ot,fU=yn,pU=Hi,z1=uU,FC=Object.isExtensible,mU=hU(function(){FC(1)}),vU=mU||z1?function(e){return!fU(e)||z1&&pU(e)==="ArrayBuffer"?!1:FC?FC(e):!0}:FC,yU=ot,k1=!yU(function(){return Object.isExtensible(Object.preventExtensions({}))}),bU=Me,wU=st,xU=Qr,SU=yn,eu=gn,EU=Fn.f,R1=na,TU=cC,tu=vU,OU=tC,NU=k1,_1=!1,eg=OU("meta"),DU=0,nu=function(n){EU(n,eg,{value:{objectID:"O"+DU++,weakData:{}}})},MU=function(n,e){if(!SU(n))return typeof n=="symbol"?n:(typeof n=="string"?"S":"P")+n;if(!eu(n,eg)){if(!tu(n))return"F";if(!e)return"E";nu(n)}return n[eg].objectID},zU=function(n,e){if(!eu(n,eg)){if(!tu(n))return!0;if(!e)return!1;nu(n)}return n[eg].weakData},kU=function(n){return NU&&_1&&tu(n)&&!eu(n,eg)&&nu(n),n},RU=function(){_U.enable=function(){},_1=!0;var n=R1.f,e=wU([].splice),t={};t[eg]=1,n(t).length&&(R1.f=function(i){for(var o=n(i),r=0,A=o.length;rp;p++)if(y=O(n[p]),y&&L1(F1,y))return y;return new UC(!1)}c=rY(n,h)}for(w=r?n.next:c.next;!(S=nY(w,c)).done;){try{y=O(S.value)}catch(E){G1(c,"throw",E)}if(typeof y=="object"&&y&&L1(F1,y))return y}return new UC(!1)},CY=jt,IY=TypeError,gu=function(n,e){if(CY(e,n))return n;throw new IY("Incorrect invocation")},lY=Me,cY=_t,dY=VC,uY=ot,hY=cs,fY=iu,pY=gu,mY=In,vY=yn,yY=As,bY=fs,wY=Fn.f,xY=Sg.forEach,SY=nn,V1=vo,EY=V1.set,TY=V1.getterFor,ou=function(n,e,t){var i=n.indexOf("Map")!==-1,o=n.indexOf("Weak")!==-1,r=i?"set":"add",A=cY[n],I=A&&A.prototype,l={},c;if(!SY||!mY(A)||!(o||I.forEach&&!uY(function(){new A().entries().next()})))c=t.getConstructor(e,n,i,r),dY.enable();else{c=e(function(m,y){EY(pY(m,h),{type:n,collection:new A}),yY(y)||fY(y,m[r],{that:m,AS_ENTRIES:i})});var h=c.prototype,p=TY(n);xY(["add","clear","delete","forEach","get","has","set","keys","values","entries"],function(m){var y=m==="add"||m==="set";m in I&&!(o&&m==="clear")&&hY(h,m,function(w,S){var x=p(this).collection;if(!y&&o&&!vY(w))return m==="get"?void 0:!1;var O=x[m](w===0?0:w,S);return y?this:O})}),o||wY(h,"size",{configurable:!0,get:function(){return p(this).collection.size}})}return bY(c,n,!1,!0),l[n]=c,lY({global:!0,forced:!0},l),o||t.setStrong(c,n,i),c},OY=ia,su=function(n,e,t){for(var i in e)t&&t.unsafe&&n[i]?n[i]=e[i]:OY(n,i,e[i],t);return n},NY=fi,DY=Kc,MY=Gt,zY=nn,U1=MY("species"),kY=function(n){var e=NY(n);zY&&e&&!e[U1]&&DY(e,U1,{configurable:!0,get:function(){return this}})},RY=ta,_Y=Kc,Y1=su,jY=Kr,ZY=gu,BY=As,PY=iu,LY=dd,YC=ud,GY=kY,Oa=nn,H1=VC.fastKey,K1=vo,W1=K1.set,ru=K1.getterFor,Q1={getConstructor:function(n,e,t,i){var o=n(function(c,h){ZY(c,r),W1(c,{type:e,index:RY(null),first:void 0,last:void 0,size:0}),Oa||(c.size=0),BY(h)||PY(h,c[i],{that:c,AS_ENTRIES:t})}),r=o.prototype,A=ru(e),I=function(c,h,p){var m=A(c),y=l(c,h),w,S;return y?y.value=p:(m.last=y={index:S=H1(h,!0),key:h,value:p,previous:w=m.last,next:void 0,removed:!1},m.first||(m.first=y),w&&(w.next=y),Oa?m.size++:c.size++,S!=="F"&&(m.index[S]=y)),c},l=function(c,h){var p=A(c),m=H1(h),y;if(m!=="F")return p.index[m];for(y=p.first;y;y=y.next)if(y.key===h)return y};return Y1(r,{clear:function(){for(var h=this,p=A(h),m=p.index,y=p.first;y;)y.removed=!0,y.previous&&(y.previous=y.previous.next=void 0),delete m[y.index],y=y.next;p.first=p.last=void 0,Oa?p.size=0:h.size=0},delete:function(c){var h=this,p=A(h),m=l(h,c);if(m){var y=m.next,w=m.previous;delete p.index[m.index],m.removed=!0,w&&(w.next=y),y&&(y.previous=w),p.first===m&&(p.first=y),p.last===m&&(p.last=w),Oa?p.size--:h.size--}return!!m},forEach:function(h){for(var p=A(this),m=jY(h,arguments.length>1?arguments[1]:void 0),y;y=y?y.next:p.first;)for(m(y.value,y.key,this);y&&y.removed;)y=y.previous},has:function(h){return!!l(this,h)}}),Y1(r,t?{get:function(h){var p=l(this,h);return p&&p.value},set:function(h,p){return I(this,h===0?0:h,p)}}:{add:function(h){return I(this,h=h===0?0:h,h)}}),Oa&&_Y(r,"size",{configurable:!0,get:function(){return A(this).size}}),o},setStrong:function(n,e,t){var i=e+" Iterator",o=ru(e),r=ru(i);LY(n,e,function(A,I){W1(this,{type:i,target:A,state:o(A),kind:I,last:void 0})},function(){for(var A=r(this),I=A.kind,l=A.last;l&&l.removed;)l=l.previous;return!A.target||!(A.last=l=l?l.next:A.state.first)?(A.target=void 0,YC(void 0,!0)):YC(I==="keys"?l.key:I==="values"?l.value:[l.key,l.value],!1)},t?"entries":"values",!t,!0),GY(e)}},FY=ou,VY=Q1;FY("Map",function(n){return function(){return n(this,arguments.length?arguments[0]:void 0)}},VY);var au=st,UY=oC,YY=Oi,HY=Gr,KY=au("".charAt),X1=au("".charCodeAt),WY=au("".slice),QY=function(n){return function(e,t){var i=YY(HY(e)),o=UY(t),r=i.length,A,I;return o<0||o>=r?n?"":void 0:(A=X1(i,o),A<55296||A>56319||o+1===r||(I=X1(i,o+1))<56320||I>57343?n?KY(i,o):A:n?WY(i,o,o+2):(A-55296<<10)+(I-56320)+65536)}},XY={charAt:QY(!0)},$Y=XY.charAt,qY=Oi,$1=vo,JY=dd,q1=ud,J1="String Iterator",eH=$1.set,tH=$1.getterFor(J1);JY(String,"String",function(n){eH(this,{type:J1,string:qY(n),index:0})},function(){var e=tH(this),t=e.string,i=e.index,o;return i>=t.length?q1(void 0,!0):(o=$Y(t,i),e.index+=o.length,q1(o,!1))});var nH=at,iH=nH.Map,gH=iH,oH=gH,sH=oH,Na=Ee(sH);class rH{constructor(){this.clear(),this._defaultIndex=0,this._groupIndex=0,this._defaultGroups=[{border:"#2B7CE9",background:"#97C2FC",highlight:{border:"#2B7CE9",background:"#D2E5FF"},hover:{border:"#2B7CE9",background:"#D2E5FF"}},{border:"#FFA500",background:"#FFFF00",highlight:{border:"#FFA500",background:"#FFFFA3"},hover:{border:"#FFA500",background:"#FFFFA3"}},{border:"#FA0A10",background:"#FB7E81",highlight:{border:"#FA0A10",background:"#FFAFB1"},hover:{border:"#FA0A10",background:"#FFAFB1"}},{border:"#41A906",background:"#7BE141",highlight:{border:"#41A906",background:"#A1EC76"},hover:{border:"#41A906",background:"#A1EC76"}},{border:"#E129F0",background:"#EB7DF4",highlight:{border:"#E129F0",background:"#F0B3F5"},hover:{border:"#E129F0",background:"#F0B3F5"}},{border:"#7C29F0",background:"#AD85E4",highlight:{border:"#7C29F0",background:"#D3BDF0"},hover:{border:"#7C29F0",background:"#D3BDF0"}},{border:"#C37F00",background:"#FFA807",highlight:{border:"#C37F00",background:"#FFCA66"},hover:{border:"#C37F00",background:"#FFCA66"}},{border:"#4220FB",background:"#6E6EFD",highlight:{border:"#4220FB",background:"#9B9BFD"},hover:{border:"#4220FB",background:"#9B9BFD"}},{border:"#FD5A77",background:"#FFC0CB",highlight:{border:"#FD5A77",background:"#FFD1D9"},hover:{border:"#FD5A77",background:"#FFD1D9"}},{border:"#4AD63A",background:"#C2FABC",highlight:{border:"#4AD63A",background:"#E6FFE3"},hover:{border:"#4AD63A",background:"#E6FFE3"}},{border:"#990000",background:"#EE0000",highlight:{border:"#BB0000",background:"#FF3333"},hover:{border:"#BB0000",background:"#FF3333"}},{border:"#FF6000",background:"#FF6000",highlight:{border:"#FF6000",background:"#FF6000"},hover:{border:"#FF6000",background:"#FF6000"}},{border:"#97C2FC",background:"#2B7CE9",highlight:{border:"#D2E5FF",background:"#2B7CE9"},hover:{border:"#D2E5FF",background:"#2B7CE9"}},{border:"#399605",background:"#255C03",highlight:{border:"#399605",background:"#255C03"},hover:{border:"#399605",background:"#255C03"}},{border:"#B70054",background:"#FF007E",highlight:{border:"#B70054",background:"#FF007E"},hover:{border:"#B70054",background:"#FF007E"}},{border:"#AD85E4",background:"#7C29F0",highlight:{border:"#D3BDF0",background:"#7C29F0"},hover:{border:"#D3BDF0",background:"#7C29F0"}},{border:"#4557FA",background:"#000EA1",highlight:{border:"#6E6EFD",background:"#000EA1"},hover:{border:"#6E6EFD",background:"#000EA1"}},{border:"#FFC0CB",background:"#FD5A77",highlight:{border:"#FFD1D9",background:"#FD5A77"},hover:{border:"#FFD1D9",background:"#FD5A77"}},{border:"#C2FABC",background:"#74D66A",highlight:{border:"#E6FFE3",background:"#74D66A"},hover:{border:"#E6FFE3",background:"#74D66A"}},{border:"#EE0000",background:"#990000",highlight:{border:"#FF3333",background:"#BB0000"},hover:{border:"#FF3333",background:"#BB0000"}}],this.options={},this.defaultOptions={useDefaultGroups:!0},Ft(this.options,this.defaultOptions)}setOptions(e){const t=["useDefaultGroups"];if(e!==void 0){for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)&&Ct(t).call(t,i)===-1){const o=e[i];this.add(i,o)}}}clear(){this._groups=new Na,this._groupNames=[]}get(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,i=this._groups.get(e);if(i===void 0&&t)if(this.options.useDefaultGroups===!1&&this._groupNames.length>0){const o=this._groupIndex%this._groupNames.length;++this._groupIndex,i={},i.color=this._groups.get(this._groupNames[o]),this._groups.set(e,i)}else{const o=this._defaultIndex%this._defaultGroups.length;this._defaultIndex++,i={},i.color=this._defaultGroups[o],this._groups.set(e,i)}return i}add(e,t){return this._groups.has(e)||this._groupNames.push(e),this._groups.set(e,t),t}}var aH=Me;aH({target:"Number",stat:!0},{isNaN:function(e){return e!==e}});var AH=at,CH=AH.Number.isNaN,IH=CH,lH=IH,cH=lH,Au=Ee(cH),dH=_t,uH=dH.isFinite,hH=Number.isFinite||function(e){return typeof e=="number"&&uH(e)},fH=Me,pH=hH;fH({target:"Number",stat:!0},{isFinite:pH});var mH=at,vH=mH.Number.isFinite,yH=vH,bH=yH,wH=bH,ko=Ee(wH),xH=Me,SH=Sg.some,EH=bs,TH=EH("some");xH({target:"Array",proto:!0,forced:!TH},{some:function(e){return SH(this,e,arguments.length>1?arguments[1]:void 0)}});var OH=Wt,NH=OH("Array").some,DH=jt,MH=NH,Cu=Array.prototype,zH=function(n){var e=n.some;return n===Cu||DH(Cu,n)&&e===Cu.some?MH:e},kH=zH,RH=kH,_H=RH,ew=Ee(_H),jH=at,ZH=jH.Object.getOwnPropertySymbols,BH=ZH,PH=BH,LH=PH,_i=Ee(LH),tw={exports:{}},GH=Me,FH=ot,VH=hi,nw=Br.f,iw=nn,UH=!iw||FH(function(){nw(1)});GH({target:"Object",stat:!0,forced:UH,sham:!iw},{getOwnPropertyDescriptor:function(e,t){return nw(VH(e),t)}});var YH=at,gw=YH.Object,HH=tw.exports=function(e,t){return gw.getOwnPropertyDescriptor(e,t)};gw.getOwnPropertyDescriptor.sham&&(HH.sham=!0);var KH=tw.exports,WH=KH,QH=WH,XH=QH,ji=Ee(XH),$H=Me,qH=nn,JH=qb,e7=hi,t7=Br,n7=qr;$H({target:"Object",stat:!0,sham:!qH},{getOwnPropertyDescriptors:function(e){for(var t=e7(e),i=t7.f,o=JH(t),r={},A=0,I,l;o.length>A;)l=i(t,I=o[A++]),l!==void 0&&n7(r,I,l);return r}});var i7=at,g7=i7.Object.getOwnPropertyDescriptors,o7=g7,s7=o7,r7=s7,Zi=Ee(r7),ow={exports:{}},a7=Me,A7=nn,sw=AC.f;a7({target:"Object",stat:!0,forced:Object.defineProperties!==sw,sham:!A7},{defineProperties:sw});var C7=at,rw=C7.Object,I7=ow.exports=function(e,t){return rw.defineProperties(e,t)};rw.defineProperties.sham&&(I7.sham=!0);var l7=ow.exports,c7=l7,d7=c7,u7=d7,Da=Ee(u7),aw={exports:{}},h7=Me,f7=nn,Aw=Fn.f;h7({target:"Object",stat:!0,forced:Object.defineProperty!==Aw,sham:!f7},{defineProperty:Aw});var p7=at,Cw=p7.Object,m7=aw.exports=function(e,t,i){return Cw.defineProperty(e,t,i)};Cw.defineProperty.sham&&(m7.sham=!0);var v7=aw.exports,y7=v7,Iw=y7,b7=Iw,w7=b7,x7=w7,S7=x7,E7=S7,T7=Ee(E7),O7=Gt,N7=Fn.f,lw=O7("metadata"),cw=Function.prototype;cw[lw]===void 0&&N7(cw,lw,{value:null});var D7=Zt;D7("asyncDispose");var M7=Zt;M7("dispose");var z7=Zt;z7("metadata");var k7=Qb,R7=k7,_7=fi,j7=st,Iu=_7("Symbol"),Z7=Iu.keyFor,B7=j7(Iu.prototype.valueOf),dw=Iu.isRegisteredSymbol||function(e){try{return Z7(B7(e))!==void 0}catch{return!1}},P7=Me,L7=dw;P7({target:"Symbol",stat:!0},{isRegisteredSymbol:L7});for(var G7=Is,uw=fi,F7=st,V7=Ur,U7=Gt,HC=uw("Symbol"),hw=HC.isWellKnownSymbol,fw=uw("Object","getOwnPropertyNames"),Y7=F7(HC.prototype.valueOf),pw=G7("wks"),lu=0,mw=fw(HC),H7=mw.length;lu=0:I>l;l+=c)l in A&&(o=t(o,A[l],l,r));return o}},RK={left:kK(!1)},_K=_t,jK=Hi,ZK=jK(_K.process)==="process",BK=Me,PK=RK.left,LK=bs,ww=Vr,GK=ZK,FK=!GK&&ww>79&&ww<83,VK=FK||!LK("reduce");BK({target:"Array",proto:!0,forced:VK},{reduce:function(e){var t=arguments.length;return PK(this,e,t,t>1?arguments[1]:void 0)}});var UK=Wt,YK=UK("Array").reduce,HK=jt,KK=YK,cu=Array.prototype,WK=function(n){var e=n.reduce;return n===cu||HK(cu,n)&&e===cu.reduce?KK:e},QK=WK,XK=QK,$K=XK,du=Ee($K),qK=xg,JK=Jn,eW=Lc,tW=Kr,xw=function(n,e,t,i,o,r,A,I){for(var l=o,c=0,h=A?tW(A,I):!1,p,m;c0&&qK(p)?(m=JK(p),l=xw(n,e,p,m,l,r-1)-1):(eW(l+1),n[l]=p),l++),c++;return l},nW=xw,iW=Me,gW=nW,oW=po,sW=Gn,rW=Jn,aW=aC;iW({target:"Array",proto:!0},{flatMap:function(e){var t=sW(this),i=rW(t),o;return oW(e),o=aW(t,0),o.length=gW(o,t,t,i,0,1,e,arguments.length>1?arguments[1]:void 0),o}});var AW=Wt;AW("Array").flatMap;var CW=bw,_s=Ee(CW),IW=ou,lW=Q1;IW("Set",function(n){return function(){return n(this,arguments.length?arguments[0]:void 0)}},lW);var cW=at,dW=cW.Set,uW=dW,hW=uW,fW=hW,wi=Ee(fW),pW=B1,mW=pW,vW=mW,yW=vW,bW=yW,wW=bW,xW=wW,SW=xW,EW=SW,TW=EW,uu=Ee(TW),Sw=Py,OW=Math.floor,hu=function(n,e){var t=n.length,i=OW(t/2);return t<8?NW(n,e):DW(n,hu(Sw(n,0,i),e),hu(Sw(n,i),e),e)},NW=function(n,e){for(var t=n.length,i=1,o,r;i0;)n[r]=n[--r];r!==i++&&(n[r]=o)}return n},DW=function(n,e,t,i){for(var o=e.length,r=t.length,A=0,I=0;A3)){if(UW)return!0;if(kw)return kw<603;var n="",e,t,i,o;for(e=65;e<76;e++){switch(t=String.fromCharCode(e),e){case 66:case 69:case 70:case 72:i=3;break;case 68:case 71:i=4;break;default:i=2}for(o=0;o<47;o++)_g.push({k:t+o,v:i})}for(_g.sort(function(r,A){return A.v-r.v}),o=0;o<_g.length;o++)t=_g[o].k.charAt(0),n.charAt(n.length-1)!==t&&(n+=t);return n!=="DGBEFHACIJK"}}),QW=HW||!KW||!WW||!_w,XW=function(n){return function(e,t){return t===void 0?-1:e===void 0?1:n!==void 0?+n(e,t)||0:Dw(e)>Dw(t)?1:-1}};BW({target:"Array",proto:!0,forced:QW},{sort:function(e){e!==void 0&&PW(e);var t=LW(this);if(_w)return e===void 0?Rw(t):Rw(t,e);var i=[],o=Nw(t),r,A;for(A=0;A{i.flush()};const o=[{name:"flush",original:void 0}];if(t&&t.replace)for(let r=0;rthis.max&&this.flush(),this._timeout!=null&&(clearTimeout(this._timeout),this._timeout=null),this.queue.length>0&&typeof this.delay=="number"&&(this._timeout=Mi(()=>{this.flush()},this.delay))}flush(){var e,t;et(e=Di(t=this._queue).call(t,0)).call(e,i=>{i.fn.apply(i.context||i.fn,i.args||[])})}}class XC{constructor(){$t(this,"_subscribers",{"*":[],add:[],remove:[],update:[]}),$t(this,"subscribe",XC.prototype.on),$t(this,"unsubscribe",XC.prototype.off)}_trigger(e,t,i){var o;if(e==="*")throw new Error("Cannot trigger event *");et(o=[...this._subscribers[e],...this._subscribers["*"]]).call(o,r=>{r(e,t,i??null)})}on(e,t){typeof t=="function"&&this._subscribers[e].push(t)}off(e,t){var i;this._subscribers[e]=Qt(i=this._subscribers[e]).call(i,o=>o!==t)}}class Ro{constructor(e){$t(this,"_pairs",void 0),this._pairs=e}*[_s](){for(const[e,t]of this._pairs)yield[e,t]}*entries(){for(const[e,t]of this._pairs)yield[e,t]}*keys(){for(const[e]of this._pairs)yield e}*values(){for(const[,e]of this._pairs)yield e}toIdArray(){var e;return ln(e=[...this._pairs]).call(e,t=>t[0])}toItemArray(){var e;return ln(e=[...this._pairs]).call(e,t=>t[1])}toEntryArray(){return[...this._pairs]}toObjectMap(){const e=Og(null);for(const[t,i]of this._pairs)e[t]=i;return e}toMap(){return new Na(this._pairs)}toIdSet(){return new wi(this.toIdArray())}toItemSet(){return new wi(this.toItemArray())}cache(){return new Ro([...this._pairs])}distinct(e){const t=new wi;for(const[i,o]of this._pairs)t.add(e(o,i));return t}filter(e){const t=this._pairs;return new Ro({*[_s](){for(const[i,o]of t)e(o,i)&&(yield[i,o])}})}forEach(e){for(const[t,i]of this._pairs)e(i,t)}map(e){const t=this._pairs;return new Ro({*[_s](){for(const[i,o]of t)yield[i,e(o,i)]}})}max(e){const t=uu(this._pairs);let i=t.next();if(i.done)return null;let o=i.value[1],r=e(i.value[1],i.value[0]);for(;!(i=t.next()).done;){const[A,I]=i.value,l=e(I,A);l>r&&(r=l,o=I)}return o}min(e){const t=uu(this._pairs);let i=t.next();if(i.done)return null;let o=i.value[1],r=e(i.value[1],i.value[0]);for(;!(i=t.next()).done;){const[A,I]=i.value,l=e(I,A);l{var t;return uu(tg(t=[...this._pairs]).call(t,(i,o)=>{let[r,A]=i,[I,l]=o;return e(A,l,r,I)}))}})}}function VQ(n,e){return n[e]==null&&(n[e]=Zs()),n}class Bs extends XC{get idProp(){return this._idProp}constructor(e,t){super(),$t(this,"flush",void 0),$t(this,"length",void 0),$t(this,"_options",void 0),$t(this,"_data",void 0),$t(this,"_idProp",void 0),$t(this,"_queue",null),e&&!nt(e)&&(t=e,e=[]),this._options=t||{},this._data=new Na,this.length=0,this._idProp=this._options.fieldId||"id",e&&e.length&&this.add(e),this.setOptions(t)}setOptions(e){e&&e.queue!==void 0&&(e.queue===!1?this._queue&&(this._queue.destroy(),this._queue=null):(this._queue||(this._queue=bu.extend(this,{replace:["add","update","remove"]})),e.queue&&typeof e.queue=="object"&&this._queue.setOptions(e.queue)))}add(e,t){const i=[];let o;if(nt(e)){const r=ln(e).call(e,A=>A[this._idProp]);if(ew(r).call(r,A=>this._data.has(A)))throw new Error("A duplicate id was found in the parameter array.");for(let A=0,I=e.length;A{const h=c[I];if(h!=null&&this._data.has(h)){const p=c,m=Ft({},this._data.get(h)),y=this._updateItem(p);o.push(y),A.push(p),r.push(m)}else{const p=this._addItem(c);i.push(p)}};if(nt(e))for(let c=0,h=e.length;c{const A=this._data.get(r[this._idProp]);if(A==null)throw new Error("Updating non-existent items is not allowed.");return{oldData:A,update:r}})).call(i,r=>{let{oldData:A,update:I}=r;const l=A[this._idProp],c=OV(A,I);return this._data.set(l,c),{id:l,oldData:A,updatedData:c}});if(o.length){const r={items:ln(o).call(o,A=>A.id),oldData:ln(o).call(o,A=>A.oldData),data:ln(o).call(o,A=>A.updatedData)};return this._trigger("update",r,t),r.items}else return[]}get(e,t){let i,o,r;Pw(e)?(i=e,r=t):nt(e)?(o=e,r=t):r=e;const A=r&&r.returnType==="Object"?"Object":"Array",I=r&&Qt(r),l=[];let c,h,p;if(i!=null)c=this._data.get(i),c&&I&&!I(c)&&(c=void 0);else if(o!=null)for(let w=0,S=o.length;w(o[r]=e[r],o),{})}_sort(e,t){if(typeof t=="string"){const i=t;tg(e).call(e,(o,r)=>{const A=o[i],I=r[i];return A>I?1:Ai)&&(t=r,i=A)}return t||null}min(e){let t=null,i=null;for(const r of WC(o=this._data).call(o)){var o;const A=r[e];typeof A=="number"&&(i==null||Ae.x&&n.tope.y}function qC(n){return typeof n=="string"&&n!==""}function Hw(n,e,t,i){let o=i.x,r=i.y;if(typeof i.distanceToBorder=="function"){const A=i.distanceToBorder(n,e),I=Math.sin(e)*A,l=Math.cos(e)*A;l===A?(o+=A,r=i.y):I===A?(o=i.x,r-=A):(o+=l,r-=I)}else i.shape.width>i.shape.height?(o=i.x+i.shape.width*.5,r=i.y-t):(o=i.x+t,r=i.y-i.shape.height*.5);return{x:o,y:r}}class hX{constructor(e){this.measureText=e,this.current=0,this.width=0,this.height=0,this.lines=[]}_add(e,t){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"normal";this.lines[e]===void 0&&(this.lines[e]={width:0,height:0,blocks:[]});let o=t;(t===void 0||t==="")&&(o=" ");const r=this.measureText(o,i),A=Ft({},WC(r));A.text=t,A.width=r.width,A.mod=i,(t===void 0||t==="")&&(A.width=0),this.lines[e].blocks.push(A),this.lines[e].width+=A.width}curWidth(){const e=this.lines[this.current];return e===void 0?0:e.width}append(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"normal";this._add(this.current,e,t)}newLine(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"normal";this._add(this.current,e,t),this.current++}determineLineHeights(){for(let e=0;ee&&(e=o.width),t+=o.height}this.width=e,this.height=t}removeEmptyBlocks(){const e=[];for(let t=0;t"://,""://,""://,"":/<\/b>/,"":/<\/i>/,"":/<\/code>/,"*":/\*/,_:/_/,"`":/`/,afterBold:/[^*]/,afterItal:/[^_]/,afterMono:/[^`]/};class Kw{constructor(e){this.text=e,this.bold=!1,this.ital=!1,this.mono=!1,this.spacing=!1,this.position=0,this.buffer="",this.modStack=[],this.blocks=[]}mod(){return this.modStack.length===0?"normal":this.modStack[0]}modName(){if(this.modStack.length===0)return"normal";if(this.modStack[0]==="mono")return"mono";if(this.bold&&this.ital)return"boldital";if(this.bold)return"bold";if(this.ital)return"ital"}emitBlock(){this.spacing&&(this.add(" "),this.spacing=!1),this.buffer.length>0&&(this.blocks.push({text:this.buffer,mod:this.modName()}),this.buffer="")}add(e){e===" "&&(this.spacing=!0),this.spacing&&(this.buffer+=" ",this.spacing=!1),e!=" "&&(this.buffer+=e)}parseWS(e){return/[ \t]/.test(e)?(this.mono?this.add(e):this.spacing=!0,!0):!1}setTag(e){this.emitBlock(),this[e]=!0,this.modStack.unshift(e)}unsetTag(e){this.emitBlock(),this[e]=!1,this.modStack.shift()}parseStartTag(e,t){return!this.mono&&!this[e]&&this.match(t)?(this.setTag(e),!0):!1}match(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;const[i,o]=this.prepareRegExp(e),r=i.test(this.text.substr(this.position,o));return r&&t&&(this.position+=o-1),r}parseEndTag(e,t,i){let o=this.mod()===e;return e==="mono"?o=o&&this.mono:o=o&&!this.mono,o&&this.match(t)?(i!==void 0?(this.position===this.text.length-1||this.match(i,!1))&&this.unsetTag(e):this.unsetTag(e),!0):!1}replace(e,t){return this.match(e)?(this.add(t),this.position+=length-1,!0):!1}prepareRegExp(e){let t,i;if(e instanceof RegExp)i=e,t=1;else{const o=fX[e];o!==void 0?i=o:i=new RegExp(e),t=e.length}return[i,t]}}class pX{constructor(e,t,i,o){this.ctx=e,this.parent=t,this.selected=i,this.hover=o;const r=(A,I)=>{if(A===void 0)return 0;const l=this.parent.getFormattingValues(e,i,o,I);let c=0;return A!==""&&(c=this.ctx.measureText(A).width),{width:c,values:l}};this.lines=new hX(r)}process(e){if(!qC(e))return this.lines.finalize();const t=this.parent.fontOptions;e=e.replace(/\r\n/g,` `),e=e.replace(/\r/g,` `);const i=String(e).split(` -`),o=i.length;if(t.multi)for(let r=0;r0)for(let I=0;I0)for(let r=0;r/&/.test(o)?(t.replace(t.text,"<","<")||t.replace(t.text,"&","&")||t.add("&"),!0):!1;for(;t.position")||t.parseStartTag("ital","")||t.parseStartTag("mono","")||t.parseEndTag("bold","")||t.parseEndTag("ital","")||t.parseEndTag("mono",""))||i(o)||t.add(o),t.position++}return t.emitBlock(),t.blocks}splitMarkdownBlocks(e){const t=new Hw(e);let i=!0;const o=r=>/\\/.test(r)?(t.positionthis.parent.fontOptions.maxWdt}getLongestFit(e){let t="",i=0;for(;i1&&arguments[1]!==void 0?arguments[1]:"normal",i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;this.parent.getFormattingValues(this.ctx,this.selected,this.hover,t),e=e.replace(/^( +)/g,"$1\r"),e=e.replace(/([^\r][^ ]*)( +)/g,"$1\r$2\r");let o=e.split("\r");for(;o.length>0;){let r=this.getLongestFit(o);if(r===0){const A=o[0],I=this.getLongestFitWord(A);this.lines.newLine(vi(A).call(A,0,I),t),o[0]=vi(A).call(A,I)}else{let A=r;o[r-1]===" "?r--:o[A]===" "&&A++;const I=vi(o).call(o,0,r).join("");r==o.length&&i?this.lines.append(I,t):this.lines.newLine(I,t),o=vi(o).call(o,A)}}}}const za=["bold","ital","boldital","mono"];class Bs{constructor(e,t){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;this.body=e,this.pointToSelf=!1,this.baseSize=void 0,this.fontOptions={},this.setOptions(t),this.size={top:0,left:0,width:0,height:0,yLine:0},this.isEdgeLabel=i}setOptions(e){if(this.elementOptions=e,this.initFontOptions(e.font),XC(e.label)?this.labelDirty=!0:e.label=void 0,e.font!==void 0&&e.font!==null){if(typeof e.font=="string")this.baseSize=this.fontOptions.size;else if(typeof e.font=="object"){const t=e.font.size;t!==void 0&&(this.baseSize=t)}}}initFontOptions(e){if(Ye(za,t=>{this.fontOptions[t]={}}),Bs.parseFontString(this.fontOptions,e)){this.fontOptions.vadjust=0;return}Ye(e,(t,i)=>{t!=null&&typeof t!="object"&&(this.fontOptions[i]=t)})}static parseFontString(e,t){if(!t||typeof t!="string")return!1;const i=t.split(" ");return e.size=+i[0].replace("px",""),e.face=i[1],e.color=i[2],!0}constrain(e){const t={constrainWidth:!1,maxWdt:-1,minWdt:-1,constrainHeight:!1,minHgt:-1,valign:"middle"},i=Mg(e,"widthConstraint");if(typeof i=="number")t.maxWdt=Number(i),t.minWdt=Number(i);else if(typeof i=="object"){const r=Mg(e,["widthConstraint","maximum"]);typeof r=="number"&&(t.maxWdt=Number(r));const A=Mg(e,["widthConstraint","minimum"]);typeof A=="number"&&(t.minWdt=Number(A))}const o=Mg(e,"heightConstraint");if(typeof o=="number")t.minHgt=Number(o);else if(typeof o=="object"){const r=Mg(e,["heightConstraint","minimum"]);typeof r=="number"&&(t.minHgt=Number(r));const A=Mg(e,["heightConstraint","valign"]);typeof A=="string"&&(A==="top"||A==="bottom")&&(t.valign=A)}return t}update(e,t){this.setOptions(e,!0),this.propagateFonts(t),mt(this.fontOptions,this.constrain(t)),this.fontOptions.chooser=bu("label",t)}adjustSizes(e){const t=e?e.right+e.left:0;this.fontOptions.constrainWidth&&(this.fontOptions.maxWdt-=t,this.fontOptions.minWdt-=t);const i=e?e.top+e.bottom:0;this.fontOptions.constrainHeight&&(this.fontOptions.minHgt-=i)}addFontOptionsToPile(e,t){for(let i=0;i{A!==void 0&&(Object.prototype.hasOwnProperty.call(t,I)||(at(za).call(za,I)!==-1?t[I]={}:t[I]=A))})}return t}getFontOption(e,t,i){let o;for(let r=0;r{r[l]=I}),r.size=Number(r.size),r.vadjust=Number(r.vadjust)}}draw(e,t,i,o,r){let A=arguments.length>5&&arguments[5]!==void 0?arguments[5]:"middle";if(this.elementOptions.label===void 0)return;let I=this.fontOptions.size*this.body.view.scale;this.elementOptions.label&&I=this.elementOptions.scaling.label.maxVisible&&(I=Number(this.elementOptions.scaling.label.maxVisible)/this.body.view.scale),this.calculateLabelSize(e,o,r,t,i,A),this._drawBackground(e),this._drawText(e,t,this.size.yLine,A,I))}_drawBackground(e){if(this.fontOptions.background!==void 0&&this.fontOptions.background!=="none"){e.fillStyle=this.fontOptions.background;const t=this.getSize();e.fillRect(t.left,t.top,t.width,t.height)}}_drawText(e,t,i){let o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"middle",r=arguments.length>4?arguments[4]:void 0;[t,i]=this._setAlignment(e,t,i,o),e.textAlign="left",t=t-this.size.width/2,this.fontOptions.valign&&this.size.height>this.size.labelHeight&&(this.fontOptions.valign==="top"&&(i-=(this.size.height-this.size.labelHeight)/2),this.fontOptions.valign==="bottom"&&(i+=(this.size.height-this.size.labelHeight)/2));for(let A=0;A0&&(e.lineWidth=h.strokeWidth,e.strokeStyle=m,e.lineJoin="round"),e.fillStyle=p,h.strokeWidth>0&&e.strokeText(h.text,t+l,i+h.vadjust),e.fillText(h.text,t+l,i+h.vadjust),l+=h.width}i+=I.height}}}_setAlignment(e,t,i,o){if(this.isEdgeLabel&&this.fontOptions.align!=="horizontal"&&this.pointToSelf===!1){t=0,i=0;const r=2;this.fontOptions.align==="top"?(e.textBaseline="alphabetic",i-=2*r):this.fontOptions.align==="bottom"?(e.textBaseline="hanging",i+=2*r):e.textBaseline="middle"}else e.textBaseline=o;return[t,i]}_getColor(e,t,i){let o=e||"#000000",r=i||"#ffffff";if(t<=this.elementOptions.scaling.label.drawThreshold){const A=Math.max(0,Math.min(1,1-(this.elementOptions.scaling.label.drawThreshold-t)));o=ni(o,A),r=ni(r,A)}return[o,r]}getTextSize(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return this._processLabel(e,t,i),{width:this.size.width,height:this.size.height,lineCount:this.lineCount}}getSize(){let t=this.size.left,i=this.size.top-.5*2;if(this.isEdgeLabel){const r=-this.size.width*.5;switch(this.fontOptions.align){case"middle":t=r,i=-this.size.height*.5;break;case"top":t=r,i=-(this.size.height+2);break;case"bottom":t=r,i=2;break}}return{left:t,top:i,width:this.size.width,height:this.size.height}}calculateLabelSize(e,t,i){let o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,r=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,A=arguments.length>5&&arguments[5]!==void 0?arguments[5]:"middle";this._processLabel(e,t,i),this.size.left=o-this.size.width*.5,this.size.top=r-this.size.height*.5,this.size.yLine=r+(1-this.lineCount)*.5*this.fontOptions.size,A==="hanging"&&(this.size.top+=.5*this.fontOptions.size,this.size.top+=4,this.size.yLine+=4)}getFormattingValues(e,t,i,o){const r=function(l,c,h){return c==="normal"?h==="mod"?"":l[h]:l[c][h]!==void 0?l[c][h]:l[h]},A={color:r(this.fontOptions,o,"color"),size:r(this.fontOptions,o,"size"),face:r(this.fontOptions,o,"face"),mod:r(this.fontOptions,o,"mod"),vadjust:r(this.fontOptions,o,"vadjust"),strokeWidth:this.fontOptions.strokeWidth,strokeColor:this.fontOptions.strokeColor};(t||i)&&(o==="normal"&&this.fontOptions.chooser===!0&&this.elementOptions.labelHighlightBold?A.mod="bold":typeof this.fontOptions.chooser=="function"&&this.fontOptions.chooser(A,this.elementOptions.id,t,i));let I="";return A.mod!==void 0&&A.mod!==""&&(I+=A.mod+" "),I+=A.size+"px "+A.face,e.font=I.replace(/"/g,""),A.font=e.font,A.height=A.size,A}differentState(e,t){return e!==this.selectedState||t!==this.hoverState}_processLabelText(e,t,i,o){return new pX(e,this,t,i).process(o)}_processLabel(e,t,i){if(this.labelDirty===!1&&!this.differentState(t,i))return;const o=this._processLabelText(e,t,i,this.elementOptions.label);this.fontOptions.minWdt>0&&o.width0&&o.height0&&(this.enableBorderDashes(e,t),e.stroke(),this.disableBorderDashes(e,t)),e.restore()}performFill(e,t){e.save(),e.fillStyle=t.color,this.enableShadow(e,t),Ia(e).call(e),this.disableShadow(e,t),e.restore(),this.performStroke(e,t)}_addBoundingBoxMargin(e){this.boundingBox.left-=e,this.boundingBox.top-=e,this.boundingBox.bottom+=e,this.boundingBox.right+=e}_updateBoundingBox(e,t,i,o,r){i!==void 0&&this.resize(i,o,r),this.left=e-this.width/2,this.top=t-this.height/2,this.boundingBox.left=this.left,this.boundingBox.top=this.top,this.boundingBox.bottom=this.top+this.height,this.boundingBox.right=this.left+this.width}updateBoundingBox(e,t,i,o,r){this._updateBoundingBox(e,t,i,o,r)}getDimensionsFromLabel(e,t,i){this.textSize=this.labelModule.getTextSize(e,t,i);let o=this.textSize.width,r=this.textSize.height;const A=14;return o===0&&(o=A,r=A),{width:o,height:r}}}let mX=class extends Ro{constructor(e,t,i){super(e,t,i),this._setMargins(i)}resize(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.selected,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.hover;if(this.needsRefresh(t,i)){const o=this.getDimensionsFromLabel(e,t,i);this.width=o.width+this.margin.right+this.margin.left,this.height=o.height+this.margin.top+this.margin.bottom,this.radius=this.width/2}}draw(e,t,i,o,r,A){this.resize(e,o,r),this.left=t-this.width/2,this.top=i-this.height/2,this.initContextForDraw(e,A),cy(e,this.left,this.top,this.width,this.height,A.borderRadius),this.performFill(e,A),this.updateBoundingBox(t,i,e,o,r),this.labelModule.draw(e,this.left+this.textSize.width/2+this.margin.left,this.top+this.textSize.height/2+this.margin.top,o,r)}updateBoundingBox(e,t,i,o,r){this._updateBoundingBox(e,t,i,o,r);const A=this.options.shapeProperties.borderRadius;this._addBoundingBoxMargin(A)}distanceToBorder(e,t){e&&this.resize(e);const i=this.options.borderWidth;return Math.min(Math.abs(this.width/2/Math.cos(t)),Math.abs(this.height/2/Math.sin(t)))+i}};class xu extends Ro{constructor(e,t,i){super(e,t,i),this.labelOffset=0,this.selected=!1}setOptions(e,t,i){this.options=e,t===void 0&&i===void 0||this.setImages(t,i)}setImages(e,t){t&&this.selected?(this.imageObj=t,this.imageObjAlt=e):(this.imageObj=e,this.imageObjAlt=t)}switchImages(e){const t=e&&!this.selected||!e&&this.selected;if(this.selected=e,this.imageObjAlt!==void 0&&t){const i=this.imageObj;this.imageObj=this.imageObjAlt,this.imageObjAlt=i}}_getImagePadding(){const e={top:0,right:0,bottom:0,left:0};if(this.options.imagePadding){const t=this.options.imagePadding;typeof t=="object"?(e.top=t.top,e.right=t.right,e.bottom=t.bottom,e.left=t.left):(e.top=t,e.right=t,e.bottom=t,e.left=t)}return e}_resizeImage(){let e,t;if(this.options.shapeProperties.useImageSize===!1){let i=1,o=1;this.imageObj.width&&this.imageObj.height&&(this.imageObj.width>this.imageObj.height?i=this.imageObj.width/this.imageObj.height:o=this.imageObj.height/this.imageObj.width),e=this.options.size*2*i,t=this.options.size*2*o}else{const i=this._getImagePadding();e=this.imageObj.width+i.left+i.right,t=this.imageObj.height+i.top+i.bottom}this.width=e,this.height=t,this.radius=.5*this.width}_drawRawCircle(e,t,i,o){this.initContextForDraw(e,o),Zc(e,t,i,o.size),this.performFill(e,o)}_drawImageAtPosition(e,t){if(this.imageObj.width!=0){e.globalAlpha=t.opacity!==void 0?t.opacity:1,this.enableShadow(e,t);let i=1;this.options.shapeProperties.interpolation===!0&&(i=this.imageObj.width/this.width/this.body.view.scale);const o=this._getImagePadding(),r=this.left+o.left,A=this.top+o.top,I=this.width-o.left-o.right,l=this.height-o.top-o.bottom;this.imageObj.drawImageAtPosition(e,i,r,A,I,l),this.disableShadow(e,t)}}_drawImageLabel(e,t,i,o,r){let A=0;if(this.height!==void 0){A=this.height*.5;const l=this.labelModule.getTextSize(e,o,r);l.lineCount>=1&&(A+=l.height/2)}const I=i+A;this.options.label&&(this.labelOffset=A),this.labelModule.draw(e,t,I,o,r,"hanging")}}let vX=class extends xu{constructor(e,t,i){super(e,t,i),this._setMargins(i)}resize(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.selected,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.hover;if(this.needsRefresh(t,i)){const o=this.getDimensionsFromLabel(e,t,i),r=Math.max(o.width+this.margin.right+this.margin.left,o.height+this.margin.top+this.margin.bottom);this.options.size=r/2,this.width=r,this.height=r,this.radius=this.width/2}}draw(e,t,i,o,r,A){this.resize(e,o,r),this.left=t-this.width/2,this.top=i-this.height/2,this._drawRawCircle(e,t,i,A),this.updateBoundingBox(t,i),this.labelModule.draw(e,this.left+this.textSize.width/2+this.margin.left,i,o,r)}updateBoundingBox(e,t){this.boundingBox.top=t-this.options.size,this.boundingBox.left=e-this.options.size,this.boundingBox.right=e+this.options.size,this.boundingBox.bottom=t+this.options.size}distanceToBorder(e){return e&&this.resize(e),this.width*.5}};class yX extends xu{constructor(e,t,i,o,r){super(e,t,i),this.setImages(o,r)}resize(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.selected,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.hover;if(this.imageObj.src===void 0||this.imageObj.width===void 0||this.imageObj.height===void 0){const r=this.options.size*2;this.width=r,this.height=r,this.radius=.5*this.width;return}this.needsRefresh(t,i)&&this._resizeImage()}draw(e,t,i,o,r,A){this.switchImages(o),this.resize();let I=t,l=i;this.options.shapeProperties.coordinateOrigin==="top-left"?(this.left=t,this.top=i,I+=this.width/2,l+=this.height/2):(this.left=t-this.width/2,this.top=i-this.height/2),this._drawRawCircle(e,I,l,A),e.save(),e.clip(),this._drawImageAtPosition(e,A),e.restore(),this._drawImageLabel(e,I,l,o,r),this.updateBoundingBox(t,i)}updateBoundingBox(e,t){this.options.shapeProperties.coordinateOrigin==="top-left"?(this.boundingBox.top=t,this.boundingBox.left=e,this.boundingBox.right=e+this.options.size*2,this.boundingBox.bottom=t+this.options.size*2):(this.boundingBox.top=t-this.options.size,this.boundingBox.left=e-this.options.size,this.boundingBox.right=e+this.options.size,this.boundingBox.bottom=t+this.options.size),this.boundingBox.left=Math.min(this.boundingBox.left,this.labelModule.size.left),this.boundingBox.right=Math.max(this.boundingBox.right,this.labelModule.size.left+this.labelModule.size.width),this.boundingBox.bottom=Math.max(this.boundingBox.bottom,this.boundingBox.bottom+this.labelOffset)}distanceToBorder(e){return e&&this.resize(e),this.width*.5}}class _g extends Ro{constructor(e,t,i){super(e,t,i)}resize(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.selected,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.hover,o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{size:this.options.size};if(this.needsRefresh(t,i)){var r,A;this.labelModule.getTextSize(e,t,i);const I=2*o.size;this.width=(r=this.customSizeWidth)!==null&&r!==void 0?r:I,this.height=(A=this.customSizeHeight)!==null&&A!==void 0?A:I,this.radius=.5*this.width}}_drawShape(e,t,i,o,r,A,I,l){return this.resize(e,A,I,l),this.left=o-this.width/2,this.top=r-this.height/2,this.initContextForDraw(e,l),i4(t)(e,o,r,l.size),this.performFill(e,l),this.options.icon!==void 0&&this.options.icon.code!==void 0&&(e.font=(A?"bold ":"")+this.height/2+"px "+(this.options.icon.face||"FontAwesome"),e.fillStyle=this.options.icon.color||"black",e.textAlign="center",e.textBaseline="middle",e.fillText(this.options.icon.code,o,r)),{drawExternalLabel:()=>{if(this.options.label!==void 0){this.labelModule.calculateLabelSize(e,A,I,o,r,"hanging");const c=r+.5*this.height+.5*this.labelModule.size.height;this.labelModule.draw(e,o,c,A,I,"hanging")}this.updateBoundingBox(o,r)}}}updateBoundingBox(e,t){this.boundingBox.top=t-this.options.size,this.boundingBox.left=e-this.options.size,this.boundingBox.right=e+this.options.size,this.boundingBox.bottom=t+this.options.size,this.options.label!==void 0&&this.labelModule.size.width>0&&(this.boundingBox.left=Math.min(this.boundingBox.left,this.labelModule.size.left),this.boundingBox.right=Math.max(this.boundingBox.right,this.labelModule.size.left+this.labelModule.size.width),this.boundingBox.bottom=Math.max(this.boundingBox.bottom,this.boundingBox.bottom+this.labelModule.size.height))}}function Kw(n,e){var t=wt(n);if(_i){var i=_i(n);e&&(i=Qt(i).call(i,function(o){return ji(n,o).enumerable})),t.push.apply(t,i)}return t}function bX(n){for(var e=1;e{e.save(),l(),e.restore()}}return I.nodeDimensions&&(this.customSizeWidth=I.nodeDimensions.width,this.customSizeHeight=I.nodeDimensions.height),I}distanceToBorder(e,t){return this._distanceToBorder(e,t)}}class xX extends Ro{constructor(e,t,i){super(e,t,i),this._setMargins(i)}resize(e,t,i){if(this.needsRefresh(t,i)){const r=this.getDimensionsFromLabel(e,t,i).width+this.margin.right+this.margin.left;this.width=r,this.height=r,this.radius=this.width/2}}draw(e,t,i,o,r,A){this.resize(e,o,r),this.left=t-this.width/2,this.top=i-this.height/2,this.initContextForDraw(e,A),dy(e,t-this.width/2,i-this.height/2,this.width,this.height),this.performFill(e,A),this.updateBoundingBox(t,i,e,o,r),this.labelModule.draw(e,this.left+this.textSize.width/2+this.margin.left,this.top+this.textSize.height/2+this.margin.top,o,r)}distanceToBorder(e,t){return this._distanceToBorder(e,t)}}let SX=class extends _g{constructor(e,t,i){super(e,t,i)}draw(e,t,i,o,r,A){return this._drawShape(e,"diamond",4,t,i,o,r,A)}distanceToBorder(e,t){return this._distanceToBorder(e,t)}};class EX extends _g{constructor(e,t,i){super(e,t,i)}draw(e,t,i,o,r,A){return this._drawShape(e,"circle",2,t,i,o,r,A)}distanceToBorder(e){return e&&this.resize(e),this.options.size}}class Ww extends Ro{constructor(e,t,i){super(e,t,i)}resize(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.selected,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.hover;if(this.needsRefresh(t,i)){const o=this.getDimensionsFromLabel(e,t,i);this.height=o.height*2,this.width=o.width+o.height,this.radius=.5*this.width}}draw(e,t,i,o,r,A){this.resize(e,o,r),this.left=t-this.width*.5,this.top=i-this.height*.5,this.initContextForDraw(e,A),Bc(e,this.left,this.top,this.width,this.height),this.performFill(e,A),this.updateBoundingBox(t,i,e,o,r),this.labelModule.draw(e,t,i,o,r)}distanceToBorder(e,t){e&&this.resize(e);const i=this.width*.5,o=this.height*.5,r=Math.sin(t)*i,A=Math.cos(t)*o;return i*o/Math.sqrt(r*r+A*A)}}class TX extends Ro{constructor(e,t,i){super(e,t,i),this._setMargins(i)}resize(e,t,i){this.needsRefresh(t,i)&&(this.iconSize={width:Number(this.options.icon.size),height:Number(this.options.icon.size)},this.width=this.iconSize.width+this.margin.right+this.margin.left,this.height=this.iconSize.height+this.margin.top+this.margin.bottom,this.radius=.5*this.width)}draw(e,t,i,o,r,A){return this.resize(e,o,r),this.options.icon.size=this.options.icon.size||50,this.left=t-this.width/2,this.top=i-this.height/2,this._icon(e,t,i,o,r,A),{drawExternalLabel:()=>{this.options.label!==void 0&&this.labelModule.draw(e,this.left+this.iconSize.width/2+this.margin.left,i+this.height/2+5,o),this.updateBoundingBox(t,i)}}}updateBoundingBox(e,t){this.boundingBox.top=t-this.options.icon.size*.5,this.boundingBox.left=e-this.options.icon.size*.5,this.boundingBox.right=e+this.options.icon.size*.5,this.boundingBox.bottom=t+this.options.icon.size*.5,this.options.label!==void 0&&this.labelModule.size.width>0&&(this.boundingBox.left=Math.min(this.boundingBox.left,this.labelModule.size.left),this.boundingBox.right=Math.max(this.boundingBox.right,this.labelModule.size.left+this.labelModule.size.width),this.boundingBox.bottom=Math.max(this.boundingBox.bottom,this.boundingBox.bottom+this.labelModule.size.height+5))}_icon(e,t,i,o,r,A){const I=Number(this.options.icon.size);this.options.icon.code!==void 0?(e.font=[this.options.icon.weight!=null?this.options.icon.weight:o?"bold":"",(this.options.icon.weight!=null&&o?5:0)+I+"px",this.options.icon.face].join(" "),e.fillStyle=this.options.icon.color||"black",e.textAlign="center",e.textBaseline="middle",this.enableShadow(e,A),e.fillText(this.options.icon.code,t,i),this.disableShadow(e,A)):console.error("When using the icon shape, you need to define the code in the icon options object. This can be done per node or globally.")}distanceToBorder(e,t){return this._distanceToBorder(e,t)}}let OX=class extends xu{constructor(e,t,i,o,r){super(e,t,i),this.setImages(o,r)}resize(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.selected,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.hover;if(this.imageObj.src===void 0||this.imageObj.width===void 0||this.imageObj.height===void 0){const r=this.options.size*2;this.width=r,this.height=r;return}this.needsRefresh(t,i)&&this._resizeImage()}draw(e,t,i,o,r,A){e.save(),this.switchImages(o),this.resize();let I=t,l=i;if(this.options.shapeProperties.coordinateOrigin==="top-left"?(this.left=t,this.top=i,I+=this.width/2,l+=this.height/2):(this.left=t-this.width/2,this.top=i-this.height/2),this.options.shapeProperties.useBorderWithImage===!0){const c=this.options.borderWidth,h=this.options.borderWidthSelected||2*this.options.borderWidth,p=(o?h:c)/this.body.view.scale;e.lineWidth=Math.min(this.width,p),e.beginPath();let m=o?this.options.color.highlight.border:r?this.options.color.hover.border:this.options.color.border,y=o?this.options.color.highlight.background:r?this.options.color.hover.background:this.options.color.background;A.opacity!==void 0&&(m=ni(m,A.opacity),y=ni(y,A.opacity)),e.strokeStyle=m,e.fillStyle=y,e.rect(this.left-.5*e.lineWidth,this.top-.5*e.lineWidth,this.width+e.lineWidth,this.height+e.lineWidth),Ia(e).call(e),this.performStroke(e,A),e.closePath()}this._drawImageAtPosition(e,A),this._drawImageLabel(e,I,l,o,r),this.updateBoundingBox(t,i),e.restore()}updateBoundingBox(e,t){this.resize(),this.options.shapeProperties.coordinateOrigin==="top-left"?(this.left=e,this.top=t):(this.left=e-this.width/2,this.top=t-this.height/2),this.boundingBox.left=this.left,this.boundingBox.top=this.top,this.boundingBox.bottom=this.top+this.height,this.boundingBox.right=this.left+this.width,this.options.label!==void 0&&this.labelModule.size.width>0&&(this.boundingBox.left=Math.min(this.boundingBox.left,this.labelModule.size.left),this.boundingBox.right=Math.max(this.boundingBox.right,this.labelModule.size.left+this.labelModule.size.width),this.boundingBox.bottom=Math.max(this.boundingBox.bottom,this.boundingBox.bottom+this.labelOffset))}distanceToBorder(e,t){return this._distanceToBorder(e,t)}};class NX extends _g{constructor(e,t,i){super(e,t,i)}draw(e,t,i,o,r,A){return this._drawShape(e,"square",2,t,i,o,r,A)}distanceToBorder(e,t){return this._distanceToBorder(e,t)}}class DX extends _g{constructor(e,t,i){super(e,t,i)}draw(e,t,i,o,r,A){return this._drawShape(e,"hexagon",4,t,i,o,r,A)}distanceToBorder(e,t){return this._distanceToBorder(e,t)}}class MX extends _g{constructor(e,t,i){super(e,t,i)}draw(e,t,i,o,r,A){return this._drawShape(e,"star",4,t,i,o,r,A)}distanceToBorder(e,t){return this._distanceToBorder(e,t)}}class zX extends Ro{constructor(e,t,i){super(e,t,i),this._setMargins(i)}resize(e,t,i){this.needsRefresh(t,i)&&(this.textSize=this.labelModule.getTextSize(e,t,i),this.width=this.textSize.width+this.margin.right+this.margin.left,this.height=this.textSize.height+this.margin.top+this.margin.bottom,this.radius=.5*this.width)}draw(e,t,i,o,r,A){this.resize(e,o,r),this.left=t-this.width/2,this.top=i-this.height/2,this.enableShadow(e,A),this.labelModule.draw(e,this.left+this.textSize.width/2+this.margin.left,this.top+this.textSize.height/2+this.margin.top,o,r),this.disableShadow(e,A),this.updateBoundingBox(t,i,e,o,r)}distanceToBorder(e,t){return this._distanceToBorder(e,t)}}let kX=class extends _g{constructor(e,t,i){super(e,t,i)}draw(e,t,i,o,r,A){return this._drawShape(e,"triangle",3,t,i,o,r,A)}distanceToBorder(e,t){return this._distanceToBorder(e,t)}};class RX extends _g{constructor(e,t,i){super(e,t,i)}draw(e,t,i,o,r,A){return this._drawShape(e,"triangleDown",3,t,i,o,r,A)}distanceToBorder(e,t){return this._distanceToBorder(e,t)}}function Qw(n,e){var t=wt(n);if(_i){var i=_i(n);e&&(i=Qt(i).call(i,function(o){return ji(n,o).enumerable})),t.push.apply(t,i)}return t}function Xw(n){for(var e=1;et[c]!=null);l.push("font"),ZC(l,e,I),e.color=Kd(e.color)}static parseOptions(e,t){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},r=arguments.length>4?arguments[4]:void 0;if(ZC(["color","fixed","shadow"],e,t,i),Ot.checkMass(t),e.opacity!==void 0&&(Ot.checkOpacity(e.opacity)||(console.error("Invalid option for node opacity. Value must be between 0 and 1, found: "+e.opacity),e.opacity=void 0)),t.opacity!==void 0&&(Ot.checkOpacity(t.opacity)||(console.error("Invalid option for node opacity. Value must be between 0 and 1, found: "+t.opacity),t.opacity=void 0)),t.shapeProperties&&!Ot.checkCoordinateOrigin(t.shapeProperties.coordinateOrigin)&&console.error("Invalid option for node coordinateOrigin, found: "+t.shapeProperties.coordinateOrigin),ii(e,t,"shadow",o),t.color!==void 0&&t.color!==null){const I=Kd(t.color);d1(e.color,I)}else i===!0&&t.color===null&&(e.color=Dg(o.color));t.fixed!==void 0&&t.fixed!==null&&(typeof t.fixed=="boolean"?(e.fixed.x=t.fixed,e.fixed.y=t.fixed):(t.fixed.x!==void 0&&typeof t.fixed.x=="boolean"&&(e.fixed.x=t.fixed.x),t.fixed.y!==void 0&&typeof t.fixed.y=="boolean"&&(e.fixed.y=t.fixed.y))),i===!0&&t.font===null&&(e.font=Dg(o.font)),Ot.updateGroupOptions(e,t,r),t.scaling!==void 0&&ii(e.scaling,t.scaling,"label",o.scaling)}getFormattingValues(){const e={color:this.options.color.background,opacity:this.options.opacity,borderWidth:this.options.borderWidth,borderColor:this.options.color.border,size:this.options.size,borderDashes:this.options.shapeProperties.borderDashes,borderRadius:this.options.shapeProperties.borderRadius,shadow:this.options.shadow.enabled,shadowColor:this.options.shadow.color,shadowSize:this.options.shadow.size,shadowX:this.options.shadow.x,shadowY:this.options.shadow.y};if(this.selected||this.hover?this.chooser===!0?this.selected?(this.options.borderWidthSelected!=null?e.borderWidth=this.options.borderWidthSelected:e.borderWidth*=2,e.color=this.options.color.highlight.background,e.borderColor=this.options.color.highlight.border,e.shadow=this.options.shadow.enabled):this.hover&&(e.color=this.options.color.hover.background,e.borderColor=this.options.color.hover.border,e.shadow=this.options.shadow.enabled):typeof this.chooser=="function"&&(this.chooser(e,this.options.id,this.selected,this.hover),e.shadow===!1&&(e.shadowColor!==this.options.shadow.color||e.shadowSize!==this.options.shadow.size||e.shadowX!==this.options.shadow.x||e.shadowY!==this.options.shadow.y)&&(e.shadow=!0)):e.shadow=this.options.shadow.enabled,this.options.opacity!==void 0){const t=this.options.opacity;e.borderColor=ni(e.borderColor,t),e.color=ni(e.color,t),e.shadowColor=ni(e.shadowColor,t)}return e}updateLabelModule(e){(this.options.label===void 0||this.options.label===null)&&(this.options.label=""),Ot.updateGroupOptions(this.options,Xw(Xw({},e),{},{color:e&&e.color||this._localColor||void 0}),this.grouplist);const t=this.grouplist.get(this.options.group,!1),i=[e,this.options,t,this.globalOptions,this.defaultOptions];this.labelModule.update(this.options,i),this.labelModule.baseSize!==void 0&&(this.baseFontSize=this.labelModule.baseSize)}updateShape(e){if(e===this.options.shape&&this.shape)this.shape.setOptions(this.options,this.imageObj,this.imageObjAlt);else switch(this.options.shape){case"box":this.shape=new mX(this.options,this.body,this.labelModule);break;case"circle":this.shape=new vX(this.options,this.body,this.labelModule);break;case"circularImage":this.shape=new yX(this.options,this.body,this.labelModule,this.imageObj,this.imageObjAlt);break;case"custom":this.shape=new wX(this.options,this.body,this.labelModule,this.options.ctxRenderer);break;case"database":this.shape=new xX(this.options,this.body,this.labelModule);break;case"diamond":this.shape=new SX(this.options,this.body,this.labelModule);break;case"dot":this.shape=new EX(this.options,this.body,this.labelModule);break;case"ellipse":this.shape=new Ww(this.options,this.body,this.labelModule);break;case"icon":this.shape=new TX(this.options,this.body,this.labelModule);break;case"image":this.shape=new OX(this.options,this.body,this.labelModule,this.imageObj,this.imageObjAlt);break;case"square":this.shape=new NX(this.options,this.body,this.labelModule);break;case"hexagon":this.shape=new DX(this.options,this.body,this.labelModule);break;case"star":this.shape=new MX(this.options,this.body,this.labelModule);break;case"text":this.shape=new zX(this.options,this.body,this.labelModule);break;case"triangle":this.shape=new kX(this.options,this.body,this.labelModule);break;case"triangleDown":this.shape=new RX(this.options,this.body,this.labelModule);break;default:this.shape=new Ww(this.options,this.body,this.labelModule);break}this.needsRefresh()}select(){this.selected=!0,this.needsRefresh()}unselect(){this.selected=!1,this.needsRefresh()}needsRefresh(){this.shape.refreshNeeded=!0}getTitle(){return this.options.title}distanceToBorder(e,t){return this.shape.distanceToBorder(e,t)}isFixed(){return this.options.fixed.x&&this.options.fixed.y}isSelected(){return this.selected}getValue(){return this.options.value}getLabelSize(){return this.labelModule.size()}setValueRange(e,t,i){if(this.options.value!==void 0){const o=this.options.scaling.customScalingFunction(e,t,i,this.options.value),r=this.options.scaling.max-this.options.scaling.min;if(this.options.scaling.label.enabled===!0){const A=this.options.scaling.label.max-this.options.scaling.label.min;this.options.font.size=this.options.scaling.label.min+o*A}this.options.size=this.options.scaling.min+o*r}else this.options.size=this.baseSize,this.options.font.size=this.baseFontSize;this.updateLabelModule()}draw(e){const t=this.getFormattingValues();return this.shape.draw(e,this.x,this.y,this.selected,this.hover,t)||{}}updateBoundingBox(e){this.shape.updateBoundingBox(this.x,this.y,e)}resize(e){const t=this.getFormattingValues();this.shape.resize(e,this.selected,this.hover,t)}getItemsOnPoint(e){const t=[];return this.labelModule.visible()&&wu(this.labelModule.getSize(),e)&&t.push({nodeId:this.id,labelId:0}),wu(this.shape.boundingBox,e)&&t.push({nodeId:this.id}),t}isOverlappingWith(e){return this.shape.lefte.left&&this.shape.tope.top}isBoundingBoxOverlappingWith(e){return this.shape.boundingBox.lefte.left&&this.shape.boundingBox.tope.top}static checkMass(e,t){if(e.mass!==void 0&&e.mass<=0){let i="";t!==void 0&&(i=" in node id: "+t),console.error("%cNegative or zero mass disallowed"+i+", setting mass to 1.",m1),e.mass=1}}}class _X{constructor(e,t,i,o){var r;if(this.body=e,this.images=t,this.groups=i,this.layoutEngine=o,this.body.functions.createNode=ge(r=this.create).call(r,this),this.nodesListeners={add:(A,I)=>{this.add(I.items)},update:(A,I)=>{this.update(I.items,I.data,I.oldData)},remove:(A,I)=>{this.remove(I.items)}},this.defaultOptions={borderWidth:1,borderWidthSelected:void 0,brokenImage:void 0,color:{border:"#2B7CE9",background:"#97C2FC",highlight:{border:"#2B7CE9",background:"#D2E5FF"},hover:{border:"#2B7CE9",background:"#D2E5FF"}},opacity:void 0,fixed:{x:!1,y:!1},font:{color:"#343434",size:14,face:"arial",background:"none",strokeWidth:0,strokeColor:"#ffffff",align:"center",vadjust:0,multi:!1,bold:{mod:"bold"},boldital:{mod:"bold italic"},ital:{mod:"italic"},mono:{mod:"",size:15,face:"monospace",vadjust:2}},group:void 0,hidden:!1,icon:{face:"FontAwesome",code:void 0,size:50,color:"#2B7CE9"},image:void 0,imagePadding:{top:0,right:0,bottom:0,left:0},label:void 0,labelHighlightBold:!0,level:void 0,margin:{top:5,right:5,bottom:5,left:5},mass:1,physics:!0,scaling:{min:10,max:30,label:{enabled:!1,min:14,max:30,maxVisible:30,drawThreshold:5},customScalingFunction:function(A,I,l,c){if(I===A)return .5;{const h=1/(I-A);return Math.max(0,(c-A)*h)}}},shadow:{enabled:!1,color:"rgba(0,0,0,0.5)",size:10,x:5,y:5},shape:"ellipse",shapeProperties:{borderDashes:!1,borderRadius:6,interpolation:!0,useImageSize:!1,useBorderWithImage:!1,coordinateOrigin:"center"},size:25,title:void 0,value:void 0,x:void 0,y:void 0},this.defaultOptions.mass<=0)throw"Internal error: mass in defaultOptions of NodesHandler may not be zero or negative";this.options=Dg(this.defaultOptions),this.bindEventListeners()}bindEventListeners(){var e,t;this.body.emitter.on("refreshNodes",ge(e=this.refresh).call(e,this)),this.body.emitter.on("refresh",ge(t=this.refresh).call(t,this)),this.body.emitter.on("destroy",()=>{Ye(this.nodesListeners,(i,o)=>{this.body.data.nodes&&this.body.data.nodes.off(o,i)}),delete this.body.functions.createNode,delete this.nodesListeners.add,delete this.nodesListeners.update,delete this.nodesListeners.remove,delete this.nodesListeners})}setOptions(e){if(e!==void 0){if(Ot.parseOptions(this.options,e),e.opacity!==void 0&&(au(e.opacity)||!zo(e.opacity)||e.opacity<0||e.opacity>1?console.error("Invalid option for node opacity. Value must be between 0 and 1, found: "+e.opacity):this.options.opacity=e.opacity),e.shape!==void 0)for(const t in this.body.nodes)Object.prototype.hasOwnProperty.call(this.body.nodes,t)&&this.body.nodes[t].updateShape();if(typeof e.font<"u"||typeof e.widthConstraint<"u"||typeof e.heightConstraint<"u")for(const t of wt(this.body.nodes))this.body.nodes[t].updateLabelModule(),this.body.nodes[t].needsRefresh();if(e.size!==void 0)for(const t in this.body.nodes)Object.prototype.hasOwnProperty.call(this.body.nodes,t)&&this.body.nodes[t].needsRefresh();(e.hidden!==void 0||e.physics!==void 0)&&this.body.emitter.emit("_dataChanged")}}setData(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;const i=this.body.data.nodes;if(Pw("id",e))this.body.data.nodes=e;else if(et(e))this.body.data.nodes=new Zs,this.body.data.nodes.add(e);else if(!e)this.body.data.nodes=new Zs;else throw new TypeError("Array or DataSet expected");if(i&&Ye(this.nodesListeners,function(o,r){i.off(r,o)}),this.body.nodes={},this.body.data.nodes){const o=this;Ye(this.nodesListeners,function(A,I){o.body.data.nodes.on(I,A)});const r=this.body.data.nodes.getIds();this.add(r,!0)}t===!1&&this.body.emitter.emit("_dataChanged")}add(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,i;const o=[];for(let r=0;r1&&arguments[1]!==void 0?arguments[1]:Ot;return new t(e,this.body,this.images,this.groups,this.options,this.defaultOptions)}refresh(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;Ye(this.body.nodes,(t,i)=>{const o=this.body.data.nodes.get(i);o!==void 0&&(e===!0&&t.setOptions({x:null,y:null}),t.setOptions({fixed:!1}),t.setOptions(o))})}getPositions(e){const t={};if(e!==void 0){if(et(e)===!0){for(let i=0;i{this.body.emitter.emit("startSimulation")},0)):console.error("Node id supplied to moveNode does not exist. Provided: ",e)}}var jX=ze,$w=Math.hypot,ZX=Math.abs,BX=Math.sqrt,PX=!!$w&&$w(1/0,NaN)!==1/0;jX({target:"Math",stat:!0,forced:PX},{hypot:function(e,t){for(var i=0,o=0,r=arguments.length,A=0,I,l;o0?(l=I/A,i+=l*l):i+=I;return A===1/0?1/0:A*BX(i)}});var LX=st,GX=LX.Math.hypot,FX=GX,VX=FX,UX=VX,YX=Ne(UX);class Ut{static transform(e,t){et(e)||(e=[e]);const i=t.point.x,o=t.point.y,r=t.angle,A=t.length;for(let I=0;I4&&arguments[4]!==void 0?arguments[4]:this.getViaNode();e.strokeStyle=this.getColor(e,t),e.lineWidth=t.width,t.dashes!==!1?this._drawDashedLine(e,t,r):this._drawLine(e,t,r)}_drawLine(e,t,i,o,r){if(this.from!=this.to)this._line(e,t,i,o,r);else{const[A,I,l]=this._getCircleData(e);this._circle(e,t,A,I,l)}}_drawDashedLine(e,t,i,o,r){e.lineCap="round";const A=et(t.dashes)?t.dashes:[5,5];if(e.setLineDash!==void 0){if(e.save(),e.setLineDash(A),e.lineDashOffset=0,this.from!=this.to)this._line(e,t,i);else{const[I,l,c]=this._getCircleData(e);this._circle(e,t,I,l,c)}e.setLineDash([0]),e.lineDashOffset=0,e.restore()}else{if(this.from!=this.to)uy(e,this.from.x,this.from.y,this.to.x,this.to.y,A);else{const[I,l,c]=this._getCircleData(e);this._circle(e,t,I,l,c)}this.enableShadow(e,t),e.stroke(),this.disableShadow(e,t)}}findBorderPosition(e,t,i){return this.from!=this.to?this._findBorderPosition(e,t,i):this._findBorderPositionCircle(e,t,i)}findBorderPositions(e){if(this.from!=this.to)return{from:this._findBorderPosition(this.from,e),to:this._findBorderPosition(this.to,e)};{var t;const[i,o]=vi(t=this._getCircleData(e)).call(t,0,2);return{from:this._findBorderPositionCircle(this.from,e,{x:i,y:o,low:.25,high:.6,direction:-1}),to:this._findBorderPositionCircle(this.from,e,{x:i,y:o,low:.6,high:.8,direction:1})}}}_getCircleData(e){const t=this.options.selfReference.size;e!==void 0&&this.from.shape.width===void 0&&this.from.shape.resize(e);const i=Yw(e,this.options.selfReference.angle,t,this.from);return[i.x,i.y,t]}_pointOnCircle(e,t,i,o){const r=o*2*Math.PI;return{x:e+i*Math.cos(r),y:t-i*Math.sin(r)}}_findBorderPositionCircle(e,t,i){const o=i.x,r=i.y;let A=i.low,I=i.high;const l=i.direction,c=10,h=this.options.selfReference.size,p=.05;let m,y=(A+I)*.5,w=0;this.options.arrowStrikethrough===!0&&(l===-1?w=this.options.endPointOffset.from:l===1&&(w=this.options.endPointOffset.to));let S=0;do{y=(A+I)*.5,m=this._pointOnCircle(o,r,h,y);const x=Math.atan2(e.y-m.y,e.x-m.x),O=e.distanceToBorder(t,x)+w,E=Math.sqrt(Math.pow(m.x-e.x,2)+Math.pow(m.y-e.y,2)),_=O-E;if(Math.abs(_)0?l>0?A=y:I=y:l>0?I=y:A=y,++S}while(A<=I&&S1?h=1:h<0&&(h=0);const p=e+h*I,m=t+h*l,y=p-r,w=m-A;return Math.sqrt(y*y+w*w)}getArrowData(e,t,i,o,r,A){let I,l,c,h,p,m,y;const w=A.width;t==="from"?(c=this.from,h=this.to,p=A.fromArrowScale<0,m=Math.abs(A.fromArrowScale),y=A.fromArrowType):t==="to"?(c=this.to,h=this.from,p=A.toArrowScale<0,m=Math.abs(A.toArrowScale),y=A.toArrowType):(c=this.to,h=this.from,p=A.middleArrowScale<0,m=Math.abs(A.middleArrowScale),y=A.middleArrowType);const S=15*m+3*w;if(c!=h){const _=YX(c.x-h.x,c.y-h.y),P=S/_;if(t!=="middle")if(this.options.smooth.enabled===!0){const Q=this._findBorderPosition(c,e,{via:i}),ne=this.getPoint(Q.t+P*(t==="from"?1:-1),i);I=Math.atan2(Q.y-ne.y,Q.x-ne.x),l=Q}else I=Math.atan2(c.y-h.y,c.x-h.x),l=this._findBorderPosition(c,e);else{const Q=(p?-P:P)/2,ne=this.getPoint(.5+Q,i),j=this.getPoint(.5-Q,i);I=Math.atan2(ne.y-j.y,ne.x-j.x),l=this.getPoint(.5,i)}}else{const[_,P,Q]=this._getCircleData(e);if(t==="from"){const ne=this.options.selfReference.angle,j=this.options.selfReference.angle+Math.PI,V=this._findBorderPositionCircle(this.from,e,{x:_,y:P,low:ne,high:j,direction:-1});I=V.t*-2*Math.PI+1.5*Math.PI+.1*Math.PI,l=V}else if(t==="to"){const ne=this.options.selfReference.angle,j=this.options.selfReference.angle+Math.PI,V=this._findBorderPositionCircle(this.from,e,{x:_,y:P,low:ne,high:j,direction:1});I=V.t*-2*Math.PI+1.5*Math.PI-1.1*Math.PI,l=V}else{const ne=this.options.selfReference.angle/(2*Math.PI);l=this._pointOnCircle(_,P,Q,ne),I=ne*-2*Math.PI+1.5*Math.PI+.1*Math.PI}}const x=l.x-S*.9*Math.cos(I),O=l.y-S*.9*Math.sin(I);return{point:l,core:{x,y:O},angle:I,length:S,type:y}}drawArrowHead(e,t,i,o,r){e.strokeStyle=this.getColor(e,t),e.fillStyle=e.strokeStyle,e.lineWidth=t.width,qw.draw(e,r)&&(this.enableShadow(e,t),Ia(e).call(e),this.disableShadow(e,t))}enableShadow(e,t){t.shadow===!0&&(e.shadowColor=t.shadowColor,e.shadowBlur=t.shadowSize,e.shadowOffsetX=t.shadowX,e.shadowOffsetY=t.shadowY)}disableShadow(e,t){t.shadow===!0&&(e.shadowColor="rgba(0,0,0,0)",e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0)}drawBackground(e,t){if(t.background!==!1){const i={strokeStyle:e.strokeStyle,lineWidth:e.lineWidth,dashes:e.dashes};e.strokeStyle=t.backgroundColor,e.lineWidth=t.backgroundSize,this.setStrokeDashed(e,t.backgroundDashes),e.stroke(),e.strokeStyle=i.strokeStyle,e.lineWidth=i.lineWidth,e.dashes=i.dashes,this.setStrokeDashed(e,t.dashes)}}setStrokeDashed(e,t){if(t!==!1)if(e.setLineDash!==void 0){const i=et(t)?t:[5,5];e.setLineDash(i)}else console.warn("setLineDash is not supported in this browser. The dashed stroke cannot be used.");else e.setLineDash!==void 0?e.setLineDash([]):console.warn("setLineDash is not supported in this browser. The dashed stroke cannot be used.")}}function nx(n,e){var t=wt(n);if(_i){var i=_i(n);e&&(i=Qt(i).call(i,function(o){return ji(n,o).enumerable})),t.push.apply(t,i)}return t}function ix(n){for(var e=1;e2&&arguments[2]!==void 0?arguments[2]:this._getViaCoordinates();const o=10,r=.2;let A=!1,I=1,l=0,c=this.to,h,p,m=this.options.endPointOffset?this.options.endPointOffset.to:0;e.id===this.from.id&&(c=this.from,A=!0,m=this.options.endPointOffset?this.options.endPointOffset.from:0),this.options.arrowStrikethrough===!1&&(m=0);let y=0;do{p=(l+I)*.5,h=this.getPoint(p,i);const w=Math.atan2(c.y-h.y,c.x-h.x),S=c.distanceToBorder(t,w)+m,x=Math.sqrt(Math.pow(h.x-c.x,2)+Math.pow(h.y-c.y,2)),O=S-x;if(Math.abs(O)0&&(c=this._getDistanceToLine(w,S,m,y,r,A),l=c{this.positionBezierNode()},this._body.emitter.on("_repositionBezierNodes",this._boundFunction)}setOptions(e){super.setOptions(e);let t=!1;this.options.physics!==e.physics&&(t=!0),this.options=e,this.id=this.options.id,this.from=this._body.nodes[this.options.from],this.to=this._body.nodes[this.options.to],this.setupSupportNode(),this.connect(),t===!0&&(this.via.setOptions({physics:this.options.physics}),this.positionBezierNode())}connect(){this.from=this._body.nodes[this.options.from],this.to=this._body.nodes[this.options.to],this.from===void 0||this.to===void 0||this.options.physics===!1?this.via.setOptions({physics:!1}):this.from.id===this.to.id?this.via.setOptions({physics:!1}):this.via.setOptions({physics:!0})}cleanup(){return this._body.emitter.off("_repositionBezierNodes",this._boundFunction),this.via!==void 0?(delete this._body.nodes[this.via.id],this.via=void 0,!0):!1}setupSupportNode(){if(this.via===void 0){const e="edgeId:"+this.id,t=this._body.functions.createNode({id:e,shape:"circle",physics:!0,hidden:!0});this._body.nodes[e]=t,this.via=t,this.via.parentEdgeId=this.id,this.positionBezierNode()}}positionBezierNode(){this.via!==void 0&&this.from!==void 0&&this.to!==void 0?(this.via.x=.5*(this.from.x+this.to.x),this.via.y=.5*(this.from.y+this.to.y)):this.via!==void 0&&(this.via.x=0,this.via.y=0)}_line(e,t,i){this._bezierCurve(e,t,i)}_getViaCoordinates(){return this.via}getViaNode(){return this.via}getPoint(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.via;if(this.from===this.to){const[i,o,r]=this._getCircleData(),A=2*Math.PI*(1-e);return{x:i+r*Math.sin(A),y:o+r-r*(1-Math.cos(A))}}else return{x:Math.pow(1-e,2)*this.fromPoint.x+2*e*(1-e)*t.x+Math.pow(e,2)*this.toPoint.x,y:Math.pow(1-e,2)*this.fromPoint.y+2*e*(1-e)*t.y+Math.pow(e,2)*this.toPoint.y}}_findBorderPosition(e,t){return this._findBorderPositionBezier(e,t,this.via)}_getDistanceToEdge(e,t,i,o,r,A){return this._getDistanceToBezierEdge(e,t,i,o,r,A,this.via)}}class ox extends Su{constructor(e,t,i){super(e,t,i)}_line(e,t,i){this._bezierCurve(e,t,i)}getViaNode(){return this._getViaCoordinates()}_getViaCoordinates(){const e=this.options.smooth.roundness,t=this.options.smooth.type;let i=Math.abs(this.from.x-this.to.x),o=Math.abs(this.from.y-this.to.y);if(t==="discrete"||t==="diagonalCross"){let r,A;i<=o?r=A=e*o:r=A=e*i,this.from.x>this.to.x&&(r=-r),this.from.y>=this.to.y&&(A=-A);let I=this.from.x+r,l=this.from.y+A;return t==="discrete"&&(i<=o?I=ithis.to.x&&(r=-r),this.from.y>=this.to.y&&(A=-A);let I=this.from.x+r,l=this.from.y+A;return i<=o?this.from.x<=this.to.x?I=this.to.xI?this.to.x:I:this.from.y>=this.to.y?l=this.to.y>l?this.to.y:l:l=this.to.y2&&arguments[2]!==void 0?arguments[2]:{};return this._findBorderPositionBezier(e,t,i.via)}_getDistanceToEdge(e,t,i,o,r,A){let I=arguments.length>6&&arguments[6]!==void 0?arguments[6]:this._getViaCoordinates();return this._getDistanceToBezierEdge(e,t,i,o,r,A,I)}getPoint(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this._getViaCoordinates();const i=e,o=Math.pow(1-i,2)*this.fromPoint.x+2*i*(1-i)*t.x+Math.pow(i,2)*this.toPoint.x,r=Math.pow(1-i,2)*this.fromPoint.y+2*i*(1-i)*t.y+Math.pow(i,2)*this.toPoint.y;return{x:o,y:r}}}class g$ extends Su{constructor(e,t,i){super(e,t,i)}_getDistanceToBezierEdge2(e,t,i,o,r,A,I,l){let c=1e9,h=e,p=t;const m=[0,0,0,0];for(let y=1;y<10;y++){const w=.1*y;m[0]=Math.pow(1-w,3),m[1]=3*w*Math.pow(1-w,2),m[2]=3*Math.pow(w,2)*(1-w),m[3]=Math.pow(w,3);const S=m[0]*e+m[1]*I.x+m[2]*l.x+m[3]*i,x=m[0]*t+m[1]*I.y+m[2]*l.y+m[3]*o;if(y>0){const O=this._getDistanceToLine(h,p,S,x,r,A);c=OMath.abs(t)||this.options.smooth.forceDirection===!0||this.options.smooth.forceDirection==="horizontal")&&this.options.smooth.forceDirection!=="vertical"?(o=this.from.y,A=this.to.y,i=this.from.x-I*e,r=this.to.x+I*e):(o=this.from.y-I*t,A=this.to.y+I*t,i=this.from.x,r=this.to.x),[{x:i,y:o},{x:r,y:A}]}getViaNode(){return this._getViaCoordinates()}_findBorderPosition(e,t){return this._findBorderPositionBezier(e,t)}_getDistanceToEdge(e,t,i,o,r,A){let[I,l]=arguments.length>6&&arguments[6]!==void 0?arguments[6]:this._getViaCoordinates();return this._getDistanceToBezierEdge2(e,t,i,o,r,A,I,l)}getPoint(e){let[t,i]=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this._getViaCoordinates();const o=e,r=[Math.pow(1-o,3),3*o*Math.pow(1-o,2),3*Math.pow(o,2)*(1-o),Math.pow(o,3)],A=r[0]*this.fromPoint.x+r[1]*t.x+r[2]*i.x+r[3]*this.toPoint.x,I=r[0]*this.fromPoint.y+r[1]*t.y+r[2]*i.y+r[3]*this.toPoint.y;return{x:A,y:I}}}class rx extends tx{constructor(e,t,i){super(e,t,i)}_line(e,t){e.beginPath(),e.moveTo(this.fromPoint.x,this.fromPoint.y),e.lineTo(this.toPoint.x,this.toPoint.y),this.enableShadow(e,t),e.stroke(),this.disableShadow(e,t)}getViaNode(){}getPoint(e){return{x:(1-e)*this.fromPoint.x+e*this.toPoint.x,y:(1-e)*this.fromPoint.y+e*this.toPoint.y}}_findBorderPosition(e,t){let i=this.to,o=this.from;e.id===this.from.id&&(i=this.from,o=this.to);const r=Math.atan2(i.y-o.y,i.x-o.x),A=i.x-o.x,I=i.y-o.y,l=Math.sqrt(A*A+I*I),c=e.distanceToBorder(t,r),h=(l-c)/l;return{x:(1-h)*o.x+h*i.x,y:(1-h)*o.y+h*i.y,t:0}}_getDistanceToEdge(e,t,i,o,r,A){return this._getDistanceToLine(e,t,i,o,r,A)}}class jg{constructor(e,t,i,o,r){if(t===void 0)throw new Error("No body provided");this.options=Dg(o),this.globalOptions=o,this.defaultOptions=r,this.body=t,this.imagelist=i,this.id=void 0,this.fromId=void 0,this.toId=void 0,this.selected=!1,this.hover=!1,this.labelDirty=!0,this.baseWidth=this.options.width,this.baseFontSize=this.options.font.size,this.from=void 0,this.to=void 0,this.edgeType=void 0,this.connected=!1,this.labelModule=new Bs(this.body,this.options,!0),this.setOptions(e)}setOptions(e){if(!e)return;let t=typeof e.physics<"u"&&this.options.physics!==e.physics||typeof e.hidden<"u"&&(this.options.hidden||!1)!==(e.hidden||!1)||typeof e.from<"u"&&this.options.from!==e.from||typeof e.to<"u"&&this.options.to!==e.to;jg.parseOptions(this.options,e,!0,this.globalOptions),e.id!==void 0&&(this.id=e.id),e.from!==void 0&&(this.fromId=e.from),e.to!==void 0&&(this.toId=e.to),e.title!==void 0&&(this.title=e.title),e.value!==void 0&&(e.value=Uw(e.value));const i=[e,this.options,this.defaultOptions];return this.chooser=bu("edge",i),this.updateLabelModule(e),t=this.updateEdgeType()||t,this._setInteractionWidths(),this.connect(),t}static parseOptions(e,t){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},r=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1;if(Ds(["endPointOffset","arrowStrikethrough","id","from","hidden","hoverWidth","labelHighlightBold","length","line","opacity","physics","scaling","selectionWidth","selfReferenceSize","selfReference","to","title","value","width","font","chosen","widthConstraint"],e,t,i),t.endPointOffset!==void 0&&t.endPointOffset.from!==void 0&&(zo(t.endPointOffset.from)?e.endPointOffset.from=t.endPointOffset.from:(e.endPointOffset.from=o.endPointOffset.from!==void 0?o.endPointOffset.from:0,console.error("endPointOffset.from is not a valid number"))),t.endPointOffset!==void 0&&t.endPointOffset.to!==void 0&&(zo(t.endPointOffset.to)?e.endPointOffset.to=t.endPointOffset.to:(e.endPointOffset.to=o.endPointOffset.to!==void 0?o.endPointOffset.to:0,console.error("endPointOffset.to is not a valid number"))),XC(t.label)?e.label=t.label:XC(e.label)||(e.label=void 0),ii(e,t,"smooth",o),ii(e,t,"shadow",o),ii(e,t,"background",o),t.dashes!==void 0&&t.dashes!==null?e.dashes=t.dashes:i===!0&&t.dashes===null&&(e.dashes=Tg(o.dashes)),t.scaling!==void 0&&t.scaling!==null?(t.scaling.min!==void 0&&(e.scaling.min=t.scaling.min),t.scaling.max!==void 0&&(e.scaling.max=t.scaling.max),ii(e.scaling,t.scaling,"label",o.scaling)):i===!0&&t.scaling===null&&(e.scaling=Tg(o.scaling)),t.arrows!==void 0&&t.arrows!==null)if(typeof t.arrows=="string"){const I=t.arrows.toLowerCase();e.arrows.to.enabled=at(I).call(I,"to")!=-1,e.arrows.middle.enabled=at(I).call(I,"middle")!=-1,e.arrows.from.enabled=at(I).call(I,"from")!=-1}else if(typeof t.arrows=="object")ii(e.arrows,t.arrows,"to",o.arrows),ii(e.arrows,t.arrows,"middle",o.arrows),ii(e.arrows,t.arrows,"from",o.arrows);else throw new Error("The arrow newOptions can only be an object or a string. Refer to the documentation. You used:"+bs(t.arrows));else i===!0&&t.arrows===null&&(e.arrows=Tg(o.arrows));if(t.color!==void 0&&t.color!==null){const I=Ns(t.color)?{color:t.color,highlight:t.color,hover:t.color,inherit:!1,opacity:1}:t.color,l=e.color;if(r)mt(l,o.color,!1,i);else for(const c in l)Object.prototype.hasOwnProperty.call(l,c)&&delete l[c];if(Ns(l))l.color=l,l.highlight=l,l.hover=l,l.inherit=!1,I.opacity===void 0&&(l.opacity=1);else{let c=!1;I.color!==void 0&&(l.color=I.color,c=!0),I.highlight!==void 0&&(l.highlight=I.highlight,c=!0),I.hover!==void 0&&(l.hover=I.hover,c=!0),I.inherit!==void 0&&(l.inherit=I.inherit),I.opacity!==void 0&&(l.opacity=Math.min(1,Math.max(0,I.opacity))),c===!0?l.inherit=!1:l.inherit===void 0&&(l.inherit="from")}}else i===!0&&t.color===null&&(e.color=Dg(o.color));i===!0&&t.font===null&&(e.font=Dg(o.font)),Object.prototype.hasOwnProperty.call(t,"selfReferenceSize")&&(console.warn("The selfReferenceSize property has been deprecated. Please use selfReference property instead. The selfReference can be set like thise selfReference:{size:30, angle:Math.PI / 4}"),e.selfReference.size=t.selfReferenceSize)}getFormattingValues(){const e=this.options.arrows.to===!0||this.options.arrows.to.enabled===!0,t=this.options.arrows.from===!0||this.options.arrows.from.enabled===!0,i=this.options.arrows.middle===!0||this.options.arrows.middle.enabled===!0,o=this.options.color.inherit,r={toArrow:e,toArrowScale:this.options.arrows.to.scaleFactor,toArrowType:this.options.arrows.to.type,toArrowSrc:this.options.arrows.to.src,toArrowImageWidth:this.options.arrows.to.imageWidth,toArrowImageHeight:this.options.arrows.to.imageHeight,middleArrow:i,middleArrowScale:this.options.arrows.middle.scaleFactor,middleArrowType:this.options.arrows.middle.type,middleArrowSrc:this.options.arrows.middle.src,middleArrowImageWidth:this.options.arrows.middle.imageWidth,middleArrowImageHeight:this.options.arrows.middle.imageHeight,fromArrow:t,fromArrowScale:this.options.arrows.from.scaleFactor,fromArrowType:this.options.arrows.from.type,fromArrowSrc:this.options.arrows.from.src,fromArrowImageWidth:this.options.arrows.from.imageWidth,fromArrowImageHeight:this.options.arrows.from.imageHeight,arrowStrikethrough:this.options.arrowStrikethrough,color:o?void 0:this.options.color.color,inheritsColor:o,opacity:this.options.color.opacity,hidden:this.options.hidden,length:this.options.length,shadow:this.options.shadow.enabled,shadowColor:this.options.shadow.color,shadowSize:this.options.shadow.size,shadowX:this.options.shadow.x,shadowY:this.options.shadow.y,dashes:this.options.dashes,width:this.options.width,background:this.options.background.enabled,backgroundColor:this.options.background.color,backgroundSize:this.options.background.size,backgroundDashes:this.options.background.dashes};if(this.selected||this.hover)if(this.chooser===!0){if(this.selected){const A=this.options.selectionWidth;typeof A=="function"?r.width=A(r.width):typeof A=="number"&&(r.width+=A),r.width=Math.max(r.width,.3/this.body.view.scale),r.color=this.options.color.highlight,r.shadow=this.options.shadow.enabled}else if(this.hover){const A=this.options.hoverWidth;typeof A=="function"?r.width=A(r.width):typeof A=="number"&&(r.width+=A),r.width=Math.max(r.width,.3/this.body.view.scale),r.color=this.options.color.hover,r.shadow=this.options.shadow.enabled}}else typeof this.chooser=="function"&&(this.chooser(r,this.options.id,this.selected,this.hover),r.color!==void 0&&(r.inheritsColor=!1),r.shadow===!1&&(r.shadowColor!==this.options.shadow.color||r.shadowSize!==this.options.shadow.size||r.shadowX!==this.options.shadow.x||r.shadowY!==this.options.shadow.y)&&(r.shadow=!0));else r.shadow=this.options.shadow.enabled,r.width=Math.max(r.width,.3/this.body.view.scale);return r}updateLabelModule(e){const t=[e,this.options,this.globalOptions,this.defaultOptions];this.labelModule.update(this.options,t),this.labelModule.baseSize!==void 0&&(this.baseFontSize=this.labelModule.baseSize)}updateEdgeType(){const e=this.options.smooth;let t=!1,i=!0;return this.edgeType!==void 0&&((this.edgeType instanceof gx&&e.enabled===!0&&e.type==="dynamic"||this.edgeType instanceof sx&&e.enabled===!0&&e.type==="cubicBezier"||this.edgeType instanceof ox&&e.enabled===!0&&e.type!=="dynamic"&&e.type!=="cubicBezier"||this.edgeType instanceof rx&&e.type.enabled===!1)&&(i=!1),i===!0&&(t=this.cleanup())),i===!0?e.enabled===!0?e.type==="dynamic"?(t=!0,this.edgeType=new gx(this.options,this.body,this.labelModule)):e.type==="cubicBezier"?this.edgeType=new sx(this.options,this.body,this.labelModule):this.edgeType=new ox(this.options,this.body,this.labelModule):this.edgeType=new rx(this.options,this.body,this.labelModule):this.edgeType.setOptions(this.options),t}connect(){this.disconnect(),this.from=this.body.nodes[this.fromId]||void 0,this.to=this.body.nodes[this.toId]||void 0,this.connected=this.from!==void 0&&this.to!==void 0,this.connected===!0?(this.from.attachEdge(this),this.to.attachEdge(this)):(this.from&&this.from.detachEdge(this),this.to&&this.to.detachEdge(this)),this.edgeType.connect()}disconnect(){this.from&&(this.from.detachEdge(this),this.from=void 0),this.to&&(this.to.detachEdge(this),this.to=void 0),this.connected=!1}getTitle(){return this.title}isSelected(){return this.selected}getValue(){return this.options.value}setValueRange(e,t,i){if(this.options.value!==void 0){const o=this.options.scaling.customScalingFunction(e,t,i,this.options.value),r=this.options.scaling.max-this.options.scaling.min;if(this.options.scaling.label.enabled===!0){const A=this.options.scaling.label.max-this.options.scaling.label.min;this.options.font.size=this.options.scaling.label.min+o*A}this.options.width=this.options.scaling.min+o*r}else this.options.width=this.baseWidth,this.options.font.size=this.baseFontSize;this._setInteractionWidths(),this.updateLabelModule()}_setInteractionWidths(){typeof this.options.hoverWidth=="function"?this.edgeType.hoverWidth=this.options.hoverWidth(this.options.width):this.edgeType.hoverWidth=this.options.hoverWidth+this.options.width,typeof this.options.selectionWidth=="function"?this.edgeType.selectionWidth=this.options.selectionWidth(this.options.width):this.edgeType.selectionWidth=this.options.selectionWidth+this.options.width}draw(e){const t=this.getFormattingValues();if(t.hidden)return;const i=this.edgeType.getViaNode();this.edgeType.drawLine(e,t,this.selected,this.hover,i),this.drawLabel(e,i)}drawArrows(e){const t=this.getFormattingValues();if(t.hidden)return;const i=this.edgeType.getViaNode(),o={};this.edgeType.fromPoint=this.edgeType.from,this.edgeType.toPoint=this.edgeType.to,t.fromArrow&&(o.from=this.edgeType.getArrowData(e,"from",i,this.selected,this.hover,t),t.arrowStrikethrough===!1&&(this.edgeType.fromPoint=o.from.core),t.fromArrowSrc&&(o.from.image=this.imagelist.load(t.fromArrowSrc)),t.fromArrowImageWidth&&(o.from.imageWidth=t.fromArrowImageWidth),t.fromArrowImageHeight&&(o.from.imageHeight=t.fromArrowImageHeight)),t.toArrow&&(o.to=this.edgeType.getArrowData(e,"to",i,this.selected,this.hover,t),t.arrowStrikethrough===!1&&(this.edgeType.toPoint=o.to.core),t.toArrowSrc&&(o.to.image=this.imagelist.load(t.toArrowSrc)),t.toArrowImageWidth&&(o.to.imageWidth=t.toArrowImageWidth),t.toArrowImageHeight&&(o.to.imageHeight=t.toArrowImageHeight)),t.middleArrow&&(o.middle=this.edgeType.getArrowData(e,"middle",i,this.selected,this.hover,t),t.middleArrowSrc&&(o.middle.image=this.imagelist.load(t.middleArrowSrc)),t.middleArrowImageWidth&&(o.middle.imageWidth=t.middleArrowImageWidth),t.middleArrowImageHeight&&(o.middle.imageHeight=t.middleArrowImageHeight)),t.fromArrow&&this.edgeType.drawArrowHead(e,t,this.selected,this.hover,o.from),t.middleArrow&&this.edgeType.drawArrowHead(e,t,this.selected,this.hover,o.middle),t.toArrow&&this.edgeType.drawArrowHead(e,t,this.selected,this.hover,o.to)}drawLabel(e,t){if(this.options.label!==void 0){const i=this.from,o=this.to;this.labelModule.differentState(this.selected,this.hover)&&this.labelModule.getTextSize(e,this.selected,this.hover);let r;if(i.id!=o.id){this.labelModule.pointToSelf=!1,r=this.edgeType.getPoint(.5,t),e.save();const A=this._getRotation(e);A.angle!=0&&(e.translate(A.x,A.y),e.rotate(A.angle)),this.labelModule.draw(e,r.x,r.y,this.selected,this.hover),e.restore()}else{this.labelModule.pointToSelf=!0;const A=Yw(e,this.options.selfReference.angle,this.options.selfReference.size,i);r=this._pointOnCircle(A.x,A.y,this.options.selfReference.size,this.options.selfReference.angle),this.labelModule.draw(e,r.x,r.y,this.selected,this.hover)}}}getItemsOnPoint(e){const t=[];if(this.labelModule.visible()){const o=this._getRotation();wu(this.labelModule.getSize(),e,o)&&t.push({edgeId:this.id,labelId:0})}const i={left:e.x,top:e.y};return this.isOverlappingWith(i)&&t.push({edgeId:this.id}),t}isOverlappingWith(e){if(this.connected){const i=this.from.x,o=this.from.y,r=this.to.x,A=this.to.y,I=e.left,l=e.top;return this.edgeType.getDistanceToEdge(i,o,r,A,I,l)<10}else return!1}_getRotation(e){const t=this.edgeType.getViaNode(),i=this.edgeType.getPoint(.5,t);e!==void 0&&this.labelModule.calculateLabelSize(e,this.selected,this.hover,i.x,i.y);const o={x:i.x,y:this.labelModule.size.yLine,angle:0};if(!this.labelModule.visible()||this.options.font.align==="horizontal")return o;const r=this.from.y-this.to.y,A=this.from.x-this.to.x;let I=Math.atan2(r,A);return(I<-1&&A<0||I>0&&A<0)&&(I+=Math.PI),o.angle=I,o}_pointOnCircle(e,t,i,o){return{x:e+i*Math.cos(o),y:t-i*Math.sin(o)}}select(){this.selected=!0}unselect(){this.selected=!1}cleanup(){return this.edgeType.cleanup()}remove(){this.cleanup(),this.disconnect(),delete this.body.edges[this.id]}endPointsValid(){return this.body.nodes[this.fromId]!==void 0&&this.body.nodes[this.toId]!==void 0}}class o${constructor(e,t,i){var o;this.body=e,this.images=t,this.groups=i,this.body.functions.createEdge=ge(o=this.create).call(o,this),this.edgesListeners={add:(r,A)=>{this.add(A.items)},update:(r,A)=>{this.update(A.items)},remove:(r,A)=>{this.remove(A.items)}},this.options={},this.defaultOptions={arrows:{to:{enabled:!1,scaleFactor:1,type:"arrow"},middle:{enabled:!1,scaleFactor:1,type:"arrow"},from:{enabled:!1,scaleFactor:1,type:"arrow"}},endPointOffset:{from:0,to:0},arrowStrikethrough:!0,color:{color:"#848484",highlight:"#848484",hover:"#848484",inherit:"from",opacity:1},dashes:!1,font:{color:"#343434",size:14,face:"arial",background:"none",strokeWidth:2,strokeColor:"#ffffff",align:"horizontal",multi:!1,vadjust:0,bold:{mod:"bold"},boldital:{mod:"bold italic"},ital:{mod:"italic"},mono:{mod:"",size:15,face:"courier new",vadjust:2}},hidden:!1,hoverWidth:1.5,label:void 0,labelHighlightBold:!0,length:void 0,physics:!0,scaling:{min:1,max:15,label:{enabled:!0,min:14,max:30,maxVisible:30,drawThreshold:5},customScalingFunction:function(r,A,I,l){if(A===r)return .5;{const c=1/(A-r);return Math.max(0,(l-r)*c)}}},selectionWidth:1.5,selfReference:{size:20,angle:Math.PI/4,renderBehindTheNode:!0},shadow:{enabled:!1,color:"rgba(0,0,0,0.5)",size:10,x:5,y:5},background:{enabled:!1,color:"rgba(111,111,111,1)",size:10,dashes:!1},smooth:{enabled:!0,type:"dynamic",forceDirection:"none",roundness:.5},title:void 0,width:1,value:void 0},mt(this.options,this.defaultOptions),this.bindEventListeners()}bindEventListeners(){var e=this,t,i;this.body.emitter.on("_forceDisableDynamicCurves",function(o){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;o==="dynamic"&&(o="continuous");let A=!1;for(const I in e.body.edges)if(Object.prototype.hasOwnProperty.call(e.body.edges,I)){const l=e.body.edges[I],c=e.body.data.edges.get(I);if(c!=null){const h=c.smooth;h!==void 0&&h.enabled===!0&&h.type==="dynamic"&&(o===void 0?l.setOptions({smooth:!1}):l.setOptions({smooth:{type:o}}),A=!0)}}r===!0&&A===!0&&e.body.emitter.emit("_dataChanged")}),this.body.emitter.on("_dataUpdated",()=>{this.reconnectEdges()}),this.body.emitter.on("refreshEdges",ge(t=this.refresh).call(t,this)),this.body.emitter.on("refresh",ge(i=this.refresh).call(i,this)),this.body.emitter.on("destroy",()=>{Ye(this.edgesListeners,(o,r)=>{this.body.data.edges&&this.body.data.edges.off(r,o)}),delete this.body.functions.createEdge,delete this.edgesListeners.add,delete this.edgesListeners.update,delete this.edgesListeners.remove,delete this.edgesListeners})}setOptions(e){if(e!==void 0){jg.parseOptions(this.options,e,!0,this.defaultOptions,!0);let t=!1;if(e.smooth!==void 0)for(const i in this.body.edges)Object.prototype.hasOwnProperty.call(this.body.edges,i)&&(t=this.body.edges[i].updateEdgeType()||t);if(e.font!==void 0)for(const i in this.body.edges)Object.prototype.hasOwnProperty.call(this.body.edges,i)&&this.body.edges[i].updateLabelModule();(e.hidden!==void 0||e.physics!==void 0||t===!0)&&this.body.emitter.emit("_dataChanged")}}setData(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;const i=this.body.data.edges;if(Pw("id",e))this.body.data.edges=e;else if(et(e))this.body.data.edges=new Zs,this.body.data.edges.add(e);else if(!e)this.body.data.edges=new Zs;else throw new TypeError("Array or DataSet expected");if(i&&Ye(this.edgesListeners,(o,r)=>{i.off(r,o)}),this.body.edges={},this.body.data.edges){Ye(this.edgesListeners,(r,A)=>{this.body.data.edges.on(A,r)});const o=this.body.data.edges.getIds();this.add(o,!0)}this.body.emitter.emit("_adjustEdgesForHierarchicalLayout"),t===!1&&this.body.emitter.emit("_dataChanged")}add(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;const i=this.body.edges,o=this.body.data.edges;for(let r=0;r1&&arguments[1]!==void 0?arguments[1]:!0;if(e.length===0)return;const i=this.body.edges;Ye(e,o=>{const r=i[o];r!==void 0&&r.remove()}),t&&this.body.emitter.emit("_dataChanged")}refresh(){Ye(this.body.edges,(e,t)=>{const i=this.body.data.edges.get(t);i!==void 0&&e.setOptions(i)})}create(e){return new jg(e,this.body,this.images,this.options,this.defaultOptions)}reconnectEdges(){let e;const t=this.body.nodes,i=this.body.edges;for(e in t)Object.prototype.hasOwnProperty.call(t,e)&&(t[e].edges=[]);for(e in i)if(Object.prototype.hasOwnProperty.call(i,e)){const o=i[e];o.from=null,o.to=null,o.connect()}}getConnectedNodes(e){const t=[];if(this.body.edges[e]!==void 0){const i=this.body.edges[e];i.fromId!==void 0&&t.push(i.fromId),i.toId!==void 0&&t.push(i.toId)}return t}_updateState(){this._addMissingEdges(),this._removeInvalidEdges()}_removeInvalidEdges(){const e=[];Ye(this.body.edges,(t,i)=>{const o=this.body.nodes[t.toId],r=this.body.nodes[t.fromId];o!==void 0&&o.isCluster===!0||r!==void 0&&r.isCluster===!0||(o===void 0||r===void 0)&&e.push(i)}),this.remove(e,!1)}_addMissingEdges(){const e=this.body.data.edges;if(e==null)return;const t=this.body.edges,i=[];Je(e).call(e,(o,r)=>{t[r]===void 0&&i.push(r)}),this.add(i,!0)}}class ax{constructor(e,t,i){this.body=e,this.physicsBody=t,this.barnesHutTree,this.setOptions(i),this._rng=jC("BARNES HUT SOLVER")}setOptions(e){this.options=e,this.thetaInversed=1/this.options.theta,this.overlapAvoidanceFactor=1-Math.max(0,Math.min(1,this.options.avoidOverlap))}solve(){if(this.options.gravitationalConstant!==0&&this.physicsBody.physicsNodeIndices.length>0){let e;const t=this.body.nodes,i=this.physicsBody.physicsNodeIndices,o=i.length,r=this._formBarnesHutTree(t,i);this.barnesHutTree=r;for(let A=0;A0&&this._getForceContributions(r.root,e)}}_getForceContributions(e,t){this._getForceContribution(e.children.NW,t),this._getForceContribution(e.children.NE,t),this._getForceContribution(e.children.SW,t),this._getForceContribution(e.children.SE,t)}_getForceContribution(e,t){if(e.childrenCount>0){const i=e.centerOfMass.x-t.x,o=e.centerOfMass.y-t.y,r=Math.sqrt(i*i+o*o);r*e.calcSize>this.thetaInversed?this._calculateForces(r,i,o,t,e):e.childrenCount===4?this._getForceContributions(e,t):e.children.data.id!=t.id&&this._calculateForces(r,i,o,t,e)}}_calculateForces(e,t,i,o,r){e===0&&(e=.1,t=e),this.overlapAvoidanceFactor<1&&o.shape.radius&&(e=Math.max(.1+this.overlapAvoidanceFactor*o.shape.radius,e-o.shape.radius));const A=this.options.gravitationalConstant*r.mass*o.options.mass/Math.pow(e,3),I=t*A,l=i*A;this.physicsBody.forces[o.id].x+=I,this.physicsBody.forces[o.id].y+=l}_formBarnesHutTree(e,t){let i;const o=t.length;let r=e[t[0]].x,A=e[t[0]].y,I=e[t[0]].x,l=e[t[0]].y;for(let x=1;x0&&(EI&&(I=E),_l&&(l=_))}const c=Math.abs(I-r)-Math.abs(l-A);c>0?(A-=.5*c,l+=.5*c):(r+=.5*c,I-=.5*c);const p=Math.max(1e-5,Math.abs(I-r)),m=.5*p,y=.5*(r+I),w=.5*(A+l),S={root:{centerOfMass:{x:0,y:0},mass:0,range:{minX:y-m,maxX:y+m,minY:w-m,maxY:w+m},size:p,calcSize:1/p,children:{data:null},maxWidth:0,level:0,childrenCount:4}};this._splitBranch(S.root);for(let x=0;x0&&this._placeInTree(S.root,i);return S}_updateBranchMass(e,t){const i=e.centerOfMass,o=e.mass+t.options.mass,r=1/o;i.x=i.x*e.mass+t.x*t.options.mass,i.x*=r,i.y=i.y*e.mass+t.y*t.options.mass,i.y*=r,e.mass=o;const A=Math.max(Math.max(t.height,t.radius),t.width);e.maxWidth=e.maxWidtht.x?o.maxY>t.y?r="NW":r="SW":o.maxY>t.y?r="NE":r="SE",this._placeInRegion(e,t,r)}_placeInRegion(e,t,i){const o=e.children[i];switch(o.childrenCount){case 0:o.children.data=t,o.childrenCount=1,this._updateBranchMass(o,t);break;case 1:o.children.data.x===t.x&&o.children.data.y===t.y?(t.x+=this._rng(),t.y+=this._rng()):(this._splitBranch(o),this._placeInTree(o,t));break;case 4:this._placeInTree(o,t);break}}_splitBranch(e){let t=null;e.childrenCount===1&&(t=e.children.data,e.mass=0,e.centerOfMass.x=0,e.centerOfMass.y=0),e.childrenCount=4,e.children.data=null,this._insertRegion(e,"NW"),this._insertRegion(e,"NE"),this._insertRegion(e,"SW"),this._insertRegion(e,"SE"),t!=null&&this._placeInTree(e,t)}_insertRegion(e,t){let i,o,r,A;const I=.5*e.size;switch(t){case"NW":i=e.range.minX,o=e.range.minX+I,r=e.range.minY,A=e.range.minY+I;break;case"NE":i=e.range.minX+I,o=e.range.maxX,r=e.range.minY,A=e.range.minY+I;break;case"SW":i=e.range.minX,o=e.range.minX+I,r=e.range.minY+I,A=e.range.maxY;break;case"SE":i=e.range.minX+I,o=e.range.maxX,r=e.range.minY+I,A=e.range.maxY;break}e.children[t]={centerOfMass:{x:0,y:0},mass:0,range:{minX:i,maxX:o,minY:r,maxY:A},size:.5*e.size,calcSize:2*e.calcSize,children:{data:null},maxWidth:0,level:e.level+1,childrenCount:0}}_debug(e,t){this.barnesHutTree!==void 0&&(e.lineWidth=1,this._drawBranch(this.barnesHutTree.root,e,t))}_drawBranch(e,t,i){i===void 0&&(i="#FF0000"),e.childrenCount===4&&(this._drawBranch(e.children.NW,t),this._drawBranch(e.children.NE,t),this._drawBranch(e.children.SE,t),this._drawBranch(e.children.SW,t)),t.strokeStyle=i,t.beginPath(),t.moveTo(e.range.minX,e.range.minY),t.lineTo(e.range.maxX,e.range.minY),t.stroke(),t.beginPath(),t.moveTo(e.range.maxX,e.range.minY),t.lineTo(e.range.maxX,e.range.maxY),t.stroke(),t.beginPath(),t.moveTo(e.range.maxX,e.range.maxY),t.lineTo(e.range.minX,e.range.maxY),t.stroke(),t.beginPath(),t.moveTo(e.range.minX,e.range.maxY),t.lineTo(e.range.minX,e.range.minY),t.stroke()}}class s${constructor(e,t,i){this._rng=jC("REPULSION SOLVER"),this.body=e,this.physicsBody=t,this.setOptions(i)}setOptions(e){this.options=e}solve(){let e,t,i,o,r,A,I,l;const c=this.body.nodes,h=this.physicsBody.physicsNodeIndices,p=this.physicsBody.forces,m=this.options.nodeDistance,y=-2/3/m,w=4/3;for(let S=0;S0){const A=r.edges.length+1,I=this.options.centralGravity*A*r.options.mass;o[r.id].x=t*I,o[r.id].y=i*I}}}class I${constructor(e){this.body=e,this.physicsBody={physicsNodeIndices:[],physicsEdgeIndices:[],forces:{},velocities:{}},this.physicsEnabled=!0,this.simulationInterval=1e3/60,this.requiresTimeout=!0,this.previousStates={},this.referenceState={},this.freezeCache={},this.renderTimer=void 0,this.adaptiveTimestep=!1,this.adaptiveTimestepEnabled=!1,this.adaptiveCounter=0,this.adaptiveInterval=3,this.stabilized=!1,this.startedStabilization=!1,this.stabilizationIterations=0,this.ready=!1,this.options={},this.defaultOptions={enabled:!0,barnesHut:{theta:.5,gravitationalConstant:-2e3,centralGravity:.3,springLength:95,springConstant:.04,damping:.09,avoidOverlap:0},forceAtlas2Based:{theta:.5,gravitationalConstant:-50,centralGravity:.01,springConstant:.08,springLength:100,damping:.4,avoidOverlap:0},repulsion:{centralGravity:.2,springLength:200,springConstant:.05,nodeDistance:100,damping:.09,avoidOverlap:0},hierarchicalRepulsion:{centralGravity:0,springLength:100,springConstant:.01,nodeDistance:120,damping:.09},maxVelocity:50,minVelocity:.75,solver:"barnesHut",stabilization:{enabled:!0,iterations:1e3,updateInterval:50,onlyDynamicEdges:!1,fit:!0},timestep:.5,adaptiveTimestep:!0,wind:{x:0,y:0}},Vt(this.options,this.defaultOptions),this.timestep=.5,this.layoutFailed=!1,this.bindEventListeners()}bindEventListeners(){this.body.emitter.on("initPhysics",()=>{this.initPhysics()}),this.body.emitter.on("_layoutFailed",()=>{this.layoutFailed=!0}),this.body.emitter.on("resetPhysics",()=>{this.stopSimulation(),this.ready=!1}),this.body.emitter.on("disablePhysics",()=>{this.physicsEnabled=!1,this.stopSimulation()}),this.body.emitter.on("restorePhysics",()=>{this.setOptions(this.options),this.ready===!0&&this.startSimulation()}),this.body.emitter.on("startSimulation",()=>{this.ready===!0&&this.startSimulation()}),this.body.emitter.on("stopSimulation",()=>{this.stopSimulation()}),this.body.emitter.on("destroy",()=>{this.stopSimulation(!1),this.body.emitter.off()}),this.body.emitter.on("_dataChanged",()=>{this.updatePhysicsData()})}setOptions(e){if(e!==void 0)if(e===!1)this.options.enabled=!1,this.physicsEnabled=!1,this.stopSimulation();else if(e===!0)this.options.enabled=!0,this.physicsEnabled=!0,this.startSimulation();else{this.physicsEnabled=!0,ZC(["stabilization"],this.options,e),ii(this.options,e,"stabilization"),e.enabled===void 0&&(this.options.enabled=!0),this.options.enabled===!1&&(this.physicsEnabled=!1,this.stopSimulation());const t=this.options.wind;t&&((typeof t.x!="number"||au(t.x))&&(t.x=0),(typeof t.y!="number"||au(t.y))&&(t.y=0)),this.timestep=this.options.timestep}this.init()}init(){let e;this.options.solver==="forceAtlas2Based"?(e=this.options.forceAtlas2Based,this.nodesSolver=new A$(this.body,this.physicsBody,e),this.edgesSolver=new Eu(this.body,this.physicsBody,e),this.gravitySolver=new C$(this.body,this.physicsBody,e)):this.options.solver==="repulsion"?(e=this.options.repulsion,this.nodesSolver=new s$(this.body,this.physicsBody,e),this.edgesSolver=new Eu(this.body,this.physicsBody,e),this.gravitySolver=new $C(this.body,this.physicsBody,e)):this.options.solver==="hierarchicalRepulsion"?(e=this.options.hierarchicalRepulsion,this.nodesSolver=new r$(this.body,this.physicsBody,e),this.edgesSolver=new a$(this.body,this.physicsBody,e),this.gravitySolver=new $C(this.body,this.physicsBody,e)):(e=this.options.barnesHut,this.nodesSolver=new ax(this.body,this.physicsBody,e),this.edgesSolver=new Eu(this.body,this.physicsBody,e),this.gravitySolver=new $C(this.body,this.physicsBody,e)),this.modelOptions=e}initPhysics(){this.physicsEnabled===!0&&this.options.enabled===!0?this.options.stabilization.enabled===!0?this.stabilize():(this.stabilized=!1,this.ready=!0,this.body.emitter.emit("fit",{},this.layoutFailed),this.startSimulation()):(this.ready=!0,this.body.emitter.emit("fit"))}startSimulation(){if(this.physicsEnabled===!0&&this.options.enabled===!0){if(this.stabilized=!1,this.adaptiveTimestep=!1,this.body.emitter.emit("_resizeNodes"),this.viewFunction===void 0){var e;this.viewFunction=ge(e=this.simulationStep).call(e,this),this.body.emitter.on("initRedraw",this.viewFunction),this.body.emitter.emit("_startRendering")}}else this.body.emitter.emit("_redraw")}stopSimulation(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;this.stabilized=!0,e===!0&&this._emitStabilized(),this.viewFunction!==void 0&&(this.body.emitter.off("initRedraw",this.viewFunction),this.viewFunction=void 0,e===!0&&this.body.emitter.emit("_stopRendering"))}simulationStep(){const e=SC();this.physicsTick(),(SC()-e<.4*this.simulationInterval||this.runDoubleSpeed===!0)&&this.stabilized===!1&&(this.physicsTick(),this.runDoubleSpeed=!0),this.stabilized===!0&&this.stopSimulation()}_emitStabilized(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.stabilizationIterations;(this.stabilizationIterations>1||this.startedStabilization===!0)&&Mi(()=>{this.body.emitter.emit("stabilized",{iterations:e}),this.startedStabilization=!1,this.stabilizationIterations=0},0)}physicsStep(){this.gravitySolver.solve(),this.nodesSolver.solve(),this.edgesSolver.solve(),this.moveNodes()}adjustTimeStep(){this._evaluateStepQuality()===!0?this.timestep=1.2*this.timestep:this.timestep/1.2A))return!1;return!0}moveNodes(){const e=this.physicsBody.physicsNodeIndices;let t=0,i=0;const o=5;for(let r=0;rA&&(e=e>0?A:-A),e}_performStep(e){const t=this.body.nodes[e],i=this.physicsBody.forces[e];this.options.wind&&(i.x+=this.options.wind.x,i.y+=this.options.wind.y);const o=this.physicsBody.velocities[e];return this.previousStates[e]={x:t.x,y:t.y,vx:o.x,vy:o.y},t.options.fixed.x===!1?(o.x=this.calculateComponentVelocity(o.x,i.x,t.options.mass),t.x+=o.x*this.timestep):(i.x=0,o.x=0),t.options.fixed.y===!1?(o.y=this.calculateComponentVelocity(o.y,i.y,t.options.mass),t.y+=o.y*this.timestep):(i.y=0,o.y=0),Math.sqrt(Math.pow(o.x,2)+Math.pow(o.y,2))}_freezeNodes(){const e=this.body.nodes;for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&e[t].x&&e[t].y){const i=e[t].options.fixed;this.freezeCache[t]={x:i.x,y:i.y},i.x=!0,i.y=!0}}_restoreFrozenNodes(){const e=this.body.nodes;for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&this.freezeCache[t]!==void 0&&(e[t].options.fixed.x=this.freezeCache[t].x,e[t].options.fixed.y=this.freezeCache[t].y);this.freezeCache={}}stabilize(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.options.stabilization.iterations;if(typeof e!="number"&&(e=this.options.stabilization.iterations,console.error("The stabilize method needs a numeric amount of iterations. Switching to default: ",e)),this.physicsBody.physicsNodeIndices.length===0){this.ready=!0;return}this.adaptiveTimestep=this.options.adaptiveTimestep,this.body.emitter.emit("_resizeNodes"),this.stopSimulation(),this.stabilized=!1,this.body.emitter.emit("_blockRedraw"),this.targetIterations=e,this.options.stabilization.onlyDynamicEdges===!0&&this._freezeNodes(),this.stabilizationIterations=0,Mi(()=>this._stabilizationBatch(),0)}_startStabilizing(){return this.startedStabilization===!0?!1:(this.body.emitter.emit("startStabilizing"),this.startedStabilization=!0,!0)}_stabilizationBatch(){const e=()=>this.stabilized===!1&&this.stabilizationIterations{this.body.emitter.emit("stabilizationProgress",{iterations:this.stabilizationIterations,total:this.targetIterations})};this._startStabilizing()&&t();let i=0;for(;e()&&i1&&arguments[1]!==void 0?arguments[1]:[],i=1e9,o=-1e9,r=1e9,A=-1e9,I;if(t.length>0)for(let l=0;lI.shape.boundingBox.left&&(r=I.shape.boundingBox.left),AI.shape.boundingBox.top&&(i=I.shape.boundingBox.top),o1&&arguments[1]!==void 0?arguments[1]:[],i=1e9,o=-1e9,r=1e9,A=-1e9,I;if(t.length>0)for(let l=0;lI.x&&(r=I.x),AI.y&&(i=I.y),o{delete this.containedEdges[i.id]}),Ye(t.containedNodes,(i,o)=>{this.containedNodes[o]=i}),t.containedNodes={},Ye(t.containedEdges,(i,o)=>{this.containedEdges[o]=i}),t.containedEdges={},Ye(t.edges,i=>{Ye(this.edges,o=>{var r,A;const I=at(r=o.clusteringEdgeReplacingIds).call(r,i.id);I!==-1&&(Ye(i.clusteringEdgeReplacingIds,l=>{o.clusteringEdgeReplacingIds.push(l),this.body.edges[l].edgeReplacedById=o.id}),Di(A=o.clusteringEdgeReplacingIds).call(A,I,1))})}),t.edges=[]}}class c${constructor(e){this.body=e,this.clusteredNodes={},this.clusteredEdges={},this.options={},this.defaultOptions={},Vt(this.options,this.defaultOptions),this.body.emitter.on("_resetData",()=>{this.clusteredNodes={},this.clusteredEdges={}})}clusterByHubsize(e,t){e===void 0?e=this._getHubSize():typeof e=="object"&&(t=this._checkOptions(e),e=this._getHubSize());const i=[];for(let o=0;o=e&&i.push(r.id)}for(let o=0;o0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(e.joinCondition===void 0)throw new Error("Cannot call clusterByNodeData without a joinCondition function in the options.");e=this._checkOptions(e);const i={},o={};Ye(this.body.nodes,(r,A)=>{r.options&&e.joinCondition(r.options)===!0&&(i[A]=r,Ye(r.edges,I=>{this.clusteredEdges[I.id]===void 0&&(o[I.id]=I)}))}),this._cluster(i,o,e,t)}clusterByEdgeCount(e,t){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;t=this._checkOptions(t);const o=[],r={};let A,I,l;for(let c=0;c0&&wt(p).length>0&&S===!0){const O=function(){for(let E=0;E1&&arguments[1]!==void 0?arguments[1]:!0;this.clusterByEdgeCount(1,e,t)}clusterBridges(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;this.clusterByEdgeCount(2,e,t)}clusterByConnection(e,t){var i;let o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(e===void 0)throw new Error("No nodeId supplied to clusterByConnection!");if(this.body.nodes[e]===void 0)throw new Error("The nodeId given to clusterByConnection does not exist!");const r=this.body.nodes[e];t=this._checkOptions(t,r),t.clusterNodeProperties.x===void 0&&(t.clusterNodeProperties.x=r.x),t.clusterNodeProperties.y===void 0&&(t.clusterNodeProperties.y=r.y),t.clusterNodeProperties.fixed===void 0&&(t.clusterNodeProperties.fixed={},t.clusterNodeProperties.fixed.x=r.options.fixed.x,t.clusterNodeProperties.fixed.y=r.options.fixed.y);const A={},I={},l=r.id,c=En.cloneOptions(r);A[l]=r;for(let p=0;p-1&&(I[w.id]=w)}}this._cluster(A,I,t,o)}_createClusterEdges(e,t,i,o){let r,A,I,l,c,h;const p=wt(e),m=[];for(let S=0;S0&&arguments[0]!==void 0?arguments[0]:{};return e.clusterEdgeProperties===void 0&&(e.clusterEdgeProperties={}),e.clusterNodeProperties===void 0&&(e.clusterNodeProperties={}),e}_cluster(e,t,i){let o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0;const r=[];for(const h in e)Object.prototype.hasOwnProperty.call(e,h)&&this.clusteredNodes[h]!==void 0&&r.push(h);for(let h=0;ho?I.x:o,r=I.yA?I.y:A;return{x:.5*(i+o),y:.5*(r+A)}}openCluster(e,t){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(e===void 0)throw new Error("No clusterNodeId supplied to openCluster.");const o=this.body.nodes[e];if(o===void 0)throw new Error("The clusterNodeId supplied to openCluster does not exist.");if(o.isCluster!==!0||o.containedNodes===void 0||o.containedEdges===void 0)throw new Error("The node:"+e+" is not a valid cluster.");const r=this.findNode(e),A=at(r).call(r,e)-1;if(A>=0){const h=r[A];this.body.nodes[h]._openChildCluster(e),delete this.body.nodes[e],i===!0&&this.body.emitter.emit("_dataChanged");return}const I=o.containedNodes,l=o.containedEdges;if(t!==void 0&&t.releaseFunction!==void 0&&typeof t.releaseFunction=="function"){const h={},p={x:o.x,y:o.y};for(const y in I)if(Object.prototype.hasOwnProperty.call(I,y)){const w=this.body.nodes[y];h[y]={x:w.x,y:w.y}}const m=t.releaseFunction(p,h);for(const y in I)if(Object.prototype.hasOwnProperty.call(I,y)){const w=this.body.nodes[y];m[y]!==void 0&&(w.x=m[y].x===void 0?o.x:m[y].x,w.y=m[y].y===void 0?o.y:m[y].y)}}else Ye(I,function(h){h.options.fixed.x===!1&&(h.x=o.x),h.options.fixed.y===!1&&(h.y=o.y)});for(const h in I)if(Object.prototype.hasOwnProperty.call(I,h)){const p=this.body.nodes[h];p.vx=o.vx,p.vy=o.vy,p.setOptions({physics:!0}),delete this.clusteredNodes[h]}const c=[];for(let h=0;h0&&Ao&&(o=c.edges.length),e+=c.edges.length,t+=Math.pow(c.edges.length,2),i+=1}e=e/i,t=t/i;const r=t-Math.pow(e,2),A=Math.sqrt(r);let I=Math.floor(e+2*A);return I>o&&(I=o),I}_createClusteredEdge(e,t,i,o,r){const A=En.cloneOptions(i,"edge");mt(A,o),A.from=e,A.to=t,A.id="clusterEdge:"+js(),r!==void 0&&mt(A,r);const I=this.body.functions.createEdge(A);return I.clusteringEdgeReplacingIds=[i.id],I.connect(),this.body.edges[I.id]=I,I}_clusterEdges(e,t,i,o){if(t instanceof jg){const r=t,A={};A[r.id]=r,t=A}if(e instanceof Ot){const r=e,A={};A[r.id]=r,e=A}if(i==null)throw new Error("_clusterEdges: parameter clusterNode required");o===void 0&&(o=i.clusterEdgeProperties),this._createClusterEdges(e,t,i,o);for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&this.body.edges[r]!==void 0){const A=this.body.edges[r];this._backupEdgeOptions(A),A.setOptions({physics:!1})}for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(this.clusteredNodes[r]={clusterId:i.id,node:this.body.nodes[r]},this.body.nodes[r].setOptions({physics:!1}))}_getClusterNodeForNode(e){if(e===void 0)return;const t=this.clusteredNodes[e];if(t===void 0)return;const i=t.clusterId;if(i!==void 0)return this.body.nodes[i]}_filter(e,t){const i=[];return Ye(e,o=>{t(o)&&i.push(o)}),i}_updateState(){let e;const t=[],i={},o=l=>{Ye(this.body.nodes,c=>{c.isCluster===!0&&l(c)})};for(e in this.clusteredNodes){if(!Object.prototype.hasOwnProperty.call(this.clusteredNodes,e))continue;this.body.nodes[e]===void 0&&t.push(e)}o(function(l){for(let c=0;c{const c=this.body.edges[l];(c===void 0||!c.endPointsValid())&&(i[l]=l)}),o(function(l){Ye(l.containedEdges,(c,h)=>{!c.endPointsValid()&&!i[h]&&(i[h]=h)})}),Ye(this.body.edges,(l,c)=>{let h=!0;const p=l.clusteringEdgeReplacingIds;if(p!==void 0){let m=0;Ye(p,y=>{const w=this.body.edges[y];w!==void 0&&w.endPointsValid()&&(m+=1)}),h=m>0}(!l.endPointsValid()||!h)&&(i[c]=c)}),o(l=>{Ye(i,c=>{delete l.containedEdges[c],Ye(l.edges,(h,p)=>{if(h.id===c){l.edges[p]=null;return}h.clusteringEdgeReplacingIds=this._filter(h.clusteringEdgeReplacingIds,function(m){return!i[m]})}),l.edges=this._filter(l.edges,function(h){return h!==null})})}),Ye(i,l=>{delete this.clusteredEdges[l]}),Ye(i,l=>{delete this.body.edges[l]});const r=wt(this.body.edges);Ye(r,l=>{const c=this.body.edges[l],h=this._isClusteredNode(c.fromId)||this._isClusteredNode(c.toId);if(h!==this._isClusteredEdge(c.id))if(h){const p=this._getClusterNodeForNode(c.fromId);p!==void 0&&this._clusterEdges(this.body.nodes[c.fromId],c,p);const m=this._getClusterNodeForNode(c.toId);m!==void 0&&this._clusterEdges(this.body.nodes[c.toId],c,m)}else delete this._clusterEdges[l],this._restoreEdge(c)});let A=!1,I=!0;for(;I;){const l=[];o(function(c){const h=wt(c.containedNodes).length,p=c.options.allowSingleNodeCluster===!0;(p&&h<1||!p&&h<2)&&l.push(c.id)});for(let c=0;c0,A=A||I}A&&this._updateState()}_isClusteredNode(e){return this.clusteredNodes[e]!==void 0}_isClusteredEdge(e){return this.clusteredEdges[e]!==void 0}}class d${constructor(e,t){this.body=e,this.canvas=t,this.redrawRequested=!1,this.requestAnimationFrameRequestId=void 0,this.renderingActive=!1,this.renderRequests=0,this.allowRedraw=!0,this.dragging=!1,this.zooming=!1,this.options={},this.defaultOptions={hideEdgesOnDrag:!1,hideEdgesOnZoom:!1,hideNodesOnDrag:!1},Vt(this.options,this.defaultOptions),this.bindEventListeners()}bindEventListeners(){var e;this.body.emitter.on("dragStart",()=>{this.dragging=!0}),this.body.emitter.on("dragEnd",()=>{this.dragging=!1}),this.body.emitter.on("zoom",()=>{this.zooming=!0,window.clearTimeout(this.zoomTimeoutId),this.zoomTimeoutId=Mi(()=>{var t;this.zooming=!1,ge(t=this._requestRedraw).call(t,this)()},250)}),this.body.emitter.on("_resizeNodes",()=>{this._resizeNodes()}),this.body.emitter.on("_redraw",()=>{this.renderingActive===!1&&this._redraw()}),this.body.emitter.on("_blockRedraw",()=>{this.allowRedraw=!1}),this.body.emitter.on("_allowRedraw",()=>{this.allowRedraw=!0,this.redrawRequested=!1}),this.body.emitter.on("_requestRedraw",ge(e=this._requestRedraw).call(e,this)),this.body.emitter.on("_startRendering",()=>{this.renderRequests+=1,this.renderingActive=!0,this._startRendering()}),this.body.emitter.on("_stopRendering",()=>{this.renderRequests-=1,this.renderingActive=this.renderRequests>0,this.requestAnimationFrameRequestId=void 0}),this.body.emitter.on("destroy",()=>{this.renderRequests=0,this.allowRedraw=!1,this.renderingActive=!1,window.cancelAnimationFrame(this.requestAnimationFrameRequestId),this.body.emitter.off()})}setOptions(e){e!==void 0&&Ds(["hideEdgesOnDrag","hideEdgesOnZoom","hideNodesOnDrag"],this.options,e)}_startRendering(){if(this.renderingActive===!0&&this.requestAnimationFrameRequestId===void 0){var e;this.requestAnimationFrameRequestId=window.requestAnimationFrame(ge(e=this._renderStep).call(e,this),this.simulationInterval)}}_renderStep(){this.renderingActive===!0&&(this.requestAnimationFrameRequestId=void 0,this._startRendering(),this._redraw())}redraw(){this.body.emitter.emit("setSize"),this._redraw()}_requestRedraw(){this.redrawRequested!==!0&&this.renderingActive===!1&&this.allowRedraw===!0&&(this.redrawRequested=!0,window.requestAnimationFrame(()=>{this._redraw(!1)}))}_redraw(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;if(this.allowRedraw===!0){this.body.emitter.emit("initRedraw"),this.redrawRequested=!1;const t={drawExternalLabels:null};(this.canvas.frame.canvas.width===0||this.canvas.frame.canvas.height===0)&&this.canvas.setSize(),this.canvas.setTransform();const i=this.canvas.getContext(),o=this.canvas.frame.canvas.clientWidth,r=this.canvas.frame.canvas.clientHeight;if(i.clearRect(0,0,o,r),this.canvas.frame.clientWidth===0)return;if(i.save(),i.translate(this.body.view.translation.x,this.body.view.translation.y),i.scale(this.body.view.scale,this.body.view.scale),i.beginPath(),this.body.emitter.emit("beforeDrawing",i),i.closePath(),e===!1&&(this.dragging===!1||this.dragging===!0&&this.options.hideEdgesOnDrag===!1)&&(this.zooming===!1||this.zooming===!0&&this.options.hideEdgesOnZoom===!1)&&this._drawEdges(i),this.dragging===!1||this.dragging===!0&&this.options.hideNodesOnDrag===!1){const{drawExternalLabels:A}=this._drawNodes(i,e);t.drawExternalLabels=A}e===!1&&(this.dragging===!1||this.dragging===!0&&this.options.hideEdgesOnDrag===!1)&&(this.zooming===!1||this.zooming===!0&&this.options.hideEdgesOnZoom===!1)&&this._drawArrows(i),t.drawExternalLabels!=null&&t.drawExternalLabels(),e===!1&&this._drawSelectionBox(i),i.beginPath(),this.body.emitter.emit("afterDrawing",i),i.closePath(),i.restore(),e===!0&&i.clearRect(0,0,o,r)}}_resizeNodes(){this.canvas.setTransform();const e=this.canvas.getContext();e.save(),e.translate(this.body.view.translation.x,this.body.view.translation.y),e.scale(this.body.view.scale,this.body.view.scale);const t=this.body.nodes;let i;for(const o in t)Object.prototype.hasOwnProperty.call(t,o)&&(i=t[o],i.resize(e),i.updateBoundingBox(e,i.selected));e.restore()}_drawNodes(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;const i=this.body.nodes,o=this.body.nodeIndices;let r;const A=[],I=[],l=20,c=this.canvas.DOMtoCanvas({x:-l,y:-l}),h=this.canvas.DOMtoCanvas({x:this.canvas.frame.canvas.clientWidth+l,y:this.canvas.frame.canvas.clientHeight+l}),p={top:c.y,left:c.x,bottom:h.y,right:h.x},m=[];for(let x=0;x{for(const x of m)x()}}}_drawEdges(e){const t=this.body.edges,i=this.body.edgeIndices;for(let o=0;o{t.width!==0&&(this.body.view.translation.x=t.width*.5),t.height!==0&&(this.body.view.translation.y=t.height*.5)}),this.body.emitter.on("setSize",ge(e=this.setSize).call(e,this)),this.body.emitter.on("destroy",()=>{this.hammerFrame.destroy(),this.hammer.destroy(),this._cleanUp()})}setOptions(e){if(e!==void 0&&Ds(["width","height","autoResize"],this.options,e),this._cleanUp(),this.options.autoResize===!0){var t;if(window.ResizeObserver){const o=new ResizeObserver(()=>{this.setSize()===!0&&this.body.emitter.emit("_requestRedraw")}),{frame:r}=this;o.observe(r),this._cleanupCallbacks.push(()=>{o.unobserve(r)})}else{const o=p$(()=>{this.setSize()===!0&&this.body.emitter.emit("_requestRedraw")},1e3);this._cleanupCallbacks.push(()=>{clearInterval(o)})}const i=ge(t=this._onResize).call(t,this);window.addEventListener("resize",i),this._cleanupCallbacks.push(()=>{window.removeEventListener("resize",i)})}}_cleanUp(){var e,t,i;Je(e=wo(t=Di(i=this._cleanupCallbacks).call(i,0)).call(t)).call(e,o=>{try{o()}catch(r){console.error(r)}})}_onResize(){this.setSize(),this.body.emitter.emit("_redraw")}_getCameraState(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.pixelRatio;this.initialized===!0&&(this.cameraState.previousWidth=this.frame.canvas.width/e,this.cameraState.previousHeight=this.frame.canvas.height/e,this.cameraState.scale=this.body.view.scale,this.cameraState.position=this.DOMtoCanvas({x:.5*this.frame.canvas.width/e,y:.5*this.frame.canvas.height/e}))}_setCameraState(){if(this.cameraState.scale!==void 0&&this.frame.canvas.clientWidth!==0&&this.frame.canvas.clientHeight!==0&&this.pixelRatio!==0&&this.cameraState.previousWidth>0&&this.cameraState.previousHeight>0){const e=this.frame.canvas.width/this.pixelRatio/this.cameraState.previousWidth,t=this.frame.canvas.height/this.pixelRatio/this.cameraState.previousHeight;let i=this.cameraState.scale;e!=1&&t!=1?i=this.cameraState.scale*.5*(e+t):e!=1?i=this.cameraState.scale*e:t!=1&&(i=this.cameraState.scale*t),this.body.view.scale=i;const o=this.DOMtoCanvas({x:.5*this.frame.canvas.clientWidth,y:.5*this.frame.canvas.clientHeight}),r={x:o.x-this.cameraState.position.x,y:o.y-this.cameraState.position.y};this.body.view.translation.x+=r.x*this.body.view.scale,this.body.view.translation.y+=r.y*this.body.view.scale}}_prepareValue(e){if(typeof e=="number")return e+"px";if(typeof e=="string"){if(at(e).call(e,"%")!==-1||at(e).call(e,"px")!==-1)return e;if(at(e).call(e,"%")===-1)return e+"px"}throw new Error("Could not use the value supplied for width or height:"+e)}_create(){for(;this.body.container.hasChildNodes();)this.body.container.removeChild(this.body.container.firstChild);if(this.frame=document.createElement("div"),this.frame.className="vis-network",this.frame.style.position="relative",this.frame.style.overflow="hidden",this.frame.tabIndex=0,this.frame.canvas=document.createElement("canvas"),this.frame.canvas.style.position="relative",this.frame.appendChild(this.frame.canvas),this.frame.canvas.getContext)this._setPixelRatio(),this.setTransform();else{const e=document.createElement("DIV");e.style.color="red",e.style.fontWeight="bold",e.style.padding="10px",e.innerText="Error: your browser does not support HTML canvas",this.frame.canvas.appendChild(e)}this.body.container.appendChild(this.frame),this.body.view.scale=1,this.body.view.translation={x:.5*this.frame.canvas.clientWidth,y:.5*this.frame.canvas.clientHeight},this._bindHammer()}_bindHammer(){this.hammer!==void 0&&this.hammer.destroy(),this.drag={},this.pinch={},this.hammer=new Ms(this.frame.canvas),this.hammer.get("pinch").set({enable:!0}),this.hammer.get("pan").set({threshold:5,direction:Ms.DIRECTION_ALL}),qC(this.hammer,e=>{this.body.eventListeners.onTouch(e)}),this.hammer.on("tap",e=>{this.body.eventListeners.onTap(e)}),this.hammer.on("doubletap",e=>{this.body.eventListeners.onDoubleTap(e)}),this.hammer.on("press",e=>{this.body.eventListeners.onHold(e)}),this.hammer.on("panstart",e=>{this.body.eventListeners.onDragStart(e)}),this.hammer.on("panmove",e=>{this.body.eventListeners.onDrag(e)}),this.hammer.on("panend",e=>{this.body.eventListeners.onDragEnd(e)}),this.hammer.on("pinch",e=>{this.body.eventListeners.onPinch(e)}),this.frame.canvas.addEventListener("wheel",e=>{this.body.eventListeners.onMouseWheel(e)}),this.frame.canvas.addEventListener("mousemove",e=>{this.body.eventListeners.onMouseMove(e)}),this.frame.canvas.addEventListener("contextmenu",e=>{this.body.eventListeners.onContext(e)}),this.hammerFrame=new Ms(this.frame),Ax(this.hammerFrame,e=>{this.body.eventListeners.onRelease(e)})}setSize(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.options.width,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.options.height;e=this._prepareValue(e),t=this._prepareValue(t);let i=!1;const o=this.frame.canvas.width,r=this.frame.canvas.height,A=this.pixelRatio;if(this._setPixelRatio(),e!=this.options.width||t!=this.options.height||this.frame.style.width!=e||this.frame.style.height!=t)this._getCameraState(A),this.frame.style.width=e,this.frame.style.height=t,this.frame.canvas.style.width="100%",this.frame.canvas.style.height="100%",this.frame.canvas.width=Math.round(this.frame.canvas.clientWidth*this.pixelRatio),this.frame.canvas.height=Math.round(this.frame.canvas.clientHeight*this.pixelRatio),this.options.width=e,this.options.height=t,this.canvasViewCenter={x:.5*this.frame.clientWidth,y:.5*this.frame.clientHeight},i=!0;else{const I=Math.round(this.frame.canvas.clientWidth*this.pixelRatio),l=Math.round(this.frame.canvas.clientHeight*this.pixelRatio);(this.frame.canvas.width!==I||this.frame.canvas.height!==l)&&this._getCameraState(A),this.frame.canvas.width!==I&&(this.frame.canvas.width=I,i=!0),this.frame.canvas.height!==l&&(this.frame.canvas.height=l,i=!0)}return i===!0&&(this.body.emitter.emit("resize",{width:Math.round(this.frame.canvas.width/this.pixelRatio),height:Math.round(this.frame.canvas.height/this.pixelRatio),oldWidth:Math.round(o/this.pixelRatio),oldHeight:Math.round(r/this.pixelRatio)}),this._setCameraState()),this.initialized=!0,i}getContext(){return this.frame.canvas.getContext("2d")}_determinePixelRatio(){const e=this.getContext();if(e===void 0)throw new Error("Could not get canvax context");let t=1;typeof window<"u"&&(t=window.devicePixelRatio||1);const i=e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1;return t/i}_setPixelRatio(){this.pixelRatio=this._determinePixelRatio()}setTransform(){const e=this.getContext();if(e===void 0)throw new Error("Could not get canvax context");e.setTransform(this.pixelRatio,0,0,this.pixelRatio,0,0)}_XconvertDOMtoCanvas(e){return(e-this.body.view.translation.x)/this.body.view.scale}_XconvertCanvasToDOM(e){return e*this.body.view.scale+this.body.view.translation.x}_YconvertDOMtoCanvas(e){return(e-this.body.view.translation.y)/this.body.view.scale}_YconvertCanvasToDOM(e){return e*this.body.view.scale+this.body.view.translation.y}canvasToDOM(e){return{x:this._XconvertCanvasToDOM(e.x),y:this._YconvertCanvasToDOM(e.y)}}DOMtoCanvas(e){return{x:this._XconvertDOMtoCanvas(e.x),y:this._YconvertDOMtoCanvas(e.y)}}}function v$(n,e){const t=Vt({nodes:e,minZoomLevel:Number.MIN_VALUE,maxZoomLevel:1},n??{});if(!et(t.nodes))throw new TypeError("Nodes has to be an array of ids.");if(t.nodes.length===0&&(t.nodes=e),!(typeof t.minZoomLevel=="number"&&t.minZoomLevel>0))throw new TypeError("Min zoom level has to be a number higher than zero.");if(!(typeof t.maxZoomLevel=="number"&&t.minZoomLevel<=t.maxZoomLevel))throw new TypeError("Max zoom level has to be a number higher than min zoom level.");return t}class y${constructor(e,t){var i,o;this.body=e,this.canvas=t,this.animationSpeed=1/this.renderRefreshRate,this.animationEasingFunction="easeInOutQuint",this.easingTime=0,this.sourceScale=0,this.targetScale=0,this.sourceTranslation=0,this.targetTranslation=0,this.lockedOnNodeId=void 0,this.lockedOnNodeOffset=void 0,this.touchTime=0,this.viewFunction=void 0,this.body.emitter.on("fit",ge(i=this.fit).call(i,this)),this.body.emitter.on("animationFinished",()=>{this.body.emitter.emit("_stopRendering")}),this.body.emitter.on("unlockNode",ge(o=this.releaseNode).call(o,this))}setOptions(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.options=e}fit(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;e=v$(e,this.body.nodeIndices);const i=this.canvas.frame.canvas.clientWidth,o=this.canvas.frame.canvas.clientHeight;let r,A;if(i===0||o===0)A=1,r=En.getRange(this.body.nodes,e.nodes);else if(t===!0){let c=0;for(const m in this.body.nodes)Object.prototype.hasOwnProperty.call(this.body.nodes,m)&&this.body.nodes[m].predefinedPosition===!0&&(c+=1);if(c>.5*this.body.nodeIndices.length){this.fit(e,!1);return}r=En.getRange(this.body.nodes,e.nodes),A=12.662/(this.body.nodeIndices.length+7.4147)+.0964822;const p=Math.min(i/600,o/600);A*=p}else{this.body.emitter.emit("_resizeNodes"),r=En.getRange(this.body.nodes,e.nodes);const c=Math.abs(r.maxX-r.minX)*1.1,h=Math.abs(r.maxY-r.minY)*1.1,p=i/c,m=o/h;A=p<=m?p:m}A>e.maxZoomLevel?A=e.maxZoomLevel:A1&&arguments[1]!==void 0?arguments[1]:{};if(this.body.nodes[e]!==void 0){const i={x:this.body.nodes[e].x,y:this.body.nodes[e].y};t.position=i,t.lockedOnNode=e,this.moveTo(t)}else console.error("Node: "+e+" cannot be found.")}moveTo(e){if(e===void 0){e={};return}if(e.offset!=null){if(e.offset.x!=null){if(e.offset.x=+e.offset.x,!zo(e.offset.x))throw new TypeError('The option "offset.x" has to be a finite number.')}else e.offset.x=0;if(e.offset.y!=null){if(e.offset.y=+e.offset.y,!zo(e.offset.y))throw new TypeError('The option "offset.y" has to be a finite number.')}else e.offset.x=0}else e.offset={x:0,y:0};if(e.position!=null){if(e.position.x!=null){if(e.position.x=+e.position.x,!zo(e.position.x))throw new TypeError('The option "position.x" has to be a finite number.')}else e.position.x=0;if(e.position.y!=null){if(e.position.y=+e.position.y,!zo(e.position.y))throw new TypeError('The option "position.y" has to be a finite number.')}else e.position.x=0}else e.position=this.getViewPosition();if(e.scale!=null){if(e.scale=+e.scale,!(e.scale>0))throw new TypeError('The option "scale" has to be a number greater than zero.')}else e.scale=this.body.view.scale;e.animation===void 0&&(e.animation={duration:0}),e.animation===!1&&(e.animation={duration:0}),e.animation===!0&&(e.animation={}),e.animation.duration===void 0&&(e.animation.duration=1e3),e.animation.easingFunction===void 0&&(e.animation.easingFunction="easeInOutQuad"),this.animateView(e)}animateView(e){if(e===void 0)return;this.animationEasingFunction=e.animation.easingFunction,this.releaseNode(),e.locked===!0&&(this.lockedOnNodeId=e.lockedOnNode,this.lockedOnNodeOffset=e.offset),this.easingTime!=0&&this._transitionRedraw(!0),this.sourceScale=this.body.view.scale,this.sourceTranslation=this.body.view.translation,this.targetScale=e.scale,this.body.view.scale=this.targetScale;const t=this.canvas.DOMtoCanvas({x:.5*this.canvas.frame.canvas.clientWidth,y:.5*this.canvas.frame.canvas.clientHeight}),i={x:t.x-e.position.x,y:t.y-e.position.y};if(this.targetTranslation={x:this.sourceTranslation.x+i.x*this.targetScale+e.offset.x,y:this.sourceTranslation.y+i.y*this.targetScale+e.offset.y},e.animation.duration===0)if(this.lockedOnNodeId!=null){var o;this.viewFunction=ge(o=this._lockedRedraw).call(o,this),this.body.emitter.on("initRedraw",this.viewFunction)}else this.body.view.scale=this.targetScale,this.body.view.translation=this.targetTranslation,this.body.emitter.emit("_requestRedraw");else{var r;this.animationSpeed=1/(60*e.animation.duration*.001)||1/60,this.animationEasingFunction=e.animation.easingFunction,this.viewFunction=ge(r=this._transitionRedraw).call(r,this),this.body.emitter.on("initRedraw",this.viewFunction),this.body.emitter.emit("_startRendering")}}_lockedRedraw(){const e={x:this.body.nodes[this.lockedOnNodeId].x,y:this.body.nodes[this.lockedOnNodeId].y},t=this.canvas.DOMtoCanvas({x:.5*this.canvas.frame.canvas.clientWidth,y:.5*this.canvas.frame.canvas.clientHeight}),i={x:t.x-e.x,y:t.y-e.y},o=this.body.view.translation,r={x:o.x+i.x*this.body.view.scale+this.lockedOnNodeOffset.x,y:o.y+i.y*this.body.view.scale+this.lockedOnNodeOffset.y};this.body.view.translation=r}releaseNode(){this.lockedOnNodeId!==void 0&&this.viewFunction!==void 0&&(this.body.emitter.off("initRedraw",this.viewFunction),this.lockedOnNodeId=void 0,this.lockedOnNodeOffset=void 0)}_transitionRedraw(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;this.easingTime+=this.animationSpeed,this.easingTime=e===!0?1:this.easingTime;const t=VV[this.animationEasingFunction](this.easingTime);if(this.body.view.scale=this.sourceScale+(this.targetScale-this.sourceScale)*t,this.body.view.translation={x:this.sourceTranslation.x+(this.targetTranslation.x-this.sourceTranslation.x)*t,y:this.sourceTranslation.y+(this.targetTranslation.y-this.sourceTranslation.y)*t},this.easingTime>=1){if(this.body.emitter.off("initRedraw",this.viewFunction),this.easingTime=0,this.lockedOnNodeId!=null){var i;this.viewFunction=ge(i=this._lockedRedraw).call(i,this),this.body.emitter.on("initRedraw",this.viewFunction)}this.body.emitter.emit("animationFinished")}}getScale(){return this.body.view.scale}getViewPosition(){return this.canvas.DOMtoCanvas({x:.5*this.canvas.frame.canvas.clientWidth,y:.5*this.canvas.frame.canvas.clientHeight})}}var b$=`div.vis-network div.vis-navigation div.vis-button { +`),o=i.length;if(t.multi)for(let r=0;r0)for(let I=0;I0)for(let r=0;r/&/.test(o)?(t.replace(t.text,"<","<")||t.replace(t.text,"&","&")||t.add("&"),!0):!1;for(;t.position")||t.parseStartTag("ital","")||t.parseStartTag("mono","")||t.parseEndTag("bold","")||t.parseEndTag("ital","")||t.parseEndTag("mono",""))||i(o)||t.add(o),t.position++}return t.emitBlock(),t.blocks}splitMarkdownBlocks(e){const t=new Kw(e);let i=!0;const o=r=>/\\/.test(r)?(t.positionthis.parent.fontOptions.maxWdt}getLongestFit(e){let t="",i=0;for(;i1&&arguments[1]!==void 0?arguments[1]:"normal",i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;this.parent.getFormattingValues(this.ctx,this.selected,this.hover,t),e=e.replace(/^( +)/g,"$1\r"),e=e.replace(/([^\r][^ ]*)( +)/g,"$1\r$2\r");let o=e.split("\r");for(;o.length>0;){let r=this.getLongestFit(o);if(r===0){const A=o[0],I=this.getLongestFitWord(A);this.lines.newLine(vi(A).call(A,0,I),t),o[0]=vi(A).call(A,I)}else{let A=r;o[r-1]===" "?r--:o[A]===" "&&A++;const I=vi(o).call(o,0,r).join("");r==o.length&&i?this.lines.append(I,t):this.lines.newLine(I,t),o=vi(o).call(o,A)}}}}const ka=["bold","ital","boldital","mono"];class Ps{constructor(e,t){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;this.body=e,this.pointToSelf=!1,this.baseSize=void 0,this.fontOptions={},this.setOptions(t),this.size={top:0,left:0,width:0,height:0,yLine:0},this.isEdgeLabel=i}setOptions(e){if(this.elementOptions=e,this.initFontOptions(e.font),qC(e.label)?this.labelDirty=!0:e.label=void 0,e.font!==void 0&&e.font!==null){if(typeof e.font=="string")this.baseSize=this.fontOptions.size;else if(typeof e.font=="object"){const t=e.font.size;t!==void 0&&(this.baseSize=t)}}}initFontOptions(e){if(Ye(ka,t=>{this.fontOptions[t]={}}),Ps.parseFontString(this.fontOptions,e)){this.fontOptions.vadjust=0;return}Ye(e,(t,i)=>{t!=null&&typeof t!="object"&&(this.fontOptions[i]=t)})}static parseFontString(e,t){if(!t||typeof t!="string")return!1;const i=t.split(" ");return e.size=+i[0].replace("px",""),e.face=i[1],e.color=i[2],!0}constrain(e){const t={constrainWidth:!1,maxWdt:-1,minWdt:-1,constrainHeight:!1,minHgt:-1,valign:"middle"},i=zg(e,"widthConstraint");if(typeof i=="number")t.maxWdt=Number(i),t.minWdt=Number(i);else if(typeof i=="object"){const r=zg(e,["widthConstraint","maximum"]);typeof r=="number"&&(t.maxWdt=Number(r));const A=zg(e,["widthConstraint","minimum"]);typeof A=="number"&&(t.minWdt=Number(A))}const o=zg(e,"heightConstraint");if(typeof o=="number")t.minHgt=Number(o);else if(typeof o=="object"){const r=zg(e,["heightConstraint","minimum"]);typeof r=="number"&&(t.minHgt=Number(r));const A=zg(e,["heightConstraint","valign"]);typeof A=="string"&&(A==="top"||A==="bottom")&&(t.valign=A)}return t}update(e,t){this.setOptions(e,!0),this.propagateFonts(t),vt(this.fontOptions,this.constrain(t)),this.fontOptions.chooser=wu("label",t)}adjustSizes(e){const t=e?e.right+e.left:0;this.fontOptions.constrainWidth&&(this.fontOptions.maxWdt-=t,this.fontOptions.minWdt-=t);const i=e?e.top+e.bottom:0;this.fontOptions.constrainHeight&&(this.fontOptions.minHgt-=i)}addFontOptionsToPile(e,t){for(let i=0;i{A!==void 0&&(Object.prototype.hasOwnProperty.call(t,I)||(Ct(ka).call(ka,I)!==-1?t[I]={}:t[I]=A))})}return t}getFontOption(e,t,i){let o;for(let r=0;r{r[l]=I}),r.size=Number(r.size),r.vadjust=Number(r.vadjust)}}draw(e,t,i,o,r){let A=arguments.length>5&&arguments[5]!==void 0?arguments[5]:"middle";if(this.elementOptions.label===void 0)return;let I=this.fontOptions.size*this.body.view.scale;this.elementOptions.label&&I=this.elementOptions.scaling.label.maxVisible&&(I=Number(this.elementOptions.scaling.label.maxVisible)/this.body.view.scale),this.calculateLabelSize(e,o,r,t,i,A),this._drawBackground(e),this._drawText(e,t,this.size.yLine,A,I))}_drawBackground(e){if(this.fontOptions.background!==void 0&&this.fontOptions.background!=="none"){e.fillStyle=this.fontOptions.background;const t=this.getSize();e.fillRect(t.left,t.top,t.width,t.height)}}_drawText(e,t,i){let o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"middle",r=arguments.length>4?arguments[4]:void 0;[t,i]=this._setAlignment(e,t,i,o),e.textAlign="left",t=t-this.size.width/2,this.fontOptions.valign&&this.size.height>this.size.labelHeight&&(this.fontOptions.valign==="top"&&(i-=(this.size.height-this.size.labelHeight)/2),this.fontOptions.valign==="bottom"&&(i+=(this.size.height-this.size.labelHeight)/2));for(let A=0;A0&&(e.lineWidth=h.strokeWidth,e.strokeStyle=m,e.lineJoin="round"),e.fillStyle=p,h.strokeWidth>0&&e.strokeText(h.text,t+l,i+h.vadjust),e.fillText(h.text,t+l,i+h.vadjust),l+=h.width}i+=I.height}}}_setAlignment(e,t,i,o){if(this.isEdgeLabel&&this.fontOptions.align!=="horizontal"&&this.pointToSelf===!1){t=0,i=0;const r=2;this.fontOptions.align==="top"?(e.textBaseline="alphabetic",i-=2*r):this.fontOptions.align==="bottom"?(e.textBaseline="hanging",i+=2*r):e.textBaseline="middle"}else e.textBaseline=o;return[t,i]}_getColor(e,t,i){let o=e||"#000000",r=i||"#ffffff";if(t<=this.elementOptions.scaling.label.drawThreshold){const A=Math.max(0,Math.min(1,1-(this.elementOptions.scaling.label.drawThreshold-t)));o=ni(o,A),r=ni(r,A)}return[o,r]}getTextSize(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return this._processLabel(e,t,i),{width:this.size.width,height:this.size.height,lineCount:this.lineCount}}getSize(){let t=this.size.left,i=this.size.top-.5*2;if(this.isEdgeLabel){const r=-this.size.width*.5;switch(this.fontOptions.align){case"middle":t=r,i=-this.size.height*.5;break;case"top":t=r,i=-(this.size.height+2);break;case"bottom":t=r,i=2;break}}return{left:t,top:i,width:this.size.width,height:this.size.height}}calculateLabelSize(e,t,i){let o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,r=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,A=arguments.length>5&&arguments[5]!==void 0?arguments[5]:"middle";this._processLabel(e,t,i),this.size.left=o-this.size.width*.5,this.size.top=r-this.size.height*.5,this.size.yLine=r+(1-this.lineCount)*.5*this.fontOptions.size,A==="hanging"&&(this.size.top+=.5*this.fontOptions.size,this.size.top+=4,this.size.yLine+=4)}getFormattingValues(e,t,i,o){const r=function(l,c,h){return c==="normal"?h==="mod"?"":l[h]:l[c][h]!==void 0?l[c][h]:l[h]},A={color:r(this.fontOptions,o,"color"),size:r(this.fontOptions,o,"size"),face:r(this.fontOptions,o,"face"),mod:r(this.fontOptions,o,"mod"),vadjust:r(this.fontOptions,o,"vadjust"),strokeWidth:this.fontOptions.strokeWidth,strokeColor:this.fontOptions.strokeColor};(t||i)&&(o==="normal"&&this.fontOptions.chooser===!0&&this.elementOptions.labelHighlightBold?A.mod="bold":typeof this.fontOptions.chooser=="function"&&this.fontOptions.chooser(A,this.elementOptions.id,t,i));let I="";return A.mod!==void 0&&A.mod!==""&&(I+=A.mod+" "),I+=A.size+"px "+A.face,e.font=I.replace(/"/g,""),A.font=e.font,A.height=A.size,A}differentState(e,t){return e!==this.selectedState||t!==this.hoverState}_processLabelText(e,t,i,o){return new pX(e,this,t,i).process(o)}_processLabel(e,t,i){if(this.labelDirty===!1&&!this.differentState(t,i))return;const o=this._processLabelText(e,t,i,this.elementOptions.label);this.fontOptions.minWdt>0&&o.width0&&o.height0&&(this.enableBorderDashes(e,t),e.stroke(),this.disableBorderDashes(e,t)),e.restore()}performFill(e,t){e.save(),e.fillStyle=t.color,this.enableShadow(e,t),la(e).call(e),this.disableShadow(e,t),e.restore(),this.performStroke(e,t)}_addBoundingBoxMargin(e){this.boundingBox.left-=e,this.boundingBox.top-=e,this.boundingBox.bottom+=e,this.boundingBox.right+=e}_updateBoundingBox(e,t,i,o,r){i!==void 0&&this.resize(i,o,r),this.left=e-this.width/2,this.top=t-this.height/2,this.boundingBox.left=this.left,this.boundingBox.top=this.top,this.boundingBox.bottom=this.top+this.height,this.boundingBox.right=this.left+this.width}updateBoundingBox(e,t,i,o,r){this._updateBoundingBox(e,t,i,o,r)}getDimensionsFromLabel(e,t,i){this.textSize=this.labelModule.getTextSize(e,t,i);let o=this.textSize.width,r=this.textSize.height;const A=14;return o===0&&(o=A,r=A),{width:o,height:r}}}let mX=class extends _o{constructor(e,t,i){super(e,t,i),this._setMargins(i)}resize(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.selected,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.hover;if(this.needsRefresh(t,i)){const o=this.getDimensionsFromLabel(e,t,i);this.width=o.width+this.margin.right+this.margin.left,this.height=o.height+this.margin.top+this.margin.bottom,this.radius=this.width/2}}draw(e,t,i,o,r,A){this.resize(e,o,r),this.left=t-this.width/2,this.top=i-this.height/2,this.initContextForDraw(e,A),dy(e,this.left,this.top,this.width,this.height,A.borderRadius),this.performFill(e,A),this.updateBoundingBox(t,i,e,o,r),this.labelModule.draw(e,this.left+this.textSize.width/2+this.margin.left,this.top+this.textSize.height/2+this.margin.top,o,r)}updateBoundingBox(e,t,i,o,r){this._updateBoundingBox(e,t,i,o,r);const A=this.options.shapeProperties.borderRadius;this._addBoundingBoxMargin(A)}distanceToBorder(e,t){e&&this.resize(e);const i=this.options.borderWidth;return Math.min(Math.abs(this.width/2/Math.cos(t)),Math.abs(this.height/2/Math.sin(t)))+i}};class Su extends _o{constructor(e,t,i){super(e,t,i),this.labelOffset=0,this.selected=!1}setOptions(e,t,i){this.options=e,t===void 0&&i===void 0||this.setImages(t,i)}setImages(e,t){t&&this.selected?(this.imageObj=t,this.imageObjAlt=e):(this.imageObj=e,this.imageObjAlt=t)}switchImages(e){const t=e&&!this.selected||!e&&this.selected;if(this.selected=e,this.imageObjAlt!==void 0&&t){const i=this.imageObj;this.imageObj=this.imageObjAlt,this.imageObjAlt=i}}_getImagePadding(){const e={top:0,right:0,bottom:0,left:0};if(this.options.imagePadding){const t=this.options.imagePadding;typeof t=="object"?(e.top=t.top,e.right=t.right,e.bottom=t.bottom,e.left=t.left):(e.top=t,e.right=t,e.bottom=t,e.left=t)}return e}_resizeImage(){let e,t;if(this.options.shapeProperties.useImageSize===!1){let i=1,o=1;this.imageObj.width&&this.imageObj.height&&(this.imageObj.width>this.imageObj.height?i=this.imageObj.width/this.imageObj.height:o=this.imageObj.height/this.imageObj.width),e=this.options.size*2*i,t=this.options.size*2*o}else{const i=this._getImagePadding();e=this.imageObj.width+i.left+i.right,t=this.imageObj.height+i.top+i.bottom}this.width=e,this.height=t,this.radius=.5*this.width}_drawRawCircle(e,t,i,o){this.initContextForDraw(e,o),Bc(e,t,i,o.size),this.performFill(e,o)}_drawImageAtPosition(e,t){if(this.imageObj.width!=0){e.globalAlpha=t.opacity!==void 0?t.opacity:1,this.enableShadow(e,t);let i=1;this.options.shapeProperties.interpolation===!0&&(i=this.imageObj.width/this.width/this.body.view.scale);const o=this._getImagePadding(),r=this.left+o.left,A=this.top+o.top,I=this.width-o.left-o.right,l=this.height-o.top-o.bottom;this.imageObj.drawImageAtPosition(e,i,r,A,I,l),this.disableShadow(e,t)}}_drawImageLabel(e,t,i,o,r){let A=0;if(this.height!==void 0){A=this.height*.5;const l=this.labelModule.getTextSize(e,o,r);l.lineCount>=1&&(A+=l.height/2)}const I=i+A;this.options.label&&(this.labelOffset=A),this.labelModule.draw(e,t,I,o,r,"hanging")}}let vX=class extends Su{constructor(e,t,i){super(e,t,i),this._setMargins(i)}resize(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.selected,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.hover;if(this.needsRefresh(t,i)){const o=this.getDimensionsFromLabel(e,t,i),r=Math.max(o.width+this.margin.right+this.margin.left,o.height+this.margin.top+this.margin.bottom);this.options.size=r/2,this.width=r,this.height=r,this.radius=this.width/2}}draw(e,t,i,o,r,A){this.resize(e,o,r),this.left=t-this.width/2,this.top=i-this.height/2,this._drawRawCircle(e,t,i,A),this.updateBoundingBox(t,i),this.labelModule.draw(e,this.left+this.textSize.width/2+this.margin.left,i,o,r)}updateBoundingBox(e,t){this.boundingBox.top=t-this.options.size,this.boundingBox.left=e-this.options.size,this.boundingBox.right=e+this.options.size,this.boundingBox.bottom=t+this.options.size}distanceToBorder(e){return e&&this.resize(e),this.width*.5}};class yX extends Su{constructor(e,t,i,o,r){super(e,t,i),this.setImages(o,r)}resize(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.selected,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.hover;if(this.imageObj.src===void 0||this.imageObj.width===void 0||this.imageObj.height===void 0){const r=this.options.size*2;this.width=r,this.height=r,this.radius=.5*this.width;return}this.needsRefresh(t,i)&&this._resizeImage()}draw(e,t,i,o,r,A){this.switchImages(o),this.resize();let I=t,l=i;this.options.shapeProperties.coordinateOrigin==="top-left"?(this.left=t,this.top=i,I+=this.width/2,l+=this.height/2):(this.left=t-this.width/2,this.top=i-this.height/2),this._drawRawCircle(e,I,l,A),e.save(),e.clip(),this._drawImageAtPosition(e,A),e.restore(),this._drawImageLabel(e,I,l,o,r),this.updateBoundingBox(t,i)}updateBoundingBox(e,t){this.options.shapeProperties.coordinateOrigin==="top-left"?(this.boundingBox.top=t,this.boundingBox.left=e,this.boundingBox.right=e+this.options.size*2,this.boundingBox.bottom=t+this.options.size*2):(this.boundingBox.top=t-this.options.size,this.boundingBox.left=e-this.options.size,this.boundingBox.right=e+this.options.size,this.boundingBox.bottom=t+this.options.size),this.boundingBox.left=Math.min(this.boundingBox.left,this.labelModule.size.left),this.boundingBox.right=Math.max(this.boundingBox.right,this.labelModule.size.left+this.labelModule.size.width),this.boundingBox.bottom=Math.max(this.boundingBox.bottom,this.boundingBox.bottom+this.labelOffset)}distanceToBorder(e){return e&&this.resize(e),this.width*.5}}class jg extends _o{constructor(e,t,i){super(e,t,i)}resize(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.selected,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.hover,o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{size:this.options.size};if(this.needsRefresh(t,i)){var r,A;this.labelModule.getTextSize(e,t,i);const I=2*o.size;this.width=(r=this.customSizeWidth)!==null&&r!==void 0?r:I,this.height=(A=this.customSizeHeight)!==null&&A!==void 0?A:I,this.radius=.5*this.width}}_drawShape(e,t,i,o,r,A,I,l){return this.resize(e,A,I,l),this.left=o-this.width/2,this.top=r-this.height/2,this.initContextForDraw(e,l),i4(t)(e,o,r,l.size),this.performFill(e,l),this.options.icon!==void 0&&this.options.icon.code!==void 0&&(e.font=(A?"bold ":"")+this.height/2+"px "+(this.options.icon.face||"FontAwesome"),e.fillStyle=this.options.icon.color||"black",e.textAlign="center",e.textBaseline="middle",e.fillText(this.options.icon.code,o,r)),{drawExternalLabel:()=>{if(this.options.label!==void 0){this.labelModule.calculateLabelSize(e,A,I,o,r,"hanging");const c=r+.5*this.height+.5*this.labelModule.size.height;this.labelModule.draw(e,o,c,A,I,"hanging")}this.updateBoundingBox(o,r)}}}updateBoundingBox(e,t){this.boundingBox.top=t-this.options.size,this.boundingBox.left=e-this.options.size,this.boundingBox.right=e+this.options.size,this.boundingBox.bottom=t+this.options.size,this.options.label!==void 0&&this.labelModule.size.width>0&&(this.boundingBox.left=Math.min(this.boundingBox.left,this.labelModule.size.left),this.boundingBox.right=Math.max(this.boundingBox.right,this.labelModule.size.left+this.labelModule.size.width),this.boundingBox.bottom=Math.max(this.boundingBox.bottom,this.boundingBox.bottom+this.labelModule.size.height))}}function Ww(n,e){var t=xt(n);if(_i){var i=_i(n);e&&(i=Qt(i).call(i,function(o){return ji(n,o).enumerable})),t.push.apply(t,i)}return t}function bX(n){for(var e=1;e{e.save(),l(),e.restore()}}return I.nodeDimensions&&(this.customSizeWidth=I.nodeDimensions.width,this.customSizeHeight=I.nodeDimensions.height),I}distanceToBorder(e,t){return this._distanceToBorder(e,t)}}class xX extends _o{constructor(e,t,i){super(e,t,i),this._setMargins(i)}resize(e,t,i){if(this.needsRefresh(t,i)){const r=this.getDimensionsFromLabel(e,t,i).width+this.margin.right+this.margin.left;this.width=r,this.height=r,this.radius=this.width/2}}draw(e,t,i,o,r,A){this.resize(e,o,r),this.left=t-this.width/2,this.top=i-this.height/2,this.initContextForDraw(e,A),uy(e,t-this.width/2,i-this.height/2,this.width,this.height),this.performFill(e,A),this.updateBoundingBox(t,i,e,o,r),this.labelModule.draw(e,this.left+this.textSize.width/2+this.margin.left,this.top+this.textSize.height/2+this.margin.top,o,r)}distanceToBorder(e,t){return this._distanceToBorder(e,t)}}let SX=class extends jg{constructor(e,t,i){super(e,t,i)}draw(e,t,i,o,r,A){return this._drawShape(e,"diamond",4,t,i,o,r,A)}distanceToBorder(e,t){return this._distanceToBorder(e,t)}};class EX extends jg{constructor(e,t,i){super(e,t,i)}draw(e,t,i,o,r,A){return this._drawShape(e,"circle",2,t,i,o,r,A)}distanceToBorder(e){return e&&this.resize(e),this.options.size}}class Qw extends _o{constructor(e,t,i){super(e,t,i)}resize(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.selected,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.hover;if(this.needsRefresh(t,i)){const o=this.getDimensionsFromLabel(e,t,i);this.height=o.height*2,this.width=o.width+o.height,this.radius=.5*this.width}}draw(e,t,i,o,r,A){this.resize(e,o,r),this.left=t-this.width*.5,this.top=i-this.height*.5,this.initContextForDraw(e,A),Pc(e,this.left,this.top,this.width,this.height),this.performFill(e,A),this.updateBoundingBox(t,i,e,o,r),this.labelModule.draw(e,t,i,o,r)}distanceToBorder(e,t){e&&this.resize(e);const i=this.width*.5,o=this.height*.5,r=Math.sin(t)*i,A=Math.cos(t)*o;return i*o/Math.sqrt(r*r+A*A)}}class TX extends _o{constructor(e,t,i){super(e,t,i),this._setMargins(i)}resize(e,t,i){this.needsRefresh(t,i)&&(this.iconSize={width:Number(this.options.icon.size),height:Number(this.options.icon.size)},this.width=this.iconSize.width+this.margin.right+this.margin.left,this.height=this.iconSize.height+this.margin.top+this.margin.bottom,this.radius=.5*this.width)}draw(e,t,i,o,r,A){return this.resize(e,o,r),this.options.icon.size=this.options.icon.size||50,this.left=t-this.width/2,this.top=i-this.height/2,this._icon(e,t,i,o,r,A),{drawExternalLabel:()=>{this.options.label!==void 0&&this.labelModule.draw(e,this.left+this.iconSize.width/2+this.margin.left,i+this.height/2+5,o),this.updateBoundingBox(t,i)}}}updateBoundingBox(e,t){this.boundingBox.top=t-this.options.icon.size*.5,this.boundingBox.left=e-this.options.icon.size*.5,this.boundingBox.right=e+this.options.icon.size*.5,this.boundingBox.bottom=t+this.options.icon.size*.5,this.options.label!==void 0&&this.labelModule.size.width>0&&(this.boundingBox.left=Math.min(this.boundingBox.left,this.labelModule.size.left),this.boundingBox.right=Math.max(this.boundingBox.right,this.labelModule.size.left+this.labelModule.size.width),this.boundingBox.bottom=Math.max(this.boundingBox.bottom,this.boundingBox.bottom+this.labelModule.size.height+5))}_icon(e,t,i,o,r,A){const I=Number(this.options.icon.size);this.options.icon.code!==void 0?(e.font=[this.options.icon.weight!=null?this.options.icon.weight:o?"bold":"",(this.options.icon.weight!=null&&o?5:0)+I+"px",this.options.icon.face].join(" "),e.fillStyle=this.options.icon.color||"black",e.textAlign="center",e.textBaseline="middle",this.enableShadow(e,A),e.fillText(this.options.icon.code,t,i),this.disableShadow(e,A)):console.error("When using the icon shape, you need to define the code in the icon options object. This can be done per node or globally.")}distanceToBorder(e,t){return this._distanceToBorder(e,t)}}let OX=class extends Su{constructor(e,t,i,o,r){super(e,t,i),this.setImages(o,r)}resize(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.selected,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.hover;if(this.imageObj.src===void 0||this.imageObj.width===void 0||this.imageObj.height===void 0){const r=this.options.size*2;this.width=r,this.height=r;return}this.needsRefresh(t,i)&&this._resizeImage()}draw(e,t,i,o,r,A){e.save(),this.switchImages(o),this.resize();let I=t,l=i;if(this.options.shapeProperties.coordinateOrigin==="top-left"?(this.left=t,this.top=i,I+=this.width/2,l+=this.height/2):(this.left=t-this.width/2,this.top=i-this.height/2),this.options.shapeProperties.useBorderWithImage===!0){const c=this.options.borderWidth,h=this.options.borderWidthSelected||2*this.options.borderWidth,p=(o?h:c)/this.body.view.scale;e.lineWidth=Math.min(this.width,p),e.beginPath();let m=o?this.options.color.highlight.border:r?this.options.color.hover.border:this.options.color.border,y=o?this.options.color.highlight.background:r?this.options.color.hover.background:this.options.color.background;A.opacity!==void 0&&(m=ni(m,A.opacity),y=ni(y,A.opacity)),e.strokeStyle=m,e.fillStyle=y,e.rect(this.left-.5*e.lineWidth,this.top-.5*e.lineWidth,this.width+e.lineWidth,this.height+e.lineWidth),la(e).call(e),this.performStroke(e,A),e.closePath()}this._drawImageAtPosition(e,A),this._drawImageLabel(e,I,l,o,r),this.updateBoundingBox(t,i),e.restore()}updateBoundingBox(e,t){this.resize(),this.options.shapeProperties.coordinateOrigin==="top-left"?(this.left=e,this.top=t):(this.left=e-this.width/2,this.top=t-this.height/2),this.boundingBox.left=this.left,this.boundingBox.top=this.top,this.boundingBox.bottom=this.top+this.height,this.boundingBox.right=this.left+this.width,this.options.label!==void 0&&this.labelModule.size.width>0&&(this.boundingBox.left=Math.min(this.boundingBox.left,this.labelModule.size.left),this.boundingBox.right=Math.max(this.boundingBox.right,this.labelModule.size.left+this.labelModule.size.width),this.boundingBox.bottom=Math.max(this.boundingBox.bottom,this.boundingBox.bottom+this.labelOffset))}distanceToBorder(e,t){return this._distanceToBorder(e,t)}};class NX extends jg{constructor(e,t,i){super(e,t,i)}draw(e,t,i,o,r,A){return this._drawShape(e,"square",2,t,i,o,r,A)}distanceToBorder(e,t){return this._distanceToBorder(e,t)}}class DX extends jg{constructor(e,t,i){super(e,t,i)}draw(e,t,i,o,r,A){return this._drawShape(e,"hexagon",4,t,i,o,r,A)}distanceToBorder(e,t){return this._distanceToBorder(e,t)}}class MX extends jg{constructor(e,t,i){super(e,t,i)}draw(e,t,i,o,r,A){return this._drawShape(e,"star",4,t,i,o,r,A)}distanceToBorder(e,t){return this._distanceToBorder(e,t)}}class zX extends _o{constructor(e,t,i){super(e,t,i),this._setMargins(i)}resize(e,t,i){this.needsRefresh(t,i)&&(this.textSize=this.labelModule.getTextSize(e,t,i),this.width=this.textSize.width+this.margin.right+this.margin.left,this.height=this.textSize.height+this.margin.top+this.margin.bottom,this.radius=.5*this.width)}draw(e,t,i,o,r,A){this.resize(e,o,r),this.left=t-this.width/2,this.top=i-this.height/2,this.enableShadow(e,A),this.labelModule.draw(e,this.left+this.textSize.width/2+this.margin.left,this.top+this.textSize.height/2+this.margin.top,o,r),this.disableShadow(e,A),this.updateBoundingBox(t,i,e,o,r)}distanceToBorder(e,t){return this._distanceToBorder(e,t)}}let kX=class extends jg{constructor(e,t,i){super(e,t,i)}draw(e,t,i,o,r,A){return this._drawShape(e,"triangle",3,t,i,o,r,A)}distanceToBorder(e,t){return this._distanceToBorder(e,t)}};class RX extends jg{constructor(e,t,i){super(e,t,i)}draw(e,t,i,o,r,A){return this._drawShape(e,"triangleDown",3,t,i,o,r,A)}distanceToBorder(e,t){return this._distanceToBorder(e,t)}}function Xw(n,e){var t=xt(n);if(_i){var i=_i(n);e&&(i=Qt(i).call(i,function(o){return ji(n,o).enumerable})),t.push.apply(t,i)}return t}function $w(n){for(var e=1;et[c]!=null);l.push("font"),PC(l,e,I),e.color=Wd(e.color)}static parseOptions(e,t){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},r=arguments.length>4?arguments[4]:void 0;if(PC(["color","fixed","shadow"],e,t,i),Nt.checkMass(t),e.opacity!==void 0&&(Nt.checkOpacity(e.opacity)||(console.error("Invalid option for node opacity. Value must be between 0 and 1, found: "+e.opacity),e.opacity=void 0)),t.opacity!==void 0&&(Nt.checkOpacity(t.opacity)||(console.error("Invalid option for node opacity. Value must be between 0 and 1, found: "+t.opacity),t.opacity=void 0)),t.shapeProperties&&!Nt.checkCoordinateOrigin(t.shapeProperties.coordinateOrigin)&&console.error("Invalid option for node coordinateOrigin, found: "+t.shapeProperties.coordinateOrigin),ii(e,t,"shadow",o),t.color!==void 0&&t.color!==null){const I=Wd(t.color);u1(e.color,I)}else i===!0&&t.color===null&&(e.color=Mg(o.color));t.fixed!==void 0&&t.fixed!==null&&(typeof t.fixed=="boolean"?(e.fixed.x=t.fixed,e.fixed.y=t.fixed):(t.fixed.x!==void 0&&typeof t.fixed.x=="boolean"&&(e.fixed.x=t.fixed.x),t.fixed.y!==void 0&&typeof t.fixed.y=="boolean"&&(e.fixed.y=t.fixed.y))),i===!0&&t.font===null&&(e.font=Mg(o.font)),Nt.updateGroupOptions(e,t,r),t.scaling!==void 0&&ii(e.scaling,t.scaling,"label",o.scaling)}getFormattingValues(){const e={color:this.options.color.background,opacity:this.options.opacity,borderWidth:this.options.borderWidth,borderColor:this.options.color.border,size:this.options.size,borderDashes:this.options.shapeProperties.borderDashes,borderRadius:this.options.shapeProperties.borderRadius,shadow:this.options.shadow.enabled,shadowColor:this.options.shadow.color,shadowSize:this.options.shadow.size,shadowX:this.options.shadow.x,shadowY:this.options.shadow.y};if(this.selected||this.hover?this.chooser===!0?this.selected?(this.options.borderWidthSelected!=null?e.borderWidth=this.options.borderWidthSelected:e.borderWidth*=2,e.color=this.options.color.highlight.background,e.borderColor=this.options.color.highlight.border,e.shadow=this.options.shadow.enabled):this.hover&&(e.color=this.options.color.hover.background,e.borderColor=this.options.color.hover.border,e.shadow=this.options.shadow.enabled):typeof this.chooser=="function"&&(this.chooser(e,this.options.id,this.selected,this.hover),e.shadow===!1&&(e.shadowColor!==this.options.shadow.color||e.shadowSize!==this.options.shadow.size||e.shadowX!==this.options.shadow.x||e.shadowY!==this.options.shadow.y)&&(e.shadow=!0)):e.shadow=this.options.shadow.enabled,this.options.opacity!==void 0){const t=this.options.opacity;e.borderColor=ni(e.borderColor,t),e.color=ni(e.color,t),e.shadowColor=ni(e.shadowColor,t)}return e}updateLabelModule(e){(this.options.label===void 0||this.options.label===null)&&(this.options.label=""),Nt.updateGroupOptions(this.options,$w($w({},e),{},{color:e&&e.color||this._localColor||void 0}),this.grouplist);const t=this.grouplist.get(this.options.group,!1),i=[e,this.options,t,this.globalOptions,this.defaultOptions];this.labelModule.update(this.options,i),this.labelModule.baseSize!==void 0&&(this.baseFontSize=this.labelModule.baseSize)}updateShape(e){if(e===this.options.shape&&this.shape)this.shape.setOptions(this.options,this.imageObj,this.imageObjAlt);else switch(this.options.shape){case"box":this.shape=new mX(this.options,this.body,this.labelModule);break;case"circle":this.shape=new vX(this.options,this.body,this.labelModule);break;case"circularImage":this.shape=new yX(this.options,this.body,this.labelModule,this.imageObj,this.imageObjAlt);break;case"custom":this.shape=new wX(this.options,this.body,this.labelModule,this.options.ctxRenderer);break;case"database":this.shape=new xX(this.options,this.body,this.labelModule);break;case"diamond":this.shape=new SX(this.options,this.body,this.labelModule);break;case"dot":this.shape=new EX(this.options,this.body,this.labelModule);break;case"ellipse":this.shape=new Qw(this.options,this.body,this.labelModule);break;case"icon":this.shape=new TX(this.options,this.body,this.labelModule);break;case"image":this.shape=new OX(this.options,this.body,this.labelModule,this.imageObj,this.imageObjAlt);break;case"square":this.shape=new NX(this.options,this.body,this.labelModule);break;case"hexagon":this.shape=new DX(this.options,this.body,this.labelModule);break;case"star":this.shape=new MX(this.options,this.body,this.labelModule);break;case"text":this.shape=new zX(this.options,this.body,this.labelModule);break;case"triangle":this.shape=new kX(this.options,this.body,this.labelModule);break;case"triangleDown":this.shape=new RX(this.options,this.body,this.labelModule);break;default:this.shape=new Qw(this.options,this.body,this.labelModule);break}this.needsRefresh()}select(){this.selected=!0,this.needsRefresh()}unselect(){this.selected=!1,this.needsRefresh()}needsRefresh(){this.shape.refreshNeeded=!0}getTitle(){return this.options.title}distanceToBorder(e,t){return this.shape.distanceToBorder(e,t)}isFixed(){return this.options.fixed.x&&this.options.fixed.y}isSelected(){return this.selected}getValue(){return this.options.value}getLabelSize(){return this.labelModule.size()}setValueRange(e,t,i){if(this.options.value!==void 0){const o=this.options.scaling.customScalingFunction(e,t,i,this.options.value),r=this.options.scaling.max-this.options.scaling.min;if(this.options.scaling.label.enabled===!0){const A=this.options.scaling.label.max-this.options.scaling.label.min;this.options.font.size=this.options.scaling.label.min+o*A}this.options.size=this.options.scaling.min+o*r}else this.options.size=this.baseSize,this.options.font.size=this.baseFontSize;this.updateLabelModule()}draw(e){const t=this.getFormattingValues();return this.shape.draw(e,this.x,this.y,this.selected,this.hover,t)||{}}updateBoundingBox(e){this.shape.updateBoundingBox(this.x,this.y,e)}resize(e){const t=this.getFormattingValues();this.shape.resize(e,this.selected,this.hover,t)}getItemsOnPoint(e){const t=[];return this.labelModule.visible()&&xu(this.labelModule.getSize(),e)&&t.push({nodeId:this.id,labelId:0}),xu(this.shape.boundingBox,e)&&t.push({nodeId:this.id}),t}isOverlappingWith(e){return this.shape.lefte.left&&this.shape.tope.top}isBoundingBoxOverlappingWith(e){return this.shape.boundingBox.lefte.left&&this.shape.boundingBox.tope.top}static checkMass(e,t){if(e.mass!==void 0&&e.mass<=0){let i="";t!==void 0&&(i=" in node id: "+t),console.error("%cNegative or zero mass disallowed"+i+", setting mass to 1.",v1),e.mass=1}}}class _X{constructor(e,t,i,o){var r;if(this.body=e,this.images=t,this.groups=i,this.layoutEngine=o,this.body.functions.createNode=ge(r=this.create).call(r,this),this.nodesListeners={add:(A,I)=>{this.add(I.items)},update:(A,I)=>{this.update(I.items,I.data,I.oldData)},remove:(A,I)=>{this.remove(I.items)}},this.defaultOptions={borderWidth:1,borderWidthSelected:void 0,brokenImage:void 0,color:{border:"#2B7CE9",background:"#97C2FC",highlight:{border:"#2B7CE9",background:"#D2E5FF"},hover:{border:"#2B7CE9",background:"#D2E5FF"}},opacity:void 0,fixed:{x:!1,y:!1},font:{color:"#343434",size:14,face:"arial",background:"none",strokeWidth:0,strokeColor:"#ffffff",align:"center",vadjust:0,multi:!1,bold:{mod:"bold"},boldital:{mod:"bold italic"},ital:{mod:"italic"},mono:{mod:"",size:15,face:"monospace",vadjust:2}},group:void 0,hidden:!1,icon:{face:"FontAwesome",code:void 0,size:50,color:"#2B7CE9"},image:void 0,imagePadding:{top:0,right:0,bottom:0,left:0},label:void 0,labelHighlightBold:!0,level:void 0,margin:{top:5,right:5,bottom:5,left:5},mass:1,physics:!0,scaling:{min:10,max:30,label:{enabled:!1,min:14,max:30,maxVisible:30,drawThreshold:5},customScalingFunction:function(A,I,l,c){if(I===A)return .5;{const h=1/(I-A);return Math.max(0,(c-A)*h)}}},shadow:{enabled:!1,color:"rgba(0,0,0,0.5)",size:10,x:5,y:5},shape:"ellipse",shapeProperties:{borderDashes:!1,borderRadius:6,interpolation:!0,useImageSize:!1,useBorderWithImage:!1,coordinateOrigin:"center"},size:25,title:void 0,value:void 0,x:void 0,y:void 0},this.defaultOptions.mass<=0)throw"Internal error: mass in defaultOptions of NodesHandler may not be zero or negative";this.options=Mg(this.defaultOptions),this.bindEventListeners()}bindEventListeners(){var e,t;this.body.emitter.on("refreshNodes",ge(e=this.refresh).call(e,this)),this.body.emitter.on("refresh",ge(t=this.refresh).call(t,this)),this.body.emitter.on("destroy",()=>{Ye(this.nodesListeners,(i,o)=>{this.body.data.nodes&&this.body.data.nodes.off(o,i)}),delete this.body.functions.createNode,delete this.nodesListeners.add,delete this.nodesListeners.update,delete this.nodesListeners.remove,delete this.nodesListeners})}setOptions(e){if(e!==void 0){if(Nt.parseOptions(this.options,e),e.opacity!==void 0&&(Au(e.opacity)||!ko(e.opacity)||e.opacity<0||e.opacity>1?console.error("Invalid option for node opacity. Value must be between 0 and 1, found: "+e.opacity):this.options.opacity=e.opacity),e.shape!==void 0)for(const t in this.body.nodes)Object.prototype.hasOwnProperty.call(this.body.nodes,t)&&this.body.nodes[t].updateShape();if(typeof e.font<"u"||typeof e.widthConstraint<"u"||typeof e.heightConstraint<"u")for(const t of xt(this.body.nodes))this.body.nodes[t].updateLabelModule(),this.body.nodes[t].needsRefresh();if(e.size!==void 0)for(const t in this.body.nodes)Object.prototype.hasOwnProperty.call(this.body.nodes,t)&&this.body.nodes[t].needsRefresh();(e.hidden!==void 0||e.physics!==void 0)&&this.body.emitter.emit("_dataChanged")}}setData(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;const i=this.body.data.nodes;if(Lw("id",e))this.body.data.nodes=e;else if(nt(e))this.body.data.nodes=new Bs,this.body.data.nodes.add(e);else if(!e)this.body.data.nodes=new Bs;else throw new TypeError("Array or DataSet expected");if(i&&Ye(this.nodesListeners,function(o,r){i.off(r,o)}),this.body.nodes={},this.body.data.nodes){const o=this;Ye(this.nodesListeners,function(A,I){o.body.data.nodes.on(I,A)});const r=this.body.data.nodes.getIds();this.add(r,!0)}t===!1&&this.body.emitter.emit("_dataChanged")}add(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,i;const o=[];for(let r=0;r1&&arguments[1]!==void 0?arguments[1]:Nt;return new t(e,this.body,this.images,this.groups,this.options,this.defaultOptions)}refresh(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;Ye(this.body.nodes,(t,i)=>{const o=this.body.data.nodes.get(i);o!==void 0&&(e===!0&&t.setOptions({x:null,y:null}),t.setOptions({fixed:!1}),t.setOptions(o))})}getPositions(e){const t={};if(e!==void 0){if(nt(e)===!0){for(let i=0;i{this.body.emitter.emit("startSimulation")},0)):console.error("Node id supplied to moveNode does not exist. Provided: ",e)}}var jX=Me,qw=Math.hypot,ZX=Math.abs,BX=Math.sqrt,PX=!!qw&&qw(1/0,NaN)!==1/0;jX({target:"Math",stat:!0,forced:PX},{hypot:function(e,t){for(var i=0,o=0,r=arguments.length,A=0,I,l;o0?(l=I/A,i+=l*l):i+=I;return A===1/0?1/0:A*BX(i)}});var LX=at,GX=LX.Math.hypot,FX=GX,VX=FX,UX=VX,YX=Ee(UX);class Vt{static transform(e,t){nt(e)||(e=[e]);const i=t.point.x,o=t.point.y,r=t.angle,A=t.length;for(let I=0;I4&&arguments[4]!==void 0?arguments[4]:this.getViaNode();e.strokeStyle=this.getColor(e,t),e.lineWidth=t.width,t.dashes!==!1?this._drawDashedLine(e,t,r):this._drawLine(e,t,r)}_drawLine(e,t,i,o,r){if(this.from!=this.to)this._line(e,t,i,o,r);else{const[A,I,l]=this._getCircleData(e);this._circle(e,t,A,I,l)}}_drawDashedLine(e,t,i,o,r){e.lineCap="round";const A=nt(t.dashes)?t.dashes:[5,5];if(e.setLineDash!==void 0){if(e.save(),e.setLineDash(A),e.lineDashOffset=0,this.from!=this.to)this._line(e,t,i);else{const[I,l,c]=this._getCircleData(e);this._circle(e,t,I,l,c)}e.setLineDash([0]),e.lineDashOffset=0,e.restore()}else{if(this.from!=this.to)hy(e,this.from.x,this.from.y,this.to.x,this.to.y,A);else{const[I,l,c]=this._getCircleData(e);this._circle(e,t,I,l,c)}this.enableShadow(e,t),e.stroke(),this.disableShadow(e,t)}}findBorderPosition(e,t,i){return this.from!=this.to?this._findBorderPosition(e,t,i):this._findBorderPositionCircle(e,t,i)}findBorderPositions(e){if(this.from!=this.to)return{from:this._findBorderPosition(this.from,e),to:this._findBorderPosition(this.to,e)};{var t;const[i,o]=vi(t=this._getCircleData(e)).call(t,0,2);return{from:this._findBorderPositionCircle(this.from,e,{x:i,y:o,low:.25,high:.6,direction:-1}),to:this._findBorderPositionCircle(this.from,e,{x:i,y:o,low:.6,high:.8,direction:1})}}}_getCircleData(e){const t=this.options.selfReference.size;e!==void 0&&this.from.shape.width===void 0&&this.from.shape.resize(e);const i=Hw(e,this.options.selfReference.angle,t,this.from);return[i.x,i.y,t]}_pointOnCircle(e,t,i,o){const r=o*2*Math.PI;return{x:e+i*Math.cos(r),y:t-i*Math.sin(r)}}_findBorderPositionCircle(e,t,i){const o=i.x,r=i.y;let A=i.low,I=i.high;const l=i.direction,c=10,h=this.options.selfReference.size,p=.05;let m,y=(A+I)*.5,w=0;this.options.arrowStrikethrough===!0&&(l===-1?w=this.options.endPointOffset.from:l===1&&(w=this.options.endPointOffset.to));let S=0;do{y=(A+I)*.5,m=this._pointOnCircle(o,r,h,y);const x=Math.atan2(e.y-m.y,e.x-m.x),O=e.distanceToBorder(t,x)+w,E=Math.sqrt(Math.pow(m.x-e.x,2)+Math.pow(m.y-e.y,2)),_=O-E;if(Math.abs(_)0?l>0?A=y:I=y:l>0?I=y:A=y,++S}while(A<=I&&S1?h=1:h<0&&(h=0);const p=e+h*I,m=t+h*l,y=p-r,w=m-A;return Math.sqrt(y*y+w*w)}getArrowData(e,t,i,o,r,A){let I,l,c,h,p,m,y;const w=A.width;t==="from"?(c=this.from,h=this.to,p=A.fromArrowScale<0,m=Math.abs(A.fromArrowScale),y=A.fromArrowType):t==="to"?(c=this.to,h=this.from,p=A.toArrowScale<0,m=Math.abs(A.toArrowScale),y=A.toArrowType):(c=this.to,h=this.from,p=A.middleArrowScale<0,m=Math.abs(A.middleArrowScale),y=A.middleArrowType);const S=15*m+3*w;if(c!=h){const _=YX(c.x-h.x,c.y-h.y),P=S/_;if(t!=="middle")if(this.options.smooth.enabled===!0){const Q=this._findBorderPosition(c,e,{via:i}),ne=this.getPoint(Q.t+P*(t==="from"?1:-1),i);I=Math.atan2(Q.y-ne.y,Q.x-ne.x),l=Q}else I=Math.atan2(c.y-h.y,c.x-h.x),l=this._findBorderPosition(c,e);else{const Q=(p?-P:P)/2,ne=this.getPoint(.5+Q,i),F=this.getPoint(.5-Q,i);I=Math.atan2(ne.y-F.y,ne.x-F.x),l=this.getPoint(.5,i)}}else{const[_,P,Q]=this._getCircleData(e);if(t==="from"){const ne=this.options.selfReference.angle,F=this.options.selfReference.angle+Math.PI,Z=this._findBorderPositionCircle(this.from,e,{x:_,y:P,low:ne,high:F,direction:-1});I=Z.t*-2*Math.PI+1.5*Math.PI+.1*Math.PI,l=Z}else if(t==="to"){const ne=this.options.selfReference.angle,F=this.options.selfReference.angle+Math.PI,Z=this._findBorderPositionCircle(this.from,e,{x:_,y:P,low:ne,high:F,direction:1});I=Z.t*-2*Math.PI+1.5*Math.PI-1.1*Math.PI,l=Z}else{const ne=this.options.selfReference.angle/(2*Math.PI);l=this._pointOnCircle(_,P,Q,ne),I=ne*-2*Math.PI+1.5*Math.PI+.1*Math.PI}}const x=l.x-S*.9*Math.cos(I),O=l.y-S*.9*Math.sin(I);return{point:l,core:{x,y:O},angle:I,length:S,type:y}}drawArrowHead(e,t,i,o,r){e.strokeStyle=this.getColor(e,t),e.fillStyle=e.strokeStyle,e.lineWidth=t.width,Jw.draw(e,r)&&(this.enableShadow(e,t),la(e).call(e),this.disableShadow(e,t))}enableShadow(e,t){t.shadow===!0&&(e.shadowColor=t.shadowColor,e.shadowBlur=t.shadowSize,e.shadowOffsetX=t.shadowX,e.shadowOffsetY=t.shadowY)}disableShadow(e,t){t.shadow===!0&&(e.shadowColor="rgba(0,0,0,0)",e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0)}drawBackground(e,t){if(t.background!==!1){const i={strokeStyle:e.strokeStyle,lineWidth:e.lineWidth,dashes:e.dashes};e.strokeStyle=t.backgroundColor,e.lineWidth=t.backgroundSize,this.setStrokeDashed(e,t.backgroundDashes),e.stroke(),e.strokeStyle=i.strokeStyle,e.lineWidth=i.lineWidth,e.dashes=i.dashes,this.setStrokeDashed(e,t.dashes)}}setStrokeDashed(e,t){if(t!==!1)if(e.setLineDash!==void 0){const i=nt(t)?t:[5,5];e.setLineDash(i)}else console.warn("setLineDash is not supported in this browser. The dashed stroke cannot be used.");else e.setLineDash!==void 0?e.setLineDash([]):console.warn("setLineDash is not supported in this browser. The dashed stroke cannot be used.")}}function ix(n,e){var t=xt(n);if(_i){var i=_i(n);e&&(i=Qt(i).call(i,function(o){return ji(n,o).enumerable})),t.push.apply(t,i)}return t}function gx(n){for(var e=1;e2&&arguments[2]!==void 0?arguments[2]:this._getViaCoordinates();const o=10,r=.2;let A=!1,I=1,l=0,c=this.to,h,p,m=this.options.endPointOffset?this.options.endPointOffset.to:0;e.id===this.from.id&&(c=this.from,A=!0,m=this.options.endPointOffset?this.options.endPointOffset.from:0),this.options.arrowStrikethrough===!1&&(m=0);let y=0;do{p=(l+I)*.5,h=this.getPoint(p,i);const w=Math.atan2(c.y-h.y,c.x-h.x),S=c.distanceToBorder(t,w)+m,x=Math.sqrt(Math.pow(h.x-c.x,2)+Math.pow(h.y-c.y,2)),O=S-x;if(Math.abs(O)0&&(c=this._getDistanceToLine(w,S,m,y,r,A),l=c{this.positionBezierNode()},this._body.emitter.on("_repositionBezierNodes",this._boundFunction)}setOptions(e){super.setOptions(e);let t=!1;this.options.physics!==e.physics&&(t=!0),this.options=e,this.id=this.options.id,this.from=this._body.nodes[this.options.from],this.to=this._body.nodes[this.options.to],this.setupSupportNode(),this.connect(),t===!0&&(this.via.setOptions({physics:this.options.physics}),this.positionBezierNode())}connect(){this.from=this._body.nodes[this.options.from],this.to=this._body.nodes[this.options.to],this.from===void 0||this.to===void 0||this.options.physics===!1?this.via.setOptions({physics:!1}):this.from.id===this.to.id?this.via.setOptions({physics:!1}):this.via.setOptions({physics:!0})}cleanup(){return this._body.emitter.off("_repositionBezierNodes",this._boundFunction),this.via!==void 0?(delete this._body.nodes[this.via.id],this.via=void 0,!0):!1}setupSupportNode(){if(this.via===void 0){const e="edgeId:"+this.id,t=this._body.functions.createNode({id:e,shape:"circle",physics:!0,hidden:!0});this._body.nodes[e]=t,this.via=t,this.via.parentEdgeId=this.id,this.positionBezierNode()}}positionBezierNode(){this.via!==void 0&&this.from!==void 0&&this.to!==void 0?(this.via.x=.5*(this.from.x+this.to.x),this.via.y=.5*(this.from.y+this.to.y)):this.via!==void 0&&(this.via.x=0,this.via.y=0)}_line(e,t,i){this._bezierCurve(e,t,i)}_getViaCoordinates(){return this.via}getViaNode(){return this.via}getPoint(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.via;if(this.from===this.to){const[i,o,r]=this._getCircleData(),A=2*Math.PI*(1-e);return{x:i+r*Math.sin(A),y:o+r-r*(1-Math.cos(A))}}else return{x:Math.pow(1-e,2)*this.fromPoint.x+2*e*(1-e)*t.x+Math.pow(e,2)*this.toPoint.x,y:Math.pow(1-e,2)*this.fromPoint.y+2*e*(1-e)*t.y+Math.pow(e,2)*this.toPoint.y}}_findBorderPosition(e,t){return this._findBorderPositionBezier(e,t,this.via)}_getDistanceToEdge(e,t,i,o,r,A){return this._getDistanceToBezierEdge(e,t,i,o,r,A,this.via)}}class sx extends Eu{constructor(e,t,i){super(e,t,i)}_line(e,t,i){this._bezierCurve(e,t,i)}getViaNode(){return this._getViaCoordinates()}_getViaCoordinates(){const e=this.options.smooth.roundness,t=this.options.smooth.type;let i=Math.abs(this.from.x-this.to.x),o=Math.abs(this.from.y-this.to.y);if(t==="discrete"||t==="diagonalCross"){let r,A;i<=o?r=A=e*o:r=A=e*i,this.from.x>this.to.x&&(r=-r),this.from.y>=this.to.y&&(A=-A);let I=this.from.x+r,l=this.from.y+A;return t==="discrete"&&(i<=o?I=ithis.to.x&&(r=-r),this.from.y>=this.to.y&&(A=-A);let I=this.from.x+r,l=this.from.y+A;return i<=o?this.from.x<=this.to.x?I=this.to.xI?this.to.x:I:this.from.y>=this.to.y?l=this.to.y>l?this.to.y:l:l=this.to.y2&&arguments[2]!==void 0?arguments[2]:{};return this._findBorderPositionBezier(e,t,i.via)}_getDistanceToEdge(e,t,i,o,r,A){let I=arguments.length>6&&arguments[6]!==void 0?arguments[6]:this._getViaCoordinates();return this._getDistanceToBezierEdge(e,t,i,o,r,A,I)}getPoint(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this._getViaCoordinates();const i=e,o=Math.pow(1-i,2)*this.fromPoint.x+2*i*(1-i)*t.x+Math.pow(i,2)*this.toPoint.x,r=Math.pow(1-i,2)*this.fromPoint.y+2*i*(1-i)*t.y+Math.pow(i,2)*this.toPoint.y;return{x:o,y:r}}}class g$ extends Eu{constructor(e,t,i){super(e,t,i)}_getDistanceToBezierEdge2(e,t,i,o,r,A,I,l){let c=1e9,h=e,p=t;const m=[0,0,0,0];for(let y=1;y<10;y++){const w=.1*y;m[0]=Math.pow(1-w,3),m[1]=3*w*Math.pow(1-w,2),m[2]=3*Math.pow(w,2)*(1-w),m[3]=Math.pow(w,3);const S=m[0]*e+m[1]*I.x+m[2]*l.x+m[3]*i,x=m[0]*t+m[1]*I.y+m[2]*l.y+m[3]*o;if(y>0){const O=this._getDistanceToLine(h,p,S,x,r,A);c=OMath.abs(t)||this.options.smooth.forceDirection===!0||this.options.smooth.forceDirection==="horizontal")&&this.options.smooth.forceDirection!=="vertical"?(o=this.from.y,A=this.to.y,i=this.from.x-I*e,r=this.to.x+I*e):(o=this.from.y-I*t,A=this.to.y+I*t,i=this.from.x,r=this.to.x),[{x:i,y:o},{x:r,y:A}]}getViaNode(){return this._getViaCoordinates()}_findBorderPosition(e,t){return this._findBorderPositionBezier(e,t)}_getDistanceToEdge(e,t,i,o,r,A){let[I,l]=arguments.length>6&&arguments[6]!==void 0?arguments[6]:this._getViaCoordinates();return this._getDistanceToBezierEdge2(e,t,i,o,r,A,I,l)}getPoint(e){let[t,i]=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this._getViaCoordinates();const o=e,r=[Math.pow(1-o,3),3*o*Math.pow(1-o,2),3*Math.pow(o,2)*(1-o),Math.pow(o,3)],A=r[0]*this.fromPoint.x+r[1]*t.x+r[2]*i.x+r[3]*this.toPoint.x,I=r[0]*this.fromPoint.y+r[1]*t.y+r[2]*i.y+r[3]*this.toPoint.y;return{x:A,y:I}}}class ax extends nx{constructor(e,t,i){super(e,t,i)}_line(e,t){e.beginPath(),e.moveTo(this.fromPoint.x,this.fromPoint.y),e.lineTo(this.toPoint.x,this.toPoint.y),this.enableShadow(e,t),e.stroke(),this.disableShadow(e,t)}getViaNode(){}getPoint(e){return{x:(1-e)*this.fromPoint.x+e*this.toPoint.x,y:(1-e)*this.fromPoint.y+e*this.toPoint.y}}_findBorderPosition(e,t){let i=this.to,o=this.from;e.id===this.from.id&&(i=this.from,o=this.to);const r=Math.atan2(i.y-o.y,i.x-o.x),A=i.x-o.x,I=i.y-o.y,l=Math.sqrt(A*A+I*I),c=e.distanceToBorder(t,r),h=(l-c)/l;return{x:(1-h)*o.x+h*i.x,y:(1-h)*o.y+h*i.y,t:0}}_getDistanceToEdge(e,t,i,o,r,A){return this._getDistanceToLine(e,t,i,o,r,A)}}class Zg{constructor(e,t,i,o,r){if(t===void 0)throw new Error("No body provided");this.options=Mg(o),this.globalOptions=o,this.defaultOptions=r,this.body=t,this.imagelist=i,this.id=void 0,this.fromId=void 0,this.toId=void 0,this.selected=!1,this.hover=!1,this.labelDirty=!0,this.baseWidth=this.options.width,this.baseFontSize=this.options.font.size,this.from=void 0,this.to=void 0,this.edgeType=void 0,this.connected=!1,this.labelModule=new Ps(this.body,this.options,!0),this.setOptions(e)}setOptions(e){if(!e)return;let t=typeof e.physics<"u"&&this.options.physics!==e.physics||typeof e.hidden<"u"&&(this.options.hidden||!1)!==(e.hidden||!1)||typeof e.from<"u"&&this.options.from!==e.from||typeof e.to<"u"&&this.options.to!==e.to;Zg.parseOptions(this.options,e,!0,this.globalOptions),e.id!==void 0&&(this.id=e.id),e.from!==void 0&&(this.fromId=e.from),e.to!==void 0&&(this.toId=e.to),e.title!==void 0&&(this.title=e.title),e.value!==void 0&&(e.value=Yw(e.value));const i=[e,this.options,this.defaultOptions];return this.chooser=wu("edge",i),this.updateLabelModule(e),t=this.updateEdgeType()||t,this._setInteractionWidths(),this.connect(),t}static parseOptions(e,t){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},r=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1;if(Ms(["endPointOffset","arrowStrikethrough","id","from","hidden","hoverWidth","labelHighlightBold","length","line","opacity","physics","scaling","selectionWidth","selfReferenceSize","selfReference","to","title","value","width","font","chosen","widthConstraint"],e,t,i),t.endPointOffset!==void 0&&t.endPointOffset.from!==void 0&&(ko(t.endPointOffset.from)?e.endPointOffset.from=t.endPointOffset.from:(e.endPointOffset.from=o.endPointOffset.from!==void 0?o.endPointOffset.from:0,console.error("endPointOffset.from is not a valid number"))),t.endPointOffset!==void 0&&t.endPointOffset.to!==void 0&&(ko(t.endPointOffset.to)?e.endPointOffset.to=t.endPointOffset.to:(e.endPointOffset.to=o.endPointOffset.to!==void 0?o.endPointOffset.to:0,console.error("endPointOffset.to is not a valid number"))),qC(t.label)?e.label=t.label:qC(e.label)||(e.label=void 0),ii(e,t,"smooth",o),ii(e,t,"shadow",o),ii(e,t,"background",o),t.dashes!==void 0&&t.dashes!==null?e.dashes=t.dashes:i===!0&&t.dashes===null&&(e.dashes=Og(o.dashes)),t.scaling!==void 0&&t.scaling!==null?(t.scaling.min!==void 0&&(e.scaling.min=t.scaling.min),t.scaling.max!==void 0&&(e.scaling.max=t.scaling.max),ii(e.scaling,t.scaling,"label",o.scaling)):i===!0&&t.scaling===null&&(e.scaling=Og(o.scaling)),t.arrows!==void 0&&t.arrows!==null)if(typeof t.arrows=="string"){const I=t.arrows.toLowerCase();e.arrows.to.enabled=Ct(I).call(I,"to")!=-1,e.arrows.middle.enabled=Ct(I).call(I,"middle")!=-1,e.arrows.from.enabled=Ct(I).call(I,"from")!=-1}else if(typeof t.arrows=="object")ii(e.arrows,t.arrows,"to",o.arrows),ii(e.arrows,t.arrows,"middle",o.arrows),ii(e.arrows,t.arrows,"from",o.arrows);else throw new Error("The arrow newOptions can only be an object or a string. Refer to the documentation. You used:"+ws(t.arrows));else i===!0&&t.arrows===null&&(e.arrows=Og(o.arrows));if(t.color!==void 0&&t.color!==null){const I=Ds(t.color)?{color:t.color,highlight:t.color,hover:t.color,inherit:!1,opacity:1}:t.color,l=e.color;if(r)vt(l,o.color,!1,i);else for(const c in l)Object.prototype.hasOwnProperty.call(l,c)&&delete l[c];if(Ds(l))l.color=l,l.highlight=l,l.hover=l,l.inherit=!1,I.opacity===void 0&&(l.opacity=1);else{let c=!1;I.color!==void 0&&(l.color=I.color,c=!0),I.highlight!==void 0&&(l.highlight=I.highlight,c=!0),I.hover!==void 0&&(l.hover=I.hover,c=!0),I.inherit!==void 0&&(l.inherit=I.inherit),I.opacity!==void 0&&(l.opacity=Math.min(1,Math.max(0,I.opacity))),c===!0?l.inherit=!1:l.inherit===void 0&&(l.inherit="from")}}else i===!0&&t.color===null&&(e.color=Mg(o.color));i===!0&&t.font===null&&(e.font=Mg(o.font)),Object.prototype.hasOwnProperty.call(t,"selfReferenceSize")&&(console.warn("The selfReferenceSize property has been deprecated. Please use selfReference property instead. The selfReference can be set like thise selfReference:{size:30, angle:Math.PI / 4}"),e.selfReference.size=t.selfReferenceSize)}getFormattingValues(){const e=this.options.arrows.to===!0||this.options.arrows.to.enabled===!0,t=this.options.arrows.from===!0||this.options.arrows.from.enabled===!0,i=this.options.arrows.middle===!0||this.options.arrows.middle.enabled===!0,o=this.options.color.inherit,r={toArrow:e,toArrowScale:this.options.arrows.to.scaleFactor,toArrowType:this.options.arrows.to.type,toArrowSrc:this.options.arrows.to.src,toArrowImageWidth:this.options.arrows.to.imageWidth,toArrowImageHeight:this.options.arrows.to.imageHeight,middleArrow:i,middleArrowScale:this.options.arrows.middle.scaleFactor,middleArrowType:this.options.arrows.middle.type,middleArrowSrc:this.options.arrows.middle.src,middleArrowImageWidth:this.options.arrows.middle.imageWidth,middleArrowImageHeight:this.options.arrows.middle.imageHeight,fromArrow:t,fromArrowScale:this.options.arrows.from.scaleFactor,fromArrowType:this.options.arrows.from.type,fromArrowSrc:this.options.arrows.from.src,fromArrowImageWidth:this.options.arrows.from.imageWidth,fromArrowImageHeight:this.options.arrows.from.imageHeight,arrowStrikethrough:this.options.arrowStrikethrough,color:o?void 0:this.options.color.color,inheritsColor:o,opacity:this.options.color.opacity,hidden:this.options.hidden,length:this.options.length,shadow:this.options.shadow.enabled,shadowColor:this.options.shadow.color,shadowSize:this.options.shadow.size,shadowX:this.options.shadow.x,shadowY:this.options.shadow.y,dashes:this.options.dashes,width:this.options.width,background:this.options.background.enabled,backgroundColor:this.options.background.color,backgroundSize:this.options.background.size,backgroundDashes:this.options.background.dashes};if(this.selected||this.hover)if(this.chooser===!0){if(this.selected){const A=this.options.selectionWidth;typeof A=="function"?r.width=A(r.width):typeof A=="number"&&(r.width+=A),r.width=Math.max(r.width,.3/this.body.view.scale),r.color=this.options.color.highlight,r.shadow=this.options.shadow.enabled}else if(this.hover){const A=this.options.hoverWidth;typeof A=="function"?r.width=A(r.width):typeof A=="number"&&(r.width+=A),r.width=Math.max(r.width,.3/this.body.view.scale),r.color=this.options.color.hover,r.shadow=this.options.shadow.enabled}}else typeof this.chooser=="function"&&(this.chooser(r,this.options.id,this.selected,this.hover),r.color!==void 0&&(r.inheritsColor=!1),r.shadow===!1&&(r.shadowColor!==this.options.shadow.color||r.shadowSize!==this.options.shadow.size||r.shadowX!==this.options.shadow.x||r.shadowY!==this.options.shadow.y)&&(r.shadow=!0));else r.shadow=this.options.shadow.enabled,r.width=Math.max(r.width,.3/this.body.view.scale);return r}updateLabelModule(e){const t=[e,this.options,this.globalOptions,this.defaultOptions];this.labelModule.update(this.options,t),this.labelModule.baseSize!==void 0&&(this.baseFontSize=this.labelModule.baseSize)}updateEdgeType(){const e=this.options.smooth;let t=!1,i=!0;return this.edgeType!==void 0&&((this.edgeType instanceof ox&&e.enabled===!0&&e.type==="dynamic"||this.edgeType instanceof rx&&e.enabled===!0&&e.type==="cubicBezier"||this.edgeType instanceof sx&&e.enabled===!0&&e.type!=="dynamic"&&e.type!=="cubicBezier"||this.edgeType instanceof ax&&e.type.enabled===!1)&&(i=!1),i===!0&&(t=this.cleanup())),i===!0?e.enabled===!0?e.type==="dynamic"?(t=!0,this.edgeType=new ox(this.options,this.body,this.labelModule)):e.type==="cubicBezier"?this.edgeType=new rx(this.options,this.body,this.labelModule):this.edgeType=new sx(this.options,this.body,this.labelModule):this.edgeType=new ax(this.options,this.body,this.labelModule):this.edgeType.setOptions(this.options),t}connect(){this.disconnect(),this.from=this.body.nodes[this.fromId]||void 0,this.to=this.body.nodes[this.toId]||void 0,this.connected=this.from!==void 0&&this.to!==void 0,this.connected===!0?(this.from.attachEdge(this),this.to.attachEdge(this)):(this.from&&this.from.detachEdge(this),this.to&&this.to.detachEdge(this)),this.edgeType.connect()}disconnect(){this.from&&(this.from.detachEdge(this),this.from=void 0),this.to&&(this.to.detachEdge(this),this.to=void 0),this.connected=!1}getTitle(){return this.title}isSelected(){return this.selected}getValue(){return this.options.value}setValueRange(e,t,i){if(this.options.value!==void 0){const o=this.options.scaling.customScalingFunction(e,t,i,this.options.value),r=this.options.scaling.max-this.options.scaling.min;if(this.options.scaling.label.enabled===!0){const A=this.options.scaling.label.max-this.options.scaling.label.min;this.options.font.size=this.options.scaling.label.min+o*A}this.options.width=this.options.scaling.min+o*r}else this.options.width=this.baseWidth,this.options.font.size=this.baseFontSize;this._setInteractionWidths(),this.updateLabelModule()}_setInteractionWidths(){typeof this.options.hoverWidth=="function"?this.edgeType.hoverWidth=this.options.hoverWidth(this.options.width):this.edgeType.hoverWidth=this.options.hoverWidth+this.options.width,typeof this.options.selectionWidth=="function"?this.edgeType.selectionWidth=this.options.selectionWidth(this.options.width):this.edgeType.selectionWidth=this.options.selectionWidth+this.options.width}draw(e){const t=this.getFormattingValues();if(t.hidden)return;const i=this.edgeType.getViaNode();this.edgeType.drawLine(e,t,this.selected,this.hover,i),this.drawLabel(e,i)}drawArrows(e){const t=this.getFormattingValues();if(t.hidden)return;const i=this.edgeType.getViaNode(),o={};this.edgeType.fromPoint=this.edgeType.from,this.edgeType.toPoint=this.edgeType.to,t.fromArrow&&(o.from=this.edgeType.getArrowData(e,"from",i,this.selected,this.hover,t),t.arrowStrikethrough===!1&&(this.edgeType.fromPoint=o.from.core),t.fromArrowSrc&&(o.from.image=this.imagelist.load(t.fromArrowSrc)),t.fromArrowImageWidth&&(o.from.imageWidth=t.fromArrowImageWidth),t.fromArrowImageHeight&&(o.from.imageHeight=t.fromArrowImageHeight)),t.toArrow&&(o.to=this.edgeType.getArrowData(e,"to",i,this.selected,this.hover,t),t.arrowStrikethrough===!1&&(this.edgeType.toPoint=o.to.core),t.toArrowSrc&&(o.to.image=this.imagelist.load(t.toArrowSrc)),t.toArrowImageWidth&&(o.to.imageWidth=t.toArrowImageWidth),t.toArrowImageHeight&&(o.to.imageHeight=t.toArrowImageHeight)),t.middleArrow&&(o.middle=this.edgeType.getArrowData(e,"middle",i,this.selected,this.hover,t),t.middleArrowSrc&&(o.middle.image=this.imagelist.load(t.middleArrowSrc)),t.middleArrowImageWidth&&(o.middle.imageWidth=t.middleArrowImageWidth),t.middleArrowImageHeight&&(o.middle.imageHeight=t.middleArrowImageHeight)),t.fromArrow&&this.edgeType.drawArrowHead(e,t,this.selected,this.hover,o.from),t.middleArrow&&this.edgeType.drawArrowHead(e,t,this.selected,this.hover,o.middle),t.toArrow&&this.edgeType.drawArrowHead(e,t,this.selected,this.hover,o.to)}drawLabel(e,t){if(this.options.label!==void 0){const i=this.from,o=this.to;this.labelModule.differentState(this.selected,this.hover)&&this.labelModule.getTextSize(e,this.selected,this.hover);let r;if(i.id!=o.id){this.labelModule.pointToSelf=!1,r=this.edgeType.getPoint(.5,t),e.save();const A=this._getRotation(e);A.angle!=0&&(e.translate(A.x,A.y),e.rotate(A.angle)),this.labelModule.draw(e,r.x,r.y,this.selected,this.hover),e.restore()}else{this.labelModule.pointToSelf=!0;const A=Hw(e,this.options.selfReference.angle,this.options.selfReference.size,i);r=this._pointOnCircle(A.x,A.y,this.options.selfReference.size,this.options.selfReference.angle),this.labelModule.draw(e,r.x,r.y,this.selected,this.hover)}}}getItemsOnPoint(e){const t=[];if(this.labelModule.visible()){const o=this._getRotation();xu(this.labelModule.getSize(),e,o)&&t.push({edgeId:this.id,labelId:0})}const i={left:e.x,top:e.y};return this.isOverlappingWith(i)&&t.push({edgeId:this.id}),t}isOverlappingWith(e){if(this.connected){const i=this.from.x,o=this.from.y,r=this.to.x,A=this.to.y,I=e.left,l=e.top;return this.edgeType.getDistanceToEdge(i,o,r,A,I,l)<10}else return!1}_getRotation(e){const t=this.edgeType.getViaNode(),i=this.edgeType.getPoint(.5,t);e!==void 0&&this.labelModule.calculateLabelSize(e,this.selected,this.hover,i.x,i.y);const o={x:i.x,y:this.labelModule.size.yLine,angle:0};if(!this.labelModule.visible()||this.options.font.align==="horizontal")return o;const r=this.from.y-this.to.y,A=this.from.x-this.to.x;let I=Math.atan2(r,A);return(I<-1&&A<0||I>0&&A<0)&&(I+=Math.PI),o.angle=I,o}_pointOnCircle(e,t,i,o){return{x:e+i*Math.cos(o),y:t-i*Math.sin(o)}}select(){this.selected=!0}unselect(){this.selected=!1}cleanup(){return this.edgeType.cleanup()}remove(){this.cleanup(),this.disconnect(),delete this.body.edges[this.id]}endPointsValid(){return this.body.nodes[this.fromId]!==void 0&&this.body.nodes[this.toId]!==void 0}}class o${constructor(e,t,i){var o;this.body=e,this.images=t,this.groups=i,this.body.functions.createEdge=ge(o=this.create).call(o,this),this.edgesListeners={add:(r,A)=>{this.add(A.items)},update:(r,A)=>{this.update(A.items)},remove:(r,A)=>{this.remove(A.items)}},this.options={},this.defaultOptions={arrows:{to:{enabled:!1,scaleFactor:1,type:"arrow"},middle:{enabled:!1,scaleFactor:1,type:"arrow"},from:{enabled:!1,scaleFactor:1,type:"arrow"}},endPointOffset:{from:0,to:0},arrowStrikethrough:!0,color:{color:"#848484",highlight:"#848484",hover:"#848484",inherit:"from",opacity:1},dashes:!1,font:{color:"#343434",size:14,face:"arial",background:"none",strokeWidth:2,strokeColor:"#ffffff",align:"horizontal",multi:!1,vadjust:0,bold:{mod:"bold"},boldital:{mod:"bold italic"},ital:{mod:"italic"},mono:{mod:"",size:15,face:"courier new",vadjust:2}},hidden:!1,hoverWidth:1.5,label:void 0,labelHighlightBold:!0,length:void 0,physics:!0,scaling:{min:1,max:15,label:{enabled:!0,min:14,max:30,maxVisible:30,drawThreshold:5},customScalingFunction:function(r,A,I,l){if(A===r)return .5;{const c=1/(A-r);return Math.max(0,(l-r)*c)}}},selectionWidth:1.5,selfReference:{size:20,angle:Math.PI/4,renderBehindTheNode:!0},shadow:{enabled:!1,color:"rgba(0,0,0,0.5)",size:10,x:5,y:5},background:{enabled:!1,color:"rgba(111,111,111,1)",size:10,dashes:!1},smooth:{enabled:!0,type:"dynamic",forceDirection:"none",roundness:.5},title:void 0,width:1,value:void 0},vt(this.options,this.defaultOptions),this.bindEventListeners()}bindEventListeners(){var e=this,t,i;this.body.emitter.on("_forceDisableDynamicCurves",function(o){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;o==="dynamic"&&(o="continuous");let A=!1;for(const I in e.body.edges)if(Object.prototype.hasOwnProperty.call(e.body.edges,I)){const l=e.body.edges[I],c=e.body.data.edges.get(I);if(c!=null){const h=c.smooth;h!==void 0&&h.enabled===!0&&h.type==="dynamic"&&(o===void 0?l.setOptions({smooth:!1}):l.setOptions({smooth:{type:o}}),A=!0)}}r===!0&&A===!0&&e.body.emitter.emit("_dataChanged")}),this.body.emitter.on("_dataUpdated",()=>{this.reconnectEdges()}),this.body.emitter.on("refreshEdges",ge(t=this.refresh).call(t,this)),this.body.emitter.on("refresh",ge(i=this.refresh).call(i,this)),this.body.emitter.on("destroy",()=>{Ye(this.edgesListeners,(o,r)=>{this.body.data.edges&&this.body.data.edges.off(r,o)}),delete this.body.functions.createEdge,delete this.edgesListeners.add,delete this.edgesListeners.update,delete this.edgesListeners.remove,delete this.edgesListeners})}setOptions(e){if(e!==void 0){Zg.parseOptions(this.options,e,!0,this.defaultOptions,!0);let t=!1;if(e.smooth!==void 0)for(const i in this.body.edges)Object.prototype.hasOwnProperty.call(this.body.edges,i)&&(t=this.body.edges[i].updateEdgeType()||t);if(e.font!==void 0)for(const i in this.body.edges)Object.prototype.hasOwnProperty.call(this.body.edges,i)&&this.body.edges[i].updateLabelModule();(e.hidden!==void 0||e.physics!==void 0||t===!0)&&this.body.emitter.emit("_dataChanged")}}setData(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;const i=this.body.data.edges;if(Lw("id",e))this.body.data.edges=e;else if(nt(e))this.body.data.edges=new Bs,this.body.data.edges.add(e);else if(!e)this.body.data.edges=new Bs;else throw new TypeError("Array or DataSet expected");if(i&&Ye(this.edgesListeners,(o,r)=>{i.off(r,o)}),this.body.edges={},this.body.data.edges){Ye(this.edgesListeners,(r,A)=>{this.body.data.edges.on(A,r)});const o=this.body.data.edges.getIds();this.add(o,!0)}this.body.emitter.emit("_adjustEdgesForHierarchicalLayout"),t===!1&&this.body.emitter.emit("_dataChanged")}add(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;const i=this.body.edges,o=this.body.data.edges;for(let r=0;r1&&arguments[1]!==void 0?arguments[1]:!0;if(e.length===0)return;const i=this.body.edges;Ye(e,o=>{const r=i[o];r!==void 0&&r.remove()}),t&&this.body.emitter.emit("_dataChanged")}refresh(){Ye(this.body.edges,(e,t)=>{const i=this.body.data.edges.get(t);i!==void 0&&e.setOptions(i)})}create(e){return new Zg(e,this.body,this.images,this.options,this.defaultOptions)}reconnectEdges(){let e;const t=this.body.nodes,i=this.body.edges;for(e in t)Object.prototype.hasOwnProperty.call(t,e)&&(t[e].edges=[]);for(e in i)if(Object.prototype.hasOwnProperty.call(i,e)){const o=i[e];o.from=null,o.to=null,o.connect()}}getConnectedNodes(e){const t=[];if(this.body.edges[e]!==void 0){const i=this.body.edges[e];i.fromId!==void 0&&t.push(i.fromId),i.toId!==void 0&&t.push(i.toId)}return t}_updateState(){this._addMissingEdges(),this._removeInvalidEdges()}_removeInvalidEdges(){const e=[];Ye(this.body.edges,(t,i)=>{const o=this.body.nodes[t.toId],r=this.body.nodes[t.fromId];o!==void 0&&o.isCluster===!0||r!==void 0&&r.isCluster===!0||(o===void 0||r===void 0)&&e.push(i)}),this.remove(e,!1)}_addMissingEdges(){const e=this.body.data.edges;if(e==null)return;const t=this.body.edges,i=[];et(e).call(e,(o,r)=>{t[r]===void 0&&i.push(r)}),this.add(i,!0)}}class Ax{constructor(e,t,i){this.body=e,this.physicsBody=t,this.barnesHutTree,this.setOptions(i),this._rng=BC("BARNES HUT SOLVER")}setOptions(e){this.options=e,this.thetaInversed=1/this.options.theta,this.overlapAvoidanceFactor=1-Math.max(0,Math.min(1,this.options.avoidOverlap))}solve(){if(this.options.gravitationalConstant!==0&&this.physicsBody.physicsNodeIndices.length>0){let e;const t=this.body.nodes,i=this.physicsBody.physicsNodeIndices,o=i.length,r=this._formBarnesHutTree(t,i);this.barnesHutTree=r;for(let A=0;A0&&this._getForceContributions(r.root,e)}}_getForceContributions(e,t){this._getForceContribution(e.children.NW,t),this._getForceContribution(e.children.NE,t),this._getForceContribution(e.children.SW,t),this._getForceContribution(e.children.SE,t)}_getForceContribution(e,t){if(e.childrenCount>0){const i=e.centerOfMass.x-t.x,o=e.centerOfMass.y-t.y,r=Math.sqrt(i*i+o*o);r*e.calcSize>this.thetaInversed?this._calculateForces(r,i,o,t,e):e.childrenCount===4?this._getForceContributions(e,t):e.children.data.id!=t.id&&this._calculateForces(r,i,o,t,e)}}_calculateForces(e,t,i,o,r){e===0&&(e=.1,t=e),this.overlapAvoidanceFactor<1&&o.shape.radius&&(e=Math.max(.1+this.overlapAvoidanceFactor*o.shape.radius,e-o.shape.radius));const A=this.options.gravitationalConstant*r.mass*o.options.mass/Math.pow(e,3),I=t*A,l=i*A;this.physicsBody.forces[o.id].x+=I,this.physicsBody.forces[o.id].y+=l}_formBarnesHutTree(e,t){let i;const o=t.length;let r=e[t[0]].x,A=e[t[0]].y,I=e[t[0]].x,l=e[t[0]].y;for(let x=1;x0&&(EI&&(I=E),_l&&(l=_))}const c=Math.abs(I-r)-Math.abs(l-A);c>0?(A-=.5*c,l+=.5*c):(r+=.5*c,I-=.5*c);const p=Math.max(1e-5,Math.abs(I-r)),m=.5*p,y=.5*(r+I),w=.5*(A+l),S={root:{centerOfMass:{x:0,y:0},mass:0,range:{minX:y-m,maxX:y+m,minY:w-m,maxY:w+m},size:p,calcSize:1/p,children:{data:null},maxWidth:0,level:0,childrenCount:4}};this._splitBranch(S.root);for(let x=0;x0&&this._placeInTree(S.root,i);return S}_updateBranchMass(e,t){const i=e.centerOfMass,o=e.mass+t.options.mass,r=1/o;i.x=i.x*e.mass+t.x*t.options.mass,i.x*=r,i.y=i.y*e.mass+t.y*t.options.mass,i.y*=r,e.mass=o;const A=Math.max(Math.max(t.height,t.radius),t.width);e.maxWidth=e.maxWidtht.x?o.maxY>t.y?r="NW":r="SW":o.maxY>t.y?r="NE":r="SE",this._placeInRegion(e,t,r)}_placeInRegion(e,t,i){const o=e.children[i];switch(o.childrenCount){case 0:o.children.data=t,o.childrenCount=1,this._updateBranchMass(o,t);break;case 1:o.children.data.x===t.x&&o.children.data.y===t.y?(t.x+=this._rng(),t.y+=this._rng()):(this._splitBranch(o),this._placeInTree(o,t));break;case 4:this._placeInTree(o,t);break}}_splitBranch(e){let t=null;e.childrenCount===1&&(t=e.children.data,e.mass=0,e.centerOfMass.x=0,e.centerOfMass.y=0),e.childrenCount=4,e.children.data=null,this._insertRegion(e,"NW"),this._insertRegion(e,"NE"),this._insertRegion(e,"SW"),this._insertRegion(e,"SE"),t!=null&&this._placeInTree(e,t)}_insertRegion(e,t){let i,o,r,A;const I=.5*e.size;switch(t){case"NW":i=e.range.minX,o=e.range.minX+I,r=e.range.minY,A=e.range.minY+I;break;case"NE":i=e.range.minX+I,o=e.range.maxX,r=e.range.minY,A=e.range.minY+I;break;case"SW":i=e.range.minX,o=e.range.minX+I,r=e.range.minY+I,A=e.range.maxY;break;case"SE":i=e.range.minX+I,o=e.range.maxX,r=e.range.minY+I,A=e.range.maxY;break}e.children[t]={centerOfMass:{x:0,y:0},mass:0,range:{minX:i,maxX:o,minY:r,maxY:A},size:.5*e.size,calcSize:2*e.calcSize,children:{data:null},maxWidth:0,level:e.level+1,childrenCount:0}}_debug(e,t){this.barnesHutTree!==void 0&&(e.lineWidth=1,this._drawBranch(this.barnesHutTree.root,e,t))}_drawBranch(e,t,i){i===void 0&&(i="#FF0000"),e.childrenCount===4&&(this._drawBranch(e.children.NW,t),this._drawBranch(e.children.NE,t),this._drawBranch(e.children.SE,t),this._drawBranch(e.children.SW,t)),t.strokeStyle=i,t.beginPath(),t.moveTo(e.range.minX,e.range.minY),t.lineTo(e.range.maxX,e.range.minY),t.stroke(),t.beginPath(),t.moveTo(e.range.maxX,e.range.minY),t.lineTo(e.range.maxX,e.range.maxY),t.stroke(),t.beginPath(),t.moveTo(e.range.maxX,e.range.maxY),t.lineTo(e.range.minX,e.range.maxY),t.stroke(),t.beginPath(),t.moveTo(e.range.minX,e.range.maxY),t.lineTo(e.range.minX,e.range.minY),t.stroke()}}class s${constructor(e,t,i){this._rng=BC("REPULSION SOLVER"),this.body=e,this.physicsBody=t,this.setOptions(i)}setOptions(e){this.options=e}solve(){let e,t,i,o,r,A,I,l;const c=this.body.nodes,h=this.physicsBody.physicsNodeIndices,p=this.physicsBody.forces,m=this.options.nodeDistance,y=-2/3/m,w=4/3;for(let S=0;S0){const A=r.edges.length+1,I=this.options.centralGravity*A*r.options.mass;o[r.id].x=t*I,o[r.id].y=i*I}}}class I${constructor(e){this.body=e,this.physicsBody={physicsNodeIndices:[],physicsEdgeIndices:[],forces:{},velocities:{}},this.physicsEnabled=!0,this.simulationInterval=1e3/60,this.requiresTimeout=!0,this.previousStates={},this.referenceState={},this.freezeCache={},this.renderTimer=void 0,this.adaptiveTimestep=!1,this.adaptiveTimestepEnabled=!1,this.adaptiveCounter=0,this.adaptiveInterval=3,this.stabilized=!1,this.startedStabilization=!1,this.stabilizationIterations=0,this.ready=!1,this.options={},this.defaultOptions={enabled:!0,barnesHut:{theta:.5,gravitationalConstant:-2e3,centralGravity:.3,springLength:95,springConstant:.04,damping:.09,avoidOverlap:0},forceAtlas2Based:{theta:.5,gravitationalConstant:-50,centralGravity:.01,springConstant:.08,springLength:100,damping:.4,avoidOverlap:0},repulsion:{centralGravity:.2,springLength:200,springConstant:.05,nodeDistance:100,damping:.09,avoidOverlap:0},hierarchicalRepulsion:{centralGravity:0,springLength:100,springConstant:.01,nodeDistance:120,damping:.09},maxVelocity:50,minVelocity:.75,solver:"barnesHut",stabilization:{enabled:!0,iterations:1e3,updateInterval:50,onlyDynamicEdges:!1,fit:!0},timestep:.5,adaptiveTimestep:!0,wind:{x:0,y:0}},Ft(this.options,this.defaultOptions),this.timestep=.5,this.layoutFailed=!1,this.bindEventListeners()}bindEventListeners(){this.body.emitter.on("initPhysics",()=>{this.initPhysics()}),this.body.emitter.on("_layoutFailed",()=>{this.layoutFailed=!0}),this.body.emitter.on("resetPhysics",()=>{this.stopSimulation(),this.ready=!1}),this.body.emitter.on("disablePhysics",()=>{this.physicsEnabled=!1,this.stopSimulation()}),this.body.emitter.on("restorePhysics",()=>{this.setOptions(this.options),this.ready===!0&&this.startSimulation()}),this.body.emitter.on("startSimulation",()=>{this.ready===!0&&this.startSimulation()}),this.body.emitter.on("stopSimulation",()=>{this.stopSimulation()}),this.body.emitter.on("destroy",()=>{this.stopSimulation(!1),this.body.emitter.off()}),this.body.emitter.on("_dataChanged",()=>{this.updatePhysicsData()})}setOptions(e){if(e!==void 0)if(e===!1)this.options.enabled=!1,this.physicsEnabled=!1,this.stopSimulation();else if(e===!0)this.options.enabled=!0,this.physicsEnabled=!0,this.startSimulation();else{this.physicsEnabled=!0,PC(["stabilization"],this.options,e),ii(this.options,e,"stabilization"),e.enabled===void 0&&(this.options.enabled=!0),this.options.enabled===!1&&(this.physicsEnabled=!1,this.stopSimulation());const t=this.options.wind;t&&((typeof t.x!="number"||Au(t.x))&&(t.x=0),(typeof t.y!="number"||Au(t.y))&&(t.y=0)),this.timestep=this.options.timestep}this.init()}init(){let e;this.options.solver==="forceAtlas2Based"?(e=this.options.forceAtlas2Based,this.nodesSolver=new A$(this.body,this.physicsBody,e),this.edgesSolver=new Tu(this.body,this.physicsBody,e),this.gravitySolver=new C$(this.body,this.physicsBody,e)):this.options.solver==="repulsion"?(e=this.options.repulsion,this.nodesSolver=new s$(this.body,this.physicsBody,e),this.edgesSolver=new Tu(this.body,this.physicsBody,e),this.gravitySolver=new JC(this.body,this.physicsBody,e)):this.options.solver==="hierarchicalRepulsion"?(e=this.options.hierarchicalRepulsion,this.nodesSolver=new r$(this.body,this.physicsBody,e),this.edgesSolver=new a$(this.body,this.physicsBody,e),this.gravitySolver=new JC(this.body,this.physicsBody,e)):(e=this.options.barnesHut,this.nodesSolver=new Ax(this.body,this.physicsBody,e),this.edgesSolver=new Tu(this.body,this.physicsBody,e),this.gravitySolver=new JC(this.body,this.physicsBody,e)),this.modelOptions=e}initPhysics(){this.physicsEnabled===!0&&this.options.enabled===!0?this.options.stabilization.enabled===!0?this.stabilize():(this.stabilized=!1,this.ready=!0,this.body.emitter.emit("fit",{},this.layoutFailed),this.startSimulation()):(this.ready=!0,this.body.emitter.emit("fit"))}startSimulation(){if(this.physicsEnabled===!0&&this.options.enabled===!0){if(this.stabilized=!1,this.adaptiveTimestep=!1,this.body.emitter.emit("_resizeNodes"),this.viewFunction===void 0){var e;this.viewFunction=ge(e=this.simulationStep).call(e,this),this.body.emitter.on("initRedraw",this.viewFunction),this.body.emitter.emit("_startRendering")}}else this.body.emitter.emit("_redraw")}stopSimulation(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;this.stabilized=!0,e===!0&&this._emitStabilized(),this.viewFunction!==void 0&&(this.body.emitter.off("initRedraw",this.viewFunction),this.viewFunction=void 0,e===!0&&this.body.emitter.emit("_stopRendering"))}simulationStep(){const e=TC();this.physicsTick(),(TC()-e<.4*this.simulationInterval||this.runDoubleSpeed===!0)&&this.stabilized===!1&&(this.physicsTick(),this.runDoubleSpeed=!0),this.stabilized===!0&&this.stopSimulation()}_emitStabilized(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.stabilizationIterations;(this.stabilizationIterations>1||this.startedStabilization===!0)&&Mi(()=>{this.body.emitter.emit("stabilized",{iterations:e}),this.startedStabilization=!1,this.stabilizationIterations=0},0)}physicsStep(){this.gravitySolver.solve(),this.nodesSolver.solve(),this.edgesSolver.solve(),this.moveNodes()}adjustTimeStep(){this._evaluateStepQuality()===!0?this.timestep=1.2*this.timestep:this.timestep/1.2A))return!1;return!0}moveNodes(){const e=this.physicsBody.physicsNodeIndices;let t=0,i=0;const o=5;for(let r=0;rA&&(e=e>0?A:-A),e}_performStep(e){const t=this.body.nodes[e],i=this.physicsBody.forces[e];this.options.wind&&(i.x+=this.options.wind.x,i.y+=this.options.wind.y);const o=this.physicsBody.velocities[e];return this.previousStates[e]={x:t.x,y:t.y,vx:o.x,vy:o.y},t.options.fixed.x===!1?(o.x=this.calculateComponentVelocity(o.x,i.x,t.options.mass),t.x+=o.x*this.timestep):(i.x=0,o.x=0),t.options.fixed.y===!1?(o.y=this.calculateComponentVelocity(o.y,i.y,t.options.mass),t.y+=o.y*this.timestep):(i.y=0,o.y=0),Math.sqrt(Math.pow(o.x,2)+Math.pow(o.y,2))}_freezeNodes(){const e=this.body.nodes;for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&e[t].x&&e[t].y){const i=e[t].options.fixed;this.freezeCache[t]={x:i.x,y:i.y},i.x=!0,i.y=!0}}_restoreFrozenNodes(){const e=this.body.nodes;for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&this.freezeCache[t]!==void 0&&(e[t].options.fixed.x=this.freezeCache[t].x,e[t].options.fixed.y=this.freezeCache[t].y);this.freezeCache={}}stabilize(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.options.stabilization.iterations;if(typeof e!="number"&&(e=this.options.stabilization.iterations,console.error("The stabilize method needs a numeric amount of iterations. Switching to default: ",e)),this.physicsBody.physicsNodeIndices.length===0){this.ready=!0;return}this.adaptiveTimestep=this.options.adaptiveTimestep,this.body.emitter.emit("_resizeNodes"),this.stopSimulation(),this.stabilized=!1,this.body.emitter.emit("_blockRedraw"),this.targetIterations=e,this.options.stabilization.onlyDynamicEdges===!0&&this._freezeNodes(),this.stabilizationIterations=0,Mi(()=>this._stabilizationBatch(),0)}_startStabilizing(){return this.startedStabilization===!0?!1:(this.body.emitter.emit("startStabilizing"),this.startedStabilization=!0,!0)}_stabilizationBatch(){const e=()=>this.stabilized===!1&&this.stabilizationIterations{this.body.emitter.emit("stabilizationProgress",{iterations:this.stabilizationIterations,total:this.targetIterations})};this._startStabilizing()&&t();let i=0;for(;e()&&i1&&arguments[1]!==void 0?arguments[1]:[],i=1e9,o=-1e9,r=1e9,A=-1e9,I;if(t.length>0)for(let l=0;lI.shape.boundingBox.left&&(r=I.shape.boundingBox.left),AI.shape.boundingBox.top&&(i=I.shape.boundingBox.top),o1&&arguments[1]!==void 0?arguments[1]:[],i=1e9,o=-1e9,r=1e9,A=-1e9,I;if(t.length>0)for(let l=0;lI.x&&(r=I.x),AI.y&&(i=I.y),o{delete this.containedEdges[i.id]}),Ye(t.containedNodes,(i,o)=>{this.containedNodes[o]=i}),t.containedNodes={},Ye(t.containedEdges,(i,o)=>{this.containedEdges[o]=i}),t.containedEdges={},Ye(t.edges,i=>{Ye(this.edges,o=>{var r,A;const I=Ct(r=o.clusteringEdgeReplacingIds).call(r,i.id);I!==-1&&(Ye(i.clusteringEdgeReplacingIds,l=>{o.clusteringEdgeReplacingIds.push(l),this.body.edges[l].edgeReplacedById=o.id}),Di(A=o.clusteringEdgeReplacingIds).call(A,I,1))})}),t.edges=[]}}class c${constructor(e){this.body=e,this.clusteredNodes={},this.clusteredEdges={},this.options={},this.defaultOptions={},Ft(this.options,this.defaultOptions),this.body.emitter.on("_resetData",()=>{this.clusteredNodes={},this.clusteredEdges={}})}clusterByHubsize(e,t){e===void 0?e=this._getHubSize():typeof e=="object"&&(t=this._checkOptions(e),e=this._getHubSize());const i=[];for(let o=0;o=e&&i.push(r.id)}for(let o=0;o0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(e.joinCondition===void 0)throw new Error("Cannot call clusterByNodeData without a joinCondition function in the options.");e=this._checkOptions(e);const i={},o={};Ye(this.body.nodes,(r,A)=>{r.options&&e.joinCondition(r.options)===!0&&(i[A]=r,Ye(r.edges,I=>{this.clusteredEdges[I.id]===void 0&&(o[I.id]=I)}))}),this._cluster(i,o,e,t)}clusterByEdgeCount(e,t){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;t=this._checkOptions(t);const o=[],r={};let A,I,l;for(let c=0;c0&&xt(p).length>0&&S===!0){const O=function(){for(let E=0;E1&&arguments[1]!==void 0?arguments[1]:!0;this.clusterByEdgeCount(1,e,t)}clusterBridges(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;this.clusterByEdgeCount(2,e,t)}clusterByConnection(e,t){var i;let o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(e===void 0)throw new Error("No nodeId supplied to clusterByConnection!");if(this.body.nodes[e]===void 0)throw new Error("The nodeId given to clusterByConnection does not exist!");const r=this.body.nodes[e];t=this._checkOptions(t,r),t.clusterNodeProperties.x===void 0&&(t.clusterNodeProperties.x=r.x),t.clusterNodeProperties.y===void 0&&(t.clusterNodeProperties.y=r.y),t.clusterNodeProperties.fixed===void 0&&(t.clusterNodeProperties.fixed={},t.clusterNodeProperties.fixed.x=r.options.fixed.x,t.clusterNodeProperties.fixed.y=r.options.fixed.y);const A={},I={},l=r.id,c=En.cloneOptions(r);A[l]=r;for(let p=0;p-1&&(I[w.id]=w)}}this._cluster(A,I,t,o)}_createClusterEdges(e,t,i,o){let r,A,I,l,c,h;const p=xt(e),m=[];for(let S=0;S0&&arguments[0]!==void 0?arguments[0]:{};return e.clusterEdgeProperties===void 0&&(e.clusterEdgeProperties={}),e.clusterNodeProperties===void 0&&(e.clusterNodeProperties={}),e}_cluster(e,t,i){let o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0;const r=[];for(const h in e)Object.prototype.hasOwnProperty.call(e,h)&&this.clusteredNodes[h]!==void 0&&r.push(h);for(let h=0;ho?I.x:o,r=I.yA?I.y:A;return{x:.5*(i+o),y:.5*(r+A)}}openCluster(e,t){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(e===void 0)throw new Error("No clusterNodeId supplied to openCluster.");const o=this.body.nodes[e];if(o===void 0)throw new Error("The clusterNodeId supplied to openCluster does not exist.");if(o.isCluster!==!0||o.containedNodes===void 0||o.containedEdges===void 0)throw new Error("The node:"+e+" is not a valid cluster.");const r=this.findNode(e),A=Ct(r).call(r,e)-1;if(A>=0){const h=r[A];this.body.nodes[h]._openChildCluster(e),delete this.body.nodes[e],i===!0&&this.body.emitter.emit("_dataChanged");return}const I=o.containedNodes,l=o.containedEdges;if(t!==void 0&&t.releaseFunction!==void 0&&typeof t.releaseFunction=="function"){const h={},p={x:o.x,y:o.y};for(const y in I)if(Object.prototype.hasOwnProperty.call(I,y)){const w=this.body.nodes[y];h[y]={x:w.x,y:w.y}}const m=t.releaseFunction(p,h);for(const y in I)if(Object.prototype.hasOwnProperty.call(I,y)){const w=this.body.nodes[y];m[y]!==void 0&&(w.x=m[y].x===void 0?o.x:m[y].x,w.y=m[y].y===void 0?o.y:m[y].y)}}else Ye(I,function(h){h.options.fixed.x===!1&&(h.x=o.x),h.options.fixed.y===!1&&(h.y=o.y)});for(const h in I)if(Object.prototype.hasOwnProperty.call(I,h)){const p=this.body.nodes[h];p.vx=o.vx,p.vy=o.vy,p.setOptions({physics:!0}),delete this.clusteredNodes[h]}const c=[];for(let h=0;h0&&Ao&&(o=c.edges.length),e+=c.edges.length,t+=Math.pow(c.edges.length,2),i+=1}e=e/i,t=t/i;const r=t-Math.pow(e,2),A=Math.sqrt(r);let I=Math.floor(e+2*A);return I>o&&(I=o),I}_createClusteredEdge(e,t,i,o,r){const A=En.cloneOptions(i,"edge");vt(A,o),A.from=e,A.to=t,A.id="clusterEdge:"+Zs(),r!==void 0&&vt(A,r);const I=this.body.functions.createEdge(A);return I.clusteringEdgeReplacingIds=[i.id],I.connect(),this.body.edges[I.id]=I,I}_clusterEdges(e,t,i,o){if(t instanceof Zg){const r=t,A={};A[r.id]=r,t=A}if(e instanceof Nt){const r=e,A={};A[r.id]=r,e=A}if(i==null)throw new Error("_clusterEdges: parameter clusterNode required");o===void 0&&(o=i.clusterEdgeProperties),this._createClusterEdges(e,t,i,o);for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&this.body.edges[r]!==void 0){const A=this.body.edges[r];this._backupEdgeOptions(A),A.setOptions({physics:!1})}for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(this.clusteredNodes[r]={clusterId:i.id,node:this.body.nodes[r]},this.body.nodes[r].setOptions({physics:!1}))}_getClusterNodeForNode(e){if(e===void 0)return;const t=this.clusteredNodes[e];if(t===void 0)return;const i=t.clusterId;if(i!==void 0)return this.body.nodes[i]}_filter(e,t){const i=[];return Ye(e,o=>{t(o)&&i.push(o)}),i}_updateState(){let e;const t=[],i={},o=l=>{Ye(this.body.nodes,c=>{c.isCluster===!0&&l(c)})};for(e in this.clusteredNodes){if(!Object.prototype.hasOwnProperty.call(this.clusteredNodes,e))continue;this.body.nodes[e]===void 0&&t.push(e)}o(function(l){for(let c=0;c{const c=this.body.edges[l];(c===void 0||!c.endPointsValid())&&(i[l]=l)}),o(function(l){Ye(l.containedEdges,(c,h)=>{!c.endPointsValid()&&!i[h]&&(i[h]=h)})}),Ye(this.body.edges,(l,c)=>{let h=!0;const p=l.clusteringEdgeReplacingIds;if(p!==void 0){let m=0;Ye(p,y=>{const w=this.body.edges[y];w!==void 0&&w.endPointsValid()&&(m+=1)}),h=m>0}(!l.endPointsValid()||!h)&&(i[c]=c)}),o(l=>{Ye(i,c=>{delete l.containedEdges[c],Ye(l.edges,(h,p)=>{if(h.id===c){l.edges[p]=null;return}h.clusteringEdgeReplacingIds=this._filter(h.clusteringEdgeReplacingIds,function(m){return!i[m]})}),l.edges=this._filter(l.edges,function(h){return h!==null})})}),Ye(i,l=>{delete this.clusteredEdges[l]}),Ye(i,l=>{delete this.body.edges[l]});const r=xt(this.body.edges);Ye(r,l=>{const c=this.body.edges[l],h=this._isClusteredNode(c.fromId)||this._isClusteredNode(c.toId);if(h!==this._isClusteredEdge(c.id))if(h){const p=this._getClusterNodeForNode(c.fromId);p!==void 0&&this._clusterEdges(this.body.nodes[c.fromId],c,p);const m=this._getClusterNodeForNode(c.toId);m!==void 0&&this._clusterEdges(this.body.nodes[c.toId],c,m)}else delete this._clusterEdges[l],this._restoreEdge(c)});let A=!1,I=!0;for(;I;){const l=[];o(function(c){const h=xt(c.containedNodes).length,p=c.options.allowSingleNodeCluster===!0;(p&&h<1||!p&&h<2)&&l.push(c.id)});for(let c=0;c0,A=A||I}A&&this._updateState()}_isClusteredNode(e){return this.clusteredNodes[e]!==void 0}_isClusteredEdge(e){return this.clusteredEdges[e]!==void 0}}class d${constructor(e,t){this.body=e,this.canvas=t,this.redrawRequested=!1,this.requestAnimationFrameRequestId=void 0,this.renderingActive=!1,this.renderRequests=0,this.allowRedraw=!0,this.dragging=!1,this.zooming=!1,this.options={},this.defaultOptions={hideEdgesOnDrag:!1,hideEdgesOnZoom:!1,hideNodesOnDrag:!1},Ft(this.options,this.defaultOptions),this.bindEventListeners()}bindEventListeners(){var e;this.body.emitter.on("dragStart",()=>{this.dragging=!0}),this.body.emitter.on("dragEnd",()=>{this.dragging=!1}),this.body.emitter.on("zoom",()=>{this.zooming=!0,window.clearTimeout(this.zoomTimeoutId),this.zoomTimeoutId=Mi(()=>{var t;this.zooming=!1,ge(t=this._requestRedraw).call(t,this)()},250)}),this.body.emitter.on("_resizeNodes",()=>{this._resizeNodes()}),this.body.emitter.on("_redraw",()=>{this.renderingActive===!1&&this._redraw()}),this.body.emitter.on("_blockRedraw",()=>{this.allowRedraw=!1}),this.body.emitter.on("_allowRedraw",()=>{this.allowRedraw=!0,this.redrawRequested=!1}),this.body.emitter.on("_requestRedraw",ge(e=this._requestRedraw).call(e,this)),this.body.emitter.on("_startRendering",()=>{this.renderRequests+=1,this.renderingActive=!0,this._startRendering()}),this.body.emitter.on("_stopRendering",()=>{this.renderRequests-=1,this.renderingActive=this.renderRequests>0,this.requestAnimationFrameRequestId=void 0}),this.body.emitter.on("destroy",()=>{this.renderRequests=0,this.allowRedraw=!1,this.renderingActive=!1,window.cancelAnimationFrame(this.requestAnimationFrameRequestId),this.body.emitter.off()})}setOptions(e){e!==void 0&&Ms(["hideEdgesOnDrag","hideEdgesOnZoom","hideNodesOnDrag"],this.options,e)}_startRendering(){if(this.renderingActive===!0&&this.requestAnimationFrameRequestId===void 0){var e;this.requestAnimationFrameRequestId=window.requestAnimationFrame(ge(e=this._renderStep).call(e,this),this.simulationInterval)}}_renderStep(){this.renderingActive===!0&&(this.requestAnimationFrameRequestId=void 0,this._startRendering(),this._redraw())}redraw(){this.body.emitter.emit("setSize"),this._redraw()}_requestRedraw(){this.redrawRequested!==!0&&this.renderingActive===!1&&this.allowRedraw===!0&&(this.redrawRequested=!0,window.requestAnimationFrame(()=>{this._redraw(!1)}))}_redraw(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;if(this.allowRedraw===!0){this.body.emitter.emit("initRedraw"),this.redrawRequested=!1;const t={drawExternalLabels:null};(this.canvas.frame.canvas.width===0||this.canvas.frame.canvas.height===0)&&this.canvas.setSize(),this.canvas.setTransform();const i=this.canvas.getContext(),o=this.canvas.frame.canvas.clientWidth,r=this.canvas.frame.canvas.clientHeight;if(i.clearRect(0,0,o,r),this.canvas.frame.clientWidth===0)return;if(i.save(),i.translate(this.body.view.translation.x,this.body.view.translation.y),i.scale(this.body.view.scale,this.body.view.scale),i.beginPath(),this.body.emitter.emit("beforeDrawing",i),i.closePath(),e===!1&&(this.dragging===!1||this.dragging===!0&&this.options.hideEdgesOnDrag===!1)&&(this.zooming===!1||this.zooming===!0&&this.options.hideEdgesOnZoom===!1)&&this._drawEdges(i),this.dragging===!1||this.dragging===!0&&this.options.hideNodesOnDrag===!1){const{drawExternalLabels:A}=this._drawNodes(i,e);t.drawExternalLabels=A}e===!1&&(this.dragging===!1||this.dragging===!0&&this.options.hideEdgesOnDrag===!1)&&(this.zooming===!1||this.zooming===!0&&this.options.hideEdgesOnZoom===!1)&&this._drawArrows(i),t.drawExternalLabels!=null&&t.drawExternalLabels(),e===!1&&this._drawSelectionBox(i),i.beginPath(),this.body.emitter.emit("afterDrawing",i),i.closePath(),i.restore(),e===!0&&i.clearRect(0,0,o,r)}}_resizeNodes(){this.canvas.setTransform();const e=this.canvas.getContext();e.save(),e.translate(this.body.view.translation.x,this.body.view.translation.y),e.scale(this.body.view.scale,this.body.view.scale);const t=this.body.nodes;let i;for(const o in t)Object.prototype.hasOwnProperty.call(t,o)&&(i=t[o],i.resize(e),i.updateBoundingBox(e,i.selected));e.restore()}_drawNodes(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;const i=this.body.nodes,o=this.body.nodeIndices;let r;const A=[],I=[],l=20,c=this.canvas.DOMtoCanvas({x:-l,y:-l}),h=this.canvas.DOMtoCanvas({x:this.canvas.frame.canvas.clientWidth+l,y:this.canvas.frame.canvas.clientHeight+l}),p={top:c.y,left:c.x,bottom:h.y,right:h.x},m=[];for(let x=0;x{for(const x of m)x()}}}_drawEdges(e){const t=this.body.edges,i=this.body.edgeIndices;for(let o=0;o{t.width!==0&&(this.body.view.translation.x=t.width*.5),t.height!==0&&(this.body.view.translation.y=t.height*.5)}),this.body.emitter.on("setSize",ge(e=this.setSize).call(e,this)),this.body.emitter.on("destroy",()=>{this.hammerFrame.destroy(),this.hammer.destroy(),this._cleanUp()})}setOptions(e){if(e!==void 0&&Ms(["width","height","autoResize"],this.options,e),this._cleanUp(),this.options.autoResize===!0){var t;if(window.ResizeObserver){const o=new ResizeObserver(()=>{this.setSize()===!0&&this.body.emitter.emit("_requestRedraw")}),{frame:r}=this;o.observe(r),this._cleanupCallbacks.push(()=>{o.unobserve(r)})}else{const o=p$(()=>{this.setSize()===!0&&this.body.emitter.emit("_requestRedraw")},1e3);this._cleanupCallbacks.push(()=>{clearInterval(o)})}const i=ge(t=this._onResize).call(t,this);window.addEventListener("resize",i),this._cleanupCallbacks.push(()=>{window.removeEventListener("resize",i)})}}_cleanUp(){var e,t,i;et(e=xo(t=Di(i=this._cleanupCallbacks).call(i,0)).call(t)).call(e,o=>{try{o()}catch(r){console.error(r)}})}_onResize(){this.setSize(),this.body.emitter.emit("_redraw")}_getCameraState(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.pixelRatio;this.initialized===!0&&(this.cameraState.previousWidth=this.frame.canvas.width/e,this.cameraState.previousHeight=this.frame.canvas.height/e,this.cameraState.scale=this.body.view.scale,this.cameraState.position=this.DOMtoCanvas({x:.5*this.frame.canvas.width/e,y:.5*this.frame.canvas.height/e}))}_setCameraState(){if(this.cameraState.scale!==void 0&&this.frame.canvas.clientWidth!==0&&this.frame.canvas.clientHeight!==0&&this.pixelRatio!==0&&this.cameraState.previousWidth>0&&this.cameraState.previousHeight>0){const e=this.frame.canvas.width/this.pixelRatio/this.cameraState.previousWidth,t=this.frame.canvas.height/this.pixelRatio/this.cameraState.previousHeight;let i=this.cameraState.scale;e!=1&&t!=1?i=this.cameraState.scale*.5*(e+t):e!=1?i=this.cameraState.scale*e:t!=1&&(i=this.cameraState.scale*t),this.body.view.scale=i;const o=this.DOMtoCanvas({x:.5*this.frame.canvas.clientWidth,y:.5*this.frame.canvas.clientHeight}),r={x:o.x-this.cameraState.position.x,y:o.y-this.cameraState.position.y};this.body.view.translation.x+=r.x*this.body.view.scale,this.body.view.translation.y+=r.y*this.body.view.scale}}_prepareValue(e){if(typeof e=="number")return e+"px";if(typeof e=="string"){if(Ct(e).call(e,"%")!==-1||Ct(e).call(e,"px")!==-1)return e;if(Ct(e).call(e,"%")===-1)return e+"px"}throw new Error("Could not use the value supplied for width or height:"+e)}_create(){for(;this.body.container.hasChildNodes();)this.body.container.removeChild(this.body.container.firstChild);if(this.frame=document.createElement("div"),this.frame.className="vis-network",this.frame.style.position="relative",this.frame.style.overflow="hidden",this.frame.tabIndex=0,this.frame.canvas=document.createElement("canvas"),this.frame.canvas.style.position="relative",this.frame.appendChild(this.frame.canvas),this.frame.canvas.getContext)this._setPixelRatio(),this.setTransform();else{const e=document.createElement("DIV");e.style.color="red",e.style.fontWeight="bold",e.style.padding="10px",e.innerText="Error: your browser does not support HTML canvas",this.frame.canvas.appendChild(e)}this.body.container.appendChild(this.frame),this.body.view.scale=1,this.body.view.translation={x:.5*this.frame.canvas.clientWidth,y:.5*this.frame.canvas.clientHeight},this._bindHammer()}_bindHammer(){this.hammer!==void 0&&this.hammer.destroy(),this.drag={},this.pinch={},this.hammer=new zs(this.frame.canvas),this.hammer.get("pinch").set({enable:!0}),this.hammer.get("pan").set({threshold:5,direction:zs.DIRECTION_ALL}),eI(this.hammer,e=>{this.body.eventListeners.onTouch(e)}),this.hammer.on("tap",e=>{this.body.eventListeners.onTap(e)}),this.hammer.on("doubletap",e=>{this.body.eventListeners.onDoubleTap(e)}),this.hammer.on("press",e=>{this.body.eventListeners.onHold(e)}),this.hammer.on("panstart",e=>{this.body.eventListeners.onDragStart(e)}),this.hammer.on("panmove",e=>{this.body.eventListeners.onDrag(e)}),this.hammer.on("panend",e=>{this.body.eventListeners.onDragEnd(e)}),this.hammer.on("pinch",e=>{this.body.eventListeners.onPinch(e)}),this.frame.canvas.addEventListener("wheel",e=>{this.body.eventListeners.onMouseWheel(e)}),this.frame.canvas.addEventListener("mousemove",e=>{this.body.eventListeners.onMouseMove(e)}),this.frame.canvas.addEventListener("contextmenu",e=>{this.body.eventListeners.onContext(e)}),this.hammerFrame=new zs(this.frame),Cx(this.hammerFrame,e=>{this.body.eventListeners.onRelease(e)})}setSize(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.options.width,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.options.height;e=this._prepareValue(e),t=this._prepareValue(t);let i=!1;const o=this.frame.canvas.width,r=this.frame.canvas.height,A=this.pixelRatio;if(this._setPixelRatio(),e!=this.options.width||t!=this.options.height||this.frame.style.width!=e||this.frame.style.height!=t)this._getCameraState(A),this.frame.style.width=e,this.frame.style.height=t,this.frame.canvas.style.width="100%",this.frame.canvas.style.height="100%",this.frame.canvas.width=Math.round(this.frame.canvas.clientWidth*this.pixelRatio),this.frame.canvas.height=Math.round(this.frame.canvas.clientHeight*this.pixelRatio),this.options.width=e,this.options.height=t,this.canvasViewCenter={x:.5*this.frame.clientWidth,y:.5*this.frame.clientHeight},i=!0;else{const I=Math.round(this.frame.canvas.clientWidth*this.pixelRatio),l=Math.round(this.frame.canvas.clientHeight*this.pixelRatio);(this.frame.canvas.width!==I||this.frame.canvas.height!==l)&&this._getCameraState(A),this.frame.canvas.width!==I&&(this.frame.canvas.width=I,i=!0),this.frame.canvas.height!==l&&(this.frame.canvas.height=l,i=!0)}return i===!0&&(this.body.emitter.emit("resize",{width:Math.round(this.frame.canvas.width/this.pixelRatio),height:Math.round(this.frame.canvas.height/this.pixelRatio),oldWidth:Math.round(o/this.pixelRatio),oldHeight:Math.round(r/this.pixelRatio)}),this._setCameraState()),this.initialized=!0,i}getContext(){return this.frame.canvas.getContext("2d")}_determinePixelRatio(){const e=this.getContext();if(e===void 0)throw new Error("Could not get canvax context");let t=1;typeof window<"u"&&(t=window.devicePixelRatio||1);const i=e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1;return t/i}_setPixelRatio(){this.pixelRatio=this._determinePixelRatio()}setTransform(){const e=this.getContext();if(e===void 0)throw new Error("Could not get canvax context");e.setTransform(this.pixelRatio,0,0,this.pixelRatio,0,0)}_XconvertDOMtoCanvas(e){return(e-this.body.view.translation.x)/this.body.view.scale}_XconvertCanvasToDOM(e){return e*this.body.view.scale+this.body.view.translation.x}_YconvertDOMtoCanvas(e){return(e-this.body.view.translation.y)/this.body.view.scale}_YconvertCanvasToDOM(e){return e*this.body.view.scale+this.body.view.translation.y}canvasToDOM(e){return{x:this._XconvertCanvasToDOM(e.x),y:this._YconvertCanvasToDOM(e.y)}}DOMtoCanvas(e){return{x:this._XconvertDOMtoCanvas(e.x),y:this._YconvertDOMtoCanvas(e.y)}}}function v$(n,e){const t=Ft({nodes:e,minZoomLevel:Number.MIN_VALUE,maxZoomLevel:1},n??{});if(!nt(t.nodes))throw new TypeError("Nodes has to be an array of ids.");if(t.nodes.length===0&&(t.nodes=e),!(typeof t.minZoomLevel=="number"&&t.minZoomLevel>0))throw new TypeError("Min zoom level has to be a number higher than zero.");if(!(typeof t.maxZoomLevel=="number"&&t.minZoomLevel<=t.maxZoomLevel))throw new TypeError("Max zoom level has to be a number higher than min zoom level.");return t}class y${constructor(e,t){var i,o;this.body=e,this.canvas=t,this.animationSpeed=1/this.renderRefreshRate,this.animationEasingFunction="easeInOutQuint",this.easingTime=0,this.sourceScale=0,this.targetScale=0,this.sourceTranslation=0,this.targetTranslation=0,this.lockedOnNodeId=void 0,this.lockedOnNodeOffset=void 0,this.touchTime=0,this.viewFunction=void 0,this.body.emitter.on("fit",ge(i=this.fit).call(i,this)),this.body.emitter.on("animationFinished",()=>{this.body.emitter.emit("_stopRendering")}),this.body.emitter.on("unlockNode",ge(o=this.releaseNode).call(o,this))}setOptions(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.options=e}fit(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;e=v$(e,this.body.nodeIndices);const i=this.canvas.frame.canvas.clientWidth,o=this.canvas.frame.canvas.clientHeight;let r,A;if(i===0||o===0)A=1,r=En.getRange(this.body.nodes,e.nodes);else if(t===!0){let c=0;for(const m in this.body.nodes)Object.prototype.hasOwnProperty.call(this.body.nodes,m)&&this.body.nodes[m].predefinedPosition===!0&&(c+=1);if(c>.5*this.body.nodeIndices.length){this.fit(e,!1);return}r=En.getRange(this.body.nodes,e.nodes),A=12.662/(this.body.nodeIndices.length+7.4147)+.0964822;const p=Math.min(i/600,o/600);A*=p}else{this.body.emitter.emit("_resizeNodes"),r=En.getRange(this.body.nodes,e.nodes);const c=Math.abs(r.maxX-r.minX)*1.1,h=Math.abs(r.maxY-r.minY)*1.1,p=i/c,m=o/h;A=p<=m?p:m}A>e.maxZoomLevel?A=e.maxZoomLevel:A1&&arguments[1]!==void 0?arguments[1]:{};if(this.body.nodes[e]!==void 0){const i={x:this.body.nodes[e].x,y:this.body.nodes[e].y};t.position=i,t.lockedOnNode=e,this.moveTo(t)}else console.error("Node: "+e+" cannot be found.")}moveTo(e){if(e===void 0){e={};return}if(e.offset!=null){if(e.offset.x!=null){if(e.offset.x=+e.offset.x,!ko(e.offset.x))throw new TypeError('The option "offset.x" has to be a finite number.')}else e.offset.x=0;if(e.offset.y!=null){if(e.offset.y=+e.offset.y,!ko(e.offset.y))throw new TypeError('The option "offset.y" has to be a finite number.')}else e.offset.x=0}else e.offset={x:0,y:0};if(e.position!=null){if(e.position.x!=null){if(e.position.x=+e.position.x,!ko(e.position.x))throw new TypeError('The option "position.x" has to be a finite number.')}else e.position.x=0;if(e.position.y!=null){if(e.position.y=+e.position.y,!ko(e.position.y))throw new TypeError('The option "position.y" has to be a finite number.')}else e.position.x=0}else e.position=this.getViewPosition();if(e.scale!=null){if(e.scale=+e.scale,!(e.scale>0))throw new TypeError('The option "scale" has to be a number greater than zero.')}else e.scale=this.body.view.scale;e.animation===void 0&&(e.animation={duration:0}),e.animation===!1&&(e.animation={duration:0}),e.animation===!0&&(e.animation={}),e.animation.duration===void 0&&(e.animation.duration=1e3),e.animation.easingFunction===void 0&&(e.animation.easingFunction="easeInOutQuad"),this.animateView(e)}animateView(e){if(e===void 0)return;this.animationEasingFunction=e.animation.easingFunction,this.releaseNode(),e.locked===!0&&(this.lockedOnNodeId=e.lockedOnNode,this.lockedOnNodeOffset=e.offset),this.easingTime!=0&&this._transitionRedraw(!0),this.sourceScale=this.body.view.scale,this.sourceTranslation=this.body.view.translation,this.targetScale=e.scale,this.body.view.scale=this.targetScale;const t=this.canvas.DOMtoCanvas({x:.5*this.canvas.frame.canvas.clientWidth,y:.5*this.canvas.frame.canvas.clientHeight}),i={x:t.x-e.position.x,y:t.y-e.position.y};if(this.targetTranslation={x:this.sourceTranslation.x+i.x*this.targetScale+e.offset.x,y:this.sourceTranslation.y+i.y*this.targetScale+e.offset.y},e.animation.duration===0)if(this.lockedOnNodeId!=null){var o;this.viewFunction=ge(o=this._lockedRedraw).call(o,this),this.body.emitter.on("initRedraw",this.viewFunction)}else this.body.view.scale=this.targetScale,this.body.view.translation=this.targetTranslation,this.body.emitter.emit("_requestRedraw");else{var r;this.animationSpeed=1/(60*e.animation.duration*.001)||1/60,this.animationEasingFunction=e.animation.easingFunction,this.viewFunction=ge(r=this._transitionRedraw).call(r,this),this.body.emitter.on("initRedraw",this.viewFunction),this.body.emitter.emit("_startRendering")}}_lockedRedraw(){const e={x:this.body.nodes[this.lockedOnNodeId].x,y:this.body.nodes[this.lockedOnNodeId].y},t=this.canvas.DOMtoCanvas({x:.5*this.canvas.frame.canvas.clientWidth,y:.5*this.canvas.frame.canvas.clientHeight}),i={x:t.x-e.x,y:t.y-e.y},o=this.body.view.translation,r={x:o.x+i.x*this.body.view.scale+this.lockedOnNodeOffset.x,y:o.y+i.y*this.body.view.scale+this.lockedOnNodeOffset.y};this.body.view.translation=r}releaseNode(){this.lockedOnNodeId!==void 0&&this.viewFunction!==void 0&&(this.body.emitter.off("initRedraw",this.viewFunction),this.lockedOnNodeId=void 0,this.lockedOnNodeOffset=void 0)}_transitionRedraw(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;this.easingTime+=this.animationSpeed,this.easingTime=e===!0?1:this.easingTime;const t=VV[this.animationEasingFunction](this.easingTime);if(this.body.view.scale=this.sourceScale+(this.targetScale-this.sourceScale)*t,this.body.view.translation={x:this.sourceTranslation.x+(this.targetTranslation.x-this.sourceTranslation.x)*t,y:this.sourceTranslation.y+(this.targetTranslation.y-this.sourceTranslation.y)*t},this.easingTime>=1){if(this.body.emitter.off("initRedraw",this.viewFunction),this.easingTime=0,this.lockedOnNodeId!=null){var i;this.viewFunction=ge(i=this._lockedRedraw).call(i,this),this.body.emitter.on("initRedraw",this.viewFunction)}this.body.emitter.emit("animationFinished")}}getScale(){return this.body.view.scale}getViewPosition(){return this.canvas.DOMtoCanvas({x:.5*this.canvas.frame.canvas.clientWidth,y:.5*this.canvas.frame.canvas.clientHeight})}}var b$=`div.vis-network div.vis-navigation div.vis-button { width: 34px; height: 34px; -moz-border-radius: 17px; @@ -782,7 +782,7 @@ div.vis-network div.vis-navigation div.vis-button.vis-zoomExtends { bottom: 50px; right: 15px; } -`;po(b$);function Cx(n){var e=n&&n.preventDefault||!1,t=n&&n.container||window,i={},o={keydown:{},keyup:{}},r={},A;for(A=97;A<=122;A++)r[String.fromCharCode(A)]={code:65+(A-97),shift:!1};for(A=65;A<=90;A++)r[String.fromCharCode(A)]={code:A,shift:!0};for(A=0;A<=9;A++)r[""+A]={code:48+A,shift:!1};for(A=1;A<=12;A++)r["F"+A]={code:111+A,shift:!1};for(A=0;A<=9;A++)r["num"+A]={code:96+A,shift:!1};r["num*"]={code:106,shift:!1},r["num+"]={code:107,shift:!1},r["num-"]={code:109,shift:!1},r["num/"]={code:111,shift:!1},r["num."]={code:110,shift:!1},r.left={code:37,shift:!1},r.up={code:38,shift:!1},r.right={code:39,shift:!1},r.down={code:40,shift:!1},r.space={code:32,shift:!1},r.enter={code:13,shift:!1},r.shift={code:16,shift:void 0},r.esc={code:27,shift:!1},r.backspace={code:8,shift:!1},r.tab={code:9,shift:!1},r.ctrl={code:17,shift:!1},r.alt={code:18,shift:!1},r.delete={code:46,shift:!1},r.pageup={code:33,shift:!1},r.pagedown={code:34,shift:!1},r["="]={code:187,shift:!1},r["-"]={code:189,shift:!1},r["]"]={code:221,shift:!1},r["["]={code:219,shift:!1};var I=function(h){c(h,"keydown")},l=function(h){c(h,"keyup")},c=function(h,p){if(o[p][h.keyCode]!==void 0){for(var m=o[p][h.keyCode],y=0;y{this.activated=!0,this.configureKeyboardBindings()}),this.body.emitter.on("deactivate",()=>{this.activated=!1,this.configureKeyboardBindings()}),this.body.emitter.on("destroy",()=>{this.keycharm!==void 0&&this.keycharm.destroy()}),this.options={}}setOptions(e){e!==void 0&&(this.options=e,this.create())}create(){this.options.navigationButtons===!0?this.iconsCreated===!1&&this.loadNavigationElements():this.iconsCreated===!0&&this.cleanNavigation(),this.configureKeyboardBindings()}cleanNavigation(){if(this.navigationHammers.length!=0){for(let e=0;e{this._stopMovement()}),this.navigationHammers.push(r),this.iconsCreated=!0}bindToRedraw(e){if(this.boundFunctions[e]===void 0){var t;this.boundFunctions[e]=ge(t=this[e]).call(t,this),this.body.emitter.on("initRedraw",this.boundFunctions[e]),this.body.emitter.emit("_startRendering")}}unbindFromRedraw(e){this.boundFunctions[e]!==void 0&&(this.body.emitter.off("initRedraw",this.boundFunctions[e]),this.body.emitter.emit("_stopRendering"),delete this.boundFunctions[e])}_fit(){new Date().valueOf()-this.touchTime>700&&(this.body.emitter.emit("fit",{duration:700}),this.touchTime=new Date().valueOf())}_stopMovement(){for(const e in this.boundFunctions)Object.prototype.hasOwnProperty.call(this.boundFunctions,e)&&(this.body.emitter.off("initRedraw",this.boundFunctions[e]),this.body.emitter.emit("_stopRendering"));this.boundFunctions={}}_moveUp(){this.body.view.translation.y+=this.options.keyboard.speed.y}_moveDown(){this.body.view.translation.y-=this.options.keyboard.speed.y}_moveLeft(){this.body.view.translation.x+=this.options.keyboard.speed.x}_moveRight(){this.body.view.translation.x-=this.options.keyboard.speed.x}_zoomIn(){const e=this.body.view.scale,t=this.body.view.scale*(1+this.options.keyboard.speed.zoom),i=this.body.view.translation,o=t/e,r=(1-o)*this.canvas.canvasViewCenter.x+i.x*o,A=(1-o)*this.canvas.canvasViewCenter.y+i.y*o;this.body.view.scale=t,this.body.view.translation={x:r,y:A},this.body.emitter.emit("zoom",{direction:"+",scale:this.body.view.scale,pointer:null})}_zoomOut(){const e=this.body.view.scale,t=this.body.view.scale/(1+this.options.keyboard.speed.zoom),i=this.body.view.translation,o=t/e,r=(1-o)*this.canvas.canvasViewCenter.x+i.x*o,A=(1-o)*this.canvas.canvasViewCenter.y+i.y*o;this.body.view.scale=t,this.body.view.translation={x:r,y:A},this.body.emitter.emit("zoom",{direction:"-",scale:this.body.view.scale,pointer:null})}configureKeyboardBindings(){if(this.keycharm!==void 0&&this.keycharm.destroy(),this.options.keyboard.enabled===!0&&(this.options.keyboard.bindToWindow===!0?this.keycharm=Cx({container:window,preventDefault:!0}):this.keycharm=Cx({container:this.canvas.frame,preventDefault:!0}),this.keycharm.reset(),this.activated===!0)){var e,t,i,o,r,A,I,l,c,h,p,m,y,w,S,x,O,E,_,P,Q,ne,j,V;ge(e=this.keycharm).call(e,"up",()=>{this.bindToRedraw("_moveUp")},"keydown"),ge(t=this.keycharm).call(t,"down",()=>{this.bindToRedraw("_moveDown")},"keydown"),ge(i=this.keycharm).call(i,"left",()=>{this.bindToRedraw("_moveLeft")},"keydown"),ge(o=this.keycharm).call(o,"right",()=>{this.bindToRedraw("_moveRight")},"keydown"),ge(r=this.keycharm).call(r,"=",()=>{this.bindToRedraw("_zoomIn")},"keydown"),ge(A=this.keycharm).call(A,"num+",()=>{this.bindToRedraw("_zoomIn")},"keydown"),ge(I=this.keycharm).call(I,"num-",()=>{this.bindToRedraw("_zoomOut")},"keydown"),ge(l=this.keycharm).call(l,"-",()=>{this.bindToRedraw("_zoomOut")},"keydown"),ge(c=this.keycharm).call(c,"[",()=>{this.bindToRedraw("_zoomOut")},"keydown"),ge(h=this.keycharm).call(h,"]",()=>{this.bindToRedraw("_zoomIn")},"keydown"),ge(p=this.keycharm).call(p,"pageup",()=>{this.bindToRedraw("_zoomIn")},"keydown"),ge(m=this.keycharm).call(m,"pagedown",()=>{this.bindToRedraw("_zoomOut")},"keydown"),ge(y=this.keycharm).call(y,"up",()=>{this.unbindFromRedraw("_moveUp")},"keyup"),ge(w=this.keycharm).call(w,"down",()=>{this.unbindFromRedraw("_moveDown")},"keyup"),ge(S=this.keycharm).call(S,"left",()=>{this.unbindFromRedraw("_moveLeft")},"keyup"),ge(x=this.keycharm).call(x,"right",()=>{this.unbindFromRedraw("_moveRight")},"keyup"),ge(O=this.keycharm).call(O,"=",()=>{this.unbindFromRedraw("_zoomIn")},"keyup"),ge(E=this.keycharm).call(E,"num+",()=>{this.unbindFromRedraw("_zoomIn")},"keyup"),ge(_=this.keycharm).call(_,"num-",()=>{this.unbindFromRedraw("_zoomOut")},"keyup"),ge(P=this.keycharm).call(P,"-",()=>{this.unbindFromRedraw("_zoomOut")},"keyup"),ge(Q=this.keycharm).call(Q,"[",()=>{this.unbindFromRedraw("_zoomOut")},"keyup"),ge(ne=this.keycharm).call(ne,"]",()=>{this.unbindFromRedraw("_zoomIn")},"keyup"),ge(j=this.keycharm).call(j,"pageup",()=>{this.unbindFromRedraw("_zoomIn")},"keyup"),ge(V=this.keycharm).call(V,"pagedown",()=>{this.unbindFromRedraw("_zoomOut")},"keyup")}}}class x${constructor(e,t,i){var o,r,A,I,l,c,h,p,m,y,w,S,x;this.body=e,this.canvas=t,this.selectionHandler=i,this.navigationHandler=new w$(e,t),this.body.eventListeners.onTap=ge(o=this.onTap).call(o,this),this.body.eventListeners.onTouch=ge(r=this.onTouch).call(r,this),this.body.eventListeners.onDoubleTap=ge(A=this.onDoubleTap).call(A,this),this.body.eventListeners.onHold=ge(I=this.onHold).call(I,this),this.body.eventListeners.onDragStart=ge(l=this.onDragStart).call(l,this),this.body.eventListeners.onDrag=ge(c=this.onDrag).call(c,this),this.body.eventListeners.onDragEnd=ge(h=this.onDragEnd).call(h,this),this.body.eventListeners.onMouseWheel=ge(p=this.onMouseWheel).call(p,this),this.body.eventListeners.onPinch=ge(m=this.onPinch).call(m,this),this.body.eventListeners.onMouseMove=ge(y=this.onMouseMove).call(y,this),this.body.eventListeners.onRelease=ge(w=this.onRelease).call(w,this),this.body.eventListeners.onContext=ge(S=this.onContext).call(S,this),this.touchTime=0,this.drag={},this.pinch={},this.popup=void 0,this.popupObj=void 0,this.popupTimer=void 0,this.body.functions.getPointer=ge(x=this.getPointer).call(x,this),this.options={},this.defaultOptions={dragNodes:!0,dragView:!0,hover:!1,keyboard:{enabled:!1,speed:{x:10,y:10,zoom:.02},bindToWindow:!0,autoFocus:!0},navigationButtons:!1,tooltipDelay:300,zoomView:!0,zoomSpeed:1},Vt(this.options,this.defaultOptions),this.bindEventListeners()}bindEventListeners(){this.body.emitter.on("destroy",()=>{clearTimeout(this.popupTimer),delete this.body.functions.getPointer})}setOptions(e){e!==void 0&&(ZC(["hideEdgesOnDrag","hideEdgesOnZoom","hideNodesOnDrag","keyboard","multiselect","selectable","selectConnectedEdges"],this.options,e),ii(this.options,e,"keyboard"),e.tooltip&&(Vt(this.options.tooltip,e.tooltip),e.tooltip.color&&(this.options.tooltip.color=Kd(e.tooltip.color)))),this.navigationHandler.setOptions(this.options)}getPointer(e){return{x:e.x-PV(this.canvas.frame.canvas),y:e.y-LV(this.canvas.frame.canvas)}}onTouch(e){new Date().valueOf()-this.touchTime>50&&(this.drag.pointer=this.getPointer(e.center),this.drag.pinched=!1,this.pinch.scale=this.body.view.scale,this.touchTime=new Date().valueOf())}onTap(e){const t=this.getPointer(e.center),i=this.selectionHandler.options.multiselect&&(e.changedPointers[0].ctrlKey||e.changedPointers[0].metaKey);this.checkSelectionChanges(t,i),this.selectionHandler.commitAndEmit(t,e),this.selectionHandler.generateClickEvent("click",e,t)}onDoubleTap(e){const t=this.getPointer(e.center);this.selectionHandler.generateClickEvent("doubleClick",e,t)}onHold(e){const t=this.getPointer(e.center),i=this.selectionHandler.options.multiselect;this.checkSelectionChanges(t,i),this.selectionHandler.commitAndEmit(t,e),this.selectionHandler.generateClickEvent("click",e,t),this.selectionHandler.generateClickEvent("hold",e,t)}onRelease(e){if(new Date().valueOf()-this.touchTime>10){const t=this.getPointer(e.center);this.selectionHandler.generateClickEvent("release",e,t),this.touchTime=new Date().valueOf()}}onContext(e){const t=this.getPointer({x:e.clientX,y:e.clientY});this.selectionHandler.generateClickEvent("oncontext",e,t)}checkSelectionChanges(e){(arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1)===!0?this.selectionHandler.selectAdditionalOnPoint(e):this.selectionHandler.selectOnPoint(e)}_determineDifference(e,t){const i=function(o,r){const A=[];for(let I=0;I{const I=A.node;A.xFixed===!1&&(I.x=this.canvas._XconvertDOMtoCanvas(this.canvas._XconvertCanvasToDOM(A.x)+o)),A.yFixed===!1&&(I.y=this.canvas._YconvertDOMtoCanvas(this.canvas._YconvertCanvasToDOM(A.y)+r))}),this.body.emitter.emit("startSimulation")}else{if(e.srcEvent.shiftKey){if(this.selectionHandler.generateClickEvent("dragging",e,t,void 0,!0),this.drag.pointer===void 0){this.onDragStart(e);return}this.body.selectionBox.position.end={x:this.canvas._XconvertDOMtoCanvas(t.x),y:this.canvas._YconvertDOMtoCanvas(t.y)},this.body.emitter.emit("_requestRedraw")}if(this.options.dragView===!0&&!e.srcEvent.shiftKey){if(this.selectionHandler.generateClickEvent("dragging",e,t,void 0,!0),this.drag.pointer===void 0){this.onDragStart(e);return}const o=t.x-this.drag.pointer.x,r=t.y-this.drag.pointer.y;this.body.view.translation={x:this.drag.translation.x+o,y:this.drag.translation.y+r},this.body.emitter.emit("_requestRedraw")}}}onDragEnd(e){if(this.drag.dragging=!1,this.body.selectionBox.show){var t;this.body.selectionBox.show=!1;const i=this.body.selectionBox.position,o={minX:Math.min(i.start.x,i.end.x),minY:Math.min(i.start.y,i.end.y),maxX:Math.max(i.start.x,i.end.x),maxY:Math.max(i.start.y,i.end.y)},r=Qt(t=this.body.nodeIndices).call(t,I=>{const l=this.body.nodes[I];return l.x>=o.minX&&l.x<=o.maxX&&l.y>=o.minY&&l.y<=o.maxY});Je(r).call(r,I=>this.selectionHandler.selectObject(this.body.nodes[I]));const A=this.getPointer(e.center);this.selectionHandler.commitAndEmit(A,e),this.selectionHandler.generateClickEvent("dragEnd",e,this.getPointer(e.center),void 0,!0),this.body.emitter.emit("_requestRedraw")}else{const i=this.drag.selection;i&&i.length?(Je(i).call(i,function(o){o.node.options.fixed.x=o.xFixed,o.node.options.fixed.y=o.yFixed}),this.selectionHandler.generateClickEvent("dragEnd",e,this.getPointer(e.center)),this.body.emitter.emit("startSimulation")):(this.selectionHandler.generateClickEvent("dragEnd",e,this.getPointer(e.center),void 0,!0),this.body.emitter.emit("_requestRedraw"))}}onPinch(e){const t=this.getPointer(e.center);this.drag.pinched=!0,this.pinch.scale===void 0&&(this.pinch.scale=1);const i=this.pinch.scale*e.scale;this.zoom(i,t)}zoom(e,t){if(this.options.zoomView===!0){const i=this.body.view.scale;e<1e-5&&(e=1e-5),e>10&&(e=10);let o;this.drag!==void 0&&this.drag.dragging===!0&&(o=this.canvas.DOMtoCanvas(this.drag.pointer));const r=this.body.view.translation,A=e/i,I=(1-A)*t.x+r.x*A,l=(1-A)*t.y+r.y*A;if(this.body.view.scale=e,this.body.view.translation={x:I,y:l},o!=null){const c=this.canvas.canvasToDOM(o);this.drag.pointer.x=c.x,this.drag.pointer.y=c.y}this.body.emitter.emit("_requestRedraw"),ithis._checkShowPopup(t),this.options.tooltipDelay))),this.options.hover===!0&&this.selectionHandler.hoverObject(e,t)}_checkShowPopup(e){const t=this.canvas._XconvertDOMtoCanvas(e.x),i=this.canvas._YconvertDOMtoCanvas(e.y),o={left:t,top:i,right:t,bottom:i},r=this.popupObj===void 0?void 0:this.popupObj.id;let A=!1,I="node";if(this.popupObj===void 0){const l=this.body.nodeIndices,c=this.body.nodes;let h;const p=[];for(let m=0;m0&&(this.popupObj=c[p[p.length-1]],A=!0)}if(this.popupObj===void 0&&A===!1){const l=this.body.edgeIndices,c=this.body.edges;let h;const p=[];for(let m=0;m0&&(this.popupObj=c[p[p.length-1]],I="edge")}this.popupObj!==void 0?this.popupObj.id!==r&&(this.popup===void 0&&(this.popup=new $V(this.canvas.frame)),this.popup.popupTargetType=I,this.popup.popupTargetId=this.popupObj.id,this.popup.setPosition(e.x+3,e.y-5),this.popup.setText(this.popupObj.getTitle()),this.popup.show(),this.body.emitter.emit("showPopup",this.popupObj.id)):this.popup!==void 0&&(this.popup.hide(),this.body.emitter.emit("hidePopup"))}_checkHidePopup(e){const t=this.selectionHandler._pointerToPositionObject(e);let i=!1;if(this.popup.popupTargetType==="node"){if(this.body.nodes[this.popup.popupTargetId]!==void 0&&(i=this.body.nodes[this.popup.popupTargetId].isOverlappingWith(t),i===!0)){const o=this.selectionHandler.getNodeAt(e);i=o===void 0?!1:o.id===this.popup.popupTargetId}}else this.selectionHandler.getNodeAt(e)===void 0&&this.body.edges[this.popup.popupTargetId]!==void 0&&(i=this.body.edges[this.popup.popupTargetId].isOverlappingWith(t));i===!1&&(this.popupObj=void 0,this.popup.hide(),this.body.emitter.emit("hidePopup"))}}var S$=gt,Ix=ou,JC=GC.getWeakData,E$=iu,T$=Hi,O$=as,Tu=yn,N$=nu,lx=xg,cx=gn,dx=mo,D$=dx.set,M$=dx.getterFor,z$=lx.find,k$=lx.findIndex,R$=S$([].splice),_$=0,eI=function(n){return n.frozen||(n.frozen=new ux)},ux=function(){this.entries=[]},Ou=function(n,e){return z$(n.entries,function(t){return t[0]===e})};ux.prototype={get:function(n){var e=Ou(this,n);if(e)return e[1]},has:function(n){return!!Ou(this,n)},set:function(n,e){var t=Ou(this,n);t?t[1]=e:this.entries.push([n,e])},delete:function(n){var e=k$(this.entries,function(t){return t[0]===n});return~e&&R$(this.entries,e,1),!!~e}};var j$={getConstructor:function(n,e,t,i){var o=n(function(l,c){E$(l,r),D$(l,{type:e,id:_$++,frozen:void 0}),O$(c)||N$(c,l[i],{that:l,AS_ENTRIES:t})}),r=o.prototype,A=M$(e),I=function(l,c,h){var p=A(l),m=JC(T$(c),!0);return m===!0?eI(p).set(c,h):m[p.id]=h,l};return Ix(r,{delete:function(l){var c=A(this);if(!Tu(l))return!1;var h=JC(l);return h===!0?eI(c).delete(l):h&&cx(h,c.id)&&delete h[c.id]},has:function(c){var h=A(this);if(!Tu(c))return!1;var p=JC(c);return p===!0?eI(h).has(c):p&&cx(p,h.id)}}),Ix(r,t?{get:function(c){var h=A(this);if(Tu(c)){var p=JC(c);return p===!0?eI(h).get(c):p?p[h.id]:void 0}},set:function(c,h){return I(this,c,h)}}:{add:function(c){return I(this,c,!0)}}),o}},Z$=z1,hx=_t,tI=gt,fx=ou,B$=GC,P$=gu,px=j$,nI=yn,iI=mo.enforce,L$=it,G$=Yy,ka=Object,F$=Array.isArray,gI=ka.isExtensible,mx=ka.isFrozen,V$=ka.isSealed,vx=ka.freeze,U$=ka.seal,yx={},bx={},Y$=!hx.ActiveXObject&&"ActiveXObject"in hx,Ra,wx=function(n){return function(){return n(this,arguments.length?arguments[0]:void 0)}},xx=P$("WeakMap",wx,px),Ps=xx.prototype,oI=tI(Ps.set),H$=function(){return Z$&&L$(function(){var n=vx([]);return oI(new xx,n,1),!mx(n)})};if(G$)if(Y$){Ra=px.getConstructor(wx,"WeakMap",!0),B$.enable();var Sx=tI(Ps.delete),sI=tI(Ps.has),Ex=tI(Ps.get);fx(Ps,{delete:function(n){if(nI(n)&&!gI(n)){var e=iI(this);return e.frozen||(e.frozen=new Ra),Sx(this,n)||e.frozen.delete(n)}return Sx(this,n)},has:function(e){if(nI(e)&&!gI(e)){var t=iI(this);return t.frozen||(t.frozen=new Ra),sI(this,e)||t.frozen.has(e)}return sI(this,e)},get:function(e){if(nI(e)&&!gI(e)){var t=iI(this);return t.frozen||(t.frozen=new Ra),sI(this,e)?Ex(this,e):t.frozen.get(e)}return Ex(this,e)},set:function(e,t){if(nI(e)&&!gI(e)){var i=iI(this);i.frozen||(i.frozen=new Ra),sI(this,e)?oI(this,e,t):i.frozen.set(e,t)}else oI(this,e,t);return this}})}else H$()&&fx(Ps,{set:function(e,t){var i;return F$(e)&&(mx(e)?i=yx:V$(e)&&(i=bx)),oI(this,e,t),i===yx&&vx(e),i===bx&&U$(e),this}});var K$=st,W$=K$.WeakMap,Q$=W$,X$=Q$,$$=X$,_a=Ne($$);function yt(n,e,t,i){if(typeof e=="function"?n!==e||!i:!e.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(n):i?i.value:e.get(n)}function Nu(n,e,t,i,o){if(typeof e=="function"?n!==e||!0:!e.has(n))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(n,t),t}typeof SuppressedError=="function"&&SuppressedError;var _o,gi,Zg,Bg,rI;function Tx(n,e){const t=new wi;for(const i of e)n.has(i)||t.add(i);return t}class Ox{constructor(){_o.set(this,new wi),gi.set(this,new wi)}get size(){return yt(this,gi,"f").size}add(){for(var e=arguments.length,t=new Array(e),i=0;i0&&arguments[0]!==void 0?arguments[0]:()=>{};Zg.set(this,new Ox),Bg.set(this,new Ox),rI.set(this,void 0),Nu(this,rI,e)}get sizeNodes(){return yt(this,Zg,"f").size}get sizeEdges(){return yt(this,Bg,"f").size}getNodes(){return yt(this,Zg,"f").getSelection()}getEdges(){return yt(this,Bg,"f").getSelection()}addNodes(){yt(this,Zg,"f").add(...arguments)}addEdges(){yt(this,Bg,"f").add(...arguments)}deleteNodes(e){yt(this,Zg,"f").delete(e)}deleteEdges(e){yt(this,Bg,"f").delete(e)}clear(){yt(this,Zg,"f").clear(),yt(this,Bg,"f").clear()}commit(){const e={nodes:yt(this,Zg,"f").commit(),edges:yt(this,Bg,"f").commit()};for(var t=arguments.length,i=new Array(t),o=0;o{this.updateSelection()})}setOptions(e){e!==void 0&&Ds(["multiselect","hoverConnectedEdges","selectable","selectConnectedEdges"],this.options,e)}selectOnPoint(e){let t=!1;if(this.options.selectable===!0){const i=this.getNodeAt(e)||this.getEdgeAt(e);this.unselectAll(),i!==void 0&&(t=this.selectObject(i)),this.body.emitter.emit("_requestRedraw")}return t}selectAdditionalOnPoint(e){let t=!1;if(this.options.selectable===!0){const i=this.getNodeAt(e)||this.getEdgeAt(e);i!==void 0&&(t=!0,i.isSelected()===!0?this.deselectObject(i):this.selectObject(i),this.body.emitter.emit("_requestRedraw"))}return t}_initBaseEvent(e,t){const i={};return i.pointer={DOM:{x:t.x,y:t.y},canvas:this.canvas.DOMtoCanvas(t)},i.event=e,i}generateClickEvent(e,t,i,o){let r=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1;const A=this._initBaseEvent(t,i);if(r===!0)A.nodes=[],A.edges=[];else{const I=this.getSelection();A.nodes=I.nodes,A.edges=I.edges}o!==void 0&&(A.previousSelection=o),e=="click"&&(A.items=this.getClickedItems(i)),t.controlEdge!==void 0&&(A.controlEdge=t.controlEdge),this.body.emitter.emit(e,A)}selectObject(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.options.selectConnectedEdges;return e!==void 0?(e instanceof Ot?(t===!0&&this._selectionAccumulator.addEdges(...e.edges),this._selectionAccumulator.addNodes(e)):this._selectionAccumulator.addEdges(e),!0):!1}deselectObject(e){e.isSelected()===!0&&(e.selected=!1,this._removeFromSelection(e))}_getAllNodesOverlappingWith(e){const t=[],i=this.body.nodes;for(let o=0;o1&&arguments[1]!==void 0?arguments[1]:!0;const i=this._pointerToPositionObject(e),o=this._getAllNodesOverlappingWith(i);if(o.length>0)return t===!0?this.body.nodes[o[o.length-1]]:o[o.length-1]}_getEdgesOverlappingWith(e,t){const i=this.body.edges;for(let o=0;o1&&arguments[1]!==void 0?arguments[1]:!0;const i=this.canvas.DOMtoCanvas(e);let o=10,r=null;const A=this.body.edges;for(let I=0;I0&&(this.generateClickEvent("deselectEdge",t,e,r),i=!0),o.nodes.deleted.length>0&&(this.generateClickEvent("deselectNode",t,e,r),i=!0),o.nodes.added.length>0&&(this.generateClickEvent("selectNode",t,e),i=!0),o.edges.added.length>0&&(this.generateClickEvent("selectEdge",t,e),i=!0),i===!0&&this.generateClickEvent("select",t,e)}getSelection(){return{nodes:this.getSelectedNodeIds(),edges:this.getSelectedEdgeIds()}}getSelectedNodes(){return this._selectionAccumulator.getNodes()}getSelectedEdges(){return this._selectionAccumulator.getEdges()}getSelectedNodeIds(){var e;return cn(e=this._selectionAccumulator.getNodes()).call(e,t=>t.id)}getSelectedEdgeIds(){var e;return cn(e=this._selectionAccumulator.getEdges()).call(e,t=>t.id)}setSelection(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!e||!e.nodes&&!e.edges)throw new TypeError("Selection must be an object with nodes and/or edges properties");if((t.unselectAll||t.unselectAll===void 0)&&this.unselectAll(),e.nodes)for(const i of e.nodes){const o=this.body.nodes[i];if(!o)throw new RangeError('Node with id "'+i+'" not found');this.selectObject(o,t.highlightEdges)}if(e.edges)for(const i of e.edges){const o=this.body.edges[i];if(!o)throw new RangeError('Edge with id "'+i+'" not found');this.selectObject(o)}this.body.emitter.emit("_requestRedraw"),this._selectionAccumulator.commit()}selectNodes(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(!e||e.length===void 0)throw"Selection must be an array with ids";this.setSelection({nodes:e},{highlightEdges:t})}selectEdges(e){if(!e||e.length===void 0)throw"Selection must be an array with ids";this.setSelection({edges:e})}updateSelection(){for(const e in this._selectionAccumulator.getNodes())Object.prototype.hasOwnProperty.call(this.body.nodes,e.id)||this._selectionAccumulator.deleteNodes(e);for(const e in this._selectionAccumulator.getEdges())Object.prototype.hasOwnProperty.call(this.body.edges,e.id)||this._selectionAccumulator.deleteEdges(e)}getClickedItems(e){const t=this.canvas.DOMtoCanvas(e),i=[],o=this.body.nodeIndices,r=this.body.nodes;for(let l=o.length-1;l>=0;l--){const h=r[o[l]].getItemsOnPoint(t);i.push.apply(i,h)}const A=this.body.edgeIndices,I=this.body.edges;for(let l=A.length-1;l>=0;l--){const h=I[A[l]].getItemsOnPoint(t);i.push.apply(i,h)}return i}}class Nx{abstract(){throw new Error("Can't instantiate abstract class!")}fake_use(){}curveType(){return this.abstract()}getPosition(e){return this.fake_use(e),this.abstract()}setPosition(e,t){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;this.fake_use(e,t,i),this.abstract()}getTreeSize(e){return this.fake_use(e),this.abstract()}sort(e){this.fake_use(e),this.abstract()}fix(e,t){this.fake_use(e,t),this.abstract()}shift(e,t){this.fake_use(e,t),this.abstract()}}class eq extends Nx{constructor(e){super(),this.layout=e}curveType(){return"horizontal"}getPosition(e){return e.x}setPosition(e,t){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;i!==void 0&&this.layout.hierarchical.addToOrdering(e,i),e.x=t}getTreeSize(e){const t=this.layout.hierarchical.getTreeSize(this.layout.body.nodes,e);return{min:t.min_x,max:t.max_x}}sort(e){eg(e).call(e,function(t,i){return t.x-i.x})}fix(e,t){e.y=this.layout.options.hierarchical.levelSeparation*t,e.options.fixed.y=!0}shift(e,t){this.layout.body.nodes[e].x+=t}}class tq extends Nx{constructor(e){super(),this.layout=e}curveType(){return"vertical"}getPosition(e){return e.y}setPosition(e,t){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;i!==void 0&&this.layout.hierarchical.addToOrdering(e,i),e.y=t}getTreeSize(e){const t=this.layout.hierarchical.getTreeSize(this.layout.body.nodes,e);return{min:t.min_y,max:t.max_y}}sort(e){eg(e).call(e,function(t,i){return t.y-i.y})}fix(e,t){e.x=this.layout.options.hierarchical.levelSeparation*t,e.options.fixed.x=!0}shift(e,t){this.layout.body.nodes[e].y+=t}}var nq=ze,iq=xg.every,gq=ys,oq=gq("every");nq({target:"Array",proto:!0,forced:!oq},{every:function(e){return iq(this,e,arguments.length>1?arguments[1]:void 0)}});var sq=Wt,rq=sq("Array").every,aq=jt,Aq=rq,Du=Array.prototype,Cq=function(n){var e=n.every;return n===Du||aq(Du,n)&&e===Du.every?Aq:e},Iq=Cq,lq=Iq,cq=lq,Dx=Ne(cq);function dq(n,e){const t=new wi;return Je(n).call(n,i=>{var o;Je(o=i.edges).call(o,r=>{r.connected&&t.add(r)})}),Je(t).call(t,i=>{const o=i.from.id,r=i.to.id;e[o]==null&&(e[o]=0),(e[r]==null||e[o]>=e[r])&&(e[r]=e[o]+1)}),e}function uq(n){return Mx(e=>{var t,i;return Dx(t=Qt(i=e.edges).call(i,o=>n.has(o.toId))).call(t,o=>o.to===e)},(e,t)=>t>e,"from",n)}function hq(n){return Mx(e=>{var t,i;return Dx(t=Qt(i=e.edges).call(i,o=>n.has(o.toId))).call(t,o=>o.from===e)},(e,t)=>tp+1+m.edges.length,0),I=t+"Id",l=t==="to"?1:-1;for(const[p,m]of i){if(!i.has(p)||!n(m))continue;r[p]=0;const y=[m];let w=0,S;for(;S=y.pop();){var c,h;if(!i.has(p))continue;const x=r[S.id]+l;if(Je(c=Qt(h=S.edges).call(h,O=>O.connected&&O.to!==O.from&&O[t]!==S&&i.has(O.toId)&&i.has(O.fromId))).call(c,O=>{const E=O[I],_=r[E];(_==null||e(x,_))&&(r[E]=x,y.push(O[t]))}),w>A)return dq(i,r);++w}}return r}class fq{constructor(){this.childrenReference={},this.parentReference={},this.trees={},this.distributionOrdering={},this.levels={},this.distributionIndex={},this.isTree=!1,this.treeIndex=-1}addRelation(e,t){this.childrenReference[e]===void 0&&(this.childrenReference[e]=[]),this.childrenReference[e].push(t),this.parentReference[t]===void 0&&(this.parentReference[t]=[]),this.parentReference[t].push(e)}checkIfTree(){for(const e in this.parentReference)if(this.parentReference[e].length>1){this.isTree=!1;return}this.isTree=!0}numTrees(){return this.treeIndex+1}setTreeIndex(e,t){t!==void 0&&this.trees[e.id]===void 0&&(this.trees[e.id]=t,this.treeIndex=Math.max(t,this.treeIndex))}ensureLevel(e){this.levels[e]===void 0&&(this.levels[e]=0)}getMaxLevel(e){const t={},i=o=>{if(t[o]!==void 0)return t[o];let r=this.levels[o];if(this.childrenReference[o]){const A=this.childrenReference[o];if(A.length>0)for(let I=0;Ir-A);for(const r of o)t.set(r,i++);for(const r in this.levels)Object.prototype.hasOwnProperty.call(this.levels,r)&&(this.levels[r]=t.get(this.levels[r]))}getTreeSize(e,t){let i=1e9,o=-1e9,r=1e9,A=-1e9;for(const I in this.trees)if(Object.prototype.hasOwnProperty.call(this.trees,I)&&this.trees[I]===t){const l=e[I];i=Math.min(l.x,i),o=Math.max(l.x,o),r=Math.min(l.y,r),A=Math.max(l.y,A)}return{min_x:i,max_x:o,min_y:r,max_y:A}}hasSameParent(e,t){const i=this.parentReference[e.id],o=this.parentReference[t.id];if(i===void 0||o===void 0)return!1;for(let r=0;r{this.setupHierarchicalLayout()}),this.body.emitter.on("_dataLoaded",()=>{this.layoutNetwork()}),this.body.emitter.on("_resetHierarchicalLayout",()=>{this.setupHierarchicalLayout()}),this.body.emitter.on("_adjustEdgesForHierarchicalLayout",()=>{if(this.options.hierarchical.enabled!==!0)return;const e=this.direction.curveType();this.body.emitter.emit("_forceDisableDynamicCurves",e,!1)})}setOptions(e,t){if(e!==void 0){const i=this.options.hierarchical,o=i.enabled;if(Ds(["randomSeed","improvedLayout","clusterThreshold"],this.options,e),ii(this.options,e,"hierarchical"),e.randomSeed!==void 0&&this._resetRNG(e.randomSeed),i.enabled===!0)return o===!0&&this.body.emitter.emit("refresh",!0),i.direction==="RL"||i.direction==="DU"?i.levelSeparation>0&&(i.levelSeparation*=-1):i.levelSeparation<0&&(i.levelSeparation*=-1),this.setDirectionStrategy(),this.body.emitter.emit("_resetHierarchicalLayout"),this.adaptAllOptionsForHierarchicalLayout(t);if(o===!0)return this.body.emitter.emit("refresh"),mt(t,this.optionsBackup)}return t}_resetRNG(e){this.initialRandomSeed=e,this._rng=jC(this.initialRandomSeed)}adaptAllOptionsForHierarchicalLayout(e){if(this.options.hierarchical.enabled===!0){const t=this.optionsBackup.physics;e.physics===void 0||e.physics===!0?(e.physics={enabled:t.enabled===void 0?!0:t.enabled,solver:"hierarchicalRepulsion"},t.enabled=t.enabled===void 0?!0:t.enabled,t.solver=t.solver||"barnesHut"):typeof e.physics=="object"?(t.enabled=e.physics.enabled===void 0?!0:e.physics.enabled,t.solver=e.physics.solver||"barnesHut",e.physics.solver="hierarchicalRepulsion"):e.physics!==!1&&(t.solver="barnesHut",e.physics={solver:"hierarchicalRepulsion"});let i=this.direction.curveType();if(e.edges===void 0)this.optionsBackup.edges={smooth:{enabled:!0,type:"dynamic"}},e.edges={smooth:!1};else if(e.edges.smooth===void 0)this.optionsBackup.edges={smooth:{enabled:!0,type:"dynamic"}},e.edges.smooth=!1;else if(typeof e.edges.smooth=="boolean")this.optionsBackup.edges={smooth:e.edges.smooth},e.edges.smooth={enabled:e.edges.smooth,type:i};else{const o=e.edges.smooth;o.type!==void 0&&o.type!=="dynamic"&&(i=o.type),this.optionsBackup.edges={smooth:{enabled:o.enabled===void 0?!0:o.enabled,type:o.type===void 0?"dynamic":o.type,roundness:o.roundness===void 0?.5:o.roundness,forceDirection:o.forceDirection===void 0?!1:o.forceDirection}},e.edges.smooth={enabled:o.enabled===void 0?!0:o.enabled,type:i,roundness:o.roundness===void 0?.5:o.roundness,forceDirection:o.forceDirection===void 0?!1:o.forceDirection}}this.body.emitter.emit("_forceDisableDynamicCurves",i)}return e}positionInitially(e){if(this.options.hierarchical.enabled!==!0){this._resetRNG(this.initialRandomSeed);const t=e.length+50;for(let i=0;ir){const l=e.length;for(;e.length>r&&o<=10;){o+=1;const c=e.length;o%3===0?this.body.modules.clustering.clusterBridges(A):this.body.modules.clustering.clusterOutliers(A);const h=e.length;if(c==h&&o%3!==0){this._declusterAll(),this.body.emitter.emit("_layoutFailed"),console.info("This network could not be positioned by this version of the improved layout algorithm. Please disable improvedLayout for better performance.");return}}this.body.modules.kamadaKawai.setOptions({springLength:Math.max(150,2*l)})}o>10&&console.info("The clustering didn't succeed within the amount of interations allowed, progressing with partial result."),this.body.modules.kamadaKawai.solve(e,this.body.edgeIndices,!0),this._shiftToCenter();const I=70;for(let l=0;l0){let e,t,i=!1,o=!1;this.lastNodeOnLevel={},this.hierarchical=new fq;for(t in this.body.nodes)Object.prototype.hasOwnProperty.call(this.body.nodes,t)&&(e=this.body.nodes[t],e.options.level!==void 0?(i=!0,this.hierarchical.levels[t]=e.options.level):o=!0);if(o===!0&&i===!0)throw new Error("To use the hierarchical layout, nodes require either no predefined levels or levels have to be defined for all nodes.");{if(o===!0){const A=this.options.hierarchical.sortMethod;A==="hubsize"?this._determineLevelsByHubsize():A==="directed"?this._determineLevelsDirected():A==="custom"&&this._determineLevelsCustomCallback()}for(const A in this.body.nodes)Object.prototype.hasOwnProperty.call(this.body.nodes,A)&&this.hierarchical.ensureLevel(A);const r=this._getDistribution();this._generateMap(),this._placeNodesByHierarchy(r),this._condenseHierarchy(),this._shiftToCenter()}}}_condenseHierarchy(){var e=this;let t=!1;const i={},o=()=>{const O=A();let E=0;for(let _=0;_{const _=this.hierarchical.trees;for(const P in _)Object.prototype.hasOwnProperty.call(_,P)&&_[P]===O&&this.direction.shift(P,E)},A=()=>{const O=[];for(let E=0;E{if(!E[O.id]&&(E[O.id]=!0,this.hierarchical.childrenReference[O.id])){const _=this.hierarchical.childrenReference[O.id];if(_.length>0)for(let P=0;P<_.length;P++)I(this.body.nodes[_[P]],E)}},l=function(O){let E=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1e9,_=1e9,P=1e9,Q=1e9,ne=-1e9;for(const j in O)if(Object.prototype.hasOwnProperty.call(O,j)){const V=e.body.nodes[j],de=e.hierarchical.levels[V.id],le=e.direction.getPosition(V),[Ze,Ee]=e._getSpaceAroundNode(V,O);_=Math.min(Ze,_),P=Math.min(Ee,P),de<=E&&(Q=Math.min(le,Q),ne=Math.max(le,ne))}return[Q,ne,_,P]},c=(O,E)=>{const _=this.hierarchical.getMaxLevel(O.id),P=this.hierarchical.getMaxLevel(E.id);return Math.min(_,P)},h=(O,E,_)=>{const P=this.hierarchical;for(let Q=0;Q1)for(let V=0;V2&&arguments[2]!==void 0?arguments[2]:!1;const P=e.direction.getPosition(O),Q=e.direction.getPosition(E),ne=Math.abs(Q-P),j=e.options.hierarchical.nodeSpacing;if(ne>j){const V={},de={};I(O,V),I(E,de);const le=c(O,E),Ze=l(V,le),Ee=l(de,le),Ue=Ze[1],We=Ee[0],Ae=Ee[2];if(Math.abs(Ue-We)>j){let U=Ue-We+j;U<-Ae+j&&(U=-Ae+j),U<0&&(e._shiftBlock(E.id,U),t=!0,_===!0&&e._centerParent(E))}}},m=(O,E)=>{const _=E.id,P=E.edges,Q=this.hierarchical.levels[E.id],ne=this.options.hierarchical.levelSeparation*this.options.hierarchical.levelSeparation,j={},V=[];for(let Ae=0;Ae{let U=0;for(let K=0;K{let U=0;for(let K=0;K{let U=this.direction.getPosition(E);const K={};for(let re=0;re{const M=this.direction.getPosition(E);if(i[E.id]===void 0){const L={};I(E,L),i[E.id]=L}const U=l(i[E.id]),K=U[2],re=U[3],ee=Ae-M;let T=0;ee>0?T=Math.min(ee,re-this.options.hierarchical.nodeSpacing):ee<0&&(T=-Math.min(-ee,K-this.options.hierarchical.nodeSpacing)),T!=0&&(this._shiftBlock(E.id,T),t=!0)},Ue=Ae=>{const M=this.direction.getPosition(E),[U,K]=this._getSpaceAroundNode(E),re=Ae-M;let ee=M;re>0?ee=Math.min(M+(K-this.options.hierarchical.nodeSpacing),Ae):re<0&&(ee=Math.max(M-(U-this.options.hierarchical.nodeSpacing),Ae)),ee!==M&&(this.direction.setPosition(E,ee),t=!0)};let We=Ze(O,V);Ee(We),We=Ze(O,P),Ue(We)},y=O=>{let E=this.hierarchical.getLevels();E=wo(E).call(E);for(let _=0;_{let E=this.hierarchical.getLevels();E=wo(E).call(E);for(let _=0;_{for(const O in this.body.nodes)Object.prototype.hasOwnProperty.call(this.body.nodes,O)&&this._centerParent(this.body.nodes[O])},x=()=>{let O=this.hierarchical.getLevels();O=wo(O).call(O);for(let E=0;E0&&Math.abs(p)0&&(c=this.direction.getPosition(o[A-1])+l),this.direction.setPosition(I,c,i),this._validatePositionAndContinue(I,i,c),r++}}}}_placeBranchNodes(e,t){var i;const o=this.hierarchical.childrenReference[e];if(o===void 0)return;const r=[];for(let I=0;It&&this.positionedNodes[l.id]===void 0){const h=this.options.hierarchical.nodeSpacing;let p;I===0?p=this.direction.getPosition(this.body.nodes[e]):p=this.direction.getPosition(r[I-1])+h,this.direction.setPosition(l,p,c),this._validatePositionAndContinue(l,c,p)}else return}const A=this._getCenterPosition(r);this.direction.setPosition(this.body.nodes[e],A,t)}_validatePositionAndContinue(e,t,i){if(this.hierarchical.isTree){if(this.lastNodeOnLevel[t]!==void 0){const o=this.direction.getPosition(this.body.nodes[this.lastNodeOnLevel[t]]);if(i-o{var o;at(o=this.body.edgeIndices).call(o,i.id)!==-1&&t.push(i)}),t}_getHubSizes(){const e={},t=this.body.nodeIndices;Ye(t,o=>{const r=this.body.nodes[o],A=this._getActiveEdges(r).length;e[A]=!0});const i=[];return Ye(e,o=>{i.push(Number(o))}),eg(i).call(i,function(o,r){return r-o}),i}_determineLevelsByHubsize(){const e=(i,o)=>{this.hierarchical.levelDownstream(i,o)},t=this._getHubSizes();for(let i=0;i{const A=this.body.nodes[r];o===this._getActiveEdges(A).length&&this._crawlNetwork(e,r)})}}_determineLevelsCustomCallback(){const t=function(o,r,A){},i=(o,r,A)=>{let I=this.hierarchical.levels[o.id];I===void 0&&(I=this.hierarchical.levels[o.id]=1e5);const l=t(En.cloneOptions(o,"node"),En.cloneOptions(r,"node"),En.cloneOptions(A,"edge"));this.hierarchical.levels[r.id]=I+l};this._crawlNetwork(i),this.hierarchical.setMinLevelToZero()}_determineLevelsDirected(){var e;const t=cu(e=this.body.nodeIndices).call(e,(i,o)=>(i.set(o,this.body.nodes[o]),i),new Oa);this.options.hierarchical.shakeTowards==="roots"?this.hierarchical.levels=hq(t):this.hierarchical.levels=uq(t),this.hierarchical.setMinLevelToZero()}_generateMap(){const e=(t,i)=>{this.hierarchical.levels[i.id]>this.hierarchical.levels[t.id]&&this.hierarchical.addRelation(t.id,i.id)};this._crawlNetwork(e),this.hierarchical.checkIfTree()}_crawlNetwork(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(){},t=arguments.length>1?arguments[1]:void 0;const i={},o=(r,A)=>{if(i[r.id]===void 0){this.hierarchical.setTreeIndex(r,A),i[r.id]=!0;let I;const l=this._getActiveEdges(r);for(let c=0;c{if(i[r])return;i[r]=!0,this.direction.shift(r,t);const A=this.hierarchical.childrenReference[r];if(A!==void 0)for(let I=0;I{const l=this.hierarchical.parentReference[I];if(l!==void 0)for(let c=0;c{const l=this.hierarchical.parentReference[I];if(l!==void 0)for(let c=0;c{this.activated=!0,this.configureKeyboardBindings()}),this.body.emitter.on("deactivate",()=>{this.activated=!1,this.configureKeyboardBindings()}),this.body.emitter.on("destroy",()=>{this.keycharm!==void 0&&this.keycharm.destroy()}),this.options={}}setOptions(e){e!==void 0&&(this.options=e,this.create())}create(){this.options.navigationButtons===!0?this.iconsCreated===!1&&this.loadNavigationElements():this.iconsCreated===!0&&this.cleanNavigation(),this.configureKeyboardBindings()}cleanNavigation(){if(this.navigationHammers.length!=0){for(let e=0;e{this._stopMovement()}),this.navigationHammers.push(r),this.iconsCreated=!0}bindToRedraw(e){if(this.boundFunctions[e]===void 0){var t;this.boundFunctions[e]=ge(t=this[e]).call(t,this),this.body.emitter.on("initRedraw",this.boundFunctions[e]),this.body.emitter.emit("_startRendering")}}unbindFromRedraw(e){this.boundFunctions[e]!==void 0&&(this.body.emitter.off("initRedraw",this.boundFunctions[e]),this.body.emitter.emit("_stopRendering"),delete this.boundFunctions[e])}_fit(){new Date().valueOf()-this.touchTime>700&&(this.body.emitter.emit("fit",{duration:700}),this.touchTime=new Date().valueOf())}_stopMovement(){for(const e in this.boundFunctions)Object.prototype.hasOwnProperty.call(this.boundFunctions,e)&&(this.body.emitter.off("initRedraw",this.boundFunctions[e]),this.body.emitter.emit("_stopRendering"));this.boundFunctions={}}_moveUp(){this.body.view.translation.y+=this.options.keyboard.speed.y}_moveDown(){this.body.view.translation.y-=this.options.keyboard.speed.y}_moveLeft(){this.body.view.translation.x+=this.options.keyboard.speed.x}_moveRight(){this.body.view.translation.x-=this.options.keyboard.speed.x}_zoomIn(){const e=this.body.view.scale,t=this.body.view.scale*(1+this.options.keyboard.speed.zoom),i=this.body.view.translation,o=t/e,r=(1-o)*this.canvas.canvasViewCenter.x+i.x*o,A=(1-o)*this.canvas.canvasViewCenter.y+i.y*o;this.body.view.scale=t,this.body.view.translation={x:r,y:A},this.body.emitter.emit("zoom",{direction:"+",scale:this.body.view.scale,pointer:null})}_zoomOut(){const e=this.body.view.scale,t=this.body.view.scale/(1+this.options.keyboard.speed.zoom),i=this.body.view.translation,o=t/e,r=(1-o)*this.canvas.canvasViewCenter.x+i.x*o,A=(1-o)*this.canvas.canvasViewCenter.y+i.y*o;this.body.view.scale=t,this.body.view.translation={x:r,y:A},this.body.emitter.emit("zoom",{direction:"-",scale:this.body.view.scale,pointer:null})}configureKeyboardBindings(){if(this.keycharm!==void 0&&this.keycharm.destroy(),this.options.keyboard.enabled===!0&&(this.options.keyboard.bindToWindow===!0?this.keycharm=Ix({container:window,preventDefault:!0}):this.keycharm=Ix({container:this.canvas.frame,preventDefault:!0}),this.keycharm.reset(),this.activated===!0)){var e,t,i,o,r,A,I,l,c,h,p,m,y,w,S,x,O,E,_,P,Q,ne,F,Z;ge(e=this.keycharm).call(e,"up",()=>{this.bindToRedraw("_moveUp")},"keydown"),ge(t=this.keycharm).call(t,"down",()=>{this.bindToRedraw("_moveDown")},"keydown"),ge(i=this.keycharm).call(i,"left",()=>{this.bindToRedraw("_moveLeft")},"keydown"),ge(o=this.keycharm).call(o,"right",()=>{this.bindToRedraw("_moveRight")},"keydown"),ge(r=this.keycharm).call(r,"=",()=>{this.bindToRedraw("_zoomIn")},"keydown"),ge(A=this.keycharm).call(A,"num+",()=>{this.bindToRedraw("_zoomIn")},"keydown"),ge(I=this.keycharm).call(I,"num-",()=>{this.bindToRedraw("_zoomOut")},"keydown"),ge(l=this.keycharm).call(l,"-",()=>{this.bindToRedraw("_zoomOut")},"keydown"),ge(c=this.keycharm).call(c,"[",()=>{this.bindToRedraw("_zoomOut")},"keydown"),ge(h=this.keycharm).call(h,"]",()=>{this.bindToRedraw("_zoomIn")},"keydown"),ge(p=this.keycharm).call(p,"pageup",()=>{this.bindToRedraw("_zoomIn")},"keydown"),ge(m=this.keycharm).call(m,"pagedown",()=>{this.bindToRedraw("_zoomOut")},"keydown"),ge(y=this.keycharm).call(y,"up",()=>{this.unbindFromRedraw("_moveUp")},"keyup"),ge(w=this.keycharm).call(w,"down",()=>{this.unbindFromRedraw("_moveDown")},"keyup"),ge(S=this.keycharm).call(S,"left",()=>{this.unbindFromRedraw("_moveLeft")},"keyup"),ge(x=this.keycharm).call(x,"right",()=>{this.unbindFromRedraw("_moveRight")},"keyup"),ge(O=this.keycharm).call(O,"=",()=>{this.unbindFromRedraw("_zoomIn")},"keyup"),ge(E=this.keycharm).call(E,"num+",()=>{this.unbindFromRedraw("_zoomIn")},"keyup"),ge(_=this.keycharm).call(_,"num-",()=>{this.unbindFromRedraw("_zoomOut")},"keyup"),ge(P=this.keycharm).call(P,"-",()=>{this.unbindFromRedraw("_zoomOut")},"keyup"),ge(Q=this.keycharm).call(Q,"[",()=>{this.unbindFromRedraw("_zoomOut")},"keyup"),ge(ne=this.keycharm).call(ne,"]",()=>{this.unbindFromRedraw("_zoomIn")},"keyup"),ge(F=this.keycharm).call(F,"pageup",()=>{this.unbindFromRedraw("_zoomIn")},"keyup"),ge(Z=this.keycharm).call(Z,"pagedown",()=>{this.unbindFromRedraw("_zoomOut")},"keyup")}}}class x${constructor(e,t,i){var o,r,A,I,l,c,h,p,m,y,w,S,x;this.body=e,this.canvas=t,this.selectionHandler=i,this.navigationHandler=new w$(e,t),this.body.eventListeners.onTap=ge(o=this.onTap).call(o,this),this.body.eventListeners.onTouch=ge(r=this.onTouch).call(r,this),this.body.eventListeners.onDoubleTap=ge(A=this.onDoubleTap).call(A,this),this.body.eventListeners.onHold=ge(I=this.onHold).call(I,this),this.body.eventListeners.onDragStart=ge(l=this.onDragStart).call(l,this),this.body.eventListeners.onDrag=ge(c=this.onDrag).call(c,this),this.body.eventListeners.onDragEnd=ge(h=this.onDragEnd).call(h,this),this.body.eventListeners.onMouseWheel=ge(p=this.onMouseWheel).call(p,this),this.body.eventListeners.onPinch=ge(m=this.onPinch).call(m,this),this.body.eventListeners.onMouseMove=ge(y=this.onMouseMove).call(y,this),this.body.eventListeners.onRelease=ge(w=this.onRelease).call(w,this),this.body.eventListeners.onContext=ge(S=this.onContext).call(S,this),this.touchTime=0,this.drag={},this.pinch={},this.popup=void 0,this.popupObj=void 0,this.popupTimer=void 0,this.body.functions.getPointer=ge(x=this.getPointer).call(x,this),this.options={},this.defaultOptions={dragNodes:!0,dragView:!0,hover:!1,keyboard:{enabled:!1,speed:{x:10,y:10,zoom:.02},bindToWindow:!0,autoFocus:!0},navigationButtons:!1,tooltipDelay:300,zoomView:!0,zoomSpeed:1},Ft(this.options,this.defaultOptions),this.bindEventListeners()}bindEventListeners(){this.body.emitter.on("destroy",()=>{clearTimeout(this.popupTimer),delete this.body.functions.getPointer})}setOptions(e){e!==void 0&&(PC(["hideEdgesOnDrag","hideEdgesOnZoom","hideNodesOnDrag","keyboard","multiselect","selectable","selectConnectedEdges"],this.options,e),ii(this.options,e,"keyboard"),e.tooltip&&(Ft(this.options.tooltip,e.tooltip),e.tooltip.color&&(this.options.tooltip.color=Wd(e.tooltip.color)))),this.navigationHandler.setOptions(this.options)}getPointer(e){return{x:e.x-PV(this.canvas.frame.canvas),y:e.y-LV(this.canvas.frame.canvas)}}onTouch(e){new Date().valueOf()-this.touchTime>50&&(this.drag.pointer=this.getPointer(e.center),this.drag.pinched=!1,this.pinch.scale=this.body.view.scale,this.touchTime=new Date().valueOf())}onTap(e){const t=this.getPointer(e.center),i=this.selectionHandler.options.multiselect&&(e.changedPointers[0].ctrlKey||e.changedPointers[0].metaKey);this.checkSelectionChanges(t,i),this.selectionHandler.commitAndEmit(t,e),this.selectionHandler.generateClickEvent("click",e,t)}onDoubleTap(e){const t=this.getPointer(e.center);this.selectionHandler.generateClickEvent("doubleClick",e,t)}onHold(e){const t=this.getPointer(e.center),i=this.selectionHandler.options.multiselect;this.checkSelectionChanges(t,i),this.selectionHandler.commitAndEmit(t,e),this.selectionHandler.generateClickEvent("click",e,t),this.selectionHandler.generateClickEvent("hold",e,t)}onRelease(e){if(new Date().valueOf()-this.touchTime>10){const t=this.getPointer(e.center);this.selectionHandler.generateClickEvent("release",e,t),this.touchTime=new Date().valueOf()}}onContext(e){const t=this.getPointer({x:e.clientX,y:e.clientY});this.selectionHandler.generateClickEvent("oncontext",e,t)}checkSelectionChanges(e){(arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1)===!0?this.selectionHandler.selectAdditionalOnPoint(e):this.selectionHandler.selectOnPoint(e)}_determineDifference(e,t){const i=function(o,r){const A=[];for(let I=0;I{const I=A.node;A.xFixed===!1&&(I.x=this.canvas._XconvertDOMtoCanvas(this.canvas._XconvertCanvasToDOM(A.x)+o)),A.yFixed===!1&&(I.y=this.canvas._YconvertDOMtoCanvas(this.canvas._YconvertCanvasToDOM(A.y)+r))}),this.body.emitter.emit("startSimulation")}else{if(e.srcEvent.shiftKey){if(this.selectionHandler.generateClickEvent("dragging",e,t,void 0,!0),this.drag.pointer===void 0){this.onDragStart(e);return}this.body.selectionBox.position.end={x:this.canvas._XconvertDOMtoCanvas(t.x),y:this.canvas._YconvertDOMtoCanvas(t.y)},this.body.emitter.emit("_requestRedraw")}if(this.options.dragView===!0&&!e.srcEvent.shiftKey){if(this.selectionHandler.generateClickEvent("dragging",e,t,void 0,!0),this.drag.pointer===void 0){this.onDragStart(e);return}const o=t.x-this.drag.pointer.x,r=t.y-this.drag.pointer.y;this.body.view.translation={x:this.drag.translation.x+o,y:this.drag.translation.y+r},this.body.emitter.emit("_requestRedraw")}}}onDragEnd(e){if(this.drag.dragging=!1,this.body.selectionBox.show){var t;this.body.selectionBox.show=!1;const i=this.body.selectionBox.position,o={minX:Math.min(i.start.x,i.end.x),minY:Math.min(i.start.y,i.end.y),maxX:Math.max(i.start.x,i.end.x),maxY:Math.max(i.start.y,i.end.y)},r=Qt(t=this.body.nodeIndices).call(t,I=>{const l=this.body.nodes[I];return l.x>=o.minX&&l.x<=o.maxX&&l.y>=o.minY&&l.y<=o.maxY});et(r).call(r,I=>this.selectionHandler.selectObject(this.body.nodes[I]));const A=this.getPointer(e.center);this.selectionHandler.commitAndEmit(A,e),this.selectionHandler.generateClickEvent("dragEnd",e,this.getPointer(e.center),void 0,!0),this.body.emitter.emit("_requestRedraw")}else{const i=this.drag.selection;i&&i.length?(et(i).call(i,function(o){o.node.options.fixed.x=o.xFixed,o.node.options.fixed.y=o.yFixed}),this.selectionHandler.generateClickEvent("dragEnd",e,this.getPointer(e.center)),this.body.emitter.emit("startSimulation")):(this.selectionHandler.generateClickEvent("dragEnd",e,this.getPointer(e.center),void 0,!0),this.body.emitter.emit("_requestRedraw"))}}onPinch(e){const t=this.getPointer(e.center);this.drag.pinched=!0,this.pinch.scale===void 0&&(this.pinch.scale=1);const i=this.pinch.scale*e.scale;this.zoom(i,t)}zoom(e,t){if(this.options.zoomView===!0){const i=this.body.view.scale;e<1e-5&&(e=1e-5),e>10&&(e=10);let o;this.drag!==void 0&&this.drag.dragging===!0&&(o=this.canvas.DOMtoCanvas(this.drag.pointer));const r=this.body.view.translation,A=e/i,I=(1-A)*t.x+r.x*A,l=(1-A)*t.y+r.y*A;if(this.body.view.scale=e,this.body.view.translation={x:I,y:l},o!=null){const c=this.canvas.canvasToDOM(o);this.drag.pointer.x=c.x,this.drag.pointer.y=c.y}this.body.emitter.emit("_requestRedraw"),ithis._checkShowPopup(t),this.options.tooltipDelay))),this.options.hover===!0&&this.selectionHandler.hoverObject(e,t)}_checkShowPopup(e){const t=this.canvas._XconvertDOMtoCanvas(e.x),i=this.canvas._YconvertDOMtoCanvas(e.y),o={left:t,top:i,right:t,bottom:i},r=this.popupObj===void 0?void 0:this.popupObj.id;let A=!1,I="node";if(this.popupObj===void 0){const l=this.body.nodeIndices,c=this.body.nodes;let h;const p=[];for(let m=0;m0&&(this.popupObj=c[p[p.length-1]],A=!0)}if(this.popupObj===void 0&&A===!1){const l=this.body.edgeIndices,c=this.body.edges;let h;const p=[];for(let m=0;m0&&(this.popupObj=c[p[p.length-1]],I="edge")}this.popupObj!==void 0?this.popupObj.id!==r&&(this.popup===void 0&&(this.popup=new $V(this.canvas.frame)),this.popup.popupTargetType=I,this.popup.popupTargetId=this.popupObj.id,this.popup.setPosition(e.x+3,e.y-5),this.popup.setText(this.popupObj.getTitle()),this.popup.show(),this.body.emitter.emit("showPopup",this.popupObj.id)):this.popup!==void 0&&(this.popup.hide(),this.body.emitter.emit("hidePopup"))}_checkHidePopup(e){const t=this.selectionHandler._pointerToPositionObject(e);let i=!1;if(this.popup.popupTargetType==="node"){if(this.body.nodes[this.popup.popupTargetId]!==void 0&&(i=this.body.nodes[this.popup.popupTargetId].isOverlappingWith(t),i===!0)){const o=this.selectionHandler.getNodeAt(e);i=o===void 0?!1:o.id===this.popup.popupTargetId}}else this.selectionHandler.getNodeAt(e)===void 0&&this.body.edges[this.popup.popupTargetId]!==void 0&&(i=this.body.edges[this.popup.popupTargetId].isOverlappingWith(t));i===!1&&(this.popupObj=void 0,this.popup.hide(),this.body.emitter.emit("hidePopup"))}}var S$=st,lx=su,tI=VC.getWeakData,E$=gu,T$=Ki,O$=As,Ou=yn,N$=iu,cx=Sg,dx=gn,ux=vo,D$=ux.set,M$=ux.getterFor,z$=cx.find,k$=cx.findIndex,R$=S$([].splice),_$=0,nI=function(n){return n.frozen||(n.frozen=new hx)},hx=function(){this.entries=[]},Nu=function(n,e){return z$(n.entries,function(t){return t[0]===e})};hx.prototype={get:function(n){var e=Nu(this,n);if(e)return e[1]},has:function(n){return!!Nu(this,n)},set:function(n,e){var t=Nu(this,n);t?t[1]=e:this.entries.push([n,e])},delete:function(n){var e=k$(this.entries,function(t){return t[0]===n});return~e&&R$(this.entries,e,1),!!~e}};var j$={getConstructor:function(n,e,t,i){var o=n(function(l,c){E$(l,r),D$(l,{type:e,id:_$++,frozen:void 0}),O$(c)||N$(c,l[i],{that:l,AS_ENTRIES:t})}),r=o.prototype,A=M$(e),I=function(l,c,h){var p=A(l),m=tI(T$(c),!0);return m===!0?nI(p).set(c,h):m[p.id]=h,l};return lx(r,{delete:function(l){var c=A(this);if(!Ou(l))return!1;var h=tI(l);return h===!0?nI(c).delete(l):h&&dx(h,c.id)&&delete h[c.id]},has:function(c){var h=A(this);if(!Ou(c))return!1;var p=tI(c);return p===!0?nI(h).has(c):p&&dx(p,h.id)}}),lx(r,t?{get:function(c){var h=A(this);if(Ou(c)){var p=tI(c);return p===!0?nI(h).get(c):p?p[h.id]:void 0}},set:function(c,h){return I(this,c,h)}}:{add:function(c){return I(this,c,!0)}}),o}},Z$=k1,fx=_t,iI=st,px=su,B$=VC,P$=ou,mx=j$,gI=yn,oI=vo.enforce,L$=ot,G$=Hy,Ra=Object,F$=Array.isArray,sI=Ra.isExtensible,vx=Ra.isFrozen,V$=Ra.isSealed,yx=Ra.freeze,U$=Ra.seal,bx={},wx={},Y$=!fx.ActiveXObject&&"ActiveXObject"in fx,_a,xx=function(n){return function(){return n(this,arguments.length?arguments[0]:void 0)}},Sx=P$("WeakMap",xx,mx),Ls=Sx.prototype,rI=iI(Ls.set),H$=function(){return Z$&&L$(function(){var n=yx([]);return rI(new Sx,n,1),!vx(n)})};if(G$)if(Y$){_a=mx.getConstructor(xx,"WeakMap",!0),B$.enable();var Ex=iI(Ls.delete),aI=iI(Ls.has),Tx=iI(Ls.get);px(Ls,{delete:function(n){if(gI(n)&&!sI(n)){var e=oI(this);return e.frozen||(e.frozen=new _a),Ex(this,n)||e.frozen.delete(n)}return Ex(this,n)},has:function(e){if(gI(e)&&!sI(e)){var t=oI(this);return t.frozen||(t.frozen=new _a),aI(this,e)||t.frozen.has(e)}return aI(this,e)},get:function(e){if(gI(e)&&!sI(e)){var t=oI(this);return t.frozen||(t.frozen=new _a),aI(this,e)?Tx(this,e):t.frozen.get(e)}return Tx(this,e)},set:function(e,t){if(gI(e)&&!sI(e)){var i=oI(this);i.frozen||(i.frozen=new _a),aI(this,e)?rI(this,e,t):i.frozen.set(e,t)}else rI(this,e,t);return this}})}else H$()&&px(Ls,{set:function(e,t){var i;return F$(e)&&(vx(e)?i=bx:V$(e)&&(i=wx)),rI(this,e,t),i===bx&&yx(e),i===wx&&U$(e),this}});var K$=at,W$=K$.WeakMap,Q$=W$,X$=Q$,$$=X$,ja=Ee($$);function bt(n,e,t,i){if(typeof e=="function"?n!==e||!i:!e.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(n):i?i.value:e.get(n)}function Du(n,e,t,i,o){if(typeof e=="function"?n!==e||!0:!e.has(n))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(n,t),t}typeof SuppressedError=="function"&&SuppressedError;var jo,gi,Bg,Pg,AI;function Ox(n,e){const t=new wi;for(const i of e)n.has(i)||t.add(i);return t}class Nx{constructor(){jo.set(this,new wi),gi.set(this,new wi)}get size(){return bt(this,gi,"f").size}add(){for(var e=arguments.length,t=new Array(e),i=0;i0&&arguments[0]!==void 0?arguments[0]:()=>{};Bg.set(this,new Nx),Pg.set(this,new Nx),AI.set(this,void 0),Du(this,AI,e)}get sizeNodes(){return bt(this,Bg,"f").size}get sizeEdges(){return bt(this,Pg,"f").size}getNodes(){return bt(this,Bg,"f").getSelection()}getEdges(){return bt(this,Pg,"f").getSelection()}addNodes(){bt(this,Bg,"f").add(...arguments)}addEdges(){bt(this,Pg,"f").add(...arguments)}deleteNodes(e){bt(this,Bg,"f").delete(e)}deleteEdges(e){bt(this,Pg,"f").delete(e)}clear(){bt(this,Bg,"f").clear(),bt(this,Pg,"f").clear()}commit(){const e={nodes:bt(this,Bg,"f").commit(),edges:bt(this,Pg,"f").commit()};for(var t=arguments.length,i=new Array(t),o=0;o{this.updateSelection()})}setOptions(e){e!==void 0&&Ms(["multiselect","hoverConnectedEdges","selectable","selectConnectedEdges"],this.options,e)}selectOnPoint(e){let t=!1;if(this.options.selectable===!0){const i=this.getNodeAt(e)||this.getEdgeAt(e);this.unselectAll(),i!==void 0&&(t=this.selectObject(i)),this.body.emitter.emit("_requestRedraw")}return t}selectAdditionalOnPoint(e){let t=!1;if(this.options.selectable===!0){const i=this.getNodeAt(e)||this.getEdgeAt(e);i!==void 0&&(t=!0,i.isSelected()===!0?this.deselectObject(i):this.selectObject(i),this.body.emitter.emit("_requestRedraw"))}return t}_initBaseEvent(e,t){const i={};return i.pointer={DOM:{x:t.x,y:t.y},canvas:this.canvas.DOMtoCanvas(t)},i.event=e,i}generateClickEvent(e,t,i,o){let r=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1;const A=this._initBaseEvent(t,i);if(r===!0)A.nodes=[],A.edges=[];else{const I=this.getSelection();A.nodes=I.nodes,A.edges=I.edges}o!==void 0&&(A.previousSelection=o),e=="click"&&(A.items=this.getClickedItems(i)),t.controlEdge!==void 0&&(A.controlEdge=t.controlEdge),this.body.emitter.emit(e,A)}selectObject(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.options.selectConnectedEdges;return e!==void 0?(e instanceof Nt?(t===!0&&this._selectionAccumulator.addEdges(...e.edges),this._selectionAccumulator.addNodes(e)):this._selectionAccumulator.addEdges(e),!0):!1}deselectObject(e){e.isSelected()===!0&&(e.selected=!1,this._removeFromSelection(e))}_getAllNodesOverlappingWith(e){const t=[],i=this.body.nodes;for(let o=0;o1&&arguments[1]!==void 0?arguments[1]:!0;const i=this._pointerToPositionObject(e),o=this._getAllNodesOverlappingWith(i);if(o.length>0)return t===!0?this.body.nodes[o[o.length-1]]:o[o.length-1]}_getEdgesOverlappingWith(e,t){const i=this.body.edges;for(let o=0;o1&&arguments[1]!==void 0?arguments[1]:!0;const i=this.canvas.DOMtoCanvas(e);let o=10,r=null;const A=this.body.edges;for(let I=0;I0&&(this.generateClickEvent("deselectEdge",t,e,r),i=!0),o.nodes.deleted.length>0&&(this.generateClickEvent("deselectNode",t,e,r),i=!0),o.nodes.added.length>0&&(this.generateClickEvent("selectNode",t,e),i=!0),o.edges.added.length>0&&(this.generateClickEvent("selectEdge",t,e),i=!0),i===!0&&this.generateClickEvent("select",t,e)}getSelection(){return{nodes:this.getSelectedNodeIds(),edges:this.getSelectedEdgeIds()}}getSelectedNodes(){return this._selectionAccumulator.getNodes()}getSelectedEdges(){return this._selectionAccumulator.getEdges()}getSelectedNodeIds(){var e;return ln(e=this._selectionAccumulator.getNodes()).call(e,t=>t.id)}getSelectedEdgeIds(){var e;return ln(e=this._selectionAccumulator.getEdges()).call(e,t=>t.id)}setSelection(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!e||!e.nodes&&!e.edges)throw new TypeError("Selection must be an object with nodes and/or edges properties");if((t.unselectAll||t.unselectAll===void 0)&&this.unselectAll(),e.nodes)for(const i of e.nodes){const o=this.body.nodes[i];if(!o)throw new RangeError('Node with id "'+i+'" not found');this.selectObject(o,t.highlightEdges)}if(e.edges)for(const i of e.edges){const o=this.body.edges[i];if(!o)throw new RangeError('Edge with id "'+i+'" not found');this.selectObject(o)}this.body.emitter.emit("_requestRedraw"),this._selectionAccumulator.commit()}selectNodes(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(!e||e.length===void 0)throw"Selection must be an array with ids";this.setSelection({nodes:e},{highlightEdges:t})}selectEdges(e){if(!e||e.length===void 0)throw"Selection must be an array with ids";this.setSelection({edges:e})}updateSelection(){for(const e in this._selectionAccumulator.getNodes())Object.prototype.hasOwnProperty.call(this.body.nodes,e.id)||this._selectionAccumulator.deleteNodes(e);for(const e in this._selectionAccumulator.getEdges())Object.prototype.hasOwnProperty.call(this.body.edges,e.id)||this._selectionAccumulator.deleteEdges(e)}getClickedItems(e){const t=this.canvas.DOMtoCanvas(e),i=[],o=this.body.nodeIndices,r=this.body.nodes;for(let l=o.length-1;l>=0;l--){const h=r[o[l]].getItemsOnPoint(t);i.push.apply(i,h)}const A=this.body.edgeIndices,I=this.body.edges;for(let l=A.length-1;l>=0;l--){const h=I[A[l]].getItemsOnPoint(t);i.push.apply(i,h)}return i}}class Dx{abstract(){throw new Error("Can't instantiate abstract class!")}fake_use(){}curveType(){return this.abstract()}getPosition(e){return this.fake_use(e),this.abstract()}setPosition(e,t){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;this.fake_use(e,t,i),this.abstract()}getTreeSize(e){return this.fake_use(e),this.abstract()}sort(e){this.fake_use(e),this.abstract()}fix(e,t){this.fake_use(e,t),this.abstract()}shift(e,t){this.fake_use(e,t),this.abstract()}}class eq extends Dx{constructor(e){super(),this.layout=e}curveType(){return"horizontal"}getPosition(e){return e.x}setPosition(e,t){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;i!==void 0&&this.layout.hierarchical.addToOrdering(e,i),e.x=t}getTreeSize(e){const t=this.layout.hierarchical.getTreeSize(this.layout.body.nodes,e);return{min:t.min_x,max:t.max_x}}sort(e){tg(e).call(e,function(t,i){return t.x-i.x})}fix(e,t){e.y=this.layout.options.hierarchical.levelSeparation*t,e.options.fixed.y=!0}shift(e,t){this.layout.body.nodes[e].x+=t}}class tq extends Dx{constructor(e){super(),this.layout=e}curveType(){return"vertical"}getPosition(e){return e.y}setPosition(e,t){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;i!==void 0&&this.layout.hierarchical.addToOrdering(e,i),e.y=t}getTreeSize(e){const t=this.layout.hierarchical.getTreeSize(this.layout.body.nodes,e);return{min:t.min_y,max:t.max_y}}sort(e){tg(e).call(e,function(t,i){return t.y-i.y})}fix(e,t){e.x=this.layout.options.hierarchical.levelSeparation*t,e.options.fixed.x=!0}shift(e,t){this.layout.body.nodes[e].y+=t}}var nq=Me,iq=Sg.every,gq=bs,oq=gq("every");nq({target:"Array",proto:!0,forced:!oq},{every:function(e){return iq(this,e,arguments.length>1?arguments[1]:void 0)}});var sq=Wt,rq=sq("Array").every,aq=jt,Aq=rq,Mu=Array.prototype,Cq=function(n){var e=n.every;return n===Mu||aq(Mu,n)&&e===Mu.every?Aq:e},Iq=Cq,lq=Iq,cq=lq,Mx=Ee(cq);function dq(n,e){const t=new wi;return et(n).call(n,i=>{var o;et(o=i.edges).call(o,r=>{r.connected&&t.add(r)})}),et(t).call(t,i=>{const o=i.from.id,r=i.to.id;e[o]==null&&(e[o]=0),(e[r]==null||e[o]>=e[r])&&(e[r]=e[o]+1)}),e}function uq(n){return zx(e=>{var t,i;return Mx(t=Qt(i=e.edges).call(i,o=>n.has(o.toId))).call(t,o=>o.to===e)},(e,t)=>t>e,"from",n)}function hq(n){return zx(e=>{var t,i;return Mx(t=Qt(i=e.edges).call(i,o=>n.has(o.toId))).call(t,o=>o.from===e)},(e,t)=>tp+1+m.edges.length,0),I=t+"Id",l=t==="to"?1:-1;for(const[p,m]of i){if(!i.has(p)||!n(m))continue;r[p]=0;const y=[m];let w=0,S;for(;S=y.pop();){var c,h;if(!i.has(p))continue;const x=r[S.id]+l;if(et(c=Qt(h=S.edges).call(h,O=>O.connected&&O.to!==O.from&&O[t]!==S&&i.has(O.toId)&&i.has(O.fromId))).call(c,O=>{const E=O[I],_=r[E];(_==null||e(x,_))&&(r[E]=x,y.push(O[t]))}),w>A)return dq(i,r);++w}}return r}class fq{constructor(){this.childrenReference={},this.parentReference={},this.trees={},this.distributionOrdering={},this.levels={},this.distributionIndex={},this.isTree=!1,this.treeIndex=-1}addRelation(e,t){this.childrenReference[e]===void 0&&(this.childrenReference[e]=[]),this.childrenReference[e].push(t),this.parentReference[t]===void 0&&(this.parentReference[t]=[]),this.parentReference[t].push(e)}checkIfTree(){for(const e in this.parentReference)if(this.parentReference[e].length>1){this.isTree=!1;return}this.isTree=!0}numTrees(){return this.treeIndex+1}setTreeIndex(e,t){t!==void 0&&this.trees[e.id]===void 0&&(this.trees[e.id]=t,this.treeIndex=Math.max(t,this.treeIndex))}ensureLevel(e){this.levels[e]===void 0&&(this.levels[e]=0)}getMaxLevel(e){const t={},i=o=>{if(t[o]!==void 0)return t[o];let r=this.levels[o];if(this.childrenReference[o]){const A=this.childrenReference[o];if(A.length>0)for(let I=0;Ir-A);for(const r of o)t.set(r,i++);for(const r in this.levels)Object.prototype.hasOwnProperty.call(this.levels,r)&&(this.levels[r]=t.get(this.levels[r]))}getTreeSize(e,t){let i=1e9,o=-1e9,r=1e9,A=-1e9;for(const I in this.trees)if(Object.prototype.hasOwnProperty.call(this.trees,I)&&this.trees[I]===t){const l=e[I];i=Math.min(l.x,i),o=Math.max(l.x,o),r=Math.min(l.y,r),A=Math.max(l.y,A)}return{min_x:i,max_x:o,min_y:r,max_y:A}}hasSameParent(e,t){const i=this.parentReference[e.id],o=this.parentReference[t.id];if(i===void 0||o===void 0)return!1;for(let r=0;r{this.setupHierarchicalLayout()}),this.body.emitter.on("_dataLoaded",()=>{this.layoutNetwork()}),this.body.emitter.on("_resetHierarchicalLayout",()=>{this.setupHierarchicalLayout()}),this.body.emitter.on("_adjustEdgesForHierarchicalLayout",()=>{if(this.options.hierarchical.enabled!==!0)return;const e=this.direction.curveType();this.body.emitter.emit("_forceDisableDynamicCurves",e,!1)})}setOptions(e,t){if(e!==void 0){const i=this.options.hierarchical,o=i.enabled;if(Ms(["randomSeed","improvedLayout","clusterThreshold"],this.options,e),ii(this.options,e,"hierarchical"),e.randomSeed!==void 0&&this._resetRNG(e.randomSeed),i.enabled===!0)return o===!0&&this.body.emitter.emit("refresh",!0),i.direction==="RL"||i.direction==="DU"?i.levelSeparation>0&&(i.levelSeparation*=-1):i.levelSeparation<0&&(i.levelSeparation*=-1),this.setDirectionStrategy(),this.body.emitter.emit("_resetHierarchicalLayout"),this.adaptAllOptionsForHierarchicalLayout(t);if(o===!0)return this.body.emitter.emit("refresh"),vt(t,this.optionsBackup)}return t}_resetRNG(e){this.initialRandomSeed=e,this._rng=BC(this.initialRandomSeed)}adaptAllOptionsForHierarchicalLayout(e){if(this.options.hierarchical.enabled===!0){const t=this.optionsBackup.physics;e.physics===void 0||e.physics===!0?(e.physics={enabled:t.enabled===void 0?!0:t.enabled,solver:"hierarchicalRepulsion"},t.enabled=t.enabled===void 0?!0:t.enabled,t.solver=t.solver||"barnesHut"):typeof e.physics=="object"?(t.enabled=e.physics.enabled===void 0?!0:e.physics.enabled,t.solver=e.physics.solver||"barnesHut",e.physics.solver="hierarchicalRepulsion"):e.physics!==!1&&(t.solver="barnesHut",e.physics={solver:"hierarchicalRepulsion"});let i=this.direction.curveType();if(e.edges===void 0)this.optionsBackup.edges={smooth:{enabled:!0,type:"dynamic"}},e.edges={smooth:!1};else if(e.edges.smooth===void 0)this.optionsBackup.edges={smooth:{enabled:!0,type:"dynamic"}},e.edges.smooth=!1;else if(typeof e.edges.smooth=="boolean")this.optionsBackup.edges={smooth:e.edges.smooth},e.edges.smooth={enabled:e.edges.smooth,type:i};else{const o=e.edges.smooth;o.type!==void 0&&o.type!=="dynamic"&&(i=o.type),this.optionsBackup.edges={smooth:{enabled:o.enabled===void 0?!0:o.enabled,type:o.type===void 0?"dynamic":o.type,roundness:o.roundness===void 0?.5:o.roundness,forceDirection:o.forceDirection===void 0?!1:o.forceDirection}},e.edges.smooth={enabled:o.enabled===void 0?!0:o.enabled,type:i,roundness:o.roundness===void 0?.5:o.roundness,forceDirection:o.forceDirection===void 0?!1:o.forceDirection}}this.body.emitter.emit("_forceDisableDynamicCurves",i)}return e}positionInitially(e){if(this.options.hierarchical.enabled!==!0){this._resetRNG(this.initialRandomSeed);const t=e.length+50;for(let i=0;ir){const l=e.length;for(;e.length>r&&o<=10;){o+=1;const c=e.length;o%3===0?this.body.modules.clustering.clusterBridges(A):this.body.modules.clustering.clusterOutliers(A);const h=e.length;if(c==h&&o%3!==0){this._declusterAll(),this.body.emitter.emit("_layoutFailed"),console.info("This network could not be positioned by this version of the improved layout algorithm. Please disable improvedLayout for better performance.");return}}this.body.modules.kamadaKawai.setOptions({springLength:Math.max(150,2*l)})}o>10&&console.info("The clustering didn't succeed within the amount of interations allowed, progressing with partial result."),this.body.modules.kamadaKawai.solve(e,this.body.edgeIndices,!0),this._shiftToCenter();const I=70;for(let l=0;l0){let e,t,i=!1,o=!1;this.lastNodeOnLevel={},this.hierarchical=new fq;for(t in this.body.nodes)Object.prototype.hasOwnProperty.call(this.body.nodes,t)&&(e=this.body.nodes[t],e.options.level!==void 0?(i=!0,this.hierarchical.levels[t]=e.options.level):o=!0);if(o===!0&&i===!0)throw new Error("To use the hierarchical layout, nodes require either no predefined levels or levels have to be defined for all nodes.");{if(o===!0){const A=this.options.hierarchical.sortMethod;A==="hubsize"?this._determineLevelsByHubsize():A==="directed"?this._determineLevelsDirected():A==="custom"&&this._determineLevelsCustomCallback()}for(const A in this.body.nodes)Object.prototype.hasOwnProperty.call(this.body.nodes,A)&&this.hierarchical.ensureLevel(A);const r=this._getDistribution();this._generateMap(),this._placeNodesByHierarchy(r),this._condenseHierarchy(),this._shiftToCenter()}}}_condenseHierarchy(){var e=this;let t=!1;const i={},o=()=>{const O=A();let E=0;for(let _=0;_{const _=this.hierarchical.trees;for(const P in _)Object.prototype.hasOwnProperty.call(_,P)&&_[P]===O&&this.direction.shift(P,E)},A=()=>{const O=[];for(let E=0;E{if(!E[O.id]&&(E[O.id]=!0,this.hierarchical.childrenReference[O.id])){const _=this.hierarchical.childrenReference[O.id];if(_.length>0)for(let P=0;P<_.length;P++)I(this.body.nodes[_[P]],E)}},l=function(O){let E=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1e9,_=1e9,P=1e9,Q=1e9,ne=-1e9;for(const F in O)if(Object.prototype.hasOwnProperty.call(O,F)){const Z=e.body.nodes[F],de=e.hierarchical.levels[Z.id],fe=e.direction.getPosition(Z),[ke,Ne]=e._getSpaceAroundNode(Z,O);_=Math.min(ke,_),P=Math.min(Ne,P),de<=E&&(Q=Math.min(fe,Q),ne=Math.max(fe,ne))}return[Q,ne,_,P]},c=(O,E)=>{const _=this.hierarchical.getMaxLevel(O.id),P=this.hierarchical.getMaxLevel(E.id);return Math.min(_,P)},h=(O,E,_)=>{const P=this.hierarchical;for(let Q=0;Q1)for(let Z=0;Z2&&arguments[2]!==void 0?arguments[2]:!1;const P=e.direction.getPosition(O),Q=e.direction.getPosition(E),ne=Math.abs(Q-P),F=e.options.hierarchical.nodeSpacing;if(ne>F){const Z={},de={};I(O,Z),I(E,de);const fe=c(O,E),ke=l(Z,fe),Ne=l(de,fe),je=ke[1],qe=Ne[0],Ae=Ne[2];if(Math.abs(je-qe)>F){let W=je-qe+F;W<-Ae+F&&(W=-Ae+F),W<0&&(e._shiftBlock(E.id,W),t=!0,_===!0&&e._centerParent(E))}}},m=(O,E)=>{const _=E.id,P=E.edges,Q=this.hierarchical.levels[E.id],ne=this.options.hierarchical.levelSeparation*this.options.hierarchical.levelSeparation,F={},Z=[];for(let Ae=0;Ae{let W=0;for(let V=0;V{let W=0;for(let V=0;V{let W=this.direction.getPosition(E);const V={};for(let se=0;se{const M=this.direction.getPosition(E);if(i[E.id]===void 0){const U={};I(E,U),i[E.id]=U}const W=l(i[E.id]),V=W[2],se=W[3],ee=Ae-M;let T=0;ee>0?T=Math.min(ee,se-this.options.hierarchical.nodeSpacing):ee<0&&(T=-Math.min(-ee,V-this.options.hierarchical.nodeSpacing)),T!=0&&(this._shiftBlock(E.id,T),t=!0)},je=Ae=>{const M=this.direction.getPosition(E),[W,V]=this._getSpaceAroundNode(E),se=Ae-M;let ee=M;se>0?ee=Math.min(M+(V-this.options.hierarchical.nodeSpacing),Ae):se<0&&(ee=Math.max(M-(W-this.options.hierarchical.nodeSpacing),Ae)),ee!==M&&(this.direction.setPosition(E,ee),t=!0)};let qe=ke(O,Z);Ne(qe),qe=ke(O,P),je(qe)},y=O=>{let E=this.hierarchical.getLevels();E=xo(E).call(E);for(let _=0;_{let E=this.hierarchical.getLevels();E=xo(E).call(E);for(let _=0;_{for(const O in this.body.nodes)Object.prototype.hasOwnProperty.call(this.body.nodes,O)&&this._centerParent(this.body.nodes[O])},x=()=>{let O=this.hierarchical.getLevels();O=xo(O).call(O);for(let E=0;E0&&Math.abs(p)0&&(c=this.direction.getPosition(o[A-1])+l),this.direction.setPosition(I,c,i),this._validatePositionAndContinue(I,i,c),r++}}}}_placeBranchNodes(e,t){var i;const o=this.hierarchical.childrenReference[e];if(o===void 0)return;const r=[];for(let I=0;It&&this.positionedNodes[l.id]===void 0){const h=this.options.hierarchical.nodeSpacing;let p;I===0?p=this.direction.getPosition(this.body.nodes[e]):p=this.direction.getPosition(r[I-1])+h,this.direction.setPosition(l,p,c),this._validatePositionAndContinue(l,c,p)}else return}const A=this._getCenterPosition(r);this.direction.setPosition(this.body.nodes[e],A,t)}_validatePositionAndContinue(e,t,i){if(this.hierarchical.isTree){if(this.lastNodeOnLevel[t]!==void 0){const o=this.direction.getPosition(this.body.nodes[this.lastNodeOnLevel[t]]);if(i-o{var o;Ct(o=this.body.edgeIndices).call(o,i.id)!==-1&&t.push(i)}),t}_getHubSizes(){const e={},t=this.body.nodeIndices;Ye(t,o=>{const r=this.body.nodes[o],A=this._getActiveEdges(r).length;e[A]=!0});const i=[];return Ye(e,o=>{i.push(Number(o))}),tg(i).call(i,function(o,r){return r-o}),i}_determineLevelsByHubsize(){const e=(i,o)=>{this.hierarchical.levelDownstream(i,o)},t=this._getHubSizes();for(let i=0;i{const A=this.body.nodes[r];o===this._getActiveEdges(A).length&&this._crawlNetwork(e,r)})}}_determineLevelsCustomCallback(){const t=function(o,r,A){},i=(o,r,A)=>{let I=this.hierarchical.levels[o.id];I===void 0&&(I=this.hierarchical.levels[o.id]=1e5);const l=t(En.cloneOptions(o,"node"),En.cloneOptions(r,"node"),En.cloneOptions(A,"edge"));this.hierarchical.levels[r.id]=I+l};this._crawlNetwork(i),this.hierarchical.setMinLevelToZero()}_determineLevelsDirected(){var e;const t=du(e=this.body.nodeIndices).call(e,(i,o)=>(i.set(o,this.body.nodes[o]),i),new Na);this.options.hierarchical.shakeTowards==="roots"?this.hierarchical.levels=hq(t):this.hierarchical.levels=uq(t),this.hierarchical.setMinLevelToZero()}_generateMap(){const e=(t,i)=>{this.hierarchical.levels[i.id]>this.hierarchical.levels[t.id]&&this.hierarchical.addRelation(t.id,i.id)};this._crawlNetwork(e),this.hierarchical.checkIfTree()}_crawlNetwork(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(){},t=arguments.length>1?arguments[1]:void 0;const i={},o=(r,A)=>{if(i[r.id]===void 0){this.hierarchical.setTreeIndex(r,A),i[r.id]=!0;let I;const l=this._getActiveEdges(r);for(let c=0;c{if(i[r])return;i[r]=!0,this.direction.shift(r,t);const A=this.hierarchical.childrenReference[r];if(A!==void 0)for(let I=0;I{const l=this.hierarchical.parentReference[I];if(l!==void 0)for(let c=0;c{const l=this.hierarchical.parentReference[I];if(l!==void 0)for(let c=0;c{this._clean()}),this.body.emitter.on("_dataChanged",ge(r=this._restore).call(r,this)),this.body.emitter.on("_resetData",ge(A=this._restore).call(A,this))}_restore(){this.inMode!==!1&&(this.options.initiallyActive===!0?this.enableEditMode():this.disableEditMode())}setOptions(e,t,i){t!==void 0&&(t.locale!==void 0?this.options.locale=t.locale:this.options.locale=i.locale,t.locales!==void 0?this.options.locales=t.locales:this.options.locales=i.locales),e!==void 0&&(typeof e=="boolean"?this.options.enabled=e:(this.options.enabled=!0,mt(this.options,e)),this.options.initiallyActive===!0&&(this.editMode=!0),this._setup())}toggleEditMode(){this.editMode===!0?this.disableEditMode():this.enableEditMode()}enableEditMode(){this.editMode=!0,this._clean(),this.guiEnabled===!0&&(this.manipulationDiv.style.display="block",this.closeDiv.style.display="block",this.editModeDiv.style.display="none",this.showManipulatorToolbar())}disableEditMode(){this.editMode=!1,this._clean(),this.guiEnabled===!0&&(this.manipulationDiv.style.display="none",this.closeDiv.style.display="none",this.editModeDiv.style.display="block",this._createEditButton())}showManipulatorToolbar(){if(this._clean(),this.manipulationDOM={},this.guiEnabled===!0){var e,t;this.editMode=!0,this.manipulationDiv.style.display="block",this.closeDiv.style.display="block";const i=this.selectionHandler.getSelectedNodeCount(),o=this.selectionHandler.getSelectedEdgeCount(),r=i+o,A=this.options.locales[this.options.locale];let I=!1;this.options.addNode!==!1&&(this._createAddNodeButton(A),I=!0),this.options.addEdge!==!1&&(I===!0?this._createSeperator(1):I=!0,this._createAddEdgeButton(A)),i===1&&typeof this.options.editNode=="function"?(I===!0?this._createSeperator(2):I=!0,this._createEditNodeButton(A)):o===1&&i===0&&this.options.editEdge!==!1&&(I===!0?this._createSeperator(3):I=!0,this._createEditEdgeButton(A)),r!==0&&(i>0&&this.options.deleteNode!==!1?(I===!0&&this._createSeperator(4),this._createDeleteButton(A)):i===0&&this.options.deleteEdge!==!1&&(I===!0&&this._createSeperator(4),this._createDeleteButton(A))),this._bindElementEvents(this.closeDiv,ge(e=this.toggleEditMode).call(e,this)),this._temporaryBindEvent("select",ge(t=this.showManipulatorToolbar).call(t,this))}this.body.emitter.emit("_redraw")}addNodeMode(){var e;if(this.editMode!==!0&&this.enableEditMode(),this._clean(),this.inMode="addNode",this.guiEnabled===!0){var t;const i=this.options.locales[this.options.locale];this.manipulationDOM={},this._createBackButton(i),this._createSeperator(),this._createDescription(i.addDescription||this.options.locales.en.addDescription),this._bindElementEvents(this.closeDiv,ge(t=this.toggleEditMode).call(t,this))}this._temporaryBindEvent("click",ge(e=this._performAddNode).call(e,this))}editNode(){this.editMode!==!0&&this.enableEditMode(),this._clean();const e=this.selectionHandler.getSelectedNodes()[0];if(e!==void 0)if(this.inMode="editNode",typeof this.options.editNode=="function")if(e.isCluster!==!0){const t=mt({},e.options,!1);if(t.x=e.x,t.y=e.y,this.options.editNode.length===2)this.options.editNode(t,i=>{i!=null&&this.inMode==="editNode"&&this.body.data.nodes.getDataSet().update(i),this.showManipulatorToolbar()});else throw new Error("The function for edit does not support two arguments (data, callback)")}else alert(this.options.locales[this.options.locale].editClusterError||this.options.locales.en.editClusterError);else throw new Error("No function has been configured to handle the editing of nodes.");else this.showManipulatorToolbar()}addEdgeMode(){var e,t,i,o,r;if(this.editMode!==!0&&this.enableEditMode(),this._clean(),this.inMode="addEdge",this.guiEnabled===!0){var A;const I=this.options.locales[this.options.locale];this.manipulationDOM={},this._createBackButton(I),this._createSeperator(),this._createDescription(I.edgeDescription||this.options.locales.en.edgeDescription),this._bindElementEvents(this.closeDiv,ge(A=this.toggleEditMode).call(A,this))}this._temporaryBindUI("onTouch",ge(e=this._handleConnect).call(e,this)),this._temporaryBindUI("onDragEnd",ge(t=this._finishConnect).call(t,this)),this._temporaryBindUI("onDrag",ge(i=this._dragControlNode).call(i,this)),this._temporaryBindUI("onRelease",ge(o=this._finishConnect).call(o,this)),this._temporaryBindUI("onDragStart",ge(r=this._dragStartEdge).call(r,this)),this._temporaryBindUI("onHold",()=>{})}editEdgeMode(){if(this.editMode!==!0&&this.enableEditMode(),this._clean(),this.inMode="editEdge",typeof this.options.editEdge=="object"&&typeof this.options.editEdge.editWithoutDrag=="function"&&(this.edgeBeingEditedId=this.selectionHandler.getSelectedEdgeIds()[0],this.edgeBeingEditedId!==void 0)){const A=this.body.edges[this.edgeBeingEditedId];this._performEditEdge(A.from.id,A.to.id);return}if(this.guiEnabled===!0){var e;const A=this.options.locales[this.options.locale];this.manipulationDOM={},this._createBackButton(A),this._createSeperator(),this._createDescription(A.editEdgeDescription||this.options.locales.en.editEdgeDescription),this._bindElementEvents(this.closeDiv,ge(e=this.toggleEditMode).call(e,this))}if(this.edgeBeingEditedId=this.selectionHandler.getSelectedEdgeIds()[0],this.edgeBeingEditedId!==void 0){var t,i,o,r;const A=this.body.edges[this.edgeBeingEditedId],I=this._getNewTargetNode(A.from.x,A.from.y),l=this._getNewTargetNode(A.to.x,A.to.y);this.temporaryIds.nodes.push(I.id),this.temporaryIds.nodes.push(l.id),this.body.nodes[I.id]=I,this.body.nodeIndices.push(I.id),this.body.nodes[l.id]=l,this.body.nodeIndices.push(l.id),this._temporaryBindUI("onTouch",ge(t=this._controlNodeTouch).call(t,this)),this._temporaryBindUI("onTap",()=>{}),this._temporaryBindUI("onHold",()=>{}),this._temporaryBindUI("onDragStart",ge(i=this._controlNodeDragStart).call(i,this)),this._temporaryBindUI("onDrag",ge(o=this._controlNodeDrag).call(o,this)),this._temporaryBindUI("onDragEnd",ge(r=this._controlNodeDragEnd).call(r,this)),this._temporaryBindUI("onMouseMove",()=>{}),this._temporaryBindEvent("beforeDrawing",c=>{const h=A.edgeType.findBorderPositions(c);I.selected===!1&&(I.x=h.from.x,I.y=h.from.y),l.selected===!1&&(l.x=h.to.x,l.y=h.to.y)}),this.body.emitter.emit("_redraw")}else this.showManipulatorToolbar()}deleteSelected(){this.editMode!==!0&&this.enableEditMode(),this._clean(),this.inMode="delete";const e=this.selectionHandler.getSelectedNodeIds(),t=this.selectionHandler.getSelectedEdgeIds();let i;if(e.length>0){for(let o=0;o0&&typeof this.options.deleteEdge=="function"&&(i=this.options.deleteEdge);if(typeof i=="function"){const o={nodes:e,edges:t};if(i.length===2)i(o,r=>{r!=null&&this.inMode==="delete"?(this.body.data.edges.getDataSet().remove(r.edges),this.body.data.nodes.getDataSet().remove(r.nodes),this.body.emitter.emit("startSimulation"),this.showManipulatorToolbar()):(this.body.emitter.emit("startSimulation"),this.showManipulatorToolbar())});else throw new Error("The function for delete does not support two arguments (data, callback)")}else this.body.data.edges.getDataSet().remove(t),this.body.data.nodes.getDataSet().remove(e),this.body.emitter.emit("startSimulation"),this.showManipulatorToolbar()}_setup(){this.options.enabled===!0?(this.guiEnabled=!0,this._createWrappers(),this.editMode===!1?this._createEditButton():this.showManipulatorToolbar()):(this._removeManipulationDOM(),this.guiEnabled=!1)}_createWrappers(){if(this.manipulationDiv===void 0&&(this.manipulationDiv=document.createElement("div"),this.manipulationDiv.className="vis-manipulation",this.editMode===!0?this.manipulationDiv.style.display="block":this.manipulationDiv.style.display="none",this.canvas.frame.appendChild(this.manipulationDiv)),this.editModeDiv===void 0&&(this.editModeDiv=document.createElement("div"),this.editModeDiv.className="vis-edit-mode",this.editMode===!0?this.editModeDiv.style.display="none":this.editModeDiv.style.display="block",this.canvas.frame.appendChild(this.editModeDiv)),this.closeDiv===void 0){var e,t;this.closeDiv=document.createElement("button"),this.closeDiv.className="vis-close",this.closeDiv.setAttribute("aria-label",(e=(t=this.options.locales[this.options.locale])===null||t===void 0?void 0:t.close)!==null&&e!==void 0?e:this.options.locales.en.close),this.closeDiv.style.display=this.manipulationDiv.style.display,this.canvas.frame.appendChild(this.closeDiv)}}_getNewTargetNode(e,t){const i=mt({},this.options.controlNodeStyle);i.id="targetNode"+js(),i.hidden=!1,i.physics=!1,i.x=e,i.y=t;const o=this.body.functions.createNode(i);return o.shape.boundingBox={left:e,right:e,top:t,bottom:t},o}_createEditButton(){var e;this._clean(),this.manipulationDOM={},Ng(this.editModeDiv);const t=this.options.locales[this.options.locale],i=this._createButton("editMode","vis-edit vis-edit-mode",t.edit||this.options.locales.en.edit);this.editModeDiv.appendChild(i),this._bindElementEvents(i,ge(e=this.toggleEditMode).call(e,this))}_clean(){this.inMode=!1,this.guiEnabled===!0&&(Ng(this.editModeDiv),Ng(this.manipulationDiv),this._cleanupDOMEventListeners()),this._cleanupTemporaryNodesAndEdges(),this._unbindTemporaryUIs(),this._unbindTemporaryEvents(),this.body.emitter.emit("restorePhysics")}_cleanupDOMEventListeners(){for(const t of Di(e=this._domEventListenerCleanupQueue).call(e,0)){var e;t()}}_removeManipulationDOM(){this._clean(),Ng(this.manipulationDiv),Ng(this.editModeDiv),Ng(this.closeDiv),this.manipulationDiv&&this.canvas.frame.removeChild(this.manipulationDiv),this.editModeDiv&&this.canvas.frame.removeChild(this.editModeDiv),this.closeDiv&&this.canvas.frame.removeChild(this.closeDiv),this.manipulationDiv=void 0,this.editModeDiv=void 0,this.closeDiv=void 0}_createSeperator(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1;this.manipulationDOM["seperatorLineDiv"+e]=document.createElement("div"),this.manipulationDOM["seperatorLineDiv"+e].className="vis-separator-line",this.manipulationDiv.appendChild(this.manipulationDOM["seperatorLineDiv"+e])}_createAddNodeButton(e){var t;const i=this._createButton("addNode","vis-add",e.addNode||this.options.locales.en.addNode);this.manipulationDiv.appendChild(i),this._bindElementEvents(i,ge(t=this.addNodeMode).call(t,this))}_createAddEdgeButton(e){var t;const i=this._createButton("addEdge","vis-connect",e.addEdge||this.options.locales.en.addEdge);this.manipulationDiv.appendChild(i),this._bindElementEvents(i,ge(t=this.addEdgeMode).call(t,this))}_createEditNodeButton(e){var t;const i=this._createButton("editNode","vis-edit",e.editNode||this.options.locales.en.editNode);this.manipulationDiv.appendChild(i),this._bindElementEvents(i,ge(t=this.editNode).call(t,this))}_createEditEdgeButton(e){var t;const i=this._createButton("editEdge","vis-edit",e.editEdge||this.options.locales.en.editEdge);this.manipulationDiv.appendChild(i),this._bindElementEvents(i,ge(t=this.editEdgeMode).call(t,this))}_createDeleteButton(e){var t;let i;this.options.rtl?i="vis-delete-rtl":i="vis-delete";const o=this._createButton("delete",i,e.del||this.options.locales.en.del);this.manipulationDiv.appendChild(o),this._bindElementEvents(o,ge(t=this.deleteSelected).call(t,this))}_createBackButton(e){var t;const i=this._createButton("back","vis-back",e.back||this.options.locales.en.back);this.manipulationDiv.appendChild(i),this._bindElementEvents(i,ge(t=this.showManipulatorToolbar).call(t,this))}_createButton(e,t,i){let o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"vis-label";return this.manipulationDOM[e+"Div"]=document.createElement("button"),this.manipulationDOM[e+"Div"].className="vis-button "+t,this.manipulationDOM[e+"Label"]=document.createElement("div"),this.manipulationDOM[e+"Label"].className=o,this.manipulationDOM[e+"Label"].innerText=i,this.manipulationDOM[e+"Div"].appendChild(this.manipulationDOM[e+"Label"]),this.manipulationDOM[e+"Div"]}_createDescription(e){this.manipulationDOM.descriptionLabel=document.createElement("div"),this.manipulationDOM.descriptionLabel.className="vis-none",this.manipulationDOM.descriptionLabel.innerText=e,this.manipulationDiv.appendChild(this.manipulationDOM.descriptionLabel)}_temporaryBindEvent(e,t){this.temporaryEventFunctions.push({event:e,boundFunction:t}),this.body.emitter.on(e,t)}_temporaryBindUI(e,t){if(this.body.eventListeners[e]!==void 0)this.temporaryUIFunctions[e]=this.body.eventListeners[e],this.body.eventListeners[e]=t;else throw new Error("This UI function does not exist. Typo? You tried: "+e+" possible are: "+bs(wt(this.body.eventListeners)))}_unbindTemporaryUIs(){for(const e in this.temporaryUIFunctions)Object.prototype.hasOwnProperty.call(this.temporaryUIFunctions,e)&&(this.body.eventListeners[e]=this.temporaryUIFunctions[e],delete this.temporaryUIFunctions[e]);this.temporaryUIFunctions={}}_unbindTemporaryEvents(){for(let e=0;e{i.destroy()});const o=r=>{let{keyCode:A,key:I}=r;(I==="Enter"||I===" "||A===13||A===32)&&t()};e.addEventListener("keyup",o,!1),this._domEventListenerCleanupQueue.push(()=>{e.removeEventListener("keyup",o,!1)})}_cleanupTemporaryNodesAndEdges(){for(let r=0;r=0;I--)if(r[I]!==this.selectedControlNode.id){A=this.body.nodes[r[I]];break}if(A!==void 0&&this.selectedControlNode!==void 0)if(A.isCluster===!0)alert(this.options.locales[this.options.locale].createEdgeError||this.options.locales.en.createEdgeError);else{const I=this.body.nodes[this.temporaryIds.nodes[0]];this.selectedControlNode.id===I.id?this._performEditEdge(A.id,o.to.id):this._performEditEdge(o.from.id,A.id)}else o.updateEdgeType(),this.body.emitter.emit("restorePhysics");this.body.emitter.emit("_redraw")}_handleConnect(e){if(new Date().valueOf()-this.touchTime>100){this.lastTouch=this.body.functions.getPointer(e.center),this.lastTouch.translation=Vt({},this.body.view.translation),this.interactionHandler.drag.pointer=this.lastTouch,this.interactionHandler.drag.translation=this.lastTouch.translation;const t=this.lastTouch,i=this.selectionHandler.getNodeAt(t);if(i!==void 0)if(i.isCluster===!0)alert(this.options.locales[this.options.locale].createEdgeError||this.options.locales.en.createEdgeError);else{const o=this._getNewTargetNode(i.x,i.y);this.body.nodes[o.id]=o,this.body.nodeIndices.push(o.id);const r=this.body.functions.createEdge({id:"connectionEdge"+js(),from:i.id,to:o.id,physics:!1,smooth:{enabled:!0,type:"continuous",roundness:.5}});this.body.edges[r.id]=r,this.body.edgeIndices.push(r.id),this.temporaryIds.nodes.push(o.id),this.temporaryIds.edges.push(r.id)}this.touchTime=new Date().valueOf()}}_dragControlNode(e){const t=this.body.functions.getPointer(e.center),i=this.selectionHandler._pointerToPositionObject(t);let o;this.temporaryIds.edges[0]!==void 0&&(o=this.body.edges[this.temporaryIds.edges[0]].fromId);const r=this.selectionHandler._getAllNodesOverlappingWith(i);let A;for(let l=r.length-1;l>=0;l--){var I;if(at(I=this.temporaryIds.nodes).call(I,r[l])===-1){A=this.body.nodes[r[l]];break}}if(e.controlEdge={from:o,to:A?A.id:void 0},this.selectionHandler.generateClickEvent("controlNodeDragging",e,t),this.temporaryIds.nodes[0]!==void 0){const l=this.body.nodes[this.temporaryIds.nodes[0]];l.x=this.canvas._XconvertDOMtoCanvas(t.x),l.y=this.canvas._YconvertDOMtoCanvas(t.y),this.body.emitter.emit("_redraw")}else this.interactionHandler.onDrag(e)}_finishConnect(e){const t=this.body.functions.getPointer(e.center),i=this.selectionHandler._pointerToPositionObject(t);let o;this.temporaryIds.edges[0]!==void 0&&(o=this.body.edges[this.temporaryIds.edges[0]].fromId);const r=this.selectionHandler._getAllNodesOverlappingWith(i);let A;for(let l=r.length-1;l>=0;l--){var I;if(at(I=this.temporaryIds.nodes).call(I,r[l])===-1){A=this.body.nodes[r[l]];break}}this._cleanupTemporaryNodesAndEdges(),A!==void 0&&(A.isCluster===!0?alert(this.options.locales[this.options.locale].createEdgeError||this.options.locales.en.createEdgeError):this.body.nodes[o]!==void 0&&this.body.nodes[A.id]!==void 0&&this._performAddEdge(o,A.id)),e.controlEdge={from:o,to:A?A.id:void 0},this.selectionHandler.generateClickEvent("controlNodeDragEnd",e,t),this.body.emitter.emit("_redraw")}_dragStartEdge(e){const t=this.lastTouch;this.selectionHandler.generateClickEvent("dragStart",e,t,void 0,!0)}_performAddNode(e){const t={id:js(),x:e.pointer.canvas.x,y:e.pointer.canvas.y,label:"new"};if(typeof this.options.addNode=="function")if(this.options.addNode.length===2)this.options.addNode(t,i=>{i!=null&&this.inMode==="addNode"&&this.body.data.nodes.getDataSet().add(i),this.showManipulatorToolbar()});else throw this.showManipulatorToolbar(),new Error("The function for add does not support two arguments (data,callback)");else this.body.data.nodes.getDataSet().add(t),this.showManipulatorToolbar()}_performAddEdge(e,t){const i={from:e,to:t};if(typeof this.options.addEdge=="function")if(this.options.addEdge.length===2)this.options.addEdge(i,o=>{o!=null&&this.inMode==="addEdge"&&(this.body.data.edges.getDataSet().add(o),this.selectionHandler.unselectAll(),this.showManipulatorToolbar())});else throw new Error("The function for connect does not support two arguments (data,callback)");else this.body.data.edges.getDataSet().add(i),this.selectionHandler.unselectAll(),this.showManipulatorToolbar()}_performEditEdge(e,t){const i={id:this.edgeBeingEditedId,from:e,to:t,label:this.body.data.edges.get(this.edgeBeingEditedId).label};let o=this.options.editEdge;if(typeof o=="object"&&(o=o.editWithoutDrag),typeof o=="function")if(o.length===2)o(i,r=>{r==null||this.inMode!=="editEdge"?(this.body.edges[i.id].updateEdgeType(),this.body.emitter.emit("_redraw"),this.showManipulatorToolbar()):(this.body.data.edges.getDataSet().update(r),this.selectionHandler.unselectAll(),this.showManipulatorToolbar())});else throw new Error("The function for edit does not support two arguments (data, callback)");else this.body.data.edges.getDataSet().update(i),this.selectionHandler.unselectAll(),this.showManipulatorToolbar()}}const se="string",oe="boolean",W="number",ja="array",xe="object",zx="dom",yq="any",Mu=["arrow","bar","box","circle","crow","curve","diamond","image","inv_curve","inv_triangle","triangle","vee"],zu={borderWidth:{number:W},borderWidthSelected:{number:W,undefined:"undefined"},brokenImage:{string:se,undefined:"undefined"},chosen:{label:{boolean:oe,function:"function"},node:{boolean:oe,function:"function"},__type__:{object:xe,boolean:oe}},color:{border:{string:se},background:{string:se},highlight:{border:{string:se},background:{string:se},__type__:{object:xe,string:se}},hover:{border:{string:se},background:{string:se},__type__:{object:xe,string:se}},__type__:{object:xe,string:se}},opacity:{number:W,undefined:"undefined"},fixed:{x:{boolean:oe},y:{boolean:oe},__type__:{object:xe,boolean:oe}},font:{align:{string:se},color:{string:se},size:{number:W},face:{string:se},background:{string:se},strokeWidth:{number:W},strokeColor:{string:se},vadjust:{number:W},multi:{boolean:oe,string:se},bold:{color:{string:se},size:{number:W},face:{string:se},mod:{string:se},vadjust:{number:W},__type__:{object:xe,string:se}},boldital:{color:{string:se},size:{number:W},face:{string:se},mod:{string:se},vadjust:{number:W},__type__:{object:xe,string:se}},ital:{color:{string:se},size:{number:W},face:{string:se},mod:{string:se},vadjust:{number:W},__type__:{object:xe,string:se}},mono:{color:{string:se},size:{number:W},face:{string:se},mod:{string:se},vadjust:{number:W},__type__:{object:xe,string:se}},__type__:{object:xe,string:se}},group:{string:se,number:W,undefined:"undefined"},heightConstraint:{minimum:{number:W},valign:{string:se},__type__:{object:xe,boolean:oe,number:W}},hidden:{boolean:oe},icon:{face:{string:se},code:{string:se},size:{number:W},color:{string:se},weight:{string:se,number:W},__type__:{object:xe}},id:{string:se,number:W},image:{selected:{string:se,undefined:"undefined"},unselected:{string:se,undefined:"undefined"},__type__:{object:xe,string:se}},imagePadding:{top:{number:W},right:{number:W},bottom:{number:W},left:{number:W},__type__:{object:xe,number:W}},label:{string:se,undefined:"undefined"},labelHighlightBold:{boolean:oe},level:{number:W,undefined:"undefined"},margin:{top:{number:W},right:{number:W},bottom:{number:W},left:{number:W},__type__:{object:xe,number:W}},mass:{number:W},physics:{boolean:oe},scaling:{min:{number:W},max:{number:W},label:{enabled:{boolean:oe},min:{number:W},max:{number:W},maxVisible:{number:W},drawThreshold:{number:W},__type__:{object:xe,boolean:oe}},customScalingFunction:{function:"function"},__type__:{object:xe}},shadow:{enabled:{boolean:oe},color:{string:se},size:{number:W},x:{number:W},y:{number:W},__type__:{object:xe,boolean:oe}},shape:{string:["custom","ellipse","circle","database","box","text","image","circularImage","diamond","dot","star","triangle","triangleDown","square","icon","hexagon"]},ctxRenderer:{function:"function"},shapeProperties:{borderDashes:{boolean:oe,array:ja},borderRadius:{number:W},interpolation:{boolean:oe},useImageSize:{boolean:oe},useBorderWithImage:{boolean:oe},coordinateOrigin:{string:["center","top-left"]},__type__:{object:xe}},size:{number:W},title:{string:se,dom:zx,undefined:"undefined"},value:{number:W,undefined:"undefined"},widthConstraint:{minimum:{number:W},maximum:{number:W},__type__:{object:xe,boolean:oe,number:W}},x:{number:W},y:{number:W},__type__:{object:xe}},bq={configure:{enabled:{boolean:oe},filter:{boolean:oe,string:se,array:ja,function:"function"},container:{dom:zx},showButton:{boolean:oe},__type__:{object:xe,boolean:oe,string:se,array:ja,function:"function"}},edges:{arrows:{to:{enabled:{boolean:oe},scaleFactor:{number:W},type:{string:Mu},imageHeight:{number:W},imageWidth:{number:W},src:{string:se},__type__:{object:xe,boolean:oe}},middle:{enabled:{boolean:oe},scaleFactor:{number:W},type:{string:Mu},imageWidth:{number:W},imageHeight:{number:W},src:{string:se},__type__:{object:xe,boolean:oe}},from:{enabled:{boolean:oe},scaleFactor:{number:W},type:{string:Mu},imageWidth:{number:W},imageHeight:{number:W},src:{string:se},__type__:{object:xe,boolean:oe}},__type__:{string:["from","to","middle"],object:xe}},endPointOffset:{from:{number:W},to:{number:W},__type__:{object:xe,number:W}},arrowStrikethrough:{boolean:oe},background:{enabled:{boolean:oe},color:{string:se},size:{number:W},dashes:{boolean:oe,array:ja},__type__:{object:xe,boolean:oe}},chosen:{label:{boolean:oe,function:"function"},edge:{boolean:oe,function:"function"},__type__:{object:xe,boolean:oe}},color:{color:{string:se},highlight:{string:se},hover:{string:se},inherit:{string:["from","to","both"],boolean:oe},opacity:{number:W},__type__:{object:xe,string:se}},dashes:{boolean:oe,array:ja},font:{color:{string:se},size:{number:W},face:{string:se},background:{string:se},strokeWidth:{number:W},strokeColor:{string:se},align:{string:["horizontal","top","middle","bottom"]},vadjust:{number:W},multi:{boolean:oe,string:se},bold:{color:{string:se},size:{number:W},face:{string:se},mod:{string:se},vadjust:{number:W},__type__:{object:xe,string:se}},boldital:{color:{string:se},size:{number:W},face:{string:se},mod:{string:se},vadjust:{number:W},__type__:{object:xe,string:se}},ital:{color:{string:se},size:{number:W},face:{string:se},mod:{string:se},vadjust:{number:W},__type__:{object:xe,string:se}},mono:{color:{string:se},size:{number:W},face:{string:se},mod:{string:se},vadjust:{number:W},__type__:{object:xe,string:se}},__type__:{object:xe,string:se}},hidden:{boolean:oe},hoverWidth:{function:"function",number:W},label:{string:se,undefined:"undefined"},labelHighlightBold:{boolean:oe},length:{number:W,undefined:"undefined"},physics:{boolean:oe},scaling:{min:{number:W},max:{number:W},label:{enabled:{boolean:oe},min:{number:W},max:{number:W},maxVisible:{number:W},drawThreshold:{number:W},__type__:{object:xe,boolean:oe}},customScalingFunction:{function:"function"},__type__:{object:xe}},selectionWidth:{function:"function",number:W},selfReferenceSize:{number:W},selfReference:{size:{number:W},angle:{number:W},renderBehindTheNode:{boolean:oe},__type__:{object:xe}},shadow:{enabled:{boolean:oe},color:{string:se},size:{number:W},x:{number:W},y:{number:W},__type__:{object:xe,boolean:oe}},smooth:{enabled:{boolean:oe},type:{string:["dynamic","continuous","discrete","diagonalCross","straightCross","horizontal","vertical","curvedCW","curvedCCW","cubicBezier"]},roundness:{number:W},forceDirection:{string:["horizontal","vertical","none"],boolean:oe},__type__:{object:xe,boolean:oe}},title:{string:se,undefined:"undefined"},width:{number:W},widthConstraint:{maximum:{number:W},__type__:{object:xe,boolean:oe,number:W}},value:{number:W,undefined:"undefined"},__type__:{object:xe}},groups:{useDefaultGroups:{boolean:oe},__any__:zu,__type__:{object:xe}},interaction:{dragNodes:{boolean:oe},dragView:{boolean:oe},hideEdgesOnDrag:{boolean:oe},hideEdgesOnZoom:{boolean:oe},hideNodesOnDrag:{boolean:oe},hover:{boolean:oe},keyboard:{enabled:{boolean:oe},speed:{x:{number:W},y:{number:W},zoom:{number:W},__type__:{object:xe}},bindToWindow:{boolean:oe},autoFocus:{boolean:oe},__type__:{object:xe,boolean:oe}},multiselect:{boolean:oe},navigationButtons:{boolean:oe},selectable:{boolean:oe},selectConnectedEdges:{boolean:oe},hoverConnectedEdges:{boolean:oe},tooltipDelay:{number:W},zoomView:{boolean:oe},zoomSpeed:{number:W},__type__:{object:xe}},layout:{randomSeed:{undefined:"undefined",number:W,string:se},improvedLayout:{boolean:oe},clusterThreshold:{number:W},hierarchical:{enabled:{boolean:oe},levelSeparation:{number:W},nodeSpacing:{number:W},treeSpacing:{number:W},blockShifting:{boolean:oe},edgeMinimization:{boolean:oe},parentCentralization:{boolean:oe},direction:{string:["UD","DU","LR","RL"]},sortMethod:{string:["hubsize","directed"]},shakeTowards:{string:["leaves","roots"]},__type__:{object:xe,boolean:oe}},__type__:{object:xe}},manipulation:{enabled:{boolean:oe},initiallyActive:{boolean:oe},addNode:{boolean:oe,function:"function"},addEdge:{boolean:oe,function:"function"},editNode:{function:"function"},editEdge:{editWithoutDrag:{function:"function"},__type__:{object:xe,boolean:oe,function:"function"}},deleteNode:{boolean:oe,function:"function"},deleteEdge:{boolean:oe,function:"function"},controlNodeStyle:zu,__type__:{object:xe,boolean:oe}},nodes:zu,physics:{enabled:{boolean:oe},barnesHut:{theta:{number:W},gravitationalConstant:{number:W},centralGravity:{number:W},springLength:{number:W},springConstant:{number:W},damping:{number:W},avoidOverlap:{number:W},__type__:{object:xe}},forceAtlas2Based:{theta:{number:W},gravitationalConstant:{number:W},centralGravity:{number:W},springLength:{number:W},springConstant:{number:W},damping:{number:W},avoidOverlap:{number:W},__type__:{object:xe}},repulsion:{centralGravity:{number:W},springLength:{number:W},springConstant:{number:W},nodeDistance:{number:W},damping:{number:W},__type__:{object:xe}},hierarchicalRepulsion:{centralGravity:{number:W},springLength:{number:W},springConstant:{number:W},nodeDistance:{number:W},damping:{number:W},avoidOverlap:{number:W},__type__:{object:xe}},maxVelocity:{number:W},minVelocity:{number:W},solver:{string:["barnesHut","repulsion","hierarchicalRepulsion","forceAtlas2Based"]},stabilization:{enabled:{boolean:oe},iterations:{number:W},updateInterval:{number:W},onlyDynamicEdges:{boolean:oe},fit:{boolean:oe},__type__:{object:xe,boolean:oe}},timestep:{number:W},adaptiveTimestep:{boolean:oe},wind:{x:{number:W},y:{number:W},__type__:{object:xe}},__type__:{object:xe,boolean:oe}},autoResize:{boolean:oe},clickToUse:{boolean:oe},locale:{string:se},locales:{__any__:{any:yq},__type__:{object:xe}},height:{string:se},width:{string:se},__type__:{object:xe}},kx={nodes:{borderWidth:[1,0,10,1],borderWidthSelected:[2,0,10,1],color:{border:["color","#2B7CE9"],background:["color","#97C2FC"],highlight:{border:["color","#2B7CE9"],background:["color","#D2E5FF"]},hover:{border:["color","#2B7CE9"],background:["color","#D2E5FF"]}},opacity:[0,0,1,.1],fixed:{x:!1,y:!1},font:{color:["color","#343434"],size:[14,0,100,1],face:["arial","verdana","tahoma"],background:["color","none"],strokeWidth:[0,0,50,1],strokeColor:["color","#ffffff"]},hidden:!1,labelHighlightBold:!0,physics:!0,scaling:{min:[10,0,200,1],max:[30,0,200,1],label:{enabled:!1,min:[14,0,200,1],max:[30,0,200,1],maxVisible:[30,0,200,1],drawThreshold:[5,0,20,1]}},shadow:{enabled:!1,color:"rgba(0,0,0,0.5)",size:[10,0,20,1],x:[5,-30,30,1],y:[5,-30,30,1]},shape:["ellipse","box","circle","database","diamond","dot","square","star","text","triangle","triangleDown","hexagon"],shapeProperties:{borderDashes:!1,borderRadius:[6,0,20,1],interpolation:!0,useImageSize:!1},size:[25,0,200,1]},edges:{arrows:{to:{enabled:!1,scaleFactor:[1,0,3,.05],type:"arrow"},middle:{enabled:!1,scaleFactor:[1,0,3,.05],type:"arrow"},from:{enabled:!1,scaleFactor:[1,0,3,.05],type:"arrow"}},endPointOffset:{from:[0,-10,10,1],to:[0,-10,10,1]},arrowStrikethrough:!0,color:{color:["color","#848484"],highlight:["color","#848484"],hover:["color","#848484"],inherit:["from","to","both",!0,!1],opacity:[1,0,1,.05]},dashes:!1,font:{color:["color","#343434"],size:[14,0,100,1],face:["arial","verdana","tahoma"],background:["color","none"],strokeWidth:[2,0,50,1],strokeColor:["color","#ffffff"],align:["horizontal","top","middle","bottom"]},hidden:!1,hoverWidth:[1.5,0,5,.1],labelHighlightBold:!0,physics:!0,scaling:{min:[1,0,100,1],max:[15,0,100,1],label:{enabled:!0,min:[14,0,200,1],max:[30,0,200,1],maxVisible:[30,0,200,1],drawThreshold:[5,0,20,1]}},selectionWidth:[1.5,0,5,.1],selfReferenceSize:[20,0,200,1],selfReference:{size:[20,0,200,1],angle:[Math.PI/2,-6*Math.PI,6*Math.PI,Math.PI/8],renderBehindTheNode:!0},shadow:{enabled:!1,color:"rgba(0,0,0,0.5)",size:[10,0,20,1],x:[5,-30,30,1],y:[5,-30,30,1]},smooth:{enabled:!0,type:["dynamic","continuous","discrete","diagonalCross","straightCross","horizontal","vertical","curvedCW","curvedCCW","cubicBezier"],forceDirection:["horizontal","vertical","none"],roundness:[.5,0,1,.05]},width:[1,0,30,1]},layout:{hierarchical:{enabled:!1,levelSeparation:[150,20,500,5],nodeSpacing:[100,20,500,5],treeSpacing:[200,20,500,5],blockShifting:!0,edgeMinimization:!0,parentCentralization:!0,direction:["UD","DU","LR","RL"],sortMethod:["hubsize","directed"],shakeTowards:["leaves","roots"]}},interaction:{dragNodes:!0,dragView:!0,hideEdgesOnDrag:!1,hideEdgesOnZoom:!1,hideNodesOnDrag:!1,hover:!1,keyboard:{enabled:!1,speed:{x:[10,0,40,1],y:[10,0,40,1],zoom:[.02,0,.1,.005]},bindToWindow:!0,autoFocus:!0},multiselect:!1,navigationButtons:!1,selectable:!0,selectConnectedEdges:!0,hoverConnectedEdges:!0,tooltipDelay:[300,0,1e3,25],zoomView:!0,zoomSpeed:[1,.1,2,.1]},manipulation:{enabled:!1,initiallyActive:!1},physics:{enabled:!0,barnesHut:{theta:[.5,.1,1,.05],gravitationalConstant:[-2e3,-3e4,0,50],centralGravity:[.3,0,10,.05],springLength:[95,0,500,5],springConstant:[.04,0,1.2,.005],damping:[.09,0,1,.01],avoidOverlap:[0,0,1,.01]},forceAtlas2Based:{theta:[.5,.1,1,.05],gravitationalConstant:[-50,-500,0,1],centralGravity:[.01,0,1,.005],springLength:[95,0,500,5],springConstant:[.08,0,1.2,.005],damping:[.4,0,1,.01],avoidOverlap:[0,0,1,.01]},repulsion:{centralGravity:[.2,0,10,.05],springLength:[200,0,500,5],springConstant:[.05,0,1.2,.005],nodeDistance:[100,0,500,5],damping:[.09,0,1,.01]},hierarchicalRepulsion:{centralGravity:[.2,0,10,.05],springLength:[100,0,500,5],springConstant:[.01,0,1.2,.005],nodeDistance:[120,0,500,5],damping:[.09,0,1,.01],avoidOverlap:[0,0,1,.01]},maxVelocity:[50,0,150,1],minVelocity:[.1,.01,.5,.01],solver:["barnesHut","forceAtlas2Based","repulsion","hierarchicalRepulsion"],timestep:[.5,.01,1,.01],wind:{x:[0,-10,10,.1],y:[0,-10,10,.1]}}},wq=(n,e,t)=>{var i;return!!(Eg(n).call(n,"physics")&&Eg(i=kx.physics.solver).call(i,e)&&t.physics.solver!==e&&e!=="wind")};class xq{constructor(){}getDistances(e,t,i){const o={},r=e.edges;for(let I=0;I2&&arguments[2]!==void 0?arguments[2]:!1;const o=this.distanceSolver.getDistances(this.body,e,t);this._createL_matrix(o),this._createK_matrix(o),this._createE_matrix();const r=.01,A=1;let I=0;const l=Math.max(1e3,Math.min(10*this.body.nodeIndices.length,6e3)),c=5;let h=1e9,p=0,m=0,y=0,w=0,S=0;for(;h>r&&IA&&Sthis.body.emitter.emit("_requestRedraw")),this.groups=new rH,this.canvas=new m$(this.body),this.selectionHandler=new J$(this.body,this.canvas),this.interactionHandler=new x$(this.body,this.canvas,this.selectionHandler),this.view=new y$(this.body,this.canvas),this.renderer=new d$(this.body,this.canvas),this.physics=new I$(this.body),this.layoutEngine=new pq(this.body),this.clustering=new c$(this.body),this.manipulation=new vq(this.body,this.canvas,this.selectionHandler,this.interactionHandler),this.nodesHandler=new _X(this.body,this.images,this.groups,this.layoutEngine),this.edgesHandler=new o$(this.body,this.images,this.groups),this.body.modules.kamadaKawai=new Sq(this.body,150,.05),this.body.modules.clustering=this.clustering,this.canvas._create(),this.setOptions(t),this.setData(e)}py(ve.prototype),ve.prototype.setOptions=function(n){if(n===null&&(n=void 0),n!==void 0){if(qV.validate(n,bq)===!0&&console.error("%cErrors have been found in the supplied options object.",m1),Ds(["locale","locales","clickToUse"],this.options,n),n.locale!==void 0&&(n.locale=IU(n.locales||this.options.locales,n.locale)),n=this.layoutEngine.setOptions(n.layout,n),this.canvas.setOptions(n),this.groups.setOptions(n.groups),this.nodesHandler.setOptions(n.nodes),this.edgesHandler.setOptions(n.edges),this.physics.setOptions(n.physics),this.manipulation.setOptions(n.manipulation,n,this.options),this.interactionHandler.setOptions(n.interaction),this.renderer.setOptions(n.interaction),this.selectionHandler.setOptions(n.interaction),n.groups!==void 0&&this.body.emitter.emit("refreshNodes"),"configure"in n&&(this.configurator||(this.configurator=new XV(this,this.body.container,kx,this.canvas.pixelRatio,wq)),this.configurator.setOptions(n.configure)),this.configurator&&this.configurator.options.enabled===!0){const i={nodes:{},edges:{},layout:{},interaction:{},manipulation:{},physics:{},global:{}};mt(i.nodes,this.nodesHandler.options),mt(i.edges,this.edgesHandler.options),mt(i.layout,this.layoutEngine.options),mt(i.interaction,this.selectionHandler.options),mt(i.interaction,this.renderer.options),mt(i.interaction,this.interactionHandler.options),mt(i.manipulation,this.manipulation.options),mt(i.physics,this.physics.options),mt(i.global,this.canvas.options),mt(i.global,this.options),this.configurator.setModuleOptions(i)}n.clickToUse!==void 0?n.clickToUse===!0?this.activator===void 0&&(this.activator=new QV(this.canvas.frame),this.activator.on("change",()=>{this.body.emitter.emit("activate")})):(this.activator!==void 0&&(this.activator.destroy(),delete this.activator),this.body.emitter.emit("activate")):this.body.emitter.emit("activate"),this.canvas.setSize(),this.body.emitter.emit("startSimulation")}},ve.prototype._updateVisibleIndices=function(){const n=this.body.nodes,e=this.body.edges;this.body.nodeIndices=[],this.body.edgeIndices=[];for(const t in n)Object.prototype.hasOwnProperty.call(n,t)&&!this.clustering._isClusteredNode(t)&&n[t].options.hidden===!1&&this.body.nodeIndices.push(n[t].id);for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)){const i=e[t],o=n[i.fromId],r=n[i.toId],A=o!==void 0&&r!==void 0;!this.clustering._isClusteredEdge(t)&&i.options.hidden===!1&&A&&o.options.hidden===!1&&r.options.hidden===!1&&this.body.edgeIndices.push(i.id)}},ve.prototype.bindEventListeners=function(){this.body.emitter.on("_dataChanged",()=>{this.edgesHandler._updateState(),this.body.emitter.emit("_dataUpdated")}),this.body.emitter.on("_dataUpdated",()=>{this.clustering._updateState(),this._updateVisibleIndices(),this._updateValueRange(this.body.nodes),this._updateValueRange(this.body.edges),this.body.emitter.emit("startSimulation"),this.body.emitter.emit("_requestRedraw")})},ve.prototype.setData=function(n){if(this.body.emitter.emit("resetPhysics"),this.body.emitter.emit("_resetData"),this.selectionHandler.unselectAll(),n&&n.dot&&(n.nodes||n.edges))throw new SyntaxError('Data must contain either parameter "dot" or parameter pair "nodes" and "edges", but not both.');if(this.setOptions(n&&n.options),n&&n.dot){console.warn("The dot property has been deprecated. Please use the static convertDot method to convert DOT into vis.network format and use the normal data format with nodes and edges. This converter is used like this: var data = vis.network.convertDot(dotString);");const e=aU(n.dot);this.setData(e);return}else if(n&&n.gephi){console.warn("The gephi property has been deprecated. Please use the static convertGephi method to convert gephi into vis.network format and use the normal data format with nodes and edges. This converter is used like this: var data = vis.network.convertGephi(gephiJson);");const e=AU(n.gephi);this.setData(e);return}else this.nodesHandler.setData(n&&n.nodes,!0),this.edgesHandler.setData(n&&n.edges,!0);this.body.emitter.emit("_dataChanged"),this.body.emitter.emit("_dataLoaded"),this.body.emitter.emit("initPhysics")},ve.prototype.destroy=function(){this.body.emitter.emit("destroy"),this.body.emitter.off(),this.off(),delete this.groups,delete this.canvas,delete this.selectionHandler,delete this.interactionHandler,delete this.view,delete this.renderer,delete this.physics,delete this.layoutEngine,delete this.clustering,delete this.manipulation,delete this.nodesHandler,delete this.edgesHandler,delete this.configurator,delete this.images;for(const n in this.body.nodes)Object.prototype.hasOwnProperty.call(this.body.nodes,n)&&delete this.body.nodes[n];for(const n in this.body.edges)Object.prototype.hasOwnProperty.call(this.body.edges,n)&&delete this.body.edges[n];Ng(this.body.container)},ve.prototype._updateValueRange=function(n){let e,t,i,o=0;for(e in n)if(Object.prototype.hasOwnProperty.call(n,e)){const r=n[e].getValue();r!==void 0&&(t=t===void 0?r:Math.min(r,t),i=i===void 0?r:Math.max(r,i),o+=r)}if(t!==void 0&&i!==void 0)for(e in n)Object.prototype.hasOwnProperty.call(n,e)&&n[e].setValueRange(t,i,o)},ve.prototype.isActive=function(){return!this.activator||this.activator.active},ve.prototype.setSize=function(){return this.canvas.setSize.apply(this.canvas,arguments)},ve.prototype.canvasToDOM=function(){return this.canvas.canvasToDOM.apply(this.canvas,arguments)},ve.prototype.DOMtoCanvas=function(){return this.canvas.DOMtoCanvas.apply(this.canvas,arguments)},ve.prototype.findNode=function(){return this.clustering.findNode.apply(this.clustering,arguments)},ve.prototype.isCluster=function(){return this.clustering.isCluster.apply(this.clustering,arguments)},ve.prototype.openCluster=function(){return this.clustering.openCluster.apply(this.clustering,arguments)},ve.prototype.cluster=function(){return this.clustering.cluster.apply(this.clustering,arguments)},ve.prototype.getNodesInCluster=function(){return this.clustering.getNodesInCluster.apply(this.clustering,arguments)},ve.prototype.clusterByConnection=function(){return this.clustering.clusterByConnection.apply(this.clustering,arguments)},ve.prototype.clusterByHubsize=function(){return this.clustering.clusterByHubsize.apply(this.clustering,arguments)},ve.prototype.updateClusteredNode=function(){return this.clustering.updateClusteredNode.apply(this.clustering,arguments)},ve.prototype.getClusteredEdges=function(){return this.clustering.getClusteredEdges.apply(this.clustering,arguments)},ve.prototype.getBaseEdge=function(){return this.clustering.getBaseEdge.apply(this.clustering,arguments)},ve.prototype.getBaseEdges=function(){return this.clustering.getBaseEdges.apply(this.clustering,arguments)},ve.prototype.updateEdge=function(){return this.clustering.updateEdge.apply(this.clustering,arguments)},ve.prototype.clusterOutliers=function(){return this.clustering.clusterOutliers.apply(this.clustering,arguments)},ve.prototype.getSeed=function(){return this.layoutEngine.getSeed.apply(this.layoutEngine,arguments)},ve.prototype.enableEditMode=function(){return this.manipulation.enableEditMode.apply(this.manipulation,arguments)},ve.prototype.disableEditMode=function(){return this.manipulation.disableEditMode.apply(this.manipulation,arguments)},ve.prototype.addNodeMode=function(){return this.manipulation.addNodeMode.apply(this.manipulation,arguments)},ve.prototype.editNode=function(){return this.manipulation.editNode.apply(this.manipulation,arguments)},ve.prototype.editNodeMode=function(){return console.warn("Deprecated: Please use editNode instead of editNodeMode."),this.manipulation.editNode.apply(this.manipulation,arguments)},ve.prototype.addEdgeMode=function(){return this.manipulation.addEdgeMode.apply(this.manipulation,arguments)},ve.prototype.editEdgeMode=function(){return this.manipulation.editEdgeMode.apply(this.manipulation,arguments)},ve.prototype.deleteSelected=function(){return this.manipulation.deleteSelected.apply(this.manipulation,arguments)},ve.prototype.getPositions=function(){return this.nodesHandler.getPositions.apply(this.nodesHandler,arguments)},ve.prototype.getPosition=function(){return this.nodesHandler.getPosition.apply(this.nodesHandler,arguments)},ve.prototype.storePositions=function(){return this.nodesHandler.storePositions.apply(this.nodesHandler,arguments)},ve.prototype.moveNode=function(){return this.nodesHandler.moveNode.apply(this.nodesHandler,arguments)},ve.prototype.getBoundingBox=function(){return this.nodesHandler.getBoundingBox.apply(this.nodesHandler,arguments)},ve.prototype.getConnectedNodes=function(n){return this.body.nodes[n]!==void 0?this.nodesHandler.getConnectedNodes.apply(this.nodesHandler,arguments):this.edgesHandler.getConnectedNodes.apply(this.edgesHandler,arguments)},ve.prototype.getConnectedEdges=function(){return this.nodesHandler.getConnectedEdges.apply(this.nodesHandler,arguments)},ve.prototype.startSimulation=function(){return this.physics.startSimulation.apply(this.physics,arguments)},ve.prototype.stopSimulation=function(){return this.physics.stopSimulation.apply(this.physics,arguments)},ve.prototype.stabilize=function(){return this.physics.stabilize.apply(this.physics,arguments)},ve.prototype.getSelection=function(){return this.selectionHandler.getSelection.apply(this.selectionHandler,arguments)},ve.prototype.setSelection=function(){return this.selectionHandler.setSelection.apply(this.selectionHandler,arguments)},ve.prototype.getSelectedNodes=function(){return this.selectionHandler.getSelectedNodeIds.apply(this.selectionHandler,arguments)},ve.prototype.getSelectedEdges=function(){return this.selectionHandler.getSelectedEdgeIds.apply(this.selectionHandler,arguments)},ve.prototype.getNodeAt=function(){const n=this.selectionHandler.getNodeAt.apply(this.selectionHandler,arguments);return n!==void 0&&n.id!==void 0?n.id:n},ve.prototype.getEdgeAt=function(){const n=this.selectionHandler.getEdgeAt.apply(this.selectionHandler,arguments);return n!==void 0&&n.id!==void 0?n.id:n},ve.prototype.selectNodes=function(){return this.selectionHandler.selectNodes.apply(this.selectionHandler,arguments)},ve.prototype.selectEdges=function(){return this.selectionHandler.selectEdges.apply(this.selectionHandler,arguments)},ve.prototype.unselectAll=function(){this.selectionHandler.unselectAll.apply(this.selectionHandler,arguments),this.selectionHandler.commitWithoutEmitting.apply(this.selectionHandler),this.redraw()},ve.prototype.redraw=function(){return this.renderer.redraw.apply(this.renderer,arguments)},ve.prototype.getScale=function(){return this.view.getScale.apply(this.view,arguments)},ve.prototype.getViewPosition=function(){return this.view.getViewPosition.apply(this.view,arguments)},ve.prototype.fit=function(){return this.view.fit.apply(this.view,arguments)},ve.prototype.moveTo=function(){return this.view.moveTo.apply(this.view,arguments)},ve.prototype.focus=function(){return this.view.focus.apply(this.view,arguments)},ve.prototype.releaseNode=function(){return this.view.releaseNode.apply(this.view,arguments)},ve.prototype.getOptionsFromConfigurator=function(){let n={};return this.configurator&&(n=this.configurator.getOptions.apply(this.configurator)),n};function Eq(n,e){n.on("click",t=>{e.onHover(null),t.edges.length===0&&e.onHoverEdge(null);const i=t.nodes[0];i!==void 0?e.onFocus(String(i)):e.onClear()}),n.on("doubleClick",t=>{const i=t.nodes[0];if(i!==void 0){e.onOpenSource(String(i));return}const o=t.edges[0];o!==void 0&&e.onOpenRelationshipSource(String(o))}),n.on("hoverNode",t=>{t.node!==void 0&&(e.onHoverEdge(null),e.onHover({nodeId:String(t.node),x:t.pointer.DOM.x,y:t.pointer.DOM.y}))}),n.on("blurNode",()=>e.onHover(null)),n.on("hoverEdge",t=>{t.edge!==void 0&&(e.onHover(null),e.onHoverEdge({edgeId:String(t.edge),x:t.pointer.DOM.x,y:t.pointer.DOM.y}))}),n.on("blurEdge",()=>e.onHoverEdge(null)),n.on("dragStart",()=>{e.onHover(null),e.onHoverEdge(null)}),n.on("zoom",()=>{e.onHover(null),e.onHoverEdge(null)})}const Tq=1e3,Oq=4e3,ku=4e3;function Nq(n){return n.nodes.length>=Tq||n.edges.length>=Oq?"static":"interactive"}function Dq(n,e=!1){if(e)return jq(n);const t=new Map;for(const h of n){const p=t.get(h.community)??[];p.push(h),t.set(h.community,p)}const i=[...t.entries()].sort(([h],[p])=>h-p).map(([h,p])=>({community:h,members:p.sort((m,y)=>m.id.localeCompare(y.id))})),o=i.reduce((h,p)=>Math.max(h,p.members.length),1),r=Math.max(1,Math.ceil(Math.sqrt(i.length))),A=Math.max(1,Math.ceil(i.length/r)),I=Math.max(280,Math.ceil(Math.sqrt(o))*48),l=Math.PI*(3-Math.sqrt(5)),c=new Map;return i.forEach((h,p)=>{const m=p%r,y=Math.floor(p/r),w=(m-(r-1)/2)*I,S=(y-(A-1)/2)*I;h.members.forEach((x,O)=>{if(O===0){c.set(x.id,{x:w,y:S});return}const E=24*Math.sqrt(O),_=O*l;c.set(x.id,{x:w+Math.cos(_)*E,y:S+Math.sin(_)*E})})}),c}function Mq(n,e,t=!1){const i=[...n].sort((o,r)=>o.community-r.community||(r.degree??0)-(o.degree??0)||o.id.localeCompare(r.id));if(e==="circle"){const o=Math.max(160,i.length*44/(2*Math.PI));return new Map(i.map((r,A)=>{const I=-Math.PI/2+A*2*Math.PI/Math.max(1,i.length);return[r.id,{x:Math.cos(I)*o,y:Math.sin(I)*o}]}))}if(e==="concentric"){const o=[...n].sort((r,A)=>(A.degree??0)-(r.degree??0)||(A.memberCount??0)-(r.memberCount??0)||r.community-A.community||r.id.localeCompare(A.id));return kq(o)}return e==="hierarchical"?zq(i):e==="spiral"?Rq(i):_q(i,t)}function zq(n){const e=new Map;for(const o of n){const r=o.depth??(o.root?0:1),A=e.get(r)??[];A.push(o),e.set(r,A)}const t=[...e.entries()].sort(([o],[r])=>o-r),i=new Map;for(const[o,r]of t){r.sort((I,l)=>Number(l.root??!1)-Number(I.root??!1)||(l.degree??0)-(I.degree??0)||I.id.localeCompare(l.id));const A=148;r.forEach((I,l)=>i.set(I.id,{x:(l-(r.length-1)/2)*A,y:o*168}))}return i}function kq(n){const e=new Map,t=n[0];if(!t)return e;e.set(t.id,{x:0,y:0});let i=1,o=1;for(;i{if(o===0)return[i.id,{x:0,y:0}];const r=36*Math.sqrt(o),A=o*.52;return[i.id,{x:Math.cos(A)*r,y:Math.sin(A)*r}]}))}function _q(n,e){const r=new Map;n.forEach((w,S)=>{const x=e?Math.floor(S/16):w.community,O=r.get(x)??[];O.push(w),r.set(x,O)});const A=[...r.entries()].sort(([w],[S])=>w-S).map(([w,S])=>{const x=Math.max(1,Math.ceil(Math.sqrt(S.length))),O=Math.max(1,Math.ceil(S.length/x));return{key:w,members:S,columns:x,rows:O,width:(x-1)*56,height:(O-1)*56}}),I=Math.max(1,Math.ceil(Math.sqrt(A.length))),l=Math.max(1,Math.ceil(A.length/I)),c=Array.from({length:I},()=>0),h=Array.from({length:l},()=>0);A.forEach((w,S)=>{const x=S%I,O=Math.floor(S/I);c[x]=Math.max(c[x]??0,w.width),h[O]=Math.max(h[O]??0,w.height)});const p=Rx(c,112),m=Rx(h,112),y=new Map;return A.forEach((w,S)=>{const x=S%I,O=Math.floor(S/I);w.members.forEach((E,_)=>{const P=Math.floor(_/w.columns),Q=Math.min(w.columns,w.members.length-P*w.columns),ne=_%w.columns;y.set(E.id,{x:(p[x]??0)+(ne-(Q-1)/2)*56,y:(m[O]??0)+(P-(w.rows-1)/2)*56})})}),y}function Rx(n,e){let i=-(n.reduce((o,r)=>o+r,0)+Math.max(0,n.length-1)*e)/2;return n.map(o=>{const r=i+o/2;return i+=o+e,r})}function _x(n){if(!n.stats.aggregated||n.edges.length<=ku)return n.edges;const e=[...n.edges].sort((A,I)=>(I.weight??jx(I.relation))-(A.weight??jx(A.relation))||A.source.localeCompare(I.source)||A.target.localeCompare(I.target)||A.id.localeCompare(I.id)),t=new Map(n.nodes.map(A=>[A.id,A.id])),i=A=>{let I=t.get(A)??A;for(;t.get(I)!==void 0&&t.get(I)!==I;)I=t.get(I);let l=A;for(;t.get(l)!==void 0&&t.get(l)!==I;){const c=t.get(l);t.set(l,I),l=c}return I},o=[],r=new Set;for(const A of e){const I=i(A.source),l=i(A.target);if(I!==l&&(t.set(l,I),o.push(A),r.add(A.id),o.length===ku))return o}for(const A of e)if(!r.has(A.id)&&(o.push(A),o.length===ku))break;return o}function jx(n){const e=Number.parseInt(n,10);return Number.isFinite(e)&&e>0?e:1}function jq(n){const e=[...n].sort((o,r)=>(r.degree??0)-(o.degree??0)||(r.memberCount??0)-(o.memberCount??0)||o.id.localeCompare(r.id)),t=Math.PI*(3-Math.sqrt(5)),i=34;return new Map(e.map((o,r)=>{if(r===0)return[o.id,{x:0,y:0}];const A=i*Math.sqrt(r),I=r*t;return[o.id,{x:Math.cos(I)*A,y:Math.sin(I)*A}]}))}const aI=176,AI=108,Zx=8,Zq=1500,Bq=2e3;function Pq(n){const e=[...n.positions.values()],t=n.viewport.left+n.viewport.width,i=n.viewport.top+n.viewport.height,o=[...e.map(j=>j.x),n.viewport.left,t],r=[...e.map(j=>j.y),n.viewport.top,i],A=Math.min(...o),I=Math.max(...o),l=Math.min(...r),c=Math.max(...r),h=Math.max(1,I-A),p=Math.max(1,c-l),m=aI-Zx*2,y=AI-Zx*2,w=Math.min(m/h,y/p),S=h*w,x=p*w,O=(aI-S)/2,E=(AI-x)/2,_=({x:j,y:V})=>({x:O+(j-A)*w,y:E+(V-l)*w}),P=({x:j,y:V})=>({x:A+(j-O)/w,y:l+(V-E)/w}),Q=_({x:n.viewport.left,y:n.viewport.top}),ne=_({x:t,y:i});return{project:_,unproject:P,viewport:{x:Q.x,y:Q.y,width:ne.x-Q.x,height:ne.y-Q.y}}}function Lq({model:n,snapshot:e,visibleNodeIds:t,visibleEdgeIds:i,focusedNodeId:o,onNavigate:r}){const A=F.useMemo(()=>Pq(e),[e]),I=F.useMemo(()=>n.nodes.filter(m=>!t||t.has(m.id)).sort((m,y)=>m.id.localeCompare(y.id)),[n.nodes,t]),l=I.slice(0,Zq),c=F.useMemo(()=>n.edges.filter(m=>(!i||i.has(m.id))&&(!t||t.has(m.source)&&t.has(m.target))).sort((m,y)=>m.id.localeCompare(y.id)).slice(0,Bq),[n.edges,i,t]),h=F.useMemo(()=>new Map(n.communities.map(m=>[m.id,m.color])),[n.communities]),p=m=>{const y=m.currentTarget.getBoundingClientRect();y.width<=0||y.height<=0||r(A.unproject({x:(m.clientX-y.left)/y.width*aI,y:(m.clientY-y.top)/y.height*AI}))};return f.jsxs("aside",{className:"compass-minimap compass-glass-panel","aria-label":"Graph overview",children:[f.jsxs("header",{children:[f.jsx("span",{children:"Map"}),f.jsx("small",{children:l.length{const y=e.positions.get(m.source),w=e.positions.get(m.target);if(!y||!w)return null;const S=A.project(y),x=A.project(w);return f.jsx("line",{x1:S.x,y1:S.y,x2:x.x,y2:x.y},m.id)})}),f.jsx("g",{className:"compass-minimap-nodes",children:l.map(m=>{const y=e.positions.get(m.id);if(!y)return null;const w=A.project(y);return f.jsx("circle",{cx:w.x,cy:w.y,r:m.id===o?3:1.65,fill:m.color?.background??h.get(m.community)??"currentColor","data-focused":m.id===o?"true":void 0},m.id)})}),f.jsx("rect",{className:"compass-minimap-viewport",x:A.viewport.x,y:A.viewport.y,width:A.viewport.width,height:A.viewport.height,rx:"2"})]})})]})}const Bx={added:{background:"#163d24",border:"#56d364"},removed:{background:"#4b1f24",border:"#ff7b72"},changed:{background:"#3d3015",border:"#d7a72b"},unchanged:{background:"#29313b",border:"#8b949e"}},Gq=200,Fq=1500,Px=.1,Vq=3,Uq=18,Yq=96,Hq=1500;function Kq(n,e){const t=[...e].sort().slice(0,Hq),i=n.getPositions(t),o=Object.values(i),r=o.length===0?0:Math.max(Math.max(...o.map(({x:l})=>l))-Math.min(...o.map(({x:l})=>l)),Math.max(...o.map(({y:l})=>l))-Math.min(...o.map(({y:l})=>l))),A=Math.min(Yq,Math.max(Uq,r*.012)),I=Math.PI*(3-Math.sqrt(5));t.forEach((l,c)=>{const h=i[l];if(!h)return;const p=c*I;n.moveNode(l,h.x+Math.cos(p)*A,h.y+Math.sin(p)*A)})}function Ls(n){return window.matchMedia("(prefers-reduced-motion: reduce)").matches?!1:{duration:n,easingFunction:"easeInOutQuad"}}const Wq={autoResize:!0,interaction:{hover:!0,tooltipDelay:100,hideEdgesOnDrag:!0,navigationButtons:!1,keyboard:{enabled:!0}},layout:{improvedLayout:!0},nodes:{borderWidth:1.5,shape:"dot"},edges:{arrows:{to:{enabled:!0,scaleFactor:.5}},smooth:{enabled:!0,type:"continuous",roundness:.2},selectionWidth:3},physics:{enabled:!0,solver:"forceAtlas2Based",stabilization:{enabled:!0,iterations:200,fit:!0,updateInterval:20},forceAtlas2Based:{gravitationalConstant:-60,centralGravity:.005,springLength:120,springConstant:.08,damping:.4,avoidOverlap:.8}}},Qq={autoResize:!0,interaction:{hover:!0,tooltipDelay:100,hideEdgesOnDrag:!0,navigationButtons:!1,keyboard:{enabled:!0}},layout:{improvedLayout:!0,randomSeed:17},nodes:{borderWidth:2,shape:"dot"},edges:{arrows:{to:{enabled:!0,scaleFactor:.38}},smooth:{enabled:!0,type:"continuous",roundness:.14},selectionWidth:3},physics:{enabled:!0,solver:"barnesHut",stabilization:{enabled:!0,iterations:520,fit:!0,updateInterval:25},maxVelocity:35,minVelocity:.55,barnesHut:{theta:.45,gravitationalConstant:-12e3,centralGravity:.12,springLength:180,springConstant:.025,damping:.3,avoidOverlap:.85}}},Xq={autoResize:!0,interaction:{hover:!0,tooltipDelay:100,hideEdgesOnDrag:!0,hideEdgesOnZoom:!0,hoverConnectedEdges:!1,selectConnectedEdges:!1,navigationButtons:!1,keyboard:{enabled:!0}},layout:{improvedLayout:!1,randomSeed:17},nodes:{borderWidth:1.5,shape:"dot"},edges:{arrows:{to:{enabled:!1}},chosen:!1,smooth:!1,selectionWidth:3},physics:{enabled:!1,solver:"barnesHut"}};function Lx(n,e,t,i,o){const r=e.change&&i?i[e.change]:void 0,A=r?r.background:e.color?.background??o?.get(e.community)??n.communities.find(I=>I.id===e.community)?.color??"#6688aa";return{background:A,border:t??r?.border??e.color?.border??A}}function Tn(n,e){return typeof window>"u"?e:getComputedStyle(document.documentElement).getPropertyValue(n).trim()||e}function $q(n){return n==="extracted"?{dashes:!1,width:2,opacity:.7}:n==="ambiguous"?{dashes:[3,4],width:2,opacity:.62}:n==="aggregated"?{dashes:!1,width:1,opacity:.2}:{dashes:!0,width:1,opacity:.35}}function Gx(n,e,t,i){if(n==="added")return{color:i.added.border,dashes:!1,width:1.7,opacity:.6};if(n==="removed")return{color:i.removed.border,dashes:[6,5],width:1.6,opacity:.56};if(n==="changed")return{color:i.changed.border,dashes:!1,width:1.65,opacity:.48};if(n==="unchanged")return{color:i.unchanged.border,dashes:!0,width:1,opacity:.2};const o=$q(e);return{color:t,...o}}function qq(n){return n==="added"?{enabled:!0,type:"curvedCW",roundness:.13}:n==="removed"?{enabled:!0,type:"curvedCCW",roundness:.13}:{enabled:!0,type:"continuous",roundness:.1}}function Jq(n){const e=new Map;for(const r of[...n].sort((A,I)=>A.id.localeCompare(I.id))){const A=r.change??"unchanged",I=e.get(A)??[];I.push(r),e.set(A,I)}const t={added:-300,changed:0,removed:300,unchanged:0},i=new Map,o=Math.PI*(3-Math.sqrt(5));for(const[r,A]of e)A.forEach((I,l)=>{const c=l*o,h=r==="unchanged"?210+Math.sqrt(l)*34:42+Math.sqrt(l)*40;i.set(I.id,{x:t[r]+Math.cos(c)*h,y:Math.sin(c)*h})});return i}function eJ(){const[n,e]=F.useState(0);return F.useEffect(()=>{const t=()=>e(r=>r+1),i=new MutationObserver(t);i.observe(document.documentElement,{attributes:!0,attributeFilter:["class","style"]}),i.observe(document.body,{attributes:!0,attributeFilter:["class","style"]});const o=window.matchMedia("(prefers-color-scheme: dark)");return o.addEventListener("change",t),()=>{i.disconnect(),o.removeEventListener("change",t)}},[]),n}function Ru(n){const e=n.match(/^#([\da-f]{3}|[\da-f]{6})$/i)?.[1];if(e){const i=e.length===3?[...e].map(o=>`${o}${o}`).join(""):e;return[Number.parseInt(i.slice(0,2),16),Number.parseInt(i.slice(2,4),16),Number.parseInt(i.slice(4,6),16)]}const t=n.match(/^rgba?\(\s*([\d.]+)[,\s]+([\d.]+)[,\s]+([\d.]+)/i);if(t)return[Number.parseFloat(t[1]??"0"),Number.parseFloat(t[2]??"0"),Number.parseFloat(t[3]??"0")]}function tJ(n,e,t){const i=Ru(n),o=Ru(e);if(!i||!o)return e;const r=i.map((A,I)=>Math.round(A*(1-t)+o[I]*t));return`rgb(${r[0]}, ${r[1]}, ${r[2]})`}function nJ(n){const e=Ru(n);return e?(e[0]*299+e[1]*587+e[2]*114)/1e3<145:!0}function CI(n,e,t,i=!1){return{background:tJ(n,e,i?t?.18:.1:t?.26:.14),border:e}}const iJ=F.forwardRef(function({model:e,focusedNodeId:t,physicsRunning:i,layoutStyle:o="automatic",initialPositions:r,forceLabels:A,showEdgeLabels:I=!1,isolatedNodeIds:l,isolatedEdgeIds:c,layoutSpacing:h=1,showMinimap:p=!1,hiddenCommunities:m,hiddenChanges:y,onFocus:w,onOpenSource:S,onOpenRelationshipSource:x,onHover:O,onHoverEdge:E,onClear:_,onStabilized:P},Q){const ne=F.useRef(null),j=F.useRef(null),[V,de]=F.useState(null),le=F.useRef(i);le.current=i;const Ze=F.useRef(i),Ee=F.useRef({onFocus:w,onOpenSource:S,onOpenRelationshipSource:x,onHover:O,onHoverEdge:E,onClear:_});Ee.current={onFocus:w,onOpenSource:S,onOpenRelationshipSource:x,onHover:O,onHoverEdge:E,onClear:_};const Ue=F.useRef(P);Ue.current=P;const We=F.useRef(null),Ae=F.useRef(h),M=eJ(),U=F.useMemo(()=>Nq(e),[e.edges.length,e.nodes.length]),K=F.useMemo(()=>_x(e),[e]),re=F.useMemo(()=>new Set(e.nodes.filter(R=>!m.has(R.community)&&!y.has(R.change??"unchanged")&&(!l||l.has(R.id))).map(R=>R.id)),[y,m,l,e.nodes]),ee=F.useMemo(()=>new Set(K.filter(R=>re.has(R.source)&&re.has(R.target)&&(!c||c.has(R.id))).map(R=>R.id)),[c,K,re]),T=F.useRef(re);T.current=re;const L=F.useCallback(()=>{const R=j.current,Ce=ne.current;if(!R||!Ce)return;const Qe=R.getPositions([...T.current].sort().slice(0,Fq)),xt=R.getViewPosition(),bt=Math.max(Px,R.getScale()),Bt=Math.max(1,Ce.clientWidth)/bt,pI=Math.max(1,Ce.clientHeight)/bt;de({positions:new Map(Object.entries(Qe)),viewport:{left:xt.x-Bt/2,top:xt.y-pI/2,width:Bt,height:pI}})},[]),te=F.useMemo(()=>{let R=1;for(const Ce of e.nodes)R=Math.max(R,Ce.degree??1);return R},[e.nodes]),ae=F.useMemo(()=>new Map(e.communities.map(R=>[R.id,R.color])),[e.communities]),ue=F.useMemo(()=>Tn("--vscode-editor-foreground",Tn("--foreground","#eef5ff")),[M]),ye=F.useMemo(()=>Tn("--vscode-descriptionForeground",Tn("--muted-foreground","#60728b")),[M]),Be=F.useMemo(()=>Tn("--vscode-editor-foreground",Tn("--foreground","#d8e4f2")),[M]),ct=F.useMemo(()=>{const R=Tn("--vscode-editor-background",Tn("--background","#08111f")),Ce=nJ(R);return{added:CI(R,Tn("--vscode-gitDecoration-addedResourceForeground",Ce?"#56d364":"#1a7f37"),Ce),removed:CI(R,Tn("--vscode-gitDecoration-deletedResourceForeground",Ce?"#ff7b72":"#cf222e"),Ce),changed:CI(R,Tn("--vscode-gitDecoration-modifiedResourceForeground",Ce?"#d7a72b":"#9a6700"),Ce),unchanged:CI(R,Tn("--vscode-descriptionForeground",Ce?"#8b949e":"#656d76"),Ce,!0)}},[M]),he=F.useMemo(()=>e.nodes.some(R=>R.change!==void 0)||e.edges.some(R=>R.change!==void 0),[e.edges,e.nodes]),sn=F.useMemo(()=>new Set(he?e.nodes.filter(R=>R.change!=="unchanged").sort((R,Ce)=>(Ce.degree??0)-(R.degree??0)||R.id.localeCompare(Ce.id)).slice(0,12).map(R=>R.id):U==="static"?[...e.nodes].sort((R,Ce)=>(Ce.degree??0)-(R.degree??0)||R.id.localeCompare(Ce.id)).slice(0,20).map(R=>R.id):[]),[he,e.nodes,U]),z=F.useMemo(()=>U==="static"?new Set([...e.nodes].sort((R,Ce)=>(Ce.degree??0)-(R.degree??0)||R.id.localeCompare(Ce.id)).slice(0,Gq).map(R=>R.id)):new Set,[e.nodes,U]),me=F.useMemo(()=>he?Jq(e.nodes):new Map,[he,e.nodes]),_e=o==="automatic"?1:h,ke=F.useMemo(()=>o==="automatic"?new Map:Mq(e.nodes,o,e.stats.aggregated),[o,e.nodes,e.stats.aggregated]),Nt=F.useMemo(()=>U==="static"&&!he?Dq(e.nodes,e.stats.aggregated):new Map,[he,e.nodes,e.stats.aggregated,U]),Dt=F.useMemo(()=>typeof document>"u"?void 0:document.body.classList.contains("vscode-high-contrast")||document.body.classList.contains("vscode-high-contrast-light")?Tn("--vscode-contrastBorder","#ffffff"):void 0,[M]),ie=F.useMemo(()=>new Zs(e.nodes.map(R=>{const Ce=R.size??Math.min(40,10+30*(R.degree??1)/te),Qe=he?R.change==="unchanged"?7+5*Math.sqrt((R.degree??1)/te):11+12*Math.sqrt((R.degree??1)/te):Ce,xt=ke.get(R.id)??me.get(R.id)??r?.get(R.id)??Nt.get(R.id),bt=xt?{x:xt.x*_e,y:xt.y*_e}:void 0;return{id:R.id,label:R.label,color:Lx(e,R,void 0,Bx,ae),size:Qe,...bt??{},opacity:R.change==="unchanged"?.58:1,font:{color:"#eef5ff",face:"system-ui",size:he||U==="static"?sn.has(R.id)?12:0:(R.degree??1)>=te*.15?12:0}}})),[sn,he,me,ae,r,_e,te,e,U,ke,Nt]),Te=F.useMemo(()=>new Zs(K.map(R=>{const Ce=Gx(R.change,R.confidence,"#60728b",Bx);return{id:R.id,from:R.source,to:R.target,dashes:Ce.dashes,width:Ce.width,...he&&U!=="static"?{smooth:qq(R.change)}:{},color:{color:Ce.color,opacity:Ce.opacity}}})),[he,K,U]);return F.useEffect(()=>{const R=ne.current;if(!R)return;We.current=null;const Ce=new ve(R,{nodes:ie,edges:Te},U==="static"?Xq:he?Qq:Wq);Ce.setOptions({physics:{enabled:le.current}}),le.current||Ce.stopSimulation(),j.current=Ce,Eq(Ce,{onFocus:bt=>Ee.current.onFocus(bt),onOpenSource:bt=>Ee.current.onOpenSource(bt),onOpenRelationshipSource:bt=>Ee.current.onOpenRelationshipSource(bt),onHover:bt=>Ee.current.onHover(bt),onHoverEdge:bt=>Ee.current.onHoverEdge(bt),onClear:()=>Ee.current.onClear()}),Ce.on("stabilizationIterationsDone",()=>{We.current={position:Ce.getViewPosition(),scale:Ce.getScale()},Ue.current(),L()}),Ce.on("stabilized",L),Ce.on("dragEnd",L),Ce.on("zoom",L),Ce.on("resize",L),Ce.on("animationFinished",L);const Qe=me.size>0||ke.size>0||(r?.size??0)>0||Nt.size>0;!le.current&&Qe&&(Ce.stopSimulation(),Ce.fit({animation:!1}),We.current={position:Ce.getViewPosition(),scale:Ce.getScale()});const xt=window.setTimeout(L,0);return()=>{window.clearTimeout(xt),Ce.destroy(),j.current=null}},[Te,ie,he,me,r,U,ke,Nt,L]),F.useEffect(()=>{const R=j.current;if(!R)return;const Ce=Ze.current;Ze.current=i,R.setOptions({physics:{enabled:i}}),i?(Ce||Kq(R,T.current),R.startSimulation()):R.stopSimulation()},[Te,ie,i]),F.useEffect(()=>{const R=j.current;if(!R||o!=="automatic"||U==="static")return;const Ce=Ae.current;if(Ae.current=h,R.setOptions({physics:he?{barnesHut:{springLength:180*h}}:{forceAtlas2Based:{springLength:120*h}}}),!i&&Ce!==h){const Qe=h/Ce,xt=R.getPositions();ie.update(Object.entries(xt).map(([bt,Bt])=>({id:bt,x:Bt.x*Qe,y:Bt.y*Qe}))),R.redraw(),L()}},[he,h,o,ie,i,L,U]),F.useEffect(()=>{ie.update(e.nodes.map(R=>({id:R.id,hidden:!re.has(R.id)}))),Te.update(K.map(R=>({id:R.id,hidden:!ee.has(R.id)}))),L()},[Te,L,K,e.nodes,ie,ee,re]),F.useEffect(()=>{const R=j.current;if(!R)return;const Ce=t?new Set(R.getConnectedNodes(t).map(String)):new Set;if(ie.update(e.nodes.map(Qe=>{const xt=Qe.id===t,bt=!t||xt||Ce.has(Qe.id),Bt=Qe.change==="unchanged"?.58:1;return{id:Qe.id,opacity:t?bt?Math.max(Bt,.72):.08:Bt,borderWidth:xt?4:Dt?2.5:1.5,color:Lx(e,Qe,Dt,ct,ae),shadow:xt?{enabled:!0,color:Qe.change?ct[Qe.change].border:Qe.color?.background??ae.get(Qe.community)??"#76b7ff",size:24,x:0,y:0}:{enabled:!1}}})),Te.update(K.map(Qe=>{const xt=Gx(Qe.change,Qe.confidence,ye,ct),bt=Qe.source===t||Qe.target===t;return{id:Qe.id,dashes:xt.dashes,color:{color:xt.color,opacity:t?bt?.92:.05:xt.opacity},width:bt?Math.max(3,xt.width):xt.width}})),t)if(R.selectNodes([t]),le.current)R.focus(t,{scale:1.35,animation:window.matchMedia("(prefers-reduced-motion: reduce)").matches?!1:{duration:260,easingFunction:"easeInOutQuad"}});else{const Qe=R.getPositions([t])[t];Qe&&R.moveTo({position:Qe,scale:1.35,animation:!1})}else R.unselectAll()},[Dt,ct,ae,ye,Te,t,e,ie,K]),F.useEffect(()=>{ie.update(e.nodes.map(R=>({id:R.id,font:{color:ue,size:A&&(U!=="static"||z.has(R.id))||R.id===t||(he||U==="static"?sn.has(R.id):(R.degree??1)>=te*.15)?12:0}})))},[sn,he,z,t,A,ue,te,e.nodes,ie,U]),F.useEffect(()=>{Te.update(K.map(R=>({id:R.id,label:I?R.relation:"",font:{align:"middle",color:Be,face:"system-ui",size:10,strokeWidth:3,strokeColor:Tn("--vscode-editor-background",Tn("--background","#08111f"))}})))},[Te,Be,K,I]),F.useImperativeHandle(Q,()=>({fit(){j.current?.fit({animation:Ls(280)})},fitSelection(R){const Ce=j.current;!Ce||R.length===0||Ce.fit({nodes:[...new Set(R)],animation:Ls(240)})},reset(){const R=j.current,Ce=We.current;if(R){if(!Ce){R.fit({animation:!1});return}R.moveTo({position:Ce.position,scale:Ce.scale,animation:!1})}},resetZoom(){j.current?.moveTo({scale:1,animation:Ls(180)})},zoomIn(){const R=j.current;R&&R.moveTo({scale:Math.min(Vq,R.getScale()*1.25),animation:Ls(160)})},zoomOut(){const R=j.current;R&&R.moveTo({scale:Math.max(Px,R.getScale()/1.25),animation:Ls(160)})}}),[]),f.jsxs(f.Fragment,{children:[f.jsx("div",{ref:ne,className:"compass-canvas","data-rendering-profile":U,"data-layout-style":o,"data-physics-running":i?"true":"false","data-isolated":l?"true":"false","data-layout-spacing":h,role:"region","aria-label":"Interactive Compass code graph",onMouseLeave:()=>{O(null),E(null)}}),p&&V?f.jsx(Lq,{model:e,snapshot:V,visibleNodeIds:re,visibleEdgeIds:ee,focusedNodeId:t,onNavigate:R=>j.current?.moveTo({position:R,animation:Ls(180)})}):null]})}),Fx=1,Vx=4;function gJ(n){return Math.max(Fx,Math.min(Vx,Math.trunc(n)))}function oJ(n,e,t,i){const o=gJ(t),r=new Map,A=new Map;for(const h of n.edges){const p=r.get(h.source)??[];p.push(h),r.set(h.source,p);const m=A.get(h.target)??[];m.push(h),A.set(h.target,m)}for(const h of[...r.values(),...A.values()])h.sort((p,m)=>p.id.localeCompare(m.id));const I=new Set([e]),l=new Set;let c=[e];for(let h=0;h0;h+=1){const p=new Set;for(const m of c.sort()){if(i!=="incoming")for(const y of r.get(m)??[])l.add(y.id),I.has(y.target)||p.add(y.target);if(i!=="outgoing")for(const y of A.get(m)??[])l.add(y.id),I.has(y.source)||p.add(y.source)}c=[...p];for(const m of c)I.add(m)}return{nodeIds:I,edgeIds:l}}const Ux={focusedNodeId:null,physicsRunning:!1,layoutStyle:"automatic",initialLayoutPending:!1,forceLabels:!1,showEdgeLabels:!1,isolateSelection:!1,neighborhoodDepth:1,edgeDirection:"both",layoutSpacing:1,showMinimap:!0,hiddenCommunities:new Set,hiddenChanges:new Set,query:""};function sJ(n,e="automatic"){return e!=="automatic"?{...Ux,layoutStyle:e,physicsRunning:!1,initialLayoutPending:!1}:{...Ux,physicsRunning:!1,initialLayoutPending:!1}}function rJ(n,e){switch(e.type){case"focus":return{...n,focusedNodeId:e.nodeId,physicsRunning:!1};case"clearFocus":return{...n,focusedNodeId:null,isolateSelection:!1};case"stabilized":return n.physicsRunning||n.initialLayoutPending?{...n,physicsRunning:!1,initialLayoutPending:!1}:n;case"revealLayout":return{...n,physicsRunning:!1,initialLayoutPending:!1};case"setPhysics":return{...n,physicsRunning:e.running};case"setLayout":return{...n,layoutStyle:e.layout,physicsRunning:e.runPhysics,initialLayoutPending:!1};case"setLabels":return{...n,forceLabels:e.visible};case"setEdgeLabels":return{...n,showEdgeLabels:e.visible};case"setIsolation":return{...n,isolateSelection:e.isolated};case"setNeighborhoodDepth":return{...n,neighborhoodDepth:Math.max(1,Math.min(4,Math.trunc(e.depth)))};case"setEdgeDirection":return{...n,edgeDirection:e.direction};case"setLayoutSpacing":return{...n,layoutSpacing:e.spacing};case"setMinimap":return{...n,showMinimap:e.visible};case"search":return{...n,query:e.query};case"toggleCommunity":{const t=new Set(n.hiddenCommunities);return t.has(e.communityId)?t.delete(e.communityId):t.add(e.communityId),{...n,hiddenCommunities:t}}case"setHiddenCommunities":return{...n,hiddenCommunities:new Set(e.communityIds)};case"toggleChange":{const t=new Set(n.hiddenChanges);return t.has(e.change)?t.delete(e.change):t.add(e.change),{...n,hiddenChanges:t}}}}const aJ=[{value:"added",label:"Added"},{value:"removed",label:"Removed"},{value:"changed",label:"Changed"},{value:"unchanged",label:"Context"}],AJ={hierarchical:"Depth-layer layout",circle:"Circle layout",concentric:"Concentric layout",spiral:"Spiral layout",grid:"Square grid layout"},_u=["both","outgoing","incoming"];function CJ(n){return n instanceof HTMLElement&&(n.isContentEditable||n.tagName==="INPUT"||n.tagName==="TEXTAREA"||n.tagName==="SELECT")}function ju({model:n,host:e,communityDetail:t,communityLoading:i,communityError:o,onBackToOverview:r,sourceRevisions:A,queryResult:I,initialInspectorLayout:l,onInspectorLayoutChange:c,preferredLayout:h="automatic",toolbarLeading:p,toolbarLeadingPanel:m,toolbarLeadingOpen:y,onToolbarLeadingClose:w,stageOverlay:S,showInspectorHeader:x=!0}){const[O,E]=F.useState(()=>vv(l)),_=F.useCallback(ne=>{const j=vv(ne);E(j),c?.(j)},[c]),P=t?.model??n,Q=t?`community-${t.communityId}`:"overview";return f.jsx(IJ,{model:P,host:e,detailCommunityId:t?.communityId,communityLoading:i,communityError:o,onBackToOverview:t?r:void 0,bounded:t?.bounded,sourceRevisions:A,queryResult:I,inspectorLayout:O,onInspectorLayoutChange:_,preferredLayout:h,toolbarLeading:p,toolbarLeadingPanel:m,toolbarLeadingOpen:y,onToolbarLeadingClose:w,stageOverlay:S,showInspectorHeader:x},Q)}function IJ({model:n,host:e,detailCommunityId:t,communityLoading:i,communityError:o,onBackToOverview:r,bounded:A,sourceRevisions:I,queryResult:l,inspectorLayout:c,onInspectorLayoutChange:h,preferredLayout:p,toolbarLeading:m,toolbarLeadingPanel:y,toolbarLeadingOpen:w,onToolbarLeadingClose:S,stageOverlay:x,showInspectorHeader:O}){const[E,_]=F.useReducer(rJ,n,ie=>sJ(ie,p)),[P,Q]=F.useState(null),[ne,j]=F.useState(null),V=F.useRef(null),de=F.useRef(e);de.current=e;const le=F.useMemo(()=>new Map(n.nodes.map(ie=>[ie.id,ie])),[n.nodes]),Ze=F.useMemo(()=>new Map(n.edges.map(ie=>[ie.id,ie])),[n.edges]),Ee=F.useMemo(()=>{const ie=new Map,Te=new Map;for(const R of n.edges){const Ce=ie.get(R.source)??new Set;Ce.add(R.target),ie.set(R.source,Ce);const Qe=ie.get(R.target)??new Set;Qe.add(R.source),ie.set(R.target,Qe);const xt=Te.get(R.source)??[];xt.push(R),Te.set(R.source,xt);const bt=Te.get(R.target)??[];bt.push(R),Te.set(R.target,bt)}return{neighborIds:ie,edges:Te}},[n.edges]),Ue=F.useMemo(()=>n.nodes.map(ie=>({node:ie,text:[ie.label,ie.source?.file,ie.kind].filter(Te=>Te!==void 0).join(` -`).toLocaleLowerCase()})),[n.nodes]),We=F.useMemo(()=>_x(n).length,[n]),Ae=E.focusedNodeId?le.get(E.focusedNodeId):void 0,M=F.useMemo(()=>Ae?oJ(n,Ae.id,E.neighborhoodDepth,E.edgeDirection):null,[n,Ae,E.edgeDirection,E.neighborhoodDepth]),U=P?le.get(P.nodeId):void 0,K=U?yv(n,U,t):void 0,re=ne?Ze.get(ne.edgeId):void 0,ee=re?le.get(re.source):void 0,T=re?le.get(re.target):void 0,L=F.useMemo(()=>n.nodes.some(ie=>ie.change!==void 0)||n.edges.some(ie=>ie.change!==void 0),[n.edges,n.nodes]),te=F.useMemo(()=>{const ie=new Map;for(const Te of n.nodes){const R=Te.change??"unchanged";ie.set(R,(ie.get(R)??0)+1)}return ie},[n.nodes]),ae=F.useMemo(()=>Ae?[...Ee.neighborIds.get(Ae.id)??[]].map(ie=>le.get(ie)).filter(ie=>ie!==void 0).sort((ie,Te)=>ie.label.localeCompare(Te.label)):[],[Ee.neighborIds,le,Ae]),ue=F.useMemo(()=>Ae?Ee.edges.get(Ae.id)??[]:[],[Ee.edges,Ae]),ye=F.useDeferredValue(E.query),Be=F.useMemo(()=>{const ie=ye.trim().toLocaleLowerCase();if(!ie)return[];const Te=[];for(const R of Ue)if(R.text.includes(ie)&&Te.push(R.node),Te.length===20)break;return Te},[ye,Ue]),ct=F.useCallback(ie=>{Q(null),j(null),_({type:"focus",nodeId:ie})},[]),he=F.useCallback(()=>{Q(null),j(null),_({type:"clearFocus"})},[]);F.useEffect(()=>{E.focusedNodeId&&!le.has(E.focusedNodeId)&&he()},[he,le,E.focusedNodeId]),F.useEffect(()=>{const ie=Te=>{if(Te.metaKey||Te.ctrlKey||Te.altKey||CJ(Te.target))return;const R=Te.key.toLocaleLowerCase();let Ce=!0;if(R==="f")Te.shiftKey&&M?V.current?.fitSelection([...M.nodeIds]):Te.shiftKey?Ce=!1:V.current?.fit();else if(R==="+"||R==="=")V.current?.zoomIn();else if(R==="-"||R==="_")V.current?.zoomOut();else if(R==="0")V.current?.resetZoom();else if(R==="i"&&Ae)_({type:"setIsolation",isolated:!E.isolateSelection});else if(R==="[")_({type:"setNeighborhoodDepth",depth:Math.max(Fx,E.neighborhoodDepth-1)});else if(R==="]")_({type:"setNeighborhoodDepth",depth:Math.min(Vx,E.neighborhoodDepth+1)});else if(R==="d"){const Qe=_u.indexOf(E.edgeDirection);_({type:"setEdgeDirection",direction:_u[(Qe+1)%_u.length]??"both"})}else R==="m"?_({type:"setMinimap",visible:!E.showMinimap}):Ce=!1;Ce&&Te.preventDefault()};return document.addEventListener("keydown",ie,{capture:!0}),()=>document.removeEventListener("keydown",ie,{capture:!0})},[Ae,M,E.edgeDirection,E.isolateSelection,E.neighborhoodDepth,E.showMinimap]);const sn=F.useCallback(()=>{_({type:"stabilized"})},[]),z=F.useCallback(()=>{_({type:"revealLayout"})},[]),me=F.useCallback(ie=>{const Te=le.get(ie);if(!Te)return;const R=yv(n,Te,t);R.type==="community"&&de.current.openCommunity?.(R.communityId),R.type==="source"&&de.current.openSource(R.source,Te.change==="removed"?I?.before:I?.after)},[t,le,n.stats.aggregated,I?.after,I?.before]),_e=F.useCallback(ie=>{const Te=Ze.get(ie);if(!Te)return;const R=Av(Te);R&&de.current.openSource(R,Te.change==="removed"?I?.before:I?.after)},[Ze,I?.after,I?.before]),ke=Ae&&E.isolateSelection&&M?`Isolated ${M.nodeIds.size} nodes · ${E.neighborhoodDepth} hop${E.neighborhoodDepth===1?"":"s"}`:Ae?`Inspecting ${Ae.label}`:E.layoutStyle!=="automatic"?AJ[E.layoutStyle]:E.physicsRunning?"Layout running":"Layout static",Nt=i!=null?n.communities.find(ie=>ie.id===i):void 0,Dt=i!=null?{kind:"community",communityLabel:Nt?.label??`Community ${i}`}:E.initialLayoutPending?{kind:"layout"}:null;return f.jsxs("div",{className:"compass-workspace",style:{"--compass-inspector-width":`${c.width}px`},children:[f.jsxs("div",{className:"compass-workspace-content","data-inspector-collapsed":c.collapsed,inert:Dt?!0:void 0,"aria-hidden":Dt?!0:void 0,children:[f.jsxs("main",{className:"compass-graph-stage","data-comparison":L?"true":"false",children:[f.jsx(iJ,{ref:V,model:n,focusedNodeId:Ae?.id??null,physicsRunning:E.physicsRunning,layoutStyle:E.layoutStyle,forceLabels:E.forceLabels,showEdgeLabels:E.showEdgeLabels,isolatedNodeIds:E.isolateSelection?M?.nodeIds:void 0,isolatedEdgeIds:E.isolateSelection?M?.edgeIds:void 0,layoutSpacing:E.layoutSpacing,showMinimap:E.showMinimap,hiddenCommunities:E.hiddenCommunities,hiddenChanges:E.hiddenChanges,onFocus:ct,onOpenSource:me,onOpenRelationshipSource:_e,onHover:Q,onHoverEdge:j,onClear:he,onStabilized:sn}),x,f.jsx(R3,{status:ke,physicsRunning:E.physicsRunning,layoutStyle:E.layoutStyle,forceLabels:E.forceLabels,showEdgeLabels:E.showEdgeLabels,hasSelection:Ae!==void 0,isolateSelection:E.isolateSelection,neighborhoodDepth:E.neighborhoodDepth,edgeDirection:E.edgeDirection,layoutSpacing:E.layoutSpacing,showMinimap:E.showMinimap,leadingControls:m,leadingPanel:y,leadingPanelOpen:w,onLeadingPanelClose:S,onTogglePhysics:()=>_({type:"setPhysics",running:!E.physicsRunning}),onLayoutChange:ie=>_({type:"setLayout",layout:ie,runPhysics:!1}),onZoomOut:()=>V.current?.zoomOut(),onResetZoom:()=>V.current?.resetZoom(),onZoomIn:()=>V.current?.zoomIn(),onFit:()=>V.current?.fit(),onFitSelection:()=>{M&&V.current?.fitSelection([...M.nodeIds])},onReset:()=>{he(),_({type:"setIsolation",isolated:!1}),V.current?.reset()},onToggleLabels:()=>_({type:"setLabels",visible:!E.forceLabels}),onToggleEdgeLabels:()=>_({type:"setEdgeLabels",visible:!E.showEdgeLabels}),onToggleIsolation:()=>{const ie=!E.isolateSelection;_({type:"setIsolation",isolated:ie}),ie&&M&&window.requestAnimationFrame(()=>{V.current?.fitSelection([...M.nodeIds])})},onNeighborhoodDepthChange:ie=>_({type:"setNeighborhoodDepth",depth:ie}),onEdgeDirectionChange:ie=>_({type:"setEdgeDirection",direction:ie}),onLayoutSpacingChange:ie=>_({type:"setLayoutSpacing",spacing:ie}),onToggleMinimap:()=>_({type:"setMinimap",visible:!E.showMinimap}),onBack:r}),L&&f.jsx("div",{className:"compass-change-legend","aria-label":"Graph change filters",children:aJ.filter(({value:ie})=>(te.get(ie)??0)>0).map(({value:ie,label:Te})=>{const R=!E.hiddenChanges.has(ie);return f.jsxs("button",{type:"button","data-change":ie,"aria-pressed":R,onClick:()=>_({type:"toggleChange",change:ie}),children:[f.jsx("span",{"aria-hidden":"true"}),Te,f.jsx("small",{children:te.get(ie)??0})]},ie)})}),o&&f.jsx("div",{className:"absolute bottom-4 left-4 z-20 max-w-md rounded-md border border-destructive/50 bg-background/95 px-3 py-2 text-sm text-destructive shadow-lg",role:"alert",children:o}),A&&f.jsxs("div",{className:"compass-bounded-notice",role:"status",children:[f.jsx("strong",{children:"Partial community comparison"}),f.jsxs("span",{children:["This view is limited to ",A.limit.toLocaleString()," nodes. Increase"," ",f.jsx("code",{children:"compass.graphNodeLimit"})," to inspect all"," ",Math.max(A.parentMembers,A.currentMembers).toLocaleString()," symbols."]})]}),P&&U&&K&&f.jsx(P3,{node:U,hover:P,activation:K}),ne&&re&&ee&&T&&f.jsx(Y3,{edge:re,sourceNode:ee,targetNode:T,hover:ne})]}),!c.collapsed&&f.jsx(Z3,{width:c.width,onResize:ie=>h({...c,width:ie})}),f.jsx(D3,{model:n,selected:Ae,neighbors:ae,connectedEdges:ue,query:E.query,matches:Be,hiddenCommunities:E.hiddenCommunities,comparisonMode:L,sourceRevisions:I,queryResult:l,renderedEdgeCount:We,showHeader:O,onQueryChange:ie=>_({type:"search",query:ie}),onFocus:ct,onOpenSource:e.openSource,onOpenCommunity:t===void 0?e.openCommunity:void 0,onQueryNode:e.queryNode,onToggleCommunity:ie=>_({type:"toggleCommunity",communityId:ie}),onSetAllVisible:ie=>_({type:"setHiddenCommunities",communityIds:ie?[]:n.communities.map(Te=>Te.id)}),collapsed:c.collapsed,onToggleCollapsed:()=>h({...c,collapsed:!c.collapsed})})]}),Dt?.kind==="community"?f.jsx(hv,{kind:"community",communityLabel:Dt.communityLabel}):Dt?.kind==="layout"?f.jsx(hv,{kind:"layout",onShowGraph:z}):null]})}const Zu=224,lJ=76,II=124,Bu=96,Gs=96,cJ=288,dJ=112,Pu=12;function uJ(n,e,t={width:1280,height:620},i={},o){const r=n.filter(j=>j.nodeCount>0||j.incomingCalls>0||j.outgoingCalls>0);if(r.length===0)return{width:t.width,height:t.height,nodes:[],routes:[],lanes:[]};const A=new Set(r.map(j=>j.id)),I=e.filter(j=>A.has(j.sourceSection)&&A.has(j.targetSection)),l=hJ(r,I),c=l.length,h=Math.max(t.width,Gs*2+cJ*c),p=(h-Gs*2)/c;mJ(l,I);const m=Math.max(...l.map(j=>j.length)),y=Math.max(t.height,II+Bu+m*dJ),w=l.findIndex(j=>j.some(V=>V.id===o)),S=Array.from({length:c},(j,V)=>({index:V,x:Gs+p*V,width:p,label:xJ(V,c,w<0?void 0:w)})),x=y-II-Bu,O=l.flatMap((j,V)=>{const de=x/Math.max(1,j.length);return j.map((le,Ze)=>{const Ee={x:Gs+p*V+p/2,y:II+de*Ze+de/2},Ue=i[le.id]??Ee;return{...le,x:Lu(Ue.x,Gs+Zu/2,h-Gs-Zu/2),y:Lu(Ue.y,II,y-Bu),width:Math.min(Zu,p-40),height:lJ,column:wJ(Ue.x,S)}})}),E=new Map(O.map(j=>[j.id,j])),_=yJ(I,E),P=Wx(I,E,"source"),Q=Wx(I,E,"target"),ne=I.flatMap(j=>{const V=E.get(j.sourceSection),de=E.get(j.targetSection);if(!V||!de)return[];const le=Qx(V,de);return[{...j,direction:le,path:vJ(V,de,le,_.get(j.id)??0,{height:y},P.get(j.id)??0,Q.get(j.id)??0),width:1+Math.min(4.4,Math.log10(j.calls+1)*1.35)}]});return{width:h,height:y,nodes:O,routes:ne,lanes:S}}function hJ(n,e){if(n.length===1)return[[n[0]]];if(e.length===0)return Yx(n);const t=fJ(n,e),i=new Map(t.map((c,h)=>[c.id,h])),o=new Map;for(const c of n)o.set(c.id,[]);for(const c of e)(i.get(c.sourceSection)??0)<(i.get(c.targetSection)??0)&&c.sourceSection!==c.targetSection&&o.get(c.targetSection)?.push(c);const r=new Map;for(const c of t){const h=(o.get(c.id)??[]).map(p=>(r.get(p.sourceSection)??0)+1);r.set(c.id,h.length>0?Math.max(...h):0)}const A=Math.max(0,...r.values()),I=Math.min(Pu,A+1);if(I===1)return Yx(n);const l=Array.from({length:I},()=>[]);for(const c of t){const h=r.get(c.id)??0,p=Ac.length>0)}function fJ(n,e){const t=new Map(n.map(A=>[A.id,A])),i=new Set(t.keys()),o=[],r=[];for(;i.size>0;){const A=pJ(i,e),I=[...i].map(p=>({section:t.get(p),incoming:A.incoming.get(p)??0,outgoing:A.outgoing.get(p)??0})),l=I.filter(p=>p.incoming===0),c=I.filter(p=>p.outgoing===0);if(l.length>0){const p=l.sort((m,y)=>y.outgoing-m.outgoing||Za(m.section,y.section))[0];o.push(p.section),i.delete(p.section.id);continue}if(c.length>0){const p=c.sort((m,y)=>y.incoming-m.incoming||Za(m.section,y.section))[0];r.unshift(p.section),i.delete(p.section.id);continue}const h=I.sort((p,m)=>m.outgoing-m.incoming-(p.outgoing-p.incoming)||m.outgoing+m.incoming-(p.outgoing+p.incoming)||Za(p.section,m.section))[0];o.push(h.section),i.delete(h.section.id)}return[...o,...r]}function pJ(n,e){const t=new Map,i=new Map;for(const o of e){if(o.sourceSection===o.targetSection||!n.has(o.sourceSection)||!n.has(o.targetSection))continue;const r=1+Math.log10(o.calls+1);i.set(o.sourceSection,(i.get(o.sourceSection)??0)+r),t.set(o.targetSection,(t.get(o.targetSection)??0)+r)}return{incoming:t,outgoing:i}}function Yx(n){const e=Math.min(6,Math.max(2,Math.ceil(Math.sqrt(n.length)))),t=Array.from({length:e},()=>[]);return[...n].sort(Za).forEach((i,o)=>{t[Math.floor(o*e/n.length)].push(i)}),t}function mJ(n,e){const t=new Map;for(const i of e)Hx(t,i.sourceSection,i.targetSection,i.calls),Hx(t,i.targetSection,i.sourceSection,i.calls);for(let i=0;i<8;i+=1)for(const o of[1,-1]){const r=o===1?1:n.length-2,A=o===1?n.length:-1;for(let I=r;I!==A;I+=o){const l=new Map,c=o===1?n.slice(0,I):n.slice(I+1);for(const p of c)p.forEach((m,y)=>{l.set(m.id,p.length===1?.5:y/(p.length-1))});const h=new Map(n[I].map((p,m,y)=>[p.id,y.length===1?.5:m/(y.length-1)]));n[I].sort((p,m)=>{const y=Kx(p.id,t,l),w=Kx(m.id,t,l);return(y??h.get(p.id)??.5)-(w??h.get(m.id)??.5)||Za(p,m)})}}}function Hx(n,e,t,i){const o=n.get(e)??new Map;o.set(t,(o.get(t)??0)+i),n.set(e,o)}function Kx(n,e,t){let i=0,o=0;for(const[r,A]of e.get(n)??[]){const I=t.get(r);I!==void 0&&(i+=I*A,o+=A)}return o>0?i/o:void 0}function vJ(n,e,t,i,o,r,A){const I=n.y+r,l=e.y+A;if(t==="forward"){const w=n.x+n.width/2,S=e.x-e.width/2,x=Math.max(1,S-w),O=Lu(x*.42,42,168),E=SJ(i%9,1.5);return[`M ${w} ${I}`,`C ${w+O} ${I+E}`,`${S-O} ${l+E}`,`${S} ${l}`].join(" ")}if(t==="backward"){const w=n.x-n.width/2,S=e.x+e.width/2,x=(I+l)/2{const I=e.get(r.sourceSection),l=e.get(A.sourceSection),c=e.get(r.targetSection),h=e.get(A.targetSection);return(I?.column??0)-(l?.column??0)||(c?.column??0)-(h?.column??0)||(I?.y??0)-(l?.y??0)||(c?.y??0)-(h?.y??0)||A.calls-r.calls||r.id.localeCompare(A.id)});for(const r of o){const A=e.get(r.sourceSection),I=e.get(r.targetSection);if(!A||!I)continue;const l=Qx(A,I),c=`${Math.min(A.column,I.column)}:${Math.max(A.column,I.column)}:${l}`,h=i.get(c)??0;t.set(r.id,h),i.set(c,h+1)}return t}function Wx(n,e,t){const i=new Map;for(const r of n){const A=t==="source"?r.sourceSection:r.targetSection,I=i.get(A)??[];I.push(r),i.set(A,I)}const o=new Map;for(const r of i.values()){r.sort((I,l)=>{const c=e.get(t==="source"?I.targetSection:I.sourceSection),h=e.get(t==="source"?l.targetSection:l.sourceSection);return(c?.y??0)-(h?.y??0)||(c?.x??0)-(h?.x??0)||I.id.localeCompare(l.id)});const A=Math.min(8,38/Math.max(1,r.length-1));r.forEach((I,l)=>{o.set(I.id,(l-(r.length-1)/2)*A)})}return o}function bJ(n,e,t,i,o){const r=Math.sign(i-e)||1,A=Math.sign(o-t)||1,I=Math.min(12,Math.abs(i-e)/2,Math.abs(t-n)/2);return[`M ${n} ${e}`,`H ${t-Math.sign(t-n)*I}`,`Q ${t} ${e} ${t} ${e+r*I}`,`V ${i-r*I}`,`Q ${t} ${i} ${t+A*I} ${i}`,`H ${o}`].join(" ")}function Qx(n,e){return e.column>n.column?"forward":e.column$x(i)),A=F.useRef(o),[I,l]=F.useState(1),[c,h]=F.useState("none"),p=F.useRef("none"),m=F.useRef(0),[y,w]=F.useState(TJ),[S,x]=F.useState("key"),[O,E]=F.useState(),_=F.useRef(null),P=F.useRef(void 0),Q=F.useRef(void 0);F.useEffect(()=>{const z=$x(i);A.current=z,r(z),l(1),p.current="start",m.current=0,h("start"),_.current?.scrollTo?.({left:0,top:0}),x("key")},[i]);const ne=F.useMemo(()=>DJ(n.routes,e),[n.routes,e]),j=F.useMemo(()=>S==="complete"?{routes:n.routes,reciprocals:new Map}:MJ(n.routes.filter(z=>ne.has(z.id)),e?.kind==="route"?e.id:void 0),[ne,n.routes,S,e]),V=j.routes,de=F.useMemo(()=>{if(S==="complete"||e===void 0)return n.sections;const z=new Set;e.kind==="section"&&z.add(e.id);for(const me of V)z.add(me.sourceSection),z.add(me.targetSection);return n.sections.filter(me=>z.has(me.id))},[n.sections,S,V,e]),le=F.useMemo(()=>uJ(de,V,y,o,S==="key"&&e?.kind==="section"?e.id:void 0),[de,o,S,V,e,y]),Ze=le.routes,Ee=F.useMemo(()=>e?.kind!=="section"?new Set:new Set(Ze.filter(z=>z.sourceSection===e.id||z.targetSection===e.id).flatMap(z=>[z.id,z.sourceSection,z.targetSection])),[Ze,e]),Ue=Math.max(1,...Ze.map(z=>z.calls)),We=n.routes.length-Ze.length,Ae={width:Math.round(le.width*I),height:Math.round(le.height*I)},M=z=>{t(z)},U=(z,me)=>{(z.key==="Enter"||z.key===" ")&&(z.preventDefault(),M(me))},K=(z,me)=>{const _e={...A.current,[z]:me};A.current=_e,r(_e)},re=()=>{try{window.localStorage.setItem(i,JSON.stringify(A.current))}catch{}},ee=()=>{A.current={},r({});try{window.localStorage.removeItem(i)}catch{}},T=()=>{l(1),p.current="start",m.current=0,h("start");const z=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;_.current?.scrollTo?.({left:0,top:0,behavior:z?"auto":"smooth"})},L=z=>{const me=Math.max(0,z.scrollWidth-z.clientWidth),_e=me<=1?"none":z.scrollLeft<=1?"start":z.scrollLeft>=me-1?"end":"middle";m.current=me,p.current=_e,h(ke=>ke===_e?ke:_e)},te=z=>{L(z.currentTarget)},ae=z=>{z.target!==z.currentTarget||!_.current||(P.current={x:z.clientX,y:z.clientY,scrollLeft:_.current.scrollLeft,scrollTop:_.current.scrollTop,pointerId:z.pointerId},z.currentTarget.setPointerCapture(z.pointerId))},ue=z=>{const me=P.current,_e=_.current;!me||!_e||me.pointerId!==z.pointerId||(_e.scrollLeft=me.scrollLeft-(z.clientX-me.x),_e.scrollTop=me.scrollTop-(z.clientY-me.y))},ye=z=>{P.current?.pointerId===z.pointerId&&(P.current=void 0,z.currentTarget.hasPointerCapture(z.pointerId)&&z.currentTarget.releasePointerCapture(z.pointerId))},Be=(z,me)=>{z.stopPropagation();const _e=Xx(z.currentTarget.ownerSVGElement,z);_e&&(Q.current={id:me.id,pointerId:z.pointerId,offsetX:_e.x-me.x,offsetY:_e.y-me.y,startClientX:z.clientX,startClientY:z.clientY,moved:!1},E(me.id),z.currentTarget.setPointerCapture(z.pointerId))},ct=(z,me)=>{const _e=Q.current;!_e||_e.id!==me.id||_e.pointerId!==z.pointerId||(z.currentTarget.hasPointerCapture(z.pointerId)&&z.currentTarget.releasePointerCapture(z.pointerId),Q.current=void 0,E(void 0),_e.moved?re():M({kind:"section",id:me.id}))},he=z=>{Q.current?.pointerId===z.pointerId&&(Q.current=void 0,E(void 0))},sn=(z,me)=>{if(z.key==="Enter"||z.key===" "){z.preventDefault(),M({kind:"section",id:me.id});return}if(!z.altKey||!z.key.startsWith("Arrow"))return;z.preventDefault();const _e=z.shiftKey?24:8;K(me.id,{x:me.x+(z.key==="ArrowRight"?_e:z.key==="ArrowLeft"?-_e:0),y:me.y+(z.key==="ArrowDown"?_e:z.key==="ArrowUp"?-_e:0)}),re()};return F.useEffect(()=>{const z=_.current;if(!z)return;const me=()=>{const ke=m.current,Nt=Math.max(0,z.scrollWidth-z.clientWidth),Dt=ke>1&&z.scrollLeft>=ke-1;if(Nt>ke&&(p.current==="end"||Dt)&&(z.scrollLeft=Nt),L(z),z.clientWidth<=0||z.clientHeight<=0)return;const ie={width:Math.round(z.clientWidth),height:Math.round(z.clientHeight)};w(Te=>Te.width===ie.width&&Te.height===ie.height?Te:ie)};if(me(),typeof ResizeObserver>"u")return;const _e=new ResizeObserver(me);return _e.observe(z),()=>_e.disconnect()},[Ae.height,Ae.width]),f.jsxs("section",{className:"architecture-map-panel","aria-labelledby":"architecture-map-title","data-route-mode":S,children:[f.jsxs("header",{className:"architecture-map-header",children:[f.jsxs("div",{className:"architecture-map-intro",children:[f.jsx("span",{children:"Flow canvas"}),f.jsx("strong",{id:"architecture-map-title",children:"Subsystem call direction"}),f.jsx("small",{id:"architecture-map-help",children:"Scroll sideways or drag open canvas space to follow the complete architecture."})]}),f.jsxs("div",{className:"architecture-map-actions",children:[f.jsxs("div",{className:"architecture-route-mode",role:"group","aria-label":"Route visibility",children:[f.jsx("button",{type:"button","aria-pressed":S==="key",onClick:()=>x("key"),children:e?.kind==="section"?"Neighbors":"Key routes"}),f.jsxs("button",{type:"button","aria-pressed":S==="complete",onClick:()=>x("complete"),children:["All routes · ",n.routes.length]})]}),f.jsxs("div",{className:"architecture-map-toolbar","aria-label":"Map controls",children:[f.jsx("button",{type:"button","aria-label":"Zoom out",onClick:()=>l(z=>Math.max(.75,z-.25)),children:f.jsx(t3,{"aria-hidden":"true"})}),f.jsxs("span",{"aria-live":"polite",children:[Math.round(I*100),"%"]}),f.jsx("button",{type:"button","aria-label":"Zoom in",onClick:()=>l(z=>Math.min(2,z+.25)),children:f.jsx(Um,{"aria-hidden":"true"})}),f.jsx("button",{type:"button","aria-label":"Reset zoom and scroll position",title:"Reset zoom and scroll position",onClick:T,children:f.jsx(Gm,{"aria-hidden":"true"})}),f.jsx("button",{type:"button","aria-label":"Reset subsystem positions",title:"Reset subsystem positions",disabled:Object.keys(o).length===0,onClick:ee,children:f.jsx(Ym,{"aria-hidden":"true"})})]})]})]}),f.jsx("div",{ref:_,className:"architecture-map-viewport",role:"region","aria-label":"Scrollable architecture flow diagram","aria-describedby":"architecture-map-help",tabIndex:0,"data-scroll-position":c,onScroll:te,children:le.nodes.length>0?f.jsx("div",{className:"architecture-map-canvas",style:{width:Ae.width,height:Ae.height},children:f.jsxs("svg",{className:"architecture-map",viewBox:`0 0 ${le.width} ${le.height}`,role:"group","aria-label":kJ(le.nodes.length,Ze.length,n.routes.length),onPointerDown:ae,onPointerMove:ue,onPointerUp:ye,onPointerCancel:()=>{P.current=void 0},children:[f.jsxs("defs",{children:[f.jsx("marker",{id:"architecture-arrow",className:"architecture-arrow architecture-arrow-default",markerWidth:"8",markerHeight:"8",refX:"7",refY:"4",orient:"auto-start-reverse",markerUnits:"userSpaceOnUse",children:f.jsx("path",{d:"M 0 0 L 8 4 L 0 8 z"})}),f.jsx("marker",{id:"architecture-arrow-incoming",className:"architecture-arrow architecture-arrow-incoming",markerWidth:"8",markerHeight:"8",refX:"7",refY:"4",orient:"auto-start-reverse",markerUnits:"userSpaceOnUse",children:f.jsx("path",{d:"M 0 0 L 8 4 L 0 8 z"})}),f.jsx("marker",{id:"architecture-arrow-outgoing",className:"architecture-arrow architecture-arrow-outgoing",markerWidth:"8",markerHeight:"8",refX:"7",refY:"4",orient:"auto-start-reverse",markerUnits:"userSpaceOnUse",children:f.jsx("path",{d:"M 0 0 L 8 4 L 0 8 z"})})]}),f.jsxs("g",{className:"architecture-map-lanes","aria-hidden":"true",children:[le.lanes.map(z=>f.jsxs("g",{children:[f.jsx("rect",{x:z.x+8,y:34,width:z.width-16,height:le.height-76,rx:"12"}),f.jsx("text",{x:z.x+z.width/2,y:61,children:z.label})]},z.index)),f.jsx("text",{className:"architecture-map-direction",x:96,y:24,children:"PRIMARY CALL DIRECTION →"})]}),f.jsx("g",{className:"architecture-routes",children:Ze.map(z=>{const me=j.reciprocals.get(z.id),_e=e?.kind==="route"&&e.id===z.id,ke=_e||e===void 0||e.kind==="section"&&Ee.has(z.id),Nt=z.inferred>z.extracted?"inferred":"extracted",Dt=e?.kind==="section"?z.targetSection===e.id?"incoming":z.sourceSection===e.id?"outgoing":void 0:void 0,ie=S==="key"?.3+Math.sqrt(z.calls/Ue)*.28:.1+Math.sqrt(z.calls/Ue)*.2;return f.jsxs("g",{role:"button",tabIndex:0,"aria-label":`${z.sourceSection} to ${z.targetSection}, ${z.calls} calls${me?`; bidirectional, ${me.calls} reverse calls`:""}${z.direction==="backward"?", feedback route":""}`,"data-direction":z.direction,"data-evidence":Nt,"data-reciprocal":me?"true":void 0,"data-focus-direction":Dt,"data-selected":_e||void 0,"data-dimmed":!ke||void 0,onClick:()=>M({kind:"route",id:z.id}),onKeyDown:Te=>U(Te,{kind:"route",id:z.id}),children:[f.jsx("path",{className:"architecture-route-hit",d:z.path}),f.jsx("path",{className:"architecture-route-line",d:z.path,style:{strokeWidth:z.width,"--architecture-route-opacity":ie},markerStart:me?zJ(Dt):void 0,markerEnd:Dt==="incoming"?"url(#architecture-arrow-incoming)":Dt==="outgoing"?"url(#architecture-arrow-outgoing)":"url(#architecture-arrow)"}),f.jsxs("title",{children:[z.sourceSection," → ",z.targetSection,": ",z.calls," calls",me&&` · ${me.sourceSection} → ${me.targetSection}: ${me.calls} calls`]})]},z.id)})}),f.jsx("g",{className:"architecture-map-nodes",children:le.nodes.map(z=>{const me=e?.kind==="section"&&e.id===z.id,_e=me||e===void 0||e.kind==="section"&&Ee.has(z.id)||e.kind==="route"&&n.routes.some(ke=>ke.id===e.id&&(ke.sourceSection===z.id||ke.targetSection===z.id));return f.jsxs("g",{role:"button",tabIndex:0,"aria-label":`${z.name}, ${z.nodeCount} visible symbols, ${z.incomingCalls} incoming and ${z.outgoingCalls} outgoing calls; drag to reposition`,transform:`translate(${z.x-z.width/2} ${z.y-z.height/2})`,"data-selected":me||void 0,"data-dimmed":!_e||void 0,"data-dragging":O===z.id||void 0,onPointerDown:ke=>Be(ke,z),onPointerMove:ke=>{const Nt=Q.current;if(!Nt||Nt.id!==z.id||Nt.pointerId!==ke.pointerId)return;const Dt=Xx(ke.currentTarget.ownerSVGElement,ke);Dt&&((Math.abs(ke.clientX-Nt.startClientX)>3||Math.abs(ke.clientY-Nt.startClientY)>3)&&(Nt.moved=!0),K(z.id,{x:Dt.x-Nt.offsetX,y:Dt.y-Nt.offsetY}))},onPointerUp:ke=>ct(ke,z),onPointerCancel:ke=>he(ke),onKeyDown:ke=>sn(ke,z),children:[f.jsx("rect",{className:"architecture-map-node-shadow",width:z.width,height:z.height,rx:"9"}),f.jsx("rect",{className:"architecture-map-node-card",width:z.width,height:z.height,rx:"9"}),f.jsx("rect",{className:"architecture-map-node-accent",width:"4",height:z.height-16,x:"8",y:"8",rx:"2"}),f.jsx("text",{x:"20",y:"27",className:"architecture-map-node-name",children:NJ(z.name,24)}),f.jsxs("text",{x:"20",y:"48",className:"architecture-map-node-meta",children:[z.nodeCount.toLocaleString()," symbols"," · ","↓",z.incomingCalls.toLocaleString()," ↑",z.outgoingCalls.toLocaleString()]}),f.jsxs("g",{className:"architecture-map-node-grip","aria-hidden":"true",children:[f.jsx("circle",{cx:z.width-18,cy:"26",r:"1.2"}),f.jsx("circle",{cx:z.width-13,cy:"26",r:"1.2"}),f.jsx("circle",{cx:z.width-18,cy:"31",r:"1.2"}),f.jsx("circle",{cx:z.width-13,cy:"31",r:"1.2"}),f.jsx("circle",{cx:z.width-18,cy:"36",r:"1.2"}),f.jsx("circle",{cx:z.width-13,cy:"36",r:"1.2"})]}),f.jsxs("title",{children:[z.name," — drag to reposition"]})]},z.id)})})]})}):f.jsxs("div",{className:"architecture-map-empty",children:[f.jsx("strong",{children:"No architecture to draw"}),f.jsx("span",{children:"No subsystems match the current scope and evidence filters."})]})}),f.jsxs("footer",{className:"architecture-map-footer",children:[f.jsxs("div",{className:"architecture-map-legend","aria-label":"Map legend",children:[f.jsxs("span",{children:[f.jsx("i",{"data-evidence":"extracted"})," Extracted"]}),f.jsxs("span",{children:[f.jsx("i",{"data-evidence":"inferred"})," Inferred"]}),f.jsxs("span",{children:[f.jsx("i",{"data-direction":"incoming"})," Incoming"]}),f.jsxs("span",{children:[f.jsx("i",{"data-direction":"outgoing"})," Outgoing"]}),f.jsxs("span",{children:[f.jsx("i",{"data-direction":"bidirectional","aria-hidden":"true",children:"↔"})," Bidirectional"]}),f.jsxs("span",{children:[f.jsx("i",{"data-direction":"feedback"})," Feedback"]}),f.jsxs("span",{children:[f.jsx(n3,{"aria-hidden":"true"})," Drag cards to arrange"]}),We>0&&f.jsxs("button",{type:"button",onClick:()=>x("complete"),children:[Ze.length," of ",n.routes.length," routes · Show all"]})]}),f.jsxs("details",{className:"architecture-map-table",children:[f.jsx("summary",{children:"View routes as a table"}),f.jsx("div",{children:f.jsxs("table",{children:[f.jsx("thead",{children:f.jsxs("tr",{children:[f.jsx("th",{children:"From"}),f.jsx("th",{children:"To"}),f.jsx("th",{children:"Calls"}),f.jsx("th",{children:"Evidence"})]})}),f.jsx("tbody",{children:n.routes.map(z=>f.jsxs("tr",{children:[f.jsx("td",{children:qx(n,z.sourceSection)}),f.jsx("td",{children:qx(n,z.targetSection)}),f.jsx("td",{children:z.calls.toLocaleString()}),f.jsxs("td",{children:[z.extracted," extracted · ",z.inferred," inferred"]})]},z.id))})]})})]})]})]})}function Xx(n,e){if(!n)return;const t=n.getScreenCTM();if(!t)return;const i=n.createSVGPoint();i.x=e.clientX,i.y=e.clientY;const o=i.matrixTransform(t.inverse());return{x:o.x,y:o.y}}function $x(n){try{const e=JSON.parse(window.localStorage.getItem(n)??"{}");return!e||typeof e!="object"||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).flatMap(([t,i])=>i&&typeof i=="object"&&"x"in i&&"y"in i&&typeof i.x=="number"&&typeof i.y=="number"&&Number.isFinite(i.x)&&Number.isFinite(i.y)?[[t,{x:i.x,y:i.y}]]:[]))}catch{return{}}}function qx(n,e){return n.sections.find(t=>t.id===e)?.name??e}function NJ(n,e){return n.length<=e?n:`${n.slice(0,e-1)}…`}function DJ(n,e){const t=o=>[...o].sort((r,A)=>A.calls-r.calls||r.id.localeCompare(A.id)),i=new Set;if(e?.kind==="route"){const o=n.find(r=>r.id===e.id);if(o){i.add(o.id);const r=n.find(A=>A.sourceSection===o.targetSection&&A.targetSection===o.sourceSection);r&&i.add(r.id)}return i}else if(e?.kind==="section"){const o=t(n.filter(A=>A.targetSection===e.id)).slice(0,6),r=t(n.filter(A=>A.sourceSection===e.id)).slice(0,6);for(const A of t([...o,...r]))i.add(A.id);return i}for(const o of t(n)){if(i.size>=EJ)break;i.add(o.id)}return i}function MJ(n,e){const t=new Map(n.map(A=>[Jx(A.sourceSection,A.targetSection),A])),i=new Set,o=[],r=new Map;for(const A of n){if(i.has(A.id))continue;const I=t.get(Jx(A.targetSection,A.sourceSection));if(!I||I.id===A.id||i.has(I.id)){o.push(A),i.add(A.id);continue}const l=A.id===e?A:I.id===e?I:A.calls>I.calls||A.calls===I.calls&&A.id.localeCompare(I.id)<=0?A:I,c=l.id===A.id?I:A;o.push(l),r.set(l.id,c),i.add(A.id),i.add(I.id)}return o.sort((A,I)=>I.calls-A.calls||A.id.localeCompare(I.id)),{routes:o,reciprocals:r}}function Jx(n,e){return`${n}\0${e}`}function zJ(n){return n==="incoming"?"url(#architecture-arrow-outgoing)":n==="outgoing"?"url(#architecture-arrow-incoming)":"url(#architecture-arrow)"}function kJ(n,e,t){return e===t?`${n} subsystems and ${t} directed routes`:`${n} subsystems and ${e} of ${t} directed routes visible`}function e2(n){var e,t,i="";if(typeof n=="string"||typeof n=="number")i+=n;else if(typeof n=="object")if(Array.isArray(n)){var o=n.length;for(e=0;etypeof n=="boolean"?`${n}`:n===0?"0":n,i2=t2,Gu=(n,e)=>t=>{var i;if(e?.variants==null)return i2(n,t?.class,t?.className);const{variants:o,defaultVariants:r}=e,A=Object.keys(o).map(c=>{const h=t?.[c],p=r?.[c];if(h===null)return null;const m=n2(h)||n2(p);return o[c][m]}),I=t&&Object.entries(t).reduce((c,h)=>{let[p,m]=h;return m===void 0||(c[p]=m),c},{}),l=e==null||(i=e.compoundVariants)===null||i===void 0?void 0:i.reduce((c,h)=>{let{class:p,className:m,...y}=h;return Object.entries(y).every(w=>{let[S,x]=w;return Array.isArray(x)?x.includes({...r,...I}[S]):{...r,...I}[S]===x})?[...c,p,m]:c},[]);return i2(n,A,l,t?.class,t?.className)},RJ=(n,e)=>{const t=new Array(n.length+e.length);for(let i=0;i({classGroupId:n,validator:e}),g2=(n=new Map,e=null,t)=>({nextPart:n,validators:e,classGroupId:t}),lI="-",o2=[],jJ="arbitrary..",ZJ=n=>{const e=PJ(n),{conflictingClassGroups:t,conflictingClassGroupModifiers:i}=n;return{getClassGroupId:A=>{if(A.startsWith("[")&&A.endsWith("]"))return BJ(A);const I=A.split(lI),l=I[0]===""&&I.length>1?1:0;return s2(I,l,e)},getConflictingClassGroupIds:(A,I)=>{if(I){const l=i[A],c=t[A];return l?c?RJ(c,l):l:c||o2}return t[A]||o2}}},s2=(n,e,t)=>{if(n.length-e===0)return t.classGroupId;const o=n[e],r=t.nextPart.get(o);if(r){const c=s2(n,e+1,r);if(c)return c}const A=t.validators;if(A===null)return;const I=e===0?n.join(lI):n.slice(e).join(lI),l=A.length;for(let c=0;cn.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const e=n.slice(1,-1),t=e.indexOf(":"),i=e.slice(0,t);return i?jJ+i:void 0})(),PJ=n=>{const{theme:e,classGroups:t}=n;return LJ(t,e)},LJ=(n,e)=>{const t=g2();for(const i in n){const o=n[i];Fu(o,t,i,e)}return t},Fu=(n,e,t,i)=>{const o=n.length;for(let r=0;r{if(typeof n=="string"){FJ(n,e,t);return}if(typeof n=="function"){VJ(n,e,t,i);return}UJ(n,e,t,i)},FJ=(n,e,t)=>{const i=n===""?e:r2(e,n);i.classGroupId=t},VJ=(n,e,t,i)=>{if(YJ(n)){Fu(n(i),e,t,i);return}e.validators===null&&(e.validators=[]),e.validators.push(_J(t,n))},UJ=(n,e,t,i)=>{const o=Object.entries(n),r=o.length;for(let A=0;A{let t=n;const i=e.split(lI),o=i.length;for(let r=0;r"isThemeGetter"in n&&n.isThemeGetter===!0,HJ=n=>{if(n<1)return{get:()=>{},set:()=>{}};let e=0,t=Object.create(null),i=Object.create(null);const o=(r,A)=>{t[r]=A,e++,e>n&&(e=0,i=t,t=Object.create(null))};return{get(r){let A=t[r];if(A!==void 0)return A;if((A=i[r])!==void 0)return o(r,A),A},set(r,A){r in t?t[r]=A:o(r,A)}}},Vu="!",a2=":",KJ=[],A2=(n,e,t,i,o)=>({modifiers:n,hasImportantModifier:e,baseClassName:t,maybePostfixModifierPosition:i,isExternal:o}),WJ=n=>{const{prefix:e,experimentalParseClassName:t}=n;let i=o=>{const r=[];let A=0,I=0,l=0,c;const h=o.length;for(let S=0;Sl?c-l:void 0;return A2(r,y,m,w)};if(e){const o=e+a2,r=i;i=A=>A.startsWith(o)?r(A.slice(o.length)):A2(KJ,!1,A,void 0,!0)}if(t){const o=i;i=r=>t({className:r,parseClassName:o})}return i},QJ=n=>{const e=new Map;return n.orderSensitiveModifiers.forEach((t,i)=>{e.set(t,1e6+i)}),t=>{const i=[];let o=[];for(let r=0;r0&&(o.sort(),i.push(...o),o=[]),i.push(A)):o.push(A)}return o.length>0&&(o.sort(),i.push(...o)),i}},XJ=n=>({cache:HJ(n.cacheSize),parseClassName:WJ(n),sortModifiers:QJ(n),postfixLookupClassGroupIds:$J(n),...ZJ(n)}),$J=n=>{const e=Object.create(null),t=n.postfixLookupClassGroups;if(t)for(let i=0;i{const{parseClassName:t,getClassGroupId:i,getConflictingClassGroupIds:o,sortModifiers:r,postfixLookupClassGroupIds:A}=e,I=[],l=n.trim().split(qJ);let c="";for(let h=l.length-1;h>=0;h-=1){const p=l[h],{isExternal:m,modifiers:y,hasImportantModifier:w,baseClassName:S,maybePostfixModifierPosition:x}=t(p);if(m){c=p+(c.length>0?" "+c:c);continue}let O=!!x,E;if(O){const j=S.substring(0,x);E=i(j);const V=E&&A[E]?i(S):void 0;V&&V!==E&&(E=V,O=!1)}else E=i(S);if(!E){if(!O){c=p+(c.length>0?" "+c:c);continue}if(E=i(S),!E){c=p+(c.length>0?" "+c:c);continue}O=!1}const _=y.length===0?"":y.length===1?y[0]:r(y).join(":"),P=w?_+Vu:_,Q=P+E;if(I.indexOf(Q)>-1)continue;I.push(Q);const ne=o(E,O);for(let j=0;j0?" "+c:c)}return c},eee=(...n)=>{let e=0,t,i,o="";for(;e{if(typeof n=="string")return n;let e,t="";for(let i=0;i{let t,i,o,r;const A=l=>{const c=e.reduce((h,p)=>p(h),n());return t=XJ(c),i=t.cache.get,o=t.cache.set,r=I,I(l)},I=l=>{const c=i(l);if(c)return c;const h=JJ(l,t);return o(l,h),h};return r=A,(...l)=>r(eee(...l))},nee=[],on=n=>{const e=t=>t[n]||nee;return e.isThemeGetter=!0,e},I2=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,l2=/^\((?:(\w[\w-]*):)?(.+)\)$/i,iee=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,gee=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,oee=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,see=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,ree=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,aee=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Pg=n=>iee.test(n),Ve=n=>!!n&&!Number.isNaN(Number(n)),Bi=n=>!!n&&Number.isInteger(Number(n)),Uu=n=>n.endsWith("%")&&Ve(n.slice(0,-1)),tg=n=>gee.test(n),c2=()=>!0,Aee=n=>oee.test(n)&&!see.test(n),Yu=()=>!1,Cee=n=>ree.test(n),Iee=n=>aee.test(n),lee=n=>!Ie(n)&&!ce(n),cee=n=>n.startsWith("@container")&&(n[10]==="/"&&n[11]!==void 0||n[11]==="s"&&n[16]!==void 0&&n.startsWith("-size/",10)||n[11]==="n"&&n[18]!==void 0&&n.startsWith("-normal/",10)),dee=n=>Lg(n,m2,Yu),Ie=n=>I2.test(n),jo=n=>Lg(n,v2,Aee),d2=n=>Lg(n,bee,Ve),uee=n=>Lg(n,b2,c2),hee=n=>Lg(n,y2,Yu),u2=n=>Lg(n,f2,Yu),fee=n=>Lg(n,p2,Iee),cI=n=>Lg(n,w2,Cee),ce=n=>l2.test(n),Ba=n=>Zo(n,v2),pee=n=>Zo(n,y2),h2=n=>Zo(n,f2),mee=n=>Zo(n,m2),vee=n=>Zo(n,p2),dI=n=>Zo(n,w2,!0),yee=n=>Zo(n,b2,!0),Lg=(n,e,t)=>{const i=I2.exec(n);return i?i[1]?e(i[1]):t(i[2]):!1},Zo=(n,e,t=!1)=>{const i=l2.exec(n);return i?i[1]?e(i[1]):t:!1},f2=n=>n==="position"||n==="percentage",p2=n=>n==="image"||n==="url",m2=n=>n==="length"||n==="size"||n==="bg-size",v2=n=>n==="length",bee=n=>n==="number",y2=n=>n==="family-name",b2=n=>n==="number"||n==="weight",w2=n=>n==="shadow",wee=tee(()=>{const n=on("color"),e=on("font"),t=on("text"),i=on("font-weight"),o=on("tracking"),r=on("leading"),A=on("breakpoint"),I=on("container"),l=on("spacing"),c=on("radius"),h=on("shadow"),p=on("inset-shadow"),m=on("text-shadow"),y=on("drop-shadow"),w=on("blur"),S=on("perspective"),x=on("aspect"),O=on("ease"),E=on("animate"),_=()=>["auto","avoid","all","avoid-page","page","left","right","column"],P=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],Q=()=>[...P(),ce,Ie],ne=()=>["auto","hidden","clip","visible","scroll"],j=()=>["auto","contain","none"],V=()=>[ce,Ie,l],de=()=>[Pg,"full","auto",...V()],le=()=>[Bi,"none","subgrid",ce,Ie],Ze=()=>["auto",{span:["full",Bi,ce,Ie]},Bi,ce,Ie],Ee=()=>[Bi,"auto",ce,Ie],Ue=()=>["auto","min","max","fr",ce,Ie],We=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],Ae=()=>["start","end","center","stretch","center-safe","end-safe"],M=()=>["auto",...V()],U=()=>[Pg,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...V()],K=()=>[Pg,"screen","full","dvw","lvw","svw","min","max","fit",...V()],re=()=>[Pg,"screen","full","lh","dvh","lvh","svh","min","max","fit",...V()],ee=()=>[n,ce,Ie],T=()=>[...P(),h2,u2,{position:[ce,Ie]}],L=()=>["no-repeat",{repeat:["","x","y","space","round"]}],te=()=>["auto","cover","contain",mee,dee,{size:[ce,Ie]}],ae=()=>[Uu,Ba,jo],ue=()=>["","none","full",c,ce,Ie],ye=()=>["",Ve,Ba,jo],Be=()=>["solid","dashed","dotted","double"],ct=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],he=()=>[Ve,Uu,h2,u2],sn=()=>["","none",w,ce,Ie],z=()=>["none",Ve,ce,Ie],me=()=>["none",Ve,ce,Ie],_e=()=>[Ve,ce,Ie],ke=()=>[Pg,"full",...V()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[tg],breakpoint:[tg],color:[c2],container:[tg],"drop-shadow":[tg],ease:["in","out","in-out"],font:[lee],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[tg],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[tg],shadow:[tg],spacing:["px",Ve],text:[tg],"text-shadow":[tg],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Pg,Ie,ce,x]}],container:["container"],"container-type":[{"@container":["","normal","size",ce,Ie]}],"container-named":[cee],columns:[{columns:[Ve,Ie,ce,I]}],"break-after":[{"break-after":_()}],"break-before":[{"break-before":_()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:Q()}],overflow:[{overflow:ne()}],"overflow-x":[{"overflow-x":ne()}],"overflow-y":[{"overflow-y":ne()}],overscroll:[{overscroll:j()}],"overscroll-x":[{"overscroll-x":j()}],"overscroll-y":[{"overscroll-y":j()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:de()}],"inset-x":[{"inset-x":de()}],"inset-y":[{"inset-y":de()}],start:[{"inset-s":de(),start:de()}],end:[{"inset-e":de(),end:de()}],"inset-bs":[{"inset-bs":de()}],"inset-be":[{"inset-be":de()}],top:[{top:de()}],right:[{right:de()}],bottom:[{bottom:de()}],left:[{left:de()}],visibility:["visible","invisible","collapse"],z:[{z:[Bi,"auto",ce,Ie]}],basis:[{basis:[Pg,"full","auto",I,...V()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ve,Pg,"auto","initial","none",Ie]}],grow:[{grow:["",Ve,ce,Ie]}],shrink:[{shrink:["",Ve,ce,Ie]}],order:[{order:[Bi,"first","last","none",ce,Ie]}],"grid-cols":[{"grid-cols":le()}],"col-start-end":[{col:Ze()}],"col-start":[{"col-start":Ee()}],"col-end":[{"col-end":Ee()}],"grid-rows":[{"grid-rows":le()}],"row-start-end":[{row:Ze()}],"row-start":[{"row-start":Ee()}],"row-end":[{"row-end":Ee()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":Ue()}],"auto-rows":[{"auto-rows":Ue()}],gap:[{gap:V()}],"gap-x":[{"gap-x":V()}],"gap-y":[{"gap-y":V()}],"justify-content":[{justify:[...We(),"normal"]}],"justify-items":[{"justify-items":[...Ae(),"normal"]}],"justify-self":[{"justify-self":["auto",...Ae()]}],"align-content":[{content:["normal",...We()]}],"align-items":[{items:[...Ae(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...Ae(),{baseline:["","last"]}]}],"place-content":[{"place-content":We()}],"place-items":[{"place-items":[...Ae(),"baseline"]}],"place-self":[{"place-self":["auto",...Ae()]}],p:[{p:V()}],px:[{px:V()}],py:[{py:V()}],ps:[{ps:V()}],pe:[{pe:V()}],pbs:[{pbs:V()}],pbe:[{pbe:V()}],pt:[{pt:V()}],pr:[{pr:V()}],pb:[{pb:V()}],pl:[{pl:V()}],m:[{m:M()}],mx:[{mx:M()}],my:[{my:M()}],ms:[{ms:M()}],me:[{me:M()}],mbs:[{mbs:M()}],mbe:[{mbe:M()}],mt:[{mt:M()}],mr:[{mr:M()}],mb:[{mb:M()}],ml:[{ml:M()}],"space-x":[{"space-x":V()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":V()}],"space-y-reverse":["space-y-reverse"],size:[{size:U()}],"inline-size":[{inline:["auto",...K()]}],"min-inline-size":[{"min-inline":["auto",...K()]}],"max-inline-size":[{"max-inline":["none",...K()]}],"block-size":[{block:["auto",...re()]}],"min-block-size":[{"min-block":["auto",...re()]}],"max-block-size":[{"max-block":["none",...re()]}],w:[{w:[I,"screen",...U()]}],"min-w":[{"min-w":[I,"screen","none",...U()]}],"max-w":[{"max-w":[I,"screen","none","prose",{screen:[A]},...U()]}],h:[{h:["screen","lh",...U()]}],"min-h":[{"min-h":["screen","lh","none",...U()]}],"max-h":[{"max-h":["screen","lh",...U()]}],"font-size":[{text:["base",t,Ba,jo]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[i,yee,uee]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Uu,Ie]}],"font-family":[{font:[pee,hee,e]}],"font-features":[{"font-features":[Ie]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[o,ce,Ie]}],"line-clamp":[{"line-clamp":[Ve,"none",ce,d2]}],leading:[{leading:[r,...V()]}],"list-image":[{"list-image":["none",ce,Ie]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",ce,Ie]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:ee()}],"text-color":[{text:ee()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Be(),"wavy"]}],"text-decoration-thickness":[{decoration:[Ve,"from-font","auto",ce,jo]}],"text-decoration-color":[{decoration:ee()}],"underline-offset":[{"underline-offset":[Ve,"auto",ce,Ie]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:V()}],"tab-size":[{tab:[Bi,ce,Ie]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ce,Ie]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",ce,Ie]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:T()}],"bg-repeat":[{bg:L()}],"bg-size":[{bg:te()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Bi,ce,Ie],radial:["",ce,Ie],conic:[Bi,ce,Ie]},vee,fee]}],"bg-color":[{bg:ee()}],"gradient-from-pos":[{from:ae()}],"gradient-via-pos":[{via:ae()}],"gradient-to-pos":[{to:ae()}],"gradient-from":[{from:ee()}],"gradient-via":[{via:ee()}],"gradient-to":[{to:ee()}],rounded:[{rounded:ue()}],"rounded-s":[{"rounded-s":ue()}],"rounded-e":[{"rounded-e":ue()}],"rounded-t":[{"rounded-t":ue()}],"rounded-r":[{"rounded-r":ue()}],"rounded-b":[{"rounded-b":ue()}],"rounded-l":[{"rounded-l":ue()}],"rounded-ss":[{"rounded-ss":ue()}],"rounded-se":[{"rounded-se":ue()}],"rounded-ee":[{"rounded-ee":ue()}],"rounded-es":[{"rounded-es":ue()}],"rounded-tl":[{"rounded-tl":ue()}],"rounded-tr":[{"rounded-tr":ue()}],"rounded-br":[{"rounded-br":ue()}],"rounded-bl":[{"rounded-bl":ue()}],"border-w":[{border:ye()}],"border-w-x":[{"border-x":ye()}],"border-w-y":[{"border-y":ye()}],"border-w-s":[{"border-s":ye()}],"border-w-e":[{"border-e":ye()}],"border-w-bs":[{"border-bs":ye()}],"border-w-be":[{"border-be":ye()}],"border-w-t":[{"border-t":ye()}],"border-w-r":[{"border-r":ye()}],"border-w-b":[{"border-b":ye()}],"border-w-l":[{"border-l":ye()}],"divide-x":[{"divide-x":ye()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ye()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...Be(),"hidden","none"]}],"divide-style":[{divide:[...Be(),"hidden","none"]}],"border-color":[{border:ee()}],"border-color-x":[{"border-x":ee()}],"border-color-y":[{"border-y":ee()}],"border-color-s":[{"border-s":ee()}],"border-color-e":[{"border-e":ee()}],"border-color-bs":[{"border-bs":ee()}],"border-color-be":[{"border-be":ee()}],"border-color-t":[{"border-t":ee()}],"border-color-r":[{"border-r":ee()}],"border-color-b":[{"border-b":ee()}],"border-color-l":[{"border-l":ee()}],"divide-color":[{divide:ee()}],"outline-style":[{outline:[...Be(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Ve,ce,Ie]}],"outline-w":[{outline:["",Ve,Ba,jo]}],"outline-color":[{outline:ee()}],shadow:[{shadow:["","none",h,dI,cI]}],"shadow-color":[{shadow:ee()}],"inset-shadow":[{"inset-shadow":["none",p,dI,cI]}],"inset-shadow-color":[{"inset-shadow":ee()}],"ring-w":[{ring:ye()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:ee()}],"ring-offset-w":[{"ring-offset":[Ve,jo]}],"ring-offset-color":[{"ring-offset":ee()}],"inset-ring-w":[{"inset-ring":ye()}],"inset-ring-color":[{"inset-ring":ee()}],"text-shadow":[{"text-shadow":["none",m,dI,cI]}],"text-shadow-color":[{"text-shadow":ee()}],opacity:[{opacity:[Ve,ce,Ie]}],"mix-blend":[{"mix-blend":[...ct(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ct()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Ve]}],"mask-image-linear-from-pos":[{"mask-linear-from":he()}],"mask-image-linear-to-pos":[{"mask-linear-to":he()}],"mask-image-linear-from-color":[{"mask-linear-from":ee()}],"mask-image-linear-to-color":[{"mask-linear-to":ee()}],"mask-image-t-from-pos":[{"mask-t-from":he()}],"mask-image-t-to-pos":[{"mask-t-to":he()}],"mask-image-t-from-color":[{"mask-t-from":ee()}],"mask-image-t-to-color":[{"mask-t-to":ee()}],"mask-image-r-from-pos":[{"mask-r-from":he()}],"mask-image-r-to-pos":[{"mask-r-to":he()}],"mask-image-r-from-color":[{"mask-r-from":ee()}],"mask-image-r-to-color":[{"mask-r-to":ee()}],"mask-image-b-from-pos":[{"mask-b-from":he()}],"mask-image-b-to-pos":[{"mask-b-to":he()}],"mask-image-b-from-color":[{"mask-b-from":ee()}],"mask-image-b-to-color":[{"mask-b-to":ee()}],"mask-image-l-from-pos":[{"mask-l-from":he()}],"mask-image-l-to-pos":[{"mask-l-to":he()}],"mask-image-l-from-color":[{"mask-l-from":ee()}],"mask-image-l-to-color":[{"mask-l-to":ee()}],"mask-image-x-from-pos":[{"mask-x-from":he()}],"mask-image-x-to-pos":[{"mask-x-to":he()}],"mask-image-x-from-color":[{"mask-x-from":ee()}],"mask-image-x-to-color":[{"mask-x-to":ee()}],"mask-image-y-from-pos":[{"mask-y-from":he()}],"mask-image-y-to-pos":[{"mask-y-to":he()}],"mask-image-y-from-color":[{"mask-y-from":ee()}],"mask-image-y-to-color":[{"mask-y-to":ee()}],"mask-image-radial":[{"mask-radial":[ce,Ie]}],"mask-image-radial-from-pos":[{"mask-radial-from":he()}],"mask-image-radial-to-pos":[{"mask-radial-to":he()}],"mask-image-radial-from-color":[{"mask-radial-from":ee()}],"mask-image-radial-to-color":[{"mask-radial-to":ee()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":P()}],"mask-image-conic-pos":[{"mask-conic":[Ve]}],"mask-image-conic-from-pos":[{"mask-conic-from":he()}],"mask-image-conic-to-pos":[{"mask-conic-to":he()}],"mask-image-conic-from-color":[{"mask-conic-from":ee()}],"mask-image-conic-to-color":[{"mask-conic-to":ee()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:T()}],"mask-repeat":[{mask:L()}],"mask-size":[{mask:te()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",ce,Ie]}],filter:[{filter:["","none",ce,Ie]}],blur:[{blur:sn()}],brightness:[{brightness:[Ve,ce,Ie]}],contrast:[{contrast:[Ve,ce,Ie]}],"drop-shadow":[{"drop-shadow":["","none",y,dI,cI]}],"drop-shadow-color":[{"drop-shadow":ee()}],grayscale:[{grayscale:["",Ve,ce,Ie]}],"hue-rotate":[{"hue-rotate":[Ve,ce,Ie]}],invert:[{invert:["",Ve,ce,Ie]}],saturate:[{saturate:[Ve,ce,Ie]}],sepia:[{sepia:["",Ve,ce,Ie]}],"backdrop-filter":[{"backdrop-filter":["","none",ce,Ie]}],"backdrop-blur":[{"backdrop-blur":sn()}],"backdrop-brightness":[{"backdrop-brightness":[Ve,ce,Ie]}],"backdrop-contrast":[{"backdrop-contrast":[Ve,ce,Ie]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Ve,ce,Ie]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ve,ce,Ie]}],"backdrop-invert":[{"backdrop-invert":["",Ve,ce,Ie]}],"backdrop-opacity":[{"backdrop-opacity":[Ve,ce,Ie]}],"backdrop-saturate":[{"backdrop-saturate":[Ve,ce,Ie]}],"backdrop-sepia":[{"backdrop-sepia":["",Ve,ce,Ie]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":V()}],"border-spacing-x":[{"border-spacing-x":V()}],"border-spacing-y":[{"border-spacing-y":V()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",ce,Ie]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Ve,"initial",ce,Ie]}],ease:[{ease:["linear","initial",O,ce,Ie]}],delay:[{delay:[Ve,ce,Ie]}],animate:[{animate:["none",E,ce,Ie]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[S,ce,Ie]}],"perspective-origin":[{"perspective-origin":Q()}],rotate:[{rotate:z()}],"rotate-x":[{"rotate-x":z()}],"rotate-y":[{"rotate-y":z()}],"rotate-z":[{"rotate-z":z()}],scale:[{scale:me()}],"scale-x":[{"scale-x":me()}],"scale-y":[{"scale-y":me()}],"scale-z":[{"scale-z":me()}],"scale-3d":["scale-3d"],skew:[{skew:_e()}],"skew-x":[{"skew-x":_e()}],"skew-y":[{"skew-y":_e()}],transform:[{transform:[ce,Ie,"","none","gpu","cpu"]}],"transform-origin":[{origin:Q()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:ke()}],"translate-x":[{"translate-x":ke()}],"translate-y":[{"translate-y":ke()}],"translate-z":[{"translate-z":ke()}],"translate-none":["translate-none"],zoom:[{zoom:[Bi,ce,Ie]}],accent:[{accent:ee()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:ee()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",ce,Ie]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":ee()}],"scrollbar-track-color":[{"scrollbar-track":ee()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":V()}],"scroll-mx":[{"scroll-mx":V()}],"scroll-my":[{"scroll-my":V()}],"scroll-ms":[{"scroll-ms":V()}],"scroll-me":[{"scroll-me":V()}],"scroll-mbs":[{"scroll-mbs":V()}],"scroll-mbe":[{"scroll-mbe":V()}],"scroll-mt":[{"scroll-mt":V()}],"scroll-mr":[{"scroll-mr":V()}],"scroll-mb":[{"scroll-mb":V()}],"scroll-ml":[{"scroll-ml":V()}],"scroll-p":[{"scroll-p":V()}],"scroll-px":[{"scroll-px":V()}],"scroll-py":[{"scroll-py":V()}],"scroll-ps":[{"scroll-ps":V()}],"scroll-pe":[{"scroll-pe":V()}],"scroll-pbs":[{"scroll-pbs":V()}],"scroll-pbe":[{"scroll-pbe":V()}],"scroll-pt":[{"scroll-pt":V()}],"scroll-pr":[{"scroll-pr":V()}],"scroll-pb":[{"scroll-pb":V()}],"scroll-pl":[{"scroll-pl":V()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",ce,Ie]}],fill:[{fill:["none",...ee()]}],"stroke-w":[{stroke:[Ve,Ba,jo,d2]}],stroke:[{stroke:["none",...ee()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}});function Pa(...n){return wee(t2(n))}const xee=Gu("group/alert relative grid w-full gap-0.5 rounded-lg border px-2.5 py-2 text-left text-sm has-data-[slot=alert-action]:relative has-data-[slot=alert-action]:pr-18 has-[>svg]:grid-cols-[auto_1fr] has-[>svg]:gap-x-2 *:[svg]:row-span-2 *:[svg]:translate-y-0.5 *:[svg]:text-current *:[svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"bg-card text-destructive *:data-[slot=alert-description]:text-destructive/90 *:[svg]:text-current"}},defaultVariants:{variant:"default"}});function Hu({className:n,variant:e,...t}){return f.jsx("div",{"data-slot":"alert",role:"alert",className:Pa(xee({variant:e}),n),...t})}function Ku({className:n,...e}){return f.jsx("div",{"data-slot":"alert-title",className:Pa("font-medium group-has-[>svg]/alert:col-start-2 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground",n),...e})}function Wu({className:n,...e}){return f.jsx("div",{"data-slot":"alert-description",className:Pa("text-sm text-balance text-muted-foreground md:text-pretty [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-4",n),...e})}var See=Object.defineProperty,Qu=(n,e)=>See(n,"name",{value:e,configurable:!0});function Xu(n,e){if(typeof n=="function")return n(e);n!=null&&(n.current=e)}Qu(Xu,"setRef");function x2(...n){return e=>{let t=!1;const i=n.map(o=>{const r=Xu(o,e);return!t&&typeof r=="function"&&(t=!0),r});if(t)return()=>{for(let o=0;oEee(n,"name",{value:e,configurable:!0});function E2(n){const e=F.forwardRef((t,i)=>{let{children:o,...r}=t,A=null,I=!1;const l=[];$u(o)&&typeof uI=="function"&&(o=uI(o._payload)),F.Children.forEach(o,m=>{if(M2(m)){I=!0;const y=m;let w="child"in y.props?y.props.child:y.props.children;$u(w)&&typeof uI=="function"&&(w=uI(w._payload)),A=Oee(y,w),l.push(A?.props?.children)}else l.push(m)}),A?A=F.cloneElement(A,void 0,l):!I&&F.Children.count(o)===1&&F.isValidElement(o)&&(A=o);const c=A?D2(A):void 0,h=S2(i,c);if(!A){if(o||o===0)throw new Error(I?Mee(n):Dee(n));return o}const p=N2(r,A.props??{});return A.type!==F.Fragment&&(p.ref=i?h:c),F.cloneElement(A,p)});return e.displayName=`${n}.Slot`,e}xi(E2,"createSlot");var T2=E2("Slot"),O2=Symbol.for("radix.slottable");function Tee(n){const e=xi(t=>"child"in t?t.children(t.child):t.children,"Slottable");return e.displayName=`${n}.Slottable`,e.__radixId=O2,e}xi(Tee,"createSlottable");var Oee=xi((n,e)=>{if("child"in n.props){const t=n.props.child;return F.isValidElement(t)?F.cloneElement(t,void 0,n.props.children(t.props.children)):null}return F.isValidElement(e)?e:null},"getSlottableElementFromSlottable");function N2(n,e){const t={...e};for(const i in e){const o=n[i],r=e[i];/^on[A-Z]/.test(i)?o&&r?t[i]=(...I)=>{const l=r(...I);return o(...I),l}:o&&(t[i]=o):i==="style"?t[i]={...o,...r}:i==="className"&&(t[i]=[o,r].filter(Boolean).join(" "))}return{...n,...t}}xi(N2,"mergeProps");function D2(n){let e=Object.getOwnPropertyDescriptor(n.props,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning;return t?n.ref:(e=Object.getOwnPropertyDescriptor(n,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning,t?n.props.ref:n.props.ref||n.ref)}xi(D2,"getElementRef");function M2(n){return F.isValidElement(n)&&typeof n.type=="function"&&"__radixId"in n.type&&n.type.__radixId===O2}xi(M2,"isSlottable");var Nee=Symbol.for("react.lazy");function $u(n){return n!=null&&typeof n=="object"&&"$$typeof"in n&&n.$$typeof===Nee&&"_payload"in n&&z2(n._payload)}xi($u,"isLazyComponent");function z2(n){return typeof n=="object"&&n!==null&&"then"in n}xi(z2,"isPromiseLike");var Dee=xi(n=>`${n} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),Mee=xi(n=>`${n} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),uI=RR[" use ".trim().toString()];const zee=Gu("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",destructive:"bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",outline:"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",ghost:"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",link:"text-primary underline-offset-4 hover:underline"}},defaultVariants:{variant:"default"}});function Gg({className:n,variant:e="default",asChild:t=!1,...i}){const o=t?T2:"span";return f.jsx(o,{"data-slot":"badge","data-variant":e,className:Pa(zee({variant:e}),n),...i})}const kee=Gu("group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/80",outline:"border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",ghost:"hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",destructive:"bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",xs:"h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",lg:"h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",icon:"size-8","icon-xs":"size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg","icon-lg":"size-9"}},defaultVariants:{variant:"default",size:"default"}});function qu({className:n,variant:e="default",size:t="default",asChild:i=!1,...o}){const r=i?T2:"button";return f.jsx(r,{"data-slot":"button","data-variant":e,"data-size":t,className:Pa(kee({variant:e,size:t,className:n})),...o})}const Ju={resolved:0,inferred:1,ambiguous:2,unresolved:3};function Ree({graph:n,host:e}){const t=new Map,i=_ee(n);for(const r of n.edges){const A=t.get(r.target);(!A||Ju[r.resolution]>Ju[A])&&t.set(r.target,r.resolution)}const o={schema:"compass.viewer.graph/1",title:`Calls from ${n.nodes.find(r=>r.id===n.rootSymbol)?.name??n.rootSymbol}`,stats:{nodes:n.nodes.length,edges:n.edges.length,communities:4,aggregated:!1},nodes:n.nodes.map(r=>({id:r.id,label:r.name,kind:r.unresolved?"Unresolved call":"Function",community:Ju[t.get(r.id)??"resolved"],communityName:t.get(r.id)??"resolved",depth:i.get(r.id),root:r.id===n.rootSymbol,source:jee(r)})),edges:n.edges.map(r=>({id:r.id,source:r.source,target:r.target,relation:`${r.callee} · ${r.resolution}`,confidence:r.resolution==="resolved"?"extracted":r.resolution==="inferred"?"inferred":"ambiguous"})),communities:[{id:0,label:"Resolved",color:"#59A14F",hidden:!1},{id:1,label:"Inferred",color:"#4E79A7",hidden:!1},{id:2,label:"Ambiguous",color:"#F28E2B",hidden:!1},{id:3,label:"Unresolved",color:"#E15759",hidden:!1}],hyperedges:[]};return f.jsx(ju,{model:o,host:e,preferredLayout:"hierarchical"})}function _ee(n){const e=new Map;for(const o of n.edges){const r=e.get(o.source)??[];r.push(o.target),e.set(o.source,r);const A=e.get(o.target)??[];A.push(o.source),e.set(o.target,A)}const t=new Map([[n.rootSymbol,0]]),i=[n.rootSymbol];for(;i.length>0;){const o=i.shift();if(o===void 0)break;const r=t.get(o)??0;for(const A of e.get(o)??[])t.has(A)||(t.set(A,r+1),i.push(A))}return t}function jee(n){if(n.anchor)return{file:n.anchor.source_file,startByte:n.anchor.start_byte,endByte:n.anchor.end_byte};if(n.file)return{file:n.file,...n.startLine!=null?{startLine:n.startLine}:{},...n.endLine!=null?{endLine:n.endLine}:{},...n.startByte!=null?{startByte:n.startByte}:{},...n.endByte!=null?{endByte:n.endByte}:{}}}function Zee({coverage:n}){return!n.partial&&n.unresolved===0&&n.ambiguous===0?null:f.jsxs(Hu,{children:[f.jsx(Ku,{children:"Partial call coverage"}),f.jsx(Wu,{children:n.warning})]})}function Bee({graph:n,host:e}){const[t,i]=F.useState(!1),o=t?n.continuations:n.continuations.slice(0,20),r=n.direction==="callers"?"No callers found":n.direction==="callees"?"No callees found":"No calls found";return f.jsxs("div",{className:"call-graph-view relative h-screen",children:[f.jsx(Ree,{graph:n,host:e}),f.jsx("div",{className:"call-graph-direction absolute top-2 left-1/2 z-20 flex -translate-x-1/2 gap-1 rounded-md border bg-popover/95 p-1 shadow-lg backdrop-blur",role:"group","aria-label":"Call graph direction",children:[["callers","Callers"],["both","Both"],["callees","Callees"]].map(([A,I])=>f.jsx(qu,{size:"sm",variant:n.direction===A?"secondary":"ghost","aria-pressed":n.direction===A,disabled:!e.changeDirection,onClick:()=>{n.direction!==A&&e.changeDirection?.(A)},children:I},A))}),f.jsxs("section",{className:"call-graph-summary absolute bottom-3 left-3 z-20 flex max-w-[min(44rem,calc(100%-1.5rem))] flex-col gap-2 rounded-md border bg-popover/95 p-3 text-popover-foreground shadow-xl backdrop-blur",children:[f.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[f.jsxs(Gg,{variant:"outline",children:[f.jsx(rc,{})," depth ",n.depth]}),f.jsxs(Gg,{variant:"outline",children:[n.nodes.length," ",n.nodes.length===1?"node":"nodes"]}),f.jsxs(Gg,{variant:"outline",children:[n.edges.length," ",n.edges.length===1?"edge":"edges"]}),f.jsxs(Gg,{variant:"secondary",children:[n.coverage.resolved," resolved"]}),f.jsxs(Gg,{variant:"outline",children:[n.coverage.inferred," inferred"]}),f.jsxs(Gg,{variant:"outline",children:[n.coverage.ambiguous," ambiguous"]}),f.jsxs(Gg,{variant:"destructive",children:[n.coverage.unresolved," unresolved"]}),n.coverage.evidenceLayer&&f.jsx(Gg,{variant:"outline",children:Pee(n.coverage.evidenceLayer)})]}),n.edges.length===0&&f.jsxs(Hu,{children:[f.jsx(Ku,{children:r}),f.jsx(Wu,{children:"Compass found the root function but no represented relationships in this direction."})]}),n.truncated&&f.jsxs(Hu,{children:[f.jsx(UA,{}),f.jsx(Ku,{children:"Partial call graph"}),f.jsx(Wu,{children:"Compass reached the configured graph limit. Counts and paths may be incomplete."})]}),f.jsx(Zee,{coverage:n.coverage}),n.continuations.length>0&&f.jsxs("div",{children:[f.jsx("div",{className:"flex max-h-24 flex-wrap gap-1 overflow-auto","aria-label":"Call graph continuations",children:o.map(A=>f.jsxs(qu,{size:"xs",variant:"outline",disabled:!e.expand,onClick:()=>e.expand?.(A.symbol,A.direction,A.nextDepth),children:[A.direction==="callers"?f.jsx(VR,{}):A.direction==="callees"?f.jsx(LR,{}):f.jsx(Um,{}),"Expand ",A.direction]},`${A.symbol}:${A.direction}:${A.nextDepth}`))}),!t&&n.continuations.length>o.length&&f.jsxs("div",{className:"mt-2 flex flex-wrap items-center justify-between gap-2",children:[f.jsxs("p",{className:"text-xs text-muted-foreground",role:"status",children:["Showing ",o.length," of ",n.continuations.length," continuations"]}),f.jsxs(qu,{size:"xs",variant:"outline",onClick:()=>i(!0),children:["Show all ",n.continuations.length," continuations"]})]})]})]})]})}function Pee(n){return n.split("_").map((e,t)=>t===0?`${e.slice(0,1).toUpperCase()}${e.slice(1)}`:e).join(" ")}const k2=0;function Lee(n,e){const t=new Set(n.nodes.map(l=>l.id)),i=n.edges.filter(l=>t.has(l.source)&&t.has(l.target)).map(Fee),o=new Map;for(const l of i)o.set(l.source,(o.get(l.source)??0)+1),o.set(l.target,(o.get(l.target)??0)+1);const r=Uee(n),A=new Set(n.paths.flatMap(l=>l.nodeIds.slice(0,1))),I=n.nodes.map(l=>Gee(l,o.get(l.id)??0,r.get(l.id),A.has(l.id)));return{schema:"compass.viewer.graph/1",title:e,stats:{nodes:I.length,edges:i.length,communities:I.length>0?1:0,aggregated:!1},nodes:I,edges:i,communities:I.length>0?[{id:k2,label:"Query result",color:"#6f7bf7",hidden:!1}]:[],hyperedges:[]}}function Gee(n,e,t,i){const o=n.details?.type==="symbol"?n.details.data.signature??void 0:void 0;return{id:n.id,label:n.name,kind:n.kind,community:k2,communityName:"Query result",degree:e,...t!==void 0?{depth:t}:{},...i?{root:!0}:{},...n.language?{language:n.language}:{},...o?{signature:o}:{},...n.source?{source:n.source}:{},codeEvidence:n.evidence}}function Fee(n){const e=Vee(n);return{id:n.id,source:n.source,target:n.target,relation:n.kind,...n.relationshipSite?{relationshipSite:n.relationshipSite}:{},...n.details?{details:n.details}:{},...e?{confidence:e}:{},codeEvidence:n.evidence}}function Vee(n){return n.evidence.some(e=>e.confidence==="ambiguous")?"ambiguous":n.evidence.some(e=>e.confidence==="inferred")?"inferred":n.evidence.length>0?"extracted":void 0}function Uee(n){const e=new Map;for(const t of n.paths)t.nodeIds.forEach((i,o)=>{const r=e.get(i);(r===void 0||o[x.id,x])),i=new Map(e.nodes.map(x=>[x.id,x])),o=new Map,r=[],A=R2(i,t),I=R2(t,i),l=new Map(Hee(i,t).map(x=>[x,Xm(t.get(x),i.get(x),"node")])),c=[...l.entries()].filter(([,x])=>x.fields.length>0).map(([x])=>x),h=Wee(n.edges,e.edges),p=h.matched.map(({before:x,after:O})=>({before:x,after:O,evidence:Kee(x,O)})).filter(({evidence:x})=>x.fields.length>0);for(const x of A)eh(o,i.get(x),"added",YA(void 0,i.get(x)));for(const x of I)eh(o,t.get(x),"removed",YA(t.get(x),void 0));for(const x of c)eh(o,i.get(x),"changed",l.get(x));for(const x of h.added)r.push({...x,change:"added",evidence:YA(void 0,x)}),th(o,x,t,i);for(const x of h.removed)r.push({...x,change:"removed",evidence:YA(x,void 0)}),th(o,x,t,i);for(const{after:x,evidence:O}of p)r.push({...x,change:"changed",evidence:O}),th(o,x,t,i);const m=[...o.values()].sort((x,O)=>x.id.localeCompare(O.id));r.sort((x,O)=>x.id.localeCompare(O.id));const y=Qee(r),w=new Set(m.map(x=>x.community)),S=[...e.communities,...n.communities.filter(x=>!e.communities.some(O=>O.id===x.id))].filter(x=>w.has(x.id));return{addedNodes:A.length,removedNodes:I.length,changedNodes:c.length,addedEdges:h.added.length,removedEdges:h.removed.length,changedEdges:p.length,graph:{...e,title:`Graph delta · ${e.title}`,stats:{...e.stats,nodes:m.length,edges:y.length,communities:S.length,aggregated:n.stats.aggregated||e.stats.aggregated},nodes:m,edges:y,communities:S,hyperedges:[]}}}function R2(n,e){return[...n.keys()].filter(t=>!e.has(t))}function Hee(n,e){return[...n.keys()].filter(t=>e.has(t))}function eh(n,e,t,i){e&&n.set(e.id,{...e,change:t,...i?{evidence:i}:{}})}function _2(n,e,t,i){if(n.has(e))return;const o=i.get(e)??t.get(e);o&&n.set(e,{...o,change:"unchanged"})}function th(n,e,t,i){_2(n,e.source,t,i),_2(n,e.target,t,i)}function Kee(n,e){return Xm({...n,id:e.id},e,"edge")}function Wee(n,e){const t=new Set,i=new Set,o=[],r=(I,l)=>{t.add(I),i.add(l),o.push({before:n[I],after:e[l]})};j2(n,e,t,i,r,I=>fI(I.id)?void 0:I.id),j2(n,e,t,i,r,I=>fI(I.id)?nh(I):void 0);const A=new Map;n.forEach((I,l)=>{if(t.has(l)||!fI(I.id))return;const c=A.get(hI(I))??{parent:[],current:[]};c.parent.push(l),A.set(hI(I),c)}),e.forEach((I,l)=>{if(i.has(l)||!fI(I.id))return;const c=A.get(hI(I))??{parent:[],current:[]};c.current.push(l),A.set(hI(I),c)});for(const I of A.values()){I.parent.sort((c,h)=>Z2(n[c],n[h])),I.current.sort((c,h)=>Z2(e[c],e[h]));const l=Math.min(I.parent.length,I.current.length);for(let c=0;c!i.has(l)),removed:n.filter((I,l)=>!t.has(l))}}function j2(n,e,t,i,o,r){const A=new Map;e.forEach((I,l)=>{if(i.has(l))return;const c=r(I);if(c===void 0)return;const h=A.get(c)??[];h.push(l),A.set(c,h)}),n.forEach((I,l)=>{if(t.has(l))return;const c=r(I);if(c===void 0)return;const p=A.get(c)?.shift();p!==void 0&&o(l,p)})}function nh(n){return JSON.stringify(f3(n,"edge"))}function hI(n){return JSON.stringify([n.source,n.target,n.relation])}function Z2(n,e){return nh(n).localeCompare(nh(e))||n.id.localeCompare(e.id)}function fI(n){return/^edge-\d+-/.test(n)}function Qee(n){const e=new Map;return n.map(t=>{const i=e.get(t.id)??0;return e.set(t.id,i+1),i===0?t:{...t,id:`${t.id}::${t.change}-${i}`}})}function Xee({workbench:n,host:e,communityDetail:t,communityLoading:i,communityError:o,onBackToOverview:r,initialInspectorLayout:A,onInspectorLayoutChange:I}){const[l,c]=F.useState(()=>P2(n)??n.defaultView),[h,p]=F.useState(!1),m=n.views.find(w=>w.id===l)??n.views[0];F.useEffect(()=>{const w=()=>{const S=P2(n);S&&c(S)};return window.addEventListener("hashchange",w),()=>window.removeEventListener("hashchange",w)},[n]);const y=w=>{c(w);const S=`view=${encodeURIComponent(w)}`;window.location.hash.slice(1)!==S&&(window.location.hash=S)};return m?f.jsxs("div",{className:"visualization-workbench","data-navigation-collapsed":h,children:[f.jsxs("aside",{className:"visualization-rail","data-collapsed":h,"aria-label":"Compass navigation",children:[f.jsxs("header",{children:[f.jsx("span",{className:"visualization-bearing","aria-hidden":"true",children:f.jsx(c3,{})}),f.jsxs("span",{children:[f.jsx("strong",{children:"Compass"}),f.jsx("small",{title:n.title,children:n.title})]}),f.jsx("button",{className:"visualization-rail-disclosure",type:"button","aria-label":h?"Expand graph navigation":"Collapse graph navigation",title:h?"Expand graph navigation":"Collapse graph navigation",onClick:()=>p(w=>!w),children:h?f.jsx(g3,{"aria-hidden":"true"}):f.jsx(i3,{"aria-hidden":"true"})})]}),f.jsx("nav",{"aria-label":"Graph views",children:n.views.map(w=>f.jsxs("button",{type:"button","aria-current":w.id===m.id?"page":void 0,onClick:()=>y(w.id),children:[f.jsx(nte,{view:w}),f.jsxs("span",{children:[f.jsx("strong",{children:w.title}),f.jsx("small",{children:w.description})]}),f.jsx("i",{"data-status":w.coverage.status,title:`${w.coverage.status} view`})]},w.id))}),f.jsxs("footer",{children:[f.jsx("span",{children:"Snapshot"}),f.jsx("code",{children:ite(n.graphIdentity)})]})]}),f.jsxs("main",{className:"visualization-main",children:[f.jsxs("header",{className:"visualization-context",children:[f.jsxs("div",{children:[f.jsx("span",{children:gte(m)}),f.jsx("strong",{children:m.title})]}),f.jsxs("div",{className:"visualization-coverage","data-status":m.coverage.status,children:[m.kind!=="call"&&f.jsxs(f.Fragment,{children:[f.jsxs("span",{children:[m.coverage.nodes.toLocaleString()," nodes"]}),f.jsxs("span",{children:[m.coverage.edges.toLocaleString()," relationships"]})]}),f.jsx("strong",{children:ote(m)})]})]}),f.jsx("section",{className:"visualization-stage","aria-label":`${m.title} visualization`,children:f.jsx($ee,{view:m,host:e,communityDetail:t,communityLoading:i,communityError:o,onBackToOverview:r,initialInspectorLayout:A,onInspectorLayoutChange:I},m.id)})]})]}):null}function $ee({view:n,host:e,communityDetail:t,communityLoading:i,communityError:o,onBackToOverview:r,initialInspectorLayout:A,onInspectorLayoutChange:I}){if(n.kind==="call")return f.jsx(Bee,{graph:n.graph,host:{openSource:e.openSource,...e.expandCall?{expand:e.expandCall}:{},...e.changeCallDirection?{changeDirection:e.changeCallDirection}:{}}});if(n.kind==="architecture")return f.jsx(qee,{model:n.model,host:e});if(n.kind==="impact")return f.jsx(ih,{model:Lee(n.result,n.title),host:e,queryResult:n.result,preferredLayout:"hierarchical"});if(n.kind==="history"){const c=Yee(n.before,n.after);return f.jsxs("div",{className:"workbench-history-view",children:[f.jsxs("div",{className:"workbench-history-banner",children:[f.jsx(Lm,{"aria-hidden":"true"}),f.jsxs("span",{children:[f.jsxs("strong",{children:[n.baseRevision," → ",n.targetRevision]}),f.jsxs("small",{children:["+",c.addedNodes," / −",c.removedNodes," / Δ",c.changedNodes," nodes"]})]})]}),f.jsx(ih,{model:c.graph,host:e,preferredLayout:"grid",sourceRevisions:{before:n.baseRevision,after:n.targetRevision}})]})}const l=n.kind==="affected"?"hierarchical":n.kind==="artifact"?n.lens==="routes"?"hierarchical":"grid":"automatic";return f.jsx(ih,{model:n.model,host:e,preferredLayout:l,communityDetails:n.kind==="code"?n.communityDetails:void 0,communityDetail:n.kind==="code"?t:void 0,communityLoading:n.kind==="code"?i:void 0,communityError:n.kind==="code"?o:void 0,onBackToOverview:n.kind==="code"?r:void 0,initialInspectorLayout:A,onInspectorLayoutChange:I})}function ih({model:n,host:e,queryResult:t,sourceRevisions:i,preferredLayout:o,communityDetails:r,communityDetail:A,communityLoading:I,communityError:l,onBackToOverview:c,initialInspectorLayout:h,onInspectorLayoutChange:p}){const[m,y]=F.useState(""),[w,S]=F.useState(""),[x,O]=F.useState(""),[E,_]=F.useState(""),[P,Q]=F.useState(),[ne,j]=F.useState(!1),V=F.useId(),de=F.useRef(null),le=F.useRef(null),Ee=(P===void 0?void 0:{communityId:P,model:r?.[String(P)]??n})??A,Ue=Ee?.model??n,We=Ee?`community-${Ee.communityId}`:"overview",Ae=F.useMemo(()=>Jee(Ue),[Ue]),M=F.useMemo(()=>ete(Ue,{relation:m,evidence:w,kind:x,language:E}),[Ue,w,x,E,m]);F.useEffect(()=>{y(""),S(""),O(""),_(""),j(!1)},[We]),F.useEffect(()=>{if(!ne)return;const T=te=>{te.key==="Escape"&&(j(!1),de.current?.focus())},L=te=>{const ae=te.target;de.current?.contains(ae)||le.current?.contains(ae)||j(!1)};return document.addEventListener("keydown",T),document.addEventListener("pointerdown",L),()=>{document.removeEventListener("keydown",T),document.removeEventListener("pointerdown",L)}},[ne]);const U=F.useCallback(()=>{y(""),S(""),O(""),_("")},[]),K=F.useCallback(()=>j(!1),[]),re=[m,w,x,E].filter(Boolean).length,ee=re>0&&M.nodes.length===0;return f.jsx("div",{className:"workbench-graph-lens",children:f.jsx(ju,{model:Ee?n:M,communityDetail:Ee?{...Ee,model:M}:void 0,communityLoading:I,communityError:l,onBackToOverview:P===void 0?c:()=>Q(void 0),initialInspectorLayout:h,onInspectorLayoutChange:p,host:{...e,openCommunity:T=>{r?.[String(T)]?Q(T):e.openCommunity?.(T)}},queryResult:t,sourceRevisions:i,showInspectorHeader:!1,preferredLayout:o,toolbarLeading:f.jsxs("button",{ref:de,className:"workbench-filter-trigger",type:"button","aria-label":"Graph filters","aria-expanded":ne,"aria-controls":V,onClick:()=>j(T=>!T),children:[f.jsx(I3,{"aria-hidden":"true"}),f.jsx("span",{children:"Filters"}),re>0?f.jsx("b",{children:re}):null,f.jsxs("small",{children:[M.nodes.length.toLocaleString()," / ",Ue.nodes.length.toLocaleString()]})]}),toolbarLeadingPanel:ne?f.jsxs("div",{ref:le,id:V,className:"workbench-filter-popover",role:"region","aria-label":"Graph filter options",children:[f.jsxs("header",{children:[f.jsxs("span",{children:[f.jsx("strong",{children:"Filter graph"}),f.jsx("small",{children:"Refine visible nodes and relationships"})]}),f.jsx("button",{type:"button",disabled:re===0,onClick:U,children:"Clear filters"})]}),f.jsx(Fs,{label:"Relationship",value:m,values:Ae.relations,onChange:y}),f.jsx(Fs,{label:"Evidence",value:w,values:Ae.evidence,onChange:S}),f.jsx(Fs,{label:"Node kind",value:x,values:Ae.kinds,onChange:O}),f.jsx(Fs,{label:"Language",value:E,values:Ae.languages,onChange:_}),f.jsx("footer",{role:"status",children:ee?"No nodes match these filters":`Showing ${M.nodes.length.toLocaleString()} of ${Ue.nodes.length.toLocaleString()} nodes`})]}):void 0,toolbarLeadingOpen:ne,onToolbarLeadingClose:K,stageOverlay:Ue.nodes.length===0?f.jsx(B2,{title:"This view has no graph nodes",detail:"The exported graph lens did not contain any nodes to visualize."}):ee&&!ne?f.jsx(B2,{title:"No nodes match these filters",detail:"Clear one or more filters to restore the graph.",onClear:U}):void 0})})}function B2({title:n,detail:e,onClear:t}){return f.jsxs("div",{className:"workbench-graph-empty",role:"status",children:[f.jsx(ac,{"aria-hidden":"true"}),f.jsx("strong",{children:n}),f.jsx("span",{children:e}),t?f.jsx("button",{type:"button",onClick:t,children:"Clear filters"}):null]})}function Fs({label:n,value:e,values:t,onChange:i}){return f.jsxs("label",{children:[f.jsx("span",{children:n}),f.jsxs("select",{value:e,onChange:o=>i(o.target.value),children:[f.jsx("option",{value:"",children:"All"}),t.map(o=>f.jsx("option",{value:o,children:gh(o)},o))]})]})}function qee({model:n,host:e}){const[t,i]=F.useState("production"),[o,r]=F.useState("all"),A=F.useMemo(()=>tte(n,t,o),[o,n,t]),I=A.sections.find(m=>m.nodeCount>0),[l,c]=F.useState(I?{kind:"section",id:I.id}:void 0),h=l?.kind==="section"?n.sections.find(m=>m.id===l.id):void 0,p=l?.kind==="route"?A.routes.find(m=>m.id===l.id):void 0;return f.jsxs("div",{className:"workbench-architecture",children:[f.jsxs("div",{className:"workbench-filter-strip","aria-label":"Architecture filters",children:[f.jsx(Fs,{label:"Source scope",value:t,values:["production","all"],onChange:m=>i(m)}),f.jsx(Fs,{label:"Evidence",value:o,values:["all","extracted","inferred","ambiguous"],onChange:m=>r(m)}),f.jsxs("span",{role:"status",children:[A.statistics.visibleCalls.toLocaleString()," visible calls"]})]}),f.jsxs("div",{className:"workbench-architecture-body",children:[f.jsx(OJ,{overview:A,selection:l,onSelect:c}),f.jsx("aside",{"aria-label":"Architecture details",children:h?f.jsxs(f.Fragment,{children:[f.jsx("span",{children:"Subsystem"}),f.jsx("h2",{children:h.name}),f.jsxs("p",{children:[h.nodes.length.toLocaleString()," symbols · ",h.edges.length.toLocaleString()," internal calls"]}),f.jsx("div",{className:"workbench-symbol-list",children:h.nodes.slice(0,100).map(m=>f.jsxs("button",{type:"button",disabled:!m.sourceFile,onClick:()=>m.sourceFile&&e.openSource({file:m.sourceFile}),children:[f.jsx("strong",{children:m.label}),f.jsxs("small",{children:[m.kind,m.sourceFile?` · ${m.sourceFile}`:""]})]},m.id))})]}):p?f.jsxs(f.Fragment,{children:[f.jsx("span",{children:"Subsystem route"}),f.jsxs("h2",{children:[L2(A,p.sourceSection)," → ",L2(A,p.targetSection)]}),f.jsxs("p",{children:[p.calls.toLocaleString()," calls cross this boundary."]})]}):f.jsx("p",{children:"Select a subsystem or route."})})]})]})}function Jee(n){const e=t=>[...new Set(t.filter(i=>!!i))].sort();return{relations:e(n.edges.map(t=>t.relation)),evidence:e(n.edges.map(t=>t.confidence)),kinds:e(n.nodes.map(t=>t.kind)),languages:e(n.nodes.map(t=>t.language))}}function ete(n,e){const t=n.nodes.filter(I=>(!e.kind||I.kind===e.kind)&&(!e.language||I.language===e.language));let i=new Set(t.map(I=>I.id));const o=n.edges.filter(I=>i.has(I.source)&&i.has(I.target)&&(!e.relation||I.relation===e.relation)&&(!e.evidence||I.confidence===e.evidence));if(e.relation||e.evidence){const I=new Set(o.flatMap(l=>[l.source,l.target]));for(const l of t)l.root&&I.add(l.id);i=I}const r=t.filter(I=>i.has(I.id)),A=new Set(r.map(I=>I.community));return{...n,stats:{...n.stats,nodes:r.length,edges:o.length,communities:A.size},nodes:r,edges:o,communities:n.communities.filter(I=>A.has(I.id))}}function tte(n,e,t){const i=n.sections.filter(S=>S.id!=="overview"),o=S=>e==="all"||S==="production",r=new Map(i.flatMap(S=>S.nodes).map(S=>[S.id,S])),A=S=>(t==="all"||S.confidence===t)&&o(r.get(S.source)?.scope??"unknown")&&o(r.get(S.target)?.scope??"unknown"),I=new Map;for(const S of n.crossSectionCalls.filter(A)){const x=`${S.sourceSection}->${S.targetSection}`,O=I.get(x)??[];O.push(S),I.set(x,O)}const l=[...I.entries()].map(([S,x])=>({id:S,sourceSection:x[0].sourceSection,targetSection:x[0].targetSection,calls:x.length,extracted:x.filter(O=>O.confidence==="extracted").length,inferred:x.filter(O=>O.confidence==="inferred").length,ambiguous:x.filter(O=>O.confidence==="ambiguous").length})).sort((S,x)=>x.calls-S.calls||S.id.localeCompare(x.id)),c=new Map,h=new Map;for(const S of l)h.set(S.sourceSection,(h.get(S.sourceSection)??0)+S.calls),c.set(S.targetSection,(c.get(S.targetSection)??0)+S.calls);const p=i.map(S=>{const x={production:0,test:0,generated:0,vendor:0,unknown:0};for(const O of S.nodes)x[O.scope]+=1;return{id:S.id,name:S.name,nodeCount:S.nodes.filter(O=>o(O.scope)).length,totalNodeCount:S.nodes.length,internalCallCount:S.edges.filter(A).length,incomingCalls:c.get(S.id)??0,outgoingCalls:h.get(S.id)??0,scopes:x}}),m=p.reduce((S,x)=>S+x.nodeCount,0),y=p.reduce((S,x)=>S+x.internalCallCount,0),w=l.reduce((S,x)=>S+x.calls,0);return{title:n.title,scope:e,evidence:t,sections:p,routes:l,statistics:{visibleNodes:m,totalNodes:n.statistics.nodes,visibleCalls:y+w,totalCalls:n.statistics.edges,communities:n.statistics.communities,extracted:n.statistics.extracted,inferred:n.statistics.inferred,ambiguous:n.statistics.ambiguous},coverage:n.coverage,provenance:n.provenance}}function nte({view:n}){const e=n.kind==="code"?ac:n.kind==="call"?rc:n.kind==="impact"?KR:n.kind==="architecture"?YR:n.kind==="history"?Lm:n.kind==="affected"?A3:n.lens==="routes"?Hm:n.lens==="provenance"?HR:r3;return f.jsx(e,{"aria-hidden":"true"})}function P2(n){const e=new URLSearchParams(window.location.hash.slice(1)).get("view");return e&&n.views.some(t=>t.id===e)?e:void 0}function ite(n){const e=n.startsWith("sha256:")?n.slice(7):n;return e.length>12?e.slice(0,12):e}function gte(n){return n.kind==="artifact"?`${gh(n.lens)} lens`:`${gh(n.kind)} graph`}function ote(n){return n.coverage.status==="complete"?"Complete":n.coverage.status==="summary"?"Community summary":"Bounded result"}function gh(n){return n.replaceAll("_"," ").replace(/\b\w/g,e=>e.toUpperCase())}function L2(n,e){return n.sections.find(t=>t.id===e)?.name??e}const ste=Se({provider:It(["github","gitlab","bitbucket"]),repositoryUrl:H().url(),revision:H().regex(/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/i)});function rte(n,e,t=n.revision){if(!ate(t))return;const i=Ate(e.file);if(!i)return;const o=n.repositoryUrl.replace(/\/$/,""),r=Cte(n.provider,e);return n.provider==="gitlab"?`${o}/-/blob/${t}/${i}${r}`:n.provider==="bitbucket"?`${o}/src/${t}/${i}${r}`:`${o}/blob/${t}/${i}${r}`}function G2(n,e,t){if(window.dispatchEvent(new CustomEvent("compass:open-source",{detail:e})),!n)return;const i=rte(n,e,t??n.revision);if(!i)return;const o=document.createElement("a");o.href=i,o.target="_blank",o.rel="noopener noreferrer",o.click()}function ate(n){return/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/i.test(n)}function Ate(n){if(!n||n.startsWith("/")||n.startsWith("\\")||n.includes("\0"))return;const e=n.replaceAll("\\","/").split("/");if(!e.some(t=>!t||t==="."||t===".."))return e.map(encodeURIComponent).join("/")}function Cte(n,e){const t=e.startLine;if(t===void 0)return"";const i=Math.max(t,e.endLine??t);return n==="gitlab"?i===t?`#L${t}`:`#L${t}-${i}`:n==="bitbucket"?i===t?`#lines-${t}`:`#lines-${t}:${i}`:i===t?`#L${t}`:`#L${t}-L${i}`}function F2(){const n=document.getElementById("compass-viewer-root"),e=document.getElementById("compass-viewer-model");if(!n||!e)throw new Error("Compass viewer root or model is missing");const t=JSON.parse(e.textContent??""),i=Ite(),o=JO.createRoot(n),r=kR.safeParse(t);if(r.success){o.render(f.jsx(Xee,{workbench:r.data,host:{openSource(m,y){G2(i,m,y)}}}));return}const A=bg.parse(t),I=new Map;let l,c=null,h;const p=()=>{o.render(f.jsx(ju,{model:A,communityDetail:l,communityLoading:c,communityError:h,onBackToOverview:l?()=>{l=void 0,h=void 0,p()}:void 0,host:{openSource(m,y){G2(i,m,y)},openCommunity(m){c===null&&(c=m,h=void 0,p(),window.setTimeout(()=>{try{let y=I.get(m);if(!y){const w=document.querySelector(`script[data-compass-community="${m}"]`);if(!w)throw new Error(`Community ${m} detail is unavailable in this export.`);y=bg.parse(JSON.parse(w.textContent??"")),I.set(m,y)}l={communityId:m,model:y},window.dispatchEvent(new CustomEvent("compass:open-community",{detail:{communityId:m}}))}catch(y){h=y instanceof Error?y.message:String(y)}finally{c=null,p()}},0))}}}))};p()}function Ite(){const n=document.getElementById("compass-source-navigation");if(!n?.textContent)return;const e=ste.safeParse(JSON.parse(n.textContent));return e.success?e.data:void 0}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",F2,{once:!0}):F2()})(); +`;mo(mq);class vq{constructor(e,t,i,o){var r,A;this.body=e,this.canvas=t,this.selectionHandler=i,this.interactionHandler=o,this.editMode=!1,this.manipulationDiv=void 0,this.editModeDiv=void 0,this.closeDiv=void 0,this._domEventListenerCleanupQueue=[],this.temporaryUIFunctions={},this.temporaryEventFunctions=[],this.touchTime=0,this.temporaryIds={nodes:[],edges:[]},this.guiEnabled=!1,this.inMode=!1,this.selectedControlNode=void 0,this.options={},this.defaultOptions={enabled:!1,initiallyActive:!1,addNode:!0,addEdge:!0,editNode:void 0,editEdge:!0,deleteNode:!0,deleteEdge:!0,controlNodeStyle:{shape:"dot",size:6,color:{background:"#ff0000",border:"#3c3c3c",highlight:{background:"#07f968",border:"#3c3c3c"}},borderWidth:2,borderWidthSelected:2}},Ft(this.options,this.defaultOptions),this.body.emitter.on("destroy",()=>{this._clean()}),this.body.emitter.on("_dataChanged",ge(r=this._restore).call(r,this)),this.body.emitter.on("_resetData",ge(A=this._restore).call(A,this))}_restore(){this.inMode!==!1&&(this.options.initiallyActive===!0?this.enableEditMode():this.disableEditMode())}setOptions(e,t,i){t!==void 0&&(t.locale!==void 0?this.options.locale=t.locale:this.options.locale=i.locale,t.locales!==void 0?this.options.locales=t.locales:this.options.locales=i.locales),e!==void 0&&(typeof e=="boolean"?this.options.enabled=e:(this.options.enabled=!0,vt(this.options,e)),this.options.initiallyActive===!0&&(this.editMode=!0),this._setup())}toggleEditMode(){this.editMode===!0?this.disableEditMode():this.enableEditMode()}enableEditMode(){this.editMode=!0,this._clean(),this.guiEnabled===!0&&(this.manipulationDiv.style.display="block",this.closeDiv.style.display="block",this.editModeDiv.style.display="none",this.showManipulatorToolbar())}disableEditMode(){this.editMode=!1,this._clean(),this.guiEnabled===!0&&(this.manipulationDiv.style.display="none",this.closeDiv.style.display="none",this.editModeDiv.style.display="block",this._createEditButton())}showManipulatorToolbar(){if(this._clean(),this.manipulationDOM={},this.guiEnabled===!0){var e,t;this.editMode=!0,this.manipulationDiv.style.display="block",this.closeDiv.style.display="block";const i=this.selectionHandler.getSelectedNodeCount(),o=this.selectionHandler.getSelectedEdgeCount(),r=i+o,A=this.options.locales[this.options.locale];let I=!1;this.options.addNode!==!1&&(this._createAddNodeButton(A),I=!0),this.options.addEdge!==!1&&(I===!0?this._createSeperator(1):I=!0,this._createAddEdgeButton(A)),i===1&&typeof this.options.editNode=="function"?(I===!0?this._createSeperator(2):I=!0,this._createEditNodeButton(A)):o===1&&i===0&&this.options.editEdge!==!1&&(I===!0?this._createSeperator(3):I=!0,this._createEditEdgeButton(A)),r!==0&&(i>0&&this.options.deleteNode!==!1?(I===!0&&this._createSeperator(4),this._createDeleteButton(A)):i===0&&this.options.deleteEdge!==!1&&(I===!0&&this._createSeperator(4),this._createDeleteButton(A))),this._bindElementEvents(this.closeDiv,ge(e=this.toggleEditMode).call(e,this)),this._temporaryBindEvent("select",ge(t=this.showManipulatorToolbar).call(t,this))}this.body.emitter.emit("_redraw")}addNodeMode(){var e;if(this.editMode!==!0&&this.enableEditMode(),this._clean(),this.inMode="addNode",this.guiEnabled===!0){var t;const i=this.options.locales[this.options.locale];this.manipulationDOM={},this._createBackButton(i),this._createSeperator(),this._createDescription(i.addDescription||this.options.locales.en.addDescription),this._bindElementEvents(this.closeDiv,ge(t=this.toggleEditMode).call(t,this))}this._temporaryBindEvent("click",ge(e=this._performAddNode).call(e,this))}editNode(){this.editMode!==!0&&this.enableEditMode(),this._clean();const e=this.selectionHandler.getSelectedNodes()[0];if(e!==void 0)if(this.inMode="editNode",typeof this.options.editNode=="function")if(e.isCluster!==!0){const t=vt({},e.options,!1);if(t.x=e.x,t.y=e.y,this.options.editNode.length===2)this.options.editNode(t,i=>{i!=null&&this.inMode==="editNode"&&this.body.data.nodes.getDataSet().update(i),this.showManipulatorToolbar()});else throw new Error("The function for edit does not support two arguments (data, callback)")}else alert(this.options.locales[this.options.locale].editClusterError||this.options.locales.en.editClusterError);else throw new Error("No function has been configured to handle the editing of nodes.");else this.showManipulatorToolbar()}addEdgeMode(){var e,t,i,o,r;if(this.editMode!==!0&&this.enableEditMode(),this._clean(),this.inMode="addEdge",this.guiEnabled===!0){var A;const I=this.options.locales[this.options.locale];this.manipulationDOM={},this._createBackButton(I),this._createSeperator(),this._createDescription(I.edgeDescription||this.options.locales.en.edgeDescription),this._bindElementEvents(this.closeDiv,ge(A=this.toggleEditMode).call(A,this))}this._temporaryBindUI("onTouch",ge(e=this._handleConnect).call(e,this)),this._temporaryBindUI("onDragEnd",ge(t=this._finishConnect).call(t,this)),this._temporaryBindUI("onDrag",ge(i=this._dragControlNode).call(i,this)),this._temporaryBindUI("onRelease",ge(o=this._finishConnect).call(o,this)),this._temporaryBindUI("onDragStart",ge(r=this._dragStartEdge).call(r,this)),this._temporaryBindUI("onHold",()=>{})}editEdgeMode(){if(this.editMode!==!0&&this.enableEditMode(),this._clean(),this.inMode="editEdge",typeof this.options.editEdge=="object"&&typeof this.options.editEdge.editWithoutDrag=="function"&&(this.edgeBeingEditedId=this.selectionHandler.getSelectedEdgeIds()[0],this.edgeBeingEditedId!==void 0)){const A=this.body.edges[this.edgeBeingEditedId];this._performEditEdge(A.from.id,A.to.id);return}if(this.guiEnabled===!0){var e;const A=this.options.locales[this.options.locale];this.manipulationDOM={},this._createBackButton(A),this._createSeperator(),this._createDescription(A.editEdgeDescription||this.options.locales.en.editEdgeDescription),this._bindElementEvents(this.closeDiv,ge(e=this.toggleEditMode).call(e,this))}if(this.edgeBeingEditedId=this.selectionHandler.getSelectedEdgeIds()[0],this.edgeBeingEditedId!==void 0){var t,i,o,r;const A=this.body.edges[this.edgeBeingEditedId],I=this._getNewTargetNode(A.from.x,A.from.y),l=this._getNewTargetNode(A.to.x,A.to.y);this.temporaryIds.nodes.push(I.id),this.temporaryIds.nodes.push(l.id),this.body.nodes[I.id]=I,this.body.nodeIndices.push(I.id),this.body.nodes[l.id]=l,this.body.nodeIndices.push(l.id),this._temporaryBindUI("onTouch",ge(t=this._controlNodeTouch).call(t,this)),this._temporaryBindUI("onTap",()=>{}),this._temporaryBindUI("onHold",()=>{}),this._temporaryBindUI("onDragStart",ge(i=this._controlNodeDragStart).call(i,this)),this._temporaryBindUI("onDrag",ge(o=this._controlNodeDrag).call(o,this)),this._temporaryBindUI("onDragEnd",ge(r=this._controlNodeDragEnd).call(r,this)),this._temporaryBindUI("onMouseMove",()=>{}),this._temporaryBindEvent("beforeDrawing",c=>{const h=A.edgeType.findBorderPositions(c);I.selected===!1&&(I.x=h.from.x,I.y=h.from.y),l.selected===!1&&(l.x=h.to.x,l.y=h.to.y)}),this.body.emitter.emit("_redraw")}else this.showManipulatorToolbar()}deleteSelected(){this.editMode!==!0&&this.enableEditMode(),this._clean(),this.inMode="delete";const e=this.selectionHandler.getSelectedNodeIds(),t=this.selectionHandler.getSelectedEdgeIds();let i;if(e.length>0){for(let o=0;o0&&typeof this.options.deleteEdge=="function"&&(i=this.options.deleteEdge);if(typeof i=="function"){const o={nodes:e,edges:t};if(i.length===2)i(o,r=>{r!=null&&this.inMode==="delete"?(this.body.data.edges.getDataSet().remove(r.edges),this.body.data.nodes.getDataSet().remove(r.nodes),this.body.emitter.emit("startSimulation"),this.showManipulatorToolbar()):(this.body.emitter.emit("startSimulation"),this.showManipulatorToolbar())});else throw new Error("The function for delete does not support two arguments (data, callback)")}else this.body.data.edges.getDataSet().remove(t),this.body.data.nodes.getDataSet().remove(e),this.body.emitter.emit("startSimulation"),this.showManipulatorToolbar()}_setup(){this.options.enabled===!0?(this.guiEnabled=!0,this._createWrappers(),this.editMode===!1?this._createEditButton():this.showManipulatorToolbar()):(this._removeManipulationDOM(),this.guiEnabled=!1)}_createWrappers(){if(this.manipulationDiv===void 0&&(this.manipulationDiv=document.createElement("div"),this.manipulationDiv.className="vis-manipulation",this.editMode===!0?this.manipulationDiv.style.display="block":this.manipulationDiv.style.display="none",this.canvas.frame.appendChild(this.manipulationDiv)),this.editModeDiv===void 0&&(this.editModeDiv=document.createElement("div"),this.editModeDiv.className="vis-edit-mode",this.editMode===!0?this.editModeDiv.style.display="none":this.editModeDiv.style.display="block",this.canvas.frame.appendChild(this.editModeDiv)),this.closeDiv===void 0){var e,t;this.closeDiv=document.createElement("button"),this.closeDiv.className="vis-close",this.closeDiv.setAttribute("aria-label",(e=(t=this.options.locales[this.options.locale])===null||t===void 0?void 0:t.close)!==null&&e!==void 0?e:this.options.locales.en.close),this.closeDiv.style.display=this.manipulationDiv.style.display,this.canvas.frame.appendChild(this.closeDiv)}}_getNewTargetNode(e,t){const i=vt({},this.options.controlNodeStyle);i.id="targetNode"+Zs(),i.hidden=!1,i.physics=!1,i.x=e,i.y=t;const o=this.body.functions.createNode(i);return o.shape.boundingBox={left:e,right:e,top:t,bottom:t},o}_createEditButton(){var e;this._clean(),this.manipulationDOM={},Dg(this.editModeDiv);const t=this.options.locales[this.options.locale],i=this._createButton("editMode","vis-edit vis-edit-mode",t.edit||this.options.locales.en.edit);this.editModeDiv.appendChild(i),this._bindElementEvents(i,ge(e=this.toggleEditMode).call(e,this))}_clean(){this.inMode=!1,this.guiEnabled===!0&&(Dg(this.editModeDiv),Dg(this.manipulationDiv),this._cleanupDOMEventListeners()),this._cleanupTemporaryNodesAndEdges(),this._unbindTemporaryUIs(),this._unbindTemporaryEvents(),this.body.emitter.emit("restorePhysics")}_cleanupDOMEventListeners(){for(const t of Di(e=this._domEventListenerCleanupQueue).call(e,0)){var e;t()}}_removeManipulationDOM(){this._clean(),Dg(this.manipulationDiv),Dg(this.editModeDiv),Dg(this.closeDiv),this.manipulationDiv&&this.canvas.frame.removeChild(this.manipulationDiv),this.editModeDiv&&this.canvas.frame.removeChild(this.editModeDiv),this.closeDiv&&this.canvas.frame.removeChild(this.closeDiv),this.manipulationDiv=void 0,this.editModeDiv=void 0,this.closeDiv=void 0}_createSeperator(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1;this.manipulationDOM["seperatorLineDiv"+e]=document.createElement("div"),this.manipulationDOM["seperatorLineDiv"+e].className="vis-separator-line",this.manipulationDiv.appendChild(this.manipulationDOM["seperatorLineDiv"+e])}_createAddNodeButton(e){var t;const i=this._createButton("addNode","vis-add",e.addNode||this.options.locales.en.addNode);this.manipulationDiv.appendChild(i),this._bindElementEvents(i,ge(t=this.addNodeMode).call(t,this))}_createAddEdgeButton(e){var t;const i=this._createButton("addEdge","vis-connect",e.addEdge||this.options.locales.en.addEdge);this.manipulationDiv.appendChild(i),this._bindElementEvents(i,ge(t=this.addEdgeMode).call(t,this))}_createEditNodeButton(e){var t;const i=this._createButton("editNode","vis-edit",e.editNode||this.options.locales.en.editNode);this.manipulationDiv.appendChild(i),this._bindElementEvents(i,ge(t=this.editNode).call(t,this))}_createEditEdgeButton(e){var t;const i=this._createButton("editEdge","vis-edit",e.editEdge||this.options.locales.en.editEdge);this.manipulationDiv.appendChild(i),this._bindElementEvents(i,ge(t=this.editEdgeMode).call(t,this))}_createDeleteButton(e){var t;let i;this.options.rtl?i="vis-delete-rtl":i="vis-delete";const o=this._createButton("delete",i,e.del||this.options.locales.en.del);this.manipulationDiv.appendChild(o),this._bindElementEvents(o,ge(t=this.deleteSelected).call(t,this))}_createBackButton(e){var t;const i=this._createButton("back","vis-back",e.back||this.options.locales.en.back);this.manipulationDiv.appendChild(i),this._bindElementEvents(i,ge(t=this.showManipulatorToolbar).call(t,this))}_createButton(e,t,i){let o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"vis-label";return this.manipulationDOM[e+"Div"]=document.createElement("button"),this.manipulationDOM[e+"Div"].className="vis-button "+t,this.manipulationDOM[e+"Label"]=document.createElement("div"),this.manipulationDOM[e+"Label"].className=o,this.manipulationDOM[e+"Label"].innerText=i,this.manipulationDOM[e+"Div"].appendChild(this.manipulationDOM[e+"Label"]),this.manipulationDOM[e+"Div"]}_createDescription(e){this.manipulationDOM.descriptionLabel=document.createElement("div"),this.manipulationDOM.descriptionLabel.className="vis-none",this.manipulationDOM.descriptionLabel.innerText=e,this.manipulationDiv.appendChild(this.manipulationDOM.descriptionLabel)}_temporaryBindEvent(e,t){this.temporaryEventFunctions.push({event:e,boundFunction:t}),this.body.emitter.on(e,t)}_temporaryBindUI(e,t){if(this.body.eventListeners[e]!==void 0)this.temporaryUIFunctions[e]=this.body.eventListeners[e],this.body.eventListeners[e]=t;else throw new Error("This UI function does not exist. Typo? You tried: "+e+" possible are: "+ws(xt(this.body.eventListeners)))}_unbindTemporaryUIs(){for(const e in this.temporaryUIFunctions)Object.prototype.hasOwnProperty.call(this.temporaryUIFunctions,e)&&(this.body.eventListeners[e]=this.temporaryUIFunctions[e],delete this.temporaryUIFunctions[e]);this.temporaryUIFunctions={}}_unbindTemporaryEvents(){for(let e=0;e{i.destroy()});const o=r=>{let{keyCode:A,key:I}=r;(I==="Enter"||I===" "||A===13||A===32)&&t()};e.addEventListener("keyup",o,!1),this._domEventListenerCleanupQueue.push(()=>{e.removeEventListener("keyup",o,!1)})}_cleanupTemporaryNodesAndEdges(){for(let r=0;r=0;I--)if(r[I]!==this.selectedControlNode.id){A=this.body.nodes[r[I]];break}if(A!==void 0&&this.selectedControlNode!==void 0)if(A.isCluster===!0)alert(this.options.locales[this.options.locale].createEdgeError||this.options.locales.en.createEdgeError);else{const I=this.body.nodes[this.temporaryIds.nodes[0]];this.selectedControlNode.id===I.id?this._performEditEdge(A.id,o.to.id):this._performEditEdge(o.from.id,A.id)}else o.updateEdgeType(),this.body.emitter.emit("restorePhysics");this.body.emitter.emit("_redraw")}_handleConnect(e){if(new Date().valueOf()-this.touchTime>100){this.lastTouch=this.body.functions.getPointer(e.center),this.lastTouch.translation=Ft({},this.body.view.translation),this.interactionHandler.drag.pointer=this.lastTouch,this.interactionHandler.drag.translation=this.lastTouch.translation;const t=this.lastTouch,i=this.selectionHandler.getNodeAt(t);if(i!==void 0)if(i.isCluster===!0)alert(this.options.locales[this.options.locale].createEdgeError||this.options.locales.en.createEdgeError);else{const o=this._getNewTargetNode(i.x,i.y);this.body.nodes[o.id]=o,this.body.nodeIndices.push(o.id);const r=this.body.functions.createEdge({id:"connectionEdge"+Zs(),from:i.id,to:o.id,physics:!1,smooth:{enabled:!0,type:"continuous",roundness:.5}});this.body.edges[r.id]=r,this.body.edgeIndices.push(r.id),this.temporaryIds.nodes.push(o.id),this.temporaryIds.edges.push(r.id)}this.touchTime=new Date().valueOf()}}_dragControlNode(e){const t=this.body.functions.getPointer(e.center),i=this.selectionHandler._pointerToPositionObject(t);let o;this.temporaryIds.edges[0]!==void 0&&(o=this.body.edges[this.temporaryIds.edges[0]].fromId);const r=this.selectionHandler._getAllNodesOverlappingWith(i);let A;for(let l=r.length-1;l>=0;l--){var I;if(Ct(I=this.temporaryIds.nodes).call(I,r[l])===-1){A=this.body.nodes[r[l]];break}}if(e.controlEdge={from:o,to:A?A.id:void 0},this.selectionHandler.generateClickEvent("controlNodeDragging",e,t),this.temporaryIds.nodes[0]!==void 0){const l=this.body.nodes[this.temporaryIds.nodes[0]];l.x=this.canvas._XconvertDOMtoCanvas(t.x),l.y=this.canvas._YconvertDOMtoCanvas(t.y),this.body.emitter.emit("_redraw")}else this.interactionHandler.onDrag(e)}_finishConnect(e){const t=this.body.functions.getPointer(e.center),i=this.selectionHandler._pointerToPositionObject(t);let o;this.temporaryIds.edges[0]!==void 0&&(o=this.body.edges[this.temporaryIds.edges[0]].fromId);const r=this.selectionHandler._getAllNodesOverlappingWith(i);let A;for(let l=r.length-1;l>=0;l--){var I;if(Ct(I=this.temporaryIds.nodes).call(I,r[l])===-1){A=this.body.nodes[r[l]];break}}this._cleanupTemporaryNodesAndEdges(),A!==void 0&&(A.isCluster===!0?alert(this.options.locales[this.options.locale].createEdgeError||this.options.locales.en.createEdgeError):this.body.nodes[o]!==void 0&&this.body.nodes[A.id]!==void 0&&this._performAddEdge(o,A.id)),e.controlEdge={from:o,to:A?A.id:void 0},this.selectionHandler.generateClickEvent("controlNodeDragEnd",e,t),this.body.emitter.emit("_redraw")}_dragStartEdge(e){const t=this.lastTouch;this.selectionHandler.generateClickEvent("dragStart",e,t,void 0,!0)}_performAddNode(e){const t={id:Zs(),x:e.pointer.canvas.x,y:e.pointer.canvas.y,label:"new"};if(typeof this.options.addNode=="function")if(this.options.addNode.length===2)this.options.addNode(t,i=>{i!=null&&this.inMode==="addNode"&&this.body.data.nodes.getDataSet().add(i),this.showManipulatorToolbar()});else throw this.showManipulatorToolbar(),new Error("The function for add does not support two arguments (data,callback)");else this.body.data.nodes.getDataSet().add(t),this.showManipulatorToolbar()}_performAddEdge(e,t){const i={from:e,to:t};if(typeof this.options.addEdge=="function")if(this.options.addEdge.length===2)this.options.addEdge(i,o=>{o!=null&&this.inMode==="addEdge"&&(this.body.data.edges.getDataSet().add(o),this.selectionHandler.unselectAll(),this.showManipulatorToolbar())});else throw new Error("The function for connect does not support two arguments (data,callback)");else this.body.data.edges.getDataSet().add(i),this.selectionHandler.unselectAll(),this.showManipulatorToolbar()}_performEditEdge(e,t){const i={id:this.edgeBeingEditedId,from:e,to:t,label:this.body.data.edges.get(this.edgeBeingEditedId).label};let o=this.options.editEdge;if(typeof o=="object"&&(o=o.editWithoutDrag),typeof o=="function")if(o.length===2)o(i,r=>{r==null||this.inMode!=="editEdge"?(this.body.edges[i.id].updateEdgeType(),this.body.emitter.emit("_redraw"),this.showManipulatorToolbar()):(this.body.data.edges.getDataSet().update(r),this.selectionHandler.unselectAll(),this.showManipulatorToolbar())});else throw new Error("The function for edit does not support two arguments (data, callback)");else this.body.data.edges.getDataSet().update(i),this.selectionHandler.unselectAll(),this.showManipulatorToolbar()}}const re="string",oe="boolean",K="number",Za="array",we="object",kx="dom",yq="any",zu=["arrow","bar","box","circle","crow","curve","diamond","image","inv_curve","inv_triangle","triangle","vee"],ku={borderWidth:{number:K},borderWidthSelected:{number:K,undefined:"undefined"},brokenImage:{string:re,undefined:"undefined"},chosen:{label:{boolean:oe,function:"function"},node:{boolean:oe,function:"function"},__type__:{object:we,boolean:oe}},color:{border:{string:re},background:{string:re},highlight:{border:{string:re},background:{string:re},__type__:{object:we,string:re}},hover:{border:{string:re},background:{string:re},__type__:{object:we,string:re}},__type__:{object:we,string:re}},opacity:{number:K,undefined:"undefined"},fixed:{x:{boolean:oe},y:{boolean:oe},__type__:{object:we,boolean:oe}},font:{align:{string:re},color:{string:re},size:{number:K},face:{string:re},background:{string:re},strokeWidth:{number:K},strokeColor:{string:re},vadjust:{number:K},multi:{boolean:oe,string:re},bold:{color:{string:re},size:{number:K},face:{string:re},mod:{string:re},vadjust:{number:K},__type__:{object:we,string:re}},boldital:{color:{string:re},size:{number:K},face:{string:re},mod:{string:re},vadjust:{number:K},__type__:{object:we,string:re}},ital:{color:{string:re},size:{number:K},face:{string:re},mod:{string:re},vadjust:{number:K},__type__:{object:we,string:re}},mono:{color:{string:re},size:{number:K},face:{string:re},mod:{string:re},vadjust:{number:K},__type__:{object:we,string:re}},__type__:{object:we,string:re}},group:{string:re,number:K,undefined:"undefined"},heightConstraint:{minimum:{number:K},valign:{string:re},__type__:{object:we,boolean:oe,number:K}},hidden:{boolean:oe},icon:{face:{string:re},code:{string:re},size:{number:K},color:{string:re},weight:{string:re,number:K},__type__:{object:we}},id:{string:re,number:K},image:{selected:{string:re,undefined:"undefined"},unselected:{string:re,undefined:"undefined"},__type__:{object:we,string:re}},imagePadding:{top:{number:K},right:{number:K},bottom:{number:K},left:{number:K},__type__:{object:we,number:K}},label:{string:re,undefined:"undefined"},labelHighlightBold:{boolean:oe},level:{number:K,undefined:"undefined"},margin:{top:{number:K},right:{number:K},bottom:{number:K},left:{number:K},__type__:{object:we,number:K}},mass:{number:K},physics:{boolean:oe},scaling:{min:{number:K},max:{number:K},label:{enabled:{boolean:oe},min:{number:K},max:{number:K},maxVisible:{number:K},drawThreshold:{number:K},__type__:{object:we,boolean:oe}},customScalingFunction:{function:"function"},__type__:{object:we}},shadow:{enabled:{boolean:oe},color:{string:re},size:{number:K},x:{number:K},y:{number:K},__type__:{object:we,boolean:oe}},shape:{string:["custom","ellipse","circle","database","box","text","image","circularImage","diamond","dot","star","triangle","triangleDown","square","icon","hexagon"]},ctxRenderer:{function:"function"},shapeProperties:{borderDashes:{boolean:oe,array:Za},borderRadius:{number:K},interpolation:{boolean:oe},useImageSize:{boolean:oe},useBorderWithImage:{boolean:oe},coordinateOrigin:{string:["center","top-left"]},__type__:{object:we}},size:{number:K},title:{string:re,dom:kx,undefined:"undefined"},value:{number:K,undefined:"undefined"},widthConstraint:{minimum:{number:K},maximum:{number:K},__type__:{object:we,boolean:oe,number:K}},x:{number:K},y:{number:K},__type__:{object:we}},bq={configure:{enabled:{boolean:oe},filter:{boolean:oe,string:re,array:Za,function:"function"},container:{dom:kx},showButton:{boolean:oe},__type__:{object:we,boolean:oe,string:re,array:Za,function:"function"}},edges:{arrows:{to:{enabled:{boolean:oe},scaleFactor:{number:K},type:{string:zu},imageHeight:{number:K},imageWidth:{number:K},src:{string:re},__type__:{object:we,boolean:oe}},middle:{enabled:{boolean:oe},scaleFactor:{number:K},type:{string:zu},imageWidth:{number:K},imageHeight:{number:K},src:{string:re},__type__:{object:we,boolean:oe}},from:{enabled:{boolean:oe},scaleFactor:{number:K},type:{string:zu},imageWidth:{number:K},imageHeight:{number:K},src:{string:re},__type__:{object:we,boolean:oe}},__type__:{string:["from","to","middle"],object:we}},endPointOffset:{from:{number:K},to:{number:K},__type__:{object:we,number:K}},arrowStrikethrough:{boolean:oe},background:{enabled:{boolean:oe},color:{string:re},size:{number:K},dashes:{boolean:oe,array:Za},__type__:{object:we,boolean:oe}},chosen:{label:{boolean:oe,function:"function"},edge:{boolean:oe,function:"function"},__type__:{object:we,boolean:oe}},color:{color:{string:re},highlight:{string:re},hover:{string:re},inherit:{string:["from","to","both"],boolean:oe},opacity:{number:K},__type__:{object:we,string:re}},dashes:{boolean:oe,array:Za},font:{color:{string:re},size:{number:K},face:{string:re},background:{string:re},strokeWidth:{number:K},strokeColor:{string:re},align:{string:["horizontal","top","middle","bottom"]},vadjust:{number:K},multi:{boolean:oe,string:re},bold:{color:{string:re},size:{number:K},face:{string:re},mod:{string:re},vadjust:{number:K},__type__:{object:we,string:re}},boldital:{color:{string:re},size:{number:K},face:{string:re},mod:{string:re},vadjust:{number:K},__type__:{object:we,string:re}},ital:{color:{string:re},size:{number:K},face:{string:re},mod:{string:re},vadjust:{number:K},__type__:{object:we,string:re}},mono:{color:{string:re},size:{number:K},face:{string:re},mod:{string:re},vadjust:{number:K},__type__:{object:we,string:re}},__type__:{object:we,string:re}},hidden:{boolean:oe},hoverWidth:{function:"function",number:K},label:{string:re,undefined:"undefined"},labelHighlightBold:{boolean:oe},length:{number:K,undefined:"undefined"},physics:{boolean:oe},scaling:{min:{number:K},max:{number:K},label:{enabled:{boolean:oe},min:{number:K},max:{number:K},maxVisible:{number:K},drawThreshold:{number:K},__type__:{object:we,boolean:oe}},customScalingFunction:{function:"function"},__type__:{object:we}},selectionWidth:{function:"function",number:K},selfReferenceSize:{number:K},selfReference:{size:{number:K},angle:{number:K},renderBehindTheNode:{boolean:oe},__type__:{object:we}},shadow:{enabled:{boolean:oe},color:{string:re},size:{number:K},x:{number:K},y:{number:K},__type__:{object:we,boolean:oe}},smooth:{enabled:{boolean:oe},type:{string:["dynamic","continuous","discrete","diagonalCross","straightCross","horizontal","vertical","curvedCW","curvedCCW","cubicBezier"]},roundness:{number:K},forceDirection:{string:["horizontal","vertical","none"],boolean:oe},__type__:{object:we,boolean:oe}},title:{string:re,undefined:"undefined"},width:{number:K},widthConstraint:{maximum:{number:K},__type__:{object:we,boolean:oe,number:K}},value:{number:K,undefined:"undefined"},__type__:{object:we}},groups:{useDefaultGroups:{boolean:oe},__any__:ku,__type__:{object:we}},interaction:{dragNodes:{boolean:oe},dragView:{boolean:oe},hideEdgesOnDrag:{boolean:oe},hideEdgesOnZoom:{boolean:oe},hideNodesOnDrag:{boolean:oe},hover:{boolean:oe},keyboard:{enabled:{boolean:oe},speed:{x:{number:K},y:{number:K},zoom:{number:K},__type__:{object:we}},bindToWindow:{boolean:oe},autoFocus:{boolean:oe},__type__:{object:we,boolean:oe}},multiselect:{boolean:oe},navigationButtons:{boolean:oe},selectable:{boolean:oe},selectConnectedEdges:{boolean:oe},hoverConnectedEdges:{boolean:oe},tooltipDelay:{number:K},zoomView:{boolean:oe},zoomSpeed:{number:K},__type__:{object:we}},layout:{randomSeed:{undefined:"undefined",number:K,string:re},improvedLayout:{boolean:oe},clusterThreshold:{number:K},hierarchical:{enabled:{boolean:oe},levelSeparation:{number:K},nodeSpacing:{number:K},treeSpacing:{number:K},blockShifting:{boolean:oe},edgeMinimization:{boolean:oe},parentCentralization:{boolean:oe},direction:{string:["UD","DU","LR","RL"]},sortMethod:{string:["hubsize","directed"]},shakeTowards:{string:["leaves","roots"]},__type__:{object:we,boolean:oe}},__type__:{object:we}},manipulation:{enabled:{boolean:oe},initiallyActive:{boolean:oe},addNode:{boolean:oe,function:"function"},addEdge:{boolean:oe,function:"function"},editNode:{function:"function"},editEdge:{editWithoutDrag:{function:"function"},__type__:{object:we,boolean:oe,function:"function"}},deleteNode:{boolean:oe,function:"function"},deleteEdge:{boolean:oe,function:"function"},controlNodeStyle:ku,__type__:{object:we,boolean:oe}},nodes:ku,physics:{enabled:{boolean:oe},barnesHut:{theta:{number:K},gravitationalConstant:{number:K},centralGravity:{number:K},springLength:{number:K},springConstant:{number:K},damping:{number:K},avoidOverlap:{number:K},__type__:{object:we}},forceAtlas2Based:{theta:{number:K},gravitationalConstant:{number:K},centralGravity:{number:K},springLength:{number:K},springConstant:{number:K},damping:{number:K},avoidOverlap:{number:K},__type__:{object:we}},repulsion:{centralGravity:{number:K},springLength:{number:K},springConstant:{number:K},nodeDistance:{number:K},damping:{number:K},__type__:{object:we}},hierarchicalRepulsion:{centralGravity:{number:K},springLength:{number:K},springConstant:{number:K},nodeDistance:{number:K},damping:{number:K},avoidOverlap:{number:K},__type__:{object:we}},maxVelocity:{number:K},minVelocity:{number:K},solver:{string:["barnesHut","repulsion","hierarchicalRepulsion","forceAtlas2Based"]},stabilization:{enabled:{boolean:oe},iterations:{number:K},updateInterval:{number:K},onlyDynamicEdges:{boolean:oe},fit:{boolean:oe},__type__:{object:we,boolean:oe}},timestep:{number:K},adaptiveTimestep:{boolean:oe},wind:{x:{number:K},y:{number:K},__type__:{object:we}},__type__:{object:we,boolean:oe}},autoResize:{boolean:oe},clickToUse:{boolean:oe},locale:{string:re},locales:{__any__:{any:yq},__type__:{object:we}},height:{string:re},width:{string:re},__type__:{object:we}},Rx={nodes:{borderWidth:[1,0,10,1],borderWidthSelected:[2,0,10,1],color:{border:["color","#2B7CE9"],background:["color","#97C2FC"],highlight:{border:["color","#2B7CE9"],background:["color","#D2E5FF"]},hover:{border:["color","#2B7CE9"],background:["color","#D2E5FF"]}},opacity:[0,0,1,.1],fixed:{x:!1,y:!1},font:{color:["color","#343434"],size:[14,0,100,1],face:["arial","verdana","tahoma"],background:["color","none"],strokeWidth:[0,0,50,1],strokeColor:["color","#ffffff"]},hidden:!1,labelHighlightBold:!0,physics:!0,scaling:{min:[10,0,200,1],max:[30,0,200,1],label:{enabled:!1,min:[14,0,200,1],max:[30,0,200,1],maxVisible:[30,0,200,1],drawThreshold:[5,0,20,1]}},shadow:{enabled:!1,color:"rgba(0,0,0,0.5)",size:[10,0,20,1],x:[5,-30,30,1],y:[5,-30,30,1]},shape:["ellipse","box","circle","database","diamond","dot","square","star","text","triangle","triangleDown","hexagon"],shapeProperties:{borderDashes:!1,borderRadius:[6,0,20,1],interpolation:!0,useImageSize:!1},size:[25,0,200,1]},edges:{arrows:{to:{enabled:!1,scaleFactor:[1,0,3,.05],type:"arrow"},middle:{enabled:!1,scaleFactor:[1,0,3,.05],type:"arrow"},from:{enabled:!1,scaleFactor:[1,0,3,.05],type:"arrow"}},endPointOffset:{from:[0,-10,10,1],to:[0,-10,10,1]},arrowStrikethrough:!0,color:{color:["color","#848484"],highlight:["color","#848484"],hover:["color","#848484"],inherit:["from","to","both",!0,!1],opacity:[1,0,1,.05]},dashes:!1,font:{color:["color","#343434"],size:[14,0,100,1],face:["arial","verdana","tahoma"],background:["color","none"],strokeWidth:[2,0,50,1],strokeColor:["color","#ffffff"],align:["horizontal","top","middle","bottom"]},hidden:!1,hoverWidth:[1.5,0,5,.1],labelHighlightBold:!0,physics:!0,scaling:{min:[1,0,100,1],max:[15,0,100,1],label:{enabled:!0,min:[14,0,200,1],max:[30,0,200,1],maxVisible:[30,0,200,1],drawThreshold:[5,0,20,1]}},selectionWidth:[1.5,0,5,.1],selfReferenceSize:[20,0,200,1],selfReference:{size:[20,0,200,1],angle:[Math.PI/2,-6*Math.PI,6*Math.PI,Math.PI/8],renderBehindTheNode:!0},shadow:{enabled:!1,color:"rgba(0,0,0,0.5)",size:[10,0,20,1],x:[5,-30,30,1],y:[5,-30,30,1]},smooth:{enabled:!0,type:["dynamic","continuous","discrete","diagonalCross","straightCross","horizontal","vertical","curvedCW","curvedCCW","cubicBezier"],forceDirection:["horizontal","vertical","none"],roundness:[.5,0,1,.05]},width:[1,0,30,1]},layout:{hierarchical:{enabled:!1,levelSeparation:[150,20,500,5],nodeSpacing:[100,20,500,5],treeSpacing:[200,20,500,5],blockShifting:!0,edgeMinimization:!0,parentCentralization:!0,direction:["UD","DU","LR","RL"],sortMethod:["hubsize","directed"],shakeTowards:["leaves","roots"]}},interaction:{dragNodes:!0,dragView:!0,hideEdgesOnDrag:!1,hideEdgesOnZoom:!1,hideNodesOnDrag:!1,hover:!1,keyboard:{enabled:!1,speed:{x:[10,0,40,1],y:[10,0,40,1],zoom:[.02,0,.1,.005]},bindToWindow:!0,autoFocus:!0},multiselect:!1,navigationButtons:!1,selectable:!0,selectConnectedEdges:!0,hoverConnectedEdges:!0,tooltipDelay:[300,0,1e3,25],zoomView:!0,zoomSpeed:[1,.1,2,.1]},manipulation:{enabled:!1,initiallyActive:!1},physics:{enabled:!0,barnesHut:{theta:[.5,.1,1,.05],gravitationalConstant:[-2e3,-3e4,0,50],centralGravity:[.3,0,10,.05],springLength:[95,0,500,5],springConstant:[.04,0,1.2,.005],damping:[.09,0,1,.01],avoidOverlap:[0,0,1,.01]},forceAtlas2Based:{theta:[.5,.1,1,.05],gravitationalConstant:[-50,-500,0,1],centralGravity:[.01,0,1,.005],springLength:[95,0,500,5],springConstant:[.08,0,1.2,.005],damping:[.4,0,1,.01],avoidOverlap:[0,0,1,.01]},repulsion:{centralGravity:[.2,0,10,.05],springLength:[200,0,500,5],springConstant:[.05,0,1.2,.005],nodeDistance:[100,0,500,5],damping:[.09,0,1,.01]},hierarchicalRepulsion:{centralGravity:[.2,0,10,.05],springLength:[100,0,500,5],springConstant:[.01,0,1.2,.005],nodeDistance:[120,0,500,5],damping:[.09,0,1,.01],avoidOverlap:[0,0,1,.01]},maxVelocity:[50,0,150,1],minVelocity:[.1,.01,.5,.01],solver:["barnesHut","forceAtlas2Based","repulsion","hierarchicalRepulsion"],timestep:[.5,.01,1,.01],wind:{x:[0,-10,10,.1],y:[0,-10,10,.1]}}},wq=(n,e,t)=>{var i;return!!(Tg(n).call(n,"physics")&&Tg(i=Rx.physics.solver).call(i,e)&&t.physics.solver!==e&&e!=="wind")};class xq{constructor(){}getDistances(e,t,i){const o={},r=e.edges;for(let I=0;I2&&arguments[2]!==void 0?arguments[2]:!1;const o=this.distanceSolver.getDistances(this.body,e,t);this._createL_matrix(o),this._createK_matrix(o),this._createE_matrix();const r=.01,A=1;let I=0;const l=Math.max(1e3,Math.min(10*this.body.nodeIndices.length,6e3)),c=5;let h=1e9,p=0,m=0,y=0,w=0,S=0;for(;h>r&&IA&&Sthis.body.emitter.emit("_requestRedraw")),this.groups=new rH,this.canvas=new m$(this.body),this.selectionHandler=new J$(this.body,this.canvas),this.interactionHandler=new x$(this.body,this.canvas,this.selectionHandler),this.view=new y$(this.body,this.canvas),this.renderer=new d$(this.body,this.canvas),this.physics=new I$(this.body),this.layoutEngine=new pq(this.body),this.clustering=new c$(this.body),this.manipulation=new vq(this.body,this.canvas,this.selectionHandler,this.interactionHandler),this.nodesHandler=new _X(this.body,this.images,this.groups,this.layoutEngine),this.edgesHandler=new o$(this.body,this.images,this.groups),this.body.modules.kamadaKawai=new Sq(this.body,150,.05),this.body.modules.clustering=this.clustering,this.canvas._create(),this.setOptions(t),this.setData(e)}my(pe.prototype),pe.prototype.setOptions=function(n){if(n===null&&(n=void 0),n!==void 0){if(qV.validate(n,bq)===!0&&console.error("%cErrors have been found in the supplied options object.",v1),Ms(["locale","locales","clickToUse"],this.options,n),n.locale!==void 0&&(n.locale=IU(n.locales||this.options.locales,n.locale)),n=this.layoutEngine.setOptions(n.layout,n),this.canvas.setOptions(n),this.groups.setOptions(n.groups),this.nodesHandler.setOptions(n.nodes),this.edgesHandler.setOptions(n.edges),this.physics.setOptions(n.physics),this.manipulation.setOptions(n.manipulation,n,this.options),this.interactionHandler.setOptions(n.interaction),this.renderer.setOptions(n.interaction),this.selectionHandler.setOptions(n.interaction),n.groups!==void 0&&this.body.emitter.emit("refreshNodes"),"configure"in n&&(this.configurator||(this.configurator=new XV(this,this.body.container,Rx,this.canvas.pixelRatio,wq)),this.configurator.setOptions(n.configure)),this.configurator&&this.configurator.options.enabled===!0){const i={nodes:{},edges:{},layout:{},interaction:{},manipulation:{},physics:{},global:{}};vt(i.nodes,this.nodesHandler.options),vt(i.edges,this.edgesHandler.options),vt(i.layout,this.layoutEngine.options),vt(i.interaction,this.selectionHandler.options),vt(i.interaction,this.renderer.options),vt(i.interaction,this.interactionHandler.options),vt(i.manipulation,this.manipulation.options),vt(i.physics,this.physics.options),vt(i.global,this.canvas.options),vt(i.global,this.options),this.configurator.setModuleOptions(i)}n.clickToUse!==void 0?n.clickToUse===!0?this.activator===void 0&&(this.activator=new QV(this.canvas.frame),this.activator.on("change",()=>{this.body.emitter.emit("activate")})):(this.activator!==void 0&&(this.activator.destroy(),delete this.activator),this.body.emitter.emit("activate")):this.body.emitter.emit("activate"),this.canvas.setSize(),this.body.emitter.emit("startSimulation")}},pe.prototype._updateVisibleIndices=function(){const n=this.body.nodes,e=this.body.edges;this.body.nodeIndices=[],this.body.edgeIndices=[];for(const t in n)Object.prototype.hasOwnProperty.call(n,t)&&!this.clustering._isClusteredNode(t)&&n[t].options.hidden===!1&&this.body.nodeIndices.push(n[t].id);for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)){const i=e[t],o=n[i.fromId],r=n[i.toId],A=o!==void 0&&r!==void 0;!this.clustering._isClusteredEdge(t)&&i.options.hidden===!1&&A&&o.options.hidden===!1&&r.options.hidden===!1&&this.body.edgeIndices.push(i.id)}},pe.prototype.bindEventListeners=function(){this.body.emitter.on("_dataChanged",()=>{this.edgesHandler._updateState(),this.body.emitter.emit("_dataUpdated")}),this.body.emitter.on("_dataUpdated",()=>{this.clustering._updateState(),this._updateVisibleIndices(),this._updateValueRange(this.body.nodes),this._updateValueRange(this.body.edges),this.body.emitter.emit("startSimulation"),this.body.emitter.emit("_requestRedraw")})},pe.prototype.setData=function(n){if(this.body.emitter.emit("resetPhysics"),this.body.emitter.emit("_resetData"),this.selectionHandler.unselectAll(),n&&n.dot&&(n.nodes||n.edges))throw new SyntaxError('Data must contain either parameter "dot" or parameter pair "nodes" and "edges", but not both.');if(this.setOptions(n&&n.options),n&&n.dot){console.warn("The dot property has been deprecated. Please use the static convertDot method to convert DOT into vis.network format and use the normal data format with nodes and edges. This converter is used like this: var data = vis.network.convertDot(dotString);");const e=aU(n.dot);this.setData(e);return}else if(n&&n.gephi){console.warn("The gephi property has been deprecated. Please use the static convertGephi method to convert gephi into vis.network format and use the normal data format with nodes and edges. This converter is used like this: var data = vis.network.convertGephi(gephiJson);");const e=AU(n.gephi);this.setData(e);return}else this.nodesHandler.setData(n&&n.nodes,!0),this.edgesHandler.setData(n&&n.edges,!0);this.body.emitter.emit("_dataChanged"),this.body.emitter.emit("_dataLoaded"),this.body.emitter.emit("initPhysics")},pe.prototype.destroy=function(){this.body.emitter.emit("destroy"),this.body.emitter.off(),this.off(),delete this.groups,delete this.canvas,delete this.selectionHandler,delete this.interactionHandler,delete this.view,delete this.renderer,delete this.physics,delete this.layoutEngine,delete this.clustering,delete this.manipulation,delete this.nodesHandler,delete this.edgesHandler,delete this.configurator,delete this.images;for(const n in this.body.nodes)Object.prototype.hasOwnProperty.call(this.body.nodes,n)&&delete this.body.nodes[n];for(const n in this.body.edges)Object.prototype.hasOwnProperty.call(this.body.edges,n)&&delete this.body.edges[n];Dg(this.body.container)},pe.prototype._updateValueRange=function(n){let e,t,i,o=0;for(e in n)if(Object.prototype.hasOwnProperty.call(n,e)){const r=n[e].getValue();r!==void 0&&(t=t===void 0?r:Math.min(r,t),i=i===void 0?r:Math.max(r,i),o+=r)}if(t!==void 0&&i!==void 0)for(e in n)Object.prototype.hasOwnProperty.call(n,e)&&n[e].setValueRange(t,i,o)},pe.prototype.isActive=function(){return!this.activator||this.activator.active},pe.prototype.setSize=function(){return this.canvas.setSize.apply(this.canvas,arguments)},pe.prototype.canvasToDOM=function(){return this.canvas.canvasToDOM.apply(this.canvas,arguments)},pe.prototype.DOMtoCanvas=function(){return this.canvas.DOMtoCanvas.apply(this.canvas,arguments)},pe.prototype.findNode=function(){return this.clustering.findNode.apply(this.clustering,arguments)},pe.prototype.isCluster=function(){return this.clustering.isCluster.apply(this.clustering,arguments)},pe.prototype.openCluster=function(){return this.clustering.openCluster.apply(this.clustering,arguments)},pe.prototype.cluster=function(){return this.clustering.cluster.apply(this.clustering,arguments)},pe.prototype.getNodesInCluster=function(){return this.clustering.getNodesInCluster.apply(this.clustering,arguments)},pe.prototype.clusterByConnection=function(){return this.clustering.clusterByConnection.apply(this.clustering,arguments)},pe.prototype.clusterByHubsize=function(){return this.clustering.clusterByHubsize.apply(this.clustering,arguments)},pe.prototype.updateClusteredNode=function(){return this.clustering.updateClusteredNode.apply(this.clustering,arguments)},pe.prototype.getClusteredEdges=function(){return this.clustering.getClusteredEdges.apply(this.clustering,arguments)},pe.prototype.getBaseEdge=function(){return this.clustering.getBaseEdge.apply(this.clustering,arguments)},pe.prototype.getBaseEdges=function(){return this.clustering.getBaseEdges.apply(this.clustering,arguments)},pe.prototype.updateEdge=function(){return this.clustering.updateEdge.apply(this.clustering,arguments)},pe.prototype.clusterOutliers=function(){return this.clustering.clusterOutliers.apply(this.clustering,arguments)},pe.prototype.getSeed=function(){return this.layoutEngine.getSeed.apply(this.layoutEngine,arguments)},pe.prototype.enableEditMode=function(){return this.manipulation.enableEditMode.apply(this.manipulation,arguments)},pe.prototype.disableEditMode=function(){return this.manipulation.disableEditMode.apply(this.manipulation,arguments)},pe.prototype.addNodeMode=function(){return this.manipulation.addNodeMode.apply(this.manipulation,arguments)},pe.prototype.editNode=function(){return this.manipulation.editNode.apply(this.manipulation,arguments)},pe.prototype.editNodeMode=function(){return console.warn("Deprecated: Please use editNode instead of editNodeMode."),this.manipulation.editNode.apply(this.manipulation,arguments)},pe.prototype.addEdgeMode=function(){return this.manipulation.addEdgeMode.apply(this.manipulation,arguments)},pe.prototype.editEdgeMode=function(){return this.manipulation.editEdgeMode.apply(this.manipulation,arguments)},pe.prototype.deleteSelected=function(){return this.manipulation.deleteSelected.apply(this.manipulation,arguments)},pe.prototype.getPositions=function(){return this.nodesHandler.getPositions.apply(this.nodesHandler,arguments)},pe.prototype.getPosition=function(){return this.nodesHandler.getPosition.apply(this.nodesHandler,arguments)},pe.prototype.storePositions=function(){return this.nodesHandler.storePositions.apply(this.nodesHandler,arguments)},pe.prototype.moveNode=function(){return this.nodesHandler.moveNode.apply(this.nodesHandler,arguments)},pe.prototype.getBoundingBox=function(){return this.nodesHandler.getBoundingBox.apply(this.nodesHandler,arguments)},pe.prototype.getConnectedNodes=function(n){return this.body.nodes[n]!==void 0?this.nodesHandler.getConnectedNodes.apply(this.nodesHandler,arguments):this.edgesHandler.getConnectedNodes.apply(this.edgesHandler,arguments)},pe.prototype.getConnectedEdges=function(){return this.nodesHandler.getConnectedEdges.apply(this.nodesHandler,arguments)},pe.prototype.startSimulation=function(){return this.physics.startSimulation.apply(this.physics,arguments)},pe.prototype.stopSimulation=function(){return this.physics.stopSimulation.apply(this.physics,arguments)},pe.prototype.stabilize=function(){return this.physics.stabilize.apply(this.physics,arguments)},pe.prototype.getSelection=function(){return this.selectionHandler.getSelection.apply(this.selectionHandler,arguments)},pe.prototype.setSelection=function(){return this.selectionHandler.setSelection.apply(this.selectionHandler,arguments)},pe.prototype.getSelectedNodes=function(){return this.selectionHandler.getSelectedNodeIds.apply(this.selectionHandler,arguments)},pe.prototype.getSelectedEdges=function(){return this.selectionHandler.getSelectedEdgeIds.apply(this.selectionHandler,arguments)},pe.prototype.getNodeAt=function(){const n=this.selectionHandler.getNodeAt.apply(this.selectionHandler,arguments);return n!==void 0&&n.id!==void 0?n.id:n},pe.prototype.getEdgeAt=function(){const n=this.selectionHandler.getEdgeAt.apply(this.selectionHandler,arguments);return n!==void 0&&n.id!==void 0?n.id:n},pe.prototype.selectNodes=function(){return this.selectionHandler.selectNodes.apply(this.selectionHandler,arguments)},pe.prototype.selectEdges=function(){return this.selectionHandler.selectEdges.apply(this.selectionHandler,arguments)},pe.prototype.unselectAll=function(){this.selectionHandler.unselectAll.apply(this.selectionHandler,arguments),this.selectionHandler.commitWithoutEmitting.apply(this.selectionHandler),this.redraw()},pe.prototype.redraw=function(){return this.renderer.redraw.apply(this.renderer,arguments)},pe.prototype.getScale=function(){return this.view.getScale.apply(this.view,arguments)},pe.prototype.getViewPosition=function(){return this.view.getViewPosition.apply(this.view,arguments)},pe.prototype.fit=function(){return this.view.fit.apply(this.view,arguments)},pe.prototype.moveTo=function(){return this.view.moveTo.apply(this.view,arguments)},pe.prototype.focus=function(){return this.view.focus.apply(this.view,arguments)},pe.prototype.releaseNode=function(){return this.view.releaseNode.apply(this.view,arguments)},pe.prototype.getOptionsFromConfigurator=function(){let n={};return this.configurator&&(n=this.configurator.getOptions.apply(this.configurator)),n};function Eq(n,e){n.on("click",t=>{e.onHover(null),t.edges.length===0&&e.onHoverEdge(null);const i=t.nodes[0];i!==void 0?e.onFocus(String(i)):e.onClear()}),n.on("doubleClick",t=>{const i=t.nodes[0];if(i!==void 0){e.onOpenSource(String(i));return}const o=t.edges[0];o!==void 0&&e.onOpenRelationshipSource(String(o))}),n.on("hoverNode",t=>{t.node!==void 0&&(e.onInteractionStart(),e.onHoverEdge(null),e.onHover({nodeId:String(t.node),x:t.pointer.DOM.x,y:t.pointer.DOM.y}))}),n.on("blurNode",()=>e.onHover(null)),n.on("hoverEdge",t=>{t.edge!==void 0&&(e.onHover(null),e.onHoverEdge({edgeId:String(t.edge),x:t.pointer.DOM.x,y:t.pointer.DOM.y}))}),n.on("blurEdge",()=>e.onHoverEdge(null)),n.on("dragStart",()=>{e.onInteractionStart(),e.onHover(null),e.onHoverEdge(null)}),n.on("zoom",()=>{e.onHover(null),e.onHoverEdge(null)})}const Tq=1e3,Oq=4e3,Ru=4e3;function Nq(n){return n.nodes.length>=Tq||n.edges.length>=Oq?"static":"interactive"}function Dq(n,e=!1){if(e)return jq(n);const t=new Map;for(const h of n){const p=t.get(h.community)??[];p.push(h),t.set(h.community,p)}const i=[...t.entries()].sort(([h],[p])=>h-p).map(([h,p])=>({community:h,members:p.sort((m,y)=>m.id.localeCompare(y.id))})),o=i.reduce((h,p)=>Math.max(h,p.members.length),1),r=Math.max(1,Math.ceil(Math.sqrt(i.length))),A=Math.max(1,Math.ceil(i.length/r)),I=Math.max(280,Math.ceil(Math.sqrt(o))*48),l=Math.PI*(3-Math.sqrt(5)),c=new Map;return i.forEach((h,p)=>{const m=p%r,y=Math.floor(p/r),w=(m-(r-1)/2)*I,S=(y-(A-1)/2)*I;h.members.forEach((x,O)=>{if(O===0){c.set(x.id,{x:w,y:S});return}const E=24*Math.sqrt(O),_=O*l;c.set(x.id,{x:w+Math.cos(_)*E,y:S+Math.sin(_)*E})})}),c}function Mq(n,e,t=!1){const i=[...n].sort((o,r)=>o.community-r.community||(r.degree??0)-(o.degree??0)||o.id.localeCompare(r.id));if(e==="circle"){const o=Math.max(160,i.length*44/(2*Math.PI));return new Map(i.map((r,A)=>{const I=-Math.PI/2+A*2*Math.PI/Math.max(1,i.length);return[r.id,{x:Math.cos(I)*o,y:Math.sin(I)*o}]}))}if(e==="concentric"){const o=[...n].sort((r,A)=>(A.degree??0)-(r.degree??0)||(A.memberCount??0)-(r.memberCount??0)||r.community-A.community||r.id.localeCompare(A.id));return kq(o)}return e==="hierarchical"?zq(i):e==="spiral"?Rq(i):_q(i,t)}function zq(n){const e=new Map;for(const o of n){const r=o.depth??(o.root?0:1),A=e.get(r)??[];A.push(o),e.set(r,A)}const t=[...e.entries()].sort(([o],[r])=>o-r),i=new Map;for(const[o,r]of t){r.sort((I,l)=>Number(l.root??!1)-Number(I.root??!1)||(l.degree??0)-(I.degree??0)||I.id.localeCompare(l.id));const A=148;r.forEach((I,l)=>i.set(I.id,{x:(l-(r.length-1)/2)*A,y:o*168}))}return i}function kq(n){const e=new Map,t=n[0];if(!t)return e;e.set(t.id,{x:0,y:0});let i=1,o=1;for(;i{if(o===0)return[i.id,{x:0,y:0}];const r=36*Math.sqrt(o),A=o*.52;return[i.id,{x:Math.cos(A)*r,y:Math.sin(A)*r}]}))}function _q(n,e){const r=new Map;n.forEach((w,S)=>{const x=e?Math.floor(S/16):w.community,O=r.get(x)??[];O.push(w),r.set(x,O)});const A=[...r.entries()].sort(([w],[S])=>w-S).map(([w,S])=>{const x=Math.max(1,Math.ceil(Math.sqrt(S.length))),O=Math.max(1,Math.ceil(S.length/x));return{key:w,members:S,columns:x,rows:O,width:(x-1)*56,height:(O-1)*56}}),I=Math.max(1,Math.ceil(Math.sqrt(A.length))),l=Math.max(1,Math.ceil(A.length/I)),c=Array.from({length:I},()=>0),h=Array.from({length:l},()=>0);A.forEach((w,S)=>{const x=S%I,O=Math.floor(S/I);c[x]=Math.max(c[x]??0,w.width),h[O]=Math.max(h[O]??0,w.height)});const p=_x(c,112),m=_x(h,112),y=new Map;return A.forEach((w,S)=>{const x=S%I,O=Math.floor(S/I);w.members.forEach((E,_)=>{const P=Math.floor(_/w.columns),Q=Math.min(w.columns,w.members.length-P*w.columns),ne=_%w.columns;y.set(E.id,{x:(p[x]??0)+(ne-(Q-1)/2)*56,y:(m[O]??0)+(P-(w.rows-1)/2)*56})})}),y}function _x(n,e){let i=-(n.reduce((o,r)=>o+r,0)+Math.max(0,n.length-1)*e)/2;return n.map(o=>{const r=i+o/2;return i+=o+e,r})}function jx(n){if(!n.stats.aggregated||n.edges.length<=Ru)return n.edges;const e=[...n.edges].sort((A,I)=>(I.weight??Zx(I.relation))-(A.weight??Zx(A.relation))||A.source.localeCompare(I.source)||A.target.localeCompare(I.target)||A.id.localeCompare(I.id)),t=new Map(n.nodes.map(A=>[A.id,A.id])),i=A=>{let I=t.get(A)??A;for(;t.get(I)!==void 0&&t.get(I)!==I;)I=t.get(I);let l=A;for(;t.get(l)!==void 0&&t.get(l)!==I;){const c=t.get(l);t.set(l,I),l=c}return I},o=[],r=new Set;for(const A of e){const I=i(A.source),l=i(A.target);if(I!==l&&(t.set(l,I),o.push(A),r.add(A.id),o.length===Ru))return o}for(const A of e)if(!r.has(A.id)&&(o.push(A),o.length===Ru))break;return o}function Zx(n){const e=Number.parseInt(n,10);return Number.isFinite(e)&&e>0?e:1}function jq(n){const e=[...n].sort((o,r)=>(r.degree??0)-(o.degree??0)||(r.memberCount??0)-(o.memberCount??0)||o.id.localeCompare(r.id)),t=Math.PI*(3-Math.sqrt(5)),i=34;return new Map(e.map((o,r)=>{if(r===0)return[o.id,{x:0,y:0}];const A=i*Math.sqrt(r),I=r*t;return[o.id,{x:Math.cos(I)*A,y:Math.sin(I)*A}]}))}const CI=176,II=108,Bx=8,Zq=1500,Bq=2e3;function Pq(n){const e=[...n.positions.values()],t=n.viewport.left+n.viewport.width,i=n.viewport.top+n.viewport.height,o=[...e.map(F=>F.x),n.viewport.left,t],r=[...e.map(F=>F.y),n.viewport.top,i],A=Math.min(...o),I=Math.max(...o),l=Math.min(...r),c=Math.max(...r),h=Math.max(1,I-A),p=Math.max(1,c-l),m=CI-Bx*2,y=II-Bx*2,w=Math.min(m/h,y/p),S=h*w,x=p*w,O=(CI-S)/2,E=(II-x)/2,_=({x:F,y:Z})=>({x:O+(F-A)*w,y:E+(Z-l)*w}),P=({x:F,y:Z})=>({x:A+(F-O)/w,y:l+(Z-E)/w}),Q=_({x:n.viewport.left,y:n.viewport.top}),ne=_({x:t,y:i});return{project:_,unproject:P,viewport:{x:Q.x,y:Q.y,width:ne.x-Q.x,height:ne.y-Q.y}}}function Lq({model:n,snapshot:e,visibleNodeIds:t,visibleEdgeIds:i,focusedNodeId:o,onNavigate:r}){const A=L.useMemo(()=>Pq(e),[e]),I=L.useMemo(()=>n.nodes.filter(m=>!t||t.has(m.id)).sort((m,y)=>m.id.localeCompare(y.id)),[n.nodes,t]),l=I.slice(0,Zq),c=L.useMemo(()=>n.edges.filter(m=>(!i||i.has(m.id))&&(!t||t.has(m.source)&&t.has(m.target))).sort((m,y)=>m.id.localeCompare(y.id)).slice(0,Bq),[n.edges,i,t]),h=L.useMemo(()=>new Map(n.communities.map(m=>[m.id,m.color])),[n.communities]),p=m=>{const y=m.currentTarget.getBoundingClientRect();y.width<=0||y.height<=0||r(A.unproject({x:(m.clientX-y.left)/y.width*CI,y:(m.clientY-y.top)/y.height*II}))};return f.jsxs("aside",{className:"compass-minimap compass-glass-panel","aria-label":"Graph overview",children:[f.jsxs("header",{children:[f.jsx("span",{children:"Map"}),f.jsx("small",{children:l.length{const y=e.positions.get(m.source),w=e.positions.get(m.target);if(!y||!w)return null;const S=A.project(y),x=A.project(w);return f.jsx("line",{x1:S.x,y1:S.y,x2:x.x,y2:x.y},m.id)})}),f.jsx("g",{className:"compass-minimap-nodes",children:l.map(m=>{const y=e.positions.get(m.id);if(!y)return null;const w=A.project(y);return f.jsx("circle",{cx:w.x,cy:w.y,r:m.id===o?3:1.65,fill:m.color?.background??h.get(m.community)??"currentColor","data-focused":m.id===o?"true":void 0},m.id)})}),f.jsx("rect",{className:"compass-minimap-viewport",x:A.viewport.x,y:A.viewport.y,width:A.viewport.width,height:A.viewport.height,rx:"2"})]})})]})}const Px={added:{background:"#163d24",border:"#56d364"},removed:{background:"#4b1f24",border:"#ff7b72"},changed:{background:"#3d3015",border:"#d7a72b"},unchanged:{background:"#29313b",border:"#8b949e"}},Gq=200,Fq=1500,Lx=.1,Vq=3,Uq=18,Yq=96,Hq=1500;function Kq(n,e){const t=[...e].sort().slice(0,Hq),i=n.getPositions(t),o=Object.values(i),r=o.length===0?0:Math.max(Math.max(...o.map(({x:l})=>l))-Math.min(...o.map(({x:l})=>l)),Math.max(...o.map(({y:l})=>l))-Math.min(...o.map(({y:l})=>l))),A=Math.min(Yq,Math.max(Uq,r*.012)),I=Math.PI*(3-Math.sqrt(5));t.forEach((l,c)=>{const h=i[l];if(!h)return;const p=c*I;n.moveNode(l,h.x+Math.cos(p)*A,h.y+Math.sin(p)*A)})}function Gs(n){return window.matchMedia("(prefers-reduced-motion: reduce)").matches?!1:{duration:n,easingFunction:"easeInOutQuad"}}const Wq={autoResize:!0,interaction:{hover:!0,tooltipDelay:100,hideEdgesOnDrag:!0,navigationButtons:!1,keyboard:{enabled:!0}},layout:{improvedLayout:!0},nodes:{borderWidth:1.5,shape:"dot"},edges:{arrows:{to:{enabled:!0,scaleFactor:.5}},smooth:{enabled:!0,type:"continuous",roundness:.2},selectionWidth:3},physics:{enabled:!0,solver:"forceAtlas2Based",stabilization:{enabled:!0,iterations:200,fit:!0,updateInterval:20},forceAtlas2Based:{gravitationalConstant:-60,centralGravity:.005,springLength:120,springConstant:.08,damping:.4,avoidOverlap:.8}}},Qq={autoResize:!0,interaction:{hover:!0,tooltipDelay:100,hideEdgesOnDrag:!0,navigationButtons:!1,keyboard:{enabled:!0}},layout:{improvedLayout:!0,randomSeed:17},nodes:{borderWidth:2,shape:"dot"},edges:{arrows:{to:{enabled:!0,scaleFactor:.38}},smooth:{enabled:!0,type:"continuous",roundness:.14},selectionWidth:3},physics:{enabled:!0,solver:"barnesHut",stabilization:{enabled:!0,iterations:520,fit:!0,updateInterval:25},maxVelocity:35,minVelocity:.55,barnesHut:{theta:.45,gravitationalConstant:-12e3,centralGravity:.12,springLength:180,springConstant:.025,damping:.3,avoidOverlap:.85}}},Xq={autoResize:!0,interaction:{hover:!0,tooltipDelay:100,hideEdgesOnDrag:!0,hideEdgesOnZoom:!0,hoverConnectedEdges:!1,selectConnectedEdges:!1,navigationButtons:!1,keyboard:{enabled:!0}},layout:{improvedLayout:!1,randomSeed:17},nodes:{borderWidth:1.5,shape:"dot"},edges:{arrows:{to:{enabled:!1}},chosen:!1,smooth:!1,selectionWidth:3},physics:{enabled:!1,solver:"barnesHut"}};function Gx(n,e,t,i,o){const r=e.change&&i?i[e.change]:void 0,A=r?r.background:e.color?.background??o?.get(e.community)??n.communities.find(I=>I.id===e.community)?.color??"#6688aa";return{background:A,border:t??r?.border??e.color?.border??A}}function Tn(n,e){return typeof window>"u"?e:getComputedStyle(document.documentElement).getPropertyValue(n).trim()||e}function $q(n){return n==="extracted"?{dashes:!1,width:2,opacity:.7}:n==="ambiguous"?{dashes:[3,4],width:2,opacity:.62}:n==="aggregated"?{dashes:!1,width:1,opacity:.2}:{dashes:!0,width:1,opacity:.35}}function Fx(n,e,t,i){if(n==="added")return{color:i.added.border,dashes:!1,width:1.7,opacity:.6};if(n==="removed")return{color:i.removed.border,dashes:[6,5],width:1.6,opacity:.56};if(n==="changed")return{color:i.changed.border,dashes:!1,width:1.65,opacity:.48};if(n==="unchanged")return{color:i.unchanged.border,dashes:!0,width:1,opacity:.2};const o=$q(e);return{color:t,...o}}function qq(n){return n==="added"?{enabled:!0,type:"curvedCW",roundness:.13}:n==="removed"?{enabled:!0,type:"curvedCCW",roundness:.13}:{enabled:!0,type:"continuous",roundness:.1}}function Jq(n){const e=new Map;for(const r of[...n].sort((A,I)=>A.id.localeCompare(I.id))){const A=r.change??"unchanged",I=e.get(A)??[];I.push(r),e.set(A,I)}const t={added:-300,changed:0,removed:300,unchanged:0},i=new Map,o=Math.PI*(3-Math.sqrt(5));for(const[r,A]of e)A.forEach((I,l)=>{const c=l*o,h=r==="unchanged"?210+Math.sqrt(l)*34:42+Math.sqrt(l)*40;i.set(I.id,{x:t[r]+Math.cos(c)*h,y:Math.sin(c)*h})});return i}function eJ(){const[n,e]=L.useState(0);return L.useEffect(()=>{const t=()=>e(r=>r+1),i=new MutationObserver(t);i.observe(document.documentElement,{attributes:!0,attributeFilter:["class","style"]}),i.observe(document.body,{attributes:!0,attributeFilter:["class","style"]});const o=window.matchMedia("(prefers-color-scheme: dark)");return o.addEventListener("change",t),()=>{i.disconnect(),o.removeEventListener("change",t)}},[]),n}function _u(n){const e=n.match(/^#([\da-f]{3}|[\da-f]{6})$/i)?.[1];if(e){const i=e.length===3?[...e].map(o=>`${o}${o}`).join(""):e;return[Number.parseInt(i.slice(0,2),16),Number.parseInt(i.slice(2,4),16),Number.parseInt(i.slice(4,6),16)]}const t=n.match(/^rgba?\(\s*([\d.]+)[,\s]+([\d.]+)[,\s]+([\d.]+)/i);if(t)return[Number.parseFloat(t[1]??"0"),Number.parseFloat(t[2]??"0"),Number.parseFloat(t[3]??"0")]}function tJ(n,e,t){const i=_u(n),o=_u(e);if(!i||!o)return e;const r=i.map((A,I)=>Math.round(A*(1-t)+o[I]*t));return`rgb(${r[0]}, ${r[1]}, ${r[2]})`}function nJ(n){const e=_u(n);return e?(e[0]*299+e[1]*587+e[2]*114)/1e3<145:!0}function lI(n,e,t,i=!1){return{background:tJ(n,e,i?t?.18:.1:t?.26:.14),border:e}}const iJ=L.forwardRef(function({model:e,focusedNodeId:t,physicsRunning:i,layoutStyle:o="automatic",initialPositions:r,forceLabels:A,showEdgeLabels:I=!1,isolatedNodeIds:l,isolatedEdgeIds:c,layoutSpacing:h=1,showMinimap:p=!1,hiddenCommunities:m,hiddenChanges:y,onFocus:w,onOpenSource:S,onOpenRelationshipSource:x,onInteractionStart:O=()=>{},onHover:E,onHoverEdge:_,onClear:P,onStabilized:Q},ne){const F=L.useRef(null),Z=L.useRef(null),[de,fe]=L.useState(null),ke=L.useRef(i);ke.current=i;const Ne=L.useRef(i),je=L.useRef({onFocus:w,onOpenSource:S,onOpenRelationshipSource:x,onInteractionStart:O,onHover:E,onHoverEdge:_,onClear:P});je.current={onFocus:w,onOpenSource:S,onOpenRelationshipSource:x,onInteractionStart:O,onHover:E,onHoverEdge:_,onClear:P};const qe=L.useRef(Q);qe.current=Q;const Ae=L.useRef(null),M=L.useRef(h),W=eJ(),V=L.useMemo(()=>Nq(e),[e.edges.length,e.nodes.length]),se=L.useMemo(()=>jx(e),[e]),ee=L.useMemo(()=>new Set(e.nodes.filter(R=>!m.has(R.community)&&!y.has(R.change??"unchanged")&&(!l||l.has(R.id))).map(R=>R.id)),[y,m,l,e.nodes]),T=L.useMemo(()=>new Set(se.filter(R=>ee.has(R.source)&&ee.has(R.target)&&(!c||c.has(R.id))).map(R=>R.id)),[c,se,ee]),U=L.useRef(ee);U.current=ee;const te=L.useCallback(()=>{const R=Z.current,Ce=F.current;if(!R||!Ce)return;const Je=R.getPositions([...U.current].sort().slice(0,Fq)),St=R.getViewPosition(),He=Math.max(Lx,R.getScale()),Pi=Math.max(1,Ce.clientWidth)/He,Ga=Math.max(1,Ce.clientHeight)/He;fe({positions:new Map(Object.entries(Je)),viewport:{left:St.x-Pi/2,top:St.y-Ga/2,width:Pi,height:Ga}})},[]),ae=L.useMemo(()=>{let R=1;for(const Ce of e.nodes)R=Math.max(R,Ce.degree??1);return R},[e.nodes]),Ie=L.useMemo(()=>new Map(e.communities.map(R=>[R.id,R.color])),[e.communities]),me=L.useMemo(()=>Tn("--vscode-editor-foreground",Tn("--foreground","#eef5ff")),[W]),Pe=L.useMemo(()=>Tn("--vscode-descriptionForeground",Tn("--muted-foreground","#60728b")),[W]),wt=L.useMemo(()=>Tn("--vscode-editor-foreground",Tn("--foreground","#d8e4f2")),[W]),ze=L.useMemo(()=>{const R=Tn("--vscode-editor-background",Tn("--background","#08111f")),Ce=nJ(R);return{added:lI(R,Tn("--vscode-gitDecoration-addedResourceForeground",Ce?"#56d364":"#1a7f37"),Ce),removed:lI(R,Tn("--vscode-gitDecoration-deletedResourceForeground",Ce?"#ff7b72":"#cf222e"),Ce),changed:lI(R,Tn("--vscode-gitDecoration-modifiedResourceForeground",Ce?"#d7a72b":"#9a6700"),Ce),unchanged:lI(R,Tn("--vscode-descriptionForeground",Ce?"#8b949e":"#656d76"),Ce,!0)}},[W]),tt=L.useMemo(()=>e.nodes.some(R=>R.change!==void 0)||e.edges.some(R=>R.change!==void 0),[e.edges,e.nodes]),z=L.useMemo(()=>new Set(tt?e.nodes.filter(R=>R.change!=="unchanged").sort((R,Ce)=>(Ce.degree??0)-(R.degree??0)||R.id.localeCompare(Ce.id)).slice(0,12).map(R=>R.id):V==="static"?[...e.nodes].sort((R,Ce)=>(Ce.degree??0)-(R.degree??0)||R.id.localeCompare(Ce.id)).slice(0,20).map(R=>R.id):[]),[tt,e.nodes,V]),ve=L.useMemo(()=>V==="static"?new Set([...e.nodes].sort((R,Ce)=>(Ce.degree??0)-(R.degree??0)||R.id.localeCompare(Ce.id)).slice(0,Gq).map(R=>R.id)):new Set,[e.nodes,V]),Re=L.useMemo(()=>tt?Jq(e.nodes):new Map,[tt,e.nodes]),Ze=o==="automatic"?1:h,Dt=L.useMemo(()=>o==="automatic"?new Map:Mq(e.nodes,o,e.stats.aggregated),[o,e.nodes,e.stats.aggregated]),Ut=L.useMemo(()=>V==="static"&&!tt?Dq(e.nodes,e.stats.aggregated):new Map,[tt,e.nodes,e.stats.aggregated,V]),dn=L.useMemo(()=>typeof document>"u"?void 0:document.body.classList.contains("vscode-high-contrast")||document.body.classList.contains("vscode-high-contrast-light")?Tn("--vscode-contrastBorder","#ffffff"):void 0,[W]),ie=L.useMemo(()=>new Bs(e.nodes.map(R=>{const Ce=R.size??Math.min(40,10+30*(R.degree??1)/ae),Je=tt?R.change==="unchanged"?7+5*Math.sqrt((R.degree??1)/ae):11+12*Math.sqrt((R.degree??1)/ae):Ce,St=Dt.get(R.id)??Re.get(R.id)??r?.get(R.id)??Ut.get(R.id),He=St?{x:St.x*Ze,y:St.y*Ze}:void 0;return{id:R.id,label:R.label,color:Gx(e,R,void 0,Px,Ie),size:Je,...He??{},opacity:R.change==="unchanged"?.58:1,font:{color:"#eef5ff",face:"system-ui",size:tt||V==="static"?z.has(R.id)?12:0:(R.degree??1)>=ae*.15?12:0}}})),[z,tt,Re,Ie,r,Ze,ae,e,V,Dt,Ut]),De=L.useMemo(()=>new Bs(se.map(R=>{const Ce=Fx(R.change,R.confidence,"#60728b",Px);return{id:R.id,from:R.source,to:R.target,dashes:Ce.dashes,width:Ce.width,...tt&&V!=="static"?{smooth:qq(R.change)}:{},color:{color:Ce.color,opacity:Ce.opacity}}})),[tt,se,V]);return L.useEffect(()=>{const R=F.current;if(!R)return;Ae.current=null;const Ce=new pe(R,{nodes:ie,edges:De},V==="static"?Xq:tt?Qq:Wq);Ce.setOptions({physics:{enabled:ke.current}}),ke.current||Ce.stopSimulation(),Z.current=Ce,Eq(Ce,{onFocus:He=>je.current.onFocus(He),onOpenSource:He=>je.current.onOpenSource(He),onOpenRelationshipSource:He=>je.current.onOpenRelationshipSource(He),onInteractionStart:()=>{ke.current&&Ce.stopSimulation(),je.current.onInteractionStart()},onHover:He=>je.current.onHover(He),onHoverEdge:He=>je.current.onHoverEdge(He),onClear:()=>je.current.onClear()}),Ce.on("stabilizationIterationsDone",()=>{Ce.stopSimulation(),Ae.current={position:Ce.getViewPosition(),scale:Ce.getScale()},qe.current(),te()}),Ce.on("stabilized",te),Ce.on("dragEnd",te),Ce.on("zoom",te),Ce.on("resize",te),Ce.on("animationFinished",te);const Je=Re.size>0||Dt.size>0||(r?.size??0)>0||Ut.size>0;!ke.current&&Je&&(Ce.stopSimulation(),Ce.fit({animation:!1}),Ae.current={position:Ce.getViewPosition(),scale:Ce.getScale()});const St=window.setTimeout(te,0);return()=>{window.clearTimeout(St),Ce.destroy(),Z.current=null}},[De,ie,tt,Re,r,V,Dt,Ut,te]),L.useEffect(()=>{const R=Z.current;if(!R)return;const Ce=Ne.current;Ne.current=i,R.setOptions({physics:{enabled:i}}),i?(Ce||Kq(R,U.current),R.startSimulation()):R.stopSimulation()},[De,ie,i]),L.useEffect(()=>{const R=Z.current;if(!R||o!=="automatic"||V==="static")return;const Ce=M.current;if(M.current=h,R.setOptions({physics:tt?{barnesHut:{springLength:180*h}}:{forceAtlas2Based:{springLength:120*h}}}),!i&&Ce!==h){const Je=h/Ce,St=R.getPositions();ie.update(Object.entries(St).map(([He,Pi])=>({id:He,x:Pi.x*Je,y:Pi.y*Je}))),R.redraw(),te()}},[tt,h,o,ie,i,te,V]),L.useEffect(()=>{ie.update(e.nodes.map(R=>({id:R.id,hidden:!ee.has(R.id)}))),De.update(se.map(R=>({id:R.id,hidden:!T.has(R.id)}))),te()},[De,te,se,e.nodes,ie,T,ee]),L.useEffect(()=>{const R=Z.current;if(!R)return;const Ce=t?new Set(R.getConnectedNodes(t).map(String)):new Set;if(ie.update(e.nodes.map(Je=>{const St=Je.id===t,He=!t||St||Ce.has(Je.id),Pi=Je.change==="unchanged"?.58:1;return{id:Je.id,opacity:t?He?Math.max(Pi,.72):.08:Pi,borderWidth:St?4:dn?2.5:1.5,color:Gx(e,Je,dn,ze,Ie),shadow:St?{enabled:!0,color:Je.change?ze[Je.change].border:Je.color?.background??Ie.get(Je.community)??"#76b7ff",size:24,x:0,y:0}:{enabled:!1}}})),De.update(se.map(Je=>{const St=Fx(Je.change,Je.confidence,Pe,ze),He=Je.source===t||Je.target===t;return{id:Je.id,dashes:St.dashes,color:{color:St.color,opacity:t?He?.92:.05:St.opacity},width:He?Math.max(3,St.width):St.width}})),t)if(R.selectNodes([t]),ke.current)R.focus(t,{scale:1.35,animation:window.matchMedia("(prefers-reduced-motion: reduce)").matches?!1:{duration:260,easingFunction:"easeInOutQuad"}});else{const Je=R.getPositions([t])[t];Je&&R.moveTo({position:Je,scale:1.35,animation:!1})}else R.unselectAll()},[dn,ze,Ie,Pe,De,t,e,ie,se]),L.useEffect(()=>{ie.update(e.nodes.map(R=>({id:R.id,font:{color:me,size:A&&(V!=="static"||ve.has(R.id))||R.id===t||(tt||V==="static"?z.has(R.id):(R.degree??1)>=ae*.15)?12:0}})))},[z,tt,ve,t,A,me,ae,e.nodes,ie,V]),L.useEffect(()=>{De.update(se.map(R=>({id:R.id,label:I?R.relation:"",font:{align:"middle",color:wt,face:"system-ui",size:10,strokeWidth:3,strokeColor:Tn("--vscode-editor-background",Tn("--background","#08111f"))}})))},[De,wt,se,I]),L.useImperativeHandle(ne,()=>({fit(){Z.current?.fit({animation:Gs(280)})},fitSelection(R){const Ce=Z.current;!Ce||R.length===0||Ce.fit({nodes:[...new Set(R)],animation:Gs(240)})},reset(){const R=Z.current,Ce=Ae.current;if(R){if(!Ce){R.fit({animation:!1});return}R.moveTo({position:Ce.position,scale:Ce.scale,animation:!1})}},resetZoom(){Z.current?.moveTo({scale:1,animation:Gs(180)})},zoomIn(){const R=Z.current;R&&R.moveTo({scale:Math.min(Vq,R.getScale()*1.25),animation:Gs(160)})},zoomOut(){const R=Z.current;R&&R.moveTo({scale:Math.max(Lx,R.getScale()/1.25),animation:Gs(160)})}}),[]),f.jsxs(f.Fragment,{children:[f.jsx("div",{ref:F,className:"compass-canvas","data-rendering-profile":V,"data-layout-style":o,"data-physics-running":i?"true":"false","data-isolated":l?"true":"false","data-layout-spacing":h,role:"region","aria-label":"Interactive Compass code graph",onMouseLeave:()=>{E(null),_(null)}}),p&&de?f.jsx(Lq,{model:e,snapshot:de,visibleNodeIds:ee,visibleEdgeIds:T,focusedNodeId:t,onNavigate:R=>Z.current?.moveTo({position:R,animation:Gs(180)})}):null]})}),Vx=1,Ux=4;function gJ(n){return Math.max(Vx,Math.min(Ux,Math.trunc(n)))}function oJ(n,e,t,i){const o=gJ(t),r=new Map,A=new Map;for(const h of n.edges){const p=r.get(h.source)??[];p.push(h),r.set(h.source,p);const m=A.get(h.target)??[];m.push(h),A.set(h.target,m)}for(const h of[...r.values(),...A.values()])h.sort((p,m)=>p.id.localeCompare(m.id));const I=new Set([e]),l=new Set;let c=[e];for(let h=0;h0;h+=1){const p=new Set;for(const m of c.sort()){if(i!=="incoming")for(const y of r.get(m)??[])l.add(y.id),I.has(y.target)||p.add(y.target);if(i!=="outgoing")for(const y of A.get(m)??[])l.add(y.id),I.has(y.source)||p.add(y.source)}c=[...p];for(const m of c)I.add(m)}return{nodeIds:I,edgeIds:l}}const Yx={focusedNodeId:null,physicsRunning:!1,layoutStyle:"automatic",initialLayoutPending:!1,forceLabels:!1,showEdgeLabels:!1,isolateSelection:!1,neighborhoodDepth:1,edgeDirection:"both",layoutSpacing:1,showMinimap:!0,hiddenCommunities:new Set,hiddenChanges:new Set,query:""};function sJ(n,e="automatic"){return e!=="automatic"?{...Yx,layoutStyle:e,physicsRunning:!1,initialLayoutPending:!1}:{...Yx,physicsRunning:!1,initialLayoutPending:!1}}function rJ(n,e){switch(e.type){case"focus":return{...n,focusedNodeId:e.nodeId,physicsRunning:!1};case"clearFocus":return{...n,focusedNodeId:null,isolateSelection:!1};case"stabilized":return n.physicsRunning||n.initialLayoutPending?{...n,physicsRunning:!1,initialLayoutPending:!1}:n;case"revealLayout":return{...n,physicsRunning:!1,initialLayoutPending:!1};case"setPhysics":return{...n,physicsRunning:e.running};case"setLayout":return{...n,layoutStyle:e.layout,physicsRunning:e.runPhysics,initialLayoutPending:!1};case"setLabels":return{...n,forceLabels:e.visible};case"setEdgeLabels":return{...n,showEdgeLabels:e.visible};case"setIsolation":return{...n,isolateSelection:e.isolated};case"setNeighborhoodDepth":return{...n,neighborhoodDepth:Math.max(1,Math.min(4,Math.trunc(e.depth)))};case"setEdgeDirection":return{...n,edgeDirection:e.direction};case"setLayoutSpacing":return{...n,layoutSpacing:e.spacing};case"setMinimap":return{...n,showMinimap:e.visible};case"search":return{...n,query:e.query};case"toggleCommunity":{const t=new Set(n.hiddenCommunities);return t.has(e.communityId)?t.delete(e.communityId):t.add(e.communityId),{...n,hiddenCommunities:t}}case"setHiddenCommunities":return{...n,hiddenCommunities:new Set(e.communityIds)};case"toggleChange":{const t=new Set(n.hiddenChanges);return t.has(e.change)?t.delete(e.change):t.add(e.change),{...n,hiddenChanges:t}}}}const aJ=[{value:"added",label:"Added"},{value:"removed",label:"Removed"},{value:"changed",label:"Changed"},{value:"unchanged",label:"Context"}],AJ={hierarchical:"Depth-layer layout",circle:"Circle layout",concentric:"Concentric layout",spiral:"Spiral layout",grid:"Square grid layout"},ju=["both","outgoing","incoming"];function CJ(n){return n instanceof HTMLElement&&(n.isContentEditable||n.tagName==="INPUT"||n.tagName==="TEXTAREA"||n.tagName==="SELECT")}function Zu({model:n,host:e,communityDetail:t,communityLoading:i,communityError:o,onBackToOverview:r,sourceRevisions:A,queryResult:I,initialInspectorLayout:l,onInspectorLayoutChange:c,preferredLayout:h="automatic",toolbarLeading:p,toolbarLeadingPanel:m,toolbarLeadingOpen:y,onToolbarLeadingClose:w,stageOverlay:S,showInspectorHeader:x=!0}){const[O,E]=L.useState(()=>yv(l)),_=L.useCallback(ne=>{const F=yv(ne);E(F),c?.(F)},[c]),P=t?.model??n,Q=t?`community-${t.communityId}`:"overview";return f.jsx(IJ,{model:P,host:e,detailCommunityId:t?.communityId,communityLoading:i,communityError:o,onBackToOverview:t?r:void 0,bounded:t?.bounded,sourceRevisions:A,queryResult:I,inspectorLayout:O,onInspectorLayoutChange:_,preferredLayout:h,toolbarLeading:p,toolbarLeadingPanel:m,toolbarLeadingOpen:y,onToolbarLeadingClose:w,stageOverlay:S,showInspectorHeader:x},Q)}function IJ({model:n,host:e,detailCommunityId:t,communityLoading:i,communityError:o,onBackToOverview:r,bounded:A,sourceRevisions:I,queryResult:l,inspectorLayout:c,onInspectorLayoutChange:h,preferredLayout:p,toolbarLeading:m,toolbarLeadingPanel:y,toolbarLeadingOpen:w,onToolbarLeadingClose:S,stageOverlay:x,showInspectorHeader:O}){const[E,_]=L.useReducer(rJ,n,ie=>sJ(ie,p)),[P,Q]=L.useState(null),[ne,F]=L.useState(null),Z=L.useRef(null),de=L.useRef(e);de.current=e;const fe=L.useMemo(()=>new Map(n.nodes.map(ie=>[ie.id,ie])),[n.nodes]),ke=L.useMemo(()=>new Map(n.edges.map(ie=>[ie.id,ie])),[n.edges]),Ne=L.useMemo(()=>{const ie=new Map,De=new Map;for(const R of n.edges){const Ce=ie.get(R.source)??new Set;Ce.add(R.target),ie.set(R.source,Ce);const Je=ie.get(R.target)??new Set;Je.add(R.source),ie.set(R.target,Je);const St=De.get(R.source)??[];St.push(R),De.set(R.source,St);const He=De.get(R.target)??[];He.push(R),De.set(R.target,He)}return{neighborIds:ie,edges:De}},[n.edges]),je=L.useMemo(()=>n.nodes.map(ie=>({node:ie,text:[ie.label,ie.source?.file,ie.kind].filter(De=>De!==void 0).join(` +`).toLocaleLowerCase()})),[n.nodes]),qe=L.useMemo(()=>jx(n).length,[n]),Ae=E.focusedNodeId?fe.get(E.focusedNodeId):void 0,M=L.useMemo(()=>Ae?oJ(n,Ae.id,E.neighborhoodDepth,E.edgeDirection):null,[n,Ae,E.edgeDirection,E.neighborhoodDepth]),W=P?fe.get(P.nodeId):void 0,V=W?bv(n,W,t):void 0,se=ne?ke.get(ne.edgeId):void 0,ee=se?fe.get(se.source):void 0,T=se?fe.get(se.target):void 0,U=L.useMemo(()=>n.nodes.some(ie=>ie.change!==void 0)||n.edges.some(ie=>ie.change!==void 0),[n.edges,n.nodes]),te=L.useMemo(()=>{const ie=new Map;for(const De of n.nodes){const R=De.change??"unchanged";ie.set(R,(ie.get(R)??0)+1)}return ie},[n.nodes]),ae=L.useMemo(()=>Ae?[...Ne.neighborIds.get(Ae.id)??[]].map(ie=>fe.get(ie)).filter(ie=>ie!==void 0).sort((ie,De)=>ie.label.localeCompare(De.label)):[],[Ne.neighborIds,fe,Ae]),Ie=L.useMemo(()=>Ae?Ne.edges.get(Ae.id)??[]:[],[Ne.edges,Ae]),me=L.useDeferredValue(E.query),Pe=L.useMemo(()=>{const ie=me.trim().toLocaleLowerCase();if(!ie)return[];const De=[];for(const R of je)if(R.text.includes(ie)&&De.push(R.node),De.length===20)break;return De},[me,je]),wt=L.useCallback(ie=>{Q(null),F(null),_({type:"focus",nodeId:ie})},[]),ze=L.useCallback(()=>{E.physicsRunning&&_({type:"setPhysics",running:!1})},[E.physicsRunning]),tt=L.useCallback(()=>{Q(null),F(null),_({type:"clearFocus"})},[]);L.useEffect(()=>{E.focusedNodeId&&!fe.has(E.focusedNodeId)&&tt()},[tt,fe,E.focusedNodeId]),L.useEffect(()=>{const ie=De=>{if(De.metaKey||De.ctrlKey||De.altKey||CJ(De.target))return;const R=De.key.toLocaleLowerCase();let Ce=!0;if(R==="f")De.shiftKey&&M?Z.current?.fitSelection([...M.nodeIds]):De.shiftKey?Ce=!1:Z.current?.fit();else if(R==="+"||R==="=")Z.current?.zoomIn();else if(R==="-"||R==="_")Z.current?.zoomOut();else if(R==="0")Z.current?.resetZoom();else if(R==="i"&&Ae)_({type:"setIsolation",isolated:!E.isolateSelection});else if(R==="[")_({type:"setNeighborhoodDepth",depth:Math.max(Vx,E.neighborhoodDepth-1)});else if(R==="]")_({type:"setNeighborhoodDepth",depth:Math.min(Ux,E.neighborhoodDepth+1)});else if(R==="d"){const Je=ju.indexOf(E.edgeDirection);_({type:"setEdgeDirection",direction:ju[(Je+1)%ju.length]??"both"})}else R==="m"?_({type:"setMinimap",visible:!E.showMinimap}):Ce=!1;Ce&&De.preventDefault()};return document.addEventListener("keydown",ie,{capture:!0}),()=>document.removeEventListener("keydown",ie,{capture:!0})},[Ae,M,E.edgeDirection,E.isolateSelection,E.neighborhoodDepth,E.showMinimap]);const z=L.useCallback(()=>{_({type:"stabilized"})},[]),ve=L.useCallback(()=>{_({type:"revealLayout"})},[]),Re=L.useCallback(ie=>{const De=fe.get(ie);if(!De)return;const R=bv(n,De,t);R.type==="community"&&de.current.openCommunity?.(R.communityId),R.type==="source"&&de.current.openSource(R.source,De.change==="removed"?I?.before:I?.after)},[t,fe,n.stats.aggregated,I?.after,I?.before]),Ze=L.useCallback(ie=>{const De=ke.get(ie);if(!De)return;const R=Cv(De);R&&de.current.openSource(R,De.change==="removed"?I?.before:I?.after)},[ke,I?.after,I?.before]),Dt=Ae&&E.isolateSelection&&M?`Isolated ${M.nodeIds.size} nodes · ${E.neighborhoodDepth} hop${E.neighborhoodDepth===1?"":"s"}`:Ae?`Inspecting ${Ae.label}`:E.layoutStyle!=="automatic"?AJ[E.layoutStyle]:E.physicsRunning?"Layout running":"Layout static",Ut=i!=null?n.communities.find(ie=>ie.id===i):void 0,dn=i!=null?{kind:"community",communityLabel:Ut?.label??`Community ${i}`}:E.initialLayoutPending?{kind:"layout"}:null;return f.jsxs("div",{className:"compass-workspace",style:{"--compass-inspector-width":`${c.width}px`},children:[f.jsxs("div",{className:"compass-workspace-content","data-inspector-collapsed":c.collapsed,inert:dn?!0:void 0,"aria-hidden":dn?!0:void 0,children:[f.jsxs("main",{className:"compass-graph-stage","data-comparison":U?"true":"false",children:[f.jsx(iJ,{ref:Z,model:n,focusedNodeId:Ae?.id??null,physicsRunning:E.physicsRunning,layoutStyle:E.layoutStyle,forceLabels:E.forceLabels,showEdgeLabels:E.showEdgeLabels,isolatedNodeIds:E.isolateSelection?M?.nodeIds:void 0,isolatedEdgeIds:E.isolateSelection?M?.edgeIds:void 0,layoutSpacing:E.layoutSpacing,showMinimap:E.showMinimap,hiddenCommunities:E.hiddenCommunities,hiddenChanges:E.hiddenChanges,onFocus:wt,onOpenSource:Re,onOpenRelationshipSource:Ze,onInteractionStart:ze,onHover:Q,onHoverEdge:F,onClear:tt,onStabilized:z}),x,f.jsx(R3,{status:Dt,physicsRunning:E.physicsRunning,layoutStyle:E.layoutStyle,forceLabels:E.forceLabels,showEdgeLabels:E.showEdgeLabels,hasSelection:Ae!==void 0,isolateSelection:E.isolateSelection,neighborhoodDepth:E.neighborhoodDepth,edgeDirection:E.edgeDirection,layoutSpacing:E.layoutSpacing,showMinimap:E.showMinimap,leadingControls:m,leadingPanel:y,leadingPanelOpen:w,onLeadingPanelClose:S,onTogglePhysics:()=>_({type:"setPhysics",running:!E.physicsRunning}),onLayoutChange:ie=>_({type:"setLayout",layout:ie,runPhysics:!1}),onZoomOut:()=>Z.current?.zoomOut(),onResetZoom:()=>Z.current?.resetZoom(),onZoomIn:()=>Z.current?.zoomIn(),onFit:()=>Z.current?.fit(),onFitSelection:()=>{M&&Z.current?.fitSelection([...M.nodeIds])},onReset:()=>{tt(),_({type:"setIsolation",isolated:!1}),Z.current?.reset()},onToggleLabels:()=>_({type:"setLabels",visible:!E.forceLabels}),onToggleEdgeLabels:()=>_({type:"setEdgeLabels",visible:!E.showEdgeLabels}),onToggleIsolation:()=>{const ie=!E.isolateSelection;_({type:"setIsolation",isolated:ie}),ie&&M&&window.requestAnimationFrame(()=>{Z.current?.fitSelection([...M.nodeIds])})},onNeighborhoodDepthChange:ie=>_({type:"setNeighborhoodDepth",depth:ie}),onEdgeDirectionChange:ie=>_({type:"setEdgeDirection",direction:ie}),onLayoutSpacingChange:ie=>_({type:"setLayoutSpacing",spacing:ie}),onToggleMinimap:()=>_({type:"setMinimap",visible:!E.showMinimap}),onBack:r}),U&&f.jsx("div",{className:"compass-change-legend","aria-label":"Graph change filters",children:aJ.filter(({value:ie})=>(te.get(ie)??0)>0).map(({value:ie,label:De})=>{const R=!E.hiddenChanges.has(ie);return f.jsxs("button",{type:"button","data-change":ie,"aria-pressed":R,onClick:()=>_({type:"toggleChange",change:ie}),children:[f.jsx("span",{"aria-hidden":"true"}),De,f.jsx("small",{children:te.get(ie)??0})]},ie)})}),o&&f.jsx("div",{className:"absolute bottom-4 left-4 z-20 max-w-md rounded-md border border-destructive/50 bg-background/95 px-3 py-2 text-sm text-destructive shadow-lg",role:"alert",children:o}),A&&f.jsxs("div",{className:"compass-bounded-notice",role:"status",children:[f.jsx("strong",{children:"Partial community comparison"}),f.jsxs("span",{children:["This view is limited to ",A.limit.toLocaleString()," nodes. Increase"," ",f.jsx("code",{children:"compass.graphNodeLimit"})," to inspect all"," ",Math.max(A.parentMembers,A.currentMembers).toLocaleString()," symbols."]})]}),P&&W&&V&&f.jsx(P3,{node:W,hover:P,activation:V}),ne&&se&&ee&&T&&f.jsx(Y3,{edge:se,sourceNode:ee,targetNode:T,hover:ne})]}),!c.collapsed&&f.jsx(Z3,{width:c.width,onResize:ie=>h({...c,width:ie})}),f.jsx(D3,{model:n,selected:Ae,neighbors:ae,connectedEdges:Ie,query:E.query,matches:Pe,hiddenCommunities:E.hiddenCommunities,comparisonMode:U,sourceRevisions:I,queryResult:l,renderedEdgeCount:qe,showHeader:O,onQueryChange:ie=>_({type:"search",query:ie}),onFocus:wt,onOpenSource:e.openSource,onOpenCommunity:t===void 0?e.openCommunity:void 0,onQueryNode:e.queryNode,onToggleCommunity:ie=>_({type:"toggleCommunity",communityId:ie}),onSetAllVisible:ie=>_({type:"setHiddenCommunities",communityIds:ie?[]:n.communities.map(De=>De.id)}),collapsed:c.collapsed,onToggleCollapsed:()=>h({...c,collapsed:!c.collapsed})})]}),dn?.kind==="community"?f.jsx(fv,{kind:"community",communityLabel:dn.communityLabel}):dn?.kind==="layout"?f.jsx(fv,{kind:"layout",onShowGraph:ve}):null]})}const Bu=224,lJ=76,cI=124,Pu=96,Fs=96,cJ=288,dJ=112,Lu=12;function uJ(n,e,t={width:1280,height:620},i={},o){const r=n.filter(F=>F.nodeCount>0||F.incomingCalls>0||F.outgoingCalls>0);if(r.length===0)return{width:t.width,height:t.height,nodes:[],routes:[],lanes:[]};const A=new Set(r.map(F=>F.id)),I=e.filter(F=>A.has(F.sourceSection)&&A.has(F.targetSection)),l=hJ(r,I),c=l.length,h=Math.max(t.width,Fs*2+cJ*c),p=(h-Fs*2)/c;mJ(l,I);const m=Math.max(...l.map(F=>F.length)),y=Math.max(t.height,cI+Pu+m*dJ),w=l.findIndex(F=>F.some(Z=>Z.id===o)),S=Array.from({length:c},(F,Z)=>({index:Z,x:Fs+p*Z,width:p,label:xJ(Z,c,w<0?void 0:w)})),x=y-cI-Pu,O=l.flatMap((F,Z)=>{const de=x/Math.max(1,F.length);return F.map((fe,ke)=>{const Ne={x:Fs+p*Z+p/2,y:cI+de*ke+de/2},je=i[fe.id]??Ne;return{...fe,x:Gu(je.x,Fs+Bu/2,h-Fs-Bu/2),y:Gu(je.y,cI,y-Pu),width:Math.min(Bu,p-40),height:lJ,column:wJ(je.x,S)}})}),E=new Map(O.map(F=>[F.id,F])),_=yJ(I,E),P=Qx(I,E,"source"),Q=Qx(I,E,"target"),ne=I.flatMap(F=>{const Z=E.get(F.sourceSection),de=E.get(F.targetSection);if(!Z||!de)return[];const fe=Xx(Z,de);return[{...F,direction:fe,path:vJ(Z,de,fe,_.get(F.id)??0,{height:y},P.get(F.id)??0,Q.get(F.id)??0),width:1+Math.min(4.4,Math.log10(F.calls+1)*1.35)}]});return{width:h,height:y,nodes:O,routes:ne,lanes:S}}function hJ(n,e){if(n.length===1)return[[n[0]]];if(e.length===0)return Hx(n);const t=fJ(n,e),i=new Map(t.map((c,h)=>[c.id,h])),o=new Map;for(const c of n)o.set(c.id,[]);for(const c of e)(i.get(c.sourceSection)??0)<(i.get(c.targetSection)??0)&&c.sourceSection!==c.targetSection&&o.get(c.targetSection)?.push(c);const r=new Map;for(const c of t){const h=(o.get(c.id)??[]).map(p=>(r.get(p.sourceSection)??0)+1);r.set(c.id,h.length>0?Math.max(...h):0)}const A=Math.max(0,...r.values()),I=Math.min(Lu,A+1);if(I===1)return Hx(n);const l=Array.from({length:I},()=>[]);for(const c of t){const h=r.get(c.id)??0,p=Ac.length>0)}function fJ(n,e){const t=new Map(n.map(A=>[A.id,A])),i=new Set(t.keys()),o=[],r=[];for(;i.size>0;){const A=pJ(i,e),I=[...i].map(p=>({section:t.get(p),incoming:A.incoming.get(p)??0,outgoing:A.outgoing.get(p)??0})),l=I.filter(p=>p.incoming===0),c=I.filter(p=>p.outgoing===0);if(l.length>0){const p=l.sort((m,y)=>y.outgoing-m.outgoing||Ba(m.section,y.section))[0];o.push(p.section),i.delete(p.section.id);continue}if(c.length>0){const p=c.sort((m,y)=>y.incoming-m.incoming||Ba(m.section,y.section))[0];r.unshift(p.section),i.delete(p.section.id);continue}const h=I.sort((p,m)=>m.outgoing-m.incoming-(p.outgoing-p.incoming)||m.outgoing+m.incoming-(p.outgoing+p.incoming)||Ba(p.section,m.section))[0];o.push(h.section),i.delete(h.section.id)}return[...o,...r]}function pJ(n,e){const t=new Map,i=new Map;for(const o of e){if(o.sourceSection===o.targetSection||!n.has(o.sourceSection)||!n.has(o.targetSection))continue;const r=1+Math.log10(o.calls+1);i.set(o.sourceSection,(i.get(o.sourceSection)??0)+r),t.set(o.targetSection,(t.get(o.targetSection)??0)+r)}return{incoming:t,outgoing:i}}function Hx(n){const e=Math.min(6,Math.max(2,Math.ceil(Math.sqrt(n.length)))),t=Array.from({length:e},()=>[]);return[...n].sort(Ba).forEach((i,o)=>{t[Math.floor(o*e/n.length)].push(i)}),t}function mJ(n,e){const t=new Map;for(const i of e)Kx(t,i.sourceSection,i.targetSection,i.calls),Kx(t,i.targetSection,i.sourceSection,i.calls);for(let i=0;i<8;i+=1)for(const o of[1,-1]){const r=o===1?1:n.length-2,A=o===1?n.length:-1;for(let I=r;I!==A;I+=o){const l=new Map,c=o===1?n.slice(0,I):n.slice(I+1);for(const p of c)p.forEach((m,y)=>{l.set(m.id,p.length===1?.5:y/(p.length-1))});const h=new Map(n[I].map((p,m,y)=>[p.id,y.length===1?.5:m/(y.length-1)]));n[I].sort((p,m)=>{const y=Wx(p.id,t,l),w=Wx(m.id,t,l);return(y??h.get(p.id)??.5)-(w??h.get(m.id)??.5)||Ba(p,m)})}}}function Kx(n,e,t,i){const o=n.get(e)??new Map;o.set(t,(o.get(t)??0)+i),n.set(e,o)}function Wx(n,e,t){let i=0,o=0;for(const[r,A]of e.get(n)??[]){const I=t.get(r);I!==void 0&&(i+=I*A,o+=A)}return o>0?i/o:void 0}function vJ(n,e,t,i,o,r,A){const I=n.y+r,l=e.y+A;if(t==="forward"){const w=n.x+n.width/2,S=e.x-e.width/2,x=Math.max(1,S-w),O=Gu(x*.42,42,168),E=SJ(i%9,1.5);return[`M ${w} ${I}`,`C ${w+O} ${I+E}`,`${S-O} ${l+E}`,`${S} ${l}`].join(" ")}if(t==="backward"){const w=n.x-n.width/2,S=e.x+e.width/2,x=(I+l)/2{const I=e.get(r.sourceSection),l=e.get(A.sourceSection),c=e.get(r.targetSection),h=e.get(A.targetSection);return(I?.column??0)-(l?.column??0)||(c?.column??0)-(h?.column??0)||(I?.y??0)-(l?.y??0)||(c?.y??0)-(h?.y??0)||A.calls-r.calls||r.id.localeCompare(A.id)});for(const r of o){const A=e.get(r.sourceSection),I=e.get(r.targetSection);if(!A||!I)continue;const l=Xx(A,I),c=`${Math.min(A.column,I.column)}:${Math.max(A.column,I.column)}:${l}`,h=i.get(c)??0;t.set(r.id,h),i.set(c,h+1)}return t}function Qx(n,e,t){const i=new Map;for(const r of n){const A=t==="source"?r.sourceSection:r.targetSection,I=i.get(A)??[];I.push(r),i.set(A,I)}const o=new Map;for(const r of i.values()){r.sort((I,l)=>{const c=e.get(t==="source"?I.targetSection:I.sourceSection),h=e.get(t==="source"?l.targetSection:l.sourceSection);return(c?.y??0)-(h?.y??0)||(c?.x??0)-(h?.x??0)||I.id.localeCompare(l.id)});const A=Math.min(8,38/Math.max(1,r.length-1));r.forEach((I,l)=>{o.set(I.id,(l-(r.length-1)/2)*A)})}return o}function bJ(n,e,t,i,o){const r=Math.sign(i-e)||1,A=Math.sign(o-t)||1,I=Math.min(12,Math.abs(i-e)/2,Math.abs(t-n)/2);return[`M ${n} ${e}`,`H ${t-Math.sign(t-n)*I}`,`Q ${t} ${e} ${t} ${e+r*I}`,`V ${i-r*I}`,`Q ${t} ${i} ${t+A*I} ${i}`,`H ${o}`].join(" ")}function Xx(n,e){return e.column>n.column?"forward":e.columnqx(i)),A=L.useRef(o),[I,l]=L.useState(1),[c,h]=L.useState("none"),p=L.useRef("none"),m=L.useRef(0),[y,w]=L.useState(TJ),[S,x]=L.useState("key"),[O,E]=L.useState(),_=L.useRef(null),P=L.useRef(void 0),Q=L.useRef(void 0);L.useEffect(()=>{const z=qx(i);A.current=z,r(z),l(1),p.current="start",m.current=0,h("start"),_.current?.scrollTo?.({left:0,top:0}),x("key")},[i]);const ne=L.useMemo(()=>DJ(n.routes,e),[n.routes,e]),F=L.useMemo(()=>S==="complete"?{routes:n.routes,reciprocals:new Map}:MJ(n.routes.filter(z=>ne.has(z.id)),e?.kind==="route"?e.id:void 0),[ne,n.routes,S,e]),Z=F.routes,de=L.useMemo(()=>{if(S==="complete"||e===void 0)return n.sections;const z=new Set;e.kind==="section"&&z.add(e.id);for(const ve of Z)z.add(ve.sourceSection),z.add(ve.targetSection);return n.sections.filter(ve=>z.has(ve.id))},[n.sections,S,Z,e]),fe=L.useMemo(()=>uJ(de,Z,y,o,S==="key"&&e?.kind==="section"?e.id:void 0),[de,o,S,Z,e,y]),ke=fe.routes,Ne=L.useMemo(()=>e?.kind!=="section"?new Set:new Set(ke.filter(z=>z.sourceSection===e.id||z.targetSection===e.id).flatMap(z=>[z.id,z.sourceSection,z.targetSection])),[ke,e]),je=Math.max(1,...ke.map(z=>z.calls)),qe=n.routes.length-ke.length,Ae={width:Math.round(fe.width*I),height:Math.round(fe.height*I)},M=z=>{t(z)},W=(z,ve)=>{(z.key==="Enter"||z.key===" ")&&(z.preventDefault(),M(ve))},V=(z,ve)=>{const Re={...A.current,[z]:ve};A.current=Re,r(Re)},se=()=>{try{window.localStorage.setItem(i,JSON.stringify(A.current))}catch{}},ee=()=>{A.current={},r({});try{window.localStorage.removeItem(i)}catch{}},T=()=>{l(1),p.current="start",m.current=0,h("start");const z=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;_.current?.scrollTo?.({left:0,top:0,behavior:z?"auto":"smooth"})},U=z=>{const ve=Math.max(0,z.scrollWidth-z.clientWidth),Re=ve<=1?"none":z.scrollLeft<=1?"start":z.scrollLeft>=ve-1?"end":"middle";m.current=ve,p.current=Re,h(Ze=>Ze===Re?Ze:Re)},te=z=>{U(z.currentTarget)},ae=z=>{z.target!==z.currentTarget||!_.current||(P.current={x:z.clientX,y:z.clientY,scrollLeft:_.current.scrollLeft,scrollTop:_.current.scrollTop,pointerId:z.pointerId},z.currentTarget.setPointerCapture(z.pointerId))},Ie=z=>{const ve=P.current,Re=_.current;!ve||!Re||ve.pointerId!==z.pointerId||(Re.scrollLeft=ve.scrollLeft-(z.clientX-ve.x),Re.scrollTop=ve.scrollTop-(z.clientY-ve.y))},me=z=>{P.current?.pointerId===z.pointerId&&(P.current=void 0,z.currentTarget.hasPointerCapture(z.pointerId)&&z.currentTarget.releasePointerCapture(z.pointerId))},Pe=(z,ve)=>{z.stopPropagation();const Re=$x(z.currentTarget.ownerSVGElement,z);Re&&(Q.current={id:ve.id,pointerId:z.pointerId,offsetX:Re.x-ve.x,offsetY:Re.y-ve.y,startClientX:z.clientX,startClientY:z.clientY,moved:!1},E(ve.id),z.currentTarget.setPointerCapture(z.pointerId))},wt=(z,ve)=>{const Re=Q.current;!Re||Re.id!==ve.id||Re.pointerId!==z.pointerId||(z.currentTarget.hasPointerCapture(z.pointerId)&&z.currentTarget.releasePointerCapture(z.pointerId),Q.current=void 0,E(void 0),Re.moved?se():M({kind:"section",id:ve.id}))},ze=z=>{Q.current?.pointerId===z.pointerId&&(Q.current=void 0,E(void 0))},tt=(z,ve)=>{if(z.key==="Enter"||z.key===" "){z.preventDefault(),M({kind:"section",id:ve.id});return}if(!z.altKey||!z.key.startsWith("Arrow"))return;z.preventDefault();const Re=z.shiftKey?24:8;V(ve.id,{x:ve.x+(z.key==="ArrowRight"?Re:z.key==="ArrowLeft"?-Re:0),y:ve.y+(z.key==="ArrowDown"?Re:z.key==="ArrowUp"?-Re:0)}),se()};return L.useEffect(()=>{const z=_.current;if(!z)return;const ve=()=>{const Ze=m.current,Dt=Math.max(0,z.scrollWidth-z.clientWidth),Ut=Ze>1&&z.scrollLeft>=Ze-1;if(Dt>Ze&&(p.current==="end"||Ut)&&(z.scrollLeft=Dt),U(z),z.clientWidth<=0||z.clientHeight<=0)return;const dn={width:Math.round(z.clientWidth),height:Math.round(z.clientHeight)};w(ie=>ie.width===dn.width&&ie.height===dn.height?ie:dn)};if(ve(),typeof ResizeObserver>"u")return;const Re=new ResizeObserver(ve);return Re.observe(z),()=>Re.disconnect()},[Ae.height,Ae.width]),f.jsxs("section",{className:"architecture-map-panel","aria-labelledby":"architecture-map-title","data-route-mode":S,children:[f.jsxs("header",{className:"architecture-map-header",children:[f.jsxs("div",{className:"architecture-map-intro",children:[f.jsx("span",{children:"Flow canvas"}),f.jsx("strong",{id:"architecture-map-title",children:"Subsystem call direction"}),f.jsx("small",{id:"architecture-map-help",children:"Scroll sideways or drag open canvas space to follow the complete architecture."})]}),f.jsxs("div",{className:"architecture-map-actions",children:[f.jsxs("div",{className:"architecture-route-mode",role:"group","aria-label":"Route visibility",children:[f.jsx("button",{type:"button","aria-pressed":S==="key",onClick:()=>x("key"),children:e?.kind==="section"?"Neighbors":"Key routes"}),f.jsxs("button",{type:"button","aria-pressed":S==="complete",onClick:()=>x("complete"),children:["All routes · ",n.routes.length]})]}),f.jsxs("div",{className:"architecture-map-toolbar","aria-label":"Map controls",children:[f.jsx("button",{type:"button","aria-label":"Zoom out",onClick:()=>l(z=>Math.max(.75,z-.25)),children:f.jsx(t3,{"aria-hidden":"true"})}),f.jsxs("span",{"aria-live":"polite",children:[Math.round(I*100),"%"]}),f.jsx("button",{type:"button","aria-label":"Zoom in",onClick:()=>l(z=>Math.min(2,z+.25)),children:f.jsx(Ym,{"aria-hidden":"true"})}),f.jsx("button",{type:"button","aria-label":"Reset zoom and scroll position",title:"Reset zoom and scroll position",onClick:T,children:f.jsx(Fm,{"aria-hidden":"true"})}),f.jsx("button",{type:"button","aria-label":"Reset subsystem positions",title:"Reset subsystem positions",disabled:Object.keys(o).length===0,onClick:ee,children:f.jsx(Hm,{"aria-hidden":"true"})})]})]})]}),f.jsx("div",{ref:_,className:"architecture-map-viewport",role:"region","aria-label":"Scrollable architecture flow diagram","aria-describedby":"architecture-map-help",tabIndex:0,"data-scroll-position":c,onScroll:te,children:fe.nodes.length>0?f.jsx("div",{className:"architecture-map-canvas",style:{width:Ae.width,height:Ae.height},children:f.jsxs("svg",{className:"architecture-map",viewBox:`0 0 ${fe.width} ${fe.height}`,role:"group","aria-label":kJ(fe.nodes.length,ke.length,n.routes.length),onPointerDown:ae,onPointerMove:Ie,onPointerUp:me,onPointerCancel:()=>{P.current=void 0},children:[f.jsxs("defs",{children:[f.jsx("marker",{id:"architecture-arrow",className:"architecture-arrow architecture-arrow-default",markerWidth:"8",markerHeight:"8",refX:"7",refY:"4",orient:"auto-start-reverse",markerUnits:"userSpaceOnUse",children:f.jsx("path",{d:"M 0 0 L 8 4 L 0 8 z"})}),f.jsx("marker",{id:"architecture-arrow-incoming",className:"architecture-arrow architecture-arrow-incoming",markerWidth:"8",markerHeight:"8",refX:"7",refY:"4",orient:"auto-start-reverse",markerUnits:"userSpaceOnUse",children:f.jsx("path",{d:"M 0 0 L 8 4 L 0 8 z"})}),f.jsx("marker",{id:"architecture-arrow-outgoing",className:"architecture-arrow architecture-arrow-outgoing",markerWidth:"8",markerHeight:"8",refX:"7",refY:"4",orient:"auto-start-reverse",markerUnits:"userSpaceOnUse",children:f.jsx("path",{d:"M 0 0 L 8 4 L 0 8 z"})})]}),f.jsxs("g",{className:"architecture-map-lanes","aria-hidden":"true",children:[fe.lanes.map(z=>f.jsxs("g",{children:[f.jsx("rect",{x:z.x+8,y:34,width:z.width-16,height:fe.height-76,rx:"12"}),f.jsx("text",{x:z.x+z.width/2,y:61,children:z.label})]},z.index)),f.jsx("text",{className:"architecture-map-direction",x:96,y:24,children:"PRIMARY CALL DIRECTION →"})]}),f.jsx("g",{className:"architecture-routes",children:ke.map(z=>{const ve=F.reciprocals.get(z.id),Re=e?.kind==="route"&&e.id===z.id,Ze=Re||e===void 0||e.kind==="section"&&Ne.has(z.id),Dt=z.inferred>z.extracted?"inferred":"extracted",Ut=e?.kind==="section"?z.targetSection===e.id?"incoming":z.sourceSection===e.id?"outgoing":void 0:void 0,dn=S==="key"?.3+Math.sqrt(z.calls/je)*.28:.1+Math.sqrt(z.calls/je)*.2;return f.jsxs("g",{role:"button",tabIndex:0,"aria-label":`${z.sourceSection} to ${z.targetSection}, ${z.calls} calls${ve?`; bidirectional, ${ve.calls} reverse calls`:""}${z.direction==="backward"?", feedback route":""}`,"data-direction":z.direction,"data-evidence":Dt,"data-reciprocal":ve?"true":void 0,"data-focus-direction":Ut,"data-selected":Re||void 0,"data-dimmed":!Ze||void 0,onClick:()=>M({kind:"route",id:z.id}),onKeyDown:ie=>W(ie,{kind:"route",id:z.id}),children:[f.jsx("path",{className:"architecture-route-hit",d:z.path}),f.jsx("path",{className:"architecture-route-line",d:z.path,style:{strokeWidth:z.width,"--architecture-route-opacity":dn},markerStart:ve?zJ(Ut):void 0,markerEnd:Ut==="incoming"?"url(#architecture-arrow-incoming)":Ut==="outgoing"?"url(#architecture-arrow-outgoing)":"url(#architecture-arrow)"}),f.jsxs("title",{children:[z.sourceSection," → ",z.targetSection,": ",z.calls," calls",ve&&` · ${ve.sourceSection} → ${ve.targetSection}: ${ve.calls} calls`]})]},z.id)})}),f.jsx("g",{className:"architecture-map-nodes",children:fe.nodes.map(z=>{const ve=e?.kind==="section"&&e.id===z.id,Re=ve||e===void 0||e.kind==="section"&&Ne.has(z.id)||e.kind==="route"&&n.routes.some(Ze=>Ze.id===e.id&&(Ze.sourceSection===z.id||Ze.targetSection===z.id));return f.jsxs("g",{role:"button",tabIndex:0,"aria-label":`${z.name}, ${z.nodeCount} visible symbols, ${z.incomingCalls} incoming and ${z.outgoingCalls} outgoing calls; drag to reposition`,transform:`translate(${z.x-z.width/2} ${z.y-z.height/2})`,"data-selected":ve||void 0,"data-dimmed":!Re||void 0,"data-dragging":O===z.id||void 0,onPointerDown:Ze=>Pe(Ze,z),onPointerMove:Ze=>{const Dt=Q.current;if(!Dt||Dt.id!==z.id||Dt.pointerId!==Ze.pointerId)return;const Ut=$x(Ze.currentTarget.ownerSVGElement,Ze);Ut&&((Math.abs(Ze.clientX-Dt.startClientX)>3||Math.abs(Ze.clientY-Dt.startClientY)>3)&&(Dt.moved=!0),V(z.id,{x:Ut.x-Dt.offsetX,y:Ut.y-Dt.offsetY}))},onPointerUp:Ze=>wt(Ze,z),onPointerCancel:Ze=>ze(Ze),onKeyDown:Ze=>tt(Ze,z),children:[f.jsx("rect",{className:"architecture-map-node-shadow",width:z.width,height:z.height,rx:"9"}),f.jsx("rect",{className:"architecture-map-node-card",width:z.width,height:z.height,rx:"9"}),f.jsx("rect",{className:"architecture-map-node-accent",width:"4",height:z.height-16,x:"8",y:"8",rx:"2"}),f.jsx("text",{x:"20",y:"27",className:"architecture-map-node-name",children:NJ(z.name,24)}),f.jsxs("text",{x:"20",y:"48",className:"architecture-map-node-meta",children:[z.nodeCount.toLocaleString()," symbols"," · ","↓",z.incomingCalls.toLocaleString()," ↑",z.outgoingCalls.toLocaleString()]}),f.jsxs("g",{className:"architecture-map-node-grip","aria-hidden":"true",children:[f.jsx("circle",{cx:z.width-18,cy:"26",r:"1.2"}),f.jsx("circle",{cx:z.width-13,cy:"26",r:"1.2"}),f.jsx("circle",{cx:z.width-18,cy:"31",r:"1.2"}),f.jsx("circle",{cx:z.width-13,cy:"31",r:"1.2"}),f.jsx("circle",{cx:z.width-18,cy:"36",r:"1.2"}),f.jsx("circle",{cx:z.width-13,cy:"36",r:"1.2"})]}),f.jsxs("title",{children:[z.name," — drag to reposition"]})]},z.id)})})]})}):f.jsxs("div",{className:"architecture-map-empty",children:[f.jsx("strong",{children:"No architecture to draw"}),f.jsx("span",{children:"No subsystems match the current scope and evidence filters."})]})}),f.jsxs("footer",{className:"architecture-map-footer",children:[f.jsxs("div",{className:"architecture-map-legend","aria-label":"Map legend",children:[f.jsxs("span",{children:[f.jsx("i",{"data-evidence":"extracted"})," Extracted"]}),f.jsxs("span",{children:[f.jsx("i",{"data-evidence":"inferred"})," Inferred"]}),f.jsxs("span",{children:[f.jsx("i",{"data-direction":"incoming"})," Incoming"]}),f.jsxs("span",{children:[f.jsx("i",{"data-direction":"outgoing"})," Outgoing"]}),f.jsxs("span",{children:[f.jsx("i",{"data-direction":"bidirectional","aria-hidden":"true",children:"↔"})," Bidirectional"]}),f.jsxs("span",{children:[f.jsx("i",{"data-direction":"feedback"})," Feedback"]}),f.jsxs("span",{children:[f.jsx(n3,{"aria-hidden":"true"})," Drag cards to arrange"]}),qe>0&&f.jsxs("button",{type:"button",onClick:()=>x("complete"),children:[ke.length," of ",n.routes.length," routes · Show all"]})]}),f.jsxs("details",{className:"architecture-map-table",children:[f.jsx("summary",{children:"View routes as a table"}),f.jsx("div",{children:f.jsxs("table",{children:[f.jsx("thead",{children:f.jsxs("tr",{children:[f.jsx("th",{children:"From"}),f.jsx("th",{children:"To"}),f.jsx("th",{children:"Calls"}),f.jsx("th",{children:"Evidence"})]})}),f.jsx("tbody",{children:n.routes.map(z=>f.jsxs("tr",{children:[f.jsx("td",{children:Jx(n,z.sourceSection)}),f.jsx("td",{children:Jx(n,z.targetSection)}),f.jsx("td",{children:z.calls.toLocaleString()}),f.jsxs("td",{children:[z.extracted," extracted · ",z.inferred," inferred"]})]},z.id))})]})})]})]})]})}function $x(n,e){if(!n)return;const t=n.getScreenCTM();if(!t)return;const i=n.createSVGPoint();i.x=e.clientX,i.y=e.clientY;const o=i.matrixTransform(t.inverse());return{x:o.x,y:o.y}}function qx(n){try{const e=JSON.parse(window.localStorage.getItem(n)??"{}");return!e||typeof e!="object"||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).flatMap(([t,i])=>i&&typeof i=="object"&&"x"in i&&"y"in i&&typeof i.x=="number"&&typeof i.y=="number"&&Number.isFinite(i.x)&&Number.isFinite(i.y)?[[t,{x:i.x,y:i.y}]]:[]))}catch{return{}}}function Jx(n,e){return n.sections.find(t=>t.id===e)?.name??e}function NJ(n,e){return n.length<=e?n:`${n.slice(0,e-1)}…`}function DJ(n,e){const t=o=>[...o].sort((r,A)=>A.calls-r.calls||r.id.localeCompare(A.id)),i=new Set;if(e?.kind==="route"){const o=n.find(r=>r.id===e.id);if(o){i.add(o.id);const r=n.find(A=>A.sourceSection===o.targetSection&&A.targetSection===o.sourceSection);r&&i.add(r.id)}return i}else if(e?.kind==="section"){const o=t(n.filter(A=>A.targetSection===e.id)).slice(0,6),r=t(n.filter(A=>A.sourceSection===e.id)).slice(0,6);for(const A of t([...o,...r]))i.add(A.id);return i}for(const o of t(n)){if(i.size>=EJ)break;i.add(o.id)}return i}function MJ(n,e){const t=new Map(n.map(A=>[e2(A.sourceSection,A.targetSection),A])),i=new Set,o=[],r=new Map;for(const A of n){if(i.has(A.id))continue;const I=t.get(e2(A.targetSection,A.sourceSection));if(!I||I.id===A.id||i.has(I.id)){o.push(A),i.add(A.id);continue}const l=A.id===e?A:I.id===e?I:A.calls>I.calls||A.calls===I.calls&&A.id.localeCompare(I.id)<=0?A:I,c=l.id===A.id?I:A;o.push(l),r.set(l.id,c),i.add(A.id),i.add(I.id)}return o.sort((A,I)=>I.calls-A.calls||A.id.localeCompare(I.id)),{routes:o,reciprocals:r}}function e2(n,e){return`${n}\0${e}`}function zJ(n){return n==="incoming"?"url(#architecture-arrow-outgoing)":n==="outgoing"?"url(#architecture-arrow-incoming)":"url(#architecture-arrow)"}function kJ(n,e,t){return e===t?`${n} subsystems and ${t} directed routes`:`${n} subsystems and ${e} of ${t} directed routes visible`}function t2(n){var e,t,i="";if(typeof n=="string"||typeof n=="number")i+=n;else if(typeof n=="object")if(Array.isArray(n)){var o=n.length;for(e=0;etypeof n=="boolean"?`${n}`:n===0?"0":n,g2=n2,Fu=(n,e)=>t=>{var i;if(e?.variants==null)return g2(n,t?.class,t?.className);const{variants:o,defaultVariants:r}=e,A=Object.keys(o).map(c=>{const h=t?.[c],p=r?.[c];if(h===null)return null;const m=i2(h)||i2(p);return o[c][m]}),I=t&&Object.entries(t).reduce((c,h)=>{let[p,m]=h;return m===void 0||(c[p]=m),c},{}),l=e==null||(i=e.compoundVariants)===null||i===void 0?void 0:i.reduce((c,h)=>{let{class:p,className:m,...y}=h;return Object.entries(y).every(w=>{let[S,x]=w;return Array.isArray(x)?x.includes({...r,...I}[S]):{...r,...I}[S]===x})?[...c,p,m]:c},[]);return g2(n,A,l,t?.class,t?.className)},RJ=(n,e)=>{const t=new Array(n.length+e.length);for(let i=0;i({classGroupId:n,validator:e}),o2=(n=new Map,e=null,t)=>({nextPart:n,validators:e,classGroupId:t}),dI="-",s2=[],jJ="arbitrary..",ZJ=n=>{const e=PJ(n),{conflictingClassGroups:t,conflictingClassGroupModifiers:i}=n;return{getClassGroupId:A=>{if(A.startsWith("[")&&A.endsWith("]"))return BJ(A);const I=A.split(dI),l=I[0]===""&&I.length>1?1:0;return r2(I,l,e)},getConflictingClassGroupIds:(A,I)=>{if(I){const l=i[A],c=t[A];return l?c?RJ(c,l):l:c||s2}return t[A]||s2}}},r2=(n,e,t)=>{if(n.length-e===0)return t.classGroupId;const o=n[e],r=t.nextPart.get(o);if(r){const c=r2(n,e+1,r);if(c)return c}const A=t.validators;if(A===null)return;const I=e===0?n.join(dI):n.slice(e).join(dI),l=A.length;for(let c=0;cn.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const e=n.slice(1,-1),t=e.indexOf(":"),i=e.slice(0,t);return i?jJ+i:void 0})(),PJ=n=>{const{theme:e,classGroups:t}=n;return LJ(t,e)},LJ=(n,e)=>{const t=o2();for(const i in n){const o=n[i];Vu(o,t,i,e)}return t},Vu=(n,e,t,i)=>{const o=n.length;for(let r=0;r{if(typeof n=="string"){FJ(n,e,t);return}if(typeof n=="function"){VJ(n,e,t,i);return}UJ(n,e,t,i)},FJ=(n,e,t)=>{const i=n===""?e:a2(e,n);i.classGroupId=t},VJ=(n,e,t,i)=>{if(YJ(n)){Vu(n(i),e,t,i);return}e.validators===null&&(e.validators=[]),e.validators.push(_J(t,n))},UJ=(n,e,t,i)=>{const o=Object.entries(n),r=o.length;for(let A=0;A{let t=n;const i=e.split(dI),o=i.length;for(let r=0;r"isThemeGetter"in n&&n.isThemeGetter===!0,HJ=n=>{if(n<1)return{get:()=>{},set:()=>{}};let e=0,t=Object.create(null),i=Object.create(null);const o=(r,A)=>{t[r]=A,e++,e>n&&(e=0,i=t,t=Object.create(null))};return{get(r){let A=t[r];if(A!==void 0)return A;if((A=i[r])!==void 0)return o(r,A),A},set(r,A){r in t?t[r]=A:o(r,A)}}},Uu="!",A2=":",KJ=[],C2=(n,e,t,i,o)=>({modifiers:n,hasImportantModifier:e,baseClassName:t,maybePostfixModifierPosition:i,isExternal:o}),WJ=n=>{const{prefix:e,experimentalParseClassName:t}=n;let i=o=>{const r=[];let A=0,I=0,l=0,c;const h=o.length;for(let S=0;Sl?c-l:void 0;return C2(r,y,m,w)};if(e){const o=e+A2,r=i;i=A=>A.startsWith(o)?r(A.slice(o.length)):C2(KJ,!1,A,void 0,!0)}if(t){const o=i;i=r=>t({className:r,parseClassName:o})}return i},QJ=n=>{const e=new Map;return n.orderSensitiveModifiers.forEach((t,i)=>{e.set(t,1e6+i)}),t=>{const i=[];let o=[];for(let r=0;r0&&(o.sort(),i.push(...o),o=[]),i.push(A)):o.push(A)}return o.length>0&&(o.sort(),i.push(...o)),i}},XJ=n=>({cache:HJ(n.cacheSize),parseClassName:WJ(n),sortModifiers:QJ(n),postfixLookupClassGroupIds:$J(n),...ZJ(n)}),$J=n=>{const e=Object.create(null),t=n.postfixLookupClassGroups;if(t)for(let i=0;i{const{parseClassName:t,getClassGroupId:i,getConflictingClassGroupIds:o,sortModifiers:r,postfixLookupClassGroupIds:A}=e,I=[],l=n.trim().split(qJ);let c="";for(let h=l.length-1;h>=0;h-=1){const p=l[h],{isExternal:m,modifiers:y,hasImportantModifier:w,baseClassName:S,maybePostfixModifierPosition:x}=t(p);if(m){c=p+(c.length>0?" "+c:c);continue}let O=!!x,E;if(O){const F=S.substring(0,x);E=i(F);const Z=E&&A[E]?i(S):void 0;Z&&Z!==E&&(E=Z,O=!1)}else E=i(S);if(!E){if(!O){c=p+(c.length>0?" "+c:c);continue}if(E=i(S),!E){c=p+(c.length>0?" "+c:c);continue}O=!1}const _=y.length===0?"":y.length===1?y[0]:r(y).join(":"),P=w?_+Uu:_,Q=P+E;if(I.indexOf(Q)>-1)continue;I.push(Q);const ne=o(E,O);for(let F=0;F0?" "+c:c)}return c},eee=(...n)=>{let e=0,t,i,o="";for(;e{if(typeof n=="string")return n;let e,t="";for(let i=0;i{let t,i,o,r;const A=l=>{const c=e.reduce((h,p)=>p(h),n());return t=XJ(c),i=t.cache.get,o=t.cache.set,r=I,I(l)},I=l=>{const c=i(l);if(c)return c;const h=JJ(l,t);return o(l,h),h};return r=A,(...l)=>r(eee(...l))},nee=[],on=n=>{const e=t=>t[n]||nee;return e.isThemeGetter=!0,e},l2=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,c2=/^\((?:(\w[\w-]*):)?(.+)\)$/i,iee=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,gee=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,oee=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,see=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,ree=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,aee=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Lg=n=>iee.test(n),Ue=n=>!!n&&!Number.isNaN(Number(n)),Bi=n=>!!n&&Number.isInteger(Number(n)),Yu=n=>n.endsWith("%")&&Ue(n.slice(0,-1)),ng=n=>gee.test(n),d2=()=>!0,Aee=n=>oee.test(n)&&!see.test(n),Hu=()=>!1,Cee=n=>ree.test(n),Iee=n=>aee.test(n),lee=n=>!le(n)&&!ce(n),cee=n=>n.startsWith("@container")&&(n[10]==="/"&&n[11]!==void 0||n[11]==="s"&&n[16]!==void 0&&n.startsWith("-size/",10)||n[11]==="n"&&n[18]!==void 0&&n.startsWith("-normal/",10)),dee=n=>Gg(n,v2,Hu),le=n=>l2.test(n),Zo=n=>Gg(n,y2,Aee),u2=n=>Gg(n,bee,Ue),uee=n=>Gg(n,w2,d2),hee=n=>Gg(n,b2,Hu),h2=n=>Gg(n,p2,Hu),fee=n=>Gg(n,m2,Iee),uI=n=>Gg(n,x2,Cee),ce=n=>c2.test(n),Pa=n=>Bo(n,y2),pee=n=>Bo(n,b2),f2=n=>Bo(n,p2),mee=n=>Bo(n,v2),vee=n=>Bo(n,m2),hI=n=>Bo(n,x2,!0),yee=n=>Bo(n,w2,!0),Gg=(n,e,t)=>{const i=l2.exec(n);return i?i[1]?e(i[1]):t(i[2]):!1},Bo=(n,e,t=!1)=>{const i=c2.exec(n);return i?i[1]?e(i[1]):t:!1},p2=n=>n==="position"||n==="percentage",m2=n=>n==="image"||n==="url",v2=n=>n==="length"||n==="size"||n==="bg-size",y2=n=>n==="length",bee=n=>n==="number",b2=n=>n==="family-name",w2=n=>n==="number"||n==="weight",x2=n=>n==="shadow",wee=tee(()=>{const n=on("color"),e=on("font"),t=on("text"),i=on("font-weight"),o=on("tracking"),r=on("leading"),A=on("breakpoint"),I=on("container"),l=on("spacing"),c=on("radius"),h=on("shadow"),p=on("inset-shadow"),m=on("text-shadow"),y=on("drop-shadow"),w=on("blur"),S=on("perspective"),x=on("aspect"),O=on("ease"),E=on("animate"),_=()=>["auto","avoid","all","avoid-page","page","left","right","column"],P=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],Q=()=>[...P(),ce,le],ne=()=>["auto","hidden","clip","visible","scroll"],F=()=>["auto","contain","none"],Z=()=>[ce,le,l],de=()=>[Lg,"full","auto",...Z()],fe=()=>[Bi,"none","subgrid",ce,le],ke=()=>["auto",{span:["full",Bi,ce,le]},Bi,ce,le],Ne=()=>[Bi,"auto",ce,le],je=()=>["auto","min","max","fr",ce,le],qe=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],Ae=()=>["start","end","center","stretch","center-safe","end-safe"],M=()=>["auto",...Z()],W=()=>[Lg,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...Z()],V=()=>[Lg,"screen","full","dvw","lvw","svw","min","max","fit",...Z()],se=()=>[Lg,"screen","full","lh","dvh","lvh","svh","min","max","fit",...Z()],ee=()=>[n,ce,le],T=()=>[...P(),f2,h2,{position:[ce,le]}],U=()=>["no-repeat",{repeat:["","x","y","space","round"]}],te=()=>["auto","cover","contain",mee,dee,{size:[ce,le]}],ae=()=>[Yu,Pa,Zo],Ie=()=>["","none","full",c,ce,le],me=()=>["",Ue,Pa,Zo],Pe=()=>["solid","dashed","dotted","double"],wt=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ze=()=>[Ue,Yu,f2,h2],tt=()=>["","none",w,ce,le],z=()=>["none",Ue,ce,le],ve=()=>["none",Ue,ce,le],Re=()=>[Ue,ce,le],Ze=()=>[Lg,"full",...Z()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[ng],breakpoint:[ng],color:[d2],container:[ng],"drop-shadow":[ng],ease:["in","out","in-out"],font:[lee],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[ng],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[ng],shadow:[ng],spacing:["px",Ue],text:[ng],"text-shadow":[ng],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Lg,le,ce,x]}],container:["container"],"container-type":[{"@container":["","normal","size",ce,le]}],"container-named":[cee],columns:[{columns:[Ue,le,ce,I]}],"break-after":[{"break-after":_()}],"break-before":[{"break-before":_()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:Q()}],overflow:[{overflow:ne()}],"overflow-x":[{"overflow-x":ne()}],"overflow-y":[{"overflow-y":ne()}],overscroll:[{overscroll:F()}],"overscroll-x":[{"overscroll-x":F()}],"overscroll-y":[{"overscroll-y":F()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:de()}],"inset-x":[{"inset-x":de()}],"inset-y":[{"inset-y":de()}],start:[{"inset-s":de(),start:de()}],end:[{"inset-e":de(),end:de()}],"inset-bs":[{"inset-bs":de()}],"inset-be":[{"inset-be":de()}],top:[{top:de()}],right:[{right:de()}],bottom:[{bottom:de()}],left:[{left:de()}],visibility:["visible","invisible","collapse"],z:[{z:[Bi,"auto",ce,le]}],basis:[{basis:[Lg,"full","auto",I,...Z()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ue,Lg,"auto","initial","none",le]}],grow:[{grow:["",Ue,ce,le]}],shrink:[{shrink:["",Ue,ce,le]}],order:[{order:[Bi,"first","last","none",ce,le]}],"grid-cols":[{"grid-cols":fe()}],"col-start-end":[{col:ke()}],"col-start":[{"col-start":Ne()}],"col-end":[{"col-end":Ne()}],"grid-rows":[{"grid-rows":fe()}],"row-start-end":[{row:ke()}],"row-start":[{"row-start":Ne()}],"row-end":[{"row-end":Ne()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":je()}],"auto-rows":[{"auto-rows":je()}],gap:[{gap:Z()}],"gap-x":[{"gap-x":Z()}],"gap-y":[{"gap-y":Z()}],"justify-content":[{justify:[...qe(),"normal"]}],"justify-items":[{"justify-items":[...Ae(),"normal"]}],"justify-self":[{"justify-self":["auto",...Ae()]}],"align-content":[{content:["normal",...qe()]}],"align-items":[{items:[...Ae(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...Ae(),{baseline:["","last"]}]}],"place-content":[{"place-content":qe()}],"place-items":[{"place-items":[...Ae(),"baseline"]}],"place-self":[{"place-self":["auto",...Ae()]}],p:[{p:Z()}],px:[{px:Z()}],py:[{py:Z()}],ps:[{ps:Z()}],pe:[{pe:Z()}],pbs:[{pbs:Z()}],pbe:[{pbe:Z()}],pt:[{pt:Z()}],pr:[{pr:Z()}],pb:[{pb:Z()}],pl:[{pl:Z()}],m:[{m:M()}],mx:[{mx:M()}],my:[{my:M()}],ms:[{ms:M()}],me:[{me:M()}],mbs:[{mbs:M()}],mbe:[{mbe:M()}],mt:[{mt:M()}],mr:[{mr:M()}],mb:[{mb:M()}],ml:[{ml:M()}],"space-x":[{"space-x":Z()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":Z()}],"space-y-reverse":["space-y-reverse"],size:[{size:W()}],"inline-size":[{inline:["auto",...V()]}],"min-inline-size":[{"min-inline":["auto",...V()]}],"max-inline-size":[{"max-inline":["none",...V()]}],"block-size":[{block:["auto",...se()]}],"min-block-size":[{"min-block":["auto",...se()]}],"max-block-size":[{"max-block":["none",...se()]}],w:[{w:[I,"screen",...W()]}],"min-w":[{"min-w":[I,"screen","none",...W()]}],"max-w":[{"max-w":[I,"screen","none","prose",{screen:[A]},...W()]}],h:[{h:["screen","lh",...W()]}],"min-h":[{"min-h":["screen","lh","none",...W()]}],"max-h":[{"max-h":["screen","lh",...W()]}],"font-size":[{text:["base",t,Pa,Zo]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[i,yee,uee]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Yu,le]}],"font-family":[{font:[pee,hee,e]}],"font-features":[{"font-features":[le]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[o,ce,le]}],"line-clamp":[{"line-clamp":[Ue,"none",ce,u2]}],leading:[{leading:[r,...Z()]}],"list-image":[{"list-image":["none",ce,le]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",ce,le]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:ee()}],"text-color":[{text:ee()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Pe(),"wavy"]}],"text-decoration-thickness":[{decoration:[Ue,"from-font","auto",ce,Zo]}],"text-decoration-color":[{decoration:ee()}],"underline-offset":[{"underline-offset":[Ue,"auto",ce,le]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:Z()}],"tab-size":[{tab:[Bi,ce,le]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ce,le]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",ce,le]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:T()}],"bg-repeat":[{bg:U()}],"bg-size":[{bg:te()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Bi,ce,le],radial:["",ce,le],conic:[Bi,ce,le]},vee,fee]}],"bg-color":[{bg:ee()}],"gradient-from-pos":[{from:ae()}],"gradient-via-pos":[{via:ae()}],"gradient-to-pos":[{to:ae()}],"gradient-from":[{from:ee()}],"gradient-via":[{via:ee()}],"gradient-to":[{to:ee()}],rounded:[{rounded:Ie()}],"rounded-s":[{"rounded-s":Ie()}],"rounded-e":[{"rounded-e":Ie()}],"rounded-t":[{"rounded-t":Ie()}],"rounded-r":[{"rounded-r":Ie()}],"rounded-b":[{"rounded-b":Ie()}],"rounded-l":[{"rounded-l":Ie()}],"rounded-ss":[{"rounded-ss":Ie()}],"rounded-se":[{"rounded-se":Ie()}],"rounded-ee":[{"rounded-ee":Ie()}],"rounded-es":[{"rounded-es":Ie()}],"rounded-tl":[{"rounded-tl":Ie()}],"rounded-tr":[{"rounded-tr":Ie()}],"rounded-br":[{"rounded-br":Ie()}],"rounded-bl":[{"rounded-bl":Ie()}],"border-w":[{border:me()}],"border-w-x":[{"border-x":me()}],"border-w-y":[{"border-y":me()}],"border-w-s":[{"border-s":me()}],"border-w-e":[{"border-e":me()}],"border-w-bs":[{"border-bs":me()}],"border-w-be":[{"border-be":me()}],"border-w-t":[{"border-t":me()}],"border-w-r":[{"border-r":me()}],"border-w-b":[{"border-b":me()}],"border-w-l":[{"border-l":me()}],"divide-x":[{"divide-x":me()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":me()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...Pe(),"hidden","none"]}],"divide-style":[{divide:[...Pe(),"hidden","none"]}],"border-color":[{border:ee()}],"border-color-x":[{"border-x":ee()}],"border-color-y":[{"border-y":ee()}],"border-color-s":[{"border-s":ee()}],"border-color-e":[{"border-e":ee()}],"border-color-bs":[{"border-bs":ee()}],"border-color-be":[{"border-be":ee()}],"border-color-t":[{"border-t":ee()}],"border-color-r":[{"border-r":ee()}],"border-color-b":[{"border-b":ee()}],"border-color-l":[{"border-l":ee()}],"divide-color":[{divide:ee()}],"outline-style":[{outline:[...Pe(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Ue,ce,le]}],"outline-w":[{outline:["",Ue,Pa,Zo]}],"outline-color":[{outline:ee()}],shadow:[{shadow:["","none",h,hI,uI]}],"shadow-color":[{shadow:ee()}],"inset-shadow":[{"inset-shadow":["none",p,hI,uI]}],"inset-shadow-color":[{"inset-shadow":ee()}],"ring-w":[{ring:me()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:ee()}],"ring-offset-w":[{"ring-offset":[Ue,Zo]}],"ring-offset-color":[{"ring-offset":ee()}],"inset-ring-w":[{"inset-ring":me()}],"inset-ring-color":[{"inset-ring":ee()}],"text-shadow":[{"text-shadow":["none",m,hI,uI]}],"text-shadow-color":[{"text-shadow":ee()}],opacity:[{opacity:[Ue,ce,le]}],"mix-blend":[{"mix-blend":[...wt(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":wt()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Ue]}],"mask-image-linear-from-pos":[{"mask-linear-from":ze()}],"mask-image-linear-to-pos":[{"mask-linear-to":ze()}],"mask-image-linear-from-color":[{"mask-linear-from":ee()}],"mask-image-linear-to-color":[{"mask-linear-to":ee()}],"mask-image-t-from-pos":[{"mask-t-from":ze()}],"mask-image-t-to-pos":[{"mask-t-to":ze()}],"mask-image-t-from-color":[{"mask-t-from":ee()}],"mask-image-t-to-color":[{"mask-t-to":ee()}],"mask-image-r-from-pos":[{"mask-r-from":ze()}],"mask-image-r-to-pos":[{"mask-r-to":ze()}],"mask-image-r-from-color":[{"mask-r-from":ee()}],"mask-image-r-to-color":[{"mask-r-to":ee()}],"mask-image-b-from-pos":[{"mask-b-from":ze()}],"mask-image-b-to-pos":[{"mask-b-to":ze()}],"mask-image-b-from-color":[{"mask-b-from":ee()}],"mask-image-b-to-color":[{"mask-b-to":ee()}],"mask-image-l-from-pos":[{"mask-l-from":ze()}],"mask-image-l-to-pos":[{"mask-l-to":ze()}],"mask-image-l-from-color":[{"mask-l-from":ee()}],"mask-image-l-to-color":[{"mask-l-to":ee()}],"mask-image-x-from-pos":[{"mask-x-from":ze()}],"mask-image-x-to-pos":[{"mask-x-to":ze()}],"mask-image-x-from-color":[{"mask-x-from":ee()}],"mask-image-x-to-color":[{"mask-x-to":ee()}],"mask-image-y-from-pos":[{"mask-y-from":ze()}],"mask-image-y-to-pos":[{"mask-y-to":ze()}],"mask-image-y-from-color":[{"mask-y-from":ee()}],"mask-image-y-to-color":[{"mask-y-to":ee()}],"mask-image-radial":[{"mask-radial":[ce,le]}],"mask-image-radial-from-pos":[{"mask-radial-from":ze()}],"mask-image-radial-to-pos":[{"mask-radial-to":ze()}],"mask-image-radial-from-color":[{"mask-radial-from":ee()}],"mask-image-radial-to-color":[{"mask-radial-to":ee()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":P()}],"mask-image-conic-pos":[{"mask-conic":[Ue]}],"mask-image-conic-from-pos":[{"mask-conic-from":ze()}],"mask-image-conic-to-pos":[{"mask-conic-to":ze()}],"mask-image-conic-from-color":[{"mask-conic-from":ee()}],"mask-image-conic-to-color":[{"mask-conic-to":ee()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:T()}],"mask-repeat":[{mask:U()}],"mask-size":[{mask:te()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",ce,le]}],filter:[{filter:["","none",ce,le]}],blur:[{blur:tt()}],brightness:[{brightness:[Ue,ce,le]}],contrast:[{contrast:[Ue,ce,le]}],"drop-shadow":[{"drop-shadow":["","none",y,hI,uI]}],"drop-shadow-color":[{"drop-shadow":ee()}],grayscale:[{grayscale:["",Ue,ce,le]}],"hue-rotate":[{"hue-rotate":[Ue,ce,le]}],invert:[{invert:["",Ue,ce,le]}],saturate:[{saturate:[Ue,ce,le]}],sepia:[{sepia:["",Ue,ce,le]}],"backdrop-filter":[{"backdrop-filter":["","none",ce,le]}],"backdrop-blur":[{"backdrop-blur":tt()}],"backdrop-brightness":[{"backdrop-brightness":[Ue,ce,le]}],"backdrop-contrast":[{"backdrop-contrast":[Ue,ce,le]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Ue,ce,le]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ue,ce,le]}],"backdrop-invert":[{"backdrop-invert":["",Ue,ce,le]}],"backdrop-opacity":[{"backdrop-opacity":[Ue,ce,le]}],"backdrop-saturate":[{"backdrop-saturate":[Ue,ce,le]}],"backdrop-sepia":[{"backdrop-sepia":["",Ue,ce,le]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":Z()}],"border-spacing-x":[{"border-spacing-x":Z()}],"border-spacing-y":[{"border-spacing-y":Z()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",ce,le]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Ue,"initial",ce,le]}],ease:[{ease:["linear","initial",O,ce,le]}],delay:[{delay:[Ue,ce,le]}],animate:[{animate:["none",E,ce,le]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[S,ce,le]}],"perspective-origin":[{"perspective-origin":Q()}],rotate:[{rotate:z()}],"rotate-x":[{"rotate-x":z()}],"rotate-y":[{"rotate-y":z()}],"rotate-z":[{"rotate-z":z()}],scale:[{scale:ve()}],"scale-x":[{"scale-x":ve()}],"scale-y":[{"scale-y":ve()}],"scale-z":[{"scale-z":ve()}],"scale-3d":["scale-3d"],skew:[{skew:Re()}],"skew-x":[{"skew-x":Re()}],"skew-y":[{"skew-y":Re()}],transform:[{transform:[ce,le,"","none","gpu","cpu"]}],"transform-origin":[{origin:Q()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Ze()}],"translate-x":[{"translate-x":Ze()}],"translate-y":[{"translate-y":Ze()}],"translate-z":[{"translate-z":Ze()}],"translate-none":["translate-none"],zoom:[{zoom:[Bi,ce,le]}],accent:[{accent:ee()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:ee()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",ce,le]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":ee()}],"scrollbar-track-color":[{"scrollbar-track":ee()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":Z()}],"scroll-mx":[{"scroll-mx":Z()}],"scroll-my":[{"scroll-my":Z()}],"scroll-ms":[{"scroll-ms":Z()}],"scroll-me":[{"scroll-me":Z()}],"scroll-mbs":[{"scroll-mbs":Z()}],"scroll-mbe":[{"scroll-mbe":Z()}],"scroll-mt":[{"scroll-mt":Z()}],"scroll-mr":[{"scroll-mr":Z()}],"scroll-mb":[{"scroll-mb":Z()}],"scroll-ml":[{"scroll-ml":Z()}],"scroll-p":[{"scroll-p":Z()}],"scroll-px":[{"scroll-px":Z()}],"scroll-py":[{"scroll-py":Z()}],"scroll-ps":[{"scroll-ps":Z()}],"scroll-pe":[{"scroll-pe":Z()}],"scroll-pbs":[{"scroll-pbs":Z()}],"scroll-pbe":[{"scroll-pbe":Z()}],"scroll-pt":[{"scroll-pt":Z()}],"scroll-pr":[{"scroll-pr":Z()}],"scroll-pb":[{"scroll-pb":Z()}],"scroll-pl":[{"scroll-pl":Z()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",ce,le]}],fill:[{fill:["none",...ee()]}],"stroke-w":[{stroke:[Ue,Pa,Zo,u2]}],stroke:[{stroke:["none",...ee()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}});function La(...n){return wee(n2(n))}const xee=Fu("group/alert relative grid w-full gap-0.5 rounded-lg border px-2.5 py-2 text-left text-sm has-data-[slot=alert-action]:relative has-data-[slot=alert-action]:pr-18 has-[>svg]:grid-cols-[auto_1fr] has-[>svg]:gap-x-2 *:[svg]:row-span-2 *:[svg]:translate-y-0.5 *:[svg]:text-current *:[svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"bg-card text-destructive *:data-[slot=alert-description]:text-destructive/90 *:[svg]:text-current"}},defaultVariants:{variant:"default"}});function Ku({className:n,variant:e,...t}){return f.jsx("div",{"data-slot":"alert",role:"alert",className:La(xee({variant:e}),n),...t})}function Wu({className:n,...e}){return f.jsx("div",{"data-slot":"alert-title",className:La("font-medium group-has-[>svg]/alert:col-start-2 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground",n),...e})}function Qu({className:n,...e}){return f.jsx("div",{"data-slot":"alert-description",className:La("text-sm text-balance text-muted-foreground md:text-pretty [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-4",n),...e})}var See=Object.defineProperty,Xu=(n,e)=>See(n,"name",{value:e,configurable:!0});function $u(n,e){if(typeof n=="function")return n(e);n!=null&&(n.current=e)}Xu($u,"setRef");function S2(...n){return e=>{let t=!1;const i=n.map(o=>{const r=$u(o,e);return!t&&typeof r=="function"&&(t=!0),r});if(t)return()=>{for(let o=0;oEee(n,"name",{value:e,configurable:!0});function T2(n){const e=L.forwardRef((t,i)=>{let{children:o,...r}=t,A=null,I=!1;const l=[];qu(o)&&typeof fI=="function"&&(o=fI(o._payload)),L.Children.forEach(o,m=>{if(z2(m)){I=!0;const y=m;let w="child"in y.props?y.props.child:y.props.children;qu(w)&&typeof fI=="function"&&(w=fI(w._payload)),A=Oee(y,w),l.push(A?.props?.children)}else l.push(m)}),A?A=L.cloneElement(A,void 0,l):!I&&L.Children.count(o)===1&&L.isValidElement(o)&&(A=o);const c=A?M2(A):void 0,h=E2(i,c);if(!A){if(o||o===0)throw new Error(I?Mee(n):Dee(n));return o}const p=D2(r,A.props??{});return A.type!==L.Fragment&&(p.ref=i?h:c),L.cloneElement(A,p)});return e.displayName=`${n}.Slot`,e}xi(T2,"createSlot");var O2=T2("Slot"),N2=Symbol.for("radix.slottable");function Tee(n){const e=xi(t=>"child"in t?t.children(t.child):t.children,"Slottable");return e.displayName=`${n}.Slottable`,e.__radixId=N2,e}xi(Tee,"createSlottable");var Oee=xi((n,e)=>{if("child"in n.props){const t=n.props.child;return L.isValidElement(t)?L.cloneElement(t,void 0,n.props.children(t.props.children)):null}return L.isValidElement(e)?e:null},"getSlottableElementFromSlottable");function D2(n,e){const t={...e};for(const i in e){const o=n[i],r=e[i];/^on[A-Z]/.test(i)?o&&r?t[i]=(...I)=>{const l=r(...I);return o(...I),l}:o&&(t[i]=o):i==="style"?t[i]={...o,...r}:i==="className"&&(t[i]=[o,r].filter(Boolean).join(" "))}return{...n,...t}}xi(D2,"mergeProps");function M2(n){let e=Object.getOwnPropertyDescriptor(n.props,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning;return t?n.ref:(e=Object.getOwnPropertyDescriptor(n,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning,t?n.props.ref:n.props.ref||n.ref)}xi(M2,"getElementRef");function z2(n){return L.isValidElement(n)&&typeof n.type=="function"&&"__radixId"in n.type&&n.type.__radixId===N2}xi(z2,"isSlottable");var Nee=Symbol.for("react.lazy");function qu(n){return n!=null&&typeof n=="object"&&"$$typeof"in n&&n.$$typeof===Nee&&"_payload"in n&&k2(n._payload)}xi(qu,"isLazyComponent");function k2(n){return typeof n=="object"&&n!==null&&"then"in n}xi(k2,"isPromiseLike");var Dee=xi(n=>`${n} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),Mee=xi(n=>`${n} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),fI=RR[" use ".trim().toString()];const zee=Fu("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",destructive:"bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",outline:"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",ghost:"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",link:"text-primary underline-offset-4 hover:underline"}},defaultVariants:{variant:"default"}});function Fg({className:n,variant:e="default",asChild:t=!1,...i}){const o=t?O2:"span";return f.jsx(o,{"data-slot":"badge","data-variant":e,className:La(zee({variant:e}),n),...i})}const kee=Fu("group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/80",outline:"border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",ghost:"hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",destructive:"bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",xs:"h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",lg:"h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",icon:"size-8","icon-xs":"size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg","icon-lg":"size-9"}},defaultVariants:{variant:"default",size:"default"}});function Ju({className:n,variant:e="default",size:t="default",asChild:i=!1,...o}){const r=i?O2:"button";return f.jsx(r,{"data-slot":"button","data-variant":e,"data-size":t,className:La(kee({variant:e,size:t,className:n})),...o})}const eh={resolved:0,inferred:1,ambiguous:2,unresolved:3};function Ree({graph:n,host:e}){const t=new Map,i=_ee(n);for(const r of n.edges){const A=t.get(r.target);(!A||eh[r.resolution]>eh[A])&&t.set(r.target,r.resolution)}const o={schema:"compass.viewer.graph/1",title:`Calls from ${n.nodes.find(r=>r.id===n.rootSymbol)?.name??n.rootSymbol}`,stats:{nodes:n.nodes.length,edges:n.edges.length,communities:4,aggregated:!1},nodes:n.nodes.map(r=>({id:r.id,label:r.name,kind:r.unresolved?"Unresolved call":"Function",community:eh[t.get(r.id)??"resolved"],communityName:t.get(r.id)??"resolved",depth:i.get(r.id),root:r.id===n.rootSymbol,source:jee(r)})),edges:n.edges.map(r=>({id:r.id,source:r.source,target:r.target,relation:`${r.callee} · ${r.resolution}`,confidence:r.resolution==="resolved"?"extracted":r.resolution==="inferred"?"inferred":"ambiguous"})),communities:[{id:0,label:"Resolved",color:"#59A14F",hidden:!1},{id:1,label:"Inferred",color:"#4E79A7",hidden:!1},{id:2,label:"Ambiguous",color:"#F28E2B",hidden:!1},{id:3,label:"Unresolved",color:"#E15759",hidden:!1}],hyperedges:[]};return f.jsx(Zu,{model:o,host:e,preferredLayout:"hierarchical"})}function _ee(n){const e=new Map;for(const o of n.edges){const r=e.get(o.source)??[];r.push(o.target),e.set(o.source,r);const A=e.get(o.target)??[];A.push(o.source),e.set(o.target,A)}const t=new Map([[n.rootSymbol,0]]),i=[n.rootSymbol];for(;i.length>0;){const o=i.shift();if(o===void 0)break;const r=t.get(o)??0;for(const A of e.get(o)??[])t.has(A)||(t.set(A,r+1),i.push(A))}return t}function jee(n){if(n.anchor)return{file:n.anchor.source_file,startByte:n.anchor.start_byte,endByte:n.anchor.end_byte};if(n.file)return{file:n.file,...n.startLine!=null?{startLine:n.startLine}:{},...n.endLine!=null?{endLine:n.endLine}:{},...n.startByte!=null?{startByte:n.startByte}:{},...n.endByte!=null?{endByte:n.endByte}:{}}}function Zee({coverage:n}){return!n.partial&&n.unresolved===0&&n.ambiguous===0?null:f.jsxs(Ku,{children:[f.jsx(Wu,{children:"Partial call coverage"}),f.jsx(Qu,{children:n.warning})]})}function Bee({graph:n,host:e}){const[t,i]=L.useState(!1),o=t?n.continuations:n.continuations.slice(0,20),r=n.direction==="callers"?"No callers found":n.direction==="callees"?"No callees found":"No calls found";return f.jsxs("div",{className:"call-graph-view relative h-screen",children:[f.jsx(Ree,{graph:n,host:e}),f.jsx("div",{className:"call-graph-direction absolute top-2 left-1/2 z-20 flex -translate-x-1/2 gap-1 rounded-md border bg-popover/95 p-1 shadow-lg backdrop-blur",role:"group","aria-label":"Call graph direction",children:[["callers","Callers"],["both","Both"],["callees","Callees"]].map(([A,I])=>f.jsx(Ju,{size:"sm",variant:n.direction===A?"secondary":"ghost","aria-pressed":n.direction===A,disabled:!e.changeDirection,onClick:()=>{n.direction!==A&&e.changeDirection?.(A)},children:I},A))}),f.jsxs("section",{className:"call-graph-summary absolute bottom-3 left-3 z-20 flex max-w-[min(44rem,calc(100%-1.5rem))] flex-col gap-2 rounded-md border bg-popover/95 p-3 text-popover-foreground shadow-xl backdrop-blur",children:[f.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[f.jsxs(Fg,{variant:"outline",children:[f.jsx(ac,{})," depth ",n.depth]}),f.jsxs(Fg,{variant:"outline",children:[n.nodes.length," ",n.nodes.length===1?"node":"nodes"]}),f.jsxs(Fg,{variant:"outline",children:[n.edges.length," ",n.edges.length===1?"edge":"edges"]}),f.jsxs(Fg,{variant:"secondary",children:[n.coverage.resolved," resolved"]}),f.jsxs(Fg,{variant:"outline",children:[n.coverage.inferred," inferred"]}),f.jsxs(Fg,{variant:"outline",children:[n.coverage.ambiguous," ambiguous"]}),f.jsxs(Fg,{variant:"destructive",children:[n.coverage.unresolved," unresolved"]}),n.coverage.evidenceLayer&&f.jsx(Fg,{variant:"outline",children:Pee(n.coverage.evidenceLayer)})]}),n.edges.length===0&&f.jsxs(Ku,{children:[f.jsx(Wu,{children:r}),f.jsx(Qu,{children:"Compass found the root function but no represented relationships in this direction."})]}),n.truncated&&f.jsxs(Ku,{children:[f.jsx(HA,{}),f.jsx(Wu,{children:"Partial call graph"}),f.jsx(Qu,{children:"Compass reached the configured graph limit. Counts and paths may be incomplete."})]}),f.jsx(Zee,{coverage:n.coverage}),n.continuations.length>0&&f.jsxs("div",{children:[f.jsx("div",{className:"flex max-h-24 flex-wrap gap-1 overflow-auto","aria-label":"Call graph continuations",children:o.map(A=>f.jsxs(Ju,{size:"xs",variant:"outline",disabled:!e.expand,onClick:()=>e.expand?.(A.symbol,A.direction,A.nextDepth),children:[A.direction==="callers"?f.jsx(VR,{}):A.direction==="callees"?f.jsx(LR,{}):f.jsx(Ym,{}),"Expand ",A.direction]},`${A.symbol}:${A.direction}:${A.nextDepth}`))}),!t&&n.continuations.length>o.length&&f.jsxs("div",{className:"mt-2 flex flex-wrap items-center justify-between gap-2",children:[f.jsxs("p",{className:"text-xs text-muted-foreground",role:"status",children:["Showing ",o.length," of ",n.continuations.length," continuations"]}),f.jsxs(Ju,{size:"xs",variant:"outline",onClick:()=>i(!0),children:["Show all ",n.continuations.length," continuations"]})]})]})]})]})}function Pee(n){return n.split("_").map((e,t)=>t===0?`${e.slice(0,1).toUpperCase()}${e.slice(1)}`:e).join(" ")}const R2=0;function Lee(n,e){const t=new Set(n.nodes.map(l=>l.id)),i=n.edges.filter(l=>t.has(l.source)&&t.has(l.target)).map(Fee),o=new Map;for(const l of i)o.set(l.source,(o.get(l.source)??0)+1),o.set(l.target,(o.get(l.target)??0)+1);const r=Uee(n),A=new Set(n.paths.flatMap(l=>l.nodeIds.slice(0,1))),I=n.nodes.map(l=>Gee(l,o.get(l.id)??0,r.get(l.id),A.has(l.id)));return{schema:"compass.viewer.graph/1",title:e,stats:{nodes:I.length,edges:i.length,communities:I.length>0?1:0,aggregated:!1},nodes:I,edges:i,communities:I.length>0?[{id:R2,label:"Query result",color:"#6f7bf7",hidden:!1}]:[],hyperedges:[]}}function Gee(n,e,t,i){const o=n.details?.type==="symbol"?n.details.data.signature??void 0:void 0;return{id:n.id,label:n.name,kind:n.kind,community:R2,communityName:"Query result",degree:e,...t!==void 0?{depth:t}:{},...i?{root:!0}:{},...n.language?{language:n.language}:{},...o?{signature:o}:{},...n.source?{source:n.source}:{},codeEvidence:n.evidence}}function Fee(n){const e=Vee(n);return{id:n.id,source:n.source,target:n.target,relation:n.kind,...n.relationshipSite?{relationshipSite:n.relationshipSite}:{},...n.details?{details:n.details}:{},...e?{confidence:e}:{},codeEvidence:n.evidence}}function Vee(n){return n.evidence.some(e=>e.confidence==="ambiguous")?"ambiguous":n.evidence.some(e=>e.confidence==="inferred")?"inferred":n.evidence.length>0?"extracted":void 0}function Uee(n){const e=new Map;for(const t of n.paths)t.nodeIds.forEach((i,o)=>{const r=e.get(i);(r===void 0||o[x.id,x])),i=new Map(e.nodes.map(x=>[x.id,x])),o=new Map,r=[],A=_2(i,t),I=_2(t,i),l=new Map(Hee(i,t).map(x=>[x,$m(t.get(x),i.get(x),"node")])),c=[...l.entries()].filter(([,x])=>x.fields.length>0).map(([x])=>x),h=Wee(n.edges,e.edges),p=h.matched.map(({before:x,after:O})=>({before:x,after:O,evidence:Kee(x,O)})).filter(({evidence:x})=>x.fields.length>0);for(const x of A)th(o,i.get(x),"added",KA(void 0,i.get(x)));for(const x of I)th(o,t.get(x),"removed",KA(t.get(x),void 0));for(const x of c)th(o,i.get(x),"changed",l.get(x));for(const x of h.added)r.push({...x,change:"added",evidence:KA(void 0,x)}),nh(o,x,t,i);for(const x of h.removed)r.push({...x,change:"removed",evidence:KA(x,void 0)}),nh(o,x,t,i);for(const{after:x,evidence:O}of p)r.push({...x,change:"changed",evidence:O}),nh(o,x,t,i);const m=[...o.values()].sort((x,O)=>x.id.localeCompare(O.id));r.sort((x,O)=>x.id.localeCompare(O.id));const y=Qee(r),w=new Set(m.map(x=>x.community)),S=[...e.communities,...n.communities.filter(x=>!e.communities.some(O=>O.id===x.id))].filter(x=>w.has(x.id));return{addedNodes:A.length,removedNodes:I.length,changedNodes:c.length,addedEdges:h.added.length,removedEdges:h.removed.length,changedEdges:p.length,graph:{...e,title:`Graph delta · ${e.title}`,stats:{...e.stats,nodes:m.length,edges:y.length,communities:S.length,aggregated:n.stats.aggregated||e.stats.aggregated},nodes:m,edges:y,communities:S,hyperedges:[]}}}function _2(n,e){return[...n.keys()].filter(t=>!e.has(t))}function Hee(n,e){return[...n.keys()].filter(t=>e.has(t))}function th(n,e,t,i){e&&n.set(e.id,{...e,change:t,...i?{evidence:i}:{}})}function j2(n,e,t,i){if(n.has(e))return;const o=i.get(e)??t.get(e);o&&n.set(e,{...o,change:"unchanged"})}function nh(n,e,t,i){j2(n,e.source,t,i),j2(n,e.target,t,i)}function Kee(n,e){return $m({...n,id:e.id},e,"edge")}function Wee(n,e){const t=new Set,i=new Set,o=[],r=(I,l)=>{t.add(I),i.add(l),o.push({before:n[I],after:e[l]})};Z2(n,e,t,i,r,I=>mI(I.id)?void 0:I.id),Z2(n,e,t,i,r,I=>mI(I.id)?ih(I):void 0);const A=new Map;n.forEach((I,l)=>{if(t.has(l)||!mI(I.id))return;const c=A.get(pI(I))??{parent:[],current:[]};c.parent.push(l),A.set(pI(I),c)}),e.forEach((I,l)=>{if(i.has(l)||!mI(I.id))return;const c=A.get(pI(I))??{parent:[],current:[]};c.current.push(l),A.set(pI(I),c)});for(const I of A.values()){I.parent.sort((c,h)=>B2(n[c],n[h])),I.current.sort((c,h)=>B2(e[c],e[h]));const l=Math.min(I.parent.length,I.current.length);for(let c=0;c!i.has(l)),removed:n.filter((I,l)=>!t.has(l))}}function Z2(n,e,t,i,o,r){const A=new Map;e.forEach((I,l)=>{if(i.has(l))return;const c=r(I);if(c===void 0)return;const h=A.get(c)??[];h.push(l),A.set(c,h)}),n.forEach((I,l)=>{if(t.has(l))return;const c=r(I);if(c===void 0)return;const p=A.get(c)?.shift();p!==void 0&&o(l,p)})}function ih(n){return JSON.stringify(f3(n,"edge"))}function pI(n){return JSON.stringify([n.source,n.target,n.relation])}function B2(n,e){return ih(n).localeCompare(ih(e))||n.id.localeCompare(e.id)}function mI(n){return/^edge-\d+-/.test(n)}function Qee(n){const e=new Map;return n.map(t=>{const i=e.get(t.id)??0;return e.set(t.id,i+1),i===0?t:{...t,id:`${t.id}::${t.change}-${i}`}})}function Xee({workbench:n,host:e,communityDetail:t,communityLoading:i,communityError:o,onBackToOverview:r,initialInspectorLayout:A,onInspectorLayoutChange:I}){const[l,c]=L.useState(()=>L2(n)??n.defaultView),[h,p]=L.useState(!1),m=n.views.find(w=>w.id===l)??n.views[0];L.useEffect(()=>{const w=()=>{const S=L2(n);S&&c(S)};return window.addEventListener("hashchange",w),()=>window.removeEventListener("hashchange",w)},[n]);const y=w=>{c(w);const S=`view=${encodeURIComponent(w)}`;window.location.hash.slice(1)!==S&&(window.location.hash=S)};return m?f.jsxs("div",{className:"visualization-workbench","data-navigation-collapsed":h,children:[f.jsxs("aside",{className:"visualization-rail","data-collapsed":h,"aria-label":"Compass navigation",children:[f.jsxs("header",{children:[f.jsx("span",{className:"visualization-bearing","aria-hidden":"true",children:f.jsx(c3,{})}),f.jsxs("span",{children:[f.jsx("strong",{children:"Compass"}),f.jsx("small",{title:n.title,children:n.title})]}),f.jsx("button",{className:"visualization-rail-disclosure",type:"button","aria-label":h?"Expand graph navigation":"Collapse graph navigation",title:h?"Expand graph navigation":"Collapse graph navigation",onClick:()=>p(w=>!w),children:h?f.jsx(g3,{"aria-hidden":"true"}):f.jsx(i3,{"aria-hidden":"true"})})]}),f.jsx("nav",{"aria-label":"Graph views",children:n.views.map(w=>f.jsxs("button",{type:"button","aria-current":w.id===m.id?"page":void 0,onClick:()=>y(w.id),children:[f.jsx(nte,{view:w}),f.jsxs("span",{children:[f.jsx("strong",{children:w.title}),f.jsx("small",{children:w.description})]}),f.jsx("i",{"data-status":w.coverage.status,title:`${w.coverage.status} view`})]},w.id))}),f.jsxs("footer",{children:[f.jsx("span",{children:"Snapshot"}),f.jsx("code",{children:ite(n.graphIdentity)})]})]}),f.jsxs("main",{className:"visualization-main",children:[f.jsxs("header",{className:"visualization-context",children:[f.jsxs("div",{children:[f.jsx("span",{children:gte(m)}),f.jsx("strong",{children:m.title})]}),f.jsxs("div",{className:"visualization-coverage","data-status":m.coverage.status,children:[m.kind!=="call"&&f.jsxs(f.Fragment,{children:[f.jsxs("span",{children:[m.coverage.nodes.toLocaleString()," nodes"]}),f.jsxs("span",{children:[m.coverage.edges.toLocaleString()," relationships"]})]}),f.jsx("strong",{children:ote(m)})]})]}),f.jsx("section",{className:"visualization-stage","aria-label":`${m.title} visualization`,children:f.jsx($ee,{view:m,host:e,communityDetail:t,communityLoading:i,communityError:o,onBackToOverview:r,initialInspectorLayout:A,onInspectorLayoutChange:I},m.id)})]})]}):null}function $ee({view:n,host:e,communityDetail:t,communityLoading:i,communityError:o,onBackToOverview:r,initialInspectorLayout:A,onInspectorLayoutChange:I}){if(n.kind==="call")return f.jsx(Bee,{graph:n.graph,host:{openSource:e.openSource,...e.expandCall?{expand:e.expandCall}:{},...e.changeCallDirection?{changeDirection:e.changeCallDirection}:{}}});if(n.kind==="architecture")return f.jsx(qee,{model:n.model,host:e});if(n.kind==="impact")return f.jsx(gh,{model:Lee(n.result,n.title),host:e,queryResult:n.result,preferredLayout:"hierarchical"});if(n.kind==="history"){const c=Yee(n.before,n.after);return f.jsxs("div",{className:"workbench-history-view",children:[f.jsxs("div",{className:"workbench-history-banner",children:[f.jsx(Gm,{"aria-hidden":"true"}),f.jsxs("span",{children:[f.jsxs("strong",{children:[n.baseRevision," → ",n.targetRevision]}),f.jsxs("small",{children:["+",c.addedNodes," / −",c.removedNodes," / Δ",c.changedNodes," nodes"]})]})]}),f.jsx(gh,{model:c.graph,host:e,preferredLayout:"grid",sourceRevisions:{before:n.baseRevision,after:n.targetRevision}})]})}const l=n.kind==="affected"?"hierarchical":n.kind==="artifact"?n.lens==="routes"?"hierarchical":"grid":"automatic";return f.jsx(gh,{model:n.model,host:e,preferredLayout:l,communityDetails:n.kind==="code"?n.communityDetails:void 0,communityDetail:n.kind==="code"?t:void 0,communityLoading:n.kind==="code"?i:void 0,communityError:n.kind==="code"?o:void 0,onBackToOverview:n.kind==="code"?r:void 0,initialInspectorLayout:A,onInspectorLayoutChange:I})}function gh({model:n,host:e,queryResult:t,sourceRevisions:i,preferredLayout:o,communityDetails:r,communityDetail:A,communityLoading:I,communityError:l,onBackToOverview:c,initialInspectorLayout:h,onInspectorLayoutChange:p}){const[m,y]=L.useState(""),[w,S]=L.useState(""),[x,O]=L.useState(""),[E,_]=L.useState(""),[P,Q]=L.useState(),[ne,F]=L.useState(!1),Z=L.useId(),de=L.useRef(null),fe=L.useRef(null),Ne=(P===void 0?void 0:{communityId:P,model:r?.[String(P)]??n})??A,je=Ne?.model??n,qe=Ne?`community-${Ne.communityId}`:"overview",Ae=L.useMemo(()=>Jee(je),[je]),M=L.useMemo(()=>ete(je,{relation:m,evidence:w,kind:x,language:E}),[je,w,x,E,m]);L.useEffect(()=>{y(""),S(""),O(""),_(""),F(!1)},[qe]),L.useEffect(()=>{if(!ne)return;const T=te=>{te.key==="Escape"&&(F(!1),de.current?.focus())},U=te=>{const ae=te.target;de.current?.contains(ae)||fe.current?.contains(ae)||F(!1)};return document.addEventListener("keydown",T),document.addEventListener("pointerdown",U),()=>{document.removeEventListener("keydown",T),document.removeEventListener("pointerdown",U)}},[ne]);const W=L.useCallback(()=>{y(""),S(""),O(""),_("")},[]),V=L.useCallback(()=>F(!1),[]),se=[m,w,x,E].filter(Boolean).length,ee=se>0&&M.nodes.length===0;return f.jsx("div",{className:"workbench-graph-lens",children:f.jsx(Zu,{model:Ne?n:M,communityDetail:Ne?{...Ne,model:M}:void 0,communityLoading:I,communityError:l,onBackToOverview:P===void 0?c:()=>Q(void 0),initialInspectorLayout:h,onInspectorLayoutChange:p,host:{...e,openCommunity:T=>{r?.[String(T)]?Q(T):e.openCommunity?.(T)}},queryResult:t,sourceRevisions:i,showInspectorHeader:!1,preferredLayout:o,toolbarLeading:f.jsxs("button",{ref:de,className:"workbench-filter-trigger",type:"button","aria-label":"Graph filters","aria-expanded":ne,"aria-controls":Z,onClick:()=>F(T=>!T),children:[f.jsx(I3,{"aria-hidden":"true"}),f.jsx("span",{children:"Filters"}),se>0?f.jsx("b",{children:se}):null,f.jsxs("small",{children:[M.nodes.length.toLocaleString()," / ",je.nodes.length.toLocaleString()]})]}),toolbarLeadingPanel:ne?f.jsxs("div",{ref:fe,id:Z,className:"workbench-filter-popover",role:"region","aria-label":"Graph filter options",children:[f.jsxs("header",{children:[f.jsxs("span",{children:[f.jsx("strong",{children:"Filter graph"}),f.jsx("small",{children:"Refine visible nodes and relationships"})]}),f.jsx("button",{type:"button",disabled:se===0,onClick:W,children:"Clear filters"})]}),f.jsx(Vs,{label:"Relationship",value:m,values:Ae.relations,onChange:y}),f.jsx(Vs,{label:"Evidence",value:w,values:Ae.evidence,onChange:S}),f.jsx(Vs,{label:"Node kind",value:x,values:Ae.kinds,onChange:O}),f.jsx(Vs,{label:"Language",value:E,values:Ae.languages,onChange:_}),f.jsx("footer",{role:"status",children:ee?"No nodes match these filters":`Showing ${M.nodes.length.toLocaleString()} of ${je.nodes.length.toLocaleString()} nodes`})]}):void 0,toolbarLeadingOpen:ne,onToolbarLeadingClose:V,stageOverlay:je.nodes.length===0?f.jsx(P2,{title:"This view has no graph nodes",detail:"The exported graph lens did not contain any nodes to visualize."}):ee&&!ne?f.jsx(P2,{title:"No nodes match these filters",detail:"Clear one or more filters to restore the graph.",onClear:W}):void 0})})}function P2({title:n,detail:e,onClear:t}){return f.jsxs("div",{className:"workbench-graph-empty",role:"status",children:[f.jsx(Ac,{"aria-hidden":"true"}),f.jsx("strong",{children:n}),f.jsx("span",{children:e}),t?f.jsx("button",{type:"button",onClick:t,children:"Clear filters"}):null]})}function Vs({label:n,value:e,values:t,onChange:i}){return f.jsxs("label",{children:[f.jsx("span",{children:n}),f.jsxs("select",{value:e,onChange:o=>i(o.target.value),children:[f.jsx("option",{value:"",children:"All"}),t.map(o=>f.jsx("option",{value:o,children:oh(o)},o))]})]})}function qee({model:n,host:e}){const[t,i]=L.useState("production"),[o,r]=L.useState("all"),A=L.useMemo(()=>tte(n,t,o),[o,n,t]),I=A.sections.find(m=>m.nodeCount>0),[l,c]=L.useState(I?{kind:"section",id:I.id}:void 0),h=l?.kind==="section"?n.sections.find(m=>m.id===l.id):void 0,p=l?.kind==="route"?A.routes.find(m=>m.id===l.id):void 0;return f.jsxs("div",{className:"workbench-architecture",children:[f.jsxs("div",{className:"workbench-filter-strip","aria-label":"Architecture filters",children:[f.jsx(Vs,{label:"Source scope",value:t,values:["production","all"],onChange:m=>i(m)}),f.jsx(Vs,{label:"Evidence",value:o,values:["all","extracted","inferred","ambiguous"],onChange:m=>r(m)}),f.jsxs("span",{role:"status",children:[A.statistics.visibleCalls.toLocaleString()," visible calls"]})]}),f.jsxs("div",{className:"workbench-architecture-body",children:[f.jsx(OJ,{overview:A,selection:l,onSelect:c}),f.jsx("aside",{"aria-label":"Architecture details",children:h?f.jsxs(f.Fragment,{children:[f.jsx("span",{children:"Subsystem"}),f.jsx("h2",{children:h.name}),f.jsxs("p",{children:[h.nodes.length.toLocaleString()," symbols · ",h.edges.length.toLocaleString()," internal calls"]}),f.jsx("div",{className:"workbench-symbol-list",children:h.nodes.slice(0,100).map(m=>f.jsxs("button",{type:"button",disabled:!m.sourceFile,onClick:()=>m.sourceFile&&e.openSource({file:m.sourceFile}),children:[f.jsx("strong",{children:m.label}),f.jsxs("small",{children:[m.kind,m.sourceFile?` · ${m.sourceFile}`:""]})]},m.id))})]}):p?f.jsxs(f.Fragment,{children:[f.jsx("span",{children:"Subsystem route"}),f.jsxs("h2",{children:[G2(A,p.sourceSection)," → ",G2(A,p.targetSection)]}),f.jsxs("p",{children:[p.calls.toLocaleString()," calls cross this boundary."]})]}):f.jsx("p",{children:"Select a subsystem or route."})})]})]})}function Jee(n){const e=t=>[...new Set(t.filter(i=>!!i))].sort();return{relations:e(n.edges.map(t=>t.relation)),evidence:e(n.edges.map(t=>t.confidence)),kinds:e(n.nodes.map(t=>t.kind)),languages:e(n.nodes.map(t=>t.language))}}function ete(n,e){const t=n.nodes.filter(I=>(!e.kind||I.kind===e.kind)&&(!e.language||I.language===e.language));let i=new Set(t.map(I=>I.id));const o=n.edges.filter(I=>i.has(I.source)&&i.has(I.target)&&(!e.relation||I.relation===e.relation)&&(!e.evidence||I.confidence===e.evidence));if(e.relation||e.evidence){const I=new Set(o.flatMap(l=>[l.source,l.target]));for(const l of t)l.root&&I.add(l.id);i=I}const r=t.filter(I=>i.has(I.id)),A=new Set(r.map(I=>I.community));return{...n,stats:{...n.stats,nodes:r.length,edges:o.length,communities:A.size},nodes:r,edges:o,communities:n.communities.filter(I=>A.has(I.id))}}function tte(n,e,t){const i=n.sections.filter(S=>S.id!=="overview"),o=S=>e==="all"||S==="production",r=new Map(i.flatMap(S=>S.nodes).map(S=>[S.id,S])),A=S=>(t==="all"||S.confidence===t)&&o(r.get(S.source)?.scope??"unknown")&&o(r.get(S.target)?.scope??"unknown"),I=new Map;for(const S of n.crossSectionCalls.filter(A)){const x=`${S.sourceSection}->${S.targetSection}`,O=I.get(x)??[];O.push(S),I.set(x,O)}const l=[...I.entries()].map(([S,x])=>({id:S,sourceSection:x[0].sourceSection,targetSection:x[0].targetSection,calls:x.length,extracted:x.filter(O=>O.confidence==="extracted").length,inferred:x.filter(O=>O.confidence==="inferred").length,ambiguous:x.filter(O=>O.confidence==="ambiguous").length})).sort((S,x)=>x.calls-S.calls||S.id.localeCompare(x.id)),c=new Map,h=new Map;for(const S of l)h.set(S.sourceSection,(h.get(S.sourceSection)??0)+S.calls),c.set(S.targetSection,(c.get(S.targetSection)??0)+S.calls);const p=i.map(S=>{const x={production:0,test:0,generated:0,vendor:0,unknown:0};for(const O of S.nodes)x[O.scope]+=1;return{id:S.id,name:S.name,nodeCount:S.nodes.filter(O=>o(O.scope)).length,totalNodeCount:S.nodes.length,internalCallCount:S.edges.filter(A).length,incomingCalls:c.get(S.id)??0,outgoingCalls:h.get(S.id)??0,scopes:x}}),m=p.reduce((S,x)=>S+x.nodeCount,0),y=p.reduce((S,x)=>S+x.internalCallCount,0),w=l.reduce((S,x)=>S+x.calls,0);return{title:n.title,scope:e,evidence:t,sections:p,routes:l,statistics:{visibleNodes:m,totalNodes:n.statistics.nodes,visibleCalls:y+w,totalCalls:n.statistics.edges,communities:n.statistics.communities,extracted:n.statistics.extracted,inferred:n.statistics.inferred,ambiguous:n.statistics.ambiguous},coverage:n.coverage,provenance:n.provenance}}function nte({view:n}){const e=n.kind==="code"?Ac:n.kind==="call"?ac:n.kind==="impact"?KR:n.kind==="architecture"?YR:n.kind==="history"?Gm:n.kind==="affected"?A3:n.lens==="routes"?Km:n.lens==="provenance"?HR:r3;return f.jsx(e,{"aria-hidden":"true"})}function L2(n){const e=new URLSearchParams(window.location.hash.slice(1)).get("view");return e&&n.views.some(t=>t.id===e)?e:void 0}function ite(n){const e=n.startsWith("sha256:")?n.slice(7):n;return e.length>12?e.slice(0,12):e}function gte(n){return n.kind==="artifact"?`${oh(n.lens)} lens`:`${oh(n.kind)} graph`}function ote(n){return n.coverage.status==="complete"?"Complete":n.coverage.status==="summary"?"Community summary":"Bounded result"}function oh(n){return n.replaceAll("_"," ").replace(/\b\w/g,e=>e.toUpperCase())}function G2(n,e){return n.sections.find(t=>t.id===e)?.name??e}const ste=xe({provider:ct(["github","gitlab","bitbucket"]),repositoryUrl:H().url(),revision:H().regex(/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/i)});function rte(n,e,t=n.revision){if(!ate(t))return;const i=Ate(e.file);if(!i)return;const o=n.repositoryUrl.replace(/\/$/,""),r=Cte(n.provider,e);return n.provider==="gitlab"?`${o}/-/blob/${t}/${i}${r}`:n.provider==="bitbucket"?`${o}/src/${t}/${i}${r}`:`${o}/blob/${t}/${i}${r}`}function F2(n,e,t){if(window.dispatchEvent(new CustomEvent("compass:open-source",{detail:e})),!n)return;const i=rte(n,e,t??n.revision);if(!i)return;const o=document.createElement("a");o.href=i,o.target="_blank",o.rel="noopener noreferrer",o.click()}function ate(n){return/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/i.test(n)}function Ate(n){if(!n||n.startsWith("/")||n.startsWith("\\")||n.includes("\0"))return;const e=n.replaceAll("\\","/").split("/");if(!e.some(t=>!t||t==="."||t===".."))return e.map(encodeURIComponent).join("/")}function Cte(n,e){const t=e.startLine;if(t===void 0)return"";const i=Math.max(t,e.endLine??t);return n==="gitlab"?i===t?`#L${t}`:`#L${t}-${i}`:n==="bitbucket"?i===t?`#lines-${t}`:`#lines-${t}:${i}`:i===t?`#L${t}`:`#L${t}-L${i}`}function V2(){const n=document.getElementById("compass-viewer-root"),e=document.getElementById("compass-viewer-model");if(!n||!e)throw new Error("Compass viewer root or model is missing");const t=JSON.parse(e.textContent??""),i=Ite(),o=JO.createRoot(n),r=kR.safeParse(t);if(r.success){o.render(f.jsx(Xee,{workbench:r.data,host:{openSource(m,y){F2(i,m,y)}}}));return}const A=wg.parse(t),I=new Map;let l,c=null,h;const p=()=>{o.render(f.jsx(Zu,{model:A,communityDetail:l,communityLoading:c,communityError:h,onBackToOverview:l?()=>{l=void 0,h=void 0,p()}:void 0,host:{openSource(m,y){F2(i,m,y)},openCommunity(m){c===null&&(c=m,h=void 0,p(),window.setTimeout(()=>{try{let y=I.get(m);if(!y){const w=document.querySelector(`script[data-compass-community="${m}"]`);if(!w)throw new Error(`Community ${m} detail is unavailable in this export.`);y=wg.parse(JSON.parse(w.textContent??"")),I.set(m,y)}l={communityId:m,model:y},window.dispatchEvent(new CustomEvent("compass:open-community",{detail:{communityId:m}}))}catch(y){h=y instanceof Error?y.message:String(y)}finally{c=null,p()}},0))}}}))};p()}function Ite(){const n=document.getElementById("compass-source-navigation");if(!n?.textContent)return;const e=ste.safeParse(JSON.parse(n.textContent));return e.success?e.data:void 0}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",V2,{once:!0}):V2()})(); diff --git a/crates/compass-output/assets/viewer/manifest.json b/crates/compass-output/assets/viewer/manifest.json index 255ea0c1..730a3520 100644 --- a/crates/compass-output/assets/viewer/manifest.json +++ b/crates/compass-output/assets/viewer/manifest.json @@ -3,8 +3,8 @@ "viewerSchema": "compass.viewer.graph/1", "files": { "graph.js": { - "bytes": 1068010, - "sha256": "7db353557e68e63a4d3d48450ddb17bf01d7a09242ee3f4183b9a9c44f6dfe06" + "bytes": 1068368, + "sha256": "d4aaf028cdcfe96a788d71fcc3a3d886ba3771e65466db1bf535e790144515b3" }, "viewer.css": { "bytes": 234489, diff --git a/packages/compass-viewer/src/graph/CompassGraph.tsx b/packages/compass-viewer/src/graph/CompassGraph.tsx index 49414b31..0064671c 100644 --- a/packages/compass-viewer/src/graph/CompassGraph.tsx +++ b/packages/compass-viewer/src/graph/CompassGraph.tsx @@ -315,6 +315,11 @@ function CompassGraphView({ setEdgeHover(null); dispatch({ type: "focus", nodeId }); }, []); + const pauseForInteraction = useCallback(() => { + if (state.physicsRunning) { + dispatch({ type: "setPhysics", running: false }); + } + }, [state.physicsRunning]); const clear = useCallback(() => { setHover(null); setEdgeHover(null); @@ -475,6 +480,7 @@ function CompassGraphView({ onFocus={focus} onOpenSource={activateNode} onOpenRelationshipSource={activateRelationship} + onInteractionStart={pauseForInteraction} onHover={setHover} onHoverEdge={setEdgeHover} onClear={clear} diff --git a/packages/compass-viewer/src/graph/VisNetworkCanvas.interaction.test.tsx b/packages/compass-viewer/src/graph/VisNetworkCanvas.interaction.test.tsx index 76f93451..141ffbd1 100644 --- a/packages/compass-viewer/src/graph/VisNetworkCanvas.interaction.test.tsx +++ b/packages/compass-viewer/src/graph/VisNetworkCanvas.interaction.test.tsx @@ -306,6 +306,35 @@ describe("VisNetworkCanvas hover lifecycle", () => { expect(onStabilized).toHaveBeenCalledTimes(2); }); + it("stops layout motion before publishing the stabilized canvas", () => { + const onStabilized = vi.fn(); + render(); + + const stopsBeforeStabilizing = mock.simulationStops; + for (const handler of [...mock.eventHandlers.get("stabilizationIterationsDone") ?? []]) { + handler(); + } + + expect(mock.simulationStops).toBeGreaterThan(stopsBeforeStabilizing); + expect(onStabilized).toHaveBeenCalledTimes(1); + }); + it("scales the reheat so motion stays visible when a large graph is fit", () => { const callbacks = { onFocus: vi.fn(), diff --git a/packages/compass-viewer/src/graph/VisNetworkCanvas.tsx b/packages/compass-viewer/src/graph/VisNetworkCanvas.tsx index c881315c..cfdeb8d6 100644 --- a/packages/compass-viewer/src/graph/VisNetworkCanvas.tsx +++ b/packages/compass-viewer/src/graph/VisNetworkCanvas.tsx @@ -60,6 +60,7 @@ type Props = { onFocus(nodeId: string): void; onOpenSource(nodeId: string): void; onOpenRelationshipSource(edgeId: string): void; + onInteractionStart?(): void; onHover(change: GraphHover | null): void; onHoverEdge(change: GraphEdgeHover | null): void; onClear(): void; @@ -415,6 +416,7 @@ export const VisNetworkCanvas = forwardRef( onFocus, onOpenSource, onOpenRelationshipSource, + onInteractionStart = () => undefined, onHover, onHoverEdge, onClear, @@ -430,6 +432,7 @@ export const VisNetworkCanvas = forwardRef( onFocus, onOpenSource, onOpenRelationshipSource, + onInteractionStart, onHover, onHoverEdge, onClear @@ -438,6 +441,7 @@ export const VisNetworkCanvas = forwardRef( onFocus, onOpenSource, onOpenRelationshipSource, + onInteractionStart, onHover, onHoverEdge, onClear @@ -707,11 +711,19 @@ export const VisNetworkCanvas = forwardRef( onFocus: (nodeId) => eventHandlersRef.current.onFocus(nodeId), onOpenSource: (nodeId) => eventHandlersRef.current.onOpenSource(nodeId), onOpenRelationshipSource: (edgeId) => eventHandlersRef.current.onOpenRelationshipSource(edgeId), + onInteractionStart: () => { + if (physicsRunningRef.current) network.stopSimulation(); + eventHandlersRef.current.onInteractionStart(); + }, onHover: (change) => eventHandlersRef.current.onHover(change), onHoverEdge: (change) => eventHandlersRef.current.onHoverEdge(change), onClear: () => eventHandlersRef.current.onClear() }); network.on("stabilizationIterationsDone", () => { + // vis-network can continue its dynamic phase after the configured + // stabilization iterations. Freeze synchronously before React removes + // the loading screen so the first interactive frame cannot drift. + network.stopSimulation(); initialViewRef.current = { position: network.getViewPosition(), scale: network.getScale() diff --git a/packages/compass-viewer/src/graph/networkEvents.test.ts b/packages/compass-viewer/src/graph/networkEvents.test.ts index 607001f6..4eeb3b23 100644 --- a/packages/compass-viewer/src/graph/networkEvents.test.ts +++ b/packages/compass-viewer/src/graph/networkEvents.test.ts @@ -16,6 +16,7 @@ function fixture() { onFocus: vi.fn(), onOpenSource: vi.fn(), onOpenRelationshipSource: vi.fn(), + onInteractionStart: vi.fn(), onHover: vi.fn(), onHoverEdge: vi.fn(), onClear: vi.fn() @@ -105,6 +106,7 @@ describe("bindGraphNetworkEvents", () => { expect(handlers.onHover).toHaveBeenCalledWith(null); expect(handlers.onHoverEdge).toHaveBeenCalledWith(null); + expect(handlers.onInteractionStart).toHaveBeenCalledTimes(1); }); it("clears an edge card before showing a node card", () => { @@ -116,5 +118,6 @@ describe("bindGraphNetworkEvents", () => { expect(handlers.onHoverEdge).toHaveBeenCalledWith(null); expect(handlers.onHover).toHaveBeenCalledWith({ nodeId: "run", x: 10, y: 20 }); + expect(handlers.onInteractionStart).toHaveBeenCalledTimes(1); }); }); diff --git a/packages/compass-viewer/src/graph/networkEvents.ts b/packages/compass-viewer/src/graph/networkEvents.ts index 33a56962..37a8fc3a 100644 --- a/packages/compass-viewer/src/graph/networkEvents.ts +++ b/packages/compass-viewer/src/graph/networkEvents.ts @@ -18,6 +18,7 @@ export type GraphNetworkHandlers = { onFocus(nodeId: string): void; onOpenSource(nodeId: string): void; onOpenRelationshipSource(edgeId: string): void; + onInteractionStart(): void; onHover(change: GraphHover | null): void; onHoverEdge(change: GraphEdgeHover | null): void; onClear(): void; @@ -48,6 +49,7 @@ export function bindGraphNetworkEvents( }); network.on("hoverNode", (parameters) => { if (parameters.node === undefined) return; + handlers.onInteractionStart(); handlers.onHoverEdge(null); handlers.onHover({ nodeId: String(parameters.node), @@ -68,6 +70,7 @@ export function bindGraphNetworkEvents( }); network.on("blurEdge", () => handlers.onHoverEdge(null)); network.on("dragStart", () => { + handlers.onInteractionStart(); handlers.onHover(null); handlers.onHoverEdge(null); }); diff --git a/tests/viewer/graph-parity.spec.ts b/tests/viewer/graph-parity.spec.ts index 95ca77b5..a6a2a37e 100644 --- a/tests/viewer/graph-parity.spec.ts +++ b/tests/viewer/graph-parity.spec.ts @@ -49,6 +49,22 @@ test("VS Code graph mirrors Compass export structure and exposes source metadata expect(external).toEqual([]); }); +test("HTML export graph stays still once it becomes interactive", async ({ page }) => { + await page.goto("/graph.html"); + await expect(page.getByRole("button", { name: "Run layout" })).toBeVisible(); + const canvas = page.locator(".compass-canvas canvas").first(); + + await page.waitForTimeout(100); + const firstInteractiveFrame = await canvas.evaluate( + (element: HTMLCanvasElement) => element.toDataURL() + ); + await page.waitForTimeout(250); + + await expect(canvas.evaluate( + (element: HTMLCanvasElement) => element.toDataURL() + )).resolves.toBe(firstInteractiveFrame); +}); + test("file-only graph nodes stay inspectable without source navigation", async ({ page }) => { await page.goto("/graph.html"); await page.evaluate(() => { @@ -264,6 +280,18 @@ test("community double-click enters lazy detail, source opens, and Back restores await search.fill("run"); await page.getByRole("option", { name: /^run/i }).click(); await page.waitForTimeout(300); + await runLayout.click(); + await expect(page.getByRole("button", { name: "Stop layout" })).toBeVisible(); + await graphCanvas.hover(); + await expect(page.getByRole("button", { name: "Run layout" })).toBeVisible(); + await page.waitForTimeout(100); + const interactionFrame = await graphCanvas.evaluate( + (canvas: HTMLCanvasElement) => canvas.toDataURL() + ); + await page.waitForTimeout(250); + await expect(graphCanvas.evaluate( + (canvas: HTMLCanvasElement) => canvas.toDataURL() + )).resolves.toBe(interactionFrame); await page.locator("canvas").dblclick(); await expect.poll(() => page.evaluate( () => (window as typeof window & { openedSource?: unknown }).openedSource