@aloudata/ink-flow 1.0.19 → 1.0.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/StoreUpdater/index.d.ts +2 -2
- package/dist/components/StoreUpdater/index.d.ts.map +1 -1
- package/dist/constants/layout.d.ts +5 -0
- package/dist/constants/layout.d.ts.map +1 -0
- package/dist/container/InkFlow/index.d.ts.map +1 -1
- package/dist/container/InkFlow/init-values.d.ts +8 -0
- package/dist/container/InkFlow/init-values.d.ts.map +1 -1
- package/dist/hooks/useNodesState.d.ts.map +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/store/index.d.ts.map +1 -1
- package/dist/store/initialState.d.ts.map +1 -1
- package/dist/types/general.d.ts +18 -0
- package/dist/types/general.d.ts.map +1 -1
- package/dist/types/props.d.ts +26 -1
- package/dist/types/props.d.ts.map +1 -1
- package/dist/types/store.d.ts +6 -2
- package/dist/types/store.d.ts.map +1 -1
- package/dist/utils/changes.d.ts.map +1 -1
- package/dist/utils/node.d.ts +23 -0
- package/dist/utils/node.d.ts.map +1 -0
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -13,5 +13,5 @@ E=k,function(){var e={}.hasOwnProperty;function n(){for(var e="",n=0;n<arguments
|
|
|
13
13
|
*
|
|
14
14
|
* This source code is licensed under the MIT license found in the
|
|
15
15
|
* LICENSE file in the root directory of this source tree.
|
|
16
|
-
*/j.exports=function(){if(M)return P;M=1;var n=e,t=z(),r="function"==typeof Object.is?Object.is:function(e,n){return e===n&&(0!==e||1/e==1/n)||e!=e&&n!=n},o=t.useSyncExternalStore,i=n.useRef,a=n.useEffect,u=n.useMemo,c=n.useDebugValue;return P.useSyncExternalStoreWithSelector=function(e,n,t,l,s){var d=i(null);if(null===d.current){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=u((function(){function e(e){if(!a){if(a=!0,o=e,e=l(e),void 0!==s&&f.hasValue){var n=f.value;if(s(n,e))return i=n}return i=e}if(n=i,r(o,e))return n;var t=l(e);return void 0!==s&&s(n,t)?n:(o=e,i=t)}var o,i,a=!1,u=void 0===t?null:t;return[function(){return e(n())},null===u?void 0:function(){return e(u())}]}),[n,t,l,s]);var h=o(e,d[0],d[1]);return a((function(){f.hasValue=!0,f.value=h}),[h]),c(h),h},P}();var T=w(j.exports);const L=e=>{let n;const t=new Set,r=(e,r)=>{const o="function"==typeof e?e(n):e;if(!Object.is(o,n)){const e=n;n=(null!=r?r:"object"!=typeof o||null===o)?o:Object.assign({},n,o),t.forEach((t=>t(n,e)))}},o=()=>n,i={setState:r,getState:o,getInitialState:()=>a,subscribe:e=>(t.add(e),()=>t.delete(e)),destroy:()=>{"production"!==(import.meta.env?import.meta.env.MODE:void 0)&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),t.clear()}},a=n=e(r,o,i);return i},{useDebugValue:B}=e,{useSyncExternalStoreWithSelector:D}=T,R=e=>e;function H(e,n=R,t){const r=D(e.subscribe,e.getState,e.getServerState||e.getInitialState,n,t);return B(r),r}const V=(e,n)=>{const t=(e=>e?L(e):L)(e),r=(e,r=n)=>H(t,e,r);return Object.assign(r,t),r};var Y=n(null),X=Y.Provider,Z=function(){return Z=Object.assign||function(e){for(var n,t=1,r=arguments.length;t<r;t++)for(var o in n=arguments[t])Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o]);return e},Z.apply(this,arguments)};function F(e){var n="function"==typeof Symbol&&Symbol.iterator,t=n&&e[n],r=0;if(t)return t.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(n?"Object is not iterable.":"Symbol.iterator is not defined.")}function U(e,n){var t="function"==typeof Symbol&&e[Symbol.iterator];if(!t)return e;var r,o,i=t.call(e),a=[];try{for(;(void 0===n||n-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(t=i.return)&&t.call(i)}finally{if(o)throw o.error}}return a}function W(e,n,t){if(2===arguments.length)for(var r,o=0,i=n.length;o<i;o++)!r&&o in n||(r||(r=Array.prototype.slice.call(n,0,o)),r[o]=n[o]);return e.concat(r||Array.prototype.slice.call(n))}"function"==typeof SuppressedError&&SuppressedError;var G,q,$,K,Q,J,ee,ne,te,re,oe,ie,ae,ue,ce,le,se,de,fe,he,ve,pe,ge,ye,me,we,be,xe,_e,Ee,Se,ke,Ne,Ce,Me,Oe,je,Pe,Ie,Ae,ze,Te,Le,Be,De,Re,He,Ve,Ye,Xe,Ze,Fe,Ue,We,Ge,qe,$e,Ke,Qe,Je,en,nn,tn,rn,on,an,un,cn,ln,sn,dn,fn,hn,vn,pn,gn,yn,mn,wn,bn,xn,_n,En,Sn,kn,Nn,Cn,Mn,On,jn,Pn,In,An,zn,Tn,Ln,Bn,Dn,Rn,Hn,Vn,Yn,Xn,Zn,Fn,Un,Wn,Gn,qn="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function $n(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Kn(){return K?$:(K=1,$=function(e,n){return e===n||e!=e&&n!=n})}function Qn(){if(J)return Q;J=1;var e=Kn();return Q=function(n,t){for(var r=n.length;r--;)if(e(n[r][0],t))return r;return-1},Q}function Jn(){if(le)return ce;le=1;var e=q?G:(q=1,G=function(){this.__data__=[],this.size=0}),n=function(){if(ne)return ee;ne=1;var e=Qn(),n=Array.prototype.splice;return ee=function(t){var r=this.__data__,o=e(r,t);return!(o<0||(o==r.length-1?r.pop():n.call(r,o,1),--this.size,0))}}(),t=function(){if(re)return te;re=1;var e=Qn();return te=function(n){var t=this.__data__,r=e(t,n);return r<0?void 0:t[r][1]}}(),r=function(){if(ie)return oe;ie=1;var e=Qn();return oe=function(n){return e(this.__data__,n)>-1}}(),o=function(){if(ue)return ae;ue=1;var e=Qn();return ae=function(n,t){var r=this.__data__,o=e(r,n);return o<0?(++this.size,r.push([n,t])):r[o][1]=t,this}}();function i(e){var n=-1,t=null==e?0:e.length;for(this.clear();++n<t;){var r=e[n];this.set(r[0],r[1])}}return i.prototype.clear=e,i.prototype.delete=n,i.prototype.get=t,i.prototype.has=r,i.prototype.set=o,ce=i}function et(){if(we)return me;we=1;var e="object"==typeof qn&&qn&&qn.Object===Object&&qn;return me=e}function nt(){if(xe)return be;xe=1;var e=et(),n="object"==typeof self&&self&&self.Object===Object&&self,t=e||n||Function("return this")();return be=t}function tt(){if(Ee)return _e;Ee=1;var e=nt().Symbol;return _e=e}function rt(){if(Oe)return Me;Oe=1;var e=tt(),n=function(){if(ke)return Se;ke=1;var e=tt(),n=Object.prototype,t=n.hasOwnProperty,r=n.toString,o=e?e.toStringTag:void 0;return Se=function(e){var n=t.call(e,o),i=e[o];try{e[o]=void 0;var a=!0}catch(e){}var u=r.call(e);return a&&(n?e[o]=i:delete e[o]),u}}(),t=function(){if(Ce)return Ne;Ce=1;var e=Object.prototype.toString;return Ne=function(n){return e.call(n)}}(),r=e?e.toStringTag:void 0;return Me=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":r&&r in Object(e)?n(e):t(e)}}function ot(){return Pe?je:(Pe=1,je=function(e){var n=typeof e;return null!=e&&("object"==n||"function"==n)})}function it(){if(Ae)return Ie;Ae=1;var e=rt(),n=ot();return Ie=function(t){if(!n(t))return!1;var r=e(t);return"[object Function]"==r||"[object GeneratorFunction]"==r||"[object AsyncFunction]"==r||"[object Proxy]"==r}}function at(){if(Re)return De;Re=1;var e=Function.prototype.toString;return De=function(n){if(null!=n){try{return e.call(n)}catch(e){}try{return n+""}catch(e){}}return""}}function ut(){if(Fe)return Ze;Fe=1;var e=function(){if(Ve)return He;Ve=1;var e=it(),n=function(){if(Be)return Le;Be=1;var e,n=function(){if(Te)return ze;Te=1;var e=nt()["__core-js_shared__"];return ze=e}(),t=(e=/[^.]+$/.exec(n&&n.keys&&n.keys.IE_PROTO||""))?"Symbol(src)_1."+e:"";return Le=function(e){return!!t&&t in e}}(),t=ot(),r=at(),o=/^\[object .+?Constructor\]$/,i=Function.prototype,a=Object.prototype,u=i.toString,c=a.hasOwnProperty,l=RegExp("^"+u.call(c).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");return He=function(i){return!(!t(i)||n(i))&&(e(i)?l:o).test(r(i))}}(),n=Xe?Ye:(Xe=1,Ye=function(e,n){return null==e?void 0:e[n]});return Ze=function(t,r){var o=n(t,r);return e(o)?o:void 0}}function ct(){if(We)return Ue;We=1;var e=ut()(nt(),"Map");return Ue=e}function lt(){if(qe)return Ge;qe=1;var e=ut()(Object,"create");return Ge=e}function st(){if(vn)return hn;vn=1;var e=fn?dn:(fn=1,dn=function(e){var n=typeof e;return"string"==n||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==e:null===e});return hn=function(n,t){var r=n.__data__;return e(t)?r["string"==typeof t?"string":"hash"]:r.map},hn}function dt(){if(Sn)return En;Sn=1;var e=function(){if(sn)return ln;sn=1;var e=function(){if(cn)return un;cn=1;var e=function(){if(Ke)return $e;Ke=1;var e=lt();return $e=function(){this.__data__=e?e(null):{},this.size=0}}(),n=Je?Qe:(Je=1,Qe=function(e){var n=this.has(e)&&delete this.__data__[e];return this.size-=n?1:0,n}),t=function(){if(nn)return en;nn=1;var e=lt(),n=Object.prototype.hasOwnProperty;return en=function(t){var r=this.__data__;if(e){var o=r[t];return"__lodash_hash_undefined__"===o?void 0:o}return n.call(r,t)?r[t]:void 0}}(),r=function(){if(rn)return tn;rn=1;var e=lt(),n=Object.prototype.hasOwnProperty;return tn=function(t){var r=this.__data__;return e?void 0!==r[t]:n.call(r,t)}}(),o=function(){if(an)return on;an=1;var e=lt();return on=function(n,t){var r=this.__data__;return this.size+=this.has(n)?0:1,r[n]=e&&void 0===t?"__lodash_hash_undefined__":t,this}}();function i(e){var n=-1,t=null==e?0:e.length;for(this.clear();++n<t;){var r=e[n];this.set(r[0],r[1])}}return i.prototype.clear=e,i.prototype.delete=n,i.prototype.get=t,i.prototype.has=r,i.prototype.set=o,un=i}(),n=Jn(),t=ct();return ln=function(){this.size=0,this.__data__={hash:new e,map:new(t||n),string:new e}}}(),n=function(){if(gn)return pn;gn=1;var e=st();return pn=function(n){var t=e(this,n).delete(n);return this.size-=t?1:0,t}}(),t=function(){if(mn)return yn;mn=1;var e=st();return yn=function(n){return e(this,n).get(n)}}(),r=function(){if(bn)return wn;bn=1;var e=st();return wn=function(n){return e(this,n).has(n)}}(),o=function(){if(_n)return xn;_n=1;var e=st();return xn=function(n,t){var r=e(this,n),o=r.size;return r.set(n,t),this.size+=r.size==o?0:1,this},xn}();function i(e){var n=-1,t=null==e?0:e.length;for(this.clear();++n<t;){var r=e[n];this.set(r[0],r[1])}}return i.prototype.clear=e,i.prototype.delete=n,i.prototype.get=t,i.prototype.has=r,i.prototype.set=o,En=i}function ft(){if(Mn)return Cn;Mn=1;var e=Jn(),n=function(){if(de)return se;de=1;var e=Jn();return se=function(){this.__data__=new e,this.size=0}}(),t=he?fe:(he=1,fe=function(e){var n=this.__data__,t=n.delete(e);return this.size=n.size,t}),r=pe?ve:(pe=1,ve=function(e){return this.__data__.get(e)}),o=ye?ge:(ye=1,ge=function(e){return this.__data__.has(e)}),i=function(){if(Nn)return kn;Nn=1;var e=Jn(),n=ct(),t=dt();return kn=function(r,o){var i=this.__data__;if(i instanceof e){var a=i.__data__;if(!n||a.length<199)return a.push([r,o]),this.size=++i.size,this;i=this.__data__=new t(a)}return i.set(r,o),this.size=i.size,this}}();function a(n){var t=this.__data__=new e(n);this.size=t.size}return a.prototype.clear=n,a.prototype.delete=t,a.prototype.get=r,a.prototype.has=o,a.prototype.set=i,Cn=a}function ht(){return jn||(jn=1,On=function(e,n){for(var t=-1,r=null==e?0:e.length;++t<r&&!1!==n(e[t],t,e););return e}),On}function vt(){if(In)return Pn;In=1;var e=ut(),n=function(){try{var n=e(Object,"defineProperty");return n({},"",{}),n}catch(e){}}();return Pn=n}function pt(){if(zn)return An;zn=1;var e=vt();return An=function(n,t,r){"__proto__"==t&&e?e(n,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):n[t]=r}}function gt(){if(Ln)return Tn;Ln=1;var e=pt(),n=Kn(),t=Object.prototype.hasOwnProperty;return Tn=function(r,o,i){var a=r[o];t.call(r,o)&&n(a,i)&&(void 0!==i||o in r)||e(r,o,i)}}function yt(){if(Dn)return Bn;Dn=1;var e=gt(),n=pt();return Bn=function(t,r,o,i){var a=!o;o||(o={});for(var u=-1,c=r.length;++u<c;){var l=r[u],s=i?i(o[l],t[l],l,o,t):void 0;void 0===s&&(s=t[l]),a?n(o,l,s):e(o,l,s)}return o}}function mt(){return Yn?Vn:(Yn=1,Vn=function(e){return null!=e&&"object"==typeof e})}function wt(){if(Un)return Fn;Un=1;var e=function(){if(Zn)return Xn;Zn=1;var e=rt(),n=mt();return Xn=function(t){return n(t)&&"[object Arguments]"==e(t)}}(),n=mt(),t=Object.prototype,r=t.hasOwnProperty,o=t.propertyIsEnumerable,i=e(function(){return arguments}())?e:function(e){return n(e)&&r.call(e,"callee")&&!o.call(e,"callee")};return Fn=i}function bt(){if(Gn)return Wn;Gn=1;var e=Array.isArray;return Wn=e}var xt,_t,Et,St,kt,Nt,Ct,Mt,Ot,jt,Pt,It={exports:{}};function At(){return Et||(Et=1,function(e,n){var t=nt(),r=_t?xt:(_t=1,xt=function(){return!1}),o=n&&!n.nodeType&&n,i=o&&e&&!e.nodeType&&e,a=i&&i.exports===o?t.Buffer:void 0,u=(a?a.isBuffer:void 0)||r;e.exports=u}(It,It.exports)),It.exports}function zt(){if(kt)return St;kt=1;var e=/^(?:0|[1-9]\d*)$/;return St=function(n,t){var r=typeof n;return!!(t=null==t?9007199254740991:t)&&("number"==r||"symbol"!=r&&e.test(n))&&n>-1&&n%1==0&&n<t}}function Tt(){return Ct?Nt:(Ct=1,Nt=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991})}function Lt(){return Pt?jt:(Pt=1,jt=function(e){return function(n){return e(n)}})}It.exports;var Bt,Dt,Rt,Ht,Vt,Yt,Xt,Zt,Ft,Ut,Wt,Gt,qt,$t,Kt,Qt,Jt,er,nr,tr,rr,or,ir,ar,ur,cr,lr,sr={exports:{}};function dr(){return Bt||(Bt=1,e=sr,n=sr.exports,t=et(),r=n&&!n.nodeType&&n,o=r&&e&&!e.nodeType&&e,i=o&&o.exports===r&&t.process,a=function(){try{return o&&o.require&&o.require("util").types||i&&i.binding&&i.binding("util")}catch(e){}}(),e.exports=a),sr.exports;var e,n,t,r,o,i,a}function fr(){if(Rt)return Dt;Rt=1;var e=function(){if(Ot)return Mt;Ot=1;var e=rt(),n=Tt(),t=mt(),r={};return r["[object Float32Array]"]=r["[object Float64Array]"]=r["[object Int8Array]"]=r["[object Int16Array]"]=r["[object Int32Array]"]=r["[object Uint8Array]"]=r["[object Uint8ClampedArray]"]=r["[object Uint16Array]"]=r["[object Uint32Array]"]=!0,r["[object Arguments]"]=r["[object Array]"]=r["[object ArrayBuffer]"]=r["[object Boolean]"]=r["[object DataView]"]=r["[object Date]"]=r["[object Error]"]=r["[object Function]"]=r["[object Map]"]=r["[object Number]"]=r["[object Object]"]=r["[object RegExp]"]=r["[object Set]"]=r["[object String]"]=r["[object WeakMap]"]=!1,Mt=function(o){return t(o)&&n(o.length)&&!!r[e(o)]}}(),n=Lt(),t=dr(),r=t&&t.isTypedArray,o=r?n(r):e;return Dt=o}function hr(){if(Vt)return Ht;Vt=1;var e=Hn?Rn:(Hn=1,Rn=function(e,n){for(var t=-1,r=Array(e);++t<e;)r[t]=n(t);return r}),n=wt(),t=bt(),r=At(),o=zt(),i=fr(),a=Object.prototype.hasOwnProperty;return Ht=function(u,c){var l=t(u),s=!l&&n(u),d=!l&&!s&&r(u),f=!l&&!s&&!d&&i(u),h=l||s||d||f,v=h?e(u.length,String):[],p=v.length;for(var g in u)!c&&!a.call(u,g)||h&&("length"==g||d&&("offset"==g||"parent"==g)||f&&("buffer"==g||"byteLength"==g||"byteOffset"==g)||o(g,p))||v.push(g);return v},Ht}function vr(){if(Xt)return Yt;Xt=1;var e=Object.prototype;return Yt=function(n){var t=n&&n.constructor;return n===("function"==typeof t&&t.prototype||e)}}function pr(){return Ft||(Ft=1,Zt=function(e,n){return function(t){return e(n(t))}}),Zt}function gr(){if(qt)return Gt;qt=1;var e=vr(),n=function(){if(Wt)return Ut;Wt=1;var e=pr()(Object.keys,Object);return Ut=e}(),t=Object.prototype.hasOwnProperty;return Gt=function(r){if(!e(r))return n(r);var o=[];for(var i in Object(r))t.call(r,i)&&"constructor"!=i&&o.push(i);return o}}function yr(){if(Kt)return $t;Kt=1;var e=it(),n=Tt();return $t=function(t){return null!=t&&n(t.length)&&!e(t)}}function mr(){if(Jt)return Qt;Jt=1;var e=hr(),n=gr(),t=yr();return Qt=function(r){return t(r)?e(r):n(r)}}function wr(){if(ur)return ar;ur=1;var e=hr(),n=function(){if(ir)return or;ir=1;var e=ot(),n=vr(),t=rr?tr:(rr=1,tr=function(e){var n=[];if(null!=e)for(var t in Object(e))n.push(t);return n}),r=Object.prototype.hasOwnProperty;return or=function(o){if(!e(o))return t(o);var i=n(o),a=[];for(var u in o)("constructor"!=u||!i&&r.call(o,u))&&a.push(u);return a}}(),t=yr();return ar=function(r){return t(r)?e(r,!0):n(r)}}sr.exports;var br,xr,_r,Er,Sr,kr,Nr,Cr,Mr,Or,jr,Pr,Ir,Ar,zr,Tr,Lr,Br,Dr,Rr,Hr,Vr,Yr,Xr,Zr,Fr,Ur,Wr,Gr,qr,$r,Kr,Qr,Jr,eo,no,to,ro,oo,io,ao,uo,co,lo,so,fo,ho,vo,po,go,yo,mo,wo,bo,xo,_o,Eo,So,ko,No,Co,Mo,Oo,jo,Po,Io,Ao,zo,To,Lo,Bo,Do,Ro,Ho,Vo,Yo,Xo,Zo,Fo,Uo,Wo,Go,qo,$o,Ko,Qo,Jo,ei,ni,ti,ri,oi,ii,ai,ui,ci,li,si,di,fi,hi,vi,pi,gi,yi,mi,wi,bi,xi,_i,Ei,Si,ki,Ni,Ci,Mi,Oi,ji,Pi,Ii,Ai,zi,Ti,Li,Bi,Di,Ri,Hi,Vi,Yi,Xi,Zi,Fi,Ui,Wi,Gi,qi,$i,Ki,Qi,Ji,ea,na,ta,ra,oa,ia,aa,ua,ca,la,sa,da,fa,ha,va,pa,ga,ya,ma,wa,ba,xa,_a,Ea,Sa,ka,Na,Ca,Ma,Oa,ja,Pa,Ia,Aa,za,Ta,La,Ba,Da,Ra,Ha,Va,Ya,Xa,Za,Fa,Ua,Wa,Ga,qa,$a,Ka,Qa,Ja,eu,nu,tu,ru,ou,iu,au,uu,cu,lu,su,du,fu,hu,vu,pu,gu,yu,mu,wu,bu,xu,_u,Eu,Su,ku,Nu,Cu,Mu,Ou,ju,Pu,Iu,Au,zu,Tu,Lu,Bu,Du,Ru,Hu,Vu,Yu,Xu,Zu,Fu,Uu,Wu,Gu,qu,$u,Ku,Qu,Ju,ec,nc,tc,rc,oc,ic,ac,uc,cc,lc,sc,dc,fc,hc,vc,pc,gc,yc,mc,wc,bc,xc,_c,Ec,Sc,kc,Nc,Cc,Mc,Oc,jc,Pc={exports:{}};function Ic(){return br||(br=1,function(e,n){var t=nt(),r=n&&!n.nodeType&&n,o=r&&e&&!e.nodeType&&e,i=o&&o.exports===r?t.Buffer:void 0,a=i?i.allocUnsafe:void 0;e.exports=function(e,n){if(n)return e.slice();var t=e.length,r=a?a(t):new e.constructor(t);return e.copy(r),r}}(Pc,Pc.exports)),Pc.exports}function Ac(){return _r||(_r=1,xr=function(e,n){var t=-1,r=e.length;for(n||(n=Array(r));++t<r;)n[t]=e[t];return n}),xr}function zc(){return Sr||(Sr=1,Er=function(e,n){for(var t=-1,r=null==e?0:e.length,o=0,i=[];++t<r;){var a=e[t];n(a,t,e)&&(i[o++]=a)}return i}),Er}function Tc(){return Nr?kr:(Nr=1,kr=function(){return[]})}function Lc(){if(Mr)return Cr;Mr=1;var e=zc(),n=Tc(),t=Object.prototype.propertyIsEnumerable,r=Object.getOwnPropertySymbols;return Cr=r?function(n){return null==n?[]:(n=Object(n),e(r(n),(function(e){return t.call(n,e)})))}:n}function Bc(){return Ir||(Ir=1,Pr=function(e,n){for(var t=-1,r=n.length,o=e.length;++t<r;)e[o+t]=n[t];return e}),Pr}function Dc(){if(zr)return Ar;zr=1;var e=pr()(Object.getPrototypeOf,Object);return Ar=e}function Rc(){if(Lr)return Tr;Lr=1;var e=Bc(),n=Dc(),t=Lc(),r=Tc(),o=Object.getOwnPropertySymbols;return Tr=o?function(r){for(var o=[];r;)e(o,t(r)),r=n(r);return o}:r}function Hc(){if(Hr)return Rr;Hr=1;var e=Bc(),n=bt();return Rr=function(t,r,o){var i=r(t);return n(t)?i:e(i,o(t))}}function Vc(){if(Yr)return Vr;Yr=1;var e=Hc(),n=Lc(),t=mr();return Vr=function(r){return e(r,t,n)}}function Yc(){if($r)return qr;$r=1;var e=ut()(nt(),"Set");return qr=e}function Xc(){if(eo)return Jr;eo=1;var e=function(){if(Ur)return Fr;Ur=1;var e=ut()(nt(),"DataView");return Fr=e}(),n=ct(),t=function(){if(Gr)return Wr;Gr=1;var e=ut()(nt(),"Promise");return Wr=e}(),r=Yc(),o=function(){if(Qr)return Kr;Qr=1;var e=ut()(nt(),"WeakMap");return Kr=e}(),i=rt(),a=at(),u="[object Map]",c="[object Promise]",l="[object Set]",s="[object WeakMap]",d="[object DataView]",f=a(e),h=a(n),v=a(t),p=a(r),g=a(o),y=i;return(e&&y(new e(new ArrayBuffer(1)))!=d||n&&y(new n)!=u||t&&y(t.resolve())!=c||r&&y(new r)!=l||o&&y(new o)!=s)&&(y=function(e){var n=i(e),t="[object Object]"==n?e.constructor:void 0,r=t?a(t):"";if(r)switch(r){case f:return d;case h:return u;case v:return c;case p:return l;case g:return s}return n}),Jr=y}function Zc(){if(oo)return ro;oo=1;var e=nt().Uint8Array;return ro=e}function Fc(){if(ao)return io;ao=1;var e=Zc();return io=function(n){var t=new n.constructor(n.byteLength);return new e(t).set(new e(n)),t}}function Uc(){if(po)return vo;po=1;var e=Fc();return vo=function(n,t){var r=t?e(n.buffer):n.buffer;return new n.constructor(r,n.byteOffset,n.length)}}function Wc(){if(wo)return mo;wo=1;var e=ot(),n=Object.create,t=function(){function t(){}return function(r){if(!e(r))return{};if(n)return n(r);t.prototype=r;var o=new t;return t.prototype=void 0,o}}();return mo=t}function Gc(){if(xo)return bo;xo=1;var e=Wc(),n=Dc(),t=vr();return bo=function(r){return"function"!=typeof r.constructor||t(r)?{}:e(n(r))}}function qc(){if(Po)return jo;Po=1;var e=ft(),n=ht(),t=gt(),r=function(){if(nr)return er;nr=1;var e=yt(),n=mr();return er=function(t,r){return t&&e(r,n(r),t)}}(),o=function(){if(lr)return cr;lr=1;var e=yt(),n=wr();return cr=function(t,r){return t&&e(r,n(r),t)}}(),i=Ic(),a=Ac(),u=function(){if(jr)return Or;jr=1;var e=yt(),n=Lc();return Or=function(t,r){return e(t,n(t),r)}}(),c=function(){if(Dr)return Br;Dr=1;var e=yt(),n=Rc();return Br=function(t,r){return e(t,n(t),r)}}(),l=Vc(),s=function(){if(Zr)return Xr;Zr=1;var e=Hc(),n=Rc(),t=wr();return Xr=function(r){return e(r,t,n)}}(),d=Xc(),f=function(){if(to)return no;to=1;var e=Object.prototype.hasOwnProperty;return no=function(n){var t=n.length,r=new n.constructor(t);return t&&"string"==typeof n[0]&&e.call(n,"index")&&(r.index=n.index,r.input=n.input),r},no}(),h=function(){if(yo)return go;yo=1;var e=Fc(),n=function(){if(co)return uo;co=1;var e=Fc();return uo=function(n,t){var r=t?e(n.buffer):n.buffer;return new n.constructor(r,n.byteOffset,n.byteLength)}}(),t=function(){if(so)return lo;so=1;var e=/\w*$/;return lo=function(n){var t=new n.constructor(n.source,e.exec(n));return t.lastIndex=n.lastIndex,t}}(),r=function(){if(ho)return fo;ho=1;var e=tt(),n=e?e.prototype:void 0,t=n?n.valueOf:void 0;return fo=function(e){return t?Object(t.call(e)):{}}}(),o=Uc();return go=function(i,a,u){var c=i.constructor;switch(a){case"[object ArrayBuffer]":return e(i);case"[object Boolean]":case"[object Date]":return new c(+i);case"[object DataView]":return n(i,u);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return o(i,u);case"[object Map]":case"[object Set]":return new c;case"[object Number]":case"[object String]":return new c(i);case"[object RegExp]":return t(i);case"[object Symbol]":return r(i)}}}(),v=Gc(),p=bt(),g=At(),y=function(){if(ko)return So;ko=1;var e=function(){if(Eo)return _o;Eo=1;var e=Xc(),n=mt();return _o=function(t){return n(t)&&"[object Map]"==e(t)}}(),n=Lt(),t=dr(),r=t&&t.isMap,o=r?n(r):e;return So=o}(),m=ot(),w=function(){if(Oo)return Mo;Oo=1;var e=function(){if(Co)return No;Co=1;var e=Xc(),n=mt();return No=function(t){return n(t)&&"[object Set]"==e(t)}}(),n=Lt(),t=dr(),r=t&&t.isSet,o=r?n(r):e;return Mo=o}(),b=mr(),x=wr(),_="[object Arguments]",E="[object Function]",S="[object Object]",k={};return k[_]=k["[object Array]"]=k["[object ArrayBuffer]"]=k["[object DataView]"]=k["[object Boolean]"]=k["[object Date]"]=k["[object Float32Array]"]=k["[object Float64Array]"]=k["[object Int8Array]"]=k["[object Int16Array]"]=k["[object Int32Array]"]=k["[object Map]"]=k["[object Number]"]=k[S]=k["[object RegExp]"]=k["[object Set]"]=k["[object String]"]=k["[object Symbol]"]=k["[object Uint8Array]"]=k["[object Uint8ClampedArray]"]=k["[object Uint16Array]"]=k["[object Uint32Array]"]=!0,k["[object Error]"]=k[E]=k["[object WeakMap]"]=!1,jo=function N(C,M,O,j,P,I){var A,z=1&M,T=2&M,L=4&M;if(O&&(A=P?O(C,j,P,I):O(C)),void 0!==A)return A;if(!m(C))return C;var B=p(C);if(B){if(A=f(C),!z)return a(C,A)}else{var D=d(C),R=D==E||"[object GeneratorFunction]"==D;if(g(C))return i(C,z);if(D==S||D==_||R&&!P){if(A=T||R?{}:v(C),!z)return T?c(C,o(A,C)):u(C,r(A,C))}else{if(!k[D])return P?C:{};A=h(C,D,z)}}I||(I=new e);var H=I.get(C);if(H)return H;I.set(C,A),w(C)?C.forEach((function(e){A.add(N(e,M,O,e,C,I))})):y(C)&&C.forEach((function(e,n){A.set(n,N(e,M,O,n,C,I))}));var V=B?void 0:(L?T?s:l:T?x:b)(C);return n(V||C,(function(e,n){V&&(e=C[n=e]),t(A,n,N(e,M,O,n,C,I))})),A},jo}function $c(){if(Ao)return Io;Ao=1;var e=qc();return Io=function(n){return e(n,4)}}function Kc(){return To?zo:(To=1,zo=function(e){return function(){return e}})}function Qc(){if(Ro)return Do;Ro=1;var e=(Bo?Lo:(Bo=1,Lo=function(e){return function(n,t,r){for(var o=-1,i=Object(n),a=r(n),u=a.length;u--;){var c=a[e?u:++o];if(!1===t(i[c],c,i))break}return n}}))();return Do=e}function Jc(){if(Vo)return Ho;Vo=1;var e=Qc(),n=mr();return Ho=function(t,r){return t&&e(t,r,n)}}function el(){if(Fo)return Zo;Fo=1;var e=Jc(),n=function(){if(Xo)return Yo;Xo=1;var e=yr();return Yo=function(n,t){return function(r,o){if(null==r)return r;if(!e(r))return n(r,o);for(var i=r.length,a=t?i:-1,u=Object(r);(t?a--:++a<i)&&!1!==o(u[a],a,u););return r}}}(),t=n(e);return Zo=t}function nl(){return Wo?Uo:(Wo=1,Uo=function(e){return e})}function tl(){if(qo)return Go;qo=1;var e=nl();return Go=function(n){return"function"==typeof n?n:e}}function rl(){if(Ko)return $o;Ko=1;var e=ht(),n=el(),t=tl(),r=bt();return $o=function(o,i){return(r(o)?e:n)(o,t(i))}}function ol(){return Jo?Qo:(Jo=1,Qo=rl())}function il(){if(ui)return ai;ui=1;var e=dt(),n=ri?ti:(ri=1,ti=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this}),t=ii?oi:(ii=1,oi=function(e){return this.__data__.has(e)});function r(n){var t=-1,r=null==n?0:n.length;for(this.__data__=new e;++t<r;)this.add(n[t])}return r.prototype.add=r.prototype.push=n,r.prototype.has=t,ai=r}function al(){return di?si:(di=1,si=function(e,n){return e.has(n)})}function ul(){if(hi)return fi;hi=1;var e=il(),n=(li||(li=1,ci=function(e,n){for(var t=-1,r=null==e?0:e.length;++t<r;)if(n(e[t],t,e))return!0;return!1}),ci),t=al();return fi=function(r,o,i,a,u,c){var l=1&i,s=r.length,d=o.length;if(s!=d&&!(l&&d>s))return!1;var f=c.get(r),h=c.get(o);if(f&&h)return f==o&&h==r;var v=-1,p=!0,g=2&i?new e:void 0;for(c.set(r,o),c.set(o,r);++v<s;){var y=r[v],m=o[v];if(a)var w=l?a(m,y,v,o,r,c):a(y,m,v,r,o,c);if(void 0!==w){if(w)continue;p=!1;break}if(g){if(!n(o,(function(e,n){if(!t(g,n)&&(y===e||u(y,e,i,a,c)))return g.push(n)}))){p=!1;break}}else if(y!==m&&!u(y,m,i,a,c)){p=!1;break}}return c.delete(r),c.delete(o),p},fi}function cl(){return yi||(yi=1,gi=function(e){var n=-1,t=Array(e.size);return e.forEach((function(e){t[++n]=e})),t}),gi}function ll(){if(Ei)return _i;Ei=1;var e=ft(),n=ul(),t=function(){if(wi)return mi;wi=1;var e=tt(),n=Zc(),t=Kn(),r=ul(),o=(pi||(pi=1,vi=function(e){var n=-1,t=Array(e.size);return e.forEach((function(e,r){t[++n]=[r,e]})),t}),vi),i=cl(),a=e?e.prototype:void 0,u=a?a.valueOf:void 0;return mi=function(e,a,c,l,s,d,f){switch(c){case"[object DataView]":if(e.byteLength!=a.byteLength||e.byteOffset!=a.byteOffset)return!1;e=e.buffer,a=a.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=a.byteLength||!d(new n(e),new n(a)));case"[object Boolean]":case"[object Date]":case"[object Number]":return t(+e,+a);case"[object Error]":return e.name==a.name&&e.message==a.message;case"[object RegExp]":case"[object String]":return e==a+"";case"[object Map]":var h=o;case"[object Set]":var v=1&l;if(h||(h=i),e.size!=a.size&&!v)return!1;var p=f.get(e);if(p)return p==a;l|=2,f.set(e,a);var g=r(h(e),h(a),l,s,d,f);return f.delete(e),g;case"[object Symbol]":if(u)return u.call(e)==u.call(a)}return!1}}(),r=function(){if(xi)return bi;xi=1;var e=Vc(),n=Object.prototype.hasOwnProperty;return bi=function(t,r,o,i,a,u){var c=1&o,l=e(t),s=l.length;if(s!=e(r).length&&!c)return!1;for(var d=s;d--;){var f=l[d];if(!(c?f in r:n.call(r,f)))return!1}var h=u.get(t),v=u.get(r);if(h&&v)return h==r&&v==t;var p=!0;u.set(t,r),u.set(r,t);for(var g=c;++d<s;){var y=t[f=l[d]],m=r[f];if(i)var w=c?i(m,y,f,r,t,u):i(y,m,f,t,r,u);if(!(void 0===w?y===m||a(y,m,o,i,u):w)){p=!1;break}g||(g="constructor"==f)}if(p&&!g){var b=t.constructor,x=r.constructor;b==x||!("constructor"in t)||!("constructor"in r)||"function"==typeof b&&b instanceof b&&"function"==typeof x&&x instanceof x||(p=!1)}return u.delete(t),u.delete(r),p}}(),o=Xc(),i=bt(),a=At(),u=fr(),c="[object Arguments]",l="[object Array]",s="[object Object]",d=Object.prototype.hasOwnProperty;return _i=function(f,h,v,p,g,y){var m=i(f),w=i(h),b=m?l:o(f),x=w?l:o(h),_=(b=b==c?s:b)==s,E=(x=x==c?s:x)==s,S=b==x;if(S&&a(f)){if(!a(h))return!1;m=!0,_=!1}if(S&&!_)return y||(y=new e),m||u(f)?n(f,h,v,p,g,y):t(f,h,b,v,p,g,y);if(!(1&v)){var k=_&&d.call(f,"__wrapped__"),N=E&&d.call(h,"__wrapped__");if(k||N){var C=k?f.value():f,M=N?h.value():h;return y||(y=new e),g(C,M,v,p,y)}}return!!S&&(y||(y=new e),r(f,h,v,p,g,y))}}function sl(){if(ki)return Si;ki=1;var e=ll(),n=mt();return Si=function t(r,o,i,a,u){return r===o||(null==r||null==o||!n(r)&&!n(o)?r!=r&&o!=o:e(r,o,i,a,t,u))},Si}function dl(){if(Oi)return Mi;Oi=1;var e=ot();return Mi=function(n){return n==n&&!e(n)}}function fl(){return Ai?Ii:(Ai=1,Ii=function(e,n){return function(t){return null!=t&&t[e]===n&&(void 0!==n||e in Object(t))}})}function hl(){if(Bi)return Li;Bi=1;var e=rt(),n=mt();return Li=function(t){return"symbol"==typeof t||n(t)&&"[object Symbol]"==e(t)}}function vl(){if(Ri)return Di;Ri=1;var e=bt(),n=hl(),t=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;return Di=function(o,i){if(e(o))return!1;var a=typeof o;return!("number"!=a&&"symbol"!=a&&"boolean"!=a&&null!=o&&!n(o))||r.test(o)||!t.test(o)||null!=i&&o in Object(i)}}function pl(){return Wi||(Wi=1,Ui=function(e,n){for(var t=-1,r=null==e?0:e.length,o=Array(r);++t<r;)o[t]=n(e[t],t,e);return o}),Ui}function gl(){if(Ki)return $i;Ki=1;var e=function(){if(qi)return Gi;qi=1;var e=tt(),n=pl(),t=bt(),r=hl(),o=e?e.prototype:void 0,i=o?o.toString:void 0;return Gi=function e(o){if("string"==typeof o)return o;if(t(o))return n(o,e)+"";if(r(o))return i?i.call(o):"";var a=o+"";return"0"==a&&1/o==-1/0?"-0":a},Gi}();return $i=function(n){return null==n?"":e(n)}}function yl(){if(Ji)return Qi;Ji=1;var e=bt(),n=vl(),t=function(){if(Fi)return Zi;Fi=1;var e=function(){if(Xi)return Yi;Xi=1;var e=function(){if(Vi)return Hi;Vi=1;var e=dt();function n(t,r){if("function"!=typeof t||null!=r&&"function"!=typeof r)throw new TypeError("Expected a function");var o=function(){var e=arguments,n=r?r.apply(this,e):e[0],i=o.cache;if(i.has(n))return i.get(n);var a=t.apply(this,e);return o.cache=i.set(n,a)||i,a};return o.cache=new(n.Cache||e),o}return n.Cache=e,Hi=n}();return Yi=function(n){var t=e(n,(function(e){return 500===r.size&&r.clear(),e})),r=t.cache;return t}}(),n=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,t=/\\(\\)?/g,r=e((function(e){var r=[];return 46===e.charCodeAt(0)&&r.push(""),e.replace(n,(function(e,n,o,i){r.push(o?i.replace(t,"$1"):n||e)})),r}));return Zi=r}(),r=gl();return Qi=function(o,i){return e(o)?o:n(o,i)?[o]:t(r(o))}}function ml(){if(na)return ea;na=1;var e=hl();return ea=function(n){if("string"==typeof n||e(n))return n;var t=n+"";return"0"==t&&1/n==-1/0?"-0":t}}function wl(){if(ra)return ta;ra=1;var e=yl(),n=ml();return ta=function(t,r){for(var o=0,i=(r=e(r,t)).length;null!=t&&o<i;)t=t[n(r[o++])];return o&&o==i?t:void 0}}function bl(){if(la)return ca;la=1;var e=yl(),n=wt(),t=bt(),r=zt(),o=Tt(),i=ml();return ca=function(a,u,c){for(var l=-1,s=(u=e(u,a)).length,d=!1;++l<s;){var f=i(u[l]);if(!(d=null!=a&&c(a,f)))break;a=a[f]}return d||++l!=s?d:!!(s=null==a?0:a.length)&&o(s)&&r(f,s)&&(t(a)||n(a))}}function xl(){if(da)return sa;da=1;var e=ua?aa:(ua=1,aa=function(e,n){return null!=e&&n in Object(e)}),n=bl();return sa=function(t,r){return null!=t&&n(t,r,e)}}function _l(){return pa?va:(pa=1,va=function(e){return function(n){return null==n?void 0:n[e]}})}function El(){if(xa)return ba;xa=1;var e=function(){if(Ti)return zi;Ti=1;var e=function(){if(Ci)return Ni;Ci=1;var e=ft(),n=sl();return Ni=function(t,r,o,i){var a=o.length,u=a,c=!i;if(null==t)return!u;for(t=Object(t);a--;){var l=o[a];if(c&&l[2]?l[1]!==t[l[0]]:!(l[0]in t))return!1}for(;++a<u;){var s=(l=o[a])[0],d=t[s],f=l[1];if(c&&l[2]){if(void 0===d&&!(s in t))return!1}else{var h=new e;if(i)var v=i(d,f,s,t,r,h);if(!(void 0===v?n(f,d,3,i,h):v))return!1}}return!0}}(),n=function(){if(Pi)return ji;Pi=1;var e=dl(),n=mr();return ji=function(t){for(var r=n(t),o=r.length;o--;){var i=r[o],a=t[i];r[o]=[i,a,e(a)]}return r}}(),t=fl();return zi=function(r){var o=n(r);return 1==o.length&&o[0][2]?t(o[0][0],o[0][1]):function(n){return n===r||e(n,r,o)}}}(),n=function(){if(ha)return fa;ha=1;var e=sl(),n=function(){if(ia)return oa;ia=1;var e=wl();return oa=function(n,t,r){var o=null==n?void 0:e(n,t);return void 0===o?r:o}}(),t=xl(),r=vl(),o=dl(),i=fl(),a=ml();return fa=function(u,c){return r(u)&&o(c)?i(a(u),c):function(r){var o=n(r,u);return void 0===o&&o===c?t(r,u):e(c,o,3)}}}(),t=nl(),r=bt(),o=function(){if(wa)return ma;wa=1;var e=_l(),n=function(){if(ya)return ga;ya=1;var e=wl();return ga=function(n){return function(t){return e(t,n)}}}(),t=vl(),r=ml();return ma=function(o){return t(o)?e(r(o)):n(o)}}();return ba=function(i){return"function"==typeof i?i:null==i?t:"object"==typeof i?r(i)?n(i[0],i[1]):e(i):o(i)}}function Sl(){if(Ea)return _a;Ea=1;var e=zc(),n=function(){if(ni)return ei;ni=1;var e=el();return ei=function(n,t){var r=[];return e(n,(function(e,n,o){t(e,n,o)&&r.push(e)})),r}}(),t=El(),r=bt();return _a=function(o,i){return(r(o)?e:n)(o,t(i,3))}}function kl(){if(Ca)return Na;Ca=1;var e=function(){if(ka)return Sa;ka=1;var e=Object.prototype.hasOwnProperty;return Sa=function(n,t){return null!=n&&e.call(n,t)}}(),n=bl();return Na=function(t,r){return null!=t&&n(t,r,e)}}function Nl(){if(Oa)return Ma;Oa=1;var e=gr(),n=Xc(),t=wt(),r=bt(),o=yr(),i=At(),a=vr(),u=fr(),c=Object.prototype.hasOwnProperty;return Ma=function(l){if(null==l)return!0;if(o(l)&&(r(l)||"string"==typeof l||"function"==typeof l.splice||i(l)||u(l)||t(l)))return!l.length;var s=n(l);if("[object Map]"==s||"[object Set]"==s)return!l.size;if(a(l))return!e(l).length;for(var d in l)if(c.call(l,d))return!1;return!0}}function Cl(){return Pa?ja:(Pa=1,ja=function(e){return void 0===e})}function Ml(){if(Aa)return Ia;Aa=1;var e=el(),n=yr();return Ia=function(t,r){var o=-1,i=n(t)?Array(t.length):[];return e(t,(function(e,n,t){i[++o]=r(e,n,t)})),i}}function Ol(){if(Ta)return za;Ta=1;var e=pl(),n=El(),t=Ml(),r=bt();return za=function(o,i){return(r(o)?e:t)(o,n(i,3))}}function jl(){if(Va)return Ha;Va=1;var e=(Ba||(Ba=1,La=function(e,n,t,r){var o=-1,i=null==e?0:e.length;for(r&&i&&(t=e[++o]);++o<i;)t=n(t,e[o],o,e);return t}),La),n=el(),t=El(),r=Ra?Da:(Ra=1,Da=function(e,n,t,r,o){return o(e,(function(e,o,i){t=r?(r=!1,e):n(t,e,o,i)})),t}),o=bt();return Ha=function(i,a,u){var c=o(i)?e:r,l=arguments.length<3;return c(i,t(a,4),u,l,n)},Ha}function Pl(){if(Ja)return Qa;Ja=1;var e=gr(),n=Xc(),t=yr(),r=function(){if(Xa)return Ya;Xa=1;var e=rt(),n=bt(),t=mt();return Ya=function(r){return"string"==typeof r||!n(r)&&t(r)&&"[object String]"==e(r)}}(),o=function(){if(Ka)return $a;Ka=1;var e=function(){if(Fa)return Za;Fa=1;var e=_l()("length");return Za=e}(),n=function(){if(Wa)return Ua;Wa=1;var e=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");return Ua=function(n){return e.test(n)}}(),t=function(){if(qa)return Ga;qa=1;var e="\\ud800-\\udfff",n="["+e+"]",t="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",r="\\ud83c[\\udffb-\\udfff]",o="[^"+e+"]",i="(?:\\ud83c[\\udde6-\\uddff]){2}",a="[\\ud800-\\udbff][\\udc00-\\udfff]",u="(?:"+t+"|"+r+")?",c="[\\ufe0e\\ufe0f]?",l=c+u+"(?:\\u200d(?:"+[o,i,a].join("|")+")"+c+u+")*",s="(?:"+[o+t+"?",t,i,a,n].join("|")+")",d=RegExp(r+"(?="+r+")|"+s+l,"g");return Ga=function(e){for(var n=d.lastIndex=0;d.test(e);)++n;return n}}();return $a=function(r){return n(r)?t(r):e(r)}}();return Qa=function(i){if(null==i)return 0;if(t(i))return r(i)?o(i):i.length;var a=n(i);return"[object Map]"==a||"[object Set]"==a?i.size:e(i).length}}function Il(){if(nu)return eu;nu=1;var e=ht(),n=Wc(),t=Jc(),r=El(),o=Dc(),i=bt(),a=At(),u=it(),c=ot(),l=fr();return eu=function(s,d,f){var h=i(s),v=h||a(s)||l(s);if(d=r(d,4),null==f){var p=s&&s.constructor;f=v?h?new p:[]:c(s)&&u(p)?n(o(s)):{}}return(v?e:t)(s,(function(e,n,t){return d(f,e,n,t)})),f}}function Al(){if(iu)return ou;iu=1;var e=Bc(),n=function(){if(ru)return tu;ru=1;var e=tt(),n=wt(),t=bt(),r=e?e.isConcatSpreadable:void 0;return tu=function(e){return t(e)||n(e)||!!(r&&e&&e[r])}}();return ou=function t(r,o,i,a,u){var c=-1,l=r.length;for(i||(i=n),u||(u=[]);++c<l;){var s=r[c];o>0&&i(s)?o>1?t(s,o-1,i,a,u):e(u,s):a||(u[u.length]=s)}return u},ou}function zl(){if(lu)return cu;lu=1;var e=uu?au:(uu=1,au=function(e,n,t){switch(t.length){case 0:return e.call(n);case 1:return e.call(n,t[0]);case 2:return e.call(n,t[0],t[1]);case 3:return e.call(n,t[0],t[1],t[2])}return e.apply(n,t)}),n=Math.max;return cu=function(t,r,o){return r=n(void 0===r?t.length-1:r,0),function(){for(var i=arguments,a=-1,u=n(i.length-r,0),c=Array(u);++a<u;)c[a]=i[r+a];a=-1;for(var l=Array(r+1);++a<r;)l[a]=i[a];return l[r]=o(c),e(t,this,l)}},cu}function Tl(){if(pu)return vu;pu=1;var e=function(){if(du)return su;du=1;var e=Kc(),n=vt(),t=nl();return su=n?function(t,r){return n(t,"toString",{configurable:!0,enumerable:!1,value:e(r),writable:!0})}:t}(),n=function(){if(hu)return fu;hu=1;var e=Date.now;return fu=function(n){var t=0,r=0;return function(){var o=e(),i=16-(o-r);if(r=o,i>0){if(++t>=800)return arguments[0]}else t=0;return n.apply(void 0,arguments)}},fu}(),t=n(e);return vu=t}function Ll(){if(yu)return gu;yu=1;var e=nl(),n=zl(),t=Tl();return gu=function(r,o){return t(n(r,o,e),r+"")},gu}function Bl(){return wu||(wu=1,mu=function(e,n,t,r){for(var o=e.length,i=t+(r?1:-1);r?i--:++i<o;)if(n(e[i],i,e))return i;return-1}),mu}function Dl(){if(Tu)return zu;Tu=1;var e=il(),n=function(){if(Cu)return Nu;Cu=1;var e=function(){if(ku)return Su;ku=1;var e=Bl(),n=xu?bu:(xu=1,bu=function(e){return e!=e}),t=(Eu||(Eu=1,_u=function(e,n,t){for(var r=t-1,o=e.length;++r<o;)if(e[r]===n)return r;return-1}),_u);return Su=function(r,o,i){return o==o?t(r,o,i):e(r,n,i)},Su}();return Nu=function(n,t){return!(null==n||!n.length)&&e(n,t,0)>-1},Nu}(),t=(Ou||(Ou=1,Mu=function(e,n,t){for(var r=-1,o=null==e?0:e.length;++r<o;)if(t(n,e[r]))return!0;return!1}),Mu),r=al(),o=function(){if(Au)return Iu;Au=1;var e=Yc(),n=Pu?ju:(Pu=1,ju=function(){}),t=cl(),r=e&&1/t(new e([,-0]))[1]==1/0?function(n){return new e(n)}:n;return Iu=r}(),i=cl();return zu=function(a,u,c){var l=-1,s=n,d=a.length,f=!0,h=[],v=h;if(c)f=!1,s=t;else if(d>=200){var p=u?null:o(a);if(p)return i(p);f=!1,s=r,v=new e}else v=u?[]:h;e:for(;++l<d;){var g=a[l],y=u?u(g):g;if(g=c||0!==g?g:0,f&&y==y){for(var m=v.length;m--;)if(v[m]===y)continue e;u&&v.push(y),h.push(g)}else s(v,y,c)||(v!==h&&v.push(y),h.push(g))}return h},zu}function Rl(){if(Bu)return Lu;Bu=1;var e=yr(),n=mt();return Lu=function(t){return n(t)&&e(t)}}function Hl(){if(Ru)return Du;Ru=1;var e=Al(),n=Ll(),t=Dl(),r=Rl(),o=n((function(n){return t(e(n,1,r,!0))}));return Du=o}function Vl(){if(Xu)return Yu;Xu=1;var e=function(){if(Vu)return Hu;Vu=1;var e=pl();return Hu=function(n,t){return e(t,(function(e){return n[e]}))}}(),n=mr();return Yu=function(t){return null==t?[]:e(t,n(t))}}function Yl(){if(Fu)return Zu;var e;Fu=1;try{e={clone:$c(),constant:Kc(),each:ol(),filter:Sl(),has:kl(),isArray:bt(),isEmpty:Nl(),isFunction:it(),isUndefined:Cl(),keys:mr(),map:Ol(),reduce:jl(),size:Pl(),transform:Il(),union:Hl(),values:Vl()}}catch(e){}return e||(e=window._),Zu=e}function Xl(){if(Wu)return Uu;Wu=1;var e=Yl();Uu=o;var n="\0",t="\0",r="";function o(n){this._isDirected=!e.has(n,"directed")||n.directed,this._isMultigraph=!!e.has(n,"multigraph")&&n.multigraph,this._isCompound=!!e.has(n,"compound")&&n.compound,this._label=void 0,this._defaultNodeLabelFn=e.constant(void 0),this._defaultEdgeLabelFn=e.constant(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[t]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}function i(e,n){e[n]?e[n]++:e[n]=1}function a(e,n){--e[n]||delete e[n]}function u(t,o,i,a){var u=""+o,c=""+i;if(!t&&u>c){var l=u;u=c,c=l}return u+r+c+r+(e.isUndefined(a)?n:a)}function c(e,n){return u(e,n.v,n.w,n.name)}return o.prototype._nodeCount=0,o.prototype._edgeCount=0,o.prototype.isDirected=function(){return this._isDirected},o.prototype.isMultigraph=function(){return this._isMultigraph},o.prototype.isCompound=function(){return this._isCompound},o.prototype.setGraph=function(e){return this._label=e,this},o.prototype.graph=function(){return this._label},o.prototype.setDefaultNodeLabel=function(n){return e.isFunction(n)||(n=e.constant(n)),this._defaultNodeLabelFn=n,this},o.prototype.nodeCount=function(){return this._nodeCount},o.prototype.nodes=function(){return e.keys(this._nodes)},o.prototype.sources=function(){var n=this;return e.filter(this.nodes(),(function(t){return e.isEmpty(n._in[t])}))},o.prototype.sinks=function(){var n=this;return e.filter(this.nodes(),(function(t){return e.isEmpty(n._out[t])}))},o.prototype.setNodes=function(n,t){var r=arguments,o=this;return e.each(n,(function(e){r.length>1?o.setNode(e,t):o.setNode(e)})),this},o.prototype.setNode=function(n,r){return e.has(this._nodes,n)?(arguments.length>1&&(this._nodes[n]=r),this):(this._nodes[n]=arguments.length>1?r:this._defaultNodeLabelFn(n),this._isCompound&&(this._parent[n]=t,this._children[n]={},this._children[t][n]=!0),this._in[n]={},this._preds[n]={},this._out[n]={},this._sucs[n]={},++this._nodeCount,this)},o.prototype.node=function(e){return this._nodes[e]},o.prototype.hasNode=function(n){return e.has(this._nodes,n)},o.prototype.removeNode=function(n){var t=this;if(e.has(this._nodes,n)){var r=function(e){t.removeEdge(t._edgeObjs[e])};delete this._nodes[n],this._isCompound&&(this._removeFromParentsChildList(n),delete this._parent[n],e.each(this.children(n),(function(e){t.setParent(e)})),delete this._children[n]),e.each(e.keys(this._in[n]),r),delete this._in[n],delete this._preds[n],e.each(e.keys(this._out[n]),r),delete this._out[n],delete this._sucs[n],--this._nodeCount}return this},o.prototype.setParent=function(n,r){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(e.isUndefined(r))r=t;else{for(var o=r+="";!e.isUndefined(o);o=this.parent(o))if(o===n)throw new Error("Setting "+r+" as parent of "+n+" would create a cycle");this.setNode(r)}return this.setNode(n),this._removeFromParentsChildList(n),this._parent[n]=r,this._children[r][n]=!0,this},o.prototype._removeFromParentsChildList=function(e){delete this._children[this._parent[e]][e]},o.prototype.parent=function(e){if(this._isCompound){var n=this._parent[e];if(n!==t)return n}},o.prototype.children=function(n){if(e.isUndefined(n)&&(n=t),this._isCompound){var r=this._children[n];if(r)return e.keys(r)}else{if(n===t)return this.nodes();if(this.hasNode(n))return[]}},o.prototype.predecessors=function(n){var t=this._preds[n];if(t)return e.keys(t)},o.prototype.successors=function(n){var t=this._sucs[n];if(t)return e.keys(t)},o.prototype.neighbors=function(n){var t=this.predecessors(n);if(t)return e.union(t,this.successors(n))},o.prototype.isLeaf=function(e){return 0===(this.isDirected()?this.successors(e):this.neighbors(e)).length},o.prototype.filterNodes=function(n){var t=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});t.setGraph(this.graph());var r=this;e.each(this._nodes,(function(e,r){n(r)&&t.setNode(r,e)})),e.each(this._edgeObjs,(function(e){t.hasNode(e.v)&&t.hasNode(e.w)&&t.setEdge(e,r.edge(e))}));var o={};function i(e){var n=r.parent(e);return void 0===n||t.hasNode(n)?(o[e]=n,n):n in o?o[n]:i(n)}return this._isCompound&&e.each(t.nodes(),(function(e){t.setParent(e,i(e))})),t},o.prototype.setDefaultEdgeLabel=function(n){return e.isFunction(n)||(n=e.constant(n)),this._defaultEdgeLabelFn=n,this},o.prototype.edgeCount=function(){return this._edgeCount},o.prototype.edges=function(){return e.values(this._edgeObjs)},o.prototype.setPath=function(n,t){var r=this,o=arguments;return e.reduce(n,(function(e,n){return o.length>1?r.setEdge(e,n,t):r.setEdge(e,n),n})),this},o.prototype.setEdge=function(){var n,t,r,o,a=!1,c=arguments[0];"object"==typeof c&&null!==c&&"v"in c?(n=c.v,t=c.w,r=c.name,2===arguments.length&&(o=arguments[1],a=!0)):(n=c,t=arguments[1],r=arguments[3],arguments.length>2&&(o=arguments[2],a=!0)),n=""+n,t=""+t,e.isUndefined(r)||(r=""+r);var l=u(this._isDirected,n,t,r);if(e.has(this._edgeLabels,l))return a&&(this._edgeLabels[l]=o),this;if(!e.isUndefined(r)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(n),this.setNode(t),this._edgeLabels[l]=a?o:this._defaultEdgeLabelFn(n,t,r);var s=function(e,n,t,r){var o=""+n,i=""+t;if(!e&&o>i){var a=o;o=i,i=a}var u={v:o,w:i};return r&&(u.name=r),u}(this._isDirected,n,t,r);return n=s.v,t=s.w,Object.freeze(s),this._edgeObjs[l]=s,i(this._preds[t],n),i(this._sucs[n],t),this._in[t][l]=s,this._out[n][l]=s,this._edgeCount++,this},o.prototype.edge=function(e,n,t){var r=1===arguments.length?c(this._isDirected,arguments[0]):u(this._isDirected,e,n,t);return this._edgeLabels[r]},o.prototype.hasEdge=function(n,t,r){var o=1===arguments.length?c(this._isDirected,arguments[0]):u(this._isDirected,n,t,r);return e.has(this._edgeLabels,o)},o.prototype.removeEdge=function(e,n,t){var r=1===arguments.length?c(this._isDirected,arguments[0]):u(this._isDirected,e,n,t),o=this._edgeObjs[r];return o&&(e=o.v,n=o.w,delete this._edgeLabels[r],delete this._edgeObjs[r],a(this._preds[n],e),a(this._sucs[e],n),delete this._in[n][r],delete this._out[e][r],this._edgeCount--),this},o.prototype.inEdges=function(n,t){var r=this._in[n];if(r){var o=e.values(r);return t?e.filter(o,(function(e){return e.v===t})):o}},o.prototype.outEdges=function(n,t){var r=this._out[n];if(r){var o=e.values(r);return t?e.filter(o,(function(e){return e.w===t})):o}},o.prototype.nodeEdges=function(e,n){var t=this.inEdges(e,n);if(t)return t.concat(this.outEdges(e,n))},Uu}function Zl(){if(Ju)return Qu;Ju=1;var e=Yl(),n=Xl();function t(n){return e.map(n.nodes(),(function(t){var r=n.node(t),o=n.parent(t),i={v:t};return e.isUndefined(r)||(i.value=r),e.isUndefined(o)||(i.parent=o),i}))}function r(n){return e.map(n.edges(),(function(t){var r=n.edge(t),o={v:t.v,w:t.w};return e.isUndefined(t.name)||(o.name=t.name),e.isUndefined(r)||(o.value=r),o}))}return Qu={write:function(n){var o={options:{directed:n.isDirected(),multigraph:n.isMultigraph(),compound:n.isCompound()},nodes:t(n),edges:r(n)};return e.isUndefined(n.graph())||(o.value=e.clone(n.graph())),o},read:function(t){var r=new n(t.options).setGraph(t.value);return e.each(t.nodes,(function(e){r.setNode(e.v,e.value),e.parent&&r.setParent(e.v,e.parent)})),e.each(t.edges,(function(e){r.setEdge({v:e.v,w:e.w,name:e.name},e.value)})),r}}}function Fl(){if(nc)return ec;nc=1;var e=Yl();return ec=function(n){var t,r={},o=[];function i(o){e.has(r,o)||(r[o]=!0,t.push(o),e.each(n.successors(o),i),e.each(n.predecessors(o),i))}return e.each(n.nodes(),(function(e){t=[],i(e),t.length&&o.push(t)})),o},ec}function Ul(){if(rc)return tc;rc=1;var e=Yl();function n(){this._arr=[],this._keyIndices={}}return tc=n,n.prototype.size=function(){return this._arr.length},n.prototype.keys=function(){return this._arr.map((function(e){return e.key}))},n.prototype.has=function(n){return e.has(this._keyIndices,n)},n.prototype.priority=function(e){var n=this._keyIndices[e];if(void 0!==n)return this._arr[n].priority},n.prototype.min=function(){if(0===this.size())throw new Error("Queue underflow");return this._arr[0].key},n.prototype.add=function(n,t){var r=this._keyIndices;if(n=String(n),!e.has(r,n)){var o=this._arr,i=o.length;return r[n]=i,o.push({key:n,priority:t}),this._decrease(i),!0}return!1},n.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var e=this._arr.pop();return delete this._keyIndices[e.key],this._heapify(0),e.key},n.prototype.decrease=function(e,n){var t=this._keyIndices[e];if(n>this._arr[t].priority)throw new Error("New priority is greater than current priority. Key: "+e+" Old: "+this._arr[t].priority+" New: "+n);this._arr[t].priority=n,this._decrease(t)},n.prototype._heapify=function(e){var n=this._arr,t=2*e,r=t+1,o=e;t<n.length&&(o=n[t].priority<n[o].priority?t:o,r<n.length&&(o=n[r].priority<n[o].priority?r:o),o!==e&&(this._swap(e,o),this._heapify(o)))},n.prototype._decrease=function(e){for(var n,t=this._arr,r=t[e].priority;0!==e&&!(t[n=e>>1].priority<r);)this._swap(e,n),e=n},n.prototype._swap=function(e,n){var t=this._arr,r=this._keyIndices,o=t[e],i=t[n];t[e]=i,t[n]=o,r[i.key]=e,r[o.key]=n},tc}function Wl(){if(ic)return oc;ic=1;var e=Yl(),n=Ul();oc=function(e,r,o,i){return function(e,t,r,o){var i,a,u={},c=new n,l=function(e){var n=e.v!==i?e.v:e.w,t=u[n],o=r(e),l=a.distance+o;if(o<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+e+" Weight: "+o);l<t.distance&&(t.distance=l,t.predecessor=i,c.decrease(n,l))};for(e.nodes().forEach((function(e){var n=e===t?0:Number.POSITIVE_INFINITY;u[e]={distance:n},c.add(e,n)}));c.size()>0&&(i=c.removeMin(),(a=u[i]).distance!==Number.POSITIVE_INFINITY);)o(i).forEach(l);return u}(e,String(r),o||t,i||function(n){return e.outEdges(n)})};var t=e.constant(1);return oc}function Gl(){if(uc)return ac;uc=1;var e=Wl(),n=Yl();return ac=function(t,r,o){return n.transform(t.nodes(),(function(n,i){n[i]=e(t,i,r,o)}),{})}}function ql(){if(lc)return cc;lc=1;var e=Yl();return cc=function(n){var t=0,r=[],o={},i=[];function a(u){var c=o[u]={onStack:!0,lowlink:t,index:t++};if(r.push(u),n.successors(u).forEach((function(n){e.has(o,n)?o[n].onStack&&(c.lowlink=Math.min(c.lowlink,o[n].index)):(a(n),c.lowlink=Math.min(c.lowlink,o[n].lowlink))})),c.lowlink===c.index){var l,s=[];do{l=r.pop(),o[l].onStack=!1,s.push(l)}while(u!==l);i.push(s)}}return n.nodes().forEach((function(n){e.has(o,n)||a(n)})),i},cc}function $l(){if(dc)return sc;dc=1;var e=Yl(),n=ql();return sc=function(t){return e.filter(n(t),(function(e){return e.length>1||1===e.length&&t.hasEdge(e[0],e[0])}))}}function Kl(){if(hc)return fc;hc=1;var e=Yl();fc=function(e,t,r){return function(e,n,t){var r={},o=e.nodes();return o.forEach((function(e){r[e]={},r[e][e]={distance:0},o.forEach((function(n){e!==n&&(r[e][n]={distance:Number.POSITIVE_INFINITY})})),t(e).forEach((function(t){var o=t.v===e?t.w:t.v,i=n(t);r[e][o]={distance:i,predecessor:e}}))})),o.forEach((function(e){var n=r[e];o.forEach((function(t){var i=r[t];o.forEach((function(t){var r=i[e],o=n[t],a=i[t],u=r.distance+o.distance;u<a.distance&&(a.distance=u,a.predecessor=o.predecessor)}))}))})),r}(e,t||n,r||function(n){return e.outEdges(n)})};var n=e.constant(1);return fc}function Ql(){if(pc)return vc;pc=1;var e=Yl();function n(n){var r={},o={},i=[];if(e.each(n.sinks(),(function a(u){if(e.has(o,u))throw new t;e.has(r,u)||(o[u]=!0,r[u]=!0,e.each(n.predecessors(u),a),delete o[u],i.push(u))})),e.size(r)!==n.nodeCount())throw new t;return i}function t(){}return vc=n,n.CycleException=t,t.prototype=new Error,vc}function Jl(){if(yc)return gc;yc=1;var e=Ql();return gc=function(n){try{e(n)}catch(n){if(n instanceof e.CycleException)return!1;throw n}return!0}}function es(){if(wc)return mc;wc=1;var e=Yl();function n(t,r,o,i,a,u){e.has(i,r)||(i[r]=!0,o||u.push(r),e.each(a(r),(function(e){n(t,e,o,i,a,u)})),o&&u.push(r))}return mc=function(t,r,o){e.isArray(r)||(r=[r]);var i=(t.isDirected()?t.successors:t.neighbors).bind(t),a=[],u={};return e.each(r,(function(e){if(!t.hasNode(e))throw new Error("Graph does not have node: "+e);n(t,e,"post"===o,u,i,a)})),a},mc}function ns(){if(xc)return bc;xc=1;var e=es();return bc=function(n,t){return e(n,t,"post")}}function ts(){if(Ec)return _c;Ec=1;var e=es();return _c=function(n,t){return e(n,t,"pre")}}function rs(){if(kc)return Sc;kc=1;var e=Yl(),n=Xl(),t=Ul();return Sc=function(r,o){var i,a=new n,u={},c=new t;function l(e){var n=e.v===i?e.w:e.v,t=c.priority(n);if(void 0!==t){var r=o(e);r<t&&(u[n]=i,c.decrease(n,r))}}if(0===r.nodeCount())return a;e.each(r.nodes(),(function(e){c.add(e,Number.POSITIVE_INFINITY),a.setNode(e)})),c.decrease(r.nodes()[0],0);for(var s=!1;c.size()>0;){if(i=c.removeMin(),e.has(u,i))a.setEdge(i,u[i]);else{if(s)throw new Error("Input graph is not connected: "+r);s=!0}r.nodeEdges(i).forEach(l)}return a},Sc}Pc.exports;try{jc=function(){if(Oc)return Mc;Oc=1;var e=Ku?$u:(Ku=1,$u={Graph:Xl(),version:qu?Gu:(qu=1,Gu="2.1.8")});return Mc={Graph:e.Graph,json:Zl(),alg:Cc?Nc:(Cc=1,Nc={components:Fl(),dijkstra:Wl(),dijkstraAll:Gl(),findCycles:$l(),floydWarshall:Kl(),isAcyclic:Jl(),postorder:ns(),preorder:ts(),prim:rs(),tarjan:ql(),topsort:Ql()}),version:e.version}}()}catch(Z){}jc||(jc=window.graphlib);var os,is,as,us,cs,ls,ss,ds,fs,hs,vs,ps,gs,ys,ms,ws,bs,xs,_s,Es,Ss,ks,Ns,Cs,Ms,Os,js,Ps,Is,As,zs,Ts,Ls,Bs,Ds,Rs,Hs,Vs,Ys,Xs,Zs,Fs,Us,Ws,Gs,qs,$s,Ks,Qs,Js,ed,nd,td,rd,od,id,ad,ud,cd,ld,sd,dd,fd,hd,vd,pd,gd,yd,md,wd,bd,xd,_d,Ed,Sd,kd,Nd,Cd,Md,Od,jd,Pd,Id,Ad,zd,Td,Ld,Bd,Dd,Rd,Hd,Vd,Yd,Xd=jc;function Zd(){if(us)return as;us=1;var e=Kn(),n=yr(),t=zt(),r=ot();return as=function(o,i,a){if(!r(a))return!1;var u=typeof i;return!!("number"==u?n(a)&&t(i,a.length):"string"==u&&i in a)&&e(a[i],o)}}function Fd(){if(ws)return ms;ws=1;var e=function(){if(ys)return gs;ys=1;var e=function(){if(ps)return vs;ps=1;var e=function(){if(hs)return fs;hs=1;var e=/\s/;return fs=function(n){for(var t=n.length;t--&&e.test(n.charAt(t)););return t}}(),n=/^\s+/;return vs=function(t){return t?t.slice(0,e(t)+1).replace(n,""):t}}(),n=ot(),t=hl(),r=/^[-+]0x[0-9a-f]+$/i,o=/^0b[01]+$/i,i=/^0o[0-7]+$/i,a=parseInt;return gs=function(u){if("number"==typeof u)return u;if(t(u))return NaN;if(n(u)){var c="function"==typeof u.valueOf?u.valueOf():u;u=n(c)?c+"":c}if("string"!=typeof u)return 0===u?u:+u;u=e(u);var l=o.test(u);return l||i.test(u)?a(u.slice(2),l?2:8):r.test(u)?NaN:+u}}(),n=1/0;return ms=function(t){return t?(t=e(t))===n||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0}}function Ud(){if(Cs)return Ns;Cs=1;var e=Al();return Ns=function(n){return null!=n&&n.length?e(n,1):[]}}function Wd(){if(Ts)return zs;Ts=1;var e=hl();return zs=function(n,t,r){for(var o=-1,i=n.length;++o<i;){var a=n[o],u=t(a);if(null!=u&&(void 0===c?u==u&&!e(u):r(u,c)))var c=u,l=a}return l},zs}function Gd(){if(Vs)return Hs;Vs=1;var e=pt(),n=Kn();return Hs=function(t,r,o){(void 0!==o&&!n(t[r],o)||void 0===o&&!(r in t))&&e(t,r,o)}}function qd(){return Fs?Zs:(Fs=1,Zs=function(e,n){if(("constructor"!==n||"function"!=typeof e[n])&&"__proto__"!=n)return e[n]})}function $d(){return rd?td:(rd=1,td=function(e,n){return e<n})}function Kd(){if(Ad)return Id;Ad=1;var e=pl(),n=wl(),t=El(),r=Ml(),o=(Cd||(Cd=1,Nd=function(e,n){var t=e.length;for(e.sort(n);t--;)e[t]=e[t].value;return e}),Nd),i=Lt(),a=function(){if(Pd)return jd;Pd=1;var e=function(){if(Od)return Md;Od=1;var e=hl();return Md=function(n,t){if(n!==t){var r=void 0!==n,o=null===n,i=n==n,a=e(n),u=void 0!==t,c=null===t,l=t==t,s=e(t);if(!c&&!s&&!a&&n>t||a&&u&&l&&!c&&!s||o&&u&&l||!r&&l||!i)return 1;if(!o&&!a&&!s&&n<t||s&&r&&i&&!o&&!a||c&&r&&i||!u&&i||!l)return-1}return 0}}();return jd=function(n,t,r){for(var o=-1,i=n.criteria,a=t.criteria,u=i.length,c=r.length;++o<u;){var l=e(i[o],a[o]);if(l)return o>=c?l:l*("desc"==r[o]?-1:1)}return n.index-t.index}}(),u=nl(),c=bt();return Id=function(l,s,d){s=s.length?e(s,(function(e){return c(e)?function(t){return n(t,1===e.length?e[0]:e)}:e})):[u];var f=-1;s=e(s,i(t));var h=r(l,(function(n,t,r){return{criteria:e(s,(function(e){return e(n)})),index:++f,value:n}}));return o(h,(function(e,n){return a(e,n,d)}))}}try{Yd={cloneDeep:function(){if(is)return os;is=1;var e=qc();return os=function(n){return e(n,5)}}(),constant:Kc(),defaults:function(){if(ls)return cs;ls=1;var e=Ll(),n=Kn(),t=Zd(),r=wr(),o=Object.prototype,i=o.hasOwnProperty,a=e((function(e,a){e=Object(e);var u=-1,c=a.length,l=c>2?a[2]:void 0;for(l&&t(a[0],a[1],l)&&(c=1);++u<c;)for(var s=a[u],d=r(s),f=-1,h=d.length;++f<h;){var v=d[f],p=e[v];(void 0===p||n(p,o[v])&&!i.call(e,v))&&(e[v]=s[v])}return e}));return cs=a}(),each:ol(),filter:Sl(),find:function(){if(ks)return Ss;ks=1;var e=function(){if(ds)return ss;ds=1;var e=El(),n=yr(),t=mr();return ss=function(r){return function(o,i,a){var u=Object(o);if(!n(o)){var c=e(i,3);o=t(o),i=function(e){return c(u[e],e,u)}}var l=r(o,i,a);return l>-1?u[c?o[l]:l]:void 0}}}(),n=e(function(){if(Es)return _s;Es=1;var e=Bl(),n=El(),t=function(){if(xs)return bs;xs=1;var e=Fd();return bs=function(n){var t=e(n),r=t%1;return t==t?r?t-r:t:0}}(),r=Math.max;return _s=function(o,i,a){var u=null==o?0:o.length;if(!u)return-1;var c=null==a?0:t(a);return c<0&&(c=r(u+c,0)),e(o,n(i,3),c)},_s}());return Ss=n}(),flatten:Ud(),forEach:rl(),forIn:function(){if(Os)return Ms;Os=1;var e=Qc(),n=tl(),t=wr();return Ms=function(r,o){return null==r?r:e(r,n(o),t)}}(),has:kl(),isUndefined:Cl(),last:(Ps||(Ps=1,js=function(e){var n=null==e?0:e.length;return n?e[n-1]:void 0}),js),map:Ol(),mapValues:function(){if(As)return Is;As=1;var e=pt(),n=Jc(),t=El();return Is=function(r,o){var i={};return o=t(o,3),n(r,(function(n,t,r){e(i,t,o(n,t,r))})),i}}(),max:function(){if(Rs)return Ds;Rs=1;var e=Wd(),n=Bs?Ls:(Bs=1,Ls=function(e,n){return e>n}),t=nl();return Ds=function(r){return r&&r.length?e(r,t,n):void 0},Ds}(),merge:function(){if(nd)return ed;nd=1;var e=function(){if(Ks)return $s;Ks=1;var e=ft(),n=Gd(),t=Qc(),r=function(){if(qs)return Gs;qs=1;var e=Gd(),n=Ic(),t=Uc(),r=Ac(),o=Gc(),i=wt(),a=bt(),u=Rl(),c=At(),l=it(),s=ot(),d=function(){if(Xs)return Ys;Xs=1;var e=rt(),n=Dc(),t=mt(),r=Function.prototype,o=Object.prototype,i=r.toString,a=o.hasOwnProperty,u=i.call(Object);return Ys=function(r){if(!t(r)||"[object Object]"!=e(r))return!1;var o=n(r);if(null===o)return!0;var c=a.call(o,"constructor")&&o.constructor;return"function"==typeof c&&c instanceof c&&i.call(c)==u}}(),f=fr(),h=qd(),v=function(){if(Ws)return Us;Ws=1;var e=yt(),n=wr();return Us=function(t){return e(t,n(t))}}();return Gs=function(p,g,y,m,w,b,x){var _=h(p,y),E=h(g,y),S=x.get(E);if(S)e(p,y,S);else{var k=b?b(_,E,y+"",p,g,x):void 0,N=void 0===k;if(N){var C=a(E),M=!C&&c(E),O=!C&&!M&&f(E);k=E,C||M||O?a(_)?k=_:u(_)?k=r(_):M?(N=!1,k=n(E,!0)):O?(N=!1,k=t(E,!0)):k=[]:d(E)||i(E)?(k=_,i(_)?k=v(_):s(_)&&!l(_)||(k=o(E))):N=!1}N&&(x.set(E,k),w(k,E,m,b,x),x.delete(E)),e(p,y,k)}}}(),o=ot(),i=wr(),a=qd();return $s=function u(c,l,s,d,f){c!==l&&t(l,(function(t,i){if(f||(f=new e),o(t))r(c,l,i,s,u,d,f);else{var h=d?d(a(c,i),t,i+"",c,l,f):void 0;void 0===h&&(h=t),n(c,i,h)}}),i)},$s}(),n=function(){if(Js)return Qs;Js=1;var e=Ll(),n=Zd();return Qs=function(t){return e((function(e,r){var o=-1,i=r.length,a=i>1?r[i-1]:void 0,u=i>2?r[2]:void 0;for(a=t.length>3&&"function"==typeof a?(i--,a):void 0,u&&n(r[0],r[1],u)&&(a=i<3?void 0:a,i=1),e=Object(e);++o<i;){var c=r[o];c&&t(e,c,o,a)}return e}))}}()((function(n,t,r){e(n,t,r)}));return ed=n}(),min:function(){if(id)return od;id=1;var e=Wd(),n=$d(),t=nl();return od=function(r){return r&&r.length?e(r,t,n):void 0},od}(),minBy:function(){if(ud)return ad;ud=1;var e=Wd(),n=El(),t=$d();return ad=function(r,o){return r&&r.length?e(r,n(o,2),t):void 0},ad}(),now:function(){if(ld)return cd;ld=1;var e=nt();return cd=function(){return e.Date.now()}}(),pick:function(){if(wd)return md;wd=1;var e=function(){if(pd)return vd;pd=1;var e=function(){if(hd)return fd;hd=1;var e=wl(),n=function(){if(dd)return sd;dd=1;var e=gt(),n=yl(),t=zt(),r=ot(),o=ml();return sd=function(i,a,u,c){if(!r(i))return i;for(var l=-1,s=(a=n(a,i)).length,d=s-1,f=i;null!=f&&++l<s;){var h=o(a[l]),v=u;if("__proto__"===h||"constructor"===h||"prototype"===h)return i;if(l!=d){var p=f[h];void 0===(v=c?c(p,h,f):void 0)&&(v=r(p)?p:t(a[l+1])?[]:{})}e(f,h,v),f=f[h]}return i}}(),t=yl();return fd=function(r,o,i){for(var a=-1,u=o.length,c={};++a<u;){var l=o[a],s=e(r,l);i(s,l)&&n(c,t(l,r),s)}return c}}(),n=xl();return vd=function(t,r){return e(t,r,(function(e,r){return n(t,r)}))}}(),n=function(){if(yd)return gd;yd=1;var e=Ud(),n=zl(),t=Tl();return gd=function(r){return t(n(r,void 0,e),r+"")}}(),t=n((function(n,t){return null==n?{}:e(n,t)}));return md=t}(),range:function(){if(kd)return Sd;kd=1;var e=function(){if(Ed)return _d;Ed=1;var e=function(){if(xd)return bd;xd=1;var e=Math.ceil,n=Math.max;return bd=function(t,r,o,i){for(var a=-1,u=n(e((r-t)/(o||1)),0),c=Array(u);u--;)c[i?u:++a]=t,t+=o;return c},bd}(),n=Zd(),t=Fd();return _d=function(r){return function(o,i,a){return a&&"number"!=typeof a&&n(o,i,a)&&(i=a=void 0),o=t(o),void 0===i?(i=o,o=0):i=t(i),a=void 0===a?o<i?1:-1:t(a),e(o,i,a,r)}},_d}()();return Sd=e}(),reduce:jl(),sortBy:function(){if(Td)return zd;Td=1;var e=Al(),n=Kd(),t=Ll(),r=Zd(),o=t((function(t,o){if(null==t)return[];var i=o.length;return i>1&&r(t,o[0],o[1])?o=[]:i>2&&r(o[0],o[1],o[2])&&(o=[o[0]]),n(t,e(o,1),[])}));return zd=o}(),uniqueId:function(){if(Bd)return Ld;Bd=1;var e=gl(),n=0;return Ld=function(t){var r=++n;return e(t)+r},Ld}(),values:Vl(),zipObject:function(){if(Vd)return Hd;Vd=1;var e=gt(),n=(Rd||(Rd=1,Dd=function(e,n,t){for(var r=-1,o=e.length,i=n.length,a={};++r<o;){var u=r<i?n[r]:void 0;t(a,e[r],u)}return a}),Dd);return Hd=function(t,r){return n(t||[],r||[],e)},Hd}()}}catch(Z){}Yd||(Yd=window._);var Qd=Yd,Jd=ef;function ef(){var e={};e._next=e._prev=e,this._sentinel=e}function nf(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function tf(e,n){if("_next"!==e&&"_prev"!==e)return n}ef.prototype.dequeue=function(){var e=this._sentinel,n=e._prev;if(n!==e)return nf(n),n},ef.prototype.enqueue=function(e){var n=this._sentinel;e._prev&&e._next&&nf(e),e._next=n._next,n._next._prev=e,n._next=e,e._prev=n},ef.prototype.toString=function(){for(var e=[],n=this._sentinel,t=n._prev;t!==n;)e.push(JSON.stringify(t,tf)),t=t._prev;return"["+e.join(", ")+"]"};var rf=Qd,of=Xd.Graph,af=Jd,uf=rf.constant(1);function cf(e,n,t,r,o){var i=o?[]:void 0;return rf.forEach(e.inEdges(r.v),(function(r){var a=e.edge(r),u=e.node(r.v);o&&i.push({v:r.v,w:r.w}),u.out-=a,lf(n,t,u)})),rf.forEach(e.outEdges(r.v),(function(r){var o=e.edge(r),i=r.w,a=e.node(i);a.in-=o,lf(n,t,a)})),e.removeNode(r.v),i}function lf(e,n,t){t.out?t.in?e[t.out-t.in+n].enqueue(t):e[e.length-1].enqueue(t):e[0].enqueue(t)}var sf=Qd,df=function(e,n){if(e.nodeCount()<=1)return[];var t=function(e,n){var t=new of,r=0,o=0;rf.forEach(e.nodes(),(function(e){t.setNode(e,{v:e,in:0,out:0})})),rf.forEach(e.edges(),(function(e){var i=t.edge(e.v,e.w)||0,a=n(e),u=i+a;t.setEdge(e.v,e.w,u),o=Math.max(o,t.node(e.v).out+=a),r=Math.max(r,t.node(e.w).in+=a)}));var i=rf.range(o+r+3).map((function(){return new af})),a=r+1;return rf.forEach(t.nodes(),(function(e){lf(i,a,t.node(e))})),{graph:t,buckets:i,zeroIdx:a}}(e,n||uf),r=function(e,n,t){for(var r,o=[],i=n[n.length-1],a=n[0];e.nodeCount();){for(;r=a.dequeue();)cf(e,n,t,r);for(;r=i.dequeue();)cf(e,n,t,r);if(e.nodeCount())for(var u=n.length-2;u>0;--u)if(r=n[u].dequeue()){o=o.concat(cf(e,n,t,r,!0));break}}return o}(t.graph,t.buckets,t.zeroIdx);return rf.flatten(rf.map(r,(function(n){return e.outEdges(n.v,n.w)})),!0)},ff={run:function(e){var n="greedy"===e.graph().acyclicer?df(e,function(e){return function(n){return e.edge(n).weight}}(e)):function(e){var n=[],t={},r={};return sf.forEach(e.nodes(),(function o(i){sf.has(r,i)||(r[i]=!0,t[i]=!0,sf.forEach(e.outEdges(i),(function(e){sf.has(t,e.w)?n.push(e):o(e.w)})),delete t[i])})),n}(e);sf.forEach(n,(function(n){var t=e.edge(n);e.removeEdge(n),t.forwardName=n.name,t.reversed=!0,e.setEdge(n.w,n.v,t,sf.uniqueId("rev"))}))},undo:function(e){sf.forEach(e.edges(),(function(n){var t=e.edge(n);if(t.reversed){e.removeEdge(n);var r=t.forwardName;delete t.reversed,delete t.forwardName,e.setEdge(n.w,n.v,t,r)}}))}},hf=Qd,vf=Xd.Graph,pf={addDummyNode:gf,simplify:function(e){var n=(new vf).setGraph(e.graph());return hf.forEach(e.nodes(),(function(t){n.setNode(t,e.node(t))})),hf.forEach(e.edges(),(function(t){var r=n.edge(t.v,t.w)||{weight:0,minlen:1},o=e.edge(t);n.setEdge(t.v,t.w,{weight:r.weight+o.weight,minlen:Math.max(r.minlen,o.minlen)})})),n},asNonCompoundGraph:function(e){var n=new vf({multigraph:e.isMultigraph()}).setGraph(e.graph());return hf.forEach(e.nodes(),(function(t){e.children(t).length||n.setNode(t,e.node(t))})),hf.forEach(e.edges(),(function(t){n.setEdge(t,e.edge(t))})),n},successorWeights:function(e){var n=hf.map(e.nodes(),(function(n){var t={};return hf.forEach(e.outEdges(n),(function(n){t[n.w]=(t[n.w]||0)+e.edge(n).weight})),t}));return hf.zipObject(e.nodes(),n)},predecessorWeights:function(e){var n=hf.map(e.nodes(),(function(n){var t={};return hf.forEach(e.inEdges(n),(function(n){t[n.v]=(t[n.v]||0)+e.edge(n).weight})),t}));return hf.zipObject(e.nodes(),n)},intersectRect:function(e,n){var t,r,o=e.x,i=e.y,a=n.x-o,u=n.y-i,c=e.width/2,l=e.height/2;if(!a&&!u)throw new Error("Not possible to find intersection inside of the rectangle");return Math.abs(u)*c>Math.abs(a)*l?(u<0&&(l=-l),t=l*a/u,r=l):(a<0&&(c=-c),t=c,r=c*u/a),{x:o+t,y:i+r}},buildLayerMatrix:function(e){var n=hf.map(hf.range(yf(e)+1),(function(){return[]}));return hf.forEach(e.nodes(),(function(t){var r=e.node(t),o=r.rank;hf.isUndefined(o)||(n[o][r.order]=t)})),n},normalizeRanks:function(e){var n=hf.min(hf.map(e.nodes(),(function(n){return e.node(n).rank})));hf.forEach(e.nodes(),(function(t){var r=e.node(t);hf.has(r,"rank")&&(r.rank-=n)}))},removeEmptyRanks:function(e){var n=hf.min(hf.map(e.nodes(),(function(n){return e.node(n).rank}))),t=[];hf.forEach(e.nodes(),(function(r){var o=e.node(r).rank-n;t[o]||(t[o]=[]),t[o].push(r)}));var r=0,o=e.graph().nodeRankFactor;hf.forEach(t,(function(n,t){hf.isUndefined(n)&&t%o!=0?--r:r&&hf.forEach(n,(function(n){e.node(n).rank+=r}))}))},addBorderNode:function(e,n,t,r){var o={width:0,height:0};return arguments.length>=4&&(o.rank=t,o.order=r),gf(e,"border",o,n)},maxRank:yf,partition:function(e,n){var t={lhs:[],rhs:[]};return hf.forEach(e,(function(e){n(e)?t.lhs.push(e):t.rhs.push(e)})),t},time:function(e,n){var t=hf.now();try{return n()}finally{console.log(e+" time: "+(hf.now()-t)+"ms")}},notime:function(e,n){return n()}};function gf(e,n,t,r){var o;do{o=hf.uniqueId(r)}while(e.hasNode(o));return t.dummy=n,e.setNode(o,t),o}function yf(e){return hf.max(hf.map(e.nodes(),(function(n){var t=e.node(n).rank;if(!hf.isUndefined(t))return t})))}var mf=Qd,wf=pf,bf={run:function(e){e.graph().dummyChains=[],mf.forEach(e.edges(),(function(n){!function(e,n){var t,r,o,i=n.v,a=e.node(i).rank,u=n.w,c=e.node(u).rank,l=n.name,s=e.edge(n),d=s.labelRank;if(c!==a+1){for(e.removeEdge(n),o=0,++a;a<c;++o,++a)s.points=[],r={width:0,height:0,edgeLabel:s,edgeObj:n,rank:a},t=wf.addDummyNode(e,"edge",r,"_d"),a===d&&(r.width=s.width,r.height=s.height,r.dummy="edge-label",r.labelpos=s.labelpos),e.setEdge(i,t,{weight:s.weight},l),0===o&&e.graph().dummyChains.push(t),i=t;e.setEdge(i,u,{weight:s.weight},l)}}(e,n)}))},undo:function(e){mf.forEach(e.graph().dummyChains,(function(n){var t,r=e.node(n),o=r.edgeLabel;for(e.setEdge(r.edgeObj,o);r.dummy;)t=e.successors(n)[0],e.removeNode(n),o.points.push({x:r.x,y:r.y}),"edge-label"===r.dummy&&(o.x=r.x,o.y=r.y,o.width=r.width,o.height=r.height),n=t,r=e.node(n)}))}},xf=Qd,_f=function(e){var n={};xf.forEach(e.sources(),(function t(r){var o=e.node(r);if(xf.has(n,r))return o.rank;n[r]=!0;var i=xf.min(xf.map(e.outEdges(r),(function(n){return t(n.w)-e.edge(n).minlen})));return i!==Number.POSITIVE_INFINITY&&null!=i||(i=0),o.rank=i}))},Ef=function(e,n){return e.node(n.w).rank-e.node(n.v).rank-e.edge(n).minlen},Sf=Qd,kf=Xd.Graph,Nf=Ef,Cf=function(e){var n,t,r=new kf({directed:!1}),o=e.nodes()[0],i=e.nodeCount();for(r.setNode(o,{});Mf(r,e)<i;)n=Of(r,e),t=r.hasNode(n.v)?Nf(e,n):-Nf(e,n),jf(r,e,t);return r};function Mf(e,n){return Sf.forEach(e.nodes(),(function t(r){Sf.forEach(n.nodeEdges(r),(function(o){var i=o.v,a=r===i?o.w:i;e.hasNode(a)||Nf(n,o)||(e.setNode(a,{}),e.setEdge(r,a,{}),t(a))}))})),e.nodeCount()}function Of(e,n){return Sf.minBy(n.edges(),(function(t){if(e.hasNode(t.v)!==e.hasNode(t.w))return Nf(n,t)}))}function jf(e,n,t){Sf.forEach(e.nodes(),(function(e){n.node(e).rank+=t}))}var Pf=Qd,If=Cf,Af=Ef,zf=_f,Tf=Xd.alg.preorder,Lf=Xd.alg.postorder,Bf=pf.simplify,Df=Rf;function Rf(e){e=Bf(e),zf(e);var n,t=If(e);for(Yf(t),Hf(t,e);n=Zf(t);)Uf(t,e,n,Ff(t,e,n))}function Hf(e,n){var t=Lf(e,e.nodes());t=t.slice(0,t.length-1),Pf.forEach(t,(function(t){!function(e,n,t){var r=e.node(t).parent;e.edge(t,r).cutvalue=Vf(e,n,t)}(e,n,t)}))}function Vf(e,n,t){var r=e.node(t).parent,o=!0,i=n.edge(t,r),a=0;return i||(o=!1,i=n.edge(r,t)),a=i.weight,Pf.forEach(n.nodeEdges(t),(function(i){var u,c,l=i.v===t,s=l?i.w:i.v;if(s!==r){var d=l===o,f=n.edge(i).weight;if(a+=d?f:-f,u=t,c=s,e.hasEdge(u,c)){var h=e.edge(t,s).cutvalue;a+=d?-h:h}}})),a}function Yf(e,n){arguments.length<2&&(n=e.nodes()[0]),Xf(e,{},1,n)}function Xf(e,n,t,r,o){var i=t,a=e.node(r);return n[r]=!0,Pf.forEach(e.neighbors(r),(function(o){Pf.has(n,o)||(t=Xf(e,n,t,o,r))})),a.low=i,a.lim=t++,o?a.parent=o:delete a.parent,t}function Zf(e){return Pf.find(e.edges(),(function(n){return e.edge(n).cutvalue<0}))}function Ff(e,n,t){var r=t.v,o=t.w;n.hasEdge(r,o)||(r=t.w,o=t.v);var i=e.node(r),a=e.node(o),u=i,c=!1;i.lim>a.lim&&(u=a,c=!0);var l=Pf.filter(n.edges(),(function(n){return c===Wf(e,e.node(n.v),u)&&c!==Wf(e,e.node(n.w),u)}));return Pf.minBy(l,(function(e){return Af(n,e)}))}function Uf(e,n,t,r){var o=t.v,i=t.w;e.removeEdge(o,i),e.setEdge(r.v,r.w,{}),Yf(e),Hf(e,n),function(e,n){var t=Pf.find(e.nodes(),(function(e){return!n.node(e).parent})),r=Tf(e,t);r=r.slice(1),Pf.forEach(r,(function(t){var r=e.node(t).parent,o=n.edge(t,r),i=!1;o||(o=n.edge(r,t),i=!0),n.node(t).rank=n.node(r).rank+(i?o.minlen:-o.minlen)}))}(e,n)}function Wf(e,n,t){return t.low<=n.lim&&n.lim<=t.lim}Rf.initLowLimValues=Yf,Rf.initCutValues=Hf,Rf.calcCutValue=Vf,Rf.leaveEdge=Zf,Rf.enterEdge=Ff,Rf.exchangeEdges=Uf;var Gf=_f,qf=Cf,$f=Df,Kf=Gf;var Qf=Qd,Jf=Qd,eh=pf,nh={run:function(e){var n=eh.addDummyNode(e,"root",{},"_root"),t=function(e){var n={};function t(r,o){var i=e.children(r);i&&i.length&&Jf.forEach(i,(function(e){t(e,o+1)})),n[r]=o}return Jf.forEach(e.children(),(function(e){t(e,1)})),n}(e),r=Jf.max(Jf.values(t))-1,o=2*r+1;e.graph().nestingRoot=n,Jf.forEach(e.edges(),(function(n){e.edge(n).minlen*=o}));var i=function(e){return Jf.reduce(e.edges(),(function(n,t){return n+e.edge(t).weight}),0)}(e)+1;Jf.forEach(e.children(),(function(a){th(e,n,o,i,r,t,a)})),e.graph().nodeRankFactor=o},cleanup:function(e){var n=e.graph();e.removeNode(n.nestingRoot),delete n.nestingRoot,Jf.forEach(e.edges(),(function(n){e.edge(n).nestingEdge&&e.removeEdge(n)}))}};function th(e,n,t,r,o,i,a){var u=e.children(a);if(u.length){var c=eh.addBorderNode(e,"_bt"),l=eh.addBorderNode(e,"_bb"),s=e.node(a);e.setParent(c,a),s.borderTop=c,e.setParent(l,a),s.borderBottom=l,Jf.forEach(u,(function(u){th(e,n,t,r,o,i,u);var s=e.node(u),d=s.borderTop?s.borderTop:u,f=s.borderBottom?s.borderBottom:u,h=s.borderTop?r:2*r,v=d!==f?1:o-i[a]+1;e.setEdge(c,d,{weight:h,minlen:v,nestingEdge:!0}),e.setEdge(f,l,{weight:h,minlen:v,nestingEdge:!0})})),e.parent(a)||e.setEdge(n,c,{weight:0,minlen:o+i[a]})}else a!==n&&e.setEdge(n,a,{weight:0,minlen:t})}var rh=Qd,oh=pf;function ih(e,n,t,r,o,i){var a={width:0,height:0,rank:i,borderType:n},u=o[n][i-1],c=oh.addDummyNode(e,"border",a,t);o[n][i]=c,e.setParent(c,r),u&&e.setEdge(u,c,{weight:1})}var ah=Qd,uh={adjust:function(e){var n=e.graph().rankdir.toLowerCase();"lr"!==n&&"rl"!==n||ch(e)},undo:function(e){var n=e.graph().rankdir.toLowerCase();"bt"!==n&&"rl"!==n||function(e){ah.forEach(e.nodes(),(function(n){sh(e.node(n))})),ah.forEach(e.edges(),(function(n){var t=e.edge(n);ah.forEach(t.points,sh),ah.has(t,"y")&&sh(t)}))}(e),"lr"!==n&&"rl"!==n||(function(e){ah.forEach(e.nodes(),(function(n){dh(e.node(n))})),ah.forEach(e.edges(),(function(n){var t=e.edge(n);ah.forEach(t.points,dh),ah.has(t,"x")&&dh(t)}))}(e),ch(e))}};function ch(e){ah.forEach(e.nodes(),(function(n){lh(e.node(n))})),ah.forEach(e.edges(),(function(n){lh(e.edge(n))}))}function lh(e){var n=e.width;e.width=e.height,e.height=n}function sh(e){e.y=-e.y}function dh(e){var n=e.x;e.x=e.y,e.y=n}var fh=Qd,hh=Qd;function vh(e,n,t){for(var r=hh.zipObject(t,hh.map(t,(function(e,n){return n}))),o=hh.flatten(hh.map(n,(function(n){return hh.sortBy(hh.map(e.outEdges(n),(function(n){return{pos:r[n.w],weight:e.edge(n).weight}})),"pos")})),!0),i=1;i<t.length;)i<<=1;var a=2*i-1;i-=1;var u=hh.map(new Array(a),(function(){return 0})),c=0;return hh.forEach(o.forEach((function(e){var n=e.pos+i;u[n]+=e.weight;for(var t=0;n>0;)n%2&&(t+=u[n+1]),u[n=n-1>>1]+=e.weight;c+=e.weight*t}))),c}var ph=Qd,gh=Qd,yh=Qd,mh=pf;function wh(e,n,t){for(var r;n.length&&(r=yh.last(n)).i<=t;)n.pop(),e.push(r.vs),t++;return t}var bh=Qd,xh=Qd,_h=Xd.Graph,Eh=Qd,Sh=Qd,kh=function(e){var n={},t=fh.filter(e.nodes(),(function(n){return!e.children(n).length})),r=fh.max(fh.map(t,(function(n){return e.node(n).rank}))),o=fh.map(fh.range(r+1),(function(){return[]}));var i=fh.sortBy(t,(function(n){return e.node(n).rank}));return fh.forEach(i,(function t(r){if(!fh.has(n,r)){n[r]=!0;var i=e.node(r);o[i.rank].push(r),fh.forEach(e.successors(r),t)}})),o},Nh=function(e,n){for(var t=0,r=1;r<n.length;++r)t+=vh(e,n[r-1],n[r]);return t},Ch=function e(n,t,r,o){var i=n.children(t),a=n.node(t),u=a?a.borderLeft:void 0,c=a?a.borderRight:void 0,l={};u&&(i=bh.filter(i,(function(e){return e!==u&&e!==c})));var s=function(e,n){return ph.map(n,(function(n){var t=e.inEdges(n);if(t.length){var r=ph.reduce(t,(function(n,t){var r=e.edge(t),o=e.node(t.v);return{sum:n.sum+r.weight*o.order,weight:n.weight+r.weight}}),{sum:0,weight:0});return{v:n,barycenter:r.sum/r.weight,weight:r.weight}}return{v:n}}))}(n,i);bh.forEach(s,(function(t){if(n.children(t.v).length){var i=e(n,t.v,r,o);l[t.v]=i,bh.has(i,"barycenter")&&(a=t,u=i,bh.isUndefined(a.barycenter)?(a.barycenter=u.barycenter,a.weight=u.weight):(a.barycenter=(a.barycenter*a.weight+u.barycenter*u.weight)/(a.weight+u.weight),a.weight+=u.weight))}var a,u}));var d=function(e,n){var t={};return gh.forEach(e,(function(e,n){var r=t[e.v]={indegree:0,in:[],out:[],vs:[e.v],i:n};gh.isUndefined(e.barycenter)||(r.barycenter=e.barycenter,r.weight=e.weight)})),gh.forEach(n.edges(),(function(e){var n=t[e.v],r=t[e.w];gh.isUndefined(n)||gh.isUndefined(r)||(r.indegree++,n.out.push(t[e.w]))})),function(e){var n=[];function t(e){return function(n){n.merged||(gh.isUndefined(n.barycenter)||gh.isUndefined(e.barycenter)||n.barycenter>=e.barycenter)&&function(e,n){var t=0,r=0;e.weight&&(t+=e.barycenter*e.weight,r+=e.weight),n.weight&&(t+=n.barycenter*n.weight,r+=n.weight),e.vs=n.vs.concat(e.vs),e.barycenter=t/r,e.weight=r,e.i=Math.min(n.i,e.i),n.merged=!0}(e,n)}}function r(n){return function(t){t.in.push(n),0==--t.indegree&&e.push(t)}}for(;e.length;){var o=e.pop();n.push(o),gh.forEach(o.in.reverse(),t(o)),gh.forEach(o.out,r(o))}return gh.map(gh.filter(n,(function(e){return!e.merged})),(function(e){return gh.pick(e,["vs","i","barycenter","weight"])}))}(gh.filter(t,(function(e){return!e.indegree})))}(s,r);!function(e,n){bh.forEach(e,(function(e){e.vs=bh.flatten(e.vs.map((function(e){return n[e]?n[e].vs:e})),!0)}))}(d,l);var f=function(e,n){var t,r=mh.partition(e,(function(e){return yh.has(e,"barycenter")})),o=r.lhs,i=yh.sortBy(r.rhs,(function(e){return-e.i})),a=[],u=0,c=0,l=0;o.sort((t=!!n,function(e,n){return e.barycenter<n.barycenter?-1:e.barycenter>n.barycenter?1:t?n.i-e.i:e.i-n.i})),l=wh(a,i,l),yh.forEach(o,(function(e){l+=e.vs.length,a.push(e.vs),u+=e.barycenter*e.weight,c+=e.weight,l=wh(a,i,l)}));var s={vs:yh.flatten(a,!0)};return c&&(s.barycenter=u/c,s.weight=c),s}(d,o);if(u&&(f.vs=bh.flatten([u,f.vs,c],!0),n.predecessors(u).length)){var h=n.node(n.predecessors(u)[0]),v=n.node(n.predecessors(c)[0]);bh.has(f,"barycenter")||(f.barycenter=0,f.weight=0),f.barycenter=(f.barycenter*f.weight+h.order+v.order)/(f.weight+2),f.weight+=2}return f},Mh=function(e,n,t){var r=function(e){for(var n;e.hasNode(n=xh.uniqueId("_root")););return n}(e),o=new _h({compound:!0}).setGraph({root:r}).setDefaultNodeLabel((function(n){return e.node(n)}));return xh.forEach(e.nodes(),(function(i){var a=e.node(i),u=e.parent(i);(a.rank===n||a.minRank<=n&&n<=a.maxRank)&&(o.setNode(i),o.setParent(i,u||r),xh.forEach(e[t](i),(function(n){var t=n.v===i?n.w:n.v,r=o.edge(t,i),a=xh.isUndefined(r)?0:r.weight;o.setEdge(t,i,{weight:e.edge(n).weight+a})})),xh.has(a,"minRank")&&o.setNode(i,{borderLeft:a.borderLeft[n],borderRight:a.borderRight[n]}))})),o},Oh=Xd.Graph,jh=pf;function Ph(e,n,t){return Sh.map(n,(function(n){return Mh(e,n,t)}))}function Ih(e,n){var t=new Oh;Sh.forEach(e,(function(e){var r=e.graph().root,o=Ch(e,r,t,n);Sh.forEach(o.vs,(function(n,t){e.node(n).order=t})),function(e,n,t){var r,o={};Eh.forEach(t,(function(t){for(var i,a,u=e.parent(t);u;){if((i=e.parent(u))?(a=o[i],o[i]=u):(a=r,r=u),a&&a!==u)return void n.setEdge(a,u);u=i}}))}(e,t,o.vs)}))}function Ah(e,n){Sh.forEach(n,(function(n){Sh.forEach(n,(function(n,t){e.node(n).order=t}))}))}var zh=Qd,Th=Xd.Graph,Lh=pf;function Bh(e,n,t){if(n>t){var r=n;n=t,t=r}var o=e[n];o||(e[n]=o={}),o[t]=!0}function Dh(e,n,t){if(n>t){var r=n;n=t,t=r}return zh.has(e[n],t)}var Rh=Qd,Hh=pf,Vh=function(e){var n,t=Lh.buildLayerMatrix(e),r=zh.merge(function(e,n){var t={};return zh.reduce(n,(function(n,r){var o=0,i=0,a=n.length,u=zh.last(r);return zh.forEach(r,(function(n,c){var l=function(e,n){if(e.node(n).dummy)return zh.find(e.predecessors(n),(function(n){return e.node(n).dummy}))}(e,n),s=l?e.node(l).order:a;(l||n===u)&&(zh.forEach(r.slice(i,c+1),(function(n){zh.forEach(e.predecessors(n),(function(r){var i=e.node(r),a=i.order;!(a<o||s<a)||i.dummy&&e.node(n).dummy||Bh(t,r,n)}))})),i=c+1,o=s)})),r})),t}(e,t),function(e,n){var t={};function r(n,r,o,i,a){var u;zh.forEach(zh.range(r,o),(function(r){u=n[r],e.node(u).dummy&&zh.forEach(e.predecessors(u),(function(n){var r=e.node(n);r.dummy&&(r.order<i||r.order>a)&&Bh(t,n,u)}))}))}return zh.reduce(n,(function(n,t){var o,i=-1,a=0;return zh.forEach(t,(function(u,c){if("border"===e.node(u).dummy){var l=e.predecessors(u);l.length&&(o=e.node(l[0]).order,r(t,a,c,i,o),a=c,i=o)}r(t,a,t.length,o,n.length)})),t})),t}(e,t)),o={};zh.forEach(["u","d"],(function(i){n="u"===i?t:zh.values(t).reverse(),zh.forEach(["l","r"],(function(t){"r"===t&&(n=zh.map(n,(function(e){return zh.values(e).reverse()})));var a=("u"===i?e.predecessors:e.successors).bind(e),u=function(e,n,t,r){var o={},i={},a={};return zh.forEach(n,(function(e){zh.forEach(e,(function(e,n){o[e]=e,i[e]=e,a[e]=n}))})),zh.forEach(n,(function(e){var n=-1;zh.forEach(e,(function(e){var u=r(e);if(u.length){u=zh.sortBy(u,(function(e){return a[e]}));for(var c=(u.length-1)/2,l=Math.floor(c),s=Math.ceil(c);l<=s;++l){var d=u[l];i[e]===e&&n<a[d]&&!Dh(t,e,d)&&(i[d]=e,i[e]=o[e]=o[d],n=a[d])}}}))})),{root:o,align:i}}(0,n,r,a),c=function(e,n,t,r,o){var i={},a=function(e,n,t,r){var o=new Th,i=e.graph(),a=function(e,n,t){return function(r,o,i){var a,u=r.node(o),c=r.node(i),l=0;if(l+=u.width/2,zh.has(u,"labelpos"))switch(u.labelpos.toLowerCase()){case"l":a=-u.width/2;break;case"r":a=u.width/2}if(a&&(l+=t?a:-a),a=0,l+=(u.dummy?n:e)/2,l+=(c.dummy?n:e)/2,l+=c.width/2,zh.has(c,"labelpos"))switch(c.labelpos.toLowerCase()){case"l":a=c.width/2;break;case"r":a=-c.width/2}return a&&(l+=t?a:-a),a=0,l}}(i.nodesep,i.edgesep,r);return zh.forEach(n,(function(n){var r;zh.forEach(n,(function(n){var i=t[n];if(o.setNode(i),r){var u=t[r],c=o.edge(u,i);o.setEdge(u,i,Math.max(a(e,n,r),c||0))}r=n}))})),o}(e,n,t,o),u=o?"borderLeft":"borderRight";function c(e,n){for(var t=a.nodes(),r=t.pop(),o={};r;)o[r]?e(r):(o[r]=!0,t.push(r),t=t.concat(n(r))),r=t.pop()}return c((function(e){i[e]=a.inEdges(e).reduce((function(e,n){return Math.max(e,i[n.v]+a.edge(n))}),0)}),a.predecessors.bind(a)),c((function(n){var t=a.outEdges(n).reduce((function(e,n){return Math.min(e,i[n.w]-a.edge(n))}),Number.POSITIVE_INFINITY),r=e.node(n);t!==Number.POSITIVE_INFINITY&&r.borderType!==u&&(i[n]=Math.max(i[n],t))}),a.successors.bind(a)),zh.forEach(r,(function(e){i[e]=i[t[e]]})),i}(e,n,u.root,u.align,"r"===t);"r"===t&&(c=zh.mapValues(c,(function(e){return-e}))),o[i+t]=c}))}));var i=function(e,n){return zh.minBy(zh.values(n),(function(n){var t=Number.NEGATIVE_INFINITY,r=Number.POSITIVE_INFINITY;return zh.forIn(n,(function(n,o){var i=function(e,n){return e.node(n).width}(e,o)/2;t=Math.max(n+i,t),r=Math.min(n-i,r)})),t-r}))}(e,o);return function(e,n){var t=zh.values(n),r=zh.min(t),o=zh.max(t);zh.forEach(["u","d"],(function(t){zh.forEach(["l","r"],(function(i){var a,u=t+i,c=e[u];if(c!==n){var l=zh.values(c);(a="l"===i?r-zh.min(l):o-zh.max(l))&&(e[u]=zh.mapValues(c,(function(e){return e+a})))}}))}))}(o,i),function(e,n){return zh.mapValues(e.ul,(function(t,r){if(n)return e[n.toLowerCase()][r];var o=zh.sortBy(zh.map(e,r));return(o[1]+o[2])/2}))}(o,e.graph().align)},Yh=Qd,Xh=ff,Zh=bf,Fh=function(e){switch(e.graph().ranker){case"network-simplex":default:!function(e){$f(e)}(e);break;case"tight-tree":!function(e){Gf(e),qf(e)}(e);break;case"longest-path":Kf(e)}},Uh=pf.normalizeRanks,Wh=function(e){var n=function(e){var n={},t=0;return Qf.forEach(e.children(),(function r(o){var i=t;Qf.forEach(e.children(o),r),n[o]={low:i,lim:t++}})),n}(e);Qf.forEach(e.graph().dummyChains,(function(t){for(var r=e.node(t),o=r.edgeObj,i=function(e,n,t,r){var o,i,a=[],u=[],c=Math.min(n[t].low,n[r].low),l=Math.max(n[t].lim,n[r].lim);o=t;do{o=e.parent(o),a.push(o)}while(o&&(n[o].low>c||l>n[o].lim));for(i=o,o=r;(o=e.parent(o))!==i;)u.push(o);return{path:a.concat(u.reverse()),lca:i}}(e,n,o.v,o.w),a=i.path,u=i.lca,c=0,l=a[c],s=!0;t!==o.w;){if(r=e.node(t),s){for(;(l=a[c])!==u&&e.node(l).maxRank<r.rank;)c++;l===u&&(s=!1)}if(!s){for(;c<a.length-1&&e.node(l=a[c+1]).minRank<=r.rank;)c++;l=a[c]}e.setParent(t,l),t=e.successors(t)[0]}}))},Gh=pf.removeEmptyRanks,qh=nh,$h=function(e){rh.forEach(e.children(),(function n(t){var r=e.children(t),o=e.node(t);if(r.length&&rh.forEach(r,n),rh.has(o,"minRank")){o.borderLeft=[],o.borderRight=[];for(var i=o.minRank,a=o.maxRank+1;i<a;++i)ih(e,"borderLeft","_bl",t,o,i),ih(e,"borderRight","_br",t,o,i)}}))},Kh=uh,Qh=function(e){var n=jh.maxRank(e),t=Ph(e,Sh.range(1,n+1),"inEdges"),r=Ph(e,Sh.range(n-1,-1,-1),"outEdges"),o=kh(e);Ah(e,o);for(var i,a=Number.POSITIVE_INFINITY,u=0,c=0;c<4;++u,++c){Ih(u%2?t:r,u%4>=2),o=jh.buildLayerMatrix(e);var l=Nh(e,o);l<a&&(c=0,i=Sh.cloneDeep(o),a=l)}Ah(e,i)},Jh=function(e){(function(e){var n=Hh.buildLayerMatrix(e),t=e.graph().ranksep,r=0;Rh.forEach(n,(function(n){var o=Rh.max(Rh.map(n,(function(n){return e.node(n).height})));Rh.forEach(n,(function(n){e.node(n).y=r+o/2})),r+=o+t}))})(e=Hh.asNonCompoundGraph(e)),Rh.forEach(Vh(e),(function(n,t){e.node(t).x=n}))},ev=pf,nv=Xd.Graph,tv=["nodesep","edgesep","ranksep","marginx","marginy"],rv={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},ov=["acyclicer","ranker","rankdir","align"],iv=["width","height"],av={width:0,height:0},uv=["minlen","weight","width","height","labeloffset"],cv={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},lv=["labelpos"];function sv(e,n){return Yh.mapValues(Yh.pick(e,n),Number)}function dv(e){var n={};return Yh.forEach(e,(function(e,t){n[t.toLowerCase()]=e})),n}var fv=Qd,hv=pf,vv=Xd.Graph,pv={debugOrdering:function(e){var n=hv.buildLayerMatrix(e),t=new vv({compound:!0,multigraph:!0}).setGraph({});return fv.forEach(e.nodes(),(function(n){t.setNode(n,{label:n}),t.setParent(n,"layer"+e.node(n).rank)})),fv.forEach(e.edges(),(function(e){t.setEdge(e.v,e.w,{},e.name)})),fv.forEach(n,(function(e,n){var r="layer"+n;t.setNode(r,{rank:"same"}),fv.reduce(e,(function(e,n){return t.setEdge(e,n,{style:"invis"}),n}))})),t}},gv=$n({graphlib:Xd,layout:function(e,n){var t=n&&n.debugTiming?ev.time:ev.notime;t("layout",(function(){var n=t(" buildLayoutGraph",(function(){return function(e){var n=new nv({multigraph:!0,compound:!0}),t=dv(e.graph());return n.setGraph(Yh.merge({},rv,sv(t,tv),Yh.pick(t,ov))),Yh.forEach(e.nodes(),(function(t){var r=dv(e.node(t));n.setNode(t,Yh.defaults(sv(r,iv),av)),n.setParent(t,e.parent(t))})),Yh.forEach(e.edges(),(function(t){var r=dv(e.edge(t));n.setEdge(t,Yh.merge({},cv,sv(r,uv),Yh.pick(r,lv)))})),n}(e)}));t(" runLayout",(function(){!function(e,n){n(" makeSpaceForEdgeLabels",(function(){!function(e){var n=e.graph();n.ranksep/=2,Yh.forEach(e.edges(),(function(t){var r=e.edge(t);r.minlen*=2,"c"!==r.labelpos.toLowerCase()&&("TB"===n.rankdir||"BT"===n.rankdir?r.width+=r.labeloffset:r.height+=r.labeloffset)}))}(e)})),n(" removeSelfEdges",(function(){!function(e){Yh.forEach(e.edges(),(function(n){if(n.v===n.w){var t=e.node(n.v);t.selfEdges||(t.selfEdges=[]),t.selfEdges.push({e:n,label:e.edge(n)}),e.removeEdge(n)}}))}(e)})),n(" acyclic",(function(){Xh.run(e)})),n(" nestingGraph.run",(function(){qh.run(e)})),n(" rank",(function(){Fh(ev.asNonCompoundGraph(e))})),n(" injectEdgeLabelProxies",(function(){!function(e){Yh.forEach(e.edges(),(function(n){var t=e.edge(n);if(t.width&&t.height){var r=e.node(n.v),o={rank:(e.node(n.w).rank-r.rank)/2+r.rank,e:n};ev.addDummyNode(e,"edge-proxy",o,"_ep")}}))}(e)})),n(" removeEmptyRanks",(function(){Gh(e)})),n(" nestingGraph.cleanup",(function(){qh.cleanup(e)})),n(" normalizeRanks",(function(){Uh(e)})),n(" assignRankMinMax",(function(){!function(e){var n=0;Yh.forEach(e.nodes(),(function(t){var r=e.node(t);r.borderTop&&(r.minRank=e.node(r.borderTop).rank,r.maxRank=e.node(r.borderBottom).rank,n=Yh.max(n,r.maxRank))})),e.graph().maxRank=n}(e)})),n(" removeEdgeLabelProxies",(function(){!function(e){Yh.forEach(e.nodes(),(function(n){var t=e.node(n);"edge-proxy"===t.dummy&&(e.edge(t.e).labelRank=t.rank,e.removeNode(n))}))}(e)})),n(" normalize.run",(function(){Zh.run(e)})),n(" parentDummyChains",(function(){Wh(e)})),n(" addBorderSegments",(function(){$h(e)})),n(" order",(function(){Qh(e)})),n(" insertSelfEdges",(function(){!function(e){var n=ev.buildLayerMatrix(e);Yh.forEach(n,(function(n){var t=0;Yh.forEach(n,(function(n,r){var o=e.node(n);o.order=r+t,Yh.forEach(o.selfEdges,(function(n){ev.addDummyNode(e,"selfedge",{width:n.label.width,height:n.label.height,rank:o.rank,order:r+ ++t,e:n.e,label:n.label},"_se")})),delete o.selfEdges}))}))}(e)})),n(" adjustCoordinateSystem",(function(){Kh.adjust(e)})),n(" position",(function(){Jh(e)})),n(" positionSelfEdges",(function(){!function(e){Yh.forEach(e.nodes(),(function(n){var t=e.node(n);if("selfedge"===t.dummy){var r=e.node(t.e.v),o=r.x+r.width/2,i=r.y,a=t.x-o,u=r.height/2;e.setEdge(t.e,t.label),e.removeNode(n),t.label.points=[{x:o+2*a/3,y:i-u},{x:o+5*a/6,y:i-u},{x:o+a,y:i},{x:o+5*a/6,y:i+u},{x:o+2*a/3,y:i+u}],t.label.x=t.x,t.label.y=t.y}}))}(e)})),n(" removeBorderNodes",(function(){!function(e){Yh.forEach(e.nodes(),(function(n){if(e.children(n).length){var t=e.node(n),r=e.node(t.borderTop),o=e.node(t.borderBottom),i=e.node(Yh.last(t.borderLeft)),a=e.node(Yh.last(t.borderRight));t.width=Math.abs(a.x-i.x),t.height=Math.abs(o.y-r.y),t.x=i.x+t.width/2,t.y=r.y+t.height/2}})),Yh.forEach(e.nodes(),(function(n){"border"===e.node(n).dummy&&e.removeNode(n)}))}(e)})),n(" normalize.undo",(function(){Zh.undo(e)})),n(" fixupEdgeLabelCoords",(function(){!function(e){Yh.forEach(e.edges(),(function(n){var t=e.edge(n);if(Yh.has(t,"x"))switch("l"!==t.labelpos&&"r"!==t.labelpos||(t.width-=t.labeloffset),t.labelpos){case"l":t.x-=t.width/2+t.labeloffset;break;case"r":t.x+=t.width/2+t.labeloffset}}))}(e)})),n(" undoCoordinateSystem",(function(){Kh.undo(e)})),n(" translateGraph",(function(){!function(e){var n=Number.POSITIVE_INFINITY,t=0,r=Number.POSITIVE_INFINITY,o=0,i=e.graph(),a=i.marginx||0,u=i.marginy||0;function c(e){var i=e.x,a=e.y,u=e.width,c=e.height;n=Math.min(n,i-u/2),t=Math.max(t,i+u/2),r=Math.min(r,a-c/2),o=Math.max(o,a+c/2)}Yh.forEach(e.nodes(),(function(n){c(e.node(n))})),Yh.forEach(e.edges(),(function(n){var t=e.edge(n);Yh.has(t,"x")&&c(t)})),n-=a,r-=u,Yh.forEach(e.nodes(),(function(t){var o=e.node(t);o.x-=n,o.y-=r})),Yh.forEach(e.edges(),(function(t){var o=e.edge(t);Yh.forEach(o.points,(function(e){e.x-=n,e.y-=r})),Yh.has(o,"x")&&(o.x-=n),Yh.has(o,"y")&&(o.y-=r)})),i.width=t-n+a,i.height=o-r+u}(e)})),n(" assignNodeIntersects",(function(){!function(e){Yh.forEach(e.edges(),(function(n){var t,r,o=e.edge(n),i=e.node(n.v),a=e.node(n.w);o.points?(t=o.points[0],r=o.points[o.points.length-1]):(o.points=[],t=a,r=i),o.points.unshift(ev.intersectRect(i,t)),o.points.push(ev.intersectRect(a,r))}))}(e)})),n(" reversePoints",(function(){!function(e){Yh.forEach(e.edges(),(function(n){var t=e.edge(n);t.reversed&&t.points.reverse()}))}(e)})),n(" acyclic.undo",(function(){Xh.undo(e)}))}(n,t)})),t(" updateInputGraph",(function(){!function(e,n){Yh.forEach(e.nodes(),(function(t){var r=e.node(t),o=n.node(t);r&&(r.x=o.x,r.y=o.y,n.children(t).length&&(r.width=o.width,r.height=o.height))})),Yh.forEach(e.edges(),(function(t){var r=e.edge(t),o=n.edge(t);r.points=o.points,Yh.has(o,"x")&&(r.x=o.x,r.y=o.y)})),e.graph().width=n.graph().width,e.graph().height=n.graph().height}(e,n)}))}))},debug:pv,util:{time:pf.time,notime:pf.notime},version:"0.8.5"}),yv={error001:function(){return"[Ink Flow]: Seems like you have not used zustand provider as an ancestor."},error002:function(){return"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them."},error003:function(e){return'Node type "'.concat(e,'" not found. Using fallback type "default".')},error004:function(){return"The Ink Flow parent container needs a width and a height to render the graph."},error005:function(){return"Only child nodes can use a parent extent."},error006:function(){return"Can't create edge. An edge needs a source and a target."},error007:function(e){return"The old edge with id=".concat(e," does not exist.")},error009:function(e){return'Marker type "'.concat(e,"\" doesn't exist.")},error008:function(e,n){var t=n.id,r=n.sourceHandle,o=n.targetHandle;return"Couldn't create edge for ".concat(e,' handle id: "').concat(r?o:r,'", edge id: ').concat(t,".")},error010:function(){return"Handle: No node id found. Make sure to only use a Handle inside a custom Node."},error011:function(e){return'Edge type "'.concat(e,'" not found. Using fallback type "default".')},error012:function(e){return'Node with id "'.concat(e,'" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.')},error013:function(e){return void 0===e&&(e="react"),"It seems that you haven't loaded the styles. Please import '@aloudata/".concat(e,"/dist/style.css' or base.css to make sure everything is working properly.")}},mv=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],wv=["Enter"," ","Escape"],bv={min:.5,max:2},xv=[0,0],_v=function(e,n,t){if(!e.id)return[];var r=new Set;return t.forEach((function(n){n.source===e.id&&r.add(n.target)})),n.filter((function(e){return r.has(e.id)}))},Ev=function(e,n,t){if(!e.id)return[];var r=new Set;return t.forEach((function(n){n.target===e.id&&r.add(n.source)})),n.filter((function(e){return r.has(e.id)}))},Sv=function(e,n){void 0===n&&(n=[0,0]);var t=Xv(e),r=t.width,o=t.height,i="internals"in e?e.internals.positionAbsolute:e.position,a=e.origin||n,u=r*a[0],c=o*a[1];return{position:{x:e.position.x-u,y:e.position.y-c},positionAbsolute:{x:i.x-u,y:i.y-c}}},kv=function(e,n){if(void 0===n&&(n={nodeOrigin:[0,0]}),0===e.length)return{x:0,y:0,width:0,height:0};var t=e.reduce((function(e,t){var r=Lv(t,n.nodeOrigin);return Av(e,r)}),{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Tv(t)},Nv=function(e,n){if(void 0===n&&(n={nodeOrigin:[0,0]}),0===e.size)return{x:0,y:0,width:0,height:0};var t={x:1/0,y:1/0,x2:-1/0,y2:-1/0};return e.forEach((function(e){if(null==n.filter||n.filter(e)){var r=Lv(e,n.nodeOrigin);t=Av(t,r)}})),Tv(t)},Cv=function(e,n){var t=new Set;return e.forEach((function(e){t.add(e.id)})),n.filter((function(e){return t.has(e.source)||t.has(e.target)}))};function Mv(e){var n=e.nodeId,t=e.nextPosition,r=e.nodeLookup,o=e.nodeOrigin,i=void 0===o?[0,0]:o,a=e.nodeExtent,u=e.onError,c=r.get(n),l=c.parentId?r.get(c.parentId):void 0,s=l?Sv(l,l.origin||i).positionAbsolute:{x:0,y:0},d=s.x,f=s.y,h=function(e,n){var t,r,o,i;return n&&"parent"!==n?[n[0],[n[1][0]-(null!==(r=null===(t=e.measured)||void 0===t?void 0:t.width)&&void 0!==r?r:0),n[1][1]-(null!==(i=null===(o=e.measured)||void 0===o?void 0:o.height)&&void 0!==i?i:0)]]:n}(c,c.extent||a);if("parent"!==c.extent||c.expandParent)l&&Yv(c.extent)&&(h=[[c.extent[0][0]+d,c.extent[0][1]+f],[c.extent[1][0]+d,c.extent[1][1]+f]]);else if(l){var v=c.measured.width,p=c.measured.height,g=l.measured.width,y=l.measured.height;if(v&&p&&g&&y){var m=c.origin||i,w=d+v*m[0],b=f+p*m[1];h=[[w,b],[w+g-v,b+y-p]]}}else null==u||u("005",yv.error005());var x=Yv(h)?jv(t,h):t;return{position:{x:x.x-d,y:x.y-f},positionAbsolute:x}}var Ov=function(e,n,t){return void 0===n&&(n=0),void 0===t&&(t=1),Math.min(Math.max(e,n),t)},jv=function(e,n){return void 0===e&&(e={x:0,y:0}),{x:Ov(e.x,n[0][0],n[1][0]),y:Ov(e.y,n[0][1],n[1][1])}},Pv=function(e,n,t){return e<n?Ov(Math.abs(e-n),1,50)/50:e>t?-Ov(Math.abs(e-t),1,50)/50:0},Iv=function(e,n){return[20*Pv(e.x,35,n.width-35),20*Pv(e.y,35,n.height-35)]},Av=function(e,n){return{x:Math.min(e.x,n.x),y:Math.min(e.y,n.y),x2:Math.max(e.x2,n.x2),y2:Math.max(e.y2,n.y2)}},zv=function(e){var n=e.x,t=e.y;return{x:n,y:t,x2:n+e.width,y2:t+e.height}},Tv=function(e){var n=e.x,t=e.y;return{x:n,y:t,width:e.x2-n,height:e.y2-t}},Lv=function(e,n){var t,r,o,i,a,u;void 0===n&&(n=[0,0]);var c=Sv(e,n).positionAbsolute,l=c.x,s=c.y;return{x:l,y:s,x2:l+(null!==(o=null!==(r=null===(t=e.measured)||void 0===t?void 0:t.width)&&void 0!==r?r:e.width)&&void 0!==o?o:0),y2:s+(null!==(u=null!==(a=null===(i=e.measured)||void 0===i?void 0:i.height)&&void 0!==a?a:e.height)&&void 0!==u?u:0)}},Bv=function(e,n){return void 0===n&&(n=[1,1]),{x:n[0]*Math.round(e.x/n[0]),y:n[1]*Math.round(e.y/n[1])}},Dv=function(e,n,t,r){var o=e.x,i=e.y,a=U(n,3),u=a[0],c=a[1],l=a[2];void 0===t&&(t=!1),void 0===r&&(r=[1,1]);var s={x:(o-u)/l,y:(i-c)/l};return t?Bv(s,r):s},Rv=function(e,n){var t=e.x,r=e.y,o=U(n,3),i=o[0],a=o[1],u=o[2];return{x:t*u+i,y:r*u+a}},Hv=function(e,n,t,r,o,i){var a=n/(e.width*(1+i)),u=t/(e.height*(1+i)),c=Math.min(a,u),l=Ov(c,r,o);return{x:n/2-(e.x+e.width/2)*l,y:t/2-(e.y+e.height/2)*l,zoom:l}},Vv=function(){var e;return"undefined"!=typeof navigator&&(null===(e=null===navigator||void 0===navigator?void 0:navigator.userAgent)||void 0===e?void 0:e.indexOf("Mac"))>=0};function Yv(e){return void 0!==e&&"parent"!==e}function Xv(e){var n,t,r,o,i,a,u,c;return{width:null!==(o=null!==(r=null!==(t=null===(n=e.measured)||void 0===n?void 0:n.width)&&void 0!==t?t:e.width)&&void 0!==r?r:e.initialWidth)&&void 0!==o?o:0,height:null!==(c=null!==(u=null!==(a=null===(i=e.measured)||void 0===i?void 0:i.height)&&void 0!==a?a:e.height)&&void 0!==u?u:e.initialHeight)&&void 0!==c?c:0}}var Zv={x:0,y:0};function Fv(e,n){var t=n.snapGrid,r=void 0===t?[0,0]:t,o=n.snapToGrid,i=void 0!==o&&o,a=n.transform,u=Qv(e),c=u.x,l=u.y,s=Dv({x:c,y:l},a),d=i?Bv(s,r):s,f=d.x,h=d.y;return Z({xSnapped:f,ySnapped:h},s)}var Uv,Wv,Gv,qv,$v,Kv,Qv=function(e,n){var t,r,o,i,a=function(e){return"clientX"in e}(e),u=a?e.clientX:null===(t=e.touches)||void 0===t?void 0:t[0].clientX,c=a?e.clientY:null===(r=e.touches)||void 0===r?void 0:r[0].clientY;return{x:u-(null!==(o=null==n?void 0:n.left)&&void 0!==o?o:0),y:c-(null!==(i=null==n?void 0:n.top)&&void 0!==i?i:0)}};function Jv(e){var n=e.sourceX,t=e.sourceY,r=e.targetX,o=e.targetY,i=e.sourceControlX,a=e.sourceControlY,u=.125*n+.375*i+.375*e.targetControlX+.125*r,c=.125*t+.375*a+.375*e.targetControlY+.125*o;return[u,c,Math.abs(u-n),Math.abs(c-t)]}function ep(e,n){return e>=0?.5*e:25*n*Math.sqrt(-e)}function np(e){var n=e.pos,t=e.x1,r=e.y1,o=e.x2,i=e.y2,a=e.c;switch(n){case Kv.Left:return[t-ep(t-o,a),r];case Kv.Right:return[t+ep(o-t,a),r];case Kv.Top:return[t,r-ep(r-i,a)];case Kv.Bottom:return[t,r+ep(i-r,a)]}}function tp(e){var n=e.sourceX,t=e.sourceY,r=e.sourcePosition,o=void 0===r?Kv.Bottom:r,i=e.targetX,a=e.targetY,u=e.targetPosition,c=void 0===u?Kv.Top:u,l=e.curvature,s=void 0===l?.25:l,d=U(np({pos:o,x1:n,y1:t,x2:i,y2:a,c:s}),2),f=d[0],h=d[1],v=U(np({pos:c,x1:i,y1:a,x2:n,y2:t,c:s}),2),p=v[0],g=v[1],y=U(Jv({sourceX:n,sourceY:t,targetX:i,targetY:a,sourceControlX:f,sourceControlY:h,targetControlX:p,targetControlY:g}),4),m=y[0],w=y[1],b=y[2],x=y[3];return["M".concat(n,",").concat(t," C").concat(f,",").concat(h," ").concat(p,",").concat(g," ").concat(i,",").concat(a),m,w,b,x]}function rp(e){var n=e.sourceX,t=e.sourceY,r=e.targetX,o=e.targetY,i=Math.abs(r-n)/2,a=r<n?r+i:r-i,u=Math.abs(o-t)/2;return[a,o<t?o+u:o-u,i,u]}!function(e){e.Strict="strict",e.Loose="loose"}(Uv||(Uv={})),function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"}(Wv||(Wv={})),function(e){e.Partial="partial",e.Full="full"}(Gv||(Gv={})),function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"}(qv||(qv={})),function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"}($v||($v={})),function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"}(Kv||(Kv={}));var op,ip=function(e){var n=e.source,t=e.sourceHandle,r=e.target,o=e.targetHandle;return"xy-edge__".concat(n).concat(t||"","-").concat(r).concat(o||"")},ap=function(e,n){return e.source&&e.target?function(e,n){return n.some((function(n){return!(n.source!==e.source||n.target!==e.target||n.sourceHandle!==e.sourceHandle&&(n.sourceHandle||e.sourceHandle)||n.targetHandle!==e.targetHandle&&(n.targetHandle||e.targetHandle))}))}(t=function(e){return"id"in e&&"source"in e&&"target"in e}(e)?Z({},e):Z(Z({},e),{id:ip(e)}),n)?n:(null===t.sourceHandle&&delete t.sourceHandle,null===t.targetHandle&&delete t.targetHandle,n.concat(t)):n;var t},up=function(e,n,t,r){void 0===r&&(r={shouldReplaceId:!0});var o=e.id,i=function(e,n){var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&n.indexOf(r)<0&&(t[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)n.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(t[r[o]]=e[r[o]])}return t}(e,["id"]);if(!n.source||!n.target)return t;if(!t.find((function(n){return n.id===e.id})))return t;var a=Z(Z({},i),{id:r.shouldReplaceId?ip(n):o,source:n.source,target:n.target,sourceHandle:n.sourceHandle,targetHandle:n.targetHandle});return t.filter((function(e){return e.id!==o})).concat(a)};function cp(e){var n=e.sourceX,t=e.sourceY,r=e.targetX,o=e.targetY,i=U(rp({sourceX:n,sourceY:t,targetX:r,targetY:o}),4),a=i[0],u=i[1],c=i[2],l=i[3];return["M ".concat(n,",").concat(t,"L ").concat(r,",").concat(o),a,u,c,l]}var lp=((op={})[Kv.Left]={x:-1,y:0},op[Kv.Right]={x:1,y:0},op[Kv.Top]={x:0,y:-1},op[Kv.Bottom]={x:0,y:1},op),sp=function(e,n){return Math.sqrt(Math.pow(n.x-e.x,2)+Math.pow(n.y-e.y,2))};function dp(e){var n=e.sourceX,t=e.sourceY,r=e.sourcePosition,o=void 0===r?Kv.Bottom:r,i=e.targetX,a=e.targetY,u=e.targetPosition,c=void 0===u?Kv.Top:u,l=e.borderRadius,s=void 0===l?5:l,d=e.centerX,f=e.centerY,h=e.offset,v=U(function(e){var n,t,r,o,i=e.source,a=e.sourcePosition,u=void 0===a?Kv.Bottom:a,c=e.target,l=e.targetPosition,s=void 0===l?Kv.Top:l,d=e.center,f=e.offset,h=lp[u],v=lp[s],p={x:i.x+h.x*f,y:i.y+h.y*f},g={x:c.x+v.x*f,y:c.y+v.y*f},y=function(e){var n=e.source,t=e.sourcePosition,r=void 0===t?Kv.Bottom:t,o=e.target;return r===Kv.Left||r===Kv.Right?n.x<o.x?{x:1,y:0}:{x:-1,y:0}:n.y<o.y?{x:0,y:1}:{x:0,y:-1}}({source:p,sourcePosition:u,target:g}),m=0!==y.x?"x":"y",w=y[m],b=[],x={x:0,y:0},_={x:0,y:0},E=U(rp({sourceX:i.x,sourceY:i.y,targetX:c.x,targetY:c.y}),4),S=E[0],k=E[1],N=E[2],C=E[3];if(h[m]*v[m]==-1){r=null!==(n=d.x)&&void 0!==n?n:S,o=null!==(t=d.y)&&void 0!==t?t:k;var M=[{x:r,y:p.y},{x:r,y:g.y}],O=[{x:p.x,y:o},{x:g.x,y:o}];b=h[m]===w?"x"===m?M:O:"x"===m?O:M}else{var j=[{x:p.x,y:g.y}],P=[{x:g.x,y:p.y}];if(b="x"===m?h.x===w?P:j:h.y===w?j:P,u===s){var I=Math.abs(i[m]-c[m]);if(I<=f){var A=Math.min(f-1,f-I);h[m]===w?x[m]=(p[m]>i[m]?-1:1)*A:_[m]=(g[m]>c[m]?-1:1)*A}}if(u!==s){var z="x"===m?"y":"x",T=h[m]===v[z],L=p[z]>g[z],B=p[z]<g[z];(1===h[m]&&(!T&&L||T&&B)||1!==h[m]&&(!T&&B||T&&L))&&(b="x"===m?j:P)}var D={x:p.x+x.x,y:p.y+x.y},R={x:g.x+_.x,y:g.y+_.y};Math.max(Math.abs(D.x-b[0].x),Math.abs(R.x-b[0].x))>=Math.max(Math.abs(D.y-b[0].y),Math.abs(R.y-b[0].y))?(r=(D.x+R.x)/2,o=b[0].y):(r=b[0].x,o=(D.y+R.y)/2)}return[W(W([i,{x:p.x+x.x,y:p.y+x.y}],U(b),!1),[{x:g.x+_.x,y:g.y+_.y},c],!1),r,o,N,C]}({source:{x:n,y:t},sourcePosition:o,target:{x:i,y:a},targetPosition:c,center:{x:d,y:f},offset:void 0===h?20:h}),5),p=v[0],g=v[1],y=v[2],m=v[3],w=v[4],b=p.reduce((function(e,n,t){var r;return r=t>0&&t<p.length-1?function(e,n,t,r){var o=Math.min(sp(e,n)/2,sp(n,t)/2,r),i=n.x,a=n.y;if(e.x===i&&i===t.x||e.y===a&&a===t.y)return"L".concat(i," ").concat(a);if(e.y===a){var u=e.x<t.x?-1:1,c=e.y<t.y?1:-1;return"L ".concat(i+o*u,",").concat(a,"Q ").concat(i,",").concat(a," ").concat(i,",").concat(a+o*c)}var l=e.x<t.x?1:-1,s=e.y<t.y?-1:1;return"L ".concat(i,",").concat(a+o*s,"Q ").concat(i,",").concat(a," ").concat(i+o*l,",").concat(a)}(p[t-1],n,p[t+1],s):"".concat(0===t?"M":"L").concat(n.x," ").concat(n.y),e+r}),"");return[b,g,y,m,w]}function fp(e,n,t){var r=(null==t?void 0:t.rankdir)||"TB",o=new gv.graphlib.Graph;o.setDefaultEdgeLabel((function(){return{}})),o.setGraph(Z({rankdir:r},t));var i=e.map((function(e){return Z({},e)}));i.forEach((function(e){var n,t;if(!e.id)throw new Error('Node "id" does not exist');var r=(null===(n=e.data)||void 0===n?void 0:n.width)||200,i=(null===(t=e.data)||void 0===t?void 0:t.height)||56;o.setNode(e.id,{width:r,height:i})})),n.forEach((function(e){o.setEdge(e.source,e.target)})),gv.layout(o),i.forEach((function(e){var n=o.node(e.id),t="bottom",i="top";switch(r){case"TB":default:t="bottom",i="top";break;case"BT":t="top",i="bottom";break;case"LR":case"RL":t="right",i="left"}e.targetPosition=i,e.sourcePosition=t,e.position={x:n.x-n.width/2,y:n.y-n.height/2}}));var a=function(e){var n=e.centerNodeId,t=e.containerHeight,r=void 0===t?0:t,o=e.containerWidth,i=void 0===o?0:o,a=e.centerByBBox,u=e.nodes,c=e.nodeOrigin,l=void 0===c?xv:c;if(!n&&!a||!r||!i)return Zv;if(null==n?void 0:n.trim()){var s=null==u?void 0:u.find((function(e){return e.id===(null==n?void 0:n.trim())}));if(s){var d=function(e,n){if(!e)return Zv;var t=Xv(e),r=t.width,o=t.height,i=r*n[0],a=o*n[1];return{x:e.position.x+r/2-i,y:e.position.y+o/2-a}}(s,l);return{x:i/2-d.x,y:r/2-d.y}}}return a?(d=function(e,n){if(!(null==e?void 0:e.length))return Zv;var t=kv(e,{nodeOrigin:n}),r=t.x,o=t.y;return{x:r+t.width/2,y:o+t.height/2}}(u,l),{x:i/2-d.x,y:r/2-d.y}):Zv}({centerByBBox:null==t?void 0:t.centerByBBox,centerNodeId:null==t?void 0:t.centerNodeId,nodes:i,containerWidth:null==t?void 0:t.width,containerHeight:null==t?void 0:t.height,nodeOrigin:null==t?void 0:t.nodeOrigin}),u=a.x,c=void 0===u?0:u,l=a.y,s=void 0===l?0:l;i.forEach((function(e){e.position={x:e.position.x+c,y:e.position.y+s}}));var d={overflowBoundary:!1,transform:{x:0,y:0,zoom:1}};return(null==t?void 0:t.width)&&(null==t?void 0:t.height)&&t.fitViewOptions&&(d=function(e,n){var t=n||{},r=t.minZoom,o=void 0===r?bv.min:r,i=t.maxZoom,a=void 0===i?bv.max:i,u=t.padding,c=void 0===u?.1:u,l=t.nodeOrigin,s=void 0===l?xv:l,d=t.width,f=t.height,h=kv(e||[],{nodeOrigin:s}),v=h.width>=d||h.height>=f;return{transform:Hv(h,d,f,o,a,c),overflowBoundary:v}}(i,Z({width:t.width,height:t.height,nodeOrigin:t.nodeOrigin},t.fitViewOptions))),{nodes:i,edges:n,transform:d.transform,overflowBoundary:d.overflowBoundary}}var hp=function(e){return null!==e&&"function"!=typeof e&&isFinite(e.length)},vp=function(e,n){return!!hp(e)&&e.indexOf(n)>-1},pp=function(e,n){if(!hp(e))return e;for(var t=[],r=0;r<e.length;r++){var o=e[r];n(o,r)&&t.push(o)}return t},gp={}.toString,yp=function(e,n){return gp.call(e)==="[object "+n+"]"},mp=function(e){return yp(e,"Function")},wp=function(e){return null==e},bp=function(e){return Array.isArray?Array.isArray(e):yp(e,"Array")},xp=function(e){var n=typeof e;return null!==e&&"object"===n||"function"===n};function _p(e,n){if(e)if(bp(e))for(var t=0,r=e.length;t<r&&!1!==n(e[t],t);t++);else if(xp(e))for(var o in e)if(e.hasOwnProperty(o)&&!1===n(e[o],o))break}var Ep=Object.keys?function(e){return Object.keys(e)}:function(e){var n=[];return _p(e,(function(t,r){mp(e)&&"prototype"===r||n.push(r)})),n};function Sp(e,n){var t=Ep(n),r=t.length;if(wp(e))return!r;for(var o=0;o<r;o+=1){var i=t[o];if(n[i]!==e[i]||!(i in e))return!1}return!0}var kp=function(e){return"object"==typeof e&&null!==e},Np=function(e){if(!kp(e)||!yp(e,"Object"))return!1;if(null===Object.getPrototypeOf(e))return!0;for(var n=e;null!==Object.getPrototypeOf(n);)n=Object.getPrototypeOf(n);return Object.getPrototypeOf(e)===n},Cp=function(e,n){if(void 0===n&&(n=[]),bp(e))for(var t=0;t<e.length;t+=1)Cp(e[t],n);else n.push(e);return n},Mp=function(e){if(bp(e))return e.reduce((function(e,n){return Math.max(e,n)}),e[0])},Op=function(e){if(bp(e))return e.reduce((function(e,n){return Math.min(e,n)}),e[0])},jp=Array.prototype,Pp=jp.splice,Ip=jp.indexOf,Ap=Array.prototype.splice,zp=function(e,n){if(!hp(e))return[];for(var t=e?n.length:0,r=t-1;t--;){var o=void 0,i=n[t];t!==r&&i===o||(o=i,Ap.call(e,i,1))}return e},Tp=function(e,n,t){if(!bp(e)&&!Np(e))return e;var r=t;return _p(e,(function(e,t){r=n(r,e,t)})),r},Lp=function(e){return yp(e,"String")};function Bp(e,n){void 0===n&&(n=new Map);var t=[];if(Array.isArray(e))for(var r=0,o=e.length;r<o;r++){var i=e[r];n.has(i)||(t.push(i),n.set(i,!0))}return t}var Dp=Object.prototype.hasOwnProperty;function Rp(e,n){if(!n||!bp(e))return{};for(var t,r={},o=mp(n)?n:function(e){return e[n]},i=0;i<e.length;i++){var a=e[i];t=o(a),Dp.call(r,t)?r[t].push(a):r[t]=[a]}return r}function Hp(e,n){if(!n)return{0:e};if(!mp(n)){var t=bp(n)?n:n.replace(/\s+/g,"").split("*");n=function(e){for(var n="_",r=0,o=t.length;r<o;r++)n+=e[t[r]]&&e[t[r]].toString();return n}}return Rp(e,n)}var Vp={},Yp=function(e){return yp(e,"Number")},Xp=Number.isInteger?Number.isInteger:function(e){return Yp(e)&&e%1==0},Zp=180/Math.PI,Fp=parseInt,Up=Math.PI/180,Wp=function(e,n){return e.hasOwnProperty(n)},Gp=Object.values?function(e){return Object.values(e)}:function(e){var n=[];return _p(e,(function(t,r){mp(e)&&"prototype"===r||n.push(t)})),n},qp=function(e){return wp(e)?"":e.toString()},$p={}.toString,Kp=function(e){return $p.call(e).replace(/^\[object /,"").replace(/]$/,"")},Qp=Object.prototype,Jp=function(e){var n=e&&e.constructor;return e===("function"==typeof n&&n.prototype||Qp)};function eg(e,n){for(var t in n)n.hasOwnProperty(t)&&"constructor"!==t&&void 0!==n[t]&&(e[t]=n[t])}function ng(e,n,t,r){return n&&eg(e,n),t&&eg(e,t),r&&eg(e,r),e}var tg=function(e){if("object"!=typeof e||null===e)return e;var n;if(bp(e)){n=[];for(var t=0,r=e.length;t<r;t++)"object"==typeof e[t]&&null!=e[t]?n[t]=tg(e[t]):n[t]=e[t]}else for(var o in n={},e)"object"==typeof e[o]&&null!=e[o]?n[o]=tg(e[o]):n[o]=e[o];return n},rg=function(e,n){if(!mp(e))throw new TypeError("Expected a function");var t=function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];var i=n?n.apply(this,r):r[0],a=t.cache;if(a.has(i))return a.get(i);var u=e.apply(this,r);return a.set(i,u),u};return t.cache=new Map,t};function og(e,n,t,r){for(var o in t=t||0,r=r||5,n)if(n.hasOwnProperty(o)){var i=n[o];null!==i&&Np(i)?(Np(e[o])||(e[o]={}),t<r?og(e[o],i,t+1,r):e[o]=n[o]):bp(i)?(e[o]=[],e[o]=e[o].concat(i)):void 0!==i&&(e[o]=i)}}var ig,ag=Object.prototype.hasOwnProperty,ug=function(e,n){if(e===n)return!0;if(!e||!n)return!1;if(Lp(e)||Lp(n))return!1;if(hp(e)||hp(n)){if(e.length!==n.length)return!1;for(var t=!0,r=0;r<e.length&&(t=ug(e[r],n[r]));r++);return t}if(kp(e)||kp(n)){var o=Object.keys(e),i=Object.keys(n);if(o.length!==i.length)return!1;for(t=!0,r=0;r<o.length&&(t=ug(e[o[r]],n[o[r]]));r++);return t}return!1},cg=function(e){return e},lg=Object.prototype.hasOwnProperty,sg={},dg=rg((function(e,n){void 0===n&&(n={});var t=n.fontSize,r=n.fontFamily,o=n.fontWeight,i=n.fontStyle,a=n.fontVariant;return ig||(ig=document.createElement("canvas").getContext("2d")),ig.font=[i,a,o,t+"px",r].join(" "),ig.measureText(Lp(e)?e:"").width}),(function(e,n){return void 0===n&&(n={}),function(){for(var e=0,n=0,t=arguments.length;n<t;n++)e+=arguments[n].length;var r=Array(e),o=0;for(n=0;n<t;n++)for(var i=arguments[n],a=0,u=i.length;a<u;a++,o++)r[o]=i[a];return r}([e],Gp(n)).join("")})),fg=function(){function e(){this.map={}}return e.prototype.has=function(e){return void 0!==this.map[e]},e.prototype.get=function(e,n){var t=this.map[e];return void 0===t?n:t},e.prototype.set=function(e,n){this.map[e]=n},e.prototype.clear=function(){this.map={}},e.prototype.delete=function(e){delete this.map[e]},e.prototype.size=function(){return Object.keys(this.map).length},e}(),hg=Object.freeze({__proto__:null,Cache:fg,assign:ng,augment:function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];for(var t=e[0],r=1;r<e.length;r++){var o=e[r];mp(o)&&(o=o.prototype),ng(t.prototype,o)}},clamp:function(e,n,t){return e<n?n:e>t?t:e},clearAnimationFrame:function(e){(window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.msCancelAnimationFrame||clearTimeout)(e)},clone:tg,contains:vp,debounce:function(e,n,t){var r;return function(){var o=this,i=arguments,a=t&&!r;clearTimeout(r),r=setTimeout((function(){r=null,t||e.apply(o,i)}),n),a&&e.apply(o,i)}},deepMix:function(e){for(var n=[],t=1;t<arguments.length;t++)n[t-1]=arguments[t];for(var r=0;r<n.length;r+=1)og(e,n[r]);return e},difference:function(e,n){return void 0===n&&(n=[]),pp(e,(function(e){return!vp(n,e)}))},each:_p,endsWith:function(e,n){return!(!bp(e)&&!Lp(e))&&e[e.length-1]===n},every:function(e,n){for(var t=0;t<e.length;t++)if(!n(e[t],t))return!1;return!0},extend:function(e,n,t,r){mp(n)||(t=n,n=e,e=function(){});var o=Object.create?function(e,n){return Object.create(e,{constructor:{value:n}})}:function(e,n){function t(){}t.prototype=e;var r=new t;return r.constructor=n,r},i=o(n.prototype,e);return e.prototype=ng(i,e.prototype),e.superclass=o(n.prototype,n),ng(i,t),ng(e,r),e},filter:pp,find:function(e,n){if(!bp(e))return null;var t;if(mp(n)&&(t=n),Np(n)&&(t=function(e){return Sp(e,n)}),t)for(var r=0;r<e.length;r+=1)if(t(e[r]))return e[r];return null},findIndex:function(e,n,t){void 0===t&&(t=0);for(var r=t;r<e.length;r++)if(n(e[r],r))return r;return-1},firstValue:function(e,n){for(var t=null,r=0;r<e.length;r++){var o=e[r][n];if(!wp(o)){t=bp(o)?o[0]:o;break}}return t},fixedBase:function(e,n){var t=n.toString(),r=t.indexOf(".");if(-1===r)return Math.round(e);var o=t.substr(r+1).length;return o>20&&(o=20),parseFloat(e.toFixed(o))},flatten:function(e){if(!bp(e))return[];for(var n=[],t=0;t<e.length;t++)n=n.concat(e[t]);return n},flattenDeep:Cp,forIn:_p,get:function(e,n,t){for(var r=0,o=Lp(n)?n.split("."):n;e&&r<o.length;)e=e[o[r++]];return void 0===e||r<o.length?t:e},getEllipsisText:function(e,n,t,r){void 0===r&&(r="...");var o,i,a=dg(r,t),u=Lp(e)?e:qp(e),c=n,l=[];if(dg(e,t)<=n)return e;for(;o=u.substr(0,16),!((i=dg(o,t))+a>c&&i>c);)if(l.push(o),c-=i,!(u=u.substr(16)))return l.join("");for(;o=u.substr(0,1),!((i=dg(o,t))+a>c);)if(l.push(o),c-=i,!(u=u.substr(1)))return l.join("");return""+l.join("")+r},getRange:function(e){var n=e.filter((function(e){return!isNaN(e)}));if(!n.length)return{min:0,max:0};if(bp(e[0])){for(var t=[],r=0;r<e.length;r++)t=t.concat(e[r]);n=t}var o=Mp(n);return{min:Op(n),max:o}},getType:Kp,getWrapBehavior:function(e,n){return e["_wrap_"+n]},group:function(e,n){if(!n)return[e];var t=Hp(e,n),r=[];for(var o in t)r.push(t[o]);return r},groupBy:Rp,groupToMap:Hp,has:Wp,hasKey:Wp,hasValue:function(e,n){return vp(Gp(e),n)},head:function(e){if(hp(e))return e[0]},identity:function(e){return e},includes:vp,indexOf:function(e,n){if(!hp(e))return-1;var t=Array.prototype.indexOf;if(t)return t.call(e,n);for(var r=-1,o=0;o<e.length;o++)if(e[o]===n){r=o;break}return r},isArguments:function(e){return yp(e,"Arguments")},isArray:bp,isArrayLike:hp,isBoolean:function(e){return yp(e,"Boolean")},isDate:function(e){return yp(e,"Date")},isDecimal:function(e){return Yp(e)&&e%1!=0},isElement:function(e){return e instanceof Element||e instanceof HTMLDocument},isEmpty:function(e){if(wp(e))return!0;if(hp(e))return!e.length;var n=Kp(e);if("Map"===n||"Set"===n)return!e.size;if(Jp(e))return!Object.keys(e).length;for(var t in e)if(ag.call(e,t))return!1;return!0},isEqual:ug,isEqualWith:function(e,n,t){return mp(t)?!!t(e,n):ug(e,n)},isError:function(e){return yp(e,"Error")},isEven:function(e){return Yp(e)&&e%2==0},isFinite:function(e){return Yp(e)&&isFinite(e)},isFunction:mp,isInteger:Xp,isMatch:Sp,isNegative:function(e){return Yp(e)&&e<0},isNil:wp,isNull:function(e){return null===e},isNumber:Yp,isNumberEqual:function(e,n,t){return void 0===t&&(t=1e-5),Math.abs(e-n)<t},isObject:xp,isObjectLike:kp,isOdd:function(e){return Yp(e)&&e%2!=0},isPlainObject:Np,isPositive:function(e){return Yp(e)&&e>0},isPrototype:Jp,isRegExp:function(e){return yp(e,"RegExp")},isString:Lp,isType:yp,isUndefined:function(e){return void 0===e},keys:Ep,last:function(e){if(hp(e))return e[e.length-1]},lowerCase:function(e){return qp(e).toLowerCase()},lowerFirst:function(e){var n=qp(e);return n.charAt(0).toLowerCase()+n.substring(1)},map:function(e,n){if(!hp(e))return e;for(var t=[],r=0;r<e.length;r++){var o=e[r];t.push(n(o,r))}return t},mapValues:function(e,n){void 0===n&&(n=cg);var t={};return xp(e)&&!wp(e)&&Object.keys(e).forEach((function(r){t[r]=n(e[r],r)})),t},max:Mp,maxBy:function(e,n){if(bp(e)){for(var t,r=-1/0,o=0;o<e.length;o++){var i=e[o],a=mp(n)?n(i):i[n];a>r&&(t=i,r=a)}return t}},measureTextWidth:dg,memoize:rg,min:Op,minBy:function(e,n){if(bp(e)){for(var t,r=1/0,o=0;o<e.length;o++){var i=e[o],a=mp(n)?n(i):i[n];a<r&&(t=i,r=a)}return t}},mix:ng,mod:function(e,n){return(e%n+n)%n},noop:function(){},number2color:function(e){var n=Vp[e];if(!n){for(var t=e.toString(16),r=t.length;r<6;r++)t="0"+t;n="#"+t,Vp[e]=n}return n},omit:function(e,n){return Tp(e,(function(e,t,r){return n.includes(r)||(e[r]=t),e}),{})},parseRadius:function(e){var n=0,t=0,r=0,o=0;return bp(e)?1===e.length?n=t=r=o=e[0]:2===e.length?(n=r=e[0],t=o=e[1]):3===e.length?(n=e[0],t=o=e[1],r=e[2]):(n=e[0],t=e[1],r=e[2],o=e[3]):n=t=r=o=e,{r1:n,r2:t,r3:r,r4:o}},pick:function(e,n){if(null===e||!Np(e))return{};var t={};return _p(n,(function(n){lg.call(e,n)&&(t[n]=e[n])})),t},pull:function(e){for(var n=[],t=1;t<arguments.length;t++)n[t-1]=arguments[t];for(var r=0;r<n.length;r++)for(var o=n[r],i=-1;(i=Ip.call(e,o))>-1;)Pp.call(e,i,1);return e},pullAt:zp,reduce:Tp,remove:function(e,n){var t=[];if(!hp(e))return t;for(var r=-1,o=[],i=e.length;++r<i;){var a=e[r];n(a,r,e)&&(t.push(a),o.push(r))}return zp(e,o),t},requestAnimationFrame:function(e){return(window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.msRequestAnimationFrame||function(e){return setTimeout(e,16)})(e)},set:function(e,n,t){var r=e,o=Lp(n)?n.split("."):n;return o.forEach((function(e,n){n<o.length-1?(xp(r[e])||(r[e]=Yp(o[n+1])?[]:{}),r=r[e]):r[e]=t})),e},size:function(e){return wp(e)?0:hp(e)?e.length:Object.keys(e).length},some:function(e,n){for(var t=0;t<e.length;t++)if(n(e[t],t))return!0;return!1},sortBy:function(e,n){var t;if(mp(n))t=function(e,t){return n(e)-n(t)};else{var r=[];Lp(n)?r.push(n):bp(n)&&(r=n),t=function(e,n){for(var t=0;t<r.length;t+=1){var o=r[t];if(e[o]>n[o])return 1;if(e[o]<n[o])return-1}return 0}}return e.sort(t),e},startsWith:function(e,n){return!(!bp(e)&&!Lp(e))&&e[0]===n},substitute:function(e,n){return e&&n?e.replace(/\\?\{([^{}]+)\}/g,(function(e,t){return"\\"===e.charAt(0)?e.slice(1):void 0===n[t]?"":n[t]})):e},throttle:function(e,n,t){var r,o,i,a,u=0;t||(t={});var c=function(){u=!1===t.leading?0:Date.now(),r=null,a=e.apply(o,i),r||(o=i=null)},l=function(){var l=Date.now();u||!1!==t.leading||(u=l);var s=n-(l-u);return o=this,i=arguments,s<=0||s>n?(r&&(clearTimeout(r),r=null),u=l,a=e.apply(o,i),r||(o=i=null)):r||!1===t.trailing||(r=setTimeout(c,s)),a};return l.cancel=function(){clearTimeout(r),u=0,r=o=i=null},l},toArray:function(e){return hp(e)?Array.prototype.slice.call(e):[]},toDegree:function(e){return Zp*e},toInteger:Fp,toRadian:function(e){return Up*e},toString:qp,union:function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return Bp([].concat.apply([],e))},uniq:Bp,uniqueId:function(e){return sg[e=e||"g"]?sg[e]+=1:sg[e]=1,e+sg[e]},upperCase:function(e){return qp(e).toUpperCase()},upperFirst:function(e){var n=qp(e);return n.charAt(0).toUpperCase()+n.substring(1)},values:Gp,valuesOfKey:function(e,n){for(var t=[],r={},o=0;o<e.length;o++){var i=e[o][n];if(!wp(i)){bp(i)||(i=[i]);for(var a=0;a<i.length;a++){var u=i[a];r[u]||(t.push(u),r[u]=!0)}}}return t},wrapBehavior:function(e,n){if(e["_wrap_"+n])return e["_wrap_"+n];var t=function(t){e[n](t)};return e["_wrap_"+n]=t,t}}),vg={assign:function(e){if(e.__esModule)return e;var n=e.default;if("function"==typeof n){var t=function e(){return this instanceof e?Reflect.construct(n,arguments,this.constructor):n.apply(this,arguments)};t.prototype=n.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(e).forEach((function(n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})})),t}(hg).mix,getHeight:function(e,n,t,r){return void 0===r&&(r="height"),"center"===t?(e[r]+n[r])/2:e.height}},pg=vg,gg={getId:function(e){return e.id||e.name},getPreH:function(e){return e.preH||0},getPreV:function(e){return e.preV||0},getHGap:function(e){return e.hgap||18},getVGap:function(e){return e.vgap||18},getChildren:function(e){return e.children},getHeight:function(e){return e.height||36},getWidth:function(e){var n=e.label||" ";return e.width||18*n.split("").length}};function yg(e,n){var t=this;if(t.vgap=t.hgap=0,e instanceof yg)return e;t.data=e;var r=n.getHGap(e),o=n.getVGap(e);return t.preH=n.getPreH(e),t.preV=n.getPreV(e),t.width=n.getWidth(e),t.height=n.getHeight(e),t.width+=t.preH,t.height+=t.preV,t.id=n.getId(e),t.x=t.y=0,t.depth=0,t.children||(t.children=[]),t.addGap(r,o),t}pg.assign(yg.prototype,{isRoot:function(){return 0===this.depth},isLeaf:function(){return 0===this.children.length},addGap:function(e,n){var t=this;t.hgap+=e,t.vgap+=n,t.width+=2*e,t.height+=2*n},eachNode:function(e){for(var n,t=[this];n=t.shift();)e(n),t=n.children.concat(t)},DFTraverse:function(e){this.eachNode(e)},BFTraverse:function(e){for(var n,t=[this];n=t.shift();)e(n),t=t.concat(n.children)},getBoundingBox:function(){var e={left:Number.MAX_VALUE,top:Number.MAX_VALUE,width:0,height:0};return this.eachNode((function(n){e.left=Math.min(e.left,n.x),e.top=Math.min(e.top,n.y),e.width=Math.max(e.width,n.x+n.width),e.height=Math.max(e.height,n.y+n.height)})),e},translate:function(e,n){void 0===e&&(e=0),void 0===n&&(n=0),this.eachNode((function(t){t.x+=e,t.y+=n,t.x+=t.preH,t.y+=t.preV}))},right2left:function(){var e=this,n=e.getBoundingBox();e.eachNode((function(e){e.x=e.x-2*(e.x-n.left)-e.width})),e.translate(n.width,0)},bottom2top:function(){var e=this,n=e.getBoundingBox();e.eachNode((function(e){e.y=e.y-2*(e.y-n.top)-e.height})),e.translate(0,n.height)}});var mg=function(e,n,t){void 0===n&&(n={});var r,o=new yg(e,n=pg.assign({},gg,n)),i=[o];if(!t&&!e.collapsed)for(;r=i.shift();)if(!r.data.collapsed){var a=n.getChildren(r.data),u=a?a.length:0;if(r.children=new Array(u),a&&u)for(var c=0;c<u;c++){var l=new yg(a[c],n);r.children[c]=l,i.push(l),l.parent=r,l.depth=r.depth+1}}return o},wg=mg,bg=function(){function e(e,n){void 0===n&&(n={}),this.options=n,this.rootNode=wg(e,n)}return e.prototype.execute=function(){throw new Error("please override this method")},e}(),xg=bg;function _g(e,n,t,r){void 0===r&&(r=[]);var o=this;o.w=e||0,o.h=n||0,o.y=t||0,o.x=0,o.c=r||[],o.cs=r.length,o.prelim=0,o.mod=0,o.shift=0,o.change=0,o.tl=null,o.tr=null,o.el=null,o.er=null,o.msel=0,o.mser=0}function Eg(e,n,t){t?e.y+=n:e.x+=n,e.children.forEach((function(e){Eg(e,n,t)}))}function Sg(e,n){var t=n?e.y:e.x;return e.children.forEach((function(e){t=Math.min(Sg(e,n),t)})),t}function kg(e,n){Eg(e,-Sg(e,n),n)}function Ng(e,n,t){t?n.y=e.x:n.x=e.x,e.c.forEach((function(e,r){Ng(e,n.children[r],t)}))}function Cg(e,n,t){void 0===t&&(t=0),n?(e.x=t,t+=e.width):(e.y=t,t+=e.height),e.children.forEach((function(e){Cg(e,n,t)}))}_g.fromNode=function(e,n){if(!e)return null;var t=[];return e.children.forEach((function(e){t.push(_g.fromNode(e,n))})),n?new _g(e.height,e.width,e.x,t):new _g(e.width,e.height,e.y,t)};var Mg=mg,Og=function(e,n){for(var t=Mg(e.data,n,!0),r=Mg(e.data,n,!0),o=e.children.length,i=Math.round(o/2),a=n.getSide||function(e,n){return n<i?"right":"left"},u=0;u<o;u++){var c=e.children[u];"right"===a(c,u)?r.children.push(c):t.children.push(c)}return t.eachNode((function(e){e.isRoot()||(e.side="left")})),r.eachNode((function(e){e.isRoot()||(e.side="right")})),{left:t,right:r}},jg=Og,Pg=["LR","RL","TB","BT","H","V"],Ig=["LR","RL","H"],Ag=Pg[0],zg=function(e,n,t){var r=n.direction||Ag;if(n.isHorizontal=function(e){return Ig.indexOf(e)>-1}(r),r&&-1===Pg.indexOf(r))throw new TypeError("Invalid direction: "+r);if(r===Pg[0])t(e,n);else if(r===Pg[1])t(e,n),e.right2left();else if(r===Pg[2])t(e,n);else if(r===Pg[3])t(e,n),e.bottom2top();else if(r===Pg[4]||r===Pg[5]){var o=jg(e,n),i=o.left,a=o.right;t(i,n),t(a,n),n.isHorizontal?i.right2left():i.bottom2top(),a.translate(i.x-a.x,i.y-a.y),e.x=i.x,e.y=a.y;var u=e.getBoundingBox();n.isHorizontal?u.top<0&&e.translate(0,-u.top):u.left<0&&e.translate(-u.left,0)}var c=n.fixedRoot;return void 0===c&&(c=!0),c&&e.translate(-(e.x+e.width/2+e.hgap),-(e.y+e.height/2+e.vgap)),e};function Tg(e,n){return Tg=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,n){return e.__proto__=n,e},Tg(e,n)}var Lg=function(e,n){void 0===n&&(n={});var t=n.isHorizontal;function r(e){0===e.cs?(e.el=e,e.er=e,e.msel=e.mser=0):(e.el=e.c[0].el,e.msel=e.c[0].msel,e.er=e.c[e.cs-1].er,e.mser=e.c[e.cs-1].mser)}function o(e,n,t){for(var r=e.c[n-1],o=r.mod,l=e.c[n],s=l.mod;null!==r&&null!==l;){c(r)>t.low&&(t=t.nxt);var d=o+r.prelim+r.w-(s+l.prelim);d>0&&(s+=d,i(e,n,t.index,d));var f=c(r),h=c(l);f<=h&&null!==(r=u(r))&&(o+=r.mod),f>=h&&null!==(l=a(l))&&(s+=l.mod)}!r&&l?function(e,n,t,r){var o=e.c[0].el;o.tl=t;var i=r-t.mod-e.c[0].msel;o.mod+=i,o.prelim-=i,e.c[0].el=e.c[n].el,e.c[0].msel=e.c[n].msel}(e,n,l,s):r&&!l&&function(e,n,t,r){var o=e.c[n].er;o.tr=t;var i=r-t.mod-e.c[n].mser;o.mod+=i,o.prelim-=i,e.c[n].er=e.c[n-1].er,e.c[n].mser=e.c[n-1].mser}(e,n,r,o)}function i(e,n,t,r){e.c[n].mod+=r,e.c[n].msel+=r,e.c[n].mser+=r,function(e,n,t,r){if(t!==n-1){var o=n-t;e.c[t+1].shift+=r/o,e.c[n].shift-=r/o,e.c[n].change-=r-r/o}}(e,n,t,r)}function a(e){return 0===e.cs?e.tl:e.c[0]}function u(e){return 0===e.cs?e.tr:e.c[e.cs-1]}function c(e){return e.y+e.h}function l(e,n,t){for(;null!==t&&e>=t.low;)t=t.nxt;return{low:e,index:n,nxt:t}}Cg(e,t);var s=_g.fromNode(e,t);return function e(n){if(0!==n.cs){e(n.c[0]);for(var t=l(c(n.c[0].el),0,null),i=1;i<n.cs;++i){e(n.c[i]);var a=c(n.c[i].er);o(n,i,t),t=l(a,i,t)}!function(e){e.prelim=(e.c[0].prelim+e.c[0].mod+e.c[e.cs-1].mod+e.c[e.cs-1].prelim+e.c[e.cs-1].w)/2-e.w/2}(n),r(n)}else r(n)}(s),function e(n,t){t+=n.mod,n.x=n.prelim+t,function(e){for(var n=0,t=0,r=0;r<e.cs;r++)t+=(n+=e.c[r].shift)+e.c[r].change,e.c[r].mod+=t}(n);for(var r=0;r<n.cs;r++)e(n.c[r],t)}(s,0),Ng(s,e,t),kg(e,t),e},Bg=zg,Dg=vg,Rg=function(e){var n,t;function r(){return e.apply(this,arguments)||this}return t=e,(n=r).prototype=Object.create(t.prototype),n.prototype.constructor=n,Tg(n,t),r.prototype.execute=function(){return Bg(this.rootNode,this.options,Lg)},r}(xg),Hg={},Vg=vg;function Yg(e,n){void 0===n&&(n=[]);var t=this;t.x=t.y=0,t.leftChild=t.rightChild=null,t.height=0,t.children=n}var Xg={isHorizontal:!0,nodeSep:20,nodeSize:20,rankSep:200,subTreeSep:10};function Zg(e,n,t){t?(n.x=e.x,n.y=e.y):(n.x=e.y,n.y=e.x),e.children.forEach((function(e,r){Zg(e,n.children[r],t)}))}function Fg(e,n){return Fg=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,n){return e.__proto__=n,e},Fg(e,n)}var Ug=function(e,n){void 0===n&&(n={}),n=Vg.assign({},Xg,n);var t,r=0,o=function e(n){if(!n)return null;n.width=0,n.depth&&n.depth>r&&(r=n.depth);var t=n.children,o=t.length,i=new Yg(n.height,[]);return t.forEach((function(n,t){var r=e(n);i.children.push(r),0===t&&(i.leftChild=r),t===o-1&&(i.rightChild=r)})),i.originNode=n,i.isLeaf=n.isLeaf(),i}(e);return function e(n){if(n.isLeaf||0===n.children.length)n.drawingDepth=r;else{var t=n.children.map((function(n){return e(n)})),o=Math.min.apply(null,t);n.drawingDepth=o-1}return n.drawingDepth}(o),function e(r){r.x=r.drawingDepth*n.rankSep,r.isLeaf?(r.y=0,t&&(r.y=t.y+t.height+n.nodeSep,r.originNode.parent!==t.originNode.parent&&(r.y+=n.subTreeSep)),t=r):(r.children.forEach((function(n){e(n)})),r.y=(r.leftChild.y+r.rightChild.y)/2)}(o),Zg(o,e,n.isHorizontal),e},Wg=zg,Gg=vg,qg=function(e){var n,t;function r(){return e.apply(this,arguments)||this}return t=e,(n=r).prototype=Object.create(t.prototype),n.prototype.constructor=n,Fg(n,t),r.prototype.execute=function(){var e=this;return e.rootNode.width=0,Wg(e.rootNode,e.options,Ug)},r}(xg),$g={},Kg=vg;function Qg(e,n){return Qg=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,n){return e.__proto__=n,e},Qg(e,n)}var Jg=xg,ey=function(e,n,t,r){var o=null;e.eachNode((function(e){!function(e,n,t,r,o){var i="function"==typeof t?t(e):t*e.depth;if(!r)try{if(e.id===e.parent.children[0].id)return e.x+=i,void(e.y=n?n.y:0)}catch(e){}if(e.x+=i,n){if(e.y=n.y+Kg.getHeight(n,e,o),n.parent&&e.parent.id!==n.parent.id){var a=n.parent,u=a.y+Kg.getHeight(a,e,o);e.y=u>e.y?u:e.y}}else e.y=0}(e,o,n,t,r),o=e}))},ny=Og,ty=vg,ry=["LR","RL","H"],oy=ry[0],iy=function(e){var n,t;function r(){return e.apply(this,arguments)||this}return t=e,(n=r).prototype=Object.create(t.prototype),n.prototype.constructor=n,Qg(n,t),r.prototype.execute=function(){var e=this.options,n=this.rootNode;e.isHorizontal=!0;var t=e.indent,r=void 0===t?20:t,o=e.dropCap,i=void 0===o||o,a=e.direction,u=void 0===a?oy:a,c=e.align;if(u&&-1===ry.indexOf(u))throw new TypeError("Invalid direction: "+u);if(u===ry[0])ey(n,r,i,c);else if(u===ry[1])ey(n,r,i,c),n.right2left();else if(u===ry[2]){var l=ny(n,e),s=l.left,d=l.right;ey(s,r,i,c),s.right2left(),ey(d,r,i,c);var f=s.getBoundingBox();d.translate(f.width,0),n.x=d.x-n.width/2}return n},r}(Jg),ay={},uy=vg;function cy(e,n){var t=0;return e.children.length?e.children.forEach((function(e){t+=cy(e,n)})):t=e.height,e._subTreeSep=n.getSubTreeSep(e.data),e.totalHeight=Math.max(e.height,t)+2*e._subTreeSep,e.totalHeight}function ly(e){var n=e.children,t=n.length;if(t){n.forEach((function(e){ly(e)}));var r=n[0],o=n[t-1],i=o.y-r.y+o.height,a=0;if(n.forEach((function(e){a+=e.totalHeight})),i>e.height)e.y=r.y+i/2-e.height/2;else if(1!==n.length||e.height>a){var u=e.y+(e.height-i)/2-r.y;n.forEach((function(e){e.translate(0,u)}))}else e.y=(r.y+r.height/2+o.y+o.height/2)/2-e.height/2}}var sy={getSubTreeSep:function(){return 0}};function dy(e,n){return dy=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,n){return e.__proto__=n,e},dy(e,n)}var fy=function(e,n){void 0===n&&(n={}),n=uy.assign({},sy,n),e.parent={x:0,width:0,height:0,y:0},e.BFTraverse((function(e){e.x=e.parent.x+e.parent.width})),e.parent=null,cy(e,n),e.startY=0,e.y=e.totalHeight/2-e.height/2,e.eachNode((function(e){var n=e.children,t=n.length;if(t){var r=n[0];if(r.startY=e.startY+e._subTreeSep,1===t)r.y=e.y+e.height/2-r.height/2;else{r.y=r.startY+r.totalHeight/2-r.height/2;for(var o=1;o<t;o++){var i=n[o];i.startY=n[o-1].startY+n[o-1].totalHeight,i.y=i.startY+i.totalHeight/2-i.height/2}}}})),ly(e)},hy=zg,vy=vg,py=function(e){var n,t;function r(){return e.apply(this,arguments)||this}return t=e,(n=r).prototype=Object.create(t.prototype),n.prototype.constructor=n,dy(n,t),r.prototype.execute=function(){return hy(this.rootNode,this.options,fy)},r}(xg),gy={};$n({compactBox:function(e,n){return n=Dg.assign({},Hg,n),new Rg(e,n).execute()},dendrogram:function(e,n){return n=Gg.assign({},$g,n),new qg(e,n).execute()},indented:function(e,n){return n=ty.assign({},ay,n),new iy(e,n).execute()},mindmap:function(e,n){return n=vy.assign({},gy,n),new py(e,n).execute()}});var yy={value:()=>{}};function my(){for(var e,n=0,t=arguments.length,r={};n<t;++n){if(!(e=arguments[n]+"")||e in r||/[\s.]/.test(e))throw new Error("illegal type: "+e);r[e]=[]}return new wy(r)}function wy(e){this._=e}function by(e,n){for(var t,r=0,o=e.length;r<o;++r)if((t=e[r]).name===n)return t.value}function xy(e,n,t){for(var r=0,o=e.length;r<o;++r)if(e[r].name===n){e[r]=yy,e=e.slice(0,r).concat(e.slice(r+1));break}return null!=t&&e.push({name:n,value:t}),e}wy.prototype=my.prototype={constructor:wy,on:function(e,n){var t,r,o=this._,i=(r=o,(e+"").trim().split(/^|\s+/).map((function(e){var n="",t=e.indexOf(".");if(t>=0&&(n=e.slice(t+1),e=e.slice(0,t)),e&&!r.hasOwnProperty(e))throw new Error("unknown type: "+e);return{type:e,name:n}}))),a=-1,u=i.length;if(!(arguments.length<2)){if(null!=n&&"function"!=typeof n)throw new Error("invalid callback: "+n);for(;++a<u;)if(t=(e=i[a]).type)o[t]=xy(o[t],e.name,n);else if(null==n)for(t in o)o[t]=xy(o[t],e.name,null);return this}for(;++a<u;)if((t=(e=i[a]).type)&&(t=by(o[t],e.name)))return t},copy:function(){var e={},n=this._;for(var t in n)e[t]=n[t].slice();return new wy(e)},call:function(e,n){if((t=arguments.length-2)>0)for(var t,r,o=new Array(t),i=0;i<t;++i)o[i]=arguments[i+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=0,t=(r=this._[e]).length;i<t;++i)r[i].value.apply(n,o)},apply:function(e,n,t){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],o=0,i=r.length;o<i;++o)r[o].value.apply(n,t)}};var _y="http://www.w3.org/1999/xhtml",Ey={svg:"http://www.w3.org/2000/svg",xhtml:_y,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Sy(e){var n=e+="",t=n.indexOf(":");return t>=0&&"xmlns"!==(n=e.slice(0,t))&&(e=e.slice(t+1)),Ey.hasOwnProperty(n)?{space:Ey[n],local:e}:e}function ky(e){return function(){var n=this.ownerDocument,t=this.namespaceURI;return t===_y&&n.documentElement.namespaceURI===_y?n.createElement(e):n.createElementNS(t,e)}}function Ny(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Cy(e){var n=Sy(e);return(n.local?Ny:ky)(n)}function My(){}function Oy(e){return null==e?My:function(){return this.querySelector(e)}}function jy(){return[]}function Py(e){return null==e?jy:function(){return this.querySelectorAll(e)}}function Iy(e){return function(){return this.matches(e)}}function Ay(e){return function(n){return n.matches(e)}}var zy=Array.prototype.find;function Ty(){return this.firstElementChild}var Ly=Array.prototype.filter;function By(){return Array.from(this.children)}function Dy(e){return new Array(e.length)}function Ry(e,n){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=n}function Hy(e,n,t,r,o,i){for(var a,u=0,c=n.length,l=i.length;u<l;++u)(a=n[u])?(a.__data__=i[u],r[u]=a):t[u]=new Ry(e,i[u]);for(;u<c;++u)(a=n[u])&&(o[u]=a)}function Vy(e,n,t,r,o,i,a){var u,c,l,s=new Map,d=n.length,f=i.length,h=new Array(d);for(u=0;u<d;++u)(c=n[u])&&(h[u]=l=a.call(c,c.__data__,u,n)+"",s.has(l)?o[u]=c:s.set(l,c));for(u=0;u<f;++u)l=a.call(e,i[u],u,i)+"",(c=s.get(l))?(r[u]=c,c.__data__=i[u],s.delete(l)):t[u]=new Ry(e,i[u]);for(u=0;u<d;++u)(c=n[u])&&s.get(h[u])===c&&(o[u]=c)}function Yy(e){return e.__data__}function Xy(e){return"object"==typeof e&&"length"in e?e:Array.from(e)}function Zy(e,n){return e<n?-1:e>n?1:e>=n?0:NaN}function Fy(e){return function(){this.removeAttribute(e)}}function Uy(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Wy(e,n){return function(){this.setAttribute(e,n)}}function Gy(e,n){return function(){this.setAttributeNS(e.space,e.local,n)}}function qy(e,n){return function(){var t=n.apply(this,arguments);null==t?this.removeAttribute(e):this.setAttribute(e,t)}}function $y(e,n){return function(){var t=n.apply(this,arguments);null==t?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,t)}}function Ky(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Qy(e){return function(){this.style.removeProperty(e)}}function Jy(e,n,t){return function(){this.style.setProperty(e,n,t)}}function em(e,n,t){return function(){var r=n.apply(this,arguments);null==r?this.style.removeProperty(e):this.style.setProperty(e,r,t)}}function nm(e,n){return e.style.getPropertyValue(n)||Ky(e).getComputedStyle(e,null).getPropertyValue(n)}function tm(e){return function(){delete this[e]}}function rm(e,n){return function(){this[e]=n}}function om(e,n){return function(){var t=n.apply(this,arguments);null==t?delete this[e]:this[e]=t}}function im(e){return e.trim().split(/^|\s+/)}function am(e){return e.classList||new um(e)}function um(e){this._node=e,this._names=im(e.getAttribute("class")||"")}function cm(e,n){for(var t=am(e),r=-1,o=n.length;++r<o;)t.add(n[r])}function lm(e,n){for(var t=am(e),r=-1,o=n.length;++r<o;)t.remove(n[r])}function sm(e){return function(){cm(this,e)}}function dm(e){return function(){lm(this,e)}}function fm(e,n){return function(){(n.apply(this,arguments)?cm:lm)(this,e)}}function hm(){this.textContent=""}function vm(e){return function(){this.textContent=e}}function pm(e){return function(){var n=e.apply(this,arguments);this.textContent=null==n?"":n}}function gm(){this.innerHTML=""}function ym(e){return function(){this.innerHTML=e}}function mm(e){return function(){var n=e.apply(this,arguments);this.innerHTML=null==n?"":n}}function wm(){this.nextSibling&&this.parentNode.appendChild(this)}function bm(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function xm(){return null}function _m(){var e=this.parentNode;e&&e.removeChild(this)}function Em(){var e=this.cloneNode(!1),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function Sm(){var e=this.cloneNode(!0),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function km(e){return function(){var n=this.__on;if(n){for(var t,r=0,o=-1,i=n.length;r<i;++r)t=n[r],e.type&&t.type!==e.type||t.name!==e.name?n[++o]=t:this.removeEventListener(t.type,t.listener,t.options);++o?n.length=o:delete this.__on}}}function Nm(e,n,t){return function(){var r,o=this.__on,i=function(e){return function(n){e.call(this,n,this.__data__)}}(n);if(o)for(var a=0,u=o.length;a<u;++a)if((r=o[a]).type===e.type&&r.name===e.name)return this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=i,r.options=t),void(r.value=n);this.addEventListener(e.type,i,t),r={type:e.type,name:e.name,value:n,listener:i,options:t},o?o.push(r):this.__on=[r]}}function Cm(e,n,t){var r=Ky(e),o=r.CustomEvent;"function"==typeof o?o=new o(n,t):(o=r.document.createEvent("Event"),t?(o.initEvent(n,t.bubbles,t.cancelable),o.detail=t.detail):o.initEvent(n,!1,!1)),e.dispatchEvent(o)}function Mm(e,n){return function(){return Cm(this,e,n)}}function Om(e,n){return function(){return Cm(this,e,n.apply(this,arguments))}}Ry.prototype={constructor:Ry,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,n){return this._parent.insertBefore(e,n)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}},um.prototype={add:function(e){this._names.indexOf(e)<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var n=this._names.indexOf(e);n>=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};var jm=[null];function Pm(e,n){this._groups=e,this._parents=n}function Im(){return new Pm([[document.documentElement]],jm)}function Am(e){return"string"==typeof e?new Pm([[document.querySelector(e)]],[document.documentElement]):new Pm([[e]],jm)}function zm(e,n){if(e=function(e){let n;for(;n=e.sourceEvent;)e=n;return e}(e),void 0===n&&(n=e.currentTarget),n){var t=n.ownerSVGElement||n;if(t.createSVGPoint){var r=t.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,[(r=r.matrixTransform(n.getScreenCTM().inverse())).x,r.y]}if(n.getBoundingClientRect){var o=n.getBoundingClientRect();return[e.clientX-o.left-n.clientLeft,e.clientY-o.top-n.clientTop]}}return[e.pageX,e.pageY]}Pm.prototype=Im.prototype={constructor:Pm,select:function(e){"function"!=typeof e&&(e=Oy(e));for(var n=this._groups,t=n.length,r=new Array(t),o=0;o<t;++o)for(var i,a,u=n[o],c=u.length,l=r[o]=new Array(c),s=0;s<c;++s)(i=u[s])&&(a=e.call(i,i.__data__,s,u))&&("__data__"in i&&(a.__data__=i.__data__),l[s]=a);return new Pm(r,this._parents)},selectAll:function(e){e="function"==typeof e?function(e){return function(){return null==(n=e.apply(this,arguments))?[]:Array.isArray(n)?n:Array.from(n);var n}}(e):Py(e);for(var n=this._groups,t=n.length,r=[],o=[],i=0;i<t;++i)for(var a,u=n[i],c=u.length,l=0;l<c;++l)(a=u[l])&&(r.push(e.call(a,a.__data__,l,u)),o.push(a));return new Pm(r,o)},selectChild:function(e){return this.select(null==e?Ty:function(e){return function(){return zy.call(this.children,e)}}("function"==typeof e?e:Ay(e)))},selectChildren:function(e){return this.selectAll(null==e?By:function(e){return function(){return Ly.call(this.children,e)}}("function"==typeof e?e:Ay(e)))},filter:function(e){"function"!=typeof e&&(e=Iy(e));for(var n=this._groups,t=n.length,r=new Array(t),o=0;o<t;++o)for(var i,a=n[o],u=a.length,c=r[o]=[],l=0;l<u;++l)(i=a[l])&&e.call(i,i.__data__,l,a)&&c.push(i);return new Pm(r,this._parents)},data:function(e,n){if(!arguments.length)return Array.from(this,Yy);var t,r=n?Vy:Hy,o=this._parents,i=this._groups;"function"!=typeof e&&(t=e,e=function(){return t});for(var a=i.length,u=new Array(a),c=new Array(a),l=new Array(a),s=0;s<a;++s){var d=o[s],f=i[s],h=f.length,v=Xy(e.call(d,d&&d.__data__,s,o)),p=v.length,g=c[s]=new Array(p),y=u[s]=new Array(p);r(d,f,g,y,l[s]=new Array(h),v,n);for(var m,w,b=0,x=0;b<p;++b)if(m=g[b]){for(b>=x&&(x=b+1);!(w=y[x])&&++x<p;);m._next=w||null}}return(u=new Pm(u,o))._enter=c,u._exit=l,u},enter:function(){return new Pm(this._enter||this._groups.map(Dy),this._parents)},exit:function(){return new Pm(this._exit||this._groups.map(Dy),this._parents)},join:function(e,n,t){var r=this.enter(),o=this,i=this.exit();return"function"==typeof e?(r=e(r))&&(r=r.selection()):r=r.append(e+""),null!=n&&(o=n(o))&&(o=o.selection()),null==t?i.remove():t(i),r&&o?r.merge(o).order():o},merge:function(e){for(var n=e.selection?e.selection():e,t=this._groups,r=n._groups,o=t.length,i=r.length,a=Math.min(o,i),u=new Array(o),c=0;c<a;++c)for(var l,s=t[c],d=r[c],f=s.length,h=u[c]=new Array(f),v=0;v<f;++v)(l=s[v]||d[v])&&(h[v]=l);for(;c<o;++c)u[c]=t[c];return new Pm(u,this._parents)},selection:function(){return this},order:function(){for(var e=this._groups,n=-1,t=e.length;++n<t;)for(var r,o=e[n],i=o.length-1,a=o[i];--i>=0;)(r=o[i])&&(a&&4^r.compareDocumentPosition(a)&&a.parentNode.insertBefore(r,a),a=r);return this},sort:function(e){function n(n,t){return n&&t?e(n.__data__,t.__data__):!n-!t}e||(e=Zy);for(var t=this._groups,r=t.length,o=new Array(r),i=0;i<r;++i){for(var a,u=t[i],c=u.length,l=o[i]=new Array(c),s=0;s<c;++s)(a=u[s])&&(l[s]=a);l.sort(n)}return new Pm(o,this._parents).order()},call:function(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this},nodes:function(){return Array.from(this)},node:function(){for(var e=this._groups,n=0,t=e.length;n<t;++n)for(var r=e[n],o=0,i=r.length;o<i;++o){var a=r[o];if(a)return a}return null},size:function(){let e=0;for(const n of this)++e;return e},empty:function(){return!this.node()},each:function(e){for(var n=this._groups,t=0,r=n.length;t<r;++t)for(var o,i=n[t],a=0,u=i.length;a<u;++a)(o=i[a])&&e.call(o,o.__data__,a,i);return this},attr:function(e,n){var t=Sy(e);if(arguments.length<2){var r=this.node();return t.local?r.getAttributeNS(t.space,t.local):r.getAttribute(t)}return this.each((null==n?t.local?Uy:Fy:"function"==typeof n?t.local?$y:qy:t.local?Gy:Wy)(t,n))},style:function(e,n,t){return arguments.length>1?this.each((null==n?Qy:"function"==typeof n?em:Jy)(e,n,null==t?"":t)):nm(this.node(),e)},property:function(e,n){return arguments.length>1?this.each((null==n?tm:"function"==typeof n?om:rm)(e,n)):this.node()[e]},classed:function(e,n){var t=im(e+"");if(arguments.length<2){for(var r=am(this.node()),o=-1,i=t.length;++o<i;)if(!r.contains(t[o]))return!1;return!0}return this.each(("function"==typeof n?fm:n?sm:dm)(t,n))},text:function(e){return arguments.length?this.each(null==e?hm:("function"==typeof e?pm:vm)(e)):this.node().textContent},html:function(e){return arguments.length?this.each(null==e?gm:("function"==typeof e?mm:ym)(e)):this.node().innerHTML},raise:function(){return this.each(wm)},lower:function(){return this.each(bm)},append:function(e){var n="function"==typeof e?e:Cy(e);return this.select((function(){return this.appendChild(n.apply(this,arguments))}))},insert:function(e,n){var t="function"==typeof e?e:Cy(e),r=null==n?xm:"function"==typeof n?n:Oy(n);return this.select((function(){return this.insertBefore(t.apply(this,arguments),r.apply(this,arguments)||null)}))},remove:function(){return this.each(_m)},clone:function(e){return this.select(e?Sm:Em)},datum:function(e){return arguments.length?this.property("__data__",e):this.node().__data__},on:function(e,n,t){var r,o,i=function(e){return e.trim().split(/^|\s+/).map((function(e){var n="",t=e.indexOf(".");return t>=0&&(n=e.slice(t+1),e=e.slice(0,t)),{type:e,name:n}}))}(e+""),a=i.length;if(!(arguments.length<2)){for(u=n?Nm:km,r=0;r<a;++r)this.each(u(i[r],n,t));return this}var u=this.node().__on;if(u)for(var c,l=0,s=u.length;l<s;++l)for(r=0,c=u[l];r<a;++r)if((o=i[r]).type===c.type&&o.name===c.name)return c.value},dispatch:function(e,n){return this.each(("function"==typeof n?Om:Mm)(e,n))},[Symbol.iterator]:function*(){for(var e=this._groups,n=0,t=e.length;n<t;++n)for(var r,o=e[n],i=0,a=o.length;i<a;++i)(r=o[i])&&(yield r)}};const Tm={passive:!1},Lm={capture:!0,passive:!1};function Bm(e){e.stopImmediatePropagation()}function Dm(e){e.preventDefault(),e.stopImmediatePropagation()}function Rm(e){var n=e.document.documentElement,t=Am(e).on("dragstart.drag",Dm,Lm);"onselectstart"in n?t.on("selectstart.drag",Dm,Lm):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")}function Hm(e,n){var t=e.document.documentElement,r=Am(e).on("dragstart.drag",null);n&&(r.on("click.drag",Dm,Lm),setTimeout((function(){r.on("click.drag",null)}),0)),"onselectstart"in t?r.on("selectstart.drag",null):(t.style.MozUserSelect=t.__noselect,delete t.__noselect)}var Vm=e=>()=>e;function Ym(e,{sourceEvent:n,subject:t,target:r,identifier:o,active:i,x:a,y:u,dx:c,dy:l,dispatch:s}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},subject:{value:t,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:o,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:u,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:s}})}function Xm(e){return!e.ctrlKey&&!e.button}function Zm(){return this.parentNode}function Fm(e,n){return null==n?{x:e.x,y:e.y}:n}function Um(){return navigator.maxTouchPoints||"ontouchstart"in this}function Wm(e,n){if(!e.parentId)return!1;var t=n.get(e.parentId);return!!t&&(!!t.selected||Wm(t,n))}function Gm(e,n,t){var r=e;do{if(null==r?void 0:r.matches(n))return!0;if(r===t)return!1;r=r.parentElement}while(r);return!1}function qm(e){var n,t,r,o,i=e.nodeId,a=e.dragItems,u=e.nodeLookup,c=[];try{for(var l=F(a),s=l.next();!s.done;s=l.next()){var d=U(s.value,2),f=d[0],h=d[1],v=null===(r=u.get(f))||void 0===r?void 0:r.internals.userNode;v&&c.push(Z(Z({},v),{position:h.position}))}}catch(e){n={error:e}}finally{try{s&&!s.done&&(t=l.return)&&t.call(l)}finally{if(n)throw n.error}}if(!i)return[c[0],c];var p=u.get(i).internals.userNode;return[Z(Z({},p),{position:(null===(o=a.get(i))||void 0===o?void 0:o.position)||p.position}),c]}function $m(e){var n=e.onNodeMouseDown,t=e.getStoreItems,r=e.onDragStart,o=e.onDrag,i=e.onDragStop,a={x:null,y:null},u=0,c=new Map,l=!1,s={x:0,y:0},d=null,f=!1,h=null;return{update:function(e){var v=e.noDragClassName,p=e.handleSelector,g=e.domNode,y=e.isSelectable,m=e.nodeId;function w(e,n){var r,i,u=e.x,l=e.y,s=t(),d=s.nodeLookup,f=s.nodeExtent,h=s.snapGrid,v=s.snapToGrid,p=s.nodeOrigin,g=s.onNodeDrag,y=s.onSelectionDrag,w=s.onError,b=s.updateNodePositions;a={x:u,y:l};var x=!1,_={x:0,y:0,x2:0,y2:0};if(c.size>1&&f){var E=Nv(c,{nodeOrigin:p});_=zv(E)}try{for(var S=F(c),k=S.next();!k.done;k=S.next()){var N=U(k.value,2),C=N[0],M=N[1],O={x:u-M.distance.x,y:l-M.distance.y};v&&(O=Bv(O,h));var j=[[f[0][0],f[0][1]],[f[1][0],f[1][1]]];if(c.size>1&&f&&!M.extent){var P=M.internals.positionAbsolute,I=P.x-_.x+f[0][0],A=P.x+M.measured.width-_.x2+f[1][0];j=[[I,P.y-_.y+f[0][1]],[A,P.y+M.measured.height-_.y2+f[1][1]]]}var z=Mv({nodeId:C,nextPosition:O,nodeLookup:d,nodeExtent:j,nodeOrigin:p,onError:w}),T=z.position,L=z.positionAbsolute;x=x||M.position.x!==T.x||M.position.y!==T.y,M.position=T,M.internals.positionAbsolute=L}}catch(e){r={error:e}}finally{try{k&&!k.done&&(i=S.return)&&i.call(S)}finally{if(r)throw r.error}}if(x&&(b(c,!0),n&&(o||g||!m&&y))){var B=U(qm({nodeId:m,dragItems:c,nodeLookup:d}),2),D=B[0],R=B[1];null==o||o(n,c,D,R),null==g||g(n,D,R),m||null==y||y(n,R)}}function b(){var e,n;if(d){var r=U(Iv(s,d),2),o=r[0],i=r[1];if(0!==o||0!==i){var c=t(),l=c.transform,f=c.panBy;a.x=(null!==(e=a.x)&&void 0!==e?e:0)-o/l[2],a.y=(null!==(n=a.y)&&void 0!==n?n:0)-i/l[2],f({x:o,y:i})&&w(a,null)}u=requestAnimationFrame(b)}}function x(e){var o,i=t(),u=i.nodeLookup,l=i.multiSelectionActive,s=i.nodesDraggable,d=i.transform,h=i.snapGrid,v=i.snapToGrid,p=i.selectNodesOnDrag,g=i.onNodeDragStart,w=i.onSelectionDragStart,b=i.unselectNodesAndEdges;f=!0,p&&y||l||!m||(null===(o=u.get(m))||void 0===o?void 0:o.selected)||b(),y&&p&&m&&(null==n||n(m));var x=Fv(e.sourceEvent,{transform:d,snapGrid:h,snapToGrid:v});if(a=x,c=function(e,n,t,r){var o,i,a,u,c=new Map;try{for(var l=F(e),s=l.next();!s.done;s=l.next()){var d=U(s.value,2),f=d[0],h=d[1];if((h.selected||h.id===r)&&(!h.parentId||!Wm(h,e))&&(h.draggable||n&&void 0===h.draggable)){var v=e.get(f);v&&c.set(f,{id:f,position:v.position||{x:0,y:0},distance:{x:t.x-v.internals.positionAbsolute.x,y:t.y-v.internals.positionAbsolute.y},extent:v.extent,parentId:v.parentId,origin:v.origin,expandParent:v.expandParent,internals:{positionAbsolute:v.internals.positionAbsolute||{x:0,y:0}},measured:{width:null!==(a=v.measured.width)&&void 0!==a?a:0,height:null!==(u=v.measured.height)&&void 0!==u?u:0}})}}}catch(e){o={error:e}}finally{try{s&&!s.done&&(i=l.return)&&i.call(l)}finally{if(o)throw o.error}}return c}(u,s,x,m),c.size>0&&(r||g||!m&&w)){var _=U(qm({nodeId:m,dragItems:c,nodeLookup:u}),2),E=_[0],S=_[1];null==r||r(e.sourceEvent,c,E,S),null==g||g(e.sourceEvent,E,S),m||null==w||w(e.sourceEvent,S)}}h=Am(g);var _=function(){var e,n,t,r,o=Xm,i=Zm,a=Fm,u=Um,c={},l=my("start","drag","end"),s=0,d=0;function f(e){e.on("mousedown.drag",h).filter(u).on("touchstart.drag",g).on("touchmove.drag",y,Tm).on("touchend.drag touchcancel.drag",m).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(a,u){if(!r&&o.call(this,a,u)){var c=w(this,i.call(this,a,u),a,u,"mouse");c&&(Am(a.view).on("mousemove.drag",v,Lm).on("mouseup.drag",p,Lm),Rm(a.view),Bm(a),t=!1,e=a.clientX,n=a.clientY,c("start",a))}}function v(r){if(Dm(r),!t){var o=r.clientX-e,i=r.clientY-n;t=o*o+i*i>d}c.mouse("drag",r)}function p(e){Am(e.view).on("mousemove.drag mouseup.drag",null),Hm(e.view,t),Dm(e),c.mouse("end",e)}function g(e,n){if(o.call(this,e,n)){var t,r,a=e.changedTouches,u=i.call(this,e,n),c=a.length;for(t=0;t<c;++t)(r=w(this,u,e,n,a[t].identifier,a[t]))&&(Bm(e),r("start",e,a[t]))}}function y(e){var n,t,r=e.changedTouches,o=r.length;for(n=0;n<o;++n)(t=c[r[n].identifier])&&(Dm(e),t("drag",e,r[n]))}function m(e){var n,t,o=e.changedTouches,i=o.length;for(r&&clearTimeout(r),r=setTimeout((function(){r=null}),500),n=0;n<i;++n)(t=c[o[n].identifier])&&(Bm(e),t("end",e,o[n]))}function w(e,n,t,r,o,i){var u,d,h,v=l.copy(),p=zm(i||t,n);if(null!=(h=a.call(e,new Ym("beforestart",{sourceEvent:t,target:f,identifier:o,active:s,x:p[0],y:p[1],dx:0,dy:0,dispatch:v}),r)))return u=h.x-p[0]||0,d=h.y-p[1]||0,function t(i,a,l){var g,y=p;switch(i){case"start":c[o]=t,g=s++;break;case"end":delete c[o],--s;case"drag":p=zm(l||a,n),g=s}v.call(i,e,new Ym(i,{sourceEvent:a,subject:h,target:f,identifier:o,active:g,x:p[0]+u,y:p[1]+d,dx:p[0]-y[0],dy:p[1]-y[1],dispatch:v}),r)}}return f.filter=function(e){return arguments.length?(o="function"==typeof e?e:Vm(!!e),f):o},f.container=function(e){return arguments.length?(i="function"==typeof e?e:Vm(e),f):i},f.subject=function(e){return arguments.length?(a="function"==typeof e?e:Vm(e),f):a},f.touchable=function(e){return arguments.length?(u="function"==typeof e?e:Vm(!!e),f):u},f.on=function(){var e=l.on.apply(l,arguments);return e===l?f:e},f.clickDistance=function(e){return arguments.length?(d=(e=+e)*e,f):Math.sqrt(d)},f}().on("start",(function(e){var n=t(),r=n.domNode,o=n.nodeDragThreshold,i=n.transform,u=n.snapGrid,c=n.snapToGrid;0===o&&x(e);var l=Fv(e.sourceEvent,{transform:i,snapGrid:u,snapToGrid:c});a=l,d=(null==r?void 0:r.getBoundingClientRect())||null,s=Qv(e.sourceEvent,d)})).on("drag",(function(e){var n,r,o=t(),i=o.autoPanOnNodeDrag,u=o.transform,h=o.snapGrid,v=o.snapToGrid,p=o.nodeDragThreshold,g=Fv(e.sourceEvent,{transform:u,snapGrid:h,snapToGrid:v});if(!l&&i&&f&&(l=!0,b()),!f){var y=g.xSnapped-(null!==(n=a.x)&&void 0!==n?n:0),m=g.ySnapped-(null!==(r=a.y)&&void 0!==r?r:0);Math.sqrt(y*y+m*m)>p&&x(e)}(a.x!==g.xSnapped||a.y!==g.ySnapped)&&c&&f&&(s=Qv(e.sourceEvent,d),w(g,e.sourceEvent))})).on("end",(function(e){if(f&&(l=!1,f=!1,cancelAnimationFrame(u),c.size>0)){var n=t(),r=n.nodeLookup,o=n.updateNodePositions,a=n.onNodeDragStop,s=n.onSelectionDragStop;if(o(c,!1),i||a||!m&&s){var d=U(qm({nodeId:m,dragItems:c,nodeLookup:r}),2),h=d[0],v=d[1];null==i||i(e.sourceEvent,c,h,v),null==a||a(e.sourceEvent,h,v),m||null==s||s(e.sourceEvent,v)}}})).filter((function(e){var n=e.target;return!e.button&&(!v||!Gm(n,".".concat(v),g))&&(!p||Gm(n,p,g))}));h.call(_)},destroy:function(){null==h||h.on(".drag",null)}}}function Km(e,n,t,r){return(n[t]||[]).reduce((function(n,o){return"".concat(e.id,"-").concat(o.id,"-").concat(t)!==r&&n.push({id:o.id||null,type:t,nodeId:e.id,x:e.internals.positionAbsolute.x+o.x+o.width/2,y:e.internals.positionAbsolute.y+o.y+o.height/2}),n}),[])}function Qm(e,n){return e||((null==n?void 0:n.classList.contains("target"))?"target":(null==n?void 0:n.classList.contains("source"))?"source":null)}Ym.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};var Jm=function(){return!0},ew=null;function nw(e,n){var t=n.handle,r=n.connectionMode,o=n.fromNodeId,i=n.fromHandleId,a=n.fromType,u=n.doc,c=n.lib,l=n.flowId,s=n.isValidConnection,d=void 0===s?Jm:s,f="target"===a,h=t?u.querySelector(".".concat(c,'-flow__handle[data-id="').concat(l,"-").concat(null==t?void 0:t.nodeId,"-").concat(null==t?void 0:t.id,"-").concat(null==t?void 0:t.type,'"]')):null,v=Qv(e),p=v.x,g=v.y,y=u.elementFromPoint(p,g),m=(null==y?void 0:y.classList.contains("".concat(c,"-flow__handle")))?y:h,w={handleDomNode:m,isValid:!1,connection:null,endHandle:null};if(m){var b=Qm(void 0,m),x=m.getAttribute("data-nodeid"),_=m.getAttribute("data-handleid"),E=m.classList.contains("connectable"),S=m.classList.contains("connectableend");if(!x)return w;var k={source:f?x:o,sourceHandle:f?_:i,target:f?o:x,targetHandle:f?i:_};w.connection=k,E&&S&&(r===Uv.Strict?f&&"source"===b||!f&&"target"===b:x!==o||_!==i)&&(w.endHandle={nodeId:x,handleId:_,type:b},w.isValid=d(k))}return w}var tw={onPointerDown:function(e,n){var t,r=n.connectionMode,o=n.connectionRadius,i=n.handleId,a=n.nodeId,u=n.edgeUpdaterType,c=n.isTarget,l=n.domNode,s=n.nodeLookup,d=n.lib,f=n.autoPanOnConnect,h=n.flowId,v=n.panBy,p=n.cancelConnection,g=n.onConnectStart,y=n.onConnect,m=n.onConnectEnd,w=n.isValidConnection,b=void 0===w?Jm:w,x=n.onEdgeUpdateEnd,_=n.updateConnection,E=n.getTransform,S=n.getConnectionStartHandle,k=function(e){var n;return(null===(n=e.getRootNode)||void 0===n?void 0:n.call(e))||(null===window||void 0===window?void 0:window.document)}(e.target),N=0,C=Qv(e),M=C.x,O=C.y,j=null==k?void 0:k.elementFromPoint(M,O),P=Qm(u,j),I=null==l?void 0:l.getBoundingClientRect();if(I&&P){var A=Qv(e,I),z=!1,T=null,L=!1,B=null,D=function(e){var n,t,r=e.nodeLookup,o=e.nodeId,i=e.handleId,a=e.handleType,u=[];try{for(var c=F(r),l=c.next();!l.done;l=c.next()){var s=U(l.value,2)[1];if(s.internals.handleBounds){var d="".concat(o,"-").concat(i,"-").concat(a),f=Km(s,s.internals.handleBounds,"source",d),h=Km(s,s.internals.handleBounds,"target",d);u.push.apply(u,W(W([],U(f),!1),U(h),!1))}}}catch(e){n={error:e}}finally{try{l&&!l.done&&(t=c.return)&&t.call(c)}finally{if(n)throw n.error}}return u}({nodeLookup:s,nodeId:a,handleId:i,handleType:P});_({connectionPosition:A,connectionStatus:null,connectionStartHandle:ew={nodeId:a,handleId:i,type:P},connectionEndHandle:null}),null==g||g(e,{nodeId:a,handleId:i,handleType:P}),k.addEventListener("mousemove",H),k.addEventListener("mouseup",V),k.addEventListener("touchmove",H),k.addEventListener("touchend",V)}function R(){if(f&&I){var e=U(Iv(A,I),2),n=e[0],t=e[1];v({x:n,y:t}),N=requestAnimationFrame(R)}}function H(e){S()||V(e);var n=E();A=Qv(e,I),t=function(e,n,t){var r,o,i=[],a=1/0;try{for(var u=F(t),c=u.next();!c.done;c=u.next()){var l=c.value,s=Math.sqrt(Math.pow(l.x-e.x,2)+Math.pow(l.y-e.y,2));s<=n&&(s<a?i=[l]:s===a&&i.push(l),a=s)}}catch(e){r={error:e}}finally{try{c&&!c.done&&(o=u.return)&&o.call(u)}finally{if(r)throw r.error}}return i.length?1===i.length?i[0]:i.find((function(e){return"target"===e.type}))||i[0]:null}(Dv(A,n,!1,[1,1]),o,D),z||(R(),z=!0);var u,l,s,f=nw(e,{handle:t,connectionMode:r,fromNodeId:a,fromHandleId:i,fromType:c?"target":"source",isValidConnection:b,doc:k,lib:d,flowId:h});B=f.handleDomNode,T=f.connection,L=f.isValid,_({connectionStartHandle:ew,connectionPosition:t&&L?Rv({x:t.x,y:t.y},n):A,connectionStatus:(u=!!t,l=L,s=null,l?s="valid":u&&!l&&(s="invalid"),s),connectionEndHandle:f.endHandle})}function V(e){(t||B)&&T&&L&&(null==y||y(T)),null==m||m(e),u&&(null==x||x(e)),p(),cancelAnimationFrame(N),z=!1,L=!1,T=null,B=null,ew=null,k.removeEventListener("mousemove",H),k.removeEventListener("mouseup",V),k.removeEventListener("touchmove",H),k.removeEventListener("touchend",V)}},isValid:nw};function rw(e,n,t){e.prototype=n.prototype=t,t.constructor=e}function ow(e,n){var t=Object.create(e.prototype);for(var r in n)t[r]=n[r];return t}function iw(){}var aw=.7,uw=1/aw,cw="\\s*([+-]?\\d+)\\s*",lw="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",sw="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",dw=/^#([0-9a-f]{3,8})$/,fw=new RegExp(`^rgb\\(${cw},${cw},${cw}\\)$`),hw=new RegExp(`^rgb\\(${sw},${sw},${sw}\\)$`),vw=new RegExp(`^rgba\\(${cw},${cw},${cw},${lw}\\)$`),pw=new RegExp(`^rgba\\(${sw},${sw},${sw},${lw}\\)$`),gw=new RegExp(`^hsl\\(${lw},${sw},${sw}\\)$`),yw=new RegExp(`^hsla\\(${lw},${sw},${sw},${lw}\\)$`),mw={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function ww(){return this.rgb().formatHex()}function bw(){return this.rgb().formatRgb()}function xw(e){var n,t;return e=(e+"").trim().toLowerCase(),(n=dw.exec(e))?(t=n[1].length,n=parseInt(n[1],16),6===t?_w(n):3===t?new kw(n>>8&15|n>>4&240,n>>4&15|240&n,(15&n)<<4|15&n,1):8===t?Ew(n>>24&255,n>>16&255,n>>8&255,(255&n)/255):4===t?Ew(n>>12&15|n>>8&240,n>>8&15|n>>4&240,n>>4&15|240&n,((15&n)<<4|15&n)/255):null):(n=fw.exec(e))?new kw(n[1],n[2],n[3],1):(n=hw.exec(e))?new kw(255*n[1]/100,255*n[2]/100,255*n[3]/100,1):(n=vw.exec(e))?Ew(n[1],n[2],n[3],n[4]):(n=pw.exec(e))?Ew(255*n[1]/100,255*n[2]/100,255*n[3]/100,n[4]):(n=gw.exec(e))?Pw(n[1],n[2]/100,n[3]/100,1):(n=yw.exec(e))?Pw(n[1],n[2]/100,n[3]/100,n[4]):mw.hasOwnProperty(e)?_w(mw[e]):"transparent"===e?new kw(NaN,NaN,NaN,0):null}function _w(e){return new kw(e>>16&255,e>>8&255,255&e,1)}function Ew(e,n,t,r){return r<=0&&(e=n=t=NaN),new kw(e,n,t,r)}function Sw(e,n,t,r){return 1===arguments.length?((o=e)instanceof iw||(o=xw(o)),o?new kw((o=o.rgb()).r,o.g,o.b,o.opacity):new kw):new kw(e,n,t,null==r?1:r);var o}function kw(e,n,t,r){this.r=+e,this.g=+n,this.b=+t,this.opacity=+r}function Nw(){return`#${jw(this.r)}${jw(this.g)}${jw(this.b)}`}function Cw(){const e=Mw(this.opacity);return`${1===e?"rgb(":"rgba("}${Ow(this.r)}, ${Ow(this.g)}, ${Ow(this.b)}${1===e?")":`, ${e})`}`}function Mw(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Ow(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function jw(e){return((e=Ow(e))<16?"0":"")+e.toString(16)}function Pw(e,n,t,r){return r<=0?e=n=t=NaN:t<=0||t>=1?e=n=NaN:n<=0&&(e=NaN),new Aw(e,n,t,r)}function Iw(e){if(e instanceof Aw)return new Aw(e.h,e.s,e.l,e.opacity);if(e instanceof iw||(e=xw(e)),!e)return new Aw;if(e instanceof Aw)return e;var n=(e=e.rgb()).r/255,t=e.g/255,r=e.b/255,o=Math.min(n,t,r),i=Math.max(n,t,r),a=NaN,u=i-o,c=(i+o)/2;return u?(a=n===i?(t-r)/u+6*(t<r):t===i?(r-n)/u+2:(n-t)/u+4,u/=c<.5?i+o:2-i-o,a*=60):u=c>0&&c<1?0:a,new Aw(a,u,c,e.opacity)}function Aw(e,n,t,r){this.h=+e,this.s=+n,this.l=+t,this.opacity=+r}function zw(e){return(e=(e||0)%360)<0?e+360:e}function Tw(e){return Math.max(0,Math.min(1,e||0))}function Lw(e,n,t){return 255*(e<60?n+(t-n)*e/60:e<180?t:e<240?n+(t-n)*(240-e)/60:n)}rw(iw,xw,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:ww,formatHex:ww,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return Iw(this).formatHsl()},formatRgb:bw,toString:bw}),rw(kw,Sw,ow(iw,{brighter(e){return e=null==e?uw:Math.pow(uw,e),new kw(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=null==e?aw:Math.pow(aw,e),new kw(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new kw(Ow(this.r),Ow(this.g),Ow(this.b),Mw(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Nw,formatHex:Nw,formatHex8:function(){return`#${jw(this.r)}${jw(this.g)}${jw(this.b)}${jw(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:Cw,toString:Cw})),rw(Aw,(function(e,n,t,r){return 1===arguments.length?Iw(e):new Aw(e,n,t,null==r?1:r)}),ow(iw,{brighter(e){return e=null==e?uw:Math.pow(uw,e),new Aw(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=null==e?aw:Math.pow(aw,e),new Aw(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+360*(this.h<0),n=isNaN(e)||isNaN(this.s)?0:this.s,t=this.l,r=t+(t<.5?t:1-t)*n,o=2*t-r;return new kw(Lw(e>=240?e-240:e+120,o,r),Lw(e,o,r),Lw(e<120?e+240:e-120,o,r),this.opacity)},clamp(){return new Aw(zw(this.h),Tw(this.s),Tw(this.l),Mw(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Mw(this.opacity);return`${1===e?"hsl(":"hsla("}${zw(this.h)}, ${100*Tw(this.s)}%, ${100*Tw(this.l)}%${1===e?")":`, ${e})`}`}}));var Bw=e=>()=>e;function Dw(e,n){var t=n-e;return t?function(e,n){return function(t){return e+t*n}}(e,t):Bw(isNaN(e)?n:e)}var Rw=function e(n){var t=function(e){return 1==(e=+e)?Dw:function(n,t){return t-n?function(e,n,t){return e=Math.pow(e,t),n=Math.pow(n,t)-e,t=1/t,function(r){return Math.pow(e+r*n,t)}}(n,t,e):Bw(isNaN(n)?t:n)}}(n);function r(e,n){var r=t((e=Sw(e)).r,(n=Sw(n)).r),o=t(e.g,n.g),i=t(e.b,n.b),a=Dw(e.opacity,n.opacity);return function(n){return e.r=r(n),e.g=o(n),e.b=i(n),e.opacity=a(n),e+""}}return r.gamma=e,r}(1);function Hw(e,n){return e=+e,n=+n,function(t){return e*(1-t)+n*t}}var Vw=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Yw=new RegExp(Vw.source,"g");function Xw(e,n){var t,r,o,i=Vw.lastIndex=Yw.lastIndex=0,a=-1,u=[],c=[];for(e+="",n+="";(t=Vw.exec(e))&&(r=Yw.exec(n));)(o=r.index)>i&&(o=n.slice(i,o),u[a]?u[a]+=o:u[++a]=o),(t=t[0])===(r=r[0])?u[a]?u[a]+=r:u[++a]=r:(u[++a]=null,c.push({i:a,x:Hw(t,r)})),i=Yw.lastIndex;return i<n.length&&(o=n.slice(i),u[a]?u[a]+=o:u[++a]=o),u.length<2?c[0]?function(e){return function(n){return e(n)+""}}(c[0].x):function(e){return function(){return e}}(n):(n=c.length,function(e){for(var t,r=0;r<n;++r)u[(t=c[r]).i]=t.x(e);return u.join("")})}var Zw,Fw=180/Math.PI,Uw={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Ww(e,n,t,r,o,i){var a,u,c;return(a=Math.sqrt(e*e+n*n))&&(e/=a,n/=a),(c=e*t+n*r)&&(t-=e*c,r-=n*c),(u=Math.sqrt(t*t+r*r))&&(t/=u,r/=u,c/=u),e*r<n*t&&(e=-e,n=-n,c=-c,a=-a),{translateX:o,translateY:i,rotate:Math.atan2(n,e)*Fw,skewX:Math.atan(c)*Fw,scaleX:a,scaleY:u}}function Gw(e,n,t,r){function o(e){return e.length?e.pop()+" ":""}return function(i,a){var u=[],c=[];return i=e(i),a=e(a),function(e,r,o,i,a,u){if(e!==o||r!==i){var c=a.push("translate(",null,n,null,t);u.push({i:c-4,x:Hw(e,o)},{i:c-2,x:Hw(r,i)})}else(o||i)&&a.push("translate("+o+n+i+t)}(i.translateX,i.translateY,a.translateX,a.translateY,u,c),function(e,n,t,i){e!==n?(e-n>180?n+=360:n-e>180&&(e+=360),i.push({i:t.push(o(t)+"rotate(",null,r)-2,x:Hw(e,n)})):n&&t.push(o(t)+"rotate("+n+r)}(i.rotate,a.rotate,u,c),function(e,n,t,i){e!==n?i.push({i:t.push(o(t)+"skewX(",null,r)-2,x:Hw(e,n)}):n&&t.push(o(t)+"skewX("+n+r)}(i.skewX,a.skewX,u,c),function(e,n,t,r,i,a){if(e!==t||n!==r){var u=i.push(o(i)+"scale(",null,",",null,")");a.push({i:u-4,x:Hw(e,t)},{i:u-2,x:Hw(n,r)})}else 1===t&&1===r||i.push(o(i)+"scale("+t+","+r+")")}(i.scaleX,i.scaleY,a.scaleX,a.scaleY,u,c),i=a=null,function(e){for(var n,t=-1,r=c.length;++t<r;)u[(n=c[t]).i]=n.x(e);return u.join("")}}}var qw=Gw((function(e){const n=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(e+"");return n.isIdentity?Uw:Ww(n.a,n.b,n.c,n.d,n.e,n.f)}),"px, ","px)","deg)"),$w=Gw((function(e){return null==e?Uw:(Zw||(Zw=document.createElementNS("http://www.w3.org/2000/svg","g")),Zw.setAttribute("transform",e),(e=Zw.transform.baseVal.consolidate())?Ww((e=e.matrix).a,e.b,e.c,e.d,e.e,e.f):Uw)}),", ",")",")");function Kw(e){return((e=Math.exp(e))+1/e)/2}var Qw,Jw,eb=function e(n,t,r){function o(e,o){var i,a,u=e[0],c=e[1],l=e[2],s=o[0],d=o[1],f=o[2],h=s-u,v=d-c,p=h*h+v*v;if(p<1e-12)a=Math.log(f/l)/n,i=function(e){return[u+e*h,c+e*v,l*Math.exp(n*e*a)]};else{var g=Math.sqrt(p),y=(f*f-l*l+r*p)/(2*l*t*g),m=(f*f-l*l-r*p)/(2*f*t*g),w=Math.log(Math.sqrt(y*y+1)-y),b=Math.log(Math.sqrt(m*m+1)-m);a=(b-w)/n,i=function(e){var r,o=e*a,i=Kw(w),s=l/(t*g)*(i*(r=n*o+w,((r=Math.exp(2*r))-1)/(r+1))-function(e){return((e=Math.exp(e))-1/e)/2}(w));return[u+s*h,c+s*v,l*i/Kw(n*o+w)]}}return i.duration=1e3*a*n/Math.SQRT2,i}return o.rho=function(n){var t=Math.max(.001,+n),r=t*t;return e(t,r,r*r)},o}(Math.SQRT2,2,4),nb=0,tb=0,rb=0,ob=1e3,ib=0,ab=0,ub=0,cb="object"==typeof performance&&performance.now?performance:Date,lb="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function sb(){return ab||(lb(db),ab=cb.now()+ub)}function db(){ab=0}function fb(){this._call=this._time=this._next=null}function hb(e,n,t){var r=new fb;return r.restart(e,n,t),r}function vb(){ab=(ib=cb.now())+ub,nb=tb=0;try{!function(){sb(),++nb;for(var e,n=Qw;n;)(e=ab-n._time)>=0&&n._call.call(void 0,e),n=n._next;--nb}()}finally{nb=0,function(){for(var e,n,t=Qw,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:Qw=n);Jw=e,gb(r)}(),ab=0}}function pb(){var e=cb.now(),n=e-ib;n>ob&&(ub-=n,ib=e)}function gb(e){nb||(tb&&(tb=clearTimeout(tb)),e-ab>24?(e<1/0&&(tb=setTimeout(vb,e-cb.now()-ub)),rb&&(rb=clearInterval(rb))):(rb||(ib=cb.now(),rb=setInterval(pb,ob)),nb=1,lb(vb)))}function yb(e,n,t){var r=new fb;return n=null==n?0:+n,r.restart((t=>{r.stop(),e(t+n)}),n,t),r}fb.prototype=hb.prototype={constructor:fb,restart:function(e,n,t){if("function"!=typeof e)throw new TypeError("callback is not a function");t=(null==t?sb():+t)+(null==n?0:+n),this._next||Jw===this||(Jw?Jw._next=this:Qw=this,Jw=this),this._call=e,this._time=t,gb()},stop:function(){this._call&&(this._call=null,this._time=1/0,gb())}};var mb=my("start","end","cancel","interrupt"),wb=[],bb=0,xb=2,_b=3,Eb=5,Sb=6;function kb(e,n,t,r,o,i){var a=e.__transition;if(a){if(t in a)return}else e.__transition={};!function(e,n,t){var r,o=e.__transition;function i(c){var l,s,d,f;if(1!==t.state)return u();for(l in o)if((f=o[l]).name===t.name){if(f.state===_b)return yb(i);4===f.state?(f.state=Sb,f.timer.stop(),f.on.call("interrupt",e,e.__data__,f.index,f.group),delete o[l]):+l<n&&(f.state=Sb,f.timer.stop(),f.on.call("cancel",e,e.__data__,f.index,f.group),delete o[l])}if(yb((function(){t.state===_b&&(t.state=4,t.timer.restart(a,t.delay,t.time),a(c))})),t.state=xb,t.on.call("start",e,e.__data__,t.index,t.group),t.state===xb){for(t.state=_b,r=new Array(d=t.tween.length),l=0,s=-1;l<d;++l)(f=t.tween[l].value.call(e,e.__data__,t.index,t.group))&&(r[++s]=f);r.length=s+1}}function a(n){for(var o=n<t.duration?t.ease.call(null,n/t.duration):(t.timer.restart(u),t.state=Eb,1),i=-1,a=r.length;++i<a;)r[i].call(e,o);t.state===Eb&&(t.on.call("end",e,e.__data__,t.index,t.group),u())}function u(){for(var r in t.state=Sb,t.timer.stop(),delete o[n],o)return;delete e.__transition}o[n]=t,t.timer=hb((function(e){t.state=1,t.timer.restart(i,t.delay,t.time),t.delay<=e&&i(e-t.delay)}),0,t.time)}(e,t,{name:n,index:r,group:o,on:mb,tween:wb,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:bb})}function Nb(e,n){var t=Mb(e,n);if(t.state>bb)throw new Error("too late; already scheduled");return t}function Cb(e,n){var t=Mb(e,n);if(t.state>_b)throw new Error("too late; already running");return t}function Mb(e,n){var t=e.__transition;if(!t||!(t=t[n]))throw new Error("transition not found");return t}function Ob(e,n){var t,r,o,i=e.__transition,a=!0;if(i){for(o in n=null==n?null:n+"",i)(t=i[o]).name===n?(r=t.state>xb&&t.state<Eb,t.state=Sb,t.timer.stop(),t.on.call(r?"interrupt":"cancel",e,e.__data__,t.index,t.group),delete i[o]):a=!1;a&&delete e.__transition}}function jb(e,n){var t,r;return function(){var o=Cb(this,e),i=o.tween;if(i!==t)for(var a=0,u=(r=t=i).length;a<u;++a)if(r[a].name===n){(r=r.slice()).splice(a,1);break}o.tween=r}}function Pb(e,n,t){var r,o;if("function"!=typeof t)throw new Error;return function(){var i=Cb(this,e),a=i.tween;if(a!==r){o=(r=a).slice();for(var u={name:n,value:t},c=0,l=o.length;c<l;++c)if(o[c].name===n){o[c]=u;break}c===l&&o.push(u)}i.tween=o}}function Ib(e,n,t){var r=e._id;return e.each((function(){var e=Cb(this,r);(e.value||(e.value={}))[n]=t.apply(this,arguments)})),function(e){return Mb(e,r).value[n]}}function Ab(e,n){var t;return("number"==typeof n?Hw:n instanceof xw?Rw:(t=xw(n))?(n=t,Rw):Xw)(e,n)}function zb(e){return function(){this.removeAttribute(e)}}function Tb(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Lb(e,n,t){var r,o,i=t+"";return function(){var a=this.getAttribute(e);return a===i?null:a===r?o:o=n(r=a,t)}}function Bb(e,n,t){var r,o,i=t+"";return function(){var a=this.getAttributeNS(e.space,e.local);return a===i?null:a===r?o:o=n(r=a,t)}}function Db(e,n,t){var r,o,i;return function(){var a,u,c=t(this);if(null!=c)return(a=this.getAttribute(e))===(u=c+"")?null:a===r&&u===o?i:(o=u,i=n(r=a,c));this.removeAttribute(e)}}function Rb(e,n,t){var r,o,i;return function(){var a,u,c=t(this);if(null!=c)return(a=this.getAttributeNS(e.space,e.local))===(u=c+"")?null:a===r&&u===o?i:(o=u,i=n(r=a,c));this.removeAttributeNS(e.space,e.local)}}function Hb(e,n){var t,r;function o(){var o=n.apply(this,arguments);return o!==r&&(t=(r=o)&&function(e,n){return function(t){this.setAttributeNS(e.space,e.local,n.call(this,t))}}(e,o)),t}return o._value=n,o}function Vb(e,n){var t,r;function o(){var o=n.apply(this,arguments);return o!==r&&(t=(r=o)&&function(e,n){return function(t){this.setAttribute(e,n.call(this,t))}}(e,o)),t}return o._value=n,o}function Yb(e,n){return function(){Nb(this,e).delay=+n.apply(this,arguments)}}function Xb(e,n){return n=+n,function(){Nb(this,e).delay=n}}function Zb(e,n){return function(){Cb(this,e).duration=+n.apply(this,arguments)}}function Fb(e,n){return n=+n,function(){Cb(this,e).duration=n}}var Ub=Im.prototype.constructor;function Wb(e){return function(){this.style.removeProperty(e)}}var Gb=0;function qb(e,n,t,r){this._groups=e,this._parents=n,this._name=t,this._id=r}function $b(){return++Gb}var Kb=Im.prototype;qb.prototype={constructor:qb,select:function(e){var n=this._name,t=this._id;"function"!=typeof e&&(e=Oy(e));for(var r=this._groups,o=r.length,i=new Array(o),a=0;a<o;++a)for(var u,c,l=r[a],s=l.length,d=i[a]=new Array(s),f=0;f<s;++f)(u=l[f])&&(c=e.call(u,u.__data__,f,l))&&("__data__"in u&&(c.__data__=u.__data__),d[f]=c,kb(d[f],n,t,f,d,Mb(u,t)));return new qb(i,this._parents,n,t)},selectAll:function(e){var n=this._name,t=this._id;"function"!=typeof e&&(e=Py(e));for(var r=this._groups,o=r.length,i=[],a=[],u=0;u<o;++u)for(var c,l=r[u],s=l.length,d=0;d<s;++d)if(c=l[d]){for(var f,h=e.call(c,c.__data__,d,l),v=Mb(c,t),p=0,g=h.length;p<g;++p)(f=h[p])&&kb(f,n,t,p,h,v);i.push(h),a.push(c)}return new qb(i,a,n,t)},selectChild:Kb.selectChild,selectChildren:Kb.selectChildren,filter:function(e){"function"!=typeof e&&(e=Iy(e));for(var n=this._groups,t=n.length,r=new Array(t),o=0;o<t;++o)for(var i,a=n[o],u=a.length,c=r[o]=[],l=0;l<u;++l)(i=a[l])&&e.call(i,i.__data__,l,a)&&c.push(i);return new qb(r,this._parents,this._name,this._id)},merge:function(e){if(e._id!==this._id)throw new Error;for(var n=this._groups,t=e._groups,r=n.length,o=t.length,i=Math.min(r,o),a=new Array(r),u=0;u<i;++u)for(var c,l=n[u],s=t[u],d=l.length,f=a[u]=new Array(d),h=0;h<d;++h)(c=l[h]||s[h])&&(f[h]=c);for(;u<r;++u)a[u]=n[u];return new qb(a,this._parents,this._name,this._id)},selection:function(){return new Ub(this._groups,this._parents)},transition:function(){for(var e=this._name,n=this._id,t=$b(),r=this._groups,o=r.length,i=0;i<o;++i)for(var a,u=r[i],c=u.length,l=0;l<c;++l)if(a=u[l]){var s=Mb(a,n);kb(a,e,t,l,u,{time:s.time+s.delay+s.duration,delay:0,duration:s.duration,ease:s.ease})}return new qb(r,this._parents,e,t)},call:Kb.call,nodes:Kb.nodes,node:Kb.node,size:Kb.size,empty:Kb.empty,each:Kb.each,on:function(e,n){var t=this._id;return arguments.length<2?Mb(this.node(),t).on.on(e):this.each(function(e,n,t){var r,o,i=function(e){return(e+"").trim().split(/^|\s+/).every((function(e){var n=e.indexOf(".");return n>=0&&(e=e.slice(0,n)),!e||"start"===e}))}(n)?Nb:Cb;return function(){var a=i(this,e),u=a.on;u!==r&&(o=(r=u).copy()).on(n,t),a.on=o}}(t,e,n))},attr:function(e,n){var t=Sy(e),r="transform"===t?$w:Ab;return this.attrTween(e,"function"==typeof n?(t.local?Rb:Db)(t,r,Ib(this,"attr."+e,n)):null==n?(t.local?Tb:zb)(t):(t.local?Bb:Lb)(t,r,n))},attrTween:function(e,n){var t="attr."+e;if(arguments.length<2)return(t=this.tween(t))&&t._value;if(null==n)return this.tween(t,null);if("function"!=typeof n)throw new Error;var r=Sy(e);return this.tween(t,(r.local?Hb:Vb)(r,n))},style:function(e,n,t){var r="transform"==(e+="")?qw:Ab;return null==n?this.styleTween(e,function(e,n){var t,r,o;return function(){var i=nm(this,e),a=(this.style.removeProperty(e),nm(this,e));return i===a?null:i===t&&a===r?o:o=n(t=i,r=a)}}(e,r)).on("end.style."+e,Wb(e)):"function"==typeof n?this.styleTween(e,function(e,n,t){var r,o,i;return function(){var a=nm(this,e),u=t(this),c=u+"";return null==u&&(this.style.removeProperty(e),c=u=nm(this,e)),a===c?null:a===r&&c===o?i:(o=c,i=n(r=a,u))}}(e,r,Ib(this,"style."+e,n))).each(function(e,n){var t,r,o,i,a="style."+n,u="end."+a;return function(){var c=Cb(this,e),l=c.on,s=null==c.value[a]?i||(i=Wb(n)):void 0;l===t&&o===s||(r=(t=l).copy()).on(u,o=s),c.on=r}}(this._id,e)):this.styleTween(e,function(e,n,t){var r,o,i=t+"";return function(){var a=nm(this,e);return a===i?null:a===r?o:o=n(r=a,t)}}(e,r,n),t).on("end.style."+e,null)},styleTween:function(e,n,t){var r="style."+(e+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==n)return this.tween(r,null);if("function"!=typeof n)throw new Error;return this.tween(r,function(e,n,t){var r,o;function i(){var i=n.apply(this,arguments);return i!==o&&(r=(o=i)&&function(e,n,t){return function(r){this.style.setProperty(e,n.call(this,r),t)}}(e,i,t)),r}return i._value=n,i}(e,n,null==t?"":t))},text:function(e){return this.tween("text","function"==typeof e?function(e){return function(){var n=e(this);this.textContent=null==n?"":n}}(Ib(this,"text",e)):function(e){return function(){this.textContent=e}}(null==e?"":e+""))},textTween:function(e){var n="text";if(arguments.length<1)return(n=this.tween(n))&&n._value;if(null==e)return this.tween(n,null);if("function"!=typeof e)throw new Error;return this.tween(n,function(e){var n,t;function r(){var r=e.apply(this,arguments);return r!==t&&(n=(t=r)&&function(e){return function(n){this.textContent=e.call(this,n)}}(r)),n}return r._value=e,r}(e))},remove:function(){return this.on("end.remove",function(e){return function(){var n=this.parentNode;for(var t in this.__transition)if(+t!==e)return;n&&n.removeChild(this)}}(this._id))},tween:function(e,n){var t=this._id;if(e+="",arguments.length<2){for(var r,o=Mb(this.node(),t).tween,i=0,a=o.length;i<a;++i)if((r=o[i]).name===e)return r.value;return null}return this.each((null==n?jb:Pb)(t,e,n))},delay:function(e){var n=this._id;return arguments.length?this.each(("function"==typeof e?Yb:Xb)(n,e)):Mb(this.node(),n).delay},duration:function(e){var n=this._id;return arguments.length?this.each(("function"==typeof e?Zb:Fb)(n,e)):Mb(this.node(),n).duration},ease:function(e){var n=this._id;return arguments.length?this.each(function(e,n){if("function"!=typeof n)throw new Error;return function(){Cb(this,e).ease=n}}(n,e)):Mb(this.node(),n).ease},easeVarying:function(e){if("function"!=typeof e)throw new Error;return this.each(function(e,n){return function(){var t=n.apply(this,arguments);if("function"!=typeof t)throw new Error;Cb(this,e).ease=t}}(this._id,e))},end:function(){var e,n,t=this,r=t._id,o=t.size();return new Promise((function(i,a){var u={value:a},c={value:function(){0==--o&&i()}};t.each((function(){var t=Cb(this,r),o=t.on;o!==e&&((n=(e=o).copy())._.cancel.push(u),n._.interrupt.push(u),n._.end.push(c)),t.on=n})),0===o&&i()}))},[Symbol.iterator]:Kb[Symbol.iterator]};var Qb={time:null,delay:0,duration:250,ease:function(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}};function Jb(e,n){for(var t;!(t=e.__transition)||!(t=t[n]);)if(!(e=e.parentNode))throw new Error(`transition ${n} not found`);return t}Im.prototype.interrupt=function(e){return this.each((function(){Ob(this,e)}))},Im.prototype.transition=function(e){var n,t;e instanceof qb?(n=e._id,e=e._name):(n=$b(),(t=Qb).time=sb(),e=null==e?null:e+"");for(var r=this._groups,o=r.length,i=0;i<o;++i)for(var a,u=r[i],c=u.length,l=0;l<c;++l)(a=u[l])&&kb(a,e,n,l,u,t||Jb(a,n));return new qb(r,this._parents,e,n)};var ex=e=>()=>e;function nx(e,{sourceEvent:n,target:t,transform:r,dispatch:o}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},target:{value:t,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:o}})}function tx(e,n,t){this.k=e,this.x=n,this.y=t}tx.prototype={constructor:tx,scale:function(e){return 1===e?this:new tx(this.k*e,this.x,this.y)},translate:function(e,n){return 0===e&0===n?this:new tx(this.k,this.x+this.k*e,this.y+this.k*n)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var rx=new tx(1,0,0);function ox(e){for(;!e.__zoom;)if(!(e=e.parentNode))return rx;return e.__zoom}function ix(e){e.stopImmediatePropagation()}function ax(e){e.preventDefault(),e.stopImmediatePropagation()}function ux(e){return!(e.ctrlKey&&"wheel"!==e.type||e.button)}function cx(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e).hasAttribute("viewBox")?[[(e=e.viewBox.baseVal).x,e.y],[e.x+e.width,e.y+e.height]]:[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]:[[0,0],[e.clientWidth,e.clientHeight]]}function lx(){return this.__zoom||rx}function sx(e){return-e.deltaY*(1===e.deltaMode?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function dx(){return navigator.maxTouchPoints||"ontouchstart"in this}function fx(e,n,t){var r=e.invertX(n[0][0])-t[0][0],o=e.invertX(n[1][0])-t[1][0],i=e.invertY(n[0][1])-t[0][1],a=e.invertY(n[1][1])-t[1][1];return e.translate(o>r?(r+o)/2:Math.min(0,r)||Math.max(0,o),a>i?(i+a)/2:Math.min(0,i)||Math.max(0,a))}ox.prototype=tx.prototype;var hx,vx=function(e,n){return e.x!==n.x||e.y!==n.y||e.zoom!==n.k},px=function(e){return{x:e.x,y:e.y,zoom:e.k}},gx=function(e){var n=e.x,t=e.y,r=e.zoom;return rx.translate(n,t).scale(r)},yx=function(e,n){return e.target.closest(".".concat(n))},mx=function(e,n){return 2===n&&Array.isArray(e)&&e.includes(2)},wx=function(e,n){return void 0===n&&(n=0),"number"==typeof n&&n>0?e.transition().duration(n):e},bx=function(e){var n=e.ctrlKey&&Vv()?10:1;return-e.deltaY*(1===e.deltaMode?.05:e.deltaMode?1:.002)*n};function xx(e){var n=e.domNode,t=e.minZoom,r=e.maxZoom,o=e.translateExtent,i=e.viewport,a=e.onPanZoom,u=e.onPanZoomStart,c=e.onPanZoomEnd,l=e.onTransformChange,s=e.onDraggingChange,d={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{x:0,y:0,zoom:0},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},f=n.getBoundingClientRect(),h=function(){var e,n,t,r=ux,o=cx,i=fx,a=sx,u=dx,c=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],s=250,d=eb,f=my("start","zoom","end"),h=500,v=150,p=0,g=10;function y(e){e.property("__zoom",lx).on("wheel.zoom",S,{passive:!1}).on("mousedown.zoom",k).on("dblclick.zoom",N).filter(u).on("touchstart.zoom",C).on("touchmove.zoom",M).on("touchend.zoom touchcancel.zoom",O).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function m(e,n){return(n=Math.max(c[0],Math.min(c[1],n)))===e.k?e:new tx(n,e.x,e.y)}function w(e,n,t){var r=n[0]-t[0]*e.k,o=n[1]-t[1]*e.k;return r===e.x&&o===e.y?e:new tx(e.k,r,o)}function b(e){return[(+e[0][0]+ +e[1][0])/2,(+e[0][1]+ +e[1][1])/2]}function x(e,n,t,r){e.on("start.zoom",(function(){_(this,arguments).event(r).start()})).on("interrupt.zoom end.zoom",(function(){_(this,arguments).event(r).end()})).tween("zoom",(function(){var e=this,i=arguments,a=_(e,i).event(r),u=o.apply(e,i),c=null==t?b(u):"function"==typeof t?t.apply(e,i):t,l=Math.max(u[1][0]-u[0][0],u[1][1]-u[0][1]),s=e.__zoom,f="function"==typeof n?n.apply(e,i):n,h=d(s.invert(c).concat(l/s.k),f.invert(c).concat(l/f.k));return function(e){if(1===e)e=f;else{var n=h(e),t=l/n[2];e=new tx(t,c[0]-n[0]*t,c[1]-n[1]*t)}a.zoom(null,e)}}))}function _(e,n,t){return!t&&e.__zooming||new E(e,n)}function E(e,n){this.that=e,this.args=n,this.active=0,this.sourceEvent=null,this.extent=o.apply(e,n),this.taps=0}function S(e,...n){if(r.apply(this,arguments)){var t=_(this,n).event(e),o=this.__zoom,u=Math.max(c[0],Math.min(c[1],o.k*Math.pow(2,a.apply(this,arguments)))),s=zm(e);if(t.wheel)t.mouse[0][0]===s[0]&&t.mouse[0][1]===s[1]||(t.mouse[1]=o.invert(t.mouse[0]=s)),clearTimeout(t.wheel);else{if(o.k===u)return;t.mouse=[s,o.invert(s)],Ob(this),t.start()}ax(e),t.wheel=setTimeout((function(){t.wheel=null,t.end()}),v),t.zoom("mouse",i(w(m(o,u),t.mouse[0],t.mouse[1]),t.extent,l))}}function k(e,...n){if(!t&&r.apply(this,arguments)){var o=e.currentTarget,a=_(this,n,!0).event(e),u=Am(e.view).on("mousemove.zoom",(function(e){if(ax(e),!a.moved){var n=e.clientX-s,t=e.clientY-d;a.moved=n*n+t*t>p}a.event(e).zoom("mouse",i(w(a.that.__zoom,a.mouse[0]=zm(e,o),a.mouse[1]),a.extent,l))}),!0).on("mouseup.zoom",(function(e){u.on("mousemove.zoom mouseup.zoom",null),Hm(e.view,a.moved),ax(e),a.event(e).end()}),!0),c=zm(e,o),s=e.clientX,d=e.clientY;Rm(e.view),ix(e),a.mouse=[c,this.__zoom.invert(c)],Ob(this),a.start()}}function N(e,...n){if(r.apply(this,arguments)){var t=this.__zoom,a=zm(e.changedTouches?e.changedTouches[0]:e,this),u=t.invert(a),c=t.k*(e.shiftKey?.5:2),d=i(w(m(t,c),a,u),o.apply(this,n),l);ax(e),s>0?Am(this).transition().duration(s).call(x,d,a,e):Am(this).call(y.transform,d,a,e)}}function C(t,...o){if(r.apply(this,arguments)){var i,a,u,c,l=t.touches,s=l.length,d=_(this,o,t.changedTouches.length===s).event(t);for(ix(t),a=0;a<s;++a)c=[c=zm(u=l[a],this),this.__zoom.invert(c),u.identifier],d.touch0?d.touch1||d.touch0[2]===c[2]||(d.touch1=c,d.taps=0):(d.touch0=c,i=!0,d.taps=1+!!e);e&&(e=clearTimeout(e)),i&&(d.taps<2&&(n=c[0],e=setTimeout((function(){e=null}),h)),Ob(this),d.start())}}function M(e,...n){if(this.__zooming){var t,r,o,a,u=_(this,n).event(e),c=e.changedTouches,s=c.length;for(ax(e),t=0;t<s;++t)o=zm(r=c[t],this),u.touch0&&u.touch0[2]===r.identifier?u.touch0[0]=o:u.touch1&&u.touch1[2]===r.identifier&&(u.touch1[0]=o);if(r=u.that.__zoom,u.touch1){var d=u.touch0[0],f=u.touch0[1],h=u.touch1[0],v=u.touch1[1],p=(p=h[0]-d[0])*p+(p=h[1]-d[1])*p,g=(g=v[0]-f[0])*g+(g=v[1]-f[1])*g;r=m(r,Math.sqrt(p/g)),o=[(d[0]+h[0])/2,(d[1]+h[1])/2],a=[(f[0]+v[0])/2,(f[1]+v[1])/2]}else{if(!u.touch0)return;o=u.touch0[0],a=u.touch0[1]}u.zoom("touch",i(w(r,o,a),u.extent,l))}}function O(e,...r){if(this.__zooming){var o,i,a=_(this,r).event(e),u=e.changedTouches,c=u.length;for(ix(e),t&&clearTimeout(t),t=setTimeout((function(){t=null}),h),o=0;o<c;++o)i=u[o],a.touch0&&a.touch0[2]===i.identifier?delete a.touch0:a.touch1&&a.touch1[2]===i.identifier&&delete a.touch1;if(a.touch1&&!a.touch0&&(a.touch0=a.touch1,delete a.touch1),a.touch0)a.touch0[1]=this.__zoom.invert(a.touch0[0]);else if(a.end(),2===a.taps&&(i=zm(i,this),Math.hypot(n[0]-i[0],n[1]-i[1])<g)){var l=Am(this).on("dblclick.zoom");l&&l.apply(this,arguments)}}}return y.transform=function(e,n,t,r){var o=e.selection?e.selection():e;o.property("__zoom",lx),e!==o?x(e,n,t,r):o.interrupt().each((function(){_(this,arguments).event(r).start().zoom(null,"function"==typeof n?n.apply(this,arguments):n).end()}))},y.scaleBy=function(e,n,t,r){y.scaleTo(e,(function(){return this.__zoom.k*("function"==typeof n?n.apply(this,arguments):n)}),t,r)},y.scaleTo=function(e,n,t,r){y.transform(e,(function(){var e=o.apply(this,arguments),r=this.__zoom,a=null==t?b(e):"function"==typeof t?t.apply(this,arguments):t,u=r.invert(a),c="function"==typeof n?n.apply(this,arguments):n;return i(w(m(r,c),a,u),e,l)}),t,r)},y.translateBy=function(e,n,t,r){y.transform(e,(function(){return i(this.__zoom.translate("function"==typeof n?n.apply(this,arguments):n,"function"==typeof t?t.apply(this,arguments):t),o.apply(this,arguments),l)}),null,r)},y.translateTo=function(e,n,t,r,a){y.transform(e,(function(){var e=o.apply(this,arguments),a=this.__zoom,u=null==r?b(e):"function"==typeof r?r.apply(this,arguments):r;return i(rx.translate(u[0],u[1]).scale(a.k).translate("function"==typeof n?-n.apply(this,arguments):-n,"function"==typeof t?-t.apply(this,arguments):-t),e,l)}),r,a)},E.prototype={event:function(e){return e&&(this.sourceEvent=e),this},start:function(){return 1==++this.active&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(e,n){return this.mouse&&"mouse"!==e&&(this.mouse[1]=n.invert(this.mouse[0])),this.touch0&&"touch"!==e&&(this.touch0[1]=n.invert(this.touch0[0])),this.touch1&&"touch"!==e&&(this.touch1[1]=n.invert(this.touch1[0])),this.that.__zoom=n,this.emit("zoom"),this},end:function(){return 0==--this.active&&(delete this.that.__zooming,this.emit("end")),this},emit:function(e){var n=Am(this.that).datum();f.call(e,this.that,new nx(e,{sourceEvent:this.sourceEvent,target:y,type:e,transform:this.that.__zoom,dispatch:f}),n)}},y.wheelDelta=function(e){return arguments.length?(a="function"==typeof e?e:ex(+e),y):a},y.filter=function(e){return arguments.length?(r="function"==typeof e?e:ex(!!e),y):r},y.touchable=function(e){return arguments.length?(u="function"==typeof e?e:ex(!!e),y):u},y.extent=function(e){return arguments.length?(o="function"==typeof e?e:ex([[+e[0][0],+e[0][1]],[+e[1][0],+e[1][1]]]),y):o},y.scaleExtent=function(e){return arguments.length?(c[0]=+e[0],c[1]=+e[1],y):[c[0],c[1]]},y.translateExtent=function(e){return arguments.length?(l[0][0]=+e[0][0],l[1][0]=+e[1][0],l[0][1]=+e[0][1],l[1][1]=+e[1][1],y):[[l[0][0],l[0][1]],[l[1][0],l[1][1]]]},y.constrain=function(e){return arguments.length?(i=e,y):i},y.duration=function(e){return arguments.length?(s=+e,y):s},y.interpolate=function(e){return arguments.length?(d=e,y):d},y.on=function(){var e=f.on.apply(f,arguments);return e===f?y:e},y.clickDistance=function(e){return arguments.length?(p=(e=+e)*e,y):Math.sqrt(p)},y.tapDistance=function(e){return arguments.length?(g=+e,y):g},y}().scaleExtent([t,r]).translateExtent(o),v=Am(n).call(h);w({x:i.x,y:i.y,zoom:Ov(i.zoom,t,r)},[[0,0],[f.width,f.height]],o);var p=v.on("wheel.zoom"),g=v.on("dblclick.zoom");function y(e,n){v&&(null==h||h.transform(wx(v,null==n?void 0:n.duration),e))}function m(){h.on("zoom",null)}function w(e,n,t){var r=gx(e),o=null==h?void 0:h.constrain()(r,n,t);return o&&y(o),o}return h.wheelDelta(bx),{update:function(e){var n=e.noWheelClassName,t=e.noPanClassName,r=e.onPaneContextMenu,o=e.userSelectionActive,i=e.panOnScroll,f=e.panOnDrag,y=e.panOnScrollMode,w=e.panOnScrollSpeed,b=e.preventScrolling,x=e.zoomOnPinch,_=e.zoomOnScroll,E=e.zoomOnDoubleClick,S=e.zoomActivationKeyPressed,k=e.lib;o&&!d.isZoomingOrPanning&&m();var N=!i||S||o?function(e){var n=e.noWheelClassName,t=e.preventScrolling,r=e.d3ZoomHandler;return function(e,o){if(!t&&"wheel"===e.type&&!e.ctrlKey||yx(e,n))return null;e.preventDefault(),r.call(this,e,o)}}({noWheelClassName:n,preventScrolling:b,d3ZoomHandler:p}):function(e){var n=e.zoomPanValues,t=e.noWheelClassName,r=e.d3Selection,o=e.d3Zoom,i=e.panOnScrollMode,a=e.panOnScrollSpeed,u=e.zoomOnPinch,c=e.onPanZoomStart,l=e.onPanZoom,s=e.onPanZoomEnd;return function(e){if(yx(e,t))return!1;e.preventDefault(),e.stopImmediatePropagation();var d=r.property("__zoom").k||1;if(e.ctrlKey&&u){var f=zm(e),h=bx(e),v=d*Math.pow(2,h);o.scaleTo(r,v,f,e)}else{var p=1===e.deltaMode?20:1,g=i===Wv.Vertical?0:e.deltaX*p,y=i===Wv.Horizontal?0:e.deltaY*p;!Vv()&&e.shiftKey&&i!==Wv.Vertical&&(g=e.deltaY*p,y=0),o.translateBy(r,-g/d*a,-y/d*a,{internal:!0});var m=px(r.property("__zoom"));clearTimeout(n.panScrollTimeout),n.isPanScrolling||(n.isPanScrolling=!0,null==c||c(e,m)),n.isPanScrolling&&(null==l||l(e,m),n.panScrollTimeout=setTimeout((function(){null==s||s(e,m),n.isPanScrolling=!1}),150))}}}({zoomPanValues:d,noWheelClassName:n,d3Selection:v,d3Zoom:h,panOnScrollMode:y,panOnScrollSpeed:w,zoomOnPinch:x,onPanZoomStart:u,onPanZoom:a,onPanZoomEnd:c});if(v.on("wheel.zoom",N,{passive:!1}),!o){var C=function(e){var n=e.zoomPanValues,t=e.onDraggingChange,r=e.onPanZoomStart;return function(e){var o,i,a;if(!(null===(o=e.sourceEvent)||void 0===o?void 0:o.internal)){var u=px(e.transform);n.mouseButton=(null===(i=e.sourceEvent)||void 0===i?void 0:i.button)||0,n.isZoomingOrPanning=!0,n.prevViewport=u,"mousedown"===(null===(a=e.sourceEvent)||void 0===a?void 0:a.type)&&t(!0),r&&(null==r||r(e.sourceEvent,u))}}}({zoomPanValues:d,onDraggingChange:s,onPanZoomStart:u});h.on("start",C);var M=function(e){var n=e.zoomPanValues,t=e.panOnDrag,r=e.onPaneContextMenu,o=e.onTransformChange,i=e.onPanZoom;return function(e){var a,u,c;n.usedRightMouseButton=!(!r||!mx(t,null!==(a=n.mouseButton)&&void 0!==a?a:0)),(null===(u=e.sourceEvent)||void 0===u?void 0:u.sync)||o([e.transform.x,e.transform.y,e.transform.k]),i&&!(null===(c=e.sourceEvent)||void 0===c?void 0:c.internal)&&(null==i||i(e.sourceEvent,px(e.transform)))}}({zoomPanValues:d,panOnDrag:f,onPaneContextMenu:!!r,onPanZoom:a,onTransformChange:l});h.on("zoom",M);var O=function(e){var n=e.zoomPanValues,t=e.panOnDrag,r=e.panOnScroll,o=e.onDraggingChange,i=e.onPanZoomEnd,a=e.onPaneContextMenu;return function(e){var u,c;if(!(null===(u=e.sourceEvent)||void 0===u?void 0:u.internal)&&(n.isZoomingOrPanning=!1,a&&mx(t,null!==(c=n.mouseButton)&&void 0!==c?c:0)&&!n.usedRightMouseButton&&e.sourceEvent&&a(e.sourceEvent),n.usedRightMouseButton=!1,o(!1),i&&vx(n.prevViewport,e.transform))){var l=px(e.transform);n.prevViewport=l,clearTimeout(n.timerId),n.timerId=setTimeout((function(){null==i||i(e.sourceEvent,l)}),r?150:0)}}}({zoomPanValues:d,panOnDrag:f,panOnScroll:i,onPaneContextMenu:r,onPanZoomEnd:c,onDraggingChange:s});h.on("end",O)}var j=function(e){var n=e.zoomActivationKeyPressed,t=e.zoomOnScroll,r=e.zoomOnPinch,o=e.panOnDrag,i=e.panOnScroll,a=e.zoomOnDoubleClick,u=e.userSelectionActive,c=e.noWheelClassName,l=e.noPanClassName,s=e.lib;return function(e){var d=n||t,f=r&&e.ctrlKey;if(1===e.button&&"mousedown"===e.type&&(yx(e,"".concat(s,"-flow__node"))||yx(e,"".concat(s,"-flow__edge"))))return!0;if(!(o||d||i||a||r))return!1;if(u)return!1;if(yx(e,c)&&"wheel"===e.type)return!1;if(yx(e,l)&&("wheel"!==e.type||i&&"wheel"===e.type&&!n))return!1;if(!r&&e.ctrlKey&&"wheel"===e.type)return!1;if(!d&&!i&&!f&&"wheel"===e.type)return!1;if(!o&&("mousedown"===e.type||"touchstart"===e.type))return!1;if(Array.isArray(o)&&!o.includes(e.button)&&"mousedown"===e.type)return!1;var h=Array.isArray(o)&&o.includes(e.button)||!e.button||e.button<=1;return(!e.ctrlKey||"wheel"===e.type)&&h}}({zoomActivationKeyPressed:S,panOnDrag:f,zoomOnScroll:_,panOnScroll:i,zoomOnDoubleClick:E,zoomOnPinch:x,userSelectionActive:o,noPanClassName:t,noWheelClassName:n,lib:k});h.filter(j),E?v.on("dblclick.zoom",g):v.on("dblclick.zoom",null)},destroy:m,setViewport:function(e,n){var t=gx(e);return y(t,n),t},setViewportConstrained:w,getViewport:function(){var e=v?ox(v.node()):{x:0,y:0,k:1};return{x:e.x,y:e.y,zoom:e.k}},scaleTo:function(e,n){v&&(null==h||h.scaleTo(wx(v,null==n?void 0:n.duration),e))},scaleBy:function(e,n){v&&(null==h||h.scaleBy(wx(v,null==n?void 0:n.duration),e))},setScaleExtent:function(e){null==h||h.scaleExtent(e)},setTranslateExtent:function(e){null==h||h.translateExtent(e)},syncViewport:function(e){if(v){var n=gx(e),t=v.property("__zoom");t.k===e.zoom&&t.x===e.x&&t.y===e.y||null==h||h.transform(v,n,null,{sync:!0})}}}}!function(e){e.Line="line",e.Handle="handle"}(hx||(hx={}));Z(Z({},{width:0,height:0,x:0,y:0}),{pointerX:0,pointerY:0,aspectRatio:1});var _x=yv.error001();function Ex(e,n){var r=t(Y);if(null===r)throw new Error(_x);return H(r,e,n)}function Sx(){var e=t(Y);if(null===e)throw new Error(_x);return r((function(){return{getState:e.getState,setState:e.setState,subscribe:e.subscribe}}),[e])}function kx(e,n){var t,r,o;void 0===n&&(n={nodeOrigin:[0,0],elevateNodesOnSelect:!0,defaults:{}});var i=(null==n?void 0:n.elevateNodesOnSelect)?1e3:0;try{for(var a=g(e),u=a.next();!u.done;u=a.next()){var c=y(u.value,2)[1],l=c.parentId;if(l){if(!e.has(l))throw new Error("Parent node ".concat(l," not found"));var s=e.get(l),d=Nx(c,e,f(f({},c.position),{z:(zx(c.zIndex)?c.zIndex:0)+(c.selected?i:0)}),null!==(o=null==s?void 0:s.origin)&&void 0!==o?o:n.nodeOrigin),h=d.x,v=d.y,p=d.z,m=c.internals.positionAbsolute,w=h!==m.x||v!==m.y;(w||p!==c.internals.z)&&(c.internals=f(f({},c.internals),{positionAbsolute:w?{x:h,y:v}:m,z:p}))}}}catch(e){t={error:e}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}}function Nx(e,n,t,r){var o,i,a,u,c,l;if(void 0===r&&(r=[0,0]),!e.parentId)return t;var s=n.get(e.parentId),d=Cx(s,r).position;return Nx(s,n,{x:(null!==(o=t.x)&&void 0!==o?o:0)+d.x,y:(null!==(i=t.y)&&void 0!==i?i:0)+d.y,z:(null!==(a=s.internals.z)&&void 0!==a?a:0)>(null!==(u=t.z)&&void 0!==u?u:0)?null!==(c=s.internals.z)&&void 0!==c?c:0:null!==(l=t.z)&&void 0!==l?l:0},s.origin||r)}var Cx=function(e,n){void 0===n&&(n=[0,0]);var t=Ax(e),r=t.width,o=t.height,i="internals"in e?e.internals.positionAbsolute:e.position,a=e.origin||n,u=r*a[0],c=o*a[1];return{position:{x:e.position.x-u,y:e.position.y-c},positionAbsolute:{x:i.x-u,y:i.y-c}}};function Mx(e,n,t){var r,o;e.clear(),n.clear();try{for(var i=g(t),a=i.next();!a.done;a=i.next()){var u=a.value,c=u.source,l=u.target,s=u.sourceHandle,d=void 0===s?null:s,f=u.targetHandle,h=void 0===f?null:f,v="".concat(c,"-source-").concat(d),p="".concat(l,"-target-").concat(h),y=e.get(v)||new Map,m=e.get(p)||new Map,w={edgeId:u.id,source:c,target:l,sourceHandle:d,targetHandle:h};n.set(u.id,u),e.set(v,y.set("".concat(l,"-").concat(h),w)),e.set(p,m.set("".concat(c,"-").concat(d),w))}}catch(e){r={error:e}}finally{try{a&&!a.done&&(o=i.return)&&o.call(i)}finally{if(r)throw r.error}}}function Ox(e,n,t,r){void 0===r&&(r={nodeOrigin:[0,0],elevateNodesOnSelect:!0,defaults:{},checkEquality:!0});var o=new Map(n);n.clear(),t.clear();var i=(null==r?void 0:r.elevateNodesOnSelect)?1e3:0;e.forEach((function(e){var a,u,c=o.get(e.id);if(r.checkEquality&&e===(null==c?void 0:c.internals.userNode)||(c=f(f(f({},r.defaults),e),{measured:{width:null===(a=e.measured)||void 0===a?void 0:a.width,height:null===(u=e.measured)||void 0===u?void 0:u.height},internals:{positionAbsolute:e.position,handleBounds:null==c?void 0:c.internals.handleBounds,z:(zx(e.zIndex)?e.zIndex:0)+(e.selected?i:0),userNode:e}})),n.set(e.id,c),e.parentId){var l=t.get(e.parentId);l?l.push(c):t.set(e.parentId,[c])}})),t.size>0&&kx(n,r)}function jx(e,n,t,r){var o,i,a,u,c,l=[],s=new Map;try{for(var d=g(e),f=d.next();!f.done;f=d.next()){var h=f.value,v=n.get(h.parentId);if(v){var p=null!==(u=null===(a=s.get(h.parentId))||void 0===a?void 0:a.expandedRect)&&void 0!==u?u:Bx(v,null!==(c=v.origin)&&void 0!==c?c:r),y=Vx(p,h.rect);s.set(h.parentId,{expandedRect:y,parent:v})}}}catch(e){o={error:e}}finally{try{f&&!f.done&&(i=d.return)&&i.call(d)}finally{if(o)throw o.error}}return s.size>0&&s.forEach((function(n,r){var o=n.expandedRect,i=n.parent,a=Cx(i,i.origin).position,u=Ax(i),c=o.x<a.x?Math.round(Math.abs(a.x-o.x)):0,s=o.y<a.y?Math.round(Math.abs(a.y-o.y)):0;if(c>0||s>0){l.push({id:r,type:"position",position:{x:a.x-c,y:a.y-s}});var d=t.get(r);null==d||d.forEach((function(n){e.some((function(e){return e.id===n.id}))||l.push({id:n.id,type:"position",position:{x:n.position.x+c,y:n.position.y+s}})}))}(u.width<o.width||u.height<o.height)&&l.push({id:r,type:"dimensions",setAttributes:!0,dimensions:{width:Math.max(u.width,Math.round(o.width)),height:Math.max(u.height,Math.round(o.height))}})})),l}var Px=function(e,n,t){return void 0===n&&(n=0),void 0===t&&(t=1),Math.min(Math.max(e,n),t)},Ix=function(e,n){return void 0===e&&(e={x:0,y:0}),{x:Px(e.x,n[0][0],n[1][0]),y:Px(e.y,n[0][1],n[1][1])}};function Ax(e){var n,t,r,o,i,a,u,c;return{width:null!==(o=null!==(r=null!==(t=null===(n=e.measured)||void 0===n?void 0:n.width)&&void 0!==t?t:e.width)&&void 0!==r?r:e.initialWidth)&&void 0!==o?o:0,height:null!==(c=null!==(u=null!==(a=null===(i=e.measured)||void 0===i?void 0:i.height)&&void 0!==a?a:e.height)&&void 0!==u?u:e.initialHeight)&&void 0!==c?c:0}}var zx=function(e){return!isNaN(e)&&isFinite(e)},Tx=function(e,n){return void 0===n&&(n=[1,1]),{x:n[0]*Math.round(e.x/n[0]),y:n[1]*Math.round(e.y/n[1])}},Lx=function(e,n,t,r){var o=e.x,i=e.y,a=y(n,3),u=a[0],c=a[1],l=a[2];void 0===t&&(t=!1),void 0===r&&(r=[1,1]);var s={x:(o-u)/l,y:(i-c)/l};return t?Tx(s,r):s},Bx=function(e,n){var t,r,o,i,a,u;void 0===n&&(n=[0,0]);var c=Cx(e,n).positionAbsolute;return{x:c.x,y:c.y,width:null!==(o=null!==(r=null===(t=e.measured)||void 0===t?void 0:t.width)&&void 0!==r?r:e.width)&&void 0!==o?o:0,height:null!==(u=null!==(a=null===(i=e.measured)||void 0===i?void 0:i.height)&&void 0!==a?a:e.height)&&void 0!==u?u:0}},Dx=function(e,n){return{x:Math.min(e.x,n.x),y:Math.min(e.y,n.y),x2:Math.max(e.x2,n.x2),y2:Math.max(e.y2,n.y2)}},Rx=function(e){var n=e.x,t=e.y;return{x:n,y:t,x2:n+e.width,y2:t+e.height}},Hx=function(e){var n=e.x,t=e.y;return{x:n,y:t,width:e.x2-n,height:e.y2-t}},Vx=function(e,n){return Hx(Dx(Rx(e),Rx(n)))};function Yx(e){return o(e)}var Xx=function(e,n){var t=Math.max(0,Math.min(e.x+e.width,n.x+n.width)-Math.max(e.x,n.x)),r=Math.max(0,Math.min(e.y+e.height,n.y+n.height)-Math.max(e.y,n.y));return Math.ceil(t*r)},Zx=function(e,n,t,r,o,i){var a=n/(e.width*(1+i)),u=t/(e.height*(1+i)),c=Math.min(a,u),l=Px(c,r,o);return{x:n/2-(e.x+e.width/2)*l,y:t/2-(e.y+e.height/2)*l,zoom:l}};function Fx(e){return void 0!==e&&"parent"!==e}var Ux=function(e){var n=e.x,t=e.y,r=e.width,o=e.height,i=e.origin,a=void 0===i?[0,0]:i;return!r||!o||a[0]<0||a[1]<0||a[0]>1||a[1]>1?{x:n,y:t}:{x:n-r*a[0],y:t-o*a[1]}},Wx=function(e){return Gx(e)},Gx=function(e){return"id"in e&&"position"in e&&!("source"in e)&&!("target"in e)};var qx=function(e){return zx(e.width)&&zx(e.height)&&zx(e.x)&&zx(e.y)},$x=function(e){return{width:e.offsetWidth,height:e.offsetHeight}},Kx=["INPUT","SELECT","TEXTAREA"];function Qx(e){var n,t,r=(null===(t=null===(n=e.composedPath)||void 0===n?void 0:n.call(e))||void 0===t?void 0:t[0])||e.target;return Kx.includes(null==r?void 0:r.nodeName)||(null==r?void 0:r.hasAttribute("contenteditable"))||!!(null==r?void 0:r.closest(".nokey"))}var Jx=function(e){return"clientX"in e},e_=function(e,n){var t,r,o,i,a=Jx(e),u=a?e.clientX:null===(t=e.touches)||void 0===t?void 0:t[0].clientX,c=a?e.clientY:null===(r=e.touches)||void 0===r?void 0:r[0].clientY;return{x:u-(null!==(o=null==n?void 0:n.left)&&void 0!==o?o:0),y:c-(null!==(i=null==n?void 0:n.top)&&void 0!==i?i:0)}},n_=function(e,n,t,r){void 0===r&&(r=[0,0]);var o=n.querySelectorAll(e);if(!o||!o.length)return null;var i=Array.from(o),a=n.getBoundingClientRect(),u=a.width*r[0],c=a.height*r[1];return i.map((function(e){var n=e.getBoundingClientRect();return f({id:e.getAttribute("data-handleid"),position:e.getAttribute("data-handlepos"),x:(n.left-a.left-u)/t,y:(n.top-a.top-c)/t},$x(e))}))},t_="undefined"!=typeof document?document:null;function r_(e,n){void 0===e&&(e=null),void 0===n&&(n={target:t_,actInsideInputWithModifier:!0});var t=y(i(!1),2),o=t[0],c=t[1],l=a(!1),s=a(new Set([])),d=y(r((function(){if(null!==e){var n=(Array.isArray(e)?e:[e]).filter((function(e){return"string"==typeof e})).map((function(e){return e.split("+")})),t=n.reduce((function(e,n){return e.concat.apply(e,m([],y(n),!1))}),[]);return[n,t]}return[[],[]]}),[e]),2),f=d[0],h=d[1];return u((function(){var t=(null==n?void 0:n.target)||t_;if(null!==e){var r=function(e){if(l.current=e.ctrlKey||e.metaKey||e.shiftKey,(!l.current||l.current&&!n.actInsideInputWithModifier)&&Qx(e))return!1;var t=i_(e.code,h);s.current.add(e[t]),o_(f,s.current,!1)&&(e.preventDefault(),c(!0))},o=function(e){if((!l.current||l.current&&!n.actInsideInputWithModifier)&&Qx(e))return!1;var t=i_(e.code,h);o_(f,s.current,!0)?(c(!1),s.current.clear()):s.current.delete(e[t]),"Meta"===e.key&&s.current.clear(),l.current=!1},i=function(){s.current.clear(),c(!1)};return null==t||t.addEventListener("keydown",r),null==t||t.addEventListener("keyup",o),window.addEventListener("blur",i),window.addEventListener("contextmenu",i),function(){null==t||t.removeEventListener("keydown",r),null==t||t.removeEventListener("keyup",o),window.removeEventListener("blur",i),window.removeEventListener("contextmenu",i)}}}),[e,c]),o}function o_(e,n,t){return e.filter((function(e){return t||e.length===n.size})).some((function(e){return e.every((function(e){return n.has(e)}))}))}function i_(e,n){return n.includes(e)?"code":"key"}function a_(e,n){if(Object.is(e,n))return!0;if("object"!=typeof e||null===e||"object"!=typeof n||null===n)return!1;if(e instanceof Map&&n instanceof Map){if(e.size!==n.size)return!1;for(const[t,r]of e)if(!Object.is(r,n.get(t)))return!1;return!0}if(e instanceof Set&&n instanceof Set){if(e.size!==n.size)return!1;for(const t of e)if(!n.has(t))return!1;return!0}const t=Object.keys(e);if(t.length!==Object.keys(n).length)return!1;for(const r of t)if(!Object.prototype.hasOwnProperty.call(n,r)||!Object.is(e[r],n[r]))return!1;return!0}var u_={position:"absolute",width:"100%",height:"100%",top:0,left:0};var c_=function(e){return{userSelectionActive:e.userSelectionActive,lib:e.lib}};function l_(e){var n=e.onPaneContextMenu,t=e.zoomOnScroll,r=void 0===t||t,o=e.zoomOnPinch,i=void 0===o||o,c=e.panOnScroll,l=void 0!==c&&c,s=e.panOnScrollSpeed,d=void 0===s?.5:s,f=e.panOnScrollMode,h=void 0===f?Wv.Free:f,v=e.zoomOnDoubleClick,p=void 0===v||v,g=e.panOnDrag,y=void 0===g||g,m=e.defaultViewport,w=e.translateExtent,b=e.zoomActivationKeyCode,x=e.preventScrolling,_=void 0===x||x,E=e.children,k=e.noWheelClassName,N=e.noPanClassName,C=e.onViewportChange,M=e.isControlledViewport,O=Sx(),j=a(null),P=Ex(c_,a_),I=P.userSelectionActive,A=P.lib,z=r_(b),T=a();return function(e){var n=Sx();u((function(){var t=function(){var t,r;if(!e.current)return!1;var o=$x(e.current);0!==o.height&&0!==o.width||null===(r=(t=n.getState()).onError)||void 0===r||r.call(t,"004",yv.error004()),n.setState({width:o.width||500,height:o.height||500})};if(e.current){t(),window.addEventListener("resize",t);var r=new ResizeObserver((function(){return t()}));return r.observe(e.current),function(){window.removeEventListener("resize",t),r&&e.current&&r.unobserve(e.current)}}}),[])}(j),u((function(){if(j.current){var e=O.getState();T.current=xx({domNode:j.current,minZoom:e.minZoom,maxZoom:e.maxZoom,translateExtent:w,viewport:m,onTransformChange:function(e){null==C||C({x:e[0],y:e[1],zoom:e[2]}),M||O.setState({transform:e})},onDraggingChange:function(e){return O.setState({paneDragging:e})},onPanZoomStart:function(e,n){var t=O.getState(),r=t.onViewportChangeStart,o=t.onMoveStart;null==o||o(e,n),null==r||r(n)},onPanZoom:function(e,n){var t=O.getState(),r=t.onViewportChange,o=t.onMove;null==o||o(e,n),null==r||r(n)},onPanZoomEnd:function(e,n){var t=O.getState(),r=t.onViewportChangeEnd,o=t.onMoveEnd;null==o||o(e,n),null==r||r(n)}});var n=T.current.getViewport(),t=n.x,r=n.y,o=n.zoom;return O.setState({panZoom:T.current,transform:[t,r,o],domNode:j.current.closest(".ink-flow")}),function(){var e;null===(e=T.current)||void 0===e||e.destroy()}}}),[]),u((function(){var e;null===(e=T.current)||void 0===e||e.update({onPaneContextMenu:n,zoomOnScroll:r,zoomOnPinch:i,panOnScroll:l,panOnScrollSpeed:d,panOnScrollMode:h,zoomOnDoubleClick:p,panOnDrag:y,zoomActivationKeyPressed:z,preventScrolling:_,noPanClassName:N,userSelectionActive:I,noWheelClassName:k,lib:A})}),[n,r,i,l,d,h,p,y,z,_,N,I,k,A]),S.jsx("div",{className:"ink-flow__renderer",ref:j,style:u_,children:E})}var s_={actInsideInputWithModifier:!1};function d_(e,n){var t;switch(e.type){case"select":n.selected=e.selected;break;case"position":void 0!==e.position&&(n.position=e.position),void 0!==e.dragging&&(n.dragging=e.dragging);break;case"dimensions":void 0!==e.dimensions&&(null!==(t=n.measured)&&void 0!==t||(n.measured={}),n.measured.width=e.dimensions.width,n.measured.height=e.dimensions.height,e.setAttributes&&(n.width=e.dimensions.width,n.height=e.dimensions.height)),"boolean"==typeof e.resizing&&(n.resizing=e.resizing)}}function f_(e,n){var t,r,o,i,a,u,c=[],l=new Map;try{for(var s=g(e),d=s.next();!d.done;d=s.next()){if("add"!==(_=d.value).type)if("remove"===_.type||"replace"===_.type)l.set(_.id,[_]);else{var h=l.get(_.id);h?h.push(_):l.set(_.id,[_])}else c.push(_.item)}}catch(e){t={error:e}}finally{try{d&&!d.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}try{for(var v=g(n),p=v.next();!p.done;p=v.next()){var y=p.value,m=l.get(y.id);if(m){if("remove"!==m[0].type)if("replace"!==m[0].type){var w=f({},y);try{for(var b=(a=void 0,g(m)),x=b.next();!x.done;x=b.next()){var _;d_(_=x.value,w)}}catch(e){a={error:e}}finally{try{x&&!x.done&&(u=b.return)&&u.call(b)}finally{if(a)throw a.error}}c.push(w)}else c.push(f({},m[0].item))}else c.push(y)}}catch(e){o={error:e}}finally{try{p&&!p.done&&(i=v.return)&&i.call(v)}finally{if(o)throw o.error}}return c}function h_(e,n){return f_(e,n)}function v_(e,n){return f_(e,n)}function p_(e,n){return{id:e,type:"select",selected:n}}function g_(e,n,t){var r,o;void 0===n&&(n=new Set),void 0===t&&(t=!1);var i=[];try{for(var a=g(e),u=a.next();!u.done;u=a.next()){var c=y(u.value,2),l=c[0],s=c[1],d=n.has(l);void 0===s.selected&&!d||s.selected===d||(t&&(s.selected=d),i.push(p_(s.id,d)))}}catch(e){r={error:e}}finally{try{u&&!u.done&&(o=a.return)&&o.call(a)}finally{if(r)throw r.error}}return i}function y_(e){var n,t,r,o,i,a,u=e.items,c=void 0===u?[]:u,l=e.lookup,s=[],d=new Map(c.map((function(e){return[e.id,e]})));try{for(var f=g(c),h=f.next();!h.done;h=f.next()){var v=h.value,p=l.get(v.id),m=null!==(a=null===(i=null==p?void 0:p.internals)||void 0===i?void 0:i.userNode)&&void 0!==a?a:p;void 0!==m&&m!==v&&s.push({id:v.id,item:v,type:"replace"}),void 0===m&&s.push({item:v,type:"add"})}}catch(e){n={error:e}}finally{try{h&&!h.done&&(t=f.return)&&t.call(f)}finally{if(n)throw n.error}}try{for(var w=g(l),b=w.next();!b.done;b=w.next()){var x=y(b.value,1)[0];void 0===d.get(x)&&s.push({id:x,type:"remove"})}}catch(e){r={error:e}}finally{try{b&&!b.done&&(o=w.return)&&o.call(w)}finally{if(r)throw r.error}}return s}function m_(e){return{id:e.id,type:"remove"}}var w_=function(e,n){void 0===n&&(n=[0,0]);var t=Ax(e),r=t.width,o=t.height,i="internals"in e?e.internals.positionAbsolute:e.position,a=e.origin||n,u=r*a[0],c=o*a[1];return{position:{x:e.position.x-u,y:e.position.y-c},positionAbsolute:{x:i.x-u,y:i.y-c}}},b_=function(e,n){if(void 0===n&&(n={nodeOrigin:[0,0]}),0===e.length)return{x:0,y:0,width:0,height:0};var t=e.reduce((function(e,t){var r=function(e,n){var t,r,o,i,a,u;void 0===n&&(n=[0,0]);var c=Cx(e,n).positionAbsolute,l=c.x,s=c.y;return{x:l,y:s,x2:l+(null!==(o=null!==(r=null===(t=e.measured)||void 0===t?void 0:t.width)&&void 0!==r?r:e.width)&&void 0!==o?o:0),y2:s+(null!==(u=null!==(a=null===(i=e.measured)||void 0===i?void 0:i.height)&&void 0!==a?a:e.height)&&void 0!==u?u:0)}}(t,n.nodeOrigin);return Dx(e,r)}),{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Hx(t)},x_=function(e,n,t,r,o,i){var a,u,c,l,s,d,h,v,p=y(void 0===t?[0,0,1]:t,3),m=p[0],w=p[1],b=p[2];void 0===r&&(r=!1),void 0===o&&(o=!1),void 0===i&&(i=[0,0]);var x=f(f({},Lx(n,[m,w,b])),{width:n.width/b,height:n.height/b}),_=[];try{for(var E=g(e),S=E.next();!S.done;S=E.next()){var k=y(S.value,2)[1],N=k.measured,C=k.selectable,M=void 0===C||C,O=k.hidden,j=void 0!==O&&O,P=null!==(s=null!==(l=null!==(c=N.width)&&void 0!==c?c:k.width)&&void 0!==l?l:k.initialWidth)&&void 0!==s?s:null,I=null!==(v=null!==(h=null!==(d=N.height)&&void 0!==d?d:k.height)&&void 0!==h?h:k.initialHeight)&&void 0!==v?v:null;if(!(o&&!M||j)){var A=Xx(x,Bx(k,i));(null===P||null===I||r&&A>0||A>=(null!=P?P:0)*(null!=I?I:0)||k.dragging)&&_.push(k)}}}catch(e){a={error:e}}finally{try{S&&!S.done&&(u=E.return)&&u.call(E)}finally{if(a)throw a.error}}return _},__=function(e,n){var t=new Set;return e.forEach((function(e){t.add(e.id)})),n.filter((function(e){return t.has(e.source)||t.has(e.target)}))};function E_(e,n){var t,r,o,i=e.nodeLookup,a=e.width,u=e.height,c=e.panZoom,l=e.minZoom,s=e.maxZoom,d=e.nodeOrigin,f=void 0===d?[0,0]:d,h=[],v=(null==n?void 0:n.nodes)?new Set(n.nodes.map((function(e){return e.id}))):null;if(i.forEach((function(e){!(e.measured.width&&e.measured.height&&((null==n?void 0:n.includeHiddenNodes)||!e.hidden))||v&&!v.has(e.id)||h.push(e)})),h.length>0){var p=b_(h,{nodeOrigin:f}),g=p.width>=a||p.height>=u;if("overflow"===(null==n?void 0:n.when)&&!g)return;var y=Zx(p,a,u,null!==(t=null==n?void 0:n.minZoom)&&void 0!==t?t:l,null!==(r=null==n?void 0:n.maxZoom)&&void 0!==r?r:s,null!==(o=null==n?void 0:n.padding)&&void 0!==o?o:.1);return c.setViewport(y,{duration:null==n?void 0:n.duration}),!0}return!1}function S_(e){var n=e.nodeId,t=e.nextPosition,r=e.nodeLookup,o=e.nodeOrigin,i=void 0===o?[0,0]:o,a=e.nodeExtent,u=e.onError,c=r.get(n),l=c.parentId?r.get(c.parentId):void 0,s=l?w_(l,l.origin||i).positionAbsolute:{x:0,y:0},d=s.x,f=s.y,h=function(e,n){var t,r,o,i;return n&&"parent"!==n?[n[0],[n[1][0]-(null!==(r=null===(t=e.measured)||void 0===t?void 0:t.width)&&void 0!==r?r:0),n[1][1]-(null!==(i=null===(o=e.measured)||void 0===o?void 0:o.height)&&void 0!==i?i:0)]]:n}(c,c.extent||a);if("parent"!==c.extent||c.expandParent)l&&Fx(c.extent)&&(h=[[c.extent[0][0]+d,c.extent[0][1]+f],[c.extent[1][0]+d,c.extent[1][1]+f]]);else if(l){var v=c.measured.width,p=c.measured.height,g=l.measured.width,y=l.measured.height;if(v&&p&&g&&y){var m=c.origin||i,w=d+v*m[0],b=f+p*m[1];h=[[w,b],[w+g-v,b+y-p]]}}else null==u||u("005",yv.error005());var x=Fx(h)?Ix(t,h):t;return{position:{x:x.x-d,y:x.y-f},positionAbsolute:x}}function k_(e){return v(this,arguments,void 0,(function(e){var n,t,r,o,i,a,u,c,l,s,d,f,h,v,y,m,w,b,x,_=e.nodesToRemove,E=void 0===_?[]:_,S=e.edgesToRemove,k=void 0===S?[]:S,N=e.nodes,C=e.edges,M=e.onBeforeDelete;return p(this,(function(e){switch(e.label){case 0:n=new Set(E.map((function(e){return e.id}))),t=[],r=function(e){if(!1===e.deletable)return"continue";var r=n.has(e.id),o=!r&&e.parentId&&t.find((function(n){return n.id===e.parentId}));(r||o)&&t.push(e)};try{for(o=g(N),i=o.next();!i.done;i=o.next())a=i.value,r(a)}catch(e){m={error:e}}finally{try{i&&!i.done&&(w=o.return)&&w.call(o)}finally{if(m)throw m.error}}u=new Set(k.map((function(e){return e.id}))),c=C.filter((function(e){return!1!==e.deletable})),l=__(t,c),s=l,d=function(e){u.has(e.id)&&!s.find((function(n){return n.id===e.id}))&&s.push(e)};try{for(f=g(c),h=f.next();!h.done;h=f.next())v=h.value,d(v)}catch(e){b={error:e}}finally{try{h&&!h.done&&(x=f.return)&&x.call(f)}finally{if(b)throw b.error}}return M?[4,M({nodes:t,edges:s})]:[2,{edges:s,nodes:t}];case 1:return"boolean"==typeof(y=e.sent())?[2,y?{edges:s,nodes:t}:{edges:[],nodes:[]}]:[2,y]}}))}))}var N_=function(e){return{userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect}};function C_(){var e=Ex(N_,a_),n=e.userSelectionActive,t=e.userSelectionRect;return n&&t?S.jsx("div",{className:"ink-flow__selection ink-flow__container",style:{width:t.width,height:t.height,transform:"translate(".concat(t.x,"px, ").concat(t.y,"px)")}}):null}var M_=function(e,n){return function(t){t.target===n.current&&(null==e||e(t))}},O_=function(e){return{userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging}};function j_(e){var n=e.isSelecting;e.selectionMode;var t=e.panOnDrag,r=e.onSelectionStart,o=e.onSelectionEnd,i=e.onPaneClick,u=e.onPaneContextMenu,c=e.onPaneScroll,l=e.onPaneMouseEnter,s=e.onPaneMouseMove,d=e.onPaneMouseLeave,f=e.children,h=a(null),v=Sx(),p=a(0),m=a(0),w=a(),b=a(new Map),x=Ex(O_,a_),_=x.userSelectionActive,E=x.elementsSelectable,k=x.dragging,N=function(){v.setState({userSelectionActive:!1,userSelectionRect:null}),p.current=0,m.current=0},C=function(e){null==i||i(e),v.getState().resetSelectedElements(),v.setState({nodesSelectionActive:!1})},M=c?function(e){return c(e)}:void 0,j=E&&(n||_);return S.jsxs("div",{className:O(["ink-flow__pane",{draggable:t,dragging:k,selection:n}]),onClick:j?void 0:M_(C,h),onContextMenu:M_((function(e){Array.isArray(t)&&(null==t?void 0:t.includes(2))?e.preventDefault():null==u||u(e)}),h),onWheel:M_(M,h),onMouseEnter:j?void 0:l,onMouseDown:j?function(e){var t,o,i,a,u=v.getState(),c=u.resetSelectedElements,l=u.domNode,s=u.edgeLookup;if(w.current=null==l?void 0:l.getBoundingClientRect(),E&&n&&0===e.button&&e.target===h.current&&w.current){b.current=new Map;try{for(var d=g(s),f=d.next();!f.done;f=d.next()){var p=y(f.value,2),m=p[0],x=p[1];b.current.set(x.source,(null===(i=b.current.get(x.source))||void 0===i?void 0:i.add(m))||new Set([m])),b.current.set(x.target,(null===(a=b.current.get(x.target))||void 0===a?void 0:a.add(m))||new Set([m]))}}catch(e){t={error:e}}finally{try{f&&!f.done&&(o=d.return)&&o.call(d)}finally{if(t)throw t.error}}var _=e_(e.nativeEvent,w.current),S=_.x,k=_.y;c(),v.setState({userSelectionRect:{width:0,height:0,startX:S,startY:k,x:S,y:k}}),null==r||r(e)}}:void 0,onMouseMove:j?function(e){var t,r,o,i,a=v.getState(),u=a.userSelectionRect,c=a.edgeLookup,l=a.transform,s=a.nodeOrigin,d=a.nodeLookup,f=a.triggerNodeChanges,h=a.triggerEdgeChanges;if(n&&w.current&&u){var y=e_(e.nativeEvent,w.current),x=y.x,_=y.y,E=u.startX,S=u.startY,k={startX:E,startY:S,x:x<E?x:E,y:_<S?_:S,width:Math.abs(x-E),height:Math.abs(_-S)},N=x_(d,k,l,!1,!0,s),C=new Set,M=new Set;try{for(var O=g(N),j=O.next();!j.done;j=O.next()){var P=j.value;M.add(P.id);var I=b.current.get(P.id);if(I)try{for(var A=(o=void 0,g(I)),z=A.next();!z.done;z=A.next()){var T=z.value;C.add(T)}}catch(e){o={error:e}}finally{try{z&&!z.done&&(i=A.return)&&i.call(A)}finally{if(o)throw o.error}}}}catch(e){t={error:e}}finally{try{j&&!j.done&&(r=O.return)&&r.call(O)}finally{if(t)throw t.error}}if(p.current!==M.size)p.current=M.size,f(g_(d,M,!0));if(m.current!==C.size)m.current=C.size,h(g_(c,C));v.setState({userSelectionRect:k,userSelectionActive:!0,nodesSelectionActive:!1})}}:s,onMouseUp:j?function(e){if(0===e.button){var n=v.getState().userSelectionRect;!_&&n&&e.target===h.current&&(null==C||C(e)),v.setState({nodesSelectionActive:p.current>0}),N(),null==o||o(e)}}:void 0,onMouseLeave:j?function(e){_&&(v.setState({nodesSelectionActive:p.current>0}),null==o||o(e)),N()}:d,ref:h,style:u_,children:[f,S.jsx(C_,{})]})}var P_=function(e){return{nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive}};function I_(e){var n=e.children,t=e.onPaneClick,r=e.onPaneMouseEnter,o=e.onPaneMouseMove,i=e.onPaneMouseLeave,a=e.onPaneContextMenu,c=e.onPaneScroll,l=e.deleteKeyCode,s=e.selectionKeyCode,d=e.selectionOnDrag,f=e.selectionMode,h=e.onSelectionStart,v=e.onSelectionEnd,p=e.multiSelectionKeyCode,g=e.panActivationKeyCode,y=e.zoomActivationKeyCode,m=e.elementsSelectable,w=e.zoomOnScroll,b=e.zoomOnPinch,x=e.panOnScroll,_=e.panOnScrollSpeed,E=e.panOnScrollMode,k=e.zoomOnDoubleClick,N=e.panOnDrag,C=e.defaultViewport,M=e.translateExtent,O=e.minZoom,j=e.maxZoom,P=e.preventScrolling;e.onSelectionContextMenu;var I=e.noWheelClassName,A=e.noPanClassName;e.disableKeyboardA11y;var z=e.onViewportChange,T=e.isControlledViewport,L=Ex(P_);L.nodesSelectionActive;var B=L.userSelectionActive,D=r_(s),R=r_(g),H=R||N,V=R||x,Y=D||B||d&&!0!==H;return function(e){var n=e.deleteKeyCode,t=e.multiSelectionKeyCode,r=Sx(),o=r_(n,s_),i=r_(t);u((function(){if(o){var e=r.getState();e.edges,e.nodes,r.setState({nodesSelectionActive:!1})}}),[o]),u((function(){r.setState({multiSelectionActive:i})}),[i])}({deleteKeyCode:l,multiSelectionKeyCode:p}),S.jsx(l_,{onPaneContextMenu:a,elementsSelectable:m,zoomOnScroll:w,zoomOnPinch:b,panOnScroll:V,panOnScrollSpeed:_,panOnScrollMode:E,zoomOnDoubleClick:k,panOnDrag:!D&&H,defaultViewport:C,translateExtent:M,minZoom:O,maxZoom:j,zoomActivationKeyCode:y,preventScrolling:P,noWheelClassName:I,noPanClassName:A,onViewportChange:z,isControlledViewport:T,children:S.jsx(j_,{onSelectionStart:h,onSelectionEnd:v,onPaneClick:t,onPaneMouseEnter:r,onPaneMouseMove:o,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:c,panOnDrag:H,isSelecting:!!Y,selectionMode:f,children:n})})}I_.displayName="FlowRenderer";var A_=c(I_);function z_(e){var n=y(i(e),2),t=n[0],r=n[1],o=l((function(e){return r((function(n){return h_(e,n)}))}),[]);return[t,r,o]}function T_(e){var n=y(i(e),2),t=n[0],r=n[1],o=l((function(e){return r((function(n){return v_(e,n)}))}),[]);return[t,r,o]}var L_="undefined"!=typeof window?s:u;function B_(e){var n=y(i(!1),2),t=n[0],r=n[1],o=y(i((function(){return function(e){var n=[];return{get:function(){return n},reset:function(){n=[]},push:function(t){n.push(t),e()}}}((function(){return r(!0)}))})),1),a=o[0];return L_((function(){if(t){var n=a.get();n.length&&(e(n),a.reset()),r(!1)}else a.reset()}),[t]),a}var D_=n(null);function R_(e){var n=e.children,t=Sx(),o=l((function(e){var n,r,o=t.getState(),i=o.nodes,a=void 0===i?[]:i,u=o.setNodes,c=o.hasDefaultNodes,l=o.onNodesChange,s=o.nodeLookup,d=a;try{for(var f=g(e),h=f.next();!h.done;h=f.next()){var v=h.value;d="function"==typeof v?v(d):v}}catch(e){n={error:e}}finally{try{h&&!h.done&&(r=f.return)&&r.call(f)}finally{if(n)throw n.error}}c?u(d):l&&l(y_({items:d,lookup:s}))}),[]),i=B_(o),a=l((function(e){var n,r,o=t.getState(),i=o.edges,a=void 0===i?[]:i,u=o.setEdges,c=o.hasDefaultEdges,l=o.onEdgesChange,s=o.edgeLookup,d=a;try{for(var f=g(e),h=f.next();!h.done;h=f.next()){var v=h.value;d="function"==typeof v?v(d):v}}catch(e){n={error:e}}finally{try{h&&!h.done&&(r=f.return)&&r.call(f)}finally{if(n)throw n.error}}c?u(d):l&&l(y_({items:d,lookup:s}))}),[]),u=B_(a),c=r((function(){return{nodeQueue:i,edgeQueue:u}}),[]);return S.jsx(D_.Provider,{value:c,children:n})}var H_=function(){var e=Sx();return r((function(){return{zoomIn:function(n){var t;return null===(t=e.getState().panZoom)||void 0===t?void 0:t.scaleBy(1.2,{duration:null==n?void 0:n.duration})},zoomOut:function(n){var t;return null===(t=e.getState().panZoom)||void 0===t?void 0:t.scaleBy(1/1.2,{duration:null==n?void 0:n.duration})},zoomTo:function(n,t){var r;return null===(r=e.getState().panZoom)||void 0===r?void 0:r.scaleTo(n,{duration:null==t?void 0:t.duration})},getZoom:function(){return e.getState().transform[2]},setViewport:function(n,t){var r,o,i,a=e.getState(),u=y(a.transform,3),c=u[0],l=u[1],s=u[2],d=a.panZoom;null==d||d.setViewport({x:null!==(r=n.x)&&void 0!==r?r:c,y:null!==(o=n.y)&&void 0!==o?o:l,zoom:null!==(i=n.zoom)&&void 0!==i?i:s},{duration:null==t?void 0:t.duration})},getViewport:function(){var n=y(e.getState().transform,3);return{x:n[0],y:n[1],zoom:n[2]}},fitView:function(n){var t=e.getState(),r=t.nodeLookup,o=t.width,i=t.height,a=t.nodeOrigin,u=t.minZoom,c=t.maxZoom,l=t.panZoom;return!!l&&E_({nodeLookup:r,width:o,height:i,nodeOrigin:a,minZoom:u,maxZoom:c,panZoom:l},n)},setCenter:function(n,t,r){var o=e.getState(),i=o.width,a=o.height,u=o.panZoom,c=o.transform,l=void 0!==(null==r?void 0:r.zoom)?r.zoom:c[2],s=i/2-n*l,d=a/2-t*l;null==u||u.setViewport({x:s,y:d,zoom:l},{duration:null==r?void 0:r.duration})},fitBounds:function(n,t){var r,o=e.getState(),i=o.width,a=o.height,u=o.minZoom,c=o.maxZoom,l=o.panZoom,s=Zx(n,i,a,u,c,null!==(r=null==t?void 0:t.padding)&&void 0!==r?r:.1);null==l||l.setViewport(s,{duration:null==t?void 0:t.duration})},screenToFlowPosition:function(n,t){void 0===t&&(t={snapToGrid:!0});var r=e.getState(),o=r.transform,i=r.snapGrid,a=r.domNode;if(!a)return n;var u=a.getBoundingClientRect(),c=u.x,l=u.y,s={x:n.x-c,y:n.y-l};return Lx(s,o,t.snapToGrid,i)},flowToScreenPosition:function(n){var t=e.getState(),r=t.transform,o=t.domNode;if(!o)return n;var i=o.getBoundingClientRect(),a=i.x,u=i.y,c=function(e,n){var t=e.x,r=e.y,o=y(n,3),i=o[0],a=o[1],u=o[2];return{x:t*u+i,y:r*u+a}}(n,r);return{x:c.x+a,y:c.y+u}}}}),[])},V_=function(e){return!!e.panZoom};function Y_(){var e=this,n=H_(),o=Sx(),i=function(){var e=t(D_);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}(),a=Ex(V_);console.log("yk store",o.getState());var u=r((function(){var n=function(e){return o.getState().nodeLookup.get(e)},t=function(e){i.nodeQueue.push(e)},r=function(e){var n,t,r,i,a=o.getState(),u=a.nodeLookup,c=a.nodeOrigin,l=Wx(e)?e:u.get(e.id),s=l.parentId?function(e,n,t,r){var o,i;void 0===r&&(r=[0,0]);for(var a=n,u=f({},e);a;){var c=t.get(n);if(a=null==c?void 0:c.parentId,c){var l=c.origin||r,s=(null!==(o=c.measured.width)&&void 0!==o?o:0)*l[0],d=(null!==(i=c.measured.height)&&void 0!==i?i:0)*l[1];u.x+=c.position.x-s,u.y+=c.position.y-d}}return u}(l.position,l.parentId,u,c):l.position,d={id:l.id,position:s,width:null!==(t=null===(n=l.measured)||void 0===n?void 0:n.width)&&void 0!==t?t:l.width,height:null!==(i=null===(r=l.measured)||void 0===r?void 0:r.height)&&void 0!==i?i:l.height,data:l.data};return Bx(d)},a=function(e,n,r){void 0===r&&(r={replace:!1}),t((function(t){return t.map((function(t){if(t.id===e){var o="function"==typeof n?n(t):n;return r.replace&&Wx(o)?o:f(f({},t),o)}return t}))}))};return{getNodes:function(){return o.getState().nodes.map((function(e){return f({},e)}))},getNode:function(e){var t;return null===(t=n(e))||void 0===t?void 0:t.internals.userNode},getInternalNode:n,getEdges:function(){var e=o.getState().edges;return(void 0===e?[]:e).map((function(e){return f({},e)}))},getEdge:function(e){return o.getState().edgeLookup.get(e)},setNodes:t,setEdges:function(e){i.edgeQueue.push(e)},addNodes:function(e){var n=Array.isArray(e)?e:[e];i.nodeQueue.push((function(e){return m(m([],y(e),!1),y(n),!1)}))},addEdges:function(e){var n=Array.isArray(e)?e:[e];i.edgeQueue.push((function(e){return m(m([],y(e),!1),y(n),!1)}))},toObject:function(){var e=o.getState(),n=e.nodes,t=void 0===n?[]:n,r=e.edges,i=void 0===r?[]:r,a=y(e.transform,3),u=a[0],c=a[1],l=a[2];return{nodes:t.map((function(e){return f({},e)})),edges:i.map((function(e){return f({},e)})),viewport:{x:u,y:c,zoom:l}}},deleteElements:function(n){return v(e,[n],void 0,(function(e){var n,t,r,i,a,u,c,l,s,d,f,h,v,g,y,m,w=e.nodes,b=void 0===w?[]:w,x=e.edges,_=void 0===x?[]:x;return p(this,(function(e){switch(e.label){case 0:return n=o.getState(),t=n.nodes,r=n.edges,i=n.onNodesDelete,a=n.onEdgesDelete,u=n.triggerNodeChanges,c=n.triggerEdgeChanges,l=n.onDelete,s=n.onBeforeDelete,[4,k_({nodesToRemove:b,edgesToRemove:_,nodes:t,edges:r,onBeforeDelete:s})];case 1:return d=e.sent(),f=d.nodes,h=d.edges,v=h.length>0,g=f.length>0,v&&(y=h.map(m_),null==a||a(h),c(y)),g&&(m=f.map(m_),null==i||i(f),u(m)),(g||v)&&(null==l||l({nodes:f,edges:h})),[2,{deletedNodes:f,deletedEdges:h}]}}))}))},getIntersectingNodes:function(e,n,t){void 0===n&&(n=!0);var i=qx(e),a=i?e:r(e),u=void 0!==t;return a?(t||o.getState().nodes).filter((function(t){var r=o.getState().nodeLookup.get(t.id);if(r&&!i&&(t.id===e.id||!r.internals.positionAbsolute))return!1;var c=Bx(u?t:r),l=Xx(c,a);return n&&l>0||l>=a.width*a.height})):[]},isNodeIntersecting:function(e,n,t){void 0===t&&(t=!0);var o=qx(e)?e:r(e);if(!o)return!1;var i=Xx(o,n);return t&&i>0||i>=o.width*o.height},updateNode:a,updateNodeData:function(e,n,t){void 0===t&&(t={replace:!1}),a(e,(function(e){var r="function"==typeof n?n(e):n;return t.replace?f(f({},e),{data:r}):f(f({},e),{data:f(f({},e.data),r)})}),t)},checkAllNodeBeMeasured:function(){return o.getState().nodes.every((function(e){return e.measured}))}}}),[]);return r((function(){return f(f(f({},u),n),{viewportInitialized:a})}),[a])}var X_=function(e){return e.updateNodeInternals};var Z_=function(e){return function(n){return e?x_(n.nodeLookup,{x:0,y:0,width:n.width,height:n.height},n.transform,!0).map((function(e){return e.id})):Array.from(n.nodeLookup.keys())}};var F_=n(null),U_=F_.Provider;F_.Consumer;var W_="ink-flow__node-desc",G_="ink-flow__edge-desc";function q_(e){var n=e.sourceX,t=e.sourceY,r=e.targetX,o=e.targetY,i=e.sourceControlX,a=e.sourceControlY,u=.125*n+.375*i+.375*e.targetControlX+.125*r,c=.125*t+.375*a+.375*e.targetControlY+.125*o;return[u,c,Math.abs(u-n),Math.abs(c-t)]}function $_(e,n){return e>=0?.5*e:25*n*Math.sqrt(-e)}function K_(e){var n=e.pos,t=e.x1,r=e.y1,o=e.x2,i=e.y2,a=e.c;switch(n){case Kv.Left:return[t-$_(t-o,a),r];case Kv.Right:return[t+$_(o-t,a),r];case Kv.Top:return[t,r-$_(r-i,a)];case Kv.Bottom:return[t,r+$_(i-r,a)]}}function Q_(e){var n=e.sourceX,t=e.sourceY,r=e.targetX,o=e.targetY,i=Math.abs(r-n)/2,a=r<n?r+i:r-i,u=Math.abs(o-t)/2;return[a,o<t?o+u:o-u,i,u]}var J_,eE=function(e){var n=e.source,t=e.sourceHandle,r=e.target,o=e.targetHandle;return"xy-edge__".concat(n).concat(t||"","-").concat(r).concat(o||"")};var nE=((J_={})[Kv.Left]={x:-1,y:0},J_[Kv.Right]={x:1,y:0},J_[Kv.Top]={x:0,y:-1},J_[Kv.Bottom]={x:0,y:1},J_),tE=function(e){var n=e.source,t=e.sourcePosition,r=void 0===t?Kv.Bottom:t,o=e.target;return r===Kv.Left||r===Kv.Right?n.x<o.x?{x:1,y:0}:{x:-1,y:0}:n.y<o.y?{x:0,y:1}:{x:0,y:-1}},rE=function(e,n){return Math.sqrt(Math.pow(n.x-e.x,2)+Math.pow(n.y-e.y,2))};function oE(e){var n=e.sourceX,t=e.sourceY,r=e.sourcePosition,o=void 0===r?Kv.Bottom:r,i=e.targetX,a=e.targetY,u=e.targetPosition,c=void 0===u?Kv.Top:u,l=e.borderRadius,s=void 0===l?5:l,d=e.centerX,f=e.centerY,h=e.offset,v=y(function(e){var n,t,r,o,i=e.source,a=e.sourcePosition,u=void 0===a?Kv.Bottom:a,c=e.target,l=e.targetPosition,s=void 0===l?Kv.Top:l,d=e.center,f=e.offset,h=nE[u],v=nE[s],p={x:i.x+h.x*f,y:i.y+h.y*f},g={x:c.x+v.x*f,y:c.y+v.y*f},w=tE({source:p,sourcePosition:u,target:g}),b=0!==w.x?"x":"y",x=w[b],_=[],E={x:0,y:0},S={x:0,y:0},k=y(Q_({sourceX:i.x,sourceY:i.y,targetX:c.x,targetY:c.y}),4),N=k[0],C=k[1],M=k[2],O=k[3];if(h[b]*v[b]==-1){r=null!==(n=d.x)&&void 0!==n?n:N,o=null!==(t=d.y)&&void 0!==t?t:C;var j=[{x:r,y:p.y},{x:r,y:g.y}],P=[{x:p.x,y:o},{x:g.x,y:o}];_=h[b]===x?"x"===b?j:P:"x"===b?P:j}else{var I=[{x:p.x,y:g.y}],A=[{x:g.x,y:p.y}];if(_="x"===b?h.x===x?A:I:h.y===x?I:A,u===s){var z=Math.abs(i[b]-c[b]);if(z<=f){var T=Math.min(f-1,f-z);h[b]===x?E[b]=(p[b]>i[b]?-1:1)*T:S[b]=(g[b]>c[b]?-1:1)*T}}if(u!==s){var L="x"===b?"y":"x",B=h[b]===v[L],D=p[L]>g[L],R=p[L]<g[L];(1===h[b]&&(!B&&D||B&&R)||1!==h[b]&&(!B&&R||B&&D))&&(_="x"===b?I:A)}var H={x:p.x+E.x,y:p.y+E.y},V={x:g.x+S.x,y:g.y+S.y};Math.max(Math.abs(H.x-_[0].x),Math.abs(V.x-_[0].x))>=Math.max(Math.abs(H.y-_[0].y),Math.abs(V.y-_[0].y))?(r=(H.x+V.x)/2,o=_[0].y):(r=_[0].x,o=(H.y+V.y)/2)}return[m(m([i,{x:p.x+E.x,y:p.y+E.y}],y(_),!1),[{x:g.x+S.x,y:g.y+S.y},c],!1),r,o,M,O]}({source:{x:n,y:t},sourcePosition:o,target:{x:i,y:a},targetPosition:c,center:{x:d,y:f},offset:void 0===h?20:h}),5),p=v[0],g=v[1],w=v[2],b=v[3],x=v[4],_=p.reduce((function(e,n,t){var r="";return r=t>0&&t<p.length-1?function(e,n,t,r){var o=Math.min(rE(e,n)/2,rE(n,t)/2,r),i=n.x,a=n.y;if(e.x===i&&i===t.x||e.y===a&&a===t.y)return"L".concat(i," ").concat(a);if(e.y===a){var u=e.x<t.x?-1:1,c=e.y<t.y?1:-1;return"L ".concat(i+o*u,",").concat(a,"Q ").concat(i,",").concat(a," ").concat(i,",").concat(a+o*c)}var l=e.x<t.x?1:-1,s=e.y<t.y?-1:1;return"L ".concat(i,",").concat(a+o*s,"Q ").concat(i,",").concat(a," ").concat(i+o*l,",").concat(a)}(p[t-1],n,p[t+1],s):"".concat(0===t?"M":"L").concat(n.x," ").concat(n.y),e+=r}),"");return[_,g,w,b,x]}var iE=function(e){return{connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}};var aE=c(Yx((function(e,n){var r,o,i=e.type,a=void 0===i?"source":i,u=e.position,c=void 0===u?Kv.Top:u,l=e.isValidConnection,s=e.isConnectable,d=void 0===s||s,v=e.isConnectableStart,p=void 0===v||v,g=e.isConnectableEnd,y=void 0===g||g,m=e.id,w=e.onConnect,b=e.children,x=e.className,_=e.onMouseDown,E=e.onTouchStart,k=h(e,["type","position","isValidConnection","isConnectable","isConnectableStart","isConnectableEnd","id","onConnect","children","className","onMouseDown","onTouchStart"]),N=m||null,C="target"===a,M=Sx(),j=t(F_),P=Ex(iE,a_),I=P.connectOnClick,A=P.noPanClassName,z=P.rfId,T=Ex(function(e,n,t){return function(r){var o=r.connectionStartHandle,i=r.connectionEndHandle,a=r.connectionClickStartHandle,u=r.connectionMode,c=r.connectionStatus,l=(null==i?void 0:i.nodeId)===e&&(null==i?void 0:i.handleId)===n&&(null==i?void 0:i.type)===t;return{connectingFrom:(null==o?void 0:o.nodeId)===e&&(null==o?void 0:o.handleId)===n&&(null==o?void 0:o.type)===t,connectingTo:l,clickConnecting:(null==a?void 0:a.nodeId)===e&&(null==a?void 0:a.handleId)===n&&(null==a?void 0:a.type)===t,isPossibleEndHandle:u===Uv.Strict?(null==o?void 0:o.type)!==t:e!==(null==o?void 0:o.nodeId)||n!==(null==o?void 0:o.handleId),connectionInProcess:!!o,valid:l&&"valid"===c}}}(j,N,a),a_),L=T.connectingFrom,B=T.connectingTo,D=T.clickConnecting,R=T.isPossibleEndHandle,H=T.connectionInProcess,V=T.valid;j||null===(o=(r=M.getState()).onError)||void 0===o||o.call(r,"010",yv.error010());var Y=function(e){var n=M.getState(),t=n.defaultEdgeOptions,r=n.onConnect,o=n.hasDefaultEdges,i=f(f({},t),e);if(o){var a=M.getState(),u=a.edges;(0,a.setEdges)(function(e,n){return e.source&&e.target?function(e,n){return n.some((function(n){return!(n.source!==e.source||n.target!==e.target||n.sourceHandle!==e.sourceHandle&&(n.sourceHandle||e.sourceHandle)||n.targetHandle!==e.targetHandle&&(n.targetHandle||e.targetHandle))}))}(t="id"in(r=e)&&"source"in r&&"target"in r?f({},e):f(f({},e),{id:eE(e)}),n)?n:(null===t.sourceHandle&&delete t.sourceHandle,null===t.targetHandle&&delete t.targetHandle,n.concat(t)):n;var t,r}(i,u))}null==r||r(i),null==w||w(i)},X=function(e){if(j){var n=Jx(e.nativeEvent);if(p&&(n&&0===e.button||!n)){var t=M.getState();tw.onPointerDown(e.nativeEvent,{autoPanOnConnect:t.autoPanOnConnect,connectionMode:t.connectionMode,connectionRadius:t.connectionRadius,domNode:t.domNode,nodeLookup:t.nodeLookup,lib:t.lib,isTarget:C,handleId:N,nodeId:j,flowId:t.rfId,panBy:t.panBy,cancelConnection:t.cancelConnection,onConnectStart:t.onConnectStart,onConnectEnd:t.onConnectEnd,updateConnection:t.updateConnection,onConnect:Y,isValidConnection:l||t.isValidConnection,getTransform:function(){return M.getState().transform},getConnectionStartHandle:function(){return M.getState().connectionStartHandle}})}n?null==_||_(e):null==E||E(e)}};return S.jsx("div",f({"data-handleid":N,"data-nodeid":j,"data-handlepos":c,"data-id":"".concat(z,"-").concat(j,"-").concat(N,"-").concat(a),className:O(["ink-flow__handle","ink-flow__handle-".concat(c),"nodrag",A,x,{source:!C,target:C,connectable:d,connectablestart:p,connectableend:y,clickconnecting:D,connectingfrom:L,connectingto:B,valid:V,connectionindicator:d&&(!H||R)&&(H?y:p)}]),onMouseDown:X,onTouchStart:X,onClick:I?function(e){var n=M.getState(),t=n.onClickConnectStart,r=n.onClickConnectEnd,o=n.connectionClickStartHandle,i=n.connectionMode,u=n.isValidConnection,c=n.lib,s=n.rfId;if(j&&(o||p)){if(!o)return null==t||t(e.nativeEvent,{nodeId:j,handleId:N,handleType:a}),void M.setState({connectionClickStartHandle:{nodeId:j,type:a,handleId:N}});var d=function(e){var n;return(null===(n=e.getRootNode)||void 0===n?void 0:n.call(e))||(null===window||void 0===window?void 0:window.document)}(e.target),f=l||u,h=tw.isValid(e.nativeEvent,{handle:{nodeId:j,id:N,type:a},connectionMode:i,fromNodeId:o.nodeId,fromHandleId:o.handleId||null,fromType:o.type,isValidConnection:f,flowId:s,doc:d,lib:c}),v=h.connection;h.isValid&&v&&Y(v),null==r||r(e),M.setState({connectionClickStartHandle:null})}}:void 0,ref:n},k,{children:b}))})));var uE={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},cE={input:function(e){var n=e.data,t=e.isConnectable,r=e.sourcePosition,o=void 0===r?Kv.Bottom:r;return S.jsxs(S.Fragment,{children:[null==n?void 0:n.label,S.jsx(aE,{type:"source",position:o,isConnectable:t})]})},default:function(e){var n=e.data,t=e.isConnectable,r=e.targetPosition,o=void 0===r?Kv.Top:r,i=e.sourcePosition,a=void 0===i?Kv.Bottom:i;return S.jsxs(S.Fragment,{children:[S.jsx(aE,{type:"target",position:o,isConnectable:t}),null==n?void 0:n.label,S.jsx(aE,{type:"source",position:a,isConnectable:t})]})},output:function(e){var n=e.data,t=e.isConnectable,r=e.targetPosition,o=void 0===r?Kv.Top:r;return S.jsxs(S.Fragment,{children:[S.jsx(aE,{type:"target",position:o,isConnectable:t}),null==n?void 0:n.label]})},group:function(){return null}};function lE(e){var n=e.id,t=e.store,r=e.unselect,o=void 0!==r&&r,i=e.nodeRef,a=t.getState(),u=a.addSelectedNodes,c=a.unselectNodesAndEdges,l=a.multiSelectionActive,s=a.nodeLookup,d=a.onError,f=s.get(n);f?(t.setState({nodesSelectionActive:!1}),f.selected?(o||f.selected&&l)&&(c({nodes:[f],edges:[]}),requestAnimationFrame((function(){var e;return null===(e=null==i?void 0:i.current)||void 0===e?void 0:e.blur()}))):u([n])):null==d||d("012",yv.error012(n))}var sE=function(e){return function(n){return n.selected&&(n.draggable||e&&void 0===n.draggable)}};function dE(e){var n,t=e.id,r=e.onClick,o=e.onMouseEnter,c=e.onMouseMove,s=e.onMouseLeave,d=e.onContextMenu,h=e.onDoubleClick,v=e.nodesDraggable,p=e.elementsSelectable,m=e.nodesConnectable,w=e.nodesFocusable,b=e.resizeObserver,x=e.noDragClassName,_=e.noPanClassName,E=e.disableKeyboardA11y,k=e.rfId,N=e.nodeTypes,C=e.nodeExtent,M=e.nodeOrigin,j=e.onError,P=Ex((function(e){var n=e.nodeLookup.get(t),r=e.parentLookup.has(t);return{node:n,internals:n.internals,isParent:r}}),a_),I=P.node,A=P.internals,z=P.isParent,T=I.type||"default",L=(null==N?void 0:N[T])||cE[T];void 0===L&&(null==j||j("003",yv.error003(T)),T="default",L=cE.default);var B=!!(I.draggable||v&&void 0===I.draggable),D=!!(I.selectable||p&&void 0===I.selectable),R=!!(I.connectable||m&&void 0===I.connectable),H=!!(I.focusable||w&&void 0===I.focusable),V=Sx(),Y=function(e){var n,t,r,o,i,a;return void 0!==(null!==(r=null!==(t=null===(n=e.measured)||void 0===n?void 0:n.width)&&void 0!==t?t:e.width)&&void 0!==r?r:e.initialWidth)&&void 0!==(null!==(a=null!==(i=null===(o=e.measured)||void 0===o?void 0:o.height)&&void 0!==i?i:e.height)&&void 0!==a?a:e.initialHeight)}(I),X=function(e){var n=e.node,t=e.nodeType,r=e.hasDimensions,o=e.resizeObserver,i=Sx(),c=a(null),l=a(null),s=a(n.sourcePosition),d=a(n.targetPosition),f=a(t),h=r&&!!n.internals.handleBounds&&!n.hidden;return u((function(){!c.current||h&&l.current===c.current||(l.current&&(null==o||o.unobserve(l.current)),null==o||o.observe(c.current),l.current=c.current)}),[h]),u((function(){return function(){l.current&&(null==o||o.unobserve(l.current),l.current=null)}}),[]),u((function(){if(c.current){var e=f.current!==t,r=s.current!==n.sourcePosition,o=d.current!==n.targetPosition;(e||r||o)&&(f.current=t,s.current=n.sourcePosition,d.current=n.targetPosition,i.getState().updateNodeInternals(new Map([[n.id,{id:n.id,nodeElement:c.current,force:!0}]])))}}),[n.id,t,n.sourcePosition,n.targetPosition]),c}({node:I,nodeType:T,hasDimensions:Y,resizeObserver:b}),Z=function(e){var n=e.nodeRef,t=e.disabled,r=void 0!==t&&t,o=e.noDragClassName,c=e.handleSelector,l=e.nodeId,s=e.isSelectable,d=Sx(),f=y(i(!1),2),h=f[0],v=f[1],p=a();return u((function(){p.current=$m({getStoreItems:function(){return d.getState()},onNodeMouseDown:function(e){lE({id:e,store:d,nodeRef:n})},onDragStart:function(){v(!0)},onDragStop:function(){v(!1)}})}),[]),u((function(){var e,t;if(r)null===(e=p.current)||void 0===e||e.destroy();else if(n.current)return null===(t=p.current)||void 0===t||t.update({noDragClassName:o,handleSelector:c,domNode:n.current,isSelectable:s,nodeId:l}),function(){var e;null===(e=p.current)||void 0===e||e.destroy()}}),[o,c,r,s,n,l]),h}({nodeRef:X,disabled:I.hidden||!B,noDragClassName:x,handleSelector:I.dragHandle,nodeId:t,isSelectable:D}),F=function(){var e=Sx(),n=l((function(n){var t,r,o=e.getState(),i=o.nodeExtent,a=o.snapToGrid,u=o.snapGrid,c=o.nodesDraggable,l=o.onError,s=o.updateNodePositions,d=o.nodeLookup,f=o.nodeOrigin,h=new Map,v=sE(c),p=a?u[0]:5,m=a?u[1]:5,w=n.direction.x*p*n.factor,b=n.direction.y*m*n.factor;try{for(var x=g(d),_=x.next();!_.done;_=x.next()){var E=y(_.value,2)[1];if(v(E)){var S={x:E.internals.positionAbsolute.x+w,y:E.internals.positionAbsolute.y+b};a&&(S=Tx(S,u));var k=S_({nodeId:E.id,nextPosition:S,nodeLookup:d,nodeExtent:i,nodeOrigin:f,onError:l}),N=k.position,C=k.positionAbsolute;E.position=N,E.internals.positionAbsolute=C,h.set(E.id,E)}}}catch(e){t={error:e}}finally{try{_&&!_.done&&(r=x.return)&&r.call(x)}finally{if(t)throw t.error}}s(h)}),[]);return n}();if(I.hidden)return null;var U=Ax(I),W=function(e){var n,t,r,o,i,a,u,c,l,s;return void 0===e.internals.handleBounds?{width:null!==(t=null!==(n=e.width)&&void 0!==n?n:e.initialWidth)&&void 0!==t?t:null===(r=e.style)||void 0===r?void 0:r.width,height:null!==(i=null!==(o=e.height)&&void 0!==o?o:e.initialHeight)&&void 0!==i?i:null===(a=e.style)||void 0===a?void 0:a.height}:{width:null!==(u=e.width)&&void 0!==u?u:null===(c=e.style)||void 0===c?void 0:c.width,height:null!==(l=e.height)&&void 0!==l?l:null===(s=e.style)||void 0===s?void 0:s.height}}(I),G=C?Ix(A.positionAbsolute,C):A.positionAbsolute,q=Ux(f(f(f({},G),U),{origin:I.origin||M})),$=D||B||r||o||c||s,K=o?function(e){return o(e,f({},A.userNode))}:void 0,Q=c?function(e){return c(e,f({},A.userNode))}:void 0,J=s?function(e){return s(e,f({},A.userNode))}:void 0,ee=d?function(e){return d(e,f({},A.userNode))}:void 0,ne=h?function(e){return h(e,f({},A.userNode))}:void 0;return S.jsx("div",{className:O(["ink-flow__node","ink-flow__node-".concat(T),(n={},n[_]=B,n),I.className,{selected:I.selected,selectable:D,parent:z,draggable:B,dragging:Z}]),ref:X,style:f(f({zIndex:A.z,transform:"translate(".concat(q.x,"px,").concat(q.y,"px)"),pointerEvents:$?"all":"none",visibility:Y?"visible":"hidden"},I.style),W),"data-id":t,"data-testid":"rf__node-".concat(t),onMouseEnter:K,onMouseMove:Q,onMouseLeave:J,onContextMenu:ee,onClick:function(e){var n=V.getState(),o=n.selectNodesOnDrag,i=n.nodeDragThreshold;D&&(!o||!B||i>0)&&lE({id:t,store:V,nodeRef:X}),r&&r(e,f({},A.userNode))},onDoubleClick:ne,onKeyDown:H?function(e){if(!Qx(e.nativeEvent)&&!E)if(wv.includes(e.key)&&D){var n="Escape"===e.key;lE({id:t,store:V,unselect:n,nodeRef:X})}else B&&I.selected&&Object.prototype.hasOwnProperty.call(uE,e.key)&&(V.setState({ariaLiveMessage:"Moved selected node ".concat(e.key.replace("Arrow","").toLowerCase(),". New position, x: ").concat(~~G.x,", y: ").concat(~~G.y)}),F({direction:uE[e.key],factor:e.shiftKey?4:1}))}:void 0,tabIndex:H?0:void 0,role:H?"button":void 0,"aria-describedby":E?void 0:"".concat(W_,"-").concat(k),"aria-label":I.ariaLabel,children:S.jsx(U_,{value:t,children:S.jsx(L,f({id:t,data:I.data,type:T,positionAbsoluteX:G.x,positionAbsoluteY:G.y,selected:I.selected,isConnectable:R,sourcePosition:I.sourcePosition,targetPosition:I.targetPosition,dragging:Z,dragHandle:I.dragHandle,zIndex:A.z},U))})})}var fE=function(e){return{nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError}};function hE(e){var n,t=Ex(fE,a_),r=t.nodesDraggable,o=t.nodesConnectable,a=t.nodesFocusable,c=t.elementsSelectable,s=t.onError,d=Ex(l(Z_(n=!1),[n]),a_),f=function(){var e=Ex(X_),n=y(i((function(){return"undefined"==typeof ResizeObserver?null:new ResizeObserver((function(n){var t=new Map;n.forEach((function(e){var n=e.target.getAttribute("data-id");t.set(n,{id:n,nodeElement:e.target})})),e(t)}))})),1),t=n[0];return u((function(){return function(){null==t||t.disconnect()}}),[t]),t}();return S.jsx("div",{className:"ink-flow__nodes",style:u_,children:d.map((function(n){return S.jsx(dE,{id:n,nodeTypes:e.nodeTypes,nodeOrigin:e.nodeOrigin,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:f,nodesDraggable:r,nodesConnectable:o,nodesFocusable:a,elementsSelectable:c,onError:s},n)}))})}hE.displayName="NodeRenderer";var vE,pE=c(hE),gE=((vE={})[$v.Arrow]=function(e){var n=e.color,t=void 0===n?"none":n,r=e.strokeWidth,o=void 0===r?1:r;return S.jsx("polyline",{style:{stroke:t,strokeWidth:o},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"})},vE[$v.ArrowClosed]=function(e){var n=e.color,t=void 0===n?"none":n,r=e.strokeWidth,o=void 0===r?1:r;return S.jsx("polyline",{style:{stroke:t,fill:t,strokeWidth:o},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},vE);function yE(e,n){if(!e)return"";if("string"==typeof e)return e;var t=n?"".concat(n,"__"):"";return"".concat(t).concat(Object.keys(e).sort().map((function(n){return"".concat(n,"=").concat(e[n])})).join("&"))}var mE=function(e){var n=e.id,t=e.type,o=e.color,i=e.width,a=void 0===i?12.5:i,u=e.height,c=void 0===u?12.5:u,l=e.markerUnits,s=void 0===l?"strokeWidth":l,d=e.strokeWidth,f=e.orient,h=void 0===f?"auto-start-reverse":f,v=function(e){var n=Sx(),t=r((function(){var t,r;return Object.prototype.hasOwnProperty.call(gE,e)?gE[e]:(null===(r=(t=n.getState()).onError)||void 0===r||r.call(t,"009",yv.error009(e)),null)}),[e]);return t}(t);return v?S.jsx("marker",{className:"ink-flow__arrowhead",id:n,markerWidth:"".concat(a),markerHeight:"".concat(c),viewBox:"-10 -10 20 20",markerUnits:s,orient:h,refX:"0",refY:"0",children:S.jsx(v,{color:o,strokeWidth:d})}):null},wE=function(e){var n=e.defaultColor,t=e.rfId,o=Ex((function(e){return e.edges})),i=Ex((function(e){return e.defaultEdgeOptions})),a=r((function(){var e=function(e,n){var t=n.id,r=n.defaultColor,o=n.defaultMarkerStart,i=n.defaultMarkerEnd,a=new Set;return e.reduce((function(e,n){return[n.markerStart||o,n.markerEnd||i].forEach((function(n){if(n&&"object"==typeof n){var o=yE(n,t);a.has(o)||(e.push(f({id:o,color:n.color||r},n)),a.add(o))}})),e}),[]).sort((function(e,n){return e.id.localeCompare(n.id)}))}(o,{id:t,defaultColor:n,defaultMarkerStart:null==i?void 0:i.markerStart,defaultMarkerEnd:null==i?void 0:i.markerEnd});return e}),[o,i,t,n]);return a.length?S.jsx("svg",{className:"ink-flow__marker",children:S.jsx("defs",{children:a.map((function(e){return S.jsx(mE,{id:e.id,type:e.type,color:e.color,width:e.width,height:e.height,markerUnits:e.markerUnits,strokeWidth:e.strokeWidth,orient:e.orient},e.id)}))})}):null};wE.displayName="MarkerDefinitions";var bE=c(wE);function xE(e){var n=e.x,t=e.y,r=e.label,o=e.labelStyle,a=void 0===o?{}:o,u=e.labelShowBg,c=void 0===u||u,s=e.labelBgStyle,d=void 0===s?{}:s,v=e.labelBgPadding,p=void 0===v?[2,4]:v,g=e.labelBgBorderRadius,m=void 0===g?2:g,w=e.children,b=e.className,x=h(e,["x","y","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","children","className"]),_=y(i({x:1,y:0,width:0,height:0}),2),E=_[0],k=_[1],N=O(["ink-flow__edge-textwrapper",b]),C=l((function(e){if(null!==e){var n=e.getBBox();k({x:n.x,y:n.y,width:n.width,height:n.height})}}),[]);return void 0!==r&&r?S.jsxs("g",f({transform:"translate(".concat(n-E.width/2," ").concat(t-E.height/2,")"),className:N,visibility:E.width?"visible":"hidden"},x,{children:[c&&S.jsx("rect",{width:E.width+2*p[0],x:-p[0],y:-p[1],height:E.height+2*p[1],className:"ink-flow__edge-textbg",style:d,rx:m,ry:m}),S.jsx("text",{className:"ink-flow__edge-text",y:E.height/2,dy:"0.3em",ref:C,style:a,children:r}),w]})):null}xE.displayName="EdgeText";var _E=c(xE);function EE(e){var n=e.id,t=e.path,r=e.labelX,o=e.labelY,i=e.label,a=e.labelStyle,u=e.labelShowBg,c=e.labelBgStyle,l=e.labelBgPadding,s=e.labelBgBorderRadius,d=e.style,f=e.markerEnd,h=e.markerStart,v=e.className,p=e.interactionWidth,g=void 0===p?20:p;return S.jsxs(S.Fragment,{children:[S.jsx("path",{id:n,style:d,d:t,fill:"none",className:O(["ink-flow__edge-path",v]),markerEnd:f,markerStart:h}),g&&S.jsx("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:g,className:"ink-flow__edge-interaction"}),i&&zx(r)&&zx(o)?S.jsx(_E,{x:r,y:o,label:i,labelStyle:a,labelShowBg:u,labelBgStyle:c,labelBgPadding:l,labelBgBorderRadius:s}):null]})}function SE(e){var n=e.pos,t=e.x1,r=e.y1,o=e.x2,i=e.y2;return n===Kv.Left||n===Kv.Right?[.5*(t+o),r]:[t,.5*(r+i)]}function kE(e){var n=e.sourceX,t=e.sourceY,r=e.sourcePosition,o=void 0===r?Kv.Bottom:r,i=e.targetX,a=e.targetY,u=e.targetPosition,c=void 0===u?Kv.Top:u,l=y(SE({pos:o,x1:n,y1:t,x2:i,y2:a}),2),s=l[0],d=l[1],f=y(SE({pos:c,x1:i,y1:a,x2:n,y2:t}),2),h=f[0],v=f[1],p=y(q_({sourceX:n,sourceY:t,targetX:i,targetY:a,sourceControlX:s,sourceControlY:d,targetControlX:h,targetControlY:v}),4),g=p[0],m=p[1],w=p[2],b=p[3];return["M".concat(n,",").concat(t," C").concat(s,",").concat(d," ").concat(h,",").concat(v," ").concat(i,",").concat(a),g,m,w,b]}function NE(e){return c((function(n){var t=n.id,r=n.sourceX,o=n.sourceY,i=n.targetX,a=n.targetY,u=n.sourcePosition,c=void 0===u?Kv.Bottom:u,l=n.targetPosition,s=void 0===l?Kv.Top:l,d=n.label,f=n.labelStyle,h=n.labelShowBg,v=n.labelBgStyle,p=n.labelBgPadding,g=n.labelBgBorderRadius,m=n.style,w=n.markerEnd,b=n.markerStart,x=n.interactionWidth,_=y(kE({sourceX:r,sourceY:o,sourcePosition:c,targetX:i,targetY:a,targetPosition:s}),3),E=_[0],k=_[1],N=_[2],C=e.isInternal?void 0:t;return S.jsx(EE,{id:C,path:E,labelX:k,labelY:N,label:d,labelStyle:f,labelShowBg:h,labelBgStyle:v,labelBgPadding:p,labelBgBorderRadius:g,style:m,markerEnd:w,markerStart:b,interactionWidth:x})}))}var CE=NE({isInternal:!1}),ME=NE({isInternal:!0});function OE(e){return c((function(n){var t=n.id,r=n.sourceX,o=n.sourceY,i=n.targetX,a=n.targetY,u=n.label,c=n.labelStyle,l=n.labelShowBg,s=n.labelBgStyle,d=n.labelBgPadding,f=n.labelBgBorderRadius,h=n.style,v=n.sourcePosition,p=void 0===v?Kv.Bottom:v,g=n.targetPosition,m=void 0===g?Kv.Top:g,w=n.markerEnd,b=n.markerStart,x=n.pathOptions,_=n.interactionWidth,E=y(oE({sourceX:r,sourceY:o,sourcePosition:p,targetX:i,targetY:a,targetPosition:m,borderRadius:null==x?void 0:x.borderRadius,offset:null==x?void 0:x.offset}),3),k=E[0],N=E[1],C=E[2],M=e.isInternal?void 0:t;return S.jsx(EE,{id:M,path:k,labelX:N,labelY:C,label:u,labelStyle:c,labelShowBg:l,labelBgStyle:s,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:w,markerStart:b,interactionWidth:_})}))}CE.displayName="SimpleBezierEdge",ME.displayName="SimpleBezierEdgeInternal";var jE=OE({isInternal:!1}),PE=OE({isInternal:!0});function IE(e){return c((function(n){var t,o=n.id,i=h(n,["id"]),a=e.isInternal?void 0:o;return S.jsx(jE,f({},i,{id:a,pathOptions:r((function(){var e;return{borderRadius:0,offset:null===(e=i.pathOptions)||void 0===e?void 0:e.offset}}),[null===(t=i.pathOptions)||void 0===t?void 0:t.offset])}))}))}jE.displayName="SmoothStepEdge",PE.displayName="SmoothStepEdgeInternal";var AE=IE({isInternal:!1}),zE=IE({isInternal:!0});function TE(e){return c((function(n){var t=n.id,r=n.sourceX,o=n.sourceY,i=n.targetX,a=n.targetY,u=n.label,c=n.labelStyle,l=n.labelShowBg,s=n.labelBgStyle,d=n.labelBgPadding,f=n.labelBgBorderRadius,h=n.style,v=n.markerEnd,p=n.markerStart,g=n.interactionWidth,m=y(function(e){var n=e.sourceX,t=e.sourceY,r=e.targetX,o=e.targetY,i=y(Q_({sourceX:n,sourceY:t,targetX:r,targetY:o}),4),a=i[0],u=i[1],c=i[2],l=i[3];return["M ".concat(n,",").concat(t,"L ").concat(r,",").concat(o),a,u,c,l]}({sourceX:r,sourceY:o,targetX:i,targetY:a}),3),w=m[0],b=m[1],x=m[2],_=e.isInternal?void 0:t;return S.jsx(EE,{id:_,path:w,labelX:b,labelY:x,label:u,labelStyle:c,labelShowBg:l,labelBgStyle:s,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:v,markerStart:p,interactionWidth:g})}))}AE.displayName="StepEdge",zE.displayName="StepEdgeInternal";var LE=TE({isInternal:!1}),BE=TE({isInternal:!0});function DE(e){return c((function(n){var t=n.id,r=n.sourceX,o=n.sourceY,i=n.targetX,a=n.targetY,u=n.sourcePosition,c=void 0===u?Kv.Bottom:u,l=n.targetPosition,s=void 0===l?Kv.Top:l,d=n.label,f=n.labelStyle,h=n.labelShowBg,v=n.labelBgStyle,p=n.labelBgPadding,g=n.labelBgBorderRadius,m=n.style,w=n.markerEnd,b=n.markerStart,x=n.pathOptions,_=n.interactionWidth,E=y(function(e){var n=e.sourceX,t=e.sourceY,r=e.sourcePosition,o=void 0===r?Kv.Bottom:r,i=e.targetX,a=e.targetY,u=e.targetPosition,c=void 0===u?Kv.Top:u,l=e.curvature,s=void 0===l?.25:l,d=y(K_({pos:o,x1:n,y1:t,x2:i,y2:a,c:s}),2),f=d[0],h=d[1],v=y(K_({pos:c,x1:i,y1:a,x2:n,y2:t,c:s}),2),p=v[0],g=v[1],m=y(q_({sourceX:n,sourceY:t,targetX:i,targetY:a,sourceControlX:f,sourceControlY:h,targetControlX:p,targetControlY:g}),4),w=m[0],b=m[1],x=m[2],_=m[3];return["M".concat(n,",").concat(t," C").concat(f,",").concat(h," ").concat(p,",").concat(g," ").concat(i,",").concat(a),w,b,x,_]}({sourceX:r,sourceY:o,sourcePosition:c,targetX:i,targetY:a,targetPosition:s,curvature:null==x?void 0:x.curvature}),3),k=E[0],N=E[1],C=E[2],M=e.isInternal?void 0:t;return S.jsx(EE,{id:M,path:k,labelX:N,labelY:C,label:d,labelStyle:f,labelShowBg:h,labelBgStyle:v,labelBgPadding:p,labelBgBorderRadius:g,style:m,markerEnd:w,markerStart:b,interactionWidth:_})}))}LE.displayName="StraightEdge",BE.displayName="StraightEdgeInternal";var RE=DE({isInternal:!1}),HE=DE({isInternal:!0});RE.displayName="BezierEdge",HE.displayName="BezierEdgeInternal";var VE={default:HE,straight:BE,step:zE,smoothstep:PE,simplebezier:ME},YE={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},XE=function(e,n,t){return t===Kv.Left?e-n:t===Kv.Right?e+n:e},ZE=function(e,n,t){return t===Kv.Top?e-n:t===Kv.Bottom?e+n:e},FE="ink-flow__edgeupdater";function UE(e){var n=e.position,t=e.centerX,r=e.centerY,o=e.radius,i=void 0===o?10:o,a=e.onMouseDown,u=e.onMouseEnter,c=e.onMouseOut,l=e.type;return S.jsx("circle",{onMouseDown:a,onMouseEnter:u,onMouseOut:c,className:O([FE,"".concat(FE,"-").concat(l)]),cx:XE(t,i,n),cy:ZE(r,i,n),r:i,stroke:"transparent",fill:"transparent"})}function WE(e){var n=e.isUpdatable,t=e.edgeUpdaterRadius,r=e.edge,o=e.targetHandleId,i=e.sourceHandleId,a=e.sourceX,u=e.sourceY,c=e.targetX,l=e.targetY,s=e.sourcePosition,d=e.targetPosition,f=e.onEdgeUpdate,h=e.onEdgeUpdateStart,v=e.onEdgeUpdateEnd,p=e.setUpdating,g=e.setUpdateHover,y=Sx(),m=function(e,n){if(0===e.button){var t=y.getState(),a=t.autoPanOnConnect,u=t.domNode,c=t.isValidConnection,l=t.connectionMode,s=t.connectionRadius,d=t.lib,g=t.onConnectStart,m=t.onConnectEnd,w=t.cancelConnection,b=t.nodeLookup,x=t.rfId,_=t.panBy,E=t.updateConnection,S=n?r.target:r.source,k=(n?o:i)||null,N=n?"target":"source",C=n;p(!0),null==h||h(e,r,N);tw.onPointerDown(e.nativeEvent,{autoPanOnConnect:a,connectionMode:l,connectionRadius:s,domNode:u,handleId:k,nodeId:S,nodeLookup:b,isTarget:C,edgeUpdaterType:N,lib:d,flowId:x,cancelConnection:w,panBy:_,isValidConnection:c,onConnect:function(e){return null==f?void 0:f(r,e)},onConnectStart:g,onConnectEnd:m,onEdgeUpdateEnd:function(e){p(!1),null==v||v(e,r,N)},updateConnection:E,getTransform:function(){return y.getState().transform},getConnectionStartHandle:function(){return y.getState().connectionStartHandle}})}},w=function(){return g(!0)},b=function(){return g(!1)};return S.jsxs(S.Fragment,{children:[("source"===n||!0===n)&&S.jsx(UE,{position:s,centerX:a,centerY:u,radius:t,onMouseDown:function(e){return m(e,!0)},onMouseEnter:w,onMouseOut:b,type:"source"}),("target"===n||!0===n)&&S.jsx(UE,{position:d,centerX:c,centerY:l,radius:t,onMouseDown:function(e){return m(e,!1)},onMouseEnter:w,onMouseOut:b,type:"target"})]})}function GE(e){var n;return e&&!(!e.internals.handleBounds&&!(null===(n=e.handles)||void 0===n?void 0:n.length))&&!!(e.measured.width||e.width||e.initialWidth)}function qE(e){var n,t,r,o;if(!e)return null;var i=[],a=[];try{for(var u=g(e),c=u.next();!c.done;c=u.next()){var l=c.value;l.width=null!==(r=l.width)&&void 0!==r?r:1,l.height=null!==(o=l.height)&&void 0!==o?o:1,"source"===l.type?i.push(l):"target"===l.type&&a.push(l)}}catch(e){n={error:e}}finally{try{c&&!c.done&&(t=u.return)&&t.call(u)}finally{if(n)throw n.error}}return{source:i,target:a}}function $E(e,n,t){var r,o;void 0===t&&(t=null);var i=(null!==(r=null==t?void 0:t.x)&&void 0!==r?r:0)+n.internals.positionAbsolute.x,a=(null!==(o=null==t?void 0:t.y)&&void 0!==o?o:0)+n.internals.positionAbsolute.y,u=null!=t?t:Ax(n),c=u.width,l=u.height;switch(e){case Kv.Top:return[i+c/2,a];case Kv.Right:return[i+c,a+l/2];case Kv.Bottom:return[i+c/2,a+l];case Kv.Left:return[i,a+l/2]}}function KE(e,n){return e&&(n?e.find((function(e){return e.id===n})):e[0])||null}function QE(e){var n=e.id,t=e.edgesFocusable,o=e.edgesUpdatable,u=e.elementsSelectable,c=e.onClick,s=e.onDoubleClick,d=e.onContextMenu,h=e.onMouseEnter,v=e.onMouseMove,p=e.onMouseLeave,g=e.edgeUpdaterRadius,m=e.onEdgeUpdate,w=e.onEdgeUpdateStart,b=e.onEdgeUpdateEnd,x=e.rfId,_=e.edgeTypes,E=e.noPanClassName,k=e.onError,N=e.disableKeyboardA11y,C=Ex((function(e){return e.edgeLookup.get(n)})),M=Ex((function(e){return e.defaultEdgeOptions})),j=(C=M?f(f({},M),C):C).type||"default",P=(null==_?void 0:_[j])||VE[j];void 0===P&&(null==k||k("011",yv.error011(j)),j="default",P=VE.default);var I=!!(C.focusable||t&&void 0===C.focusable),A=void 0!==m&&(C.updatable||o&&void 0===C.updatable),z=!!(C.selectable||u&&void 0===C.selectable),T=a(null),L=y(i(!1),2),B=L[0],D=L[1],R=y(i(!1),2),H=R[0],V=R[1],Y=Sx(),X=Ex(l((function(e){var t=e.nodeLookup.get(C.source),r=e.nodeLookup.get(C.target);if(!t||!r)return f({zIndex:C.zIndex},YE);var o=function(e){var n,t,r,o,i,a=e.sourceNode,u=e.targetNode;if(!GE(a)||!GE(u))return null;var c=a.internals.handleBounds||qE(a.handles),l=u.internals.handleBounds||qE(u.handles),s=KE(null!==(n=null==c?void 0:c.source)&&void 0!==n?n:[],e.sourceHandle),d=KE(e.connectionMode===Uv.Strict?null!==(t=null==l?void 0:l.target)&&void 0!==t?t:[]:(null!==(r=null==l?void 0:l.target)&&void 0!==r?r:[]).concat(null!==(o=null==l?void 0:l.source)&&void 0!==o?o:[]),e.targetHandle),f=(null==s?void 0:s.position)||Kv.Bottom,h=(null==d?void 0:d.position)||Kv.Top;if(!s||!d)return null===(i=e.onError)||void 0===i||i.call(e,"008",yv.error008(s?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;var v=y($E(f,a,s),2),p=v[0],g=v[1],m=y($E(h,u,d),2);return{sourceX:p,sourceY:g,targetX:m[0],targetY:m[1],sourcePosition:f,targetPosition:h}}({id:n,sourceNode:t,targetNode:r,sourceHandle:C.sourceHandle||null,targetHandle:C.targetHandle||null,connectionMode:e.connectionMode,onError:k}),i=function(e){var n=e.sourceNode,t=e.targetNode,r=e.selected,o=void 0!==r&&r,i=e.zIndex,a=void 0===i?0:i,u=e.elevateOnSelect;if(void 0===u||!u)return a;var c=o||t.selected||n.selected,l=Math.max(n.internals.z||0,t.internals.z||0,1e3);return a+(c?l:0)}({selected:C.selected,zIndex:C.zIndex,sourceNode:t,targetNode:r,elevateOnSelect:e.elevateEdgesOnSelect});return f({zIndex:i},o||YE)}),[C.source,C.target,C.sourceHandle,C.targetHandle,C.selected,C.zIndex]),a_),Z=X.zIndex,F=X.sourceX,U=X.sourceY,W=X.targetX,G=X.targetY,q=X.sourcePosition,$=X.targetPosition,K=r((function(){return C.markerStart?"url('#".concat(yE(C.markerStart,x),"')"):void 0}),[C.markerStart,x]),Q=r((function(){return C.markerEnd?"url('#".concat(yE(C.markerEnd,x),"')"):void 0}),[C.markerEnd,x]);if(C.hidden||null===F||null===U||null===W||null===G)return null;var J=s?function(e){s(e,f({},C))}:void 0,ee=d?function(e){d(e,f({},C))}:void 0,ne=h?function(e){h(e,f({},C))}:void 0,te=v?function(e){v(e,f({},C))}:void 0,re=p?function(e){p(e,f({},C))}:void 0;return S.jsx("svg",{style:{zIndex:Z},children:S.jsxs("g",{className:O(["ink-flow__edge","ink-flow__edge-".concat(j),C.className,E,{selected:C.selected,animated:C.animated,inactive:!z&&!c,updating:B,selectable:z}]),onClick:function(e){var t,r=Y.getState(),o=r.addSelectedEdges,i=r.unselectNodesAndEdges,a=r.multiSelectionActive;z&&(Y.setState({nodesSelectionActive:!1}),C.selected&&a?(i({nodes:[],edges:[C]}),null===(t=T.current)||void 0===t||t.blur()):o([n])),c&&c(e,C)},onDoubleClick:J,onContextMenu:ee,onMouseEnter:ne,onMouseMove:te,onMouseLeave:re,onKeyDown:I?function(e){var t;if(!N&&wv.includes(e.key)&&z){var r=Y.getState(),o=r.unselectNodesAndEdges,i=r.addSelectedEdges;"Escape"===e.key?(null===(t=T.current)||void 0===t||t.blur(),o({edges:[C]})):i([n])}}:void 0,tabIndex:I?0:void 0,role:I?"button":"img","data-id":n,"data-testid":"rf__edge-".concat(n),"aria-label":null===C.ariaLabel?void 0:C.ariaLabel||"Edge from ".concat(C.source," to ").concat(C.target),"aria-describedby":I?"".concat(G_,"-").concat(x):void 0,ref:T,children:[!H&&S.jsx(P,{id:n,source:C.source,target:C.target,type:C.type,selected:C.selected,animated:C.animated,label:C.label,labelStyle:C.labelStyle,labelShowBg:C.labelShowBg,labelBgStyle:C.labelBgStyle,labelBgPadding:C.labelBgPadding,labelBgBorderRadius:C.labelBgBorderRadius,sourceX:F,sourceY:U,targetX:W,targetY:G,sourcePosition:q,targetPosition:$,data:C.data,style:C.style,sourceHandleId:C.sourceHandle,targetHandleId:C.targetHandle,markerStart:K,markerEnd:Q,pathOptions:"pathOptions"in C?C.pathOptions:void 0,interactionWidth:C.interactionWidth}),A&&S.jsx(WE,{edge:C,isUpdatable:A,edgeUpdaterRadius:g,onEdgeUpdate:m,onEdgeUpdateStart:w,onEdgeUpdateEnd:b,sourceX:F,sourceY:U,targetX:W,targetY:G,sourcePosition:q,targetPosition:$,setUpdateHover:D,setUpdating:V,sourceHandleId:C.sourceHandle,targetHandleId:C.targetHandle})]})})}var JE=function(e){return{width:e.width,height:e.height,edgesFocusable:e.edgesFocusable,edgesUpdatable:e.edgesUpdatable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError}};function eS(e){var n=e.defaultMarkerColor,t=e.rfId,r=e.noPanClassName,o=e.onEdgeUpdate,i=e.onEdgeContextMenu,a=e.onEdgeMouseEnter,u=e.onEdgeMouseMove,c=e.onEdgeMouseLeave,s=e.onEdgeClick,d=e.edgeTypes,f=Ex(JE,a_),h=f.edgesFocusable,v=f.edgesUpdatable,p=f.elementsSelectable,g=f.onError,y=function(e){var n=Ex(l((function(e){return e.edges.map((function(e){return e.id}))}),[e]),a_);return n}(!1);return S.jsxs("div",{className:"ink-flow__edges",children:[S.jsx(bE,{defaultColor:n,rfId:t}),y.map((function(e){return S.jsx(QE,{id:e,edgesFocusable:h,edgesUpdatable:v,elementsSelectable:p,noPanClassName:r,onEdgeUpdate:o,onContextMenu:i,onMouseEnter:a,onMouseMove:u,onMouseLeave:c,onClick:s,rfId:t,onError:g,edgeTypes:d},e)}))]})}eS.displayName="EdgeRenderer";var nS,tS=c(eS),rS=function(e){return"translate(".concat(e.transform[0],"px,").concat(e.transform[1],"px) scale(").concat(e.transform[2],")")};function oS(e){var n=e.children,t=Ex(rS);return S.jsx("div",{className:"ink-flow__viewport xyflow__viewport ink-flow__container",style:{transform:t},children:n})}var iS=((nS={})[Kv.Left]=Kv.Right,nS[Kv.Right]=Kv.Left,nS[Kv.Top]=Kv.Bottom,nS[Kv.Bottom]=Kv.Top,nS),aS=function(e){var n,t,r=e.nodeId,o=e.handleType,i=e.style,a=e.type,u=void 0===a?qv.Bezier:a,c=e.CustomComponent,s=e.connectionStatus,d=Ex(l((function(e){var n;return{fromNode:e.nodeLookup.get(r),handleId:null===(n=e.connectionStartHandle)||void 0===n?void 0:n.handleId,toX:(e.connectionPosition.x-e.transform[0])/e.transform[2],toY:(e.connectionPosition.y-e.transform[1])/e.transform[2],connectionMode:e.connectionMode}}),[r]),a_),h=d.fromNode,v=d.handleId,p=d.toX,g=d.toY,m=d.connectionMode,w=null==h?void 0:h.internals.handleBounds,b=null==w?void 0:w[o];if(m===Uv.Loose&&(b=b||(null==w?void 0:w["source"===o?"target":"source"])),!h||!b)return null;var x=v?b.find((function(e){return e.id===v})):b[0],_=x?x.x+x.width/2:(null!==(n=h.measured.width)&&void 0!==n?n:0)/2,E=x?x.y+x.height/2:null!==(t=h.measured.height)&&void 0!==t?t:0,k=h.internals.positionAbsolute.x+_,N=h.internals.positionAbsolute.y+E,C=null==x?void 0:x.position,M=C?iS[C]:null;if(!C||!M)return null;if(c)return S.jsx(c,{connectionLineType:u,connectionLineStyle:i,fromNode:h,fromHandle:x,fromX:k,fromY:N,toX:p,toY:g,fromPosition:C,toPosition:M,connectionStatus:s});var O="",j={sourceX:k,sourceY:N,sourcePosition:C,targetX:p,targetY:g,targetPosition:M};return O=u===qv.Bezier?y(tp(j),1)[0]:u===qv.Step?y(dp(f(f({},j),{borderRadius:0})),1)[0]:u===qv.SmoothStep?y(dp(j),1)[0]:u===qv.SimpleBezier?y(kE(j),1)[0]:"M".concat(k,",").concat(N," ").concat(p,",").concat(g),S.jsx("path",{d:O,fill:"none",className:"react-flow__connection-path",style:i})};aS.displayName="ConnectionLine";var uS=function(e){var n,t;return{nodeId:null===(n=e.connectionStartHandle)||void 0===n?void 0:n.nodeId,handleType:null===(t=e.connectionStartHandle)||void 0===t?void 0:t.type,nodesConnectable:e.nodesConnectable,connectionStatus:e.connectionStatus,width:e.width,height:e.height}};function cS(e){var n=e.containerStyle,t=e.style,r=e.type,o=e.component,i=Ex(uS,a_),a=i.nodeId,u=i.handleType,c=i.nodesConnectable,l=i.width,s=i.height,d=i.connectionStatus;return!!(a&&u&&l&&c)?S.jsx("svg",{style:n,width:l,height:s,className:"react-flow__connectionline react-flow__container",children:S.jsx("g",{className:O(["react-flow__connection",d]),children:S.jsx(aS,{nodeId:a,handleType:u,style:t,type:r,CustomComponent:o,connectionStatus:d})})}):null}function lS(e){var n=e.onNodeClick,t=e.onNodeDoubleClick,r=e.onNodeMouseEnter,o=e.onNodeMouseMove,i=e.onNodeMouseLeave,a=e.onNodeContextMenu,u=e.onEdgeClick,c=e.onEdgeDoubleClick,l=e.onEdgeMouseEnter,s=e.onEdgeMouseMove,d=e.onEdgeMouseLeave,f=e.onEdgeContextMenu,h=e.rfId,v=e.minZoom,p=e.maxZoom,g=e.noPanClassName,y=e.noDragClassName,m=e.nodeOrigin,w=e.viewport,b=e.disableKeyboardA11y,x=e.translateExtent,_=e.defaultViewport,E=e.nodeTypes,k=e.edgeTypes,N=e.elementsSelectable,C=e.defaultMarkerColor,M=e.connectionLineType,O=e.connectionLineStyle,j=e.connectionLineComponent,P=e.connectionLineContainerStyle,I=e.onPaneClick,A=e.onPaneContextMenu,z=e.onPaneMouseEnter,T=e.onPaneMouseMove,L=e.onPaneMouseLeave,B=e.onPaneScroll;return S.jsx(A_,{minZoom:v,maxZoom:p,noPanClassName:g,noDragClassName:y,isControlledViewport:!!w,disableKeyboardA11y:b,translateExtent:x,defaultViewport:_,elementsSelectable:N,onPaneClick:I,onPaneContextMenu:A,onPaneMouseEnter:z,onPaneMouseMove:T,onPaneMouseLeave:L,onPaneScroll:B,children:S.jsxs(oS,{children:[S.jsx(tS,{rfId:h,edgeTypes:k,noPanClassName:g,onEdgeClick:u,onEdgeDoubleClick:c,onEdgeMouseEnter:l,onEdgeMouseMove:s,onEdgeMouseLeave:d,onEdgeContextMenu:f,defaultMarkerColor:C}),S.jsx(cS,{style:O,type:M,component:j,containerStyle:P}),S.jsx("div",{className:"ink-flow__edgelabel-renderer"}),S.jsx(pE,{rfId:h,nodeTypes:E,nodeOrigin:m,noDragClassName:y,noPanClassName:g,disableKeyboardA11y:!1,onNodeClick:n,onNodeDoubleClick:t,onNodeMouseEnter:r,onNodeMouseMove:o,onNodeMouseLeave:i,onNodeContextMenu:a}),S.jsx("div",{className:"ink-flow__viewport-portal"})]})})}lS.displayName="GraphView";var sS=c(lS),dS=function(e){var n,t,r=void 0===e?{}:e,o=r.nodes,i=r.edges,a=r.defaultNodes,u=r.defaultEdges;r.width,r.height,r.fitView;var c=new Map,l=new Map,s=new Map,d=new Map,f=null!==(n=null!=u?u:i)&&void 0!==n?n:[],h=null!==(t=null!=a?a:o)&&void 0!==t?t:[];Mx(s,d,f),Ox(h,c,l,{nodeOrigin:[0,0],elevateNodesOnSelect:!1});return{rfId:"1",width:0,height:0,transform:[0,0,1],nodes:h,nodeLookup:c,parentLookup:l,edges:f,edgeLookup:d,connectionLookup:s,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:void 0!==a,hasDefaultEdges:void 0!==u,panZoom:null,minZoom:.5,maxZoom:2,translateExtent:mv,nodeExtent:mv,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:Uv.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:[0,0],nodeDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesUpdatable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!1,fitViewOnInit:!1,fitViewDone:!1,fitViewOnInitOptions:void 0,selectNodesOnDrag:!0,multiSelectionActive:!1,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,connectionRadius:20,onError:void 0,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1}},fS=function(e){var n,t,r=e.nodes,o=e.edges,i=e.defaultNodes,a=e.defaultEdges,u=e.width,c=e.height,l=e.fitView;return n=function(e,n){return f(f({},dS({nodes:r,edges:o,width:u,height:c,fitView:l,defaultNodes:i,defaultEdges:a})),{setNodes:function(t){var r=n();Ox(t,r.nodeLookup,r.parentLookup,{nodeOrigin:r.nodeOrigin,elevateNodesOnSelect:r.elevateNodesOnSelect,checkEquality:!0}),e({nodes:t})},setEdges:function(t){var r=n();Mx(r.connectionLookup,r.edgeLookup,t),e({edges:t})},setDefaultNodesAndEdges:function(t,r){t&&((0,n().setNodes)(t),e({hasDefaultNodes:!0})),r&&((0,n().setEdges)(r),e({hasDefaultEdges:!0}))},updateNodeInternals:function(t){var r=n(),o=r.triggerNodeChanges,i=r.fitView,a=r.nodeLookup,u=r.parentLookup,c=r.fitViewOnInit,l=r.fitViewDone,s=r.fitViewOnInitOptions,d=r.domNode,h=r.nodeOrigin,v=r.debug,p=function(e,n,t,r,o){var i=null==r?void 0:r.querySelector(".xyflow__viewport"),a=!1;if(!i)return{changes:[],updatedInternals:a};var u=[],c=window.getComputedStyle(i),l=new window.DOMMatrixReadOnly(c.transform).m22,s=[];if(e.forEach((function(e){var t=n.get(e.id);if(null==t?void 0:t.hidden)n.set(t.id,f(f({},t),{internals:f(f({},t.internals),{handleBounds:void 0})})),a=!0;else if(t){var r=$x(e.nodeElement),i=t.measured.width!==r.width||t.measured.height!==r.height;if(r.width&&r.height&&(i||!t.internals.handleBounds||e.force)){var c=f(f({},t),{measured:r,internals:f(f({},t.internals),{handleBounds:{source:n_(".source",e.nodeElement,l,t.origin||o),target:n_(".target",e.nodeElement,l,t.origin||o)}})});n.set(t.id,c),a=!0,i&&(u.push({id:c.id,type:"dimensions",dimensions:r}),c.expandParent&&c.parentId&&s.push({id:c.id,parentId:c.parentId,rect:Bx(c,c.origin||o)}))}}})),s.length>0){var d=jx(s,n,t,o);u.push.apply(u,m([],y(d),!1))}return{changes:u,updatedInternals:a}}(t,a,u,d,h),g=p.changes;if(p.updatedInternals){kx(a,{nodeOrigin:h});var w=l;!l&&c&&(w=i(f(f({},s),{nodes:null==s?void 0:s.nodes}))),e({fitViewDone:w}),(null==g?void 0:g.length)>0&&(v&&console.log("Ink Flow: trigger node changes",g),null==o||o(g))}},updateNodePositions:function(e,t){var r,o;void 0===t&&(t=!1);var i=[],a=[];try{for(var u=g(e),c=u.next();!c.done;c=u.next()){var l=y(c.value,2),s=l[0],d=l[1],h={id:s,type:"position",position:d.position,dragging:t};(null==d?void 0:d.expandParent)&&(null==d?void 0:d.parentId)&&h.position&&(i.push({id:s,parentId:d.parentId,rect:f(f({},d.internals.positionAbsolute),{width:d.measured.width,height:d.measured.height})}),h.position.x=Math.max(0,h.position.x),h.position.y=Math.max(0,h.position.y)),a.push(h)}}catch(e){r={error:e}}finally{try{c&&!c.done&&(o=u.return)&&o.call(u)}finally{if(r)throw r.error}}if(i.length>0){var v=n(),p=jx(i,v.nodeLookup,v.parentLookup);a.push.apply(a,m([],y(p),!1))}n().triggerNodeChanges(a)},triggerNodeChanges:function(e){var t=n(),r=t.onNodesChange,o=t.setNodes,i=t.nodes,a=t.hasDefaultNodes,u=t.debug;(null==e?void 0:e.length)&&(a&&o(v_(e,i)),u&&console.log("Ink Flow: trigger node changes",e),null==r||r(e))},triggerEdgeChanges:function(e){var t=n(),r=t.onEdgesChange,o=t.setEdges,i=t.edges,a=t.hasDefaultEdges,u=t.debug;(null==e?void 0:e.length)&&(a&&o(h_(e,i)),u&&console.log("Ink Flow: trigger edge changes",e),null==r||r(e))},addSelectedNodes:function(e){var t=n(),r=t.multiSelectionActive,o=t.edgeLookup,i=t.nodeLookup,a=t.triggerNodeChanges,u=t.triggerEdgeChanges;r?a(e.map((function(e){return p_(e,!0)}))):(a(g_(i,new Set(m([],y(e),!1)),!0)),u(g_(o)))},addSelectedEdges:function(e){var t=n(),r=t.multiSelectionActive,o=t.edgeLookup,i=t.nodeLookup,a=t.triggerNodeChanges,u=t.triggerEdgeChanges;r?u(e.map((function(e){return p_(e,!0)}))):(u(g_(o,new Set(m([],y(e),!1)))),a(g_(i,new Set,!0)))},unselectNodesAndEdges:function(e){var t=void 0===e?{}:e,r=t.nodes,o=t.edges,i=n(),a=i.edges,u=i.nodes,c=i.triggerNodeChanges,l=i.triggerEdgeChanges,s=o||a,d=(r||u).map((function(e){return e.selected=!1,p_(e.id,!1)})),f=s.map((function(e){return p_(e.id,!1)}));c(d),l(f)},setMinZoom:function(t){var r=n(),o=r.panZoom,i=r.maxZoom;null==o||o.setScaleExtent([t,i]),e({minZoom:t})},setMaxZoom:function(t){var r=n(),o=r.panZoom,i=r.minZoom;null==o||o.setScaleExtent([i,t]),e({maxZoom:t})},setTranslateExtent:function(t){var r;null===(r=n().panZoom)||void 0===r||r.setTranslateExtent(t),e({translateExtent:t})},resetSelectedElements:function(){var e=n(),t=e.edges,r=e.nodes,o=e.triggerNodeChanges,i=e.triggerEdgeChanges,a=r.reduce((function(e,n){return n.selected?m(m([],y(e),!1),[p_(n.id,!1)],!1):e}),[]),u=t.reduce((function(e,n){return n.selected?m(m([],y(e),!1),[p_(n.id,!1)],!1):e}),[]);o(a),i(u)},setNodeExtent:function(t){var r,o,i=n().nodeLookup;try{for(var a=g(i),u=a.next();!u.done;u=a.next()){var c=y(u.value,2)[1],l=Ix(c.position,t);i.set(c.id,f(f({},c),{internals:f(f({},c.internals),{positionAbsolute:l})}))}}catch(e){r={error:e}}finally{try{u&&!u.done&&(o=a.return)&&o.call(a)}finally{if(r)throw r.error}}e({nodeExtent:t})},panBy:function(e){var t=n(),r=t.transform,o=t.width,i=t.height;return function(e){var n=e.delta,t=e.panZoom,r=e.transform,o=e.translateExtent,i=e.width,a=e.height;if(!t||!n.x&&!n.y)return!1;var u=t.setViewportConstrained({x:r[0]+n.x,y:r[1]+n.y,zoom:r[2]},[[0,0],[i,a]],o);return!!u&&(u.x!==r[0]||u.y!==r[1]||u.k!==r[2])}({delta:e,panZoom:t.panZoom,transform:r,translateExtent:t.translateExtent,width:o,height:i})},fitView:function(e){var t=n(),r=t.panZoom,o=t.width,i=t.height,a=t.minZoom,u=t.maxZoom,c=t.nodeOrigin,l=t.nodeLookup;return!!r&&E_({nodeLookup:l,width:o,height:i,panZoom:r,minZoom:a,maxZoom:u,nodeOrigin:c},e)},cancelConnection:function(){return e({connectionStatus:null,connectionStartHandle:null,connectionEndHandle:null})},updateConnection:function(t){var r,o=n().connectionPosition,i=f(f({},t),{connectionPosition:null!==(r=t.connectionPosition)&&void 0!==r?r:o});e(i)},reset:function(){return e(f({},dS()))}})},t=Object.is,n?V(n,t):V};function hS(e){var n=e.initialNodes,t=e.initialEdges,r=e.defaultNodes,o=e.defaultEdges,a=e.initialWidth,u=e.initialHeight,c=e.fitView,l=e.children,s=y(i((function(){return fS({nodes:n,edges:t,defaultNodes:r,defaultEdges:o,width:a,height:u,fitView:c})})),1)[0];return S.jsx(X,{value:s,children:S.jsx(R_,{children:l})})}function vS(e){var n=e.children,r=e.nodes,o=e.edges,i=e.defaultNodes,a=e.defaultEdges,u=e.width,c=e.height,l=e.fitView;return t(Y)?S.jsx(S.Fragment,{children:n}):S.jsx(hS,{initialNodes:r,initialEdges:o,defaultNodes:i,defaultEdges:a,initialWidth:u,initialHeight:c,fitView:l,children:n})}var pS={x:0,y:0,zoom:1},gS=m(m([],y(["nodes","edges","defaultNodes","defaultEdges","nodesDraggable","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","translateExtent","defaultEdgeOptions","fitView","fitViewOptions","nodeOrigin"]),!1),["rfId"],!1),yS=function(e){return{setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}},mS={translateExtent:mv,nodeOrigin:[0,0],minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function wS(e){var n=Ex(yS,a_),t=n.setNodes,r=n.setEdges,o=n.setMinZoom,i=n.setMaxZoom,c=n.setTranslateExtent,l=n.setNodeExtent,s=n.reset,d=n.setDefaultNodesAndEdges,f=Sx();u((function(){return d(e.defaultNodes,e.defaultEdges),function(){h.current=mS,s()}}),[]);var h=a(mS);return u((function(){var n,a,u;try{for(var s=g(gS),d=s.next();!d.done;d=s.next()){var v=d.value,p=e[v];p!==h.current[v]&&(void 0!==e[v]&&("nodes"===v?t(p):"edges"===v?r(p):"minZoom"===v?o(p):"maxZoom"===v?i(p):"translateExtent"===v?c(p):"nodeExtent"===v?l(p):"fitView"===v?f.setState({fitViewOnInit:p}):"fitViewOptions"===v?f.setState({fitViewOnInitOptions:p}):f.setState(((u={})[v]=p,u))))}}catch(e){n={error:e}}finally{try{d&&!d.done&&(a=s.return)&&a.call(s)}finally{if(n)throw n.error}}h.current=e}),gS.map((function(n){return e[n]}))),null}var bS={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};var xS=Yx((function(e,n){var t=e.nodes,r=e.edges,o=e.translateExtent,i=void 0===o?mv:o,a=e.defaultViewport,u=void 0===a?pS:a,c=e.minZoom,l=void 0===c?.5:c,s=e.maxZoom,d=void 0===s?2:s,v=e.defaultMarkerColor,p=void 0===v?"#b1b1b7":v,g=e.nodeOrigin,y=e.noDragClassName,m=e.noPanClassName,w=e.disableKeyboardA11y,b=e.nodeTypes,x=e.edgeTypes;e.connectionMode;var _=e.connectionLineType,E=void 0===_?qv.Bezier:_,k=e.connectionLineStyle,N=e.connectionLineComponent,C=e.connectionLineContainerStyle,M=e.onNodeClick,j=e.onNodeDoubleClick,P=e.onNodeMouseEnter,I=e.onNodeMouseMove,A=e.onNodeMouseLeave,z=e.onNodeContextMenu,T=e.onEdgeClick,L=e.onEdgeMouseEnter,B=e.onEdgeMouseMove,D=e.onEdgeMouseLeave,R=e.onEdgeContextMenu,H=e.onEdgeDoubleClick,V=e.onNodesChange,Y=e.onEdgesChange,X=e.fitView,Z=e.fitViewOptions,F=e.nodeExtent,U=e.nodesDraggable,W=e.children,G=e.id,q=e.width,$=e.height,K=e.onPaneClick,Q=e.onPaneContextMenu,J=e.onPaneMouseEnter,ee=e.onPaneMouseMove,ne=e.onPaneMouseLeave,te=e.onPaneScroll,re=e.elementsSelectable,oe=void 0===re||re,ie=h(e,["nodes","edges","translateExtent","defaultViewport","minZoom","maxZoom","defaultMarkerColor","nodeOrigin","noDragClassName","noPanClassName","disableKeyboardA11y","nodeTypes","edgeTypes","connectionMode","connectionLineType","connectionLineStyle","connectionLineComponent","connectionLineContainerStyle","onNodeClick","onNodeDoubleClick","onNodeMouseEnter","onNodeMouseMove","onNodeMouseLeave","onNodeContextMenu","onEdgeClick","onEdgeMouseEnter","onEdgeMouseMove","onEdgeMouseLeave","onEdgeContextMenu","onEdgeDoubleClick","onNodesChange","onEdgesChange","fitView","fitViewOptions","nodeExtent","nodesDraggable","children","id","width","height","onPaneClick","onPaneContextMenu","onPaneMouseEnter","onPaneMouseMove","onPaneMouseLeave","onPaneScroll","elementsSelectable"]),ae=G||"1";return S.jsx("div",f({},ie,{ref:n,style:f({},bS),className:O(["ink-flow"]),"data-testid":"rf__wrapper",id:G,children:S.jsxs(vS,{nodes:t,edges:r,width:q,height:$,fitView:X,children:[S.jsx(sS,{onNodeClick:M,onNodeMouseEnter:P,onNodeMouseMove:I,onNodeMouseLeave:A,onNodeContextMenu:z,onNodeDoubleClick:j,onEdgeClick:T,onEdgeMouseEnter:L,onEdgeMouseMove:B,onEdgeMouseLeave:D,onEdgeContextMenu:R,onEdgeDoubleClick:H,rfId:ae,nodeTypes:b,edgeTypes:x,minZoom:l,maxZoom:d,nodeOrigin:g,noDragClassName:y,noPanClassName:m,disableKeyboardA11y:w,translateExtent:i,defaultMarkerColor:p,connectionLineType:E,connectionLineStyle:k,connectionLineComponent:N,connectionLineContainerStyle:C,defaultViewport:u,onPaneClick:K,onPaneContextMenu:Q,onPaneMouseEnter:J,onPaneMouseMove:ee,onPaneMouseLeave:ne,onPaneScroll:te}),S.jsx(wS,{nodes:t,edges:r,rfId:ae,onNodesChange:V,onEdgesChange:Y,fitView:X,fitViewOptions:Z,nodeExtent:F,nodesDraggable:U,elementsSelectable:oe,minZoom:l,maxZoom:d,nodeOrigin:g}),W]})}))}));function _S(){return S.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:S.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10 4.375C10.3452 4.375 10.625 4.65482 10.625 5V9.375H15C15.3452 9.375 15.625 9.65482 15.625 10C15.625 10.3452 15.3452 10.625 15 10.625H10.625V15C10.625 15.3452 10.3452 15.625 10 15.625C9.65482 15.625 9.375 15.3452 9.375 15V10.625H5C4.65482 10.625 4.375 10.3452 4.375 10C4.375 9.65482 4.65482 9.375 5 9.375H9.375V5C9.375 4.65482 9.65482 4.375 10 4.375Z",fill:"#6B7280"})})}function ES(){return S.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:S.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4.375 10C4.375 9.65482 4.65482 9.375 5 9.375H15C15.3452 9.375 15.625 9.65482 15.625 10C15.625 10.3452 15.3452 10.625 15 10.625H5C4.65482 10.625 4.375 10.3452 4.375 10Z",fill:"#6B7280"})})}function SS(){return S.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:S.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10 1.875C10.3452 1.875 10.625 2.15482 10.625 2.5V3.57152C13.6929 3.86613 16.1339 6.30708 16.4285 9.375H17.5C17.8452 9.375 18.125 9.65482 18.125 10C18.125 10.3452 17.8452 10.625 17.5 10.625H16.4285C16.1339 13.6929 13.6929 16.1339 10.625 16.4285V17.5C10.625 17.8452 10.3452 18.125 10 18.125C9.65482 18.125 9.375 17.8452 9.375 17.5V16.4285C6.30708 16.1339 3.86613 13.6929 3.57152 10.625H2.5C2.15482 10.625 1.875 10.3452 1.875 10C1.875 9.65482 2.15482 9.375 2.5 9.375H3.57152C3.86613 6.30708 6.30708 3.86613 9.375 3.57152V2.5C9.375 2.15482 9.65482 1.875 10 1.875ZM4.82878 10.625H5.83333C6.17851 10.625 6.45833 10.3452 6.45833 10C6.45833 9.65482 6.17851 9.375 5.83333 9.375H4.82878C5.11304 6.99811 6.99811 5.11304 9.375 4.82878V5.83333C9.375 6.17851 9.65482 6.45833 10 6.45833C10.3452 6.45833 10.625 6.17851 10.625 5.83333V4.82878C13.0019 5.11304 14.887 6.99811 15.1712 9.375H14.1667C13.8215 9.375 13.5417 9.65482 13.5417 10C13.5417 10.3452 13.8215 10.625 14.1667 10.625H15.1712C14.887 13.0019 13.0019 14.887 10.625 15.1712V14.1667C10.625 13.8215 10.3452 13.5417 10 13.5417C9.65482 13.5417 9.375 13.8215 9.375 14.1667V15.1712C6.99811 14.887 5.11304 13.0019 4.82878 10.625Z",fill:"#6B7280"})})}function kS(){return S.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:S.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function NS(){return S.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:S.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function CS(e){var n=e.children,t=e.className,r=h(e,["children","className"]);return S.jsx("button",f({type:"button",className:O(["ink-flow__controls-button",t])},r,{children:n}))}var MS=function(e){return e.userSelectionActive?"none":"all"};function OS(e){var n=e.position,t=void 0===n?"top-left":n,r=e.children,o=e.className,i=e.style,a=h(e,["position","children","className","style"]),u=Ex(MS),c="".concat(t).split("-");return S.jsx("div",f({className:O(m(["ink-flow__panel",o],y(c),!1)),style:f(f({},i),{pointerEvents:u})},a,{children:r}))}var jS=function(e){return{isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom}};function PS(e){var n=e.style,t=e.showZoom,r=void 0===t||t,o=e.showFitView,i=void 0===o||o,a=e.showInteractive,u=void 0===a||a,c=e.fitViewOptions,l=e.onZoomIn,s=e.onZoomOut,d=e.onFitView,f=e.onInteractiveChange,h=e.className,v=e.children,p=e.position,g=void 0===p?"bottom-left":p,y=e.orientation,m=void 0===y?"vertical":y,w=e["aria-label"],b=void 0===w?"Ink Flow controls":w,x=Sx(),_=Ex(jS,a_),E=_.isInteractive,k=_.minZoomReached,N=_.maxZoomReached,C=Y_(),M=C.zoomIn,j=C.zoomOut,P=C.fitView,I="horizontal"===m?"horizontal":"vertical";return S.jsxs(OS,{className:O(["ink-flow__controls",I,h]),position:g,style:n,"data-testid":"rf__controls","aria-label":b,children:[i&&S.jsx(CS,{className:"ink-flow__controls-fitview",onClick:function(){P(c),null==d||d()},"aria-label":"fit view",children:S.jsx(SS,{})}),r&&S.jsxs("div",{className:"ink-flow__controls-zoom",children:[S.jsx(CS,{onClick:function(){M(),null==l||l()},className:"ink-flow__controls-zoomin","aria-label":"zoom in",disabled:N,children:S.jsx(_S,{})}),S.jsx(CS,{onClick:function(){j(),null==s||s()},className:"ink-flow__controls-zoomout","aria-label":"zoom out",disabled:k,children:S.jsx(ES,{})})]}),u&&S.jsx(CS,{className:"ink-flow__controls-interactive",onClick:function(){x.setState({nodesDraggable:!E,nodesConnectable:!E,elementsSelectable:!E}),null==f||f(!E)},title:"toggle interactivity","aria-label":"toggle interactivity",children:E?S.jsx(NS,{}):S.jsx(kS,{})}),v]})}PS.displayName="Controls";var IS,AS,zS=c(PS);function TS(e){var n=e.dimensions,t=e.lineWidth,r=e.variant,o=e.className;return S.jsx("path",{strokeWidth:t,d:"M".concat(n[0]/2," 0 V").concat(n[1]," M0 ").concat(n[1]/2," H").concat(n[0]),className:O(["react-flow__background-pattern",r,o])})}function LS(e){var n=e.radius,t=e.className;return S.jsx("circle",{cx:n,cy:n,r:n,className:O(["react-flow__background-pattern","dots",t])})}!function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"}(IS||(IS={}));var BS=((AS={})[IS.Dots]=1,AS[IS.Lines]=1,AS[IS.Cross]=6,AS),DS=function(e){return{transform:e.transform,patternId:"pattern-".concat(e.rfId)}};function RS(e){var n=e.id,t=e.variant,r=void 0===t?IS.Dots:t,o=e.gap,i=void 0===o?20:o,u=e.size,c=e.lineWidth,l=void 0===c?1:c,s=e.offset,d=void 0===s?2:s,h=e.color,v=e.bgColor,p=e.style,g=e.className,y=e.patternClassName,m=a(null),w=Ex(DS,a_),b=w.transform,x=w.patternId,_=u||BS[r],E=r===IS.Dots,k=r===IS.Cross,N=Array.isArray(i)?i:[i,i],C=[N[0]*b[2]||1,N[1]*b[2]||1],M=_*b[2],j=k?[M,M]:C,P=E?[M/d,M/d]:[j[0]/d,j[1]/d],I="".concat(x).concat(n||"");return S.jsxs("svg",{className:O(["ink-flow__background",g]),style:f(f(f({},p),u_),{"--xy-background-color-props":v,"--xy-background-pattern-color-props":h}),ref:m,"data-testid":"rf__background",children:[S.jsx("pattern",{id:I,x:b[0]%C[0],y:b[1]%C[1],width:C[0],height:C[1],patternUnits:"userSpaceOnUse",patternTransform:"translate(-".concat(P[0],",-").concat(P[1],")"),children:E?S.jsx(LS,{radius:M/d,className:y}):S.jsx(TS,{dimensions:j,lineWidth:l,variant:r,className:y})}),S.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:"url(#".concat(I,")")})]})}RS.displayName="Background";var HS=c(RS),VS=function(e){var n;return null===(n=e.domNode)||void 0===n?void 0:n.querySelector(".ink-flow__edgelabel-renderer")};function YS(e){var n=e.children,t=Ex(VS);return t?d(n,t):null}export{HS as Background,IS as BackgroundVariant,EE as BaseEdge,qv as ConnectionLineType,Uv as ConnectionMode,CS as ControlButton,zS as Controls,YS as EdgeLabelRenderer,aE as Handle,hS as InkFlowProvider,$v as MarkerType,Wv as PanOnScrollMode,Kv as Position,Gv as SelectionMode,jE as SmoothStepEdge,AE as StepEdge,ap as addEdge,fp as dagreLayout,xS as default,Jv as getBezierEdgeCenter,tp as getBezierPath,Cv as getConnectedEdges,rp as getEdgeCenter,Ev as getIncomers,kv as getNodesBounds,_v as getOutgoers,dp as getSmoothStepPath,cp as getStraightPath,Hv as getViewportForBounds,up as updateEdge,z_ as useEdgesState,Y_ as useInkFlow,T_ as useNodesState,Ex as useStore,Sx as useStoreApi};
|
|
16
|
+
*/j.exports=function(){if(M)return P;M=1;var n=e,t=z(),r="function"==typeof Object.is?Object.is:function(e,n){return e===n&&(0!==e||1/e==1/n)||e!=e&&n!=n},o=t.useSyncExternalStore,i=n.useRef,a=n.useEffect,u=n.useMemo,c=n.useDebugValue;return P.useSyncExternalStoreWithSelector=function(e,n,t,l,s){var d=i(null);if(null===d.current){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=u((function(){function e(e){if(!a){if(a=!0,o=e,e=l(e),void 0!==s&&f.hasValue){var n=f.value;if(s(n,e))return i=n}return i=e}if(n=i,r(o,e))return n;var t=l(e);return void 0!==s&&s(n,t)?n:(o=e,i=t)}var o,i,a=!1,u=void 0===t?null:t;return[function(){return e(n())},null===u?void 0:function(){return e(u())}]}),[n,t,l,s]);var h=o(e,d[0],d[1]);return a((function(){f.hasValue=!0,f.value=h}),[h]),c(h),h},P}();var T=w(j.exports);const L=e=>{let n;const t=new Set,r=(e,r)=>{const o="function"==typeof e?e(n):e;if(!Object.is(o,n)){const e=n;n=(null!=r?r:"object"!=typeof o||null===o)?o:Object.assign({},n,o),t.forEach((t=>t(n,e)))}},o=()=>n,i={setState:r,getState:o,getInitialState:()=>a,subscribe:e=>(t.add(e),()=>t.delete(e)),destroy:()=>{"production"!==(import.meta.env?import.meta.env.MODE:void 0)&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),t.clear()}},a=n=e(r,o,i);return i},{useDebugValue:B}=e,{useSyncExternalStoreWithSelector:D}=T,R=e=>e;function V(e,n=R,t){const r=D(e.subscribe,e.getState,e.getServerState||e.getInitialState,n,t);return B(r),r}const H=(e,n)=>{const t=(e=>e?L(e):L)(e),r=(e,r=n)=>V(t,e,r);return Object.assign(r,t),r};var Y=n(null),X=Y.Provider,Z=function(){return Z=Object.assign||function(e){for(var n,t=1,r=arguments.length;t<r;t++)for(var o in n=arguments[t])Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o]);return e},Z.apply(this,arguments)};function F(e){var n="function"==typeof Symbol&&Symbol.iterator,t=n&&e[n],r=0;if(t)return t.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(n?"Object is not iterable.":"Symbol.iterator is not defined.")}function U(e,n){var t="function"==typeof Symbol&&e[Symbol.iterator];if(!t)return e;var r,o,i=t.call(e),a=[];try{for(;(void 0===n||n-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(t=i.return)&&t.call(i)}finally{if(o)throw o.error}}return a}function W(e,n,t){if(2===arguments.length)for(var r,o=0,i=n.length;o<i;o++)!r&&o in n||(r||(r=Array.prototype.slice.call(n,0,o)),r[o]=n[o]);return e.concat(r||Array.prototype.slice.call(n))}"function"==typeof SuppressedError&&SuppressedError;var G,q,$,K,Q,J,ee,ne,te,re,oe,ie,ae,ue,ce,le,se,de,fe,he,ve,pe,ge,ye,me,we,be,xe,_e,Ee,Se,ke,Ne,Ce,Me,Oe,je,Pe,Ie,Ae,ze,Te,Le,Be,De,Re,Ve,He,Ye,Xe,Ze,Fe,Ue,We,Ge,qe,$e,Ke,Qe,Je,en,nn,tn,rn,on,an,un,cn,ln,sn,dn,fn,hn,vn,pn,gn,yn,mn,wn,bn,xn,_n,En,Sn,kn,Nn,Cn,Mn,On,jn,Pn,In,An,zn,Tn,Ln,Bn,Dn,Rn,Vn,Hn,Yn,Xn,Zn,Fn,Un,Wn,Gn,qn="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function $n(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Kn(){return K?$:(K=1,$=function(e,n){return e===n||e!=e&&n!=n})}function Qn(){if(J)return Q;J=1;var e=Kn();return Q=function(n,t){for(var r=n.length;r--;)if(e(n[r][0],t))return r;return-1},Q}function Jn(){if(le)return ce;le=1;var e=q?G:(q=1,G=function(){this.__data__=[],this.size=0}),n=function(){if(ne)return ee;ne=1;var e=Qn(),n=Array.prototype.splice;return ee=function(t){var r=this.__data__,o=e(r,t);return!(o<0||(o==r.length-1?r.pop():n.call(r,o,1),--this.size,0))}}(),t=function(){if(re)return te;re=1;var e=Qn();return te=function(n){var t=this.__data__,r=e(t,n);return r<0?void 0:t[r][1]}}(),r=function(){if(ie)return oe;ie=1;var e=Qn();return oe=function(n){return e(this.__data__,n)>-1}}(),o=function(){if(ue)return ae;ue=1;var e=Qn();return ae=function(n,t){var r=this.__data__,o=e(r,n);return o<0?(++this.size,r.push([n,t])):r[o][1]=t,this}}();function i(e){var n=-1,t=null==e?0:e.length;for(this.clear();++n<t;){var r=e[n];this.set(r[0],r[1])}}return i.prototype.clear=e,i.prototype.delete=n,i.prototype.get=t,i.prototype.has=r,i.prototype.set=o,ce=i}function et(){if(we)return me;we=1;var e="object"==typeof qn&&qn&&qn.Object===Object&&qn;return me=e}function nt(){if(xe)return be;xe=1;var e=et(),n="object"==typeof self&&self&&self.Object===Object&&self,t=e||n||Function("return this")();return be=t}function tt(){if(Ee)return _e;Ee=1;var e=nt().Symbol;return _e=e}function rt(){if(Oe)return Me;Oe=1;var e=tt(),n=function(){if(ke)return Se;ke=1;var e=tt(),n=Object.prototype,t=n.hasOwnProperty,r=n.toString,o=e?e.toStringTag:void 0;return Se=function(e){var n=t.call(e,o),i=e[o];try{e[o]=void 0;var a=!0}catch(e){}var u=r.call(e);return a&&(n?e[o]=i:delete e[o]),u}}(),t=function(){if(Ce)return Ne;Ce=1;var e=Object.prototype.toString;return Ne=function(n){return e.call(n)}}(),r=e?e.toStringTag:void 0;return Me=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":r&&r in Object(e)?n(e):t(e)}}function ot(){return Pe?je:(Pe=1,je=function(e){var n=typeof e;return null!=e&&("object"==n||"function"==n)})}function it(){if(Ae)return Ie;Ae=1;var e=rt(),n=ot();return Ie=function(t){if(!n(t))return!1;var r=e(t);return"[object Function]"==r||"[object GeneratorFunction]"==r||"[object AsyncFunction]"==r||"[object Proxy]"==r}}function at(){if(Re)return De;Re=1;var e=Function.prototype.toString;return De=function(n){if(null!=n){try{return e.call(n)}catch(e){}try{return n+""}catch(e){}}return""}}function ut(){if(Fe)return Ze;Fe=1;var e=function(){if(He)return Ve;He=1;var e=it(),n=function(){if(Be)return Le;Be=1;var e,n=function(){if(Te)return ze;Te=1;var e=nt()["__core-js_shared__"];return ze=e}(),t=(e=/[^.]+$/.exec(n&&n.keys&&n.keys.IE_PROTO||""))?"Symbol(src)_1."+e:"";return Le=function(e){return!!t&&t in e}}(),t=ot(),r=at(),o=/^\[object .+?Constructor\]$/,i=Function.prototype,a=Object.prototype,u=i.toString,c=a.hasOwnProperty,l=RegExp("^"+u.call(c).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");return Ve=function(i){return!(!t(i)||n(i))&&(e(i)?l:o).test(r(i))}}(),n=Xe?Ye:(Xe=1,Ye=function(e,n){return null==e?void 0:e[n]});return Ze=function(t,r){var o=n(t,r);return e(o)?o:void 0}}function ct(){if(We)return Ue;We=1;var e=ut()(nt(),"Map");return Ue=e}function lt(){if(qe)return Ge;qe=1;var e=ut()(Object,"create");return Ge=e}function st(){if(vn)return hn;vn=1;var e=fn?dn:(fn=1,dn=function(e){var n=typeof e;return"string"==n||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==e:null===e});return hn=function(n,t){var r=n.__data__;return e(t)?r["string"==typeof t?"string":"hash"]:r.map},hn}function dt(){if(Sn)return En;Sn=1;var e=function(){if(sn)return ln;sn=1;var e=function(){if(cn)return un;cn=1;var e=function(){if(Ke)return $e;Ke=1;var e=lt();return $e=function(){this.__data__=e?e(null):{},this.size=0}}(),n=Je?Qe:(Je=1,Qe=function(e){var n=this.has(e)&&delete this.__data__[e];return this.size-=n?1:0,n}),t=function(){if(nn)return en;nn=1;var e=lt(),n=Object.prototype.hasOwnProperty;return en=function(t){var r=this.__data__;if(e){var o=r[t];return"__lodash_hash_undefined__"===o?void 0:o}return n.call(r,t)?r[t]:void 0}}(),r=function(){if(rn)return tn;rn=1;var e=lt(),n=Object.prototype.hasOwnProperty;return tn=function(t){var r=this.__data__;return e?void 0!==r[t]:n.call(r,t)}}(),o=function(){if(an)return on;an=1;var e=lt();return on=function(n,t){var r=this.__data__;return this.size+=this.has(n)?0:1,r[n]=e&&void 0===t?"__lodash_hash_undefined__":t,this}}();function i(e){var n=-1,t=null==e?0:e.length;for(this.clear();++n<t;){var r=e[n];this.set(r[0],r[1])}}return i.prototype.clear=e,i.prototype.delete=n,i.prototype.get=t,i.prototype.has=r,i.prototype.set=o,un=i}(),n=Jn(),t=ct();return ln=function(){this.size=0,this.__data__={hash:new e,map:new(t||n),string:new e}}}(),n=function(){if(gn)return pn;gn=1;var e=st();return pn=function(n){var t=e(this,n).delete(n);return this.size-=t?1:0,t}}(),t=function(){if(mn)return yn;mn=1;var e=st();return yn=function(n){return e(this,n).get(n)}}(),r=function(){if(bn)return wn;bn=1;var e=st();return wn=function(n){return e(this,n).has(n)}}(),o=function(){if(_n)return xn;_n=1;var e=st();return xn=function(n,t){var r=e(this,n),o=r.size;return r.set(n,t),this.size+=r.size==o?0:1,this},xn}();function i(e){var n=-1,t=null==e?0:e.length;for(this.clear();++n<t;){var r=e[n];this.set(r[0],r[1])}}return i.prototype.clear=e,i.prototype.delete=n,i.prototype.get=t,i.prototype.has=r,i.prototype.set=o,En=i}function ft(){if(Mn)return Cn;Mn=1;var e=Jn(),n=function(){if(de)return se;de=1;var e=Jn();return se=function(){this.__data__=new e,this.size=0}}(),t=he?fe:(he=1,fe=function(e){var n=this.__data__,t=n.delete(e);return this.size=n.size,t}),r=pe?ve:(pe=1,ve=function(e){return this.__data__.get(e)}),o=ye?ge:(ye=1,ge=function(e){return this.__data__.has(e)}),i=function(){if(Nn)return kn;Nn=1;var e=Jn(),n=ct(),t=dt();return kn=function(r,o){var i=this.__data__;if(i instanceof e){var a=i.__data__;if(!n||a.length<199)return a.push([r,o]),this.size=++i.size,this;i=this.__data__=new t(a)}return i.set(r,o),this.size=i.size,this}}();function a(n){var t=this.__data__=new e(n);this.size=t.size}return a.prototype.clear=n,a.prototype.delete=t,a.prototype.get=r,a.prototype.has=o,a.prototype.set=i,Cn=a}function ht(){return jn||(jn=1,On=function(e,n){for(var t=-1,r=null==e?0:e.length;++t<r&&!1!==n(e[t],t,e););return e}),On}function vt(){if(In)return Pn;In=1;var e=ut(),n=function(){try{var n=e(Object,"defineProperty");return n({},"",{}),n}catch(e){}}();return Pn=n}function pt(){if(zn)return An;zn=1;var e=vt();return An=function(n,t,r){"__proto__"==t&&e?e(n,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):n[t]=r}}function gt(){if(Ln)return Tn;Ln=1;var e=pt(),n=Kn(),t=Object.prototype.hasOwnProperty;return Tn=function(r,o,i){var a=r[o];t.call(r,o)&&n(a,i)&&(void 0!==i||o in r)||e(r,o,i)}}function yt(){if(Dn)return Bn;Dn=1;var e=gt(),n=pt();return Bn=function(t,r,o,i){var a=!o;o||(o={});for(var u=-1,c=r.length;++u<c;){var l=r[u],s=i?i(o[l],t[l],l,o,t):void 0;void 0===s&&(s=t[l]),a?n(o,l,s):e(o,l,s)}return o}}function mt(){return Yn?Hn:(Yn=1,Hn=function(e){return null!=e&&"object"==typeof e})}function wt(){if(Un)return Fn;Un=1;var e=function(){if(Zn)return Xn;Zn=1;var e=rt(),n=mt();return Xn=function(t){return n(t)&&"[object Arguments]"==e(t)}}(),n=mt(),t=Object.prototype,r=t.hasOwnProperty,o=t.propertyIsEnumerable,i=e(function(){return arguments}())?e:function(e){return n(e)&&r.call(e,"callee")&&!o.call(e,"callee")};return Fn=i}function bt(){if(Gn)return Wn;Gn=1;var e=Array.isArray;return Wn=e}var xt,_t,Et,St,kt,Nt,Ct,Mt,Ot,jt,Pt,It={exports:{}};function At(){return Et||(Et=1,function(e,n){var t=nt(),r=_t?xt:(_t=1,xt=function(){return!1}),o=n&&!n.nodeType&&n,i=o&&e&&!e.nodeType&&e,a=i&&i.exports===o?t.Buffer:void 0,u=(a?a.isBuffer:void 0)||r;e.exports=u}(It,It.exports)),It.exports}function zt(){if(kt)return St;kt=1;var e=/^(?:0|[1-9]\d*)$/;return St=function(n,t){var r=typeof n;return!!(t=null==t?9007199254740991:t)&&("number"==r||"symbol"!=r&&e.test(n))&&n>-1&&n%1==0&&n<t}}function Tt(){return Ct?Nt:(Ct=1,Nt=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991})}function Lt(){return Pt?jt:(Pt=1,jt=function(e){return function(n){return e(n)}})}It.exports;var Bt,Dt,Rt,Vt,Ht,Yt,Xt,Zt,Ft,Ut,Wt,Gt,qt,$t,Kt,Qt,Jt,er,nr,tr,rr,or,ir,ar,ur,cr,lr,sr={exports:{}};function dr(){return Bt||(Bt=1,e=sr,n=sr.exports,t=et(),r=n&&!n.nodeType&&n,o=r&&e&&!e.nodeType&&e,i=o&&o.exports===r&&t.process,a=function(){try{return o&&o.require&&o.require("util").types||i&&i.binding&&i.binding("util")}catch(e){}}(),e.exports=a),sr.exports;var e,n,t,r,o,i,a}function fr(){if(Rt)return Dt;Rt=1;var e=function(){if(Ot)return Mt;Ot=1;var e=rt(),n=Tt(),t=mt(),r={};return r["[object Float32Array]"]=r["[object Float64Array]"]=r["[object Int8Array]"]=r["[object Int16Array]"]=r["[object Int32Array]"]=r["[object Uint8Array]"]=r["[object Uint8ClampedArray]"]=r["[object Uint16Array]"]=r["[object Uint32Array]"]=!0,r["[object Arguments]"]=r["[object Array]"]=r["[object ArrayBuffer]"]=r["[object Boolean]"]=r["[object DataView]"]=r["[object Date]"]=r["[object Error]"]=r["[object Function]"]=r["[object Map]"]=r["[object Number]"]=r["[object Object]"]=r["[object RegExp]"]=r["[object Set]"]=r["[object String]"]=r["[object WeakMap]"]=!1,Mt=function(o){return t(o)&&n(o.length)&&!!r[e(o)]}}(),n=Lt(),t=dr(),r=t&&t.isTypedArray,o=r?n(r):e;return Dt=o}function hr(){if(Ht)return Vt;Ht=1;var e=Vn?Rn:(Vn=1,Rn=function(e,n){for(var t=-1,r=Array(e);++t<e;)r[t]=n(t);return r}),n=wt(),t=bt(),r=At(),o=zt(),i=fr(),a=Object.prototype.hasOwnProperty;return Vt=function(u,c){var l=t(u),s=!l&&n(u),d=!l&&!s&&r(u),f=!l&&!s&&!d&&i(u),h=l||s||d||f,v=h?e(u.length,String):[],p=v.length;for(var g in u)!c&&!a.call(u,g)||h&&("length"==g||d&&("offset"==g||"parent"==g)||f&&("buffer"==g||"byteLength"==g||"byteOffset"==g)||o(g,p))||v.push(g);return v},Vt}function vr(){if(Xt)return Yt;Xt=1;var e=Object.prototype;return Yt=function(n){var t=n&&n.constructor;return n===("function"==typeof t&&t.prototype||e)}}function pr(){return Ft||(Ft=1,Zt=function(e,n){return function(t){return e(n(t))}}),Zt}function gr(){if(qt)return Gt;qt=1;var e=vr(),n=function(){if(Wt)return Ut;Wt=1;var e=pr()(Object.keys,Object);return Ut=e}(),t=Object.prototype.hasOwnProperty;return Gt=function(r){if(!e(r))return n(r);var o=[];for(var i in Object(r))t.call(r,i)&&"constructor"!=i&&o.push(i);return o}}function yr(){if(Kt)return $t;Kt=1;var e=it(),n=Tt();return $t=function(t){return null!=t&&n(t.length)&&!e(t)}}function mr(){if(Jt)return Qt;Jt=1;var e=hr(),n=gr(),t=yr();return Qt=function(r){return t(r)?e(r):n(r)}}function wr(){if(ur)return ar;ur=1;var e=hr(),n=function(){if(ir)return or;ir=1;var e=ot(),n=vr(),t=rr?tr:(rr=1,tr=function(e){var n=[];if(null!=e)for(var t in Object(e))n.push(t);return n}),r=Object.prototype.hasOwnProperty;return or=function(o){if(!e(o))return t(o);var i=n(o),a=[];for(var u in o)("constructor"!=u||!i&&r.call(o,u))&&a.push(u);return a}}(),t=yr();return ar=function(r){return t(r)?e(r,!0):n(r)}}sr.exports;var br,xr,_r,Er,Sr,kr,Nr,Cr,Mr,Or,jr,Pr,Ir,Ar,zr,Tr,Lr,Br,Dr,Rr,Vr,Hr,Yr,Xr,Zr,Fr,Ur,Wr,Gr,qr,$r,Kr,Qr,Jr,eo,no,to,ro,oo,io,ao,uo,co,lo,so,fo,ho,vo,po,go,yo,mo,wo,bo,xo,_o,Eo,So,ko,No,Co,Mo,Oo,jo,Po,Io,Ao,zo,To,Lo,Bo,Do,Ro,Vo,Ho,Yo,Xo,Zo,Fo,Uo,Wo,Go,qo,$o,Ko,Qo,Jo,ei,ni,ti,ri,oi,ii,ai,ui,ci,li,si,di,fi,hi,vi,pi,gi,yi,mi,wi,bi,xi,_i,Ei,Si,ki,Ni,Ci,Mi,Oi,ji,Pi,Ii,Ai,zi,Ti,Li,Bi,Di,Ri,Vi,Hi,Yi,Xi,Zi,Fi,Ui,Wi,Gi,qi,$i,Ki,Qi,Ji,ea,na,ta,ra,oa,ia,aa,ua,ca,la,sa,da,fa,ha,va,pa,ga,ya,ma,wa,ba,xa,_a,Ea,Sa,ka,Na,Ca,Ma,Oa,ja,Pa,Ia,Aa,za,Ta,La,Ba,Da,Ra,Va,Ha,Ya,Xa,Za,Fa,Ua,Wa,Ga,qa,$a,Ka,Qa,Ja,eu,nu,tu,ru,ou,iu,au,uu,cu,lu,su,du,fu,hu,vu,pu,gu,yu,mu,wu,bu,xu,_u,Eu,Su,ku,Nu,Cu,Mu,Ou,ju,Pu,Iu,Au,zu,Tu,Lu,Bu,Du,Ru,Vu,Hu,Yu,Xu,Zu,Fu,Uu,Wu,Gu,qu,$u,Ku,Qu,Ju,ec,nc,tc,rc,oc,ic,ac,uc,cc,lc,sc,dc,fc,hc,vc,pc,gc,yc,mc,wc,bc,xc,_c,Ec,Sc,kc,Nc,Cc,Mc,Oc,jc,Pc={exports:{}};function Ic(){return br||(br=1,function(e,n){var t=nt(),r=n&&!n.nodeType&&n,o=r&&e&&!e.nodeType&&e,i=o&&o.exports===r?t.Buffer:void 0,a=i?i.allocUnsafe:void 0;e.exports=function(e,n){if(n)return e.slice();var t=e.length,r=a?a(t):new e.constructor(t);return e.copy(r),r}}(Pc,Pc.exports)),Pc.exports}function Ac(){return _r||(_r=1,xr=function(e,n){var t=-1,r=e.length;for(n||(n=Array(r));++t<r;)n[t]=e[t];return n}),xr}function zc(){return Sr||(Sr=1,Er=function(e,n){for(var t=-1,r=null==e?0:e.length,o=0,i=[];++t<r;){var a=e[t];n(a,t,e)&&(i[o++]=a)}return i}),Er}function Tc(){return Nr?kr:(Nr=1,kr=function(){return[]})}function Lc(){if(Mr)return Cr;Mr=1;var e=zc(),n=Tc(),t=Object.prototype.propertyIsEnumerable,r=Object.getOwnPropertySymbols;return Cr=r?function(n){return null==n?[]:(n=Object(n),e(r(n),(function(e){return t.call(n,e)})))}:n}function Bc(){return Ir||(Ir=1,Pr=function(e,n){for(var t=-1,r=n.length,o=e.length;++t<r;)e[o+t]=n[t];return e}),Pr}function Dc(){if(zr)return Ar;zr=1;var e=pr()(Object.getPrototypeOf,Object);return Ar=e}function Rc(){if(Lr)return Tr;Lr=1;var e=Bc(),n=Dc(),t=Lc(),r=Tc(),o=Object.getOwnPropertySymbols;return Tr=o?function(r){for(var o=[];r;)e(o,t(r)),r=n(r);return o}:r}function Vc(){if(Vr)return Rr;Vr=1;var e=Bc(),n=bt();return Rr=function(t,r,o){var i=r(t);return n(t)?i:e(i,o(t))}}function Hc(){if(Yr)return Hr;Yr=1;var e=Vc(),n=Lc(),t=mr();return Hr=function(r){return e(r,t,n)}}function Yc(){if($r)return qr;$r=1;var e=ut()(nt(),"Set");return qr=e}function Xc(){if(eo)return Jr;eo=1;var e=function(){if(Ur)return Fr;Ur=1;var e=ut()(nt(),"DataView");return Fr=e}(),n=ct(),t=function(){if(Gr)return Wr;Gr=1;var e=ut()(nt(),"Promise");return Wr=e}(),r=Yc(),o=function(){if(Qr)return Kr;Qr=1;var e=ut()(nt(),"WeakMap");return Kr=e}(),i=rt(),a=at(),u="[object Map]",c="[object Promise]",l="[object Set]",s="[object WeakMap]",d="[object DataView]",f=a(e),h=a(n),v=a(t),p=a(r),g=a(o),y=i;return(e&&y(new e(new ArrayBuffer(1)))!=d||n&&y(new n)!=u||t&&y(t.resolve())!=c||r&&y(new r)!=l||o&&y(new o)!=s)&&(y=function(e){var n=i(e),t="[object Object]"==n?e.constructor:void 0,r=t?a(t):"";if(r)switch(r){case f:return d;case h:return u;case v:return c;case p:return l;case g:return s}return n}),Jr=y}function Zc(){if(oo)return ro;oo=1;var e=nt().Uint8Array;return ro=e}function Fc(){if(ao)return io;ao=1;var e=Zc();return io=function(n){var t=new n.constructor(n.byteLength);return new e(t).set(new e(n)),t}}function Uc(){if(po)return vo;po=1;var e=Fc();return vo=function(n,t){var r=t?e(n.buffer):n.buffer;return new n.constructor(r,n.byteOffset,n.length)}}function Wc(){if(wo)return mo;wo=1;var e=ot(),n=Object.create,t=function(){function t(){}return function(r){if(!e(r))return{};if(n)return n(r);t.prototype=r;var o=new t;return t.prototype=void 0,o}}();return mo=t}function Gc(){if(xo)return bo;xo=1;var e=Wc(),n=Dc(),t=vr();return bo=function(r){return"function"!=typeof r.constructor||t(r)?{}:e(n(r))}}function qc(){if(Po)return jo;Po=1;var e=ft(),n=ht(),t=gt(),r=function(){if(nr)return er;nr=1;var e=yt(),n=mr();return er=function(t,r){return t&&e(r,n(r),t)}}(),o=function(){if(lr)return cr;lr=1;var e=yt(),n=wr();return cr=function(t,r){return t&&e(r,n(r),t)}}(),i=Ic(),a=Ac(),u=function(){if(jr)return Or;jr=1;var e=yt(),n=Lc();return Or=function(t,r){return e(t,n(t),r)}}(),c=function(){if(Dr)return Br;Dr=1;var e=yt(),n=Rc();return Br=function(t,r){return e(t,n(t),r)}}(),l=Hc(),s=function(){if(Zr)return Xr;Zr=1;var e=Vc(),n=Rc(),t=wr();return Xr=function(r){return e(r,t,n)}}(),d=Xc(),f=function(){if(to)return no;to=1;var e=Object.prototype.hasOwnProperty;return no=function(n){var t=n.length,r=new n.constructor(t);return t&&"string"==typeof n[0]&&e.call(n,"index")&&(r.index=n.index,r.input=n.input),r},no}(),h=function(){if(yo)return go;yo=1;var e=Fc(),n=function(){if(co)return uo;co=1;var e=Fc();return uo=function(n,t){var r=t?e(n.buffer):n.buffer;return new n.constructor(r,n.byteOffset,n.byteLength)}}(),t=function(){if(so)return lo;so=1;var e=/\w*$/;return lo=function(n){var t=new n.constructor(n.source,e.exec(n));return t.lastIndex=n.lastIndex,t}}(),r=function(){if(ho)return fo;ho=1;var e=tt(),n=e?e.prototype:void 0,t=n?n.valueOf:void 0;return fo=function(e){return t?Object(t.call(e)):{}}}(),o=Uc();return go=function(i,a,u){var c=i.constructor;switch(a){case"[object ArrayBuffer]":return e(i);case"[object Boolean]":case"[object Date]":return new c(+i);case"[object DataView]":return n(i,u);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return o(i,u);case"[object Map]":case"[object Set]":return new c;case"[object Number]":case"[object String]":return new c(i);case"[object RegExp]":return t(i);case"[object Symbol]":return r(i)}}}(),v=Gc(),p=bt(),g=At(),y=function(){if(ko)return So;ko=1;var e=function(){if(Eo)return _o;Eo=1;var e=Xc(),n=mt();return _o=function(t){return n(t)&&"[object Map]"==e(t)}}(),n=Lt(),t=dr(),r=t&&t.isMap,o=r?n(r):e;return So=o}(),m=ot(),w=function(){if(Oo)return Mo;Oo=1;var e=function(){if(Co)return No;Co=1;var e=Xc(),n=mt();return No=function(t){return n(t)&&"[object Set]"==e(t)}}(),n=Lt(),t=dr(),r=t&&t.isSet,o=r?n(r):e;return Mo=o}(),b=mr(),x=wr(),_="[object Arguments]",E="[object Function]",S="[object Object]",k={};return k[_]=k["[object Array]"]=k["[object ArrayBuffer]"]=k["[object DataView]"]=k["[object Boolean]"]=k["[object Date]"]=k["[object Float32Array]"]=k["[object Float64Array]"]=k["[object Int8Array]"]=k["[object Int16Array]"]=k["[object Int32Array]"]=k["[object Map]"]=k["[object Number]"]=k[S]=k["[object RegExp]"]=k["[object Set]"]=k["[object String]"]=k["[object Symbol]"]=k["[object Uint8Array]"]=k["[object Uint8ClampedArray]"]=k["[object Uint16Array]"]=k["[object Uint32Array]"]=!0,k["[object Error]"]=k[E]=k["[object WeakMap]"]=!1,jo=function N(C,M,O,j,P,I){var A,z=1&M,T=2&M,L=4&M;if(O&&(A=P?O(C,j,P,I):O(C)),void 0!==A)return A;if(!m(C))return C;var B=p(C);if(B){if(A=f(C),!z)return a(C,A)}else{var D=d(C),R=D==E||"[object GeneratorFunction]"==D;if(g(C))return i(C,z);if(D==S||D==_||R&&!P){if(A=T||R?{}:v(C),!z)return T?c(C,o(A,C)):u(C,r(A,C))}else{if(!k[D])return P?C:{};A=h(C,D,z)}}I||(I=new e);var V=I.get(C);if(V)return V;I.set(C,A),w(C)?C.forEach((function(e){A.add(N(e,M,O,e,C,I))})):y(C)&&C.forEach((function(e,n){A.set(n,N(e,M,O,n,C,I))}));var H=B?void 0:(L?T?s:l:T?x:b)(C);return n(H||C,(function(e,n){H&&(e=C[n=e]),t(A,n,N(e,M,O,n,C,I))})),A},jo}function $c(){if(Ao)return Io;Ao=1;var e=qc();return Io=function(n){return e(n,4)}}function Kc(){return To?zo:(To=1,zo=function(e){return function(){return e}})}function Qc(){if(Ro)return Do;Ro=1;var e=(Bo?Lo:(Bo=1,Lo=function(e){return function(n,t,r){for(var o=-1,i=Object(n),a=r(n),u=a.length;u--;){var c=a[e?u:++o];if(!1===t(i[c],c,i))break}return n}}))();return Do=e}function Jc(){if(Ho)return Vo;Ho=1;var e=Qc(),n=mr();return Vo=function(t,r){return t&&e(t,r,n)}}function el(){if(Fo)return Zo;Fo=1;var e=Jc(),n=function(){if(Xo)return Yo;Xo=1;var e=yr();return Yo=function(n,t){return function(r,o){if(null==r)return r;if(!e(r))return n(r,o);for(var i=r.length,a=t?i:-1,u=Object(r);(t?a--:++a<i)&&!1!==o(u[a],a,u););return r}}}(),t=n(e);return Zo=t}function nl(){return Wo?Uo:(Wo=1,Uo=function(e){return e})}function tl(){if(qo)return Go;qo=1;var e=nl();return Go=function(n){return"function"==typeof n?n:e}}function rl(){if(Ko)return $o;Ko=1;var e=ht(),n=el(),t=tl(),r=bt();return $o=function(o,i){return(r(o)?e:n)(o,t(i))}}function ol(){return Jo?Qo:(Jo=1,Qo=rl())}function il(){if(ui)return ai;ui=1;var e=dt(),n=ri?ti:(ri=1,ti=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this}),t=ii?oi:(ii=1,oi=function(e){return this.__data__.has(e)});function r(n){var t=-1,r=null==n?0:n.length;for(this.__data__=new e;++t<r;)this.add(n[t])}return r.prototype.add=r.prototype.push=n,r.prototype.has=t,ai=r}function al(){return di?si:(di=1,si=function(e,n){return e.has(n)})}function ul(){if(hi)return fi;hi=1;var e=il(),n=(li||(li=1,ci=function(e,n){for(var t=-1,r=null==e?0:e.length;++t<r;)if(n(e[t],t,e))return!0;return!1}),ci),t=al();return fi=function(r,o,i,a,u,c){var l=1&i,s=r.length,d=o.length;if(s!=d&&!(l&&d>s))return!1;var f=c.get(r),h=c.get(o);if(f&&h)return f==o&&h==r;var v=-1,p=!0,g=2&i?new e:void 0;for(c.set(r,o),c.set(o,r);++v<s;){var y=r[v],m=o[v];if(a)var w=l?a(m,y,v,o,r,c):a(y,m,v,r,o,c);if(void 0!==w){if(w)continue;p=!1;break}if(g){if(!n(o,(function(e,n){if(!t(g,n)&&(y===e||u(y,e,i,a,c)))return g.push(n)}))){p=!1;break}}else if(y!==m&&!u(y,m,i,a,c)){p=!1;break}}return c.delete(r),c.delete(o),p},fi}function cl(){return yi||(yi=1,gi=function(e){var n=-1,t=Array(e.size);return e.forEach((function(e){t[++n]=e})),t}),gi}function ll(){if(Ei)return _i;Ei=1;var e=ft(),n=ul(),t=function(){if(wi)return mi;wi=1;var e=tt(),n=Zc(),t=Kn(),r=ul(),o=(pi||(pi=1,vi=function(e){var n=-1,t=Array(e.size);return e.forEach((function(e,r){t[++n]=[r,e]})),t}),vi),i=cl(),a=e?e.prototype:void 0,u=a?a.valueOf:void 0;return mi=function(e,a,c,l,s,d,f){switch(c){case"[object DataView]":if(e.byteLength!=a.byteLength||e.byteOffset!=a.byteOffset)return!1;e=e.buffer,a=a.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=a.byteLength||!d(new n(e),new n(a)));case"[object Boolean]":case"[object Date]":case"[object Number]":return t(+e,+a);case"[object Error]":return e.name==a.name&&e.message==a.message;case"[object RegExp]":case"[object String]":return e==a+"";case"[object Map]":var h=o;case"[object Set]":var v=1&l;if(h||(h=i),e.size!=a.size&&!v)return!1;var p=f.get(e);if(p)return p==a;l|=2,f.set(e,a);var g=r(h(e),h(a),l,s,d,f);return f.delete(e),g;case"[object Symbol]":if(u)return u.call(e)==u.call(a)}return!1}}(),r=function(){if(xi)return bi;xi=1;var e=Hc(),n=Object.prototype.hasOwnProperty;return bi=function(t,r,o,i,a,u){var c=1&o,l=e(t),s=l.length;if(s!=e(r).length&&!c)return!1;for(var d=s;d--;){var f=l[d];if(!(c?f in r:n.call(r,f)))return!1}var h=u.get(t),v=u.get(r);if(h&&v)return h==r&&v==t;var p=!0;u.set(t,r),u.set(r,t);for(var g=c;++d<s;){var y=t[f=l[d]],m=r[f];if(i)var w=c?i(m,y,f,r,t,u):i(y,m,f,t,r,u);if(!(void 0===w?y===m||a(y,m,o,i,u):w)){p=!1;break}g||(g="constructor"==f)}if(p&&!g){var b=t.constructor,x=r.constructor;b==x||!("constructor"in t)||!("constructor"in r)||"function"==typeof b&&b instanceof b&&"function"==typeof x&&x instanceof x||(p=!1)}return u.delete(t),u.delete(r),p}}(),o=Xc(),i=bt(),a=At(),u=fr(),c="[object Arguments]",l="[object Array]",s="[object Object]",d=Object.prototype.hasOwnProperty;return _i=function(f,h,v,p,g,y){var m=i(f),w=i(h),b=m?l:o(f),x=w?l:o(h),_=(b=b==c?s:b)==s,E=(x=x==c?s:x)==s,S=b==x;if(S&&a(f)){if(!a(h))return!1;m=!0,_=!1}if(S&&!_)return y||(y=new e),m||u(f)?n(f,h,v,p,g,y):t(f,h,b,v,p,g,y);if(!(1&v)){var k=_&&d.call(f,"__wrapped__"),N=E&&d.call(h,"__wrapped__");if(k||N){var C=k?f.value():f,M=N?h.value():h;return y||(y=new e),g(C,M,v,p,y)}}return!!S&&(y||(y=new e),r(f,h,v,p,g,y))}}function sl(){if(ki)return Si;ki=1;var e=ll(),n=mt();return Si=function t(r,o,i,a,u){return r===o||(null==r||null==o||!n(r)&&!n(o)?r!=r&&o!=o:e(r,o,i,a,t,u))},Si}function dl(){if(Oi)return Mi;Oi=1;var e=ot();return Mi=function(n){return n==n&&!e(n)}}function fl(){return Ai?Ii:(Ai=1,Ii=function(e,n){return function(t){return null!=t&&t[e]===n&&(void 0!==n||e in Object(t))}})}function hl(){if(Bi)return Li;Bi=1;var e=rt(),n=mt();return Li=function(t){return"symbol"==typeof t||n(t)&&"[object Symbol]"==e(t)}}function vl(){if(Ri)return Di;Ri=1;var e=bt(),n=hl(),t=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;return Di=function(o,i){if(e(o))return!1;var a=typeof o;return!("number"!=a&&"symbol"!=a&&"boolean"!=a&&null!=o&&!n(o))||r.test(o)||!t.test(o)||null!=i&&o in Object(i)}}function pl(){return Wi||(Wi=1,Ui=function(e,n){for(var t=-1,r=null==e?0:e.length,o=Array(r);++t<r;)o[t]=n(e[t],t,e);return o}),Ui}function gl(){if(Ki)return $i;Ki=1;var e=function(){if(qi)return Gi;qi=1;var e=tt(),n=pl(),t=bt(),r=hl(),o=e?e.prototype:void 0,i=o?o.toString:void 0;return Gi=function e(o){if("string"==typeof o)return o;if(t(o))return n(o,e)+"";if(r(o))return i?i.call(o):"";var a=o+"";return"0"==a&&1/o==-1/0?"-0":a},Gi}();return $i=function(n){return null==n?"":e(n)}}function yl(){if(Ji)return Qi;Ji=1;var e=bt(),n=vl(),t=function(){if(Fi)return Zi;Fi=1;var e=function(){if(Xi)return Yi;Xi=1;var e=function(){if(Hi)return Vi;Hi=1;var e=dt();function n(t,r){if("function"!=typeof t||null!=r&&"function"!=typeof r)throw new TypeError("Expected a function");var o=function(){var e=arguments,n=r?r.apply(this,e):e[0],i=o.cache;if(i.has(n))return i.get(n);var a=t.apply(this,e);return o.cache=i.set(n,a)||i,a};return o.cache=new(n.Cache||e),o}return n.Cache=e,Vi=n}();return Yi=function(n){var t=e(n,(function(e){return 500===r.size&&r.clear(),e})),r=t.cache;return t}}(),n=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,t=/\\(\\)?/g,r=e((function(e){var r=[];return 46===e.charCodeAt(0)&&r.push(""),e.replace(n,(function(e,n,o,i){r.push(o?i.replace(t,"$1"):n||e)})),r}));return Zi=r}(),r=gl();return Qi=function(o,i){return e(o)?o:n(o,i)?[o]:t(r(o))}}function ml(){if(na)return ea;na=1;var e=hl();return ea=function(n){if("string"==typeof n||e(n))return n;var t=n+"";return"0"==t&&1/n==-1/0?"-0":t}}function wl(){if(ra)return ta;ra=1;var e=yl(),n=ml();return ta=function(t,r){for(var o=0,i=(r=e(r,t)).length;null!=t&&o<i;)t=t[n(r[o++])];return o&&o==i?t:void 0}}function bl(){if(la)return ca;la=1;var e=yl(),n=wt(),t=bt(),r=zt(),o=Tt(),i=ml();return ca=function(a,u,c){for(var l=-1,s=(u=e(u,a)).length,d=!1;++l<s;){var f=i(u[l]);if(!(d=null!=a&&c(a,f)))break;a=a[f]}return d||++l!=s?d:!!(s=null==a?0:a.length)&&o(s)&&r(f,s)&&(t(a)||n(a))}}function xl(){if(da)return sa;da=1;var e=ua?aa:(ua=1,aa=function(e,n){return null!=e&&n in Object(e)}),n=bl();return sa=function(t,r){return null!=t&&n(t,r,e)}}function _l(){return pa?va:(pa=1,va=function(e){return function(n){return null==n?void 0:n[e]}})}function El(){if(xa)return ba;xa=1;var e=function(){if(Ti)return zi;Ti=1;var e=function(){if(Ci)return Ni;Ci=1;var e=ft(),n=sl();return Ni=function(t,r,o,i){var a=o.length,u=a,c=!i;if(null==t)return!u;for(t=Object(t);a--;){var l=o[a];if(c&&l[2]?l[1]!==t[l[0]]:!(l[0]in t))return!1}for(;++a<u;){var s=(l=o[a])[0],d=t[s],f=l[1];if(c&&l[2]){if(void 0===d&&!(s in t))return!1}else{var h=new e;if(i)var v=i(d,f,s,t,r,h);if(!(void 0===v?n(f,d,3,i,h):v))return!1}}return!0}}(),n=function(){if(Pi)return ji;Pi=1;var e=dl(),n=mr();return ji=function(t){for(var r=n(t),o=r.length;o--;){var i=r[o],a=t[i];r[o]=[i,a,e(a)]}return r}}(),t=fl();return zi=function(r){var o=n(r);return 1==o.length&&o[0][2]?t(o[0][0],o[0][1]):function(n){return n===r||e(n,r,o)}}}(),n=function(){if(ha)return fa;ha=1;var e=sl(),n=function(){if(ia)return oa;ia=1;var e=wl();return oa=function(n,t,r){var o=null==n?void 0:e(n,t);return void 0===o?r:o}}(),t=xl(),r=vl(),o=dl(),i=fl(),a=ml();return fa=function(u,c){return r(u)&&o(c)?i(a(u),c):function(r){var o=n(r,u);return void 0===o&&o===c?t(r,u):e(c,o,3)}}}(),t=nl(),r=bt(),o=function(){if(wa)return ma;wa=1;var e=_l(),n=function(){if(ya)return ga;ya=1;var e=wl();return ga=function(n){return function(t){return e(t,n)}}}(),t=vl(),r=ml();return ma=function(o){return t(o)?e(r(o)):n(o)}}();return ba=function(i){return"function"==typeof i?i:null==i?t:"object"==typeof i?r(i)?n(i[0],i[1]):e(i):o(i)}}function Sl(){if(Ea)return _a;Ea=1;var e=zc(),n=function(){if(ni)return ei;ni=1;var e=el();return ei=function(n,t){var r=[];return e(n,(function(e,n,o){t(e,n,o)&&r.push(e)})),r}}(),t=El(),r=bt();return _a=function(o,i){return(r(o)?e:n)(o,t(i,3))}}function kl(){if(Ca)return Na;Ca=1;var e=function(){if(ka)return Sa;ka=1;var e=Object.prototype.hasOwnProperty;return Sa=function(n,t){return null!=n&&e.call(n,t)}}(),n=bl();return Na=function(t,r){return null!=t&&n(t,r,e)}}function Nl(){if(Oa)return Ma;Oa=1;var e=gr(),n=Xc(),t=wt(),r=bt(),o=yr(),i=At(),a=vr(),u=fr(),c=Object.prototype.hasOwnProperty;return Ma=function(l){if(null==l)return!0;if(o(l)&&(r(l)||"string"==typeof l||"function"==typeof l.splice||i(l)||u(l)||t(l)))return!l.length;var s=n(l);if("[object Map]"==s||"[object Set]"==s)return!l.size;if(a(l))return!e(l).length;for(var d in l)if(c.call(l,d))return!1;return!0}}function Cl(){return Pa?ja:(Pa=1,ja=function(e){return void 0===e})}function Ml(){if(Aa)return Ia;Aa=1;var e=el(),n=yr();return Ia=function(t,r){var o=-1,i=n(t)?Array(t.length):[];return e(t,(function(e,n,t){i[++o]=r(e,n,t)})),i}}function Ol(){if(Ta)return za;Ta=1;var e=pl(),n=El(),t=Ml(),r=bt();return za=function(o,i){return(r(o)?e:t)(o,n(i,3))}}function jl(){if(Ha)return Va;Ha=1;var e=(Ba||(Ba=1,La=function(e,n,t,r){var o=-1,i=null==e?0:e.length;for(r&&i&&(t=e[++o]);++o<i;)t=n(t,e[o],o,e);return t}),La),n=el(),t=El(),r=Ra?Da:(Ra=1,Da=function(e,n,t,r,o){return o(e,(function(e,o,i){t=r?(r=!1,e):n(t,e,o,i)})),t}),o=bt();return Va=function(i,a,u){var c=o(i)?e:r,l=arguments.length<3;return c(i,t(a,4),u,l,n)},Va}function Pl(){if(Ja)return Qa;Ja=1;var e=gr(),n=Xc(),t=yr(),r=function(){if(Xa)return Ya;Xa=1;var e=rt(),n=bt(),t=mt();return Ya=function(r){return"string"==typeof r||!n(r)&&t(r)&&"[object String]"==e(r)}}(),o=function(){if(Ka)return $a;Ka=1;var e=function(){if(Fa)return Za;Fa=1;var e=_l()("length");return Za=e}(),n=function(){if(Wa)return Ua;Wa=1;var e=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");return Ua=function(n){return e.test(n)}}(),t=function(){if(qa)return Ga;qa=1;var e="\\ud800-\\udfff",n="["+e+"]",t="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",r="\\ud83c[\\udffb-\\udfff]",o="[^"+e+"]",i="(?:\\ud83c[\\udde6-\\uddff]){2}",a="[\\ud800-\\udbff][\\udc00-\\udfff]",u="(?:"+t+"|"+r+")?",c="[\\ufe0e\\ufe0f]?",l=c+u+"(?:\\u200d(?:"+[o,i,a].join("|")+")"+c+u+")*",s="(?:"+[o+t+"?",t,i,a,n].join("|")+")",d=RegExp(r+"(?="+r+")|"+s+l,"g");return Ga=function(e){for(var n=d.lastIndex=0;d.test(e);)++n;return n}}();return $a=function(r){return n(r)?t(r):e(r)}}();return Qa=function(i){if(null==i)return 0;if(t(i))return r(i)?o(i):i.length;var a=n(i);return"[object Map]"==a||"[object Set]"==a?i.size:e(i).length}}function Il(){if(nu)return eu;nu=1;var e=ht(),n=Wc(),t=Jc(),r=El(),o=Dc(),i=bt(),a=At(),u=it(),c=ot(),l=fr();return eu=function(s,d,f){var h=i(s),v=h||a(s)||l(s);if(d=r(d,4),null==f){var p=s&&s.constructor;f=v?h?new p:[]:c(s)&&u(p)?n(o(s)):{}}return(v?e:t)(s,(function(e,n,t){return d(f,e,n,t)})),f}}function Al(){if(iu)return ou;iu=1;var e=Bc(),n=function(){if(ru)return tu;ru=1;var e=tt(),n=wt(),t=bt(),r=e?e.isConcatSpreadable:void 0;return tu=function(e){return t(e)||n(e)||!!(r&&e&&e[r])}}();return ou=function t(r,o,i,a,u){var c=-1,l=r.length;for(i||(i=n),u||(u=[]);++c<l;){var s=r[c];o>0&&i(s)?o>1?t(s,o-1,i,a,u):e(u,s):a||(u[u.length]=s)}return u},ou}function zl(){if(lu)return cu;lu=1;var e=uu?au:(uu=1,au=function(e,n,t){switch(t.length){case 0:return e.call(n);case 1:return e.call(n,t[0]);case 2:return e.call(n,t[0],t[1]);case 3:return e.call(n,t[0],t[1],t[2])}return e.apply(n,t)}),n=Math.max;return cu=function(t,r,o){return r=n(void 0===r?t.length-1:r,0),function(){for(var i=arguments,a=-1,u=n(i.length-r,0),c=Array(u);++a<u;)c[a]=i[r+a];a=-1;for(var l=Array(r+1);++a<r;)l[a]=i[a];return l[r]=o(c),e(t,this,l)}},cu}function Tl(){if(pu)return vu;pu=1;var e=function(){if(du)return su;du=1;var e=Kc(),n=vt(),t=nl();return su=n?function(t,r){return n(t,"toString",{configurable:!0,enumerable:!1,value:e(r),writable:!0})}:t}(),n=function(){if(hu)return fu;hu=1;var e=Date.now;return fu=function(n){var t=0,r=0;return function(){var o=e(),i=16-(o-r);if(r=o,i>0){if(++t>=800)return arguments[0]}else t=0;return n.apply(void 0,arguments)}},fu}(),t=n(e);return vu=t}function Ll(){if(yu)return gu;yu=1;var e=nl(),n=zl(),t=Tl();return gu=function(r,o){return t(n(r,o,e),r+"")},gu}function Bl(){return wu||(wu=1,mu=function(e,n,t,r){for(var o=e.length,i=t+(r?1:-1);r?i--:++i<o;)if(n(e[i],i,e))return i;return-1}),mu}function Dl(){if(Tu)return zu;Tu=1;var e=il(),n=function(){if(Cu)return Nu;Cu=1;var e=function(){if(ku)return Su;ku=1;var e=Bl(),n=xu?bu:(xu=1,bu=function(e){return e!=e}),t=(Eu||(Eu=1,_u=function(e,n,t){for(var r=t-1,o=e.length;++r<o;)if(e[r]===n)return r;return-1}),_u);return Su=function(r,o,i){return o==o?t(r,o,i):e(r,n,i)},Su}();return Nu=function(n,t){return!(null==n||!n.length)&&e(n,t,0)>-1},Nu}(),t=(Ou||(Ou=1,Mu=function(e,n,t){for(var r=-1,o=null==e?0:e.length;++r<o;)if(t(n,e[r]))return!0;return!1}),Mu),r=al(),o=function(){if(Au)return Iu;Au=1;var e=Yc(),n=Pu?ju:(Pu=1,ju=function(){}),t=cl(),r=e&&1/t(new e([,-0]))[1]==1/0?function(n){return new e(n)}:n;return Iu=r}(),i=cl();return zu=function(a,u,c){var l=-1,s=n,d=a.length,f=!0,h=[],v=h;if(c)f=!1,s=t;else if(d>=200){var p=u?null:o(a);if(p)return i(p);f=!1,s=r,v=new e}else v=u?[]:h;e:for(;++l<d;){var g=a[l],y=u?u(g):g;if(g=c||0!==g?g:0,f&&y==y){for(var m=v.length;m--;)if(v[m]===y)continue e;u&&v.push(y),h.push(g)}else s(v,y,c)||(v!==h&&v.push(y),h.push(g))}return h},zu}function Rl(){if(Bu)return Lu;Bu=1;var e=yr(),n=mt();return Lu=function(t){return n(t)&&e(t)}}function Vl(){if(Ru)return Du;Ru=1;var e=Al(),n=Ll(),t=Dl(),r=Rl(),o=n((function(n){return t(e(n,1,r,!0))}));return Du=o}function Hl(){if(Xu)return Yu;Xu=1;var e=function(){if(Hu)return Vu;Hu=1;var e=pl();return Vu=function(n,t){return e(t,(function(e){return n[e]}))}}(),n=mr();return Yu=function(t){return null==t?[]:e(t,n(t))}}function Yl(){if(Fu)return Zu;var e;Fu=1;try{e={clone:$c(),constant:Kc(),each:ol(),filter:Sl(),has:kl(),isArray:bt(),isEmpty:Nl(),isFunction:it(),isUndefined:Cl(),keys:mr(),map:Ol(),reduce:jl(),size:Pl(),transform:Il(),union:Vl(),values:Hl()}}catch(e){}return e||(e=window._),Zu=e}function Xl(){if(Wu)return Uu;Wu=1;var e=Yl();Uu=o;var n="\0",t="\0",r="";function o(n){this._isDirected=!e.has(n,"directed")||n.directed,this._isMultigraph=!!e.has(n,"multigraph")&&n.multigraph,this._isCompound=!!e.has(n,"compound")&&n.compound,this._label=void 0,this._defaultNodeLabelFn=e.constant(void 0),this._defaultEdgeLabelFn=e.constant(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[t]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}function i(e,n){e[n]?e[n]++:e[n]=1}function a(e,n){--e[n]||delete e[n]}function u(t,o,i,a){var u=""+o,c=""+i;if(!t&&u>c){var l=u;u=c,c=l}return u+r+c+r+(e.isUndefined(a)?n:a)}function c(e,n){return u(e,n.v,n.w,n.name)}return o.prototype._nodeCount=0,o.prototype._edgeCount=0,o.prototype.isDirected=function(){return this._isDirected},o.prototype.isMultigraph=function(){return this._isMultigraph},o.prototype.isCompound=function(){return this._isCompound},o.prototype.setGraph=function(e){return this._label=e,this},o.prototype.graph=function(){return this._label},o.prototype.setDefaultNodeLabel=function(n){return e.isFunction(n)||(n=e.constant(n)),this._defaultNodeLabelFn=n,this},o.prototype.nodeCount=function(){return this._nodeCount},o.prototype.nodes=function(){return e.keys(this._nodes)},o.prototype.sources=function(){var n=this;return e.filter(this.nodes(),(function(t){return e.isEmpty(n._in[t])}))},o.prototype.sinks=function(){var n=this;return e.filter(this.nodes(),(function(t){return e.isEmpty(n._out[t])}))},o.prototype.setNodes=function(n,t){var r=arguments,o=this;return e.each(n,(function(e){r.length>1?o.setNode(e,t):o.setNode(e)})),this},o.prototype.setNode=function(n,r){return e.has(this._nodes,n)?(arguments.length>1&&(this._nodes[n]=r),this):(this._nodes[n]=arguments.length>1?r:this._defaultNodeLabelFn(n),this._isCompound&&(this._parent[n]=t,this._children[n]={},this._children[t][n]=!0),this._in[n]={},this._preds[n]={},this._out[n]={},this._sucs[n]={},++this._nodeCount,this)},o.prototype.node=function(e){return this._nodes[e]},o.prototype.hasNode=function(n){return e.has(this._nodes,n)},o.prototype.removeNode=function(n){var t=this;if(e.has(this._nodes,n)){var r=function(e){t.removeEdge(t._edgeObjs[e])};delete this._nodes[n],this._isCompound&&(this._removeFromParentsChildList(n),delete this._parent[n],e.each(this.children(n),(function(e){t.setParent(e)})),delete this._children[n]),e.each(e.keys(this._in[n]),r),delete this._in[n],delete this._preds[n],e.each(e.keys(this._out[n]),r),delete this._out[n],delete this._sucs[n],--this._nodeCount}return this},o.prototype.setParent=function(n,r){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(e.isUndefined(r))r=t;else{for(var o=r+="";!e.isUndefined(o);o=this.parent(o))if(o===n)throw new Error("Setting "+r+" as parent of "+n+" would create a cycle");this.setNode(r)}return this.setNode(n),this._removeFromParentsChildList(n),this._parent[n]=r,this._children[r][n]=!0,this},o.prototype._removeFromParentsChildList=function(e){delete this._children[this._parent[e]][e]},o.prototype.parent=function(e){if(this._isCompound){var n=this._parent[e];if(n!==t)return n}},o.prototype.children=function(n){if(e.isUndefined(n)&&(n=t),this._isCompound){var r=this._children[n];if(r)return e.keys(r)}else{if(n===t)return this.nodes();if(this.hasNode(n))return[]}},o.prototype.predecessors=function(n){var t=this._preds[n];if(t)return e.keys(t)},o.prototype.successors=function(n){var t=this._sucs[n];if(t)return e.keys(t)},o.prototype.neighbors=function(n){var t=this.predecessors(n);if(t)return e.union(t,this.successors(n))},o.prototype.isLeaf=function(e){return 0===(this.isDirected()?this.successors(e):this.neighbors(e)).length},o.prototype.filterNodes=function(n){var t=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});t.setGraph(this.graph());var r=this;e.each(this._nodes,(function(e,r){n(r)&&t.setNode(r,e)})),e.each(this._edgeObjs,(function(e){t.hasNode(e.v)&&t.hasNode(e.w)&&t.setEdge(e,r.edge(e))}));var o={};function i(e){var n=r.parent(e);return void 0===n||t.hasNode(n)?(o[e]=n,n):n in o?o[n]:i(n)}return this._isCompound&&e.each(t.nodes(),(function(e){t.setParent(e,i(e))})),t},o.prototype.setDefaultEdgeLabel=function(n){return e.isFunction(n)||(n=e.constant(n)),this._defaultEdgeLabelFn=n,this},o.prototype.edgeCount=function(){return this._edgeCount},o.prototype.edges=function(){return e.values(this._edgeObjs)},o.prototype.setPath=function(n,t){var r=this,o=arguments;return e.reduce(n,(function(e,n){return o.length>1?r.setEdge(e,n,t):r.setEdge(e,n),n})),this},o.prototype.setEdge=function(){var n,t,r,o,a=!1,c=arguments[0];"object"==typeof c&&null!==c&&"v"in c?(n=c.v,t=c.w,r=c.name,2===arguments.length&&(o=arguments[1],a=!0)):(n=c,t=arguments[1],r=arguments[3],arguments.length>2&&(o=arguments[2],a=!0)),n=""+n,t=""+t,e.isUndefined(r)||(r=""+r);var l=u(this._isDirected,n,t,r);if(e.has(this._edgeLabels,l))return a&&(this._edgeLabels[l]=o),this;if(!e.isUndefined(r)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(n),this.setNode(t),this._edgeLabels[l]=a?o:this._defaultEdgeLabelFn(n,t,r);var s=function(e,n,t,r){var o=""+n,i=""+t;if(!e&&o>i){var a=o;o=i,i=a}var u={v:o,w:i};return r&&(u.name=r),u}(this._isDirected,n,t,r);return n=s.v,t=s.w,Object.freeze(s),this._edgeObjs[l]=s,i(this._preds[t],n),i(this._sucs[n],t),this._in[t][l]=s,this._out[n][l]=s,this._edgeCount++,this},o.prototype.edge=function(e,n,t){var r=1===arguments.length?c(this._isDirected,arguments[0]):u(this._isDirected,e,n,t);return this._edgeLabels[r]},o.prototype.hasEdge=function(n,t,r){var o=1===arguments.length?c(this._isDirected,arguments[0]):u(this._isDirected,n,t,r);return e.has(this._edgeLabels,o)},o.prototype.removeEdge=function(e,n,t){var r=1===arguments.length?c(this._isDirected,arguments[0]):u(this._isDirected,e,n,t),o=this._edgeObjs[r];return o&&(e=o.v,n=o.w,delete this._edgeLabels[r],delete this._edgeObjs[r],a(this._preds[n],e),a(this._sucs[e],n),delete this._in[n][r],delete this._out[e][r],this._edgeCount--),this},o.prototype.inEdges=function(n,t){var r=this._in[n];if(r){var o=e.values(r);return t?e.filter(o,(function(e){return e.v===t})):o}},o.prototype.outEdges=function(n,t){var r=this._out[n];if(r){var o=e.values(r);return t?e.filter(o,(function(e){return e.w===t})):o}},o.prototype.nodeEdges=function(e,n){var t=this.inEdges(e,n);if(t)return t.concat(this.outEdges(e,n))},Uu}function Zl(){if(Ju)return Qu;Ju=1;var e=Yl(),n=Xl();function t(n){return e.map(n.nodes(),(function(t){var r=n.node(t),o=n.parent(t),i={v:t};return e.isUndefined(r)||(i.value=r),e.isUndefined(o)||(i.parent=o),i}))}function r(n){return e.map(n.edges(),(function(t){var r=n.edge(t),o={v:t.v,w:t.w};return e.isUndefined(t.name)||(o.name=t.name),e.isUndefined(r)||(o.value=r),o}))}return Qu={write:function(n){var o={options:{directed:n.isDirected(),multigraph:n.isMultigraph(),compound:n.isCompound()},nodes:t(n),edges:r(n)};return e.isUndefined(n.graph())||(o.value=e.clone(n.graph())),o},read:function(t){var r=new n(t.options).setGraph(t.value);return e.each(t.nodes,(function(e){r.setNode(e.v,e.value),e.parent&&r.setParent(e.v,e.parent)})),e.each(t.edges,(function(e){r.setEdge({v:e.v,w:e.w,name:e.name},e.value)})),r}}}function Fl(){if(nc)return ec;nc=1;var e=Yl();return ec=function(n){var t,r={},o=[];function i(o){e.has(r,o)||(r[o]=!0,t.push(o),e.each(n.successors(o),i),e.each(n.predecessors(o),i))}return e.each(n.nodes(),(function(e){t=[],i(e),t.length&&o.push(t)})),o},ec}function Ul(){if(rc)return tc;rc=1;var e=Yl();function n(){this._arr=[],this._keyIndices={}}return tc=n,n.prototype.size=function(){return this._arr.length},n.prototype.keys=function(){return this._arr.map((function(e){return e.key}))},n.prototype.has=function(n){return e.has(this._keyIndices,n)},n.prototype.priority=function(e){var n=this._keyIndices[e];if(void 0!==n)return this._arr[n].priority},n.prototype.min=function(){if(0===this.size())throw new Error("Queue underflow");return this._arr[0].key},n.prototype.add=function(n,t){var r=this._keyIndices;if(n=String(n),!e.has(r,n)){var o=this._arr,i=o.length;return r[n]=i,o.push({key:n,priority:t}),this._decrease(i),!0}return!1},n.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var e=this._arr.pop();return delete this._keyIndices[e.key],this._heapify(0),e.key},n.prototype.decrease=function(e,n){var t=this._keyIndices[e];if(n>this._arr[t].priority)throw new Error("New priority is greater than current priority. Key: "+e+" Old: "+this._arr[t].priority+" New: "+n);this._arr[t].priority=n,this._decrease(t)},n.prototype._heapify=function(e){var n=this._arr,t=2*e,r=t+1,o=e;t<n.length&&(o=n[t].priority<n[o].priority?t:o,r<n.length&&(o=n[r].priority<n[o].priority?r:o),o!==e&&(this._swap(e,o),this._heapify(o)))},n.prototype._decrease=function(e){for(var n,t=this._arr,r=t[e].priority;0!==e&&!(t[n=e>>1].priority<r);)this._swap(e,n),e=n},n.prototype._swap=function(e,n){var t=this._arr,r=this._keyIndices,o=t[e],i=t[n];t[e]=i,t[n]=o,r[i.key]=e,r[o.key]=n},tc}function Wl(){if(ic)return oc;ic=1;var e=Yl(),n=Ul();oc=function(e,r,o,i){return function(e,t,r,o){var i,a,u={},c=new n,l=function(e){var n=e.v!==i?e.v:e.w,t=u[n],o=r(e),l=a.distance+o;if(o<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+e+" Weight: "+o);l<t.distance&&(t.distance=l,t.predecessor=i,c.decrease(n,l))};for(e.nodes().forEach((function(e){var n=e===t?0:Number.POSITIVE_INFINITY;u[e]={distance:n},c.add(e,n)}));c.size()>0&&(i=c.removeMin(),(a=u[i]).distance!==Number.POSITIVE_INFINITY);)o(i).forEach(l);return u}(e,String(r),o||t,i||function(n){return e.outEdges(n)})};var t=e.constant(1);return oc}function Gl(){if(uc)return ac;uc=1;var e=Wl(),n=Yl();return ac=function(t,r,o){return n.transform(t.nodes(),(function(n,i){n[i]=e(t,i,r,o)}),{})}}function ql(){if(lc)return cc;lc=1;var e=Yl();return cc=function(n){var t=0,r=[],o={},i=[];function a(u){var c=o[u]={onStack:!0,lowlink:t,index:t++};if(r.push(u),n.successors(u).forEach((function(n){e.has(o,n)?o[n].onStack&&(c.lowlink=Math.min(c.lowlink,o[n].index)):(a(n),c.lowlink=Math.min(c.lowlink,o[n].lowlink))})),c.lowlink===c.index){var l,s=[];do{l=r.pop(),o[l].onStack=!1,s.push(l)}while(u!==l);i.push(s)}}return n.nodes().forEach((function(n){e.has(o,n)||a(n)})),i},cc}function $l(){if(dc)return sc;dc=1;var e=Yl(),n=ql();return sc=function(t){return e.filter(n(t),(function(e){return e.length>1||1===e.length&&t.hasEdge(e[0],e[0])}))}}function Kl(){if(hc)return fc;hc=1;var e=Yl();fc=function(e,t,r){return function(e,n,t){var r={},o=e.nodes();return o.forEach((function(e){r[e]={},r[e][e]={distance:0},o.forEach((function(n){e!==n&&(r[e][n]={distance:Number.POSITIVE_INFINITY})})),t(e).forEach((function(t){var o=t.v===e?t.w:t.v,i=n(t);r[e][o]={distance:i,predecessor:e}}))})),o.forEach((function(e){var n=r[e];o.forEach((function(t){var i=r[t];o.forEach((function(t){var r=i[e],o=n[t],a=i[t],u=r.distance+o.distance;u<a.distance&&(a.distance=u,a.predecessor=o.predecessor)}))}))})),r}(e,t||n,r||function(n){return e.outEdges(n)})};var n=e.constant(1);return fc}function Ql(){if(pc)return vc;pc=1;var e=Yl();function n(n){var r={},o={},i=[];if(e.each(n.sinks(),(function a(u){if(e.has(o,u))throw new t;e.has(r,u)||(o[u]=!0,r[u]=!0,e.each(n.predecessors(u),a),delete o[u],i.push(u))})),e.size(r)!==n.nodeCount())throw new t;return i}function t(){}return vc=n,n.CycleException=t,t.prototype=new Error,vc}function Jl(){if(yc)return gc;yc=1;var e=Ql();return gc=function(n){try{e(n)}catch(n){if(n instanceof e.CycleException)return!1;throw n}return!0}}function es(){if(wc)return mc;wc=1;var e=Yl();function n(t,r,o,i,a,u){e.has(i,r)||(i[r]=!0,o||u.push(r),e.each(a(r),(function(e){n(t,e,o,i,a,u)})),o&&u.push(r))}return mc=function(t,r,o){e.isArray(r)||(r=[r]);var i=(t.isDirected()?t.successors:t.neighbors).bind(t),a=[],u={};return e.each(r,(function(e){if(!t.hasNode(e))throw new Error("Graph does not have node: "+e);n(t,e,"post"===o,u,i,a)})),a},mc}function ns(){if(xc)return bc;xc=1;var e=es();return bc=function(n,t){return e(n,t,"post")}}function ts(){if(Ec)return _c;Ec=1;var e=es();return _c=function(n,t){return e(n,t,"pre")}}function rs(){if(kc)return Sc;kc=1;var e=Yl(),n=Xl(),t=Ul();return Sc=function(r,o){var i,a=new n,u={},c=new t;function l(e){var n=e.v===i?e.w:e.v,t=c.priority(n);if(void 0!==t){var r=o(e);r<t&&(u[n]=i,c.decrease(n,r))}}if(0===r.nodeCount())return a;e.each(r.nodes(),(function(e){c.add(e,Number.POSITIVE_INFINITY),a.setNode(e)})),c.decrease(r.nodes()[0],0);for(var s=!1;c.size()>0;){if(i=c.removeMin(),e.has(u,i))a.setEdge(i,u[i]);else{if(s)throw new Error("Input graph is not connected: "+r);s=!0}r.nodeEdges(i).forEach(l)}return a},Sc}Pc.exports;try{jc=function(){if(Oc)return Mc;Oc=1;var e=Ku?$u:(Ku=1,$u={Graph:Xl(),version:qu?Gu:(qu=1,Gu="2.1.8")});return Mc={Graph:e.Graph,json:Zl(),alg:Cc?Nc:(Cc=1,Nc={components:Fl(),dijkstra:Wl(),dijkstraAll:Gl(),findCycles:$l(),floydWarshall:Kl(),isAcyclic:Jl(),postorder:ns(),preorder:ts(),prim:rs(),tarjan:ql(),topsort:Ql()}),version:e.version}}()}catch(Z){}jc||(jc=window.graphlib);var os,is,as,us,cs,ls,ss,ds,fs,hs,vs,ps,gs,ys,ms,ws,bs,xs,_s,Es,Ss,ks,Ns,Cs,Ms,Os,js,Ps,Is,As,zs,Ts,Ls,Bs,Ds,Rs,Vs,Hs,Ys,Xs,Zs,Fs,Us,Ws,Gs,qs,$s,Ks,Qs,Js,ed,nd,td,rd,od,id,ad,ud,cd,ld,sd,dd,fd,hd,vd,pd,gd,yd,md,wd,bd,xd,_d,Ed,Sd,kd,Nd,Cd,Md,Od,jd,Pd,Id,Ad,zd,Td,Ld,Bd,Dd,Rd,Vd,Hd,Yd,Xd=jc;function Zd(){if(us)return as;us=1;var e=Kn(),n=yr(),t=zt(),r=ot();return as=function(o,i,a){if(!r(a))return!1;var u=typeof i;return!!("number"==u?n(a)&&t(i,a.length):"string"==u&&i in a)&&e(a[i],o)}}function Fd(){if(ws)return ms;ws=1;var e=function(){if(ys)return gs;ys=1;var e=function(){if(ps)return vs;ps=1;var e=function(){if(hs)return fs;hs=1;var e=/\s/;return fs=function(n){for(var t=n.length;t--&&e.test(n.charAt(t)););return t}}(),n=/^\s+/;return vs=function(t){return t?t.slice(0,e(t)+1).replace(n,""):t}}(),n=ot(),t=hl(),r=/^[-+]0x[0-9a-f]+$/i,o=/^0b[01]+$/i,i=/^0o[0-7]+$/i,a=parseInt;return gs=function(u){if("number"==typeof u)return u;if(t(u))return NaN;if(n(u)){var c="function"==typeof u.valueOf?u.valueOf():u;u=n(c)?c+"":c}if("string"!=typeof u)return 0===u?u:+u;u=e(u);var l=o.test(u);return l||i.test(u)?a(u.slice(2),l?2:8):r.test(u)?NaN:+u}}(),n=1/0;return ms=function(t){return t?(t=e(t))===n||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0}}function Ud(){if(Cs)return Ns;Cs=1;var e=Al();return Ns=function(n){return null!=n&&n.length?e(n,1):[]}}function Wd(){if(Ts)return zs;Ts=1;var e=hl();return zs=function(n,t,r){for(var o=-1,i=n.length;++o<i;){var a=n[o],u=t(a);if(null!=u&&(void 0===c?u==u&&!e(u):r(u,c)))var c=u,l=a}return l},zs}function Gd(){if(Hs)return Vs;Hs=1;var e=pt(),n=Kn();return Vs=function(t,r,o){(void 0!==o&&!n(t[r],o)||void 0===o&&!(r in t))&&e(t,r,o)}}function qd(){return Fs?Zs:(Fs=1,Zs=function(e,n){if(("constructor"!==n||"function"!=typeof e[n])&&"__proto__"!=n)return e[n]})}function $d(){return rd?td:(rd=1,td=function(e,n){return e<n})}function Kd(){if(Ad)return Id;Ad=1;var e=pl(),n=wl(),t=El(),r=Ml(),o=(Cd||(Cd=1,Nd=function(e,n){var t=e.length;for(e.sort(n);t--;)e[t]=e[t].value;return e}),Nd),i=Lt(),a=function(){if(Pd)return jd;Pd=1;var e=function(){if(Od)return Md;Od=1;var e=hl();return Md=function(n,t){if(n!==t){var r=void 0!==n,o=null===n,i=n==n,a=e(n),u=void 0!==t,c=null===t,l=t==t,s=e(t);if(!c&&!s&&!a&&n>t||a&&u&&l&&!c&&!s||o&&u&&l||!r&&l||!i)return 1;if(!o&&!a&&!s&&n<t||s&&r&&i&&!o&&!a||c&&r&&i||!u&&i||!l)return-1}return 0}}();return jd=function(n,t,r){for(var o=-1,i=n.criteria,a=t.criteria,u=i.length,c=r.length;++o<u;){var l=e(i[o],a[o]);if(l)return o>=c?l:l*("desc"==r[o]?-1:1)}return n.index-t.index}}(),u=nl(),c=bt();return Id=function(l,s,d){s=s.length?e(s,(function(e){return c(e)?function(t){return n(t,1===e.length?e[0]:e)}:e})):[u];var f=-1;s=e(s,i(t));var h=r(l,(function(n,t,r){return{criteria:e(s,(function(e){return e(n)})),index:++f,value:n}}));return o(h,(function(e,n){return a(e,n,d)}))}}try{Yd={cloneDeep:function(){if(is)return os;is=1;var e=qc();return os=function(n){return e(n,5)}}(),constant:Kc(),defaults:function(){if(ls)return cs;ls=1;var e=Ll(),n=Kn(),t=Zd(),r=wr(),o=Object.prototype,i=o.hasOwnProperty,a=e((function(e,a){e=Object(e);var u=-1,c=a.length,l=c>2?a[2]:void 0;for(l&&t(a[0],a[1],l)&&(c=1);++u<c;)for(var s=a[u],d=r(s),f=-1,h=d.length;++f<h;){var v=d[f],p=e[v];(void 0===p||n(p,o[v])&&!i.call(e,v))&&(e[v]=s[v])}return e}));return cs=a}(),each:ol(),filter:Sl(),find:function(){if(ks)return Ss;ks=1;var e=function(){if(ds)return ss;ds=1;var e=El(),n=yr(),t=mr();return ss=function(r){return function(o,i,a){var u=Object(o);if(!n(o)){var c=e(i,3);o=t(o),i=function(e){return c(u[e],e,u)}}var l=r(o,i,a);return l>-1?u[c?o[l]:l]:void 0}}}(),n=e(function(){if(Es)return _s;Es=1;var e=Bl(),n=El(),t=function(){if(xs)return bs;xs=1;var e=Fd();return bs=function(n){var t=e(n),r=t%1;return t==t?r?t-r:t:0}}(),r=Math.max;return _s=function(o,i,a){var u=null==o?0:o.length;if(!u)return-1;var c=null==a?0:t(a);return c<0&&(c=r(u+c,0)),e(o,n(i,3),c)},_s}());return Ss=n}(),flatten:Ud(),forEach:rl(),forIn:function(){if(Os)return Ms;Os=1;var e=Qc(),n=tl(),t=wr();return Ms=function(r,o){return null==r?r:e(r,n(o),t)}}(),has:kl(),isUndefined:Cl(),last:(Ps||(Ps=1,js=function(e){var n=null==e?0:e.length;return n?e[n-1]:void 0}),js),map:Ol(),mapValues:function(){if(As)return Is;As=1;var e=pt(),n=Jc(),t=El();return Is=function(r,o){var i={};return o=t(o,3),n(r,(function(n,t,r){e(i,t,o(n,t,r))})),i}}(),max:function(){if(Rs)return Ds;Rs=1;var e=Wd(),n=Bs?Ls:(Bs=1,Ls=function(e,n){return e>n}),t=nl();return Ds=function(r){return r&&r.length?e(r,t,n):void 0},Ds}(),merge:function(){if(nd)return ed;nd=1;var e=function(){if(Ks)return $s;Ks=1;var e=ft(),n=Gd(),t=Qc(),r=function(){if(qs)return Gs;qs=1;var e=Gd(),n=Ic(),t=Uc(),r=Ac(),o=Gc(),i=wt(),a=bt(),u=Rl(),c=At(),l=it(),s=ot(),d=function(){if(Xs)return Ys;Xs=1;var e=rt(),n=Dc(),t=mt(),r=Function.prototype,o=Object.prototype,i=r.toString,a=o.hasOwnProperty,u=i.call(Object);return Ys=function(r){if(!t(r)||"[object Object]"!=e(r))return!1;var o=n(r);if(null===o)return!0;var c=a.call(o,"constructor")&&o.constructor;return"function"==typeof c&&c instanceof c&&i.call(c)==u}}(),f=fr(),h=qd(),v=function(){if(Ws)return Us;Ws=1;var e=yt(),n=wr();return Us=function(t){return e(t,n(t))}}();return Gs=function(p,g,y,m,w,b,x){var _=h(p,y),E=h(g,y),S=x.get(E);if(S)e(p,y,S);else{var k=b?b(_,E,y+"",p,g,x):void 0,N=void 0===k;if(N){var C=a(E),M=!C&&c(E),O=!C&&!M&&f(E);k=E,C||M||O?a(_)?k=_:u(_)?k=r(_):M?(N=!1,k=n(E,!0)):O?(N=!1,k=t(E,!0)):k=[]:d(E)||i(E)?(k=_,i(_)?k=v(_):s(_)&&!l(_)||(k=o(E))):N=!1}N&&(x.set(E,k),w(k,E,m,b,x),x.delete(E)),e(p,y,k)}}}(),o=ot(),i=wr(),a=qd();return $s=function u(c,l,s,d,f){c!==l&&t(l,(function(t,i){if(f||(f=new e),o(t))r(c,l,i,s,u,d,f);else{var h=d?d(a(c,i),t,i+"",c,l,f):void 0;void 0===h&&(h=t),n(c,i,h)}}),i)},$s}(),n=function(){if(Js)return Qs;Js=1;var e=Ll(),n=Zd();return Qs=function(t){return e((function(e,r){var o=-1,i=r.length,a=i>1?r[i-1]:void 0,u=i>2?r[2]:void 0;for(a=t.length>3&&"function"==typeof a?(i--,a):void 0,u&&n(r[0],r[1],u)&&(a=i<3?void 0:a,i=1),e=Object(e);++o<i;){var c=r[o];c&&t(e,c,o,a)}return e}))}}()((function(n,t,r){e(n,t,r)}));return ed=n}(),min:function(){if(id)return od;id=1;var e=Wd(),n=$d(),t=nl();return od=function(r){return r&&r.length?e(r,t,n):void 0},od}(),minBy:function(){if(ud)return ad;ud=1;var e=Wd(),n=El(),t=$d();return ad=function(r,o){return r&&r.length?e(r,n(o,2),t):void 0},ad}(),now:function(){if(ld)return cd;ld=1;var e=nt();return cd=function(){return e.Date.now()}}(),pick:function(){if(wd)return md;wd=1;var e=function(){if(pd)return vd;pd=1;var e=function(){if(hd)return fd;hd=1;var e=wl(),n=function(){if(dd)return sd;dd=1;var e=gt(),n=yl(),t=zt(),r=ot(),o=ml();return sd=function(i,a,u,c){if(!r(i))return i;for(var l=-1,s=(a=n(a,i)).length,d=s-1,f=i;null!=f&&++l<s;){var h=o(a[l]),v=u;if("__proto__"===h||"constructor"===h||"prototype"===h)return i;if(l!=d){var p=f[h];void 0===(v=c?c(p,h,f):void 0)&&(v=r(p)?p:t(a[l+1])?[]:{})}e(f,h,v),f=f[h]}return i}}(),t=yl();return fd=function(r,o,i){for(var a=-1,u=o.length,c={};++a<u;){var l=o[a],s=e(r,l);i(s,l)&&n(c,t(l,r),s)}return c}}(),n=xl();return vd=function(t,r){return e(t,r,(function(e,r){return n(t,r)}))}}(),n=function(){if(yd)return gd;yd=1;var e=Ud(),n=zl(),t=Tl();return gd=function(r){return t(n(r,void 0,e),r+"")}}(),t=n((function(n,t){return null==n?{}:e(n,t)}));return md=t}(),range:function(){if(kd)return Sd;kd=1;var e=function(){if(Ed)return _d;Ed=1;var e=function(){if(xd)return bd;xd=1;var e=Math.ceil,n=Math.max;return bd=function(t,r,o,i){for(var a=-1,u=n(e((r-t)/(o||1)),0),c=Array(u);u--;)c[i?u:++a]=t,t+=o;return c},bd}(),n=Zd(),t=Fd();return _d=function(r){return function(o,i,a){return a&&"number"!=typeof a&&n(o,i,a)&&(i=a=void 0),o=t(o),void 0===i?(i=o,o=0):i=t(i),a=void 0===a?o<i?1:-1:t(a),e(o,i,a,r)}},_d}()();return Sd=e}(),reduce:jl(),sortBy:function(){if(Td)return zd;Td=1;var e=Al(),n=Kd(),t=Ll(),r=Zd(),o=t((function(t,o){if(null==t)return[];var i=o.length;return i>1&&r(t,o[0],o[1])?o=[]:i>2&&r(o[0],o[1],o[2])&&(o=[o[0]]),n(t,e(o,1),[])}));return zd=o}(),uniqueId:function(){if(Bd)return Ld;Bd=1;var e=gl(),n=0;return Ld=function(t){var r=++n;return e(t)+r},Ld}(),values:Hl(),zipObject:function(){if(Hd)return Vd;Hd=1;var e=gt(),n=(Rd||(Rd=1,Dd=function(e,n,t){for(var r=-1,o=e.length,i=n.length,a={};++r<o;){var u=r<i?n[r]:void 0;t(a,e[r],u)}return a}),Dd);return Vd=function(t,r){return n(t||[],r||[],e)},Vd}()}}catch(Z){}Yd||(Yd=window._);var Qd=Yd,Jd=ef;function ef(){var e={};e._next=e._prev=e,this._sentinel=e}function nf(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function tf(e,n){if("_next"!==e&&"_prev"!==e)return n}ef.prototype.dequeue=function(){var e=this._sentinel,n=e._prev;if(n!==e)return nf(n),n},ef.prototype.enqueue=function(e){var n=this._sentinel;e._prev&&e._next&&nf(e),e._next=n._next,n._next._prev=e,n._next=e,e._prev=n},ef.prototype.toString=function(){for(var e=[],n=this._sentinel,t=n._prev;t!==n;)e.push(JSON.stringify(t,tf)),t=t._prev;return"["+e.join(", ")+"]"};var rf=Qd,of=Xd.Graph,af=Jd,uf=rf.constant(1);function cf(e,n,t,r,o){var i=o?[]:void 0;return rf.forEach(e.inEdges(r.v),(function(r){var a=e.edge(r),u=e.node(r.v);o&&i.push({v:r.v,w:r.w}),u.out-=a,lf(n,t,u)})),rf.forEach(e.outEdges(r.v),(function(r){var o=e.edge(r),i=r.w,a=e.node(i);a.in-=o,lf(n,t,a)})),e.removeNode(r.v),i}function lf(e,n,t){t.out?t.in?e[t.out-t.in+n].enqueue(t):e[e.length-1].enqueue(t):e[0].enqueue(t)}var sf=Qd,df=function(e,n){if(e.nodeCount()<=1)return[];var t=function(e,n){var t=new of,r=0,o=0;rf.forEach(e.nodes(),(function(e){t.setNode(e,{v:e,in:0,out:0})})),rf.forEach(e.edges(),(function(e){var i=t.edge(e.v,e.w)||0,a=n(e),u=i+a;t.setEdge(e.v,e.w,u),o=Math.max(o,t.node(e.v).out+=a),r=Math.max(r,t.node(e.w).in+=a)}));var i=rf.range(o+r+3).map((function(){return new af})),a=r+1;return rf.forEach(t.nodes(),(function(e){lf(i,a,t.node(e))})),{graph:t,buckets:i,zeroIdx:a}}(e,n||uf),r=function(e,n,t){for(var r,o=[],i=n[n.length-1],a=n[0];e.nodeCount();){for(;r=a.dequeue();)cf(e,n,t,r);for(;r=i.dequeue();)cf(e,n,t,r);if(e.nodeCount())for(var u=n.length-2;u>0;--u)if(r=n[u].dequeue()){o=o.concat(cf(e,n,t,r,!0));break}}return o}(t.graph,t.buckets,t.zeroIdx);return rf.flatten(rf.map(r,(function(n){return e.outEdges(n.v,n.w)})),!0)},ff={run:function(e){var n="greedy"===e.graph().acyclicer?df(e,function(e){return function(n){return e.edge(n).weight}}(e)):function(e){var n=[],t={},r={};return sf.forEach(e.nodes(),(function o(i){sf.has(r,i)||(r[i]=!0,t[i]=!0,sf.forEach(e.outEdges(i),(function(e){sf.has(t,e.w)?n.push(e):o(e.w)})),delete t[i])})),n}(e);sf.forEach(n,(function(n){var t=e.edge(n);e.removeEdge(n),t.forwardName=n.name,t.reversed=!0,e.setEdge(n.w,n.v,t,sf.uniqueId("rev"))}))},undo:function(e){sf.forEach(e.edges(),(function(n){var t=e.edge(n);if(t.reversed){e.removeEdge(n);var r=t.forwardName;delete t.reversed,delete t.forwardName,e.setEdge(n.w,n.v,t,r)}}))}},hf=Qd,vf=Xd.Graph,pf={addDummyNode:gf,simplify:function(e){var n=(new vf).setGraph(e.graph());return hf.forEach(e.nodes(),(function(t){n.setNode(t,e.node(t))})),hf.forEach(e.edges(),(function(t){var r=n.edge(t.v,t.w)||{weight:0,minlen:1},o=e.edge(t);n.setEdge(t.v,t.w,{weight:r.weight+o.weight,minlen:Math.max(r.minlen,o.minlen)})})),n},asNonCompoundGraph:function(e){var n=new vf({multigraph:e.isMultigraph()}).setGraph(e.graph());return hf.forEach(e.nodes(),(function(t){e.children(t).length||n.setNode(t,e.node(t))})),hf.forEach(e.edges(),(function(t){n.setEdge(t,e.edge(t))})),n},successorWeights:function(e){var n=hf.map(e.nodes(),(function(n){var t={};return hf.forEach(e.outEdges(n),(function(n){t[n.w]=(t[n.w]||0)+e.edge(n).weight})),t}));return hf.zipObject(e.nodes(),n)},predecessorWeights:function(e){var n=hf.map(e.nodes(),(function(n){var t={};return hf.forEach(e.inEdges(n),(function(n){t[n.v]=(t[n.v]||0)+e.edge(n).weight})),t}));return hf.zipObject(e.nodes(),n)},intersectRect:function(e,n){var t,r,o=e.x,i=e.y,a=n.x-o,u=n.y-i,c=e.width/2,l=e.height/2;if(!a&&!u)throw new Error("Not possible to find intersection inside of the rectangle");return Math.abs(u)*c>Math.abs(a)*l?(u<0&&(l=-l),t=l*a/u,r=l):(a<0&&(c=-c),t=c,r=c*u/a),{x:o+t,y:i+r}},buildLayerMatrix:function(e){var n=hf.map(hf.range(yf(e)+1),(function(){return[]}));return hf.forEach(e.nodes(),(function(t){var r=e.node(t),o=r.rank;hf.isUndefined(o)||(n[o][r.order]=t)})),n},normalizeRanks:function(e){var n=hf.min(hf.map(e.nodes(),(function(n){return e.node(n).rank})));hf.forEach(e.nodes(),(function(t){var r=e.node(t);hf.has(r,"rank")&&(r.rank-=n)}))},removeEmptyRanks:function(e){var n=hf.min(hf.map(e.nodes(),(function(n){return e.node(n).rank}))),t=[];hf.forEach(e.nodes(),(function(r){var o=e.node(r).rank-n;t[o]||(t[o]=[]),t[o].push(r)}));var r=0,o=e.graph().nodeRankFactor;hf.forEach(t,(function(n,t){hf.isUndefined(n)&&t%o!=0?--r:r&&hf.forEach(n,(function(n){e.node(n).rank+=r}))}))},addBorderNode:function(e,n,t,r){var o={width:0,height:0};return arguments.length>=4&&(o.rank=t,o.order=r),gf(e,"border",o,n)},maxRank:yf,partition:function(e,n){var t={lhs:[],rhs:[]};return hf.forEach(e,(function(e){n(e)?t.lhs.push(e):t.rhs.push(e)})),t},time:function(e,n){var t=hf.now();try{return n()}finally{console.log(e+" time: "+(hf.now()-t)+"ms")}},notime:function(e,n){return n()}};function gf(e,n,t,r){var o;do{o=hf.uniqueId(r)}while(e.hasNode(o));return t.dummy=n,e.setNode(o,t),o}function yf(e){return hf.max(hf.map(e.nodes(),(function(n){var t=e.node(n).rank;if(!hf.isUndefined(t))return t})))}var mf=Qd,wf=pf,bf={run:function(e){e.graph().dummyChains=[],mf.forEach(e.edges(),(function(n){!function(e,n){var t,r,o,i=n.v,a=e.node(i).rank,u=n.w,c=e.node(u).rank,l=n.name,s=e.edge(n),d=s.labelRank;if(c!==a+1){for(e.removeEdge(n),o=0,++a;a<c;++o,++a)s.points=[],r={width:0,height:0,edgeLabel:s,edgeObj:n,rank:a},t=wf.addDummyNode(e,"edge",r,"_d"),a===d&&(r.width=s.width,r.height=s.height,r.dummy="edge-label",r.labelpos=s.labelpos),e.setEdge(i,t,{weight:s.weight},l),0===o&&e.graph().dummyChains.push(t),i=t;e.setEdge(i,u,{weight:s.weight},l)}}(e,n)}))},undo:function(e){mf.forEach(e.graph().dummyChains,(function(n){var t,r=e.node(n),o=r.edgeLabel;for(e.setEdge(r.edgeObj,o);r.dummy;)t=e.successors(n)[0],e.removeNode(n),o.points.push({x:r.x,y:r.y}),"edge-label"===r.dummy&&(o.x=r.x,o.y=r.y,o.width=r.width,o.height=r.height),n=t,r=e.node(n)}))}},xf=Qd,_f=function(e){var n={};xf.forEach(e.sources(),(function t(r){var o=e.node(r);if(xf.has(n,r))return o.rank;n[r]=!0;var i=xf.min(xf.map(e.outEdges(r),(function(n){return t(n.w)-e.edge(n).minlen})));return i!==Number.POSITIVE_INFINITY&&null!=i||(i=0),o.rank=i}))},Ef=function(e,n){return e.node(n.w).rank-e.node(n.v).rank-e.edge(n).minlen},Sf=Qd,kf=Xd.Graph,Nf=Ef,Cf=function(e){var n,t,r=new kf({directed:!1}),o=e.nodes()[0],i=e.nodeCount();for(r.setNode(o,{});Mf(r,e)<i;)n=Of(r,e),t=r.hasNode(n.v)?Nf(e,n):-Nf(e,n),jf(r,e,t);return r};function Mf(e,n){return Sf.forEach(e.nodes(),(function t(r){Sf.forEach(n.nodeEdges(r),(function(o){var i=o.v,a=r===i?o.w:i;e.hasNode(a)||Nf(n,o)||(e.setNode(a,{}),e.setEdge(r,a,{}),t(a))}))})),e.nodeCount()}function Of(e,n){return Sf.minBy(n.edges(),(function(t){if(e.hasNode(t.v)!==e.hasNode(t.w))return Nf(n,t)}))}function jf(e,n,t){Sf.forEach(e.nodes(),(function(e){n.node(e).rank+=t}))}var Pf=Qd,If=Cf,Af=Ef,zf=_f,Tf=Xd.alg.preorder,Lf=Xd.alg.postorder,Bf=pf.simplify,Df=Rf;function Rf(e){e=Bf(e),zf(e);var n,t=If(e);for(Yf(t),Vf(t,e);n=Zf(t);)Uf(t,e,n,Ff(t,e,n))}function Vf(e,n){var t=Lf(e,e.nodes());t=t.slice(0,t.length-1),Pf.forEach(t,(function(t){!function(e,n,t){var r=e.node(t).parent;e.edge(t,r).cutvalue=Hf(e,n,t)}(e,n,t)}))}function Hf(e,n,t){var r=e.node(t).parent,o=!0,i=n.edge(t,r),a=0;return i||(o=!1,i=n.edge(r,t)),a=i.weight,Pf.forEach(n.nodeEdges(t),(function(i){var u,c,l=i.v===t,s=l?i.w:i.v;if(s!==r){var d=l===o,f=n.edge(i).weight;if(a+=d?f:-f,u=t,c=s,e.hasEdge(u,c)){var h=e.edge(t,s).cutvalue;a+=d?-h:h}}})),a}function Yf(e,n){arguments.length<2&&(n=e.nodes()[0]),Xf(e,{},1,n)}function Xf(e,n,t,r,o){var i=t,a=e.node(r);return n[r]=!0,Pf.forEach(e.neighbors(r),(function(o){Pf.has(n,o)||(t=Xf(e,n,t,o,r))})),a.low=i,a.lim=t++,o?a.parent=o:delete a.parent,t}function Zf(e){return Pf.find(e.edges(),(function(n){return e.edge(n).cutvalue<0}))}function Ff(e,n,t){var r=t.v,o=t.w;n.hasEdge(r,o)||(r=t.w,o=t.v);var i=e.node(r),a=e.node(o),u=i,c=!1;i.lim>a.lim&&(u=a,c=!0);var l=Pf.filter(n.edges(),(function(n){return c===Wf(e,e.node(n.v),u)&&c!==Wf(e,e.node(n.w),u)}));return Pf.minBy(l,(function(e){return Af(n,e)}))}function Uf(e,n,t,r){var o=t.v,i=t.w;e.removeEdge(o,i),e.setEdge(r.v,r.w,{}),Yf(e),Vf(e,n),function(e,n){var t=Pf.find(e.nodes(),(function(e){return!n.node(e).parent})),r=Tf(e,t);r=r.slice(1),Pf.forEach(r,(function(t){var r=e.node(t).parent,o=n.edge(t,r),i=!1;o||(o=n.edge(r,t),i=!0),n.node(t).rank=n.node(r).rank+(i?o.minlen:-o.minlen)}))}(e,n)}function Wf(e,n,t){return t.low<=n.lim&&n.lim<=t.lim}Rf.initLowLimValues=Yf,Rf.initCutValues=Vf,Rf.calcCutValue=Hf,Rf.leaveEdge=Zf,Rf.enterEdge=Ff,Rf.exchangeEdges=Uf;var Gf=_f,qf=Cf,$f=Df,Kf=Gf;var Qf=Qd,Jf=Qd,eh=pf,nh={run:function(e){var n=eh.addDummyNode(e,"root",{},"_root"),t=function(e){var n={};function t(r,o){var i=e.children(r);i&&i.length&&Jf.forEach(i,(function(e){t(e,o+1)})),n[r]=o}return Jf.forEach(e.children(),(function(e){t(e,1)})),n}(e),r=Jf.max(Jf.values(t))-1,o=2*r+1;e.graph().nestingRoot=n,Jf.forEach(e.edges(),(function(n){e.edge(n).minlen*=o}));var i=function(e){return Jf.reduce(e.edges(),(function(n,t){return n+e.edge(t).weight}),0)}(e)+1;Jf.forEach(e.children(),(function(a){th(e,n,o,i,r,t,a)})),e.graph().nodeRankFactor=o},cleanup:function(e){var n=e.graph();e.removeNode(n.nestingRoot),delete n.nestingRoot,Jf.forEach(e.edges(),(function(n){e.edge(n).nestingEdge&&e.removeEdge(n)}))}};function th(e,n,t,r,o,i,a){var u=e.children(a);if(u.length){var c=eh.addBorderNode(e,"_bt"),l=eh.addBorderNode(e,"_bb"),s=e.node(a);e.setParent(c,a),s.borderTop=c,e.setParent(l,a),s.borderBottom=l,Jf.forEach(u,(function(u){th(e,n,t,r,o,i,u);var s=e.node(u),d=s.borderTop?s.borderTop:u,f=s.borderBottom?s.borderBottom:u,h=s.borderTop?r:2*r,v=d!==f?1:o-i[a]+1;e.setEdge(c,d,{weight:h,minlen:v,nestingEdge:!0}),e.setEdge(f,l,{weight:h,minlen:v,nestingEdge:!0})})),e.parent(a)||e.setEdge(n,c,{weight:0,minlen:o+i[a]})}else a!==n&&e.setEdge(n,a,{weight:0,minlen:t})}var rh=Qd,oh=pf;function ih(e,n,t,r,o,i){var a={width:0,height:0,rank:i,borderType:n},u=o[n][i-1],c=oh.addDummyNode(e,"border",a,t);o[n][i]=c,e.setParent(c,r),u&&e.setEdge(u,c,{weight:1})}var ah=Qd,uh={adjust:function(e){var n=e.graph().rankdir.toLowerCase();"lr"!==n&&"rl"!==n||ch(e)},undo:function(e){var n=e.graph().rankdir.toLowerCase();"bt"!==n&&"rl"!==n||function(e){ah.forEach(e.nodes(),(function(n){sh(e.node(n))})),ah.forEach(e.edges(),(function(n){var t=e.edge(n);ah.forEach(t.points,sh),ah.has(t,"y")&&sh(t)}))}(e),"lr"!==n&&"rl"!==n||(function(e){ah.forEach(e.nodes(),(function(n){dh(e.node(n))})),ah.forEach(e.edges(),(function(n){var t=e.edge(n);ah.forEach(t.points,dh),ah.has(t,"x")&&dh(t)}))}(e),ch(e))}};function ch(e){ah.forEach(e.nodes(),(function(n){lh(e.node(n))})),ah.forEach(e.edges(),(function(n){lh(e.edge(n))}))}function lh(e){var n=e.width;e.width=e.height,e.height=n}function sh(e){e.y=-e.y}function dh(e){var n=e.x;e.x=e.y,e.y=n}var fh=Qd,hh=Qd;function vh(e,n,t){for(var r=hh.zipObject(t,hh.map(t,(function(e,n){return n}))),o=hh.flatten(hh.map(n,(function(n){return hh.sortBy(hh.map(e.outEdges(n),(function(n){return{pos:r[n.w],weight:e.edge(n).weight}})),"pos")})),!0),i=1;i<t.length;)i<<=1;var a=2*i-1;i-=1;var u=hh.map(new Array(a),(function(){return 0})),c=0;return hh.forEach(o.forEach((function(e){var n=e.pos+i;u[n]+=e.weight;for(var t=0;n>0;)n%2&&(t+=u[n+1]),u[n=n-1>>1]+=e.weight;c+=e.weight*t}))),c}var ph=Qd,gh=Qd,yh=Qd,mh=pf;function wh(e,n,t){for(var r;n.length&&(r=yh.last(n)).i<=t;)n.pop(),e.push(r.vs),t++;return t}var bh=Qd,xh=Qd,_h=Xd.Graph,Eh=Qd,Sh=Qd,kh=function(e){var n={},t=fh.filter(e.nodes(),(function(n){return!e.children(n).length})),r=fh.max(fh.map(t,(function(n){return e.node(n).rank}))),o=fh.map(fh.range(r+1),(function(){return[]}));var i=fh.sortBy(t,(function(n){return e.node(n).rank}));return fh.forEach(i,(function t(r){if(!fh.has(n,r)){n[r]=!0;var i=e.node(r);o[i.rank].push(r),fh.forEach(e.successors(r),t)}})),o},Nh=function(e,n){for(var t=0,r=1;r<n.length;++r)t+=vh(e,n[r-1],n[r]);return t},Ch=function e(n,t,r,o){var i=n.children(t),a=n.node(t),u=a?a.borderLeft:void 0,c=a?a.borderRight:void 0,l={};u&&(i=bh.filter(i,(function(e){return e!==u&&e!==c})));var s=function(e,n){return ph.map(n,(function(n){var t=e.inEdges(n);if(t.length){var r=ph.reduce(t,(function(n,t){var r=e.edge(t),o=e.node(t.v);return{sum:n.sum+r.weight*o.order,weight:n.weight+r.weight}}),{sum:0,weight:0});return{v:n,barycenter:r.sum/r.weight,weight:r.weight}}return{v:n}}))}(n,i);bh.forEach(s,(function(t){if(n.children(t.v).length){var i=e(n,t.v,r,o);l[t.v]=i,bh.has(i,"barycenter")&&(a=t,u=i,bh.isUndefined(a.barycenter)?(a.barycenter=u.barycenter,a.weight=u.weight):(a.barycenter=(a.barycenter*a.weight+u.barycenter*u.weight)/(a.weight+u.weight),a.weight+=u.weight))}var a,u}));var d=function(e,n){var t={};return gh.forEach(e,(function(e,n){var r=t[e.v]={indegree:0,in:[],out:[],vs:[e.v],i:n};gh.isUndefined(e.barycenter)||(r.barycenter=e.barycenter,r.weight=e.weight)})),gh.forEach(n.edges(),(function(e){var n=t[e.v],r=t[e.w];gh.isUndefined(n)||gh.isUndefined(r)||(r.indegree++,n.out.push(t[e.w]))})),function(e){var n=[];function t(e){return function(n){n.merged||(gh.isUndefined(n.barycenter)||gh.isUndefined(e.barycenter)||n.barycenter>=e.barycenter)&&function(e,n){var t=0,r=0;e.weight&&(t+=e.barycenter*e.weight,r+=e.weight),n.weight&&(t+=n.barycenter*n.weight,r+=n.weight),e.vs=n.vs.concat(e.vs),e.barycenter=t/r,e.weight=r,e.i=Math.min(n.i,e.i),n.merged=!0}(e,n)}}function r(n){return function(t){t.in.push(n),0==--t.indegree&&e.push(t)}}for(;e.length;){var o=e.pop();n.push(o),gh.forEach(o.in.reverse(),t(o)),gh.forEach(o.out,r(o))}return gh.map(gh.filter(n,(function(e){return!e.merged})),(function(e){return gh.pick(e,["vs","i","barycenter","weight"])}))}(gh.filter(t,(function(e){return!e.indegree})))}(s,r);!function(e,n){bh.forEach(e,(function(e){e.vs=bh.flatten(e.vs.map((function(e){return n[e]?n[e].vs:e})),!0)}))}(d,l);var f=function(e,n){var t,r=mh.partition(e,(function(e){return yh.has(e,"barycenter")})),o=r.lhs,i=yh.sortBy(r.rhs,(function(e){return-e.i})),a=[],u=0,c=0,l=0;o.sort((t=!!n,function(e,n){return e.barycenter<n.barycenter?-1:e.barycenter>n.barycenter?1:t?n.i-e.i:e.i-n.i})),l=wh(a,i,l),yh.forEach(o,(function(e){l+=e.vs.length,a.push(e.vs),u+=e.barycenter*e.weight,c+=e.weight,l=wh(a,i,l)}));var s={vs:yh.flatten(a,!0)};return c&&(s.barycenter=u/c,s.weight=c),s}(d,o);if(u&&(f.vs=bh.flatten([u,f.vs,c],!0),n.predecessors(u).length)){var h=n.node(n.predecessors(u)[0]),v=n.node(n.predecessors(c)[0]);bh.has(f,"barycenter")||(f.barycenter=0,f.weight=0),f.barycenter=(f.barycenter*f.weight+h.order+v.order)/(f.weight+2),f.weight+=2}return f},Mh=function(e,n,t){var r=function(e){for(var n;e.hasNode(n=xh.uniqueId("_root")););return n}(e),o=new _h({compound:!0}).setGraph({root:r}).setDefaultNodeLabel((function(n){return e.node(n)}));return xh.forEach(e.nodes(),(function(i){var a=e.node(i),u=e.parent(i);(a.rank===n||a.minRank<=n&&n<=a.maxRank)&&(o.setNode(i),o.setParent(i,u||r),xh.forEach(e[t](i),(function(n){var t=n.v===i?n.w:n.v,r=o.edge(t,i),a=xh.isUndefined(r)?0:r.weight;o.setEdge(t,i,{weight:e.edge(n).weight+a})})),xh.has(a,"minRank")&&o.setNode(i,{borderLeft:a.borderLeft[n],borderRight:a.borderRight[n]}))})),o},Oh=Xd.Graph,jh=pf;function Ph(e,n,t){return Sh.map(n,(function(n){return Mh(e,n,t)}))}function Ih(e,n){var t=new Oh;Sh.forEach(e,(function(e){var r=e.graph().root,o=Ch(e,r,t,n);Sh.forEach(o.vs,(function(n,t){e.node(n).order=t})),function(e,n,t){var r,o={};Eh.forEach(t,(function(t){for(var i,a,u=e.parent(t);u;){if((i=e.parent(u))?(a=o[i],o[i]=u):(a=r,r=u),a&&a!==u)return void n.setEdge(a,u);u=i}}))}(e,t,o.vs)}))}function Ah(e,n){Sh.forEach(n,(function(n){Sh.forEach(n,(function(n,t){e.node(n).order=t}))}))}var zh=Qd,Th=Xd.Graph,Lh=pf;function Bh(e,n,t){if(n>t){var r=n;n=t,t=r}var o=e[n];o||(e[n]=o={}),o[t]=!0}function Dh(e,n,t){if(n>t){var r=n;n=t,t=r}return zh.has(e[n],t)}var Rh=Qd,Vh=pf,Hh=function(e){var n,t=Lh.buildLayerMatrix(e),r=zh.merge(function(e,n){var t={};return zh.reduce(n,(function(n,r){var o=0,i=0,a=n.length,u=zh.last(r);return zh.forEach(r,(function(n,c){var l=function(e,n){if(e.node(n).dummy)return zh.find(e.predecessors(n),(function(n){return e.node(n).dummy}))}(e,n),s=l?e.node(l).order:a;(l||n===u)&&(zh.forEach(r.slice(i,c+1),(function(n){zh.forEach(e.predecessors(n),(function(r){var i=e.node(r),a=i.order;!(a<o||s<a)||i.dummy&&e.node(n).dummy||Bh(t,r,n)}))})),i=c+1,o=s)})),r})),t}(e,t),function(e,n){var t={};function r(n,r,o,i,a){var u;zh.forEach(zh.range(r,o),(function(r){u=n[r],e.node(u).dummy&&zh.forEach(e.predecessors(u),(function(n){var r=e.node(n);r.dummy&&(r.order<i||r.order>a)&&Bh(t,n,u)}))}))}return zh.reduce(n,(function(n,t){var o,i=-1,a=0;return zh.forEach(t,(function(u,c){if("border"===e.node(u).dummy){var l=e.predecessors(u);l.length&&(o=e.node(l[0]).order,r(t,a,c,i,o),a=c,i=o)}r(t,a,t.length,o,n.length)})),t})),t}(e,t)),o={};zh.forEach(["u","d"],(function(i){n="u"===i?t:zh.values(t).reverse(),zh.forEach(["l","r"],(function(t){"r"===t&&(n=zh.map(n,(function(e){return zh.values(e).reverse()})));var a=("u"===i?e.predecessors:e.successors).bind(e),u=function(e,n,t,r){var o={},i={},a={};return zh.forEach(n,(function(e){zh.forEach(e,(function(e,n){o[e]=e,i[e]=e,a[e]=n}))})),zh.forEach(n,(function(e){var n=-1;zh.forEach(e,(function(e){var u=r(e);if(u.length){u=zh.sortBy(u,(function(e){return a[e]}));for(var c=(u.length-1)/2,l=Math.floor(c),s=Math.ceil(c);l<=s;++l){var d=u[l];i[e]===e&&n<a[d]&&!Dh(t,e,d)&&(i[d]=e,i[e]=o[e]=o[d],n=a[d])}}}))})),{root:o,align:i}}(0,n,r,a),c=function(e,n,t,r,o){var i={},a=function(e,n,t,r){var o=new Th,i=e.graph(),a=function(e,n,t){return function(r,o,i){var a,u=r.node(o),c=r.node(i),l=0;if(l+=u.width/2,zh.has(u,"labelpos"))switch(u.labelpos.toLowerCase()){case"l":a=-u.width/2;break;case"r":a=u.width/2}if(a&&(l+=t?a:-a),a=0,l+=(u.dummy?n:e)/2,l+=(c.dummy?n:e)/2,l+=c.width/2,zh.has(c,"labelpos"))switch(c.labelpos.toLowerCase()){case"l":a=c.width/2;break;case"r":a=-c.width/2}return a&&(l+=t?a:-a),a=0,l}}(i.nodesep,i.edgesep,r);return zh.forEach(n,(function(n){var r;zh.forEach(n,(function(n){var i=t[n];if(o.setNode(i),r){var u=t[r],c=o.edge(u,i);o.setEdge(u,i,Math.max(a(e,n,r),c||0))}r=n}))})),o}(e,n,t,o),u=o?"borderLeft":"borderRight";function c(e,n){for(var t=a.nodes(),r=t.pop(),o={};r;)o[r]?e(r):(o[r]=!0,t.push(r),t=t.concat(n(r))),r=t.pop()}return c((function(e){i[e]=a.inEdges(e).reduce((function(e,n){return Math.max(e,i[n.v]+a.edge(n))}),0)}),a.predecessors.bind(a)),c((function(n){var t=a.outEdges(n).reduce((function(e,n){return Math.min(e,i[n.w]-a.edge(n))}),Number.POSITIVE_INFINITY),r=e.node(n);t!==Number.POSITIVE_INFINITY&&r.borderType!==u&&(i[n]=Math.max(i[n],t))}),a.successors.bind(a)),zh.forEach(r,(function(e){i[e]=i[t[e]]})),i}(e,n,u.root,u.align,"r"===t);"r"===t&&(c=zh.mapValues(c,(function(e){return-e}))),o[i+t]=c}))}));var i=function(e,n){return zh.minBy(zh.values(n),(function(n){var t=Number.NEGATIVE_INFINITY,r=Number.POSITIVE_INFINITY;return zh.forIn(n,(function(n,o){var i=function(e,n){return e.node(n).width}(e,o)/2;t=Math.max(n+i,t),r=Math.min(n-i,r)})),t-r}))}(e,o);return function(e,n){var t=zh.values(n),r=zh.min(t),o=zh.max(t);zh.forEach(["u","d"],(function(t){zh.forEach(["l","r"],(function(i){var a,u=t+i,c=e[u];if(c!==n){var l=zh.values(c);(a="l"===i?r-zh.min(l):o-zh.max(l))&&(e[u]=zh.mapValues(c,(function(e){return e+a})))}}))}))}(o,i),function(e,n){return zh.mapValues(e.ul,(function(t,r){if(n)return e[n.toLowerCase()][r];var o=zh.sortBy(zh.map(e,r));return(o[1]+o[2])/2}))}(o,e.graph().align)},Yh=Qd,Xh=ff,Zh=bf,Fh=function(e){switch(e.graph().ranker){case"network-simplex":default:!function(e){$f(e)}(e);break;case"tight-tree":!function(e){Gf(e),qf(e)}(e);break;case"longest-path":Kf(e)}},Uh=pf.normalizeRanks,Wh=function(e){var n=function(e){var n={},t=0;return Qf.forEach(e.children(),(function r(o){var i=t;Qf.forEach(e.children(o),r),n[o]={low:i,lim:t++}})),n}(e);Qf.forEach(e.graph().dummyChains,(function(t){for(var r=e.node(t),o=r.edgeObj,i=function(e,n,t,r){var o,i,a=[],u=[],c=Math.min(n[t].low,n[r].low),l=Math.max(n[t].lim,n[r].lim);o=t;do{o=e.parent(o),a.push(o)}while(o&&(n[o].low>c||l>n[o].lim));for(i=o,o=r;(o=e.parent(o))!==i;)u.push(o);return{path:a.concat(u.reverse()),lca:i}}(e,n,o.v,o.w),a=i.path,u=i.lca,c=0,l=a[c],s=!0;t!==o.w;){if(r=e.node(t),s){for(;(l=a[c])!==u&&e.node(l).maxRank<r.rank;)c++;l===u&&(s=!1)}if(!s){for(;c<a.length-1&&e.node(l=a[c+1]).minRank<=r.rank;)c++;l=a[c]}e.setParent(t,l),t=e.successors(t)[0]}}))},Gh=pf.removeEmptyRanks,qh=nh,$h=function(e){rh.forEach(e.children(),(function n(t){var r=e.children(t),o=e.node(t);if(r.length&&rh.forEach(r,n),rh.has(o,"minRank")){o.borderLeft=[],o.borderRight=[];for(var i=o.minRank,a=o.maxRank+1;i<a;++i)ih(e,"borderLeft","_bl",t,o,i),ih(e,"borderRight","_br",t,o,i)}}))},Kh=uh,Qh=function(e){var n=jh.maxRank(e),t=Ph(e,Sh.range(1,n+1),"inEdges"),r=Ph(e,Sh.range(n-1,-1,-1),"outEdges"),o=kh(e);Ah(e,o);for(var i,a=Number.POSITIVE_INFINITY,u=0,c=0;c<4;++u,++c){Ih(u%2?t:r,u%4>=2),o=jh.buildLayerMatrix(e);var l=Nh(e,o);l<a&&(c=0,i=Sh.cloneDeep(o),a=l)}Ah(e,i)},Jh=function(e){(function(e){var n=Vh.buildLayerMatrix(e),t=e.graph().ranksep,r=0;Rh.forEach(n,(function(n){var o=Rh.max(Rh.map(n,(function(n){return e.node(n).height})));Rh.forEach(n,(function(n){e.node(n).y=r+o/2})),r+=o+t}))})(e=Vh.asNonCompoundGraph(e)),Rh.forEach(Hh(e),(function(n,t){e.node(t).x=n}))},ev=pf,nv=Xd.Graph,tv=["nodesep","edgesep","ranksep","marginx","marginy"],rv={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},ov=["acyclicer","ranker","rankdir","align"],iv=["width","height"],av={width:0,height:0},uv=["minlen","weight","width","height","labeloffset"],cv={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},lv=["labelpos"];function sv(e,n){return Yh.mapValues(Yh.pick(e,n),Number)}function dv(e){var n={};return Yh.forEach(e,(function(e,t){n[t.toLowerCase()]=e})),n}var fv=Qd,hv=pf,vv=Xd.Graph,pv={debugOrdering:function(e){var n=hv.buildLayerMatrix(e),t=new vv({compound:!0,multigraph:!0}).setGraph({});return fv.forEach(e.nodes(),(function(n){t.setNode(n,{label:n}),t.setParent(n,"layer"+e.node(n).rank)})),fv.forEach(e.edges(),(function(e){t.setEdge(e.v,e.w,{},e.name)})),fv.forEach(n,(function(e,n){var r="layer"+n;t.setNode(r,{rank:"same"}),fv.reduce(e,(function(e,n){return t.setEdge(e,n,{style:"invis"}),n}))})),t}},gv=$n({graphlib:Xd,layout:function(e,n){var t=n&&n.debugTiming?ev.time:ev.notime;t("layout",(function(){var n=t(" buildLayoutGraph",(function(){return function(e){var n=new nv({multigraph:!0,compound:!0}),t=dv(e.graph());return n.setGraph(Yh.merge({},rv,sv(t,tv),Yh.pick(t,ov))),Yh.forEach(e.nodes(),(function(t){var r=dv(e.node(t));n.setNode(t,Yh.defaults(sv(r,iv),av)),n.setParent(t,e.parent(t))})),Yh.forEach(e.edges(),(function(t){var r=dv(e.edge(t));n.setEdge(t,Yh.merge({},cv,sv(r,uv),Yh.pick(r,lv)))})),n}(e)}));t(" runLayout",(function(){!function(e,n){n(" makeSpaceForEdgeLabels",(function(){!function(e){var n=e.graph();n.ranksep/=2,Yh.forEach(e.edges(),(function(t){var r=e.edge(t);r.minlen*=2,"c"!==r.labelpos.toLowerCase()&&("TB"===n.rankdir||"BT"===n.rankdir?r.width+=r.labeloffset:r.height+=r.labeloffset)}))}(e)})),n(" removeSelfEdges",(function(){!function(e){Yh.forEach(e.edges(),(function(n){if(n.v===n.w){var t=e.node(n.v);t.selfEdges||(t.selfEdges=[]),t.selfEdges.push({e:n,label:e.edge(n)}),e.removeEdge(n)}}))}(e)})),n(" acyclic",(function(){Xh.run(e)})),n(" nestingGraph.run",(function(){qh.run(e)})),n(" rank",(function(){Fh(ev.asNonCompoundGraph(e))})),n(" injectEdgeLabelProxies",(function(){!function(e){Yh.forEach(e.edges(),(function(n){var t=e.edge(n);if(t.width&&t.height){var r=e.node(n.v),o={rank:(e.node(n.w).rank-r.rank)/2+r.rank,e:n};ev.addDummyNode(e,"edge-proxy",o,"_ep")}}))}(e)})),n(" removeEmptyRanks",(function(){Gh(e)})),n(" nestingGraph.cleanup",(function(){qh.cleanup(e)})),n(" normalizeRanks",(function(){Uh(e)})),n(" assignRankMinMax",(function(){!function(e){var n=0;Yh.forEach(e.nodes(),(function(t){var r=e.node(t);r.borderTop&&(r.minRank=e.node(r.borderTop).rank,r.maxRank=e.node(r.borderBottom).rank,n=Yh.max(n,r.maxRank))})),e.graph().maxRank=n}(e)})),n(" removeEdgeLabelProxies",(function(){!function(e){Yh.forEach(e.nodes(),(function(n){var t=e.node(n);"edge-proxy"===t.dummy&&(e.edge(t.e).labelRank=t.rank,e.removeNode(n))}))}(e)})),n(" normalize.run",(function(){Zh.run(e)})),n(" parentDummyChains",(function(){Wh(e)})),n(" addBorderSegments",(function(){$h(e)})),n(" order",(function(){Qh(e)})),n(" insertSelfEdges",(function(){!function(e){var n=ev.buildLayerMatrix(e);Yh.forEach(n,(function(n){var t=0;Yh.forEach(n,(function(n,r){var o=e.node(n);o.order=r+t,Yh.forEach(o.selfEdges,(function(n){ev.addDummyNode(e,"selfedge",{width:n.label.width,height:n.label.height,rank:o.rank,order:r+ ++t,e:n.e,label:n.label},"_se")})),delete o.selfEdges}))}))}(e)})),n(" adjustCoordinateSystem",(function(){Kh.adjust(e)})),n(" position",(function(){Jh(e)})),n(" positionSelfEdges",(function(){!function(e){Yh.forEach(e.nodes(),(function(n){var t=e.node(n);if("selfedge"===t.dummy){var r=e.node(t.e.v),o=r.x+r.width/2,i=r.y,a=t.x-o,u=r.height/2;e.setEdge(t.e,t.label),e.removeNode(n),t.label.points=[{x:o+2*a/3,y:i-u},{x:o+5*a/6,y:i-u},{x:o+a,y:i},{x:o+5*a/6,y:i+u},{x:o+2*a/3,y:i+u}],t.label.x=t.x,t.label.y=t.y}}))}(e)})),n(" removeBorderNodes",(function(){!function(e){Yh.forEach(e.nodes(),(function(n){if(e.children(n).length){var t=e.node(n),r=e.node(t.borderTop),o=e.node(t.borderBottom),i=e.node(Yh.last(t.borderLeft)),a=e.node(Yh.last(t.borderRight));t.width=Math.abs(a.x-i.x),t.height=Math.abs(o.y-r.y),t.x=i.x+t.width/2,t.y=r.y+t.height/2}})),Yh.forEach(e.nodes(),(function(n){"border"===e.node(n).dummy&&e.removeNode(n)}))}(e)})),n(" normalize.undo",(function(){Zh.undo(e)})),n(" fixupEdgeLabelCoords",(function(){!function(e){Yh.forEach(e.edges(),(function(n){var t=e.edge(n);if(Yh.has(t,"x"))switch("l"!==t.labelpos&&"r"!==t.labelpos||(t.width-=t.labeloffset),t.labelpos){case"l":t.x-=t.width/2+t.labeloffset;break;case"r":t.x+=t.width/2+t.labeloffset}}))}(e)})),n(" undoCoordinateSystem",(function(){Kh.undo(e)})),n(" translateGraph",(function(){!function(e){var n=Number.POSITIVE_INFINITY,t=0,r=Number.POSITIVE_INFINITY,o=0,i=e.graph(),a=i.marginx||0,u=i.marginy||0;function c(e){var i=e.x,a=e.y,u=e.width,c=e.height;n=Math.min(n,i-u/2),t=Math.max(t,i+u/2),r=Math.min(r,a-c/2),o=Math.max(o,a+c/2)}Yh.forEach(e.nodes(),(function(n){c(e.node(n))})),Yh.forEach(e.edges(),(function(n){var t=e.edge(n);Yh.has(t,"x")&&c(t)})),n-=a,r-=u,Yh.forEach(e.nodes(),(function(t){var o=e.node(t);o.x-=n,o.y-=r})),Yh.forEach(e.edges(),(function(t){var o=e.edge(t);Yh.forEach(o.points,(function(e){e.x-=n,e.y-=r})),Yh.has(o,"x")&&(o.x-=n),Yh.has(o,"y")&&(o.y-=r)})),i.width=t-n+a,i.height=o-r+u}(e)})),n(" assignNodeIntersects",(function(){!function(e){Yh.forEach(e.edges(),(function(n){var t,r,o=e.edge(n),i=e.node(n.v),a=e.node(n.w);o.points?(t=o.points[0],r=o.points[o.points.length-1]):(o.points=[],t=a,r=i),o.points.unshift(ev.intersectRect(i,t)),o.points.push(ev.intersectRect(a,r))}))}(e)})),n(" reversePoints",(function(){!function(e){Yh.forEach(e.edges(),(function(n){var t=e.edge(n);t.reversed&&t.points.reverse()}))}(e)})),n(" acyclic.undo",(function(){Xh.undo(e)}))}(n,t)})),t(" updateInputGraph",(function(){!function(e,n){Yh.forEach(e.nodes(),(function(t){var r=e.node(t),o=n.node(t);r&&(r.x=o.x,r.y=o.y,n.children(t).length&&(r.width=o.width,r.height=o.height))})),Yh.forEach(e.edges(),(function(t){var r=e.edge(t),o=n.edge(t);r.points=o.points,Yh.has(o,"x")&&(r.x=o.x,r.y=o.y)})),e.graph().width=n.graph().width,e.graph().height=n.graph().height}(e,n)}))}))},debug:pv,util:{time:pf.time,notime:pf.notime},version:"0.8.5"}),yv={error001:function(){return"[Ink Flow]: Seems like you have not used zustand provider as an ancestor."},error002:function(){return"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them."},error003:function(e){return'Node type "'.concat(e,'" not found. Using fallback type "default".')},error004:function(){return"The Ink Flow parent container needs a width and a height to render the graph."},error005:function(){return"Only child nodes can use a parent extent."},error006:function(){return"Can't create edge. An edge needs a source and a target."},error007:function(e){return"The old edge with id=".concat(e," does not exist.")},error009:function(e){return'Marker type "'.concat(e,"\" doesn't exist.")},error008:function(e,n){var t=n.id,r=n.sourceHandle,o=n.targetHandle;return"Couldn't create edge for ".concat(e,' handle id: "').concat(r?o:r,'", edge id: ').concat(t,".")},error010:function(){return"Handle: No node id found. Make sure to only use a Handle inside a custom Node."},error011:function(e){return'Edge type "'.concat(e,'" not found. Using fallback type "default".')},error012:function(e){return'Node with id "'.concat(e,'" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.')},error013:function(e){return void 0===e&&(e="react"),"It seems that you haven't loaded the styles. Please import '@aloudata/".concat(e,"/dist/style.css' or base.css to make sure everything is working properly.")}},mv=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],wv=["Enter"," ","Escape"],bv={min:.5,max:2},xv=[0,0],_v=function(e,n,t){if(!e.id)return[];var r=new Set;return t.forEach((function(n){n.source===e.id&&r.add(n.target)})),n.filter((function(e){return r.has(e.id)}))},Ev=function(e,n,t){if(!e.id)return[];var r=new Set;return t.forEach((function(n){n.target===e.id&&r.add(n.source)})),n.filter((function(e){return r.has(e.id)}))},Sv=function(e,n){void 0===n&&(n=[0,0]);var t=Xv(e),r=t.width,o=t.height,i="internals"in e?e.internals.positionAbsolute:e.position,a=e.origin||n,u=r*a[0],c=o*a[1];return{position:{x:e.position.x-u,y:e.position.y-c},positionAbsolute:{x:i.x-u,y:i.y-c}}},kv=function(e,n){if(void 0===n&&(n={nodeOrigin:[0,0]}),0===e.length)return{x:0,y:0,width:0,height:0};var t=e.reduce((function(e,t){var r=Lv(t,n.nodeOrigin);return Av(e,r)}),{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Tv(t)},Nv=function(e,n){if(void 0===n&&(n={nodeOrigin:[0,0]}),0===e.size)return{x:0,y:0,width:0,height:0};var t={x:1/0,y:1/0,x2:-1/0,y2:-1/0};return e.forEach((function(e){if(null==n.filter||n.filter(e)){var r=Lv(e,n.nodeOrigin);t=Av(t,r)}})),Tv(t)},Cv=function(e,n){var t=new Set;return e.forEach((function(e){t.add(e.id)})),n.filter((function(e){return t.has(e.source)||t.has(e.target)}))};function Mv(e){var n=e.nodeId,t=e.nextPosition,r=e.nodeLookup,o=e.nodeOrigin,i=void 0===o?[0,0]:o,a=e.nodeExtent,u=e.onError,c=r.get(n),l=c.parentId?r.get(c.parentId):void 0,s=l?Sv(l,l.origin||i).positionAbsolute:{x:0,y:0},d=s.x,f=s.y,h=function(e,n){var t,r,o,i;return n&&"parent"!==n?[n[0],[n[1][0]-(null!==(r=null===(t=e.measured)||void 0===t?void 0:t.width)&&void 0!==r?r:0),n[1][1]-(null!==(i=null===(o=e.measured)||void 0===o?void 0:o.height)&&void 0!==i?i:0)]]:n}(c,c.extent||a);if("parent"!==c.extent||c.expandParent)l&&Yv(c.extent)&&(h=[[c.extent[0][0]+d,c.extent[0][1]+f],[c.extent[1][0]+d,c.extent[1][1]+f]]);else if(l){var v=c.measured.width,p=c.measured.height,g=l.measured.width,y=l.measured.height;if(v&&p&&g&&y){var m=c.origin||i,w=d+v*m[0],b=f+p*m[1];h=[[w,b],[w+g-v,b+y-p]]}}else null==u||u("005",yv.error005());var x=Yv(h)?jv(t,h):t;return{position:{x:x.x-d,y:x.y-f},positionAbsolute:x}}var Ov=function(e,n,t){return void 0===n&&(n=0),void 0===t&&(t=1),Math.min(Math.max(e,n),t)},jv=function(e,n){return void 0===e&&(e={x:0,y:0}),{x:Ov(e.x,n[0][0],n[1][0]),y:Ov(e.y,n[0][1],n[1][1])}},Pv=function(e,n,t){return e<n?Ov(Math.abs(e-n),1,50)/50:e>t?-Ov(Math.abs(e-t),1,50)/50:0},Iv=function(e,n){return[20*Pv(e.x,35,n.width-35),20*Pv(e.y,35,n.height-35)]},Av=function(e,n){return{x:Math.min(e.x,n.x),y:Math.min(e.y,n.y),x2:Math.max(e.x2,n.x2),y2:Math.max(e.y2,n.y2)}},zv=function(e){var n=e.x,t=e.y;return{x:n,y:t,x2:n+e.width,y2:t+e.height}},Tv=function(e){var n=e.x,t=e.y;return{x:n,y:t,width:e.x2-n,height:e.y2-t}},Lv=function(e,n){var t,r,o,i,a,u;void 0===n&&(n=[0,0]);var c=Sv(e,n).positionAbsolute,l=c.x,s=c.y;return{x:l,y:s,x2:l+(null!==(o=null!==(r=null===(t=e.measured)||void 0===t?void 0:t.width)&&void 0!==r?r:e.width)&&void 0!==o?o:0),y2:s+(null!==(u=null!==(a=null===(i=e.measured)||void 0===i?void 0:i.height)&&void 0!==a?a:e.height)&&void 0!==u?u:0)}},Bv=function(e,n){return void 0===n&&(n=[1,1]),{x:n[0]*Math.round(e.x/n[0]),y:n[1]*Math.round(e.y/n[1])}},Dv=function(e,n,t,r){var o=e.x,i=e.y,a=U(n,3),u=a[0],c=a[1],l=a[2];void 0===t&&(t=!1),void 0===r&&(r=[1,1]);var s={x:(o-u)/l,y:(i-c)/l};return t?Bv(s,r):s},Rv=function(e,n){var t=e.x,r=e.y,o=U(n,3),i=o[0],a=o[1],u=o[2];return{x:t*u+i,y:r*u+a}},Vv=function(e,n,t,r,o,i){var a=n/(e.width*(1+i)),u=t/(e.height*(1+i)),c=Math.min(a,u),l=Ov(c,r,o);return{x:n/2-(e.x+e.width/2)*l,y:t/2-(e.y+e.height/2)*l,zoom:l}},Hv=function(){var e;return"undefined"!=typeof navigator&&(null===(e=null===navigator||void 0===navigator?void 0:navigator.userAgent)||void 0===e?void 0:e.indexOf("Mac"))>=0};function Yv(e){return void 0!==e&&"parent"!==e}function Xv(e){var n,t,r,o,i,a,u,c;return{width:null!==(o=null!==(r=null!==(t=null===(n=e.measured)||void 0===n?void 0:n.width)&&void 0!==t?t:e.width)&&void 0!==r?r:e.initialWidth)&&void 0!==o?o:0,height:null!==(c=null!==(u=null!==(a=null===(i=e.measured)||void 0===i?void 0:i.height)&&void 0!==a?a:e.height)&&void 0!==u?u:e.initialHeight)&&void 0!==c?c:0}}var Zv={x:0,y:0};function Fv(e,n){var t=n.snapGrid,r=void 0===t?[0,0]:t,o=n.snapToGrid,i=void 0!==o&&o,a=n.transform,u=Qv(e),c=u.x,l=u.y,s=Dv({x:c,y:l},a),d=i?Bv(s,r):s,f=d.x,h=d.y;return Z({xSnapped:f,ySnapped:h},s)}var Uv,Wv,Gv,qv,$v,Kv,Qv=function(e,n){var t,r,o,i,a=function(e){return"clientX"in e}(e),u=a?e.clientX:null===(t=e.touches)||void 0===t?void 0:t[0].clientX,c=a?e.clientY:null===(r=e.touches)||void 0===r?void 0:r[0].clientY;return{x:u-(null!==(o=null==n?void 0:n.left)&&void 0!==o?o:0),y:c-(null!==(i=null==n?void 0:n.top)&&void 0!==i?i:0)}};function Jv(e){var n=e.sourceX,t=e.sourceY,r=e.targetX,o=e.targetY,i=e.sourceControlX,a=e.sourceControlY,u=.125*n+.375*i+.375*e.targetControlX+.125*r,c=.125*t+.375*a+.375*e.targetControlY+.125*o;return[u,c,Math.abs(u-n),Math.abs(c-t)]}function ep(e,n){return e>=0?.5*e:25*n*Math.sqrt(-e)}function np(e){var n=e.pos,t=e.x1,r=e.y1,o=e.x2,i=e.y2,a=e.c;switch(n){case Kv.Left:return[t-ep(t-o,a),r];case Kv.Right:return[t+ep(o-t,a),r];case Kv.Top:return[t,r-ep(r-i,a)];case Kv.Bottom:return[t,r+ep(i-r,a)]}}function tp(e){var n=e.sourceX,t=e.sourceY,r=e.sourcePosition,o=void 0===r?Kv.Bottom:r,i=e.targetX,a=e.targetY,u=e.targetPosition,c=void 0===u?Kv.Top:u,l=e.curvature,s=void 0===l?.25:l,d=U(np({pos:o,x1:n,y1:t,x2:i,y2:a,c:s}),2),f=d[0],h=d[1],v=U(np({pos:c,x1:i,y1:a,x2:n,y2:t,c:s}),2),p=v[0],g=v[1],y=U(Jv({sourceX:n,sourceY:t,targetX:i,targetY:a,sourceControlX:f,sourceControlY:h,targetControlX:p,targetControlY:g}),4),m=y[0],w=y[1],b=y[2],x=y[3];return["M".concat(n,",").concat(t," C").concat(f,",").concat(h," ").concat(p,",").concat(g," ").concat(i,",").concat(a),m,w,b,x]}function rp(e){var n=e.sourceX,t=e.sourceY,r=e.targetX,o=e.targetY,i=Math.abs(r-n)/2,a=r<n?r+i:r-i,u=Math.abs(o-t)/2;return[a,o<t?o+u:o-u,i,u]}!function(e){e.Strict="strict",e.Loose="loose"}(Uv||(Uv={})),function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"}(Wv||(Wv={})),function(e){e.Partial="partial",e.Full="full"}(Gv||(Gv={})),function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"}(qv||(qv={})),function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"}($v||($v={})),function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"}(Kv||(Kv={}));var op,ip=function(e){var n=e.source,t=e.sourceHandle,r=e.target,o=e.targetHandle;return"xy-edge__".concat(n).concat(t||"","-").concat(r).concat(o||"")},ap=function(e,n){return e.source&&e.target?function(e,n){return n.some((function(n){return!(n.source!==e.source||n.target!==e.target||n.sourceHandle!==e.sourceHandle&&(n.sourceHandle||e.sourceHandle)||n.targetHandle!==e.targetHandle&&(n.targetHandle||e.targetHandle))}))}(t=function(e){return"id"in e&&"source"in e&&"target"in e}(e)?Z({},e):Z(Z({},e),{id:ip(e)}),n)?n:(null===t.sourceHandle&&delete t.sourceHandle,null===t.targetHandle&&delete t.targetHandle,n.concat(t)):n;var t},up=function(e,n,t,r){void 0===r&&(r={shouldReplaceId:!0});var o=e.id,i=function(e,n){var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&n.indexOf(r)<0&&(t[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)n.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(t[r[o]]=e[r[o]])}return t}(e,["id"]);if(!n.source||!n.target)return t;if(!t.find((function(n){return n.id===e.id})))return t;var a=Z(Z({},i),{id:r.shouldReplaceId?ip(n):o,source:n.source,target:n.target,sourceHandle:n.sourceHandle,targetHandle:n.targetHandle});return t.filter((function(e){return e.id!==o})).concat(a)};function cp(e){var n=e.sourceX,t=e.sourceY,r=e.targetX,o=e.targetY,i=U(rp({sourceX:n,sourceY:t,targetX:r,targetY:o}),4),a=i[0],u=i[1],c=i[2],l=i[3];return["M ".concat(n,",").concat(t,"L ").concat(r,",").concat(o),a,u,c,l]}var lp=((op={})[Kv.Left]={x:-1,y:0},op[Kv.Right]={x:1,y:0},op[Kv.Top]={x:0,y:-1},op[Kv.Bottom]={x:0,y:1},op),sp=function(e,n){return Math.sqrt(Math.pow(n.x-e.x,2)+Math.pow(n.y-e.y,2))};function dp(e){var n=e.sourceX,t=e.sourceY,r=e.sourcePosition,o=void 0===r?Kv.Bottom:r,i=e.targetX,a=e.targetY,u=e.targetPosition,c=void 0===u?Kv.Top:u,l=e.borderRadius,s=void 0===l?5:l,d=e.centerX,f=e.centerY,h=e.offset,v=U(function(e){var n,t,r,o,i=e.source,a=e.sourcePosition,u=void 0===a?Kv.Bottom:a,c=e.target,l=e.targetPosition,s=void 0===l?Kv.Top:l,d=e.center,f=e.offset,h=lp[u],v=lp[s],p={x:i.x+h.x*f,y:i.y+h.y*f},g={x:c.x+v.x*f,y:c.y+v.y*f},y=function(e){var n=e.source,t=e.sourcePosition,r=void 0===t?Kv.Bottom:t,o=e.target;return r===Kv.Left||r===Kv.Right?n.x<o.x?{x:1,y:0}:{x:-1,y:0}:n.y<o.y?{x:0,y:1}:{x:0,y:-1}}({source:p,sourcePosition:u,target:g}),m=0!==y.x?"x":"y",w=y[m],b=[],x={x:0,y:0},_={x:0,y:0},E=U(rp({sourceX:i.x,sourceY:i.y,targetX:c.x,targetY:c.y}),4),S=E[0],k=E[1],N=E[2],C=E[3];if(h[m]*v[m]==-1){r=null!==(n=d.x)&&void 0!==n?n:S,o=null!==(t=d.y)&&void 0!==t?t:k;var M=[{x:r,y:p.y},{x:r,y:g.y}],O=[{x:p.x,y:o},{x:g.x,y:o}];b=h[m]===w?"x"===m?M:O:"x"===m?O:M}else{var j=[{x:p.x,y:g.y}],P=[{x:g.x,y:p.y}];if(b="x"===m?h.x===w?P:j:h.y===w?j:P,u===s){var I=Math.abs(i[m]-c[m]);if(I<=f){var A=Math.min(f-1,f-I);h[m]===w?x[m]=(p[m]>i[m]?-1:1)*A:_[m]=(g[m]>c[m]?-1:1)*A}}if(u!==s){var z="x"===m?"y":"x",T=h[m]===v[z],L=p[z]>g[z],B=p[z]<g[z];(1===h[m]&&(!T&&L||T&&B)||1!==h[m]&&(!T&&B||T&&L))&&(b="x"===m?j:P)}var D={x:p.x+x.x,y:p.y+x.y},R={x:g.x+_.x,y:g.y+_.y};Math.max(Math.abs(D.x-b[0].x),Math.abs(R.x-b[0].x))>=Math.max(Math.abs(D.y-b[0].y),Math.abs(R.y-b[0].y))?(r=(D.x+R.x)/2,o=b[0].y):(r=b[0].x,o=(D.y+R.y)/2)}return[W(W([i,{x:p.x+x.x,y:p.y+x.y}],U(b),!1),[{x:g.x+_.x,y:g.y+_.y},c],!1),r,o,N,C]}({source:{x:n,y:t},sourcePosition:o,target:{x:i,y:a},targetPosition:c,center:{x:d,y:f},offset:void 0===h?20:h}),5),p=v[0],g=v[1],y=v[2],m=v[3],w=v[4],b=p.reduce((function(e,n,t){var r;return r=t>0&&t<p.length-1?function(e,n,t,r){var o=Math.min(sp(e,n)/2,sp(n,t)/2,r),i=n.x,a=n.y;if(e.x===i&&i===t.x||e.y===a&&a===t.y)return"L".concat(i," ").concat(a);if(e.y===a){var u=e.x<t.x?-1:1,c=e.y<t.y?1:-1;return"L ".concat(i+o*u,",").concat(a,"Q ").concat(i,",").concat(a," ").concat(i,",").concat(a+o*c)}var l=e.x<t.x?1:-1,s=e.y<t.y?-1:1;return"L ".concat(i,",").concat(a+o*s,"Q ").concat(i,",").concat(a," ").concat(i+o*l,",").concat(a)}(p[t-1],n,p[t+1],s):"".concat(0===t?"M":"L").concat(n.x," ").concat(n.y),e+r}),"");return[b,g,y,m,w]}function fp(e,n,t){var r=(null==t?void 0:t.rankdir)||"TB",o=new gv.graphlib.Graph;o.setDefaultEdgeLabel((function(){return{}})),o.setGraph(Z({rankdir:r},t));var i=e.map((function(e){return Z({},e)}));i.forEach((function(e){var n,t;if(!e.id)throw new Error('Node "id" does not exist');var r=(null===(n=e.data)||void 0===n?void 0:n.width)||200,i=(null===(t=e.data)||void 0===t?void 0:t.height)||56;o.setNode(e.id,{width:r,height:i})})),n.forEach((function(e){o.setEdge(e.source,e.target)})),gv.layout(o),i.forEach((function(e){var n=o.node(e.id),t="bottom",i="top";switch(r){case"TB":default:t="bottom",i="top";break;case"BT":t="top",i="bottom";break;case"LR":case"RL":t="right",i="left"}e.targetPosition=i,e.sourcePosition=t,e.position={x:n.x-n.width/2,y:n.y-n.height/2}}));var a=function(e){var n=e.centerNodeId,t=e.containerHeight,r=void 0===t?0:t,o=e.containerWidth,i=void 0===o?0:o,a=e.centerByBBox,u=e.nodes,c=e.nodeOrigin,l=void 0===c?xv:c;if(!n&&!a||!r||!i)return Zv;if(null==n?void 0:n.trim()){var s=null==u?void 0:u.find((function(e){return e.id===(null==n?void 0:n.trim())}));if(s){var d=function(e,n){if(!e)return Zv;var t=Xv(e),r=t.width,o=t.height,i=r*n[0],a=o*n[1];return{x:e.position.x+r/2-i,y:e.position.y+o/2-a}}(s,l);return{x:i/2-d.x,y:r/2-d.y}}}return a?(d=function(e,n){if(!(null==e?void 0:e.length))return Zv;var t=kv(e,{nodeOrigin:n}),r=t.x,o=t.y;return{x:r+t.width/2,y:o+t.height/2}}(u,l),{x:i/2-d.x,y:r/2-d.y}):Zv}({centerByBBox:null==t?void 0:t.centerByBBox,centerNodeId:null==t?void 0:t.centerNodeId,nodes:i,containerWidth:null==t?void 0:t.width,containerHeight:null==t?void 0:t.height,nodeOrigin:null==t?void 0:t.nodeOrigin}),u=a.x,c=void 0===u?0:u,l=a.y,s=void 0===l?0:l;i.forEach((function(e){e.position={x:e.position.x+c,y:e.position.y+s}}));var d={overflowBoundary:!1,transform:{x:0,y:0,zoom:1}};return(null==t?void 0:t.width)&&(null==t?void 0:t.height)&&t.fitViewOptions&&(d=function(e,n){var t=n||{},r=t.minZoom,o=void 0===r?bv.min:r,i=t.maxZoom,a=void 0===i?bv.max:i,u=t.padding,c=void 0===u?.1:u,l=t.nodeOrigin,s=void 0===l?xv:l,d=t.width,f=t.height,h=kv(e||[],{nodeOrigin:s}),v=h.width>=d||h.height>=f;return{transform:Vv(h,d,f,o,a,c),overflowBoundary:v}}(i,Z({width:t.width,height:t.height,nodeOrigin:t.nodeOrigin},t.fitViewOptions))),{nodes:i,edges:n,transform:d.transform,overflowBoundary:d.overflowBoundary}}var hp=function(e){return null!==e&&"function"!=typeof e&&isFinite(e.length)},vp=function(e,n){return!!hp(e)&&e.indexOf(n)>-1},pp=function(e,n){if(!hp(e))return e;for(var t=[],r=0;r<e.length;r++){var o=e[r];n(o,r)&&t.push(o)}return t},gp={}.toString,yp=function(e,n){return gp.call(e)==="[object "+n+"]"},mp=function(e){return yp(e,"Function")},wp=function(e){return null==e},bp=function(e){return Array.isArray?Array.isArray(e):yp(e,"Array")},xp=function(e){var n=typeof e;return null!==e&&"object"===n||"function"===n};function _p(e,n){if(e)if(bp(e))for(var t=0,r=e.length;t<r&&!1!==n(e[t],t);t++);else if(xp(e))for(var o in e)if(e.hasOwnProperty(o)&&!1===n(e[o],o))break}var Ep=Object.keys?function(e){return Object.keys(e)}:function(e){var n=[];return _p(e,(function(t,r){mp(e)&&"prototype"===r||n.push(r)})),n};function Sp(e,n){var t=Ep(n),r=t.length;if(wp(e))return!r;for(var o=0;o<r;o+=1){var i=t[o];if(n[i]!==e[i]||!(i in e))return!1}return!0}var kp=function(e){return"object"==typeof e&&null!==e},Np=function(e){if(!kp(e)||!yp(e,"Object"))return!1;if(null===Object.getPrototypeOf(e))return!0;for(var n=e;null!==Object.getPrototypeOf(n);)n=Object.getPrototypeOf(n);return Object.getPrototypeOf(e)===n},Cp=function(e,n){if(void 0===n&&(n=[]),bp(e))for(var t=0;t<e.length;t+=1)Cp(e[t],n);else n.push(e);return n},Mp=function(e){if(bp(e))return e.reduce((function(e,n){return Math.max(e,n)}),e[0])},Op=function(e){if(bp(e))return e.reduce((function(e,n){return Math.min(e,n)}),e[0])},jp=Array.prototype,Pp=jp.splice,Ip=jp.indexOf,Ap=Array.prototype.splice,zp=function(e,n){if(!hp(e))return[];for(var t=e?n.length:0,r=t-1;t--;){var o=void 0,i=n[t];t!==r&&i===o||(o=i,Ap.call(e,i,1))}return e},Tp=function(e,n,t){if(!bp(e)&&!Np(e))return e;var r=t;return _p(e,(function(e,t){r=n(r,e,t)})),r},Lp=function(e){return yp(e,"String")};function Bp(e,n){void 0===n&&(n=new Map);var t=[];if(Array.isArray(e))for(var r=0,o=e.length;r<o;r++){var i=e[r];n.has(i)||(t.push(i),n.set(i,!0))}return t}var Dp=Object.prototype.hasOwnProperty;function Rp(e,n){if(!n||!bp(e))return{};for(var t,r={},o=mp(n)?n:function(e){return e[n]},i=0;i<e.length;i++){var a=e[i];t=o(a),Dp.call(r,t)?r[t].push(a):r[t]=[a]}return r}function Vp(e,n){if(!n)return{0:e};if(!mp(n)){var t=bp(n)?n:n.replace(/\s+/g,"").split("*");n=function(e){for(var n="_",r=0,o=t.length;r<o;r++)n+=e[t[r]]&&e[t[r]].toString();return n}}return Rp(e,n)}var Hp={},Yp=function(e){return yp(e,"Number")},Xp=Number.isInteger?Number.isInteger:function(e){return Yp(e)&&e%1==0},Zp=180/Math.PI,Fp=parseInt,Up=Math.PI/180,Wp=function(e,n){return e.hasOwnProperty(n)},Gp=Object.values?function(e){return Object.values(e)}:function(e){var n=[];return _p(e,(function(t,r){mp(e)&&"prototype"===r||n.push(t)})),n},qp=function(e){return wp(e)?"":e.toString()},$p={}.toString,Kp=function(e){return $p.call(e).replace(/^\[object /,"").replace(/]$/,"")},Qp=Object.prototype,Jp=function(e){var n=e&&e.constructor;return e===("function"==typeof n&&n.prototype||Qp)};function eg(e,n){for(var t in n)n.hasOwnProperty(t)&&"constructor"!==t&&void 0!==n[t]&&(e[t]=n[t])}function ng(e,n,t,r){return n&&eg(e,n),t&&eg(e,t),r&&eg(e,r),e}var tg=function(e){if("object"!=typeof e||null===e)return e;var n;if(bp(e)){n=[];for(var t=0,r=e.length;t<r;t++)"object"==typeof e[t]&&null!=e[t]?n[t]=tg(e[t]):n[t]=e[t]}else for(var o in n={},e)"object"==typeof e[o]&&null!=e[o]?n[o]=tg(e[o]):n[o]=e[o];return n},rg=function(e,n){if(!mp(e))throw new TypeError("Expected a function");var t=function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];var i=n?n.apply(this,r):r[0],a=t.cache;if(a.has(i))return a.get(i);var u=e.apply(this,r);return a.set(i,u),u};return t.cache=new Map,t};function og(e,n,t,r){for(var o in t=t||0,r=r||5,n)if(n.hasOwnProperty(o)){var i=n[o];null!==i&&Np(i)?(Np(e[o])||(e[o]={}),t<r?og(e[o],i,t+1,r):e[o]=n[o]):bp(i)?(e[o]=[],e[o]=e[o].concat(i)):void 0!==i&&(e[o]=i)}}var ig,ag=Object.prototype.hasOwnProperty,ug=function(e,n){if(e===n)return!0;if(!e||!n)return!1;if(Lp(e)||Lp(n))return!1;if(hp(e)||hp(n)){if(e.length!==n.length)return!1;for(var t=!0,r=0;r<e.length&&(t=ug(e[r],n[r]));r++);return t}if(kp(e)||kp(n)){var o=Object.keys(e),i=Object.keys(n);if(o.length!==i.length)return!1;for(t=!0,r=0;r<o.length&&(t=ug(e[o[r]],n[o[r]]));r++);return t}return!1},cg=function(e){return e},lg=Object.prototype.hasOwnProperty,sg={},dg=rg((function(e,n){void 0===n&&(n={});var t=n.fontSize,r=n.fontFamily,o=n.fontWeight,i=n.fontStyle,a=n.fontVariant;return ig||(ig=document.createElement("canvas").getContext("2d")),ig.font=[i,a,o,t+"px",r].join(" "),ig.measureText(Lp(e)?e:"").width}),(function(e,n){return void 0===n&&(n={}),function(){for(var e=0,n=0,t=arguments.length;n<t;n++)e+=arguments[n].length;var r=Array(e),o=0;for(n=0;n<t;n++)for(var i=arguments[n],a=0,u=i.length;a<u;a++,o++)r[o]=i[a];return r}([e],Gp(n)).join("")})),fg=function(){function e(){this.map={}}return e.prototype.has=function(e){return void 0!==this.map[e]},e.prototype.get=function(e,n){var t=this.map[e];return void 0===t?n:t},e.prototype.set=function(e,n){this.map[e]=n},e.prototype.clear=function(){this.map={}},e.prototype.delete=function(e){delete this.map[e]},e.prototype.size=function(){return Object.keys(this.map).length},e}(),hg=Object.freeze({__proto__:null,Cache:fg,assign:ng,augment:function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];for(var t=e[0],r=1;r<e.length;r++){var o=e[r];mp(o)&&(o=o.prototype),ng(t.prototype,o)}},clamp:function(e,n,t){return e<n?n:e>t?t:e},clearAnimationFrame:function(e){(window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.msCancelAnimationFrame||clearTimeout)(e)},clone:tg,contains:vp,debounce:function(e,n,t){var r;return function(){var o=this,i=arguments,a=t&&!r;clearTimeout(r),r=setTimeout((function(){r=null,t||e.apply(o,i)}),n),a&&e.apply(o,i)}},deepMix:function(e){for(var n=[],t=1;t<arguments.length;t++)n[t-1]=arguments[t];for(var r=0;r<n.length;r+=1)og(e,n[r]);return e},difference:function(e,n){return void 0===n&&(n=[]),pp(e,(function(e){return!vp(n,e)}))},each:_p,endsWith:function(e,n){return!(!bp(e)&&!Lp(e))&&e[e.length-1]===n},every:function(e,n){for(var t=0;t<e.length;t++)if(!n(e[t],t))return!1;return!0},extend:function(e,n,t,r){mp(n)||(t=n,n=e,e=function(){});var o=Object.create?function(e,n){return Object.create(e,{constructor:{value:n}})}:function(e,n){function t(){}t.prototype=e;var r=new t;return r.constructor=n,r},i=o(n.prototype,e);return e.prototype=ng(i,e.prototype),e.superclass=o(n.prototype,n),ng(i,t),ng(e,r),e},filter:pp,find:function(e,n){if(!bp(e))return null;var t;if(mp(n)&&(t=n),Np(n)&&(t=function(e){return Sp(e,n)}),t)for(var r=0;r<e.length;r+=1)if(t(e[r]))return e[r];return null},findIndex:function(e,n,t){void 0===t&&(t=0);for(var r=t;r<e.length;r++)if(n(e[r],r))return r;return-1},firstValue:function(e,n){for(var t=null,r=0;r<e.length;r++){var o=e[r][n];if(!wp(o)){t=bp(o)?o[0]:o;break}}return t},fixedBase:function(e,n){var t=n.toString(),r=t.indexOf(".");if(-1===r)return Math.round(e);var o=t.substr(r+1).length;return o>20&&(o=20),parseFloat(e.toFixed(o))},flatten:function(e){if(!bp(e))return[];for(var n=[],t=0;t<e.length;t++)n=n.concat(e[t]);return n},flattenDeep:Cp,forIn:_p,get:function(e,n,t){for(var r=0,o=Lp(n)?n.split("."):n;e&&r<o.length;)e=e[o[r++]];return void 0===e||r<o.length?t:e},getEllipsisText:function(e,n,t,r){void 0===r&&(r="...");var o,i,a=dg(r,t),u=Lp(e)?e:qp(e),c=n,l=[];if(dg(e,t)<=n)return e;for(;o=u.substr(0,16),!((i=dg(o,t))+a>c&&i>c);)if(l.push(o),c-=i,!(u=u.substr(16)))return l.join("");for(;o=u.substr(0,1),!((i=dg(o,t))+a>c);)if(l.push(o),c-=i,!(u=u.substr(1)))return l.join("");return""+l.join("")+r},getRange:function(e){var n=e.filter((function(e){return!isNaN(e)}));if(!n.length)return{min:0,max:0};if(bp(e[0])){for(var t=[],r=0;r<e.length;r++)t=t.concat(e[r]);n=t}var o=Mp(n);return{min:Op(n),max:o}},getType:Kp,getWrapBehavior:function(e,n){return e["_wrap_"+n]},group:function(e,n){if(!n)return[e];var t=Vp(e,n),r=[];for(var o in t)r.push(t[o]);return r},groupBy:Rp,groupToMap:Vp,has:Wp,hasKey:Wp,hasValue:function(e,n){return vp(Gp(e),n)},head:function(e){if(hp(e))return e[0]},identity:function(e){return e},includes:vp,indexOf:function(e,n){if(!hp(e))return-1;var t=Array.prototype.indexOf;if(t)return t.call(e,n);for(var r=-1,o=0;o<e.length;o++)if(e[o]===n){r=o;break}return r},isArguments:function(e){return yp(e,"Arguments")},isArray:bp,isArrayLike:hp,isBoolean:function(e){return yp(e,"Boolean")},isDate:function(e){return yp(e,"Date")},isDecimal:function(e){return Yp(e)&&e%1!=0},isElement:function(e){return e instanceof Element||e instanceof HTMLDocument},isEmpty:function(e){if(wp(e))return!0;if(hp(e))return!e.length;var n=Kp(e);if("Map"===n||"Set"===n)return!e.size;if(Jp(e))return!Object.keys(e).length;for(var t in e)if(ag.call(e,t))return!1;return!0},isEqual:ug,isEqualWith:function(e,n,t){return mp(t)?!!t(e,n):ug(e,n)},isError:function(e){return yp(e,"Error")},isEven:function(e){return Yp(e)&&e%2==0},isFinite:function(e){return Yp(e)&&isFinite(e)},isFunction:mp,isInteger:Xp,isMatch:Sp,isNegative:function(e){return Yp(e)&&e<0},isNil:wp,isNull:function(e){return null===e},isNumber:Yp,isNumberEqual:function(e,n,t){return void 0===t&&(t=1e-5),Math.abs(e-n)<t},isObject:xp,isObjectLike:kp,isOdd:function(e){return Yp(e)&&e%2!=0},isPlainObject:Np,isPositive:function(e){return Yp(e)&&e>0},isPrototype:Jp,isRegExp:function(e){return yp(e,"RegExp")},isString:Lp,isType:yp,isUndefined:function(e){return void 0===e},keys:Ep,last:function(e){if(hp(e))return e[e.length-1]},lowerCase:function(e){return qp(e).toLowerCase()},lowerFirst:function(e){var n=qp(e);return n.charAt(0).toLowerCase()+n.substring(1)},map:function(e,n){if(!hp(e))return e;for(var t=[],r=0;r<e.length;r++){var o=e[r];t.push(n(o,r))}return t},mapValues:function(e,n){void 0===n&&(n=cg);var t={};return xp(e)&&!wp(e)&&Object.keys(e).forEach((function(r){t[r]=n(e[r],r)})),t},max:Mp,maxBy:function(e,n){if(bp(e)){for(var t,r=-1/0,o=0;o<e.length;o++){var i=e[o],a=mp(n)?n(i):i[n];a>r&&(t=i,r=a)}return t}},measureTextWidth:dg,memoize:rg,min:Op,minBy:function(e,n){if(bp(e)){for(var t,r=1/0,o=0;o<e.length;o++){var i=e[o],a=mp(n)?n(i):i[n];a<r&&(t=i,r=a)}return t}},mix:ng,mod:function(e,n){return(e%n+n)%n},noop:function(){},number2color:function(e){var n=Hp[e];if(!n){for(var t=e.toString(16),r=t.length;r<6;r++)t="0"+t;n="#"+t,Hp[e]=n}return n},omit:function(e,n){return Tp(e,(function(e,t,r){return n.includes(r)||(e[r]=t),e}),{})},parseRadius:function(e){var n=0,t=0,r=0,o=0;return bp(e)?1===e.length?n=t=r=o=e[0]:2===e.length?(n=r=e[0],t=o=e[1]):3===e.length?(n=e[0],t=o=e[1],r=e[2]):(n=e[0],t=e[1],r=e[2],o=e[3]):n=t=r=o=e,{r1:n,r2:t,r3:r,r4:o}},pick:function(e,n){if(null===e||!Np(e))return{};var t={};return _p(n,(function(n){lg.call(e,n)&&(t[n]=e[n])})),t},pull:function(e){for(var n=[],t=1;t<arguments.length;t++)n[t-1]=arguments[t];for(var r=0;r<n.length;r++)for(var o=n[r],i=-1;(i=Ip.call(e,o))>-1;)Pp.call(e,i,1);return e},pullAt:zp,reduce:Tp,remove:function(e,n){var t=[];if(!hp(e))return t;for(var r=-1,o=[],i=e.length;++r<i;){var a=e[r];n(a,r,e)&&(t.push(a),o.push(r))}return zp(e,o),t},requestAnimationFrame:function(e){return(window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.msRequestAnimationFrame||function(e){return setTimeout(e,16)})(e)},set:function(e,n,t){var r=e,o=Lp(n)?n.split("."):n;return o.forEach((function(e,n){n<o.length-1?(xp(r[e])||(r[e]=Yp(o[n+1])?[]:{}),r=r[e]):r[e]=t})),e},size:function(e){return wp(e)?0:hp(e)?e.length:Object.keys(e).length},some:function(e,n){for(var t=0;t<e.length;t++)if(n(e[t],t))return!0;return!1},sortBy:function(e,n){var t;if(mp(n))t=function(e,t){return n(e)-n(t)};else{var r=[];Lp(n)?r.push(n):bp(n)&&(r=n),t=function(e,n){for(var t=0;t<r.length;t+=1){var o=r[t];if(e[o]>n[o])return 1;if(e[o]<n[o])return-1}return 0}}return e.sort(t),e},startsWith:function(e,n){return!(!bp(e)&&!Lp(e))&&e[0]===n},substitute:function(e,n){return e&&n?e.replace(/\\?\{([^{}]+)\}/g,(function(e,t){return"\\"===e.charAt(0)?e.slice(1):void 0===n[t]?"":n[t]})):e},throttle:function(e,n,t){var r,o,i,a,u=0;t||(t={});var c=function(){u=!1===t.leading?0:Date.now(),r=null,a=e.apply(o,i),r||(o=i=null)},l=function(){var l=Date.now();u||!1!==t.leading||(u=l);var s=n-(l-u);return o=this,i=arguments,s<=0||s>n?(r&&(clearTimeout(r),r=null),u=l,a=e.apply(o,i),r||(o=i=null)):r||!1===t.trailing||(r=setTimeout(c,s)),a};return l.cancel=function(){clearTimeout(r),u=0,r=o=i=null},l},toArray:function(e){return hp(e)?Array.prototype.slice.call(e):[]},toDegree:function(e){return Zp*e},toInteger:Fp,toRadian:function(e){return Up*e},toString:qp,union:function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return Bp([].concat.apply([],e))},uniq:Bp,uniqueId:function(e){return sg[e=e||"g"]?sg[e]+=1:sg[e]=1,e+sg[e]},upperCase:function(e){return qp(e).toUpperCase()},upperFirst:function(e){var n=qp(e);return n.charAt(0).toUpperCase()+n.substring(1)},values:Gp,valuesOfKey:function(e,n){for(var t=[],r={},o=0;o<e.length;o++){var i=e[o][n];if(!wp(i)){bp(i)||(i=[i]);for(var a=0;a<i.length;a++){var u=i[a];r[u]||(t.push(u),r[u]=!0)}}}return t},wrapBehavior:function(e,n){if(e["_wrap_"+n])return e["_wrap_"+n];var t=function(t){e[n](t)};return e["_wrap_"+n]=t,t}}),vg={assign:function(e){if(e.__esModule)return e;var n=e.default;if("function"==typeof n){var t=function e(){return this instanceof e?Reflect.construct(n,arguments,this.constructor):n.apply(this,arguments)};t.prototype=n.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(e).forEach((function(n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})})),t}(hg).mix,getHeight:function(e,n,t,r){return void 0===r&&(r="height"),"center"===t?(e[r]+n[r])/2:e.height}},pg=vg,gg={getId:function(e){return e.id||e.name},getPreH:function(e){return e.preH||0},getPreV:function(e){return e.preV||0},getHGap:function(e){return e.hgap||18},getVGap:function(e){return e.vgap||18},getChildren:function(e){return e.children},getHeight:function(e){return e.height||36},getWidth:function(e){var n=e.label||" ";return e.width||18*n.split("").length}};function yg(e,n){var t=this;if(t.vgap=t.hgap=0,e instanceof yg)return e;t.data=e;var r=n.getHGap(e),o=n.getVGap(e);return t.preH=n.getPreH(e),t.preV=n.getPreV(e),t.width=n.getWidth(e),t.height=n.getHeight(e),t.width+=t.preH,t.height+=t.preV,t.id=n.getId(e),t.x=t.y=0,t.depth=0,t.children||(t.children=[]),t.addGap(r,o),t}pg.assign(yg.prototype,{isRoot:function(){return 0===this.depth},isLeaf:function(){return 0===this.children.length},addGap:function(e,n){var t=this;t.hgap+=e,t.vgap+=n,t.width+=2*e,t.height+=2*n},eachNode:function(e){for(var n,t=[this];n=t.shift();)e(n),t=n.children.concat(t)},DFTraverse:function(e){this.eachNode(e)},BFTraverse:function(e){for(var n,t=[this];n=t.shift();)e(n),t=t.concat(n.children)},getBoundingBox:function(){var e={left:Number.MAX_VALUE,top:Number.MAX_VALUE,width:0,height:0};return this.eachNode((function(n){e.left=Math.min(e.left,n.x),e.top=Math.min(e.top,n.y),e.width=Math.max(e.width,n.x+n.width),e.height=Math.max(e.height,n.y+n.height)})),e},translate:function(e,n){void 0===e&&(e=0),void 0===n&&(n=0),this.eachNode((function(t){t.x+=e,t.y+=n,t.x+=t.preH,t.y+=t.preV}))},right2left:function(){var e=this,n=e.getBoundingBox();e.eachNode((function(e){e.x=e.x-2*(e.x-n.left)-e.width})),e.translate(n.width,0)},bottom2top:function(){var e=this,n=e.getBoundingBox();e.eachNode((function(e){e.y=e.y-2*(e.y-n.top)-e.height})),e.translate(0,n.height)}});var mg=function(e,n,t){void 0===n&&(n={});var r,o=new yg(e,n=pg.assign({},gg,n)),i=[o];if(!t&&!e.collapsed)for(;r=i.shift();)if(!r.data.collapsed){var a=n.getChildren(r.data),u=a?a.length:0;if(r.children=new Array(u),a&&u)for(var c=0;c<u;c++){var l=new yg(a[c],n);r.children[c]=l,i.push(l),l.parent=r,l.depth=r.depth+1}}return o},wg=mg,bg=function(){function e(e,n){void 0===n&&(n={}),this.options=n,this.rootNode=wg(e,n)}return e.prototype.execute=function(){throw new Error("please override this method")},e}(),xg=bg;function _g(e,n,t,r){void 0===r&&(r=[]);var o=this;o.w=e||0,o.h=n||0,o.y=t||0,o.x=0,o.c=r||[],o.cs=r.length,o.prelim=0,o.mod=0,o.shift=0,o.change=0,o.tl=null,o.tr=null,o.el=null,o.er=null,o.msel=0,o.mser=0}function Eg(e,n,t){t?e.y+=n:e.x+=n,e.children.forEach((function(e){Eg(e,n,t)}))}function Sg(e,n){var t=n?e.y:e.x;return e.children.forEach((function(e){t=Math.min(Sg(e,n),t)})),t}function kg(e,n){Eg(e,-Sg(e,n),n)}function Ng(e,n,t){t?n.y=e.x:n.x=e.x,e.c.forEach((function(e,r){Ng(e,n.children[r],t)}))}function Cg(e,n,t){void 0===t&&(t=0),n?(e.x=t,t+=e.width):(e.y=t,t+=e.height),e.children.forEach((function(e){Cg(e,n,t)}))}_g.fromNode=function(e,n){if(!e)return null;var t=[];return e.children.forEach((function(e){t.push(_g.fromNode(e,n))})),n?new _g(e.height,e.width,e.x,t):new _g(e.width,e.height,e.y,t)};var Mg=mg,Og=function(e,n){for(var t=Mg(e.data,n,!0),r=Mg(e.data,n,!0),o=e.children.length,i=Math.round(o/2),a=n.getSide||function(e,n){return n<i?"right":"left"},u=0;u<o;u++){var c=e.children[u];"right"===a(c,u)?r.children.push(c):t.children.push(c)}return t.eachNode((function(e){e.isRoot()||(e.side="left")})),r.eachNode((function(e){e.isRoot()||(e.side="right")})),{left:t,right:r}},jg=Og,Pg=["LR","RL","TB","BT","H","V"],Ig=["LR","RL","H"],Ag=Pg[0],zg=function(e,n,t){var r=n.direction||Ag;if(n.isHorizontal=function(e){return Ig.indexOf(e)>-1}(r),r&&-1===Pg.indexOf(r))throw new TypeError("Invalid direction: "+r);if(r===Pg[0])t(e,n);else if(r===Pg[1])t(e,n),e.right2left();else if(r===Pg[2])t(e,n);else if(r===Pg[3])t(e,n),e.bottom2top();else if(r===Pg[4]||r===Pg[5]){var o=jg(e,n),i=o.left,a=o.right;t(i,n),t(a,n),n.isHorizontal?i.right2left():i.bottom2top(),a.translate(i.x-a.x,i.y-a.y),e.x=i.x,e.y=a.y;var u=e.getBoundingBox();n.isHorizontal?u.top<0&&e.translate(0,-u.top):u.left<0&&e.translate(-u.left,0)}var c=n.fixedRoot;return void 0===c&&(c=!0),c&&e.translate(-(e.x+e.width/2+e.hgap),-(e.y+e.height/2+e.vgap)),e};function Tg(e,n){return Tg=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,n){return e.__proto__=n,e},Tg(e,n)}var Lg=function(e,n){void 0===n&&(n={});var t=n.isHorizontal;function r(e){0===e.cs?(e.el=e,e.er=e,e.msel=e.mser=0):(e.el=e.c[0].el,e.msel=e.c[0].msel,e.er=e.c[e.cs-1].er,e.mser=e.c[e.cs-1].mser)}function o(e,n,t){for(var r=e.c[n-1],o=r.mod,l=e.c[n],s=l.mod;null!==r&&null!==l;){c(r)>t.low&&(t=t.nxt);var d=o+r.prelim+r.w-(s+l.prelim);d>0&&(s+=d,i(e,n,t.index,d));var f=c(r),h=c(l);f<=h&&null!==(r=u(r))&&(o+=r.mod),f>=h&&null!==(l=a(l))&&(s+=l.mod)}!r&&l?function(e,n,t,r){var o=e.c[0].el;o.tl=t;var i=r-t.mod-e.c[0].msel;o.mod+=i,o.prelim-=i,e.c[0].el=e.c[n].el,e.c[0].msel=e.c[n].msel}(e,n,l,s):r&&!l&&function(e,n,t,r){var o=e.c[n].er;o.tr=t;var i=r-t.mod-e.c[n].mser;o.mod+=i,o.prelim-=i,e.c[n].er=e.c[n-1].er,e.c[n].mser=e.c[n-1].mser}(e,n,r,o)}function i(e,n,t,r){e.c[n].mod+=r,e.c[n].msel+=r,e.c[n].mser+=r,function(e,n,t,r){if(t!==n-1){var o=n-t;e.c[t+1].shift+=r/o,e.c[n].shift-=r/o,e.c[n].change-=r-r/o}}(e,n,t,r)}function a(e){return 0===e.cs?e.tl:e.c[0]}function u(e){return 0===e.cs?e.tr:e.c[e.cs-1]}function c(e){return e.y+e.h}function l(e,n,t){for(;null!==t&&e>=t.low;)t=t.nxt;return{low:e,index:n,nxt:t}}Cg(e,t);var s=_g.fromNode(e,t);return function e(n){if(0!==n.cs){e(n.c[0]);for(var t=l(c(n.c[0].el),0,null),i=1;i<n.cs;++i){e(n.c[i]);var a=c(n.c[i].er);o(n,i,t),t=l(a,i,t)}!function(e){e.prelim=(e.c[0].prelim+e.c[0].mod+e.c[e.cs-1].mod+e.c[e.cs-1].prelim+e.c[e.cs-1].w)/2-e.w/2}(n),r(n)}else r(n)}(s),function e(n,t){t+=n.mod,n.x=n.prelim+t,function(e){for(var n=0,t=0,r=0;r<e.cs;r++)t+=(n+=e.c[r].shift)+e.c[r].change,e.c[r].mod+=t}(n);for(var r=0;r<n.cs;r++)e(n.c[r],t)}(s,0),Ng(s,e,t),kg(e,t),e},Bg=zg,Dg=vg,Rg=function(e){var n,t;function r(){return e.apply(this,arguments)||this}return t=e,(n=r).prototype=Object.create(t.prototype),n.prototype.constructor=n,Tg(n,t),r.prototype.execute=function(){return Bg(this.rootNode,this.options,Lg)},r}(xg),Vg={},Hg=vg;function Yg(e,n){void 0===n&&(n=[]);var t=this;t.x=t.y=0,t.leftChild=t.rightChild=null,t.height=0,t.children=n}var Xg={isHorizontal:!0,nodeSep:20,nodeSize:20,rankSep:200,subTreeSep:10};function Zg(e,n,t){t?(n.x=e.x,n.y=e.y):(n.x=e.y,n.y=e.x),e.children.forEach((function(e,r){Zg(e,n.children[r],t)}))}function Fg(e,n){return Fg=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,n){return e.__proto__=n,e},Fg(e,n)}var Ug=function(e,n){void 0===n&&(n={}),n=Hg.assign({},Xg,n);var t,r=0,o=function e(n){if(!n)return null;n.width=0,n.depth&&n.depth>r&&(r=n.depth);var t=n.children,o=t.length,i=new Yg(n.height,[]);return t.forEach((function(n,t){var r=e(n);i.children.push(r),0===t&&(i.leftChild=r),t===o-1&&(i.rightChild=r)})),i.originNode=n,i.isLeaf=n.isLeaf(),i}(e);return function e(n){if(n.isLeaf||0===n.children.length)n.drawingDepth=r;else{var t=n.children.map((function(n){return e(n)})),o=Math.min.apply(null,t);n.drawingDepth=o-1}return n.drawingDepth}(o),function e(r){r.x=r.drawingDepth*n.rankSep,r.isLeaf?(r.y=0,t&&(r.y=t.y+t.height+n.nodeSep,r.originNode.parent!==t.originNode.parent&&(r.y+=n.subTreeSep)),t=r):(r.children.forEach((function(n){e(n)})),r.y=(r.leftChild.y+r.rightChild.y)/2)}(o),Zg(o,e,n.isHorizontal),e},Wg=zg,Gg=vg,qg=function(e){var n,t;function r(){return e.apply(this,arguments)||this}return t=e,(n=r).prototype=Object.create(t.prototype),n.prototype.constructor=n,Fg(n,t),r.prototype.execute=function(){var e=this;return e.rootNode.width=0,Wg(e.rootNode,e.options,Ug)},r}(xg),$g={},Kg=vg;function Qg(e,n){return Qg=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,n){return e.__proto__=n,e},Qg(e,n)}var Jg=xg,ey=function(e,n,t,r){var o=null;e.eachNode((function(e){!function(e,n,t,r,o){var i="function"==typeof t?t(e):t*e.depth;if(!r)try{if(e.id===e.parent.children[0].id)return e.x+=i,void(e.y=n?n.y:0)}catch(e){}if(e.x+=i,n){if(e.y=n.y+Kg.getHeight(n,e,o),n.parent&&e.parent.id!==n.parent.id){var a=n.parent,u=a.y+Kg.getHeight(a,e,o);e.y=u>e.y?u:e.y}}else e.y=0}(e,o,n,t,r),o=e}))},ny=Og,ty=vg,ry=["LR","RL","H"],oy=ry[0],iy=function(e){var n,t;function r(){return e.apply(this,arguments)||this}return t=e,(n=r).prototype=Object.create(t.prototype),n.prototype.constructor=n,Qg(n,t),r.prototype.execute=function(){var e=this.options,n=this.rootNode;e.isHorizontal=!0;var t=e.indent,r=void 0===t?20:t,o=e.dropCap,i=void 0===o||o,a=e.direction,u=void 0===a?oy:a,c=e.align;if(u&&-1===ry.indexOf(u))throw new TypeError("Invalid direction: "+u);if(u===ry[0])ey(n,r,i,c);else if(u===ry[1])ey(n,r,i,c),n.right2left();else if(u===ry[2]){var l=ny(n,e),s=l.left,d=l.right;ey(s,r,i,c),s.right2left(),ey(d,r,i,c);var f=s.getBoundingBox();d.translate(f.width,0),n.x=d.x-n.width/2}return n},r}(Jg),ay={},uy=vg;function cy(e,n){var t=0;return e.children.length?e.children.forEach((function(e){t+=cy(e,n)})):t=e.height,e._subTreeSep=n.getSubTreeSep(e.data),e.totalHeight=Math.max(e.height,t)+2*e._subTreeSep,e.totalHeight}function ly(e){var n=e.children,t=n.length;if(t){n.forEach((function(e){ly(e)}));var r=n[0],o=n[t-1],i=o.y-r.y+o.height,a=0;if(n.forEach((function(e){a+=e.totalHeight})),i>e.height)e.y=r.y+i/2-e.height/2;else if(1!==n.length||e.height>a){var u=e.y+(e.height-i)/2-r.y;n.forEach((function(e){e.translate(0,u)}))}else e.y=(r.y+r.height/2+o.y+o.height/2)/2-e.height/2}}var sy={getSubTreeSep:function(){return 0}};function dy(e,n){return dy=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,n){return e.__proto__=n,e},dy(e,n)}var fy=function(e,n){void 0===n&&(n={}),n=uy.assign({},sy,n),e.parent={x:0,width:0,height:0,y:0},e.BFTraverse((function(e){e.x=e.parent.x+e.parent.width})),e.parent=null,cy(e,n),e.startY=0,e.y=e.totalHeight/2-e.height/2,e.eachNode((function(e){var n=e.children,t=n.length;if(t){var r=n[0];if(r.startY=e.startY+e._subTreeSep,1===t)r.y=e.y+e.height/2-r.height/2;else{r.y=r.startY+r.totalHeight/2-r.height/2;for(var o=1;o<t;o++){var i=n[o];i.startY=n[o-1].startY+n[o-1].totalHeight,i.y=i.startY+i.totalHeight/2-i.height/2}}}})),ly(e)},hy=zg,vy=vg,py=function(e){var n,t;function r(){return e.apply(this,arguments)||this}return t=e,(n=r).prototype=Object.create(t.prototype),n.prototype.constructor=n,dy(n,t),r.prototype.execute=function(){return hy(this.rootNode,this.options,fy)},r}(xg),gy={};$n({compactBox:function(e,n){return n=Dg.assign({},Vg,n),new Rg(e,n).execute()},dendrogram:function(e,n){return n=Gg.assign({},$g,n),new qg(e,n).execute()},indented:function(e,n){return n=ty.assign({},ay,n),new iy(e,n).execute()},mindmap:function(e,n){return n=vy.assign({},gy,n),new py(e,n).execute()}});var yy={value:()=>{}};function my(){for(var e,n=0,t=arguments.length,r={};n<t;++n){if(!(e=arguments[n]+"")||e in r||/[\s.]/.test(e))throw new Error("illegal type: "+e);r[e]=[]}return new wy(r)}function wy(e){this._=e}function by(e,n){for(var t,r=0,o=e.length;r<o;++r)if((t=e[r]).name===n)return t.value}function xy(e,n,t){for(var r=0,o=e.length;r<o;++r)if(e[r].name===n){e[r]=yy,e=e.slice(0,r).concat(e.slice(r+1));break}return null!=t&&e.push({name:n,value:t}),e}wy.prototype=my.prototype={constructor:wy,on:function(e,n){var t,r,o=this._,i=(r=o,(e+"").trim().split(/^|\s+/).map((function(e){var n="",t=e.indexOf(".");if(t>=0&&(n=e.slice(t+1),e=e.slice(0,t)),e&&!r.hasOwnProperty(e))throw new Error("unknown type: "+e);return{type:e,name:n}}))),a=-1,u=i.length;if(!(arguments.length<2)){if(null!=n&&"function"!=typeof n)throw new Error("invalid callback: "+n);for(;++a<u;)if(t=(e=i[a]).type)o[t]=xy(o[t],e.name,n);else if(null==n)for(t in o)o[t]=xy(o[t],e.name,null);return this}for(;++a<u;)if((t=(e=i[a]).type)&&(t=by(o[t],e.name)))return t},copy:function(){var e={},n=this._;for(var t in n)e[t]=n[t].slice();return new wy(e)},call:function(e,n){if((t=arguments.length-2)>0)for(var t,r,o=new Array(t),i=0;i<t;++i)o[i]=arguments[i+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=0,t=(r=this._[e]).length;i<t;++i)r[i].value.apply(n,o)},apply:function(e,n,t){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],o=0,i=r.length;o<i;++o)r[o].value.apply(n,t)}};var _y="http://www.w3.org/1999/xhtml",Ey={svg:"http://www.w3.org/2000/svg",xhtml:_y,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Sy(e){var n=e+="",t=n.indexOf(":");return t>=0&&"xmlns"!==(n=e.slice(0,t))&&(e=e.slice(t+1)),Ey.hasOwnProperty(n)?{space:Ey[n],local:e}:e}function ky(e){return function(){var n=this.ownerDocument,t=this.namespaceURI;return t===_y&&n.documentElement.namespaceURI===_y?n.createElement(e):n.createElementNS(t,e)}}function Ny(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Cy(e){var n=Sy(e);return(n.local?Ny:ky)(n)}function My(){}function Oy(e){return null==e?My:function(){return this.querySelector(e)}}function jy(){return[]}function Py(e){return null==e?jy:function(){return this.querySelectorAll(e)}}function Iy(e){return function(){return this.matches(e)}}function Ay(e){return function(n){return n.matches(e)}}var zy=Array.prototype.find;function Ty(){return this.firstElementChild}var Ly=Array.prototype.filter;function By(){return Array.from(this.children)}function Dy(e){return new Array(e.length)}function Ry(e,n){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=n}function Vy(e,n,t,r,o,i){for(var a,u=0,c=n.length,l=i.length;u<l;++u)(a=n[u])?(a.__data__=i[u],r[u]=a):t[u]=new Ry(e,i[u]);for(;u<c;++u)(a=n[u])&&(o[u]=a)}function Hy(e,n,t,r,o,i,a){var u,c,l,s=new Map,d=n.length,f=i.length,h=new Array(d);for(u=0;u<d;++u)(c=n[u])&&(h[u]=l=a.call(c,c.__data__,u,n)+"",s.has(l)?o[u]=c:s.set(l,c));for(u=0;u<f;++u)l=a.call(e,i[u],u,i)+"",(c=s.get(l))?(r[u]=c,c.__data__=i[u],s.delete(l)):t[u]=new Ry(e,i[u]);for(u=0;u<d;++u)(c=n[u])&&s.get(h[u])===c&&(o[u]=c)}function Yy(e){return e.__data__}function Xy(e){return"object"==typeof e&&"length"in e?e:Array.from(e)}function Zy(e,n){return e<n?-1:e>n?1:e>=n?0:NaN}function Fy(e){return function(){this.removeAttribute(e)}}function Uy(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Wy(e,n){return function(){this.setAttribute(e,n)}}function Gy(e,n){return function(){this.setAttributeNS(e.space,e.local,n)}}function qy(e,n){return function(){var t=n.apply(this,arguments);null==t?this.removeAttribute(e):this.setAttribute(e,t)}}function $y(e,n){return function(){var t=n.apply(this,arguments);null==t?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,t)}}function Ky(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Qy(e){return function(){this.style.removeProperty(e)}}function Jy(e,n,t){return function(){this.style.setProperty(e,n,t)}}function em(e,n,t){return function(){var r=n.apply(this,arguments);null==r?this.style.removeProperty(e):this.style.setProperty(e,r,t)}}function nm(e,n){return e.style.getPropertyValue(n)||Ky(e).getComputedStyle(e,null).getPropertyValue(n)}function tm(e){return function(){delete this[e]}}function rm(e,n){return function(){this[e]=n}}function om(e,n){return function(){var t=n.apply(this,arguments);null==t?delete this[e]:this[e]=t}}function im(e){return e.trim().split(/^|\s+/)}function am(e){return e.classList||new um(e)}function um(e){this._node=e,this._names=im(e.getAttribute("class")||"")}function cm(e,n){for(var t=am(e),r=-1,o=n.length;++r<o;)t.add(n[r])}function lm(e,n){for(var t=am(e),r=-1,o=n.length;++r<o;)t.remove(n[r])}function sm(e){return function(){cm(this,e)}}function dm(e){return function(){lm(this,e)}}function fm(e,n){return function(){(n.apply(this,arguments)?cm:lm)(this,e)}}function hm(){this.textContent=""}function vm(e){return function(){this.textContent=e}}function pm(e){return function(){var n=e.apply(this,arguments);this.textContent=null==n?"":n}}function gm(){this.innerHTML=""}function ym(e){return function(){this.innerHTML=e}}function mm(e){return function(){var n=e.apply(this,arguments);this.innerHTML=null==n?"":n}}function wm(){this.nextSibling&&this.parentNode.appendChild(this)}function bm(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function xm(){return null}function _m(){var e=this.parentNode;e&&e.removeChild(this)}function Em(){var e=this.cloneNode(!1),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function Sm(){var e=this.cloneNode(!0),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function km(e){return function(){var n=this.__on;if(n){for(var t,r=0,o=-1,i=n.length;r<i;++r)t=n[r],e.type&&t.type!==e.type||t.name!==e.name?n[++o]=t:this.removeEventListener(t.type,t.listener,t.options);++o?n.length=o:delete this.__on}}}function Nm(e,n,t){return function(){var r,o=this.__on,i=function(e){return function(n){e.call(this,n,this.__data__)}}(n);if(o)for(var a=0,u=o.length;a<u;++a)if((r=o[a]).type===e.type&&r.name===e.name)return this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=i,r.options=t),void(r.value=n);this.addEventListener(e.type,i,t),r={type:e.type,name:e.name,value:n,listener:i,options:t},o?o.push(r):this.__on=[r]}}function Cm(e,n,t){var r=Ky(e),o=r.CustomEvent;"function"==typeof o?o=new o(n,t):(o=r.document.createEvent("Event"),t?(o.initEvent(n,t.bubbles,t.cancelable),o.detail=t.detail):o.initEvent(n,!1,!1)),e.dispatchEvent(o)}function Mm(e,n){return function(){return Cm(this,e,n)}}function Om(e,n){return function(){return Cm(this,e,n.apply(this,arguments))}}Ry.prototype={constructor:Ry,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,n){return this._parent.insertBefore(e,n)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}},um.prototype={add:function(e){this._names.indexOf(e)<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var n=this._names.indexOf(e);n>=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};var jm=[null];function Pm(e,n){this._groups=e,this._parents=n}function Im(){return new Pm([[document.documentElement]],jm)}function Am(e){return"string"==typeof e?new Pm([[document.querySelector(e)]],[document.documentElement]):new Pm([[e]],jm)}function zm(e,n){if(e=function(e){let n;for(;n=e.sourceEvent;)e=n;return e}(e),void 0===n&&(n=e.currentTarget),n){var t=n.ownerSVGElement||n;if(t.createSVGPoint){var r=t.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,[(r=r.matrixTransform(n.getScreenCTM().inverse())).x,r.y]}if(n.getBoundingClientRect){var o=n.getBoundingClientRect();return[e.clientX-o.left-n.clientLeft,e.clientY-o.top-n.clientTop]}}return[e.pageX,e.pageY]}Pm.prototype=Im.prototype={constructor:Pm,select:function(e){"function"!=typeof e&&(e=Oy(e));for(var n=this._groups,t=n.length,r=new Array(t),o=0;o<t;++o)for(var i,a,u=n[o],c=u.length,l=r[o]=new Array(c),s=0;s<c;++s)(i=u[s])&&(a=e.call(i,i.__data__,s,u))&&("__data__"in i&&(a.__data__=i.__data__),l[s]=a);return new Pm(r,this._parents)},selectAll:function(e){e="function"==typeof e?function(e){return function(){return null==(n=e.apply(this,arguments))?[]:Array.isArray(n)?n:Array.from(n);var n}}(e):Py(e);for(var n=this._groups,t=n.length,r=[],o=[],i=0;i<t;++i)for(var a,u=n[i],c=u.length,l=0;l<c;++l)(a=u[l])&&(r.push(e.call(a,a.__data__,l,u)),o.push(a));return new Pm(r,o)},selectChild:function(e){return this.select(null==e?Ty:function(e){return function(){return zy.call(this.children,e)}}("function"==typeof e?e:Ay(e)))},selectChildren:function(e){return this.selectAll(null==e?By:function(e){return function(){return Ly.call(this.children,e)}}("function"==typeof e?e:Ay(e)))},filter:function(e){"function"!=typeof e&&(e=Iy(e));for(var n=this._groups,t=n.length,r=new Array(t),o=0;o<t;++o)for(var i,a=n[o],u=a.length,c=r[o]=[],l=0;l<u;++l)(i=a[l])&&e.call(i,i.__data__,l,a)&&c.push(i);return new Pm(r,this._parents)},data:function(e,n){if(!arguments.length)return Array.from(this,Yy);var t,r=n?Hy:Vy,o=this._parents,i=this._groups;"function"!=typeof e&&(t=e,e=function(){return t});for(var a=i.length,u=new Array(a),c=new Array(a),l=new Array(a),s=0;s<a;++s){var d=o[s],f=i[s],h=f.length,v=Xy(e.call(d,d&&d.__data__,s,o)),p=v.length,g=c[s]=new Array(p),y=u[s]=new Array(p);r(d,f,g,y,l[s]=new Array(h),v,n);for(var m,w,b=0,x=0;b<p;++b)if(m=g[b]){for(b>=x&&(x=b+1);!(w=y[x])&&++x<p;);m._next=w||null}}return(u=new Pm(u,o))._enter=c,u._exit=l,u},enter:function(){return new Pm(this._enter||this._groups.map(Dy),this._parents)},exit:function(){return new Pm(this._exit||this._groups.map(Dy),this._parents)},join:function(e,n,t){var r=this.enter(),o=this,i=this.exit();return"function"==typeof e?(r=e(r))&&(r=r.selection()):r=r.append(e+""),null!=n&&(o=n(o))&&(o=o.selection()),null==t?i.remove():t(i),r&&o?r.merge(o).order():o},merge:function(e){for(var n=e.selection?e.selection():e,t=this._groups,r=n._groups,o=t.length,i=r.length,a=Math.min(o,i),u=new Array(o),c=0;c<a;++c)for(var l,s=t[c],d=r[c],f=s.length,h=u[c]=new Array(f),v=0;v<f;++v)(l=s[v]||d[v])&&(h[v]=l);for(;c<o;++c)u[c]=t[c];return new Pm(u,this._parents)},selection:function(){return this},order:function(){for(var e=this._groups,n=-1,t=e.length;++n<t;)for(var r,o=e[n],i=o.length-1,a=o[i];--i>=0;)(r=o[i])&&(a&&4^r.compareDocumentPosition(a)&&a.parentNode.insertBefore(r,a),a=r);return this},sort:function(e){function n(n,t){return n&&t?e(n.__data__,t.__data__):!n-!t}e||(e=Zy);for(var t=this._groups,r=t.length,o=new Array(r),i=0;i<r;++i){for(var a,u=t[i],c=u.length,l=o[i]=new Array(c),s=0;s<c;++s)(a=u[s])&&(l[s]=a);l.sort(n)}return new Pm(o,this._parents).order()},call:function(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this},nodes:function(){return Array.from(this)},node:function(){for(var e=this._groups,n=0,t=e.length;n<t;++n)for(var r=e[n],o=0,i=r.length;o<i;++o){var a=r[o];if(a)return a}return null},size:function(){let e=0;for(const n of this)++e;return e},empty:function(){return!this.node()},each:function(e){for(var n=this._groups,t=0,r=n.length;t<r;++t)for(var o,i=n[t],a=0,u=i.length;a<u;++a)(o=i[a])&&e.call(o,o.__data__,a,i);return this},attr:function(e,n){var t=Sy(e);if(arguments.length<2){var r=this.node();return t.local?r.getAttributeNS(t.space,t.local):r.getAttribute(t)}return this.each((null==n?t.local?Uy:Fy:"function"==typeof n?t.local?$y:qy:t.local?Gy:Wy)(t,n))},style:function(e,n,t){return arguments.length>1?this.each((null==n?Qy:"function"==typeof n?em:Jy)(e,n,null==t?"":t)):nm(this.node(),e)},property:function(e,n){return arguments.length>1?this.each((null==n?tm:"function"==typeof n?om:rm)(e,n)):this.node()[e]},classed:function(e,n){var t=im(e+"");if(arguments.length<2){for(var r=am(this.node()),o=-1,i=t.length;++o<i;)if(!r.contains(t[o]))return!1;return!0}return this.each(("function"==typeof n?fm:n?sm:dm)(t,n))},text:function(e){return arguments.length?this.each(null==e?hm:("function"==typeof e?pm:vm)(e)):this.node().textContent},html:function(e){return arguments.length?this.each(null==e?gm:("function"==typeof e?mm:ym)(e)):this.node().innerHTML},raise:function(){return this.each(wm)},lower:function(){return this.each(bm)},append:function(e){var n="function"==typeof e?e:Cy(e);return this.select((function(){return this.appendChild(n.apply(this,arguments))}))},insert:function(e,n){var t="function"==typeof e?e:Cy(e),r=null==n?xm:"function"==typeof n?n:Oy(n);return this.select((function(){return this.insertBefore(t.apply(this,arguments),r.apply(this,arguments)||null)}))},remove:function(){return this.each(_m)},clone:function(e){return this.select(e?Sm:Em)},datum:function(e){return arguments.length?this.property("__data__",e):this.node().__data__},on:function(e,n,t){var r,o,i=function(e){return e.trim().split(/^|\s+/).map((function(e){var n="",t=e.indexOf(".");return t>=0&&(n=e.slice(t+1),e=e.slice(0,t)),{type:e,name:n}}))}(e+""),a=i.length;if(!(arguments.length<2)){for(u=n?Nm:km,r=0;r<a;++r)this.each(u(i[r],n,t));return this}var u=this.node().__on;if(u)for(var c,l=0,s=u.length;l<s;++l)for(r=0,c=u[l];r<a;++r)if((o=i[r]).type===c.type&&o.name===c.name)return c.value},dispatch:function(e,n){return this.each(("function"==typeof n?Om:Mm)(e,n))},[Symbol.iterator]:function*(){for(var e=this._groups,n=0,t=e.length;n<t;++n)for(var r,o=e[n],i=0,a=o.length;i<a;++i)(r=o[i])&&(yield r)}};const Tm={passive:!1},Lm={capture:!0,passive:!1};function Bm(e){e.stopImmediatePropagation()}function Dm(e){e.preventDefault(),e.stopImmediatePropagation()}function Rm(e){var n=e.document.documentElement,t=Am(e).on("dragstart.drag",Dm,Lm);"onselectstart"in n?t.on("selectstart.drag",Dm,Lm):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")}function Vm(e,n){var t=e.document.documentElement,r=Am(e).on("dragstart.drag",null);n&&(r.on("click.drag",Dm,Lm),setTimeout((function(){r.on("click.drag",null)}),0)),"onselectstart"in t?r.on("selectstart.drag",null):(t.style.MozUserSelect=t.__noselect,delete t.__noselect)}var Hm=e=>()=>e;function Ym(e,{sourceEvent:n,subject:t,target:r,identifier:o,active:i,x:a,y:u,dx:c,dy:l,dispatch:s}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},subject:{value:t,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:o,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:u,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:s}})}function Xm(e){return!e.ctrlKey&&!e.button}function Zm(){return this.parentNode}function Fm(e,n){return null==n?{x:e.x,y:e.y}:n}function Um(){return navigator.maxTouchPoints||"ontouchstart"in this}function Wm(e,n){if(!e.parentId)return!1;var t=n.get(e.parentId);return!!t&&(!!t.selected||Wm(t,n))}function Gm(e,n,t){var r=e;do{if(null==r?void 0:r.matches(n))return!0;if(r===t)return!1;r=r.parentElement}while(r);return!1}function qm(e){var n,t,r,o,i=e.nodeId,a=e.dragItems,u=e.nodeLookup,c=[];try{for(var l=F(a),s=l.next();!s.done;s=l.next()){var d=U(s.value,2),f=d[0],h=d[1],v=null===(r=u.get(f))||void 0===r?void 0:r.internals.userNode;v&&c.push(Z(Z({},v),{position:h.position}))}}catch(e){n={error:e}}finally{try{s&&!s.done&&(t=l.return)&&t.call(l)}finally{if(n)throw n.error}}if(!i)return[c[0],c];var p=u.get(i).internals.userNode;return[Z(Z({},p),{position:(null===(o=a.get(i))||void 0===o?void 0:o.position)||p.position}),c]}function $m(e){var n=e.onNodeMouseDown,t=e.getStoreItems,r=e.onDragStart,o=e.onDrag,i=e.onDragStop,a={x:null,y:null},u=0,c=new Map,l=!1,s={x:0,y:0},d=null,f=!1,h=null;return{update:function(e){var v=e.noDragClassName,p=e.handleSelector,g=e.domNode,y=e.isSelectable,m=e.nodeId;function w(e,n){var r,i,u=e.x,l=e.y,s=t(),d=s.nodeLookup,f=s.nodeExtent,h=s.snapGrid,v=s.snapToGrid,p=s.nodeOrigin,g=s.onNodeDrag,y=s.onSelectionDrag,w=s.onError,b=s.updateNodePositions;a={x:u,y:l};var x=!1,_={x:0,y:0,x2:0,y2:0};if(c.size>1&&f){var E=Nv(c,{nodeOrigin:p});_=zv(E)}try{for(var S=F(c),k=S.next();!k.done;k=S.next()){var N=U(k.value,2),C=N[0],M=N[1],O={x:u-M.distance.x,y:l-M.distance.y};v&&(O=Bv(O,h));var j=[[f[0][0],f[0][1]],[f[1][0],f[1][1]]];if(c.size>1&&f&&!M.extent){var P=M.internals.positionAbsolute,I=P.x-_.x+f[0][0],A=P.x+M.measured.width-_.x2+f[1][0];j=[[I,P.y-_.y+f[0][1]],[A,P.y+M.measured.height-_.y2+f[1][1]]]}var z=Mv({nodeId:C,nextPosition:O,nodeLookup:d,nodeExtent:j,nodeOrigin:p,onError:w}),T=z.position,L=z.positionAbsolute;x=x||M.position.x!==T.x||M.position.y!==T.y,M.position=T,M.internals.positionAbsolute=L}}catch(e){r={error:e}}finally{try{k&&!k.done&&(i=S.return)&&i.call(S)}finally{if(r)throw r.error}}if(x&&(b(c,!0),n&&(o||g||!m&&y))){var B=U(qm({nodeId:m,dragItems:c,nodeLookup:d}),2),D=B[0],R=B[1];null==o||o(n,c,D,R),null==g||g(n,D,R),m||null==y||y(n,R)}}function b(){var e,n;if(d){var r=U(Iv(s,d),2),o=r[0],i=r[1];if(0!==o||0!==i){var c=t(),l=c.transform,f=c.panBy;a.x=(null!==(e=a.x)&&void 0!==e?e:0)-o/l[2],a.y=(null!==(n=a.y)&&void 0!==n?n:0)-i/l[2],f({x:o,y:i})&&w(a,null)}u=requestAnimationFrame(b)}}function x(e){var o,i=t(),u=i.nodeLookup,l=i.multiSelectionActive,s=i.nodesDraggable,d=i.transform,h=i.snapGrid,v=i.snapToGrid,p=i.selectNodesOnDrag,g=i.onNodeDragStart,w=i.onSelectionDragStart,b=i.unselectNodesAndEdges;f=!0,p&&y||l||!m||(null===(o=u.get(m))||void 0===o?void 0:o.selected)||b(),y&&p&&m&&(null==n||n(m));var x=Fv(e.sourceEvent,{transform:d,snapGrid:h,snapToGrid:v});if(a=x,c=function(e,n,t,r){var o,i,a,u,c=new Map;try{for(var l=F(e),s=l.next();!s.done;s=l.next()){var d=U(s.value,2),f=d[0],h=d[1];if((h.selected||h.id===r)&&(!h.parentId||!Wm(h,e))&&(h.draggable||n&&void 0===h.draggable)){var v=e.get(f);v&&c.set(f,{id:f,position:v.position||{x:0,y:0},distance:{x:t.x-v.internals.positionAbsolute.x,y:t.y-v.internals.positionAbsolute.y},extent:v.extent,parentId:v.parentId,origin:v.origin,expandParent:v.expandParent,internals:{positionAbsolute:v.internals.positionAbsolute||{x:0,y:0}},measured:{width:null!==(a=v.measured.width)&&void 0!==a?a:0,height:null!==(u=v.measured.height)&&void 0!==u?u:0}})}}}catch(e){o={error:e}}finally{try{s&&!s.done&&(i=l.return)&&i.call(l)}finally{if(o)throw o.error}}return c}(u,s,x,m),c.size>0&&(r||g||!m&&w)){var _=U(qm({nodeId:m,dragItems:c,nodeLookup:u}),2),E=_[0],S=_[1];null==r||r(e.sourceEvent,c,E,S),null==g||g(e.sourceEvent,E,S),m||null==w||w(e.sourceEvent,S)}}h=Am(g);var _=function(){var e,n,t,r,o=Xm,i=Zm,a=Fm,u=Um,c={},l=my("start","drag","end"),s=0,d=0;function f(e){e.on("mousedown.drag",h).filter(u).on("touchstart.drag",g).on("touchmove.drag",y,Tm).on("touchend.drag touchcancel.drag",m).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(a,u){if(!r&&o.call(this,a,u)){var c=w(this,i.call(this,a,u),a,u,"mouse");c&&(Am(a.view).on("mousemove.drag",v,Lm).on("mouseup.drag",p,Lm),Rm(a.view),Bm(a),t=!1,e=a.clientX,n=a.clientY,c("start",a))}}function v(r){if(Dm(r),!t){var o=r.clientX-e,i=r.clientY-n;t=o*o+i*i>d}c.mouse("drag",r)}function p(e){Am(e.view).on("mousemove.drag mouseup.drag",null),Vm(e.view,t),Dm(e),c.mouse("end",e)}function g(e,n){if(o.call(this,e,n)){var t,r,a=e.changedTouches,u=i.call(this,e,n),c=a.length;for(t=0;t<c;++t)(r=w(this,u,e,n,a[t].identifier,a[t]))&&(Bm(e),r("start",e,a[t]))}}function y(e){var n,t,r=e.changedTouches,o=r.length;for(n=0;n<o;++n)(t=c[r[n].identifier])&&(Dm(e),t("drag",e,r[n]))}function m(e){var n,t,o=e.changedTouches,i=o.length;for(r&&clearTimeout(r),r=setTimeout((function(){r=null}),500),n=0;n<i;++n)(t=c[o[n].identifier])&&(Bm(e),t("end",e,o[n]))}function w(e,n,t,r,o,i){var u,d,h,v=l.copy(),p=zm(i||t,n);if(null!=(h=a.call(e,new Ym("beforestart",{sourceEvent:t,target:f,identifier:o,active:s,x:p[0],y:p[1],dx:0,dy:0,dispatch:v}),r)))return u=h.x-p[0]||0,d=h.y-p[1]||0,function t(i,a,l){var g,y=p;switch(i){case"start":c[o]=t,g=s++;break;case"end":delete c[o],--s;case"drag":p=zm(l||a,n),g=s}v.call(i,e,new Ym(i,{sourceEvent:a,subject:h,target:f,identifier:o,active:g,x:p[0]+u,y:p[1]+d,dx:p[0]-y[0],dy:p[1]-y[1],dispatch:v}),r)}}return f.filter=function(e){return arguments.length?(o="function"==typeof e?e:Hm(!!e),f):o},f.container=function(e){return arguments.length?(i="function"==typeof e?e:Hm(e),f):i},f.subject=function(e){return arguments.length?(a="function"==typeof e?e:Hm(e),f):a},f.touchable=function(e){return arguments.length?(u="function"==typeof e?e:Hm(!!e),f):u},f.on=function(){var e=l.on.apply(l,arguments);return e===l?f:e},f.clickDistance=function(e){return arguments.length?(d=(e=+e)*e,f):Math.sqrt(d)},f}().on("start",(function(e){var n=t(),r=n.domNode,o=n.nodeDragThreshold,i=n.transform,u=n.snapGrid,c=n.snapToGrid;0===o&&x(e);var l=Fv(e.sourceEvent,{transform:i,snapGrid:u,snapToGrid:c});a=l,d=(null==r?void 0:r.getBoundingClientRect())||null,s=Qv(e.sourceEvent,d)})).on("drag",(function(e){var n,r,o=t(),i=o.autoPanOnNodeDrag,u=o.transform,h=o.snapGrid,v=o.snapToGrid,p=o.nodeDragThreshold,g=Fv(e.sourceEvent,{transform:u,snapGrid:h,snapToGrid:v});if(!l&&i&&f&&(l=!0,b()),!f){var y=g.xSnapped-(null!==(n=a.x)&&void 0!==n?n:0),m=g.ySnapped-(null!==(r=a.y)&&void 0!==r?r:0);Math.sqrt(y*y+m*m)>p&&x(e)}(a.x!==g.xSnapped||a.y!==g.ySnapped)&&c&&f&&(s=Qv(e.sourceEvent,d),w(g,e.sourceEvent))})).on("end",(function(e){if(f&&(l=!1,f=!1,cancelAnimationFrame(u),c.size>0)){var n=t(),r=n.nodeLookup,o=n.updateNodePositions,a=n.onNodeDragStop,s=n.onSelectionDragStop;if(o(c,!1),i||a||!m&&s){var d=U(qm({nodeId:m,dragItems:c,nodeLookup:r}),2),h=d[0],v=d[1];null==i||i(e.sourceEvent,c,h,v),null==a||a(e.sourceEvent,h,v),m||null==s||s(e.sourceEvent,v)}}})).filter((function(e){var n=e.target;return!e.button&&(!v||!Gm(n,".".concat(v),g))&&(!p||Gm(n,p,g))}));h.call(_)},destroy:function(){null==h||h.on(".drag",null)}}}function Km(e,n,t,r){return(n[t]||[]).reduce((function(n,o){return"".concat(e.id,"-").concat(o.id,"-").concat(t)!==r&&n.push({id:o.id||null,type:t,nodeId:e.id,x:e.internals.positionAbsolute.x+o.x+o.width/2,y:e.internals.positionAbsolute.y+o.y+o.height/2}),n}),[])}function Qm(e,n){return e||((null==n?void 0:n.classList.contains("target"))?"target":(null==n?void 0:n.classList.contains("source"))?"source":null)}Ym.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};var Jm=function(){return!0},ew=null;function nw(e,n){var t=n.handle,r=n.connectionMode,o=n.fromNodeId,i=n.fromHandleId,a=n.fromType,u=n.doc,c=n.lib,l=n.flowId,s=n.isValidConnection,d=void 0===s?Jm:s,f="target"===a,h=t?u.querySelector(".".concat(c,'-flow__handle[data-id="').concat(l,"-").concat(null==t?void 0:t.nodeId,"-").concat(null==t?void 0:t.id,"-").concat(null==t?void 0:t.type,'"]')):null,v=Qv(e),p=v.x,g=v.y,y=u.elementFromPoint(p,g),m=(null==y?void 0:y.classList.contains("".concat(c,"-flow__handle")))?y:h,w={handleDomNode:m,isValid:!1,connection:null,endHandle:null};if(m){var b=Qm(void 0,m),x=m.getAttribute("data-nodeid"),_=m.getAttribute("data-handleid"),E=m.classList.contains("connectable"),S=m.classList.contains("connectableend");if(!x)return w;var k={source:f?x:o,sourceHandle:f?_:i,target:f?o:x,targetHandle:f?i:_};w.connection=k,E&&S&&(r===Uv.Strict?f&&"source"===b||!f&&"target"===b:x!==o||_!==i)&&(w.endHandle={nodeId:x,handleId:_,type:b},w.isValid=d(k))}return w}var tw={onPointerDown:function(e,n){var t,r=n.connectionMode,o=n.connectionRadius,i=n.handleId,a=n.nodeId,u=n.edgeUpdaterType,c=n.isTarget,l=n.domNode,s=n.nodeLookup,d=n.lib,f=n.autoPanOnConnect,h=n.flowId,v=n.panBy,p=n.cancelConnection,g=n.onConnectStart,y=n.onConnect,m=n.onConnectEnd,w=n.isValidConnection,b=void 0===w?Jm:w,x=n.onEdgeUpdateEnd,_=n.updateConnection,E=n.getTransform,S=n.getConnectionStartHandle,k=function(e){var n;return(null===(n=e.getRootNode)||void 0===n?void 0:n.call(e))||(null===window||void 0===window?void 0:window.document)}(e.target),N=0,C=Qv(e),M=C.x,O=C.y,j=null==k?void 0:k.elementFromPoint(M,O),P=Qm(u,j),I=null==l?void 0:l.getBoundingClientRect();if(I&&P){var A=Qv(e,I),z=!1,T=null,L=!1,B=null,D=function(e){var n,t,r=e.nodeLookup,o=e.nodeId,i=e.handleId,a=e.handleType,u=[];try{for(var c=F(r),l=c.next();!l.done;l=c.next()){var s=U(l.value,2)[1];if(s.internals.handleBounds){var d="".concat(o,"-").concat(i,"-").concat(a),f=Km(s,s.internals.handleBounds,"source",d),h=Km(s,s.internals.handleBounds,"target",d);u.push.apply(u,W(W([],U(f),!1),U(h),!1))}}}catch(e){n={error:e}}finally{try{l&&!l.done&&(t=c.return)&&t.call(c)}finally{if(n)throw n.error}}return u}({nodeLookup:s,nodeId:a,handleId:i,handleType:P});_({connectionPosition:A,connectionStatus:null,connectionStartHandle:ew={nodeId:a,handleId:i,type:P},connectionEndHandle:null}),null==g||g(e,{nodeId:a,handleId:i,handleType:P}),k.addEventListener("mousemove",V),k.addEventListener("mouseup",H),k.addEventListener("touchmove",V),k.addEventListener("touchend",H)}function R(){if(f&&I){var e=U(Iv(A,I),2),n=e[0],t=e[1];v({x:n,y:t}),N=requestAnimationFrame(R)}}function V(e){S()||H(e);var n=E();A=Qv(e,I),t=function(e,n,t){var r,o,i=[],a=1/0;try{for(var u=F(t),c=u.next();!c.done;c=u.next()){var l=c.value,s=Math.sqrt(Math.pow(l.x-e.x,2)+Math.pow(l.y-e.y,2));s<=n&&(s<a?i=[l]:s===a&&i.push(l),a=s)}}catch(e){r={error:e}}finally{try{c&&!c.done&&(o=u.return)&&o.call(u)}finally{if(r)throw r.error}}return i.length?1===i.length?i[0]:i.find((function(e){return"target"===e.type}))||i[0]:null}(Dv(A,n,!1,[1,1]),o,D),z||(R(),z=!0);var u,l,s,f=nw(e,{handle:t,connectionMode:r,fromNodeId:a,fromHandleId:i,fromType:c?"target":"source",isValidConnection:b,doc:k,lib:d,flowId:h});B=f.handleDomNode,T=f.connection,L=f.isValid,_({connectionStartHandle:ew,connectionPosition:t&&L?Rv({x:t.x,y:t.y},n):A,connectionStatus:(u=!!t,l=L,s=null,l?s="valid":u&&!l&&(s="invalid"),s),connectionEndHandle:f.endHandle})}function H(e){(t||B)&&T&&L&&(null==y||y(T)),null==m||m(e),u&&(null==x||x(e)),p(),cancelAnimationFrame(N),z=!1,L=!1,T=null,B=null,ew=null,k.removeEventListener("mousemove",V),k.removeEventListener("mouseup",H),k.removeEventListener("touchmove",V),k.removeEventListener("touchend",H)}},isValid:nw};function rw(e,n,t){e.prototype=n.prototype=t,t.constructor=e}function ow(e,n){var t=Object.create(e.prototype);for(var r in n)t[r]=n[r];return t}function iw(){}var aw=.7,uw=1/aw,cw="\\s*([+-]?\\d+)\\s*",lw="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",sw="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",dw=/^#([0-9a-f]{3,8})$/,fw=new RegExp(`^rgb\\(${cw},${cw},${cw}\\)$`),hw=new RegExp(`^rgb\\(${sw},${sw},${sw}\\)$`),vw=new RegExp(`^rgba\\(${cw},${cw},${cw},${lw}\\)$`),pw=new RegExp(`^rgba\\(${sw},${sw},${sw},${lw}\\)$`),gw=new RegExp(`^hsl\\(${lw},${sw},${sw}\\)$`),yw=new RegExp(`^hsla\\(${lw},${sw},${sw},${lw}\\)$`),mw={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function ww(){return this.rgb().formatHex()}function bw(){return this.rgb().formatRgb()}function xw(e){var n,t;return e=(e+"").trim().toLowerCase(),(n=dw.exec(e))?(t=n[1].length,n=parseInt(n[1],16),6===t?_w(n):3===t?new kw(n>>8&15|n>>4&240,n>>4&15|240&n,(15&n)<<4|15&n,1):8===t?Ew(n>>24&255,n>>16&255,n>>8&255,(255&n)/255):4===t?Ew(n>>12&15|n>>8&240,n>>8&15|n>>4&240,n>>4&15|240&n,((15&n)<<4|15&n)/255):null):(n=fw.exec(e))?new kw(n[1],n[2],n[3],1):(n=hw.exec(e))?new kw(255*n[1]/100,255*n[2]/100,255*n[3]/100,1):(n=vw.exec(e))?Ew(n[1],n[2],n[3],n[4]):(n=pw.exec(e))?Ew(255*n[1]/100,255*n[2]/100,255*n[3]/100,n[4]):(n=gw.exec(e))?Pw(n[1],n[2]/100,n[3]/100,1):(n=yw.exec(e))?Pw(n[1],n[2]/100,n[3]/100,n[4]):mw.hasOwnProperty(e)?_w(mw[e]):"transparent"===e?new kw(NaN,NaN,NaN,0):null}function _w(e){return new kw(e>>16&255,e>>8&255,255&e,1)}function Ew(e,n,t,r){return r<=0&&(e=n=t=NaN),new kw(e,n,t,r)}function Sw(e,n,t,r){return 1===arguments.length?((o=e)instanceof iw||(o=xw(o)),o?new kw((o=o.rgb()).r,o.g,o.b,o.opacity):new kw):new kw(e,n,t,null==r?1:r);var o}function kw(e,n,t,r){this.r=+e,this.g=+n,this.b=+t,this.opacity=+r}function Nw(){return`#${jw(this.r)}${jw(this.g)}${jw(this.b)}`}function Cw(){const e=Mw(this.opacity);return`${1===e?"rgb(":"rgba("}${Ow(this.r)}, ${Ow(this.g)}, ${Ow(this.b)}${1===e?")":`, ${e})`}`}function Mw(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Ow(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function jw(e){return((e=Ow(e))<16?"0":"")+e.toString(16)}function Pw(e,n,t,r){return r<=0?e=n=t=NaN:t<=0||t>=1?e=n=NaN:n<=0&&(e=NaN),new Aw(e,n,t,r)}function Iw(e){if(e instanceof Aw)return new Aw(e.h,e.s,e.l,e.opacity);if(e instanceof iw||(e=xw(e)),!e)return new Aw;if(e instanceof Aw)return e;var n=(e=e.rgb()).r/255,t=e.g/255,r=e.b/255,o=Math.min(n,t,r),i=Math.max(n,t,r),a=NaN,u=i-o,c=(i+o)/2;return u?(a=n===i?(t-r)/u+6*(t<r):t===i?(r-n)/u+2:(n-t)/u+4,u/=c<.5?i+o:2-i-o,a*=60):u=c>0&&c<1?0:a,new Aw(a,u,c,e.opacity)}function Aw(e,n,t,r){this.h=+e,this.s=+n,this.l=+t,this.opacity=+r}function zw(e){return(e=(e||0)%360)<0?e+360:e}function Tw(e){return Math.max(0,Math.min(1,e||0))}function Lw(e,n,t){return 255*(e<60?n+(t-n)*e/60:e<180?t:e<240?n+(t-n)*(240-e)/60:n)}rw(iw,xw,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:ww,formatHex:ww,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return Iw(this).formatHsl()},formatRgb:bw,toString:bw}),rw(kw,Sw,ow(iw,{brighter(e){return e=null==e?uw:Math.pow(uw,e),new kw(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=null==e?aw:Math.pow(aw,e),new kw(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new kw(Ow(this.r),Ow(this.g),Ow(this.b),Mw(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Nw,formatHex:Nw,formatHex8:function(){return`#${jw(this.r)}${jw(this.g)}${jw(this.b)}${jw(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:Cw,toString:Cw})),rw(Aw,(function(e,n,t,r){return 1===arguments.length?Iw(e):new Aw(e,n,t,null==r?1:r)}),ow(iw,{brighter(e){return e=null==e?uw:Math.pow(uw,e),new Aw(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=null==e?aw:Math.pow(aw,e),new Aw(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+360*(this.h<0),n=isNaN(e)||isNaN(this.s)?0:this.s,t=this.l,r=t+(t<.5?t:1-t)*n,o=2*t-r;return new kw(Lw(e>=240?e-240:e+120,o,r),Lw(e,o,r),Lw(e<120?e+240:e-120,o,r),this.opacity)},clamp(){return new Aw(zw(this.h),Tw(this.s),Tw(this.l),Mw(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Mw(this.opacity);return`${1===e?"hsl(":"hsla("}${zw(this.h)}, ${100*Tw(this.s)}%, ${100*Tw(this.l)}%${1===e?")":`, ${e})`}`}}));var Bw=e=>()=>e;function Dw(e,n){var t=n-e;return t?function(e,n){return function(t){return e+t*n}}(e,t):Bw(isNaN(e)?n:e)}var Rw=function e(n){var t=function(e){return 1==(e=+e)?Dw:function(n,t){return t-n?function(e,n,t){return e=Math.pow(e,t),n=Math.pow(n,t)-e,t=1/t,function(r){return Math.pow(e+r*n,t)}}(n,t,e):Bw(isNaN(n)?t:n)}}(n);function r(e,n){var r=t((e=Sw(e)).r,(n=Sw(n)).r),o=t(e.g,n.g),i=t(e.b,n.b),a=Dw(e.opacity,n.opacity);return function(n){return e.r=r(n),e.g=o(n),e.b=i(n),e.opacity=a(n),e+""}}return r.gamma=e,r}(1);function Vw(e,n){return e=+e,n=+n,function(t){return e*(1-t)+n*t}}var Hw=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Yw=new RegExp(Hw.source,"g");function Xw(e,n){var t,r,o,i=Hw.lastIndex=Yw.lastIndex=0,a=-1,u=[],c=[];for(e+="",n+="";(t=Hw.exec(e))&&(r=Yw.exec(n));)(o=r.index)>i&&(o=n.slice(i,o),u[a]?u[a]+=o:u[++a]=o),(t=t[0])===(r=r[0])?u[a]?u[a]+=r:u[++a]=r:(u[++a]=null,c.push({i:a,x:Vw(t,r)})),i=Yw.lastIndex;return i<n.length&&(o=n.slice(i),u[a]?u[a]+=o:u[++a]=o),u.length<2?c[0]?function(e){return function(n){return e(n)+""}}(c[0].x):function(e){return function(){return e}}(n):(n=c.length,function(e){for(var t,r=0;r<n;++r)u[(t=c[r]).i]=t.x(e);return u.join("")})}var Zw,Fw=180/Math.PI,Uw={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Ww(e,n,t,r,o,i){var a,u,c;return(a=Math.sqrt(e*e+n*n))&&(e/=a,n/=a),(c=e*t+n*r)&&(t-=e*c,r-=n*c),(u=Math.sqrt(t*t+r*r))&&(t/=u,r/=u,c/=u),e*r<n*t&&(e=-e,n=-n,c=-c,a=-a),{translateX:o,translateY:i,rotate:Math.atan2(n,e)*Fw,skewX:Math.atan(c)*Fw,scaleX:a,scaleY:u}}function Gw(e,n,t,r){function o(e){return e.length?e.pop()+" ":""}return function(i,a){var u=[],c=[];return i=e(i),a=e(a),function(e,r,o,i,a,u){if(e!==o||r!==i){var c=a.push("translate(",null,n,null,t);u.push({i:c-4,x:Vw(e,o)},{i:c-2,x:Vw(r,i)})}else(o||i)&&a.push("translate("+o+n+i+t)}(i.translateX,i.translateY,a.translateX,a.translateY,u,c),function(e,n,t,i){e!==n?(e-n>180?n+=360:n-e>180&&(e+=360),i.push({i:t.push(o(t)+"rotate(",null,r)-2,x:Vw(e,n)})):n&&t.push(o(t)+"rotate("+n+r)}(i.rotate,a.rotate,u,c),function(e,n,t,i){e!==n?i.push({i:t.push(o(t)+"skewX(",null,r)-2,x:Vw(e,n)}):n&&t.push(o(t)+"skewX("+n+r)}(i.skewX,a.skewX,u,c),function(e,n,t,r,i,a){if(e!==t||n!==r){var u=i.push(o(i)+"scale(",null,",",null,")");a.push({i:u-4,x:Vw(e,t)},{i:u-2,x:Vw(n,r)})}else 1===t&&1===r||i.push(o(i)+"scale("+t+","+r+")")}(i.scaleX,i.scaleY,a.scaleX,a.scaleY,u,c),i=a=null,function(e){for(var n,t=-1,r=c.length;++t<r;)u[(n=c[t]).i]=n.x(e);return u.join("")}}}var qw=Gw((function(e){const n=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(e+"");return n.isIdentity?Uw:Ww(n.a,n.b,n.c,n.d,n.e,n.f)}),"px, ","px)","deg)"),$w=Gw((function(e){return null==e?Uw:(Zw||(Zw=document.createElementNS("http://www.w3.org/2000/svg","g")),Zw.setAttribute("transform",e),(e=Zw.transform.baseVal.consolidate())?Ww((e=e.matrix).a,e.b,e.c,e.d,e.e,e.f):Uw)}),", ",")",")");function Kw(e){return((e=Math.exp(e))+1/e)/2}var Qw,Jw,eb=function e(n,t,r){function o(e,o){var i,a,u=e[0],c=e[1],l=e[2],s=o[0],d=o[1],f=o[2],h=s-u,v=d-c,p=h*h+v*v;if(p<1e-12)a=Math.log(f/l)/n,i=function(e){return[u+e*h,c+e*v,l*Math.exp(n*e*a)]};else{var g=Math.sqrt(p),y=(f*f-l*l+r*p)/(2*l*t*g),m=(f*f-l*l-r*p)/(2*f*t*g),w=Math.log(Math.sqrt(y*y+1)-y),b=Math.log(Math.sqrt(m*m+1)-m);a=(b-w)/n,i=function(e){var r,o=e*a,i=Kw(w),s=l/(t*g)*(i*(r=n*o+w,((r=Math.exp(2*r))-1)/(r+1))-function(e){return((e=Math.exp(e))-1/e)/2}(w));return[u+s*h,c+s*v,l*i/Kw(n*o+w)]}}return i.duration=1e3*a*n/Math.SQRT2,i}return o.rho=function(n){var t=Math.max(.001,+n),r=t*t;return e(t,r,r*r)},o}(Math.SQRT2,2,4),nb=0,tb=0,rb=0,ob=1e3,ib=0,ab=0,ub=0,cb="object"==typeof performance&&performance.now?performance:Date,lb="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function sb(){return ab||(lb(db),ab=cb.now()+ub)}function db(){ab=0}function fb(){this._call=this._time=this._next=null}function hb(e,n,t){var r=new fb;return r.restart(e,n,t),r}function vb(){ab=(ib=cb.now())+ub,nb=tb=0;try{!function(){sb(),++nb;for(var e,n=Qw;n;)(e=ab-n._time)>=0&&n._call.call(void 0,e),n=n._next;--nb}()}finally{nb=0,function(){for(var e,n,t=Qw,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:Qw=n);Jw=e,gb(r)}(),ab=0}}function pb(){var e=cb.now(),n=e-ib;n>ob&&(ub-=n,ib=e)}function gb(e){nb||(tb&&(tb=clearTimeout(tb)),e-ab>24?(e<1/0&&(tb=setTimeout(vb,e-cb.now()-ub)),rb&&(rb=clearInterval(rb))):(rb||(ib=cb.now(),rb=setInterval(pb,ob)),nb=1,lb(vb)))}function yb(e,n,t){var r=new fb;return n=null==n?0:+n,r.restart((t=>{r.stop(),e(t+n)}),n,t),r}fb.prototype=hb.prototype={constructor:fb,restart:function(e,n,t){if("function"!=typeof e)throw new TypeError("callback is not a function");t=(null==t?sb():+t)+(null==n?0:+n),this._next||Jw===this||(Jw?Jw._next=this:Qw=this,Jw=this),this._call=e,this._time=t,gb()},stop:function(){this._call&&(this._call=null,this._time=1/0,gb())}};var mb=my("start","end","cancel","interrupt"),wb=[],bb=0,xb=2,_b=3,Eb=5,Sb=6;function kb(e,n,t,r,o,i){var a=e.__transition;if(a){if(t in a)return}else e.__transition={};!function(e,n,t){var r,o=e.__transition;function i(c){var l,s,d,f;if(1!==t.state)return u();for(l in o)if((f=o[l]).name===t.name){if(f.state===_b)return yb(i);4===f.state?(f.state=Sb,f.timer.stop(),f.on.call("interrupt",e,e.__data__,f.index,f.group),delete o[l]):+l<n&&(f.state=Sb,f.timer.stop(),f.on.call("cancel",e,e.__data__,f.index,f.group),delete o[l])}if(yb((function(){t.state===_b&&(t.state=4,t.timer.restart(a,t.delay,t.time),a(c))})),t.state=xb,t.on.call("start",e,e.__data__,t.index,t.group),t.state===xb){for(t.state=_b,r=new Array(d=t.tween.length),l=0,s=-1;l<d;++l)(f=t.tween[l].value.call(e,e.__data__,t.index,t.group))&&(r[++s]=f);r.length=s+1}}function a(n){for(var o=n<t.duration?t.ease.call(null,n/t.duration):(t.timer.restart(u),t.state=Eb,1),i=-1,a=r.length;++i<a;)r[i].call(e,o);t.state===Eb&&(t.on.call("end",e,e.__data__,t.index,t.group),u())}function u(){for(var r in t.state=Sb,t.timer.stop(),delete o[n],o)return;delete e.__transition}o[n]=t,t.timer=hb((function(e){t.state=1,t.timer.restart(i,t.delay,t.time),t.delay<=e&&i(e-t.delay)}),0,t.time)}(e,t,{name:n,index:r,group:o,on:mb,tween:wb,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:bb})}function Nb(e,n){var t=Mb(e,n);if(t.state>bb)throw new Error("too late; already scheduled");return t}function Cb(e,n){var t=Mb(e,n);if(t.state>_b)throw new Error("too late; already running");return t}function Mb(e,n){var t=e.__transition;if(!t||!(t=t[n]))throw new Error("transition not found");return t}function Ob(e,n){var t,r,o,i=e.__transition,a=!0;if(i){for(o in n=null==n?null:n+"",i)(t=i[o]).name===n?(r=t.state>xb&&t.state<Eb,t.state=Sb,t.timer.stop(),t.on.call(r?"interrupt":"cancel",e,e.__data__,t.index,t.group),delete i[o]):a=!1;a&&delete e.__transition}}function jb(e,n){var t,r;return function(){var o=Cb(this,e),i=o.tween;if(i!==t)for(var a=0,u=(r=t=i).length;a<u;++a)if(r[a].name===n){(r=r.slice()).splice(a,1);break}o.tween=r}}function Pb(e,n,t){var r,o;if("function"!=typeof t)throw new Error;return function(){var i=Cb(this,e),a=i.tween;if(a!==r){o=(r=a).slice();for(var u={name:n,value:t},c=0,l=o.length;c<l;++c)if(o[c].name===n){o[c]=u;break}c===l&&o.push(u)}i.tween=o}}function Ib(e,n,t){var r=e._id;return e.each((function(){var e=Cb(this,r);(e.value||(e.value={}))[n]=t.apply(this,arguments)})),function(e){return Mb(e,r).value[n]}}function Ab(e,n){var t;return("number"==typeof n?Vw:n instanceof xw?Rw:(t=xw(n))?(n=t,Rw):Xw)(e,n)}function zb(e){return function(){this.removeAttribute(e)}}function Tb(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Lb(e,n,t){var r,o,i=t+"";return function(){var a=this.getAttribute(e);return a===i?null:a===r?o:o=n(r=a,t)}}function Bb(e,n,t){var r,o,i=t+"";return function(){var a=this.getAttributeNS(e.space,e.local);return a===i?null:a===r?o:o=n(r=a,t)}}function Db(e,n,t){var r,o,i;return function(){var a,u,c=t(this);if(null!=c)return(a=this.getAttribute(e))===(u=c+"")?null:a===r&&u===o?i:(o=u,i=n(r=a,c));this.removeAttribute(e)}}function Rb(e,n,t){var r,o,i;return function(){var a,u,c=t(this);if(null!=c)return(a=this.getAttributeNS(e.space,e.local))===(u=c+"")?null:a===r&&u===o?i:(o=u,i=n(r=a,c));this.removeAttributeNS(e.space,e.local)}}function Vb(e,n){var t,r;function o(){var o=n.apply(this,arguments);return o!==r&&(t=(r=o)&&function(e,n){return function(t){this.setAttributeNS(e.space,e.local,n.call(this,t))}}(e,o)),t}return o._value=n,o}function Hb(e,n){var t,r;function o(){var o=n.apply(this,arguments);return o!==r&&(t=(r=o)&&function(e,n){return function(t){this.setAttribute(e,n.call(this,t))}}(e,o)),t}return o._value=n,o}function Yb(e,n){return function(){Nb(this,e).delay=+n.apply(this,arguments)}}function Xb(e,n){return n=+n,function(){Nb(this,e).delay=n}}function Zb(e,n){return function(){Cb(this,e).duration=+n.apply(this,arguments)}}function Fb(e,n){return n=+n,function(){Cb(this,e).duration=n}}var Ub=Im.prototype.constructor;function Wb(e){return function(){this.style.removeProperty(e)}}var Gb=0;function qb(e,n,t,r){this._groups=e,this._parents=n,this._name=t,this._id=r}function $b(){return++Gb}var Kb=Im.prototype;qb.prototype={constructor:qb,select:function(e){var n=this._name,t=this._id;"function"!=typeof e&&(e=Oy(e));for(var r=this._groups,o=r.length,i=new Array(o),a=0;a<o;++a)for(var u,c,l=r[a],s=l.length,d=i[a]=new Array(s),f=0;f<s;++f)(u=l[f])&&(c=e.call(u,u.__data__,f,l))&&("__data__"in u&&(c.__data__=u.__data__),d[f]=c,kb(d[f],n,t,f,d,Mb(u,t)));return new qb(i,this._parents,n,t)},selectAll:function(e){var n=this._name,t=this._id;"function"!=typeof e&&(e=Py(e));for(var r=this._groups,o=r.length,i=[],a=[],u=0;u<o;++u)for(var c,l=r[u],s=l.length,d=0;d<s;++d)if(c=l[d]){for(var f,h=e.call(c,c.__data__,d,l),v=Mb(c,t),p=0,g=h.length;p<g;++p)(f=h[p])&&kb(f,n,t,p,h,v);i.push(h),a.push(c)}return new qb(i,a,n,t)},selectChild:Kb.selectChild,selectChildren:Kb.selectChildren,filter:function(e){"function"!=typeof e&&(e=Iy(e));for(var n=this._groups,t=n.length,r=new Array(t),o=0;o<t;++o)for(var i,a=n[o],u=a.length,c=r[o]=[],l=0;l<u;++l)(i=a[l])&&e.call(i,i.__data__,l,a)&&c.push(i);return new qb(r,this._parents,this._name,this._id)},merge:function(e){if(e._id!==this._id)throw new Error;for(var n=this._groups,t=e._groups,r=n.length,o=t.length,i=Math.min(r,o),a=new Array(r),u=0;u<i;++u)for(var c,l=n[u],s=t[u],d=l.length,f=a[u]=new Array(d),h=0;h<d;++h)(c=l[h]||s[h])&&(f[h]=c);for(;u<r;++u)a[u]=n[u];return new qb(a,this._parents,this._name,this._id)},selection:function(){return new Ub(this._groups,this._parents)},transition:function(){for(var e=this._name,n=this._id,t=$b(),r=this._groups,o=r.length,i=0;i<o;++i)for(var a,u=r[i],c=u.length,l=0;l<c;++l)if(a=u[l]){var s=Mb(a,n);kb(a,e,t,l,u,{time:s.time+s.delay+s.duration,delay:0,duration:s.duration,ease:s.ease})}return new qb(r,this._parents,e,t)},call:Kb.call,nodes:Kb.nodes,node:Kb.node,size:Kb.size,empty:Kb.empty,each:Kb.each,on:function(e,n){var t=this._id;return arguments.length<2?Mb(this.node(),t).on.on(e):this.each(function(e,n,t){var r,o,i=function(e){return(e+"").trim().split(/^|\s+/).every((function(e){var n=e.indexOf(".");return n>=0&&(e=e.slice(0,n)),!e||"start"===e}))}(n)?Nb:Cb;return function(){var a=i(this,e),u=a.on;u!==r&&(o=(r=u).copy()).on(n,t),a.on=o}}(t,e,n))},attr:function(e,n){var t=Sy(e),r="transform"===t?$w:Ab;return this.attrTween(e,"function"==typeof n?(t.local?Rb:Db)(t,r,Ib(this,"attr."+e,n)):null==n?(t.local?Tb:zb)(t):(t.local?Bb:Lb)(t,r,n))},attrTween:function(e,n){var t="attr."+e;if(arguments.length<2)return(t=this.tween(t))&&t._value;if(null==n)return this.tween(t,null);if("function"!=typeof n)throw new Error;var r=Sy(e);return this.tween(t,(r.local?Vb:Hb)(r,n))},style:function(e,n,t){var r="transform"==(e+="")?qw:Ab;return null==n?this.styleTween(e,function(e,n){var t,r,o;return function(){var i=nm(this,e),a=(this.style.removeProperty(e),nm(this,e));return i===a?null:i===t&&a===r?o:o=n(t=i,r=a)}}(e,r)).on("end.style."+e,Wb(e)):"function"==typeof n?this.styleTween(e,function(e,n,t){var r,o,i;return function(){var a=nm(this,e),u=t(this),c=u+"";return null==u&&(this.style.removeProperty(e),c=u=nm(this,e)),a===c?null:a===r&&c===o?i:(o=c,i=n(r=a,u))}}(e,r,Ib(this,"style."+e,n))).each(function(e,n){var t,r,o,i,a="style."+n,u="end."+a;return function(){var c=Cb(this,e),l=c.on,s=null==c.value[a]?i||(i=Wb(n)):void 0;l===t&&o===s||(r=(t=l).copy()).on(u,o=s),c.on=r}}(this._id,e)):this.styleTween(e,function(e,n,t){var r,o,i=t+"";return function(){var a=nm(this,e);return a===i?null:a===r?o:o=n(r=a,t)}}(e,r,n),t).on("end.style."+e,null)},styleTween:function(e,n,t){var r="style."+(e+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==n)return this.tween(r,null);if("function"!=typeof n)throw new Error;return this.tween(r,function(e,n,t){var r,o;function i(){var i=n.apply(this,arguments);return i!==o&&(r=(o=i)&&function(e,n,t){return function(r){this.style.setProperty(e,n.call(this,r),t)}}(e,i,t)),r}return i._value=n,i}(e,n,null==t?"":t))},text:function(e){return this.tween("text","function"==typeof e?function(e){return function(){var n=e(this);this.textContent=null==n?"":n}}(Ib(this,"text",e)):function(e){return function(){this.textContent=e}}(null==e?"":e+""))},textTween:function(e){var n="text";if(arguments.length<1)return(n=this.tween(n))&&n._value;if(null==e)return this.tween(n,null);if("function"!=typeof e)throw new Error;return this.tween(n,function(e){var n,t;function r(){var r=e.apply(this,arguments);return r!==t&&(n=(t=r)&&function(e){return function(n){this.textContent=e.call(this,n)}}(r)),n}return r._value=e,r}(e))},remove:function(){return this.on("end.remove",function(e){return function(){var n=this.parentNode;for(var t in this.__transition)if(+t!==e)return;n&&n.removeChild(this)}}(this._id))},tween:function(e,n){var t=this._id;if(e+="",arguments.length<2){for(var r,o=Mb(this.node(),t).tween,i=0,a=o.length;i<a;++i)if((r=o[i]).name===e)return r.value;return null}return this.each((null==n?jb:Pb)(t,e,n))},delay:function(e){var n=this._id;return arguments.length?this.each(("function"==typeof e?Yb:Xb)(n,e)):Mb(this.node(),n).delay},duration:function(e){var n=this._id;return arguments.length?this.each(("function"==typeof e?Zb:Fb)(n,e)):Mb(this.node(),n).duration},ease:function(e){var n=this._id;return arguments.length?this.each(function(e,n){if("function"!=typeof n)throw new Error;return function(){Cb(this,e).ease=n}}(n,e)):Mb(this.node(),n).ease},easeVarying:function(e){if("function"!=typeof e)throw new Error;return this.each(function(e,n){return function(){var t=n.apply(this,arguments);if("function"!=typeof t)throw new Error;Cb(this,e).ease=t}}(this._id,e))},end:function(){var e,n,t=this,r=t._id,o=t.size();return new Promise((function(i,a){var u={value:a},c={value:function(){0==--o&&i()}};t.each((function(){var t=Cb(this,r),o=t.on;o!==e&&((n=(e=o).copy())._.cancel.push(u),n._.interrupt.push(u),n._.end.push(c)),t.on=n})),0===o&&i()}))},[Symbol.iterator]:Kb[Symbol.iterator]};var Qb={time:null,delay:0,duration:250,ease:function(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}};function Jb(e,n){for(var t;!(t=e.__transition)||!(t=t[n]);)if(!(e=e.parentNode))throw new Error(`transition ${n} not found`);return t}Im.prototype.interrupt=function(e){return this.each((function(){Ob(this,e)}))},Im.prototype.transition=function(e){var n,t;e instanceof qb?(n=e._id,e=e._name):(n=$b(),(t=Qb).time=sb(),e=null==e?null:e+"");for(var r=this._groups,o=r.length,i=0;i<o;++i)for(var a,u=r[i],c=u.length,l=0;l<c;++l)(a=u[l])&&kb(a,e,n,l,u,t||Jb(a,n));return new qb(r,this._parents,e,n)};var ex=e=>()=>e;function nx(e,{sourceEvent:n,target:t,transform:r,dispatch:o}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},target:{value:t,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:o}})}function tx(e,n,t){this.k=e,this.x=n,this.y=t}tx.prototype={constructor:tx,scale:function(e){return 1===e?this:new tx(this.k*e,this.x,this.y)},translate:function(e,n){return 0===e&0===n?this:new tx(this.k,this.x+this.k*e,this.y+this.k*n)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var rx=new tx(1,0,0);function ox(e){for(;!e.__zoom;)if(!(e=e.parentNode))return rx;return e.__zoom}function ix(e){e.stopImmediatePropagation()}function ax(e){e.preventDefault(),e.stopImmediatePropagation()}function ux(e){return!(e.ctrlKey&&"wheel"!==e.type||e.button)}function cx(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e).hasAttribute("viewBox")?[[(e=e.viewBox.baseVal).x,e.y],[e.x+e.width,e.y+e.height]]:[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]:[[0,0],[e.clientWidth,e.clientHeight]]}function lx(){return this.__zoom||rx}function sx(e){return-e.deltaY*(1===e.deltaMode?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function dx(){return navigator.maxTouchPoints||"ontouchstart"in this}function fx(e,n,t){var r=e.invertX(n[0][0])-t[0][0],o=e.invertX(n[1][0])-t[1][0],i=e.invertY(n[0][1])-t[0][1],a=e.invertY(n[1][1])-t[1][1];return e.translate(o>r?(r+o)/2:Math.min(0,r)||Math.max(0,o),a>i?(i+a)/2:Math.min(0,i)||Math.max(0,a))}ox.prototype=tx.prototype;var hx,vx=function(e,n){return e.x!==n.x||e.y!==n.y||e.zoom!==n.k},px=function(e){return{x:e.x,y:e.y,zoom:e.k}},gx=function(e){var n=e.x,t=e.y,r=e.zoom;return rx.translate(n,t).scale(r)},yx=function(e,n){return e.target.closest(".".concat(n))},mx=function(e,n){return 2===n&&Array.isArray(e)&&e.includes(2)},wx=function(e,n){return void 0===n&&(n=0),"number"==typeof n&&n>0?e.transition().duration(n):e},bx=function(e){var n=e.ctrlKey&&Hv()?10:1;return-e.deltaY*(1===e.deltaMode?.05:e.deltaMode?1:.002)*n};function xx(e){var n=e.domNode,t=e.minZoom,r=e.maxZoom,o=e.translateExtent,i=e.viewport,a=e.onPanZoom,u=e.onPanZoomStart,c=e.onPanZoomEnd,l=e.onTransformChange,s=e.onDraggingChange,d={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{x:0,y:0,zoom:0},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},f=n.getBoundingClientRect(),h=function(){var e,n,t,r=ux,o=cx,i=fx,a=sx,u=dx,c=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],s=250,d=eb,f=my("start","zoom","end"),h=500,v=150,p=0,g=10;function y(e){e.property("__zoom",lx).on("wheel.zoom",S,{passive:!1}).on("mousedown.zoom",k).on("dblclick.zoom",N).filter(u).on("touchstart.zoom",C).on("touchmove.zoom",M).on("touchend.zoom touchcancel.zoom",O).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function m(e,n){return(n=Math.max(c[0],Math.min(c[1],n)))===e.k?e:new tx(n,e.x,e.y)}function w(e,n,t){var r=n[0]-t[0]*e.k,o=n[1]-t[1]*e.k;return r===e.x&&o===e.y?e:new tx(e.k,r,o)}function b(e){return[(+e[0][0]+ +e[1][0])/2,(+e[0][1]+ +e[1][1])/2]}function x(e,n,t,r){e.on("start.zoom",(function(){_(this,arguments).event(r).start()})).on("interrupt.zoom end.zoom",(function(){_(this,arguments).event(r).end()})).tween("zoom",(function(){var e=this,i=arguments,a=_(e,i).event(r),u=o.apply(e,i),c=null==t?b(u):"function"==typeof t?t.apply(e,i):t,l=Math.max(u[1][0]-u[0][0],u[1][1]-u[0][1]),s=e.__zoom,f="function"==typeof n?n.apply(e,i):n,h=d(s.invert(c).concat(l/s.k),f.invert(c).concat(l/f.k));return function(e){if(1===e)e=f;else{var n=h(e),t=l/n[2];e=new tx(t,c[0]-n[0]*t,c[1]-n[1]*t)}a.zoom(null,e)}}))}function _(e,n,t){return!t&&e.__zooming||new E(e,n)}function E(e,n){this.that=e,this.args=n,this.active=0,this.sourceEvent=null,this.extent=o.apply(e,n),this.taps=0}function S(e,...n){if(r.apply(this,arguments)){var t=_(this,n).event(e),o=this.__zoom,u=Math.max(c[0],Math.min(c[1],o.k*Math.pow(2,a.apply(this,arguments)))),s=zm(e);if(t.wheel)t.mouse[0][0]===s[0]&&t.mouse[0][1]===s[1]||(t.mouse[1]=o.invert(t.mouse[0]=s)),clearTimeout(t.wheel);else{if(o.k===u)return;t.mouse=[s,o.invert(s)],Ob(this),t.start()}ax(e),t.wheel=setTimeout((function(){t.wheel=null,t.end()}),v),t.zoom("mouse",i(w(m(o,u),t.mouse[0],t.mouse[1]),t.extent,l))}}function k(e,...n){if(!t&&r.apply(this,arguments)){var o=e.currentTarget,a=_(this,n,!0).event(e),u=Am(e.view).on("mousemove.zoom",(function(e){if(ax(e),!a.moved){var n=e.clientX-s,t=e.clientY-d;a.moved=n*n+t*t>p}a.event(e).zoom("mouse",i(w(a.that.__zoom,a.mouse[0]=zm(e,o),a.mouse[1]),a.extent,l))}),!0).on("mouseup.zoom",(function(e){u.on("mousemove.zoom mouseup.zoom",null),Vm(e.view,a.moved),ax(e),a.event(e).end()}),!0),c=zm(e,o),s=e.clientX,d=e.clientY;Rm(e.view),ix(e),a.mouse=[c,this.__zoom.invert(c)],Ob(this),a.start()}}function N(e,...n){if(r.apply(this,arguments)){var t=this.__zoom,a=zm(e.changedTouches?e.changedTouches[0]:e,this),u=t.invert(a),c=t.k*(e.shiftKey?.5:2),d=i(w(m(t,c),a,u),o.apply(this,n),l);ax(e),s>0?Am(this).transition().duration(s).call(x,d,a,e):Am(this).call(y.transform,d,a,e)}}function C(t,...o){if(r.apply(this,arguments)){var i,a,u,c,l=t.touches,s=l.length,d=_(this,o,t.changedTouches.length===s).event(t);for(ix(t),a=0;a<s;++a)c=[c=zm(u=l[a],this),this.__zoom.invert(c),u.identifier],d.touch0?d.touch1||d.touch0[2]===c[2]||(d.touch1=c,d.taps=0):(d.touch0=c,i=!0,d.taps=1+!!e);e&&(e=clearTimeout(e)),i&&(d.taps<2&&(n=c[0],e=setTimeout((function(){e=null}),h)),Ob(this),d.start())}}function M(e,...n){if(this.__zooming){var t,r,o,a,u=_(this,n).event(e),c=e.changedTouches,s=c.length;for(ax(e),t=0;t<s;++t)o=zm(r=c[t],this),u.touch0&&u.touch0[2]===r.identifier?u.touch0[0]=o:u.touch1&&u.touch1[2]===r.identifier&&(u.touch1[0]=o);if(r=u.that.__zoom,u.touch1){var d=u.touch0[0],f=u.touch0[1],h=u.touch1[0],v=u.touch1[1],p=(p=h[0]-d[0])*p+(p=h[1]-d[1])*p,g=(g=v[0]-f[0])*g+(g=v[1]-f[1])*g;r=m(r,Math.sqrt(p/g)),o=[(d[0]+h[0])/2,(d[1]+h[1])/2],a=[(f[0]+v[0])/2,(f[1]+v[1])/2]}else{if(!u.touch0)return;o=u.touch0[0],a=u.touch0[1]}u.zoom("touch",i(w(r,o,a),u.extent,l))}}function O(e,...r){if(this.__zooming){var o,i,a=_(this,r).event(e),u=e.changedTouches,c=u.length;for(ix(e),t&&clearTimeout(t),t=setTimeout((function(){t=null}),h),o=0;o<c;++o)i=u[o],a.touch0&&a.touch0[2]===i.identifier?delete a.touch0:a.touch1&&a.touch1[2]===i.identifier&&delete a.touch1;if(a.touch1&&!a.touch0&&(a.touch0=a.touch1,delete a.touch1),a.touch0)a.touch0[1]=this.__zoom.invert(a.touch0[0]);else if(a.end(),2===a.taps&&(i=zm(i,this),Math.hypot(n[0]-i[0],n[1]-i[1])<g)){var l=Am(this).on("dblclick.zoom");l&&l.apply(this,arguments)}}}return y.transform=function(e,n,t,r){var o=e.selection?e.selection():e;o.property("__zoom",lx),e!==o?x(e,n,t,r):o.interrupt().each((function(){_(this,arguments).event(r).start().zoom(null,"function"==typeof n?n.apply(this,arguments):n).end()}))},y.scaleBy=function(e,n,t,r){y.scaleTo(e,(function(){return this.__zoom.k*("function"==typeof n?n.apply(this,arguments):n)}),t,r)},y.scaleTo=function(e,n,t,r){y.transform(e,(function(){var e=o.apply(this,arguments),r=this.__zoom,a=null==t?b(e):"function"==typeof t?t.apply(this,arguments):t,u=r.invert(a),c="function"==typeof n?n.apply(this,arguments):n;return i(w(m(r,c),a,u),e,l)}),t,r)},y.translateBy=function(e,n,t,r){y.transform(e,(function(){return i(this.__zoom.translate("function"==typeof n?n.apply(this,arguments):n,"function"==typeof t?t.apply(this,arguments):t),o.apply(this,arguments),l)}),null,r)},y.translateTo=function(e,n,t,r,a){y.transform(e,(function(){var e=o.apply(this,arguments),a=this.__zoom,u=null==r?b(e):"function"==typeof r?r.apply(this,arguments):r;return i(rx.translate(u[0],u[1]).scale(a.k).translate("function"==typeof n?-n.apply(this,arguments):-n,"function"==typeof t?-t.apply(this,arguments):-t),e,l)}),r,a)},E.prototype={event:function(e){return e&&(this.sourceEvent=e),this},start:function(){return 1==++this.active&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(e,n){return this.mouse&&"mouse"!==e&&(this.mouse[1]=n.invert(this.mouse[0])),this.touch0&&"touch"!==e&&(this.touch0[1]=n.invert(this.touch0[0])),this.touch1&&"touch"!==e&&(this.touch1[1]=n.invert(this.touch1[0])),this.that.__zoom=n,this.emit("zoom"),this},end:function(){return 0==--this.active&&(delete this.that.__zooming,this.emit("end")),this},emit:function(e){var n=Am(this.that).datum();f.call(e,this.that,new nx(e,{sourceEvent:this.sourceEvent,target:y,type:e,transform:this.that.__zoom,dispatch:f}),n)}},y.wheelDelta=function(e){return arguments.length?(a="function"==typeof e?e:ex(+e),y):a},y.filter=function(e){return arguments.length?(r="function"==typeof e?e:ex(!!e),y):r},y.touchable=function(e){return arguments.length?(u="function"==typeof e?e:ex(!!e),y):u},y.extent=function(e){return arguments.length?(o="function"==typeof e?e:ex([[+e[0][0],+e[0][1]],[+e[1][0],+e[1][1]]]),y):o},y.scaleExtent=function(e){return arguments.length?(c[0]=+e[0],c[1]=+e[1],y):[c[0],c[1]]},y.translateExtent=function(e){return arguments.length?(l[0][0]=+e[0][0],l[1][0]=+e[1][0],l[0][1]=+e[0][1],l[1][1]=+e[1][1],y):[[l[0][0],l[0][1]],[l[1][0],l[1][1]]]},y.constrain=function(e){return arguments.length?(i=e,y):i},y.duration=function(e){return arguments.length?(s=+e,y):s},y.interpolate=function(e){return arguments.length?(d=e,y):d},y.on=function(){var e=f.on.apply(f,arguments);return e===f?y:e},y.clickDistance=function(e){return arguments.length?(p=(e=+e)*e,y):Math.sqrt(p)},y.tapDistance=function(e){return arguments.length?(g=+e,y):g},y}().scaleExtent([t,r]).translateExtent(o),v=Am(n).call(h);w({x:i.x,y:i.y,zoom:Ov(i.zoom,t,r)},[[0,0],[f.width,f.height]],o);var p=v.on("wheel.zoom"),g=v.on("dblclick.zoom");function y(e,n){v&&(null==h||h.transform(wx(v,null==n?void 0:n.duration),e))}function m(){h.on("zoom",null)}function w(e,n,t){var r=gx(e),o=null==h?void 0:h.constrain()(r,n,t);return o&&y(o),o}return h.wheelDelta(bx),{update:function(e){var n=e.noWheelClassName,t=e.noPanClassName,r=e.onPaneContextMenu,o=e.userSelectionActive,i=e.panOnScroll,f=e.panOnDrag,y=e.panOnScrollMode,w=e.panOnScrollSpeed,b=e.preventScrolling,x=e.zoomOnPinch,_=e.zoomOnScroll,E=e.zoomOnDoubleClick,S=e.zoomActivationKeyPressed,k=e.lib;o&&!d.isZoomingOrPanning&&m();var N=!i||S||o?function(e){var n=e.noWheelClassName,t=e.preventScrolling,r=e.d3ZoomHandler;return function(e,o){if(!t&&"wheel"===e.type&&!e.ctrlKey||yx(e,n))return null;e.preventDefault(),r.call(this,e,o)}}({noWheelClassName:n,preventScrolling:b,d3ZoomHandler:p}):function(e){var n=e.zoomPanValues,t=e.noWheelClassName,r=e.d3Selection,o=e.d3Zoom,i=e.panOnScrollMode,a=e.panOnScrollSpeed,u=e.zoomOnPinch,c=e.onPanZoomStart,l=e.onPanZoom,s=e.onPanZoomEnd;return function(e){if(yx(e,t))return!1;e.preventDefault(),e.stopImmediatePropagation();var d=r.property("__zoom").k||1;if(e.ctrlKey&&u){var f=zm(e),h=bx(e),v=d*Math.pow(2,h);o.scaleTo(r,v,f,e)}else{var p=1===e.deltaMode?20:1,g=i===Wv.Vertical?0:e.deltaX*p,y=i===Wv.Horizontal?0:e.deltaY*p;!Hv()&&e.shiftKey&&i!==Wv.Vertical&&(g=e.deltaY*p,y=0),o.translateBy(r,-g/d*a,-y/d*a,{internal:!0});var m=px(r.property("__zoom"));clearTimeout(n.panScrollTimeout),n.isPanScrolling||(n.isPanScrolling=!0,null==c||c(e,m)),n.isPanScrolling&&(null==l||l(e,m),n.panScrollTimeout=setTimeout((function(){null==s||s(e,m),n.isPanScrolling=!1}),150))}}}({zoomPanValues:d,noWheelClassName:n,d3Selection:v,d3Zoom:h,panOnScrollMode:y,panOnScrollSpeed:w,zoomOnPinch:x,onPanZoomStart:u,onPanZoom:a,onPanZoomEnd:c});if(v.on("wheel.zoom",N,{passive:!1}),!o){var C=function(e){var n=e.zoomPanValues,t=e.onDraggingChange,r=e.onPanZoomStart;return function(e){var o,i,a;if(!(null===(o=e.sourceEvent)||void 0===o?void 0:o.internal)){var u=px(e.transform);n.mouseButton=(null===(i=e.sourceEvent)||void 0===i?void 0:i.button)||0,n.isZoomingOrPanning=!0,n.prevViewport=u,"mousedown"===(null===(a=e.sourceEvent)||void 0===a?void 0:a.type)&&t(!0),r&&(null==r||r(e.sourceEvent,u))}}}({zoomPanValues:d,onDraggingChange:s,onPanZoomStart:u});h.on("start",C);var M=function(e){var n=e.zoomPanValues,t=e.panOnDrag,r=e.onPaneContextMenu,o=e.onTransformChange,i=e.onPanZoom;return function(e){var a,u,c;n.usedRightMouseButton=!(!r||!mx(t,null!==(a=n.mouseButton)&&void 0!==a?a:0)),(null===(u=e.sourceEvent)||void 0===u?void 0:u.sync)||o([e.transform.x,e.transform.y,e.transform.k]),i&&!(null===(c=e.sourceEvent)||void 0===c?void 0:c.internal)&&(null==i||i(e.sourceEvent,px(e.transform)))}}({zoomPanValues:d,panOnDrag:f,onPaneContextMenu:!!r,onPanZoom:a,onTransformChange:l});h.on("zoom",M);var O=function(e){var n=e.zoomPanValues,t=e.panOnDrag,r=e.panOnScroll,o=e.onDraggingChange,i=e.onPanZoomEnd,a=e.onPaneContextMenu;return function(e){var u,c;if(!(null===(u=e.sourceEvent)||void 0===u?void 0:u.internal)&&(n.isZoomingOrPanning=!1,a&&mx(t,null!==(c=n.mouseButton)&&void 0!==c?c:0)&&!n.usedRightMouseButton&&e.sourceEvent&&a(e.sourceEvent),n.usedRightMouseButton=!1,o(!1),i&&vx(n.prevViewport,e.transform))){var l=px(e.transform);n.prevViewport=l,clearTimeout(n.timerId),n.timerId=setTimeout((function(){null==i||i(e.sourceEvent,l)}),r?150:0)}}}({zoomPanValues:d,panOnDrag:f,panOnScroll:i,onPaneContextMenu:r,onPanZoomEnd:c,onDraggingChange:s});h.on("end",O)}var j=function(e){var n=e.zoomActivationKeyPressed,t=e.zoomOnScroll,r=e.zoomOnPinch,o=e.panOnDrag,i=e.panOnScroll,a=e.zoomOnDoubleClick,u=e.userSelectionActive,c=e.noWheelClassName,l=e.noPanClassName,s=e.lib;return function(e){var d=n||t,f=r&&e.ctrlKey;if(1===e.button&&"mousedown"===e.type&&(yx(e,"".concat(s,"-flow__node"))||yx(e,"".concat(s,"-flow__edge"))))return!0;if(!(o||d||i||a||r))return!1;if(u)return!1;if(yx(e,c)&&"wheel"===e.type)return!1;if(yx(e,l)&&("wheel"!==e.type||i&&"wheel"===e.type&&!n))return!1;if(!r&&e.ctrlKey&&"wheel"===e.type)return!1;if(!d&&!i&&!f&&"wheel"===e.type)return!1;if(!o&&("mousedown"===e.type||"touchstart"===e.type))return!1;if(Array.isArray(o)&&!o.includes(e.button)&&"mousedown"===e.type)return!1;var h=Array.isArray(o)&&o.includes(e.button)||!e.button||e.button<=1;return(!e.ctrlKey||"wheel"===e.type)&&h}}({zoomActivationKeyPressed:S,panOnDrag:f,zoomOnScroll:_,panOnScroll:i,zoomOnDoubleClick:E,zoomOnPinch:x,userSelectionActive:o,noPanClassName:t,noWheelClassName:n,lib:k});h.filter(j),E?v.on("dblclick.zoom",g):v.on("dblclick.zoom",null)},destroy:m,setViewport:function(e,n){var t=gx(e);return y(t,n),t},setViewportConstrained:w,getViewport:function(){var e=v?ox(v.node()):{x:0,y:0,k:1};return{x:e.x,y:e.y,zoom:e.k}},scaleTo:function(e,n){v&&(null==h||h.scaleTo(wx(v,null==n?void 0:n.duration),e))},scaleBy:function(e,n){v&&(null==h||h.scaleBy(wx(v,null==n?void 0:n.duration),e))},setScaleExtent:function(e){null==h||h.scaleExtent(e)},setTranslateExtent:function(e){null==h||h.translateExtent(e)},syncViewport:function(e){if(v){var n=gx(e),t=v.property("__zoom");t.k===e.zoom&&t.x===e.x&&t.y===e.y||null==h||h.transform(v,n,null,{sync:!0})}}}}!function(e){e.Line="line",e.Handle="handle"}(hx||(hx={}));Z(Z({},{width:0,height:0,x:0,y:0}),{pointerX:0,pointerY:0,aspectRatio:1});var _x=yv.error001();function Ex(e,n){var r=t(Y);if(null===r)throw new Error(_x);return V(r,e,n)}function Sx(){var e=t(Y);if(null===e)throw new Error(_x);return r((function(){return{getState:e.getState,setState:e.setState,subscribe:e.subscribe}}),[e])}function kx(e,n){var t,r,o;void 0===n&&(n={nodeOrigin:[0,0],elevateNodesOnSelect:!0,defaults:{}});var i=(null==n?void 0:n.elevateNodesOnSelect)?1e3:0;try{for(var a=g(e),u=a.next();!u.done;u=a.next()){var c=y(u.value,2)[1],l=c.parentId;if(l){if(!e.has(l))throw new Error("Parent node ".concat(l," not found"));var s=e.get(l),d=Nx(c,e,f(f({},c.position),{z:(zx(c.zIndex)?c.zIndex:0)+(c.selected?i:0)}),null!==(o=null==s?void 0:s.origin)&&void 0!==o?o:n.nodeOrigin),h=d.x,v=d.y,p=d.z,m=c.internals.positionAbsolute,w=h!==m.x||v!==m.y;(w||p!==c.internals.z)&&(c.internals=f(f({},c.internals),{positionAbsolute:w?{x:h,y:v}:m,z:p}))}}}catch(e){t={error:e}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}}function Nx(e,n,t,r){var o,i,a,u,c,l;if(void 0===r&&(r=[0,0]),!e.parentId)return t;var s=n.get(e.parentId),d=Cx(s,r).position;return Nx(s,n,{x:(null!==(o=t.x)&&void 0!==o?o:0)+d.x,y:(null!==(i=t.y)&&void 0!==i?i:0)+d.y,z:(null!==(a=s.internals.z)&&void 0!==a?a:0)>(null!==(u=t.z)&&void 0!==u?u:0)?null!==(c=s.internals.z)&&void 0!==c?c:0:null!==(l=t.z)&&void 0!==l?l:0},s.origin||r)}var Cx=function(e,n){void 0===n&&(n=[0,0]);var t=Ax(e),r=t.width,o=t.height,i="internals"in e?e.internals.positionAbsolute:e.position,a=e.origin||n,u=r*a[0],c=o*a[1];return{position:{x:e.position.x-u,y:e.position.y-c},positionAbsolute:{x:i.x-u,y:i.y-c}}};function Mx(e,n,t){var r,o;e.clear(),n.clear();try{for(var i=g(t),a=i.next();!a.done;a=i.next()){var u=a.value,c=u.source,l=u.target,s=u.sourceHandle,d=void 0===s?null:s,f=u.targetHandle,h=void 0===f?null:f,v="".concat(c,"-source-").concat(d),p="".concat(l,"-target-").concat(h),y=e.get(v)||new Map,m=e.get(p)||new Map,w={edgeId:u.id,source:c,target:l,sourceHandle:d,targetHandle:h};n.set(u.id,u),e.set(v,y.set("".concat(l,"-").concat(h),w)),e.set(p,m.set("".concat(c,"-").concat(d),w))}}catch(e){r={error:e}}finally{try{a&&!a.done&&(o=i.return)&&o.call(i)}finally{if(r)throw r.error}}}function Ox(e,n,t,r){void 0===r&&(r={nodeOrigin:[0,0],elevateNodesOnSelect:!0,defaults:{},checkEquality:!0});var o=new Map(n);n.clear(),t.clear();var i=(null==r?void 0:r.elevateNodesOnSelect)?1e3:0;e.forEach((function(e){var a,u,c=o.get(e.id);if(r.checkEquality&&e===(null==c?void 0:c.internals.userNode)||(c=f(f(f({},r.defaults),e),{measured:{width:null===(a=e.measured)||void 0===a?void 0:a.width,height:null===(u=e.measured)||void 0===u?void 0:u.height},internals:{positionAbsolute:e.position,handleBounds:null==c?void 0:c.internals.handleBounds,z:(zx(e.zIndex)?e.zIndex:0)+(e.selected?i:0),userNode:e}})),n.set(e.id,c),e.parentId){var l=t.get(e.parentId);l?l.push(c):t.set(e.parentId,[c])}})),t.size>0&&kx(n,r)}function jx(e,n,t,r){var o,i,a,u,c,l=[],s=new Map;try{for(var d=g(e),f=d.next();!f.done;f=d.next()){var h=f.value,v=n.get(h.parentId);if(v){var p=null!==(u=null===(a=s.get(h.parentId))||void 0===a?void 0:a.expandedRect)&&void 0!==u?u:Bx(v,null!==(c=v.origin)&&void 0!==c?c:r),y=Hx(p,h.rect);s.set(h.parentId,{expandedRect:y,parent:v})}}}catch(e){o={error:e}}finally{try{f&&!f.done&&(i=d.return)&&i.call(d)}finally{if(o)throw o.error}}return s.size>0&&s.forEach((function(n,r){var o=n.expandedRect,i=n.parent,a=Cx(i,i.origin).position,u=Ax(i),c=o.x<a.x?Math.round(Math.abs(a.x-o.x)):0,s=o.y<a.y?Math.round(Math.abs(a.y-o.y)):0;if(c>0||s>0){l.push({id:r,type:"position",position:{x:a.x-c,y:a.y-s}});var d=t.get(r);null==d||d.forEach((function(n){e.some((function(e){return e.id===n.id}))||l.push({id:n.id,type:"position",position:{x:n.position.x+c,y:n.position.y+s}})}))}(u.width<o.width||u.height<o.height)&&l.push({id:r,type:"dimensions",setAttributes:!0,dimensions:{width:Math.max(u.width,Math.round(o.width)),height:Math.max(u.height,Math.round(o.height))}})})),l}var Px=function(e,n,t){return void 0===n&&(n=0),void 0===t&&(t=1),Math.min(Math.max(e,n),t)},Ix=function(e,n){return void 0===e&&(e={x:0,y:0}),{x:Px(e.x,n[0][0],n[1][0]),y:Px(e.y,n[0][1],n[1][1])}};function Ax(e){var n,t,r,o,i,a,u,c;return{width:null!==(o=null!==(r=null!==(t=null===(n=e.measured)||void 0===n?void 0:n.width)&&void 0!==t?t:e.width)&&void 0!==r?r:e.initialWidth)&&void 0!==o?o:0,height:null!==(c=null!==(u=null!==(a=null===(i=e.measured)||void 0===i?void 0:i.height)&&void 0!==a?a:e.height)&&void 0!==u?u:e.initialHeight)&&void 0!==c?c:0}}var zx=function(e){return!isNaN(e)&&isFinite(e)},Tx=function(e,n){return void 0===n&&(n=[1,1]),{x:n[0]*Math.round(e.x/n[0]),y:n[1]*Math.round(e.y/n[1])}},Lx=function(e,n,t,r){var o=e.x,i=e.y,a=y(n,3),u=a[0],c=a[1],l=a[2];void 0===t&&(t=!1),void 0===r&&(r=[1,1]);var s={x:(o-u)/l,y:(i-c)/l};return t?Tx(s,r):s},Bx=function(e,n){var t,r,o,i,a,u;void 0===n&&(n=[0,0]);var c=Cx(e,n).positionAbsolute;return{x:c.x,y:c.y,width:null!==(o=null!==(r=null===(t=e.measured)||void 0===t?void 0:t.width)&&void 0!==r?r:e.width)&&void 0!==o?o:0,height:null!==(u=null!==(a=null===(i=e.measured)||void 0===i?void 0:i.height)&&void 0!==a?a:e.height)&&void 0!==u?u:0}},Dx=function(e,n){return{x:Math.min(e.x,n.x),y:Math.min(e.y,n.y),x2:Math.max(e.x2,n.x2),y2:Math.max(e.y2,n.y2)}},Rx=function(e){var n=e.x,t=e.y;return{x:n,y:t,x2:n+e.width,y2:t+e.height}},Vx=function(e){var n=e.x,t=e.y;return{x:n,y:t,width:e.x2-n,height:e.y2-t}},Hx=function(e,n){return Vx(Dx(Rx(e),Rx(n)))};function Yx(e){return o(e)}var Xx=function(e,n){var t=Math.max(0,Math.min(e.x+e.width,n.x+n.width)-Math.max(e.x,n.x)),r=Math.max(0,Math.min(e.y+e.height,n.y+n.height)-Math.max(e.y,n.y));return Math.ceil(t*r)},Zx=function(e,n,t,r,o,i){var a=n/(e.width*(1+i)),u=t/(e.height*(1+i)),c=Math.min(a,u),l=Px(c,r,o);return{x:n/2-(e.x+e.width/2)*l,y:t/2-(e.y+e.height/2)*l,zoom:l}};function Fx(e){return void 0!==e&&"parent"!==e}var Ux=function(e){var n=e.x,t=e.y,r=e.width,o=e.height,i=e.origin,a=void 0===i?[0,0]:i;return!r||!o||a[0]<0||a[1]<0||a[0]>1||a[1]>1?{x:n,y:t}:{x:n-r*a[0],y:t-o*a[1]}},Wx=function(e){return Gx(e)},Gx=function(e){return"id"in e&&"position"in e&&!("source"in e)&&!("target"in e)};var qx=function(e){return zx(e.width)&&zx(e.height)&&zx(e.x)&&zx(e.y)},$x=function(e){return{width:e.offsetWidth,height:e.offsetHeight}},Kx=["INPUT","SELECT","TEXTAREA"];function Qx(e){var n,t,r=(null===(t=null===(n=e.composedPath)||void 0===n?void 0:n.call(e))||void 0===t?void 0:t[0])||e.target;return Kx.includes(null==r?void 0:r.nodeName)||(null==r?void 0:r.hasAttribute("contenteditable"))||!!(null==r?void 0:r.closest(".nokey"))}var Jx=function(e){return"clientX"in e},e_=function(e,n){var t,r,o,i,a=Jx(e),u=a?e.clientX:null===(t=e.touches)||void 0===t?void 0:t[0].clientX,c=a?e.clientY:null===(r=e.touches)||void 0===r?void 0:r[0].clientY;return{x:u-(null!==(o=null==n?void 0:n.left)&&void 0!==o?o:0),y:c-(null!==(i=null==n?void 0:n.top)&&void 0!==i?i:0)}},n_=function(e,n,t,r){void 0===r&&(r=[0,0]);var o=n.querySelectorAll(e);if(!o||!o.length)return null;var i=Array.from(o),a=n.getBoundingClientRect(),u=a.width*r[0],c=a.height*r[1];return i.map((function(e){var n=e.getBoundingClientRect();return f({id:e.getAttribute("data-handleid"),position:e.getAttribute("data-handlepos"),x:(n.left-a.left-u)/t,y:(n.top-a.top-c)/t},$x(e))}))},t_="undefined"!=typeof document?document:null;function r_(e,n){void 0===e&&(e=null),void 0===n&&(n={target:t_,actInsideInputWithModifier:!0});var t=y(i(!1),2),o=t[0],c=t[1],l=a(!1),s=a(new Set([])),d=y(r((function(){if(null!==e){var n=(Array.isArray(e)?e:[e]).filter((function(e){return"string"==typeof e})).map((function(e){return e.split("+")})),t=n.reduce((function(e,n){return e.concat.apply(e,m([],y(n),!1))}),[]);return[n,t]}return[[],[]]}),[e]),2),f=d[0],h=d[1];return u((function(){var t=(null==n?void 0:n.target)||t_;if(null!==e){var r=function(e){if(l.current=e.ctrlKey||e.metaKey||e.shiftKey,(!l.current||l.current&&!n.actInsideInputWithModifier)&&Qx(e))return!1;var t=i_(e.code,h);s.current.add(e[t]),o_(f,s.current,!1)&&(e.preventDefault(),c(!0))},o=function(e){if((!l.current||l.current&&!n.actInsideInputWithModifier)&&Qx(e))return!1;var t=i_(e.code,h);o_(f,s.current,!0)?(c(!1),s.current.clear()):s.current.delete(e[t]),"Meta"===e.key&&s.current.clear(),l.current=!1},i=function(){s.current.clear(),c(!1)};return null==t||t.addEventListener("keydown",r),null==t||t.addEventListener("keyup",o),window.addEventListener("blur",i),window.addEventListener("contextmenu",i),function(){null==t||t.removeEventListener("keydown",r),null==t||t.removeEventListener("keyup",o),window.removeEventListener("blur",i),window.removeEventListener("contextmenu",i)}}}),[e,c]),o}function o_(e,n,t){return e.filter((function(e){return t||e.length===n.size})).some((function(e){return e.every((function(e){return n.has(e)}))}))}function i_(e,n){return n.includes(e)?"code":"key"}function a_(e,n){if(Object.is(e,n))return!0;if("object"!=typeof e||null===e||"object"!=typeof n||null===n)return!1;if(e instanceof Map&&n instanceof Map){if(e.size!==n.size)return!1;for(const[t,r]of e)if(!Object.is(r,n.get(t)))return!1;return!0}if(e instanceof Set&&n instanceof Set){if(e.size!==n.size)return!1;for(const t of e)if(!n.has(t))return!1;return!0}const t=Object.keys(e);if(t.length!==Object.keys(n).length)return!1;for(const r of t)if(!Object.prototype.hasOwnProperty.call(n,r)||!Object.is(e[r],n[r]))return!1;return!0}var u_={position:"absolute",width:"100%",height:"100%",top:0,left:0};var c_=function(e){return{userSelectionActive:e.userSelectionActive,lib:e.lib}};function l_(e){var n=e.onPaneContextMenu,t=e.zoomOnScroll,r=void 0===t||t,o=e.zoomOnPinch,i=void 0===o||o,c=e.panOnScroll,l=void 0!==c&&c,s=e.panOnScrollSpeed,d=void 0===s?.5:s,f=e.panOnScrollMode,h=void 0===f?Wv.Free:f,v=e.zoomOnDoubleClick,p=void 0===v||v,g=e.panOnDrag,y=void 0===g||g,m=e.defaultViewport,w=e.translateExtent,b=e.zoomActivationKeyCode,x=e.preventScrolling,_=void 0===x||x,E=e.children,k=e.noWheelClassName,N=e.noPanClassName,C=e.onViewportChange,M=e.isControlledViewport,O=Sx(),j=a(null),P=Ex(c_,a_),I=P.userSelectionActive,A=P.lib,z=r_(b),T=a();return function(e){var n=Sx();u((function(){var t=function(){var t,r;if(!e.current)return!1;var o=$x(e.current);0!==o.height&&0!==o.width||null===(r=(t=n.getState()).onError)||void 0===r||r.call(t,"004",yv.error004()),n.setState({width:o.width||500,height:o.height||500})};if(e.current){t(),window.addEventListener("resize",t);var r=new ResizeObserver((function(){return t()}));return r.observe(e.current),function(){window.removeEventListener("resize",t),r&&e.current&&r.unobserve(e.current)}}}),[])}(j),u((function(){if(j.current){var e=O.getState();T.current=xx({domNode:j.current,minZoom:e.minZoom,maxZoom:e.maxZoom,translateExtent:w,viewport:m,onTransformChange:function(e){null==C||C({x:e[0],y:e[1],zoom:e[2]}),M||O.setState({transform:e})},onDraggingChange:function(e){return O.setState({paneDragging:e})},onPanZoomStart:function(e,n){var t=O.getState(),r=t.onViewportChangeStart,o=t.onMoveStart;null==o||o(e,n),null==r||r(n)},onPanZoom:function(e,n){var t=O.getState(),r=t.onViewportChange,o=t.onMove;null==o||o(e,n),null==r||r(n)},onPanZoomEnd:function(e,n){var t=O.getState(),r=t.onViewportChangeEnd,o=t.onMoveEnd;null==o||o(e,n),null==r||r(n)}});var n=T.current.getViewport(),t=n.x,r=n.y,o=n.zoom;return O.setState({panZoom:T.current,transform:[t,r,o],domNode:j.current.closest(".ink-flow")}),function(){var e;null===(e=T.current)||void 0===e||e.destroy()}}}),[]),u((function(){var e;null===(e=T.current)||void 0===e||e.update({onPaneContextMenu:n,zoomOnScroll:r,zoomOnPinch:i,panOnScroll:l,panOnScrollSpeed:d,panOnScrollMode:h,zoomOnDoubleClick:p,panOnDrag:y,zoomActivationKeyPressed:z,preventScrolling:_,noPanClassName:N,userSelectionActive:I,noWheelClassName:k,lib:A})}),[n,r,i,l,d,h,p,y,z,_,N,I,k,A]),S.jsx("div",{className:"ink-flow__renderer",ref:j,style:u_,children:E})}var s_={actInsideInputWithModifier:!1};function d_(e,n){switch(e.type){case"select":n.selected=e.selected;break;case"position":void 0!==e.position&&(n.position=e.position),void 0!==e.dragging&&(n.dragging=e.dragging);break;case"dimensions":void 0!==e.dimensions&&(n.measured={width:e.dimensions.width,height:e.dimensions.height},e.setAttributes&&(n.width=e.dimensions.width,n.height=e.dimensions.height)),"boolean"==typeof e.resizing&&(n.resizing=e.resizing)}}function f_(e,n){var t,r,o,i,a,u,c=[],l=new Map;try{for(var s=g(e),d=s.next();!d.done;d=s.next()){if("add"!==(_=d.value).type)if("remove"===_.type||"replace"===_.type)l.set(_.id,[_]);else{var h=l.get(_.id);h?h.push(_):l.set(_.id,[_])}else c.push(_.item)}}catch(e){t={error:e}}finally{try{d&&!d.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}try{for(var v=g(n),p=v.next();!p.done;p=v.next()){var y=p.value,m=l.get(y.id);if(m){if("remove"!==m[0].type)if("replace"!==m[0].type){var w=f({},y);try{for(var b=(a=void 0,g(m)),x=b.next();!x.done;x=b.next()){var _;d_(_=x.value,w)}}catch(e){a={error:e}}finally{try{x&&!x.done&&(u=b.return)&&u.call(b)}finally{if(a)throw a.error}}c.push(w)}else c.push(f({},m[0].item))}else c.push(y)}}catch(e){o={error:e}}finally{try{p&&!p.done&&(i=v.return)&&i.call(v)}finally{if(o)throw o.error}}return c}function h_(e,n){return f_(e,n)}function v_(e,n){return f_(e,n)}function p_(e,n){return{id:e,type:"select",selected:n}}function g_(e,n,t){var r,o;void 0===n&&(n=new Set),void 0===t&&(t=!1);var i=[];try{for(var a=g(e),u=a.next();!u.done;u=a.next()){var c=y(u.value,2),l=c[0],s=c[1],d=n.has(l);void 0===s.selected&&!d||s.selected===d||(t&&(s.selected=d),i.push(p_(s.id,d)))}}catch(e){r={error:e}}finally{try{u&&!u.done&&(o=a.return)&&o.call(a)}finally{if(r)throw r.error}}return i}function y_(e){var n,t,r,o,i,a,u=e.items,c=void 0===u?[]:u,l=e.lookup,s=[],d=new Map(c.map((function(e){return[e.id,e]})));try{for(var f=g(c),h=f.next();!h.done;h=f.next()){var v=h.value,p=l.get(v.id),m=null!==(a=null===(i=null==p?void 0:p.internals)||void 0===i?void 0:i.userNode)&&void 0!==a?a:p;void 0!==m&&m!==v&&s.push({id:v.id,item:v,type:"replace"}),void 0===m&&s.push({item:v,type:"add"})}}catch(e){n={error:e}}finally{try{h&&!h.done&&(t=f.return)&&t.call(f)}finally{if(n)throw n.error}}try{for(var w=g(l),b=w.next();!b.done;b=w.next()){var x=y(b.value,1)[0];void 0===d.get(x)&&s.push({id:x,type:"remove"})}}catch(e){r={error:e}}finally{try{b&&!b.done&&(o=w.return)&&o.call(w)}finally{if(r)throw r.error}}return s}function m_(e){return{id:e.id,type:"remove"}}var w_=function(e,n){void 0===n&&(n=[0,0]);var t=Ax(e),r=t.width,o=t.height,i="internals"in e?e.internals.positionAbsolute:e.position,a=e.origin||n,u=r*a[0],c=o*a[1];return{position:{x:e.position.x-u,y:e.position.y-c},positionAbsolute:{x:i.x-u,y:i.y-c}}},b_=function(e,n){if(void 0===n&&(n={nodeOrigin:[0,0]}),0===e.length)return{x:0,y:0,width:0,height:0};var t=e.reduce((function(e,t){var r=function(e,n){var t,r,o,i,a,u;void 0===n&&(n=[0,0]);var c=Cx(e,n).positionAbsolute,l=c.x,s=c.y;return{x:l,y:s,x2:l+(null!==(o=null!==(r=null===(t=e.measured)||void 0===t?void 0:t.width)&&void 0!==r?r:e.width)&&void 0!==o?o:0),y2:s+(null!==(u=null!==(a=null===(i=e.measured)||void 0===i?void 0:i.height)&&void 0!==a?a:e.height)&&void 0!==u?u:0)}}(t,n.nodeOrigin);return Dx(e,r)}),{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Vx(t)},x_=function(e,n,t,r,o,i){var a,u,c,l,s,d,h,v,p=y(void 0===t?[0,0,1]:t,3),m=p[0],w=p[1],b=p[2];void 0===r&&(r=!1),void 0===o&&(o=!1),void 0===i&&(i=[0,0]);var x=f(f({},Lx(n,[m,w,b])),{width:n.width/b,height:n.height/b}),_=[];try{for(var E=g(e),S=E.next();!S.done;S=E.next()){var k=y(S.value,2)[1],N=k.measured,C=k.selectable,M=void 0===C||C,O=k.hidden,j=void 0!==O&&O,P=null!==(s=null!==(l=null!==(c=N.width)&&void 0!==c?c:k.width)&&void 0!==l?l:k.initialWidth)&&void 0!==s?s:null,I=null!==(v=null!==(h=null!==(d=N.height)&&void 0!==d?d:k.height)&&void 0!==h?h:k.initialHeight)&&void 0!==v?v:null;if(!(o&&!M||j)){var A=Xx(x,Bx(k,i));(null===P||null===I||r&&A>0||A>=(null!=P?P:0)*(null!=I?I:0)||k.dragging)&&_.push(k)}}}catch(e){a={error:e}}finally{try{S&&!S.done&&(u=E.return)&&u.call(E)}finally{if(a)throw a.error}}return _},__=function(e,n){var t=new Set;return e.forEach((function(e){t.add(e.id)})),n.filter((function(e){return t.has(e.source)||t.has(e.target)}))};function E_(e,n){var t,r,o,i=e.nodeLookup,a=e.width,u=e.height,c=e.panZoom,l=e.minZoom,s=e.maxZoom,d=e.nodeOrigin,f=void 0===d?[0,0]:d,h=[],v=(null==n?void 0:n.nodes)?new Set(n.nodes.map((function(e){return e.id}))):null;if(i.forEach((function(e){!(e.measured.width&&e.measured.height&&((null==n?void 0:n.includeHiddenNodes)||!e.hidden))||v&&!v.has(e.id)||h.push(e)})),h.length>0){var p=b_(h,{nodeOrigin:f}),g=p.width>=a||p.height>=u;if("overflow"===(null==n?void 0:n.when)&&!g)return!0;var y=Zx(p,a,u,null!==(t=null==n?void 0:n.minZoom)&&void 0!==t?t:l,null!==(r=null==n?void 0:n.maxZoom)&&void 0!==r?r:s,null!==(o=null==n?void 0:n.padding)&&void 0!==o?o:.1);return c.setViewport(y,{duration:null==n?void 0:n.duration}),!0}return!1}function S_(e){var n=e.nodeId,t=e.nextPosition,r=e.nodeLookup,o=e.nodeOrigin,i=void 0===o?[0,0]:o,a=e.nodeExtent,u=e.onError,c=r.get(n),l=c.parentId?r.get(c.parentId):void 0,s=l?w_(l,l.origin||i).positionAbsolute:{x:0,y:0},d=s.x,f=s.y,h=function(e,n){var t,r,o,i;return n&&"parent"!==n?[n[0],[n[1][0]-(null!==(r=null===(t=e.measured)||void 0===t?void 0:t.width)&&void 0!==r?r:0),n[1][1]-(null!==(i=null===(o=e.measured)||void 0===o?void 0:o.height)&&void 0!==i?i:0)]]:n}(c,c.extent||a);if("parent"!==c.extent||c.expandParent)l&&Fx(c.extent)&&(h=[[c.extent[0][0]+d,c.extent[0][1]+f],[c.extent[1][0]+d,c.extent[1][1]+f]]);else if(l){var v=c.measured.width,p=c.measured.height,g=l.measured.width,y=l.measured.height;if(v&&p&&g&&y){var m=c.origin||i,w=d+v*m[0],b=f+p*m[1];h=[[w,b],[w+g-v,b+y-p]]}}else null==u||u("005",yv.error005());var x=Fx(h)?Ix(t,h):t;return{position:{x:x.x-d,y:x.y-f},positionAbsolute:x}}function k_(e){return v(this,arguments,void 0,(function(e){var n,t,r,o,i,a,u,c,l,s,d,f,h,v,y,m,w,b,x,_=e.nodesToRemove,E=void 0===_?[]:_,S=e.edgesToRemove,k=void 0===S?[]:S,N=e.nodes,C=e.edges,M=e.onBeforeDelete;return p(this,(function(e){switch(e.label){case 0:n=new Set(E.map((function(e){return e.id}))),t=[],r=function(e){if(!1===e.deletable)return"continue";var r=n.has(e.id),o=!r&&e.parentId&&t.find((function(n){return n.id===e.parentId}));(r||o)&&t.push(e)};try{for(o=g(N),i=o.next();!i.done;i=o.next())a=i.value,r(a)}catch(e){m={error:e}}finally{try{i&&!i.done&&(w=o.return)&&w.call(o)}finally{if(m)throw m.error}}u=new Set(k.map((function(e){return e.id}))),c=C.filter((function(e){return!1!==e.deletable})),l=__(t,c),s=l,d=function(e){u.has(e.id)&&!s.find((function(n){return n.id===e.id}))&&s.push(e)};try{for(f=g(c),h=f.next();!h.done;h=f.next())v=h.value,d(v)}catch(e){b={error:e}}finally{try{h&&!h.done&&(x=f.return)&&x.call(f)}finally{if(b)throw b.error}}return M?[4,M({nodes:t,edges:s})]:[2,{edges:s,nodes:t}];case 1:return"boolean"==typeof(y=e.sent())?[2,y?{edges:s,nodes:t}:{edges:[],nodes:[]}]:[2,y]}}))}))}var N_=function(e){return{userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect}};function C_(){var e=Ex(N_,a_),n=e.userSelectionActive,t=e.userSelectionRect;return n&&t?S.jsx("div",{className:"ink-flow__selection ink-flow__container",style:{width:t.width,height:t.height,transform:"translate(".concat(t.x,"px, ").concat(t.y,"px)")}}):null}var M_=function(e,n){return function(t){t.target===n.current&&(null==e||e(t))}},O_=function(e){return{userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging}};function j_(e){var n=e.isSelecting;e.selectionMode;var t=e.panOnDrag,r=e.onSelectionStart,o=e.onSelectionEnd,i=e.onPaneClick,u=e.onPaneContextMenu,c=e.onPaneScroll,l=e.onPaneMouseEnter,s=e.onPaneMouseMove,d=e.onPaneMouseLeave,f=e.children,h=a(null),v=Sx(),p=a(0),m=a(0),w=a(),b=a(new Map),x=Ex(O_,a_),_=x.userSelectionActive,E=x.elementsSelectable,k=x.dragging,N=function(){v.setState({userSelectionActive:!1,userSelectionRect:null}),p.current=0,m.current=0},C=function(e){null==i||i(e),v.getState().resetSelectedElements(),v.setState({nodesSelectionActive:!1})},M=c?function(e){return c(e)}:void 0,j=E&&(n||_);return S.jsxs("div",{className:O(["ink-flow__pane",{draggable:t,dragging:k,selection:n}]),onClick:j?void 0:M_(C,h),onContextMenu:M_((function(e){Array.isArray(t)&&(null==t?void 0:t.includes(2))?e.preventDefault():null==u||u(e)}),h),onWheel:M_(M,h),onMouseEnter:j?void 0:l,onMouseDown:j?function(e){var t,o,i,a,u=v.getState(),c=u.resetSelectedElements,l=u.domNode,s=u.edgeLookup;if(w.current=null==l?void 0:l.getBoundingClientRect(),E&&n&&0===e.button&&e.target===h.current&&w.current){b.current=new Map;try{for(var d=g(s),f=d.next();!f.done;f=d.next()){var p=y(f.value,2),m=p[0],x=p[1];b.current.set(x.source,(null===(i=b.current.get(x.source))||void 0===i?void 0:i.add(m))||new Set([m])),b.current.set(x.target,(null===(a=b.current.get(x.target))||void 0===a?void 0:a.add(m))||new Set([m]))}}catch(e){t={error:e}}finally{try{f&&!f.done&&(o=d.return)&&o.call(d)}finally{if(t)throw t.error}}var _=e_(e.nativeEvent,w.current),S=_.x,k=_.y;c(),v.setState({userSelectionRect:{width:0,height:0,startX:S,startY:k,x:S,y:k}}),null==r||r(e)}}:void 0,onMouseMove:j?function(e){var t,r,o,i,a=v.getState(),u=a.userSelectionRect,c=a.edgeLookup,l=a.transform,s=a.nodeOrigin,d=a.nodeLookup,f=a.triggerNodeChanges,h=a.triggerEdgeChanges;if(n&&w.current&&u){var y=e_(e.nativeEvent,w.current),x=y.x,_=y.y,E=u.startX,S=u.startY,k={startX:E,startY:S,x:x<E?x:E,y:_<S?_:S,width:Math.abs(x-E),height:Math.abs(_-S)},N=x_(d,k,l,!1,!0,s),C=new Set,M=new Set;try{for(var O=g(N),j=O.next();!j.done;j=O.next()){var P=j.value;M.add(P.id);var I=b.current.get(P.id);if(I)try{for(var A=(o=void 0,g(I)),z=A.next();!z.done;z=A.next()){var T=z.value;C.add(T)}}catch(e){o={error:e}}finally{try{z&&!z.done&&(i=A.return)&&i.call(A)}finally{if(o)throw o.error}}}}catch(e){t={error:e}}finally{try{j&&!j.done&&(r=O.return)&&r.call(O)}finally{if(t)throw t.error}}if(p.current!==M.size)p.current=M.size,f(g_(d,M,!0));if(m.current!==C.size)m.current=C.size,h(g_(c,C));v.setState({userSelectionRect:k,userSelectionActive:!0,nodesSelectionActive:!1})}}:s,onMouseUp:j?function(e){if(0===e.button){var n=v.getState().userSelectionRect;!_&&n&&e.target===h.current&&(null==C||C(e)),v.setState({nodesSelectionActive:p.current>0}),N(),null==o||o(e)}}:void 0,onMouseLeave:j?function(e){_&&(v.setState({nodesSelectionActive:p.current>0}),null==o||o(e)),N()}:d,ref:h,style:u_,children:[f,S.jsx(C_,{})]})}var P_=function(e){return{nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive}};function I_(e){var n=e.children,t=e.onPaneClick,r=e.onPaneMouseEnter,o=e.onPaneMouseMove,i=e.onPaneMouseLeave,a=e.onPaneContextMenu,c=e.onPaneScroll,l=e.deleteKeyCode,s=e.selectionKeyCode,d=e.selectionOnDrag,f=e.selectionMode,h=e.onSelectionStart,v=e.onSelectionEnd,p=e.multiSelectionKeyCode,g=e.panActivationKeyCode,y=e.zoomActivationKeyCode,m=e.elementsSelectable,w=e.zoomOnScroll,b=e.zoomOnPinch,x=e.panOnScroll,_=e.panOnScrollSpeed,E=e.panOnScrollMode,k=e.zoomOnDoubleClick,N=e.panOnDrag,C=e.defaultViewport,M=e.translateExtent,O=e.minZoom,j=e.maxZoom,P=e.preventScrolling;e.onSelectionContextMenu;var I=e.noWheelClassName,A=e.noPanClassName;e.disableKeyboardA11y;var z=e.onViewportChange,T=e.isControlledViewport,L=Ex(P_);L.nodesSelectionActive;var B=L.userSelectionActive,D=r_(s),R=r_(g),V=R||N,H=R||x,Y=D||B||d&&!0!==V;return function(e){var n=e.deleteKeyCode,t=e.multiSelectionKeyCode,r=Sx(),o=r_(n,s_),i=r_(t);u((function(){if(o){var e=r.getState();e.edges,e.nodes,r.setState({nodesSelectionActive:!1})}}),[o]),u((function(){r.setState({multiSelectionActive:i})}),[i])}({deleteKeyCode:l,multiSelectionKeyCode:p}),S.jsx(l_,{onPaneContextMenu:a,elementsSelectable:m,zoomOnScroll:w,zoomOnPinch:b,panOnScroll:H,panOnScrollSpeed:_,panOnScrollMode:E,zoomOnDoubleClick:k,panOnDrag:!D&&V,defaultViewport:C,translateExtent:M,minZoom:O,maxZoom:j,zoomActivationKeyCode:y,preventScrolling:P,noWheelClassName:I,noPanClassName:A,onViewportChange:z,isControlledViewport:T,children:S.jsx(j_,{onSelectionStart:h,onSelectionEnd:v,onPaneClick:t,onPaneMouseEnter:r,onPaneMouseMove:o,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:c,panOnDrag:V,isSelecting:!!Y,selectionMode:f,children:n})})}I_.displayName="FlowRenderer";var A_=c(I_);function z_(e){var n=y(i(e),2),t=n[0],r=n[1],o=l((function(e){return r((function(n){return h_(e,n)}))}),[]);return[t,r,o]}var T_={x:0,y:0,zoom:1},L_={type:"dagre",options:{rankdir:"TB",ranksep:100,nodesep:50}},B_={dagre:fp};function D_(e){var n=y(i(e),2),t=n[0],r=n[1],o=Sx(),a=l((function(e){var n=o.getState(),t=n.nodeOrigin,r=n.width,i=n.height,a=n.fitViewDone,u=n.panZoom,c=n.fitViewOnInit,l=n.minZoom,s=n.maxZoom,d=n.fitViewOnInitOptions;if(c&&!a&&u){var f=new Map;e.forEach((function(e){f.set(e.id,e)}));var h=E_({nodeLookup:f,width:r,height:i,panZoom:u,nodeOrigin:t,minZoom:l,maxZoom:s},d);o.setState({fitViewDone:h})}}),[o]),u=l((function(e){var n=o.getState(),t=n.fitViewDone,r=n.centered,i=n.centerConfig,a=n.width,u=n.height,c=n.transform,l=n.panZoom,s=n.nodeOrigin;if(!r&&!t&&i&&l){var d=i.centerByBBox,f=i.centerNodeId;if(f){var h=e.find((function(e){return e.id===f}));if(h)return void function(e){var n=e.node,t=e.height,r=e.width,o=e.zoom,i=void 0===o?1:o,a=e.panZoom,u=Ax(n),c={x:r/2-(n.position.x+u.width/2)*i,y:t/2-(n.position.y+u.height/2)*i};a.setViewport({x:c.x,y:c.y,zoom:i})}({node:h,width:a,height:u,panZoom:l,nodeOrigin:s,zoom:c[2]})}d&&function(e){var n=e.nodes,t=e.nodeOrigin,r=e.height,o=e.width,i=e.zoom,a=void 0===i?1:i,u=e.panZoom,c=b_(n,{nodeOrigin:t}),l={x:o/2-(c.x+c.width/2)*a,y:r/2-(c.y+c.height/2)*a};u.setViewport({x:l.x,y:l.y,zoom:a})}({nodes:e,width:a,height:u,panZoom:l,nodeOrigin:s,zoom:c[2]}),o.setState({centered:!0})}}),[o]),c=l((function(e){var n=o.getState(),t=n.layoutTypes,i=n.layoutConfig,c=void 0===i?L_:i,l=n.edges,s=n.setEdges,d=n.nodeOrigin,h=n.width,v=n.height,p=t[null==c?void 0:c.type]||B_[null==c?void 0:c.type];if(!p)return r(e),void console.error("layout function is not existed");var g=[];e.forEach((function(e){e.data&&(e.data.width=e.measured.width,e.data.height=e.measured.height),g.push(e)}));var y=p(g,l,f({nodeOrigin:d,width:h,height:v},null==c?void 0:c.options)),m=y.nodes,w=y.edges;a(m),u(m),r(m),s(w)}),[o,a,u]),s=l((function(e){var n=v_(e,t),i=function(e,n){if(!e.every((function(e){return e.measured})))return!1;var t=n.reduce((function(e,n){var t;return f(f({},e),((t={})[n.id]=n,t))}),{});return e.some((function(e){var n=Ax(e),r=t[e.id],o=r?Ax(r):{width:0,height:0};return n.width!==o.width||n.height!==o.height}))}(n,t),a=o.getState().autoLayout;i&&a?c(n):r(n)}),[t,c]);return[t,r,s]}var R_="undefined"!=typeof window?s:u;function V_(e){var n=y(i(!1),2),t=n[0],r=n[1],o=y(i((function(){return function(e){var n=[];return{get:function(){return n},reset:function(){n=[]},push:function(t){n.push(t),e()}}}((function(){return r(!0)}))})),1),a=o[0];return R_((function(){if(t){var n=a.get();n.length&&(e(n),a.reset()),r(!1)}else a.reset()}),[t]),a}var H_=n(null);function Y_(e){var n=e.children,t=Sx(),o=l((function(e){var n,r,o=t.getState(),i=o.nodes,a=void 0===i?[]:i,u=o.setNodes,c=o.hasDefaultNodes,l=o.onNodesChange,s=o.nodeLookup,d=a;try{for(var f=g(e),h=f.next();!h.done;h=f.next()){var v=h.value;d="function"==typeof v?v(d):v}}catch(e){n={error:e}}finally{try{h&&!h.done&&(r=f.return)&&r.call(f)}finally{if(n)throw n.error}}c?u(d):l&&l(y_({items:d,lookup:s}))}),[]),i=V_(o),a=l((function(e){var n,r,o=t.getState(),i=o.edges,a=void 0===i?[]:i,u=o.setEdges,c=o.hasDefaultEdges,l=o.onEdgesChange,s=o.edgeLookup,d=a;try{for(var f=g(e),h=f.next();!h.done;h=f.next()){var v=h.value;d="function"==typeof v?v(d):v}}catch(e){n={error:e}}finally{try{h&&!h.done&&(r=f.return)&&r.call(f)}finally{if(n)throw n.error}}c?u(d):l&&l(y_({items:d,lookup:s}))}),[]),u=V_(a),c=r((function(){return{nodeQueue:i,edgeQueue:u}}),[]);return S.jsx(H_.Provider,{value:c,children:n})}var X_=function(){var e=Sx();return r((function(){return{zoomIn:function(n){var t;return null===(t=e.getState().panZoom)||void 0===t?void 0:t.scaleBy(1.2,{duration:null==n?void 0:n.duration})},zoomOut:function(n){var t;return null===(t=e.getState().panZoom)||void 0===t?void 0:t.scaleBy(1/1.2,{duration:null==n?void 0:n.duration})},zoomTo:function(n,t){var r;return null===(r=e.getState().panZoom)||void 0===r?void 0:r.scaleTo(n,{duration:null==t?void 0:t.duration})},getZoom:function(){return e.getState().transform[2]},setViewport:function(n,t){var r,o,i,a=e.getState(),u=y(a.transform,3),c=u[0],l=u[1],s=u[2],d=a.panZoom;null==d||d.setViewport({x:null!==(r=n.x)&&void 0!==r?r:c,y:null!==(o=n.y)&&void 0!==o?o:l,zoom:null!==(i=n.zoom)&&void 0!==i?i:s},{duration:null==t?void 0:t.duration})},getViewport:function(){var n=y(e.getState().transform,3);return{x:n[0],y:n[1],zoom:n[2]}},fitView:function(n){var t=e.getState(),r=t.nodeLookup,o=t.width,i=t.height,a=t.nodeOrigin,u=t.minZoom,c=t.maxZoom,l=t.panZoom;return!!l&&E_({nodeLookup:r,width:o,height:i,nodeOrigin:a,minZoom:u,maxZoom:c,panZoom:l},n)},setCenter:function(n,t,r){var o=e.getState(),i=o.width,a=o.height,u=o.panZoom,c=o.transform,l=void 0!==(null==r?void 0:r.zoom)?r.zoom:c[2],s=i/2-n*l,d=a/2-t*l;null==u||u.setViewport({x:s,y:d,zoom:l},{duration:null==r?void 0:r.duration})},fitBounds:function(n,t){var r,o=e.getState(),i=o.width,a=o.height,u=o.minZoom,c=o.maxZoom,l=o.panZoom,s=Zx(n,i,a,u,c,null!==(r=null==t?void 0:t.padding)&&void 0!==r?r:.1);null==l||l.setViewport(s,{duration:null==t?void 0:t.duration})},screenToFlowPosition:function(n,t){void 0===t&&(t={snapToGrid:!0});var r=e.getState(),o=r.transform,i=r.snapGrid,a=r.domNode;if(!a)return n;var u=a.getBoundingClientRect(),c=u.x,l=u.y,s={x:n.x-c,y:n.y-l};return Lx(s,o,t.snapToGrid,i)},flowToScreenPosition:function(n){var t=e.getState(),r=t.transform,o=t.domNode;if(!o)return n;var i=o.getBoundingClientRect(),a=i.x,u=i.y,c=function(e,n){var t=e.x,r=e.y,o=y(n,3),i=o[0],a=o[1],u=o[2];return{x:t*u+i,y:r*u+a}}(n,r);return{x:c.x+a,y:c.y+u}}}}),[])},Z_=function(e){return!!e.panZoom};function F_(){var e=this,n=X_(),o=Sx(),i=function(){var e=t(H_);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}(),a=Ex(Z_);console.log("yk store",o.getState());var u=r((function(){var n=function(e){return o.getState().nodeLookup.get(e)},t=function(e){i.nodeQueue.push(e)},r=function(e){var n,t,r,i,a=o.getState(),u=a.nodeLookup,c=a.nodeOrigin,l=Wx(e)?e:u.get(e.id),s=l.parentId?function(e,n,t,r){var o,i;void 0===r&&(r=[0,0]);for(var a=n,u=f({},e);a;){var c=t.get(n);if(a=null==c?void 0:c.parentId,c){var l=c.origin||r,s=(null!==(o=c.measured.width)&&void 0!==o?o:0)*l[0],d=(null!==(i=c.measured.height)&&void 0!==i?i:0)*l[1];u.x+=c.position.x-s,u.y+=c.position.y-d}}return u}(l.position,l.parentId,u,c):l.position,d={id:l.id,position:s,width:null!==(t=null===(n=l.measured)||void 0===n?void 0:n.width)&&void 0!==t?t:l.width,height:null!==(i=null===(r=l.measured)||void 0===r?void 0:r.height)&&void 0!==i?i:l.height,data:l.data};return Bx(d)},a=function(e,n,r){void 0===r&&(r={replace:!1}),t((function(t){return t.map((function(t){if(t.id===e){var o="function"==typeof n?n(t):n;return r.replace&&Wx(o)?o:f(f({},t),o)}return t}))}))};return{getNodes:function(){return o.getState().nodes.map((function(e){return f({},e)}))},getNode:function(e){var t;return null===(t=n(e))||void 0===t?void 0:t.internals.userNode},getInternalNode:n,getEdges:function(){var e=o.getState().edges;return(void 0===e?[]:e).map((function(e){return f({},e)}))},getEdge:function(e){return o.getState().edgeLookup.get(e)},setNodes:t,setEdges:function(e){i.edgeQueue.push(e)},addNodes:function(e){var n=Array.isArray(e)?e:[e];i.nodeQueue.push((function(e){return m(m([],y(e),!1),y(n),!1)}))},addEdges:function(e){var n=Array.isArray(e)?e:[e];i.edgeQueue.push((function(e){return m(m([],y(e),!1),y(n),!1)}))},toObject:function(){var e=o.getState(),n=e.nodes,t=void 0===n?[]:n,r=e.edges,i=void 0===r?[]:r,a=y(e.transform,3),u=a[0],c=a[1],l=a[2];return{nodes:t.map((function(e){return f({},e)})),edges:i.map((function(e){return f({},e)})),viewport:{x:u,y:c,zoom:l}}},deleteElements:function(n){return v(e,[n],void 0,(function(e){var n,t,r,i,a,u,c,l,s,d,f,h,v,g,y,m,w=e.nodes,b=void 0===w?[]:w,x=e.edges,_=void 0===x?[]:x;return p(this,(function(e){switch(e.label){case 0:return n=o.getState(),t=n.nodes,r=n.edges,i=n.onNodesDelete,a=n.onEdgesDelete,u=n.triggerNodeChanges,c=n.triggerEdgeChanges,l=n.onDelete,s=n.onBeforeDelete,[4,k_({nodesToRemove:b,edgesToRemove:_,nodes:t,edges:r,onBeforeDelete:s})];case 1:return d=e.sent(),f=d.nodes,h=d.edges,v=h.length>0,g=f.length>0,v&&(y=h.map(m_),null==a||a(h),c(y)),g&&(m=f.map(m_),null==i||i(f),u(m)),(g||v)&&(null==l||l({nodes:f,edges:h})),[2,{deletedNodes:f,deletedEdges:h}]}}))}))},getIntersectingNodes:function(e,n,t){void 0===n&&(n=!0);var i=qx(e),a=i?e:r(e),u=void 0!==t;return a?(t||o.getState().nodes).filter((function(t){var r=o.getState().nodeLookup.get(t.id);if(r&&!i&&(t.id===e.id||!r.internals.positionAbsolute))return!1;var c=Bx(u?t:r),l=Xx(c,a);return n&&l>0||l>=a.width*a.height})):[]},isNodeIntersecting:function(e,n,t){void 0===t&&(t=!0);var o=qx(e)?e:r(e);if(!o)return!1;var i=Xx(o,n);return t&&i>0||i>=o.width*o.height},updateNode:a,updateNodeData:function(e,n,t){void 0===t&&(t={replace:!1}),a(e,(function(e){var r="function"==typeof n?n(e):n;return t.replace?f(f({},e),{data:r}):f(f({},e),{data:f(f({},e.data),r)})}),t)},checkAllNodeBeMeasured:function(){return o.getState().nodes.every((function(e){return e.measured}))}}}),[]);return r((function(){return f(f(f({},u),n),{viewportInitialized:a})}),[a])}var U_=function(e){return e.updateNodeInternals};var W_=function(e){return function(n){return e?x_(n.nodeLookup,{x:0,y:0,width:n.width,height:n.height},n.transform,!0).map((function(e){return e.id})):Array.from(n.nodeLookup.keys())}};var G_=n(null),q_=G_.Provider;G_.Consumer;var $_="ink-flow__node-desc",K_="ink-flow__edge-desc";function Q_(e){var n=e.sourceX,t=e.sourceY,r=e.targetX,o=e.targetY,i=e.sourceControlX,a=e.sourceControlY,u=.125*n+.375*i+.375*e.targetControlX+.125*r,c=.125*t+.375*a+.375*e.targetControlY+.125*o;return[u,c,Math.abs(u-n),Math.abs(c-t)]}function J_(e,n){return e>=0?.5*e:25*n*Math.sqrt(-e)}function eE(e){var n=e.pos,t=e.x1,r=e.y1,o=e.x2,i=e.y2,a=e.c;switch(n){case Kv.Left:return[t-J_(t-o,a),r];case Kv.Right:return[t+J_(o-t,a),r];case Kv.Top:return[t,r-J_(r-i,a)];case Kv.Bottom:return[t,r+J_(i-r,a)]}}function nE(e){var n=e.sourceX,t=e.sourceY,r=e.targetX,o=e.targetY,i=Math.abs(r-n)/2,a=r<n?r+i:r-i,u=Math.abs(o-t)/2;return[a,o<t?o+u:o-u,i,u]}var tE,rE=function(e){var n=e.source,t=e.sourceHandle,r=e.target,o=e.targetHandle;return"xy-edge__".concat(n).concat(t||"","-").concat(r).concat(o||"")};var oE=((tE={})[Kv.Left]={x:-1,y:0},tE[Kv.Right]={x:1,y:0},tE[Kv.Top]={x:0,y:-1},tE[Kv.Bottom]={x:0,y:1},tE),iE=function(e){var n=e.source,t=e.sourcePosition,r=void 0===t?Kv.Bottom:t,o=e.target;return r===Kv.Left||r===Kv.Right?n.x<o.x?{x:1,y:0}:{x:-1,y:0}:n.y<o.y?{x:0,y:1}:{x:0,y:-1}},aE=function(e,n){return Math.sqrt(Math.pow(n.x-e.x,2)+Math.pow(n.y-e.y,2))};function uE(e){var n=e.sourceX,t=e.sourceY,r=e.sourcePosition,o=void 0===r?Kv.Bottom:r,i=e.targetX,a=e.targetY,u=e.targetPosition,c=void 0===u?Kv.Top:u,l=e.borderRadius,s=void 0===l?5:l,d=e.centerX,f=e.centerY,h=e.offset,v=y(function(e){var n,t,r,o,i=e.source,a=e.sourcePosition,u=void 0===a?Kv.Bottom:a,c=e.target,l=e.targetPosition,s=void 0===l?Kv.Top:l,d=e.center,f=e.offset,h=oE[u],v=oE[s],p={x:i.x+h.x*f,y:i.y+h.y*f},g={x:c.x+v.x*f,y:c.y+v.y*f},w=iE({source:p,sourcePosition:u,target:g}),b=0!==w.x?"x":"y",x=w[b],_=[],E={x:0,y:0},S={x:0,y:0},k=y(nE({sourceX:i.x,sourceY:i.y,targetX:c.x,targetY:c.y}),4),N=k[0],C=k[1],M=k[2],O=k[3];if(h[b]*v[b]==-1){r=null!==(n=d.x)&&void 0!==n?n:N,o=null!==(t=d.y)&&void 0!==t?t:C;var j=[{x:r,y:p.y},{x:r,y:g.y}],P=[{x:p.x,y:o},{x:g.x,y:o}];_=h[b]===x?"x"===b?j:P:"x"===b?P:j}else{var I=[{x:p.x,y:g.y}],A=[{x:g.x,y:p.y}];if(_="x"===b?h.x===x?A:I:h.y===x?I:A,u===s){var z=Math.abs(i[b]-c[b]);if(z<=f){var T=Math.min(f-1,f-z);h[b]===x?E[b]=(p[b]>i[b]?-1:1)*T:S[b]=(g[b]>c[b]?-1:1)*T}}if(u!==s){var L="x"===b?"y":"x",B=h[b]===v[L],D=p[L]>g[L],R=p[L]<g[L];(1===h[b]&&(!B&&D||B&&R)||1!==h[b]&&(!B&&R||B&&D))&&(_="x"===b?I:A)}var V={x:p.x+E.x,y:p.y+E.y},H={x:g.x+S.x,y:g.y+S.y};Math.max(Math.abs(V.x-_[0].x),Math.abs(H.x-_[0].x))>=Math.max(Math.abs(V.y-_[0].y),Math.abs(H.y-_[0].y))?(r=(V.x+H.x)/2,o=_[0].y):(r=_[0].x,o=(V.y+H.y)/2)}return[m(m([i,{x:p.x+E.x,y:p.y+E.y}],y(_),!1),[{x:g.x+S.x,y:g.y+S.y},c],!1),r,o,M,O]}({source:{x:n,y:t},sourcePosition:o,target:{x:i,y:a},targetPosition:c,center:{x:d,y:f},offset:void 0===h?20:h}),5),p=v[0],g=v[1],w=v[2],b=v[3],x=v[4],_=p.reduce((function(e,n,t){var r="";return r=t>0&&t<p.length-1?function(e,n,t,r){var o=Math.min(aE(e,n)/2,aE(n,t)/2,r),i=n.x,a=n.y;if(e.x===i&&i===t.x||e.y===a&&a===t.y)return"L".concat(i," ").concat(a);if(e.y===a){var u=e.x<t.x?-1:1,c=e.y<t.y?1:-1;return"L ".concat(i+o*u,",").concat(a,"Q ").concat(i,",").concat(a," ").concat(i,",").concat(a+o*c)}var l=e.x<t.x?1:-1,s=e.y<t.y?-1:1;return"L ".concat(i,",").concat(a+o*s,"Q ").concat(i,",").concat(a," ").concat(i+o*l,",").concat(a)}(p[t-1],n,p[t+1],s):"".concat(0===t?"M":"L").concat(n.x," ").concat(n.y),e+=r}),"");return[_,g,w,b,x]}var cE=function(e){return{connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}};var lE=c(Yx((function(e,n){var r,o,i=e.type,a=void 0===i?"source":i,u=e.position,c=void 0===u?Kv.Top:u,l=e.isValidConnection,s=e.isConnectable,d=void 0===s||s,v=e.isConnectableStart,p=void 0===v||v,g=e.isConnectableEnd,y=void 0===g||g,m=e.id,w=e.onConnect,b=e.children,x=e.className,_=e.onMouseDown,E=e.onTouchStart,k=h(e,["type","position","isValidConnection","isConnectable","isConnectableStart","isConnectableEnd","id","onConnect","children","className","onMouseDown","onTouchStart"]),N=m||null,C="target"===a,M=Sx(),j=t(G_),P=Ex(cE,a_),I=P.connectOnClick,A=P.noPanClassName,z=P.rfId,T=Ex(function(e,n,t){return function(r){var o=r.connectionStartHandle,i=r.connectionEndHandle,a=r.connectionClickStartHandle,u=r.connectionMode,c=r.connectionStatus,l=(null==i?void 0:i.nodeId)===e&&(null==i?void 0:i.handleId)===n&&(null==i?void 0:i.type)===t;return{connectingFrom:(null==o?void 0:o.nodeId)===e&&(null==o?void 0:o.handleId)===n&&(null==o?void 0:o.type)===t,connectingTo:l,clickConnecting:(null==a?void 0:a.nodeId)===e&&(null==a?void 0:a.handleId)===n&&(null==a?void 0:a.type)===t,isPossibleEndHandle:u===Uv.Strict?(null==o?void 0:o.type)!==t:e!==(null==o?void 0:o.nodeId)||n!==(null==o?void 0:o.handleId),connectionInProcess:!!o,valid:l&&"valid"===c}}}(j,N,a),a_),L=T.connectingFrom,B=T.connectingTo,D=T.clickConnecting,R=T.isPossibleEndHandle,V=T.connectionInProcess,H=T.valid;j||null===(o=(r=M.getState()).onError)||void 0===o||o.call(r,"010",yv.error010());var Y=function(e){var n=M.getState(),t=n.defaultEdgeOptions,r=n.onConnect,o=n.hasDefaultEdges,i=f(f({},t),e);if(o){var a=M.getState(),u=a.edges;(0,a.setEdges)(function(e,n){return e.source&&e.target?function(e,n){return n.some((function(n){return!(n.source!==e.source||n.target!==e.target||n.sourceHandle!==e.sourceHandle&&(n.sourceHandle||e.sourceHandle)||n.targetHandle!==e.targetHandle&&(n.targetHandle||e.targetHandle))}))}(t="id"in(r=e)&&"source"in r&&"target"in r?f({},e):f(f({},e),{id:rE(e)}),n)?n:(null===t.sourceHandle&&delete t.sourceHandle,null===t.targetHandle&&delete t.targetHandle,n.concat(t)):n;var t,r}(i,u))}null==r||r(i),null==w||w(i)},X=function(e){if(j){var n=Jx(e.nativeEvent);if(p&&(n&&0===e.button||!n)){var t=M.getState();tw.onPointerDown(e.nativeEvent,{autoPanOnConnect:t.autoPanOnConnect,connectionMode:t.connectionMode,connectionRadius:t.connectionRadius,domNode:t.domNode,nodeLookup:t.nodeLookup,lib:t.lib,isTarget:C,handleId:N,nodeId:j,flowId:t.rfId,panBy:t.panBy,cancelConnection:t.cancelConnection,onConnectStart:t.onConnectStart,onConnectEnd:t.onConnectEnd,updateConnection:t.updateConnection,onConnect:Y,isValidConnection:l||t.isValidConnection,getTransform:function(){return M.getState().transform},getConnectionStartHandle:function(){return M.getState().connectionStartHandle}})}n?null==_||_(e):null==E||E(e)}};return S.jsx("div",f({"data-handleid":N,"data-nodeid":j,"data-handlepos":c,"data-id":"".concat(z,"-").concat(j,"-").concat(N,"-").concat(a),className:O(["ink-flow__handle","ink-flow__handle-".concat(c),"nodrag",A,x,{source:!C,target:C,connectable:d,connectablestart:p,connectableend:y,clickconnecting:D,connectingfrom:L,connectingto:B,valid:H,connectionindicator:d&&(!V||R)&&(V?y:p)}]),onMouseDown:X,onTouchStart:X,onClick:I?function(e){var n=M.getState(),t=n.onClickConnectStart,r=n.onClickConnectEnd,o=n.connectionClickStartHandle,i=n.connectionMode,u=n.isValidConnection,c=n.lib,s=n.rfId;if(j&&(o||p)){if(!o)return null==t||t(e.nativeEvent,{nodeId:j,handleId:N,handleType:a}),void M.setState({connectionClickStartHandle:{nodeId:j,type:a,handleId:N}});var d=function(e){var n;return(null===(n=e.getRootNode)||void 0===n?void 0:n.call(e))||(null===window||void 0===window?void 0:window.document)}(e.target),f=l||u,h=tw.isValid(e.nativeEvent,{handle:{nodeId:j,id:N,type:a},connectionMode:i,fromNodeId:o.nodeId,fromHandleId:o.handleId||null,fromType:o.type,isValidConnection:f,flowId:s,doc:d,lib:c}),v=h.connection;h.isValid&&v&&Y(v),null==r||r(e),M.setState({connectionClickStartHandle:null})}}:void 0,ref:n},k,{children:b}))})));var sE={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},dE={input:function(e){var n=e.data,t=e.isConnectable,r=e.sourcePosition,o=void 0===r?Kv.Bottom:r;return S.jsxs(S.Fragment,{children:[null==n?void 0:n.label,S.jsx(lE,{type:"source",position:o,isConnectable:t})]})},default:function(e){var n=e.data,t=e.isConnectable,r=e.targetPosition,o=void 0===r?Kv.Top:r,i=e.sourcePosition,a=void 0===i?Kv.Bottom:i;return S.jsxs(S.Fragment,{children:[S.jsx(lE,{type:"target",position:o,isConnectable:t}),null==n?void 0:n.label,S.jsx(lE,{type:"source",position:a,isConnectable:t})]})},output:function(e){var n=e.data,t=e.isConnectable,r=e.targetPosition,o=void 0===r?Kv.Top:r;return S.jsxs(S.Fragment,{children:[S.jsx(lE,{type:"target",position:o,isConnectable:t}),null==n?void 0:n.label]})},group:function(){return null}};function fE(e){var n=e.id,t=e.store,r=e.unselect,o=void 0!==r&&r,i=e.nodeRef,a=t.getState(),u=a.addSelectedNodes,c=a.unselectNodesAndEdges,l=a.multiSelectionActive,s=a.nodeLookup,d=a.onError,f=s.get(n);f?(t.setState({nodesSelectionActive:!1}),f.selected?(o||f.selected&&l)&&(c({nodes:[f],edges:[]}),requestAnimationFrame((function(){var e;return null===(e=null==i?void 0:i.current)||void 0===e?void 0:e.blur()}))):u([n])):null==d||d("012",yv.error012(n))}var hE=function(e){return function(n){return n.selected&&(n.draggable||e&&void 0===n.draggable)}};function vE(e){var n,t=e.id,r=e.onClick,o=e.onMouseEnter,c=e.onMouseMove,s=e.onMouseLeave,d=e.onContextMenu,h=e.onDoubleClick,v=e.nodesDraggable,p=e.elementsSelectable,m=e.nodesConnectable,w=e.nodesFocusable,b=e.resizeObserver,x=e.noDragClassName,_=e.noPanClassName,E=e.disableKeyboardA11y,k=e.rfId,N=e.nodeTypes,C=e.nodeExtent,M=e.nodeOrigin,j=e.onError,P=Ex((function(e){var n=e.nodeLookup.get(t),r=e.parentLookup.has(t);return{node:n,internals:n.internals,isParent:r}}),a_),I=P.node,A=P.internals,z=P.isParent,T=I.type||"default",L=(null==N?void 0:N[T])||dE[T];void 0===L&&(null==j||j("003",yv.error003(T)),T="default",L=dE.default);var B=!!(I.draggable||v&&void 0===I.draggable),D=!!(I.selectable||p&&void 0===I.selectable),R=!!(I.connectable||m&&void 0===I.connectable),V=!!(I.focusable||w&&void 0===I.focusable),H=Sx(),Y=function(e){var n,t,r,o,i,a;return void 0!==(null!==(r=null!==(t=null===(n=e.measured)||void 0===n?void 0:n.width)&&void 0!==t?t:e.width)&&void 0!==r?r:e.initialWidth)&&void 0!==(null!==(a=null!==(i=null===(o=e.measured)||void 0===o?void 0:o.height)&&void 0!==i?i:e.height)&&void 0!==a?a:e.initialHeight)}(I),X=function(e){var n=e.node,t=e.nodeType,r=e.hasDimensions,o=e.resizeObserver,i=Sx(),c=a(null),l=a(null),s=a(n.sourcePosition),d=a(n.targetPosition),f=a(t),h=r&&!!n.internals.handleBounds&&!n.hidden;return u((function(){!c.current||h&&l.current===c.current||(l.current&&(null==o||o.unobserve(l.current)),null==o||o.observe(c.current),l.current=c.current)}),[h]),u((function(){return function(){l.current&&(null==o||o.unobserve(l.current),l.current=null)}}),[]),u((function(){if(c.current){var e=f.current!==t,r=s.current!==n.sourcePosition,o=d.current!==n.targetPosition;(e||r||o)&&(f.current=t,s.current=n.sourcePosition,d.current=n.targetPosition,i.getState().updateNodeInternals(new Map([[n.id,{id:n.id,nodeElement:c.current,force:!0}]])))}}),[n.id,t,n.sourcePosition,n.targetPosition]),c}({node:I,nodeType:T,hasDimensions:Y,resizeObserver:b}),Z=function(e){var n=e.nodeRef,t=e.disabled,r=void 0!==t&&t,o=e.noDragClassName,c=e.handleSelector,l=e.nodeId,s=e.isSelectable,d=Sx(),f=y(i(!1),2),h=f[0],v=f[1],p=a();return u((function(){p.current=$m({getStoreItems:function(){return d.getState()},onNodeMouseDown:function(e){fE({id:e,store:d,nodeRef:n})},onDragStart:function(){v(!0)},onDragStop:function(){v(!1)}})}),[]),u((function(){var e,t;if(r)null===(e=p.current)||void 0===e||e.destroy();else if(n.current)return null===(t=p.current)||void 0===t||t.update({noDragClassName:o,handleSelector:c,domNode:n.current,isSelectable:s,nodeId:l}),function(){var e;null===(e=p.current)||void 0===e||e.destroy()}}),[o,c,r,s,n,l]),h}({nodeRef:X,disabled:I.hidden||!B,noDragClassName:x,handleSelector:I.dragHandle,nodeId:t,isSelectable:D}),F=function(){var e=Sx(),n=l((function(n){var t,r,o=e.getState(),i=o.nodeExtent,a=o.snapToGrid,u=o.snapGrid,c=o.nodesDraggable,l=o.onError,s=o.updateNodePositions,d=o.nodeLookup,f=o.nodeOrigin,h=new Map,v=hE(c),p=a?u[0]:5,m=a?u[1]:5,w=n.direction.x*p*n.factor,b=n.direction.y*m*n.factor;try{for(var x=g(d),_=x.next();!_.done;_=x.next()){var E=y(_.value,2)[1];if(v(E)){var S={x:E.internals.positionAbsolute.x+w,y:E.internals.positionAbsolute.y+b};a&&(S=Tx(S,u));var k=S_({nodeId:E.id,nextPosition:S,nodeLookup:d,nodeExtent:i,nodeOrigin:f,onError:l}),N=k.position,C=k.positionAbsolute;E.position=N,E.internals.positionAbsolute=C,h.set(E.id,E)}}}catch(e){t={error:e}}finally{try{_&&!_.done&&(r=x.return)&&r.call(x)}finally{if(t)throw t.error}}s(h)}),[]);return n}();if(I.hidden)return null;var U=Ax(I),W=function(e){var n,t,r,o,i,a,u,c,l,s;return void 0===e.internals.handleBounds?{width:null!==(t=null!==(n=e.width)&&void 0!==n?n:e.initialWidth)&&void 0!==t?t:null===(r=e.style)||void 0===r?void 0:r.width,height:null!==(i=null!==(o=e.height)&&void 0!==o?o:e.initialHeight)&&void 0!==i?i:null===(a=e.style)||void 0===a?void 0:a.height}:{width:null!==(u=e.width)&&void 0!==u?u:null===(c=e.style)||void 0===c?void 0:c.width,height:null!==(l=e.height)&&void 0!==l?l:null===(s=e.style)||void 0===s?void 0:s.height}}(I),G=C?Ix(A.positionAbsolute,C):A.positionAbsolute,q=Ux(f(f(f({},G),U),{origin:I.origin||M})),$=D||B||r||o||c||s,K=o?function(e){return o(e,f({},A.userNode))}:void 0,Q=c?function(e){return c(e,f({},A.userNode))}:void 0,J=s?function(e){return s(e,f({},A.userNode))}:void 0,ee=d?function(e){return d(e,f({},A.userNode))}:void 0,ne=h?function(e){return h(e,f({},A.userNode))}:void 0;return S.jsx("div",{className:O(["ink-flow__node","ink-flow__node-".concat(T),(n={},n[_]=B,n),I.className,{selected:I.selected,selectable:D,parent:z,draggable:B,dragging:Z}]),ref:X,style:f(f({zIndex:A.z,transform:"translate(".concat(q.x,"px,").concat(q.y,"px)"),pointerEvents:$?"all":"none",visibility:Y?"visible":"hidden"},I.style),W),"data-id":t,"data-testid":"rf__node-".concat(t),onMouseEnter:K,onMouseMove:Q,onMouseLeave:J,onContextMenu:ee,onClick:function(e){var n=H.getState(),o=n.selectNodesOnDrag,i=n.nodeDragThreshold;D&&(!o||!B||i>0)&&fE({id:t,store:H,nodeRef:X}),r&&r(e,f({},A.userNode))},onDoubleClick:ne,onKeyDown:V?function(e){if(!Qx(e.nativeEvent)&&!E)if(wv.includes(e.key)&&D){var n="Escape"===e.key;fE({id:t,store:H,unselect:n,nodeRef:X})}else B&&I.selected&&Object.prototype.hasOwnProperty.call(sE,e.key)&&(H.setState({ariaLiveMessage:"Moved selected node ".concat(e.key.replace("Arrow","").toLowerCase(),". New position, x: ").concat(~~G.x,", y: ").concat(~~G.y)}),F({direction:sE[e.key],factor:e.shiftKey?4:1}))}:void 0,tabIndex:V?0:void 0,role:V?"button":void 0,"aria-describedby":E?void 0:"".concat($_,"-").concat(k),"aria-label":I.ariaLabel,children:S.jsx(q_,{value:t,children:S.jsx(L,f({id:t,data:I.data,type:T,positionAbsoluteX:G.x,positionAbsoluteY:G.y,selected:I.selected,isConnectable:R,sourcePosition:I.sourcePosition,targetPosition:I.targetPosition,dragging:Z,dragHandle:I.dragHandle,zIndex:A.z},U))})})}var pE=function(e){return{nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError}};function gE(e){var n,t=Ex(pE,a_),r=t.nodesDraggable,o=t.nodesConnectable,a=t.nodesFocusable,c=t.elementsSelectable,s=t.onError,d=Ex(l(W_(n=!1),[n]),a_),f=function(){var e=Ex(U_),n=y(i((function(){return"undefined"==typeof ResizeObserver?null:new ResizeObserver((function(n){var t=new Map;n.forEach((function(e){var n=e.target.getAttribute("data-id");t.set(n,{id:n,nodeElement:e.target})})),e(t)}))})),1),t=n[0];return u((function(){return function(){null==t||t.disconnect()}}),[t]),t}();return S.jsx("div",{className:"ink-flow__nodes",style:u_,children:d.map((function(n){return S.jsx(vE,{id:n,nodeTypes:e.nodeTypes,nodeOrigin:e.nodeOrigin,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:f,nodesDraggable:r,nodesConnectable:o,nodesFocusable:a,elementsSelectable:c,onError:s},n)}))})}gE.displayName="NodeRenderer";var yE,mE=c(gE),wE=((yE={})[$v.Arrow]=function(e){var n=e.color,t=void 0===n?"none":n,r=e.strokeWidth,o=void 0===r?1:r;return S.jsx("polyline",{style:{stroke:t,strokeWidth:o},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"})},yE[$v.ArrowClosed]=function(e){var n=e.color,t=void 0===n?"none":n,r=e.strokeWidth,o=void 0===r?1:r;return S.jsx("polyline",{style:{stroke:t,fill:t,strokeWidth:o},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},yE);function bE(e,n){if(!e)return"";if("string"==typeof e)return e;var t=n?"".concat(n,"__"):"";return"".concat(t).concat(Object.keys(e).sort().map((function(n){return"".concat(n,"=").concat(e[n])})).join("&"))}var xE=function(e){var n=e.id,t=e.type,o=e.color,i=e.width,a=void 0===i?12.5:i,u=e.height,c=void 0===u?12.5:u,l=e.markerUnits,s=void 0===l?"strokeWidth":l,d=e.strokeWidth,f=e.orient,h=void 0===f?"auto-start-reverse":f,v=function(e){var n=Sx(),t=r((function(){var t,r;return Object.prototype.hasOwnProperty.call(wE,e)?wE[e]:(null===(r=(t=n.getState()).onError)||void 0===r||r.call(t,"009",yv.error009(e)),null)}),[e]);return t}(t);return v?S.jsx("marker",{className:"ink-flow__arrowhead",id:n,markerWidth:"".concat(a),markerHeight:"".concat(c),viewBox:"-10 -10 20 20",markerUnits:s,orient:h,refX:"0",refY:"0",children:S.jsx(v,{color:o,strokeWidth:d})}):null},_E=function(e){var n=e.defaultColor,t=e.rfId,o=Ex((function(e){return e.edges})),i=Ex((function(e){return e.defaultEdgeOptions})),a=r((function(){var e=function(e,n){var t=n.id,r=n.defaultColor,o=n.defaultMarkerStart,i=n.defaultMarkerEnd,a=new Set;return e.reduce((function(e,n){return[n.markerStart||o,n.markerEnd||i].forEach((function(n){if(n&&"object"==typeof n){var o=bE(n,t);a.has(o)||(e.push(f({id:o,color:n.color||r},n)),a.add(o))}})),e}),[]).sort((function(e,n){return e.id.localeCompare(n.id)}))}(o,{id:t,defaultColor:n,defaultMarkerStart:null==i?void 0:i.markerStart,defaultMarkerEnd:null==i?void 0:i.markerEnd});return e}),[o,i,t,n]);return a.length?S.jsx("svg",{className:"ink-flow__marker",children:S.jsx("defs",{children:a.map((function(e){return S.jsx(xE,{id:e.id,type:e.type,color:e.color,width:e.width,height:e.height,markerUnits:e.markerUnits,strokeWidth:e.strokeWidth,orient:e.orient},e.id)}))})}):null};_E.displayName="MarkerDefinitions";var EE=c(_E);function SE(e){var n=e.x,t=e.y,r=e.label,o=e.labelStyle,a=void 0===o?{}:o,u=e.labelShowBg,c=void 0===u||u,s=e.labelBgStyle,d=void 0===s?{}:s,v=e.labelBgPadding,p=void 0===v?[2,4]:v,g=e.labelBgBorderRadius,m=void 0===g?2:g,w=e.children,b=e.className,x=h(e,["x","y","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","children","className"]),_=y(i({x:1,y:0,width:0,height:0}),2),E=_[0],k=_[1],N=O(["ink-flow__edge-textwrapper",b]),C=l((function(e){if(null!==e){var n=e.getBBox();k({x:n.x,y:n.y,width:n.width,height:n.height})}}),[]);return void 0!==r&&r?S.jsxs("g",f({transform:"translate(".concat(n-E.width/2," ").concat(t-E.height/2,")"),className:N,visibility:E.width?"visible":"hidden"},x,{children:[c&&S.jsx("rect",{width:E.width+2*p[0],x:-p[0],y:-p[1],height:E.height+2*p[1],className:"ink-flow__edge-textbg",style:d,rx:m,ry:m}),S.jsx("text",{className:"ink-flow__edge-text",y:E.height/2,dy:"0.3em",ref:C,style:a,children:r}),w]})):null}SE.displayName="EdgeText";var kE=c(SE);function NE(e){var n=e.id,t=e.path,r=e.labelX,o=e.labelY,i=e.label,a=e.labelStyle,u=e.labelShowBg,c=e.labelBgStyle,l=e.labelBgPadding,s=e.labelBgBorderRadius,d=e.style,f=e.markerEnd,h=e.markerStart,v=e.className,p=e.interactionWidth,g=void 0===p?20:p;return S.jsxs(S.Fragment,{children:[S.jsx("path",{id:n,style:d,d:t,fill:"none",className:O(["ink-flow__edge-path",v]),markerEnd:f,markerStart:h}),g&&S.jsx("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:g,className:"ink-flow__edge-interaction"}),i&&zx(r)&&zx(o)?S.jsx(kE,{x:r,y:o,label:i,labelStyle:a,labelShowBg:u,labelBgStyle:c,labelBgPadding:l,labelBgBorderRadius:s}):null]})}function CE(e){var n=e.pos,t=e.x1,r=e.y1,o=e.x2,i=e.y2;return n===Kv.Left||n===Kv.Right?[.5*(t+o),r]:[t,.5*(r+i)]}function ME(e){var n=e.sourceX,t=e.sourceY,r=e.sourcePosition,o=void 0===r?Kv.Bottom:r,i=e.targetX,a=e.targetY,u=e.targetPosition,c=void 0===u?Kv.Top:u,l=y(CE({pos:o,x1:n,y1:t,x2:i,y2:a}),2),s=l[0],d=l[1],f=y(CE({pos:c,x1:i,y1:a,x2:n,y2:t}),2),h=f[0],v=f[1],p=y(Q_({sourceX:n,sourceY:t,targetX:i,targetY:a,sourceControlX:s,sourceControlY:d,targetControlX:h,targetControlY:v}),4),g=p[0],m=p[1],w=p[2],b=p[3];return["M".concat(n,",").concat(t," C").concat(s,",").concat(d," ").concat(h,",").concat(v," ").concat(i,",").concat(a),g,m,w,b]}function OE(e){return c((function(n){var t=n.id,r=n.sourceX,o=n.sourceY,i=n.targetX,a=n.targetY,u=n.sourcePosition,c=void 0===u?Kv.Bottom:u,l=n.targetPosition,s=void 0===l?Kv.Top:l,d=n.label,f=n.labelStyle,h=n.labelShowBg,v=n.labelBgStyle,p=n.labelBgPadding,g=n.labelBgBorderRadius,m=n.style,w=n.markerEnd,b=n.markerStart,x=n.interactionWidth,_=y(ME({sourceX:r,sourceY:o,sourcePosition:c,targetX:i,targetY:a,targetPosition:s}),3),E=_[0],k=_[1],N=_[2],C=e.isInternal?void 0:t;return S.jsx(NE,{id:C,path:E,labelX:k,labelY:N,label:d,labelStyle:f,labelShowBg:h,labelBgStyle:v,labelBgPadding:p,labelBgBorderRadius:g,style:m,markerEnd:w,markerStart:b,interactionWidth:x})}))}var jE=OE({isInternal:!1}),PE=OE({isInternal:!0});function IE(e){return c((function(n){var t=n.id,r=n.sourceX,o=n.sourceY,i=n.targetX,a=n.targetY,u=n.label,c=n.labelStyle,l=n.labelShowBg,s=n.labelBgStyle,d=n.labelBgPadding,f=n.labelBgBorderRadius,h=n.style,v=n.sourcePosition,p=void 0===v?Kv.Bottom:v,g=n.targetPosition,m=void 0===g?Kv.Top:g,w=n.markerEnd,b=n.markerStart,x=n.pathOptions,_=n.interactionWidth,E=y(uE({sourceX:r,sourceY:o,sourcePosition:p,targetX:i,targetY:a,targetPosition:m,borderRadius:null==x?void 0:x.borderRadius,offset:null==x?void 0:x.offset}),3),k=E[0],N=E[1],C=E[2],M=e.isInternal?void 0:t;return S.jsx(NE,{id:M,path:k,labelX:N,labelY:C,label:u,labelStyle:c,labelShowBg:l,labelBgStyle:s,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:w,markerStart:b,interactionWidth:_})}))}jE.displayName="SimpleBezierEdge",PE.displayName="SimpleBezierEdgeInternal";var AE=IE({isInternal:!1}),zE=IE({isInternal:!0});function TE(e){return c((function(n){var t,o=n.id,i=h(n,["id"]),a=e.isInternal?void 0:o;return S.jsx(AE,f({},i,{id:a,pathOptions:r((function(){var e;return{borderRadius:0,offset:null===(e=i.pathOptions)||void 0===e?void 0:e.offset}}),[null===(t=i.pathOptions)||void 0===t?void 0:t.offset])}))}))}AE.displayName="SmoothStepEdge",zE.displayName="SmoothStepEdgeInternal";var LE=TE({isInternal:!1}),BE=TE({isInternal:!0});function DE(e){return c((function(n){var t=n.id,r=n.sourceX,o=n.sourceY,i=n.targetX,a=n.targetY,u=n.label,c=n.labelStyle,l=n.labelShowBg,s=n.labelBgStyle,d=n.labelBgPadding,f=n.labelBgBorderRadius,h=n.style,v=n.markerEnd,p=n.markerStart,g=n.interactionWidth,m=y(function(e){var n=e.sourceX,t=e.sourceY,r=e.targetX,o=e.targetY,i=y(nE({sourceX:n,sourceY:t,targetX:r,targetY:o}),4),a=i[0],u=i[1],c=i[2],l=i[3];return["M ".concat(n,",").concat(t,"L ").concat(r,",").concat(o),a,u,c,l]}({sourceX:r,sourceY:o,targetX:i,targetY:a}),3),w=m[0],b=m[1],x=m[2],_=e.isInternal?void 0:t;return S.jsx(NE,{id:_,path:w,labelX:b,labelY:x,label:u,labelStyle:c,labelShowBg:l,labelBgStyle:s,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:v,markerStart:p,interactionWidth:g})}))}LE.displayName="StepEdge",BE.displayName="StepEdgeInternal";var RE=DE({isInternal:!1}),VE=DE({isInternal:!0});function HE(e){return c((function(n){var t=n.id,r=n.sourceX,o=n.sourceY,i=n.targetX,a=n.targetY,u=n.sourcePosition,c=void 0===u?Kv.Bottom:u,l=n.targetPosition,s=void 0===l?Kv.Top:l,d=n.label,f=n.labelStyle,h=n.labelShowBg,v=n.labelBgStyle,p=n.labelBgPadding,g=n.labelBgBorderRadius,m=n.style,w=n.markerEnd,b=n.markerStart,x=n.pathOptions,_=n.interactionWidth,E=y(function(e){var n=e.sourceX,t=e.sourceY,r=e.sourcePosition,o=void 0===r?Kv.Bottom:r,i=e.targetX,a=e.targetY,u=e.targetPosition,c=void 0===u?Kv.Top:u,l=e.curvature,s=void 0===l?.25:l,d=y(eE({pos:o,x1:n,y1:t,x2:i,y2:a,c:s}),2),f=d[0],h=d[1],v=y(eE({pos:c,x1:i,y1:a,x2:n,y2:t,c:s}),2),p=v[0],g=v[1],m=y(Q_({sourceX:n,sourceY:t,targetX:i,targetY:a,sourceControlX:f,sourceControlY:h,targetControlX:p,targetControlY:g}),4),w=m[0],b=m[1],x=m[2],_=m[3];return["M".concat(n,",").concat(t," C").concat(f,",").concat(h," ").concat(p,",").concat(g," ").concat(i,",").concat(a),w,b,x,_]}({sourceX:r,sourceY:o,sourcePosition:c,targetX:i,targetY:a,targetPosition:s,curvature:null==x?void 0:x.curvature}),3),k=E[0],N=E[1],C=E[2],M=e.isInternal?void 0:t;return S.jsx(NE,{id:M,path:k,labelX:N,labelY:C,label:d,labelStyle:f,labelShowBg:h,labelBgStyle:v,labelBgPadding:p,labelBgBorderRadius:g,style:m,markerEnd:w,markerStart:b,interactionWidth:_})}))}RE.displayName="StraightEdge",VE.displayName="StraightEdgeInternal";var YE=HE({isInternal:!1}),XE=HE({isInternal:!0});YE.displayName="BezierEdge",XE.displayName="BezierEdgeInternal";var ZE={default:XE,straight:VE,step:BE,smoothstep:zE,simplebezier:PE},FE={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},UE=function(e,n,t){return t===Kv.Left?e-n:t===Kv.Right?e+n:e},WE=function(e,n,t){return t===Kv.Top?e-n:t===Kv.Bottom?e+n:e},GE="ink-flow__edgeupdater";function qE(e){var n=e.position,t=e.centerX,r=e.centerY,o=e.radius,i=void 0===o?10:o,a=e.onMouseDown,u=e.onMouseEnter,c=e.onMouseOut,l=e.type;return S.jsx("circle",{onMouseDown:a,onMouseEnter:u,onMouseOut:c,className:O([GE,"".concat(GE,"-").concat(l)]),cx:UE(t,i,n),cy:WE(r,i,n),r:i,stroke:"transparent",fill:"transparent"})}function $E(e){var n=e.isUpdatable,t=e.edgeUpdaterRadius,r=e.edge,o=e.targetHandleId,i=e.sourceHandleId,a=e.sourceX,u=e.sourceY,c=e.targetX,l=e.targetY,s=e.sourcePosition,d=e.targetPosition,f=e.onEdgeUpdate,h=e.onEdgeUpdateStart,v=e.onEdgeUpdateEnd,p=e.setUpdating,g=e.setUpdateHover,y=Sx(),m=function(e,n){if(0===e.button){var t=y.getState(),a=t.autoPanOnConnect,u=t.domNode,c=t.isValidConnection,l=t.connectionMode,s=t.connectionRadius,d=t.lib,g=t.onConnectStart,m=t.onConnectEnd,w=t.cancelConnection,b=t.nodeLookup,x=t.rfId,_=t.panBy,E=t.updateConnection,S=n?r.target:r.source,k=(n?o:i)||null,N=n?"target":"source",C=n;p(!0),null==h||h(e,r,N);tw.onPointerDown(e.nativeEvent,{autoPanOnConnect:a,connectionMode:l,connectionRadius:s,domNode:u,handleId:k,nodeId:S,nodeLookup:b,isTarget:C,edgeUpdaterType:N,lib:d,flowId:x,cancelConnection:w,panBy:_,isValidConnection:c,onConnect:function(e){return null==f?void 0:f(r,e)},onConnectStart:g,onConnectEnd:m,onEdgeUpdateEnd:function(e){p(!1),null==v||v(e,r,N)},updateConnection:E,getTransform:function(){return y.getState().transform},getConnectionStartHandle:function(){return y.getState().connectionStartHandle}})}},w=function(){return g(!0)},b=function(){return g(!1)};return S.jsxs(S.Fragment,{children:[("source"===n||!0===n)&&S.jsx(qE,{position:s,centerX:a,centerY:u,radius:t,onMouseDown:function(e){return m(e,!0)},onMouseEnter:w,onMouseOut:b,type:"source"}),("target"===n||!0===n)&&S.jsx(qE,{position:d,centerX:c,centerY:l,radius:t,onMouseDown:function(e){return m(e,!1)},onMouseEnter:w,onMouseOut:b,type:"target"})]})}function KE(e){var n;return e&&!(!e.internals.handleBounds&&!(null===(n=e.handles)||void 0===n?void 0:n.length))&&!!(e.measured.width||e.width||e.initialWidth)}function QE(e){var n,t,r,o;if(!e)return null;var i=[],a=[];try{for(var u=g(e),c=u.next();!c.done;c=u.next()){var l=c.value;l.width=null!==(r=l.width)&&void 0!==r?r:1,l.height=null!==(o=l.height)&&void 0!==o?o:1,"source"===l.type?i.push(l):"target"===l.type&&a.push(l)}}catch(e){n={error:e}}finally{try{c&&!c.done&&(t=u.return)&&t.call(u)}finally{if(n)throw n.error}}return{source:i,target:a}}function JE(e,n,t){var r,o;void 0===t&&(t=null);var i=(null!==(r=null==t?void 0:t.x)&&void 0!==r?r:0)+n.internals.positionAbsolute.x,a=(null!==(o=null==t?void 0:t.y)&&void 0!==o?o:0)+n.internals.positionAbsolute.y,u=null!=t?t:Ax(n),c=u.width,l=u.height;switch(e){case Kv.Top:return[i+c/2,a];case Kv.Right:return[i+c,a+l/2];case Kv.Bottom:return[i+c/2,a+l];case Kv.Left:return[i,a+l/2]}}function eS(e,n){return e&&(n?e.find((function(e){return e.id===n})):e[0])||null}function nS(e){var n=e.id,t=e.edgesFocusable,o=e.edgesUpdatable,u=e.elementsSelectable,c=e.onClick,s=e.onDoubleClick,d=e.onContextMenu,h=e.onMouseEnter,v=e.onMouseMove,p=e.onMouseLeave,g=e.edgeUpdaterRadius,m=e.onEdgeUpdate,w=e.onEdgeUpdateStart,b=e.onEdgeUpdateEnd,x=e.rfId,_=e.edgeTypes,E=e.noPanClassName,k=e.onError,N=e.disableKeyboardA11y,C=Ex((function(e){return e.edgeLookup.get(n)})),M=Ex((function(e){return e.defaultEdgeOptions})),j=(C=M?f(f({},M),C):C).type||"default",P=(null==_?void 0:_[j])||ZE[j];void 0===P&&(null==k||k("011",yv.error011(j)),j="default",P=ZE.default);var I=!!(C.focusable||t&&void 0===C.focusable),A=void 0!==m&&(C.updatable||o&&void 0===C.updatable),z=!!(C.selectable||u&&void 0===C.selectable),T=a(null),L=y(i(!1),2),B=L[0],D=L[1],R=y(i(!1),2),V=R[0],H=R[1],Y=Sx(),X=Ex(l((function(e){var t=e.nodeLookup.get(C.source),r=e.nodeLookup.get(C.target);if(!t||!r)return f({zIndex:C.zIndex},FE);var o=function(e){var n,t,r,o,i,a=e.sourceNode,u=e.targetNode;if(!KE(a)||!KE(u))return null;var c=a.internals.handleBounds||QE(a.handles),l=u.internals.handleBounds||QE(u.handles),s=eS(null!==(n=null==c?void 0:c.source)&&void 0!==n?n:[],e.sourceHandle),d=eS(e.connectionMode===Uv.Strict?null!==(t=null==l?void 0:l.target)&&void 0!==t?t:[]:(null!==(r=null==l?void 0:l.target)&&void 0!==r?r:[]).concat(null!==(o=null==l?void 0:l.source)&&void 0!==o?o:[]),e.targetHandle),f=(null==s?void 0:s.position)||Kv.Bottom,h=(null==d?void 0:d.position)||Kv.Top;if(!s||!d)return null===(i=e.onError)||void 0===i||i.call(e,"008",yv.error008(s?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;var v=y(JE(f,a,s),2),p=v[0],g=v[1],m=y(JE(h,u,d),2);return{sourceX:p,sourceY:g,targetX:m[0],targetY:m[1],sourcePosition:f,targetPosition:h}}({id:n,sourceNode:t,targetNode:r,sourceHandle:C.sourceHandle||null,targetHandle:C.targetHandle||null,connectionMode:e.connectionMode,onError:k}),i=function(e){var n=e.sourceNode,t=e.targetNode,r=e.selected,o=void 0!==r&&r,i=e.zIndex,a=void 0===i?0:i,u=e.elevateOnSelect;if(void 0===u||!u)return a;var c=o||t.selected||n.selected,l=Math.max(n.internals.z||0,t.internals.z||0,1e3);return a+(c?l:0)}({selected:C.selected,zIndex:C.zIndex,sourceNode:t,targetNode:r,elevateOnSelect:e.elevateEdgesOnSelect});return f({zIndex:i},o||FE)}),[C.source,C.target,C.sourceHandle,C.targetHandle,C.selected,C.zIndex]),a_),Z=X.zIndex,F=X.sourceX,U=X.sourceY,W=X.targetX,G=X.targetY,q=X.sourcePosition,$=X.targetPosition,K=r((function(){return C.markerStart?"url('#".concat(bE(C.markerStart,x),"')"):void 0}),[C.markerStart,x]),Q=r((function(){return C.markerEnd?"url('#".concat(bE(C.markerEnd,x),"')"):void 0}),[C.markerEnd,x]);if(C.hidden||null===F||null===U||null===W||null===G)return null;var J=s?function(e){s(e,f({},C))}:void 0,ee=d?function(e){d(e,f({},C))}:void 0,ne=h?function(e){h(e,f({},C))}:void 0,te=v?function(e){v(e,f({},C))}:void 0,re=p?function(e){p(e,f({},C))}:void 0;return S.jsx("svg",{style:{zIndex:Z},children:S.jsxs("g",{className:O(["ink-flow__edge","ink-flow__edge-".concat(j),C.className,E,{selected:C.selected,animated:C.animated,inactive:!z&&!c,updating:B,selectable:z}]),onClick:function(e){var t,r=Y.getState(),o=r.addSelectedEdges,i=r.unselectNodesAndEdges,a=r.multiSelectionActive;z&&(Y.setState({nodesSelectionActive:!1}),C.selected&&a?(i({nodes:[],edges:[C]}),null===(t=T.current)||void 0===t||t.blur()):o([n])),c&&c(e,C)},onDoubleClick:J,onContextMenu:ee,onMouseEnter:ne,onMouseMove:te,onMouseLeave:re,onKeyDown:I?function(e){var t;if(!N&&wv.includes(e.key)&&z){var r=Y.getState(),o=r.unselectNodesAndEdges,i=r.addSelectedEdges;"Escape"===e.key?(null===(t=T.current)||void 0===t||t.blur(),o({edges:[C]})):i([n])}}:void 0,tabIndex:I?0:void 0,role:I?"button":"img","data-id":n,"data-testid":"rf__edge-".concat(n),"aria-label":null===C.ariaLabel?void 0:C.ariaLabel||"Edge from ".concat(C.source," to ").concat(C.target),"aria-describedby":I?"".concat(K_,"-").concat(x):void 0,ref:T,children:[!V&&S.jsx(P,{id:n,source:C.source,target:C.target,type:C.type,selected:C.selected,animated:C.animated,label:C.label,labelStyle:C.labelStyle,labelShowBg:C.labelShowBg,labelBgStyle:C.labelBgStyle,labelBgPadding:C.labelBgPadding,labelBgBorderRadius:C.labelBgBorderRadius,sourceX:F,sourceY:U,targetX:W,targetY:G,sourcePosition:q,targetPosition:$,data:C.data,style:C.style,sourceHandleId:C.sourceHandle,targetHandleId:C.targetHandle,markerStart:K,markerEnd:Q,pathOptions:"pathOptions"in C?C.pathOptions:void 0,interactionWidth:C.interactionWidth}),A&&S.jsx($E,{edge:C,isUpdatable:A,edgeUpdaterRadius:g,onEdgeUpdate:m,onEdgeUpdateStart:w,onEdgeUpdateEnd:b,sourceX:F,sourceY:U,targetX:W,targetY:G,sourcePosition:q,targetPosition:$,setUpdateHover:D,setUpdating:H,sourceHandleId:C.sourceHandle,targetHandleId:C.targetHandle})]})})}var tS=function(e){return{width:e.width,height:e.height,edgesFocusable:e.edgesFocusable,edgesUpdatable:e.edgesUpdatable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError}};function rS(e){var n=e.defaultMarkerColor,t=e.rfId,r=e.noPanClassName,o=e.onEdgeUpdate,i=e.onEdgeContextMenu,a=e.onEdgeMouseEnter,u=e.onEdgeMouseMove,c=e.onEdgeMouseLeave,s=e.onEdgeClick,d=e.edgeTypes,f=Ex(tS,a_),h=f.edgesFocusable,v=f.edgesUpdatable,p=f.elementsSelectable,g=f.onError,y=function(e){var n=Ex(l((function(e){return e.edges.map((function(e){return e.id}))}),[e]),a_);return n}(!1);return S.jsxs("div",{className:"ink-flow__edges",children:[S.jsx(EE,{defaultColor:n,rfId:t}),y.map((function(e){return S.jsx(nS,{id:e,edgesFocusable:h,edgesUpdatable:v,elementsSelectable:p,noPanClassName:r,onEdgeUpdate:o,onContextMenu:i,onMouseEnter:a,onMouseMove:u,onMouseLeave:c,onClick:s,rfId:t,onError:g,edgeTypes:d},e)}))]})}rS.displayName="EdgeRenderer";var oS,iS=c(rS),aS=function(e){return"translate(".concat(e.transform[0],"px,").concat(e.transform[1],"px) scale(").concat(e.transform[2],")")};function uS(e){var n=e.children,t=Ex(aS);return S.jsx("div",{className:"ink-flow__viewport xyflow__viewport ink-flow__container",style:{transform:t},children:n})}var cS=((oS={})[Kv.Left]=Kv.Right,oS[Kv.Right]=Kv.Left,oS[Kv.Top]=Kv.Bottom,oS[Kv.Bottom]=Kv.Top,oS),lS=function(e){var n,t,r=e.nodeId,o=e.handleType,i=e.style,a=e.type,u=void 0===a?qv.Bezier:a,c=e.CustomComponent,s=e.connectionStatus,d=Ex(l((function(e){var n;return{fromNode:e.nodeLookup.get(r),handleId:null===(n=e.connectionStartHandle)||void 0===n?void 0:n.handleId,toX:(e.connectionPosition.x-e.transform[0])/e.transform[2],toY:(e.connectionPosition.y-e.transform[1])/e.transform[2],connectionMode:e.connectionMode}}),[r]),a_),h=d.fromNode,v=d.handleId,p=d.toX,g=d.toY,m=d.connectionMode,w=null==h?void 0:h.internals.handleBounds,b=null==w?void 0:w[o];if(m===Uv.Loose&&(b=b||(null==w?void 0:w["source"===o?"target":"source"])),!h||!b)return null;var x=v?b.find((function(e){return e.id===v})):b[0],_=x?x.x+x.width/2:(null!==(n=h.measured.width)&&void 0!==n?n:0)/2,E=x?x.y+x.height/2:null!==(t=h.measured.height)&&void 0!==t?t:0,k=h.internals.positionAbsolute.x+_,N=h.internals.positionAbsolute.y+E,C=null==x?void 0:x.position,M=C?cS[C]:null;if(!C||!M)return null;if(c)return S.jsx(c,{connectionLineType:u,connectionLineStyle:i,fromNode:h,fromHandle:x,fromX:k,fromY:N,toX:p,toY:g,fromPosition:C,toPosition:M,connectionStatus:s});var O="",j={sourceX:k,sourceY:N,sourcePosition:C,targetX:p,targetY:g,targetPosition:M};return O=u===qv.Bezier?y(tp(j),1)[0]:u===qv.Step?y(dp(f(f({},j),{borderRadius:0})),1)[0]:u===qv.SmoothStep?y(dp(j),1)[0]:u===qv.SimpleBezier?y(ME(j),1)[0]:"M".concat(k,",").concat(N," ").concat(p,",").concat(g),S.jsx("path",{d:O,fill:"none",className:"react-flow__connection-path",style:i})};lS.displayName="ConnectionLine";var sS=function(e){var n,t;return{nodeId:null===(n=e.connectionStartHandle)||void 0===n?void 0:n.nodeId,handleType:null===(t=e.connectionStartHandle)||void 0===t?void 0:t.type,nodesConnectable:e.nodesConnectable,connectionStatus:e.connectionStatus,width:e.width,height:e.height}};function dS(e){var n=e.containerStyle,t=e.style,r=e.type,o=e.component,i=Ex(sS,a_),a=i.nodeId,u=i.handleType,c=i.nodesConnectable,l=i.width,s=i.height,d=i.connectionStatus;return!!(a&&u&&l&&c)?S.jsx("svg",{style:n,width:l,height:s,className:"react-flow__connectionline react-flow__container",children:S.jsx("g",{className:O(["react-flow__connection",d]),children:S.jsx(lS,{nodeId:a,handleType:u,style:t,type:r,CustomComponent:o,connectionStatus:d})})}):null}function fS(e){var n=e.onNodeClick,t=e.onNodeDoubleClick,r=e.onNodeMouseEnter,o=e.onNodeMouseMove,i=e.onNodeMouseLeave,a=e.onNodeContextMenu,u=e.onEdgeClick,c=e.onEdgeDoubleClick,l=e.onEdgeMouseEnter,s=e.onEdgeMouseMove,d=e.onEdgeMouseLeave,f=e.onEdgeContextMenu,h=e.rfId,v=e.minZoom,p=e.maxZoom,g=e.noPanClassName,y=e.noDragClassName,m=e.nodeOrigin,w=e.viewport,b=e.disableKeyboardA11y,x=e.translateExtent,_=e.defaultViewport,E=e.nodeTypes,k=e.edgeTypes,N=e.elementsSelectable,C=e.defaultMarkerColor,M=e.connectionLineType,O=e.connectionLineStyle,j=e.connectionLineComponent,P=e.connectionLineContainerStyle,I=e.onPaneClick,A=e.onPaneContextMenu,z=e.onPaneMouseEnter,T=e.onPaneMouseMove,L=e.onPaneMouseLeave,B=e.onPaneScroll;return S.jsx(A_,{minZoom:v,maxZoom:p,noPanClassName:g,noDragClassName:y,isControlledViewport:!!w,disableKeyboardA11y:b,translateExtent:x,defaultViewport:_,elementsSelectable:N,onPaneClick:I,onPaneContextMenu:A,onPaneMouseEnter:z,onPaneMouseMove:T,onPaneMouseLeave:L,onPaneScroll:B,children:S.jsxs(uS,{children:[S.jsx(iS,{rfId:h,edgeTypes:k,noPanClassName:g,onEdgeClick:u,onEdgeDoubleClick:c,onEdgeMouseEnter:l,onEdgeMouseMove:s,onEdgeMouseLeave:d,onEdgeContextMenu:f,defaultMarkerColor:C}),S.jsx(dS,{style:O,type:M,component:j,containerStyle:P}),S.jsx("div",{className:"ink-flow__edgelabel-renderer"}),S.jsx(mE,{rfId:h,nodeTypes:E,nodeOrigin:m,noDragClassName:y,noPanClassName:g,disableKeyboardA11y:!1,onNodeClick:n,onNodeDoubleClick:t,onNodeMouseEnter:r,onNodeMouseMove:o,onNodeMouseLeave:i,onNodeContextMenu:a}),S.jsx("div",{className:"ink-flow__viewport-portal"})]})})}fS.displayName="GraphView";var hS=c(fS),vS=function(e){var n,t,r=void 0===e?{}:e,o=r.nodes,i=r.edges,a=r.defaultNodes,u=r.defaultEdges;r.width,r.height,r.fitView;var c=new Map,l=new Map,s=new Map,d=new Map,f=null!==(n=null!=u?u:i)&&void 0!==n?n:[],h=null!==(t=null!=a?a:o)&&void 0!==t?t:[];Mx(s,d,f),Ox(h,c,l,{nodeOrigin:[0,0],elevateNodesOnSelect:!1});return{rfId:"1",width:0,height:0,transform:[0,0,1],nodes:h,nodeLookup:c,parentLookup:l,edges:f,edgeLookup:d,connectionLookup:s,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:void 0!==a,hasDefaultEdges:void 0!==u,panZoom:null,minZoom:.5,maxZoom:2,translateExtent:mv,nodeExtent:mv,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:Uv.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:[0,0],nodeDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesUpdatable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!1,fitViewOnInit:!1,fitViewDone:!1,fitViewOnInitOptions:void 0,selectNodesOnDrag:!0,multiSelectionActive:!1,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,connectionRadius:20,onError:void 0,isValidConnection:void 0,onSelectionChangeHandlers:[],autoLayout:!1,layoutConfig:L_,layoutTypes:{},centerConfig:{},centered:!1,lib:"react",debug:!1}},pS=function(e){var n,t,r=e.nodes,o=e.edges,i=e.defaultNodes,a=e.defaultEdges,u=e.width,c=e.height,l=e.fitView;return n=function(e,n){return f(f({},vS({nodes:r,edges:o,width:u,height:c,fitView:l,defaultNodes:i,defaultEdges:a})),{setNodes:function(t){var r=n();Ox(t,r.nodeLookup,r.parentLookup,{nodeOrigin:r.nodeOrigin,elevateNodesOnSelect:r.elevateNodesOnSelect,checkEquality:!0}),e({nodes:t})},setEdges:function(t){var r=n();Mx(r.connectionLookup,r.edgeLookup,t),e({edges:t})},setDefaultNodesAndEdges:function(t,r){t&&((0,n().setNodes)(t),e({hasDefaultNodes:!0})),r&&((0,n().setEdges)(r),e({hasDefaultEdges:!0}))},updateNodeInternals:function(e){var t=n(),r=t.triggerNodeChanges,o=t.nodeLookup,i=t.parentLookup,a=t.domNode,u=t.nodeOrigin,c=t.debug,l=function(e,n,t,r,o){var i=null==r?void 0:r.querySelector(".xyflow__viewport"),a=!1;if(!i)return{changes:[],updatedInternals:a};var u=[],c=window.getComputedStyle(i),l=new window.DOMMatrixReadOnly(c.transform).m22,s=[];if(e.forEach((function(e){var t=n.get(e.id);if(null==t?void 0:t.hidden)n.set(t.id,f(f({},t),{internals:f(f({},t.internals),{handleBounds:void 0})})),a=!0;else if(t){var r=$x(e.nodeElement),i=t.measured.width!==r.width||t.measured.height!==r.height;if(r.width&&r.height&&(i||!t.internals.handleBounds||e.force)){var c=f(f({},t),{measured:r,internals:f(f({},t.internals),{handleBounds:{source:n_(".source",e.nodeElement,l,t.origin||o),target:n_(".target",e.nodeElement,l,t.origin||o)}})});n.set(t.id,c),a=!0,i&&(u.push({id:c.id,type:"dimensions",dimensions:r}),c.expandParent&&c.parentId&&s.push({id:c.id,parentId:c.parentId,rect:Bx(c,c.origin||o)}))}}})),s.length>0){var d=jx(s,n,t,o);u.push.apply(u,m([],y(d),!1))}return{changes:u,updatedInternals:a}}(e,o,i,a,u),s=l.changes;l.updatedInternals&&(kx(o,{nodeOrigin:u}),(null==s?void 0:s.length)>0&&(c&&console.log("Ink Flow: trigger node changes",s),null==r||r(s)))},updateNodePositions:function(e,t){var r,o;void 0===t&&(t=!1);var i=[],a=[];try{for(var u=g(e),c=u.next();!c.done;c=u.next()){var l=y(c.value,2),s=l[0],d=l[1],h={id:s,type:"position",position:d.position,dragging:t};(null==d?void 0:d.expandParent)&&(null==d?void 0:d.parentId)&&h.position&&(i.push({id:s,parentId:d.parentId,rect:f(f({},d.internals.positionAbsolute),{width:d.measured.width,height:d.measured.height})}),h.position.x=Math.max(0,h.position.x),h.position.y=Math.max(0,h.position.y)),a.push(h)}}catch(e){r={error:e}}finally{try{c&&!c.done&&(o=u.return)&&o.call(u)}finally{if(r)throw r.error}}if(i.length>0){var v=n(),p=jx(i,v.nodeLookup,v.parentLookup);a.push.apply(a,m([],y(p),!1))}n().triggerNodeChanges(a)},triggerNodeChanges:function(e){var t=n(),r=t.onNodesChange,o=t.setNodes,i=t.nodes,a=t.hasDefaultNodes,u=t.debug;(null==e?void 0:e.length)&&(a&&o(v_(e,i)),u&&console.log("Ink Flow: trigger node changes",e),null==r||r(e))},triggerEdgeChanges:function(e){var t=n(),r=t.onEdgesChange,o=t.setEdges,i=t.edges,a=t.hasDefaultEdges,u=t.debug;(null==e?void 0:e.length)&&(a&&o(h_(e,i)),u&&console.log("Ink Flow: trigger edge changes",e),null==r||r(e))},addSelectedNodes:function(e){var t=n(),r=t.multiSelectionActive,o=t.edgeLookup,i=t.nodeLookup,a=t.triggerNodeChanges,u=t.triggerEdgeChanges;r?a(e.map((function(e){return p_(e,!0)}))):(a(g_(i,new Set(m([],y(e),!1)),!0)),u(g_(o)))},addSelectedEdges:function(e){var t=n(),r=t.multiSelectionActive,o=t.edgeLookup,i=t.nodeLookup,a=t.triggerNodeChanges,u=t.triggerEdgeChanges;r?u(e.map((function(e){return p_(e,!0)}))):(u(g_(o,new Set(m([],y(e),!1)))),a(g_(i,new Set,!0)))},unselectNodesAndEdges:function(e){var t=void 0===e?{}:e,r=t.nodes,o=t.edges,i=n(),a=i.edges,u=i.nodes,c=i.triggerNodeChanges,l=i.triggerEdgeChanges,s=o||a,d=(r||u).map((function(e){return e.selected=!1,p_(e.id,!1)})),f=s.map((function(e){return p_(e.id,!1)}));c(d),l(f)},setMinZoom:function(t){var r=n(),o=r.panZoom,i=r.maxZoom;null==o||o.setScaleExtent([t,i]),e({minZoom:t})},setMaxZoom:function(t){var r=n(),o=r.panZoom,i=r.minZoom;null==o||o.setScaleExtent([i,t]),e({maxZoom:t})},setTranslateExtent:function(t){var r;null===(r=n().panZoom)||void 0===r||r.setTranslateExtent(t),e({translateExtent:t})},resetSelectedElements:function(){var e=n(),t=e.edges,r=e.nodes,o=e.triggerNodeChanges,i=e.triggerEdgeChanges,a=r.reduce((function(e,n){return n.selected?m(m([],y(e),!1),[p_(n.id,!1)],!1):e}),[]),u=t.reduce((function(e,n){return n.selected?m(m([],y(e),!1),[p_(n.id,!1)],!1):e}),[]);o(a),i(u)},setNodeExtent:function(t){var r,o,i=n().nodeLookup;try{for(var a=g(i),u=a.next();!u.done;u=a.next()){var c=y(u.value,2)[1],l=Ix(c.position,t);i.set(c.id,f(f({},c),{internals:f(f({},c.internals),{positionAbsolute:l})}))}}catch(e){r={error:e}}finally{try{u&&!u.done&&(o=a.return)&&o.call(a)}finally{if(r)throw r.error}}e({nodeExtent:t})},panBy:function(e){var t=n(),r=t.transform,o=t.width,i=t.height;return function(e){var n=e.delta,t=e.panZoom,r=e.transform,o=e.translateExtent,i=e.width,a=e.height;if(!t||!n.x&&!n.y)return!1;var u=t.setViewportConstrained({x:r[0]+n.x,y:r[1]+n.y,zoom:r[2]},[[0,0],[i,a]],o);return!!u&&(u.x!==r[0]||u.y!==r[1]||u.k!==r[2])}({delta:e,panZoom:t.panZoom,transform:r,translateExtent:t.translateExtent,width:o,height:i})},cancelConnection:function(){return e({connectionStatus:null,connectionStartHandle:null,connectionEndHandle:null})},updateConnection:function(t){var r,o=n().connectionPosition,i=f(f({},t),{connectionPosition:null!==(r=t.connectionPosition)&&void 0!==r?r:o});e(i)},reset:function(){return e(f({},vS()))}})},t=Object.is,n?H(n,t):H};function gS(e){var n=e.initialNodes,t=e.initialEdges,r=e.defaultNodes,o=e.defaultEdges,a=e.initialWidth,u=e.initialHeight,c=e.fitView,l=e.children,s=y(i((function(){return pS({nodes:n,edges:t,defaultNodes:r,defaultEdges:o,width:a,height:u,fitView:c})})),1)[0];return S.jsx(X,{value:s,children:S.jsx(Y_,{children:l})})}function yS(e){var n=e.children,r=e.nodes,o=e.edges,i=e.defaultNodes,a=e.defaultEdges,u=e.width,c=e.height,l=e.fitView;return t(Y)?S.jsx(S.Fragment,{children:n}):S.jsx(gS,{initialNodes:r,initialEdges:o,defaultNodes:i,defaultEdges:a,initialWidth:u,initialHeight:c,fitView:l,children:n})}var mS=m(m([],y(["nodes","edges","defaultNodes","defaultEdges","nodesDraggable","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","translateExtent","defaultEdgeOptions","fitView","fitViewOptions","nodeOrigin","autoLayout","layoutConfig","centerConfig","layoutTypes"]),!1),["rfId"],!1),wS=function(e){return{setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}},bS={translateExtent:mv,nodeOrigin:[0,0],minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function xS(e){var n=Ex(wS,a_),t=n.setNodes,r=n.setEdges,o=n.setMinZoom,i=n.setMaxZoom,c=n.setTranslateExtent,l=n.setNodeExtent,s=n.reset,d=n.setDefaultNodesAndEdges,f=Sx();u((function(){return d(e.defaultNodes,e.defaultEdges),function(){h.current=bS,s()}}),[]);var h=a(bS);return u((function(){var n,a,u;try{for(var s=g(mS),d=s.next();!d.done;d=s.next()){var v=d.value,p=e[v];p!==h.current[v]&&(void 0!==e[v]&&("nodes"===v?t(p):"edges"===v?r(p):"minZoom"===v?o(p):"maxZoom"===v?i(p):"translateExtent"===v?c(p):"nodeExtent"===v?l(p):"fitView"===v?f.setState({fitViewOnInit:p}):"fitViewOptions"===v?f.setState({fitViewOnInitOptions:p}):f.setState(((u={})[v]=p,u))))}}catch(e){n={error:e}}finally{try{d&&!d.done&&(a=s.return)&&a.call(s)}finally{if(n)throw n.error}}h.current=e}),mS.map((function(n){return e[n]}))),null}var _S={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};var ES=Yx((function(e,n){var t=e.nodes,r=e.edges,o=e.translateExtent,i=void 0===o?mv:o,a=e.defaultViewport,u=void 0===a?T_:a,c=e.minZoom,l=void 0===c?.5:c,s=e.maxZoom,d=void 0===s?2:s,v=e.defaultMarkerColor,p=void 0===v?"#b1b1b7":v,g=e.nodeOrigin,y=e.noDragClassName,m=e.noPanClassName,w=e.disableKeyboardA11y,b=e.nodeTypes,x=e.edgeTypes;e.connectionMode;var _=e.connectionLineType,E=void 0===_?qv.Bezier:_,k=e.connectionLineStyle,N=e.connectionLineComponent,C=e.connectionLineContainerStyle,M=e.onNodeClick,j=e.onNodeDoubleClick,P=e.onNodeMouseEnter,I=e.onNodeMouseMove,A=e.onNodeMouseLeave,z=e.onNodeContextMenu,T=e.onEdgeClick,L=e.onEdgeMouseEnter,B=e.onEdgeMouseMove,D=e.onEdgeMouseLeave,R=e.onEdgeContextMenu,V=e.onEdgeDoubleClick,H=e.onNodesChange,Y=e.onEdgesChange,X=e.fitView,Z=e.fitViewOptions,F=e.nodeExtent,U=e.nodesDraggable,W=e.children,G=e.id,q=e.width,$=e.height,K=e.onPaneClick,Q=e.onPaneContextMenu,J=e.onPaneMouseEnter,ee=e.onPaneMouseMove,ne=e.onPaneMouseLeave,te=e.onPaneScroll,re=e.elementsSelectable,oe=void 0===re||re,ie=e.autoLayout,ae=void 0!==ie&&ie,ue=e.layoutConfig,ce=void 0===ue?L_:ue,le=e.centerConfig,se=void 0===le?{}:le,de=e.layoutTypes,fe=void 0===de?{}:de,he=h(e,["nodes","edges","translateExtent","defaultViewport","minZoom","maxZoom","defaultMarkerColor","nodeOrigin","noDragClassName","noPanClassName","disableKeyboardA11y","nodeTypes","edgeTypes","connectionMode","connectionLineType","connectionLineStyle","connectionLineComponent","connectionLineContainerStyle","onNodeClick","onNodeDoubleClick","onNodeMouseEnter","onNodeMouseMove","onNodeMouseLeave","onNodeContextMenu","onEdgeClick","onEdgeMouseEnter","onEdgeMouseMove","onEdgeMouseLeave","onEdgeContextMenu","onEdgeDoubleClick","onNodesChange","onEdgesChange","fitView","fitViewOptions","nodeExtent","nodesDraggable","children","id","width","height","onPaneClick","onPaneContextMenu","onPaneMouseEnter","onPaneMouseMove","onPaneMouseLeave","onPaneScroll","elementsSelectable","autoLayout","layoutConfig","centerConfig","layoutTypes"]),ve=G||"1";return S.jsx("div",f({},he,{ref:n,style:f({},_S),className:O(["ink-flow"]),"data-testid":"rf__wrapper",id:G,children:S.jsxs(yS,{nodes:t,edges:r,width:q,height:$,fitView:X,children:[S.jsx(hS,{onNodeClick:M,onNodeMouseEnter:P,onNodeMouseMove:I,onNodeMouseLeave:A,onNodeContextMenu:z,onNodeDoubleClick:j,onEdgeClick:T,onEdgeMouseEnter:L,onEdgeMouseMove:B,onEdgeMouseLeave:D,onEdgeContextMenu:R,onEdgeDoubleClick:V,rfId:ve,nodeTypes:b,edgeTypes:x,minZoom:l,maxZoom:d,nodeOrigin:g,noDragClassName:y,noPanClassName:m,disableKeyboardA11y:w,translateExtent:i,defaultMarkerColor:p,connectionLineType:E,connectionLineStyle:k,connectionLineComponent:N,connectionLineContainerStyle:C,defaultViewport:u,onPaneClick:K,onPaneContextMenu:Q,onPaneMouseEnter:J,onPaneMouseMove:ee,onPaneMouseLeave:ne,onPaneScroll:te}),S.jsx(xS,{nodes:t,edges:r,rfId:ve,onNodesChange:H,onEdgesChange:Y,fitView:X,fitViewOptions:Z,nodeExtent:F,nodesDraggable:U,elementsSelectable:oe,minZoom:l,maxZoom:d,nodeOrigin:g,autoLayout:ae,layoutConfig:ce,layoutTypes:fe,centerConfig:se}),W]})}))}));function SS(){return S.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:S.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10 4.375C10.3452 4.375 10.625 4.65482 10.625 5V9.375H15C15.3452 9.375 15.625 9.65482 15.625 10C15.625 10.3452 15.3452 10.625 15 10.625H10.625V15C10.625 15.3452 10.3452 15.625 10 15.625C9.65482 15.625 9.375 15.3452 9.375 15V10.625H5C4.65482 10.625 4.375 10.3452 4.375 10C4.375 9.65482 4.65482 9.375 5 9.375H9.375V5C9.375 4.65482 9.65482 4.375 10 4.375Z",fill:"#6B7280"})})}function kS(){return S.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:S.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4.375 10C4.375 9.65482 4.65482 9.375 5 9.375H15C15.3452 9.375 15.625 9.65482 15.625 10C15.625 10.3452 15.3452 10.625 15 10.625H5C4.65482 10.625 4.375 10.3452 4.375 10Z",fill:"#6B7280"})})}function NS(){return S.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:S.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10 1.875C10.3452 1.875 10.625 2.15482 10.625 2.5V3.57152C13.6929 3.86613 16.1339 6.30708 16.4285 9.375H17.5C17.8452 9.375 18.125 9.65482 18.125 10C18.125 10.3452 17.8452 10.625 17.5 10.625H16.4285C16.1339 13.6929 13.6929 16.1339 10.625 16.4285V17.5C10.625 17.8452 10.3452 18.125 10 18.125C9.65482 18.125 9.375 17.8452 9.375 17.5V16.4285C6.30708 16.1339 3.86613 13.6929 3.57152 10.625H2.5C2.15482 10.625 1.875 10.3452 1.875 10C1.875 9.65482 2.15482 9.375 2.5 9.375H3.57152C3.86613 6.30708 6.30708 3.86613 9.375 3.57152V2.5C9.375 2.15482 9.65482 1.875 10 1.875ZM4.82878 10.625H5.83333C6.17851 10.625 6.45833 10.3452 6.45833 10C6.45833 9.65482 6.17851 9.375 5.83333 9.375H4.82878C5.11304 6.99811 6.99811 5.11304 9.375 4.82878V5.83333C9.375 6.17851 9.65482 6.45833 10 6.45833C10.3452 6.45833 10.625 6.17851 10.625 5.83333V4.82878C13.0019 5.11304 14.887 6.99811 15.1712 9.375H14.1667C13.8215 9.375 13.5417 9.65482 13.5417 10C13.5417 10.3452 13.8215 10.625 14.1667 10.625H15.1712C14.887 13.0019 13.0019 14.887 10.625 15.1712V14.1667C10.625 13.8215 10.3452 13.5417 10 13.5417C9.65482 13.5417 9.375 13.8215 9.375 14.1667V15.1712C6.99811 14.887 5.11304 13.0019 4.82878 10.625Z",fill:"#6B7280"})})}function CS(){return S.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:S.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function MS(){return S.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:S.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function OS(e){var n=e.children,t=e.className,r=h(e,["children","className"]);return S.jsx("button",f({type:"button",className:O(["ink-flow__controls-button",t])},r,{children:n}))}var jS=function(e){return e.userSelectionActive?"none":"all"};function PS(e){var n=e.position,t=void 0===n?"top-left":n,r=e.children,o=e.className,i=e.style,a=h(e,["position","children","className","style"]),u=Ex(jS),c="".concat(t).split("-");return S.jsx("div",f({className:O(m(["ink-flow__panel",o],y(c),!1)),style:f(f({},i),{pointerEvents:u})},a,{children:r}))}var IS=function(e){return{isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom}};function AS(e){var n=e.style,t=e.showZoom,r=void 0===t||t,o=e.showFitView,i=void 0===o||o,a=e.showInteractive,u=void 0===a||a,c=e.fitViewOptions,l=e.onZoomIn,s=e.onZoomOut,d=e.onFitView,f=e.onInteractiveChange,h=e.className,v=e.children,p=e.position,g=void 0===p?"bottom-left":p,y=e.orientation,m=void 0===y?"vertical":y,w=e["aria-label"],b=void 0===w?"Ink Flow controls":w,x=Sx(),_=Ex(IS,a_),E=_.isInteractive,k=_.minZoomReached,N=_.maxZoomReached,C=F_(),M=C.zoomIn,j=C.zoomOut,P=C.fitView,I="horizontal"===m?"horizontal":"vertical";return S.jsxs(PS,{className:O(["ink-flow__controls",I,h]),position:g,style:n,"data-testid":"rf__controls","aria-label":b,children:[i&&S.jsx(OS,{className:"ink-flow__controls-fitview",onClick:function(){P(c),null==d||d()},"aria-label":"fit view",children:S.jsx(NS,{})}),r&&S.jsxs("div",{className:"ink-flow__controls-zoom",children:[S.jsx(OS,{onClick:function(){M(),null==l||l()},className:"ink-flow__controls-zoomin","aria-label":"zoom in",disabled:N,children:S.jsx(SS,{})}),S.jsx(OS,{onClick:function(){j(),null==s||s()},className:"ink-flow__controls-zoomout","aria-label":"zoom out",disabled:k,children:S.jsx(kS,{})})]}),u&&S.jsx(OS,{className:"ink-flow__controls-interactive",onClick:function(){x.setState({nodesDraggable:!E,nodesConnectable:!E,elementsSelectable:!E}),null==f||f(!E)},title:"toggle interactivity","aria-label":"toggle interactivity",children:E?S.jsx(MS,{}):S.jsx(CS,{})}),v]})}AS.displayName="Controls";var zS,TS,LS=c(AS);function BS(e){var n=e.dimensions,t=e.lineWidth,r=e.variant,o=e.className;return S.jsx("path",{strokeWidth:t,d:"M".concat(n[0]/2," 0 V").concat(n[1]," M0 ").concat(n[1]/2," H").concat(n[0]),className:O(["react-flow__background-pattern",r,o])})}function DS(e){var n=e.radius,t=e.className;return S.jsx("circle",{cx:n,cy:n,r:n,className:O(["react-flow__background-pattern","dots",t])})}!function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"}(zS||(zS={}));var RS=((TS={})[zS.Dots]=1,TS[zS.Lines]=1,TS[zS.Cross]=6,TS),VS=function(e){return{transform:e.transform,patternId:"pattern-".concat(e.rfId)}};function HS(e){var n=e.id,t=e.variant,r=void 0===t?zS.Dots:t,o=e.gap,i=void 0===o?20:o,u=e.size,c=e.lineWidth,l=void 0===c?1:c,s=e.offset,d=void 0===s?2:s,h=e.color,v=e.bgColor,p=e.style,g=e.className,y=e.patternClassName,m=a(null),w=Ex(VS,a_),b=w.transform,x=w.patternId,_=u||RS[r],E=r===zS.Dots,k=r===zS.Cross,N=Array.isArray(i)?i:[i,i],C=[N[0]*b[2]||1,N[1]*b[2]||1],M=_*b[2],j=k?[M,M]:C,P=E?[M/d,M/d]:[j[0]/d,j[1]/d],I="".concat(x).concat(n||"");return S.jsxs("svg",{className:O(["ink-flow__background",g]),style:f(f(f({},p),u_),{"--xy-background-color-props":v,"--xy-background-pattern-color-props":h}),ref:m,"data-testid":"rf__background",children:[S.jsx("pattern",{id:I,x:b[0]%C[0],y:b[1]%C[1],width:C[0],height:C[1],patternUnits:"userSpaceOnUse",patternTransform:"translate(-".concat(P[0],",-").concat(P[1],")"),children:E?S.jsx(DS,{radius:M/d,className:y}):S.jsx(BS,{dimensions:j,lineWidth:l,variant:r,className:y})}),S.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:"url(#".concat(I,")")})]})}HS.displayName="Background";var YS=c(HS),XS=function(e){var n;return null===(n=e.domNode)||void 0===n?void 0:n.querySelector(".ink-flow__edgelabel-renderer")};function ZS(e){var n=e.children,t=Ex(XS);return t?d(n,t):null}export{YS as Background,zS as BackgroundVariant,NE as BaseEdge,qv as ConnectionLineType,Uv as ConnectionMode,OS as ControlButton,LS as Controls,ZS as EdgeLabelRenderer,lE as Handle,gS as InkFlowProvider,$v as MarkerType,Wv as PanOnScrollMode,Kv as Position,Gv as SelectionMode,AE as SmoothStepEdge,LE as StepEdge,ap as addEdge,fp as dagreLayout,ES as default,Jv as getBezierEdgeCenter,tp as getBezierPath,Cv as getConnectedEdges,rp as getEdgeCenter,Ev as getIncomers,kv as getNodesBounds,_v as getOutgoers,dp as getSmoothStepPath,cp as getStraightPath,Vv as getViewportForBounds,up as updateEdge,z_ as useEdgesState,F_ as useInkFlow,D_ as useNodesState,Ex as useStore,Sx as useStoreApi};
|
|
17
17
|
//# sourceMappingURL=index.esm.js.map
|