@opscanvas/opscanvas 0.0.9 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,758 @@
1
+ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,o)=>(o=n==null?{}:e(i(n)),s(r||!n||!n.__esModule||!a.call(n,`default`)?t(o,`default`,{value:n,enumerable:!0}):o,n));(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var l={context:void 0,registry:void 0,effects:void 0,done:!1,getContextId(){return u(this.context.count)},getNextContextId(){return u(this.context.count++)}};function u(e){let t=String(e),n=t.length-1;return l.context.id+(n?String.fromCharCode(96+n):``)+t}function d(e){l.context=e}var f=(e,t)=>e===t,p=Symbol(`solid-proxy`),m=typeof Proxy==`function`,h=Symbol(`solid-track`),g={equals:f},_=null,v=we,y=1,b=2,x={owned:null,cleanups:null,context:null,owner:null},S=null,C=null,w=null,T=null,E=null,ee=0;function te(e,t){let n=w,r=S,i=e.length===0,a=t===void 0?r:t,o=i?x:{owned:null,cleanups:null,context:a?a.context:null,owner:a},s=i?e:()=>e(()=>re(()=>Oe(o)));S=o,w=null;try{return Se(s,!0)}finally{w=n,S=r}}function D(e,t){t=t?Object.assign({},g,t):g;let n={value:e,observers:null,observerSlots:null,comparator:t.equals||void 0};return[ge.bind(n),e=>(typeof e==`function`&&(e=C&&C.running&&C.sources.has(n)?e(n.tValue):e(n.value)),_e(n,e))]}function O(e,t,n){ve(be(e,t,!1,y))}function k(e,t,n){v=Te;let r=be(e,t,!1,y),i=he&&pe(he);i&&(r.suspense=i),(!n||!n.render)&&(r.user=!0),E?E.push(r):ve(r)}function A(e,t,n){n=n?Object.assign({},g,n):g;let r=be(e,t,!0,0);return r.observers=null,r.observerSlots=null,r.comparator=n.equals||void 0,ve(r),ge.bind(r)}function ne(e){return Se(e,!1)}function re(e){if(w===null)return e();let t=w;w=null;try{return e()}finally{w=t}}function ie(e,t,n){let r=Array.isArray(e),i,a=n&&n.defer;return n=>{let o;if(r){o=Array(e.length);for(let t=0;t<e.length;t++)o[t]=e[t]()}else o=e();if(a)return a=!1,n;let s=re(()=>t(o,i,n));return i=o,s}}function ae(e){k(()=>re(e))}function oe(e){return S===null||(S.cleanups===null?S.cleanups=[e]:S.cleanups.push(e)),e}function se(){return S}function ce(e,t){let n=S,r=w;S=e,w=null;try{return Se(t,!0)}catch(e){Me(e)}finally{S=n,w=r}}function le(e){if(C&&C.running)return e(),C.done;let t=w,n=S;return Promise.resolve().then(()=>{w=t,S=n;let r;return he&&(r=C||={sources:new Set,effects:[],promises:new Set,disposed:new Set,queue:new Set,running:!0},r.done||(r.done=new Promise(e=>r.resolve=e)),r.running=!0),Se(e,!1),w=S=null,r?r.done:void 0})}var[ue,de]=D(!1);function fe(e,t){let n=Symbol(`context`);return{id:n,Provider:Pe(n),defaultValue:e}}function pe(e){let t;return S&&S.context&&(t=S.context[e.id])!==void 0?t:e.defaultValue}function me(e){let t=A(e),n=A(()=>Ne(t()));return n.toArray=()=>{let e=n();return Array.isArray(e)?e:e==null?[]:[e]},n}var he;function ge(){let e=C&&C.running;if(this.sources&&(e?this.tState:this.state)){if((e?this.tState:this.state)===y)ve(this);else{let e=T;T=null,Se(()=>Ee(this),!1),T=e}}if(w){let e=this.observers;if(!e||e[e.length-1]!==w){let t=e?e.length:0;w.sources?(w.sources.push(this),w.sourceSlots.push(t)):(w.sources=[this],w.sourceSlots=[t]),e?(e.push(w),this.observerSlots.push(w.sources.length-1)):(this.observers=[w],this.observerSlots=[w.sources.length-1])}}return e&&C.sources.has(this)?this.tValue:this.value}function _e(e,t,n){let r=C&&C.running&&C.sources.has(e)?e.tValue:e.value;if(!e.comparator||!e.comparator(r,t)){if(C){let r=C.running;(r||!n&&C.sources.has(e))&&(C.sources.add(e),e.tValue=t),r||(e.value=t)}else e.value=t;e.observers&&e.observers.length&&Se(()=>{for(let t=0;t<e.observers.length;t+=1){let n=e.observers[t],r=C&&C.running;r&&C.disposed.has(n)||((r?!n.tState:!n.state)&&(n.pure?T.push(n):E.push(n),n.observers&&De(n)),r?n.tState=y:n.state=y)}if(T.length>1e6)throw T=[],Error()},!1)}return t}function ve(e){if(!e.fn)return;Oe(e);let t=ee;ye(e,C&&C.running&&C.sources.has(e)?e.tValue:e.value,t),C&&!C.running&&C.sources.has(e)&&queueMicrotask(()=>{Se(()=>{C&&(C.running=!0),w=S=e,ye(e,e.tValue,t),w=S=null},!1)})}function ye(e,t,n){let r,i=S,a=w;w=S=e;try{r=e.fn(t)}catch(t){return e.pure&&(C&&C.running?(e.tState=y,e.tOwned&&e.tOwned.forEach(Oe),e.tOwned=void 0):(e.state=y,e.owned&&e.owned.forEach(Oe),e.owned=null)),e.updatedAt=n+1,Me(t)}finally{w=a,S=i}(!e.updatedAt||e.updatedAt<=n)&&(e.updatedAt!=null&&`observers`in e?_e(e,r,!0):C&&C.running&&e.pure?(C.sources.has(e)||(e.value=r),C.sources.add(e),e.tValue=r):e.value=r,e.updatedAt=n)}function be(e,t,n,r=y,i){let a={fn:e,state:r,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null,value:t,owner:S,context:S?S.context:null,pure:n};return C&&C.running&&(a.state=0,a.tState=r),S===null||S!==x&&(C&&C.running&&S.pure?S.tOwned?S.tOwned.push(a):S.tOwned=[a]:S.owned?S.owned.push(a):S.owned=[a]),a}function xe(e){let t=C&&C.running;if((t?e.tState:e.state)===0)return;if((t?e.tState:e.state)===b)return Ee(e);if(e.suspense&&re(e.suspense.inFallback))return e.suspense.effects.push(e);let n=[e];for(;(e=e.owner)&&(!e.updatedAt||e.updatedAt<ee);){if(t&&C.disposed.has(e))return;(t?e.tState:e.state)&&n.push(e)}for(let r=n.length-1;r>=0;r--){if(e=n[r],t){let t=e,i=n[r+1];for(;(t=t.owner)&&t!==i;)if(C.disposed.has(t))return}if((t?e.tState:e.state)===y)ve(e);else if((t?e.tState:e.state)===b){let t=T;T=null,Se(()=>Ee(e,n[0]),!1),T=t}}}function Se(e,t){if(T)return e();let n=!1;t||(T=[]),E?n=!0:E=[],ee++;try{let t=e();return Ce(n),t}catch(e){n||(E=null),T=null,Me(e)}}function Ce(e){if(T&&=(we(T),null),e)return;let t;if(C){if(!C.promises.size&&!C.queue.size){let e=C.sources,n=C.disposed;E.push.apply(E,C.effects),t=C.resolve;for(let e of E)`tState`in e&&(e.state=e.tState),delete e.tState;C=null,Se(()=>{for(let e of n)Oe(e);for(let t of e){if(t.value=t.tValue,t.owned)for(let e=0,n=t.owned.length;e<n;e++)Oe(t.owned[e]);t.tOwned&&(t.owned=t.tOwned),delete t.tValue,delete t.tOwned,t.tState=0}de(!1)},!1)}else if(C.running){C.running=!1,C.effects.push.apply(C.effects,E),E=null,de(!0);return}}let n=E;E=null,n.length&&Se(()=>v(n),!1),t&&t()}function we(e){for(let t=0;t<e.length;t++)xe(e[t])}function Te(e){let t,n=0;for(t=0;t<e.length;t++){let r=e[t];r.user?e[n++]=r:xe(r)}if(l.context){if(l.count){l.effects||=[],l.effects.push(...e.slice(0,n));return}d()}for(l.effects&&(l.done||!l.count)&&(e=[...l.effects,...e],n+=l.effects.length,delete l.effects),t=0;t<n;t++)xe(e[t])}function Ee(e,t){let n=C&&C.running;n?e.tState=0:e.state=0;for(let r=0;r<e.sources.length;r+=1){let i=e.sources[r];if(i.sources){let e=n?i.tState:i.state;e===y?i!==t&&(!i.updatedAt||i.updatedAt<ee)&&xe(i):e===b&&Ee(i,t)}}}function De(e){let t=C&&C.running;for(let n=0;n<e.observers.length;n+=1){let r=e.observers[n];(t?!r.tState:!r.state)&&(t?r.tState=b:r.state=b,r.pure?T.push(r):E.push(r),r.observers&&De(r))}}function Oe(e){let t;if(e.sources)for(;e.sources.length;){let t=e.sources.pop(),n=e.sourceSlots.pop(),r=t.observers;if(r&&r.length){let e=r.pop(),i=t.observerSlots.pop();n<r.length&&(e.sourceSlots[i]=n,r[n]=e,t.observerSlots[n]=i)}}if(e.tOwned){for(t=e.tOwned.length-1;t>=0;t--)Oe(e.tOwned[t]);delete e.tOwned}if(C&&C.running&&e.pure)ke(e,!0);else if(e.owned){for(t=e.owned.length-1;t>=0;t--)Oe(e.owned[t]);e.owned=null}if(e.cleanups){for(t=e.cleanups.length-1;t>=0;t--)e.cleanups[t]();e.cleanups=null}C&&C.running?e.tState=0:e.state=0}function ke(e,t){if(t||(e.tState=0,C.disposed.add(e)),e.owned)for(let t=0;t<e.owned.length;t++)ke(e.owned[t])}function Ae(e){return e instanceof Error?e:Error(typeof e==`string`?e:`Unknown error`,{cause:e})}function je(e,t,n){try{for(let n of t)n(e)}catch(e){Me(e,n&&n.owner||null)}}function Me(e,t=S){let n=_&&t&&t.context&&t.context[_],r=Ae(e);if(!n)throw r;E?E.push({fn(){je(r,n,t)},state:y}):je(r,n,t)}function Ne(e){if(typeof e==`function`&&!e.length)return Ne(e());if(Array.isArray(e)){let t=[];for(let n=0;n<e.length;n++){let r=Ne(e[n]);if(Array.isArray(r)){if(r.length<32768)t.push.apply(t,r);else for(let e=0;e<r.length;e++)t.push(r[e])}else t.push(r)}return t}return e}function Pe(e,t){return function(t){let n;return O(()=>n=re(()=>(S.context={...S.context,[e]:t.value},me(()=>t.children))),void 0),n}}var Fe=Symbol(`fallback`);function Ie(e){for(let t=0;t<e.length;t++)e[t]()}function Le(e,t,n={}){let r=[],i=[],a=[],o=0,s=t.length>1?[]:null;return oe(()=>Ie(a)),()=>{let c=e()||[],l=c.length,u,d;return c[h],re(()=>{let e,t,p,m,h,g,_,v,y;if(l===0)o!==0&&(Ie(a),a=[],r=[],i=[],o=0,s&&=[]),n.fallback&&(r=[Fe],i[0]=te(e=>(a[0]=e,n.fallback())),o=1);else if(o===0){for(i=Array(l),d=0;d<l;d++)r[d]=c[d],i[d]=te(f);o=l}else{for(p=Array(l),m=Array(l),s&&(h=Array(l)),g=0,_=Math.min(o,l);g<_&&r[g]===c[g];g++);for(_=o-1,v=l-1;_>=g&&v>=g&&r[_]===c[v];_--,v--)p[v]=i[_],m[v]=a[_],s&&(h[v]=s[_]);for(e=new Map,t=Array(v+1),d=v;d>=g;d--)y=c[d],u=e.get(y),t[d]=u===void 0?-1:u,e.set(y,d);for(u=g;u<=_;u++)y=r[u],d=e.get(y),d!==void 0&&d!==-1?(p[d]=i[u],m[d]=a[u],s&&(h[d]=s[u]),d=t[d],e.set(y,d)):a[u]();for(d=g;d<l;d++)d in p?(i[d]=p[d],a[d]=m[d],s&&(s[d]=h[d],s[d](d))):i[d]=te(f);i=i.slice(0,o=l),r=c.slice(0)}return i});function f(e){if(a[d]=e,s){let[e,n]=D(d);return s[d]=n,t(c[d],e)}return t(c[d])}}}function j(e,t){return re(()=>e(t||{}))}function Re(){return!0}var ze={get(e,t,n){return t===p?n:e.get(t)},has(e,t){return t===p||e.has(t)},set:Re,deleteProperty:Re,getOwnPropertyDescriptor(e,t){return{configurable:!0,enumerable:!0,get(){return e.get(t)},set:Re,deleteProperty:Re}},ownKeys(e){return e.keys()}};function Be(e){return(e=typeof e==`function`?e():e)?e:{}}function Ve(){for(let e=0,t=this.length;e<t;++e){let t=this[e]();if(t!==void 0)return t}}function He(...e){let t=!1;for(let n=0;n<e.length;n++){let r=e[n];t||=!!r&&p in r,e[n]=typeof r==`function`?(t=!0,A(r)):r}if(m&&t)return new Proxy({get(t){for(let n=e.length-1;n>=0;n--){let r=Be(e[n])[t];if(r!==void 0)return r}},has(t){for(let n=e.length-1;n>=0;n--)if(t in Be(e[n]))return!0;return!1},keys(){let t=[];for(let n=0;n<e.length;n++)t.push(...Object.keys(Be(e[n])));return[...new Set(t)]}},ze);let n={},r=Object.create(null);for(let t=e.length-1;t>=0;t--){let i=e[t];if(!i)continue;let a=Object.getOwnPropertyNames(i);for(let e=a.length-1;e>=0;e--){let t=a[e];if(t===`__proto__`||t===`constructor`)continue;let o=Object.getOwnPropertyDescriptor(i,t);if(!r[t])r[t]=o.get?{enumerable:!0,configurable:!0,get:Ve.bind(n[t]=[o.get.bind(i)])}:o.value===void 0?void 0:o;else{let e=n[t];e&&(o.get?e.push(o.get.bind(i)):o.value!==void 0&&e.push(()=>o.value))}}}let i={},a=Object.keys(r);for(let e=a.length-1;e>=0;e--){let t=a[e],n=r[t];n&&n.get?Object.defineProperty(i,t,n):i[t]=n?n.value:void 0}return i}function Ue(e,...t){let n=t.length;if(m&&p in e){let r=n>1?t.flat():t[0],i=t.map(t=>new Proxy({get(n){return t.includes(n)?e[n]:void 0},has(n){return t.includes(n)&&n in e},keys(){return t.filter(t=>t in e)}},ze));return i.push(new Proxy({get(t){return r.includes(t)?void 0:e[t]},has(t){return!r.includes(t)&&t in e},keys(){return Object.keys(e).filter(e=>!r.includes(e))}},ze)),i}let r=[];for(let e=0;e<=n;e++)r[e]={};for(let i of Object.getOwnPropertyNames(e)){let a=n;for(let e=0;e<t.length;e++)if(t[e].includes(i)){a=e;break}let o=Object.getOwnPropertyDescriptor(e,i);!o.get&&!o.set&&o.enumerable&&o.writable&&o.configurable?r[a][i]=o.value:Object.defineProperty(r[a],i,o)}return r}var We=0;function Ge(){return l.context?l.getNextContextId():`cl-${We++}`}var Ke=e=>`Stale read from <${e}>.`;function qe(e){let t=`fallback`in e&&{fallback:()=>e.fallback};return A(Le(()=>e.each,e.children,t||void 0))}function M(e){let t=e.keyed,n=A(()=>e.when,void 0,void 0),r=t?n:A(n,void 0,{equals:(e,t)=>!e==!t});return A(()=>{let i=r();if(i){let a=e.children;return typeof a==`function`&&a.length>0?re(()=>a(t?i:()=>{if(!re(r))throw Ke(`Show`);return n()})):a}return e.fallback},void 0,void 0)}function Je(e){let t=me(()=>e.children),n=A(()=>{let e=t(),n=Array.isArray(e)?e:[e],r=()=>void 0;for(let e=0;e<n.length;e++){let t=e,i=n[e],a=r,o=A(()=>a()?void 0:i.when,void 0,void 0),s=i.keyed?o:A(o,void 0,{equals:(e,t)=>!e==!t});r=()=>a()||(s()?[t,o,i]:void 0)}return r});return A(()=>{let t=n()();if(!t)return e.fallback;let[r,i,a]=t,o=a.children;return typeof o==`function`&&o.length>0?re(()=>o(a.keyed?i():()=>{if(re(n)()?.[0]!==r)throw Ke(`Match`);return i()})):o},void 0,void 0)}function Ye(e){return e}var Xe;function Ze(){Xe&&[...Xe].forEach(e=>e())}var Qe=e=>A(()=>e());function $e(e,t,n){let r=n.length,i=t.length,a=r,o=0,s=0,c=t[i-1].nextSibling,l=null;for(;o<i||s<a;){if(t[o]===n[s]){o++,s++;continue}for(;t[i-1]===n[a-1];)i--,a--;if(i===o){let t=a<r?s?n[s-1].nextSibling:n[a-s]:c;for(;s<a;)e.insertBefore(n[s++],t)}else if(a===s)for(;o<i;)(!l||!l.has(t[o]))&&t[o].remove(),o++;else if(t[o]===n[a-1]&&n[s]===t[i-1]){let r=t[--i].nextSibling;e.insertBefore(n[s++],t[o++].nextSibling),e.insertBefore(n[--a],r),t[i]=n[a]}else{if(!l){l=new Map;let e=s;for(;e<a;)l.set(n[e],e++)}let r=l.get(t[o]);if(r!=null){if(s<r&&r<a){let c=o,u=1,d;for(;++c<i&&c<a&&(d=l.get(t[c]))!=null&&d===r+u;)u++;if(u>r-s){let i=t[o];for(;s<r;)e.insertBefore(n[s++],i)}else e.replaceChild(n[s++],t[o++])}else o++}else t[o++].remove()}}}var et=`_$DX_DELEGATE`;function tt(e,t,n,r={}){let i;return te(r=>{i=r,t===document?e():F(t,e(),t.firstChild?null:void 0,n)},r.owner),()=>{i(),t.textContent=``}}function N(e,t,n,r){let i,a=()=>{let t=r?document.createElementNS(`http://www.w3.org/1998/Math/MathML`,`template`):document.createElement(`template`);return t.innerHTML=e,n?t.content.firstChild.firstChild:r?t.firstChild:t.content.firstChild},o=t?()=>re(()=>document.importNode(i||=a(),!0)):()=>(i||=a()).cloneNode(!0);return o.cloneNode=o,o}function nt(e,t=window.document){let n=t[et]||(t[et]=new Set);for(let r=0,i=e.length;r<i;r++){let i=e[r];n.has(i)||(n.add(i),t.addEventListener(i,st))}}function P(e,t,n){ot(e)||(n==null?e.removeAttribute(t):e.setAttribute(t,n))}function rt(e,t){ot(e)||(t==null?e.removeAttribute(`class`):e.className=t)}function it(e,t,n,r){if(r)Array.isArray(n)?(e[`$$${t}`]=n[0],e[`$$${t}Data`]=n[1]):e[`$$${t}`]=n;else if(Array.isArray(n)){let r=n[0];e.addEventListener(t,n[0]=t=>r.call(e,n[1],t))}else e.addEventListener(t,n,typeof n!=`function`&&n)}function at(e,t,n){return re(()=>e(t,n))}function F(e,t,n,r){if(n!==void 0&&!r&&(r=[]),typeof t!=`function`)return ct(e,t,r,n);O(r=>ct(e,t(),r,n),r)}function ot(e){return!!l.context&&!l.done&&(!e||e.isConnected)}function st(e){if(l.registry&&l.events&&l.events.find(([t,n])=>n===e))return;let t=e.target,n=`$$${e.type}`,r=e.target,i=e.currentTarget,a=t=>Object.defineProperty(e,"target",{configurable:!0,value:t}),o=()=>{let r=t[n];if(r&&!t.disabled){let i=t[`${n}Data`];if(i===void 0?r.call(t,e):r.call(t,i,e),e.cancelBubble)return}return t.host&&typeof t.host!=`string`&&!t.host._$host&&t.contains(e.target)&&a(t.host),!0},s=()=>{for(;o()&&(t=t._$host||t.parentNode||t.host););};if(Object.defineProperty(e,"currentTarget",{configurable:!0,get(){return t||document}}),l.registry&&!l.done&&(l.done=_$HY.done=!0),e.composedPath){let n=e.composedPath();a(n[0]);for(let e=0;e<n.length-2&&(t=n[e],o());e++){if(t._$host){t=t._$host,s();break}if(t.parentNode===i)break}}else s();a(r)}function ct(e,t,n,r,i){let a=ot(e);if(a){!n&&(n=[...e.childNodes]);let t=[];for(let e=0;e<n.length;e++){let r=n[e];r.nodeType===8&&r.data.slice(0,2)===`!$`?r.remove():t.push(r)}n=t}for(;typeof n==`function`;)n=n();if(t===n)return n;let o=typeof t,s=r!==void 0;if(e=s&&n[0]&&n[0].parentNode||e,o===`string`||o===`number`){if(a||o===`number`&&(t=t.toString(),t===n))return n;if(s){let i=n[0];i&&i.nodeType===3?i.data!==t&&(i.data=t):i=document.createTextNode(t),n=dt(e,n,r,i)}else n=n!==``&&typeof n==`string`?e.firstChild.data=t:e.textContent=t}else if(t==null||o===`boolean`){if(a)return n;n=dt(e,n,r)}else if(o===`function`)return O(()=>{let i=t();for(;typeof i==`function`;)i=i();n=ct(e,i,n,r)}),()=>n;else if(Array.isArray(t)){let o=[],c=n&&Array.isArray(n);if(lt(o,t,n,i))return O(()=>n=ct(e,o,n,r,!0)),()=>n;if(a){if(!o.length)return n;if(r===void 0)return n=[...e.childNodes];let t=o[0];if(t.parentNode!==e)return n;let i=[t];for(;(t=t.nextSibling)!==r;)i.push(t);return n=i}if(o.length===0){if(n=dt(e,n,r),s)return n}else c?n.length===0?ut(e,o,r):$e(e,n,o):(n&&dt(e),ut(e,o));n=o}else if(t.nodeType){if(a&&t.parentNode)return n=s?[t]:t;if(Array.isArray(n)){if(s)return n=dt(e,n,r,t);dt(e,n,null,t)}else n==null||n===``||!e.firstChild?e.appendChild(t):e.replaceChild(t,e.firstChild);n=t}return n}function lt(e,t,n,r){let i=!1;for(let a=0,o=t.length;a<o;a++){let o=t[a],s=n&&n[e.length],c;if(o!=null&&o!==!0&&o!==!1){if((c=typeof o)==`object`&&o.nodeType)e.push(o);else if(Array.isArray(o))i=lt(e,o,s)||i;else if(c===`function`){if(r){for(;typeof o==`function`;)o=o();i=lt(e,Array.isArray(o)?o:[o],Array.isArray(s)?s:[s])||i}else e.push(o),i=!0}else{let t=String(o);s&&s.nodeType===3&&s.data===t?e.push(s):e.push(document.createTextNode(t))}}}return i}function ut(e,t,n=null){for(let r=0,i=t.length;r<i;r++)e.insertBefore(t[r],n)}function dt(e,t,n,r){if(n===void 0)return e.textContent=``;let i=r||document.createTextNode(``);if(t.length){let r=!1;for(let a=t.length-1;a>=0;a--){let o=t[a];if(i!==o){let t=o.parentNode===e;!r&&!a?t?e.replaceChild(i,o):e.insertBefore(i,n):t&&o.remove()}else r=!0}}else e.insertBefore(i,n);return[i]}function ft(){let e=new Set;function t(t){return e.add(t),()=>e.delete(t)}let n=!1;function r(t,r){if(n)return!(n=!1);let i={to:t,options:r,defaultPrevented:!1,preventDefault:()=>i.defaultPrevented=!0};for(let a of e)a.listener({to:t,options:r,get defaultPrevented(){return i.defaultPrevented},preventDefault:i.preventDefault,from:a.location,retry:e=>{e&&(n=!0),a.navigate(t,{...r,resolve:!1})}});return!i.defaultPrevented}return{subscribe:t,confirm:r}}var pt;function mt(){(!window.history.state||window.history.state._depth==null)&&window.history.replaceState({...window.history.state,_depth:window.history.length-1},``),pt=window.history.state._depth}mt();function ht(e){return{...e,_depth:window.history.state&&window.history.state._depth}}function gt(e,t){let n=!1;return()=>{let r=pt;mt();let i=r==null?null:pt-r;if(n){n=!1;return}i&&t(i)?(n=!0,window.history.go(-i)):e()}}var _t=/^(?:[a-z0-9]+:)?\/\//i,vt=/^\/+|(\/)\/+$/g,yt=`http://sr`;function bt(e,t=!1){let n=e.replace(vt,`$1`);return n?t||/^[?#]/.test(n)?n:`/`+n:``}function xt(e,t,n){if(_t.test(t))return;let r=bt(e),i=n&&bt(n),a=``;return a=!i||t.startsWith(`/`)?r:i.toLowerCase().indexOf(r.toLowerCase())===0?i:r+i,(a||`/`)+bt(t,!a)}function St(e,t){if(e==null)throw Error(t);return e}function Ct(e,t){return bt(e).replace(/\/*(\*.*)?$/g,``)+bt(t)}function wt(e){let t={};return e.searchParams.forEach((e,n)=>{n in t?Array.isArray(t[n])?t[n].push(e):t[n]=[t[n],e]:t[n]=e}),t}function Tt(e,t,n){let[r,i]=e.split(`/*`,2),a=r.split(`/`).filter(Boolean),o=a.length;return e=>{let r=e.split(`/`);if(r[0]===``&&r.shift(),r.length&&r[r.length-1]===``&&r.pop(),r.includes(``))return null;let s=r.length-o;if(s<0||s>0&&i===void 0&&!t)return null;let c={path:o?``:`/`,params:{}},l=e=>n===void 0?void 0:n[e];for(let e=0;e<o;e++){let t=a[e],n=t[0]===`:`,i=n?r[e]:r[e].toLowerCase(),o=n?t.slice(1):t.toLowerCase();if(n&&Et(i,l(o)))c.params[o]=i;else if(n||!Et(i,o))return null;c.path+=`/${i}`}if(i){let e=s?r.slice(-s).join(`/`):``;if(Et(e,l(i)))c.params[i]=e;else return null}return c}}function Et(e,t){let n=t=>t===e;return t===void 0?!0:typeof t==`string`?n(t):typeof t==`function`?t(e):Array.isArray(t)?t.some(n):t instanceof RegExp&&t.test(e)}function Dt(e){let[t,n]=e.pattern.split(`/*`,2),r=t.split(`/`).filter(Boolean);return r.reduce((e,t)=>e+(t.startsWith(`:`)?2:3),r.length-(n===void 0?0:1))}function Ot(e){let t=new Map,n=se();return new Proxy({},{get(r,i){return t.has(i)||ce(n,()=>t.set(i,A(()=>e()[i]))),t.get(i)()},getOwnPropertyDescriptor(){return{enumerable:!0,configurable:!0}},ownKeys(){return Reflect.ownKeys(e())},has(t,n){return n in e()}})}function kt(e){let t=/(\/?\:[^\/]+)\?/.exec(e);if(!t)return[e];let n=e.slice(0,t.index),r=e.slice(t.index+t[0].length),i=[n,n+=t[1]];for(;t=/^(\/\:[^\/]+)\?/.exec(r);)i.push(n+=t[1]),r=r.slice(t[0].length);return kt(r).reduce((e,t)=>[...e,...i.map(e=>e+t)],[])}var At=100,jt=fe(),Mt=fe(),Nt=()=>St(pe(jt),`<A> and 'use' router primitives can be only used inside a Route.`),Pt=()=>Nt().location,Ft=e=>encodeURIComponent(e).replace(/%(2B|40|3A|24|26|2C|3B|3D)/g,e=>decodeURIComponent(e));function It(e,t=``){let{component:n,preload:r,load:i,children:a,info:o}=e,s=!a||Array.isArray(a)&&!a.length,c={key:e,component:n,preload:r||i,info:o};return Rt(e.path).reduce((n,r)=>{for(let i of kt(r)){let a=Ct(t,i),o=s?a:a.split(`/*`,1)[0];o=o.split(`/`).map(e=>e.startsWith(`:`)||e.startsWith(`*`)?e:Ft(e)).join(`/`),n.push({...c,originalPath:r,pattern:o,matcher:Tt(o,!s,e.matchFilters)})}return n},[])}function Lt(e,t=0){return{routes:e,score:Dt(e[e.length-1])*1e4-t,matcher(t){let n=[];for(let r=e.length-1;r>=0;r--){let i=e[r],a=i.matcher(t);if(!a)return null;n.unshift({...a,route:i})}return n}}}function Rt(e){return Array.isArray(e)?e:[e]}function zt(e,t=``,n=[],r=[]){let i=Rt(e);for(let e=0,a=i.length;e<a;e++){let a=i[e];if(a&&typeof a==`object`){a.hasOwnProperty(`path`)||(a.path=``);let e=It(a,t);for(let t of e){n.push(t);let e=Array.isArray(a.children)&&a.children.length===0;if(a.children&&!e)zt(a.children,t.pattern,n,r);else{let e=Lt([...n],r.length);r.push(e)}n.pop()}}}return n.length?r:r.sort((e,t)=>t.score-e.score)}function Bt(e,t){for(let n=0,r=e.length;n<r;n++){let r=e[n].matcher(t);if(r)return r}return[]}function Vt(e,t,n){let r=new URL(yt),i=A(t=>{let n=e();try{return new URL(n[0]===`/`?yt+n:n,r)}catch{return console.error(`Invalid path ${n}`),t}},r,{equals:(e,t)=>e.href===t.href}),a=A(()=>i().pathname),o=A(()=>i().search,!0),s=A(()=>i().hash),c=()=>``,l=ie(o,()=>wt(i()));return{get pathname(){return a()},get search(){return o()},get hash(){return s()},get state(){return t()},get key(){return c()},query:n?n(l):Ot(l)}}var Ht;function Ut(){return Ht}function Wt(e,t,n,r={}){let{signal:[i,a],utils:o={}}=e,s=o.parsePath||(e=>e),c=o.renderPath||(e=>e),l=o.beforeLeave||ft(),u=xt(``,r.base||``);if(u===void 0)throw Error(`${u} is not a valid base path`);u&&!i().value&&a({value:u,replace:!0,scroll:!1});let[d,f]=D(!1),p,m=(e,t)=>{(t.value!==h()||t.state!==_())&&(p===void 0&&f(!0),Ht=e,p=t,le(()=>{p===t&&(g(p.value),v(p.state),Ze(),x[1](e=>e.filter(e=>e.pending)))}).finally(()=>{p===t&&ne(()=>{Ht=void 0,e===`navigate`&&te(p),f(!1),p=void 0})}))},[h,g]=D(i().value),[_,v]=D(i().state),y=Vt(h,_,o.queryWrapper),b=[],x=D([]),S=A(()=>typeof r.transformUrl==`function`?Bt(t(),r.transformUrl(y.pathname)):Bt(t(),y.pathname)),C=()=>{let e=S(),t={};for(let n=0;n<e.length;n++)Object.assign(t,e[n].params);return t},w=o.paramsWrapper?o.paramsWrapper(C,t):Ot(C),T={pattern:u,path:()=>u,outlet:()=>null,resolvePath(e){return xt(u,e)}};return O(ie(i,e=>m(`native`,e),{defer:!0})),{base:T,location:y,params:w,isRouting:d,get pendingTarget(){return p},renderPath:c,parsePath:s,navigatorFactory:ee,matches:S,beforeLeave:l,preloadRoute:k,singleFlight:r.singleFlight===void 0||r.singleFlight,submissions:x};function E(e,t,n){re(()=>{if(typeof t==`number`){t&&(o.go?o.go(t):console.warn(`Router integration does not support relative routing`));return}let r=!t||t[0]===`?`,{replace:i,resolve:a,scroll:s,state:c}={replace:!1,resolve:!r,scroll:!0,...n},u=a?e.resolvePath(t):xt(r&&y.pathname||``,t);if(u===void 0)throw Error(`Path '${t}' is not a routable path`);if(b.length>=At)throw Error(`Too many redirects`);let d=h();(u!==d||c!==_())&&l.confirm(u,n)&&(b.push({value:d,replace:i,scroll:s,state:_()}),m(`navigate`,{value:u,state:c}))})}function ee(e){return e=e||pe(Mt)||T,(t,n)=>E(e,t,n)}function te(e){let t=b[0];t&&(a({...e,replace:t.replace,scroll:t.scroll}),b.length=0)}function k(e,r){let i=Bt(t(),e.pathname),a=Ht;Ht=`preload`;for(let t in i){let{route:a,params:o}=i[t];a.component&&a.component.preload&&a.component.preload();let{preload:s}=a;r&&s&&ce(n(),()=>s({params:o,location:{pathname:e.pathname,search:e.search,hash:e.hash,query:wt(e),state:null,key:``},intent:`preload`}))}Ht=a}}function Gt(e,t,n,r){let{base:i,location:a,params:o}=e,{pattern:s,component:c,preload:l}=r().route,u=A(()=>r().path);c&&c.preload&&c.preload();let d=l?l({params:o,location:a,intent:Ht||`initial`}):void 0;return{parent:t,pattern:s,path:u,outlet:()=>c?j(c,{params:o,location:a,data:d,get children(){return n()}}):n(),resolvePath(e){return xt(i.path(),e,u())}}}var Kt=e=>t=>{let{base:n}=t,r=me(()=>t.children),i=A(()=>zt(r(),t.base||``)),a,o=Wt(e,i,()=>a,{base:n,singleFlight:t.singleFlight,transformUrl:t.transformUrl});return e.create&&e.create(o),j(jt.Provider,{value:o,get children(){return j(qt,{routerState:o,get root(){return t.root},get preload(){return t.rootPreload||t.rootLoad},get children(){return[Qe(()=>(a=se())&&null),j(Jt,{routerState:o,get branches(){return i()}})]}})}})};function qt(e){let t=e.routerState.location,n=e.routerState.params,r=A(()=>e.preload&&re(()=>{e.preload({params:n,location:t,intent:Ut()||`initial`})}));return j(M,{get when(){return e.root},keyed:!0,get fallback(){return e.children},children:i=>j(i,{params:n,location:t,get data(){return r()},get children(){return e.children}})})}function Jt(e){let t=[],n;oe(()=>t.forEach(e=>e()));let r=A(ie(e.routerState.matches,(i,a,o)=>{let s=a&&i.length===a.length,c=[];for(let n=0,l=i.length;n<l;n++){let l=a&&a[n],u=i[n];o&&l&&u.route.key===l.route.key?c[n]=o[n]:(s=!1,t[n]&&t[n](),te(i=>{t[n]=i,c[n]=Gt(e.routerState,c[n-1]||e.routerState.base,Yt(()=>r()[n+1]),()=>{let t=e.routerState.matches();return t[n]??t[0]})}))}return t.splice(i.length).forEach(e=>e()),o&&s?o:(n=c[0],c)}));return Yt(()=>r()&&n)()}var Yt=e=>()=>j(M,{get when(){return e()},keyed:!0,children:e=>j(Mt.Provider,{value:e,get children(){return e.outlet()}})}),Xt=e=>{let t=me(()=>e.children);return He(e,{get children(){return t()}})};function Zt([e,t],n,r){return[n?()=>n(e()):e,r?e=>t(r(e)):t]}function Qt(e){let t=!1,n=e=>typeof e==`string`?{value:e}:e,r=Zt(D(n(e.get()),{equals:(e,t)=>e.value===t.value&&e.state===t.state}),void 0,n=>(!t&&e.set(n),l.registry&&!l.done&&(l.done=!0),n));return e.init&&oe(e.init((i=e.get())=>{t=!0,r[1](n(i)),t=!1})),Kt({signal:r,create:e.create,utils:e.utils})}function $t(e,t,n){return e.addEventListener(t,n),()=>e.removeEventListener(t,n)}function en(e,t){let n=e&&document.getElementById(e);n?n.scrollIntoView():t&&window.scrollTo(0,0)}var tn=new Map;function nn({preload:e=!0,explicitLinks:t=!1,actionBase:n=`/_server`,transformUrl:r}={}){return i=>{let a=i.base.path(),o=i.navigatorFactory(i.base),s,c;function l(e){return e.namespaceURI===`http://www.w3.org/2000/svg`}function u(e){if(e.defaultPrevented||e.button!==0||e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)return;let n=e.composedPath().find(e=>e instanceof Node&&e.nodeName.toUpperCase()===`A`);if(!n||t&&!n.hasAttribute(`link`))return;let r=l(n),i=r?n.href.baseVal:n.href;if((r?n.target.baseVal:n.target)||!i&&!n.hasAttribute(`state`))return;let o=(n.getAttribute(`rel`)||``).split(/\s+/);if(n.hasAttribute(`download`)||o&&o.includes(`external`))return;let s=r?new URL(i,document.baseURI):new URL(i);if(!(s.origin!==window.location.origin||a&&s.pathname&&!s.pathname.toLowerCase().startsWith(a.toLowerCase())))return[n,s]}function d(e){let t=u(e);if(!t)return;let[n,r]=t,a=i.parsePath(r.pathname+r.search+r.hash),s=n.getAttribute(`state`);e.preventDefault(),o(a,{resolve:!1,replace:n.hasAttribute(`replace`),scroll:!n.hasAttribute(`noscroll`),state:s?JSON.parse(s):void 0})}function f(e){let t=u(e);if(!t)return;let[n,a]=t;r&&(a.pathname=r(a.pathname)),i.preloadRoute(a,n.getAttribute(`preload`)!==`false`)}function p(e){clearTimeout(s);let t=u(e);if(!t)return c=null;let[n,a]=t;c!==n&&(r&&(a.pathname=r(a.pathname)),s=setTimeout(()=>{i.preloadRoute(a,n.getAttribute(`preload`)!==`false`),c=n},20))}function m(e){if(e.defaultPrevented)return;let t=e.submitter&&e.submitter.hasAttribute(`formaction`)?e.submitter.getAttribute(`formaction`):e.target.getAttribute(`action`);if(!t)return;if(!t.startsWith(`https://action/`)){let e=new URL(t,yt);if(t=i.parsePath(e.pathname+e.search),!t.startsWith(n))return}if(e.target.method.toUpperCase()!==`POST`)throw Error(`Only POST forms are supported for Actions`);let r=tn.get(t);if(r){e.preventDefault();let t=new FormData(e.target,e.submitter);r.call({r:i,f:e.target},e.target.enctype===`multipart/form-data`?t:new URLSearchParams(t))}}nt([`click`,`submit`]),document.addEventListener(`click`,d),e&&(document.addEventListener(`mousemove`,p,{passive:!0}),document.addEventListener(`focusin`,f,{passive:!0}),document.addEventListener(`touchstart`,f,{passive:!0})),document.addEventListener(`submit`,m),oe(()=>{document.removeEventListener(`click`,d),e&&(document.removeEventListener(`mousemove`,p),document.removeEventListener(`focusin`,f),document.removeEventListener(`touchstart`,f)),document.removeEventListener(`submit`,m)})}}var rn=`solid-router:scroll`;function an(){window.history.scrollRestoration=`manual`,mt();let e={};try{e=JSON.parse(sessionStorage.getItem(rn))||{}}catch{}let t=()=>window.history.state&&window.history.state._depth,n=!1,r,i=[$t(window,`scroll`,()=>{let i=t();i!=null&&(e[i]=window.scrollY),n||(r=void 0)}),$t(window,`pagehide`,()=>{try{sessionStorage.setItem(rn,JSON.stringify(e))}catch{}})],a=()=>{if(r==null)return;let t=e[r];r=void 0,t!=null&&(n=!0,window.scrollTo(0,t),n=!1)};return{onPop(){r=t()},onPush(){let n=t();if(n!=null)for(let t in e)+t>=n&&delete e[t]},create(e){k(ie(e.isRouting,e=>e||a(),{defer:!0})),oe(()=>i.forEach(e=>e()));let[n]=performance.getEntriesByType&&performance.getEntriesByType(`navigation`);n&&n.type!==`navigate`&&(r=t(),a())}}}function on(e){let t=e.scrollRestoration?an():void 0,n=()=>{let e=window.location.pathname+window.location.search,t=window.history.state&&window.history.state._depth&&Object.keys(window.history.state).length===1?void 0:window.history.state;return{value:e+window.location.hash,state:t}},r=ft();return Qt({get:n,set({value:e,replace:n,scroll:r,state:i}){n?window.history.replaceState(ht(i),``,e):window.history.pushState(i,``,e),en(decodeURIComponent(window.location.hash.slice(1)),r),mt(),t&&!n&&t.onPush()},init:e=>{let i=gt(e,e=>{if(e)return!r.confirm(e);{let e=n();return!r.confirm(e.value,{state:e.state})}});return $t(window,`popstate`,t?()=>{t.onPop(),i()}:i)},create:n=>{nn({preload:e.preload,explicitLinks:e.explicitLinks,actionBase:e.actionBase,transformUrl:e.transformUrl})(n),t&&t.create(n)},utils:{go:e=>window.history.go(e),beforeLeave:r}})(e)}function sn(e){return{ok:!0,value:e}}function cn(e){return{ok:!1,error:e}}var ln;(function(e){e.assertEqual=e=>{};function t(e){}e.assertIs=t;function n(e){throw Error()}e.assertNever=n,e.arrayToEnum=e=>{let t={};for(let n of e)t[n]=n;return t},e.getValidEnumValues=t=>{let n=e.objectKeys(t).filter(e=>typeof t[t[e]]!=`number`),r={};for(let e of n)r[e]=t[e];return e.objectValues(r)},e.objectValues=t=>e.objectKeys(t).map(function(e){return t[e]}),e.objectKeys=typeof Object.keys==`function`?e=>Object.keys(e):e=>{let t=[];for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},e.find=(e,t)=>{for(let n of e)if(t(n))return n},e.isInteger=typeof Number.isInteger==`function`?e=>Number.isInteger(e):e=>typeof e==`number`&&Number.isFinite(e)&&Math.floor(e)===e;function r(e,t=` | `){return e.map(e=>typeof e==`string`?`'${e}'`:e).join(t)}e.joinValues=r,e.jsonStringifyReplacer=(e,t)=>typeof t==`bigint`?t.toString():t})(ln||={});var un;(function(e){e.mergeShapes=(e,t)=>({...e,...t})})(un||={});var I=ln.arrayToEnum([`string`,`nan`,`number`,`integer`,`float`,`boolean`,`date`,`bigint`,`symbol`,`function`,`undefined`,`null`,`array`,`object`,`unknown`,`promise`,`void`,`never`,`map`,`set`]),dn=e=>{switch(typeof e){case`undefined`:return I.undefined;case`string`:return I.string;case`number`:return Number.isNaN(e)?I.nan:I.number;case`boolean`:return I.boolean;case`function`:return I.function;case`bigint`:return I.bigint;case`symbol`:return I.symbol;case`object`:return Array.isArray(e)?I.array:e===null?I.null:e.then&&typeof e.then==`function`&&e.catch&&typeof e.catch==`function`?I.promise:typeof Map<`u`&&e instanceof Map?I.map:typeof Set<`u`&&e instanceof Set?I.set:typeof Date<`u`&&e instanceof Date?I.date:I.object;default:return I.unknown}},L=ln.arrayToEnum([`invalid_type`,`invalid_literal`,`custom`,`invalid_union`,`invalid_union_discriminator`,`invalid_enum_value`,`unrecognized_keys`,`invalid_arguments`,`invalid_return_type`,`invalid_date`,`invalid_string`,`too_small`,`too_big`,`invalid_intersection_types`,`not_multiple_of`,`not_finite`]),fn=class e extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name=`ZodError`,this.issues=e}format(e){let t=e||function(e){return e.message},n={_errors:[]},r=e=>{for(let i of e.issues)if(i.code===`invalid_union`)i.unionErrors.map(r);else if(i.code===`invalid_return_type`)r(i.returnTypeError);else if(i.code===`invalid_arguments`)r(i.argumentsError);else if(i.path.length===0)n._errors.push(t(i));else{let e=n,r=0;for(;r<i.path.length;){let n=i.path[r];r===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(this),n}static assert(t){if(!(t instanceof e))throw Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,ln.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=e=>e.message){let t={},n=[];for(let r of this.issues)if(r.path.length>0){let n=r.path[0];t[n]=t[n]||[],t[n].push(e(r))}else n.push(e(r));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}};fn.create=e=>new fn(e);var pn=(e,t)=>{let n;switch(e.code){case L.invalid_type:n=e.received===I.undefined?`Required`:`Expected ${e.expected}, received ${e.received}`;break;case L.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,ln.jsonStringifyReplacer)}`;break;case L.unrecognized_keys:n=`Unrecognized key(s) in object: ${ln.joinValues(e.keys,`, `)}`;break;case L.invalid_union:n=`Invalid input`;break;case L.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${ln.joinValues(e.options)}`;break;case L.invalid_enum_value:n=`Invalid enum value. Expected ${ln.joinValues(e.options)}, received '${e.received}'`;break;case L.invalid_arguments:n=`Invalid function arguments`;break;case L.invalid_return_type:n=`Invalid function return type`;break;case L.invalid_date:n=`Invalid date`;break;case L.invalid_string:typeof e.validation==`object`?`includes`in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position==`number`&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):`startsWith`in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:`endsWith`in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:ln.assertNever(e.validation):n=e.validation===`regex`?`Invalid`:`Invalid ${e.validation}`;break;case L.too_small:n=e.type===`array`?`Array must contain ${e.exact?`exactly`:e.inclusive?`at least`:`more than`} ${e.minimum} element(s)`:e.type===`string`?`String must contain ${e.exact?`exactly`:e.inclusive?`at least`:`over`} ${e.minimum} character(s)`:e.type===`number`||e.type===`bigint`?`Number must be ${e.exact?`exactly equal to `:e.inclusive?`greater than or equal to `:`greater than `}${e.minimum}`:e.type===`date`?`Date must be ${e.exact?`exactly equal to `:e.inclusive?`greater than or equal to `:`greater than `}${new Date(Number(e.minimum))}`:`Invalid input`;break;case L.too_big:n=e.type===`array`?`Array must contain ${e.exact?`exactly`:e.inclusive?`at most`:`less than`} ${e.maximum} element(s)`:e.type===`string`?`String must contain ${e.exact?`exactly`:e.inclusive?`at most`:`under`} ${e.maximum} character(s)`:e.type===`number`?`Number must be ${e.exact?`exactly`:e.inclusive?`less than or equal to`:`less than`} ${e.maximum}`:e.type===`bigint`?`BigInt must be ${e.exact?`exactly`:e.inclusive?`less than or equal to`:`less than`} ${e.maximum}`:e.type===`date`?`Date must be ${e.exact?`exactly`:e.inclusive?`smaller than or equal to`:`smaller than`} ${new Date(Number(e.maximum))}`:`Invalid input`;break;case L.custom:n=`Invalid input`;break;case L.invalid_intersection_types:n=`Intersection results could not be merged`;break;case L.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case L.not_finite:n=`Number must be finite`;break;default:n=t.defaultError,ln.assertNever(e)}return{message:n}},mn=pn;function hn(){return mn}var gn=e=>{let{data:t,path:n,errorMaps:r,issueData:i}=e,a=[...n,...i.path||[]],o={...i,path:a};if(i.message!==void 0)return{...i,path:a,message:i.message};let s=``,c=r.filter(e=>!!e).slice().reverse();for(let e of c)s=e(o,{data:t,defaultError:s}).message;return{...i,path:a,message:s}};function R(e,t){let n=hn(),r=gn({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===pn?void 0:pn].filter(e=>!!e)});e.common.issues.push(r)}var _n=class e{constructor(){this.value=`valid`}dirty(){this.value===`valid`&&(this.value=`dirty`)}abort(){this.value!==`aborted`&&(this.value=`aborted`)}static mergeArray(e,t){let n=[];for(let r of t){if(r.status===`aborted`)return z;r.status===`dirty`&&e.dirty(),n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(t,n){let r=[];for(let e of n){let t=await e.key,n=await e.value;r.push({key:t,value:n})}return e.mergeObjectSync(t,r)}static mergeObjectSync(e,t){let n={};for(let r of t){let{key:t,value:i}=r;if(t.status===`aborted`||i.status===`aborted`)return z;t.status===`dirty`&&e.dirty(),i.status===`dirty`&&e.dirty(),t.value!==`__proto__`&&(i.value!==void 0||r.alwaysSet)&&(n[t.value]=i.value)}return{status:e.value,value:n}}},z=Object.freeze({status:`aborted`}),vn=e=>({status:`dirty`,value:e}),yn=e=>({status:`valid`,value:e}),bn=e=>e.status===`aborted`,xn=e=>e.status===`dirty`,Sn=e=>e.status===`valid`,Cn=e=>typeof Promise<`u`&&e instanceof Promise,B;(function(e){e.errToObj=e=>typeof e==`string`?{message:e}:e||{},e.toString=e=>typeof e==`string`?e:e?.message})(B||={});var wn=class{constructor(e,t,n,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=r}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Tn=(e,t)=>{if(Sn(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw Error(`Validation failed but no issues detected.`);return{success:!1,get error(){if(this._error)return this._error;let t=new fn(e.common.issues);return this._error=t,this._error}}};function V(e){if(!e)return{};let{errorMap:t,invalid_type_error:n,required_error:r,description:i}=e;if(t&&(n||r))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(t,i)=>{let{message:a}=e;return t.code===`invalid_enum_value`?{message:a??i.defaultError}:i.data===void 0?{message:a??r??i.defaultError}:t.code===`invalid_type`?{message:a??n??i.defaultError}:{message:i.defaultError}},description:i}}var H=class{get description(){return this._def.description}_getType(e){return dn(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:dn(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new _n,ctx:{common:e.parent.common,data:e.data,parsedType:dn(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(Cn(t))throw Error(`Synchronous parse encountered promise.`);return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){let n={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:dn(e)};return Tn(n,this._parseSync({data:e,path:n.path,parent:n}))}"~validate"(e){let t={common:{issues:[],async:!!this[`~standard`].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:dn(e)};if(!this[`~standard`].async)try{let n=this._parseSync({data:e,path:[],parent:t});return Sn(n)?{value:n.value}:{issues:t.common.issues}}catch(e){e?.message?.toLowerCase()?.includes(`encountered`)&&(this[`~standard`].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(e=>Sn(e)?{value:e.value}:{issues:t.common.issues})}async parseAsync(e,t){let n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){let n={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:dn(e)},r=this._parse({data:e,path:n.path,parent:n});return Tn(n,await(Cn(r)?r:Promise.resolve(r)))}refine(e,t){let n=e=>typeof t==`string`||t===void 0?{message:t}:typeof t==`function`?t(e):t;return this._refinement((t,r)=>{let i=e(t),a=()=>r.addIssue({code:L.custom,...n(t)});return typeof Promise<`u`&&i instanceof Promise?i.then(e=>e?!0:(a(),!1)):i?!0:(a(),!1)})}refinement(e,t){return this._refinement((n,r)=>e(n)?!0:(r.addIssue(typeof t==`function`?t(n,r):t),!1))}_refinement(e){return new Or({schema:this,typeName:U.ZodEffects,effect:{type:`refinement`,refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this[`~standard`]={version:1,vendor:`zod`,validate:e=>this[`~validate`](e)}}optional(){return kr.create(this,this._def)}nullable(){return Ar.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return lr.create(this)}promise(){return Dr.create(this,this._def)}or(e){return fr.create([this,e],this._def)}and(e){return gr.create(this,e,this._def)}transform(e){return new Or({...V(this._def),schema:this,typeName:U.ZodEffects,effect:{type:`transform`,transform:e}})}default(e){let t=typeof e==`function`?e:()=>e;return new jr({...V(this._def),innerType:this,defaultValue:t,typeName:U.ZodDefault})}brand(){return new Pr({typeName:U.ZodBranded,type:this,...V(this._def)})}catch(e){let t=typeof e==`function`?e:()=>e;return new Mr({...V(this._def),innerType:this,catchValue:t,typeName:U.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Fr.create(this,e)}readonly(){return Ir.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},En=/^c[^\s-]{8,}$/i,Dn=/^[0-9a-z]+$/,On=/^[0-9A-HJKMNP-TV-Z]{26}$/i,kn=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,An=/^[a-z0-9_-]{21}$/i,jn=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Mn=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Nn=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Pn=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,Fn,In=/^(?:(?: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])$/,Ln=/^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/,Rn=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,zn=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Bn=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Vn=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Hn=`((\\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=RegExp(`^${Hn}$`);function Wn(e){let t=`[0-5]\\d`;e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision??(t=`${t}(\\.\\d+)?`);let n=e.precision?`+`:`?`;return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function Gn(e){return RegExp(`^${Wn(e)}$`)}function Kn(e){let t=`${Hn}T${Wn(e)}`,n=[];return n.push(e.local?`Z?`:`Z`),e.offset&&n.push(`([+-]\\d{2}:?\\d{2})`),t=`${t}(${n.join(`|`)})`,RegExp(`^${t}$`)}function qn(e,t){return!!((t===`v4`||!t)&&In.test(e)||(t===`v6`||!t)&&Rn.test(e))}function Jn(e,t){if(!jn.test(e))return!1;try{let[n]=e.split(`.`);if(!n)return!1;let r=n.replace(/-/g,`+`).replace(/_/g,`/`).padEnd(n.length+(4-n.length%4)%4,`=`),i=JSON.parse(atob(r));return!(typeof i!=`object`||!i||`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&i.alg!==t)}catch{return!1}}function Yn(e,t){return!!((t===`v4`||!t)&&Ln.test(e)||(t===`v6`||!t)&&zn.test(e))}var Xn=class e extends H{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==I.string){let t=this._getOrReturnCtx(e);return R(t,{code:L.invalid_type,expected:I.string,received:t.parsedType}),z}let t=new _n,n;for(let r of this._def.checks)if(r.kind===`min`)e.data.length<r.value&&(n=this._getOrReturnCtx(e,n),R(n,{code:L.too_small,minimum:r.value,type:`string`,inclusive:!0,exact:!1,message:r.message}),t.dirty());else if(r.kind===`max`)e.data.length>r.value&&(n=this._getOrReturnCtx(e,n),R(n,{code:L.too_big,maximum:r.value,type:`string`,inclusive:!0,exact:!1,message:r.message}),t.dirty());else if(r.kind===`length`){let i=e.data.length>r.value,a=e.data.length<r.value;(i||a)&&(n=this._getOrReturnCtx(e,n),i?R(n,{code:L.too_big,maximum:r.value,type:`string`,inclusive:!0,exact:!0,message:r.message}):a&&R(n,{code:L.too_small,minimum:r.value,type:`string`,inclusive:!0,exact:!0,message:r.message}),t.dirty())}else if(r.kind===`email`)Nn.test(e.data)||(n=this._getOrReturnCtx(e,n),R(n,{validation:`email`,code:L.invalid_string,message:r.message}),t.dirty());else if(r.kind===`emoji`)Fn||=new RegExp(Pn,`u`),Fn.test(e.data)||(n=this._getOrReturnCtx(e,n),R(n,{validation:`emoji`,code:L.invalid_string,message:r.message}),t.dirty());else if(r.kind===`uuid`)kn.test(e.data)||(n=this._getOrReturnCtx(e,n),R(n,{validation:`uuid`,code:L.invalid_string,message:r.message}),t.dirty());else if(r.kind===`nanoid`)An.test(e.data)||(n=this._getOrReturnCtx(e,n),R(n,{validation:`nanoid`,code:L.invalid_string,message:r.message}),t.dirty());else if(r.kind===`cuid`)En.test(e.data)||(n=this._getOrReturnCtx(e,n),R(n,{validation:`cuid`,code:L.invalid_string,message:r.message}),t.dirty());else if(r.kind===`cuid2`)Dn.test(e.data)||(n=this._getOrReturnCtx(e,n),R(n,{validation:`cuid2`,code:L.invalid_string,message:r.message}),t.dirty());else if(r.kind===`ulid`)On.test(e.data)||(n=this._getOrReturnCtx(e,n),R(n,{validation:`ulid`,code:L.invalid_string,message:r.message}),t.dirty());else if(r.kind===`url`)try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),R(n,{validation:`url`,code:L.invalid_string,message:r.message}),t.dirty()}else r.kind===`regex`?(r.regex.lastIndex=0,r.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),R(n,{validation:`regex`,code:L.invalid_string,message:r.message}),t.dirty())):r.kind===`trim`?e.data=e.data.trim():r.kind===`includes`?e.data.includes(r.value,r.position)||(n=this._getOrReturnCtx(e,n),R(n,{code:L.invalid_string,validation:{includes:r.value,position:r.position},message:r.message}),t.dirty()):r.kind===`toLowerCase`?e.data=e.data.toLowerCase():r.kind===`toUpperCase`?e.data=e.data.toUpperCase():r.kind===`startsWith`?e.data.startsWith(r.value)||(n=this._getOrReturnCtx(e,n),R(n,{code:L.invalid_string,validation:{startsWith:r.value},message:r.message}),t.dirty()):r.kind===`endsWith`?e.data.endsWith(r.value)||(n=this._getOrReturnCtx(e,n),R(n,{code:L.invalid_string,validation:{endsWith:r.value},message:r.message}),t.dirty()):r.kind===`datetime`?Kn(r).test(e.data)||(n=this._getOrReturnCtx(e,n),R(n,{code:L.invalid_string,validation:`datetime`,message:r.message}),t.dirty()):r.kind===`date`?Un.test(e.data)||(n=this._getOrReturnCtx(e,n),R(n,{code:L.invalid_string,validation:`date`,message:r.message}),t.dirty()):r.kind===`time`?Gn(r).test(e.data)||(n=this._getOrReturnCtx(e,n),R(n,{code:L.invalid_string,validation:`time`,message:r.message}),t.dirty()):r.kind===`duration`?Mn.test(e.data)||(n=this._getOrReturnCtx(e,n),R(n,{validation:`duration`,code:L.invalid_string,message:r.message}),t.dirty()):r.kind===`ip`?qn(e.data,r.version)||(n=this._getOrReturnCtx(e,n),R(n,{validation:`ip`,code:L.invalid_string,message:r.message}),t.dirty()):r.kind===`jwt`?Jn(e.data,r.alg)||(n=this._getOrReturnCtx(e,n),R(n,{validation:`jwt`,code:L.invalid_string,message:r.message}),t.dirty()):r.kind===`cidr`?Yn(e.data,r.version)||(n=this._getOrReturnCtx(e,n),R(n,{validation:`cidr`,code:L.invalid_string,message:r.message}),t.dirty()):r.kind===`base64`?Bn.test(e.data)||(n=this._getOrReturnCtx(e,n),R(n,{validation:`base64`,code:L.invalid_string,message:r.message}),t.dirty()):r.kind===`base64url`?Vn.test(e.data)||(n=this._getOrReturnCtx(e,n),R(n,{validation:`base64url`,code:L.invalid_string,message:r.message}),t.dirty()):ln.assertNever(r);return{status:t.value,value:e.data}}_regex(e,t,n){return this.refinement(t=>e.test(t),{validation:t,code:L.invalid_string,...B.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(e){return this._addCheck({kind:`email`,...B.errToObj(e)})}url(e){return this._addCheck({kind:`url`,...B.errToObj(e)})}emoji(e){return this._addCheck({kind:`emoji`,...B.errToObj(e)})}uuid(e){return this._addCheck({kind:`uuid`,...B.errToObj(e)})}nanoid(e){return this._addCheck({kind:`nanoid`,...B.errToObj(e)})}cuid(e){return this._addCheck({kind:`cuid`,...B.errToObj(e)})}cuid2(e){return this._addCheck({kind:`cuid2`,...B.errToObj(e)})}ulid(e){return this._addCheck({kind:`ulid`,...B.errToObj(e)})}base64(e){return this._addCheck({kind:`base64`,...B.errToObj(e)})}base64url(e){return this._addCheck({kind:`base64url`,...B.errToObj(e)})}jwt(e){return this._addCheck({kind:`jwt`,...B.errToObj(e)})}ip(e){return this._addCheck({kind:`ip`,...B.errToObj(e)})}cidr(e){return this._addCheck({kind:`cidr`,...B.errToObj(e)})}datetime(e){return typeof e==`string`?this._addCheck({kind:`datetime`,precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:`datetime`,precision:e?.precision===void 0?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...B.errToObj(e?.message)})}date(e){return this._addCheck({kind:`date`,message:e})}time(e){return typeof e==`string`?this._addCheck({kind:`time`,precision:null,message:e}):this._addCheck({kind:`time`,precision:e?.precision===void 0?null:e?.precision,...B.errToObj(e?.message)})}duration(e){return this._addCheck({kind:`duration`,...B.errToObj(e)})}regex(e,t){return this._addCheck({kind:`regex`,regex:e,...B.errToObj(t)})}includes(e,t){return this._addCheck({kind:`includes`,value:e,position:t?.position,...B.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:`startsWith`,value:e,...B.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:`endsWith`,value:e,...B.errToObj(t)})}min(e,t){return this._addCheck({kind:`min`,value:e,...B.errToObj(t)})}max(e,t){return this._addCheck({kind:`max`,value:e,...B.errToObj(t)})}length(e,t){return this._addCheck({kind:`length`,value:e,...B.errToObj(t)})}nonempty(e){return this.min(1,B.errToObj(e))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:`trim`}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:`toLowerCase`}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:`toUpperCase`}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind===`datetime`)}get isDate(){return!!this._def.checks.find(e=>e.kind===`date`)}get isTime(){return!!this._def.checks.find(e=>e.kind===`time`)}get isDuration(){return!!this._def.checks.find(e=>e.kind===`duration`)}get isEmail(){return!!this._def.checks.find(e=>e.kind===`email`)}get isURL(){return!!this._def.checks.find(e=>e.kind===`url`)}get isEmoji(){return!!this._def.checks.find(e=>e.kind===`emoji`)}get isUUID(){return!!this._def.checks.find(e=>e.kind===`uuid`)}get isNANOID(){return!!this._def.checks.find(e=>e.kind===`nanoid`)}get isCUID(){return!!this._def.checks.find(e=>e.kind===`cuid`)}get isCUID2(){return!!this._def.checks.find(e=>e.kind===`cuid2`)}get isULID(){return!!this._def.checks.find(e=>e.kind===`ulid`)}get isIP(){return!!this._def.checks.find(e=>e.kind===`ip`)}get isCIDR(){return!!this._def.checks.find(e=>e.kind===`cidr`)}get isBase64(){return!!this._def.checks.find(e=>e.kind===`base64`)}get isBase64url(){return!!this._def.checks.find(e=>e.kind===`base64url`)}get minLength(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}};Xn.create=e=>new Xn({checks:[],typeName:U.ZodString,coerce:e?.coerce??!1,...V(e)});function Zn(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=(t.toString().split(`.`)[1]||``).length,i=n>r?n:r;return Number.parseInt(e.toFixed(i).replace(`.`,``))%Number.parseInt(t.toFixed(i).replace(`.`,``))/10**i}var Qn=class e extends H{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==I.number){let t=this._getOrReturnCtx(e);return R(t,{code:L.invalid_type,expected:I.number,received:t.parsedType}),z}let t,n=new _n;for(let r of this._def.checks)r.kind===`int`?ln.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),R(t,{code:L.invalid_type,expected:`integer`,received:`float`,message:r.message}),n.dirty()):r.kind===`min`?(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),R(t,{code:L.too_small,minimum:r.value,type:`number`,inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty()):r.kind===`max`?(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),R(t,{code:L.too_big,maximum:r.value,type:`number`,inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty()):r.kind===`multipleOf`?Zn(e.data,r.value)!==0&&(t=this._getOrReturnCtx(e,t),R(t,{code:L.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):r.kind===`finite`?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),R(t,{code:L.not_finite,message:r.message}),n.dirty()):ln.assertNever(r);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit(`min`,e,!0,B.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,B.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,B.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,B.toString(t))}setLimit(t,n,r,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:B.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(e){return this._addCheck({kind:`int`,message:B.toString(e)})}positive(e){return this._addCheck({kind:`min`,value:0,inclusive:!1,message:B.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:0,inclusive:!1,message:B.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:0,inclusive:!0,message:B.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:0,inclusive:!0,message:B.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:B.toString(t)})}finite(e){return this._addCheck({kind:`finite`,message:B.toString(e)})}safe(e){return this._addCheck({kind:`min`,inclusive:!0,value:-(2**53-1),message:B.toString(e)})._addCheck({kind:`max`,inclusive:!0,value:2**53-1,message:B.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind===`int`||e.kind===`multipleOf`&&ln.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let n of this._def.checks)if(n.kind===`finite`||n.kind===`int`||n.kind===`multipleOf`)return!0;else n.kind===`min`?(t===null||n.value>t)&&(t=n.value):n.kind===`max`&&(e===null||n.value<e)&&(e=n.value);return Number.isFinite(t)&&Number.isFinite(e)}};Qn.create=e=>new Qn({checks:[],typeName:U.ZodNumber,coerce:e?.coerce||!1,...V(e)});var $n=class e extends H{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==I.bigint)return this._getInvalidInput(e);let t,n=new _n;for(let r of this._def.checks)r.kind===`min`?(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),R(t,{code:L.too_small,type:`bigint`,minimum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty()):r.kind===`max`?(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),R(t,{code:L.too_big,type:`bigint`,maximum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty()):r.kind===`multipleOf`?e.data%r.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),R(t,{code:L.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):ln.assertNever(r);return{status:n.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return R(t,{code:L.invalid_type,expected:I.bigint,received:t.parsedType}),z}gte(e,t){return this.setLimit(`min`,e,!0,B.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,B.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,B.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,B.toString(t))}setLimit(t,n,r,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:B.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(e){return this._addCheck({kind:`min`,value:BigInt(0),inclusive:!1,message:B.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!1,message:B.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!0,message:B.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:BigInt(0),inclusive:!0,message:B.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:B.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}};$n.create=e=>new $n({checks:[],typeName:U.ZodBigInt,coerce:e?.coerce??!1,...V(e)});var er=class extends H{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==I.boolean){let t=this._getOrReturnCtx(e);return R(t,{code:L.invalid_type,expected:I.boolean,received:t.parsedType}),z}return yn(e.data)}};er.create=e=>new er({typeName:U.ZodBoolean,coerce:e?.coerce||!1,...V(e)});var tr=class e extends H{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==I.date){let t=this._getOrReturnCtx(e);return R(t,{code:L.invalid_type,expected:I.date,received:t.parsedType}),z}if(Number.isNaN(e.data.getTime()))return R(this._getOrReturnCtx(e),{code:L.invalid_date}),z;let t=new _n,n;for(let r of this._def.checks)r.kind===`min`?e.data.getTime()<r.value&&(n=this._getOrReturnCtx(e,n),R(n,{code:L.too_small,message:r.message,inclusive:!0,exact:!1,minimum:r.value,type:`date`}),t.dirty()):r.kind===`max`?e.data.getTime()>r.value&&(n=this._getOrReturnCtx(e,n),R(n,{code:L.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:`date`}),t.dirty()):ln.assertNever(r);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(e,t){return this._addCheck({kind:`min`,value:e.getTime(),message:B.toString(t)})}max(e,t){return this._addCheck({kind:`max`,value:e.getTime(),message:B.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e==null?null:new Date(e)}get maxDate(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e==null?null:new Date(e)}};tr.create=e=>new tr({checks:[],coerce:e?.coerce||!1,typeName:U.ZodDate,...V(e)});var nr=class extends H{_parse(e){if(this._getType(e)!==I.symbol){let t=this._getOrReturnCtx(e);return R(t,{code:L.invalid_type,expected:I.symbol,received:t.parsedType}),z}return yn(e.data)}};nr.create=e=>new nr({typeName:U.ZodSymbol,...V(e)});var rr=class extends H{_parse(e){if(this._getType(e)!==I.undefined){let t=this._getOrReturnCtx(e);return R(t,{code:L.invalid_type,expected:I.undefined,received:t.parsedType}),z}return yn(e.data)}};rr.create=e=>new rr({typeName:U.ZodUndefined,...V(e)});var ir=class extends H{_parse(e){if(this._getType(e)!==I.null){let t=this._getOrReturnCtx(e);return R(t,{code:L.invalid_type,expected:I.null,received:t.parsedType}),z}return yn(e.data)}};ir.create=e=>new ir({typeName:U.ZodNull,...V(e)});var ar=class extends H{constructor(){super(...arguments),this._any=!0}_parse(e){return yn(e.data)}};ar.create=e=>new ar({typeName:U.ZodAny,...V(e)});var or=class extends H{constructor(){super(...arguments),this._unknown=!0}_parse(e){return yn(e.data)}};or.create=e=>new or({typeName:U.ZodUnknown,...V(e)});var sr=class extends H{_parse(e){let t=this._getOrReturnCtx(e);return R(t,{code:L.invalid_type,expected:I.never,received:t.parsedType}),z}};sr.create=e=>new sr({typeName:U.ZodNever,...V(e)});var cr=class extends H{_parse(e){if(this._getType(e)!==I.undefined){let t=this._getOrReturnCtx(e);return R(t,{code:L.invalid_type,expected:I.void,received:t.parsedType}),z}return yn(e.data)}};cr.create=e=>new cr({typeName:U.ZodVoid,...V(e)});var lr=class e extends H{_parse(e){let{ctx:t,status:n}=this._processInputParams(e),r=this._def;if(t.parsedType!==I.array)return R(t,{code:L.invalid_type,expected:I.array,received:t.parsedType}),z;if(r.exactLength!==null){let e=t.data.length>r.exactLength.value,i=t.data.length<r.exactLength.value;(e||i)&&(R(t,{code:e?L.too_big:L.too_small,minimum:i?r.exactLength.value:void 0,maximum:e?r.exactLength.value:void 0,type:`array`,inclusive:!0,exact:!0,message:r.exactLength.message}),n.dirty())}if(r.minLength!==null&&t.data.length<r.minLength.value&&(R(t,{code:L.too_small,minimum:r.minLength.value,type:`array`,inclusive:!0,exact:!1,message:r.minLength.message}),n.dirty()),r.maxLength!==null&&t.data.length>r.maxLength.value&&(R(t,{code:L.too_big,maximum:r.maxLength.value,type:`array`,inclusive:!0,exact:!1,message:r.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((e,n)=>r.type._parseAsync(new wn(t,e,t.path,n)))).then(e=>_n.mergeArray(n,e));let i=[...t.data].map((e,n)=>r.type._parseSync(new wn(t,e,t.path,n)));return _n.mergeArray(n,i)}get element(){return this._def.type}min(t,n){return new e({...this._def,minLength:{value:t,message:B.toString(n)}})}max(t,n){return new e({...this._def,maxLength:{value:t,message:B.toString(n)}})}length(t,n){return new e({...this._def,exactLength:{value:t,message:B.toString(n)}})}nonempty(e){return this.min(1,e)}};lr.create=(e,t)=>new lr({type:e,minLength:null,maxLength:null,exactLength:null,typeName:U.ZodArray,...V(t)});function ur(e){if(e instanceof dr){let t={};for(let n in e.shape){let r=e.shape[n];t[n]=kr.create(ur(r))}return new dr({...e._def,shape:()=>t})}return e instanceof lr?new lr({...e._def,type:ur(e.element)}):e instanceof kr?kr.create(ur(e.unwrap())):e instanceof Ar?Ar.create(ur(e.unwrap())):e instanceof _r?_r.create(e.items.map(e=>ur(e))):e}var dr=class e extends H{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=ln.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==I.object){let t=this._getOrReturnCtx(e);return R(t,{code:L.invalid_type,expected:I.object,received:t.parsedType}),z}let{status:t,ctx:n}=this._processInputParams(e),{shape:r,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof sr&&this._def.unknownKeys===`strip`))for(let e in n.data)i.includes(e)||a.push(e);let o=[];for(let e of i){let t=r[e],i=n.data[e];o.push({key:{status:`valid`,value:e},value:t._parse(new wn(n,i,n.path,e)),alwaysSet:e in n.data})}if(this._def.catchall instanceof sr){let e=this._def.unknownKeys;if(e===`passthrough`)for(let e of a)o.push({key:{status:`valid`,value:e},value:{status:`valid`,value:n.data[e]}});else if(e===`strict`)a.length>0&&(R(n,{code:L.unrecognized_keys,keys:a}),t.dirty());else if(e!==`strip`)throw Error(`Internal ZodObject error: invalid unknownKeys value.`)}else{let e=this._def.catchall;for(let t of a){let r=n.data[t];o.push({key:{status:`valid`,value:t},value:e._parse(new wn(n,r,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let e=[];for(let t of o){let n=await t.key,r=await t.value;e.push({key:n,value:r,alwaysSet:t.alwaysSet})}return e}).then(e=>_n.mergeObjectSync(t,e)):_n.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(t){return B.errToObj,new e({...this._def,unknownKeys:`strict`,...t===void 0?{}:{errorMap:(e,n)=>{let r=this._def.errorMap?.(e,n).message??n.defaultError;return e.code===`unrecognized_keys`?{message:B.errToObj(t).message??r}:{message:r}}}})}strip(){return new e({...this._def,unknownKeys:`strip`})}passthrough(){return new e({...this._def,unknownKeys:`passthrough`})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:U.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let n={};for(let e of ln.objectKeys(t))t[e]&&this.shape[e]&&(n[e]=this.shape[e]);return new e({...this._def,shape:()=>n})}omit(t){let n={};for(let e of ln.objectKeys(this.shape))t[e]||(n[e]=this.shape[e]);return new e({...this._def,shape:()=>n})}deepPartial(){return ur(this)}partial(t){let n={};for(let e of ln.objectKeys(this.shape)){let r=this.shape[e];n[e]=t&&!t[e]?r:r.optional()}return new e({...this._def,shape:()=>n})}required(t){let n={};for(let e of ln.objectKeys(this.shape))if(t&&!t[e])n[e]=this.shape[e];else{let t=this.shape[e];for(;t instanceof kr;)t=t._def.innerType;n[e]=t}return new e({...this._def,shape:()=>n})}keyof(){return wr(ln.objectKeys(this.shape))}};dr.create=(e,t)=>new dr({shape:()=>e,unknownKeys:`strip`,catchall:sr.create(),typeName:U.ZodObject,...V(t)}),dr.strictCreate=(e,t)=>new dr({shape:()=>e,unknownKeys:`strict`,catchall:sr.create(),typeName:U.ZodObject,...V(t)}),dr.lazycreate=(e,t)=>new dr({shape:e,unknownKeys:`strip`,catchall:sr.create(),typeName:U.ZodObject,...V(t)});var fr=class extends H{_parse(e){let{ctx:t}=this._processInputParams(e),n=this._def.options;function r(e){for(let t of e)if(t.result.status===`valid`)return t.result;for(let n of e)if(n.result.status===`dirty`)return t.common.issues.push(...n.ctx.common.issues),n.result;let n=e.map(e=>new fn(e.ctx.common.issues));return R(t,{code:L.invalid_union,unionErrors:n}),z}if(t.common.async)return Promise.all(n.map(async e=>{let n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}})).then(r);{let e,r=[];for(let i of n){let n={...t,common:{...t.common,issues:[]},parent:null},a=i._parseSync({data:t.data,path:t.path,parent:n});if(a.status===`valid`)return a;a.status===`dirty`&&!e&&(e={result:a,ctx:n}),n.common.issues.length&&r.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;let i=r.map(e=>new fn(e));return R(t,{code:L.invalid_union,unionErrors:i}),z}}get options(){return this._def.options}};fr.create=(e,t)=>new fr({options:e,typeName:U.ZodUnion,...V(t)});var pr=e=>e instanceof Sr?pr(e.schema):e instanceof Or?pr(e.innerType()):e instanceof Cr?[e.value]:e instanceof Tr?e.options:e instanceof Er?ln.objectValues(e.enum):e instanceof jr?pr(e._def.innerType):e instanceof rr?[void 0]:e instanceof ir?[null]:e instanceof kr?[void 0,...pr(e.unwrap())]:e instanceof Ar?[null,...pr(e.unwrap())]:e instanceof Pr||e instanceof Ir?pr(e.unwrap()):e instanceof Mr?pr(e._def.innerType):[],mr=class e extends H{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==I.object)return R(t,{code:L.invalid_type,expected:I.object,received:t.parsedType}),z;let n=this.discriminator,r=t.data[n],i=this.optionsMap.get(r);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(R(t,{code:L.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),z)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){let i=new Map;for(let e of n){let n=pr(e.shape[t]);if(!n.length)throw Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let r of n){if(i.has(r))throw Error(`Discriminator property ${String(t)} has duplicate value ${String(r)}`);i.set(r,e)}}return new e({typeName:U.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:i,...V(r)})}};function hr(e,t){let n=dn(e),r=dn(t);if(e===t)return{valid:!0,data:e};if(n===I.object&&r===I.object){let n=ln.objectKeys(t),r=ln.objectKeys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=hr(e[n],t[n]);if(!r.valid)return{valid:!1};i[n]=r.data}return{valid:!0,data:i}}if(n===I.array&&r===I.array){if(e.length!==t.length)return{valid:!1};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=hr(i,a);if(!o.valid)return{valid:!1};n.push(o.data)}return{valid:!0,data:n}}return n===I.date&&r===I.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var gr=class extends H{_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=(e,r)=>{if(bn(e)||bn(r))return z;let i=hr(e.value,r.value);return i.valid?((xn(e)||xn(r))&&t.dirty(),{status:t.value,value:i.data}):(R(n,{code:L.invalid_intersection_types}),z)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([e,t])=>r(e,t)):r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};gr.create=(e,t,n)=>new gr({left:e,right:t,typeName:U.ZodIntersection,...V(n)});var _r=class e extends H{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==I.array)return R(n,{code:L.invalid_type,expected:I.array,received:n.parsedType}),z;if(n.data.length<this._def.items.length)return R(n,{code:L.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:`array`}),z;!this._def.rest&&n.data.length>this._def.items.length&&(R(n,{code:L.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:`array`}),t.dirty());let r=[...n.data].map((e,t)=>{let r=this._def.items[t]||this._def.rest;return r?r._parse(new wn(n,e,n.path,t)):null}).filter(e=>!!e);return n.common.async?Promise.all(r).then(e=>_n.mergeArray(t,e)):_n.mergeArray(t,r)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};_r.create=(e,t)=>{if(!Array.isArray(e))throw Error(`You must pass an array of schemas to z.tuple([ ... ])`);return new _r({items:e,typeName:U.ZodTuple,rest:null,...V(t)})};var vr=class e extends H{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==I.object)return R(n,{code:L.invalid_type,expected:I.object,received:n.parsedType}),z;let r=[],i=this._def.keyType,a=this._def.valueType;for(let e in n.data)r.push({key:i._parse(new wn(n,e,n.path,e)),value:a._parse(new wn(n,n.data[e],n.path,e)),alwaysSet:e in n.data});return n.common.async?_n.mergeObjectAsync(t,r):_n.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof H?new e({keyType:t,valueType:n,typeName:U.ZodRecord,...V(r)}):new e({keyType:Xn.create(),valueType:t,typeName:U.ZodRecord,...V(n)})}},yr=class extends H{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==I.map)return R(n,{code:L.invalid_type,expected:I.map,received:n.parsedType}),z;let r=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([e,t],a)=>({key:r._parse(new wn(n,e,n.path,[a,`key`])),value:i._parse(new wn(n,t,n.path,[a,`value`]))}));if(n.common.async){let e=new Map;return Promise.resolve().then(async()=>{for(let n of a){let r=await n.key,i=await n.value;if(r.status===`aborted`||i.status===`aborted`)return z;(r.status===`dirty`||i.status===`dirty`)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}})}{let e=new Map;for(let n of a){let r=n.key,i=n.value;if(r.status===`aborted`||i.status===`aborted`)return z;(r.status===`dirty`||i.status===`dirty`)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}}}};yr.create=(e,t,n)=>new yr({valueType:t,keyType:e,typeName:U.ZodMap,...V(n)});var br=class e extends H{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==I.set)return R(n,{code:L.invalid_type,expected:I.set,received:n.parsedType}),z;let r=this._def;r.minSize!==null&&n.data.size<r.minSize.value&&(R(n,{code:L.too_small,minimum:r.minSize.value,type:`set`,inclusive:!0,exact:!1,message:r.minSize.message}),t.dirty()),r.maxSize!==null&&n.data.size>r.maxSize.value&&(R(n,{code:L.too_big,maximum:r.maxSize.value,type:`set`,inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());let i=this._def.valueType;function a(e){let n=new Set;for(let r of e){if(r.status===`aborted`)return z;r.status===`dirty`&&t.dirty(),n.add(r.value)}return{status:t.value,value:n}}let o=[...n.data.values()].map((e,t)=>i._parse(new wn(n,e,n.path,t)));return n.common.async?Promise.all(o).then(e=>a(e)):a(o)}min(t,n){return new e({...this._def,minSize:{value:t,message:B.toString(n)}})}max(t,n){return new e({...this._def,maxSize:{value:t,message:B.toString(n)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};br.create=(e,t)=>new br({valueType:e,minSize:null,maxSize:null,typeName:U.ZodSet,...V(t)});var xr=class e extends H{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==I.function)return R(t,{code:L.invalid_type,expected:I.function,received:t.parsedType}),z;function n(e,n){return gn({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,hn(),pn].filter(e=>!!e),issueData:{code:L.invalid_arguments,argumentsError:n}})}function r(e,n){return gn({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,hn(),pn].filter(e=>!!e),issueData:{code:L.invalid_return_type,returnTypeError:n}})}let i={errorMap:t.common.contextualErrorMap},a=t.data;if(this._def.returns instanceof Dr){let e=this;return yn(async function(...t){let o=new fn([]),s=await e._def.args.parseAsync(t,i).catch(e=>{throw o.addIssue(n(t,e)),o}),c=await Reflect.apply(a,this,s);return await e._def.returns._def.type.parseAsync(c,i).catch(e=>{throw o.addIssue(r(c,e)),o})})}{let e=this;return yn(function(...t){let o=e._def.args.safeParse(t,i);if(!o.success)throw new fn([n(t,o.error)]);let s=Reflect.apply(a,this,o.data),c=e._def.returns.safeParse(s,i);if(!c.success)throw new fn([r(s,c.error)]);return c.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:_r.create(t).rest(or.create())})}returns(t){return new e({...this._def,returns:t})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(t,n,r){return new e({args:t||_r.create([]).rest(or.create()),returns:n||or.create(),typeName:U.ZodFunction,...V(r)})}},Sr=class extends H{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};Sr.create=(e,t)=>new Sr({getter:e,typeName:U.ZodLazy,...V(t)});var Cr=class extends H{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return R(t,{received:t.data,code:L.invalid_literal,expected:this._def.value}),z}return{status:`valid`,value:e.data}}get value(){return this._def.value}};Cr.create=(e,t)=>new Cr({value:e,typeName:U.ZodLiteral,...V(t)});function wr(e,t){return new Tr({values:e,typeName:U.ZodEnum,...V(t)})}var Tr=class e extends H{_parse(e){if(typeof e.data!=`string`){let t=this._getOrReturnCtx(e),n=this._def.values;return R(t,{expected:ln.joinValues(n),received:t.parsedType,code:L.invalid_type}),z}if(this._cache||=new Set(this._def.values),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),n=this._def.values;return R(t,{received:t.data,code:L.invalid_enum_value,options:n}),z}return yn(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(t,n=this._def){return e.create(t,{...this._def,...n})}exclude(t,n=this._def){return e.create(this.options.filter(e=>!t.includes(e)),{...this._def,...n})}};Tr.create=wr;var Er=class extends H{_parse(e){let t=ln.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==I.string&&n.parsedType!==I.number){let e=ln.objectValues(t);return R(n,{expected:ln.joinValues(e),received:n.parsedType,code:L.invalid_type}),z}if(this._cache||=new Set(ln.getValidEnumValues(this._def.values)),!this._cache.has(e.data)){let e=ln.objectValues(t);return R(n,{received:n.data,code:L.invalid_enum_value,options:e}),z}return yn(e.data)}get enum(){return this._def.values}};Er.create=(e,t)=>new Er({values:e,typeName:U.ZodNativeEnum,...V(t)});var Dr=class extends H{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);return t.parsedType!==I.promise&&t.common.async===!1?(R(t,{code:L.invalid_type,expected:I.promise,received:t.parsedType}),z):yn((t.parsedType===I.promise?t.data:Promise.resolve(t.data)).then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}};Dr.create=(e,t)=>new Dr({type:e,typeName:U.ZodPromise,...V(t)});var Or=class extends H{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===U.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=this._def.effect||null,i={addIssue:e=>{R(n,e),e.fatal?t.abort():t.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),r.type===`preprocess`){let e=r.transform(n.data,i);if(n.common.async)return Promise.resolve(e).then(async e=>{if(t.value===`aborted`)return z;let r=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return r.status===`aborted`?z:r.status===`dirty`||t.value===`dirty`?vn(r.value):r});{if(t.value===`aborted`)return z;let r=this._def.schema._parseSync({data:e,path:n.path,parent:n});return r.status===`aborted`?z:r.status===`dirty`||t.value===`dirty`?vn(r.value):r}}if(r.type===`refinement`){let e=e=>{let t=r.refinement(e,i);if(n.common.async)return Promise.resolve(t);if(t instanceof Promise)throw Error(`Async refinement encountered during synchronous parse operation. Use .parseAsync instead.`);return e};if(n.common.async===!1){let r=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return r.status===`aborted`?z:(r.status===`dirty`&&t.dirty(),e(r.value),{status:t.value,value:r.value})}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(n=>n.status===`aborted`?z:(n.status===`dirty`&&t.dirty(),e(n.value).then(()=>({status:t.value,value:n.value}))))}if(r.type===`transform`){if(n.common.async===!1){let e=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Sn(e))return z;let a=r.transform(e.value,i);if(a instanceof Promise)throw Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);return{status:t.value,value:a}}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(e=>Sn(e)?Promise.resolve(r.transform(e.value,i)).then(e=>({status:t.value,value:e})):z)}ln.assertNever(r)}};Or.create=(e,t,n)=>new Or({schema:e,typeName:U.ZodEffects,effect:t,...V(n)}),Or.createWithPreprocess=(e,t,n)=>new Or({schema:t,effect:{type:`preprocess`,transform:e},typeName:U.ZodEffects,...V(n)});var kr=class extends H{_parse(e){return this._getType(e)===I.undefined?yn(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};kr.create=(e,t)=>new kr({innerType:e,typeName:U.ZodOptional,...V(t)});var Ar=class extends H{_parse(e){return this._getType(e)===I.null?yn(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Ar.create=(e,t)=>new Ar({innerType:e,typeName:U.ZodNullable,...V(t)});var jr=class extends H{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return t.parsedType===I.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};jr.create=(e,t)=>new jr({innerType:e,typeName:U.ZodDefault,defaultValue:typeof t.default==`function`?t.default:()=>t.default,...V(t)});var Mr=class extends H{_parse(e){let{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Cn(r)?r.then(e=>({status:`valid`,value:e.status===`valid`?e.value:this._def.catchValue({get error(){return new fn(n.common.issues)},input:n.data})})):{status:`valid`,value:r.status===`valid`?r.value:this._def.catchValue({get error(){return new fn(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Mr.create=(e,t)=>new Mr({innerType:e,typeName:U.ZodCatch,catchValue:typeof t.catch==`function`?t.catch:()=>t.catch,...V(t)});var Nr=class extends H{_parse(e){if(this._getType(e)!==I.nan){let t=this._getOrReturnCtx(e);return R(t,{code:L.invalid_type,expected:I.nan,received:t.parsedType}),z}return{status:`valid`,value:e.data}}};Nr.create=e=>new Nr({typeName:U.ZodNaN,...V(e)});var Pr=class extends H{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}},Fr=class e extends H{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return e.status===`aborted`?z:e.status===`dirty`?(t.dirty(),vn(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})();{let e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return e.status===`aborted`?z:e.status===`dirty`?(t.dirty(),{status:`dirty`,value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(t,n){return new e({in:t,out:n,typeName:U.ZodPipeline})}},Ir=class extends H{_parse(e){let t=this._def.innerType._parse(e),n=e=>(Sn(e)&&(e.value=Object.freeze(e.value)),e);return Cn(t)?t.then(e=>n(e)):n(t)}unwrap(){return this._def.innerType}};Ir.create=(e,t)=>new Ir({innerType:e,typeName:U.ZodReadonly,...V(t)}),dr.lazycreate;var U;(function(e){e.ZodString=`ZodString`,e.ZodNumber=`ZodNumber`,e.ZodNaN=`ZodNaN`,e.ZodBigInt=`ZodBigInt`,e.ZodBoolean=`ZodBoolean`,e.ZodDate=`ZodDate`,e.ZodSymbol=`ZodSymbol`,e.ZodUndefined=`ZodUndefined`,e.ZodNull=`ZodNull`,e.ZodAny=`ZodAny`,e.ZodUnknown=`ZodUnknown`,e.ZodNever=`ZodNever`,e.ZodVoid=`ZodVoid`,e.ZodArray=`ZodArray`,e.ZodObject=`ZodObject`,e.ZodUnion=`ZodUnion`,e.ZodDiscriminatedUnion=`ZodDiscriminatedUnion`,e.ZodIntersection=`ZodIntersection`,e.ZodTuple=`ZodTuple`,e.ZodRecord=`ZodRecord`,e.ZodMap=`ZodMap`,e.ZodSet=`ZodSet`,e.ZodFunction=`ZodFunction`,e.ZodLazy=`ZodLazy`,e.ZodLiteral=`ZodLiteral`,e.ZodEnum=`ZodEnum`,e.ZodEffects=`ZodEffects`,e.ZodNativeEnum=`ZodNativeEnum`,e.ZodOptional=`ZodOptional`,e.ZodNullable=`ZodNullable`,e.ZodDefault=`ZodDefault`,e.ZodCatch=`ZodCatch`,e.ZodPromise=`ZodPromise`,e.ZodBranded=`ZodBranded`,e.ZodPipeline=`ZodPipeline`,e.ZodReadonly=`ZodReadonly`})(U||={});var Lr=Xn.create,Rr=Qn.create;Nr.create,$n.create;var zr=er.create;tr.create,nr.create,rr.create;var Br=ir.create;ar.create;var Vr=or.create;sr.create,cr.create;var W=lr.create,G=dr.create;dr.strictCreate;var Hr=fr.create,Ur=mr.create;gr.create;var Wr=_r.create,Gr=vr.create;yr.create,br.create,xr.create,Sr.create;var K=Cr.create,Kr=Tr.create;Er.create,Dr.create,Or.create,kr.create,Ar.create,Or.createWithPreprocess,Fr.create;var qr=G({code:Kr([`invalid_shape`,`config_root_unresolvable`,`daemon_unreachable`,`unauthorized`,`report_failed`,`service_unregistrable`,`durable_store_unusable`,`storage_fault`,`unknown_subcommand`,`login_failed`,`identity_not_found`]),attempted:Lr(),message:Lr()}).strict();function Jr(e,t,n){return{code:e,attempted:t,message:n}}function Yr(e,t,n){return cn(Jr(e,t,n))}var Xr=`/api/health`,Zr=`/api/registration`,Qr=`/api/feedback`,$r=`/api/update`,ei=`/api/topology/pending-review`,ti=`/api/topology/review/hierarchy`,ni=`/api/topology/review/environment`,ri=`/api/topology/review/hierarchy/commit`,ii=`/api/topology/review/environment/commit`,ai=`/api/topology/review/stage`,oi=`/api/topology`,si=`/api/identity/enumerate`,ci=`/api/identity`,li=`/api/identity/trust`,ui=`/api/identity/verify`,di=`/api/identity`,fi=`x-operator-token`,pi=G({source:Kr([`daemon`,`mcp-server`]),contract:Rr().int().nonnegative(),version:Lr().min(1),asOf:Lr().datetime(),provenance:Lr().min(1)});function mi(e){return pi.extend({value:e})}var hi=Kr([`open`,`unreadable`]),gi=mi(G({durableStore:hi,runtimeStore:hi,surface:Lr().url()})),_i=5e3,vi=G({feedback:Lr().trim().min(1,`Feedback is required`).max(_i,`Feedback must be ${String(_i)} characters or fewer`)}).strict(),yi=mi(G({submitted:K(!0)}).strict());G({path:Lr().trim().min(1,`path is required`)}),mi(G({recorded:zr()}));var q=Lr().trim().min(1),bi=Kr([`app`,`iac`,`mixed`]),xi=Kr([`application`,`environment`,`service`,`service_instance`,`system_ref`,`repo`]);G({kind:xi,key:q}).strict();var Si=G({applicationKey:q,name:q}).strict(),Ci=G({environmentKey:q,applicationKey:q,name:q}).strict(),wi=G({serviceKey:q,name:q,description:q.nullish()}).strict(),Ti=G({serviceInstanceKey:q,environmentKey:q,serviceKey:q,name:q}).strict(),Ei=G({systemRefKey:q,provider:q,kind:q,name:q.nullish(),source:q.nullish()}).strict(),Di=G({repoKey:q,name:q,role:bi,remoteUrl:q.nullish()}).strict();G({repoKey:q,name:q,role:bi.nullable(),remoteUrl:q.nullish()}).strict();var Oi=G({repoKey:q,localPath:q,branch:q.nullable(),commitSha:q.nullable(),dirty:zr(),detachedHead:zr(),discoveryRunFingerprint:q,scanSourceKey:q,scannedAt:q}).strict();G({applicationKey:q,serviceKey:q}).strict(),Ur(`kind`,[G({kind:K(`application`),payload:Si}).strict(),G({kind:K(`environment`),payload:Ci}).strict(),G({kind:K(`service`),payload:wi}).strict(),G({kind:K(`service_instance`),payload:Ti}).strict(),G({kind:K(`system_ref`),payload:Ei}).strict(),G({kind:K(`repo`),payload:Di}).strict()]);var ki=2e4;function Ai(e,t,n){if(e===`aws`)return ji(t,n);let r=Mi[e];return r===void 0?null:r(t)}function ji(e,t){if(t===void 0)return{caveat:`if this is an SSO profile`,command:`aws sso login --profile ${e}`};switch(t.kind){case`sso`:return{command:`aws sso login --profile ${e}`};case`static-keys`:return{caveat:`static access keys; there is no login to run, only new keys to configure if these stop working`,command:`aws configure list --profile ${e}`};case`assume-role`:return{caveat:`assumes ${t.sourceProfile}'s role; that profile's own login is what actually matters`,command:`aws sts get-caller-identity --profile ${t.sourceProfile}`};case`credential-process`:return{caveat:`refreshed by a credential_process this cannot run for you`,command:`aws configure list --profile ${e}`};case`unknown`:return{caveat:`if this is an SSO profile`,command:`aws sso login --profile ${e}`}}}var Mi={azure:e=>({command:`az login --use-device-code && az account set --subscription ${e}`}),kubernetes:e=>({command:`kubectl config view --minify --context ${e}`}),github:e=>({command:`gh auth login --hostname ${e}`}),gitlab:e=>({command:`glab auth login --hostname ${e}`})},Ni=G({provider:q,selector:q,alias:q.nullable(),approvedAt:q,lastSuccessAt:q.nullable(),consecutiveFailures:Rr().int().nonnegative()}).strict(),Pi=[/^AKIA[0-9A-Z]{16}$/,/^ASIA[0-9A-Z]{16}$/,/^[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+$/,/^gh[pousr]_[A-Za-z0-9]{36,}$/,/^glpat-[A-Za-z0-9_-]{20,}$/];function Fi(e){return Pi.some(t=>t.test(e.trim()))}var Ii=q.refine(e=>!Fi(e),`selector looks like credential material, not a bare label`);G({provider:q,selector:q}).strict(),G({provider:q,selector:Ii,alias:q.nullish()}).strict(),G({provider:q,selector:q,succeeded:zr()}).strict(),mi(G({identity:Ni.nullable()}));var Li=mi(G({identities:W(Ni)})),Ri=mi(G({identity:Ni,created:zr()})),zi=mi(G({succeeded:zr(),message:q.nullable()})),Bi=mi(G({removed:zr()}));mi(G({identity:Ni}));var Vi=mi(G({candidates:W(G({provider:q,selector:q,awsMechanism:Ur(`kind`,[G({kind:K(`sso`)}).strict(),G({kind:K(`static-keys`)}).strict(),G({kind:K(`assume-role`),sourceProfile:q}).strict(),G({kind:K(`credential-process`)}).strict(),G({kind:K(`unknown`)}).strict()]).optional()}).strict())}));function Hi(e){return Lr().trim().min(1,`${e} is required`)}var Ui=G({firstName:Hi(`First name`),lastName:Hi(`Last name`),email:Lr().trim().email(`Enter a well formed email address`),company:Hi(`Company`),title:Lr().trim().default(``)});function Wi(e){let t=e.email.trim(),n=e=>e.trim().length===0?t:e;return{firstName:n(e.firstName),lastName:n(e.lastName),email:t,company:n(e.company),title:e.title}}var Gi=mi(G({registered:zr()})),Ki=`/register`;mi(G({enabled:zr()})),G({enabled:zr()}).strict();var qi=Lr().trim().min(1).max(64);G({tool:qi,provider:qi.nullish()}).strict(),mi(G({recorded:zr()}));function Ji(e,t,n){let r=e.safeParse(t);return r.success?sn(r.data):Yr(`invalid_shape`,n,r.error.issues.map(e=>`${e.path.join(`.`)||`(root)`}: ${e.message}`).join(`; `))}var Yi=mi(G({status:Kr([`ineligible`,`disabled`,`checking`]),newerVersion:Lr().nullable()})),Xi=5e3;function Zi({origin:e,token:t}){return async({method:n,path:r,schema:i,attempted:a,body:o,timeoutMs:s})=>{let c=e===``?r:`${e}${r}`,l;try{l=await fetch(c,{method:n,signal:AbortSignal.timeout(s??Xi),headers:{[fi]:t,...o===void 0?{}:{"content-type":`application/json`}},...o===void 0?{}:{body:JSON.stringify(o)}})}catch(e){return Yr(`daemon_unreachable`,a,`no answer from ${c}: ${String(e)}`)}if(l.status===401)return Yr(`unauthorized`,a,`the daemon refused this token; it mints a new one every time it restarts`);if(!l.ok){let e=await l.json().catch(()=>null),t=qr.safeParse(e);return t.success?cn(t.data):Yr(`daemon_unreachable`,a,`the daemon answered ${String(l.status)}`)}return Ji(i,await l.json(),a)}}var Qi=e=>G({kind:Kr(e),key:q}).strict(),$i=Qi([`environment`]),ea=Qi([`service`]),ta=Qi([`service_instance`]),na=Qi([`system_ref`]),ra=Qi([`repo`]),ia=Qi([`application`]),aa=G({source:$i,target:na}).strict(),oa=G({source:Hr([$i,ta]),target:na}).strict(),sa=G({source:na,target:na}).strict(),ca=G({source:Hr([ia,ea]),target:ra}).strict(),la=G({source:Hr([$i,ta]),target:ra}).strict(),ua=G({source:Hr([$i,ta]),target:na}).strict(),da=Kr([`connected_via`,`observed_by`,`accessed_via`,`implemented_in`,`deployed_from`,`provided_as`]);Ur(`kind`,[G({kind:K(`connected_via`),payload:aa}).strict(),G({kind:K(`observed_by`),payload:oa}).strict(),G({kind:K(`accessed_via`),payload:sa}).strict(),G({kind:K(`implemented_in`),payload:ca}).strict(),G({kind:K(`deployed_from`),payload:la}).strict(),G({kind:K(`provided_as`),payload:ua}).strict()]);var fa=Kr([`repo_file`,`api_response`,`operator_note`,`derived_note`]),pa=q.refine(e=>{let t=new Date(e);return!Number.isNaN(t.valueOf())&&t.toISOString()===e},`Expected ISO timestamp.`),ma=G({kind:K(`repo_file`),repoKey:q,scanSourceKey:q.optional(),path:q,line:Rr().int().positive(),commitSha:q,dirty:zr(),snippet:Lr().refine(e=>e.trim().length>0,`Expected non-blank snippet.`).optional(),repoScanId:Rr().int().positive().optional()}).strict(),ha=G({kind:K(`api_response`),systemKey:q,capturedAt:pa,summary:q.optional(),locator:q.optional()}).strict(),ga=G({kind:K(`operator_note`),text:q,createdAt:pa}).strict(),_a=Kr([`legacy_migration`,`uncited_observation`,`name_match`]),va=Ur(`kind`,[ma,ha,ga,G({kind:K(`derived_note`),text:q,createdAt:pa,origin:_a}).strict()]);W(va);var ya=W(va).min(1),ba={applications:25,services:25,memberships:24,implementations:48,repos:48,facts:128,citations:128,environments:25,serviceInstances:48,deployedFrom:48,connectedVia:24};G({applications:K(ba.applications),services:K(ba.services),memberships:K(ba.memberships),implementations:K(ba.implementations),repos:K(ba.repos),facts:K(ba.facts),citations:K(ba.citations),environments:K(ba.environments),serviceInstances:K(ba.serviceInstances),deployedFrom:K(ba.deployedFrom),connectedVia:K(ba.connectedVia)}).strict();var xa=G({kind:Kr([`application`,`service`,`repo`,`environment`,`service_instance`,`system_ref`]),displayName:q,diagnostic:G({canonicalKey:q,visibility:K(`diagnostic_only`)}).strip()}).strip(),Sa=G({kind:Kr([`application`,`service`,`environment`,`service_instance`,`application_service_membership`,`implemented_in`,`deployed_from`,`connected_via`]),canonicalFactKey:q,citationKeys:W(q)}).strip(),Ca=G({key:q,kind:fa,label:q,labelTruncated:zr()}).strip(),wa=G({application:xa,service:xa,canonicalFactKey:q,citationKeys:W(q)}).strip(),Ta=G({source:xa,repo:xa,canonicalFactKey:q,citationKeys:W(q)}).strip(),Ea=G({source:xa,repo:xa,canonicalFactKey:q,citationKeys:W(q),note:q}).strip(),Da=G({environment:xa,system:xa,canonicalFactKey:q,citationKeys:W(q)}).strip(),Oa=G({parentEnvironment:xa,deployedFrom:W(Ea),connectedVia:W(Da),label:K(`supplemental_inherited_operational_context`),note:q}).strip(),ka=G({applications:zr(),services:zr(),memberships:zr(),implementations:zr(),repos:zr(),facts:zr(),citations:zr(),environments:zr(),serviceInstances:zr(),deployedFrom:zr(),connectedVia:zr()}).strip(),Aa=mi(G({matched:xa,applications:W(xa),services:W(xa),environments:W(xa),serviceInstances:W(xa),repos:W(xa),memberships:W(wa),implementations:W(Ta),directDeploymentProvenance:W(Ea),providerAssociations:W(Da),inheritedOperationalContext:Oa.optional(),facts:W(Sa),citations:W(Ca),truncation:ka}).strip()).extend({source:K(`daemon`)}),ja=Wr([K(`application`),K(`service`),K(`environment`),K(`service_instance`)]),Ma=G({subjectKinds:ja,aliasKinds:Wr([K(`application`),K(`service`)])}).strip(),Na=mi(G({code:K(`topology_subject_not_found`),message:q,searchScope:Ma}).strip()).extend({source:K(`daemon`)}),Pa=xa.extend({kind:Kr([`application`,`service`,`environment`,`service_instance`])});Hr([Hr([Aa,Na,mi(G({code:K(`topology_subject_ambiguous`),message:q,searchScope:G({subjectKinds:ja}).strip(),matches:W(Pa).min(2).max(25),matchesTruncated:zr(),retryWith:K(`canonical_key`)}).strip()).extend({source:K(`daemon`)})]),G({code:K(`registration_required`),attempted:K(`look up committed topology`),message:q}).strip(),G({code:Kr([`topology_lookup_invalid_input`,`topology_lookup_input_too_large`]),attempted:K(`look up committed topology`),message:q}).strip(),G({code:K(`topology_lookup_output_too_large`),attempted:K(`serialize a committed topology lookup`),message:q}).strip(),G({code:K(`topology_storage_fault`),attempted:K(`project a committed topology neighborhood`),message:q}).strip()]);var Fa=K(`currently_reviewable_topology_candidates_v1`),Ia=mi(G({count:Rr().int().nonnegative(),scope:Fa}).strip()).extend({source:K(`daemon`)});Kr([`repo_role`,`application`,`service`,`application_service_membership`,`implemented_in`,`environment`,`service_instance`,`deployed_from`,`connected_via`]);var La=Kr([`hierarchy`,`environment`]),Ra=G({repoKey:q,role:bi,hasApplication:zr(),hasService:zr(),hasIac:zr()}).strict(),za=G({applicationKey:q,name:q,aliases:W(q)}).strict(),Ba=G({serviceKey:q,name:q,aliases:W(q),description:q.optional(),derivedFromRepoIdentity:zr(),owningRepoKey:q.nullable().optional(),serviceCardinality:Rr().int().positive().optional(),serviceDiscriminator:q.optional()}).strict(),Va=G({applicationKey:q,serviceKey:q}).strict(),Ha=ca,Ua=G({environmentKey:q,applicationKey:q,name:q}).strict(),Wa=G({serviceInstanceKey:q,environmentKey:q,applicationKey:q,logicalServiceKey:q,name:q}).strict(),Ga=la,Ka=G({environmentKey:q,systemKey:q,provider:q,authorityKind:q,authorityDisplayName:q,contributingCandidateId:q.optional()}).strict(),qa=Ur(`kind`,[G({kind:K(`repo_role`),reviewScope:K(`hierarchy`),payload:Ra}).strict(),G({kind:K(`application`),reviewScope:K(`hierarchy`),payload:za}).strict(),G({kind:K(`service`),reviewScope:K(`hierarchy`),payload:Ba}).strict(),G({kind:K(`application_service_membership`),reviewScope:K(`hierarchy`),payload:Va}).strict(),G({kind:K(`implemented_in`),reviewScope:K(`hierarchy`),payload:Ha}).strict(),G({kind:K(`environment`),reviewScope:K(`environment`),payload:Ua}).strict(),G({kind:K(`service_instance`),reviewScope:K(`environment`),payload:Wa}).strict(),G({kind:K(`deployed_from`),reviewScope:K(`environment`),payload:Ga}).strict(),G({kind:K(`connected_via`),reviewScope:K(`environment`),payload:Ka}).strict()]);G({applicationKey:q,alias:q}).strict(),G({serviceKey:q,alias:q}).strict();var Ja=Kr([`active`,`needs_attention`]),Ya=G({candidateId:q,candidate:qa,candidateIdentity:q,payloadFingerprint:q,discoveryRunFingerprint:q,discoveredAt:q,evidence:ya,evidenceCount:Rr().int().positive()}).strict(),Xa=G({repoKey:q,name:q,remoteUrl:q.nullable(),role:bi.nullable(),committed:zr(),requiresIdentityResolution:zr(),ignored:zr()}).strict(),Za=G({unitKey:q,label:q,projectionToken:q,status:Ja,candidates:W(Ya),scans:W(Oi),repo:Xa.nullable()}).strict(),Qa=G({applicationKey:q,name:q,serviceKeys:W(q)}).strict(),$a=G({serviceKey:q,name:q,description:q.nullable(),owningRepoKeys:W(q)}).strict(),eo=G({repoKey:q,name:q,remoteUrl:q.nullable(),role:bi}).strict(),to=G({environmentKey:q,applicationKey:q,name:q}).strict(),no=G({applications:W(Qa),services:W($a),repos:W(eo),environments:W(to)}).strict(),ro=mi(G({reviewScope:La,units:W(Za),committed:no,ignoredRepoKeys:W(q).default([])}).strict()).extend({source:K(`daemon`)}),io=Gr(Vr()),ao=G({unitKey:q,projectionToken:q}).strict(),oo=G({candidateId:q,payload:io}).strict(),so=G({candidateId:q}).strict(),co=G({applicationKey:q,name:q}).strict(),lo=G({repoKey:q,applicationKey:q,name:q}).strict(),uo=G({candidateId:q,applicationKey:q}).strict(),fo=G({mode:Kr([`new`,`reuse`]),repoKey:q}).strict(),po=G({application:zr(),service:zr(),iac:zr()}).strict(),mo=G({unitKey:q,ignored:zr().optional(),holds:po.optional(),role:bi.optional(),identity:fo.optional()}).strict();G({reviewScope:La,units:W(ao),edits:W(oo),dismissals:W(so),createdApplications:W(co),createdServices:W(lo),placements:W(uo).default([]),repoDecisions:W(mo)}).strict();var ho=G({reposConfirmed:Rr().int().nonnegative(),reposIgnored:Rr().int().nonnegative(),applicationsCommitted:Rr().int().nonnegative(),servicesCommitted:Rr().int().nonnegative(),membershipsCommitted:Rr().int().nonnegative(),environmentsCommitted:Rr().int().nonnegative(),serviceInstancesCommitted:Rr().int().nonnegative(),edgesCommitted:Rr().int().nonnegative(),aliasesRecorded:Rr().int().nonnegative(),decisionsRecorded:Rr().int().nonnegative()}).strict(),go=Kr([`invalid_request`,`invalid_edit`,`unresolvable_endpoint`,`identity_required`,`identity_conflict`,`service_cardinality_change`,`environment_reparent`]),_o=mi(Ur(`outcome`,[G({outcome:K(`committed`),summary:ho}).strict(),G({outcome:K(`stale`),staleUnitKeys:W(q)}).strict(),G({outcome:K(`refused`),code:go,message:Lr().min(1)}).strict()])).extend({source:K(`daemon`)}),vo=mi(G({stage:Kr([`hierarchy`,`environment`,`nothing_to_review`]),hierarchyCount:Rr().int().nonnegative(),environmentCount:Rr().int().nonnegative()}).strict()).extend({source:K(`daemon`)});function yo(e){let t=e.normalize(`NFKD`).replace(/\p{M}/gu,``).toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``);return t.length===0?null:t}function bo(e){return yo(e.trim())}function xo(e){let t=bo(e);return t!==null&&t!==`unknown`}var So=Lr().refine(e=>e.trim().length>0,{message:`String must contain a non-whitespace character`}),Co=W(G({sourceFile:q,sourceLine:Rr().int().positive(),sourceSnippet:So,rationale:q}).strict()).min(1),wo=W(q).nullable(),To=G({vcs:K(`git`),provider:q,project:q,localRoot:q}).strict(),Eo=G({project:q,neededFor:q,subject:q,note:q,sources:Co}).strict(),Do=G({name:q,scope:Kr([`shared`,`application_scoped`]),sources:Co}).strict(),Oo=G({name:q,aliases:wo,sources:Co}).strict(),ko=G({applicationName:q,sources:Co}).strict(),Ao=G({name:q,aliases:wo,sources:Co}).strict(),jo=G({applicationName:q,logicalServiceName:q,sources:Co}).strict(),Mo=G({name:q,applicationName:Lr().nullable(),coreInfraName:Lr().nullable(),sources:Co}).strict(),No=G({deployedName:q,logicalServiceName:Lr().nullable(),applicationName:Lr().nullable(),environmentName:q,sources:Co}).strict(),Po=G({kind:Kr([`aws-profile`,`aws-role`]),value:q,applicationName:Lr().nullable(),environmentName:Lr().nullable(),sources:Co}).strict(),Fo=G({repo:To,additionalReposNeeded:W(Eo),coreInfraSignals:W(Do),applications:W(Oo),implementedApplications:W(ko),logicalServices:W(Ao),applicationServiceMemberships:W(jo),environments:W(Mo),serviceInstances:W(No),runtimeAccessSignals:W(Po)}).strict().omit({repo:!0}),Io=G({repoKey:q,commitSha:q,draftGeneration:Rr().int().positive(),repoScanId:Rr().int().positive()}).strip();G({path:q,binding:Io,candidates:Fo}).strict(),Hr([G({path:q}).strict(),G({repoKey:q}).strict()]);var Lo=G({path:q,snippet:q,category:q}).strip(),Ro=G({category:q,count:Rr().int().nonnegative()}).strip(),zo=G({guidance:q,files:W(Lo),categoryComposition:W(Ro)}).strip();Hr([mi(G({code:K(`ready`),path:q,binding:Io,context:zo}).strip()).extend({source:K(`daemon`)}),mi(G({code:K(`unknown_repo_key`),message:q,repoKey:q,searchedScope:K(`pending_discovery_drafts_by_repo_key_v1`)}).strip()).extend({source:K(`daemon`)}),mi(G({code:K(`locally_unresolvable`),message:q,binding:Io,searchedScope:K(`producing_checkout_resolution_and_repository_identity_v1`)}).strip()).extend({source:K(`daemon`)}),mi(G({code:K(`scan_failed`),message:q,cause:q,retryable:K(!0)}).strip()).extend({source:K(`daemon`)})]);var Bo=Hr([G({collection:K(`repo`)}).strip(),G({collection:Kr([`additionalReposNeeded`,`coreInfraSignals`,`applications`,`implementedApplications`,`logicalServices`,`applicationServiceMemberships`,`environments`,`serviceInstances`,`runtimeAccessSignals`]),index:Rr().int().nonnegative()}).strip()]),Vo=G({fact:Bo,reason:Kr([`ungrounded`,`unmappable`]),message:q}).strip(),Ho=mi(G({code:K(`submitted`),binding:Io,candidatesStaged:Rr().int().nonnegative(),droppedFacts:W(Vo)}).strip()).extend({source:K(`daemon`)}),Uo=mi(G({code:K(`repository_changed`),binding:Io,message:q,candidatesStaged:K(0),rejectedFact:K(`submission`)}).strip()).extend({source:K(`daemon`)}),Wo=mi(G({code:K(`schema_invalid`),binding:Io,message:q,candidatesStaged:K(0),rejectedFact:K(`submission`)}).strip()).extend({source:K(`daemon`)}),Go=G({fact:Bo,sourceIndex:Rr().int().nonnegative(),code:Kr([`invalid_source_path`,`source_not_committed`,`source_not_blob`,`source_blob_unavailable`,`invalid_source_line`,`source_line_unavailable`,`source_snippet_mismatch`]),sourceFile:q,sourceLine:Rr().int().positive(),message:q}).strip();Hr([Ho,Uo,Wo,mi(G({code:K(`evidence_invalid`),binding:Io,message:q,candidatesStaged:K(0),failures:W(Go).min(1),retryable:K(!0)}).strip()).extend({source:K(`daemon`)})]);var Ko=Kr([`prompt_submit`,`session_start`]),qo=K(`current_repository_and_session_unattempted_pending_scanned_drafts_v1`);G({sessionId:q,cwd:q,triggerEvent:Ko}).strict();var Jo=Hr([G({totalCount:K(0),nextRepoKey:Br(),nextRepoName:Br()}).strip(),G({totalCount:Rr().int().positive().max(2**53-1),nextRepoKey:q,nextRepoName:q}).strip()]),Yo=G({triggerEvent:Ko,scope:qo});mi(Hr([Yo.extend({currentRepositoryEligible:K(!1),pendingNudgeSet:G({totalCount:K(0),nextRepoKey:Br(),nextRepoName:Br()}).strip(),nudgeText:Br()}).strip(),Yo.extend({currentRepositoryEligible:K(!0),pendingNudgeSet:Jo,nudgeText:q}).strip(),Yo.extend({currentRepositoryEligible:K(!1),pendingNudgeSet:G({totalCount:Rr().int().positive().max(2**53-1),nextRepoKey:q,nextRepoName:q}).strip(),nudgeText:q}).strip()])).extend({source:K(`daemon`)}),G({path:q}).strict();var Xo=K(`requested_repository_path_scan_dispatch_v1`);mi(G({acknowledged:K(!0),scope:Xo}).strip()).extend({source:K(`daemon`)});var Zo=K(`install_time_repository_candidates_pending_and_error_v1`),Qo=Rr().int().nonnegative().max(2**53-1);mi(G({processedCount:Qo,clearedNonRepositoryCount:Qo,errorCount:Qo,scope:Zo}).strip()).extend({source:K(`daemon`)});var $o={id:q,key:q,label:q,providers:W(q)},es=Ur(`kind`,[G({kind:K(`application`),...$o}).strip(),G({kind:K(`environment`),...$o,applicationKey:q}).strip(),G({kind:K(`service`),...$o,applicationKeys:W(q)}).strip(),G({kind:K(`service_instance`),...$o,environmentKey:q,serviceKey:q}).strip(),G({kind:K(`system_ref`),...$o}).strip(),G({kind:K(`repo`),...$o}).strip()]),ts=G({id:q,kind:da,source:q,target:q}).strip(),ns=G({providers:W(q),kinds:W(xi),applications:W(q)}).strip(),rs=G({nodeCount:Rr().int().nonnegative(),edgeCount:Rr().int().nonnegative()}).strip();G({provider:q.optional(),kind:xi.optional(),q:q.optional()}).strict();var is=mi(G({nodes:W(es),edges:W(ts),facets:ns,totals:rs}).strip()).extend({source:K(`daemon`)});function as(){return document.querySelector(`meta[name="operator-token"]`)?.getAttribute(`content`)??``}var os=Zi({origin:``,token:as()}),ss=[`system`,`light`,`dark`],cs=`opscanvas.web.colorMode`,ls=`data-color-mode`;function us(e){return e!==null&&ss.includes(e)}var ds={getItem:()=>null,setItem:()=>void 0,removeItem:()=>void 0};function fs(){try{return globalThis.localStorage??ds}catch{return ds}}function ps(e){let t;try{t=e.getItem(cs)}catch{return`system`}return us(t)?t:`system`}function ms(e,t){try{t===`system`?e.removeItem(cs):e.setItem(cs,t)}catch{}}function hs(e,t){return e===`light`?`light`:e===`dark`||t?`dark`:`light`}function gs(e,t){e.setAttribute(ls,t)}var _s=N(`<div class=color-mode role=group aria-label="Color mode">`),vs=N(`<button type=button class=color-mode-option>`),ys={system:`System`,light:`Light`,dark:`Dark`},bs=`(prefers-color-scheme: dark)`;function xs(){let e=window.matchMedia(bs),t=()=>{gs(document.documentElement,hs(ps(fs()),e.matches))};return t(),e.addEventListener(`change`,t),()=>{e.removeEventListener(`change`,t)}}function Ss(){let[e,t]=D(`system`);ae(()=>{t(ps(fs())),oe(xs())});let n=e=>{t(e),ms(fs(),e),gs(document.documentElement,hs(e,window.matchMedia(bs).matches))};return(()=>{var t=_s();return F(t,j(qe,{each:ss,children:t=>(()=>{var r=vs();return r.$$click=()=>{n(t)},F(r,()=>ys[t]),O(n=>{var i=e()===t,a=e()===t;return i!==n.e&&r.classList.toggle(`is-current`,n.e=i),a!==n.t&&P(r,`aria-pressed`,n.t=a),n},{e:void 0,t:void 0}),r})()})),t})()}nt([`click`]);function Cs(e){if(e===void 0||!e.ok)return;let{value:t}=e.value;if(t.status===`checking`&&t.newerVersion!==null)return{current:e.value.version,newer:t.newerVersion}}function ws(e){return e!==void 0&&e.ok&&e.value.value.status===`disabled`}var Ts=N(`<div class=update-banner role=status>New version available (<!>), current version (<!>). Run <code>npm update @opscanvas/opscanvas</code> to upgrade.`),Es=N(`<details class=update-check-notice><summary>Update check disabled</summary><p>Run <code>opscanvas setup</code> without <code>--no-update-check</code> to turn it back on.`);function Ds(e){let t=()=>Cs(e.poll);return j(Je,{get children(){return j(Ye,{get when(){return t()},children:e=>(()=>{var t=Ts(),n=t.firstChild.nextSibling,r=n.nextSibling.nextSibling;return r.nextSibling,F(t,()=>e().newer,n),F(t,()=>e().current,r),t})()})}})}function Os(e){return j(Je,{get children(){return j(Ye,{get when(){return ws(e.poll)},get children(){return Es()}})}})}var ks=`/assets/logo-wordmark-light-DvltDuln.svg`,As=N(`<div class=shell><nav class=shell-nav aria-label="Main navigation"><a class=shell-brand href=/><img class=shell-brand-mark alt=OpsCanvas></a><ul class=shell-nav-list></ul><div class=shell-nav-foot><ul class="shell-nav-list shell-nav-utility"></ul></div></nav><main class=shell-content><header class=shell-header><div class=shell-header-text><h1></h1></div></header><div class=shell-body>`),js=N(`<span class=shell-nav-badge role=img aria-label="Work is waiting">!`),Ms=N(`<li><a class=shell-nav-link><span>`),Ns=N(`<ul class=shell-nav-children>`),Ps=N(`<li><a class="shell-nav-link shell-nav-child"><span>`),Fs=N(`<p class=shell-subtitle aria-live=polite>`),Is=N(`<div class=shell-actions>`);function Ls(e){return(()=>{var t=As(),n=t.firstChild,r=n.firstChild,i=r.firstChild,a=r.nextSibling,o=a.nextSibling,s=o.firstChild,c=n.nextSibling,l=c.firstChild,u=l.firstChild,d=u.firstChild,f=l.nextSibling;return P(i,`src`,ks),F(a,j(qe,{get each(){return e.destinations??[]},children:e=>(()=>{var t=Ms(),n=t.firstChild,r=n.firstChild;return F(r,()=>e.label),F(n,j(M,{get when(){return e.badge},get children(){return js()}}),null),F(t,j(M,{get when(){return e.children},children:e=>(()=>{var t=Ns();return F(t,j(qe,{get each(){return e()},children:e=>(()=>{var t=Ps(),n=t.firstChild,r=n.firstChild;return F(r,()=>e.label),F(n,j(M,{get when(){return e.badge},get children(){return js()}}),null),O(t=>{var r=e.current===!0,i=e.href,a=e.current===!0?`page`:void 0;return r!==t.e&&n.classList.toggle(`is-current`,t.e=r),i!==t.t&&P(n,`href`,t.t=i),a!==t.a&&P(n,`aria-current`,t.a=a),t},{e:void 0,t:void 0,a:void 0}),t})()})),t})()}),null),O(r=>{var i=e.expanded===!0,a=e.current===!0,o=e.href,s=e.current===!0?`page`:void 0,c=e.expanded===void 0?void 0:e.expanded;return i!==r.e&&t.classList.toggle(`shell-nav-group`,r.e=i),a!==r.t&&n.classList.toggle(`is-current`,r.t=a),o!==r.a&&P(n,`href`,r.a=o),s!==r.o&&P(n,`aria-current`,r.o=s),c!==r.i&&P(n,`aria-expanded`,r.i=c),r},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),t})()})),F(s,j(qe,{get each(){return e.utilityDestinations??[]},children:e=>(()=>{var t=Ms(),n=t.firstChild,r=n.firstChild;return F(r,()=>e.label),O(t=>{var r=e.current===!0,i=e.href,a=e.current===!0?`page`:void 0;return r!==t.e&&n.classList.toggle(`is-current`,t.e=r),i!==t.t&&P(n,`href`,t.t=i),a!==t.a&&P(n,`aria-current`,t.a=a),t},{e:void 0,t:void 0,a:void 0}),t})()})),F(o,j(Os,{get poll(){return e.updatePoll}}),null),F(o,j(Ss,{}),null),F(c,j(Ds,{get poll(){return e.updatePoll}}),l),F(d,()=>e.title),F(u,j(M,{get when(){return e.subtitle},children:e=>(()=>{var t=Fs();return F(t,e),t})()}),null),F(l,j(M,{get when(){return e.actions},children:e=>(()=>{var t=Is();return F(t,e),t})()}),null),F(f,()=>e.children),t})()}var Rs=fe();function zs(e){return j(Rs.Provider,{get value(){return e.value},get children(){return e.children}})}function Bs(){let e=pe(Rs);if(e===void 0)throw TypeError(`Shell subtitle context is unavailable.`);return e}var Vs=N(`<section class=card>`),Hs=N(`<span>`),Us=N(`<span class=status><span aria-hidden=true>`),Ws=N(`<button>`),Gs=N(`<div class=empty-state><h3>`),Ks=N(`<p>`),qs=N(`<dl class=data-list>`),Js=N(`<div class=data-row><dt></dt><dd>`),Ys=N(`<div class=field><label class=field-label>`),Xs=N(`<p class=field-hint>`),Zs=N(`<p class=field-error role=alert>`);function Qs(e){return(()=>{var t=Vs();return F(t,()=>e.children),t})()}function $s(e){return(()=>{var t=Hs();return F(t,()=>e.children),O(()=>rt(t,`badge badge--${e.status??`neutral`}`)),t})()}function ec(e){return(()=>{var t=Us(),n=t.firstChild;return F(t,()=>e.children,null),O(()=>rt(n,`status-dot status-dot--${e.status}`)),t})()}function tc(e){return(()=>{var t=Ws();return it(t,`click`,e.onClick,!0),F(t,()=>e.children),O(n=>{var r=`button button--${e.variant??`primary`}`,i=e.type??`submit`,a=e.disabled===!0;return r!==n.e&&rt(t,n.e=r),i!==n.t&&P(t,`type`,n.t=i),a!==n.a&&(t.disabled=n.a=a),n},{e:void 0,t:void 0,a:void 0}),t})()}function nc(e){return(()=>{var t=Gs(),n=t.firstChild;return F(n,()=>e.title),F(t,j(M,{get when(){return e.children},children:e=>(()=>{var t=Ks();return F(t,e),t})()}),null),t})()}function rc(e){return(()=>{var t=qs();return F(t,()=>e.children),t})()}function ic(e){return(()=>{var t=Js(),n=t.firstChild,r=n.nextSibling;return F(n,()=>e.label),F(r,()=>e.children),t})()}function ac(e){return(()=>{var t=Ys(),n=t.firstChild;return F(n,()=>e.label),F(t,()=>e.children,null),F(t,j(M,{get when(){return e.hint},children:t=>(()=>{var n=Xs();return F(n,t),O(()=>P(n,`id`,`${e.for}-hint`)),n})()}),null),F(t,j(M,{get when(){return e.error},children:t=>(()=>{var n=Zs();return F(n,t),O(()=>P(n,`id`,`${e.for}-error`)),n})()}),null),O(r=>{var i=e.error!==void 0,a=e.for;return i!==r.e&&t.classList.toggle(`is-invalid`,r.e=i),a!==r.t&&P(n,`for`,r.t=a),r},{e:void 0,t:void 0}),t})()}nt([`click`]);function oc(e){let[t,n]=D(void 0);return ae(()=>{e().then(e=>{n(()=>e)})}),t}var sc=N(`<p>Asking the daemon.`),cc=N(`<p>The daemon did not answer: `),lc=()=>os({method:`GET`,path:Xr,schema:gi,attempted:`read the daemon's health`});function uc(e){return`${e.message} (while trying to ${e.attempted})`}function dc(e){return e===`open`?`success`:`error`}function fc(e){return j(Qs,{get children(){return j(rc,{get children(){return[j(ic,{label:`Answered by`,get children(){return[Qe(()=>e.source),` `,Qe(()=>e.version)]}}),j(ic,{label:`Durable store`,get children(){return j(ec,{get status(){return dc(e.value.durableStore)},get children(){return e.value.durableStore}})}}),j(ic,{label:`Runtime store`,get children(){return j(ec,{get status(){return dc(e.value.runtimeStore)},get children(){return e.value.runtimeStore}})}}),j(ic,{label:`Surface`,get children(){return e.value.surface}}),j(ic,{label:`As of`,get children(){return e.asOf}}),j(ic,{label:`Provenance`,get children(){return e.provenance}})]}})}})}function pc(){let e=oc(lc),t=()=>{let t=e();return t===void 0||t.ok?void 0:t.error},n=()=>{let t=e();return t?.ok===!0?t.value:void 0};return j(Je,{get children(){return[j(Ye,{get when(){return e()===void 0},get children(){return sc()}}),j(Ye,{get when(){return t()},children:e=>(()=>{var t=cc();return t.firstChild,F(t,()=>uc(e()),null),t})()}),j(Ye,{get when(){return n()},children:e=>fc(e())})]}})}function mc(e){let t=vi.safeParse({feedback:e});if(!t.success)return t.error.issues[0]?.message??`Feedback is invalid`}function hc(e){let t=vi.safeParse({feedback:e});return t.success?t.data:null}function gc(e){return e.trim().length}var _c=N(`<textarea class=feedback-textarea id=feedback name=feedback>`),vc=N(`<p class="form-message form-message--success"role=status>Sent. Thanks for helping us improve OpsCanvas!`),yc=N(`<form class=form novalidate><p>Report a bug, share a suggestion, or tell us what's working well. Your message goes directly to the OpsCanvas team.`),bc=N(`<p class=form-message role=alert>`),xc=12e3;function Sc(){let[e,t]=D(``),[n,r]=D(!1),[i,a]=D(!1),[o,s]=D(void 0),[c,l]=D(!1),u=()=>n()?mc(e()):void 0;async function d(n){if(n.preventDefault(),i())return;r(!0),s(void 0),l(!1);let o=hc(e());if(o===null)return;a(!0);let c=await os({method:`POST`,path:Qr,schema:yi,attempted:`submit feedback to OpsCanvas support`,body:o,timeoutMs:xc});if(a(!1),!c.ok){s(c.error.code===`report_failed`?`We couldn't deliver your feedback right now. Please try again in a moment.`:`Something went wrong. Please try again.`);return}t(``),r(!1),l(!0)}return j(Qs,{get children(){var n=yc();return n.firstChild,n.addEventListener(`submit`,e=>{d(e)}),F(n,j(ac,{label:`Your message`,for:`feedback`,get error(){return u()},get hint(){return Qe(()=>gc(e())>0)()?`${String(gc(e()))} / ${String(_i)}`:`Up to ${String(_i)} characters.`},get children(){var n=_c();return n.$$input=e=>{t(e.currentTarget.value),l(!1)},O(e=>{var t=i(),r=u()!==void 0,a=u()===void 0?`feedback-hint`:`feedback-hint feedback-error`;return t!==e.e&&(n.disabled=e.e=t),r!==e.t&&P(n,`aria-invalid`,e.t=r),a!==e.a&&P(n,`aria-describedby`,e.a=a),e},{e:void 0,t:void 0,a:void 0}),O(()=>n.value=e()),n}}),null),F(n,j(M,{get when(){return o()},children:e=>(()=>{var t=bc();return F(t,e),t})()}),null),F(n,j(M,{get when(){return c()},get children(){return vc()}}),null),F(n,j(tc,{get disabled(){return i()},get children(){return i()?`Sending.`:`Send`}}),null),n}})}nt([`input`]);function Cc(e){let t=new Map;for(let n of e){let e=t.get(n.provider);e===void 0?t.set(n.provider,[n]):e.push(n)}for(let e of t.values())e.sort((e,t)=>e.selector.localeCompare(t.selector));return[...t.entries()].sort(([e],[t])=>e.localeCompare(t))}function wc(e){return e.alias??e.selector}function Tc(e){if(e.lastSuccessAt===null&&e.consecutiveFailures===0)return`no usage reported yet`;let t=e.lastSuccessAt===null?`never succeeded`:`last succeeded ${e.lastSuccessAt}`;return e.consecutiveFailures===0?t:`${t}, ${String(e.consecutiveFailures)} consecutive failure${e.consecutiveFailures===1?``:`s`} since`}function Ec(e){return e?.ok===!0?e.value.length>0:void 0}function Dc(e){return JSON.stringify([e.provider,e.selector])}function Oc(e){let t=e.trim();if(t.length===0)return`?`;let n=t.split(/[\s_-]+/).filter(e=>e.length>0);return n.length>=2?`${n[0]?.[0]??``}${n[1]?.[0]??``}`.toUpperCase():t.slice(0,2).toUpperCase()}function kc(e){return e.length===0?e:`${e[0]?.toUpperCase()??``}${e.slice(1)}`}function Ac(e,t,n){let r=Array.from({length:Math.max(1,n)},()=>({items:[],total:0})),i=[...e].sort((e,n)=>t(n)-t(e));for(let e of i){let n=r.reduce((e,t)=>t.total<e.total?t:e);n.items.push(e),n.total+=t(e)}return r.map(e=>e.items)}var jc=N(`<p class=identity-row-detail>`),Mc=N(`<div class=identity-row-confirm role=group><p>Remove <!> (<!>)? OpsCanvas will no longer treat this as an identity it may act through.</p><div class=identity-row-actions>`),Nc=N(`<div class=identity-row><div class=identity-row-heading><span class=identity-row-name></span><div class=identity-row-actions></div></div><p class=identity-row-meta>approved <!> &middot; `),Pc=N(`<p class=identity-row-result>`),Fc=N(`<svg width=14 height=14 viewBox="0 0 16 16"fill=none aria-hidden=true><rect x=5.5 y=5.5 width=8 height=8 rx=1.5 stroke=currentColor stroke-width=1.3></rect><path d="M3.5 10.5V3.5a1 1 0 0 1 1-1h7"stroke=currentColor stroke-width=1.3 stroke-linecap=round>`),Ic=N(`<svg width=14 height=14 viewBox="0 0 16 16"fill=none aria-hidden=true><path d="M3.5 8.5l3 3 6-7"stroke=currentColor stroke-width=1.5 stroke-linecap=round stroke-linejoin=round>`),Lc=N(`<button type=button class=identity-command-copy>`),Rc=N(`<div class=identity-command-block><span class=identity-command-label>Confirmation command</span><div class=identity-command-row><pre class=identity-command-pre><code>`),zc=N(`<div class=identity-row><div class=identity-row-heading><span class=identity-row-name>: </span><div class=identity-row-actions>`),Bc=N(`<span class=identity-row-result>approved`),Vc=N(`<svg class=chevron width=16 height=16 viewBox="0 0 16 16"fill=none aria-hidden=true><path d="M4 6l4 4 4-4"stroke=currentColor stroke-width=1.5 stroke-linecap=round stroke-linejoin=round>`),Hc=N(`<p>An identity granted through SSO that was never configured locally won't show up here. Run the find_identity skill instead: in Claude Code, type /find_identity; in Codex, type $find_identity or open /skills.`),Uc=N(`<div class=identity-candidate-list>`),Wc=N(`<div class=identity-add-section><button type=button class=identity-add-header><span class=provider-card-title>Found, not yet approved`),Gc=N(`<p class=identity-explainer>An identity granted through SSO that was never configured locally won't show up here. Run the find_identity skill instead: in Claude Code, type /find_identity; in Codex, type $find_identity or open /skills.`),Kc=N(`<div class=provider-card-header><span class=provider-badge aria-hidden=true></span><span class=provider-card-title>`),qc=N(`<p>Asking the daemon.`),Jc=N(`<div class=identities-page><p class=identity-explainer>An approved identity is one you have told OpsCanvas it may act through: a cloud account, a VCS login, or similar. A model only ever sees what is listed here; nothing OpsCanvas discovers on this workstation is usable until it is approved, either here, during setup, or through the find_identity skill.</p><p class=identity-explainer>The page lets you approve identities that OpsCanvas can use without verifying they are valid.`),Yc=N(`<p>The daemon did not answer: `),Xc=N(`<div class=identity-approved-section><p class=identity-section-title>Approved Identities</p><div class=identity-columns>`),Zc=N(`<div class=identity-column>`);function Qc(e){return`${e.message} (while trying to ${e.attempted})`}async function $c(){let e=await os({method:`GET`,path:ci,schema:Li,attempted:`list every approved identity`});return e.ok?sn(e.value.value.identities):e}async function el(){let e=await os({method:`GET`,path:si,schema:Vi,attempted:`enumerate locally configured identities`});return e.ok?sn(e.value.value.candidates):e}function tl(e){let[t,n]=D(null),[r,i]=D(null),[a,o]=D(!1);async function s(){n(`verify`),i(null);let t=await os({method:`POST`,path:ui,schema:zi,attempted:`verify an approved identity`,body:{provider:e.identity.provider,selector:e.identity.selector},timeoutMs:ki});if(n(null),!t.ok){i(Qc(t.error));return}i(t.value.value.succeeded?`verified just now`:`login failed: ${t.value.value.message??`no further detail`}`)}async function c(){o(!1),n(`remove`),i(null);let t=await os({method:`DELETE`,path:di,schema:Bi,attempted:`remove an approved identity`,body:{provider:e.identity.provider,selector:e.identity.selector}});if(n(null),!t.ok){i(Qc(t.error));return}e.onRemoved()}return(()=>{var n=Nc(),i=n.firstChild,l=i.firstChild,u=l.nextSibling,d=i.nextSibling,f=d.firstChild.nextSibling;return f.nextSibling,F(l,()=>wc(e.identity)),F(u,j(tc,{variant:`subtle`,type:`button`,get disabled(){return t()!==null},onClick:()=>void s(),get children(){return t()===`verify`?`Verifying.`:`Verify`}}),null),F(u,j(tc,{variant:`danger`,type:`button`,get disabled(){return t()!==null},onClick:()=>o(!0),get children(){return t()===`remove`?`Removing.`:`Remove`}}),null),F(n,j(M,{get when(){return e.identity.alias!==null},get children(){var t=jc();return F(t,()=>e.identity.selector),t}}),d),F(d,()=>e.identity.approvedAt,f),F(d,()=>Tc(e.identity),null),F(n,j(M,{get when(){return r()},children:e=>(()=>{var t=Pc();return F(t,e),t})()}),null),F(n,j(M,{get when(){return a()},get children(){var t=Mc(),n=t.firstChild,r=n.firstChild.nextSibling,i=r.nextSibling.nextSibling;i.nextSibling;var a=n.nextSibling;return F(n,()=>wc(e.identity),r),F(n,()=>e.identity.provider,i),F(a,j(tc,{variant:`danger`,type:`button`,onClick:()=>void c(),children:`Remove`}),null),F(a,j(tc,{variant:`subtle`,type:`button`,onClick:()=>o(!1),children:`Cancel`}),null),O(()=>P(t,`aria-label`,`Remove ${wc(e.identity)}?`)),t}}),null),n})()}function nl(){return Fc()}function rl(){return Ic()}function il(e){let[t,n]=D(!1);async function r(){try{await navigator.clipboard.writeText(e.text),n(!0),setTimeout(()=>n(!1),2e3)}catch{}}return(()=>{var e=Lc();return e.$$click=()=>void r(),F(e,j(M,{get when(){return!t()},get fallback(){return j(rl,{})},get children(){return j(nl,{})}})),O(()=>P(e,`aria-label`,t()?`Copied`:`Copy command`)),e})()}function al(e){return(()=>{var t=Rc(),n=t.firstChild;n.firstChild;var r=n.nextSibling,i=r.firstChild.firstChild;return F(n,j(M,{get when(){return e.caveat},children:e=>` (${e()})`}),null),F(i,()=>e.command),F(r,j(il,{get text(){return e.command}}),null),t})()}function ol(e){let[t,n]=D(!1),[r,i]=D(null),[a,o]=D(!1);async function s(){n(!0),i(null);let t=await os({method:`POST`,path:li,schema:Ri,attempted:`approve an identity for use`,body:{provider:e.candidate.provider,selector:e.candidate.selector}});if(n(!1),!t.ok){i(Qc(t.error));return}o(!0),e.onApproved()}let c=Ai(e.candidate.provider,e.candidate.selector,e.candidate.awsMechanism);return(()=>{var n=zc(),i=n.firstChild.firstChild,o=i.firstChild,l=i.nextSibling;return F(i,()=>e.candidate.provider,o),F(i,()=>e.candidate.selector,null),F(l,j(M,{get when(){return!a()},get fallback(){return Bc()},get children(){return j(tc,{type:`button`,get disabled(){return t()},onClick:()=>void s(),get children(){return t()?`Approving.`:`Approve for Use`}})}})),F(n,j(M,{when:c,children:e=>j(al,{get command(){return e().command},get caveat(){return e().caveat}})}),null),F(n,j(M,{get when(){return r()},children:e=>(()=>{var t=Pc();return F(t,e),t})()}),null),n})()}function sl(e){return(()=>{var t=Vc();return O(()=>t.classList.toggle(`is-collapsed`,!e.expanded)),t})()}function cl(e){let[t,n]=D(void 0),[r,i]=D(null),[a,o]=D(!0),s=!1;async function c(){i(null);let e=await el();if(!e.ok){i(Qc(e.error));return}n(e.value)}k(ie(()=>e.reloadOn,()=>void c())),k(()=>{let t=e.hasApprovedIdentities;t===void 0||s||(s=!0,t&&o(!1))});function l(t){n(e=>(e??[]).filter(e=>Dc(e)!==Dc(t))),e.onApproved()}return j(M,{get when(){return r()!==null||(t()?.length??0)>0},get fallback(){return Gc()},get children(){return j(Qs,{get children(){var e=Wc(),n=e.firstChild;return n.firstChild,n.$$click=()=>{s=!0,o(e=>!e)},F(n,j(sl,{get expanded(){return a()}}),null),F(e,j(M,{get when(){return a()},get children(){return[Hc(),j(M,{get when(){return r()},children:e=>(()=>{var t=Pc();return F(t,e),t})()}),(()=>{var e=Uc();return F(e,j(qe,{get each(){return t()??[]},children:e=>j(ol,{candidate:e,onApproved:()=>{l(e)}})})),e})()]}}),null),O(()=>P(n,`aria-expanded`,a())),e}})}})}function ll(e){return j(Qs,{get children(){return[(()=>{var t=Kc(),n=t.firstChild,r=n.nextSibling;return F(n,()=>Oc(e.provider)),F(r,()=>kc(e.provider)),t})(),j(qe,{get each(){return e.identities},children:t=>j(tl,{identity:t,get onRemoved(){return e.onChanged}})})]}})}var ul=`(max-width: 700px)`;function dl(){let[e,t]=D(window.matchMedia(ul).matches?1:2);return ae(()=>{let e=window.matchMedia(ul),n=()=>{t(e.matches?1:2)};n(),e.addEventListener(`change`,n),oe(()=>{e.removeEventListener(`change`,n)})}),e}function fl(){let e=dl(),[t,n]=D(void 0),[r,i]=D(0);async function a(){n(await $c())}function o(){a(),i(e=>e+1)}ae(()=>{a()});let s=()=>{let e=t();return e===void 0||e.ok?void 0:e.error},c=()=>{let e=t();return e?.ok===!0?e.value:void 0},l=()=>Ec(t());return(()=>{var n=Jc();return n.firstChild.nextSibling,F(n,j(cl,{onApproved:()=>void a(),get reloadOn(){return r()},get hasApprovedIdentities(){return l()}}),null),F(n,j(Je,{get children(){return[j(Ye,{get when(){return t()===void 0},get children(){return qc()}}),j(Ye,{get when(){return s()},children:e=>(()=>{var t=Yc();return t.firstChild,F(t,()=>Qc(e()),null),t})()}),j(Ye,{get when(){return c()},children:t=>j(M,{get when(){return t().length>0},get fallback(){return j(nc,{title:`No identities approved yet`,children:`Approve one found above, through the find_identity skill, or during setup.`})},get children(){var n=Xc(),r=n.firstChild.nextSibling;return F(r,j(qe,{get each(){return Ac(Cc(t()),([,e])=>e.length,e())},children:e=>(()=>{var t=Zc();return F(t,j(qe,{each:e,children:([e,t])=>j(ll,{provider:e,identities:t,onChanged:o})})),t})()})),n}})})]}}),null),n})()}nt([`click`]);var pl=`/health`,ml=`/identities`,hl=`/feedback`,gl=`/topology/view`,_l=`/topology/confirm`;function vl(e){if(!(e===void 0||!e.ok||e.value.value.count===0))return!0}function yl(e,t){return e===`/`||e===`/topology/view`||t&&e===`/topology/confirm`}function bl(e){let t=yl(e.pathname,e.confirmAvailable),n=[{label:`View`,href:gl,current:e.pathname===`/`||e.pathname===`/topology/view`}];if(e.confirmAvailable){let t=vl(e.pendingReview);n.push({label:`Confirm`,href:_l,current:e.pathname===_l,...t===void 0?{}:{badge:t}})}let r=[{label:`Topology`,href:gl,expanded:t,...t?{children:n}:{}},{label:`Health`,href:pl,current:e.pathname===pl},{label:`Identities`,href:ml,current:e.pathname===ml}];return e.registered||r.push({label:`Registration`,href:e.registrationRoute,current:e.pathname===e.registrationRoute}),r}function xl(e){return[{label:`Feedback`,href:hl,current:e===hl}]}function Sl(e,t,n){return e===`/`||e===`/topology/view`?`Topology View`:n&&e===`/topology/confirm`?`Confirm`:e===`/health`?`Health`:e===`/identities`?`Identities`:e===`/feedback`?`Feedback`:e===t?`Registration`:`Operator Edition`}var Cl={firstName:``,lastName:``,email:``,company:``,title:``};function wl(e){let t=Ui.shape.email.safeParse(e.email);return t.success?{}:{email:t.error.issues.map(e=>e.message).join(`; `)}}function Tl(e){let t=Ui.safeParse(Wi(e));return t.success?t.data:null}var[El,Dl]=D(!1);function Ol(){Dl(!0)}function kl(e,t){return t?!0:e?.ok===!0&&e.value.value.registered}var Al=N(`<input>`),jl=N(`<form class=form novalidate><p>Please register with OpsCanvas before using the operator edition browser application. Only your email address is needed.</p><div class=form-pair></div><div class=form-pair>`),Ml=N(`<p>Thank you for registering. The browser app is now available.`),Nl=N(`<p class=form-message role=alert>`);function Pl(e){return j(ac,{get label(){return e.label},get for(){return e.name},get error(){return e.problem},get hint(){return e.hint},get children(){var t=Al();return t.$$input=t=>{e.onInput(t.currentTarget.value)},O(n=>{var r=e.name,i=e.name,a=e.type??`text`,o=e.disabled;return r!==n.e&&P(t,`id`,n.e=r),i!==n.t&&P(t,`name`,n.t=i),a!==n.a&&P(t,`type`,n.a=a),o!==n.o&&(t.disabled=n.o=o),n},{e:void 0,t:void 0,a:void 0,o:void 0}),O(()=>t.value=e.value),t}})}var Fl=()=>os({method:`GET`,path:Zr,schema:Gi,attempted:`read whether a practitioner has registered`});function Il(){let[e,t]=D(Cl),[n,r]=D(!1),[i,a]=D(!1),[o,s]=D(void 0),c=oc(Fl),l=()=>kl(c(),El()),u=()=>n()?wl(e()):{},d=n=>r=>{t({...e(),[n]:r})};async function f(t){t.preventDefault(),r(!0),s(void 0);let n=Tl(e());if(n===null)return;a(!0);let i=await os({method:`POST`,path:Zr,schema:Gi,attempted:`register this practitioner`,body:n});if(a(!1),!i.ok){s(`${i.error.message} (while trying to ${i.error.attempted})`);return}Ol()}return j(Qs,{get children(){return j(M,{get when(){return!l()},get fallback(){return Ml()},get children(){var t=jl(),n=t.firstChild.nextSibling,r=n.nextSibling;return t.addEventListener(`submit`,e=>{f(e)}),F(t,j(Pl,{name:`email`,label:`Email`,type:`email`,get value(){return e().email},get problem(){return u().email},get disabled(){return i()},get onInput(){return d(`email`)}}),n),F(n,j(Pl,{name:`firstName`,label:`First name (optional)`,get value(){return e().firstName},get problem(){return u().firstName},get disabled(){return i()},get onInput(){return d(`firstName`)}}),null),F(n,j(Pl,{name:`lastName`,label:`Last name (optional)`,get value(){return e().lastName},get problem(){return u().lastName},get disabled(){return i()},get onInput(){return d(`lastName`)}}),null),F(r,j(Pl,{name:`company`,label:`Company (optional)`,get value(){return e().company},get problem(){return u().company},get disabled(){return i()},get onInput(){return d(`company`)}}),null),F(r,j(Pl,{name:`title`,label:`Job title (optional)`,get value(){return e().title},get problem(){return u().title},get disabled(){return i()},get onInput(){return d(`title`)}}),null),F(t,j(M,{get when(){return o()},children:e=>(()=>{var t=Nl();return F(t,e),t})()}),null),F(t,j(tc,{get disabled(){return i()},get children(){return i()?`Registering.`:`Register`}}),null),t}})}})}nt([`input`]);var[Ll,Rl]=D(0);function zl(){Rl(e=>e+1)}var Bl=N(`<mark>`),Vl=N(`<div>`),Hl=N(`<div class=solid-select-control>`),Ul=N(`<div class=solid-select-placeholder>`),Wl=N(`<div class=solid-select-single-value>`),Gl=N(`<div class=solid-select-multi-value><span></span><button type=button class=solid-select-multi-value-remove>⨯`),Kl=N(`<input class=solid-select-input type=text tabindex=0 autocomplete=off autocapitalize=none autocorrect=off size=1>`),ql=N(`<div class=solid-select-list>`),Jl=N(`<div class=solid-select-list-placeholder>`),Yl=N(`<div class=solid-select-option>`),Xl=e=>{let t=He({multiple:!1,disabled:!1,optionToValue:e=>e,isOptionDisabled:e=>!1},e),n=e=>{if(t.multiple&&Array.isArray(e))return e;if(!t.multiple&&!Array.isArray(e))return e===null?[]:[e];throw Error(`Incompatible value type for ${t.multiple?`multple`:`single`} select.`)},[r,i]=D(t.initialValue===void 0?[]:n(t.initialValue)),a=()=>t.multiple?r():r()[0]||null,o=e=>i(n(e)),s=()=>i([]),c=()=>!!(t.multiple?a().length:a());k(ie(r,()=>t.onChange?.(a()),{defer:!0}));let[l,u]=D(``),d=()=>u(``),f=()=>!!l().length;k(ie(l,e=>t.onInput?.(e),{defer:!0})),k(ie(l,e=>{e&&!v()&&y(!0)},{defer:!0}));let p=typeof t.options==`function`?A(()=>t.options(l()),t.options(l())):()=>t.options,m=()=>p().length,h=e=>{if(t.isOptionDisabled(e))return;let n=t.optionToValue(e);t.multiple?o([...r(),n]):(o(n),_(!1)),y(!1)},[g,_]=D(!1),[v,y]=D(!1),b=()=>y(!v()),[x,S]=D(-1),C=()=>p()[x()],w=e=>e===C(),T=e=>{m()||S(-1);let t=m()-1,n=e===`next`?1:-1,r=x()+n;r>t&&(r=0),r<0&&(r=t),S(r)},E=()=>T(`previous`),ee=()=>T(`next`);return k(ie(p,e=>{v()&&S(Math.min(0,e.length-1))},{defer:!0})),k(ie(()=>t.disabled,e=>{e&&v()&&y(!1)})),k(ie(v,e=>{e?(x()===-1&&ee(),_(!0)):(x()>-1&&S(-1),u(``))},{defer:!0})),k(ie(x,e=>{e>-1&&!v()&&y(!0)},{defer:!0})),{options:p,value:a,setValue:o,hasValue:c,clearValue:s,inputValue:l,setInputValue:u,hasInputValue:f,clearInputValue:d,isOpen:v,setIsOpen:y,toggleOpen:b,isActive:g,setIsActive:_,get multiple(){return t.multiple},get disabled(){return t.disabled},pickOption:h,isOptionFocused:w,isOptionDisabled:t.isOptionDisabled,onFocusIn:()=>_(!0),onFocusOut:()=>{_(!1),y(!1)},onMouseDown:e=>e.preventDefault(),onClick:e=>{!t.disabled&&!f()&&b()},onInput:e=>{u(e.target.value)},onKeyDown:e=>{switch(e.key){case`ArrowDown`:ee();break;case`ArrowUp`:E();break;case`Enter`:if(v()&&C()){h(C());break}return;case`Escape`:if(v()){y(!1);break}return;case`Delete`:case`Backspace`:if(l())return;if(t.multiple){let e=a();o([...e.slice(0,-1)])}else s();break;case` `:if(l())return;v()?C()&&h(C()):y(!0);break;case`Tab`:if(C()&&v()){h(C());break}return;default:return}e.preventDefault(),e.stopPropagation()}}},Zl={NO_MATCH:0,MATCH:1,WORD_START:2,START:3},Ql=(e,t)=>{let n=Zl.NO_MATCH,r=[];if(e.length<=t.length){let i=Array.from(e.toLocaleLowerCase()),a=Array.from(t.toLocaleLowerCase()),o=Zl.START;outer:for(let e=0,t=0;e<i.length;e++){for(;t<a.length;)if(a[t]===i[e]){r[t]=!0,o===Zl.MATCH&&a[t-1]===` `&&a[t]!==` `&&(o=Zl.WORD_START),n+=o,o++,t++;continue outer}else o=Zl.MATCH,t++;n=Zl.NO_MATCH,r.length=0}}return{target:t,score:n,matches:r}},$l=(e,t=e=>(()=>{var t=Bl();return F(t,e),t})())=>{let n=e.target,r=e.matches,i=[],a=!1;for(let e=0;e<n.length;e++){let t=n[e],o=r[e];!a&&o?(i.push(`\0`),a=!0):a&&!o&&(i.push(`\0`),a=!1),i.push(t)}return a&&=(i.push(`\0`),!1),Qe(()=>i.join(``).split(`\0`).map((e,n)=>n%2?t(e):e))},eu=(e,t,n)=>{let r=[];for(let i=0;i<t.length;i++){let a=t[i],o=Ql(e,n?typeof n==`function`?n(a):a[n]:a);o.score&&r.push({...o,item:a,index:i})}return r.sort((e,t)=>{let n=t.score-e.score;return n===0&&(n=e.index-t.index),n}),r},tu=(e,t,n)=>t===`label`?[Qe(()=>n.prefix),Qe(()=>n.highlight??e)]:e,nu=(e,t)=>{let n=Object.assign({extractText:e=>e.toString?e.toString():e,filterable:!0,disable:()=>!1},t||{});n.key&&t&&(t.format||t.disable||t.extractText),typeof n.createable==`function`&&n.createable.length;let r=e=>n.key?e[n.key]:e,i=e=>n.extractText(r(e)),a=(e,t,i)=>{let a=r(e);return n.format?n.format(a,t,i):tu(a,t,i)},o=e=>n.disable(r(e));return{options:t=>{let r=t.trim(),s=(typeof e==`function`?e(t):e).map(e=>({value:e,label:a(e,`label`,{}),text:i(e),disabled:o(e)}));if(n.filterable&&r&&(s=typeof n.filterable==`function`?n.filterable(r,s):eu(r,s,`text`).map(e=>({...e.item,label:a(e.item.value,`label`,{highlight:$l(e)})}))),n.createable!==void 0){let e=s.some(e=>ru(r,e.text));if(r){let t;if(typeof n.createable==`function`?n.createable.length===1&&e||(t=n.createable(r,e,s)):e||(t=n.key?{[n.key]:r}:r),t!==void 0){let e=Array.isArray(t)?t:[t],n=[];for(let t of e)n.push({value:t,label:a(t,`label`,{prefix:`Create `}),text:i(t),disabled:!1});s=[...s,...n]}}}return s},optionToValue:e=>e.value,isOptionDisabled:e=>e.disabled,format:(e,t)=>t===`option`?e.label:a(e,`value`,{})}},ru=(e,t)=>e.localeCompare(t,void 0,{sensitivity:`base`})===0,iu=fe(),au=()=>{let e=pe(iu);if(!e)throw Error(`No SelectContext found in ancestry.`);return e},ou=e=>{let[t,n]=Ue(He({format:(e,t)=>e,placeholder:`Select...`,readonly:typeof e.options!=`function`,loading:!1,loadingPlaceholder:`Loading...`,emptyPlaceholder:`No options`},e),[`options`,`optionToValue`,`isOptionDisabled`,`multiple`,`disabled`,`onInput`,`onChange`]),r=Xl(t);return k(ie(()=>n.initialValue,e=>e!==void 0&&r.setValue(e))),j(iu.Provider,{value:r,get children(){return j(su,{get class(){return n.class},get children(){return[j(cu,{get id(){return n.id},get name(){return n.name},get format(){return n.format},get placeholder(){return n.placeholder},get autofocus(){return n.autofocus},get readonly(){return n.readonly},ref(t){var n=e.ref;typeof n==`function`?n(t):e.ref=t}}),j(pu,{get loading(){return n.loading},get loadingPlaceholder(){return n.loadingPlaceholder},get emptyPlaceholder(){return n.emptyPlaceholder},get format(){return n.format}})]}})}})},su=e=>{let t=au();return(()=>{var n=Vl();return n.$$mousedown=e=>{t.onMouseDown(e),e.currentTarget.getElementsByTagName(`input`)[0].focus()},it(n,`focusout`,t.onFocusOut,!0),it(n,`focusin`,t.onFocusIn,!0),F(n,()=>e.children),O(r=>{var i=`solid-select-container ${e.class===void 0?``:e.class}`,a=t.disabled;return i!==r.e&&rt(n,r.e=i),a!==r.t&&P(n,`data-disabled`,r.t=a),r},{e:void 0,t:void 0}),n})()},cu=e=>{let t=au(),n=e=>{let n=t.value();t.setValue([...n.slice(0,e),...n.slice(e+1)])};return(()=>{var r=Hl();return it(r,`click`,t.onClick,!0),F(r,j(M,{get when(){return Qe(()=>!t.hasValue())()&&!t.hasInputValue()},get children(){return j(lu,{get children(){return e.placeholder}})}}),null),F(r,j(M,{get when(){return Qe(()=>!!(t.hasValue()&&!t.multiple))()&&!t.hasInputValue()},get children(){return j(uu,{get children(){return e.format(t.value(),`value`)}})}}),null),F(r,j(M,{get when(){return Qe(()=>!!t.hasValue())()&&t.multiple},get children(){return j(qe,{get each(){return t.value()},children:(t,r)=>j(du,{onRemove:()=>n(r()),get children(){return e.format(t,`value`)}})})}}),null),F(r,j(fu,{get id(){return e.id},get name(){return e.name},get autofocus(){return e.autofocus},get readonly(){return e.readonly},ref(t){var n=e.ref;typeof n==`function`?n(t):e.ref=t}}),null),O(e=>{var n=t.multiple,i=t.hasValue(),a=t.disabled;return n!==e.e&&P(r,`data-multiple`,e.e=n),i!==e.t&&P(r,`data-has-value`,e.t=i),a!==e.a&&P(r,`data-disabled`,e.a=a),e},{e:void 0,t:void 0,a:void 0}),r})()},lu=e=>(()=>{var t=Ul();return F(t,()=>e.children),t})(),uu=e=>(()=>{var t=Wl();return F(t,()=>e.children),t})(),du=e=>(au(),(()=>{var t=Gl(),n=t.firstChild,r=n.nextSibling;return F(n,()=>e.children),r.$$click=t=>{t.stopPropagation(),e.onRemove()},t})()),fu=e=>{let t=au();return(()=>{var n=Kl();n.$$mousedown=e=>{e.stopPropagation()},n.$$keydown=e=>{t.onKeyDown(e),e.defaultPrevented||e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),e.target.blur())},it(n,`input`,t.onInput,!0);var r=e.ref;return typeof r==`function`?at(r,n):e.ref=n,O(r=>{var i=e.id,a=e.name,o=t.multiple,s=t.isActive(),c=e.autofocus,l=e.readonly,u=t.disabled;return i!==r.e&&P(n,`id`,r.e=i),a!==r.t&&P(n,`name`,r.t=a),o!==r.a&&P(n,`data-multiple`,r.a=o),s!==r.o&&P(n,`data-is-active`,r.o=s),c!==r.i&&(n.autofocus=r.i=c),l!==r.n&&(n.readOnly=r.n=l),u!==r.s&&(n.disabled=r.s=u),r},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0}),O(()=>n.value=t.inputValue()),n})()},pu=e=>{let t=au();return j(M,{get when(){return t.isOpen()},get children(){var n=ql();return F(n,j(M,{get when(){return!e.loading},get fallback(){return(()=>{var t=Jl();return F(t,()=>e.loadingPlaceholder),t})()},get children(){return j(qe,{get each(){return t.options()},get fallback(){return(()=>{var t=Jl();return F(t,()=>e.emptyPlaceholder),t})()},children:t=>j(mu,{option:t,get children(){return e.format(t,`option`)}})})}})),n}})},mu=e=>{let t=au(),n=n=>{k(()=>{t.isOptionFocused(e.option)&&n.scrollIntoView({block:`nearest`})})};return(()=>{var r=Yl();return r.$$click=()=>t.pickOption(e.option),at(n,r),F(r,()=>e.children),O(n=>{var i=t.isOptionDisabled(e.option),a=t.isOptionFocused(e.option);return i!==n.e&&P(r,`data-disabled`,n.e=i),a!==n.t&&P(r,`data-focused`,n.t=a),n},{e:void 0,t:void 0}),r})()};nt([`focusin`,`focusout`,`mousedown`,`click`,`input`,`keydown`]);function hu(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,``)}function gu(e){return e.trim().toLowerCase()}function _u(e,t,n){let r=hu(t);if(r.length===0)return[...e].sort((e,t)=>e.name.localeCompare(t.name));let i=e=>{let t=hu(n(e)),i=hu(e.name);return t===r?0:i===r?1:i.startsWith(r)||t.startsWith(r)?2:i.includes(r)||t.includes(r)?3:99};return e.filter(e=>i(e)<99).sort((e,t)=>i(e)-i(t)||e.name.localeCompare(t.name))}function vu(e,t,n){let r=gu(t);return e.some(e=>gu(e.name)===r||gu(n(e))===r)}function yu(e,t,n,r,i=()=>!0){let a=t.trim();return a.length===0||!i(a)||vu(e,a,n)?[]:[r(a)]}var bu=N(`<div class=entity-select>`),xu=N(`<span class=entity-select-problem role=alert>`);function Su(e,t,n){return nu(A(()=>[...e()]),{extractText:e=>e.name,format:(e,t,n)=>{let r=e;return t===`label`?n.prefix===void 0?r.note===void 0?r.name:`${r.name} (${r.note})`:`Create ${r.name}`:r.name},filterable:(e,t)=>{let n=t.map(e=>e.value),r=new Map(t.map(e=>[e.value.key,e]));return _u(n,e,e=>e.key).map(e=>r.get(e.key)).filter(e=>e!==void 0)},createable:r=>yu(e(),r,e=>e.key,t,n)})}function Cu(e){let t=t=>vu(e.options,t,e=>e.key)?null:e.validateCreate(t),[n,r]=D(null),i=Su(()=>e.options,t=>e.createOption(t),e=>t(e)===null),a=A(()=>e.id??`entity-select`);return(()=>{var o=bu();return F(o,j(M,{get when(){return a()},keyed:!0,children:n=>j(ou,He(i,()=>e.id===void 0?{}:{id:e.id},()=>e.value===null?{}:{initialValue:e.value},()=>e.disabled===void 0?{}:{disabled:e.disabled},{get placeholder(){return e.placeholder},emptyPlaceholder:`No matching Applications`,onInput:e=>{r(e.trim().length===0?null:t(e))},onChange:t=>{if(t===null||Array.isArray(t))return;let n=t;(n.mode!==`reference`||n.key!==e.value?.key)&&(r(null),e.onChange(n))}}))}),null),F(o,j(M,{get when(){return n()},keyed:!0,children:e=>(()=>{var t=xu();return F(t,e),t})()}),null),o})()}var wu=N(`<form class=form novalidate><div class=form-actions>`),Tu=N(`<div>`),Eu=N(`<input>`),Du=N(`<p class=form-message role=alert>`),Ou=[[{name:`email`,label:`Email`,type:`email`}],[{name:`firstName`,label:`First name (optional)`},{name:`lastName`,label:`Last name (optional)`}],[{name:`company`,label:`Company (optional)`},{name:`title`,label:`Job title (optional)`}]];function ku(e){let[t,n]=D(Cl),[r,i]=D(!1),[a,o]=D(!1),[s,c]=D(void 0),l=()=>r()?wl(t()):{};async function u(n){n.preventDefault(),i(!0),c(void 0);let r=Tl(t());if(r===null)return;o(!0);let a=await os({method:`POST`,path:Zr,schema:Gi,attempted:`register this practitioner`,body:r});if(o(!1),!a.ok){c(`${a.error.message} (while trying to ${a.error.attempted})`);return}Ol(),e.onRegistered()}return(()=>{var r=wu(),i=r.firstChild;return r.addEventListener(`submit`,e=>{u(e)}),F(r,j(qe,{each:Ou,children:e=>(()=>{var r=Tu();return F(r,j(qe,{each:e,children:e=>j(ac,{get label(){return e.label},get for(){return`inline-${e.name}`},get error(){return l()[e.name]},get children(){var r=Eu();return r.$$input=r=>{n({...t(),[e.name]:r.currentTarget.value})},O(t=>{var n=`inline-${e.name}`,i=e.name,o=e.type??`text`,s=a();return n!==t.e&&P(r,`id`,t.e=n),i!==t.t&&P(r,`name`,t.t=i),o!==t.a&&P(r,`type`,t.a=o),s!==t.o&&(r.disabled=t.o=s),t},{e:void 0,t:void 0,a:void 0,o:void 0}),O(()=>r.value=t()[e.name]),r}})})),O(()=>r.classList.toggle(`form-pair`,e.length>1)),r})()}),i),F(r,j(M,{get when(){return s()},children:e=>(()=>{var t=Du();return F(t,e),t})()}),i),F(i,j(tc,{get disabled(){return a()},get children(){return a()?`Registering.`:`Register`}}),null),F(i,j(M,{get when(){return e.alongside},children:e=>j(tc,{type:`button`,variant:`subtle`,onClick:()=>{e().onClick()},get children(){return e().label}})}),null),r})()}nt([`input`]);function Au(e){switch(e.kind){case`repo_file`:return{key:`repo:${e.repoKey}`,label:e.repoKey};case`api_response`:return{key:`system:${e.systemKey}`,label:e.systemKey};case`operator_note`:return{key:`operator-notes`,label:`Operator notes`};case`derived_note`:return{key:`derived-notes`,label:`Derived notes`}}}function ju(e){switch(e){case`legacy_migration`:return`Migrated legacy evidence`;case`uncited_observation`:return`Observed, no citable source`;case`name_match`:return`Name match only`}}function Mu(e){let t=new Map;for(let n of e){let{key:e,label:r}=Au(n),i=t.get(e);i===void 0?t.set(e,{key:e,label:r,evidence:[n]}):i.evidence.push(n)}return[...t.values()]}var Nu={edits:[],dismissals:[],inclusions:[],createdApplications:[],createdServices:[],placements:[],repoDecisions:[],reviewedUnitKeys:[],confirmedUnitKeys:[]};function Pu(e){return{projection:e,data:Nu,past:[],future:[]}}function Fu(e,t){return{projection:e.projection,data:t,past:[...e.past,e.data],future:[]}}function Iu(e){let t=e.past.at(-1);return t===void 0?e:{projection:e.projection,data:t,past:e.past.slice(0,-1),future:[e.data,...e.future]}}function Lu(e,t){return e.projection.units.find(e=>e.candidates.some(e=>e.candidateId===t))}function Ru(e,t){return e.projection.units.flatMap(e=>e.candidates).find(e=>e.candidateId===t)}function zu(e,t){let n=e.data.edits.find(e=>e.candidateId===t);if(n!==void 0)return n.payload;let r=Ru(e,t);return r===void 0?void 0:{...r.candidate.payload}}function Bu(e,t){return e.data.dismissals.some(e=>e.candidateId===t)}function Vu(e,t){let n=e.data.repoDecisions.find(e=>e.unitKey===t)?.categories;return n!==void 0&&!n.hasApplication&&!n.hasService&&!n.hasIac}function Hu(e,t){return Vu(e,t.originUnitKey)}function Uu(e){let t=new Set(e.projection.ignoredRepoKeys);for(let n of e.projection.units)n.repo!==null&&Vu(e,n.unitKey)&&t.add(n.repo.repoKey);return t}function Wu(e,t){return t.kind===`repo_file`&&Uu(e).has(t.repoKey)}function Gu(e,t){return t.reduce((e,t)=>e+t.evidence.length,0)}function Ku(e){switch(e){case`repo_role`:return[];case`application`:return[`name`,`aliases`];case`service`:return[`name`];case`application_service_membership`:return[`applicationKey`,`serviceKey`];case`implemented_in`:return[`source`,`target`];case`environment`:return[`name`,`applicationKey`];case`service_instance`:return[`name`,`environmentKey`,`applicationKey`,`logicalServiceKey`];case`deployed_from`:return[`source`,`target`];case`connected_via`:return[`environmentKey`,`systemKey`,`provider`,`authorityKind`,`authorityDisplayName`]}}function qu(e,t,n){let r=Ru(e,t);if(r===void 0)return`That candidate is not part of this review.`;let i=Ku(r.candidate.kind);if(i.length===0)return`This candidate is not editable.`;let a=Object.keys(n).filter(e=>!i.includes(e));return a.length===0?null:`${r.candidate.kind} candidates do not expose ${a.join(`, `)} for editing.`}function Ju(e,t,n){if(qu(e,t,n)!==null)return e;let r=Lu(e,t),i=zu(e,t);if(r===void 0||i===void 0)return e;let a={...i,...n};return Fu(e,{...e.data,edits:[...e.data.edits.filter(e=>e.candidateId!==t),{originUnitKey:r.unitKey,candidateId:t,payload:a}]})}function Yu(e){return e===`application_service_membership`||e===`implemented_in`||e===`deployed_from`||e===`connected_via`}function Xu(e){return e.evidence.every(e=>e.kind===`derived_note`||e.kind===`operator_note`)}function Zu(e,t){let n=Ru(e,t);return n!==void 0&&Qu(e.data,n)}function Qu(e,t){return e.dismissals.some(e=>e.candidateId===t.candidateId)?!1:e.inclusions.some(e=>e.candidateId===t.candidateId)||!Yu(t.candidate.kind)?!0:!Xu(t)}function $u(e){return Yu(e)||e===`service`}function ed(e,t){let n=Ru(e,t);return n===void 0?!1:Yu(n.candidate.kind)?!0:n.candidate.kind===`service`&&(Lu(e,t)?.candidates.filter(e=>e.candidate.kind===`service`).length??0)>1}function td(e,t,n){let r=Ru(e,t),i=Lu(e,t);if(r===void 0||i===void 0||!ed(e,t)||Zu(e,t)===n)return e;let a=e.data.dismissals.filter(e=>e.candidateId!==t),o=e.data.inclusions.filter(e=>e.candidateId!==t),s={...e.data,dismissals:n?a:[...a,{originUnitKey:i.unitKey,candidateId:t}],inclusions:n?[...o,{originUnitKey:i.unitKey,candidateId:t}]:o};return Fu(e,r.candidate.kind===`service`&&!n&&yd(e,i.unitKey).hasService&&!i.candidates.some(e=>e.candidate.kind===`service`&&Qu(s,e))?Sd(e,s,i.unitKey,{hasService:!1}):s)}function J(e,t){let n=e?.[t];return typeof n==`string`?n:``}function nd(e){return id(e,Kd(e))}function rd(e){return id(e,Jd(e))}function id(e,t){return new Set([...e.projection.committed.applications.map(e=>e.applicationKey),...e.data.createdApplications.map(e=>e.applicationKey),...t.filter(e=>e.candidate.kind===`application`).map(t=>J(zu(e,t.candidateId),`applicationKey`))].filter(e=>e.length>0))}function ad(e){let t=new Map;for(let n of e.projection.committed.applications)t.set(n.applicationKey,{applicationKey:n.applicationKey,name:n.name,source:`committed`});for(let n of Kd(e)){if(n.candidate.kind!==`application`)continue;let r=zu(e,n.candidateId),i=J(r,`applicationKey`);i.length===0||t.has(i)||t.set(i,{applicationKey:i,name:J(r,`name`),source:`proposed`})}for(let n of Xd(e))e.projection.committed.applications.some(e=>e.applicationKey===n.applicationKey)||t.set(n.applicationKey,{applicationKey:n.applicationKey,name:n.name,source:n.createdDuringReview?`created`:`proposed`});for(let n of e.data.createdApplications)t.set(n.applicationKey,{applicationKey:n.applicationKey,name:n.name,source:`created`});return[...t.values()].sort((e,t)=>e.name.localeCompare(t.name))}function od(e,t,n,r){if(sd(e,r)!==null)return e;let i=bo(r);if(i===null||qu(e,n,{applicationKey:i})!==null)return e;let a=zu(e,n);return a===void 0?e:Fu(e,{...e.data,createdApplications:[...e.data.createdApplications,{originUnitKey:t,applicationKey:i,name:r.trim()}],edits:[...e.data.edits.filter(e=>e.candidateId!==n),{originUnitKey:t,candidateId:n,payload:{...a,applicationKey:i}}]})}function sd(e,t){if(!xo(t))return`An Application needs a name that says which one it is.`;let n=bo(t);return n===null?`An Application needs a name that says which one it is.`:nd(e).has(n)?`An Application with this name already exists. Place this under it instead of creating a second one.`:null}function cd(e,t,n){if(sd(e,n)!==null)return e;let r=bo(n);return r===null?e:Fu(e,{...e.data,createdApplications:[...e.data.createdApplications,{originUnitKey:t,applicationKey:r,name:n.trim()}]})}function ld(e,t,n){let r=e.projection.units.find(e=>e.unitKey===t)?.candidates.some(t=>t.candidate.kind===`service`&&!Bu(e,t.candidateId))??!1,i=e.data.createdServices.some(e=>e.repoKey===n),a=e.projection.committed.services.some(e=>e.owningRepoKeys.includes(n));return r||i||a}function ud(e,t){return xo(t.name)?ld(e,t.unitKey,t.repoKey)?`This repository already has a logical Service.`:nd(e).has(t.applicationKey)?null:`Choose an Application for this Service, or create one first.`:`A logical Service needs a name that says which one it is.`}function dd(e,t){return ud(e,t)===null?Fu(e,{...e.data,createdServices:[...e.data.createdServices,{originUnitKey:t.unitKey,repoKey:t.repoKey,applicationKey:t.applicationKey,name:t.name.trim()}]}):e}function fd(e,t,n){let r={...e.data.repoDecisions.find(e=>e.unitKey===t)??{originUnitKey:t,unitKey:t},...n};return Fu(e,{...e.data,repoDecisions:[...e.data.repoDecisions.filter(e=>e.unitKey!==t),r]})}function pd(e,t,n){return fd(e,t,{identity:n})}function md(e,t){return e.data.reviewedUnitKeys.includes(t)?e:{...e,data:{...e.data,reviewedUnitKeys:[...e.data.reviewedUnitKeys,t]}}}function hd(e,t){return e.data.confirmedUnitKeys.includes(t)?e:{...e,data:{...e.data,reviewedUnitKeys:e.data.reviewedUnitKeys.includes(t)?e.data.reviewedUnitKeys:[...e.data.reviewedUnitKeys,t],confirmedUnitKeys:[...e.data.confirmedUnitKeys,t]}}}function gd(e,t){let n={edits:e.data.edits.filter(e=>e.originUnitKey!==t),dismissals:e.data.dismissals.filter(e=>e.originUnitKey!==t),inclusions:e.data.inclusions.filter(e=>e.originUnitKey!==t),createdApplications:e.data.createdApplications.filter(e=>e.originUnitKey!==t),createdServices:e.data.createdServices.filter(e=>e.originUnitKey!==t),placements:e.data.placements.filter(e=>e.originUnitKey!==t),repoDecisions:e.data.repoDecisions.filter(e=>e.originUnitKey!==t),reviewedUnitKeys:e.data.reviewedUnitKeys,confirmedUnitKeys:e.data.confirmedUnitKeys},r=new Set(e.data.createdApplications.filter(e=>e.originUnitKey===t).map(e=>e.applicationKey)),i=r.size===0?n.edits:n.edits.filter(e=>!_d(e.payload,r)),a=r.size===0?n.createdServices:n.createdServices.filter(e=>!r.has(e.applicationKey));return Fu(e,{...n,edits:i,createdServices:a})}function _d(e,t){for(let n of Object.values(e)){if(typeof n==`string`&&t.has(n))return!0;if(typeof n==`object`&&n){let e=n;if(typeof e.key==`string`&&t.has(e.key))return!0}}return!1}function vd(e,t){return e.projection.units.find(e=>e.unitKey===t)?.candidates.find(e=>e.candidate.kind===`repo_role`)}function yd(e,t){let n=e.data.repoDecisions.find(e=>e.unitKey===t)?.categories;if(n!==void 0)return n;let r=vd(e,t);if(r===void 0||r.candidate.kind!==`repo_role`)return{hasApplication:!1,hasService:!1,hasIac:!1};let i=r.candidate.payload,a=i.hasService;return{hasApplication:!a&&i.hasApplication,hasService:a,hasIac:i.hasIac}}function bd(e){let t=e.hasApplication||e.hasService;return t&&e.hasIac?`mixed`:t?`app`:e.hasIac?`iac`:null}function xd(e,t){return e.data.repoDecisions.find(e=>e.unitKey===t)?.categories!==void 0||Ad(e,t,`repo_role`).length>0}function Sd(e,t,n,r){let i={...yd(e,n),...r},a=bd(i),{role:o,...s}=t.repoDecisions.find(e=>e.unitKey===n)??{originUnitKey:n,unitKey:n};return{...t,repoDecisions:[...t.repoDecisions.filter(e=>e.unitKey!==n),{...s,originUnitKey:n,unitKey:n,categories:i,...a===null?{}:{role:a}}],createdServices:i.hasService?t.createdServices:t.createdServices.filter(e=>e.originUnitKey!==n)}}function Cd(e,t,n){return Fu(e,Sd(e,e.data,t,n))}function wd(e,t,n,r){return Fu(e,{...e.data,placements:[...e.data.placements.filter(e=>e.candidateId!==n),{originUnitKey:t,candidateId:n,applicationKey:r}]})}function Td(e,t){let n=new Set,r=e.data.repoDecisions.find(e=>e.unitKey===t);if(r?.categories===void 0)return n;let i=r.categories,a=e.projection.units.find(e=>e.unitKey===t);if(a===void 0)return n;let o=new Set;if(!i.hasService)for(let e of a.candidates)e.candidate.kind===`service`&&(o.add(e.candidate.payload.serviceKey),n.add(e.candidateId));for(let e of a.candidates){let t=e.candidate;if(t.kind===`application_service_membership`&&o.has(t.payload.serviceKey)){n.add(e.candidateId);continue}if(t.kind!==`implemented_in`)continue;let r=t.payload.source;r.kind===`service`&&o.has(r.key)&&n.add(e.candidateId),r.kind===`application`&&!i.hasApplication&&n.add(e.candidateId)}return n}function Ed(e,t){let n=Lu(e,t)?.unitKey;return n!==void 0&&Td(e,n).has(t)}function Dd(e,t){if(e.data.repoDecisions.find(e=>e.unitKey===t)?.categories?.hasApplication!==!0)return[];let n=e.projection.units.find(e=>e.unitKey===t);if(n===void 0)return[];let r=Td(e,t),i=new Set,a=new Set;for(let e of n.candidates){let t=e.candidate;t.kind===`application_service_membership`&&r.has(e.candidateId)&&i.add(t.payload.applicationKey),t.kind===`implemented_in`&&t.payload.source.kind===`application`&&!r.has(e.candidateId)&&a.add(t.payload.source.key)}return[...i].filter(e=>!a.has(e)).sort()}function Od(e,t){let n=vd(e,t);if(n===void 0||n.candidate.kind!==`repo_role`)return null;let r=n.candidate.payload,i=[...r.hasApplication?[`Application`]:[],...r.hasService?[`Service`]:[],...r.hasIac?[`IaC`]:[]],a={app:`App`,iac:`IaC`,mixed:`Mixed`}[r.role];if(i.length===0)return`Discovery inferred ${a}, but identified no supporting category.`;let o=i.at(-1)??``;return`Discovery inferred ${a} from ${i.length===1?o:`${i.slice(0,-1).join(`, `)} and ${o}`} evidence.`}function kd(e,t,n){return{candidate:t,value:J(zu(e,t.candidateId),n),dismissed:Bu(e,t.candidateId)}}function Ad(e,t,n){return e.projection.units.find(e=>e.unitKey===t)?.candidates.filter(e=>e.candidate.kind===n)??[]}function jd(e,t){let n=e?.[t];if(typeof n!=`object`||!n)return``;let r=n.key;return typeof r==`string`?r:``}function Md(e,t,n,r){return Ad(e,t,`implemented_in`).find(t=>{let i=zu(e,t.candidateId),a=i?.source;return(typeof a==`object`&&a?a.kind:void 0)===n&&jd(i,`source`)===r})??null}function Nd(e,t){return Ad(e,t,`application`).map(n=>({application:kd(e,n,`name`),implementation:Md(e,t,`application`,J(zu(e,n.candidateId),`applicationKey`))}))}function Pd(e,t){let n=Ad(e,t,`application_service_membership`);return Ad(e,t,`service`).map(r=>{let i=J(zu(e,r.candidateId),`serviceKey`),a=n.find(t=>J(zu(e,t.candidateId),`serviceKey`)===i),o=e.data.placements.find(e=>e.candidateId===r.candidateId);return{service:kd(e,r,`name`),membership:a===void 0?null:kd(e,a,`applicationKey`),placement:o?.applicationKey??``,implementation:Md(e,t,`service`,i)}})}function Fd(e,t){let n=Ad(e,t,`environment`)[0];return n===void 0?null:kd(e,n,`name`)}function Id(e,t){let n=Ad(e,t,`deployed_from`);return Ad(e,t,`service_instance`).map(t=>{let r=J(zu(e,t.candidateId),`serviceInstanceKey`),i=n.find(t=>jd(zu(e,t.candidateId),`source`)===r);return{instance:kd(e,t,`name`),deployment:i??null}})}function Ld(e,t){return new Set([...Nd(e,t).map(e=>e.implementation?.candidateId),...Pd(e,t).flatMap(e=>[e.membership?.candidate.candidateId,e.implementation?.candidateId]),...Id(e,t).map(e=>e.deployment?.candidateId)].filter(e=>e!==void 0))}function Rd(e,t,n){let r=t===`application`?e.projection.committed.applications.find(e=>e.applicationKey===n)?.name:e.projection.committed.services.find(e=>e.serviceKey===n)?.name;if(r!==void 0)return r;let i=t===`application`?e.data.createdApplications.find(e=>e.applicationKey===n)?.name:void 0;if(i!==void 0)return i;let a=t===`application`?`applicationKey`:`serviceKey`;for(let r of Kd(e)){let i=Yd(e,r);if(i.kind===t&&J(i.payload,a)===n)return J(i.payload,`name`)}return n}function zd(e,t){let n=e.projection.committed.services.find(e=>e.serviceKey===t);if(n!==void 0)return n.owningRepoKeys[0]??null;for(let n of e.projection.units)if(n.candidates.some(e=>e.candidate.kind===`service`&&J(e.candidate.payload,`serviceKey`)===t))return n.repo?.repoKey??null;return null}function Bd(e,t,n){let r=e.projection.units.find(e=>e.unitKey===t)?.repo?.repoKey??null,i=[],a=zu(e,n.candidateId)??{},o=n.candidate.kind===`application_service_membership`?J(a,`serviceKey`):``;if(o.length>0){let t=zd(e,o);t!==null&&t!==r&&i.push(`${Rd(e,`service`,o)} is a Service of ${t}`)}let s=[...new Set(n.evidence.flatMap(e=>e.kind===`repo_file`?[e.repoKey]:[]))].sort();return r!==null&&s.length>0&&!s.includes(r)&&i.push(`Read in ${s.join(`, `)}`),i}function Vd(e,t){let n=zu(e,t.candidateId);switch(t.candidate.kind){case`application_service_membership`:return`Service ${Rd(e,`service`,J(n,`serviceKey`))} belongs to Application ${Rd(e,`application`,J(n,`applicationKey`))}`;case`implemented_in`:return`${jd(n,`source`)} is implemented in ${jd(n,`target`)}`;case`deployed_from`:return`${jd(n,`source`)} is deployed from ${jd(n,`target`)}`;case`connected_via`:return`${J(n,`environmentKey`)} is connected to ${J(n,`authorityDisplayName`)} (${J(n,`systemKey`)})`;default:return t.candidate.kind.replaceAll(`_`,` `)}}function Hd(e,t){let n=Ld(e,t);return e.projection.units.find(e=>e.unitKey===t)?.candidates.filter(e=>Yu(e.candidate.kind)&&!n.has(e.candidateId))??[]}function Ud(e){return new Set(e.data.confirmedUnitKeys)}function Wd(e,t){let n=Ud(e);return t.length>0&&t.every(e=>n.has(e))}function Gd(e,t){return Ud(e).has(t.originUnitKey)}function Kd(e){return e.projection.units.filter(t=>!Vu(e,t.unitKey)).flatMap(t=>{let n=Td(e,t.unitKey),r=t.candidates.filter(t=>!n.has(t.candidateId)&&Zu(e,t.candidateId)),i=new Set(t.candidates.filter(e=>e.candidate.kind===`service`&&!r.includes(e)).map(e=>J(e.candidate.payload,`serviceKey`)));return i.size===0?r:r.filter(e=>!qd(e,i))})}function qd(e,t){let n=e.candidate;if(n.kind===`application_service_membership`)return t.has(n.payload.serviceKey);if(n.kind!==`implemented_in`)return!1;let r=n.payload.source;return r.kind===`service`&&t.has(r.key)}function Jd(e){let t=Ud(e);return Kd(e).filter(n=>t.has(Lu(e,n.candidateId)?.unitKey??``))}function Yd(e,t){return{kind:t.candidate.kind,payload:zu(e,t.candidateId)??{}}}function Xd(e){let t=Kd(e),n=new Map,r=new Map,i=new Map,a=new Map;for(let t of e.projection.committed.applications)n.set(t.applicationKey,t.name);for(let t of e.projection.committed.services)r.set(t.serviceKey,t.name);for(let t of e.data.createdApplications)n.set(t.applicationKey,t.name);for(let o of t){let{kind:t,payload:s}=Yd(e,o),c=Lu(e,o.candidateId)?.unitKey??``;if(t===`application`&&n.set(J(s,`applicationKey`),J(s,`name`)),t===`service`&&r.set(J(s,`serviceKey`),J(s,`name`)),t===`application_service_membership`){let e=J(s,`applicationKey`),t=J(s,`serviceKey`),n=i.get(e)??new Map,r=n.get(t)??new Set;r.add(c),n.set(t,r),i.set(e,n)}if(t===`implemented_in`){let e=s.source;if(e?.kind===`application`&&typeof e.key==`string`){let t=a.get(e.key)??new Set;t.add(c),a.set(e.key,t)}}}let o=new Set(t.map(e=>e.candidateId));for(let t of e.data.placements){if(!o.has(t.candidateId))continue;let n=zu(e,t.candidateId),a=J(n,`serviceKey`);r.set(a,J(n,`name`));let s=i.get(t.applicationKey)??new Map,c=s.get(a)??new Set;c.add(t.originUnitKey),s.set(a,c),i.set(t.applicationKey,s)}for(let t of e.projection.units)if(!Vu(e,t.unitKey))for(let n of Dd(e,t.unitKey)){let e=a.get(n)??new Set;e.add(t.unitKey),a.set(n,e)}for(let t of e.data.createdServices){if(Hu(e,t))continue;let n=i.get(t.applicationKey)??new Map;n.set(`created:${t.repoKey}`,new Set([t.originUnitKey])),r.set(`created:${t.repoKey}`,t.name),i.set(t.applicationKey,n)}return[...new Set([...i.keys(),...a.keys()])].filter(e=>n.has(e)).sort().map(t=>{let o=[...(i.get(t)??new Map).entries()].sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>({serviceKey:e.startsWith(`created:`)?null:e,name:r.get(e)??e,sourceUnitKeys:[...t].sort()}));return{applicationKey:t,name:n.get(t)??t,createdDuringReview:e.data.createdApplications.some(e=>e.applicationKey===t),implementedDirectly:a.has(t),services:o,sourceUnitKeys:[...new Set([...a.get(t)??[],...o.flatMap(e=>e.sourceUnitKeys)])].sort()}})}function Zd(e){return e.projection.reviewScope===`hierarchy`?e.projection.units.map(t=>{let n=yd(e,t.unitKey),r=n.hasApplication&&n.hasService?`an Application and a Service`:n.hasApplication?`an Application`:n.hasService?`a Service`:n.hasIac?`infrastructure only`:`nothing logical`;return{unitKey:t.unitKey,name:t.repo?.name??t.label,holds:r,hasIac:n.hasIac,ignored:Vu(e,t.unitKey)}}):[]}function Qd(e){let t=e.projection.units,n=t.flatMap(e=>e.candidates);return{totalUnits:t.length,reviewedUnits:e.data.reviewedUnitKeys.length,ignoredUnits:t.filter(t=>Vu(e,t.unitKey)).length,needsAttentionUnits:t.filter(e=>e.status===`needs_attention`).length,committableCandidates:Jd(e).length,dismissedCandidates:n.filter(t=>$u(t.candidate.kind)&&!Zu(e,t.candidateId)).length}}function $d(e,t){return ef(hd(e,t)).filter(e=>e.unitKey===t&&e.awaitsAnotherRepository!==!0)}function ef(e){let t=[],n=e.projection.units.filter(t=>Ud(e).has(t.unitKey));for(let r of n){if(Vu(e,r.unitKey))continue;let n=r.repo;if(n?.requiresIdentityResolution!==!0)continue;let i=e.data.repoDecisions.find(e=>e.unitKey===r.unitKey)?.identity;(i===void 0||i.repoKey.trim().length===0)&&t.push({message:`${n.name} has no remote, so its identity has to be confirmed before its facts can be committed.`,unitKey:r.unitKey})}for(let r of n)r.repo===null||Vu(e,r.unitKey)||bd(yd(e,r.unitKey))===null&&t.push({message:`Nothing is selected for ${r.repo.name}. Say what it holds, or ignore the repository.`,unitKey:r.unitKey});for(let r of Jd(e)){if(r.candidate.kind!==`service`&&r.candidate.kind!==`application`)continue;let i=Lu(e,r.candidateId);i===void 0||Vu(e,i.unitKey)||n.some(e=>e.unitKey===i.unitKey)&&(J(zu(e,r.candidateId),`name`).trim().length>0||t.push({message:r.candidate.kind===`service`?`A logical Service needs a name. Give this one a name, or say this repository holds something else.`:`An Application needs a name. Give this one a name, or say this repository holds something else.`,unitKey:i.unitKey,candidateId:r.candidateId}))}let r=new Set([...e.projection.committed.services.map(e=>e.serviceKey),...Kd(e).filter(e=>e.candidate.kind===`application_service_membership`).map(t=>J(zu(e,t.candidateId),`serviceKey`)),...e.data.placements.map(t=>J(zu(e,t.candidateId)??{},`serviceKey`))]);for(let i of n)if(!Vu(e,i.unitKey))for(let n of Jd(e)){if(n.candidate.kind!==`service`||Lu(e,n.candidateId)?.unitKey!==i.unitKey)continue;let a=zu(e,n.candidateId);r.has(J(a,`serviceKey`))||t.push({message:`Services must be associated with an Application, but "${J(a,`name`)}" isn't associated with any. You can categorize this repository as an Application using the radio buttons above, or specify the Application this Service belongs to using the form.`,unitKey:i.unitKey,candidateId:n.candidateId})}let i=rd(e),a=new Set([...e.projection.committed.services.map(e=>e.serviceKey),...Jd(e).filter(e=>e.candidate.kind===`service`).map(t=>J(zu(e,t.candidateId),`serviceKey`))]),o=new Set([...e.projection.committed.environments.map(e=>e.environmentKey),...Jd(e).filter(e=>e.candidate.kind===`environment`).map(t=>J(zu(e,t.candidateId),`environmentKey`))]),s=(t,n)=>Kd(e).some(r=>{let i=Yd(e,r);return t===`Application`?i.kind===`application`&&J(i.payload,`applicationKey`)===n:t===`logical Service`?i.kind===`service`&&J(i.payload,`serviceKey`)===n:i.kind===`environment`&&J(i.payload,`environmentKey`)===n}),c=(t,n,r)=>{let i=s(n,r);return{message:i?`A ${t.candidate.kind} candidate names ${n} ${r}, which another repository in this review contributes. Confirm that one too before committing.`:`A ${t.candidate.kind} candidate names ${n} ${r}, which nothing in this commit creates.`,unitKey:Lu(e,t.candidateId)?.unitKey??``,candidateId:t.candidateId,...i?{awaitsAnotherRepository:!0}:{}}};for(let n of Jd(e)){let{kind:r,payload:s}=Yd(e,n);if(r===`application_service_membership`){let e=J(s,`applicationKey`),r=J(s,`serviceKey`);i.has(e)||t.push(c(n,`Application`,e)),a.has(r)||t.push(c(n,`logical Service`,r))}if(r===`environment`){let e=J(s,`applicationKey`);i.has(e)||t.push(c(n,`Application`,e))}if(r===`service_instance`){let e=J(s,`environmentKey`),r=J(s,`logicalServiceKey`);o.has(e)||t.push(c(n,`Environment`,e)),a.has(r)||t.push(c(n,`logical Service`,r))}}return t}function tf(e){let t=new Set(Jd(e).map(e=>e.candidateId)),n=Ud(e);return{reviewScope:e.projection.reviewScope,units:e.projection.units.filter(e=>n.has(e.unitKey)).map(e=>({unitKey:e.unitKey,projectionToken:e.projectionToken})),edits:e.data.edits.filter(e=>t.has(e.candidateId)).map(e=>({candidateId:e.candidateId,payload:e.payload})),dismissals:e.projection.units.filter(t=>n.has(t.unitKey)&&!Vu(e,t.unitKey)).flatMap(t=>{let n=Td(e,t.unitKey);return t.candidates.filter(t=>$u(t.candidate.kind)&&!n.has(t.candidateId)&&!Zu(e,t.candidateId))}).map(e=>({candidateId:e.candidateId})),createdApplications:e.data.createdApplications.filter(t=>Xd(e).some(e=>e.applicationKey===t.applicationKey&&e.sourceUnitKeys.some(e=>n.has(e)))).map(e=>({applicationKey:e.applicationKey,name:e.name})),createdServices:e.data.createdServices.filter(t=>Gd(e,t)&&!Hu(e,t)).map(e=>({repoKey:e.repoKey,applicationKey:e.applicationKey,name:e.name})),placements:e.data.placements.filter(t=>Gd(e,t)&&!Hu(e,t)&&!Ed(e,t.candidateId)).map(e=>({candidateId:e.candidateId,applicationKey:e.applicationKey})),repoDecisions:e.data.repoDecisions.filter(e=>n.has(e.unitKey)).map(t=>({unitKey:t.unitKey,...Vu(e,t.unitKey)?{ignored:!0}:{},...t.categories===void 0?{}:{holds:{application:t.categories.hasApplication,service:t.categories.hasService,iac:t.categories.hasIac}},...t.role===void 0?{}:{role:t.role},...t.identity===void 0?{}:{identity:t.identity}}))}}function nf(e,t,n){let r=new Set(n),i=new Set(t.units.filter(e=>!r.has(e.unitKey)).flatMap(e=>e.candidates.map(e=>e.candidateId))),a=e=>e.filter(e=>!r.has(e.originUnitKey));return{projection:t,data:{edits:a(e.data.edits).filter(e=>i.has(e.candidateId)),dismissals:a(e.data.dismissals).filter(e=>i.has(e.candidateId)),inclusions:a(e.data.inclusions).filter(e=>i.has(e.candidateId)),createdApplications:a(e.data.createdApplications),createdServices:a(e.data.createdServices),placements:a(e.data.placements).filter(e=>i.has(e.candidateId)),repoDecisions:a(e.data.repoDecisions),reviewedUnitKeys:e.data.reviewedUnitKeys.filter(e=>!r.has(e)),confirmedUnitKeys:e.data.confirmedUnitKeys.filter(e=>!r.has(e))},past:[],future:[]}}function rf(e){return{unitKey:e,name:``,applicationKey:``}}function af(e,t){return e.unitKey===t?e:rf(t)}var of=N(`<div class=review-evidence role=dialog aria-label=Evidence><header><h4>What discovery read</h4></header><details class=review-evidence-payload><summary>What discovery proposed`),sf=N(`<div class=review-evidence-group><h5></h5><ul>`),cf=N(`<li>`),lf=N(`<code>:`),uf=N(`<code>`),df=N(`<span class=review-explainer-body role=note><button type=button class=review-explainer-close>Close`),ff=N(`<span class=review-explainer><button type=button class=review-explainer-toggle>?`),pf=N(`<span aria-hidden=true>`),mf=N(`<h3>Register with OpsCanvas`),hf=N(`<p class=review-hint>You have confirmed <!>. Please register in order to make this data available to your model. Only an email address is required.`),gf=N(`<input>`),_f=N(`<div class=review-fact-row><div class=review-fact-actions>`),vf=N(`<input class=review-fact-tick type=checkbox>`),yf=N(`<p class=review-fact-problem role=alert>`),bf=N(`<em class=review-preview-unnamed>Needs a name`),xf=N(`<span class=review-commit-mark aria-hidden=true>`),Sf=N(`<div class=review-preview-head><h3>Items to be committed</h3><div class=review-move>`),Cf=N(`<p class=review-blockers>Waiting on <!>.`),wf=N(`<p class=review-hint>Everything still to be committed, from every repository in this review rather than only the one above. A check marks what committing now would finish; the rest waits for the repositories it comes from to be worked through.`),Tf=N(`<p class=review-hint>You have opened <!> of <!> repositories. Committing now writes those, and leaves the rest here for later.`),Ef=N(`<h4 class=review-preview-heading>Applications and Services`),Df=N(`<ul class=review-preview>`),Of=N(`<h4 class=review-preview-heading>Repositories`),kf=N(`<p class=review-hint>Not shown: <!> left unticked, <!> repositories ignored.`),Af=N(`<p class=review-hint>`),jf=N(`<p class=review-empty>Nothing yet. Nothing decided so far would create an Application.`),Mf=N(`<ul>`),Nf=N(`<li><span class=review-preview-line><span><strong>`),Pf=N(`<li><span class=review-preview-line><span>`),Ff=N(`<p class=review-elsewhere><button type=button class=review-elsewhere-switch>Switch to <!> (<!> waiting)`),If=N(`<strong> of `),Lf=N(`<div class=review><header class=review-head><div><h2></h2><p class=review-position></p></div><div class=review-move></div></header><div class=review-commit>`),Rf=N(`<p class=review-hint> are now part of the estate's topology.`),zf=N(`<section class=review-committed><h3>Committed`),Bf=N(`<input id=no-remote-identity placeholder=git.example.com/team/repository>`),Vf=N(`<select id=reuse-repo><option value>Select an existing Repo`),Hf=N(`<section class=review-section><h4>Repository identity</h4><div class=review-grid>`),Uf=N(`<section class=review-section><h4>What is in this repository?</h4><div class=review-role><div class=review-choices role=radiogroup aria-label="What this repository holds"></div><label class=review-iac><input type=checkbox><span><strong>Has IaC</strong><small>It also holds infrastructure as code.`),Wf=N(`<p class=review-empty>Discovery proposed no Application for this repository.`),Gf=N(`<p class=review-empty>`),Kf=N(`<h5 class=review-subsection>Other relationships found here`),qf=N(`<p class=review-hint>Read in this repository, about Applications and Services that may live in others.`),Jf=N(`<div class=review-card-blockers>`),Yf=N(`<div class=review-card><header class=review-identity><div class=review-identity-main><span class=review-eyebrow></span><h3></h3></div></header><section class=review-section><h4></h4></section><footer class=review-card-foot><div class=review-move>`),Xf=N(`<span class=review-mono> · <!> `),Zf=N(`<option> (<!>)`),Qf=N(`<label><input type=radio name=holds><span><strong></strong><small>`),$f=N(`<p class=review-inference>`),ep=N(`<input id=create-service>`),tp=N(`<div class=review-add-form>`),np=N(`<p class=review-hint>A name only. Its key is derived from this repository's identity, so a later rescan can still match it.`),rp=N(`<p class=review-problem>`),ip=N(`<div class=review-relationship><label><input type=checkbox><span>`),ap=N(`<small class=review-relationship-note>`),op=N(`<p role=alert>`),sp=N(`<p class=form-message role=alert>`),cp=N(`<p>Loading the review.`),lp={hierarchy:ti,environment:ni},up={hierarchy:ri,environment:ii},dp={hierarchy:`Applications and Services`,environment:`Environments and deployments`};async function fp(e){let t=await os({method:`GET`,path:lp[e],schema:ro,attempted:`read the ${e} topology review`});return t.ok?t.value.value:`${t.error.message} (while trying to ${t.error.attempted})`}function pp(e){let t=()=>e.candidates.flatMap(e=>e.evidence);return(()=>{var n=of(),r=n.firstChild;r.firstChild;var i=r.nextSibling;return i.firstChild,F(r,j(tc,{type:`button`,variant:`subtle`,get onClick(){return e.onClose},children:`Close`}),null),F(n,j(qe,{get each(){return Mu(t())},children:t=>(()=>{var n=sf(),r=n.firstChild,i=r.nextSibling;return F(r,()=>t.label,null),F(r,j(M,{get when(){return t.evidence.some(t=>Wu(e.draft,t))},get children(){return[` `,j($s,{status:`warning`,children:`not modelled`})]}}),null),F(i,j(qe,{get each(){return t.evidence},children:e=>(()=>{var t=cf();return F(t,(()=>{var t=Qe(()=>e.kind===`repo_file`);return()=>t()?(()=>{var t=lf(),n=t.firstChild;return F(t,()=>e.path,n),F(t,()=>String(e.line),null),t})():null})(),null),F(t,(()=>{var t=Qe(()=>e.kind===`api_response`);return()=>t()?`read from ${e.systemKey} at ${e.capturedAt}`:null})(),null),F(t,(()=>{var t=Qe(()=>e.kind===`operator_note`);return()=>t()?e.text:null})(),null),F(t,(()=>{var t=Qe(()=>e.kind===`derived_note`);return()=>t()?[j($s,{status:`warning`,get children(){return ju(e.origin)}}),` `,Qe(()=>e.text)]:null})(),null),t})()})),n})()}),i),F(i,j(qe,{get each(){return e.candidates},children:e=>(()=>{var t=uf();return F(t,()=>JSON.stringify(e.candidate.payload)),t})()}),null),n})()}function mp(e){let[t,n]=D(!1),r=Ge(),i,a;return k(()=>{if(!t())return;let e=e=>{e.target instanceof Node&&i?.contains(e.target)===!0||n(!1)},r=e=>{e.key===`Escape`&&(n(!1),a?.focus())};document.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,r),oe(()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,r)})}),(()=>{var o=ff(),s=o.firstChild,c=i;typeof c==`function`?at(c,o):i=o,s.$$click=()=>{n(!t())};var l=a;return typeof l==`function`?at(l,s):a=s,P(s,`aria-controls`,r),F(o,j(M,{get when(){return t()},get children(){var t=df(),i=t.firstChild;return P(t,`id`,r),F(t,()=>e.children,i),i.$$click=()=>{n(!1)},t}}),null),O(n=>{var r=t(),i=e.label;return r!==n.e&&P(s,`aria-expanded`,n.e=r),i!==n.t&&P(s,`aria-label`,n.t=i),n},{e:void 0,t:void 0}),o})()}function hp(e){let t={repo:`R`,application:`A`,service:`S`,environment:`E`}[e.kind];return(()=>{var n=pf();return F(n,t),O(()=>rt(n,`review-type-mark review-type-mark--${e.kind}`)),n})()}var gp=[{label:`An Application`,detail:`A logical product or capability that delivers value to end users.`,matches:e=>e.hasApplication,select:{hasApplication:!0,hasService:!1}},{label:`A Service`,detail:`A deployable runtime unit, such as a container, a function, or a managed service, that implements part of an Application.`,matches:e=>e.hasService,select:{hasApplication:!1,hasService:!0}},{label:`Neither`,detail:`Not a product and not a runtime unit. Without IaC, the repository is left out of the topology.`,matches:e=>!e.hasApplication&&!e.hasService,select:{hasApplication:!1,hasService:!1}}];function _p(e){let t=e=>e.source===`committed`?void 0:e.source===`proposed`?`proposed here`:`added by you`,n=e=>({key:e.applicationKey,name:e.name,mode:`reference`,...t(e)===void 0?{}:{note:t(e)}}),r=A(()=>e.options.map(n)),i=A(()=>{let t=e.options.find(t=>t.applicationKey===e.value);return t===void 0?null:n(t)});return j(ac,{get label(){return e.label},get for(){return e.id},get children(){return j(Cu,He({get id(){return e.id},get value(){return i()}},()=>e.disabled===void 0?{}:{disabled:e.disabled},{get options(){return r()},placeholder:`Search, or type a new name`,createOption:e=>({key:bo(e)??e,name:e,mode:`create`}),get validateCreate(){return e.validateCreate},onChange:t=>{t.mode===`create`?e.onCreate(t.name):e.onSelect(t.key)}}))}})}function vp(e){return[e.service.candidate,...e.membership===null?[]:[e.membership.candidate],...e.implementation===null?[]:[e.implementation]]}function yp(e){let t=e.projection.committed;return bp([{count:t.repos.length,one:`repository`,many:`repositories`},{count:t.applications.length,one:`Application`,many:`Applications`},{count:t.environments.length,one:`Environment`,many:`Environments`}])}function bp(e){let t=e.filter(e=>e.count>0).map(e=>`${String(e.count)} ${e.count===1?e.one:e.many}`);return t.length<=1?t[0]??`nothing yet`:`${t.slice(0,-1).join(`, `)} and ${t.at(-1)??``}`}function xp(e){let t=e.projection.committed;return t.applications.length>0||t.services.length>0||t.repos.length>0||t.environments.length>0}function Sp(e){return j(Qs,{get children(){return[mf(),(()=>{var t=hf(),n=t.firstChild.nextSibling;return n.nextSibling,F(t,()=>e.confirmed,n),t})(),j(ku,{onRegistered:Ol,get alongside(){return e.alongside}})]}})}var Cp={reposConfirmed:0,reposIgnored:0,applicationsCommitted:0,servicesCommitted:0,membershipsCommitted:0,environmentsCommitted:0,serviceInstancesCommitted:0,edgesCommitted:0,aliasesRecorded:0,decisionsRecorded:0};function wp(e){return bp([{count:e.reposConfirmed,one:`repository`,many:`repositories`},{count:e.applicationsCommitted,one:`Application`,many:`Applications`},{count:e.environmentsCommitted,one:`Environment`,many:`Environments`}])}function Tp(e){return j(tc,{type:`button`,variant:`subtle`,get onClick(){return e.onClick},get children(){return[`Evidence (`,Qe(()=>String(e.evidence)),`)`]}})}function Ep(e){let t=()=>`fact-${e.fact.candidate.candidateId}`;return(()=>{var n=_f(),r=n.firstChild;return F(n,j(M,{get when(){return e.included},children:t=>(()=>{var n=vf();return n.addEventListener(`change`,e=>{t().onChange(e.currentTarget.checked)}),O(()=>P(n,`aria-label`,`Commit ${e.label}`)),O(()=>n.checked=t().checked),n})()}),r),F(n,j(ac,{get label(){return e.label},get for(){return t()},get hint(){return e.hint},get children(){var n=gf();return n.addEventListener(`change`,t=>{e.onEdit(t.currentTarget.value)}),O(()=>P(n,`id`,t())),O(()=>n.value=e.fact.value),n}}),r),F(n,()=>e.children,r),F(r,j(Tp,{get evidence(){return Gu(e.state,e.speaksFor)},get onClick(){return e.onEvidence}}),null),F(r,()=>e.actions,null),F(n,j(M,{get when(){return e.problem},children:e=>(()=>{var t=yf();return F(t,e),t})()}),null),O(()=>n.classList.toggle(`is-excluded`,e.included?.checked===!1)),n})()}function Dp(e){return e.trim().length>0?e:bf()}function Op(e){let t=()=>Wd(e.draft,e.sourceUnitKeys);return(()=>{var e=xf();return F(e,()=>t()?`✓`:``),O(n=>{var r=!!t(),i=t()?`Committing now finishes this`:`Waiting on a repository you have not opened`;return r!==n.e&&e.classList.toggle(`is-included`,n.e=r),i!==n.t&&P(e,`title`,n.t=i),n},{e:void 0,t:void 0}),e})()}function kp(e){let t=()=>Xd(e.draft),n=()=>Zd(e.draft),r=t=>t.includes(e.unitKey);return j(Qs,{get children(){return[(()=>{var t=Sf(),n=t.firstChild.nextSibling;return F(n,()=>e.action),t})(),j(M,{get when(){return e.note},children:e=>(()=>{var t=Af();return F(t,e),t})()}),j(M,{get when(){return e.blockedBy.length>0},get children(){var t=Cf(),n=t.firstChild.nextSibling;return n.nextSibling,F(t,()=>e.blockedBy.join(`, `),n),t}}),wf(),j(M,{get when(){return e.counts.reviewedUnits<e.counts.totalUnits},get children(){var t=Tf(),n=t.firstChild.nextSibling,r=n.nextSibling.nextSibling;return r.nextSibling,F(t,()=>e.counts.reviewedUnits,n),F(t,()=>e.counts.totalUnits,r),t}}),j(M,{get when(){return t().length>0},get children(){return Ef()}}),j(M,{get when(){return t().length>0},get fallback(){return jf()},get children(){var n=Df();return F(n,j(qe,{get each(){return t()},children:t=>(()=>{var n=Nf(),i=n.firstChild,a=i.firstChild,o=a.firstChild;return F(i,j(Op,{get sourceUnitKeys(){return t.sourceUnitKeys},get draft(){return e.draft}}),a),F(i,j(hp,{kind:`application`}),a),F(o,()=>Dp(t.name)),F(a,j(M,{get when(){return t.createdDuringReview},get children(){return[` `,j($s,{status:`info`,children:`You added this`})]}}),null),F(a,j(M,{get when(){return Qe(()=>!!t.implementedDirectly)()&&t.services.length===0},get children(){return[` `,j($s,{status:`neutral`,get children(){return t.sourceUnitKeys.length>1?`These repositories contain the entire Application`:`This repository contains the entire Application`}})]}}),null),F(a,j(M,{get when(){return r(t.sourceUnitKeys)},get children(){return[` `,j($s,{status:`success`,children:`from this repository`})]}}),null),F(n,j(M,{get when(){return t.services.length>0},get children(){var n=Mf();return F(n,j(qe,{get each(){return t.services},children:t=>(()=>{var n=Pf(),i=n.firstChild,a=i.firstChild;return F(i,j(Op,{get sourceUnitKeys(){return t.sourceUnitKeys},get draft(){return e.draft}}),a),F(i,j(hp,{kind:`service`}),a),F(a,()=>Dp(t.name),null),F(a,j(M,{get when(){return t.serviceKey===null},get children(){return[` `,j($s,{status:`info`,children:`You added this`})]}}),null),F(a,j(M,{get when(){return r(t.sourceUnitKeys)},get children(){return[` `,j($s,{status:`success`,children:`from this repository`})]}}),null),n})()})),n}}),null),O(()=>n.classList.toggle(`is-from-here`,!!r(t.sourceUnitKeys))),n})()})),n}}),j(M,{get when(){return n().length>0},get children(){return[Of(),(()=>{var t=Df();return F(t,j(qe,{get each(){return n()},children:t=>(()=>{var n=Nf(),r=n.firstChild,i=r.firstChild,a=i.firstChild;return F(r,j(Op,{get sourceUnitKeys(){return[t.unitKey]},get draft(){return e.draft}}),i),F(r,j(hp,{kind:`repo`}),i),F(a,()=>t.name),F(i,j(M,{get when(){return!t.ignored},get fallback(){return[` `,j($s,{status:`warning`,children:`ignored`})]},get children(){return[` `,`holds `,Qe(()=>t.holds),j(M,{get when(){return Qe(()=>!!t.hasIac)()&&t.holds!==`infrastructure only`},get children(){return[` `,j($s,{status:`neutral`,children:`and IaC`})]}})]}}),null),O(()=>n.classList.toggle(`is-from-here`,t.unitKey===e.unitKey)),n})()})),t})()]}}),j(M,{get when(){return e.counts.dismissedCandidates+e.counts.ignoredUnits>0},get children(){var t=kf(),n=t.firstChild.nextSibling,r=n.nextSibling.nextSibling;return r.nextSibling,F(t,()=>e.counts.dismissedCandidates,n),F(t,()=>e.counts.ignoredUnits,r),t}})]}})}function Ap(e){let[t,n]=D(Pu(e.projection)),[r,i]=D(0),[a,o]=D(!1),[s,c]=D(!1),[l,u]=D(void 0),[d,f]=D(void 0),p=oc(()=>os({method:`GET`,path:Zr,schema:Gi,attempted:`read whether a practitioner has registered`})),m=()=>kl(p(),El()),[h,g]=D(rf(``)),[_,v]=D([]),y=()=>t().projection.units,b=()=>y()[r()];ae(()=>{let e=b();e!==void 0&&n(md(t(),e.unitKey))});let x=()=>af(h(),b()?.unitKey??``),S=()=>yd(t(),b()?.unitKey??``),C=()=>xd(t(),b()?.unitKey??``),w=e=>{n(e),u(void 0)},T=(e,n)=>r=>{w(Ju(t(),e.candidate.candidateId,{[n]:r}))},E,ee=()=>y().length>0&&r()>=y().length-1,te=()=>$d(t(),b()?.unitKey??``),k=()=>{A(0,!0),E?.scrollIntoView({behavior:`smooth`,block:`start`})},A=(e,a=!1)=>{let o=b();o!==void 0&&n(a?hd(t(),o.unitKey):md(t(),o.unitKey)),i(Math.min(Math.max(r()+e,0),Math.max(y().length-1,0))),v([])};async function ne(){c(!0);let r=await os({method:`POST`,path:up[e.scope],schema:_o,attempted:`commit this ${e.scope} review`,body:tf(t())});if(c(!1),!r.ok){u(`${r.error.message} (while trying to ${r.error.attempted})`);return}let i=r.value.value;if(i.outcome===`committed`){f(i.summary),o(!1),zl();return}if(i.outcome===`stale`){let r=await fp(e.scope);if(typeof r==`string`){u(r);return}n(nf(t(),r,i.staleUnitKeys)),o(!1),u(`These review units changed while you were working: ${i.staleUnitKeys.join(`, `)}. They have been reloaded, and your work on the rest is intact.`);return}u(i.message)}return j(M,{get when(){return d()===void 0},get fallback(){return(()=>{var t=zf();return t.firstChild,F(t,j(M,{get when(){return m()},get fallback(){return j(Sp,{get confirmed(){return wp(d()??Cp)},get alongside(){return{label:`Continue reviewing`,onClick:e.onContinue}}})},get children(){return[(()=>{var e=Rf(),t=e.firstChild;return F(e,()=>wp(d()??Cp),t),e})(),j(tc,{type:`button`,get onClick(){return e.onContinue},children:`Continue reviewing`})]}}),null),t})()},get children(){var n=Lf(),i=n.firstChild,c=i.firstChild,u=c.firstChild,d=u.nextSibling,f=c.nextSibling,p=i.nextSibling;F(n,j(M,{get when(){return Qe(()=>!!xp(t()))()&&!m()},get children(){return j(Sp,{get confirmed(){return yp(t())}})}}),i),F(u,()=>dp[e.scope]),F(c,j(M,{get when(){return e.elsewhere>0},get children(){var t=Ff(),n=t.firstChild,r=n.firstChild.nextSibling,i=r.nextSibling.nextSibling;return i.nextSibling,it(n,`click`,e.onSwitch,!0),F(n,()=>dp[e.scope===`hierarchy`?`environment`:`hierarchy`].toLowerCase(),r),F(n,()=>String(e.elsewhere),i),t}}),d),F(d,j(M,{get when(){return y().length>0},fallback:`Nothing to review`,get children(){return[(()=>{var e=If(),t=e.firstChild;return F(e,()=>String(r()+1),t),F(e,()=>String(y().length),null),e})(),` `,Qe(()=>b()?.label??``)]}})),F(f,j(tc,{type:`button`,variant:`subtle`,get disabled(){return r()===0},onClick:()=>{A(-1)},children:`Previous`}),null),F(f,j(M,{get when(){return ee()},get fallback(){return j(tc,{type:`button`,get disabled(){return y().length===0||te().length>0},onClick:()=>{A(1,!0)},children:`Confirm and continue`})},get children(){return j(tc,{type:`button`,get disabled(){return te().length>0},onClick:()=>{k()},children:`Finish review`})}}),null),F(n,j(M,{get when(){return b()},children:n=>(()=>{var r=Yf(),i=r.firstChild,a=i.firstChild,o=a.firstChild,s=o.nextSibling,c=i.nextSibling,l=c.firstChild,u=c.nextSibling,d=u.firstChild;return F(i,j(hp,{get kind(){return e.scope===`hierarchy`?`repo`:`environment`}}),a),F(o,()=>e.scope===`hierarchy`?`Repository`:`Environment`),F(s,()=>n().label),F(a,j(qe,{get each(){return n().scans},children:e=>(()=>{var t=Xf(),n=t.firstChild,r=n.nextSibling;return r.nextSibling,F(t,()=>e.localPath,n),F(t,()=>e.branch??`detached`,r),F(t,()=>e.commitSha??``,null),F(t,j(M,{get when(){return e.dirty},get children(){return[` `,j($s,{status:`warning`,children:`uncommitted changes`})]}}),null),O(()=>P(t,`title`,e.localPath)),t})()}),null),F(r,j(M,{get when(){return n().repo?.requiresIdentityResolution===!0},get children(){var e=Hf(),r=e.firstChild.nextSibling;return F(r,j(ac,{label:`Canonical host and path`,for:`no-remote-identity`,hint:`It has no remote, so nothing derived an identity for it.`,get children(){var e=Bf();return e.addEventListener(`change`,e=>{w(pd(t(),n().unitKey,{mode:`new`,repoKey:e.currentTarget.value}))}),e}}),null),F(r,j(M,{get when(){return t().projection.committed.repos.length>0},get children(){return j(ac,{label:`Or reuse a Repo already committed`,for:`reuse-repo`,get children(){var e=Vf();return e.firstChild,e.addEventListener(`change`,e=>{e.currentTarget.value.length!==0&&w(pd(t(),n().unitKey,{mode:`reuse`,repoKey:e.currentTarget.value}))}),F(e,j(qe,{get each(){return t().projection.committed.repos},children:e=>(()=>{var t=Zf(),n=t.firstChild,r=n.nextSibling;return r.nextSibling,F(t,()=>e.name,n),F(t,()=>e.repoKey,r),O(()=>t.value=e.repoKey),t})()}),null),e}})}}),null),e}}),c),F(r,j(M,{get when(){return e.scope===`hierarchy`},get children(){var e=Uf(),r=e.firstChild;r.firstChild;var i=r.nextSibling.firstChild,a=i.nextSibling,o=a.firstChild;return F(r,j(mp,{label:`Why this is asked`,children:`Discovery inferred this from the files it read, but you know the definitive answer. Application and Service are the logical topology components that describe the software from your organization's point of view. This repository holds the code that implements one of them, and that drives the value being delivered. They define the thing that is deployed, not a running instance of it. An Environment, which you will confirm later, is a configured instance of these logical components running and communicating with other software.`}),null),F(i,j(qe,{each:gp,children:e=>(()=>{var r=Qf(),i=r.firstChild,a=i.nextSibling.firstChild,o=a.nextSibling;return i.addEventListener(`change`,()=>{w(Cd(t(),n().unitKey,e.select))}),F(a,()=>e.label),F(o,()=>e.detail),O(()=>r.classList.toggle(`is-chosen`,!!(C()&&e.matches(S())))),O(()=>i.checked=C()&&e.matches(S())),r})()})),o.addEventListener(`change`,e=>{w(Cd(t(),n().unitKey,{hasIac:e.currentTarget.checked}))}),F(e,j(M,{get when(){return Od(t(),n().unitKey)},children:e=>(()=>{var t=$f();return F(t,e),t})()}),null),O(()=>a.classList.toggle(`is-chosen`,!!S().hasIac)),O(()=>o.checked=S().hasIac),e}}),c),F(l,()=>e.scope===`hierarchy`?`Logical facts`:`What is deployed here`),F(c,j(M,{get when(){return Qe(()=>e.scope===`hierarchy`)()&&S().hasApplication},get children(){return[j(qe,{get each(){return Nd(t(),n().unitKey)},children:e=>j(Ep,{get state(){return t()},label:`This repository implements Application`,get fact(){return e.application},get speaksFor(){return[e.application.candidate,...e.implementation===null?[]:[e.implementation]]},get onEdit(){return T(e.application,`name`)},onEvidence:()=>{v([e.application.candidate,...e.implementation===null?[]:[e.implementation]])},get problem(){return te().find(t=>t.candidateId===e.application.candidate.candidateId)?.message}})}),j(M,{get when(){return Nd(t(),n().unitKey).length===0},get children(){return Wf()}})]}}),null),F(c,j(M,{get when(){return Qe(()=>e.scope===`hierarchy`)()&&S().hasService},get children(){return[j(qe,{get each(){return Pd(t(),n().unitKey)},children:e=>j(Ep,{get state(){return t()},label:`This repository implements logical Service`,get fact(){return e.service},get speaksFor(){return vp(e)},get onEdit(){return T(e.service,`name`)},onEvidence:()=>{v(vp(e))},get included(){return Qe(()=>!!ed(t(),e.service.candidate.candidateId))()?{checked:Zu(t(),e.service.candidate.candidateId),onChange:n=>{w(td(t(),e.service.candidate.candidateId,n))}}:void 0},get problem(){return te().find(t=>t.candidateId===e.service.candidate.candidateId)?.message},get children(){return j(M,{get when(){return e.membership},get fallback(){return j(_p,{get id(){return`placement-${e.service.candidate.candidateId}`},label:`Under Application`,get value(){return e.placement},get options(){return ad(t())},onSelect:r=>{w(wd(t(),n().unitKey,e.service.candidate.candidateId,r))},onCreate:r=>{let i=cd(t(),n().unitKey,r),a=bo(r);w(a===null?i:wd(i,n().unitKey,e.service.candidate.candidateId,a))},validateCreate:e=>sd(t(),e)})},children:e=>j(_p,{get id(){return`membership-${e().candidate.candidateId}`},label:`Under Application`,get value(){return e().value},get options(){return ad(t())},onSelect:t=>{T(e(),`applicationKey`)(t)},onCreate:r=>{w(od(t(),n().unitKey,e().candidate.candidateId,r))},validateCreate:e=>sd(t(),e)})})}})}),j(M,{get when(){return Qe(()=>Pd(t(),n().unitKey).length===0)()&&n().repo},children:e=>[(()=>{var r=tp();return F(r,j(ac,{label:`Service name`,for:`create-service`,get children(){var e=ep();return e.$$input=e=>{g({...x(),name:e.currentTarget.value})},O(()=>e.value=x().name),e}}),null),F(r,j(_p,{get id(){return`create-service-application-${n().unitKey}`},label:`Under Application`,get value(){return x().applicationKey},get options(){return ad(t())},onSelect:e=>{g({...x(),applicationKey:e})},onCreate:e=>{w(cd(t(),n().unitKey,e));let r=bo(e);r!==null&&g({...x(),applicationKey:r})},validateCreate:e=>sd(t(),e)}),null),F(r,j(tc,{type:`button`,get disabled(){return ud(t(),{unitKey:n().unitKey,repoKey:e().repoKey,applicationKey:x().applicationKey,name:x().name})!==null},onClick:()=>{w(dd(t(),{unitKey:n().unitKey,repoKey:e().repoKey,applicationKey:x().applicationKey,name:x().name})),g(rf(n().unitKey))},children:`Add`}),null),r})(),np(),j(M,{get when(){return Qe(()=>x().name!==``)()&&ud(t(),{unitKey:n().unitKey,repoKey:e().repoKey,applicationKey:x().applicationKey,name:x().name})},children:e=>(()=>{var t=rp();return F(t,e),t})()})]})]}}),null),F(c,j(M,{get when(){return e.scope===`environment`},get children(){return[j(M,{get when(){return Fd(t(),n().unitKey)},children:e=>j(Ep,{get state(){return t()},label:`This Environment`,get fact(){return e()},get speaksFor(){return[e().candidate]},get onEdit(){return T(e(),`name`)},onEvidence:()=>{v([e().candidate])}})}),j(qe,{get each(){return Id(t(),n().unitKey)},children:e=>j(Ep,{get state(){return t()},label:`Deployed here`,get hint(){return e.deployment===null?`Nothing says where this is deployed from.`:void 0},get fact(){return e.instance},get speaksFor(){return[e.instance.candidate,...e.deployment===null?[]:[e.deployment]]},get onEdit(){return T(e.instance,`name`)},onEvidence:()=>{v([e.instance.candidate,...e.deployment===null?[]:[e.deployment]])}})})]}}),null),F(c,j(M,{get when(){return Qe(()=>e.scope===`hierarchy`&&!S().hasApplication)()&&!S().hasService},get children(){var e=Gf();return F(e,j(M,{get when(){return S().hasIac},fallback:`Nothing this model records. This repository will be set aside, and nothing will be committed for it.`,children:`Nothing logical: this repository carries infrastructure only.`})),e}}),null),F(c,j(M,{get when(){return Hd(t(),n().unitKey).length>0},get children(){return[Kf(),qf()]}}),null),F(c,j(qe,{get each(){return Hd(t(),n().unitKey)},children:e=>(()=>{var r=ip(),i=r.firstChild.firstChild,a=i.nextSibling;return i.addEventListener(`change`,n=>{w(td(t(),e.candidateId,n.currentTarget.checked))}),F(a,()=>Vd(t(),e),null),F(a,j(qe,{get each(){return Bd(t(),n().unitKey,e)},children:e=>(()=>{var t=ap();return F(t,e),t})()}),null),F(r,j(Tp,{get evidence(){return Gu(t(),[e])},onClick:()=>{v([e])}}),null),O(()=>r.classList.toggle(`is-excluded`,!Zu(t(),e.candidateId))),O(()=>i.checked=Zu(t(),e.candidateId)),r})()}),null),F(r,j(M,{get when(){return _().length>0},get children(){return j(pp,{get draft(){return t()},get candidates(){return _()},onClose:()=>{v([])}})}}),u),F(r,j(M,{get when(){return te().some(e=>e.candidateId===void 0)},get children(){var e=Jf();return F(e,j(qe,{get each(){return te().filter(e=>e.candidateId===void 0)},children:e=>(()=>{var t=op();return F(t,()=>e.message),t})()})),e}}),u),F(u,j(tc,{type:`button`,variant:`subtle`,onClick:()=>{w(gd(t(),n().unitKey))},children:`Reset`}),d),F(d,j(tc,{type:`button`,variant:`subtle`,onClick:()=>{w(Iu(t()))},children:`Undo`})),r})()}),p);var h=E;return typeof h==`function`?at(h,p):E=p,F(p,j(kp,{get draft(){return t()},get unitKey(){return b()?.unitKey??``},get counts(){return Qd(t())},get blockedBy(){return[...new Set(ef(t()).map(e=>e.unitKey))]},get note(){return a()?`This is written into the estate in one go, and cannot be undone.`:void 0},get action(){return j(M,{get when(){return ef(t()).length===0},get children(){return j(M,{get when(){return a()},get fallback(){return j(tc,{type:`button`,onClick:()=>{o(!0)},get disabled(){return Jd(t()).length===0},get children(){return[`Commit `,Qe(()=>String(Ud(t()).size)),Qe(()=>Ud(t()).size===1?` repository`:` repositories`)]}})},get children(){return[j(tc,{type:`button`,get disabled(){return s()},onClick:()=>{ne()},get children(){return s()?`Committing.`:`Commit`}}),j(tc,{type:`button`,variant:`subtle`,onClick:()=>{o(!1)},children:`Go back`})]}})}})}}),null),F(p,j(M,{get when(){return l()},children:e=>(()=>{var t=sp();return F(t,e),t})()}),null),n}})}function jp(){let[e,t]=D({kind:`loading`}),n=async e=>{t({kind:`loading`});let n=await os({method:`GET`,path:ai,schema:vo,attempted:`resolve which topology review stage is ready`});if(!n.ok){t({kind:`failed`,message:`${n.error.message} (while trying to ${n.error.attempted})`});return}let{stage:r,hierarchyCount:i,environmentCount:a}=n.value.value;if(r===`nothing_to_review`){t({kind:`nothing`});return}let o=e??r,s=await fp(o);t(typeof s==`string`?{kind:`failed`,message:s}:{kind:`ready`,scope:o,projection:s,elsewhere:o===`hierarchy`?a:i})};return ae(()=>{n()}),j(M,{get when(){return Qe(()=>e().kind===`ready`)()?e():void 0},keyed:!0,get fallback(){return j(Mp,{get load(){return e()}})},children:e=>e.kind===`ready`?j(Ap,{get scope(){return e.scope},get projection(){return e.projection},get elsewhere(){return e.elsewhere},onContinue:()=>{n()},onSwitch:()=>{n(e.scope===`hierarchy`?`environment`:`hierarchy`)}}):null})}function Mp(e){return[j(M,{get when(){return e.load.kind===`loading`},get children(){return cp()}}),j(M,{get when(){return e.load.kind===`nothing`},get children(){return j(nc,{title:`Nothing to review`,children:`Discovery has proposed nothing that can be reviewed right now.`})}}),j(M,{get when(){return Qe(()=>e.load.kind===`failed`)()?e.load.message:void 0},children:e=>(()=>{var t=op();return F(t,e),t})()})]}nt([`click`,`input`]);var Np=fe();function Pp(e){return j(Np.Provider,{get value(){return e.value},get children(){return e.children}})}function Fp(){let e=pe(Np);if(e===void 0)throw TypeError(`Topology pending-review context is unavailable.`);return e}function Ip(e){return e.trim().toLowerCase()}function Lp(e){let t=Ip(e);return t===`git`?`github`:t===`k8s`?`kubernetes`:t}function Rp(e){let t=new Set;for(let n of e){let e=Lp(n);e.length>0&&t.add(e)}return t}function zp(e,t,n,r){if(t.nodeKinds.size>0&&!t.nodeKinds.has(e.kind)||n.length>0&&!Ip(e.label).includes(n)&&!Ip(e.entityKey).includes(n))return!1;if(r.size===0)return!0;let i=new Set(e.providers.map(Lp).filter(e=>e.length>0));for(let e of r)if(i.has(e))return!0;return!1}function Bp(e,t,n){return t.length>0||e.nodeKinds.size>0||e.relationshipKinds.size>0||n.size>0}function Vp(e,t){let n=Ip(t.query),r=Rp(t.providers);if(!Bp(t,n,r))return e;let i=e.nodes.filter(e=>zp(e,t,n,r)),a=new Set(i.map(e=>e.key)),o=e.edges.filter(e=>(t.relationshipKinds.size===0||t.relationshipKinds.has(e.kind))&&a.has(e.source)&&a.has(e.target)),s=new Set;for(let e of o)s.add(e.source),s.add(e.target);return{nodes:n.length>0||r.size>0?i:i.filter(e=>s.has(e.key)),edges:o,totals:e.totals}}function Hp(e,t){return{nodes:e.nodes.filter(e=>t.has(e.key)),edges:e.edges.filter(e=>t.has(e.source)&&t.has(e.target)),totals:e.totals}}function Up(e,t){let n=new Map(e.nodes.map(e=>[e.key,e])),r=e=>e?.kind===`repo`||e?.kind===`system_ref`,i=!0;for(;i;){i=!1;for(let a of e.edges){let e=t.has(a.source),o=t.has(a.target);e&&!o&&r(n.get(a.target))&&(t.add(a.target),i=!0),o&&!e&&r(n.get(a.source))&&(t.add(a.source),i=!0)}}}function Wp(e,t){let n=new Set;for(let r of e.nodes)r.kind===`application`&&r.entityKey===t&&n.add(r.key),r.kind===`environment`&&r.applicationKey===t&&n.add(r.key);return n}function Gp(e,t){let n=Wp(e,t),r=new Set(e.nodes.filter(e=>e.kind===`environment`&&e.applicationKey===t).map(e=>e.entityKey)),i=new Set(e.nodes.filter(e=>e.kind===`service`&&e.applicationKeys.includes(t)).map(e=>e.entityKey));for(let t of e.nodes)t.kind===`service`&&i.has(t.entityKey)&&n.add(t.key);for(let t of e.nodes){if(t.kind!==`service_instance`)continue;let e=t.environmentKey!==null&&r.has(t.environmentKey),a=t.environmentKey===null&&t.serviceKey!==null&&i.has(t.serviceKey);(e||a)&&n.add(t.key)}return Up(e,n),n}function Kp(e,t){let n=new Set;for(let r of e.nodes)r.kind===`environment`&&r.entityKey===t&&n.add(r.key);let r=new Set;for(let i of e.nodes)i.kind===`service_instance`&&i.environmentKey===t&&(n.add(i.key),i.serviceKey!==null&&r.add(i.serviceKey));for(let t of e.nodes)t.kind===`service`&&r.has(t.entityKey)&&n.add(t.key);return Up(e,n),n}function qp(e,t){return t.kind===`estate`?e:t.kind===`application`?Hp(e,t.mode===`overview`?Wp(e,t.applicationKey):Gp(e,t.applicationKey)):Hp(e,Kp(e,t.environmentKey))}var Jp={application:16,environment:14,system_ref:13,service:13,service_instance:11,repo:12},Yp=3.2,Xp=2;function Zp(e){let t=new Map,n=(e,n)=>{let r=t.get(e)??{dependents:0,dependencies:0};r[n]+=1,t.set(e,r)};for(let t of e)n(t.target,`dependents`),n(t.source,`dependencies`);return t}function Qp(e,t){let n=t?.dependents??0,r=t?.dependencies??0,i=Math.sqrt(Xp*n+r);return{dependents:n,dependencies:r,score:Math.round(i*100)/100,size:Math.round((Jp[e]+Yp*i)*10)/10}}function $p(e){return e.kind===`estate`?void 0:e.applicationKey}function em(e,t){if(e.kind===`application`)return t.kind===`application`&&t.applicationKey===e.entityKey?{kind:`select`}:{kind:`navigate`,focus:{kind:`application`,applicationKey:e.entityKey,mode:`overview`}};if(e.kind===`environment`){if(t.kind===`environment`&&t.environmentKey===e.entityKey)return{kind:`select`};if(e.applicationKey===null)throw TypeError(`Environment "${e.entityKey}" has no parent Application key.`);return{kind:`navigate`,focus:{kind:`environment`,applicationKey:e.applicationKey,environmentKey:e.entityKey}}}return{kind:`select`}}var tm=`data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA5NjAgNTIwIiByb2xlPSJpbWciIGFyaWEtbGFiZWxsZWRieT0idGl0bGUgZGVzY3JpcHRpb24iPgogIDx0aXRsZSBpZD0idGl0bGUiPkV4YW1wbGUgT3BzQ2FudmFzIHRvcG9sb2d5IGdyYXBoPC90aXRsZT4KICA8ZGVzYyBpZD0iZGVzY3JpcHRpb24iPkFwcGxpY2F0aW9ucywgZW52aXJvbm1lbnRzLCBzZXJ2aWNlcywgcmVwb3NpdG9yaWVzLCBhbmQgc3lzdGVtcyBjb25uZWN0ZWQgaW4gYW4gZXN0YXRlIGdyYXBoLjwvZGVzYz4KICA8cmVjdCB3aWR0aD0iOTYwIiBoZWlnaHQ9IjUyMCIgcng9IjIwIiBmaWxsPSIjZjdmOWZjIi8+CiAgPGcgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjODQ5MmE4IiBzdHJva2Utd2lkdGg9IjMiIG9wYWNpdHk9IjAuNzUiPgogICAgPCEtLSBoYXNfZW52aXJvbm1lbnQ6IENoZWNrb3V0IOKGkiBQcm9kdWN0aW9uIC0tPgogICAgPHBhdGggZD0iTTE2NCAxMzUgQzI1MCAxMDAgMjg1IDExNSAzNjAgMTcwIi8+CiAgICA8IS0tIGhhc19lbnZpcm9ubWVudDogQ2hlY2tvdXQg4oaSIFN0YWdpbmcgLS0+CiAgICA8cGF0aCBkPSJNMTY0IDEzNSBDMjQ1IDIwNSAyNzAgMjMwIDM1MCAyNjUiLz4KICAgIDwhLS0gbWVtYmVyX3NlcnZpY2U6IENoZWNrb3V0IOKGkiBQYXltZW50cyAtLT4KICAgIDxwYXRoIGQ9Ik0xNjQgMTM1IEMzMDAgNzAgNDUwIDkwIDU5NSAyMDUiLz4KICAgIDwhLS0gcnVuc19pbnN0YW5jZTogUHJvZHVjdGlvbiDihpIgU2VydmljZSBpbnN0YW5jZSAtLT4KICAgIDxwYXRoIGQ9Ik0zNjAgMTcwIEM0MzAgMjUwIDUwMCAzMTAgNTcwIDM4MCIvPgogICAgPCEtLSBydW5zX2luc3RhbmNlOiBTdGFnaW5nIOKGkiBTZXJ2aWNlIGluc3RhbmNlIC0tPgogICAgPHBhdGggZD0iTTM1MCAyNjUgQzQyMCAzNTAgNDc1IDM4MCA1NzAgMzgwIi8+CiAgICA8IS0tIGluc3RhbmNlX29mOiBTZXJ2aWNlIGluc3RhbmNlIOKGkiBQYXltZW50cyAtLT4KICAgIDxwYXRoIGQ9Ik01NzAgMzgwIEM1NzUgMzM1IDU4NSAyNzUgNTk1IDIwNSIvPgogICAgPCEtLSBQYXltZW50cyDihpIgU3RyaXBlIC0tPgogICAgPHBhdGggZD0iTTU5NSAyMDUgQzY2NSAxNTUgNzIwIDE0MCA4MDAgMTY1Ii8+CiAgICA8IS0tIFBheW1lbnRzIOKGkiBSZXBvc2l0b3J5IC0tPgogICAgPHBhdGggZD0iTTU5NSAyMDUgQzY2NSAyNDUgNzE1IDI3NSA3OTUgMzEwIi8+CiAgPC9nPgogIDxnIGZvbnQtZmFtaWx5PSJBcmlhbCwgc2Fucy1zZXJpZiIgdGV4dC1hbmNob3I9Im1pZGRsZSI+CiAgICA8ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSgxNjQgMTM1KSI+CiAgICAgIDxjaXJjbGUgcj0iNDMiIGZpbGw9IiMwMDVjZTAiLz4KICAgICAgPHRleHQgeT0iOCIgZmlsbD0iI2ZmZiIgZm9udC1zaXplPSIyNiIgZm9udC13ZWlnaHQ9IjcwMCI+QTwvdGV4dD4KICAgICAgPHRleHQgeT0iNzAiIGZpbGw9IiMxZDI5NDIiIGZvbnQtc2l6ZT0iMTciIGZvbnQtd2VpZ2h0PSI2MDAiPkNoZWNrb3V0PC90ZXh0PgogICAgPC9nPgogICAgPGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMzYwIDE3MCkiPgogICAgICA8Y2lyY2xlIHI9IjM0IiBmaWxsPSIjNGUzY2QyIi8+CiAgICAgIDx0ZXh0IHk9IjciIGZpbGw9IiNmZmYiIGZvbnQtc2l6ZT0iMjEiIGZvbnQtd2VpZ2h0PSI3MDAiPkU8L3RleHQ+CiAgICAgIDx0ZXh0IHk9IjYxIiBmaWxsPSIjMWQyOTQyIiBmb250LXNpemU9IjE1IiBmb250LXdlaWdodD0iNjAwIj5Qcm9kdWN0aW9uPC90ZXh0PgogICAgPC9nPgogICAgPGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMzUwIDI2NSkiPgogICAgICA8Y2lyY2xlIHI9IjM0IiBmaWxsPSIjNGUzY2QyIi8+CiAgICAgIDx0ZXh0IHk9IjciIGZpbGw9IiNmZmYiIGZvbnQtc2l6ZT0iMjEiIGZvbnQtd2VpZ2h0PSI3MDAiPkU8L3RleHQ+CiAgICAgIDx0ZXh0IHk9IjYxIiBmaWxsPSIjMWQyOTQyIiBmb250LXNpemU9IjE1IiBmb250LXdlaWdodD0iNjAwIj5TdGFnaW5nPC90ZXh0PgogICAgPC9nPgogICAgPGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoNTk1IDIwNSkiPgogICAgICA8Y2lyY2xlIHI9IjQyIiBmaWxsPSIjMjJiNjdjIi8+CiAgICAgIDx0ZXh0IHk9IjgiIGZpbGw9IiNmZmYiIGZvbnQtc2l6ZT0iMjYiIGZvbnQtd2VpZ2h0PSI3MDAiPlM8L3RleHQ+CiAgICAgIDx0ZXh0IHk9IjcwIiBmaWxsPSIjMWQyOTQyIiBmb250LXNpemU9IjE3IiBmb250LXdlaWdodD0iNjAwIj5QYXltZW50czwvdGV4dD4KICAgIDwvZz4KICAgIDxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDgwMCAxNjUpIj4KICAgICAgPGNpcmNsZSByPSIzNSIgZmlsbD0iI2YwMjE2YiIvPgogICAgICA8dGV4dCB5PSI3IiBmaWxsPSIjZmZmIiBmb250LXNpemU9IjIxIiBmb250LXdlaWdodD0iNzAwIj5DPC90ZXh0PgogICAgICA8dGV4dCB5PSI2MiIgZmlsbD0iIzFkMjk0MiIgZm9udC1zaXplPSIxNSIgZm9udC13ZWlnaHQ9IjYwMCI+U3RyaXBlPC90ZXh0PgogICAgPC9nPgogICAgPGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoNzk1IDMxMCkiPgogICAgICA8Y2lyY2xlIHI9IjM0IiBmaWxsPSIjMTgxNzE3Ii8+CiAgICAgIDxnIHRyYW5zZm9ybT0ic2NhbGUoMS4xNjcpIHRyYW5zbGF0ZSgtMTIgLTEyKSI+CiAgICAgICAgPHBhdGggZmlsbD0iI2ZmZmZmZiIgZD0iTTEyIC4yOTdjLTYuNjMgMC0xMiA1LjM3My0xMiAxMiAwIDUuMzAzIDMuNDM4IDkuOCA4LjIwNSAxMS4zODUuNi4xMTMuODItLjI1OC44Mi0uNTc3IDAtLjI4NS0uMDEtMS4wNC0uMDE1LTIuMDQtMy4zMzguNzI0LTQuMDQyLTEuNjEtNC4wNDItMS42MUM0LjQyMiAxOC4wNyAzLjYzMyAxNy43IDMuNjMzIDE3LjdjLTEuMDg3LS43NDQuMDg0LS43MjkuMDg0LS43MjkgMS4yMDUuMDg0IDEuODM4IDEuMjM2IDEuODM4IDEuMjM2IDEuMDcgMS44MzUgMi44MDkgMS4zMDUgMy40OTUuOTk4LjEwOC0uNzc2LjQxNy0xLjMwNS43Ni0xLjYwNS0yLjY2NS0uMy01LjQ2Ni0xLjMzMi01LjQ2Ni01LjkzIDAtMS4zMS40NjUtMi4zOCAxLjIzNS0zLjIyLS4xMzUtLjMwMy0uNTQtMS41MjMuMTA1LTMuMTc2IDAgMCAxLjAwNS0uMzIyIDMuMyAxLjIzLjk2LS4yNjcgMS45OC0uMzk5IDMtLjQwNSAxLjAyLjAwNiAyLjA0LjEzOCAzIC40MDUgMi4yOC0xLjU1MiAzLjI4NS0xLjIzIDMuMjg1LTEuMjMuNjQ1IDEuNjUzLjI0IDIuODczLjEyIDMuMTc2Ljc2NS44NCAxLjIzIDEuOTEgMS4yMyAzLjIyIDAgNC42MS0yLjgwNSA1LjYyNS01LjQ3NSA1LjkyLjQyLjM2LjgxIDEuMDk2LjgxIDIuMjIgMCAxLjYwNi0uMDE1IDIuODk2LS4wMTUgMy4yODYgMCAuMzE1LjIxLjY5LjgyNS41N0MyMC41NjUgMjIuMDkyIDI0IDE3LjU5MiAyNCAxMi4yOTdjMC02LjYyNy01LjM3My0xMi0xMi0xMiIvPgogICAgICA8L2c+CiAgICAgIDx0ZXh0IHk9IjYxIiBmaWxsPSIjMWQyOTQyIiBmb250LXNpemU9IjE1IiBmb250LXdlaWdodD0iNjAwIj5SZXBvc2l0b3J5PC90ZXh0PgogICAgPC9nPgogICAgPGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoNTcwIDM4MCkiPgogICAgICA8Y2lyY2xlIHI9IjM3IiBmaWxsPSIjNTk5NWViIi8+CiAgICAgIDx0ZXh0IHk9IjciIGZpbGw9IiNmZmYiIGZvbnQtc2l6ZT0iMjIiIGZvbnQtd2VpZ2h0PSI3MDAiPkk8L3RleHQ+CiAgICAgIDx0ZXh0IHk9IjY1IiBmaWxsPSIjMWQyOTQyIiBmb250LXNpemU9IjE1IiBmb250LXdlaWdodD0iNjAwIj5TZXJ2aWNlIGluc3RhbmNlPC90ZXh0PgogICAgPC9nPgogIDwvZz4KICA8dGV4dAogICAgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoNDgwIDI2MCkgcm90YXRlKC0yOCkiCiAgICB0ZXh0LWFuY2hvcj0ibWlkZGxlIgogICAgZG9taW5hbnQtYmFzZWxpbmU9Im1pZGRsZSIKICAgIGZvbnQtZmFtaWx5PSJBcmlhbCwgc2Fucy1zZXJpZiIKICAgIGZvbnQtc2l6ZT0iMTQwIgogICAgZm9udC13ZWlnaHQ9IjcwMCIKICAgIGxldHRlci1zcGFjaW5nPSIyOCIKICAgIGZpbGw9IiMxZDI5NDIiCiAgICBvcGFjaXR5PSIwLjEwIgogID5ERU1PPC90ZXh0Pgo8L3N2Zz4K`;function nm(e,t,n){return e===void 0?{kind:`loading`}:e.ok?e.value.totals.nodeCount>0?{kind:`graph`}:t===void 0?{kind:`loading`}:t.ok?t.value.value.count>0?{kind:`reviewable`,count:t.value.value.count,confirmAvailable:n}:{kind:`empty`}:{kind:`indeterminate`,error:t.error}:{kind:`graph_failure`,error:e.error}}function rm(e,t,n){return`${e} · ${t.toLocaleString()} nodes · ${n.toLocaleString()} relationships`}var im=`data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='80'%20height='80'%20viewBox='4.537%205.306%2068.086%2068.086'%3e%3cpath%20fill='%23ffffff'%20fill-rule='evenodd'%20d='M6.941%2045.018%20C6.819%2045.021%206.72%2045.052%206.666%2045.113%20C6.537%2045.272%206.58%2045.542%206.771%2045.798%20C11.22%2050.026%2016.99%2053.295%2023.959%2055.695%20C33.724%2058.864%2044.63%2058.335%2052.86%2055.568%20C58.316%2053.845%2061.38%2052.003%2064.219%2049.968%20C64.558%2049.73%2064.827%2049.203%2064.581%2048.775%20C64.242%2048.277%2063.648%2048.284%2063.1%2048.532%20C61.025%2049.553%2057.898%2050.803%2052.408%2052.019%20C41.169%2054.459%2032.578%2053.563%2026.397%2052.254%20C20.764%2051.101%2014.44%2049.043%207.642%2045.217%20C7.41%2045.085%207.144%2045.014%206.941%2045.018%20Z%20M65.791%2043.781%20C64.158%2043.802%2062.215%2044.152%2059.413%2045.43%20C59.044%2045.608%2058.647%2045.855%2058.695%2046.123%20C58.758%2046.32%2058.92%2046.415%2059.305%2046.357%20C60.863%2046.075%2064.175%2045.637%2066.02%2046.04%20C67.552%2046.342%2067.826%2046.955%2067.557%2048.512%20C67.037%2050.883%2066.354%2052.788%2065.685%2054.402%20C65.473%2054.875%2065.495%2055.223%2065.654%2055.308%20C65.846%2055.394%2066.214%2055.325%2066.388%2055.11%20C68.792%2052.515%2070.081%2049.514%2070.417%2046.353%20C70.623%2044.929%2069.964%2044.157%2068.514%2043.969%20C67.639%2043.875%2066.771%2043.769%2065.791%2043.781%20Z%20M17.238%2030.338%20C18.335%2030.338%2019.717%2030.538%2021.229%2030.904%20L21.233%2033.171%20C21.233%2034.369%2019.486%2036.73%2016.091%2037.11%20C14.181%2037.262%2012.628%2035.851%2012.648%2033.973%20C12.713%2031.749%2013.907%2030.748%2016.241%2030.405%20C16.538%2030.36%2016.872%2030.338%2017.238%2030.338%20Z%20M49.602%2020.417%20C49.176%2020.417%2048.936%2020.582%2048.808%2021.058%20L44.889%2036.268%20L41.388%2021.251%20C41.278%2020.818%2040.929%2020.461%2040.339%2020.461%20L38.295%2020.461%20C37.84%2020.461%2037.623%2020.826%2037.442%2021.51%20L34.066%2036.061%20L30.206%2021.226%20C30.078%2020.774%2029.736%2020.474%2029.254%2020.474%20L26.911%2020.445%20C26.655%2020.445%2026.556%2020.655%2026.664%2021.021%20L31.891%2038.157%20C32.027%2038.68%2032.346%2039.025%2032.745%2039.025%20L34.975%2039.033%20C35.403%2039.033%2035.826%2038.625%2035.969%2038.047%20L39.384%2023.667%20L42.901%2038.11%20C43.062%2038.756%2043.451%2039.041%2043.854%2039.041%20L45.808%2039.057%20C46.203%2039.057%2046.703%2038.697%2046.827%2038.339%20L52.142%2021.192%20C52.264%2020.76%2052.213%2020.445%2051.737%2020.445%20Z%20M18.038%2019.895%20C15.383%2019.893%2012.754%2020.47%2011.206%2021.219%20C10.782%2021.437%2010.534%2021.723%2010.534%2022.3%20L10.542%2023.306%20C10.524%2023.688%2010.927%2023.999%2011.316%2023.853%20C13.344%2022.946%2015.222%2022.4%2017.216%2022.489%20C20.061%2022.666%2021.248%2024.567%2021.248%2026.236%20L21.26%2028.923%20C19.185%2028.287%2016.171%2027.907%2014.542%2028.235%20C12.194%2028.675%209.785%2030.295%209.395%2032.748%20C8.877%2035.415%2010.054%2037.831%2011.33%2038.573%20C13.547%2039.911%2016.064%2039.652%2017.561%2039.15%20C19.216%2038.585%2020.356%2037.551%2021.403%2036.377%20C21.792%2037.518%2022.269%2038.412%2022.798%2038.949%20C22.971%2039.123%2023.297%2039.278%2023.616%2039.099%20L25.303%2037.863%20C25.481%2037.673%2025.518%2037.301%2025.354%2037.011%20L24.77%2035.931%20C24.547%2035.505%2024.389%2035.022%2024.389%2033.974%20L24.392%2025.702%20C24.194%2022.339%2022.011%2020.032%2018.569%2019.904%20C18.392%2019.899%2018.215%2019.896%2018.038%2019.896%20Z%20M61.194%2019.847%20C60.665%2019.851%2060.118%2019.897%2059.534%2019.985%20C57.096%2020.361%2054.816%2021.614%2054.177%2024.068%20C53.606%2026.618%2055.274%2029.093%2057.161%2029.933%20C58.916%2030.77%2061.51%2030.946%2063.599%2032.393%20C64.722%2033.224%2064.628%2034.338%2064.012%2035.369%20C63.235%2036.421%2061.771%2037.004%2059.798%2037.004%20C58.131%2037.004%2056.404%2036.389%2054.87%2035.797%20C54.164%2035.563%2053.859%2035.724%2053.859%2036.088%20L53.859%2037.487%20C53.859%2037.886%2054.107%2038.155%2054.461%2038.306%20C56.392%2039.256%2060.17%2040.025%2062.864%2039.303%20C66.525%2038.232%2067.538%2036.196%2067.611%2033.859%20C67.65%2031.682%2066.434%2029.826%2064.35%2029.08%20C61.6%2027.98%2060.579%2028.17%2058.52%2026.965%20C57.446%2026.304%2056.655%2025.04%2057.95%2023.42%20C58.939%2022.47%2059.69%2022.277%2061.741%2022.341%20C63.103%2022.4%2064.483%2022.669%2065.582%2023.268%20C66.131%2023.507%2066.485%2023.317%2066.485%2022.788%20L66.485%2021.608%20C66.477%2021.375%2066.332%2021.093%2066.006%2020.933%20C64.206%2020.198%2062.78%2019.834%2061.194%2019.847%20Z'/%3e%3c/svg%3e`,am=`data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='128'%20height='128'%20viewBox='0%200%2024%2024'%3e%3cpath%20fill='%23ffffff'%20d='M12%20.297c-6.63%200-12%205.373-12%2012%200%205.303%203.438%209.8%208.205%2011.385.6.113.82-.258.82-.577%200-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422%2018.07%203.633%2017.7%203.633%2017.7c-1.087-.744.084-.729.084-.729%201.205.084%201.838%201.236%201.838%201.236%201.07%201.835%202.809%201.305%203.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93%200-1.31.465-2.38%201.235-3.22-.135-.303-.54-1.523.105-3.176%200%200%201.005-.322%203.3%201.23.96-.267%201.98-.399%203-.405%201.02.006%202.04.138%203%20.405%202.28-1.552%203.285-1.23%203.285-1.23.645%201.653.24%202.873.12%203.176.765.84%201.23%201.91%201.23%203.22%200%204.61-2.805%205.625-5.475%205.92.42.36.81%201.096.81%202.22%200%201.606-.015%202.896-.015%203.286%200%20.315.21.69.825.57C20.565%2022.092%2024%2017.592%2024%2012.297c0-6.627-5.373-12-12-12'/%3e%3c/svg%3e`,om=`data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='128'%20height='128'%20viewBox='0%200%2024%2024'%3e%3cpath%20fill='%23ffffff'%20transform='translate(1.2%201.2)%20scale(0.9)'%20d='m23.6004%209.5927-.0337-.0862L20.3.9814a.851.851%200%200%200-.3362-.405.8748.8748%200%200%200-.9997.0539.8748.8748%200%200%200-.29.4399l-2.2055%206.748H7.5375l-2.2057-6.748a.8573.8573%200%200%200-.29-.4412.8748.8748%200%200%200-.9997-.0537.8585.8585%200%200%200-.3362.4049L.4332%209.5015l-.0325.0862a6.0657%206.0657%200%200%200%202.0119%207.0105l.0113.0087.03.0213%204.976%203.7264%202.462%201.8633%201.4995%201.1321a1.0085%201.0085%200%200%200%201.2197%200l1.4995-1.1321%202.4619-1.8633%205.006-3.7489.0125-.01a6.0682%206.0682%200%200%200%202.0094-7.003z'/%3e%3c/svg%3e`,sm=`data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='128'%20height='128'%20viewBox='0%200%2024%2024'%3e%3cpath%20fill='%23ffffff'%20transform='translate(1.2%201.2)%20scale(0.9)'%20d='M10.204%2014.35l.007.01-.999%202.413a5.171%205.171%200%200%201-2.075-2.597l2.578-.437.004.005a.44.44%200%200%201%20.484.606zm-.833-2.129a.44.44%200%200%200%20.173-.756l.002-.011L7.585%209.7a5.143%205.143%200%200%200-.73%203.255l2.514-.725.002-.009zm1.145-1.98a.44.44%200%200%200%20.699-.337l.01-.005.15-2.62a5.144%205.144%200%200%200-3.01%201.442l2.147%201.523.004-.002zm.76%202.75l.723.349.722-.347.18-.78-.5-.623h-.804l-.5.623.179.779zm1.5-3.095a.44.44%200%200%200%20.7.336l.008.003%202.134-1.513a5.188%205.188%200%200%200-2.992-1.442l.148%202.615.002.001zm10.876%205.97l-5.773%207.181a1.6%201.6%200%200%201-1.248.594l-9.261.003a1.6%201.6%200%200%201-1.247-.596l-5.776-7.18a1.583%201.583%200%200%201-.307-1.34L2.1%205.573c.108-.47.425-.864.863-1.073L11.305.513a1.606%201.606%200%200%201%201.385%200l8.345%203.985c.438.209.755.604.863%201.073l2.062%208.955c.108.47-.005.963-.308%201.34zm-3.289-2.057c-.042-.01-.103-.026-.145-.034-.174-.033-.315-.025-.479-.038-.35-.037-.638-.067-.895-.148-.105-.04-.18-.165-.216-.216l-.201-.059a6.45%206.45%200%200%200-.105-2.332%206.465%206.465%200%200%200-.936-2.163c.052-.047.15-.133.177-.159.008-.09.001-.183.094-.282.197-.185.444-.338.743-.522.142-.084.273-.137.415-.242.032-.024.076-.062.11-.089.24-.191.295-.52.123-.736-.172-.216-.506-.236-.745-.045-.034.027-.08.062-.111.088-.134.116-.217.23-.33.35-.246.25-.45.458-.673.609-.097.056-.239.037-.303.033l-.19.135a6.545%206.545%200%200%200-4.146-2.003l-.012-.223c-.065-.062-.143-.115-.163-.25-.022-.268.015-.557.057-.905.023-.163.061-.298.068-.475.001-.04-.001-.099-.001-.142%200-.306-.224-.555-.5-.555-.275%200-.499.249-.499.555l.001.014c0%20.041-.002.092%200%20.128.006.177.044.312.067.475.042.348.078.637.056.906a.545.545%200%200%201-.162.258l-.012.211a6.424%206.424%200%200%200-4.166%202.003%208.373%208.373%200%200%201-.18-.128c-.09.012-.18.04-.297-.029-.223-.15-.427-.358-.673-.608-.113-.12-.195-.234-.329-.349-.03-.026-.077-.062-.111-.088a.594.594%200%200%200-.348-.132.481.481%200%200%200-.398.176c-.172.216-.117.546.123.737l.007.005.104.083c.142.105.272.159.414.242.299.185.546.338.743.522.076.082.09.226.1.288l.16.143a6.462%206.462%200%200%200-1.02%204.506l-.208.06c-.055.072-.133.184-.215.217-.257.081-.546.11-.895.147-.164.014-.305.006-.48.039-.037.007-.09.02-.133.03l-.004.002-.007.002c-.295.071-.484.342-.423.608.061.267.349.429.645.365l.007-.001.01-.003.129-.029c.17-.046.294-.113.448-.172.33-.118.604-.217.87-.256.112-.009.23.069.288.101l.217-.037a6.5%206.5%200%200%200%202.88%203.596l-.09.218c.033.084.069.199.044.282-.097.252-.263.517-.452.813-.091.136-.185.242-.268.399-.02.037-.045.095-.064.134-.128.275-.034.591.213.71.248.12.556-.007.69-.282v-.002c.02-.039.046-.09.062-.127.07-.162.094-.301.144-.458.132-.332.205-.68.387-.897.05-.06.13-.082.215-.105l.113-.205a6.453%206.453%200%200%200%204.609.012l.106.192c.086.028.18.042.256.155.136.232.229.507.342.84.05.156.074.295.145.457.016.037.043.09.062.129.133.276.442.402.69.282.247-.118.341-.435.213-.71-.02-.039-.045-.096-.065-.134-.083-.156-.177-.261-.268-.398-.19-.296-.346-.541-.443-.793-.04-.13.007-.21.038-.294-.018-.022-.059-.144-.083-.202a6.499%206.499%200%200%200%202.88-3.622c.064.01.176.03.213.038.075-.05.144-.114.28-.104.266.039.54.138.87.256.154.06.277.128.448.173.036.01.088.019.13.028l.009.003.007.001c.297.064.584-.098.645-.365.06-.266-.128-.537-.423-.608zM16.4%209.701l-1.95%201.746v.005a.44.44%200%200%200%20.173.757l.003.01%202.526.728a5.199%205.199%200%200%200-.108-1.674A5.208%205.208%200%200%200%2016.4%209.7zm-4.013%205.325a.437.437%200%200%200-.404-.232.44.44%200%200%200-.372.233h-.002l-1.268%202.292a5.164%205.164%200%200%200%203.326.003l-1.27-2.296h-.01zm1.888-1.293a.44.44%200%200%200-.27.036.44.44%200%200%200-.214.572l-.003.004%201.01%202.438a5.15%205.15%200%200%200%202.081-2.615l-2.6-.44-.004.005z'/%3e%3c/svg%3e`,cm={application:`A`,environment:`E`,service:`S`,service_instance:`I`,system_ref:`C`,repo:`R`};function lm(e){return e.glyph??(e.image===void 0?cm[e.kind]:void 0)}var um={aws:im,github:am,gitlab:om,kubernetes:sm},dm={git:`github`,k8s:`kubernetes`},fm={aws:`#ED7100`,github:`#181717`,gitlab:`#E24329`,kubernetes:`#326CE5`},pm={aws:`AWS`,github:`GitHub`,gitlab:`GitLab`,kubernetes:`Kubernetes`,gcp:`GCP`};function mm(e){let t=e.trim().toLowerCase();return dm[t]??t}function hm(e){let t=[...new Set(e.map(mm))];if(t.length!==1)return;let n=t[0];if(n!==void 0)return um[n]===void 0?void 0:n}function gm(e,t){return e===void 0?void 0:um[mm(e)]}function _m(e){let t=pm[mm(e)];return t===void 0?e.length===0?e:`${e.slice(0,1).toLocaleUpperCase()}${e.slice(1)}`:t}function vm(e){let t=e.toLowerCase();if(t.includes(`github`))return`github`;if(t.includes(`gitlab`))return`gitlab`}function ym(e,t){if(t?.kind===`repo`&&t.entityKey!==void 0){let e=vm(t.entityKey);if(e!==void 0)return e}return hm(e)}function bm(e){if(e!==void 0)return fm[mm(e)]}function xm(e,t,n){return gm(ym(e,n),t)}var Sm={connected_via:`Connected via`,observed_by:`Observed by`,accessed_via:`Accessed via`,implemented_in:`Implemented in`,deployed_from:`Deployed from`,provided_as:`Provided as`},Cm={has_environment:`Contains`,member_service:`Includes service`,runs_instance:`Runs instance`,instance_of:`Instance of`};function wm(e){return e in Cm?Cm[e]:e in Sm?Sm[e]:e.split(`_`).map(e=>`${e.slice(0,1).toLocaleUpperCase()}${e.slice(1)}`).join(` `)}function Tm(e){let t={key:e.id,entityKey:e.key,label:e.label,kind:e.kind,providers:e.providers};switch(e.kind){case`application`:case`system_ref`:case`repo`:return{...t,applicationKey:null,environmentKey:null,serviceKey:null,applicationKeys:[]};case`environment`:return{...t,applicationKey:e.applicationKey,environmentKey:null,serviceKey:null,applicationKeys:[]};case`service`:return{...t,applicationKey:null,environmentKey:null,serviceKey:null,applicationKeys:e.applicationKeys};case`service_instance`:return{...t,applicationKey:null,environmentKey:e.environmentKey,serviceKey:e.serviceKey,applicationKeys:[]}}}function Em(e){let t=new Map;for(let n of e){let e=t.get(n.kind);e===void 0&&(e=new Map,t.set(n.kind,e)),e.has(n.entityKey)||e.set(n.entityKey,n.key)}return t}function Dm(e,t,n){return e.get(t)?.get(n)}function Om(e,t,n){return{key:`${e}::${t}-->${n}`,source:t,target:n,kind:e,label:Cm[e]}}function km(e){let t=[],n=Em(e);for(let r of e){if(r.kind===`environment`&&r.applicationKey!==null){let e=Dm(n,`application`,r.applicationKey);e!==void 0&&t.push(Om(`has_environment`,e,r.key))}if(r.kind===`service`)for(let e of r.applicationKeys){let i=Dm(n,`application`,e);i!==void 0&&t.push(Om(`member_service`,i,r.key))}if(r.kind===`service_instance`){if(r.environmentKey!==null){let e=Dm(n,`environment`,r.environmentKey);e!==void 0&&t.push(Om(`runs_instance`,e,r.key))}if(r.serviceKey!==null){let e=Dm(n,`service`,r.serviceKey);e!==void 0&&t.push(Om(`instance_of`,r.key,e))}}}return t}function Am(e){return`${e.kind}\0${e.source}\0${e.target}`}function jm(e){let t=e.nodes.map(Tm),n=e.edges.map(e=>({key:e.id,source:e.source,target:e.target,kind:e.kind,label:Sm[e.kind]})),r=new Set(n.map(Am)),i=km(t).filter(e=>!r.has(Am(e)));return{graph:{nodes:t,edges:[...n,...i],totals:e.totals},facets:{providers:e.facets.providers,kinds:e.facets.kinds,applications:e.facets.applications}}}async function Mm(){let e=await os({method:`GET`,path:oi,schema:is,attempted:`read committed topology`});return e.ok?{ok:!0,value:jm(e.value.value)}:e}var Nm=o(((e,t)=>{var n=typeof Reflect==`object`?Reflect:null,r=n&&typeof n.apply==`function`?n.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)},i=n&&typeof n.ownKeys==`function`?n.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};function a(e){console&&console.warn&&console.warn(e)}var o=Number.isNaN||function(e){return e!==e};function s(){s.init.call(this)}t.exports=s,t.exports.once=y,s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var c=10;function l(e){if(typeof e!=`function`)throw TypeError(`The "listener" argument must be of type Function. Received type `+typeof e)}Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return c},set:function(e){if(typeof e!=`number`||e<0||o(e))throw RangeError(`The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received `+e+`.`);c=e}}),s.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},s.prototype.setMaxListeners=function(e){if(typeof e!=`number`||e<0||o(e))throw RangeError(`The value of "n" is out of range. It must be a non-negative number. Received `+e+`.`);return this._maxListeners=e,this};function u(e){return e._maxListeners===void 0?s.defaultMaxListeners:e._maxListeners}s.prototype.getMaxListeners=function(){return u(this)},s.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var i=e===`error`,a=this._events;if(a!==void 0)i&&=a.error===void 0;else if(!i)return!1;if(i){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var s=Error(`Unhandled error.`+(o?` (`+o.message+`)`:``));throw s.context=o,s}var c=a[e];if(c===void 0)return!1;if(typeof c==`function`)r(c,this,t);else for(var l=c.length,u=g(c,l),n=0;n<l;++n)r(u[n],this,t);return!0};function d(e,t,n,r){var i,o,s;if(l(n),o=e._events,o===void 0?(o=e._events=Object.create(null),e._eventsCount=0):(o.newListener!==void 0&&(e.emit(`newListener`,t,n.listener?n.listener:n),o=e._events),s=o[t]),s===void 0)s=o[t]=n,++e._eventsCount;else if(typeof s==`function`?s=o[t]=r?[n,s]:[s,n]:r?s.unshift(n):s.push(n),i=u(e),i>0&&s.length>i&&!s.warned){s.warned=!0;var c=Error(`Possible EventEmitter memory leak detected. `+s.length+` `+String(t)+` listeners added. Use emitter.setMaxListeners() to increase limit`);c.name=`MaxListenersExceededWarning`,c.emitter=e,c.type=t,c.count=s.length,a(c)}return e}s.prototype.addListener=function(e,t){return d(this,e,t,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(e,t){return d(this,e,t,!0)};function f(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function p(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=f.bind(r);return i.listener=n,r.wrapFn=i,i}s.prototype.once=function(e,t){return l(t),this.on(e,p(this,e,t)),this},s.prototype.prependOnceListener=function(e,t){return l(t),this.prependListener(e,p(this,e,t)),this},s.prototype.removeListener=function(e,t){var n,r,i,a,o;if(l(t),r=this._events,r===void 0||(n=r[e],n===void 0))return this;if(n===t||n.listener===t)--this._eventsCount===0?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit(`removeListener`,e,n.listener||t));else if(typeof n!=`function`){for(i=-1,a=n.length-1;a>=0;a--)if(n[a]===t||n[a].listener===t){o=n[a].listener,i=a;break}if(i<0)return this;i===0?n.shift():_(n,i),n.length===1&&(r[e]=n[0]),r.removeListener!==void 0&&this.emit(`removeListener`,e,o||t)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(e){var t,n=this._events,r;if(n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var i=Object.keys(n),a;for(r=0;r<i.length;++r)a=i[r],a!==`removeListener`&&this.removeAllListeners(a);return this.removeAllListeners(`removeListener`),this._events=Object.create(null),this._eventsCount=0,this}if(t=n[e],typeof t==`function`)this.removeListener(e,t);else if(t!==void 0)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this};function m(e,t,n){var r=e._events;if(r===void 0)return[];var i=r[t];return i===void 0?[]:typeof i==`function`?n?[i.listener||i]:[i]:n?v(i):g(i,i.length)}s.prototype.listeners=function(e){return m(this,e,!0)},s.prototype.rawListeners=function(e){return m(this,e,!1)},s.listenerCount=function(e,t){return typeof e.listenerCount==`function`?e.listenerCount(t):h.call(e,t)},s.prototype.listenerCount=h;function h(e){var t=this._events;if(t!==void 0){var n=t[e];if(typeof n==`function`)return 1;if(n!==void 0)return n.length}return 0}s.prototype.eventNames=function(){return this._eventsCount>0?i(this._events):[]};function g(e,t){for(var n=Array(t),r=0;r<t;++r)n[r]=e[r];return n}function _(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}function v(e){for(var t=Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}function y(e,t){return new Promise(function(n,r){function i(n){e.removeListener(t,a),r(n)}function a(){typeof e.removeListener==`function`&&e.removeListener(`error`,i),n([].slice.call(arguments))}x(e,t,a,{once:!0}),t!==`error`&&b(e,i,{once:!0})})}function b(e,t,n){typeof e.on==`function`&&x(e,`error`,t,n)}function x(e,t,n,r){if(typeof e.on==`function`)r.once?e.once(t,n):e.on(t,n);else if(typeof e.addEventListener==`function`)e.addEventListener(t,function i(a){r.once&&e.removeEventListener(t,i),n(a)});else throw TypeError(`The "emitter" argument must be of type EventEmitter. Received type `+typeof e)}}))();function Pm(){let e=arguments[0];for(let t=1,n=arguments.length;t<n;t++)if(arguments[t])for(let n in arguments[t])e[n]=arguments[t][n];return e}var Fm=Pm;typeof Object.assign==`function`&&(Fm=Object.assign);function Im(e,t,n,r){let i=e._nodes.get(t),a=null;return i&&(a=r===`mixed`?i.out&&i.out[n]||i.undirected&&i.undirected[n]:r===`directed`?i.out&&i.out[n]:i.undirected&&i.undirected[n]),a}function Lm(e){return typeof e==`object`&&!!e}function Rm(e){let t;for(t in e)return!1;return!0}function zm(e,t,n){Object.defineProperty(e,t,{enumerable:!1,configurable:!1,writable:!0,value:n})}function Bm(e,t,n){let r={enumerable:!0,configurable:!0};typeof n==`function`?r.get=n:(r.value=n,r.writable=!1),Object.defineProperty(e,t,r)}function Vm(e){return!(!Lm(e)||e.attributes&&!Array.isArray(e.attributes))}function Hm(){let e=Math.floor(Math.random()*256)&255;return()=>e++}function Um(){let e=arguments,t=null,n=-1;return{[Symbol.iterator](){return this},next(){let r=null;do{if(t===null){if(n++,n>=e.length)return{done:!0};t=e[n][Symbol.iterator]()}if(r=t.next(),r.done){t=null;continue}break}while(!0);return r}}}function Wm(){return{[Symbol.iterator](){return this},next(){return{done:!0}}}}var Gm=class extends Error{constructor(e){super(),this.name=`GraphError`,this.message=e}},Y=class e extends Gm{constructor(t){super(t),this.name=`InvalidArgumentsGraphError`,typeof Error.captureStackTrace==`function`&&Error.captureStackTrace(this,e.prototype.constructor)}},X=class e extends Gm{constructor(t){super(t),this.name=`NotFoundGraphError`,typeof Error.captureStackTrace==`function`&&Error.captureStackTrace(this,e.prototype.constructor)}},Z=class e extends Gm{constructor(t){super(t),this.name=`UsageGraphError`,typeof Error.captureStackTrace==`function`&&Error.captureStackTrace(this,e.prototype.constructor)}};function Km(e,t){this.key=e,this.attributes=t,this.clear()}Km.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.undirectedDegree=0,this.undirectedLoops=0,this.directedLoops=0,this.in={},this.out={},this.undirected={}};function qm(e,t){this.key=e,this.attributes=t,this.clear()}qm.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.directedLoops=0,this.in={},this.out={}};function Jm(e,t){this.key=e,this.attributes=t,this.clear()}Jm.prototype.clear=function(){this.undirectedDegree=0,this.undirectedLoops=0,this.undirected={}};function Ym(e,t,n,r,i){this.key=t,this.attributes=i,this.undirected=e,this.source=n,this.target=r}Ym.prototype.attach=function(){let e=`out`,t=`in`;this.undirected&&(e=t=`undirected`);let n=this.source.key,r=this.target.key;this.source[e][r]=this,!(this.undirected&&n===r)&&(this.target[t][n]=this)},Ym.prototype.attachMulti=function(){let e=`out`,t=`in`,n=this.source.key,r=this.target.key;this.undirected&&(e=t=`undirected`);let i=this.source[e],a=i[r];if(a===void 0){i[r]=this,this.undirected&&n===r||(this.target[t][n]=this);return}a.previous=this,this.next=a,i[r]=this,this.target[t][n]=this},Ym.prototype.detach=function(){let e=this.source.key,t=this.target.key,n=`out`,r=`in`;this.undirected&&(n=r=`undirected`),delete this.source[n][t],delete this.target[r][e]},Ym.prototype.detachMulti=function(){let e=this.source.key,t=this.target.key,n=`out`,r=`in`;this.undirected&&(n=r=`undirected`),this.previous===void 0?this.next===void 0?(delete this.source[n][t],delete this.target[r][e]):(this.next.previous=void 0,this.source[n][t]=this.next,this.target[r][e]=this.next):(this.previous.next=this.next,this.next!==void 0&&(this.next.previous=this.previous))};var Xm=0,Zm=1,Qm=2,$m=3;function eh(e,t,n,r,i,a,o){let s,c,l,u;if(r=``+r,n===Xm){if(s=e._nodes.get(r),!s)throw new X(`Graph.${t}: could not find the "${r}" node in the graph.`);l=i,u=a}else if(n===$m){if(i=``+i,c=e._edges.get(i),!c)throw new X(`Graph.${t}: could not find the "${i}" edge in the graph.`);let n=c.source.key,d=c.target.key;if(r===n)s=c.target;else if(r===d)s=c.source;else throw new X(`Graph.${t}: the "${r}" node is not attached to the "${i}" edge (${n}, ${d}).`);l=a,u=o}else{if(c=e._edges.get(r),!c)throw new X(`Graph.${t}: could not find the "${r}" edge in the graph.`);s=n===Zm?c.source:c.target,l=i,u=a}return[s,l,u]}function th(e,t,n){e.prototype[t]=function(e,r,i){let[a,o]=eh(this,t,n,e,r,i);return a.attributes[o]}}function nh(e,t,n){e.prototype[t]=function(e,r){let[i]=eh(this,t,n,e,r);return i.attributes}}function rh(e,t,n){e.prototype[t]=function(e,r,i){let[a,o]=eh(this,t,n,e,r,i);return a.attributes.hasOwnProperty(o)}}function ih(e,t,n){e.prototype[t]=function(e,r,i,a){let[o,s,c]=eh(this,t,n,e,r,i,a);return o.attributes[s]=c,this.emit(`nodeAttributesUpdated`,{key:o.key,type:`set`,attributes:o.attributes,name:s}),this}}function ah(e,t,n){e.prototype[t]=function(e,r,i,a){let[o,s,c]=eh(this,t,n,e,r,i,a);if(typeof c!=`function`)throw new Y(`Graph.${t}: updater should be a function.`);let l=o.attributes;return l[s]=c(l[s]),this.emit(`nodeAttributesUpdated`,{key:o.key,type:`set`,attributes:o.attributes,name:s}),this}}function oh(e,t,n){e.prototype[t]=function(e,r,i){let[a,o]=eh(this,t,n,e,r,i);return delete a.attributes[o],this.emit(`nodeAttributesUpdated`,{key:a.key,type:`remove`,attributes:a.attributes,name:o}),this}}function sh(e,t,n){e.prototype[t]=function(e,r,i){let[a,o]=eh(this,t,n,e,r,i);if(!Lm(o))throw new Y(`Graph.${t}: provided attributes are not a plain object.`);return a.attributes=o,this.emit(`nodeAttributesUpdated`,{key:a.key,type:`replace`,attributes:a.attributes}),this}}function ch(e,t,n){e.prototype[t]=function(e,r,i){let[a,o]=eh(this,t,n,e,r,i);if(!Lm(o))throw new Y(`Graph.${t}: provided attributes are not a plain object.`);return Fm(a.attributes,o),this.emit(`nodeAttributesUpdated`,{key:a.key,type:`merge`,attributes:a.attributes,data:o}),this}}function lh(e,t,n){e.prototype[t]=function(e,r,i){let[a,o]=eh(this,t,n,e,r,i);if(typeof o!=`function`)throw new Y(`Graph.${t}: provided updater is not a function.`);return a.attributes=o(a.attributes),this.emit(`nodeAttributesUpdated`,{key:a.key,type:`update`,attributes:a.attributes}),this}}var uh=[{name:e=>`get${e}Attribute`,attacher:th},{name:e=>`get${e}Attributes`,attacher:nh},{name:e=>`has${e}Attribute`,attacher:rh},{name:e=>`set${e}Attribute`,attacher:ih},{name:e=>`update${e}Attribute`,attacher:ah},{name:e=>`remove${e}Attribute`,attacher:oh},{name:e=>`replace${e}Attributes`,attacher:sh},{name:e=>`merge${e}Attributes`,attacher:ch},{name:e=>`update${e}Attributes`,attacher:lh}];function dh(e){uh.forEach(function({name:t,attacher:n}){n(e,t(`Node`),Xm),n(e,t(`Source`),Zm),n(e,t(`Target`),Qm),n(e,t(`Opposite`),$m)})}function fh(e,t,n){e.prototype[t]=function(e,r){let i;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new Z(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new Z(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let a=``+e,o=``+r;if(r=arguments[2],i=Im(this,a,o,n),!i)throw new X(`Graph.${t}: could not find an edge for the given path ("${a}" - "${o}").`)}else{if(n!==`mixed`)throw new Z(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=``+e,i=this._edges.get(e),!i)throw new X(`Graph.${t}: could not find the "${e}" edge in the graph.`)}return i.attributes[r]}}function ph(e,t,n){e.prototype[t]=function(e){let r;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new Z(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>1){if(this.multi)throw new Z(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let i=``+e,a=``+arguments[1];if(r=Im(this,i,a,n),!r)throw new X(`Graph.${t}: could not find an edge for the given path ("${i}" - "${a}").`)}else{if(n!==`mixed`)throw new Z(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=``+e,r=this._edges.get(e),!r)throw new X(`Graph.${t}: could not find the "${e}" edge in the graph.`)}return r.attributes}}function mh(e,t,n){e.prototype[t]=function(e,r){let i;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new Z(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new Z(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let a=``+e,o=``+r;if(r=arguments[2],i=Im(this,a,o,n),!i)throw new X(`Graph.${t}: could not find an edge for the given path ("${a}" - "${o}").`)}else{if(n!==`mixed`)throw new Z(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=``+e,i=this._edges.get(e),!i)throw new X(`Graph.${t}: could not find the "${e}" edge in the graph.`)}return i.attributes.hasOwnProperty(r)}}function hh(e,t,n){e.prototype[t]=function(e,r,i){let a;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new Z(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new Z(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let o=``+e,s=``+r;if(r=arguments[2],i=arguments[3],a=Im(this,o,s,n),!a)throw new X(`Graph.${t}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if(n!==`mixed`)throw new Z(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=``+e,a=this._edges.get(e),!a)throw new X(`Graph.${t}: could not find the "${e}" edge in the graph.`)}return a.attributes[r]=i,this.emit(`edgeAttributesUpdated`,{key:a.key,type:`set`,attributes:a.attributes,name:r}),this}}function gh(e,t,n){e.prototype[t]=function(e,r,i){let a;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new Z(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new Z(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let o=``+e,s=``+r;if(r=arguments[2],i=arguments[3],a=Im(this,o,s,n),!a)throw new X(`Graph.${t}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if(n!==`mixed`)throw new Z(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=``+e,a=this._edges.get(e),!a)throw new X(`Graph.${t}: could not find the "${e}" edge in the graph.`)}if(typeof i!=`function`)throw new Y(`Graph.${t}: updater should be a function.`);return a.attributes[r]=i(a.attributes[r]),this.emit(`edgeAttributesUpdated`,{key:a.key,type:`set`,attributes:a.attributes,name:r}),this}}function _h(e,t,n){e.prototype[t]=function(e,r){let i;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new Z(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new Z(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let a=``+e,o=``+r;if(r=arguments[2],i=Im(this,a,o,n),!i)throw new X(`Graph.${t}: could not find an edge for the given path ("${a}" - "${o}").`)}else{if(n!==`mixed`)throw new Z(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=``+e,i=this._edges.get(e),!i)throw new X(`Graph.${t}: could not find the "${e}" edge in the graph.`)}return delete i.attributes[r],this.emit(`edgeAttributesUpdated`,{key:i.key,type:`remove`,attributes:i.attributes,name:r}),this}}function vh(e,t,n){e.prototype[t]=function(e,r){let i;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new Z(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new Z(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let a=``+e,o=``+r;if(r=arguments[2],i=Im(this,a,o,n),!i)throw new X(`Graph.${t}: could not find an edge for the given path ("${a}" - "${o}").`)}else{if(n!==`mixed`)throw new Z(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=``+e,i=this._edges.get(e),!i)throw new X(`Graph.${t}: could not find the "${e}" edge in the graph.`)}if(!Lm(r))throw new Y(`Graph.${t}: provided attributes are not a plain object.`);return i.attributes=r,this.emit(`edgeAttributesUpdated`,{key:i.key,type:`replace`,attributes:i.attributes}),this}}function yh(e,t,n){e.prototype[t]=function(e,r){let i;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new Z(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new Z(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let a=``+e,o=``+r;if(r=arguments[2],i=Im(this,a,o,n),!i)throw new X(`Graph.${t}: could not find an edge for the given path ("${a}" - "${o}").`)}else{if(n!==`mixed`)throw new Z(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=``+e,i=this._edges.get(e),!i)throw new X(`Graph.${t}: could not find the "${e}" edge in the graph.`)}if(!Lm(r))throw new Y(`Graph.${t}: provided attributes are not a plain object.`);return Fm(i.attributes,r),this.emit(`edgeAttributesUpdated`,{key:i.key,type:`merge`,attributes:i.attributes,data:r}),this}}function bh(e,t,n){e.prototype[t]=function(e,r){let i;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new Z(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new Z(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let a=``+e,o=``+r;if(r=arguments[2],i=Im(this,a,o,n),!i)throw new X(`Graph.${t}: could not find an edge for the given path ("${a}" - "${o}").`)}else{if(n!==`mixed`)throw new Z(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=``+e,i=this._edges.get(e),!i)throw new X(`Graph.${t}: could not find the "${e}" edge in the graph.`)}if(typeof r!=`function`)throw new Y(`Graph.${t}: provided updater is not a function.`);return i.attributes=r(i.attributes),this.emit(`edgeAttributesUpdated`,{key:i.key,type:`update`,attributes:i.attributes}),this}}var xh=[{name:e=>`get${e}Attribute`,attacher:fh},{name:e=>`get${e}Attributes`,attacher:ph},{name:e=>`has${e}Attribute`,attacher:mh},{name:e=>`set${e}Attribute`,attacher:hh},{name:e=>`update${e}Attribute`,attacher:gh},{name:e=>`remove${e}Attribute`,attacher:_h},{name:e=>`replace${e}Attributes`,attacher:vh},{name:e=>`merge${e}Attributes`,attacher:yh},{name:e=>`update${e}Attributes`,attacher:bh}];function Sh(e){xh.forEach(function({name:t,attacher:n}){n(e,t(`Edge`),`mixed`),n(e,t(`DirectedEdge`),`directed`),n(e,t(`UndirectedEdge`),`undirected`)})}var Ch=[{name:`edges`,type:`mixed`},{name:`inEdges`,type:`directed`,direction:`in`},{name:`outEdges`,type:`directed`,direction:`out`},{name:`inboundEdges`,type:`mixed`,direction:`in`},{name:`outboundEdges`,type:`mixed`,direction:`out`},{name:`directedEdges`,type:`directed`},{name:`undirectedEdges`,type:`undirected`}];function wh(e,t,n,r){let i=!1;for(let a in t){if(a===r)continue;let o=t[a];if(i=n(o.key,o.attributes,o.source.key,o.target.key,o.source.attributes,o.target.attributes,o.undirected),e&&i)return o.key}}function Th(e,t,n,r){let i,a,o,s=!1;for(let c in t)if(c!==r){i=t[c];do{if(a=i.source,o=i.target,s=n(i.key,i.attributes,a.key,o.key,a.attributes,o.attributes,i.undirected),e&&s)return i.key;i=i.next}while(i!==void 0)}}function Eh(e,t){let n=Object.keys(e),r=n.length,i,a=0;return{[Symbol.iterator](){return this},next(){do if(i)i=i.next;else{if(a>=r)return{done:!0};let o=n[a++];if(o===t){i=void 0;continue}i=e[o]}while(!i);return{done:!1,value:{edge:i.key,attributes:i.attributes,source:i.source.key,target:i.target.key,sourceAttributes:i.source.attributes,targetAttributes:i.target.attributes,undirected:i.undirected}}}}}function Dh(e,t,n,r){let i=t[n];if(!i)return;let a=i.source,o=i.target;if(r(i.key,i.attributes,a.key,o.key,a.attributes,o.attributes,i.undirected)&&e)return i.key}function Oh(e,t,n,r){let i=t[n];if(!i)return;let a=!1;do{if(a=r(i.key,i.attributes,i.source.key,i.target.key,i.source.attributes,i.target.attributes,i.undirected),e&&a)return i.key;i=i.next}while(i!==void 0)}function kh(e,t){let n=e[t];if(n.next!==void 0)return{[Symbol.iterator](){return this},next(){if(!n)return{done:!0};let e={edge:n.key,attributes:n.attributes,source:n.source.key,target:n.target.key,sourceAttributes:n.source.attributes,targetAttributes:n.target.attributes,undirected:n.undirected};return n=n.next,{done:!1,value:e}}};let r=!1;return{[Symbol.iterator](){return this},next(){return r===!0?{done:!0}:(r=!0,{done:!1,value:{edge:n.key,attributes:n.attributes,source:n.source.key,target:n.target.key,sourceAttributes:n.source.attributes,targetAttributes:n.target.attributes,undirected:n.undirected}})}}}function Ah(e,t){if(e.size===0)return[];if(t===`mixed`||t===e.type)return Array.from(e._edges.keys());let n=t===`undirected`?e.undirectedSize:e.directedSize,r=Array(n),i=t===`undirected`,a=e._edges.values(),o=0,s,c;for(;s=a.next(),s.done!==!0;)c=s.value,c.undirected===i&&(r[o++]=c.key);return r}function jh(e,t,n,r){if(t.size===0)return;let i=n!==`mixed`&&n!==t.type,a=n===`undirected`,o,s,c=!1,l=t._edges.values();for(;o=l.next(),o.done!==!0;){if(s=o.value,i&&s.undirected!==a)continue;let{key:t,attributes:n,source:l,target:u}=s;if(c=r(t,n,l.key,u.key,l.attributes,u.attributes,s.undirected),e&&c)return t}}function Mh(e,t){if(e.size===0)return Wm();let n=t!==`mixed`&&t!==e.type,r=t===`undirected`,i=e._edges.values();return{[Symbol.iterator](){return this},next(){let e,t;for(;;){if(e=i.next(),e.done)return e;if(t=e.value,!(n&&t.undirected!==r))break}return{value:{edge:t.key,attributes:t.attributes,source:t.source.key,target:t.target.key,sourceAttributes:t.source.attributes,targetAttributes:t.target.attributes,undirected:t.undirected},done:!1}}}}function Nh(e,t,n,r,i,a){let o=t?Th:wh,s;if(n!==`undirected`&&(r!==`out`&&(s=o(e,i.in,a),e&&s)||r!==`in`&&(s=o(e,i.out,a,r?void 0:i.key),e&&s))||n!==`directed`&&(s=o(e,i.undirected,a),e&&s))return s}function Ph(e,t,n,r){let i=[];return Nh(!1,e,t,n,r,function(e){i.push(e)}),i}function Fh(e,t,n){let r=Wm();return e!==`undirected`&&(t!==`out`&&n.in!==void 0&&(r=Um(r,Eh(n.in))),t!==`in`&&n.out!==void 0&&(r=Um(r,Eh(n.out,t?void 0:n.key)))),e!==`directed`&&n.undirected!==void 0&&(r=Um(r,Eh(n.undirected))),r}function Ih(e,t,n,r,i,a,o){let s=n?Oh:Dh,c;if(t!==`undirected`&&(i.in!==void 0&&r!==`out`&&(c=s(e,i.in,a,o),e&&c)||i.out!==void 0&&r!==`in`&&(r||i.key!==a)&&(c=s(e,i.out,a,o),e&&c))||t!==`directed`&&i.undirected!==void 0&&(c=s(e,i.undirected,a,o),e&&c))return c}function Lh(e,t,n,r,i){let a=[];return Ih(!1,e,t,n,r,i,function(e){a.push(e)}),a}function Rh(e,t,n,r){let i=Wm();return e!==`undirected`&&(n.in!==void 0&&t!==`out`&&r in n.in&&(i=Um(i,kh(n.in,r))),n.out!==void 0&&t!==`in`&&r in n.out&&(t||n.key!==r)&&(i=Um(i,kh(n.out,r)))),e!==`directed`&&n.undirected!==void 0&&r in n.undirected&&(i=Um(i,kh(n.undirected,r))),i}function zh(e,t){let{name:n,type:r,direction:i}=t;e.prototype[n]=function(e,t){if(r!==`mixed`&&this.type!==`mixed`&&r!==this.type)return[];if(!arguments.length)return Ah(this,r);if(arguments.length===1){e=``+e;let t=this._nodes.get(e);if(t===void 0)throw new X(`Graph.${n}: could not find the "${e}" node in the graph.`);return Ph(this.multi,r===`mixed`?this.type:r,i,t)}if(arguments.length===2){e=``+e,t=``+t;let a=this._nodes.get(e);if(!a)throw new X(`Graph.${n}: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new X(`Graph.${n}: could not find the "${t}" target node in the graph.`);return Lh(r,this.multi,i,a,t)}throw new Y(`Graph.${n}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function Bh(e,t){let{name:n,type:r,direction:i}=t,a=`forEach`+n[0].toUpperCase()+n.slice(1,-1);e.prototype[a]=function(e,t,n){if(r===`mixed`||this.type===`mixed`||r===this.type){if(arguments.length===1)return n=e,jh(!1,this,r,n);if(arguments.length===2){e=``+e,n=t;let o=this._nodes.get(e);if(o===void 0)throw new X(`Graph.${a}: could not find the "${e}" node in the graph.`);return Nh(!1,this.multi,r===`mixed`?this.type:r,i,o,n)}if(arguments.length===3){e=``+e,t=``+t;let o=this._nodes.get(e);if(!o)throw new X(`Graph.${a}: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new X(`Graph.${a}: could not find the "${t}" target node in the graph.`);return Ih(!1,r,this.multi,i,o,t,n)}throw new Y(`Graph.${a}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)}};let o=`map`+n[0].toUpperCase()+n.slice(1);e.prototype[o]=function(){let e=Array.prototype.slice.call(arguments),t=e.pop(),n;if(e.length===0){let i=0;r!==`directed`&&(i+=this.undirectedSize),r!==`undirected`&&(i+=this.directedSize),n=Array(i);let a=0;e.push((e,r,i,o,s,c,l)=>{n[a++]=t(e,r,i,o,s,c,l)})}else n=[],e.push((e,r,i,a,o,s,c)=>{n.push(t(e,r,i,a,o,s,c))});return this[a].apply(this,e),n};let s=`filter`+n[0].toUpperCase()+n.slice(1);e.prototype[s]=function(){let e=Array.prototype.slice.call(arguments),t=e.pop(),n=[];return e.push((e,r,i,a,o,s,c)=>{t(e,r,i,a,o,s,c)&&n.push(e)}),this[a].apply(this,e),n};let c=`reduce`+n[0].toUpperCase()+n.slice(1);e.prototype[c]=function(){let e=Array.prototype.slice.call(arguments);if(e.length<2||e.length>4)throw new Y(`Graph.${c}: invalid number of arguments (expecting 2, 3 or 4 and got ${e.length}).`);if(typeof e[e.length-1]==`function`&&typeof e[e.length-2]!=`function`)throw new Y(`Graph.${c}: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.`);let t,n;e.length===2?(t=e[0],n=e[1],e=[]):e.length===3?(t=e[1],n=e[2],e=[e[0]]):e.length===4&&(t=e[2],n=e[3],e=[e[0],e[1]]);let r=n;return e.push((e,n,i,a,o,s,c)=>{r=t(r,e,n,i,a,o,s,c)}),this[a].apply(this,e),r}}function Vh(e,t){let{name:n,type:r,direction:i}=t,a=`find`+n[0].toUpperCase()+n.slice(1,-1);e.prototype[a]=function(e,t,n){if(r!==`mixed`&&this.type!==`mixed`&&r!==this.type)return!1;if(arguments.length===1)return n=e,jh(!0,this,r,n);if(arguments.length===2){e=``+e,n=t;let o=this._nodes.get(e);if(o===void 0)throw new X(`Graph.${a}: could not find the "${e}" node in the graph.`);return Nh(!0,this.multi,r===`mixed`?this.type:r,i,o,n)}if(arguments.length===3){e=``+e,t=``+t;let o=this._nodes.get(e);if(!o)throw new X(`Graph.${a}: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new X(`Graph.${a}: could not find the "${t}" target node in the graph.`);return Ih(!0,r,this.multi,i,o,t,n)}throw new Y(`Graph.${a}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)};let o=`some`+n[0].toUpperCase()+n.slice(1,-1);e.prototype[o]=function(){let e=Array.prototype.slice.call(arguments),t=e.pop();return e.push((e,n,r,i,a,o,s)=>t(e,n,r,i,a,o,s)),!!this[a].apply(this,e)};let s=`every`+n[0].toUpperCase()+n.slice(1,-1);e.prototype[s]=function(){let e=Array.prototype.slice.call(arguments),t=e.pop();return e.push((e,n,r,i,a,o,s)=>!t(e,n,r,i,a,o,s)),!this[a].apply(this,e)}}function Hh(e,t){let{name:n,type:r,direction:i}=t,a=n.slice(0,-1)+`Entries`;e.prototype[a]=function(e,t){if(r!==`mixed`&&this.type!==`mixed`&&r!==this.type)return Wm();if(!arguments.length)return Mh(this,r);if(arguments.length===1){e=``+e;let t=this._nodes.get(e);if(!t)throw new X(`Graph.${a}: could not find the "${e}" node in the graph.`);return Fh(r,i,t)}if(arguments.length===2){e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new X(`Graph.${a}: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new X(`Graph.${a}: could not find the "${t}" target node in the graph.`);return Rh(r,i,n,t)}throw new Y(`Graph.${a}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function Uh(e){Ch.forEach(t=>{zh(e,t),Bh(e,t),Vh(e,t),Hh(e,t)})}var Wh=[{name:`neighbors`,type:`mixed`},{name:`inNeighbors`,type:`directed`,direction:`in`},{name:`outNeighbors`,type:`directed`,direction:`out`},{name:`inboundNeighbors`,type:`mixed`,direction:`in`},{name:`outboundNeighbors`,type:`mixed`,direction:`out`},{name:`directedNeighbors`,type:`directed`},{name:`undirectedNeighbors`,type:`undirected`}];function Gh(){this.A=null,this.B=null}Gh.prototype.wrap=function(e){this.A===null?this.A=e:this.B===null&&(this.B=e)},Gh.prototype.has=function(e){return this.A!==null&&e in this.A||this.B!==null&&e in this.B};function Kh(e,t,n,r,i){for(let a in r){let o=r[a],s=o.source,c=o.target,l=s===n?c:s;if(t&&t.has(l.key))continue;let u=i(l.key,l.attributes);if(e&&u)return l.key}}function qh(e,t,n,r,i){if(t!==`mixed`){if(t===`undirected`)return Kh(e,null,r,r.undirected,i);if(typeof n==`string`)return Kh(e,null,r,r[n],i)}let a=new Gh,o;if(t!==`undirected`){if(n!==`out`){if(o=Kh(e,null,r,r.in,i),e&&o)return o;a.wrap(r.in)}if(n!==`in`){if(o=Kh(e,a,r,r.out,i),e&&o)return o;a.wrap(r.out)}}if(t!==`directed`&&(o=Kh(e,a,r,r.undirected,i),e&&o))return o}function Jh(e,t,n){if(e!==`mixed`){if(e===`undirected`)return Object.keys(n.undirected);if(typeof t==`string`)return Object.keys(n[t])}let r=[];return qh(!1,e,t,n,function(e){r.push(e)}),r}function Yh(e,t,n){let r=Object.keys(n),i=r.length,a=0;return{[Symbol.iterator](){return this},next(){let o=null;do{if(a>=i)return e&&e.wrap(n),{done:!0};let s=n[r[a++]],c=s.source,l=s.target;if(o=c===t?l:c,e&&e.has(o.key)){o=null;continue}}while(o===null);return{done:!1,value:{neighbor:o.key,attributes:o.attributes}}}}}function Xh(e,t,n){if(e!==`mixed`){if(e===`undirected`)return Yh(null,n,n.undirected);if(typeof t==`string`)return Yh(null,n,n[t])}let r=Wm(),i=new Gh;return e!==`undirected`&&(t!==`out`&&(r=Um(r,Yh(i,n,n.in))),t!==`in`&&(r=Um(r,Yh(i,n,n.out)))),e!==`directed`&&(r=Um(r,Yh(i,n,n.undirected))),r}function Zh(e,t){let{name:n,type:r,direction:i}=t;e.prototype[n]=function(e){if(r!==`mixed`&&this.type!==`mixed`&&r!==this.type)return[];e=``+e;let t=this._nodes.get(e);if(t===void 0)throw new X(`Graph.${n}: could not find the "${e}" node in the graph.`);return Jh(r===`mixed`?this.type:r,i,t)}}function Qh(e,t){let{name:n,type:r,direction:i}=t,a=`forEach`+n[0].toUpperCase()+n.slice(1,-1);e.prototype[a]=function(e,t){if(r!==`mixed`&&this.type!==`mixed`&&r!==this.type)return;e=``+e;let n=this._nodes.get(e);if(n===void 0)throw new X(`Graph.${a}: could not find the "${e}" node in the graph.`);qh(!1,r===`mixed`?this.type:r,i,n,t)};let o=`map`+n[0].toUpperCase()+n.slice(1);e.prototype[o]=function(e,t){let n=[];return this[a](e,(e,r)=>{n.push(t(e,r))}),n};let s=`filter`+n[0].toUpperCase()+n.slice(1);e.prototype[s]=function(e,t){let n=[];return this[a](e,(e,r)=>{t(e,r)&&n.push(e)}),n};let c=`reduce`+n[0].toUpperCase()+n.slice(1);e.prototype[c]=function(e,t,n){if(arguments.length<3)throw new Y(`Graph.${c}: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.`);let r=n;return this[a](e,(e,n)=>{r=t(r,e,n)}),r}}function $h(e,t){let{name:n,type:r,direction:i}=t,a=n[0].toUpperCase()+n.slice(1,-1),o=`find`+a;e.prototype[o]=function(e,t){if(r!==`mixed`&&this.type!==`mixed`&&r!==this.type)return;e=``+e;let n=this._nodes.get(e);if(n===void 0)throw new X(`Graph.${o}: could not find the "${e}" node in the graph.`);return qh(!0,r===`mixed`?this.type:r,i,n,t)};let s=`some`+a;e.prototype[s]=function(e,t){return!!this[o](e,t)};let c=`every`+a;e.prototype[c]=function(e,t){return!this[o](e,(e,n)=>!t(e,n))}}function eg(e,t){let{name:n,type:r,direction:i}=t,a=n.slice(0,-1)+`Entries`;e.prototype[a]=function(e){if(r!==`mixed`&&this.type!==`mixed`&&r!==this.type)return Wm();e=``+e;let t=this._nodes.get(e);if(t===void 0)throw new X(`Graph.${a}: could not find the "${e}" node in the graph.`);return Xh(r===`mixed`?this.type:r,i,t)}}function tg(e){Wh.forEach(t=>{Zh(e,t),Qh(e,t),$h(e,t),eg(e,t)})}function ng(e,t,n,r,i){let a=r._nodes.values(),o=r.type,s,c,l,u,d,f,p;for(;s=a.next(),s.done!==!0;){let r=!1;if(c=s.value,o!==`undirected`)for(l in u=c.out,u){d=u[l];do{if(f=d.target,r=!0,p=i(c.key,f.key,c.attributes,f.attributes,d.key,d.attributes,d.undirected),e&&p)return d;d=d.next}while(d)}if(o!==`directed`){for(l in u=c.undirected,u)if(!(t&&c.key>l)){d=u[l];do{if(f=d.target,f.key!==l&&(f=d.source),r=!0,p=i(c.key,f.key,c.attributes,f.attributes,d.key,d.attributes,d.undirected),e&&p)return d;d=d.next}while(d)}}if(n&&!r&&(p=i(c.key,null,c.attributes,null,null,null,null),e&&p))return null}}function rg(e,t){let n={key:e};return Rm(t.attributes)||(n.attributes=Fm({},t.attributes)),n}function ig(e,t,n){let r={key:t,source:n.source.key,target:n.target.key};return Rm(n.attributes)||(r.attributes=Fm({},n.attributes)),e===`mixed`&&n.undirected&&(r.undirected=!0),r}function ag(e){if(!Lm(e))throw new Y(`Graph.import: invalid serialized node. A serialized node should be a plain object with at least a "key" property.`);if(!(`key`in e))throw new Y(`Graph.import: serialized node is missing its key.`);if(`attributes`in e&&(!Lm(e.attributes)||e.attributes===null))throw new Y(`Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.`)}function og(e){if(!Lm(e))throw new Y(`Graph.import: invalid serialized edge. A serialized edge should be a plain object with at least a "source" & "target" property.`);if(!(`source`in e))throw new Y(`Graph.import: serialized edge is missing its source.`);if(!(`target`in e))throw new Y(`Graph.import: serialized edge is missing its target.`);if(`attributes`in e&&(!Lm(e.attributes)||e.attributes===null))throw new Y(`Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.`);if(`undirected`in e&&typeof e.undirected!=`boolean`)throw new Y(`Graph.import: invalid undirectedness information. Undirected should be boolean or omitted.`)}var sg=Hm(),cg=new Set([`directed`,`undirected`,`mixed`]),lg=new Set([`domain`,`_events`,`_eventsCount`,`_maxListeners`]),ug=[{name:e=>`${e}Edge`,generateKey:!0},{name:e=>`${e}DirectedEdge`,generateKey:!0,type:`directed`},{name:e=>`${e}UndirectedEdge`,generateKey:!0,type:`undirected`},{name:e=>`${e}EdgeWithKey`},{name:e=>`${e}DirectedEdgeWithKey`,type:`directed`},{name:e=>`${e}UndirectedEdgeWithKey`,type:`undirected`}],dg={allowSelfLoops:!0,multi:!1,type:`mixed`};function fg(e,t,n){if(n&&!Lm(n))throw new Y(`Graph.addNode: invalid attributes. Expecting an object but got "${n}"`);if(t=``+t,n||={},e._nodes.has(t))throw new Z(`Graph.addNode: the "${t}" node already exist in the graph.`);let r=new e.NodeDataClass(t,n);return e._nodes.set(t,r),e.emit(`nodeAdded`,{key:t,attributes:n}),r}function pg(e,t,n){let r=new e.NodeDataClass(t,n);return e._nodes.set(t,r),e.emit(`nodeAdded`,{key:t,attributes:n}),r}function mg(e,t,n,r,i,a,o,s){if(!r&&e.type===`undirected`)throw new Z(`Graph.${t}: you cannot add a directed edge to an undirected graph. Use the #.addEdge or #.addUndirectedEdge instead.`);if(r&&e.type===`directed`)throw new Z(`Graph.${t}: you cannot add an undirected edge to a directed graph. Use the #.addEdge or #.addDirectedEdge instead.`);if(s&&!Lm(s))throw new Y(`Graph.${t}: invalid attributes. Expecting an object but got "${s}"`);if(a=``+a,o=``+o,s||={},!e.allowSelfLoops&&a===o)throw new Z(`Graph.${t}: source & target are the same ("${a}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);let c=e._nodes.get(a),l=e._nodes.get(o);if(!c)throw new X(`Graph.${t}: source node "${a}" not found.`);if(!l)throw new X(`Graph.${t}: target node "${o}" not found.`);let u={key:null,undirected:r,source:a,target:o,attributes:s};if(n)i=e._edgeKeyGenerator();else if(i=``+i,e._edges.has(i))throw new Z(`Graph.${t}: the "${i}" edge already exists in the graph.`);if(!e.multi&&(r?c.undirected[o]!==void 0:c.out[o]!==void 0))throw new Z(`Graph.${t}: an edge linking "${a}" to "${o}" already exists. If you really want to add multiple edges linking those nodes, you should create a multi graph by using the 'multi' option.`);let d=new Ym(r,i,c,l,s);e._edges.set(i,d);let f=a===o;return r?(c.undirectedDegree++,l.undirectedDegree++,f&&(c.undirectedLoops++,e._undirectedSelfLoopCount++)):(c.outDegree++,l.inDegree++,f&&(c.directedLoops++,e._directedSelfLoopCount++)),e.multi?d.attachMulti():d.attach(),r?e._undirectedSize++:e._directedSize++,u.key=i,e.emit(`edgeAdded`,u),i}function hg(e,t,n,r,i,a,o,s,c){if(!r&&e.type===`undirected`)throw new Z(`Graph.${t}: you cannot merge/update a directed edge to an undirected graph. Use the #.mergeEdge/#.updateEdge or #.addUndirectedEdge instead.`);if(r&&e.type===`directed`)throw new Z(`Graph.${t}: you cannot merge/update an undirected edge to a directed graph. Use the #.mergeEdge/#.updateEdge or #.addDirectedEdge instead.`);if(s){if(c){if(typeof s!=`function`)throw new Y(`Graph.${t}: invalid updater function. Expecting a function but got "${s}"`)}else if(!Lm(s))throw new Y(`Graph.${t}: invalid attributes. Expecting an object but got "${s}"`)}a=``+a,o=``+o;let l;if(c&&(l=s,s=void 0),!e.allowSelfLoops&&a===o)throw new Z(`Graph.${t}: source & target are the same ("${a}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);let u=e._nodes.get(a),d=e._nodes.get(o),f,p;if(!n&&(f=e._edges.get(i),f)){if((f.source.key!==a||f.target.key!==o)&&(!r||f.source.key!==o||f.target.key!==a))throw new Z(`Graph.${t}: inconsistency detected when attempting to merge the "${i}" edge with "${a}" source & "${o}" target vs. ("${f.source.key}", "${f.target.key}").`);p=f}if(!p&&!e.multi&&u&&(p=r?u.undirected[o]:u.out[o]),p){let t=[p.key,!1,!1,!1];if(c?!l:!s)return t;if(c){let t=p.attributes;p.attributes=l(t),e.emit(`edgeAttributesUpdated`,{type:`replace`,key:p.key,attributes:p.attributes})}else Fm(p.attributes,s),e.emit(`edgeAttributesUpdated`,{type:`merge`,key:p.key,attributes:p.attributes,data:s});return t}s||={},c&&l&&(s=l(s));let m={key:null,undirected:r,source:a,target:o,attributes:s};if(n)i=e._edgeKeyGenerator();else if(i=``+i,e._edges.has(i))throw new Z(`Graph.${t}: the "${i}" edge already exists in the graph.`);let h=!1,g=!1;u||(u=pg(e,a,{}),h=!0,a===o&&(d=u,g=!0)),d||(d=pg(e,o,{}),g=!0),f=new Ym(r,i,u,d,s),e._edges.set(i,f);let _=a===o;return r?(u.undirectedDegree++,d.undirectedDegree++,_&&(u.undirectedLoops++,e._undirectedSelfLoopCount++)):(u.outDegree++,d.inDegree++,_&&(u.directedLoops++,e._directedSelfLoopCount++)),e.multi?f.attachMulti():f.attach(),r?e._undirectedSize++:e._directedSize++,m.key=i,e.emit(`edgeAdded`,m),[i,!0,h,g]}function gg(e,t){e._edges.delete(t.key);let{source:n,target:r,attributes:i}=t,a=t.undirected,o=n===r;a?(n.undirectedDegree--,r.undirectedDegree--,o&&(n.undirectedLoops--,e._undirectedSelfLoopCount--)):(n.outDegree--,r.inDegree--,o&&(n.directedLoops--,e._directedSelfLoopCount--)),e.multi?t.detachMulti():t.detach(),a?e._undirectedSize--:e._directedSize--,e.emit(`edgeDropped`,{key:t.key,attributes:i,source:n.key,target:r.key,undirected:a})}var _g=class e extends Nm.EventEmitter{constructor(e){if(super(),e=Fm({},dg,e),typeof e.multi!=`boolean`)throw new Y(`Graph.constructor: invalid 'multi' option. Expecting a boolean but got "${e.multi}".`);if(!cg.has(e.type))throw new Y(`Graph.constructor: invalid 'type' option. Should be one of "mixed", "directed" or "undirected" but got "${e.type}".`);if(typeof e.allowSelfLoops!=`boolean`)throw new Y(`Graph.constructor: invalid 'allowSelfLoops' option. Expecting a boolean but got "${e.allowSelfLoops}".`);let t=e.type===`mixed`?Km:e.type===`directed`?qm:Jm;zm(this,`NodeDataClass`,t);let n=`geid_`+sg()+`_`,r=0;zm(this,`_attributes`,{}),zm(this,`_nodes`,new Map),zm(this,`_edges`,new Map),zm(this,`_directedSize`,0),zm(this,`_undirectedSize`,0),zm(this,`_directedSelfLoopCount`,0),zm(this,`_undirectedSelfLoopCount`,0),zm(this,`_edgeKeyGenerator`,()=>{let e;do e=n+r++;while(this._edges.has(e));return e}),zm(this,`_options`,e),lg.forEach(e=>zm(this,e,this[e])),Bm(this,`order`,()=>this._nodes.size),Bm(this,`size`,()=>this._edges.size),Bm(this,`directedSize`,()=>this._directedSize),Bm(this,`undirectedSize`,()=>this._undirectedSize),Bm(this,`selfLoopCount`,()=>this._directedSelfLoopCount+this._undirectedSelfLoopCount),Bm(this,`directedSelfLoopCount`,()=>this._directedSelfLoopCount),Bm(this,`undirectedSelfLoopCount`,()=>this._undirectedSelfLoopCount),Bm(this,`multi`,this._options.multi),Bm(this,`type`,this._options.type),Bm(this,`allowSelfLoops`,this._options.allowSelfLoops),Bm(this,`implementation`,()=>`graphology`)}_resetInstanceCounters(){this._directedSize=0,this._undirectedSize=0,this._directedSelfLoopCount=0,this._undirectedSelfLoopCount=0}hasNode(e){return this._nodes.has(``+e)}hasDirectedEdge(e,t){if(this.type===`undirected`)return!1;if(arguments.length===1){let t=``+e,n=this._edges.get(t);return!!n&&!n.undirected}if(arguments.length===2){e=``+e,t=``+t;let n=this._nodes.get(e);return n?n.out.hasOwnProperty(t):!1}throw new Y(`Graph.hasDirectedEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}hasUndirectedEdge(e,t){if(this.type===`directed`)return!1;if(arguments.length===1){let t=``+e,n=this._edges.get(t);return!!n&&n.undirected}if(arguments.length===2){e=``+e,t=``+t;let n=this._nodes.get(e);return n?n.undirected.hasOwnProperty(t):!1}throw new Y(`Graph.hasDirectedEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}hasEdge(e,t){if(arguments.length===1){let t=``+e;return this._edges.has(t)}if(arguments.length===2){e=``+e,t=``+t;let n=this._nodes.get(e);return n?n.out!==void 0&&n.out.hasOwnProperty(t)||n.undirected!==void 0&&n.undirected.hasOwnProperty(t):!1}throw new Y(`Graph.hasEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}directedEdge(e,t){if(this.type===`undirected`)return;if(e=``+e,t=``+t,this.multi)throw new Z(`Graph.directedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.directedEdges instead.`);let n=this._nodes.get(e);if(!n)throw new X(`Graph.directedEdge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new X(`Graph.directedEdge: could not find the "${t}" target node in the graph.`);let r=n.out&&n.out[t]||void 0;if(r)return r.key}undirectedEdge(e,t){if(this.type===`directed`)return;if(e=``+e,t=``+t,this.multi)throw new Z(`Graph.undirectedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.undirectedEdges instead.`);let n=this._nodes.get(e);if(!n)throw new X(`Graph.undirectedEdge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new X(`Graph.undirectedEdge: could not find the "${t}" target node in the graph.`);let r=n.undirected&&n.undirected[t]||void 0;if(r)return r.key}edge(e,t){if(this.multi)throw new Z(`Graph.edge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.edges instead.`);e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new X(`Graph.edge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new X(`Graph.edge: could not find the "${t}" target node in the graph.`);let r=n.out&&n.out[t]||n.undirected&&n.undirected[t]||void 0;if(r)return r.key}areDirectedNeighbors(e,t){e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new X(`Graph.areDirectedNeighbors: could not find the "${e}" node in the graph.`);return this.type===`undirected`?!1:t in n.in||t in n.out}areOutNeighbors(e,t){e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new X(`Graph.areOutNeighbors: could not find the "${e}" node in the graph.`);return this.type!==`undirected`&&t in n.out}areInNeighbors(e,t){e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new X(`Graph.areInNeighbors: could not find the "${e}" node in the graph.`);return this.type!==`undirected`&&t in n.in}areUndirectedNeighbors(e,t){e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new X(`Graph.areUndirectedNeighbors: could not find the "${e}" node in the graph.`);return this.type!==`directed`&&t in n.undirected}areNeighbors(e,t){e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new X(`Graph.areNeighbors: could not find the "${e}" node in the graph.`);return this.type!==`undirected`&&(t in n.in||t in n.out)||this.type!==`directed`&&t in n.undirected}areInboundNeighbors(e,t){e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new X(`Graph.areInboundNeighbors: could not find the "${e}" node in the graph.`);return this.type!==`undirected`&&t in n.in||this.type!==`directed`&&t in n.undirected}areOutboundNeighbors(e,t){e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new X(`Graph.areOutboundNeighbors: could not find the "${e}" node in the graph.`);return this.type!==`undirected`&&t in n.out||this.type!==`directed`&&t in n.undirected}inDegree(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new X(`Graph.inDegree: could not find the "${e}" node in the graph.`);return this.type===`undirected`?0:t.inDegree}outDegree(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new X(`Graph.outDegree: could not find the "${e}" node in the graph.`);return this.type===`undirected`?0:t.outDegree}directedDegree(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new X(`Graph.directedDegree: could not find the "${e}" node in the graph.`);return this.type===`undirected`?0:t.inDegree+t.outDegree}undirectedDegree(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new X(`Graph.undirectedDegree: could not find the "${e}" node in the graph.`);return this.type===`directed`?0:t.undirectedDegree}inboundDegree(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new X(`Graph.inboundDegree: could not find the "${e}" node in the graph.`);let n=0;return this.type!==`directed`&&(n+=t.undirectedDegree),this.type!==`undirected`&&(n+=t.inDegree),n}outboundDegree(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new X(`Graph.outboundDegree: could not find the "${e}" node in the graph.`);let n=0;return this.type!==`directed`&&(n+=t.undirectedDegree),this.type!==`undirected`&&(n+=t.outDegree),n}degree(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new X(`Graph.degree: could not find the "${e}" node in the graph.`);let n=0;return this.type!==`directed`&&(n+=t.undirectedDegree),this.type!==`undirected`&&(n+=t.inDegree+t.outDegree),n}inDegreeWithoutSelfLoops(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new X(`Graph.inDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type===`undirected`?0:t.inDegree-t.directedLoops}outDegreeWithoutSelfLoops(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new X(`Graph.outDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type===`undirected`?0:t.outDegree-t.directedLoops}directedDegreeWithoutSelfLoops(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new X(`Graph.directedDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type===`undirected`?0:t.inDegree+t.outDegree-t.directedLoops*2}undirectedDegreeWithoutSelfLoops(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new X(`Graph.undirectedDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type===`directed`?0:t.undirectedDegree-t.undirectedLoops*2}inboundDegreeWithoutSelfLoops(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new X(`Graph.inboundDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let n=0,r=0;return this.type!==`directed`&&(n+=t.undirectedDegree,r+=t.undirectedLoops*2),this.type!==`undirected`&&(n+=t.inDegree,r+=t.directedLoops),n-r}outboundDegreeWithoutSelfLoops(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new X(`Graph.outboundDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let n=0,r=0;return this.type!==`directed`&&(n+=t.undirectedDegree,r+=t.undirectedLoops*2),this.type!==`undirected`&&(n+=t.outDegree,r+=t.directedLoops),n-r}degreeWithoutSelfLoops(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new X(`Graph.degreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let n=0,r=0;return this.type!==`directed`&&(n+=t.undirectedDegree,r+=t.undirectedLoops*2),this.type!==`undirected`&&(n+=t.inDegree+t.outDegree,r+=t.directedLoops*2),n-r}source(e){e=``+e;let t=this._edges.get(e);if(!t)throw new X(`Graph.source: could not find the "${e}" edge in the graph.`);return t.source.key}target(e){e=``+e;let t=this._edges.get(e);if(!t)throw new X(`Graph.target: could not find the "${e}" edge in the graph.`);return t.target.key}extremities(e){e=``+e;let t=this._edges.get(e);if(!t)throw new X(`Graph.extremities: could not find the "${e}" edge in the graph.`);return[t.source.key,t.target.key]}opposite(e,t){e=``+e,t=``+t;let n=this._edges.get(t);if(!n)throw new X(`Graph.opposite: could not find the "${t}" edge in the graph.`);let r=n.source.key,i=n.target.key;if(e===r)return i;if(e===i)return r;throw new X(`Graph.opposite: the "${e}" node is not attached to the "${t}" edge (${r}, ${i}).`)}hasExtremity(e,t){e=``+e,t=``+t;let n=this._edges.get(e);if(!n)throw new X(`Graph.hasExtremity: could not find the "${e}" edge in the graph.`);return n.source.key===t||n.target.key===t}isUndirected(e){e=``+e;let t=this._edges.get(e);if(!t)throw new X(`Graph.isUndirected: could not find the "${e}" edge in the graph.`);return t.undirected}isDirected(e){e=``+e;let t=this._edges.get(e);if(!t)throw new X(`Graph.isDirected: could not find the "${e}" edge in the graph.`);return!t.undirected}isSelfLoop(e){e=``+e;let t=this._edges.get(e);if(!t)throw new X(`Graph.isSelfLoop: could not find the "${e}" edge in the graph.`);return t.source===t.target}addNode(e,t){return fg(this,e,t).key}mergeNode(e,t){if(t&&!Lm(t))throw new Y(`Graph.mergeNode: invalid attributes. Expecting an object but got "${t}"`);e=``+e,t||={};let n=this._nodes.get(e);return n?(t&&(Fm(n.attributes,t),this.emit(`nodeAttributesUpdated`,{type:`merge`,key:e,attributes:n.attributes,data:t})),[e,!1]):(n=new this.NodeDataClass(e,t),this._nodes.set(e,n),this.emit(`nodeAdded`,{key:e,attributes:t}),[e,!0])}updateNode(e,t){if(t&&typeof t!=`function`)throw new Y(`Graph.updateNode: invalid updater function. Expecting a function but got "${t}"`);e=``+e;let n=this._nodes.get(e);if(n){if(t){let r=n.attributes;n.attributes=t(r),this.emit(`nodeAttributesUpdated`,{type:`replace`,key:e,attributes:n.attributes})}return[e,!1]}let r=t?t({}):{};return n=new this.NodeDataClass(e,r),this._nodes.set(e,n),this.emit(`nodeAdded`,{key:e,attributes:r}),[e,!0]}dropNode(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new X(`Graph.dropNode: could not find the "${e}" node in the graph.`);let n;if(this.type!==`undirected`){for(let e in t.out){n=t.out[e];do gg(this,n),n=n.next;while(n)}for(let e in t.in){n=t.in[e];do gg(this,n),n=n.next;while(n)}}if(this.type!==`directed`)for(let e in t.undirected){n=t.undirected[e];do gg(this,n),n=n.next;while(n)}this._nodes.delete(e),this.emit(`nodeDropped`,{key:e,attributes:t.attributes})}dropEdge(e){let t;if(arguments.length>1){let e=``+arguments[0],n=``+arguments[1];if(t=Im(this,e,n,this.type),!t)throw new X(`Graph.dropEdge: could not find the "${e}" -> "${n}" edge in the graph.`)}else if(e=``+e,t=this._edges.get(e),!t)throw new X(`Graph.dropEdge: could not find the "${e}" edge in the graph.`);return gg(this,t),this}dropDirectedEdge(e,t){if(arguments.length<2)throw new Z(`Graph.dropDirectedEdge: it does not make sense to try and drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.`);if(this.multi)throw new Z(`Graph.dropDirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.`);e=``+e,t=``+t;let n=Im(this,e,t,`directed`);if(!n)throw new X(`Graph.dropDirectedEdge: could not find a "${e}" -> "${t}" edge in the graph.`);return gg(this,n),this}dropUndirectedEdge(e,t){if(arguments.length<2)throw new Z(`Graph.dropUndirectedEdge: it does not make sense to drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.`);if(this.multi)throw new Z(`Graph.dropUndirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.`);let n=Im(this,e,t,`undirected`);if(!n)throw new X(`Graph.dropUndirectedEdge: could not find a "${e}" -> "${t}" edge in the graph.`);return gg(this,n),this}clear(){this._edges.clear(),this._nodes.clear(),this._resetInstanceCounters(),this.emit(`cleared`)}clearEdges(){let e=this._nodes.values(),t;for(;t=e.next(),t.done!==!0;)t.value.clear();this._edges.clear(),this._resetInstanceCounters(),this.emit(`edgesCleared`)}getAttribute(e){return this._attributes[e]}getAttributes(){return this._attributes}hasAttribute(e){return this._attributes.hasOwnProperty(e)}setAttribute(e,t){return this._attributes[e]=t,this.emit(`attributesUpdated`,{type:`set`,attributes:this._attributes,name:e}),this}updateAttribute(e,t){if(typeof t!=`function`)throw new Y(`Graph.updateAttribute: updater should be a function.`);let n=this._attributes[e];return this._attributes[e]=t(n),this.emit(`attributesUpdated`,{type:`set`,attributes:this._attributes,name:e}),this}removeAttribute(e){return delete this._attributes[e],this.emit(`attributesUpdated`,{type:`remove`,attributes:this._attributes,name:e}),this}replaceAttributes(e){if(!Lm(e))throw new Y(`Graph.replaceAttributes: provided attributes are not a plain object.`);return this._attributes=e,this.emit(`attributesUpdated`,{type:`replace`,attributes:this._attributes}),this}mergeAttributes(e){if(!Lm(e))throw new Y(`Graph.mergeAttributes: provided attributes are not a plain object.`);return Fm(this._attributes,e),this.emit(`attributesUpdated`,{type:`merge`,attributes:this._attributes,data:e}),this}updateAttributes(e){if(typeof e!=`function`)throw new Y(`Graph.updateAttributes: provided updater is not a function.`);return this._attributes=e(this._attributes),this.emit(`attributesUpdated`,{type:`update`,attributes:this._attributes}),this}updateEachNodeAttributes(e,t){if(typeof e!=`function`)throw new Y(`Graph.updateEachNodeAttributes: expecting an updater function.`);if(t&&!Vm(t))throw new Y(`Graph.updateEachNodeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}`);let n=this._nodes.values(),r,i;for(;r=n.next(),r.done!==!0;)i=r.value,i.attributes=e(i.key,i.attributes);this.emit(`eachNodeAttributesUpdated`,{hints:t||null})}updateEachEdgeAttributes(e,t){if(typeof e!=`function`)throw new Y(`Graph.updateEachEdgeAttributes: expecting an updater function.`);if(t&&!Vm(t))throw new Y(`Graph.updateEachEdgeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}`);let n=this._edges.values(),r,i,a,o;for(;r=n.next(),r.done!==!0;)i=r.value,a=i.source,o=i.target,i.attributes=e(i.key,i.attributes,a.key,o.key,a.attributes,o.attributes,i.undirected);this.emit(`eachEdgeAttributesUpdated`,{hints:t||null})}forEachAdjacencyEntry(e){if(typeof e!=`function`)throw new Y(`Graph.forEachAdjacencyEntry: expecting a callback.`);ng(!1,!1,!1,this,e)}forEachAdjacencyEntryWithOrphans(e){if(typeof e!=`function`)throw new Y(`Graph.forEachAdjacencyEntryWithOrphans: expecting a callback.`);ng(!1,!1,!0,this,e)}forEachAssymetricAdjacencyEntry(e){if(typeof e!=`function`)throw new Y(`Graph.forEachAssymetricAdjacencyEntry: expecting a callback.`);ng(!1,!0,!1,this,e)}forEachAssymetricAdjacencyEntryWithOrphans(e){if(typeof e!=`function`)throw new Y(`Graph.forEachAssymetricAdjacencyEntryWithOrphans: expecting a callback.`);ng(!1,!0,!0,this,e)}nodes(){return Array.from(this._nodes.keys())}forEachNode(e){if(typeof e!=`function`)throw new Y(`Graph.forEachNode: expecting a callback.`);let t=this._nodes.values(),n,r;for(;n=t.next(),n.done!==!0;)r=n.value,e(r.key,r.attributes)}findNode(e){if(typeof e!=`function`)throw new Y(`Graph.findNode: expecting a callback.`);let t=this._nodes.values(),n,r;for(;n=t.next(),n.done!==!0;)if(r=n.value,e(r.key,r.attributes))return r.key}mapNodes(e){if(typeof e!=`function`)throw new Y(`Graph.mapNode: expecting a callback.`);let t=this._nodes.values(),n,r,i=Array(this.order),a=0;for(;n=t.next(),n.done!==!0;)r=n.value,i[a++]=e(r.key,r.attributes);return i}someNode(e){if(typeof e!=`function`)throw new Y(`Graph.someNode: expecting a callback.`);let t=this._nodes.values(),n,r;for(;n=t.next(),n.done!==!0;)if(r=n.value,e(r.key,r.attributes))return!0;return!1}everyNode(e){if(typeof e!=`function`)throw new Y(`Graph.everyNode: expecting a callback.`);let t=this._nodes.values(),n,r;for(;n=t.next(),n.done!==!0;)if(r=n.value,!e(r.key,r.attributes))return!1;return!0}filterNodes(e){if(typeof e!=`function`)throw new Y(`Graph.filterNodes: expecting a callback.`);let t=this._nodes.values(),n,r,i=[];for(;n=t.next(),n.done!==!0;)r=n.value,e(r.key,r.attributes)&&i.push(r.key);return i}reduceNodes(e,t){if(typeof e!=`function`)throw new Y(`Graph.reduceNodes: expecting a callback.`);if(arguments.length<2)throw new Y(`Graph.reduceNodes: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.`);let n=t,r=this._nodes.values(),i,a;for(;i=r.next(),i.done!==!0;)a=i.value,n=e(n,a.key,a.attributes);return n}nodeEntries(){let e=this._nodes.values();return{[Symbol.iterator](){return this},next(){let t=e.next();if(t.done)return t;let n=t.value;return{value:{node:n.key,attributes:n.attributes},done:!1}}}}export(){let e=Array(this._nodes.size),t=0;this._nodes.forEach((n,r)=>{e[t++]=rg(r,n)});let n=Array(this._edges.size);return t=0,this._edges.forEach((e,r)=>{n[t++]=ig(this.type,r,e)}),{options:{type:this.type,multi:this.multi,allowSelfLoops:this.allowSelfLoops},attributes:this.getAttributes(),nodes:e,edges:n}}import(t,n=!1){if(t instanceof e)return t.forEachNode((e,t)=>{n?this.mergeNode(e,t):this.addNode(e,t)}),t.forEachEdge((e,t,r,i,a,o,s)=>{n?s?this.mergeUndirectedEdgeWithKey(e,r,i,t):this.mergeDirectedEdgeWithKey(e,r,i,t):s?this.addUndirectedEdgeWithKey(e,r,i,t):this.addDirectedEdgeWithKey(e,r,i,t)}),this;if(!Lm(t))throw new Y(`Graph.import: invalid argument. Expecting a serialized graph or, alternatively, a Graph instance.`);if(t.attributes){if(!Lm(t.attributes))throw new Y(`Graph.import: invalid attributes. Expecting a plain object.`);n?this.mergeAttributes(t.attributes):this.replaceAttributes(t.attributes)}let r,i,a,o,s;if(t.nodes){if(a=t.nodes,!Array.isArray(a))throw new Y(`Graph.import: invalid nodes. Expecting an array.`);for(r=0,i=a.length;r<i;r++){o=a[r],ag(o);let{key:e,attributes:t}=o;n?this.mergeNode(e,t):this.addNode(e,t)}}if(t.edges){let e=!1;if(this.type===`undirected`&&(e=!0),a=t.edges,!Array.isArray(a))throw new Y(`Graph.import: invalid edges. Expecting an array.`);for(r=0,i=a.length;r<i;r++){s=a[r],og(s);let{source:t,target:i,attributes:o,undirected:c=e}=s,l;`key`in s?(l=n?c?this.mergeUndirectedEdgeWithKey:this.mergeDirectedEdgeWithKey:c?this.addUndirectedEdgeWithKey:this.addDirectedEdgeWithKey,l.call(this,s.key,t,i,o)):(l=n?c?this.mergeUndirectedEdge:this.mergeDirectedEdge:c?this.addUndirectedEdge:this.addDirectedEdge,l.call(this,t,i,o))}}return this}nullCopy(t){let n=new e(Fm({},this._options,t));return n.replaceAttributes(Fm({},this.getAttributes())),n}emptyCopy(e){let t=this.nullCopy(e);return this._nodes.forEach((e,n)=>{let r=Fm({},e.attributes);e=new t.NodeDataClass(n,r),t._nodes.set(n,e)}),t}copy(e){if(e||={},typeof e.type==`string`&&e.type!==this.type&&e.type!==`mixed`)throw new Z(`Graph.copy: cannot create an incompatible copy from "${this.type}" type to "${e.type}" because this would mean losing information about the current graph.`);if(typeof e.multi==`boolean`&&e.multi!==this.multi&&e.multi!==!0)throw new Z(`Graph.copy: cannot create an incompatible copy by downgrading a multi graph to a simple one because this would mean losing information about the current graph.`);if(typeof e.allowSelfLoops==`boolean`&&e.allowSelfLoops!==this.allowSelfLoops&&e.allowSelfLoops!==!0)throw new Z(`Graph.copy: cannot create an incompatible copy from a graph allowing self loops to one that does not because this would mean losing information about the current graph.`);let t=this.emptyCopy(e),n=this._edges.values(),r,i;for(;r=n.next(),r.done!==!0;)i=r.value,mg(t,`copy`,!1,i.undirected,i.key,i.source.key,i.target.key,Fm({},i.attributes));return t}toJSON(){return this.export()}toString(){return`[object Graph]`}inspect(){let e={};this._nodes.forEach((t,n)=>{e[n]=t.attributes});let t={},n={};this._edges.forEach((e,r)=>{let i=e.undirected?`--`:`->`,a=``,o=e.source.key,s=e.target.key,c;e.undirected&&o>s&&(c=o,o=s,s=c);let l=`(${o})${i}(${s})`;r.startsWith(`geid_`)?this.multi&&(n[l]===void 0?n[l]=0:n[l]++,a+=`${n[l]}. `):a+=`[${r}]: `,a+=l,t[a]=e.attributes});let r={};for(let e in this)this.hasOwnProperty(e)&&!lg.has(e)&&typeof this[e]!=`function`&&typeof e!=`symbol`&&(r[e]=this[e]);return r.attributes=this._attributes,r.nodes=e,r.edges=t,zm(r,`constructor`,this.constructor),r}};typeof Symbol<`u`&&(_g.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=_g.prototype.inspect),ug.forEach(e=>{[`add`,`merge`,`update`].forEach(t=>{let n=e.name(t),r=t===`add`?mg:hg;e.generateKey?_g.prototype[n]=function(i,a,o){return r(this,n,!0,(e.type||this.type)===`undirected`,null,i,a,o,t===`update`)}:_g.prototype[n]=function(i,a,o,s){return r(this,n,!1,(e.type||this.type)===`undirected`,i,a,o,s,t===`update`)}})}),dh(_g),Sh(_g),Uh(_g),tg(_g);var vg=class extends _g{constructor(e){let t=Fm({type:`directed`},e);if(`multi`in t&&t.multi!==!1)throw new Y(`DirectedGraph.from: inconsistent indication that the graph should be multi in given options!`);if(t.type!==`directed`)throw new Y(`DirectedGraph.from: inconsistent "`+t.type+`" type in given options!`);super(t)}},yg=class extends _g{constructor(e){let t=Fm({type:`undirected`},e);if(`multi`in t&&t.multi!==!1)throw new Y(`UndirectedGraph.from: inconsistent indication that the graph should be multi in given options!`);if(t.type!==`undirected`)throw new Y(`UndirectedGraph.from: inconsistent "`+t.type+`" type in given options!`);super(t)}},bg=class extends _g{constructor(e){let t=Fm({multi:!0},e);if(`multi`in t&&t.multi!==!0)throw new Y(`MultiGraph.from: inconsistent indication that the graph should be simple in given options!`);super(t)}},xg=class extends _g{constructor(e){let t=Fm({type:`directed`,multi:!0},e);if(`multi`in t&&t.multi!==!0)throw new Y(`MultiDirectedGraph.from: inconsistent indication that the graph should be simple in given options!`);if(t.type!==`directed`)throw new Y(`MultiDirectedGraph.from: inconsistent "`+t.type+`" type in given options!`);super(t)}},Sg=class extends _g{constructor(e){let t=Fm({type:`undirected`,multi:!0},e);if(`multi`in t&&t.multi!==!0)throw new Y(`MultiUndirectedGraph.from: inconsistent indication that the graph should be simple in given options!`);if(t.type!==`undirected`)throw new Y(`MultiUndirectedGraph.from: inconsistent "`+t.type+`" type in given options!`);super(t)}};function Cg(e){e.from=function(t,n){let r=new e(Fm({},t.options,n));return r.import(t),r}}Cg(_g),Cg(vg),Cg(yg),Cg(bg),Cg(xg),Cg(Sg),_g.Graph=_g,_g.DirectedGraph=vg,_g.UndirectedGraph=yg,_g.MultiGraph=bg,_g.MultiDirectedGraph=xg,_g.MultiUndirectedGraph=Sg,_g.InvalidArgumentsGraphError=Y,_g.NotFoundGraphError=X,_g.UsageGraphError=Z;function wg(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function Tg(e){var t=wg(e,`string`);return typeof t==`symbol`?t:t+``}function Eg(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function Dg(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,Tg(r.key),r)}}function Og(e,t,n){return t&&Dg(e.prototype,t),n&&Dg(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function kg(e){return kg=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},kg(e)}function Ag(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Ag=function(){return!!e})()}function jg(e){if(e===void 0)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return e}function Mg(e,t){if(t&&(typeof t==`object`||typeof t==`function`))return t;if(t!==void 0)throw TypeError(`Derived constructors may only return object or undefined`);return jg(e)}function Ng(e,t,n){return t=kg(t),Mg(e,Ag()?Reflect.construct(t,n||[],kg(e).constructor):t.apply(e,n))}function Pg(e,t){return Pg=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Pg(e,t)}function Fg(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function`);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Pg(e,t)}function Ig(e){if(Array.isArray(e))return e}function Lg(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function Rg(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function zg(e,t){if(e){if(typeof e==`string`)return Rg(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Rg(e,t):void 0}}function Bg(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
2
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Vg(e,t){return Ig(e)||Lg(e,t)||zg(e,t)||Bg()}var Hg={black:`#000000`,silver:`#C0C0C0`,gray:`#808080`,grey:`#808080`,white:`#FFFFFF`,maroon:`#800000`,red:`#FF0000`,purple:`#800080`,fuchsia:`#FF00FF`,green:`#008000`,lime:`#00FF00`,olive:`#808000`,yellow:`#FFFF00`,navy:`#000080`,blue:`#0000FF`,teal:`#008080`,aqua:`#00FFFF`,darkblue:`#00008B`,mediumblue:`#0000CD`,darkgreen:`#006400`,darkcyan:`#008B8B`,deepskyblue:`#00BFFF`,darkturquoise:`#00CED1`,mediumspringgreen:`#00FA9A`,springgreen:`#00FF7F`,cyan:`#00FFFF`,midnightblue:`#191970`,dodgerblue:`#1E90FF`,lightseagreen:`#20B2AA`,forestgreen:`#228B22`,seagreen:`#2E8B57`,darkslategray:`#2F4F4F`,darkslategrey:`#2F4F4F`,limegreen:`#32CD32`,mediumseagreen:`#3CB371`,turquoise:`#40E0D0`,royalblue:`#4169E1`,steelblue:`#4682B4`,darkslateblue:`#483D8B`,mediumturquoise:`#48D1CC`,indigo:`#4B0082`,darkolivegreen:`#556B2F`,cadetblue:`#5F9EA0`,cornflowerblue:`#6495ED`,rebeccapurple:`#663399`,mediumaquamarine:`#66CDAA`,dimgray:`#696969`,dimgrey:`#696969`,slateblue:`#6A5ACD`,olivedrab:`#6B8E23`,slategray:`#708090`,slategrey:`#708090`,lightslategray:`#778899`,lightslategrey:`#778899`,mediumslateblue:`#7B68EE`,lawngreen:`#7CFC00`,chartreuse:`#7FFF00`,aquamarine:`#7FFFD4`,skyblue:`#87CEEB`,lightskyblue:`#87CEFA`,blueviolet:`#8A2BE2`,darkred:`#8B0000`,darkmagenta:`#8B008B`,saddlebrown:`#8B4513`,darkseagreen:`#8FBC8F`,lightgreen:`#90EE90`,mediumpurple:`#9370DB`,darkviolet:`#9400D3`,palegreen:`#98FB98`,darkorchid:`#9932CC`,yellowgreen:`#9ACD32`,sienna:`#A0522D`,brown:`#A52A2A`,darkgray:`#A9A9A9`,darkgrey:`#A9A9A9`,lightblue:`#ADD8E6`,greenyellow:`#ADFF2F`,paleturquoise:`#AFEEEE`,lightsteelblue:`#B0C4DE`,powderblue:`#B0E0E6`,firebrick:`#B22222`,darkgoldenrod:`#B8860B`,mediumorchid:`#BA55D3`,rosybrown:`#BC8F8F`,darkkhaki:`#BDB76B`,mediumvioletred:`#C71585`,indianred:`#CD5C5C`,peru:`#CD853F`,chocolate:`#D2691E`,tan:`#D2B48C`,lightgray:`#D3D3D3`,lightgrey:`#D3D3D3`,thistle:`#D8BFD8`,orchid:`#DA70D6`,goldenrod:`#DAA520`,palevioletred:`#DB7093`,crimson:`#DC143C`,gainsboro:`#DCDCDC`,plum:`#DDA0DD`,burlywood:`#DEB887`,lightcyan:`#E0FFFF`,lavender:`#E6E6FA`,darksalmon:`#E9967A`,violet:`#EE82EE`,palegoldenrod:`#EEE8AA`,lightcoral:`#F08080`,khaki:`#F0E68C`,aliceblue:`#F0F8FF`,honeydew:`#F0FFF0`,azure:`#F0FFFF`,sandybrown:`#F4A460`,wheat:`#F5DEB3`,beige:`#F5F5DC`,whitesmoke:`#F5F5F5`,mintcream:`#F5FFFA`,ghostwhite:`#F8F8FF`,salmon:`#FA8072`,antiquewhite:`#FAEBD7`,linen:`#FAF0E6`,lightgoldenrodyellow:`#FAFAD2`,oldlace:`#FDF5E6`,magenta:`#FF00FF`,deeppink:`#FF1493`,orangered:`#FF4500`,tomato:`#FF6347`,hotpink:`#FF69B4`,coral:`#FF7F50`,darkorange:`#FF8C00`,lightsalmon:`#FFA07A`,orange:`#FFA500`,lightpink:`#FFB6C1`,pink:`#FFC0CB`,gold:`#FFD700`,peachpuff:`#FFDAB9`,navajowhite:`#FFDEAD`,moccasin:`#FFE4B5`,bisque:`#FFE4C4`,mistyrose:`#FFE4E1`,blanchedalmond:`#FFEBCD`,papayawhip:`#FFEFD5`,lavenderblush:`#FFF0F5`,seashell:`#FFF5EE`,cornsilk:`#FFF8DC`,lemonchiffon:`#FFFACD`,floralwhite:`#FFFAF0`,snow:`#FFFAFA`,lightyellow:`#FFFFE0`,ivory:`#FFFFF0`},Ug=new Int8Array(4),Wg=new Int32Array(Ug.buffer,0,1),Gg=new Float32Array(Ug.buffer,0,1),Kg=/^\s*rgba?\s*\(/,qg=/^\s*rgba?\s*\(\s*([0-9]*)\s*,\s*([0-9]*)\s*,\s*([0-9]*)(?:\s*,\s*(.*)?)?\)\s*$/;function Jg(e){var t=0,n=0,r=0,i=1;if(e[0]===`#`)e.length===4?(t=parseInt(e.charAt(1)+e.charAt(1),16),n=parseInt(e.charAt(2)+e.charAt(2),16),r=parseInt(e.charAt(3)+e.charAt(3),16)):(t=parseInt(e.charAt(1)+e.charAt(2),16),n=parseInt(e.charAt(3)+e.charAt(4),16),r=parseInt(e.charAt(5)+e.charAt(6),16)),e.length===9&&(i=parseInt(e.charAt(7)+e.charAt(8),16)/255);else if(Kg.test(e)){var a=e.match(qg);a&&(t=+a[1],n=+a[2],r=+a[3],a[4]&&(i=+a[4]))}return{r:t,g:n,b:r,a:i}}var Yg={};for(var Xg in Hg)Yg[Xg]=Qg(Hg[Xg]),Yg[Hg[Xg]]=Yg[Xg];function Zg(e,t,n,r,i){return Wg[0]=r<<24|n<<16|t<<8|e,i&&(Wg[0]&=4278190079),Gg[0]}function Qg(e){if(e=e.toLowerCase(),Yg[e]!==void 0)return Yg[e];var t=Jg(e),n=t.r,r=t.g,i=t.b,a=t.a;a=a*255|0;var o=Zg(n,r,i,a,!0);return Yg[e]=o,o}function $g(e,t){Gg[0]=Qg(e);var n=Wg[0];return t&&(n|=16777216),[n&255,n>>8&255,n>>16&255,n>>24&255]}var e_={};function t_(e){if(e_[e]!==void 0)return e_[e];var t=Zg((e&16711680)>>>16,(e&65280)>>>8,e&255,255,!0);return e_[e]=t,t}function n_(e,t,n,r){return n+(t<<8)+(e<<16)}function r_(e,t,n,r,i,a){var o=Math.floor(n/a*i),s=Math.floor(e.drawingBufferHeight/a-r/a*i),c=new Uint8Array(4);e.bindFramebuffer(e.FRAMEBUFFER,t),e.readPixels(o,s,1,1,e.RGBA,e.UNSIGNED_BYTE,c);var l=Vg(c,4);return[l[0],l[1],l[2],l[3]]}function Q(e,t,n){return(t=Tg(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i_(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function $(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?i_(Object(n),!0).forEach(function(t){Q(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i_(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function a_(e,t){for(;!{}.hasOwnProperty.call(e,t)&&(e=kg(e))!==null;);return e}function o_(){return o_=typeof Reflect<`u`&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=a_(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},o_.apply(null,arguments)}function s_(e,t,n,r){var i=o_(kg(1&r?e.prototype:e),t,n);return 2&r&&typeof i==`function`?function(e){return i.apply(n,e)}:i}function c_(e){return e.normalized?1:e.size}function l_(e){var t=0;return e.forEach(function(e){return t+=c_(e)}),t}function u_(e,t,n){var r=e===`VERTEX`?t.VERTEX_SHADER:t.FRAGMENT_SHADER,i=t.createShader(r);if(i===null)throw Error(`loadShader: error while creating the shader`);if(t.shaderSource(i,n),t.compileShader(i),!t.getShaderParameter(i,t.COMPILE_STATUS)){var a=t.getShaderInfoLog(i);throw t.deleteShader(i),Error(`loadShader: error while compiling the shader:
3
+ ${a}
4
+ ${n}`)}return i}function d_(e,t){return u_(`VERTEX`,e,t)}function f_(e,t){return u_(`FRAGMENT`,e,t)}function p_(e,t){var n=e.createProgram();if(n===null)throw Error(`loadProgram: error while creating the program.`);var r,i;for(r=0,i=t.length;r<i;r++)e.attachShader(n,t[r]);if(e.linkProgram(n),!e.getProgramParameter(n,e.LINK_STATUS)){var a=e.getProgramInfoLog(n);throw e.deleteProgram(n),Error(`loadProgram: error while linking the program: ${a}`)}return n}function m_(e){var t=e.gl,n=e.buffer,r=e.program,i=e.vertexShader,a=e.fragmentShader;t.deleteShader(i),t.deleteShader(a),t.deleteProgram(r),t.deleteBuffer(n)}function h_(e){return e%1==0?e.toFixed(1):e.toString()}var g_=`#define PICKING_MODE
5
+ `,__=Q(Q(Q(Q(Q(Q(Q(Q({},WebGL2RenderingContext.BOOL,1),WebGL2RenderingContext.BYTE,1),WebGL2RenderingContext.UNSIGNED_BYTE,1),WebGL2RenderingContext.SHORT,2),WebGL2RenderingContext.UNSIGNED_SHORT,2),WebGL2RenderingContext.INT,4),WebGL2RenderingContext.UNSIGNED_INT,4),WebGL2RenderingContext.FLOAT,4),v_=function(){function e(t,n,r){Eg(this,e),Q(this,`array`,new Float32Array),Q(this,`constantArray`,new Float32Array),Q(this,`capacity`,0),Q(this,`verticesCount`,0);var i=this.getDefinition();if(this.VERTICES=i.VERTICES,this.VERTEX_SHADER_SOURCE=i.VERTEX_SHADER_SOURCE,this.FRAGMENT_SHADER_SOURCE=i.FRAGMENT_SHADER_SOURCE,this.UNIFORMS=i.UNIFORMS,this.ATTRIBUTES=i.ATTRIBUTES,this.METHOD=i.METHOD,this.CONSTANT_ATTRIBUTES=`CONSTANT_ATTRIBUTES`in i?i.CONSTANT_ATTRIBUTES:[],this.CONSTANT_DATA=`CONSTANT_DATA`in i?i.CONSTANT_DATA:[],this.isInstanced=`CONSTANT_ATTRIBUTES`in i,this.ATTRIBUTES_ITEMS_COUNT=l_(this.ATTRIBUTES),this.STRIDE=this.VERTICES*this.ATTRIBUTES_ITEMS_COUNT,this.renderer=r,this.normalProgram=this.getProgramInfo(`normal`,t,i.VERTEX_SHADER_SOURCE,i.FRAGMENT_SHADER_SOURCE,null),this.pickProgram=n?this.getProgramInfo(`pick`,t,g_+i.VERTEX_SHADER_SOURCE,g_+i.FRAGMENT_SHADER_SOURCE,n):null,this.isInstanced){var a=l_(this.CONSTANT_ATTRIBUTES);if(this.CONSTANT_DATA.length!==this.VERTICES)throw Error(`Program: error while getting constant data (expected ${this.VERTICES} items, received ${this.CONSTANT_DATA.length} instead)`);this.constantArray=new Float32Array(this.CONSTANT_DATA.length*a);for(var o=0;o<this.CONSTANT_DATA.length;o++){var s=this.CONSTANT_DATA[o];if(s.length!==a)throw Error(`Program: error while getting constant data (one vector has ${s.length} items instead of ${a})`);for(var c=0;c<s.length;c++)this.constantArray[o*a+c]=s[c]}this.STRIDE=this.ATTRIBUTES_ITEMS_COUNT}}return Og(e,[{key:`kill`,value:function(){m_(this.normalProgram),this.pickProgram&&=(m_(this.pickProgram),null)}},{key:`getProgramInfo`,value:function(e,t,n,r,i){var a=this.getDefinition(),o=t.createBuffer();if(o===null)throw Error(`Program: error while creating the WebGL buffer.`);var s=d_(t,n),c=f_(t,r),l=p_(t,[s,c]),u={};a.UNIFORMS.forEach(function(e){var n=t.getUniformLocation(l,e);n&&(u[e]=n)});var d={};a.ATTRIBUTES.forEach(function(e){d[e.name]=t.getAttribLocation(l,e.name)});var f;if(`CONSTANT_ATTRIBUTES`in a&&(a.CONSTANT_ATTRIBUTES.forEach(function(e){d[e.name]=t.getAttribLocation(l,e.name)}),f=t.createBuffer(),f===null))throw Error(`Program: error while creating the WebGL constant buffer.`);return{name:e,program:l,gl:t,frameBuffer:i,buffer:o,constantBuffer:f||{},uniformLocations:u,attributeLocations:d,isPicking:e===`pick`,vertexShader:s,fragmentShader:c}}},{key:`bindProgram`,value:function(e){var t=this,n=0,r=e.gl,i=e.buffer;this.isInstanced?(r.bindBuffer(r.ARRAY_BUFFER,e.constantBuffer),n=0,this.CONSTANT_ATTRIBUTES.forEach(function(r){return n+=t.bindAttribute(r,e,n,!1)}),r.bufferData(r.ARRAY_BUFFER,this.constantArray,r.STATIC_DRAW),r.bindBuffer(r.ARRAY_BUFFER,e.buffer),n=0,this.ATTRIBUTES.forEach(function(r){return n+=t.bindAttribute(r,e,n,!0)}),r.bufferData(r.ARRAY_BUFFER,this.array,r.DYNAMIC_DRAW)):(r.bindBuffer(r.ARRAY_BUFFER,i),n=0,this.ATTRIBUTES.forEach(function(r){return n+=t.bindAttribute(r,e,n)}),r.bufferData(r.ARRAY_BUFFER,this.array,r.DYNAMIC_DRAW)),r.bindBuffer(r.ARRAY_BUFFER,null)}},{key:`unbindProgram`,value:function(e){var t=this;this.isInstanced?(this.CONSTANT_ATTRIBUTES.forEach(function(n){return t.unbindAttribute(n,e,!1)}),this.ATTRIBUTES.forEach(function(n){return t.unbindAttribute(n,e,!0)})):this.ATTRIBUTES.forEach(function(n){return t.unbindAttribute(n,e)})}},{key:`bindAttribute`,value:function(e,t,n,r){var i=__[e.type];if(typeof i!=`number`)throw Error(`Program.bind: yet unsupported attribute type "${e.type}"`);var a=t.attributeLocations[e.name],o=t.gl;if(a!==-1){o.enableVertexAttribArray(a);var s=this.isInstanced?(r?this.ATTRIBUTES_ITEMS_COUNT:l_(this.CONSTANT_ATTRIBUTES))*Float32Array.BYTES_PER_ELEMENT:this.ATTRIBUTES_ITEMS_COUNT*Float32Array.BYTES_PER_ELEMENT;if(o.vertexAttribPointer(a,e.size,e.type,e.normalized||!1,s,n),this.isInstanced&&r){if(o instanceof WebGL2RenderingContext)o.vertexAttribDivisor(a,1);else{var c=o.getExtension(`ANGLE_instanced_arrays`);c&&c.vertexAttribDivisorANGLE(a,1)}}}return e.size*i}},{key:`unbindAttribute`,value:function(e,t,n){var r=t.attributeLocations[e.name],i=t.gl;if(r!==-1&&(i.disableVertexAttribArray(r),this.isInstanced&&n)){if(i instanceof WebGL2RenderingContext)i.vertexAttribDivisor(r,0);else{var a=i.getExtension(`ANGLE_instanced_arrays`);a&&a.vertexAttribDivisorANGLE(r,0)}}}},{key:`reallocate`,value:function(e){e!==this.capacity&&(this.capacity=e,this.verticesCount=this.VERTICES*e,this.array=new Float32Array(this.isInstanced?this.capacity*this.ATTRIBUTES_ITEMS_COUNT:this.verticesCount*this.ATTRIBUTES_ITEMS_COUNT))}},{key:`hasNothingToRender`,value:function(){return this.verticesCount===0}},{key:`renderProgram`,value:function(e,t){var n=t.gl,r=t.program;n.enable(n.BLEND),n.useProgram(r),this.setUniforms(e,t),this.drawWebGL(this.METHOD,t)}},{key:`render`,value:function(e){this.hasNothingToRender()||(this.pickProgram&&(this.pickProgram.gl.viewport(0,0,e.width*e.pixelRatio/e.downSizingRatio,e.height*e.pixelRatio/e.downSizingRatio),this.bindProgram(this.pickProgram),this.renderProgram($($({},e),{},{pixelRatio:e.pixelRatio/e.downSizingRatio}),this.pickProgram),this.unbindProgram(this.pickProgram)),this.normalProgram.gl.viewport(0,0,e.width*e.pixelRatio,e.height*e.pixelRatio),this.bindProgram(this.normalProgram),this.renderProgram(e,this.normalProgram),this.unbindProgram(this.normalProgram))}},{key:`drawWebGL`,value:function(e,t){var n=t.gl,r=t.frameBuffer;if(n.bindFramebuffer(n.FRAMEBUFFER,r),!this.isInstanced)n.drawArrays(e,0,this.verticesCount);else if(n instanceof WebGL2RenderingContext)n.drawArraysInstanced(e,0,this.VERTICES,this.capacity);else{var i=n.getExtension(`ANGLE_instanced_arrays`);i&&i.drawArraysInstancedANGLE(e,0,this.VERTICES,this.capacity)}}}])}(),y_=function(e){function t(){return Eg(this,t),Ng(this,t,arguments)}return Fg(t,e),Og(t,[{key:`kill`,value:function(){s_(t,`kill`,this,3)([])}},{key:`process`,value:function(e,t,n){var r=t*this.STRIDE;if(n.hidden){for(var i=r+this.STRIDE;r<i;r++)this.array[r]=0;return}return this.processVisibleItem(t_(e),r,n)}}])}(v_);function b_(e,t,n){return function(){function r(i,a,o){Eg(this,r),Q(this,`drawLabel`,t),Q(this,`drawHover`,n),this.programs=e.map(function(e){return new e(i,a,o)})}return Og(r,[{key:`reallocate`,value:function(e){this.programs.forEach(function(t){return t.reallocate(e)})}},{key:`process`,value:function(e,t,n){this.programs.forEach(function(r){return r.process(e,t,n)})}},{key:`render`,value:function(e){this.programs.forEach(function(t){return t.render(e)})}},{key:`kill`,value:function(){this.programs.forEach(function(e){return e.kill()})}}])}()}var x_=function(e){function t(){var e;Eg(this,t);var n=[...arguments];return e=Ng(this,t,[].concat(n)),Q(e,`drawLabel`,void 0),e}return Fg(t,e),Og(t,[{key:`kill`,value:function(){s_(t,`kill`,this,3)([])}},{key:`process`,value:function(e,t,n,r,i){var a=t*this.STRIDE;if(i.hidden||n.hidden||r.hidden){for(var o=a+this.STRIDE;a<o;a++)this.array[a]=0;return}return this.processVisibleItem(t_(e),a,n,r,i)}}])}(v_);function S_(e,t){return function(){function n(r,i,a){Eg(this,n),Q(this,`drawLabel`,t),this.programs=e.map(function(e){return new e(r,i,a)})}return Og(n,[{key:`reallocate`,value:function(e){this.programs.forEach(function(t){return t.reallocate(e)})}},{key:`process`,value:function(e,t,n,r,i){this.programs.forEach(function(a){return a.process(e,t,n,r,i)})}},{key:`render`,value:function(e){this.programs.forEach(function(t){return t.render(e)})}},{key:`kill`,value:function(){this.programs.forEach(function(e){return e.kill()})}}])}()}function C_(e,t,n,r,i){var a=i.edgeLabelSize,o=i.edgeLabelFont,s=i.edgeLabelWeight,c=i.edgeLabelColor.attribute?t[i.edgeLabelColor.attribute]||i.edgeLabelColor.color||`#000`:i.edgeLabelColor.color,l=t.label;if(l){e.fillStyle=c,e.font=`${s} ${a}px ${o}`;var u=n.size,d=r.size,f=n.x,p=n.y,m=r.x,h=r.y,g=(f+m)/2,_=(p+h)/2,v=m-f,y=h-p,b=Math.sqrt(v*v+y*y);if(!(b<u+d)){f+=v*u/b,p+=y*u/b,m-=v*d/b,h-=y*d/b,g=(f+m)/2,_=(p+h)/2,v=m-f,y=h-p,b=Math.sqrt(v*v+y*y);var x=e.measureText(l).width;if(x>b){var S=`…`;for(l+=S,x=e.measureText(l).width;x>b&&l.length>1;)l=l.slice(0,-2)+S,x=e.measureText(l).width;if(l.length<4)return}var C=v>0?y>0?Math.acos(v/b):Math.asin(y/b):y>0?Math.acos(v/b)+Math.PI:Math.asin(v/b)+Math.PI/2;e.save(),e.translate(g,_),e.rotate(C),e.fillText(l,-x/2,t.size/2+a),e.restore()}}}function w_(e,t,n){if(t.label){var r=n.labelSize,i=n.labelFont,a=n.labelWeight;e.fillStyle=n.labelColor.attribute?t[n.labelColor.attribute]||n.labelColor.color||`#000`:n.labelColor.color,e.font=`${a} ${r}px ${i}`,e.fillText(t.label,t.x+t.size+3,t.y+r/3)}}function T_(e,t,n){var r=n.labelSize,i=n.labelFont;e.font=`${n.labelWeight} ${r}px ${i}`,e.fillStyle=`#FFF`,e.shadowOffsetX=0,e.shadowOffsetY=0,e.shadowBlur=8,e.shadowColor=`#000`;var a=2;if(typeof t.label==`string`){var o=e.measureText(t.label).width,s=Math.round(o+5),c=Math.round(r+2*a),l=Math.max(t.size,r/2)+a,u=Math.asin(c/2/l),d=Math.sqrt(Math.abs(l**2-(c/2)**2));e.beginPath(),e.moveTo(t.x+d,t.y+c/2),e.lineTo(t.x+l+s,t.y+c/2),e.lineTo(t.x+l+s,t.y-c/2),e.lineTo(t.x+d,t.y-c/2),e.arc(t.x,t.y,l,u,-u),e.closePath(),e.fill()}else e.beginPath(),e.arc(t.x,t.y,t.size+a,0,Math.PI*2),e.closePath(),e.fill();e.shadowOffsetX=0,e.shadowOffsetY=0,e.shadowBlur=0,w_(e,t,n)}var E_=`
6
+ precision highp float;
7
+
8
+ varying vec4 v_color;
9
+ varying vec2 v_diffVector;
10
+ varying float v_radius;
11
+
12
+ uniform float u_correctionRatio;
13
+
14
+ const vec4 transparent = vec4(0.0, 0.0, 0.0, 0.0);
15
+
16
+ void main(void) {
17
+ float border = u_correctionRatio * 2.0;
18
+ float dist = length(v_diffVector) - v_radius + border;
19
+
20
+ // No antialiasing for picking mode:
21
+ #ifdef PICKING_MODE
22
+ if (dist > border)
23
+ gl_FragColor = transparent;
24
+ else
25
+ gl_FragColor = v_color;
26
+
27
+ #else
28
+ float t = 0.0;
29
+ if (dist > border)
30
+ t = 1.0;
31
+ else if (dist > 0.0)
32
+ t = dist / border;
33
+
34
+ gl_FragColor = mix(v_color, transparent, t);
35
+ #endif
36
+ }
37
+ `,D_=`
38
+ attribute vec4 a_id;
39
+ attribute vec4 a_color;
40
+ attribute vec2 a_position;
41
+ attribute float a_size;
42
+ attribute float a_angle;
43
+
44
+ uniform mat3 u_matrix;
45
+ uniform float u_sizeRatio;
46
+ uniform float u_correctionRatio;
47
+
48
+ varying vec4 v_color;
49
+ varying vec2 v_diffVector;
50
+ varying float v_radius;
51
+ varying float v_border;
52
+
53
+ const float bias = 255.0 / 254.0;
54
+
55
+ void main() {
56
+ float size = a_size * u_correctionRatio / u_sizeRatio * 4.0;
57
+ vec2 diffVector = size * vec2(cos(a_angle), sin(a_angle));
58
+ vec2 position = a_position + diffVector;
59
+ gl_Position = vec4(
60
+ (u_matrix * vec3(position, 1)).xy,
61
+ 0,
62
+ 1
63
+ );
64
+
65
+ v_diffVector = diffVector;
66
+ v_radius = size / 2.0;
67
+
68
+ #ifdef PICKING_MODE
69
+ // For picking mode, we use the ID as the color:
70
+ v_color = a_id;
71
+ #else
72
+ // For normal mode, we use the color:
73
+ v_color = a_color;
74
+ #endif
75
+
76
+ v_color.a *= bias;
77
+ }
78
+ `,O_=WebGLRenderingContext,k_=O_.UNSIGNED_BYTE,A_=O_.FLOAT,j_=[`u_sizeRatio`,`u_correctionRatio`,`u_matrix`],M_=function(e){function t(){return Eg(this,t),Ng(this,t,arguments)}return Fg(t,e),Og(t,[{key:`getDefinition`,value:function(){return{VERTICES:3,VERTEX_SHADER_SOURCE:D_,FRAGMENT_SHADER_SOURCE:E_,METHOD:WebGLRenderingContext.TRIANGLES,UNIFORMS:j_,ATTRIBUTES:[{name:`a_position`,size:2,type:A_},{name:`a_size`,size:1,type:A_},{name:`a_color`,size:4,type:k_,normalized:!0},{name:`a_id`,size:4,type:k_,normalized:!0}],CONSTANT_ATTRIBUTES:[{name:`a_angle`,size:1,type:A_}],CONSTANT_DATA:[[t.ANGLE_1],[t.ANGLE_2],[t.ANGLE_3]]}}},{key:`processVisibleItem`,value:function(e,t,n){var r=this.array,i=Qg(n.color);r[t++]=n.x,r[t++]=n.y,r[t++]=n.size,r[t++]=i,r[t++]=e}},{key:`setUniforms`,value:function(e,t){var n=t.gl,r=t.uniformLocations,i=r.u_sizeRatio,a=r.u_correctionRatio,o=r.u_matrix;n.uniform1f(a,e.correctionRatio),n.uniform1f(i,e.sizeRatio),n.uniformMatrix3fv(o,!1,e.matrix)}}])}(y_);Q(M_,`ANGLE_1`,0),Q(M_,`ANGLE_2`,2*Math.PI/3),Q(M_,`ANGLE_3`,4*Math.PI/3);var N_=`
79
+ precision mediump float;
80
+
81
+ varying vec4 v_color;
82
+
83
+ void main(void) {
84
+ gl_FragColor = v_color;
85
+ }
86
+ `,P_=`
87
+ attribute vec2 a_position;
88
+ attribute vec2 a_normal;
89
+ attribute float a_radius;
90
+ attribute vec3 a_barycentric;
91
+
92
+ #ifdef PICKING_MODE
93
+ attribute vec4 a_id;
94
+ #else
95
+ attribute vec4 a_color;
96
+ #endif
97
+
98
+ uniform mat3 u_matrix;
99
+ uniform float u_sizeRatio;
100
+ uniform float u_correctionRatio;
101
+ uniform float u_minEdgeThickness;
102
+ uniform float u_lengthToThicknessRatio;
103
+ uniform float u_widenessToThicknessRatio;
104
+
105
+ varying vec4 v_color;
106
+
107
+ const float bias = 255.0 / 254.0;
108
+
109
+ void main() {
110
+ float minThickness = u_minEdgeThickness;
111
+
112
+ float normalLength = length(a_normal);
113
+ vec2 unitNormal = a_normal / normalLength;
114
+
115
+ // These first computations are taken from edge.vert.glsl and
116
+ // edge.clamped.vert.glsl. Please read it to get better comments on what's
117
+ // happening:
118
+ float pixelsThickness = max(normalLength / u_sizeRatio, minThickness);
119
+ float webGLThickness = pixelsThickness * u_correctionRatio;
120
+ float webGLNodeRadius = a_radius * 2.0 * u_correctionRatio / u_sizeRatio;
121
+ float webGLArrowHeadLength = webGLThickness * u_lengthToThicknessRatio * 2.0;
122
+ float webGLArrowHeadThickness = webGLThickness * u_widenessToThicknessRatio;
123
+
124
+ float da = a_barycentric.x;
125
+ float db = a_barycentric.y;
126
+ float dc = a_barycentric.z;
127
+
128
+ vec2 delta = vec2(
129
+ da * (webGLNodeRadius * unitNormal.y)
130
+ + db * ((webGLNodeRadius + webGLArrowHeadLength) * unitNormal.y + webGLArrowHeadThickness * unitNormal.x)
131
+ + dc * ((webGLNodeRadius + webGLArrowHeadLength) * unitNormal.y - webGLArrowHeadThickness * unitNormal.x),
132
+
133
+ da * (-webGLNodeRadius * unitNormal.x)
134
+ + db * (-(webGLNodeRadius + webGLArrowHeadLength) * unitNormal.x + webGLArrowHeadThickness * unitNormal.y)
135
+ + dc * (-(webGLNodeRadius + webGLArrowHeadLength) * unitNormal.x - webGLArrowHeadThickness * unitNormal.y)
136
+ );
137
+
138
+ vec2 position = (u_matrix * vec3(a_position + delta, 1)).xy;
139
+
140
+ gl_Position = vec4(position, 0, 1);
141
+
142
+ #ifdef PICKING_MODE
143
+ // For picking mode, we use the ID as the color:
144
+ v_color = a_id;
145
+ #else
146
+ // For normal mode, we use the color:
147
+ v_color = a_color;
148
+ #endif
149
+
150
+ v_color.a *= bias;
151
+ }
152
+ `,F_=WebGLRenderingContext,I_=F_.UNSIGNED_BYTE,L_=F_.FLOAT,R_=[`u_matrix`,`u_sizeRatio`,`u_correctionRatio`,`u_minEdgeThickness`,`u_lengthToThicknessRatio`,`u_widenessToThicknessRatio`],z_={extremity:`target`,lengthToThicknessRatio:2.5,widenessToThicknessRatio:2};function B_(e){var t=$($({},z_),e||{});return function(e){function n(){return Eg(this,n),Ng(this,n,arguments)}return Fg(n,e),Og(n,[{key:`getDefinition`,value:function(){return{VERTICES:3,VERTEX_SHADER_SOURCE:P_,FRAGMENT_SHADER_SOURCE:N_,METHOD:WebGLRenderingContext.TRIANGLES,UNIFORMS:R_,ATTRIBUTES:[{name:`a_position`,size:2,type:L_},{name:`a_normal`,size:2,type:L_},{name:`a_radius`,size:1,type:L_},{name:`a_color`,size:4,type:I_,normalized:!0},{name:`a_id`,size:4,type:I_,normalized:!0}],CONSTANT_ATTRIBUTES:[{name:`a_barycentric`,size:3,type:L_}],CONSTANT_DATA:[[1,0,0],[0,1,0],[0,0,1]]}}},{key:`processVisibleItem`,value:function(e,n,r,i,a){if(t.extremity===`source`){var o=[i,r];r=o[0],i=o[1]}var s=a.size||1,c=i.size||1,l=r.x,u=r.y,d=i.x,f=i.y,p=Qg(a.color),m=d-l,h=f-u,g=m*m+h*h,_=0,v=0;g&&(g=1/Math.sqrt(g),_=-h*g*s,v=m*g*s);var y=this.array;y[n++]=d,y[n++]=f,y[n++]=-_,y[n++]=-v,y[n++]=c,y[n++]=p,y[n++]=e}},{key:`setUniforms`,value:function(e,n){var r=n.gl,i=n.uniformLocations,a=i.u_matrix,o=i.u_sizeRatio,s=i.u_correctionRatio,c=i.u_minEdgeThickness,l=i.u_lengthToThicknessRatio,u=i.u_widenessToThicknessRatio;r.uniformMatrix3fv(a,!1,e.matrix),r.uniform1f(o,e.sizeRatio),r.uniform1f(s,e.correctionRatio),r.uniform1f(c,e.minEdgeThickness),r.uniform1f(l,t.lengthToThicknessRatio),r.uniform1f(u,t.widenessToThicknessRatio)}}])}(x_)}B_();var V_=`
153
+ precision mediump float;
154
+
155
+ varying vec4 v_color;
156
+ varying vec2 v_normal;
157
+ varying float v_thickness;
158
+ varying float v_feather;
159
+
160
+ const vec4 transparent = vec4(0.0, 0.0, 0.0, 0.0);
161
+
162
+ void main(void) {
163
+ // We only handle antialiasing for normal mode:
164
+ #ifdef PICKING_MODE
165
+ gl_FragColor = v_color;
166
+ #else
167
+ float dist = length(v_normal) * v_thickness;
168
+
169
+ float t = smoothstep(
170
+ v_thickness - v_feather,
171
+ v_thickness,
172
+ dist
173
+ );
174
+
175
+ gl_FragColor = mix(v_color, transparent, t);
176
+ #endif
177
+ }
178
+ `,H_=`
179
+ attribute vec4 a_id;
180
+ attribute vec4 a_color;
181
+ attribute vec2 a_normal;
182
+ attribute float a_normalCoef;
183
+ attribute vec2 a_positionStart;
184
+ attribute vec2 a_positionEnd;
185
+ attribute float a_positionCoef;
186
+ attribute float a_radius;
187
+ attribute float a_radiusCoef;
188
+
189
+ uniform mat3 u_matrix;
190
+ uniform float u_zoomRatio;
191
+ uniform float u_sizeRatio;
192
+ uniform float u_pixelRatio;
193
+ uniform float u_correctionRatio;
194
+ uniform float u_minEdgeThickness;
195
+ uniform float u_lengthToThicknessRatio;
196
+ uniform float u_feather;
197
+
198
+ varying vec4 v_color;
199
+ varying vec2 v_normal;
200
+ varying float v_thickness;
201
+ varying float v_feather;
202
+
203
+ const float bias = 255.0 / 254.0;
204
+
205
+ void main() {
206
+ float minThickness = u_minEdgeThickness;
207
+
208
+ float radius = a_radius * a_radiusCoef;
209
+ vec2 normal = a_normal * a_normalCoef;
210
+ vec2 position = a_positionStart * (1.0 - a_positionCoef) + a_positionEnd * a_positionCoef;
211
+
212
+ float normalLength = length(normal);
213
+ vec2 unitNormal = normal / normalLength;
214
+
215
+ // These first computations are taken from edge.vert.glsl. Please read it to
216
+ // get better comments on what's happening:
217
+ float pixelsThickness = max(normalLength, minThickness * u_sizeRatio);
218
+ float webGLThickness = pixelsThickness * u_correctionRatio / u_sizeRatio;
219
+
220
+ // Here, we move the point to leave space for the arrow head:
221
+ float direction = sign(radius);
222
+ float webGLNodeRadius = direction * radius * 2.0 * u_correctionRatio / u_sizeRatio;
223
+ float webGLArrowHeadLength = webGLThickness * u_lengthToThicknessRatio * 2.0;
224
+
225
+ vec2 compensationVector = vec2(-direction * unitNormal.y, direction * unitNormal.x) * (webGLNodeRadius + webGLArrowHeadLength);
226
+
227
+ // Here is the proper position of the vertex
228
+ gl_Position = vec4((u_matrix * vec3(position + unitNormal * webGLThickness + compensationVector, 1)).xy, 0, 1);
229
+
230
+ v_thickness = webGLThickness / u_zoomRatio;
231
+
232
+ v_normal = unitNormal;
233
+
234
+ v_feather = u_feather * u_correctionRatio / u_zoomRatio / u_pixelRatio * 2.0;
235
+
236
+ #ifdef PICKING_MODE
237
+ // For picking mode, we use the ID as the color:
238
+ v_color = a_id;
239
+ #else
240
+ // For normal mode, we use the color:
241
+ v_color = a_color;
242
+ #endif
243
+
244
+ v_color.a *= bias;
245
+ }
246
+ `,U_=WebGLRenderingContext,W_=U_.UNSIGNED_BYTE,G_=U_.FLOAT,K_=[`u_matrix`,`u_zoomRatio`,`u_sizeRatio`,`u_correctionRatio`,`u_pixelRatio`,`u_feather`,`u_minEdgeThickness`,`u_lengthToThicknessRatio`],q_={lengthToThicknessRatio:z_.lengthToThicknessRatio};function J_(e){var t=$($({},q_),e||{});return function(e){function n(){return Eg(this,n),Ng(this,n,arguments)}return Fg(n,e),Og(n,[{key:`getDefinition`,value:function(){return{VERTICES:6,VERTEX_SHADER_SOURCE:H_,FRAGMENT_SHADER_SOURCE:V_,METHOD:WebGLRenderingContext.TRIANGLES,UNIFORMS:K_,ATTRIBUTES:[{name:`a_positionStart`,size:2,type:G_},{name:`a_positionEnd`,size:2,type:G_},{name:`a_normal`,size:2,type:G_},{name:`a_color`,size:4,type:W_,normalized:!0},{name:`a_id`,size:4,type:W_,normalized:!0},{name:`a_radius`,size:1,type:G_}],CONSTANT_ATTRIBUTES:[{name:`a_positionCoef`,size:1,type:G_},{name:`a_normalCoef`,size:1,type:G_},{name:`a_radiusCoef`,size:1,type:G_}],CONSTANT_DATA:[[0,1,0],[0,-1,0],[1,1,1],[1,1,1],[0,-1,0],[1,-1,-1]]}}},{key:`processVisibleItem`,value:function(e,t,n,r,i){var a=i.size||1,o=n.x,s=n.y,c=r.x,l=r.y,u=Qg(i.color),d=c-o,f=l-s,p=r.size||1,m=d*d+f*f,h=0,g=0;m&&(m=1/Math.sqrt(m),h=-f*m*a,g=d*m*a);var _=this.array;_[t++]=o,_[t++]=s,_[t++]=c,_[t++]=l,_[t++]=h,_[t++]=g,_[t++]=u,_[t++]=e,_[t++]=p}},{key:`setUniforms`,value:function(e,n){var r=n.gl,i=n.uniformLocations,a=i.u_matrix,o=i.u_zoomRatio,s=i.u_feather,c=i.u_pixelRatio,l=i.u_correctionRatio,u=i.u_sizeRatio,d=i.u_minEdgeThickness,f=i.u_lengthToThicknessRatio;r.uniformMatrix3fv(a,!1,e.matrix),r.uniform1f(o,e.zoomRatio),r.uniform1f(u,e.sizeRatio),r.uniform1f(l,e.correctionRatio),r.uniform1f(c,e.pixelRatio),r.uniform1f(s,e.antiAliasingFeather),r.uniform1f(d,e.minEdgeThickness),r.uniform1f(f,t.lengthToThicknessRatio)}}])}(x_)}J_();function Y_(e){return S_([J_(e),B_(e)])}var X_=Y_(),Z_=`
247
+ attribute vec4 a_id;
248
+ attribute vec4 a_color;
249
+ attribute vec2 a_normal;
250
+ attribute float a_normalCoef;
251
+ attribute vec2 a_positionStart;
252
+ attribute vec2 a_positionEnd;
253
+ attribute float a_positionCoef;
254
+
255
+ uniform mat3 u_matrix;
256
+ uniform float u_sizeRatio;
257
+ uniform float u_zoomRatio;
258
+ uniform float u_pixelRatio;
259
+ uniform float u_correctionRatio;
260
+ uniform float u_minEdgeThickness;
261
+ uniform float u_feather;
262
+
263
+ varying vec4 v_color;
264
+ varying vec2 v_normal;
265
+ varying float v_thickness;
266
+ varying float v_feather;
267
+
268
+ const float bias = 255.0 / 254.0;
269
+
270
+ void main() {
271
+ float minThickness = u_minEdgeThickness;
272
+
273
+ vec2 normal = a_normal * a_normalCoef;
274
+ vec2 position = a_positionStart * (1.0 - a_positionCoef) + a_positionEnd * a_positionCoef;
275
+
276
+ float normalLength = length(normal);
277
+ vec2 unitNormal = normal / normalLength;
278
+
279
+ // We require edges to be at least "minThickness" pixels thick *on screen*
280
+ // (so we need to compensate the size ratio):
281
+ float pixelsThickness = max(normalLength, minThickness * u_sizeRatio);
282
+
283
+ // Then, we need to retrieve the normalized thickness of the edge in the WebGL
284
+ // referential (in a ([0, 1], [0, 1]) space), using our "magic" correction
285
+ // ratio:
286
+ float webGLThickness = pixelsThickness * u_correctionRatio / u_sizeRatio;
287
+
288
+ // Here is the proper position of the vertex
289
+ gl_Position = vec4((u_matrix * vec3(position + unitNormal * webGLThickness, 1)).xy, 0, 1);
290
+
291
+ // For the fragment shader though, we need a thickness that takes the "magic"
292
+ // correction ratio into account (as in webGLThickness), but so that the
293
+ // antialiasing effect does not depend on the zoom level. So here's yet
294
+ // another thickness version:
295
+ v_thickness = webGLThickness / u_zoomRatio;
296
+
297
+ v_normal = unitNormal;
298
+
299
+ v_feather = u_feather * u_correctionRatio / u_zoomRatio / u_pixelRatio * 2.0;
300
+
301
+ #ifdef PICKING_MODE
302
+ // For picking mode, we use the ID as the color:
303
+ v_color = a_id;
304
+ #else
305
+ // For normal mode, we use the color:
306
+ v_color = a_color;
307
+ #endif
308
+
309
+ v_color.a *= bias;
310
+ }
311
+ `,Q_=WebGLRenderingContext,$_=Q_.UNSIGNED_BYTE,ev=Q_.FLOAT,tv=[`u_matrix`,`u_zoomRatio`,`u_sizeRatio`,`u_correctionRatio`,`u_pixelRatio`,`u_feather`,`u_minEdgeThickness`],nv=function(e){function t(){return Eg(this,t),Ng(this,t,arguments)}return Fg(t,e),Og(t,[{key:`getDefinition`,value:function(){return{VERTICES:6,VERTEX_SHADER_SOURCE:Z_,FRAGMENT_SHADER_SOURCE:V_,METHOD:WebGLRenderingContext.TRIANGLES,UNIFORMS:tv,ATTRIBUTES:[{name:`a_positionStart`,size:2,type:ev},{name:`a_positionEnd`,size:2,type:ev},{name:`a_normal`,size:2,type:ev},{name:`a_color`,size:4,type:$_,normalized:!0},{name:`a_id`,size:4,type:$_,normalized:!0}],CONSTANT_ATTRIBUTES:[{name:`a_positionCoef`,size:1,type:ev},{name:`a_normalCoef`,size:1,type:ev}],CONSTANT_DATA:[[0,1],[0,-1],[1,1],[1,1],[0,-1],[1,-1]]}}},{key:`processVisibleItem`,value:function(e,t,n,r,i){var a=i.size||1,o=n.x,s=n.y,c=r.x,l=r.y,u=Qg(i.color),d=c-o,f=l-s,p=d*d+f*f,m=0,h=0;p&&(p=1/Math.sqrt(p),m=-f*p*a,h=d*p*a);var g=this.array;g[t++]=o,g[t++]=s,g[t++]=c,g[t++]=l,g[t++]=m,g[t++]=h,g[t++]=u,g[t++]=e}},{key:`setUniforms`,value:function(e,t){var n=t.gl,r=t.uniformLocations,i=r.u_matrix,a=r.u_zoomRatio,o=r.u_feather,s=r.u_pixelRatio,c=r.u_correctionRatio,l=r.u_sizeRatio,u=r.u_minEdgeThickness;n.uniformMatrix3fv(i,!1,e.matrix),n.uniform1f(a,e.zoomRatio),n.uniform1f(l,e.sizeRatio),n.uniform1f(c,e.correctionRatio),n.uniform1f(s,e.pixelRatio),n.uniform1f(o,e.antiAliasingFeather),n.uniform1f(u,e.minEdgeThickness)}}])}(x_),rv=function(e){function t(){var e;return Eg(this,t),e=Ng(this,t),e.rawEmitter=e,e}return Fg(t,e),Og(t)}(Nm.EventEmitter),iv=o(((e,t)=>{t.exports=function(e){return typeof e==`object`&&!!e&&typeof e.addUndirectedEdgeWithKey==`function`&&typeof e.dropNode==`function`&&typeof e.multi==`boolean`}})),av=c(iv()),ov={linear:function(e){return e},quadraticIn:function(e){return e*e},quadraticOut:function(e){return e*(2-e)},quadraticInOut:function(e){return(e*=2)<1?.5*e*e:-.5*(--e*(e-2)-1)},cubicIn:function(e){return e*e*e},cubicOut:function(e){return--e*e*e+1},cubicInOut:function(e){return(e*=2)<1?.5*e*e*e:.5*((e-=2)*e*e+2)}},sv={easing:`quadraticInOut`,duration:150};function cv(){return Float32Array.of(1,0,0,0,1,0,0,0,1)}function lv(e,t,n){return e[0]=t,e[4]=typeof n==`number`?n:t,e}function uv(e,t){var n=Math.sin(t),r=Math.cos(t);return e[0]=r,e[1]=n,e[3]=-n,e[4]=r,e}function dv(e,t,n){return e[6]=t,e[7]=n,e}function fv(e,t){var n=e[0],r=e[1],i=e[2],a=e[3],o=e[4],s=e[5],c=e[6],l=e[7],u=e[8],d=t[0],f=t[1],p=t[2],m=t[3],h=t[4],g=t[5],_=t[6],v=t[7],y=t[8];return e[0]=d*n+f*a+p*c,e[1]=d*r+f*o+p*l,e[2]=d*i+f*s+p*u,e[3]=m*n+h*a+g*c,e[4]=m*r+h*o+g*l,e[5]=m*i+h*s+g*u,e[6]=_*n+v*a+y*c,e[7]=_*r+v*o+y*l,e[8]=_*i+v*s+y*u,e}function pv(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,r=e[0],i=e[1],a=e[3],o=e[4],s=e[6],c=e[7],l=t.x,u=t.y;return{x:l*r+u*a+s*n,y:l*i+u*o+c*n}}function mv(e,t){var n=e.height/e.width,r=t.height/t.width;return n<1&&r>1||n>1&&r<1?1:Math.min(Math.max(r,1/r),Math.max(1/n,n))}function hv(e,t,n,r,i){var a=e.angle,o=e.ratio,s=e.x,c=e.y,l=t.width,u=t.height,d=cv(),f=Math.min(l,u)-2*r,p=mv(t,n);return i?(fv(d,dv(cv(),s,c)),fv(d,lv(cv(),o)),fv(d,uv(cv(),a)),fv(d,lv(cv(),l/f/2/p,u/f/2/p))):(fv(d,lv(cv(),f/l*2*p,f/u*2*p)),fv(d,uv(cv(),-a)),fv(d,lv(cv(),1/o)),fv(d,dv(cv(),-s,-c))),d}function gv(e,t,n){var r=pv(e,{x:Math.cos(t.angle),y:Math.sin(t.angle)},0),i=r.x,a=r.y;return 1/Math.sqrt(i**2+a**2)/n.width}function _v(e){if(!e.order)return{x:[0,1],y:[0,1]};var t=1/0,n=-1/0,r=1/0,i=-1/0;return e.forEachNode(function(e,a){var o=a.x,s=a.y;o<t&&(t=o),o>n&&(n=o),s<r&&(r=s),s>i&&(i=s)}),{x:[t,n],y:[r,i]}}function vv(e){if(!(0,av.default)(e))throw Error(`Sigma: invalid graph instance.`);e.forEachNode(function(e,t){if(!Number.isFinite(t.x)||!Number.isFinite(t.y))throw Error(`Sigma: Coordinates of node ${e} are invalid. A node must have a numeric 'x' and 'y' attribute.`)})}function yv(e,t,n){var r=document.createElement(e);if(t)for(var i in t)r.style[i]=t[i];if(n)for(var a in n)r.setAttribute(a,n[a]);return r}function bv(){return window.devicePixelRatio===void 0?1:window.devicePixelRatio}function xv(e,t,n){return n.sort(function(e,n){var r=t(e)||0,i=t(n)||0;return r<i?-1:+(r>i)})}function Sv(e){var t=Vg(e.x,2),n=t[0],r=t[1],i=Vg(e.y,2),a=i[0],o=i[1],s=Math.max(r-n,o-a),c=(r+n)/2,l=(o+a)/2;(s===0||Math.abs(s)===1/0||isNaN(s))&&(s=1),isNaN(c)&&(c=0),isNaN(l)&&(l=0);var u=function(e){return{x:.5+(e.x-c)/s,y:.5+(e.y-l)/s}};return u.applyTo=function(e){e.x=.5+(e.x-c)/s,e.y=.5+(e.y-l)/s},u.inverse=function(e){return{x:c+s*(e.x-.5),y:l+s*(e.y-.5)}},u.ratio=s,u}function Cv(e){"@babel/helpers - typeof";return Cv=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},Cv(e)}function wv(e,t){var n=t.size;if(n!==0){var r=e.length;e.length+=n;var i=0;t.forEach(function(t){e[r+i]=t,i++})}}function Tv(e){e||={};for(var t=0,n=arguments.length<=1?0:arguments.length-1;t<n;t++){var r=t+1<1||arguments.length<=t+1?void 0:arguments[t+1];r&&Object.assign(e,r)}return e}var Ev={hideEdgesOnMove:!1,hideLabelsOnMove:!1,renderLabels:!0,renderEdgeLabels:!1,enableEdgeEvents:!1,defaultNodeColor:`#999`,defaultNodeType:`circle`,defaultEdgeColor:`#ccc`,defaultEdgeType:`line`,labelFont:`Arial`,labelSize:14,labelWeight:`normal`,labelColor:{color:`#000`},edgeLabelFont:`Arial`,edgeLabelSize:14,edgeLabelWeight:`normal`,edgeLabelColor:{attribute:`color`},stagePadding:30,defaultDrawEdgeLabel:C_,defaultDrawNodeLabel:w_,defaultDrawNodeHover:T_,minEdgeThickness:1.7,antiAliasingFeather:1,dragTimeout:100,draggedEventsTolerance:3,inertiaDuration:200,inertiaRatio:3,zoomDuration:250,zoomingRatio:1.7,doubleClickTimeout:300,doubleClickZoomingRatio:2.2,doubleClickZoomingDuration:200,tapMoveTolerance:10,zoomToSizeRatioFunction:Math.sqrt,itemSizesReference:`screen`,autoRescale:!0,autoCenter:!0,labelDensity:1,labelGridCellSize:100,labelRenderedSizeThreshold:6,nodeReducer:null,edgeReducer:null,zIndex:!1,minCameraRatio:null,maxCameraRatio:null,enableCameraZooming:!0,enableCameraPanning:!0,enableCameraRotation:!0,cameraPanBoundaries:null,allowInvalidContainer:!1,nodeProgramClasses:{},nodeHoverProgramClasses:{},edgeProgramClasses:{}},Dv={circle:M_},Ov={arrow:X_,line:nv};function kv(e){if(typeof e.labelDensity!=`number`||e.labelDensity<0)throw Error("Settings: invalid `labelDensity`. Expecting a positive number.");var t=e.minCameraRatio,n=e.maxCameraRatio;if(typeof t==`number`&&typeof n==`number`&&n<t)throw Error("Settings: invalid camera ratio boundaries. Expecting `maxCameraRatio` to be greater than `minCameraRatio`.")}function Av(e){var t=Tv({},Ev,e);return t.nodeProgramClasses=Tv({},Dv,t.nodeProgramClasses),t.edgeProgramClasses=Tv({},Ov,t.edgeProgramClasses),t}var jv=1.5,Mv=function(e){function t(){var e;return Eg(this,t),e=Ng(this,t),Q(e,`x`,.5),Q(e,`y`,.5),Q(e,`angle`,0),Q(e,`ratio`,1),Q(e,`minRatio`,null),Q(e,`maxRatio`,null),Q(e,`enabledZooming`,!0),Q(e,`enabledPanning`,!0),Q(e,`enabledRotation`,!0),Q(e,`clean`,null),Q(e,`nextFrame`,null),Q(e,`previousState`,null),Q(e,`enabled`,!0),e.previousState=e.getState(),e}return Fg(t,e),Og(t,[{key:`enable`,value:function(){return this.enabled=!0,this}},{key:`disable`,value:function(){return this.enabled=!1,this}},{key:`getState`,value:function(){return{x:this.x,y:this.y,angle:this.angle,ratio:this.ratio}}},{key:`hasState`,value:function(e){return this.x===e.x&&this.y===e.y&&this.ratio===e.ratio&&this.angle===e.angle}},{key:`getPreviousState`,value:function(){var e=this.previousState;return e?{x:e.x,y:e.y,angle:e.angle,ratio:e.ratio}:null}},{key:`getBoundedRatio`,value:function(e){var t=e;return typeof this.minRatio==`number`&&(t=Math.max(t,this.minRatio)),typeof this.maxRatio==`number`&&(t=Math.min(t,this.maxRatio)),t}},{key:`validateState`,value:function(e){var t={};return this.enabledPanning&&typeof e.x==`number`&&(t.x=e.x),this.enabledPanning&&typeof e.y==`number`&&(t.y=e.y),this.enabledZooming&&typeof e.ratio==`number`&&(t.ratio=this.getBoundedRatio(e.ratio)),this.enabledRotation&&typeof e.angle==`number`&&(t.angle=e.angle),this.clean?this.clean($($({},this.getState()),t)):t}},{key:`isAnimated`,value:function(){return!!this.nextFrame}},{key:`setState`,value:function(e){if(!this.enabled)return this;this.previousState=this.getState();var t=this.validateState(e);return typeof t.x==`number`&&(this.x=t.x),typeof t.y==`number`&&(this.y=t.y),typeof t.ratio==`number`&&(this.ratio=t.ratio),typeof t.angle==`number`&&(this.angle=t.angle),this.hasState(this.previousState)||this.emit(`updated`,this.getState()),this}},{key:`updateState`,value:function(e){return this.setState(e(this.getState())),this}},{key:`animate`,value:function(e){var t=this,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0;if(!r)return new Promise(function(r){return t.animate(e,n,r)});if(this.enabled){var i=$($({},sv),n),a=this.validateState(e),o=typeof i.easing==`function`?i.easing:ov[i.easing],s=Date.now(),c=this.getState(),l=function(){var e=(Date.now()-s)/i.duration;if(e>=1){t.nextFrame=null,t.setState(a),t.animationCallback&&=(t.animationCallback.call(null),void 0);return}var n=o(e),r={};typeof a.x==`number`&&(r.x=c.x+(a.x-c.x)*n),typeof a.y==`number`&&(r.y=c.y+(a.y-c.y)*n),t.enabledRotation&&typeof a.angle==`number`&&(r.angle=c.angle+(a.angle-c.angle)*n),typeof a.ratio==`number`&&(r.ratio=c.ratio+(a.ratio-c.ratio)*n),t.setState(r),t.nextFrame=requestAnimationFrame(l)};this.nextFrame?(cancelAnimationFrame(this.nextFrame),this.animationCallback&&this.animationCallback.call(null),this.nextFrame=requestAnimationFrame(l)):l(),this.animationCallback=r}}},{key:`animatedZoom`,value:function(e){return e?typeof e==`number`?this.animate({ratio:this.ratio/e}):this.animate({ratio:this.ratio/(e.factor||jv)},e):this.animate({ratio:this.ratio/jv})}},{key:`animatedUnzoom`,value:function(e){return e?typeof e==`number`?this.animate({ratio:this.ratio*e}):this.animate({ratio:this.ratio*(e.factor||jv)},e):this.animate({ratio:this.ratio*jv})}},{key:`animatedReset`,value:function(e){return this.animate({x:.5,y:.5,ratio:1,angle:0},e)}},{key:`copy`,value:function(){return t.from(this.getState())}}],[{key:`from`,value:function(e){return new t().setState(e)}}])}(rv);function Nv(e,t){var n=t.getBoundingClientRect();return{x:e.clientX-n.left,y:e.clientY-n.top}}function Pv(e,t){var n=$($({},Nv(e,t)),{},{sigmaDefaultPrevented:!1,preventSigmaDefault:function(){n.sigmaDefaultPrevented=!0},original:e});return n}function Fv(e){var t=`x`in e?e:$($({},e.touches[0]||e.previousTouches[0]),{},{original:e.original,sigmaDefaultPrevented:e.sigmaDefaultPrevented,preventSigmaDefault:function(){e.sigmaDefaultPrevented=!0,t.sigmaDefaultPrevented=!0}});return t}function Iv(e,t){return $($({},Pv(e,t)),{},{delta:Bv(e)})}var Lv=2;function Rv(e){for(var t=[],n=0,r=Math.min(e.length,Lv);n<r;n++)t.push(e[n]);return t}function zv(e,t,n){var r={touches:Rv(e.touches).map(function(e){return Nv(e,n)}),previousTouches:t.map(function(e){return Nv(e,n)}),sigmaDefaultPrevented:!1,preventSigmaDefault:function(){r.sigmaDefaultPrevented=!0},original:e};return r}function Bv(e){if(e.deltaY!==void 0)return e.deltaY*-3/360;if(e.detail!==void 0)return e.detail/-9;throw Error(`Captor: could not extract delta from event.`)}var Vv=function(e){function t(e,n){var r;return Eg(this,t),r=Ng(this,t),r.container=e,r.renderer=n,r}return Fg(t,e),Og(t)}(rv),Hv=[`doubleClickTimeout`,`doubleClickZoomingDuration`,`doubleClickZoomingRatio`,`dragTimeout`,`draggedEventsTolerance`,`inertiaDuration`,`inertiaRatio`,`zoomDuration`,`zoomingRatio`].reduce(function(e,t){return $($({},e),{},Q({},t,Ev[t]))},{}),Uv=function(e){function t(e,n){var r;return Eg(this,t),r=Ng(this,t,[e,n]),Q(r,`enabled`,!0),Q(r,`draggedEvents`,0),Q(r,`downStartTime`,null),Q(r,`lastMouseX`,null),Q(r,`lastMouseY`,null),Q(r,`isMouseDown`,!1),Q(r,`isMoving`,!1),Q(r,`movingTimeout`,null),Q(r,`startCameraState`,null),Q(r,`clicks`,0),Q(r,`doubleClickTimeout`,null),Q(r,`currentWheelDirection`,0),Q(r,`settings`,Hv),r.handleClick=r.handleClick.bind(r),r.handleRightClick=r.handleRightClick.bind(r),r.handleDown=r.handleDown.bind(r),r.handleUp=r.handleUp.bind(r),r.handleMove=r.handleMove.bind(r),r.handleWheel=r.handleWheel.bind(r),r.handleLeave=r.handleLeave.bind(r),r.handleEnter=r.handleEnter.bind(r),e.addEventListener(`click`,r.handleClick,{capture:!1}),e.addEventListener(`contextmenu`,r.handleRightClick,{capture:!1}),e.addEventListener(`mousedown`,r.handleDown,{capture:!1}),e.addEventListener(`wheel`,r.handleWheel,{capture:!1}),e.addEventListener(`mouseleave`,r.handleLeave,{capture:!1}),e.addEventListener(`mouseenter`,r.handleEnter,{capture:!1}),document.addEventListener(`mousemove`,r.handleMove,{capture:!1}),document.addEventListener(`mouseup`,r.handleUp,{capture:!1}),r}return Fg(t,e),Og(t,[{key:`kill`,value:function(){var e=this.container;e.removeEventListener(`click`,this.handleClick),e.removeEventListener(`contextmenu`,this.handleRightClick),e.removeEventListener(`mousedown`,this.handleDown),e.removeEventListener(`wheel`,this.handleWheel),e.removeEventListener(`mouseleave`,this.handleLeave),e.removeEventListener(`mouseenter`,this.handleEnter),document.removeEventListener(`mousemove`,this.handleMove),document.removeEventListener(`mouseup`,this.handleUp)}},{key:`handleClick`,value:function(e){var t=this;if(this.enabled){if(this.clicks++,this.clicks===2)return this.clicks=0,typeof this.doubleClickTimeout==`number`&&(clearTimeout(this.doubleClickTimeout),this.doubleClickTimeout=null),this.handleDoubleClick(e);setTimeout(function(){t.clicks=0,t.doubleClickTimeout=null},this.settings.doubleClickTimeout),this.draggedEvents<this.settings.draggedEventsTolerance&&this.emit(`click`,Pv(e,this.container))}}},{key:`handleRightClick`,value:function(e){this.enabled&&this.emit(`rightClick`,Pv(e,this.container))}},{key:`handleDoubleClick`,value:function(e){if(this.enabled){e.preventDefault(),e.stopPropagation();var t=Pv(e,this.container);if(this.emit(`doubleClick`,t),!t.sigmaDefaultPrevented){var n=this.renderer.getCamera(),r=n.getBoundedRatio(n.getState().ratio/this.settings.doubleClickZoomingRatio);n.animate(this.renderer.getViewportZoomedState(Nv(e,this.container),r),{easing:`quadraticInOut`,duration:this.settings.doubleClickZoomingDuration})}}}},{key:`handleDown`,value:function(e){if(this.enabled){if(e.button===0){this.startCameraState=this.renderer.getCamera().getState();var t=Nv(e,this.container),n=t.x,r=t.y;this.lastMouseX=n,this.lastMouseY=r,this.draggedEvents=0,this.downStartTime=Date.now(),this.isMouseDown=!0}this.emit(`mousedown`,Pv(e,this.container))}}},{key:`handleUp`,value:function(e){var t=this;if(!(!this.enabled||!this.isMouseDown)){var n=this.renderer.getCamera();this.isMouseDown=!1,typeof this.movingTimeout==`number`&&(clearTimeout(this.movingTimeout),this.movingTimeout=null);var r=Nv(e,this.container),i=r.x,a=r.y,o=n.getState(),s=n.getPreviousState()||{x:0,y:0};this.isMoving?n.animate({x:o.x+this.settings.inertiaRatio*(o.x-s.x),y:o.y+this.settings.inertiaRatio*(o.y-s.y)},{duration:this.settings.inertiaDuration,easing:`quadraticOut`}):(this.lastMouseX!==i||this.lastMouseY!==a)&&n.setState({x:o.x,y:o.y}),this.isMoving=!1,setTimeout(function(){var e=t.draggedEvents>0;t.draggedEvents=0,e&&t.renderer.getSetting(`hideEdgesOnMove`)&&t.renderer.refresh()},0),this.emit(`mouseup`,Pv(e,this.container))}}},{key:`handleMove`,value:function(e){var t=this;if(this.enabled){var n=Pv(e,this.container);if(this.emit(`mousemovebody`,n),(e.target===this.container||e.composedPath()[0]===this.container)&&this.emit(`mousemove`,n),!n.sigmaDefaultPrevented&&this.isMouseDown){this.isMoving=!0,this.draggedEvents++,typeof this.movingTimeout==`number`&&clearTimeout(this.movingTimeout),this.movingTimeout=window.setTimeout(function(){t.movingTimeout=null,t.isMoving=!1},this.settings.dragTimeout);var r=this.renderer.getCamera(),i=Nv(e,this.container),a=i.x,o=i.y,s=this.renderer.viewportToFramedGraph({x:this.lastMouseX,y:this.lastMouseY}),c=this.renderer.viewportToFramedGraph({x:a,y:o}),l=s.x-c.x,u=s.y-c.y,d=r.getState(),f=d.x+l,p=d.y+u;r.setState({x:f,y:p}),this.lastMouseX=a,this.lastMouseY=o,e.preventDefault(),e.stopPropagation()}}}},{key:`handleLeave`,value:function(e){this.emit(`mouseleave`,Pv(e,this.container))}},{key:`handleEnter`,value:function(e){this.emit(`mouseenter`,Pv(e,this.container))}},{key:`handleWheel`,value:function(e){var t=this,n=this.renderer.getCamera();if(!(!this.enabled||!n.enabledZooming)){var r=Bv(e);if(r){var i=Iv(e,this.container);if(this.emit(`wheel`,i),i.sigmaDefaultPrevented){e.preventDefault(),e.stopPropagation();return}var a=n.getState().ratio,o=r>0?1/this.settings.zoomingRatio:this.settings.zoomingRatio,s=n.getBoundedRatio(a*o),c=r>0?1:-1,l=Date.now();a!==s&&(e.preventDefault(),e.stopPropagation(),!(this.currentWheelDirection===c&&this.lastWheelTriggerTime&&l-this.lastWheelTriggerTime<this.settings.zoomDuration/5)&&(n.animate(this.renderer.getViewportZoomedState(Nv(e,this.container),s),{easing:`quadraticOut`,duration:this.settings.zoomDuration},function(){t.currentWheelDirection=0}),this.currentWheelDirection=c,this.lastWheelTriggerTime=l))}}}},{key:`setSettings`,value:function(e){this.settings=e}}])}(Vv),Wv=[`dragTimeout`,`inertiaDuration`,`inertiaRatio`,`doubleClickTimeout`,`doubleClickZoomingRatio`,`doubleClickZoomingDuration`,`tapMoveTolerance`].reduce(function(e,t){return $($({},e),{},Q({},t,Ev[t]))},{}),Gv=function(e){function t(e,n){var r;return Eg(this,t),r=Ng(this,t,[e,n]),Q(r,`enabled`,!0),Q(r,`isMoving`,!1),Q(r,`hasMoved`,!1),Q(r,`touchMode`,0),Q(r,`startTouchesPositions`,[]),Q(r,`lastTouches`,[]),Q(r,`lastTap`,null),Q(r,`settings`,Wv),r.handleStart=r.handleStart.bind(r),r.handleLeave=r.handleLeave.bind(r),r.handleMove=r.handleMove.bind(r),e.addEventListener(`touchstart`,r.handleStart,{capture:!1}),e.addEventListener(`touchcancel`,r.handleLeave,{capture:!1}),document.addEventListener(`touchend`,r.handleLeave,{capture:!1,passive:!1}),document.addEventListener(`touchmove`,r.handleMove,{capture:!1,passive:!1}),r}return Fg(t,e),Og(t,[{key:`kill`,value:function(){var e=this.container;e.removeEventListener(`touchstart`,this.handleStart),e.removeEventListener(`touchcancel`,this.handleLeave),document.removeEventListener(`touchend`,this.handleLeave),document.removeEventListener(`touchmove`,this.handleMove)}},{key:`getDimensions`,value:function(){return{width:this.container.offsetWidth,height:this.container.offsetHeight}}},{key:`handleStart`,value:function(e){var t=this;if(this.enabled){e.preventDefault();var n=Rv(e.touches);if(this.touchMode=n.length,this.startCameraState=this.renderer.getCamera().getState(),this.startTouchesPositions=n.map(function(e){return Nv(e,t.container)}),this.touchMode===2){var r=Vg(this.startTouchesPositions,2),i=r[0],a=i.x,o=i.y,s=r[1],c=s.x,l=s.y;this.startTouchesAngle=Math.atan2(l-o,c-a),this.startTouchesDistance=Math.sqrt((c-a)**2+(l-o)**2)}this.emit(`touchdown`,zv(e,this.lastTouches,this.container)),this.lastTouches=n,this.lastTouchesPositions=this.startTouchesPositions}}},{key:`handleLeave`,value:function(e){if(!(!this.enabled||!this.startTouchesPositions.length)){switch(e.cancelable&&e.preventDefault(),this.movingTimeout&&(this.isMoving=!1,clearTimeout(this.movingTimeout)),this.touchMode){case 2:if(e.touches.length===1){this.handleStart(e),e.preventDefault();break}case 1:if(this.isMoving){var t=this.renderer.getCamera(),n=t.getState(),r=t.getPreviousState()||{x:0,y:0};t.animate({x:n.x+this.settings.inertiaRatio*(n.x-r.x),y:n.y+this.settings.inertiaRatio*(n.y-r.y)},{duration:this.settings.inertiaDuration,easing:`quadraticOut`})}this.hasMoved=!1,this.isMoving=!1,this.touchMode=0}if(this.emit(`touchup`,zv(e,this.lastTouches,this.container)),!e.touches.length){var i=Nv(this.lastTouches[0],this.container),a=this.startTouchesPositions[0],o=(i.x-a.x)**2+(i.y-a.y)**2;if(!e.touches.length&&o<this.settings.tapMoveTolerance**2){if(this.lastTap&&Date.now()-this.lastTap.time<this.settings.doubleClickTimeout){var s=zv(e,this.lastTouches,this.container);if(this.emit(`doubletap`,s),this.lastTap=null,!s.sigmaDefaultPrevented){var c=this.renderer.getCamera(),l=c.getBoundedRatio(c.getState().ratio/this.settings.doubleClickZoomingRatio);c.animate(this.renderer.getViewportZoomedState(i,l),{easing:`quadraticInOut`,duration:this.settings.doubleClickZoomingDuration})}}else{var u=zv(e,this.lastTouches,this.container);this.emit(`tap`,u),this.lastTap={time:Date.now(),position:u.touches[0]||u.previousTouches[0]}}}}this.lastTouches=Rv(e.touches),this.startTouchesPositions=[]}}},{key:`handleMove`,value:function(e){var t=this;if(!(!this.enabled||!this.startTouchesPositions.length)){e.preventDefault();var n=Rv(e.touches),r=n.map(function(e){return Nv(e,t.container)}),i=this.lastTouches;this.lastTouches=n,this.lastTouchesPositions=r;var a=zv(e,i,this.container);if(this.emit(`touchmove`,a),!a.sigmaDefaultPrevented&&(this.hasMoved||=r.some(function(e,n){var r=t.startTouchesPositions[n];return r&&(e.x!==r.x||e.y!==r.y)}),this.hasMoved)){this.isMoving=!0,this.movingTimeout&&clearTimeout(this.movingTimeout),this.movingTimeout=window.setTimeout(function(){t.isMoving=!1},this.settings.dragTimeout);var o=this.renderer.getCamera(),s=this.startCameraState,c=this.renderer.getSetting(`stagePadding`);switch(this.touchMode){case 1:var l=this.renderer.viewportToFramedGraph((this.startTouchesPositions||[])[0]),u=l.x,d=l.y,f=this.renderer.viewportToFramedGraph(r[0]),p=f.x,m=f.y;o.setState({x:s.x+u-p,y:s.y+d-m});break;case 2:var h={x:.5,y:.5,angle:0,ratio:1},g=r[0],_=g.x,v=g.y,y=r[1],b=y.x,x=y.y,S=Math.atan2(x-v,b-_)-this.startTouchesAngle,C=Math.hypot(x-v,b-_)/this.startTouchesDistance,w=o.getBoundedRatio(s.ratio/C);h.ratio=w,h.angle=s.angle+S;var T=this.getDimensions(),E=this.renderer.viewportToFramedGraph((this.startTouchesPositions||[])[0],{cameraState:s}),ee=Math.min(T.width,T.height)-2*c,te=ee/T.width,D=ee/T.height,O=w/ee,k=_-ee/2/te,A=v-ee/2/D,ne=[k*Math.cos(-h.angle)-A*Math.sin(-h.angle),A*Math.cos(-h.angle)+k*Math.sin(-h.angle)];k=ne[0],A=ne[1],h.x=E.x-k*O,h.y=E.y+A*O,o.setState(h)}}}}},{key:`setSettings`,value:function(e){this.settings=e}}])}(Vv);function Kv(e){if(Array.isArray(e))return Rg(e)}function qv(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function Jv(){throw TypeError(`Invalid attempt to spread non-iterable instance.
312
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Yv(e){return Kv(e)||qv(e)||zg(e)||Jv()}function Xv(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function Zv(e,t){if(e==null)return{};var n,r,i=Xv(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var Qv=function(){function e(t,n){Eg(this,e),this.key=t,this.size=n}return Og(e,null,[{key:`compare`,value:function(e,t){return e.size>t.size?-1:e.size<t.size||e.key>t.key?1:-1}}])}(),$v=function(){function e(){Eg(this,e),Q(this,`width`,0),Q(this,`height`,0),Q(this,`cellSize`,0),Q(this,`columns`,0),Q(this,`rows`,0),Q(this,`cells`,{})}return Og(e,[{key:`resizeAndClear`,value:function(e,t){this.width=e.width,this.height=e.height,this.cellSize=t,this.columns=Math.ceil(e.width/t),this.rows=Math.ceil(e.height/t),this.cells={}}},{key:`getIndex`,value:function(e){var t=Math.floor(e.x/this.cellSize);return Math.floor(e.y/this.cellSize)*this.columns+t}},{key:`add`,value:function(e,t,n){var r=new Qv(e,t),i=this.getIndex(n),a=this.cells[i];a||(a=[],this.cells[i]=a),a.push(r)}},{key:`organize`,value:function(){for(var e in this.cells)this.cells[e].sort(Qv.compare)}},{key:`getLabelsToDisplay`,value:function(e,t){var n=this.cellSize*this.cellSize,r=n/e/e*t/n,i=Math.ceil(r),a=[];for(var o in this.cells)for(var s=this.cells[o],c=0;c<Math.min(i,s.length);c++)a.push(s[c].key);return a}}])}();function ey(e){var t=e.graph,n=e.hoveredNode,r=e.highlightedNodes,i=e.displayedNodeLabels,a=[];return t.forEachEdge(function(e,t,o,s){(o===n||s===n||r.has(o)||r.has(s)||i.has(o)&&i.has(s))&&a.push(e)}),a}var ty=150,ny=50,ry=Object.prototype.hasOwnProperty;function iy(e,t,n){if(!ry.call(n,`x`)||!ry.call(n,`y`))throw Error(`Sigma: could not find a valid position (x, y) for node "${t}". All your nodes must have a number "x" and "y". Maybe your forgot to apply a layout or your "nodeReducer" is not returning the correct data?`);return n.color||=e.defaultNodeColor,!n.label&&n.label!==``&&(n.label=null),n.label=n.label!==void 0&&n.label!==null?``+n.label:null,n.size||=2,ry.call(n,`hidden`)||(n.hidden=!1),ry.call(n,`highlighted`)||(n.highlighted=!1),ry.call(n,`forceLabel`)||(n.forceLabel=!1),(!n.type||n.type===``)&&(n.type=e.defaultNodeType),n.zIndex||=0,n}function ay(e,t,n){return n.color||=e.defaultEdgeColor,n.label||=``,n.size||=.5,ry.call(n,`hidden`)||(n.hidden=!1),ry.call(n,`forceLabel`)||(n.forceLabel=!1),(!n.type||n.type===``)&&(n.type=e.defaultEdgeType),n.zIndex||=0,n}var oy=function(e){function t(e,n){var r,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(Eg(this,t),r=Ng(this,t),Q(r,`elements`,{}),Q(r,`canvasContexts`,{}),Q(r,`webGLContexts`,{}),Q(r,`pickingLayers`,new Set),Q(r,`textures`,{}),Q(r,`frameBuffers`,{}),Q(r,`activeListeners`,{}),Q(r,`labelGrid`,new $v),Q(r,`nodeDataCache`,{}),Q(r,`edgeDataCache`,{}),Q(r,`nodeProgramIndex`,{}),Q(r,`edgeProgramIndex`,{}),Q(r,`nodesWithForcedLabels`,new Set),Q(r,`edgesWithForcedLabels`,new Set),Q(r,`nodeExtent`,{x:[0,1],y:[0,1]}),Q(r,`nodeZExtent`,[1/0,-1/0]),Q(r,`edgeZExtent`,[1/0,-1/0]),Q(r,`matrix`,cv()),Q(r,`invMatrix`,cv()),Q(r,`correctionRatio`,1),Q(r,`customBBox`,null),Q(r,`normalizationFunction`,Sv({x:[0,1],y:[0,1]})),Q(r,`graphToViewportRatio`,1),Q(r,`itemIDsIndex`,{}),Q(r,`nodeIndices`,{}),Q(r,`edgeIndices`,{}),Q(r,`width`,0),Q(r,`height`,0),Q(r,`pixelRatio`,bv()),Q(r,`pickingDownSizingRatio`,2*r.pixelRatio),Q(r,`displayedNodeLabels`,new Set),Q(r,`displayedEdgeLabels`,new Set),Q(r,`highlightedNodes`,new Set),Q(r,`hoveredNode`,null),Q(r,`hoveredEdge`,null),Q(r,`renderFrame`,null),Q(r,`renderHighlightedNodesFrame`,null),Q(r,`needToProcess`,!1),Q(r,`checkEdgesEventsFrame`,null),Q(r,`nodePrograms`,{}),Q(r,`nodeHoverPrograms`,{}),Q(r,`edgePrograms`,{}),r.settings=Av(i),kv(r.settings),vv(e),!(n instanceof HTMLElement))throw Error(`Sigma: container should be an html element.`);for(var a in r.graph=e,r.container=n,r.createWebGLContext(`edges`,{picking:i.enableEdgeEvents}),r.createCanvasContext(`edgeLabels`),r.createWebGLContext(`nodes`,{picking:!0}),r.createCanvasContext(`labels`),r.createCanvasContext(`hovers`),r.createWebGLContext(`hoverNodes`),r.createCanvasContext(`mouse`,{style:{touchAction:`none`,userSelect:`none`}}),r.resize(),r.settings.nodeProgramClasses)r.registerNodeProgram(a,r.settings.nodeProgramClasses[a],r.settings.nodeHoverProgramClasses[a]);for(var o in r.settings.edgeProgramClasses)r.registerEdgeProgram(o,r.settings.edgeProgramClasses[o]);return r.camera=new Mv,r.bindCameraHandlers(),r.mouseCaptor=new Uv(r.elements.mouse,r),r.mouseCaptor.setSettings(r.settings),r.touchCaptor=new Gv(r.elements.mouse,r),r.touchCaptor.setSettings(r.settings),r.bindEventHandlers(),r.bindGraphHandlers(),r.handleSettingsUpdate(),r.refresh(),r}return Fg(t,e),Og(t,[{key:`registerNodeProgram`,value:function(e,t,n){return this.nodePrograms[e]&&this.nodePrograms[e].kill(),this.nodeHoverPrograms[e]&&this.nodeHoverPrograms[e].kill(),this.nodePrograms[e]=new t(this.webGLContexts.nodes,this.frameBuffers.nodes,this),this.nodeHoverPrograms[e]=new(n||t)(this.webGLContexts.hoverNodes,null,this),this}},{key:`registerEdgeProgram`,value:function(e,t){return this.edgePrograms[e]&&this.edgePrograms[e].kill(),this.edgePrograms[e]=new t(this.webGLContexts.edges,this.frameBuffers.edges,this),this}},{key:`unregisterNodeProgram`,value:function(e){if(this.nodePrograms[e]){var t=this.nodePrograms,n=t[e],r=Zv(t,[e].map(Tg));n.kill(),this.nodePrograms=r}if(this.nodeHoverPrograms[e]){var i=this.nodeHoverPrograms,a=i[e],o=Zv(i,[e].map(Tg));a.kill(),this.nodePrograms=o}return this}},{key:`unregisterEdgeProgram`,value:function(e){if(this.edgePrograms[e]){var t=this.edgePrograms,n=t[e],r=Zv(t,[e].map(Tg));n.kill(),this.edgePrograms=r}return this}},{key:`resetWebGLTexture`,value:function(e){var t=this.webGLContexts[e],n=this.frameBuffers[e],r=this.textures[e];r&&t.deleteTexture(r);var i=t.createTexture();return t.bindFramebuffer(t.FRAMEBUFFER,n),t.bindTexture(t.TEXTURE_2D,i),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,this.width,this.height,0,t.RGBA,t.UNSIGNED_BYTE,null),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,i,0),this.textures[e]=i,this}},{key:`bindCameraHandlers`,value:function(){var e=this;return this.activeListeners.camera=function(){e.scheduleRender()},this.camera.on(`updated`,this.activeListeners.camera),this}},{key:`unbindCameraHandlers`,value:function(){return this.camera.removeListener(`updated`,this.activeListeners.camera),this}},{key:`getNodeAtPosition`,value:function(e){var t=e.x,n=e.y,r=r_(this.webGLContexts.nodes,this.frameBuffers.nodes,t,n,this.pixelRatio,this.pickingDownSizingRatio),i=n_.apply(void 0,Yv(r)),a=this.itemIDsIndex[i];return a&&a.type===`node`?a.id:null}},{key:`bindEventHandlers`,value:function(){var e=this;this.activeListeners.handleResize=function(){e.scheduleRefresh()},window.addEventListener(`resize`,this.activeListeners.handleResize),this.activeListeners.handleMove=function(t){var n=Fv(t),r={event:n,preventSigmaDefault:function(){n.preventSigmaDefault()}},i=e.getNodeAtPosition(n);if(i&&e.hoveredNode!==i&&!e.nodeDataCache[i].hidden){e.hoveredNode&&e.emit(`leaveNode`,$($({},r),{},{node:e.hoveredNode})),e.hoveredNode=i,e.emit(`enterNode`,$($({},r),{},{node:i})),e.scheduleHighlightedNodesRender();return}if(e.hoveredNode&&e.getNodeAtPosition(n)!==e.hoveredNode){var a=e.hoveredNode;e.hoveredNode=null,e.emit(`leaveNode`,$($({},r),{},{node:a})),e.scheduleHighlightedNodesRender();return}if(e.settings.enableEdgeEvents){var o=e.hoveredNode?null:e.getEdgeAtPoint(r.event.x,r.event.y);o!==e.hoveredEdge&&(e.hoveredEdge&&e.emit(`leaveEdge`,$($({},r),{},{edge:e.hoveredEdge})),o&&e.emit(`enterEdge`,$($({},r),{},{edge:o})),e.hoveredEdge=o)}},this.activeListeners.handleMoveBody=function(t){var n=Fv(t);e.emit(`moveBody`,{event:n,preventSigmaDefault:function(){n.preventSigmaDefault()}})},this.activeListeners.handleLeave=function(t){var n=Fv(t),r={event:n,preventSigmaDefault:function(){n.preventSigmaDefault()}};e.hoveredNode&&(e.emit(`leaveNode`,$($({},r),{},{node:e.hoveredNode})),e.scheduleHighlightedNodesRender()),e.settings.enableEdgeEvents&&e.hoveredEdge&&(e.emit(`leaveEdge`,$($({},r),{},{edge:e.hoveredEdge})),e.scheduleHighlightedNodesRender()),e.emit(`leaveStage`,$({},r))},this.activeListeners.handleEnter=function(t){var n=Fv(t),r={event:n,preventSigmaDefault:function(){n.preventSigmaDefault()}};e.emit(`enterStage`,$({},r))};var t=function(t){return function(n){var r=Fv(n),i={event:r,preventSigmaDefault:function(){r.preventSigmaDefault()}},a=e.getNodeAtPosition(r);if(a)return e.emit(`${t}Node`,$($({},i),{},{node:a}));if(e.settings.enableEdgeEvents){var o=e.getEdgeAtPoint(r.x,r.y);if(o)return e.emit(`${t}Edge`,$($({},i),{},{edge:o}))}return e.emit(`${t}Stage`,i)}};return this.activeListeners.handleClick=t(`click`),this.activeListeners.handleRightClick=t(`rightClick`),this.activeListeners.handleDoubleClick=t(`doubleClick`),this.activeListeners.handleWheel=t(`wheel`),this.activeListeners.handleDown=t(`down`),this.activeListeners.handleUp=t(`up`),this.mouseCaptor.on(`mousemove`,this.activeListeners.handleMove),this.mouseCaptor.on(`mousemovebody`,this.activeListeners.handleMoveBody),this.mouseCaptor.on(`click`,this.activeListeners.handleClick),this.mouseCaptor.on(`rightClick`,this.activeListeners.handleRightClick),this.mouseCaptor.on(`doubleClick`,this.activeListeners.handleDoubleClick),this.mouseCaptor.on(`wheel`,this.activeListeners.handleWheel),this.mouseCaptor.on(`mousedown`,this.activeListeners.handleDown),this.mouseCaptor.on(`mouseup`,this.activeListeners.handleUp),this.mouseCaptor.on(`mouseleave`,this.activeListeners.handleLeave),this.mouseCaptor.on(`mouseenter`,this.activeListeners.handleEnter),this.touchCaptor.on(`touchdown`,this.activeListeners.handleDown),this.touchCaptor.on(`touchdown`,this.activeListeners.handleMove),this.touchCaptor.on(`touchup`,this.activeListeners.handleUp),this.touchCaptor.on(`touchmove`,this.activeListeners.handleMove),this.touchCaptor.on(`tap`,this.activeListeners.handleClick),this.touchCaptor.on(`doubletap`,this.activeListeners.handleDoubleClick),this.touchCaptor.on(`touchmove`,this.activeListeners.handleMoveBody),this}},{key:`bindGraphHandlers`,value:function(){var e=this,t=this.graph,n=new Set([`x`,`y`,`zIndex`,`type`]);return this.activeListeners.eachNodeAttributesUpdatedGraphUpdate=function(r){var i=r.hints?.attributes;e.graph.forEachNode(function(t){return e.updateNode(t)});var a=!i||i.some(function(e){return n.has(e)});e.refresh({partialGraph:{nodes:t.nodes()},skipIndexation:!a,schedule:!0})},this.activeListeners.eachEdgeAttributesUpdatedGraphUpdate=function(n){var r=n.hints?.attributes;e.graph.forEachEdge(function(t){return e.updateEdge(t)});var i=r&&[`zIndex`,`type`].some(function(e){return r?.includes(e)});e.refresh({partialGraph:{edges:t.edges()},skipIndexation:!i,schedule:!0})},this.activeListeners.addNodeGraphUpdate=function(t){var n=t.key;e.addNode(n),e.refresh({partialGraph:{nodes:[n]},skipIndexation:!1,schedule:!0})},this.activeListeners.updateNodeGraphUpdate=function(t){var n=t.key;e.refresh({partialGraph:{nodes:[n]},skipIndexation:!1,schedule:!0})},this.activeListeners.dropNodeGraphUpdate=function(t){var n=t.key;e.removeNode(n),e.refresh({schedule:!0})},this.activeListeners.addEdgeGraphUpdate=function(t){var n=t.key;e.addEdge(n),e.refresh({partialGraph:{edges:[n]},schedule:!0})},this.activeListeners.updateEdgeGraphUpdate=function(t){var n=t.key;e.refresh({partialGraph:{edges:[n]},skipIndexation:!1,schedule:!0})},this.activeListeners.dropEdgeGraphUpdate=function(t){var n=t.key;e.removeEdge(n),e.refresh({schedule:!0})},this.activeListeners.clearEdgesGraphUpdate=function(){e.clearEdgeState(),e.clearEdgeIndices(),e.refresh({schedule:!0})},this.activeListeners.clearGraphUpdate=function(){e.clearEdgeState(),e.clearNodeState(),e.clearEdgeIndices(),e.clearNodeIndices(),e.refresh({schedule:!0})},t.on(`nodeAdded`,this.activeListeners.addNodeGraphUpdate),t.on(`nodeDropped`,this.activeListeners.dropNodeGraphUpdate),t.on(`nodeAttributesUpdated`,this.activeListeners.updateNodeGraphUpdate),t.on(`eachNodeAttributesUpdated`,this.activeListeners.eachNodeAttributesUpdatedGraphUpdate),t.on(`edgeAdded`,this.activeListeners.addEdgeGraphUpdate),t.on(`edgeDropped`,this.activeListeners.dropEdgeGraphUpdate),t.on(`edgeAttributesUpdated`,this.activeListeners.updateEdgeGraphUpdate),t.on(`eachEdgeAttributesUpdated`,this.activeListeners.eachEdgeAttributesUpdatedGraphUpdate),t.on(`edgesCleared`,this.activeListeners.clearEdgesGraphUpdate),t.on(`cleared`,this.activeListeners.clearGraphUpdate),this}},{key:`unbindGraphHandlers`,value:function(){var e=this.graph;e.removeListener(`nodeAdded`,this.activeListeners.addNodeGraphUpdate),e.removeListener(`nodeDropped`,this.activeListeners.dropNodeGraphUpdate),e.removeListener(`nodeAttributesUpdated`,this.activeListeners.updateNodeGraphUpdate),e.removeListener(`eachNodeAttributesUpdated`,this.activeListeners.eachNodeAttributesUpdatedGraphUpdate),e.removeListener(`edgeAdded`,this.activeListeners.addEdgeGraphUpdate),e.removeListener(`edgeDropped`,this.activeListeners.dropEdgeGraphUpdate),e.removeListener(`edgeAttributesUpdated`,this.activeListeners.updateEdgeGraphUpdate),e.removeListener(`eachEdgeAttributesUpdated`,this.activeListeners.eachEdgeAttributesUpdatedGraphUpdate),e.removeListener(`edgesCleared`,this.activeListeners.clearEdgesGraphUpdate),e.removeListener(`cleared`,this.activeListeners.clearGraphUpdate)}},{key:`getEdgeAtPoint`,value:function(e,t){var n=r_(this.webGLContexts.edges,this.frameBuffers.edges,e,t,this.pixelRatio,this.pickingDownSizingRatio),r=n_.apply(void 0,Yv(n)),i=this.itemIDsIndex[r];return i&&i.type===`edge`?i.id:null}},{key:`process`,value:function(){var e=this;this.emit(`beforeProcess`);var t=this.graph,n=this.settings,r=this.getDimensions();if(this.nodeExtent=_v(this.graph),!this.settings.autoRescale){var i=r.width,a=r.height,o=this.nodeExtent,s=o.x,c=o.y;this.nodeExtent={x:[(s[0]+s[1])/2-i/2,(s[0]+s[1])/2+i/2],y:[(c[0]+c[1])/2-a/2,(c[0]+c[1])/2+a/2]}}this.normalizationFunction=Sv(this.customBBox||this.nodeExtent);var l=hv(new Mv().getState(),r,this.getGraphDimensions(),this.getStagePadding());this.labelGrid.resizeAndClear(r,n.labelGridCellSize);for(var u={},d={},f={},p={},m=1,h=t.nodes(),g=0,_=h.length;g<_;g++){var v=h[g],y=this.nodeDataCache[v],b=t.getNodeAttributes(v);y.x=b.x,y.y=b.y,this.normalizationFunction.applyTo(y),typeof y.label==`string`&&!y.hidden&&this.labelGrid.add(v,y.size,this.framedGraphToViewport(y,{matrix:l})),u[y.type]=(u[y.type]||0)+1}for(var x in this.labelGrid.organize(),this.nodePrograms){if(!ry.call(this.nodePrograms,x))throw Error(`Sigma: could not find a suitable program for node type "${x}"!`);this.nodePrograms[x].reallocate(u[x]||0),u[x]=0}this.settings.zIndex&&this.nodeZExtent[0]!==this.nodeZExtent[1]&&(h=xv(this.nodeZExtent,function(t){return e.nodeDataCache[t].zIndex},h));for(var S=0,C=h.length;S<C;S++){var w=h[S];d[w]=m,p[d[w]]={type:`node`,id:w},m++;var T=this.nodeDataCache[w];this.addNodeToProgram(w,d[w],u[T.type]++)}for(var E={},ee=t.edges(),te=0,D=ee.length;te<D;te++){var O=ee[te],k=this.edgeDataCache[O];E[k.type]=(E[k.type]||0)+1}for(var A in this.settings.zIndex&&this.edgeZExtent[0]!==this.edgeZExtent[1]&&(ee=xv(this.edgeZExtent,function(t){return e.edgeDataCache[t].zIndex},ee)),this.edgePrograms){if(!ry.call(this.edgePrograms,A))throw Error(`Sigma: could not find a suitable program for edge type "${A}"!`);this.edgePrograms[A].reallocate(E[A]||0),E[A]=0}for(var ne=0,re=ee.length;ne<re;ne++){var ie=ee[ne];f[ie]=m,p[f[ie]]={type:`edge`,id:ie},m++;var ae=this.edgeDataCache[ie];this.addEdgeToProgram(ie,f[ie],E[ae.type]++)}return this.itemIDsIndex=p,this.nodeIndices=d,this.edgeIndices=f,this.emit(`afterProcess`),this}},{key:`handleSettingsUpdate`,value:function(e){var t=this,n=this.settings;if(this.camera.minRatio=n.minCameraRatio,this.camera.maxRatio=n.maxCameraRatio,this.camera.enabledZooming=n.enableCameraZooming,this.camera.enabledPanning=n.enableCameraPanning,this.camera.enabledRotation=n.enableCameraRotation,n.cameraPanBoundaries?this.camera.clean=function(e){return t.cleanCameraState(e,n.cameraPanBoundaries&&Cv(n.cameraPanBoundaries)===`object`?n.cameraPanBoundaries:{})}:this.camera.clean=null,this.camera.setState(this.camera.validateState(this.camera.getState())),e){if(e.edgeProgramClasses!==n.edgeProgramClasses){for(var r in n.edgeProgramClasses)n.edgeProgramClasses[r]!==e.edgeProgramClasses[r]&&this.registerEdgeProgram(r,n.edgeProgramClasses[r]);for(var i in e.edgeProgramClasses)n.edgeProgramClasses[i]||this.unregisterEdgeProgram(i)}if(e.nodeProgramClasses!==n.nodeProgramClasses||e.nodeHoverProgramClasses!==n.nodeHoverProgramClasses){for(var a in n.nodeProgramClasses)(n.nodeProgramClasses[a]!==e.nodeProgramClasses[a]||n.nodeHoverProgramClasses[a]!==e.nodeHoverProgramClasses[a])&&this.registerNodeProgram(a,n.nodeProgramClasses[a],n.nodeHoverProgramClasses[a]);for(var o in e.nodeProgramClasses)n.nodeProgramClasses[o]||this.unregisterNodeProgram(o)}}return this.mouseCaptor.setSettings(this.settings),this.touchCaptor.setSettings(this.settings),this}},{key:`cleanCameraState`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=t.tolerance,r=n===void 0?0:n,i=t.boundaries,a=$({},e),o=i||this.nodeExtent,s=Vg(o.x,2),c=s[0],l=s[1],u=Vg(o.y,2),d=u[0],f=u[1],p=[this.graphToViewport({x:c,y:d},{cameraState:e}),this.graphToViewport({x:l,y:d},{cameraState:e}),this.graphToViewport({x:c,y:f},{cameraState:e}),this.graphToViewport({x:l,y:f},{cameraState:e})],m=1/0,h=-1/0,g=1/0,_=-1/0;p.forEach(function(e){var t=e.x,n=e.y;m=Math.min(m,t),h=Math.max(h,t),g=Math.min(g,n),_=Math.max(_,n)});var v=h-m,y=_-g,b=this.getDimensions(),x=b.width,S=b.height,C=0,w=0;if(v>=x?h<x-r?C=h-(x-r):m>r&&(C=m-r):h>x+r?C=h-(x+r):m<-r&&(C=m+r),y>=S?_<S-r?w=_-(S-r):g>r&&(w=g-r):_>S+r?w=_-(S+r):g<-r&&(w=g+r),C||w){var T=this.viewportToFramedGraph({x:0,y:0},{cameraState:e}),E=this.viewportToFramedGraph({x:C,y:w},{cameraState:e});C=E.x-T.x,w=E.y-T.y,a.x+=C,a.y+=w}return a}},{key:`renderLabels`,value:function(){if(!this.settings.renderLabels)return this;var e=this.camera.getState(),t=this.labelGrid.getLabelsToDisplay(e.ratio,this.settings.labelDensity);wv(t,this.nodesWithForcedLabels),this.displayedNodeLabels=new Set;for(var n=this.canvasContexts.labels,r=0,i=t.length;r<i;r++){var a=t[r],o=this.nodeDataCache[a];if(!this.displayedNodeLabels.has(a)&&!o.hidden){var s=this.framedGraphToViewport(o),c=s.x,l=s.y,u=this.scaleSize(o.size);if(!(!o.forceLabel&&u<this.settings.labelRenderedSizeThreshold)&&!(c<-ty||c>this.width+ty||l<-ny||l>this.height+ny)){this.displayedNodeLabels.add(a);var d=this.settings.defaultDrawNodeLabel;(this.nodePrograms[o.type]?.drawLabel||d)(n,$($({key:a},o),{},{size:u,x:c,y:l}),this.settings)}}}return this}},{key:`renderEdgeLabels`,value:function(){if(!this.settings.renderEdgeLabels)return this;var e=this.canvasContexts.edgeLabels;e.clearRect(0,0,this.width,this.height);var t=ey({graph:this.graph,hoveredNode:this.hoveredNode,displayedNodeLabels:this.displayedNodeLabels,highlightedNodes:this.highlightedNodes});wv(t,this.edgesWithForcedLabels);for(var n=new Set,r=0,i=t.length;r<i;r++){var a=t[r],o=this.graph.extremities(a),s=this.nodeDataCache[o[0]],c=this.nodeDataCache[o[1]],l=this.edgeDataCache[a];if(!n.has(a)&&!(l.hidden||s.hidden||c.hidden)){var u=this.settings.defaultDrawEdgeLabel;(this.edgePrograms[l.type]?.drawLabel||u)(e,$($({key:a},l),{},{size:this.scaleSize(l.size)}),$($($({key:o[0]},s),this.framedGraphToViewport(s)),{},{size:this.scaleSize(s.size)}),$($($({key:o[1]},c),this.framedGraphToViewport(c)),{},{size:this.scaleSize(c.size)}),this.settings),n.add(a)}}return this.displayedEdgeLabels=n,this}},{key:`renderHighlightedNodes`,value:function(){var e=this,t=this.canvasContexts.hovers;t.clearRect(0,0,this.width,this.height);var n=function(n){var r=e.nodeDataCache[n],i=e.framedGraphToViewport(r),a=i.x,o=i.y,s=e.scaleSize(r.size),c=e.settings.defaultDrawNodeHover;(e.nodePrograms[r.type]?.drawHover||c)(t,$($({key:n},r),{},{size:s,x:a,y:o}),e.settings)},r=[];this.hoveredNode&&!this.nodeDataCache[this.hoveredNode].hidden&&r.push(this.hoveredNode),this.highlightedNodes.forEach(function(t){t!==e.hoveredNode&&r.push(t)}),r.forEach(function(e){return n(e)});var i={};for(var a in r.forEach(function(t){var n=e.nodeDataCache[t].type;i[n]=(i[n]||0)+1}),this.nodeHoverPrograms)this.nodeHoverPrograms[a].reallocate(i[a]||0),i[a]=0;r.forEach(function(t){var n=e.nodeDataCache[t];e.nodeHoverPrograms[n.type].process(0,i[n.type]++,n)}),this.webGLContexts.hoverNodes.clear(this.webGLContexts.hoverNodes.COLOR_BUFFER_BIT);var o=this.getRenderParams();for(var s in this.nodeHoverPrograms)this.nodeHoverPrograms[s].render(o)}},{key:`scheduleHighlightedNodesRender`,value:function(){var e=this;this.renderHighlightedNodesFrame||this.renderFrame||(this.renderHighlightedNodesFrame=requestAnimationFrame(function(){e.renderHighlightedNodesFrame=null,e.renderHighlightedNodes(),e.renderEdgeLabels()}))}},{key:`render`,value:function(){var e=this;this.emit(`beforeRender`);var t=function(){return e.emit(`afterRender`),e};if(this.renderFrame&&=(cancelAnimationFrame(this.renderFrame),null),this.resize(),this.needToProcess&&this.process(),this.needToProcess=!1,this.clear(),this.pickingLayers.forEach(function(t){return e.resetWebGLTexture(t)}),!this.graph.order)return t();var n=this.mouseCaptor,r=this.camera.isAnimated()||n.isMoving||n.draggedEvents||n.currentWheelDirection,i=this.camera.getState(),a=this.getDimensions(),o=this.getGraphDimensions(),s=this.getStagePadding();this.matrix=hv(i,a,o,s),this.invMatrix=hv(i,a,o,s,!0),this.correctionRatio=gv(this.matrix,i,a),this.graphToViewportRatio=this.getGraphToViewportRatio();var c=this.getRenderParams();for(var l in this.nodePrograms)this.nodePrograms[l].render(c);if(!this.settings.hideEdgesOnMove||!r)for(var u in this.edgePrograms)this.edgePrograms[u].render(c);return this.settings.hideLabelsOnMove&&r?t():(this.renderLabels(),this.renderEdgeLabels(),this.renderHighlightedNodes(),t())}},{key:`addNode`,value:function(e){var t=Object.assign({},this.graph.getNodeAttributes(e));this.settings.nodeReducer&&(t=this.settings.nodeReducer(e,t));var n=iy(this.settings,e,t);this.nodeDataCache[e]=n,this.nodesWithForcedLabels.delete(e),n.forceLabel&&!n.hidden&&this.nodesWithForcedLabels.add(e),this.highlightedNodes.delete(e),n.highlighted&&!n.hidden&&this.highlightedNodes.add(e),this.settings.zIndex&&(n.zIndex<this.nodeZExtent[0]&&(this.nodeZExtent[0]=n.zIndex),n.zIndex>this.nodeZExtent[1]&&(this.nodeZExtent[1]=n.zIndex))}},{key:`updateNode`,value:function(e){this.addNode(e);var t=this.nodeDataCache[e];this.normalizationFunction.applyTo(t)}},{key:`removeNode`,value:function(e){delete this.nodeDataCache[e],delete this.nodeProgramIndex[e],this.highlightedNodes.delete(e),this.hoveredNode===e&&(this.hoveredNode=null),this.nodesWithForcedLabels.delete(e)}},{key:`addEdge`,value:function(e){var t=Object.assign({},this.graph.getEdgeAttributes(e));this.settings.edgeReducer&&(t=this.settings.edgeReducer(e,t));var n=ay(this.settings,e,t);this.edgeDataCache[e]=n,this.edgesWithForcedLabels.delete(e),n.forceLabel&&!n.hidden&&this.edgesWithForcedLabels.add(e),this.settings.zIndex&&(n.zIndex<this.edgeZExtent[0]&&(this.edgeZExtent[0]=n.zIndex),n.zIndex>this.edgeZExtent[1]&&(this.edgeZExtent[1]=n.zIndex))}},{key:`updateEdge`,value:function(e){this.addEdge(e)}},{key:`removeEdge`,value:function(e){delete this.edgeDataCache[e],delete this.edgeProgramIndex[e],this.hoveredEdge===e&&(this.hoveredEdge=null),this.edgesWithForcedLabels.delete(e)}},{key:`clearNodeIndices`,value:function(){this.labelGrid=new $v,this.nodeExtent={x:[0,1],y:[0,1]},this.nodeDataCache={},this.edgeProgramIndex={},this.nodesWithForcedLabels=new Set,this.nodeZExtent=[1/0,-1/0],this.highlightedNodes=new Set}},{key:`clearEdgeIndices`,value:function(){this.edgeDataCache={},this.edgeProgramIndex={},this.edgesWithForcedLabels=new Set,this.edgeZExtent=[1/0,-1/0]}},{key:`clearIndices`,value:function(){this.clearEdgeIndices(),this.clearNodeIndices()}},{key:`clearNodeState`,value:function(){this.displayedNodeLabels=new Set,this.highlightedNodes=new Set,this.hoveredNode=null}},{key:`clearEdgeState`,value:function(){this.displayedEdgeLabels=new Set,this.highlightedNodes=new Set,this.hoveredEdge=null}},{key:`clearState`,value:function(){this.clearEdgeState(),this.clearNodeState()}},{key:`addNodeToProgram`,value:function(e,t,n){var r=this.nodeDataCache[e],i=this.nodePrograms[r.type];if(!i)throw Error(`Sigma: could not find a suitable program for node type "${r.type}"!`);i.process(t,n,r),this.nodeProgramIndex[e]=n}},{key:`addEdgeToProgram`,value:function(e,t,n){var r=this.edgeDataCache[e],i=this.edgePrograms[r.type];if(!i)throw Error(`Sigma: could not find a suitable program for edge type "${r.type}"!`);var a=this.graph.extremities(e),o=this.nodeDataCache[a[0]],s=this.nodeDataCache[a[1]];i.process(t,n,o,s,r),this.edgeProgramIndex[e]=n}},{key:`getRenderParams`,value:function(){return{matrix:this.matrix,invMatrix:this.invMatrix,width:this.width,height:this.height,pixelRatio:this.pixelRatio,zoomRatio:this.camera.ratio,cameraAngle:this.camera.angle,sizeRatio:1/this.scaleSize(),correctionRatio:this.correctionRatio,downSizingRatio:this.pickingDownSizingRatio,minEdgeThickness:this.settings.minEdgeThickness,antiAliasingFeather:this.settings.antiAliasingFeather}}},{key:`getStagePadding`,value:function(){var e=this.settings,t=e.stagePadding;return e.autoRescale&&t||0}},{key:`createLayer`,value:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(this.elements[e])throw Error(`Sigma: a layer named "${e}" already exists`);var r=yv(t,{position:`absolute`},{class:`sigma-${e}`});return n.style&&Object.assign(r.style,n.style),this.elements[e]=r,`beforeLayer`in n&&n.beforeLayer?this.elements[n.beforeLayer].before(r):`afterLayer`in n&&n.afterLayer?this.elements[n.afterLayer].after(r):this.container.appendChild(r),r}},{key:`createCanvas`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return this.createLayer(e,`canvas`,t)}},{key:`createCanvasContext`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=this.createCanvas(e,t),r={preserveDrawingBuffer:!1,antialias:!1};return this.canvasContexts[e]=n.getContext(`2d`,r),this}},{key:`createWebGLContext`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=t?.canvas||this.createCanvas(e,t);t.hidden&&n.remove();var r=$({preserveDrawingBuffer:!1,antialias:!1},t),i=n.getContext(`webgl2`,r);i||=n.getContext(`webgl`,r),i||=n.getContext(`experimental-webgl`,r);var a=i;if(this.webGLContexts[e]=a,a.blendFunc(a.ONE,a.ONE_MINUS_SRC_ALPHA),t.picking){this.pickingLayers.add(e);var o=a.createFramebuffer();if(!o)throw Error(`Sigma: cannot create a new frame buffer for layer ${e}`);this.frameBuffers[e]=o}return a}},{key:`killLayer`,value:function(e){var t=this.elements[e];if(!t)throw Error(`Sigma: cannot kill layer ${e}, which does not exist`);if(this.webGLContexts[e]){var n;(n=this.webGLContexts[e].getExtension(`WEBGL_lose_context`))==null||n.loseContext(),delete this.webGLContexts[e]}else this.canvasContexts[e]&&delete this.canvasContexts[e];return t.remove(),delete this.elements[e],this}},{key:`getCamera`,value:function(){return this.camera}},{key:`setCamera`,value:function(e){this.unbindCameraHandlers(),this.camera=e,this.bindCameraHandlers()}},{key:`getContainer`,value:function(){return this.container}},{key:`getGraph`,value:function(){return this.graph}},{key:`setGraph`,value:function(e){e!==this.graph&&(this.hoveredNode&&!e.hasNode(this.hoveredNode)&&(this.hoveredNode=null),this.hoveredEdge&&!e.hasEdge(this.hoveredEdge)&&(this.hoveredEdge=null),this.unbindGraphHandlers(),this.checkEdgesEventsFrame!==null&&(cancelAnimationFrame(this.checkEdgesEventsFrame),this.checkEdgesEventsFrame=null),this.graph=e,this.bindGraphHandlers(),this.refresh())}},{key:`getMouseCaptor`,value:function(){return this.mouseCaptor}},{key:`getTouchCaptor`,value:function(){return this.touchCaptor}},{key:`getDimensions`,value:function(){return{width:this.width,height:this.height}}},{key:`getGraphDimensions`,value:function(){var e=this.customBBox||this.nodeExtent;return{width:e.x[1]-e.x[0]||1,height:e.y[1]-e.y[0]||1}}},{key:`getNodeDisplayData`,value:function(e){var t=this.nodeDataCache[e];return t?Object.assign({},t):void 0}},{key:`getEdgeDisplayData`,value:function(e){var t=this.edgeDataCache[e];return t?Object.assign({},t):void 0}},{key:`getNodeDisplayedLabels`,value:function(){return new Set(this.displayedNodeLabels)}},{key:`getEdgeDisplayedLabels`,value:function(){return new Set(this.displayedEdgeLabels)}},{key:`getSettings`,value:function(){return $({},this.settings)}},{key:`getSetting`,value:function(e){return this.settings[e]}},{key:`setSetting`,value:function(e,t){var n=$({},this.settings);return this.settings[e]=t,kv(this.settings),this.handleSettingsUpdate(n),this.scheduleRefresh(),this}},{key:`updateSetting`,value:function(e,t){return this.setSetting(e,t(this.settings[e])),this}},{key:`setSettings`,value:function(e){var t=$({},this.settings);return this.settings=$($({},this.settings),e),kv(this.settings),this.handleSettingsUpdate(t),this.scheduleRefresh(),this}},{key:`resize`,value:function(e){var t=this.width,n=this.height;if(this.width=this.container.offsetWidth,this.height=this.container.offsetHeight,this.pixelRatio=bv(),this.width===0){if(this.settings.allowInvalidContainer)this.width=1;else throw Error(`Sigma: Container has no width. You can set the allowInvalidContainer setting to true to stop seeing this error.`)}if(this.height===0){if(this.settings.allowInvalidContainer)this.height=1;else throw Error(`Sigma: Container has no height. You can set the allowInvalidContainer setting to true to stop seeing this error.`)}if(!e&&t===this.width&&n===this.height)return this;for(var r in this.elements){var i=this.elements[r];i.style.width=this.width+`px`,i.style.height=this.height+`px`}for(var a in this.canvasContexts)this.elements[a].setAttribute(`width`,this.width*this.pixelRatio+`px`),this.elements[a].setAttribute(`height`,this.height*this.pixelRatio+`px`),this.pixelRatio!==1&&this.canvasContexts[a].scale(this.pixelRatio,this.pixelRatio);for(var o in this.webGLContexts){this.elements[o].setAttribute(`width`,this.width*this.pixelRatio+`px`),this.elements[o].setAttribute(`height`,this.height*this.pixelRatio+`px`);var s=this.webGLContexts[o];if(s.viewport(0,0,this.width*this.pixelRatio,this.height*this.pixelRatio),this.pickingLayers.has(o)){var c=this.textures[o];c&&s.deleteTexture(c)}}return this.emit(`resize`),this}},{key:`clear`,value:function(){return this.emit(`beforeClear`),this.webGLContexts.nodes.bindFramebuffer(WebGLRenderingContext.FRAMEBUFFER,null),this.webGLContexts.nodes.clear(WebGLRenderingContext.COLOR_BUFFER_BIT),this.webGLContexts.edges.bindFramebuffer(WebGLRenderingContext.FRAMEBUFFER,null),this.webGLContexts.edges.clear(WebGLRenderingContext.COLOR_BUFFER_BIT),this.webGLContexts.hoverNodes.clear(WebGLRenderingContext.COLOR_BUFFER_BIT),this.canvasContexts.labels.clearRect(0,0,this.width,this.height),this.canvasContexts.hovers.clearRect(0,0,this.width,this.height),this.canvasContexts.edgeLabels.clearRect(0,0,this.width,this.height),this.emit(`afterClear`),this}},{key:`refresh`,value:function(e){var t=this,n=e?.skipIndexation!==void 0&&e?.skipIndexation,r=e?.schedule!==void 0&&e.schedule,i=!e||!e.partialGraph;if(i)this.clearEdgeIndices(),this.clearNodeIndices(),this.graph.forEachNode(function(e){return t.addNode(e)}),this.graph.forEachEdge(function(e){return t.addEdge(e)});else{for(var a,o=e.partialGraph?.nodes||[],s=0,c=o?.length||0;s<c;s++){var l=o[s];if(this.updateNode(l),n){var u=this.nodeProgramIndex[l];if(u===void 0)throw Error(`Sigma: node "${l}" can't be repaint`);this.addNodeToProgram(l,this.nodeIndices[l],u)}}for(var d=(e==null||(a=e.partialGraph)==null?void 0:a.edges)||[],f=0,p=d.length;f<p;f++){var m=d[f];if(this.updateEdge(m),n){var h=this.edgeProgramIndex[m];if(h===void 0)throw Error(`Sigma: edge "${m}" can't be repaint`);this.addEdgeToProgram(m,this.edgeIndices[m],h)}}}return(i||!n)&&(this.needToProcess=!0),r?this.scheduleRender():this.render(),this}},{key:`scheduleRender`,value:function(){var e=this;return this.renderFrame||=requestAnimationFrame(function(){e.render()}),this}},{key:`scheduleRefresh`,value:function(e){return this.refresh($($({},e),{},{schedule:!0}))}},{key:`getViewportZoomedState`,value:function(e,t){var n=this.camera.getState(),r=n.ratio,i=n.angle,a=n.x,o=n.y,s=this.settings,c=s.minCameraRatio,l=s.maxCameraRatio;typeof l==`number`&&(t=Math.min(t,l)),typeof c==`number`&&(t=Math.max(t,c));var u=t/r,d={x:this.width/2,y:this.height/2},f=this.viewportToFramedGraph(e),p=this.viewportToFramedGraph(d);return{angle:i,x:(f.x-p.x)*(1-u)+a,y:(f.y-p.y)*(1-u)+o,ratio:t}}},{key:`viewRectangle`,value:function(){var e=this.viewportToFramedGraph({x:0,y:0}),t=this.viewportToFramedGraph({x:this.width,y:0}),n=this.viewportToFramedGraph({x:0,y:this.height});return{x1:e.x,y1:e.y,x2:t.x,y2:t.y,height:t.y-n.y}}},{key:`framedGraphToViewport`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=!!t.cameraState||!!t.viewportDimensions||!!t.graphDimensions,r=pv(t.matrix?t.matrix:n?hv(t.cameraState||this.camera.getState(),t.viewportDimensions||this.getDimensions(),t.graphDimensions||this.getGraphDimensions(),t.padding||this.getStagePadding()):this.matrix,e);return{x:(1+r.x)*this.width/2,y:(1-r.y)*this.height/2}}},{key:`viewportToFramedGraph`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=!!t.cameraState||!!t.viewportDimensions||!t.graphDimensions,r=pv(t.matrix?t.matrix:n?hv(t.cameraState||this.camera.getState(),t.viewportDimensions||this.getDimensions(),t.graphDimensions||this.getGraphDimensions(),t.padding||this.getStagePadding(),!0):this.invMatrix,{x:e.x/this.width*2-1,y:1-e.y/this.height*2});return isNaN(r.x)&&(r.x=0),isNaN(r.y)&&(r.y=0),r}},{key:`viewportToGraph`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return this.normalizationFunction.inverse(this.viewportToFramedGraph(e,t))}},{key:`graphToViewport`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return this.framedGraphToViewport(this.normalizationFunction(e),t)}},{key:`getGraphToViewportRatio`,value:function(){var e={x:0,y:0},t={x:1,y:1},n=Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2),r=this.graphToViewport(e),i=this.graphToViewport(t);return Math.sqrt((r.x-i.x)**2+(r.y-i.y)**2)/n}},{key:`getBBox`,value:function(){return this.nodeExtent}},{key:`getCustomBBox`,value:function(){return this.customBBox}},{key:`setCustomBBox`,value:function(e){return this.customBBox=e,this.scheduleRender(),this}},{key:`kill`,value:function(){this.emit(`kill`),this.removeAllListeners(),this.unbindCameraHandlers(),window.removeEventListener(`resize`,this.activeListeners.handleResize),this.mouseCaptor.kill(),this.touchCaptor.kill(),this.unbindGraphHandlers(),this.clearIndices(),this.clearState(),this.nodeDataCache={},this.edgeDataCache={},this.highlightedNodes.clear(),this.renderFrame&&=(cancelAnimationFrame(this.renderFrame),null),this.renderHighlightedNodesFrame&&=(cancelAnimationFrame(this.renderHighlightedNodesFrame),null);for(var e=this.container;e.firstChild;)e.removeChild(e.firstChild);for(var t in this.nodePrograms)this.nodePrograms[t].kill();for(var n in this.nodeHoverPrograms)this.nodeHoverPrograms[n].kill();for(var r in this.edgePrograms)this.edgePrograms[r].kill();for(var i in this.nodePrograms={},this.nodeHoverPrograms={},this.edgePrograms={},this.elements)this.killLayer(i);this.canvasContexts={},this.webGLContexts={},this.elements={}}},{key:`scaleSize`,value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.camera.ratio;return e/this.settings.zoomToSizeRatioFunction(t)*(this.getSetting(`itemSizesReference`)===`positions`?t*this.graphToViewportRatio:1)}},{key:`getCanvases`,value:function(){var e={};for(var t in this.elements)this.elements[t]instanceof HTMLCanvasElement&&(e[t]=this.elements[t]);return e}}])}(rv),sy=[`application`,`environment`,`service`,`service_instance`,`system_ref`,`repo`];function cy(e){let t=+this._x.call(null,e),n=+this._y.call(null,e);return ly(this.cover(t,n),t,n,e)}function ly(e,t,n,r){if(isNaN(t)||isNaN(n))return e;var i,a=e._root,o={data:r},s=e._x0,c=e._y0,l=e._x1,u=e._y1,d,f,p,m,h,g,_,v;if(!a)return e._root=o,e;for(;a.length;)if((h=t>=(d=(s+l)/2))?s=d:l=d,(g=n>=(f=(c+u)/2))?c=f:u=f,i=a,!(a=a[_=g<<1|h]))return i[_]=o,e;if(p=+e._x.call(null,a.data),m=+e._y.call(null,a.data),t===p&&n===m)return o.next=a,i?i[_]=o:e._root=o,e;do i=i?i[_]=[,,,,]:e._root=[,,,,],(h=t>=(d=(s+l)/2))?s=d:l=d,(g=n>=(f=(c+u)/2))?c=f:u=f;while((_=g<<1|h)==(v=(m>=f)<<1|p>=d));return i[v]=a,i[_]=o,e}function uy(e){var t,n,r=e.length,i,a,o=Array(r),s=Array(r),c=1/0,l=1/0,u=-1/0,d=-1/0;for(n=0;n<r;++n)isNaN(i=+this._x.call(null,t=e[n]))||isNaN(a=+this._y.call(null,t))||(o[n]=i,s[n]=a,i<c&&(c=i),i>u&&(u=i),a<l&&(l=a),a>d&&(d=a));if(c>u||l>d)return this;for(this.cover(c,l).cover(u,d),n=0;n<r;++n)ly(this,o[n],s[n],e[n]);return this}function dy(e,t){if(isNaN(e=+e)||isNaN(t=+t))return this;var n=this._x0,r=this._y0,i=this._x1,a=this._y1;if(isNaN(n))i=(n=Math.floor(e))+1,a=(r=Math.floor(t))+1;else{for(var o=i-n||1,s=this._root,c,l;n>e||e>=i||r>t||t>=a;)switch(l=(t<r)<<1|e<n,c=[,,,,],c[l]=s,s=c,o*=2,l){case 0:i=n+o,a=r+o;break;case 1:n=i-o,a=r+o;break;case 2:i=n+o,r=a-o;break;case 3:n=i-o,r=a-o}this._root&&this._root.length&&(this._root=s)}return this._x0=n,this._y0=r,this._x1=i,this._y1=a,this}function fy(){var e=[];return this.visit(function(t){if(!t.length)do e.push(t.data);while(t=t.next)}),e}function py(e){return arguments.length?this.cover(+e[0][0],+e[0][1]).cover(+e[1][0],+e[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}function my(e,t,n,r,i){this.node=e,this.x0=t,this.y0=n,this.x1=r,this.y1=i}function hy(e,t,n){var r,i=this._x0,a=this._y0,o,s,c,l,u=this._x1,d=this._y1,f=[],p=this._root,m,h;for(p&&f.push(new my(p,i,a,u,d)),n==null?n=1/0:(i=e-n,a=t-n,u=e+n,d=t+n,n*=n);m=f.pop();)if(!(!(p=m.node)||(o=m.x0)>u||(s=m.y0)>d||(c=m.x1)<i||(l=m.y1)<a)){if(p.length){var g=(o+c)/2,_=(s+l)/2;f.push(new my(p[3],g,_,c,l),new my(p[2],o,_,g,l),new my(p[1],g,s,c,_),new my(p[0],o,s,g,_)),(h=(t>=_)<<1|e>=g)&&(m=f[f.length-1],f[f.length-1]=f[f.length-1-h],f[f.length-1-h]=m)}else{var v=e-+this._x.call(null,p.data),y=t-+this._y.call(null,p.data),b=v*v+y*y;if(b<n){var x=Math.sqrt(n=b);i=e-x,a=t-x,u=e+x,d=t+x,r=p.data}}}return r}function gy(e){if(isNaN(u=+this._x.call(null,e))||isNaN(d=+this._y.call(null,e)))return this;var t,n=this._root,r,i,a,o=this._x0,s=this._y0,c=this._x1,l=this._y1,u,d,f,p,m,h,g,_;if(!n)return this;if(n.length)for(;;){if((m=u>=(f=(o+c)/2))?o=f:c=f,(h=d>=(p=(s+l)/2))?s=p:l=p,t=n,!(n=n[g=h<<1|m]))return this;if(!n.length)break;(t[g+1&3]||t[g+2&3]||t[g+3&3])&&(r=t,_=g)}for(;n.data!==e;)if(i=n,!(n=n.next))return this;return(a=n.next)&&delete n.next,i?(a?i.next=a:delete i.next,this):t?(a?t[g]=a:delete t[g],(n=t[0]||t[1]||t[2]||t[3])&&n===(t[3]||t[2]||t[1]||t[0])&&!n.length&&(r?r[_]=n:this._root=n),this):(this._root=a,this)}function _y(e){for(var t=0,n=e.length;t<n;++t)this.remove(e[t]);return this}function vy(){return this._root}function yy(){var e=0;return this.visit(function(t){if(!t.length)do++e;while(t=t.next)}),e}function by(e){var t=[],n,r=this._root,i,a,o,s,c;for(r&&t.push(new my(r,this._x0,this._y0,this._x1,this._y1));n=t.pop();)if(!e(r=n.node,a=n.x0,o=n.y0,s=n.x1,c=n.y1)&&r.length){var l=(a+s)/2,u=(o+c)/2;(i=r[3])&&t.push(new my(i,l,u,s,c)),(i=r[2])&&t.push(new my(i,a,u,l,c)),(i=r[1])&&t.push(new my(i,l,o,s,u)),(i=r[0])&&t.push(new my(i,a,o,l,u))}return this}function xy(e){var t=[],n=[],r;for(this._root&&t.push(new my(this._root,this._x0,this._y0,this._x1,this._y1));r=t.pop();){var i=r.node;if(i.length){var a,o=r.x0,s=r.y0,c=r.x1,l=r.y1,u=(o+c)/2,d=(s+l)/2;(a=i[0])&&t.push(new my(a,o,s,u,d)),(a=i[1])&&t.push(new my(a,u,s,c,d)),(a=i[2])&&t.push(new my(a,o,d,u,l)),(a=i[3])&&t.push(new my(a,u,d,c,l))}n.push(r)}for(;r=n.pop();)e(r.node,r.x0,r.y0,r.x1,r.y1);return this}function Sy(e){return e[0]}function Cy(e){return arguments.length?(this._x=e,this):this._x}function wy(e){return e[1]}function Ty(e){return arguments.length?(this._y=e,this):this._y}function Ey(e,t,n){var r=new Dy(t??Sy,n??wy,NaN,NaN,NaN,NaN);return e==null?r:r.addAll(e)}function Dy(e,t,n,r,i,a){this._x=e,this._y=t,this._x0=n,this._y0=r,this._x1=i,this._y1=a,this._root=void 0}function Oy(e){for(var t={data:e.data},n=t;e=e.next;)n=n.next={data:e.data};return t}var ky=Ey.prototype=Dy.prototype;ky.copy=function(){var e=new Dy(this._x,this._y,this._x0,this._y0,this._x1,this._y1),t=this._root,n,r;if(!t)return e;if(!t.length)return e._root=Oy(t),e;for(n=[{source:t,target:e._root=[,,,,]}];t=n.pop();)for(var i=0;i<4;++i)(r=t.source[i])&&(r.length?n.push({source:r,target:t.target[i]=[,,,,]}):t.target[i]=Oy(r));return e},ky.add=cy,ky.addAll=uy,ky.cover=dy,ky.data=fy,ky.extent=py,ky.find=hy,ky.remove=gy,ky.removeAll=_y,ky.root=vy,ky.size=yy,ky.visit=by,ky.visitAfter=xy,ky.x=Cy,ky.y=Ty;function Ay(e){return function(){return e}}function jy(e){return(e()-.5)*1e-6}function My(e){return e.x+e.vx}function Ny(e){return e.y+e.vy}function Py(e){var t,n,r,i=1,a=1;typeof e!=`function`&&(e=Ay(e==null?1:+e));function o(){for(var e,o=t.length,c,l,u,d,f,p,m=0;m<a;++m)for(c=Ey(t,My,Ny).visitAfter(s),e=0;e<o;++e)l=t[e],f=n[l.index],p=f*f,u=l.x+l.vx,d=l.y+l.vy,c.visit(h);function h(e,t,n,a,o){var s=e.data,c=e.r,m=f+c;if(s){if(s.index>l.index){var h=u-s.x-s.vx,g=d-s.y-s.vy,_=h*h+g*g;_<m*m&&(h===0&&(h=jy(r),_+=h*h),g===0&&(g=jy(r),_+=g*g),_=(m-(_=Math.sqrt(_)))/_*i,l.vx+=(h*=_)*(m=(c*=c)/(p+c)),l.vy+=(g*=_)*m,s.vx-=h*(m=1-m),s.vy-=g*m)}return}return t>u+m||a<u-m||n>d+m||o<d-m}}function s(e){if(e.data)return e.r=n[e.data.index];for(var t=e.r=0;t<4;++t)e[t]&&e[t].r>e.r&&(e.r=e[t].r)}function c(){if(t){var r,i=t.length,a;for(n=Array(i),r=0;r<i;++r)a=t[r],n[a.index]=+e(a,r,t)}}return o.initialize=function(e,n){t=e,r=n,c()},o.iterations=function(e){return arguments.length?(a=+e,o):a},o.strength=function(e){return arguments.length?(i=+e,o):i},o.radius=function(t){return arguments.length?(e=typeof t==`function`?t:Ay(+t),c(),o):e},o}function Fy(e){return e.index}function Iy(e,t){var n=e.get(t);if(!n)throw Error(`node not found: `+t);return n}function Ly(e){var t=Fy,n=d,r,i=Ay(30),a,o,s,c,l,u=1;e??=[];function d(e){return 1/Math.min(s[e.source.index],s[e.target.index])}function f(t){for(var n=0,i=e.length;n<u;++n)for(var o=0,s,d,f,p,m,h,g;o<i;++o)s=e[o],d=s.source,f=s.target,p=f.x+f.vx-d.x-d.vx||jy(l),m=f.y+f.vy-d.y-d.vy||jy(l),h=Math.sqrt(p*p+m*m),h=(h-a[o])/h*t*r[o],p*=h,m*=h,f.vx-=p*(g=c[o]),f.vy-=m*g,d.vx+=p*(g=1-g),d.vy+=m*g}function p(){if(o){var n,i=o.length,l=e.length,u=new Map(o.map((e,n)=>[t(e,n,o),e])),d;for(n=0,s=Array(i);n<l;++n)d=e[n],d.index=n,typeof d.source!=`object`&&(d.source=Iy(u,d.source)),typeof d.target!=`object`&&(d.target=Iy(u,d.target)),s[d.source.index]=(s[d.source.index]||0)+1,s[d.target.index]=(s[d.target.index]||0)+1;for(n=0,c=Array(l);n<l;++n)d=e[n],c[n]=s[d.source.index]/(s[d.source.index]+s[d.target.index]);r=Array(l),m(),a=Array(l),h()}}function m(){if(o)for(var t=0,i=e.length;t<i;++t)r[t]=+n(e[t],t,e)}function h(){if(o)for(var t=0,n=e.length;t<n;++t)a[t]=+i(e[t],t,e)}return f.initialize=function(e,t){o=e,l=t,p()},f.links=function(t){return arguments.length?(e=t,p(),f):e},f.id=function(e){return arguments.length?(t=e,f):t},f.iterations=function(e){return arguments.length?(u=+e,f):u},f.strength=function(e){return arguments.length?(n=typeof e==`function`?e:Ay(+e),m(),f):n},f.distance=function(e){return arguments.length?(i=typeof e==`function`?e:Ay(+e),h(),f):i},f}var Ry={value:()=>{}};function zy(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+``)||r in n||/[\s.]/.test(r))throw Error(`illegal type: `+r);n[r]=[]}return new By(n)}function By(e){this._=e}function Vy(e,t){return e.trim().split(/^|\s+/).map(function(e){var n=``,r=e.indexOf(`.`);if(r>=0&&(n=e.slice(r+1),e=e.slice(0,r)),e&&!t.hasOwnProperty(e))throw Error(`unknown type: `+e);return{type:e,name:n}})}By.prototype=zy.prototype={constructor:By,on:function(e,t){var n=this._,r=Vy(e+``,n),i,a=-1,o=r.length;if(arguments.length<2){for(;++a<o;)if((i=(e=r[a]).type)&&(i=Hy(n[i],e.name)))return i;return}if(t!=null&&typeof t!=`function`)throw Error(`invalid callback: `+t);for(;++a<o;)if(i=(e=r[a]).type)n[i]=Uy(n[i],e.name,t);else if(t==null)for(i in n)n[i]=Uy(n[i],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new By(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var n=Array(i),r=0,i,a;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw Error(`unknown type: `+e);for(a=this._[e],r=0,i=a.length;r<i;++r)a[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw Error(`unknown type: `+e);for(var r=this._[e],i=0,a=r.length;i<a;++i)r[i].value.apply(t,n)}};function Hy(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function Uy(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=Ry,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var Wy=0,Gy=0,Ky=0,qy=1e3,Jy,Yy,Xy=0,Zy=0,Qy=0,$y=typeof performance==`object`&&performance.now?performance:Date,eb=typeof window==`object`&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function tb(){return Zy||=(eb(nb),$y.now()+Qy)}function nb(){Zy=0}function rb(){this._call=this._time=this._next=null}rb.prototype=ib.prototype={constructor:rb,restart:function(e,t,n){if(typeof e!=`function`)throw TypeError(`callback is not a function`);n=(n==null?tb():+n)+(t==null?0:+t),!this._next&&Yy!==this&&(Yy?Yy._next=this:Jy=this,Yy=this),this._call=e,this._time=n,lb()},stop:function(){this._call&&(this._call=null,this._time=1/0,lb())}};function ib(e,t,n){var r=new rb;return r.restart(e,t,n),r}function ab(){tb(),++Wy;for(var e=Jy,t;e;)(t=Zy-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Wy}function ob(){Zy=(Xy=$y.now())+Qy,Wy=Gy=0;try{ab()}finally{Wy=0,cb(),Zy=0}}function sb(){var e=$y.now(),t=e-Xy;t>qy&&(Qy-=t,Xy=e)}function cb(){for(var e,t=Jy,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:Jy=n);Yy=e,lb(r)}function lb(e){Wy||(Gy&&=clearTimeout(Gy),e-Zy>24?(e<1/0&&(Gy=setTimeout(ob,e-$y.now()-Qy)),Ky&&=clearInterval(Ky)):(Ky||=(Xy=$y.now(),setInterval(sb,qy)),Wy=1,eb(ob)))}var ub=1664525,db=1013904223,fb=4294967296;function pb(){let e=1;return()=>(e=(ub*e+db)%fb)/fb}function mb(e){return e.x}function hb(e){return e.y}var gb=10,_b=Math.PI*(3-Math.sqrt(5));function vb(e){var t,n=1,r=.001,i=1-r**(1/300),a=0,o=.6,s=new Map,c=ib(d),l=zy(`tick`,`end`),u=pb();e??=[];function d(){f(),l.call(`tick`,t),n<r&&(c.stop(),l.call(`end`,t))}function f(r){var c,l=e.length,u;r===void 0&&(r=1);for(var d=0;d<r;++d)for(n+=(a-n)*i,s.forEach(function(e){e(n)}),c=0;c<l;++c)u=e[c],u.fx==null?u.x+=u.vx*=o:(u.x=u.fx,u.vx=0),u.fy==null?u.y+=u.vy*=o:(u.y=u.fy,u.vy=0);return t}function p(){for(var t=0,n=e.length,r;t<n;++t){if(r=e[t],r.index=t,r.fx!=null&&(r.x=r.fx),r.fy!=null&&(r.y=r.fy),isNaN(r.x)||isNaN(r.y)){var i=gb*Math.sqrt(.5+t),a=t*_b;r.x=i*Math.cos(a),r.y=i*Math.sin(a)}(isNaN(r.vx)||isNaN(r.vy))&&(r.vx=r.vy=0)}}function m(t){return t.initialize&&t.initialize(e,u),t}return p(),t={tick:f,restart:function(){return c.restart(d),t},stop:function(){return c.stop(),t},nodes:function(n){return arguments.length?(e=n,p(),s.forEach(m),t):e},alpha:function(e){return arguments.length?(n=+e,t):n},alphaMin:function(e){return arguments.length?(r=+e,t):r},alphaDecay:function(e){return arguments.length?(i=+e,t):+i},alphaTarget:function(e){return arguments.length?(a=+e,t):a},velocityDecay:function(e){return arguments.length?(o=1-e,t):1-o},randomSource:function(e){return arguments.length?(u=e,s.forEach(m),t):u},force:function(e,n){return arguments.length>1?(n==null?s.delete(e):s.set(e,m(n)),t):s.get(e)},find:function(t,n,r){var i=0,a=e.length,o,s,c,l,u;for(r==null?r=1/0:r*=r,i=0;i<a;++i)l=e[i],o=t-l.x,s=n-l.y,c=o*o+s*s,c<r&&(u=l,r=c);return u},on:function(e,n){return arguments.length>1?(l.on(e,n),t):l.on(e)}}}function yb(){var e,t,n,r,i=Ay(-30),a,o=1,s=1/0,c=.81;function l(n){var i,a=e.length,o=Ey(e,mb,hb).visitAfter(d);for(r=n,i=0;i<a;++i)t=e[i],o.visit(f)}function u(){if(e){var t,n=e.length,r;for(a=Array(n),t=0;t<n;++t)r=e[t],a[r.index]=+i(r,t,e)}}function d(e){var t=0,n,r,i=0,o,s,c;if(e.length){for(o=s=c=0;c<4;++c)(n=e[c])&&(r=Math.abs(n.value))&&(t+=n.value,i+=r,o+=r*n.x,s+=r*n.y);e.x=o/i,e.y=s/i}else{n=e,n.x=n.data.x,n.y=n.data.y;do t+=a[n.data.index];while(n=n.next)}e.value=t}function f(e,i,l,u){if(!e.value)return!0;var d=e.x-t.x,f=e.y-t.y,p=u-i,m=d*d+f*f;if(p*p/c<m)return m<s&&(d===0&&(d=jy(n),m+=d*d),f===0&&(f=jy(n),m+=f*f),m<o&&(m=Math.sqrt(o*m)),t.vx+=d*e.value*r/m,t.vy+=f*e.value*r/m),!0;if(!(e.length||m>=s)){(e.data!==t||e.next)&&(d===0&&(d=jy(n),m+=d*d),f===0&&(f=jy(n),m+=f*f),m<o&&(m=Math.sqrt(o*m)));do e.data!==t&&(p=a[e.data.index]*r/m,t.vx+=d*p,t.vy+=f*p);while(e=e.next)}}return l.initialize=function(t,r){e=t,n=r,u()},l.strength=function(e){return arguments.length?(i=typeof e==`function`?e:Ay(+e),u(),l):i},l.distanceMin=function(e){return arguments.length?(o=e*e,l):Math.sqrt(o)},l.distanceMax=function(e){return arguments.length?(s=e*e,l):Math.sqrt(s)},l.theta=function(e){return arguments.length?(c=e*e,l):Math.sqrt(c)},l}function bb(e){var t=Ay(.1),n,r,i;typeof e!=`function`&&(e=Ay(e==null?0:+e));function a(e){for(var t=0,a=n.length,o;t<a;++t)o=n[t],o.vx+=(i[t]-o.x)*r[t]*e}function o(){if(n){var a,o=n.length;for(r=Array(o),i=Array(o),a=0;a<o;++a)r[a]=isNaN(i[a]=+e(n[a],a,n))?0:+t(n[a],a,n)}}return a.initialize=function(e){n=e,o()},a.strength=function(e){return arguments.length?(t=typeof e==`function`?e:Ay(+e),o(),a):t},a.x=function(t){return arguments.length?(e=typeof t==`function`?t:Ay(+t),o(),a):e},a}function xb(e){var t=Ay(.1),n,r,i;typeof e!=`function`&&(e=Ay(e==null?0:+e));function a(e){for(var t=0,a=n.length,o;t<a;++t)o=n[t],o.vy+=(i[t]-o.y)*r[t]*e}function o(){if(n){var a,o=n.length;for(r=Array(o),i=Array(o),a=0;a<o;++a)r[a]=isNaN(i[a]=+e(n[a],a,n))?0:+t(n[a],a,n)}}return a.initialize=function(e){n=e,o()},a.strength=function(e){return arguments.length?(t=typeof e==`function`?e:Ay(+e),o(),a):t},a.y=function(t){return arguments.length?(e=typeof t==`function`?t:Ay(+t),o(),a):e},a}var Sb=o(((e,t)=>{function n(e){return!e||typeof e!=`object`||typeof e==`function`||Array.isArray(e)||e instanceof Set||e instanceof Map||e instanceof RegExp||e instanceof Date}function r(e,t){e||={};var i={};for(var a in t){var o=e[a],s=t[a];if(!n(s)){i[a]=r(o,s);continue}i[a]=o===void 0?s:o}return i}t.exports=r})),Cb=c(o(((e,t)=>{var n=Sb(),r=iv(),i={dimensions:[`x`,`y`],center:.5,rng:Math.random,scale:1};function a(e,t,a){if(!r(t))throw Error(`graphology-layout/random: the given graph is not a valid graphology instance.`);a=n(a,i);var o=a.dimensions;if(!Array.isArray(o)||o.length<1)throw Error(`graphology-layout/random: given dimensions are invalid.`);var s=o.length,c=a.center,l=a.rng,u=a.scale,d=(c-.5)*u;function f(e){for(var t=0;t<s;t++)e[o[t]]=l()*u+d;return e}if(!e){var p={};return t.forEachNode(function(e){p[e]=f({})}),p}t.updateEachNodeAttributes(function(e,t){return f(t),t},{attributes:o})}var o=a.bind(null,!1);o.assign=a.bind(null,!0),t.exports=o}))(),1);function wb(e){let t=e;return()=>(t=Math.imul(t,1664525)+1013904223|0,(t>>>0)%1e6/1e6)}function Tb(e,t){e.forEachNode((e,n)=>{t.set(e,{x:n.x,y:n.y})})}function Eb(e,t){let n=!0;return e.forEachNode(r=>{let i=t.get(r);if(i===void 0){n=!1;return}e.setNodeAttribute(r,`x`,i.x),e.setNodeAttribute(r,`y`,i.y)}),n}function Db(e,t=new Map){Cb.default.assign(e,{rng:wb(7),scale:80});let n=e.mapNodes((e,n)=>{let r=t.get(e);return r===void 0?{id:e,x:n.x,y:n.y}:{id:e,x:r.x,y:r.y,fx:r.x,fy:r.y}}),r=e.mapEdges((e,t,n,r)=>({source:n,target:r})),i=vb(n).force(`link`,Ly(r).id(e=>e.id).distance(145).strength(.75)).force(`charge`,yb().strength(-300).distanceMax(460)).force(`collide`,Py().radius(62)).force(`x`,bb(0).strength(.06)).force(`y`,xb(0).strength(.06)).stop();for(let e=0;e<320;e+=1)i.tick();for(let t of n)e.setNodeAttribute(t.id,`x`,t.x),e.setNodeAttribute(t.id,`y`,t.y)}function Ob(e,t){Db(e,t)}function kb(e,t){let n=t.get(e);if(n===void 0)throw TypeError(`Topology path references missing node "${e}".`);return n}function Ab(e,t,n){if(e===t||kb(t,n)===`application`)return!1;let r=kb(e,n);return r===`application`||r===`environment`||r===`service`||r===`repo`||r===`system_ref`}function jb(e,t,n){let r=new Map(t.map(e=>[e.key,e.kind]));kb(e,r);let i=new Map;for(let e of n){let t=i.get(e.source)??[];t.push({edgeKey:e.key,otherKey:e.target}),i.set(e.source,t);let n=i.get(e.target)??[];n.push({edgeKey:e.key,otherKey:e.source}),i.set(e.target,n)}let a=new Set([e]),o=new Set,s=[e];for(let t=0;t<s.length;t+=1){let n=s[t];if(n!==void 0)for(let t of i.get(n)??[])o.add(t.edgeKey),!a.has(t.otherKey)&&(a.add(t.otherKey),Ab(t.otherKey,e,r)||s.push(t.otherKey))}for(let e of n)a.has(e.source)&&a.has(e.target)&&o.add(e.key);return{nodes:a,edges:o}}function Mb(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function Nb(e){var t=Mb(e,`string`);return typeof t==`symbol`?t:t+``}function Pb(e,t,n){return(t=Nb(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Fb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Ib(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Fb(Object(n),!0).forEach(function(t){Pb(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Fb(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Lb(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function Rb(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,Nb(r.key),r)}}function zb(e,t,n){return t&&Rb(e.prototype,t),n&&Rb(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Bb(e){return Bb=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Bb(e)}function Vb(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Vb=function(){return!!e})()}function Hb(e){if(e===void 0)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return e}function Ub(e,t){if(t&&(typeof t==`object`||typeof t==`function`))return t;if(t!==void 0)throw TypeError(`Derived constructors may only return object or undefined`);return Hb(e)}function Wb(e,t,n){return t=Bb(t),Ub(e,Vb()?Reflect.construct(t,n||[],Bb(e).constructor):t.apply(e,n))}function Gb(e,t){return Gb=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Gb(e,t)}function Kb(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function`);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Gb(e,t)}function qb(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Jb(e){if(Array.isArray(e))return qb(e)}function Yb(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function Xb(e,t){if(e){if(typeof e==`string`)return qb(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?qb(e,t):void 0}}function Zb(){throw TypeError(`Invalid attempt to spread non-iterable instance.
313
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Qb(e){return Jb(e)||Yb(e)||Xb(e)||Zb()}function $b(e,t,n,r){return{x:(1-e)**2*t.x+2*(1-e)*e*n.x+e**2*r.x,y:(1-e)**2*t.y+2*(1-e)*e*n.y+e**2*r.y}}function ex(e,t,n){for(var r=20,i=0,a=e,o=0;o<r;o++){var s=$b((o+1)/r,e,t,n);i+=Math.sqrt((a.x-s.x)**2+(a.y-s.y)**2),a=s}return i}function tx(e){var t=e.curvatureAttribute,n=e.defaultCurvature,r=e.keepLabelUpright,i=r===void 0||r;return function(e,r,a,o,s){var c=s.edgeLabelSize,l=r[t]||n,u=s.edgeLabelFont,d=s.edgeLabelWeight,f=s.edgeLabelColor.attribute?r[s.edgeLabelColor.attribute]||s.edgeLabelColor.color||`#000`:s.edgeLabelColor.color,p=r.label;if(p){e.fillStyle=f,e.font=`${d} ${c}px ${u}`;var m=!i||a.x<o.x,h=m?a.x:o.x,g=m?a.y:o.y,_=m?o.x:a.x,v=m?o.y:a.y,y=(h+_)/2,b=(g+v)/2,x=_-h,S=v-g,C=Math.sqrt(x**2+S**2),w=m?1:-1,T=y+S*l*w,E=b-x*l*w,ee=r.size*.7+5,te={x:E-g,y:-(T-h)},D=Math.sqrt(te.x**2+te.y**2),O={x:v-E,y:-(_-T)},k=Math.sqrt(O.x**2+O.y**2);h+=ee*te.x/D,g+=ee*te.y/D,_+=ee*O.x/k,v+=ee*O.y/k,T+=ee*S/C,E-=ee*x/C;var A={x:T,y:E},ne={x:h,y:g},re={x:_,y:v},ie=ex(ne,A,re);if(!(ie<a.size+o.size)){var ae=e.measureText(p).width,oe=ie-a.size-o.size;if(ae>oe){var se=`…`;for(p+=se,ae=e.measureText(p).width;ae>oe&&p.length>1;)p=p.slice(0,-2)+se,ae=e.measureText(p).width;if(p.length<4)return}for(var ce={},le=0,ue=p.length;le<ue;le++){var de=p[le];ce[de]||(ce[de]=e.measureText(de).width*(1+l*.35))}for(var fe=.5-ae/ie/2,pe=0,me=p.length;pe<me;pe++){var he=p[pe],ge=$b(fe,ne,A,re),_e=2*(1-fe)*(T-h)+2*fe*(_-T),ve=2*(1-fe)*(E-g)+2*fe*(v-E),ye=Math.atan2(ve,_e);e.save(),e.translate(ge.x,ge.y),e.rotate(ye),e.fillText(he,0,0),e.restore(),fe+=ce[he]/ie}}}}}function nx(e){var t=e.arrowHead,n=t?.extremity===`target`||t?.extremity===`both`,r=t?.extremity===`source`||t?.extremity===`both`;return`
314
+ precision highp float;
315
+
316
+ varying vec4 v_color;
317
+ varying float v_thickness;
318
+ varying float v_feather;
319
+ varying vec2 v_cpA;
320
+ varying vec2 v_cpB;
321
+ varying vec2 v_cpC;
322
+ ${n?`
323
+ varying float v_targetSize;
324
+ varying vec2 v_targetPoint;`:``}
325
+ ${r?`
326
+ varying float v_sourceSize;
327
+ varying vec2 v_sourcePoint;`:``}
328
+ ${t?`
329
+ uniform float u_lengthToThicknessRatio;
330
+ uniform float u_widenessToThicknessRatio;`:``}
331
+
332
+ float det(vec2 a, vec2 b) {
333
+ return a.x * b.y - b.x * a.y;
334
+ }
335
+
336
+ vec2 getDistanceVector(vec2 b0, vec2 b1, vec2 b2) {
337
+ float a = det(b0, b2), b = 2.0 * det(b1, b0), d = 2.0 * det(b2, b1);
338
+ float f = b * d - a * a;
339
+ vec2 d21 = b2 - b1, d10 = b1 - b0, d20 = b2 - b0;
340
+ vec2 gf = 2.0 * (b * d21 + d * d10 + a * d20);
341
+ gf = vec2(gf.y, -gf.x);
342
+ vec2 pp = -f * gf / dot(gf, gf);
343
+ vec2 d0p = b0 - pp;
344
+ float ap = det(d0p, d20), bp = 2.0 * det(d10, d0p);
345
+ float t = clamp((ap + bp) / (2.0 * a + b + d), 0.0, 1.0);
346
+ return mix(mix(b0, b1, t), mix(b1, b2, t), t);
347
+ }
348
+
349
+ float distToQuadraticBezierCurve(vec2 p, vec2 b0, vec2 b1, vec2 b2) {
350
+ return length(getDistanceVector(b0 - p, b1 - p, b2 - p));
351
+ }
352
+
353
+ const vec4 transparent = vec4(0.0, 0.0, 0.0, 0.0);
354
+
355
+ void main(void) {
356
+ float dist = distToQuadraticBezierCurve(gl_FragCoord.xy, v_cpA, v_cpB, v_cpC);
357
+ float thickness = v_thickness;
358
+ ${n?`
359
+ float distToTarget = length(gl_FragCoord.xy - v_targetPoint);
360
+ float targetArrowLength = v_targetSize + thickness * u_lengthToThicknessRatio;
361
+ if (distToTarget < targetArrowLength) {
362
+ thickness = (distToTarget - v_targetSize) / (targetArrowLength - v_targetSize) * u_widenessToThicknessRatio * thickness;
363
+ }`:``}
364
+ ${r?`
365
+ float distToSource = length(gl_FragCoord.xy - v_sourcePoint);
366
+ float sourceArrowLength = v_sourceSize + thickness * u_lengthToThicknessRatio;
367
+ if (distToSource < sourceArrowLength) {
368
+ thickness = (distToSource - v_sourceSize) / (sourceArrowLength - v_sourceSize) * u_widenessToThicknessRatio * thickness;
369
+ }`:``}
370
+
371
+ float halfThickness = thickness / 2.0;
372
+ if (dist < halfThickness) {
373
+ #ifdef PICKING_MODE
374
+ gl_FragColor = v_color;
375
+ #else
376
+ float t = smoothstep(
377
+ halfThickness - v_feather,
378
+ halfThickness,
379
+ dist
380
+ );
381
+
382
+ gl_FragColor = mix(v_color, transparent, t);
383
+ #endif
384
+ } else {
385
+ gl_FragColor = transparent;
386
+ }
387
+ }
388
+ `}function rx(e){var t=e.arrowHead,n=t?.extremity===`target`||t?.extremity===`both`,r=t?.extremity===`source`||t?.extremity===`both`;return`
389
+ attribute vec4 a_id;
390
+ attribute vec4 a_color;
391
+ attribute float a_direction;
392
+ attribute float a_thickness;
393
+ attribute vec2 a_source;
394
+ attribute vec2 a_target;
395
+ attribute float a_current;
396
+ attribute float a_curvature;
397
+ ${n?`attribute float a_targetSize;
398
+ `:``}
399
+ ${r?`attribute float a_sourceSize;
400
+ `:``}
401
+
402
+ uniform mat3 u_matrix;
403
+ uniform float u_sizeRatio;
404
+ uniform float u_pixelRatio;
405
+ uniform vec2 u_dimensions;
406
+ uniform float u_minEdgeThickness;
407
+ uniform float u_feather;
408
+
409
+ varying vec4 v_color;
410
+ varying float v_thickness;
411
+ varying float v_feather;
412
+ varying vec2 v_cpA;
413
+ varying vec2 v_cpB;
414
+ varying vec2 v_cpC;
415
+ ${n?`
416
+ varying float v_targetSize;
417
+ varying vec2 v_targetPoint;`:``}
418
+ ${r?`
419
+ varying float v_sourceSize;
420
+ varying vec2 v_sourcePoint;`:``}
421
+ ${t?`
422
+ uniform float u_widenessToThicknessRatio;`:``}
423
+
424
+ const float bias = 255.0 / 254.0;
425
+ const float epsilon = 0.7;
426
+
427
+ vec2 clipspaceToViewport(vec2 pos, vec2 dimensions) {
428
+ return vec2(
429
+ (pos.x + 1.0) * dimensions.x / 2.0,
430
+ (pos.y + 1.0) * dimensions.y / 2.0
431
+ );
432
+ }
433
+
434
+ vec2 viewportToClipspace(vec2 pos, vec2 dimensions) {
435
+ return vec2(
436
+ pos.x / dimensions.x * 2.0 - 1.0,
437
+ pos.y / dimensions.y * 2.0 - 1.0
438
+ );
439
+ }
440
+
441
+ void main() {
442
+ float minThickness = u_minEdgeThickness;
443
+
444
+ // Selecting the correct position
445
+ // Branchless "position = a_source if a_current == 1.0 else a_target"
446
+ vec2 position = a_source * max(0.0, a_current) + a_target * max(0.0, 1.0 - a_current);
447
+ position = (u_matrix * vec3(position, 1)).xy;
448
+
449
+ vec2 source = (u_matrix * vec3(a_source, 1)).xy;
450
+ vec2 target = (u_matrix * vec3(a_target, 1)).xy;
451
+
452
+ vec2 viewportPosition = clipspaceToViewport(position, u_dimensions);
453
+ vec2 viewportSource = clipspaceToViewport(source, u_dimensions);
454
+ vec2 viewportTarget = clipspaceToViewport(target, u_dimensions);
455
+
456
+ vec2 delta = viewportTarget.xy - viewportSource.xy;
457
+ float len = length(delta);
458
+ vec2 normal = vec2(-delta.y, delta.x) * a_direction;
459
+ vec2 unitNormal = normal / len;
460
+ float boundingBoxThickness = len * a_curvature;
461
+
462
+ float curveThickness = max(minThickness, a_thickness / u_sizeRatio);
463
+ v_thickness = curveThickness * u_pixelRatio;
464
+ v_feather = u_feather;
465
+
466
+ v_cpA = viewportSource;
467
+ v_cpB = 0.5 * (viewportSource + viewportTarget) + unitNormal * a_direction * boundingBoxThickness;
468
+ v_cpC = viewportTarget;
469
+
470
+ vec2 viewportOffsetPosition = (
471
+ viewportPosition +
472
+ unitNormal * (boundingBoxThickness / 2.0 + sign(boundingBoxThickness) * (${t?`curveThickness * u_widenessToThicknessRatio`:`curveThickness`} + epsilon)) *
473
+ max(0.0, a_direction) // NOTE: cutting the bounding box in half to avoid overdraw
474
+ );
475
+
476
+ position = viewportToClipspace(viewportOffsetPosition, u_dimensions);
477
+ gl_Position = vec4(position, 0, 1);
478
+
479
+ ${n?`
480
+ v_targetSize = a_targetSize * u_pixelRatio / u_sizeRatio;
481
+ v_targetPoint = viewportTarget;
482
+ `:``}
483
+ ${r?`
484
+ v_sourceSize = a_sourceSize * u_pixelRatio / u_sizeRatio;
485
+ v_sourcePoint = viewportSource;
486
+ `:``}
487
+
488
+ #ifdef PICKING_MODE
489
+ // For picking mode, we use the ID as the color:
490
+ v_color = a_id;
491
+ #else
492
+ // For normal mode, we use the color:
493
+ v_color = a_color;
494
+ #endif
495
+
496
+ v_color.a *= bias;
497
+ }
498
+ `}var ix=.25,ax={arrowHead:null,curvatureAttribute:`curvature`,defaultCurvature:ix},ox=WebGLRenderingContext,sx=ox.UNSIGNED_BYTE,cx=ox.FLOAT;function lx(e){var t=Ib(Ib({},ax),e||{}),n=t,r=n.arrowHead,i=n.curvatureAttribute,a=n.drawLabel,o=r?.extremity===`target`||r?.extremity===`both`,s=r?.extremity===`source`||r?.extremity===`both`,c=[`u_matrix`,`u_sizeRatio`,`u_dimensions`,`u_pixelRatio`,`u_feather`,`u_minEdgeThickness`].concat(Qb(r?[`u_lengthToThicknessRatio`,`u_widenessToThicknessRatio`]:[]));return function(e){Kb(n,e);function n(){var e;Lb(this,n);var r=[...arguments];return e=Wb(this,n,[].concat(r)),Pb(Hb(e),`drawLabel`,a||tx(t)),e}return zb(n,[{key:`getDefinition`,value:function(){return{VERTICES:6,VERTEX_SHADER_SOURCE:rx(t),FRAGMENT_SHADER_SOURCE:nx(t),METHOD:WebGLRenderingContext.TRIANGLES,UNIFORMS:c,ATTRIBUTES:[{name:`a_source`,size:2,type:cx},{name:`a_target`,size:2,type:cx}].concat(Qb(o?[{name:`a_targetSize`,size:1,type:cx}]:[]),Qb(s?[{name:`a_sourceSize`,size:1,type:cx}]:[]),[{name:`a_thickness`,size:1,type:cx},{name:`a_curvature`,size:1,type:cx},{name:`a_color`,size:4,type:sx,normalized:!0},{name:`a_id`,size:4,type:sx,normalized:!0}]),CONSTANT_ATTRIBUTES:[{name:`a_current`,size:1,type:cx},{name:`a_direction`,size:1,type:cx}],CONSTANT_DATA:[[0,1],[0,-1],[1,1],[0,-1],[1,1],[1,-1]]}}},{key:`processVisibleItem`,value:function(e,t,n,r,a){var c=a.size||1,l=n.x,u=n.y,d=r.x,f=r.y,p=Qg(a.color),m=a[i]??ix,h=this.array;h[t++]=l,h[t++]=u,h[t++]=d,h[t++]=f,o&&(h[t++]=r.size),s&&(h[t++]=n.size),h[t++]=c,h[t++]=m,h[t++]=p,h[t++]=e}},{key:`setUniforms`,value:function(e,t){var n=t.gl,i=t.uniformLocations,a=i.u_matrix,o=i.u_pixelRatio,s=i.u_feather,c=i.u_sizeRatio,l=i.u_dimensions,u=i.u_minEdgeThickness;if(n.uniformMatrix3fv(a,!1,e.matrix),n.uniform1f(o,e.pixelRatio),n.uniform1f(c,e.sizeRatio),n.uniform1f(s,e.antiAliasingFeather),n.uniform2f(l,e.width*e.pixelRatio,e.height*e.pixelRatio),n.uniform1f(u,e.minEdgeThickness),r){var d=i.u_lengthToThicknessRatio,f=i.u_widenessToThicknessRatio;n.uniform1f(d,r.lengthToThicknessRatio),n.uniform1f(f,r.widenessToThicknessRatio)}}}]),n}(x_)}lx();var ux=lx({arrowHead:z_});lx({arrowHead:Ib(Ib({},z_),{},{extremity:`both`})});function dx(e){if(Array.isArray(e))return e}function fx(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function px(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function mx(e,t){if(e){if(typeof e==`string`)return px(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?px(e,t):void 0}}function hx(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
499
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function gx(e,t){return dx(e)||fx(e,t)||mx(e,t)||hx()}function _x(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function vx(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function yx(e){var t=vx(e,`string`);return typeof t==`symbol`?t:t+``}function bx(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,yx(r.key),r)}}function xx(e,t,n){return t&&bx(e.prototype,t),n&&bx(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Sx(e){return Sx=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Sx(e)}function Cx(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Cx=function(){return!!e})()}function wx(e){if(e===void 0)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return e}function Tx(e,t){if(t&&(typeof t==`object`||typeof t==`function`))return t;if(t!==void 0)throw TypeError(`Derived constructors may only return object or undefined`);return wx(e)}function Ex(e,t,n){return t=Sx(t),Tx(e,Cx()?Reflect.construct(t,n||[],Sx(e).constructor):t.apply(e,n))}function Dx(e,t){return Dx=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Dx(e,t)}function Ox(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function`);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Dx(e,t)}function kx(e,t,n){return(t=yx(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ax(e){if(Array.isArray(e))return px(e)}function jx(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function Mx(){throw TypeError(`Invalid attempt to spread non-iterable instance.
500
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Nx(e){return Ax(e)||jx(e)||mx(e)||Mx()}function Px(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Fx(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Px(Object(n),!0).forEach(function(t){kx(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Px(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Ix=`relative`,Lx={drawLabel:void 0,drawHover:void 0,borders:[{size:{value:.1},color:{attribute:`borderColor`}},{size:{fill:!0},color:{attribute:`color`}}]},Rx=`#000000`;function zx(e){var t=e.borders,n=h_(t.filter(function(e){return`fill`in e.size}).length);return`
501
+ precision highp float;
502
+
503
+ varying vec2 v_diffVector;
504
+ varying float v_radius;
505
+
506
+ #ifdef PICKING_MODE
507
+ varying vec4 v_color;
508
+ #else
509
+ // For normal mode, we use the border colors defined in the program:
510
+ ${t.flatMap(function(e,t){return`attribute`in e.size?[`varying float v_borderSize_${t+1};`]:[]}).join(`
511
+ `)}
512
+ ${t.flatMap(function(e,t){var n=e.color;return`attribute`in n?[`varying vec4 v_borderColor_${t+1};`]:`value`in n?[`uniform vec4 u_borderColor_${t+1};`]:[]}).join(`
513
+ `)}
514
+ #endif
515
+
516
+ uniform float u_correctionRatio;
517
+
518
+ const float bias = 255.0 / 254.0;
519
+ const vec4 transparent = vec4(0.0, 0.0, 0.0, 0.0);
520
+
521
+ void main(void) {
522
+ float dist = length(v_diffVector);
523
+ float aaBorder = 2.0 * u_correctionRatio;
524
+ float v_borderSize_0 = v_radius;
525
+ vec4 v_borderColor_0 = transparent;
526
+
527
+ // No antialiasing for picking mode:
528
+ #ifdef PICKING_MODE
529
+ if (dist > v_radius)
530
+ gl_FragColor = transparent;
531
+ else {
532
+ gl_FragColor = v_color;
533
+ gl_FragColor.a *= bias;
534
+ }
535
+ #else
536
+ // Sizes:
537
+ ${t.flatMap(function(e,t){var n=e.size;if(`fill`in n)return[];n=n;var r=`attribute`in n?`v_borderSize_${t+1}`:h_(n.value),i=(n.mode||Ix)===`pixels`?`u_correctionRatio`:`v_radius`;return[` float borderSize_${t+1} = ${i} * ${r};`]}).join(`
538
+ `)}
539
+ // Now, let's split the remaining space between "fill" borders:
540
+ float fillBorderSize = (v_radius - (${t.flatMap(function(e,t){return`fill`in e.size?[]:[`borderSize_${t+1}`]}).join(` + `)}) ) / ${n};
541
+ ${t.flatMap(function(e,t){return`fill`in e.size?[` float borderSize_${t+1} = fillBorderSize;`]:[]}).join(`
542
+ `)}
543
+
544
+ // Finally, normalize all border sizes, to start from the full size and to end with the smallest:
545
+ float adjustedBorderSize_0 = v_radius;
546
+ ${t.map(function(e,t){return` float adjustedBorderSize_${t+1} = adjustedBorderSize_${t} - borderSize_${t+1};`}).join(`
547
+ `)}
548
+
549
+ // Colors:
550
+ vec4 borderColor_0 = transparent;
551
+ ${t.map(function(e,t){var n=e.color,r=[];return`attribute`in n?r.push(` vec4 borderColor_${t+1} = v_borderColor_${t+1};`):`transparent`in n?r.push(` vec4 borderColor_${t+1} = vec4(0.0, 0.0, 0.0, 0.0);`):r.push(` vec4 borderColor_${t+1} = u_borderColor_${t+1};`),r.push(` borderColor_${t+1}.a *= bias;`),r.push(` if (borderSize_${t+1} <= 1.0 * u_correctionRatio) { borderColor_${t+1} = borderColor_${t}; }`),r.join(`
552
+ `)}).join(`
553
+ `)}
554
+ if (dist > adjustedBorderSize_0) {
555
+ gl_FragColor = borderColor_0;
556
+ } else ${t.map(function(e,t){return`if (dist > adjustedBorderSize_${t} - aaBorder) {
557
+ gl_FragColor = mix(borderColor_${t+1}, borderColor_${t}, (dist - adjustedBorderSize_${t} + aaBorder) / aaBorder);
558
+ } else if (dist > adjustedBorderSize_${t+1}) {
559
+ gl_FragColor = borderColor_${t+1};
560
+ } else `}).join(``)} { /* Nothing to add here */ }
561
+ #endif
562
+ }
563
+ `}function Bx(e){var t=e.borders;return`
564
+ attribute vec2 a_position;
565
+ attribute float a_size;
566
+ attribute float a_angle;
567
+
568
+ uniform mat3 u_matrix;
569
+ uniform float u_sizeRatio;
570
+ uniform float u_correctionRatio;
571
+
572
+ varying vec2 v_diffVector;
573
+ varying float v_radius;
574
+
575
+ #ifdef PICKING_MODE
576
+ attribute vec4 a_id;
577
+ varying vec4 v_color;
578
+ #else
579
+ ${t.flatMap(function(e,t){return`attribute`in e.size?[`attribute float a_borderSize_${t+1};`,`varying float v_borderSize_${t+1};`]:[]}).join(`
580
+ `)}
581
+ ${t.flatMap(function(e,t){return`attribute`in e.color?[`attribute vec4 a_borderColor_${t+1};`,`varying vec4 v_borderColor_${t+1};`]:[]}).join(`
582
+ `)}
583
+ #endif
584
+
585
+ const float bias = 255.0 / 254.0;
586
+ const vec4 transparent = vec4(0.0, 0.0, 0.0, 0.0);
587
+
588
+ void main() {
589
+ float size = a_size * u_correctionRatio / u_sizeRatio * 4.0;
590
+ vec2 diffVector = size * vec2(cos(a_angle), sin(a_angle));
591
+ vec2 position = a_position + diffVector;
592
+ gl_Position = vec4(
593
+ (u_matrix * vec3(position, 1)).xy,
594
+ 0,
595
+ 1
596
+ );
597
+
598
+ v_radius = size / 2.0;
599
+ v_diffVector = diffVector;
600
+
601
+ #ifdef PICKING_MODE
602
+ v_color = a_id;
603
+ #else
604
+ ${t.flatMap(function(e,t){return`attribute`in e.size?[` v_borderSize_${t+1} = a_borderSize_${t+1};`]:[]}).join(`
605
+ `)}
606
+ ${t.flatMap(function(e,t){return`attribute`in e.color?[` v_borderColor_${t+1} = a_borderColor_${t+1};`]:[]}).join(`
607
+ `)}
608
+ #endif
609
+ }
610
+ `}var Vx=WebGLRenderingContext,Hx=Vx.UNSIGNED_BYTE,Ux=Vx.FLOAT;function Wx(e){var t,n=Fx(Fx({},Lx),e||{}),r=n.borders,i=n.drawLabel,a=n.drawHover,o=[`u_sizeRatio`,`u_correctionRatio`,`u_matrix`].concat(Nx(r.flatMap(function(e,t){return`value`in e.color?[`u_borderColor_${t+1}`]:[]})));return t=function(e){Ox(t,e);function t(){var e;_x(this,t);var n=[...arguments];return e=Ex(this,t,[].concat(n)),kx(wx(e),`drawLabel`,i),kx(wx(e),`drawHover`,a),e}return xx(t,[{key:`getDefinition`,value:function(){return{VERTICES:3,VERTEX_SHADER_SOURCE:Bx(n),FRAGMENT_SHADER_SOURCE:zx(n),METHOD:WebGLRenderingContext.TRIANGLES,UNIFORMS:o,ATTRIBUTES:[{name:`a_position`,size:2,type:Ux},{name:`a_id`,size:4,type:Hx,normalized:!0},{name:`a_size`,size:1,type:Ux}].concat(Nx(r.flatMap(function(e,t){return`attribute`in e.color?[{name:`a_borderColor_${t+1}`,size:4,type:Hx,normalized:!0}]:[]})),Nx(r.flatMap(function(e,t){return`attribute`in e.size?[{name:`a_borderSize_${t+1}`,size:1,type:Ux}]:[]}))),CONSTANT_ATTRIBUTES:[{name:`a_angle`,size:1,type:Ux}],CONSTANT_DATA:[[t.ANGLE_1],[t.ANGLE_2],[t.ANGLE_3]]}}},{key:`processVisibleItem`,value:function(e,t,n){var i=this.array;i[t++]=n.x,i[t++]=n.y,i[t++]=e,i[t++]=n.size,r.forEach(function(e){var r=e.color;`attribute`in r&&(i[t++]=Qg(n[r.attribute]||r.defaultValue||Rx))}),r.forEach(function(e){var r=e.size;`attribute`in r&&(i[t++]=n[r.attribute]||r.defaultValue)})}},{key:`setUniforms`,value:function(e,t){var n=t.gl,i=t.uniformLocations,a=i.u_sizeRatio,o=i.u_correctionRatio,s=i.u_matrix;n.uniform1f(o,e.correctionRatio),n.uniform1f(a,e.sizeRatio),n.uniformMatrix3fv(s,!1,e.matrix),r.forEach(function(e,t){var r=e.color;if(`value`in r){var a=i[`u_borderColor_${t+1}`],o=gx($g(r.value),4),s=o[0],c=o[1],l=o[2],u=o[3];n.uniform4f(a,s/255,c/255,l/255,u/255)}})}}]),t}(y_),kx(t,`ANGLE_1`,0),kx(t,`ANGLE_2`,2*Math.PI/3),kx(t,`ANGLE_3`,4*Math.PI/3),t}var Gx=Wx();function Kx(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function qx(e){if(Array.isArray(e))return Kx(e)}function Jx(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function Yx(e,t){if(e){if(typeof e==`string`)return Kx(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Kx(e,t):void 0}}function Xx(){throw TypeError(`Invalid attempt to spread non-iterable instance.
611
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Zx(e){return qx(e)||Jx(e)||Yx(e)||Xx()}function Qx(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function $x(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function eS(e){var t=$x(e,`string`);return typeof t==`symbol`?t:t+``}function tS(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,eS(r.key),r)}}function nS(e,t,n){return t&&tS(e.prototype,t),n&&tS(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function rS(e){return rS=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},rS(e)}function iS(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(iS=function(){return!!e})()}function aS(e){if(e===void 0)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return e}function oS(e,t){if(t&&(typeof t==`object`||typeof t==`function`))return t;if(t!==void 0)throw TypeError(`Derived constructors may only return object or undefined`);return aS(e)}function sS(e,t,n){return t=rS(t),oS(e,iS()?Reflect.construct(t,n||[],rS(e).constructor):t.apply(e,n))}function cS(e,t){for(;!{}.hasOwnProperty.call(e,t)&&(e=rS(e))!==null;);return e}function lS(){return lS=typeof Reflect<`u`&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=cS(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},lS.apply(null,arguments)}function uS(e,t,n,r){var i=lS(rS(1&r?e.prototype:e),t,n);return 2&r&&typeof i==`function`?function(e){return i.apply(n,e)}:i}function dS(e,t){return dS=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},dS(e,t)}function fS(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function`);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&dS(e,t)}function pS(e,t,n){return(t=eS(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function mS(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.includes(r))continue;n[r]=e[r]}return n}function hS(e,t){if(e==null)return{};var n,r,i=mS(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.includes(n)||{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function gS(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function _S(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?gS(Object(n),!0).forEach(function(t){pS(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):gS(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function vS(e){var t=e.texturesCount;return`
612
+ precision highp float;
613
+
614
+ varying vec4 v_color;
615
+ varying vec2 v_diffVector;
616
+ varying float v_radius;
617
+ varying vec4 v_texture;
618
+ varying float v_textureIndex;
619
+
620
+ uniform sampler2D u_atlas[${t}];
621
+ uniform float u_correctionRatio;
622
+ uniform float u_cameraAngle;
623
+ uniform float u_percentagePadding;
624
+ uniform bool u_colorizeImages;
625
+ uniform bool u_keepWithinCircle;
626
+
627
+ const vec4 transparent = vec4(0.0, 0.0, 0.0, 0.0);
628
+
629
+ const float radius = 0.5;
630
+
631
+ void main(void) {
632
+ float border = 2.0 * u_correctionRatio;
633
+ float dist = length(v_diffVector);
634
+ vec4 color = gl_FragColor;
635
+
636
+ float c = cos(-u_cameraAngle);
637
+ float s = sin(-u_cameraAngle);
638
+ vec2 diffVector = mat2(c, s, -s, c) * (v_diffVector);
639
+
640
+ // No antialiasing for picking mode:
641
+ #ifdef PICKING_MODE
642
+ border = 0.0;
643
+ color = v_color;
644
+
645
+ #else
646
+ // First case: No image to display
647
+ if (v_texture.w <= 0.0) {
648
+ if (!u_colorizeImages) {
649
+ color = v_color;
650
+ }
651
+ }
652
+
653
+ // Second case: Image loaded into the texture
654
+ else {
655
+ float paddingRatio = 1.0 + 2.0 * u_percentagePadding;
656
+ float coef = u_keepWithinCircle ? 1.0 : ${Math.SQRT2};
657
+ vec2 coordinateInTexture = diffVector * vec2(paddingRatio, -paddingRatio) / v_radius / 2.0 * coef + vec2(0.5, 0.5);
658
+ int index = int(v_textureIndex + 0.5); // +0.5 avoid rounding errors
659
+
660
+ bool noTextureFound = false;
661
+ vec4 texel;
662
+
663
+ ${Zx(Array(t)).map(function(e,t){return`if (index == ${t}) texel = texture2D(u_atlas[${t}], (v_texture.xy + coordinateInTexture * v_texture.zw), -1.0);`}).join(`
664
+ else `)+`else {
665
+ texel = texture2D(u_atlas[0], (v_texture.xy + coordinateInTexture * v_texture.zw), -1.0);
666
+ noTextureFound = true;
667
+ }`}
668
+
669
+ if (noTextureFound) {
670
+ color = v_color;
671
+ } else {
672
+ // Colorize all visible image pixels:
673
+ if (u_colorizeImages) {
674
+ color = mix(gl_FragColor, v_color, texel.a);
675
+ }
676
+
677
+ // Colorize background pixels, keep image pixel colors:
678
+ else {
679
+ color = vec4(mix(v_color, texel, texel.a).rgb, max(texel.a, v_color.a));
680
+ }
681
+
682
+ // Erase pixels "in the padding":
683
+ if (abs(diffVector.x) > v_radius / paddingRatio || abs(diffVector.y) > v_radius / paddingRatio) {
684
+ color = u_colorizeImages ? gl_FragColor : v_color;
685
+ }
686
+ }
687
+ }
688
+ #endif
689
+
690
+ // Crop in a circle when u_keepWithinCircle is truthy:
691
+ if (u_keepWithinCircle) {
692
+ if (dist < v_radius - border) {
693
+ gl_FragColor = color;
694
+ } else if (dist < v_radius) {
695
+ gl_FragColor = mix(transparent, color, (v_radius - dist) / border);
696
+ }
697
+ }
698
+
699
+ // Crop in a square else:
700
+ else {
701
+ float squareHalfSize = v_radius * ${Math.SQRT1_2*Math.cos(Math.PI/12)};
702
+ if (abs(diffVector.x) > squareHalfSize || abs(diffVector.y) > squareHalfSize) {
703
+ gl_FragColor = transparent;
704
+ } else {
705
+ gl_FragColor = color;
706
+ }
707
+ }
708
+ }
709
+ `}var yS=`
710
+ attribute vec4 a_id;
711
+ attribute vec4 a_color;
712
+ attribute vec2 a_position;
713
+ attribute float a_size;
714
+ attribute float a_angle;
715
+ attribute vec4 a_texture;
716
+ attribute float a_textureIndex;
717
+
718
+ uniform mat3 u_matrix;
719
+ uniform float u_sizeRatio;
720
+ uniform float u_correctionRatio;
721
+
722
+ varying vec4 v_color;
723
+ varying vec2 v_diffVector;
724
+ varying float v_radius;
725
+ varying vec4 v_texture;
726
+ varying float v_textureIndex;
727
+
728
+ const float bias = 255.0 / 254.0;
729
+ const float marginRatio = 1.05;
730
+
731
+ void main() {
732
+ float size = a_size * u_correctionRatio / u_sizeRatio * 4.0;
733
+ vec2 diffVector = size * vec2(cos(a_angle), sin(a_angle));
734
+ vec2 position = a_position + diffVector * marginRatio;
735
+ gl_Position = vec4(
736
+ (u_matrix * vec3(position, 1)).xy,
737
+ 0,
738
+ 1
739
+ );
740
+
741
+ v_diffVector = diffVector;
742
+ v_radius = size / 2.0 / marginRatio;
743
+
744
+ #ifdef PICKING_MODE
745
+ // For picking mode, we use the ID as the color:
746
+ v_color = a_id;
747
+ #else
748
+ // For normal mode, we use the color:
749
+ v_color = a_color;
750
+
751
+ // Pass the texture coordinates:
752
+ v_textureIndex = a_textureIndex;
753
+ v_texture = a_texture;
754
+ #endif
755
+
756
+ v_color.a *= bias;
757
+ }
758
+ `;function bS(){bS=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},a=typeof Symbol==`function`?Symbol:{},o=a.iterator||`@@iterator`,s=a.asyncIterator||`@@asyncIterator`,c=a.toStringTag||`@@toStringTag`;function l(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},``)}catch{l=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var a=t&&t.prototype instanceof _?t:_,o=Object.create(a.prototype);return i(o,`_invoke`,{value:E(e,n,new O(r||[]))}),o}function d(e,t,n){try{return{type:`normal`,arg:e.call(t,n)}}catch(e){return{type:`throw`,arg:e}}}t.wrap=u;var f=`suspendedStart`,p=`suspendedYield`,m=`executing`,h=`completed`,g={};function _(){}function v(){}function y(){}var b={};l(b,o,function(){return this});var x=Object.getPrototypeOf,S=x&&x(x(k([])));S&&S!==n&&r.call(S,o)&&(b=S);var C=y.prototype=_.prototype=Object.create(b);function w(e){[`next`,`throw`,`return`].forEach(function(t){l(e,t,function(e){return this._invoke(t,e)})})}function T(e,t){function n(i,a,o,s){var c=d(e[i],e,a);if(c.type!==`throw`){var l=c.arg,u=l.value;return u&&typeof u==`object`&&r.call(u,`__await`)?t.resolve(u.__await).then(function(e){n(`next`,e,o,s)},function(e){n(`throw`,e,o,s)}):t.resolve(u).then(function(e){l.value=e,o(l)},function(e){return n(`throw`,e,o,s)})}s(c.arg)}var a;i(this,`_invoke`,{value:function(e,r){function i(){return new t(function(t,i){n(e,r,t,i)})}return a=a?a.then(i,i):i()}})}function E(t,n,r){var i=f;return function(a,o){if(i===m)throw Error(`Generator is already running`);if(i===h){if(a===`throw`)throw o;return{value:e,done:!0}}for(r.method=a,r.arg=o;;){var s=r.delegate;if(s){var c=ee(s,r);if(c){if(c===g)continue;return c}}if(r.method===`next`)r.sent=r._sent=r.arg;else if(r.method===`throw`){if(i===f)throw i=h,r.arg;r.dispatchException(r.arg)}else r.method===`return`&&r.abrupt(`return`,r.arg);i=m;var l=d(t,n,r);if(l.type===`normal`){if(i=r.done?h:p,l.arg===g)continue;return{value:l.arg,done:r.done}}l.type===`throw`&&(i=h,r.method=`throw`,r.arg=l.arg)}}}function ee(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,r===`throw`&&t.iterator.return&&(n.method=`return`,n.arg=e,ee(t,n),n.method===`throw`)||r!==`return`&&(n.method=`throw`,n.arg=TypeError(`The iterator does not provide a '`+r+`' method`)),g;var a=d(i,t.iterator,n.arg);if(a.type===`throw`)return n.method=`throw`,n.arg=a.arg,n.delegate=null,g;var o=a.arg;return o?o.done?(n[t.resultName]=o.value,n.next=t.nextLoc,n.method!==`return`&&(n.method=`next`,n.arg=e),n.delegate=null,g):o:(n.method=`throw`,n.arg=TypeError(`iterator result is not an object`),n.delegate=null,g)}function te(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function D(e){var t=e.completion||{};t.type=`normal`,delete t.arg,e.completion=t}function O(e){this.tryEntries=[{tryLoc:`root`}],e.forEach(te,this),this.reset(!0)}function k(t){if(t||t===``){var n=t[o];if(n)return n.call(t);if(typeof t.next==`function`)return t;if(!isNaN(t.length)){var i=-1,a=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return a.next=a}}throw TypeError(typeof t+` is not iterable`)}return v.prototype=y,i(C,`constructor`,{value:y,configurable:!0}),i(y,`constructor`,{value:v,configurable:!0}),v.displayName=l(y,c,`GeneratorFunction`),t.isGeneratorFunction=function(e){var t=typeof e==`function`&&e.constructor;return!!t&&(t===v||(t.displayName||t.name)===`GeneratorFunction`)},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,y):(e.__proto__=y,l(e,c,`GeneratorFunction`)),e.prototype=Object.create(C),e},t.awrap=function(e){return{__await:e}},w(T.prototype),l(T.prototype,s,function(){return this}),t.AsyncIterator=T,t.async=function(e,n,r,i,a){a===void 0&&(a=Promise);var o=new T(u(e,n,r,i),a);return t.isGeneratorFunction(n)?o:o.next().then(function(e){return e.done?e.value:o.next()})},w(C),l(C,c,`Generator`),l(C,o,function(){return this}),l(C,`toString`,function(){return`[object Generator]`}),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=k,O.prototype={constructor:O,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method=`next`,this.arg=e,this.tryEntries.forEach(D),!t)for(var n in this)n.charAt(0)===`t`&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if(e.type===`throw`)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return s.type=`throw`,s.arg=t,n.next=r,i&&(n.method=`next`,n.arg=e),!!i}for(var a=this.tryEntries.length-1;a>=0;--a){var o=this.tryEntries[a],s=o.completion;if(o.tryLoc===`root`)return i(`end`);if(o.tryLoc<=this.prev){var c=r.call(o,`catchLoc`),l=r.call(o,`finallyLoc`);if(c&&l){if(this.prev<o.catchLoc)return i(o.catchLoc,!0);if(this.prev<o.finallyLoc)return i(o.finallyLoc)}else if(c){if(this.prev<o.catchLoc)return i(o.catchLoc,!0)}else{if(!l)throw Error(`try statement without catch or finally`);if(this.prev<o.finallyLoc)return i(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,`finallyLoc`)&&this.prev<i.finallyLoc){var a=i;break}}a&&(e===`break`||e===`continue`)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var o=a?a.completion:{};return o.type=e,o.arg=t,a?(this.method=`next`,this.next=a.finallyLoc,g):this.complete(o)},complete:function(e,t){if(e.type===`throw`)throw e.arg;return e.type===`break`||e.type===`continue`?this.next=e.arg:e.type===`return`?(this.rval=this.arg=e.arg,this.method=`return`,this.next=`end`):e.type===`normal`&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),D(n),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if(r.type===`throw`){var i=r.arg;D(n)}return i}}throw Error(`illegal catch attempt`)},delegateYield:function(t,n,r){return this.delegate={iterator:k(t),resultName:n,nextLoc:r},this.method===`next`&&(this.arg=e),g}},t}function xS(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){n(e);return}s.done?t(c):Promise.resolve(c).then(r,i)}function SS(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var a=e.apply(t,n);function o(e){xS(a,r,i,o,s,`next`,e)}function s(e){xS(a,r,i,o,s,`throw`,e)}o(void 0)})}}var CS={size:{mode:`max`,value:512},objectFit:`cover`,correctCentering:!1,maxTextureSize:4096,debounceTimeout:500,crossOrigin:`anonymous`},wS=1;function TS(e){var t=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:{}).crossOrigin;return new Promise(function(n,r){var i=new Image;i.addEventListener(`load`,function(){n(i)},{once:!0}),i.addEventListener(`error`,function(e){r(e.error)},{once:!0}),t&&i.setAttribute(`crossOrigin`,t),i.src=e})}function ES(e){return DS.apply(this,arguments)}function DS(){return DS=SS(bS().mark(function e(t){var n,r,i,a,o,s,c,l,u,d,f,p,m,h=arguments;return bS().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n=h.length>1&&h[1]!==void 0?h[1]:{},r=n.size,i=n.crossOrigin,i!==`use-credentials`){e.next=7;break}return e.next=4,fetch(t,{credentials:`include`});case 4:a=e.sent,e.next=10;break;case 7:return e.next=9,fetch(t);case 9:a=e.sent;case 10:return e.next=12,a.text();case 12:if(o=e.sent,s=new DOMParser().parseFromString(o,`image/svg+xml`),c=s.documentElement,l=c.getAttribute(`width`),u=c.getAttribute(`height`),!(!l||!u)){e.next=19;break}throw Error("loadSVGImage: cannot use `size` if target SVG has no definite dimensions.");case 19:return typeof r==`number`&&(c.setAttribute(`width`,``+r),c.setAttribute(`height`,``+r)),d=new XMLSerializer().serializeToString(s),f=new Blob([d],{type:`image/svg+xml`}),p=URL.createObjectURL(f),m=TS(p),m.finally(function(){return URL.revokeObjectURL(p)}),e.abrupt(`return`,m);case 26:case`end`:return e.stop()}},e)})),DS.apply(this,arguments)}function OS(e){return kS.apply(this,arguments)}function kS(){return kS=SS(bS().mark(function e(t){var n,r,i,a,o,s=arguments;return bS().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n=s.length>1&&s[1]!==void 0?s[1]:{},r=n.size,i=n.crossOrigin,a=t.split(/[#?]/)[0].split(`.`).pop()?.trim().toLowerCase()===`svg`,!(a&&r)){e.next=16;break}return e.prev=3,e.next=6,ES(t,{size:r,crossOrigin:i});case 6:o=e.sent,e.next=14;break;case 9:return e.prev=9,e.t0=e.catch(3),e.next=13,TS(t,{crossOrigin:i});case 13:o=e.sent;case 14:e.next=19;break;case 16:return e.next=18,TS(t,{crossOrigin:i});case 18:o=e.sent;case 19:return e.abrupt(`return`,o);case 20:case`end`:return e.stop()}},e,null,[[3,9]])})),kS.apply(this,arguments)}function AS(e,t,n){var r=n.objectFit,i=n.size,a=n.correctCentering,o=r===`contain`?Math.max(e.width,e.height):Math.min(e.width,e.height),s=i.mode===`auto`?o:i.mode===`force`?i.value:Math.min(i.value,o),c=(e.width-o)/2,l=(e.height-o)/2;if(a){var u=t.getCorrectionOffset(e,o);c=u.x,l=u.y}return{sourceX:c,sourceY:l,sourceSize:o,destinationSize:s}}function jS(e,t,n){for(var r=t.canvas,i=r.width,a=r.height,o=[],s=n.x,c=n.y,l=n.rowHeight,u=n.maxRowWidth,d={},f=0,p=e.length;f<p;f++){var m=e[f],h=m.key,g=m.image,_=m.sourceSize,v=m.sourceX,y=m.sourceY,b=m.destinationSize,x=b+wS;c+x>a||s+x>i&&c+x+l>a||(s+x>i&&(u=Math.max(u,s),s=0,c+=l,l=x),o.push({key:h,image:g,sourceX:v,sourceY:y,sourceSize:_,destinationX:s,destinationY:c,destinationSize:b}),d[h]={x:s,y:c,size:b},s+=x,l=Math.max(l,x))}u=Math.max(u,s);for(var S=u,C=c+l,w=0,T=o.length;w<T;w++){var E=o[w],ee=E.image,te=E.sourceSize,D=E.sourceX,O=E.sourceY,k=E.destinationSize,A=E.destinationX,ne=E.destinationY;t.drawImage(ee,D,O,te,te,A,ne,k,k)}return{atlas:d,texture:t.getImageData(0,0,S,C),cursor:{x:s,y:c,rowHeight:l,maxRowWidth:u}}}function MS(e,t,n){var r=e.atlas,i=e.textures,a=e.cursor,o={atlas:_S({},r),textures:Zx(i.slice(0,-1)),cursor:_S({},a)},s=[];for(var c in t){var l=t[c];l.status===`ready`&&typeof r[c]?.textureIndex!=`number`&&s.push(_S({key:c},l))}for(var u=function(){var e=jS(s,n,o.cursor),t=e.atlas,r=e.texture;o.cursor=e.cursor;var i=[];s.forEach(function(e){t[e.key]?o.atlas[e.key]=_S(_S({},t[e.key]),{},{textureIndex:o.textures.length}):i.push(e)}),o.textures.push(r),s=i,s.length&&(o.cursor={x:0,y:0,rowHeight:0,maxRowWidth:0},n.clearRect(0,0,n.canvas.width,n.canvas.height))};s.length;)u();return o}var NS=function(){function e(){Qx(this,e),this.canvas=document.createElement(`canvas`),this.context=this.canvas.getContext(`2d`,{willReadFrequently:!0})}return nS(e,[{key:`getCorrectionOffset`,value:function(e,t){this.canvas.width=t,this.canvas.height=t,this.context.clearRect(0,0,t,t),this.context.drawImage(e,0,0,t,t);for(var n=this.context.getImageData(0,0,t,t).data,r=new Uint8ClampedArray(n.length/4),i=0;i<n.length;i++)r[i]=n[i*4+3];for(var a=0,o=0,s=0,c=0;c<t;c++)for(var l=0;l<t;l++){var u=r[c*t+l];s+=u,a+=u*l,o+=u*c}var d=a/s,f=o/s;return{x:d-t/2,y:f-t/2}}}]),e}(),PS=function(e){fS(t,e);function t(){var e,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return Qx(this,t),e=sS(this,t),pS(aS(e),`canvas`,document.createElement(`canvas`)),pS(aS(e),`ctx`,e.canvas.getContext(`2d`,{willReadFrequently:!0})),pS(aS(e),`corrector`,new NS),pS(aS(e),`imageStates`,{}),pS(aS(e),`textures`,[e.ctx.getImageData(0,0,1,1)]),pS(aS(e),`lastTextureCursor`,{x:0,y:0,rowHeight:0,maxRowWidth:0}),pS(aS(e),`atlas`,{}),e.options=_S(_S({},CS),n),e.canvas.width=e.options.maxTextureSize,e.canvas.height=e.options.maxTextureSize,e}return nS(t,[{key:`scheduleGenerateTexture`,value:function(){var e=this;typeof this.frameId!=`number`&&(typeof this.options.debounceTimeout==`number`?this.frameId=window.setTimeout(function(){e.generateTextures(),e.frameId=void 0},this.options.debounceTimeout):this.generateTextures())}},{key:`generateTextures`,value:function(){var e=MS({atlas:this.atlas,textures:this.textures,cursor:this.lastTextureCursor},this.imageStates,this.ctx),n=e.atlas,r=e.textures,i=e.cursor;this.atlas=n,this.textures=r,this.lastTextureCursor=i,this.emit(t.NEW_TEXTURE_EVENT,{atlas:n,textures:r})}},{key:`registerImage`,value:function(){var e=SS(bS().mark(function e(t){var n,r;return bS().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.imageStates[t]){e.next=2;break}return e.abrupt(`return`);case 2:return this.imageStates[t]={status:`loading`},e.prev=3,n=this.options.size,e.next=7,OS(t,{size:n.mode===`force`?n.value:void 0,crossOrigin:this.options.crossOrigin||void 0});case 7:r=e.sent,this.imageStates[t]=_S({status:`ready`,image:r},AS(r,this.corrector,this.options)),this.scheduleGenerateTexture(),e.next=15;break;case 12:e.prev=12,e.t0=e.catch(3),this.imageStates[t]={status:`error`};case 15:case`end`:return e.stop()}},e,this,[[3,12]])}));function t(t){return e.apply(this,arguments)}return t}()},{key:`getAtlas`,value:function(){return this.atlas}},{key:`getTextures`,value:function(){return this.textures}}]),t}(Nm.EventEmitter);pS(PS,`NEW_TEXTURE_EVENT`,`newTexture`);var FS=[`drawHover`,`drawLabel`,`drawingMode`,`keepWithinCircle`,`padding`,`colorAttribute`,`imageAttribute`],IS=WebGLRenderingContext,LS=IS.UNSIGNED_BYTE,RS=IS.FLOAT,zS=_S(_S({},CS),{},{drawingMode:`background`,keepWithinCircle:!0,drawLabel:void 0,drawHover:void 0,padding:0,colorAttribute:`color`,imageAttribute:`image`}),BS=[`u_sizeRatio`,`u_correctionRatio`,`u_cameraAngle`,`u_percentagePadding`,`u_matrix`,`u_colorizeImages`,`u_keepWithinCircle`,`u_atlas`];function VS(e){var t,n=document.createElement(`canvas`).getContext(`webgl`),r=Math.min(n.getParameter(n.MAX_TEXTURE_SIZE),CS.maxTextureSize);n.canvas.remove();var i=_S(_S(_S({},zS),{maxTextureSize:r}),e||{}),a=i.drawHover,o=i.drawLabel,s=i.drawingMode,c=i.keepWithinCircle,l=i.padding,u=i.colorAttribute,d=i.imageAttribute,f=new PS(hS(i,FS));return t=function(e){fS(t,e);function t(e,n,r){var i;return Qx(this,t),i=sS(this,t,[e,n,r]),pS(aS(i),`drawLabel`,o),pS(aS(i),`drawHover`,a),pS(aS(i),`textureManagerCallback`,null),i.textureManagerCallback=function(e){var t=e.atlas,n=e.textures,r=n.length!==i.textures.length;i.atlas=t,i.textureImages=n,r&&i.upgradeShaders(),i.bindTextures(),i.latestRenderParams&&i.render(i.latestRenderParams),i.renderer&&i.renderer.refresh&&i.renderer.refresh()},f.on(PS.NEW_TEXTURE_EVENT,i.textureManagerCallback),i.atlas=f.getAtlas(),i.textureImages=f.getTextures(),i.textures=i.textureImages.map(function(){return e.createTexture()}),i.bindTextures(),i}return nS(t,[{key:`getDefinition`,value:function(){return{VERTICES:3,VERTEX_SHADER_SOURCE:yS,FRAGMENT_SHADER_SOURCE:vS({texturesCount:f.getTextures().length}),METHOD:WebGLRenderingContext.TRIANGLES,UNIFORMS:BS,ATTRIBUTES:[{name:`a_position`,size:2,type:RS},{name:`a_size`,size:1,type:RS},{name:`a_color`,size:4,type:LS,normalized:!0},{name:`a_id`,size:4,type:LS,normalized:!0},{name:`a_texture`,size:4,type:RS},{name:`a_textureIndex`,size:1,type:RS}],CONSTANT_ATTRIBUTES:[{name:`a_angle`,size:1,type:RS}],CONSTANT_DATA:[[t.ANGLE_1],[t.ANGLE_2],[t.ANGLE_3]]}}},{key:`upgradeShaders`,value:function(){var e=this.getDefinition(),t=this.normalProgram,n=t.program,r=t.buffer,i=t.vertexShader,a=t.fragmentShader,o=t.gl;o.deleteProgram(n),o.deleteBuffer(r),o.deleteShader(i),o.deleteShader(a),this.normalProgram=this.getProgramInfo(`normal`,o,e.VERTEX_SHADER_SOURCE,e.FRAGMENT_SHADER_SOURCE,null)}},{key:`kill`,value:function(){var e=this.normalProgram?.gl;if(e)for(var n=0;n<this.textures.length;n++)e.deleteTexture(this.textures[n]);this.textureManagerCallback&&=(f.off(PS.NEW_TEXTURE_EVENT,this.textureManagerCallback),null),uS(t,`kill`,this,3)([])}},{key:`bindTextures`,value:function(){for(var e=this.normalProgram.gl,t=0;t<this.textureImages.length;t++){if(t>=this.textures.length){var n=e.createTexture();n&&this.textures.push(n)}e.activeTexture(e.TEXTURE0+t),e.bindTexture(e.TEXTURE_2D,this.textures[t]),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,this.textureImages[t]),e.generateMipmap(e.TEXTURE_2D)}}},{key:`renderProgram`,value:function(e,n){if(!n.isPicking)for(var r=n.gl,i=0;i<this.textureImages.length;i++)r.activeTexture(r.TEXTURE0+i),r.bindTexture(r.TEXTURE_2D,this.textures[i]);uS(t,`renderProgram`,this,3)([e,n])}},{key:`processVisibleItem`,value:function(e,t,n){var r=this.array,i=Qg(n[u]),a=n[d],o=a?this.atlas[a]:void 0;if(typeof a==`string`&&!o&&f.registerImage(a),r[t++]=n.x,r[t++]=n.y,r[t++]=n.size,r[t++]=i,r[t++]=e,o&&typeof o.textureIndex==`number`){var s=this.textureImages[o.textureIndex],c=s.width,l=s.height;r[t++]=o.x/c,r[t++]=o.y/l,r[t++]=o.size/c,r[t++]=o.size/l,r[t++]=o.textureIndex}else r[t++]=0,r[t++]=0,r[t++]=0,r[t++]=0,r[t++]=0}},{key:`setUniforms`,value:function(e,t){var n=t.gl,r=t.uniformLocations,i=r.u_sizeRatio,a=r.u_correctionRatio,o=r.u_matrix,u=r.u_atlas,d=r.u_colorizeImages,f=r.u_keepWithinCircle,p=r.u_cameraAngle,m=r.u_percentagePadding;this.latestRenderParams=e,n.uniform1f(a,e.correctionRatio),n.uniform1f(i,c?e.sizeRatio:e.sizeRatio/Math.SQRT2),n.uniform1f(p,e.cameraAngle),n.uniform1f(m,l),n.uniformMatrix3fv(o,!1,e.matrix),n.uniform1iv(u,Zx(Array(this.textureImages.length)).map(function(e,t){return t})),n.uniform1i(d,+(s===`color`)),n.uniform1i(f,+!!c)}}]),t}(y_),pS(t,`ANGLE_1`,0),pS(t,`ANGLE_2`,2*Math.PI/3),pS(t,`ANGLE_3`,4*Math.PI/3),pS(t,`textureManager`,f),t}VS(),VS({keepWithinCircle:!1,size:{mode:`force`,value:256},drawingMode:`color`,correctCentering:!0});function HS(e){return e.image===void 0?`glyph`:`icon`}function US(e){if(typeof e!=`string`||e.trim().length===0)throw TypeError(`Topology renderer node has an invalid or missing color.`);return e}function WS(e){return e>250}function GS(e){return e.hovered||e.selected?!0:!e.dense&&e.kind!==`service_instance`&&e.kind!==`repo`}function KS(e,t){return e!==null&&t.has(e)?e:null}function qS(e,t,n){let r=(e.x+t.x)/2,i=(e.y+t.y)/2,a=r+(t.y-e.y)*n,o=i-(t.x-e.x)*n;return{x:.25*e.x+.5*a+.25*t.x,y:.25*e.y+.5*o+.25*t.y}}function JS(e,t,n){let r=Math.hypot(t.x-e.x,t.y-e.y)-e.size-t.size-12;return r<48?null:{...qS(e,t,n),availableWidth:Math.min(150,r)}}var YS;function XS(e){YS=e}function ZS(){if(YS===void 0)throw TypeError(`Topology canvas palette was not initialized before rendering.`);return YS}var QS=new Set(sy);function $S(e,t){let n=e[t];if(n!==void 0){if(typeof n!=`string`)throw TypeError(`Topology renderer attribute "${t}" must be a string.`);return n}}function eC(e){let t=e.kind;if(typeof t!=`string`||!QS.has(t))throw TypeError(`Topology renderer node has an invalid or missing kind.`);return{kind:t,color:US(e.color),image:$S(e,`image`),glyph:$S(e,`glyph`),iconShellColor:$S(e,`iconShellColor`),iconBorderColor:$S(e,`iconBorderColor`)}}function tC(e){let t=e.curvature;if(t===void 0)return ix;if(typeof t!=`number`||!Number.isFinite(t))throw TypeError(`Topology renderer edge curvature must be a finite number.`);return t}function nC(e,t,n,r,i,a){let o=Math.min(a,r/2,i/2);e.beginPath(),e.moveTo(t+o,n),e.lineTo(t+r-o,n),e.quadraticCurveTo(t+r,n,t+r,n+o),e.lineTo(t+r,n+i-o),e.quadraticCurveTo(t+r,n+i,t+r-o,n+i),e.lineTo(t+o,n+i),e.quadraticCurveTo(t,n+i,t,n+i-o),e.lineTo(t,n+o),e.quadraticCurveTo(t,n,t+o,n),e.closePath(),e.fill()}function rC(e,t,n,r,i){let a=ZS(),o=e.measureText(t).width,s=Math.ceil(o+10),c=Math.ceil(i+6);e.fillStyle=a.captionHalo,nC(e,n-s/2,r-1,s,c,4),e.fillStyle=a.caption,e.fillText(t,n,r)}var iC=(e,t,n)=>{let r=ZS(),i=eC(t);i.image!==void 0&&(e.save(),e.beginPath(),e.arc(t.x,t.y,t.size*.82,0,Math.PI*2),e.strokeStyle=i.iconShellColor??i.color,e.lineWidth=Math.max(4,t.size*.36),e.stroke(),e.beginPath(),e.arc(t.x,t.y,t.size,0,Math.PI*2),e.strokeStyle=i.iconBorderColor??r.iconBorder,e.lineWidth=1.5,e.stroke(),e.restore());let a=lm(i);a!==void 0&&(e.fillStyle=r.glyph,e.font=`600 ${String(Math.round(t.size*1.15))}px `+n.labelFont,e.textAlign=`center`,e.textBaseline=`middle`,e.fillText(a,t.x,t.y))},aC=(e,t,n)=>{let r=t.label;if(r===null||r.length===0)return;let i=n.labelSize;e.font=`${n.labelWeight} ${String(i)}px `+n.labelFont,e.textAlign=`center`,e.textBaseline=`top`,rC(e,r,t.x,t.y+t.size+6,i)},oC=(e,t,n)=>{let r=ZS();e.save(),e.beginPath(),e.arc(t.x,t.y,t.size+4,0,Math.PI*2),e.strokeStyle=r.hoverRing,e.lineWidth=2,e.stroke(),e.restore(),aC(e,t,n)},sC=(e,t,n,r,i)=>{let a=t.label;if(a===null||a.length===0)return;let o=JS({x:n.x,y:n.y,size:n.size},{x:r.x,y:r.y,size:r.size},tC(t));if(o===null)return;let s=ZS(),c=i.edgeLabelSize,l=a;e.save(),e.font=`${i.edgeLabelWeight} ${String(c)}px `+i.edgeLabelFont;let u=e.measureText(l).width;if(u>o.availableWidth)for(l=`${l}...`,u=e.measureText(l).width;l.length>4&&u>o.availableWidth;)l=`${l.slice(0,-4)}...`,u=e.measureText(l).width;if(l.length<=3||u>o.availableWidth){e.restore();return}let d=Math.ceil(u+16),f=Math.ceil(Math.max(c+10,t.size*4+8));e.fillStyle=s.captionHalo,nC(e,o.x-d/2,o.y-f/2,d,f,4),e.fillStyle=s.edgeLabel,e.textAlign=`center`,e.textBaseline=`middle`,e.fillText(l,o.x,o.y+.5),e.restore()},cC=b_([Gx],aC),lC=b_([Gx,VS({correctCentering:!0,drawingMode:`background`,keepWithinCircle:!0,objectFit:`contain`,padding:.18,size:{mode:`force`,value:128}})],aC),uC=S_([ux],sC);function dC(e,t,n){let r=Qp(e.kind,t.get(e.key)),i={kind:e.kind,entityKey:e.entityKey},a=xm(e.providers,n.theme,i),o=a===void 0?{glyph:cm[e.kind]}:{image:a};return{...e,...o,x:0,y:0,size:r.size,dependents:r.dependents,dependencies:r.dependencies,importance:r.score,color:bm(ym(e.providers,i))??n.nodeColors[e.kind],borderColor:n.nodeBorderColor}}function fC(e,t){return{...e,color:t.edgeColor,size:t.edgeSize}}function pC(e,t,n){let r=Zp(t.edges);return{nodes:e.nodes.map(e=>dC(e,r,n)),edges:e.edges.map(e=>fC(e,n))}}var mC=N(`<section class=topology-canvas-region role=region><button class="button button--subtle topology-reset-layout"type=button>Reset layout</button><div class=topology-canvas>`),hC={application:`--topology-application`,environment:`--topology-environment`,service:`--topology-service`,service_instance:`--topology-service-instance`,system_ref:`--topology-system`,repo:`--topology-repo`};function gC(e,t){let n=e.getPropertyValue(t).trim();if(n.length===0)throw TypeError(`Topology design role "${t}" is unavailable.`);return n}function _C(){let e=document.documentElement,t=getComputedStyle(e),n=e.getAttribute(`data-color-mode`);if(n!==`light`&&n!==`dark`)throw TypeError(`Topology graph requires a resolved light or dark color mode.`);let r=Object.fromEntries(Object.entries(hC).map(([e,n])=>[e,gC(t,n)])),i=gC(t,`--topology-caption`),a=gC(t,`--topology-edge`);return XS({caption:i,captionHalo:gC(t,`--topology-caption-halo`),glyph:gC(t,`--topology-glyph`),iconBorder:gC(t,`--topology-icon-border`),hoverRing:gC(t,`--topology-hover-ring`),edgeLabel:i}),{presentation:{theme:n,nodeColors:r,nodeBorderColor:gC(t,`--topology-icon-border`),edgeColor:a,edgeSize:1.15},activeEdge:gC(t,`--topology-edge-active`),dimEdge:gC(t,`--topology-edge-dim`),dimNode:gC(t,`--topology-node-dim`)}}function vC(e){return[...e.nodes.map(e=>e.key),`|`,...e.edges.map(e=>e.key)].join(`\0`)}function yC(e){if(typeof e!=`object`||!e||!(`kind`in e))throw TypeError(`Topology renderer node has no kind.`);let t=e.kind;if(typeof t!=`string`)throw TypeError(`Topology renderer node has no kind.`);if(!sy.includes(t))throw TypeError(`Topology renderer node has unknown kind "${t}".`);return t}function bC(e){if(typeof e!=`object`||!e||!(`size`in e)||typeof e.size!=`number`||!Number.isFinite(e.size))throw TypeError(`Topology renderer item has no finite size.`);return e.size}function xC(e){let t,[n,r]=D(null),[i,a]=D(0),[o,s]=D(0),c=new Map,l=new Map,u;return ae(()=>{let i=new _g({type:`directed`,multi:!0}),d=_C(),f=new oy(i,t,{defaultDrawEdgeLabel:sC,defaultDrawNodeHover:oC,defaultDrawNodeLabel:aC,defaultEdgeColor:d.presentation.edgeColor,defaultEdgeType:`curvedArrow`,defaultNodeType:`glyph`,edgeProgramClasses:{curvedArrow:uC},nodeProgramClasses:{glyph:cC,icon:lC},edgeLabelColor:{color:d.presentation.edgeColor},edgeLabelSize:10,edgeLabelWeight:`500`,enableEdgeEvents:!0,itemSizesReference:`screen`,labelColor:{color:gC(getComputedStyle(document.documentElement),`--topology-caption`)},labelDensity:1,labelFont:`Poppins, sans-serif`,labelRenderedSizeThreshold:0,labelSize:12,labelWeight:`600`,maxCameraRatio:3,minCameraRatio:.2,renderEdgeLabels:!0,stagePadding:90,zIndex:!1}),p=f.getCanvases().labels?.getContext(`2d`);if(p==null)throw TypeError(`Topology renderer label canvas is unavailable.`);f.on(`afterRender`,()=>{let e=f.getSettings();i.forEachNode((t,n)=>{let r=f.getNodeDisplayData(t);if(r===void 0||r.hidden)return;let i=f.framedGraphToViewport(r);iC(p,{...n,...r,...i,key:t,size:f.scaleSize(r.size)},e)})});let m=new MutationObserver(e=>{e.some(e=>e.attributeName===`data-color-mode`)&&s(e=>e+1)});m.observe(document.documentElement,{attributes:!0,attributeFilter:[`data-color-mode`]});let h=``;u=()=>{c.clear(),a(0),Db(i),Tb(i,l),f.setCustomBBox(null),f.refresh(),f.getCamera().animatedReset({duration:280})},k(()=>{o();let t=e.graph,n=pC(t,e.wholeEstate,_C().presentation),s=vC(t);if(s!==h){Tb(i,l),i.clear();for(let e of n.nodes)i.addNode(e.key,e),i.setNodeAttribute(e.key,`type`,HS(e));for(let e of n.edges)i.addDirectedEdgeWithKey(e.key,e.source,e.target,{...e,curvature:.14,type:`curvedArrow`});let e=new Set(n.nodes.map(e=>e.key));for(let t of[...c.keys()])e.has(t)||(c.delete(t),l.delete(t));r(t=>KS(t,e)),a(c.size);let t=Eb(i,l);f.setCustomBBox(null),t||(Db(i,c),Tb(i,l),f.getCamera().animatedReset({duration:280})),h=s}else{for(let e of n.nodes){let{x:t,y:n}=i.getNodeAttributes(e.key);i.replaceNodeAttributes(e.key,{...e,x:t,y:n}),i.setNodeAttribute(e.key,`type`,HS(e))}for(let e of n.edges)i.replaceEdgeAttributes(e.key,{...e,curvature:.14,type:`curvedArrow`})}f.refresh()}),k(()=>{o();let t=e.graph,r=_C(),i=e.selectedKey,a=n()??i,s=WS(t.nodes.length),c=a!==null&&t.nodes.some(e=>e.key===a)?jb(a,t.nodes,t.edges):{nodes:new Set,edges:new Set};f.setSettings({defaultEdgeColor:r.presentation.edgeColor,edgeLabelColor:{color:r.presentation.edgeColor},labelColor:{color:gC(getComputedStyle(document.documentElement),`--topology-caption`)},nodeReducer:(e,t)=>{let o=HS(t),l=GS({kind:yC(t),dense:s,hovered:n()===e,selected:i===e});return a===null?{...t,forceLabel:l,type:o}:e===a?{...t,forceLabel:l,highlighted:!0,size:bC(t)*1.2,type:o}:c.nodes.has(e)?{...t,forceLabel:l,size:bC(t)*1.06,type:o}:{...t,color:r.dimNode,forceLabel:!1,size:bC(t)*.92,type:o}},edgeReducer:(e,t)=>a===null?{...t,color:r.presentation.edgeColor,forceLabel:!1,label:null,size:r.presentation.edgeSize,type:`curvedArrow`}:c.edges.has(e)?{...t,color:r.activeEdge,forceLabel:!s,size:Math.max(bC(t),1.4)*1.2,type:`curvedArrow`}:{...t,color:r.dimEdge,forceLabel:!1,label:null,size:1,type:`curvedArrow`}}),f.refresh()});let g=null,_=null,v=null,y=!1,b=()=>{v!==null&&(Ob(i,c),Tb(i,l),f.getCamera().enable(),y=!0,f.refresh()),g=null,_=null,v=null};f.on(`downNode`,({node:e,event:t})=>{y=!1,g=e,_={x:t.x,y:t.y}}),f.on(`upNode`,b),f.on(`upStage`,b),f.on(`enterNode`,({node:e})=>{v===null&&r(e)}),f.on(`leaveNode`,()=>{v===null&&r(null)}),f.on(`moveBody`,({event:e})=>{if(v===null&&g!==null&&_!==null&&Math.hypot(e.x-_.x,e.y-_.y)>=4&&(v=g,f.getCamera().disable(),f.setCustomBBox(f.getBBox())),v===null)return;let t=f.viewportToGraph({x:e.x,y:e.y});i.setNodeAttribute(v,`x`,t.x),i.setNodeAttribute(v,`y`,t.y);let n=c.has(v);c.set(v,t),n||a(c.size),e.preventSigmaDefault(),e.original.preventDefault(),e.original.stopPropagation(),f.refresh()}),f.on(`clickNode`,({node:t})=>{if(y){y=!1;return}let n=e.graph.nodes.find(e=>e.key===t);if(n===void 0)return;let r=em(n,e.focus);if(r.kind===`navigate`){e.onNavigate(r.focus);return}e.onSelect(e.selectedKey===t?null:t)}),f.on(`clickStage`,()=>{e.onSelect(null)});let x=()=>{b()};window.addEventListener(`mouseup`,x),window.addEventListener(`touchend`,x),window.addEventListener(`touchcancel`,x),oe(()=>{window.removeEventListener(`mouseup`,x),window.removeEventListener(`touchend`,x),window.removeEventListener(`touchcancel`,x),m.disconnect(),f.kill()})}),(()=>{var n=mC(),r=n.firstChild,a=r.nextSibling;r.$$click=()=>{u?.()};var o=t;return typeof o==`function`?at(o,a):t=a,O(t=>{var a=`Topology graph, ${String(e.graph.nodes.length)} nodes and ${String(e.graph.edges.length)} relationships`,o=i()===0;return a!==t.e&&P(n,`aria-label`,t.e=a),o!==t.t&&(r.disabled=t.t=o),t},{e:void 0,t:void 0}),n})()}nt([`click`]);var SC=N(`<div class=field><span class=field-label>Detail</span><div class=topology-segmented role=group aria-label="Application detail"><button type=button>Overview</button><button type=button>Full`),CC=N(`<button type=button class=topology-back>← Back to `),wC=N(`<label class=field><span class=field-label>Environment</span><select aria-label="Environment focus"><option value>All environments`),TC=N(`<div class=topology-filter-empty role=status><p>No topology matches these filters.</p><button type=button class="button button--subtle">Reset filters`),EC=N(`<div class=topology-workspace><aside class=topology-controls aria-label="Topology controls"><section class=topology-control-section><div class=topology-control-heading><h3>Focus</h3><button type=button class=topology-text-button>Show all</button></div><p class=topology-focus-status role=status></p><p class=topology-focus-hint>Click an application to focus. Click any other node for details.</p><label class=field><span class=field-label>Application</span><select aria-label="Application focus"><option value>All applications</option></select></label></section><section class=topology-control-section><div class=topology-control-heading><h3>Filters</h3><button type=button class=topology-text-button>Reset</button></div><label class=field><span class=field-label>Search</span><input type=search aria-label="Search topology"placeholder="Search this topology"></label><details class=topology-filter-group open><summary>Node kinds</summary><div class=topology-filter-list></div></details><details class=topology-filter-group><summary>Relationship kinds</summary><div class=topology-filter-list></div></details><details class=topology-filter-group><summary>Providers</summary><div class=topology-provider-list></div></details></section></aside><div class=topology-graph-column><div class=topology-graph-stage>`),DC=N(`<option>`),OC=N(`<label><input type=checkbox><span aria-hidden=true></span><span>`),kC=N(`<label><input type=checkbox><span>`),AC=N(`<button type=button>`),jC=N(`<div><dt>Application</dt><dd>`),MC=N(`<div><dt>Provider</dt><dd>`),NC=N(`<aside class=topology-details aria-label="Selected topology entity"><div class=topology-details-heading><div><p></p><h3></h3></div><button type=button aria-label="Clear selection"title="Clear selection">×</button></div><dl class=topology-details-facts><div><dt>Key</dt><dd class=topology-details-key></dd></div></dl><div class=topology-details-section><span>Relationships</span><strong></strong></div><div class=topology-relationships role=group aria-label=Relationships>`),PC=N(`<div><dt>Environment</dt><dd>`),FC=N(`<div><dt>Importance</dt><dd> dependents, <!> dependencies, score `),IC=N(`<button type=button><span aria-hidden=true></span><span><strong></strong><small>`),LC=N(`<section class=topology-preview-state><img alt="Example topology graph showing applications, environments, services, repositories, and connected systems"><div><h2>`),RC=N(`<div class=topology-message role=status><h3>Loading topology</h3><p>Reading the latest confirmed topology.`),zC=N(`<div class="topology-message topology-message-error"role=alert><h3>Topology could not be loaded</h3><p>`),BC=N(`<div class="topology-message topology-message-error"role=alert><h3>Topology state could not be determined</h3><p>`),VC=N(`<p>`),HC=N(`<a class="button button--primary">Open Confirm`),UC=N(`<p>No confirmed or currently reviewable topology is available.`),WC=N(`<p class=topology-coming-soon>Coming soon - on demand repo registry`),GC=N(`<section class=topology-page>`),KC={application:`Application`,environment:`Environment`,service:`Service`,service_instance:`Service instance`,system_ref:`Connected system`,repo:`Repository`};function qC(e){return e===void 0||!e.ok?e:{ok:!0,value:e.value.graph}}function JC(e,t){let n=new Set(e);return n.has(t)?n.delete(t):n.add(t),n}function YC(e){return e.nodes.filter(e=>e.kind===`application`).sort((e,t)=>e.label.localeCompare(t.label))}function XC(e,t){return e.nodes.filter(e=>e.kind===`environment`&&(t===void 0||e.applicationKey===t)).sort((e,t)=>e.label.localeCompare(t.label))}function ZC(e){let t=Bs(),[n,r]=D({kind:`estate`}),[i,a]=D(``),[o,s]=D(new Set),[c,l]=D(new Set),[u,d]=D(new Set),[f,p]=D(null),m=A(()=>qp(e.data.graph,n())),h=A(()=>{let e=n();return e.kind===`application`?e:void 0}),g=A(()=>{let e=n();return e.kind===`environment`?e:void 0}),_=A(()=>[...new Set(m().nodes.map(e=>e.kind))].sort((e,t)=>KC[e].localeCompare(KC[t]))),v=A(()=>[...new Set(m().edges.map(e=>e.kind))].sort((e,t)=>e.localeCompare(t))),y=A(()=>[...new Set(m().nodes.flatMap(e=>e.providers))].sort((e,t)=>e.localeCompare(t))),b=A(()=>{let e=new Set(_().filter(e=>!o().has(e))),t=new Set(v().filter(e=>!c().has(e)));return Vp(m(),{query:i(),nodeKinds:o().size===0?new Set:e,relationshipKinds:c().size===0?new Set:t,providers:u()})}),x=A(()=>i().trim().length>0||o().size>0||c().size>0||u().size>0),S=A(()=>{let e=f();if(e!==null)return b().nodes.find(t=>t.key===e)}),C=A(()=>{let e=S();if(e===void 0)return[];let t=new Map(b().nodes.map(e=>[e.key,e]));return b().edges.filter(t=>t.source===e.key||t.target===e.key).map(n=>{let r=n.source===e.key,i=r?n.target:n.source;return{edge:n,outbound:r,other:t.get(i)}})}),w=A(()=>{let t=S();if(t!==void 0)return Qp(t.kind,Zp(e.data.graph.edges).get(t.key))});k(()=>{f()!==null&&S()===void 0&&p(null)}),k(()=>{t(rm(ie(),b().nodes.length,b().edges.length))});function T(){a(``),s(new Set),l(new Set),d(new Set)}function E(e){r(e),p(null),T()}function ee(e){if(e.length===0){E({kind:`estate`});return}E({kind:`application`,applicationKey:e,mode:`overview`})}function te(t){if(t.length===0){let e=n();e.kind===`environment`&&E({kind:`application`,applicationKey:e.applicationKey,mode:`overview`});return}let r=XC(e.data.graph).find(e=>e.entityKey===t);if(r===void 0||r.applicationKey===null)throw TypeError(`Environment "${t}" has no parent Application.`);E({kind:`environment`,applicationKey:r.applicationKey,environmentKey:r.entityKey})}let ne=t=>YC(e.data.graph).find(e=>e.entityKey===t)?.label??t,re=t=>XC(e.data.graph).find(e=>e.entityKey===t)?.label??t,ie=()=>{let e=n();if(e.kind===`estate`)return`Showing all confirmed topology`;if(e.kind===`application`){let t=ne(e.applicationKey);return e.mode===`overview`?`Showing ${t} and its environments`:`Showing ${t} in full`}return`Showing ${re(e.environmentKey)}`},ae=t=>{if(t.kind===`application`)return[t.entityKey];if(t.kind===`environment`)return t.applicationKey===null?[]:[t.applicationKey];if(t.kind===`service`)return t.applicationKeys;if(t.kind===`service_instance`&&t.environmentKey!==null){let n=XC(e.data.graph).find(e=>e.entityKey===t.environmentKey);return n?.applicationKey===null||n?.applicationKey===void 0?[]:[n.applicationKey]}return[]};return(()=>{var t=EC(),r=t.firstChild,m=r.firstChild,D=m.firstChild,k=D.firstChild.nextSibling,A=D.nextSibling,oe=A.nextSibling.nextSibling.firstChild.nextSibling;oe.firstChild;var se=m.nextSibling.firstChild,ce=se.firstChild.nextSibling,le=se.nextSibling,ue=le.firstChild.nextSibling,de=le.nextSibling,fe=de.firstChild.nextSibling,pe=de.nextSibling,me=pe.firstChild.nextSibling,he=pe.nextSibling.firstChild.nextSibling,ge=r.nextSibling,_e=ge.firstChild;return k.$$click=()=>{E({kind:`estate`})},F(A,ie),oe.addEventListener(`change`,e=>{ee(e.currentTarget.value)}),F(oe,j(qe,{get each(){return YC(e.data.graph)},children:e=>(()=>{var t=DC();return F(t,()=>e.label),O(()=>t.value=e.entityKey),t})()}),null),F(m,j(M,{get when(){return h()},get children(){var e=SC(),t=e.firstChild.nextSibling.firstChild,r=t.nextSibling;return t.$$click=()=>{let e=n();e.kind===`application`&&E({...e,mode:`overview`})},r.$$click=()=>{let e=n();e.kind===`application`&&E({...e,mode:`full`})},O(e=>{var n=h()?.mode===`overview`,i=h()?.mode===`full`;return n!==e.e&&P(t,`aria-pressed`,e.e=n),i!==e.t&&P(r,`aria-pressed`,e.t=i),e},{e:void 0,t:void 0}),e}}),null),F(m,j(M,{get when(){return g()},get children(){var e=CC();return e.firstChild,e.$$click=()=>{let e=n();e.kind===`environment`&&E({kind:`application`,applicationKey:e.applicationKey,mode:`overview`})},F(e,(()=>{var e=Qe(()=>g()===void 0);return()=>e()?`Application`:ne(g()?.applicationKey??``)})(),null),e}}),null),F(m,j(M,{get when(){return h()??g()},get children(){var t=wC(),n=t.firstChild.nextSibling;return n.firstChild,n.addEventListener(`change`,e=>{te(e.currentTarget.value)}),F(n,j(qe,{get each(){return XC(e.data.graph,h()?.applicationKey??g()?.applicationKey)},children:e=>(()=>{var t=DC();return F(t,()=>e.label),O(()=>t.value=e.entityKey),t})()}),null),O(()=>n.value=g()?.environmentKey??``),t}}),null),ce.$$click=T,ue.$$input=e=>{a(e.currentTarget.value)},F(fe,j(qe,{get each(){return _()},children:e=>{let t=()=>!o().has(e)&&_().length-o().size===1;return(()=>{var n=OC(),r=n.firstChild,i=r.nextSibling,a=i.nextSibling;return r.addEventListener(`change`,()=>{s(t=>JC(t,e))}),rt(i,`topology-kind-mark topology-kind-mark--${e}`),F(i,()=>cm[e]),F(a,()=>KC[e]),O(()=>r.disabled=t()),O(()=>r.checked=!o().has(e)),n})()}})),F(me,j(qe,{get each(){return v()},children:e=>{let t=()=>!c().has(e)&&v().length-c().size===1;return(()=>{var n=kC(),r=n.firstChild,i=r.nextSibling;return r.addEventListener(`change`,()=>{l(t=>JC(t,e))}),F(i,()=>wm(e)),O(()=>r.disabled=t()),O(()=>r.checked=!c().has(e)),n})()}})),F(he,j(qe,{get each(){return y()},children:e=>(()=>{var t=AC();return t.$$click=()=>{d(t=>JC(t,e))},F(t,()=>_m(e)),O(()=>P(t,`aria-pressed`,u().has(e))),t})()})),F(_e,j(M,{get when(){return Qe(()=>b().nodes.length===0)()&&x()},get children(){var e=TC(),t=e.firstChild.nextSibling;return t.$$click=T,e}}),null),F(_e,j(xC,{get graph(){return b()},get wholeEstate(){return e.data.graph},get focus(){return n()},get selectedKey(){return f()},onSelect:p,onNavigate:E}),null),F(ge,j(M,{get when(){return S()},children:e=>(()=>{var t=NC(),n=t.firstChild,r=n.firstChild,i=r.firstChild,a=i.nextSibling,o=r.nextSibling,s=n.nextSibling,c=s.firstChild,l=c.firstChild.nextSibling,u=s.nextSibling,d=u.firstChild.nextSibling,f=u.nextSibling;return F(i,()=>KC[e().kind]),F(a,()=>e().label),o.$$click=()=>{p(null)},F(s,j(M,{get when(){return ae(e()).length>0},get children(){var t=jC(),n=t.firstChild.nextSibling;return F(n,()=>ae(e()).map(ne).join(`, `)),t}}),c),F(s,j(M,{get when(){return e().environmentKey},children:e=>(()=>{var t=PC(),n=t.firstChild.nextSibling;return F(n,()=>re(e())),t})()}),c),F(s,j(M,{get when(){return e().providers.length>0},get children(){var t=MC(),n=t.firstChild.nextSibling;return F(n,()=>e().providers.map(_m).join(`, `)),t}}),c),F(s,j(M,{get when(){return w()},children:e=>(()=>{var t=FC(),n=t.firstChild.nextSibling,r=n.firstChild,i=r.nextSibling;return i.nextSibling,F(n,()=>e().dependents,r),F(n,()=>e().dependencies,i),F(n,()=>e().score.toFixed(2),null),t})()}),c),F(l,()=>e().entityKey),F(d,()=>C().length),F(f,j(qe,{get each(){return C()},children:e=>(()=>{var t=IC(),n=t.firstChild,r=n.nextSibling.firstChild,i=r.nextSibling;return t.$$click=()=>{e.other!==void 0&&p(e.other.key)},F(n,()=>e.outbound?`→`:`←`),F(r,()=>e.other?.label??`Outside current view`),F(i,()=>e.edge.label),O(()=>t.disabled=e.other===void 0),t})()})),t})()}),null),O(e=>{var t=n().kind===`estate`,r=!x();return t!==e.e&&(k.disabled=e.e=t),r!==e.t&&(ce.disabled=e.t=r),e},{e:void 0,t:void 0}),O(()=>oe.value=$p(n())??``),O(()=>ue.value=i()),t})()}function QC(e){return(()=>{var t=LC(),n=t.firstChild,r=n.nextSibling,i=r.firstChild;return P(n,`src`,tm),F(i,()=>e.title),F(r,()=>e.children,null),t})()}function $C(){let e=oc(Mm),t=Fp(),n=Bs(),r=A(()=>nm(qC(e()),t(),!0)),i=A(()=>{let e=r();return e.kind===`graph_failure`?e:void 0}),a=A(()=>{let e=r();return e.kind===`indeterminate`?e:void 0}),o=A(()=>{let e=r();return e.kind===`reviewable`?e:void 0}),s=A(()=>{let t=e();return t?.ok===!0?t.value:void 0});return k(()=>{let e=r();if(e.kind!==`graph`){if(e.kind===`loading`){n(`Reading confirmed topology`);return}if(e.kind===`graph_failure`||e.kind===`indeterminate`){n(`Topology could not be loaded`);return}if(e.kind===`reviewable`){n(`${e.count.toLocaleString()} candidates ready for review`);return}n(`No confirmed topology yet`)}}),oe(()=>{n(void 0)}),(()=>{var e=GC();return F(e,j(Je,{get children(){return[j(Ye,{get when(){return r().kind===`loading`},get children(){return RC()}}),j(Ye,{get when(){return i()},get children(){var e=zC(),t=e.firstChild.nextSibling;return F(t,()=>i()?.error.message),e}}),j(Ye,{get when(){return a()},get children(){var e=BC(),t=e.firstChild.nextSibling;return F(t,()=>a()?.error.message),e}}),j(Ye,{get when(){return o()},get children(){return j(QC,{title:`Topology is ready for confirmation`,get children(){return[(()=>{var e=VC();return F(e,()=>`${String(o()?.count??0)} topology candidates are currently ready for review.`),e})(),j(M,{get when(){return o()?.confirmAvailable===!0},get children(){var e=HC();return P(e,`href`,_l),e}})]}})}}),j(Ye,{get when(){return r().kind===`empty`},get children(){return j(QC,{title:`No topology is ready`,get children(){return[UC(),WC()]}})}}),j(Ye,{get when(){return r().kind===`graph`},get children(){return j(M,{get when(){return s()},children:e=>j(ZC,{get data(){return e()}})})}})]}})),e})()}nt([`click`,`input`]);var ew=N(`<p>There is no page at this address.`),tw=()=>os({method:`GET`,path:$r,schema:Yi,attempted:`read the daemon's update-poll status`}),nw=()=>os({method:`GET`,path:ei,schema:Ia,attempted:`read how many topology candidates can be reviewed now`}),rw=()=>os({method:`GET`,path:Zr,schema:Gi,attempted:`read whether a practitioner has registered`});function iw(e){let t=Pt(),n=oc(rw),r=()=>kl(n(),El()),[i,a]=D(void 0),o=0;k(()=>{Ll();let e=++o;nw().then(t=>{e===o&&a(()=>t)})});let s=()=>bl({pathname:t.pathname,registered:r(),registrationRoute:Ki,pendingReview:i(),confirmAvailable:!0}),c=oc(tw),[l,u]=D();return j(Pp,{value:i,get children(){return j(zs,{value:u,get children(){return j(Ls,{get title(){return Sl(t.pathname,Ki,!0)},get subtitle(){return l()},get destinations(){return s()},get utilityDestinations(){return xl(t.pathname)},get updatePoll(){return c()},get children(){return e.children}})}})}})}function aw(){return j(on,{root:iw,get children(){return[j(Xt,{path:`/`,component:$C}),j(Xt,{path:gl,component:$C}),j(Xt,{path:pl,component:pc}),j(Xt,{path:ml,component:fl}),j(Xt,{path:_l,component:jp}),j(Xt,{path:hl,component:Sc}),j(Xt,{path:Ki,component:Il}),j(Xt,{path:`*`,component:()=>ew()})]}})}xs();var ow=document.getElementById(`root`);ow===null?document.body.textContent=`operator: the page is missing its #root element`:tt(()=>j(aw,{}),ow);