@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.
|
@@ -1,758 +0,0 @@
|
|
|
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=Te,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(()=>ie(()=>ke(o)));S=o,w=null;try{return Ce(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[_e.bind(n),e=>(typeof e==`function`&&(e=C&&C.running&&C.sources.has(n)?e(n.tValue):e(n.value)),ve(n,e))]}function O(e,t,n){ye(xe(e,t,!1,y))}function ne(e,t,n){v=Ee;let r=xe(e,t,!1,y),i=ge&&me(ge);i&&(r.suspense=i),(!n||!n.render)&&(r.user=!0),E?E.push(r):ye(r)}function k(e,t,n){n=n?Object.assign({},g,n):g;let r=xe(e,t,!0,0);return r.observers=null,r.observerSlots=null,r.comparator=n.equals||void 0,ye(r),_e.bind(r)}function re(e){return Ce(e,!1)}function ie(e){if(w===null)return e();let t=w;w=null;try{return e()}finally{w=t}}function ae(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=ie(()=>t(o,i,n));return i=o,s}}function oe(e){ne(()=>ie(e))}function se(e){return S===null||(S.cleanups===null?S.cleanups=[e]:S.cleanups.push(e)),e}function ce(){return S}function le(e,t){let n=S,r=w;S=e,w=null;try{return Ce(t,!0)}catch(e){Ne(e)}finally{S=n,w=r}}function ue(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 ge&&(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),Ce(e,!1),w=S=null,r?r.done:void 0})}var[de,fe]=D(!1);function pe(e,t){let n=Symbol(`context`);return{id:n,Provider:Fe(n),defaultValue:e}}function me(e){let t;return S&&S.context&&(t=S.context[e.id])!==void 0?t:e.defaultValue}function he(e){let t=k(e),n=k(()=>Pe(t()));return n.toArray=()=>{let e=n();return Array.isArray(e)?e:e==null?[]:[e]},n}var ge;function _e(){let e=C&&C.running;if(this.sources&&(e?this.tState:this.state)){if((e?this.tState:this.state)===y)ye(this);else{let e=T;T=null,Ce(()=>De(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 ve(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&&Ce(()=>{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&&Oe(n)),r?n.tState=y:n.state=y)}if(T.length>1e6)throw T=[],Error()},!1)}return t}function ye(e){if(!e.fn)return;ke(e);let t=ee;be(e,C&&C.running&&C.sources.has(e)?e.tValue:e.value,t),C&&!C.running&&C.sources.has(e)&&queueMicrotask(()=>{Ce(()=>{C&&(C.running=!0),w=S=e,be(e,e.tValue,t),w=S=null},!1)})}function be(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(ke),e.tOwned=void 0):(e.state=y,e.owned&&e.owned.forEach(ke),e.owned=null)),e.updatedAt=n+1,Ne(t)}finally{w=a,S=i}(!e.updatedAt||e.updatedAt<=n)&&(e.updatedAt!=null&&`observers`in e?ve(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 xe(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 Se(e){let t=C&&C.running;if((t?e.tState:e.state)===0)return;if((t?e.tState:e.state)===b)return De(e);if(e.suspense&&ie(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)ye(e);else if((t?e.tState:e.state)===b){let t=T;T=null,Ce(()=>De(e,n[0]),!1),T=t}}}function Ce(e,t){if(T)return e();let n=!1;t||(T=[]),E?n=!0:E=[],ee++;try{let t=e();return we(n),t}catch(e){n||(E=null),T=null,Ne(e)}}function we(e){if(T&&=(Te(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,Ce(()=>{for(let e of n)ke(e);for(let t of e){if(t.value=t.tValue,t.owned)for(let e=0,n=t.owned.length;e<n;e++)ke(t.owned[e]);t.tOwned&&(t.owned=t.tOwned),delete t.tValue,delete t.tOwned,t.tState=0}fe(!1)},!1)}else if(C.running){C.running=!1,C.effects.push.apply(C.effects,E),E=null,fe(!0);return}}let n=E;E=null,n.length&&Ce(()=>v(n),!1),t&&t()}function Te(e){for(let t=0;t<e.length;t++)Se(e[t])}function Ee(e){let t,n=0;for(t=0;t<e.length;t++){let r=e[t];r.user?e[n++]=r:Se(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++)Se(e[t])}function De(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)&&Se(i):e===b&&De(i,t)}}}function Oe(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&&Oe(r))}}function ke(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--)ke(e.tOwned[t]);delete e.tOwned}if(C&&C.running&&e.pure)Ae(e,!0);else if(e.owned){for(t=e.owned.length-1;t>=0;t--)ke(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 Ae(e,t){if(t||(e.tState=0,C.disposed.add(e)),e.owned)for(let t=0;t<e.owned.length;t++)Ae(e.owned[t])}function je(e){return e instanceof Error?e:Error(typeof e==`string`?e:`Unknown error`,{cause:e})}function Me(e,t,n){try{for(let n of t)n(e)}catch(e){Ne(e,n&&n.owner||null)}}function Ne(e,t=S){let n=_&&t&&t.context&&t.context[_],r=je(e);if(!n)throw r;E?E.push({fn(){Me(r,n,t)},state:y}):Me(r,n,t)}function Pe(e){if(typeof e==`function`&&!e.length)return Pe(e());if(Array.isArray(e)){let t=[];for(let n=0;n<e.length;n++){let r=Pe(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 Fe(e,t){return function(t){let n;return O(()=>n=ie(()=>(S.context={...S.context,[e]:t.value},he(()=>t.children))),void 0),n}}var Ie=Symbol(`fallback`);function Le(e){for(let t=0;t<e.length;t++)e[t]()}function Re(e,t,n={}){let r=[],i=[],a=[],o=0,s=t.length>1?[]:null;return se(()=>Le(a)),()=>{let c=e()||[],l=c.length,u,d;return c[h],ie(()=>{let e,t,p,m,h,g,_,v,y;if(l===0)o!==0&&(Le(a),a=[],r=[],i=[],o=0,s&&=[]),n.fallback&&(r=[Ie],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 A(e,t){return ie(()=>e(t||{}))}function ze(){return!0}var Be={get(e,t,n){return t===p?n:e.get(t)},has(e,t){return t===p||e.has(t)},set:ze,deleteProperty:ze,getOwnPropertyDescriptor(e,t){return{configurable:!0,enumerable:!0,get(){return e.get(t)},set:ze,deleteProperty:ze}},ownKeys(e){return e.keys()}};function Ve(e){return(e=typeof e==`function`?e():e)?e:{}}function He(){for(let e=0,t=this.length;e<t;++e){let t=this[e]();if(t!==void 0)return t}}function Ue(...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,k(r)):r}if(m&&t)return new Proxy({get(t){for(let n=e.length-1;n>=0;n--){let r=Ve(e[n])[t];if(r!==void 0)return r}},has(t){for(let n=e.length-1;n>=0;n--)if(t in Ve(e[n]))return!0;return!1},keys(){let t=[];for(let n=0;n<e.length;n++)t.push(...Object.keys(Ve(e[n])));return[...new Set(t)]}},Be);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:He.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}var We=e=>`Stale read from <${e}>.`;function Ge(e){let t=`fallback`in e&&{fallback:()=>e.fallback};return k(Re(()=>e.each,e.children,t||void 0))}function j(e){let t=e.keyed,n=k(()=>e.when,void 0,void 0),r=t?n:k(n,void 0,{equals:(e,t)=>!e==!t});return k(()=>{let i=r();if(i){let a=e.children;return typeof a==`function`&&a.length>0?ie(()=>a(t?i:()=>{if(!ie(r))throw We(`Show`);return n()})):a}return e.fallback},void 0,void 0)}function Ke(e){let t=he(()=>e.children),n=k(()=>{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=k(()=>a()?void 0:i.when,void 0,void 0),s=i.keyed?o:k(o,void 0,{equals:(e,t)=>!e==!t});r=()=>a()||(s()?[t,o,i]:void 0)}return r});return k(()=>{let t=n()();if(!t)return e.fallback;let[r,i,a]=t,o=a.children;return typeof o==`function`&&o.length>0?ie(()=>o(a.keyed?i():()=>{if(ie(n)()?.[0]!==r)throw We(`Match`);return i()})):o},void 0,void 0)}function qe(e){return e}var Je;function Ye(){Je&&[...Je].forEach(e=>e())}var Xe=e=>k(()=>e());function Ze(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 Qe=`_$DX_DELEGATE`;function $e(e,t,n,r={}){let i;return te(r=>{i=r,t===document?e():N(t,e(),t.firstChild?null:void 0,n)},r.owner),()=>{i(),t.textContent=``}}function M(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?()=>ie(()=>document.importNode(i||=a(),!0)):()=>(i||=a()).cloneNode(!0);return o.cloneNode=o,o}function et(e,t=window.document){let n=t[Qe]||(t[Qe]=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,ot))}}function tt(e,t,n){at(e)||(n==null?e.removeAttribute(t):e.setAttribute(t,n))}function nt(e,t){at(e)||(t==null?e.removeAttribute(`class`):e.className=t)}function rt(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 it(e,t,n){return ie(()=>e(t,n))}function N(e,t,n,r){if(n!==void 0&&!r&&(r=[]),typeof t!=`function`)return st(e,t,r,n);O(r=>st(e,t(),r,n),r)}function at(e){return!!l.context&&!l.done&&(!e||e.isConnected)}function ot(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 st(e,t,n,r,i){let a=at(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=ut(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=ut(e,n,r)}else if(o===`function`)return O(()=>{let i=t();for(;typeof i==`function`;)i=i();n=st(e,i,n,r)}),()=>n;else if(Array.isArray(t)){let o=[],c=n&&Array.isArray(n);if(ct(o,t,n,i))return O(()=>n=st(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=ut(e,n,r),s)return n}else c?n.length===0?lt(e,o,r):Ze(e,n,o):(n&&ut(e),lt(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=ut(e,n,r,t);ut(e,n,null,t)}else n==null||n===``||!e.firstChild?e.appendChild(t):e.replaceChild(t,e.firstChild);n=t}return n}function ct(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=ct(e,o,s)||i;else if(c===`function`){if(r){for(;typeof o==`function`;)o=o();i=ct(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 lt(e,t,n=null){for(let r=0,i=t.length;r<i;r++)e.insertBefore(t[r],n)}function ut(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 dt(){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 ft;function pt(){(!window.history.state||window.history.state._depth==null)&&window.history.replaceState({...window.history.state,_depth:window.history.length-1},``),ft=window.history.state._depth}pt();function mt(e){return{...e,_depth:window.history.state&&window.history.state._depth}}function ht(e,t){let n=!1;return()=>{let r=ft;pt();let i=r==null?null:ft-r;if(n){n=!1;return}i&&t(i)?(n=!0,window.history.go(-i)):e()}}var gt=/^(?:[a-z0-9]+:)?\/\//i,_t=/^\/+|(\/)\/+$/g,vt=`http://sr`;function yt(e,t=!1){let n=e.replace(_t,`$1`);return n?t||/^[?#]/.test(n)?n:`/`+n:``}function bt(e,t,n){if(gt.test(t))return;let r=yt(e),i=n&&yt(n),a=``;return a=!i||t.startsWith(`/`)?r:i.toLowerCase().indexOf(r.toLowerCase())===0?i:r+i,(a||`/`)+yt(t,!a)}function xt(e,t){if(e==null)throw Error(t);return e}function St(e,t){return yt(e).replace(/\/*(\*.*)?$/g,``)+yt(t)}function Ct(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 wt(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&&Tt(i,l(o)))c.params[o]=i;else if(n||!Tt(i,o))return null;c.path+=`/${i}`}if(i){let e=s?r.slice(-s).join(`/`):``;if(Tt(e,l(i)))c.params[i]=e;else return null}return c}}function Tt(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 Et(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 Dt(e){let t=new Map,n=ce();return new Proxy({},{get(r,i){return t.has(i)||le(n,()=>t.set(i,k(()=>e()[i]))),t.get(i)()},getOwnPropertyDescriptor(){return{enumerable:!0,configurable:!0}},ownKeys(){return Reflect.ownKeys(e())},has(t,n){return n in e()}})}function Ot(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 Ot(r).reduce((e,t)=>[...e,...i.map(e=>e+t)],[])}var kt=100,At=pe(),jt=pe(),Mt=()=>xt(me(At),`<A> and 'use' router primitives can be only used inside a Route.`),Nt=()=>Mt().location,Pt=e=>encodeURIComponent(e).replace(/%(2B|40|3A|24|26|2C|3B|3D)/g,e=>decodeURIComponent(e));function Ft(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 Lt(e.path).reduce((n,r)=>{for(let i of Ot(r)){let a=St(t,i),o=s?a:a.split(`/*`,1)[0];o=o.split(`/`).map(e=>e.startsWith(`:`)||e.startsWith(`*`)?e:Pt(e)).join(`/`),n.push({...c,originalPath:r,pattern:o,matcher:wt(o,!s,e.matchFilters)})}return n},[])}function It(e,t=0){return{routes:e,score:Et(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 Lt(e){return Array.isArray(e)?e:[e]}function Rt(e,t=``,n=[],r=[]){let i=Lt(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=Ft(a,t);for(let t of e){n.push(t);let e=Array.isArray(a.children)&&a.children.length===0;if(a.children&&!e)Rt(a.children,t.pattern,n,r);else{let e=It([...n],r.length);r.push(e)}n.pop()}}}return n.length?r:r.sort((e,t)=>t.score-e.score)}function zt(e,t){for(let n=0,r=e.length;n<r;n++){let r=e[n].matcher(t);if(r)return r}return[]}function Bt(e,t,n){let r=new URL(vt),i=k(t=>{let n=e();try{return new URL(n[0]===`/`?vt+n:n,r)}catch{return console.error(`Invalid path ${n}`),t}},r,{equals:(e,t)=>e.href===t.href}),a=k(()=>i().pathname),o=k(()=>i().search,!0),s=k(()=>i().hash),c=()=>``,l=ae(o,()=>Ct(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):Dt(l)}}var Vt;function Ht(){return Vt}function Ut(e,t,n,r={}){let{signal:[i,a],utils:o={}}=e,s=o.parsePath||(e=>e),c=o.renderPath||(e=>e),l=o.beforeLeave||dt(),u=bt(``,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),Vt=e,p=t,ue(()=>{p===t&&(g(p.value),v(p.state),Ye(),x[1](e=>e.filter(e=>e.pending)))}).finally(()=>{p===t&&re(()=>{Vt=void 0,e===`navigate`&&te(p),f(!1),p=void 0})}))},[h,g]=D(i().value),[_,v]=D(i().state),y=Bt(h,_,o.queryWrapper),b=[],x=D([]),S=k(()=>typeof r.transformUrl==`function`?zt(t(),r.transformUrl(y.pathname)):zt(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):Dt(C),T={pattern:u,path:()=>u,outlet:()=>null,resolvePath(e){return bt(u,e)}};return O(ae(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:ne,singleFlight:r.singleFlight===void 0||r.singleFlight,submissions:x};function E(e,t,n){ie(()=>{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):bt(r&&y.pathname||``,t);if(u===void 0)throw Error(`Path '${t}' is not a routable path`);if(b.length>=kt)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||me(jt)||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 ne(e,r){let i=zt(t(),e.pathname),a=Vt;Vt=`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&&le(n(),()=>s({params:o,location:{pathname:e.pathname,search:e.search,hash:e.hash,query:Ct(e),state:null,key:``},intent:`preload`}))}Vt=a}}function Wt(e,t,n,r){let{base:i,location:a,params:o}=e,{pattern:s,component:c,preload:l}=r().route,u=k(()=>r().path);c&&c.preload&&c.preload();let d=l?l({params:o,location:a,intent:Vt||`initial`}):void 0;return{parent:t,pattern:s,path:u,outlet:()=>c?A(c,{params:o,location:a,data:d,get children(){return n()}}):n(),resolvePath(e){return bt(i.path(),e,u())}}}var Gt=e=>t=>{let{base:n}=t,r=he(()=>t.children),i=k(()=>Rt(r(),t.base||``)),a,o=Ut(e,i,()=>a,{base:n,singleFlight:t.singleFlight,transformUrl:t.transformUrl});return e.create&&e.create(o),A(At.Provider,{value:o,get children(){return A(Kt,{routerState:o,get root(){return t.root},get preload(){return t.rootPreload||t.rootLoad},get children(){return[Xe(()=>(a=ce())&&null),A(qt,{routerState:o,get branches(){return i()}})]}})}})};function Kt(e){let t=e.routerState.location,n=e.routerState.params,r=k(()=>e.preload&&ie(()=>{e.preload({params:n,location:t,intent:Ht()||`initial`})}));return A(j,{get when(){return e.root},keyed:!0,get fallback(){return e.children},children:i=>A(i,{params:n,location:t,get data(){return r()},get children(){return e.children}})})}function qt(e){let t=[],n;se(()=>t.forEach(e=>e()));let r=k(ae(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]=Wt(e.routerState,c[n-1]||e.routerState.base,Jt(()=>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 Jt(()=>r()&&n)()}var Jt=e=>()=>A(j,{get when(){return e()},keyed:!0,children:e=>A(jt.Provider,{value:e,get children(){return e.outlet()}})}),Yt=e=>{let t=he(()=>e.children);return Ue(e,{get children(){return t()}})};function Xt([e,t],n,r){return[n?()=>n(e()):e,r?e=>t(r(e)):t]}function Zt(e){let t=!1,n=e=>typeof e==`string`?{value:e}:e,r=Xt(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&&se(e.init((i=e.get())=>{t=!0,r[1](n(i)),t=!1})),Gt({signal:r,create:e.create,utils:e.utils})}function Qt(e,t,n){return e.addEventListener(t,n),()=>e.removeEventListener(t,n)}function $t(e,t){let n=e&&document.getElementById(e);n?n.scrollIntoView():t&&window.scrollTo(0,0)}var en=new Map;function tn({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,vt);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=en.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))}}et([`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),se(()=>{document.removeEventListener(`click`,d),e&&(document.removeEventListener(`mousemove`,p),document.removeEventListener(`focusin`,f),document.removeEventListener(`touchstart`,f)),document.removeEventListener(`submit`,m)})}}var nn=`solid-router:scroll`;function rn(){window.history.scrollRestoration=`manual`,pt();let e={};try{e=JSON.parse(sessionStorage.getItem(nn))||{}}catch{}let t=()=>window.history.state&&window.history.state._depth,n=!1,r,i=[Qt(window,`scroll`,()=>{let i=t();i!=null&&(e[i]=window.scrollY),n||(r=void 0)}),Qt(window,`pagehide`,()=>{try{sessionStorage.setItem(nn,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){ne(ae(e.isRouting,e=>e||a(),{defer:!0})),se(()=>i.forEach(e=>e()));let[n]=performance.getEntriesByType&&performance.getEntriesByType(`navigation`);n&&n.type!==`navigate`&&(r=t(),a())}}}function an(e){let t=e.scrollRestoration?rn():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=dt();return Zt({get:n,set({value:e,replace:n,scroll:r,state:i}){n?window.history.replaceState(mt(i),``,e):window.history.pushState(i,``,e),$t(decodeURIComponent(window.location.hash.slice(1)),r),pt(),t&&!n&&t.onPush()},init:e=>{let i=ht(e,e=>{if(e)return!r.confirm(e);{let e=n();return!r.confirm(e.value,{state:e.state})}});return Qt(window,`popstate`,t?()=>{t.onPop(),i()}:i)},create:n=>{tn({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 on(e){return{ok:!0,value:e}}function sn(e){return{ok:!1,error:e}}var P;(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})(P||={});var cn;(function(e){e.mergeShapes=(e,t)=>({...e,...t})})(cn||={});var F=P.arrayToEnum([`string`,`nan`,`number`,`integer`,`float`,`boolean`,`date`,`bigint`,`symbol`,`function`,`undefined`,`null`,`array`,`object`,`unknown`,`promise`,`void`,`never`,`map`,`set`]),ln=e=>{switch(typeof e){case`undefined`:return F.undefined;case`string`:return F.string;case`number`:return Number.isNaN(e)?F.nan:F.number;case`boolean`:return F.boolean;case`function`:return F.function;case`bigint`:return F.bigint;case`symbol`:return F.symbol;case`object`:return Array.isArray(e)?F.array:e===null?F.null:e.then&&typeof e.then==`function`&&e.catch&&typeof e.catch==`function`?F.promise:typeof Map<`u`&&e instanceof Map?F.map:typeof Set<`u`&&e instanceof Set?F.set:typeof Date<`u`&&e instanceof Date?F.date:F.object;default:return F.unknown}},I=P.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`]),un=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,P.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()}};un.create=e=>new un(e);var dn=(e,t)=>{let n;switch(e.code){case I.invalid_type:n=e.received===F.undefined?`Required`:`Expected ${e.expected}, received ${e.received}`;break;case I.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,P.jsonStringifyReplacer)}`;break;case I.unrecognized_keys:n=`Unrecognized key(s) in object: ${P.joinValues(e.keys,`, `)}`;break;case I.invalid_union:n=`Invalid input`;break;case I.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${P.joinValues(e.options)}`;break;case I.invalid_enum_value:n=`Invalid enum value. Expected ${P.joinValues(e.options)}, received '${e.received}'`;break;case I.invalid_arguments:n=`Invalid function arguments`;break;case I.invalid_return_type:n=`Invalid function return type`;break;case I.invalid_date:n=`Invalid date`;break;case I.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}"`:P.assertNever(e.validation):n=e.validation===`regex`?`Invalid`:`Invalid ${e.validation}`;break;case I.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 I.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 I.custom:n=`Invalid input`;break;case I.invalid_intersection_types:n=`Intersection results could not be merged`;break;case I.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case I.not_finite:n=`Number must be finite`;break;default:n=t.defaultError,P.assertNever(e)}return{message:n}},fn=dn;function pn(){return fn}var mn=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 L(e,t){let n=pn(),r=mn({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===dn?void 0:dn].filter(e=>!!e)});e.common.issues.push(r)}var hn=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 R;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 R;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}}},R=Object.freeze({status:`aborted`}),gn=e=>({status:`dirty`,value:e}),_n=e=>({status:`valid`,value:e}),vn=e=>e.status===`aborted`,yn=e=>e.status===`dirty`,bn=e=>e.status===`valid`,xn=e=>typeof Promise<`u`&&e instanceof Promise,z;(function(e){e.errToObj=e=>typeof e==`string`?{message:e}:e||{},e.toString=e=>typeof e==`string`?e:e?.message})(z||={});var Sn=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}},Cn=(e,t)=>{if(bn(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 un(e.common.issues);return this._error=t,this._error}}};function B(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 V=class{get description(){return this._def.description}_getType(e){return ln(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:ln(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new hn,ctx:{common:e.parent.common,data:e.data,parsedType:ln(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(xn(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:ln(e)};return Cn(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:ln(e)};if(!this[`~standard`].async)try{let n=this._parseSync({data:e,path:[],parent:t});return bn(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=>bn(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:ln(e)},r=this._parse({data:e,path:n.path,parent:n});return Cn(n,await(xn(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:I.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 Er({schema:this,typeName:H.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 Dr.create(this,this._def)}nullable(){return Or.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return sr.create(this)}promise(){return Tr.create(this,this._def)}or(e){return ur.create([this,e],this._def)}and(e){return mr.create(this,e,this._def)}transform(e){return new Er({...B(this._def),schema:this,typeName:H.ZodEffects,effect:{type:`transform`,transform:e}})}default(e){let t=typeof e==`function`?e:()=>e;return new kr({...B(this._def),innerType:this,defaultValue:t,typeName:H.ZodDefault})}brand(){return new Mr({typeName:H.ZodBranded,type:this,...B(this._def)})}catch(e){let t=typeof e==`function`?e:()=>e;return new Ar({...B(this._def),innerType:this,catchValue:t,typeName:H.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Nr.create(this,e)}readonly(){return Pr.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},wn=/^c[^\s-]{8,}$/i,Tn=/^[0-9a-z]+$/,En=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Dn=/^[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,On=/^[a-z0-9_-]{21}$/i,kn=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,An=/^[-+]?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)?)??$/,jn=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Mn=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,Nn,Pn=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Fn=/^(?:(?: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])$/,In=/^(([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]))$/,Ln=/^(([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])$/,Rn=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,zn=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Bn=`((\\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])))`,Vn=RegExp(`^${Bn}$`);function Hn(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 Un(e){return RegExp(`^${Hn(e)}$`)}function Wn(e){let t=`${Bn}T${Hn(e)}`,n=[];return n.push(e.local?`Z?`:`Z`),e.offset&&n.push(`([+-]\\d{2}:?\\d{2})`),t=`${t}(${n.join(`|`)})`,RegExp(`^${t}$`)}function Gn(e,t){return!!((t===`v4`||!t)&&Pn.test(e)||(t===`v6`||!t)&&In.test(e))}function Kn(e,t){if(!kn.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 qn(e,t){return!!((t===`v4`||!t)&&Fn.test(e)||(t===`v6`||!t)&&Ln.test(e))}var Jn=class e extends V{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==F.string){let t=this._getOrReturnCtx(e);return L(t,{code:I.invalid_type,expected:F.string,received:t.parsedType}),R}let t=new hn,n;for(let r of this._def.checks)if(r.kind===`min`)e.data.length<r.value&&(n=this._getOrReturnCtx(e,n),L(n,{code:I.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),L(n,{code:I.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?L(n,{code:I.too_big,maximum:r.value,type:`string`,inclusive:!0,exact:!0,message:r.message}):a&&L(n,{code:I.too_small,minimum:r.value,type:`string`,inclusive:!0,exact:!0,message:r.message}),t.dirty())}else if(r.kind===`email`)jn.test(e.data)||(n=this._getOrReturnCtx(e,n),L(n,{validation:`email`,code:I.invalid_string,message:r.message}),t.dirty());else if(r.kind===`emoji`)Nn||=new RegExp(Mn,`u`),Nn.test(e.data)||(n=this._getOrReturnCtx(e,n),L(n,{validation:`emoji`,code:I.invalid_string,message:r.message}),t.dirty());else if(r.kind===`uuid`)Dn.test(e.data)||(n=this._getOrReturnCtx(e,n),L(n,{validation:`uuid`,code:I.invalid_string,message:r.message}),t.dirty());else if(r.kind===`nanoid`)On.test(e.data)||(n=this._getOrReturnCtx(e,n),L(n,{validation:`nanoid`,code:I.invalid_string,message:r.message}),t.dirty());else if(r.kind===`cuid`)wn.test(e.data)||(n=this._getOrReturnCtx(e,n),L(n,{validation:`cuid`,code:I.invalid_string,message:r.message}),t.dirty());else if(r.kind===`cuid2`)Tn.test(e.data)||(n=this._getOrReturnCtx(e,n),L(n,{validation:`cuid2`,code:I.invalid_string,message:r.message}),t.dirty());else if(r.kind===`ulid`)En.test(e.data)||(n=this._getOrReturnCtx(e,n),L(n,{validation:`ulid`,code:I.invalid_string,message:r.message}),t.dirty());else if(r.kind===`url`)try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),L(n,{validation:`url`,code:I.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),L(n,{validation:`regex`,code:I.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),L(n,{code:I.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),L(n,{code:I.invalid_string,validation:{startsWith:r.value},message:r.message}),t.dirty()):r.kind===`endsWith`?e.data.endsWith(r.value)||(n=this._getOrReturnCtx(e,n),L(n,{code:I.invalid_string,validation:{endsWith:r.value},message:r.message}),t.dirty()):r.kind===`datetime`?Wn(r).test(e.data)||(n=this._getOrReturnCtx(e,n),L(n,{code:I.invalid_string,validation:`datetime`,message:r.message}),t.dirty()):r.kind===`date`?Vn.test(e.data)||(n=this._getOrReturnCtx(e,n),L(n,{code:I.invalid_string,validation:`date`,message:r.message}),t.dirty()):r.kind===`time`?Un(r).test(e.data)||(n=this._getOrReturnCtx(e,n),L(n,{code:I.invalid_string,validation:`time`,message:r.message}),t.dirty()):r.kind===`duration`?An.test(e.data)||(n=this._getOrReturnCtx(e,n),L(n,{validation:`duration`,code:I.invalid_string,message:r.message}),t.dirty()):r.kind===`ip`?Gn(e.data,r.version)||(n=this._getOrReturnCtx(e,n),L(n,{validation:`ip`,code:I.invalid_string,message:r.message}),t.dirty()):r.kind===`jwt`?Kn(e.data,r.alg)||(n=this._getOrReturnCtx(e,n),L(n,{validation:`jwt`,code:I.invalid_string,message:r.message}),t.dirty()):r.kind===`cidr`?qn(e.data,r.version)||(n=this._getOrReturnCtx(e,n),L(n,{validation:`cidr`,code:I.invalid_string,message:r.message}),t.dirty()):r.kind===`base64`?Rn.test(e.data)||(n=this._getOrReturnCtx(e,n),L(n,{validation:`base64`,code:I.invalid_string,message:r.message}),t.dirty()):r.kind===`base64url`?zn.test(e.data)||(n=this._getOrReturnCtx(e,n),L(n,{validation:`base64url`,code:I.invalid_string,message:r.message}),t.dirty()):P.assertNever(r);return{status:t.value,value:e.data}}_regex(e,t,n){return this.refinement(t=>e.test(t),{validation:t,code:I.invalid_string,...z.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(e){return this._addCheck({kind:`email`,...z.errToObj(e)})}url(e){return this._addCheck({kind:`url`,...z.errToObj(e)})}emoji(e){return this._addCheck({kind:`emoji`,...z.errToObj(e)})}uuid(e){return this._addCheck({kind:`uuid`,...z.errToObj(e)})}nanoid(e){return this._addCheck({kind:`nanoid`,...z.errToObj(e)})}cuid(e){return this._addCheck({kind:`cuid`,...z.errToObj(e)})}cuid2(e){return this._addCheck({kind:`cuid2`,...z.errToObj(e)})}ulid(e){return this._addCheck({kind:`ulid`,...z.errToObj(e)})}base64(e){return this._addCheck({kind:`base64`,...z.errToObj(e)})}base64url(e){return this._addCheck({kind:`base64url`,...z.errToObj(e)})}jwt(e){return this._addCheck({kind:`jwt`,...z.errToObj(e)})}ip(e){return this._addCheck({kind:`ip`,...z.errToObj(e)})}cidr(e){return this._addCheck({kind:`cidr`,...z.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,...z.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,...z.errToObj(e?.message)})}duration(e){return this._addCheck({kind:`duration`,...z.errToObj(e)})}regex(e,t){return this._addCheck({kind:`regex`,regex:e,...z.errToObj(t)})}includes(e,t){return this._addCheck({kind:`includes`,value:e,position:t?.position,...z.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:`startsWith`,value:e,...z.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:`endsWith`,value:e,...z.errToObj(t)})}min(e,t){return this._addCheck({kind:`min`,value:e,...z.errToObj(t)})}max(e,t){return this._addCheck({kind:`max`,value:e,...z.errToObj(t)})}length(e,t){return this._addCheck({kind:`length`,value:e,...z.errToObj(t)})}nonempty(e){return this.min(1,z.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}};Jn.create=e=>new Jn({checks:[],typeName:H.ZodString,coerce:e?.coerce??!1,...B(e)});function Yn(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 Xn=class e extends V{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)!==F.number){let t=this._getOrReturnCtx(e);return L(t,{code:I.invalid_type,expected:F.number,received:t.parsedType}),R}let t,n=new hn;for(let r of this._def.checks)r.kind===`int`?P.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),L(t,{code:I.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),L(t,{code:I.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),L(t,{code:I.too_big,maximum:r.value,type:`number`,inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty()):r.kind===`multipleOf`?Yn(e.data,r.value)!==0&&(t=this._getOrReturnCtx(e,t),L(t,{code:I.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):r.kind===`finite`?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),L(t,{code:I.not_finite,message:r.message}),n.dirty()):P.assertNever(r);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit(`min`,e,!0,z.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,z.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,z.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,z.toString(t))}setLimit(t,n,r,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:z.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(e){return this._addCheck({kind:`int`,message:z.toString(e)})}positive(e){return this._addCheck({kind:`min`,value:0,inclusive:!1,message:z.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:0,inclusive:!1,message:z.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:0,inclusive:!0,message:z.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:0,inclusive:!0,message:z.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:z.toString(t)})}finite(e){return this._addCheck({kind:`finite`,message:z.toString(e)})}safe(e){return this._addCheck({kind:`min`,inclusive:!0,value:-(2**53-1),message:z.toString(e)})._addCheck({kind:`max`,inclusive:!0,value:2**53-1,message:z.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`&&P.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)}};Xn.create=e=>new Xn({checks:[],typeName:H.ZodNumber,coerce:e?.coerce||!1,...B(e)});var Zn=class e extends V{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)!==F.bigint)return this._getInvalidInput(e);let t,n=new hn;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),L(t,{code:I.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),L(t,{code:I.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),L(t,{code:I.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):P.assertNever(r);return{status:n.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return L(t,{code:I.invalid_type,expected:F.bigint,received:t.parsedType}),R}gte(e,t){return this.setLimit(`min`,e,!0,z.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,z.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,z.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,z.toString(t))}setLimit(t,n,r,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:z.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:z.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!1,message:z.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!0,message:z.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:BigInt(0),inclusive:!0,message:z.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:z.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}};Zn.create=e=>new Zn({checks:[],typeName:H.ZodBigInt,coerce:e?.coerce??!1,...B(e)});var Qn=class extends V{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==F.boolean){let t=this._getOrReturnCtx(e);return L(t,{code:I.invalid_type,expected:F.boolean,received:t.parsedType}),R}return _n(e.data)}};Qn.create=e=>new Qn({typeName:H.ZodBoolean,coerce:e?.coerce||!1,...B(e)});var $n=class e extends V{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==F.date){let t=this._getOrReturnCtx(e);return L(t,{code:I.invalid_type,expected:F.date,received:t.parsedType}),R}if(Number.isNaN(e.data.getTime()))return L(this._getOrReturnCtx(e),{code:I.invalid_date}),R;let t=new hn,n;for(let r of this._def.checks)r.kind===`min`?e.data.getTime()<r.value&&(n=this._getOrReturnCtx(e,n),L(n,{code:I.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),L(n,{code:I.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:`date`}),t.dirty()):P.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:z.toString(t)})}max(e,t){return this._addCheck({kind:`max`,value:e.getTime(),message:z.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)}};$n.create=e=>new $n({checks:[],coerce:e?.coerce||!1,typeName:H.ZodDate,...B(e)});var er=class extends V{_parse(e){if(this._getType(e)!==F.symbol){let t=this._getOrReturnCtx(e);return L(t,{code:I.invalid_type,expected:F.symbol,received:t.parsedType}),R}return _n(e.data)}};er.create=e=>new er({typeName:H.ZodSymbol,...B(e)});var tr=class extends V{_parse(e){if(this._getType(e)!==F.undefined){let t=this._getOrReturnCtx(e);return L(t,{code:I.invalid_type,expected:F.undefined,received:t.parsedType}),R}return _n(e.data)}};tr.create=e=>new tr({typeName:H.ZodUndefined,...B(e)});var nr=class extends V{_parse(e){if(this._getType(e)!==F.null){let t=this._getOrReturnCtx(e);return L(t,{code:I.invalid_type,expected:F.null,received:t.parsedType}),R}return _n(e.data)}};nr.create=e=>new nr({typeName:H.ZodNull,...B(e)});var rr=class extends V{constructor(){super(...arguments),this._any=!0}_parse(e){return _n(e.data)}};rr.create=e=>new rr({typeName:H.ZodAny,...B(e)});var ir=class extends V{constructor(){super(...arguments),this._unknown=!0}_parse(e){return _n(e.data)}};ir.create=e=>new ir({typeName:H.ZodUnknown,...B(e)});var ar=class extends V{_parse(e){let t=this._getOrReturnCtx(e);return L(t,{code:I.invalid_type,expected:F.never,received:t.parsedType}),R}};ar.create=e=>new ar({typeName:H.ZodNever,...B(e)});var or=class extends V{_parse(e){if(this._getType(e)!==F.undefined){let t=this._getOrReturnCtx(e);return L(t,{code:I.invalid_type,expected:F.void,received:t.parsedType}),R}return _n(e.data)}};or.create=e=>new or({typeName:H.ZodVoid,...B(e)});var sr=class e extends V{_parse(e){let{ctx:t,status:n}=this._processInputParams(e),r=this._def;if(t.parsedType!==F.array)return L(t,{code:I.invalid_type,expected:F.array,received:t.parsedType}),R;if(r.exactLength!==null){let e=t.data.length>r.exactLength.value,i=t.data.length<r.exactLength.value;(e||i)&&(L(t,{code:e?I.too_big:I.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&&(L(t,{code:I.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&&(L(t,{code:I.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 Sn(t,e,t.path,n)))).then(e=>hn.mergeArray(n,e));let i=[...t.data].map((e,n)=>r.type._parseSync(new Sn(t,e,t.path,n)));return hn.mergeArray(n,i)}get element(){return this._def.type}min(t,n){return new e({...this._def,minLength:{value:t,message:z.toString(n)}})}max(t,n){return new e({...this._def,maxLength:{value:t,message:z.toString(n)}})}length(t,n){return new e({...this._def,exactLength:{value:t,message:z.toString(n)}})}nonempty(e){return this.min(1,e)}};sr.create=(e,t)=>new sr({type:e,minLength:null,maxLength:null,exactLength:null,typeName:H.ZodArray,...B(t)});function cr(e){if(e instanceof lr){let t={};for(let n in e.shape){let r=e.shape[n];t[n]=Dr.create(cr(r))}return new lr({...e._def,shape:()=>t})}return e instanceof sr?new sr({...e._def,type:cr(e.element)}):e instanceof Dr?Dr.create(cr(e.unwrap())):e instanceof Or?Or.create(cr(e.unwrap())):e instanceof hr?hr.create(e.items.map(e=>cr(e))):e}var lr=class e extends V{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=P.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==F.object){let t=this._getOrReturnCtx(e);return L(t,{code:I.invalid_type,expected:F.object,received:t.parsedType}),R}let{status:t,ctx:n}=this._processInputParams(e),{shape:r,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof ar&&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 Sn(n,i,n.path,e)),alwaysSet:e in n.data})}if(this._def.catchall instanceof ar){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&&(L(n,{code:I.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 Sn(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=>hn.mergeObjectSync(t,e)):hn.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(t){return z.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:z.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:H.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 P.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 P.objectKeys(this.shape))t[e]||(n[e]=this.shape[e]);return new e({...this._def,shape:()=>n})}deepPartial(){return cr(this)}partial(t){let n={};for(let e of P.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 P.objectKeys(this.shape))if(t&&!t[e])n[e]=this.shape[e];else{let t=this.shape[e];for(;t instanceof Dr;)t=t._def.innerType;n[e]=t}return new e({...this._def,shape:()=>n})}keyof(){return Sr(P.objectKeys(this.shape))}};lr.create=(e,t)=>new lr({shape:()=>e,unknownKeys:`strip`,catchall:ar.create(),typeName:H.ZodObject,...B(t)}),lr.strictCreate=(e,t)=>new lr({shape:()=>e,unknownKeys:`strict`,catchall:ar.create(),typeName:H.ZodObject,...B(t)}),lr.lazycreate=(e,t)=>new lr({shape:e,unknownKeys:`strip`,catchall:ar.create(),typeName:H.ZodObject,...B(t)});var ur=class extends V{_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 un(e.ctx.common.issues));return L(t,{code:I.invalid_union,unionErrors:n}),R}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 un(e));return L(t,{code:I.invalid_union,unionErrors:i}),R}}get options(){return this._def.options}};ur.create=(e,t)=>new ur({options:e,typeName:H.ZodUnion,...B(t)});var dr=e=>e instanceof br?dr(e.schema):e instanceof Er?dr(e.innerType()):e instanceof xr?[e.value]:e instanceof Cr?e.options:e instanceof wr?P.objectValues(e.enum):e instanceof kr?dr(e._def.innerType):e instanceof tr?[void 0]:e instanceof nr?[null]:e instanceof Dr?[void 0,...dr(e.unwrap())]:e instanceof Or?[null,...dr(e.unwrap())]:e instanceof Mr||e instanceof Pr?dr(e.unwrap()):e instanceof Ar?dr(e._def.innerType):[],fr=class e extends V{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==F.object)return L(t,{code:I.invalid_type,expected:F.object,received:t.parsedType}),R;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}):(L(t,{code:I.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),R)}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=dr(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:H.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:i,...B(r)})}};function pr(e,t){let n=ln(e),r=ln(t);if(e===t)return{valid:!0,data:e};if(n===F.object&&r===F.object){let n=P.objectKeys(t),r=P.objectKeys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=pr(e[n],t[n]);if(!r.valid)return{valid:!1};i[n]=r.data}return{valid:!0,data:i}}if(n===F.array&&r===F.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=pr(i,a);if(!o.valid)return{valid:!1};n.push(o.data)}return{valid:!0,data:n}}return n===F.date&&r===F.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var mr=class extends V{_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=(e,r)=>{if(vn(e)||vn(r))return R;let i=pr(e.value,r.value);return i.valid?((yn(e)||yn(r))&&t.dirty(),{status:t.value,value:i.data}):(L(n,{code:I.invalid_intersection_types}),R)};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}))}};mr.create=(e,t,n)=>new mr({left:e,right:t,typeName:H.ZodIntersection,...B(n)});var hr=class e extends V{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==F.array)return L(n,{code:I.invalid_type,expected:F.array,received:n.parsedType}),R;if(n.data.length<this._def.items.length)return L(n,{code:I.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:`array`}),R;!this._def.rest&&n.data.length>this._def.items.length&&(L(n,{code:I.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 Sn(n,e,n.path,t)):null}).filter(e=>!!e);return n.common.async?Promise.all(r).then(e=>hn.mergeArray(t,e)):hn.mergeArray(t,r)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};hr.create=(e,t)=>{if(!Array.isArray(e))throw Error(`You must pass an array of schemas to z.tuple([ ... ])`);return new hr({items:e,typeName:H.ZodTuple,rest:null,...B(t)})};var gr=class e extends V{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!==F.object)return L(n,{code:I.invalid_type,expected:F.object,received:n.parsedType}),R;let r=[],i=this._def.keyType,a=this._def.valueType;for(let e in n.data)r.push({key:i._parse(new Sn(n,e,n.path,e)),value:a._parse(new Sn(n,n.data[e],n.path,e)),alwaysSet:e in n.data});return n.common.async?hn.mergeObjectAsync(t,r):hn.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof V?new e({keyType:t,valueType:n,typeName:H.ZodRecord,...B(r)}):new e({keyType:Jn.create(),valueType:t,typeName:H.ZodRecord,...B(n)})}},_r=class extends V{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!==F.map)return L(n,{code:I.invalid_type,expected:F.map,received:n.parsedType}),R;let r=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([e,t],a)=>({key:r._parse(new Sn(n,e,n.path,[a,`key`])),value:i._parse(new Sn(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 R;(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 R;(r.status===`dirty`||i.status===`dirty`)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}}}};_r.create=(e,t,n)=>new _r({valueType:t,keyType:e,typeName:H.ZodMap,...B(n)});var vr=class e extends V{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==F.set)return L(n,{code:I.invalid_type,expected:F.set,received:n.parsedType}),R;let r=this._def;r.minSize!==null&&n.data.size<r.minSize.value&&(L(n,{code:I.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&&(L(n,{code:I.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 R;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 Sn(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:z.toString(n)}})}max(t,n){return new e({...this._def,maxSize:{value:t,message:z.toString(n)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};vr.create=(e,t)=>new vr({valueType:e,minSize:null,maxSize:null,typeName:H.ZodSet,...B(t)});var yr=class e extends V{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==F.function)return L(t,{code:I.invalid_type,expected:F.function,received:t.parsedType}),R;function n(e,n){return mn({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,pn(),dn].filter(e=>!!e),issueData:{code:I.invalid_arguments,argumentsError:n}})}function r(e,n){return mn({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,pn(),dn].filter(e=>!!e),issueData:{code:I.invalid_return_type,returnTypeError:n}})}let i={errorMap:t.common.contextualErrorMap},a=t.data;if(this._def.returns instanceof Tr){let e=this;return _n(async function(...t){let o=new un([]),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 _n(function(...t){let o=e._def.args.safeParse(t,i);if(!o.success)throw new un([n(t,o.error)]);let s=Reflect.apply(a,this,o.data),c=e._def.returns.safeParse(s,i);if(!c.success)throw new un([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:hr.create(t).rest(ir.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||hr.create([]).rest(ir.create()),returns:n||ir.create(),typeName:H.ZodFunction,...B(r)})}},br=class extends V{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})}};br.create=(e,t)=>new br({getter:e,typeName:H.ZodLazy,...B(t)});var xr=class extends V{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return L(t,{received:t.data,code:I.invalid_literal,expected:this._def.value}),R}return{status:`valid`,value:e.data}}get value(){return this._def.value}};xr.create=(e,t)=>new xr({value:e,typeName:H.ZodLiteral,...B(t)});function Sr(e,t){return new Cr({values:e,typeName:H.ZodEnum,...B(t)})}var Cr=class e extends V{_parse(e){if(typeof e.data!=`string`){let t=this._getOrReturnCtx(e),n=this._def.values;return L(t,{expected:P.joinValues(n),received:t.parsedType,code:I.invalid_type}),R}if(this._cache||=new Set(this._def.values),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),n=this._def.values;return L(t,{received:t.data,code:I.invalid_enum_value,options:n}),R}return _n(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})}};Cr.create=Sr;var wr=class extends V{_parse(e){let t=P.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==F.string&&n.parsedType!==F.number){let e=P.objectValues(t);return L(n,{expected:P.joinValues(e),received:n.parsedType,code:I.invalid_type}),R}if(this._cache||=new Set(P.getValidEnumValues(this._def.values)),!this._cache.has(e.data)){let e=P.objectValues(t);return L(n,{received:n.data,code:I.invalid_enum_value,options:e}),R}return _n(e.data)}get enum(){return this._def.values}};wr.create=(e,t)=>new wr({values:e,typeName:H.ZodNativeEnum,...B(t)});var Tr=class extends V{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);return t.parsedType!==F.promise&&t.common.async===!1?(L(t,{code:I.invalid_type,expected:F.promise,received:t.parsedType}),R):_n((t.parsedType===F.promise?t.data:Promise.resolve(t.data)).then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}};Tr.create=(e,t)=>new Tr({type:e,typeName:H.ZodPromise,...B(t)});var Er=class extends V{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===H.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=>{L(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 R;let r=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return r.status===`aborted`?R:r.status===`dirty`||t.value===`dirty`?gn(r.value):r});{if(t.value===`aborted`)return R;let r=this._def.schema._parseSync({data:e,path:n.path,parent:n});return r.status===`aborted`?R:r.status===`dirty`||t.value===`dirty`?gn(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`?R:(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`?R:(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(!bn(e))return R;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=>bn(e)?Promise.resolve(r.transform(e.value,i)).then(e=>({status:t.value,value:e})):R)}P.assertNever(r)}};Er.create=(e,t,n)=>new Er({schema:e,typeName:H.ZodEffects,effect:t,...B(n)}),Er.createWithPreprocess=(e,t,n)=>new Er({schema:t,effect:{type:`preprocess`,transform:e},typeName:H.ZodEffects,...B(n)});var Dr=class extends V{_parse(e){return this._getType(e)===F.undefined?_n(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Dr.create=(e,t)=>new Dr({innerType:e,typeName:H.ZodOptional,...B(t)});var Or=class extends V{_parse(e){return this._getType(e)===F.null?_n(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Or.create=(e,t)=>new Or({innerType:e,typeName:H.ZodNullable,...B(t)});var kr=class extends V{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return t.parsedType===F.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};kr.create=(e,t)=>new kr({innerType:e,typeName:H.ZodDefault,defaultValue:typeof t.default==`function`?t.default:()=>t.default,...B(t)});var Ar=class extends V{_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 xn(r)?r.then(e=>({status:`valid`,value:e.status===`valid`?e.value:this._def.catchValue({get error(){return new un(n.common.issues)},input:n.data})})):{status:`valid`,value:r.status===`valid`?r.value:this._def.catchValue({get error(){return new un(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Ar.create=(e,t)=>new Ar({innerType:e,typeName:H.ZodCatch,catchValue:typeof t.catch==`function`?t.catch:()=>t.catch,...B(t)});var jr=class extends V{_parse(e){if(this._getType(e)!==F.nan){let t=this._getOrReturnCtx(e);return L(t,{code:I.invalid_type,expected:F.nan,received:t.parsedType}),R}return{status:`valid`,value:e.data}}};jr.create=e=>new jr({typeName:H.ZodNaN,...B(e)});var Mr=class extends V{_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}},Nr=class e extends V{_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`?R:e.status===`dirty`?(t.dirty(),gn(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`?R: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:H.ZodPipeline})}},Pr=class extends V{_parse(e){let t=this._def.innerType._parse(e),n=e=>(bn(e)&&(e.value=Object.freeze(e.value)),e);return xn(t)?t.then(e=>n(e)):n(t)}unwrap(){return this._def.innerType}};Pr.create=(e,t)=>new Pr({innerType:e,typeName:H.ZodReadonly,...B(t)}),lr.lazycreate;var H;(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`})(H||={});var Fr=Jn.create,Ir=Xn.create;jr.create,Zn.create;var U=Qn.create;$n.create,er.create,tr.create;var Lr=nr.create;rr.create,ir.create,ar.create,or.create;var W=sr.create,G=lr.create;lr.strictCreate;var Rr=ur.create,zr=fr.create;mr.create;var Br=hr.create;gr.create,_r.create,vr.create,yr.create,br.create;var K=xr.create,Vr=Cr.create;wr.create,Tr.create,Er.create,Dr.create,Or.create,Er.createWithPreprocess,Nr.create;var Hr=G({code:Vr([`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:Fr(),message:Fr()}).strict();function Ur(e,t,n){return{code:e,attempted:t,message:n}}function Wr(e,t,n){return sn(Ur(e,t,n))}var Gr=`/api/health`,Kr=`/api/registration`,qr=`/api/update`,Jr=`/api/topology/pending-review`,Yr=`/api/topology`,Xr=`/api/identity/enumerate`,Zr=`/api/identity`,Qr=`/api/identity/trust`,$r=`/api/identity/verify`,ei=`/api/identity`,ti=`x-operator-token`,ni=G({source:Vr([`daemon`,`mcp-server`]),contract:Ir().int().nonnegative(),version:Fr().min(1),asOf:Fr().datetime(),provenance:Fr().min(1)});function q(e){return ni.extend({value:e})}var ri=Vr([`open`,`unreadable`]),ii=q(G({durableStore:ri,runtimeStore:ri,surface:Fr().url()}));G({path:Fr().trim().min(1,`path is required`)}),q(G({recorded:U()}));var J=Fr().trim().min(1),ai=Vr([`app`,`iac`,`mixed`]),oi=Vr([`application`,`environment`,`service`,`service_instance`,`system_ref`,`repo`]);G({kind:oi,key:J}).strict();var si=G({applicationKey:J,name:J}).strict(),ci=G({environmentKey:J,applicationKey:J,name:J}).strict(),li=G({serviceKey:J,name:J,description:J.nullish()}).strict(),ui=G({serviceInstanceKey:J,environmentKey:J,serviceKey:J,name:J}).strict(),di=G({systemRefKey:J,provider:J,kind:J,name:J.nullish(),source:J.nullish()}).strict(),fi=G({repoKey:J,name:J,role:ai,remoteUrl:J.nullish()}).strict();G({repoKey:J,name:J,role:ai.nullable(),remoteUrl:J.nullish()}).strict(),G({repoKey:J,localPath:J,branch:J.nullable(),commitSha:J.nullable(),dirty:U(),detachedHead:U(),discoveryRunFingerprint:J,scanSourceKey:J,scannedAt:J}).strict(),G({applicationKey:J,serviceKey:J}).strict(),zr(`kind`,[G({kind:K(`application`),payload:si}).strict(),G({kind:K(`environment`),payload:ci}).strict(),G({kind:K(`service`),payload:li}).strict(),G({kind:K(`service_instance`),payload:ui}).strict(),G({kind:K(`system_ref`),payload:di}).strict(),G({kind:K(`repo`),payload:fi}).strict()]);var pi=2e4;function mi(e,t,n){if(e===`aws`)return hi(t,n);let r=gi[e];return r===void 0?null:r(t)}function hi(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 gi={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}`})},_i=G({provider:J,selector:J,alias:J.nullable(),approvedAt:J,lastSuccessAt:J.nullable(),consecutiveFailures:Ir().int().nonnegative()}).strict(),vi=[/^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 yi(e){return vi.some(t=>t.test(e.trim()))}var bi=J.refine(e=>!yi(e),`selector looks like credential material, not a bare label`);G({provider:J,selector:J}).strict(),G({provider:J,selector:bi,alias:J.nullish()}).strict(),G({provider:J,selector:J,succeeded:U()}).strict(),q(G({identity:_i.nullable()}));var xi=q(G({identities:W(_i)})),Si=q(G({identity:_i,created:U()})),Ci=q(G({succeeded:U(),message:J.nullable()})),wi=q(G({removed:U()}));q(G({identity:_i}));var Ti=q(G({candidates:W(G({provider:J,selector:J,awsMechanism:zr(`kind`,[G({kind:K(`sso`)}).strict(),G({kind:K(`static-keys`)}).strict(),G({kind:K(`assume-role`),sourceProfile:J}).strict(),G({kind:K(`credential-process`)}).strict(),G({kind:K(`unknown`)}).strict()]).optional()}).strict())}));function Ei(e){return Fr().trim().min(1,`${e} is required`)}var Di=G({firstName:Ei(`First name`),lastName:Ei(`Last name`),email:Fr().trim().email(`Enter a well formed email address`),company:Ei(`Company`),title:Fr().trim().default(``)}),Oi=q(G({registered:U()})),ki=`/register`;q(G({enabled:U()})),G({enabled:U()}).strict();var Ai=Fr().trim().min(1).max(64);G({tool:Ai,provider:Ai.nullish()}).strict(),q(G({recorded:U()}));function ji(e,t,n){let r=e.safeParse(t);return r.success?on(r.data):Wr(`invalid_shape`,n,r.error.issues.map(e=>`${e.path.join(`.`)||`(root)`}: ${e.message}`).join(`; `))}var Mi=q(G({status:Vr([`ineligible`,`disabled`,`checking`]),newerVersion:Fr().nullable()})),Ni=5e3;function Pi({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??Ni),headers:{[ti]:t,...o===void 0?{}:{"content-type":`application/json`}},...o===void 0?{}:{body:JSON.stringify(o)}})}catch(e){return Wr(`daemon_unreachable`,a,`no answer from ${c}: ${String(e)}`)}if(l.status===401)return Wr(`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=Hr.safeParse(e);return t.success?sn(t.data):Wr(`daemon_unreachable`,a,`the daemon answered ${String(l.status)}`)}return ji(i,await l.json(),a)}}var Fi=e=>G({kind:Vr(e),key:J}).strict(),Ii=Fi([`environment`]),Li=Fi([`service`]),Ri=Fi([`service_instance`]),zi=Fi([`system_ref`]),Bi=Fi([`repo`]),Vi=Fi([`application`]),Hi=G({source:Ii,target:zi}).strict(),Ui=G({source:Rr([Ii,Ri]),target:zi}).strict(),Wi=G({source:zi,target:zi}).strict(),Gi=G({source:Rr([Vi,Li]),target:Bi}).strict(),Ki=G({source:Rr([Ii,Ri]),target:Bi}).strict(),qi=G({source:Rr([Ii,Ri]),target:zi}).strict(),Ji=Vr([`connected_via`,`observed_by`,`accessed_via`,`implemented_in`,`deployed_from`,`provided_as`]);zr(`kind`,[G({kind:K(`connected_via`),payload:Hi}).strict(),G({kind:K(`observed_by`),payload:Ui}).strict(),G({kind:K(`accessed_via`),payload:Wi}).strict(),G({kind:K(`implemented_in`),payload:Gi}).strict(),G({kind:K(`deployed_from`),payload:Ki}).strict(),G({kind:K(`provided_as`),payload:qi}).strict()]);var Yi=Vr([`repo_file`,`api_response`,`operator_note`,`derived_note`]),Xi=J.refine(e=>{let t=new Date(e);return!Number.isNaN(t.valueOf())&&t.toISOString()===e},`Expected ISO timestamp.`),Zi=G({kind:K(`repo_file`),repoKey:J,scanSourceKey:J.optional(),path:J,line:Ir().int().positive(),commitSha:J,dirty:U(),snippet:Fr().refine(e=>e.trim().length>0,`Expected non-blank snippet.`).optional(),repoScanId:Ir().int().positive().optional()}).strict(),Qi=G({kind:K(`api_response`),systemKey:J,capturedAt:Xi,summary:J.optional(),locator:J.optional()}).strict(),$i=G({kind:K(`operator_note`),text:J,createdAt:Xi}).strict(),ea=Vr([`legacy_migration`,`uncited_observation`,`name_match`]);W(zr(`kind`,[Zi,Qi,$i,G({kind:K(`derived_note`),text:J,createdAt:Xi,origin:ea}).strict()]));var ta={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(ta.applications),services:K(ta.services),memberships:K(ta.memberships),implementations:K(ta.implementations),repos:K(ta.repos),facts:K(ta.facts),citations:K(ta.citations),environments:K(ta.environments),serviceInstances:K(ta.serviceInstances),deployedFrom:K(ta.deployedFrom),connectedVia:K(ta.connectedVia)}).strict();var na=G({kind:Vr([`application`,`service`,`repo`,`environment`,`service_instance`,`system_ref`]),displayName:J,diagnostic:G({canonicalKey:J,visibility:K(`diagnostic_only`)}).strip()}).strip(),ra=G({kind:Vr([`application`,`service`,`environment`,`service_instance`,`application_service_membership`,`implemented_in`,`deployed_from`,`connected_via`]),canonicalFactKey:J,citationKeys:W(J)}).strip(),ia=G({key:J,kind:Yi,label:J,labelTruncated:U()}).strip(),aa=G({application:na,service:na,canonicalFactKey:J,citationKeys:W(J)}).strip(),oa=G({source:na,repo:na,canonicalFactKey:J,citationKeys:W(J)}).strip(),sa=G({source:na,repo:na,canonicalFactKey:J,citationKeys:W(J),note:J}).strip(),ca=G({environment:na,system:na,canonicalFactKey:J,citationKeys:W(J)}).strip(),la=G({parentEnvironment:na,deployedFrom:W(sa),connectedVia:W(ca),label:K(`supplemental_inherited_operational_context`),note:J}).strip(),ua=G({applications:U(),services:U(),memberships:U(),implementations:U(),repos:U(),facts:U(),citations:U(),environments:U(),serviceInstances:U(),deployedFrom:U(),connectedVia:U()}).strip(),da=q(G({matched:na,applications:W(na),services:W(na),environments:W(na),serviceInstances:W(na),repos:W(na),memberships:W(aa),implementations:W(oa),directDeploymentProvenance:W(sa),providerAssociations:W(ca),inheritedOperationalContext:la.optional(),facts:W(ra),citations:W(ia),truncation:ua}).strip()).extend({source:K(`daemon`)}),fa=Br([K(`application`),K(`service`),K(`environment`),K(`service_instance`)]),pa=G({subjectKinds:fa,aliasKinds:Br([K(`application`),K(`service`)])}).strip(),ma=q(G({code:K(`topology_subject_not_found`),message:J,searchScope:pa}).strip()).extend({source:K(`daemon`)}),ha=na.extend({kind:Vr([`application`,`service`,`environment`,`service_instance`])});Rr([Rr([da,ma,q(G({code:K(`topology_subject_ambiguous`),message:J,searchScope:G({subjectKinds:fa}).strip(),matches:W(ha).min(2).max(25),matchesTruncated:U(),retryWith:K(`canonical_key`)}).strip()).extend({source:K(`daemon`)})]),G({code:Vr([`topology_lookup_invalid_input`,`topology_lookup_input_too_large`]),attempted:K(`look up committed topology`),message:J}).strip(),G({code:K(`topology_lookup_output_too_large`),attempted:K(`serialize a committed topology lookup`),message:J}).strip(),G({code:K(`topology_storage_fault`),attempted:K(`project a committed topology neighborhood`),message:J}).strip()]);var ga=K(`currently_reviewable_topology_candidates_v1`),_a=q(G({count:Ir().int().nonnegative(),scope:ga}).strip()).extend({source:K(`daemon`)}),va=Fr().refine(e=>e.trim().length>0,{message:`String must contain a non-whitespace character`}),ya=W(G({sourceFile:J,sourceLine:Ir().int().positive(),sourceSnippet:va,rationale:J}).strict()).min(1),ba=W(J).nullable(),xa=G({vcs:K(`git`),provider:J,project:J,localRoot:J}).strict(),Sa=G({project:J,neededFor:J,subject:J,note:J,sources:ya}).strict(),Ca=G({name:J,scope:Vr([`shared`,`application_scoped`]),sources:ya}).strict(),wa=G({name:J,aliases:ba,sources:ya}).strict(),Ta=G({applicationName:J,sources:ya}).strict(),Ea=G({name:J,aliases:ba,sources:ya}).strict(),Da=G({applicationName:J,logicalServiceName:J,sources:ya}).strict(),Oa=G({name:J,applicationName:Fr().nullable(),coreInfraName:Fr().nullable(),sources:ya}).strict(),ka=G({deployedName:J,logicalServiceName:Fr().nullable(),applicationName:Fr().nullable(),environmentName:J,sources:ya}).strict(),Aa=G({kind:Vr([`aws-profile`,`aws-role`]),value:J,applicationName:Fr().nullable(),environmentName:Fr().nullable(),sources:ya}).strict(),ja=G({repo:xa,additionalReposNeeded:W(Sa),coreInfraSignals:W(Ca),applications:W(wa),implementedApplications:W(Ta),logicalServices:W(Ea),applicationServiceMemberships:W(Da),environments:W(Oa),serviceInstances:W(ka),runtimeAccessSignals:W(Aa)}).strict().omit({repo:!0}),Ma=G({repoKey:J,commitSha:J,draftGeneration:Ir().int().positive(),repoScanId:Ir().int().positive()}).strip();G({path:J,binding:Ma,candidates:ja}).strict(),Rr([G({path:J}).strict(),G({repoKey:J}).strict()]);var Na=G({path:J,snippet:J,category:J}).strip(),Pa=G({category:J,count:Ir().int().nonnegative()}).strip(),Fa=G({guidance:J,files:W(Na),categoryComposition:W(Pa)}).strip();Rr([q(G({code:K(`ready`),path:J,binding:Ma,context:Fa}).strip()).extend({source:K(`daemon`)}),q(G({code:K(`unknown_repo_key`),message:J,repoKey:J,searchedScope:K(`pending_discovery_drafts_by_repo_key_v1`)}).strip()).extend({source:K(`daemon`)}),q(G({code:K(`locally_unresolvable`),message:J,binding:Ma,searchedScope:K(`producing_checkout_resolution_and_repository_identity_v1`)}).strip()).extend({source:K(`daemon`)}),q(G({code:K(`scan_failed`),message:J,cause:J,retryable:K(!0)}).strip()).extend({source:K(`daemon`)})]);var Ia=Rr([G({collection:K(`repo`)}).strip(),G({collection:Vr([`additionalReposNeeded`,`coreInfraSignals`,`applications`,`implementedApplications`,`logicalServices`,`applicationServiceMemberships`,`environments`,`serviceInstances`,`runtimeAccessSignals`]),index:Ir().int().nonnegative()}).strip()]),La=G({fact:Ia,reason:Vr([`ungrounded`,`unmappable`]),message:J}).strip(),Ra=q(G({code:K(`submitted`),binding:Ma,candidatesStaged:Ir().int().nonnegative(),droppedFacts:W(La)}).strip()).extend({source:K(`daemon`)}),za=q(G({code:K(`repository_changed`),binding:Ma,message:J,candidatesStaged:K(0),rejectedFact:K(`submission`)}).strip()).extend({source:K(`daemon`)}),Ba=q(G({code:K(`schema_invalid`),binding:Ma,message:J,candidatesStaged:K(0),rejectedFact:K(`submission`)}).strip()).extend({source:K(`daemon`)}),Va=G({fact:Ia,sourceIndex:Ir().int().nonnegative(),code:Vr([`invalid_source_path`,`source_not_committed`,`source_not_blob`,`source_blob_unavailable`,`invalid_source_line`,`source_line_unavailable`,`source_snippet_mismatch`]),sourceFile:J,sourceLine:Ir().int().positive(),message:J}).strip();Rr([Ra,za,Ba,q(G({code:K(`evidence_invalid`),binding:Ma,message:J,candidatesStaged:K(0),failures:W(Va).min(1),retryable:K(!0)}).strip()).extend({source:K(`daemon`)})]);var Ha=Vr([`prompt_submit`,`session_start`]),Ua=K(`current_repository_and_session_unattempted_pending_scanned_drafts_v1`);G({sessionId:J,cwd:J,triggerEvent:Ha}).strict();var Wa=Rr([G({totalCount:K(0),nextRepoKey:Lr(),nextRepoName:Lr()}).strip(),G({totalCount:Ir().int().positive().max(2**53-1),nextRepoKey:J,nextRepoName:J}).strip()]),Ga=G({triggerEvent:Ha,scope:Ua});q(Rr([Ga.extend({currentRepositoryEligible:K(!1),pendingNudgeSet:G({totalCount:K(0),nextRepoKey:Lr(),nextRepoName:Lr()}).strip(),nudgeText:Lr()}).strip(),Ga.extend({currentRepositoryEligible:K(!0),pendingNudgeSet:Wa,nudgeText:J}).strip(),Ga.extend({currentRepositoryEligible:K(!1),pendingNudgeSet:G({totalCount:Ir().int().positive().max(2**53-1),nextRepoKey:J,nextRepoName:J}).strip(),nudgeText:J}).strip()])).extend({source:K(`daemon`)}),G({path:J}).strict();var Ka=K(`requested_repository_path_scan_dispatch_v1`);q(G({acknowledged:K(!0),scope:Ka}).strip()).extend({source:K(`daemon`)});var qa=K(`install_time_repository_candidates_pending_and_error_v1`),Ja=Ir().int().nonnegative().max(2**53-1);q(G({processedCount:Ja,clearedNonRepositoryCount:Ja,errorCount:Ja,scope:qa}).strip()).extend({source:K(`daemon`)});var Ya={id:J,key:J,label:J,providers:W(J)},Xa=zr(`kind`,[G({kind:K(`application`),...Ya}).strip(),G({kind:K(`environment`),...Ya,applicationKey:J}).strip(),G({kind:K(`service`),...Ya,applicationKeys:W(J)}).strip(),G({kind:K(`service_instance`),...Ya,environmentKey:J,serviceKey:J}).strip(),G({kind:K(`system_ref`),...Ya}).strip(),G({kind:K(`repo`),...Ya}).strip()]),Za=G({id:J,kind:Ji,source:J,target:J}).strip(),Qa=G({providers:W(J),kinds:W(oi),applications:W(J)}).strip(),$a=G({nodeCount:Ir().int().nonnegative(),edgeCount:Ir().int().nonnegative()}).strip();G({provider:J.optional(),kind:oi.optional(),q:J.optional()}).strict();var eo=q(G({nodes:W(Xa),edges:W(Za),facets:Qa,totals:$a}).strip()).extend({source:K(`daemon`)});Vr([`repo_role`,`application`,`service`,`application_service_membership`,`implemented_in`,`environment`,`service_instance`,`deployed_from`,`connected_via`]),Vr([`hierarchy`,`environment`]);var to=G({repoKey:J,role:ai,hasApplication:U(),hasService:U(),hasIac:U()}).strict(),no=G({applicationKey:J,name:J,aliases:W(J)}).strict(),ro=G({serviceKey:J,name:J,aliases:W(J),description:J.optional(),derivedFromRepoIdentity:U(),owningRepoKey:J.nullable().optional(),serviceCardinality:Ir().int().positive().optional(),serviceDiscriminator:J.optional()}).strict(),io=G({applicationKey:J,serviceKey:J}).strict(),ao=Gi,oo=G({environmentKey:J,applicationKey:J,name:J}).strict(),so=G({serviceInstanceKey:J,environmentKey:J,applicationKey:J,logicalServiceKey:J,name:J}).strict(),co=Ki,lo=G({environmentKey:J,systemKey:J,provider:J,authorityKind:J,authorityDisplayName:J,contributingCandidateId:J.optional()}).strict();zr(`kind`,[G({kind:K(`repo_role`),reviewScope:K(`hierarchy`),payload:to}).strict(),G({kind:K(`application`),reviewScope:K(`hierarchy`),payload:no}).strict(),G({kind:K(`service`),reviewScope:K(`hierarchy`),payload:ro}).strict(),G({kind:K(`application_service_membership`),reviewScope:K(`hierarchy`),payload:io}).strict(),G({kind:K(`implemented_in`),reviewScope:K(`hierarchy`),payload:ao}).strict(),G({kind:K(`environment`),reviewScope:K(`environment`),payload:oo}).strict(),G({kind:K(`service_instance`),reviewScope:K(`environment`),payload:so}).strict(),G({kind:K(`deployed_from`),reviewScope:K(`environment`),payload:co}).strict(),G({kind:K(`connected_via`),reviewScope:K(`environment`),payload:lo}).strict()]),G({applicationKey:J,alias:J}).strict(),G({serviceKey:J,alias:J}).strict();function uo(){return document.querySelector(`meta[name="operator-token"]`)?.getAttribute(`content`)??``}var fo=Pi({origin:``,token:uo()}),po=[`system`,`light`,`dark`],mo=`opscanvas.web.colorMode`,ho=`data-color-mode`;function go(e){return e!==null&&po.includes(e)}var _o={getItem:()=>null,setItem:()=>void 0,removeItem:()=>void 0};function vo(){try{return globalThis.localStorage??_o}catch{return _o}}function yo(e){let t;try{t=e.getItem(mo)}catch{return`system`}return go(t)?t:`system`}function bo(e,t){try{t===`system`?e.removeItem(mo):e.setItem(mo,t)}catch{}}function xo(e,t){return e===`light`?`light`:e===`dark`||t?`dark`:`light`}function So(e,t){e.setAttribute(ho,t)}var Co=M(`<div class=color-mode role=group aria-label="Color mode">`),wo=M(`<button type=button class=color-mode-option>`),To={system:`System`,light:`Light`,dark:`Dark`},Eo=`(prefers-color-scheme: dark)`;function Do(){let e=window.matchMedia(Eo),t=()=>{So(document.documentElement,xo(yo(vo()),e.matches))};return t(),e.addEventListener(`change`,t),()=>{e.removeEventListener(`change`,t)}}function Oo(){let[e,t]=D(`system`);oe(()=>{t(yo(vo())),se(Do())});let n=e=>{t(e),bo(vo(),e),So(document.documentElement,xo(e,window.matchMedia(Eo).matches))};return(()=>{var t=Co();return N(t,A(Ge,{each:po,children:t=>(()=>{var r=wo();return r.$$click=()=>{n(t)},N(r,()=>To[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&&tt(r,`aria-pressed`,n.t=a),n},{e:void 0,t:void 0}),r})()})),t})()}et([`click`]);function ko(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 Ao(e){return e!==void 0&&e.ok&&e.value.value.status===`disabled`}var jo=M(`<div class=update-banner role=status>New version available (<!>), current version (<!>). Run <code>npm update @opscanvas/opscanvas</code> to upgrade.`),Mo=M(`<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 No(e){let t=()=>ko(e.poll);return A(Ke,{get children(){return A(qe,{get when(){return t()},children:e=>(()=>{var t=jo(),n=t.firstChild.nextSibling,r=n.nextSibling.nextSibling;return r.nextSibling,N(t,()=>e().newer,n),N(t,()=>e().current,r),t})()})}})}function Po(e){return A(Ke,{get children(){return A(qe,{get when(){return Ao(e.poll)},get children(){return Mo()}})}})}var Fo=`/assets/logo-wordmark-light-DvltDuln.svg`,Io=M(`<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></div></nav><main class=shell-content><header class=shell-header><div class=shell-header-text><h1></h1></div></header><div class=shell-body>`),Lo=M(`<li><a class=shell-nav-link><span>`),Ro=M(`<span class=shell-nav-badge>`),zo=M(`<ul class=shell-nav-children>`),Bo=M(`<li><a class="shell-nav-link shell-nav-child"><span>`),Vo=M(`<p class=shell-subtitle aria-live=polite>`),Ho=M(`<div class=shell-actions>`);function Uo(e){return(()=>{var t=Io(),n=t.firstChild,r=n.firstChild,i=r.firstChild,a=r.nextSibling,o=a.nextSibling,s=n.nextSibling,c=s.firstChild,l=c.firstChild,u=l.firstChild,d=c.nextSibling;return tt(i,`src`,Fo),N(a,A(Ge,{get each(){return e.destinations??[]},children:e=>(()=>{var t=Lo(),n=t.firstChild,r=n.firstChild;return N(r,()=>e.label),N(n,A(j,{get when(){return e.badge},children:e=>(()=>{var t=Ro();return N(t,e),t})()}),null),N(t,A(j,{get when(){return e.children},children:e=>(()=>{var t=zo();return N(t,A(Ge,{get each(){return e()},children:e=>(()=>{var t=Bo(),n=t.firstChild,r=n.firstChild;return N(r,()=>e.label),N(n,A(j,{get when(){return e.badge},children:e=>(()=>{var t=Ro();return N(t,e),t})()}),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&&tt(n,`href`,t.t=i),a!==t.a&&tt(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&&tt(n,`href`,r.a=o),s!==r.o&&tt(n,`aria-current`,r.o=s),c!==r.i&&tt(n,`aria-expanded`,r.i=c),r},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),t})()})),N(o,A(Po,{get poll(){return e.updatePoll}}),null),N(o,A(Oo,{}),null),N(s,A(No,{get poll(){return e.updatePoll}}),c),N(u,()=>e.title),N(l,A(j,{get when(){return e.subtitle},children:e=>(()=>{var t=Vo();return N(t,e),t})()}),null),N(c,A(j,{get when(){return e.actions},children:e=>(()=>{var t=Ho();return N(t,e),t})()}),null),N(d,()=>e.children),t})()}var Wo=pe();function Go(e){return A(Wo.Provider,{get value(){return e.value},get children(){return e.children}})}function Ko(){let e=me(Wo);if(e===void 0)throw TypeError(`Shell subtitle context is unavailable.`);return e}var qo=M(`<section class=card>`),Jo=M(`<span class=status><span aria-hidden=true>`),Yo=M(`<button>`),Xo=M(`<div class=empty-state><h3>`),Zo=M(`<p>`),Qo=M(`<dl class=data-list>`),$o=M(`<div class=data-row><dt></dt><dd>`),es=M(`<div class=field><label class=field-label>`),ts=M(`<p class=field-hint>`),ns=M(`<p class=field-error role=alert>`);function rs(e){return(()=>{var t=qo();return N(t,()=>e.children),t})()}function is(e){return(()=>{var t=Jo(),n=t.firstChild;return N(t,()=>e.children,null),O(()=>nt(n,`status-dot status-dot--${e.status}`)),t})()}function as(e){return(()=>{var t=Yo();return rt(t,`click`,e.onClick,!0),N(t,()=>e.children),O(n=>{var r=`button button--${e.variant??`primary`}`,i=e.type??`submit`,a=e.disabled===!0;return r!==n.e&&nt(t,n.e=r),i!==n.t&&tt(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 os(e){return(()=>{var t=Xo(),n=t.firstChild;return N(n,()=>e.title),N(t,A(j,{get when(){return e.children},children:e=>(()=>{var t=Zo();return N(t,e),t})()}),null),t})()}function ss(e){return(()=>{var t=Qo();return N(t,()=>e.children),t})()}function cs(e){return(()=>{var t=$o(),n=t.firstChild,r=n.nextSibling;return N(n,()=>e.label),N(r,()=>e.children),t})()}function ls(e){return(()=>{var t=es(),n=t.firstChild;return N(n,()=>e.label),N(t,()=>e.children,null),N(t,A(j,{get when(){return e.hint},children:t=>(()=>{var n=ts();return N(n,t),O(()=>tt(n,`id`,`${e.for}-hint`)),n})()}),null),N(t,A(j,{get when(){return e.error},children:t=>(()=>{var n=ns();return N(n,t),O(()=>tt(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&&tt(n,`for`,r.t=a),r},{e:void 0,t:void 0}),t})()}et([`click`]);function us(e){let[t,n]=D(void 0);return oe(()=>{e().then(e=>{n(()=>e)})}),t}var ds=M(`<p>Asking the daemon.`),fs=M(`<p>The daemon did not answer: `),ps=()=>fo({method:`GET`,path:Gr,schema:ii,attempted:`read the daemon's health`});function ms(e){return`${e.message} (while trying to ${e.attempted})`}function hs(e){return e===`open`?`success`:`error`}function gs(e){return A(rs,{get children(){return A(ss,{get children(){return[A(cs,{label:`Answered by`,get children(){return[Xe(()=>e.source),` `,Xe(()=>e.version)]}}),A(cs,{label:`Durable store`,get children(){return A(is,{get status(){return hs(e.value.durableStore)},get children(){return e.value.durableStore}})}}),A(cs,{label:`Runtime store`,get children(){return A(is,{get status(){return hs(e.value.runtimeStore)},get children(){return e.value.runtimeStore}})}}),A(cs,{label:`Surface`,get children(){return e.value.surface}}),A(cs,{label:`As of`,get children(){return e.asOf}}),A(cs,{label:`Provenance`,get children(){return e.provenance}})]}})}})}function _s(){let e=us(ps),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 A(Ke,{get children(){return[A(qe,{get when(){return e()===void 0},get children(){return ds()}}),A(qe,{get when(){return t()},children:e=>(()=>{var t=fs();return t.firstChild,N(t,()=>ms(e()),null),t})()}),A(qe,{get when(){return n()},children:e=>gs(e())})]}})}function vs(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 ys(e){return e.alias??e.selector}function bs(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 xs(e){return e?.ok===!0?e.value.length>0:void 0}function Ss(e){return JSON.stringify([e.provider,e.selector])}function Cs(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 ws(e){return e.length===0?e:`${e[0]?.toUpperCase()??``}${e.slice(1)}`}function Ts(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 Es=M(`<p class=identity-row-detail>`),Ds=M(`<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>`),Os=M(`<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 <!> · `),ks=M(`<p class=identity-row-result>`),As=M(`<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>`),js=M(`<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>`),Ms=M(`<button type=button class=identity-command-copy>`),Ns=M(`<div class=identity-command-block><span class=identity-command-label>Confirmation command</span><div class=identity-command-row><pre class=identity-command-pre><code>`),Ps=M(`<div class=identity-row><div class=identity-row-heading><span class=identity-row-name>: </span><div class=identity-row-actions>`),Fs=M(`<span class=identity-row-result>approved`),Is=M(`<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>`),Ls=M(`<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.`),Rs=M(`<div class=identity-candidate-list>`),zs=M(`<div class=identity-add-section><button type=button class=identity-add-header><span class=provider-card-title>Found, not yet approved`),Bs=M(`<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.`),Vs=M(`<div class=provider-card-header><span class=provider-badge aria-hidden=true></span><span class=provider-card-title>`),Hs=M(`<p>Asking the daemon.`),Us=M(`<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.`),Ws=M(`<p>The daemon did not answer: `),Gs=M(`<div class=identity-approved-section><p class=identity-section-title>Approved Identities</p><div class=identity-columns>`),Ks=M(`<div class=identity-column>`);function qs(e){return`${e.message} (while trying to ${e.attempted})`}async function Js(){let e=await fo({method:`GET`,path:Zr,schema:xi,attempted:`list every approved identity`});return e.ok?on(e.value.value.identities):e}async function Ys(){let e=await fo({method:`GET`,path:Xr,schema:Ti,attempted:`enumerate locally configured identities`});return e.ok?on(e.value.value.candidates):e}function Xs(e){let[t,n]=D(null),[r,i]=D(null),[a,o]=D(!1);async function s(){n(`verify`),i(null);let t=await fo({method:`POST`,path:$r,schema:Ci,attempted:`verify an approved identity`,body:{provider:e.identity.provider,selector:e.identity.selector},timeoutMs:pi});if(n(null),!t.ok){i(qs(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 fo({method:`DELETE`,path:ei,schema:wi,attempted:`remove an approved identity`,body:{provider:e.identity.provider,selector:e.identity.selector}});if(n(null),!t.ok){i(qs(t.error));return}e.onRemoved()}return(()=>{var n=Os(),i=n.firstChild,l=i.firstChild,u=l.nextSibling,d=i.nextSibling,f=d.firstChild.nextSibling;return f.nextSibling,N(l,()=>ys(e.identity)),N(u,A(as,{variant:`subtle`,type:`button`,get disabled(){return t()!==null},onClick:()=>void s(),get children(){return t()===`verify`?`Verifying.`:`Verify`}}),null),N(u,A(as,{variant:`danger`,type:`button`,get disabled(){return t()!==null},onClick:()=>o(!0),get children(){return t()===`remove`?`Removing.`:`Remove`}}),null),N(n,A(j,{get when(){return e.identity.alias!==null},get children(){var t=Es();return N(t,()=>e.identity.selector),t}}),d),N(d,()=>e.identity.approvedAt,f),N(d,()=>bs(e.identity),null),N(n,A(j,{get when(){return r()},children:e=>(()=>{var t=ks();return N(t,e),t})()}),null),N(n,A(j,{get when(){return a()},get children(){var t=Ds(),n=t.firstChild,r=n.firstChild.nextSibling,i=r.nextSibling.nextSibling;i.nextSibling;var a=n.nextSibling;return N(n,()=>ys(e.identity),r),N(n,()=>e.identity.provider,i),N(a,A(as,{variant:`danger`,type:`button`,onClick:()=>void c(),children:`Remove`}),null),N(a,A(as,{variant:`subtle`,type:`button`,onClick:()=>o(!1),children:`Cancel`}),null),O(()=>tt(t,`aria-label`,`Remove ${ys(e.identity)}?`)),t}}),null),n})()}function Zs(){return As()}function Qs(){return js()}function $s(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=Ms();return e.$$click=()=>void r(),N(e,A(j,{get when(){return!t()},get fallback(){return A(Qs,{})},get children(){return A(Zs,{})}})),O(()=>tt(e,`aria-label`,t()?`Copied`:`Copy command`)),e})()}function ec(e){return(()=>{var t=Ns(),n=t.firstChild;n.firstChild;var r=n.nextSibling,i=r.firstChild.firstChild;return N(n,A(j,{get when(){return e.caveat},children:e=>` (${e()})`}),null),N(i,()=>e.command),N(r,A($s,{get text(){return e.command}}),null),t})()}function tc(e){let[t,n]=D(!1),[r,i]=D(null),[a,o]=D(!1);async function s(){n(!0),i(null);let t=await fo({method:`POST`,path:Qr,schema:Si,attempted:`approve an identity for use`,body:{provider:e.candidate.provider,selector:e.candidate.selector}});if(n(!1),!t.ok){i(qs(t.error));return}o(!0),e.onApproved()}let c=mi(e.candidate.provider,e.candidate.selector,e.candidate.awsMechanism);return(()=>{var n=Ps(),i=n.firstChild.firstChild,o=i.firstChild,l=i.nextSibling;return N(i,()=>e.candidate.provider,o),N(i,()=>e.candidate.selector,null),N(l,A(j,{get when(){return!a()},get fallback(){return Fs()},get children(){return A(as,{type:`button`,get disabled(){return t()},onClick:()=>void s(),get children(){return t()?`Approving.`:`Approve for Use`}})}})),N(n,A(j,{when:c,children:e=>A(ec,{get command(){return e().command},get caveat(){return e().caveat}})}),null),N(n,A(j,{get when(){return r()},children:e=>(()=>{var t=ks();return N(t,e),t})()}),null),n})()}function nc(e){return(()=>{var t=Is();return O(()=>t.classList.toggle(`is-collapsed`,!e.expanded)),t})()}function rc(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 Ys();if(!e.ok){i(qs(e.error));return}n(e.value)}ne(ae(()=>e.reloadOn,()=>void c())),ne(()=>{let t=e.hasApprovedIdentities;t===void 0||s||(s=!0,t&&o(!1))});function l(t){n(e=>(e??[]).filter(e=>Ss(e)!==Ss(t))),e.onApproved()}return A(j,{get when(){return r()!==null||(t()?.length??0)>0},get fallback(){return Bs()},get children(){return A(rs,{get children(){var e=zs(),n=e.firstChild;return n.firstChild,n.$$click=()=>{s=!0,o(e=>!e)},N(n,A(nc,{get expanded(){return a()}}),null),N(e,A(j,{get when(){return a()},get children(){return[Ls(),A(j,{get when(){return r()},children:e=>(()=>{var t=ks();return N(t,e),t})()}),(()=>{var e=Rs();return N(e,A(Ge,{get each(){return t()??[]},children:e=>A(tc,{candidate:e,onApproved:()=>{l(e)}})})),e})()]}}),null),O(()=>tt(n,`aria-expanded`,a())),e}})}})}function ic(e){return A(rs,{get children(){return[(()=>{var t=Vs(),n=t.firstChild,r=n.nextSibling;return N(n,()=>Cs(e.provider)),N(r,()=>ws(e.provider)),t})(),A(Ge,{get each(){return e.identities},children:t=>A(Xs,{identity:t,get onRemoved(){return e.onChanged}})})]}})}var ac=`(max-width: 700px)`;function oc(){let[e,t]=D(window.matchMedia(ac).matches?1:2);return oe(()=>{let e=window.matchMedia(ac),n=()=>{t(e.matches?1:2)};n(),e.addEventListener(`change`,n),se(()=>{e.removeEventListener(`change`,n)})}),e}function sc(){let e=oc(),[t,n]=D(void 0),[r,i]=D(0);async function a(){n(await Js())}function o(){a(),i(e=>e+1)}oe(()=>{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=()=>xs(t());return(()=>{var n=Us();return n.firstChild.nextSibling,N(n,A(rc,{onApproved:()=>void a(),get reloadOn(){return r()},get hasApprovedIdentities(){return l()}}),null),N(n,A(Ke,{get children(){return[A(qe,{get when(){return t()===void 0},get children(){return Hs()}}),A(qe,{get when(){return s()},children:e=>(()=>{var t=Ws();return t.firstChild,N(t,()=>qs(e()),null),t})()}),A(qe,{get when(){return c()},children:t=>A(j,{get when(){return t().length>0},get fallback(){return A(os,{title:`No identities approved yet`,children:`Approve one found above, through the find_identity skill, or during setup.`})},get children(){var n=Gs(),r=n.firstChild.nextSibling;return N(r,A(Ge,{get each(){return Ts(vs(t()),([,e])=>e.length,e())},children:e=>(()=>{var t=Ks();return N(t,A(Ge,{each:e,children:([e,t])=>A(ic,{provider:e,identities:t,onChanged:o})})),t})()})),n}})})]}}),null),n})()}et([`click`]);var cc=`/health`,lc=`/identities`,uc=`/topology/view`,dc=`/topology/confirm`;function fc(e){if(!(e===void 0||!e.ok||e.value.value.count===0))return e.value.value.count}function pc(e,t){return e===`/`||e===`/topology/view`||t&&e===`/topology/confirm`}function mc(e){let t=pc(e.pathname,e.confirmAvailable),n=[{label:`View`,href:uc,current:e.pathname===`/`||e.pathname===`/topology/view`}];if(e.confirmAvailable){let t=fc(e.pendingReview);n.push({label:`Confirm`,href:dc,current:e.pathname===dc,...t===void 0?{}:{badge:t}})}let r=[{label:`Topology`,href:uc,expanded:t,...t?{children:n}:{}},{label:`Health`,href:cc,current:e.pathname===cc},{label:`Identities`,href:lc,current:e.pathname===lc}];return e.registered||r.push({label:`Registration`,href:e.registrationRoute,current:e.pathname===e.registrationRoute}),r}function hc(e,t,n){return e===`/`||e===`/topology/view`?`Topology View`:n&&e===`/topology/confirm`?`Confirm`:e===`/health`?`Health`:e===`/identities`?`Identities`:e===t?`Registration`:`Operator Edition`}var gc={firstName:``,lastName:``,email:``,company:``,title:``};function _c(e){let t=Di.safeParse(e);if(t.success)return{};let n={};for(let e of t.error.issues){let t=e.path[0];typeof t==`string`&&!(t in n)&&(n[t]=e.message)}return n}function vc(e){let t=Di.safeParse(e);return t.success?t.data:null}var[yc,bc]=D(!1);function xc(){bc(!0)}function Sc(e,t){return t?!0:e?.ok===!0&&e.value.value.registered}var Cc=M(`<input>`),wc=M(`<form class=form novalidate><p>Please register with OpsCanvas before using the operator edition browser application.</p><div class=form-pair>`),Tc=M(`<p>Thank you for registering. The browser app is now available.`),Ec=M(`<p class=form-message role=alert>`);function Dc(e){return A(ls,{get label(){return e.label},get for(){return e.name},get error(){return e.problem},get hint(){return e.hint},get children(){var t=Cc();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&&tt(t,`id`,n.e=r),i!==n.t&&tt(t,`name`,n.t=i),a!==n.a&&tt(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 Oc=()=>fo({method:`GET`,path:Kr,schema:Oi,attempted:`read whether a practitioner has registered`});function kc(){let[e,t]=D(gc),[n,r]=D(!1),[i,a]=D(!1),[o,s]=D(void 0),c=us(Oc),l=()=>Sc(c(),yc()),u=()=>n()?_c(e()):{},d=n=>r=>{t({...e(),[n]:r})};async function f(t){t.preventDefault(),r(!0),s(void 0);let n=vc(e());if(n===null)return;a(!0);let i=await fo({method:`POST`,path:Kr,schema:Oi,attempted:`register this practitioner`,body:n});if(a(!1),!i.ok){s(`${i.error.message} (while trying to ${i.error.attempted})`);return}xc()}return A(rs,{get children(){return A(j,{get when(){return!l()},get fallback(){return Tc()},get children(){var t=wc(),n=t.firstChild.nextSibling;return t.addEventListener(`submit`,e=>{f(e)}),N(n,A(Dc,{name:`firstName`,label:`First name`,get value(){return e().firstName},get problem(){return u().firstName},get disabled(){return i()},get onInput(){return d(`firstName`)}}),null),N(n,A(Dc,{name:`lastName`,label:`Last name`,get value(){return e().lastName},get problem(){return u().lastName},get disabled(){return i()},get onInput(){return d(`lastName`)}}),null),N(t,A(Dc,{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`)}}),null),N(t,A(Dc,{name:`company`,label:`Company`,get value(){return e().company},get problem(){return u().company},get disabled(){return i()},get onInput(){return d(`company`)}}),null),N(t,A(Dc,{name:`title`,label:`Job title`,hint:`Optional.`,get value(){return e().title},get problem(){return u().title},get disabled(){return i()},get onInput(){return d(`title`)}}),null),N(t,A(j,{get when(){return o()},children:e=>(()=>{var t=Ec();return N(t,e),t})()}),null),N(t,A(as,{get disabled(){return i()},get children(){return i()?`Registering.`:`Register`}}),null),t}})}})}et([`input`]);var Ac=pe();function jc(e){return A(Ac.Provider,{get value(){return e.value},get children(){return e.children}})}function Mc(){let e=me(Ac);if(e===void 0)throw TypeError(`Topology pending-review context is unavailable.`);return e}function Nc(e){return e.trim().toLowerCase()}function Pc(e){let t=Nc(e);return t===`git`?`github`:t===`k8s`?`kubernetes`:t}function Fc(e){let t=new Set;for(let n of e){let e=Pc(n);e.length>0&&t.add(e)}return t}function Ic(e,t,n,r){if(t.nodeKinds.size>0&&!t.nodeKinds.has(e.kind)||n.length>0&&!Nc(e.label).includes(n)&&!Nc(e.entityKey).includes(n))return!1;if(r.size===0)return!0;let i=new Set(e.providers.map(Pc).filter(e=>e.length>0));for(let e of r)if(i.has(e))return!0;return!1}function Lc(e,t,n){return t.length>0||e.nodeKinds.size>0||e.relationshipKinds.size>0||n.size>0}function Rc(e,t){let n=Nc(t.query),r=Fc(t.providers);if(!Lc(t,n,r))return e;let i=e.nodes.filter(e=>Ic(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 zc(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 Bc(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 Vc(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 Hc(e,t){let n=Vc(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 Bc(e,n),n}function Uc(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 Bc(e,n),n}function Wc(e,t){return t.kind===`estate`?e:t.kind===`application`?zc(e,t.mode===`overview`?Vc(e,t.applicationKey):Hc(e,t.applicationKey)):zc(e,Uc(e,t.environmentKey))}var Gc={application:16,environment:14,system_ref:13,service:13,service_instance:11,repo:12},Kc=3.2,qc=2;function Jc(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 Yc(e,t){let n=t?.dependents??0,r=t?.dependencies??0,i=Math.sqrt(qc*n+r);return{dependents:n,dependencies:r,score:Math.round(i*100)/100,size:Math.round((Gc[e]+Kc*i)*10)/10}}function Xc(e){return e.kind===`estate`?void 0:e.applicationKey}function Zc(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 Qc=`data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA5NjAgNTIwIiByb2xlPSJpbWciIGFyaWEtbGFiZWxsZWRieT0idGl0bGUgZGVzY3JpcHRpb24iPgogIDx0aXRsZSBpZD0idGl0bGUiPkV4YW1wbGUgT3BzQ2FudmFzIHRvcG9sb2d5IGdyYXBoPC90aXRsZT4KICA8ZGVzYyBpZD0iZGVzY3JpcHRpb24iPkFwcGxpY2F0aW9ucywgZW52aXJvbm1lbnRzLCBzZXJ2aWNlcywgcmVwb3NpdG9yaWVzLCBhbmQgc3lzdGVtcyBjb25uZWN0ZWQgaW4gYW4gZXN0YXRlIGdyYXBoLjwvZGVzYz4KICA8cmVjdCB3aWR0aD0iOTYwIiBoZWlnaHQ9IjUyMCIgcng9IjIwIiBmaWxsPSIjZjdmOWZjIi8+CiAgPGcgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjODQ5MmE4IiBzdHJva2Utd2lkdGg9IjMiIG9wYWNpdHk9IjAuNzUiPgogICAgPHBhdGggZD0iTTE2NCAxMzUgQzI1MCAxMDAgMjg1IDExNSAzNjAgMTcwIi8+CiAgICA8cGF0aCBkPSJNMTY0IDEzNSBDMjQ1IDIwNSAyNzAgMjMwIDM1MCAyNjUiLz4KICAgIDxwYXRoIGQ9Ik0zNjAgMTcwIEM0NTUgMTMwIDUxNSAxNDAgNTk1IDIwNSIvPgogICAgPHBhdGggZD0iTTM1MCAyNjUgQzQ1NSAyODUgNTAwIDI3MCA1OTUgMjA1Ii8+CiAgICA8cGF0aCBkPSJNNTk1IDIwNSBDNjY1IDE1NSA3MjAgMTQwIDgwMCAxNjUiLz4KICAgIDxwYXRoIGQ9Ik01OTUgMjA1IEM2NjUgMjQ1IDcxNSAyNzUgNzk1IDMxMCIvPgogICAgPHBhdGggZD0iTTM1MCAyNjUgQzQyMCAzNTAgNDc1IDM4MCA1NzAgMzgwIi8+CiAgICA8cGF0aCBkPSJNNTcwIDM4MCBDNjYwIDM5MCA3MTUgMzY1IDc5NSAzMTAiLz4KICA8L2c+CiAgPGcgZm9udC1mYW1pbHk9IkFyaWFsLCBzYW5zLXNlcmlmIiB0ZXh0LWFuY2hvcj0ibWlkZGxlIj4KICAgIDxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDE2NCAxMzUpIj4KICAgICAgPGNpcmNsZSByPSI0MyIgZmlsbD0iIzAwNWNlMCIvPjx0ZXh0IHk9IjgiIGZpbGw9IiNmZmYiIGZvbnQtc2l6ZT0iMjUiPuKXjjwvdGV4dD4KICAgICAgPHRleHQgeT0iNzAiIGZpbGw9IiMxZDI5NDIiIGZvbnQtc2l6ZT0iMTciIGZvbnQtd2VpZ2h0PSI2MDAiPkNoZWNrb3V0PC90ZXh0PgogICAgPC9nPgogICAgPGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMzYwIDE3MCkiPgogICAgICA8Y2lyY2xlIHI9IjM0IiBmaWxsPSIjNGUzY2QyIi8+PHRleHQgeT0iOCIgZmlsbD0iI2ZmZiIgZm9udC1zaXplPSIyMyI+4peGPC90ZXh0PgogICAgICA8dGV4dCB5PSI2MSIgZmlsbD0iIzFkMjk0MiIgZm9udC1zaXplPSIxNSIgZm9udC13ZWlnaHQ9IjYwMCI+UHJvZHVjdGlvbjwvdGV4dD4KICAgIDwvZz4KICAgIDxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDM1MCAyNjUpIj4KICAgICAgPGNpcmNsZSByPSIzNCIgZmlsbD0iIzRlM2NkMiIvPjx0ZXh0IHk9IjgiIGZpbGw9IiNmZmYiIGZvbnQtc2l6ZT0iMjMiPuKXhjwvdGV4dD4KICAgICAgPHRleHQgeT0iNjEiIGZpbGw9IiMxZDI5NDIiIGZvbnQtc2l6ZT0iMTUiIGZvbnQtd2VpZ2h0PSI2MDAiPlN0YWdpbmc8L3RleHQ+CiAgICA8L2c+CiAgICA8ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSg1OTUgMjA1KSI+CiAgICAgIDxjaXJjbGUgcj0iNDIiIGZpbGw9IiMyMmI2N2MiLz48dGV4dCB5PSI5IiBmaWxsPSIjZmZmIiBmb250LXNpemU9IjI3Ij7irKE8L3RleHQ+CiAgICAgIDx0ZXh0IHk9IjcwIiBmaWxsPSIjMWQyOTQyIiBmb250LXNpemU9IjE3IiBmb250LXdlaWdodD0iNjAwIj5QYXltZW50czwvdGV4dD4KICAgIDwvZz4KICAgIDxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDgwMCAxNjUpIj4KICAgICAgPGNpcmNsZSByPSIzNSIgZmlsbD0iI2YwMjE2YiIvPjx0ZXh0IHk9IjgiIGZpbGw9IiNmZmYiIGZvbnQtc2l6ZT0iMjMiPuKYhTwvdGV4dD4KICAgICAgPHRleHQgeT0iNjIiIGZpbGw9IiMxZDI5NDIiIGZvbnQtc2l6ZT0iMTUiIGZvbnQtd2VpZ2h0PSI2MDAiPlN0cmlwZTwvdGV4dD4KICAgIDwvZz4KICAgIDxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDc5NSAzMTApIj4KICAgICAgPGNpcmNsZSByPSIzNCIgZmlsbD0iIzZlNzA3MiIvPjx0ZXh0IHk9IjgiIGZpbGw9IiNmZmYiIGZvbnQtc2l6ZT0iMjMiPuKMmDwvdGV4dD4KICAgICAgPHRleHQgeT0iNjEiIGZpbGw9IiMxZDI5NDIiIGZvbnQtc2l6ZT0iMTUiIGZvbnQtd2VpZ2h0PSI2MDAiPlJlcG9zaXRvcnk8L3RleHQ+CiAgICA8L2c+CiAgICA8ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSg1NzAgMzgwKSI+CiAgICAgIDxjaXJjbGUgcj0iMzciIGZpbGw9IiM1OTk1ZWIiLz48dGV4dCB5PSI4IiBmaWxsPSIjZmZmIiBmb250LXNpemU9IjIzIj7ilqI8L3RleHQ+CiAgICAgIDx0ZXh0IHk9IjY1IiBmaWxsPSIjMWQyOTQyIiBmb250LXNpemU9IjE1IiBmb250LXdlaWdodD0iNjAwIj5TZXJ2aWNlIGluc3RhbmNlPC90ZXh0PgogICAgPC9nPgogIDwvZz4KPC9zdmc+Cg==`;function $c(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 el(e,t,n){return`${e} · ${t.toLocaleString()} nodes · ${n.toLocaleString()} relationships`}var tl=`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`,nl=`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`,rl=`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`,il=`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`,al={application:`A`,environment:`E`,service:`S`,service_instance:`I`,system_ref:`C`,repo:`R`};function ol(e){return e.glyph??(e.image===void 0?al[e.kind]:void 0)}var sl={aws:tl,github:nl,gitlab:rl,kubernetes:il},cl={git:`github`,k8s:`kubernetes`},ll={aws:`#ED7100`,github:`#181717`,gitlab:`#E24329`,kubernetes:`#326CE5`},ul={aws:`AWS`,github:`GitHub`,gitlab:`GitLab`,kubernetes:`Kubernetes`,gcp:`GCP`};function dl(e){let t=e.trim().toLowerCase();return cl[t]??t}function fl(e){let t=[...new Set(e.map(dl))];if(t.length!==1)return;let n=t[0];if(n!==void 0)return sl[n]===void 0?void 0:n}function pl(e,t){return e===void 0?void 0:sl[dl(e)]}function ml(e){let t=ul[dl(e)];return t===void 0?e.length===0?e:`${e.slice(0,1).toLocaleUpperCase()}${e.slice(1)}`:t}function hl(e){let t=e.toLowerCase();if(t.includes(`github`))return`github`;if(t.includes(`gitlab`))return`gitlab`}function gl(e,t){if(t?.kind===`repo`&&t.entityKey!==void 0){let e=hl(t.entityKey);if(e!==void 0)return e}return fl(e)}function _l(e){if(e!==void 0)return ll[dl(e)]}function vl(e,t,n){return pl(gl(e,n),t)}var yl={connected_via:`Connected via`,observed_by:`Observed by`,accessed_via:`Accessed via`,implemented_in:`Implemented in`,deployed_from:`Deployed from`,provided_as:`Provided as`},bl={has_environment:`Contains`,member_service:`Includes service`,runs_instance:`Runs instance`,instance_of:`Instance of`};function xl(e){return e in bl?bl[e]:e in yl?yl[e]:e.split(`_`).map(e=>`${e.slice(0,1).toLocaleUpperCase()}${e.slice(1)}`).join(` `)}function Sl(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 Cl(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 wl(e,t,n){return e.get(t)?.get(n)}function Tl(e,t,n){return{key:`${e}::${t}-->${n}`,source:t,target:n,kind:e,label:bl[e]}}function El(e){let t=[],n=Cl(e);for(let r of e){if(r.kind===`environment`&&r.applicationKey!==null){let e=wl(n,`application`,r.applicationKey);e!==void 0&&t.push(Tl(`has_environment`,e,r.key))}if(r.kind===`service`)for(let e of r.applicationKeys){let i=wl(n,`application`,e);i!==void 0&&t.push(Tl(`member_service`,i,r.key))}if(r.kind===`service_instance`){if(r.environmentKey!==null){let e=wl(n,`environment`,r.environmentKey);e!==void 0&&t.push(Tl(`runs_instance`,e,r.key))}if(r.serviceKey!==null){let e=wl(n,`service`,r.serviceKey);e!==void 0&&t.push(Tl(`instance_of`,r.key,e))}}}return t}function Dl(e){return`${e.kind}\0${e.source}\0${e.target}`}function Ol(e){let t=e.nodes.map(Sl),n=e.edges.map(e=>({key:e.id,source:e.source,target:e.target,kind:e.kind,label:yl[e.kind]})),r=new Set(n.map(Dl)),i=El(t).filter(e=>!r.has(Dl(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 kl(){let e=await fo({method:`GET`,path:Yr,schema:eo,attempted:`read committed topology`});return e.ok?{ok:!0,value:Ol(e.value.value)}:e}var Al=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 jl(){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 Ml=jl;typeof Object.assign==`function`&&(Ml=Object.assign);function Nl(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 Pl(e){return typeof e==`object`&&!!e}function Fl(e){let t;for(t in e)return!1;return!0}function Il(e,t,n){Object.defineProperty(e,t,{enumerable:!1,configurable:!1,writable:!0,value:n})}function Ll(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 Rl(e){return!(!Pl(e)||e.attributes&&!Array.isArray(e.attributes))}function zl(){let e=Math.floor(Math.random()*256)&255;return()=>e++}function Bl(){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 Vl(){return{[Symbol.iterator](){return this},next(){return{done:!0}}}}var Hl=class extends Error{constructor(e){super(),this.name=`GraphError`,this.message=e}},Y=class e extends Hl{constructor(t){super(t),this.name=`InvalidArgumentsGraphError`,typeof Error.captureStackTrace==`function`&&Error.captureStackTrace(this,e.prototype.constructor)}},X=class e extends Hl{constructor(t){super(t),this.name=`NotFoundGraphError`,typeof Error.captureStackTrace==`function`&&Error.captureStackTrace(this,e.prototype.constructor)}},Z=class e extends Hl{constructor(t){super(t),this.name=`UsageGraphError`,typeof Error.captureStackTrace==`function`&&Error.captureStackTrace(this,e.prototype.constructor)}};function Ul(e,t){this.key=e,this.attributes=t,this.clear()}Ul.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 Wl(e,t){this.key=e,this.attributes=t,this.clear()}Wl.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.directedLoops=0,this.in={},this.out={}};function Gl(e,t){this.key=e,this.attributes=t,this.clear()}Gl.prototype.clear=function(){this.undirectedDegree=0,this.undirectedLoops=0,this.undirected={}};function Kl(e,t,n,r,i){this.key=t,this.attributes=i,this.undirected=e,this.source=n,this.target=r}Kl.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)},Kl.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},Kl.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]},Kl.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 ql=0,Jl=1,Yl=2,Xl=3;function Zl(e,t,n,r,i,a,o){let s,c,l,u;if(r=``+r,n===ql){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===Xl){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===Jl?c.source:c.target,l=i,u=a}return[s,l,u]}function Ql(e,t,n){e.prototype[t]=function(e,r,i){let[a,o]=Zl(this,t,n,e,r,i);return a.attributes[o]}}function $l(e,t,n){e.prototype[t]=function(e,r){let[i]=Zl(this,t,n,e,r);return i.attributes}}function eu(e,t,n){e.prototype[t]=function(e,r,i){let[a,o]=Zl(this,t,n,e,r,i);return a.attributes.hasOwnProperty(o)}}function tu(e,t,n){e.prototype[t]=function(e,r,i,a){let[o,s,c]=Zl(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 nu(e,t,n){e.prototype[t]=function(e,r,i,a){let[o,s,c]=Zl(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 ru(e,t,n){e.prototype[t]=function(e,r,i){let[a,o]=Zl(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 iu(e,t,n){e.prototype[t]=function(e,r,i){let[a,o]=Zl(this,t,n,e,r,i);if(!Pl(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 au(e,t,n){e.prototype[t]=function(e,r,i){let[a,o]=Zl(this,t,n,e,r,i);if(!Pl(o))throw new Y(`Graph.${t}: provided attributes are not a plain object.`);return Ml(a.attributes,o),this.emit(`nodeAttributesUpdated`,{key:a.key,type:`merge`,attributes:a.attributes,data:o}),this}}function ou(e,t,n){e.prototype[t]=function(e,r,i){let[a,o]=Zl(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 su=[{name:e=>`get${e}Attribute`,attacher:Ql},{name:e=>`get${e}Attributes`,attacher:$l},{name:e=>`has${e}Attribute`,attacher:eu},{name:e=>`set${e}Attribute`,attacher:tu},{name:e=>`update${e}Attribute`,attacher:nu},{name:e=>`remove${e}Attribute`,attacher:ru},{name:e=>`replace${e}Attributes`,attacher:iu},{name:e=>`merge${e}Attributes`,attacher:au},{name:e=>`update${e}Attributes`,attacher:ou}];function cu(e){su.forEach(function({name:t,attacher:n}){n(e,t(`Node`),ql),n(e,t(`Source`),Jl),n(e,t(`Target`),Yl),n(e,t(`Opposite`),Xl)})}function lu(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=Nl(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 uu(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=Nl(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 du(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=Nl(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 fu(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=Nl(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 pu(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=Nl(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 mu(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=Nl(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 hu(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=Nl(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(!Pl(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 gu(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=Nl(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(!Pl(r))throw new Y(`Graph.${t}: provided attributes are not a plain object.`);return Ml(i.attributes,r),this.emit(`edgeAttributesUpdated`,{key:i.key,type:`merge`,attributes:i.attributes,data:r}),this}}function _u(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=Nl(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 vu=[{name:e=>`get${e}Attribute`,attacher:lu},{name:e=>`get${e}Attributes`,attacher:uu},{name:e=>`has${e}Attribute`,attacher:du},{name:e=>`set${e}Attribute`,attacher:fu},{name:e=>`update${e}Attribute`,attacher:pu},{name:e=>`remove${e}Attribute`,attacher:mu},{name:e=>`replace${e}Attributes`,attacher:hu},{name:e=>`merge${e}Attributes`,attacher:gu},{name:e=>`update${e}Attributes`,attacher:_u}];function yu(e){vu.forEach(function({name:t,attacher:n}){n(e,t(`Edge`),`mixed`),n(e,t(`DirectedEdge`),`directed`),n(e,t(`UndirectedEdge`),`undirected`)})}var bu=[{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 xu(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 Su(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 Cu(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 wu(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 Tu(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 Eu(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 Du(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 Ou(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 ku(e,t){if(e.size===0)return Vl();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 Au(e,t,n,r,i,a){let o=t?Su:xu,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 ju(e,t,n,r){let i=[];return Au(!1,e,t,n,r,function(e){i.push(e)}),i}function Mu(e,t,n){let r=Vl();return e!==`undirected`&&(t!==`out`&&n.in!==void 0&&(r=Bl(r,Cu(n.in))),t!==`in`&&n.out!==void 0&&(r=Bl(r,Cu(n.out,t?void 0:n.key)))),e!==`directed`&&n.undirected!==void 0&&(r=Bl(r,Cu(n.undirected))),r}function Nu(e,t,n,r,i,a,o){let s=n?Tu:wu,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 Pu(e,t,n,r,i){let a=[];return Nu(!1,e,t,n,r,i,function(e){a.push(e)}),a}function Fu(e,t,n,r){let i=Vl();return e!==`undirected`&&(n.in!==void 0&&t!==`out`&&r in n.in&&(i=Bl(i,Eu(n.in,r))),n.out!==void 0&&t!==`in`&&r in n.out&&(t||n.key!==r)&&(i=Bl(i,Eu(n.out,r)))),e!==`directed`&&n.undirected!==void 0&&r in n.undirected&&(i=Bl(i,Eu(n.undirected,r))),i}function Iu(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 Du(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 ju(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 Pu(r,this.multi,i,a,t)}throw new Y(`Graph.${n}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function Lu(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,Ou(!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 Au(!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 Nu(!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 Ru(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,Ou(!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 Au(!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 Nu(!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 zu(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 Vl();if(!arguments.length)return ku(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 Mu(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 Fu(r,i,n,t)}throw new Y(`Graph.${a}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function Bu(e){bu.forEach(t=>{Iu(e,t),Lu(e,t),Ru(e,t),zu(e,t)})}var Vu=[{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 Hu(){this.A=null,this.B=null}Hu.prototype.wrap=function(e){this.A===null?this.A=e:this.B===null&&(this.B=e)},Hu.prototype.has=function(e){return this.A!==null&&e in this.A||this.B!==null&&e in this.B};function Uu(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 Wu(e,t,n,r,i){if(t!==`mixed`){if(t===`undirected`)return Uu(e,null,r,r.undirected,i);if(typeof n==`string`)return Uu(e,null,r,r[n],i)}let a=new Hu,o;if(t!==`undirected`){if(n!==`out`){if(o=Uu(e,null,r,r.in,i),e&&o)return o;a.wrap(r.in)}if(n!==`in`){if(o=Uu(e,a,r,r.out,i),e&&o)return o;a.wrap(r.out)}}if(t!==`directed`&&(o=Uu(e,a,r,r.undirected,i),e&&o))return o}function Gu(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 Wu(!1,e,t,n,function(e){r.push(e)}),r}function Ku(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 qu(e,t,n){if(e!==`mixed`){if(e===`undirected`)return Ku(null,n,n.undirected);if(typeof t==`string`)return Ku(null,n,n[t])}let r=Vl(),i=new Hu;return e!==`undirected`&&(t!==`out`&&(r=Bl(r,Ku(i,n,n.in))),t!==`in`&&(r=Bl(r,Ku(i,n,n.out)))),e!==`directed`&&(r=Bl(r,Ku(i,n,n.undirected))),r}function Ju(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 Gu(r===`mixed`?this.type:r,i,t)}}function Yu(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.`);Wu(!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 Xu(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 Wu(!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 Zu(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 Vl();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 qu(r===`mixed`?this.type:r,i,t)}}function Qu(e){Vu.forEach(t=>{Ju(e,t),Yu(e,t),Xu(e,t),Zu(e,t)})}function $u(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 ed(e,t){let n={key:e};return Fl(t.attributes)||(n.attributes=Ml({},t.attributes)),n}function td(e,t,n){let r={key:t,source:n.source.key,target:n.target.key};return Fl(n.attributes)||(r.attributes=Ml({},n.attributes)),e===`mixed`&&n.undirected&&(r.undirected=!0),r}function nd(e){if(!Pl(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&&(!Pl(e.attributes)||e.attributes===null))throw new Y(`Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.`)}function rd(e){if(!Pl(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&&(!Pl(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 id=zl(),ad=new Set([`directed`,`undirected`,`mixed`]),od=new Set([`domain`,`_events`,`_eventsCount`,`_maxListeners`]),sd=[{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`}],cd={allowSelfLoops:!0,multi:!1,type:`mixed`};function ld(e,t,n){if(n&&!Pl(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 ud(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 dd(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&&!Pl(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 Kl(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 fd(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(!Pl(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 Ml(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=ud(e,a,{}),h=!0,a===o&&(d=u,g=!0)),d||(d=ud(e,o,{}),g=!0),f=new Kl(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 pd(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 md=class e extends Al.EventEmitter{constructor(e){if(super(),e=Ml({},cd,e),typeof e.multi!=`boolean`)throw new Y(`Graph.constructor: invalid 'multi' option. Expecting a boolean but got "${e.multi}".`);if(!ad.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`?Ul:e.type===`directed`?Wl:Gl;Il(this,`NodeDataClass`,t);let n=`geid_`+id()+`_`,r=0;Il(this,`_attributes`,{}),Il(this,`_nodes`,new Map),Il(this,`_edges`,new Map),Il(this,`_directedSize`,0),Il(this,`_undirectedSize`,0),Il(this,`_directedSelfLoopCount`,0),Il(this,`_undirectedSelfLoopCount`,0),Il(this,`_edgeKeyGenerator`,()=>{let e;do e=n+r++;while(this._edges.has(e));return e}),Il(this,`_options`,e),od.forEach(e=>Il(this,e,this[e])),Ll(this,`order`,()=>this._nodes.size),Ll(this,`size`,()=>this._edges.size),Ll(this,`directedSize`,()=>this._directedSize),Ll(this,`undirectedSize`,()=>this._undirectedSize),Ll(this,`selfLoopCount`,()=>this._directedSelfLoopCount+this._undirectedSelfLoopCount),Ll(this,`directedSelfLoopCount`,()=>this._directedSelfLoopCount),Ll(this,`undirectedSelfLoopCount`,()=>this._undirectedSelfLoopCount),Ll(this,`multi`,this._options.multi),Ll(this,`type`,this._options.type),Ll(this,`allowSelfLoops`,this._options.allowSelfLoops),Ll(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 ld(this,e,t).key}mergeNode(e,t){if(t&&!Pl(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&&(Ml(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 pd(this,n),n=n.next;while(n)}for(let e in t.in){n=t.in[e];do pd(this,n),n=n.next;while(n)}}if(this.type!==`directed`)for(let e in t.undirected){n=t.undirected[e];do pd(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=Nl(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 pd(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=Nl(this,e,t,`directed`);if(!n)throw new X(`Graph.dropDirectedEdge: could not find a "${e}" -> "${t}" edge in the graph.`);return pd(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=Nl(this,e,t,`undirected`);if(!n)throw new X(`Graph.dropUndirectedEdge: could not find a "${e}" -> "${t}" edge in the graph.`);return pd(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(!Pl(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(!Pl(e))throw new Y(`Graph.mergeAttributes: provided attributes are not a plain object.`);return Ml(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&&!Rl(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&&!Rl(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.`);$u(!1,!1,!1,this,e)}forEachAdjacencyEntryWithOrphans(e){if(typeof e!=`function`)throw new Y(`Graph.forEachAdjacencyEntryWithOrphans: expecting a callback.`);$u(!1,!1,!0,this,e)}forEachAssymetricAdjacencyEntry(e){if(typeof e!=`function`)throw new Y(`Graph.forEachAssymetricAdjacencyEntry: expecting a callback.`);$u(!1,!0,!1,this,e)}forEachAssymetricAdjacencyEntryWithOrphans(e){if(typeof e!=`function`)throw new Y(`Graph.forEachAssymetricAdjacencyEntryWithOrphans: expecting a callback.`);$u(!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++]=ed(r,n)});let n=Array(this._edges.size);return t=0,this._edges.forEach((e,r)=>{n[t++]=td(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(!Pl(t))throw new Y(`Graph.import: invalid argument. Expecting a serialized graph or, alternatively, a Graph instance.`);if(t.attributes){if(!Pl(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],nd(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],rd(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(Ml({},this._options,t));return n.replaceAttributes(Ml({},this.getAttributes())),n}emptyCopy(e){let t=this.nullCopy(e);return this._nodes.forEach((e,n)=>{let r=Ml({},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,dd(t,`copy`,!1,i.undirected,i.key,i.source.key,i.target.key,Ml({},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)&&!od.has(e)&&typeof this[e]!=`function`&&typeof e!=`symbol`&&(r[e]=this[e]);return r.attributes=this._attributes,r.nodes=e,r.edges=t,Il(r,`constructor`,this.constructor),r}};typeof Symbol<`u`&&(md.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=md.prototype.inspect),sd.forEach(e=>{[`add`,`merge`,`update`].forEach(t=>{let n=e.name(t),r=t===`add`?dd:fd;e.generateKey?md.prototype[n]=function(i,a,o){return r(this,n,!0,(e.type||this.type)===`undirected`,null,i,a,o,t===`update`)}:md.prototype[n]=function(i,a,o,s){return r(this,n,!1,(e.type||this.type)===`undirected`,i,a,o,s,t===`update`)}})}),cu(md),yu(md),Bu(md),Qu(md);var hd=class extends md{constructor(e){let t=Ml({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)}},gd=class extends md{constructor(e){let t=Ml({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)}},_d=class extends md{constructor(e){let t=Ml({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)}},vd=class extends md{constructor(e){let t=Ml({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)}},yd=class extends md{constructor(e){let t=Ml({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 bd(e){e.from=function(t,n){let r=new e(Ml({},t.options,n));return r.import(t),r}}bd(md),bd(hd),bd(gd),bd(_d),bd(vd),bd(yd),md.Graph=md,md.DirectedGraph=hd,md.UndirectedGraph=gd,md.MultiGraph=_d,md.MultiDirectedGraph=vd,md.MultiUndirectedGraph=yd,md.InvalidArgumentsGraphError=Y,md.NotFoundGraphError=X,md.UsageGraphError=Z;function xd(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 Sd(e){var t=xd(e,`string`);return typeof t==`symbol`?t:t+``}function Cd(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function wd(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,Sd(r.key),r)}}function Td(e,t,n){return t&&wd(e.prototype,t),n&&wd(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Ed(e){return Ed=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Ed(e)}function Dd(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Dd=function(){return!!e})()}function Od(e){if(e===void 0)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return e}function kd(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 Od(e)}function Ad(e,t,n){return t=Ed(t),kd(e,Dd()?Reflect.construct(t,n||[],Ed(e).constructor):t.apply(e,n))}function jd(e,t){return jd=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},jd(e,t)}function Md(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&&jd(e,t)}function Nd(e){if(Array.isArray(e))return e}function Pd(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 Fd(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 Id(e,t){if(e){if(typeof e==`string`)return Fd(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)?Fd(e,t):void 0}}function Ld(){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 Rd(e,t){return Nd(e)||Pd(e,t)||Id(e,t)||Ld()}var zd={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`},Bd=new Int8Array(4),Vd=new Int32Array(Bd.buffer,0,1),Hd=new Float32Array(Bd.buffer,0,1),Ud=/^\s*rgba?\s*\(/,Wd=/^\s*rgba?\s*\(\s*([0-9]*)\s*,\s*([0-9]*)\s*,\s*([0-9]*)(?:\s*,\s*(.*)?)?\)\s*$/;function Gd(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(Ud.test(e)){var a=e.match(Wd);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 Kd={};for(var qd in zd)Kd[qd]=Yd(zd[qd]),Kd[zd[qd]]=Kd[qd];function Jd(e,t,n,r,i){return Vd[0]=r<<24|n<<16|t<<8|e,i&&(Vd[0]&=4278190079),Hd[0]}function Yd(e){if(e=e.toLowerCase(),Kd[e]!==void 0)return Kd[e];var t=Gd(e),n=t.r,r=t.g,i=t.b,a=t.a;a=a*255|0;var o=Jd(n,r,i,a,!0);return Kd[e]=o,o}function Xd(e,t){Hd[0]=Yd(e);var n=Vd[0];return t&&(n|=16777216),[n&255,n>>8&255,n>>16&255,n>>24&255]}var Zd={};function Qd(e){if(Zd[e]!==void 0)return Zd[e];var t=Jd((e&16711680)>>>16,(e&65280)>>>8,e&255,255,!0);return Zd[e]=t,t}function $d(e,t,n,r){return n+(t<<8)+(e<<16)}function ef(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=Rd(c,4);return[l[0],l[1],l[2],l[3]]}function Q(e,t,n){return(t=Sd(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function tf(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?tf(Object(n),!0).forEach(function(t){Q(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):tf(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function nf(e,t){for(;!{}.hasOwnProperty.call(e,t)&&(e=Ed(e))!==null;);return e}function rf(){return rf=typeof Reflect<`u`&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=nf(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},rf.apply(null,arguments)}function af(e,t,n,r){var i=rf(Ed(1&r?e.prototype:e),t,n);return 2&r&&typeof i==`function`?function(e){return i.apply(n,e)}:i}function of(e){return e.normalized?1:e.size}function sf(e){var t=0;return e.forEach(function(e){return t+=of(e)}),t}function cf(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 lf(e,t){return cf(`VERTEX`,e,t)}function uf(e,t){return cf(`FRAGMENT`,e,t)}function df(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 ff(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 pf(e){return e%1==0?e.toFixed(1):e.toString()}var mf=`#define PICKING_MODE
|
|
5
|
-
`,hf=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),gf=function(){function e(t,n,r){Cd(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=sf(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,mf+i.VERTEX_SHADER_SOURCE,mf+i.FRAGMENT_SHADER_SOURCE,n):null,this.isInstanced){var a=sf(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 Td(e,[{key:`kill`,value:function(){ff(this.normalProgram),this.pickProgram&&=(ff(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=lf(t,n),c=uf(t,r),l=df(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=hf[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:sf(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)}}}])}(),_f=function(e){function t(){return Cd(this,t),Ad(this,t,arguments)}return Md(t,e),Td(t,[{key:`kill`,value:function(){af(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(Qd(e),r,n)}}])}(gf);function vf(e,t,n){return function(){function r(i,a,o){Cd(this,r),Q(this,`drawLabel`,t),Q(this,`drawHover`,n),this.programs=e.map(function(e){return new e(i,a,o)})}return Td(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 yf=function(e){function t(){var e;Cd(this,t);var n=[...arguments];return e=Ad(this,t,[].concat(n)),Q(e,`drawLabel`,void 0),e}return Md(t,e),Td(t,[{key:`kill`,value:function(){af(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(Qd(e),a,n,r,i)}}])}(gf);function bf(e,t){return function(){function n(r,i,a){Cd(this,n),Q(this,`drawLabel`,t),this.programs=e.map(function(e){return new e(r,i,a)})}return Td(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 xf(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 Sf(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 Cf(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,Sf(e,t,n)}var wf=`
|
|
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
|
-
`,Tf=`
|
|
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
|
-
`,Ef=WebGLRenderingContext,Df=Ef.UNSIGNED_BYTE,Of=Ef.FLOAT,kf=[`u_sizeRatio`,`u_correctionRatio`,`u_matrix`],Af=function(e){function t(){return Cd(this,t),Ad(this,t,arguments)}return Md(t,e),Td(t,[{key:`getDefinition`,value:function(){return{VERTICES:3,VERTEX_SHADER_SOURCE:Tf,FRAGMENT_SHADER_SOURCE:wf,METHOD:WebGLRenderingContext.TRIANGLES,UNIFORMS:kf,ATTRIBUTES:[{name:`a_position`,size:2,type:Of},{name:`a_size`,size:1,type:Of},{name:`a_color`,size:4,type:Df,normalized:!0},{name:`a_id`,size:4,type:Df,normalized:!0}],CONSTANT_ATTRIBUTES:[{name:`a_angle`,size:1,type:Of}],CONSTANT_DATA:[[t.ANGLE_1],[t.ANGLE_2],[t.ANGLE_3]]}}},{key:`processVisibleItem`,value:function(e,t,n){var r=this.array,i=Yd(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)}}])}(_f);Q(Af,`ANGLE_1`,0),Q(Af,`ANGLE_2`,2*Math.PI/3),Q(Af,`ANGLE_3`,4*Math.PI/3);var jf=`
|
|
79
|
-
precision mediump float;
|
|
80
|
-
|
|
81
|
-
varying vec4 v_color;
|
|
82
|
-
|
|
83
|
-
void main(void) {
|
|
84
|
-
gl_FragColor = v_color;
|
|
85
|
-
}
|
|
86
|
-
`,Mf=`
|
|
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
|
-
`,Nf=WebGLRenderingContext,Pf=Nf.UNSIGNED_BYTE,Ff=Nf.FLOAT,If=[`u_matrix`,`u_sizeRatio`,`u_correctionRatio`,`u_minEdgeThickness`,`u_lengthToThicknessRatio`,`u_widenessToThicknessRatio`],Lf={extremity:`target`,lengthToThicknessRatio:2.5,widenessToThicknessRatio:2};function Rf(e){var t=$($({},Lf),e||{});return function(e){function n(){return Cd(this,n),Ad(this,n,arguments)}return Md(n,e),Td(n,[{key:`getDefinition`,value:function(){return{VERTICES:3,VERTEX_SHADER_SOURCE:Mf,FRAGMENT_SHADER_SOURCE:jf,METHOD:WebGLRenderingContext.TRIANGLES,UNIFORMS:If,ATTRIBUTES:[{name:`a_position`,size:2,type:Ff},{name:`a_normal`,size:2,type:Ff},{name:`a_radius`,size:1,type:Ff},{name:`a_color`,size:4,type:Pf,normalized:!0},{name:`a_id`,size:4,type:Pf,normalized:!0}],CONSTANT_ATTRIBUTES:[{name:`a_barycentric`,size:3,type:Ff}],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=Yd(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)}}])}(yf)}Rf();var zf=`
|
|
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
|
-
`,Bf=`
|
|
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
|
-
`,Vf=WebGLRenderingContext,Hf=Vf.UNSIGNED_BYTE,Uf=Vf.FLOAT,Wf=[`u_matrix`,`u_zoomRatio`,`u_sizeRatio`,`u_correctionRatio`,`u_pixelRatio`,`u_feather`,`u_minEdgeThickness`,`u_lengthToThicknessRatio`],Gf={lengthToThicknessRatio:Lf.lengthToThicknessRatio};function Kf(e){var t=$($({},Gf),e||{});return function(e){function n(){return Cd(this,n),Ad(this,n,arguments)}return Md(n,e),Td(n,[{key:`getDefinition`,value:function(){return{VERTICES:6,VERTEX_SHADER_SOURCE:Bf,FRAGMENT_SHADER_SOURCE:zf,METHOD:WebGLRenderingContext.TRIANGLES,UNIFORMS:Wf,ATTRIBUTES:[{name:`a_positionStart`,size:2,type:Uf},{name:`a_positionEnd`,size:2,type:Uf},{name:`a_normal`,size:2,type:Uf},{name:`a_color`,size:4,type:Hf,normalized:!0},{name:`a_id`,size:4,type:Hf,normalized:!0},{name:`a_radius`,size:1,type:Uf}],CONSTANT_ATTRIBUTES:[{name:`a_positionCoef`,size:1,type:Uf},{name:`a_normalCoef`,size:1,type:Uf},{name:`a_radiusCoef`,size:1,type:Uf}],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=Yd(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)}}])}(yf)}Kf();function qf(e){return bf([Kf(e),Rf(e)])}var Jf=qf(),Yf=`
|
|
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
|
-
`,Xf=WebGLRenderingContext,Zf=Xf.UNSIGNED_BYTE,Qf=Xf.FLOAT,$f=[`u_matrix`,`u_zoomRatio`,`u_sizeRatio`,`u_correctionRatio`,`u_pixelRatio`,`u_feather`,`u_minEdgeThickness`],ep=function(e){function t(){return Cd(this,t),Ad(this,t,arguments)}return Md(t,e),Td(t,[{key:`getDefinition`,value:function(){return{VERTICES:6,VERTEX_SHADER_SOURCE:Yf,FRAGMENT_SHADER_SOURCE:zf,METHOD:WebGLRenderingContext.TRIANGLES,UNIFORMS:$f,ATTRIBUTES:[{name:`a_positionStart`,size:2,type:Qf},{name:`a_positionEnd`,size:2,type:Qf},{name:`a_normal`,size:2,type:Qf},{name:`a_color`,size:4,type:Zf,normalized:!0},{name:`a_id`,size:4,type:Zf,normalized:!0}],CONSTANT_ATTRIBUTES:[{name:`a_positionCoef`,size:1,type:Qf},{name:`a_normalCoef`,size:1,type:Qf}],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=Yd(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)}}])}(yf),tp=function(e){function t(){var e;return Cd(this,t),e=Ad(this,t),e.rawEmitter=e,e}return Md(t,e),Td(t)}(Al.EventEmitter),np=o(((e,t)=>{t.exports=function(e){return typeof e==`object`&&!!e&&typeof e.addUndirectedEdgeWithKey==`function`&&typeof e.dropNode==`function`&&typeof e.multi==`boolean`}})),rp=c(np()),ip={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)}},ap={easing:`quadraticInOut`,duration:150};function op(){return Float32Array.of(1,0,0,0,1,0,0,0,1)}function sp(e,t,n){return e[0]=t,e[4]=typeof n==`number`?n:t,e}function cp(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 lp(e,t,n){return e[6]=t,e[7]=n,e}function up(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 dp(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 fp(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 pp(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=op(),f=Math.min(l,u)-2*r,p=fp(t,n);return i?(up(d,lp(op(),s,c)),up(d,sp(op(),o)),up(d,cp(op(),a)),up(d,sp(op(),l/f/2/p,u/f/2/p))):(up(d,sp(op(),f/l*2*p,f/u*2*p)),up(d,cp(op(),-a)),up(d,sp(op(),1/o)),up(d,lp(op(),-s,-c))),d}function mp(e,t,n){var r=dp(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 hp(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 gp(e){if(!(0,rp.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 _p(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 vp(){return window.devicePixelRatio===void 0?1:window.devicePixelRatio}function yp(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 bp(e){var t=Rd(e.x,2),n=t[0],r=t[1],i=Rd(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 xp(e){"@babel/helpers - typeof";return xp=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},xp(e)}function Sp(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 Cp(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 wp={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:xf,defaultDrawNodeLabel:Sf,defaultDrawNodeHover:Cf,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:{}},Tp={circle:Af},Ep={arrow:Jf,line:ep};function Dp(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 Op(e){var t=Cp({},wp,e);return t.nodeProgramClasses=Cp({},Tp,t.nodeProgramClasses),t.edgeProgramClasses=Cp({},Ep,t.edgeProgramClasses),t}var kp=1.5,Ap=function(e){function t(){var e;return Cd(this,t),e=Ad(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 Md(t,e),Td(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=$($({},ap),n),a=this.validateState(e),o=typeof i.easing==`function`?i.easing:ip[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||kp)},e):this.animate({ratio:this.ratio/kp})}},{key:`animatedUnzoom`,value:function(e){return e?typeof e==`number`?this.animate({ratio:this.ratio*e}):this.animate({ratio:this.ratio*(e.factor||kp)},e):this.animate({ratio:this.ratio*kp})}},{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)}}])}(tp);function jp(e,t){var n=t.getBoundingClientRect();return{x:e.clientX-n.left,y:e.clientY-n.top}}function Mp(e,t){var n=$($({},jp(e,t)),{},{sigmaDefaultPrevented:!1,preventSigmaDefault:function(){n.sigmaDefaultPrevented=!0},original:e});return n}function Np(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 Pp(e,t){return $($({},Mp(e,t)),{},{delta:Rp(e)})}var Fp=2;function Ip(e){for(var t=[],n=0,r=Math.min(e.length,Fp);n<r;n++)t.push(e[n]);return t}function Lp(e,t,n){var r={touches:Ip(e.touches).map(function(e){return jp(e,n)}),previousTouches:t.map(function(e){return jp(e,n)}),sigmaDefaultPrevented:!1,preventSigmaDefault:function(){r.sigmaDefaultPrevented=!0},original:e};return r}function Rp(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 zp=function(e){function t(e,n){var r;return Cd(this,t),r=Ad(this,t),r.container=e,r.renderer=n,r}return Md(t,e),Td(t)}(tp),Bp=[`doubleClickTimeout`,`doubleClickZoomingDuration`,`doubleClickZoomingRatio`,`dragTimeout`,`draggedEventsTolerance`,`inertiaDuration`,`inertiaRatio`,`zoomDuration`,`zoomingRatio`].reduce(function(e,t){return $($({},e),{},Q({},t,wp[t]))},{}),Vp=function(e){function t(e,n){var r;return Cd(this,t),r=Ad(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`,Bp),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 Md(t,e),Td(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`,Mp(e,this.container))}}},{key:`handleRightClick`,value:function(e){this.enabled&&this.emit(`rightClick`,Mp(e,this.container))}},{key:`handleDoubleClick`,value:function(e){if(this.enabled){e.preventDefault(),e.stopPropagation();var t=Mp(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(jp(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=jp(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`,Mp(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=jp(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`,Mp(e,this.container))}}},{key:`handleMove`,value:function(e){var t=this;if(this.enabled){var n=Mp(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=jp(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`,Mp(e,this.container))}},{key:`handleEnter`,value:function(e){this.emit(`mouseenter`,Mp(e,this.container))}},{key:`handleWheel`,value:function(e){var t=this,n=this.renderer.getCamera();if(!(!this.enabled||!n.enabledZooming)){var r=Rp(e);if(r){var i=Pp(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(jp(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}}])}(zp),Hp=[`dragTimeout`,`inertiaDuration`,`inertiaRatio`,`doubleClickTimeout`,`doubleClickZoomingRatio`,`doubleClickZoomingDuration`,`tapMoveTolerance`].reduce(function(e,t){return $($({},e),{},Q({},t,wp[t]))},{}),Up=function(e){function t(e,n){var r;return Cd(this,t),r=Ad(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`,Hp),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 Md(t,e),Td(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=Ip(e.touches);if(this.touchMode=n.length,this.startCameraState=this.renderer.getCamera().getState(),this.startTouchesPositions=n.map(function(e){return jp(e,t.container)}),this.touchMode===2){var r=Rd(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`,Lp(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`,Lp(e,this.lastTouches,this.container)),!e.touches.length){var i=jp(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=Lp(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=Lp(e,this.lastTouches,this.container);this.emit(`tap`,u),this.lastTap={time:Date.now(),position:u.touches[0]||u.previousTouches[0]}}}}this.lastTouches=Ip(e.touches),this.startTouchesPositions=[]}}},{key:`handleMove`,value:function(e){var t=this;if(!(!this.enabled||!this.startTouchesPositions.length)){e.preventDefault();var n=Ip(e.touches),r=n.map(function(e){return jp(e,t.container)}),i=this.lastTouches;this.lastTouches=n,this.lastTouchesPositions=r;var a=Lp(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,ne=_-ee/2/te,k=v-ee/2/D,re=[ne*Math.cos(-h.angle)-k*Math.sin(-h.angle),k*Math.cos(-h.angle)+ne*Math.sin(-h.angle)];ne=re[0],k=re[1],h.x=E.x-ne*O,h.y=E.y+k*O,o.setState(h)}}}}},{key:`setSettings`,value:function(e){this.settings=e}}])}(zp);function Wp(e){if(Array.isArray(e))return Fd(e)}function Gp(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function Kp(){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 qp(e){return Wp(e)||Gp(e)||Id(e)||Kp()}function Jp(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 Yp(e,t){if(e==null)return{};var n,r,i=Jp(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 Xp=function(){function e(t,n){Cd(this,e),this.key=t,this.size=n}return Td(e,null,[{key:`compare`,value:function(e,t){return e.size>t.size?-1:e.size<t.size||e.key>t.key?1:-1}}])}(),Zp=function(){function e(){Cd(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 Td(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 Xp(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(Xp.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 Qp(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 $p=150,em=50,tm=Object.prototype.hasOwnProperty;function nm(e,t,n){if(!tm.call(n,`x`)||!tm.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,tm.call(n,`hidden`)||(n.hidden=!1),tm.call(n,`highlighted`)||(n.highlighted=!1),tm.call(n,`forceLabel`)||(n.forceLabel=!1),(!n.type||n.type===``)&&(n.type=e.defaultNodeType),n.zIndex||=0,n}function rm(e,t,n){return n.color||=e.defaultEdgeColor,n.label||=``,n.size||=.5,tm.call(n,`hidden`)||(n.hidden=!1),tm.call(n,`forceLabel`)||(n.forceLabel=!1),(!n.type||n.type===``)&&(n.type=e.defaultEdgeType),n.zIndex||=0,n}var im=function(e){function t(e,n){var r,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(Cd(this,t),r=Ad(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 Zp),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`,op()),Q(r,`invMatrix`,op()),Q(r,`correctionRatio`,1),Q(r,`customBBox`,null),Q(r,`normalizationFunction`,bp({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`,vp()),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=Op(i),Dp(r.settings),gp(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 Ap,r.bindCameraHandlers(),r.mouseCaptor=new Vp(r.elements.mouse,r),r.mouseCaptor.setSettings(r.settings),r.touchCaptor=new Up(r.elements.mouse,r),r.touchCaptor.setSettings(r.settings),r.bindEventHandlers(),r.bindGraphHandlers(),r.handleSettingsUpdate(),r.refresh(),r}return Md(t,e),Td(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=Yp(t,[e].map(Sd));n.kill(),this.nodePrograms=r}if(this.nodeHoverPrograms[e]){var i=this.nodeHoverPrograms,a=i[e],o=Yp(i,[e].map(Sd));a.kill(),this.nodePrograms=o}return this}},{key:`unregisterEdgeProgram`,value:function(e){if(this.edgePrograms[e]){var t=this.edgePrograms,n=t[e],r=Yp(t,[e].map(Sd));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=ef(this.webGLContexts.nodes,this.frameBuffers.nodes,t,n,this.pixelRatio,this.pickingDownSizingRatio),i=$d.apply(void 0,qp(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=Np(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=Np(t);e.emit(`moveBody`,{event:n,preventSigmaDefault:function(){n.preventSigmaDefault()}})},this.activeListeners.handleLeave=function(t){var n=Np(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=Np(t),r={event:n,preventSigmaDefault:function(){n.preventSigmaDefault()}};e.emit(`enterStage`,$({},r))};var t=function(t){return function(n){var r=Np(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=ef(this.webGLContexts.edges,this.frameBuffers.edges,e,t,this.pixelRatio,this.pickingDownSizingRatio),r=$d.apply(void 0,qp(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=hp(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=bp(this.customBBox||this.nodeExtent);var l=pp(new Ap().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(!tm.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=yp(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],ne=this.edgeDataCache[O];E[ne.type]=(E[ne.type]||0)+1}for(var k in this.settings.zIndex&&this.edgeZExtent[0]!==this.edgeZExtent[1]&&(ee=yp(this.edgeZExtent,function(t){return e.edgeDataCache[t].zIndex},ee)),this.edgePrograms){if(!tm.call(this.edgePrograms,k))throw Error(`Sigma: could not find a suitable program for edge type "${k}"!`);this.edgePrograms[k].reallocate(E[k]||0),E[k]=0}for(var re=0,ie=ee.length;re<ie;re++){var ae=ee[re];f[ae]=m,p[f[ae]]={type:`edge`,id:ae},m++;var oe=this.edgeDataCache[ae];this.addEdgeToProgram(ae,f[ae],E[oe.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&&xp(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=Rd(o.x,2),c=s[0],l=s[1],u=Rd(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);Sp(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<-$p||c>this.width+$p||l<-em||l>this.height+em)){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=Qp({graph:this.graph,hoveredNode:this.hoveredNode,displayedNodeLabels:this.displayedNodeLabels,highlightedNodes:this.highlightedNodes});Sp(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=pp(i,a,o,s),this.invMatrix=pp(i,a,o,s,!0),this.correctionRatio=mp(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=nm(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=rm(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 Zp,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=_p(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,Dp(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),Dp(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=vp(),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=dp(t.matrix?t.matrix:n?pp(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=dp(t.matrix?t.matrix:n?pp(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}}])}(tp),am=[`application`,`environment`,`service`,`service_instance`,`system_ref`,`repo`];function om(e){let t=+this._x.call(null,e),n=+this._y.call(null,e);return sm(this.cover(t,n),t,n,e)}function sm(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 cm(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)sm(this,o[n],s[n],e[n]);return this}function lm(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 um(){var e=[];return this.visit(function(t){if(!t.length)do e.push(t.data);while(t=t.next)}),e}function dm(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 fm(e,t,n,r,i){this.node=e,this.x0=t,this.y0=n,this.x1=r,this.y1=i}function pm(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 fm(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 fm(p[3],g,_,c,l),new fm(p[2],o,_,g,l),new fm(p[1],g,s,c,_),new fm(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 mm(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 hm(e){for(var t=0,n=e.length;t<n;++t)this.remove(e[t]);return this}function gm(){return this._root}function _m(){var e=0;return this.visit(function(t){if(!t.length)do++e;while(t=t.next)}),e}function vm(e){var t=[],n,r=this._root,i,a,o,s,c;for(r&&t.push(new fm(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 fm(i,l,u,s,c)),(i=r[2])&&t.push(new fm(i,a,u,l,c)),(i=r[1])&&t.push(new fm(i,l,o,s,u)),(i=r[0])&&t.push(new fm(i,a,o,l,u))}return this}function ym(e){var t=[],n=[],r;for(this._root&&t.push(new fm(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 fm(a,o,s,u,d)),(a=i[1])&&t.push(new fm(a,u,s,c,d)),(a=i[2])&&t.push(new fm(a,o,d,u,l)),(a=i[3])&&t.push(new fm(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 bm(e){return e[0]}function xm(e){return arguments.length?(this._x=e,this):this._x}function Sm(e){return e[1]}function Cm(e){return arguments.length?(this._y=e,this):this._y}function wm(e,t,n){var r=new Tm(t??bm,n??Sm,NaN,NaN,NaN,NaN);return e==null?r:r.addAll(e)}function Tm(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 Em(e){for(var t={data:e.data},n=t;e=e.next;)n=n.next={data:e.data};return t}var Dm=wm.prototype=Tm.prototype;Dm.copy=function(){var e=new Tm(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=Em(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]=Em(r));return e},Dm.add=om,Dm.addAll=cm,Dm.cover=lm,Dm.data=um,Dm.extent=dm,Dm.find=pm,Dm.remove=mm,Dm.removeAll=hm,Dm.root=gm,Dm.size=_m,Dm.visit=vm,Dm.visitAfter=ym,Dm.x=xm,Dm.y=Cm;function Om(e){return function(){return e}}function km(e){return(e()-.5)*1e-6}function Am(e){return e.x+e.vx}function jm(e){return e.y+e.vy}function Mm(e){var t,n,r,i=1,a=1;typeof e!=`function`&&(e=Om(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=wm(t,Am,jm).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=km(r),_+=h*h),g===0&&(g=km(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:Om(+t),c(),o):e},o}function Nm(e){return e.index}function Pm(e,t){var n=e.get(t);if(!n)throw Error(`node not found: `+t);return n}function Fm(e){var t=Nm,n=d,r,i=Om(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||km(l),m=f.y+f.vy-d.y-d.vy||km(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=Pm(u,d.source)),typeof d.target!=`object`&&(d.target=Pm(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:Om(+e),m(),f):n},f.distance=function(e){return arguments.length?(i=typeof e==`function`?e:Om(+e),h(),f):i},f}var Im={value:()=>{}};function Lm(){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 Rm(n)}function Rm(e){this._=e}function zm(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}})}Rm.prototype=Lm.prototype={constructor:Rm,on:function(e,t){var n=this._,r=zm(e+``,n),i,a=-1,o=r.length;if(arguments.length<2){for(;++a<o;)if((i=(e=r[a]).type)&&(i=Bm(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]=Vm(n[i],e.name,t);else if(t==null)for(i in n)n[i]=Vm(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 Rm(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 Bm(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function Vm(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=Im,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var Hm=0,Um=0,Wm=0,Gm=1e3,Km,qm,Jm=0,Ym=0,Xm=0,Zm=typeof performance==`object`&&performance.now?performance:Date,Qm=typeof window==`object`&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function $m(){return Ym||=(Qm(eh),Zm.now()+Xm)}function eh(){Ym=0}function th(){this._call=this._time=this._next=null}th.prototype=nh.prototype={constructor:th,restart:function(e,t,n){if(typeof e!=`function`)throw TypeError(`callback is not a function`);n=(n==null?$m():+n)+(t==null?0:+t),!this._next&&qm!==this&&(qm?qm._next=this:Km=this,qm=this),this._call=e,this._time=n,sh()},stop:function(){this._call&&(this._call=null,this._time=1/0,sh())}};function nh(e,t,n){var r=new th;return r.restart(e,t,n),r}function rh(){$m(),++Hm;for(var e=Km,t;e;)(t=Ym-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Hm}function ih(){Ym=(Jm=Zm.now())+Xm,Hm=Um=0;try{rh()}finally{Hm=0,oh(),Ym=0}}function ah(){var e=Zm.now(),t=e-Jm;t>Gm&&(Xm-=t,Jm=e)}function oh(){for(var e,t=Km,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:Km=n);qm=e,sh(r)}function sh(e){Hm||(Um&&=clearTimeout(Um),e-Ym>24?(e<1/0&&(Um=setTimeout(ih,e-Zm.now()-Xm)),Wm&&=clearInterval(Wm)):(Wm||=(Jm=Zm.now(),setInterval(ah,Gm)),Hm=1,Qm(ih)))}var ch=1664525,lh=1013904223,uh=4294967296;function dh(){let e=1;return()=>(e=(ch*e+lh)%uh)/uh}function fh(e){return e.x}function ph(e){return e.y}var mh=10,hh=Math.PI*(3-Math.sqrt(5));function gh(e){var t,n=1,r=.001,i=1-r**(1/300),a=0,o=.6,s=new Map,c=nh(d),l=Lm(`tick`,`end`),u=dh();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=mh*Math.sqrt(.5+t),a=t*hh;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 _h(){var e,t,n,r,i=Om(-30),a,o=1,s=1/0,c=.81;function l(n){var i,a=e.length,o=wm(e,fh,ph).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=km(n),m+=d*d),f===0&&(f=km(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=km(n),m+=d*d),f===0&&(f=km(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:Om(+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 vh(e){var t=Om(.1),n,r,i;typeof e!=`function`&&(e=Om(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:Om(+e),o(),a):t},a.x=function(t){return arguments.length?(e=typeof t==`function`?t:Om(+t),o(),a):e},a}function yh(e){var t=Om(.1),n,r,i;typeof e!=`function`&&(e=Om(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:Om(+e),o(),a):t},a.y=function(t){return arguments.length?(e=typeof t==`function`?t:Om(+t),o(),a):e},a}var bh=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})),xh=c(o(((e,t)=>{var n=bh(),r=np(),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 Sh(e){let t=e;return()=>(t=Math.imul(t,1664525)+1013904223|0,(t>>>0)%1e6/1e6)}function Ch(e,t){e.forEachNode((e,n)=>{t.set(e,{x:n.x,y:n.y})})}function wh(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 Th(e,t=new Map){xh.default.assign(e,{rng:Sh(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=gh(n).force(`link`,Fm(r).id(e=>e.id).distance(145).strength(.75)).force(`charge`,_h().strength(-300).distanceMax(460)).force(`collide`,Mm().radius(62)).force(`x`,vh(0).strength(.06)).force(`y`,yh(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 Eh(e,t){Th(e,t)}function Dh(e,t){let n=t.get(e);if(n===void 0)throw TypeError(`Topology path references missing node "${e}".`);return n}function Oh(e,t,n){if(e===t||Dh(t,n)===`application`)return!1;let r=Dh(e,n);return r===`application`||r===`environment`||r===`service`||r===`repo`||r===`system_ref`}function kh(e,t,n){let r=new Map(t.map(e=>[e.key,e.kind]));Dh(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),Oh(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 Ah(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 jh(e){var t=Ah(e,`string`);return typeof t==`symbol`?t:t+``}function Mh(e,t,n){return(t=jh(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Nh(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 Ph(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Nh(Object(n),!0).forEach(function(t){Mh(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Nh(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Fh(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function Ih(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,jh(r.key),r)}}function Lh(e,t,n){return t&&Ih(e.prototype,t),n&&Ih(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Rh(e){return Rh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Rh(e)}function zh(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(zh=function(){return!!e})()}function Bh(e){if(e===void 0)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return e}function Vh(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 Bh(e)}function Hh(e,t,n){return t=Rh(t),Vh(e,zh()?Reflect.construct(t,n||[],Rh(e).constructor):t.apply(e,n))}function Uh(e,t){return Uh=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Uh(e,t)}function Wh(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&&Uh(e,t)}function Gh(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 Kh(e){if(Array.isArray(e))return Gh(e)}function qh(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function Jh(e,t){if(e){if(typeof e==`string`)return Gh(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)?Gh(e,t):void 0}}function Yh(){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 Xh(e){return Kh(e)||qh(e)||Jh(e)||Yh()}function Zh(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 Qh(e,t,n){for(var r=20,i=0,a=e,o=0;o<r;o++){var s=Zh((o+1)/r,e,t,n);i+=Math.sqrt((a.x-s.x)**2+(a.y-s.y)**2),a=s}return i}function $h(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)},ne=Math.sqrt(O.x**2+O.y**2);h+=ee*te.x/D,g+=ee*te.y/D,_+=ee*O.x/ne,v+=ee*O.y/ne,T+=ee*S/C,E-=ee*x/C;var k={x:T,y:E},re={x:h,y:g},ie={x:_,y:v},ae=Qh(re,k,ie);if(!(ae<a.size+o.size)){var oe=e.measureText(p).width,se=ae-a.size-o.size;if(oe>se){var ce=`…`;for(p+=ce,oe=e.measureText(p).width;oe>se&&p.length>1;)p=p.slice(0,-2)+ce,oe=e.measureText(p).width;if(p.length<4)return}for(var le={},ue=0,de=p.length;ue<de;ue++){var fe=p[ue];le[fe]||(le[fe]=e.measureText(fe).width*(1+l*.35))}for(var pe=.5-oe/ae/2,me=0,he=p.length;me<he;me++){var ge=p[me],_e=Zh(pe,re,k,ie),ve=2*(1-pe)*(T-h)+2*pe*(_-T),ye=2*(1-pe)*(E-g)+2*pe*(v-E),be=Math.atan2(ye,ve);e.save(),e.translate(_e.x,_e.y),e.rotate(be),e.fillText(ge,0,0),e.restore(),pe+=le[ge]/ae}}}}}function eg(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 tg(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 ng=.25,rg={arrowHead:null,curvatureAttribute:`curvature`,defaultCurvature:ng},ig=WebGLRenderingContext,ag=ig.UNSIGNED_BYTE,og=ig.FLOAT;function sg(e){var t=Ph(Ph({},rg),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(Xh(r?[`u_lengthToThicknessRatio`,`u_widenessToThicknessRatio`]:[]));return function(e){Wh(n,e);function n(){var e;Fh(this,n);var r=[...arguments];return e=Hh(this,n,[].concat(r)),Mh(Bh(e),`drawLabel`,a||$h(t)),e}return Lh(n,[{key:`getDefinition`,value:function(){return{VERTICES:6,VERTEX_SHADER_SOURCE:tg(t),FRAGMENT_SHADER_SOURCE:eg(t),METHOD:WebGLRenderingContext.TRIANGLES,UNIFORMS:c,ATTRIBUTES:[{name:`a_source`,size:2,type:og},{name:`a_target`,size:2,type:og}].concat(Xh(o?[{name:`a_targetSize`,size:1,type:og}]:[]),Xh(s?[{name:`a_sourceSize`,size:1,type:og}]:[]),[{name:`a_thickness`,size:1,type:og},{name:`a_curvature`,size:1,type:og},{name:`a_color`,size:4,type:ag,normalized:!0},{name:`a_id`,size:4,type:ag,normalized:!0}]),CONSTANT_ATTRIBUTES:[{name:`a_current`,size:1,type:og},{name:`a_direction`,size:1,type:og}],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=Yd(a.color),m=a[i]??ng,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}(yf)}sg();var cg=sg({arrowHead:Lf});sg({arrowHead:Ph(Ph({},Lf),{},{extremity:`both`})});function lg(e){if(Array.isArray(e))return e}function ug(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 dg(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 fg(e,t){if(e){if(typeof e==`string`)return dg(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)?dg(e,t):void 0}}function pg(){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 mg(e,t){return lg(e)||ug(e,t)||fg(e,t)||pg()}function hg(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function gg(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 _g(e){var t=gg(e,`string`);return typeof t==`symbol`?t:t+``}function vg(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,_g(r.key),r)}}function yg(e,t,n){return t&&vg(e.prototype,t),n&&vg(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function bg(e){return bg=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},bg(e)}function xg(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(xg=function(){return!!e})()}function Sg(e){if(e===void 0)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return e}function Cg(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 Sg(e)}function wg(e,t,n){return t=bg(t),Cg(e,xg()?Reflect.construct(t,n||[],bg(e).constructor):t.apply(e,n))}function Tg(e,t){return Tg=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Tg(e,t)}function Eg(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&&Tg(e,t)}function Dg(e,t,n){return(t=_g(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Og(e){if(Array.isArray(e))return dg(e)}function kg(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function Ag(){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 jg(e){return Og(e)||kg(e)||fg(e)||Ag()}function Mg(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 Ng(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Mg(Object(n),!0).forEach(function(t){Dg(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Mg(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Pg=`relative`,Fg={drawLabel:void 0,drawHover:void 0,borders:[{size:{value:.1},color:{attribute:`borderColor`}},{size:{fill:!0},color:{attribute:`color`}}]},Ig=`#000000`;function Lg(e){var t=e.borders,n=pf(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}`:pf(n.value),i=(n.mode||Pg)===`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 Rg(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 zg=WebGLRenderingContext,Bg=zg.UNSIGNED_BYTE,Vg=zg.FLOAT;function Hg(e){var t,n=Ng(Ng({},Fg),e||{}),r=n.borders,i=n.drawLabel,a=n.drawHover,o=[`u_sizeRatio`,`u_correctionRatio`,`u_matrix`].concat(jg(r.flatMap(function(e,t){return`value`in e.color?[`u_borderColor_${t+1}`]:[]})));return t=function(e){Eg(t,e);function t(){var e;hg(this,t);var n=[...arguments];return e=wg(this,t,[].concat(n)),Dg(Sg(e),`drawLabel`,i),Dg(Sg(e),`drawHover`,a),e}return yg(t,[{key:`getDefinition`,value:function(){return{VERTICES:3,VERTEX_SHADER_SOURCE:Rg(n),FRAGMENT_SHADER_SOURCE:Lg(n),METHOD:WebGLRenderingContext.TRIANGLES,UNIFORMS:o,ATTRIBUTES:[{name:`a_position`,size:2,type:Vg},{name:`a_id`,size:4,type:Bg,normalized:!0},{name:`a_size`,size:1,type:Vg}].concat(jg(r.flatMap(function(e,t){return`attribute`in e.color?[{name:`a_borderColor_${t+1}`,size:4,type:Bg,normalized:!0}]:[]})),jg(r.flatMap(function(e,t){return`attribute`in e.size?[{name:`a_borderSize_${t+1}`,size:1,type:Vg}]:[]}))),CONSTANT_ATTRIBUTES:[{name:`a_angle`,size:1,type:Vg}],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++]=Yd(n[r.attribute]||r.defaultValue||Ig))}),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=mg(Xd(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}(_f),Dg(t,`ANGLE_1`,0),Dg(t,`ANGLE_2`,2*Math.PI/3),Dg(t,`ANGLE_3`,4*Math.PI/3),t}var Ug=Hg();function Wg(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 Gg(e){if(Array.isArray(e))return Wg(e)}function Kg(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function qg(e,t){if(e){if(typeof e==`string`)return Wg(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)?Wg(e,t):void 0}}function Jg(){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 Yg(e){return Gg(e)||Kg(e)||qg(e)||Jg()}function Xg(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function Zg(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 Qg(e){var t=Zg(e,`string`);return typeof t==`symbol`?t:t+``}function $g(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,Qg(r.key),r)}}function e_(e,t,n){return t&&$g(e.prototype,t),n&&$g(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function t_(e){return t_=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},t_(e)}function n_(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(n_=function(){return!!e})()}function r_(e){if(e===void 0)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return e}function i_(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 r_(e)}function a_(e,t,n){return t=t_(t),i_(e,n_()?Reflect.construct(t,n||[],t_(e).constructor):t.apply(e,n))}function o_(e,t){for(;!{}.hasOwnProperty.call(e,t)&&(e=t_(e))!==null;);return e}function s_(){return s_=typeof Reflect<`u`&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=o_(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},s_.apply(null,arguments)}function c_(e,t,n,r){var i=s_(t_(1&r?e.prototype:e),t,n);return 2&r&&typeof i==`function`?function(e){return i.apply(n,e)}:i}function l_(e,t){return l_=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},l_(e,t)}function u_(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&&l_(e,t)}function d_(e,t,n){return(t=Qg(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function f_(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 p_(e,t){if(e==null)return{};var n,r,i=f_(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 m_(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 h_(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?m_(Object(n),!0).forEach(function(t){d_(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):m_(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function g_(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
|
-
${Yg(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 __=`
|
|
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 v_(){v_=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(ne([])));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 ne(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=ne,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:ne(t),resultName:n,nextLoc:r},this.method===`next`&&(this.arg=e),g}},t}function y_(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 b_(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var a=e.apply(t,n);function o(e){y_(a,r,i,o,s,`next`,e)}function s(e){y_(a,r,i,o,s,`throw`,e)}o(void 0)})}}var x_={size:{mode:`max`,value:512},objectFit:`cover`,correctCentering:!1,maxTextureSize:4096,debounceTimeout:500,crossOrigin:`anonymous`},S_=1;function C_(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 w_(e){return T_.apply(this,arguments)}function T_(){return T_=b_(v_().mark(function e(t){var n,r,i,a,o,s,c,l,u,d,f,p,m,h=arguments;return v_().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=C_(p),m.finally(function(){return URL.revokeObjectURL(p)}),e.abrupt(`return`,m);case 26:case`end`:return e.stop()}},e)})),T_.apply(this,arguments)}function E_(e){return D_.apply(this,arguments)}function D_(){return D_=b_(v_().mark(function e(t){var n,r,i,a,o,s=arguments;return v_().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,w_(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,C_(t,{crossOrigin:i});case 13:o=e.sent;case 14:e.next=19;break;case 16:return e.next=18,C_(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]])})),D_.apply(this,arguments)}function O_(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 k_(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+S_;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,ne=E.destinationSize,k=E.destinationX,re=E.destinationY;t.drawImage(ee,D,O,te,te,k,re,ne,ne)}return{atlas:d,texture:t.getImageData(0,0,S,C),cursor:{x:s,y:c,rowHeight:l,maxRowWidth:u}}}function A_(e,t,n){var r=e.atlas,i=e.textures,a=e.cursor,o={atlas:h_({},r),textures:Yg(i.slice(0,-1)),cursor:h_({},a)},s=[];for(var c in t){var l=t[c];l.status===`ready`&&typeof r[c]?.textureIndex!=`number`&&s.push(h_({key:c},l))}for(var u=function(){var e=k_(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]=h_(h_({},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 j_=function(){function e(){Xg(this,e),this.canvas=document.createElement(`canvas`),this.context=this.canvas.getContext(`2d`,{willReadFrequently:!0})}return e_(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}(),M_=function(e){u_(t,e);function t(){var e,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return Xg(this,t),e=a_(this,t),d_(r_(e),`canvas`,document.createElement(`canvas`)),d_(r_(e),`ctx`,e.canvas.getContext(`2d`,{willReadFrequently:!0})),d_(r_(e),`corrector`,new j_),d_(r_(e),`imageStates`,{}),d_(r_(e),`textures`,[e.ctx.getImageData(0,0,1,1)]),d_(r_(e),`lastTextureCursor`,{x:0,y:0,rowHeight:0,maxRowWidth:0}),d_(r_(e),`atlas`,{}),e.options=h_(h_({},x_),n),e.canvas.width=e.options.maxTextureSize,e.canvas.height=e.options.maxTextureSize,e}return e_(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=A_({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=b_(v_().mark(function e(t){var n,r;return v_().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,E_(t,{size:n.mode===`force`?n.value:void 0,crossOrigin:this.options.crossOrigin||void 0});case 7:r=e.sent,this.imageStates[t]=h_({status:`ready`,image:r},O_(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}(Al.EventEmitter);d_(M_,`NEW_TEXTURE_EVENT`,`newTexture`);var N_=[`drawHover`,`drawLabel`,`drawingMode`,`keepWithinCircle`,`padding`,`colorAttribute`,`imageAttribute`],P_=WebGLRenderingContext,F_=P_.UNSIGNED_BYTE,I_=P_.FLOAT,L_=h_(h_({},x_),{},{drawingMode:`background`,keepWithinCircle:!0,drawLabel:void 0,drawHover:void 0,padding:0,colorAttribute:`color`,imageAttribute:`image`}),R_=[`u_sizeRatio`,`u_correctionRatio`,`u_cameraAngle`,`u_percentagePadding`,`u_matrix`,`u_colorizeImages`,`u_keepWithinCircle`,`u_atlas`];function z_(e){var t,n=document.createElement(`canvas`).getContext(`webgl`),r=Math.min(n.getParameter(n.MAX_TEXTURE_SIZE),x_.maxTextureSize);n.canvas.remove();var i=h_(h_(h_({},L_),{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 M_(p_(i,N_));return t=function(e){u_(t,e);function t(e,n,r){var i;return Xg(this,t),i=a_(this,t,[e,n,r]),d_(r_(i),`drawLabel`,o),d_(r_(i),`drawHover`,a),d_(r_(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(M_.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 e_(t,[{key:`getDefinition`,value:function(){return{VERTICES:3,VERTEX_SHADER_SOURCE:__,FRAGMENT_SHADER_SOURCE:g_({texturesCount:f.getTextures().length}),METHOD:WebGLRenderingContext.TRIANGLES,UNIFORMS:R_,ATTRIBUTES:[{name:`a_position`,size:2,type:I_},{name:`a_size`,size:1,type:I_},{name:`a_color`,size:4,type:F_,normalized:!0},{name:`a_id`,size:4,type:F_,normalized:!0},{name:`a_texture`,size:4,type:I_},{name:`a_textureIndex`,size:1,type:I_}],CONSTANT_ATTRIBUTES:[{name:`a_angle`,size:1,type:I_}],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(M_.NEW_TEXTURE_EVENT,this.textureManagerCallback),null),c_(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]);c_(t,`renderProgram`,this,3)([e,n])}},{key:`processVisibleItem`,value:function(e,t,n){var r=this.array,i=Yd(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,Yg(Array(this.textureImages.length)).map(function(e,t){return t})),n.uniform1i(d,+(s===`color`)),n.uniform1i(f,+!!c)}}]),t}(_f),d_(t,`ANGLE_1`,0),d_(t,`ANGLE_2`,2*Math.PI/3),d_(t,`ANGLE_3`,4*Math.PI/3),d_(t,`textureManager`,f),t}z_(),z_({keepWithinCircle:!1,size:{mode:`force`,value:256},drawingMode:`color`,correctCentering:!0});function B_(e){return e.image===void 0?`glyph`:`icon`}function V_(e){if(typeof e!=`string`||e.trim().length===0)throw TypeError(`Topology renderer node has an invalid or missing color.`);return e}function H_(e){return e>250}function U_(e){return e.hovered||e.selected?!0:!e.dense&&e.kind!==`service_instance`&&e.kind!==`repo`}function W_(e,t){return e!==null&&t.has(e)?e:null}function G_(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 K_(e,t,n){let r=Math.hypot(t.x-e.x,t.y-e.y)-e.size-t.size-12;return r<48?null:{...G_(e,t,n),availableWidth:Math.min(150,r)}}var q_;function J_(e){q_=e}function Y_(){if(q_===void 0)throw TypeError(`Topology canvas palette was not initialized before rendering.`);return q_}var X_=new Set(am);function Z_(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 Q_(e){let t=e.kind;if(typeof t!=`string`||!X_.has(t))throw TypeError(`Topology renderer node has an invalid or missing kind.`);return{kind:t,color:V_(e.color),image:Z_(e,`image`),glyph:Z_(e,`glyph`),iconShellColor:Z_(e,`iconShellColor`),iconBorderColor:Z_(e,`iconBorderColor`)}}function $_(e){let t=e.curvature;if(t===void 0)return ng;if(typeof t!=`number`||!Number.isFinite(t))throw TypeError(`Topology renderer edge curvature must be a finite number.`);return t}function ev(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 tv(e,t,n,r,i){let a=Y_(),o=e.measureText(t).width,s=Math.ceil(o+10),c=Math.ceil(i+6);e.fillStyle=a.captionHalo,ev(e,n-s/2,r-1,s,c,4),e.fillStyle=a.caption,e.fillText(t,n,r)}var nv=(e,t,n)=>{let r=Y_(),i=Q_(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=ol(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))},rv=(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`,tv(e,r,t.x,t.y+t.size+6,i)},iv=(e,t,n)=>{let r=Y_();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(),rv(e,t,n)},av=(e,t,n,r,i)=>{let a=t.label;if(a===null||a.length===0)return;let o=K_({x:n.x,y:n.y,size:n.size},{x:r.x,y:r.y,size:r.size},$_(t));if(o===null)return;let s=Y_(),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,ev(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()},ov=vf([Ug],rv),sv=vf([Ug,z_({correctCentering:!0,drawingMode:`background`,keepWithinCircle:!0,objectFit:`contain`,padding:.18,size:{mode:`force`,value:128}})],rv),cv=bf([cg],av);function lv(e,t,n){let r=Yc(e.kind,t.get(e.key)),i={kind:e.kind,entityKey:e.entityKey},a=vl(e.providers,n.theme,i),o=a===void 0?{glyph:al[e.kind]}:{image:a};return{...e,...o,x:0,y:0,size:r.size,dependents:r.dependents,dependencies:r.dependencies,importance:r.score,color:_l(gl(e.providers,i))??n.nodeColors[e.kind],borderColor:n.nodeBorderColor}}function uv(e,t){return{...e,color:t.edgeColor,size:t.edgeSize}}function dv(e,t,n){let r=Jc(t.edges);return{nodes:e.nodes.map(e=>lv(e,r,n)),edges:e.edges.map(e=>uv(e,n))}}var fv=M(`<section class=topology-canvas-region role=region><button class="button button--subtle topology-reset-layout"type=button>Reset layout</button><div class=topology-canvas>`),pv={application:`--topology-application`,environment:`--topology-environment`,service:`--topology-service`,service_instance:`--topology-service-instance`,system_ref:`--topology-system`,repo:`--topology-repo`};function mv(e,t){let n=e.getPropertyValue(t).trim();if(n.length===0)throw TypeError(`Topology design role "${t}" is unavailable.`);return n}function hv(){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(pv).map(([e,n])=>[e,mv(t,n)])),i=mv(t,`--topology-caption`),a=mv(t,`--topology-edge`);return J_({caption:i,captionHalo:mv(t,`--topology-caption-halo`),glyph:mv(t,`--topology-glyph`),iconBorder:mv(t,`--topology-icon-border`),hoverRing:mv(t,`--topology-hover-ring`),edgeLabel:i}),{presentation:{theme:n,nodeColors:r,nodeBorderColor:mv(t,`--topology-icon-border`),edgeColor:a,edgeSize:1.15},activeEdge:mv(t,`--topology-edge-active`),dimEdge:mv(t,`--topology-edge-dim`),dimNode:mv(t,`--topology-node-dim`)}}function gv(e){return[...e.nodes.map(e=>e.key),`|`,...e.edges.map(e=>e.key)].join(`\0`)}function _v(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(!am.includes(t))throw TypeError(`Topology renderer node has unknown kind "${t}".`);return t}function vv(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 yv(e){let t,[n,r]=D(null),[i,a]=D(0),[o,s]=D(0),c=new Map,l=new Map,u;return oe(()=>{let i=new md({type:`directed`,multi:!0}),d=hv(),f=new im(i,t,{defaultDrawEdgeLabel:av,defaultDrawNodeHover:iv,defaultDrawNodeLabel:rv,defaultEdgeColor:d.presentation.edgeColor,defaultEdgeType:`curvedArrow`,defaultNodeType:`glyph`,edgeProgramClasses:{curvedArrow:cv},nodeProgramClasses:{glyph:ov,icon:sv},edgeLabelColor:{color:d.presentation.edgeColor},edgeLabelSize:10,edgeLabelWeight:`500`,enableEdgeEvents:!0,itemSizesReference:`screen`,labelColor:{color:mv(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);nv(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),Th(i),Ch(i,l),f.setCustomBBox(null),f.refresh(),f.getCamera().animatedReset({duration:280})},ne(()=>{o();let t=e.graph,n=dv(t,e.wholeEstate,hv().presentation),s=gv(t);if(s!==h){Ch(i,l),i.clear();for(let e of n.nodes)i.addNode(e.key,e),i.setNodeAttribute(e.key,`type`,B_(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=>W_(t,e)),a(c.size);let t=wh(i,l);f.setCustomBBox(null),t||(Th(i,c),Ch(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`,B_(e))}for(let e of n.edges)i.replaceEdgeAttributes(e.key,{...e,curvature:.14,type:`curvedArrow`})}f.refresh()}),ne(()=>{o();let t=e.graph,r=hv(),i=e.selectedKey,a=n()??i,s=H_(t.nodes.length),c=a!==null&&t.nodes.some(e=>e.key===a)?kh(a,t.nodes,t.edges):{nodes:new Set,edges:new Set};f.setSettings({defaultEdgeColor:r.presentation.edgeColor,edgeLabelColor:{color:r.presentation.edgeColor},labelColor:{color:mv(getComputedStyle(document.documentElement),`--topology-caption`)},nodeReducer:(e,t)=>{let o=B_(t),l=U_({kind:_v(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:vv(t)*1.2,type:o}:c.nodes.has(e)?{...t,forceLabel:l,size:vv(t)*1.06,type:o}:{...t,color:r.dimNode,forceLabel:!1,size:vv(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(vv(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&&(Eh(i,c),Ch(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=Zc(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),se(()=>{window.removeEventListener(`mouseup`,x),window.removeEventListener(`touchend`,x),window.removeEventListener(`touchcancel`,x),m.disconnect(),f.kill()})}),(()=>{var n=fv(),r=n.firstChild,a=r.nextSibling;r.$$click=()=>{u?.()};var o=t;return typeof o==`function`?it(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&&tt(n,`aria-label`,t.e=a),o!==t.t&&(r.disabled=t.t=o),t},{e:void 0,t:void 0}),n})()}et([`click`]);var bv=M(`<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`),xv=M(`<button type=button class=topology-back>← Back to `),Sv=M(`<label class=field><span class=field-label>Environment</span><select aria-label="Environment focus"><option value>All environments`),Cv=M(`<div class=topology-filter-empty role=status><p>No topology matches these filters.</p><button type=button class="button button--subtle">Reset filters`),wv=M(`<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>`),Tv=M(`<option>`),Ev=M(`<label><input type=checkbox><span aria-hidden=true></span><span>`),Dv=M(`<label><input type=checkbox><span>`),Ov=M(`<button type=button>`),kv=M(`<div><dt>Application</dt><dd>`),Av=M(`<div><dt>Provider</dt><dd>`),jv=M(`<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>`),Mv=M(`<div><dt>Environment</dt><dd>`),Nv=M(`<div><dt>Importance</dt><dd> dependents, <!> dependencies, score `),Pv=M(`<button type=button><span aria-hidden=true></span><span><strong></strong><small>`),Fv=M(`<section class=topology-preview-state><img alt="Example topology graph showing applications, environments, services, repositories, and connected systems"><div><h2>`),Iv=M(`<div class=topology-message role=status><h3>Loading topology</h3><p>Reading the latest confirmed topology.`),Lv=M(`<div class="topology-message topology-message-error"role=alert><h3>Topology could not be loaded</h3><p>`),Rv=M(`<div class="topology-message topology-message-error"role=alert><h3>Topology state could not be determined</h3><p>`),zv=M(`<p>`),Bv=M(`<a class="button button--primary">Open Confirm`),Vv=M(`<p>No confirmed or currently reviewable topology is available.`),Hv=M(`<p class=topology-coming-soon>Coming soon - on demand repo registry`),Uv=M(`<section class=topology-page>`),Wv={application:`Application`,environment:`Environment`,service:`Service`,service_instance:`Service instance`,system_ref:`Connected system`,repo:`Repository`};function Gv(e){return e===void 0||!e.ok?e:{ok:!0,value:e.value.graph}}function Kv(e,t){let n=new Set(e);return n.has(t)?n.delete(t):n.add(t),n}function qv(e){return e.nodes.filter(e=>e.kind===`application`).sort((e,t)=>e.label.localeCompare(t.label))}function Jv(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 Yv(e){let t=Ko(),[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=k(()=>Wc(e.data.graph,n())),h=k(()=>{let e=n();return e.kind===`application`?e:void 0}),g=k(()=>{let e=n();return e.kind===`environment`?e:void 0}),_=k(()=>[...new Set(m().nodes.map(e=>e.kind))].sort((e,t)=>Wv[e].localeCompare(Wv[t]))),v=k(()=>[...new Set(m().edges.map(e=>e.kind))].sort((e,t)=>e.localeCompare(t))),y=k(()=>[...new Set(m().nodes.flatMap(e=>e.providers))].sort((e,t)=>e.localeCompare(t))),b=k(()=>{let e=new Set(_().filter(e=>!o().has(e))),t=new Set(v().filter(e=>!c().has(e)));return Rc(m(),{query:i(),nodeKinds:o().size===0?new Set:e,relationshipKinds:c().size===0?new Set:t,providers:u()})}),x=k(()=>i().trim().length>0||o().size>0||c().size>0||u().size>0),S=k(()=>{let e=f();if(e!==null)return b().nodes.find(t=>t.key===e)}),C=k(()=>{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=k(()=>{let t=S();if(t!==void 0)return Yc(t.kind,Jc(e.data.graph.edges).get(t.key))});ne(()=>{f()!==null&&S()===void 0&&p(null)}),ne(()=>{t(el(ae(),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=Jv(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 re=t=>qv(e.data.graph).find(e=>e.entityKey===t)?.label??t,ie=t=>Jv(e.data.graph).find(e=>e.entityKey===t)?.label??t,ae=()=>{let e=n();if(e.kind===`estate`)return`Showing all confirmed topology`;if(e.kind===`application`){let t=re(e.applicationKey);return e.mode===`overview`?`Showing ${t} and its environments`:`Showing ${t} in full`}return`Showing ${ie(e.environmentKey)}`},oe=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=Jv(e.data.graph).find(e=>e.entityKey===t.environmentKey);return n?.applicationKey===null||n?.applicationKey===void 0?[]:[n.applicationKey]}return[]};return(()=>{var t=wv(),r=t.firstChild,m=r.firstChild,D=m.firstChild,ne=D.firstChild.nextSibling,k=D.nextSibling,se=k.nextSibling.nextSibling.firstChild.nextSibling;se.firstChild;var ce=m.nextSibling.firstChild,le=ce.firstChild.nextSibling,ue=ce.nextSibling,de=ue.firstChild.nextSibling,fe=ue.nextSibling,pe=fe.firstChild.nextSibling,me=fe.nextSibling,he=me.firstChild.nextSibling,ge=me.nextSibling.firstChild.nextSibling,_e=r.nextSibling,ve=_e.firstChild;return ne.$$click=()=>{E({kind:`estate`})},N(k,ae),se.addEventListener(`change`,e=>{ee(e.currentTarget.value)}),N(se,A(Ge,{get each(){return qv(e.data.graph)},children:e=>(()=>{var t=Tv();return N(t,()=>e.label),O(()=>t.value=e.entityKey),t})()}),null),N(m,A(j,{get when(){return h()},get children(){var e=bv(),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&&tt(t,`aria-pressed`,e.e=n),i!==e.t&&tt(r,`aria-pressed`,e.t=i),e},{e:void 0,t:void 0}),e}}),null),N(m,A(j,{get when(){return g()},get children(){var e=xv();return e.firstChild,e.$$click=()=>{let e=n();e.kind===`environment`&&E({kind:`application`,applicationKey:e.applicationKey,mode:`overview`})},N(e,(()=>{var e=Xe(()=>g()===void 0);return()=>e()?`Application`:re(g()?.applicationKey??``)})(),null),e}}),null),N(m,A(j,{get when(){return h()??g()},get children(){var t=Sv(),n=t.firstChild.nextSibling;return n.firstChild,n.addEventListener(`change`,e=>{te(e.currentTarget.value)}),N(n,A(Ge,{get each(){return Jv(e.data.graph,h()?.applicationKey??g()?.applicationKey)},children:e=>(()=>{var t=Tv();return N(t,()=>e.label),O(()=>t.value=e.entityKey),t})()}),null),O(()=>n.value=g()?.environmentKey??``),t}}),null),le.$$click=T,de.$$input=e=>{a(e.currentTarget.value)},N(pe,A(Ge,{get each(){return _()},children:e=>{let t=()=>!o().has(e)&&_().length-o().size===1;return(()=>{var n=Ev(),r=n.firstChild,i=r.nextSibling,a=i.nextSibling;return r.addEventListener(`change`,()=>{s(t=>Kv(t,e))}),nt(i,`topology-kind-mark topology-kind-mark--${e}`),N(i,()=>al[e]),N(a,()=>Wv[e]),O(()=>r.disabled=t()),O(()=>r.checked=!o().has(e)),n})()}})),N(he,A(Ge,{get each(){return v()},children:e=>{let t=()=>!c().has(e)&&v().length-c().size===1;return(()=>{var n=Dv(),r=n.firstChild,i=r.nextSibling;return r.addEventListener(`change`,()=>{l(t=>Kv(t,e))}),N(i,()=>xl(e)),O(()=>r.disabled=t()),O(()=>r.checked=!c().has(e)),n})()}})),N(ge,A(Ge,{get each(){return y()},children:e=>(()=>{var t=Ov();return t.$$click=()=>{d(t=>Kv(t,e))},N(t,()=>ml(e)),O(()=>tt(t,`aria-pressed`,u().has(e))),t})()})),N(ve,A(j,{get when(){return Xe(()=>b().nodes.length===0)()&&x()},get children(){var e=Cv(),t=e.firstChild.nextSibling;return t.$$click=T,e}}),null),N(ve,A(yv,{get graph(){return b()},get wholeEstate(){return e.data.graph},get focus(){return n()},get selectedKey(){return f()},onSelect:p,onNavigate:E}),null),N(_e,A(j,{get when(){return S()},children:e=>(()=>{var t=jv(),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 N(i,()=>Wv[e().kind]),N(a,()=>e().label),o.$$click=()=>{p(null)},N(s,A(j,{get when(){return oe(e()).length>0},get children(){var t=kv(),n=t.firstChild.nextSibling;return N(n,()=>oe(e()).map(re).join(`, `)),t}}),c),N(s,A(j,{get when(){return e().environmentKey},children:e=>(()=>{var t=Mv(),n=t.firstChild.nextSibling;return N(n,()=>ie(e())),t})()}),c),N(s,A(j,{get when(){return e().providers.length>0},get children(){var t=Av(),n=t.firstChild.nextSibling;return N(n,()=>e().providers.map(ml).join(`, `)),t}}),c),N(s,A(j,{get when(){return w()},children:e=>(()=>{var t=Nv(),n=t.firstChild.nextSibling,r=n.firstChild,i=r.nextSibling;return i.nextSibling,N(n,()=>e().dependents,r),N(n,()=>e().dependencies,i),N(n,()=>e().score.toFixed(2),null),t})()}),c),N(l,()=>e().entityKey),N(d,()=>C().length),N(f,A(Ge,{get each(){return C()},children:e=>(()=>{var t=Pv(),n=t.firstChild,r=n.nextSibling.firstChild,i=r.nextSibling;return t.$$click=()=>{e.other!==void 0&&p(e.other.key)},N(n,()=>e.outbound?`→`:`←`),N(r,()=>e.other?.label??`Outside current view`),N(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&&(ne.disabled=e.e=t),r!==e.t&&(le.disabled=e.t=r),e},{e:void 0,t:void 0}),O(()=>se.value=Xc(n())??``),O(()=>de.value=i()),t})()}function Xv(e){return(()=>{var t=Fv(),n=t.firstChild,r=n.nextSibling,i=r.firstChild;return tt(n,`src`,Qc),N(i,()=>e.title),N(r,()=>e.children,null),t})()}function Zv(){let e=us(kl),t=Mc(),n=Ko(),r=k(()=>$c(Gv(e()),t(),!1)),i=k(()=>{let e=r();return e.kind===`graph_failure`?e:void 0}),a=k(()=>{let e=r();return e.kind===`indeterminate`?e:void 0}),o=k(()=>{let e=r();return e.kind===`reviewable`?e:void 0}),s=k(()=>{let t=e();return t?.ok===!0?t.value:void 0});return ne(()=>{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`)}}),se(()=>{n(void 0)}),(()=>{var e=Uv();return N(e,A(Ke,{get children(){return[A(qe,{get when(){return r().kind===`loading`},get children(){return Iv()}}),A(qe,{get when(){return i()},get children(){var e=Lv(),t=e.firstChild.nextSibling;return N(t,()=>i()?.error.message),e}}),A(qe,{get when(){return a()},get children(){var e=Rv(),t=e.firstChild.nextSibling;return N(t,()=>a()?.error.message),e}}),A(qe,{get when(){return o()},get children(){return A(Xv,{title:`Topology is ready for confirmation`,get children(){return[(()=>{var e=zv();return N(e,()=>`${String(o()?.count??0)} topology candidates are currently ready for review.`),e})(),A(j,{get when(){return o()?.confirmAvailable===!0},get children(){var e=Bv();return tt(e,`href`,dc),e}})]}})}}),A(qe,{get when(){return r().kind===`empty`},get children(){return A(Xv,{title:`No topology is ready`,get children(){return[Vv(),Hv()]}})}}),A(qe,{get when(){return r().kind===`graph`},get children(){return A(j,{get when(){return s()},children:e=>A(Yv,{get data(){return e()}})})}})]}})),e})()}et([`click`,`input`]);var Qv=M(`<p>There is no page at this address.`),$v=()=>fo({method:`GET`,path:qr,schema:Mi,attempted:`read the daemon's update-poll status`}),ey=()=>fo({method:`GET`,path:Kr,schema:Oi,attempted:`read whether a practitioner has registered`}),ty=()=>fo({method:`GET`,path:Jr,schema:_a,attempted:`read topology pending review`});function ny(e){let t=Nt(),n=us(ey),r=()=>Sc(n(),yc()),i=us(ty),a=()=>mc({pathname:t.pathname,registered:r(),registrationRoute:ki,pendingReview:i(),confirmAvailable:!1}),o=us($v),[s,c]=D();return A(jc,{value:i,get children(){return A(Go,{value:c,get children(){return A(Uo,{get title(){return hc(t.pathname,ki,!1)},get subtitle(){return s()},get destinations(){return a()},get updatePoll(){return o()},get children(){return e.children}})}})}})}function ry(){return A(an,{root:ny,get children(){return[A(Yt,{path:`/`,component:Zv}),A(Yt,{path:uc,component:Zv}),A(Yt,{path:cc,component:_s}),A(Yt,{path:lc,component:sc}),A(Yt,{path:ki,component:kc}),A(Yt,{path:`*`,component:()=>Qv()})]}})}Do();var iy=document.getElementById(`root`);iy===null?document.body.textContent=`operator: the page is missing its #root element`:$e(()=>A(ry,{}),iy);
|