From d940efa1a349307592904af06836d7f58db1f07c Mon Sep 17 00:00:00 2001 From: Daniele Pala Date: Sat, 10 Apr 2021 15:37:28 +0200 Subject: [PATCH] update to fflate 0.6.9 --- dist/cimdraw.min.js | 2 +- js/fflate/fflate.min.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dist/cimdraw.min.js b/dist/cimdraw.min.js index 53cc992..85df3f0 100644 --- a/dist/cimdraw.min.js +++ b/dist/cimdraw.min.js @@ -1,2 +1,2 @@ /* Riot v5.1.2, @license MIT */ -var t,e;function rotate(t,e){let n=d3.select("svg").node(),r=n.createSVGPoint();if(r.x=t.x,r.y=t.y,0===e)return r;let i=n.createSVGTransform();return i.setRotate(e,0,0),r.matrixTransform(i.matrix)}function rotateTerm(t,e){let n=t.getTargets([e],"Terminal.ConductingEquipment")[0],r=n.x,i=n.y,o=rotate({x:e.x-r,y:e.y-i},e.rotation);return{x:r+o.x,y:i+o.y}}function addToDiagram(t,e,n){let r=d3.pointer(e,d3.select("svg").node()),i=d3.zoomTransform(d3.select("svg").node()),o=i.x,a=i.y,s=i.k;n.x=(r[0]-o)/s,n.px=n.x,n.y=(r[1]-a)/s,n.py=n.y;let l=[{x:0,y:0,seq:1}];"cim:ACLineSegment"!==n.nodeName&&"cim:BusbarSection"!==n.nodeName||l.push({x:150,y:0,seq:2}),t.addToActiveDiagram(n,l)}function calcLineData(t,e){let n="ConnectivityNode",r="ConnectivityNode.Terminals";"BUS_BRANCH"===t.getMode()&&(n="TopologicalNode",r="TopologicalNode.Terminal"),e.x=void 0,e.y=void 0,e.rotation=0;let i=[],o=0,a=0,s=t.getEquipments(e).filter((t=>void 0!==t.lineData||"BusbarSection"===t.localName)),l=s.filter((t=>"BusbarSection"===t.localName))[0],c=t.getDiagramObjects([e]);if(0===c.length){if(void 0!==l){c=t.getDiagramObjects([l]);let n=t.getAttribute(c[0],"cim:DiagramObject.rotation");void 0!==n&&(e.rotation=parseInt(n.innerHTML))}else if(s.length>0){let t=[];for(let e of s){let n=e.x+e.lineData[e.lineData.length-1].x,r=e.y+e.lineData[e.lineData.length-1].y;t.push({x:e.x+e.lineData[0].x,y:e.y+e.lineData[0].y,eq:e},{x:n,y:r,eq:e})}let e=1/0,n=t[0],r=t[0];for(let i of t)for(let o of t){if(i.eq===o.eq)continue;let t=distance2(i,o);t0){for(let e of u){let n=t.getAttribute(e,"cim:DiagramObjectPoint.sequenceNumber");n=void 0===n?1:parseInt(n.innerHTML),i.push({x:parseFloat(t.getAttribute(e,"cim:DiagramObjectPoint.xPosition").innerHTML),y:parseFloat(t.getAttribute(e,"cim:DiagramObjectPoint.yPosition").innerHTML),seq:n})}i.sort((function(t,e){return t.seq-e.seq})),e.x=i[0].x,e.y=i[0].y;for(let t of i)t.x=t.x-e.x,t.y=t.y-e.y}else{if(i.push({x:0,y:0,seq:1}),e.nodeName==="cim:"+n){let n=t.getTargets([e],r);void 0!==t.getTargets(n,"Terminal.ConductingEquipment").filter((t=>"cim:BusbarSection"===t.nodeName))[0]&&i.push({x:150,y:0,seq:2})}e.x=o,e.y=a,t.addToActiveDiagram(e,i)}return e.lineData=i,i}function distance2(t,e){let n=t.x-e.x,r=t.y-e.y;return n*n+r*r}function closestPoint(t,e){let n=d3.line().x((function(t){return t.x})).y((function(t){return t.y})),r=d3.select(document.createElementNS("http://www.w3.org/2000/svg","svg")).append("path").attr("d",n(t.lineData)).node();if(null===r)return[0,0];let i,o,a=r.getTotalLength(),s=8,l=1/0;if(0===a)return[0,0];if(void 0===e.x||void 0===e.y)return[0,0];for(let e=0;e<=a;e+=s){let n=r.getPointAtLength(e);0!==t.rotation&&(n=rotate(n,t.rotation));let a=c(n);a.5;){let e=o-s;if(e>=0){let n=r.getPointAtLength(e);0!==t.rotation&&(n=rotate(n,t.rotation));let a=c(n);if(at.matches('[data-bs-toggle="popover"]')));for(let t of e){let e=bootstrap.Popover.getInstance(t);null!==e&&e.hide()}}function showPopovers(t){let e=[];e=void 0===t?document.querySelectorAll('[data-bs-toggle="popover"]'):t.filter((t=>t.matches('[data-bs-toggle="popover"]')));for(let t of e){let e=bootstrap.Popover.getInstance(t);null!==e&&e.show()}}function disposePopovers(t){let e=[];e=void 0===t?document.querySelectorAll('[data-bs-toggle="popover"]'):t.filter((t=>t.matches('[data-bs-toggle="popover"]')));for(let t of e){let e=bootstrap.Popover.getInstance(t);null!==e&&e.dispose()}}function exportToMatpower(t){let e="function mpc = cim\n",n="100",r=[],i=topologyProcessor(t);r="NODE_BREAKER"===t.getMode()?i.calcTopology():t.getObjects(["cim:TopologicalNode"])["cim:TopologicalNode"],e+="% MATPOWER Case Format : Version 2\n",e+="mpc.version = '2';\n",e+="% system MVA base\n",e=e+"mpc.baseMVA = "+"100;\n",e+="% bus data\n",e+="mpc.bus = [\n",e+="%bus_i\ttype\tPd\tQd\tGs\tBs\tarea\tVm\tVa\tbaseKV\tzone\tVmax\tVmin\n";let o=new Map;for(let n in r){let a=t.ID(r[n]),s=1,l=u(t.getTargets([r[n]],"TopologicalNode.BaseVoltage")[0],"cim:BaseVoltage.nominalVoltage","0"),c=parseInt(n)+1,d=i.getTerminals(r[n]),f=t.getTargets(d,"Terminal.ConductingEquipment"),h=f.filter((e=>!0===t.schema.isA("EnergyConsumer",e))),p=f.filter((e=>!0===t.schema.isA("ShuntCompensator",e))),m=f.filter((e=>!0===t.schema.isA("SynchronousMachine",e))),g=f.filter((e=>!0===t.schema.isA("AsynchronousMachine",e))),b=(t.getTargets(d,"Terminal.TransformerEnd"),0),v=0,y=1;h.forEach((function(t){b+=parseFloat(u(t,"cim:EnergyConsumer.p","0.0")),v+=parseFloat(u(t,"cim:EnergyConsumer.q","0.0"))})),g.forEach((function(t){b+=parseFloat(u(t,"cim:RotatingMachine.p","0")),v+=parseFloat(u(t,"cim:RotatingMachine.q","0"))}));let _=0,w=0;if(p.forEach((function(t){let e=parseFloat(u(t,"cim:ShuntCompensator.sections","0.0")),n=parseFloat(u(t,"cim:LinearShuntCompensator.gPerSection","0.0")),r=parseFloat(u(t,"cim:LinearShuntCompensator.bPerSection","0.0"));_+=n*e,w+=r*e})),_=_*l*l,w=w*l*l,m.length>0||p.length>0){if(p.length>0){let e=i.getTerminals(p[0]),n=(t.getTargets(e,"Terminal.TopologicalNode"),t.getTargets([p[0]],"RegulatingCondEq.RegulatingControl")[0]);if(void 0!==n){s=2;let t=u(n,"cim:RegulatingControl.targetValue",l);y=parseFloat(t)/parseFloat(l)}}if(m.length>0){void 0!==t.getTargets([m[0]],"RegulatingCondEq.RegulatingControl")[0]&&(s=2)}}m.filter((function(t){return parseInt(u(t,"cim:SynchronousMachine.referencePriority","0"))>0})).length>0&&(s=3),e=e+c+"\t",e=e+s+"\t",e=e+b+"\t",e=e+v+"\t",e=e+_+"\t",e=e+w+"\t",e=e+1+"\t",e=e+y+"\t",e=e+0+"\t",e=e+l+"\t",e=e+1+"\t",e=e+1.1+"\t",e=e+.9+";\t",e=e+"%Node ("+a+")",e+="\n",o.set(r[n],c)}e+="];\n";let a=t.getObjects(["cim:SynchronousMachine"])["cim:SynchronousMachine"],s=t.getObjects(["cim:EquivalentInjection"])["cim:EquivalentInjection"];e+="% generator data\n",e+="mpc.gen = [\n",e+="%bus\tPg\tQg\tQmax\tQmin\tVg\tmBase\tstatus\tPmax\tPmin\tPc1\tPc2\tQc1min\tQc1max\tQc2min\tQc2max\tramp_agc\tramp_10\tramp_30\tramp_q\tapf\n",a.forEach((function(r){let a={};a.genUUID=t.ID(r);let s=i.getTerminals(r),l=t.getTargets(s,"Terminal.TopologicalNode"),d=t.getTargets([r],"RotatingMachine.GeneratingUnit")[0],f=t.getTargets([r],"RegulatingCondEq.RegulatingControl")[0];l.forEach((function(i){if(a.busNum=o.get(i),a.p=-1*parseFloat(u(r,"cim:RotatingMachine.p","0")),a.q=-1*parseFloat(u(r,"cim:RotatingMachine.q","0")),a.qmax=parseFloat(u(r,"cim:SynchronousMachine.maxQ","0")),a.qmin=parseFloat(u(r,"cim:SynchronousMachine.minQ","0")),a.vg=1,void 0!==f){let e=u(t.getTargets([i],"TopologicalNode.BaseVoltage")[0],"cim:BaseVoltage.nominalVoltage","0"),n=u(f,"cim:RegulatingControl.targetValue",e);a.vg=parseFloat(n)/parseFloat(e)}a.mbase=parseFloat(u(r,"cim:SynchronousMachine.ratedS",n)),a.pmax=parseFloat(u(d,"cim:GeneratingUnit.maxOperatingP","0")),a.pmin=parseFloat(u(d,"cim:GeneratingUnit.minOperatingP","0")),e+=c(a)}))})),s.forEach((function(r){let a={};a.genUUID=t.ID(r);let s=i.getTerminals(r),l=t.getTargets(s,"Terminal.TopologicalNode"),d=u(r,"cim:EquivalentInjection.regulationStatus","false");l.forEach((function(i){if(a.busNum=o.get(i),a.p=-1*parseFloat(u(r,"cim:EquivalentInjection.p","0")),a.q=-1*parseFloat(u(r,"cim:EquivalentInjection.q","0")),a.qmax=parseFloat(u(r,"cim:EquivalentInjection.maxQ","0")),a.qmin=parseFloat(u(r,"cim:EquivalentInjection.minQ","0")),a.vg=1,"true"===d){let e=u(t.getTargets([i],"TopologicalNode.BaseVoltage")[0],"cim:BaseVoltage.nominalVoltage","0"),n=u(r,"cim:EquivalentInjection.regulationTarget",e);a.vg=parseFloat(n)/parseFloat(e)}a.mbase=n,a.pmax=parseFloat(u(r,"cim:EquivalentInjection.maxP","0")),a.pmin=parseFloat(u(r,"cim:EquivalentInjection.minP","0")),e+=c(a)}))})),e+="];\n";let l=t.getObjects(["cim:ACLineSegment"])["cim:ACLineSegment"];return e+="% branch data\n",e+="mpc.branch = [\n",e+="%fbus\ttbus\tr\tx\tb\trateA\trateB\trateC\tratio\tangle\tstatus\tangmin\tangmax\n",l.forEach((function(r){let a=t.ID(r),s=i.getTerminals(r),l=t.getTargets(s,"Terminal.TopologicalNode");if(2===l.length){let i=u(t.getTargets(l,"TopologicalNode.BaseVoltage")[0],"cim:BaseVoltage.nominalVoltage","0"),s=parseFloat(i)*parseFloat(i)/parseFloat(n),c=u(r,"cim:ACLineSegment.r","0"),d=u(r,"cim:ACLineSegment.x","0"),f=u(r,"cim:ACLineSegment.bch","0"),h=parseFloat(c)/s,p=parseFloat(d)/s,m=parseFloat(f)*s;e=e+o.get(l[0])+"\t",e=e+o.get(l[1])+"\t",e=e+h+"\t",e=e+p+"\t",e=e+m+"\t",e=e+0+"\t",e=e+0+"\t",e=e+0+"\t",e=e+0+"\t",e=e+0+"\t",e=e+1+"\t",e+="-360\t",e+="360;\t",e=e+"%AC line segment ("+a+")",e+="\n"}})),t.getObjects(["cim:PowerTransformer"])["cim:PowerTransformer"].forEach((function(r){let a=t.ID(r),s=t.getTargets([r],"PowerTransformer.PowerTransformerEnd");if(2===s.length){let r=s[0],l=s[1],c=u(r,"cim:PowerTransformerEnd.r","0"),d=u(r,"cim:PowerTransformerEnd.x","0");"0"===c&&"0"===d&&(l=s[0],r=s[1],c=u(r,"cim:PowerTransformerEnd.r","0"),d=u(r,"cim:PowerTransformerEnd.x","0"));let f=u(r,"cim:PowerTransformerEnd.b","0"),h=i.getTerminals(r),p=t.getTargets(h,"Terminal.TopologicalNode")[0],m=i.getTerminals(l),g=t.getTargets(m,"Terminal.TopologicalNode")[0];if(1===h.length&&1===m.length&&void 0!==p&&void 0!==g){let i=u(t.getTargets([p],"TopologicalNode.BaseVoltage")[0],"cim:BaseVoltage.nominalVoltage","0"),s=u(t.getTargets([g],"TopologicalNode.BaseVoltage")[0],"cim:BaseVoltage.nominalVoltage","0"),h=u(r,"cim:PowerTransformerEnd.ratedU",i),m=u(l,"cim:PowerTransformerEnd.ratedU",s),b=parseFloat(i)*parseFloat(i)/parseFloat(n),v=parseFloat(c)/b,y=parseFloat(d)/b,_=parseFloat(f)*b,w=t.getTargets([r],"TransformerEnd.RatioTapChanger"),x=parseFloat(s)*parseFloat(h)/(parseFloat(i)*parseFloat(m)),T=!1;if(0===w.length&&(w=t.getTargets([l],"TransformerEnd.RatioTapChanger"),T=!0),w.length>0){let t=u(w[0],"cim:TapChanger.neutralStep","0"),e=u(w[0],"cim:TapChanger.step",t),n=u(w[0],"cim:RatioTapChanger.stepVoltageIncrement","0"),r=(parseFloat(e)-parseFloat(t))*parseFloat(n);r/=100,r=1+r,!0===T&&(r=1/r),x*=r}e=e+o.get(p)+"\t",e=e+o.get(g)+"\t",e=e+v+"\t",e=e+y+"\t",e=e+_+"\t",e=e+0+"\t",e=e+0+"\t",e=e+0+"\t",e=e+x+"\t",e=e+0+"\t",e=e+1+"\t",e+="-360\t",e+="360;\t",e=e+"%Two-winding transformer ("+a+")",e+="\n"}}if(3===s.length){let r=s[0],l=s[1],c=s[2],m=u(r,"cim:PowerTransformerEnd.r","0"),g=u(l,"cim:PowerTransformerEnd.r","0"),b=u(c,"cim:PowerTransformerEnd.r","0"),v=u(r,"cim:PowerTransformerEnd.x","0"),y=u(l,"cim:PowerTransformerEnd.x","0"),_=u(c,"cim:PowerTransformerEnd.x","0"),w=u(r,"cim:PowerTransformerEnd.b","0"),x=u(l,"cim:PowerTransformerEnd.b","0"),T=u(c,"cim:PowerTransformerEnd.b","0"),A=i.getTerminals(r),E=i.getTerminals(l),M=i.getTerminals(c),S=t.getTargets(A,"Terminal.TopologicalNode")[0],N=t.getTargets(E,"Terminal.TopologicalNode")[0],k=t.getTargets(M,"Terminal.TopologicalNode")[0];if(1===A.length&&1===E.length&&1===M.length){let i=t.getTargets([S],"TopologicalNode.BaseVoltage")[0],s=t.getTargets([N],"TopologicalNode.BaseVoltage")[0],A=t.getTargets([k],"TopologicalNode.BaseVoltage")[0],E=u(i,"cim:BaseVoltage.nominalVoltage","0"),M=u(s,"cim:BaseVoltage.nominalVoltage","0"),C=u(A,"cim:BaseVoltage.nominalVoltage","0"),D=u(r,"cim:PowerTransformerEnd.ratedU",E),L=u(l,"cim:PowerTransformerEnd.ratedU",M),O=u(c,"cim:PowerTransformerEnd.ratedU",C),I=parseFloat(E)*parseFloat(E)/parseFloat(n),B=parseFloat(M)*parseFloat(M)/parseFloat(n),P=parseFloat(C)*parseFloat(C)/parseFloat(n),j=parseFloat(m)/I,R=parseFloat(g)/B,q=parseFloat(b)/P,F=parseFloat(v)/I,z=parseFloat(y)/B,U=parseFloat(_)/P,V=parseFloat(w)*I,H=parseFloat(x)*B,G=parseFloat(T)*P,Y=d(j,F),W=d(R,z),$=d(q,U),K=f(f(h(Y,W),h(W,$)),h($,Y)),X=h(K,p($)),Q=h(K,p(Y)),Z=h(K,p(W)),J=parseFloat(M)*parseFloat(D)/(parseFloat(E)*parseFloat(L)),tt=parseFloat(C)*parseFloat(L)/(parseFloat(M)*parseFloat(O)),et=parseFloat(E)*parseFloat(O)/(parseFloat(C)*parseFloat(D));e=e+o.get(S)+"\t",e=e+o.get(N)+"\t",e=e+X.re+"\t",e=e+X.im+"\t",e=e+V+"\t",e=e+0+"\t",e=e+0+"\t",e=e+0+"\t",e=e+J+"\t",e=e+0+"\t",e=e+1+"\t",e+="-360\t",e+="360;\t",e=e+"%Three-winding transformer branch 1-2 ("+a+")",e+="\n",e=e+o.get(N)+"\t",e=e+o.get(k)+"\t",e=e+Q.re+"\t",e=e+Q.im+"\t",e=e+H+"\t",e=e+0+"\t",e=e+0+"\t",e=e+0+"\t",e=e+tt+"\t",e=e+0+"\t",e=e+1+"\t",e+="-360\t",e+="360;\t",e=e+"%Three-winding transformer branch 2-3 ("+a+")",e+="\n",e=e+o.get(k)+"\t",e=e+o.get(S)+"\t",e=e+Z.re+"\t",e=e+Z.im+"\t",e=e+G+"\t",e=e+0+"\t",e=e+0+"\t",e=e+0+"\t",e=e+et+"\t",e=e+0+"\t",e=e+1+"\t",e+="-360\t",e+="360;\t",e=e+"%Three-winding transformer branch 3-1 ("+a+")",e+="\n"}}})),e+="];\n",e;function c(t){let e="";return e=e+t.busNum+"\t",e=e+t.p+"\t",e=e+t.q+"\t",e=e+t.qmax+"\t",e=e+t.qmin+"\t",e=e+t.vg+"\t",e=e+t.mbase+"\t",e=e+1+"\t",e=e+t.pmax+"\t",e=e+t.pmin+"\t",e=e+0+"\t",e=e+0+"\t",e=e+0+"\t",e=e+0+"\t",e=e+0+"\t",e=e+0+"\t",e=e+0+"\t",e=e+0+"\t",e=e+0+"\t",e=e+0+"\t",e=e+0+";\t",e=e+"%Generator ("+t.genUUID+")",e+="\n",e}function u(e,n,r){let i=t.getAttribute(e,n);return i=void 0===i?r:i.textContent,i}function d(t,e){return{re:t,im:e}}function f(t,e){return{re:t.re+e.re,im:t.im+e.im}}function h(t,e){return{re:t.re*e.re-t.im*e.im,im:t.re*e.im+t.im*e.re}}function p(t){const e=t.re*t.re+t.im*t.im;return{re:t.re/e,im:-t.im/e}}}!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).d3=t.d3||{})}(this,(function(t){"use strict";function e(t,e){return te?1:t>=e?0:NaN}function n(t){let n=t,r=t;function i(t,e,n,i){for(null==n&&(n=0),null==i&&(i=t.length);n>>1;r(t[o],e)<0?n=o+1:i=o}return n}return 1===t.length&&(n=(e,n)=>t(e)-n,r=function(t){return(n,r)=>e(t(n),r)}(t)),{left:i,center:function(t,e,r,o){null==r&&(r=0),null==o&&(o=t.length);const a=i(t,e,r,o-1);return a>r&&n(t[a-1],e)>-n(t[a],e)?a-1:a},right:function(t,e,n,i){for(null==n&&(n=0),null==i&&(i=t.length);n>>1;r(t[o],e)>0?i=o:n=o+1}return n}}}function r(t){return null===t?NaN:+t}const i=n(e),o=i.right,a=i.left,s=n(r).center;function l(t,e){let n=0;if(void 0===e)for(let e of t)null!=e&&(e=+e)>=e&&++n;else{let r=-1;for(let i of t)null!=(i=e(i,++r,t))&&(i=+i)>=i&&++n}return n}function c(t){return 0|t.length}function u(t){return!(t>0)}function d(t){return"object"!=typeof t||"length"in t?t:Array.from(t)}function f(t,e){let n,r=0,i=0,o=0;if(void 0===e)for(let e of t)null!=e&&(e=+e)>=e&&(n=e-i,i+=n/++r,o+=n*(e-i));else{let a=-1;for(let s of t)null!=(s=e(s,++a,t))&&(s=+s)>=s&&(n=s-i,i+=n/++r,o+=n*(s-i))}if(r>1)return o/(r-1)}function h(t,e){const n=f(t,e);return n?Math.sqrt(n):n}function p(t,e){let n,r;if(void 0===e)for(const e of t)null!=e&&(void 0===n?e>=e&&(n=r=e):(n>e&&(n=e),r=o&&(n=r=o):(n>o&&(n=o),r0){for(o=t[--i];i>0&&(e=o,n=t[--i],o=e+n,r=n-(o-e),!r););i>0&&(r<0&&t[i-1]<0||r>0&&t[i-1]>0)&&(n=2*r,e=o+n,n==e-o&&(o=e))}return o}}function g(t){return t}function b(t){if(1!==t.length)throw new Error("duplicate key");return t[0]}function v(t,e,n,r){return function t(i,o){if(o>=r.length)return n(i);const a=new Map,s=r[o++];let l=-1;for(const t of i){const e=s(t,++l,i),n=a.get(e);n?n.push(t):a.set(e,[t])}for(const[e,n]of a)a.set(e,t(n,o));return e(a)}(t,0)}var y=Array.prototype.slice;function _(t){return function(){return t}}var w=Math.sqrt(50),x=Math.sqrt(10),T=Math.sqrt(2);function A(t,e,n){var r,i,o,a,s=-1;if(n=+n,(t=+t)==(e=+e)&&n>0)return[t];if((r=e0)for(t=Math.ceil(t/a),e=Math.floor(e/a),o=new Array(i=Math.ceil(e-t+1));++s=0?(o>=w?10:o>=x?5:o>=T?2:1)*Math.pow(10,i):-Math.pow(10,-i)/(o>=w?10:o>=x?5:o>=T?2:1)}function M(t,e,n){var r=Math.abs(e-t)/Math.max(0,n),i=Math.pow(10,Math.floor(Math.log(r)/Math.LN10)),o=r/i;return o>=w?i*=10:o>=x?i*=5:o>=T&&(i*=2),e0?(t=Math.floor(t/i)*i,e=Math.ceil(e/i)*i):i<0&&(t=Math.ceil(t*i)/i,e=Math.floor(e*i)/i),r=i}}function N(t){return Math.ceil(Math.log(l(t))/Math.LN2)+1}function k(){var t=g,e=p,n=N;function r(r){Array.isArray(r)||(r=Array.from(r));var i,a,s=r.length,l=new Array(s);for(i=0;i0?d=(Math.floor(d/t)+1)*t:t<0&&(d=(Math.ceil(d*t)+1)/t))}else f.pop()}for(var h=f.length;f[0]<=u;)f.shift(),--h;for(;f[h-1]>d;)f.pop(),--h;var m,g=new Array(h+1);for(i=0;i<=h;++i)(m=g[i]=[]).x0=i>0?f[i-1]:u,m.x1=i=e)&&(n=e);else{let r=-1;for(let i of t)null!=(i=e(i,++r,t))&&(n=i)&&(n=i)}return n}function D(t,e){let n;if(void 0===e)for(const e of t)null!=e&&(n>e||void 0===n&&e>=e)&&(n=e);else{let r=-1;for(let i of t)null!=(i=e(i,++r,t))&&(n>i||void 0===n&&i>=i)&&(n=i)}return n}function L(t,n,r=0,i=t.length-1,o=e){for(;i>r;){if(i-r>600){const e=i-r+1,a=n-r+1,s=Math.log(e),l=.5*Math.exp(2*s/3),c=.5*Math.sqrt(s*l*(e-l)/e)*(a-e/2<0?-1:1);L(t,n,Math.max(r,Math.floor(n-a*l/e+c)),Math.min(i,Math.floor(n+(e-a)*l/e+c)),o)}const e=t[n];let a=r,s=i;for(O(t,r,n),o(t[i],e)>0&&O(t,r,i);a0;)--s}0===o(t[r],e)?O(t,r,s):(++s,O(t,s,i)),s<=n&&(r=s+1),n<=s&&(i=s-1)}return t}function O(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function I(t,e,n){if(r=(t=Float64Array.from(function*(t,e){if(void 0===e)for(let e of t)null!=e&&(e=+e)>=e&&(yield e);else{let n=-1;for(let r of t)null!=(r=e(r,++n,t))&&(r=+r)>=r&&(yield r)}}(t,n))).length){if((e=+e)<=0||r<2)return D(t);if(e>=1)return C(t);var r,i=(r-1)*e,o=Math.floor(i),a=C(L(t,o).subarray(0,o+1));return a+(D(t.subarray(o+1))-a)*(i-o)}}function B(t,e,n=r){if(i=t.length){if((e=+e)<=0||i<2)return+n(t[0],0,t);if(e>=1)return+n(t[i-1],i-1,t);var i,o=(i-1)*e,a=Math.floor(o),s=+n(t[a],a,t);return s+(+n(t[a+1],a+1,t)-s)*(o-a)}}function P(t,e){let n,r=-1,i=-1;if(void 0===e)for(const e of t)++i,null!=e&&(n=e)&&(n=e,r=i);else for(let o of t)null!=(o=e(o,++i,t))&&(n=o)&&(n=o,r=i);return r}function j(t){return Array.from(function*(t){for(const e of t)yield*e}(t))}function R(t,e){let n,r=-1,i=-1;if(void 0===e)for(const e of t)++i,null!=e&&(n>e||void 0===n&&e>=e)&&(n=e,r=i);else for(let o of t)null!=(o=e(o,++i,t))&&(n>o||void 0===n&&o>=o)&&(n=o,r=i);return r}function q(t,e){return[t,e]}function F(t,e){return Array.from(e,(e=>t[e]))}function z(t,e,n){t=+t,e=+e,n=(i=arguments.length)<2?(e=t,t=0,1):i<3?1:+n;for(var r=-1,i=0|Math.max(0,Math.ceil((e-t)/n)),o=new Array(i);++r+t(e)}function et(t){var e=Math.max(0,t.bandwidth()-1)/2;return t.round()&&(e=Math.round(e)),function(n){return+t(n)+e}}function nt(){return!this.__axis}function rt(t,e){var n=[],r=null,i=null,o=6,a=6,s=3,l=1===t||4===t?-1:1,c=4===t||2===t?"x":"y",u=1===t||3===t?Z:J;function d(d){var f=null==r?e.ticks?e.ticks.apply(e,n):e.domain():r,h=null==i?e.tickFormat?e.tickFormat.apply(e,n):X:i,p=Math.max(o,0)+s,m=e.range(),g=+m[0]+.5,b=+m[m.length-1]+.5,v=(e.bandwidth?et:tt)(e.copy()),y=d.selection?d.selection():d,_=y.selectAll(".domain").data([null]),w=y.selectAll(".tick").data(f,e).order(),x=w.exit(),T=w.enter().append("g").attr("class","tick"),A=w.select("line"),E=w.select("text");_=_.merge(_.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),w=w.merge(T),A=A.merge(T.append("line").attr("stroke","currentColor").attr(c+"2",l*o)),E=E.merge(T.append("text").attr("fill","currentColor").attr(c,l*p).attr("dy",1===t?"0em":3===t?"0.71em":"0.32em")),d!==y&&(_=_.transition(d),w=w.transition(d),A=A.transition(d),E=E.transition(d),x=x.transition(d).attr("opacity",Q).attr("transform",(function(t){return isFinite(t=v(t))?u(t):this.getAttribute("transform")})),T.attr("opacity",Q).attr("transform",(function(t){var e=this.parentNode.__axis;return u(e&&isFinite(e=e(t))?e:v(t))}))),x.remove(),_.attr("d",4===t||2==t?a?"M"+l*a+","+g+"H0.5V"+b+"H"+l*a:"M0.5,"+g+"V"+b:a?"M"+g+","+l*a+"V0.5H"+b+"V"+l*a:"M"+g+",0.5H"+b),w.attr("opacity",1).attr("transform",(function(t){return u(v(t))})),A.attr(c+"2",l*o),E.attr(c,l*p).text(h),y.filter(nt).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",2===t?"start":4===t?"end":"middle"),y.each((function(){this.__axis=v}))}return d.scale=function(t){return arguments.length?(e=t,d):e},d.ticks=function(){return n=K.call(arguments),d},d.tickArguments=function(t){return arguments.length?(n=null==t?[]:K.call(t),d):n.slice()},d.tickValues=function(t){return arguments.length?(r=null==t?null:K.call(t),d):r&&r.slice()},d.tickFormat=function(t){return arguments.length?(i=t,d):i},d.tickSize=function(t){return arguments.length?(o=a=+t,d):o},d.tickSizeInner=function(t){return arguments.length?(o=+t,d):o},d.tickSizeOuter=function(t){return arguments.length?(a=+t,d):a},d.tickPadding=function(t){return arguments.length?(s=+t,d):s},d}var it={value:()=>{}};function ot(){for(var t,e=0,n=arguments.length,r={};e=0&&(n=t.slice(r+1),t=t.slice(0,r)),t&&!e.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:n}}))}function lt(t,e){for(var n,r=0,i=t.length;r0)for(var n,r,i=new Array(n),o=0;o=0&&"xmlns"!==(e=t.slice(0,n))&&(t=t.slice(n+1)),dt.hasOwnProperty(e)?{space:dt[e],local:t}:t}function ht(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===ut&&e.documentElement.namespaceURI===ut?e.createElement(t):e.createElementNS(n,t)}}function pt(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function mt(t){var e=ft(t);return(e.local?pt:ht)(e)}function gt(){}function bt(t){return null==t?gt:function(){return this.querySelector(t)}}function vt(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}function yt(){return[]}function _t(t){return null==t?yt:function(){return this.querySelectorAll(t)}}function wt(t){return function(){return this.matches(t)}}function xt(t){return function(e){return e.matches(t)}}var Tt=Array.prototype.find;function At(){return this.firstElementChild}var Et=Array.prototype.filter;function Mt(){return this.children}function St(t){return new Array(t.length)}function Nt(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}function kt(t){return function(){return t}}function Ct(t,e,n,r,i,o){for(var a,s=0,l=e.length,c=o.length;se?1:t>=e?0:NaN}function It(t){return function(){this.removeAttribute(t)}}function Bt(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Pt(t,e){return function(){this.setAttribute(t,e)}}function jt(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function Rt(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttribute(t):this.setAttribute(t,n)}}function qt(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}function Ft(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function zt(t){return function(){this.style.removeProperty(t)}}function Ut(t,e,n){return function(){this.style.setProperty(t,e,n)}}function Vt(t,e,n){return function(){var r=e.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,n)}}function Ht(t,e){return t.style.getPropertyValue(e)||Ft(t).getComputedStyle(t,null).getPropertyValue(e)}function Gt(t){return function(){delete this[t]}}function Yt(t,e){return function(){this[t]=e}}function Wt(t,e){return function(){var n=e.apply(this,arguments);null==n?delete this[t]:this[t]=n}}function $t(t){return t.trim().split(/^|\s+/)}function Kt(t){return t.classList||new Xt(t)}function Xt(t){this._node=t,this._names=$t(t.getAttribute("class")||"")}function Qt(t,e){for(var n=Kt(t),r=-1,i=e.length;++r=0&&(e=t.slice(n+1),t=t.slice(0,n)),{type:t,name:e}}))}function me(t){return function(){var e=this.__on;if(e){for(var n,r=0,i=-1,o=e.length;r=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var _e=[null];function we(t,e){this._groups=t,this._parents=e}function xe(){return new we([[document.documentElement]],_e)}function Te(t){return"string"==typeof t?new we([[document.querySelector(t)]],[document.documentElement]):new we([[t]],_e)}we.prototype=xe.prototype={constructor:we,select:function(t){"function"!=typeof t&&(t=bt(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i=w&&(w=_+1);!(y=g[w])&&++w=0;)(r=i[o])&&(a&&4^r.compareDocumentPosition(a)&&a.parentNode.insertBefore(r,a),a=r);return this},sort:function(t){function e(e,n){return e&&n?t(e.__data__,n.__data__):!e-!n}t||(t=Ot);for(var n=this._groups,r=n.length,i=new Array(r),o=0;o1?this.each((null==e?zt:"function"==typeof e?Vt:Ut)(t,e,null==n?"":n)):Ht(this.node(),t)},property:function(t,e){return arguments.length>1?this.each((null==e?Gt:"function"==typeof e?Wt:Yt)(t,e)):this.node()[t]},classed:function(t,e){var n=$t(t+"");if(arguments.length<2){for(var r=Kt(this.node()),i=-1,o=n.length;++i()=>t;function Ie(t,{sourceEvent:e,subject:n,target:r,identifier:i,active:o,x:a,y:s,dx:l,dy:c,dispatch:u}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:o,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:u}})}function Be(t){return!t.ctrlKey&&!t.button}function Pe(){return this.parentNode}function je(t,e){return null==e?{x:t.x,y:t.y}:e}function Re(){return navigator.maxTouchPoints||"ontouchstart"in this}function qe(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function Fe(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function ze(){}Ie.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};var Ue=.7,Ve=1/Ue,He="\\s*([+-]?\\d+)\\s*",Ge="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",Ye="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",We=/^#([0-9a-f]{3,8})$/,$e=new RegExp("^rgb\\("+[He,He,He]+"\\)$"),Ke=new RegExp("^rgb\\("+[Ye,Ye,Ye]+"\\)$"),Xe=new RegExp("^rgba\\("+[He,He,He,Ge]+"\\)$"),Qe=new RegExp("^rgba\\("+[Ye,Ye,Ye,Ge]+"\\)$"),Ze=new RegExp("^hsl\\("+[Ge,Ye,Ye]+"\\)$"),Je=new RegExp("^hsla\\("+[Ge,Ye,Ye,Ge]+"\\)$"),tn={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 en(){return this.rgb().formatHex()}function nn(){return this.rgb().formatRgb()}function rn(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=We.exec(t))?(n=e[1].length,e=parseInt(e[1],16),6===n?on(e):3===n?new cn(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===n?an(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?an(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|240&e,((15&e)<<4|15&e)/255):null):(e=$e.exec(t))?new cn(e[1],e[2],e[3],1):(e=Ke.exec(t))?new cn(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=Xe.exec(t))?an(e[1],e[2],e[3],e[4]):(e=Qe.exec(t))?an(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=Ze.exec(t))?hn(e[1],e[2]/100,e[3]/100,1):(e=Je.exec(t))?hn(e[1],e[2]/100,e[3]/100,e[4]):tn.hasOwnProperty(t)?on(tn[t]):"transparent"===t?new cn(NaN,NaN,NaN,0):null}function on(t){return new cn(t>>16&255,t>>8&255,255&t,1)}function an(t,e,n,r){return r<=0&&(t=e=n=NaN),new cn(t,e,n,r)}function sn(t){return t instanceof ze||(t=rn(t)),t?new cn((t=t.rgb()).r,t.g,t.b,t.opacity):new cn}function ln(t,e,n,r){return 1===arguments.length?sn(t):new cn(t,e,n,null==r?1:r)}function cn(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}function un(){return"#"+fn(this.r)+fn(this.g)+fn(this.b)}function dn(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===t?")":", "+t+")")}function fn(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function hn(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new gn(t,e,n,r)}function pn(t){if(t instanceof gn)return new gn(t.h,t.s,t.l,t.opacity);if(t instanceof ze||(t=rn(t)),!t)return new gn;if(t instanceof gn)return t;var e=(t=t.rgb()).r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),o=Math.max(e,n,r),a=NaN,s=o-i,l=(o+i)/2;return s?(a=e===o?(n-r)/s+6*(n0&&l<1?0:a,new gn(a,s,l,t.opacity)}function mn(t,e,n,r){return 1===arguments.length?pn(t):new gn(t,e,n,null==r?1:r)}function gn(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function bn(t,e,n){return 255*(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)}qe(ze,rn,{copy:function(t){return Object.assign(new this.constructor,this,t)},displayable:function(){return this.rgb().displayable()},hex:en,formatHex:en,formatHsl:function(){return pn(this).formatHsl()},formatRgb:nn,toString:nn}),qe(cn,ln,Fe(ze,{brighter:function(t){return t=null==t?Ve:Math.pow(Ve,t),new cn(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?Ue:Math.pow(Ue,t),new cn(this.r*t,this.g*t,this.b*t,this.opacity)},rgb:function(){return this},displayable:function(){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:un,formatHex:un,formatRgb:dn,toString:dn})),qe(gn,mn,Fe(ze,{brighter:function(t){return t=null==t?Ve:Math.pow(Ve,t),new gn(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?Ue:Math.pow(Ue,t),new gn(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,i=2*n-r;return new cn(bn(t>=240?t-240:t+120,i,r),bn(t,i,r),bn(t<120?t+240:t-120,i,r),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl:function(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"hsl(":"hsla(")+(this.h||0)+", "+100*(this.s||0)+"%, "+100*(this.l||0)+"%"+(1===t?")":", "+t+")")}}));const vn=Math.PI/180,yn=180/Math.PI,_n=.96422,wn=.82521,xn=4/29,Tn=6/29,An=3*Tn*Tn;function En(t){if(t instanceof Sn)return new Sn(t.l,t.a,t.b,t.opacity);if(t instanceof In)return Bn(t);t instanceof cn||(t=sn(t));var e,n,r=Dn(t.r),i=Dn(t.g),o=Dn(t.b),a=Nn((.2225045*r+.7168786*i+.0606169*o)/1);return r===i&&i===o?e=n=a:(e=Nn((.4360747*r+.3850649*i+.1430804*o)/_n),n=Nn((.0139322*r+.0971045*i+.7141733*o)/wn)),new Sn(116*a-16,500*(e-a),200*(a-n),t.opacity)}function Mn(t,e,n,r){return 1===arguments.length?En(t):new Sn(t,e,n,null==r?1:r)}function Sn(t,e,n,r){this.l=+t,this.a=+e,this.b=+n,this.opacity=+r}function Nn(t){return t>.008856451679035631?Math.pow(t,1/3):t/An+xn}function kn(t){return t>Tn?t*t*t:An*(t-xn)}function Cn(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function Dn(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Ln(t){if(t instanceof In)return new In(t.h,t.c,t.l,t.opacity);if(t instanceof Sn||(t=En(t)),0===t.a&&0===t.b)return new In(NaN,0=1?(n=1,e-1):Math.floor(n*e),i=t[r],o=t[r+1],a=r>0?t[r-1]:2*i-o,s=r()=>t;function Qn(t,e){return function(n){return t+n*e}}function Zn(t,e){var n=e-t;return n?Qn(t,n>180||n<-180?n-360*Math.round(n/360):n):Xn(isNaN(t)?e:t)}function Jn(t,e){var n=e-t;return n?Qn(t,n):Xn(isNaN(t)?e:t)}var tr=function t(e){var n=function(t){return 1==(t=+t)?Jn:function(e,n){return n-e?function(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}(e,n,t):Xn(isNaN(e)?n:e)}}(e);function r(t,e){var r=n((t=ln(t)).r,(e=ln(e)).r),i=n(t.g,e.g),o=n(t.b,e.b),a=Jn(t.opacity,e.opacity);return function(e){return t.r=r(e),t.g=i(e),t.b=o(e),t.opacity=a(e),t+""}}return r.gamma=t,r}(1);function er(t){return function(e){var n,r,i=e.length,o=new Array(i),a=new Array(i),s=new Array(i);for(n=0;no&&(i=e.slice(o,i),s[a]?s[a]+=i:s[++a]=i),(n=n[0])===(r=r[0])?s[a]?s[a]+=r:s[++a]=r:(s[++a]=null,l.push({i:a,x:lr(n,r)})),o=dr.lastIndex;return o180?e+=360:e-t>180&&(t+=360),o.push({i:n.push(i(n)+"rotate(",null,r)-2,x:lr(t,e)})):e&&n.push(i(n)+"rotate("+e+r)}(o.rotate,a.rotate,s,l),function(t,e,n,o){t!==e?o.push({i:n.push(i(n)+"skewX(",null,r)-2,x:lr(t,e)}):e&&n.push(i(n)+"skewX("+e+r)}(o.skewX,a.skewX,s,l),function(t,e,n,r,o,a){if(t!==n||e!==r){var s=o.push(i(o)+"scale(",null,",",null,")");a.push({i:s-4,x:lr(t,n)},{i:s-2,x:lr(e,r)})}else 1===n&&1===r||o.push(i(o)+"scale("+n+","+r+")")}(o.scaleX,o.scaleY,a.scaleX,a.scaleY,s,l),o=a=null,function(t){for(var e,n=-1,r=l.length;++n=0&&e._call.call(null,t),e=e._next;--Pr}function Kr(){Fr=(qr=Ur.now())+zr,Pr=jr=0;try{$r()}finally{Pr=0,function(){for(var t,e,n=Ir,r=1/0;n;)n._call?(r>n._time&&(r=n._time),t=n,n=n._next):(e=n._next,n._next=null,n=t?t._next=e:Ir=e);Br=t,Qr(r)}(),Fr=0}}function Xr(){var t=Ur.now(),e=t-qr;e>1e3&&(zr-=e,qr=t)}function Qr(t){Pr||(jr&&(jr=clearTimeout(jr)),t-Fr>24?(t<1/0&&(jr=setTimeout(Kr,t-Ur.now()-zr)),Rr&&(Rr=clearInterval(Rr))):(Rr||(qr=Ur.now(),Rr=setInterval(Xr,1e3)),Pr=1,Vr(Kr)))}function Zr(t,e,n){var r=new Yr;return e=null==e?0:+e,r.restart((n=>{r.stop(),t(n+e)}),e,n),r}Yr.prototype=Wr.prototype={constructor:Yr,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?Hr():+n)+(null==e?0:+e),this._next||Br===this||(Br?Br._next=this:Ir=this,Br=this),this._call=t,this._time=n,Qr()},stop:function(){this._call&&(this._call=null,this._time=1/0,Qr())}};var Jr=ot("start","end","cancel","interrupt"),ti=[];function ei(t,e,n,r,i,o){var a=t.__transition;if(a){if(n in a)return}else t.__transition={};!function(t,e,n){var r,i=t.__transition;function o(l){var c,u,d,f;if(1!==n.state)return s();for(c in i)if((f=i[c]).name===n.name){if(3===f.state)return Zr(o);4===f.state?(f.state=6,f.timer.stop(),f.on.call("interrupt",t,t.__data__,f.index,f.group),delete i[c]):+c0)throw new Error("too late; already scheduled");return n}function ri(t,e){var n=ii(t,e);if(n.state>3)throw new Error("too late; already running");return n}function ii(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function oi(t,e){var n,r,i,o=t.__transition,a=!0;if(o){for(i in e=null==e?null:e+"",o)(n=o[i]).name===e?(r=n.state>2&&n.state<5,n.state=6,n.timer.stop(),n.on.call(r?"interrupt":"cancel",t,t.__data__,n.index,n.group),delete o[i]):a=!1;a&&delete t.__transition}}function ai(t,e){var n,r;return function(){var i=ri(this,t),o=i.tween;if(o!==n)for(var a=0,s=(r=n=o).length;a=0&&(t=t.slice(0,e)),!t||"start"===t}))}(e)?ni:ri;return function(){var a=o(this,t),s=a.on;s!==r&&(i=(r=s).copy()).on(e,n),a.on=i}}var Mi=xe.prototype.constructor;function Si(t){return function(){this.style.removeProperty(t)}}function Ni(t,e,n){return function(r){this.style.setProperty(t,e.call(this,r),n)}}function ki(t,e,n){var r,i;function o(){var o=e.apply(this,arguments);return o!==i&&(r=(i=o)&&Ni(t,o,n)),r}return o._value=e,o}function Ci(t){return function(e){this.textContent=t.call(this,e)}}function Di(t){var e,n;function r(){var r=t.apply(this,arguments);return r!==n&&(e=(n=r)&&Ci(r)),e}return r._value=t,r}var Li=0;function Oi(t,e,n,r){this._groups=t,this._parents=e,this._name=n,this._id=r}function Ii(t){return xe().transition(t)}function Bi(){return++Li}var Pi=xe.prototype;function ji(t){return((t*=2)<=1?t*t:--t*(2-t)+1)/2}function Ri(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}Oi.prototype=Ii.prototype={constructor:Oi,select:function(t){var e=this._name,n=this._id;"function"!=typeof t&&(t=bt(t));for(var r=this._groups,i=r.length,o=new Array(i),a=0;a()=>t;function lo(t,{sourceEvent:e,target:n,selection:r,mode:i,dispatch:o}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},selection:{value:r,enumerable:!0,configurable:!0},mode:{value:i,enumerable:!0,configurable:!0},_:{value:o}})}function co(t){t.stopImmediatePropagation()}function uo(t){t.preventDefault(),t.stopImmediatePropagation()}var fo={name:"drag"},ho={name:"space"},po={name:"handle"},mo={name:"center"};const{abs:go,max:bo,min:vo}=Math;function yo(t){return[+t[0],+t[1]]}function _o(t){return[yo(t[0]),yo(t[1])]}var wo={name:"x",handles:["w","e"].map(ko),input:function(t,e){return null==t?null:[[+t[0],e[0][1]],[+t[1],e[1][1]]]},output:function(t){return t&&[t[0][0],t[1][0]]}},xo={name:"y",handles:["n","s"].map(ko),input:function(t,e){return null==t?null:[[e[0][0],+t[0]],[e[1][0],+t[1]]]},output:function(t){return t&&[t[0][1],t[1][1]]}},To={name:"xy",handles:["n","w","e","s","nw","ne","sw","se"].map(ko),input:function(t){return null==t?null:_o(t)},output:function(t){return t}},Ao={overlay:"crosshair",selection:"move",n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},Eo={e:"w",w:"e",nw:"ne",ne:"nw",se:"sw",sw:"se"},Mo={n:"s",s:"n",nw:"sw",ne:"se",se:"ne",sw:"nw"},So={overlay:1,selection:1,n:null,e:1,s:null,w:-1,nw:-1,ne:1,se:1,sw:-1},No={overlay:1,selection:1,n:-1,e:null,s:1,w:null,nw:-1,ne:-1,se:1,sw:1};function ko(t){return{type:t}}function Co(t){return!t.ctrlKey&&!t.button}function Do(){var t=this.ownerSVGElement||this;return t.hasAttribute("viewBox")?[[(t=t.viewBox.baseVal).x,t.y],[t.x+t.width,t.y+t.height]]:[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]}function Lo(){return navigator.maxTouchPoints||"ontouchstart"in this}function Oo(t){for(;!t.__brush;)if(!(t=t.parentNode))return;return t.__brush}function Io(t){return t[0][0]===t[1][0]||t[0][1]===t[1][1]}function Bo(t){var e,n=Do,r=Co,i=Lo,o=!0,a=ot("start","brush","end"),s=6;function l(e){var n=e.property("__brush",m).selectAll(".overlay").data([ko("overlay")]);n.enter().append("rect").attr("class","overlay").attr("pointer-events","all").attr("cursor",Ao.overlay).merge(n).each((function(){var t=Oo(this).extent;Te(this).attr("x",t[0][0]).attr("y",t[0][1]).attr("width",t[1][0]-t[0][0]).attr("height",t[1][1]-t[0][1])})),e.selectAll(".selection").data([ko("selection")]).enter().append("rect").attr("class","selection").attr("cursor",Ao.selection).attr("fill","#777").attr("fill-opacity",.3).attr("stroke","#fff").attr("shape-rendering","crispEdges");var r=e.selectAll(".handle").data(t.handles,(function(t){return t.type}));r.exit().remove(),r.enter().append("rect").attr("class",(function(t){return"handle handle--"+t.type})).attr("cursor",(function(t){return Ao[t.type]})),e.each(c).attr("fill","none").attr("pointer-events","all").on("mousedown.brush",f).filter(i).on("touchstart.brush",f).on("touchmove.brush",h).on("touchend.brush touchcancel.brush",p).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function c(){var t=Te(this),e=Oo(this).selection;e?(t.selectAll(".selection").style("display",null).attr("x",e[0][0]).attr("y",e[0][1]).attr("width",e[1][0]-e[0][0]).attr("height",e[1][1]-e[0][1]),t.selectAll(".handle").style("display",null).attr("x",(function(t){return"e"===t.type[t.type.length-1]?e[1][0]-s/2:e[0][0]-s/2})).attr("y",(function(t){return"s"===t.type[0]?e[1][1]-s/2:e[0][1]-s/2})).attr("width",(function(t){return"n"===t.type||"s"===t.type?e[1][0]-e[0][0]+s:s})).attr("height",(function(t){return"e"===t.type||"w"===t.type?e[1][1]-e[0][1]+s:s}))):t.selectAll(".selection,.handle").style("display","none").attr("x",null).attr("y",null).attr("width",null).attr("height",null)}function u(t,e,n){var r=t.__brush.emitter;return!r||n&&r.clean?new d(t,e,n):r}function d(t,e,n){this.that=t,this.args=e,this.state=t.__brush,this.active=0,this.clean=n}function f(n){if((!e||n.touches)&&r.apply(this,arguments)){var i,a,s,l,d,f,h,p,m,g,b,v=this,y=n.target.__data__.type,_="selection"===(o&&n.metaKey?y="overlay":y)?fo:o&&n.altKey?mo:po,w=t===xo?null:So[y],x=t===wo?null:No[y],T=Oo(v),A=T.extent,E=T.selection,M=A[0][0],S=A[0][1],N=A[1][0],k=A[1][1],C=0,D=0,L=w&&x&&o&&n.shiftKey,O=Array.from(n.touches||[n],(t=>{const e=t.identifier;return(t=Ne(t,v)).point0=t.slice(),t.identifier=e,t}));if("overlay"===y){E&&(m=!0);const e=[O[0],O[1]||O[0]];T.selection=E=[[i=t===xo?M:vo(e[0][0],e[1][0]),s=t===wo?S:vo(e[0][1],e[1][1])],[d=t===xo?N:bo(e[0][0],e[1][0]),h=t===wo?k:bo(e[0][1],e[1][1])]],O.length>1&&q()}else i=E[0][0],s=E[0][1],d=E[1][0],h=E[1][1];a=i,l=s,f=d,p=h;var I=Te(v).attr("pointer-events","none"),B=I.selectAll(".overlay").attr("cursor",Ao[y]);oi(v);var P=u(v,arguments,!0).beforestart();if(n.touches)P.moved=R,P.ended=F;else{var j=Te(n.view).on("mousemove.brush",R,!0).on("mouseup.brush",F,!0);o&&j.on("keydown.brush",z,!0).on("keyup.brush",U,!0),De(n.view)}c.call(v),P.start(n,_.name)}function R(t){for(const e of t.changedTouches||[t])for(const t of O)t.identifier===e.identifier&&(t.cur=Ne(e,v));if(L&&!g&&!b&&1===O.length){const t=O[0];go(t.cur[0]-t[0])>go(t.cur[1]-t[1])?b=!0:g=!0}for(const t of O)t.cur&&(t[0]=t.cur[0],t[1]=t.cur[1]);m=!0,uo(t),q(t)}function q(t){const e=O[0],n=e.point0;var r;switch(C=e[0]-n[0],D=e[1]-n[1],_){case ho:case fo:w&&(C=bo(M-i,vo(N-d,C)),a=i+C,f=d+C),x&&(D=bo(S-s,vo(k-h,D)),l=s+D,p=h+D);break;case po:O[1]?(w&&(a=bo(M,vo(N,O[0][0])),f=bo(M,vo(N,O[1][0])),w=1),x&&(l=bo(S,vo(k,O[0][1])),p=bo(S,vo(k,O[1][1])),x=1)):(w<0?(C=bo(M-i,vo(N-i,C)),a=i+C,f=d):w>0&&(C=bo(M-d,vo(N-d,C)),a=i,f=d+C),x<0?(D=bo(S-s,vo(k-s,D)),l=s+D,p=h):x>0&&(D=bo(S-h,vo(k-h,D)),l=s,p=h+D));break;case mo:w&&(a=bo(M,vo(N,i-C*w)),f=bo(M,vo(N,d+C*w))),x&&(l=bo(S,vo(k,s-D*x)),p=bo(S,vo(k,h+D*x)))}f0&&(i=a-C),x<0?h=p-D:x>0&&(s=l-D),_=ho,B.attr("cursor",Ao.selection),q());break;default:return}uo(t)}function U(t){switch(t.keyCode){case 16:L&&(g=b=L=!1,q());break;case 18:_===mo&&(w<0?d=f:w>0&&(i=a),x<0?h=p:x>0&&(s=l),_=po,q());break;case 32:_===ho&&(t.altKey?(w&&(d=f-C*w,i=a+C*w),x&&(h=p-D*x,s=l+D*x),_=mo):(w<0?d=f:w>0&&(i=a),x<0?h=p:x>0&&(s=l),_=po),B.attr("cursor",Ao[y]),q());break;default:return}uo(t)}}function h(t){u(this,arguments).moved(t)}function p(t){u(this,arguments).ended(t)}function m(){var e=this.__brush||{selection:null};return e.extent=_o(n.apply(this,arguments)),e.dim=t,e}return l.move=function(e,n){e.tween?e.on("start.brush",(function(t){u(this,arguments).beforestart().start(t)})).on("interrupt.brush end.brush",(function(t){u(this,arguments).end(t)})).tween("brush",(function(){var e=this,r=e.__brush,i=u(e,arguments),o=r.selection,a=t.input("function"==typeof n?n.apply(this,arguments):n,r.extent),s=hr(o,a);function l(t){r.selection=1===t&&null===a?null:s(t),c.call(e),i.brush()}return null!==o&&null!==a?l:l(1)})):e.each((function(){var e=this,r=arguments,i=e.__brush,o=t.input("function"==typeof n?n.apply(e,r):n,i.extent),a=u(e,r).beforestart();oi(e),i.selection=null===o?null:o,c.call(e),a.start().brush().end()}))},l.clear=function(t){l.move(t,null)},d.prototype={beforestart:function(){return 1==++this.active&&(this.state.emitter=this,this.starting=!0),this},start:function(t,e){return this.starting?(this.starting=!1,this.emit("start",t,e)):this.emit("brush",t),this},brush:function(t,e){return this.emit("brush",t,e),this},end:function(t,e){return 0==--this.active&&(delete this.state.emitter,this.emit("end",t,e)),this},emit:function(e,n,r){var i=Te(this.that).datum();a.call(e,this.that,new lo(e,{sourceEvent:n,target:l,selection:t.output(this.state.selection),mode:r,dispatch:a}),i)}},l.extent=function(t){return arguments.length?(n="function"==typeof t?t:so(_o(t)),l):n},l.filter=function(t){return arguments.length?(r="function"==typeof t?t:so(!!t),l):r},l.touchable=function(t){return arguments.length?(i="function"==typeof t?t:so(!!t),l):i},l.handleSize=function(t){return arguments.length?(s=+t,l):s},l.keyModifiers=function(t){return arguments.length?(o=!!t,l):o},l.on=function(){var t=a.on.apply(a,arguments);return t===a?l:t},l}var Po=Math.abs,jo=Math.cos,Ro=Math.sin,qo=Math.PI,Fo=qo/2,zo=2*qo,Uo=Math.max,Vo=1e-12;function Ho(t,e){return Array.from({length:e-t},((e,n)=>t+n))}function Go(t){return function(e,n){return t(e.source.value+e.target.value,n.source.value+n.target.value)}}function Yo(t,e){var n=0,r=null,i=null,o=null;function a(a){var s,l=a.length,c=new Array(l),u=Ho(0,l),d=new Array(l*l),f=new Array(l),h=0;a=Float64Array.from({length:l*l},e?(t,e)=>a[e%l][e/l|0]:(t,e)=>a[e/l|0][e%l]);for(let e=0;er(c[t],c[e])));for(const n of u){const r=e;if(t){const t=Ho(1+~l,l).filter((t=>t<0?a[~t*l+n]:a[n*l+t]));i&&t.sort(((t,e)=>i(t<0?-a[~t*l+n]:a[n*l+t],e<0?-a[~e*l+n]:a[n*l+e])));for(const r of t)r<0?(d[~r*l+n]||(d[~r*l+n]={source:null,target:null})).target={index:n,startAngle:e,endAngle:e+=a[~r*l+n]*h,value:a[~r*l+n]}:(d[n*l+r]||(d[n*l+r]={source:null,target:null})).source={index:n,startAngle:e,endAngle:e+=a[n*l+r]*h,value:a[n*l+r]};f[n]={index:n,startAngle:r,endAngle:e,value:c[n]}}else{const t=Ho(0,l).filter((t=>a[n*l+t]||a[t*l+n]));i&&t.sort(((t,e)=>i(a[n*l+t],a[n*l+e])));for(const r of t){let t;if(nKo)if(Math.abs(u*s-l*c)>Ko&&i){var f=n-o,h=r-a,p=s*s+l*l,m=f*f+h*h,g=Math.sqrt(p),b=Math.sqrt(d),v=i*Math.tan((Wo-Math.acos((p+d-m)/(2*g*b)))/2),y=v/b,_=v/g;Math.abs(y-1)>Ko&&(this._+="L"+(t+y*c)+","+(e+y*u)),this._+="A"+i+","+i+",0,0,"+ +(u*f>c*h)+","+(this._x1=t+_*s)+","+(this._y1=e+_*l)}else this._+="L"+(this._x1=t)+","+(this._y1=e)},arc:function(t,e,n,r,i,o){t=+t,e=+e,o=!!o;var a=(n=+n)*Math.cos(r),s=n*Math.sin(r),l=t+a,c=e+s,u=1^o,d=o?r-i:i-r;if(n<0)throw new Error("negative radius: "+n);null===this._x1?this._+="M"+l+","+c:(Math.abs(this._x1-l)>Ko||Math.abs(this._y1-c)>Ko)&&(this._+="L"+l+","+c),n&&(d<0&&(d=d%$o+$o),d>Xo?this._+="A"+n+","+n+",0,1,"+u+","+(t-a)+","+(e-s)+"A"+n+","+n+",0,1,"+u+","+(this._x1=l)+","+(this._y1=c):d>Ko&&(this._+="A"+n+","+n+",0,"+ +(d>=Wo)+","+u+","+(this._x1=t+n*Math.cos(i))+","+(this._y1=e+n*Math.sin(i))))},rect:function(t,e,n,r){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)+"h"+ +n+"v"+ +r+"h"+-n+"Z"},toString:function(){return this._}};var Jo=Array.prototype.slice;function ta(t){return function(){return t}}function ea(t){return t.source}function na(t){return t.target}function ra(t){return t.radius}function ia(t){return t.startAngle}function oa(t){return t.endAngle}function aa(){return 0}function sa(){return 10}function la(t){var e=ea,n=na,r=ra,i=ra,o=ia,a=oa,s=aa,l=null;function c(){var c,u=e.apply(this,arguments),d=n.apply(this,arguments),f=s.apply(this,arguments)/2,h=Jo.call(arguments),p=+r.apply(this,(h[0]=u,h)),m=o.apply(this,h)-Fo,g=a.apply(this,h)-Fo,b=+i.apply(this,(h[0]=d,h)),v=o.apply(this,h)-Fo,y=a.apply(this,h)-Fo;if(l||(l=c=Zo()),f>Vo&&(Po(g-m)>2*f+Vo?g>m?(m+=f,g-=f):(m-=f,g+=f):m=g=(m+g)/2,Po(y-v)>2*f+Vo?y>v?(v+=f,y-=f):(v-=f,y+=f):v=y=(v+y)/2),l.moveTo(p*jo(m),p*Ro(m)),l.arc(0,0,p,m,g),m!==v||g!==y)if(t){var _=+t.apply(this,arguments),w=b-_,x=(v+y)/2;l.quadraticCurveTo(0,0,w*jo(v),w*Ro(v)),l.lineTo(b*jo(x),b*Ro(x)),l.lineTo(w*jo(y),w*Ro(y))}else l.quadraticCurveTo(0,0,b*jo(v),b*Ro(v)),l.arc(0,0,b,v,y);if(l.quadraticCurveTo(0,0,p*jo(m),p*Ro(m)),l.closePath(),c)return l=null,c+""||null}return t&&(c.headRadius=function(e){return arguments.length?(t="function"==typeof e?e:ta(+e),c):t}),c.radius=function(t){return arguments.length?(r=i="function"==typeof t?t:ta(+t),c):r},c.sourceRadius=function(t){return arguments.length?(r="function"==typeof t?t:ta(+t),c):r},c.targetRadius=function(t){return arguments.length?(i="function"==typeof t?t:ta(+t),c):i},c.startAngle=function(t){return arguments.length?(o="function"==typeof t?t:ta(+t),c):o},c.endAngle=function(t){return arguments.length?(a="function"==typeof t?t:ta(+t),c):a},c.padAngle=function(t){return arguments.length?(s="function"==typeof t?t:ta(+t),c):s},c.source=function(t){return arguments.length?(e=t,c):e},c.target=function(t){return arguments.length?(n=t,c):n},c.context=function(t){return arguments.length?(l=null==t?null:t,c):l},c}var ca=Array.prototype.slice;function ua(t,e){return t-e}var da=t=>()=>t;function fa(t,e){for(var n,r=-1,i=e.length;++rr!=h>r&&n<(f-c)*(r-u)/(h-u)+c&&(i=-i)}return i}function pa(t,e,n){var r,i,o,a;return function(t,e,n){return(e[0]-t[0])*(n[1]-t[1])==(n[0]-t[0])*(e[1]-t[1])}(t,e,n)&&(i=t[r=+(t[0]===e[0])],o=n[r],a=e[r],i<=o&&o<=a||a<=o&&o<=i)}function ma(){}var ga=[[],[[[1,1.5],[.5,1]]],[[[1.5,1],[1,1.5]]],[[[1.5,1],[.5,1]]],[[[1,.5],[1.5,1]]],[[[1,1.5],[.5,1]],[[1,.5],[1.5,1]]],[[[1,.5],[1,1.5]]],[[[1,.5],[.5,1]]],[[[.5,1],[1,.5]]],[[[1,1.5],[1,.5]]],[[[.5,1],[1,.5]],[[1.5,1],[1,1.5]]],[[[1.5,1],[1,.5]]],[[[.5,1],[1.5,1]]],[[[1,1.5],[1.5,1]]],[[[.5,1],[1,1.5]]],[]];function ba(){var t=1,e=1,n=N,r=s;function i(t){var e=n(t);if(Array.isArray(e))e=e.slice().sort(ua);else{var r=p(t),i=r[0],a=r[1];e=M(i,a,e),e=z(Math.floor(i/e)*e,Math.floor(a/e)*e,e)}return e.map((function(e){return o(t,e)}))}function o(n,i){var o=[],s=[];return function(n,r,i){var o,s,l,c,u,d,f=new Array,h=new Array;for(o=s=-1,c=n[0]>=r,ga[c<<1].forEach(p);++o=r,ga[l|c<<1].forEach(p);for(ga[c<<0].forEach(p);++s=r,u=n[s*t]>=r,ga[c<<1|u<<2].forEach(p);++o=r,d=u,u=n[s*t+o+1]>=r,ga[l|c<<1|u<<2|d<<3].forEach(p);ga[c|u<<3].forEach(p)}for(o=-1,u=n[s*t]>=r,ga[u<<2].forEach(p);++o=r,ga[u<<2|d<<3].forEach(p);function p(t){var e,n,r=[t[0][0]+o,t[0][1]+s],l=[t[1][0]+o,t[1][1]+s],c=a(r),u=a(l);(e=h[c])?(n=f[u])?(delete h[e.end],delete f[n.start],e===n?(e.ring.push(l),i(e.ring)):f[e.start]=h[n.end]={start:e.start,end:n.end,ring:e.ring.concat(n.ring)}):(delete h[e.end],e.ring.push(l),h[e.end=u]=e):(e=f[u])?(n=h[c])?(delete f[e.start],delete h[n.end],e===n?(e.ring.push(l),i(e.ring)):f[n.start]=h[e.end]={start:n.start,end:e.end,ring:n.ring.concat(e.ring)}):(delete f[e.start],e.ring.unshift(r),f[e.start=c]=e):f[c]=h[u]={start:c,end:u,ring:[r,l]}}ga[u<<3].forEach(p)}(n,i,(function(t){r(t,n,i),function(t){for(var e=0,n=t.length,r=t[n-1][1]*t[0][0]-t[n-1][0]*t[0][1];++e0?o.push([t]):s.push(t)})),s.forEach((function(t){for(var e,n=0,r=o.length;n0&&a0&&s=0&&o>=0))throw new Error("invalid size");return t=r,e=o,i},i.thresholds=function(t){return arguments.length?(n="function"==typeof t?t:Array.isArray(t)?da(ca.call(t)):da(t),i):n},i.smooth=function(t){return arguments.length?(r=t?s:ma,i):r===s},i}function va(t,e,n){for(var r=t.width,i=t.height,o=1+(n<<1),a=0;a=n&&(s>=o&&(l-=t.data[s-o+a*r]),e.data[s-n+a*r]=l/Math.min(s+1,r-1+o-s,o))}function ya(t,e,n){for(var r=t.width,i=t.height,o=1+(n<<1),a=0;a=n&&(s>=o&&(l-=t.data[a+(s-o)*r]),e.data[a+(s-n)*r]=l/Math.min(s+1,i-1+o-s,o))}function _a(t){return t[0]}function wa(t){return t[1]}function xa(){return 1}const Ta=Math.pow(2,-52),Aa=new Uint32Array(512);class Ea{static from(t,e=Oa,n=Ia){const r=t.length,i=new Float64Array(2*r);for(let o=0;o>1;if(e>0&&"number"!=typeof t[0])throw new Error("Expected coords to contain numbers.");this.coords=t;const n=Math.max(2*e-5,0);this._triangles=new Uint32Array(3*n),this._halfedges=new Int32Array(3*n),this._hashSize=Math.ceil(Math.sqrt(e)),this._hullPrev=new Uint32Array(e),this._hullNext=new Uint32Array(e),this._hullTri=new Uint32Array(e),this._hullHash=new Int32Array(this._hashSize).fill(-1),this._ids=new Uint32Array(e),this._dists=new Float64Array(e),this.update()}update(){const{coords:t,_hullPrev:e,_hullNext:n,_hullTri:r,_hullHash:i}=this,o=t.length>>1;let a=1/0,s=1/0,l=-1/0,c=-1/0;for(let e=0;el&&(l=n),r>c&&(c=r),this._ids[e]=e}const u=(a+l)/2,d=(s+c)/2;let f,h,p,m=1/0;for(let e=0;e0&&(h=e,m=n)}let v=t[2*h],y=t[2*h+1],_=1/0;for(let e=0;er&&(e[n++]=i,r=this._dists[i])}return this.hull=e.subarray(0,n),this.triangles=new Uint32Array(0),void(this.halfedges=new Uint32Array(0))}if(Na(g,b,v,y,w,x)){const t=h,e=v,n=y;h=p,v=w,y=x,p=t,w=e,x=n}const T=function(t,e,n,r,i,o){const a=n-t,s=r-e,l=i-t,c=o-e,u=a*a+s*s,d=l*l+c*c,f=.5/(a*c-s*l);return{x:t+(c*u-s*d)*f,y:e+(a*d-l*u)*f}}(g,b,v,y,w,x);this._cx=T.x,this._cy=T.y;for(let e=0;e0&&Math.abs(c-o)<=Ta&&Math.abs(u-a)<=Ta)continue;if(o=c,a=u,l===f||l===h||l===p)continue;let d=0;for(let t=0,e=this._hashKey(c,u);t0?3-n:1+n)/4}(t-this._cx,e-this._cy)*this._hashSize)%this._hashSize}_legalize(t){const{_triangles:e,_halfedges:n,coords:r}=this;let i=0,o=0;for(;;){const a=n[t],s=t-t%3;if(o=s+(t+2)%3,-1===a){if(0===i)break;t=Aa[--i];continue}const l=a-a%3,c=s+(t+1)%3,u=l+(a+2)%3,d=e[o],f=e[t],h=e[c],p=e[u];if(ka(r[2*d],r[2*d+1],r[2*f],r[2*f+1],r[2*h],r[2*h+1],r[2*p],r[2*p+1])){e[t]=p,e[a]=d;const r=n[u];if(-1===r){let e=this._hullStart;do{if(this._hullTri[e]===u){this._hullTri[e]=t;break}e=this._hullPrev[e]}while(e!==this._hullStart)}this._link(t,r),this._link(a,n[o]),this._link(o,u);const s=l+(a+1)%3;i=33306690738754716e-32*Math.abs(a+s)?a-s:0}function Na(t,e,n,r,i,o){return(Sa(i,o,t,e,n,r)||Sa(t,e,n,r,i,o)||Sa(n,r,i,o,t,e))<0}function ka(t,e,n,r,i,o,a,s){const l=t-a,c=e-s,u=n-a,d=r-s,f=i-a,h=o-s,p=u*u+d*d,m=f*f+h*h;return l*(d*m-p*h)-c*(u*m-p*f)+(l*l+c*c)*(u*h-d*f)<0}function Ca(t,e,n,r,i,o){const a=n-t,s=r-e,l=i-t,c=o-e,u=a*a+s*s,d=l*l+c*c,f=.5/(a*c-s*l),h=(c*u-s*d)*f,p=(a*d-l*u)*f;return h*h+p*p}function Da(t,e,n,r){if(r-n<=20)for(let i=n+1;i<=r;i++){const r=t[i],o=e[r];let a=i-1;for(;a>=n&&e[t[a]]>o;)t[a+1]=t[a--];t[a+1]=r}else{let i=n+1,o=r;La(t,n+r>>1,i),e[t[n]]>e[t[r]]&&La(t,n,r),e[t[i]]>e[t[r]]&&La(t,i,r),e[t[n]]>e[t[i]]&&La(t,n,i);const a=t[i],s=e[a];for(;;){do{i++}while(e[t[i]]s);if(o=o-n?(Da(t,e,i,r),Da(t,e,n,o-1)):(Da(t,e,n,o-1),Da(t,e,i,r))}}function La(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function Oa(t){return t[0]}function Ia(t){return t[1]}const Ba=1e-6;class Pa{constructor(){this._x0=this._y0=this._x1=this._y1=null,this._=""}moveTo(t,e){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+e}`}closePath(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")}lineTo(t,e){this._+=`L${this._x1=+t},${this._y1=+e}`}arc(t,e,n){const r=(t=+t)+(n=+n),i=e=+e;if(n<0)throw new Error("negative radius");null===this._x1?this._+=`M${r},${i}`:(Math.abs(this._x1-r)>Ba||Math.abs(this._y1-i)>Ba)&&(this._+="L"+r+","+i),n&&(this._+=`A${n},${n},0,1,1,${t-n},${e}A${n},${n},0,1,1,${this._x1=r},${this._y1=i}`)}rect(t,e,n,r){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+e}h${+n}v${+r}h${-n}Z`}value(){return this._||null}}class ja{constructor(){this._=[]}moveTo(t,e){this._.push([t,e])}closePath(){this._.push(this._[0].slice())}lineTo(t,e){this._.push([t,e])}value(){return this._.length?this._:null}}class Ra{constructor(t,[e,n,r,i]=[0,0,960,500]){if(!((r=+r)>=(e=+e)&&(i=+i)>=(n=+n)))throw new Error("invalid bounds");this.delaunay=t,this._circumcenters=new Float64Array(2*t.points.length),this.vectors=new Float64Array(2*t.points.length),this.xmax=r,this.xmin=e,this.ymax=i,this.ymin=n,this._init()}update(){return this.delaunay.update(),this._init(),this}_init(){const{delaunay:{points:t,hull:e,triangles:n},vectors:r}=this,i=this.circumcenters=this._circumcenters.subarray(0,n.length/3*2);for(let e,r,o=0,a=0,s=n.length;o1;)i-=2;for(let t=2;t4)for(let t=0;t0){if(e>=this.ymax)return null;(i=(this.ymax-e)/r)0){if(t>=this.xmax)return null;(i=(this.xmax-t)/n)this.xmax?2:0)|(ethis.ymax?8:0)}}const qa=2*Math.PI,Fa=Math.pow;function za(t){return t[0]}function Ua(t){return t[1]}function Va(t,e,n){return[t+Math.sin(t+e)*n,e+Math.cos(t-e)*n]}class Ha{static from(t,e=za,n=Ua,r){return new Ha("length"in t?function(t,e,n,r){const i=t.length,o=new Float64Array(2*i);for(let a=0;a2&&function(t){const{triangles:e,coords:n}=t;for(let t=0;t1e-10)return!1}return!0}(t)){this.collinear=Int32Array.from({length:e.length/2},((t,e)=>e)).sort(((t,n)=>e[2*t]-e[2*n]||e[2*t+1]-e[2*n+1]));const t=this.collinear[0],n=this.collinear[this.collinear.length-1],r=[e[2*t],e[2*t+1],e[2*n],e[2*n+1]],i=1e-8*Math.hypot(r[3]-r[1],r[2]-r[0]);for(let t=0,n=e.length/2;t0&&(this.triangles=new Int32Array(3).fill(-1),this.halfedges=new Int32Array(3).fill(-1),this.triangles[0]=r[0],this.triangles[1]=r[1],this.triangles[2]=r[1],o[r[0]]=1,2===r.length&&(o[r[1]]=0))}voronoi(t){return new Ra(this,t)}*neighbors(t){const{inedges:e,hull:n,_hullIndex:r,halfedges:i,triangles:o,collinear:a}=this;if(a){const e=a.indexOf(t);return e>0&&(yield a[e-1]),void(e=0&&i!==n&&i!==r;)n=i;return i}_step(t,e,n){const{inedges:r,hull:i,_hullIndex:o,halfedges:a,triangles:s,points:l}=this;if(-1===r[t]||!l.length)return(t+1)%(l.length>>1);let c=t,u=Fa(e-l[2*t],2)+Fa(n-l[2*t+1],2);const d=r[t];let f=d;do{let r=s[f];const d=Fa(e-l[2*r],2)+Fa(n-l[2*r+1],2);if(d=o?l=!0:10===(r=t.charCodeAt(a++))?c=!0:13===r&&(c=!0,10===t.charCodeAt(a)&&++a),t.slice(i+1,e-1).replace(/""/g,'"')}for(;a9999?"+"+Ka(t,6):Ka(t,4)}(t.getUTCFullYear())+"-"+Ka(t.getUTCMonth()+1,2)+"-"+Ka(t.getUTCDate(),2)+(i?"T"+Ka(e,2)+":"+Ka(n,2)+":"+Ka(r,2)+"."+Ka(i,3)+"Z":r?"T"+Ka(e,2)+":"+Ka(n,2)+":"+Ka(r,2)+"Z":n||e?"T"+Ka(e,2)+":"+Ka(n,2)+"Z":"")}(t):e.test(t+="")?'"'+t.replace(/"/g,'""')+'"':t}return{parse:function(t,e){var n,i,o=r(t,(function(t,r){if(n)return n(t,r-1);i=t,n=e?function(t,e){var n=Wa(t);return function(r,i){return e(n(r),i,t)}}(t,e):Wa(t)}));return o.columns=i||[],o},parseRows:r,format:function(e,n){return null==n&&(n=$a(e)),[n.map(a).join(t)].concat(i(e,n)).join("\n")},formatBody:function(t,e){return null==e&&(e=$a(t)),i(t,e).join("\n")},formatRows:function(t){return t.map(o).join("\n")},formatRow:o,formatValue:a}}var Qa=Xa(","),Za=Qa.parse,Ja=Qa.parseRows,ts=Qa.format,es=Qa.formatBody,ns=Qa.formatRows,rs=Qa.formatRow,is=Qa.formatValue,os=Xa("\t"),as=os.parse,ss=os.parseRows,ls=os.format,cs=os.formatBody,us=os.formatRows,ds=os.formatRow,fs=os.formatValue;const hs=new Date("2019-01-01T00:00").getHours()||new Date("2019-07-01T00:00").getHours();function ps(t){if(!t.ok)throw new Error(t.status+" "+t.statusText);return t.blob()}function ms(t){if(!t.ok)throw new Error(t.status+" "+t.statusText);return t.arrayBuffer()}function gs(t){if(!t.ok)throw new Error(t.status+" "+t.statusText);return t.text()}function bs(t,e){return fetch(t,e).then(gs)}function vs(t){return function(e,n,r){return 2===arguments.length&&"function"==typeof n&&(r=n,n=void 0),bs(e,n).then((function(e){return t(e,r)}))}}var ys=vs(Za),_s=vs(as);function ws(t){if(!t.ok)throw new Error(t.status+" "+t.statusText);if(204!==t.status&&205!==t.status)return t.json()}function xs(t){return(e,n)=>bs(e,n).then((e=>(new DOMParser).parseFromString(e,t)))}var Ts=xs("application/xml"),As=xs("text/html"),Es=xs("image/svg+xml");function Ms(t,e,n,r){if(isNaN(e)||isNaN(n))return t;var i,o,a,s,l,c,u,d,f,h=t._root,p={data:r},m=t._x0,g=t._y0,b=t._x1,v=t._y1;if(!h)return t._root=p,t;for(;h.length;)if((c=e>=(o=(m+b)/2))?m=o:b=o,(u=n>=(a=(g+v)/2))?g=a:v=a,i=h,!(h=h[d=u<<1|c]))return i[d]=p,t;if(s=+t._x.call(null,h.data),l=+t._y.call(null,h.data),e===s&&n===l)return p.next=h,i?i[d]=p:t._root=p,t;do{i=i?i[d]=new Array(4):t._root=new Array(4),(c=e>=(o=(m+b)/2))?m=o:b=o,(u=n>=(a=(g+v)/2))?g=a:v=a}while((d=u<<1|c)==(f=(l>=a)<<1|s>=o));return i[f]=h,i[d]=p,t}function Ss(t,e,n,r,i){this.node=t,this.x0=e,this.y0=n,this.x1=r,this.y1=i}function Ns(t){return t[0]}function ks(t){return t[1]}function Cs(t,e,n){var r=new Ds(null==e?Ns:e,null==n?ks:n,NaN,NaN,NaN,NaN);return null==t?r:r.addAll(t)}function Ds(t,e,n,r,i,o){this._x=t,this._y=e,this._x0=n,this._y0=r,this._x1=i,this._y1=o,this._root=void 0}function Ls(t){for(var e={data:t.data},n=e;t=t.next;)n=n.next={data:t.data};return e}var Os=Cs.prototype=Ds.prototype;function Is(t){return function(){return t}}function Bs(t){return 1e-6*(t()-.5)}function Ps(t){return t.x+t.vx}function js(t){return t.y+t.vy}function Rs(t){return t.index}function qs(t,e){var n=t.get(e);if(!n)throw new Error("node not found: "+e);return n}Os.copy=function(){var t,e,n=new Ds(this._x,this._y,this._x0,this._y0,this._x1,this._y1),r=this._root;if(!r)return n;if(!r.length)return n._root=Ls(r),n;for(t=[{source:r,target:n._root=new Array(4)}];r=t.pop();)for(var i=0;i<4;++i)(e=r.source[i])&&(e.length?t.push({source:e,target:r.target[i]=new Array(4)}):r.target[i]=Ls(e));return n},Os.add=function(t){const e=+this._x.call(null,t),n=+this._y.call(null,t);return Ms(this.cover(e,n),e,n,t)},Os.addAll=function(t){var e,n,r,i,o=t.length,a=new Array(o),s=new Array(o),l=1/0,c=1/0,u=-1/0,d=-1/0;for(n=0;nu&&(u=r),id&&(d=i));if(l>u||c>d)return this;for(this.cover(l,c).cover(u,d),n=0;nt||t>=i||r>e||e>=o;)switch(s=(ef||(o=l.y0)>h||(a=l.x1)=b)<<1|t>=g)&&(l=p[p.length-1],p[p.length-1]=p[p.length-1-c],p[p.length-1-c]=l)}else{var v=t-+this._x.call(null,m.data),y=e-+this._y.call(null,m.data),_=v*v+y*y;if(_=(s=(p+g)/2))?p=s:g=s,(u=a>=(l=(m+b)/2))?m=l:b=l,e=h,!(h=h[d=u<<1|c]))return this;if(!h.length)break;(e[d+1&3]||e[d+2&3]||e[d+3&3])&&(n=e,f=d)}for(;h.data!==t;)if(r=h,!(h=h.next))return this;return(i=h.next)&&delete h.next,r?(i?r.next=i:delete r.next,this):e?(i?e[d]=i:delete e[d],(h=e[0]||e[1]||e[2]||e[3])&&h===(e[3]||e[2]||e[1]||e[0])&&!h.length&&(n?n[f]=h:this._root=h),this):(this._root=i,this)},Os.removeAll=function(t){for(var e=0,n=t.length;e1?r[0]+r.slice(2):r,+t.slice(n+1)]}function Gs(t){return(t=Hs(Math.abs(t)))?t[1]:NaN}var Ys,Ws=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function $s(t){if(!(e=Ws.exec(t)))throw new Error("invalid format: "+t);var e;return new Ks({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}function Ks(t){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}function Xs(t,e){var n=Hs(t,e);if(!n)return t+"";var r=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}$s.prototype=Ks.prototype,Ks.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};var Qs={"%":(t,e)=>(100*t).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>Xs(100*t,e),r:Xs,s:function(t,e){var n=Hs(t,e);if(!n)return t+"";var r=n[0],i=n[1],o=i-(Ys=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,a=r.length;return o===a?r:o>a?r+new Array(o-a+1).join("0"):o>0?r.slice(0,o)+"."+r.slice(o):"0."+new Array(1-o).join("0")+Hs(t,Math.max(0,e+o-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function Zs(t){return t}var Js,tl=Array.prototype.map,el=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function nl(t){var e,n,r=void 0===t.grouping||void 0===t.thousands?Zs:(e=tl.call(t.grouping,Number),n=t.thousands+"",function(t,r){for(var i=t.length,o=[],a=0,s=e[0],l=0;i>0&&s>0&&(l+s+1>r&&(s=Math.max(1,r-l)),o.push(t.substring(i-=s,i+s)),!((l+=s+1)>r));)s=e[a=(a+1)%e.length];return o.reverse().join(n)}),i=void 0===t.currency?"":t.currency[0]+"",o=void 0===t.currency?"":t.currency[1]+"",a=void 0===t.decimal?".":t.decimal+"",s=void 0===t.numerals?Zs:function(t){return function(e){return e.replace(/[0-9]/g,(function(e){return t[+e]}))}}(tl.call(t.numerals,String)),l=void 0===t.percent?"%":t.percent+"",c=void 0===t.minus?"−":t.minus+"",u=void 0===t.nan?"NaN":t.nan+"";function d(t){var e=(t=$s(t)).fill,n=t.align,d=t.sign,f=t.symbol,h=t.zero,p=t.width,m=t.comma,g=t.precision,b=t.trim,v=t.type;"n"===v?(m=!0,v="g"):Qs[v]||(void 0===g&&(g=12),b=!0,v="g"),(h||"0"===e&&"="===n)&&(h=!0,e="0",n="=");var y="$"===f?i:"#"===f&&/[boxX]/.test(v)?"0"+v.toLowerCase():"",_="$"===f?o:/[%p]/.test(v)?l:"",w=Qs[v],x=/[defgprs%]/.test(v);function T(t){var i,o,l,f=y,T=_;if("c"===v)T=w(t)+T,t="";else{var A=(t=+t)<0||1/t<0;if(t=isNaN(t)?u:w(Math.abs(t),g),b&&(t=function(t){t:for(var e,n=t.length,r=1,i=-1;r0&&(i=0)}return i>0?t.slice(0,i)+t.slice(e+1):t}(t)),A&&0==+t&&"+"!==d&&(A=!1),f=(A?"("===d?d:c:"-"===d||"("===d?"":d)+f,T=("s"===v?el[8+Ys/3]:"")+T+(A&&"("===d?")":""),x)for(i=-1,o=t.length;++i(l=t.charCodeAt(i))||l>57){T=(46===l?a+t.slice(i+1):t.slice(i))+T,t=t.slice(0,i);break}}m&&!h&&(t=r(t,1/0));var E=f.length+t.length+T.length,M=E>1)+f+t+T+M.slice(E);break;default:t=M+f+t+T}return s(t)}return g=void 0===g?6:/[gprs]/.test(v)?Math.max(1,Math.min(21,g)):Math.max(0,Math.min(20,g)),T.toString=function(){return t+""},T}return{format:d,formatPrefix:function(t,e){var n=d(((t=$s(t)).type="f",t)),r=3*Math.max(-8,Math.min(8,Math.floor(Gs(e)/3))),i=Math.pow(10,-r),o=el[8+r/3];return function(t){return n(i*t)+o}}}}function rl(e){return Js=nl(e),t.format=Js.format,t.formatPrefix=Js.formatPrefix,Js}function il(t){return Math.max(0,-Gs(Math.abs(t)))}function ol(t,e){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(Gs(e)/3)))-Gs(Math.abs(t)))}function al(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,Gs(e)-Gs(t))+1}rl({thousands:",",grouping:[3],currency:["$",""]});var sl=1e-6,ll=1e-12,cl=Math.PI,ul=cl/2,dl=cl/4,fl=2*cl,hl=180/cl,pl=cl/180,ml=Math.abs,gl=Math.atan,bl=Math.atan2,vl=Math.cos,yl=Math.ceil,_l=Math.exp,wl=Math.hypot,xl=Math.log,Tl=Math.pow,Al=Math.sin,El=Math.sign||function(t){return t>0?1:t<0?-1:0},Ml=Math.sqrt,Sl=Math.tan;function Nl(t){return t>1?0:t<-1?cl:Math.acos(t)}function kl(t){return t>1?ul:t<-1?-ul:Math.asin(t)}function Cl(t){return(t=Al(t/2))*t}function Dl(){}function Ll(t,e){t&&Il.hasOwnProperty(t.type)&&Il[t.type](t,e)}var Ol={Feature:function(t,e){Ll(t.geometry,e)},FeatureCollection:function(t,e){for(var n=t.features,r=-1,i=n.length;++r=0?1:-1,i=r*n,o=vl(e=(e*=pl)/2+dl),a=Al(e),s=Ul*a,l=zl*o+s*vl(i),c=s*r*Al(i);tc.add(bl(c,l)),Fl=t,zl=o,Ul=a}function sc(t){return[bl(t[1],t[0]),kl(t[2])]}function lc(t){var e=t[0],n=t[1],r=vl(n);return[r*vl(e),r*Al(e),Al(n)]}function cc(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function uc(t,e){return[t[1]*e[2]-t[2]*e[1],t[2]*e[0]-t[0]*e[2],t[0]*e[1]-t[1]*e[0]]}function dc(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function fc(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function hc(t){var e=Ml(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}var pc,mc,gc,bc,vc,yc,_c,wc,xc,Tc,Ac,Ec,Mc,Sc,Nc,kc,Cc={point:Dc,lineStart:Oc,lineEnd:Ic,polygonStart:function(){Cc.point=Bc,Cc.lineStart=Pc,Cc.lineEnd=jc,Ql=new m,nc.polygonStart()},polygonEnd:function(){nc.polygonEnd(),Cc.point=Dc,Cc.lineStart=Oc,Cc.lineEnd=Ic,tc<0?(Vl=-(Gl=180),Hl=-(Yl=90)):Ql>sl?Yl=90:Ql<-1e-6&&(Hl=-90),Jl[0]=Vl,Jl[1]=Gl},sphere:function(){Vl=-(Gl=180),Hl=-(Yl=90)}};function Dc(t,e){Zl.push(Jl=[Vl=t,Gl=t]),eYl&&(Yl=e)}function Lc(t,e){var n=lc([t*pl,e*pl]);if(Xl){var r=uc(Xl,n),i=uc([r[1],-r[0],0],r);hc(i),i=sc(i);var o,a=t-Wl,s=a>0?1:-1,l=i[0]*hl*s,c=ml(a)>180;c^(s*WlYl&&(Yl=o):c^(s*Wl<(l=(l+360)%360-180)&&lYl&&(Yl=e)),c?tRc(Vl,Gl)&&(Gl=t):Rc(t,Gl)>Rc(Vl,Gl)&&(Vl=t):Gl>=Vl?(tGl&&(Gl=t)):t>Wl?Rc(Vl,t)>Rc(Vl,Gl)&&(Gl=t):Rc(t,Gl)>Rc(Vl,Gl)&&(Vl=t)}else Zl.push(Jl=[Vl=t,Gl=t]);eYl&&(Yl=e),Xl=n,Wl=t}function Oc(){Cc.point=Lc}function Ic(){Jl[0]=Vl,Jl[1]=Gl,Cc.point=Dc,Xl=null}function Bc(t,e){if(Xl){var n=t-Wl;Ql.add(ml(n)>180?n+(n>0?360:-360):n)}else $l=t,Kl=e;nc.point(t,e),Lc(t,e)}function Pc(){nc.lineStart()}function jc(){Bc($l,Kl),nc.lineEnd(),ml(Ql)>sl&&(Vl=-(Gl=180)),Jl[0]=Vl,Jl[1]=Gl,Xl=null}function Rc(t,e){return(e-=t)<0?e+360:e}function qc(t,e){return t[0]-e[0]}function Fc(t,e){return t[0]<=t[1]?t[0]<=e&&e<=t[1]:ecl?t+Math.round(-t/fl)*fl:t,e]}function eu(t,e,n){return(t%=fl)?e||n?Jc(ru(t),iu(e,n)):ru(t):e||n?iu(e,n):tu}function nu(t){return function(e,n){return[(e+=t)>cl?e-fl:e<-cl?e+fl:e,n]}}function ru(t){var e=nu(t);return e.invert=nu(-t),e}function iu(t,e){var n=vl(t),r=Al(t),i=vl(e),o=Al(e);function a(t,e){var a=vl(e),s=vl(t)*a,l=Al(t)*a,c=Al(e),u=c*n+s*r;return[bl(l*i-u*o,s*n-c*r),kl(u*i+l*o)]}return a.invert=function(t,e){var a=vl(e),s=vl(t)*a,l=Al(t)*a,c=Al(e),u=c*i-l*o;return[bl(l*i+c*o,s*n+u*r),kl(u*n-s*r)]},a}function ou(t){function e(e){return(e=t(e[0]*pl,e[1]*pl))[0]*=hl,e[1]*=hl,e}return t=eu(t[0]*pl,t[1]*pl,t.length>2?t[2]*pl:0),e.invert=function(e){return(e=t.invert(e[0]*pl,e[1]*pl))[0]*=hl,e[1]*=hl,e},e}function au(t,e,n,r,i,o){if(n){var a=vl(e),s=Al(e),l=r*n;null==i?(i=e+r*fl,o=e-l/2):(i=su(a,i),o=su(a,o),(r>0?io)&&(i+=r*fl));for(var c,u=i;r>0?u>o:u1&&e.push(e.pop().concat(e.shift()))},result:function(){var n=e;return e=[],t=null,n}}}function cu(t,e){return ml(t[0]-e[0])=0;--o)i.point((u=c[o])[0],u[1]);else r(f.x,f.p.x,-1,i);f=f.p}c=(f=f.o).z,h=!h}while(!f.v);i.lineEnd()}}}function fu(t){if(e=t.length){for(var e,n,r=0,i=t[0];++r=0?1:-1,S=M*E,N=S>cl,k=b*T;if(l.add(bl(k*M*Al(S),v*A+k*vl(S))),a+=N?E+M*fl:E,N^p>=n^w>=n){var C=uc(lc(h),lc(_));hc(C);var D=uc(o,C);hc(D);var L=(N^E>=0?-1:1)*kl(D[2]);(r>L||r===L&&(C[0]||C[1]))&&(s+=N^E>=0?1:-1)}}return(a<-1e-6||a0){for(d||(i.polygonStart(),d=!0),i.lineStart(),t=0;t1&&2&l&&f.push(f.pop().concat(f.shift())),a.push(f.filter(gu))}return f}}function gu(t){return t.length>1}function bu(t,e){return((t=t.x)[0]<0?t[1]-ul-sl:ul-t[1])-((e=e.x)[0]<0?e[1]-ul-sl:ul-e[1])}tu.invert=tu;var vu=mu((function(){return!0}),(function(t){var e,n=NaN,r=NaN,i=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(o,a){var s=o>0?cl:-cl,l=ml(o-n);ml(l-cl)0?ul:-ul),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(s,r),t.point(o,r),e=0):i!==s&&l>=cl&&(ml(n-i)sl?gl((Al(e)*(o=vl(r))*Al(n)-Al(r)*(i=vl(e))*Al(t))/(i*o*a)):(e+r)/2}(n,r,o,a),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(s,r),e=0),t.point(n=o,r=a),i=s},lineEnd:function(){t.lineEnd(),n=r=NaN},clean:function(){return 2-e}}}),(function(t,e,n,r){var i;if(null==t)i=n*ul,r.point(-cl,i),r.point(0,i),r.point(cl,i),r.point(cl,0),r.point(cl,-i),r.point(0,-i),r.point(-cl,-i),r.point(-cl,0),r.point(-cl,i);else if(ml(t[0]-e[0])>sl){var o=t[0]0,i=ml(e)>sl;function o(t,n){return vl(t)*vl(n)>e}function a(t,n,r){var i=[1,0,0],o=uc(lc(t),lc(n)),a=cc(o,o),s=o[0],l=a-s*s;if(!l)return!r&&t;var c=e*a/l,u=-e*s/l,d=uc(i,o),f=fc(i,c);dc(f,fc(o,u));var h=d,p=cc(f,h),m=cc(h,h),g=p*p-m*(cc(f,f)-1);if(!(g<0)){var b=Ml(g),v=fc(h,(-p-b)/m);if(dc(v,f),v=sc(v),!r)return v;var y,_=t[0],w=n[0],x=t[1],T=n[1];w<_&&(y=_,_=w,w=y);var A=w-_,E=ml(A-cl)0^v[1]<(ml(v[0]-_)cl^(_<=v[0]&&v[0]<=w)){var M=fc(h,(-p+b)/m);return dc(M,f),[v,sc(M)]}}}function s(e,n){var i=r?t:cl-t,o=0;return e<-i?o|=1:e>i&&(o|=2),n<-i?o|=4:n>i&&(o|=8),o}return mu(o,(function(t){var e,n,l,c,u;return{lineStart:function(){c=l=!1,u=1},point:function(d,f){var h,p=[d,f],m=o(d,f),g=r?m?0:s(d,f):m?s(d+(d<0?cl:-cl),f):0;if(!e&&(c=l=m)&&t.lineStart(),m!==l&&(!(h=a(e,p))||cu(e,h)||cu(p,h))&&(p[2]=1),m!==l)u=0,m?(t.lineStart(),h=a(p,e),t.point(h[0],h[1])):(h=a(e,p),t.point(h[0],h[1],2),t.lineEnd()),e=h;else if(i&&e&&r^m){var b;g&n||!(b=a(p,e,!0))||(u=0,r?(t.lineStart(),t.point(b[0][0],b[0][1]),t.point(b[1][0],b[1][1]),t.lineEnd()):(t.point(b[1][0],b[1][1]),t.lineEnd(),t.lineStart(),t.point(b[0][0],b[0][1],3)))}!m||e&&cu(e,p)||t.point(p[0],p[1]),e=p,l=m,n=g},lineEnd:function(){l&&t.lineEnd(),e=null},clean:function(){return u|(c&&l)<<1}}}),(function(e,r,i,o){au(o,t,n,i,e,r)}),r?[0,-t]:[-cl,t-cl])}var _u,wu,xu,Tu,Au=1e9,Eu=-Au;function Mu(t,e,n,r){function i(i,o){return t<=i&&i<=n&&e<=o&&o<=r}function o(i,o,s,c){var u=0,d=0;if(null==i||(u=a(i,s))!==(d=a(o,s))||l(i,o)<0^s>0)do{c.point(0===u||3===u?t:n,u>1?r:e)}while((u=(u+s+4)%4)!==d);else c.point(o[0],o[1])}function a(r,i){return ml(r[0]-t)0?0:3:ml(r[0]-n)0?2:1:ml(r[1]-e)0?1:0:i>0?3:2}function s(t,e){return l(t.x,e.x)}function l(t,e){var n=a(t,1),r=a(e,1);return n!==r?n-r:0===n?e[1]-t[1]:1===n?t[0]-e[0]:2===n?t[1]-e[1]:e[0]-t[0]}return function(a){var l,c,u,d,f,h,p,m,g,b,v,y=a,_=lu(),w={point:x,lineStart:function(){w.point=T,c&&c.push(u=[]),b=!0,g=!1,p=m=NaN},lineEnd:function(){l&&(T(d,f),h&&g&&_.rejoin(),l.push(_.result())),w.point=x,g&&y.lineEnd()},polygonStart:function(){y=_,l=[],c=[],v=!0},polygonEnd:function(){var e=function(){for(var e=0,n=0,i=c.length;nr&&(f-o)*(r-a)>(h-a)*(t-o)&&++e:h<=r&&(f-o)*(r-a)<(h-a)*(t-o)&&--e;return e}(),n=v&&e,i=(l=j(l)).length;(n||i)&&(a.polygonStart(),n&&(a.lineStart(),o(null,null,1,a),a.lineEnd()),i&&du(l,s,e,o,a),a.polygonEnd()),y=a,l=c=u=null}};function x(t,e){i(t,e)&&y.point(t,e)}function T(o,a){var s=i(o,a);if(c&&u.push([o,a]),b)d=o,f=a,h=s,b=!1,s&&(y.lineStart(),y.point(o,a));else if(s&&g)y.point(o,a);else{var l=[p=Math.max(Eu,Math.min(Au,p)),m=Math.max(Eu,Math.min(Au,m))],_=[o=Math.max(Eu,Math.min(Au,o)),a=Math.max(Eu,Math.min(Au,a))];!function(t,e,n,r,i,o){var a,s=t[0],l=t[1],c=0,u=1,d=e[0]-s,f=e[1]-l;if(a=n-s,d||!(a>0)){if(a/=d,d<0){if(a0){if(a>u)return;a>c&&(c=a)}if(a=i-s,d||!(a<0)){if(a/=d,d<0){if(a>u)return;a>c&&(c=a)}else if(d>0){if(a0)){if(a/=f,f<0){if(a0){if(a>u)return;a>c&&(c=a)}if(a=o-l,f||!(a<0)){if(a/=f,f<0){if(a>u)return;a>c&&(c=a)}else if(f>0){if(a0&&(t[0]=s+c*d,t[1]=l+c*f),u<1&&(e[0]=s+u*d,e[1]=l+u*f),!0}}}}}(l,_,t,e,n,r)?s&&(y.lineStart(),y.point(o,a),v=!1):(g||(y.lineStart(),y.point(l[0],l[1])),y.point(_[0],_[1]),s||y.lineEnd(),v=!1)}p=o,m=a,g=s}return w}}var Su={sphere:Dl,point:Dl,lineStart:function(){Su.point=ku,Su.lineEnd=Nu},lineEnd:Dl,polygonStart:Dl,polygonEnd:Dl};function Nu(){Su.point=Su.lineEnd=Dl}function ku(t,e){wu=t*=pl,xu=Al(e*=pl),Tu=vl(e),Su.point=Cu}function Cu(t,e){t*=pl;var n=Al(e*=pl),r=vl(e),i=ml(t-wu),o=vl(i),a=r*Al(i),s=Tu*n-xu*r*o,l=xu*n+Tu*r*o;_u.add(bl(Ml(a*a+s*s),l)),wu=t,xu=n,Tu=r}function Du(t){return _u=new m,jl(t,Su),+_u}var Lu=[null,null],Ou={type:"LineString",coordinates:Lu};function Iu(t,e){return Lu[0]=t,Lu[1]=e,Du(Ou)}var Bu={Feature:function(t,e){return ju(t.geometry,e)},FeatureCollection:function(t,e){for(var n=t.features,r=-1,i=n.length;++r0&&(i=Iu(t[o],t[o-1]))>0&&n<=i&&r<=i&&(n+r-i)*(1-Math.pow((n-r)/i,2))sl})).map(l)).concat(z(yl(o/h)*h,i,h).filter((function(t){return ml(t%m)>sl})).map(c))}return b.lines=function(){return v().map((function(t){return{type:"LineString",coordinates:t}}))},b.outline=function(){return{type:"Polygon",coordinates:[u(r).concat(d(a).slice(1),u(n).reverse().slice(1),d(s).reverse().slice(1))]}},b.extent=function(t){return arguments.length?b.extentMajor(t).extentMinor(t):b.extentMinor()},b.extentMajor=function(t){return arguments.length?(r=+t[0][0],n=+t[1][0],s=+t[0][1],a=+t[1][1],r>n&&(t=r,r=n,n=t),s>a&&(t=s,s=a,a=t),b.precision(g)):[[r,s],[n,a]]},b.extentMinor=function(n){return arguments.length?(e=+n[0][0],t=+n[1][0],o=+n[0][1],i=+n[1][1],e>t&&(n=e,e=t,t=n),o>i&&(n=o,o=i,i=n),b.precision(g)):[[e,o],[t,i]]},b.step=function(t){return arguments.length?b.stepMajor(t).stepMinor(t):b.stepMinor()},b.stepMajor=function(t){return arguments.length?(p=+t[0],m=+t[1],b):[p,m]},b.stepMinor=function(t){return arguments.length?(f=+t[0],h=+t[1],b):[f,h]},b.precision=function(f){return arguments.length?(g=+f,l=Vu(o,i,90),c=Hu(e,t,g),u=Vu(s,a,90),d=Hu(r,n,g),b):g},b.extentMajor([[-180,-89.999999],[180,89.999999]]).extentMinor([[-180,-80.000001],[180,80.000001]])}var Yu,Wu,$u,Ku,Xu=t=>t,Qu=new m,Zu=new m,Ju={point:Dl,lineStart:Dl,lineEnd:Dl,polygonStart:function(){Ju.lineStart=td,Ju.lineEnd=rd},polygonEnd:function(){Ju.lineStart=Ju.lineEnd=Ju.point=Dl,Qu.add(ml(Zu)),Zu=new m},result:function(){var t=Qu/2;return Qu=new m,t}};function td(){Ju.point=ed}function ed(t,e){Ju.point=nd,Yu=$u=t,Wu=Ku=e}function nd(t,e){Zu.add(Ku*t-$u*e),$u=t,Ku=e}function rd(){nd(Yu,Wu)}var id,od,ad,sd,ld=1/0,cd=ld,ud=-ld,dd=ud,fd={point:function(t,e){tud&&(ud=t),edd&&(dd=e)},lineStart:Dl,lineEnd:Dl,polygonStart:Dl,polygonEnd:Dl,result:function(){var t=[[ld,cd],[ud,dd]];return ud=dd=-(cd=ld=1/0),t}},hd=0,pd=0,md=0,gd=0,bd=0,vd=0,yd=0,_d=0,wd=0,xd={point:Td,lineStart:Ad,lineEnd:Sd,polygonStart:function(){xd.lineStart=Nd,xd.lineEnd=kd},polygonEnd:function(){xd.point=Td,xd.lineStart=Ad,xd.lineEnd=Sd},result:function(){var t=wd?[yd/wd,_d/wd]:vd?[gd/vd,bd/vd]:md?[hd/md,pd/md]:[NaN,NaN];return hd=pd=md=gd=bd=vd=yd=_d=wd=0,t}};function Td(t,e){hd+=t,pd+=e,++md}function Ad(){xd.point=Ed}function Ed(t,e){xd.point=Md,Td(ad=t,sd=e)}function Md(t,e){var n=t-ad,r=e-sd,i=Ml(n*n+r*r);gd+=i*(ad+t)/2,bd+=i*(sd+e)/2,vd+=i,Td(ad=t,sd=e)}function Sd(){xd.point=Td}function Nd(){xd.point=Cd}function kd(){Dd(id,od)}function Cd(t,e){xd.point=Dd,Td(id=ad=t,od=sd=e)}function Dd(t,e){var n=t-ad,r=e-sd,i=Ml(n*n+r*r);gd+=i*(ad+t)/2,bd+=i*(sd+e)/2,vd+=i,yd+=(i=sd*t-ad*e)*(ad+t),_d+=i*(sd+e),wd+=3*i,Td(ad=t,sd=e)}function Ld(t){this._context=t}Ld.prototype={_radius:4.5,pointRadius:function(t){return this._radius=t,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._context.closePath(),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._context.moveTo(t,e),this._point=1;break;case 1:this._context.lineTo(t,e);break;default:this._context.moveTo(t+this._radius,e),this._context.arc(t,e,this._radius,0,fl)}},result:Dl};var Od,Id,Bd,Pd,jd,Rd=new m,qd={point:Dl,lineStart:function(){qd.point=Fd},lineEnd:function(){Od&&zd(Id,Bd),qd.point=Dl},polygonStart:function(){Od=!0},polygonEnd:function(){Od=null},result:function(){var t=+Rd;return Rd=new m,t}};function Fd(t,e){qd.point=zd,Id=Pd=t,Bd=jd=e}function zd(t,e){Pd-=t,jd-=e,Rd.add(Ml(Pd*Pd+jd*jd)),Pd=t,jd=e}function Ud(){this._string=[]}function Vd(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Hd(t){return function(e){var n=new Gd;for(var r in t)n[r]=t[r];return n.stream=e,n}}function Gd(){}function Yd(t,e,n){var r=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=r&&t.clipExtent(null),jl(n,t.stream(fd)),e(fd.result()),null!=r&&t.clipExtent(r),t}function Wd(t,e,n){return Yd(t,(function(n){var r=e[1][0]-e[0][0],i=e[1][1]-e[0][1],o=Math.min(r/(n[1][0]-n[0][0]),i/(n[1][1]-n[0][1])),a=+e[0][0]+(r-o*(n[1][0]+n[0][0]))/2,s=+e[0][1]+(i-o*(n[1][1]+n[0][1]))/2;t.scale(150*o).translate([a,s])}),n)}function $d(t,e,n){return Wd(t,[[0,0],e],n)}function Kd(t,e,n){return Yd(t,(function(n){var r=+e,i=r/(n[1][0]-n[0][0]),o=(r-i*(n[1][0]+n[0][0]))/2,a=-i*n[0][1];t.scale(150*i).translate([o,a])}),n)}function Xd(t,e,n){return Yd(t,(function(n){var r=+e,i=r/(n[1][1]-n[0][1]),o=-i*n[0][0],a=(r-i*(n[1][1]+n[0][1]))/2;t.scale(150*i).translate([o,a])}),n)}Ud.prototype={_radius:4.5,_circle:Vd(4.5),pointRadius:function(t){return(t=+t)!==this._radius&&(this._radius=t,this._circle=null),this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._string.push("Z"),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._string.push("M",t,",",e),this._point=1;break;case 1:this._string.push("L",t,",",e);break;default:null==this._circle&&(this._circle=Vd(this._radius)),this._string.push("M",t,",",e,this._circle)}},result:function(){if(this._string.length){var t=this._string.join("");return this._string=[],t}return null}},Gd.prototype={constructor:Gd,point:function(t,e){this.stream.point(t,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var Qd=vl(30*pl);function Zd(t,e){return+e?function(t,e){function n(r,i,o,a,s,l,c,u,d,f,h,p,m,g){var b=c-r,v=u-i,y=b*b+v*v;if(y>4*e&&m--){var _=a+f,w=s+h,x=l+p,T=Ml(_*_+w*w+x*x),A=kl(x/=T),E=ml(ml(x)-1)e||ml((b*k+v*C)/y-.5)>.3||a*f+s*h+l*p2?t[2]%360*pl:0,k()):[g*hl,b*hl,v*hl]},S.angle=function(t){return arguments.length?(y=t%360*pl,k()):y*hl},S.reflectX=function(t){return arguments.length?(_=t?-1:1,k()):_<0},S.reflectY=function(t){return arguments.length?(w=t?-1:1,k()):w<0},S.precision=function(t){return arguments.length?(a=Zd(s,M=t*t),C()):Ml(M)},S.fitExtent=function(t,e){return Wd(S,t,e)},S.fitSize=function(t,e){return $d(S,t,e)},S.fitWidth=function(t,e){return Kd(S,t,e)},S.fitHeight=function(t,e){return Xd(S,t,e)},function(){return e=t.apply(this,arguments),S.invert=e.invert&&N,k()}}function rf(t){var e=0,n=cl/3,r=nf(t),i=r(e,n);return i.parallels=function(t){return arguments.length?r(e=t[0]*pl,n=t[1]*pl):[e*hl,n*hl]},i}function of(t,e){var n=Al(t),r=(n+Al(e))/2;if(ml(r)0?e<-ul+sl&&(e=-ul+sl):e>ul-sl&&(e=ul-sl);var n=i/Tl(pf(e),r);return[n*Al(r*t),i-n*vl(r*t)]}return o.invert=function(t,e){var n=i-e,o=El(r)*Ml(t*t+n*n),a=bl(t,ml(n))*El(n);return n*r<0&&(a-=cl*El(t)*El(n)),[a/r,2*gl(Tl(i/o,1/r))-ul]},o}function gf(t,e){return[t,e]}function bf(t,e){var n=vl(t),r=t===e?Al(t):(n-vl(e))/(e-t),i=n/r+t;if(ml(r)=0;)e+=n[r].value;else e=1;t.value=e}function Of(t,e){t instanceof Map?(t=[void 0,t],void 0===e&&(e=Bf)):void 0===e&&(e=If);for(var n,r,i,o,a,s=new Rf(t),l=[s];n=l.pop();)if((i=e(n.data))&&(a=(i=Array.from(i)).length))for(n.children=i,o=a-1;o>=0;--o)l.push(r=i[o]=new Rf(i[o])),r.parent=n,r.depth=n.depth+1;return s.eachBefore(jf)}function If(t){return t.children}function Bf(t){return Array.isArray(t)?t[1]:null}function Pf(t){void 0!==t.data.value&&(t.value=t.data.value),t.data=t.data.data}function jf(t){var e=0;do{t.height=e}while((t=t.parent)&&t.height<++e)}function Rf(t){this.data=t,this.depth=this.height=0,this.parent=null}function qf(t){for(var e,n,r=0,i=(t=function(t){for(var e,n,r=t.length;r;)n=Math.random()*r--|0,e=t[r],t[r]=t[n],t[n]=e;return t}(Array.from(t))).length,o=[];r0&&n*n>r*r+i*i}function Vf(t,e){for(var n=0;n(a*=a)?(r=(c+a-i)/(2*c),o=Math.sqrt(Math.max(0,a/c-r*r)),n.x=t.x-r*s-o*l,n.y=t.y-r*l+o*s):(r=(c+i-a)/(2*c),o=Math.sqrt(Math.max(0,i/c-r*r)),n.x=e.x+r*s-o*l,n.y=e.y+r*l+o*s)):(n.x=e.x+n.r,n.y=e.y)}function $f(t,e){var n=t.r+e.r-1e-6,r=e.x-t.x,i=e.y-t.y;return n>0&&n*n>r*r+i*i}function Kf(t){var e=t._,n=t.next._,r=e.r+n.r,i=(e.x*n.r+n.x*e.r)/r,o=(e.y*n.r+n.y*e.r)/r;return i*i+o*o}function Xf(t){this._=t,this.next=null,this.previous=null}function Qf(t){if(!(i=(t=function(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}(t)).length))return 0;var e,n,r,i,o,a,s,l,c,u,d;if((e=t[0]).x=0,e.y=0,!(i>1))return e.r;if(n=t[1],e.x=-n.r,n.x=e.r,n.y=0,!(i>2))return e.r+n.r;Wf(n,e,r=t[2]),e=new Xf(e),n=new Xf(n),r=new Xf(r),e.next=r.previous=n,n.next=e.previous=r,r.next=n.previous=e;t:for(s=3;ssl&&--i>0);return[t/(.8707+(o=r*r)*(o*(o*o*o*(.003971-.001529*o)-.013791)-.131979)),r]},Mf.invert=cf(kl),Sf.invert=cf((function(t){return 2*gl(t)})),Nf.invert=function(t,e){return[-e,2*gl(_l(t))-ul]},Rf.prototype=Of.prototype={constructor:Rf,count:function(){return this.eachAfter(Lf)},each:function(t,e){let n=-1;for(const r of this)t.call(e,r,++n,this);return this},eachAfter:function(t,e){for(var n,r,i,o=this,a=[o],s=[],l=-1;o=a.pop();)if(s.push(o),n=o.children)for(r=0,i=n.length;r=0;--r)o.push(n[r]);return this},find:function(t,e){let n=-1;for(const r of this)if(t.call(e,r,++n,this))return r},sum:function(t){return this.eachAfter((function(e){for(var n=+t(e.data)||0,r=e.children,i=r&&r.length;--i>=0;)n+=r[i].value;e.value=n}))},sort:function(t){return this.eachBefore((function(e){e.children&&e.children.sort(t)}))},path:function(t){for(var e=this,n=function(t,e){if(t===e)return t;var n=t.ancestors(),r=e.ancestors(),i=null;for(t=n.pop(),e=r.pop();t===e;)i=t,t=n.pop(),e=r.pop();return i}(e,t),r=[e];e!==n;)e=e.parent,r.push(e);for(var i=r.length;t!==n;)r.splice(i,0,t),t=t.parent;return r},ancestors:function(){for(var t=this,e=[t];t=t.parent;)e.push(t);return e},descendants:function(){return Array.from(this)},leaves:function(){var t=[];return this.eachBefore((function(e){e.children||t.push(e)})),t},links:function(){var t=this,e=[];return t.each((function(n){n!==t&&e.push({source:n.parent,target:n})})),e},copy:function(){return Of(this).eachBefore(Pf)},[Symbol.iterator]:function*(){var t,e,n,r,i=this,o=[i];do{for(t=o.reverse(),o=[];i=t.pop();)if(yield i,e=i.children)for(n=0,r=e.length;nf&&(f=s),g=u*u*m,(h=Math.max(f/g,g/d))>p){u-=s;break}p=h}b.push(a={value:u,dice:l1?e:1)},n}(yh),xh=function t(e){function n(t,n,r,i,o){if((a=t._squarify)&&a.ratio===e)for(var a,s,l,c,u,d=-1,f=a.length,h=t.value;++d1?e:1)},n}(yh);function Th(t,e,n){return(e[0]-t[0])*(n[1]-t[1])-(e[1]-t[1])*(n[0]-t[0])}function Ah(t,e){return t[0]-e[0]||t[1]-e[1]}function Eh(t){const e=t.length,n=[0,1];let r,i=2;for(r=2;r1&&Th(t[n[i-2]],t[n[i-1]],t[r])<=0;)--i;n[i++]=r}return n.slice(0,i)}var Mh=Math.random,Sh=function t(e){function n(t,n){return t=null==t?0:+t,n=null==n?1:+n,1===arguments.length?(n=t,t=0):n-=t,function(){return e()*n+t}}return n.source=t,n}(Mh),Nh=function t(e){function n(t,n){return arguments.length<2&&(n=t,t=0),t=Math.floor(t),n=Math.floor(n)-t,function(){return Math.floor(e()*n+t)}}return n.source=t,n}(Mh),kh=function t(e){function n(t,n){var r,i;return t=null==t?0:+t,n=null==n?1:+n,function(){var o;if(null!=r)o=r,r=null;else do{r=2*e()-1,o=2*e()-1,i=r*r+o*o}while(!i||i>1);return t+n*o*Math.sqrt(-2*Math.log(i)/i)}}return n.source=t,n}(Mh),Ch=function t(e){var n=kh.source(e);function r(){var t=n.apply(this,arguments);return function(){return Math.exp(t())}}return r.source=t,r}(Mh),Dh=function t(e){function n(t){return(t=+t)<=0?()=>0:function(){for(var n=0,r=t;r>1;--r)n+=e();return n+r*e()}}return n.source=t,n}(Mh),Lh=function t(e){var n=Dh.source(e);function r(t){if(0==(t=+t))return e;var r=n(t);return function(){return r()/t}}return r.source=t,r}(Mh),Oh=function t(e){function n(t){return function(){return-Math.log1p(-e())/t}}return n.source=t,n}(Mh),Ih=function t(e){function n(t){if((t=+t)<0)throw new RangeError("invalid alpha");return t=1/-t,function(){return Math.pow(1-e(),t)}}return n.source=t,n}(Mh),Bh=function t(e){function n(t){if((t=+t)<0||t>1)throw new RangeError("invalid p");return function(){return Math.floor(e()+t)}}return n.source=t,n}(Mh),Ph=function t(e){function n(t){if((t=+t)<0||t>1)throw new RangeError("invalid p");return 0===t?()=>1/0:1===t?()=>1:(t=Math.log1p(-t),function(){return 1+Math.floor(Math.log1p(-e())/t)})}return n.source=t,n}(Mh),jh=function t(e){var n=kh.source(e)();function r(t,r){if((t=+t)<0)throw new RangeError("invalid k");if(0===t)return()=>0;if(r=null==r?1:+r,1===t)return()=>-Math.log1p(-e())*r;var i=(t<1?t+1:t)-1/3,o=1/(3*Math.sqrt(i)),a=t<1?()=>Math.pow(e(),1/t):()=>1;return function(){do{do{var t=n(),s=1+o*t}while(s<=0);s*=s*s;var l=1-e()}while(l>=1-.0331*t*t*t*t&&Math.log(l)>=.5*t*t+i*(1-s+Math.log(s)));return i*s*a()*r}}return r.source=t,r}(Mh),Rh=function t(e){var n=jh.source(e);function r(t,e){var r=n(t),i=n(e);return function(){var t=r();return 0===t?0:t/(t+i())}}return r.source=t,r}(Mh),qh=function t(e){var n=Ph.source(e),r=Rh.source(e);function i(t,e){return t=+t,(e=+e)>=1?()=>t:e<=0?()=>0:function(){for(var i=0,o=t,a=e;o*a>16&&o*(1-a)>16;){var s=Math.floor((o+1)*a),l=r(s,o-s+1)();l<=a?(i+=s,o-=s,a=(a-l)/(1-l)):(o=s-1,a/=l)}for(var c=a<.5,u=n(c?a:1-a),d=u(),f=0;d<=o;++f)d+=u();return i+(c?f:o-f)}}return i.source=t,i}(Mh),Fh=function t(e){function n(t,n,r){var i;return 0==(t=+t)?i=t=>-Math.log(t):(t=1/t,i=e=>Math.pow(e,t)),n=null==n?0:+n,r=null==r?1:+r,function(){return n+r*i(-Math.log1p(-e()))}}return n.source=t,n}(Mh),zh=function t(e){function n(t,n){return t=null==t?0:+t,n=null==n?1:+n,function(){return t+n*Math.tan(Math.PI*e())}}return n.source=t,n}(Mh),Uh=function t(e){function n(t,n){return t=null==t?0:+t,n=null==n?1:+n,function(){var r=e();return t+n*Math.log(r/(1-r))}}return n.source=t,n}(Mh),Vh=function t(e){var n=jh.source(e),r=qh.source(e);function i(t){return function(){for(var i=0,o=t;o>16;){var a=Math.floor(.875*o),s=n(a)();if(s>o)return i+r(a-1,o/s)();i+=a,o-=s}for(var l=-Math.log1p(-e()),c=0;l<=o;++c)l-=Math.log1p(-e());return i+c}}return i.source=t,i}(Mh);const Hh=1/4294967296;function Gh(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t)}return this}function Yh(t,e){switch(arguments.length){case 0:break;case 1:"function"==typeof t?this.interpolator(t):this.range(t);break;default:this.domain(t),"function"==typeof e?this.interpolator(e):this.range(e)}return this}const Wh=Symbol("implicit");function $h(){var t=new Map,e=[],n=[],r=Wh;function i(i){var o=i+"",a=t.get(o);if(!a){if(r!==Wh)return r;t.set(o,a=e.push(i))}return n[(a-1)%n.length]}return i.domain=function(n){if(!arguments.length)return e.slice();e=[],t=new Map;for(const r of n){const n=r+"";t.has(n)||t.set(n,e.push(r))}return i},i.range=function(t){return arguments.length?(n=Array.from(t),i):n.slice()},i.unknown=function(t){return arguments.length?(r=t,i):r},i.copy=function(){return $h(e,n).unknown(r)},Gh.apply(i,arguments),i}function Kh(){var t,e,n=$h().unknown(void 0),r=n.domain,i=n.range,o=0,a=1,s=!1,l=0,c=0,u=.5;function d(){var n=r().length,d=ae&&(n=t,t=e,e=n),function(n){return Math.max(t,Math.min(e,n))}}(a[0],a[t-1])),r=t>2?np:ep,i=o=null,d}function d(e){return isNaN(e=+e)?n:(i||(i=r(a.map(t),s,l)))(t(c(e)))}return d.invert=function(n){return c(e((o||(o=r(s,a.map(t),lr)))(n)))},d.domain=function(t){return arguments.length?(a=Array.from(t,Qh),u()):a.slice()},d.range=function(t){return arguments.length?(s=Array.from(t),u()):s.slice()},d.rangeRound=function(t){return s=Array.from(t),l=pr,u()},d.clamp=function(t){return arguments.length?(c=!!t||Jh,u()):c!==Jh},d.interpolate=function(t){return arguments.length?(l=t,u()):l},d.unknown=function(t){return arguments.length?(n=t,d):n},function(n,r){return t=n,e=r,u()}}function op(){return ip()(Jh,Jh)}function ap(e,n,r,i){var o,a=M(e,n,r);switch((i=$s(null==i?",f":i)).type){case"s":var s=Math.max(Math.abs(e),Math.abs(n));return null!=i.precision||isNaN(o=ol(a,s))||(i.precision=o),t.formatPrefix(i,s);case"":case"e":case"g":case"p":case"r":null!=i.precision||isNaN(o=al(a,Math.max(Math.abs(e),Math.abs(n))))||(i.precision=o-("e"===i.type));break;case"f":case"%":null!=i.precision||isNaN(o=il(a))||(i.precision=o-2*("%"===i.type))}return t.format(i)}function sp(t){var e=t.domain;return t.ticks=function(t){var n=e();return A(n[0],n[n.length-1],null==t?10:t)},t.tickFormat=function(t,n){var r=e();return ap(r[0],r[r.length-1],null==t?10:t,n)},t.nice=function(n){null==n&&(n=10);var r,i,o=e(),a=0,s=o.length-1,l=o[a],c=o[s],u=10;for(c0;){if((i=E(l,c,n))===r)return o[a]=l,o[s]=c,e(o);if(i>0)l=Math.floor(l/i)*i,c=Math.ceil(c/i)*i;else{if(!(i<0))break;l=Math.ceil(l*i)/i,c=Math.floor(c*i)/i}r=i}return t},t}function lp(t,e){var n,r=0,i=(t=t.slice()).length-1,o=t[r],a=t[i];return a0){for(;f<=h;++f)for(u=1,c=r(f);ul)break;m.push(d)}}else for(;f<=h;++f)for(u=a-1,c=r(f);u>=1;--u)if(!((d=c*u)l)break;m.push(d)}2*m.length0))return s;do{s.push(a=new Date(+n)),e(n,o),t(n)}while(a=e)for(;t(e),!n(e);)e.setTime(e-1)}),(function(t,r){if(t>=t)if(r<0)for(;++r<=0;)for(;e(t,-1),!n(t););else for(;--r>=0;)for(;e(t,1),!n(t););}))},n&&(i.count=function(e,r){return Mp.setTime(+e),Sp.setTime(+r),t(Mp),t(Sp),Math.floor(n(Mp,Sp))},i.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?i.filter(r?function(e){return r(e)%t==0}:function(e){return i.count(0,e)%t==0}):i:null}),i}var kp=Np((function(){}),(function(t,e){t.setTime(+t+e)}),(function(t,e){return e-t}));kp.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?Np((function(e){e.setTime(Math.floor(e/t)*t)}),(function(e,n){e.setTime(+e+n*t)}),(function(e,n){return(n-e)/t})):kp:null};var Cp=kp.range,Dp=1e3,Lp=6e4,Op=36e5,Ip=864e5,Bp=6048e5,Pp=Np((function(t){t.setTime(t-t.getMilliseconds())}),(function(t,e){t.setTime(+t+e*Dp)}),(function(t,e){return(e-t)/Dp}),(function(t){return t.getUTCSeconds()})),jp=Pp.range,Rp=Np((function(t){t.setTime(t-t.getMilliseconds()-t.getSeconds()*Dp)}),(function(t,e){t.setTime(+t+e*Lp)}),(function(t,e){return(e-t)/Lp}),(function(t){return t.getMinutes()})),qp=Rp.range,Fp=Np((function(t){t.setTime(t-t.getMilliseconds()-t.getSeconds()*Dp-t.getMinutes()*Lp)}),(function(t,e){t.setTime(+t+e*Op)}),(function(t,e){return(e-t)/Op}),(function(t){return t.getHours()})),zp=Fp.range,Up=Np((t=>t.setHours(0,0,0,0)),((t,e)=>t.setDate(t.getDate()+e)),((t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*Lp)/Ip),(t=>t.getDate()-1)),Vp=Up.range;function Hp(t){return Np((function(e){e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)}),(function(t,e){t.setDate(t.getDate()+7*e)}),(function(t,e){return(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*Lp)/Bp}))}var Gp=Hp(0),Yp=Hp(1),Wp=Hp(2),$p=Hp(3),Kp=Hp(4),Xp=Hp(5),Qp=Hp(6),Zp=Gp.range,Jp=Yp.range,tm=Wp.range,em=$p.range,nm=Kp.range,rm=Xp.range,im=Qp.range,om=Np((function(t){t.setDate(1),t.setHours(0,0,0,0)}),(function(t,e){t.setMonth(t.getMonth()+e)}),(function(t,e){return e.getMonth()-t.getMonth()+12*(e.getFullYear()-t.getFullYear())}),(function(t){return t.getMonth()})),am=om.range,sm=Np((function(t){t.setMonth(0,1),t.setHours(0,0,0,0)}),(function(t,e){t.setFullYear(t.getFullYear()+e)}),(function(t,e){return e.getFullYear()-t.getFullYear()}),(function(t){return t.getFullYear()}));sm.every=function(t){return isFinite(t=Math.floor(t))&&t>0?Np((function(e){e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)}),(function(e,n){e.setFullYear(e.getFullYear()+n*t)})):null};var lm=sm.range,cm=Np((function(t){t.setUTCSeconds(0,0)}),(function(t,e){t.setTime(+t+e*Lp)}),(function(t,e){return(e-t)/Lp}),(function(t){return t.getUTCMinutes()})),um=cm.range,dm=Np((function(t){t.setUTCMinutes(0,0,0)}),(function(t,e){t.setTime(+t+e*Op)}),(function(t,e){return(e-t)/Op}),(function(t){return t.getUTCHours()})),fm=dm.range,hm=Np((function(t){t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCDate(t.getUTCDate()+e)}),(function(t,e){return(e-t)/Ip}),(function(t){return t.getUTCDate()-1})),pm=hm.range;function mm(t){return Np((function(e){e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCDate(t.getUTCDate()+7*e)}),(function(t,e){return(e-t)/Bp}))}var gm=mm(0),bm=mm(1),vm=mm(2),ym=mm(3),_m=mm(4),wm=mm(5),xm=mm(6),Tm=gm.range,Am=bm.range,Em=vm.range,Mm=ym.range,Sm=_m.range,Nm=wm.range,km=xm.range,Cm=Np((function(t){t.setUTCDate(1),t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCMonth(t.getUTCMonth()+e)}),(function(t,e){return e.getUTCMonth()-t.getUTCMonth()+12*(e.getUTCFullYear()-t.getUTCFullYear())}),(function(t){return t.getUTCMonth()})),Dm=Cm.range,Lm=Np((function(t){t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCFullYear(t.getUTCFullYear()+e)}),(function(t,e){return e.getUTCFullYear()-t.getUTCFullYear()}),(function(t){return t.getUTCFullYear()}));Lm.every=function(t){return isFinite(t=Math.floor(t))&&t>0?Np((function(e){e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)}),(function(e,n){e.setUTCFullYear(e.getUTCFullYear()+n*t)})):null};var Om=Lm.range;function Im(t){if(0<=t.y&&t.y<100){var e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function Bm(t){if(0<=t.y&&t.y<100){var e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function Pm(t,e,n){return{y:t,m:e,d:n,H:0,M:0,S:0,L:0}}function jm(t){var e=t.dateTime,n=t.date,r=t.time,i=t.periods,o=t.days,a=t.shortDays,s=t.months,l=t.shortMonths,c=Gm(i),u=Ym(i),d=Gm(o),f=Ym(o),h=Gm(a),p=Ym(a),m=Gm(s),g=Ym(s),b=Gm(l),v=Ym(l),y={a:function(t){return a[t.getDay()]},A:function(t){return o[t.getDay()]},b:function(t){return l[t.getMonth()]},B:function(t){return s[t.getMonth()]},c:null,d:hg,e:hg,f:vg,g:kg,G:Dg,H:pg,I:mg,j:gg,L:bg,m:yg,M:_g,p:function(t){return i[+(t.getHours()>=12)]},q:function(t){return 1+~~(t.getMonth()/3)},Q:tb,s:eb,S:wg,u:xg,U:Tg,V:Eg,w:Mg,W:Sg,x:null,X:null,y:Ng,Y:Cg,Z:Lg,"%":Jg},_={a:function(t){return a[t.getUTCDay()]},A:function(t){return o[t.getUTCDay()]},b:function(t){return l[t.getUTCMonth()]},B:function(t){return s[t.getUTCMonth()]},c:null,d:Og,e:Og,f:Rg,g:Kg,G:Qg,H:Ig,I:Bg,j:Pg,L:jg,m:qg,M:Fg,p:function(t){return i[+(t.getUTCHours()>=12)]},q:function(t){return 1+~~(t.getUTCMonth()/3)},Q:tb,s:eb,S:zg,u:Ug,U:Vg,V:Gg,w:Yg,W:Wg,x:null,X:null,y:$g,Y:Xg,Z:Zg,"%":Jg},w={a:function(t,e,n){var r=h.exec(e.slice(n));return r?(t.w=p.get(r[0].toLowerCase()),n+r[0].length):-1},A:function(t,e,n){var r=d.exec(e.slice(n));return r?(t.w=f.get(r[0].toLowerCase()),n+r[0].length):-1},b:function(t,e,n){var r=b.exec(e.slice(n));return r?(t.m=v.get(r[0].toLowerCase()),n+r[0].length):-1},B:function(t,e,n){var r=m.exec(e.slice(n));return r?(t.m=g.get(r[0].toLowerCase()),n+r[0].length):-1},c:function(t,n,r){return A(t,e,n,r)},d:rg,e:rg,f:cg,g:Jm,G:Zm,H:og,I:og,j:ig,L:lg,m:ng,M:ag,p:function(t,e,n){var r=c.exec(e.slice(n));return r?(t.p=u.get(r[0].toLowerCase()),n+r[0].length):-1},q:eg,Q:dg,s:fg,S:sg,u:$m,U:Km,V:Xm,w:Wm,W:Qm,x:function(t,e,r){return A(t,n,e,r)},X:function(t,e,n){return A(t,r,e,n)},y:Jm,Y:Zm,Z:tg,"%":ug};function x(t,e){return function(n){var r,i,o,a=[],s=-1,l=0,c=t.length;for(n instanceof Date||(n=new Date(+n));++s53)return null;"w"in o||(o.w=1),"Z"in o?(i=(r=Bm(Pm(o.y,0,1))).getUTCDay(),r=i>4||0===i?bm.ceil(r):bm(r),r=hm.offset(r,7*(o.V-1)),o.y=r.getUTCFullYear(),o.m=r.getUTCMonth(),o.d=r.getUTCDate()+(o.w+6)%7):(i=(r=Im(Pm(o.y,0,1))).getDay(),r=i>4||0===i?Yp.ceil(r):Yp(r),r=Up.offset(r,7*(o.V-1)),o.y=r.getFullYear(),o.m=r.getMonth(),o.d=r.getDate()+(o.w+6)%7)}else("W"in o||"U"in o)&&("w"in o||(o.w="u"in o?o.u%7:"W"in o?1:0),i="Z"in o?Bm(Pm(o.y,0,1)).getUTCDay():Im(Pm(o.y,0,1)).getDay(),o.m=0,o.d="W"in o?(o.w+6)%7+7*o.W-(i+5)%7:o.w+7*o.U-(i+6)%7);return"Z"in o?(o.H+=o.Z/100|0,o.M+=o.Z%100,Bm(o)):Im(o)}}function A(t,e,n,r){for(var i,o,a=0,s=e.length,l=n.length;a=l)return-1;if(37===(i=e.charCodeAt(a++))){if(i=e.charAt(a++),!(o=w[i in qm?e.charAt(a++):i])||(r=o(t,n,r))<0)return-1}else if(i!=n.charCodeAt(r++))return-1}return r}return y.x=x(n,y),y.X=x(r,y),y.c=x(e,y),_.x=x(n,_),_.X=x(r,_),_.c=x(e,_),{format:function(t){var e=x(t+="",y);return e.toString=function(){return t},e},parse:function(t){var e=T(t+="",!1);return e.toString=function(){return t},e},utcFormat:function(t){var e=x(t+="",_);return e.toString=function(){return t},e},utcParse:function(t){var e=T(t+="",!0);return e.toString=function(){return t},e}}}var Rm,qm={"-":"",_:" ",0:"0"},Fm=/^\s*\d+/,zm=/^%/,Um=/[\\^$*+?|[\]().{}]/g;function Vm(t,e,n){var r=t<0?"-":"",i=(r?-t:t)+"",o=i.length;return r+(o[t.toLowerCase(),e])))}function Wm(t,e,n){var r=Fm.exec(e.slice(n,n+1));return r?(t.w=+r[0],n+r[0].length):-1}function $m(t,e,n){var r=Fm.exec(e.slice(n,n+1));return r?(t.u=+r[0],n+r[0].length):-1}function Km(t,e,n){var r=Fm.exec(e.slice(n,n+2));return r?(t.U=+r[0],n+r[0].length):-1}function Xm(t,e,n){var r=Fm.exec(e.slice(n,n+2));return r?(t.V=+r[0],n+r[0].length):-1}function Qm(t,e,n){var r=Fm.exec(e.slice(n,n+2));return r?(t.W=+r[0],n+r[0].length):-1}function Zm(t,e,n){var r=Fm.exec(e.slice(n,n+4));return r?(t.y=+r[0],n+r[0].length):-1}function Jm(t,e,n){var r=Fm.exec(e.slice(n,n+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function tg(t,e,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(n,n+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function eg(t,e,n){var r=Fm.exec(e.slice(n,n+1));return r?(t.q=3*r[0]-3,n+r[0].length):-1}function ng(t,e,n){var r=Fm.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function rg(t,e,n){var r=Fm.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function ig(t,e,n){var r=Fm.exec(e.slice(n,n+3));return r?(t.m=0,t.d=+r[0],n+r[0].length):-1}function og(t,e,n){var r=Fm.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function ag(t,e,n){var r=Fm.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function sg(t,e,n){var r=Fm.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function lg(t,e,n){var r=Fm.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function cg(t,e,n){var r=Fm.exec(e.slice(n,n+6));return r?(t.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function ug(t,e,n){var r=zm.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function dg(t,e,n){var r=Fm.exec(e.slice(n));return r?(t.Q=+r[0],n+r[0].length):-1}function fg(t,e,n){var r=Fm.exec(e.slice(n));return r?(t.s=+r[0],n+r[0].length):-1}function hg(t,e){return Vm(t.getDate(),e,2)}function pg(t,e){return Vm(t.getHours(),e,2)}function mg(t,e){return Vm(t.getHours()%12||12,e,2)}function gg(t,e){return Vm(1+Up.count(sm(t),t),e,3)}function bg(t,e){return Vm(t.getMilliseconds(),e,3)}function vg(t,e){return bg(t,e)+"000"}function yg(t,e){return Vm(t.getMonth()+1,e,2)}function _g(t,e){return Vm(t.getMinutes(),e,2)}function wg(t,e){return Vm(t.getSeconds(),e,2)}function xg(t){var e=t.getDay();return 0===e?7:e}function Tg(t,e){return Vm(Gp.count(sm(t)-1,t),e,2)}function Ag(t){var e=t.getDay();return e>=4||0===e?Kp(t):Kp.ceil(t)}function Eg(t,e){return t=Ag(t),Vm(Kp.count(sm(t),t)+(4===sm(t).getDay()),e,2)}function Mg(t){return t.getDay()}function Sg(t,e){return Vm(Yp.count(sm(t)-1,t),e,2)}function Ng(t,e){return Vm(t.getFullYear()%100,e,2)}function kg(t,e){return Vm((t=Ag(t)).getFullYear()%100,e,2)}function Cg(t,e){return Vm(t.getFullYear()%1e4,e,4)}function Dg(t,e){var n=t.getDay();return Vm((t=n>=4||0===n?Kp(t):Kp.ceil(t)).getFullYear()%1e4,e,4)}function Lg(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+Vm(e/60|0,"0",2)+Vm(e%60,"0",2)}function Og(t,e){return Vm(t.getUTCDate(),e,2)}function Ig(t,e){return Vm(t.getUTCHours(),e,2)}function Bg(t,e){return Vm(t.getUTCHours()%12||12,e,2)}function Pg(t,e){return Vm(1+hm.count(Lm(t),t),e,3)}function jg(t,e){return Vm(t.getUTCMilliseconds(),e,3)}function Rg(t,e){return jg(t,e)+"000"}function qg(t,e){return Vm(t.getUTCMonth()+1,e,2)}function Fg(t,e){return Vm(t.getUTCMinutes(),e,2)}function zg(t,e){return Vm(t.getUTCSeconds(),e,2)}function Ug(t){var e=t.getUTCDay();return 0===e?7:e}function Vg(t,e){return Vm(gm.count(Lm(t)-1,t),e,2)}function Hg(t){var e=t.getUTCDay();return e>=4||0===e?_m(t):_m.ceil(t)}function Gg(t,e){return t=Hg(t),Vm(_m.count(Lm(t),t)+(4===Lm(t).getUTCDay()),e,2)}function Yg(t){return t.getUTCDay()}function Wg(t,e){return Vm(bm.count(Lm(t)-1,t),e,2)}function $g(t,e){return Vm(t.getUTCFullYear()%100,e,2)}function Kg(t,e){return Vm((t=Hg(t)).getUTCFullYear()%100,e,2)}function Xg(t,e){return Vm(t.getUTCFullYear()%1e4,e,4)}function Qg(t,e){var n=t.getUTCDay();return Vm((t=n>=4||0===n?_m(t):_m.ceil(t)).getUTCFullYear()%1e4,e,4)}function Zg(){return"+0000"}function Jg(){return"%"}function tb(t){return+t}function eb(t){return Math.floor(+t/1e3)}function nb(e){return Rm=jm(e),t.timeFormat=Rm.format,t.timeParse=Rm.parse,t.utcFormat=Rm.utcFormat,t.utcParse=Rm.utcParse,Rm}nb({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});var rb="%Y-%m-%dT%H:%M:%S.%LZ",ib=Date.prototype.toISOString?function(t){return t.toISOString()}:t.utcFormat(rb),ob=+new Date("2000-01-01T00:00:00.000Z")?function(t){var e=new Date(t);return isNaN(e)?null:e}:t.utcParse(rb),ab=31536e6;function sb(t){return new Date(t)}function lb(t){return t instanceof Date?+t:+new Date(+t)}function cb(t,e,r,i,o,a,s,l,c){var u=op(),d=u.invert,f=u.domain,h=c(".%L"),p=c(":%S"),m=c("%I:%M"),g=c("%I %p"),b=c("%a %d"),v=c("%b %d"),y=c("%B"),_=c("%Y"),w=[[s,1,1e3],[s,5,5e3],[s,15,15e3],[s,30,3e4],[a,1,6e4],[a,5,3e5],[a,15,9e5],[a,30,18e5],[o,1,36e5],[o,3,108e5],[o,6,216e5],[o,12,432e5],[i,1,864e5],[i,2,1728e5],[r,1,6048e5],[e,1,2592e6],[e,3,7776e6],[t,1,ab]];function x(n){return(s(n)nr(t[t.length-1]),Sb=new Array(3).concat("d8b365f5f5f55ab4ac","a6611adfc27d80cdc1018571","a6611adfc27df5f5f580cdc1018571","8c510ad8b365f6e8c3c7eae55ab4ac01665e","8c510ad8b365f6e8c3f5f5f5c7eae55ab4ac01665e","8c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e","8c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e","5430058c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e003c30","5430058c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e003c30").map(mb),Nb=Mb(Sb),kb=new Array(3).concat("af8dc3f7f7f77fbf7b","7b3294c2a5cfa6dba0008837","7b3294c2a5cff7f7f7a6dba0008837","762a83af8dc3e7d4e8d9f0d37fbf7b1b7837","762a83af8dc3e7d4e8f7f7f7d9f0d37fbf7b1b7837","762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b7837","762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b7837","40004b762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b783700441b","40004b762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b783700441b").map(mb),Cb=Mb(kb),Db=new Array(3).concat("e9a3c9f7f7f7a1d76a","d01c8bf1b6dab8e1864dac26","d01c8bf1b6daf7f7f7b8e1864dac26","c51b7de9a3c9fde0efe6f5d0a1d76a4d9221","c51b7de9a3c9fde0eff7f7f7e6f5d0a1d76a4d9221","c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221","c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221","8e0152c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221276419","8e0152c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221276419").map(mb),Lb=Mb(Db),Ob=new Array(3).concat("998ec3f7f7f7f1a340","5e3c99b2abd2fdb863e66101","5e3c99b2abd2f7f7f7fdb863e66101","542788998ec3d8daebfee0b6f1a340b35806","542788998ec3d8daebf7f7f7fee0b6f1a340b35806","5427888073acb2abd2d8daebfee0b6fdb863e08214b35806","5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b35806","2d004b5427888073acb2abd2d8daebfee0b6fdb863e08214b358067f3b08","2d004b5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b358067f3b08").map(mb),Ib=Mb(Ob),Bb=new Array(3).concat("ef8a62f7f7f767a9cf","ca0020f4a58292c5de0571b0","ca0020f4a582f7f7f792c5de0571b0","b2182bef8a62fddbc7d1e5f067a9cf2166ac","b2182bef8a62fddbc7f7f7f7d1e5f067a9cf2166ac","b2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac","b2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac","67001fb2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac053061","67001fb2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac053061").map(mb),Pb=Mb(Bb),jb=new Array(3).concat("ef8a62ffffff999999","ca0020f4a582bababa404040","ca0020f4a582ffffffbababa404040","b2182bef8a62fddbc7e0e0e09999994d4d4d","b2182bef8a62fddbc7ffffffe0e0e09999994d4d4d","b2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d","b2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d","67001fb2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d1a1a1a","67001fb2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d1a1a1a").map(mb),Rb=Mb(jb),qb=new Array(3).concat("fc8d59ffffbf91bfdb","d7191cfdae61abd9e92c7bb6","d7191cfdae61ffffbfabd9e92c7bb6","d73027fc8d59fee090e0f3f891bfdb4575b4","d73027fc8d59fee090ffffbfe0f3f891bfdb4575b4","d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4","d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4","a50026d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4313695","a50026d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4313695").map(mb),Fb=Mb(qb),zb=new Array(3).concat("fc8d59ffffbf91cf60","d7191cfdae61a6d96a1a9641","d7191cfdae61ffffbfa6d96a1a9641","d73027fc8d59fee08bd9ef8b91cf601a9850","d73027fc8d59fee08bffffbfd9ef8b91cf601a9850","d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850","d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850","a50026d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850006837","a50026d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850006837").map(mb),Ub=Mb(zb),Vb=new Array(3).concat("fc8d59ffffbf99d594","d7191cfdae61abdda42b83ba","d7191cfdae61ffffbfabdda42b83ba","d53e4ffc8d59fee08be6f59899d5943288bd","d53e4ffc8d59fee08bffffbfe6f59899d5943288bd","d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd","d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd","9e0142d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd5e4fa2","9e0142d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd5e4fa2").map(mb),Hb=Mb(Vb),Gb=new Array(3).concat("e5f5f999d8c92ca25f","edf8fbb2e2e266c2a4238b45","edf8fbb2e2e266c2a42ca25f006d2c","edf8fbccece699d8c966c2a42ca25f006d2c","edf8fbccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45006d2c00441b").map(mb),Yb=Mb(Gb),Wb=new Array(3).concat("e0ecf49ebcda8856a7","edf8fbb3cde38c96c688419d","edf8fbb3cde38c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d810f7c4d004b").map(mb),$b=Mb(Wb),Kb=new Array(3).concat("e0f3dba8ddb543a2ca","f0f9e8bae4bc7bccc42b8cbe","f0f9e8bae4bc7bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe0868ac084081").map(mb),Xb=Mb(Kb),Qb=new Array(3).concat("fee8c8fdbb84e34a33","fef0d9fdcc8afc8d59d7301f","fef0d9fdcc8afc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301fb300007f0000").map(mb),Zb=Mb(Qb),Jb=new Array(3).concat("ece2f0a6bddb1c9099","f6eff7bdc9e167a9cf02818a","f6eff7bdc9e167a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016c59014636").map(mb),tv=Mb(Jb),ev=new Array(3).concat("ece7f2a6bddb2b8cbe","f1eef6bdc9e174a9cf0570b0","f1eef6bdc9e174a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0045a8d023858").map(mb),nv=Mb(ev),rv=new Array(3).concat("e7e1efc994c7dd1c77","f1eef6d7b5d8df65b0ce1256","f1eef6d7b5d8df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125698004367001f").map(mb),iv=Mb(rv),ov=new Array(3).concat("fde0ddfa9fb5c51b8a","feebe2fbb4b9f768a1ae017e","feebe2fbb4b9f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a017749006a").map(mb),av=Mb(ov),sv=new Array(3).concat("edf8b17fcdbb2c7fb8","ffffcca1dab441b6c4225ea8","ffffcca1dab441b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea8253494081d58").map(mb),lv=Mb(sv),cv=new Array(3).concat("f7fcb9addd8e31a354","ffffccc2e69978c679238443","ffffccc2e69978c67931a354006837","ffffccd9f0a3addd8e78c67931a354006837","ffffccd9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443006837004529").map(mb),uv=Mb(cv),dv=new Array(3).concat("fff7bcfec44fd95f0e","ffffd4fed98efe9929cc4c02","ffffd4fed98efe9929d95f0e993404","ffffd4fee391fec44ffe9929d95f0e993404","ffffd4fee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c02993404662506").map(mb),fv=Mb(dv),hv=new Array(3).concat("ffeda0feb24cf03b20","ffffb2fecc5cfd8d3ce31a1c","ffffb2fecc5cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cbd0026800026").map(mb),pv=Mb(hv),mv=new Array(3).concat("deebf79ecae13182bd","eff3ffbdd7e76baed62171b5","eff3ffbdd7e76baed63182bd08519c","eff3ffc6dbef9ecae16baed63182bd08519c","eff3ffc6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b508519c08306b").map(mb),gv=Mb(mv),bv=new Array(3).concat("e5f5e0a1d99b31a354","edf8e9bae4b374c476238b45","edf8e9bae4b374c47631a354006d2c","edf8e9c7e9c0a1d99b74c47631a354006d2c","edf8e9c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45006d2c00441b").map(mb),vv=Mb(bv),yv=new Array(3).concat("f0f0f0bdbdbd636363","f7f7f7cccccc969696525252","f7f7f7cccccc969696636363252525","f7f7f7d9d9d9bdbdbd969696636363252525","f7f7f7d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525000000").map(mb),_v=Mb(yv),wv=new Array(3).concat("efedf5bcbddc756bb1","f2f0f7cbc9e29e9ac86a51a3","f2f0f7cbc9e29e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a354278f3f007d").map(mb),xv=Mb(wv),Tv=new Array(3).concat("fee0d2fc9272de2d26","fee5d9fcae91fb6a4acb181d","fee5d9fcae91fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181da50f1567000d").map(mb),Av=Mb(Tv),Ev=new Array(3).concat("fee6cefdae6be6550d","feeddefdbe85fd8d3cd94701","feeddefdbe85fd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d94801a636037f2704").map(mb),Mv=Mb(Ev),Sv=Lr(Gn(300,.5,0),Gn(-240,.5,1)),Nv=Lr(Gn(-100,.75,.35),Gn(80,1.5,.8)),kv=Lr(Gn(260,.75,.35),Gn(80,1.5,.8)),Cv=Gn(),Dv=ln(),Lv=Math.PI/3,Ov=2*Math.PI/3;function Iv(t){var e=t.length;return function(n){return t[Math.max(0,Math.min(e-1,Math.floor(n*e)))]}}var Bv=Iv(mb("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725")),Pv=Iv(mb("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf")),jv=Iv(mb("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4")),Rv=Iv(mb("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921"));function qv(t){return function(){return t}}var Fv=Math.abs,zv=Math.atan2,Uv=Math.cos,Vv=Math.max,Hv=Math.min,Gv=Math.sin,Yv=Math.sqrt,Wv=1e-12,$v=Math.PI,Kv=$v/2,Xv=2*$v;function Qv(t){return t>1?0:t<-1?$v:Math.acos(t)}function Zv(t){return t>=1?Kv:t<=-1?-Kv:Math.asin(t)}function Jv(t){return t.innerRadius}function ty(t){return t.outerRadius}function ey(t){return t.startAngle}function ny(t){return t.endAngle}function ry(t){return t&&t.padAngle}function iy(t,e,n,r,i,o,a,s){var l=n-t,c=r-e,u=a-i,d=s-o,f=d*l-u*c;if(!(f*fC*C+D*D&&(A=M,E=S),{cx:A,cy:E,x01:-u,y01:-d,x11:A*(i/w-1),y11:E*(i/w-1)}}var ay=Array.prototype.slice;function sy(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}function ly(t){this._context=t}function cy(t){return new ly(t)}function uy(t){return t[0]}function dy(t){return t[1]}function fy(t,e){var n=qv(!0),r=null,i=cy,o=null;function a(a){var s,l,c,u=(a=sy(a)).length,d=!1;for(null==r&&(o=i(c=Zo())),s=0;s<=u;++s)!(s=u;--d)s.point(g[d],b[d]);s.lineEnd(),s.areaEnd()}m&&(g[c]=+t(f,c,l),b[c]=+e(f,c,l),s.point(r?+r(f,c,l):g[c],n?+n(f,c,l):b[c]))}if(h)return s=null,h+""||null}function c(){return fy().defined(i).curve(a).context(o)}return t="function"==typeof t?t:void 0===t?uy:qv(+t),e="function"==typeof e?e:qv(void 0===e?0:+e),n="function"==typeof n?n:void 0===n?dy:qv(+n),l.x=function(e){return arguments.length?(t="function"==typeof e?e:qv(+e),r=null,l):t},l.x0=function(e){return arguments.length?(t="function"==typeof e?e:qv(+e),l):t},l.x1=function(t){return arguments.length?(r=null==t?null:"function"==typeof t?t:qv(+t),l):r},l.y=function(t){return arguments.length?(e="function"==typeof t?t:qv(+t),n=null,l):e},l.y0=function(t){return arguments.length?(e="function"==typeof t?t:qv(+t),l):e},l.y1=function(t){return arguments.length?(n=null==t?null:"function"==typeof t?t:qv(+t),l):n},l.lineX0=l.lineY0=function(){return c().x(t).y(e)},l.lineY1=function(){return c().x(t).y(n)},l.lineX1=function(){return c().x(r).y(e)},l.defined=function(t){return arguments.length?(i="function"==typeof t?t:qv(!!t),l):i},l.curve=function(t){return arguments.length?(a=t,null!=o&&(s=a(o)),l):a},l.context=function(t){return arguments.length?(null==t?o=s=null:s=a(o=t),l):o},l}function py(t,e){return et?1:e>=t?0:NaN}function my(t){return t}ly.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._context.lineTo(t,e)}}};var gy=vy(cy);function by(t){this._curve=t}function vy(t){function e(e){return new by(t(e))}return e._curve=t,e}function yy(t){var e=t.curve;return t.angle=t.x,delete t.x,t.radius=t.y,delete t.y,t.curve=function(t){return arguments.length?e(vy(t)):e()._curve},t}function _y(){return yy(fy().curve(gy))}function wy(){var t=hy().curve(gy),e=t.curve,n=t.lineX0,r=t.lineX1,i=t.lineY0,o=t.lineY1;return t.angle=t.x,delete t.x,t.startAngle=t.x0,delete t.x0,t.endAngle=t.x1,delete t.x1,t.radius=t.y,delete t.y,t.innerRadius=t.y0,delete t.y0,t.outerRadius=t.y1,delete t.y1,t.lineStartAngle=function(){return yy(n())},delete t.lineX0,t.lineEndAngle=function(){return yy(r())},delete t.lineX1,t.lineInnerRadius=function(){return yy(i())},delete t.lineY0,t.lineOuterRadius=function(){return yy(o())},delete t.lineY1,t.curve=function(t){return arguments.length?e(vy(t)):e()._curve},t}function xy(t,e){return[(e=+e)*Math.cos(t-=Math.PI/2),e*Math.sin(t)]}function Ty(t){return t.source}function Ay(t){return t.target}function Ey(t){var e=Ty,n=Ay,r=uy,i=dy,o=null;function a(){var a,s=ay.call(arguments),l=e.apply(this,s),c=n.apply(this,s);if(o||(o=a=Zo()),t(o,+r.apply(this,(s[0]=l,s)),+i.apply(this,s),+r.apply(this,(s[0]=c,s)),+i.apply(this,s)),a)return o=null,a+""||null}return a.source=function(t){return arguments.length?(e=t,a):e},a.target=function(t){return arguments.length?(n=t,a):n},a.x=function(t){return arguments.length?(r="function"==typeof t?t:qv(+t),a):r},a.y=function(t){return arguments.length?(i="function"==typeof t?t:qv(+t),a):i},a.context=function(t){return arguments.length?(o=null==t?null:t,a):o},a}function My(t,e,n,r,i){t.moveTo(e,n),t.bezierCurveTo(e=(e+r)/2,n,e,i,r,i)}function Sy(t,e,n,r,i){t.moveTo(e,n),t.bezierCurveTo(e,n=(n+i)/2,r,n,r,i)}function Ny(t,e,n,r,i){var o=xy(e,n),a=xy(e,n=(n+i)/2),s=xy(r,n),l=xy(r,i);t.moveTo(o[0],o[1]),t.bezierCurveTo(a[0],a[1],s[0],s[1],l[0],l[1])}by.prototype={areaStart:function(){this._curve.areaStart()},areaEnd:function(){this._curve.areaEnd()},lineStart:function(){this._curve.lineStart()},lineEnd:function(){this._curve.lineEnd()},point:function(t,e){this._curve.point(e*Math.sin(t),e*-Math.cos(t))}};var ky={draw:function(t,e){var n=Math.sqrt(e/$v);t.moveTo(n,0),t.arc(0,0,n,0,Xv)}},Cy={draw:function(t,e){var n=Math.sqrt(e/5)/2;t.moveTo(-3*n,-n),t.lineTo(-n,-n),t.lineTo(-n,-3*n),t.lineTo(n,-3*n),t.lineTo(n,-n),t.lineTo(3*n,-n),t.lineTo(3*n,n),t.lineTo(n,n),t.lineTo(n,3*n),t.lineTo(-n,3*n),t.lineTo(-n,n),t.lineTo(-3*n,n),t.closePath()}},Dy=Math.sqrt(1/3),Ly=2*Dy,Oy={draw:function(t,e){var n=Math.sqrt(e/Ly),r=n*Dy;t.moveTo(0,-n),t.lineTo(r,0),t.lineTo(0,n),t.lineTo(-r,0),t.closePath()}},Iy=Math.sin($v/10)/Math.sin(7*$v/10),By=Math.sin(Xv/10)*Iy,Py=-Math.cos(Xv/10)*Iy,jy={draw:function(t,e){var n=Math.sqrt(.8908130915292852*e),r=By*n,i=Py*n;t.moveTo(0,-n),t.lineTo(r,i);for(var o=1;o<5;++o){var a=Xv*o/5,s=Math.cos(a),l=Math.sin(a);t.lineTo(l*n,-s*n),t.lineTo(s*r-l*i,l*r+s*i)}t.closePath()}},Ry={draw:function(t,e){var n=Math.sqrt(e),r=-n/2;t.rect(r,r,n,n)}},qy=Math.sqrt(3),Fy={draw:function(t,e){var n=-Math.sqrt(e/(3*qy));t.moveTo(0,2*n),t.lineTo(-qy*n,-n),t.lineTo(qy*n,-n),t.closePath()}},zy=-.5,Uy=Math.sqrt(3)/2,Vy=1/Math.sqrt(12),Hy=3*(Vy/2+1),Gy={draw:function(t,e){var n=Math.sqrt(e/Hy),r=n/2,i=n*Vy,o=r,a=n*Vy+n,s=-o,l=a;t.moveTo(r,i),t.lineTo(o,a),t.lineTo(s,l),t.lineTo(zy*r-Uy*i,Uy*r+zy*i),t.lineTo(zy*o-Uy*a,Uy*o+zy*a),t.lineTo(zy*s-Uy*l,Uy*s+zy*l),t.lineTo(zy*r+Uy*i,zy*i-Uy*r),t.lineTo(zy*o+Uy*a,zy*a-Uy*o),t.lineTo(zy*s+Uy*l,zy*l-Uy*s),t.closePath()}},Yy=[ky,Cy,Oy,Ry,jy,Fy,Gy];function Wy(){}function $y(t,e,n){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+n)/6)}function Ky(t){this._context=t}function Xy(t){this._context=t}function Qy(t){this._context=t}function Zy(t,e){this._basis=new Ky(t),this._beta=e}Ky.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:$y(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:$y(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},Xy.prototype={areaStart:Wy,areaEnd:Wy,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x2=t,this._y2=e;break;case 1:this._point=2,this._x3=t,this._y3=e;break;case 2:this._point=3,this._x4=t,this._y4=e,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+e)/6);break;default:$y(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},Qy.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+t)/6,r=(this._y0+4*this._y1+e)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:$y(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},Zy.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var t=this._x,e=this._y,n=t.length-1;if(n>0)for(var r,i=t[0],o=e[0],a=t[n]-i,s=e[n]-o,l=-1;++l<=n;)r=l/n,this._basis.point(this._beta*t[l]+(1-this._beta)*(i+r*a),this._beta*e[l]+(1-this._beta)*(o+r*s));this._x=this._y=null,this._basis.lineEnd()},point:function(t,e){this._x.push(+t),this._y.push(+e)}};var Jy=function t(e){function n(t){return 1===e?new Ky(t):new Zy(t,e)}return n.beta=function(e){return t(+e)},n}(.85);function t_(t,e,n){t._context.bezierCurveTo(t._x1+t._k*(t._x2-t._x0),t._y1+t._k*(t._y2-t._y0),t._x2+t._k*(t._x1-e),t._y2+t._k*(t._y1-n),t._x2,t._y2)}function e_(t,e){this._context=t,this._k=(1-e)/6}e_.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:t_(this,this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2,this._x1=t,this._y1=e;break;case 2:this._point=3;default:t_(this,t,e)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var n_=function t(e){function n(t){return new e_(t,e)}return n.tension=function(e){return t(+e)},n}(0);function r_(t,e){this._context=t,this._k=(1-e)/6}r_.prototype={areaStart:Wy,areaEnd:Wy,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x3=t,this._y3=e;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=e);break;case 2:this._point=3,this._x5=t,this._y5=e;break;default:t_(this,t,e)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var i_=function t(e){function n(t){return new r_(t,e)}return n.tension=function(e){return t(+e)},n}(0);function o_(t,e){this._context=t,this._k=(1-e)/6}o_.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:t_(this,t,e)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var a_=function t(e){function n(t){return new o_(t,e)}return n.tension=function(e){return t(+e)},n}(0);function s_(t,e,n){var r=t._x1,i=t._y1,o=t._x2,a=t._y2;if(t._l01_a>Wv){var s=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,l=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*s-t._x0*t._l12_2a+t._x2*t._l01_2a)/l,i=(i*s-t._y0*t._l12_2a+t._y2*t._l01_2a)/l}if(t._l23_a>Wv){var c=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,u=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*c+t._x1*t._l23_2a-e*t._l12_2a)/u,a=(a*c+t._y1*t._l23_2a-n*t._l12_2a)/u}t._context.bezierCurveTo(r,i,o,a,t._x2,t._y2)}function l_(t,e){this._context=t,this._alpha=e}l_.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){if(t=+t,e=+e,this._point){var n=this._x2-t,r=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3;default:s_(this,t,e)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var c_=function t(e){function n(t){return e?new l_(t,e):new e_(t,0)}return n.alpha=function(e){return t(+e)},n}(.5);function u_(t,e){this._context=t,this._alpha=e}u_.prototype={areaStart:Wy,areaEnd:Wy,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(t,e){if(t=+t,e=+e,this._point){var n=this._x2-t,r=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=t,this._y3=e;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=e);break;case 2:this._point=3,this._x5=t,this._y5=e;break;default:s_(this,t,e)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var d_=function t(e){function n(t){return e?new u_(t,e):new r_(t,0)}return n.alpha=function(e){return t(+e)},n}(.5);function f_(t,e){this._context=t,this._alpha=e}f_.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){if(t=+t,e=+e,this._point){var n=this._x2-t,r=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:s_(this,t,e)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var h_=function t(e){function n(t){return e?new f_(t,e):new o_(t,0)}return n.alpha=function(e){return t(+e)},n}(.5);function p_(t){this._context=t}function m_(t){return t<0?-1:1}function g_(t,e,n){var r=t._x1-t._x0,i=e-t._x1,o=(t._y1-t._y0)/(r||i<0&&-0),a=(n-t._y1)/(i||r<0&&-0),s=(o*i+a*r)/(r+i);return(m_(o)+m_(a))*Math.min(Math.abs(o),Math.abs(a),.5*Math.abs(s))||0}function b_(t,e){var n=t._x1-t._x0;return n?(3*(t._y1-t._y0)/n-e)/2:e}function v_(t,e,n){var r=t._x0,i=t._y0,o=t._x1,a=t._y1,s=(o-r)/3;t._context.bezierCurveTo(r+s,i+s*e,o-s,a-s*n,o,a)}function y_(t){this._context=t}function __(t){this._context=new w_(t)}function w_(t){this._context=t}function x_(t){this._context=t}function T_(t){var e,n,r=t.length-1,i=new Array(r),o=new Array(r),a=new Array(r);for(i[0]=0,o[0]=2,a[0]=t[0]+2*t[1],e=1;e=0;--e)i[e]=(a[e]-i[e+1])/o[e];for(o[r-1]=(t[r]+i[r-1])/2,e=0;e1)for(var n,r,i,o=1,a=t[e[0]],s=a.length;o=0;)n[e]=e;return n}function S_(t,e){return t[e]}function N_(t){const e=[];return e.key=t,e}function k_(t){var e=t.map(C_);return M_(t).sort((function(t,n){return e[t]-e[n]}))}function C_(t){for(var e,n=-1,r=0,i=t.length,o=-1/0;++no&&(o=e,r=n);return r}function D_(t){var e=t.map(L_);return M_(t).sort((function(t,n){return e[t]-e[n]}))}function L_(t){for(var e,n=0,r=-1,i=t.length;++r=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,e),this._context.lineTo(t,e);else{var n=this._x*(1-this._t)+t*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,e)}}this._x=t,this._y=e}};var O_=t=>()=>t;function I_(t,{sourceEvent:e,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function B_(t,e,n){this.k=t,this.x=e,this.y=n}B_.prototype={constructor:B_,scale:function(t){return 1===t?this:new B_(this.k*t,this.x,this.y)},translate:function(t,e){return 0===t&0===e?this:new B_(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var P_=new B_(1,0,0);function j_(t){for(;!t.__zoom;)if(!(t=t.parentNode))return P_;return t.__zoom}function R_(t){t.stopImmediatePropagation()}function q_(t){t.preventDefault(),t.stopImmediatePropagation()}function F_(t){return!(t.ctrlKey&&"wheel"!==t.type||t.button)}function z_(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t).hasAttribute("viewBox")?[[(t=t.viewBox.baseVal).x,t.y],[t.x+t.width,t.y+t.height]]:[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]:[[0,0],[t.clientWidth,t.clientHeight]]}function U_(){return this.__zoom||P_}function V_(t){return-t.deltaY*(1===t.deltaMode?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function H_(){return navigator.maxTouchPoints||"ontouchstart"in this}function G_(t,e,n){var r=t.invertX(e[0][0])-n[0][0],i=t.invertX(e[1][0])-n[1][0],o=t.invertY(e[0][1])-n[0][1],a=t.invertY(e[1][1])-n[1][1];return t.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),a>o?(o+a)/2:Math.min(0,o)||Math.max(0,a))}j_.prototype=B_.prototype,t.Adder=m,t.Delaunay=Ha,t.FormatSpecifier=Ks,t.Voronoi=Ra,t.active=function(t,e){var n,r,i=t.__transition;if(i)for(r in e=null==e?null:e+"",i)if((n=i[r]).state>1&&n.name===e)return new Oi([[t]],ao,e,+r);return null},t.arc=function(){var t=Jv,e=ty,n=qv(0),r=null,i=ey,o=ny,a=ry,s=null;function l(){var l,c,u=+t.apply(this,arguments),d=+e.apply(this,arguments),f=i.apply(this,arguments)-Kv,h=o.apply(this,arguments)-Kv,p=Fv(h-f),m=h>f;if(s||(s=l=Zo()),dWv)if(p>Xv-Wv)s.moveTo(d*Uv(f),d*Gv(f)),s.arc(0,0,d,f,h,!m),u>Wv&&(s.moveTo(u*Uv(h),u*Gv(h)),s.arc(0,0,u,h,f,m));else{var g,b,v=f,y=h,_=f,w=h,x=p,T=p,A=a.apply(this,arguments)/2,E=A>Wv&&(r?+r.apply(this,arguments):Yv(u*u+d*d)),M=Hv(Fv(d-u)/2,+n.apply(this,arguments)),S=M,N=M;if(E>Wv){var k=Zv(E/u*Gv(A)),C=Zv(E/d*Gv(A));(x-=2*k)>Wv?(_+=k*=m?1:-1,w-=k):(x=0,_=w=(f+h)/2),(T-=2*C)>Wv?(v+=C*=m?1:-1,y-=C):(T=0,v=y=(f+h)/2)}var D=d*Uv(v),L=d*Gv(v),O=u*Uv(w),I=u*Gv(w);if(M>Wv){var B,P=d*Uv(y),j=d*Gv(y),R=u*Uv(_),q=u*Gv(_);if(p<$v&&(B=iy(D,L,R,q,P,j,O,I))){var F=D-B[0],z=L-B[1],U=P-B[0],V=j-B[1],H=1/Gv(Qv((F*U+z*V)/(Yv(F*F+z*z)*Yv(U*U+V*V)))/2),G=Yv(B[0]*B[0]+B[1]*B[1]);S=Hv(M,(u-G)/(H-1)),N=Hv(M,(d-G)/(H+1))}}T>Wv?N>Wv?(g=oy(R,q,D,L,d,N,m),b=oy(P,j,O,I,d,N,m),s.moveTo(g.cx+g.x01,g.cy+g.y01),NWv&&x>Wv?S>Wv?(g=oy(O,I,P,j,u,-S,m),b=oy(D,L,R,q,u,-S,m),s.lineTo(g.cx+g.x01,g.cy+g.y01),S>a,c=i+2*s>>a,u=da(20);function d(r){var i=new Float32Array(l*c),d=new Float32Array(l*c);r.forEach((function(r,o,u){var d=+t(r,o,u)+s>>a,f=+e(r,o,u)+s>>a,h=+n(r,o,u);d>=0&&d=0&&f>a),ya({width:l,height:c,data:d},{width:l,height:c,data:i},o>>a),va({width:l,height:c,data:i},{width:l,height:c,data:d},o>>a),ya({width:l,height:c,data:d},{width:l,height:c,data:i},o>>a),va({width:l,height:c,data:i},{width:l,height:c,data:d},o>>a),ya({width:l,height:c,data:d},{width:l,height:c,data:i},o>>a);var h=u(i);if(!Array.isArray(h)){var p=C(i);h=M(0,p,h),(h=z(0,Math.floor(p/h)*h,h)).shift()}return ba().thresholds(h).size([l,c])(i).map(f)}function f(t){return t.value*=Math.pow(2,-2*a),t.coordinates.forEach(h),t}function h(t){t.forEach(p)}function p(t){t.forEach(m)}function m(t){t[0]=t[0]*Math.pow(2,a)-s,t[1]=t[1]*Math.pow(2,a)-s}function g(){return l=r+2*(s=3*o)>>a,c=i+2*s>>a,d}return d.x=function(e){return arguments.length?(t="function"==typeof e?e:da(+e),d):t},d.y=function(t){return arguments.length?(e="function"==typeof t?t:da(+t),d):e},d.weight=function(t){return arguments.length?(n="function"==typeof t?t:da(+t),d):n},d.size=function(t){if(!arguments.length)return[r,i];var e=+t[0],n=+t[1];if(!(e>=0&&n>=0))throw new Error("invalid size");return r=e,i=n,g()},d.cellSize=function(t){if(!arguments.length)return 1<=1))throw new Error("invalid cell size");return a=Math.floor(Math.log(t)/Math.LN2),g()},d.thresholds=function(t){return arguments.length?(u="function"==typeof t?t:Array.isArray(t)?da(ca.call(t)):da(t),d):u},d.bandwidth=function(t){if(!arguments.length)return Math.sqrt(o*(o+1));if(!((t=+t)>=0))throw new Error("invalid bandwidth");return o=Math.round((Math.sqrt(4*t*t+1)-1)/2),g()},d},t.contours=ba,t.count=l,t.create=function(t){return Te(mt(t).call(document.documentElement))},t.creator=mt,t.cross=function(...t){const e="function"==typeof t[t.length-1]&&function(t){return e=>t(...e)}(t.pop()),n=(t=t.map(d)).map(c),r=t.length-1,i=new Array(r+1).fill(0),o=[];if(r<0||n.some(u))return o;for(;;){o.push(i.map(((e,n)=>t[n][e])));let a=r;for(;++i[a]===n[a];){if(0===a)return e?o.map(e):o;i[a--]=0}}},t.csv=ys,t.csvFormat=ts,t.csvFormatBody=es,t.csvFormatRow=rs,t.csvFormatRows=ns,t.csvFormatValue=is,t.csvParse=Za,t.csvParseRows=Ja,t.cubehelix=Gn,t.cumsum=function(t,e){var n=0,r=0;return Float64Array.from(t,void 0===e?t=>n+=+t||0:i=>n+=+e(i,r++,t)||0)},t.curveBasis=function(t){return new Ky(t)},t.curveBasisClosed=function(t){return new Xy(t)},t.curveBasisOpen=function(t){return new Qy(t)},t.curveBundle=Jy,t.curveCardinal=n_,t.curveCardinalClosed=i_,t.curveCardinalOpen=a_,t.curveCatmullRom=c_,t.curveCatmullRomClosed=d_,t.curveCatmullRomOpen=h_,t.curveLinear=cy,t.curveLinearClosed=function(t){return new p_(t)},t.curveMonotoneX=function(t){return new y_(t)},t.curveMonotoneY=function(t){return new __(t)},t.curveNatural=function(t){return new x_(t)},t.curveStep=function(t){return new A_(t,.5)},t.curveStepAfter=function(t){return new A_(t,1)},t.curveStepBefore=function(t){return new A_(t,0)},t.descending=function(t,e){return et?1:e>=t?0:NaN},t.deviation=h,t.difference=function(t,...e){t=new Set(t);for(const n of e)for(const e of n)t.delete(e);return t},t.disjoint=function(t,e){const n=e[Symbol.iterator](),r=new Set;for(const e of t){if(r.has(e))return!1;let t,i;for(;({value:t,done:i}=n.next())&&!i;){if(Object.is(e,t))return!1;r.add(t)}}return!0},t.dispatch=ot,t.drag=function(){var t,e,n,r,i=Be,o=Pe,a=je,s=Re,l={},c=ot("start","drag","end"),u=0,d=0;function f(t){t.on("mousedown.drag",h).filter(s).on("touchstart.drag",g).on("touchmove.drag",b).on("touchend.drag touchcancel.drag",v).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(a,s){if(!r&&i.call(this,a,s)){var l=y(this,o.call(this,a,s),a,s,"mouse");l&&(Te(a.view).on("mousemove.drag",p,!0).on("mouseup.drag",m,!0),De(a.view),ke(a),n=!1,t=a.clientX,e=a.clientY,l("start",a))}}function p(r){if(Ce(r),!n){var i=r.clientX-t,o=r.clientY-e;n=i*i+o*o>d}l.mouse("drag",r)}function m(t){Te(t.view).on("mousemove.drag mouseup.drag",null),Le(t.view,n),Ce(t),l.mouse("end",t)}function g(t,e){if(i.call(this,t,e)){var n,r,a=t.changedTouches,s=o.call(this,t,e),l=a.length;for(n=0;n+t,t.easePoly=zi,t.easePolyIn=qi,t.easePolyInOut=zi,t.easePolyOut=Fi,t.easeQuad=ji,t.easeQuadIn=function(t){return t*t},t.easeQuadInOut=ji,t.easeQuadOut=function(t){return t*(2-t)},t.easeSin=Hi,t.easeSinIn=function(t){return 1==+t?1:1-Math.cos(t*Vi)},t.easeSinInOut=Hi,t.easeSinOut=function(t){return Math.sin(t*Vi)},t.every=function(t,e){if("function"!=typeof e)throw new TypeError("test is not a function");let n=-1;for(const r of t)if(!e(r,++n,t))return!1;return!0},t.extent=p,t.filter=function(t,e){if("function"!=typeof e)throw new TypeError("test is not a function");const n=[];let r=-1;for(const i of t)e(i,++r,t)&&n.push(i);return n},t.forceCenter=function(t,e){var n,r=1;function i(){var i,o,a=n.length,s=0,l=0;for(i=0;ic+p||ou+p||al.index){var m=c-s.x-s.vx,g=u-s.y-s.vy,b=m*m+g*g;bt.r&&(t.r=t[e].r)}function l(){if(e){var r,i,o=e.length;for(n=new Array(o),r=0;r[s(t,e,r),t])));for(a=0,i=new Array(c);a=s)){(t.data!==e||t.next)&&(0===d&&(p+=(d=Bs(n))*d),0===f&&(p+=(f=Bs(n))*f),p(t=(1664525*t+1013904223)%Fs)/Fs}();function d(){f(),c.call("tick",e),n1?(null==n?s.delete(t):s.set(t,p(n)),e):s.get(t)},find:function(e,n,r){var i,o,a,s,l,c=0,u=t.length;for(null==r?r=1/0:r*=r,c=0;c1?(c.on(t,n),e):c.on(t)}}},t.forceX=function(t){var e,n,r,i=Is(.1);function o(t){for(var i,o=0,a=e.length;o=.12&&i<.234&&r>=-.425&&r<-.214?s:i>=.166&&i<.234&&r>=-.214&&r<-.115?l:a).invert(t)},u.stream=function(n){return t&&e===n?t:(r=[a.stream(e=n),s.stream(n),l.stream(n)],i=r.length,t={point:function(t,e){for(var n=-1;++nRc(r[0],r[1])&&(r[1]=i[1]),Rc(i[0],r[1])>Rc(r[0],r[1])&&(r[0]=i[0])):o.push(r=i);for(a=-1/0,e=0,r=o[n=o.length-1];e<=n;r=i,++e)i=o[e],(s=Rc(r[1],i[0]))>a&&(a=s,Vl=i[0],Gl=r[1])}return Zl=Jl=null,Vl===1/0||Hl===1/0?[[NaN,NaN],[NaN,NaN]]:[[Vl,Hl],[Gl,Yl]]},t.geoCentroid=function(t){pc=mc=gc=bc=vc=yc=_c=wc=0,xc=new m,Tc=new m,Ac=new m,jl(t,zc);var e=+xc,n=+Tc,r=+Ac,i=wl(e,n,r);return i2?t[2]+90:90]):[(t=n())[0],t[1],t[2]-90]},n([0,0,90]).scale(159.155)},t.geoTransverseMercatorRaw=Nf,t.gray=function(t,e){return new Sn(t,0,0,null==e?1:e)},t.greatest=function(t,n=e){let r,i=!1;if(1===n.length){let o;for(const a of t){const t=n(a);(i?e(t,o)>0:0===e(t,t))&&(r=a,o=t,i=!0)}}else for(const e of t)(i?n(e,r)>0:0===n(e,e))&&(r=e,i=!0);return r},t.greatestIndex=function(t,n=e){if(1===n.length)return P(t,n);let r,i=-1,o=-1;for(const e of t)++o,(i<0?0===n(e,e):n(e,r)>0)&&(r=e,i=o);return i},t.group=function(t,...e){return v(t,g,g,e)},t.groups=function(t,...e){return v(t,Array.from,g,e)},t.hcl=On,t.hierarchy=Of,t.histogram=k,t.hsl=mn,t.html=As,t.image=function(t,e){return new Promise((function(n,r){var i=new Image;for(var o in e)i[o]=e[o];i.onerror=r,i.onload=function(){n(i)},i.src=t}))},t.index=function(t,...e){return v(t,g,b,e)},t.indexes=function(t,...e){return v(t,Array.from,b,e)},t.interpolate=hr,t.interpolateArray=function(t,e){return(or(e)?ir:ar)(t,e)},t.interpolateBasis=$n,t.interpolateBasisClosed=Kn,t.interpolateBlues=gv,t.interpolateBrBG=Nb,t.interpolateBuGn=Yb,t.interpolateBuPu=$b,t.interpolateCividis=function(t){return t=Math.max(0,Math.min(1,t)),"rgb("+Math.max(0,Math.min(255,Math.round(-4.54-t*(35.34-t*(2381.73-t*(6402.7-t*(7024.72-2710.57*t)))))))+", "+Math.max(0,Math.min(255,Math.round(32.49+t*(170.73+t*(52.82-t*(131.46-t*(176.58-67.37*t)))))))+", "+Math.max(0,Math.min(255,Math.round(81.24+t*(442.36-t*(2482.43-t*(6167.24-t*(6614.94-2475.67*t)))))))+")"},t.interpolateCool=kv,t.interpolateCubehelix=Dr,t.interpolateCubehelixDefault=Sv,t.interpolateCubehelixLong=Lr,t.interpolateDate=sr,t.interpolateDiscrete=function(t){var e=t.length;return function(n){return t[Math.max(0,Math.min(e-1,Math.floor(n*e)))]}},t.interpolateGnBu=Xb,t.interpolateGreens=vv,t.interpolateGreys=_v,t.interpolateHcl=Nr,t.interpolateHclLong=kr,t.interpolateHsl=Er,t.interpolateHslLong=Mr,t.interpolateHue=function(t,e){var n=Zn(+t,+e);return function(t){var e=n(t);return e-360*Math.floor(e/360)}},t.interpolateInferno=jv,t.interpolateLab=function(t,e){var n=Jn((t=Mn(t)).l,(e=Mn(e)).l),r=Jn(t.a,e.a),i=Jn(t.b,e.b),o=Jn(t.opacity,e.opacity);return function(e){return t.l=n(e),t.a=r(e),t.b=i(e),t.opacity=o(e),t+""}},t.interpolateMagma=Pv,t.interpolateNumber=lr,t.interpolateNumberArray=ir,t.interpolateObject=cr,t.interpolateOrRd=Zb,t.interpolateOranges=Mv,t.interpolatePRGn=Cb,t.interpolatePiYG=Lb,t.interpolatePlasma=Rv,t.interpolatePuBu=nv,t.interpolatePuBuGn=tv,t.interpolatePuOr=Ib,t.interpolatePuRd=iv,t.interpolatePurples=xv,t.interpolateRainbow=function(t){(t<0||t>1)&&(t-=Math.floor(t));var e=Math.abs(t-.5);return Cv.h=360*t-100,Cv.s=1.5-1.5*e,Cv.l=.8-.9*e,Cv+""},t.interpolateRdBu=Pb,t.interpolateRdGy=Rb,t.interpolateRdPu=av,t.interpolateRdYlBu=Fb,t.interpolateRdYlGn=Ub,t.interpolateReds=Av,t.interpolateRgb=tr,t.interpolateRgbBasis=nr,t.interpolateRgbBasisClosed=rr,t.interpolateRound=pr,t.interpolateSinebow=function(t){var e;return t=(.5-t)*Math.PI,Dv.r=255*(e=Math.sin(t))*e,Dv.g=255*(e=Math.sin(t+Lv))*e,Dv.b=255*(e=Math.sin(t+Ov))*e,Dv+""},t.interpolateSpectral=Hb,t.interpolateString=fr,t.interpolateTransformCss=_r,t.interpolateTransformSvg=wr,t.interpolateTurbo=function(t){return t=Math.max(0,Math.min(1,t)),"rgb("+Math.max(0,Math.min(255,Math.round(34.61+t*(1172.33-t*(10793.56-t*(33300.12-t*(38394.49-14825.05*t)))))))+", "+Math.max(0,Math.min(255,Math.round(23.31+t*(557.33+t*(1225.33-t*(3574.96-t*(1073.77+707.56*t)))))))+", "+Math.max(0,Math.min(255,Math.round(27.2+t*(3211.1-t*(15327.97-t*(27814-t*(22569.18-6838.66*t)))))))+")"},t.interpolateViridis=Bv,t.interpolateWarm=Nv,t.interpolateYlGn=uv,t.interpolateYlGnBu=lv,t.interpolateYlOrBr=fv,t.interpolateYlOrRd=pv,t.interpolateZoom=Tr,t.interrupt=oi,t.intersection=function(t,...e){t=new Set(t),e=e.map(W);t:for(const n of t)for(const r of e)if(!r.has(n)){t.delete(n);continue t}return t},t.interval=function(t,e,n){var r=new Yr,i=e;return null==e?(r.restart(t,e,n),r):(r._restart=r.restart,r.restart=function(t,e,n){e=+e,n=null==n?Hr():+n,r._restart((function o(a){a+=i,r._restart(o,i+=e,n),t(a)}),e,n)},r.restart(t,e,n),r)},t.isoFormat=ib,t.isoParse=ob,t.json=function(t,e){return fetch(t,e).then(ws)},t.lab=Mn,t.lch=function(t,e,n,r){return 1===arguments.length?Ln(t):new In(n,e,t,null==r?1:r)},t.least=function(t,n=e){let r,i=!1;if(1===n.length){let o;for(const a of t){const t=n(a);(i?e(t,o)<0:0===e(t,t))&&(r=a,o=t,i=!0)}}else for(const e of t)(i?n(e,r)<0:0===n(e,e))&&(r=e,i=!0);return r},t.leastIndex=U,t.line=fy,t.lineRadial=_y,t.linkHorizontal=function(){return Ey(My)},t.linkRadial=function(){var t=Ey(Ny);return t.angle=t.x,delete t.x,t.radius=t.y,delete t.y,t},t.linkVertical=function(){return Ey(Sy)},t.local=Ee,t.map=function(t,e){if("function"!=typeof t[Symbol.iterator])throw new TypeError("values is not iterable");if("function"!=typeof e)throw new TypeError("mapper is not a function");return Array.from(t,((n,r)=>e(n,r,t)))},t.matcher=wt,t.max=C,t.maxIndex=P,t.mean=function(t,e){let n=0,r=0;if(void 0===e)for(let e of t)null!=e&&(e=+e)>=e&&(++n,r+=e);else{let i=-1;for(let o of t)null!=(o=e(o,++i,t))&&(o=+o)>=o&&(++n,r+=o)}if(n)return r/n},t.median=function(t,e){return I(t,.5,e)},t.merge=j,t.min=D,t.minIndex=R,t.namespace=ft,t.namespaces=dt,t.nice=S,t.now=Hr,t.pack=function(){var t=null,e=1,n=1,r=th;function i(i){return i.x=e/2,i.y=n/2,t?i.eachBefore(rh(t)).eachAfter(ih(r,.5)).eachBefore(oh(1)):i.eachBefore(rh(nh)).eachAfter(ih(th,1)).eachAfter(ih(r,i.r/Math.min(e,n))).eachBefore(oh(Math.min(e,n)/(2*i.r))),i}return i.radius=function(e){return arguments.length?(t=Zf(e),i):t},i.size=function(t){return arguments.length?(e=+t[0],n=+t[1],i):[e,n]},i.padding=function(t){return arguments.length?(r="function"==typeof t?t:eh(+t),i):r},i},t.packEnclose=qf,t.packSiblings=function(t){return Qf(t),t},t.pairs=function(t,e=q){const n=[];let r,i=!1;for(const o of t)i&&n.push(e(r,o)),r=o,i=!0;return n},t.partition=function(){var t=1,e=1,n=0,r=!1;function i(i){var o=i.height+1;return i.x0=i.y0=n,i.x1=t,i.y1=e/o,i.eachBefore(function(t,e){return function(r){r.children&&sh(r,r.x0,t*(r.depth+1)/e,r.x1,t*(r.depth+2)/e);var i=r.x0,o=r.y0,a=r.x1-n,s=r.y1-n;a0&&(h+=d);for(null!=e?p.sort((function(t,n){return e(m[t],m[n])})):null!=n&&p.sort((function(t,e){return n(a[t],a[e])})),s=0,c=h?(b-f*y)/h:0;s0?d*c:0)+y,m[l]={data:a[l],index:s,value:d,startAngle:g,endAngle:u,padAngle:v};return m}return a.value=function(e){return arguments.length?(t="function"==typeof e?e:qv(+e),a):t},a.sortValues=function(t){return arguments.length?(e=t,n=null,a):e},a.sort=function(t){return arguments.length?(n=t,e=null,a):n},a.startAngle=function(t){return arguments.length?(r="function"==typeof t?t:qv(+t),a):r},a.endAngle=function(t){return arguments.length?(i="function"==typeof t?t:qv(+t),a):i},a.padAngle=function(t){return arguments.length?(o="function"==typeof t?t:qv(+t),a):o},a},t.piecewise=Or,t.pointRadial=xy,t.pointer=Ne,t.pointers=function(t,e){return t.target&&(t=Se(t),void 0===e&&(e=t.currentTarget),t=t.touches||[t]),Array.from(t,(t=>Ne(t,e)))},t.polygonArea=function(t){for(var e,n=-1,r=t.length,i=t[r-1],o=0;++ns!=c>s&&a<(l-n)*(s-r)/(c-r)+n&&(u=!u),l=n,c=r;return u},t.polygonHull=function(t){if((n=t.length)<3)return null;var e,n,r=new Array(n),i=new Array(n);for(e=0;e=0;--e)c.push(t[r[o[e]][2]]);for(e=+s;e(e=1664525*e+1013904223|0,Hh*(e>>>0))},t.randomLogNormal=Ch,t.randomLogistic=Uh,t.randomNormal=kh,t.randomPareto=Ih,t.randomPoisson=Vh,t.randomUniform=Sh,t.randomWeibull=Fh,t.range=z,t.reduce=function(t,e,n){if("function"!=typeof e)throw new TypeError("reducer is not a function");const r=t[Symbol.iterator]();let i,o,a=-1;if(arguments.length<3){if(({done:i,value:n}=r.next()),i)return;++a}for(;({done:i,value:o}=r.next()),!i;)n=e(n,o,++a,t);return n},t.reverse=function(t){if("function"!=typeof t[Symbol.iterator])throw new TypeError("values is not iterable");return Array.from(t).reverse()},t.rgb=ln,t.ribbon=function(){return la()},t.ribbonArrow=function(){return la(sa)},t.rollup=function(t,e,...n){return v(t,g,e,n)},t.rollups=function(t,e,...n){return v(t,Array.from,e,n)},t.scaleBand=Kh,t.scaleDiverging=function t(){var e=sp(hb()(Jh));return e.copy=function(){return db(e,t())},Yh.apply(e,arguments)},t.scaleDivergingLog=function t(){var e=mp(hb()).domain([.1,1,10]);return e.copy=function(){return db(e,t()).base(e.base())},Yh.apply(e,arguments)},t.scaleDivergingPow=pb,t.scaleDivergingSqrt=function(){return pb.apply(null,arguments).exponent(.5)},t.scaleDivergingSymlog=function t(){var e=vp(hb());return e.copy=function(){return db(e,t()).constant(e.constant())},Yh.apply(e,arguments)},t.scaleIdentity=function t(e){var n;function r(t){return isNaN(t=+t)?n:t}return r.invert=r,r.domain=r.range=function(t){return arguments.length?(e=Array.from(t,Qh),r):e.slice()},r.unknown=function(t){return arguments.length?(n=t,r):n},r.copy=function(){return t(e).unknown(n)},e=arguments.length?Array.from(e,Qh):[0,1],sp(r)},t.scaleImplicit=Wh,t.scaleLinear=function t(){var e=op();return e.copy=function(){return rp(e,t())},Gh.apply(e,arguments),sp(e)},t.scaleLog=function t(){var e=mp(ip()).domain([1,10]);return e.copy=function(){return rp(e,t()).base(e.base())},Gh.apply(e,arguments),e},t.scaleOrdinal=$h,t.scalePoint=function(){return Xh(Kh.apply(null,arguments).paddingInner(1))},t.scalePow=Tp,t.scaleQuantile=function t(){var n,r=[],i=[],a=[];function s(){var t=0,e=Math.max(1,i.length);for(a=new Array(e-1);++t0?a[e-1]:r[0],e=i?[a[i-1],r]:[a[e-1],a[e]]},l.unknown=function(t){return arguments.length?(e=t,l):l},l.thresholds=function(){return a.slice()},l.copy=function(){return t().domain([n,r]).range(s).unknown(e)},Gh.apply(sp(l),arguments)},t.scaleRadial=function t(){var e,n=op(),r=[0,1],i=!1;function o(t){var r=Ep(n(t));return isNaN(r)?e:i?Math.round(r):r}return o.invert=function(t){return n.invert(Ap(t))},o.domain=function(t){return arguments.length?(n.domain(t),o):n.domain()},o.range=function(t){return arguments.length?(n.range((r=Array.from(t,Qh)).map(Ap)),o):r.slice()},o.rangeRound=function(t){return o.range(t).round(!0)},o.round=function(t){return arguments.length?(i=!!t,o):i},o.clamp=function(t){return arguments.length?(n.clamp(t),o):n.clamp()},o.unknown=function(t){return arguments.length?(e=t,o):e},o.copy=function(){return t(n.domain(),r).round(i).clamp(n.clamp()).unknown(e)},Gh.apply(o,arguments),sp(o)},t.scaleSequential=function t(){var e=sp(ub()(Jh));return e.copy=function(){return db(e,t())},Yh.apply(e,arguments)},t.scaleSequentialLog=function t(){var e=mp(ub()).domain([1,10]);return e.copy=function(){return db(e,t()).base(e.base())},Yh.apply(e,arguments)},t.scaleSequentialPow=fb,t.scaleSequentialQuantile=function t(){var n=[],r=Jh;function i(t){if(!isNaN(t=+t))return r((o(n,t,1)-1)/(n.length-1))}return i.domain=function(t){if(!arguments.length)return n.slice();n=[];for(let e of t)null==e||isNaN(e=+e)||n.push(e);return n.sort(e),i},i.interpolator=function(t){return arguments.length?(r=t,i):r},i.range=function(){return n.map(((t,e)=>r(e/(n.length-1))))},i.quantiles=function(t){return Array.from({length:t+1},((e,r)=>I(n,r/t)))},i.copy=function(){return t(r).domain(n)},Yh.apply(i,arguments)},t.scaleSequentialSqrt=function(){return fb.apply(null,arguments).exponent(.5)},t.scaleSequentialSymlog=function t(){var e=vp(ub());return e.copy=function(){return db(e,t()).constant(e.constant())},Yh.apply(e,arguments)},t.scaleSqrt=function(){return Tp.apply(null,arguments).exponent(.5)},t.scaleSymlog=function t(){var e=vp(ip());return e.copy=function(){return rp(e,t()).constant(e.constant())},Gh.apply(e,arguments)},t.scaleThreshold=function t(){var e,n=[.5],r=[0,1],i=1;function a(t){return t<=t?r[o(n,t,0,i)]:e}return a.domain=function(t){return arguments.length?(n=Array.from(t),i=Math.min(n.length,r.length-1),a):n.slice()},a.range=function(t){return arguments.length?(r=Array.from(t),i=Math.min(n.length,r.length-1),a):r.slice()},a.invertExtent=function(t){var e=r.indexOf(t);return[n[e-1],n[e]]},a.unknown=function(t){return arguments.length?(e=t,a):e},a.copy=function(){return t().domain(n).range(r).unknown(e)},Gh.apply(a,arguments)},t.scaleTime=function(){return Gh.apply(cb(sm,om,Gp,Up,Fp,Rp,Pp,kp,t.timeFormat).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)},t.scaleUtc=function(){return Gh.apply(cb(Lm,Cm,gm,hm,dm,cm,Pp,kp,t.utcFormat).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)},t.scan=function(t,e){const n=U(t,e);return n<0?void 0:n},t.schemeAccent=bb,t.schemeBlues=mv,t.schemeBrBG=Sb,t.schemeBuGn=Gb,t.schemeBuPu=Wb,t.schemeCategory10=gb,t.schemeDark2=vb,t.schemeGnBu=Kb,t.schemeGreens=bv,t.schemeGreys=yv,t.schemeOrRd=Qb,t.schemeOranges=Ev,t.schemePRGn=kb,t.schemePaired=yb,t.schemePastel1=_b,t.schemePastel2=wb,t.schemePiYG=Db,t.schemePuBu=ev,t.schemePuBuGn=Jb,t.schemePuOr=Ob,t.schemePuRd=rv,t.schemePurples=wv,t.schemeRdBu=Bb,t.schemeRdGy=jb,t.schemeRdPu=ov,t.schemeRdYlBu=qb,t.schemeRdYlGn=zb,t.schemeReds=Tv,t.schemeSet1=xb,t.schemeSet2=Tb,t.schemeSet3=Ab,t.schemeSpectral=Vb,t.schemeTableau10=Eb,t.schemeYlGn=cv,t.schemeYlGnBu=sv,t.schemeYlOrBr=dv,t.schemeYlOrRd=hv,t.select=Te,t.selectAll=function(t){return"string"==typeof t?new we([document.querySelectorAll(t)],[document.documentElement]):new we([null==t?[]:vt(t)],_e)},t.selection=xe,t.selector=bt,t.selectorAll=_t,t.shuffle=V,t.shuffler=H,t.some=function(t,e){if("function"!=typeof e)throw new TypeError("test is not a function");let n=-1;for(const r of t)if(e(r,++n,t))return!0;return!1},t.sort=function(t,n=e){if("function"!=typeof t[Symbol.iterator])throw new TypeError("values is not iterable");return t=Array.from(t),1===n.length?(n=t.map(n),F(t,t.map(((t,e)=>e)).sort(((t,r)=>e(n[t],n[r]))))):t.sort(n)},t.stack=function(){var t=qv([]),e=M_,n=E_,r=S_;function i(i){var o,a,s=Array.from(t.apply(this,arguments),N_),l=s.length,c=-1;for(const t of i)for(o=0,++c;o0)for(var n,r,i,o,a,s,l=0,c=t[e[0]].length;l0?(r[0]=o,r[1]=o+=i):i<0?(r[1]=a,r[0]=a+=i):(r[0]=0,r[1]=i)},t.stackOffsetExpand=function(t,e){if((r=t.length)>0){for(var n,r,i,o=0,a=t[0].length;o0){for(var n,r=0,i=t[e[0]],o=i.length;r0&&(r=(n=t[e[0]]).length)>0){for(var n,r,i,o=0,a=1;a0)throw new Error("cycle");return o}return n.id=function(e){return arguments.length?(t=Jf(e),n):t},n.parentId=function(t){return arguments.length?(e=Jf(t),n):e},n},t.style=Ht,t.subset=function(t,e){return $(e,t)},t.sum=function(t,e){let n=0;if(void 0===e)for(let e of t)(e=+e)&&(n+=e);else{let r=-1;for(let i of t)(i=+e(i,++r,t))&&(n+=i)}return n},t.superset=$,t.svg=Es,t.symbol=function(t,e){var n=null;function r(){var r;if(n||(n=r=Zo()),t.apply(this,arguments).draw(n,+e.apply(this,arguments)),r)return n=null,r+""||null}return t="function"==typeof t?t:qv(t||ky),e="function"==typeof e?e:qv(void 0===e?64:+e),r.type=function(e){return arguments.length?(t="function"==typeof e?e:qv(e),r):t},r.size=function(t){return arguments.length?(e="function"==typeof t?t:qv(+t),r):e},r.context=function(t){return arguments.length?(n=null==t?null:t,r):n},r},t.symbolCircle=ky,t.symbolCross=Cy,t.symbolDiamond=Oy,t.symbolSquare=Ry,t.symbolStar=jy,t.symbolTriangle=Fy,t.symbolWye=Gy,t.symbols=Yy,t.text=bs,t.thresholdFreedmanDiaconis=function(t,e,n){return Math.ceil((n-e)/(2*(I(t,.75)-I(t,.25))*Math.pow(l(t),-1/3)))},t.thresholdScott=function(t,e,n){return Math.ceil((n-e)/(3.5*h(t)*Math.pow(l(t),-1/3)))},t.thresholdSturges=N,t.tickFormat=ap,t.tickIncrement=E,t.tickStep=M,t.ticks=A,t.timeDay=Up,t.timeDays=Vp,t.timeFormatDefaultLocale=nb,t.timeFormatLocale=jm,t.timeFriday=Xp,t.timeFridays=rm,t.timeHour=Fp,t.timeHours=zp,t.timeInterval=Np,t.timeMillisecond=kp,t.timeMilliseconds=Cp,t.timeMinute=Rp,t.timeMinutes=qp,t.timeMonday=Yp,t.timeMondays=Jp,t.timeMonth=om,t.timeMonths=am,t.timeSaturday=Qp,t.timeSaturdays=im,t.timeSecond=Pp,t.timeSeconds=jp,t.timeSunday=Gp,t.timeSundays=Zp,t.timeThursday=Kp,t.timeThursdays=nm,t.timeTuesday=Wp,t.timeTuesdays=tm,t.timeWednesday=$p,t.timeWednesdays=em,t.timeWeek=Gp,t.timeWeeks=Zp,t.timeYear=sm,t.timeYears=lm,t.timeout=Zr,t.timer=Wr,t.timerFlush=$r,t.transition=Ii,t.transpose=G,t.tree=function(){var t=fh,e=1,n=1,r=null;function i(i){var l=function(t){for(var e,n,r,i,o,a=new bh(t,0),s=[a];e=s.pop();)if(r=e._.children)for(e.children=new Array(o=r.length),i=o-1;i>=0;--i)s.push(n=e.children[i]=new bh(r[i],i)),n.parent=e;return(a.parent=new bh(null,0)).children=[a],a}(i);if(l.eachAfter(o),l.parent.m=-l.z,l.eachBefore(a),r)i.eachBefore(s);else{var c=i,u=i,d=i;i.eachBefore((function(t){t.xu.x&&(u=t),t.depth>d.depth&&(d=t)}));var f=c===u?1:t(c,u)/2,h=f-c.x,p=e/(u.x+f+h),m=n/(d.depth||1);i.eachBefore((function(t){t.x=(t.x+h)*p,t.y=t.depth*m}))}return i}function o(e){var n=e.children,r=e.parent.children,i=e.i?r[e.i-1]:null;if(n){!function(t){for(var e,n=0,r=0,i=t.children,o=i.length;--o>=0;)(e=i[o]).z+=n,e.m+=n,n+=e.s+(r+=e.c)}(e);var o=(n[0].z+n[n.length-1].z)/2;i?(e.z=i.z+t(e._,i._),e.m=e.z-o):e.z=o}else i&&(e.z=i.z+t(e._,i._));e.parent.A=function(e,n,r){if(n){for(var i,o=e,a=e,s=n,l=o.parent.children[0],c=o.m,u=a.m,d=s.m,f=l.m;s=ph(s),o=hh(o),s&&o;)l=hh(l),(a=ph(a)).a=e,(i=s.z+d-o.z-c+t(s._,o._))>0&&(mh(gh(s,e,r),e,i),c+=i,u+=i),d+=s.m,c+=o.m,f+=l.m,u+=a.m;s&&!ph(a)&&(a.t=s,a.m+=d-u),o&&!hh(l)&&(l.t=o,l.m+=c-f,r=e)}return r}(e,i,e.parent.A||r[0])}function a(t){t._.x=t.z+t.parent.m,t.m+=t.parent.m}function s(t){t.x*=e,t.y=t.depth*n}return i.separation=function(e){return arguments.length?(t=e,i):t},i.size=function(t){return arguments.length?(r=!1,e=+t[0],n=+t[1],i):r?null:[e,n]},i.nodeSize=function(t){return arguments.length?(r=!0,e=+t[0],n=+t[1],i):r?[e,n]:null},i},t.treemap=function(){var t=wh,e=!1,n=1,r=1,i=[0],o=th,a=th,s=th,l=th,c=th;function u(t){return t.x0=t.y0=0,t.x1=n,t.y1=r,t.eachBefore(d),i=[0],e&&t.eachBefore(ah),t}function d(e){var n=i[e.depth],r=e.x0+n,u=e.y0+n,d=e.x1-n,f=e.y1-n;d=n-1){var u=s[e];return u.x0=i,u.y0=o,u.x1=a,void(u.y1=l)}for(var d=c[e],f=r/2+d,h=e+1,p=n-1;h>>1;c[m]l-o){var v=r?(i*b+a*g)/r:a;t(e,h,g,i,o,v,l),t(h,n,b,v,o,a,l)}else{var y=r?(o*b+l*g)/r:l;t(e,h,g,i,o,a,y),t(h,n,b,i,y,a,l)}}(0,l,t.value,e,n,r,i)},t.treemapDice=sh,t.treemapResquarify=xh,t.treemapSlice=vh,t.treemapSliceDice=function(t,e,n,r,i){(1&t.depth?vh:sh)(t,e,n,r,i)},t.treemapSquarify=wh,t.tsv=_s,t.tsvFormat=ls,t.tsvFormatBody=cs,t.tsvFormatRow=ds,t.tsvFormatRows=us,t.tsvFormatValue=fs,t.tsvParse=as,t.tsvParseRows=ss,t.union=function(...t){const e=new Set;for(const n of t)for(const t of n)e.add(t);return e},t.utcDay=hm,t.utcDays=pm,t.utcFriday=wm,t.utcFridays=Nm,t.utcHour=dm,t.utcHours=fm,t.utcMillisecond=kp,t.utcMilliseconds=Cp,t.utcMinute=cm,t.utcMinutes=um,t.utcMonday=bm,t.utcMondays=Am,t.utcMonth=Cm,t.utcMonths=Dm,t.utcSaturday=xm,t.utcSaturdays=km,t.utcSecond=Pp,t.utcSeconds=jp,t.utcSunday=gm,t.utcSundays=Tm,t.utcThursday=_m,t.utcThursdays=Sm,t.utcTuesday=vm,t.utcTuesdays=Em,t.utcWednesday=ym,t.utcWednesdays=Mm,t.utcWeek=gm,t.utcWeeks=Tm,t.utcYear=Lm,t.utcYears=Om,t.variance=f,t.version="6.3.0",t.window=Ft,t.xml=Ts,t.zip=function(){return G(arguments)},t.zoom=function(){var t,e,n,r=F_,i=z_,o=G_,a=V_,s=H_,l=[0,1/0],c=[[-1/0,-1/0],[1/0,1/0]],u=250,d=Tr,f=ot("start","zoom","end"),h=500,p=0,m=10;function g(t){t.property("__zoom",U_).on("wheel.zoom",T).on("mousedown.zoom",A).on("dblclick.zoom",E).filter(s).on("touchstart.zoom",M).on("touchmove.zoom",S).on("touchend.zoom touchcancel.zoom",N).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function b(t,e){return(e=Math.max(l[0],Math.min(l[1],e)))===t.k?t:new B_(e,t.x,t.y)}function v(t,e,n){var r=e[0]-n[0]*t.k,i=e[1]-n[1]*t.k;return r===t.x&&i===t.y?t:new B_(t.k,r,i)}function y(t){return[(+t[0][0]+ +t[1][0])/2,(+t[0][1]+ +t[1][1])/2]}function _(t,e,n,r){t.on("start.zoom",(function(){w(this,arguments).event(r).start()})).on("interrupt.zoom end.zoom",(function(){w(this,arguments).event(r).end()})).tween("zoom",(function(){var t=this,o=arguments,a=w(t,o).event(r),s=i.apply(t,o),l=null==n?y(s):"function"==typeof n?n.apply(t,o):n,c=Math.max(s[1][0]-s[0][0],s[1][1]-s[0][1]),u=t.__zoom,f="function"==typeof e?e.apply(t,o):e,h=d(u.invert(l).concat(c/u.k),f.invert(l).concat(c/f.k));return function(t){if(1===t)t=f;else{var e=h(t),n=c/e[2];t=new B_(n,l[0]-e[0]*n,l[1]-e[1]*n)}a.zoom(null,t)}}))}function w(t,e,n){return!n&&t.__zooming||new x(t,e)}function x(t,e){this.that=t,this.args=e,this.active=0,this.sourceEvent=null,this.extent=i.apply(t,e),this.taps=0}function T(t,...e){if(r.apply(this,arguments)){var n=w(this,e).event(t),i=this.__zoom,s=Math.max(l[0],Math.min(l[1],i.k*Math.pow(2,a.apply(this,arguments)))),u=Ne(t);if(n.wheel)n.mouse[0][0]===u[0]&&n.mouse[0][1]===u[1]||(n.mouse[1]=i.invert(n.mouse[0]=u)),clearTimeout(n.wheel);else{if(i.k===s)return;n.mouse=[u,i.invert(u)],oi(this),n.start()}q_(t),n.wheel=setTimeout(d,150),n.zoom("mouse",o(v(b(i,s),n.mouse[0],n.mouse[1]),n.extent,c))}function d(){n.wheel=null,n.end()}}function A(t,...e){if(!n&&r.apply(this,arguments)){var i=w(this,e,!0).event(t),a=Te(t.view).on("mousemove.zoom",f,!0).on("mouseup.zoom",h,!0),s=Ne(t,l),l=t.currentTarget,u=t.clientX,d=t.clientY;De(t.view),R_(t),i.mouse=[s,this.__zoom.invert(s)],oi(this),i.start()}function f(t){if(q_(t),!i.moved){var e=t.clientX-u,n=t.clientY-d;i.moved=e*e+n*n>p}i.event(t).zoom("mouse",o(v(i.that.__zoom,i.mouse[0]=Ne(t,l),i.mouse[1]),i.extent,c))}function h(t){a.on("mousemove.zoom mouseup.zoom",null),Le(t.view,i.moved),q_(t),i.event(t).end()}}function E(t,...e){if(r.apply(this,arguments)){var n=this.__zoom,a=Ne(t.changedTouches?t.changedTouches[0]:t,this),s=n.invert(a),l=n.k*(t.shiftKey?.5:2),d=o(v(b(n,l),a,s),i.apply(this,e),c);q_(t),u>0?Te(this).transition().duration(u).call(_,d,a,t):Te(this).call(g.transform,d,a,t)}}function M(n,...i){if(r.apply(this,arguments)){var o,a,s,l,c=n.touches,u=c.length,d=w(this,i,n.changedTouches.length===u).event(n);for(R_(n),a=0;a{do{t+=Math.floor(1e6*Math.random())}while(document.getElementById(t));return t},e=t=>{let e=t.getAttribute("data-bs-target");if(!e||"#"===e){let n=t.getAttribute("href");if(!n||!n.includes("#")&&!n.startsWith("."))return null;n.includes("#")&&!n.startsWith("#")&&(n="#"+n.split("#")[1]),e=n&&"#"!==n?n.trim():null}return e},n=t=>{const n=e(t);return n&&document.querySelector(n)?n:null},r=t=>{const n=e(t);return n?document.querySelector(n):null},i=t=>{if(!t)return 0;let{transitionDuration:e,transitionDelay:n}=window.getComputedStyle(t);const r=Number.parseFloat(e),i=Number.parseFloat(n);return r||i?(e=e.split(",")[0],n=n.split(",")[0],1e3*(Number.parseFloat(e)+Number.parseFloat(n))):0},o=t=>{t.dispatchEvent(new Event("transitionend"))},a=t=>(t[0]||t).nodeType,s=(t,e)=>{let n=!1;const r=e+5;t.addEventListener("transitionend",(function e(){n=!0,t.removeEventListener("transitionend",e)})),setTimeout((()=>{n||o(t)}),r)},l=(t,e,n)=>{Object.keys(n).forEach((r=>{const i=n[r],o=e[r],s=o&&a(o)?"element":null==(l=o)?""+l:{}.toString.call(l).match(/\s([a-z]+)/i)[1].toLowerCase();var l;if(!new RegExp(i).test(s))throw new TypeError(t.toUpperCase()+": "+`Option "${r}" provided type "${s}" `+`but expected type "${i}".`)}))},c=t=>{if(!t)return!1;if(t.style&&t.parentNode&&t.parentNode.style){const e=getComputedStyle(t),n=getComputedStyle(t.parentNode);return"none"!==e.display&&"none"!==n.display&&"hidden"!==e.visibility}return!1},u=t=>!t||t.nodeType!==Node.ELEMENT_NODE||!!t.classList.contains("disabled")||(void 0!==t.disabled?t.disabled:t.hasAttribute("disabled")&&"false"!==t.getAttribute("disabled")),d=t=>{if(!document.documentElement.attachShadow)return null;if("function"==typeof t.getRootNode){const e=t.getRootNode();return e instanceof ShadowRoot?e:null}return t instanceof ShadowRoot?t:t.parentNode?d(t.parentNode):null},f=()=>function(){},h=t=>t.offsetHeight,p=()=>{const{jQuery:t}=window;return t&&!document.body.hasAttribute("data-bs-no-jquery")?t:null},m=()=>"rtl"===document.documentElement.dir,g=(t,e)=>{var n;n=()=>{const n=p();if(n){const r=n.fn[t];n.fn[t]=e.jQueryInterface,n.fn[t].Constructor=e,n.fn[t].noConflict=()=>(n.fn[t]=r,e.jQueryInterface)}},"loading"===document.readyState?document.addEventListener("DOMContentLoaded",n):n()},b=new Map;var v={set(t,e,n){b.has(t)||b.set(t,new Map);const r=b.get(t);r.has(e)||0===r.size?r.set(e,n):console.error(`Bootstrap doesn't allow more than one instance per element. Bound instance: ${Array.from(r.keys())[0]}.`)},get:(t,e)=>b.has(t)&&b.get(t).get(e)||null,remove(t,e){if(!b.has(t))return;const n=b.get(t);n.delete(e),0===n.size&&b.delete(t)}};const y=/[^.]*(?=\..*)\.|.*/,_=/\..*/,w=/::\d+$/,x={};let T=1;const A={mouseenter:"mouseover",mouseleave:"mouseout"},E=new Set(["click","dblclick","mouseup","mousedown","contextmenu","mousewheel","DOMMouseScroll","mouseover","mouseout","mousemove","selectstart","selectend","keydown","keypress","keyup","orientationchange","touchstart","touchmove","touchend","touchcancel","pointerdown","pointermove","pointerup","pointerleave","pointercancel","gesturestart","gesturechange","gestureend","focus","blur","change","reset","select","submit","focusin","focusout","load","unload","beforeunload","resize","move","DOMContentLoaded","readystatechange","error","abort","scroll"]);function M(t,e){return e&&`${e}::${T++}`||t.uidEvent||T++}function S(t){const e=M(t);return t.uidEvent=e,x[e]=x[e]||{},x[e]}function N(t,e,n=null){const r=Object.keys(t);for(let i=0,o=r.length;i{!function(t,e,n,r){const i=e[n]||{};Object.keys(i).forEach((o=>{if(o.includes(r)){const r=i[o];D(t,e,n,r.originalHandler,r.delegationSelector)}}))}(t,l,n,e.slice(1))}));const u=l[a]||{};Object.keys(u).forEach((n=>{const r=n.replace(w,"");if(!s||e.includes(r)){const e=u[n];D(t,l,a,e.originalHandler,e.delegationSelector)}}))},trigger(t,e,n){if("string"!=typeof e||!t)return null;const r=p(),i=e.replace(_,""),o=e!==i,a=E.has(i);let s,l=!0,c=!0,u=!1,d=null;return o&&r&&(s=r.Event(e,n),r(t).trigger(s),l=!s.isPropagationStopped(),c=!s.isImmediatePropagationStopped(),u=s.isDefaultPrevented()),a?(d=document.createEvent("HTMLEvents"),d.initEvent(i,l,!0)):d=new CustomEvent(e,{bubbles:l,cancelable:!0}),void 0!==n&&Object.keys(n).forEach((t=>{Object.defineProperty(d,t,{get:()=>n[t]})})),u&&d.preventDefault(),c&&t.dispatchEvent(d),d.defaultPrevented&&void 0!==s&&s.preventDefault(),d}};class O{constructor(t){(t="string"==typeof t?document.querySelector(t):t)&&(this._element=t,v.set(this._element,this.constructor.DATA_KEY,this))}dispose(){v.remove(this._element,this.constructor.DATA_KEY),this._element=null}static getInstance(t){return v.get(t,this.DATA_KEY)}static get VERSION(){return"5.0.0-beta3"}}class I extends O{static get DATA_KEY(){return"bs.alert"}close(t){const e=t?this._getRootElement(t):this._element,n=this._triggerCloseEvent(e);null===n||n.defaultPrevented||this._removeElement(e)}_getRootElement(t){return r(t)||t.closest(".alert")}_triggerCloseEvent(t){return L.trigger(t,"close.bs.alert")}_removeElement(t){if(t.classList.remove("show"),!t.classList.contains("fade"))return void this._destroyElement(t);const e=i(t);L.one(t,"transitionend",(()=>this._destroyElement(t))),s(t,e)}_destroyElement(t){t.parentNode&&t.parentNode.removeChild(t),L.trigger(t,"closed.bs.alert")}static jQueryInterface(t){return this.each((function(){let e=v.get(this,"bs.alert");e||(e=new I(this)),"close"===t&&e[t](this)}))}static handleDismiss(t){return function(e){e&&e.preventDefault(),t.close(this)}}}L.on(document,"click.bs.alert.data-api",'[data-bs-dismiss="alert"]',I.handleDismiss(new I)),g("alert",I);class B extends O{static get DATA_KEY(){return"bs.button"}toggle(){this._element.setAttribute("aria-pressed",this._element.classList.toggle("active"))}static jQueryInterface(t){return this.each((function(){let e=v.get(this,"bs.button");e||(e=new B(this)),"toggle"===t&&e[t]()}))}}function P(t){return"true"===t||"false"!==t&&(t===Number(t).toString()?Number(t):""===t||"null"===t?null:t)}function j(t){return t.replace(/[A-Z]/g,(t=>"-"+t.toLowerCase()))}L.on(document,"click.bs.button.data-api",'[data-bs-toggle="button"]',(t=>{t.preventDefault();const e=t.target.closest('[data-bs-toggle="button"]');let n=v.get(e,"bs.button");n||(n=new B(e)),n.toggle()})),g("button",B);const R={setDataAttribute(t,e,n){t.setAttribute("data-bs-"+j(e),n)},removeDataAttribute(t,e){t.removeAttribute("data-bs-"+j(e))},getDataAttributes(t){if(!t)return{};const e={};return Object.keys(t.dataset).filter((t=>t.startsWith("bs"))).forEach((n=>{let r=n.replace(/^bs/,"");r=r.charAt(0).toLowerCase()+r.slice(1,r.length),e[r]=P(t.dataset[n])})),e},getDataAttribute:(t,e)=>P(t.getAttribute("data-bs-"+j(e))),offset(t){const e=t.getBoundingClientRect();return{top:e.top+document.body.scrollTop,left:e.left+document.body.scrollLeft}},position:t=>({top:t.offsetTop,left:t.offsetLeft})},q={find:(t,e=document.documentElement)=>[].concat(...Element.prototype.querySelectorAll.call(e,t)),findOne:(t,e=document.documentElement)=>Element.prototype.querySelector.call(e,t),children:(t,e)=>[].concat(...t.children).filter((t=>t.matches(e))),parents(t,e){const n=[];let r=t.parentNode;for(;r&&r.nodeType===Node.ELEMENT_NODE&&3!==r.nodeType;)r.matches(e)&&n.push(r),r=r.parentNode;return n},prev(t,e){let n=t.previousElementSibling;for(;n;){if(n.matches(e))return[n];n=n.previousElementSibling}return[]},next(t,e){let n=t.nextElementSibling;for(;n;){if(n.matches(e))return[n];n=n.nextElementSibling}return[]}},F={interval:5e3,keyboard:!0,slide:!1,pause:"hover",wrap:!0,touch:!0},z={interval:"(number|boolean)",keyboard:"boolean",slide:"(boolean|string)",pause:"(string|boolean)",wrap:"boolean",touch:"boolean"},U="next",V="prev",H="left",G="right";class Y extends O{constructor(t,e){super(t),this._items=null,this._interval=null,this._activeElement=null,this._isPaused=!1,this._isSliding=!1,this.touchTimeout=null,this.touchStartX=0,this.touchDeltaX=0,this._config=this._getConfig(e),this._indicatorsElement=q.findOne(".carousel-indicators",this._element),this._touchSupported="ontouchstart"in document.documentElement||navigator.maxTouchPoints>0,this._pointerEvent=Boolean(window.PointerEvent),this._addEventListeners()}static get Default(){return F}static get DATA_KEY(){return"bs.carousel"}next(){this._isSliding||this._slide(U)}nextWhenVisible(){!document.hidden&&c(this._element)&&this.next()}prev(){this._isSliding||this._slide(V)}pause(t){t||(this._isPaused=!0),q.findOne(".carousel-item-next, .carousel-item-prev",this._element)&&(o(this._element),this.cycle(!0)),clearInterval(this._interval),this._interval=null}cycle(t){t||(this._isPaused=!1),this._interval&&(clearInterval(this._interval),this._interval=null),this._config&&this._config.interval&&!this._isPaused&&(this._updateInterval(),this._interval=setInterval((document.visibilityState?this.nextWhenVisible:this.next).bind(this),this._config.interval))}to(t){this._activeElement=q.findOne(".active.carousel-item",this._element);const e=this._getItemIndex(this._activeElement);if(t>this._items.length-1||t<0)return;if(this._isSliding)return void L.one(this._element,"slid.bs.carousel",(()=>this.to(t)));if(e===t)return this.pause(),void this.cycle();const n=t>e?U:V;this._slide(n,this._items[t])}dispose(){L.off(this._element,".bs.carousel"),this._items=null,this._config=null,this._interval=null,this._isPaused=null,this._isSliding=null,this._activeElement=null,this._indicatorsElement=null,super.dispose()}_getConfig(t){return t={...F,...t},l("carousel",t,z),t}_handleSwipe(){const t=Math.abs(this.touchDeltaX);if(t<=40)return;const e=t/this.touchDeltaX;this.touchDeltaX=0,e&&this._slide(e>0?G:H)}_addEventListeners(){this._config.keyboard&&L.on(this._element,"keydown.bs.carousel",(t=>this._keydown(t))),"hover"===this._config.pause&&(L.on(this._element,"mouseenter.bs.carousel",(t=>this.pause(t))),L.on(this._element,"mouseleave.bs.carousel",(t=>this.cycle(t)))),this._config.touch&&this._touchSupported&&this._addTouchEventListeners()}_addTouchEventListeners(){const t=t=>{!this._pointerEvent||"pen"!==t.pointerType&&"touch"!==t.pointerType?this._pointerEvent||(this.touchStartX=t.touches[0].clientX):this.touchStartX=t.clientX},e=t=>{this.touchDeltaX=t.touches&&t.touches.length>1?0:t.touches[0].clientX-this.touchStartX},n=t=>{!this._pointerEvent||"pen"!==t.pointerType&&"touch"!==t.pointerType||(this.touchDeltaX=t.clientX-this.touchStartX),this._handleSwipe(),"hover"===this._config.pause&&(this.pause(),this.touchTimeout&&clearTimeout(this.touchTimeout),this.touchTimeout=setTimeout((t=>this.cycle(t)),500+this._config.interval))};q.find(".carousel-item img",this._element).forEach((t=>{L.on(t,"dragstart.bs.carousel",(t=>t.preventDefault()))})),this._pointerEvent?(L.on(this._element,"pointerdown.bs.carousel",(e=>t(e))),L.on(this._element,"pointerup.bs.carousel",(t=>n(t))),this._element.classList.add("pointer-event")):(L.on(this._element,"touchstart.bs.carousel",(e=>t(e))),L.on(this._element,"touchmove.bs.carousel",(t=>e(t))),L.on(this._element,"touchend.bs.carousel",(t=>n(t))))}_keydown(t){/input|textarea/i.test(t.target.tagName)||("ArrowLeft"===t.key?(t.preventDefault(),this._slide(H)):"ArrowRight"===t.key&&(t.preventDefault(),this._slide(G)))}_getItemIndex(t){return this._items=t&&t.parentNode?q.find(".carousel-item",t.parentNode):[],this._items.indexOf(t)}_getItemByOrder(t,e){const n=t===U,r=t===V,i=this._getItemIndex(e),o=this._items.length-1;if((r&&0===i||n&&i===o)&&!this._config.wrap)return e;const a=(i+(r?-1:1))%this._items.length;return-1===a?this._items[this._items.length-1]:this._items[a]}_triggerSlideEvent(t,e){const n=this._getItemIndex(t),r=this._getItemIndex(q.findOne(".active.carousel-item",this._element));return L.trigger(this._element,"slide.bs.carousel",{relatedTarget:t,direction:e,from:r,to:n})}_setActiveIndicatorElement(t){if(this._indicatorsElement){const e=q.findOne(".active",this._indicatorsElement);e.classList.remove("active"),e.removeAttribute("aria-current");const n=q.find("[data-bs-target]",this._indicatorsElement);for(let e=0;e{a.classList.remove(d,f),a.classList.add("active"),r.classList.remove("active",f,d),this._isSliding=!1,setTimeout((()=>{L.trigger(this._element,"slid.bs.carousel",{relatedTarget:a,direction:p,from:o,to:l})}),0)})),s(r,t)}else r.classList.remove("active"),a.classList.add("active"),this._isSliding=!1,L.trigger(this._element,"slid.bs.carousel",{relatedTarget:a,direction:p,from:o,to:l});c&&this.cycle()}}_directionToOrder(t){return[G,H].includes(t)?m()?t===G?V:U:t===G?U:V:t}_orderToDirection(t){return[U,V].includes(t)?m()?t===U?H:G:t===U?G:H:t}static carouselInterface(t,e){let n=v.get(t,"bs.carousel"),r={...F,...R.getDataAttributes(t)};"object"==typeof e&&(r={...r,...e});const i="string"==typeof e?e:r.slide;if(n||(n=new Y(t,r)),"number"==typeof e)n.to(e);else if("string"==typeof i){if(void 0===n[i])throw new TypeError(`No method named "${i}"`);n[i]()}else r.interval&&r.ride&&(n.pause(),n.cycle())}static jQueryInterface(t){return this.each((function(){Y.carouselInterface(this,t)}))}static dataApiClickHandler(t){const e=r(this);if(!e||!e.classList.contains("carousel"))return;const n={...R.getDataAttributes(e),...R.getDataAttributes(this)},i=this.getAttribute("data-bs-slide-to");i&&(n.interval=!1),Y.carouselInterface(e,n),i&&v.get(e,"bs.carousel").to(i),t.preventDefault()}}L.on(document,"click.bs.carousel.data-api","[data-bs-slide], [data-bs-slide-to]",Y.dataApiClickHandler),L.on(window,"load.bs.carousel.data-api",(()=>{const t=q.find('[data-bs-ride="carousel"]');for(let e=0,n=t.length;et===this._element));null!==i&&o.length&&(this._selector=i,this._triggerArray.push(e))}this._parent=this._config.parent?this._getParent():null,this._config.parent||this._addAriaAndCollapsedClass(this._element,this._triggerArray),this._config.toggle&&this.toggle()}static get Default(){return W}static get DATA_KEY(){return"bs.collapse"}toggle(){this._element.classList.contains("show")?this.hide():this.show()}show(){if(this._isTransitioning||this._element.classList.contains("show"))return;let t,e;this._parent&&(t=q.find(".show, .collapsing",this._parent).filter((t=>"string"==typeof this._config.parent?t.getAttribute("data-bs-parent")===this._config.parent:t.classList.contains("collapse"))),0===t.length&&(t=null));const n=q.findOne(this._selector);if(t){const r=t.find((t=>n!==t));if(e=r?v.get(r,"bs.collapse"):null,e&&e._isTransitioning)return}if(L.trigger(this._element,"show.bs.collapse").defaultPrevented)return;t&&t.forEach((t=>{n!==t&&K.collapseInterface(t,"hide"),e||v.set(t,"bs.collapse",null)}));const r=this._getDimension();this._element.classList.remove("collapse"),this._element.classList.add("collapsing"),this._element.style[r]=0,this._triggerArray.length&&this._triggerArray.forEach((t=>{t.classList.remove("collapsed"),t.setAttribute("aria-expanded",!0)})),this.setTransitioning(!0);const o="scroll"+(r[0].toUpperCase()+r.slice(1)),a=i(this._element);L.one(this._element,"transitionend",(()=>{this._element.classList.remove("collapsing"),this._element.classList.add("collapse","show"),this._element.style[r]="",this.setTransitioning(!1),L.trigger(this._element,"shown.bs.collapse")})),s(this._element,a),this._element.style[r]=this._element[o]+"px"}hide(){if(this._isTransitioning||!this._element.classList.contains("show"))return;if(L.trigger(this._element,"hide.bs.collapse").defaultPrevented)return;const t=this._getDimension();this._element.style[t]=this._element.getBoundingClientRect()[t]+"px",h(this._element),this._element.classList.add("collapsing"),this._element.classList.remove("collapse","show");const e=this._triggerArray.length;if(e>0)for(let t=0;t{this.setTransitioning(!1),this._element.classList.remove("collapsing"),this._element.classList.add("collapse"),L.trigger(this._element,"hidden.bs.collapse")})),s(this._element,n)}setTransitioning(t){this._isTransitioning=t}dispose(){super.dispose(),this._config=null,this._parent=null,this._triggerArray=null,this._isTransitioning=null}_getConfig(t){return(t={...W,...t}).toggle=Boolean(t.toggle),l("collapse",t,$),t}_getDimension(){return this._element.classList.contains("width")?"width":"height"}_getParent(){let{parent:t}=this._config;a(t)?void 0===t.jquery&&void 0===t[0]||(t=t[0]):t=q.findOne(t);const e=`[data-bs-toggle="collapse"][data-bs-parent="${t}"]`;return q.find(e,t).forEach((t=>{const e=r(t);this._addAriaAndCollapsedClass(e,[t])})),t}_addAriaAndCollapsedClass(t,e){if(!t||!e.length)return;const n=t.classList.contains("show");e.forEach((t=>{n?t.classList.remove("collapsed"):t.classList.add("collapsed"),t.setAttribute("aria-expanded",n)}))}static collapseInterface(t,e){let n=v.get(t,"bs.collapse");const r={...W,...R.getDataAttributes(t),..."object"==typeof e&&e?e:{}};if(!n&&r.toggle&&"string"==typeof e&&/show|hide/.test(e)&&(r.toggle=!1),n||(n=new K(t,r)),"string"==typeof e){if(void 0===n[e])throw new TypeError(`No method named "${e}"`);n[e]()}}static jQueryInterface(t){return this.each((function(){K.collapseInterface(this,t)}))}}L.on(document,"click.bs.collapse.data-api",'[data-bs-toggle="collapse"]',(function(t){("A"===t.target.tagName||t.delegateTarget&&"A"===t.delegateTarget.tagName)&&t.preventDefault();const e=R.getDataAttributes(this),r=n(this);q.find(r).forEach((t=>{const n=v.get(t,"bs.collapse");let r;n?(null===n._parent&&"string"==typeof e.parent&&(n._config.parent=e.parent,n._parent=n._getParent()),r="toggle"):r=e,K.collapseInterface(t,r)}))})),g("collapse",K);var X="top",Q="bottom",Z="right",J="left",tt=[X,Q,Z,J],et=tt.reduce((function(t,e){return t.concat([e+"-start",e+"-end"])}),[]),nt=[].concat(tt,["auto"]).reduce((function(t,e){return t.concat([e,e+"-start",e+"-end"])}),[]),rt=["beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite"];function it(t){return t?(t.nodeName||"").toLowerCase():null}function ot(t){if(null==t)return window;if("[object Window]"!==t.toString()){var e=t.ownerDocument;return e&&e.defaultView||window}return t}function at(t){return t instanceof ot(t).Element||t instanceof Element}function st(t){return t instanceof ot(t).HTMLElement||t instanceof HTMLElement}function lt(t){return"undefined"!=typeof ShadowRoot&&(t instanceof ot(t).ShadowRoot||t instanceof ShadowRoot)}var ct={name:"applyStyles",enabled:!0,phase:"write",fn:function(t){var e=t.state;Object.keys(e.elements).forEach((function(t){var n=e.styles[t]||{},r=e.attributes[t]||{},i=e.elements[t];st(i)&&it(i)&&(Object.assign(i.style,n),Object.keys(r).forEach((function(t){var e=r[t];!1===e?i.removeAttribute(t):i.setAttribute(t,!0===e?"":e)})))}))},effect:function(t){var e=t.state,n={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,n.popper),e.styles=n,e.elements.arrow&&Object.assign(e.elements.arrow.style,n.arrow),function(){Object.keys(e.elements).forEach((function(t){var r=e.elements[t],i=e.attributes[t]||{},o=Object.keys(e.styles.hasOwnProperty(t)?e.styles[t]:n[t]).reduce((function(t,e){return t[e]="",t}),{});st(r)&&it(r)&&(Object.assign(r.style,o),Object.keys(i).forEach((function(t){r.removeAttribute(t)})))}))}},requires:["computeStyles"]};function ut(t){return t.split("-")[0]}function dt(t){var e=t.getBoundingClientRect();return{width:e.width,height:e.height,top:e.top,right:e.right,bottom:e.bottom,left:e.left,x:e.left,y:e.top}}function ft(t){var e=dt(t),n=t.offsetWidth,r=t.offsetHeight;return Math.abs(e.width-n)<=1&&(n=e.width),Math.abs(e.height-r)<=1&&(r=e.height),{x:t.offsetLeft,y:t.offsetTop,width:n,height:r}}function ht(t,e){var n=e.getRootNode&&e.getRootNode();if(t.contains(e))return!0;if(n&<(n)){var r=e;do{if(r&&t.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function pt(t){return ot(t).getComputedStyle(t)}function mt(t){return["table","td","th"].indexOf(it(t))>=0}function gt(t){return((at(t)?t.ownerDocument:t.document)||window.document).documentElement}function bt(t){return"html"===it(t)?t:t.assignedSlot||t.parentNode||(lt(t)?t.host:null)||gt(t)}function vt(t){return st(t)&&"fixed"!==pt(t).position?t.offsetParent:null}function yt(t){for(var e=ot(t),n=vt(t);n&&mt(n)&&"static"===pt(n).position;)n=vt(n);return n&&("html"===it(n)||"body"===it(n)&&"static"===pt(n).position)?e:n||function(t){for(var e=-1!==navigator.userAgent.toLowerCase().indexOf("firefox"),n=bt(t);st(n)&&["html","body"].indexOf(it(n))<0;){var r=pt(n);if("none"!==r.transform||"none"!==r.perspective||"paint"===r.contain||-1!==["transform","perspective"].indexOf(r.willChange)||e&&"filter"===r.willChange||e&&r.filter&&"none"!==r.filter)return n;n=n.parentNode}return null}(t)||e}function _t(t){return["top","bottom"].indexOf(t)>=0?"x":"y"}var wt=Math.max,xt=Math.min,Tt=Math.round;function At(t,e,n){return wt(t,xt(e,n))}function Et(t){return Object.assign({},{top:0,right:0,bottom:0,left:0},t)}function Mt(t,e){return e.reduce((function(e,n){return e[n]=t,e}),{})}var St={name:"arrow",enabled:!0,phase:"main",fn:function(t){var e,n=t.state,r=t.name,i=t.options,o=n.elements.arrow,a=n.modifiersData.popperOffsets,s=ut(n.placement),l=_t(s),c=[J,Z].indexOf(s)>=0?"height":"width";if(o&&a){var u=function(t,e){return Et("number"!=typeof(t="function"==typeof t?t(Object.assign({},e.rects,{placement:e.placement})):t)?t:Mt(t,tt))}(i.padding,n),d=ft(o),f="y"===l?X:J,h="y"===l?Q:Z,p=n.rects.reference[c]+n.rects.reference[l]-a[l]-n.rects.popper[c],m=a[l]-n.rects.reference[l],g=yt(o),b=g?"y"===l?g.clientHeight||0:g.clientWidth||0:0,v=p/2-m/2,y=u[f],_=b-d[c]-u[h],w=b/2-d[c]/2+v,x=At(y,w,_),T=l;n.modifiersData[r]=((e={})[T]=x,e.centerOffset=x-w,e)}},effect:function(t){var e=t.state,n=t.options.element,r=void 0===n?"[data-popper-arrow]":n;null!=r&&("string"!=typeof r||(r=e.elements.popper.querySelector(r)))&&ht(e.elements.popper,r)&&(e.elements.arrow=r)},requires:["popperOffsets"],requiresIfExists:["preventOverflow"]},Nt={top:"auto",right:"auto",bottom:"auto",left:"auto"};function kt(t){var e,n=t.popper,r=t.popperRect,i=t.placement,o=t.offsets,a=t.position,s=t.gpuAcceleration,l=t.adaptive,c=t.roundOffsets,u=!0===c?function(t){var e=t.x,n=t.y,r=window.devicePixelRatio||1;return{x:Tt(Tt(e*r)/r)||0,y:Tt(Tt(n*r)/r)||0}}(o):"function"==typeof c?c(o):o,d=u.x,f=void 0===d?0:d,h=u.y,p=void 0===h?0:h,m=o.hasOwnProperty("x"),g=o.hasOwnProperty("y"),b=J,v=X,y=window;if(l){var _=yt(n),w="clientHeight",x="clientWidth";_===ot(n)&&"static"!==pt(_=gt(n)).position&&(w="scrollHeight",x="scrollWidth"),_=_,i===X&&(v=Q,p-=_[w]-r.height,p*=s?1:-1),i===J&&(b=Z,f-=_[x]-r.width,f*=s?1:-1)}var T,A=Object.assign({position:a},l&&Nt);return s?Object.assign({},A,((T={})[v]=g?"0":"",T[b]=m?"0":"",T.transform=(y.devicePixelRatio||1)<2?"translate("+f+"px, "+p+"px)":"translate3d("+f+"px, "+p+"px, 0)",T)):Object.assign({},A,((e={})[v]=g?p+"px":"",e[b]=m?f+"px":"",e.transform="",e))}var Ct={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:function(t){var e=t.state,n=t.options,r=n.gpuAcceleration,i=void 0===r||r,o=n.adaptive,a=void 0===o||o,s=n.roundOffsets,l=void 0===s||s,c={placement:ut(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:i};null!=e.modifiersData.popperOffsets&&(e.styles.popper=Object.assign({},e.styles.popper,kt(Object.assign({},c,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:a,roundOffsets:l})))),null!=e.modifiersData.arrow&&(e.styles.arrow=Object.assign({},e.styles.arrow,kt(Object.assign({},c,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})},data:{}},Dt={passive:!0},Lt={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:function(t){var e=t.state,n=t.instance,r=t.options,i=r.scroll,o=void 0===i||i,a=r.resize,s=void 0===a||a,l=ot(e.elements.popper),c=[].concat(e.scrollParents.reference,e.scrollParents.popper);return o&&c.forEach((function(t){t.addEventListener("scroll",n.update,Dt)})),s&&l.addEventListener("resize",n.update,Dt),function(){o&&c.forEach((function(t){t.removeEventListener("scroll",n.update,Dt)})),s&&l.removeEventListener("resize",n.update,Dt)}},data:{}},Ot={left:"right",right:"left",bottom:"top",top:"bottom"};function It(t){return t.replace(/left|right|bottom|top/g,(function(t){return Ot[t]}))}var Bt={start:"end",end:"start"};function Pt(t){return t.replace(/start|end/g,(function(t){return Bt[t]}))}function jt(t){var e=ot(t);return{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function Rt(t){return dt(gt(t)).left+jt(t).scrollLeft}function qt(t){var e=pt(t),n=e.overflow,r=e.overflowX,i=e.overflowY;return/auto|scroll|overlay|hidden/.test(n+i+r)}function Ft(t,e){var n;void 0===e&&(e=[]);var r=function t(e){return["html","body","#document"].indexOf(it(e))>=0?e.ownerDocument.body:st(e)&&qt(e)?e:t(bt(e))}(t),i=r===(null==(n=t.ownerDocument)?void 0:n.body),o=ot(r),a=i?[o].concat(o.visualViewport||[],qt(r)?r:[]):r,s=e.concat(a);return i?s:s.concat(Ft(bt(a)))}function zt(t){return Object.assign({},t,{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height})}function Ut(t,e){return"viewport"===e?zt(function(t){var e=ot(t),n=gt(t),r=e.visualViewport,i=n.clientWidth,o=n.clientHeight,a=0,s=0;return r&&(i=r.width,o=r.height,/^((?!chrome|android).)*safari/i.test(navigator.userAgent)||(a=r.offsetLeft,s=r.offsetTop)),{width:i,height:o,x:a+Rt(t),y:s}}(t)):st(e)?function(t){var e=dt(t);return e.top=e.top+t.clientTop,e.left=e.left+t.clientLeft,e.bottom=e.top+t.clientHeight,e.right=e.left+t.clientWidth,e.width=t.clientWidth,e.height=t.clientHeight,e.x=e.left,e.y=e.top,e}(e):zt(function(t){var e,n=gt(t),r=jt(t),i=null==(e=t.ownerDocument)?void 0:e.body,o=wt(n.scrollWidth,n.clientWidth,i?i.scrollWidth:0,i?i.clientWidth:0),a=wt(n.scrollHeight,n.clientHeight,i?i.scrollHeight:0,i?i.clientHeight:0),s=-r.scrollLeft+Rt(t),l=-r.scrollTop;return"rtl"===pt(i||n).direction&&(s+=wt(n.clientWidth,i?i.clientWidth:0)-o),{width:o,height:a,x:s,y:l}}(gt(t)))}function Vt(t){return t.split("-")[1]}function Ht(t){var e,n=t.reference,r=t.element,i=t.placement,o=i?ut(i):null,a=i?Vt(i):null,s=n.x+n.width/2-r.width/2,l=n.y+n.height/2-r.height/2;switch(o){case X:e={x:s,y:n.y-r.height};break;case Q:e={x:s,y:n.y+n.height};break;case Z:e={x:n.x+n.width,y:l};break;case J:e={x:n.x-r.width,y:l};break;default:e={x:n.x,y:n.y}}var c=o?_t(o):null;if(null!=c){var u="y"===c?"height":"width";switch(a){case"start":e[c]=e[c]-(n[u]/2-r[u]/2);break;case"end":e[c]=e[c]+(n[u]/2-r[u]/2)}}return e}function Gt(t,e){void 0===e&&(e={});var n=e,r=n.placement,i=void 0===r?t.placement:r,o=n.boundary,a=void 0===o?"clippingParents":o,s=n.rootBoundary,l=void 0===s?"viewport":s,c=n.elementContext,u=void 0===c?"popper":c,d=n.altBoundary,f=void 0!==d&&d,h=n.padding,p=void 0===h?0:h,m=Et("number"!=typeof p?p:Mt(p,tt)),g="popper"===u?"reference":"popper",b=t.elements.reference,v=t.rects.popper,y=t.elements[f?g:u],_=function(t,e,n){var r="clippingParents"===e?function(t){var e=Ft(bt(t)),n=["absolute","fixed"].indexOf(pt(t).position)>=0&&st(t)?yt(t):t;return at(n)?e.filter((function(t){return at(t)&&ht(t,n)&&"body"!==it(t)})):[]}(t):[].concat(e),i=[].concat(r,[n]),o=i[0],a=i.reduce((function(e,n){var r=Ut(t,n);return e.top=wt(r.top,e.top),e.right=xt(r.right,e.right),e.bottom=xt(r.bottom,e.bottom),e.left=wt(r.left,e.left),e}),Ut(t,o));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}(at(y)?y:y.contextElement||gt(t.elements.popper),a,l),w=dt(b),x=Ht({reference:w,element:v,strategy:"absolute",placement:i}),T=zt(Object.assign({},v,x)),A="popper"===u?T:w,E={top:_.top-A.top+m.top,bottom:A.bottom-_.bottom+m.bottom,left:_.left-A.left+m.left,right:A.right-_.right+m.right},M=t.modifiersData.offset;if("popper"===u&&M){var S=M[i];Object.keys(E).forEach((function(t){var e=[Z,Q].indexOf(t)>=0?1:-1,n=[X,Q].indexOf(t)>=0?"y":"x";E[t]+=S[n]*e}))}return E}var Yt={name:"flip",enabled:!0,phase:"main",fn:function(t){var e=t.state,n=t.options,r=t.name;if(!e.modifiersData[r]._skip){for(var i=n.mainAxis,o=void 0===i||i,a=n.altAxis,s=void 0===a||a,l=n.fallbackPlacements,c=n.padding,u=n.boundary,d=n.rootBoundary,f=n.altBoundary,h=n.flipVariations,p=void 0===h||h,m=n.allowedAutoPlacements,g=e.options.placement,b=ut(g),v=l||(b!==g&&p?function(t){if("auto"===ut(t))return[];var e=It(t);return[Pt(t),e,Pt(e)]}(g):[It(g)]),y=[g].concat(v).reduce((function(t,n){return t.concat("auto"===ut(n)?function(t,e){void 0===e&&(e={});var n=e,r=n.placement,i=n.boundary,o=n.rootBoundary,a=n.padding,s=n.flipVariations,l=n.allowedAutoPlacements,c=void 0===l?nt:l,u=Vt(r),d=u?s?et:et.filter((function(t){return Vt(t)===u})):tt,f=d.filter((function(t){return c.indexOf(t)>=0}));0===f.length&&(f=d);var h=f.reduce((function(e,n){return e[n]=Gt(t,{placement:n,boundary:i,rootBoundary:o,padding:a})[ut(n)],e}),{});return Object.keys(h).sort((function(t,e){return h[t]-h[e]}))}(e,{placement:n,boundary:u,rootBoundary:d,padding:c,flipVariations:p,allowedAutoPlacements:m}):n)}),[]),_=e.rects.reference,w=e.rects.popper,x=new Map,T=!0,A=y[0],E=0;E=0,C=k?"width":"height",D=Gt(e,{placement:M,boundary:u,rootBoundary:d,altBoundary:f,padding:c}),L=k?N?Z:J:N?Q:X;_[C]>w[C]&&(L=It(L));var O=It(L),I=[];if(o&&I.push(D[S]<=0),s&&I.push(D[L]<=0,D[O]<=0),I.every((function(t){return t}))){A=M,T=!1;break}x.set(M,I)}if(T)for(var B=function(t){var e=y.find((function(e){var n=x.get(e);if(n)return n.slice(0,t).every((function(t){return t}))}));if(e)return A=e,"break"},P=p?3:1;P>0&&"break"!==B(P);P--);e.placement!==A&&(e.modifiersData[r]._skip=!0,e.placement=A,e.reset=!0)}},requiresIfExists:["offset"],data:{_skip:!1}};function Wt(t,e,n){return void 0===n&&(n={x:0,y:0}),{top:t.top-e.height-n.y,right:t.right-e.width+n.x,bottom:t.bottom-e.height+n.y,left:t.left-e.width-n.x}}function $t(t){return[X,Z,Q,J].some((function(e){return t[e]>=0}))}var Kt={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:function(t){var e=t.state,n=t.name,r=e.rects.reference,i=e.rects.popper,o=e.modifiersData.preventOverflow,a=Gt(e,{elementContext:"reference"}),s=Gt(e,{altBoundary:!0}),l=Wt(a,r),c=Wt(s,i,o),u=$t(l),d=$t(c);e.modifiersData[n]={referenceClippingOffsets:l,popperEscapeOffsets:c,isReferenceHidden:u,hasPopperEscaped:d},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":u,"data-popper-escaped":d})}},Xt={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:function(t){var e=t.state,n=t.options,r=t.name,i=n.offset,o=void 0===i?[0,0]:i,a=nt.reduce((function(t,n){return t[n]=function(t,e,n){var r=ut(t),i=[J,X].indexOf(r)>=0?-1:1,o="function"==typeof n?n(Object.assign({},e,{placement:t})):n,a=o[0],s=o[1];return a=a||0,s=(s||0)*i,[J,Z].indexOf(r)>=0?{x:s,y:a}:{x:a,y:s}}(n,e.rects,o),t}),{}),s=a[e.placement],l=s.x,c=s.y;null!=e.modifiersData.popperOffsets&&(e.modifiersData.popperOffsets.x+=l,e.modifiersData.popperOffsets.y+=c),e.modifiersData[r]=a}},Qt={name:"popperOffsets",enabled:!0,phase:"read",fn:function(t){var e=t.state,n=t.name;e.modifiersData[n]=Ht({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})},data:{}},Zt={name:"preventOverflow",enabled:!0,phase:"main",fn:function(t){var e=t.state,n=t.options,r=t.name,i=n.mainAxis,o=void 0===i||i,a=n.altAxis,s=void 0!==a&&a,l=n.boundary,c=n.rootBoundary,u=n.altBoundary,d=n.padding,f=n.tether,h=void 0===f||f,p=n.tetherOffset,m=void 0===p?0:p,g=Gt(e,{boundary:l,rootBoundary:c,padding:d,altBoundary:u}),b=ut(e.placement),v=Vt(e.placement),y=!v,_=_t(b),w="x"===_?"y":"x",x=e.modifiersData.popperOffsets,T=e.rects.reference,A=e.rects.popper,E="function"==typeof m?m(Object.assign({},e.rects,{placement:e.placement})):m,M={x:0,y:0};if(x){if(o||s){var S="y"===_?X:J,N="y"===_?Q:Z,k="y"===_?"height":"width",C=x[_],D=x[_]+g[S],L=x[_]-g[N],O=h?-A[k]/2:0,I="start"===v?T[k]:A[k],B="start"===v?-A[k]:-T[k],P=e.elements.arrow,j=h&&P?ft(P):{width:0,height:0},R=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:{top:0,right:0,bottom:0,left:0},q=R[S],F=R[N],z=At(0,T[k],j[k]),U=y?T[k]/2-O-z-q-E:I-z-q-E,V=y?-T[k]/2+O+z+F+E:B+z+F+E,H=e.elements.arrow&&yt(e.elements.arrow),G=H?"y"===_?H.clientTop||0:H.clientLeft||0:0,Y=e.modifiersData.offset?e.modifiersData.offset[e.placement][_]:0,W=x[_]+U-Y-G,$=x[_]+V-Y;if(o){var K=At(h?xt(D,W):D,C,h?wt(L,$):L);x[_]=K,M[_]=K-C}if(s){var tt="x"===_?X:J,et="x"===_?Q:Z,nt=x[w],rt=nt+g[tt],it=nt-g[et],ot=At(h?xt(rt,W):rt,nt,h?wt(it,$):it);x[w]=ot,M[w]=ot-nt}}e.modifiersData[r]=M}},requiresIfExists:["offset"]};function Jt(t,e,n){void 0===n&&(n=!1);var r,i,o=gt(e),a=dt(t),s=st(e),l={scrollLeft:0,scrollTop:0},c={x:0,y:0};return(s||!s&&!n)&&(("body"!==it(e)||qt(o))&&(l=(r=e)!==ot(r)&&st(r)?{scrollLeft:(i=r).scrollLeft,scrollTop:i.scrollTop}:jt(r)),st(e)?((c=dt(e)).x+=e.clientLeft,c.y+=e.clientTop):o&&(c.x=Rt(o))),{x:a.left+l.scrollLeft-c.x,y:a.top+l.scrollTop-c.y,width:a.width,height:a.height}}var te={placement:"bottom",modifiers:[],strategy:"absolute"};function ee(){for(var t=arguments.length,e=new Array(t),n=0;n"applyStyles"===t.name&&!1===t.enabled));this._popper=oe(e,this._menu,n),r&&R.setDataAttribute(this._menu,"popper","static")}"ontouchstart"in document.documentElement&&!t.closest(".navbar-nav")&&[].concat(...document.body.children).forEach((t=>L.on(t,"mouseover",null,(function(){})))),this._element.focus(),this._element.setAttribute("aria-expanded",!0),this._menu.classList.toggle("show"),this._element.classList.toggle("show"),L.trigger(this._element,"shown.bs.dropdown",e)}}hide(){if(this._element.disabled||this._element.classList.contains("disabled")||!this._menu.classList.contains("show"))return;const t={relatedTarget:this._element};L.trigger(this._element,"hide.bs.dropdown",t).defaultPrevented||(this._popper&&this._popper.destroy(),this._menu.classList.toggle("show"),this._element.classList.toggle("show"),R.removeDataAttribute(this._menu,"popper"),L.trigger(this._element,"hidden.bs.dropdown",t))}dispose(){L.off(this._element,".bs.dropdown"),this._menu=null,this._popper&&(this._popper.destroy(),this._popper=null),super.dispose()}update(){this._inNavbar=this._detectNavbar(),this._popper&&this._popper.update()}_addEventListeners(){L.on(this._element,"click.bs.dropdown",(t=>{t.preventDefault(),this.toggle()}))}_getConfig(t){if(t={...this.constructor.Default,...R.getDataAttributes(this._element),...t},l("dropdown",t,this.constructor.DefaultType),"object"==typeof t.reference&&!a(t.reference)&&"function"!=typeof t.reference.getBoundingClientRect)throw new TypeError("dropdown".toUpperCase()+': Option "reference" provided type "object" without a required "getBoundingClientRect" method.');return t}_getMenuElement(){return q.next(this._element,".dropdown-menu")[0]}_getPlacement(){const t=this._element.parentNode;if(t.classList.contains("dropend"))return fe;if(t.classList.contains("dropstart"))return he;const e="end"===getComputedStyle(this._menu).getPropertyValue("--bs-position").trim();return t.classList.contains("dropup")?e?ce:le:e?de:ue}_detectNavbar(){return null!==this._element.closest(".navbar")}_getOffset(){const{offset:t}=this._config;return"string"==typeof t?t.split(",").map((t=>Number.parseInt(t,10))):"function"==typeof t?e=>t(e,this._element):t}_getPopperConfig(){const t={placement:this._getPlacement(),modifiers:[{name:"preventOverflow",options:{boundary:this._config.boundary}},{name:"offset",options:{offset:this._getOffset()}}]};return"static"===this._config.display&&(t.modifiers=[{name:"applyStyles",enabled:!1}]),{...t,..."function"==typeof this._config.popperConfig?this._config.popperConfig(t):this._config.popperConfig}}static dropdownInterface(t,e){let n=v.get(t,"bs.dropdown");if(n||(n=new ge(t,"object"==typeof e?e:null)),"string"==typeof e){if(void 0===n[e])throw new TypeError(`No method named "${e}"`);n[e]()}}static jQueryInterface(t){return this.each((function(){ge.dropdownInterface(this,t)}))}static clearMenus(t){if(t){if(2===t.button||"keyup"===t.type&&"Tab"!==t.key)return;if(/input|select|textarea|form/i.test(t.target.tagName))return}const e=q.find('[data-bs-toggle="dropdown"]');for(let n=0,r=e.length;nt.composedPath().includes(e))))continue;if("keyup"===t.type&&"Tab"===t.key&&o.contains(t.target))continue}L.trigger(e[n],"hide.bs.dropdown",i).defaultPrevented||("ontouchstart"in document.documentElement&&[].concat(...document.body.children).forEach((t=>L.off(t,"mouseover",null,(function(){})))),e[n].setAttribute("aria-expanded","false"),r._popper&&r._popper.destroy(),o.classList.remove("show"),e[n].classList.remove("show"),R.removeDataAttribute(o,"popper"),L.trigger(e[n],"hidden.bs.dropdown",i))}}}static getParentFromElement(t){return r(t)||t.parentNode}static dataApiKeydownHandler(t){if(/input|textarea/i.test(t.target.tagName)?"Space"===t.key||"Escape"!==t.key&&("ArrowDown"!==t.key&&"ArrowUp"!==t.key||t.target.closest(".dropdown-menu")):!se.test(t.key))return;if(t.preventDefault(),t.stopPropagation(),this.disabled||this.classList.contains("disabled"))return;const e=ge.getParentFromElement(this),n=this.classList.contains("show");if("Escape"===t.key)return(this.matches('[data-bs-toggle="dropdown"]')?this:q.prev(this,'[data-bs-toggle="dropdown"]')[0]).focus(),void ge.clearMenus();if(!n&&("ArrowUp"===t.key||"ArrowDown"===t.key))return void(this.matches('[data-bs-toggle="dropdown"]')?this:q.prev(this,'[data-bs-toggle="dropdown"]')[0]).click();if(!n||"Space"===t.key)return void ge.clearMenus();const r=q.find(".dropdown-menu .dropdown-item:not(.disabled):not(:disabled)",e).filter(c);if(!r.length)return;let i=r.indexOf(t.target);"ArrowUp"===t.key&&i>0&&i--,"ArrowDown"===t.key&&ithis.hide(t))),L.on(this._dialog,"mousedown.dismiss.bs.modal",(()=>{L.one(this._element,"mouseup.dismiss.bs.modal",(t=>{t.target===this._element&&(this._ignoreBackdropClick=!0)}))})),this._showBackdrop((()=>this._showElement(t))))}hide(t){if(t&&t.preventDefault(),!this._isShown||this._isTransitioning)return;if(L.trigger(this._element,"hide.bs.modal").defaultPrevented)return;this._isShown=!1;const e=this._isAnimated();if(e&&(this._isTransitioning=!0),this._setEscapeEvent(),this._setResizeEvent(),L.off(document,"focusin.bs.modal"),this._element.classList.remove("show"),L.off(this._element,"click.dismiss.bs.modal"),L.off(this._dialog,"mousedown.dismiss.bs.modal"),e){const t=i(this._element);L.one(this._element,"transitionend",(t=>this._hideModal(t))),s(this._element,t)}else this._hideModal()}dispose(){[window,this._element,this._dialog].forEach((t=>L.off(t,".bs.modal"))),super.dispose(),L.off(document,"focusin.bs.modal"),this._config=null,this._dialog=null,this._backdrop=null,this._isShown=null,this._isBodyOverflowing=null,this._ignoreBackdropClick=null,this._isTransitioning=null,this._scrollbarWidth=null}handleUpdate(){this._adjustDialog()}_getConfig(t){return t={...be,...t},l("modal",t,ve),t}_showElement(t){const e=this._isAnimated(),n=q.findOne(".modal-body",this._dialog);this._element.parentNode&&this._element.parentNode.nodeType===Node.ELEMENT_NODE||document.body.appendChild(this._element),this._element.style.display="block",this._element.removeAttribute("aria-hidden"),this._element.setAttribute("aria-modal",!0),this._element.setAttribute("role","dialog"),this._element.scrollTop=0,n&&(n.scrollTop=0),e&&h(this._element),this._element.classList.add("show"),this._config.focus&&this._enforceFocus();const r=()=>{this._config.focus&&this._element.focus(),this._isTransitioning=!1,L.trigger(this._element,"shown.bs.modal",{relatedTarget:t})};if(e){const t=i(this._dialog);L.one(this._dialog,"transitionend",r),s(this._dialog,t)}else r()}_enforceFocus(){L.off(document,"focusin.bs.modal"),L.on(document,"focusin.bs.modal",(t=>{document===t.target||this._element===t.target||this._element.contains(t.target)||this._element.focus()}))}_setEscapeEvent(){this._isShown?L.on(this._element,"keydown.dismiss.bs.modal",(t=>{this._config.keyboard&&"Escape"===t.key?(t.preventDefault(),this.hide()):this._config.keyboard||"Escape"!==t.key||this._triggerBackdropTransition()})):L.off(this._element,"keydown.dismiss.bs.modal")}_setResizeEvent(){this._isShown?L.on(window,"resize.bs.modal",(()=>this._adjustDialog())):L.off(window,"resize.bs.modal")}_hideModal(){this._element.style.display="none",this._element.setAttribute("aria-hidden",!0),this._element.removeAttribute("aria-modal"),this._element.removeAttribute("role"),this._isTransitioning=!1,this._showBackdrop((()=>{document.body.classList.remove("modal-open"),this._resetAdjustments(),this._resetScrollbar(),L.trigger(this._element,"hidden.bs.modal")}))}_removeBackdrop(){this._backdrop.parentNode.removeChild(this._backdrop),this._backdrop=null}_showBackdrop(t){const e=this._isAnimated();if(this._isShown&&this._config.backdrop){if(this._backdrop=document.createElement("div"),this._backdrop.className="modal-backdrop",e&&this._backdrop.classList.add("fade"),document.body.appendChild(this._backdrop),L.on(this._element,"click.dismiss.bs.modal",(t=>{this._ignoreBackdropClick?this._ignoreBackdropClick=!1:t.target===t.currentTarget&&("static"===this._config.backdrop?this._triggerBackdropTransition():this.hide())})),e&&h(this._backdrop),this._backdrop.classList.add("show"),!e)return void t();const n=i(this._backdrop);L.one(this._backdrop,"transitionend",t),s(this._backdrop,n)}else if(!this._isShown&&this._backdrop){this._backdrop.classList.remove("show");const n=()=>{this._removeBackdrop(),t()};if(e){const t=i(this._backdrop);L.one(this._backdrop,"transitionend",n),s(this._backdrop,t)}else n()}else t()}_isAnimated(){return this._element.classList.contains("fade")}_triggerBackdropTransition(){if(L.trigger(this._element,"hidePrevented.bs.modal").defaultPrevented)return;const t=this._element.scrollHeight>document.documentElement.clientHeight;t||(this._element.style.overflowY="hidden"),this._element.classList.add("modal-static");const e=i(this._dialog);L.off(this._element,"transitionend"),L.one(this._element,"transitionend",(()=>{this._element.classList.remove("modal-static"),t||(L.one(this._element,"transitionend",(()=>{this._element.style.overflowY=""})),s(this._element,e))})),s(this._element,e),this._element.focus()}_adjustDialog(){const t=this._element.scrollHeight>document.documentElement.clientHeight;(!this._isBodyOverflowing&&t&&!m()||this._isBodyOverflowing&&!t&&m())&&(this._element.style.paddingLeft=this._scrollbarWidth+"px"),(this._isBodyOverflowing&&!t&&!m()||!this._isBodyOverflowing&&t&&m())&&(this._element.style.paddingRight=this._scrollbarWidth+"px")}_resetAdjustments(){this._element.style.paddingLeft="",this._element.style.paddingRight=""}_checkScrollbar(){const t=document.body.getBoundingClientRect();this._isBodyOverflowing=Math.round(t.left+t.right)t+this._scrollbarWidth)),this._setElementAttributes(".sticky-top","marginRight",(t=>t-this._scrollbarWidth)),this._setElementAttributes("body","paddingRight",(t=>t+this._scrollbarWidth))),document.body.classList.add("modal-open")}_setElementAttributes(t,e,n){q.find(t).forEach((t=>{if(t!==document.body&&window.innerWidth>t.clientWidth+this._scrollbarWidth)return;const r=t.style[e],i=window.getComputedStyle(t)[e];R.setDataAttribute(t,e,r),t.style[e]=n(Number.parseFloat(i))+"px"}))}_resetScrollbar(){this._resetElementAttributes(".fixed-top, .fixed-bottom, .is-fixed, .sticky-top","paddingRight"),this._resetElementAttributes(".sticky-top","marginRight"),this._resetElementAttributes("body","paddingRight")}_resetElementAttributes(t,e){q.find(t).forEach((t=>{const n=R.getDataAttribute(t,e);void 0===n&&t===document.body?t.style[e]="":(R.removeDataAttribute(t,e),t.style[e]=n)}))}_getScrollbarWidth(){const t=document.createElement("div");t.className="modal-scrollbar-measure",document.body.appendChild(t);const e=t.getBoundingClientRect().width-t.clientWidth;return document.body.removeChild(t),e}static jQueryInterface(t,e){return this.each((function(){let n=v.get(this,"bs.modal");const r={...be,...R.getDataAttributes(this),..."object"==typeof t&&t?t:{}};if(n||(n=new ye(this,r)),"string"==typeof t){if(void 0===n[t])throw new TypeError(`No method named "${t}"`);n[t](e)}}))}}L.on(document,"click.bs.modal.data-api",'[data-bs-toggle="modal"]',(function(t){const e=r(this);"A"!==this.tagName&&"AREA"!==this.tagName||t.preventDefault(),L.one(e,"show.bs.modal",(t=>{t.defaultPrevented||L.one(e,"hidden.bs.modal",(()=>{c(this)&&this.focus()}))}));let n=v.get(e,"bs.modal");if(!n){const t={...R.getDataAttributes(e),...R.getDataAttributes(this)};n=new ye(e,t)}n.toggle(this)})),g("modal",ye);const _e=()=>{const t=document.documentElement.clientWidth;return Math.abs(window.innerWidth-t)},we=(t,e,n)=>{const r=_e();q.find(t).forEach((t=>{if(t!==document.body&&window.innerWidth>t.clientWidth+r)return;const i=t.style[e],o=window.getComputedStyle(t)[e];R.setDataAttribute(t,e,i),t.style[e]=n(Number.parseFloat(o))+"px"}))},xe=(t,e)=>{q.find(t).forEach((t=>{const n=R.getDataAttribute(t,e);void 0===n&&t===document.body?t.style.removeProperty(e):(R.removeDataAttribute(t,e),t.style[e]=n)}))},Te={backdrop:!0,keyboard:!0,scroll:!1},Ae={backdrop:"boolean",keyboard:"boolean",scroll:"boolean"};class Ee extends O{constructor(t,e){super(t),this._config=this._getConfig(e),this._isShown=!1,this._addEventListeners()}static get Default(){return Te}static get DATA_KEY(){return"bs.offcanvas"}toggle(t){return this._isShown?this.hide():this.show(t)}show(t){this._isShown||L.trigger(this._element,"show.bs.offcanvas",{relatedTarget:t}).defaultPrevented||(this._isShown=!0,this._element.style.visibility="visible",this._config.backdrop&&document.body.classList.add("offcanvas-backdrop"),this._config.scroll||((t=_e())=>{document.body.style.overflow="hidden",we(".fixed-top, .fixed-bottom, .is-fixed","paddingRight",(e=>e+t)),we(".sticky-top","marginRight",(e=>e-t)),we("body","paddingRight",(e=>e+t))})(),this._element.classList.add("offcanvas-toggling"),this._element.removeAttribute("aria-hidden"),this._element.setAttribute("aria-modal",!0),this._element.setAttribute("role","dialog"),this._element.classList.add("show"),setTimeout((()=>{this._element.classList.remove("offcanvas-toggling"),L.trigger(this._element,"shown.bs.offcanvas",{relatedTarget:t}),this._enforceFocusOnElement(this._element)}),i(this._element)))}hide(){this._isShown&&(L.trigger(this._element,"hide.bs.offcanvas").defaultPrevented||(this._element.classList.add("offcanvas-toggling"),L.off(document,"focusin.bs.offcanvas"),this._element.blur(),this._isShown=!1,this._element.classList.remove("show"),setTimeout((()=>{this._element.setAttribute("aria-hidden",!0),this._element.removeAttribute("aria-modal"),this._element.removeAttribute("role"),this._element.style.visibility="hidden",this._config.backdrop&&document.body.classList.remove("offcanvas-backdrop"),this._config.scroll||(document.body.style.overflow="auto",xe(".fixed-top, .fixed-bottom, .is-fixed","paddingRight"),xe(".sticky-top","marginRight"),xe("body","paddingRight")),L.trigger(this._element,"hidden.bs.offcanvas"),this._element.classList.remove("offcanvas-toggling")}),i(this._element))))}_getConfig(t){return t={...Te,...R.getDataAttributes(this._element),..."object"==typeof t?t:{}},l("offcanvas",t,Ae),t}_enforceFocusOnElement(t){L.off(document,"focusin.bs.offcanvas"),L.on(document,"focusin.bs.offcanvas",(e=>{document===e.target||t===e.target||t.contains(e.target)||t.focus()})),t.focus()}_addEventListeners(){L.on(this._element,"click.dismiss.bs.offcanvas",'[data-bs-dismiss="offcanvas"]',(()=>this.hide())),L.on(document,"keydown",(t=>{this._config.keyboard&&"Escape"===t.key&&this.hide()})),L.on(document,"click.bs.offcanvas.data-api",(t=>{const e=q.findOne(n(t.target));this._element.contains(t.target)||e===this._element||this.hide()}))}static jQueryInterface(t){return this.each((function(){const e=v.get(this,"bs.offcanvas")||new Ee(this,"object"==typeof t?t:{});if("string"==typeof t){if(void 0===e[t]||t.startsWith("_")||"constructor"===t)throw new TypeError(`No method named "${t}"`);e[t](this)}}))}}L.on(document,"click.bs.offcanvas.data-api",'[data-bs-toggle="offcanvas"]',(function(t){const e=r(this);if(["A","AREA"].includes(this.tagName)&&t.preventDefault(),u(this))return;L.one(e,"hidden.bs.offcanvas",(()=>{c(this)&&this.focus()}));const n=q.findOne(".offcanvas.show, .offcanvas-toggling");n&&n!==e||(v.get(e,"bs.offcanvas")||new Ee(e)).toggle(this)})),L.on(window,"load.bs.offcanvas.data-api",(()=>{q.find(".offcanvas.show").forEach((t=>(v.get(t,"bs.offcanvas")||new Ee(t)).show()))})),g("offcanvas",Ee);const Me=new Set(["background","cite","href","itemtype","longdesc","poster","src","xlink:href"]),Se=/^(?:(?:https?|mailto|ftp|tel|file):|[^#&/:?]*(?:[#/?]|$))/i,Ne=/^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[\d+/a-z]+=*$/i,ke=(t,e)=>{const n=t.nodeName.toLowerCase();if(e.includes(n))return!Me.has(n)||Boolean(Se.test(t.nodeValue)||Ne.test(t.nodeValue));const r=e.filter((t=>t instanceof RegExp));for(let t=0,e=r.length;t{ke(t,s)||n.removeAttribute(t.nodeName)}))}return r.body.innerHTML}const De=new RegExp("(^|\\s)bs-tooltip\\S+","g"),Le=new Set(["sanitize","allowList","sanitizeFn"]),Oe={animation:"boolean",template:"string",title:"(string|element|function)",trigger:"string",delay:"(number|object)",html:"boolean",selector:"(string|boolean)",placement:"(string|function)",offset:"(array|string|function)",container:"(string|element|boolean)",fallbackPlacements:"array",boundary:"(string|element)",customClass:"(string|function)",sanitize:"boolean",sanitizeFn:"(null|function)",allowList:"object",popperConfig:"(null|object|function)"},Ie={AUTO:"auto",TOP:"top",RIGHT:m()?"left":"right",BOTTOM:"bottom",LEFT:m()?"right":"left"},Be={animation:!0,template:'',trigger:"hover focus",title:"",delay:0,html:!1,selector:!1,placement:"top",offset:[0,0],container:!1,fallbackPlacements:["top","right","bottom","left"],boundary:"clippingParents",customClass:"",sanitize:!0,sanitizeFn:null,allowList:{"*":["class","dir","id","lang","role",/^aria-[\w-]*$/i],a:["target","href","title","rel"],area:[],b:[],br:[],col:[],code:[],div:[],em:[],hr:[],h1:[],h2:[],h3:[],h4:[],h5:[],h6:[],i:[],img:["src","srcset","alt","title","width","height"],li:[],ol:[],p:[],pre:[],s:[],small:[],span:[],sub:[],sup:[],strong:[],u:[],ul:[]},popperConfig:null},Pe={HIDE:"hide.bs.tooltip",HIDDEN:"hidden.bs.tooltip",SHOW:"show.bs.tooltip",SHOWN:"shown.bs.tooltip",INSERTED:"inserted.bs.tooltip",CLICK:"click.bs.tooltip",FOCUSIN:"focusin.bs.tooltip",FOCUSOUT:"focusout.bs.tooltip",MOUSEENTER:"mouseenter.bs.tooltip",MOUSELEAVE:"mouseleave.bs.tooltip"};class je extends O{constructor(t,e){if(void 0===ae)throw new TypeError("Bootstrap's tooltips require Popper (https://popper.js.org)");super(t),this._isEnabled=!0,this._timeout=0,this._hoverState="",this._activeTrigger={},this._popper=null,this.config=this._getConfig(e),this.tip=null,this._setListeners()}static get Default(){return Be}static get NAME(){return"tooltip"}static get DATA_KEY(){return"bs.tooltip"}static get Event(){return Pe}static get EVENT_KEY(){return".bs.tooltip"}static get DefaultType(){return Oe}enable(){this._isEnabled=!0}disable(){this._isEnabled=!1}toggleEnabled(){this._isEnabled=!this._isEnabled}toggle(t){if(this._isEnabled)if(t){const e=this._initializeOnDelegatedTarget(t);e._activeTrigger.click=!e._activeTrigger.click,e._isWithActiveTrigger()?e._enter(null,e):e._leave(null,e)}else{if(this.getTipElement().classList.contains("show"))return void this._leave(null,this);this._enter(null,this)}}dispose(){clearTimeout(this._timeout),L.off(this._element,this.constructor.EVENT_KEY),L.off(this._element.closest(".modal"),"hide.bs.modal",this._hideModalHandler),this.tip&&this.tip.parentNode&&this.tip.parentNode.removeChild(this.tip),this._isEnabled=null,this._timeout=null,this._hoverState=null,this._activeTrigger=null,this._popper&&this._popper.destroy(),this._popper=null,this.config=null,this.tip=null,super.dispose()}show(){if("none"===this._element.style.display)throw new Error("Please use show on visible elements");if(!this.isWithContent()||!this._isEnabled)return;const e=L.trigger(this._element,this.constructor.Event.SHOW),n=d(this._element),r=null===n?this._element.ownerDocument.documentElement.contains(this._element):n.contains(this._element);if(e.defaultPrevented||!r)return;const o=this.getTipElement(),a=t(this.constructor.NAME);o.setAttribute("id",a),this._element.setAttribute("aria-describedby",a),this.setContent(),this.config.animation&&o.classList.add("fade");const l="function"==typeof this.config.placement?this.config.placement.call(this,o,this._element):this.config.placement,c=this._getAttachment(l);this._addAttachmentClass(c);const u=this._getContainer();v.set(o,this.constructor.DATA_KEY,this),this._element.ownerDocument.documentElement.contains(this.tip)||(u.appendChild(o),L.trigger(this._element,this.constructor.Event.INSERTED)),this._popper?this._popper.update():this._popper=oe(this._element,o,this._getPopperConfig(c)),o.classList.add("show");const f="function"==typeof this.config.customClass?this.config.customClass():this.config.customClass;f&&o.classList.add(...f.split(" ")),"ontouchstart"in document.documentElement&&[].concat(...document.body.children).forEach((t=>{L.on(t,"mouseover",(function(){}))}));const h=()=>{const t=this._hoverState;this._hoverState=null,L.trigger(this._element,this.constructor.Event.SHOWN),"out"===t&&this._leave(null,this)};if(this.tip.classList.contains("fade")){const t=i(this.tip);L.one(this.tip,"transitionend",h),s(this.tip,t)}else h()}hide(){if(!this._popper)return;const t=this.getTipElement(),e=()=>{this._isWithActiveTrigger()||("show"!==this._hoverState&&t.parentNode&&t.parentNode.removeChild(t),this._cleanTipClass(),this._element.removeAttribute("aria-describedby"),L.trigger(this._element,this.constructor.Event.HIDDEN),this._popper&&(this._popper.destroy(),this._popper=null))};if(!L.trigger(this._element,this.constructor.Event.HIDE).defaultPrevented){if(t.classList.remove("show"),"ontouchstart"in document.documentElement&&[].concat(...document.body.children).forEach((t=>L.off(t,"mouseover",f))),this._activeTrigger.click=!1,this._activeTrigger.focus=!1,this._activeTrigger.hover=!1,this.tip.classList.contains("fade")){const n=i(t);L.one(t,"transitionend",e),s(t,n)}else e();this._hoverState=""}}update(){null!==this._popper&&this._popper.update()}isWithContent(){return Boolean(this.getTitle())}getTipElement(){if(this.tip)return this.tip;const t=document.createElement("div");return t.innerHTML=this.config.template,this.tip=t.children[0],this.tip}setContent(){const t=this.getTipElement();this.setElementContent(q.findOne(".tooltip-inner",t),this.getTitle()),t.classList.remove("fade","show")}setElementContent(t,e){if(null!==t)return"object"==typeof e&&a(e)?(e.jquery&&(e=e[0]),void(this.config.html?e.parentNode!==t&&(t.innerHTML="",t.appendChild(e)):t.textContent=e.textContent)):void(this.config.html?(this.config.sanitize&&(e=Ce(e,this.config.allowList,this.config.sanitizeFn)),t.innerHTML=e):t.textContent=e)}getTitle(){let t=this._element.getAttribute("data-bs-original-title");return t||(t="function"==typeof this.config.title?this.config.title.call(this._element):this.config.title),t}updateAttachment(t){return"right"===t?"end":"left"===t?"start":t}_initializeOnDelegatedTarget(t,e){const n=this.constructor.DATA_KEY;return(e=e||v.get(t.delegateTarget,n))||(e=new this.constructor(t.delegateTarget,this._getDelegateConfig()),v.set(t.delegateTarget,n,e)),e}_getOffset(){const{offset:t}=this.config;return"string"==typeof t?t.split(",").map((t=>Number.parseInt(t,10))):"function"==typeof t?e=>t(e,this._element):t}_getPopperConfig(t){const e={placement:t,modifiers:[{name:"flip",options:{altBoundary:!0,fallbackPlacements:this.config.fallbackPlacements}},{name:"offset",options:{offset:this._getOffset()}},{name:"preventOverflow",options:{boundary:this.config.boundary}},{name:"arrow",options:{element:`.${this.constructor.NAME}-arrow`}},{name:"onChange",enabled:!0,phase:"afterWrite",fn:t=>this._handlePopperPlacementChange(t)}],onFirstUpdate:t=>{t.options.placement!==t.placement&&this._handlePopperPlacementChange(t)}};return{...e,..."function"==typeof this.config.popperConfig?this.config.popperConfig(e):this.config.popperConfig}}_addAttachmentClass(t){this.getTipElement().classList.add("bs-tooltip-"+this.updateAttachment(t))}_getContainer(){return!1===this.config.container?document.body:a(this.config.container)?this.config.container:q.findOne(this.config.container)}_getAttachment(t){return Ie[t.toUpperCase()]}_setListeners(){this.config.trigger.split(" ").forEach((t=>{if("click"===t)L.on(this._element,this.constructor.Event.CLICK,this.config.selector,(t=>this.toggle(t)));else if("manual"!==t){const e="hover"===t?this.constructor.Event.MOUSEENTER:this.constructor.Event.FOCUSIN,n="hover"===t?this.constructor.Event.MOUSELEAVE:this.constructor.Event.FOCUSOUT;L.on(this._element,e,this.config.selector,(t=>this._enter(t))),L.on(this._element,n,this.config.selector,(t=>this._leave(t)))}})),this._hideModalHandler=()=>{this._element&&this.hide()},L.on(this._element.closest(".modal"),"hide.bs.modal",this._hideModalHandler),this.config.selector?this.config={...this.config,trigger:"manual",selector:""}:this._fixTitle()}_fixTitle(){const t=this._element.getAttribute("title"),e=typeof this._element.getAttribute("data-bs-original-title");(t||"string"!==e)&&(this._element.setAttribute("data-bs-original-title",t||""),!t||this._element.getAttribute("aria-label")||this._element.textContent||this._element.setAttribute("aria-label",t),this._element.setAttribute("title",""))}_enter(t,e){e=this._initializeOnDelegatedTarget(t,e),t&&(e._activeTrigger["focusin"===t.type?"focus":"hover"]=!0),e.getTipElement().classList.contains("show")||"show"===e._hoverState?e._hoverState="show":(clearTimeout(e._timeout),e._hoverState="show",e.config.delay&&e.config.delay.show?e._timeout=setTimeout((()=>{"show"===e._hoverState&&e.show()}),e.config.delay.show):e.show())}_leave(t,e){e=this._initializeOnDelegatedTarget(t,e),t&&(e._activeTrigger["focusout"===t.type?"focus":"hover"]=e._element.contains(t.relatedTarget)),e._isWithActiveTrigger()||(clearTimeout(e._timeout),e._hoverState="out",e.config.delay&&e.config.delay.hide?e._timeout=setTimeout((()=>{"out"===e._hoverState&&e.hide()}),e.config.delay.hide):e.hide())}_isWithActiveTrigger(){for(const t in this._activeTrigger)if(this._activeTrigger[t])return!0;return!1}_getConfig(t){const e=R.getDataAttributes(this._element);return Object.keys(e).forEach((t=>{Le.has(t)&&delete e[t]})),t&&"object"==typeof t.container&&t.container.jquery&&(t.container=t.container[0]),"number"==typeof(t={...this.constructor.Default,...e,..."object"==typeof t&&t?t:{}}).delay&&(t.delay={show:t.delay,hide:t.delay}),"number"==typeof t.title&&(t.title=t.title.toString()),"number"==typeof t.content&&(t.content=t.content.toString()),l("tooltip",t,this.constructor.DefaultType),t.sanitize&&(t.template=Ce(t.template,t.allowList,t.sanitizeFn)),t}_getDelegateConfig(){const t={};if(this.config)for(const e in this.config)this.constructor.Default[e]!==this.config[e]&&(t[e]=this.config[e]);return t}_cleanTipClass(){const t=this.getTipElement(),e=t.getAttribute("class").match(De);null!==e&&e.length>0&&e.map((t=>t.trim())).forEach((e=>t.classList.remove(e)))}_handlePopperPlacementChange(t){const{state:e}=t;e&&(this.tip=e.elements.popper,this._cleanTipClass(),this._addAttachmentClass(this._getAttachment(e.placement)))}static jQueryInterface(t){return this.each((function(){let e=v.get(this,"bs.tooltip");const n="object"==typeof t&&t;if((e||!/dispose|hide/.test(t))&&(e||(e=new je(this,n)),"string"==typeof t)){if(void 0===e[t])throw new TypeError(`No method named "${t}"`);e[t]()}}))}}g("tooltip",je);const Re=new RegExp("(^|\\s)bs-popover\\S+","g"),qe={...je.Default,placement:"right",offset:[0,8],trigger:"click",content:"",template:''},Fe={...je.DefaultType,content:"(string|element|function)"},ze={HIDE:"hide.bs.popover",HIDDEN:"hidden.bs.popover",SHOW:"show.bs.popover",SHOWN:"shown.bs.popover",INSERTED:"inserted.bs.popover",CLICK:"click.bs.popover",FOCUSIN:"focusin.bs.popover",FOCUSOUT:"focusout.bs.popover",MOUSEENTER:"mouseenter.bs.popover",MOUSELEAVE:"mouseleave.bs.popover"};class Ue extends je{static get Default(){return qe}static get NAME(){return"popover"}static get DATA_KEY(){return"bs.popover"}static get Event(){return ze}static get EVENT_KEY(){return".bs.popover"}static get DefaultType(){return Fe}isWithContent(){return this.getTitle()||this._getContent()}setContent(){const t=this.getTipElement();this.setElementContent(q.findOne(".popover-header",t),this.getTitle());let e=this._getContent();"function"==typeof e&&(e=e.call(this._element)),this.setElementContent(q.findOne(".popover-body",t),e),t.classList.remove("fade","show")}_addAttachmentClass(t){this.getTipElement().classList.add("bs-popover-"+this.updateAttachment(t))}_getContent(){return this._element.getAttribute("data-bs-content")||this.config.content}_cleanTipClass(){const t=this.getTipElement(),e=t.getAttribute("class").match(Re);null!==e&&e.length>0&&e.map((t=>t.trim())).forEach((e=>t.classList.remove(e)))}static jQueryInterface(t){return this.each((function(){let e=v.get(this,"bs.popover");const n="object"==typeof t?t:null;if((e||!/dispose|hide/.test(t))&&(e||(e=new Ue(this,n),v.set(this,"bs.popover",e)),"string"==typeof t)){if(void 0===e[t])throw new TypeError(`No method named "${t}"`);e[t]()}}))}}g("popover",Ue);const Ve={offset:10,method:"auto",target:""},He={offset:"number",method:"string",target:"(string|element)"};class Ge extends O{constructor(t,e){super(t),this._scrollElement="BODY"===this._element.tagName?window:this._element,this._config=this._getConfig(e),this._selector=`${this._config.target} .nav-link, ${this._config.target} .list-group-item, ${this._config.target} .dropdown-item`,this._offsets=[],this._targets=[],this._activeTarget=null,this._scrollHeight=0,L.on(this._scrollElement,"scroll.bs.scrollspy",(()=>this._process())),this.refresh(),this._process()}static get Default(){return Ve}static get DATA_KEY(){return"bs.scrollspy"}refresh(){const t=this._scrollElement===this._scrollElement.window?"offset":"position",e="auto"===this._config.method?t:this._config.method,r="position"===e?this._getScrollTop():0;this._offsets=[],this._targets=[],this._scrollHeight=this._getScrollHeight(),q.find(this._selector).map((t=>{const i=n(t),o=i?q.findOne(i):null;if(o){const t=o.getBoundingClientRect();if(t.width||t.height)return[R[e](o).top+r,i]}return null})).filter((t=>t)).sort(((t,e)=>t[0]-e[0])).forEach((t=>{this._offsets.push(t[0]),this._targets.push(t[1])}))}dispose(){super.dispose(),L.off(this._scrollElement,".bs.scrollspy"),this._scrollElement=null,this._config=null,this._selector=null,this._offsets=null,this._targets=null,this._activeTarget=null,this._scrollHeight=null}_getConfig(e){if("string"!=typeof(e={...Ve,..."object"==typeof e&&e?e:{}}).target&&a(e.target)){let{id:n}=e.target;n||(n=t("scrollspy"),e.target.id=n),e.target="#"+n}return l("scrollspy",e,He),e}_getScrollTop(){return this._scrollElement===window?this._scrollElement.pageYOffset:this._scrollElement.scrollTop}_getScrollHeight(){return this._scrollElement.scrollHeight||Math.max(document.body.scrollHeight,document.documentElement.scrollHeight)}_getOffsetHeight(){return this._scrollElement===window?window.innerHeight:this._scrollElement.getBoundingClientRect().height}_process(){const t=this._getScrollTop()+this._config.offset,e=this._getScrollHeight(),n=this._config.offset+e-this._getOffsetHeight();if(this._scrollHeight!==e&&this.refresh(),t>=n){const t=this._targets[this._targets.length-1];this._activeTarget!==t&&this._activate(t)}else{if(this._activeTarget&&t0)return this._activeTarget=null,void this._clear();for(let e=this._offsets.length;e--;)this._activeTarget!==this._targets[e]&&t>=this._offsets[e]&&(void 0===this._offsets[e+1]||t`${e}[data-bs-target="${t}"],${e}[href="${t}"]`)),n=q.findOne(e.join(","));n.classList.contains("dropdown-item")?(q.findOne(".dropdown-toggle",n.closest(".dropdown")).classList.add("active"),n.classList.add("active")):(n.classList.add("active"),q.parents(n,".nav, .list-group").forEach((t=>{q.prev(t,".nav-link, .list-group-item").forEach((t=>t.classList.add("active"))),q.prev(t,".nav-item").forEach((t=>{q.children(t,".nav-link").forEach((t=>t.classList.add("active")))}))}))),L.trigger(this._scrollElement,"activate.bs.scrollspy",{relatedTarget:t})}_clear(){q.find(this._selector).filter((t=>t.classList.contains("active"))).forEach((t=>t.classList.remove("active")))}static jQueryInterface(t){return this.each((function(){let e=v.get(this,"bs.scrollspy");if(e||(e=new Ge(this,"object"==typeof t&&t)),"string"==typeof t){if(void 0===e[t])throw new TypeError(`No method named "${t}"`);e[t]()}}))}}L.on(window,"load.bs.scrollspy.data-api",(()=>{q.find('[data-bs-spy="scroll"]').forEach((t=>new Ge(t,R.getDataAttributes(t))))})),g("scrollspy",Ge);class Ye extends O{static get DATA_KEY(){return"bs.tab"}show(){if(this._element.parentNode&&this._element.parentNode.nodeType===Node.ELEMENT_NODE&&this._element.classList.contains("active")||u(this._element))return;let t;const e=r(this._element),n=this._element.closest(".nav, .list-group");if(n){const e="UL"===n.nodeName||"OL"===n.nodeName?":scope > li > .active":".active";t=q.find(e,n),t=t[t.length-1]}const i=t?L.trigger(t,"hide.bs.tab",{relatedTarget:this._element}):null;if(L.trigger(this._element,"show.bs.tab",{relatedTarget:t}).defaultPrevented||null!==i&&i.defaultPrevented)return;this._activate(this._element,n);const o=()=>{L.trigger(t,"hidden.bs.tab",{relatedTarget:this._element}),L.trigger(this._element,"shown.bs.tab",{relatedTarget:t})};e?this._activate(e,e.parentNode,o):o()}_activate(t,e,n){const r=(!e||"UL"!==e.nodeName&&"OL"!==e.nodeName?q.children(e,".active"):q.find(":scope > li > .active",e))[0],o=n&&r&&r.classList.contains("fade"),a=()=>this._transitionComplete(t,r,n);if(r&&o){const t=i(r);r.classList.remove("show"),L.one(r,"transitionend",a),s(r,t)}else a()}_transitionComplete(t,e,n){if(e){e.classList.remove("active");const t=q.findOne(":scope > .dropdown-menu .active",e.parentNode);t&&t.classList.remove("active"),"tab"===e.getAttribute("role")&&e.setAttribute("aria-selected",!1)}t.classList.add("active"),"tab"===t.getAttribute("role")&&t.setAttribute("aria-selected",!0),h(t),t.classList.contains("fade")&&t.classList.add("show"),t.parentNode&&t.parentNode.classList.contains("dropdown-menu")&&(t.closest(".dropdown")&&q.find(".dropdown-toggle").forEach((t=>t.classList.add("active"))),t.setAttribute("aria-expanded",!0)),n&&n()}static jQueryInterface(t){return this.each((function(){const e=v.get(this,"bs.tab")||new Ye(this);if("string"==typeof t){if(void 0===e[t])throw new TypeError(`No method named "${t}"`);e[t]()}}))}}L.on(document,"click.bs.tab.data-api",'[data-bs-toggle="tab"], [data-bs-toggle="pill"], [data-bs-toggle="list"]',(function(t){t.preventDefault(),(v.get(this,"bs.tab")||new Ye(this)).show()})),g("tab",Ye);const We={animation:"boolean",autohide:"boolean",delay:"number"},$e={animation:!0,autohide:!0,delay:5e3};class Ke extends O{constructor(t,e){super(t),this._config=this._getConfig(e),this._timeout=null,this._setListeners()}static get DefaultType(){return We}static get Default(){return $e}static get DATA_KEY(){return"bs.toast"}show(){if(L.trigger(this._element,"show.bs.toast").defaultPrevented)return;this._clearTimeout(),this._config.animation&&this._element.classList.add("fade");const t=()=>{this._element.classList.remove("showing"),this._element.classList.add("show"),L.trigger(this._element,"shown.bs.toast"),this._config.autohide&&(this._timeout=setTimeout((()=>{this.hide()}),this._config.delay))};if(this._element.classList.remove("hide"),h(this._element),this._element.classList.add("showing"),this._config.animation){const e=i(this._element);L.one(this._element,"transitionend",t),s(this._element,e)}else t()}hide(){if(!this._element.classList.contains("show"))return;if(L.trigger(this._element,"hide.bs.toast").defaultPrevented)return;const t=()=>{this._element.classList.add("hide"),L.trigger(this._element,"hidden.bs.toast")};if(this._element.classList.remove("show"),this._config.animation){const e=i(this._element);L.one(this._element,"transitionend",t),s(this._element,e)}else t()}dispose(){this._clearTimeout(),this._element.classList.contains("show")&&this._element.classList.remove("show"),L.off(this._element,"click.dismiss.bs.toast"),super.dispose(),this._config=null}_getConfig(t){return t={...$e,...R.getDataAttributes(this._element),..."object"==typeof t&&t?t:{}},l("toast",t,this.constructor.DefaultType),t}_setListeners(){L.on(this._element,"click.dismiss.bs.toast",'[data-bs-dismiss="toast"]',(()=>this.hide()))}_clearTimeout(){clearTimeout(this._timeout),this._timeout=null}static jQueryInterface(t){return this.each((function(){let e=v.get(this,"bs.toast");if(e||(e=new Ke(this,"object"==typeof t&&t)),"string"==typeof t){if(void 0===e[t])throw new TypeError(`No method named "${t}"`);e[t](this)}}))}}return g("toast",Ke),{Alert:I,Button:B,Carousel:Y,Collapse:K,Dropdown:ge,Modal:ye,Offcanvas:Ee,Popover:Ue,ScrollSpy:Ge,Tab:Ye,Toast:Ke,Tooltip:je}})),function(t,e){if("object"==typeof module&&module.exports){var n=require("d3");module.exports=e(n)}else if("function"==typeof define&&define.amd){try{n=require("d3")}catch(e){n=t.d3}n.contextMenu=e(n),define([],(function(){return n.contextMenu}))}else t.d3&&(t.d3.contextMenu=e(t.d3))}(this,(function(t){var e={noop:function(){},isFn:function(t){return"function"==typeof t},const:function(t){return function(){return t}},toFactory:function(t,n){return t=void 0===t?n:t,e.isFn(t)?t:e.const(t)}},n=null,r=function(){n&&(t.select(".d3-context-menu").remove(),t.select("body").on("mousedown.d3-context-menu",null),n.boundCloseCallback(),n=null)};return function(i,o){if("close"===i)return r();i=e.toFactory(i);var a=(o=e.isFn(o)?{onOpen:o}:o||{}).onOpen||e.noop,s=o.onClose||e.noop,l=e.toFactory(o.position),c=e.toFactory(o.theme,"d3-context-menu-theme");return function(o,u){var d,f=this;if(void 0===t.event?(d=o,u,void 0):(d=t.event,o,u),r(),n={boundCloseCallback:s.bind(f,o,u)},t.selectAll(".d3-context-menu").data([1]).enter().append("div").attr("class","d3-context-menu "+c.bind(f)(o,u)),t.select("body").on("mousedown.d3-context-menu",r),t.select("body").on("click.d3-context-menu",r),t.selectAll(".d3-context-menu").on("contextmenu",(function(){r(),d.preventDefault(),d.stopPropagation()})).append("ul").call((function n(a,s,l=0){var c=function(t){return e.toFactory(t).call(s,o,u)};a.selectAll("li").data((function(t){var e=0===l?i:t.children;return c(e)})).enter().append("li").each((function(e){var i=!!c(e.divider),a=!!c(e.disabled),d=!!c(e.children),f=!!e.action,h=i?"
":c(e.title),p=t.select(this).classed("is-divider",i).classed("is-disabled",a).classed("is-header",!d&&!f).classed("is-parent",d).html(h).on("click",(function(){!a&&f&&(e.action.call(s,o,u),r())}));if(d){var m=p.append("ul").classed("is-children",!0);n(m,s,++l)}}))}),f),!1!==a.bind(f)(o,u)){var h=l.bind(f)(o,u),p=document.documentElement,m=window.innerWidth||p.clientWidth,g=window.innerHeight||p.clientHeight,b="left",v="right",y=h?h.left:d.pageX-2;d.pageX>m/2&&(b="right",v="left",y=h?m-h.left:m-d.pageX-2);var _="top",w="bottom",x=h?h.top:d.pageY-2;d.pageY>g/2&&(_="bottom",w="top",x=h?g-h.top:g-d.pageY-2),t.select(".d3-context-menu").style(b,y+"px").style(v,null).style(_,x+"px").style(w,null).style("display","block"),d.preventDefault(),d.stopPropagation()}}}})),function(t){"undefined"!=typeof module&&"object"==typeof exports?module.exports=t():"undefined"!=typeof define&&define.amd?define(["fflate",t]):("undefined"!=typeof self?self:this).fflate=t()}((function(){var t={},e=("undefined"!=typeof module&&"object"==typeof exports?function(t){"use strict";var e;try{e=require("worker_threads").Worker}catch(e){}return t.default=e?function(t,n,r,i,o){var a=!1,s=new e(t+";var __w=eval('require')('worker_threads');__w.parentPort.on('message',function(m){onmessage({data:m})}),postMessage=function(m,t){__w.parentPort.postMessage(m,t)},close=process.exit;self=global",{eval:!0}).on("error",(function(t){return o(t,null)})).on("message",(function(t){return o(null,t)})).on("exit",(function(t){t&&!a&&o(Error("exited with code "+t),null)}));return s.postMessage(r,i),s.terminate=function(){return a=!0,e.prototype.terminate.call(s)},s}:function(t,e,n,r,i){setImmediate((function(){return i(Error("async operations unsupported - update to Node 12+ (or Node 10-11 with the --experimental-worker CLI flag)"),null)}));var o=function(){};return{terminate:o,postMessage:o}},t}:function(t){"use strict";var e={};return t.default=function(t,n,r,i,o){var a=e[n]||(e[n]=URL.createObjectURL(new Blob([t],{type:"text/javascript"}))),s=new Worker(a);return s.onerror=function(t){return o(t.error,null)},s.onmessage=function(t){return o(null,t.data)},s.postMessage(r,i),s},t})({}),n=Uint8Array,r=Uint16Array,i=Uint32Array,o=new n([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),a=new n([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),s=new n([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),l=function(t,e){for(var n=new r(31),o=0;o<31;++o)n[o]=e+=1<>>1|(21845&g)<<1;m[g]=((65280&(b=(61680&(b=(52428&b)>>>2|(13107&b)<<2))>>>4|(3855&b)<<4))>>>8|(255&b)<<8)>>>1}var v=function(t,e,n){for(var i=t.length,o=0,a=new r(e);o>>c]=u}else for(s=new r(i),o=0;o>>15-t[o];return s},y=new n(288);for(g=0;g<144;++g)y[g]=8;for(g=144;g<256;++g)y[g]=9;for(g=256;g<280;++g)y[g]=7;for(g=280;g<288;++g)y[g]=8;var _=new n(32);for(g=0;g<32;++g)_[g]=5;var w=v(y,9,0),x=v(y,9,1),T=v(_,5,0),A=v(_,5,1),E=function(t){for(var e=t[0],n=1;ne&&(e=t[n]);return e},M=function(t,e,n){var r=e/8>>0;return(t[r]|t[r+1]<<8)>>>(7&e)&n},S=function(t,e){var n=e/8>>0;return(t[n]|t[n+1]<<8|t[n+2]<<16)>>>(7&e)},N=function(t){return(t/8>>0)+(7&t&&1)},k=function(t,e,o){(null==e||e<0)&&(e=0),(null==o||o>t.length)&&(o=t.length);var a=new(t instanceof r?r:t instanceof i?i:n)(o-e);return a.set(t.subarray(e,o)),a},C=function(t,e,r){var i=t.length,l=!e||r,c=!r||r.i;r||(r={}),e||(e=new n(3*i));var d=function(t){var r=e.length;if(t>r){var i=new n(Math.max(2*r,t));i.set(e),e=i}},f=r.f||0,p=r.p||0,m=r.b||0,g=r.l,b=r.d,y=r.m,_=r.n,w=8*i;do{if(!g){r.f=f=M(t,p,1);var T=M(t,p+1,3);if(p+=3,!T){var C=t[(z=N(p)+4)-4]|t[z-3]<<8,D=z+C;if(D>i){if(c)throw"unexpected EOF";break}l&&d(m+C),e.set(t.subarray(z,D),m),r.b=m+=C,r.p=p=8*D;continue}if(1==T)g=x,b=A,y=9,_=5;else{if(2!=T)throw"invalid block type";var L=M(t,p,31)+257,O=M(t,p+10,15)+4,I=L+M(t,p+5,31)+1;p+=14;for(var B=new n(I),P=new n(19),j=0;jw)break;var F=v(P,R,1);for(j=0;j>>4)<16)B[j++]=z;else{var V=0,H=0;for(16==z?(H=3+M(t,p,3),p+=2,V=B[j-1]):17==z?(H=3+M(t,p,7),p+=3):18==z&&(H=11+M(t,p,127),p+=7);H--;)B[j++]=V}}var G=B.subarray(0,L),Y=B.subarray(L);y=E(G),_=E(Y),g=v(G,y,1),b=v(Y,_,1)}if(p>w)throw"unexpected EOF"}l&&d(m+131072);for(var W=(1<>>4;if((p+=15&V)>w)throw"unexpected EOF";if(!V)throw"invalid length/literal";if(X<256)e[m++]=X;else{if(256==X){g=null;break}var Q=X-254;X>264&&(Q=M(t,p,(1<<(tt=o[j=X-257]))-1)+u[j],p+=tt);var Z=b[S(t,p)&$],J=Z>>>4;if(!Z)throw"invalid distance";if(p+=15&Z,Y=h[J],J>3){var tt=a[J];Y+=S(t,p)&(1<w)throw"unexpected EOF";l&&d(m+131072);for(var et=m+Q;m>0;t[r]|=n<<=7&e,t[r+1]|=n>>>8},L=function(t,e,n){var r=e/8>>0;t[r]|=n<<=7&e,t[r+1]|=n>>>8,t[r+2]|=n>>>16},O=function(t,e){for(var i=[],o=0;op&&(p=s[o].s);var m=new r(p+1),g=I(i[f-1],m,0);if(g>e){o=0;var b=0,v=g-e,y=1<e))break;b+=y-(1<>>=v;b>0;){var w=s[o].s;m[w]=0&&b;--o){var x=s[o].s;m[x]==e&&(--m[x],++b)}g=e}return[new n(m),g]},I=function(t,e,n){return-1==t.s?Math.max(I(t.l,e,n+1),I(t.r,e,n+1)):e[t.s]=n},B=function(t){for(var e=t.length;e&&!t[--e];);for(var n=new r(++e),i=0,o=t[0],a=1,s=function(t){n[i++]=t},l=1;l<=e;++l)if(t[l]==o&&l!=e)++a;else{if(!o&&a>2){for(;a>138;a-=138)s(32754);a>2&&(s(a>10?a-11<<5|28690:a-3<<5|12305),a=0)}else if(a>3){for(s(o),--a;a>6;a-=6)s(8304);a>2&&(s(a-3<<5|8208),a=0)}for(;a--;)s(o);a=1,o=t[l]}return[n.subarray(0,i),e]},P=function(t,e){for(var n=0,r=0;r>>8,t[i+2]=255^t[i],t[i+3]=255^t[i+1];for(var o=0;o4&&!z[s[V-1]];--V);var H,G,Y,W,$=h+5<<3,K=P(l,y)+P(c,_)+u,X=P(l,g)+P(c,A)+u+14+3*V+P(R,z)+(2*R[16]+3*R[17]+7*R[18]);if($<=K&&$<=X)return j(e,p,t.subarray(f,f+h));if(D(e,p,1+(X15&&(D(e,p,tt[q]>>>5&127),p+=tt[q]>>>12)}}else H=w,G=y,Y=T,W=_;for(q=0;q255){var et;L(e,p,H[257+(et=i[q]>>>18&31)]),p+=G[et+257],et>7&&(D(e,p,i[q]>>>23&31),p+=o[et]);var nt=31&i[q];L(e,p,Y[nt]),p+=W[nt],nt>3&&(L(e,p,i[q]>>>5&8191),p+=a[nt])}else L(e,p,H[i[q]]),p+=G[i[q]];return L(e,p,H[256]),p+G[256]},q=new i([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),F=new n(0),z=function(t,e,s,l,c,u){var f=t.length,h=new n(l+f+5*(1+Math.floor(f/7e3))+c),m=h.subarray(l,h.length-c),g=0;if(!e||f<8)for(var b=0;b<=f;b+=65535){var v=b+65535;v>>13,w=8191&y,x=(1<7e3||B>24576)&&G>423){g=R(t,m,0,C,D,L,I,B,z,b-z,g),B=O=I=0,z=b;for(var Y=0;Y<286;++Y)D[Y]=0;for(Y=0;Y<30;++Y)L[Y]=0}var W=2,$=0,K=w,X=V-H&32767;if(G>2&&U==S(b-X))for(var Q=Math.min(_,G)-1,Z=Math.min(32767,b),J=Math.min(258,G);X<=Z&&--K&&V!=H;){if(t[b+W]==t[b+W-X]){for(var tt=0;ttW){if(W=tt,$=X,tt>Q)break;var et=Math.min(X,tt-2),nt=0;for(Y=0;Ynt&&(nt=it,H=rt)}}}X+=(V=H)-(H=T[V])+32768&32767}if($){C[B++]=268435456|d[W]<<18|p[$];var ot=31&d[W],at=31&p[$];I+=o[ot]+a[at],++D[257+ot],++L[at],P=b+W,++O}else C[B++]=t[b],++D[t[b]]}}g=R(t,m,u,C,D,L,I,B,z,b-z,g),u||(g=j(m,g,F))}return k(h,0,l+N(g)+c)},U=function(){for(var t=new i(256),e=0;e<256;++e){for(var n=e,r=9;--r;)n=(1&n&&3988292384)^n>>>1;t[e]=n}return t}(),V=function(){var t=4294967295;return{p:function(e){for(var n=t,r=0;r>>8;t=n},d:function(){return 4294967295^t}}},H=function(){var t=1,e=0;return{p:function(n){for(var r=t,i=e,o=n.length,a=0;a!=o;){for(var s=Math.min(a+5552,o);a>>8<<16|(255&e)<<8|e>>>8)+2*((255&t)<<23)}}},G=function(t,e,n,r,i){return z(t,null==e.level?6:e.level,null==e.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(t.length)))):12+e.mem,n,r,!i)},Y=function(t,e){var n={};for(var r in t)n[r]=t[r];for(var r in e)n[r]=e[r];return n},W=function(t,e,n){for(var r=t(),i=""+t,o=i.slice(i.indexOf("[")+1,i.lastIndexOf("]")).replace(/ /g,"").split(","),a=0;a>>=8},dt=function(t,e){var n=e.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=e.level<2?4:9==e.level?2:0,t[9]=3,0!=e.mtime&&ut(t,4,Math.floor(new Date(e.mtime||Date.now())/1e3)),n){t[3]=8;for(var r=0;r<=n.length;++r)t[r+10]=n.charCodeAt(r)}},ft=function(t){if(31!=t[0]||139!=t[1]||8!=t[2])throw"invalid gzip data";var e=t[3],n=10;4&e&&(n+=t[10]|2+(t[11]<<8));for(var r=(e>>3&1)+(e>>4&1);r>0;r-=!t[n++]);return n+(2&e)},ht=function(t){var e=t.length;return(t[e-4]|t[e-3]<<8|t[e-2]<<16)+2*(t[e-1]<<23)},pt=function(t){return 10+(t.filename&&t.filename.length+1||0)},mt=function(t,e){var n=e.level,r=0==n?0:n<6?1:9==n?3:2;t[0]=120,t[1]=r<<6|(r?32-2*r:1)},gt=function(t){if(8!=(15&t[0])||t[0]>>>4>7||(t[0]<<8|t[1])%31)throw"invalid zlib data";if(32&t[1])throw"invalid zlib data: preset dictionaries not supported"};function bt(t,e){return e||"function"!=typeof t||(e=t,t={}),this.ondata=e,t}var vt=function(){function t(t,e){e||"function"!=typeof t||(e=t,t={}),this.ondata=e,this.o=t||{}}return t.prototype.p=function(t,e){this.ondata(G(t,this.o,0,0,!e),e)},t.prototype.push=function(t,e){if(this.d)throw"stream finished";if(!this.ondata)throw"no stream handler";this.d=e,this.p(t,e||!1)},t}();t.Deflate=vt;function yt(t,e,n){if(n||(n=e,e={}),"function"!=typeof n)throw"no callback";return ot(t,e,[Z],(function(t){return rt(_t(t.data[0],t.data[1]))}),0,n)}function _t(t,e){return void 0===e&&(e={}),G(t,e,0,0)}t.AsyncDeflate=function(t,e){st([Z,function(){return[at,vt]}],this,bt.call(this,t,e),(function(t){var e=new vt(t.data);onmessage=at(e)}),6)},t.deflate=yt,t.deflateSync=_t;var wt=function(){function t(t){this.s={},this.p=new n(0),this.ondata=t}return t.prototype.e=function(t){if(this.d)throw"stream finished";if(!this.ondata)throw"no stream handler";var e=this.p.length,r=new n(e+t.length);r.set(this.p),r.set(t,e),this.p=r},t.prototype.c=function(t){this.d=this.s.i=t||!1;var e=this.s.b,n=C(this.p,this.o,this.s);this.ondata(k(n,e,this.s.b),this.d),this.o=k(n,this.s.b-32768),this.s.b=this.o.length,this.p=k(this.p,this.s.p/8>>0),this.s.p&=7},t.prototype.push=function(t,e){this.e(t),this.c(e)},t}();t.Inflate=wt;var xt=function(t){this.ondata=t,st([Q,function(){return[at,wt]}],this,0,(function(){var t=new wt;onmessage=at(t)}),7)};function Tt(t,e,n){if(n||(n=e,e={}),"function"!=typeof n)throw"no callback";return ot(t,e,[Q],(function(t){return rt(At(t.data[0],it(t.data[1])))}),1,n)}function At(t,e){return C(t,e)}t.AsyncInflate=xt,t.inflate=Tt,t.inflateSync=At;var Et=function(){function t(t,e){this.c=V(),this.l=0,this.v=1,vt.call(this,t,e)}return t.prototype.push=function(t,e){vt.prototype.push.call(this,t,e)},t.prototype.p=function(t,e){this.c.p(t),this.l+=t.length;var n=G(t,this.o,this.v&&pt(this.o),e&&8,!e);this.v&&(dt(n,this.o),this.v=0),e&&(ut(n,n.length-8,this.c.d()),ut(n,n.length-4,this.l)),this.ondata(n,e)},t}();t.Gzip=Et,t.Compress=Et;var Mt=function(t,e){st([Z,J,function(){return[at,vt,Et]}],this,bt.call(this,t,e),(function(t){var e=new Et(t.data);onmessage=at(e)}),8)};function St(t,e,n){if(n||(n=e,e={}),"function"!=typeof n)throw"no callback";return ot(t,e,[Z,J,function(){return[Nt]}],(function(t){return rt(Nt(t.data[0],t.data[1]))}),2,n)}function Nt(t,e){void 0===e&&(e={});var n=V(),r=t.length;n.p(t);var i=G(t,e,pt(e),8),o=i.length;return dt(i,e),ut(i,o-8,n.d()),ut(i,o-4,r),i}t.AsyncGzip=Mt,t.AsyncCompress=Mt,t.gzip=St,t.compress=St,t.gzipSync=Nt,t.compressSync=Nt;var kt=function(){function t(t){this.v=1,wt.call(this,t)}return t.prototype.push=function(t,e){if(wt.prototype.e.call(this,t),this.v){var n=ft(this.p);if(n>=this.p.length&&!e)return;this.p=this.p.subarray(n),this.v=0}if(e){if(this.p.length<8)throw"invalid gzip stream";this.p=this.p.subarray(0,-8)}wt.prototype.c.call(this,e)},t}();t.Gunzip=kt;var Ct=function(t){this.ondata=t,st([Q,tt,function(){return[at,wt,kt]}],this,0,(function(){var t=new kt;onmessage=at(t)}),9)};function Dt(t,e,n){if(n||(n=e,e={}),"function"!=typeof n)throw"no callback";return ot(t,e,[Q,tt,function(){return[Lt]}],(function(t){return rt(Lt(t.data[0]))}),3,n)}function Lt(t,e){return C(t.subarray(ft(t),-8),e||new n(ht(t)))}t.AsyncGunzip=Ct,t.gunzip=Dt,t.gunzipSync=Lt;var Ot=function(){function t(t,e){this.c=H(),this.v=1,vt.call(this,t,e)}return t.prototype.push=function(t,e){vt.prototype.push.call(this,t,e)},t.prototype.p=function(t,e){this.c.p(t);var n=G(t,this.o,this.v&&2,e&&4,!e);this.v&&(mt(n,this.o),this.v=0),e&&ut(n,n.length-4,this.c.d()),this.ondata(n,e)},t}();t.Zlib=Ot;function It(t,e){void 0===e&&(e={});var n=H();n.p(t);var r=G(t,e,2,4);return mt(r,e),ut(r,r.length-4,n.d()),r}t.AsyncZlib=function(t,e){st([Z,et,function(){return[at,vt,Ot]}],this,bt.call(this,t,e),(function(t){var e=new Ot(t.data);onmessage=at(e)}),10)},t.zlib=function(t,e,n){if(n||(n=e,e={}),"function"!=typeof n)throw"no callback";return ot(t,e,[Z,et,function(){return[It]}],(function(t){return rt(It(t.data[0],t.data[1]))}),4,n)},t.zlibSync=It;var Bt=function(){function t(t){this.v=1,wt.call(this,t)}return t.prototype.push=function(t,e){if(wt.prototype.e.call(this,t),this.v){if(this.p.length<2&&!e)return;this.p=this.p.subarray(2),this.v=0}if(e){if(this.p.length<4)throw"invalid zlib stream";this.p=this.p.subarray(0,-4)}wt.prototype.c.call(this,e)},t}();t.Unzlib=Bt;var Pt=function(t){this.ondata=t,st([Q,nt,function(){return[at,wt,Bt]}],this,0,(function(){var t=new Bt;onmessage=at(t)}),11)};function jt(t,e,n){if(n||(n=e,e={}),"function"!=typeof n)throw"no callback";return ot(t,e,[Q,nt,function(){return[Rt]}],(function(t){return rt(Rt(t.data[0],it(t.data[1])))}),5,n)}function Rt(t,e){return C((gt(t),t.subarray(2,-4)),e)}t.AsyncUnzlib=Pt,t.unzlib=jt,t.unzlibSync=Rt;var qt=function(){function t(t){this.G=kt,this.I=wt,this.Z=Bt,this.ondata=t}return t.prototype.push=function(t,e){if(!this.ondata)throw"no stream handler";if(this.s)this.s.push(t,e);else{if(this.p&&this.p.length){var r=new n(this.p.length+t.length);r.set(this.p),r.set(t,this.p.length)}else this.p=t;if(this.p.length>2){var i=this,o=function(){i.ondata.apply(i,arguments)};this.s=31==this.p[0]&&139==this.p[1]&&8==this.p[2]?new this.G(o):8!=(15&this.p[0])||this.p[0]>>4>7||(this.p[0]<<8|this.p[1])%31?new this.I(o):new this.Z(o),this.s.push(this.p,e),this.p=null}}},t}();t.Decompress=qt;var Ft=function(){function t(t){this.G=Ct,this.I=xt,this.Z=Pt,this.ondata=t}return t.prototype.push=function(t,e){qt.prototype.push.call(this,t,e)},t}();t.AsyncDecompress=Ft,t.decompress=function(t,e,n){if(n||(n=e,e={}),"function"!=typeof n)throw"no callback";return 31==t[0]&&139==t[1]&&8==t[2]?Dt(t,e,n):8!=(15&t[0])||t[0]>>4>7||(t[0]<<8|t[1])%31?Tt(t,e,n):jt(t,e,n)},t.decompressSync=function(t,e){return 31==t[0]&&139==t[1]&&8==t[2]?Lt(t,e):8!=(15&t[0])||t[0]>>4>7||(t[0]<<8|t[1])%31?At(t,e):Rt(t,e)};var zt=function(t,e,r,i){for(var o in t){var a=t[o],s=e+o;a instanceof n?r[s]=[a,i]:Array.isArray(a)?r[s]=[a[0],Y(i,a[1])]:zt(a,s+"/",r,i)}};function Ut(t,e){var r=t.length;if(!e&&"undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var i=new n(t.length+(t.length>>>1)),o=0,a=function(t){i[o++]=t},s=0;si.length){var l=new n(o+8+(r-s<<1));l.set(i),i=l}var c=t.charCodeAt(s);c<128||e?a(c):c<2048?(a(192|c>>>6),a(128|63&c)):c>55295&&c<57344?(a(240|(c=65536+(1047552&c)|1023&t.charCodeAt(++s))>>>18),a(128|c>>>12&63),a(128|c>>>6&63),a(128|63&c)):(a(224|c>>>12),a(128|c>>>6&63),a(128|63&c))}return k(i,0,o)}function Vt(t,e){var n="";if(!e&&"undefined"!=typeof TextDecoder)return(new TextDecoder).decode(t);for(var r=0;r>10,56320|1023&i))}return n}t.strToU8=Ut,t.strFromU8=Vt;var Ht=function(t,e){return e+30+lt(t,e+26)+lt(t,e+28)},Gt=function(t,e,n){var r=lt(t,e+28),i=Vt(t.subarray(e+46,e+46+r),!(2048<(t,e+8))),o=e+46+r,a=n?Yt(t,o):[ct(t,e+20),ct(t,e+24),ct(t,e+42)],s=a[0],l=a[1],c=a[2];return[lt(t,e+10),s,l,i,o+lt(t,e+30)+lt(t,e+32),c]},Yt=function(t,e){for(;1!=lt(t,e);e+=4+lt(t,e+2));return[ct(t,e+12),ct(t,e+4),ct(t,e+20)]},Wt=function(t,e,n,r,i,o,a,s,l,c){var u=o.length,d=r.length;ut(t,e,null!=l?33639248:67324752),e+=4,null!=l&&(t[e]=20,e+=2),t[e]=20,e+=2,t[e++]=8==c&&(1==s.level?6:s.level<6?4:9==s.level?2:0),t[e++]=a&&8,t[e]=c,e+=2;var f=new Date(s.mtime||Date.now()),h=f.getFullYear()-1980;if(h<0||h>119)throw"date not in range 1980-2099";ut(t,e,2*(h<<24)|f.getMonth()+1<<21|f.getDate()<<16|f.getHours()<<11|f.getMinutes()<<5|f.getSeconds()>>>1),ut(t,e+=4,n),ut(t,e+4,d),ut(t,e+8,i),ut(t,e+12,u),e+=16,null!=l&&(ut(t,e+=10,l),e+=4),t.set(o,e),e+=u,null==l&&t.set(r,e)},$t=function(t,e,n,r,i){ut(t,e,101010256),ut(t,e+8,n),ut(t,e+10,n),ut(t,e+12,r),ut(t,e+16,i)};return t.zip=function(t,e,r){if(r||(r=e,e={}),"function"!=typeof r)throw"no callback";var i={};zt(t,"",i,e);var o=Object.keys(i),a=o.length,s=0,l=0,c=a,u=Array(a),d=[],f=function(){for(var t=0;t65535&&_("filename too long",null),y)if(g<16e4)try{_(null,_t(c,p))}catch(t){_(t,null)}else d.push(yt(c,p,_));else _(null,c)},m=0;m65535)throw"filename too long";var p=d?_t(c,u):c,m=p.length,g=V();g.p(c),i.push({t:d,d:p,m:c.length,c:g.d(),u:s.length!=h,n:f,o:o,p:u}),o+=30+h+m,a+=76+2*h+m}for(var b=new n(a+22),v=o,y=a-o,_=0;_65558)return void e("invalid zip file",null);var s=lt(t,a+8);s||e(null,{});var l=s,c=ct(t,a+16),u=4294967295==c;if(u){if(a=ct(t,a-12),101075792!=ct(t,a))throw"invalid zip file";l=s=ct(t,a+32),c=ct(t,a+48)}for(var d=function(a){var l=Gt(t,c,u),d=l[0],f=l[1],h=l[2],p=l[3],m=l[4],g=Ht(t,l[5]);c=m;var b=function(t,n){t?(i(),e(t,null)):(o[p]=n,--s||e(null,o))};if(d)if(8==d){var v=t.subarray(g,g+f);if(f<32e4)try{b(null,At(v,new n(h)))}catch(t){b(t,null)}else r.push(Tt(v,{size:h},b))}else b("unknown compression type "+d,null);else b(null,k(t,g,g+f))},f=0;f65558)throw"invalid zip file";var i=lt(t,r+8);if(!i)return{};var o=ct(t,r+16),a=4294967295==o;if(a){if(r=ct(t,r-12),101075792!=ct(t,r))throw"invalid zip file";i=ct(t,r+32),o=ct(t,r+48)}for(var s=0;s(n,r)=>(t.has(n)?t.get(n).add(r):t.set(n,(new Set).add(r)),e),a=(t,e)=>(r,i)=>{if(r!==n||i)if(i){const e=t.get(r);e&&(e.delete(i),0===e.size&&t.delete(r))}else t.delete(r);else t.clear();return e},s=(t,e)=>(t,n)=>e.on(t,(function r(...i){e.off(t,r),n.apply(e,i)})),l=(t,e)=>(r,...i)=>{const o=t.get(r);return o&&o.forEach((t=>t.apply(e,i))),t.get(n)&&r!==n&&e.trigger(n,r,...i),e},c=function(t){const e=new Map;return r(t=t||{},i({on:o,off:a,one:s,trigger:l}).reduce(((n,[r,i])=>(n[r]={value:i(e,t),enumerable:!1,writable:!1,configurable:!1},n)),{})),t};"object"==typeof exports?module.exports=c:"function"==typeof r&&r.amd?r((function(){return c})):t.observable=c}("undefined"!=typeof window?window:void 0),t=this,e=function(t){"use strict";function e(t){return t.replace(/-(\w)/g,((t,e)=>e.toUpperCase()))}function n(t,e){t.firstChild&&(e.appendChild(t.firstChild),n(t,e))}function r(t){Array.from(t).forEach(i)}const i=t=>t&&t.parentNode&&t.parentNode.removeChild(t),o=(t,e)=>e&&e.parentNode&&e.parentNode.insertBefore(t,e),a=new Map,s=Symbol("riot-component"),l=new Set,c="is",u="mount",d="update",f="unmount",h="shouldUpdate",p="onBeforeMount",m="onMounted",g="onBeforeUpdate",b="onUpdated",v="onBeforeUnmount",y="onUnmounted",_="props",w="state",x="slots",T="root",A=Symbol.for("pure"),E=Symbol("parent"),M=Symbol("attributes"),S=Symbol("template");var N=Object.freeze({__proto__:null,COMPONENTS_IMPLEMENTATION_MAP:a,DOM_COMPONENT_INSTANCE_PROPERTY:s,PLUGINS_SET:l,IS_DIRECTIVE:c,VALUE_ATTRIBUTE:"value",MOUNT_METHOD_KEY:u,UPDATE_METHOD_KEY:d,UNMOUNT_METHOD_KEY:f,SHOULD_UPDATE_KEY:h,ON_BEFORE_MOUNT_KEY:p,ON_MOUNTED_KEY:m,ON_BEFORE_UPDATE_KEY:g,ON_UPDATED_KEY:b,ON_BEFORE_UNMOUNT_KEY:v,ON_UNMOUNTED_KEY:y,PROPS_KEY:_,STATE_KEY:w,SLOTS_KEY:x,ROOT_KEY:T,IS_PURE_SYMBOL:A,PARENT_KEY_SYMBOL:E,ATTRIBUTES_KEY_SYMBOL:M,TEMPLATE_KEY_SYMBOL:S}),k={EACH:0,IF:1,SIMPLE:2,TAG:3,SLOT:4},C={ATTRIBUTE:0,EVENT:1,TEXT:2,VALUE:3};function D(t,e){return typeof t===e}function L(t){const e=t.ownerSVGElement;return!!e||null===e}function O(t){return!P(t.content)}function I(t){return D(t,"function")}function B(t){return!P(t)&&D(t,"object")}function P(t){return null==t}const j=Symbol("unmount"),R={nodes:[],mount(t,e){return this.update(t,e)},update(t,e){const{placeholder:n,nodes:r,childrenMap:a}=this,s=t===j?null:this.evaluate(t),l=s?Array.from(s):[],{newChildrenMap:c,batches:u,futureNodes:d}=(n.parentNode,function(t,e,n,r){const{condition:i,template:o,childrenMap:a,itemName:s,getKey:l,indexName:c,root:u,isTemplateTag:d}=r,f=new Map,h=[],p=[];return t.forEach(((t,r)=>{const m=function(t,e){let{itemName:n,indexName:r,index:i,item:o}=e;return t[n]=o,r&&(t[r]=i),t}(Object.create(e),{itemName:s,indexName:c,index:r,item:t}),g=l?l(m):r,b=a.get(g);if(function(t,e){return!!t&&!1===Boolean(t(e))}(i,m))return;const v=b?b.template:o.clone(),y=b?v.el:u.cloneNode(),_=!b,w=d&&_?function(t){const e=t.dom.cloneNode(!0);return{avoidDOMInjection:!0,fragment:e,children:Array.from(e.childNodes)}}(v):{};if(_?h.push((()=>v.mount(y,m,n,w))):h.push((()=>v.update(m,n))),d){const t=w.children||v.children;p.push(...t)}else p.push(y);a.delete(g),f.set(g,{template:v,context:m,index:r})})),{newChildrenMap:f,batches:h,futureNodes:p}}(l,t,e,this));return((t,e,n,r,a)=>{const s=n.length;let l=e.length,c=s,u=0,d=0,f=null;for(;ut-d){const i=r(e[u],0);for(;d{if(r<0){const n=t.pop();if(n){const{template:t,context:r}=n;t.unmount(r,e,null)}}return n}}(Array.from(a.values()),e),n),u.forEach((t=>t())),this.childrenMap=c,this.nodes=d,this},unmount(t,e){return this.update(j,e),this}},q={mount(t,e){return this.update(t,e)},update(t,e){const n=!!this.evaluate(t),r=!this.value&&n,i=this.value&&!n,a=()=>{const n=this.node.cloneNode();o(n,this.placeholder),this.template=this.template.clone(),this.template.mount(n,t,e)};switch(!0){case r:a();break;case i:this.unmount(t);break;default:n&&this.template.update(t,e)}return this.value=n,this},unmount(t,e){return this.template.unmount(t,e,!0),this}};function F(t){throw new Error(t)}function z(t){return t.reduce(((t,n)=>{const{value:r,type:i}=n;switch(!0){case!n.name&&0===i:return Object.assign({},t,r);case 3===i:t.value=n.value;break;default:t[e(n.name)]=n.value}return t}),{})}const U="undefined"==typeof Element?{}:Element.prototype,V=function(t){const e=new Map,n=n=>(e.has(n)||e.set(n,t.call(this,n)))&&e.get(n);return n.cache=e,n}((t=>U.hasOwnProperty(t)));const H=/^on/,G={handleEvent(t){this[t.type](t)}},Y=new WeakMap;function W(t){return P(t)?"":t}const $=(t,e)=>{const n=t.childNodes[e];if(n.nodeType===Node.COMMENT_NODE){const e=document.createTextNode("");return t.replaceChild(e,n),e}return n};var K={0:function t(e,n,r,i){let{name:o}=n;if(!o)return i&&function(t,e,n){const r=e?Object.keys(e):[];Object.keys(n).filter((t=>!r.includes(t))).forEach((e=>t.removeAttribute(e)))}(e,r,i),void(r&&function(e,n){Object.entries(n).forEach((n=>{let[r,i]=n;return t(e,{name:r},i)}))}(e,r));!V(o)&&(function(t){return D(t,"boolean")}(r)||B(r)||I(r))&&(e[o]=r),e[function(t){return P(t)||!1===t||""===t||B(t)||I(t)?"removeAttribute":"setAttribute"}(r)](o,function(t,e){return!0===e?t:e}(o,r))},1:function(t,e,n){let{name:r}=e;const i=r.replace(H,""),o=Y.get(t)||(t=>{const e=Object.create(G);return Y.set(t,e),e})(t),[a,s]=(t=>Array.isArray(t)?t:[t,!1])(n),l=o[i],c=a&&!l;l&&!a&&t.removeEventListener(i,o),c&&t.addEventListener(i,o,s),o[i]=a},2:function(t,e,n){t.data=W(n)},3:function(t,e,n){t.value=W(n)}};const X={mount(t){return this.value=this.evaluate(t),Q(this,this.value),this},update(t){const e=this.evaluate(t);return this.value!==e&&(Q(this,e),this.value=e),this},unmount(){return 1===this.type&&Q(this,null),this}};function Q(t,e){return K[t.type](t.node,t,e,t.value)}function Z(t,e){return Object.assign({},X,e,{node:2===e.type?$(t,e.childNodeIndex):t})}const J=(t,e)=>t[E]||e,tt={attributes:[],getTemplateScope(t,e){return function(t,e,n){if(!t||!t.length)return n;const r=t.map((t=>Object.assign({},t,{value:t.evaluate(e)})));return Object.assign(Object.create(n||null),z(r))}(this.attributes,t,e)},mount(t,e){const n=!!t.slots&&t.slots.find((t=>{let{id:e}=t;return e===this.name})),{parentNode:r}=this.node,o=J(t,e);return this.template=n&&ct(n.html,n.bindings).createDOM(r),this.template&&(this.template.mount(this.node,this.getTemplateScope(t,o),o),this.template.children=Array.from(this.node.childNodes),et(this.node)),i(this.node),this},update(t,e){if(this.template){const n=J(t,e);this.template.update(this.getTemplateScope(t,n),n)}return this},unmount(t,e,n){return this.template&&this.template.unmount(this.getTemplateScope(t,e),null,n),this}};function et(t){const e=t&&t.firstChild;e&&(o(e,t),et(t))}function nt(t){return t.reduce(((t,e)=>{let{bindings:n}=e;return t.concat(n)}),[])}const rt={mount(t){return this.update(t)},update(t,e){const n=this.evaluate(t);return n===this.name?this.tag.update(t):(this.unmount(t,e,!0),this.name=n,this.tag=function(t,e,n){return void 0===e&&(e=[]),void 0===n&&(n=[]),t?t({slots:e,attributes:n}):ct(function(t){return t.reduce(((t,e)=>t+e.html),"")}(e),[...nt(e),{expressions:n.map((t=>Object.assign({type:0},t)))}])}(this.getComponent(n),this.slots,this.attributes),this.tag.mount(this.node,t)),this},unmount(t,e,n){return this.tag&&this.tag.unmount(n),this}};var it={1:function(t,e){let{evaluate:n,template:r}=e;const a=document.createTextNode("");return o(a,t),i(t),Object.assign({},q,{node:t,evaluate:n,placeholder:a,template:r.createDOM(t)})},2:function(t,e){let{expressions:n}=e;return Object.assign({},(r=n.map((e=>Z(t,e))),["mount","update","unmount"].reduce(((t,e)=>Object.assign({},t,{[e]:t=>r.map((n=>n[e](t)))&&undefined})),{})));var r},0:function(t,e){let{evaluate:n,condition:r,itemName:a,indexName:s,getKey:l,template:c}=e;const u=document.createTextNode(""),d=t.cloneNode();return o(u,t),i(t),Object.assign({},R,{childrenMap:new Map,node:t,root:d,condition:r,evaluate:n,isTemplateTag:O(d),template:c.createDOM(t),getKey:l,indexName:s,itemName:a,placeholder:u})},3:function(t,e){let{evaluate:n,getComponent:r,slots:i,attributes:o}=e;return Object.assign({},rt,{node:t,evaluate:n,slots:i,attributes:o,getComponent:r})},4:function(t,e){let{name:n,attributes:r}=e;return Object.assign({},tt,{attributes:r,node:t,name:n})}};function ot(t,e){return t.map((t=>2===t.type?Object.assign({},t,{childNodeIndex:t.childNodeIndex+e}):t))}function at(t,e,n){const{selector:r,type:i,redundantAttribute:o,expressions:a}=e,s=r?t.querySelector(r):t;o&&s.removeAttribute(o);const l=a||[];return(it[i]||it[2])(s,Object.assign({},e,{expressions:n&&!r?ot(l,n):l}))}function st(t,e){switch(!0){case L(t):n(e,t);break;case O(t):t.parentNode.replaceChild(e,t);break;default:t.appendChild(e)}}const lt=Object.freeze({createDOM(t){return this.dom=this.dom||function(t,e){return e&&("string"==typeof e?function(t,e){return L(t)?function(t,e){return e.ownerDocument.importNode((new window.DOMParser).parseFromString(`${t}`,"application/xml").documentElement,!0)}(e,t):function(t,e){const n=O(e)?e:document.createElement("template");return n.innerHTML=t,n.content}(e,t)}(t,e):e)}(t,this.html),this},mount(t,e,n,r){if(void 0===r&&(r={}),!t)throw new Error("Please provide DOM node to mount properly your template");this.el&&this.unmount(e);const{fragment:i,children:o,avoidDOMInjection:a}=r,{parentNode:s}=o?o[0]:t,l=O(t),c=l?Math.max(Array.from(s.childNodes).indexOf(t),0):null;return this.isTemplateTag=l,this.createDOM(t),this.dom&&(this.fragment=i||this.dom.cloneNode(!0)),this.el=this.isTemplateTag?s:t,this.children=this.isTemplateTag?o||Array.from(this.fragment.childNodes):null,!a&&this.fragment&&st(t,this.fragment),this.bindings=this.bindingsData.map((t=>at(this.el,t,c))),this.bindings.forEach((t=>t.mount(e,n))),this},update(t,e){return this.bindings.forEach((n=>n.update(t,e))),this},unmount(t,e,n){if(this.el){switch(this.bindings.forEach((r=>r.unmount(t,e,n))),!0){case this.el[A]:break;case this.children&&null!==n:r(this.children);break;case!0===n:i(this.el);break;case null!==n:r(this.el.childNodes)}this.el=null}return this},clone(){return Object.assign({},this,{el:null})}});function ct(t,e){return void 0===e&&(e=[]),Object.assign({},lt,{html:t,bindingsData:e})}var ut=Object.freeze({__proto__:null,template:ct,createBinding:at,createExpression:Z,bindingTypes:k,expressionTypes:C});function dt(){return this}function ft(t){return I(t)?t.prototype&&t.prototype.constructor?new t:t():t}function ht(t,e,n,r){return void 0===r&&(r={}),Object.defineProperty(t,e,Object.assign({value:n,enumerable:!1,writable:!1,configurable:!0},r)),t}function pt(t,e,n){return Object.entries(e).forEach((e=>{let[r,i]=e;ht(t,r,i,n)})),t}function mt(t,e){return Object.entries(e).forEach((e=>{let[n,r]=e;t[n]||(t[n]=r)})),t}function gt(t){return Array.isArray(t)?t:/^\[object (HTMLCollection|NodeList|Object)\]$/.test(Object.prototype.toString.call(t))&&"number"==typeof t.length?Array.from(t):[t]}function bt(t,e){return gt("string"==typeof t?(e||document).querySelectorAll(t):t)}const vt=t=>1===t.length?t[0]:t;function yt(t,e,n){const r="object"==typeof e?e:{[e]:n},i=Object.keys(r);return gt(t).forEach((t=>{i.forEach((e=>t.setAttribute(e,r[e])))})),t}const _t=new Map;var wt,xt={CSS_BY_NAME:_t,add(t,e){return _t.has(t)||(_t.set(t,e),this.inject()),this},inject(){return(wt||(yt(wt=bt("style[riot]")[0]||document.createElement("style"),"type","text/css"),wt.parentNode||document.head.appendChild(wt),wt)).innerHTML=[..._t.values()].join("\n"),this},remove(t){return _t.has(t)&&(_t.delete(t),this.inject()),this}};function Tt(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;rvt(r.map((e=>t.getAttribute(e)))))))}(t,e)}(t,c)||t.tagName.toLowerCase()}const Et=Object.freeze({$(t){return bt(t,this.root)[0]},$$(t){return bt(t,this.root)}}),Mt=Object.freeze({[u]:dt,[d]:dt,[f]:dt}),St=Object.freeze({[h]:dt,[p]:dt,[m]:dt,[g]:dt,[b]:dt,[v]:dt,[y]:dt}),Nt=Object.assign({},Mt,{clone:dt,createDOM:dt});function kt(t,n){return void 0===n&&(n={}),Object.assign({},function(t){return Array.from(t.attributes).reduce(((t,n)=>(t[e(n.name)]=n.value,t)),{})}(t),ft(n))}const Ct=(t,e)=>t[s]=e;function Dt(t){return[u,d,f].reduce(((e,n)=>(e[n]=t(n),e)),{})}function Lt(t){let{css:e,template:n,exports:r,name:i}=t;const o=n?function(t,e){return t(ct,C,k,(t=>e[t]||a.get(t)))}(n,r?(void 0===(s=r.components)&&(s={}),Object.entries(ft(s)).reduce(((t,e)=>{let[n,r]=e;var i;return t[(i=n,i.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase())]=Lt(r),t}),{})):{}):Nt;var s;return t=>{let{slots:a,attributes:s,props:l}=t;if(r&&r[A])return function(t,e){let{slots:n,attributes:r,props:i,css:o,template:a}=e;a&&F("Pure components can not have html"),o&&F("Pure components do not have css");const s=mt(t({slots:n,attributes:r,props:i}),Mt);return Dt((t=>function(){for(var e=arguments.length,n=new Array(e),r=0;rd.mount(t,n,e),update:(t,e)=>d.update(e,t),unmount:t=>d.unmount(t)}}}function Ot(t){let{css:e,template:n,componentAPI:r,name:i}=t;return e&&i&&xt.add(i,e),Tt(Bt)(pt(mt(r,Object.assign({},St,{[w]:{}})),Object.assign({[x]:null,[T]:null},Et,{name:i,css:e,template:n})))}function It(t,e){return Object.assign({},t,ft(e))}function Bt(t,e){let{slots:n,attributes:r,props:i}=e;return o=function(t){return[...l].reduce(((t,e)=>e(t)||t),t)}(pt(Object.create(t),{mount(e,o,a){return void 0===o&&(o={}),this[M]=function(t,e){void 0===e&&(e=[]);const n=e.map((e=>Z(t,e))),r={};return Object.assign(r,Object.assign({expressions:n},Dt((t=>e=>(n.forEach((n=>n[t](e))),r)))))}(e,r).mount(a),ht(this,_,Object.freeze(Object.assign({},kt(e,i),z(this[M].expressions)))),this.state=It(this.state,o),this[S]=this.template.createDOM(e).clone(),Ct(e,this),t.name&&function(t,e){At(t)!==e&&yt(t,c,e)}(e,t.name),ht(this,T,e),ht(this,x,n),this.onBeforeMount(this.props,this.state),this[E]=a,this[S].mount(e,this,a),this.onMounted(this.props,this.state),this},update(t,e){void 0===t&&(t={}),e&&(this[E]=e,this[M].update(e));const n=z(this[M].expressions);if(!1!==this.shouldUpdate(n,this.props))return ht(this,_,Object.freeze(Object.assign({},this.props,n))),this.state=It(this.state,t),this.onBeforeUpdate(this.props,this.state),this[S].update(this,this[E]),this.onUpdated(this.props,this.state),this},unmount(t){return this.onBeforeUnmount(this.props,this.state),this[M].unmount(),this[S].unmount(this,this[E],null===t?null:!t),this.onUnmounted(this.props,this.state),this}})),Object.keys(t).filter((e=>I(t[e]))).forEach((t=>{o[t]=o[t].bind(o)})),o;var o}const{DOM_COMPONENT_INSTANCE_PROPERTY:Pt,COMPONENTS_IMPLEMENTATION_MAP:jt,PLUGINS_SET:Rt}=N,qt={cssManager:xt,DOMBindings:ut,createComponent:Lt,defineComponent:Ot,globals:N};t.__=qt,t.component=function(t){return function(e,n,r){let{slots:i,attributes:o,parentScope:a}=void 0===r?{}:r;return function(){for(var t=arguments.length,e=new Array(t),n=0;nfunction(){return t(e(...arguments))}))}((t=>t.mount(e,a)),(t=>t({props:n,slots:i,attributes:o})),Lt)(t)}},t.install=function(t){return I(t)||F("Plugins must be of type function"),Rt.has(t)&&F("This plugin was already installed"),Rt.add(t),Rt},t.mount=function(t,e,n){return bt(t).map((t=>function(t,e,n){const r=n||At(t);return a.has(r)||F(`The component named "${r}" was never registered`),a.get(r)({props:e}).mount(t)}(t,e,n)))},t.pure=function(t){return I(t)||F('riot.pure accepts only arguments of type "function"'),t[A]=!0,t},t.register=function(t,e){let{css:n,template:r,exports:i}=e;return jt.has(t)&&F(`The component "${t}" was already registered`),jt.set(t,Lt({name:t,css:n,template:r,exports:i})),jt},t.uninstall=function(t){return Rt.has(t)||F("This plugin was never installed"),Rt.delete(t),Rt},t.unmount=function(t,e){return bt(t).map((t=>(t[Pt]&&t[Pt].unmount(e),t)))},t.unregister=function(t){return jt.has(t)||F(`The component "${t}" was never registered`),jt.delete(t),xt.remove(t),jt},t.version="v5.1.2",Object.defineProperty(t,"__esModule",{value:!0})},"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).riot={}),function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("./components/route-hoc.riot"),require("./components/router-hoc.riot")):"function"==typeof define&&define.amd?define(["exports","./components/route-hoc.riot","./components/router-hoc.riot"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).route={},t.routeHoc_riot,t.routerHoc_riot)}(this,(function(t,e,n){"use strict";function r(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var i=r(e),o=r(n);function a(t,e){void 0===e&&(e={});for(var n=function(t){for(var e=[],n=0;n=48&&l<=57||l>=65&&l<=90||l>=97&&l<=122||95===l))break;a+=t[s++]}if(!a)throw new TypeError("Missing parameter name at "+n);e.push({type:"NAME",index:n,value:a}),n=s}else e.push({type:"CLOSE",index:n,value:t[n++]});else e.push({type:"OPEN",index:n,value:t[n++]});else e.push({type:"ESCAPED_CHAR",index:n++,value:t[n++]});else e.push({type:"MODIFIER",index:n,value:t[n++]})}return e.push({type:"END",index:n,value:""}),e}(t),r=e.prefixes,i=void 0===r?"./":r,o="[^"+l(e.delimiter||"/#?")+"]+?",a=[],s=0,c=0,u="",d=function(t){if(c-1:void 0===x;i||(m+="(?:"+p+"(?="+h+"))?"),T||(m+="(?="+p+"|"+h+")")}return new RegExp(m,c(n))}(a(t,n),e,n)}function d(t,e,n){return t instanceof RegExp?function(t,e){if(!e)return t;var n=t.source.match(/\((?!\?)/g);if(n)for(var r=0;rfunction e(r,i){if(!r.length)return t(i);const[o,...a]=r,s="function"==typeof o?o(i):o,l=t=>e(a,t);if(null!=s){if(s===f)return;if(s.then)return s.then(l,n)}return Promise.resolve(l(s))}(e)))}h.cancel=()=>f,h.compose=function(){for(var t=arguments.length,e=new Array(t),n=0;n{n(e)===m&&t.delete(n)})),t}function v(t){throw new Error(t)}function y(){for(var t=arguments.length,e=new Array(t),n=0;ne=>t.add(e)&&l,u=t=>e=>t.delete(e)?l:v("Couldn't remove handler passed by reference");return Object.assign(l,{on:Object.freeze({value:c(r),error:c(i),end:c(o)}),off:Object.freeze({value:u(r),error:u(i),end:u(o)}),connect:c(a),push(t){const{value:e,done:n}=l.next(t);return n||e.then((t=>b(r,t)),(t=>b(i,t))),l},end:()=>(s.return(),b(o),[r,i,o,a].forEach((t=>t.clear())),l),fork:()=>y(...a),next(t){const e=s.next(t);return s.next(),e}})}y.install=function(t,e){return t&&"string"==typeof t||v("Please provide a name (as string) for your erre plugin"),e&&"function"==typeof e||v("Please provide a function for your erre plugin"),p.has(t)?v(`The ${t} is already part of the erre API, please provide a different name`):(y[t]=e,p.add(t)),y},y.install("cancel",h.cancel),y.install("off",(()=>m));const _="undefined"!=typeof process,w=t=>t.replace(M.base,""),x=t=>e=>k(e,t)?e:y.cancel(),T=t=>{if(!M.silentErrors)throw new Error(t)},A=t=>(t=>"string"==typeof t)(t)?t:y.cancel(),E=y(A).on.error(T),M={base:"",silentErrors:!1,sensitive:!1,strict:!1,end:!0,start:!0,delimiter:"/#?",encode:void 0,endsWith:void 0,prefixes:"./"},S=t=>Object.assign({},M,t),N=function(t,e,n){void 0===n&&(n={});const{base:r}=S(n),[,...i]=e.exec(t),o=function(){for(var t=arguments.length,e=new Array(t),n=0;n{const i=n.keys&&n.keys[r];return i&&(t[i.name]=e),t}),{}),o},k=(t,e)=>e.test(t),C=(t,e)=>[w,x(t),n=>N(n,t,e)];const D=(L=null,E.on.value((t=>L=t)),()=>L);var L;const O="popstate",I="click",B="/",P=/^.+?\/\/+[^/]+/;function j(t){return Array.isArray(t)?t:/^\[object (HTMLCollection|NodeList|Object)\]$/.test(Object.prototype.toString.call(t))&&"number"==typeof t.length?Array.from(t):[t]}function R(t,e,n,r,i){var o;t=j(t),(o=e,o.split(/\s/)).forEach((e=>{t.forEach((t=>t[r](e,n,i||!1)))}))}function q(t,e,n,r){return R(t,e,n,"addEventListener",r),t}function F(t,e,n,r){return R(t,e,n,"removeEventListener",r),t}const z=()=>"undefined"==typeof window?null:window,U=()=>"undefined"==typeof document?null:document,V=()=>{const t=z();return t?t.location:{}},H=t=>1===t.length?t[0]:t;function G(t,e){return function(t,e,n){const r="string"==typeof e?[e]:e;return H(j(t).map((t=>H(r.map((e=>t[n](e)))))))}(t,e,"hasAttribute")}const Y=()=>E.push(Q(String(V().href))),W=t=>{const e=t.includes(M.base)?t:M.base+t,n=V(),r="undefined"==typeof history?null:history,i=U();r&&e!==n.href&&r.pushState(null,i.title,e)},$=t=>t&&!K(t)?$(t.parentNode):t,K=t=>"A"===t.nodeName,X=t=>!t||!K(t)||G(t,"download")||!G(t,"href")||(t=>t.target&&"_self"!==t.target)(t)||-1===t.href.indexOf(V().href.match(P)[0]),Q=t=>t.replace(M.base,""),Z=t=>{if((t=>t.which&&1!==t.which||t.metaKey||t.ctrlKey||t.shiftKey||t.defaultPrevented)(t))return;const e=$(t.target);if(X(e)||(t=>t.split("#").length>1)(e.href)||!(t=>!M.base||t.includes(M.base))(e.href))return;const n=Q(e.href);E.push(n),t.preventDefault()};const J=t=>t[t.length-1]===B?t.substr(0,t.length-1):t,tt=t=>{const e=z().location,n=e?`${e.protocol}//${e.host}`:"",{pathname:r}=e||{};switch(!0){case!1===Boolean(t):return J(`${n}${r||""}`);case/(www|http(s)?:)/.test(t):return t;case"#"===t[0]:return`${n}${r&&r!==B?r:""}${t}`;case t===B:return J(n);default:return J(`${n}${i=t,i[0]===B?i:"/"+i}`)}var i};Object.defineProperty(t,"Route",{enumerable:!0,get:function(){return i.default}}),Object.defineProperty(t,"Router",{enumerable:!0,get:function(){return o.default}}),t.createURLStreamPipe=C,t.filterStrings=A,t.getCurrentRoute=D,t.initDomListeners=function(t){const e=z(),n=t||U();return e&&(q(e,O,Y),q(n,I,Z)),E.on.value(W),()=>{e&&(F(e,O,Y),F(n,I,Z)),E.off.value(W)}},t.match=k,t.route=function(t,e){const n=[],r=d(t,n,e),i=y(...C(r,Object.assign({},e,{keys:n})));return(o=E,a=i,o.on.value(a.push),a.on.end((()=>{o.off.value(a.push)})),a).on.error(T);var o,a},t.router=E,t.setBase=function(t){M.base=tt(t)},t.toPath=(t,e,n)=>s(t,S(n))(e),t.toRegexp=(t,e,n)=>d(t,e,S(n)),t.toURL=N,Object.defineProperty(t,"__esModule",{value:!0})})),function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).cimDiagram=e()}(this,(function(){"use strict";const t=14,e=d3.scaleSequential([0,500],d3.interpolateTurbo);let n=null,r="ConnectivityNode",i="ConnectivityNode.Terminals",o="Terminal.ConnectivityNode";return{css:'cimdiagram .app-diagram,[is="cimdiagram"] .app-diagram{ max-height: 800px; } cimdiagram path.domain,[is="cimdiagram"] path.domain{ fill: none; stroke: black; } cimdiagram g.tick > line,[is="cimdiagram"] g.tick > line{ stroke: black; stroke-dasharray: 1 5; } cimdiagram svg,[is="cimdiagram"] svg{ width: 1200px; height: 800px; } cimdiagram line.highlight-x,[is="cimdiagram"] line.highlight-x,cimdiagram line.highlight-y,[is="cimdiagram"] line.highlight-y{ stroke: red; stroke-width: 1; } cimdiagram g.resize > rect,[is="cimdiagram"] g.resize > rect{ stroke: black; stroke-width: 2; }',exports:{onBeforeMount(t,e){n=this,n.props.dispatcher.on("showDiagram",(function(t,e,a){if(decodeURI(e)!==n.diagramName){"BUS_BRANCH"===n.props.model.getMode()&&(r="TopologicalNode",i="TopologicalNode.Terminal",o="Terminal.TopologicalNode"),n.render(e)}void 0!==a?(n.moveTo(a),n.props.dispatcher.trigger("moveTo",a)):n.props.dispatcher.trigger("deselect")})),n.props.dispatcher.on("transform",(function(){let t=d3.zoomTransform(d3.select("svg").node()),e=t.x,n=t.y,r=t.k,i=parseInt(d3.select("svg").style("width")),o=parseInt(d3.select("svg").style("height")),a=d3.scaleLinear().domain([-e/r,(i-e)/r]).range([0,i]),s=d3.scaleLinear().domain([-n/r,(o-n)/r]).range([0,o]),l=d3.axisRight(s),c=d3.axisBottom(a);d3.select("svg").select("#diagram-yAxis").call(l),d3.select("svg").select("#diagram-xAxis").call(c)})),n.props.model.on("setAttribute",(function(t,e,r){switch(e){case"cim:IdentifiedObject.name":{let e=t.localName,i=n.props.model.ID(t);if("cim:BusbarSection"===t.nodeName){let r=n.props.model.getNode(t);if(null===r)return;e=r.localName,i=n.props.model.ID(r)}d3.select("svg").selectAll("svg > g#diagram-main > g."+e+"s").select("#cimdiagram-"+i).select("text").html(r);break}case"cim:AnalogValue.value":{let e=n.props.model.getTargets([t],"AnalogValue.Analog"),r=n.props.model.getTargets(e,"Measurement.PowerSystemResource")[0];"cim:BusbarSection"===r.nodeName&&(r=n.props.model.getNode(r));let i=n.props.model.ID(r),o=d3.select("g#cimdiagram-"+i);n.createStatusInfo(o);break}case"cim:SvPowerFlow.p":case"cim:SvPowerFlow.q":{let e=n.props.model.getTargets([t],"SvPowerFlow.Terminal")[0];if(void 0!==e){let t=n.props.model.getTargets([e],"Terminal.ConductingEquipment")[0],r=n.props.model.ID(t),i=d3.select("g#cimdiagram-"+r);n.createStatusInfo(i)}break}case"cim:BaseVoltage.nominalVoltage":{n.drawLegend();const e=n.props.model.getTargets([t],"BaseVoltage.ConductingEquipment"),r=e.filter((function(t){return!0===n.props.model.schema.isA("ACLineSegment",t)}));n.drawACLines(r);let i=e.filter((function(t){return!0===n.props.model.schema.isA("BusbarSection",t)})).map((t=>n.props.model.getNode(t)));n.drawNodes(i);const o=n.props.model.getTargets([t],"BaseVoltage.TransformerEnds");for(const t of o){const e=n.getTermNode(t);null!==e&&n.handlePowerTransformerEnds(e)}break}}if("cim:Analog"===t.nodeName||"cim:Discrete"===t.nodeName){let e=n.props.model.getTargets([t],"Measurement.PowerSystemResource")[0];if(void 0!==e){"cim:BusbarSection"===e.nodeName&&(e=n.props.model.getNode(e));let t=n.props.model.ID(e),r=d3.select("g#cimdiagram-"+t);n.createStatusInfo(r)}}if("cim:OperationalLimitSet"===t.nodeName){let e=n.props.model.getTargets([t],"OperationalLimitSet.Equipment"),r=n.props.model.getTargets([t],"OperationalLimitSet.Terminal");if(e=e.concat(n.props.model.getTargets(r,"Terminal.ConductingEquipment"))[0],void 0!==e){"cim:BusbarSection"===e.nodeName&&(e=n.props.model.getNode(e));let t=n.props.model.ID(e),r=d3.select("g#cimdiagram-"+t);n.createStatusInfo(r)}}})),n.props.model.on("setEnum",(function(t,e,r){if("cim:Analog"===t.nodeName||"cim:Discrete"===t.nodeName){let e=n.props.model.getTargets([t],"Measurement.PowerSystemResource")[0];if(void 0!==e){"cim:BusbarSection"===e.nodeName&&(e=n.props.model.getNode(e));let t=n.props.model.ID(e),r=d3.select("g#cimdiagram-"+t);n.createStatusInfo(r)}}switch(e){case"cim:PowerTransformerEnd.connectionKind":{const e=n.getTermNode(t);null!==e&&n.handlePowerTransformerEnds(e);break}}})),n.props.model.on("updateActiveDiagram",(function(t){let e=null;switch(t.nodeName){case"cim:ACLineSegment":e=n.drawACLines([t])[0],n.createTerminals(e);break;case"cim:"+r:n.drawNodes([t])}let i=t.localName,o=n.props.model.ID(t),a=d3.select("svg").selectAll("svg > g#diagram-main > g."+i+"s").select("#cimdiagram-"+o);n.forceTick(a)})),n.props.model.on("addToActiveDiagram",(function(t){let e=null;switch(t.nodeName){case"cim:ACLineSegment":e=n.drawACLines([t])[1];break;case"cim:Breaker":e=n.drawBreakers([t]);break;case"cim:Disconnector":e=n.drawDisconnectors([t]);break;case"cim:LoadBreakSwitch":e=n.drawLoadBreakSwitches([t]);break;case"cim:Junction":e=n.drawJunctions([t]);break;case"cim:EnergySource":e=n.drawEnergySources([t]);break;case"cim:SynchronousMachine":e=n.drawSynchronousMachines([t]);break;case"cim:AsynchronousMachine":e=n.drawAsynchronousMachines([t]);break;case"cim:EnergyConsumer":e=n.drawEnergyConsumers([t]);break;case"cim:ConformLoad":e=n.drawConformLoads([t]);break;case"cim:NonConformLoad":e=n.drawNonConformLoads([t]);break;case"cim:EquivalentInjection":e=n.drawEquivalentInjections([t]);break;case"cim:LinearShuntCompensator":e=n.drawLinearCompensators([t]);break;case"cim:NonlinearShuntCompensator":e=n.drawNonlinearCompensators([t]);break;case"cim:PowerTransformer":e=n.drawPowerTransformers([t]);break;case"cim:"+r:e=n.drawNodes([t]),i(t,null)}if(null!==e&&function(e){let r=n.props.model.getTerminals([t]);for(let t of r){let e=n.props.model.getTargets([t],o)[0];if(void 0!==e){let t=n.props.model.getEquipments(e),r=t.filter((t=>"BusbarSection"===t.localName))[0];if(t=t.filter((t=>t!==r)),t.length>1){n.drawNodes([e]);let r=n.props.model.getTerminals(t);for(let t of r){if(n.props.model.getTargets([t],o)[0]===e){let r={source:e,target:t};n.createEdges([r])}}}}}n.createTerminals(e)}(e),"cim:BusbarSection"===t.nodeName){let r=n.props.model.getTargets([t],"ConductingEquipment.Terminals"),a=n.props.model.getTargets(r,o)[0];e=n.drawNodes([a]),i(a,t)}function i(t,e){let r=n.props.model.getEquipments(t).filter((t=>t!==e)),i=n.props.model.getTerminals(r);for(let e of i){if(void 0===e.x)continue;if(n.props.model.getTargets([e],o)[0]===t){let r={source:t,target:e};n.createEdges([r])}}}null!==e&&(n.forceTick(e),n.props.dispatcher.trigger("addToDiagram",e))})),n.props.model.on("addLink",(function(t,e,a){switch(e){case"cim:"+o:case"cim:"+i:{let e=void 0,i=void 0;if("cim:Terminal"===a.nodeName&&t.nodeName==="cim:"+r)e=t,i=a;else{if("cim:Terminal"!==t.nodeName||a.nodeName!=="cim:"+r)return;i=t,e=a}let o=d3.select("svg").selectAll("svg > g#diagram-main > g.edges > g").data().filter((t=>t.target===i))[0];if(void 0===o){let t=n.props.model.getTargets([i],"Terminal.ConductingEquipment");n.props.model.getDiagramObjects(t).length>0&&(o={source:e,target:i},n.createEdges([o]))}else o.source=e;let s=n.props.model.ID(e),l=d3.select("svg > g#diagram-main > g."+r+"s > g#cimdiagram-"+s);n.forceTick(l);break}case"cim:Terminal.SvPowerFlow":case"cim:SvPowerFlow.Terminal":{let e=a;if("cim:Terminal"===t.nodeName&&(e=t),void 0!==e){let t=n.props.model.getTargets([e],"Terminal.ConductingEquipment")[0],r=n.props.model.ID(t),i=d3.select("g#cimdiagram-"+r);n.createStatusInfo(i)}break}case"cim:Measurement.Terminal":case"cim:ACDCTerminal.Measurements":{let e=a;"cim:Terminal"===t.nodeName&&(e=t);let r=n.props.model.getTargets([e],"Terminal.ConductingEquipment")[0],i=n.props.model.ID(r),o=d3.select("g#cimdiagram-"+i);n.createStatusInfo(o);break}case"cim:Measurement.PowerSystemResource":case"cim:PowerSystemResource.Measurements":{let r=a;if("cim:PowerSystemResource.Measurements"===e&&(r=t),void 0!==r){"cim:BusbarSection"===r.nodeName&&(r=n.props.model.getNode(r));let t=n.props.model.ID(r),e=d3.select("g#cimdiagram-"+t);n.createStatusInfo(e)}break}case"cim:OperationalLimitSet.Terminal":case"cim:ACDCTerminal.OperationalLimitSet":{let e=a;"cim:Terminal"===t.nodeName&&(e=t);let r=n.props.model.getTargets([e],"Terminal.ConductingEquipment")[0],i=n.props.model.ID(r),o=d3.select("g#cimdiagram-"+i);n.createStatusInfo(o);break}case"cim:OperationalLimitSet.Equipment":case"cim:Equipment.OperationalLimitSet":{let r=a;if("cim:Equipment.OperationalLimitSet"===e&&(r=t),void 0!==r){"cim:BusbarSection"===r.nodeName&&(r=n.props.model.getNode(r));let t=n.props.model.ID(r),e=d3.select("g#cimdiagram-"+t);n.createStatusInfo(e)}break}case"cim:ConductingEquipment.BaseVoltage":case"cim:BaseVoltage.ConductingEquipment":case"cim:BaseVoltage.TransformerEnds":case"cim:TransformerEnd.BaseVoltage":n.updateColoring(t,e,a)}})),n.props.model.on("removeLink",(function(t,e,a){switch(e){case"cim:Measurement.PowerSystemResource":case"cim:PowerSystemResource.Measurements":{let r=a;if("cim:PowerSystemResource.Measurements"===e&&(r=t),void 0!==r){"cim:BusbarSection"===r.nodeName&&(r=n.props.model.getNode(r));let t=n.props.model.ID(r),e=d3.select("g#"+t);n.createStatusInfo(e)}break}case"cim:"+o:case"cim:"+i:{let e=void 0;if("cim:Terminal"===a.nodeName&&t.nodeName==="cim:"+r)e=a;else{if("cim:Terminal"!==t.nodeName||a.nodeName!=="cim:"+r)return;e=t}d3.select("svg").selectAll("svg > g#diagram-main > g.edges > g").filter((function(t){return t.target===e})).remove();break}case"cim:OperationalLimitSet.Terminal":case"cim:ACDCTerminal.OperationalLimitSet":{let e=a;"cim:Terminal"===t.nodeName&&(e=t);let r=n.props.model.getTargets([e],"Terminal.ConductingEquipment")[0];if(void 0!==r){let t=n.props.model.ID(r),e=d3.select("g#cimdiagram-"+t);n.createStatusInfo(e)}break}case"cim:OperationalLimitSet.Equipment":case"cim:Equipment.OperationalLimitSet":{let r=a;if("cim:Equipment.OperationalLimitSet"===e&&(r=t),void 0!==r&&("cim:BusbarSection"===r.nodeName&&(r=n.props.model.getNode(r)),null!==r)){let t=n.props.model.ID(r),e=d3.select("g#cimdiagram-"+t);n.createStatusInfo(e)}break}case"cim:ConductingEquipment.BaseVoltage":case"cim:BaseVoltage.ConductingEquipment":case"cim:BaseVoltage.TransformerEnds":case"cim:TransformerEnd.BaseVoltage":n.updateColoring(t,e,a)}})),n.props.model.on("deleteObject",(function(t,e){"BaseVoltage"===e&&n.drawLegend()}))},onMounted(){let t=d3.scaleLinear().domain([0,1200]).range([0,1200]),e=d3.scaleLinear().domain([0,800]).range([0,800]),r=d3.axisRight(e),i=d3.axisBottom(t);d3.select("svg").append("g").attr("id","diagram-yAxis").call(r),d3.select("svg").append("g").attr("id","diagram-xAxis").call(i),n.drawGrid(1)},render(t){let e=function*(t){d3.select("svg").select("g#diagram-main").selectAll("g:not(.edges)").remove(),n.props.model.selectDiagram(decodeURI(t)),n.diagramName=decodeURI(t);const e=n.props.model.getNodes();yield"DIAGRAM: extracted nodes";const r=n.props.model.getGraphicObjects(["cim:ACLineSegment","cim:Breaker","cim:Disconnector","cim:LoadBreakSwitch","cim:Junction","cim:EnergySource","cim:SynchronousMachine","cim:AsynchronousMachine","cim:EnergyConsumer","cim:ConformLoad","cim:NonConformLoad","cim:EquivalentInjection","cim:PowerTransformer","cim:BusbarSection","cim:LinearShuntCompensator","cim:NonlinearShuntCompensator"]),i=r["cim:ACLineSegment"],o=r["cim:Breaker"],a=r["cim:Disconnector"],s=r["cim:LoadBreakSwitch"],l=r["cim:Junction"],c=r["cim:EnergySource"],u=r["cim:SynchronousMachine"],d=r["cim:AsynchronousMachine"],f=r["cim:EnergyConsumer"],h=r["cim:ConformLoad"],p=r["cim:NonConformLoad"],m=r["cim:EquivalentInjection"],g=r["cim:PowerTransformer"];r["cim:BusbarSection"];const b=r["cim:LinearShuntCompensator"],v=r["cim:NonlinearShuntCompensator"];yield"DIAGRAM: extracted equipments";const y=n.drawACLines(i)[1];yield"DIAGRAM: drawn acLines";const _=n.drawBreakers(o);yield"DIAGRAM: drawn breakers";const w=n.drawDisconnectors(a);yield"DIAGRAM: drawn disconnectors";const x=n.drawLoadBreakSwitches(s);yield"DIAGRAM: drawn load break switches";const T=n.drawJunctions(l);yield"DIAGRAM: drawn junctions";const A=n.drawEnergySources(c);yield"DIAGRAM: drawn energy sources";const E=n.drawSynchronousMachines(u);yield"DIAGRAM: drawn synchronous machines";const M=n.drawAsynchronousMachines(d);yield"DIAGRAM: drawn asynchronous machines";const S=n.drawEnergyConsumers(f);yield"DIAGRAM: drawn energy consumers";const N=n.drawConformLoads(h);yield"DIAGRAM: drawn conform loads";const k=n.drawNonConformLoads(p);yield"DIAGRAM: drawn non conform loads";const C=n.drawEquivalentInjections(m);yield"DIAGRAM: drawn equivalent injections";const D=n.drawPowerTransformers(g);yield"DIAGRAM: drawn power transformers";const L=n.drawLinearCompensators(b);yield"DIAGRAM: drawn linear shunt compensators";const O=n.drawNonlinearCompensators(v);yield"DIAGRAM: drawn nonlinear shunt compensators";const I=n.drawNodes(e);n.createStatusInfo(I),yield"DIAGRAM: drawn connectivity nodes",n.createTerminals(y),n.createStatusInfo(y),yield"DIAGRAM: drawn acline terminals",n.createTerminals(_),n.createStatusInfo(_),yield"DIAGRAM: drawn breaker terminals",n.createTerminals(w),n.createStatusInfo(w),yield"DIAGRAM: drawn disconnector terminals",n.createTerminals(x),n.createStatusInfo(x),yield"DIAGRAM: drawn load break switch terminals",n.createTerminals(T),n.createStatusInfo(T),yield"DIAGRAM: drawn junction terminals",n.createTerminals(A),n.createStatusInfo(A),yield"DIAGRAM: drawn energy source terminals",n.createTerminals(E),n.createStatusInfo(E),yield"DIAGRAM: drawn synchronous machine terminals",n.createTerminals(M),n.createStatusInfo(M),yield"DIAGRAM: drawn asynchronous machine terminals",n.createTerminals(S),n.createStatusInfo(S),yield"DIAGRAM: drawn energy consumer terminals",n.createTerminals(N),n.createStatusInfo(N),yield"DIAGRAM: drawn conform load terminals",n.createTerminals(k),n.createStatusInfo(k),yield"DIAGRAM: drawn non conform load terminals",n.createTerminals(C),n.createStatusInfo(C),yield"DIAGRAM: drawn equivalent injection terminals",n.createTerminals(D),n.createStatusInfo(D),yield"DIAGRAM: drawn power transformer terminals",n.createTerminals(L),n.createStatusInfo(L),yield"DIAGRAM: drawn linear shunt compensator terminals",n.createTerminals(O),n.createStatusInfo(O),yield"DIAGRAM: drawn nonlinear shunt compensator terminals",n.drawLegend(),d3.select("svg").on("dragover",(function(t){t.preventDefault()})).on("drop",(function(t){t.preventDefault();const e=t.dataTransfer.getData("text/plain");if(void 0===e)return;const r=n.props.model.getObject(e);if(void 0===r)return;n.props.model.getDiagramObjects([r]).length>0?n.moveTo(e):addToDiagram(n.props.model,t,r)})),n.forceTick(),n.props.dispatcher.trigger("render")}(t);!function t(){let r=e.next().value;void 0!==r?(document.getElementById("loadingDiagramMsg").innerHTML="
"+r,setTimeout(t,1)):n.props.dispatcher.trigger("loaded")}()},createEdges(t){let e=d3.select("svg").select("g > g.edges").selectAll("g.edge").data(t,(function(t){return t.source.attributes[0].value+t.target.attributes[0].value})).enter().append("g").attr("class","edge").attr("id",(function(t){return t.source.attributes[0].value+t.target.attributes[0].value})).append("path").attr("fill","none").attr("stroke","black").attr("stroke-width",1);n.props.dispatcher.trigger("createEdges",e)},createStatusInfo(t){t.attr("data-bs-toggle","popover"),t.filter((function(t){return n.props.model.schema.isA("Switch",t)})).selectAll("path").attr("fill",(function(t){let e=n.props.model.getTargets([t],"PowerSystemResource.Measurements")[0];return"0"===n.getDiscreteValue(e)?"white":"black"})),t.each((function(t){let e=[],i=[],o=[],a=n.props.model.getTargets([t],"TopologicalNode.SvVoltage"),s=n.props.model.getTerminals([t]);if(t.nodeName==="cim:"+r){let r=n.props.model.getBusbar(t);if(null===r)return;s=n.props.model.getTerminals([r]),e=n.props.model.getTargets([r],"PowerSystemResource.Measurements"),o=n.props.model.getTargets([r],"Equipment.OperationalLimitSet")}else e=n.props.model.getTargets([t],"PowerSystemResource.Measurements"),o=n.props.model.getTargets([t],"Equipment.OperationalLimitSet");o=o.concat(n.props.model.getTargets(s,"ACDCTerminal.OperationalLimitSet"));for(let t of s){let e=n.props.model.getTargets([t],"Terminal.SvPowerFlow");i=i.concat(e)}if(e.length>0||i.length>0||a.length>0||o.length>0){let t=n.createTooltip(e,i,a,o);disposePopovers([this]),new bootstrap.Popover(this,{title:"Element Status Info",content:t,container:"body",html:!0,trigger:"manual",delay:{show:200,hide:0},placement:"auto"})}else disposePopovers([this])}))},getDiscreteValue(t){let e="0";if(void 0!==t){let r=n.props.model.getTargets([t],"Discrete.DiscreteValues")[0];if(void 0!==r){let t=n.props.model.getAttribute(r,"cim:DiscreteValue.value");void 0!==t&&(e=t.textContent)}}return e},createTooltip(t,e,r,i){let o="";if(t.length>0){o+="Measurements

";let e=[];for(let r of t){let t="unnamed",i="ABC",o="",a="no unit",s=n.props.model.getAttribute(r,"cim:IdentifiedObject.name"),l=n.props.model.getEnum(r,"cim:Measurement.phases"),c=n.props.model.getEnum(r,"cim:Measurement.unitMultiplier"),u=n.props.model.getEnum(r,"cim:Measurement.unitSymbol");void 0!==s&&(t=s.textContent),void 0!==l&&(i=l),void 0!==c&&(o=c,"none"===o&&(o="")),void 0!==u&&(a=u);let d=n.props.model.getTargets([r],"Analog.AnalogValues")[0],f="",h="n.a.";void 0!==d?void 0!==n.props.model.getAttribute(d,"cim:AnalogValue.value")&&(h=n.props.model.getAttribute(d,"cim:AnalogValue.value").textContent,h=parseFloat(h).toFixed(2)):(h=n.getDiscreteValue(r),h=parseInt(h));let p=n.props.model.ID(r),m=window.location.hash.split("/");f=f+""+t+"",f=f+" (phase: "+i+")",f+=": ",f+=h,f=f+" ["+o+a+"]",f+="
",e.push(f)}e.sort();for(let t in e)o+=e[t]}if(e.length>0){""!==o&&(o+="
"),o+="Power flow results (Power)

";for(let t of e){let e=0,r=0;void 0!==n.props.model.getAttribute(t,"cim:SvPowerFlow.p")&&(e=n.props.model.getAttribute(t,"cim:SvPowerFlow.p").textContent),void 0!==n.props.model.getAttribute(t,"cim:SvPowerFlow.q")&&(r=n.props.model.getAttribute(t,"cim:SvPowerFlow.q").textContent);let i="Active Power: "+parseFloat(e).toFixed(2)+" [MW]";i+="
",i=i+"Reactive power: "+parseFloat(r).toFixed(2)+" [MVAr]",i+="
",o+=i}}if(r.length>0){""!==o&&(o+="
"),o+="Power flow results (Voltage)

";for(let t of r){let e=0,r=0;void 0!==n.props.model.getAttribute(t,"cim:SvVoltage.v")&&(e=n.props.model.getAttribute(t,"cim:SvVoltage.v").textContent),void 0!==n.props.model.getAttribute(t,"cim:SvVoltage.angle")&&(r=n.props.model.getAttribute(t,"cim:SvVoltage.angle").textContent);let i="Voltage magnitude: "+parseFloat(e).toFixed(2)+" [kV]";i+="
",i=i+"Voltage angle: "+parseFloat(r).toFixed(2)+" [deg]",i+="
",o+=i}}if(i.length>0){""!==o&&(o+="
"),o+="Operational limit sets

";for(let t of i){let e="unnamed",r=n.props.model.getAttribute(t,"cim:IdentifiedObject.name");void 0!==r&&(e=r.textContent);let i=n.props.model.ID(t),a=window.location.hash.split("/");o+=""+e+"
"}}return o},createSelection(t,e){let r=t+"s";d3.select("svg").select("g."+r).empty()&&d3.select("svg").select("g#diagram-main").append("g").attr("class",r);for(let t of e)calcLineData(n.props.model,t);let i=d3.select("svg").select("g."+r).selectAll("g."+t).data(e,(function(t){return n.props.model.ID(t)})),o=i.enter().append("g").attr("class",t).attr("id",(function(t){return"cimdiagram-"+n.props.model.ID(t)}));return[i,o]},drawACLines(t){const e=d3.line().x((function(t){return t.x})).y((function(t){return t.y})),r=n.createSelection("ACLineSegment",t),i=r[0],o=r[1];function a(t){t.attr("x",(function(t){let e=d3.select(this.parentNode).select("path").node();return e.getPointAtLength(e.getTotalLength()/2).x+2})).attr("y",(function(t){let e=d3.select(this.parentNode).select("path").node();return e.getPointAtLength(e.getTotalLength()/2).y-2})).text((function(t){let e=n.props.model.getAttribute(t,"cim:IdentifiedObject.name");return void 0!==e?e.innerHTML:""}))}return o.append("path").attr("d",(function(t){return 1===t.lineData.length&&t.lineData.push({x:150,y:0,seq:2}),e(t.lineData)})).attr("fill","none").attr("stroke",(function(t){return n.voltageColor(t,"darkred")})).attr("stroke-width",2),o.append("text").attr("class","cim-object-text").attr("font-size",3),a(i.select("text")),a(o.select("text")),i.select("path").attr("d",(function(t){return 1===t.lineData.length&&t.lineData.push({x:150,y:0,seq:2}),e(t.lineData)})).attr("fill","none").attr("stroke",(function(t){return n.voltageColor(t,"darkred")})).attr("stroke-width",2),[i,o]},drawBreakers:t=>n.drawSwitches(t,"Breaker","green"),drawDisconnectors:t=>n.drawSwitches(t,"Disconnector","blue"),drawLoadBreakSwitches:t=>n.drawSwitches(t,"LoadBreakSwitch","black"),drawJunctions:t=>n.drawSwitches(t,"Junction","red"),drawSwitches(t,e,r){let i=d3.line().x((function(t){return t.x})).y((function(t){return t.y})).curve(d3.curveLinearClosed),o=n.createSelection(e,t)[1];return o.append("path").attr("d",(function(t){return i([{x:-5,y:-5,seq:1},{x:5,y:-5,seq:2},{x:5,y:5,seq:3},{x:-5,y:5,seq:4}])})).attr("fill",(function(t){let e=n.props.model.getTargets([t],"PowerSystemResource.Measurements")[0];return"0"===n.getDiscreteValue(e)?"white":"black"})).attr("stroke",r).attr("stroke-width",1),o.append("text").attr("class","cim-object-text").style("text-anchor","end").attr("font-size",3).attr("x",-10).attr("y",0).text((function(t){let e=n.props.model.getAttribute(t,"cim:IdentifiedObject.name");return void 0!==e?e.innerHTML:""})),o},drawEnergySources:t=>n.drawGenerators(t,"EnergySource"),drawSynchronousMachines:t=>n.drawGenerators(t,"SynchronousMachine"),drawAsynchronousMachines:t=>n.drawGenerators(t,"AsynchronousMachine"),drawEnergyConsumers:t=>n.drawLoads(t,"EnergyConsumer"),drawConformLoads:t=>n.drawLoads(t,"ConformLoad"),drawNonConformLoads:t=>n.drawLoads(t,"NonConformLoad"),drawEquivalentInjections:t=>n.drawLoads(t,"EquivalentInjection"),drawLinearCompensators:t=>n.drawCompensators(t,"LinearShuntCompensator"),drawNonlinearCompensators:t=>n.drawCompensators(t,"NonlinearShuntCompensator"),drawGenerators(t,e){let r=n.createSelection(e,t)[1],i="G";const o=Math.round(15);return"AsynchronousMachine"===e&&(i="M"),r.append("circle").attr("r",12.5).attr("cx",0).attr("cy",0).attr("fill","white").attr("stroke","black").attr("stroke-width",1),r.append("text").attr("class","cim-object-text").style("text-anchor","middle").attr("font-size",3).attr("x",17.5).attr("y",0).text((function(t){let e=n.props.model.getAttribute(t,"cim:IdentifiedObject.name");return void 0!==e?e.innerHTML:""})),r.append("text").style("text-anchor","middle").attr("font-size",o).attr("x",0).attr("y",6.25).text(i),r},drawLoads(t,e){let r=d3.line().x((function(t){return t.x})).y((function(t){return t.y})).curve(d3.curveLinearClosed),i=n.createSelection(e,t)[1];return i.append("path").attr("d",(function(t){return r([{x:-15,y:-10,seq:1},{x:15,y:-10,seq:2},{x:0,y:10,seq:3}])})).attr("fill","white").attr("stroke","black").attr("stroke-width",2),i.append("text").attr("class","cim-object-text").style("text-anchor","middle").attr("font-size",3).attr("x",0).attr("y",20).text((function(t){let e=n.props.model.getAttribute(t,"cim:IdentifiedObject.name");return void 0!==e?e.innerHTML:""})),i},drawCompensators(t,e){let r=d3.line().x((function(t){return t.x})).y((function(t){return t.y})),i=n.createSelection(e,t)[1];return i.append("path").attr("d",(function(t){return r([{x:0,y:-10,seq:1},{x:0,y:-4,seq:2}])})).attr("fill","white").attr("stroke","black").attr("stroke-width",1),i.append("path").attr("d",(function(t){return r([{x:0,y:4,seq:1},{x:0,y:10,seq:2}])})).attr("fill","white").attr("stroke","black").attr("stroke-width",1),i.append("path").attr("d",(function(t){return r([{x:-15,y:-4,seq:1},{x:15,y:-4,seq:2}])})).attr("fill","white").attr("stroke","black").attr("stroke-width",4),i.append("path").attr("d",(function(t){return r([{x:-15,y:4,seq:1},{x:15,y:4,seq:2}])})).attr("fill","white").attr("stroke","black").attr("stroke-width",4),i.append("text").attr("class","cim-object-text").style("text-anchor","middle").attr("font-size",3).attr("x",0).attr("y",20).text((function(t){let e=n.props.model.getAttribute(t,"cim:IdentifiedObject.name");return void 0!==e?e.innerHTML:""})),i},drawPowerTransformers(e){const r=this.createSelection("PowerTransformer",e)[1],i=r.filter((function(t){return 2===n.props.model.getTargets([t],"PowerTransformer.PowerTransformerEnd").length})),o=r.filter((function(t){return 3===n.props.model.getTargets([t],"PowerTransformer.PowerTransformerEnd").length}));return i.append("circle").attr("r",t).attr("cx",0).attr("cy",11).attr("fill","white").attr("stroke","black").attr("stroke-width",1),o.append("circle").attr("r",t).attr("cx",-11).attr("cy",11).attr("fill","white").attr("stroke","black").attr("stroke-width",1),o.append("circle").attr("r",t).attr("cx",11).attr("cy",11).attr("fill","white").attr("stroke","black").attr("stroke-width",1),i.append("g").attr("class","TransformerEnd").attr("transform",d3.zoomIdentity.translate(0,-11)).append("circle").attr("r",t).attr("cx",0).attr("cy",0).attr("fill","white").attr("stroke","black").attr("stroke-width",1).attr("class","TransformerEndCircle"),i.append("g").attr("class","TransformerEnd").attr("transform",d3.zoomIdentity.translate(0,11)).append("circle").attr("r",t).attr("cx",0).attr("cy",0).attr("fill","white").attr("fill-opacity","0").attr("stroke","black").attr("stroke-width",1).attr("class","TransformerEndCircle"),o.append("g").attr("class","TransformerEnd").attr("transform",d3.zoomIdentity.translate(0,-11)).append("circle").attr("r",t).attr("cx",0).attr("cy",0).attr("fill","white").attr("stroke","black").attr("stroke-width",1).attr("class","TransformerEndCircle"),o.append("g").attr("class","TransformerEnd").attr("transform",d3.zoomIdentity.translate(-11,11)).append("circle").attr("r",t).attr("cx",0).attr("cy",0).attr("fill","white").attr("fill-opacity","0").attr("stroke","black").attr("stroke-width",1).attr("class","TransformerEndCircle"),o.append("g").attr("class","TransformerEnd").attr("transform",d3.zoomIdentity.translate(11,11)).append("circle").attr("r",t).attr("cx",0).attr("cy",0).attr("fill","white").attr("fill-opacity","0").attr("stroke","black").attr("stroke-width",1).attr("class","TransformerEndCircle"),r.append("text").attr("class","cim-object-text").style("text-anchor","end").attr("font-size",3).attr("x",-25).attr("y",0).text((function(t){const e=n.props.model.getAttribute(t,"cim:IdentifiedObject.name");return void 0!==e?e.innerHTML:""})),r},handlePowerTransformerEnds(t){const e=d3.select(t).datum(),r=d3.select(t.parentNode).datum(),i=n.props.model.getTargets([e],"Terminal.TransformerEnd"),o=e.x-r.x,a=e.y-r.y;let s=null,l=null;d3.select(t.parentNode).selectAll(":scope > g.TransformerEnd").each((function(){const t=this.transform.baseVal.consolidate();let e={e:0,f:0};null!==t&&(e=t.matrix);const n=e.e,r=e.f,i=(n-o)**2+(r-a)**2;(null===s||s>i)&&(s=i,l=d3.select(this))})),l.data(i),l.attr("id",(function(){return"cimdiagram-"+n.props.model.ID(i[0])})),l.select("circle.TransformerEndCircle").attr("stroke",(function(t){return n.voltageColor(t,"black")})),l.selectAll("path").remove();const c=n.props.model.getEnum(i[0],"cim:PowerTransformerEnd.connectionKind");if(void 0!==c){const t=.2,e=.4,n=[0,a*t],r=[0,a*e],i=e-t,o=i*Math.sqrt(3)/2,s=i/2,u=[a*-o,a*(t-s)],d=[a*o,a*(t-s)];c.startsWith("Y")&&(l.append("path").attr("d",d3.line()([r,n])).attr("stroke","black"),l.append("path").attr("d",d3.line()([n,u])).attr("stroke","black"),l.append("path").attr("d",d3.line()([n,d])).attr("stroke","black")),"D"===c&&l.append("path").attr("d",d3.line().curve(d3.curveLinearClosed)([r,u,d])).attr("stroke","black").attr("fill","white")}},createTerminals(e){let r=0,i=30,a="none";switch(e.size()>0&&(a=e.data()[0].nodeName),a){case"cim:Breaker":case"cim:Disconnector":case"cim:LoadBreakSwitch":r=-6,i=6;break;case"cim:EnergySource":case"cim:SynchronousMachine":case"cim:AsynchronousMachine":r=-13.5;break;case"cim:EnergyConsumer":case"cim:ConformLoad":case"cim:NonConformLoad":case"cim:EquivalentInjection":r=-11;break;case"cim:PowerTransformer":r=-26,i=26;break;case"cim:LinearShuntCompensator":case"cim:NonlinearShuntCompensator":r=-11;break;default:i=30}let s=[],l=e.selectAll("g.Terminal").data((function(t){return n.props.model.getTerminals([t])})),c=l.enter().append("g").each((function(e,l){let c=n.props.model.getTargets([e],o)[0],u=d3.select(this.parentNode).datum().lineData,d=u[0],f=u[u.length-1],h=d3.select(this.parentNode).datum().x,p=d3.select(this.parentNode).datum().y;1===u.length&&(d={x:0,y:r},f={x:0,y:i});let m=d3.select(this.parentNode).datum().rotation,g=n.props.model.getTerminals(d3.select(this.parentNode).data());if(void 0!==c&&2===g.length){let t=0,r=0;if(m>0){let e=rotate(d,m),n=rotate(f,m);t=Math.pow(h+e.x-c.x,2)+Math.pow(p+e.y-c.y,2),r=Math.pow(h+n.x-c.x,2)+Math.pow(p+n.y-c.y,2)}else t=Math.pow(h+d.x-c.x,2)+Math.pow(p+d.y-c.y,2),r=Math.pow(h+f.x-c.x,2)+Math.pow(p+f.y-c.y,2);rt!==e))[0],u=n.props.model.getTargets([c],o)[0],d=c;if(void 0!==u){n.props.model.getEquipments(u).length>1&&(d=e)}c.x===e.x&&c.y===e.y&&(e.x===i+l.x&&e.y===a+l.y?(d.x=i+s.x,d.y=a+s.y):(d.x=i+l.x,d.y=a+l.y))}(g,e,0,h,p,d,f)}else 1===u.length?(e.x=h,3===g.length?(0===l&&(e.y=p+r),1===l&&(e.x=e.x-25+t,e.y=p+i),2===l&&(e.x=e.x+25-t,e.y=p+i)):e.y=p+r*(1-l)+i*l):(e.x=h+d.x*(1-l)+f.x*l,e.y=p+d.y*(1-l)+f.y*l);if(e.rotation=d3.select(this.parentNode).datum().rotation,void 0!==c&&void 0!==c.lineData){let t={source:c,target:e};s.push(t)}"cim:PowerTransformer"===a&&n.handlePowerTransformerEnds(this)})).attr("id",(function(t){return"cimdiagram-"+n.props.model.ID(t)})).attr("class",(function(t){return t.localName}));return n.createEdges(s),c.append("circle").attr("r",1).style("fill","black").attr("cx",(function(t,e){return d3.select(this.parentNode).datum().x-d3.select(this.parentNode.parentNode).datum().x})).attr("cy",(function(t,e){return d3.select(this.parentNode).datum().y-d3.select(this.parentNode.parentNode).datum().y})),l.each((function(t,e){let n=d3.select(this.parentNode).datum().x,r=d3.select(this.parentNode).datum().y,i=parseInt(d3.select(this.firstChild).attr("cx")),o=parseInt(d3.select(this.firstChild).attr("cy"));if(0===i&&0===o)t.x=n,t.y=r;else{let e=d3.select(this.parentNode).datum().lineData,i=e[e.length-1];t.x=n+i.x,t.y=r+i.y}})),l.selectAll("circle").attr("cx",(function(t,e){return d3.select(this.parentNode).datum().x-d3.select(this.parentNode.parentNode).datum().x})).attr("cy",(function(t,e){return d3.select(this.parentNode).datum().y-d3.select(this.parentNode.parentNode).datum().y})),c.each((function(){let t=d3.select(this).select("circle");d3.select(this).append("circle").attr("cx",t.attr("cx")).attr("cy",t.attr("cy")).attr("r",4).attr("stroke-width",0).attr("fill","steelblue").attr("fill-opacity","0.0").attr("class","big-circle").on("mouseout",(function(t,e){d3.select(this).attr("fill-opacity","0.0")}))})),c.on("mouseover",(function(t,e){0===d3.select(this).select("circle.selection-circle").size()&&d3.select(this).select("circle.big-circle").attr("fill-opacity","0.7")})),c},drawNodes(t){let e=d3.line().x((function(t){return t.x})).y((function(t){return t.y}));for(let e of t)calcLineData(n.props.model,e);d3.select("svg").select("g."+r+"s").empty()&&d3.select("svg").select("g#diagram-main").append("g").attr("class",r+"s");let i=d3.select("svg").select("g."+r+"s").selectAll("g."+r).data(t,(function(t){return n.props.model.ID(t)})),o=i.enter().append("g").attr("class",r).attr("id",(function(t){return"cimdiagram-"+n.props.model.ID(t)}));function a(t){t.attr("x",(function(t){let e=d3.select(this.parentNode).select("path").node();return e.getPointAtLength(e.getTotalLength()/2).x+2})).attr("y",(function(t){let e=d3.select(this.parentNode).select("path").node();return e.getPointAtLength(e.getTotalLength()/2).y-2})).text((function(t){let e=n.props.model.getBusbar(t);if(null!==e){let t=n.props.model.getAttribute(e,"cim:IdentifiedObject.name");if(void 0!==t)return t.innerHTML}return""}))}return i.select("path").attr("d",(function(t){let n=d3.select(this.parentNode).data()[0].lineData;return e(n)})).attr("stroke",(function(t){return n.voltageColor(n.props.model.getBusbar(t),"black")})),o.append("path").attr("d",(function(t){let n=d3.select(this.parentNode).data()[0].lineData;return e(n)})).attr("stroke",(function(t){return n.voltageColor(n.props.model.getBusbar(t),"black")})).attr("stroke-width",2).attr("fill","none"),o.filter((function(t){return null!==n.props.model.getBusbar(t)})).append("text").attr("class","cim-object-text").attr("font-size",3),a(o.select("text")),a(i.select("text")),o},moveTo(t){let e=n.props.model.getObject(t);if(void 0===e)return;if("cim:BusbarSection"===e.nodeName&&(e=n.props.model.getNode(e)),"cim:Substation"===e.nodeName||"cim:Line"===e.nodeName){let t=n.props.model.getTargets([e],"EquipmentContainer.Equipments");for(let r of t){if("cim:BusbarSection"===r.nodeName){let t=n.props.model.getNode(r);null!==t&&(r=t)}if(void 0!==r.x&&void 0!==r.y){e.x=r.x,e.y=r.y;break}}}if("cim:Analog"!==e.nodeName&&"cim:Discrete"!==e.nodeName||(e=n.props.model.getTargets([e],"Measurement.PowerSystemResource")[0],void 0!==e&&"cim:BusbarSection"===e.nodeName&&(e=n.props.model.getNode(e))),"cim:PowerTransformerEnd"===e.nodeName&&(e=n.props.model.getTargets([e],"PowerTransformerEnd.PowerTransformer")[0]),void 0===e.x||void 0===e.y)return;hidePopovers();let r=parseInt(d3.select("svg").style("width")),i=parseInt(d3.select("svg").style("height")),o=1*-e.x+r/2,a=1*-e.y+i/2,s=d3.transition().duration(750).ease(d3.easeLinear),l=d3.zoomIdentity.translate(o,a).scale(1);d3.selectAll("svg").select("g#diagram-main").transition(s).attr("transform",l),d3.zoom().transform(d3.selectAll("svg"),l),n.props.dispatcher.trigger("transform")},forceTick(t){0!==arguments.length&&void 0===t.alpha||(t=d3.select("svg").selectAll("svg > g#diagram-main > g:not(.edges) > g"));let e=d3.zoomTransform(d3.select("svg").node()),r=e.x,i=e.y,o=e.k;if(function(t){t.attr("transform",(function(t){return"translate("+t.x+","+t.y+") rotate("+t.rotation+")"})).selectAll("g.Terminal").each((function(t,e){t.x=d3.select(this.parentNode).datum().x+parseInt(d3.select(this.firstChild).attr("cx")),t.y=d3.select(this.parentNode).datum().y+parseInt(d3.select(this.firstChild).attr("cy"))})),t.selectAll("text.cim-object-text").attr("transform",(function(t){let e=0,n={x:0,y:0};switch(t.rotation%360==180&&(e=-1*t.rotation),t.nodeName){case"cim:Breaker":case"cim:Disconnector":case"cim:LoadBreakSwitch":case"cim:Junction":case"cim:PowerTransformer":n={x:0,y:0};break;default:n={x:d3.select(this).attr("x"),y:d3.select(this).attr("y")}}return"rotate("+e+","+n.x+","+n.y+")"})),t.selectAll("rect.selection-rect").attr("x",0).attr("y",0).attr("width",0).attr("height",0),t.selectAll("rect.selection-rect").attr("x",(function(t){return this.parentNode.getBBox().x})).attr("y",(function(t){return this.parentNode.getBBox().y})).attr("width",(function(t){return this.parentNode.getBBox().width})).attr("height",(function(t){return this.parentNode.getBBox().height})),t.selectAll("g.resize").selectAll("rect").attr("x",(function(t){return t[0].lineData.filter((e=>e.seq===t[1]))[0].x-2})).attr("y",(function(t){return t[0].lineData.filter((e=>e.seq===t[1]))[0].y-2}))}(t),1===arguments.length){let e=n.props.model.getTerminals(t.data()),a=d3.select("svg").selectAll("svg > g#diagram-main > g.edges > g").filter((function(n){return t.data().indexOf(n.source)>-1||e.indexOf(n.target)>-1}));n.updateEdges(r,i,o,a)}else n.updateEdges(r,i,o)},updateEdges(t,e,r,i){let o=d3.line().x((function(t){return t.x})).y((function(t){return t.y})).curve(d3.curveStepBefore);3===arguments.length&&(i=d3.select("svg").selectAll("svg > g#diagram-main > g.edges > g")),i.select("path").attr("d",(function(t){let e={x:t.source.x,y:t.source.y},r={x:t.target.x,y:t.target.y};return 0!==t.target.rotation&&(r=rotateTerm(n.props.model,t.target)),t.source.lineData.length>1?t.p=closestPoint(t.source,r):t.p=[0,0],e.x=e.x+t.p[0],e.y=e.y+t.p[1],o([e,r])})).attr("stroke-dasharray",(function(t){let e=n.props.model.getAttribute(t.target,"cim:ACDCTerminal.connected");return void 0!==e&&"false"===e.textContent?"5, 5":null}))},drawGrid(t){let e=parseInt(d3.select("svg").style("width"))/t,n=parseInt(d3.select("svg").style("height"))/t,r=d3.select("svg").select("g#diagram-grid");r.selectAll("*").remove();const i=25;for(let t=i;t<=n-i;t+=i)r.append("svg:line").attr("x1",0).attr("y1",t).attr("x2",e).attr("y2",t).attr("stroke-dasharray","1, 5").style("stroke","rgb(6,120,155)").style("stroke-width",1);for(let t=i;t<=e-i;t+=i)r.append("svg:line").attr("x1",t).attr("y1",0).attr("x2",t).attr("y2",n).attr("stroke-dasharray","1, 5").style("stroke","rgb(6,120,155)").style("stroke-width",1);r.attr("transform","scale("+t+")")},voltageColor(t,r){let i=r;if(null!=t){let r="ConductingEquipment.BaseVoltage";!0===n.props.model.schema.isA("TransformerEnd",t)&&(r="TransformerEnd.BaseVoltage");const o=n.props.model.getTargets([t],r)[0],a=n.props.model.getAttribute(o,"cim:BaseVoltage.nominalVoltage");if(void 0!==a&&""!==a.textContent){const t=a.textContent,n=parseFloat(t);i=e(n)}}return i},drawLegend(){let t=n.props.model.getObjects(["cim:BaseVoltage"])["cim:BaseVoltage"];d3.select("#legend-rect").attr("height",60+20*t.length),t.sort((function(t,e){const r=n.props.model.getAttribute(t,"cim:BaseVoltage.nominalVoltage"),i=n.props.model.getAttribute(e,"cim:BaseVoltage.nominalVoltage");if(void 0!==r&&void 0!==i){const t=r.textContent,e=parseFloat(t),n=i.textContent;return e
Legend
',[{type:n.TAG,getComponent:r,evaluate:function(t){return"cimdiagramcontrols"},slots:[],attributes:[{type:e.ATTRIBUTE,name:"model",evaluate:function(t){return t.props.model}},{type:e.ATTRIBUTE,name:"dispatcher",evaluate:function(t){return t.props.dispatcher}}],redundantAttribute:"expr4",selector:"[expr4]"}])},name:"cimdiagram"}})),function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).cimDiagramControls=e()}(this,(function(){"use strict";let t=null,e="ConnectivityNode",n="ConnectivityNode.Terminals",r="Terminal.ConnectivityNode",i=d3.quadtree(),o=[],a=[],s=!1,l=!1,c=[{title:"Copy",action:function(e,n){let r=this;!0===t.props.model.schema.isA("TransformerEnd",d3.select(r).datum())&&(r=r.parentElement),-1===o.indexOf(r)&&(o.push(r),t.updateSelected());let i=d3.selectAll(o).data();for(let e of i)if("cim:ConnectivityNode"===e.nodeName){let n=t.props.model.getBusbar(e);null!==n&&(n.x=e.x,n.y=e.y,a.push(n))}else a.push(e)}},{title:"Rotate",action:function(e,n){let r=this;!0===t.props.model.schema.isA("TransformerEnd",d3.select(r).datum())&&(r=r.parentElement),-1===o.indexOf(r)&&(t.deselectAll(),o.push(r),t.updateSelected()),hidePopovers(o);let i=d3.selectAll(o);t.props.model.getTerminals(i.data()).forEach((function(t){t.rotation=(t.rotation+90)%360}));for(let e of i.data())e.rotation=(e.rotation+90)%360,t.props.model.updateActiveDiagram(e,e.lineData)}},{title:"Delete",action:function(e,n){let r=this;!0===t.props.model.schema.isA("TransformerEnd",d3.select(r).datum())&&(r=r.parentElement),t.deleteObject(r)}},{title:"Delete from current diagram",action:function(e,n){let r=this;!0===t.props.model.schema.isA("TransformerEnd",d3.select(r).datum())&&(r=r.parentElement),t.deleteFromDiagram(r)}},{title:"Show element info",action:function(e,n){let r=this;!0===t.props.model.schema.isA("TransformerEnd",d3.select(r).datum())&&(r=r.parentElement),-1===o.indexOf(r)&&(t.deselectAll(),o.push(r),t.updateSelected()),showPopovers(o)}},{title:"Add new operational limit set",action:function(e,n){t.addNewLimitSet(this,n)}}],u=c.concat([{title:"Add points",action:function(e,n){let r=t.status,i=this;t.disableAll(),t.deselectAll(),o.push(i),d3.select("svg").on("contextmenu.general",null),t.addDrawing(n,(function(e){let o=d3.select("svg"),a=o.selectAll("svg > #diagram-connect > path"),s=o.selectAll("svg > #diagram-connect > circle");switch(e.preventDefault(),t.addNewPoint(n),t.deleteFromDiagram(i),t.props.model.addToActiveDiagram(n,n.lineData),o.on("mousemove",null),a.attr("d",null),s.attr("transform","translate(0, 0)"),d3.select("svg > #diagram-connect > path").datum(null),o.on("contextmenu.add",null),o.on("click.add",null),r){case"DRAG":t.enableDrag();break;case"ZOOM":t.enableZoom();break;case"CONNECT":t.enableConnect();break;default:{let e=r.substring("ADD".length);e.startsWith("Multi")?(e=e.substring("Multi".length),t.enableAddMulti(e)):t.enableAdd(e);break}}d3.select("svg").on("contextmenu.general",d3.contextMenu(g))})),d3.select("svg").on("click.add",(function(){t.addNewPoint(n)}))}}]),d=[{title:"Delete point",action:function(e,n){let r=d3.selectAll(o).data().filter((t=>t===n[0]))[0];o=o.filter((t=>d3.select(t).datum()!==n[0])),t.deselectAll(),o.push(r),t.updateSelected(),t.deleteFromDiagram(this.parentNode),n[0].lineData=n[0].lineData.filter((t=>t.seq!==n[1]));for(let t of n[0].lineData)t.seq>n[1]&&(t.seq=t.seq-1);t.props.model.addToActiveDiagram(n[0],n[0].lineData)}}],f=[{title:"Add new operational limit set",action:function(e,n){t.addNewLimitSet(this,n)}},{title:"Add regulating control",action:function(e,n){t.addRegulatingControl(this,n)}},{title:"Add tap changer control",action:function(e,n){t.addTCControl(this,n)}}],h=f.concat([{title:"Add ratio tap changer",action:function(e,n){t.addTC(this,n)}}]),p=c.concat([{title:"Add ratio tap changer",action:function(e,n){t.addTC(this,n)}}]),m=[{title:"Delete",action:function(e,r){let i=t.getLinkedCNs([r.target])[0];if(void 0!==i){let e=t.props.model.ID(i.cn),n=d3.select("svg").selectAll("g#cimdiagram-"+e).node();t.deleteObject(n)}else t.props.model.removeLink(r.source,"cim:"+n,r.target)}}],g=[{title:"Paste",disabled:function(t,e){return a.length<1},action:function(e,n){if(a.length<1)return;let r=d3.pointer(e,d3.select("svg").node()),i=d3.zoomTransform(d3.select("svg").node());i.x,i.y,i.k;let o=r[0]-a[0].x,s=r[1]-a[0].y,l=null;for(let e of a){let n=t.props.model.createObject(e.nodeName);for(let r of t.props.model.getAttributes(e)){let e=r.nodeName,i=r.textContent;t.props.model.setAttribute(n,e,i)}if(n.x=e.x+o,n.y=e.y+s,"cim:BusbarSection"===n.nodeName){let n=t.props.model.getNode(e);if(null===n)return;l=n.lineData}else l=e.lineData;t.props.model.addToActiveDiagram(n,l)}a=[]}}];const b=d3.drag().on("drag",(function(e,n){hidePopovers(o);const r={x:e.x,y:e.y,seq:n[1]},i=t.align(n[0],r,!0);!function(t,e,n){const r=t.lineData.filter((t=>t.seq===e))[0],i=rotate({x:n.x,y:n.y},-1*t.rotation);if(1!==r.seq)r.x=n.x,r.y=n.y;else{t.x=t.x+n.x,t.y=t.y+n.y;for(let e of t.lineData)1!==e.seq&&(e.x=e.x-i.x,e.y=e.y-i.y)}}(n[0],n[1],i),t.props.model.updateActiveDiagram(n[0],n[0].lineData)})).on("start",(function(e,n){t.removeFromQuadtree()})).on("end",(function(e,n){t.highlight(null),t.props.model.updateActiveDiagram(n[0],n[0].lineData),t.addToQuadtree(d3.selectAll(o))}));return{css:null,exports:{onBeforeMount(a,s){t=this,t.props.dispatcher.on("moveTo",(function(e){t.deselectAll();let n=t.props.model.getObject(e),r=null,i=null,a=null,s=null,l=null;if(void 0!==n){switch(n.nodeName){case"cim:Substation":case"cim:Line":r=t.props.model.getTargets([n],"EquipmentContainer.Equipments");for(let e of r)"cim:BusbarSection"===e.nodeName&&(a=t.props.model.getNode(e),null!==a&&(e=a)),l=d3.select("svg").select("#cimdiagram-"+t.props.model.ID(e)).node(),null!==l&&o.push(l);break;case"cim:Analog":case"cim:Discrete":i=t.props.model.getTargets([n],"Measurement.Terminal");for(let e of i)l=d3.select("svg").select("#cimdiagram-"+t.props.model.ID(e)).node(),null!==l&&o.push(l);break;case"cim:BusbarSection":a=t.props.model.getNode(n),s=t.props.model.ID(a),l=d3.select("svg").selectAll("g#cimdiagram-"+s).node(),o=[l];break;default:l=d3.select("svg").selectAll("g#cimdiagram-"+e).node(),o=[l]}t.updateSelected()}})),t.props.dispatcher.on("deselect",(function(){t.deselectAll()})),t.props.dispatcher.on("render",(function(){"BUS_BRANCH"===t.props.model.getMode()?(e="TopologicalNode",n="TopologicalNode.Terminal",r="Terminal.TopologicalNode"):(c.push({title:"Add new measurement",action:function(e,n){t.addNewMeasurement(this,n)}}),u.push({title:"Add new measurement",action:function(e,n){t.addNewMeasurement(this,n)}}),f.push({title:"Add new measurement",action:function(e,n){t.addNewMeasurement(this,n)}}));let o=d3.select("svg").selectAll("svg > g#diagram-main > g:not(.edges) > g");i.x((function(t){let e=d3.select(t.elm).datum(),n=e.lineData.filter((e=>e.seq===t.seq));return e.x+n[0].x})).y((function(t){let e=d3.select(t.elm).datum(),n=e.lineData.filter((e=>e.seq===t.seq));return e.y+n[0].y})),t.addToQuadtree(o);let a=d3.select("svg").selectAll("svg > g#diagram-main > g.edges > g");t.addContextMenu(o),d3.select("svg").on("contextmenu.general",d3.contextMenu(g)),a.on("contextmenu",d3.contextMenu(m)),t.disableZoom(),t.disableConnect(),t.enableDrag(),document.querySelector("#cim-diagram-controls").classList.remove("invisible"),document.querySelector("#cim-diagram-insert").classList.remove("invisible"),document.querySelector("#cim-diagram-legend").classList.remove("invisible");let s=null;d3.select("body").on("keydown",(function(e){void 0!==e&&e.ctrlKey&&(null===s&&(s=t.status),t.disableDrag(),t.disableZoom(),t.enableZoom())})).on("keyup",(function(e){if(17===e.keyCode){switch(t.disableZoom(),s){case"DRAG":t.enableDrag();break;case"ZOOM":t.enableZoom();break;default:t.status=s}s=null}27===e.keyCode&&d3.contextMenu("close")}))})),t.props.dispatcher.on("addToDiagram",(function(e){1===e.size()&&(t.addToQuadtree(e),"DRAG"===t.status&&(t.disableAll(),t.enableDrag()),t.addContextMenu(e))})),t.props.dispatcher.on("createEdges",(function(t){t.on("contextmenu",d3.contextMenu(m))}))},onMounted(){document.querySelector("#select").addEventListener("change",(function(){t.disableAll(),t.enableDrag()})),document.querySelector("#pan").addEventListener("change",(function(){t.disableAll(),t.enableZoom()})),document.querySelector("#connect").addEventListener("change",(function(){t.disableAll(),t.enableConnect()})),document.querySelector("#legendToggle").addEventListener("change",(function(){const t=d3.transition().duration(750).ease(d3.easeLinear);!1===this.checked?d3.select("#diagram-legend").transition(t).attr("transform",d3.zoomIdentity.translate(1200,50)):d3.select("#diagram-legend").transition(t).attr("transform",d3.zoomIdentity.translate(1050,50))}))},disableAll(){t.disableDrag(),t.disableZoom(),t.disableConnect(),t.disableAdd()},deselectAll(){d3.selectAll(o).selectAll("rect.selection-rect").remove(),d3.selectAll(o).selectAll("g.resize").remove(),d3.selectAll(o).selectAll("circle.selection-circle").remove(),o=[]},enableDrag(){let e=[];t.disableDrag(),t.status="DRAG";let n=d3.drag().on("start",(function(n,r){if(d3.contextMenu("close"),-1===o.indexOf(this)&&t.deselectAll(),0===o.length&&(o.push(this),t.updateSelected()),t.removeFromQuadtree(),!0===t.props.model.schema.isA("ConductingEquipment",r)){let n=t.props.model.getTerminals([r]);e=t.getLinkedCNs(n)}let i=t.props.model.getTerminals(d3.selectAll(o).data());d3.select("svg").selectAll("svg > g#diagram-main > g.edges > g").filter((function(t){return d3.selectAll(o).data().indexOf(t.source)>-1||i.indexOf(t.target)>-1})).select("path").attr("stroke","green").attr("stroke-width","3")})).on("drag",(function(n,r){hidePopovers(o);let i=n.x-r.x,a=n.y-r.y,s={x:0,y:0};for(let e of o){let n=d3.select(e).data()[0];if(n.x=n.x+i,n.px=n.x,n.y=n.y+a,n.py=n.y,0===s.x&&0===s.y)for(let e of n.lineData){let r=t.align(n,e,!1);if(s={x:r.x-e.x,y:r.y-e.y},0!==s.x||0!==s.y){e.seq>1&&(s=rotate(s,n.rotation));break}}}for(let e of o){let n=d3.select(e).data()[0];l(n,null,s),t.props.model.updateActiveDiagram(n,n.lineData)}for(let n of e){let e={x:n.cnTerms[0].x,y:n.cnTerms[0].y},r={x:n.cnTerms[1].x,y:n.cnTerms[1].y};n.cnTerms[0].rotation>0&&(e=rotateTerm(t.props.model,n.cnTerms[0])),n.cnTerms[1].rotation>0&&(r=rotateTerm(t.props.model,n.cnTerms[1])),n.cn.x=(e.x+r.x)/2,n.cn.y=(e.y+r.y)/2,t.props.model.updateActiveDiagram(n.cn,n.cn.lineData)}function l(t,e,n){t.x=t.x+n.x,t.y=t.y+n.y,t.px=t.x,t.py=t.y}})).on("end",(function(n,r){t.addToQuadtree(d3.selectAll(o)),e=[];let i=t.props.model.getTerminals(d3.selectAll(o).data());d3.select("svg").selectAll("svg > g#diagram-main > g.edges > g").filter((function(t){return d3.selectAll(o).data().indexOf(t.source)>-1||i.indexOf(t.target)>-1})).select("path").attr("stroke","black").attr("stroke-width","1"),t.highlight("x",null),t.highlight("y",null)}));d3.select("svg").selectAll("svg > g#diagram-main > g:not(.edges) > g").call(n),d3.select("svg").select("g#diagram-brush").call(d3.brush().on("start",(function(){let e=window.location.hash.substring(1).split("/"),n=e[0]+"/"+e[1]+"/"+e[2];route.router.push(n),t.deselectAll(),hidePopovers(),d3.contextMenu("close")})).on("end",(function(e){d3.select("svg").select("g#diagram-brush").selectAll("*:not(.overlay)").style("display","none");let n=e.selection;if(null===n)return;t.deselectAll();let r=d3.zoomTransform(d3.select("svg").node()),a=r.x,s=r.y,l=r.k;o=t.search(i,(n[0][0]-a)/l,(n[0][1]-s)/l,(n[1][0]-a)/l,(n[1][1]-s)/l),t.updateSelected()})))},search(t,e,n,r,i){let o=new Set;return t.visit((function(t,a,s,l,c){if(!t.length)do{let a=t.data,s=d3.select(a.elm).datum();for(let t of s.lineData){let l=rotate(t,s.rotation),c=s.x+l.x,u=s.y+l.y;if(c>=e&&c=n&&u=r||s>=i||lo.indexOf(t.elm)>-1));i.removeAll(t)},updateSelected(){d3.selectAll(o).each((function(e){t.hover(this)})).selectAll("g.resize").call(b).filter((function(t){return t[0].lineData.length>2})).on("contextmenu",d3.contextMenu(d))},getLinkedCNs(e){let i=[],o=t.props.model.getTargets(e,r);for(let e of o){if(void 0===e.lineData)continue;if(e.lineData.length>1)continue;let r=t.props.model.getTargets([e],n);if(2===r.length){let t={cn:e,cnTerms:r};i.push(t)}}return i},disableDrag(){d3.select("svg").selectAll("svg > g#diagram-main > g:not(.edges) > g").on(".drag",null),d3.select("svg").select("g#diagram-brush").on(".brush",null),"DRAG"===t.status&&d3.select("svg").select("g#diagram-brush").call(d3.brush().move,null)},enableZoom(){t.status="ZOOM",hidePopovers(),d3.select("svg").selectAll("svg > g#diagram-main > g:not(.edges) > g").on("click.zoom",(function(e,n){let r=window.location.hash.substring(1).split("/"),i=r[0]+"/"+r[1]+"/"+r[2];route.router.push(i+"/"+t.props.model.ID(n))}));let e=d3.zoom();e.on("zoom",this.zooming),d3.select("svg").call(e)},disableZoom(){d3.select("svg").selectAll("svg > g#diagram-main > g:not(.edges) > g").on("click.zoom",null),d3.select("svg").on(".zoom",null)},zooming(e){d3.select("svg").select("g#diagram-main").attr("transform",e.transform),t.props.dispatcher.trigger("transform");let n=d3.select("svg > #diagram-connect > path").datum();if(void 0===n)return;let r=d3.line().x((function(t){return t.x})).y((function(t){return t.y})),i=d3.select("svg > #diagram-connect > path"),o=d3.zoomTransform(d3.select("svg").node()),a=d3.select("svg > #diagram-connect > circle").node().transform.baseVal.consolidate();if(null===a)return;let s=a.matrix,l=s.e-10,c=s.f-10,u=[],d=n.obj;if(void 0===d.lineData)u.push({x:d.x*o.k+o.x,y:d.y*o.k+o.y});else for(let t of d.lineData)u.push({x:(t.x+d.x)*o.k+o.x,y:(t.y+d.y)*o.k+o.y});u.push({x:l,y:c}),i.attr("d",(function(){return r(u)}))},enableConnect(){function n(e){d3.select("svg").selectAll("svg > #diagram-connect > path").attr("d",null),d3.select("svg").selectAll("svg > #diagram-connect > circle").attr("transform","translate(0, 0)");let n=d3.select("svg > #diagram-connect > path").datum();void 0!==n&&(d3.select("svg").on("mousemove",null),t.props.model.setLink(n.obj,"cim:"+r,e),d3.select("svg > #diagram-connect > path").datum(null))}t.deselectAll(),d3.select("body").on("keyup.connect",(function(e){27===e.keyCode&&(t.disableConnect(),t.enableConnect())})),t.status="CONNECT",d3.select("svg").selectAll("svg > g#diagram-main > g:not(.edges) > g > g.Terminal").on("click",(function(n,i){let o=d3.line().x((function(t){return t.x})).y((function(t){return t.y})),a={x:i.x,y:i.y};i.rotation>0&&(a=rotateTerm(t.props.model,i));let s=d3.select("svg"),l=d3.select("svg > #diagram-connect > path"),c=d3.select("svg > #diagram-connect > circle"),u=l.datum();if(void 0!==u&&(u=u.obj),void 0!==u){let n=t.props.model.getTargets([i],r)[0];if(void 0===n)n=t.props.model.getTargets([u],r)[0];else{let n=t.getLinkedCNs([u]);for(let r of n){let n=t.props.model.ID(r.cn),i=d3.select("svg > g#diagram-main > g."+e+"s > g#cimdiagram-"+n).node();t.deleteObject(i)}}if(d3.select("svg").selectAll("svg > #diagram-connect > path").attr("d",null),d3.select("svg").selectAll("svg > #diagram-connect > circle").attr("transform","translate(0, 0)"),void 0===n){let r={x:u.x,y:u.y};u.rotation>0&&(r=rotateTerm(t.props.model,u)),n=t.props.model.createObject("cim:"+e),t.props.model.setAttribute(n,"cim:IdentifiedObject.name","new1"),n.x=(r.x+a.x)/2,n.y=(r.y+a.y)/2,t.props.model.addToActiveDiagram(n,[{x:0,y:0,seq:1}])}d3.select("svg").on("mousemove",null);let o="cim:"+r;t.props.model.setLink(u,o,n),t.props.model.setLink(i,o,n),l.datum(null)}else{s.on("mousemove",(function(t){let e=d3.pointer(t),n=d3.zoomTransform(d3.select("svg").node());c.attr("transform",(function(){return"translate("+(e[0]+10)+","+(e[1]+10)+")"})),l.attr("d",(function(){let t=a.x*n.k+n.x,r=a.y*n.k+n.y;return o([{x:t,y:r},{x:e[0],y:e[1]}])}))})),l.datum({obj:i})}})),d3.select("svg").selectAll("svg > g#diagram-main > g."+e+"s > g."+e).on("click",(function(t,e){n(e)})),d3.select("svg").selectAll("svg > g#diagram-main > g.edges > g").on("click",(function(t,e){n(e.source)}))},disableConnect(){d3.select("body").on("keyup.connect",null),d3.select("svg").selectAll("svg > g#diagram-main > g:not(.edges) > g > g.Terminal").on("click",null),d3.select("svg").selectAll("svg > g#diagram-main > g."+e+"s > g."+e).on("click",null),d3.select("svg").selectAll("svg > g#diagram-main > g.edges > g").on("click",null),d3.select("svg").on("mousemove",null),d3.select("svg > #diagram-connect > path").attr("d",null),d3.select("svg > #diagram-connect > circle").attr("transform","translate(0, 0)");let t=d3.select("svg > #diagram-connect > path").datum();void 0!==t&&"cim:Terminal"===t.nodeName&&d3.select("svg > #diagram-connect > path").datum(null)},enableAdd(e){let n="",r="";"object"==typeof e?(n=e.target.id,r=e.target.textContent):(n=e,r=d3.select("#"+n).text());let i=void 0;"Three-winding Transformer"===r&&(i={windNum:3}),t.disableAll(),document.querySelector("cimDiagramControls").querySelectorAll("input").forEach((function(t){t.checked=!1})),document.querySelector("#addElement").textContent=r,t.status="ADD"+n,d3.select("svg").on("click.add",(function(e){if(!1===e.ctrlKey){let r=t.props.model.createObject("cim:"+n,i);addToDiagram(t.props.model,e,r)}}))},enableAddMulti(e){let n="",r="",i=d3.select("svg"),o=i.selectAll("svg > #diagram-connect > path"),a=i.selectAll("svg > #diagram-connect > circle");t.disableAll(),d3.select("svg").on("contextmenu.general",null),d3.select("body").on("keyup.addMulti",(function(n){27===n.keyCode&&(t.disableAdd(),t.enableAddMulti(e))})),"object"==typeof e?(n=e.target.id,r=e.target.textContent):(n=e,r=d3.select("#"+n).text()),document.querySelector("cimDiagramControls").querySelectorAll("input").forEach((function(t){t.checked=!1})),document.querySelector("#addElement").textContent=r,t.status="ADDMulti"+n,d3.select("svg").on("click.add",(function(e){if(!1===e.ctrlKey)if(t.status==="ADDMulti"+n){s=t.props.model.createObject("cim:"+n);let r=d3.pointer(e),l=d3.zoomTransform(d3.select("svg").node()),c=l.x,u=l.y,d=l.k;s.x=Math.round((r[0]-c)/d),s.px=s.x,s.y=Math.round((r[1]-u)/d),s.py=s.y,s.lineData=[{x:0,y:0,seq:1}],s.rotation=0,t.addDrawing(s,(function(e){e.preventDefault(),t.addNewPoint(s),t.props.model.addToActiveDiagram(s,s.lineData),t.status="ADDMulti"+n,i.on("mousemove",null),o.attr("d",null),a.attr("transform","translate(0, 0)"),d3.select("svg > #diagram-connect > path").datum(null),i.on("contextmenu.add",null)}))}else t.addNewPoint(s)}));let s=void 0},addDrawing(e,n){t.status="ADDdrawing";let r=d3.select("svg");r.on("contextmenu.add",n),r.on("mousemove",(function(n){let i=d3.pointer(n),o=d3.zoomTransform(r.node()),a=(i[0]-o.x)/o.k,s=(i[1]-o.y)/o.k,l=rotate({x:a-e.x,y:s-e.y,seq:null},-1*e.rotation),c=rotate(t.align(e,l,!0),e.rotation);!function(t,n,i){let o=d3.zoomTransform(r.node()),a=r.selectAll("svg > #diagram-connect > path"),s=r.selectAll("svg > #diagram-connect > circle"),l=d3.line().x((function(t){return t.x})).y((function(t){return t.y}));s.attr("transform",(function(){return"translate("+((t.x+i.x)*o.k+o.x+10)+","+((t.y+i.y)*o.k+o.y+10)+")"})),a.attr("d",(function(){let n=[];for(let r of t.lineData){let i=rotate(r,e.rotation);n.push({x:(i.x+t.x)*o.k+o.x,y:(i.y+t.y)*o.k+o.y})}return n.push({x:(t.x+i.x)*o.k+o.x,y:(t.y+i.y)*o.k+o.y}),l(n)})),a.datum({obj:e,x:t.x+i.x,y:t.y+i.y})}(e,0,c)}))},addNewPoint(e){let n=d3.select("svg").selectAll("svg > #diagram-connect > path").datum(),r=n.x-e.x,i=n.y-e.y,o=e.lineData.length+1,a=rotate({x:r,y:i},-1*e.rotation);e.lineData.push({x:a.x,y:a.y,seq:o}),t.highlight(null)},align(e,n,r){let o=d3.zoomTransform(d3.select("svg").node()),a=!1,c=!1,u=rotate(n,e.rotation),d=e.x+u.x,f=e.y+u.y,h=u.x,p=u.y,m=d-250/o.k,g=f-250/o.k,b=d+250/o.k,v=f+250/o.k,y=t.search(i,m,g,b,v),_=d3.selectAll(y).data();!0===r&&_.push(e);for(let r of _)t:for(let i of r.lineData){if(r===e&&i.seq===n.seq)continue t;let u=rotate(i,r.rotation),m=u.x+r.x,g=u.y+r.y,b=d-m,v=f-g;if(Math.abs(b)<5){d=m,h=d-e.x;let n=m*o.k+o.x;t.highlight("x",n),a=!0,s=!0}if(Math.abs(v)<5){f=g,p=f-e.y;let n=g*o.k+o.y;t.highlight("y",n),c=!0,l=!0}}!1===a&&!0===s&&(t.highlight("x",null),s=!1),!1===c&&!0===l&&(t.highlight("y",null),l=!1);let w={x:h,y:p},x=rotate(w,-1*e.rotation);return 1===n.seq?w:x},highlight(t,e,n){let r=d3.select("svg").select("g#diagram-highlight"),i=null,o=null,a=null,s=null,l=parseInt(d3.select("svg").style("height")),c=parseInt(d3.select("svg").style("width")),u=2*Math.max(l,c);"x"===t?(i=e,o=-1*u,a=e,s=u,r.select("line.highlight-x").attr("x1",i).attr("y1",o).attr("x2",a).attr("y2",s)):"y"===t?(i=-1*u,o=e,a=u,s=e,r.select("line.highlight-y").attr("x1",i).attr("y1",o).attr("x2",a).attr("y2",s)):(r.select("line.highlight-x").attr("x1",i).attr("y1",o).attr("x2",a).attr("y2",s),r.select("line.highlight-y").attr("x1",i).attr("y1",o).attr("x2",a).attr("y2",s)),3===arguments.length?r.attr("transform","rotate("+n.val+","+n.x+","+n.y+")"):r.attr("transform",null)},disableAdd(){document.querySelector("#addElement").textContent="Insert element",d3.select("body").on("keyup.addMulti",null),d3.select("svg").on("click.add",null),d3.select("svg").on("contextmenu.add",null),d3.select("svg").on("contextmenu.general",d3.contextMenu(g)),d3.select("svg").on("mousemove",null),d3.select("svg > #diagram-connect > path").attr("d",null),d3.select("svg > #diagram-connect > circle").attr("transform","translate(0, 0)");let e=d3.select("svg > #diagram-connect > path").datum();if(void 0!==e){0===t.props.model.getDiagramObjects([e.obj]).length?t.props.model.deleteObject(e.obj):calcLineData(t.props.model,e.obj)}d3.select("svg > #diagram-connect > path").datum(null),t.highlight("x",null),t.highlight("y",null)},hover(t){let n=d3.select(t);n.filter("g:not(.ACLineSegment)").filter("g:not(."+e+")").filter("g:not(.Terminal)").each((function(t){d3.select(this).append("rect").attr("x",this.getBBox().x).attr("y",this.getBBox().y).attr("width",this.getBBox().width).attr("height",this.getBBox().height).attr("stroke","black").attr("stroke-width",2).attr("stroke-dasharray","5,5").attr("fill","none").attr("class","selection-rect")})),n.filter("g.ACLineSegment,g."+e).selectAll("g.resize").data((function(t){return t.lineData.map((e=>[t,e.seq]))})).enter().append("g").attr("class","resize").append("rect").attr("x",(function(t){return t[0].lineData.filter((e=>e.seq===t[1]))[0].x-2})).attr("y",(function(t){return t[0].lineData.filter((e=>e.seq===t[1]))[0].y-2})).attr("width",4).attr("height",4),n.filter("g.Terminal").each((function(t){let e=d3.select(this).select("circle");d3.select(this).append("circle").attr("cx",e.attr("cx")).attr("cy",e.attr("cy")).attr("r",8).attr("stroke-width",0).attr("fill","red").attr("fill-opacity","0.7").attr("class","selection-circle")}))},addNewMeasurement(n,r){t.deselectAll(),"cim:Terminal"!==r.nodeName&&(o.push(n),t.updateSelected());let i=null;if(i=!0===t.props.model.schema.isA("Switch",r)?t.props.model.createObject("cim:Discrete"):t.props.model.createObject("cim:Analog"),"cim:Terminal"===r.nodeName){let e=t.props.model.getTargets([r],"Terminal.ConductingEquipment")[0];t.props.model.setLink(i,"cim:Measurement.Terminal",r),t.props.model.setLink(i,"cim:Measurement.PowerSystemResource",e)}else if(r.nodeName==="cim:"+e){let e=t.props.model.getBusbar(r);null!==e&&t.props.model.setLink(i,"cim:Measurement.PowerSystemResource",e)}else t.props.model.setLink(i,"cim:Measurement.PowerSystemResource",r);t.props.model.addToActiveDiagram(i,[])},addNewLimitSet(n,r){t.deselectAll();let i=n,a=r;!0===t.props.model.schema.isA("TransformerEnd",d3.select(n).datum())&&(i=n.parentElement,a=d3.select(i).datum()),"cim:Terminal"!==a.nodeName&&(o.push(i),t.updateSelected());let s=t.props.model.createObject("cim:OperationalLimitSet");if("cim:Terminal"===a.nodeName)t.props.model.getTargets([a],"Terminal.ConductingEquipment")[0],t.props.model.setLink(s,"cim:OperationalLimitSet.Terminal",a);else if(a.nodeName==="cim:"+e){let e=t.props.model.getBusbar(a);null!==e&&t.props.model.setLink(s,"cim:OperationalLimitSet.Equipment",e)}else t.props.model.setLink(s,"cim:OperationalLimitSet.Equipment",a);t.props.model.addToActiveDiagram(s,[])},addRegulatingControl(e,n){t.deselectAll();let r=t.props.model.createObject("cim:RegulatingControl");t.props.model.setLink(r,"cim:RegulatingControl.Terminal",n),t.props.model.addToActiveDiagram(r,[])},addTCControl(e,n){t.deselectAll();let r=t.props.model.createObject("cim:TapChangerControl");t.props.model.setLink(r,"cim:RegulatingControl.Terminal",n),t.props.model.addToActiveDiagram(r,[])},addTC(e,n){t.deselectAll();let r=n;if(!0===t.props.model.schema.isA("Terminal",n)&&(r=t.props.model.getTargets([n],"Terminal.TransformerEnd")[0]),0===t.props.model.getTargets([r],"TransformerEnd.RatioTapChanger").length){let e=t.props.model.createObject("cim:RatioTapChanger");t.props.model.setLink(e,"cim:RatioTapChanger.TransformerEnd",r),t.props.model.addToActiveDiagram(e,[])}},addContextMenu(t){t.filter("g:not(.ACLineSegment)").filter("g:not(."+e+")").filter("g:not(.PowerTransformer)").on("contextmenu",d3.contextMenu(c)),t.filter("g.ACLineSegment,g."+e).selectAll("path").on("contextmenu",(function(t,e){d3.contextMenu(u).bind(this.parentNode)(t,e),t.stopPropagation()})),t.filter("g:not(.PowerTransformer)").selectAll("g.Terminal").on("contextmenu",(function(t,e){d3.contextMenu(f).bind(this)(t,e),t.stopPropagation()})),t.filter("g.PowerTransformer").selectAll("g.Terminal").on("contextmenu",(function(t,e){d3.contextMenu(h).bind(this)(t,e),t.stopPropagation()})),t.filter("g.PowerTransformer").selectAll("g.TransformerEnd").on("contextmenu",(function(t,e){d3.contextMenu(p).bind(this)(t,e),t.stopPropagation()}))},deleteObject(e){let n=t.deleteSelection(e);t.props.model.deleteObjects(n.data())},deleteFromDiagram(e){let n=t.deleteSelection(e);for(let e of n.data())t.props.model.deleteFromDiagram(e)},deleteSelection(n){-1===o.indexOf(n)&&(t.deselectAll(),o.push(n));let r=d3.selectAll(o),i=t.props.model.getTerminals(r.data()),a=t.getLinkedCNs(i);for(let n of a){let r=t.props.model.ID(n.cn),i=d3.select("svg > g#diagram-main > g."+e+"s > g#cimdiagram-"+r).node();o.push(i)}return t.removeFromQuadtree(),r=d3.selectAll(o),disposePopovers(o),r.remove(),r}},template:function(t,e,n,r){return t('',[{redundantAttribute:"expr5",selector:"[expr5]",expressions:[{type:e.EVENT,name:"onclick",evaluate:function(t){return t.enableAddMulti}}]},{redundantAttribute:"expr6",selector:"[expr6]",expressions:[{type:e.EVENT,name:"onclick",evaluate:function(t){return t.enableAddMulti}}]},{redundantAttribute:"expr7",selector:"[expr7]",expressions:[{type:e.EVENT,name:"onclick",evaluate:function(t){return t.enableAdd}}]},{redundantAttribute:"expr8",selector:"[expr8]",expressions:[{type:e.EVENT,name:"onclick",evaluate:function(t){return t.enableAdd}}]},{redundantAttribute:"expr9",selector:"[expr9]",expressions:[{type:e.EVENT,name:"onclick",evaluate:function(t){return t.enableAdd}}]},{redundantAttribute:"expr10",selector:"[expr10]",expressions:[{type:e.EVENT,name:"onclick",evaluate:function(t){return t.enableAdd}}]},{redundantAttribute:"expr11",selector:"[expr11]",expressions:[{type:e.EVENT,name:"onclick",evaluate:function(t){return t.enableAdd}}]},{redundantAttribute:"expr12",selector:"[expr12]",expressions:[{type:e.EVENT,name:"onclick",evaluate:function(t){return t.enableAdd}}]},{redundantAttribute:"expr13",selector:"[expr13]",expressions:[{type:e.EVENT,name:"onclick",evaluate:function(t){return t.enableAdd}}]},{redundantAttribute:"expr14",selector:"[expr14]",expressions:[{type:e.EVENT,name:"onclick",evaluate:function(t){return t.enableAdd}}]},{redundantAttribute:"expr15",selector:"[expr15]",expressions:[{type:e.EVENT,name:"onclick",evaluate:function(t){return t.enableAdd}}]},{redundantAttribute:"expr16",selector:"[expr16]",expressions:[{type:e.EVENT,name:"onclick",evaluate:function(t){return t.enableAdd}}]},{redundantAttribute:"expr17",selector:"[expr17]",expressions:[{type:e.EVENT,name:"onclick",evaluate:function(t){return t.enableAdd}}]},{redundantAttribute:"expr18",selector:"[expr18]",expressions:[{type:e.EVENT,name:"onclick",evaluate:function(t){return t.enableAdd}}]},{redundantAttribute:"expr19",selector:"[expr19]",expressions:[{type:e.EVENT,name:"onclick",evaluate:function(t){return t.enableAdd}}]}])},name:"cimdiagramcontrols"}})),function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).cimDraw=e()}(this,(function(){"use strict";let t=null;return{css:'cimdraw .center-block,[is="cimdraw"] .center-block{ text-align: center; } cimdraw nav.navbar,[is="cimdraw"] nav.navbar{ margin-bottom: 20px; } cimdraw .app-container,[is="cimdraw"] .app-container{ display: flex; flex-flow: row nowrap; } cimdraw .navbar-light .navbar-text,[is="cimdraw"] .navbar-light .navbar-text{ color: rgba(0,0,0,1); } cimdraw .navbar-light .navbar-nav .nav-link,[is="cimdraw"] .navbar-light .navbar-nav .nav-link{ color: rgba(0,0,0,1); } cimdraw .cim-content-center,[is="cimdraw"] .cim-content-center{ text-align: center; max-width: 700px; } cimdraw #upload-boundary,[is="cimdraw"] #upload-boundary{ display: none; }',exports:{onBeforeMount(e,n){t=this,t.state.cimModel=cimModel(),t.state.diagramsToLoad=2,t.state.dispatcher={},observable(t.state.dispatcher),t.state.cimModel.on("setMode",(function(t){document.getElementById("cim-mode").textContent="NODE_BREAKER"===t?"Mode: Operational":"Mode: Planning"}))},onMounted(){const e=new bootstrap.Modal(document.getElementById("cimModeModal")),n=new bootstrap.Modal(document.getElementById("loadingModal")),r=new bootstrap.Modal(document.getElementById("loadingFileModal")),i=new bootstrap.Modal(document.getElementById("boundaryModal")),o=new bootstrap.Modal(document.getElementById("newDiagramModal"));let a={},s=!1,l=window.location.pathname.substring(1);function c(e){u();const n=document.getElementById("cim-diagrams"),r=document.createElement("option");r.setAttribute("value","#"+e+"/createNew"),r.textContent="Generate a new diagram",n.appendChild(r);const i=t.state.cimModel.getDiagramList();for(let t in i){const r=document.createElement("option");r.setAttribute("value","#"+e+"/diagrams/"+i[t]),r.setAttribute("id",i[t]),r.textContent=i[t],n.appendChild(r)}0===i.length&&route.router.push(e+"/createNew")}function u(){const t=document.getElementById("cim-diagrams");for(;null!==t.firstChild;)t.removeChild(t.lastChild);const e=document.createElement("option");e.setAttribute("disabled","disabled"),e.setAttribute("selected","selected"),e.textContent="Select a diagram",t.appendChild(e)}-1===l.indexOf("index.html")&&(l+="index.html"),route.setBase(l+"#"),route.router.push(window.location.hash.replace("#","")),route.initDomListeners(),t.state.dispatcher.on("loaded",(function(){t.state.diagramsToLoad=t.state.diagramsToLoad-1,0===t.state.diagramsToLoad&&(n.hide(),document.getElementById("loadingDiagramMsg").textContent="loading diagram...",t.state.diagramsToLoad=2)})),document.getElementById("operational").addEventListener("change",(function(){t.state.cimModel.setMode("NODE_BREAKER")})),document.getElementById("planning").addEventListener("change",(function(){t.state.cimModel.setMode("BUS_BRANCH")})),document.getElementById("cim-create-new-container").addEventListener("click",(function(){a={name:"new1"},s=!0,e.show()})),document.getElementById("cim-file-modal-error").addEventListener("click",(function(){r.hide(),route.router.push("")})),document.getElementById("cim-boundary-modal-error").addEventListener("click",(function(){i.hide(),document.getElementById("boundaryMsg").textContent="loading boundary file..."})),document.getElementById("cim-create-new-modal").addEventListener("click",(function(){route.router.push(a.name+"/diagrams")})),document.getElementById("load-boundary").addEventListener("click",(function(){return document.getElementById("upload-boundary").click(),!1})),document.getElementById("upload-boundary").addEventListener("change",(function(){const e=this.files[0];function n(){t.state.cimModel.loadBoundary(e).then((function(t){const e=document.createElement("br");document.getElementById("boundaryMsg").append(e,"OK. "+t),document.getElementById("cim-boundary-modal-error-container").style.display=null})).catch((function(t){const e=document.createElement("br");document.getElementById("boundaryMsg").append(e,t),document.getElementById("cim-boundary-modal-error-container").style.display=null}))}document.getElementById("boundaryModal").removeEventListener("shown.bs.modal",n),document.getElementById("boundaryModal").addEventListener("shown.bs.modal",n),i.show()})),document.getElementById("cim-save").addEventListener("click",(function(e){const n=t.state.cimModel.save(),r=new Blob([n],{type:"text/xml"}),i=URL.createObjectURL(r);e.currentTarget.setAttribute("href",i)})),document.getElementById("cgmes-save").addEventListener("click",(function(e){t.state.cimModel.saveAsCGMES().then((function(t){const e=URL.createObjectURL(t);document.getElementById("cgmes-download").setAttribute("href",e),document.getElementById("cgmes-download").click()})).catch((function(t){console.log(t)}))})),document.getElementById("cim-export").addEventListener("click",(function(e){const n=t.state.cimModel.export(),r=new Blob([n],{type:"text/xml"}),i=URL.createObjectURL(r);e.currentTarget.setAttribute("href",i)})),document.getElementById("matpower-export").addEventListener("click",(function(e){const n=exportToMatpower(t.state.cimModel),r=new Blob([n],{type:"text/plain"}),i=URL.createObjectURL(r);e.currentTarget.setAttribute("href",i)})),document.getElementById("newDiagramBtn").addEventListener("click",(function(t){const e=document.getElementById("newDiagramName").value,n=window.location.hash.substring(1).split("/")[0]+"/diagrams/"+e;o.hide(),route.router.push(n)})),document.getElementById("loadingFileModal").addEventListener("shown.bs.modal",(function(e){if(void 0===a.name)return r.hide(),void route.router.push("");{document.getElementById("cim-filename").innerHTML="["+a.name+"]  ";let e=null;e=!1===s?t.state.cimModel.load(a):t.state.cimModel.newFile(a.name),e.then((function(){c(a.name),r.hide(),"new1"!==a.name&&function(){const e=t.state.cimModel.getObjects(["cim:ConnectivityNode","cim:TopologicalNode"]);let n=e["cim:ConnectivityNode"];const r=e["cim:TopologicalNode"];n=n.filter((function(e){return!1===t.state.cimModel.isBoundary(e)})),n.length>0||0===r.length?t.state.cimModel.setMode("NODE_BREAKER"):t.state.cimModel.setMode("BUS_BRANCH")}()})).catch((function(t){const e=document.createElement("br");document.getElementById("loadingFileMsg").append(e,t),document.getElementById("cim-file-modal-error-container").style.display=null}))}})),route.route("").on.value((function(t){document.getElementById("cim-local-file-component").style.display=null,document.getElementById("app-container").style.display="none",document.getElementById("cim-load-container").style.display="none",document.getElementById("cim-home-container").style.display="none",document.getElementById("cim-diagrams").style.display="none",document.getElementById("cim-mode").style.display="none",document.getElementById("cim-file-modal-error-container").style.display="none",document.getElementById("cim-boundary-modal-error-container").style.display="none",u(),document.getElementById("cim-filename").textContent="";document.getElementById("cim-file-input").addEventListener("change",(function(){a=this.files[0],s=!1;const t="#"+encodeURI(a.name)+"/diagrams";document.getElementById("cim-load").setAttribute("href",t),document.getElementById("cim-load-container").style.display=null}))})),route.route(":file/diagrams").on.value((function(n){document.getElementById("cim-home-container").style.display=null,document.getElementById("cim-diagrams").style.display=null,document.getElementById("cim-mode").style.display=null,document.getElementById("cim-local-file-component").style.display="none",document.getElementById("app-container").style.display="none",document.getElementById("cim-export").parentNode.classList.add("disabled"),e.hide();const i=document.getElementById("cim-filename").textContent;a.name!==i?(document.getElementById("loadingFileMsg").textContent="loading CIM network...",r.show(),t.state.dispatcher.trigger("diagrams")):c(a.name)})),route.route(":file/diagrams/:name").on.value((function(e){const r=e.params.file,i=e.params.name;if(void 0!==a.name){if(t.state.cimModel.activeDiagramName===decodeURI(i))return t.state.dispatcher.trigger("showDiagram",r,i),void(document.getElementById("app-container").style.display=null);document.getElementById("cim-local-file-component").style.display="none",document.getElementById("loadingDiagramMsg").textContent="loading diagram...",document.getElementById("loadingModal").addEventListener("shown.bs.modal",(function e(n){!function(e,n,r){t.state.cimModel.selectDiagram(decodeURI(n)),c(decodeURI(e)),document.getElementById(decodeURI(n)).setAttribute("selected",!0),document.getElementById("app-container").style.display=null,document.getElementById("cim-export").parentNode.classList.remove("disabled"),t.state.dispatcher.trigger("showDiagram",e,n,r)}(r,i),document.getElementById("loadingModal").removeEventListener("shown.bs.modal",e)})),n.show()}else route.router.push("")})),route.route(":file/diagrams/:name/:element").on.value((function(e){const n=e.params.file,r=e.params.name,i=e.params.element;document.getElementById("cim-local-file-component").style.display="none",t.state.dispatcher.trigger("showDiagram",n,r,i)})),route.route(":file/createNew").on.value((function(t){window.history.back(),o.show()}))}},template:function(t,e,n,r){return t('


',[{type:n.TAG,getComponent:r,evaluate:function(t){return"cimtopologyprocessor"},slots:[],attributes:[{type:e.ATTRIBUTE,name:"model",evaluate:function(t){return t.state.cimModel}},{type:e.ATTRIBUTE,name:"dispatcher",evaluate:function(t){return t.state.dispatcher}}],redundantAttribute:"expr1",selector:"[expr1]"},{type:n.TAG,getComponent:r,evaluate:function(t){return"cimtree"},slots:[],attributes:[{type:e.ATTRIBUTE,name:"model",evaluate:function(t){return t.state.cimModel}},{type:e.ATTRIBUTE,name:"dispatcher",evaluate:function(t){return t.state.dispatcher}}],redundantAttribute:"expr2",selector:"[expr2]"},{type:n.TAG,getComponent:r,evaluate:function(t){return"cimdiagram"},slots:[],attributes:[{type:e.ATTRIBUTE,name:"model",evaluate:function(t){return t.state.cimModel}},{type:e.ATTRIBUTE,name:"dispatcher",evaluate:function(t){return t.state.dispatcher}}],redundantAttribute:"expr3",selector:"[expr3]"}])},name:"cimdraw"}})),function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).cimTopologyProcessor=e()}(this,(function(){"use strict";let t=null;return{css:'cimtopologyprocessor #cim-topology-processor,[is="cimtopologyprocessor"] #cim-topology-processor{ display: none }',exports:{onBeforeMount(e,n){t=this,e.dispatcher.on("diagrams",(function(){document.querySelector("#cim-topology-processor").style.display="flex"}))},run(e){const n=document.querySelector("#tpMsg"),r=document.getElementById("tpStatusModal"),i=new bootstrap.Modal(r);n.textContent="Loading...",i.show(),r.addEventListener("shown.bs.modal",(function(e){let r=topologyProcessor(t.props.model).calcTopology();n.textContent="Done ("+r.length+" nodes calculated)."}))}},template:function(t,e,n,r){return t('',[{redundantAttribute:"expr0",selector:"[expr0]",expressions:[{type:e.EVENT,name:"onclick",evaluate:function(t){return t.run}}]}])},name:"cimtopologyprocessor"}})),function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).cimTree=e()}(this,(function(){"use strict";let t=null,e=d3.contextMenu([{title:"Delete",action:function(e,n){t.props.model.deleteObject(n)}}]),n=null;return{css:'cimtree .tree,[is="cimtree"] .tree{ display: flex; flex-flow: column; max-height: 800px; min-width: 500px; resize: horizontal; padding-top: 10px; overflow: auto; } cimtree .tab-content,[is="cimtree"] .tab-content{ overflow: scroll; } cimtree .cim-tree-attribute-name,[is="cimtree"] .cim-tree-attribute-name{ text-align: left; min-width: 200px; } cimtree .cim-tree-attribute-uom,[is="cimtree"] .cim-tree-attribute-uom{ width: 70px; } cimtree .cim-tree-btn-group,[is="cimtree"] .cim-tree-btn-group{ flex-grow: 1; } cimtree .cim-tree-dropdown-toggle,[is="cimtree"] .cim-tree-dropdown-toggle{ flex-grow: 1; } cimtree ul,[is="cimtree"] ul{ list-style-type: none; } cimtree #tree-link-dialog,[is="cimtree"] #tree-link-dialog{ max-width: 18rem; align-self: center; min-width: 90%; min-height: min-content; } cimtree #tree-link-dialog > .card-body,[is="cimtree"] #tree-link-dialog > .card-body{ text-align: center; } cimtree #tree-controls,[is="cimtree"] #tree-controls{ padding-bottom: 10px; align-self: center; flex-shrink: 0; width: 370px; } cimtree #cim-search-form,[is="cimtree"] #cim-search-form{ align-self: center; max-width: 600px; padding-right: 20px; padding-left: 20px; padding-bottom: 20px; } cimtree .list-group-item > div,[is="cimtree"] .list-group-item > div{ width: 100%; } cimtree .cim-tree-btn-group > .cimLinkBtn,[is="cimtree"] .cim-tree-btn-group > .cimLinkBtn{ flex-grow: 1; } cimtree .tree > .nav-tabs,[is="cimtree"] .tree > .nav-tabs{ flex-shrink: 0; } cimtree .cim-expand-object,[is="cimtree"] .cim-expand-object{ border: transparent; } cimtree .cim-expand-object:focus,[is="cimtree"] .cim-expand-object:focus{ box-shadow: initial; } cimtree .cim-expand-object:hover,[is="cimtree"] .cim-expand-object:hover{ color: #6c757d; background-color: transparent; } cimtree li.attribute > .input-group,[is="cimtree"] li.attribute > .input-group{ flex-wrap: nowrap }',exports:{onBeforeMount(e,n){t=this,t.state.mode="default",e.dispatcher.on("showDiagram",(function(e,n,r){decodeURI(n)!==t.state.diagramName&&(d3.drag().on("drag.end",null),t.render(n)),void 0!==r?t.moveTo(r):d3.select(".tree").selectAll(".btn-danger").classed("btn-danger",!1).classed("btn-primary",!0)}))},onMounted(){[].slice.call(document.querySelectorAll("#cim-tree-tabs a")).forEach((function(t){const e=new bootstrap.Tab(t);t.addEventListener("click",(function(t){t.preventDefault(),e.show()}))})),document.getElementById("cim-search-key").addEventListener("keyup",(function(e){if("Enter"===e.key){let e=document.getElementById("cim-search-case").classList.contains("active"),r=document.getElementById("cim-search-key").value;if(""===r)document.getElementById("cim-search-results").classList.add("d-none"),n=null;else{let i=[];document.getElementById("app-tree").querySelectorAll("ul:not(.CIM-object-list)").forEach((function(t){let n=null;n=!0===e?Array.prototype.filter.call(t.querySelectorAll("li.CIM-object>button.cim-object-btn"),(function(t){return t.textContent.indexOf(r)>=0})):Array.prototype.filter.call(t.querySelectorAll("li.CIM-object>button.cim-object-btn"),(function(t){let e=r.toLocaleLowerCase();return t.textContent.toLocaleLowerCase().indexOf(e)>=0})),i=i.concat(n)})),i=[...new Set(i)],document.getElementById("cim-search-results").classList.remove("d-none"),i.length>0?(document.querySelector("#cim-search-results").textContent="Result 1 of "+i.length,n={elements:d3.selectAll(i).data(),actualResult:0},t.moveTo(t.props.model.ID(n.elements[n.actualResult]))):document.querySelector("#cim-search-results").textContent="Text not found"}}})),document.getElementById("cim-search-next").addEventListener("click",(function(){if(null!==n&&n.actualResult0){n.actualResult=n.actualResult-1;let e=n.actualResult+1;document.querySelector("#cim-search-results").textContent="Result "+e+" of "+n.elements.length,t.moveTo(t.props.model.ID(n.elements[n.actualResult]))}})),document.getElementById("showAllObjects").addEventListener("change",(function(){t.createTree(this.checked)})),document.getElementById("sshInput").addEventListener("change",(function(){t.resetAttrs()})),document.querySelectorAll('a[data-bs-toggle="tab"]').forEach((e=>e.addEventListener("click",(function(e){t.goToBasePath()})))),t.props.model.on("addToActiveDiagram",(function(e){t.addNewObject(e)})),t.props.model.on("deleteObject",(function(e,n){t.deleteObject(e)})),t.props.model.on("deleteFromDiagram",(function(e){!1===document.getElementById("showAllObjects").checked&&t.deleteObject(e)})),t.props.model.on("setAttribute",(function(e,n,r){if("cim:IdentifiedObject.name"===n){e.localName;let n=d3.select("div.tree").selectAll("ul#"+t.props.model.ID(e));if(!1===n.empty()){d3.select(n.node().parentNode).select("button").html(r)}document.querySelectorAll('[cim-target="'+t.props.model.ID(e)+'"]').innerHTML=r}})),t.props.model.on("addLink",(function(e,n,r){let i=t.props.model.ID(e),o=d3.select(".tree").select("#"+i),a=o.selectAll("#cimRemoveBtn").filter((function(t){return t.attributes[0].value==="#"+n.split(":")[1]}));o.selectAll(".cimLinkBtn").filter((function(t){return t.attributes[0].value==="#"+n.split(":")[1]})).html((function(){return t.props.model.getAttribute(r,"cim:IdentifiedObject.name").textContent})).attr("cim-target",(function(){return t.props.model.ID(r)})).attr("disabled",null),o.selectAll("#cimTarget").attr("id",null),a.attr("disabled",null),"BUS_BRANCH"===t.props.model.getMode()&&"cim:BusbarSection"===e.nodeName&&"cim:ConductingEquipment.BaseVoltage"===n&&t.props.model.setLink(t.props.model.getNode(e),"cim:TopologicalNode.BaseVoltage",r)})),t.props.model.on("removeLink",(function(e,n,r){let i=t.props.model.ID(e),o=d3.select(".tree").select("#"+i),a=o.selectAll("#cimRemoveBtn").filter((function(t){return t.attributes[0].value==="#"+n.split(":")[1]})),s=o.selectAll(".cimLinkBtn").filter((function(t){return t.attributes[0].value==="#"+n.split(":")[1]}));a.attr("disabled","disabled"),s.html("none").attr("cim-target","none").attr("disabled","disabled")})),t.props.model.on("createdDiagram",(function(){t.state.diagramName=decodeURI(t.props.model.activeDiagramName),document.getElementById("showAllObjects").checked=!1,document.getElementById("showAllObjects").dispatchEvent(new MouseEvent("click"))})),t.props.model.on("setMode",(function(e){"BUS_BRANCH"===t.state.mode&&(document.getElementById("measurementsTab").style.display=null)}))},goToBasePath(){let t=window.location.hash.substring(1).split("/");if(t.length>3){let e=t[0]+"/"+t[1]+"/"+t[2];route.router.push(e)}},addNewObject(e){const n=d3.select("div.tree > div.tab-content > div.tab-pane"),r=d3.select("div.tree > div.tab-content > div.tab-pane > ul#CIMComponents"),i=d3.select("div.tree > div.tab-content > div.tab-pane > ul#CIMContainers"),o=d3.select("div.tree > div.tab-content > div.tab-pane > ul#CIMMeasurements"),a=d3.select("div.tree > div.tab-content > div.tab-pane > ul#CIMBases"),s=d3.select("div.tree > div.tab-content > div.tab-pane > ul#CIMCurvesAndRegs"),l=d3.select("div.tree > div.tab-content > div.tab-pane > ul#CIMLimits");switch(e.nodeName){case"cim:ACLineSegment":t.elements(r,"ACLineSegment","AC Line Segments",[e]);break;case"cim:Breaker":t.elements(r,"Breaker","Breakers",[e]);break;case"cim:Disconnector":t.elements(r,"Disconnector","Disconnectors",[e]);break;case"cim:LoadBreakSwitch":t.elements(r,"LoadBreakSwitch","Load Break Switches",[e]);break;case"cim:Junction":t.elements(r,"Junction","Junctions",[e]);break;case"cim:EnergySource":{const n=t.createTopContainer(r,"Equivalent","Equivalents",[e]);t.elements(n,"EnergySource","Energy Sources",[e]);break}case"cim:SynchronousMachine":{const n=t.createTopContainer(r,"RotatingMachine","RotatingMachines",[e]);t.elements(n,"SynchronousMachine","Synchronous Machines",[e]);break}case"cim:AsynchronousMachine":{const n=t.createTopContainer(r,"RotatingMachine","RotatingMachines",[e]);t.elements(n,"AsynchronousMachine","Asynchronous Machines",[e]);break}case"cim:EnergyConsumer":{const n=t.createTopContainer(r,"Load","Loads",[e]);t.elements(n,"EnergyConsumer","Energy Consumers",[e]);break}case"cim:ConformLoad":{const n=t.createTopContainer(r,"Load","Loads",[e]);t.elements(n,"ConformLoad","Conform Loads",[e]);break}case"cim:NonConformLoad":{const n=t.createTopContainer(r,"Load","Loads",[e]);t.elements(n,"NonConformLoad","Non Conform Loads",[e]);break}case"cim:LinearShuntCompensator":{const n=t.createTopContainer(r,"Compensator","Compensators",[e]);t.elements(n,"LinearShuntCompensator","Linear",[e]);break}case"cim:NonlinearShuntCompensator":{const n=t.createTopContainer(r,"Compensator","Compensators",[e]);t.nlCompensators(n,[e]);break}case"cim:NonlinearShuntCompensatorPoint":{const n=t.props.model.getTargets([e],"NonlinearShuntCompensatorPoint.NonlinearShuntCompensator"),i=t.props.model.ID(n[0]),o=r.selectAll("ul#"+i);t.nlCompensatorPoints(o,[e]);break}case"cim:PowerTransformer":t.powerTransformers(r,[e]);break;case"cim:RatioTapChanger":{const n=t.props.model.getTargets([e],"RatioTapChanger.TransformerEnd"),i=t.props.model.ID(n[0]),o=r.selectAll("ul#"+i);t.tapChangers(o,[e]);break}case"cim:BusbarSection":t.elements(r,"BusbarSection","Nodes",[e]);break;case"cim:BaseVoltage":{const n=t.elements(a,"BaseVoltage","Base Voltages",[e]);t.createDeleteMenu(n);break}case"cim:GeographicalRegion":t.geoRegions(i,[e]);break;case"cim:SubGeographicalRegion":{const n=t.props.model.getTargets([e],"SubGeographicalRegion.Region"),r=t.props.model.ID(n[0]),o=i.selectAll("ul#"+r);t.subGeoRegions(o,[e]);break}case"cim:Substation":t.substations(i,[e]);break;case"cim:VoltageLevel":{const n=t.props.model.getTargets([e],"VoltageLevel.Substation"),r=t.props.model.ID(n[0]),o=i.selectAll("ul#"+r);t.voltageLevels(o,[e]);break}case"cim:Bay":{const n=t.props.model.getTargets([e],"Bay.VoltageLevel"),r=t.props.model.ID(n[0]),o=i.selectAll("ul#"+r);t.bays(o,[e]);break}case"cim:Line":{const n=t.elements(i,"Line","Lines",[e]);t.createDeleteMenu(n);break}case"cim:GeneratingUnit":{const n=t.createTopContainer(i,"GeneralGeneratingUnit","Generating Units",[e]);t.elements(n,"GeneratingUnit","General Units",[e]);break}case"cim:ThermalGeneratingUnit":{const n=t.createTopContainer(i,"GeneralGeneratingUnit","Generating Units",[e]);t.elements(n,"ThermalGeneratingUnit","Thermal Units",[e]);break}case"cim:Analog":{const n=t.elements(o,"Analog","Analogs",[e]);t.createDeleteMenu(n);break}case"cim:Discrete":{const n=t.elements(o,"Discrete","Discretes",[e]);t.createDeleteMenu(n);break}case"cim:LoadResponseCharacteristic":{const n=t.elements(s,"LoadResponseCharacteristic","Load Response Characteristics",[e]);t.createDeleteMenu(n);break}case"cim:TapChangerControl":{const n=t.elements(s,"TapChangerControl","Tap Changer Controls",[e]);t.createDeleteMenu(n);break}case"cim:RegulatingControl":{const n=t.elements(s,"RegulatingControl","Regulating Controls",[e]);t.createDeleteMenu(n);break}case"cim:OperationalLimitType":{const n=t.elements(l,"OperationalLimitType","Operational Limit Types",[e]);t.createDeleteMenu(n);break}case"cim:OperationalLimitSet":{let r=t.props.model.getTargets([e],"OperationalLimitSet.Equipment");if(0===r.length){const n=t.props.model.getTargets([e],"OperationalLimitSet.Terminal");r=t.props.model.getTargets(n,"Terminal.ConductingEquipment")}const i=t.props.model.ID(r[0]),o=n.selectAll("ul#"+i);t.limitSets(o,[e]);break}case"cim:VoltageLimit":case"cim:CurrentLimit":case"cim:ActivePowerLimit":case"cim:ApparentPowerLimit":{const r=t.props.model.getTargets([e],"OperationalLimit.OperationalLimitSet"),i=t.props.model.ID(r[0]),o=n.selectAll("ul#"+i);t.limits(o,[e]);break}}},createTree(e){let n=function*(e){d3.select("#app-tree").selectAll("#CIMComponents > li").remove(),d3.select("#app-tree").selectAll("#CIMContainers > li").remove(),d3.select("#app-tree").selectAll("#CIMMeasurements > li").remove(),d3.select("#app-tree").selectAll("#CIMBases > li").remove(),d3.select("#app-tree").selectAll("#CIMCurvesAndRegs > li").remove(),d3.select("#app-tree").selectAll("#CIMLimits > li").remove();let n=d3.select("div.tree > div.tab-content > div.tab-pane > ul#CIMComponents"),r=d3.select("div.tree > div.tab-content > div.tab-pane > ul#CIMContainers"),i=d3.select("div.tree > div.tab-content > div.tab-pane > ul#CIMMeasurements"),o=d3.select("div.tree > div.tab-content > div.tab-pane > ul#CIMBases"),a=d3.select("div.tree > div.tab-content > div.tab-pane > ul#CIMCurvesAndRegs"),s=d3.select("div.tree > div.tab-content > div.tab-pane > ul#CIMLimits"),l=["cim:Substation","cim:Line"],c=["cim:Analog","cim:Discrete"],u=["cim:GeneratingUnit","cim:ThermalGeneratingUnit"],d=null,f=null,h=null,p=null,m=null,g=null,b=t.props.model.getObjects,v=t.props.model.getObjects;!1===e&&(b=t.props.model.getGraphicObjects,v=t.props.model.getConnectors);if("BUS_BRANCH"===t.props.model.getMode()){let e=t.props.model.getObjects(["cim:BusbarSection","cim:TopologicalNode"]);0===e["cim:BusbarSection"].length&&e["cim:TopologicalNode"].forEach((function(e){let n=t.props.model.createObject("cim:BusbarSection",{node:e}),r=t.props.model.getAttribute(e,"cim:IdentifiedObject.name");void 0!==r&&t.props.model.setAttribute(n,"cim:IdentifiedObject.name",r.innerHTML)}))}let y=b(["cim:BusbarSection","cim:PowerTransformer","cim:ACLineSegment","cim:Breaker","cim:Disconnector","cim:LoadBreakSwitch","cim:Junction","cim:EnergySource","cim:EquivalentInjection","cim:SynchronousMachine","cim:AsynchronousMachine","cim:EnergyConsumer","cim:ConformLoad","cim:NonConformLoad","cim:LinearShuntCompensator","cim:NonlinearShuntCompensator"]);yield"TREE: extracted equipments",p=b(["cim:SubGeographicalRegion"])["cim:SubGeographicalRegion"],m=b(["cim:GeographicalRegion"])["cim:GeographicalRegion"],!1===e?(d=t.props.model.getLinkedObjects(l,["EquipmentContainer.Equipments","Substation.VoltageLevels/EquipmentContainer.Equipments","Substation.VoltageLevels/VoltageLevel.Bays/EquipmentContainer.Equipments"]),f=t.props.model.getLinkedObjects(c,["Measurement.PowerSystemResource"]),h=t.props.model.getLinkedObjects(u,["GeneratingUnit.RotatingMachine"]),p=p.concat(t.props.model.getTargets(d["cim:Substation"],"Substation.Region")),m=m.concat(t.props.model.getTargets(p,"SubGeographicalRegion.Region")),p=[...new Set(p)],m=[...new Set(m)],g=t.props.model.getLinkedObjects(["cim:LoadResponseCharacteristic"],["LoadResponseCharacteristic.EnergyConsumer"])):(d=b(l),f=b(c),h=b(u),g=b(["cim:LoadResponseCharacteristic"]));let _=t.props.model.getObjects(["cim:BaseVoltage","cim:TapChangerControl","cim:RegulatingControl","cim:OperationalLimitType"]),w=v(["cim:BusbarSection"])["cim:BusbarSection"],x=y["cim:EnergySource"].concat(y["cim:EquivalentInjection"]),T=y["cim:SynchronousMachine"].concat(y["cim:AsynchronousMachine"]),A=y["cim:EnergyConsumer"].concat(y["cim:ConformLoad"]).concat(y["cim:NonConformLoad"]),E=y["cim:LinearShuntCompensator"].concat(y["cim:nonlinearShuntCompensator"]),M=t.elements(i,"Analog","Analogs",f["cim:Analog"]);t.createDeleteMenu(M);let S=t.elements(i,"Discrete","Discretes",f["cim:Discrete"]);t.createDeleteMenu(S);let N=t.elements(o,"BaseVoltage","Base Voltages",_["cim:BaseVoltage"]);t.createDeleteMenu(N),t.elements(n,"ACLineSegment","AC Line Segments",y["cim:ACLineSegment"]),t.elements(n,"Breaker","Breakers",y["cim:Breaker"]),t.elements(n,"Disconnector","Disconnectors",y["cim:Disconnector"]),t.elements(n,"LoadBreakSwitch","Load Break Switches",y["cim:LoadBreakSwitch"]),t.elements(n,"Junction","Junctions",y["cim:Junction"]);let k=t.createTopContainer(n,"Equivalent","Equivalents",x);t.elements(k,"EnergySource","Energy Sources",y["cim:EnergySource"]),t.elements(k,"EquivalentInjection","Equivalent Injections",y["cim:EquivalentInjection"]);let C=t.createTopContainer(n,"RotatingMachine","Rotating Machines",T);t.elements(C,"SynchronousMachine","Synchronous Machines",y["cim:SynchronousMachine"]),t.elements(C,"AsynchronousMachine","Asynchronous Machines",y["cim:AsynchronousMachine"]);let D=t.createTopContainer(n,"Load","Loads",A);t.elements(D,"EnergyConsumer","Energy Consumers",y["cim:EnergyConsumer"]),t.elements(D,"ConformLoad","Conform Loads",y["cim:ConformLoad"]),t.elements(D,"NonConformLoad","Non Conform Loads",y["cim:NonConformLoad"]);let L=t.createTopContainer(n,"Compensator","Compensators",E);t.elements(L,"LinearShuntCompensator","Linear",y["cim:LinearShuntCompensator"]),t.nlCompensators(L,y["cim:NonlinearShuntCompensator"]),t.elements(n,"BusbarSection","Nodes",w),t.powerTransformers(n,y["cim:PowerTransformer"]),t.geoRegions(r,m),t.substations(r,d["cim:Substation"]);let O=t.elements(r,"Line","Lines",d["cim:Line"]);t.createDeleteMenu(O);let I=t.createTopContainer(r,"GeneralGeneratingUnit","Generating Units",h["cim:GeneratingUnit"].concat(h["cim:ThermalGeneratingUnit"]));t.elements(I,"GeneratingUnit","General Units",h["cim:GeneratingUnit"]),t.elements(I,"ThermalGeneratingUnit","Thermal Units",h["cim:ThermalGeneratingUnit"]),t.elements(a,"LoadResponseCharacteristic","Load Response Characteristics",g["cim:LoadResponseCharacteristic"]);let B=t.elements(a,"TapChangerControl","Tap Changer Controls",_["cim:TapChangerControl"]);t.createDeleteMenu(B);let P=t.elements(a,"RegulatingControl","Regulating Controls",_["cim:RegulatingControl"]);t.createDeleteMenu(P);let j=t.elements(s,"OperationalLimitType","Operational Limit Types",_["cim:OperationalLimitType"]);t.createDeleteMenu(j),t.createAddButton(o,"BaseVoltage"),t.createAddButton(r,"Substation"),t.createAddButton(r,"GeographicalRegion"),t.createAddButton(r,"Line"),t.createAddButton(r,"GeneratingUnit"),t.createAddButton(r,"ThermalGeneratingUnit"),t.createAddButton(a,"LoadResponseCharacteristic"),t.createAddButton(s,"OperationalLimitType")}(e);!function e(){let r=n.next().value;void 0!==r?(document.getElementById("loadingDiagramMsg").innerHTML="
"+r,setTimeout(e,1)):t.props.dispatcher.trigger("loaded")}()},render(e){t.props.model.selectDiagram(decodeURI(e)),t.state.diagramName=decodeURI(e),document.getElementById("showAllObjects").checked=!0,document.getElementById("showAllObjects").dispatchEvent(new MouseEvent("click"))},geoRegions(e,n){let r=t.elements(e,"GeographicalRegion","Geographical Regions",n);r.each((function(e,n){let r=t.props.model.getTargets([e],"GeographicalRegion.Regions");t.subGeoRegions(d3.select(this),r),t.subAddButton(d3.select(this),"SubGeographicalRegion","cim:SubGeographicalRegion.Region")})),t.createDeleteMenu(r)},subGeoRegions(e,n){let r=e.data()[0],i=t.elements(e,t.props.model.ID(r)+"SubGeographicalRegion","Sub-Geographical Regions",n);t.createDeleteMenu(i)},substations(e,n){let r=t.elements(e,"Substation","Substations",n);r.each((function(e,n){let r=t.props.model.getTargets([e],"Substation.VoltageLevels");t.voltageLevels(d3.select(this),r),t.subAddButton(d3.select(this),"VoltageLevel","cim:VoltageLevel.Substation")})),t.createDeleteMenu(r)},voltageLevels(e,n){let r=e.data()[0],i=t.elements(e,t.props.model.ID(r)+"VoltageLevel","Voltage Levels",n);i.each((function(e,n){let r=t.props.model.getTargets([e],"VoltageLevel.Bays");t.bays(d3.select(this),r),t.subAddButton(d3.select(this),"Bay","cim:Bay.VoltageLevel")})),t.createDeleteMenu(i)},bays(e,n){let r=e.data()[0],i=t.elements(e,t.props.model.ID(r)+"Bay","Bays",n);t.createDeleteMenu(i)},powerTransformers(e,n){t.elements(e,"PowerTransformer","Transformers",n).each((function(e,n){let r=t.props.model.getTargets([e],"PowerTransformer.PowerTransformerEnd");t.elements(d3.select(this),t.props.model.ID(e)+"PowerTransformerEnd","Transformer Windings",r).each((function(e,n){let r=t.props.model.getTargets([e],"TransformerEnd.RatioTapChanger");t.tapChangers(d3.select(this),r)}))}))},nlCompensators(e,n){t.elements(e,"NonlinearShuntCompensator","Nonlinear",n).each((function(e,n){let r=t.props.model.getTargets([e],"NonlinearShuntCompensator.NonlinearShuntCompensatorPoints");t.nlCompensatorPoints(d3.select(this),r),t.subAddButton(d3.select(this),"NonlinearShuntCompensatorPoint","cim:NonlinearShuntCompensatorPoint.NonlinearShuntCompensator")}))},nlCompensatorPoints(e,n){let r=e.data()[0],i=t.elements(e,t.props.model.ID(r)+"NonlinearShuntCompensatorPoint","Points",n,!0);t.createDeleteMenu(i)},tapChangers(e,n){let r=e.data()[0],i=t.elements(e,t.props.model.ID(r)+"RatioTapChanger","Ratio Tap Changer",n);t.createDeleteMenu(i)},limitSets(e,n){const r=e.data()[0];let i=t.elements(e,t.props.model.ID(r)+"OperationalLimitSet","Operational Limit Sets",n);i.each((function(e,n){let r=t.props.model.getTargets([e],"OperationalLimitSet.OperationalLimitValue");t.limits(d3.select(this),r),t.subAddButton(d3.select(this),"VoltageLimit","cim:OperationalLimit.OperationalLimitSet"),t.subAddButton(d3.select(this),"CurrentLimit","cim:OperationalLimit.OperationalLimitSet"),t.subAddButton(d3.select(this),"ActivePowerLimit","cim:OperationalLimit.OperationalLimitSet"),t.subAddButton(d3.select(this),"ApparentPowerLimit","cim:OperationalLimit.OperationalLimitSet")})),t.createDeleteMenu(i)},limits(e,n){let r=e.data()[0],i=n.filter((e=>t.props.model.schema.isA("VoltageLimit",e))),o=n.filter((e=>t.props.model.schema.isA("CurrentLimit",e))),a=n.filter((e=>t.props.model.schema.isA("ActivePowerLimit",e))),s=n.filter((e=>t.props.model.schema.isA("ApparentPowerLimit",e))),l=t.elements(e,t.props.model.ID(r)+"VoltageLimit","Voltage limits",i),c=t.elements(e,t.props.model.ID(r)+"CurrentLimit","Current limits",o),u=t.elements(e,t.props.model.ID(r)+"ActivePowerLimit","Active power limits",a),d=t.elements(e,t.props.model.ID(r)+"ApparentPowerLimit","Apparent power limits",s);t.createDeleteMenu(l),t.createDeleteMenu(c),t.createDeleteMenu(u),t.createDeleteMenu(d)},createTopContainer(e,n,r,i){let o=e.select("li."+n+"s"),a=o.select("ul#"+n+"sList");if(o.empty()){o=e.append("li").attr("class",n+"s list-group-item d-flex justify-content-between cim-parent-container");let i=o.append("div");i.append("a").attr("class","btn btn-primary btn-sm").attr("role","button").attr("data-bs-toggle","collapse").attr("href","#"+n+"sList").html(r),o.append("h4").append("span").attr("class","badge bg-primary rounded-pill").html(0),a=i.append("ul").attr("id",n+"sList").attr("class","collapse"),o.on("click",(function(e){e.target===this&&t.goToBasePath()}))}return a},createAddButton(e,n){let r=e.select("li."+n+"s"),i=r.select("ul#"+n+"sList"),o=r.select("ul#"+n+"sList > button.cim-add-btn");!0===o.empty()&&(o=i.insert("li",":first-child").append("button").attr("class","btn btn-default btn-sm cim-add-btn").attr("type","submit"),o.html(' Add'),o.on("click.add",(function(){let e=t.props.model.createObject("cim:"+n);t.props.model.addToActiveDiagram(e,[])})))},subAddButton(e,n,r){let i=e.data()[0],o=t.props.model.ID(i)+n,a=e.select("li."+o+"s"),s=a.select("ul#"+o+"sList"),l=a.select("ul#"+o+"sList > button.cim-add-btn");!0===l.empty()&&(l=s.insert("li",":first-child").append("button").attr("class","btn btn-default btn-sm cim-add-btn").attr("type","submit"),l.html(' Add'),l.on("click.add",(function(){let e=t.props.model.createObject("cim:"+n);t.props.model.setLink(e,r,i),t.props.model.addToActiveDiagram(e,[])})))},createDeleteMenu(t){t.selectAll((function(){return this.parentNode.childNodes})).filter("button.cim-object-btn").on("contextmenu",e)},elements(e,n,r,i){let o=e.select("li."+n+"s"),a=o.select("ul#"+n+"sList");if(!0===o.empty()){o=e.append("li").attr("class",n+"s list-group-item d-flex justify-content-between"),o.append("div").append("a").attr("class","btn btn-primary btn-sm").attr("role","button").attr("data-bs-toggle","collapse").attr("href","#"+n+"sList").html(r),o.append("h4").append("span").attr("class","badge bg-primary rounded-pill").html(0),o.on("click",(function(e){e.target===this&&t.goToBasePath()})),a=o.select("div").append("ul").attr("id",n+"sList").attr("class","collapse")}let s=a.selectAll("li."+n).data(i,(function(e){return t.props.model.ID(e)})).enter().append("li").attr("class",n+" CIM-object").on("click",(function(e){e.target===this&&t.goToBasePath()}));s.append("a").attr("class","btn btn-outline-secondary btn-sm cim-expand-object").attr("role","button").attr("data-bs-toggle","collapse").attr("href",(function(e){return"#"+t.props.model.ID(e)})).on("click",(function(e,n){e.preventDefault();let r=d3.select(this.parentNode).select("ul");0===r.selectAll("li.attribute").size()&&t.generateAttrsAndLinks(r)})).html(''),s.append("button").attr("class","btn btn-primary btn-sm cim-object-btn").on("click",(function(e,n){let r=window.location.hash.substring(1).split("/"),i=r[0]+"/"+r[1]+"/"+r[2];window.location.hash.substring(1)!==i+"/"+t.props.model.ID(n)&&route.router.push(i+"/"+t.props.model.ID(n))})).html((function(e){let n=t.props.model.getAttribute(e,"cim:IdentifiedObject.name");return void 0!==n?n.innerHTML:"unnamed"})).attr("draggable","true").on("dragstart",(function(e,n){e.dataTransfer.setData("text/plain",t.props.model.ID(n))}));let l=s.append("ul").attr("id",(function(e){return t.props.model.ID(e)})).attr("class","collapse CIM-object-list"),c=parseInt(o.select(":scope > h4 > span").html());c+=l.size(),o.select(":scope > h4 > span").html(c);const u=o.node();if(null===u.closest(".CIM-object")){let t=u.closest("li.cim-parent-container");for(;null!==t;){let e=t.querySelector(":scope>h4>span"),n=parseInt(e.innerHTML);n+=l.size(),e.innerHTML=n,t=t.parentNode.closest("li.cim-parent-container")}}return l.each((function(e){if(t.props.model.schema.isA("Equipment",e)){let n=t.props.model.getTerminals([e]),r=t.props.model.getTargets([e],"Equipment.OperationalLimitSet");r=r.concat(t.props.model.getTargets(n,"ACDCTerminal.OperationalLimitSet")),t.limitSets(d3.select(this),r)}})),l},generateAttrsAndLinks(e){let n=a(!1===document.getElementById("sshInput").checked,"EQ");t.generateAttributes(n);let r=a(!0===document.getElementById("sshInput").checked,"SSH");t.generateAttributes(r);let i=s(!1===document.getElementById("sshInput").checked,"EQ");t.generateLinks(i);let o=s(!0===document.getElementById("sshInput").checked,"SSH");function a(n,r){return e.selectAll("li.attribute."+r).data((function(n){let i=t.props.model.schema.getSchemaAttributes(n.localName,r),o=e.selectAll("li.attribute > div > span.cim-tree-attribute-name").nodes().map((t=>t.textContent));return i=i.filter((function(t){let e=t.attributes[0].value.substring(1).split(".")[1];return o.indexOf(e)<0})),i.filter((t=>"#IdentifiedObject.mRID"!==t.attributes[0].value))})).enter().append("li").attr("class",l(n,r)).attr("title",(function(t){let e=t.attributes.getNamedItem("rdf:about").value.split(".")[1],n=[].filter.call(t.children,(function(t){return"rdfs:comment"===t.nodeName}));return n.length>0?e+" - "+n[0].textContent:e})).append("div").attr("class","input-group")}function s(n,r){return e.selectAll("li.link."+r).data((function(e){let n=["#NonlinearShuntCompensatorPoint.NonlinearShuntCompensator","#TransformerEnd.Terminal","#PowerTransformerEnd.PowerTransformer","#RatioTapChanger.TransformerEnd","#RegulatingControl.Terminal","#Measurement.Terminal","#Measurement.PowerSystemResource","#Discrete.ValueAliasSet","#OperationalLimitSet.Terminal","#OperationalLimitSet.Equipment","#OperationalLimit.OperationalLimitSet","#SubGeographicalRegion.Region","#VoltageLevel.Substation","#Bay.VoltageLevel"];return t.props.model.schema.getSchemaLinks(e.localName,r).filter((e=>"Yes"===t.props.model.getAttribute(e,"cims:AssociationUsed").textContent)).filter((t=>n.indexOf(t.attributes[0].value)<0))})).enter().append("li").attr("class",l(n,r)).attr("title",(function(t){let e=t.attributes.getNamedItem("rdf:about").value.split(".")[1],n=[].filter.call(t.children,(function(t){return"rdfs:comment"===t.nodeName}));return n.length>0?e+" - "+n[0].textContent:e})).append("div").attr("class","input-group")}function l(e,n){return function(r){let i="attribute "+n;!1===r.attributes.getNamedItem("rdf:about").value.startsWith("#")&&(i+=" entsoe");let o=null;return"EQ"===n&&(o=t.props.model.schema.getSchemaStereotype(r),null!==o&&(i=i+" "+o)),("Operation"===o&&"BUS_BRANCH"===t.props.model.getMode()||!1===e)&&(i+=" d-none"),i}}t.generateLinks(o)},generateAttributes(e){e.append("span").attr("class","input-group-text cim-tree-attribute-name").html((function(t){let e=t.attributes.getNamedItem("rdf:about").value.split(".")[1];return e.length>20&&(e=e.substring(0,20)+"..."),e})),e.filter((function(e){return"#String"===t.props.model.schema.getSchemaAttributeType(e)[0]})).append("input").attr("class","form-control").each(a).attr("type","text").on("input",l),e.filter((function(e){return"#Integer"===t.props.model.schema.getSchemaAttributeType(e)[0]})).append("input").attr("class","form-control").each((function(e){let n=d3.select(this.closest("ul")).data()[0],r=t.props.model.getAttribute(n,"cim:"+e.attributes[0].value.substring(1));void 0!==r?this.value=parseInt(r.innerHTML):d3.select(this).attr("placeholder","none")})).attr("type","number").on("input",l);let n=e.filter((function(e){let n=t.props.model.schema.getSchemaAttributeType(e);return"#Float"===n[0]||"#Decimal"===n[0]}));n.append("input").attr("class","form-control").each((function(e){let n=d3.select(this.closest("ul")).data()[0],r=t.props.model.getAttribute(n,"cim:"+e.attributes[0].value.substring(1));void 0!==r?this.value=parseFloat(r.innerHTML).toFixed(5):d3.select(this).attr("placeholder","none")})).attr("type","number").attr("step","0.00001").on("input",l),n.append("span").attr("class","input-group-text cim-tree-attribute-uom").html((function(e){let n=t.props.model.schema.getSchemaAttributeType(e);return"none"===n[2]?n[1]:n[2]+n[1]}));let r=e.filter((function(e){return"#Boolean"===t.props.model.schema.getSchemaAttributeType(e)[0]}));r.append("button").attr("type","button").attr("class","btn btn-outline-secondary dropdown-toggle cim-tree-dropdown-toggle").attr("data-bs-toggle","dropdown").attr("aria-expanded","false").append("span").attr("class","boolVal").each((function(e){let n=d3.select(this.closest("li.attribute").parentNode).data()[0],r=t.props.model.getAttribute(n,"cim:"+e.attributes[0].value.substring(1));void 0!==r?d3.select(this).text(r.innerHTML):d3.select(this).text("none")}));let i=r.append("ul").attr("class","dropdown-menu dropdown-menu-end");i.append("li").append("a").attr("class","dropdown-item").text("true").on("click",s),i.append("li").append("a").attr("class","dropdown-item").text("false").on("click",s),e.filter((function(e){return"#DateTime"===t.props.model.schema.getSchemaAttributeType(e)[0]})).append("input").attr("class","form-control").each(a).attr("type","datetime-local").on("input",l);let o=e.filter((function(e){return t.props.model.schema.isEnum(e)}));function a(e){let n=d3.select(this.closest("li.attribute").parentNode).data()[0],r=t.props.model.getAttribute(n,"cim:"+e.attributes[0].value.substring(1));void 0!==r?this.value=r.innerHTML:d3.select(this).attr("placeholder","none")}function s(e,n){let r=this.textContent;this.closest("div.input-group").querySelector(":scope>button>span.boolVal").textContent=r;let i=d3.select(this.closest("li.attribute").parentNode).data()[0],o="cim:"+n.attributes[0].value.substring(1);t.props.model.setAttribute(i,o,r)}function l(e,n){let r=d3.select(this.closest("ul")).data()[0],i=n.attributes.getNamedItem("rdf:about").value,o="cim:";!1===i.startsWith("#")&&(o="entsoe:"),i=i.substring(i.indexOf("#")+1);let a=o+i;t.props.model.setAttribute(r,a,this.value)}o.append("button").attr("type","button").attr("class","btn btn-outline-secondary dropdown-toggle cim-tree-dropdown-toggle").attr("data-bs-toggle","dropdown").attr("aria-expanded","false").append("span").attr("class","enumVal").each((function(e){let n=d3.select(this.closest("li.attribute").parentNode).data()[0],r=t.props.model.getEnum(n,"cim:"+e.attributes[0].value.substring(1));void 0!==r?d3.select(this).text(r):d3.select(this).text("none")})),o.append("ul").attr("class","dropdown-menu dropdown-menu-end").selectAll("li").data((function(e){return t.props.model.schema.getSchemaEnumValues(e)})).enter().append("li").append("a").on("click",(function(e,n){this.closest("div.input-group").querySelector(":scope>button>span.enumVal").textContent=n;let r=d3.select(this.closest("li.attribute").parentNode).data()[0],i=d3.select(this.closest("li.attribute")).data()[0],o="cim:"+i.attributes[0].value.substring(1),a=t.props.model.schema.getSchemaEnumName(i)+"."+n;t.props.model.setEnum(r,o,a)})).attr("class","dropdown-item").text((function(t){return t}))},generateLinks(e){e.attr("class","input-group").append("span").attr("class","input-group-text cim-tree-attribute-name").html((function(t){let e=t.attributes.getNamedItem("rdf:about").value.split(".")[1];return e.length>20&&(e=e.substring(0,20)+"..."),e}));let n=e.append("div").attr("class","btn-group cim-tree-btn-group");n.append("button").attr("class","btn btn-outline-secondary cimLinkBtn").attr("type","submit").on("click",(function(t,e){let n="#"+d3.select(this).attr("cim-target"),r=window.location.hash.substring(1).split("/"),i=r[0]+"/"+r[1]+"/"+r[2];route.router.push(i+"/"+n.substring(1))})).attr("cim-target",(function(e){let n=d3.select(this.closest("ul")).data()[0],r=t.props.model.getTargets([n],e.attributes[0].value.substring(1))[0];return void 0===r?"none":t.props.model.ID(r)})).html((function(e){let n=t.props.model.getObject(d3.select(this).attr("cim-target"));if(void 0===n)return d3.select(this).attr("disabled","disabled"),"none";let r=t.props.model.getAttribute(n,"cim:IdentifiedObject.name");return void 0!==r?r.innerHTML:"unnamed"})),n.append("button").attr("class","btn btn-outline-secondary").attr("type","submit").on("click",(function(e,n){let r=d3.select(this.parentNode),i=t.props.model.schema.getLinkRange(n),o=d3.select(".tree").selectAll(".tab-pane > .list-group > .list-group-item > div > ul"),a=o.filter((function(e){let n=!1,r=d3.select(this).select(".CIM-object");return r.size()>0&&(n=!0===t.props.model.schema.isA(i,r.datum())),n})),s=o.filter((function(e){let n=!0,r=d3.select(this).select(".CIM-object");return r.size()>0&&(n=!1===t.props.model.schema.isA(i,r.datum())),n}));t.enterSetLinkMode(r,a,s)})).html("change"),n.append("button").attr("class","btn btn-outline-secondary").attr("type","submit").attr("id","cimRemoveBtn").on("click",(function(e,n){let r=d3.select(this.closest("ul")).data()[0],i="cim:"+n.attributes[0].value.substring(1),o=t.props.model.getObject(this.parentNode.querySelector("[cim-target]").getAttribute("cim-target"));t.props.model.removeLink(r,i,o)})).html((function(){return void 0===t.props.model.getObject(this.parentNode.querySelector("[cim-target]").getAttribute("cim-target"))&&d3.select(this).attr("disabled","disabled"),"remove"}))},setLink(e,n){let r=d3.select(e.node().closest("ul")).data()[0],i=t.props.model.ID(r);if(null!==n){let i="cim:"+e.data()[0].attributes[0].value.substring(1);t.props.model.setLink(r,i,n)}let o=window.location.hash.substring(1).split("/"),a=o[0]+"/"+o[1]+"/"+o[2];route.router.push(a+"/"+i)},enterSetLinkMode(e,n,r){t.state.mode="setLinks",document.getElementById("tree-link-dialog").classList.remove("d-none"),document.getElementById("tree-controls").classList.add("d-none"),n.each((function(n){let r=d3.select(this).selectAll(".CIM-object");r.select("button.cim-object-btn").classed("btn-primary",!1).classed("btn-outline-dark",!0),r.insert("button",":first-child").attr("class","btn btn-outline-dark btn-sm cim-check-btn").attr("type","submit").on("click",(function(){d3.select(this.firstChild).attr("class","far fa-check-square");let n=d3.select(this).datum();t.setLink(e,n),t.exitSetLinkMode()})).append("span").attr("class","far fa-square"),r.selectAll("a.cim-expand-object").classed("d-none",!0)})),r.each((function(t){this.parentNode.parentNode.classList.add("d-none"),this.parentNode.parentNode.classList.remove("d-flex")})),document.querySelectorAll(".tab-content > .tab-pane > ul").forEach((function(t){const e=t.parentNode.getAttribute("id")+"Tab";0===t.querySelectorAll(":scope > li.d-flex").length?document.getElementById(e).classList.add("d-none"):bootstrap.Tab.getInstance(document.querySelector("#"+e)).show()})),d3.select("body").on("keyup.tree",(function(n){27===n.keyCode&&(t.exitSetLinkMode(),t.setLink(e,null))})),d3.select("#tree-link-dialog-cancel").on("click",(function(){t.exitSetLinkMode(),t.setLink(e,null)}))},exitSetLinkMode(){t.state.mode="default",document.getElementById("tree-link-dialog").classList.add("d-none"),document.getElementById("tree-controls").classList.remove("d-none"),d3.select(".tree").selectAll(".tab-pane > .list-group > .list-group-item > div > ul").each((function(t){let e=d3.select(this).selectAll(".CIM-object");e.selectAll("button.cim-check-btn").remove(),e.select("button.cim-object-btn").classed("btn-primary",!0).classed("btn-outline-dark",!1),e.selectAll("a.cim-expand-object").classed("d-none",!1),this.parentNode.parentNode.classList.add("d-flex"),this.parentNode.parentNode.classList.remove("d-none")})),document.querySelectorAll(".tab-content > .tab-pane > ul").forEach((function(t){const e=t.parentNode.getAttribute("id")+"Tab";document.getElementById(e).classList.remove("d-none")})),d3.select("body").on("keyup.tree",null),d3.select("#tree-link-dialog-cancel").on("click",null)},moveTo(e){if(void 0===e)return;let n=null,r=null,i=t.props.model.getObject(e);if(void 0===i)return;if("cim:ConnectivityNode"===i.nodeName||"cim:TopologicalNode"===i.nodeName){let n=t.props.model.getBusbar(i);if(null===n)return;e=t.props.model.ID(n)}if(r=d3.select(".tree").select("#"+e).node(),null===r)return;n=r.parentNode,d3.select(".tree").selectAll(".btn-danger").classed("btn-danger",!1).classed("btn-primary",!0);const o=n.closest("div.tab-pane").getAttribute("id")+"Tab";if(document.getElementById(o).classList.contains("active"))t.scrollTo("#"+e);else{document.querySelector("#"+o).addEventListener("shown.bs.tab",(function n(r){t.scrollTo("#"+e),this.removeEventListener("shown.bs.tab",n)}))}bootstrap.Tab.getInstance(document.querySelector("#"+o)).show(),d3.select(n).select("button.cim-object-btn").classed("btn-danger",!0).classed("btn-primary",!1)},deleteObject(t){let e=d3.select("div.tree").select("ul#"+t).node();if(null!==e){let t=e.parentNode;t.closest("li.list-group-item").querySelectorAll(":scope>h4>span").forEach((function(t){let e=parseInt(t.innerHTML);e-=1,t.innerHTML=e}));let n=t.closest("li.cim-parent-container");for(;null!==n;){let t=n.querySelector(":scope>h4>span"),e=parseInt(t.innerHTML);e-=1,t.innerHTML=e,n=n.parentNode.closest("li.cim-parent-container")}t.remove()}},scrollTo(e){let n=document.querySelector(e).parentNode.closest(".collapse:not(.show)");for(null===n&&i(e);null!==n;){function r(n){n.stopPropagation();let o=d3.select(this.parentNode).filter(".CIM-object").select("ul");o.size()>0&&0===o.selectAll("li.attribute").size()&&t.generateAttrsAndLinks(o),i(e),this.removeEventListener("shown.bs.collapse",r)}n.addEventListener("shown.bs.collapse",r);let o=bootstrap.Collapse.getInstance(n);null===o&&(o=new bootstrap.Collapse(n,{toggle:!1})),o.show(),n=n.parentNode.closest(".collapse:not(.show)")}function i(t){const e=document.getElementById("tab-content"),n=e.querySelector(t),r=e.getBoundingClientRect().top+document.body.scrollTop,i=n.parentNode.getBoundingClientRect().top+document.body.scrollTop;e.scrollTop=e.scrollTop+i-r}},resetAttrs(){!0===document.getElementById("sshInput").checked?(d3.select("#app-tree").selectAll("li.attribute:not(.SSH)").classed("d-none",!0),d3.select("#app-tree").selectAll("li.link:not(.SSH)").classed("d-none",!0),d3.select("#app-tree").selectAll("li.attribute.SSH").classed("d-none",!1),d3.select("#app-tree").selectAll("li.link.SSH").classed("d-none",!1)):(d3.select("#app-tree").selectAll("li.attribute:not(.SSH)").classed("d-none",!1),d3.select("#app-tree").selectAll("li.link:not(.SSH)").classed("d-none",!1),d3.select("#app-tree").selectAll("li.attribute.SSH").classed("d-none",!0),d3.select("#app-tree").selectAll("li.link.SSH").classed("d-none",!0))}},template:function(t,e,n,r){return t('
              ',[])},name:"cimtree"}}));"use strict";function cimModel(){const t="http://iec.ch/TC57/2013/CIM-schema-cim16#",e="http://entsoe.eu/CIM/SchemaExtension/3/1#",n="http://iec.ch/TC57/61970-552/ModelDescription/1#",r="http://www.w3.org/1999/02/22-rdf-syntax-ns#",i='';let o={all:null},a=new Map,s=new Map,l="NODE_BREAKER";function c(t){let e=new DOMParser,n=[],r=[],a=[],s=[],l=[],c=[],u=null,f=null;function h(t){for(const e in t){let i=new DOMParser,o=fflate.strFromU8(t[e]),d=i.parseFromString(o,"application/xml");if(d.children.length>0&&"rdf:RDF"!==d.children[0].nodeName)return Promise.reject(new DOMException("invalid input file."));if(0===n.length||0===r.length||0===a.length||0===s.length||0===l.length||0===c.length||null===u||null===f){let t=[].filter.call(d.children[0].children,(function(t){return"md:FullModel"===t.nodeName}))[0];if(void 0===t)return Promise.reject("error: invalid CGMES file.");let e=x.getAttribute(t,"md:Model.profile");e.textContent.includes("Equipment")&&(!1===e.textContent.includes("Boundary")?n.push(d):u=d),e.textContent.includes("DiagramLayout")&&r.push(d),e.textContent.includes("StateVariables")&&a.push(d),e.textContent.includes("Topology")&&(!1===e.textContent.includes("Boundary")?s.push(d):f=d),e.textContent.includes("SteadyStateHypothesis")&&l.push(d),e.textContent.includes("GeographicalLocation")&&c.push(d)}}return Promise.resolve()}return function(p){var m;return(m=new Uint8Array(p),new Promise((function(t,e){fflate.unzip(m,((n,r)=>{null===n?t(r):e(new DOMException("problem unzipping input file."))}))}))).then(h).then((function(){if(n.length>0&&!1===t){let t=e.parseFromString(i,"application/xml");for(let e of n)for(let n of e.children[0].children)"md:FullModel"!==n.nodeName&&t.children[0].appendChild(n.cloneNode(!0));for(let e of r)for(let n of e.children[0].children)"md:FullModel"!==n.nodeName&&t.children[0].appendChild(n.cloneNode(!0));for(let e of a)for(let n of e.children[0].children)"md:FullModel"!==n.nodeName&&t.children[0].appendChild(n.cloneNode(!0));for(let e of s)for(let n of e.children[0].children)"md:FullModel"!==n.nodeName&&t.children[0].appendChild(n.cloneNode(!0));for(let e of l)for(let n of e.children[0].children)"md:FullModel"!==n.nodeName&&t.children[0].appendChild(n.cloneNode(!0));for(let e of c)for(let n of e.children[0].children)"md:FullModel"!==n.nodeName&&t.children[0].appendChild(n.cloneNode(!0));if(null!==u)for(let e of u.children[0].children)"md:FullModel"!==e.nodeName&&t.children[0].appendChild(e.cloneNode(!0));if(null!==f)for(let e of f.children[0].children)"md:FullModel"!==e.nodeName&&t.children[0].appendChild(e.cloneNode(!0));return o.all=t,d()}if(null===o.all||!1===t)return Promise.reject("Invalid CGMES file: no equipment description found.");if(null!==u){let t=u.children[0].children,e=[].filter.call(t,(function(t){return"cim:ConnectivityNode"===t.nodeName})).filter((t=>x.isBoundary(t))).length;return x.updateModel(u),null!==f&&x.updateModel(f),Promise.resolve("Loaded "+e+" boundary nodes.")}return Promise.reject("Invalid boundary file: no equipment boundary file found.")})).catch((function(e){return!1===t&&x.clear(),Promise.reject(e)}))}}function u(t){const e=new FileReader;return new Promise((function(n,r){e.onerror=function(){e.abort(),r(new DOMException("problem parsing input file."))},e.onload=function(){n(e.result)},e.readAsArrayBuffer(t)}))}function d(){let t=f();for(let e in t){let n=t[e],r=x.ID(n);if(null!==r&&(a.set("#"+r,n),void 0!==n.attributes)){let t=x.getLinks(n);for(let e of t){let t=e.localName+e.attributes[0].value,r=s.get(t);void 0===r?s.set(t,[n]):r.push(n)}}}for(let e in t){let n=t[e],r=n.attributes.getNamedItem("rdf:about");if(null!==r){let t=a.get(r.value);if(void 0===t)continue;for(let e of x.getAttributes(n))t.appendChild(e.cloneNode(!0));for(let e of x.getLinks(n)){t.appendChild(e.cloneNode(!0));let n=e.localName+e.attributes[0].value,r=s.get(n);void 0===r?s.set(n,[t]):r.push(t)}n.remove()}}return x.schema.buildSchema()}function f(){let t=[];for(let e of Object.keys(o))void 0!==o[e]&&null!==o[e]&&(t=t.concat([...o[e].children[0].children]));return t}function h(e,n){let i=void 0;void 0!==n&&(i=n.uuid);let s=o.all,l=s.createElementNS(t,e);return s.children[0].appendChild(l),void 0!==i?l.setAttributeNS(r,"rdf:ID",i):l.setAttributeNS(r,"rdf:ID",y()),a.set("#"+x.ID(l),l),l}function p(t){let e=h("cim:Terminal");return m(e,"cim:Terminal.ConductingEquipment",t),x.setAttribute(e,"cim:ACDCTerminal.connected","true"),e}function m(e,n,i){if(x.getTargets([e],n).length>0)return;let o=e.ownerDocument.createElementNS(t,n);e.appendChild(o),o.setAttributeNS(r,"rdf:resource","#"+x.ID(i));let a=o.localName+o.attributes[0].value,l=s.get(a);void 0===l?s.set(a,[e]):l.push(e),x.trigger("addLink",e,n,i)}function g(t,e){let n=x.schema.schemaInvLinksMap.get(e),r=new Map,i=[];for(let o of t){let t=x.ID(o),l=x.getLink(o,"cim:"+e);for(let e of l){let n=a.get(e.attributes.getNamedItem("rdf:resource").value);if(void 0!==n){let e=x.ID(n);i.push({source:o,target:n}),r.set(t+e,1)}}let c=s.get(n+"#"+t);if(void 0!==c)for(let e of c){let n=x.ID(e);void 0===r.get(t+n)&&i.push({source:o,target:e})}}return i}function b(t){let e=[];if(0===arguments.length){let t=[];void 0!==x.activeDiagram&&(t=x.getTargets([x.activeDiagram],"Diagram.DiagramElements")),e=g(t,"DiagramObject.IdentifiedObject")}else if(void 0!==x.activeDiagram){let n=x.getTargets(t,"IdentifiedObject.DiagramObjects");n=g(n,"DiagramObject.Diagram").filter((t=>t.target===x.activeDiagram)).map((t=>t.source)),e=g(n,"DiagramObject.IdentifiedObject")}return e}function v(t){let e=[];if(0===arguments.length){if(void 0!==x.activeDiagram){e=g(b().map((t=>t.target)),"ConductingEquipment.Terminals")}}else if(void 0!==x.activeDiagram){e=g(b(t).map((t=>t.target)),"ConductingEquipment.Terminals")}else e=g(t,"ConductingEquipment.Terminals");return e}function y(){let t=(new Date).getTime();return"_"+"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){let n=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"==e?n:3&n|8).toString(16)}))}function _(t){return[].filter.call(t.children,(function(t){let e=t.attributes.getNamedItem("rdf:resource");return 0!==t.attributes.length&&null!==e&&"#"!==e.value.charAt(0)}))}function w(t,e){return _(t).filter((t=>t.nodeName===e))[0]}let x={fileName:null,activeDiagramName:"none",schema:new cimSchema,load(t){let e=Promise.resolve();return x.fileName!==t.name&&(x.fileName=t.name,e=t.name.endsWith(".zip")?u(t).then(c(!1)).catch((function(t){return x.clear(),Promise.reject(t)})):function(t){const e=new FileReader;return new Promise((function(n,r){e.onerror=function(){e.abort(),r(new DOMException("problem parsing input file."))},e.onload=function(){let t=new DOMParser,i=e.result,o=t.parseFromString(i,"application/xml");o.children.length>0&&"rdf:RDF"!==o.children[0].nodeName&&r(new DOMException("invalid input file.")),n(o)},e.readAsText(t)}))}(t).then((function(t){return o.all=t,d()})).catch((function(t){return x.clear(),Promise.reject(t)}))),e},newFile(t){let e=new DOMParser;return o.all=e.parseFromString(i,"application/xml"),x.fileName=t,d()},updateModel(t){let e=t.children[0].children;for(let t of e){if("md:FullModel"===t.nodeName)continue;let e=t.attributes.getNamedItem("rdf:ID");if(null===e&&(e=t.attributes.getNamedItem("rdf:about")),null===e)continue;let n=e.value;n.startsWith("#")&&(n=n.substring(1));let r=x.getObject(n);void 0===r&&(r=x.createObject(t.nodeName,{uuid:n}))}for(let t of e){if("md:FullModel"===t.nodeName)continue;let e=t.attributes.getNamedItem("rdf:ID");if(null===e&&(e=t.attributes.getNamedItem("rdf:about")),null===e)continue;let n=e.value;n.startsWith("#")&&(n=n.substring(1));let r=x.getObject(n);if(void 0===r)continue;let i=x.getAttributes(t);for(let t of i)x.setAttribute(r,t.nodeName,t.innerHTML);let o=x.getLinks(t);for(let t of o){let e=t.attributes.getNamedItem("rdf:resource").value.substring(1);x.setLink(r,t.nodeName,x.getObject(e))}}},loadBoundary(t){let e=Promise.resolve();return e=t.name.endsWith(".zip")?u(t).then(c(!0)).catch((function(t){return Promise.reject(t)})):Promise.reject("Error: not a boundary file."),e},loadRemote(t){let e=Promise.resolve();return x.fileName!==decodeURI(t).substring(1)&&(x.fileName=decodeURI(t).substring(1),e=d3.xml(t).then((function(t){return o.all=t,d()})).catch((function(t){return x.clear(),Promise.reject(t)}))),e},save(){if(null===o.all)throw new Error("error: no CIM file loaded.");let t="";return t=(new XMLSerializer).serializeToString(o.all),t},saveAsCGMES(){if(null===o.all)return Promise.reject("error: no CIM file loaded.");let t=new XMLSerializer,e={},r=null,a=[];for(let t of o.all.children[0].children){x.getLinks(t).forEach((function(e){let n=x.schema.checkLink(t,e.nodeName);if(n!==e.nodeName){x.getTargets([t],e.localName).forEach((function(e){a.push({s:e,l:n,t:t})}))}}))}a.forEach((function(t){x.setLink(t.s,t.l,t.t)})),r=o.all.children[0].cloneNode(!0).children;let s=["http://entsoe.eu/CIM/EquipmentCore/3/1"];"NODE_BREAKER"===l&&s.push("http://entsoe.eu/CIM/EquipmentOperation/3/1");let c=g("EQ",s,r,[]),u=g("DL",["http://entsoe.eu/CIM/DiagramLayout/3/1"],r,[c]),d=g("SV",["http://entsoe.eu/CIM/StateVariables/4/1"],r,[c]),f=g("TP",["http://entsoe.eu/CIM/Topology/4/1"],r,[c]),h=g("SSH",["http://entsoe.eu/CIM/SteadyStateHypothesis/1/1"],r,[c]),p=g("GL",["http://entsoe.eu/CIM/GeographicalLocation/2/1"],r,[c]);return e["EQ.xml"]=fflate.strToU8(t.serializeToString(c)),e["DL.xml"]=fflate.strToU8(t.serializeToString(u)),e["SV.xml"]=fflate.strToU8(t.serializeToString(d)),e["TP.xml"]=fflate.strToU8(t.serializeToString(f)),e["SSH.xml"]=fflate.strToU8(t.serializeToString(h)),e["GL.xml"]=fflate.strToU8(t.serializeToString(p)),m=e,new Promise((function(t,e){fflate.zip(m,((n,r)=>{null===n?t(new Blob([r.buffer])):e(new DOMException("problem zipping input files."))}))}));var m;function g(t,e,r,o){let a=[].filter.call(r,(function(e){return null!==x.schema.getSchemaObject(e.localName,t)})),s=function(t,e){let r=(new DOMParser).parseFromString(i,"application/xml"),o=document.createElementNS(n,"md:FullModel");return r.children[0].appendChild(o),o.setAttribute("rdf:about","urn:uuid:"+y().substring(1)),t.forEach((function(t){let e=o.ownerDocument.createElementNS(n,"md:Model.profile");e.innerHTML=t,o.appendChild(e)})),e.forEach((function(t){let e=[].filter.call(t.children[0].children,(function(t){return"md:FullModel"===t.nodeName}))[0],n=o.ownerDocument.createElement("md:Model.DependentOn");n.setAttribute("rdf:resource",e.attributes.getNamedItem("rdf:about").value),o.appendChild(n)})),r}(e,o);return function(t,e,n){for(let r in e){let i=e[r].cloneNode();x.getAttributes(e[r]).forEach((function(t){void 0!==x.schema.getSchemaAttribute(i.localName,t.localName,n)&&i.appendChild(t)})),x.getLinks(e[r]).forEach((function(t){void 0!==x.schema.getSchemaLink(i.localName,t.localName,n)&&i.appendChild(t)})),_(e[r]).forEach((function(t){void 0!==x.schema.getSchemaAttribute(i.localName,t.localName,n)&&i.appendChild(t)}));let o=x.schema.isDescription(i,n),a=x.schema.isConcrete(i,n);if(!0===o&&null!==x.ID(i)){let t=x.ID(i);i.removeAttribute("rdf:ID");let e=i.ownerDocument.createAttribute("rdf:about");e.value="#"+t,i.setAttributeNode(e)}!0===a&&(!1===o||i.children.length>0)&&t.children[0].appendChild(i)}}(s,a,t),s}},export(){let t=new DOMParser,e=new XMLSerializer,n=t.parseFromString(i,"application/xml");if(void 0===x.activeDiagram)return e.serializeToString(n);n.children[0].appendChild(x.activeDiagram.cloneNode(!0));let r=x.getTargets([x.activeDiagram],"Diagram.DiagramElements");for(let t of r)n.children[0].appendChild(t.cloneNode(!0));let o=x.getTargets(r,"DiagramObject.IdentifiedObject");for(let t of o)n.children[0].appendChild(t.cloneNode(!0));let a=x.getTargets(r,"DiagramObject.DiagramObjectPoints");for(let t of a)n.children[0].appendChild(t.cloneNode(!0));let s=x.getTerminals(o);for(let t of s)n.children[0].appendChild(t.cloneNode(!0));let l=x.getNodes();for(let t of l)n.children[0].appendChild(t.cloneNode(!0));let c=x.getLinkedObjects(["cim:Substation","cim:Line"],["EquipmentContainer.Equipments"]),u=c["cim:Substation"];for(let t of u)n.children[0].appendChild(t.cloneNode(!0));let d=c["cim:Line"];for(let t of d)n.children[0].appendChild(t.cloneNode(!0));let f=x.getTargets(o,"ConductingEquipment.BaseVoltage");for(let t of f)n.children[0].appendChild(t.cloneNode(!0));let h=x.getTargets(o,"PowerTransformer.PowerTransformerEnd");for(let t of h)n.children[0].appendChild(t.cloneNode(!0));let p=x.getTargets(s,"ACDCTerminal.Measurements");for(let t of p)n.children[0].appendChild(t.cloneNode(!0));let m=x.getTargets(p,"Analog.AnalogValues");for(let t of m)n.children[0].appendChild(t.cloneNode(!0));return e.serializeToString(n)},getDiagramList:()=>x.getObjects(["cim:Diagram"])["cim:Diagram"].map((t=>(void 0===x.getAttribute(t,"cim:IdentifiedObject.name")&&x.setAttribute(t,"cim:IdentifiedObject.name","unnamed diagram"),x.getAttribute(t,"cim:IdentifiedObject.name")))).map((t=>t.textContent)),getObjects(t){let e={},n=f();for(let n of t)e[n]=[];return e=[].reduce.call(n,(function(t,e){return void 0!==t[e.nodeName]&&t[e.nodeName].push(e),t}),e),e},getSubObjects:t=>f().filter((function(e){return!0===x.schema.isA(t,e)})),getGraphicObjects(t){let e={},n=b().map((t=>t.target)),r=new Set(n);for(let n of t)e[n]=[];return e=[...r].reduce((function(t,e){return void 0!==t[e.nodeName]&&t[e.nodeName].push(e),t}),e),e},getNodes(){let t="cim:ConnectivityNode";"BUS_BRANCH"===l&&(t="cim:TopologicalNode");let e=x.getObjects([t])[t],n=x.getGraphicObjects([t])[t],r=e.filter((t=>-1===n.indexOf(t)));return r=r.filter((function(t){let e=x.getBusbar(t),n=x.getEquipments(t);return null!==e||n.length>1})),n.concat(r)},getConnectors(t){let e={};for(let n of t){let t=x.getObjects([n])[n],r=x.getGraphicObjects([n])[n],i=t.filter((t=>-1===r.indexOf(t)));i=i.filter((function(t){let e=x.getNode(t);if(null!==e){return x.getDiagramObjects([e]).length>0}return!1})),e[n]=r.concat(i)}return e},getLinkedObjects(t,e){let n={};for(let r of t)n[r]=x.getObjects([r])[r].filter((function(t){let n=[t],r=[];for(let r of e){let e=r.split("/"),i=[t];for(let t=0;t0}));return n},getTerminals(t){let e=v(t).map((t=>t.target));return e=[...new Set(e)],e},getObject:t=>a.get("#"+t),getAttributes(t){if(null!=t)return[].filter.call(t.children,(function(t){return 0===t.attributes.length}))},getAttribute(t,e){if(void 0===t)return;if(null===t)return;return x.getAttributes(t).filter((t=>t.nodeName===e))[0]},setAttribute(n,r,i){let o=x.getAttribute(n,r);if(void 0!==o)o.innerHTML=i;else{let a=t;r.startsWith("entsoe:")&&(a=e),o=n.ownerDocument.createElementNS(a,r),o.innerHTML=i,n.appendChild(o)}x.trigger("setAttribute",n,r,i)},setEnum(e,n,r){let i=w(e,n);if(void 0===i){i=e.ownerDocument.createElement(n);let t=e.ownerDocument.createAttribute("rdf:resource");t.nodeValue="#",i.setAttributeNode(t),e.appendChild(i)}i.attributes[0].value=t+r,x.trigger("setEnum",e,n,r)},createObject(t,e){let n=h(t,e);if(x.schema.isA("IdentifiedObject",n)&&x.setAttribute(n,"cim:IdentifiedObject.name","new1"),!1===x.schema.isA("ConductingEquipment",n))return x.trigger("createObject",n),n;let r=2,i=null;void 0!==e&&(void 0!==e.windNum&&(r=e.windNum),void 0!==e.node&&(i=e.node));let o=p(n),a=null,s=null;if("cim:ACLineSegment"!==t&&"cim:Breaker"!==t&&"cim:Disconnector"!==t&&"cim:LoadBreakSwitch"!==t&&"cim:Junction"!==t&&"cim:PowerTransformer"!==t||(a=p(n)),"cim:PowerTransformer"===t&&3===r&&(s=p(n)),"cim:BusbarSection"===t){let t="ConnectivityNode";"BUS_BRANCH"===l&&(t="TopologicalNode"),null===i&&(i=h("cim:"+t)),m(o,"cim:Terminal."+t,i)}if("cim:PowerTransformer"===t){let t=h("cim:PowerTransformerEnd"),e=h("cim:PowerTransformerEnd");if(x.setAttribute(t,"cim:IdentifiedObject.name","winding1"),x.setAttribute(e,"cim:IdentifiedObject.name","winding2"),m(n,"cim:PowerTransformer.PowerTransformerEnd",t),m(n,"cim:PowerTransformer.PowerTransformerEnd",e),m(t,"cim:TransformerEnd.Terminal",o),m(e,"cim:TransformerEnd.Terminal",a),3===r){let t=h("cim:PowerTransformerEnd");x.setAttribute(t,"cim:IdentifiedObject.name","winding3"),m(n,"cim:PowerTransformer.PowerTransformerEnd",t),m(t,"cim:TransformerEnd.Terminal",s)}}return x.trigger("createObject",n),n},deleteObjects(t){let e=[],n=[];for(let s of t){"cim:ConnectivityNode"!==s.nodeName&&"cim:TopologicalNode"!==s.nodeName||(n=n.concat(o(s))),"cim:BusbarSection"===s.nodeName&&(n=n.concat(i(s)));let t=x.getLinks(s);for(let i of t){let t=a.get(i.attributes.getNamedItem("rdf:resource").value),o=i.nodeName;void 0!==t&&(r(s,t)&&n.push(t),e.push({s:s,l:o,t:t}))}}for(let[i,o]of s){let s=i.split("#"),l="cim:"+s[0],c="#"+s[1],u=a.get(c);if(t.indexOf(u)>-1)for(let t of o)e.push({s:t,l:l,t:u}),r(u,t)&&n.push(t)}for(let t of e)x.removeLink(t.s,t.l,t.t);n.length>0&&x.deleteObjects(n);for(let e of t){let t=x.ID(e),n=e.localName;a.delete("#"+t),e.remove(),x.trigger("deleteObject",t,n)}function r(t,e){return!(!x.schema.isA("ConductingEquipment",t)||"cim:Terminal"!==e.nodeName)||("cim:DiagramObjectPoint"===e.nodeName||("cim:DiagramObjectPoint"!==t.nodeName&&"cim:DiagramObject"===e.nodeName||("cim:PowerTransformer"===t.nodeName&&"cim:PowerTransformerEnd"===e.nodeName||("cim:GeographicalRegion"===t.nodeName&&"cim:SubGeographicalRegion"===e.nodeName||("cim:SubGeographicalRegion"===t.nodeName&&"cim:Substation"===e.nodeName||("cim:Substation"===t.nodeName&&"cim:VoltageLevel"===e.nodeName||"cim:VoltageLevel"===t.nodeName&&"cim:Bay"===e.nodeName))))))}function i(t){let e="ConnectivityNode";if("BUS_BRANCH"===l&&(e="TopologicalNode"),"cim:BusbarSection"===t.nodeName){let n=x.getTargets([t],"ConductingEquipment.Terminals");return x.getTargets(n,"Terminal."+e)}return[]}function o(t){let e="ConnectivityNode.Terminals";"BUS_BRANCH"===l&&(e="TopologicalNode.Terminal");let n=x.getTargets([t],e);return x.getTargets(n,"Terminal.ConductingEquipment").filter((t=>"cim:BusbarSection"===t.nodeName))}},deleteObject(t){x.deleteObjects([t])},getNode(t){let e="ConnectivityNode";if("BUS_BRANCH"===l&&(e="TopologicalNode"),"cim:BusbarSection"===t.nodeName){let n=x.getTargets([t],"ConductingEquipment.Terminals"),r=x.getTargets(n,"Terminal."+e);return 0===r.length?null:r[0]}return null},getBusbar(t){let e="ConnectivityNode.Terminals";"BUS_BRANCH"===l&&(e="TopologicalNode.Terminal");let n=x.getTargets([t],e),r=x.getTargets(n,"Terminal.ConductingEquipment").filter((t=>"BusbarSection"===t.localName)),i=x.getDiagramObjects([t].concat(r));return r.length>0&&i.length>0?r[0]:null},deleteFromDiagram(t){let e=x.ID(t),n=x.getDiagramObjects([t]),r="ConnectivityNode";if("BUS_BRANCH"===l&&(r="TopologicalNode"),"BusbarSection"===t.localName){let e=x.getNode(t);n=n.concat(x.getDiagramObjects([e]))}if(t.localName===r){let e=x.getBusbar(t);null!==e&&(n=n.concat(x.getDiagramObjects([e])))}let i=x.getTargets(n,"DiagramObject.DiagramObjectPoints");for(let t of n)x.deleteObject(t);for(let t of i)x.deleteObject(t);x.trigger("deleteFromDiagram",e)},addToActiveDiagram(t,e){let n=h("cim:DiagramObject");for(let r of e){let e=h("cim:DiagramObjectPoint");x.setAttribute(e,"cim:DiagramObjectPoint.xPosition",r.x+t.x),x.setAttribute(e,"cim:DiagramObjectPoint.yPosition",r.y+t.y),x.setAttribute(e,"cim:DiagramObjectPoint.sequenceNumber",r.seq),m(e,"cim:DiagramObjectPoint.DiagramObject",n)}void 0!==t.rotation&&x.setAttribute(n,"cim:DiagramObject.rotation",t.rotation),m(n,"cim:DiagramObject.IdentifiedObject",t),m(n,"cim:DiagramObject.Diagram",x.activeDiagram),x.trigger("addToActiveDiagram",t)},updateActiveDiagram(t,e){let n=x.getDiagramObjects([t]);if(("cim:ConnectivityNode"===t.nodeName||"cim:TopologicalNode"===t.nodeName)&&0===n.length){let e=x.getEquipments(t).filter((t=>"BusbarSection"===t.localName))[0];void 0!==e&&(n=x.getDiagramObjects([e]))}for(let e of n)x.setAttribute(e,"cim:DiagramObject.rotation",t.rotation);let r=x.getTargets(n,"DiagramObject.DiagramObjectPoints");if(r.length>0){for(let e of r){let n=1,r=x.getAttribute(e,"cim:DiagramObjectPoint.sequenceNumber");void 0!==r&&(n=parseInt(r.innerHTML));let i=t.lineData.filter((t=>t.seq===n))[0];x.getAttribute(e,"cim:DiagramObjectPoint.xPosition").innerHTML=i.x+t.x,x.getAttribute(e,"cim:DiagramObjectPoint.yPosition").innerHTML=i.y+t.y}x.trigger("updateActiveDiagram",t)}else x.addToActiveDiagram(t,t.lineData)},getLinks:t=>[].filter.call(t.children,(function(t){let e=t.attributes.getNamedItem("rdf:resource");return 0!==t.attributes.length&&null!==e&&"#"===e.value.charAt(0)})),getLink:(t,e)=>x.getLinks(t).filter((t=>t.nodeName===e)),getEnum(t,e){let n=w(t,e),r=void 0;return void 0!==n&&(r=n.attributes.getNamedItem("rdf:resource").value.split("#")[1].split(".")[1]),r},setLink(t,e,n){let r=x.getTargets([t],e.split(":")[1]);for(let n of r)x.removeLink(t,e,n);m(t,e,n)},removeLink(t,e,n){i(x.getLink(t,e),t,n);let r=x.schema.schemaInvLinksMap.get(e.split(":")[1]);if(void 0!==r){i(x.getLink(n,"cim:"+r),n,t)}function i(t,e,n){for(let r of t){let t=r.attributes.getNamedItem("rdf:resource").value;if(t==="#"+x.ID(n)){let n=r.localName+t,i=s.get(n);r.remove(),1===i.length?s.delete(n):i.splice(i.indexOf(e),1)}}}x.trigger("removeLink",t,e,n)},getTargets(t,e){let n=g(t,e).map((t=>t.target));return[...new Set(n)]},getDiagramObjects(t){let e=b(t).map((t=>t.source));return[...new Set(e)]},getEquipments(t){let e="ConnectivityNode.Terminals";"BUS_BRANCH"===l&&(e="TopologicalNode.Terminal");let n=x.getTargets([t],e),r=x.getTargets(n,"Terminal.ConductingEquipment");return r=v(r).map((t=>t.source)),[...new Set(r)]},selectDiagram(t){t!==x.activeDiagramName&&(x.activeDiagramName=t,x.activeDiagram=x.getObjects(["cim:Diagram"])["cim:Diagram"].filter((t=>x.getAttribute(t,"cim:IdentifiedObject.name").textContent===x.activeDiagramName))[0]),void 0===x.activeDiagram&&(x.activeDiagram=h("cim:Diagram"),x.setAttribute(x.activeDiagram,"cim:IdentifiedObject.name",t),x.activeDiagramName=t,x.trigger("createdDiagram")),x.trigger("changedDiagram")},isBoundary(t){let e=!1,n=x.getAttribute(t,"entsoe:ConnectivityNode.boundaryPoint");return void 0!==n&&"true"===n.textContent&&(e=!0),e},getMode:()=>l,setMode(t){"NODE_BREAKER"!==t&&"BUS_BRANCH"!==t||(l=t),x.trigger("setMode",l)},ID(t){if(null==t)return null;if(void 0===t.attributes)return null;{let e=t.attributes.getNamedItem("rdf:ID");return null===e?null:e.value}},clear(){o.all=null,x.fileName=null,a=new Map,s=new Map}};return observable(x),x}function cimSchema(){let t={EQ:null,DL:null,SV:null,TP:null,SSH:null,GL:null};let e=new Map,n=new Map,r=new Map;function i(t,e){let n=[],r=o.getSchemaObject(t,e);if(null===r)return n;let a=[].filter.call(r.children,(function(t){return"rdfs:subClassOf"===t.nodeName}))[0];if(void 0!==a){let t=a.attributes[0].value.substring(1);n.push(t),n=n.concat(i(t,e))}return n}let o={schemaInvLinksMap:new Map,buildSchema(){return null===t.EQ?d3.xml("rdf-schema/EquipmentProfileCoreShortCircuitOperationRDFSAugmented-v2_4_15-16Feb2016.rdf").then((function(n){return t.EQ=n,e(t.EQ),d3.xml("rdf-schema/DiagramLayoutProfileRDFSAugmented-v2_4_15-16Feb2016.rdf")})).then((function(n){return t.DL=n,e(t.DL),d3.xml("rdf-schema/StateVariablesProfileRDFSAugmented-v2_4_15-16Feb2016.rdf")})).then((function(n){return t.SV=n,e(t.SV),d3.xml("rdf-schema/TopologyProfileRDFSAugmented-v2_4_15-16Feb2016.rdf")})).then((function(n){return t.TP=n,e(t.TP),d3.xml("rdf-schema/SteadyStateHypothesisProfileRDFSAugmented-v2_4_15-16Feb2016.rdf")})).then((function(n){return t.SSH=n,e(t.SSH),d3.xml("rdf-schema/GeographicalLocationProfileRDFSAugmented-v2_4_15-16Feb2016.rdf")})).then((function(n){t.GL=n,e(t.GL)})).catch((function(t){return Promise.reject(t)})):Promise.resolve();function e(t){let e=t.children[0].children;for(let t in e){let n=e[t];if(void 0===n.children)continue;let r=[].filter.call(n.children,(function(t){return"cims:inverseRoleName"===t.nodeName}))[0];void 0!==r&&o.schemaInvLinksMap.set(n.attributes[0].value.substring(1),r.attributes[0].value.substring(1))}}},getSchemaObject(e,n){let i=null;for(let o of Object.keys(t)){if(void 0!==n&&n!==o)continue;let a=r.get(o+e);if(null!=a){i=a;break}if(null===a){if(void 0!==n)break;continue}let s=t[o].children[0].children;if(a=[].filter.call(s,(function(t){return t.attributes[0].value==="#"+e}))[0],void 0!==a){i=a,r.set(o+e,a);break}r.set(o+e,null)}return i},getSchemaEnumValues(e,n){let r="EQ";void 0!==n&&(r=n);let i=[].filter.call(e.children,(function(t){return"rdfs:range"===t.nodeName}))[0].attributes.getNamedItem("rdf:resource").value.substring(1),o=t[r].children[0].children;return[].filter.call(o,(function(t){return t.attributes[0].value.startsWith("#"+i+".")})).map((t=>[].filter.call(t.children,(function(t){return"rdfs:label"===t.nodeName}))[0].textContent))},getSchemaEnumName:t=>[].filter.call(t.children,(function(t){return"rdfs:range"===t.nodeName}))[0].attributes.getNamedItem("rdf:resource").value.substring(1),getSchemaAttributes(n,r){let o=n,a="EQ";void 0!==r&&(a=r),o+=a;let s=e.get(o);if(void 0===s){let r=t[a].children[0].children;s=[].filter.call(r,(function(t){return t.attributes.getNamedItem("rdf:about").value.startsWith("#"+n+".")}));let l=i(n,a);for(let t in l)s=s.concat([].filter.call(r,(function(e){return e.attributes.getNamedItem("rdf:about").value.startsWith("#"+l[t]+".")})));s=s.filter((function(t){let e=t.attributes.getNamedItem("rdf:about").value;e=e.substring(e.indexOf("#"));let n=!1,r=e.split(".")[1];return void 0!==r&&(n=r.toLowerCase().charAt(0)===r.charAt(0)),n})),e.set(o,s)}return s},getSchemaAttribute:(t,e,n)=>o.getSchemaAttributes(t,n).filter((t=>t.attributes[0].value.substring(1)===e))[0],isEnum:t=>void 0===[].filter.call(t.children,(function(t){return"cims:dataType"===t.nodeName}))[0],getSchemaAttributeType(t){let e="none",n="none";if(o.isEnum(t))return["#Enum",e,n];let r=[].filter.call(t.children,(function(t){return"cims:dataType"===t.nodeName}))[0].attributes.getNamedItem("rdf:resource").value,i=o.getSchemaObject(r.substring(1));if("CIMDatatype"===[].filter.call(i.children,(function(t){return"cims:stereotype"===t.nodeName}))[0].textContent){let t=o.getSchemaObject(r.substring(1)+".value"),i=o.getSchemaObject(r.substring(1)+".unit"),a=o.getSchemaObject(r.substring(1)+".multiplier");if(r=[].filter.call(t.children,(function(t){return"cims:dataType"===t.nodeName}))[0].attributes.getNamedItem("rdf:resource").value,null!==i&&(e=[].filter.call(i.children,(function(t){return"cims:isFixed"===t.nodeName}))[0].attributes.getNamedItem("rdfs:Literal").value),null!==a){let t=[].filter.call(a.children,(function(t){return"cims:isFixed"===t.nodeName}))[0];void 0!==t&&(n=t.attributes.getNamedItem("rdfs:Literal").value)}}return[r,e,n]},getSchemaStereotype(t){let e=[].filter.call(t.children,(function(t){return"cims:stereotype"===t.nodeName&&""!==t.textContent}));return e.length>0?e[0].textContent:null},getSchemaLinks(e,r){let o=e;o+=void 0!==r?r:"EQ";let a=n.get(o);if(void 0===a){let s=t.EQ;void 0!==r&&(s=t[r]);let l=s.children[0].children;a=[].filter.call(l,(function(t){return t.attributes[0].value.startsWith("#"+e+".")}));let c=i(e);for(let t in c)a=a.concat([].filter.call(l,(function(e){return e.attributes[0].value.startsWith("#"+c[t]+".")})));a=a.filter((function(t){let e=!1,n=t.attributes[0].value.split(".")[1];return void 0!==n&&(e=n.toLowerCase().charAt(0)!==n.charAt(0)),e})),n.set(o,a)}return a},getAllSchemasLinks(e){let n=[];return Object.keys(t).forEach((function(t){n=n.concat(o.getSchemaLinks(e,t))})),n},getSchemaLink:(t,e,n)=>o.getSchemaLinks(t,n).filter((t=>t.attributes[0].value.substring(1)===e))[0],getAllSchemasLink:(t,e)=>o.getAllSchemasLinks(t).filter((t=>t.attributes[0].value.substring(1)===e))[0],isA:(t,e)=>e.localName===t||!(i(e.localName).indexOf(t)<0),isConcrete(t,e){let n=!1,r=o.getSchemaObject(t.localName,e);if(null!==r){[].filter.call(r.children,(function(t){return"cims:stereotype"===t.nodeName})).forEach((function(t){let e=t.attributes.getNamedItem("rdf:resource");if(null!==e){"http://iec.ch/TC57/NonStandard/UML#concrete"===e.value&&(n=!0)}}))}return n},isDescription(t,e){let n=!1,r=o.getSchemaObject(t.localName,e);if(null!==r){[].filter.call(r.children,(function(t){return"cims:stereotype"===t.nodeName})).forEach((function(t){"Description"===t.textContent&&(n=!0)}))}return n},checkLink(t,e){let n=e,r=o.getAllSchemasLink(t.localName,e.split(":")[1]);if(void 0!==r){if("No"===[].filter.call(r.children,(function(t){return"cims:AssociationUsed"===t.nodeName}))[0].textContent){n="cim:"+o.schemaInvLinksMap.get(e.split(":")[1])}}return n},getLinkDomain(t){if(void 0===t)return null;if(null===t)return null;let e=[].filter.call(t.children,(function(t){return"rdfs:domain"===t.nodeName}))[0];return void 0===e?null:e.attributes.getNamedItem("rdf:resource").value.substring(1)},getLinkRange(t){if(void 0===t)return null;if(null===t)return null;let e=[].filter.call(t.children,(function(t){return"rdfs:range"===t.nodeName}))[0];return void 0===e?null:e.attributes.getNamedItem("rdf:resource").value.substring(1)}};return o}function topologyProcessor(t){return{calcTopology(){let e=[],n=t.getObjects(["cim:TopologicalNode"])["cim:TopologicalNode"];"BUS_BRANCH"===t.getMode()&&n.forEach((function(e){let n=t.createObject("cim:ConnectivityNode");t.getTargets([e],"TopologicalNode.Terminal").forEach((function(e){t.setLink(e,"cim:Terminal.ConnectivityNode",n)}))})),t.deleteObjects(n),n=[];let r=[],i=t.getObjects(["cim:ConnectivityNode"])["cim:ConnectivityNode"];for(;i.length>0;){let t=o(i[0]);i=i.filter((e=>t.indexOf(e)<0)),r.push(t)}function o(e){let n=new Set,r=-1;for(n.add(e);r!==n.size;){r=n.size;let e=t.getTargets([...n],"ConnectivityNode.Terminals"),i=t.getTargets(e,"Terminal.ConductingEquipment").filter((function(e){return!0===t.schema.isA("Switch",e)}));i=i.filter((function(e){let n=!0,r=t.getAttribute(e,"cim:Switch.open");return void 0!==r&&(n="false"===r.textContent),n}));let o=t.getTargets(i,"ConductingEquipment.Terminals"),a=t.getTargets(o,"Terminal.ConnectivityNode");for(let t of a)n.add(t)}return[...n]}return r.forEach((function(n){let r=t.createObject("cim:TopologicalNode");n.forEach((function(e){t.setLink(e,"cim:ConnectivityNode.TopologicalNode",r)}));let i=t.getTargets(n,"ConnectivityNode.Terminals"),o=t.getTargets(i,"Terminal.ConductingEquipment"),a=t.getTargets(o,"ConductingEquipment.BaseVoltage");if(a.length>0)t.setLink(r,"cim:TopologicalNode.BaseVoltage",a[0]);else{let e=t.getTargets(i,"Terminal.TransformerEnd");if(a=t.getTargets(e,"TransformerEnd.BaseVoltage"),a.length>0)t.setLink(r,"cim:TopologicalNode.BaseVoltage",a[0]);else{let e=t.getTargets(o,"Equipment.EquipmentContainer"),n=e.filter((e=>t.schema.isA("VoltageLevel",e)));if(a=t.getTargets(n,"VoltageLevel.BaseVoltage"),a.length>0)t.setLink(r,"cim:TopologicalNode.BaseVoltage",a[0]);else{let i=e.filter((e=>t.schema.isA("Bay",e)));n=t.getTargets(i,"Bay.VoltageLevel"),a=t.getTargets(n,"VoltageLevel.BaseVoltage"),a.length>0&&t.setLink(r,"cim:TopologicalNode.BaseVoltage",a[0])}}}i.forEach((function(e){t.setLink(e,"cim:Terminal.TopologicalNode",r),void 0===t.getAttribute(e,"cim:ACDCTerminal.connected")&&t.setAttribute(e,"cim:ACDCTerminal.connected","true")})),e.push(r)})),e},getTerminals(e){let n=[];return n=t.schema.isA("TopologicalNode",e)?t.getTargets([e],"TopologicalNode.Terminal"):t.schema.isA("TransformerEnd",e)?t.getTargets([e],"TransformerEnd.Terminal"):t.getTargets([e],"ConductingEquipment.Terminals"),n=n.filter((function(e){let n=t.getAttribute(e,"cim:ACDCTerminal.connected");return void 0!==n&&"true"===n.textContent})),n}}} +var t,e;function rotate(t,e){let n=d3.select("svg").node(),r=n.createSVGPoint();if(r.x=t.x,r.y=t.y,0===e)return r;let i=n.createSVGTransform();return i.setRotate(e,0,0),r.matrixTransform(i.matrix)}function rotateTerm(t,e){let n=t.getTargets([e],"Terminal.ConductingEquipment")[0],r=n.x,i=n.y,o=rotate({x:e.x-r,y:e.y-i},e.rotation);return{x:r+o.x,y:i+o.y}}function addToDiagram(t,e,n){let r=d3.pointer(e,d3.select("svg").node()),i=d3.zoomTransform(d3.select("svg").node()),o=i.x,a=i.y,s=i.k;n.x=(r[0]-o)/s,n.px=n.x,n.y=(r[1]-a)/s,n.py=n.y;let l=[{x:0,y:0,seq:1}];"cim:ACLineSegment"!==n.nodeName&&"cim:BusbarSection"!==n.nodeName||l.push({x:150,y:0,seq:2}),t.addToActiveDiagram(n,l)}function calcLineData(t,e){let n="ConnectivityNode",r="ConnectivityNode.Terminals";"BUS_BRANCH"===t.getMode()&&(n="TopologicalNode",r="TopologicalNode.Terminal"),e.x=void 0,e.y=void 0,e.rotation=0;let i=[],o=0,a=0,s=t.getEquipments(e).filter((t=>void 0!==t.lineData||"BusbarSection"===t.localName)),l=s.filter((t=>"BusbarSection"===t.localName))[0],c=t.getDiagramObjects([e]);if(0===c.length){if(void 0!==l){c=t.getDiagramObjects([l]);let n=t.getAttribute(c[0],"cim:DiagramObject.rotation");void 0!==n&&(e.rotation=parseInt(n.innerHTML))}else if(s.length>0){let t=[];for(let e of s){let n=e.x+e.lineData[e.lineData.length-1].x,r=e.y+e.lineData[e.lineData.length-1].y;t.push({x:e.x+e.lineData[0].x,y:e.y+e.lineData[0].y,eq:e},{x:n,y:r,eq:e})}let e=1/0,n=t[0],r=t[0];for(let i of t)for(let o of t){if(i.eq===o.eq)continue;let t=distance2(i,o);t0){for(let e of u){let n=t.getAttribute(e,"cim:DiagramObjectPoint.sequenceNumber");n=void 0===n?1:parseInt(n.innerHTML),i.push({x:parseFloat(t.getAttribute(e,"cim:DiagramObjectPoint.xPosition").innerHTML),y:parseFloat(t.getAttribute(e,"cim:DiagramObjectPoint.yPosition").innerHTML),seq:n})}i.sort((function(t,e){return t.seq-e.seq})),e.x=i[0].x,e.y=i[0].y;for(let t of i)t.x=t.x-e.x,t.y=t.y-e.y}else{if(i.push({x:0,y:0,seq:1}),e.nodeName==="cim:"+n){let n=t.getTargets([e],r);void 0!==t.getTargets(n,"Terminal.ConductingEquipment").filter((t=>"cim:BusbarSection"===t.nodeName))[0]&&i.push({x:150,y:0,seq:2})}e.x=o,e.y=a,t.addToActiveDiagram(e,i)}return e.lineData=i,i}function distance2(t,e){let n=t.x-e.x,r=t.y-e.y;return n*n+r*r}function closestPoint(t,e){let n=d3.line().x((function(t){return t.x})).y((function(t){return t.y})),r=d3.select(document.createElementNS("http://www.w3.org/2000/svg","svg")).append("path").attr("d",n(t.lineData)).node();if(null===r)return[0,0];let i,o,a=r.getTotalLength(),s=8,l=1/0;if(0===a)return[0,0];if(void 0===e.x||void 0===e.y)return[0,0];for(let e=0;e<=a;e+=s){let n=r.getPointAtLength(e);0!==t.rotation&&(n=rotate(n,t.rotation));let a=c(n);a.5;){let e=o-s;if(e>=0){let n=r.getPointAtLength(e);0!==t.rotation&&(n=rotate(n,t.rotation));let a=c(n);if(at.matches('[data-bs-toggle="popover"]')));for(let t of e){let e=bootstrap.Popover.getInstance(t);null!==e&&e.hide()}}function showPopovers(t){let e=[];e=void 0===t?document.querySelectorAll('[data-bs-toggle="popover"]'):t.filter((t=>t.matches('[data-bs-toggle="popover"]')));for(let t of e){let e=bootstrap.Popover.getInstance(t);null!==e&&e.show()}}function disposePopovers(t){let e=[];e=void 0===t?document.querySelectorAll('[data-bs-toggle="popover"]'):t.filter((t=>t.matches('[data-bs-toggle="popover"]')));for(let t of e){let e=bootstrap.Popover.getInstance(t);null!==e&&e.dispose()}}function exportToMatpower(t){let e="function mpc = cim\n",n="100",r=[],i=topologyProcessor(t);r="NODE_BREAKER"===t.getMode()?i.calcTopology():t.getObjects(["cim:TopologicalNode"])["cim:TopologicalNode"],e+="% MATPOWER Case Format : Version 2\n",e+="mpc.version = '2';\n",e+="% system MVA base\n",e=e+"mpc.baseMVA = "+"100;\n",e+="% bus data\n",e+="mpc.bus = [\n",e+="%bus_i\ttype\tPd\tQd\tGs\tBs\tarea\tVm\tVa\tbaseKV\tzone\tVmax\tVmin\n";let o=new Map;for(let n in r){let a=t.ID(r[n]),s=1,l=u(t.getTargets([r[n]],"TopologicalNode.BaseVoltage")[0],"cim:BaseVoltage.nominalVoltage","0"),c=parseInt(n)+1,f=i.getTerminals(r[n]),d=t.getTargets(f,"Terminal.ConductingEquipment"),h=d.filter((e=>!0===t.schema.isA("EnergyConsumer",e))),p=d.filter((e=>!0===t.schema.isA("ShuntCompensator",e))),m=d.filter((e=>!0===t.schema.isA("SynchronousMachine",e))),g=d.filter((e=>!0===t.schema.isA("AsynchronousMachine",e))),b=(t.getTargets(f,"Terminal.TransformerEnd"),0),v=0,y=1;h.forEach((function(t){b+=parseFloat(u(t,"cim:EnergyConsumer.p","0.0")),v+=parseFloat(u(t,"cim:EnergyConsumer.q","0.0"))})),g.forEach((function(t){b+=parseFloat(u(t,"cim:RotatingMachine.p","0")),v+=parseFloat(u(t,"cim:RotatingMachine.q","0"))}));let _=0,w=0;if(p.forEach((function(t){let e=parseFloat(u(t,"cim:ShuntCompensator.sections","0.0")),n=parseFloat(u(t,"cim:LinearShuntCompensator.gPerSection","0.0")),r=parseFloat(u(t,"cim:LinearShuntCompensator.bPerSection","0.0"));_+=n*e,w+=r*e})),_=_*l*l,w=w*l*l,m.length>0||p.length>0){if(p.length>0){let e=i.getTerminals(p[0]),n=(t.getTargets(e,"Terminal.TopologicalNode"),t.getTargets([p[0]],"RegulatingCondEq.RegulatingControl")[0]);if(void 0!==n){s=2;let t=u(n,"cim:RegulatingControl.targetValue",l);y=parseFloat(t)/parseFloat(l)}}if(m.length>0){void 0!==t.getTargets([m[0]],"RegulatingCondEq.RegulatingControl")[0]&&(s=2)}}m.filter((function(t){return parseInt(u(t,"cim:SynchronousMachine.referencePriority","0"))>0})).length>0&&(s=3),e=e+c+"\t",e=e+s+"\t",e=e+b+"\t",e=e+v+"\t",e=e+_+"\t",e=e+w+"\t",e=e+1+"\t",e=e+y+"\t",e=e+0+"\t",e=e+l+"\t",e=e+1+"\t",e=e+1.1+"\t",e=e+.9+";\t",e=e+"%Node ("+a+")",e+="\n",o.set(r[n],c)}e+="];\n";let a=t.getObjects(["cim:SynchronousMachine"])["cim:SynchronousMachine"],s=t.getObjects(["cim:EquivalentInjection"])["cim:EquivalentInjection"];e+="% generator data\n",e+="mpc.gen = [\n",e+="%bus\tPg\tQg\tQmax\tQmin\tVg\tmBase\tstatus\tPmax\tPmin\tPc1\tPc2\tQc1min\tQc1max\tQc2min\tQc2max\tramp_agc\tramp_10\tramp_30\tramp_q\tapf\n",a.forEach((function(r){let a={};a.genUUID=t.ID(r);let s=i.getTerminals(r),l=t.getTargets(s,"Terminal.TopologicalNode"),f=t.getTargets([r],"RotatingMachine.GeneratingUnit")[0],d=t.getTargets([r],"RegulatingCondEq.RegulatingControl")[0];l.forEach((function(i){if(a.busNum=o.get(i),a.p=-1*parseFloat(u(r,"cim:RotatingMachine.p","0")),a.q=-1*parseFloat(u(r,"cim:RotatingMachine.q","0")),a.qmax=parseFloat(u(r,"cim:SynchronousMachine.maxQ","0")),a.qmin=parseFloat(u(r,"cim:SynchronousMachine.minQ","0")),a.vg=1,void 0!==d){let e=u(t.getTargets([i],"TopologicalNode.BaseVoltage")[0],"cim:BaseVoltage.nominalVoltage","0"),n=u(d,"cim:RegulatingControl.targetValue",e);a.vg=parseFloat(n)/parseFloat(e)}a.mbase=parseFloat(u(r,"cim:SynchronousMachine.ratedS",n)),a.pmax=parseFloat(u(f,"cim:GeneratingUnit.maxOperatingP","0")),a.pmin=parseFloat(u(f,"cim:GeneratingUnit.minOperatingP","0")),e+=c(a)}))})),s.forEach((function(r){let a={};a.genUUID=t.ID(r);let s=i.getTerminals(r),l=t.getTargets(s,"Terminal.TopologicalNode"),f=u(r,"cim:EquivalentInjection.regulationStatus","false");l.forEach((function(i){if(a.busNum=o.get(i),a.p=-1*parseFloat(u(r,"cim:EquivalentInjection.p","0")),a.q=-1*parseFloat(u(r,"cim:EquivalentInjection.q","0")),a.qmax=parseFloat(u(r,"cim:EquivalentInjection.maxQ","0")),a.qmin=parseFloat(u(r,"cim:EquivalentInjection.minQ","0")),a.vg=1,"true"===f){let e=u(t.getTargets([i],"TopologicalNode.BaseVoltage")[0],"cim:BaseVoltage.nominalVoltage","0"),n=u(r,"cim:EquivalentInjection.regulationTarget",e);a.vg=parseFloat(n)/parseFloat(e)}a.mbase=n,a.pmax=parseFloat(u(r,"cim:EquivalentInjection.maxP","0")),a.pmin=parseFloat(u(r,"cim:EquivalentInjection.minP","0")),e+=c(a)}))})),e+="];\n";let l=t.getObjects(["cim:ACLineSegment"])["cim:ACLineSegment"];return e+="% branch data\n",e+="mpc.branch = [\n",e+="%fbus\ttbus\tr\tx\tb\trateA\trateB\trateC\tratio\tangle\tstatus\tangmin\tangmax\n",l.forEach((function(r){let a=t.ID(r),s=i.getTerminals(r),l=t.getTargets(s,"Terminal.TopologicalNode");if(2===l.length){let i=u(t.getTargets(l,"TopologicalNode.BaseVoltage")[0],"cim:BaseVoltage.nominalVoltage","0"),s=parseFloat(i)*parseFloat(i)/parseFloat(n),c=u(r,"cim:ACLineSegment.r","0"),f=u(r,"cim:ACLineSegment.x","0"),d=u(r,"cim:ACLineSegment.bch","0"),h=parseFloat(c)/s,p=parseFloat(f)/s,m=parseFloat(d)*s;e=e+o.get(l[0])+"\t",e=e+o.get(l[1])+"\t",e=e+h+"\t",e=e+p+"\t",e=e+m+"\t",e=e+0+"\t",e=e+0+"\t",e=e+0+"\t",e=e+0+"\t",e=e+0+"\t",e=e+1+"\t",e+="-360\t",e+="360;\t",e=e+"%AC line segment ("+a+")",e+="\n"}})),t.getObjects(["cim:PowerTransformer"])["cim:PowerTransformer"].forEach((function(r){let a=t.ID(r),s=t.getTargets([r],"PowerTransformer.PowerTransformerEnd");if(2===s.length){let r=s[0],l=s[1],c=u(r,"cim:PowerTransformerEnd.r","0"),f=u(r,"cim:PowerTransformerEnd.x","0");"0"===c&&"0"===f&&(l=s[0],r=s[1],c=u(r,"cim:PowerTransformerEnd.r","0"),f=u(r,"cim:PowerTransformerEnd.x","0"));let d=u(r,"cim:PowerTransformerEnd.b","0"),h=i.getTerminals(r),p=t.getTargets(h,"Terminal.TopologicalNode")[0],m=i.getTerminals(l),g=t.getTargets(m,"Terminal.TopologicalNode")[0];if(1===h.length&&1===m.length&&void 0!==p&&void 0!==g){let i=u(t.getTargets([p],"TopologicalNode.BaseVoltage")[0],"cim:BaseVoltage.nominalVoltage","0"),s=u(t.getTargets([g],"TopologicalNode.BaseVoltage")[0],"cim:BaseVoltage.nominalVoltage","0"),h=u(r,"cim:PowerTransformerEnd.ratedU",i),m=u(l,"cim:PowerTransformerEnd.ratedU",s),b=parseFloat(i)*parseFloat(i)/parseFloat(n),v=parseFloat(c)/b,y=parseFloat(f)/b,_=parseFloat(d)*b,w=t.getTargets([r],"TransformerEnd.RatioTapChanger"),x=parseFloat(s)*parseFloat(h)/(parseFloat(i)*parseFloat(m)),T=!1;if(0===w.length&&(w=t.getTargets([l],"TransformerEnd.RatioTapChanger"),T=!0),w.length>0){let t=u(w[0],"cim:TapChanger.neutralStep","0"),e=u(w[0],"cim:TapChanger.step",t),n=u(w[0],"cim:RatioTapChanger.stepVoltageIncrement","0"),r=(parseFloat(e)-parseFloat(t))*parseFloat(n);r/=100,r=1+r,!0===T&&(r=1/r),x*=r}e=e+o.get(p)+"\t",e=e+o.get(g)+"\t",e=e+v+"\t",e=e+y+"\t",e=e+_+"\t",e=e+0+"\t",e=e+0+"\t",e=e+0+"\t",e=e+x+"\t",e=e+0+"\t",e=e+1+"\t",e+="-360\t",e+="360;\t",e=e+"%Two-winding transformer ("+a+")",e+="\n"}}if(3===s.length){let r=s[0],l=s[1],c=s[2],m=u(r,"cim:PowerTransformerEnd.r","0"),g=u(l,"cim:PowerTransformerEnd.r","0"),b=u(c,"cim:PowerTransformerEnd.r","0"),v=u(r,"cim:PowerTransformerEnd.x","0"),y=u(l,"cim:PowerTransformerEnd.x","0"),_=u(c,"cim:PowerTransformerEnd.x","0"),w=u(r,"cim:PowerTransformerEnd.b","0"),x=u(l,"cim:PowerTransformerEnd.b","0"),T=u(c,"cim:PowerTransformerEnd.b","0"),A=i.getTerminals(r),E=i.getTerminals(l),M=i.getTerminals(c),S=t.getTargets(A,"Terminal.TopologicalNode")[0],N=t.getTargets(E,"Terminal.TopologicalNode")[0],k=t.getTargets(M,"Terminal.TopologicalNode")[0];if(1===A.length&&1===E.length&&1===M.length){let i=t.getTargets([S],"TopologicalNode.BaseVoltage")[0],s=t.getTargets([N],"TopologicalNode.BaseVoltage")[0],A=t.getTargets([k],"TopologicalNode.BaseVoltage")[0],E=u(i,"cim:BaseVoltage.nominalVoltage","0"),M=u(s,"cim:BaseVoltage.nominalVoltage","0"),C=u(A,"cim:BaseVoltage.nominalVoltage","0"),D=u(r,"cim:PowerTransformerEnd.ratedU",E),L=u(l,"cim:PowerTransformerEnd.ratedU",M),O=u(c,"cim:PowerTransformerEnd.ratedU",C),I=parseFloat(E)*parseFloat(E)/parseFloat(n),B=parseFloat(M)*parseFloat(M)/parseFloat(n),P=parseFloat(C)*parseFloat(C)/parseFloat(n),j=parseFloat(m)/I,R=parseFloat(g)/B,q=parseFloat(b)/P,F=parseFloat(v)/I,z=parseFloat(y)/B,U=parseFloat(_)/P,V=parseFloat(w)*I,H=parseFloat(x)*B,G=parseFloat(T)*P,Y=f(j,F),W=f(R,z),$=f(q,U),K=d(d(h(Y,W),h(W,$)),h($,Y)),X=h(K,p($)),Q=h(K,p(Y)),Z=h(K,p(W)),J=parseFloat(M)*parseFloat(D)/(parseFloat(E)*parseFloat(L)),tt=parseFloat(C)*parseFloat(L)/(parseFloat(M)*parseFloat(O)),et=parseFloat(E)*parseFloat(O)/(parseFloat(C)*parseFloat(D));e=e+o.get(S)+"\t",e=e+o.get(N)+"\t",e=e+X.re+"\t",e=e+X.im+"\t",e=e+V+"\t",e=e+0+"\t",e=e+0+"\t",e=e+0+"\t",e=e+J+"\t",e=e+0+"\t",e=e+1+"\t",e+="-360\t",e+="360;\t",e=e+"%Three-winding transformer branch 1-2 ("+a+")",e+="\n",e=e+o.get(N)+"\t",e=e+o.get(k)+"\t",e=e+Q.re+"\t",e=e+Q.im+"\t",e=e+H+"\t",e=e+0+"\t",e=e+0+"\t",e=e+0+"\t",e=e+tt+"\t",e=e+0+"\t",e=e+1+"\t",e+="-360\t",e+="360;\t",e=e+"%Three-winding transformer branch 2-3 ("+a+")",e+="\n",e=e+o.get(k)+"\t",e=e+o.get(S)+"\t",e=e+Z.re+"\t",e=e+Z.im+"\t",e=e+G+"\t",e=e+0+"\t",e=e+0+"\t",e=e+0+"\t",e=e+et+"\t",e=e+0+"\t",e=e+1+"\t",e+="-360\t",e+="360;\t",e=e+"%Three-winding transformer branch 3-1 ("+a+")",e+="\n"}}})),e+="];\n",e;function c(t){let e="";return e=e+t.busNum+"\t",e=e+t.p+"\t",e=e+t.q+"\t",e=e+t.qmax+"\t",e=e+t.qmin+"\t",e=e+t.vg+"\t",e=e+t.mbase+"\t",e=e+1+"\t",e=e+t.pmax+"\t",e=e+t.pmin+"\t",e=e+0+"\t",e=e+0+"\t",e=e+0+"\t",e=e+0+"\t",e=e+0+"\t",e=e+0+"\t",e=e+0+"\t",e=e+0+"\t",e=e+0+"\t",e=e+0+"\t",e=e+0+";\t",e=e+"%Generator ("+t.genUUID+")",e+="\n",e}function u(e,n,r){let i=t.getAttribute(e,n);return i=void 0===i?r:i.textContent,i}function f(t,e){return{re:t,im:e}}function d(t,e){return{re:t.re+e.re,im:t.im+e.im}}function h(t,e){return{re:t.re*e.re-t.im*e.im,im:t.re*e.im+t.im*e.re}}function p(t){const e=t.re*t.re+t.im*t.im;return{re:t.re/e,im:-t.im/e}}}!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).d3=t.d3||{})}(this,(function(t){"use strict";function e(t,e){return te?1:t>=e?0:NaN}function n(t){let n=t,r=t;function i(t,e,n,i){for(null==n&&(n=0),null==i&&(i=t.length);n>>1;r(t[o],e)<0?n=o+1:i=o}return n}return 1===t.length&&(n=(e,n)=>t(e)-n,r=function(t){return(n,r)=>e(t(n),r)}(t)),{left:i,center:function(t,e,r,o){null==r&&(r=0),null==o&&(o=t.length);const a=i(t,e,r,o-1);return a>r&&n(t[a-1],e)>-n(t[a],e)?a-1:a},right:function(t,e,n,i){for(null==n&&(n=0),null==i&&(i=t.length);n>>1;r(t[o],e)>0?i=o:n=o+1}return n}}}function r(t){return null===t?NaN:+t}const i=n(e),o=i.right,a=i.left,s=n(r).center;function l(t,e){let n=0;if(void 0===e)for(let e of t)null!=e&&(e=+e)>=e&&++n;else{let r=-1;for(let i of t)null!=(i=e(i,++r,t))&&(i=+i)>=i&&++n}return n}function c(t){return 0|t.length}function u(t){return!(t>0)}function f(t){return"object"!=typeof t||"length"in t?t:Array.from(t)}function d(t,e){let n,r=0,i=0,o=0;if(void 0===e)for(let e of t)null!=e&&(e=+e)>=e&&(n=e-i,i+=n/++r,o+=n*(e-i));else{let a=-1;for(let s of t)null!=(s=e(s,++a,t))&&(s=+s)>=s&&(n=s-i,i+=n/++r,o+=n*(s-i))}if(r>1)return o/(r-1)}function h(t,e){const n=d(t,e);return n?Math.sqrt(n):n}function p(t,e){let n,r;if(void 0===e)for(const e of t)null!=e&&(void 0===n?e>=e&&(n=r=e):(n>e&&(n=e),r=o&&(n=r=o):(n>o&&(n=o),r0){for(o=t[--i];i>0&&(e=o,n=t[--i],o=e+n,r=n-(o-e),!r););i>0&&(r<0&&t[i-1]<0||r>0&&t[i-1]>0)&&(n=2*r,e=o+n,n==e-o&&(o=e))}return o}}function g(t){return t}function b(t){if(1!==t.length)throw new Error("duplicate key");return t[0]}function v(t,e,n,r){return function t(i,o){if(o>=r.length)return n(i);const a=new Map,s=r[o++];let l=-1;for(const t of i){const e=s(t,++l,i),n=a.get(e);n?n.push(t):a.set(e,[t])}for(const[e,n]of a)a.set(e,t(n,o));return e(a)}(t,0)}var y=Array.prototype.slice;function _(t){return function(){return t}}var w=Math.sqrt(50),x=Math.sqrt(10),T=Math.sqrt(2);function A(t,e,n){var r,i,o,a,s=-1;if(n=+n,(t=+t)==(e=+e)&&n>0)return[t];if((r=e0)for(t=Math.ceil(t/a),e=Math.floor(e/a),o=new Array(i=Math.ceil(e-t+1));++s=0?(o>=w?10:o>=x?5:o>=T?2:1)*Math.pow(10,i):-Math.pow(10,-i)/(o>=w?10:o>=x?5:o>=T?2:1)}function M(t,e,n){var r=Math.abs(e-t)/Math.max(0,n),i=Math.pow(10,Math.floor(Math.log(r)/Math.LN10)),o=r/i;return o>=w?i*=10:o>=x?i*=5:o>=T&&(i*=2),e0?(t=Math.floor(t/i)*i,e=Math.ceil(e/i)*i):i<0&&(t=Math.ceil(t*i)/i,e=Math.floor(e*i)/i),r=i}}function N(t){return Math.ceil(Math.log(l(t))/Math.LN2)+1}function k(){var t=g,e=p,n=N;function r(r){Array.isArray(r)||(r=Array.from(r));var i,a,s=r.length,l=new Array(s);for(i=0;i0?f=(Math.floor(f/t)+1)*t:t<0&&(f=(Math.ceil(f*t)+1)/t))}else d.pop()}for(var h=d.length;d[0]<=u;)d.shift(),--h;for(;d[h-1]>f;)d.pop(),--h;var m,g=new Array(h+1);for(i=0;i<=h;++i)(m=g[i]=[]).x0=i>0?d[i-1]:u,m.x1=i=e)&&(n=e);else{let r=-1;for(let i of t)null!=(i=e(i,++r,t))&&(n=i)&&(n=i)}return n}function D(t,e){let n;if(void 0===e)for(const e of t)null!=e&&(n>e||void 0===n&&e>=e)&&(n=e);else{let r=-1;for(let i of t)null!=(i=e(i,++r,t))&&(n>i||void 0===n&&i>=i)&&(n=i)}return n}function L(t,n,r=0,i=t.length-1,o=e){for(;i>r;){if(i-r>600){const e=i-r+1,a=n-r+1,s=Math.log(e),l=.5*Math.exp(2*s/3),c=.5*Math.sqrt(s*l*(e-l)/e)*(a-e/2<0?-1:1);L(t,n,Math.max(r,Math.floor(n-a*l/e+c)),Math.min(i,Math.floor(n+(e-a)*l/e+c)),o)}const e=t[n];let a=r,s=i;for(O(t,r,n),o(t[i],e)>0&&O(t,r,i);a0;)--s}0===o(t[r],e)?O(t,r,s):(++s,O(t,s,i)),s<=n&&(r=s+1),n<=s&&(i=s-1)}return t}function O(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function I(t,e,n){if(r=(t=Float64Array.from(function*(t,e){if(void 0===e)for(let e of t)null!=e&&(e=+e)>=e&&(yield e);else{let n=-1;for(let r of t)null!=(r=e(r,++n,t))&&(r=+r)>=r&&(yield r)}}(t,n))).length){if((e=+e)<=0||r<2)return D(t);if(e>=1)return C(t);var r,i=(r-1)*e,o=Math.floor(i),a=C(L(t,o).subarray(0,o+1));return a+(D(t.subarray(o+1))-a)*(i-o)}}function B(t,e,n=r){if(i=t.length){if((e=+e)<=0||i<2)return+n(t[0],0,t);if(e>=1)return+n(t[i-1],i-1,t);var i,o=(i-1)*e,a=Math.floor(o),s=+n(t[a],a,t);return s+(+n(t[a+1],a+1,t)-s)*(o-a)}}function P(t,e){let n,r=-1,i=-1;if(void 0===e)for(const e of t)++i,null!=e&&(n=e)&&(n=e,r=i);else for(let o of t)null!=(o=e(o,++i,t))&&(n=o)&&(n=o,r=i);return r}function j(t){return Array.from(function*(t){for(const e of t)yield*e}(t))}function R(t,e){let n,r=-1,i=-1;if(void 0===e)for(const e of t)++i,null!=e&&(n>e||void 0===n&&e>=e)&&(n=e,r=i);else for(let o of t)null!=(o=e(o,++i,t))&&(n>o||void 0===n&&o>=o)&&(n=o,r=i);return r}function q(t,e){return[t,e]}function F(t,e){return Array.from(e,(e=>t[e]))}function z(t,e,n){t=+t,e=+e,n=(i=arguments.length)<2?(e=t,t=0,1):i<3?1:+n;for(var r=-1,i=0|Math.max(0,Math.ceil((e-t)/n)),o=new Array(i);++r+t(e)}function et(t){var e=Math.max(0,t.bandwidth()-1)/2;return t.round()&&(e=Math.round(e)),function(n){return+t(n)+e}}function nt(){return!this.__axis}function rt(t,e){var n=[],r=null,i=null,o=6,a=6,s=3,l=1===t||4===t?-1:1,c=4===t||2===t?"x":"y",u=1===t||3===t?Z:J;function f(f){var d=null==r?e.ticks?e.ticks.apply(e,n):e.domain():r,h=null==i?e.tickFormat?e.tickFormat.apply(e,n):X:i,p=Math.max(o,0)+s,m=e.range(),g=+m[0]+.5,b=+m[m.length-1]+.5,v=(e.bandwidth?et:tt)(e.copy()),y=f.selection?f.selection():f,_=y.selectAll(".domain").data([null]),w=y.selectAll(".tick").data(d,e).order(),x=w.exit(),T=w.enter().append("g").attr("class","tick"),A=w.select("line"),E=w.select("text");_=_.merge(_.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),w=w.merge(T),A=A.merge(T.append("line").attr("stroke","currentColor").attr(c+"2",l*o)),E=E.merge(T.append("text").attr("fill","currentColor").attr(c,l*p).attr("dy",1===t?"0em":3===t?"0.71em":"0.32em")),f!==y&&(_=_.transition(f),w=w.transition(f),A=A.transition(f),E=E.transition(f),x=x.transition(f).attr("opacity",Q).attr("transform",(function(t){return isFinite(t=v(t))?u(t):this.getAttribute("transform")})),T.attr("opacity",Q).attr("transform",(function(t){var e=this.parentNode.__axis;return u(e&&isFinite(e=e(t))?e:v(t))}))),x.remove(),_.attr("d",4===t||2==t?a?"M"+l*a+","+g+"H0.5V"+b+"H"+l*a:"M0.5,"+g+"V"+b:a?"M"+g+","+l*a+"V0.5H"+b+"V"+l*a:"M"+g+",0.5H"+b),w.attr("opacity",1).attr("transform",(function(t){return u(v(t))})),A.attr(c+"2",l*o),E.attr(c,l*p).text(h),y.filter(nt).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",2===t?"start":4===t?"end":"middle"),y.each((function(){this.__axis=v}))}return f.scale=function(t){return arguments.length?(e=t,f):e},f.ticks=function(){return n=K.call(arguments),f},f.tickArguments=function(t){return arguments.length?(n=null==t?[]:K.call(t),f):n.slice()},f.tickValues=function(t){return arguments.length?(r=null==t?null:K.call(t),f):r&&r.slice()},f.tickFormat=function(t){return arguments.length?(i=t,f):i},f.tickSize=function(t){return arguments.length?(o=a=+t,f):o},f.tickSizeInner=function(t){return arguments.length?(o=+t,f):o},f.tickSizeOuter=function(t){return arguments.length?(a=+t,f):a},f.tickPadding=function(t){return arguments.length?(s=+t,f):s},f}var it={value:()=>{}};function ot(){for(var t,e=0,n=arguments.length,r={};e=0&&(n=t.slice(r+1),t=t.slice(0,r)),t&&!e.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:n}}))}function lt(t,e){for(var n,r=0,i=t.length;r0)for(var n,r,i=new Array(n),o=0;o=0&&"xmlns"!==(e=t.slice(0,n))&&(t=t.slice(n+1)),ft.hasOwnProperty(e)?{space:ft[e],local:t}:t}function ht(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===ut&&e.documentElement.namespaceURI===ut?e.createElement(t):e.createElementNS(n,t)}}function pt(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function mt(t){var e=dt(t);return(e.local?pt:ht)(e)}function gt(){}function bt(t){return null==t?gt:function(){return this.querySelector(t)}}function vt(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}function yt(){return[]}function _t(t){return null==t?yt:function(){return this.querySelectorAll(t)}}function wt(t){return function(){return this.matches(t)}}function xt(t){return function(e){return e.matches(t)}}var Tt=Array.prototype.find;function At(){return this.firstElementChild}var Et=Array.prototype.filter;function Mt(){return this.children}function St(t){return new Array(t.length)}function Nt(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}function kt(t){return function(){return t}}function Ct(t,e,n,r,i,o){for(var a,s=0,l=e.length,c=o.length;se?1:t>=e?0:NaN}function It(t){return function(){this.removeAttribute(t)}}function Bt(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Pt(t,e){return function(){this.setAttribute(t,e)}}function jt(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function Rt(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttribute(t):this.setAttribute(t,n)}}function qt(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}function Ft(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function zt(t){return function(){this.style.removeProperty(t)}}function Ut(t,e,n){return function(){this.style.setProperty(t,e,n)}}function Vt(t,e,n){return function(){var r=e.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,n)}}function Ht(t,e){return t.style.getPropertyValue(e)||Ft(t).getComputedStyle(t,null).getPropertyValue(e)}function Gt(t){return function(){delete this[t]}}function Yt(t,e){return function(){this[t]=e}}function Wt(t,e){return function(){var n=e.apply(this,arguments);null==n?delete this[t]:this[t]=n}}function $t(t){return t.trim().split(/^|\s+/)}function Kt(t){return t.classList||new Xt(t)}function Xt(t){this._node=t,this._names=$t(t.getAttribute("class")||"")}function Qt(t,e){for(var n=Kt(t),r=-1,i=e.length;++r=0&&(e=t.slice(n+1),t=t.slice(0,n)),{type:t,name:e}}))}function me(t){return function(){var e=this.__on;if(e){for(var n,r=0,i=-1,o=e.length;r=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var _e=[null];function we(t,e){this._groups=t,this._parents=e}function xe(){return new we([[document.documentElement]],_e)}function Te(t){return"string"==typeof t?new we([[document.querySelector(t)]],[document.documentElement]):new we([[t]],_e)}we.prototype=xe.prototype={constructor:we,select:function(t){"function"!=typeof t&&(t=bt(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i=w&&(w=_+1);!(y=g[w])&&++w=0;)(r=i[o])&&(a&&4^r.compareDocumentPosition(a)&&a.parentNode.insertBefore(r,a),a=r);return this},sort:function(t){function e(e,n){return e&&n?t(e.__data__,n.__data__):!e-!n}t||(t=Ot);for(var n=this._groups,r=n.length,i=new Array(r),o=0;o1?this.each((null==e?zt:"function"==typeof e?Vt:Ut)(t,e,null==n?"":n)):Ht(this.node(),t)},property:function(t,e){return arguments.length>1?this.each((null==e?Gt:"function"==typeof e?Wt:Yt)(t,e)):this.node()[t]},classed:function(t,e){var n=$t(t+"");if(arguments.length<2){for(var r=Kt(this.node()),i=-1,o=n.length;++i()=>t;function Ie(t,{sourceEvent:e,subject:n,target:r,identifier:i,active:o,x:a,y:s,dx:l,dy:c,dispatch:u}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:o,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:u}})}function Be(t){return!t.ctrlKey&&!t.button}function Pe(){return this.parentNode}function je(t,e){return null==e?{x:t.x,y:t.y}:e}function Re(){return navigator.maxTouchPoints||"ontouchstart"in this}function qe(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function Fe(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function ze(){}Ie.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};var Ue=.7,Ve=1/Ue,He="\\s*([+-]?\\d+)\\s*",Ge="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",Ye="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",We=/^#([0-9a-f]{3,8})$/,$e=new RegExp("^rgb\\("+[He,He,He]+"\\)$"),Ke=new RegExp("^rgb\\("+[Ye,Ye,Ye]+"\\)$"),Xe=new RegExp("^rgba\\("+[He,He,He,Ge]+"\\)$"),Qe=new RegExp("^rgba\\("+[Ye,Ye,Ye,Ge]+"\\)$"),Ze=new RegExp("^hsl\\("+[Ge,Ye,Ye]+"\\)$"),Je=new RegExp("^hsla\\("+[Ge,Ye,Ye,Ge]+"\\)$"),tn={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 en(){return this.rgb().formatHex()}function nn(){return this.rgb().formatRgb()}function rn(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=We.exec(t))?(n=e[1].length,e=parseInt(e[1],16),6===n?on(e):3===n?new cn(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===n?an(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?an(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|240&e,((15&e)<<4|15&e)/255):null):(e=$e.exec(t))?new cn(e[1],e[2],e[3],1):(e=Ke.exec(t))?new cn(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=Xe.exec(t))?an(e[1],e[2],e[3],e[4]):(e=Qe.exec(t))?an(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=Ze.exec(t))?hn(e[1],e[2]/100,e[3]/100,1):(e=Je.exec(t))?hn(e[1],e[2]/100,e[3]/100,e[4]):tn.hasOwnProperty(t)?on(tn[t]):"transparent"===t?new cn(NaN,NaN,NaN,0):null}function on(t){return new cn(t>>16&255,t>>8&255,255&t,1)}function an(t,e,n,r){return r<=0&&(t=e=n=NaN),new cn(t,e,n,r)}function sn(t){return t instanceof ze||(t=rn(t)),t?new cn((t=t.rgb()).r,t.g,t.b,t.opacity):new cn}function ln(t,e,n,r){return 1===arguments.length?sn(t):new cn(t,e,n,null==r?1:r)}function cn(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}function un(){return"#"+dn(this.r)+dn(this.g)+dn(this.b)}function fn(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===t?")":", "+t+")")}function dn(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function hn(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new gn(t,e,n,r)}function pn(t){if(t instanceof gn)return new gn(t.h,t.s,t.l,t.opacity);if(t instanceof ze||(t=rn(t)),!t)return new gn;if(t instanceof gn)return t;var e=(t=t.rgb()).r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),o=Math.max(e,n,r),a=NaN,s=o-i,l=(o+i)/2;return s?(a=e===o?(n-r)/s+6*(n0&&l<1?0:a,new gn(a,s,l,t.opacity)}function mn(t,e,n,r){return 1===arguments.length?pn(t):new gn(t,e,n,null==r?1:r)}function gn(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function bn(t,e,n){return 255*(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)}qe(ze,rn,{copy:function(t){return Object.assign(new this.constructor,this,t)},displayable:function(){return this.rgb().displayable()},hex:en,formatHex:en,formatHsl:function(){return pn(this).formatHsl()},formatRgb:nn,toString:nn}),qe(cn,ln,Fe(ze,{brighter:function(t){return t=null==t?Ve:Math.pow(Ve,t),new cn(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?Ue:Math.pow(Ue,t),new cn(this.r*t,this.g*t,this.b*t,this.opacity)},rgb:function(){return this},displayable:function(){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:un,formatHex:un,formatRgb:fn,toString:fn})),qe(gn,mn,Fe(ze,{brighter:function(t){return t=null==t?Ve:Math.pow(Ve,t),new gn(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?Ue:Math.pow(Ue,t),new gn(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,i=2*n-r;return new cn(bn(t>=240?t-240:t+120,i,r),bn(t,i,r),bn(t<120?t+240:t-120,i,r),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl:function(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"hsl(":"hsla(")+(this.h||0)+", "+100*(this.s||0)+"%, "+100*(this.l||0)+"%"+(1===t?")":", "+t+")")}}));const vn=Math.PI/180,yn=180/Math.PI,_n=.96422,wn=.82521,xn=4/29,Tn=6/29,An=3*Tn*Tn;function En(t){if(t instanceof Sn)return new Sn(t.l,t.a,t.b,t.opacity);if(t instanceof In)return Bn(t);t instanceof cn||(t=sn(t));var e,n,r=Dn(t.r),i=Dn(t.g),o=Dn(t.b),a=Nn((.2225045*r+.7168786*i+.0606169*o)/1);return r===i&&i===o?e=n=a:(e=Nn((.4360747*r+.3850649*i+.1430804*o)/_n),n=Nn((.0139322*r+.0971045*i+.7141733*o)/wn)),new Sn(116*a-16,500*(e-a),200*(a-n),t.opacity)}function Mn(t,e,n,r){return 1===arguments.length?En(t):new Sn(t,e,n,null==r?1:r)}function Sn(t,e,n,r){this.l=+t,this.a=+e,this.b=+n,this.opacity=+r}function Nn(t){return t>.008856451679035631?Math.pow(t,1/3):t/An+xn}function kn(t){return t>Tn?t*t*t:An*(t-xn)}function Cn(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function Dn(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Ln(t){if(t instanceof In)return new In(t.h,t.c,t.l,t.opacity);if(t instanceof Sn||(t=En(t)),0===t.a&&0===t.b)return new In(NaN,0=1?(n=1,e-1):Math.floor(n*e),i=t[r],o=t[r+1],a=r>0?t[r-1]:2*i-o,s=r()=>t;function Qn(t,e){return function(n){return t+n*e}}function Zn(t,e){var n=e-t;return n?Qn(t,n>180||n<-180?n-360*Math.round(n/360):n):Xn(isNaN(t)?e:t)}function Jn(t,e){var n=e-t;return n?Qn(t,n):Xn(isNaN(t)?e:t)}var tr=function t(e){var n=function(t){return 1==(t=+t)?Jn:function(e,n){return n-e?function(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}(e,n,t):Xn(isNaN(e)?n:e)}}(e);function r(t,e){var r=n((t=ln(t)).r,(e=ln(e)).r),i=n(t.g,e.g),o=n(t.b,e.b),a=Jn(t.opacity,e.opacity);return function(e){return t.r=r(e),t.g=i(e),t.b=o(e),t.opacity=a(e),t+""}}return r.gamma=t,r}(1);function er(t){return function(e){var n,r,i=e.length,o=new Array(i),a=new Array(i),s=new Array(i);for(n=0;no&&(i=e.slice(o,i),s[a]?s[a]+=i:s[++a]=i),(n=n[0])===(r=r[0])?s[a]?s[a]+=r:s[++a]=r:(s[++a]=null,l.push({i:a,x:lr(n,r)})),o=fr.lastIndex;return o180?e+=360:e-t>180&&(t+=360),o.push({i:n.push(i(n)+"rotate(",null,r)-2,x:lr(t,e)})):e&&n.push(i(n)+"rotate("+e+r)}(o.rotate,a.rotate,s,l),function(t,e,n,o){t!==e?o.push({i:n.push(i(n)+"skewX(",null,r)-2,x:lr(t,e)}):e&&n.push(i(n)+"skewX("+e+r)}(o.skewX,a.skewX,s,l),function(t,e,n,r,o,a){if(t!==n||e!==r){var s=o.push(i(o)+"scale(",null,",",null,")");a.push({i:s-4,x:lr(t,n)},{i:s-2,x:lr(e,r)})}else 1===n&&1===r||o.push(i(o)+"scale("+n+","+r+")")}(o.scaleX,o.scaleY,a.scaleX,a.scaleY,s,l),o=a=null,function(t){for(var e,n=-1,r=l.length;++n=0&&e._call.call(null,t),e=e._next;--Pr}function Kr(){Fr=(qr=Ur.now())+zr,Pr=jr=0;try{$r()}finally{Pr=0,function(){for(var t,e,n=Ir,r=1/0;n;)n._call?(r>n._time&&(r=n._time),t=n,n=n._next):(e=n._next,n._next=null,n=t?t._next=e:Ir=e);Br=t,Qr(r)}(),Fr=0}}function Xr(){var t=Ur.now(),e=t-qr;e>1e3&&(zr-=e,qr=t)}function Qr(t){Pr||(jr&&(jr=clearTimeout(jr)),t-Fr>24?(t<1/0&&(jr=setTimeout(Kr,t-Ur.now()-zr)),Rr&&(Rr=clearInterval(Rr))):(Rr||(qr=Ur.now(),Rr=setInterval(Xr,1e3)),Pr=1,Vr(Kr)))}function Zr(t,e,n){var r=new Yr;return e=null==e?0:+e,r.restart((n=>{r.stop(),t(n+e)}),e,n),r}Yr.prototype=Wr.prototype={constructor:Yr,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?Hr():+n)+(null==e?0:+e),this._next||Br===this||(Br?Br._next=this:Ir=this,Br=this),this._call=t,this._time=n,Qr()},stop:function(){this._call&&(this._call=null,this._time=1/0,Qr())}};var Jr=ot("start","end","cancel","interrupt"),ti=[];function ei(t,e,n,r,i,o){var a=t.__transition;if(a){if(n in a)return}else t.__transition={};!function(t,e,n){var r,i=t.__transition;function o(l){var c,u,f,d;if(1!==n.state)return s();for(c in i)if((d=i[c]).name===n.name){if(3===d.state)return Zr(o);4===d.state?(d.state=6,d.timer.stop(),d.on.call("interrupt",t,t.__data__,d.index,d.group),delete i[c]):+c0)throw new Error("too late; already scheduled");return n}function ri(t,e){var n=ii(t,e);if(n.state>3)throw new Error("too late; already running");return n}function ii(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function oi(t,e){var n,r,i,o=t.__transition,a=!0;if(o){for(i in e=null==e?null:e+"",o)(n=o[i]).name===e?(r=n.state>2&&n.state<5,n.state=6,n.timer.stop(),n.on.call(r?"interrupt":"cancel",t,t.__data__,n.index,n.group),delete o[i]):a=!1;a&&delete t.__transition}}function ai(t,e){var n,r;return function(){var i=ri(this,t),o=i.tween;if(o!==n)for(var a=0,s=(r=n=o).length;a=0&&(t=t.slice(0,e)),!t||"start"===t}))}(e)?ni:ri;return function(){var a=o(this,t),s=a.on;s!==r&&(i=(r=s).copy()).on(e,n),a.on=i}}var Mi=xe.prototype.constructor;function Si(t){return function(){this.style.removeProperty(t)}}function Ni(t,e,n){return function(r){this.style.setProperty(t,e.call(this,r),n)}}function ki(t,e,n){var r,i;function o(){var o=e.apply(this,arguments);return o!==i&&(r=(i=o)&&Ni(t,o,n)),r}return o._value=e,o}function Ci(t){return function(e){this.textContent=t.call(this,e)}}function Di(t){var e,n;function r(){var r=t.apply(this,arguments);return r!==n&&(e=(n=r)&&Ci(r)),e}return r._value=t,r}var Li=0;function Oi(t,e,n,r){this._groups=t,this._parents=e,this._name=n,this._id=r}function Ii(t){return xe().transition(t)}function Bi(){return++Li}var Pi=xe.prototype;function ji(t){return((t*=2)<=1?t*t:--t*(2-t)+1)/2}function Ri(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}Oi.prototype=Ii.prototype={constructor:Oi,select:function(t){var e=this._name,n=this._id;"function"!=typeof t&&(t=bt(t));for(var r=this._groups,i=r.length,o=new Array(i),a=0;a()=>t;function lo(t,{sourceEvent:e,target:n,selection:r,mode:i,dispatch:o}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},selection:{value:r,enumerable:!0,configurable:!0},mode:{value:i,enumerable:!0,configurable:!0},_:{value:o}})}function co(t){t.stopImmediatePropagation()}function uo(t){t.preventDefault(),t.stopImmediatePropagation()}var fo={name:"drag"},ho={name:"space"},po={name:"handle"},mo={name:"center"};const{abs:go,max:bo,min:vo}=Math;function yo(t){return[+t[0],+t[1]]}function _o(t){return[yo(t[0]),yo(t[1])]}var wo={name:"x",handles:["w","e"].map(ko),input:function(t,e){return null==t?null:[[+t[0],e[0][1]],[+t[1],e[1][1]]]},output:function(t){return t&&[t[0][0],t[1][0]]}},xo={name:"y",handles:["n","s"].map(ko),input:function(t,e){return null==t?null:[[e[0][0],+t[0]],[e[1][0],+t[1]]]},output:function(t){return t&&[t[0][1],t[1][1]]}},To={name:"xy",handles:["n","w","e","s","nw","ne","sw","se"].map(ko),input:function(t){return null==t?null:_o(t)},output:function(t){return t}},Ao={overlay:"crosshair",selection:"move",n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},Eo={e:"w",w:"e",nw:"ne",ne:"nw",se:"sw",sw:"se"},Mo={n:"s",s:"n",nw:"sw",ne:"se",se:"ne",sw:"nw"},So={overlay:1,selection:1,n:null,e:1,s:null,w:-1,nw:-1,ne:1,se:1,sw:-1},No={overlay:1,selection:1,n:-1,e:null,s:1,w:null,nw:-1,ne:-1,se:1,sw:1};function ko(t){return{type:t}}function Co(t){return!t.ctrlKey&&!t.button}function Do(){var t=this.ownerSVGElement||this;return t.hasAttribute("viewBox")?[[(t=t.viewBox.baseVal).x,t.y],[t.x+t.width,t.y+t.height]]:[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]}function Lo(){return navigator.maxTouchPoints||"ontouchstart"in this}function Oo(t){for(;!t.__brush;)if(!(t=t.parentNode))return;return t.__brush}function Io(t){return t[0][0]===t[1][0]||t[0][1]===t[1][1]}function Bo(t){var e,n=Do,r=Co,i=Lo,o=!0,a=ot("start","brush","end"),s=6;function l(e){var n=e.property("__brush",m).selectAll(".overlay").data([ko("overlay")]);n.enter().append("rect").attr("class","overlay").attr("pointer-events","all").attr("cursor",Ao.overlay).merge(n).each((function(){var t=Oo(this).extent;Te(this).attr("x",t[0][0]).attr("y",t[0][1]).attr("width",t[1][0]-t[0][0]).attr("height",t[1][1]-t[0][1])})),e.selectAll(".selection").data([ko("selection")]).enter().append("rect").attr("class","selection").attr("cursor",Ao.selection).attr("fill","#777").attr("fill-opacity",.3).attr("stroke","#fff").attr("shape-rendering","crispEdges");var r=e.selectAll(".handle").data(t.handles,(function(t){return t.type}));r.exit().remove(),r.enter().append("rect").attr("class",(function(t){return"handle handle--"+t.type})).attr("cursor",(function(t){return Ao[t.type]})),e.each(c).attr("fill","none").attr("pointer-events","all").on("mousedown.brush",d).filter(i).on("touchstart.brush",d).on("touchmove.brush",h).on("touchend.brush touchcancel.brush",p).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function c(){var t=Te(this),e=Oo(this).selection;e?(t.selectAll(".selection").style("display",null).attr("x",e[0][0]).attr("y",e[0][1]).attr("width",e[1][0]-e[0][0]).attr("height",e[1][1]-e[0][1]),t.selectAll(".handle").style("display",null).attr("x",(function(t){return"e"===t.type[t.type.length-1]?e[1][0]-s/2:e[0][0]-s/2})).attr("y",(function(t){return"s"===t.type[0]?e[1][1]-s/2:e[0][1]-s/2})).attr("width",(function(t){return"n"===t.type||"s"===t.type?e[1][0]-e[0][0]+s:s})).attr("height",(function(t){return"e"===t.type||"w"===t.type?e[1][1]-e[0][1]+s:s}))):t.selectAll(".selection,.handle").style("display","none").attr("x",null).attr("y",null).attr("width",null).attr("height",null)}function u(t,e,n){var r=t.__brush.emitter;return!r||n&&r.clean?new f(t,e,n):r}function f(t,e,n){this.that=t,this.args=e,this.state=t.__brush,this.active=0,this.clean=n}function d(n){if((!e||n.touches)&&r.apply(this,arguments)){var i,a,s,l,f,d,h,p,m,g,b,v=this,y=n.target.__data__.type,_="selection"===(o&&n.metaKey?y="overlay":y)?fo:o&&n.altKey?mo:po,w=t===xo?null:So[y],x=t===wo?null:No[y],T=Oo(v),A=T.extent,E=T.selection,M=A[0][0],S=A[0][1],N=A[1][0],k=A[1][1],C=0,D=0,L=w&&x&&o&&n.shiftKey,O=Array.from(n.touches||[n],(t=>{const e=t.identifier;return(t=Ne(t,v)).point0=t.slice(),t.identifier=e,t}));if("overlay"===y){E&&(m=!0);const e=[O[0],O[1]||O[0]];T.selection=E=[[i=t===xo?M:vo(e[0][0],e[1][0]),s=t===wo?S:vo(e[0][1],e[1][1])],[f=t===xo?N:bo(e[0][0],e[1][0]),h=t===wo?k:bo(e[0][1],e[1][1])]],O.length>1&&q()}else i=E[0][0],s=E[0][1],f=E[1][0],h=E[1][1];a=i,l=s,d=f,p=h;var I=Te(v).attr("pointer-events","none"),B=I.selectAll(".overlay").attr("cursor",Ao[y]);oi(v);var P=u(v,arguments,!0).beforestart();if(n.touches)P.moved=R,P.ended=F;else{var j=Te(n.view).on("mousemove.brush",R,!0).on("mouseup.brush",F,!0);o&&j.on("keydown.brush",z,!0).on("keyup.brush",U,!0),De(n.view)}c.call(v),P.start(n,_.name)}function R(t){for(const e of t.changedTouches||[t])for(const t of O)t.identifier===e.identifier&&(t.cur=Ne(e,v));if(L&&!g&&!b&&1===O.length){const t=O[0];go(t.cur[0]-t[0])>go(t.cur[1]-t[1])?b=!0:g=!0}for(const t of O)t.cur&&(t[0]=t.cur[0],t[1]=t.cur[1]);m=!0,uo(t),q(t)}function q(t){const e=O[0],n=e.point0;var r;switch(C=e[0]-n[0],D=e[1]-n[1],_){case ho:case fo:w&&(C=bo(M-i,vo(N-f,C)),a=i+C,d=f+C),x&&(D=bo(S-s,vo(k-h,D)),l=s+D,p=h+D);break;case po:O[1]?(w&&(a=bo(M,vo(N,O[0][0])),d=bo(M,vo(N,O[1][0])),w=1),x&&(l=bo(S,vo(k,O[0][1])),p=bo(S,vo(k,O[1][1])),x=1)):(w<0?(C=bo(M-i,vo(N-i,C)),a=i+C,d=f):w>0&&(C=bo(M-f,vo(N-f,C)),a=i,d=f+C),x<0?(D=bo(S-s,vo(k-s,D)),l=s+D,p=h):x>0&&(D=bo(S-h,vo(k-h,D)),l=s,p=h+D));break;case mo:w&&(a=bo(M,vo(N,i-C*w)),d=bo(M,vo(N,f+C*w))),x&&(l=bo(S,vo(k,s-D*x)),p=bo(S,vo(k,h+D*x)))}d0&&(i=a-C),x<0?h=p-D:x>0&&(s=l-D),_=ho,B.attr("cursor",Ao.selection),q());break;default:return}uo(t)}function U(t){switch(t.keyCode){case 16:L&&(g=b=L=!1,q());break;case 18:_===mo&&(w<0?f=d:w>0&&(i=a),x<0?h=p:x>0&&(s=l),_=po,q());break;case 32:_===ho&&(t.altKey?(w&&(f=d-C*w,i=a+C*w),x&&(h=p-D*x,s=l+D*x),_=mo):(w<0?f=d:w>0&&(i=a),x<0?h=p:x>0&&(s=l),_=po),B.attr("cursor",Ao[y]),q());break;default:return}uo(t)}}function h(t){u(this,arguments).moved(t)}function p(t){u(this,arguments).ended(t)}function m(){var e=this.__brush||{selection:null};return e.extent=_o(n.apply(this,arguments)),e.dim=t,e}return l.move=function(e,n){e.tween?e.on("start.brush",(function(t){u(this,arguments).beforestart().start(t)})).on("interrupt.brush end.brush",(function(t){u(this,arguments).end(t)})).tween("brush",(function(){var e=this,r=e.__brush,i=u(e,arguments),o=r.selection,a=t.input("function"==typeof n?n.apply(this,arguments):n,r.extent),s=hr(o,a);function l(t){r.selection=1===t&&null===a?null:s(t),c.call(e),i.brush()}return null!==o&&null!==a?l:l(1)})):e.each((function(){var e=this,r=arguments,i=e.__brush,o=t.input("function"==typeof n?n.apply(e,r):n,i.extent),a=u(e,r).beforestart();oi(e),i.selection=null===o?null:o,c.call(e),a.start().brush().end()}))},l.clear=function(t){l.move(t,null)},f.prototype={beforestart:function(){return 1==++this.active&&(this.state.emitter=this,this.starting=!0),this},start:function(t,e){return this.starting?(this.starting=!1,this.emit("start",t,e)):this.emit("brush",t),this},brush:function(t,e){return this.emit("brush",t,e),this},end:function(t,e){return 0==--this.active&&(delete this.state.emitter,this.emit("end",t,e)),this},emit:function(e,n,r){var i=Te(this.that).datum();a.call(e,this.that,new lo(e,{sourceEvent:n,target:l,selection:t.output(this.state.selection),mode:r,dispatch:a}),i)}},l.extent=function(t){return arguments.length?(n="function"==typeof t?t:so(_o(t)),l):n},l.filter=function(t){return arguments.length?(r="function"==typeof t?t:so(!!t),l):r},l.touchable=function(t){return arguments.length?(i="function"==typeof t?t:so(!!t),l):i},l.handleSize=function(t){return arguments.length?(s=+t,l):s},l.keyModifiers=function(t){return arguments.length?(o=!!t,l):o},l.on=function(){var t=a.on.apply(a,arguments);return t===a?l:t},l}var Po=Math.abs,jo=Math.cos,Ro=Math.sin,qo=Math.PI,Fo=qo/2,zo=2*qo,Uo=Math.max,Vo=1e-12;function Ho(t,e){return Array.from({length:e-t},((e,n)=>t+n))}function Go(t){return function(e,n){return t(e.source.value+e.target.value,n.source.value+n.target.value)}}function Yo(t,e){var n=0,r=null,i=null,o=null;function a(a){var s,l=a.length,c=new Array(l),u=Ho(0,l),f=new Array(l*l),d=new Array(l),h=0;a=Float64Array.from({length:l*l},e?(t,e)=>a[e%l][e/l|0]:(t,e)=>a[e/l|0][e%l]);for(let e=0;er(c[t],c[e])));for(const n of u){const r=e;if(t){const t=Ho(1+~l,l).filter((t=>t<0?a[~t*l+n]:a[n*l+t]));i&&t.sort(((t,e)=>i(t<0?-a[~t*l+n]:a[n*l+t],e<0?-a[~e*l+n]:a[n*l+e])));for(const r of t)r<0?(f[~r*l+n]||(f[~r*l+n]={source:null,target:null})).target={index:n,startAngle:e,endAngle:e+=a[~r*l+n]*h,value:a[~r*l+n]}:(f[n*l+r]||(f[n*l+r]={source:null,target:null})).source={index:n,startAngle:e,endAngle:e+=a[n*l+r]*h,value:a[n*l+r]};d[n]={index:n,startAngle:r,endAngle:e,value:c[n]}}else{const t=Ho(0,l).filter((t=>a[n*l+t]||a[t*l+n]));i&&t.sort(((t,e)=>i(a[n*l+t],a[n*l+e])));for(const r of t){let t;if(nKo)if(Math.abs(u*s-l*c)>Ko&&i){var d=n-o,h=r-a,p=s*s+l*l,m=d*d+h*h,g=Math.sqrt(p),b=Math.sqrt(f),v=i*Math.tan((Wo-Math.acos((p+f-m)/(2*g*b)))/2),y=v/b,_=v/g;Math.abs(y-1)>Ko&&(this._+="L"+(t+y*c)+","+(e+y*u)),this._+="A"+i+","+i+",0,0,"+ +(u*d>c*h)+","+(this._x1=t+_*s)+","+(this._y1=e+_*l)}else this._+="L"+(this._x1=t)+","+(this._y1=e)},arc:function(t,e,n,r,i,o){t=+t,e=+e,o=!!o;var a=(n=+n)*Math.cos(r),s=n*Math.sin(r),l=t+a,c=e+s,u=1^o,f=o?r-i:i-r;if(n<0)throw new Error("negative radius: "+n);null===this._x1?this._+="M"+l+","+c:(Math.abs(this._x1-l)>Ko||Math.abs(this._y1-c)>Ko)&&(this._+="L"+l+","+c),n&&(f<0&&(f=f%$o+$o),f>Xo?this._+="A"+n+","+n+",0,1,"+u+","+(t-a)+","+(e-s)+"A"+n+","+n+",0,1,"+u+","+(this._x1=l)+","+(this._y1=c):f>Ko&&(this._+="A"+n+","+n+",0,"+ +(f>=Wo)+","+u+","+(this._x1=t+n*Math.cos(i))+","+(this._y1=e+n*Math.sin(i))))},rect:function(t,e,n,r){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)+"h"+ +n+"v"+ +r+"h"+-n+"Z"},toString:function(){return this._}};var Jo=Array.prototype.slice;function ta(t){return function(){return t}}function ea(t){return t.source}function na(t){return t.target}function ra(t){return t.radius}function ia(t){return t.startAngle}function oa(t){return t.endAngle}function aa(){return 0}function sa(){return 10}function la(t){var e=ea,n=na,r=ra,i=ra,o=ia,a=oa,s=aa,l=null;function c(){var c,u=e.apply(this,arguments),f=n.apply(this,arguments),d=s.apply(this,arguments)/2,h=Jo.call(arguments),p=+r.apply(this,(h[0]=u,h)),m=o.apply(this,h)-Fo,g=a.apply(this,h)-Fo,b=+i.apply(this,(h[0]=f,h)),v=o.apply(this,h)-Fo,y=a.apply(this,h)-Fo;if(l||(l=c=Zo()),d>Vo&&(Po(g-m)>2*d+Vo?g>m?(m+=d,g-=d):(m-=d,g+=d):m=g=(m+g)/2,Po(y-v)>2*d+Vo?y>v?(v+=d,y-=d):(v-=d,y+=d):v=y=(v+y)/2),l.moveTo(p*jo(m),p*Ro(m)),l.arc(0,0,p,m,g),m!==v||g!==y)if(t){var _=+t.apply(this,arguments),w=b-_,x=(v+y)/2;l.quadraticCurveTo(0,0,w*jo(v),w*Ro(v)),l.lineTo(b*jo(x),b*Ro(x)),l.lineTo(w*jo(y),w*Ro(y))}else l.quadraticCurveTo(0,0,b*jo(v),b*Ro(v)),l.arc(0,0,b,v,y);if(l.quadraticCurveTo(0,0,p*jo(m),p*Ro(m)),l.closePath(),c)return l=null,c+""||null}return t&&(c.headRadius=function(e){return arguments.length?(t="function"==typeof e?e:ta(+e),c):t}),c.radius=function(t){return arguments.length?(r=i="function"==typeof t?t:ta(+t),c):r},c.sourceRadius=function(t){return arguments.length?(r="function"==typeof t?t:ta(+t),c):r},c.targetRadius=function(t){return arguments.length?(i="function"==typeof t?t:ta(+t),c):i},c.startAngle=function(t){return arguments.length?(o="function"==typeof t?t:ta(+t),c):o},c.endAngle=function(t){return arguments.length?(a="function"==typeof t?t:ta(+t),c):a},c.padAngle=function(t){return arguments.length?(s="function"==typeof t?t:ta(+t),c):s},c.source=function(t){return arguments.length?(e=t,c):e},c.target=function(t){return arguments.length?(n=t,c):n},c.context=function(t){return arguments.length?(l=null==t?null:t,c):l},c}var ca=Array.prototype.slice;function ua(t,e){return t-e}var fa=t=>()=>t;function da(t,e){for(var n,r=-1,i=e.length;++rr!=h>r&&n<(d-c)*(r-u)/(h-u)+c&&(i=-i)}return i}function pa(t,e,n){var r,i,o,a;return function(t,e,n){return(e[0]-t[0])*(n[1]-t[1])==(n[0]-t[0])*(e[1]-t[1])}(t,e,n)&&(i=t[r=+(t[0]===e[0])],o=n[r],a=e[r],i<=o&&o<=a||a<=o&&o<=i)}function ma(){}var ga=[[],[[[1,1.5],[.5,1]]],[[[1.5,1],[1,1.5]]],[[[1.5,1],[.5,1]]],[[[1,.5],[1.5,1]]],[[[1,1.5],[.5,1]],[[1,.5],[1.5,1]]],[[[1,.5],[1,1.5]]],[[[1,.5],[.5,1]]],[[[.5,1],[1,.5]]],[[[1,1.5],[1,.5]]],[[[.5,1],[1,.5]],[[1.5,1],[1,1.5]]],[[[1.5,1],[1,.5]]],[[[.5,1],[1.5,1]]],[[[1,1.5],[1.5,1]]],[[[.5,1],[1,1.5]]],[]];function ba(){var t=1,e=1,n=N,r=s;function i(t){var e=n(t);if(Array.isArray(e))e=e.slice().sort(ua);else{var r=p(t),i=r[0],a=r[1];e=M(i,a,e),e=z(Math.floor(i/e)*e,Math.floor(a/e)*e,e)}return e.map((function(e){return o(t,e)}))}function o(n,i){var o=[],s=[];return function(n,r,i){var o,s,l,c,u,f,d=new Array,h=new Array;for(o=s=-1,c=n[0]>=r,ga[c<<1].forEach(p);++o=r,ga[l|c<<1].forEach(p);for(ga[c<<0].forEach(p);++s=r,u=n[s*t]>=r,ga[c<<1|u<<2].forEach(p);++o=r,f=u,u=n[s*t+o+1]>=r,ga[l|c<<1|u<<2|f<<3].forEach(p);ga[c|u<<3].forEach(p)}for(o=-1,u=n[s*t]>=r,ga[u<<2].forEach(p);++o=r,ga[u<<2|f<<3].forEach(p);function p(t){var e,n,r=[t[0][0]+o,t[0][1]+s],l=[t[1][0]+o,t[1][1]+s],c=a(r),u=a(l);(e=h[c])?(n=d[u])?(delete h[e.end],delete d[n.start],e===n?(e.ring.push(l),i(e.ring)):d[e.start]=h[n.end]={start:e.start,end:n.end,ring:e.ring.concat(n.ring)}):(delete h[e.end],e.ring.push(l),h[e.end=u]=e):(e=d[u])?(n=h[c])?(delete d[e.start],delete h[n.end],e===n?(e.ring.push(l),i(e.ring)):d[n.start]=h[e.end]={start:n.start,end:e.end,ring:n.ring.concat(e.ring)}):(delete d[e.start],e.ring.unshift(r),d[e.start=c]=e):d[c]=h[u]={start:c,end:u,ring:[r,l]}}ga[u<<3].forEach(p)}(n,i,(function(t){r(t,n,i),function(t){for(var e=0,n=t.length,r=t[n-1][1]*t[0][0]-t[n-1][0]*t[0][1];++e0?o.push([t]):s.push(t)})),s.forEach((function(t){for(var e,n=0,r=o.length;n0&&a0&&s=0&&o>=0))throw new Error("invalid size");return t=r,e=o,i},i.thresholds=function(t){return arguments.length?(n="function"==typeof t?t:Array.isArray(t)?fa(ca.call(t)):fa(t),i):n},i.smooth=function(t){return arguments.length?(r=t?s:ma,i):r===s},i}function va(t,e,n){for(var r=t.width,i=t.height,o=1+(n<<1),a=0;a=n&&(s>=o&&(l-=t.data[s-o+a*r]),e.data[s-n+a*r]=l/Math.min(s+1,r-1+o-s,o))}function ya(t,e,n){for(var r=t.width,i=t.height,o=1+(n<<1),a=0;a=n&&(s>=o&&(l-=t.data[a+(s-o)*r]),e.data[a+(s-n)*r]=l/Math.min(s+1,i-1+o-s,o))}function _a(t){return t[0]}function wa(t){return t[1]}function xa(){return 1}const Ta=Math.pow(2,-52),Aa=new Uint32Array(512);class Ea{static from(t,e=Oa,n=Ia){const r=t.length,i=new Float64Array(2*r);for(let o=0;o>1;if(e>0&&"number"!=typeof t[0])throw new Error("Expected coords to contain numbers.");this.coords=t;const n=Math.max(2*e-5,0);this._triangles=new Uint32Array(3*n),this._halfedges=new Int32Array(3*n),this._hashSize=Math.ceil(Math.sqrt(e)),this._hullPrev=new Uint32Array(e),this._hullNext=new Uint32Array(e),this._hullTri=new Uint32Array(e),this._hullHash=new Int32Array(this._hashSize).fill(-1),this._ids=new Uint32Array(e),this._dists=new Float64Array(e),this.update()}update(){const{coords:t,_hullPrev:e,_hullNext:n,_hullTri:r,_hullHash:i}=this,o=t.length>>1;let a=1/0,s=1/0,l=-1/0,c=-1/0;for(let e=0;el&&(l=n),r>c&&(c=r),this._ids[e]=e}const u=(a+l)/2,f=(s+c)/2;let d,h,p,m=1/0;for(let e=0;e0&&(h=e,m=n)}let v=t[2*h],y=t[2*h+1],_=1/0;for(let e=0;er&&(e[n++]=i,r=this._dists[i])}return this.hull=e.subarray(0,n),this.triangles=new Uint32Array(0),void(this.halfedges=new Uint32Array(0))}if(Na(g,b,v,y,w,x)){const t=h,e=v,n=y;h=p,v=w,y=x,p=t,w=e,x=n}const T=function(t,e,n,r,i,o){const a=n-t,s=r-e,l=i-t,c=o-e,u=a*a+s*s,f=l*l+c*c,d=.5/(a*c-s*l);return{x:t+(c*u-s*f)*d,y:e+(a*f-l*u)*d}}(g,b,v,y,w,x);this._cx=T.x,this._cy=T.y;for(let e=0;e0&&Math.abs(c-o)<=Ta&&Math.abs(u-a)<=Ta)continue;if(o=c,a=u,l===d||l===h||l===p)continue;let f=0;for(let t=0,e=this._hashKey(c,u);t0?3-n:1+n)/4}(t-this._cx,e-this._cy)*this._hashSize)%this._hashSize}_legalize(t){const{_triangles:e,_halfedges:n,coords:r}=this;let i=0,o=0;for(;;){const a=n[t],s=t-t%3;if(o=s+(t+2)%3,-1===a){if(0===i)break;t=Aa[--i];continue}const l=a-a%3,c=s+(t+1)%3,u=l+(a+2)%3,f=e[o],d=e[t],h=e[c],p=e[u];if(ka(r[2*f],r[2*f+1],r[2*d],r[2*d+1],r[2*h],r[2*h+1],r[2*p],r[2*p+1])){e[t]=p,e[a]=f;const r=n[u];if(-1===r){let e=this._hullStart;do{if(this._hullTri[e]===u){this._hullTri[e]=t;break}e=this._hullPrev[e]}while(e!==this._hullStart)}this._link(t,r),this._link(a,n[o]),this._link(o,u);const s=l+(a+1)%3;i=33306690738754716e-32*Math.abs(a+s)?a-s:0}function Na(t,e,n,r,i,o){return(Sa(i,o,t,e,n,r)||Sa(t,e,n,r,i,o)||Sa(n,r,i,o,t,e))<0}function ka(t,e,n,r,i,o,a,s){const l=t-a,c=e-s,u=n-a,f=r-s,d=i-a,h=o-s,p=u*u+f*f,m=d*d+h*h;return l*(f*m-p*h)-c*(u*m-p*d)+(l*l+c*c)*(u*h-f*d)<0}function Ca(t,e,n,r,i,o){const a=n-t,s=r-e,l=i-t,c=o-e,u=a*a+s*s,f=l*l+c*c,d=.5/(a*c-s*l),h=(c*u-s*f)*d,p=(a*f-l*u)*d;return h*h+p*p}function Da(t,e,n,r){if(r-n<=20)for(let i=n+1;i<=r;i++){const r=t[i],o=e[r];let a=i-1;for(;a>=n&&e[t[a]]>o;)t[a+1]=t[a--];t[a+1]=r}else{let i=n+1,o=r;La(t,n+r>>1,i),e[t[n]]>e[t[r]]&&La(t,n,r),e[t[i]]>e[t[r]]&&La(t,i,r),e[t[n]]>e[t[i]]&&La(t,n,i);const a=t[i],s=e[a];for(;;){do{i++}while(e[t[i]]s);if(o=o-n?(Da(t,e,i,r),Da(t,e,n,o-1)):(Da(t,e,n,o-1),Da(t,e,i,r))}}function La(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function Oa(t){return t[0]}function Ia(t){return t[1]}const Ba=1e-6;class Pa{constructor(){this._x0=this._y0=this._x1=this._y1=null,this._=""}moveTo(t,e){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+e}`}closePath(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")}lineTo(t,e){this._+=`L${this._x1=+t},${this._y1=+e}`}arc(t,e,n){const r=(t=+t)+(n=+n),i=e=+e;if(n<0)throw new Error("negative radius");null===this._x1?this._+=`M${r},${i}`:(Math.abs(this._x1-r)>Ba||Math.abs(this._y1-i)>Ba)&&(this._+="L"+r+","+i),n&&(this._+=`A${n},${n},0,1,1,${t-n},${e}A${n},${n},0,1,1,${this._x1=r},${this._y1=i}`)}rect(t,e,n,r){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+e}h${+n}v${+r}h${-n}Z`}value(){return this._||null}}class ja{constructor(){this._=[]}moveTo(t,e){this._.push([t,e])}closePath(){this._.push(this._[0].slice())}lineTo(t,e){this._.push([t,e])}value(){return this._.length?this._:null}}class Ra{constructor(t,[e,n,r,i]=[0,0,960,500]){if(!((r=+r)>=(e=+e)&&(i=+i)>=(n=+n)))throw new Error("invalid bounds");this.delaunay=t,this._circumcenters=new Float64Array(2*t.points.length),this.vectors=new Float64Array(2*t.points.length),this.xmax=r,this.xmin=e,this.ymax=i,this.ymin=n,this._init()}update(){return this.delaunay.update(),this._init(),this}_init(){const{delaunay:{points:t,hull:e,triangles:n},vectors:r}=this,i=this.circumcenters=this._circumcenters.subarray(0,n.length/3*2);for(let e,r,o=0,a=0,s=n.length;o1;)i-=2;for(let t=2;t4)for(let t=0;t0){if(e>=this.ymax)return null;(i=(this.ymax-e)/r)0){if(t>=this.xmax)return null;(i=(this.xmax-t)/n)this.xmax?2:0)|(ethis.ymax?8:0)}}const qa=2*Math.PI,Fa=Math.pow;function za(t){return t[0]}function Ua(t){return t[1]}function Va(t,e,n){return[t+Math.sin(t+e)*n,e+Math.cos(t-e)*n]}class Ha{static from(t,e=za,n=Ua,r){return new Ha("length"in t?function(t,e,n,r){const i=t.length,o=new Float64Array(2*i);for(let a=0;a2&&function(t){const{triangles:e,coords:n}=t;for(let t=0;t1e-10)return!1}return!0}(t)){this.collinear=Int32Array.from({length:e.length/2},((t,e)=>e)).sort(((t,n)=>e[2*t]-e[2*n]||e[2*t+1]-e[2*n+1]));const t=this.collinear[0],n=this.collinear[this.collinear.length-1],r=[e[2*t],e[2*t+1],e[2*n],e[2*n+1]],i=1e-8*Math.hypot(r[3]-r[1],r[2]-r[0]);for(let t=0,n=e.length/2;t0&&(this.triangles=new Int32Array(3).fill(-1),this.halfedges=new Int32Array(3).fill(-1),this.triangles[0]=r[0],this.triangles[1]=r[1],this.triangles[2]=r[1],o[r[0]]=1,2===r.length&&(o[r[1]]=0))}voronoi(t){return new Ra(this,t)}*neighbors(t){const{inedges:e,hull:n,_hullIndex:r,halfedges:i,triangles:o,collinear:a}=this;if(a){const e=a.indexOf(t);return e>0&&(yield a[e-1]),void(e=0&&i!==n&&i!==r;)n=i;return i}_step(t,e,n){const{inedges:r,hull:i,_hullIndex:o,halfedges:a,triangles:s,points:l}=this;if(-1===r[t]||!l.length)return(t+1)%(l.length>>1);let c=t,u=Fa(e-l[2*t],2)+Fa(n-l[2*t+1],2);const f=r[t];let d=f;do{let r=s[d];const f=Fa(e-l[2*r],2)+Fa(n-l[2*r+1],2);if(f=o?l=!0:10===(r=t.charCodeAt(a++))?c=!0:13===r&&(c=!0,10===t.charCodeAt(a)&&++a),t.slice(i+1,e-1).replace(/""/g,'"')}for(;a9999?"+"+Ka(t,6):Ka(t,4)}(t.getUTCFullYear())+"-"+Ka(t.getUTCMonth()+1,2)+"-"+Ka(t.getUTCDate(),2)+(i?"T"+Ka(e,2)+":"+Ka(n,2)+":"+Ka(r,2)+"."+Ka(i,3)+"Z":r?"T"+Ka(e,2)+":"+Ka(n,2)+":"+Ka(r,2)+"Z":n||e?"T"+Ka(e,2)+":"+Ka(n,2)+"Z":"")}(t):e.test(t+="")?'"'+t.replace(/"/g,'""')+'"':t}return{parse:function(t,e){var n,i,o=r(t,(function(t,r){if(n)return n(t,r-1);i=t,n=e?function(t,e){var n=Wa(t);return function(r,i){return e(n(r),i,t)}}(t,e):Wa(t)}));return o.columns=i||[],o},parseRows:r,format:function(e,n){return null==n&&(n=$a(e)),[n.map(a).join(t)].concat(i(e,n)).join("\n")},formatBody:function(t,e){return null==e&&(e=$a(t)),i(t,e).join("\n")},formatRows:function(t){return t.map(o).join("\n")},formatRow:o,formatValue:a}}var Qa=Xa(","),Za=Qa.parse,Ja=Qa.parseRows,ts=Qa.format,es=Qa.formatBody,ns=Qa.formatRows,rs=Qa.formatRow,is=Qa.formatValue,os=Xa("\t"),as=os.parse,ss=os.parseRows,ls=os.format,cs=os.formatBody,us=os.formatRows,fs=os.formatRow,ds=os.formatValue;const hs=new Date("2019-01-01T00:00").getHours()||new Date("2019-07-01T00:00").getHours();function ps(t){if(!t.ok)throw new Error(t.status+" "+t.statusText);return t.blob()}function ms(t){if(!t.ok)throw new Error(t.status+" "+t.statusText);return t.arrayBuffer()}function gs(t){if(!t.ok)throw new Error(t.status+" "+t.statusText);return t.text()}function bs(t,e){return fetch(t,e).then(gs)}function vs(t){return function(e,n,r){return 2===arguments.length&&"function"==typeof n&&(r=n,n=void 0),bs(e,n).then((function(e){return t(e,r)}))}}var ys=vs(Za),_s=vs(as);function ws(t){if(!t.ok)throw new Error(t.status+" "+t.statusText);if(204!==t.status&&205!==t.status)return t.json()}function xs(t){return(e,n)=>bs(e,n).then((e=>(new DOMParser).parseFromString(e,t)))}var Ts=xs("application/xml"),As=xs("text/html"),Es=xs("image/svg+xml");function Ms(t,e,n,r){if(isNaN(e)||isNaN(n))return t;var i,o,a,s,l,c,u,f,d,h=t._root,p={data:r},m=t._x0,g=t._y0,b=t._x1,v=t._y1;if(!h)return t._root=p,t;for(;h.length;)if((c=e>=(o=(m+b)/2))?m=o:b=o,(u=n>=(a=(g+v)/2))?g=a:v=a,i=h,!(h=h[f=u<<1|c]))return i[f]=p,t;if(s=+t._x.call(null,h.data),l=+t._y.call(null,h.data),e===s&&n===l)return p.next=h,i?i[f]=p:t._root=p,t;do{i=i?i[f]=new Array(4):t._root=new Array(4),(c=e>=(o=(m+b)/2))?m=o:b=o,(u=n>=(a=(g+v)/2))?g=a:v=a}while((f=u<<1|c)==(d=(l>=a)<<1|s>=o));return i[d]=h,i[f]=p,t}function Ss(t,e,n,r,i){this.node=t,this.x0=e,this.y0=n,this.x1=r,this.y1=i}function Ns(t){return t[0]}function ks(t){return t[1]}function Cs(t,e,n){var r=new Ds(null==e?Ns:e,null==n?ks:n,NaN,NaN,NaN,NaN);return null==t?r:r.addAll(t)}function Ds(t,e,n,r,i,o){this._x=t,this._y=e,this._x0=n,this._y0=r,this._x1=i,this._y1=o,this._root=void 0}function Ls(t){for(var e={data:t.data},n=e;t=t.next;)n=n.next={data:t.data};return e}var Os=Cs.prototype=Ds.prototype;function Is(t){return function(){return t}}function Bs(t){return 1e-6*(t()-.5)}function Ps(t){return t.x+t.vx}function js(t){return t.y+t.vy}function Rs(t){return t.index}function qs(t,e){var n=t.get(e);if(!n)throw new Error("node not found: "+e);return n}Os.copy=function(){var t,e,n=new Ds(this._x,this._y,this._x0,this._y0,this._x1,this._y1),r=this._root;if(!r)return n;if(!r.length)return n._root=Ls(r),n;for(t=[{source:r,target:n._root=new Array(4)}];r=t.pop();)for(var i=0;i<4;++i)(e=r.source[i])&&(e.length?t.push({source:e,target:r.target[i]=new Array(4)}):r.target[i]=Ls(e));return n},Os.add=function(t){const e=+this._x.call(null,t),n=+this._y.call(null,t);return Ms(this.cover(e,n),e,n,t)},Os.addAll=function(t){var e,n,r,i,o=t.length,a=new Array(o),s=new Array(o),l=1/0,c=1/0,u=-1/0,f=-1/0;for(n=0;nu&&(u=r),if&&(f=i));if(l>u||c>f)return this;for(this.cover(l,c).cover(u,f),n=0;nt||t>=i||r>e||e>=o;)switch(s=(ed||(o=l.y0)>h||(a=l.x1)=b)<<1|t>=g)&&(l=p[p.length-1],p[p.length-1]=p[p.length-1-c],p[p.length-1-c]=l)}else{var v=t-+this._x.call(null,m.data),y=e-+this._y.call(null,m.data),_=v*v+y*y;if(_=(s=(p+g)/2))?p=s:g=s,(u=a>=(l=(m+b)/2))?m=l:b=l,e=h,!(h=h[f=u<<1|c]))return this;if(!h.length)break;(e[f+1&3]||e[f+2&3]||e[f+3&3])&&(n=e,d=f)}for(;h.data!==t;)if(r=h,!(h=h.next))return this;return(i=h.next)&&delete h.next,r?(i?r.next=i:delete r.next,this):e?(i?e[f]=i:delete e[f],(h=e[0]||e[1]||e[2]||e[3])&&h===(e[3]||e[2]||e[1]||e[0])&&!h.length&&(n?n[d]=h:this._root=h),this):(this._root=i,this)},Os.removeAll=function(t){for(var e=0,n=t.length;e1?r[0]+r.slice(2):r,+t.slice(n+1)]}function Gs(t){return(t=Hs(Math.abs(t)))?t[1]:NaN}var Ys,Ws=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function $s(t){if(!(e=Ws.exec(t)))throw new Error("invalid format: "+t);var e;return new Ks({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}function Ks(t){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}function Xs(t,e){var n=Hs(t,e);if(!n)return t+"";var r=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}$s.prototype=Ks.prototype,Ks.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};var Qs={"%":(t,e)=>(100*t).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>Xs(100*t,e),r:Xs,s:function(t,e){var n=Hs(t,e);if(!n)return t+"";var r=n[0],i=n[1],o=i-(Ys=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,a=r.length;return o===a?r:o>a?r+new Array(o-a+1).join("0"):o>0?r.slice(0,o)+"."+r.slice(o):"0."+new Array(1-o).join("0")+Hs(t,Math.max(0,e+o-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function Zs(t){return t}var Js,tl=Array.prototype.map,el=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function nl(t){var e,n,r=void 0===t.grouping||void 0===t.thousands?Zs:(e=tl.call(t.grouping,Number),n=t.thousands+"",function(t,r){for(var i=t.length,o=[],a=0,s=e[0],l=0;i>0&&s>0&&(l+s+1>r&&(s=Math.max(1,r-l)),o.push(t.substring(i-=s,i+s)),!((l+=s+1)>r));)s=e[a=(a+1)%e.length];return o.reverse().join(n)}),i=void 0===t.currency?"":t.currency[0]+"",o=void 0===t.currency?"":t.currency[1]+"",a=void 0===t.decimal?".":t.decimal+"",s=void 0===t.numerals?Zs:function(t){return function(e){return e.replace(/[0-9]/g,(function(e){return t[+e]}))}}(tl.call(t.numerals,String)),l=void 0===t.percent?"%":t.percent+"",c=void 0===t.minus?"−":t.minus+"",u=void 0===t.nan?"NaN":t.nan+"";function f(t){var e=(t=$s(t)).fill,n=t.align,f=t.sign,d=t.symbol,h=t.zero,p=t.width,m=t.comma,g=t.precision,b=t.trim,v=t.type;"n"===v?(m=!0,v="g"):Qs[v]||(void 0===g&&(g=12),b=!0,v="g"),(h||"0"===e&&"="===n)&&(h=!0,e="0",n="=");var y="$"===d?i:"#"===d&&/[boxX]/.test(v)?"0"+v.toLowerCase():"",_="$"===d?o:/[%p]/.test(v)?l:"",w=Qs[v],x=/[defgprs%]/.test(v);function T(t){var i,o,l,d=y,T=_;if("c"===v)T=w(t)+T,t="";else{var A=(t=+t)<0||1/t<0;if(t=isNaN(t)?u:w(Math.abs(t),g),b&&(t=function(t){t:for(var e,n=t.length,r=1,i=-1;r0&&(i=0)}return i>0?t.slice(0,i)+t.slice(e+1):t}(t)),A&&0==+t&&"+"!==f&&(A=!1),d=(A?"("===f?f:c:"-"===f||"("===f?"":f)+d,T=("s"===v?el[8+Ys/3]:"")+T+(A&&"("===f?")":""),x)for(i=-1,o=t.length;++i(l=t.charCodeAt(i))||l>57){T=(46===l?a+t.slice(i+1):t.slice(i))+T,t=t.slice(0,i);break}}m&&!h&&(t=r(t,1/0));var E=d.length+t.length+T.length,M=E>1)+d+t+T+M.slice(E);break;default:t=M+d+t+T}return s(t)}return g=void 0===g?6:/[gprs]/.test(v)?Math.max(1,Math.min(21,g)):Math.max(0,Math.min(20,g)),T.toString=function(){return t+""},T}return{format:f,formatPrefix:function(t,e){var n=f(((t=$s(t)).type="f",t)),r=3*Math.max(-8,Math.min(8,Math.floor(Gs(e)/3))),i=Math.pow(10,-r),o=el[8+r/3];return function(t){return n(i*t)+o}}}}function rl(e){return Js=nl(e),t.format=Js.format,t.formatPrefix=Js.formatPrefix,Js}function il(t){return Math.max(0,-Gs(Math.abs(t)))}function ol(t,e){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(Gs(e)/3)))-Gs(Math.abs(t)))}function al(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,Gs(e)-Gs(t))+1}rl({thousands:",",grouping:[3],currency:["$",""]});var sl=1e-6,ll=1e-12,cl=Math.PI,ul=cl/2,fl=cl/4,dl=2*cl,hl=180/cl,pl=cl/180,ml=Math.abs,gl=Math.atan,bl=Math.atan2,vl=Math.cos,yl=Math.ceil,_l=Math.exp,wl=Math.hypot,xl=Math.log,Tl=Math.pow,Al=Math.sin,El=Math.sign||function(t){return t>0?1:t<0?-1:0},Ml=Math.sqrt,Sl=Math.tan;function Nl(t){return t>1?0:t<-1?cl:Math.acos(t)}function kl(t){return t>1?ul:t<-1?-ul:Math.asin(t)}function Cl(t){return(t=Al(t/2))*t}function Dl(){}function Ll(t,e){t&&Il.hasOwnProperty(t.type)&&Il[t.type](t,e)}var Ol={Feature:function(t,e){Ll(t.geometry,e)},FeatureCollection:function(t,e){for(var n=t.features,r=-1,i=n.length;++r=0?1:-1,i=r*n,o=vl(e=(e*=pl)/2+fl),a=Al(e),s=Ul*a,l=zl*o+s*vl(i),c=s*r*Al(i);tc.add(bl(c,l)),Fl=t,zl=o,Ul=a}function sc(t){return[bl(t[1],t[0]),kl(t[2])]}function lc(t){var e=t[0],n=t[1],r=vl(n);return[r*vl(e),r*Al(e),Al(n)]}function cc(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function uc(t,e){return[t[1]*e[2]-t[2]*e[1],t[2]*e[0]-t[0]*e[2],t[0]*e[1]-t[1]*e[0]]}function fc(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function dc(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function hc(t){var e=Ml(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}var pc,mc,gc,bc,vc,yc,_c,wc,xc,Tc,Ac,Ec,Mc,Sc,Nc,kc,Cc={point:Dc,lineStart:Oc,lineEnd:Ic,polygonStart:function(){Cc.point=Bc,Cc.lineStart=Pc,Cc.lineEnd=jc,Ql=new m,nc.polygonStart()},polygonEnd:function(){nc.polygonEnd(),Cc.point=Dc,Cc.lineStart=Oc,Cc.lineEnd=Ic,tc<0?(Vl=-(Gl=180),Hl=-(Yl=90)):Ql>sl?Yl=90:Ql<-1e-6&&(Hl=-90),Jl[0]=Vl,Jl[1]=Gl},sphere:function(){Vl=-(Gl=180),Hl=-(Yl=90)}};function Dc(t,e){Zl.push(Jl=[Vl=t,Gl=t]),eYl&&(Yl=e)}function Lc(t,e){var n=lc([t*pl,e*pl]);if(Xl){var r=uc(Xl,n),i=uc([r[1],-r[0],0],r);hc(i),i=sc(i);var o,a=t-Wl,s=a>0?1:-1,l=i[0]*hl*s,c=ml(a)>180;c^(s*WlYl&&(Yl=o):c^(s*Wl<(l=(l+360)%360-180)&&lYl&&(Yl=e)),c?tRc(Vl,Gl)&&(Gl=t):Rc(t,Gl)>Rc(Vl,Gl)&&(Vl=t):Gl>=Vl?(tGl&&(Gl=t)):t>Wl?Rc(Vl,t)>Rc(Vl,Gl)&&(Gl=t):Rc(t,Gl)>Rc(Vl,Gl)&&(Vl=t)}else Zl.push(Jl=[Vl=t,Gl=t]);eYl&&(Yl=e),Xl=n,Wl=t}function Oc(){Cc.point=Lc}function Ic(){Jl[0]=Vl,Jl[1]=Gl,Cc.point=Dc,Xl=null}function Bc(t,e){if(Xl){var n=t-Wl;Ql.add(ml(n)>180?n+(n>0?360:-360):n)}else $l=t,Kl=e;nc.point(t,e),Lc(t,e)}function Pc(){nc.lineStart()}function jc(){Bc($l,Kl),nc.lineEnd(),ml(Ql)>sl&&(Vl=-(Gl=180)),Jl[0]=Vl,Jl[1]=Gl,Xl=null}function Rc(t,e){return(e-=t)<0?e+360:e}function qc(t,e){return t[0]-e[0]}function Fc(t,e){return t[0]<=t[1]?t[0]<=e&&e<=t[1]:ecl?t+Math.round(-t/dl)*dl:t,e]}function eu(t,e,n){return(t%=dl)?e||n?Jc(ru(t),iu(e,n)):ru(t):e||n?iu(e,n):tu}function nu(t){return function(e,n){return[(e+=t)>cl?e-dl:e<-cl?e+dl:e,n]}}function ru(t){var e=nu(t);return e.invert=nu(-t),e}function iu(t,e){var n=vl(t),r=Al(t),i=vl(e),o=Al(e);function a(t,e){var a=vl(e),s=vl(t)*a,l=Al(t)*a,c=Al(e),u=c*n+s*r;return[bl(l*i-u*o,s*n-c*r),kl(u*i+l*o)]}return a.invert=function(t,e){var a=vl(e),s=vl(t)*a,l=Al(t)*a,c=Al(e),u=c*i-l*o;return[bl(l*i+c*o,s*n+u*r),kl(u*n-s*r)]},a}function ou(t){function e(e){return(e=t(e[0]*pl,e[1]*pl))[0]*=hl,e[1]*=hl,e}return t=eu(t[0]*pl,t[1]*pl,t.length>2?t[2]*pl:0),e.invert=function(e){return(e=t.invert(e[0]*pl,e[1]*pl))[0]*=hl,e[1]*=hl,e},e}function au(t,e,n,r,i,o){if(n){var a=vl(e),s=Al(e),l=r*n;null==i?(i=e+r*dl,o=e-l/2):(i=su(a,i),o=su(a,o),(r>0?io)&&(i+=r*dl));for(var c,u=i;r>0?u>o:u1&&e.push(e.pop().concat(e.shift()))},result:function(){var n=e;return e=[],t=null,n}}}function cu(t,e){return ml(t[0]-e[0])=0;--o)i.point((u=c[o])[0],u[1]);else r(d.x,d.p.x,-1,i);d=d.p}c=(d=d.o).z,h=!h}while(!d.v);i.lineEnd()}}}function du(t){if(e=t.length){for(var e,n,r=0,i=t[0];++r=0?1:-1,S=M*E,N=S>cl,k=b*T;if(l.add(bl(k*M*Al(S),v*A+k*vl(S))),a+=N?E+M*dl:E,N^p>=n^w>=n){var C=uc(lc(h),lc(_));hc(C);var D=uc(o,C);hc(D);var L=(N^E>=0?-1:1)*kl(D[2]);(r>L||r===L&&(C[0]||C[1]))&&(s+=N^E>=0?1:-1)}}return(a<-1e-6||a0){for(f||(i.polygonStart(),f=!0),i.lineStart(),t=0;t1&&2&l&&d.push(d.pop().concat(d.shift())),a.push(d.filter(gu))}return d}}function gu(t){return t.length>1}function bu(t,e){return((t=t.x)[0]<0?t[1]-ul-sl:ul-t[1])-((e=e.x)[0]<0?e[1]-ul-sl:ul-e[1])}tu.invert=tu;var vu=mu((function(){return!0}),(function(t){var e,n=NaN,r=NaN,i=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(o,a){var s=o>0?cl:-cl,l=ml(o-n);ml(l-cl)0?ul:-ul),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(s,r),t.point(o,r),e=0):i!==s&&l>=cl&&(ml(n-i)sl?gl((Al(e)*(o=vl(r))*Al(n)-Al(r)*(i=vl(e))*Al(t))/(i*o*a)):(e+r)/2}(n,r,o,a),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(s,r),e=0),t.point(n=o,r=a),i=s},lineEnd:function(){t.lineEnd(),n=r=NaN},clean:function(){return 2-e}}}),(function(t,e,n,r){var i;if(null==t)i=n*ul,r.point(-cl,i),r.point(0,i),r.point(cl,i),r.point(cl,0),r.point(cl,-i),r.point(0,-i),r.point(-cl,-i),r.point(-cl,0),r.point(-cl,i);else if(ml(t[0]-e[0])>sl){var o=t[0]0,i=ml(e)>sl;function o(t,n){return vl(t)*vl(n)>e}function a(t,n,r){var i=[1,0,0],o=uc(lc(t),lc(n)),a=cc(o,o),s=o[0],l=a-s*s;if(!l)return!r&&t;var c=e*a/l,u=-e*s/l,f=uc(i,o),d=dc(i,c);fc(d,dc(o,u));var h=f,p=cc(d,h),m=cc(h,h),g=p*p-m*(cc(d,d)-1);if(!(g<0)){var b=Ml(g),v=dc(h,(-p-b)/m);if(fc(v,d),v=sc(v),!r)return v;var y,_=t[0],w=n[0],x=t[1],T=n[1];w<_&&(y=_,_=w,w=y);var A=w-_,E=ml(A-cl)0^v[1]<(ml(v[0]-_)cl^(_<=v[0]&&v[0]<=w)){var M=dc(h,(-p+b)/m);return fc(M,d),[v,sc(M)]}}}function s(e,n){var i=r?t:cl-t,o=0;return e<-i?o|=1:e>i&&(o|=2),n<-i?o|=4:n>i&&(o|=8),o}return mu(o,(function(t){var e,n,l,c,u;return{lineStart:function(){c=l=!1,u=1},point:function(f,d){var h,p=[f,d],m=o(f,d),g=r?m?0:s(f,d):m?s(f+(f<0?cl:-cl),d):0;if(!e&&(c=l=m)&&t.lineStart(),m!==l&&(!(h=a(e,p))||cu(e,h)||cu(p,h))&&(p[2]=1),m!==l)u=0,m?(t.lineStart(),h=a(p,e),t.point(h[0],h[1])):(h=a(e,p),t.point(h[0],h[1],2),t.lineEnd()),e=h;else if(i&&e&&r^m){var b;g&n||!(b=a(p,e,!0))||(u=0,r?(t.lineStart(),t.point(b[0][0],b[0][1]),t.point(b[1][0],b[1][1]),t.lineEnd()):(t.point(b[1][0],b[1][1]),t.lineEnd(),t.lineStart(),t.point(b[0][0],b[0][1],3)))}!m||e&&cu(e,p)||t.point(p[0],p[1]),e=p,l=m,n=g},lineEnd:function(){l&&t.lineEnd(),e=null},clean:function(){return u|(c&&l)<<1}}}),(function(e,r,i,o){au(o,t,n,i,e,r)}),r?[0,-t]:[-cl,t-cl])}var _u,wu,xu,Tu,Au=1e9,Eu=-Au;function Mu(t,e,n,r){function i(i,o){return t<=i&&i<=n&&e<=o&&o<=r}function o(i,o,s,c){var u=0,f=0;if(null==i||(u=a(i,s))!==(f=a(o,s))||l(i,o)<0^s>0)do{c.point(0===u||3===u?t:n,u>1?r:e)}while((u=(u+s+4)%4)!==f);else c.point(o[0],o[1])}function a(r,i){return ml(r[0]-t)0?0:3:ml(r[0]-n)0?2:1:ml(r[1]-e)0?1:0:i>0?3:2}function s(t,e){return l(t.x,e.x)}function l(t,e){var n=a(t,1),r=a(e,1);return n!==r?n-r:0===n?e[1]-t[1]:1===n?t[0]-e[0]:2===n?t[1]-e[1]:e[0]-t[0]}return function(a){var l,c,u,f,d,h,p,m,g,b,v,y=a,_=lu(),w={point:x,lineStart:function(){w.point=T,c&&c.push(u=[]),b=!0,g=!1,p=m=NaN},lineEnd:function(){l&&(T(f,d),h&&g&&_.rejoin(),l.push(_.result())),w.point=x,g&&y.lineEnd()},polygonStart:function(){y=_,l=[],c=[],v=!0},polygonEnd:function(){var e=function(){for(var e=0,n=0,i=c.length;nr&&(d-o)*(r-a)>(h-a)*(t-o)&&++e:h<=r&&(d-o)*(r-a)<(h-a)*(t-o)&&--e;return e}(),n=v&&e,i=(l=j(l)).length;(n||i)&&(a.polygonStart(),n&&(a.lineStart(),o(null,null,1,a),a.lineEnd()),i&&fu(l,s,e,o,a),a.polygonEnd()),y=a,l=c=u=null}};function x(t,e){i(t,e)&&y.point(t,e)}function T(o,a){var s=i(o,a);if(c&&u.push([o,a]),b)f=o,d=a,h=s,b=!1,s&&(y.lineStart(),y.point(o,a));else if(s&&g)y.point(o,a);else{var l=[p=Math.max(Eu,Math.min(Au,p)),m=Math.max(Eu,Math.min(Au,m))],_=[o=Math.max(Eu,Math.min(Au,o)),a=Math.max(Eu,Math.min(Au,a))];!function(t,e,n,r,i,o){var a,s=t[0],l=t[1],c=0,u=1,f=e[0]-s,d=e[1]-l;if(a=n-s,f||!(a>0)){if(a/=f,f<0){if(a0){if(a>u)return;a>c&&(c=a)}if(a=i-s,f||!(a<0)){if(a/=f,f<0){if(a>u)return;a>c&&(c=a)}else if(f>0){if(a0)){if(a/=d,d<0){if(a0){if(a>u)return;a>c&&(c=a)}if(a=o-l,d||!(a<0)){if(a/=d,d<0){if(a>u)return;a>c&&(c=a)}else if(d>0){if(a0&&(t[0]=s+c*f,t[1]=l+c*d),u<1&&(e[0]=s+u*f,e[1]=l+u*d),!0}}}}}(l,_,t,e,n,r)?s&&(y.lineStart(),y.point(o,a),v=!1):(g||(y.lineStart(),y.point(l[0],l[1])),y.point(_[0],_[1]),s||y.lineEnd(),v=!1)}p=o,m=a,g=s}return w}}var Su={sphere:Dl,point:Dl,lineStart:function(){Su.point=ku,Su.lineEnd=Nu},lineEnd:Dl,polygonStart:Dl,polygonEnd:Dl};function Nu(){Su.point=Su.lineEnd=Dl}function ku(t,e){wu=t*=pl,xu=Al(e*=pl),Tu=vl(e),Su.point=Cu}function Cu(t,e){t*=pl;var n=Al(e*=pl),r=vl(e),i=ml(t-wu),o=vl(i),a=r*Al(i),s=Tu*n-xu*r*o,l=xu*n+Tu*r*o;_u.add(bl(Ml(a*a+s*s),l)),wu=t,xu=n,Tu=r}function Du(t){return _u=new m,jl(t,Su),+_u}var Lu=[null,null],Ou={type:"LineString",coordinates:Lu};function Iu(t,e){return Lu[0]=t,Lu[1]=e,Du(Ou)}var Bu={Feature:function(t,e){return ju(t.geometry,e)},FeatureCollection:function(t,e){for(var n=t.features,r=-1,i=n.length;++r0&&(i=Iu(t[o],t[o-1]))>0&&n<=i&&r<=i&&(n+r-i)*(1-Math.pow((n-r)/i,2))sl})).map(l)).concat(z(yl(o/h)*h,i,h).filter((function(t){return ml(t%m)>sl})).map(c))}return b.lines=function(){return v().map((function(t){return{type:"LineString",coordinates:t}}))},b.outline=function(){return{type:"Polygon",coordinates:[u(r).concat(f(a).slice(1),u(n).reverse().slice(1),f(s).reverse().slice(1))]}},b.extent=function(t){return arguments.length?b.extentMajor(t).extentMinor(t):b.extentMinor()},b.extentMajor=function(t){return arguments.length?(r=+t[0][0],n=+t[1][0],s=+t[0][1],a=+t[1][1],r>n&&(t=r,r=n,n=t),s>a&&(t=s,s=a,a=t),b.precision(g)):[[r,s],[n,a]]},b.extentMinor=function(n){return arguments.length?(e=+n[0][0],t=+n[1][0],o=+n[0][1],i=+n[1][1],e>t&&(n=e,e=t,t=n),o>i&&(n=o,o=i,i=n),b.precision(g)):[[e,o],[t,i]]},b.step=function(t){return arguments.length?b.stepMajor(t).stepMinor(t):b.stepMinor()},b.stepMajor=function(t){return arguments.length?(p=+t[0],m=+t[1],b):[p,m]},b.stepMinor=function(t){return arguments.length?(d=+t[0],h=+t[1],b):[d,h]},b.precision=function(d){return arguments.length?(g=+d,l=Vu(o,i,90),c=Hu(e,t,g),u=Vu(s,a,90),f=Hu(r,n,g),b):g},b.extentMajor([[-180,-89.999999],[180,89.999999]]).extentMinor([[-180,-80.000001],[180,80.000001]])}var Yu,Wu,$u,Ku,Xu=t=>t,Qu=new m,Zu=new m,Ju={point:Dl,lineStart:Dl,lineEnd:Dl,polygonStart:function(){Ju.lineStart=tf,Ju.lineEnd=rf},polygonEnd:function(){Ju.lineStart=Ju.lineEnd=Ju.point=Dl,Qu.add(ml(Zu)),Zu=new m},result:function(){var t=Qu/2;return Qu=new m,t}};function tf(){Ju.point=ef}function ef(t,e){Ju.point=nf,Yu=$u=t,Wu=Ku=e}function nf(t,e){Zu.add(Ku*t-$u*e),$u=t,Ku=e}function rf(){nf(Yu,Wu)}var of,af,sf,lf,cf=1/0,uf=cf,ff=-cf,df=ff,hf={point:function(t,e){tff&&(ff=t),edf&&(df=e)},lineStart:Dl,lineEnd:Dl,polygonStart:Dl,polygonEnd:Dl,result:function(){var t=[[cf,uf],[ff,df]];return ff=df=-(uf=cf=1/0),t}},pf=0,mf=0,gf=0,bf=0,vf=0,yf=0,_f=0,wf=0,xf=0,Tf={point:Af,lineStart:Ef,lineEnd:Nf,polygonStart:function(){Tf.lineStart=kf,Tf.lineEnd=Cf},polygonEnd:function(){Tf.point=Af,Tf.lineStart=Ef,Tf.lineEnd=Nf},result:function(){var t=xf?[_f/xf,wf/xf]:yf?[bf/yf,vf/yf]:gf?[pf/gf,mf/gf]:[NaN,NaN];return pf=mf=gf=bf=vf=yf=_f=wf=xf=0,t}};function Af(t,e){pf+=t,mf+=e,++gf}function Ef(){Tf.point=Mf}function Mf(t,e){Tf.point=Sf,Af(sf=t,lf=e)}function Sf(t,e){var n=t-sf,r=e-lf,i=Ml(n*n+r*r);bf+=i*(sf+t)/2,vf+=i*(lf+e)/2,yf+=i,Af(sf=t,lf=e)}function Nf(){Tf.point=Af}function kf(){Tf.point=Df}function Cf(){Lf(of,af)}function Df(t,e){Tf.point=Lf,Af(of=sf=t,af=lf=e)}function Lf(t,e){var n=t-sf,r=e-lf,i=Ml(n*n+r*r);bf+=i*(sf+t)/2,vf+=i*(lf+e)/2,yf+=i,_f+=(i=lf*t-sf*e)*(sf+t),wf+=i*(lf+e),xf+=3*i,Af(sf=t,lf=e)}function Of(t){this._context=t}Of.prototype={_radius:4.5,pointRadius:function(t){return this._radius=t,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._context.closePath(),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._context.moveTo(t,e),this._point=1;break;case 1:this._context.lineTo(t,e);break;default:this._context.moveTo(t+this._radius,e),this._context.arc(t,e,this._radius,0,dl)}},result:Dl};var If,Bf,Pf,jf,Rf,qf=new m,Ff={point:Dl,lineStart:function(){Ff.point=zf},lineEnd:function(){If&&Uf(Bf,Pf),Ff.point=Dl},polygonStart:function(){If=!0},polygonEnd:function(){If=null},result:function(){var t=+qf;return qf=new m,t}};function zf(t,e){Ff.point=Uf,Bf=jf=t,Pf=Rf=e}function Uf(t,e){jf-=t,Rf-=e,qf.add(Ml(jf*jf+Rf*Rf)),jf=t,Rf=e}function Vf(){this._string=[]}function Hf(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Gf(t){return function(e){var n=new Yf;for(var r in t)n[r]=t[r];return n.stream=e,n}}function Yf(){}function Wf(t,e,n){var r=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=r&&t.clipExtent(null),jl(n,t.stream(hf)),e(hf.result()),null!=r&&t.clipExtent(r),t}function $f(t,e,n){return Wf(t,(function(n){var r=e[1][0]-e[0][0],i=e[1][1]-e[0][1],o=Math.min(r/(n[1][0]-n[0][0]),i/(n[1][1]-n[0][1])),a=+e[0][0]+(r-o*(n[1][0]+n[0][0]))/2,s=+e[0][1]+(i-o*(n[1][1]+n[0][1]))/2;t.scale(150*o).translate([a,s])}),n)}function Kf(t,e,n){return $f(t,[[0,0],e],n)}function Xf(t,e,n){return Wf(t,(function(n){var r=+e,i=r/(n[1][0]-n[0][0]),o=(r-i*(n[1][0]+n[0][0]))/2,a=-i*n[0][1];t.scale(150*i).translate([o,a])}),n)}function Qf(t,e,n){return Wf(t,(function(n){var r=+e,i=r/(n[1][1]-n[0][1]),o=-i*n[0][0],a=(r-i*(n[1][1]+n[0][1]))/2;t.scale(150*i).translate([o,a])}),n)}Vf.prototype={_radius:4.5,_circle:Hf(4.5),pointRadius:function(t){return(t=+t)!==this._radius&&(this._radius=t,this._circle=null),this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._string.push("Z"),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._string.push("M",t,",",e),this._point=1;break;case 1:this._string.push("L",t,",",e);break;default:null==this._circle&&(this._circle=Hf(this._radius)),this._string.push("M",t,",",e,this._circle)}},result:function(){if(this._string.length){var t=this._string.join("");return this._string=[],t}return null}},Yf.prototype={constructor:Yf,point:function(t,e){this.stream.point(t,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var Zf=vl(30*pl);function Jf(t,e){return+e?function(t,e){function n(r,i,o,a,s,l,c,u,f,d,h,p,m,g){var b=c-r,v=u-i,y=b*b+v*v;if(y>4*e&&m--){var _=a+d,w=s+h,x=l+p,T=Ml(_*_+w*w+x*x),A=kl(x/=T),E=ml(ml(x)-1)e||ml((b*k+v*C)/y-.5)>.3||a*d+s*h+l*p2?t[2]%360*pl:0,k()):[g*hl,b*hl,v*hl]},S.angle=function(t){return arguments.length?(y=t%360*pl,k()):y*hl},S.reflectX=function(t){return arguments.length?(_=t?-1:1,k()):_<0},S.reflectY=function(t){return arguments.length?(w=t?-1:1,k()):w<0},S.precision=function(t){return arguments.length?(a=Jf(s,M=t*t),C()):Ml(M)},S.fitExtent=function(t,e){return $f(S,t,e)},S.fitSize=function(t,e){return Kf(S,t,e)},S.fitWidth=function(t,e){return Xf(S,t,e)},S.fitHeight=function(t,e){return Qf(S,t,e)},function(){return e=t.apply(this,arguments),S.invert=e.invert&&N,k()}}function id(t){var e=0,n=cl/3,r=rd(t),i=r(e,n);return i.parallels=function(t){return arguments.length?r(e=t[0]*pl,n=t[1]*pl):[e*hl,n*hl]},i}function od(t,e){var n=Al(t),r=(n+Al(e))/2;if(ml(r)0?e<-ul+sl&&(e=-ul+sl):e>ul-sl&&(e=ul-sl);var n=i/Tl(pd(e),r);return[n*Al(r*t),i-n*vl(r*t)]}return o.invert=function(t,e){var n=i-e,o=El(r)*Ml(t*t+n*n),a=bl(t,ml(n))*El(n);return n*r<0&&(a-=cl*El(t)*El(n)),[a/r,2*gl(Tl(i/o,1/r))-ul]},o}function gd(t,e){return[t,e]}function bd(t,e){var n=vl(t),r=t===e?Al(t):(n-vl(e))/(e-t),i=n/r+t;if(ml(r)=0;)e+=n[r].value;else e=1;t.value=e}function Od(t,e){t instanceof Map?(t=[void 0,t],void 0===e&&(e=Bd)):void 0===e&&(e=Id);for(var n,r,i,o,a,s=new Rd(t),l=[s];n=l.pop();)if((i=e(n.data))&&(a=(i=Array.from(i)).length))for(n.children=i,o=a-1;o>=0;--o)l.push(r=i[o]=new Rd(i[o])),r.parent=n,r.depth=n.depth+1;return s.eachBefore(jd)}function Id(t){return t.children}function Bd(t){return Array.isArray(t)?t[1]:null}function Pd(t){void 0!==t.data.value&&(t.value=t.data.value),t.data=t.data.data}function jd(t){var e=0;do{t.height=e}while((t=t.parent)&&t.height<++e)}function Rd(t){this.data=t,this.depth=this.height=0,this.parent=null}function qd(t){for(var e,n,r=0,i=(t=function(t){for(var e,n,r=t.length;r;)n=Math.random()*r--|0,e=t[r],t[r]=t[n],t[n]=e;return t}(Array.from(t))).length,o=[];r0&&n*n>r*r+i*i}function Vd(t,e){for(var n=0;n(a*=a)?(r=(c+a-i)/(2*c),o=Math.sqrt(Math.max(0,a/c-r*r)),n.x=t.x-r*s-o*l,n.y=t.y-r*l+o*s):(r=(c+i-a)/(2*c),o=Math.sqrt(Math.max(0,i/c-r*r)),n.x=e.x+r*s-o*l,n.y=e.y+r*l+o*s)):(n.x=e.x+n.r,n.y=e.y)}function $d(t,e){var n=t.r+e.r-1e-6,r=e.x-t.x,i=e.y-t.y;return n>0&&n*n>r*r+i*i}function Kd(t){var e=t._,n=t.next._,r=e.r+n.r,i=(e.x*n.r+n.x*e.r)/r,o=(e.y*n.r+n.y*e.r)/r;return i*i+o*o}function Xd(t){this._=t,this.next=null,this.previous=null}function Qd(t){if(!(i=(t=function(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}(t)).length))return 0;var e,n,r,i,o,a,s,l,c,u,f;if((e=t[0]).x=0,e.y=0,!(i>1))return e.r;if(n=t[1],e.x=-n.r,n.x=e.r,n.y=0,!(i>2))return e.r+n.r;Wd(n,e,r=t[2]),e=new Xd(e),n=new Xd(n),r=new Xd(r),e.next=r.previous=n,n.next=e.previous=r,r.next=n.previous=e;t:for(s=3;ssl&&--i>0);return[t/(.8707+(o=r*r)*(o*(o*o*o*(.003971-.001529*o)-.013791)-.131979)),r]},Md.invert=cd(kl),Sd.invert=cd((function(t){return 2*gl(t)})),Nd.invert=function(t,e){return[-e,2*gl(_l(t))-ul]},Rd.prototype=Od.prototype={constructor:Rd,count:function(){return this.eachAfter(Ld)},each:function(t,e){let n=-1;for(const r of this)t.call(e,r,++n,this);return this},eachAfter:function(t,e){for(var n,r,i,o=this,a=[o],s=[],l=-1;o=a.pop();)if(s.push(o),n=o.children)for(r=0,i=n.length;r=0;--r)o.push(n[r]);return this},find:function(t,e){let n=-1;for(const r of this)if(t.call(e,r,++n,this))return r},sum:function(t){return this.eachAfter((function(e){for(var n=+t(e.data)||0,r=e.children,i=r&&r.length;--i>=0;)n+=r[i].value;e.value=n}))},sort:function(t){return this.eachBefore((function(e){e.children&&e.children.sort(t)}))},path:function(t){for(var e=this,n=function(t,e){if(t===e)return t;var n=t.ancestors(),r=e.ancestors(),i=null;for(t=n.pop(),e=r.pop();t===e;)i=t,t=n.pop(),e=r.pop();return i}(e,t),r=[e];e!==n;)e=e.parent,r.push(e);for(var i=r.length;t!==n;)r.splice(i,0,t),t=t.parent;return r},ancestors:function(){for(var t=this,e=[t];t=t.parent;)e.push(t);return e},descendants:function(){return Array.from(this)},leaves:function(){var t=[];return this.eachBefore((function(e){e.children||t.push(e)})),t},links:function(){var t=this,e=[];return t.each((function(n){n!==t&&e.push({source:n.parent,target:n})})),e},copy:function(){return Od(this).eachBefore(Pd)},[Symbol.iterator]:function*(){var t,e,n,r,i=this,o=[i];do{for(t=o.reverse(),o=[];i=t.pop();)if(yield i,e=i.children)for(n=0,r=e.length;nd&&(d=s),g=u*u*m,(h=Math.max(d/g,g/f))>p){u-=s;break}p=h}b.push(a={value:u,dice:l1?e:1)},n}(yh),xh=function t(e){function n(t,n,r,i,o){if((a=t._squarify)&&a.ratio===e)for(var a,s,l,c,u,f=-1,d=a.length,h=t.value;++f1?e:1)},n}(yh);function Th(t,e,n){return(e[0]-t[0])*(n[1]-t[1])-(e[1]-t[1])*(n[0]-t[0])}function Ah(t,e){return t[0]-e[0]||t[1]-e[1]}function Eh(t){const e=t.length,n=[0,1];let r,i=2;for(r=2;r1&&Th(t[n[i-2]],t[n[i-1]],t[r])<=0;)--i;n[i++]=r}return n.slice(0,i)}var Mh=Math.random,Sh=function t(e){function n(t,n){return t=null==t?0:+t,n=null==n?1:+n,1===arguments.length?(n=t,t=0):n-=t,function(){return e()*n+t}}return n.source=t,n}(Mh),Nh=function t(e){function n(t,n){return arguments.length<2&&(n=t,t=0),t=Math.floor(t),n=Math.floor(n)-t,function(){return Math.floor(e()*n+t)}}return n.source=t,n}(Mh),kh=function t(e){function n(t,n){var r,i;return t=null==t?0:+t,n=null==n?1:+n,function(){var o;if(null!=r)o=r,r=null;else do{r=2*e()-1,o=2*e()-1,i=r*r+o*o}while(!i||i>1);return t+n*o*Math.sqrt(-2*Math.log(i)/i)}}return n.source=t,n}(Mh),Ch=function t(e){var n=kh.source(e);function r(){var t=n.apply(this,arguments);return function(){return Math.exp(t())}}return r.source=t,r}(Mh),Dh=function t(e){function n(t){return(t=+t)<=0?()=>0:function(){for(var n=0,r=t;r>1;--r)n+=e();return n+r*e()}}return n.source=t,n}(Mh),Lh=function t(e){var n=Dh.source(e);function r(t){if(0==(t=+t))return e;var r=n(t);return function(){return r()/t}}return r.source=t,r}(Mh),Oh=function t(e){function n(t){return function(){return-Math.log1p(-e())/t}}return n.source=t,n}(Mh),Ih=function t(e){function n(t){if((t=+t)<0)throw new RangeError("invalid alpha");return t=1/-t,function(){return Math.pow(1-e(),t)}}return n.source=t,n}(Mh),Bh=function t(e){function n(t){if((t=+t)<0||t>1)throw new RangeError("invalid p");return function(){return Math.floor(e()+t)}}return n.source=t,n}(Mh),Ph=function t(e){function n(t){if((t=+t)<0||t>1)throw new RangeError("invalid p");return 0===t?()=>1/0:1===t?()=>1:(t=Math.log1p(-t),function(){return 1+Math.floor(Math.log1p(-e())/t)})}return n.source=t,n}(Mh),jh=function t(e){var n=kh.source(e)();function r(t,r){if((t=+t)<0)throw new RangeError("invalid k");if(0===t)return()=>0;if(r=null==r?1:+r,1===t)return()=>-Math.log1p(-e())*r;var i=(t<1?t+1:t)-1/3,o=1/(3*Math.sqrt(i)),a=t<1?()=>Math.pow(e(),1/t):()=>1;return function(){do{do{var t=n(),s=1+o*t}while(s<=0);s*=s*s;var l=1-e()}while(l>=1-.0331*t*t*t*t&&Math.log(l)>=.5*t*t+i*(1-s+Math.log(s)));return i*s*a()*r}}return r.source=t,r}(Mh),Rh=function t(e){var n=jh.source(e);function r(t,e){var r=n(t),i=n(e);return function(){var t=r();return 0===t?0:t/(t+i())}}return r.source=t,r}(Mh),qh=function t(e){var n=Ph.source(e),r=Rh.source(e);function i(t,e){return t=+t,(e=+e)>=1?()=>t:e<=0?()=>0:function(){for(var i=0,o=t,a=e;o*a>16&&o*(1-a)>16;){var s=Math.floor((o+1)*a),l=r(s,o-s+1)();l<=a?(i+=s,o-=s,a=(a-l)/(1-l)):(o=s-1,a/=l)}for(var c=a<.5,u=n(c?a:1-a),f=u(),d=0;f<=o;++d)f+=u();return i+(c?d:o-d)}}return i.source=t,i}(Mh),Fh=function t(e){function n(t,n,r){var i;return 0==(t=+t)?i=t=>-Math.log(t):(t=1/t,i=e=>Math.pow(e,t)),n=null==n?0:+n,r=null==r?1:+r,function(){return n+r*i(-Math.log1p(-e()))}}return n.source=t,n}(Mh),zh=function t(e){function n(t,n){return t=null==t?0:+t,n=null==n?1:+n,function(){return t+n*Math.tan(Math.PI*e())}}return n.source=t,n}(Mh),Uh=function t(e){function n(t,n){return t=null==t?0:+t,n=null==n?1:+n,function(){var r=e();return t+n*Math.log(r/(1-r))}}return n.source=t,n}(Mh),Vh=function t(e){var n=jh.source(e),r=qh.source(e);function i(t){return function(){for(var i=0,o=t;o>16;){var a=Math.floor(.875*o),s=n(a)();if(s>o)return i+r(a-1,o/s)();i+=a,o-=s}for(var l=-Math.log1p(-e()),c=0;l<=o;++c)l-=Math.log1p(-e());return i+c}}return i.source=t,i}(Mh);const Hh=1/4294967296;function Gh(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t)}return this}function Yh(t,e){switch(arguments.length){case 0:break;case 1:"function"==typeof t?this.interpolator(t):this.range(t);break;default:this.domain(t),"function"==typeof e?this.interpolator(e):this.range(e)}return this}const Wh=Symbol("implicit");function $h(){var t=new Map,e=[],n=[],r=Wh;function i(i){var o=i+"",a=t.get(o);if(!a){if(r!==Wh)return r;t.set(o,a=e.push(i))}return n[(a-1)%n.length]}return i.domain=function(n){if(!arguments.length)return e.slice();e=[],t=new Map;for(const r of n){const n=r+"";t.has(n)||t.set(n,e.push(r))}return i},i.range=function(t){return arguments.length?(n=Array.from(t),i):n.slice()},i.unknown=function(t){return arguments.length?(r=t,i):r},i.copy=function(){return $h(e,n).unknown(r)},Gh.apply(i,arguments),i}function Kh(){var t,e,n=$h().unknown(void 0),r=n.domain,i=n.range,o=0,a=1,s=!1,l=0,c=0,u=.5;function f(){var n=r().length,f=ae&&(n=t,t=e,e=n),function(n){return Math.max(t,Math.min(e,n))}}(a[0],a[t-1])),r=t>2?np:ep,i=o=null,f}function f(e){return isNaN(e=+e)?n:(i||(i=r(a.map(t),s,l)))(t(c(e)))}return f.invert=function(n){return c(e((o||(o=r(s,a.map(t),lr)))(n)))},f.domain=function(t){return arguments.length?(a=Array.from(t,Qh),u()):a.slice()},f.range=function(t){return arguments.length?(s=Array.from(t),u()):s.slice()},f.rangeRound=function(t){return s=Array.from(t),l=pr,u()},f.clamp=function(t){return arguments.length?(c=!!t||Jh,u()):c!==Jh},f.interpolate=function(t){return arguments.length?(l=t,u()):l},f.unknown=function(t){return arguments.length?(n=t,f):n},function(n,r){return t=n,e=r,u()}}function op(){return ip()(Jh,Jh)}function ap(e,n,r,i){var o,a=M(e,n,r);switch((i=$s(null==i?",f":i)).type){case"s":var s=Math.max(Math.abs(e),Math.abs(n));return null!=i.precision||isNaN(o=ol(a,s))||(i.precision=o),t.formatPrefix(i,s);case"":case"e":case"g":case"p":case"r":null!=i.precision||isNaN(o=al(a,Math.max(Math.abs(e),Math.abs(n))))||(i.precision=o-("e"===i.type));break;case"f":case"%":null!=i.precision||isNaN(o=il(a))||(i.precision=o-2*("%"===i.type))}return t.format(i)}function sp(t){var e=t.domain;return t.ticks=function(t){var n=e();return A(n[0],n[n.length-1],null==t?10:t)},t.tickFormat=function(t,n){var r=e();return ap(r[0],r[r.length-1],null==t?10:t,n)},t.nice=function(n){null==n&&(n=10);var r,i,o=e(),a=0,s=o.length-1,l=o[a],c=o[s],u=10;for(c0;){if((i=E(l,c,n))===r)return o[a]=l,o[s]=c,e(o);if(i>0)l=Math.floor(l/i)*i,c=Math.ceil(c/i)*i;else{if(!(i<0))break;l=Math.ceil(l*i)/i,c=Math.floor(c*i)/i}r=i}return t},t}function lp(t,e){var n,r=0,i=(t=t.slice()).length-1,o=t[r],a=t[i];return a0){for(;d<=h;++d)for(u=1,c=r(d);ul)break;m.push(f)}}else for(;d<=h;++d)for(u=a-1,c=r(d);u>=1;--u)if(!((f=c*u)l)break;m.push(f)}2*m.length0))return s;do{s.push(a=new Date(+n)),e(n,o),t(n)}while(a=e)for(;t(e),!n(e);)e.setTime(e-1)}),(function(t,r){if(t>=t)if(r<0)for(;++r<=0;)for(;e(t,-1),!n(t););else for(;--r>=0;)for(;e(t,1),!n(t););}))},n&&(i.count=function(e,r){return Mp.setTime(+e),Sp.setTime(+r),t(Mp),t(Sp),Math.floor(n(Mp,Sp))},i.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?i.filter(r?function(e){return r(e)%t==0}:function(e){return i.count(0,e)%t==0}):i:null}),i}var kp=Np((function(){}),(function(t,e){t.setTime(+t+e)}),(function(t,e){return e-t}));kp.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?Np((function(e){e.setTime(Math.floor(e/t)*t)}),(function(e,n){e.setTime(+e+n*t)}),(function(e,n){return(n-e)/t})):kp:null};var Cp=kp.range,Dp=1e3,Lp=6e4,Op=36e5,Ip=864e5,Bp=6048e5,Pp=Np((function(t){t.setTime(t-t.getMilliseconds())}),(function(t,e){t.setTime(+t+e*Dp)}),(function(t,e){return(e-t)/Dp}),(function(t){return t.getUTCSeconds()})),jp=Pp.range,Rp=Np((function(t){t.setTime(t-t.getMilliseconds()-t.getSeconds()*Dp)}),(function(t,e){t.setTime(+t+e*Lp)}),(function(t,e){return(e-t)/Lp}),(function(t){return t.getMinutes()})),qp=Rp.range,Fp=Np((function(t){t.setTime(t-t.getMilliseconds()-t.getSeconds()*Dp-t.getMinutes()*Lp)}),(function(t,e){t.setTime(+t+e*Op)}),(function(t,e){return(e-t)/Op}),(function(t){return t.getHours()})),zp=Fp.range,Up=Np((t=>t.setHours(0,0,0,0)),((t,e)=>t.setDate(t.getDate()+e)),((t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*Lp)/Ip),(t=>t.getDate()-1)),Vp=Up.range;function Hp(t){return Np((function(e){e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)}),(function(t,e){t.setDate(t.getDate()+7*e)}),(function(t,e){return(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*Lp)/Bp}))}var Gp=Hp(0),Yp=Hp(1),Wp=Hp(2),$p=Hp(3),Kp=Hp(4),Xp=Hp(5),Qp=Hp(6),Zp=Gp.range,Jp=Yp.range,tm=Wp.range,em=$p.range,nm=Kp.range,rm=Xp.range,im=Qp.range,om=Np((function(t){t.setDate(1),t.setHours(0,0,0,0)}),(function(t,e){t.setMonth(t.getMonth()+e)}),(function(t,e){return e.getMonth()-t.getMonth()+12*(e.getFullYear()-t.getFullYear())}),(function(t){return t.getMonth()})),am=om.range,sm=Np((function(t){t.setMonth(0,1),t.setHours(0,0,0,0)}),(function(t,e){t.setFullYear(t.getFullYear()+e)}),(function(t,e){return e.getFullYear()-t.getFullYear()}),(function(t){return t.getFullYear()}));sm.every=function(t){return isFinite(t=Math.floor(t))&&t>0?Np((function(e){e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)}),(function(e,n){e.setFullYear(e.getFullYear()+n*t)})):null};var lm=sm.range,cm=Np((function(t){t.setUTCSeconds(0,0)}),(function(t,e){t.setTime(+t+e*Lp)}),(function(t,e){return(e-t)/Lp}),(function(t){return t.getUTCMinutes()})),um=cm.range,fm=Np((function(t){t.setUTCMinutes(0,0,0)}),(function(t,e){t.setTime(+t+e*Op)}),(function(t,e){return(e-t)/Op}),(function(t){return t.getUTCHours()})),dm=fm.range,hm=Np((function(t){t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCDate(t.getUTCDate()+e)}),(function(t,e){return(e-t)/Ip}),(function(t){return t.getUTCDate()-1})),pm=hm.range;function mm(t){return Np((function(e){e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCDate(t.getUTCDate()+7*e)}),(function(t,e){return(e-t)/Bp}))}var gm=mm(0),bm=mm(1),vm=mm(2),ym=mm(3),_m=mm(4),wm=mm(5),xm=mm(6),Tm=gm.range,Am=bm.range,Em=vm.range,Mm=ym.range,Sm=_m.range,Nm=wm.range,km=xm.range,Cm=Np((function(t){t.setUTCDate(1),t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCMonth(t.getUTCMonth()+e)}),(function(t,e){return e.getUTCMonth()-t.getUTCMonth()+12*(e.getUTCFullYear()-t.getUTCFullYear())}),(function(t){return t.getUTCMonth()})),Dm=Cm.range,Lm=Np((function(t){t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCFullYear(t.getUTCFullYear()+e)}),(function(t,e){return e.getUTCFullYear()-t.getUTCFullYear()}),(function(t){return t.getUTCFullYear()}));Lm.every=function(t){return isFinite(t=Math.floor(t))&&t>0?Np((function(e){e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)}),(function(e,n){e.setUTCFullYear(e.getUTCFullYear()+n*t)})):null};var Om=Lm.range;function Im(t){if(0<=t.y&&t.y<100){var e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function Bm(t){if(0<=t.y&&t.y<100){var e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function Pm(t,e,n){return{y:t,m:e,d:n,H:0,M:0,S:0,L:0}}function jm(t){var e=t.dateTime,n=t.date,r=t.time,i=t.periods,o=t.days,a=t.shortDays,s=t.months,l=t.shortMonths,c=Gm(i),u=Ym(i),f=Gm(o),d=Ym(o),h=Gm(a),p=Ym(a),m=Gm(s),g=Ym(s),b=Gm(l),v=Ym(l),y={a:function(t){return a[t.getDay()]},A:function(t){return o[t.getDay()]},b:function(t){return l[t.getMonth()]},B:function(t){return s[t.getMonth()]},c:null,d:hg,e:hg,f:vg,g:kg,G:Dg,H:pg,I:mg,j:gg,L:bg,m:yg,M:_g,p:function(t){return i[+(t.getHours()>=12)]},q:function(t){return 1+~~(t.getMonth()/3)},Q:tb,s:eb,S:wg,u:xg,U:Tg,V:Eg,w:Mg,W:Sg,x:null,X:null,y:Ng,Y:Cg,Z:Lg,"%":Jg},_={a:function(t){return a[t.getUTCDay()]},A:function(t){return o[t.getUTCDay()]},b:function(t){return l[t.getUTCMonth()]},B:function(t){return s[t.getUTCMonth()]},c:null,d:Og,e:Og,f:Rg,g:Kg,G:Qg,H:Ig,I:Bg,j:Pg,L:jg,m:qg,M:Fg,p:function(t){return i[+(t.getUTCHours()>=12)]},q:function(t){return 1+~~(t.getUTCMonth()/3)},Q:tb,s:eb,S:zg,u:Ug,U:Vg,V:Gg,w:Yg,W:Wg,x:null,X:null,y:$g,Y:Xg,Z:Zg,"%":Jg},w={a:function(t,e,n){var r=h.exec(e.slice(n));return r?(t.w=p.get(r[0].toLowerCase()),n+r[0].length):-1},A:function(t,e,n){var r=f.exec(e.slice(n));return r?(t.w=d.get(r[0].toLowerCase()),n+r[0].length):-1},b:function(t,e,n){var r=b.exec(e.slice(n));return r?(t.m=v.get(r[0].toLowerCase()),n+r[0].length):-1},B:function(t,e,n){var r=m.exec(e.slice(n));return r?(t.m=g.get(r[0].toLowerCase()),n+r[0].length):-1},c:function(t,n,r){return A(t,e,n,r)},d:rg,e:rg,f:cg,g:Jm,G:Zm,H:og,I:og,j:ig,L:lg,m:ng,M:ag,p:function(t,e,n){var r=c.exec(e.slice(n));return r?(t.p=u.get(r[0].toLowerCase()),n+r[0].length):-1},q:eg,Q:fg,s:dg,S:sg,u:$m,U:Km,V:Xm,w:Wm,W:Qm,x:function(t,e,r){return A(t,n,e,r)},X:function(t,e,n){return A(t,r,e,n)},y:Jm,Y:Zm,Z:tg,"%":ug};function x(t,e){return function(n){var r,i,o,a=[],s=-1,l=0,c=t.length;for(n instanceof Date||(n=new Date(+n));++s53)return null;"w"in o||(o.w=1),"Z"in o?(i=(r=Bm(Pm(o.y,0,1))).getUTCDay(),r=i>4||0===i?bm.ceil(r):bm(r),r=hm.offset(r,7*(o.V-1)),o.y=r.getUTCFullYear(),o.m=r.getUTCMonth(),o.d=r.getUTCDate()+(o.w+6)%7):(i=(r=Im(Pm(o.y,0,1))).getDay(),r=i>4||0===i?Yp.ceil(r):Yp(r),r=Up.offset(r,7*(o.V-1)),o.y=r.getFullYear(),o.m=r.getMonth(),o.d=r.getDate()+(o.w+6)%7)}else("W"in o||"U"in o)&&("w"in o||(o.w="u"in o?o.u%7:"W"in o?1:0),i="Z"in o?Bm(Pm(o.y,0,1)).getUTCDay():Im(Pm(o.y,0,1)).getDay(),o.m=0,o.d="W"in o?(o.w+6)%7+7*o.W-(i+5)%7:o.w+7*o.U-(i+6)%7);return"Z"in o?(o.H+=o.Z/100|0,o.M+=o.Z%100,Bm(o)):Im(o)}}function A(t,e,n,r){for(var i,o,a=0,s=e.length,l=n.length;a=l)return-1;if(37===(i=e.charCodeAt(a++))){if(i=e.charAt(a++),!(o=w[i in qm?e.charAt(a++):i])||(r=o(t,n,r))<0)return-1}else if(i!=n.charCodeAt(r++))return-1}return r}return y.x=x(n,y),y.X=x(r,y),y.c=x(e,y),_.x=x(n,_),_.X=x(r,_),_.c=x(e,_),{format:function(t){var e=x(t+="",y);return e.toString=function(){return t},e},parse:function(t){var e=T(t+="",!1);return e.toString=function(){return t},e},utcFormat:function(t){var e=x(t+="",_);return e.toString=function(){return t},e},utcParse:function(t){var e=T(t+="",!0);return e.toString=function(){return t},e}}}var Rm,qm={"-":"",_:" ",0:"0"},Fm=/^\s*\d+/,zm=/^%/,Um=/[\\^$*+?|[\]().{}]/g;function Vm(t,e,n){var r=t<0?"-":"",i=(r?-t:t)+"",o=i.length;return r+(o[t.toLowerCase(),e])))}function Wm(t,e,n){var r=Fm.exec(e.slice(n,n+1));return r?(t.w=+r[0],n+r[0].length):-1}function $m(t,e,n){var r=Fm.exec(e.slice(n,n+1));return r?(t.u=+r[0],n+r[0].length):-1}function Km(t,e,n){var r=Fm.exec(e.slice(n,n+2));return r?(t.U=+r[0],n+r[0].length):-1}function Xm(t,e,n){var r=Fm.exec(e.slice(n,n+2));return r?(t.V=+r[0],n+r[0].length):-1}function Qm(t,e,n){var r=Fm.exec(e.slice(n,n+2));return r?(t.W=+r[0],n+r[0].length):-1}function Zm(t,e,n){var r=Fm.exec(e.slice(n,n+4));return r?(t.y=+r[0],n+r[0].length):-1}function Jm(t,e,n){var r=Fm.exec(e.slice(n,n+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function tg(t,e,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(n,n+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function eg(t,e,n){var r=Fm.exec(e.slice(n,n+1));return r?(t.q=3*r[0]-3,n+r[0].length):-1}function ng(t,e,n){var r=Fm.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function rg(t,e,n){var r=Fm.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function ig(t,e,n){var r=Fm.exec(e.slice(n,n+3));return r?(t.m=0,t.d=+r[0],n+r[0].length):-1}function og(t,e,n){var r=Fm.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function ag(t,e,n){var r=Fm.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function sg(t,e,n){var r=Fm.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function lg(t,e,n){var r=Fm.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function cg(t,e,n){var r=Fm.exec(e.slice(n,n+6));return r?(t.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function ug(t,e,n){var r=zm.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function fg(t,e,n){var r=Fm.exec(e.slice(n));return r?(t.Q=+r[0],n+r[0].length):-1}function dg(t,e,n){var r=Fm.exec(e.slice(n));return r?(t.s=+r[0],n+r[0].length):-1}function hg(t,e){return Vm(t.getDate(),e,2)}function pg(t,e){return Vm(t.getHours(),e,2)}function mg(t,e){return Vm(t.getHours()%12||12,e,2)}function gg(t,e){return Vm(1+Up.count(sm(t),t),e,3)}function bg(t,e){return Vm(t.getMilliseconds(),e,3)}function vg(t,e){return bg(t,e)+"000"}function yg(t,e){return Vm(t.getMonth()+1,e,2)}function _g(t,e){return Vm(t.getMinutes(),e,2)}function wg(t,e){return Vm(t.getSeconds(),e,2)}function xg(t){var e=t.getDay();return 0===e?7:e}function Tg(t,e){return Vm(Gp.count(sm(t)-1,t),e,2)}function Ag(t){var e=t.getDay();return e>=4||0===e?Kp(t):Kp.ceil(t)}function Eg(t,e){return t=Ag(t),Vm(Kp.count(sm(t),t)+(4===sm(t).getDay()),e,2)}function Mg(t){return t.getDay()}function Sg(t,e){return Vm(Yp.count(sm(t)-1,t),e,2)}function Ng(t,e){return Vm(t.getFullYear()%100,e,2)}function kg(t,e){return Vm((t=Ag(t)).getFullYear()%100,e,2)}function Cg(t,e){return Vm(t.getFullYear()%1e4,e,4)}function Dg(t,e){var n=t.getDay();return Vm((t=n>=4||0===n?Kp(t):Kp.ceil(t)).getFullYear()%1e4,e,4)}function Lg(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+Vm(e/60|0,"0",2)+Vm(e%60,"0",2)}function Og(t,e){return Vm(t.getUTCDate(),e,2)}function Ig(t,e){return Vm(t.getUTCHours(),e,2)}function Bg(t,e){return Vm(t.getUTCHours()%12||12,e,2)}function Pg(t,e){return Vm(1+hm.count(Lm(t),t),e,3)}function jg(t,e){return Vm(t.getUTCMilliseconds(),e,3)}function Rg(t,e){return jg(t,e)+"000"}function qg(t,e){return Vm(t.getUTCMonth()+1,e,2)}function Fg(t,e){return Vm(t.getUTCMinutes(),e,2)}function zg(t,e){return Vm(t.getUTCSeconds(),e,2)}function Ug(t){var e=t.getUTCDay();return 0===e?7:e}function Vg(t,e){return Vm(gm.count(Lm(t)-1,t),e,2)}function Hg(t){var e=t.getUTCDay();return e>=4||0===e?_m(t):_m.ceil(t)}function Gg(t,e){return t=Hg(t),Vm(_m.count(Lm(t),t)+(4===Lm(t).getUTCDay()),e,2)}function Yg(t){return t.getUTCDay()}function Wg(t,e){return Vm(bm.count(Lm(t)-1,t),e,2)}function $g(t,e){return Vm(t.getUTCFullYear()%100,e,2)}function Kg(t,e){return Vm((t=Hg(t)).getUTCFullYear()%100,e,2)}function Xg(t,e){return Vm(t.getUTCFullYear()%1e4,e,4)}function Qg(t,e){var n=t.getUTCDay();return Vm((t=n>=4||0===n?_m(t):_m.ceil(t)).getUTCFullYear()%1e4,e,4)}function Zg(){return"+0000"}function Jg(){return"%"}function tb(t){return+t}function eb(t){return Math.floor(+t/1e3)}function nb(e){return Rm=jm(e),t.timeFormat=Rm.format,t.timeParse=Rm.parse,t.utcFormat=Rm.utcFormat,t.utcParse=Rm.utcParse,Rm}nb({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});var rb="%Y-%m-%dT%H:%M:%S.%LZ",ib=Date.prototype.toISOString?function(t){return t.toISOString()}:t.utcFormat(rb),ob=+new Date("2000-01-01T00:00:00.000Z")?function(t){var e=new Date(t);return isNaN(e)?null:e}:t.utcParse(rb),ab=31536e6;function sb(t){return new Date(t)}function lb(t){return t instanceof Date?+t:+new Date(+t)}function cb(t,e,r,i,o,a,s,l,c){var u=op(),f=u.invert,d=u.domain,h=c(".%L"),p=c(":%S"),m=c("%I:%M"),g=c("%I %p"),b=c("%a %d"),v=c("%b %d"),y=c("%B"),_=c("%Y"),w=[[s,1,1e3],[s,5,5e3],[s,15,15e3],[s,30,3e4],[a,1,6e4],[a,5,3e5],[a,15,9e5],[a,30,18e5],[o,1,36e5],[o,3,108e5],[o,6,216e5],[o,12,432e5],[i,1,864e5],[i,2,1728e5],[r,1,6048e5],[e,1,2592e6],[e,3,7776e6],[t,1,ab]];function x(n){return(s(n)nr(t[t.length-1]),Sb=new Array(3).concat("d8b365f5f5f55ab4ac","a6611adfc27d80cdc1018571","a6611adfc27df5f5f580cdc1018571","8c510ad8b365f6e8c3c7eae55ab4ac01665e","8c510ad8b365f6e8c3f5f5f5c7eae55ab4ac01665e","8c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e","8c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e","5430058c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e003c30","5430058c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e003c30").map(mb),Nb=Mb(Sb),kb=new Array(3).concat("af8dc3f7f7f77fbf7b","7b3294c2a5cfa6dba0008837","7b3294c2a5cff7f7f7a6dba0008837","762a83af8dc3e7d4e8d9f0d37fbf7b1b7837","762a83af8dc3e7d4e8f7f7f7d9f0d37fbf7b1b7837","762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b7837","762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b7837","40004b762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b783700441b","40004b762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b783700441b").map(mb),Cb=Mb(kb),Db=new Array(3).concat("e9a3c9f7f7f7a1d76a","d01c8bf1b6dab8e1864dac26","d01c8bf1b6daf7f7f7b8e1864dac26","c51b7de9a3c9fde0efe6f5d0a1d76a4d9221","c51b7de9a3c9fde0eff7f7f7e6f5d0a1d76a4d9221","c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221","c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221","8e0152c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221276419","8e0152c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221276419").map(mb),Lb=Mb(Db),Ob=new Array(3).concat("998ec3f7f7f7f1a340","5e3c99b2abd2fdb863e66101","5e3c99b2abd2f7f7f7fdb863e66101","542788998ec3d8daebfee0b6f1a340b35806","542788998ec3d8daebf7f7f7fee0b6f1a340b35806","5427888073acb2abd2d8daebfee0b6fdb863e08214b35806","5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b35806","2d004b5427888073acb2abd2d8daebfee0b6fdb863e08214b358067f3b08","2d004b5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b358067f3b08").map(mb),Ib=Mb(Ob),Bb=new Array(3).concat("ef8a62f7f7f767a9cf","ca0020f4a58292c5de0571b0","ca0020f4a582f7f7f792c5de0571b0","b2182bef8a62fddbc7d1e5f067a9cf2166ac","b2182bef8a62fddbc7f7f7f7d1e5f067a9cf2166ac","b2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac","b2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac","67001fb2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac053061","67001fb2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac053061").map(mb),Pb=Mb(Bb),jb=new Array(3).concat("ef8a62ffffff999999","ca0020f4a582bababa404040","ca0020f4a582ffffffbababa404040","b2182bef8a62fddbc7e0e0e09999994d4d4d","b2182bef8a62fddbc7ffffffe0e0e09999994d4d4d","b2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d","b2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d","67001fb2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d1a1a1a","67001fb2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d1a1a1a").map(mb),Rb=Mb(jb),qb=new Array(3).concat("fc8d59ffffbf91bfdb","d7191cfdae61abd9e92c7bb6","d7191cfdae61ffffbfabd9e92c7bb6","d73027fc8d59fee090e0f3f891bfdb4575b4","d73027fc8d59fee090ffffbfe0f3f891bfdb4575b4","d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4","d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4","a50026d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4313695","a50026d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4313695").map(mb),Fb=Mb(qb),zb=new Array(3).concat("fc8d59ffffbf91cf60","d7191cfdae61a6d96a1a9641","d7191cfdae61ffffbfa6d96a1a9641","d73027fc8d59fee08bd9ef8b91cf601a9850","d73027fc8d59fee08bffffbfd9ef8b91cf601a9850","d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850","d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850","a50026d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850006837","a50026d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850006837").map(mb),Ub=Mb(zb),Vb=new Array(3).concat("fc8d59ffffbf99d594","d7191cfdae61abdda42b83ba","d7191cfdae61ffffbfabdda42b83ba","d53e4ffc8d59fee08be6f59899d5943288bd","d53e4ffc8d59fee08bffffbfe6f59899d5943288bd","d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd","d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd","9e0142d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd5e4fa2","9e0142d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd5e4fa2").map(mb),Hb=Mb(Vb),Gb=new Array(3).concat("e5f5f999d8c92ca25f","edf8fbb2e2e266c2a4238b45","edf8fbb2e2e266c2a42ca25f006d2c","edf8fbccece699d8c966c2a42ca25f006d2c","edf8fbccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45006d2c00441b").map(mb),Yb=Mb(Gb),Wb=new Array(3).concat("e0ecf49ebcda8856a7","edf8fbb3cde38c96c688419d","edf8fbb3cde38c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d810f7c4d004b").map(mb),$b=Mb(Wb),Kb=new Array(3).concat("e0f3dba8ddb543a2ca","f0f9e8bae4bc7bccc42b8cbe","f0f9e8bae4bc7bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe0868ac084081").map(mb),Xb=Mb(Kb),Qb=new Array(3).concat("fee8c8fdbb84e34a33","fef0d9fdcc8afc8d59d7301f","fef0d9fdcc8afc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301fb300007f0000").map(mb),Zb=Mb(Qb),Jb=new Array(3).concat("ece2f0a6bddb1c9099","f6eff7bdc9e167a9cf02818a","f6eff7bdc9e167a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016c59014636").map(mb),tv=Mb(Jb),ev=new Array(3).concat("ece7f2a6bddb2b8cbe","f1eef6bdc9e174a9cf0570b0","f1eef6bdc9e174a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0045a8d023858").map(mb),nv=Mb(ev),rv=new Array(3).concat("e7e1efc994c7dd1c77","f1eef6d7b5d8df65b0ce1256","f1eef6d7b5d8df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125698004367001f").map(mb),iv=Mb(rv),ov=new Array(3).concat("fde0ddfa9fb5c51b8a","feebe2fbb4b9f768a1ae017e","feebe2fbb4b9f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a017749006a").map(mb),av=Mb(ov),sv=new Array(3).concat("edf8b17fcdbb2c7fb8","ffffcca1dab441b6c4225ea8","ffffcca1dab441b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea8253494081d58").map(mb),lv=Mb(sv),cv=new Array(3).concat("f7fcb9addd8e31a354","ffffccc2e69978c679238443","ffffccc2e69978c67931a354006837","ffffccd9f0a3addd8e78c67931a354006837","ffffccd9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443006837004529").map(mb),uv=Mb(cv),fv=new Array(3).concat("fff7bcfec44fd95f0e","ffffd4fed98efe9929cc4c02","ffffd4fed98efe9929d95f0e993404","ffffd4fee391fec44ffe9929d95f0e993404","ffffd4fee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c02993404662506").map(mb),dv=Mb(fv),hv=new Array(3).concat("ffeda0feb24cf03b20","ffffb2fecc5cfd8d3ce31a1c","ffffb2fecc5cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cbd0026800026").map(mb),pv=Mb(hv),mv=new Array(3).concat("deebf79ecae13182bd","eff3ffbdd7e76baed62171b5","eff3ffbdd7e76baed63182bd08519c","eff3ffc6dbef9ecae16baed63182bd08519c","eff3ffc6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b508519c08306b").map(mb),gv=Mb(mv),bv=new Array(3).concat("e5f5e0a1d99b31a354","edf8e9bae4b374c476238b45","edf8e9bae4b374c47631a354006d2c","edf8e9c7e9c0a1d99b74c47631a354006d2c","edf8e9c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45006d2c00441b").map(mb),vv=Mb(bv),yv=new Array(3).concat("f0f0f0bdbdbd636363","f7f7f7cccccc969696525252","f7f7f7cccccc969696636363252525","f7f7f7d9d9d9bdbdbd969696636363252525","f7f7f7d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525000000").map(mb),_v=Mb(yv),wv=new Array(3).concat("efedf5bcbddc756bb1","f2f0f7cbc9e29e9ac86a51a3","f2f0f7cbc9e29e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a354278f3f007d").map(mb),xv=Mb(wv),Tv=new Array(3).concat("fee0d2fc9272de2d26","fee5d9fcae91fb6a4acb181d","fee5d9fcae91fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181da50f1567000d").map(mb),Av=Mb(Tv),Ev=new Array(3).concat("fee6cefdae6be6550d","feeddefdbe85fd8d3cd94701","feeddefdbe85fd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d94801a636037f2704").map(mb),Mv=Mb(Ev),Sv=Lr(Gn(300,.5,0),Gn(-240,.5,1)),Nv=Lr(Gn(-100,.75,.35),Gn(80,1.5,.8)),kv=Lr(Gn(260,.75,.35),Gn(80,1.5,.8)),Cv=Gn(),Dv=ln(),Lv=Math.PI/3,Ov=2*Math.PI/3;function Iv(t){var e=t.length;return function(n){return t[Math.max(0,Math.min(e-1,Math.floor(n*e)))]}}var Bv=Iv(mb("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725")),Pv=Iv(mb("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf")),jv=Iv(mb("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4")),Rv=Iv(mb("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921"));function qv(t){return function(){return t}}var Fv=Math.abs,zv=Math.atan2,Uv=Math.cos,Vv=Math.max,Hv=Math.min,Gv=Math.sin,Yv=Math.sqrt,Wv=1e-12,$v=Math.PI,Kv=$v/2,Xv=2*$v;function Qv(t){return t>1?0:t<-1?$v:Math.acos(t)}function Zv(t){return t>=1?Kv:t<=-1?-Kv:Math.asin(t)}function Jv(t){return t.innerRadius}function ty(t){return t.outerRadius}function ey(t){return t.startAngle}function ny(t){return t.endAngle}function ry(t){return t&&t.padAngle}function iy(t,e,n,r,i,o,a,s){var l=n-t,c=r-e,u=a-i,f=s-o,d=f*l-u*c;if(!(d*dC*C+D*D&&(A=M,E=S),{cx:A,cy:E,x01:-u,y01:-f,x11:A*(i/w-1),y11:E*(i/w-1)}}var ay=Array.prototype.slice;function sy(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}function ly(t){this._context=t}function cy(t){return new ly(t)}function uy(t){return t[0]}function fy(t){return t[1]}function dy(t,e){var n=qv(!0),r=null,i=cy,o=null;function a(a){var s,l,c,u=(a=sy(a)).length,f=!1;for(null==r&&(o=i(c=Zo())),s=0;s<=u;++s)!(s=u;--f)s.point(g[f],b[f]);s.lineEnd(),s.areaEnd()}m&&(g[c]=+t(d,c,l),b[c]=+e(d,c,l),s.point(r?+r(d,c,l):g[c],n?+n(d,c,l):b[c]))}if(h)return s=null,h+""||null}function c(){return dy().defined(i).curve(a).context(o)}return t="function"==typeof t?t:void 0===t?uy:qv(+t),e="function"==typeof e?e:qv(void 0===e?0:+e),n="function"==typeof n?n:void 0===n?fy:qv(+n),l.x=function(e){return arguments.length?(t="function"==typeof e?e:qv(+e),r=null,l):t},l.x0=function(e){return arguments.length?(t="function"==typeof e?e:qv(+e),l):t},l.x1=function(t){return arguments.length?(r=null==t?null:"function"==typeof t?t:qv(+t),l):r},l.y=function(t){return arguments.length?(e="function"==typeof t?t:qv(+t),n=null,l):e},l.y0=function(t){return arguments.length?(e="function"==typeof t?t:qv(+t),l):e},l.y1=function(t){return arguments.length?(n=null==t?null:"function"==typeof t?t:qv(+t),l):n},l.lineX0=l.lineY0=function(){return c().x(t).y(e)},l.lineY1=function(){return c().x(t).y(n)},l.lineX1=function(){return c().x(r).y(e)},l.defined=function(t){return arguments.length?(i="function"==typeof t?t:qv(!!t),l):i},l.curve=function(t){return arguments.length?(a=t,null!=o&&(s=a(o)),l):a},l.context=function(t){return arguments.length?(null==t?o=s=null:s=a(o=t),l):o},l}function py(t,e){return et?1:e>=t?0:NaN}function my(t){return t}ly.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._context.lineTo(t,e)}}};var gy=vy(cy);function by(t){this._curve=t}function vy(t){function e(e){return new by(t(e))}return e._curve=t,e}function yy(t){var e=t.curve;return t.angle=t.x,delete t.x,t.radius=t.y,delete t.y,t.curve=function(t){return arguments.length?e(vy(t)):e()._curve},t}function _y(){return yy(dy().curve(gy))}function wy(){var t=hy().curve(gy),e=t.curve,n=t.lineX0,r=t.lineX1,i=t.lineY0,o=t.lineY1;return t.angle=t.x,delete t.x,t.startAngle=t.x0,delete t.x0,t.endAngle=t.x1,delete t.x1,t.radius=t.y,delete t.y,t.innerRadius=t.y0,delete t.y0,t.outerRadius=t.y1,delete t.y1,t.lineStartAngle=function(){return yy(n())},delete t.lineX0,t.lineEndAngle=function(){return yy(r())},delete t.lineX1,t.lineInnerRadius=function(){return yy(i())},delete t.lineY0,t.lineOuterRadius=function(){return yy(o())},delete t.lineY1,t.curve=function(t){return arguments.length?e(vy(t)):e()._curve},t}function xy(t,e){return[(e=+e)*Math.cos(t-=Math.PI/2),e*Math.sin(t)]}function Ty(t){return t.source}function Ay(t){return t.target}function Ey(t){var e=Ty,n=Ay,r=uy,i=fy,o=null;function a(){var a,s=ay.call(arguments),l=e.apply(this,s),c=n.apply(this,s);if(o||(o=a=Zo()),t(o,+r.apply(this,(s[0]=l,s)),+i.apply(this,s),+r.apply(this,(s[0]=c,s)),+i.apply(this,s)),a)return o=null,a+""||null}return a.source=function(t){return arguments.length?(e=t,a):e},a.target=function(t){return arguments.length?(n=t,a):n},a.x=function(t){return arguments.length?(r="function"==typeof t?t:qv(+t),a):r},a.y=function(t){return arguments.length?(i="function"==typeof t?t:qv(+t),a):i},a.context=function(t){return arguments.length?(o=null==t?null:t,a):o},a}function My(t,e,n,r,i){t.moveTo(e,n),t.bezierCurveTo(e=(e+r)/2,n,e,i,r,i)}function Sy(t,e,n,r,i){t.moveTo(e,n),t.bezierCurveTo(e,n=(n+i)/2,r,n,r,i)}function Ny(t,e,n,r,i){var o=xy(e,n),a=xy(e,n=(n+i)/2),s=xy(r,n),l=xy(r,i);t.moveTo(o[0],o[1]),t.bezierCurveTo(a[0],a[1],s[0],s[1],l[0],l[1])}by.prototype={areaStart:function(){this._curve.areaStart()},areaEnd:function(){this._curve.areaEnd()},lineStart:function(){this._curve.lineStart()},lineEnd:function(){this._curve.lineEnd()},point:function(t,e){this._curve.point(e*Math.sin(t),e*-Math.cos(t))}};var ky={draw:function(t,e){var n=Math.sqrt(e/$v);t.moveTo(n,0),t.arc(0,0,n,0,Xv)}},Cy={draw:function(t,e){var n=Math.sqrt(e/5)/2;t.moveTo(-3*n,-n),t.lineTo(-n,-n),t.lineTo(-n,-3*n),t.lineTo(n,-3*n),t.lineTo(n,-n),t.lineTo(3*n,-n),t.lineTo(3*n,n),t.lineTo(n,n),t.lineTo(n,3*n),t.lineTo(-n,3*n),t.lineTo(-n,n),t.lineTo(-3*n,n),t.closePath()}},Dy=Math.sqrt(1/3),Ly=2*Dy,Oy={draw:function(t,e){var n=Math.sqrt(e/Ly),r=n*Dy;t.moveTo(0,-n),t.lineTo(r,0),t.lineTo(0,n),t.lineTo(-r,0),t.closePath()}},Iy=Math.sin($v/10)/Math.sin(7*$v/10),By=Math.sin(Xv/10)*Iy,Py=-Math.cos(Xv/10)*Iy,jy={draw:function(t,e){var n=Math.sqrt(.8908130915292852*e),r=By*n,i=Py*n;t.moveTo(0,-n),t.lineTo(r,i);for(var o=1;o<5;++o){var a=Xv*o/5,s=Math.cos(a),l=Math.sin(a);t.lineTo(l*n,-s*n),t.lineTo(s*r-l*i,l*r+s*i)}t.closePath()}},Ry={draw:function(t,e){var n=Math.sqrt(e),r=-n/2;t.rect(r,r,n,n)}},qy=Math.sqrt(3),Fy={draw:function(t,e){var n=-Math.sqrt(e/(3*qy));t.moveTo(0,2*n),t.lineTo(-qy*n,-n),t.lineTo(qy*n,-n),t.closePath()}},zy=-.5,Uy=Math.sqrt(3)/2,Vy=1/Math.sqrt(12),Hy=3*(Vy/2+1),Gy={draw:function(t,e){var n=Math.sqrt(e/Hy),r=n/2,i=n*Vy,o=r,a=n*Vy+n,s=-o,l=a;t.moveTo(r,i),t.lineTo(o,a),t.lineTo(s,l),t.lineTo(zy*r-Uy*i,Uy*r+zy*i),t.lineTo(zy*o-Uy*a,Uy*o+zy*a),t.lineTo(zy*s-Uy*l,Uy*s+zy*l),t.lineTo(zy*r+Uy*i,zy*i-Uy*r),t.lineTo(zy*o+Uy*a,zy*a-Uy*o),t.lineTo(zy*s+Uy*l,zy*l-Uy*s),t.closePath()}},Yy=[ky,Cy,Oy,Ry,jy,Fy,Gy];function Wy(){}function $y(t,e,n){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+n)/6)}function Ky(t){this._context=t}function Xy(t){this._context=t}function Qy(t){this._context=t}function Zy(t,e){this._basis=new Ky(t),this._beta=e}Ky.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:$y(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:$y(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},Xy.prototype={areaStart:Wy,areaEnd:Wy,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x2=t,this._y2=e;break;case 1:this._point=2,this._x3=t,this._y3=e;break;case 2:this._point=3,this._x4=t,this._y4=e,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+e)/6);break;default:$y(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},Qy.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+t)/6,r=(this._y0+4*this._y1+e)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:$y(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},Zy.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var t=this._x,e=this._y,n=t.length-1;if(n>0)for(var r,i=t[0],o=e[0],a=t[n]-i,s=e[n]-o,l=-1;++l<=n;)r=l/n,this._basis.point(this._beta*t[l]+(1-this._beta)*(i+r*a),this._beta*e[l]+(1-this._beta)*(o+r*s));this._x=this._y=null,this._basis.lineEnd()},point:function(t,e){this._x.push(+t),this._y.push(+e)}};var Jy=function t(e){function n(t){return 1===e?new Ky(t):new Zy(t,e)}return n.beta=function(e){return t(+e)},n}(.85);function t_(t,e,n){t._context.bezierCurveTo(t._x1+t._k*(t._x2-t._x0),t._y1+t._k*(t._y2-t._y0),t._x2+t._k*(t._x1-e),t._y2+t._k*(t._y1-n),t._x2,t._y2)}function e_(t,e){this._context=t,this._k=(1-e)/6}e_.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:t_(this,this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2,this._x1=t,this._y1=e;break;case 2:this._point=3;default:t_(this,t,e)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var n_=function t(e){function n(t){return new e_(t,e)}return n.tension=function(e){return t(+e)},n}(0);function r_(t,e){this._context=t,this._k=(1-e)/6}r_.prototype={areaStart:Wy,areaEnd:Wy,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x3=t,this._y3=e;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=e);break;case 2:this._point=3,this._x5=t,this._y5=e;break;default:t_(this,t,e)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var i_=function t(e){function n(t){return new r_(t,e)}return n.tension=function(e){return t(+e)},n}(0);function o_(t,e){this._context=t,this._k=(1-e)/6}o_.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:t_(this,t,e)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var a_=function t(e){function n(t){return new o_(t,e)}return n.tension=function(e){return t(+e)},n}(0);function s_(t,e,n){var r=t._x1,i=t._y1,o=t._x2,a=t._y2;if(t._l01_a>Wv){var s=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,l=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*s-t._x0*t._l12_2a+t._x2*t._l01_2a)/l,i=(i*s-t._y0*t._l12_2a+t._y2*t._l01_2a)/l}if(t._l23_a>Wv){var c=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,u=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*c+t._x1*t._l23_2a-e*t._l12_2a)/u,a=(a*c+t._y1*t._l23_2a-n*t._l12_2a)/u}t._context.bezierCurveTo(r,i,o,a,t._x2,t._y2)}function l_(t,e){this._context=t,this._alpha=e}l_.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){if(t=+t,e=+e,this._point){var n=this._x2-t,r=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3;default:s_(this,t,e)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var c_=function t(e){function n(t){return e?new l_(t,e):new e_(t,0)}return n.alpha=function(e){return t(+e)},n}(.5);function u_(t,e){this._context=t,this._alpha=e}u_.prototype={areaStart:Wy,areaEnd:Wy,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(t,e){if(t=+t,e=+e,this._point){var n=this._x2-t,r=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=t,this._y3=e;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=e);break;case 2:this._point=3,this._x5=t,this._y5=e;break;default:s_(this,t,e)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var f_=function t(e){function n(t){return e?new u_(t,e):new r_(t,0)}return n.alpha=function(e){return t(+e)},n}(.5);function d_(t,e){this._context=t,this._alpha=e}d_.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){if(t=+t,e=+e,this._point){var n=this._x2-t,r=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:s_(this,t,e)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var h_=function t(e){function n(t){return e?new d_(t,e):new o_(t,0)}return n.alpha=function(e){return t(+e)},n}(.5);function p_(t){this._context=t}function m_(t){return t<0?-1:1}function g_(t,e,n){var r=t._x1-t._x0,i=e-t._x1,o=(t._y1-t._y0)/(r||i<0&&-0),a=(n-t._y1)/(i||r<0&&-0),s=(o*i+a*r)/(r+i);return(m_(o)+m_(a))*Math.min(Math.abs(o),Math.abs(a),.5*Math.abs(s))||0}function b_(t,e){var n=t._x1-t._x0;return n?(3*(t._y1-t._y0)/n-e)/2:e}function v_(t,e,n){var r=t._x0,i=t._y0,o=t._x1,a=t._y1,s=(o-r)/3;t._context.bezierCurveTo(r+s,i+s*e,o-s,a-s*n,o,a)}function y_(t){this._context=t}function __(t){this._context=new w_(t)}function w_(t){this._context=t}function x_(t){this._context=t}function T_(t){var e,n,r=t.length-1,i=new Array(r),o=new Array(r),a=new Array(r);for(i[0]=0,o[0]=2,a[0]=t[0]+2*t[1],e=1;e=0;--e)i[e]=(a[e]-i[e+1])/o[e];for(o[r-1]=(t[r]+i[r-1])/2,e=0;e1)for(var n,r,i,o=1,a=t[e[0]],s=a.length;o=0;)n[e]=e;return n}function S_(t,e){return t[e]}function N_(t){const e=[];return e.key=t,e}function k_(t){var e=t.map(C_);return M_(t).sort((function(t,n){return e[t]-e[n]}))}function C_(t){for(var e,n=-1,r=0,i=t.length,o=-1/0;++no&&(o=e,r=n);return r}function D_(t){var e=t.map(L_);return M_(t).sort((function(t,n){return e[t]-e[n]}))}function L_(t){for(var e,n=0,r=-1,i=t.length;++r=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,e),this._context.lineTo(t,e);else{var n=this._x*(1-this._t)+t*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,e)}}this._x=t,this._y=e}};var O_=t=>()=>t;function I_(t,{sourceEvent:e,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function B_(t,e,n){this.k=t,this.x=e,this.y=n}B_.prototype={constructor:B_,scale:function(t){return 1===t?this:new B_(this.k*t,this.x,this.y)},translate:function(t,e){return 0===t&0===e?this:new B_(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var P_=new B_(1,0,0);function j_(t){for(;!t.__zoom;)if(!(t=t.parentNode))return P_;return t.__zoom}function R_(t){t.stopImmediatePropagation()}function q_(t){t.preventDefault(),t.stopImmediatePropagation()}function F_(t){return!(t.ctrlKey&&"wheel"!==t.type||t.button)}function z_(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t).hasAttribute("viewBox")?[[(t=t.viewBox.baseVal).x,t.y],[t.x+t.width,t.y+t.height]]:[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]:[[0,0],[t.clientWidth,t.clientHeight]]}function U_(){return this.__zoom||P_}function V_(t){return-t.deltaY*(1===t.deltaMode?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function H_(){return navigator.maxTouchPoints||"ontouchstart"in this}function G_(t,e,n){var r=t.invertX(e[0][0])-n[0][0],i=t.invertX(e[1][0])-n[1][0],o=t.invertY(e[0][1])-n[0][1],a=t.invertY(e[1][1])-n[1][1];return t.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),a>o?(o+a)/2:Math.min(0,o)||Math.max(0,a))}j_.prototype=B_.prototype,t.Adder=m,t.Delaunay=Ha,t.FormatSpecifier=Ks,t.Voronoi=Ra,t.active=function(t,e){var n,r,i=t.__transition;if(i)for(r in e=null==e?null:e+"",i)if((n=i[r]).state>1&&n.name===e)return new Oi([[t]],ao,e,+r);return null},t.arc=function(){var t=Jv,e=ty,n=qv(0),r=null,i=ey,o=ny,a=ry,s=null;function l(){var l,c,u=+t.apply(this,arguments),f=+e.apply(this,arguments),d=i.apply(this,arguments)-Kv,h=o.apply(this,arguments)-Kv,p=Fv(h-d),m=h>d;if(s||(s=l=Zo()),fWv)if(p>Xv-Wv)s.moveTo(f*Uv(d),f*Gv(d)),s.arc(0,0,f,d,h,!m),u>Wv&&(s.moveTo(u*Uv(h),u*Gv(h)),s.arc(0,0,u,h,d,m));else{var g,b,v=d,y=h,_=d,w=h,x=p,T=p,A=a.apply(this,arguments)/2,E=A>Wv&&(r?+r.apply(this,arguments):Yv(u*u+f*f)),M=Hv(Fv(f-u)/2,+n.apply(this,arguments)),S=M,N=M;if(E>Wv){var k=Zv(E/u*Gv(A)),C=Zv(E/f*Gv(A));(x-=2*k)>Wv?(_+=k*=m?1:-1,w-=k):(x=0,_=w=(d+h)/2),(T-=2*C)>Wv?(v+=C*=m?1:-1,y-=C):(T=0,v=y=(d+h)/2)}var D=f*Uv(v),L=f*Gv(v),O=u*Uv(w),I=u*Gv(w);if(M>Wv){var B,P=f*Uv(y),j=f*Gv(y),R=u*Uv(_),q=u*Gv(_);if(p<$v&&(B=iy(D,L,R,q,P,j,O,I))){var F=D-B[0],z=L-B[1],U=P-B[0],V=j-B[1],H=1/Gv(Qv((F*U+z*V)/(Yv(F*F+z*z)*Yv(U*U+V*V)))/2),G=Yv(B[0]*B[0]+B[1]*B[1]);S=Hv(M,(u-G)/(H-1)),N=Hv(M,(f-G)/(H+1))}}T>Wv?N>Wv?(g=oy(R,q,D,L,f,N,m),b=oy(P,j,O,I,f,N,m),s.moveTo(g.cx+g.x01,g.cy+g.y01),NWv&&x>Wv?S>Wv?(g=oy(O,I,P,j,u,-S,m),b=oy(D,L,R,q,u,-S,m),s.lineTo(g.cx+g.x01,g.cy+g.y01),S>a,c=i+2*s>>a,u=fa(20);function f(r){var i=new Float32Array(l*c),f=new Float32Array(l*c);r.forEach((function(r,o,u){var f=+t(r,o,u)+s>>a,d=+e(r,o,u)+s>>a,h=+n(r,o,u);f>=0&&f=0&&d>a),ya({width:l,height:c,data:f},{width:l,height:c,data:i},o>>a),va({width:l,height:c,data:i},{width:l,height:c,data:f},o>>a),ya({width:l,height:c,data:f},{width:l,height:c,data:i},o>>a),va({width:l,height:c,data:i},{width:l,height:c,data:f},o>>a),ya({width:l,height:c,data:f},{width:l,height:c,data:i},o>>a);var h=u(i);if(!Array.isArray(h)){var p=C(i);h=M(0,p,h),(h=z(0,Math.floor(p/h)*h,h)).shift()}return ba().thresholds(h).size([l,c])(i).map(d)}function d(t){return t.value*=Math.pow(2,-2*a),t.coordinates.forEach(h),t}function h(t){t.forEach(p)}function p(t){t.forEach(m)}function m(t){t[0]=t[0]*Math.pow(2,a)-s,t[1]=t[1]*Math.pow(2,a)-s}function g(){return l=r+2*(s=3*o)>>a,c=i+2*s>>a,f}return f.x=function(e){return arguments.length?(t="function"==typeof e?e:fa(+e),f):t},f.y=function(t){return arguments.length?(e="function"==typeof t?t:fa(+t),f):e},f.weight=function(t){return arguments.length?(n="function"==typeof t?t:fa(+t),f):n},f.size=function(t){if(!arguments.length)return[r,i];var e=+t[0],n=+t[1];if(!(e>=0&&n>=0))throw new Error("invalid size");return r=e,i=n,g()},f.cellSize=function(t){if(!arguments.length)return 1<=1))throw new Error("invalid cell size");return a=Math.floor(Math.log(t)/Math.LN2),g()},f.thresholds=function(t){return arguments.length?(u="function"==typeof t?t:Array.isArray(t)?fa(ca.call(t)):fa(t),f):u},f.bandwidth=function(t){if(!arguments.length)return Math.sqrt(o*(o+1));if(!((t=+t)>=0))throw new Error("invalid bandwidth");return o=Math.round((Math.sqrt(4*t*t+1)-1)/2),g()},f},t.contours=ba,t.count=l,t.create=function(t){return Te(mt(t).call(document.documentElement))},t.creator=mt,t.cross=function(...t){const e="function"==typeof t[t.length-1]&&function(t){return e=>t(...e)}(t.pop()),n=(t=t.map(f)).map(c),r=t.length-1,i=new Array(r+1).fill(0),o=[];if(r<0||n.some(u))return o;for(;;){o.push(i.map(((e,n)=>t[n][e])));let a=r;for(;++i[a]===n[a];){if(0===a)return e?o.map(e):o;i[a--]=0}}},t.csv=ys,t.csvFormat=ts,t.csvFormatBody=es,t.csvFormatRow=rs,t.csvFormatRows=ns,t.csvFormatValue=is,t.csvParse=Za,t.csvParseRows=Ja,t.cubehelix=Gn,t.cumsum=function(t,e){var n=0,r=0;return Float64Array.from(t,void 0===e?t=>n+=+t||0:i=>n+=+e(i,r++,t)||0)},t.curveBasis=function(t){return new Ky(t)},t.curveBasisClosed=function(t){return new Xy(t)},t.curveBasisOpen=function(t){return new Qy(t)},t.curveBundle=Jy,t.curveCardinal=n_,t.curveCardinalClosed=i_,t.curveCardinalOpen=a_,t.curveCatmullRom=c_,t.curveCatmullRomClosed=f_,t.curveCatmullRomOpen=h_,t.curveLinear=cy,t.curveLinearClosed=function(t){return new p_(t)},t.curveMonotoneX=function(t){return new y_(t)},t.curveMonotoneY=function(t){return new __(t)},t.curveNatural=function(t){return new x_(t)},t.curveStep=function(t){return new A_(t,.5)},t.curveStepAfter=function(t){return new A_(t,1)},t.curveStepBefore=function(t){return new A_(t,0)},t.descending=function(t,e){return et?1:e>=t?0:NaN},t.deviation=h,t.difference=function(t,...e){t=new Set(t);for(const n of e)for(const e of n)t.delete(e);return t},t.disjoint=function(t,e){const n=e[Symbol.iterator](),r=new Set;for(const e of t){if(r.has(e))return!1;let t,i;for(;({value:t,done:i}=n.next())&&!i;){if(Object.is(e,t))return!1;r.add(t)}}return!0},t.dispatch=ot,t.drag=function(){var t,e,n,r,i=Be,o=Pe,a=je,s=Re,l={},c=ot("start","drag","end"),u=0,f=0;function d(t){t.on("mousedown.drag",h).filter(s).on("touchstart.drag",g).on("touchmove.drag",b).on("touchend.drag touchcancel.drag",v).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(a,s){if(!r&&i.call(this,a,s)){var l=y(this,o.call(this,a,s),a,s,"mouse");l&&(Te(a.view).on("mousemove.drag",p,!0).on("mouseup.drag",m,!0),De(a.view),ke(a),n=!1,t=a.clientX,e=a.clientY,l("start",a))}}function p(r){if(Ce(r),!n){var i=r.clientX-t,o=r.clientY-e;n=i*i+o*o>f}l.mouse("drag",r)}function m(t){Te(t.view).on("mousemove.drag mouseup.drag",null),Le(t.view,n),Ce(t),l.mouse("end",t)}function g(t,e){if(i.call(this,t,e)){var n,r,a=t.changedTouches,s=o.call(this,t,e),l=a.length;for(n=0;n+t,t.easePoly=zi,t.easePolyIn=qi,t.easePolyInOut=zi,t.easePolyOut=Fi,t.easeQuad=ji,t.easeQuadIn=function(t){return t*t},t.easeQuadInOut=ji,t.easeQuadOut=function(t){return t*(2-t)},t.easeSin=Hi,t.easeSinIn=function(t){return 1==+t?1:1-Math.cos(t*Vi)},t.easeSinInOut=Hi,t.easeSinOut=function(t){return Math.sin(t*Vi)},t.every=function(t,e){if("function"!=typeof e)throw new TypeError("test is not a function");let n=-1;for(const r of t)if(!e(r,++n,t))return!1;return!0},t.extent=p,t.filter=function(t,e){if("function"!=typeof e)throw new TypeError("test is not a function");const n=[];let r=-1;for(const i of t)e(i,++r,t)&&n.push(i);return n},t.forceCenter=function(t,e){var n,r=1;function i(){var i,o,a=n.length,s=0,l=0;for(i=0;ic+p||ou+p||al.index){var m=c-s.x-s.vx,g=u-s.y-s.vy,b=m*m+g*g;bt.r&&(t.r=t[e].r)}function l(){if(e){var r,i,o=e.length;for(n=new Array(o),r=0;r[s(t,e,r),t])));for(a=0,i=new Array(c);a=s)){(t.data!==e||t.next)&&(0===f&&(p+=(f=Bs(n))*f),0===d&&(p+=(d=Bs(n))*d),p(t=(1664525*t+1013904223)%Fs)/Fs}();function f(){d(),c.call("tick",e),n1?(null==n?s.delete(t):s.set(t,p(n)),e):s.get(t)},find:function(e,n,r){var i,o,a,s,l,c=0,u=t.length;for(null==r?r=1/0:r*=r,c=0;c1?(c.on(t,n),e):c.on(t)}}},t.forceX=function(t){var e,n,r,i=Is(.1);function o(t){for(var i,o=0,a=e.length;o=.12&&i<.234&&r>=-.425&&r<-.214?s:i>=.166&&i<.234&&r>=-.214&&r<-.115?l:a).invert(t)},u.stream=function(n){return t&&e===n?t:(r=[a.stream(e=n),s.stream(n),l.stream(n)],i=r.length,t={point:function(t,e){for(var n=-1;++nRc(r[0],r[1])&&(r[1]=i[1]),Rc(i[0],r[1])>Rc(r[0],r[1])&&(r[0]=i[0])):o.push(r=i);for(a=-1/0,e=0,r=o[n=o.length-1];e<=n;r=i,++e)i=o[e],(s=Rc(r[1],i[0]))>a&&(a=s,Vl=i[0],Gl=r[1])}return Zl=Jl=null,Vl===1/0||Hl===1/0?[[NaN,NaN],[NaN,NaN]]:[[Vl,Hl],[Gl,Yl]]},t.geoCentroid=function(t){pc=mc=gc=bc=vc=yc=_c=wc=0,xc=new m,Tc=new m,Ac=new m,jl(t,zc);var e=+xc,n=+Tc,r=+Ac,i=wl(e,n,r);return i2?t[2]+90:90]):[(t=n())[0],t[1],t[2]-90]},n([0,0,90]).scale(159.155)},t.geoTransverseMercatorRaw=Nd,t.gray=function(t,e){return new Sn(t,0,0,null==e?1:e)},t.greatest=function(t,n=e){let r,i=!1;if(1===n.length){let o;for(const a of t){const t=n(a);(i?e(t,o)>0:0===e(t,t))&&(r=a,o=t,i=!0)}}else for(const e of t)(i?n(e,r)>0:0===n(e,e))&&(r=e,i=!0);return r},t.greatestIndex=function(t,n=e){if(1===n.length)return P(t,n);let r,i=-1,o=-1;for(const e of t)++o,(i<0?0===n(e,e):n(e,r)>0)&&(r=e,i=o);return i},t.group=function(t,...e){return v(t,g,g,e)},t.groups=function(t,...e){return v(t,Array.from,g,e)},t.hcl=On,t.hierarchy=Od,t.histogram=k,t.hsl=mn,t.html=As,t.image=function(t,e){return new Promise((function(n,r){var i=new Image;for(var o in e)i[o]=e[o];i.onerror=r,i.onload=function(){n(i)},i.src=t}))},t.index=function(t,...e){return v(t,g,b,e)},t.indexes=function(t,...e){return v(t,Array.from,b,e)},t.interpolate=hr,t.interpolateArray=function(t,e){return(or(e)?ir:ar)(t,e)},t.interpolateBasis=$n,t.interpolateBasisClosed=Kn,t.interpolateBlues=gv,t.interpolateBrBG=Nb,t.interpolateBuGn=Yb,t.interpolateBuPu=$b,t.interpolateCividis=function(t){return t=Math.max(0,Math.min(1,t)),"rgb("+Math.max(0,Math.min(255,Math.round(-4.54-t*(35.34-t*(2381.73-t*(6402.7-t*(7024.72-2710.57*t)))))))+", "+Math.max(0,Math.min(255,Math.round(32.49+t*(170.73+t*(52.82-t*(131.46-t*(176.58-67.37*t)))))))+", "+Math.max(0,Math.min(255,Math.round(81.24+t*(442.36-t*(2482.43-t*(6167.24-t*(6614.94-2475.67*t)))))))+")"},t.interpolateCool=kv,t.interpolateCubehelix=Dr,t.interpolateCubehelixDefault=Sv,t.interpolateCubehelixLong=Lr,t.interpolateDate=sr,t.interpolateDiscrete=function(t){var e=t.length;return function(n){return t[Math.max(0,Math.min(e-1,Math.floor(n*e)))]}},t.interpolateGnBu=Xb,t.interpolateGreens=vv,t.interpolateGreys=_v,t.interpolateHcl=Nr,t.interpolateHclLong=kr,t.interpolateHsl=Er,t.interpolateHslLong=Mr,t.interpolateHue=function(t,e){var n=Zn(+t,+e);return function(t){var e=n(t);return e-360*Math.floor(e/360)}},t.interpolateInferno=jv,t.interpolateLab=function(t,e){var n=Jn((t=Mn(t)).l,(e=Mn(e)).l),r=Jn(t.a,e.a),i=Jn(t.b,e.b),o=Jn(t.opacity,e.opacity);return function(e){return t.l=n(e),t.a=r(e),t.b=i(e),t.opacity=o(e),t+""}},t.interpolateMagma=Pv,t.interpolateNumber=lr,t.interpolateNumberArray=ir,t.interpolateObject=cr,t.interpolateOrRd=Zb,t.interpolateOranges=Mv,t.interpolatePRGn=Cb,t.interpolatePiYG=Lb,t.interpolatePlasma=Rv,t.interpolatePuBu=nv,t.interpolatePuBuGn=tv,t.interpolatePuOr=Ib,t.interpolatePuRd=iv,t.interpolatePurples=xv,t.interpolateRainbow=function(t){(t<0||t>1)&&(t-=Math.floor(t));var e=Math.abs(t-.5);return Cv.h=360*t-100,Cv.s=1.5-1.5*e,Cv.l=.8-.9*e,Cv+""},t.interpolateRdBu=Pb,t.interpolateRdGy=Rb,t.interpolateRdPu=av,t.interpolateRdYlBu=Fb,t.interpolateRdYlGn=Ub,t.interpolateReds=Av,t.interpolateRgb=tr,t.interpolateRgbBasis=nr,t.interpolateRgbBasisClosed=rr,t.interpolateRound=pr,t.interpolateSinebow=function(t){var e;return t=(.5-t)*Math.PI,Dv.r=255*(e=Math.sin(t))*e,Dv.g=255*(e=Math.sin(t+Lv))*e,Dv.b=255*(e=Math.sin(t+Ov))*e,Dv+""},t.interpolateSpectral=Hb,t.interpolateString=dr,t.interpolateTransformCss=_r,t.interpolateTransformSvg=wr,t.interpolateTurbo=function(t){return t=Math.max(0,Math.min(1,t)),"rgb("+Math.max(0,Math.min(255,Math.round(34.61+t*(1172.33-t*(10793.56-t*(33300.12-t*(38394.49-14825.05*t)))))))+", "+Math.max(0,Math.min(255,Math.round(23.31+t*(557.33+t*(1225.33-t*(3574.96-t*(1073.77+707.56*t)))))))+", "+Math.max(0,Math.min(255,Math.round(27.2+t*(3211.1-t*(15327.97-t*(27814-t*(22569.18-6838.66*t)))))))+")"},t.interpolateViridis=Bv,t.interpolateWarm=Nv,t.interpolateYlGn=uv,t.interpolateYlGnBu=lv,t.interpolateYlOrBr=dv,t.interpolateYlOrRd=pv,t.interpolateZoom=Tr,t.interrupt=oi,t.intersection=function(t,...e){t=new Set(t),e=e.map(W);t:for(const n of t)for(const r of e)if(!r.has(n)){t.delete(n);continue t}return t},t.interval=function(t,e,n){var r=new Yr,i=e;return null==e?(r.restart(t,e,n),r):(r._restart=r.restart,r.restart=function(t,e,n){e=+e,n=null==n?Hr():+n,r._restart((function o(a){a+=i,r._restart(o,i+=e,n),t(a)}),e,n)},r.restart(t,e,n),r)},t.isoFormat=ib,t.isoParse=ob,t.json=function(t,e){return fetch(t,e).then(ws)},t.lab=Mn,t.lch=function(t,e,n,r){return 1===arguments.length?Ln(t):new In(n,e,t,null==r?1:r)},t.least=function(t,n=e){let r,i=!1;if(1===n.length){let o;for(const a of t){const t=n(a);(i?e(t,o)<0:0===e(t,t))&&(r=a,o=t,i=!0)}}else for(const e of t)(i?n(e,r)<0:0===n(e,e))&&(r=e,i=!0);return r},t.leastIndex=U,t.line=dy,t.lineRadial=_y,t.linkHorizontal=function(){return Ey(My)},t.linkRadial=function(){var t=Ey(Ny);return t.angle=t.x,delete t.x,t.radius=t.y,delete t.y,t},t.linkVertical=function(){return Ey(Sy)},t.local=Ee,t.map=function(t,e){if("function"!=typeof t[Symbol.iterator])throw new TypeError("values is not iterable");if("function"!=typeof e)throw new TypeError("mapper is not a function");return Array.from(t,((n,r)=>e(n,r,t)))},t.matcher=wt,t.max=C,t.maxIndex=P,t.mean=function(t,e){let n=0,r=0;if(void 0===e)for(let e of t)null!=e&&(e=+e)>=e&&(++n,r+=e);else{let i=-1;for(let o of t)null!=(o=e(o,++i,t))&&(o=+o)>=o&&(++n,r+=o)}if(n)return r/n},t.median=function(t,e){return I(t,.5,e)},t.merge=j,t.min=D,t.minIndex=R,t.namespace=dt,t.namespaces=ft,t.nice=S,t.now=Hr,t.pack=function(){var t=null,e=1,n=1,r=th;function i(i){return i.x=e/2,i.y=n/2,t?i.eachBefore(rh(t)).eachAfter(ih(r,.5)).eachBefore(oh(1)):i.eachBefore(rh(nh)).eachAfter(ih(th,1)).eachAfter(ih(r,i.r/Math.min(e,n))).eachBefore(oh(Math.min(e,n)/(2*i.r))),i}return i.radius=function(e){return arguments.length?(t=Zd(e),i):t},i.size=function(t){return arguments.length?(e=+t[0],n=+t[1],i):[e,n]},i.padding=function(t){return arguments.length?(r="function"==typeof t?t:eh(+t),i):r},i},t.packEnclose=qd,t.packSiblings=function(t){return Qd(t),t},t.pairs=function(t,e=q){const n=[];let r,i=!1;for(const o of t)i&&n.push(e(r,o)),r=o,i=!0;return n},t.partition=function(){var t=1,e=1,n=0,r=!1;function i(i){var o=i.height+1;return i.x0=i.y0=n,i.x1=t,i.y1=e/o,i.eachBefore(function(t,e){return function(r){r.children&&sh(r,r.x0,t*(r.depth+1)/e,r.x1,t*(r.depth+2)/e);var i=r.x0,o=r.y0,a=r.x1-n,s=r.y1-n;a0&&(h+=f);for(null!=e?p.sort((function(t,n){return e(m[t],m[n])})):null!=n&&p.sort((function(t,e){return n(a[t],a[e])})),s=0,c=h?(b-d*y)/h:0;s0?f*c:0)+y,m[l]={data:a[l],index:s,value:f,startAngle:g,endAngle:u,padAngle:v};return m}return a.value=function(e){return arguments.length?(t="function"==typeof e?e:qv(+e),a):t},a.sortValues=function(t){return arguments.length?(e=t,n=null,a):e},a.sort=function(t){return arguments.length?(n=t,e=null,a):n},a.startAngle=function(t){return arguments.length?(r="function"==typeof t?t:qv(+t),a):r},a.endAngle=function(t){return arguments.length?(i="function"==typeof t?t:qv(+t),a):i},a.padAngle=function(t){return arguments.length?(o="function"==typeof t?t:qv(+t),a):o},a},t.piecewise=Or,t.pointRadial=xy,t.pointer=Ne,t.pointers=function(t,e){return t.target&&(t=Se(t),void 0===e&&(e=t.currentTarget),t=t.touches||[t]),Array.from(t,(t=>Ne(t,e)))},t.polygonArea=function(t){for(var e,n=-1,r=t.length,i=t[r-1],o=0;++ns!=c>s&&a<(l-n)*(s-r)/(c-r)+n&&(u=!u),l=n,c=r;return u},t.polygonHull=function(t){if((n=t.length)<3)return null;var e,n,r=new Array(n),i=new Array(n);for(e=0;e=0;--e)c.push(t[r[o[e]][2]]);for(e=+s;e(e=1664525*e+1013904223|0,Hh*(e>>>0))},t.randomLogNormal=Ch,t.randomLogistic=Uh,t.randomNormal=kh,t.randomPareto=Ih,t.randomPoisson=Vh,t.randomUniform=Sh,t.randomWeibull=Fh,t.range=z,t.reduce=function(t,e,n){if("function"!=typeof e)throw new TypeError("reducer is not a function");const r=t[Symbol.iterator]();let i,o,a=-1;if(arguments.length<3){if(({done:i,value:n}=r.next()),i)return;++a}for(;({done:i,value:o}=r.next()),!i;)n=e(n,o,++a,t);return n},t.reverse=function(t){if("function"!=typeof t[Symbol.iterator])throw new TypeError("values is not iterable");return Array.from(t).reverse()},t.rgb=ln,t.ribbon=function(){return la()},t.ribbonArrow=function(){return la(sa)},t.rollup=function(t,e,...n){return v(t,g,e,n)},t.rollups=function(t,e,...n){return v(t,Array.from,e,n)},t.scaleBand=Kh,t.scaleDiverging=function t(){var e=sp(hb()(Jh));return e.copy=function(){return fb(e,t())},Yh.apply(e,arguments)},t.scaleDivergingLog=function t(){var e=mp(hb()).domain([.1,1,10]);return e.copy=function(){return fb(e,t()).base(e.base())},Yh.apply(e,arguments)},t.scaleDivergingPow=pb,t.scaleDivergingSqrt=function(){return pb.apply(null,arguments).exponent(.5)},t.scaleDivergingSymlog=function t(){var e=vp(hb());return e.copy=function(){return fb(e,t()).constant(e.constant())},Yh.apply(e,arguments)},t.scaleIdentity=function t(e){var n;function r(t){return isNaN(t=+t)?n:t}return r.invert=r,r.domain=r.range=function(t){return arguments.length?(e=Array.from(t,Qh),r):e.slice()},r.unknown=function(t){return arguments.length?(n=t,r):n},r.copy=function(){return t(e).unknown(n)},e=arguments.length?Array.from(e,Qh):[0,1],sp(r)},t.scaleImplicit=Wh,t.scaleLinear=function t(){var e=op();return e.copy=function(){return rp(e,t())},Gh.apply(e,arguments),sp(e)},t.scaleLog=function t(){var e=mp(ip()).domain([1,10]);return e.copy=function(){return rp(e,t()).base(e.base())},Gh.apply(e,arguments),e},t.scaleOrdinal=$h,t.scalePoint=function(){return Xh(Kh.apply(null,arguments).paddingInner(1))},t.scalePow=Tp,t.scaleQuantile=function t(){var n,r=[],i=[],a=[];function s(){var t=0,e=Math.max(1,i.length);for(a=new Array(e-1);++t0?a[e-1]:r[0],e=i?[a[i-1],r]:[a[e-1],a[e]]},l.unknown=function(t){return arguments.length?(e=t,l):l},l.thresholds=function(){return a.slice()},l.copy=function(){return t().domain([n,r]).range(s).unknown(e)},Gh.apply(sp(l),arguments)},t.scaleRadial=function t(){var e,n=op(),r=[0,1],i=!1;function o(t){var r=Ep(n(t));return isNaN(r)?e:i?Math.round(r):r}return o.invert=function(t){return n.invert(Ap(t))},o.domain=function(t){return arguments.length?(n.domain(t),o):n.domain()},o.range=function(t){return arguments.length?(n.range((r=Array.from(t,Qh)).map(Ap)),o):r.slice()},o.rangeRound=function(t){return o.range(t).round(!0)},o.round=function(t){return arguments.length?(i=!!t,o):i},o.clamp=function(t){return arguments.length?(n.clamp(t),o):n.clamp()},o.unknown=function(t){return arguments.length?(e=t,o):e},o.copy=function(){return t(n.domain(),r).round(i).clamp(n.clamp()).unknown(e)},Gh.apply(o,arguments),sp(o)},t.scaleSequential=function t(){var e=sp(ub()(Jh));return e.copy=function(){return fb(e,t())},Yh.apply(e,arguments)},t.scaleSequentialLog=function t(){var e=mp(ub()).domain([1,10]);return e.copy=function(){return fb(e,t()).base(e.base())},Yh.apply(e,arguments)},t.scaleSequentialPow=db,t.scaleSequentialQuantile=function t(){var n=[],r=Jh;function i(t){if(!isNaN(t=+t))return r((o(n,t,1)-1)/(n.length-1))}return i.domain=function(t){if(!arguments.length)return n.slice();n=[];for(let e of t)null==e||isNaN(e=+e)||n.push(e);return n.sort(e),i},i.interpolator=function(t){return arguments.length?(r=t,i):r},i.range=function(){return n.map(((t,e)=>r(e/(n.length-1))))},i.quantiles=function(t){return Array.from({length:t+1},((e,r)=>I(n,r/t)))},i.copy=function(){return t(r).domain(n)},Yh.apply(i,arguments)},t.scaleSequentialSqrt=function(){return db.apply(null,arguments).exponent(.5)},t.scaleSequentialSymlog=function t(){var e=vp(ub());return e.copy=function(){return fb(e,t()).constant(e.constant())},Yh.apply(e,arguments)},t.scaleSqrt=function(){return Tp.apply(null,arguments).exponent(.5)},t.scaleSymlog=function t(){var e=vp(ip());return e.copy=function(){return rp(e,t()).constant(e.constant())},Gh.apply(e,arguments)},t.scaleThreshold=function t(){var e,n=[.5],r=[0,1],i=1;function a(t){return t<=t?r[o(n,t,0,i)]:e}return a.domain=function(t){return arguments.length?(n=Array.from(t),i=Math.min(n.length,r.length-1),a):n.slice()},a.range=function(t){return arguments.length?(r=Array.from(t),i=Math.min(n.length,r.length-1),a):r.slice()},a.invertExtent=function(t){var e=r.indexOf(t);return[n[e-1],n[e]]},a.unknown=function(t){return arguments.length?(e=t,a):e},a.copy=function(){return t().domain(n).range(r).unknown(e)},Gh.apply(a,arguments)},t.scaleTime=function(){return Gh.apply(cb(sm,om,Gp,Up,Fp,Rp,Pp,kp,t.timeFormat).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)},t.scaleUtc=function(){return Gh.apply(cb(Lm,Cm,gm,hm,fm,cm,Pp,kp,t.utcFormat).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)},t.scan=function(t,e){const n=U(t,e);return n<0?void 0:n},t.schemeAccent=bb,t.schemeBlues=mv,t.schemeBrBG=Sb,t.schemeBuGn=Gb,t.schemeBuPu=Wb,t.schemeCategory10=gb,t.schemeDark2=vb,t.schemeGnBu=Kb,t.schemeGreens=bv,t.schemeGreys=yv,t.schemeOrRd=Qb,t.schemeOranges=Ev,t.schemePRGn=kb,t.schemePaired=yb,t.schemePastel1=_b,t.schemePastel2=wb,t.schemePiYG=Db,t.schemePuBu=ev,t.schemePuBuGn=Jb,t.schemePuOr=Ob,t.schemePuRd=rv,t.schemePurples=wv,t.schemeRdBu=Bb,t.schemeRdGy=jb,t.schemeRdPu=ov,t.schemeRdYlBu=qb,t.schemeRdYlGn=zb,t.schemeReds=Tv,t.schemeSet1=xb,t.schemeSet2=Tb,t.schemeSet3=Ab,t.schemeSpectral=Vb,t.schemeTableau10=Eb,t.schemeYlGn=cv,t.schemeYlGnBu=sv,t.schemeYlOrBr=fv,t.schemeYlOrRd=hv,t.select=Te,t.selectAll=function(t){return"string"==typeof t?new we([document.querySelectorAll(t)],[document.documentElement]):new we([null==t?[]:vt(t)],_e)},t.selection=xe,t.selector=bt,t.selectorAll=_t,t.shuffle=V,t.shuffler=H,t.some=function(t,e){if("function"!=typeof e)throw new TypeError("test is not a function");let n=-1;for(const r of t)if(e(r,++n,t))return!0;return!1},t.sort=function(t,n=e){if("function"!=typeof t[Symbol.iterator])throw new TypeError("values is not iterable");return t=Array.from(t),1===n.length?(n=t.map(n),F(t,t.map(((t,e)=>e)).sort(((t,r)=>e(n[t],n[r]))))):t.sort(n)},t.stack=function(){var t=qv([]),e=M_,n=E_,r=S_;function i(i){var o,a,s=Array.from(t.apply(this,arguments),N_),l=s.length,c=-1;for(const t of i)for(o=0,++c;o0)for(var n,r,i,o,a,s,l=0,c=t[e[0]].length;l0?(r[0]=o,r[1]=o+=i):i<0?(r[1]=a,r[0]=a+=i):(r[0]=0,r[1]=i)},t.stackOffsetExpand=function(t,e){if((r=t.length)>0){for(var n,r,i,o=0,a=t[0].length;o0){for(var n,r=0,i=t[e[0]],o=i.length;r0&&(r=(n=t[e[0]]).length)>0){for(var n,r,i,o=0,a=1;a0)throw new Error("cycle");return o}return n.id=function(e){return arguments.length?(t=Jd(e),n):t},n.parentId=function(t){return arguments.length?(e=Jd(t),n):e},n},t.style=Ht,t.subset=function(t,e){return $(e,t)},t.sum=function(t,e){let n=0;if(void 0===e)for(let e of t)(e=+e)&&(n+=e);else{let r=-1;for(let i of t)(i=+e(i,++r,t))&&(n+=i)}return n},t.superset=$,t.svg=Es,t.symbol=function(t,e){var n=null;function r(){var r;if(n||(n=r=Zo()),t.apply(this,arguments).draw(n,+e.apply(this,arguments)),r)return n=null,r+""||null}return t="function"==typeof t?t:qv(t||ky),e="function"==typeof e?e:qv(void 0===e?64:+e),r.type=function(e){return arguments.length?(t="function"==typeof e?e:qv(e),r):t},r.size=function(t){return arguments.length?(e="function"==typeof t?t:qv(+t),r):e},r.context=function(t){return arguments.length?(n=null==t?null:t,r):n},r},t.symbolCircle=ky,t.symbolCross=Cy,t.symbolDiamond=Oy,t.symbolSquare=Ry,t.symbolStar=jy,t.symbolTriangle=Fy,t.symbolWye=Gy,t.symbols=Yy,t.text=bs,t.thresholdFreedmanDiaconis=function(t,e,n){return Math.ceil((n-e)/(2*(I(t,.75)-I(t,.25))*Math.pow(l(t),-1/3)))},t.thresholdScott=function(t,e,n){return Math.ceil((n-e)/(3.5*h(t)*Math.pow(l(t),-1/3)))},t.thresholdSturges=N,t.tickFormat=ap,t.tickIncrement=E,t.tickStep=M,t.ticks=A,t.timeDay=Up,t.timeDays=Vp,t.timeFormatDefaultLocale=nb,t.timeFormatLocale=jm,t.timeFriday=Xp,t.timeFridays=rm,t.timeHour=Fp,t.timeHours=zp,t.timeInterval=Np,t.timeMillisecond=kp,t.timeMilliseconds=Cp,t.timeMinute=Rp,t.timeMinutes=qp,t.timeMonday=Yp,t.timeMondays=Jp,t.timeMonth=om,t.timeMonths=am,t.timeSaturday=Qp,t.timeSaturdays=im,t.timeSecond=Pp,t.timeSeconds=jp,t.timeSunday=Gp,t.timeSundays=Zp,t.timeThursday=Kp,t.timeThursdays=nm,t.timeTuesday=Wp,t.timeTuesdays=tm,t.timeWednesday=$p,t.timeWednesdays=em,t.timeWeek=Gp,t.timeWeeks=Zp,t.timeYear=sm,t.timeYears=lm,t.timeout=Zr,t.timer=Wr,t.timerFlush=$r,t.transition=Ii,t.transpose=G,t.tree=function(){var t=dh,e=1,n=1,r=null;function i(i){var l=function(t){for(var e,n,r,i,o,a=new bh(t,0),s=[a];e=s.pop();)if(r=e._.children)for(e.children=new Array(o=r.length),i=o-1;i>=0;--i)s.push(n=e.children[i]=new bh(r[i],i)),n.parent=e;return(a.parent=new bh(null,0)).children=[a],a}(i);if(l.eachAfter(o),l.parent.m=-l.z,l.eachBefore(a),r)i.eachBefore(s);else{var c=i,u=i,f=i;i.eachBefore((function(t){t.xu.x&&(u=t),t.depth>f.depth&&(f=t)}));var d=c===u?1:t(c,u)/2,h=d-c.x,p=e/(u.x+d+h),m=n/(f.depth||1);i.eachBefore((function(t){t.x=(t.x+h)*p,t.y=t.depth*m}))}return i}function o(e){var n=e.children,r=e.parent.children,i=e.i?r[e.i-1]:null;if(n){!function(t){for(var e,n=0,r=0,i=t.children,o=i.length;--o>=0;)(e=i[o]).z+=n,e.m+=n,n+=e.s+(r+=e.c)}(e);var o=(n[0].z+n[n.length-1].z)/2;i?(e.z=i.z+t(e._,i._),e.m=e.z-o):e.z=o}else i&&(e.z=i.z+t(e._,i._));e.parent.A=function(e,n,r){if(n){for(var i,o=e,a=e,s=n,l=o.parent.children[0],c=o.m,u=a.m,f=s.m,d=l.m;s=ph(s),o=hh(o),s&&o;)l=hh(l),(a=ph(a)).a=e,(i=s.z+f-o.z-c+t(s._,o._))>0&&(mh(gh(s,e,r),e,i),c+=i,u+=i),f+=s.m,c+=o.m,d+=l.m,u+=a.m;s&&!ph(a)&&(a.t=s,a.m+=f-u),o&&!hh(l)&&(l.t=o,l.m+=c-d,r=e)}return r}(e,i,e.parent.A||r[0])}function a(t){t._.x=t.z+t.parent.m,t.m+=t.parent.m}function s(t){t.x*=e,t.y=t.depth*n}return i.separation=function(e){return arguments.length?(t=e,i):t},i.size=function(t){return arguments.length?(r=!1,e=+t[0],n=+t[1],i):r?null:[e,n]},i.nodeSize=function(t){return arguments.length?(r=!0,e=+t[0],n=+t[1],i):r?[e,n]:null},i},t.treemap=function(){var t=wh,e=!1,n=1,r=1,i=[0],o=th,a=th,s=th,l=th,c=th;function u(t){return t.x0=t.y0=0,t.x1=n,t.y1=r,t.eachBefore(f),i=[0],e&&t.eachBefore(ah),t}function f(e){var n=i[e.depth],r=e.x0+n,u=e.y0+n,f=e.x1-n,d=e.y1-n;f=n-1){var u=s[e];return u.x0=i,u.y0=o,u.x1=a,void(u.y1=l)}for(var f=c[e],d=r/2+f,h=e+1,p=n-1;h>>1;c[m]l-o){var v=r?(i*b+a*g)/r:a;t(e,h,g,i,o,v,l),t(h,n,b,v,o,a,l)}else{var y=r?(o*b+l*g)/r:l;t(e,h,g,i,o,a,y),t(h,n,b,i,y,a,l)}}(0,l,t.value,e,n,r,i)},t.treemapDice=sh,t.treemapResquarify=xh,t.treemapSlice=vh,t.treemapSliceDice=function(t,e,n,r,i){(1&t.depth?vh:sh)(t,e,n,r,i)},t.treemapSquarify=wh,t.tsv=_s,t.tsvFormat=ls,t.tsvFormatBody=cs,t.tsvFormatRow=fs,t.tsvFormatRows=us,t.tsvFormatValue=ds,t.tsvParse=as,t.tsvParseRows=ss,t.union=function(...t){const e=new Set;for(const n of t)for(const t of n)e.add(t);return e},t.utcDay=hm,t.utcDays=pm,t.utcFriday=wm,t.utcFridays=Nm,t.utcHour=fm,t.utcHours=dm,t.utcMillisecond=kp,t.utcMilliseconds=Cp,t.utcMinute=cm,t.utcMinutes=um,t.utcMonday=bm,t.utcMondays=Am,t.utcMonth=Cm,t.utcMonths=Dm,t.utcSaturday=xm,t.utcSaturdays=km,t.utcSecond=Pp,t.utcSeconds=jp,t.utcSunday=gm,t.utcSundays=Tm,t.utcThursday=_m,t.utcThursdays=Sm,t.utcTuesday=vm,t.utcTuesdays=Em,t.utcWednesday=ym,t.utcWednesdays=Mm,t.utcWeek=gm,t.utcWeeks=Tm,t.utcYear=Lm,t.utcYears=Om,t.variance=d,t.version="6.3.0",t.window=Ft,t.xml=Ts,t.zip=function(){return G(arguments)},t.zoom=function(){var t,e,n,r=F_,i=z_,o=G_,a=V_,s=H_,l=[0,1/0],c=[[-1/0,-1/0],[1/0,1/0]],u=250,f=Tr,d=ot("start","zoom","end"),h=500,p=0,m=10;function g(t){t.property("__zoom",U_).on("wheel.zoom",T).on("mousedown.zoom",A).on("dblclick.zoom",E).filter(s).on("touchstart.zoom",M).on("touchmove.zoom",S).on("touchend.zoom touchcancel.zoom",N).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function b(t,e){return(e=Math.max(l[0],Math.min(l[1],e)))===t.k?t:new B_(e,t.x,t.y)}function v(t,e,n){var r=e[0]-n[0]*t.k,i=e[1]-n[1]*t.k;return r===t.x&&i===t.y?t:new B_(t.k,r,i)}function y(t){return[(+t[0][0]+ +t[1][0])/2,(+t[0][1]+ +t[1][1])/2]}function _(t,e,n,r){t.on("start.zoom",(function(){w(this,arguments).event(r).start()})).on("interrupt.zoom end.zoom",(function(){w(this,arguments).event(r).end()})).tween("zoom",(function(){var t=this,o=arguments,a=w(t,o).event(r),s=i.apply(t,o),l=null==n?y(s):"function"==typeof n?n.apply(t,o):n,c=Math.max(s[1][0]-s[0][0],s[1][1]-s[0][1]),u=t.__zoom,d="function"==typeof e?e.apply(t,o):e,h=f(u.invert(l).concat(c/u.k),d.invert(l).concat(c/d.k));return function(t){if(1===t)t=d;else{var e=h(t),n=c/e[2];t=new B_(n,l[0]-e[0]*n,l[1]-e[1]*n)}a.zoom(null,t)}}))}function w(t,e,n){return!n&&t.__zooming||new x(t,e)}function x(t,e){this.that=t,this.args=e,this.active=0,this.sourceEvent=null,this.extent=i.apply(t,e),this.taps=0}function T(t,...e){if(r.apply(this,arguments)){var n=w(this,e).event(t),i=this.__zoom,s=Math.max(l[0],Math.min(l[1],i.k*Math.pow(2,a.apply(this,arguments)))),u=Ne(t);if(n.wheel)n.mouse[0][0]===u[0]&&n.mouse[0][1]===u[1]||(n.mouse[1]=i.invert(n.mouse[0]=u)),clearTimeout(n.wheel);else{if(i.k===s)return;n.mouse=[u,i.invert(u)],oi(this),n.start()}q_(t),n.wheel=setTimeout(f,150),n.zoom("mouse",o(v(b(i,s),n.mouse[0],n.mouse[1]),n.extent,c))}function f(){n.wheel=null,n.end()}}function A(t,...e){if(!n&&r.apply(this,arguments)){var i=w(this,e,!0).event(t),a=Te(t.view).on("mousemove.zoom",d,!0).on("mouseup.zoom",h,!0),s=Ne(t,l),l=t.currentTarget,u=t.clientX,f=t.clientY;De(t.view),R_(t),i.mouse=[s,this.__zoom.invert(s)],oi(this),i.start()}function d(t){if(q_(t),!i.moved){var e=t.clientX-u,n=t.clientY-f;i.moved=e*e+n*n>p}i.event(t).zoom("mouse",o(v(i.that.__zoom,i.mouse[0]=Ne(t,l),i.mouse[1]),i.extent,c))}function h(t){a.on("mousemove.zoom mouseup.zoom",null),Le(t.view,i.moved),q_(t),i.event(t).end()}}function E(t,...e){if(r.apply(this,arguments)){var n=this.__zoom,a=Ne(t.changedTouches?t.changedTouches[0]:t,this),s=n.invert(a),l=n.k*(t.shiftKey?.5:2),f=o(v(b(n,l),a,s),i.apply(this,e),c);q_(t),u>0?Te(this).transition().duration(u).call(_,f,a,t):Te(this).call(g.transform,f,a,t)}}function M(n,...i){if(r.apply(this,arguments)){var o,a,s,l,c=n.touches,u=c.length,f=w(this,i,n.changedTouches.length===u).event(n);for(R_(n),a=0;a{do{t+=Math.floor(1e6*Math.random())}while(document.getElementById(t));return t},e=t=>{let e=t.getAttribute("data-bs-target");if(!e||"#"===e){let n=t.getAttribute("href");if(!n||!n.includes("#")&&!n.startsWith("."))return null;n.includes("#")&&!n.startsWith("#")&&(n="#"+n.split("#")[1]),e=n&&"#"!==n?n.trim():null}return e},n=t=>{const n=e(t);return n&&document.querySelector(n)?n:null},r=t=>{const n=e(t);return n?document.querySelector(n):null},i=t=>{if(!t)return 0;let{transitionDuration:e,transitionDelay:n}=window.getComputedStyle(t);const r=Number.parseFloat(e),i=Number.parseFloat(n);return r||i?(e=e.split(",")[0],n=n.split(",")[0],1e3*(Number.parseFloat(e)+Number.parseFloat(n))):0},o=t=>{t.dispatchEvent(new Event("transitionend"))},a=t=>(t[0]||t).nodeType,s=(t,e)=>{let n=!1;const r=e+5;t.addEventListener("transitionend",(function e(){n=!0,t.removeEventListener("transitionend",e)})),setTimeout((()=>{n||o(t)}),r)},l=(t,e,n)=>{Object.keys(n).forEach((r=>{const i=n[r],o=e[r],s=o&&a(o)?"element":null==(l=o)?""+l:{}.toString.call(l).match(/\s([a-z]+)/i)[1].toLowerCase();var l;if(!new RegExp(i).test(s))throw new TypeError(t.toUpperCase()+": "+`Option "${r}" provided type "${s}" `+`but expected type "${i}".`)}))},c=t=>{if(!t)return!1;if(t.style&&t.parentNode&&t.parentNode.style){const e=getComputedStyle(t),n=getComputedStyle(t.parentNode);return"none"!==e.display&&"none"!==n.display&&"hidden"!==e.visibility}return!1},u=t=>!t||t.nodeType!==Node.ELEMENT_NODE||!!t.classList.contains("disabled")||(void 0!==t.disabled?t.disabled:t.hasAttribute("disabled")&&"false"!==t.getAttribute("disabled")),f=t=>{if(!document.documentElement.attachShadow)return null;if("function"==typeof t.getRootNode){const e=t.getRootNode();return e instanceof ShadowRoot?e:null}return t instanceof ShadowRoot?t:t.parentNode?f(t.parentNode):null},d=()=>function(){},h=t=>t.offsetHeight,p=()=>{const{jQuery:t}=window;return t&&!document.body.hasAttribute("data-bs-no-jquery")?t:null},m=()=>"rtl"===document.documentElement.dir,g=(t,e)=>{var n;n=()=>{const n=p();if(n){const r=n.fn[t];n.fn[t]=e.jQueryInterface,n.fn[t].Constructor=e,n.fn[t].noConflict=()=>(n.fn[t]=r,e.jQueryInterface)}},"loading"===document.readyState?document.addEventListener("DOMContentLoaded",n):n()},b=new Map;var v={set(t,e,n){b.has(t)||b.set(t,new Map);const r=b.get(t);r.has(e)||0===r.size?r.set(e,n):console.error(`Bootstrap doesn't allow more than one instance per element. Bound instance: ${Array.from(r.keys())[0]}.`)},get:(t,e)=>b.has(t)&&b.get(t).get(e)||null,remove(t,e){if(!b.has(t))return;const n=b.get(t);n.delete(e),0===n.size&&b.delete(t)}};const y=/[^.]*(?=\..*)\.|.*/,_=/\..*/,w=/::\d+$/,x={};let T=1;const A={mouseenter:"mouseover",mouseleave:"mouseout"},E=new Set(["click","dblclick","mouseup","mousedown","contextmenu","mousewheel","DOMMouseScroll","mouseover","mouseout","mousemove","selectstart","selectend","keydown","keypress","keyup","orientationchange","touchstart","touchmove","touchend","touchcancel","pointerdown","pointermove","pointerup","pointerleave","pointercancel","gesturestart","gesturechange","gestureend","focus","blur","change","reset","select","submit","focusin","focusout","load","unload","beforeunload","resize","move","DOMContentLoaded","readystatechange","error","abort","scroll"]);function M(t,e){return e&&`${e}::${T++}`||t.uidEvent||T++}function S(t){const e=M(t);return t.uidEvent=e,x[e]=x[e]||{},x[e]}function N(t,e,n=null){const r=Object.keys(t);for(let i=0,o=r.length;i{!function(t,e,n,r){const i=e[n]||{};Object.keys(i).forEach((o=>{if(o.includes(r)){const r=i[o];D(t,e,n,r.originalHandler,r.delegationSelector)}}))}(t,l,n,e.slice(1))}));const u=l[a]||{};Object.keys(u).forEach((n=>{const r=n.replace(w,"");if(!s||e.includes(r)){const e=u[n];D(t,l,a,e.originalHandler,e.delegationSelector)}}))},trigger(t,e,n){if("string"!=typeof e||!t)return null;const r=p(),i=e.replace(_,""),o=e!==i,a=E.has(i);let s,l=!0,c=!0,u=!1,f=null;return o&&r&&(s=r.Event(e,n),r(t).trigger(s),l=!s.isPropagationStopped(),c=!s.isImmediatePropagationStopped(),u=s.isDefaultPrevented()),a?(f=document.createEvent("HTMLEvents"),f.initEvent(i,l,!0)):f=new CustomEvent(e,{bubbles:l,cancelable:!0}),void 0!==n&&Object.keys(n).forEach((t=>{Object.defineProperty(f,t,{get:()=>n[t]})})),u&&f.preventDefault(),c&&t.dispatchEvent(f),f.defaultPrevented&&void 0!==s&&s.preventDefault(),f}};class O{constructor(t){(t="string"==typeof t?document.querySelector(t):t)&&(this._element=t,v.set(this._element,this.constructor.DATA_KEY,this))}dispose(){v.remove(this._element,this.constructor.DATA_KEY),this._element=null}static getInstance(t){return v.get(t,this.DATA_KEY)}static get VERSION(){return"5.0.0-beta3"}}class I extends O{static get DATA_KEY(){return"bs.alert"}close(t){const e=t?this._getRootElement(t):this._element,n=this._triggerCloseEvent(e);null===n||n.defaultPrevented||this._removeElement(e)}_getRootElement(t){return r(t)||t.closest(".alert")}_triggerCloseEvent(t){return L.trigger(t,"close.bs.alert")}_removeElement(t){if(t.classList.remove("show"),!t.classList.contains("fade"))return void this._destroyElement(t);const e=i(t);L.one(t,"transitionend",(()=>this._destroyElement(t))),s(t,e)}_destroyElement(t){t.parentNode&&t.parentNode.removeChild(t),L.trigger(t,"closed.bs.alert")}static jQueryInterface(t){return this.each((function(){let e=v.get(this,"bs.alert");e||(e=new I(this)),"close"===t&&e[t](this)}))}static handleDismiss(t){return function(e){e&&e.preventDefault(),t.close(this)}}}L.on(document,"click.bs.alert.data-api",'[data-bs-dismiss="alert"]',I.handleDismiss(new I)),g("alert",I);class B extends O{static get DATA_KEY(){return"bs.button"}toggle(){this._element.setAttribute("aria-pressed",this._element.classList.toggle("active"))}static jQueryInterface(t){return this.each((function(){let e=v.get(this,"bs.button");e||(e=new B(this)),"toggle"===t&&e[t]()}))}}function P(t){return"true"===t||"false"!==t&&(t===Number(t).toString()?Number(t):""===t||"null"===t?null:t)}function j(t){return t.replace(/[A-Z]/g,(t=>"-"+t.toLowerCase()))}L.on(document,"click.bs.button.data-api",'[data-bs-toggle="button"]',(t=>{t.preventDefault();const e=t.target.closest('[data-bs-toggle="button"]');let n=v.get(e,"bs.button");n||(n=new B(e)),n.toggle()})),g("button",B);const R={setDataAttribute(t,e,n){t.setAttribute("data-bs-"+j(e),n)},removeDataAttribute(t,e){t.removeAttribute("data-bs-"+j(e))},getDataAttributes(t){if(!t)return{};const e={};return Object.keys(t.dataset).filter((t=>t.startsWith("bs"))).forEach((n=>{let r=n.replace(/^bs/,"");r=r.charAt(0).toLowerCase()+r.slice(1,r.length),e[r]=P(t.dataset[n])})),e},getDataAttribute:(t,e)=>P(t.getAttribute("data-bs-"+j(e))),offset(t){const e=t.getBoundingClientRect();return{top:e.top+document.body.scrollTop,left:e.left+document.body.scrollLeft}},position:t=>({top:t.offsetTop,left:t.offsetLeft})},q={find:(t,e=document.documentElement)=>[].concat(...Element.prototype.querySelectorAll.call(e,t)),findOne:(t,e=document.documentElement)=>Element.prototype.querySelector.call(e,t),children:(t,e)=>[].concat(...t.children).filter((t=>t.matches(e))),parents(t,e){const n=[];let r=t.parentNode;for(;r&&r.nodeType===Node.ELEMENT_NODE&&3!==r.nodeType;)r.matches(e)&&n.push(r),r=r.parentNode;return n},prev(t,e){let n=t.previousElementSibling;for(;n;){if(n.matches(e))return[n];n=n.previousElementSibling}return[]},next(t,e){let n=t.nextElementSibling;for(;n;){if(n.matches(e))return[n];n=n.nextElementSibling}return[]}},F={interval:5e3,keyboard:!0,slide:!1,pause:"hover",wrap:!0,touch:!0},z={interval:"(number|boolean)",keyboard:"boolean",slide:"(boolean|string)",pause:"(string|boolean)",wrap:"boolean",touch:"boolean"},U="next",V="prev",H="left",G="right";class Y extends O{constructor(t,e){super(t),this._items=null,this._interval=null,this._activeElement=null,this._isPaused=!1,this._isSliding=!1,this.touchTimeout=null,this.touchStartX=0,this.touchDeltaX=0,this._config=this._getConfig(e),this._indicatorsElement=q.findOne(".carousel-indicators",this._element),this._touchSupported="ontouchstart"in document.documentElement||navigator.maxTouchPoints>0,this._pointerEvent=Boolean(window.PointerEvent),this._addEventListeners()}static get Default(){return F}static get DATA_KEY(){return"bs.carousel"}next(){this._isSliding||this._slide(U)}nextWhenVisible(){!document.hidden&&c(this._element)&&this.next()}prev(){this._isSliding||this._slide(V)}pause(t){t||(this._isPaused=!0),q.findOne(".carousel-item-next, .carousel-item-prev",this._element)&&(o(this._element),this.cycle(!0)),clearInterval(this._interval),this._interval=null}cycle(t){t||(this._isPaused=!1),this._interval&&(clearInterval(this._interval),this._interval=null),this._config&&this._config.interval&&!this._isPaused&&(this._updateInterval(),this._interval=setInterval((document.visibilityState?this.nextWhenVisible:this.next).bind(this),this._config.interval))}to(t){this._activeElement=q.findOne(".active.carousel-item",this._element);const e=this._getItemIndex(this._activeElement);if(t>this._items.length-1||t<0)return;if(this._isSliding)return void L.one(this._element,"slid.bs.carousel",(()=>this.to(t)));if(e===t)return this.pause(),void this.cycle();const n=t>e?U:V;this._slide(n,this._items[t])}dispose(){L.off(this._element,".bs.carousel"),this._items=null,this._config=null,this._interval=null,this._isPaused=null,this._isSliding=null,this._activeElement=null,this._indicatorsElement=null,super.dispose()}_getConfig(t){return t={...F,...t},l("carousel",t,z),t}_handleSwipe(){const t=Math.abs(this.touchDeltaX);if(t<=40)return;const e=t/this.touchDeltaX;this.touchDeltaX=0,e&&this._slide(e>0?G:H)}_addEventListeners(){this._config.keyboard&&L.on(this._element,"keydown.bs.carousel",(t=>this._keydown(t))),"hover"===this._config.pause&&(L.on(this._element,"mouseenter.bs.carousel",(t=>this.pause(t))),L.on(this._element,"mouseleave.bs.carousel",(t=>this.cycle(t)))),this._config.touch&&this._touchSupported&&this._addTouchEventListeners()}_addTouchEventListeners(){const t=t=>{!this._pointerEvent||"pen"!==t.pointerType&&"touch"!==t.pointerType?this._pointerEvent||(this.touchStartX=t.touches[0].clientX):this.touchStartX=t.clientX},e=t=>{this.touchDeltaX=t.touches&&t.touches.length>1?0:t.touches[0].clientX-this.touchStartX},n=t=>{!this._pointerEvent||"pen"!==t.pointerType&&"touch"!==t.pointerType||(this.touchDeltaX=t.clientX-this.touchStartX),this._handleSwipe(),"hover"===this._config.pause&&(this.pause(),this.touchTimeout&&clearTimeout(this.touchTimeout),this.touchTimeout=setTimeout((t=>this.cycle(t)),500+this._config.interval))};q.find(".carousel-item img",this._element).forEach((t=>{L.on(t,"dragstart.bs.carousel",(t=>t.preventDefault()))})),this._pointerEvent?(L.on(this._element,"pointerdown.bs.carousel",(e=>t(e))),L.on(this._element,"pointerup.bs.carousel",(t=>n(t))),this._element.classList.add("pointer-event")):(L.on(this._element,"touchstart.bs.carousel",(e=>t(e))),L.on(this._element,"touchmove.bs.carousel",(t=>e(t))),L.on(this._element,"touchend.bs.carousel",(t=>n(t))))}_keydown(t){/input|textarea/i.test(t.target.tagName)||("ArrowLeft"===t.key?(t.preventDefault(),this._slide(H)):"ArrowRight"===t.key&&(t.preventDefault(),this._slide(G)))}_getItemIndex(t){return this._items=t&&t.parentNode?q.find(".carousel-item",t.parentNode):[],this._items.indexOf(t)}_getItemByOrder(t,e){const n=t===U,r=t===V,i=this._getItemIndex(e),o=this._items.length-1;if((r&&0===i||n&&i===o)&&!this._config.wrap)return e;const a=(i+(r?-1:1))%this._items.length;return-1===a?this._items[this._items.length-1]:this._items[a]}_triggerSlideEvent(t,e){const n=this._getItemIndex(t),r=this._getItemIndex(q.findOne(".active.carousel-item",this._element));return L.trigger(this._element,"slide.bs.carousel",{relatedTarget:t,direction:e,from:r,to:n})}_setActiveIndicatorElement(t){if(this._indicatorsElement){const e=q.findOne(".active",this._indicatorsElement);e.classList.remove("active"),e.removeAttribute("aria-current");const n=q.find("[data-bs-target]",this._indicatorsElement);for(let e=0;e{a.classList.remove(f,d),a.classList.add("active"),r.classList.remove("active",d,f),this._isSliding=!1,setTimeout((()=>{L.trigger(this._element,"slid.bs.carousel",{relatedTarget:a,direction:p,from:o,to:l})}),0)})),s(r,t)}else r.classList.remove("active"),a.classList.add("active"),this._isSliding=!1,L.trigger(this._element,"slid.bs.carousel",{relatedTarget:a,direction:p,from:o,to:l});c&&this.cycle()}}_directionToOrder(t){return[G,H].includes(t)?m()?t===G?V:U:t===G?U:V:t}_orderToDirection(t){return[U,V].includes(t)?m()?t===U?H:G:t===U?G:H:t}static carouselInterface(t,e){let n=v.get(t,"bs.carousel"),r={...F,...R.getDataAttributes(t)};"object"==typeof e&&(r={...r,...e});const i="string"==typeof e?e:r.slide;if(n||(n=new Y(t,r)),"number"==typeof e)n.to(e);else if("string"==typeof i){if(void 0===n[i])throw new TypeError(`No method named "${i}"`);n[i]()}else r.interval&&r.ride&&(n.pause(),n.cycle())}static jQueryInterface(t){return this.each((function(){Y.carouselInterface(this,t)}))}static dataApiClickHandler(t){const e=r(this);if(!e||!e.classList.contains("carousel"))return;const n={...R.getDataAttributes(e),...R.getDataAttributes(this)},i=this.getAttribute("data-bs-slide-to");i&&(n.interval=!1),Y.carouselInterface(e,n),i&&v.get(e,"bs.carousel").to(i),t.preventDefault()}}L.on(document,"click.bs.carousel.data-api","[data-bs-slide], [data-bs-slide-to]",Y.dataApiClickHandler),L.on(window,"load.bs.carousel.data-api",(()=>{const t=q.find('[data-bs-ride="carousel"]');for(let e=0,n=t.length;et===this._element));null!==i&&o.length&&(this._selector=i,this._triggerArray.push(e))}this._parent=this._config.parent?this._getParent():null,this._config.parent||this._addAriaAndCollapsedClass(this._element,this._triggerArray),this._config.toggle&&this.toggle()}static get Default(){return W}static get DATA_KEY(){return"bs.collapse"}toggle(){this._element.classList.contains("show")?this.hide():this.show()}show(){if(this._isTransitioning||this._element.classList.contains("show"))return;let t,e;this._parent&&(t=q.find(".show, .collapsing",this._parent).filter((t=>"string"==typeof this._config.parent?t.getAttribute("data-bs-parent")===this._config.parent:t.classList.contains("collapse"))),0===t.length&&(t=null));const n=q.findOne(this._selector);if(t){const r=t.find((t=>n!==t));if(e=r?v.get(r,"bs.collapse"):null,e&&e._isTransitioning)return}if(L.trigger(this._element,"show.bs.collapse").defaultPrevented)return;t&&t.forEach((t=>{n!==t&&K.collapseInterface(t,"hide"),e||v.set(t,"bs.collapse",null)}));const r=this._getDimension();this._element.classList.remove("collapse"),this._element.classList.add("collapsing"),this._element.style[r]=0,this._triggerArray.length&&this._triggerArray.forEach((t=>{t.classList.remove("collapsed"),t.setAttribute("aria-expanded",!0)})),this.setTransitioning(!0);const o="scroll"+(r[0].toUpperCase()+r.slice(1)),a=i(this._element);L.one(this._element,"transitionend",(()=>{this._element.classList.remove("collapsing"),this._element.classList.add("collapse","show"),this._element.style[r]="",this.setTransitioning(!1),L.trigger(this._element,"shown.bs.collapse")})),s(this._element,a),this._element.style[r]=this._element[o]+"px"}hide(){if(this._isTransitioning||!this._element.classList.contains("show"))return;if(L.trigger(this._element,"hide.bs.collapse").defaultPrevented)return;const t=this._getDimension();this._element.style[t]=this._element.getBoundingClientRect()[t]+"px",h(this._element),this._element.classList.add("collapsing"),this._element.classList.remove("collapse","show");const e=this._triggerArray.length;if(e>0)for(let t=0;t{this.setTransitioning(!1),this._element.classList.remove("collapsing"),this._element.classList.add("collapse"),L.trigger(this._element,"hidden.bs.collapse")})),s(this._element,n)}setTransitioning(t){this._isTransitioning=t}dispose(){super.dispose(),this._config=null,this._parent=null,this._triggerArray=null,this._isTransitioning=null}_getConfig(t){return(t={...W,...t}).toggle=Boolean(t.toggle),l("collapse",t,$),t}_getDimension(){return this._element.classList.contains("width")?"width":"height"}_getParent(){let{parent:t}=this._config;a(t)?void 0===t.jquery&&void 0===t[0]||(t=t[0]):t=q.findOne(t);const e=`[data-bs-toggle="collapse"][data-bs-parent="${t}"]`;return q.find(e,t).forEach((t=>{const e=r(t);this._addAriaAndCollapsedClass(e,[t])})),t}_addAriaAndCollapsedClass(t,e){if(!t||!e.length)return;const n=t.classList.contains("show");e.forEach((t=>{n?t.classList.remove("collapsed"):t.classList.add("collapsed"),t.setAttribute("aria-expanded",n)}))}static collapseInterface(t,e){let n=v.get(t,"bs.collapse");const r={...W,...R.getDataAttributes(t),..."object"==typeof e&&e?e:{}};if(!n&&r.toggle&&"string"==typeof e&&/show|hide/.test(e)&&(r.toggle=!1),n||(n=new K(t,r)),"string"==typeof e){if(void 0===n[e])throw new TypeError(`No method named "${e}"`);n[e]()}}static jQueryInterface(t){return this.each((function(){K.collapseInterface(this,t)}))}}L.on(document,"click.bs.collapse.data-api",'[data-bs-toggle="collapse"]',(function(t){("A"===t.target.tagName||t.delegateTarget&&"A"===t.delegateTarget.tagName)&&t.preventDefault();const e=R.getDataAttributes(this),r=n(this);q.find(r).forEach((t=>{const n=v.get(t,"bs.collapse");let r;n?(null===n._parent&&"string"==typeof e.parent&&(n._config.parent=e.parent,n._parent=n._getParent()),r="toggle"):r=e,K.collapseInterface(t,r)}))})),g("collapse",K);var X="top",Q="bottom",Z="right",J="left",tt=[X,Q,Z,J],et=tt.reduce((function(t,e){return t.concat([e+"-start",e+"-end"])}),[]),nt=[].concat(tt,["auto"]).reduce((function(t,e){return t.concat([e,e+"-start",e+"-end"])}),[]),rt=["beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite"];function it(t){return t?(t.nodeName||"").toLowerCase():null}function ot(t){if(null==t)return window;if("[object Window]"!==t.toString()){var e=t.ownerDocument;return e&&e.defaultView||window}return t}function at(t){return t instanceof ot(t).Element||t instanceof Element}function st(t){return t instanceof ot(t).HTMLElement||t instanceof HTMLElement}function lt(t){return"undefined"!=typeof ShadowRoot&&(t instanceof ot(t).ShadowRoot||t instanceof ShadowRoot)}var ct={name:"applyStyles",enabled:!0,phase:"write",fn:function(t){var e=t.state;Object.keys(e.elements).forEach((function(t){var n=e.styles[t]||{},r=e.attributes[t]||{},i=e.elements[t];st(i)&&it(i)&&(Object.assign(i.style,n),Object.keys(r).forEach((function(t){var e=r[t];!1===e?i.removeAttribute(t):i.setAttribute(t,!0===e?"":e)})))}))},effect:function(t){var e=t.state,n={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,n.popper),e.styles=n,e.elements.arrow&&Object.assign(e.elements.arrow.style,n.arrow),function(){Object.keys(e.elements).forEach((function(t){var r=e.elements[t],i=e.attributes[t]||{},o=Object.keys(e.styles.hasOwnProperty(t)?e.styles[t]:n[t]).reduce((function(t,e){return t[e]="",t}),{});st(r)&&it(r)&&(Object.assign(r.style,o),Object.keys(i).forEach((function(t){r.removeAttribute(t)})))}))}},requires:["computeStyles"]};function ut(t){return t.split("-")[0]}function ft(t){var e=t.getBoundingClientRect();return{width:e.width,height:e.height,top:e.top,right:e.right,bottom:e.bottom,left:e.left,x:e.left,y:e.top}}function dt(t){var e=ft(t),n=t.offsetWidth,r=t.offsetHeight;return Math.abs(e.width-n)<=1&&(n=e.width),Math.abs(e.height-r)<=1&&(r=e.height),{x:t.offsetLeft,y:t.offsetTop,width:n,height:r}}function ht(t,e){var n=e.getRootNode&&e.getRootNode();if(t.contains(e))return!0;if(n&<(n)){var r=e;do{if(r&&t.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function pt(t){return ot(t).getComputedStyle(t)}function mt(t){return["table","td","th"].indexOf(it(t))>=0}function gt(t){return((at(t)?t.ownerDocument:t.document)||window.document).documentElement}function bt(t){return"html"===it(t)?t:t.assignedSlot||t.parentNode||(lt(t)?t.host:null)||gt(t)}function vt(t){return st(t)&&"fixed"!==pt(t).position?t.offsetParent:null}function yt(t){for(var e=ot(t),n=vt(t);n&&mt(n)&&"static"===pt(n).position;)n=vt(n);return n&&("html"===it(n)||"body"===it(n)&&"static"===pt(n).position)?e:n||function(t){for(var e=-1!==navigator.userAgent.toLowerCase().indexOf("firefox"),n=bt(t);st(n)&&["html","body"].indexOf(it(n))<0;){var r=pt(n);if("none"!==r.transform||"none"!==r.perspective||"paint"===r.contain||-1!==["transform","perspective"].indexOf(r.willChange)||e&&"filter"===r.willChange||e&&r.filter&&"none"!==r.filter)return n;n=n.parentNode}return null}(t)||e}function _t(t){return["top","bottom"].indexOf(t)>=0?"x":"y"}var wt=Math.max,xt=Math.min,Tt=Math.round;function At(t,e,n){return wt(t,xt(e,n))}function Et(t){return Object.assign({},{top:0,right:0,bottom:0,left:0},t)}function Mt(t,e){return e.reduce((function(e,n){return e[n]=t,e}),{})}var St={name:"arrow",enabled:!0,phase:"main",fn:function(t){var e,n=t.state,r=t.name,i=t.options,o=n.elements.arrow,a=n.modifiersData.popperOffsets,s=ut(n.placement),l=_t(s),c=[J,Z].indexOf(s)>=0?"height":"width";if(o&&a){var u=function(t,e){return Et("number"!=typeof(t="function"==typeof t?t(Object.assign({},e.rects,{placement:e.placement})):t)?t:Mt(t,tt))}(i.padding,n),f=dt(o),d="y"===l?X:J,h="y"===l?Q:Z,p=n.rects.reference[c]+n.rects.reference[l]-a[l]-n.rects.popper[c],m=a[l]-n.rects.reference[l],g=yt(o),b=g?"y"===l?g.clientHeight||0:g.clientWidth||0:0,v=p/2-m/2,y=u[d],_=b-f[c]-u[h],w=b/2-f[c]/2+v,x=At(y,w,_),T=l;n.modifiersData[r]=((e={})[T]=x,e.centerOffset=x-w,e)}},effect:function(t){var e=t.state,n=t.options.element,r=void 0===n?"[data-popper-arrow]":n;null!=r&&("string"!=typeof r||(r=e.elements.popper.querySelector(r)))&&ht(e.elements.popper,r)&&(e.elements.arrow=r)},requires:["popperOffsets"],requiresIfExists:["preventOverflow"]},Nt={top:"auto",right:"auto",bottom:"auto",left:"auto"};function kt(t){var e,n=t.popper,r=t.popperRect,i=t.placement,o=t.offsets,a=t.position,s=t.gpuAcceleration,l=t.adaptive,c=t.roundOffsets,u=!0===c?function(t){var e=t.x,n=t.y,r=window.devicePixelRatio||1;return{x:Tt(Tt(e*r)/r)||0,y:Tt(Tt(n*r)/r)||0}}(o):"function"==typeof c?c(o):o,f=u.x,d=void 0===f?0:f,h=u.y,p=void 0===h?0:h,m=o.hasOwnProperty("x"),g=o.hasOwnProperty("y"),b=J,v=X,y=window;if(l){var _=yt(n),w="clientHeight",x="clientWidth";_===ot(n)&&"static"!==pt(_=gt(n)).position&&(w="scrollHeight",x="scrollWidth"),_=_,i===X&&(v=Q,p-=_[w]-r.height,p*=s?1:-1),i===J&&(b=Z,d-=_[x]-r.width,d*=s?1:-1)}var T,A=Object.assign({position:a},l&&Nt);return s?Object.assign({},A,((T={})[v]=g?"0":"",T[b]=m?"0":"",T.transform=(y.devicePixelRatio||1)<2?"translate("+d+"px, "+p+"px)":"translate3d("+d+"px, "+p+"px, 0)",T)):Object.assign({},A,((e={})[v]=g?p+"px":"",e[b]=m?d+"px":"",e.transform="",e))}var Ct={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:function(t){var e=t.state,n=t.options,r=n.gpuAcceleration,i=void 0===r||r,o=n.adaptive,a=void 0===o||o,s=n.roundOffsets,l=void 0===s||s,c={placement:ut(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:i};null!=e.modifiersData.popperOffsets&&(e.styles.popper=Object.assign({},e.styles.popper,kt(Object.assign({},c,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:a,roundOffsets:l})))),null!=e.modifiersData.arrow&&(e.styles.arrow=Object.assign({},e.styles.arrow,kt(Object.assign({},c,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})},data:{}},Dt={passive:!0},Lt={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:function(t){var e=t.state,n=t.instance,r=t.options,i=r.scroll,o=void 0===i||i,a=r.resize,s=void 0===a||a,l=ot(e.elements.popper),c=[].concat(e.scrollParents.reference,e.scrollParents.popper);return o&&c.forEach((function(t){t.addEventListener("scroll",n.update,Dt)})),s&&l.addEventListener("resize",n.update,Dt),function(){o&&c.forEach((function(t){t.removeEventListener("scroll",n.update,Dt)})),s&&l.removeEventListener("resize",n.update,Dt)}},data:{}},Ot={left:"right",right:"left",bottom:"top",top:"bottom"};function It(t){return t.replace(/left|right|bottom|top/g,(function(t){return Ot[t]}))}var Bt={start:"end",end:"start"};function Pt(t){return t.replace(/start|end/g,(function(t){return Bt[t]}))}function jt(t){var e=ot(t);return{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function Rt(t){return ft(gt(t)).left+jt(t).scrollLeft}function qt(t){var e=pt(t),n=e.overflow,r=e.overflowX,i=e.overflowY;return/auto|scroll|overlay|hidden/.test(n+i+r)}function Ft(t,e){var n;void 0===e&&(e=[]);var r=function t(e){return["html","body","#document"].indexOf(it(e))>=0?e.ownerDocument.body:st(e)&&qt(e)?e:t(bt(e))}(t),i=r===(null==(n=t.ownerDocument)?void 0:n.body),o=ot(r),a=i?[o].concat(o.visualViewport||[],qt(r)?r:[]):r,s=e.concat(a);return i?s:s.concat(Ft(bt(a)))}function zt(t){return Object.assign({},t,{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height})}function Ut(t,e){return"viewport"===e?zt(function(t){var e=ot(t),n=gt(t),r=e.visualViewport,i=n.clientWidth,o=n.clientHeight,a=0,s=0;return r&&(i=r.width,o=r.height,/^((?!chrome|android).)*safari/i.test(navigator.userAgent)||(a=r.offsetLeft,s=r.offsetTop)),{width:i,height:o,x:a+Rt(t),y:s}}(t)):st(e)?function(t){var e=ft(t);return e.top=e.top+t.clientTop,e.left=e.left+t.clientLeft,e.bottom=e.top+t.clientHeight,e.right=e.left+t.clientWidth,e.width=t.clientWidth,e.height=t.clientHeight,e.x=e.left,e.y=e.top,e}(e):zt(function(t){var e,n=gt(t),r=jt(t),i=null==(e=t.ownerDocument)?void 0:e.body,o=wt(n.scrollWidth,n.clientWidth,i?i.scrollWidth:0,i?i.clientWidth:0),a=wt(n.scrollHeight,n.clientHeight,i?i.scrollHeight:0,i?i.clientHeight:0),s=-r.scrollLeft+Rt(t),l=-r.scrollTop;return"rtl"===pt(i||n).direction&&(s+=wt(n.clientWidth,i?i.clientWidth:0)-o),{width:o,height:a,x:s,y:l}}(gt(t)))}function Vt(t){return t.split("-")[1]}function Ht(t){var e,n=t.reference,r=t.element,i=t.placement,o=i?ut(i):null,a=i?Vt(i):null,s=n.x+n.width/2-r.width/2,l=n.y+n.height/2-r.height/2;switch(o){case X:e={x:s,y:n.y-r.height};break;case Q:e={x:s,y:n.y+n.height};break;case Z:e={x:n.x+n.width,y:l};break;case J:e={x:n.x-r.width,y:l};break;default:e={x:n.x,y:n.y}}var c=o?_t(o):null;if(null!=c){var u="y"===c?"height":"width";switch(a){case"start":e[c]=e[c]-(n[u]/2-r[u]/2);break;case"end":e[c]=e[c]+(n[u]/2-r[u]/2)}}return e}function Gt(t,e){void 0===e&&(e={});var n=e,r=n.placement,i=void 0===r?t.placement:r,o=n.boundary,a=void 0===o?"clippingParents":o,s=n.rootBoundary,l=void 0===s?"viewport":s,c=n.elementContext,u=void 0===c?"popper":c,f=n.altBoundary,d=void 0!==f&&f,h=n.padding,p=void 0===h?0:h,m=Et("number"!=typeof p?p:Mt(p,tt)),g="popper"===u?"reference":"popper",b=t.elements.reference,v=t.rects.popper,y=t.elements[d?g:u],_=function(t,e,n){var r="clippingParents"===e?function(t){var e=Ft(bt(t)),n=["absolute","fixed"].indexOf(pt(t).position)>=0&&st(t)?yt(t):t;return at(n)?e.filter((function(t){return at(t)&&ht(t,n)&&"body"!==it(t)})):[]}(t):[].concat(e),i=[].concat(r,[n]),o=i[0],a=i.reduce((function(e,n){var r=Ut(t,n);return e.top=wt(r.top,e.top),e.right=xt(r.right,e.right),e.bottom=xt(r.bottom,e.bottom),e.left=wt(r.left,e.left),e}),Ut(t,o));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}(at(y)?y:y.contextElement||gt(t.elements.popper),a,l),w=ft(b),x=Ht({reference:w,element:v,strategy:"absolute",placement:i}),T=zt(Object.assign({},v,x)),A="popper"===u?T:w,E={top:_.top-A.top+m.top,bottom:A.bottom-_.bottom+m.bottom,left:_.left-A.left+m.left,right:A.right-_.right+m.right},M=t.modifiersData.offset;if("popper"===u&&M){var S=M[i];Object.keys(E).forEach((function(t){var e=[Z,Q].indexOf(t)>=0?1:-1,n=[X,Q].indexOf(t)>=0?"y":"x";E[t]+=S[n]*e}))}return E}var Yt={name:"flip",enabled:!0,phase:"main",fn:function(t){var e=t.state,n=t.options,r=t.name;if(!e.modifiersData[r]._skip){for(var i=n.mainAxis,o=void 0===i||i,a=n.altAxis,s=void 0===a||a,l=n.fallbackPlacements,c=n.padding,u=n.boundary,f=n.rootBoundary,d=n.altBoundary,h=n.flipVariations,p=void 0===h||h,m=n.allowedAutoPlacements,g=e.options.placement,b=ut(g),v=l||(b!==g&&p?function(t){if("auto"===ut(t))return[];var e=It(t);return[Pt(t),e,Pt(e)]}(g):[It(g)]),y=[g].concat(v).reduce((function(t,n){return t.concat("auto"===ut(n)?function(t,e){void 0===e&&(e={});var n=e,r=n.placement,i=n.boundary,o=n.rootBoundary,a=n.padding,s=n.flipVariations,l=n.allowedAutoPlacements,c=void 0===l?nt:l,u=Vt(r),f=u?s?et:et.filter((function(t){return Vt(t)===u})):tt,d=f.filter((function(t){return c.indexOf(t)>=0}));0===d.length&&(d=f);var h=d.reduce((function(e,n){return e[n]=Gt(t,{placement:n,boundary:i,rootBoundary:o,padding:a})[ut(n)],e}),{});return Object.keys(h).sort((function(t,e){return h[t]-h[e]}))}(e,{placement:n,boundary:u,rootBoundary:f,padding:c,flipVariations:p,allowedAutoPlacements:m}):n)}),[]),_=e.rects.reference,w=e.rects.popper,x=new Map,T=!0,A=y[0],E=0;E=0,C=k?"width":"height",D=Gt(e,{placement:M,boundary:u,rootBoundary:f,altBoundary:d,padding:c}),L=k?N?Z:J:N?Q:X;_[C]>w[C]&&(L=It(L));var O=It(L),I=[];if(o&&I.push(D[S]<=0),s&&I.push(D[L]<=0,D[O]<=0),I.every((function(t){return t}))){A=M,T=!1;break}x.set(M,I)}if(T)for(var B=function(t){var e=y.find((function(e){var n=x.get(e);if(n)return n.slice(0,t).every((function(t){return t}))}));if(e)return A=e,"break"},P=p?3:1;P>0&&"break"!==B(P);P--);e.placement!==A&&(e.modifiersData[r]._skip=!0,e.placement=A,e.reset=!0)}},requiresIfExists:["offset"],data:{_skip:!1}};function Wt(t,e,n){return void 0===n&&(n={x:0,y:0}),{top:t.top-e.height-n.y,right:t.right-e.width+n.x,bottom:t.bottom-e.height+n.y,left:t.left-e.width-n.x}}function $t(t){return[X,Z,Q,J].some((function(e){return t[e]>=0}))}var Kt={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:function(t){var e=t.state,n=t.name,r=e.rects.reference,i=e.rects.popper,o=e.modifiersData.preventOverflow,a=Gt(e,{elementContext:"reference"}),s=Gt(e,{altBoundary:!0}),l=Wt(a,r),c=Wt(s,i,o),u=$t(l),f=$t(c);e.modifiersData[n]={referenceClippingOffsets:l,popperEscapeOffsets:c,isReferenceHidden:u,hasPopperEscaped:f},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":u,"data-popper-escaped":f})}},Xt={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:function(t){var e=t.state,n=t.options,r=t.name,i=n.offset,o=void 0===i?[0,0]:i,a=nt.reduce((function(t,n){return t[n]=function(t,e,n){var r=ut(t),i=[J,X].indexOf(r)>=0?-1:1,o="function"==typeof n?n(Object.assign({},e,{placement:t})):n,a=o[0],s=o[1];return a=a||0,s=(s||0)*i,[J,Z].indexOf(r)>=0?{x:s,y:a}:{x:a,y:s}}(n,e.rects,o),t}),{}),s=a[e.placement],l=s.x,c=s.y;null!=e.modifiersData.popperOffsets&&(e.modifiersData.popperOffsets.x+=l,e.modifiersData.popperOffsets.y+=c),e.modifiersData[r]=a}},Qt={name:"popperOffsets",enabled:!0,phase:"read",fn:function(t){var e=t.state,n=t.name;e.modifiersData[n]=Ht({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})},data:{}},Zt={name:"preventOverflow",enabled:!0,phase:"main",fn:function(t){var e=t.state,n=t.options,r=t.name,i=n.mainAxis,o=void 0===i||i,a=n.altAxis,s=void 0!==a&&a,l=n.boundary,c=n.rootBoundary,u=n.altBoundary,f=n.padding,d=n.tether,h=void 0===d||d,p=n.tetherOffset,m=void 0===p?0:p,g=Gt(e,{boundary:l,rootBoundary:c,padding:f,altBoundary:u}),b=ut(e.placement),v=Vt(e.placement),y=!v,_=_t(b),w="x"===_?"y":"x",x=e.modifiersData.popperOffsets,T=e.rects.reference,A=e.rects.popper,E="function"==typeof m?m(Object.assign({},e.rects,{placement:e.placement})):m,M={x:0,y:0};if(x){if(o||s){var S="y"===_?X:J,N="y"===_?Q:Z,k="y"===_?"height":"width",C=x[_],D=x[_]+g[S],L=x[_]-g[N],O=h?-A[k]/2:0,I="start"===v?T[k]:A[k],B="start"===v?-A[k]:-T[k],P=e.elements.arrow,j=h&&P?dt(P):{width:0,height:0},R=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:{top:0,right:0,bottom:0,left:0},q=R[S],F=R[N],z=At(0,T[k],j[k]),U=y?T[k]/2-O-z-q-E:I-z-q-E,V=y?-T[k]/2+O+z+F+E:B+z+F+E,H=e.elements.arrow&&yt(e.elements.arrow),G=H?"y"===_?H.clientTop||0:H.clientLeft||0:0,Y=e.modifiersData.offset?e.modifiersData.offset[e.placement][_]:0,W=x[_]+U-Y-G,$=x[_]+V-Y;if(o){var K=At(h?xt(D,W):D,C,h?wt(L,$):L);x[_]=K,M[_]=K-C}if(s){var tt="x"===_?X:J,et="x"===_?Q:Z,nt=x[w],rt=nt+g[tt],it=nt-g[et],ot=At(h?xt(rt,W):rt,nt,h?wt(it,$):it);x[w]=ot,M[w]=ot-nt}}e.modifiersData[r]=M}},requiresIfExists:["offset"]};function Jt(t,e,n){void 0===n&&(n=!1);var r,i,o=gt(e),a=ft(t),s=st(e),l={scrollLeft:0,scrollTop:0},c={x:0,y:0};return(s||!s&&!n)&&(("body"!==it(e)||qt(o))&&(l=(r=e)!==ot(r)&&st(r)?{scrollLeft:(i=r).scrollLeft,scrollTop:i.scrollTop}:jt(r)),st(e)?((c=ft(e)).x+=e.clientLeft,c.y+=e.clientTop):o&&(c.x=Rt(o))),{x:a.left+l.scrollLeft-c.x,y:a.top+l.scrollTop-c.y,width:a.width,height:a.height}}var te={placement:"bottom",modifiers:[],strategy:"absolute"};function ee(){for(var t=arguments.length,e=new Array(t),n=0;n"applyStyles"===t.name&&!1===t.enabled));this._popper=oe(e,this._menu,n),r&&R.setDataAttribute(this._menu,"popper","static")}"ontouchstart"in document.documentElement&&!t.closest(".navbar-nav")&&[].concat(...document.body.children).forEach((t=>L.on(t,"mouseover",null,(function(){})))),this._element.focus(),this._element.setAttribute("aria-expanded",!0),this._menu.classList.toggle("show"),this._element.classList.toggle("show"),L.trigger(this._element,"shown.bs.dropdown",e)}}hide(){if(this._element.disabled||this._element.classList.contains("disabled")||!this._menu.classList.contains("show"))return;const t={relatedTarget:this._element};L.trigger(this._element,"hide.bs.dropdown",t).defaultPrevented||(this._popper&&this._popper.destroy(),this._menu.classList.toggle("show"),this._element.classList.toggle("show"),R.removeDataAttribute(this._menu,"popper"),L.trigger(this._element,"hidden.bs.dropdown",t))}dispose(){L.off(this._element,".bs.dropdown"),this._menu=null,this._popper&&(this._popper.destroy(),this._popper=null),super.dispose()}update(){this._inNavbar=this._detectNavbar(),this._popper&&this._popper.update()}_addEventListeners(){L.on(this._element,"click.bs.dropdown",(t=>{t.preventDefault(),this.toggle()}))}_getConfig(t){if(t={...this.constructor.Default,...R.getDataAttributes(this._element),...t},l("dropdown",t,this.constructor.DefaultType),"object"==typeof t.reference&&!a(t.reference)&&"function"!=typeof t.reference.getBoundingClientRect)throw new TypeError("dropdown".toUpperCase()+': Option "reference" provided type "object" without a required "getBoundingClientRect" method.');return t}_getMenuElement(){return q.next(this._element,".dropdown-menu")[0]}_getPlacement(){const t=this._element.parentNode;if(t.classList.contains("dropend"))return de;if(t.classList.contains("dropstart"))return he;const e="end"===getComputedStyle(this._menu).getPropertyValue("--bs-position").trim();return t.classList.contains("dropup")?e?ce:le:e?fe:ue}_detectNavbar(){return null!==this._element.closest(".navbar")}_getOffset(){const{offset:t}=this._config;return"string"==typeof t?t.split(",").map((t=>Number.parseInt(t,10))):"function"==typeof t?e=>t(e,this._element):t}_getPopperConfig(){const t={placement:this._getPlacement(),modifiers:[{name:"preventOverflow",options:{boundary:this._config.boundary}},{name:"offset",options:{offset:this._getOffset()}}]};return"static"===this._config.display&&(t.modifiers=[{name:"applyStyles",enabled:!1}]),{...t,..."function"==typeof this._config.popperConfig?this._config.popperConfig(t):this._config.popperConfig}}static dropdownInterface(t,e){let n=v.get(t,"bs.dropdown");if(n||(n=new ge(t,"object"==typeof e?e:null)),"string"==typeof e){if(void 0===n[e])throw new TypeError(`No method named "${e}"`);n[e]()}}static jQueryInterface(t){return this.each((function(){ge.dropdownInterface(this,t)}))}static clearMenus(t){if(t){if(2===t.button||"keyup"===t.type&&"Tab"!==t.key)return;if(/input|select|textarea|form/i.test(t.target.tagName))return}const e=q.find('[data-bs-toggle="dropdown"]');for(let n=0,r=e.length;nt.composedPath().includes(e))))continue;if("keyup"===t.type&&"Tab"===t.key&&o.contains(t.target))continue}L.trigger(e[n],"hide.bs.dropdown",i).defaultPrevented||("ontouchstart"in document.documentElement&&[].concat(...document.body.children).forEach((t=>L.off(t,"mouseover",null,(function(){})))),e[n].setAttribute("aria-expanded","false"),r._popper&&r._popper.destroy(),o.classList.remove("show"),e[n].classList.remove("show"),R.removeDataAttribute(o,"popper"),L.trigger(e[n],"hidden.bs.dropdown",i))}}}static getParentFromElement(t){return r(t)||t.parentNode}static dataApiKeydownHandler(t){if(/input|textarea/i.test(t.target.tagName)?"Space"===t.key||"Escape"!==t.key&&("ArrowDown"!==t.key&&"ArrowUp"!==t.key||t.target.closest(".dropdown-menu")):!se.test(t.key))return;if(t.preventDefault(),t.stopPropagation(),this.disabled||this.classList.contains("disabled"))return;const e=ge.getParentFromElement(this),n=this.classList.contains("show");if("Escape"===t.key)return(this.matches('[data-bs-toggle="dropdown"]')?this:q.prev(this,'[data-bs-toggle="dropdown"]')[0]).focus(),void ge.clearMenus();if(!n&&("ArrowUp"===t.key||"ArrowDown"===t.key))return void(this.matches('[data-bs-toggle="dropdown"]')?this:q.prev(this,'[data-bs-toggle="dropdown"]')[0]).click();if(!n||"Space"===t.key)return void ge.clearMenus();const r=q.find(".dropdown-menu .dropdown-item:not(.disabled):not(:disabled)",e).filter(c);if(!r.length)return;let i=r.indexOf(t.target);"ArrowUp"===t.key&&i>0&&i--,"ArrowDown"===t.key&&ithis.hide(t))),L.on(this._dialog,"mousedown.dismiss.bs.modal",(()=>{L.one(this._element,"mouseup.dismiss.bs.modal",(t=>{t.target===this._element&&(this._ignoreBackdropClick=!0)}))})),this._showBackdrop((()=>this._showElement(t))))}hide(t){if(t&&t.preventDefault(),!this._isShown||this._isTransitioning)return;if(L.trigger(this._element,"hide.bs.modal").defaultPrevented)return;this._isShown=!1;const e=this._isAnimated();if(e&&(this._isTransitioning=!0),this._setEscapeEvent(),this._setResizeEvent(),L.off(document,"focusin.bs.modal"),this._element.classList.remove("show"),L.off(this._element,"click.dismiss.bs.modal"),L.off(this._dialog,"mousedown.dismiss.bs.modal"),e){const t=i(this._element);L.one(this._element,"transitionend",(t=>this._hideModal(t))),s(this._element,t)}else this._hideModal()}dispose(){[window,this._element,this._dialog].forEach((t=>L.off(t,".bs.modal"))),super.dispose(),L.off(document,"focusin.bs.modal"),this._config=null,this._dialog=null,this._backdrop=null,this._isShown=null,this._isBodyOverflowing=null,this._ignoreBackdropClick=null,this._isTransitioning=null,this._scrollbarWidth=null}handleUpdate(){this._adjustDialog()}_getConfig(t){return t={...be,...t},l("modal",t,ve),t}_showElement(t){const e=this._isAnimated(),n=q.findOne(".modal-body",this._dialog);this._element.parentNode&&this._element.parentNode.nodeType===Node.ELEMENT_NODE||document.body.appendChild(this._element),this._element.style.display="block",this._element.removeAttribute("aria-hidden"),this._element.setAttribute("aria-modal",!0),this._element.setAttribute("role","dialog"),this._element.scrollTop=0,n&&(n.scrollTop=0),e&&h(this._element),this._element.classList.add("show"),this._config.focus&&this._enforceFocus();const r=()=>{this._config.focus&&this._element.focus(),this._isTransitioning=!1,L.trigger(this._element,"shown.bs.modal",{relatedTarget:t})};if(e){const t=i(this._dialog);L.one(this._dialog,"transitionend",r),s(this._dialog,t)}else r()}_enforceFocus(){L.off(document,"focusin.bs.modal"),L.on(document,"focusin.bs.modal",(t=>{document===t.target||this._element===t.target||this._element.contains(t.target)||this._element.focus()}))}_setEscapeEvent(){this._isShown?L.on(this._element,"keydown.dismiss.bs.modal",(t=>{this._config.keyboard&&"Escape"===t.key?(t.preventDefault(),this.hide()):this._config.keyboard||"Escape"!==t.key||this._triggerBackdropTransition()})):L.off(this._element,"keydown.dismiss.bs.modal")}_setResizeEvent(){this._isShown?L.on(window,"resize.bs.modal",(()=>this._adjustDialog())):L.off(window,"resize.bs.modal")}_hideModal(){this._element.style.display="none",this._element.setAttribute("aria-hidden",!0),this._element.removeAttribute("aria-modal"),this._element.removeAttribute("role"),this._isTransitioning=!1,this._showBackdrop((()=>{document.body.classList.remove("modal-open"),this._resetAdjustments(),this._resetScrollbar(),L.trigger(this._element,"hidden.bs.modal")}))}_removeBackdrop(){this._backdrop.parentNode.removeChild(this._backdrop),this._backdrop=null}_showBackdrop(t){const e=this._isAnimated();if(this._isShown&&this._config.backdrop){if(this._backdrop=document.createElement("div"),this._backdrop.className="modal-backdrop",e&&this._backdrop.classList.add("fade"),document.body.appendChild(this._backdrop),L.on(this._element,"click.dismiss.bs.modal",(t=>{this._ignoreBackdropClick?this._ignoreBackdropClick=!1:t.target===t.currentTarget&&("static"===this._config.backdrop?this._triggerBackdropTransition():this.hide())})),e&&h(this._backdrop),this._backdrop.classList.add("show"),!e)return void t();const n=i(this._backdrop);L.one(this._backdrop,"transitionend",t),s(this._backdrop,n)}else if(!this._isShown&&this._backdrop){this._backdrop.classList.remove("show");const n=()=>{this._removeBackdrop(),t()};if(e){const t=i(this._backdrop);L.one(this._backdrop,"transitionend",n),s(this._backdrop,t)}else n()}else t()}_isAnimated(){return this._element.classList.contains("fade")}_triggerBackdropTransition(){if(L.trigger(this._element,"hidePrevented.bs.modal").defaultPrevented)return;const t=this._element.scrollHeight>document.documentElement.clientHeight;t||(this._element.style.overflowY="hidden"),this._element.classList.add("modal-static");const e=i(this._dialog);L.off(this._element,"transitionend"),L.one(this._element,"transitionend",(()=>{this._element.classList.remove("modal-static"),t||(L.one(this._element,"transitionend",(()=>{this._element.style.overflowY=""})),s(this._element,e))})),s(this._element,e),this._element.focus()}_adjustDialog(){const t=this._element.scrollHeight>document.documentElement.clientHeight;(!this._isBodyOverflowing&&t&&!m()||this._isBodyOverflowing&&!t&&m())&&(this._element.style.paddingLeft=this._scrollbarWidth+"px"),(this._isBodyOverflowing&&!t&&!m()||!this._isBodyOverflowing&&t&&m())&&(this._element.style.paddingRight=this._scrollbarWidth+"px")}_resetAdjustments(){this._element.style.paddingLeft="",this._element.style.paddingRight=""}_checkScrollbar(){const t=document.body.getBoundingClientRect();this._isBodyOverflowing=Math.round(t.left+t.right)t+this._scrollbarWidth)),this._setElementAttributes(".sticky-top","marginRight",(t=>t-this._scrollbarWidth)),this._setElementAttributes("body","paddingRight",(t=>t+this._scrollbarWidth))),document.body.classList.add("modal-open")}_setElementAttributes(t,e,n){q.find(t).forEach((t=>{if(t!==document.body&&window.innerWidth>t.clientWidth+this._scrollbarWidth)return;const r=t.style[e],i=window.getComputedStyle(t)[e];R.setDataAttribute(t,e,r),t.style[e]=n(Number.parseFloat(i))+"px"}))}_resetScrollbar(){this._resetElementAttributes(".fixed-top, .fixed-bottom, .is-fixed, .sticky-top","paddingRight"),this._resetElementAttributes(".sticky-top","marginRight"),this._resetElementAttributes("body","paddingRight")}_resetElementAttributes(t,e){q.find(t).forEach((t=>{const n=R.getDataAttribute(t,e);void 0===n&&t===document.body?t.style[e]="":(R.removeDataAttribute(t,e),t.style[e]=n)}))}_getScrollbarWidth(){const t=document.createElement("div");t.className="modal-scrollbar-measure",document.body.appendChild(t);const e=t.getBoundingClientRect().width-t.clientWidth;return document.body.removeChild(t),e}static jQueryInterface(t,e){return this.each((function(){let n=v.get(this,"bs.modal");const r={...be,...R.getDataAttributes(this),..."object"==typeof t&&t?t:{}};if(n||(n=new ye(this,r)),"string"==typeof t){if(void 0===n[t])throw new TypeError(`No method named "${t}"`);n[t](e)}}))}}L.on(document,"click.bs.modal.data-api",'[data-bs-toggle="modal"]',(function(t){const e=r(this);"A"!==this.tagName&&"AREA"!==this.tagName||t.preventDefault(),L.one(e,"show.bs.modal",(t=>{t.defaultPrevented||L.one(e,"hidden.bs.modal",(()=>{c(this)&&this.focus()}))}));let n=v.get(e,"bs.modal");if(!n){const t={...R.getDataAttributes(e),...R.getDataAttributes(this)};n=new ye(e,t)}n.toggle(this)})),g("modal",ye);const _e=()=>{const t=document.documentElement.clientWidth;return Math.abs(window.innerWidth-t)},we=(t,e,n)=>{const r=_e();q.find(t).forEach((t=>{if(t!==document.body&&window.innerWidth>t.clientWidth+r)return;const i=t.style[e],o=window.getComputedStyle(t)[e];R.setDataAttribute(t,e,i),t.style[e]=n(Number.parseFloat(o))+"px"}))},xe=(t,e)=>{q.find(t).forEach((t=>{const n=R.getDataAttribute(t,e);void 0===n&&t===document.body?t.style.removeProperty(e):(R.removeDataAttribute(t,e),t.style[e]=n)}))},Te={backdrop:!0,keyboard:!0,scroll:!1},Ae={backdrop:"boolean",keyboard:"boolean",scroll:"boolean"};class Ee extends O{constructor(t,e){super(t),this._config=this._getConfig(e),this._isShown=!1,this._addEventListeners()}static get Default(){return Te}static get DATA_KEY(){return"bs.offcanvas"}toggle(t){return this._isShown?this.hide():this.show(t)}show(t){this._isShown||L.trigger(this._element,"show.bs.offcanvas",{relatedTarget:t}).defaultPrevented||(this._isShown=!0,this._element.style.visibility="visible",this._config.backdrop&&document.body.classList.add("offcanvas-backdrop"),this._config.scroll||((t=_e())=>{document.body.style.overflow="hidden",we(".fixed-top, .fixed-bottom, .is-fixed","paddingRight",(e=>e+t)),we(".sticky-top","marginRight",(e=>e-t)),we("body","paddingRight",(e=>e+t))})(),this._element.classList.add("offcanvas-toggling"),this._element.removeAttribute("aria-hidden"),this._element.setAttribute("aria-modal",!0),this._element.setAttribute("role","dialog"),this._element.classList.add("show"),setTimeout((()=>{this._element.classList.remove("offcanvas-toggling"),L.trigger(this._element,"shown.bs.offcanvas",{relatedTarget:t}),this._enforceFocusOnElement(this._element)}),i(this._element)))}hide(){this._isShown&&(L.trigger(this._element,"hide.bs.offcanvas").defaultPrevented||(this._element.classList.add("offcanvas-toggling"),L.off(document,"focusin.bs.offcanvas"),this._element.blur(),this._isShown=!1,this._element.classList.remove("show"),setTimeout((()=>{this._element.setAttribute("aria-hidden",!0),this._element.removeAttribute("aria-modal"),this._element.removeAttribute("role"),this._element.style.visibility="hidden",this._config.backdrop&&document.body.classList.remove("offcanvas-backdrop"),this._config.scroll||(document.body.style.overflow="auto",xe(".fixed-top, .fixed-bottom, .is-fixed","paddingRight"),xe(".sticky-top","marginRight"),xe("body","paddingRight")),L.trigger(this._element,"hidden.bs.offcanvas"),this._element.classList.remove("offcanvas-toggling")}),i(this._element))))}_getConfig(t){return t={...Te,...R.getDataAttributes(this._element),..."object"==typeof t?t:{}},l("offcanvas",t,Ae),t}_enforceFocusOnElement(t){L.off(document,"focusin.bs.offcanvas"),L.on(document,"focusin.bs.offcanvas",(e=>{document===e.target||t===e.target||t.contains(e.target)||t.focus()})),t.focus()}_addEventListeners(){L.on(this._element,"click.dismiss.bs.offcanvas",'[data-bs-dismiss="offcanvas"]',(()=>this.hide())),L.on(document,"keydown",(t=>{this._config.keyboard&&"Escape"===t.key&&this.hide()})),L.on(document,"click.bs.offcanvas.data-api",(t=>{const e=q.findOne(n(t.target));this._element.contains(t.target)||e===this._element||this.hide()}))}static jQueryInterface(t){return this.each((function(){const e=v.get(this,"bs.offcanvas")||new Ee(this,"object"==typeof t?t:{});if("string"==typeof t){if(void 0===e[t]||t.startsWith("_")||"constructor"===t)throw new TypeError(`No method named "${t}"`);e[t](this)}}))}}L.on(document,"click.bs.offcanvas.data-api",'[data-bs-toggle="offcanvas"]',(function(t){const e=r(this);if(["A","AREA"].includes(this.tagName)&&t.preventDefault(),u(this))return;L.one(e,"hidden.bs.offcanvas",(()=>{c(this)&&this.focus()}));const n=q.findOne(".offcanvas.show, .offcanvas-toggling");n&&n!==e||(v.get(e,"bs.offcanvas")||new Ee(e)).toggle(this)})),L.on(window,"load.bs.offcanvas.data-api",(()=>{q.find(".offcanvas.show").forEach((t=>(v.get(t,"bs.offcanvas")||new Ee(t)).show()))})),g("offcanvas",Ee);const Me=new Set(["background","cite","href","itemtype","longdesc","poster","src","xlink:href"]),Se=/^(?:(?:https?|mailto|ftp|tel|file):|[^#&/:?]*(?:[#/?]|$))/i,Ne=/^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[\d+/a-z]+=*$/i,ke=(t,e)=>{const n=t.nodeName.toLowerCase();if(e.includes(n))return!Me.has(n)||Boolean(Se.test(t.nodeValue)||Ne.test(t.nodeValue));const r=e.filter((t=>t instanceof RegExp));for(let t=0,e=r.length;t{ke(t,s)||n.removeAttribute(t.nodeName)}))}return r.body.innerHTML}const De=new RegExp("(^|\\s)bs-tooltip\\S+","g"),Le=new Set(["sanitize","allowList","sanitizeFn"]),Oe={animation:"boolean",template:"string",title:"(string|element|function)",trigger:"string",delay:"(number|object)",html:"boolean",selector:"(string|boolean)",placement:"(string|function)",offset:"(array|string|function)",container:"(string|element|boolean)",fallbackPlacements:"array",boundary:"(string|element)",customClass:"(string|function)",sanitize:"boolean",sanitizeFn:"(null|function)",allowList:"object",popperConfig:"(null|object|function)"},Ie={AUTO:"auto",TOP:"top",RIGHT:m()?"left":"right",BOTTOM:"bottom",LEFT:m()?"right":"left"},Be={animation:!0,template:'',trigger:"hover focus",title:"",delay:0,html:!1,selector:!1,placement:"top",offset:[0,0],container:!1,fallbackPlacements:["top","right","bottom","left"],boundary:"clippingParents",customClass:"",sanitize:!0,sanitizeFn:null,allowList:{"*":["class","dir","id","lang","role",/^aria-[\w-]*$/i],a:["target","href","title","rel"],area:[],b:[],br:[],col:[],code:[],div:[],em:[],hr:[],h1:[],h2:[],h3:[],h4:[],h5:[],h6:[],i:[],img:["src","srcset","alt","title","width","height"],li:[],ol:[],p:[],pre:[],s:[],small:[],span:[],sub:[],sup:[],strong:[],u:[],ul:[]},popperConfig:null},Pe={HIDE:"hide.bs.tooltip",HIDDEN:"hidden.bs.tooltip",SHOW:"show.bs.tooltip",SHOWN:"shown.bs.tooltip",INSERTED:"inserted.bs.tooltip",CLICK:"click.bs.tooltip",FOCUSIN:"focusin.bs.tooltip",FOCUSOUT:"focusout.bs.tooltip",MOUSEENTER:"mouseenter.bs.tooltip",MOUSELEAVE:"mouseleave.bs.tooltip"};class je extends O{constructor(t,e){if(void 0===ae)throw new TypeError("Bootstrap's tooltips require Popper (https://popper.js.org)");super(t),this._isEnabled=!0,this._timeout=0,this._hoverState="",this._activeTrigger={},this._popper=null,this.config=this._getConfig(e),this.tip=null,this._setListeners()}static get Default(){return Be}static get NAME(){return"tooltip"}static get DATA_KEY(){return"bs.tooltip"}static get Event(){return Pe}static get EVENT_KEY(){return".bs.tooltip"}static get DefaultType(){return Oe}enable(){this._isEnabled=!0}disable(){this._isEnabled=!1}toggleEnabled(){this._isEnabled=!this._isEnabled}toggle(t){if(this._isEnabled)if(t){const e=this._initializeOnDelegatedTarget(t);e._activeTrigger.click=!e._activeTrigger.click,e._isWithActiveTrigger()?e._enter(null,e):e._leave(null,e)}else{if(this.getTipElement().classList.contains("show"))return void this._leave(null,this);this._enter(null,this)}}dispose(){clearTimeout(this._timeout),L.off(this._element,this.constructor.EVENT_KEY),L.off(this._element.closest(".modal"),"hide.bs.modal",this._hideModalHandler),this.tip&&this.tip.parentNode&&this.tip.parentNode.removeChild(this.tip),this._isEnabled=null,this._timeout=null,this._hoverState=null,this._activeTrigger=null,this._popper&&this._popper.destroy(),this._popper=null,this.config=null,this.tip=null,super.dispose()}show(){if("none"===this._element.style.display)throw new Error("Please use show on visible elements");if(!this.isWithContent()||!this._isEnabled)return;const e=L.trigger(this._element,this.constructor.Event.SHOW),n=f(this._element),r=null===n?this._element.ownerDocument.documentElement.contains(this._element):n.contains(this._element);if(e.defaultPrevented||!r)return;const o=this.getTipElement(),a=t(this.constructor.NAME);o.setAttribute("id",a),this._element.setAttribute("aria-describedby",a),this.setContent(),this.config.animation&&o.classList.add("fade");const l="function"==typeof this.config.placement?this.config.placement.call(this,o,this._element):this.config.placement,c=this._getAttachment(l);this._addAttachmentClass(c);const u=this._getContainer();v.set(o,this.constructor.DATA_KEY,this),this._element.ownerDocument.documentElement.contains(this.tip)||(u.appendChild(o),L.trigger(this._element,this.constructor.Event.INSERTED)),this._popper?this._popper.update():this._popper=oe(this._element,o,this._getPopperConfig(c)),o.classList.add("show");const d="function"==typeof this.config.customClass?this.config.customClass():this.config.customClass;d&&o.classList.add(...d.split(" ")),"ontouchstart"in document.documentElement&&[].concat(...document.body.children).forEach((t=>{L.on(t,"mouseover",(function(){}))}));const h=()=>{const t=this._hoverState;this._hoverState=null,L.trigger(this._element,this.constructor.Event.SHOWN),"out"===t&&this._leave(null,this)};if(this.tip.classList.contains("fade")){const t=i(this.tip);L.one(this.tip,"transitionend",h),s(this.tip,t)}else h()}hide(){if(!this._popper)return;const t=this.getTipElement(),e=()=>{this._isWithActiveTrigger()||("show"!==this._hoverState&&t.parentNode&&t.parentNode.removeChild(t),this._cleanTipClass(),this._element.removeAttribute("aria-describedby"),L.trigger(this._element,this.constructor.Event.HIDDEN),this._popper&&(this._popper.destroy(),this._popper=null))};if(!L.trigger(this._element,this.constructor.Event.HIDE).defaultPrevented){if(t.classList.remove("show"),"ontouchstart"in document.documentElement&&[].concat(...document.body.children).forEach((t=>L.off(t,"mouseover",d))),this._activeTrigger.click=!1,this._activeTrigger.focus=!1,this._activeTrigger.hover=!1,this.tip.classList.contains("fade")){const n=i(t);L.one(t,"transitionend",e),s(t,n)}else e();this._hoverState=""}}update(){null!==this._popper&&this._popper.update()}isWithContent(){return Boolean(this.getTitle())}getTipElement(){if(this.tip)return this.tip;const t=document.createElement("div");return t.innerHTML=this.config.template,this.tip=t.children[0],this.tip}setContent(){const t=this.getTipElement();this.setElementContent(q.findOne(".tooltip-inner",t),this.getTitle()),t.classList.remove("fade","show")}setElementContent(t,e){if(null!==t)return"object"==typeof e&&a(e)?(e.jquery&&(e=e[0]),void(this.config.html?e.parentNode!==t&&(t.innerHTML="",t.appendChild(e)):t.textContent=e.textContent)):void(this.config.html?(this.config.sanitize&&(e=Ce(e,this.config.allowList,this.config.sanitizeFn)),t.innerHTML=e):t.textContent=e)}getTitle(){let t=this._element.getAttribute("data-bs-original-title");return t||(t="function"==typeof this.config.title?this.config.title.call(this._element):this.config.title),t}updateAttachment(t){return"right"===t?"end":"left"===t?"start":t}_initializeOnDelegatedTarget(t,e){const n=this.constructor.DATA_KEY;return(e=e||v.get(t.delegateTarget,n))||(e=new this.constructor(t.delegateTarget,this._getDelegateConfig()),v.set(t.delegateTarget,n,e)),e}_getOffset(){const{offset:t}=this.config;return"string"==typeof t?t.split(",").map((t=>Number.parseInt(t,10))):"function"==typeof t?e=>t(e,this._element):t}_getPopperConfig(t){const e={placement:t,modifiers:[{name:"flip",options:{altBoundary:!0,fallbackPlacements:this.config.fallbackPlacements}},{name:"offset",options:{offset:this._getOffset()}},{name:"preventOverflow",options:{boundary:this.config.boundary}},{name:"arrow",options:{element:`.${this.constructor.NAME}-arrow`}},{name:"onChange",enabled:!0,phase:"afterWrite",fn:t=>this._handlePopperPlacementChange(t)}],onFirstUpdate:t=>{t.options.placement!==t.placement&&this._handlePopperPlacementChange(t)}};return{...e,..."function"==typeof this.config.popperConfig?this.config.popperConfig(e):this.config.popperConfig}}_addAttachmentClass(t){this.getTipElement().classList.add("bs-tooltip-"+this.updateAttachment(t))}_getContainer(){return!1===this.config.container?document.body:a(this.config.container)?this.config.container:q.findOne(this.config.container)}_getAttachment(t){return Ie[t.toUpperCase()]}_setListeners(){this.config.trigger.split(" ").forEach((t=>{if("click"===t)L.on(this._element,this.constructor.Event.CLICK,this.config.selector,(t=>this.toggle(t)));else if("manual"!==t){const e="hover"===t?this.constructor.Event.MOUSEENTER:this.constructor.Event.FOCUSIN,n="hover"===t?this.constructor.Event.MOUSELEAVE:this.constructor.Event.FOCUSOUT;L.on(this._element,e,this.config.selector,(t=>this._enter(t))),L.on(this._element,n,this.config.selector,(t=>this._leave(t)))}})),this._hideModalHandler=()=>{this._element&&this.hide()},L.on(this._element.closest(".modal"),"hide.bs.modal",this._hideModalHandler),this.config.selector?this.config={...this.config,trigger:"manual",selector:""}:this._fixTitle()}_fixTitle(){const t=this._element.getAttribute("title"),e=typeof this._element.getAttribute("data-bs-original-title");(t||"string"!==e)&&(this._element.setAttribute("data-bs-original-title",t||""),!t||this._element.getAttribute("aria-label")||this._element.textContent||this._element.setAttribute("aria-label",t),this._element.setAttribute("title",""))}_enter(t,e){e=this._initializeOnDelegatedTarget(t,e),t&&(e._activeTrigger["focusin"===t.type?"focus":"hover"]=!0),e.getTipElement().classList.contains("show")||"show"===e._hoverState?e._hoverState="show":(clearTimeout(e._timeout),e._hoverState="show",e.config.delay&&e.config.delay.show?e._timeout=setTimeout((()=>{"show"===e._hoverState&&e.show()}),e.config.delay.show):e.show())}_leave(t,e){e=this._initializeOnDelegatedTarget(t,e),t&&(e._activeTrigger["focusout"===t.type?"focus":"hover"]=e._element.contains(t.relatedTarget)),e._isWithActiveTrigger()||(clearTimeout(e._timeout),e._hoverState="out",e.config.delay&&e.config.delay.hide?e._timeout=setTimeout((()=>{"out"===e._hoverState&&e.hide()}),e.config.delay.hide):e.hide())}_isWithActiveTrigger(){for(const t in this._activeTrigger)if(this._activeTrigger[t])return!0;return!1}_getConfig(t){const e=R.getDataAttributes(this._element);return Object.keys(e).forEach((t=>{Le.has(t)&&delete e[t]})),t&&"object"==typeof t.container&&t.container.jquery&&(t.container=t.container[0]),"number"==typeof(t={...this.constructor.Default,...e,..."object"==typeof t&&t?t:{}}).delay&&(t.delay={show:t.delay,hide:t.delay}),"number"==typeof t.title&&(t.title=t.title.toString()),"number"==typeof t.content&&(t.content=t.content.toString()),l("tooltip",t,this.constructor.DefaultType),t.sanitize&&(t.template=Ce(t.template,t.allowList,t.sanitizeFn)),t}_getDelegateConfig(){const t={};if(this.config)for(const e in this.config)this.constructor.Default[e]!==this.config[e]&&(t[e]=this.config[e]);return t}_cleanTipClass(){const t=this.getTipElement(),e=t.getAttribute("class").match(De);null!==e&&e.length>0&&e.map((t=>t.trim())).forEach((e=>t.classList.remove(e)))}_handlePopperPlacementChange(t){const{state:e}=t;e&&(this.tip=e.elements.popper,this._cleanTipClass(),this._addAttachmentClass(this._getAttachment(e.placement)))}static jQueryInterface(t){return this.each((function(){let e=v.get(this,"bs.tooltip");const n="object"==typeof t&&t;if((e||!/dispose|hide/.test(t))&&(e||(e=new je(this,n)),"string"==typeof t)){if(void 0===e[t])throw new TypeError(`No method named "${t}"`);e[t]()}}))}}g("tooltip",je);const Re=new RegExp("(^|\\s)bs-popover\\S+","g"),qe={...je.Default,placement:"right",offset:[0,8],trigger:"click",content:"",template:''},Fe={...je.DefaultType,content:"(string|element|function)"},ze={HIDE:"hide.bs.popover",HIDDEN:"hidden.bs.popover",SHOW:"show.bs.popover",SHOWN:"shown.bs.popover",INSERTED:"inserted.bs.popover",CLICK:"click.bs.popover",FOCUSIN:"focusin.bs.popover",FOCUSOUT:"focusout.bs.popover",MOUSEENTER:"mouseenter.bs.popover",MOUSELEAVE:"mouseleave.bs.popover"};class Ue extends je{static get Default(){return qe}static get NAME(){return"popover"}static get DATA_KEY(){return"bs.popover"}static get Event(){return ze}static get EVENT_KEY(){return".bs.popover"}static get DefaultType(){return Fe}isWithContent(){return this.getTitle()||this._getContent()}setContent(){const t=this.getTipElement();this.setElementContent(q.findOne(".popover-header",t),this.getTitle());let e=this._getContent();"function"==typeof e&&(e=e.call(this._element)),this.setElementContent(q.findOne(".popover-body",t),e),t.classList.remove("fade","show")}_addAttachmentClass(t){this.getTipElement().classList.add("bs-popover-"+this.updateAttachment(t))}_getContent(){return this._element.getAttribute("data-bs-content")||this.config.content}_cleanTipClass(){const t=this.getTipElement(),e=t.getAttribute("class").match(Re);null!==e&&e.length>0&&e.map((t=>t.trim())).forEach((e=>t.classList.remove(e)))}static jQueryInterface(t){return this.each((function(){let e=v.get(this,"bs.popover");const n="object"==typeof t?t:null;if((e||!/dispose|hide/.test(t))&&(e||(e=new Ue(this,n),v.set(this,"bs.popover",e)),"string"==typeof t)){if(void 0===e[t])throw new TypeError(`No method named "${t}"`);e[t]()}}))}}g("popover",Ue);const Ve={offset:10,method:"auto",target:""},He={offset:"number",method:"string",target:"(string|element)"};class Ge extends O{constructor(t,e){super(t),this._scrollElement="BODY"===this._element.tagName?window:this._element,this._config=this._getConfig(e),this._selector=`${this._config.target} .nav-link, ${this._config.target} .list-group-item, ${this._config.target} .dropdown-item`,this._offsets=[],this._targets=[],this._activeTarget=null,this._scrollHeight=0,L.on(this._scrollElement,"scroll.bs.scrollspy",(()=>this._process())),this.refresh(),this._process()}static get Default(){return Ve}static get DATA_KEY(){return"bs.scrollspy"}refresh(){const t=this._scrollElement===this._scrollElement.window?"offset":"position",e="auto"===this._config.method?t:this._config.method,r="position"===e?this._getScrollTop():0;this._offsets=[],this._targets=[],this._scrollHeight=this._getScrollHeight(),q.find(this._selector).map((t=>{const i=n(t),o=i?q.findOne(i):null;if(o){const t=o.getBoundingClientRect();if(t.width||t.height)return[R[e](o).top+r,i]}return null})).filter((t=>t)).sort(((t,e)=>t[0]-e[0])).forEach((t=>{this._offsets.push(t[0]),this._targets.push(t[1])}))}dispose(){super.dispose(),L.off(this._scrollElement,".bs.scrollspy"),this._scrollElement=null,this._config=null,this._selector=null,this._offsets=null,this._targets=null,this._activeTarget=null,this._scrollHeight=null}_getConfig(e){if("string"!=typeof(e={...Ve,..."object"==typeof e&&e?e:{}}).target&&a(e.target)){let{id:n}=e.target;n||(n=t("scrollspy"),e.target.id=n),e.target="#"+n}return l("scrollspy",e,He),e}_getScrollTop(){return this._scrollElement===window?this._scrollElement.pageYOffset:this._scrollElement.scrollTop}_getScrollHeight(){return this._scrollElement.scrollHeight||Math.max(document.body.scrollHeight,document.documentElement.scrollHeight)}_getOffsetHeight(){return this._scrollElement===window?window.innerHeight:this._scrollElement.getBoundingClientRect().height}_process(){const t=this._getScrollTop()+this._config.offset,e=this._getScrollHeight(),n=this._config.offset+e-this._getOffsetHeight();if(this._scrollHeight!==e&&this.refresh(),t>=n){const t=this._targets[this._targets.length-1];this._activeTarget!==t&&this._activate(t)}else{if(this._activeTarget&&t0)return this._activeTarget=null,void this._clear();for(let e=this._offsets.length;e--;)this._activeTarget!==this._targets[e]&&t>=this._offsets[e]&&(void 0===this._offsets[e+1]||t`${e}[data-bs-target="${t}"],${e}[href="${t}"]`)),n=q.findOne(e.join(","));n.classList.contains("dropdown-item")?(q.findOne(".dropdown-toggle",n.closest(".dropdown")).classList.add("active"),n.classList.add("active")):(n.classList.add("active"),q.parents(n,".nav, .list-group").forEach((t=>{q.prev(t,".nav-link, .list-group-item").forEach((t=>t.classList.add("active"))),q.prev(t,".nav-item").forEach((t=>{q.children(t,".nav-link").forEach((t=>t.classList.add("active")))}))}))),L.trigger(this._scrollElement,"activate.bs.scrollspy",{relatedTarget:t})}_clear(){q.find(this._selector).filter((t=>t.classList.contains("active"))).forEach((t=>t.classList.remove("active")))}static jQueryInterface(t){return this.each((function(){let e=v.get(this,"bs.scrollspy");if(e||(e=new Ge(this,"object"==typeof t&&t)),"string"==typeof t){if(void 0===e[t])throw new TypeError(`No method named "${t}"`);e[t]()}}))}}L.on(window,"load.bs.scrollspy.data-api",(()=>{q.find('[data-bs-spy="scroll"]').forEach((t=>new Ge(t,R.getDataAttributes(t))))})),g("scrollspy",Ge);class Ye extends O{static get DATA_KEY(){return"bs.tab"}show(){if(this._element.parentNode&&this._element.parentNode.nodeType===Node.ELEMENT_NODE&&this._element.classList.contains("active")||u(this._element))return;let t;const e=r(this._element),n=this._element.closest(".nav, .list-group");if(n){const e="UL"===n.nodeName||"OL"===n.nodeName?":scope > li > .active":".active";t=q.find(e,n),t=t[t.length-1]}const i=t?L.trigger(t,"hide.bs.tab",{relatedTarget:this._element}):null;if(L.trigger(this._element,"show.bs.tab",{relatedTarget:t}).defaultPrevented||null!==i&&i.defaultPrevented)return;this._activate(this._element,n);const o=()=>{L.trigger(t,"hidden.bs.tab",{relatedTarget:this._element}),L.trigger(this._element,"shown.bs.tab",{relatedTarget:t})};e?this._activate(e,e.parentNode,o):o()}_activate(t,e,n){const r=(!e||"UL"!==e.nodeName&&"OL"!==e.nodeName?q.children(e,".active"):q.find(":scope > li > .active",e))[0],o=n&&r&&r.classList.contains("fade"),a=()=>this._transitionComplete(t,r,n);if(r&&o){const t=i(r);r.classList.remove("show"),L.one(r,"transitionend",a),s(r,t)}else a()}_transitionComplete(t,e,n){if(e){e.classList.remove("active");const t=q.findOne(":scope > .dropdown-menu .active",e.parentNode);t&&t.classList.remove("active"),"tab"===e.getAttribute("role")&&e.setAttribute("aria-selected",!1)}t.classList.add("active"),"tab"===t.getAttribute("role")&&t.setAttribute("aria-selected",!0),h(t),t.classList.contains("fade")&&t.classList.add("show"),t.parentNode&&t.parentNode.classList.contains("dropdown-menu")&&(t.closest(".dropdown")&&q.find(".dropdown-toggle").forEach((t=>t.classList.add("active"))),t.setAttribute("aria-expanded",!0)),n&&n()}static jQueryInterface(t){return this.each((function(){const e=v.get(this,"bs.tab")||new Ye(this);if("string"==typeof t){if(void 0===e[t])throw new TypeError(`No method named "${t}"`);e[t]()}}))}}L.on(document,"click.bs.tab.data-api",'[data-bs-toggle="tab"], [data-bs-toggle="pill"], [data-bs-toggle="list"]',(function(t){t.preventDefault(),(v.get(this,"bs.tab")||new Ye(this)).show()})),g("tab",Ye);const We={animation:"boolean",autohide:"boolean",delay:"number"},$e={animation:!0,autohide:!0,delay:5e3};class Ke extends O{constructor(t,e){super(t),this._config=this._getConfig(e),this._timeout=null,this._setListeners()}static get DefaultType(){return We}static get Default(){return $e}static get DATA_KEY(){return"bs.toast"}show(){if(L.trigger(this._element,"show.bs.toast").defaultPrevented)return;this._clearTimeout(),this._config.animation&&this._element.classList.add("fade");const t=()=>{this._element.classList.remove("showing"),this._element.classList.add("show"),L.trigger(this._element,"shown.bs.toast"),this._config.autohide&&(this._timeout=setTimeout((()=>{this.hide()}),this._config.delay))};if(this._element.classList.remove("hide"),h(this._element),this._element.classList.add("showing"),this._config.animation){const e=i(this._element);L.one(this._element,"transitionend",t),s(this._element,e)}else t()}hide(){if(!this._element.classList.contains("show"))return;if(L.trigger(this._element,"hide.bs.toast").defaultPrevented)return;const t=()=>{this._element.classList.add("hide"),L.trigger(this._element,"hidden.bs.toast")};if(this._element.classList.remove("show"),this._config.animation){const e=i(this._element);L.one(this._element,"transitionend",t),s(this._element,e)}else t()}dispose(){this._clearTimeout(),this._element.classList.contains("show")&&this._element.classList.remove("show"),L.off(this._element,"click.dismiss.bs.toast"),super.dispose(),this._config=null}_getConfig(t){return t={...$e,...R.getDataAttributes(this._element),..."object"==typeof t&&t?t:{}},l("toast",t,this.constructor.DefaultType),t}_setListeners(){L.on(this._element,"click.dismiss.bs.toast",'[data-bs-dismiss="toast"]',(()=>this.hide()))}_clearTimeout(){clearTimeout(this._timeout),this._timeout=null}static jQueryInterface(t){return this.each((function(){let e=v.get(this,"bs.toast");if(e||(e=new Ke(this,"object"==typeof t&&t)),"string"==typeof t){if(void 0===e[t])throw new TypeError(`No method named "${t}"`);e[t](this)}}))}}return g("toast",Ke),{Alert:I,Button:B,Carousel:Y,Collapse:K,Dropdown:ge,Modal:ye,Offcanvas:Ee,Popover:Ue,ScrollSpy:Ge,Tab:Ye,Toast:Ke,Tooltip:je}})),function(t,e){if("object"==typeof module&&module.exports){var n=require("d3");module.exports=e(n)}else if("function"==typeof define&&define.amd){try{n=require("d3")}catch(e){n=t.d3}n.contextMenu=e(n),define([],(function(){return n.contextMenu}))}else t.d3&&(t.d3.contextMenu=e(t.d3))}(this,(function(t){var e={noop:function(){},isFn:function(t){return"function"==typeof t},const:function(t){return function(){return t}},toFactory:function(t,n){return t=void 0===t?n:t,e.isFn(t)?t:e.const(t)}},n=null,r=function(){n&&(t.select(".d3-context-menu").remove(),t.select("body").on("mousedown.d3-context-menu",null),n.boundCloseCallback(),n=null)};return function(i,o){if("close"===i)return r();i=e.toFactory(i);var a=(o=e.isFn(o)?{onOpen:o}:o||{}).onOpen||e.noop,s=o.onClose||e.noop,l=e.toFactory(o.position),c=e.toFactory(o.theme,"d3-context-menu-theme");return function(o,u){var f,d=this;if(void 0===t.event?(f=o,u,void 0):(f=t.event,o,u),r(),n={boundCloseCallback:s.bind(d,o,u)},t.selectAll(".d3-context-menu").data([1]).enter().append("div").attr("class","d3-context-menu "+c.bind(d)(o,u)),t.select("body").on("mousedown.d3-context-menu",r),t.select("body").on("click.d3-context-menu",r),t.selectAll(".d3-context-menu").on("contextmenu",(function(){r(),f.preventDefault(),f.stopPropagation()})).append("ul").call((function n(a,s,l=0){var c=function(t){return e.toFactory(t).call(s,o,u)};a.selectAll("li").data((function(t){var e=0===l?i:t.children;return c(e)})).enter().append("li").each((function(e){var i=!!c(e.divider),a=!!c(e.disabled),f=!!c(e.children),d=!!e.action,h=i?"
              ":c(e.title),p=t.select(this).classed("is-divider",i).classed("is-disabled",a).classed("is-header",!f&&!d).classed("is-parent",f).html(h).on("click",(function(){!a&&d&&(e.action.call(s,o,u),r())}));if(f){var m=p.append("ul").classed("is-children",!0);n(m,s,++l)}}))}),d),!1!==a.bind(d)(o,u)){var h=l.bind(d)(o,u),p=document.documentElement,m=window.innerWidth||p.clientWidth,g=window.innerHeight||p.clientHeight,b="left",v="right",y=h?h.left:f.pageX-2;f.pageX>m/2&&(b="right",v="left",y=h?m-h.left:m-f.pageX-2);var _="top",w="bottom",x=h?h.top:f.pageY-2;f.pageY>g/2&&(_="bottom",w="top",x=h?g-h.top:g-f.pageY-2),t.select(".d3-context-menu").style(b,y+"px").style(v,null).style(_,x+"px").style(w,null).style("display","block"),f.preventDefault(),f.stopPropagation()}}}})),function(t){"undefined"!=typeof module&&"object"==typeof exports?module.exports=t():"undefined"!=typeof define&&define.amd?define(["fflate",t]):("undefined"!=typeof self?self:this).fflate=t()}((function(){var t={},e=("undefined"!=typeof module&&"object"==typeof exports?function(t){"use strict";var e;try{e=require("worker_threads").Worker}catch(e){}return exports.default=e?function(t,n,r,i,o){var a=!1,s=new e(t+";var __w=require('worker_threads');__w.parentPort.on('message',function(m){onmessage({data:m})}),postMessage=function(m,t){__w.parentPort.postMessage(m,t)},close=process.exit;self=global",{eval:!0}).on("error",(function(t){return o(t,null)})).on("message",(function(t){return o(null,t)})).on("exit",(function(t){t&&!a&&o(Error("exited with code "+t),null)}));return s.postMessage(r,i),s.terminate=function(){return a=!0,e.prototype.terminate.call(s)},s}:function(t,e,n,r,i){setImmediate((function(){return i(Error("async operations unsupported - update to Node 12+ (or Node 10-11 with the --experimental-worker CLI flag)"),null)}));var o=function(){};return{terminate:o,postMessage:o}},t}:function(t){"use strict";var e={},n=function(t){return URL.createObjectURL(new Blob([t],{type:"text/javascript"}))},r=function(t){return new Worker(t)};try{URL.revokeObjectURL(n(""))}catch(e){n=function(t){return"data:application/javascript;charset=UTF-8,"+encodeURI(t)},r=function(t){return new Worker(t,{type:"module"})}}return t.default=function(t,i,o,a,s){var l=r(e[i]||(e[i]=n(t)));return l.onerror=function(t){return s(t.error,null)},l.onmessage=function(t){return s(null,t.data)},l.postMessage(o,a),l},t})({}),n=Uint8Array,r=Uint16Array,i=Uint32Array,o=new n([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),a=new n([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),s=new n([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),l=function(t,e){for(var n=new r(31),o=0;o<31;++o)n[o]=e+=1<>>1|(21845&g)<<1;m[g]=((65280&(b=(61680&(b=(52428&b)>>>2|(13107&b)<<2))>>>4|(3855&b)<<4))>>>8|(255&b)<<8)>>>1}var v=function(t,e,n){for(var i=t.length,o=0,a=new r(e);o>>c]=u}else for(s=new r(i),o=0;o>>15-t[o]);return s},y=new n(288);for(g=0;g<144;++g)y[g]=8;for(g=144;g<256;++g)y[g]=9;for(g=256;g<280;++g)y[g]=7;for(g=280;g<288;++g)y[g]=8;var _=new n(32);for(g=0;g<32;++g)_[g]=5;var w=v(y,9,0),x=v(y,9,1),T=v(_,5,0),A=v(_,5,1),E=function(t){for(var e=t[0],n=1;ne&&(e=t[n]);return e},M=function(t,e,n){var r=e/8|0;return(t[r]|t[r+1]<<8)>>(7&e)&n},S=function(t,e){var n=e/8|0;return(t[n]|t[n+1]<<8|t[n+2]<<16)>>(7&e)},N=function(t){return(t/8|0)+(7&t&&1)},k=function(t,e,o){(null==e||e<0)&&(e=0),(null==o||o>t.length)&&(o=t.length);var a=new(t instanceof r?r:t instanceof i?i:n)(o-e);return a.set(t.subarray(e,o)),a},C=function(t,e,r){var i=t.length;if(!i||r&&!r.l&&i<5)return e||new n(0);var l=!e||r,c=!r||r.i;r||(r={}),e||(e=new n(3*i));var f=function(t){var r=e.length;if(t>r){var i=new n(Math.max(2*r,t));i.set(e),e=i}},d=r.f||0,p=r.p||0,m=r.b||0,g=r.l,b=r.d,y=r.m,_=r.n,w=8*i;do{if(!g){r.f=d=M(t,p,1);var T=M(t,p+1,3);if(p+=3,!T){var C=t[(z=N(p)+4)-4]|t[z-3]<<8,D=z+C;if(D>i){if(c)throw"unexpected EOF";break}l&&f(m+C),e.set(t.subarray(z,D),m),r.b=m+=C,r.p=p=8*D;continue}if(1==T)g=x,b=A,y=9,_=5;else{if(2!=T)throw"invalid block type";var L=M(t,p,31)+257,O=M(t,p+10,15)+4,I=L+M(t,p+5,31)+1;p+=14;for(var B=new n(I),P=new n(19),j=0;j>>4)<16)B[j++]=z;else{var V=0,H=0;for(16==z?(H=3+M(t,p,3),p+=2,V=B[j-1]):17==z?(H=3+M(t,p,7),p+=3):18==z&&(H=11+M(t,p,127),p+=7);H--;)B[j++]=V}}var G=B.subarray(0,L),Y=B.subarray(L);y=E(G),_=E(Y),g=v(G,y,1),b=v(Y,_,1)}if(p>w){if(c)throw"unexpected EOF";break}}l&&f(m+131072);for(var W=(1<>>4;if((p+=15&V)>w){if(c)throw"unexpected EOF";break}if(!V)throw"invalid length/literal";if(X<256)e[m++]=X;else{if(256==X){K=p,g=null;break}var Q=X-254;X>264&&(Q=M(t,p,(1<<(tt=o[j=X-257]))-1)+u[j],p+=tt);var Z=b[S(t,p)&$],J=Z>>>4;if(!Z)throw"invalid distance";if(p+=15&Z,Y=h[J],J>3){var tt=a[J];Y+=S(t,p)&(1<w){if(c)throw"unexpected EOF";break}l&&f(m+131072);for(var et=m+Q;m>>8},L=function(t,e,n){var r=e/8|0;t[r]|=n<<=7&e,t[r+1]|=n>>>8,t[r+2]|=n>>>16},O=function(t,e){for(var i=[],o=0;op&&(p=s[o].s);var m=new r(p+1),g=I(i[d-1],m,0);if(g>e){o=0;var b=0,v=g-e,y=1<e))break;b+=y-(1<>>=v;b>0;){var w=s[o].s;m[w]=0&&b;--o){var x=s[o].s;m[x]==e&&(--m[x],++b)}g=e}return[new n(m),g]},I=function(t,e,n){return-1==t.s?Math.max(I(t.l,e,n+1),I(t.r,e,n+1)):e[t.s]=n},B=function(t){for(var e=t.length;e&&!t[--e];);for(var n=new r(++e),i=0,o=t[0],a=1,s=function(t){n[i++]=t},l=1;l<=e;++l)if(t[l]==o&&l!=e)++a;else{if(!o&&a>2){for(;a>138;a-=138)s(32754);a>2&&(s(a>10?a-11<<5|28690:a-3<<5|12305),a=0)}else if(a>3){for(s(o),--a;a>6;a-=6)s(8304);a>2&&(s(a-3<<5|8208),a=0)}for(;a--;)s(o);a=1,o=t[l]}return[n.subarray(0,i),e]},P=function(t,e){for(var n=0,r=0;r>>8,t[i+2]=255^t[i],t[i+3]=255^t[i+1];for(var o=0;o4&&!z[s[V-1]];--V);var H,G,Y,W,$=h+5<<3,K=P(l,y)+P(c,_)+u,X=P(l,g)+P(c,A)+u+14+3*V+P(R,z)+(2*R[16]+3*R[17]+7*R[18]);if($<=K&&$<=X)return j(e,p,t.subarray(d,d+h));if(D(e,p,1+(X15&&(D(e,p,tt[q]>>>5&127),p+=tt[q]>>>12)}}else H=w,G=y,Y=T,W=_;for(q=0;q255){var et;L(e,p,H[257+(et=i[q]>>>18&31)]),p+=G[et+257],et>7&&(D(e,p,i[q]>>>23&31),p+=o[et]);var nt=31&i[q];L(e,p,Y[nt]),p+=W[nt],nt>3&&(L(e,p,i[q]>>>5&8191),p+=a[nt])}else L(e,p,H[i[q]]),p+=G[i[q]];return L(e,p,H[256]),p+G[256]},q=new i([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),F=new n(0),z=function(t,e,s,l,c,u){var d=t.length,h=new n(l+d+5*(1+Math.ceil(d/7e3))+c),m=h.subarray(l,h.length-c),g=0;if(!e||d<8)for(var b=0;b<=d;b+=65535){var v=b+65535;v>>13,w=8191&y,x=(1<7e3||B>24576)&&G>423){g=R(t,m,0,C,D,L,I,B,z,b-z,g),B=O=I=0,z=b;for(var Y=0;Y<286;++Y)D[Y]=0;for(Y=0;Y<30;++Y)L[Y]=0}var W=2,$=0,K=w,X=V-H&32767;if(G>2&&U==S(b-X))for(var Q=Math.min(_,G)-1,Z=Math.min(32767,b),J=Math.min(258,G);X<=Z&&--K&&V!=H;){if(t[b+W]==t[b+W-X]){for(var tt=0;ttW){if(W=tt,$=X,tt>Q)break;var et=Math.min(X,tt-2),nt=0;for(Y=0;Ynt&&(nt=it,H=rt)}}}X+=(V=H)-(H=T[V])+32768&32767}if($){C[B++]=268435456|f[W]<<18|p[$];var ot=31&f[W],at=31&p[$];I+=o[ot]+a[at],++D[257+ot],++L[at],P=b+W,++O}else C[B++]=t[b],++D[t[b]]}}g=R(t,m,u,C,D,L,I,B,z,b-z,g),!u&&7&g&&(g=j(m,g+1,F))}return k(h,0,l+N(g)+c)},U=function(){for(var t=new i(256),e=0;e<256;++e){for(var n=e,r=9;--r;)n=(1&n&&3988292384)^n>>>1;t[e]=n}return t}(),V=function(){var t=-1;return{p:function(e){for(var n=t,r=0;r>>8;t=n},d:function(){return~t}}},H=function(){var t=1,e=0;return{p:function(n){for(var r=t,i=e,o=n.length,a=0;a!=o;){for(var s=Math.min(a+2655,o);a>16),i=(65535&i)+15*(i>>16)}t=r,e=i},d:function(){return(255&(t%=65521))<<24|t>>>8<<16|(255&(e%=65521))<<8|e>>>8}}},G=function(t,e,n,r,i){return z(t,null==e.level?6:e.level,null==e.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(t.length)))):12+e.mem,n,r,!i)},Y=function(t,e){var n={};for(var r in t)n[r]=t[r];for(var r in e)n[r]=e[r];return n},W=function(t,e,n){for(var r=t(),i=""+t,o=i.slice(i.indexOf("[")+1,i.lastIndexOf("]")).replace(/ /g,"").split(","),a=0;a>>0},ut=function(t,e){return ct(t,e)+4294967296*ct(t,e+4)},ft=function(t,e,n){for(;n;++e)t[e]=n,n>>>=8},dt=function(t,e){var n=e.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=e.level<2?4:9==e.level?2:0,t[9]=3,0!=e.mtime&&ft(t,4,Math.floor(new Date(e.mtime||Date.now())/1e3)),n){t[3]=8;for(var r=0;r<=n.length;++r)t[r+10]=n.charCodeAt(r)}},ht=function(t){if(31!=t[0]||139!=t[1]||8!=t[2])throw"invalid gzip data";var e=t[3],n=10;4&e&&(n+=t[10]|2+(t[11]<<8));for(var r=(e>>3&1)+(e>>4&1);r>0;r-=!t[n++]);return n+(2&e)},pt=function(t){var e=t.length;return(t[e-4]|t[e-3]<<8|t[e-2]<<16|t[e-1]<<24)>>>0},mt=function(t){return 10+(t.filename&&t.filename.length+1||0)},gt=function(t,e){var n=e.level,r=0==n?0:n<6?1:9==n?3:2;t[0]=120,t[1]=r<<6|(r?32-2*r:1)},bt=function(t){if(8!=(15&t[0])||t[0]>>>4>7||(t[0]<<8|t[1])%31)throw"invalid zlib data";if(32&t[1])throw"invalid zlib data: preset dictionaries not supported"};function vt(t,e){return e||"function"!=typeof t||(e=t,t={}),this.ondata=e,t}var yt=function(){function t(t,e){e||"function"!=typeof t||(e=t,t={}),this.ondata=e,this.o=t||{}}return t.prototype.p=function(t,e){this.ondata(G(t,this.o,0,0,!e),e)},t.prototype.push=function(t,e){if(this.d)throw"stream finished";if(!this.ondata)throw"no stream handler";this.d=e,this.p(t,e||!1)},t}();t.Deflate=yt;var _t=function(t,e){st([Z,function(){return[at,yt]}],this,vt.call(this,t,e),(function(t){var e=new yt(t.data);onmessage=at(e)}),6)};function wt(t,e,n){if(n||(n=e,e={}),"function"!=typeof n)throw"no callback";return ot(t,e,[Z],(function(t){return rt(xt(t.data[0],t.data[1]))}),0,n)}function xt(t,e){return G(t,e||{},0,0)}t.AsyncDeflate=_t,t.deflate=wt,t.deflateSync=xt;var Tt=function(){function t(t){this.s={},this.p=new n(0),this.ondata=t}return t.prototype.e=function(t){if(this.d)throw"stream finished";if(!this.ondata)throw"no stream handler";var e=this.p.length,r=new n(e+t.length);r.set(this.p),r.set(t,e),this.p=r},t.prototype.c=function(t){this.d=this.s.i=t||!1;var e=this.s.b,n=C(this.p,this.o,this.s);this.ondata(k(n,e,this.s.b),this.d),this.o=k(n,this.s.b-32768),this.s.b=this.o.length,this.p=k(this.p,this.s.p/8|0),this.s.p&=7},t.prototype.push=function(t,e){this.e(t),this.c(e)},t}();t.Inflate=Tt;var At=function(t){this.ondata=t,st([Q,function(){return[at,Tt]}],this,0,(function(){var t=new Tt;onmessage=at(t)}),7)};function Et(t,e,n){if(n||(n=e,e={}),"function"!=typeof n)throw"no callback";return ot(t,e,[Q],(function(t){return rt(Mt(t.data[0],it(t.data[1])))}),1,n)}function Mt(t,e){return C(t,e)}t.AsyncInflate=At,t.inflate=Et,t.inflateSync=Mt;var St=function(){function t(t,e){this.c=V(),this.l=0,this.v=1,yt.call(this,t,e)}return t.prototype.push=function(t,e){yt.prototype.push.call(this,t,e)},t.prototype.p=function(t,e){this.c.p(t),this.l+=t.length;var n=G(t,this.o,this.v&&mt(this.o),e&&8,!e);this.v&&(dt(n,this.o),this.v=0),e&&(ft(n,n.length-8,this.c.d()),ft(n,n.length-4,this.l)),this.ondata(n,e)},t}();t.Gzip=St,t.Compress=St;var Nt=function(t,e){st([Z,J,function(){return[at,yt,St]}],this,vt.call(this,t,e),(function(t){var e=new St(t.data);onmessage=at(e)}),8)};function kt(t,e,n){if(n||(n=e,e={}),"function"!=typeof n)throw"no callback";return ot(t,e,[Z,J,function(){return[Ct]}],(function(t){return rt(Ct(t.data[0],t.data[1]))}),2,n)}function Ct(t,e){e||(e={});var n=V(),r=t.length;n.p(t);var i=G(t,e,mt(e),8),o=i.length;return dt(i,e),ft(i,o-8,n.d()),ft(i,o-4,r),i}t.AsyncGzip=Nt,t.AsyncCompress=Nt,t.gzip=kt,t.compress=kt,t.gzipSync=Ct,t.compressSync=Ct;var Dt=function(){function t(t){this.v=1,Tt.call(this,t)}return t.prototype.push=function(t,e){if(Tt.prototype.e.call(this,t),this.v){var n=this.p.length>3?ht(this.p):4;if(n>=this.p.length&&!e)return;this.p=this.p.subarray(n),this.v=0}if(e){if(this.p.length<8)throw"invalid gzip stream";this.p=this.p.subarray(0,-8)}Tt.prototype.c.call(this,e)},t}();t.Gunzip=Dt;var Lt=function(t){this.ondata=t,st([Q,tt,function(){return[at,Tt,Dt]}],this,0,(function(){var t=new Dt;onmessage=at(t)}),9)};function Ot(t,e,n){if(n||(n=e,e={}),"function"!=typeof n)throw"no callback";return ot(t,e,[Q,tt,function(){return[It]}],(function(t){return rt(It(t.data[0]))}),3,n)}function It(t,e){return C(t.subarray(ht(t),-8),e||new n(pt(t)))}t.AsyncGunzip=Lt,t.gunzip=Ot,t.gunzipSync=It;var Bt=function(){function t(t,e){this.c=H(),this.v=1,yt.call(this,t,e)}return t.prototype.push=function(t,e){yt.prototype.push.call(this,t,e)},t.prototype.p=function(t,e){this.c.p(t);var n=G(t,this.o,this.v&&2,e&&4,!e);this.v&&(gt(n,this.o),this.v=0),e&&ft(n,n.length-4,this.c.d()),this.ondata(n,e)},t}();t.Zlib=Bt;var Pt=function(t,e){st([Z,et,function(){return[at,yt,Bt]}],this,vt.call(this,t,e),(function(t){var e=new Bt(t.data);onmessage=at(e)}),10)};function jt(t,e){e||(e={});var n=H();n.p(t);var r=G(t,e,2,4);return gt(r,e),ft(r,r.length-4,n.d()),r}t.AsyncZlib=Pt,t.zlib=function(t,e,n){if(n||(n=e,e={}),"function"!=typeof n)throw"no callback";return ot(t,e,[Z,et,function(){return[jt]}],(function(t){return rt(jt(t.data[0],t.data[1]))}),4,n)},t.zlibSync=jt;var Rt=function(){function t(t){this.v=1,Tt.call(this,t)}return t.prototype.push=function(t,e){if(Tt.prototype.e.call(this,t),this.v){if(this.p.length<2&&!e)return;this.p=this.p.subarray(2),this.v=0}if(e){if(this.p.length<4)throw"invalid zlib stream";this.p=this.p.subarray(0,-4)}Tt.prototype.c.call(this,e)},t}();t.Unzlib=Rt;var qt=function(t){this.ondata=t,st([Q,nt,function(){return[at,Tt,Rt]}],this,0,(function(){var t=new Rt;onmessage=at(t)}),11)};function Ft(t,e,n){if(n||(n=e,e={}),"function"!=typeof n)throw"no callback";return ot(t,e,[Q,nt,function(){return[zt]}],(function(t){return rt(zt(t.data[0],it(t.data[1])))}),5,n)}function zt(t,e){return C((bt(t),t.subarray(2,-4)),e)}t.AsyncUnzlib=qt,t.unzlib=Ft,t.unzlibSync=zt;var Ut=function(){function t(t){this.G=Dt,this.I=Tt,this.Z=Rt,this.ondata=t}return t.prototype.push=function(t,e){if(!this.ondata)throw"no stream handler";if(this.s)this.s.push(t,e);else{if(this.p&&this.p.length){var r=new n(this.p.length+t.length);r.set(this.p),r.set(t,this.p.length)}else this.p=t;if(this.p.length>2){var i=this,o=function(){i.ondata.apply(i,arguments)};this.s=31==this.p[0]&&139==this.p[1]&&8==this.p[2]?new this.G(o):8!=(15&this.p[0])||this.p[0]>>4>7||(this.p[0]<<8|this.p[1])%31?new this.I(o):new this.Z(o),this.s.push(this.p,e),this.p=null}}},t}();t.Decompress=Ut;var Vt=function(){function t(t){this.G=Lt,this.I=At,this.Z=qt,this.ondata=t}return t.prototype.push=function(t,e){Ut.prototype.push.call(this,t,e)},t}();t.AsyncDecompress=Vt,t.decompress=function(t,e,n){if(n||(n=e,e={}),"function"!=typeof n)throw"no callback";return 31==t[0]&&139==t[1]&&8==t[2]?Ot(t,e,n):8!=(15&t[0])||t[0]>>4>7||(t[0]<<8|t[1])%31?Et(t,e,n):Ft(t,e,n)},t.decompressSync=function(t,e){return 31==t[0]&&139==t[1]&&8==t[2]?It(t,e):8!=(15&t[0])||t[0]>>4>7||(t[0]<<8|t[1])%31?Mt(t,e):zt(t,e)};var Ht=function(t,e,r,i){for(var o in t){var a=t[o],s=e+o;a instanceof n?r[s]=[a,i]:Array.isArray(a)?r[s]=[a[0],Y(i,a[1])]:Ht(a,s+"/",r,i)}},Gt="undefined"!=typeof TextEncoder&&new TextEncoder,Yt="undefined"!=typeof TextDecoder&&new TextDecoder,Wt=0;try{Yt.decode(F,{stream:!0}),Wt=1}catch(e){}var $t=function(t){for(var e="",n=0;;){var r=t[n++],i=(r>127)+(r>223)+(r>239);if(n+i>t.length)return[e,k(t,n-1)];i?3==i?(r=((15&r)<<18|(63&t[n++])<<12|(63&t[n++])<<6|63&t[n++])-65536,e+=String.fromCharCode(55296|r>>10,56320|1023&r)):e+=String.fromCharCode(1&i?(31&r)<<6|63&t[n++]:(15&r)<<12|(63&t[n++])<<6|63&t[n++]):e+=String.fromCharCode(r)}},Kt=function(){function t(t){this.ondata=t,Wt?this.t=new TextDecoder:this.p=F}return t.prototype.push=function(t,e){if(!this.ondata)throw"no callback";if(e=!!e,this.t){if(this.ondata(this.t.decode(t,{stream:!0}),e),e){if(this.t.decode().length)throw"invalid utf-8 data";this.t=null}}else{if(!this.p)throw"stream finished";var r=new n(this.p.length+t.length);r.set(this.p),r.set(t,this.p.length);var i=$t(r),o=i[0],a=i[1];if(e){if(a.length)throw"invalid utf-8 data";this.p=null}else this.p=a;this.ondata(o,e)}},t}();t.DecodeUTF8=Kt;var Xt=function(){function t(t){this.ondata=t}return t.prototype.push=function(t,e){if(!this.ondata)throw"no callback";if(this.d)throw"stream finished";this.ondata(Qt(t),this.d=e||!1)},t}();function Qt(t,e){if(e){for(var r=new n(t.length),i=0;i>1)),s=0,l=function(t){a[s++]=t};for(i=0;ia.length){var c=new n(s+8+(o-i<<1));c.set(a),a=c}var u=t.charCodeAt(i);u<128||e?l(u):u<2048?(l(192|u>>6),l(128|63&u)):u>55295&&u<57344?(l(240|(u=65536+(1047552&u)|1023&t.charCodeAt(++i))>>18),l(128|u>>12&63),l(128|u>>6&63),l(128|63&u)):(l(224|u>>12),l(128|u>>6&63),l(128|63&u))}return k(a,0,s)}function Zt(t,e){if(e){for(var n="",r=0;r65535)throw"extra field too long";e+=r+4}return e},ie=function(t,e,n,r,i,o,a,s){var l=r.length,c=n.extra,u=s&&s.length,f=re(c);ft(t,e,null!=a?33639248:67324752),e+=4,null!=a&&(t[e++]=20,t[e++]=n.os),t[e]=20,e+=2,t[e++]=n.flag<<1|(null==o&&8),t[e++]=i&&8,t[e++]=255&n.compression,t[e++]=n.compression>>8;var d=new Date(null==n.mtime?Date.now():n.mtime),h=d.getFullYear()-1980;if(h<0||h>119)throw"date not in range 1980-2099";if(ft(t,e,h<<25|d.getMonth()+1<<21|d.getDate()<<16|d.getHours()<<11|d.getMinutes()<<5|d.getSeconds()>>>1),e+=4,null!=o&&(ft(t,e,n.crc),ft(t,e+4,o),ft(t,e+8,n.size)),ft(t,e+12,l),ft(t,e+14,f),e+=16,null!=a&&(ft(t,e,u),ft(t,e+6,n.attrs),ft(t,e+10,a),e+=14),t.set(r,e),e+=l,f)for(var p in c){var m=c[p],g=m.length;ft(t,e,+p),ft(t,e+2,g),t.set(m,e+4),e+=4+g}return u&&(t.set(s,e),e+=u),e},oe=function(t,e,n,r,i){ft(t,e,101010256),ft(t,e+8,n),ft(t,e+10,n),ft(t,e+12,r),ft(t,e+16,i)},ae=function(){function t(t){this.filename=t,this.c=V(),this.size=0,this.compression=0}return t.prototype.process=function(t,e){this.ondata(null,t,e)},t.prototype.push=function(t,e){if(!this.ondata)throw"no callback - add to ZIP archive before pushing";this.c.p(t),this.size+=t.length,e&&(this.crc=this.c.d()),this.process(t,e||!1)},t}();t.ZipPassThrough=ae;var se=function(){function t(t,e){var n=this;e||(e={}),ae.call(this,t),this.d=new yt(e,(function(t,e){n.ondata(null,t,e)})),this.compression=8,this.flag=Jt(e.level)}return t.prototype.process=function(t,e){try{this.d.push(t,e)}catch(t){this.ondata(t,null,e)}},t.prototype.push=function(t,e){ae.prototype.push.call(this,t,e)},t}();t.ZipDeflate=se;var le=function(){function t(t,e){var n=this;e||(e={}),ae.call(this,t),this.d=new _t(e,(function(t,e,r){n.ondata(t,e,r)})),this.compression=8,this.flag=Jt(e.level),this.terminate=this.d.terminate}return t.prototype.process=function(t,e){this.d.push(t,e)},t.prototype.push=function(t,e){ae.prototype.push.call(this,t,e)},t}();t.AsyncZipDeflate=le;var ce=function(){function t(t){this.ondata=t,this.u=[],this.d=1}return t.prototype.add=function(t){var e=this;if(2&this.d)throw"stream finished";var r=Qt(t.filename),i=r.length,o=t.comment,a=o&&Qt(o),s=i!=t.filename.length||a&&o.length!=a.length,l=i+re(t.extra)+30;if(i>65535)throw"filename too long";var c=new n(l);ie(c,0,t,r,s);var u=[c],f=function(){for(var t=0,n=u;t65535&&A("filename too long",null),T)if(g<16e4)try{A(null,xt(c,p))}catch(t){A(t,null)}else f.push(wt(c,p,A));else A(null,c)},m=0;m65535)throw"filename too long";var b=f?xt(c,u):c,v=b.length,y=V();y.p(c),i.push(Y(u,{size:c.length,crc:y.d(),c:b,f:A,m:p,u:d!=s.length||p&&h.length!=m,o:o,compression:f})),o+=30+d+g+v,a+=76+2*(d+g)+(m||0)+v}for(var _=new n(a+22),w=o,x=a-o,T=0;T0){var i=Math.min(this.c,t.length),o=t.subarray(0,i);if(this.c-=i,this.d?this.d.push(o,!this.c):this.k[0].push(o),(t=t.subarray(i)).length)return this.push(t,e)}else{var a=0,s=0,l=void 0,c=void 0;this.p.length?t.length?((c=new n(this.p.length+t.length)).set(this.p),c.set(t,this.p.length)):c=this.p:c=t;for(var u=c.length,f=this.c,d=f&&this.d,h=function(){var t,e=ct(c,s);if(67324752==e){a=1,l=s,p.d=null,p.c=0;var n=lt(c,s+6),i=lt(c,s+8),o=2048&n,d=8&n,h=lt(c,s+26),m=lt(c,s+28);if(u>s+30+h+m){var g=[];p.k.unshift(g),a=2;var b,v=ct(c,s+18),y=ct(c,s+22),_=Zt(c.subarray(s+30,s+=30+h),!o);4294967295==v?(t=d?[-2]:ne(c,s),v=t[0],y=t[1]):d&&(v=-1),s+=m,p.c=v;var w={name:_,compression:i,start:function(){if(!w.ondata)throw"no callback";if(v){var t=r.o[i];if(!t)throw"unknown compression type "+i;(b=v<0?new t(_):new t(_,v,y)).ondata=function(t,e,n){w.ondata(t,e,n)};for(var e=0,n=g;e=0&&(w.size=v,w.originalSize=y),p.onfile(w)}return"break"}if(f){if(134695760==e)return l=s+=12+(-2==f&&8),a=3,p.c=0,"break";if(33639248==e)return l=s-=4,a=3,p.c=0,"break"}},p=this;s65558)return void e("invalid zip file",null);var s=lt(t,a+8);s||e(null,{});var l=s,c=ct(t,a+16),u=4294967295==c;if(u){if(a=ct(t,a-12),101075792!=ct(t,a))return void e("invalid zip file",null);l=s=ct(t,a+32),c=ct(t,a+48)}for(var f=function(a){var l=ee(t,c,u),f=l[0],d=l[1],h=l[2],p=l[3],m=l[4],g=te(t,l[5]);c=m;var b=function(t,n){t?(i(),e(t,null)):(o[p]=n,--s||e(null,o))};if(f)if(8==f){var v=t.subarray(g,g+d);if(d<32e4)try{b(null,Mt(v,new n(h)))}catch(t){b(t,null)}else r.push(Et(v,{size:h},b))}else b("unknown compression type "+f,null);else b(null,k(t,g,g+d))},d=0;d65558)throw"invalid zip file";var i=lt(t,r+8);if(!i)return{};var o=ct(t,r+16),a=4294967295==o;if(a){if(r=ct(t,r-12),101075792!=ct(t,r))throw"invalid zip file";i=ct(t,r+32),o=ct(t,r+48)}for(var s=0;s(n,r)=>(t.has(n)?t.get(n).add(r):t.set(n,(new Set).add(r)),e),a=(t,e)=>(r,i)=>{if(r!==n||i)if(i){const e=t.get(r);e&&(e.delete(i),0===e.size&&t.delete(r))}else t.delete(r);else t.clear();return e},s=(t,e)=>(t,n)=>e.on(t,(function r(...i){e.off(t,r),n.apply(e,i)})),l=(t,e)=>(r,...i)=>{const o=t.get(r);return o&&o.forEach((t=>t.apply(e,i))),t.get(n)&&r!==n&&e.trigger(n,r,...i),e},c=function(t){const e=new Map;return r(t=t||{},i({on:o,off:a,one:s,trigger:l}).reduce(((n,[r,i])=>(n[r]={value:i(e,t),enumerable:!1,writable:!1,configurable:!1},n)),{})),t};"object"==typeof exports?module.exports=c:"function"==typeof r&&r.amd?r((function(){return c})):t.observable=c}("undefined"!=typeof window?window:void 0),t=this,e=function(t){"use strict";function e(t){return t.replace(/-(\w)/g,((t,e)=>e.toUpperCase()))}function n(t,e){t.firstChild&&(e.appendChild(t.firstChild),n(t,e))}function r(t){Array.from(t).forEach(i)}const i=t=>t&&t.parentNode&&t.parentNode.removeChild(t),o=(t,e)=>e&&e.parentNode&&e.parentNode.insertBefore(t,e),a=new Map,s=Symbol("riot-component"),l=new Set,c="is",u="mount",f="update",d="unmount",h="shouldUpdate",p="onBeforeMount",m="onMounted",g="onBeforeUpdate",b="onUpdated",v="onBeforeUnmount",y="onUnmounted",_="props",w="state",x="slots",T="root",A=Symbol.for("pure"),E=Symbol("parent"),M=Symbol("attributes"),S=Symbol("template");var N=Object.freeze({__proto__:null,COMPONENTS_IMPLEMENTATION_MAP:a,DOM_COMPONENT_INSTANCE_PROPERTY:s,PLUGINS_SET:l,IS_DIRECTIVE:c,VALUE_ATTRIBUTE:"value",MOUNT_METHOD_KEY:u,UPDATE_METHOD_KEY:f,UNMOUNT_METHOD_KEY:d,SHOULD_UPDATE_KEY:h,ON_BEFORE_MOUNT_KEY:p,ON_MOUNTED_KEY:m,ON_BEFORE_UPDATE_KEY:g,ON_UPDATED_KEY:b,ON_BEFORE_UNMOUNT_KEY:v,ON_UNMOUNTED_KEY:y,PROPS_KEY:_,STATE_KEY:w,SLOTS_KEY:x,ROOT_KEY:T,IS_PURE_SYMBOL:A,PARENT_KEY_SYMBOL:E,ATTRIBUTES_KEY_SYMBOL:M,TEMPLATE_KEY_SYMBOL:S}),k={EACH:0,IF:1,SIMPLE:2,TAG:3,SLOT:4},C={ATTRIBUTE:0,EVENT:1,TEXT:2,VALUE:3};function D(t,e){return typeof t===e}function L(t){const e=t.ownerSVGElement;return!!e||null===e}function O(t){return!P(t.content)}function I(t){return D(t,"function")}function B(t){return!P(t)&&D(t,"object")}function P(t){return null==t}const j=Symbol("unmount"),R={nodes:[],mount(t,e){return this.update(t,e)},update(t,e){const{placeholder:n,nodes:r,childrenMap:a}=this,s=t===j?null:this.evaluate(t),l=s?Array.from(s):[],{newChildrenMap:c,batches:u,futureNodes:f}=(n.parentNode,function(t,e,n,r){const{condition:i,template:o,childrenMap:a,itemName:s,getKey:l,indexName:c,root:u,isTemplateTag:f}=r,d=new Map,h=[],p=[];return t.forEach(((t,r)=>{const m=function(t,e){let{itemName:n,indexName:r,index:i,item:o}=e;return t[n]=o,r&&(t[r]=i),t}(Object.create(e),{itemName:s,indexName:c,index:r,item:t}),g=l?l(m):r,b=a.get(g);if(function(t,e){return!!t&&!1===Boolean(t(e))}(i,m))return;const v=b?b.template:o.clone(),y=b?v.el:u.cloneNode(),_=!b,w=f&&_?function(t){const e=t.dom.cloneNode(!0);return{avoidDOMInjection:!0,fragment:e,children:Array.from(e.childNodes)}}(v):{};if(_?h.push((()=>v.mount(y,m,n,w))):h.push((()=>v.update(m,n))),f){const t=w.children||v.children;p.push(...t)}else p.push(y);a.delete(g),d.set(g,{template:v,context:m,index:r})})),{newChildrenMap:d,batches:h,futureNodes:p}}(l,t,e,this));return((t,e,n,r,a)=>{const s=n.length;let l=e.length,c=s,u=0,f=0,d=null;for(;ut-f){const i=r(e[u],0);for(;f{if(r<0){const n=t.pop();if(n){const{template:t,context:r}=n;t.unmount(r,e,null)}}return n}}(Array.from(a.values()),e),n),u.forEach((t=>t())),this.childrenMap=c,this.nodes=f,this},unmount(t,e){return this.update(j,e),this}},q={mount(t,e){return this.update(t,e)},update(t,e){const n=!!this.evaluate(t),r=!this.value&&n,i=this.value&&!n,a=()=>{const n=this.node.cloneNode();o(n,this.placeholder),this.template=this.template.clone(),this.template.mount(n,t,e)};switch(!0){case r:a();break;case i:this.unmount(t);break;default:n&&this.template.update(t,e)}return this.value=n,this},unmount(t,e){return this.template.unmount(t,e,!0),this}};function F(t){throw new Error(t)}function z(t){return t.reduce(((t,n)=>{const{value:r,type:i}=n;switch(!0){case!n.name&&0===i:return Object.assign({},t,r);case 3===i:t.value=n.value;break;default:t[e(n.name)]=n.value}return t}),{})}const U="undefined"==typeof Element?{}:Element.prototype,V=function(t){const e=new Map,n=n=>(e.has(n)||e.set(n,t.call(this,n)))&&e.get(n);return n.cache=e,n}((t=>U.hasOwnProperty(t)));const H=/^on/,G={handleEvent(t){this[t.type](t)}},Y=new WeakMap;function W(t){return P(t)?"":t}const $=(t,e)=>{const n=t.childNodes[e];if(n.nodeType===Node.COMMENT_NODE){const e=document.createTextNode("");return t.replaceChild(e,n),e}return n};var K={0:function t(e,n,r,i){let{name:o}=n;if(!o)return i&&function(t,e,n){const r=e?Object.keys(e):[];Object.keys(n).filter((t=>!r.includes(t))).forEach((e=>t.removeAttribute(e)))}(e,r,i),void(r&&function(e,n){Object.entries(n).forEach((n=>{let[r,i]=n;return t(e,{name:r},i)}))}(e,r));!V(o)&&(function(t){return D(t,"boolean")}(r)||B(r)||I(r))&&(e[o]=r),e[function(t){return P(t)||!1===t||""===t||B(t)||I(t)?"removeAttribute":"setAttribute"}(r)](o,function(t,e){return!0===e?t:e}(o,r))},1:function(t,e,n){let{name:r}=e;const i=r.replace(H,""),o=Y.get(t)||(t=>{const e=Object.create(G);return Y.set(t,e),e})(t),[a,s]=(t=>Array.isArray(t)?t:[t,!1])(n),l=o[i],c=a&&!l;l&&!a&&t.removeEventListener(i,o),c&&t.addEventListener(i,o,s),o[i]=a},2:function(t,e,n){t.data=W(n)},3:function(t,e,n){t.value=W(n)}};const X={mount(t){return this.value=this.evaluate(t),Q(this,this.value),this},update(t){const e=this.evaluate(t);return this.value!==e&&(Q(this,e),this.value=e),this},unmount(){return 1===this.type&&Q(this,null),this}};function Q(t,e){return K[t.type](t.node,t,e,t.value)}function Z(t,e){return Object.assign({},X,e,{node:2===e.type?$(t,e.childNodeIndex):t})}const J=(t,e)=>t[E]||e,tt={attributes:[],getTemplateScope(t,e){return function(t,e,n){if(!t||!t.length)return n;const r=t.map((t=>Object.assign({},t,{value:t.evaluate(e)})));return Object.assign(Object.create(n||null),z(r))}(this.attributes,t,e)},mount(t,e){const n=!!t.slots&&t.slots.find((t=>{let{id:e}=t;return e===this.name})),{parentNode:r}=this.node,o=J(t,e);return this.template=n&&ct(n.html,n.bindings).createDOM(r),this.template&&(this.template.mount(this.node,this.getTemplateScope(t,o),o),this.template.children=Array.from(this.node.childNodes),et(this.node)),i(this.node),this},update(t,e){if(this.template){const n=J(t,e);this.template.update(this.getTemplateScope(t,n),n)}return this},unmount(t,e,n){return this.template&&this.template.unmount(this.getTemplateScope(t,e),null,n),this}};function et(t){const e=t&&t.firstChild;e&&(o(e,t),et(t))}function nt(t){return t.reduce(((t,e)=>{let{bindings:n}=e;return t.concat(n)}),[])}const rt={mount(t){return this.update(t)},update(t,e){const n=this.evaluate(t);return n===this.name?this.tag.update(t):(this.unmount(t,e,!0),this.name=n,this.tag=function(t,e,n){return void 0===e&&(e=[]),void 0===n&&(n=[]),t?t({slots:e,attributes:n}):ct(function(t){return t.reduce(((t,e)=>t+e.html),"")}(e),[...nt(e),{expressions:n.map((t=>Object.assign({type:0},t)))}])}(this.getComponent(n),this.slots,this.attributes),this.tag.mount(this.node,t)),this},unmount(t,e,n){return this.tag&&this.tag.unmount(n),this}};var it={1:function(t,e){let{evaluate:n,template:r}=e;const a=document.createTextNode("");return o(a,t),i(t),Object.assign({},q,{node:t,evaluate:n,placeholder:a,template:r.createDOM(t)})},2:function(t,e){let{expressions:n}=e;return Object.assign({},(r=n.map((e=>Z(t,e))),["mount","update","unmount"].reduce(((t,e)=>Object.assign({},t,{[e]:t=>r.map((n=>n[e](t)))&&undefined})),{})));var r},0:function(t,e){let{evaluate:n,condition:r,itemName:a,indexName:s,getKey:l,template:c}=e;const u=document.createTextNode(""),f=t.cloneNode();return o(u,t),i(t),Object.assign({},R,{childrenMap:new Map,node:t,root:f,condition:r,evaluate:n,isTemplateTag:O(f),template:c.createDOM(t),getKey:l,indexName:s,itemName:a,placeholder:u})},3:function(t,e){let{evaluate:n,getComponent:r,slots:i,attributes:o}=e;return Object.assign({},rt,{node:t,evaluate:n,slots:i,attributes:o,getComponent:r})},4:function(t,e){let{name:n,attributes:r}=e;return Object.assign({},tt,{attributes:r,node:t,name:n})}};function ot(t,e){return t.map((t=>2===t.type?Object.assign({},t,{childNodeIndex:t.childNodeIndex+e}):t))}function at(t,e,n){const{selector:r,type:i,redundantAttribute:o,expressions:a}=e,s=r?t.querySelector(r):t;o&&s.removeAttribute(o);const l=a||[];return(it[i]||it[2])(s,Object.assign({},e,{expressions:n&&!r?ot(l,n):l}))}function st(t,e){switch(!0){case L(t):n(e,t);break;case O(t):t.parentNode.replaceChild(e,t);break;default:t.appendChild(e)}}const lt=Object.freeze({createDOM(t){return this.dom=this.dom||function(t,e){return e&&("string"==typeof e?function(t,e){return L(t)?function(t,e){return e.ownerDocument.importNode((new window.DOMParser).parseFromString(`${t}`,"application/xml").documentElement,!0)}(e,t):function(t,e){const n=O(e)?e:document.createElement("template");return n.innerHTML=t,n.content}(e,t)}(t,e):e)}(t,this.html),this},mount(t,e,n,r){if(void 0===r&&(r={}),!t)throw new Error("Please provide DOM node to mount properly your template");this.el&&this.unmount(e);const{fragment:i,children:o,avoidDOMInjection:a}=r,{parentNode:s}=o?o[0]:t,l=O(t),c=l?Math.max(Array.from(s.childNodes).indexOf(t),0):null;return this.isTemplateTag=l,this.createDOM(t),this.dom&&(this.fragment=i||this.dom.cloneNode(!0)),this.el=this.isTemplateTag?s:t,this.children=this.isTemplateTag?o||Array.from(this.fragment.childNodes):null,!a&&this.fragment&&st(t,this.fragment),this.bindings=this.bindingsData.map((t=>at(this.el,t,c))),this.bindings.forEach((t=>t.mount(e,n))),this},update(t,e){return this.bindings.forEach((n=>n.update(t,e))),this},unmount(t,e,n){if(this.el){switch(this.bindings.forEach((r=>r.unmount(t,e,n))),!0){case this.el[A]:break;case this.children&&null!==n:r(this.children);break;case!0===n:i(this.el);break;case null!==n:r(this.el.childNodes)}this.el=null}return this},clone(){return Object.assign({},this,{el:null})}});function ct(t,e){return void 0===e&&(e=[]),Object.assign({},lt,{html:t,bindingsData:e})}var ut=Object.freeze({__proto__:null,template:ct,createBinding:at,createExpression:Z,bindingTypes:k,expressionTypes:C});function ft(){return this}function dt(t){return I(t)?t.prototype&&t.prototype.constructor?new t:t():t}function ht(t,e,n,r){return void 0===r&&(r={}),Object.defineProperty(t,e,Object.assign({value:n,enumerable:!1,writable:!1,configurable:!0},r)),t}function pt(t,e,n){return Object.entries(e).forEach((e=>{let[r,i]=e;ht(t,r,i,n)})),t}function mt(t,e){return Object.entries(e).forEach((e=>{let[n,r]=e;t[n]||(t[n]=r)})),t}function gt(t){return Array.isArray(t)?t:/^\[object (HTMLCollection|NodeList|Object)\]$/.test(Object.prototype.toString.call(t))&&"number"==typeof t.length?Array.from(t):[t]}function bt(t,e){return gt("string"==typeof t?(e||document).querySelectorAll(t):t)}const vt=t=>1===t.length?t[0]:t;function yt(t,e,n){const r="object"==typeof e?e:{[e]:n},i=Object.keys(r);return gt(t).forEach((t=>{i.forEach((e=>t.setAttribute(e,r[e])))})),t}const _t=new Map;var wt,xt={CSS_BY_NAME:_t,add(t,e){return _t.has(t)||(_t.set(t,e),this.inject()),this},inject(){return(wt||(yt(wt=bt("style[riot]")[0]||document.createElement("style"),"type","text/css"),wt.parentNode||document.head.appendChild(wt),wt)).innerHTML=[..._t.values()].join("\n"),this},remove(t){return _t.has(t)&&(_t.delete(t),this.inject()),this}};function Tt(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;rvt(r.map((e=>t.getAttribute(e)))))))}(t,e)}(t,c)||t.tagName.toLowerCase()}const Et=Object.freeze({$(t){return bt(t,this.root)[0]},$$(t){return bt(t,this.root)}}),Mt=Object.freeze({[u]:ft,[f]:ft,[d]:ft}),St=Object.freeze({[h]:ft,[p]:ft,[m]:ft,[g]:ft,[b]:ft,[v]:ft,[y]:ft}),Nt=Object.assign({},Mt,{clone:ft,createDOM:ft});function kt(t,n){return void 0===n&&(n={}),Object.assign({},function(t){return Array.from(t.attributes).reduce(((t,n)=>(t[e(n.name)]=n.value,t)),{})}(t),dt(n))}const Ct=(t,e)=>t[s]=e;function Dt(t){return[u,f,d].reduce(((e,n)=>(e[n]=t(n),e)),{})}function Lt(t){let{css:e,template:n,exports:r,name:i}=t;const o=n?function(t,e){return t(ct,C,k,(t=>e[t]||a.get(t)))}(n,r?(void 0===(s=r.components)&&(s={}),Object.entries(dt(s)).reduce(((t,e)=>{let[n,r]=e;var i;return t[(i=n,i.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase())]=Lt(r),t}),{})):{}):Nt;var s;return t=>{let{slots:a,attributes:s,props:l}=t;if(r&&r[A])return function(t,e){let{slots:n,attributes:r,props:i,css:o,template:a}=e;a&&F("Pure components can not have html"),o&&F("Pure components do not have css");const s=mt(t({slots:n,attributes:r,props:i}),Mt);return Dt((t=>function(){for(var e=arguments.length,n=new Array(e),r=0;rf.mount(t,n,e),update:(t,e)=>f.update(e,t),unmount:t=>f.unmount(t)}}}function Ot(t){let{css:e,template:n,componentAPI:r,name:i}=t;return e&&i&&xt.add(i,e),Tt(Bt)(pt(mt(r,Object.assign({},St,{[w]:{}})),Object.assign({[x]:null,[T]:null},Et,{name:i,css:e,template:n})))}function It(t,e){return Object.assign({},t,dt(e))}function Bt(t,e){let{slots:n,attributes:r,props:i}=e;return o=function(t){return[...l].reduce(((t,e)=>e(t)||t),t)}(pt(Object.create(t),{mount(e,o,a){return void 0===o&&(o={}),this[M]=function(t,e){void 0===e&&(e=[]);const n=e.map((e=>Z(t,e))),r={};return Object.assign(r,Object.assign({expressions:n},Dt((t=>e=>(n.forEach((n=>n[t](e))),r)))))}(e,r).mount(a),ht(this,_,Object.freeze(Object.assign({},kt(e,i),z(this[M].expressions)))),this.state=It(this.state,o),this[S]=this.template.createDOM(e).clone(),Ct(e,this),t.name&&function(t,e){At(t)!==e&&yt(t,c,e)}(e,t.name),ht(this,T,e),ht(this,x,n),this.onBeforeMount(this.props,this.state),this[E]=a,this[S].mount(e,this,a),this.onMounted(this.props,this.state),this},update(t,e){void 0===t&&(t={}),e&&(this[E]=e,this[M].update(e));const n=z(this[M].expressions);if(!1!==this.shouldUpdate(n,this.props))return ht(this,_,Object.freeze(Object.assign({},this.props,n))),this.state=It(this.state,t),this.onBeforeUpdate(this.props,this.state),this[S].update(this,this[E]),this.onUpdated(this.props,this.state),this},unmount(t){return this.onBeforeUnmount(this.props,this.state),this[M].unmount(),this[S].unmount(this,this[E],null===t?null:!t),this.onUnmounted(this.props,this.state),this}})),Object.keys(t).filter((e=>I(t[e]))).forEach((t=>{o[t]=o[t].bind(o)})),o;var o}const{DOM_COMPONENT_INSTANCE_PROPERTY:Pt,COMPONENTS_IMPLEMENTATION_MAP:jt,PLUGINS_SET:Rt}=N,qt={cssManager:xt,DOMBindings:ut,createComponent:Lt,defineComponent:Ot,globals:N};t.__=qt,t.component=function(t){return function(e,n,r){let{slots:i,attributes:o,parentScope:a}=void 0===r?{}:r;return function(){for(var t=arguments.length,e=new Array(t),n=0;nfunction(){return t(e(...arguments))}))}((t=>t.mount(e,a)),(t=>t({props:n,slots:i,attributes:o})),Lt)(t)}},t.install=function(t){return I(t)||F("Plugins must be of type function"),Rt.has(t)&&F("This plugin was already installed"),Rt.add(t),Rt},t.mount=function(t,e,n){return bt(t).map((t=>function(t,e,n){const r=n||At(t);return a.has(r)||F(`The component named "${r}" was never registered`),a.get(r)({props:e}).mount(t)}(t,e,n)))},t.pure=function(t){return I(t)||F('riot.pure accepts only arguments of type "function"'),t[A]=!0,t},t.register=function(t,e){let{css:n,template:r,exports:i}=e;return jt.has(t)&&F(`The component "${t}" was already registered`),jt.set(t,Lt({name:t,css:n,template:r,exports:i})),jt},t.uninstall=function(t){return Rt.has(t)||F("This plugin was never installed"),Rt.delete(t),Rt},t.unmount=function(t,e){return bt(t).map((t=>(t[Pt]&&t[Pt].unmount(e),t)))},t.unregister=function(t){return jt.has(t)||F(`The component "${t}" was never registered`),jt.delete(t),xt.remove(t),jt},t.version="v5.1.2",Object.defineProperty(t,"__esModule",{value:!0})},"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).riot={}),function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("./components/route-hoc.riot"),require("./components/router-hoc.riot")):"function"==typeof define&&define.amd?define(["exports","./components/route-hoc.riot","./components/router-hoc.riot"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).route={},t.routeHoc_riot,t.routerHoc_riot)}(this,(function(t,e,n){"use strict";function r(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var i=r(e),o=r(n);function a(t,e){void 0===e&&(e={});for(var n=function(t){for(var e=[],n=0;n=48&&l<=57||l>=65&&l<=90||l>=97&&l<=122||95===l))break;a+=t[s++]}if(!a)throw new TypeError("Missing parameter name at "+n);e.push({type:"NAME",index:n,value:a}),n=s}else e.push({type:"CLOSE",index:n,value:t[n++]});else e.push({type:"OPEN",index:n,value:t[n++]});else e.push({type:"ESCAPED_CHAR",index:n++,value:t[n++]});else e.push({type:"MODIFIER",index:n,value:t[n++]})}return e.push({type:"END",index:n,value:""}),e}(t),r=e.prefixes,i=void 0===r?"./":r,o="[^"+l(e.delimiter||"/#?")+"]+?",a=[],s=0,c=0,u="",f=function(t){if(c-1:void 0===x;i||(m+="(?:"+p+"(?="+h+"))?"),T||(m+="(?="+p+"|"+h+")")}return new RegExp(m,c(n))}(a(t,n),e,n)}function f(t,e,n){return t instanceof RegExp?function(t,e){if(!e)return t;var n=t.source.match(/\((?!\?)/g);if(n)for(var r=0;rfunction e(r,i){if(!r.length)return t(i);const[o,...a]=r,s="function"==typeof o?o(i):o,l=t=>e(a,t);if(null!=s){if(s===d)return;if(s.then)return s.then(l,n)}return Promise.resolve(l(s))}(e)))}h.cancel=()=>d,h.compose=function(){for(var t=arguments.length,e=new Array(t),n=0;n{n(e)===m&&t.delete(n)})),t}function v(t){throw new Error(t)}function y(){for(var t=arguments.length,e=new Array(t),n=0;ne=>t.add(e)&&l,u=t=>e=>t.delete(e)?l:v("Couldn't remove handler passed by reference");return Object.assign(l,{on:Object.freeze({value:c(r),error:c(i),end:c(o)}),off:Object.freeze({value:u(r),error:u(i),end:u(o)}),connect:c(a),push(t){const{value:e,done:n}=l.next(t);return n||e.then((t=>b(r,t)),(t=>b(i,t))),l},end:()=>(s.return(),b(o),[r,i,o,a].forEach((t=>t.clear())),l),fork:()=>y(...a),next(t){const e=s.next(t);return s.next(),e}})}y.install=function(t,e){return t&&"string"==typeof t||v("Please provide a name (as string) for your erre plugin"),e&&"function"==typeof e||v("Please provide a function for your erre plugin"),p.has(t)?v(`The ${t} is already part of the erre API, please provide a different name`):(y[t]=e,p.add(t)),y},y.install("cancel",h.cancel),y.install("off",(()=>m));const _="undefined"!=typeof process,w=t=>t.replace(M.base,""),x=t=>e=>k(e,t)?e:y.cancel(),T=t=>{if(!M.silentErrors)throw new Error(t)},A=t=>(t=>"string"==typeof t)(t)?t:y.cancel(),E=y(A).on.error(T),M={base:"",silentErrors:!1,sensitive:!1,strict:!1,end:!0,start:!0,delimiter:"/#?",encode:void 0,endsWith:void 0,prefixes:"./"},S=t=>Object.assign({},M,t),N=function(t,e,n){void 0===n&&(n={});const{base:r}=S(n),[,...i]=e.exec(t),o=function(){for(var t=arguments.length,e=new Array(t),n=0;n{const i=n.keys&&n.keys[r];return i&&(t[i.name]=e),t}),{}),o},k=(t,e)=>e.test(t),C=(t,e)=>[w,x(t),n=>N(n,t,e)];const D=(L=null,E.on.value((t=>L=t)),()=>L);var L;const O="popstate",I="click",B="/",P=/^.+?\/\/+[^/]+/;function j(t){return Array.isArray(t)?t:/^\[object (HTMLCollection|NodeList|Object)\]$/.test(Object.prototype.toString.call(t))&&"number"==typeof t.length?Array.from(t):[t]}function R(t,e,n,r,i){var o;t=j(t),(o=e,o.split(/\s/)).forEach((e=>{t.forEach((t=>t[r](e,n,i||!1)))}))}function q(t,e,n,r){return R(t,e,n,"addEventListener",r),t}function F(t,e,n,r){return R(t,e,n,"removeEventListener",r),t}const z=()=>"undefined"==typeof window?null:window,U=()=>"undefined"==typeof document?null:document,V=()=>{const t=z();return t?t.location:{}},H=t=>1===t.length?t[0]:t;function G(t,e){return function(t,e,n){const r="string"==typeof e?[e]:e;return H(j(t).map((t=>H(r.map((e=>t[n](e)))))))}(t,e,"hasAttribute")}const Y=()=>E.push(Q(String(V().href))),W=t=>{const e=t.includes(M.base)?t:M.base+t,n=V(),r="undefined"==typeof history?null:history,i=U();r&&e!==n.href&&r.pushState(null,i.title,e)},$=t=>t&&!K(t)?$(t.parentNode):t,K=t=>"A"===t.nodeName,X=t=>!t||!K(t)||G(t,"download")||!G(t,"href")||(t=>t.target&&"_self"!==t.target)(t)||-1===t.href.indexOf(V().href.match(P)[0]),Q=t=>t.replace(M.base,""),Z=t=>{if((t=>t.which&&1!==t.which||t.metaKey||t.ctrlKey||t.shiftKey||t.defaultPrevented)(t))return;const e=$(t.target);if(X(e)||(t=>t.split("#").length>1)(e.href)||!(t=>!M.base||t.includes(M.base))(e.href))return;const n=Q(e.href);E.push(n),t.preventDefault()};const J=t=>t[t.length-1]===B?t.substr(0,t.length-1):t,tt=t=>{const e=z().location,n=e?`${e.protocol}//${e.host}`:"",{pathname:r}=e||{};switch(!0){case!1===Boolean(t):return J(`${n}${r||""}`);case/(www|http(s)?:)/.test(t):return t;case"#"===t[0]:return`${n}${r&&r!==B?r:""}${t}`;case t===B:return J(n);default:return J(`${n}${i=t,i[0]===B?i:"/"+i}`)}var i};Object.defineProperty(t,"Route",{enumerable:!0,get:function(){return i.default}}),Object.defineProperty(t,"Router",{enumerable:!0,get:function(){return o.default}}),t.createURLStreamPipe=C,t.filterStrings=A,t.getCurrentRoute=D,t.initDomListeners=function(t){const e=z(),n=t||U();return e&&(q(e,O,Y),q(n,I,Z)),E.on.value(W),()=>{e&&(F(e,O,Y),F(n,I,Z)),E.off.value(W)}},t.match=k,t.route=function(t,e){const n=[],r=f(t,n,e),i=y(...C(r,Object.assign({},e,{keys:n})));return(o=E,a=i,o.on.value(a.push),a.on.end((()=>{o.off.value(a.push)})),a).on.error(T);var o,a},t.router=E,t.setBase=function(t){M.base=tt(t)},t.toPath=(t,e,n)=>s(t,S(n))(e),t.toRegexp=(t,e,n)=>f(t,e,S(n)),t.toURL=N,Object.defineProperty(t,"__esModule",{value:!0})})),function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).cimDiagram=e()}(this,(function(){"use strict";const t=14,e=d3.scaleSequential([0,500],d3.interpolateTurbo);let n=null,r="ConnectivityNode",i="ConnectivityNode.Terminals",o="Terminal.ConnectivityNode";return{css:'cimdiagram .app-diagram,[is="cimdiagram"] .app-diagram{ max-height: 800px; } cimdiagram path.domain,[is="cimdiagram"] path.domain{ fill: none; stroke: black; } cimdiagram g.tick > line,[is="cimdiagram"] g.tick > line{ stroke: black; stroke-dasharray: 1 5; } cimdiagram svg,[is="cimdiagram"] svg{ width: 1200px; height: 800px; } cimdiagram line.highlight-x,[is="cimdiagram"] line.highlight-x,cimdiagram line.highlight-y,[is="cimdiagram"] line.highlight-y{ stroke: red; stroke-width: 1; } cimdiagram g.resize > rect,[is="cimdiagram"] g.resize > rect{ stroke: black; stroke-width: 2; }',exports:{onBeforeMount(t,e){n=this,n.props.dispatcher.on("showDiagram",(function(t,e,a){if(decodeURI(e)!==n.diagramName){"BUS_BRANCH"===n.props.model.getMode()&&(r="TopologicalNode",i="TopologicalNode.Terminal",o="Terminal.TopologicalNode"),n.render(e)}void 0!==a?(n.moveTo(a),n.props.dispatcher.trigger("moveTo",a)):n.props.dispatcher.trigger("deselect")})),n.props.dispatcher.on("transform",(function(){let t=d3.zoomTransform(d3.select("svg").node()),e=t.x,n=t.y,r=t.k,i=parseInt(d3.select("svg").style("width")),o=parseInt(d3.select("svg").style("height")),a=d3.scaleLinear().domain([-e/r,(i-e)/r]).range([0,i]),s=d3.scaleLinear().domain([-n/r,(o-n)/r]).range([0,o]),l=d3.axisRight(s),c=d3.axisBottom(a);d3.select("svg").select("#diagram-yAxis").call(l),d3.select("svg").select("#diagram-xAxis").call(c)})),n.props.model.on("setAttribute",(function(t,e,r){switch(e){case"cim:IdentifiedObject.name":{let e=t.localName,i=n.props.model.ID(t);if("cim:BusbarSection"===t.nodeName){let r=n.props.model.getNode(t);if(null===r)return;e=r.localName,i=n.props.model.ID(r)}d3.select("svg").selectAll("svg > g#diagram-main > g."+e+"s").select("#cimdiagram-"+i).select("text").html(r);break}case"cim:AnalogValue.value":{let e=n.props.model.getTargets([t],"AnalogValue.Analog"),r=n.props.model.getTargets(e,"Measurement.PowerSystemResource")[0];"cim:BusbarSection"===r.nodeName&&(r=n.props.model.getNode(r));let i=n.props.model.ID(r),o=d3.select("g#cimdiagram-"+i);n.createStatusInfo(o);break}case"cim:SvPowerFlow.p":case"cim:SvPowerFlow.q":{let e=n.props.model.getTargets([t],"SvPowerFlow.Terminal")[0];if(void 0!==e){let t=n.props.model.getTargets([e],"Terminal.ConductingEquipment")[0],r=n.props.model.ID(t),i=d3.select("g#cimdiagram-"+r);n.createStatusInfo(i)}break}case"cim:BaseVoltage.nominalVoltage":{n.drawLegend();const e=n.props.model.getTargets([t],"BaseVoltage.ConductingEquipment"),r=e.filter((function(t){return!0===n.props.model.schema.isA("ACLineSegment",t)}));n.drawACLines(r);let i=e.filter((function(t){return!0===n.props.model.schema.isA("BusbarSection",t)})).map((t=>n.props.model.getNode(t)));n.drawNodes(i);const o=n.props.model.getTargets([t],"BaseVoltage.TransformerEnds");for(const t of o){const e=n.getTermNode(t);null!==e&&n.handlePowerTransformerEnds(e)}break}}if("cim:Analog"===t.nodeName||"cim:Discrete"===t.nodeName){let e=n.props.model.getTargets([t],"Measurement.PowerSystemResource")[0];if(void 0!==e){"cim:BusbarSection"===e.nodeName&&(e=n.props.model.getNode(e));let t=n.props.model.ID(e),r=d3.select("g#cimdiagram-"+t);n.createStatusInfo(r)}}if("cim:OperationalLimitSet"===t.nodeName){let e=n.props.model.getTargets([t],"OperationalLimitSet.Equipment"),r=n.props.model.getTargets([t],"OperationalLimitSet.Terminal");if(e=e.concat(n.props.model.getTargets(r,"Terminal.ConductingEquipment"))[0],void 0!==e){"cim:BusbarSection"===e.nodeName&&(e=n.props.model.getNode(e));let t=n.props.model.ID(e),r=d3.select("g#cimdiagram-"+t);n.createStatusInfo(r)}}})),n.props.model.on("setEnum",(function(t,e,r){if("cim:Analog"===t.nodeName||"cim:Discrete"===t.nodeName){let e=n.props.model.getTargets([t],"Measurement.PowerSystemResource")[0];if(void 0!==e){"cim:BusbarSection"===e.nodeName&&(e=n.props.model.getNode(e));let t=n.props.model.ID(e),r=d3.select("g#cimdiagram-"+t);n.createStatusInfo(r)}}switch(e){case"cim:PowerTransformerEnd.connectionKind":{const e=n.getTermNode(t);null!==e&&n.handlePowerTransformerEnds(e);break}}})),n.props.model.on("updateActiveDiagram",(function(t){let e=null;switch(t.nodeName){case"cim:ACLineSegment":e=n.drawACLines([t])[0],n.createTerminals(e);break;case"cim:"+r:n.drawNodes([t])}let i=t.localName,o=n.props.model.ID(t),a=d3.select("svg").selectAll("svg > g#diagram-main > g."+i+"s").select("#cimdiagram-"+o);n.forceTick(a)})),n.props.model.on("addToActiveDiagram",(function(t){let e=null;switch(t.nodeName){case"cim:ACLineSegment":e=n.drawACLines([t])[1];break;case"cim:Breaker":e=n.drawBreakers([t]);break;case"cim:Disconnector":e=n.drawDisconnectors([t]);break;case"cim:LoadBreakSwitch":e=n.drawLoadBreakSwitches([t]);break;case"cim:Junction":e=n.drawJunctions([t]);break;case"cim:EnergySource":e=n.drawEnergySources([t]);break;case"cim:SynchronousMachine":e=n.drawSynchronousMachines([t]);break;case"cim:AsynchronousMachine":e=n.drawAsynchronousMachines([t]);break;case"cim:EnergyConsumer":e=n.drawEnergyConsumers([t]);break;case"cim:ConformLoad":e=n.drawConformLoads([t]);break;case"cim:NonConformLoad":e=n.drawNonConformLoads([t]);break;case"cim:EquivalentInjection":e=n.drawEquivalentInjections([t]);break;case"cim:LinearShuntCompensator":e=n.drawLinearCompensators([t]);break;case"cim:NonlinearShuntCompensator":e=n.drawNonlinearCompensators([t]);break;case"cim:PowerTransformer":e=n.drawPowerTransformers([t]);break;case"cim:"+r:e=n.drawNodes([t]),i(t,null)}if(null!==e&&function(e){let r=n.props.model.getTerminals([t]);for(let t of r){let e=n.props.model.getTargets([t],o)[0];if(void 0!==e){let t=n.props.model.getEquipments(e),r=t.filter((t=>"BusbarSection"===t.localName))[0];if(t=t.filter((t=>t!==r)),t.length>1){n.drawNodes([e]);let r=n.props.model.getTerminals(t);for(let t of r){if(n.props.model.getTargets([t],o)[0]===e){let r={source:e,target:t};n.createEdges([r])}}}}}n.createTerminals(e)}(e),"cim:BusbarSection"===t.nodeName){let r=n.props.model.getTargets([t],"ConductingEquipment.Terminals"),a=n.props.model.getTargets(r,o)[0];e=n.drawNodes([a]),i(a,t)}function i(t,e){let r=n.props.model.getEquipments(t).filter((t=>t!==e)),i=n.props.model.getTerminals(r);for(let e of i){if(void 0===e.x)continue;if(n.props.model.getTargets([e],o)[0]===t){let r={source:t,target:e};n.createEdges([r])}}}null!==e&&(n.forceTick(e),n.props.dispatcher.trigger("addToDiagram",e))})),n.props.model.on("addLink",(function(t,e,a){switch(e){case"cim:"+o:case"cim:"+i:{let e=void 0,i=void 0;if("cim:Terminal"===a.nodeName&&t.nodeName==="cim:"+r)e=t,i=a;else{if("cim:Terminal"!==t.nodeName||a.nodeName!=="cim:"+r)return;i=t,e=a}let o=d3.select("svg").selectAll("svg > g#diagram-main > g.edges > g").data().filter((t=>t.target===i))[0];if(void 0===o){let t=n.props.model.getTargets([i],"Terminal.ConductingEquipment");n.props.model.getDiagramObjects(t).length>0&&(o={source:e,target:i},n.createEdges([o]))}else o.source=e;let s=n.props.model.ID(e),l=d3.select("svg > g#diagram-main > g."+r+"s > g#cimdiagram-"+s);n.forceTick(l);break}case"cim:Terminal.SvPowerFlow":case"cim:SvPowerFlow.Terminal":{let e=a;if("cim:Terminal"===t.nodeName&&(e=t),void 0!==e){let t=n.props.model.getTargets([e],"Terminal.ConductingEquipment")[0],r=n.props.model.ID(t),i=d3.select("g#cimdiagram-"+r);n.createStatusInfo(i)}break}case"cim:Measurement.Terminal":case"cim:ACDCTerminal.Measurements":{let e=a;"cim:Terminal"===t.nodeName&&(e=t);let r=n.props.model.getTargets([e],"Terminal.ConductingEquipment")[0],i=n.props.model.ID(r),o=d3.select("g#cimdiagram-"+i);n.createStatusInfo(o);break}case"cim:Measurement.PowerSystemResource":case"cim:PowerSystemResource.Measurements":{let r=a;if("cim:PowerSystemResource.Measurements"===e&&(r=t),void 0!==r){"cim:BusbarSection"===r.nodeName&&(r=n.props.model.getNode(r));let t=n.props.model.ID(r),e=d3.select("g#cimdiagram-"+t);n.createStatusInfo(e)}break}case"cim:OperationalLimitSet.Terminal":case"cim:ACDCTerminal.OperationalLimitSet":{let e=a;"cim:Terminal"===t.nodeName&&(e=t);let r=n.props.model.getTargets([e],"Terminal.ConductingEquipment")[0],i=n.props.model.ID(r),o=d3.select("g#cimdiagram-"+i);n.createStatusInfo(o);break}case"cim:OperationalLimitSet.Equipment":case"cim:Equipment.OperationalLimitSet":{let r=a;if("cim:Equipment.OperationalLimitSet"===e&&(r=t),void 0!==r){"cim:BusbarSection"===r.nodeName&&(r=n.props.model.getNode(r));let t=n.props.model.ID(r),e=d3.select("g#cimdiagram-"+t);n.createStatusInfo(e)}break}case"cim:ConductingEquipment.BaseVoltage":case"cim:BaseVoltage.ConductingEquipment":case"cim:BaseVoltage.TransformerEnds":case"cim:TransformerEnd.BaseVoltage":n.updateColoring(t,e,a)}})),n.props.model.on("removeLink",(function(t,e,a){switch(e){case"cim:Measurement.PowerSystemResource":case"cim:PowerSystemResource.Measurements":{let r=a;if("cim:PowerSystemResource.Measurements"===e&&(r=t),void 0!==r){"cim:BusbarSection"===r.nodeName&&(r=n.props.model.getNode(r));let t=n.props.model.ID(r),e=d3.select("g#"+t);n.createStatusInfo(e)}break}case"cim:"+o:case"cim:"+i:{let e=void 0;if("cim:Terminal"===a.nodeName&&t.nodeName==="cim:"+r)e=a;else{if("cim:Terminal"!==t.nodeName||a.nodeName!=="cim:"+r)return;e=t}d3.select("svg").selectAll("svg > g#diagram-main > g.edges > g").filter((function(t){return t.target===e})).remove();break}case"cim:OperationalLimitSet.Terminal":case"cim:ACDCTerminal.OperationalLimitSet":{let e=a;"cim:Terminal"===t.nodeName&&(e=t);let r=n.props.model.getTargets([e],"Terminal.ConductingEquipment")[0];if(void 0!==r){let t=n.props.model.ID(r),e=d3.select("g#cimdiagram-"+t);n.createStatusInfo(e)}break}case"cim:OperationalLimitSet.Equipment":case"cim:Equipment.OperationalLimitSet":{let r=a;if("cim:Equipment.OperationalLimitSet"===e&&(r=t),void 0!==r&&("cim:BusbarSection"===r.nodeName&&(r=n.props.model.getNode(r)),null!==r)){let t=n.props.model.ID(r),e=d3.select("g#cimdiagram-"+t);n.createStatusInfo(e)}break}case"cim:ConductingEquipment.BaseVoltage":case"cim:BaseVoltage.ConductingEquipment":case"cim:BaseVoltage.TransformerEnds":case"cim:TransformerEnd.BaseVoltage":n.updateColoring(t,e,a)}})),n.props.model.on("deleteObject",(function(t,e){"BaseVoltage"===e&&n.drawLegend()}))},onMounted(){let t=d3.scaleLinear().domain([0,1200]).range([0,1200]),e=d3.scaleLinear().domain([0,800]).range([0,800]),r=d3.axisRight(e),i=d3.axisBottom(t);d3.select("svg").append("g").attr("id","diagram-yAxis").call(r),d3.select("svg").append("g").attr("id","diagram-xAxis").call(i),n.drawGrid(1)},render(t){let e=function*(t){d3.select("svg").select("g#diagram-main").selectAll("g:not(.edges)").remove(),n.props.model.selectDiagram(decodeURI(t)),n.diagramName=decodeURI(t);const e=n.props.model.getNodes();yield"DIAGRAM: extracted nodes";const r=n.props.model.getGraphicObjects(["cim:ACLineSegment","cim:Breaker","cim:Disconnector","cim:LoadBreakSwitch","cim:Junction","cim:EnergySource","cim:SynchronousMachine","cim:AsynchronousMachine","cim:EnergyConsumer","cim:ConformLoad","cim:NonConformLoad","cim:EquivalentInjection","cim:PowerTransformer","cim:BusbarSection","cim:LinearShuntCompensator","cim:NonlinearShuntCompensator"]),i=r["cim:ACLineSegment"],o=r["cim:Breaker"],a=r["cim:Disconnector"],s=r["cim:LoadBreakSwitch"],l=r["cim:Junction"],c=r["cim:EnergySource"],u=r["cim:SynchronousMachine"],f=r["cim:AsynchronousMachine"],d=r["cim:EnergyConsumer"],h=r["cim:ConformLoad"],p=r["cim:NonConformLoad"],m=r["cim:EquivalentInjection"],g=r["cim:PowerTransformer"];r["cim:BusbarSection"];const b=r["cim:LinearShuntCompensator"],v=r["cim:NonlinearShuntCompensator"];yield"DIAGRAM: extracted equipments";const y=n.drawACLines(i)[1];yield"DIAGRAM: drawn acLines";const _=n.drawBreakers(o);yield"DIAGRAM: drawn breakers";const w=n.drawDisconnectors(a);yield"DIAGRAM: drawn disconnectors";const x=n.drawLoadBreakSwitches(s);yield"DIAGRAM: drawn load break switches";const T=n.drawJunctions(l);yield"DIAGRAM: drawn junctions";const A=n.drawEnergySources(c);yield"DIAGRAM: drawn energy sources";const E=n.drawSynchronousMachines(u);yield"DIAGRAM: drawn synchronous machines";const M=n.drawAsynchronousMachines(f);yield"DIAGRAM: drawn asynchronous machines";const S=n.drawEnergyConsumers(d);yield"DIAGRAM: drawn energy consumers";const N=n.drawConformLoads(h);yield"DIAGRAM: drawn conform loads";const k=n.drawNonConformLoads(p);yield"DIAGRAM: drawn non conform loads";const C=n.drawEquivalentInjections(m);yield"DIAGRAM: drawn equivalent injections";const D=n.drawPowerTransformers(g);yield"DIAGRAM: drawn power transformers";const L=n.drawLinearCompensators(b);yield"DIAGRAM: drawn linear shunt compensators";const O=n.drawNonlinearCompensators(v);yield"DIAGRAM: drawn nonlinear shunt compensators";const I=n.drawNodes(e);n.createStatusInfo(I),yield"DIAGRAM: drawn connectivity nodes",n.createTerminals(y),n.createStatusInfo(y),yield"DIAGRAM: drawn acline terminals",n.createTerminals(_),n.createStatusInfo(_),yield"DIAGRAM: drawn breaker terminals",n.createTerminals(w),n.createStatusInfo(w),yield"DIAGRAM: drawn disconnector terminals",n.createTerminals(x),n.createStatusInfo(x),yield"DIAGRAM: drawn load break switch terminals",n.createTerminals(T),n.createStatusInfo(T),yield"DIAGRAM: drawn junction terminals",n.createTerminals(A),n.createStatusInfo(A),yield"DIAGRAM: drawn energy source terminals",n.createTerminals(E),n.createStatusInfo(E),yield"DIAGRAM: drawn synchronous machine terminals",n.createTerminals(M),n.createStatusInfo(M),yield"DIAGRAM: drawn asynchronous machine terminals",n.createTerminals(S),n.createStatusInfo(S),yield"DIAGRAM: drawn energy consumer terminals",n.createTerminals(N),n.createStatusInfo(N),yield"DIAGRAM: drawn conform load terminals",n.createTerminals(k),n.createStatusInfo(k),yield"DIAGRAM: drawn non conform load terminals",n.createTerminals(C),n.createStatusInfo(C),yield"DIAGRAM: drawn equivalent injection terminals",n.createTerminals(D),n.createStatusInfo(D),yield"DIAGRAM: drawn power transformer terminals",n.createTerminals(L),n.createStatusInfo(L),yield"DIAGRAM: drawn linear shunt compensator terminals",n.createTerminals(O),n.createStatusInfo(O),yield"DIAGRAM: drawn nonlinear shunt compensator terminals",n.drawLegend(),d3.select("svg").on("dragover",(function(t){t.preventDefault()})).on("drop",(function(t){t.preventDefault();const e=t.dataTransfer.getData("text/plain");if(void 0===e)return;const r=n.props.model.getObject(e);if(void 0===r)return;n.props.model.getDiagramObjects([r]).length>0?n.moveTo(e):addToDiagram(n.props.model,t,r)})),n.forceTick(),n.props.dispatcher.trigger("render")}(t);!function t(){let r=e.next().value;void 0!==r?(document.getElementById("loadingDiagramMsg").innerHTML="
              "+r,setTimeout(t,1)):n.props.dispatcher.trigger("loaded")}()},createEdges(t){let e=d3.select("svg").select("g > g.edges").selectAll("g.edge").data(t,(function(t){return t.source.attributes[0].value+t.target.attributes[0].value})).enter().append("g").attr("class","edge").attr("id",(function(t){return t.source.attributes[0].value+t.target.attributes[0].value})).append("path").attr("fill","none").attr("stroke","black").attr("stroke-width",1);n.props.dispatcher.trigger("createEdges",e)},createStatusInfo(t){t.attr("data-bs-toggle","popover"),t.filter((function(t){return n.props.model.schema.isA("Switch",t)})).selectAll("path").attr("fill",(function(t){let e=n.props.model.getTargets([t],"PowerSystemResource.Measurements")[0];return"0"===n.getDiscreteValue(e)?"white":"black"})),t.each((function(t){let e=[],i=[],o=[],a=n.props.model.getTargets([t],"TopologicalNode.SvVoltage"),s=n.props.model.getTerminals([t]);if(t.nodeName==="cim:"+r){let r=n.props.model.getBusbar(t);if(null===r)return;s=n.props.model.getTerminals([r]),e=n.props.model.getTargets([r],"PowerSystemResource.Measurements"),o=n.props.model.getTargets([r],"Equipment.OperationalLimitSet")}else e=n.props.model.getTargets([t],"PowerSystemResource.Measurements"),o=n.props.model.getTargets([t],"Equipment.OperationalLimitSet");o=o.concat(n.props.model.getTargets(s,"ACDCTerminal.OperationalLimitSet"));for(let t of s){let e=n.props.model.getTargets([t],"Terminal.SvPowerFlow");i=i.concat(e)}if(e.length>0||i.length>0||a.length>0||o.length>0){let t=n.createTooltip(e,i,a,o);disposePopovers([this]),new bootstrap.Popover(this,{title:"Element Status Info",content:t,container:"body",html:!0,trigger:"manual",delay:{show:200,hide:0},placement:"auto"})}else disposePopovers([this])}))},getDiscreteValue(t){let e="0";if(void 0!==t){let r=n.props.model.getTargets([t],"Discrete.DiscreteValues")[0];if(void 0!==r){let t=n.props.model.getAttribute(r,"cim:DiscreteValue.value");void 0!==t&&(e=t.textContent)}}return e},createTooltip(t,e,r,i){let o="";if(t.length>0){o+="Measurements

              ";let e=[];for(let r of t){let t="unnamed",i="ABC",o="",a="no unit",s=n.props.model.getAttribute(r,"cim:IdentifiedObject.name"),l=n.props.model.getEnum(r,"cim:Measurement.phases"),c=n.props.model.getEnum(r,"cim:Measurement.unitMultiplier"),u=n.props.model.getEnum(r,"cim:Measurement.unitSymbol");void 0!==s&&(t=s.textContent),void 0!==l&&(i=l),void 0!==c&&(o=c,"none"===o&&(o="")),void 0!==u&&(a=u);let f=n.props.model.getTargets([r],"Analog.AnalogValues")[0],d="",h="n.a.";void 0!==f?void 0!==n.props.model.getAttribute(f,"cim:AnalogValue.value")&&(h=n.props.model.getAttribute(f,"cim:AnalogValue.value").textContent,h=parseFloat(h).toFixed(2)):(h=n.getDiscreteValue(r),h=parseInt(h));let p=n.props.model.ID(r),m=window.location.hash.split("/");d=d+""+t+"",d=d+" (phase: "+i+")",d+=": ",d+=h,d=d+" ["+o+a+"]",d+="
              ",e.push(d)}e.sort();for(let t in e)o+=e[t]}if(e.length>0){""!==o&&(o+="
              "),o+="Power flow results (Power)

              ";for(let t of e){let e=0,r=0;void 0!==n.props.model.getAttribute(t,"cim:SvPowerFlow.p")&&(e=n.props.model.getAttribute(t,"cim:SvPowerFlow.p").textContent),void 0!==n.props.model.getAttribute(t,"cim:SvPowerFlow.q")&&(r=n.props.model.getAttribute(t,"cim:SvPowerFlow.q").textContent);let i="Active Power: "+parseFloat(e).toFixed(2)+" [MW]";i+="
              ",i=i+"Reactive power: "+parseFloat(r).toFixed(2)+" [MVAr]",i+="
              ",o+=i}}if(r.length>0){""!==o&&(o+="
              "),o+="Power flow results (Voltage)

              ";for(let t of r){let e=0,r=0;void 0!==n.props.model.getAttribute(t,"cim:SvVoltage.v")&&(e=n.props.model.getAttribute(t,"cim:SvVoltage.v").textContent),void 0!==n.props.model.getAttribute(t,"cim:SvVoltage.angle")&&(r=n.props.model.getAttribute(t,"cim:SvVoltage.angle").textContent);let i="Voltage magnitude: "+parseFloat(e).toFixed(2)+" [kV]";i+="
              ",i=i+"Voltage angle: "+parseFloat(r).toFixed(2)+" [deg]",i+="
              ",o+=i}}if(i.length>0){""!==o&&(o+="
              "),o+="Operational limit sets

              ";for(let t of i){let e="unnamed",r=n.props.model.getAttribute(t,"cim:IdentifiedObject.name");void 0!==r&&(e=r.textContent);let i=n.props.model.ID(t),a=window.location.hash.split("/");o+=""+e+"
              "}}return o},createSelection(t,e){let r=t+"s";d3.select("svg").select("g."+r).empty()&&d3.select("svg").select("g#diagram-main").append("g").attr("class",r);for(let t of e)calcLineData(n.props.model,t);let i=d3.select("svg").select("g."+r).selectAll("g."+t).data(e,(function(t){return n.props.model.ID(t)})),o=i.enter().append("g").attr("class",t).attr("id",(function(t){return"cimdiagram-"+n.props.model.ID(t)}));return[i,o]},drawACLines(t){const e=d3.line().x((function(t){return t.x})).y((function(t){return t.y})),r=n.createSelection("ACLineSegment",t),i=r[0],o=r[1];function a(t){t.attr("x",(function(t){let e=d3.select(this.parentNode).select("path").node();return e.getPointAtLength(e.getTotalLength()/2).x+2})).attr("y",(function(t){let e=d3.select(this.parentNode).select("path").node();return e.getPointAtLength(e.getTotalLength()/2).y-2})).text((function(t){let e=n.props.model.getAttribute(t,"cim:IdentifiedObject.name");return void 0!==e?e.innerHTML:""}))}return o.append("path").attr("d",(function(t){return 1===t.lineData.length&&t.lineData.push({x:150,y:0,seq:2}),e(t.lineData)})).attr("fill","none").attr("stroke",(function(t){return n.voltageColor(t,"darkred")})).attr("stroke-width",2),o.append("text").attr("class","cim-object-text").attr("font-size",3),a(i.select("text")),a(o.select("text")),i.select("path").attr("d",(function(t){return 1===t.lineData.length&&t.lineData.push({x:150,y:0,seq:2}),e(t.lineData)})).attr("fill","none").attr("stroke",(function(t){return n.voltageColor(t,"darkred")})).attr("stroke-width",2),[i,o]},drawBreakers:t=>n.drawSwitches(t,"Breaker","green"),drawDisconnectors:t=>n.drawSwitches(t,"Disconnector","blue"),drawLoadBreakSwitches:t=>n.drawSwitches(t,"LoadBreakSwitch","black"),drawJunctions:t=>n.drawSwitches(t,"Junction","red"),drawSwitches(t,e,r){let i=d3.line().x((function(t){return t.x})).y((function(t){return t.y})).curve(d3.curveLinearClosed),o=n.createSelection(e,t)[1];return o.append("path").attr("d",(function(t){return i([{x:-5,y:-5,seq:1},{x:5,y:-5,seq:2},{x:5,y:5,seq:3},{x:-5,y:5,seq:4}])})).attr("fill",(function(t){let e=n.props.model.getTargets([t],"PowerSystemResource.Measurements")[0];return"0"===n.getDiscreteValue(e)?"white":"black"})).attr("stroke",r).attr("stroke-width",1),o.append("text").attr("class","cim-object-text").style("text-anchor","end").attr("font-size",3).attr("x",-10).attr("y",0).text((function(t){let e=n.props.model.getAttribute(t,"cim:IdentifiedObject.name");return void 0!==e?e.innerHTML:""})),o},drawEnergySources:t=>n.drawGenerators(t,"EnergySource"),drawSynchronousMachines:t=>n.drawGenerators(t,"SynchronousMachine"),drawAsynchronousMachines:t=>n.drawGenerators(t,"AsynchronousMachine"),drawEnergyConsumers:t=>n.drawLoads(t,"EnergyConsumer"),drawConformLoads:t=>n.drawLoads(t,"ConformLoad"),drawNonConformLoads:t=>n.drawLoads(t,"NonConformLoad"),drawEquivalentInjections:t=>n.drawLoads(t,"EquivalentInjection"),drawLinearCompensators:t=>n.drawCompensators(t,"LinearShuntCompensator"),drawNonlinearCompensators:t=>n.drawCompensators(t,"NonlinearShuntCompensator"),drawGenerators(t,e){let r=n.createSelection(e,t)[1],i="G";const o=Math.round(15);return"AsynchronousMachine"===e&&(i="M"),r.append("circle").attr("r",12.5).attr("cx",0).attr("cy",0).attr("fill","white").attr("stroke","black").attr("stroke-width",1),r.append("text").attr("class","cim-object-text").style("text-anchor","middle").attr("font-size",3).attr("x",17.5).attr("y",0).text((function(t){let e=n.props.model.getAttribute(t,"cim:IdentifiedObject.name");return void 0!==e?e.innerHTML:""})),r.append("text").style("text-anchor","middle").attr("font-size",o).attr("x",0).attr("y",6.25).text(i),r},drawLoads(t,e){let r=d3.line().x((function(t){return t.x})).y((function(t){return t.y})).curve(d3.curveLinearClosed),i=n.createSelection(e,t)[1];return i.append("path").attr("d",(function(t){return r([{x:-15,y:-10,seq:1},{x:15,y:-10,seq:2},{x:0,y:10,seq:3}])})).attr("fill","white").attr("stroke","black").attr("stroke-width",2),i.append("text").attr("class","cim-object-text").style("text-anchor","middle").attr("font-size",3).attr("x",0).attr("y",20).text((function(t){let e=n.props.model.getAttribute(t,"cim:IdentifiedObject.name");return void 0!==e?e.innerHTML:""})),i},drawCompensators(t,e){let r=d3.line().x((function(t){return t.x})).y((function(t){return t.y})),i=n.createSelection(e,t)[1];return i.append("path").attr("d",(function(t){return r([{x:0,y:-10,seq:1},{x:0,y:-4,seq:2}])})).attr("fill","white").attr("stroke","black").attr("stroke-width",1),i.append("path").attr("d",(function(t){return r([{x:0,y:4,seq:1},{x:0,y:10,seq:2}])})).attr("fill","white").attr("stroke","black").attr("stroke-width",1),i.append("path").attr("d",(function(t){return r([{x:-15,y:-4,seq:1},{x:15,y:-4,seq:2}])})).attr("fill","white").attr("stroke","black").attr("stroke-width",4),i.append("path").attr("d",(function(t){return r([{x:-15,y:4,seq:1},{x:15,y:4,seq:2}])})).attr("fill","white").attr("stroke","black").attr("stroke-width",4),i.append("text").attr("class","cim-object-text").style("text-anchor","middle").attr("font-size",3).attr("x",0).attr("y",20).text((function(t){let e=n.props.model.getAttribute(t,"cim:IdentifiedObject.name");return void 0!==e?e.innerHTML:""})),i},drawPowerTransformers(e){const r=this.createSelection("PowerTransformer",e)[1],i=r.filter((function(t){return 2===n.props.model.getTargets([t],"PowerTransformer.PowerTransformerEnd").length})),o=r.filter((function(t){return 3===n.props.model.getTargets([t],"PowerTransformer.PowerTransformerEnd").length}));return i.append("circle").attr("r",t).attr("cx",0).attr("cy",11).attr("fill","white").attr("stroke","black").attr("stroke-width",1),o.append("circle").attr("r",t).attr("cx",-11).attr("cy",11).attr("fill","white").attr("stroke","black").attr("stroke-width",1),o.append("circle").attr("r",t).attr("cx",11).attr("cy",11).attr("fill","white").attr("stroke","black").attr("stroke-width",1),i.append("g").attr("class","TransformerEnd").attr("transform",d3.zoomIdentity.translate(0,-11)).append("circle").attr("r",t).attr("cx",0).attr("cy",0).attr("fill","white").attr("stroke","black").attr("stroke-width",1).attr("class","TransformerEndCircle"),i.append("g").attr("class","TransformerEnd").attr("transform",d3.zoomIdentity.translate(0,11)).append("circle").attr("r",t).attr("cx",0).attr("cy",0).attr("fill","white").attr("fill-opacity","0").attr("stroke","black").attr("stroke-width",1).attr("class","TransformerEndCircle"),o.append("g").attr("class","TransformerEnd").attr("transform",d3.zoomIdentity.translate(0,-11)).append("circle").attr("r",t).attr("cx",0).attr("cy",0).attr("fill","white").attr("stroke","black").attr("stroke-width",1).attr("class","TransformerEndCircle"),o.append("g").attr("class","TransformerEnd").attr("transform",d3.zoomIdentity.translate(-11,11)).append("circle").attr("r",t).attr("cx",0).attr("cy",0).attr("fill","white").attr("fill-opacity","0").attr("stroke","black").attr("stroke-width",1).attr("class","TransformerEndCircle"),o.append("g").attr("class","TransformerEnd").attr("transform",d3.zoomIdentity.translate(11,11)).append("circle").attr("r",t).attr("cx",0).attr("cy",0).attr("fill","white").attr("fill-opacity","0").attr("stroke","black").attr("stroke-width",1).attr("class","TransformerEndCircle"),r.append("text").attr("class","cim-object-text").style("text-anchor","end").attr("font-size",3).attr("x",-25).attr("y",0).text((function(t){const e=n.props.model.getAttribute(t,"cim:IdentifiedObject.name");return void 0!==e?e.innerHTML:""})),r},handlePowerTransformerEnds(t){const e=d3.select(t).datum(),r=d3.select(t.parentNode).datum(),i=n.props.model.getTargets([e],"Terminal.TransformerEnd"),o=e.x-r.x,a=e.y-r.y;let s=null,l=null;d3.select(t.parentNode).selectAll(":scope > g.TransformerEnd").each((function(){const t=this.transform.baseVal.consolidate();let e={e:0,f:0};null!==t&&(e=t.matrix);const n=e.e,r=e.f,i=(n-o)**2+(r-a)**2;(null===s||s>i)&&(s=i,l=d3.select(this))})),l.data(i),l.attr("id",(function(){return"cimdiagram-"+n.props.model.ID(i[0])})),l.select("circle.TransformerEndCircle").attr("stroke",(function(t){return n.voltageColor(t,"black")})),l.selectAll("path").remove();const c=n.props.model.getEnum(i[0],"cim:PowerTransformerEnd.connectionKind");if(void 0!==c){const t=.2,e=.4,n=[0,a*t],r=[0,a*e],i=e-t,o=i*Math.sqrt(3)/2,s=i/2,u=[a*-o,a*(t-s)],f=[a*o,a*(t-s)];c.startsWith("Y")&&(l.append("path").attr("d",d3.line()([r,n])).attr("stroke","black"),l.append("path").attr("d",d3.line()([n,u])).attr("stroke","black"),l.append("path").attr("d",d3.line()([n,f])).attr("stroke","black")),"D"===c&&l.append("path").attr("d",d3.line().curve(d3.curveLinearClosed)([r,u,f])).attr("stroke","black").attr("fill","white")}},createTerminals(e){let r=0,i=30,a="none";switch(e.size()>0&&(a=e.data()[0].nodeName),a){case"cim:Breaker":case"cim:Disconnector":case"cim:LoadBreakSwitch":r=-6,i=6;break;case"cim:EnergySource":case"cim:SynchronousMachine":case"cim:AsynchronousMachine":r=-13.5;break;case"cim:EnergyConsumer":case"cim:ConformLoad":case"cim:NonConformLoad":case"cim:EquivalentInjection":r=-11;break;case"cim:PowerTransformer":r=-26,i=26;break;case"cim:LinearShuntCompensator":case"cim:NonlinearShuntCompensator":r=-11;break;default:i=30}let s=[],l=e.selectAll("g.Terminal").data((function(t){return n.props.model.getTerminals([t])})),c=l.enter().append("g").each((function(e,l){let c=n.props.model.getTargets([e],o)[0],u=d3.select(this.parentNode).datum().lineData,f=u[0],d=u[u.length-1],h=d3.select(this.parentNode).datum().x,p=d3.select(this.parentNode).datum().y;1===u.length&&(f={x:0,y:r},d={x:0,y:i});let m=d3.select(this.parentNode).datum().rotation,g=n.props.model.getTerminals(d3.select(this.parentNode).data());if(void 0!==c&&2===g.length){let t=0,r=0;if(m>0){let e=rotate(f,m),n=rotate(d,m);t=Math.pow(h+e.x-c.x,2)+Math.pow(p+e.y-c.y,2),r=Math.pow(h+n.x-c.x,2)+Math.pow(p+n.y-c.y,2)}else t=Math.pow(h+f.x-c.x,2)+Math.pow(p+f.y-c.y,2),r=Math.pow(h+d.x-c.x,2)+Math.pow(p+d.y-c.y,2);rt!==e))[0],u=n.props.model.getTargets([c],o)[0],f=c;if(void 0!==u){n.props.model.getEquipments(u).length>1&&(f=e)}c.x===e.x&&c.y===e.y&&(e.x===i+l.x&&e.y===a+l.y?(f.x=i+s.x,f.y=a+s.y):(f.x=i+l.x,f.y=a+l.y))}(g,e,0,h,p,f,d)}else 1===u.length?(e.x=h,3===g.length?(0===l&&(e.y=p+r),1===l&&(e.x=e.x-25+t,e.y=p+i),2===l&&(e.x=e.x+25-t,e.y=p+i)):e.y=p+r*(1-l)+i*l):(e.x=h+f.x*(1-l)+d.x*l,e.y=p+f.y*(1-l)+d.y*l);if(e.rotation=d3.select(this.parentNode).datum().rotation,void 0!==c&&void 0!==c.lineData){let t={source:c,target:e};s.push(t)}"cim:PowerTransformer"===a&&n.handlePowerTransformerEnds(this)})).attr("id",(function(t){return"cimdiagram-"+n.props.model.ID(t)})).attr("class",(function(t){return t.localName}));return n.createEdges(s),c.append("circle").attr("r",1).style("fill","black").attr("cx",(function(t,e){return d3.select(this.parentNode).datum().x-d3.select(this.parentNode.parentNode).datum().x})).attr("cy",(function(t,e){return d3.select(this.parentNode).datum().y-d3.select(this.parentNode.parentNode).datum().y})),l.each((function(t,e){let n=d3.select(this.parentNode).datum().x,r=d3.select(this.parentNode).datum().y,i=parseInt(d3.select(this.firstChild).attr("cx")),o=parseInt(d3.select(this.firstChild).attr("cy"));if(0===i&&0===o)t.x=n,t.y=r;else{let e=d3.select(this.parentNode).datum().lineData,i=e[e.length-1];t.x=n+i.x,t.y=r+i.y}})),l.selectAll("circle").attr("cx",(function(t,e){return d3.select(this.parentNode).datum().x-d3.select(this.parentNode.parentNode).datum().x})).attr("cy",(function(t,e){return d3.select(this.parentNode).datum().y-d3.select(this.parentNode.parentNode).datum().y})),c.each((function(){let t=d3.select(this).select("circle");d3.select(this).append("circle").attr("cx",t.attr("cx")).attr("cy",t.attr("cy")).attr("r",4).attr("stroke-width",0).attr("fill","steelblue").attr("fill-opacity","0.0").attr("class","big-circle").on("mouseout",(function(t,e){d3.select(this).attr("fill-opacity","0.0")}))})),c.on("mouseover",(function(t,e){0===d3.select(this).select("circle.selection-circle").size()&&d3.select(this).select("circle.big-circle").attr("fill-opacity","0.7")})),c},drawNodes(t){let e=d3.line().x((function(t){return t.x})).y((function(t){return t.y}));for(let e of t)calcLineData(n.props.model,e);d3.select("svg").select("g."+r+"s").empty()&&d3.select("svg").select("g#diagram-main").append("g").attr("class",r+"s");let i=d3.select("svg").select("g."+r+"s").selectAll("g."+r).data(t,(function(t){return n.props.model.ID(t)})),o=i.enter().append("g").attr("class",r).attr("id",(function(t){return"cimdiagram-"+n.props.model.ID(t)}));function a(t){t.attr("x",(function(t){let e=d3.select(this.parentNode).select("path").node();return e.getPointAtLength(e.getTotalLength()/2).x+2})).attr("y",(function(t){let e=d3.select(this.parentNode).select("path").node();return e.getPointAtLength(e.getTotalLength()/2).y-2})).text((function(t){let e=n.props.model.getBusbar(t);if(null!==e){let t=n.props.model.getAttribute(e,"cim:IdentifiedObject.name");if(void 0!==t)return t.innerHTML}return""}))}return i.select("path").attr("d",(function(t){let n=d3.select(this.parentNode).data()[0].lineData;return e(n)})).attr("stroke",(function(t){return n.voltageColor(n.props.model.getBusbar(t),"black")})),o.append("path").attr("d",(function(t){let n=d3.select(this.parentNode).data()[0].lineData;return e(n)})).attr("stroke",(function(t){return n.voltageColor(n.props.model.getBusbar(t),"black")})).attr("stroke-width",2).attr("fill","none"),o.filter((function(t){return null!==n.props.model.getBusbar(t)})).append("text").attr("class","cim-object-text").attr("font-size",3),a(o.select("text")),a(i.select("text")),o},moveTo(t){let e=n.props.model.getObject(t);if(void 0===e)return;if("cim:BusbarSection"===e.nodeName&&(e=n.props.model.getNode(e)),"cim:Substation"===e.nodeName||"cim:Line"===e.nodeName){let t=n.props.model.getTargets([e],"EquipmentContainer.Equipments");for(let r of t){if("cim:BusbarSection"===r.nodeName){let t=n.props.model.getNode(r);null!==t&&(r=t)}if(void 0!==r.x&&void 0!==r.y){e.x=r.x,e.y=r.y;break}}}if("cim:Analog"!==e.nodeName&&"cim:Discrete"!==e.nodeName||(e=n.props.model.getTargets([e],"Measurement.PowerSystemResource")[0],void 0!==e&&"cim:BusbarSection"===e.nodeName&&(e=n.props.model.getNode(e))),"cim:PowerTransformerEnd"===e.nodeName&&(e=n.props.model.getTargets([e],"PowerTransformerEnd.PowerTransformer")[0]),void 0===e.x||void 0===e.y)return;hidePopovers();let r=parseInt(d3.select("svg").style("width")),i=parseInt(d3.select("svg").style("height")),o=1*-e.x+r/2,a=1*-e.y+i/2,s=d3.transition().duration(750).ease(d3.easeLinear),l=d3.zoomIdentity.translate(o,a).scale(1);d3.selectAll("svg").select("g#diagram-main").transition(s).attr("transform",l),d3.zoom().transform(d3.selectAll("svg"),l),n.props.dispatcher.trigger("transform")},forceTick(t){0!==arguments.length&&void 0===t.alpha||(t=d3.select("svg").selectAll("svg > g#diagram-main > g:not(.edges) > g"));let e=d3.zoomTransform(d3.select("svg").node()),r=e.x,i=e.y,o=e.k;if(function(t){t.attr("transform",(function(t){return"translate("+t.x+","+t.y+") rotate("+t.rotation+")"})).selectAll("g.Terminal").each((function(t,e){t.x=d3.select(this.parentNode).datum().x+parseInt(d3.select(this.firstChild).attr("cx")),t.y=d3.select(this.parentNode).datum().y+parseInt(d3.select(this.firstChild).attr("cy"))})),t.selectAll("text.cim-object-text").attr("transform",(function(t){let e=0,n={x:0,y:0};switch(t.rotation%360==180&&(e=-1*t.rotation),t.nodeName){case"cim:Breaker":case"cim:Disconnector":case"cim:LoadBreakSwitch":case"cim:Junction":case"cim:PowerTransformer":n={x:0,y:0};break;default:n={x:d3.select(this).attr("x"),y:d3.select(this).attr("y")}}return"rotate("+e+","+n.x+","+n.y+")"})),t.selectAll("rect.selection-rect").attr("x",0).attr("y",0).attr("width",0).attr("height",0),t.selectAll("rect.selection-rect").attr("x",(function(t){return this.parentNode.getBBox().x})).attr("y",(function(t){return this.parentNode.getBBox().y})).attr("width",(function(t){return this.parentNode.getBBox().width})).attr("height",(function(t){return this.parentNode.getBBox().height})),t.selectAll("g.resize").selectAll("rect").attr("x",(function(t){return t[0].lineData.filter((e=>e.seq===t[1]))[0].x-2})).attr("y",(function(t){return t[0].lineData.filter((e=>e.seq===t[1]))[0].y-2}))}(t),1===arguments.length){let e=n.props.model.getTerminals(t.data()),a=d3.select("svg").selectAll("svg > g#diagram-main > g.edges > g").filter((function(n){return t.data().indexOf(n.source)>-1||e.indexOf(n.target)>-1}));n.updateEdges(r,i,o,a)}else n.updateEdges(r,i,o)},updateEdges(t,e,r,i){let o=d3.line().x((function(t){return t.x})).y((function(t){return t.y})).curve(d3.curveStepBefore);3===arguments.length&&(i=d3.select("svg").selectAll("svg > g#diagram-main > g.edges > g")),i.select("path").attr("d",(function(t){let e={x:t.source.x,y:t.source.y},r={x:t.target.x,y:t.target.y};return 0!==t.target.rotation&&(r=rotateTerm(n.props.model,t.target)),t.source.lineData.length>1?t.p=closestPoint(t.source,r):t.p=[0,0],e.x=e.x+t.p[0],e.y=e.y+t.p[1],o([e,r])})).attr("stroke-dasharray",(function(t){let e=n.props.model.getAttribute(t.target,"cim:ACDCTerminal.connected");return void 0!==e&&"false"===e.textContent?"5, 5":null}))},drawGrid(t){let e=parseInt(d3.select("svg").style("width"))/t,n=parseInt(d3.select("svg").style("height"))/t,r=d3.select("svg").select("g#diagram-grid");r.selectAll("*").remove();const i=25;for(let t=i;t<=n-i;t+=i)r.append("svg:line").attr("x1",0).attr("y1",t).attr("x2",e).attr("y2",t).attr("stroke-dasharray","1, 5").style("stroke","rgb(6,120,155)").style("stroke-width",1);for(let t=i;t<=e-i;t+=i)r.append("svg:line").attr("x1",t).attr("y1",0).attr("x2",t).attr("y2",n).attr("stroke-dasharray","1, 5").style("stroke","rgb(6,120,155)").style("stroke-width",1);r.attr("transform","scale("+t+")")},voltageColor(t,r){let i=r;if(null!=t){let r="ConductingEquipment.BaseVoltage";!0===n.props.model.schema.isA("TransformerEnd",t)&&(r="TransformerEnd.BaseVoltage");const o=n.props.model.getTargets([t],r)[0],a=n.props.model.getAttribute(o,"cim:BaseVoltage.nominalVoltage");if(void 0!==a&&""!==a.textContent){const t=a.textContent,n=parseFloat(t);i=e(n)}}return i},drawLegend(){let t=n.props.model.getObjects(["cim:BaseVoltage"])["cim:BaseVoltage"];d3.select("#legend-rect").attr("height",60+20*t.length),t.sort((function(t,e){const r=n.props.model.getAttribute(t,"cim:BaseVoltage.nominalVoltage"),i=n.props.model.getAttribute(e,"cim:BaseVoltage.nominalVoltage");if(void 0!==r&&void 0!==i){const t=r.textContent,e=parseFloat(t),n=i.textContent;return e
              Legend
              ',[{type:n.TAG,getComponent:r,evaluate:function(t){return"cimdiagramcontrols"},slots:[],attributes:[{type:e.ATTRIBUTE,name:"model",evaluate:function(t){return t.props.model}},{type:e.ATTRIBUTE,name:"dispatcher",evaluate:function(t){return t.props.dispatcher}}],redundantAttribute:"expr4",selector:"[expr4]"}])},name:"cimdiagram"}})),function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).cimDiagramControls=e()}(this,(function(){"use strict";let t=null,e="ConnectivityNode",n="ConnectivityNode.Terminals",r="Terminal.ConnectivityNode",i=d3.quadtree(),o=[],a=[],s=!1,l=!1,c=[{title:"Copy",action:function(e,n){let r=this;!0===t.props.model.schema.isA("TransformerEnd",d3.select(r).datum())&&(r=r.parentElement),-1===o.indexOf(r)&&(o.push(r),t.updateSelected());let i=d3.selectAll(o).data();for(let e of i)if("cim:ConnectivityNode"===e.nodeName){let n=t.props.model.getBusbar(e);null!==n&&(n.x=e.x,n.y=e.y,a.push(n))}else a.push(e)}},{title:"Rotate",action:function(e,n){let r=this;!0===t.props.model.schema.isA("TransformerEnd",d3.select(r).datum())&&(r=r.parentElement),-1===o.indexOf(r)&&(t.deselectAll(),o.push(r),t.updateSelected()),hidePopovers(o);let i=d3.selectAll(o);t.props.model.getTerminals(i.data()).forEach((function(t){t.rotation=(t.rotation+90)%360}));for(let e of i.data())e.rotation=(e.rotation+90)%360,t.props.model.updateActiveDiagram(e,e.lineData)}},{title:"Delete",action:function(e,n){let r=this;!0===t.props.model.schema.isA("TransformerEnd",d3.select(r).datum())&&(r=r.parentElement),t.deleteObject(r)}},{title:"Delete from current diagram",action:function(e,n){let r=this;!0===t.props.model.schema.isA("TransformerEnd",d3.select(r).datum())&&(r=r.parentElement),t.deleteFromDiagram(r)}},{title:"Show element info",action:function(e,n){let r=this;!0===t.props.model.schema.isA("TransformerEnd",d3.select(r).datum())&&(r=r.parentElement),-1===o.indexOf(r)&&(t.deselectAll(),o.push(r),t.updateSelected()),showPopovers(o)}},{title:"Add new operational limit set",action:function(e,n){t.addNewLimitSet(this,n)}}],u=c.concat([{title:"Add points",action:function(e,n){let r=t.status,i=this;t.disableAll(),t.deselectAll(),o.push(i),d3.select("svg").on("contextmenu.general",null),t.addDrawing(n,(function(e){let o=d3.select("svg"),a=o.selectAll("svg > #diagram-connect > path"),s=o.selectAll("svg > #diagram-connect > circle");switch(e.preventDefault(),t.addNewPoint(n),t.deleteFromDiagram(i),t.props.model.addToActiveDiagram(n,n.lineData),o.on("mousemove",null),a.attr("d",null),s.attr("transform","translate(0, 0)"),d3.select("svg > #diagram-connect > path").datum(null),o.on("contextmenu.add",null),o.on("click.add",null),r){case"DRAG":t.enableDrag();break;case"ZOOM":t.enableZoom();break;case"CONNECT":t.enableConnect();break;default:{let e=r.substring("ADD".length);e.startsWith("Multi")?(e=e.substring("Multi".length),t.enableAddMulti(e)):t.enableAdd(e);break}}d3.select("svg").on("contextmenu.general",d3.contextMenu(g))})),d3.select("svg").on("click.add",(function(){t.addNewPoint(n)}))}}]),f=[{title:"Delete point",action:function(e,n){let r=d3.selectAll(o).data().filter((t=>t===n[0]))[0];o=o.filter((t=>d3.select(t).datum()!==n[0])),t.deselectAll(),o.push(r),t.updateSelected(),t.deleteFromDiagram(this.parentNode),n[0].lineData=n[0].lineData.filter((t=>t.seq!==n[1]));for(let t of n[0].lineData)t.seq>n[1]&&(t.seq=t.seq-1);t.props.model.addToActiveDiagram(n[0],n[0].lineData)}}],d=[{title:"Add new operational limit set",action:function(e,n){t.addNewLimitSet(this,n)}},{title:"Add regulating control",action:function(e,n){t.addRegulatingControl(this,n)}},{title:"Add tap changer control",action:function(e,n){t.addTCControl(this,n)}}],h=d.concat([{title:"Add ratio tap changer",action:function(e,n){t.addTC(this,n)}}]),p=c.concat([{title:"Add ratio tap changer",action:function(e,n){t.addTC(this,n)}}]),m=[{title:"Delete",action:function(e,r){let i=t.getLinkedCNs([r.target])[0];if(void 0!==i){let e=t.props.model.ID(i.cn),n=d3.select("svg").selectAll("g#cimdiagram-"+e).node();t.deleteObject(n)}else t.props.model.removeLink(r.source,"cim:"+n,r.target)}}],g=[{title:"Paste",disabled:function(t,e){return a.length<1},action:function(e,n){if(a.length<1)return;let r=d3.pointer(e,d3.select("svg").node()),i=d3.zoomTransform(d3.select("svg").node());i.x,i.y,i.k;let o=r[0]-a[0].x,s=r[1]-a[0].y,l=null;for(let e of a){let n=t.props.model.createObject(e.nodeName);for(let r of t.props.model.getAttributes(e)){let e=r.nodeName,i=r.textContent;t.props.model.setAttribute(n,e,i)}if(n.x=e.x+o,n.y=e.y+s,"cim:BusbarSection"===n.nodeName){let n=t.props.model.getNode(e);if(null===n)return;l=n.lineData}else l=e.lineData;t.props.model.addToActiveDiagram(n,l)}a=[]}}];const b=d3.drag().on("drag",(function(e,n){hidePopovers(o);const r={x:e.x,y:e.y,seq:n[1]},i=t.align(n[0],r,!0);!function(t,e,n){const r=t.lineData.filter((t=>t.seq===e))[0],i=rotate({x:n.x,y:n.y},-1*t.rotation);if(1!==r.seq)r.x=n.x,r.y=n.y;else{t.x=t.x+n.x,t.y=t.y+n.y;for(let e of t.lineData)1!==e.seq&&(e.x=e.x-i.x,e.y=e.y-i.y)}}(n[0],n[1],i),t.props.model.updateActiveDiagram(n[0],n[0].lineData)})).on("start",(function(e,n){t.removeFromQuadtree()})).on("end",(function(e,n){t.highlight(null),t.props.model.updateActiveDiagram(n[0],n[0].lineData),t.addToQuadtree(d3.selectAll(o))}));return{css:null,exports:{onBeforeMount(a,s){t=this,t.props.dispatcher.on("moveTo",(function(e){t.deselectAll();let n=t.props.model.getObject(e),r=null,i=null,a=null,s=null,l=null;if(void 0!==n){switch(n.nodeName){case"cim:Substation":case"cim:Line":r=t.props.model.getTargets([n],"EquipmentContainer.Equipments");for(let e of r)"cim:BusbarSection"===e.nodeName&&(a=t.props.model.getNode(e),null!==a&&(e=a)),l=d3.select("svg").select("#cimdiagram-"+t.props.model.ID(e)).node(),null!==l&&o.push(l);break;case"cim:Analog":case"cim:Discrete":i=t.props.model.getTargets([n],"Measurement.Terminal");for(let e of i)l=d3.select("svg").select("#cimdiagram-"+t.props.model.ID(e)).node(),null!==l&&o.push(l);break;case"cim:BusbarSection":a=t.props.model.getNode(n),s=t.props.model.ID(a),l=d3.select("svg").selectAll("g#cimdiagram-"+s).node(),o=[l];break;default:l=d3.select("svg").selectAll("g#cimdiagram-"+e).node(),o=[l]}t.updateSelected()}})),t.props.dispatcher.on("deselect",(function(){t.deselectAll()})),t.props.dispatcher.on("render",(function(){"BUS_BRANCH"===t.props.model.getMode()?(e="TopologicalNode",n="TopologicalNode.Terminal",r="Terminal.TopologicalNode"):(c.push({title:"Add new measurement",action:function(e,n){t.addNewMeasurement(this,n)}}),u.push({title:"Add new measurement",action:function(e,n){t.addNewMeasurement(this,n)}}),d.push({title:"Add new measurement",action:function(e,n){t.addNewMeasurement(this,n)}}));let o=d3.select("svg").selectAll("svg > g#diagram-main > g:not(.edges) > g");i.x((function(t){let e=d3.select(t.elm).datum(),n=e.lineData.filter((e=>e.seq===t.seq));return e.x+n[0].x})).y((function(t){let e=d3.select(t.elm).datum(),n=e.lineData.filter((e=>e.seq===t.seq));return e.y+n[0].y})),t.addToQuadtree(o);let a=d3.select("svg").selectAll("svg > g#diagram-main > g.edges > g");t.addContextMenu(o),d3.select("svg").on("contextmenu.general",d3.contextMenu(g)),a.on("contextmenu",d3.contextMenu(m)),t.disableZoom(),t.disableConnect(),t.enableDrag(),document.querySelector("#cim-diagram-controls").classList.remove("invisible"),document.querySelector("#cim-diagram-insert").classList.remove("invisible"),document.querySelector("#cim-diagram-legend").classList.remove("invisible");let s=null;d3.select("body").on("keydown",(function(e){void 0!==e&&e.ctrlKey&&(null===s&&(s=t.status),t.disableDrag(),t.disableZoom(),t.enableZoom())})).on("keyup",(function(e){if(17===e.keyCode){switch(t.disableZoom(),s){case"DRAG":t.enableDrag();break;case"ZOOM":t.enableZoom();break;default:t.status=s}s=null}27===e.keyCode&&d3.contextMenu("close")}))})),t.props.dispatcher.on("addToDiagram",(function(e){1===e.size()&&(t.addToQuadtree(e),"DRAG"===t.status&&(t.disableAll(),t.enableDrag()),t.addContextMenu(e))})),t.props.dispatcher.on("createEdges",(function(t){t.on("contextmenu",d3.contextMenu(m))}))},onMounted(){document.querySelector("#select").addEventListener("change",(function(){t.disableAll(),t.enableDrag()})),document.querySelector("#pan").addEventListener("change",(function(){t.disableAll(),t.enableZoom()})),document.querySelector("#connect").addEventListener("change",(function(){t.disableAll(),t.enableConnect()})),document.querySelector("#legendToggle").addEventListener("change",(function(){const t=d3.transition().duration(750).ease(d3.easeLinear);!1===this.checked?d3.select("#diagram-legend").transition(t).attr("transform",d3.zoomIdentity.translate(1200,50)):d3.select("#diagram-legend").transition(t).attr("transform",d3.zoomIdentity.translate(1050,50))}))},disableAll(){t.disableDrag(),t.disableZoom(),t.disableConnect(),t.disableAdd()},deselectAll(){d3.selectAll(o).selectAll("rect.selection-rect").remove(),d3.selectAll(o).selectAll("g.resize").remove(),d3.selectAll(o).selectAll("circle.selection-circle").remove(),o=[]},enableDrag(){let e=[];t.disableDrag(),t.status="DRAG";let n=d3.drag().on("start",(function(n,r){if(d3.contextMenu("close"),-1===o.indexOf(this)&&t.deselectAll(),0===o.length&&(o.push(this),t.updateSelected()),t.removeFromQuadtree(),!0===t.props.model.schema.isA("ConductingEquipment",r)){let n=t.props.model.getTerminals([r]);e=t.getLinkedCNs(n)}let i=t.props.model.getTerminals(d3.selectAll(o).data());d3.select("svg").selectAll("svg > g#diagram-main > g.edges > g").filter((function(t){return d3.selectAll(o).data().indexOf(t.source)>-1||i.indexOf(t.target)>-1})).select("path").attr("stroke","green").attr("stroke-width","3")})).on("drag",(function(n,r){hidePopovers(o);let i=n.x-r.x,a=n.y-r.y,s={x:0,y:0};for(let e of o){let n=d3.select(e).data()[0];if(n.x=n.x+i,n.px=n.x,n.y=n.y+a,n.py=n.y,0===s.x&&0===s.y)for(let e of n.lineData){let r=t.align(n,e,!1);if(s={x:r.x-e.x,y:r.y-e.y},0!==s.x||0!==s.y){e.seq>1&&(s=rotate(s,n.rotation));break}}}for(let e of o){let n=d3.select(e).data()[0];l(n,null,s),t.props.model.updateActiveDiagram(n,n.lineData)}for(let n of e){let e={x:n.cnTerms[0].x,y:n.cnTerms[0].y},r={x:n.cnTerms[1].x,y:n.cnTerms[1].y};n.cnTerms[0].rotation>0&&(e=rotateTerm(t.props.model,n.cnTerms[0])),n.cnTerms[1].rotation>0&&(r=rotateTerm(t.props.model,n.cnTerms[1])),n.cn.x=(e.x+r.x)/2,n.cn.y=(e.y+r.y)/2,t.props.model.updateActiveDiagram(n.cn,n.cn.lineData)}function l(t,e,n){t.x=t.x+n.x,t.y=t.y+n.y,t.px=t.x,t.py=t.y}})).on("end",(function(n,r){t.addToQuadtree(d3.selectAll(o)),e=[];let i=t.props.model.getTerminals(d3.selectAll(o).data());d3.select("svg").selectAll("svg > g#diagram-main > g.edges > g").filter((function(t){return d3.selectAll(o).data().indexOf(t.source)>-1||i.indexOf(t.target)>-1})).select("path").attr("stroke","black").attr("stroke-width","1"),t.highlight("x",null),t.highlight("y",null)}));d3.select("svg").selectAll("svg > g#diagram-main > g:not(.edges) > g").call(n),d3.select("svg").select("g#diagram-brush").call(d3.brush().on("start",(function(){let e=window.location.hash.substring(1).split("/"),n=e[0]+"/"+e[1]+"/"+e[2];route.router.push(n),t.deselectAll(),hidePopovers(),d3.contextMenu("close")})).on("end",(function(e){d3.select("svg").select("g#diagram-brush").selectAll("*:not(.overlay)").style("display","none");let n=e.selection;if(null===n)return;t.deselectAll();let r=d3.zoomTransform(d3.select("svg").node()),a=r.x,s=r.y,l=r.k;o=t.search(i,(n[0][0]-a)/l,(n[0][1]-s)/l,(n[1][0]-a)/l,(n[1][1]-s)/l),t.updateSelected()})))},search(t,e,n,r,i){let o=new Set;return t.visit((function(t,a,s,l,c){if(!t.length)do{let a=t.data,s=d3.select(a.elm).datum();for(let t of s.lineData){let l=rotate(t,s.rotation),c=s.x+l.x,u=s.y+l.y;if(c>=e&&c=n&&u=r||s>=i||lo.indexOf(t.elm)>-1));i.removeAll(t)},updateSelected(){d3.selectAll(o).each((function(e){t.hover(this)})).selectAll("g.resize").call(b).filter((function(t){return t[0].lineData.length>2})).on("contextmenu",d3.contextMenu(f))},getLinkedCNs(e){let i=[],o=t.props.model.getTargets(e,r);for(let e of o){if(void 0===e.lineData)continue;if(e.lineData.length>1)continue;let r=t.props.model.getTargets([e],n);if(2===r.length){let t={cn:e,cnTerms:r};i.push(t)}}return i},disableDrag(){d3.select("svg").selectAll("svg > g#diagram-main > g:not(.edges) > g").on(".drag",null),d3.select("svg").select("g#diagram-brush").on(".brush",null),"DRAG"===t.status&&d3.select("svg").select("g#diagram-brush").call(d3.brush().move,null)},enableZoom(){t.status="ZOOM",hidePopovers(),d3.select("svg").selectAll("svg > g#diagram-main > g:not(.edges) > g").on("click.zoom",(function(e,n){let r=window.location.hash.substring(1).split("/"),i=r[0]+"/"+r[1]+"/"+r[2];route.router.push(i+"/"+t.props.model.ID(n))}));let e=d3.zoom();e.on("zoom",this.zooming),d3.select("svg").call(e)},disableZoom(){d3.select("svg").selectAll("svg > g#diagram-main > g:not(.edges) > g").on("click.zoom",null),d3.select("svg").on(".zoom",null)},zooming(e){d3.select("svg").select("g#diagram-main").attr("transform",e.transform),t.props.dispatcher.trigger("transform");let n=d3.select("svg > #diagram-connect > path").datum();if(void 0===n)return;let r=d3.line().x((function(t){return t.x})).y((function(t){return t.y})),i=d3.select("svg > #diagram-connect > path"),o=d3.zoomTransform(d3.select("svg").node()),a=d3.select("svg > #diagram-connect > circle").node().transform.baseVal.consolidate();if(null===a)return;let s=a.matrix,l=s.e-10,c=s.f-10,u=[],f=n.obj;if(void 0===f.lineData)u.push({x:f.x*o.k+o.x,y:f.y*o.k+o.y});else for(let t of f.lineData)u.push({x:(t.x+f.x)*o.k+o.x,y:(t.y+f.y)*o.k+o.y});u.push({x:l,y:c}),i.attr("d",(function(){return r(u)}))},enableConnect(){function n(e){d3.select("svg").selectAll("svg > #diagram-connect > path").attr("d",null),d3.select("svg").selectAll("svg > #diagram-connect > circle").attr("transform","translate(0, 0)");let n=d3.select("svg > #diagram-connect > path").datum();void 0!==n&&(d3.select("svg").on("mousemove",null),t.props.model.setLink(n.obj,"cim:"+r,e),d3.select("svg > #diagram-connect > path").datum(null))}t.deselectAll(),d3.select("body").on("keyup.connect",(function(e){27===e.keyCode&&(t.disableConnect(),t.enableConnect())})),t.status="CONNECT",d3.select("svg").selectAll("svg > g#diagram-main > g:not(.edges) > g > g.Terminal").on("click",(function(n,i){let o=d3.line().x((function(t){return t.x})).y((function(t){return t.y})),a={x:i.x,y:i.y};i.rotation>0&&(a=rotateTerm(t.props.model,i));let s=d3.select("svg"),l=d3.select("svg > #diagram-connect > path"),c=d3.select("svg > #diagram-connect > circle"),u=l.datum();if(void 0!==u&&(u=u.obj),void 0!==u){let n=t.props.model.getTargets([i],r)[0];if(void 0===n)n=t.props.model.getTargets([u],r)[0];else{let n=t.getLinkedCNs([u]);for(let r of n){let n=t.props.model.ID(r.cn),i=d3.select("svg > g#diagram-main > g."+e+"s > g#cimdiagram-"+n).node();t.deleteObject(i)}}if(d3.select("svg").selectAll("svg > #diagram-connect > path").attr("d",null),d3.select("svg").selectAll("svg > #diagram-connect > circle").attr("transform","translate(0, 0)"),void 0===n){let r={x:u.x,y:u.y};u.rotation>0&&(r=rotateTerm(t.props.model,u)),n=t.props.model.createObject("cim:"+e),t.props.model.setAttribute(n,"cim:IdentifiedObject.name","new1"),n.x=(r.x+a.x)/2,n.y=(r.y+a.y)/2,t.props.model.addToActiveDiagram(n,[{x:0,y:0,seq:1}])}d3.select("svg").on("mousemove",null);let o="cim:"+r;t.props.model.setLink(u,o,n),t.props.model.setLink(i,o,n),l.datum(null)}else{s.on("mousemove",(function(t){let e=d3.pointer(t),n=d3.zoomTransform(d3.select("svg").node());c.attr("transform",(function(){return"translate("+(e[0]+10)+","+(e[1]+10)+")"})),l.attr("d",(function(){let t=a.x*n.k+n.x,r=a.y*n.k+n.y;return o([{x:t,y:r},{x:e[0],y:e[1]}])}))})),l.datum({obj:i})}})),d3.select("svg").selectAll("svg > g#diagram-main > g."+e+"s > g."+e).on("click",(function(t,e){n(e)})),d3.select("svg").selectAll("svg > g#diagram-main > g.edges > g").on("click",(function(t,e){n(e.source)}))},disableConnect(){d3.select("body").on("keyup.connect",null),d3.select("svg").selectAll("svg > g#diagram-main > g:not(.edges) > g > g.Terminal").on("click",null),d3.select("svg").selectAll("svg > g#diagram-main > g."+e+"s > g."+e).on("click",null),d3.select("svg").selectAll("svg > g#diagram-main > g.edges > g").on("click",null),d3.select("svg").on("mousemove",null),d3.select("svg > #diagram-connect > path").attr("d",null),d3.select("svg > #diagram-connect > circle").attr("transform","translate(0, 0)");let t=d3.select("svg > #diagram-connect > path").datum();void 0!==t&&"cim:Terminal"===t.nodeName&&d3.select("svg > #diagram-connect > path").datum(null)},enableAdd(e){let n="",r="";"object"==typeof e?(n=e.target.id,r=e.target.textContent):(n=e,r=d3.select("#"+n).text());let i=void 0;"Three-winding Transformer"===r&&(i={windNum:3}),t.disableAll(),document.querySelector("cimDiagramControls").querySelectorAll("input").forEach((function(t){t.checked=!1})),document.querySelector("#addElement").textContent=r,t.status="ADD"+n,d3.select("svg").on("click.add",(function(e){if(!1===e.ctrlKey){let r=t.props.model.createObject("cim:"+n,i);addToDiagram(t.props.model,e,r)}}))},enableAddMulti(e){let n="",r="",i=d3.select("svg"),o=i.selectAll("svg > #diagram-connect > path"),a=i.selectAll("svg > #diagram-connect > circle");t.disableAll(),d3.select("svg").on("contextmenu.general",null),d3.select("body").on("keyup.addMulti",(function(n){27===n.keyCode&&(t.disableAdd(),t.enableAddMulti(e))})),"object"==typeof e?(n=e.target.id,r=e.target.textContent):(n=e,r=d3.select("#"+n).text()),document.querySelector("cimDiagramControls").querySelectorAll("input").forEach((function(t){t.checked=!1})),document.querySelector("#addElement").textContent=r,t.status="ADDMulti"+n,d3.select("svg").on("click.add",(function(e){if(!1===e.ctrlKey)if(t.status==="ADDMulti"+n){s=t.props.model.createObject("cim:"+n);let r=d3.pointer(e),l=d3.zoomTransform(d3.select("svg").node()),c=l.x,u=l.y,f=l.k;s.x=Math.round((r[0]-c)/f),s.px=s.x,s.y=Math.round((r[1]-u)/f),s.py=s.y,s.lineData=[{x:0,y:0,seq:1}],s.rotation=0,t.addDrawing(s,(function(e){e.preventDefault(),t.addNewPoint(s),t.props.model.addToActiveDiagram(s,s.lineData),t.status="ADDMulti"+n,i.on("mousemove",null),o.attr("d",null),a.attr("transform","translate(0, 0)"),d3.select("svg > #diagram-connect > path").datum(null),i.on("contextmenu.add",null)}))}else t.addNewPoint(s)}));let s=void 0},addDrawing(e,n){t.status="ADDdrawing";let r=d3.select("svg");r.on("contextmenu.add",n),r.on("mousemove",(function(n){let i=d3.pointer(n),o=d3.zoomTransform(r.node()),a=(i[0]-o.x)/o.k,s=(i[1]-o.y)/o.k,l=rotate({x:a-e.x,y:s-e.y,seq:null},-1*e.rotation),c=rotate(t.align(e,l,!0),e.rotation);!function(t,n,i){let o=d3.zoomTransform(r.node()),a=r.selectAll("svg > #diagram-connect > path"),s=r.selectAll("svg > #diagram-connect > circle"),l=d3.line().x((function(t){return t.x})).y((function(t){return t.y}));s.attr("transform",(function(){return"translate("+((t.x+i.x)*o.k+o.x+10)+","+((t.y+i.y)*o.k+o.y+10)+")"})),a.attr("d",(function(){let n=[];for(let r of t.lineData){let i=rotate(r,e.rotation);n.push({x:(i.x+t.x)*o.k+o.x,y:(i.y+t.y)*o.k+o.y})}return n.push({x:(t.x+i.x)*o.k+o.x,y:(t.y+i.y)*o.k+o.y}),l(n)})),a.datum({obj:e,x:t.x+i.x,y:t.y+i.y})}(e,0,c)}))},addNewPoint(e){let n=d3.select("svg").selectAll("svg > #diagram-connect > path").datum(),r=n.x-e.x,i=n.y-e.y,o=e.lineData.length+1,a=rotate({x:r,y:i},-1*e.rotation);e.lineData.push({x:a.x,y:a.y,seq:o}),t.highlight(null)},align(e,n,r){let o=d3.zoomTransform(d3.select("svg").node()),a=!1,c=!1,u=rotate(n,e.rotation),f=e.x+u.x,d=e.y+u.y,h=u.x,p=u.y,m=f-250/o.k,g=d-250/o.k,b=f+250/o.k,v=d+250/o.k,y=t.search(i,m,g,b,v),_=d3.selectAll(y).data();!0===r&&_.push(e);for(let r of _)t:for(let i of r.lineData){if(r===e&&i.seq===n.seq)continue t;let u=rotate(i,r.rotation),m=u.x+r.x,g=u.y+r.y,b=f-m,v=d-g;if(Math.abs(b)<5){f=m,h=f-e.x;let n=m*o.k+o.x;t.highlight("x",n),a=!0,s=!0}if(Math.abs(v)<5){d=g,p=d-e.y;let n=g*o.k+o.y;t.highlight("y",n),c=!0,l=!0}}!1===a&&!0===s&&(t.highlight("x",null),s=!1),!1===c&&!0===l&&(t.highlight("y",null),l=!1);let w={x:h,y:p},x=rotate(w,-1*e.rotation);return 1===n.seq?w:x},highlight(t,e,n){let r=d3.select("svg").select("g#diagram-highlight"),i=null,o=null,a=null,s=null,l=parseInt(d3.select("svg").style("height")),c=parseInt(d3.select("svg").style("width")),u=2*Math.max(l,c);"x"===t?(i=e,o=-1*u,a=e,s=u,r.select("line.highlight-x").attr("x1",i).attr("y1",o).attr("x2",a).attr("y2",s)):"y"===t?(i=-1*u,o=e,a=u,s=e,r.select("line.highlight-y").attr("x1",i).attr("y1",o).attr("x2",a).attr("y2",s)):(r.select("line.highlight-x").attr("x1",i).attr("y1",o).attr("x2",a).attr("y2",s),r.select("line.highlight-y").attr("x1",i).attr("y1",o).attr("x2",a).attr("y2",s)),3===arguments.length?r.attr("transform","rotate("+n.val+","+n.x+","+n.y+")"):r.attr("transform",null)},disableAdd(){document.querySelector("#addElement").textContent="Insert element",d3.select("body").on("keyup.addMulti",null),d3.select("svg").on("click.add",null),d3.select("svg").on("contextmenu.add",null),d3.select("svg").on("contextmenu.general",d3.contextMenu(g)),d3.select("svg").on("mousemove",null),d3.select("svg > #diagram-connect > path").attr("d",null),d3.select("svg > #diagram-connect > circle").attr("transform","translate(0, 0)");let e=d3.select("svg > #diagram-connect > path").datum();if(void 0!==e){0===t.props.model.getDiagramObjects([e.obj]).length?t.props.model.deleteObject(e.obj):calcLineData(t.props.model,e.obj)}d3.select("svg > #diagram-connect > path").datum(null),t.highlight("x",null),t.highlight("y",null)},hover(t){let n=d3.select(t);n.filter("g:not(.ACLineSegment)").filter("g:not(."+e+")").filter("g:not(.Terminal)").each((function(t){d3.select(this).append("rect").attr("x",this.getBBox().x).attr("y",this.getBBox().y).attr("width",this.getBBox().width).attr("height",this.getBBox().height).attr("stroke","black").attr("stroke-width",2).attr("stroke-dasharray","5,5").attr("fill","none").attr("class","selection-rect")})),n.filter("g.ACLineSegment,g."+e).selectAll("g.resize").data((function(t){return t.lineData.map((e=>[t,e.seq]))})).enter().append("g").attr("class","resize").append("rect").attr("x",(function(t){return t[0].lineData.filter((e=>e.seq===t[1]))[0].x-2})).attr("y",(function(t){return t[0].lineData.filter((e=>e.seq===t[1]))[0].y-2})).attr("width",4).attr("height",4),n.filter("g.Terminal").each((function(t){let e=d3.select(this).select("circle");d3.select(this).append("circle").attr("cx",e.attr("cx")).attr("cy",e.attr("cy")).attr("r",8).attr("stroke-width",0).attr("fill","red").attr("fill-opacity","0.7").attr("class","selection-circle")}))},addNewMeasurement(n,r){t.deselectAll(),"cim:Terminal"!==r.nodeName&&(o.push(n),t.updateSelected());let i=null;if(i=!0===t.props.model.schema.isA("Switch",r)?t.props.model.createObject("cim:Discrete"):t.props.model.createObject("cim:Analog"),"cim:Terminal"===r.nodeName){let e=t.props.model.getTargets([r],"Terminal.ConductingEquipment")[0];t.props.model.setLink(i,"cim:Measurement.Terminal",r),t.props.model.setLink(i,"cim:Measurement.PowerSystemResource",e)}else if(r.nodeName==="cim:"+e){let e=t.props.model.getBusbar(r);null!==e&&t.props.model.setLink(i,"cim:Measurement.PowerSystemResource",e)}else t.props.model.setLink(i,"cim:Measurement.PowerSystemResource",r);t.props.model.addToActiveDiagram(i,[])},addNewLimitSet(n,r){t.deselectAll();let i=n,a=r;!0===t.props.model.schema.isA("TransformerEnd",d3.select(n).datum())&&(i=n.parentElement,a=d3.select(i).datum()),"cim:Terminal"!==a.nodeName&&(o.push(i),t.updateSelected());let s=t.props.model.createObject("cim:OperationalLimitSet");if("cim:Terminal"===a.nodeName)t.props.model.getTargets([a],"Terminal.ConductingEquipment")[0],t.props.model.setLink(s,"cim:OperationalLimitSet.Terminal",a);else if(a.nodeName==="cim:"+e){let e=t.props.model.getBusbar(a);null!==e&&t.props.model.setLink(s,"cim:OperationalLimitSet.Equipment",e)}else t.props.model.setLink(s,"cim:OperationalLimitSet.Equipment",a);t.props.model.addToActiveDiagram(s,[])},addRegulatingControl(e,n){t.deselectAll();let r=t.props.model.createObject("cim:RegulatingControl");t.props.model.setLink(r,"cim:RegulatingControl.Terminal",n),t.props.model.addToActiveDiagram(r,[])},addTCControl(e,n){t.deselectAll();let r=t.props.model.createObject("cim:TapChangerControl");t.props.model.setLink(r,"cim:RegulatingControl.Terminal",n),t.props.model.addToActiveDiagram(r,[])},addTC(e,n){t.deselectAll();let r=n;if(!0===t.props.model.schema.isA("Terminal",n)&&(r=t.props.model.getTargets([n],"Terminal.TransformerEnd")[0]),0===t.props.model.getTargets([r],"TransformerEnd.RatioTapChanger").length){let e=t.props.model.createObject("cim:RatioTapChanger");t.props.model.setLink(e,"cim:RatioTapChanger.TransformerEnd",r),t.props.model.addToActiveDiagram(e,[])}},addContextMenu(t){t.filter("g:not(.ACLineSegment)").filter("g:not(."+e+")").filter("g:not(.PowerTransformer)").on("contextmenu",d3.contextMenu(c)),t.filter("g.ACLineSegment,g."+e).selectAll("path").on("contextmenu",(function(t,e){d3.contextMenu(u).bind(this.parentNode)(t,e),t.stopPropagation()})),t.filter("g:not(.PowerTransformer)").selectAll("g.Terminal").on("contextmenu",(function(t,e){d3.contextMenu(d).bind(this)(t,e),t.stopPropagation()})),t.filter("g.PowerTransformer").selectAll("g.Terminal").on("contextmenu",(function(t,e){d3.contextMenu(h).bind(this)(t,e),t.stopPropagation()})),t.filter("g.PowerTransformer").selectAll("g.TransformerEnd").on("contextmenu",(function(t,e){d3.contextMenu(p).bind(this)(t,e),t.stopPropagation()}))},deleteObject(e){let n=t.deleteSelection(e);t.props.model.deleteObjects(n.data())},deleteFromDiagram(e){let n=t.deleteSelection(e);for(let e of n.data())t.props.model.deleteFromDiagram(e)},deleteSelection(n){-1===o.indexOf(n)&&(t.deselectAll(),o.push(n));let r=d3.selectAll(o),i=t.props.model.getTerminals(r.data()),a=t.getLinkedCNs(i);for(let n of a){let r=t.props.model.ID(n.cn),i=d3.select("svg > g#diagram-main > g."+e+"s > g#cimdiagram-"+r).node();o.push(i)}return t.removeFromQuadtree(),r=d3.selectAll(o),disposePopovers(o),r.remove(),r}},template:function(t,e,n,r){return t('',[{redundantAttribute:"expr5",selector:"[expr5]",expressions:[{type:e.EVENT,name:"onclick",evaluate:function(t){return t.enableAddMulti}}]},{redundantAttribute:"expr6",selector:"[expr6]",expressions:[{type:e.EVENT,name:"onclick",evaluate:function(t){return t.enableAddMulti}}]},{redundantAttribute:"expr7",selector:"[expr7]",expressions:[{type:e.EVENT,name:"onclick",evaluate:function(t){return t.enableAdd}}]},{redundantAttribute:"expr8",selector:"[expr8]",expressions:[{type:e.EVENT,name:"onclick",evaluate:function(t){return t.enableAdd}}]},{redundantAttribute:"expr9",selector:"[expr9]",expressions:[{type:e.EVENT,name:"onclick",evaluate:function(t){return t.enableAdd}}]},{redundantAttribute:"expr10",selector:"[expr10]",expressions:[{type:e.EVENT,name:"onclick",evaluate:function(t){return t.enableAdd}}]},{redundantAttribute:"expr11",selector:"[expr11]",expressions:[{type:e.EVENT,name:"onclick",evaluate:function(t){return t.enableAdd}}]},{redundantAttribute:"expr12",selector:"[expr12]",expressions:[{type:e.EVENT,name:"onclick",evaluate:function(t){return t.enableAdd}}]},{redundantAttribute:"expr13",selector:"[expr13]",expressions:[{type:e.EVENT,name:"onclick",evaluate:function(t){return t.enableAdd}}]},{redundantAttribute:"expr14",selector:"[expr14]",expressions:[{type:e.EVENT,name:"onclick",evaluate:function(t){return t.enableAdd}}]},{redundantAttribute:"expr15",selector:"[expr15]",expressions:[{type:e.EVENT,name:"onclick",evaluate:function(t){return t.enableAdd}}]},{redundantAttribute:"expr16",selector:"[expr16]",expressions:[{type:e.EVENT,name:"onclick",evaluate:function(t){return t.enableAdd}}]},{redundantAttribute:"expr17",selector:"[expr17]",expressions:[{type:e.EVENT,name:"onclick",evaluate:function(t){return t.enableAdd}}]},{redundantAttribute:"expr18",selector:"[expr18]",expressions:[{type:e.EVENT,name:"onclick",evaluate:function(t){return t.enableAdd}}]},{redundantAttribute:"expr19",selector:"[expr19]",expressions:[{type:e.EVENT,name:"onclick",evaluate:function(t){return t.enableAdd}}]}])},name:"cimdiagramcontrols"}})),function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).cimDraw=e()}(this,(function(){"use strict";let t=null;return{css:'cimdraw .center-block,[is="cimdraw"] .center-block{ text-align: center; } cimdraw nav.navbar,[is="cimdraw"] nav.navbar{ margin-bottom: 20px; } cimdraw .app-container,[is="cimdraw"] .app-container{ display: flex; flex-flow: row nowrap; } cimdraw .navbar-light .navbar-text,[is="cimdraw"] .navbar-light .navbar-text{ color: rgba(0,0,0,1); } cimdraw .navbar-light .navbar-nav .nav-link,[is="cimdraw"] .navbar-light .navbar-nav .nav-link{ color: rgba(0,0,0,1); } cimdraw .cim-content-center,[is="cimdraw"] .cim-content-center{ text-align: center; max-width: 700px; } cimdraw #upload-boundary,[is="cimdraw"] #upload-boundary{ display: none; }',exports:{onBeforeMount(e,n){t=this,t.state.cimModel=cimModel(),t.state.diagramsToLoad=2,t.state.dispatcher={},observable(t.state.dispatcher),t.state.cimModel.on("setMode",(function(t){document.getElementById("cim-mode").textContent="NODE_BREAKER"===t?"Mode: Operational":"Mode: Planning"}))},onMounted(){const e=new bootstrap.Modal(document.getElementById("cimModeModal")),n=new bootstrap.Modal(document.getElementById("loadingModal")),r=new bootstrap.Modal(document.getElementById("loadingFileModal")),i=new bootstrap.Modal(document.getElementById("boundaryModal")),o=new bootstrap.Modal(document.getElementById("newDiagramModal"));let a={},s=!1,l=window.location.pathname.substring(1);function c(e){u();const n=document.getElementById("cim-diagrams"),r=document.createElement("option");r.setAttribute("value","#"+e+"/createNew"),r.textContent="Generate a new diagram",n.appendChild(r);const i=t.state.cimModel.getDiagramList();for(let t in i){const r=document.createElement("option");r.setAttribute("value","#"+e+"/diagrams/"+i[t]),r.setAttribute("id",i[t]),r.textContent=i[t],n.appendChild(r)}0===i.length&&route.router.push(e+"/createNew")}function u(){const t=document.getElementById("cim-diagrams");for(;null!==t.firstChild;)t.removeChild(t.lastChild);const e=document.createElement("option");e.setAttribute("disabled","disabled"),e.setAttribute("selected","selected"),e.textContent="Select a diagram",t.appendChild(e)}-1===l.indexOf("index.html")&&(l+="index.html"),route.setBase(l+"#"),route.router.push(window.location.hash.replace("#","")),route.initDomListeners(),t.state.dispatcher.on("loaded",(function(){t.state.diagramsToLoad=t.state.diagramsToLoad-1,0===t.state.diagramsToLoad&&(n.hide(),document.getElementById("loadingDiagramMsg").textContent="loading diagram...",t.state.diagramsToLoad=2)})),document.getElementById("operational").addEventListener("change",(function(){t.state.cimModel.setMode("NODE_BREAKER")})),document.getElementById("planning").addEventListener("change",(function(){t.state.cimModel.setMode("BUS_BRANCH")})),document.getElementById("cim-create-new-container").addEventListener("click",(function(){a={name:"new1"},s=!0,e.show()})),document.getElementById("cim-file-modal-error").addEventListener("click",(function(){r.hide(),route.router.push("")})),document.getElementById("cim-boundary-modal-error").addEventListener("click",(function(){i.hide(),document.getElementById("boundaryMsg").textContent="loading boundary file..."})),document.getElementById("cim-create-new-modal").addEventListener("click",(function(){route.router.push(a.name+"/diagrams")})),document.getElementById("load-boundary").addEventListener("click",(function(){return document.getElementById("upload-boundary").click(),!1})),document.getElementById("upload-boundary").addEventListener("change",(function(){const e=this.files[0];function n(){t.state.cimModel.loadBoundary(e).then((function(t){const e=document.createElement("br");document.getElementById("boundaryMsg").append(e,"OK. "+t),document.getElementById("cim-boundary-modal-error-container").style.display=null})).catch((function(t){const e=document.createElement("br");document.getElementById("boundaryMsg").append(e,t),document.getElementById("cim-boundary-modal-error-container").style.display=null}))}document.getElementById("boundaryModal").removeEventListener("shown.bs.modal",n),document.getElementById("boundaryModal").addEventListener("shown.bs.modal",n),i.show()})),document.getElementById("cim-save").addEventListener("click",(function(e){const n=t.state.cimModel.save(),r=new Blob([n],{type:"text/xml"}),i=URL.createObjectURL(r);e.currentTarget.setAttribute("href",i)})),document.getElementById("cgmes-save").addEventListener("click",(function(e){t.state.cimModel.saveAsCGMES().then((function(t){const e=URL.createObjectURL(t);document.getElementById("cgmes-download").setAttribute("href",e),document.getElementById("cgmes-download").click()})).catch((function(t){console.log(t)}))})),document.getElementById("cim-export").addEventListener("click",(function(e){const n=t.state.cimModel.export(),r=new Blob([n],{type:"text/xml"}),i=URL.createObjectURL(r);e.currentTarget.setAttribute("href",i)})),document.getElementById("matpower-export").addEventListener("click",(function(e){const n=exportToMatpower(t.state.cimModel),r=new Blob([n],{type:"text/plain"}),i=URL.createObjectURL(r);e.currentTarget.setAttribute("href",i)})),document.getElementById("newDiagramBtn").addEventListener("click",(function(t){const e=document.getElementById("newDiagramName").value,n=window.location.hash.substring(1).split("/")[0]+"/diagrams/"+e;o.hide(),route.router.push(n)})),document.getElementById("loadingFileModal").addEventListener("shown.bs.modal",(function(e){if(void 0===a.name)return r.hide(),void route.router.push("");{document.getElementById("cim-filename").innerHTML="["+a.name+"]  ";let e=null;e=!1===s?t.state.cimModel.load(a):t.state.cimModel.newFile(a.name),e.then((function(){c(a.name),r.hide(),"new1"!==a.name&&function(){const e=t.state.cimModel.getObjects(["cim:ConnectivityNode","cim:TopologicalNode"]);let n=e["cim:ConnectivityNode"];const r=e["cim:TopologicalNode"];n=n.filter((function(e){return!1===t.state.cimModel.isBoundary(e)})),n.length>0||0===r.length?t.state.cimModel.setMode("NODE_BREAKER"):t.state.cimModel.setMode("BUS_BRANCH")}()})).catch((function(t){const e=document.createElement("br");document.getElementById("loadingFileMsg").append(e,t),document.getElementById("cim-file-modal-error-container").style.display=null}))}})),route.route("").on.value((function(t){document.getElementById("cim-local-file-component").style.display=null,document.getElementById("app-container").style.display="none",document.getElementById("cim-load-container").style.display="none",document.getElementById("cim-home-container").style.display="none",document.getElementById("cim-diagrams").style.display="none",document.getElementById("cim-mode").style.display="none",document.getElementById("cim-file-modal-error-container").style.display="none",document.getElementById("cim-boundary-modal-error-container").style.display="none",u(),document.getElementById("cim-filename").textContent="";document.getElementById("cim-file-input").addEventListener("change",(function(){a=this.files[0],s=!1;const t="#"+encodeURI(a.name)+"/diagrams";document.getElementById("cim-load").setAttribute("href",t),document.getElementById("cim-load-container").style.display=null}))})),route.route(":file/diagrams").on.value((function(n){document.getElementById("cim-home-container").style.display=null,document.getElementById("cim-diagrams").style.display=null,document.getElementById("cim-mode").style.display=null,document.getElementById("cim-local-file-component").style.display="none",document.getElementById("app-container").style.display="none",document.getElementById("cim-export").parentNode.classList.add("disabled"),e.hide();const i=document.getElementById("cim-filename").textContent;a.name!==i?(document.getElementById("loadingFileMsg").textContent="loading CIM network...",r.show(),t.state.dispatcher.trigger("diagrams")):c(a.name)})),route.route(":file/diagrams/:name").on.value((function(e){const r=e.params.file,i=e.params.name;if(void 0!==a.name){if(t.state.cimModel.activeDiagramName===decodeURI(i))return t.state.dispatcher.trigger("showDiagram",r,i),void(document.getElementById("app-container").style.display=null);document.getElementById("cim-local-file-component").style.display="none",document.getElementById("loadingDiagramMsg").textContent="loading diagram...",document.getElementById("loadingModal").addEventListener("shown.bs.modal",(function e(n){!function(e,n,r){t.state.cimModel.selectDiagram(decodeURI(n)),c(decodeURI(e)),document.getElementById(decodeURI(n)).setAttribute("selected",!0),document.getElementById("app-container").style.display=null,document.getElementById("cim-export").parentNode.classList.remove("disabled"),t.state.dispatcher.trigger("showDiagram",e,n,r)}(r,i),document.getElementById("loadingModal").removeEventListener("shown.bs.modal",e)})),n.show()}else route.router.push("")})),route.route(":file/diagrams/:name/:element").on.value((function(e){const n=e.params.file,r=e.params.name,i=e.params.element;document.getElementById("cim-local-file-component").style.display="none",t.state.dispatcher.trigger("showDiagram",n,r,i)})),route.route(":file/createNew").on.value((function(t){window.history.back(),o.show()}))}},template:function(t,e,n,r){return t('


              ',[{type:n.TAG,getComponent:r,evaluate:function(t){return"cimtopologyprocessor"},slots:[],attributes:[{type:e.ATTRIBUTE,name:"model",evaluate:function(t){return t.state.cimModel}},{type:e.ATTRIBUTE,name:"dispatcher",evaluate:function(t){return t.state.dispatcher}}],redundantAttribute:"expr0",selector:"[expr0]"},{type:n.TAG,getComponent:r,evaluate:function(t){return"cimtree"},slots:[],attributes:[{type:e.ATTRIBUTE,name:"model",evaluate:function(t){return t.state.cimModel}},{type:e.ATTRIBUTE,name:"dispatcher",evaluate:function(t){return t.state.dispatcher}}],redundantAttribute:"expr1",selector:"[expr1]"},{type:n.TAG,getComponent:r,evaluate:function(t){return"cimdiagram"},slots:[],attributes:[{type:e.ATTRIBUTE,name:"model",evaluate:function(t){return t.state.cimModel}},{type:e.ATTRIBUTE,name:"dispatcher",evaluate:function(t){return t.state.dispatcher}}],redundantAttribute:"expr2",selector:"[expr2]"}])},name:"cimdraw"}})),function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).cimTopologyProcessor=e()}(this,(function(){"use strict";let t=null;return{css:'cimtopologyprocessor #cim-topology-processor,[is="cimtopologyprocessor"] #cim-topology-processor{ display: none }',exports:{onBeforeMount(e,n){t=this,e.dispatcher.on("diagrams",(function(){document.querySelector("#cim-topology-processor").style.display="flex"}))},run(e){const n=document.querySelector("#tpMsg"),r=document.getElementById("tpStatusModal"),i=new bootstrap.Modal(r);n.textContent="Loading...",i.show(),r.addEventListener("shown.bs.modal",(function(e){let r=topologyProcessor(t.props.model).calcTopology();n.textContent="Done ("+r.length+" nodes calculated)."}))}},template:function(t,e,n,r){return t('',[{redundantAttribute:"expr3",selector:"[expr3]",expressions:[{type:e.EVENT,name:"onclick",evaluate:function(t){return t.run}}]}])},name:"cimtopologyprocessor"}})),function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).cimTree=e()}(this,(function(){"use strict";let t=null,e=d3.contextMenu([{title:"Delete",action:function(e,n){t.props.model.deleteObject(n)}}]),n=null;return{css:'cimtree .tree,[is="cimtree"] .tree{ display: flex; flex-flow: column; max-height: 800px; min-width: 500px; resize: horizontal; padding-top: 10px; overflow: auto; } cimtree .tab-content,[is="cimtree"] .tab-content{ overflow: scroll; } cimtree .cim-tree-attribute-name,[is="cimtree"] .cim-tree-attribute-name{ text-align: left; min-width: 200px; } cimtree .cim-tree-attribute-uom,[is="cimtree"] .cim-tree-attribute-uom{ width: 70px; } cimtree .cim-tree-btn-group,[is="cimtree"] .cim-tree-btn-group{ flex-grow: 1; } cimtree .cim-tree-dropdown-toggle,[is="cimtree"] .cim-tree-dropdown-toggle{ flex-grow: 1; } cimtree ul,[is="cimtree"] ul{ list-style-type: none; } cimtree #tree-link-dialog,[is="cimtree"] #tree-link-dialog{ max-width: 18rem; align-self: center; min-width: 90%; min-height: min-content; } cimtree #tree-link-dialog > .card-body,[is="cimtree"] #tree-link-dialog > .card-body{ text-align: center; } cimtree #tree-controls,[is="cimtree"] #tree-controls{ padding-bottom: 10px; align-self: center; flex-shrink: 0; width: 370px; } cimtree #cim-search-form,[is="cimtree"] #cim-search-form{ align-self: center; max-width: 600px; padding-right: 20px; padding-left: 20px; padding-bottom: 20px; } cimtree .list-group-item > div,[is="cimtree"] .list-group-item > div{ width: 100%; } cimtree .cim-tree-btn-group > .cimLinkBtn,[is="cimtree"] .cim-tree-btn-group > .cimLinkBtn{ flex-grow: 1; } cimtree .tree > .nav-tabs,[is="cimtree"] .tree > .nav-tabs{ flex-shrink: 0; } cimtree .cim-expand-object,[is="cimtree"] .cim-expand-object{ border: transparent; } cimtree .cim-expand-object:focus,[is="cimtree"] .cim-expand-object:focus{ box-shadow: initial; } cimtree .cim-expand-object:hover,[is="cimtree"] .cim-expand-object:hover{ color: #6c757d; background-color: transparent; } cimtree li.attribute > .input-group,[is="cimtree"] li.attribute > .input-group{ flex-wrap: nowrap }',exports:{onBeforeMount(e,n){t=this,t.state.mode="default",e.dispatcher.on("showDiagram",(function(e,n,r){decodeURI(n)!==t.state.diagramName&&(d3.drag().on("drag.end",null),t.render(n)),void 0!==r?t.moveTo(r):d3.select(".tree").selectAll(".btn-danger").classed("btn-danger",!1).classed("btn-primary",!0)}))},onMounted(){[].slice.call(document.querySelectorAll("#cim-tree-tabs a")).forEach((function(t){const e=new bootstrap.Tab(t);t.addEventListener("click",(function(t){t.preventDefault(),e.show()}))})),document.getElementById("cim-search-key").addEventListener("keyup",(function(e){if("Enter"===e.key){let e=document.getElementById("cim-search-case").classList.contains("active"),r=document.getElementById("cim-search-key").value;if(""===r)document.getElementById("cim-search-results").classList.add("d-none"),n=null;else{let i=[];document.getElementById("app-tree").querySelectorAll("ul:not(.CIM-object-list)").forEach((function(t){let n=null;n=!0===e?Array.prototype.filter.call(t.querySelectorAll("li.CIM-object>button.cim-object-btn"),(function(t){return t.textContent.indexOf(r)>=0})):Array.prototype.filter.call(t.querySelectorAll("li.CIM-object>button.cim-object-btn"),(function(t){let e=r.toLocaleLowerCase();return t.textContent.toLocaleLowerCase().indexOf(e)>=0})),i=i.concat(n)})),i=[...new Set(i)],document.getElementById("cim-search-results").classList.remove("d-none"),i.length>0?(document.querySelector("#cim-search-results").textContent="Result 1 of "+i.length,n={elements:d3.selectAll(i).data(),actualResult:0},t.moveTo(t.props.model.ID(n.elements[n.actualResult]))):document.querySelector("#cim-search-results").textContent="Text not found"}}})),document.getElementById("cim-search-next").addEventListener("click",(function(){if(null!==n&&n.actualResult0){n.actualResult=n.actualResult-1;let e=n.actualResult+1;document.querySelector("#cim-search-results").textContent="Result "+e+" of "+n.elements.length,t.moveTo(t.props.model.ID(n.elements[n.actualResult]))}})),document.getElementById("showAllObjects").addEventListener("change",(function(){t.createTree(this.checked)})),document.getElementById("sshInput").addEventListener("change",(function(){t.resetAttrs()})),document.querySelectorAll('a[data-bs-toggle="tab"]').forEach((e=>e.addEventListener("click",(function(e){t.goToBasePath()})))),t.props.model.on("addToActiveDiagram",(function(e){t.addNewObject(e)})),t.props.model.on("deleteObject",(function(e,n){t.deleteObject(e)})),t.props.model.on("deleteFromDiagram",(function(e){!1===document.getElementById("showAllObjects").checked&&t.deleteObject(e)})),t.props.model.on("setAttribute",(function(e,n,r){if("cim:IdentifiedObject.name"===n){e.localName;let n=d3.select("div.tree").selectAll("ul#"+t.props.model.ID(e));if(!1===n.empty()){d3.select(n.node().parentNode).select("button").html(r)}document.querySelectorAll('[cim-target="'+t.props.model.ID(e)+'"]').innerHTML=r}})),t.props.model.on("addLink",(function(e,n,r){let i=t.props.model.ID(e),o=d3.select(".tree").select("#"+i),a=o.selectAll("#cimRemoveBtn").filter((function(t){return t.attributes[0].value==="#"+n.split(":")[1]}));o.selectAll(".cimLinkBtn").filter((function(t){return t.attributes[0].value==="#"+n.split(":")[1]})).html((function(){return t.props.model.getAttribute(r,"cim:IdentifiedObject.name").textContent})).attr("cim-target",(function(){return t.props.model.ID(r)})).attr("disabled",null),o.selectAll("#cimTarget").attr("id",null),a.attr("disabled",null),"BUS_BRANCH"===t.props.model.getMode()&&"cim:BusbarSection"===e.nodeName&&"cim:ConductingEquipment.BaseVoltage"===n&&t.props.model.setLink(t.props.model.getNode(e),"cim:TopologicalNode.BaseVoltage",r)})),t.props.model.on("removeLink",(function(e,n,r){let i=t.props.model.ID(e),o=d3.select(".tree").select("#"+i),a=o.selectAll("#cimRemoveBtn").filter((function(t){return t.attributes[0].value==="#"+n.split(":")[1]})),s=o.selectAll(".cimLinkBtn").filter((function(t){return t.attributes[0].value==="#"+n.split(":")[1]}));a.attr("disabled","disabled"),s.html("none").attr("cim-target","none").attr("disabled","disabled")})),t.props.model.on("createdDiagram",(function(){t.state.diagramName=decodeURI(t.props.model.activeDiagramName),document.getElementById("showAllObjects").checked=!1,document.getElementById("showAllObjects").dispatchEvent(new MouseEvent("click"))})),t.props.model.on("setMode",(function(e){"BUS_BRANCH"===t.state.mode&&(document.getElementById("measurementsTab").style.display=null)}))},goToBasePath(){let t=window.location.hash.substring(1).split("/");if(t.length>3){let e=t[0]+"/"+t[1]+"/"+t[2];route.router.push(e)}},addNewObject(e){const n=d3.select("div.tree > div.tab-content > div.tab-pane"),r=d3.select("div.tree > div.tab-content > div.tab-pane > ul#CIMComponents"),i=d3.select("div.tree > div.tab-content > div.tab-pane > ul#CIMContainers"),o=d3.select("div.tree > div.tab-content > div.tab-pane > ul#CIMMeasurements"),a=d3.select("div.tree > div.tab-content > div.tab-pane > ul#CIMBases"),s=d3.select("div.tree > div.tab-content > div.tab-pane > ul#CIMCurvesAndRegs"),l=d3.select("div.tree > div.tab-content > div.tab-pane > ul#CIMLimits");switch(e.nodeName){case"cim:ACLineSegment":t.elements(r,"ACLineSegment","AC Line Segments",[e]);break;case"cim:Breaker":t.elements(r,"Breaker","Breakers",[e]);break;case"cim:Disconnector":t.elements(r,"Disconnector","Disconnectors",[e]);break;case"cim:LoadBreakSwitch":t.elements(r,"LoadBreakSwitch","Load Break Switches",[e]);break;case"cim:Junction":t.elements(r,"Junction","Junctions",[e]);break;case"cim:EnergySource":{const n=t.createTopContainer(r,"Equivalent","Equivalents",[e]);t.elements(n,"EnergySource","Energy Sources",[e]);break}case"cim:SynchronousMachine":{const n=t.createTopContainer(r,"RotatingMachine","RotatingMachines",[e]);t.elements(n,"SynchronousMachine","Synchronous Machines",[e]);break}case"cim:AsynchronousMachine":{const n=t.createTopContainer(r,"RotatingMachine","RotatingMachines",[e]);t.elements(n,"AsynchronousMachine","Asynchronous Machines",[e]);break}case"cim:EnergyConsumer":{const n=t.createTopContainer(r,"Load","Loads",[e]);t.elements(n,"EnergyConsumer","Energy Consumers",[e]);break}case"cim:ConformLoad":{const n=t.createTopContainer(r,"Load","Loads",[e]);t.elements(n,"ConformLoad","Conform Loads",[e]);break}case"cim:NonConformLoad":{const n=t.createTopContainer(r,"Load","Loads",[e]);t.elements(n,"NonConformLoad","Non Conform Loads",[e]);break}case"cim:LinearShuntCompensator":{const n=t.createTopContainer(r,"Compensator","Compensators",[e]);t.elements(n,"LinearShuntCompensator","Linear",[e]);break}case"cim:NonlinearShuntCompensator":{const n=t.createTopContainer(r,"Compensator","Compensators",[e]);t.nlCompensators(n,[e]);break}case"cim:NonlinearShuntCompensatorPoint":{const n=t.props.model.getTargets([e],"NonlinearShuntCompensatorPoint.NonlinearShuntCompensator"),i=t.props.model.ID(n[0]),o=r.selectAll("ul#"+i);t.nlCompensatorPoints(o,[e]);break}case"cim:PowerTransformer":t.powerTransformers(r,[e]);break;case"cim:RatioTapChanger":{const n=t.props.model.getTargets([e],"RatioTapChanger.TransformerEnd"),i=t.props.model.ID(n[0]),o=r.selectAll("ul#"+i);t.tapChangers(o,[e]);break}case"cim:BusbarSection":t.elements(r,"BusbarSection","Nodes",[e]);break;case"cim:BaseVoltage":{const n=t.elements(a,"BaseVoltage","Base Voltages",[e]);t.createDeleteMenu(n);break}case"cim:GeographicalRegion":t.geoRegions(i,[e]);break;case"cim:SubGeographicalRegion":{const n=t.props.model.getTargets([e],"SubGeographicalRegion.Region"),r=t.props.model.ID(n[0]),o=i.selectAll("ul#"+r);t.subGeoRegions(o,[e]);break}case"cim:Substation":t.substations(i,[e]);break;case"cim:VoltageLevel":{const n=t.props.model.getTargets([e],"VoltageLevel.Substation"),r=t.props.model.ID(n[0]),o=i.selectAll("ul#"+r);t.voltageLevels(o,[e]);break}case"cim:Bay":{const n=t.props.model.getTargets([e],"Bay.VoltageLevel"),r=t.props.model.ID(n[0]),o=i.selectAll("ul#"+r);t.bays(o,[e]);break}case"cim:Line":{const n=t.elements(i,"Line","Lines",[e]);t.createDeleteMenu(n);break}case"cim:GeneratingUnit":{const n=t.createTopContainer(i,"GeneralGeneratingUnit","Generating Units",[e]);t.elements(n,"GeneratingUnit","General Units",[e]);break}case"cim:ThermalGeneratingUnit":{const n=t.createTopContainer(i,"GeneralGeneratingUnit","Generating Units",[e]);t.elements(n,"ThermalGeneratingUnit","Thermal Units",[e]);break}case"cim:Analog":{const n=t.elements(o,"Analog","Analogs",[e]);t.createDeleteMenu(n);break}case"cim:Discrete":{const n=t.elements(o,"Discrete","Discretes",[e]);t.createDeleteMenu(n);break}case"cim:LoadResponseCharacteristic":{const n=t.elements(s,"LoadResponseCharacteristic","Load Response Characteristics",[e]);t.createDeleteMenu(n);break}case"cim:TapChangerControl":{const n=t.elements(s,"TapChangerControl","Tap Changer Controls",[e]);t.createDeleteMenu(n);break}case"cim:RegulatingControl":{const n=t.elements(s,"RegulatingControl","Regulating Controls",[e]);t.createDeleteMenu(n);break}case"cim:OperationalLimitType":{const n=t.elements(l,"OperationalLimitType","Operational Limit Types",[e]);t.createDeleteMenu(n);break}case"cim:OperationalLimitSet":{let r=t.props.model.getTargets([e],"OperationalLimitSet.Equipment");if(0===r.length){const n=t.props.model.getTargets([e],"OperationalLimitSet.Terminal");r=t.props.model.getTargets(n,"Terminal.ConductingEquipment")}const i=t.props.model.ID(r[0]),o=n.selectAll("ul#"+i);t.limitSets(o,[e]);break}case"cim:VoltageLimit":case"cim:CurrentLimit":case"cim:ActivePowerLimit":case"cim:ApparentPowerLimit":{const r=t.props.model.getTargets([e],"OperationalLimit.OperationalLimitSet"),i=t.props.model.ID(r[0]),o=n.selectAll("ul#"+i);t.limits(o,[e]);break}}},createTree(e){let n=function*(e){d3.select("#app-tree").selectAll("#CIMComponents > li").remove(),d3.select("#app-tree").selectAll("#CIMContainers > li").remove(),d3.select("#app-tree").selectAll("#CIMMeasurements > li").remove(),d3.select("#app-tree").selectAll("#CIMBases > li").remove(),d3.select("#app-tree").selectAll("#CIMCurvesAndRegs > li").remove(),d3.select("#app-tree").selectAll("#CIMLimits > li").remove();let n=d3.select("div.tree > div.tab-content > div.tab-pane > ul#CIMComponents"),r=d3.select("div.tree > div.tab-content > div.tab-pane > ul#CIMContainers"),i=d3.select("div.tree > div.tab-content > div.tab-pane > ul#CIMMeasurements"),o=d3.select("div.tree > div.tab-content > div.tab-pane > ul#CIMBases"),a=d3.select("div.tree > div.tab-content > div.tab-pane > ul#CIMCurvesAndRegs"),s=d3.select("div.tree > div.tab-content > div.tab-pane > ul#CIMLimits"),l=["cim:Substation","cim:Line"],c=["cim:Analog","cim:Discrete"],u=["cim:GeneratingUnit","cim:ThermalGeneratingUnit"],f=null,d=null,h=null,p=null,m=null,g=null,b=t.props.model.getObjects,v=t.props.model.getObjects;!1===e&&(b=t.props.model.getGraphicObjects,v=t.props.model.getConnectors);if("BUS_BRANCH"===t.props.model.getMode()){let e=t.props.model.getObjects(["cim:BusbarSection","cim:TopologicalNode"]);0===e["cim:BusbarSection"].length&&e["cim:TopologicalNode"].forEach((function(e){let n=t.props.model.createObject("cim:BusbarSection",{node:e}),r=t.props.model.getAttribute(e,"cim:IdentifiedObject.name");void 0!==r&&t.props.model.setAttribute(n,"cim:IdentifiedObject.name",r.innerHTML)}))}let y=b(["cim:BusbarSection","cim:PowerTransformer","cim:ACLineSegment","cim:Breaker","cim:Disconnector","cim:LoadBreakSwitch","cim:Junction","cim:EnergySource","cim:EquivalentInjection","cim:SynchronousMachine","cim:AsynchronousMachine","cim:EnergyConsumer","cim:ConformLoad","cim:NonConformLoad","cim:LinearShuntCompensator","cim:NonlinearShuntCompensator"]);yield"TREE: extracted equipments",p=b(["cim:SubGeographicalRegion"])["cim:SubGeographicalRegion"],m=b(["cim:GeographicalRegion"])["cim:GeographicalRegion"],!1===e?(f=t.props.model.getLinkedObjects(l,["EquipmentContainer.Equipments","Substation.VoltageLevels/EquipmentContainer.Equipments","Substation.VoltageLevels/VoltageLevel.Bays/EquipmentContainer.Equipments"]),d=t.props.model.getLinkedObjects(c,["Measurement.PowerSystemResource"]),h=t.props.model.getLinkedObjects(u,["GeneratingUnit.RotatingMachine"]),p=p.concat(t.props.model.getTargets(f["cim:Substation"],"Substation.Region")),m=m.concat(t.props.model.getTargets(p,"SubGeographicalRegion.Region")),p=[...new Set(p)],m=[...new Set(m)],g=t.props.model.getLinkedObjects(["cim:LoadResponseCharacteristic"],["LoadResponseCharacteristic.EnergyConsumer"])):(f=b(l),d=b(c),h=b(u),g=b(["cim:LoadResponseCharacteristic"]));let _=t.props.model.getObjects(["cim:BaseVoltage","cim:TapChangerControl","cim:RegulatingControl","cim:OperationalLimitType"]),w=v(["cim:BusbarSection"])["cim:BusbarSection"],x=y["cim:EnergySource"].concat(y["cim:EquivalentInjection"]),T=y["cim:SynchronousMachine"].concat(y["cim:AsynchronousMachine"]),A=y["cim:EnergyConsumer"].concat(y["cim:ConformLoad"]).concat(y["cim:NonConformLoad"]),E=y["cim:LinearShuntCompensator"].concat(y["cim:nonlinearShuntCompensator"]),M=t.elements(i,"Analog","Analogs",d["cim:Analog"]);t.createDeleteMenu(M);let S=t.elements(i,"Discrete","Discretes",d["cim:Discrete"]);t.createDeleteMenu(S);let N=t.elements(o,"BaseVoltage","Base Voltages",_["cim:BaseVoltage"]);t.createDeleteMenu(N),t.elements(n,"ACLineSegment","AC Line Segments",y["cim:ACLineSegment"]),t.elements(n,"Breaker","Breakers",y["cim:Breaker"]),t.elements(n,"Disconnector","Disconnectors",y["cim:Disconnector"]),t.elements(n,"LoadBreakSwitch","Load Break Switches",y["cim:LoadBreakSwitch"]),t.elements(n,"Junction","Junctions",y["cim:Junction"]);let k=t.createTopContainer(n,"Equivalent","Equivalents",x);t.elements(k,"EnergySource","Energy Sources",y["cim:EnergySource"]),t.elements(k,"EquivalentInjection","Equivalent Injections",y["cim:EquivalentInjection"]);let C=t.createTopContainer(n,"RotatingMachine","Rotating Machines",T);t.elements(C,"SynchronousMachine","Synchronous Machines",y["cim:SynchronousMachine"]),t.elements(C,"AsynchronousMachine","Asynchronous Machines",y["cim:AsynchronousMachine"]);let D=t.createTopContainer(n,"Load","Loads",A);t.elements(D,"EnergyConsumer","Energy Consumers",y["cim:EnergyConsumer"]),t.elements(D,"ConformLoad","Conform Loads",y["cim:ConformLoad"]),t.elements(D,"NonConformLoad","Non Conform Loads",y["cim:NonConformLoad"]);let L=t.createTopContainer(n,"Compensator","Compensators",E);t.elements(L,"LinearShuntCompensator","Linear",y["cim:LinearShuntCompensator"]),t.nlCompensators(L,y["cim:NonlinearShuntCompensator"]),t.elements(n,"BusbarSection","Nodes",w),t.powerTransformers(n,y["cim:PowerTransformer"]),t.geoRegions(r,m),t.substations(r,f["cim:Substation"]);let O=t.elements(r,"Line","Lines",f["cim:Line"]);t.createDeleteMenu(O);let I=t.createTopContainer(r,"GeneralGeneratingUnit","Generating Units",h["cim:GeneratingUnit"].concat(h["cim:ThermalGeneratingUnit"]));t.elements(I,"GeneratingUnit","General Units",h["cim:GeneratingUnit"]),t.elements(I,"ThermalGeneratingUnit","Thermal Units",h["cim:ThermalGeneratingUnit"]),t.elements(a,"LoadResponseCharacteristic","Load Response Characteristics",g["cim:LoadResponseCharacteristic"]);let B=t.elements(a,"TapChangerControl","Tap Changer Controls",_["cim:TapChangerControl"]);t.createDeleteMenu(B);let P=t.elements(a,"RegulatingControl","Regulating Controls",_["cim:RegulatingControl"]);t.createDeleteMenu(P);let j=t.elements(s,"OperationalLimitType","Operational Limit Types",_["cim:OperationalLimitType"]);t.createDeleteMenu(j),t.createAddButton(o,"BaseVoltage"),t.createAddButton(r,"Substation"),t.createAddButton(r,"GeographicalRegion"),t.createAddButton(r,"Line"),t.createAddButton(r,"GeneratingUnit"),t.createAddButton(r,"ThermalGeneratingUnit"),t.createAddButton(a,"LoadResponseCharacteristic"),t.createAddButton(s,"OperationalLimitType")}(e);!function e(){let r=n.next().value;void 0!==r?(document.getElementById("loadingDiagramMsg").innerHTML="
              "+r,setTimeout(e,1)):t.props.dispatcher.trigger("loaded")}()},render(e){t.props.model.selectDiagram(decodeURI(e)),t.state.diagramName=decodeURI(e),document.getElementById("showAllObjects").checked=!0,document.getElementById("showAllObjects").dispatchEvent(new MouseEvent("click"))},geoRegions(e,n){let r=t.elements(e,"GeographicalRegion","Geographical Regions",n);r.each((function(e,n){let r=t.props.model.getTargets([e],"GeographicalRegion.Regions");t.subGeoRegions(d3.select(this),r),t.subAddButton(d3.select(this),"SubGeographicalRegion","cim:SubGeographicalRegion.Region")})),t.createDeleteMenu(r)},subGeoRegions(e,n){let r=e.data()[0],i=t.elements(e,t.props.model.ID(r)+"SubGeographicalRegion","Sub-Geographical Regions",n);t.createDeleteMenu(i)},substations(e,n){let r=t.elements(e,"Substation","Substations",n);r.each((function(e,n){let r=t.props.model.getTargets([e],"Substation.VoltageLevels");t.voltageLevels(d3.select(this),r),t.subAddButton(d3.select(this),"VoltageLevel","cim:VoltageLevel.Substation")})),t.createDeleteMenu(r)},voltageLevels(e,n){let r=e.data()[0],i=t.elements(e,t.props.model.ID(r)+"VoltageLevel","Voltage Levels",n);i.each((function(e,n){let r=t.props.model.getTargets([e],"VoltageLevel.Bays");t.bays(d3.select(this),r),t.subAddButton(d3.select(this),"Bay","cim:Bay.VoltageLevel")})),t.createDeleteMenu(i)},bays(e,n){let r=e.data()[0],i=t.elements(e,t.props.model.ID(r)+"Bay","Bays",n);t.createDeleteMenu(i)},powerTransformers(e,n){t.elements(e,"PowerTransformer","Transformers",n).each((function(e,n){let r=t.props.model.getTargets([e],"PowerTransformer.PowerTransformerEnd");t.elements(d3.select(this),t.props.model.ID(e)+"PowerTransformerEnd","Transformer Windings",r).each((function(e,n){let r=t.props.model.getTargets([e],"TransformerEnd.RatioTapChanger");t.tapChangers(d3.select(this),r)}))}))},nlCompensators(e,n){t.elements(e,"NonlinearShuntCompensator","Nonlinear",n).each((function(e,n){let r=t.props.model.getTargets([e],"NonlinearShuntCompensator.NonlinearShuntCompensatorPoints");t.nlCompensatorPoints(d3.select(this),r),t.subAddButton(d3.select(this),"NonlinearShuntCompensatorPoint","cim:NonlinearShuntCompensatorPoint.NonlinearShuntCompensator")}))},nlCompensatorPoints(e,n){let r=e.data()[0],i=t.elements(e,t.props.model.ID(r)+"NonlinearShuntCompensatorPoint","Points",n,!0);t.createDeleteMenu(i)},tapChangers(e,n){let r=e.data()[0],i=t.elements(e,t.props.model.ID(r)+"RatioTapChanger","Ratio Tap Changer",n);t.createDeleteMenu(i)},limitSets(e,n){const r=e.data()[0];let i=t.elements(e,t.props.model.ID(r)+"OperationalLimitSet","Operational Limit Sets",n);i.each((function(e,n){let r=t.props.model.getTargets([e],"OperationalLimitSet.OperationalLimitValue");t.limits(d3.select(this),r),t.subAddButton(d3.select(this),"VoltageLimit","cim:OperationalLimit.OperationalLimitSet"),t.subAddButton(d3.select(this),"CurrentLimit","cim:OperationalLimit.OperationalLimitSet"),t.subAddButton(d3.select(this),"ActivePowerLimit","cim:OperationalLimit.OperationalLimitSet"),t.subAddButton(d3.select(this),"ApparentPowerLimit","cim:OperationalLimit.OperationalLimitSet")})),t.createDeleteMenu(i)},limits(e,n){let r=e.data()[0],i=n.filter((e=>t.props.model.schema.isA("VoltageLimit",e))),o=n.filter((e=>t.props.model.schema.isA("CurrentLimit",e))),a=n.filter((e=>t.props.model.schema.isA("ActivePowerLimit",e))),s=n.filter((e=>t.props.model.schema.isA("ApparentPowerLimit",e))),l=t.elements(e,t.props.model.ID(r)+"VoltageLimit","Voltage limits",i),c=t.elements(e,t.props.model.ID(r)+"CurrentLimit","Current limits",o),u=t.elements(e,t.props.model.ID(r)+"ActivePowerLimit","Active power limits",a),f=t.elements(e,t.props.model.ID(r)+"ApparentPowerLimit","Apparent power limits",s);t.createDeleteMenu(l),t.createDeleteMenu(c),t.createDeleteMenu(u),t.createDeleteMenu(f)},createTopContainer(e,n,r,i){let o=e.select("li."+n+"s"),a=o.select("ul#"+n+"sList");if(o.empty()){o=e.append("li").attr("class",n+"s list-group-item d-flex justify-content-between cim-parent-container");let i=o.append("div");i.append("a").attr("class","btn btn-primary btn-sm").attr("role","button").attr("data-bs-toggle","collapse").attr("href","#"+n+"sList").html(r),o.append("h4").append("span").attr("class","badge bg-primary rounded-pill").html(0),a=i.append("ul").attr("id",n+"sList").attr("class","collapse"),o.on("click",(function(e){e.target===this&&t.goToBasePath()}))}return a},createAddButton(e,n){let r=e.select("li."+n+"s"),i=r.select("ul#"+n+"sList"),o=r.select("ul#"+n+"sList > button.cim-add-btn");!0===o.empty()&&(o=i.insert("li",":first-child").append("button").attr("class","btn btn-default btn-sm cim-add-btn").attr("type","submit"),o.html(' Add'),o.on("click.add",(function(){let e=t.props.model.createObject("cim:"+n);t.props.model.addToActiveDiagram(e,[])})))},subAddButton(e,n,r){let i=e.data()[0],o=t.props.model.ID(i)+n,a=e.select("li."+o+"s"),s=a.select("ul#"+o+"sList"),l=a.select("ul#"+o+"sList > button.cim-add-btn");!0===l.empty()&&(l=s.insert("li",":first-child").append("button").attr("class","btn btn-default btn-sm cim-add-btn").attr("type","submit"),l.html(' Add'),l.on("click.add",(function(){let e=t.props.model.createObject("cim:"+n);t.props.model.setLink(e,r,i),t.props.model.addToActiveDiagram(e,[])})))},createDeleteMenu(t){t.selectAll((function(){return this.parentNode.childNodes})).filter("button.cim-object-btn").on("contextmenu",e)},elements(e,n,r,i){let o=e.select("li."+n+"s"),a=o.select("ul#"+n+"sList");if(!0===o.empty()){o=e.append("li").attr("class",n+"s list-group-item d-flex justify-content-between"),o.append("div").append("a").attr("class","btn btn-primary btn-sm").attr("role","button").attr("data-bs-toggle","collapse").attr("href","#"+n+"sList").html(r),o.append("h4").append("span").attr("class","badge bg-primary rounded-pill").html(0),o.on("click",(function(e){e.target===this&&t.goToBasePath()})),a=o.select("div").append("ul").attr("id",n+"sList").attr("class","collapse")}let s=a.selectAll("li."+n).data(i,(function(e){return t.props.model.ID(e)})).enter().append("li").attr("class",n+" CIM-object").on("click",(function(e){e.target===this&&t.goToBasePath()}));s.append("a").attr("class","btn btn-outline-secondary btn-sm cim-expand-object").attr("role","button").attr("data-bs-toggle","collapse").attr("href",(function(e){return"#"+t.props.model.ID(e)})).on("click",(function(e,n){e.preventDefault();let r=d3.select(this.parentNode).select("ul");0===r.selectAll("li.attribute").size()&&t.generateAttrsAndLinks(r)})).html(''),s.append("button").attr("class","btn btn-primary btn-sm cim-object-btn").on("click",(function(e,n){let r=window.location.hash.substring(1).split("/"),i=r[0]+"/"+r[1]+"/"+r[2];window.location.hash.substring(1)!==i+"/"+t.props.model.ID(n)&&route.router.push(i+"/"+t.props.model.ID(n))})).html((function(e){let n=t.props.model.getAttribute(e,"cim:IdentifiedObject.name");return void 0!==n?n.innerHTML:"unnamed"})).attr("draggable","true").on("dragstart",(function(e,n){e.dataTransfer.setData("text/plain",t.props.model.ID(n))}));let l=s.append("ul").attr("id",(function(e){return t.props.model.ID(e)})).attr("class","collapse CIM-object-list"),c=parseInt(o.select(":scope > h4 > span").html());c+=l.size(),o.select(":scope > h4 > span").html(c);const u=o.node();if(null===u.closest(".CIM-object")){let t=u.closest("li.cim-parent-container");for(;null!==t;){let e=t.querySelector(":scope>h4>span"),n=parseInt(e.innerHTML);n+=l.size(),e.innerHTML=n,t=t.parentNode.closest("li.cim-parent-container")}}return l.each((function(e){if(t.props.model.schema.isA("Equipment",e)){let n=t.props.model.getTerminals([e]),r=t.props.model.getTargets([e],"Equipment.OperationalLimitSet");r=r.concat(t.props.model.getTargets(n,"ACDCTerminal.OperationalLimitSet")),t.limitSets(d3.select(this),r)}})),l},generateAttrsAndLinks(e){let n=a(!1===document.getElementById("sshInput").checked,"EQ");t.generateAttributes(n);let r=a(!0===document.getElementById("sshInput").checked,"SSH");t.generateAttributes(r);let i=s(!1===document.getElementById("sshInput").checked,"EQ");t.generateLinks(i);let o=s(!0===document.getElementById("sshInput").checked,"SSH");function a(n,r){return e.selectAll("li.attribute."+r).data((function(n){let i=t.props.model.schema.getSchemaAttributes(n.localName,r),o=e.selectAll("li.attribute > div > span.cim-tree-attribute-name").nodes().map((t=>t.textContent));return i=i.filter((function(t){let e=t.attributes[0].value.substring(1).split(".")[1];return o.indexOf(e)<0})),i.filter((t=>"#IdentifiedObject.mRID"!==t.attributes[0].value))})).enter().append("li").attr("class",l(n,r)).attr("title",(function(t){let e=t.attributes.getNamedItem("rdf:about").value.split(".")[1],n=[].filter.call(t.children,(function(t){return"rdfs:comment"===t.nodeName}));return n.length>0?e+" - "+n[0].textContent:e})).append("div").attr("class","input-group")}function s(n,r){return e.selectAll("li.link."+r).data((function(e){let n=["#NonlinearShuntCompensatorPoint.NonlinearShuntCompensator","#TransformerEnd.Terminal","#PowerTransformerEnd.PowerTransformer","#RatioTapChanger.TransformerEnd","#RegulatingControl.Terminal","#Measurement.Terminal","#Measurement.PowerSystemResource","#Discrete.ValueAliasSet","#OperationalLimitSet.Terminal","#OperationalLimitSet.Equipment","#OperationalLimit.OperationalLimitSet","#SubGeographicalRegion.Region","#VoltageLevel.Substation","#Bay.VoltageLevel"];return t.props.model.schema.getSchemaLinks(e.localName,r).filter((e=>"Yes"===t.props.model.getAttribute(e,"cims:AssociationUsed").textContent)).filter((t=>n.indexOf(t.attributes[0].value)<0))})).enter().append("li").attr("class",l(n,r)).attr("title",(function(t){let e=t.attributes.getNamedItem("rdf:about").value.split(".")[1],n=[].filter.call(t.children,(function(t){return"rdfs:comment"===t.nodeName}));return n.length>0?e+" - "+n[0].textContent:e})).append("div").attr("class","input-group")}function l(e,n){return function(r){let i="attribute "+n;!1===r.attributes.getNamedItem("rdf:about").value.startsWith("#")&&(i+=" entsoe");let o=null;return"EQ"===n&&(o=t.props.model.schema.getSchemaStereotype(r),null!==o&&(i=i+" "+o)),("Operation"===o&&"BUS_BRANCH"===t.props.model.getMode()||!1===e)&&(i+=" d-none"),i}}t.generateLinks(o)},generateAttributes(e){e.append("span").attr("class","input-group-text cim-tree-attribute-name").html((function(t){let e=t.attributes.getNamedItem("rdf:about").value.split(".")[1];return e.length>20&&(e=e.substring(0,20)+"..."),e})),e.filter((function(e){return"#String"===t.props.model.schema.getSchemaAttributeType(e)[0]})).append("input").attr("class","form-control").each(a).attr("type","text").on("input",l),e.filter((function(e){return"#Integer"===t.props.model.schema.getSchemaAttributeType(e)[0]})).append("input").attr("class","form-control").each((function(e){let n=d3.select(this.closest("ul")).data()[0],r=t.props.model.getAttribute(n,"cim:"+e.attributes[0].value.substring(1));void 0!==r?this.value=parseInt(r.innerHTML):d3.select(this).attr("placeholder","none")})).attr("type","number").on("input",l);let n=e.filter((function(e){let n=t.props.model.schema.getSchemaAttributeType(e);return"#Float"===n[0]||"#Decimal"===n[0]}));n.append("input").attr("class","form-control").each((function(e){let n=d3.select(this.closest("ul")).data()[0],r=t.props.model.getAttribute(n,"cim:"+e.attributes[0].value.substring(1));void 0!==r?this.value=parseFloat(r.innerHTML).toFixed(5):d3.select(this).attr("placeholder","none")})).attr("type","number").attr("step","0.00001").on("input",l),n.append("span").attr("class","input-group-text cim-tree-attribute-uom").html((function(e){let n=t.props.model.schema.getSchemaAttributeType(e);return"none"===n[2]?n[1]:n[2]+n[1]}));let r=e.filter((function(e){return"#Boolean"===t.props.model.schema.getSchemaAttributeType(e)[0]}));r.append("button").attr("type","button").attr("class","btn btn-outline-secondary dropdown-toggle cim-tree-dropdown-toggle").attr("data-bs-toggle","dropdown").attr("aria-expanded","false").append("span").attr("class","boolVal").each((function(e){let n=d3.select(this.closest("li.attribute").parentNode).data()[0],r=t.props.model.getAttribute(n,"cim:"+e.attributes[0].value.substring(1));void 0!==r?d3.select(this).text(r.innerHTML):d3.select(this).text("none")}));let i=r.append("ul").attr("class","dropdown-menu dropdown-menu-end");i.append("li").append("a").attr("class","dropdown-item").text("true").on("click",s),i.append("li").append("a").attr("class","dropdown-item").text("false").on("click",s),e.filter((function(e){return"#DateTime"===t.props.model.schema.getSchemaAttributeType(e)[0]})).append("input").attr("class","form-control").each(a).attr("type","datetime-local").on("input",l);let o=e.filter((function(e){return t.props.model.schema.isEnum(e)}));function a(e){let n=d3.select(this.closest("li.attribute").parentNode).data()[0],r=t.props.model.getAttribute(n,"cim:"+e.attributes[0].value.substring(1));void 0!==r?this.value=r.innerHTML:d3.select(this).attr("placeholder","none")}function s(e,n){let r=this.textContent;this.closest("div.input-group").querySelector(":scope>button>span.boolVal").textContent=r;let i=d3.select(this.closest("li.attribute").parentNode).data()[0],o="cim:"+n.attributes[0].value.substring(1);t.props.model.setAttribute(i,o,r)}function l(e,n){let r=d3.select(this.closest("ul")).data()[0],i=n.attributes.getNamedItem("rdf:about").value,o="cim:";!1===i.startsWith("#")&&(o="entsoe:"),i=i.substring(i.indexOf("#")+1);let a=o+i;t.props.model.setAttribute(r,a,this.value)}o.append("button").attr("type","button").attr("class","btn btn-outline-secondary dropdown-toggle cim-tree-dropdown-toggle").attr("data-bs-toggle","dropdown").attr("aria-expanded","false").append("span").attr("class","enumVal").each((function(e){let n=d3.select(this.closest("li.attribute").parentNode).data()[0],r=t.props.model.getEnum(n,"cim:"+e.attributes[0].value.substring(1));void 0!==r?d3.select(this).text(r):d3.select(this).text("none")})),o.append("ul").attr("class","dropdown-menu dropdown-menu-end").selectAll("li").data((function(e){return t.props.model.schema.getSchemaEnumValues(e)})).enter().append("li").append("a").on("click",(function(e,n){this.closest("div.input-group").querySelector(":scope>button>span.enumVal").textContent=n;let r=d3.select(this.closest("li.attribute").parentNode).data()[0],i=d3.select(this.closest("li.attribute")).data()[0],o="cim:"+i.attributes[0].value.substring(1),a=t.props.model.schema.getSchemaEnumName(i)+"."+n;t.props.model.setEnum(r,o,a)})).attr("class","dropdown-item").text((function(t){return t}))},generateLinks(e){e.attr("class","input-group").append("span").attr("class","input-group-text cim-tree-attribute-name").html((function(t){let e=t.attributes.getNamedItem("rdf:about").value.split(".")[1];return e.length>20&&(e=e.substring(0,20)+"..."),e}));let n=e.append("div").attr("class","btn-group cim-tree-btn-group");n.append("button").attr("class","btn btn-outline-secondary cimLinkBtn").attr("type","submit").on("click",(function(t,e){let n="#"+d3.select(this).attr("cim-target"),r=window.location.hash.substring(1).split("/"),i=r[0]+"/"+r[1]+"/"+r[2];route.router.push(i+"/"+n.substring(1))})).attr("cim-target",(function(e){let n=d3.select(this.closest("ul")).data()[0],r=t.props.model.getTargets([n],e.attributes[0].value.substring(1))[0];return void 0===r?"none":t.props.model.ID(r)})).html((function(e){let n=t.props.model.getObject(d3.select(this).attr("cim-target"));if(void 0===n)return d3.select(this).attr("disabled","disabled"),"none";let r=t.props.model.getAttribute(n,"cim:IdentifiedObject.name");return void 0!==r?r.innerHTML:"unnamed"})),n.append("button").attr("class","btn btn-outline-secondary").attr("type","submit").on("click",(function(e,n){let r=d3.select(this.parentNode),i=t.props.model.schema.getLinkRange(n),o=d3.select(".tree").selectAll(".tab-pane > .list-group > .list-group-item > div > ul"),a=o.filter((function(e){let n=!1,r=d3.select(this).select(".CIM-object");return r.size()>0&&(n=!0===t.props.model.schema.isA(i,r.datum())),n})),s=o.filter((function(e){let n=!0,r=d3.select(this).select(".CIM-object");return r.size()>0&&(n=!1===t.props.model.schema.isA(i,r.datum())),n}));t.enterSetLinkMode(r,a,s)})).html("change"),n.append("button").attr("class","btn btn-outline-secondary").attr("type","submit").attr("id","cimRemoveBtn").on("click",(function(e,n){let r=d3.select(this.closest("ul")).data()[0],i="cim:"+n.attributes[0].value.substring(1),o=t.props.model.getObject(this.parentNode.querySelector("[cim-target]").getAttribute("cim-target"));t.props.model.removeLink(r,i,o)})).html((function(){return void 0===t.props.model.getObject(this.parentNode.querySelector("[cim-target]").getAttribute("cim-target"))&&d3.select(this).attr("disabled","disabled"),"remove"}))},setLink(e,n){let r=d3.select(e.node().closest("ul")).data()[0],i=t.props.model.ID(r);if(null!==n){let i="cim:"+e.data()[0].attributes[0].value.substring(1);t.props.model.setLink(r,i,n)}let o=window.location.hash.substring(1).split("/"),a=o[0]+"/"+o[1]+"/"+o[2];route.router.push(a+"/"+i)},enterSetLinkMode(e,n,r){t.state.mode="setLinks",document.getElementById("tree-link-dialog").classList.remove("d-none"),document.getElementById("tree-controls").classList.add("d-none"),n.each((function(n){let r=d3.select(this).selectAll(".CIM-object");r.select("button.cim-object-btn").classed("btn-primary",!1).classed("btn-outline-dark",!0),r.insert("button",":first-child").attr("class","btn btn-outline-dark btn-sm cim-check-btn").attr("type","submit").on("click",(function(){d3.select(this.firstChild).attr("class","far fa-check-square");let n=d3.select(this).datum();t.setLink(e,n),t.exitSetLinkMode()})).append("span").attr("class","far fa-square"),r.selectAll("a.cim-expand-object").classed("d-none",!0)})),r.each((function(t){this.parentNode.parentNode.classList.add("d-none"),this.parentNode.parentNode.classList.remove("d-flex")})),document.querySelectorAll(".tab-content > .tab-pane > ul").forEach((function(t){const e=t.parentNode.getAttribute("id")+"Tab";0===t.querySelectorAll(":scope > li.d-flex").length?document.getElementById(e).classList.add("d-none"):bootstrap.Tab.getInstance(document.querySelector("#"+e)).show()})),d3.select("body").on("keyup.tree",(function(n){27===n.keyCode&&(t.exitSetLinkMode(),t.setLink(e,null))})),d3.select("#tree-link-dialog-cancel").on("click",(function(){t.exitSetLinkMode(),t.setLink(e,null)}))},exitSetLinkMode(){t.state.mode="default",document.getElementById("tree-link-dialog").classList.add("d-none"),document.getElementById("tree-controls").classList.remove("d-none"),d3.select(".tree").selectAll(".tab-pane > .list-group > .list-group-item > div > ul").each((function(t){let e=d3.select(this).selectAll(".CIM-object");e.selectAll("button.cim-check-btn").remove(),e.select("button.cim-object-btn").classed("btn-primary",!0).classed("btn-outline-dark",!1),e.selectAll("a.cim-expand-object").classed("d-none",!1),this.parentNode.parentNode.classList.add("d-flex"),this.parentNode.parentNode.classList.remove("d-none")})),document.querySelectorAll(".tab-content > .tab-pane > ul").forEach((function(t){const e=t.parentNode.getAttribute("id")+"Tab";document.getElementById(e).classList.remove("d-none")})),d3.select("body").on("keyup.tree",null),d3.select("#tree-link-dialog-cancel").on("click",null)},moveTo(e){if(void 0===e)return;let n=null,r=null,i=t.props.model.getObject(e);if(void 0===i)return;if("cim:ConnectivityNode"===i.nodeName||"cim:TopologicalNode"===i.nodeName){let n=t.props.model.getBusbar(i);if(null===n)return;e=t.props.model.ID(n)}if(r=d3.select(".tree").select("#"+e).node(),null===r)return;n=r.parentNode,d3.select(".tree").selectAll(".btn-danger").classed("btn-danger",!1).classed("btn-primary",!0);const o=n.closest("div.tab-pane").getAttribute("id")+"Tab";if(document.getElementById(o).classList.contains("active"))t.scrollTo("#"+e);else{document.querySelector("#"+o).addEventListener("shown.bs.tab",(function n(r){t.scrollTo("#"+e),this.removeEventListener("shown.bs.tab",n)}))}bootstrap.Tab.getInstance(document.querySelector("#"+o)).show(),d3.select(n).select("button.cim-object-btn").classed("btn-danger",!0).classed("btn-primary",!1)},deleteObject(t){let e=d3.select("div.tree").select("ul#"+t).node();if(null!==e){let t=e.parentNode;t.closest("li.list-group-item").querySelectorAll(":scope>h4>span").forEach((function(t){let e=parseInt(t.innerHTML);e-=1,t.innerHTML=e}));let n=t.closest("li.cim-parent-container");for(;null!==n;){let t=n.querySelector(":scope>h4>span"),e=parseInt(t.innerHTML);e-=1,t.innerHTML=e,n=n.parentNode.closest("li.cim-parent-container")}t.remove()}},scrollTo(e){let n=document.querySelector(e).parentNode.closest(".collapse:not(.show)");for(null===n&&i(e);null!==n;){function r(n){n.stopPropagation();let o=d3.select(this.parentNode).filter(".CIM-object").select("ul");o.size()>0&&0===o.selectAll("li.attribute").size()&&t.generateAttrsAndLinks(o),i(e),this.removeEventListener("shown.bs.collapse",r)}n.addEventListener("shown.bs.collapse",r);let o=bootstrap.Collapse.getInstance(n);null===o&&(o=new bootstrap.Collapse(n,{toggle:!1})),o.show(),n=n.parentNode.closest(".collapse:not(.show)")}function i(t){const e=document.getElementById("tab-content"),n=e.querySelector(t),r=e.getBoundingClientRect().top+document.body.scrollTop,i=n.parentNode.getBoundingClientRect().top+document.body.scrollTop;e.scrollTop=e.scrollTop+i-r}},resetAttrs(){!0===document.getElementById("sshInput").checked?(d3.select("#app-tree").selectAll("li.attribute:not(.SSH)").classed("d-none",!0),d3.select("#app-tree").selectAll("li.link:not(.SSH)").classed("d-none",!0),d3.select("#app-tree").selectAll("li.attribute.SSH").classed("d-none",!1),d3.select("#app-tree").selectAll("li.link.SSH").classed("d-none",!1)):(d3.select("#app-tree").selectAll("li.attribute:not(.SSH)").classed("d-none",!1),d3.select("#app-tree").selectAll("li.link:not(.SSH)").classed("d-none",!1),d3.select("#app-tree").selectAll("li.attribute.SSH").classed("d-none",!0),d3.select("#app-tree").selectAll("li.link.SSH").classed("d-none",!0))}},template:function(t,e,n,r){return t('
                          ',[])},name:"cimtree"}}));"use strict";function cimModel(){const t="http://iec.ch/TC57/2013/CIM-schema-cim16#",e="http://entsoe.eu/CIM/SchemaExtension/3/1#",n="http://iec.ch/TC57/61970-552/ModelDescription/1#",r="http://www.w3.org/1999/02/22-rdf-syntax-ns#",i='';let o={all:null},a=new Map,s=new Map,l="NODE_BREAKER";function c(t){let e=new DOMParser,n=[],r=[],a=[],s=[],l=[],c=[],u=null,d=null;function h(t){for(const e in t){let i=new DOMParser,o=fflate.strFromU8(t[e]),f=i.parseFromString(o,"application/xml");if(f.children.length>0&&"rdf:RDF"!==f.children[0].nodeName)return Promise.reject(new DOMException("invalid input file."));if(0===n.length||0===r.length||0===a.length||0===s.length||0===l.length||0===c.length||null===u||null===d){let t=[].filter.call(f.children[0].children,(function(t){return"md:FullModel"===t.nodeName}))[0];if(void 0===t)return Promise.reject("error: invalid CGMES file.");let e=x.getAttribute(t,"md:Model.profile");e.textContent.includes("Equipment")&&(!1===e.textContent.includes("Boundary")?n.push(f):u=f),e.textContent.includes("DiagramLayout")&&r.push(f),e.textContent.includes("StateVariables")&&a.push(f),e.textContent.includes("Topology")&&(!1===e.textContent.includes("Boundary")?s.push(f):d=f),e.textContent.includes("SteadyStateHypothesis")&&l.push(f),e.textContent.includes("GeographicalLocation")&&c.push(f)}}return Promise.resolve()}return function(p){var m;return(m=new Uint8Array(p),new Promise((function(t,e){fflate.unzip(m,((n,r)=>{null===n?t(r):e(new DOMException("problem unzipping input file."))}))}))).then(h).then((function(){if(n.length>0&&!1===t){let t=e.parseFromString(i,"application/xml");for(let e of n)for(let n of e.children[0].children)"md:FullModel"!==n.nodeName&&t.children[0].appendChild(n.cloneNode(!0));for(let e of r)for(let n of e.children[0].children)"md:FullModel"!==n.nodeName&&t.children[0].appendChild(n.cloneNode(!0));for(let e of a)for(let n of e.children[0].children)"md:FullModel"!==n.nodeName&&t.children[0].appendChild(n.cloneNode(!0));for(let e of s)for(let n of e.children[0].children)"md:FullModel"!==n.nodeName&&t.children[0].appendChild(n.cloneNode(!0));for(let e of l)for(let n of e.children[0].children)"md:FullModel"!==n.nodeName&&t.children[0].appendChild(n.cloneNode(!0));for(let e of c)for(let n of e.children[0].children)"md:FullModel"!==n.nodeName&&t.children[0].appendChild(n.cloneNode(!0));if(null!==u)for(let e of u.children[0].children)"md:FullModel"!==e.nodeName&&t.children[0].appendChild(e.cloneNode(!0));if(null!==d)for(let e of d.children[0].children)"md:FullModel"!==e.nodeName&&t.children[0].appendChild(e.cloneNode(!0));return o.all=t,f()}if(null===o.all||!1===t)return Promise.reject("Invalid CGMES file: no equipment description found.");if(null!==u){let t=u.children[0].children,e=[].filter.call(t,(function(t){return"cim:ConnectivityNode"===t.nodeName})).filter((t=>x.isBoundary(t))).length;return x.updateModel(u),null!==d&&x.updateModel(d),Promise.resolve("Loaded "+e+" boundary nodes.")}return Promise.reject("Invalid boundary file: no equipment boundary file found.")})).catch((function(e){return!1===t&&x.clear(),Promise.reject(e)}))}}function u(t){const e=new FileReader;return new Promise((function(n,r){e.onerror=function(){e.abort(),r(new DOMException("problem parsing input file."))},e.onload=function(){n(e.result)},e.readAsArrayBuffer(t)}))}function f(){let t=d();for(let e in t){let n=t[e],r=x.ID(n);if(null!==r&&(a.set("#"+r,n),void 0!==n.attributes)){let t=x.getLinks(n);for(let e of t){let t=e.localName+e.attributes[0].value,r=s.get(t);void 0===r?s.set(t,[n]):r.push(n)}}}for(let e in t){let n=t[e],r=n.attributes.getNamedItem("rdf:about");if(null!==r){let t=a.get(r.value);if(void 0===t)continue;for(let e of x.getAttributes(n))t.appendChild(e.cloneNode(!0));for(let e of x.getLinks(n)){t.appendChild(e.cloneNode(!0));let n=e.localName+e.attributes[0].value,r=s.get(n);void 0===r?s.set(n,[t]):r.push(t)}n.remove()}}return x.schema.buildSchema()}function d(){let t=[];for(let e of Object.keys(o))void 0!==o[e]&&null!==o[e]&&(t=t.concat([...o[e].children[0].children]));return t}function h(e,n){let i=void 0;void 0!==n&&(i=n.uuid);let s=o.all,l=s.createElementNS(t,e);return s.children[0].appendChild(l),void 0!==i?l.setAttributeNS(r,"rdf:ID",i):l.setAttributeNS(r,"rdf:ID",y()),a.set("#"+x.ID(l),l),l}function p(t){let e=h("cim:Terminal");return m(e,"cim:Terminal.ConductingEquipment",t),x.setAttribute(e,"cim:ACDCTerminal.connected","true"),e}function m(e,n,i){if(x.getTargets([e],n).length>0)return;let o=e.ownerDocument.createElementNS(t,n);e.appendChild(o),o.setAttributeNS(r,"rdf:resource","#"+x.ID(i));let a=o.localName+o.attributes[0].value,l=s.get(a);void 0===l?s.set(a,[e]):l.push(e),x.trigger("addLink",e,n,i)}function g(t,e){let n=x.schema.schemaInvLinksMap.get(e),r=new Map,i=[];for(let o of t){let t=x.ID(o),l=x.getLink(o,"cim:"+e);for(let e of l){let n=a.get(e.attributes.getNamedItem("rdf:resource").value);if(void 0!==n){let e=x.ID(n);i.push({source:o,target:n}),r.set(t+e,1)}}let c=s.get(n+"#"+t);if(void 0!==c)for(let e of c){let n=x.ID(e);void 0===r.get(t+n)&&i.push({source:o,target:e})}}return i}function b(t){let e=[];if(0===arguments.length){let t=[];void 0!==x.activeDiagram&&(t=x.getTargets([x.activeDiagram],"Diagram.DiagramElements")),e=g(t,"DiagramObject.IdentifiedObject")}else if(void 0!==x.activeDiagram){let n=x.getTargets(t,"IdentifiedObject.DiagramObjects");n=g(n,"DiagramObject.Diagram").filter((t=>t.target===x.activeDiagram)).map((t=>t.source)),e=g(n,"DiagramObject.IdentifiedObject")}return e}function v(t){let e=[];if(0===arguments.length){if(void 0!==x.activeDiagram){e=g(b().map((t=>t.target)),"ConductingEquipment.Terminals")}}else if(void 0!==x.activeDiagram){e=g(b(t).map((t=>t.target)),"ConductingEquipment.Terminals")}else e=g(t,"ConductingEquipment.Terminals");return e}function y(){let t=(new Date).getTime();return"_"+"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){let n=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"==e?n:3&n|8).toString(16)}))}function _(t){return[].filter.call(t.children,(function(t){let e=t.attributes.getNamedItem("rdf:resource");return 0!==t.attributes.length&&null!==e&&"#"!==e.value.charAt(0)}))}function w(t,e){return _(t).filter((t=>t.nodeName===e))[0]}let x={fileName:null,activeDiagramName:"none",schema:new cimSchema,load(t){let e=Promise.resolve();return x.fileName!==t.name&&(x.fileName=t.name,e=t.name.endsWith(".zip")?u(t).then(c(!1)).catch((function(t){return x.clear(),Promise.reject(t)})):function(t){const e=new FileReader;return new Promise((function(n,r){e.onerror=function(){e.abort(),r(new DOMException("problem parsing input file."))},e.onload=function(){let t=new DOMParser,i=e.result,o=t.parseFromString(i,"application/xml");o.children.length>0&&"rdf:RDF"!==o.children[0].nodeName&&r(new DOMException("invalid input file.")),n(o)},e.readAsText(t)}))}(t).then((function(t){return o.all=t,f()})).catch((function(t){return x.clear(),Promise.reject(t)}))),e},newFile(t){let e=new DOMParser;return o.all=e.parseFromString(i,"application/xml"),x.fileName=t,f()},updateModel(t){let e=t.children[0].children;for(let t of e){if("md:FullModel"===t.nodeName)continue;let e=t.attributes.getNamedItem("rdf:ID");if(null===e&&(e=t.attributes.getNamedItem("rdf:about")),null===e)continue;let n=e.value;n.startsWith("#")&&(n=n.substring(1));let r=x.getObject(n);void 0===r&&(r=x.createObject(t.nodeName,{uuid:n}))}for(let t of e){if("md:FullModel"===t.nodeName)continue;let e=t.attributes.getNamedItem("rdf:ID");if(null===e&&(e=t.attributes.getNamedItem("rdf:about")),null===e)continue;let n=e.value;n.startsWith("#")&&(n=n.substring(1));let r=x.getObject(n);if(void 0===r)continue;let i=x.getAttributes(t);for(let t of i)x.setAttribute(r,t.nodeName,t.innerHTML);let o=x.getLinks(t);for(let t of o){let e=t.attributes.getNamedItem("rdf:resource").value.substring(1);x.setLink(r,t.nodeName,x.getObject(e))}}},loadBoundary(t){let e=Promise.resolve();return e=t.name.endsWith(".zip")?u(t).then(c(!0)).catch((function(t){return Promise.reject(t)})):Promise.reject("Error: not a boundary file."),e},loadRemote(t){let e=Promise.resolve();return x.fileName!==decodeURI(t).substring(1)&&(x.fileName=decodeURI(t).substring(1),e=d3.xml(t).then((function(t){return o.all=t,f()})).catch((function(t){return x.clear(),Promise.reject(t)}))),e},save(){if(null===o.all)throw new Error("error: no CIM file loaded.");let t="";return t=(new XMLSerializer).serializeToString(o.all),t},saveAsCGMES(){if(null===o.all)return Promise.reject("error: no CIM file loaded.");let t=new XMLSerializer,e={},r=null,a=[];for(let t of o.all.children[0].children){x.getLinks(t).forEach((function(e){let n=x.schema.checkLink(t,e.nodeName);if(n!==e.nodeName){x.getTargets([t],e.localName).forEach((function(e){a.push({s:e,l:n,t:t})}))}}))}a.forEach((function(t){x.setLink(t.s,t.l,t.t)})),r=o.all.children[0].cloneNode(!0).children;let s=["http://entsoe.eu/CIM/EquipmentCore/3/1"];"NODE_BREAKER"===l&&s.push("http://entsoe.eu/CIM/EquipmentOperation/3/1");let c=g("EQ",s,r,[]),u=g("DL",["http://entsoe.eu/CIM/DiagramLayout/3/1"],r,[c]),f=g("SV",["http://entsoe.eu/CIM/StateVariables/4/1"],r,[c]),d=g("TP",["http://entsoe.eu/CIM/Topology/4/1"],r,[c]),h=g("SSH",["http://entsoe.eu/CIM/SteadyStateHypothesis/1/1"],r,[c]),p=g("GL",["http://entsoe.eu/CIM/GeographicalLocation/2/1"],r,[c]);return e["EQ.xml"]=fflate.strToU8(t.serializeToString(c)),e["DL.xml"]=fflate.strToU8(t.serializeToString(u)),e["SV.xml"]=fflate.strToU8(t.serializeToString(f)),e["TP.xml"]=fflate.strToU8(t.serializeToString(d)),e["SSH.xml"]=fflate.strToU8(t.serializeToString(h)),e["GL.xml"]=fflate.strToU8(t.serializeToString(p)),m=e,new Promise((function(t,e){fflate.zip(m,((n,r)=>{null===n?t(new Blob([r.buffer])):e(new DOMException("problem zipping input files."))}))}));var m;function g(t,e,r,o){let a=[].filter.call(r,(function(e){return null!==x.schema.getSchemaObject(e.localName,t)})),s=function(t,e){let r=(new DOMParser).parseFromString(i,"application/xml"),o=document.createElementNS(n,"md:FullModel");return r.children[0].appendChild(o),o.setAttribute("rdf:about","urn:uuid:"+y().substring(1)),t.forEach((function(t){let e=o.ownerDocument.createElementNS(n,"md:Model.profile");e.innerHTML=t,o.appendChild(e)})),e.forEach((function(t){let e=[].filter.call(t.children[0].children,(function(t){return"md:FullModel"===t.nodeName}))[0],n=o.ownerDocument.createElement("md:Model.DependentOn");n.setAttribute("rdf:resource",e.attributes.getNamedItem("rdf:about").value),o.appendChild(n)})),r}(e,o);return function(t,e,n){for(let r in e){let i=e[r].cloneNode();x.getAttributes(e[r]).forEach((function(t){void 0!==x.schema.getSchemaAttribute(i.localName,t.localName,n)&&i.appendChild(t)})),x.getLinks(e[r]).forEach((function(t){void 0!==x.schema.getSchemaLink(i.localName,t.localName,n)&&i.appendChild(t)})),_(e[r]).forEach((function(t){void 0!==x.schema.getSchemaAttribute(i.localName,t.localName,n)&&i.appendChild(t)}));let o=x.schema.isDescription(i,n),a=x.schema.isConcrete(i,n);if(!0===o&&null!==x.ID(i)){let t=x.ID(i);i.removeAttribute("rdf:ID");let e=i.ownerDocument.createAttribute("rdf:about");e.value="#"+t,i.setAttributeNode(e)}!0===a&&(!1===o||i.children.length>0)&&t.children[0].appendChild(i)}}(s,a,t),s}},export(){let t=new DOMParser,e=new XMLSerializer,n=t.parseFromString(i,"application/xml");if(void 0===x.activeDiagram)return e.serializeToString(n);n.children[0].appendChild(x.activeDiagram.cloneNode(!0));let r=x.getTargets([x.activeDiagram],"Diagram.DiagramElements");for(let t of r)n.children[0].appendChild(t.cloneNode(!0));let o=x.getTargets(r,"DiagramObject.IdentifiedObject");for(let t of o)n.children[0].appendChild(t.cloneNode(!0));let a=x.getTargets(r,"DiagramObject.DiagramObjectPoints");for(let t of a)n.children[0].appendChild(t.cloneNode(!0));let s=x.getTerminals(o);for(let t of s)n.children[0].appendChild(t.cloneNode(!0));let l=x.getNodes();for(let t of l)n.children[0].appendChild(t.cloneNode(!0));let c=x.getLinkedObjects(["cim:Substation","cim:Line"],["EquipmentContainer.Equipments"]),u=c["cim:Substation"];for(let t of u)n.children[0].appendChild(t.cloneNode(!0));let f=c["cim:Line"];for(let t of f)n.children[0].appendChild(t.cloneNode(!0));let d=x.getTargets(o,"ConductingEquipment.BaseVoltage");for(let t of d)n.children[0].appendChild(t.cloneNode(!0));let h=x.getTargets(o,"PowerTransformer.PowerTransformerEnd");for(let t of h)n.children[0].appendChild(t.cloneNode(!0));let p=x.getTargets(s,"ACDCTerminal.Measurements");for(let t of p)n.children[0].appendChild(t.cloneNode(!0));let m=x.getTargets(p,"Analog.AnalogValues");for(let t of m)n.children[0].appendChild(t.cloneNode(!0));return e.serializeToString(n)},getDiagramList:()=>x.getObjects(["cim:Diagram"])["cim:Diagram"].map((t=>(void 0===x.getAttribute(t,"cim:IdentifiedObject.name")&&x.setAttribute(t,"cim:IdentifiedObject.name","unnamed diagram"),x.getAttribute(t,"cim:IdentifiedObject.name")))).map((t=>t.textContent)),getObjects(t){let e={},n=d();for(let n of t)e[n]=[];return e=[].reduce.call(n,(function(t,e){return void 0!==t[e.nodeName]&&t[e.nodeName].push(e),t}),e),e},getSubObjects:t=>d().filter((function(e){return!0===x.schema.isA(t,e)})),getGraphicObjects(t){let e={},n=b().map((t=>t.target)),r=new Set(n);for(let n of t)e[n]=[];return e=[...r].reduce((function(t,e){return void 0!==t[e.nodeName]&&t[e.nodeName].push(e),t}),e),e},getNodes(){let t="cim:ConnectivityNode";"BUS_BRANCH"===l&&(t="cim:TopologicalNode");let e=x.getObjects([t])[t],n=x.getGraphicObjects([t])[t],r=e.filter((t=>-1===n.indexOf(t)));return r=r.filter((function(t){let e=x.getBusbar(t),n=x.getEquipments(t);return null!==e||n.length>1})),n.concat(r)},getConnectors(t){let e={};for(let n of t){let t=x.getObjects([n])[n],r=x.getGraphicObjects([n])[n],i=t.filter((t=>-1===r.indexOf(t)));i=i.filter((function(t){let e=x.getNode(t);if(null!==e){return x.getDiagramObjects([e]).length>0}return!1})),e[n]=r.concat(i)}return e},getLinkedObjects(t,e){let n={};for(let r of t)n[r]=x.getObjects([r])[r].filter((function(t){let n=[t],r=[];for(let r of e){let e=r.split("/"),i=[t];for(let t=0;t0}));return n},getTerminals(t){let e=v(t).map((t=>t.target));return e=[...new Set(e)],e},getObject:t=>a.get("#"+t),getAttributes(t){if(null!=t)return[].filter.call(t.children,(function(t){return 0===t.attributes.length}))},getAttribute(t,e){if(void 0===t)return;if(null===t)return;return x.getAttributes(t).filter((t=>t.nodeName===e))[0]},setAttribute(n,r,i){let o=x.getAttribute(n,r);if(void 0!==o)o.innerHTML=i;else{let a=t;r.startsWith("entsoe:")&&(a=e),o=n.ownerDocument.createElementNS(a,r),o.innerHTML=i,n.appendChild(o)}x.trigger("setAttribute",n,r,i)},setEnum(e,n,r){let i=w(e,n);if(void 0===i){i=e.ownerDocument.createElement(n);let t=e.ownerDocument.createAttribute("rdf:resource");t.nodeValue="#",i.setAttributeNode(t),e.appendChild(i)}i.attributes[0].value=t+r,x.trigger("setEnum",e,n,r)},createObject(t,e){let n=h(t,e);if(x.schema.isA("IdentifiedObject",n)&&x.setAttribute(n,"cim:IdentifiedObject.name","new1"),!1===x.schema.isA("ConductingEquipment",n))return x.trigger("createObject",n),n;let r=2,i=null;void 0!==e&&(void 0!==e.windNum&&(r=e.windNum),void 0!==e.node&&(i=e.node));let o=p(n),a=null,s=null;if("cim:ACLineSegment"!==t&&"cim:Breaker"!==t&&"cim:Disconnector"!==t&&"cim:LoadBreakSwitch"!==t&&"cim:Junction"!==t&&"cim:PowerTransformer"!==t||(a=p(n)),"cim:PowerTransformer"===t&&3===r&&(s=p(n)),"cim:BusbarSection"===t){let t="ConnectivityNode";"BUS_BRANCH"===l&&(t="TopologicalNode"),null===i&&(i=h("cim:"+t)),m(o,"cim:Terminal."+t,i)}if("cim:PowerTransformer"===t){let t=h("cim:PowerTransformerEnd"),e=h("cim:PowerTransformerEnd");if(x.setAttribute(t,"cim:IdentifiedObject.name","winding1"),x.setAttribute(e,"cim:IdentifiedObject.name","winding2"),m(n,"cim:PowerTransformer.PowerTransformerEnd",t),m(n,"cim:PowerTransformer.PowerTransformerEnd",e),m(t,"cim:TransformerEnd.Terminal",o),m(e,"cim:TransformerEnd.Terminal",a),3===r){let t=h("cim:PowerTransformerEnd");x.setAttribute(t,"cim:IdentifiedObject.name","winding3"),m(n,"cim:PowerTransformer.PowerTransformerEnd",t),m(t,"cim:TransformerEnd.Terminal",s)}}return x.trigger("createObject",n),n},deleteObjects(t){let e=[],n=[];for(let s of t){"cim:ConnectivityNode"!==s.nodeName&&"cim:TopologicalNode"!==s.nodeName||(n=n.concat(o(s))),"cim:BusbarSection"===s.nodeName&&(n=n.concat(i(s)));let t=x.getLinks(s);for(let i of t){let t=a.get(i.attributes.getNamedItem("rdf:resource").value),o=i.nodeName;void 0!==t&&(r(s,t)&&n.push(t),e.push({s:s,l:o,t:t}))}}for(let[i,o]of s){let s=i.split("#"),l="cim:"+s[0],c="#"+s[1],u=a.get(c);if(t.indexOf(u)>-1)for(let t of o)e.push({s:t,l:l,t:u}),r(u,t)&&n.push(t)}for(let t of e)x.removeLink(t.s,t.l,t.t);n.length>0&&x.deleteObjects(n);for(let e of t){let t=x.ID(e),n=e.localName;a.delete("#"+t),e.remove(),x.trigger("deleteObject",t,n)}function r(t,e){return!(!x.schema.isA("ConductingEquipment",t)||"cim:Terminal"!==e.nodeName)||("cim:DiagramObjectPoint"===e.nodeName||("cim:DiagramObjectPoint"!==t.nodeName&&"cim:DiagramObject"===e.nodeName||("cim:PowerTransformer"===t.nodeName&&"cim:PowerTransformerEnd"===e.nodeName||("cim:GeographicalRegion"===t.nodeName&&"cim:SubGeographicalRegion"===e.nodeName||("cim:SubGeographicalRegion"===t.nodeName&&"cim:Substation"===e.nodeName||("cim:Substation"===t.nodeName&&"cim:VoltageLevel"===e.nodeName||"cim:VoltageLevel"===t.nodeName&&"cim:Bay"===e.nodeName))))))}function i(t){let e="ConnectivityNode";if("BUS_BRANCH"===l&&(e="TopologicalNode"),"cim:BusbarSection"===t.nodeName){let n=x.getTargets([t],"ConductingEquipment.Terminals");return x.getTargets(n,"Terminal."+e)}return[]}function o(t){let e="ConnectivityNode.Terminals";"BUS_BRANCH"===l&&(e="TopologicalNode.Terminal");let n=x.getTargets([t],e);return x.getTargets(n,"Terminal.ConductingEquipment").filter((t=>"cim:BusbarSection"===t.nodeName))}},deleteObject(t){x.deleteObjects([t])},getNode(t){let e="ConnectivityNode";if("BUS_BRANCH"===l&&(e="TopologicalNode"),"cim:BusbarSection"===t.nodeName){let n=x.getTargets([t],"ConductingEquipment.Terminals"),r=x.getTargets(n,"Terminal."+e);return 0===r.length?null:r[0]}return null},getBusbar(t){let e="ConnectivityNode.Terminals";"BUS_BRANCH"===l&&(e="TopologicalNode.Terminal");let n=x.getTargets([t],e),r=x.getTargets(n,"Terminal.ConductingEquipment").filter((t=>"BusbarSection"===t.localName)),i=x.getDiagramObjects([t].concat(r));return r.length>0&&i.length>0?r[0]:null},deleteFromDiagram(t){let e=x.ID(t),n=x.getDiagramObjects([t]),r="ConnectivityNode";if("BUS_BRANCH"===l&&(r="TopologicalNode"),"BusbarSection"===t.localName){let e=x.getNode(t);n=n.concat(x.getDiagramObjects([e]))}if(t.localName===r){let e=x.getBusbar(t);null!==e&&(n=n.concat(x.getDiagramObjects([e])))}let i=x.getTargets(n,"DiagramObject.DiagramObjectPoints");for(let t of n)x.deleteObject(t);for(let t of i)x.deleteObject(t);x.trigger("deleteFromDiagram",e)},addToActiveDiagram(t,e){let n=h("cim:DiagramObject");for(let r of e){let e=h("cim:DiagramObjectPoint");x.setAttribute(e,"cim:DiagramObjectPoint.xPosition",r.x+t.x),x.setAttribute(e,"cim:DiagramObjectPoint.yPosition",r.y+t.y),x.setAttribute(e,"cim:DiagramObjectPoint.sequenceNumber",r.seq),m(e,"cim:DiagramObjectPoint.DiagramObject",n)}void 0!==t.rotation&&x.setAttribute(n,"cim:DiagramObject.rotation",t.rotation),m(n,"cim:DiagramObject.IdentifiedObject",t),m(n,"cim:DiagramObject.Diagram",x.activeDiagram),x.trigger("addToActiveDiagram",t)},updateActiveDiagram(t,e){let n=x.getDiagramObjects([t]);if(("cim:ConnectivityNode"===t.nodeName||"cim:TopologicalNode"===t.nodeName)&&0===n.length){let e=x.getEquipments(t).filter((t=>"BusbarSection"===t.localName))[0];void 0!==e&&(n=x.getDiagramObjects([e]))}for(let e of n)x.setAttribute(e,"cim:DiagramObject.rotation",t.rotation);let r=x.getTargets(n,"DiagramObject.DiagramObjectPoints");if(r.length>0){for(let e of r){let n=1,r=x.getAttribute(e,"cim:DiagramObjectPoint.sequenceNumber");void 0!==r&&(n=parseInt(r.innerHTML));let i=t.lineData.filter((t=>t.seq===n))[0];x.getAttribute(e,"cim:DiagramObjectPoint.xPosition").innerHTML=i.x+t.x,x.getAttribute(e,"cim:DiagramObjectPoint.yPosition").innerHTML=i.y+t.y}x.trigger("updateActiveDiagram",t)}else x.addToActiveDiagram(t,t.lineData)},getLinks:t=>[].filter.call(t.children,(function(t){let e=t.attributes.getNamedItem("rdf:resource");return 0!==t.attributes.length&&null!==e&&"#"===e.value.charAt(0)})),getLink:(t,e)=>x.getLinks(t).filter((t=>t.nodeName===e)),getEnum(t,e){let n=w(t,e),r=void 0;return void 0!==n&&(r=n.attributes.getNamedItem("rdf:resource").value.split("#")[1].split(".")[1]),r},setLink(t,e,n){let r=x.getTargets([t],e.split(":")[1]);for(let n of r)x.removeLink(t,e,n);m(t,e,n)},removeLink(t,e,n){i(x.getLink(t,e),t,n);let r=x.schema.schemaInvLinksMap.get(e.split(":")[1]);if(void 0!==r){i(x.getLink(n,"cim:"+r),n,t)}function i(t,e,n){for(let r of t){let t=r.attributes.getNamedItem("rdf:resource").value;if(t==="#"+x.ID(n)){let n=r.localName+t,i=s.get(n);r.remove(),1===i.length?s.delete(n):i.splice(i.indexOf(e),1)}}}x.trigger("removeLink",t,e,n)},getTargets(t,e){let n=g(t,e).map((t=>t.target));return[...new Set(n)]},getDiagramObjects(t){let e=b(t).map((t=>t.source));return[...new Set(e)]},getEquipments(t){let e="ConnectivityNode.Terminals";"BUS_BRANCH"===l&&(e="TopologicalNode.Terminal");let n=x.getTargets([t],e),r=x.getTargets(n,"Terminal.ConductingEquipment");return r=v(r).map((t=>t.source)),[...new Set(r)]},selectDiagram(t){t!==x.activeDiagramName&&(x.activeDiagramName=t,x.activeDiagram=x.getObjects(["cim:Diagram"])["cim:Diagram"].filter((t=>x.getAttribute(t,"cim:IdentifiedObject.name").textContent===x.activeDiagramName))[0]),void 0===x.activeDiagram&&(x.activeDiagram=h("cim:Diagram"),x.setAttribute(x.activeDiagram,"cim:IdentifiedObject.name",t),x.activeDiagramName=t,x.trigger("createdDiagram")),x.trigger("changedDiagram")},isBoundary(t){let e=!1,n=x.getAttribute(t,"entsoe:ConnectivityNode.boundaryPoint");return void 0!==n&&"true"===n.textContent&&(e=!0),e},getMode:()=>l,setMode(t){"NODE_BREAKER"!==t&&"BUS_BRANCH"!==t||(l=t),x.trigger("setMode",l)},ID(t){if(null==t)return null;if(void 0===t.attributes)return null;{let e=t.attributes.getNamedItem("rdf:ID");return null===e?null:e.value}},clear(){o.all=null,x.fileName=null,a=new Map,s=new Map}};return observable(x),x}function cimSchema(){let t={EQ:null,DL:null,SV:null,TP:null,SSH:null,GL:null};let e=new Map,n=new Map,r=new Map;function i(t,e){let n=[],r=o.getSchemaObject(t,e);if(null===r)return n;let a=[].filter.call(r.children,(function(t){return"rdfs:subClassOf"===t.nodeName}))[0];if(void 0!==a){let t=a.attributes[0].value.substring(1);n.push(t),n=n.concat(i(t,e))}return n}let o={schemaInvLinksMap:new Map,buildSchema(){return null===t.EQ?d3.xml("rdf-schema/EquipmentProfileCoreShortCircuitOperationRDFSAugmented-v2_4_15-16Feb2016.rdf").then((function(n){return t.EQ=n,e(t.EQ),d3.xml("rdf-schema/DiagramLayoutProfileRDFSAugmented-v2_4_15-16Feb2016.rdf")})).then((function(n){return t.DL=n,e(t.DL),d3.xml("rdf-schema/StateVariablesProfileRDFSAugmented-v2_4_15-16Feb2016.rdf")})).then((function(n){return t.SV=n,e(t.SV),d3.xml("rdf-schema/TopologyProfileRDFSAugmented-v2_4_15-16Feb2016.rdf")})).then((function(n){return t.TP=n,e(t.TP),d3.xml("rdf-schema/SteadyStateHypothesisProfileRDFSAugmented-v2_4_15-16Feb2016.rdf")})).then((function(n){return t.SSH=n,e(t.SSH),d3.xml("rdf-schema/GeographicalLocationProfileRDFSAugmented-v2_4_15-16Feb2016.rdf")})).then((function(n){t.GL=n,e(t.GL)})).catch((function(t){return Promise.reject(t)})):Promise.resolve();function e(t){let e=t.children[0].children;for(let t in e){let n=e[t];if(void 0===n.children)continue;let r=[].filter.call(n.children,(function(t){return"cims:inverseRoleName"===t.nodeName}))[0];void 0!==r&&o.schemaInvLinksMap.set(n.attributes[0].value.substring(1),r.attributes[0].value.substring(1))}}},getSchemaObject(e,n){let i=null;for(let o of Object.keys(t)){if(void 0!==n&&n!==o)continue;let a=r.get(o+e);if(null!=a){i=a;break}if(null===a){if(void 0!==n)break;continue}let s=t[o].children[0].children;if(a=[].filter.call(s,(function(t){return t.attributes[0].value==="#"+e}))[0],void 0!==a){i=a,r.set(o+e,a);break}r.set(o+e,null)}return i},getSchemaEnumValues(e,n){let r="EQ";void 0!==n&&(r=n);let i=[].filter.call(e.children,(function(t){return"rdfs:range"===t.nodeName}))[0].attributes.getNamedItem("rdf:resource").value.substring(1),o=t[r].children[0].children;return[].filter.call(o,(function(t){return t.attributes[0].value.startsWith("#"+i+".")})).map((t=>[].filter.call(t.children,(function(t){return"rdfs:label"===t.nodeName}))[0].textContent))},getSchemaEnumName:t=>[].filter.call(t.children,(function(t){return"rdfs:range"===t.nodeName}))[0].attributes.getNamedItem("rdf:resource").value.substring(1),getSchemaAttributes(n,r){let o=n,a="EQ";void 0!==r&&(a=r),o+=a;let s=e.get(o);if(void 0===s){let r=t[a].children[0].children;s=[].filter.call(r,(function(t){return t.attributes.getNamedItem("rdf:about").value.startsWith("#"+n+".")}));let l=i(n,a);for(let t in l)s=s.concat([].filter.call(r,(function(e){return e.attributes.getNamedItem("rdf:about").value.startsWith("#"+l[t]+".")})));s=s.filter((function(t){let e=t.attributes.getNamedItem("rdf:about").value;e=e.substring(e.indexOf("#"));let n=!1,r=e.split(".")[1];return void 0!==r&&(n=r.toLowerCase().charAt(0)===r.charAt(0)),n})),e.set(o,s)}return s},getSchemaAttribute:(t,e,n)=>o.getSchemaAttributes(t,n).filter((t=>t.attributes[0].value.substring(1)===e))[0],isEnum:t=>void 0===[].filter.call(t.children,(function(t){return"cims:dataType"===t.nodeName}))[0],getSchemaAttributeType(t){let e="none",n="none";if(o.isEnum(t))return["#Enum",e,n];let r=[].filter.call(t.children,(function(t){return"cims:dataType"===t.nodeName}))[0].attributes.getNamedItem("rdf:resource").value,i=o.getSchemaObject(r.substring(1));if("CIMDatatype"===[].filter.call(i.children,(function(t){return"cims:stereotype"===t.nodeName}))[0].textContent){let t=o.getSchemaObject(r.substring(1)+".value"),i=o.getSchemaObject(r.substring(1)+".unit"),a=o.getSchemaObject(r.substring(1)+".multiplier");if(r=[].filter.call(t.children,(function(t){return"cims:dataType"===t.nodeName}))[0].attributes.getNamedItem("rdf:resource").value,null!==i&&(e=[].filter.call(i.children,(function(t){return"cims:isFixed"===t.nodeName}))[0].attributes.getNamedItem("rdfs:Literal").value),null!==a){let t=[].filter.call(a.children,(function(t){return"cims:isFixed"===t.nodeName}))[0];void 0!==t&&(n=t.attributes.getNamedItem("rdfs:Literal").value)}}return[r,e,n]},getSchemaStereotype(t){let e=[].filter.call(t.children,(function(t){return"cims:stereotype"===t.nodeName&&""!==t.textContent}));return e.length>0?e[0].textContent:null},getSchemaLinks(e,r){let o=e;o+=void 0!==r?r:"EQ";let a=n.get(o);if(void 0===a){let s=t.EQ;void 0!==r&&(s=t[r]);let l=s.children[0].children;a=[].filter.call(l,(function(t){return t.attributes[0].value.startsWith("#"+e+".")}));let c=i(e);for(let t in c)a=a.concat([].filter.call(l,(function(e){return e.attributes[0].value.startsWith("#"+c[t]+".")})));a=a.filter((function(t){let e=!1,n=t.attributes[0].value.split(".")[1];return void 0!==n&&(e=n.toLowerCase().charAt(0)!==n.charAt(0)),e})),n.set(o,a)}return a},getAllSchemasLinks(e){let n=[];return Object.keys(t).forEach((function(t){n=n.concat(o.getSchemaLinks(e,t))})),n},getSchemaLink:(t,e,n)=>o.getSchemaLinks(t,n).filter((t=>t.attributes[0].value.substring(1)===e))[0],getAllSchemasLink:(t,e)=>o.getAllSchemasLinks(t).filter((t=>t.attributes[0].value.substring(1)===e))[0],isA:(t,e)=>e.localName===t||!(i(e.localName).indexOf(t)<0),isConcrete(t,e){let n=!1,r=o.getSchemaObject(t.localName,e);if(null!==r){[].filter.call(r.children,(function(t){return"cims:stereotype"===t.nodeName})).forEach((function(t){let e=t.attributes.getNamedItem("rdf:resource");if(null!==e){"http://iec.ch/TC57/NonStandard/UML#concrete"===e.value&&(n=!0)}}))}return n},isDescription(t,e){let n=!1,r=o.getSchemaObject(t.localName,e);if(null!==r){[].filter.call(r.children,(function(t){return"cims:stereotype"===t.nodeName})).forEach((function(t){"Description"===t.textContent&&(n=!0)}))}return n},checkLink(t,e){let n=e,r=o.getAllSchemasLink(t.localName,e.split(":")[1]);if(void 0!==r){if("No"===[].filter.call(r.children,(function(t){return"cims:AssociationUsed"===t.nodeName}))[0].textContent){n="cim:"+o.schemaInvLinksMap.get(e.split(":")[1])}}return n},getLinkDomain(t){if(void 0===t)return null;if(null===t)return null;let e=[].filter.call(t.children,(function(t){return"rdfs:domain"===t.nodeName}))[0];return void 0===e?null:e.attributes.getNamedItem("rdf:resource").value.substring(1)},getLinkRange(t){if(void 0===t)return null;if(null===t)return null;let e=[].filter.call(t.children,(function(t){return"rdfs:range"===t.nodeName}))[0];return void 0===e?null:e.attributes.getNamedItem("rdf:resource").value.substring(1)}};return o}function topologyProcessor(t){return{calcTopology(){let e=[],n=t.getObjects(["cim:TopologicalNode"])["cim:TopologicalNode"];"BUS_BRANCH"===t.getMode()&&n.forEach((function(e){let n=t.createObject("cim:ConnectivityNode");t.getTargets([e],"TopologicalNode.Terminal").forEach((function(e){t.setLink(e,"cim:Terminal.ConnectivityNode",n)}))})),t.deleteObjects(n),n=[];let r=[],i=t.getObjects(["cim:ConnectivityNode"])["cim:ConnectivityNode"];for(;i.length>0;){let t=o(i[0]);i=i.filter((e=>t.indexOf(e)<0)),r.push(t)}function o(e){let n=new Set,r=-1;for(n.add(e);r!==n.size;){r=n.size;let e=t.getTargets([...n],"ConnectivityNode.Terminals"),i=t.getTargets(e,"Terminal.ConductingEquipment").filter((function(e){return!0===t.schema.isA("Switch",e)}));i=i.filter((function(e){let n=!0,r=t.getAttribute(e,"cim:Switch.open");return void 0!==r&&(n="false"===r.textContent),n}));let o=t.getTargets(i,"ConductingEquipment.Terminals"),a=t.getTargets(o,"Terminal.ConnectivityNode");for(let t of a)n.add(t)}return[...n]}return r.forEach((function(n){let r=t.createObject("cim:TopologicalNode");n.forEach((function(e){t.setLink(e,"cim:ConnectivityNode.TopologicalNode",r)}));let i=t.getTargets(n,"ConnectivityNode.Terminals"),o=t.getTargets(i,"Terminal.ConductingEquipment"),a=t.getTargets(o,"ConductingEquipment.BaseVoltage");if(a.length>0)t.setLink(r,"cim:TopologicalNode.BaseVoltage",a[0]);else{let e=t.getTargets(i,"Terminal.TransformerEnd");if(a=t.getTargets(e,"TransformerEnd.BaseVoltage"),a.length>0)t.setLink(r,"cim:TopologicalNode.BaseVoltage",a[0]);else{let e=t.getTargets(o,"Equipment.EquipmentContainer"),n=e.filter((e=>t.schema.isA("VoltageLevel",e)));if(a=t.getTargets(n,"VoltageLevel.BaseVoltage"),a.length>0)t.setLink(r,"cim:TopologicalNode.BaseVoltage",a[0]);else{let i=e.filter((e=>t.schema.isA("Bay",e)));n=t.getTargets(i,"Bay.VoltageLevel"),a=t.getTargets(n,"VoltageLevel.BaseVoltage"),a.length>0&&t.setLink(r,"cim:TopologicalNode.BaseVoltage",a[0])}}}i.forEach((function(e){t.setLink(e,"cim:Terminal.TopologicalNode",r),void 0===t.getAttribute(e,"cim:ACDCTerminal.connected")&&t.setAttribute(e,"cim:ACDCTerminal.connected","true")})),e.push(r)})),e},getTerminals(e){let n=[];return n=t.schema.isA("TopologicalNode",e)?t.getTargets([e],"TopologicalNode.Terminal"):t.schema.isA("TransformerEnd",e)?t.getTargets([e],"TransformerEnd.Terminal"):t.getTargets([e],"ConductingEquipment.Terminals"),n=n.filter((function(e){let n=t.getAttribute(e,"cim:ACDCTerminal.connected");return void 0!==n&&"true"===n.textContent})),n}}} diff --git a/js/fflate/fflate.min.js b/js/fflate/fflate.min.js index ff653ec..8716702 100644 --- a/js/fflate/fflate.min.js +++ b/js/fflate/fflate.min.js @@ -1 +1 @@ -!function(f){typeof module!='undefined'&&typeof exports=='object'?module.exports=f():typeof define!='undefined'&&define.amd?define(['fflate',f]):(typeof self!='undefined'?self:this).fflate=f()}(function(){var _e={};"use strict";var t=(typeof module!='undefined'&&typeof exports=='object'?function(_f){"use strict";var e;var r=";var __w=eval('require')('worker_threads');__w.parentPort.on('message',function(m){onmessage({data:m})}),postMessage=function(m,t){__w.parentPort.postMessage(m,t)},close=process.exit;self=global";try{e=require("worker_threads").Worker}catch(e){}_f.default=e?function(t,n,o,s,a){var u=!1,i=new e(t+r,{eval:!0}).on("error",(function(e){return a(e,null)})).on("message",(function(e){return a(null,e)})).on("exit",(function(e){e&&!u&&a(Error("exited with code "+e),null)}));return i.postMessage(o,s),i.terminate=function(){return u=!0,e.prototype.terminate.call(i)},i}:function(e,r,t,n,o){setImmediate((function(){return o(Error("async operations unsupported - update to Node 12+ (or Node 10-11 with the --experimental-worker CLI flag)"),null)}));var s=function(){};return{terminate:s,postMessage:s}};return _f}:function(_f){"use strict";var e={};_f.default=function(r,t,n,o,s){var u=e[t]||(e[t]=URL.createObjectURL(new Blob([r],{type:"text/javascript"}))),a=new Worker(u);return a.onerror=function(e){return s(e.error,null)},a.onmessage=function(e){return s(null,e.data)},a.postMessage(n,o),a};return _f})({}),n=Uint8Array,r=Uint16Array,e=Uint32Array,o=new n([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),i=new n([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),a=new n([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),s=function(t,n){for(var o=new r(31),i=0;i<31;++i)o[i]=n+=1<>>1|(21845&d)<<1;v[d]=((65280&(g=(61680&(g=(52428&g)>>>2|(13107&g)<<2))>>>4|(3855&g)<<4))>>>8|(255&g)<<8)>>>1}var y=function(t,n,e){for(var o=t.length,i=0,a=new r(n);i>>u]=l}else for(s=new r(o),i=0;i>>15-t[i];return s},w=new n(288);for(d=0;d<144;++d)w[d]=8;for(d=144;d<256;++d)w[d]=9;for(d=256;d<280;++d)w[d]=7;for(d=280;d<288;++d)w[d]=8;var x=new n(32);for(d=0;d<32;++d)x[d]=5;var m=y(w,9,0),b=y(w,9,1),z=y(x,5,0),A=y(x,5,1),S=function(t){for(var n=t[0],r=1;rn&&(n=t[r]);return n},k=function(t,n,r){var e=n/8>>0;return(t[e]|t[e+1]<<8)>>>(7&n)&r},M=function(t,n){var r=n/8>>0;return(t[r]|t[r+1]<<8|t[r+2]<<16)>>>(7&n)},C=function(t){return(t/8>>0)+(7&t&&1)},D=function(t,o,i){(null==o||o<0)&&(o=0),(null==i||i>t.length)&&(i=t.length);var a=new(t instanceof r?r:t instanceof e?e:n)(i-o);return a.set(t.subarray(o,i)),a},G=function(t,r,e){var s=t.length,f=!r||e,l=!e||e.i;e||(e={}),r||(r=new n(3*s));var c=function(t){var e=r.length;if(t>e){var o=new n(Math.max(2*e,t));o.set(r),r=o}},p=e.f||0,v=e.p||0,d=e.b||0,g=e.l,w=e.d,x=e.m,m=e.n,z=8*s;do{if(!g){e.f=p=k(t,v,1);var G=k(t,v+1,3);if(v+=3,!G){var U=t[(Y=C(v)+4)-4]|t[Y-3]<<8,O=Y+U;if(O>s){if(l)throw"unexpected EOF";break}f&&c(d+U),r.set(t.subarray(Y,O),d),e.b=d+=U,e.p=v=8*O;continue}if(1==G)g=b,w=A,x=9,m=5;else{if(2!=G)throw"invalid block type";var I=k(t,v,31)+257,F=k(t,v+10,15)+4,Z=I+k(t,v+5,31)+1;v+=14;for(var E=new n(Z),T=new n(19),_=0;_z)break;var H=y(T,j,1);for(_=0;_>>4)<16)E[_++]=Y;else{var J=0,K=0;for(16==Y?(K=3+k(t,v,3),v+=2,J=E[_-1]):17==Y?(K=3+k(t,v,7),v+=3):18==Y&&(K=11+k(t,v,127),v+=7);K--;)E[_++]=J}}var L=E.subarray(0,I),N=E.subarray(I);x=S(L),m=S(N),g=y(L,x,1),w=y(N,m,1)}if(v>z)throw"unexpected EOF"}f&&c(d+131072);for(var P=(1<>>4;if((v+=15&J)>z)throw"unexpected EOF";if(!J)throw"invalid length/literal";if(V<256)r[d++]=V;else{if(256==V){g=null;break}var W=V-254;V>264&&(W=k(t,v,(1<<(tt=o[_=V-257]))-1)+u[_],v+=tt);var X=w[M(t,v)&Q],$=X>>>4;if(!X)throw"invalid distance";if(v+=15&X,N=h[$],$>3){var tt=i[$];N+=M(t,v)&(1<z)throw"unexpected EOF";f&&c(d+131072);for(var nt=d+W;d>0;t[e]|=r<<=7&n,t[e+1]|=r>>>8},O=function(t,n,r){var e=n/8>>0;t[e]|=r<<=7&n,t[e+1]|=r>>>8,t[e+2]|=r>>>16},I=function(t,e){for(var o=[],i=0;iv&&(v=s[i].s);var d=new r(v+1),g=F(o[h-1],d,0);if(g>e){i=0;var y=0,w=g-e,x=1<e))break;y+=x-(1<>>=w;y>0;){var b=s[i].s;d[b]=0&&y;--i){var z=s[i].s;d[z]==e&&(--d[z],++y)}g=e}return[new n(d),g]},F=function(t,n,r){return-1==t.s?Math.max(F(t.l,n,r+1),F(t.r,n,r+1)):n[t.s]=r},Z=function(t){for(var n=t.length;n&&!t[--n];);for(var e=new r(++n),o=0,i=t[0],a=1,s=function(t){e[o++]=t},f=1;f<=n;++f)if(t[f]==i&&f!=n)++a;else{if(!i&&a>2){for(;a>138;a-=138)s(32754);a>2&&(s(a>10?a-11<<5|28690:a-3<<5|12305),a=0)}else if(a>3){for(s(i),--a;a>6;a-=6)s(8304);a>2&&(s(a-3<<5|8208),a=0)}for(;a--;)s(i);a=1,i=t[f]}return[e.subarray(0,o),n]},E=function(t,n){for(var r=0,e=0;e>>8,t[o+2]=255^t[o],t[o+3]=255^t[o+1];for(var i=0;i4&&!Y[a[J-1]];--J);var K,L,N,P,Q=p+5<<3,R=E(f,w)+E(u,x)+l,V=E(f,g)+E(u,S)+l+14+3*J+E(j,Y)+(2*j[16]+3*j[17]+7*j[18]);if(Q<=R&&Q<=V)return T(n,v,t.subarray(h,h+p));if(U(n,v,1+(V15&&(U(n,v,tt[q]>>>5&127),v+=tt[q]>>>12)}}else K=m,L=w,N=z,P=x;for(q=0;q255){var nt;O(n,v,K[257+(nt=s[q]>>>18&31)]),v+=L[nt+257],nt>7&&(U(n,v,s[q]>>>23&31),v+=o[nt]);var rt=31&s[q];O(n,v,N[rt]),v+=P[rt],rt>3&&(O(n,v,s[q]>>>5&8191),v+=i[rt])}else O(n,v,K[s[q]]),v+=L[s[q]];return O(n,v,K[256]),v+L[256]},j=new e([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),q=new n(0),H=function(t,a,s,f,u,c){var h=t.length,v=new n(f+h+5*(1+Math.floor(h/7e3))+u),d=v.subarray(f,v.length-u),g=0;if(!a||h<8)for(var y=0;y<=h;y+=65535){var w=y+65535;w>>13,b=8191&x,z=(1<7e3||E>24576)&&L>423){g=_(t,d,0,U,O,I,Z,E,Y,y-Y,g),E=F=Z=0,Y=y;for(var N=0;N<286;++N)O[N]=0;for(N=0;N<30;++N)I[N]=0}var P=2,Q=0,R=b,V=J-K&32767;if(L>2&&B==G(y-V))for(var W=Math.min(m,L)-1,X=Math.min(32767,y),$=Math.min(258,L);V<=X&&--R&&J!=K;){if(t[y+P]==t[y+P-V]){for(var tt=0;tt<$&&t[y+tt]==t[y+tt-V];++tt);if(tt>P){if(P=tt,Q=V,tt>W)break;var nt=Math.min(V,tt-2),rt=0;for(N=0;Nrt&&(rt=ot,K=et)}}}V+=(J=K)-(K=A[J])+32768&32767}if(Q){U[E++]=268435456|l[P]<<18|p[Q];var it=31&l[P],at=31&p[Q];Z+=o[it]+i[at],++O[257+it],++I[at],H=y+P,++F}else U[E++]=t[y],++O[t[y]]}}g=_(t,d,c,U,O,I,Z,E,Y,y-Y,g),c||(g=T(d,g,q))}return D(v,0,f+C(g)+u)},Y=function(){for(var t=new e(256),n=0;n<256;++n){for(var r=n,o=9;--o;)r=(1&r&&3988292384)^r>>>1;t[n]=r}return t}(),B=function(){var t=4294967295;return{p:function(n){for(var r=t,e=0;e>>8;t=r},d:function(){return 4294967295^t}}},J=function(){var t=1,n=0;return{p:function(r){for(var e=t,o=n,i=r.length,a=0;a!=i;){for(var s=Math.min(a+5552,i);a>>8<<16|(255&n)<<8|n>>>8)+2*((255&t)<<23)}}},K=function(t,n,r,e,o){return H(t,null==n.level?6:n.level,null==n.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(t.length)))):12+n.mem,r,e,!o)},L=function(t,n){var r={};for(var e in t)r[e]=t[e];for(var e in n)r[e]=n[e];return r},N=function(t,n,r){for(var e=t(),o=""+t,i=o.slice(o.indexOf("[")+1,o.lastIndexOf("]")).replace(/ /g,"").split(","),a=0;a>>=8},lt=function(t,n){var r=n.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=n.level<2?4:9==n.level?2:0,t[9]=3,0!=n.mtime&&ut(t,4,Math.floor(new Date(n.mtime||Date.now())/1e3)),r){t[3]=8;for(var e=0;e<=r.length;++e)t[e+10]=r.charCodeAt(e)}},ct=function(t){if(31!=t[0]||139!=t[1]||8!=t[2])throw"invalid gzip data";var n=t[3],r=10;4&n&&(r+=t[10]|2+(t[11]<<8));for(var e=(n>>3&1)+(n>>4&1);e>0;e-=!t[r++]);return r+(2&n)},ht=function(t){var n=t.length;return(t[n-4]|t[n-3]<<8|t[n-2]<<16)+2*(t[n-1]<<23)},pt=function(t){return 10+(t.filename&&t.filename.length+1||0)},vt=function(t,n){var r=n.level,e=0==r?0:r<6?1:9==r?3:2;t[0]=120,t[1]=e<<6|(e?32-2*e:1)},dt=function(t){if(8!=(15&t[0])||t[0]>>>4>7||(t[0]<<8|t[1])%31)throw"invalid zlib data";if(32&t[1])throw"invalid zlib data: preset dictionaries not supported"};function gt(t,n){return n||"function"!=typeof t||(n=t,t={}),this.ondata=n,t}var yt=function(){function t(t,n){n||"function"!=typeof t||(n=t,t={}),this.ondata=n,this.o=t||{}}return t.prototype.p=function(t,n){this.ondata(K(t,this.o,0,0,!n),n)},t.prototype.push=function(t,n){if(this.d)throw"stream finished";if(!this.ondata)throw"no stream handler";this.d=n,this.p(t,n||!1)},t}();_e.Deflate=yt;var wt=function(t,n){at([W,function(){return[it,yt]}],this,gt.call(this,t,n),(function(t){var n=new yt(t.data);onmessage=it(n)}),6)};function xt(t,n,r){if(r||(r=n,n={}),"function"!=typeof r)throw"no callback";return ot(t,n,[W],(function(t){return rt(mt(t.data[0],t.data[1]))}),0,r)}function mt(t,n){return void 0===n&&(n={}),K(t,n,0,0)}_e.AsyncDeflate=wt,_e.deflate=xt,_e.deflateSync=mt;var bt=function(){function t(t){this.s={},this.p=new n(0),this.ondata=t}return t.prototype.e=function(t){if(this.d)throw"stream finished";if(!this.ondata)throw"no stream handler";var r=this.p.length,e=new n(r+t.length);e.set(this.p),e.set(t,r),this.p=e},t.prototype.c=function(t){this.d=this.s.i=t||!1;var n=this.s.b,r=G(this.p,this.o,this.s);this.ondata(D(r,n,this.s.b),this.d),this.o=D(r,this.s.b-32768),this.s.b=this.o.length,this.p=D(this.p,this.s.p/8>>0),this.s.p&=7},t.prototype.push=function(t,n){this.e(t),this.c(n)},t}();_e.Inflate=bt;var zt=function(t){this.ondata=t,at([V,function(){return[it,bt]}],this,0,(function(){var t=new bt;onmessage=it(t)}),7)};function At(t,n,r){if(r||(r=n,n={}),"function"!=typeof r)throw"no callback";return ot(t,n,[V],(function(t){return rt(St(t.data[0],et(t.data[1])))}),1,r)}function St(t,n){return G(t,n)}_e.AsyncInflate=zt,_e.inflate=At,_e.inflateSync=St;var kt=function(){function t(t,n){this.c=B(),this.l=0,this.v=1,yt.call(this,t,n)}return t.prototype.push=function(t,n){yt.prototype.push.call(this,t,n)},t.prototype.p=function(t,n){this.c.p(t),this.l+=t.length;var r=K(t,this.o,this.v&&pt(this.o),n&&8,!n);this.v&&(lt(r,this.o),this.v=0),n&&(ut(r,r.length-8,this.c.d()),ut(r,r.length-4,this.l)),this.ondata(r,n)},t}();_e.Gzip=kt,_e.Compress=kt;var Mt=function(t,n){at([W,X,function(){return[it,yt,kt]}],this,gt.call(this,t,n),(function(t){var n=new kt(t.data);onmessage=it(n)}),8)};function Ct(t,n,r){if(r||(r=n,n={}),"function"!=typeof r)throw"no callback";return ot(t,n,[W,X,function(){return[Dt]}],(function(t){return rt(Dt(t.data[0],t.data[1]))}),2,r)}function Dt(t,n){void 0===n&&(n={});var r=B(),e=t.length;r.p(t);var o=K(t,n,pt(n),8),i=o.length;return lt(o,n),ut(o,i-8,r.d()),ut(o,i-4,e),o}_e.AsyncGzip=Mt,_e.AsyncCompress=Mt,_e.gzip=Ct,_e.compress=Ct,_e.gzipSync=Dt,_e.compressSync=Dt;var Gt=function(){function t(t){this.v=1,bt.call(this,t)}return t.prototype.push=function(t,n){if(bt.prototype.e.call(this,t),this.v){var r=ct(this.p);if(r>=this.p.length&&!n)return;this.p=this.p.subarray(r),this.v=0}if(n){if(this.p.length<8)throw"invalid gzip stream";this.p=this.p.subarray(0,-8)}bt.prototype.c.call(this,n)},t}();_e.Gunzip=Gt;var Ut=function(t){this.ondata=t,at([V,$,function(){return[it,bt,Gt]}],this,0,(function(){var t=new Gt;onmessage=it(t)}),9)};function Ot(t,n,r){if(r||(r=n,n={}),"function"!=typeof r)throw"no callback";return ot(t,n,[V,$,function(){return[It]}],(function(t){return rt(It(t.data[0]))}),3,r)}function It(t,r){return G(t.subarray(ct(t),-8),r||new n(ht(t)))}_e.AsyncGunzip=Ut,_e.gunzip=Ot,_e.gunzipSync=It;var Ft=function(){function t(t,n){this.c=J(),this.v=1,yt.call(this,t,n)}return t.prototype.push=function(t,n){yt.prototype.push.call(this,t,n)},t.prototype.p=function(t,n){this.c.p(t);var r=K(t,this.o,this.v&&2,n&&4,!n);this.v&&(vt(r,this.o),this.v=0),n&&ut(r,r.length-4,this.c.d()),this.ondata(r,n)},t}();_e.Zlib=Ft;var Zt=function(t,n){at([W,tt,function(){return[it,yt,Ft]}],this,gt.call(this,t,n),(function(t){var n=new Ft(t.data);onmessage=it(n)}),10)};function Et(t,n,r){if(r||(r=n,n={}),"function"!=typeof r)throw"no callback";return ot(t,n,[W,tt,function(){return[Tt]}],(function(t){return rt(Tt(t.data[0],t.data[1]))}),4,r)}function Tt(t,n){void 0===n&&(n={});var r=J();r.p(t);var e=K(t,n,2,4);return vt(e,n),ut(e,e.length-4,r.d()),e}_e.AsyncZlib=Zt,_e.zlib=Et,_e.zlibSync=Tt;var _t=function(){function t(t){this.v=1,bt.call(this,t)}return t.prototype.push=function(t,n){if(bt.prototype.e.call(this,t),this.v){if(this.p.length<2&&!n)return;this.p=this.p.subarray(2),this.v=0}if(n){if(this.p.length<4)throw"invalid zlib stream";this.p=this.p.subarray(0,-4)}bt.prototype.c.call(this,n)},t}();_e.Unzlib=_t;var jt=function(t){this.ondata=t,at([V,nt,function(){return[it,bt,_t]}],this,0,(function(){var t=new _t;onmessage=it(t)}),11)};function qt(t,n,r){if(r||(r=n,n={}),"function"!=typeof r)throw"no callback";return ot(t,n,[V,nt,function(){return[Ht]}],(function(t){return rt(Ht(t.data[0],et(t.data[1])))}),5,r)}function Ht(t,n){return G((dt(t),t.subarray(2,-4)),n)}_e.AsyncUnzlib=jt,_e.unzlib=qt,_e.unzlibSync=Ht;var Yt=function(){function t(t){this.G=Gt,this.I=bt,this.Z=_t,this.ondata=t}return t.prototype.push=function(t,r){if(!this.ondata)throw"no stream handler";if(this.s)this.s.push(t,r);else{if(this.p&&this.p.length){var e=new n(this.p.length+t.length);e.set(this.p),e.set(t,this.p.length)}else this.p=t;if(this.p.length>2){var o=this,i=function(){o.ondata.apply(o,arguments)};this.s=31==this.p[0]&&139==this.p[1]&&8==this.p[2]?new this.G(i):8!=(15&this.p[0])||this.p[0]>>4>7||(this.p[0]<<8|this.p[1])%31?new this.I(i):new this.Z(i),this.s.push(this.p,r),this.p=null}}},t}();_e.Decompress=Yt;var Bt=function(){function t(t){this.G=Ut,this.I=zt,this.Z=jt,this.ondata=t}return t.prototype.push=function(t,n){Yt.prototype.push.call(this,t,n)},t}();function Jt(t,n,r){if(r||(r=n,n={}),"function"!=typeof r)throw"no callback";return 31==t[0]&&139==t[1]&&8==t[2]?Ot(t,n,r):8!=(15&t[0])||t[0]>>4>7||(t[0]<<8|t[1])%31?At(t,n,r):qt(t,n,r)}function Kt(t,n){return 31==t[0]&&139==t[1]&&8==t[2]?It(t,n):8!=(15&t[0])||t[0]>>4>7||(t[0]<<8|t[1])%31?St(t,n):Ht(t,n)}_e.AsyncDecompress=Bt,_e.decompress=Jt,_e.decompressSync=Kt;var Lt=function(t,r,e,o){for(var i in t){var a=t[i],s=r+i;a instanceof n?e[s]=[a,o]:Array.isArray(a)?e[s]=[a[0],L(o,a[1])]:Lt(a,s+"/",e,o)}};function Nt(t,r){var e=t.length;if(!r&&"undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var o=new n(t.length+(t.length>>>1)),i=0,a=function(t){o[i++]=t},s=0;so.length){var f=new n(i+8+(e-s<<1));f.set(o),o=f}var u=t.charCodeAt(s);u<128||r?a(u):u<2048?(a(192|u>>>6),a(128|63&u)):u>55295&&u<57344?(a(240|(u=65536+(1047552&u)|1023&t.charCodeAt(++s))>>>18),a(128|u>>>12&63),a(128|u>>>6&63),a(128|63&u)):(a(224|u>>>12),a(128|u>>>6&63),a(128|63&u))}return D(o,0,i)}function Pt(t,n){var r="";if(!n&&"undefined"!=typeof TextDecoder)return(new TextDecoder).decode(t);for(var e=0;e>10,56320|1023&o))}return r}_e.strToU8=Nt,_e.strFromU8=Pt;var Qt=function(t,n){return n+30+st(t,n+26)+st(t,n+28)},Rt=function(t,n,r){var e=st(t,n+28),o=Pt(t.subarray(n+46,n+46+e),!(2048&st(t,n+8))),i=n+46+e,a=r?Vt(t,i):[ft(t,n+20),ft(t,n+24),ft(t,n+42)],s=a[0],f=a[1],u=a[2];return[st(t,n+10),s,f,o,i+st(t,n+30)+st(t,n+32),u]},Vt=function(t,n){for(;1!=st(t,n);n+=4+st(t,n+2));return[ft(t,n+12),ft(t,n+4),ft(t,n+20)]},Wt=function(t,n,r,e,o,i,a,s,f,u){var l=i.length,c=e.length;ut(t,n,null!=f?33639248:67324752),n+=4,null!=f&&(t[n]=20,n+=2),t[n]=20,n+=2,t[n++]=8==u&&(1==s.level?6:s.level<6?4:9==s.level?2:0),t[n++]=a&&8,t[n]=u,n+=2;var h=new Date(s.mtime||Date.now()),p=h.getFullYear()-1980;if(p<0||p>119)throw"date not in range 1980-2099";ut(t,n,2*(p<<24)|h.getMonth()+1<<21|h.getDate()<<16|h.getHours()<<11|h.getMinutes()<<5|h.getSeconds()>>>1),ut(t,n+=4,r),ut(t,n+4,c),ut(t,n+8,o),ut(t,n+12,l),n+=16,null!=f&&(ut(t,n+=10,f),n+=4),t.set(i,n),n+=l,null==f&&t.set(e,n)},Xt=function(t,n,r,e,o){ut(t,n,101010256),ut(t,n+8,r),ut(t,n+10,r),ut(t,n+12,e),ut(t,n+16,o)};function $t(t,r,e){if(e||(e=r,r={}),"function"!=typeof e)throw"no callback";var o={};Lt(t,"",o,r);var i=Object.keys(o),a=i.length,s=0,f=0,u=a,l=Array(a),c=[],h=function(){for(var t=0;t65535&&m("filename too long",null),x)if(g<16e4)try{m(null,mt(u,v))}catch(t){m(t,null)}else c.push(xt(u,v,m));else m(null,u)},d=0;d65535)throw"filename too long";var v=c?mt(u,l):u,d=v.length,g=B();g.p(u),o.push({t:c,d:v,m:u.length,c:g.d(),u:s.length!=p,n:h,o:i,p:l}),i+=30+p+d,a+=76+2*p+d}for(var y=new n(a+22),w=i,x=a-i,m=0;m65558)return void r("invalid zip file",null);var s=st(t,a+8);s||r(null,{});var f=s,u=ft(t,a+16),l=4294967295==u;if(l){if(a=ft(t,a-12),101075792!=ft(t,a))throw"invalid zip file";f=s=ft(t,a+32),u=ft(t,a+48)}for(var c=function(a){var f=Rt(t,u,l),c=f[0],h=f[1],p=f[2],v=f[3],d=f[4],g=Qt(t,f[5]);u=d;var y=function(t,n){t?(o(),r(t,null)):(i[v]=n,--s||r(null,i))};if(c)if(8==c){var w=t.subarray(g,g+h);if(h<32e4)try{y(null,St(w,new n(p)))}catch(t){y(t,null)}else e.push(At(w,{size:p},y))}else y("unknown compression type "+c,null);else y(null,D(t,g,g+h))},h=0;h65558)throw"invalid zip file";var o=st(t,e+8);if(!o)return{};var i=ft(t,e+16),a=4294967295==i;if(a){if(e=ft(t,e-12),101075792!=ft(t,e))throw"invalid zip file";o=ft(t,e+32),i=ft(t,e+48)}for(var s=0;s>>1|(21845&d)<<1;v[d]=((65280&(g=(61680&(g=(52428&g)>>>2|(13107&g)<<2))>>>4|(3855&g)<<4))>>>8|(255&g)<<8)>>>1}var w=function(t,n,e){for(var i=t.length,o=0,a=new r(n);o>>u]=h}else for(s=new r(i),o=0;o>>15-t[o]);return s},y=new n(288);for(d=0;d<144;++d)y[d]=8;for(d=144;d<256;++d)y[d]=9;for(d=256;d<280;++d)y[d]=7;for(d=280;d<288;++d)y[d]=8;var m=new n(32);for(d=0;d<32;++d)m[d]=5;var b=w(y,9,0),x=w(y,9,1),z=w(m,5,0),k=w(m,5,1),M=function(t){for(var n=t[0],r=1;rn&&(n=t[r]);return n},A=function(t,n,r){var e=n/8|0;return(t[e]|t[e+1]<<8)>>(7&n)&r},S=function(t,n){var r=n/8|0;return(t[r]|t[r+1]<<8|t[r+2]<<16)>>(7&n)},D=function(t){return(t/8|0)+(7&t&&1)},C=function(t,i,o){(null==i||i<0)&&(i=0),(null==o||o>t.length)&&(o=t.length);var a=new(t instanceof r?r:t instanceof e?e:n)(o-i);return a.set(t.subarray(i,o)),a},U=function(t,r,e){var s=t.length;if(!s||e&&!e.l&&s<5)return r||new n(0);var f=!r||e,h=!e||e.i;e||(e={}),r||(r=new n(3*s));var c=function(t){var e=r.length;if(t>e){var i=new n(Math.max(2*e,t));i.set(r),r=i}},p=e.f||0,v=e.p||0,d=e.b||0,g=e.l,y=e.d,m=e.m,b=e.n,z=8*s;do{if(!g){e.f=p=A(t,v,1);var U=A(t,v+1,3);if(v+=3,!U){var O=t[(Y=D(v)+4)-4]|t[Y-3]<<8,T=Y+O;if(T>s){if(h)throw"unexpected EOF";break}f&&c(d+O),r.set(t.subarray(Y,T),d),e.b=d+=O,e.p=v=8*T;continue}if(1==U)g=x,y=k,m=9,b=5;else{if(2!=U)throw"invalid block type";var Z=A(t,v,31)+257,I=A(t,v+10,15)+4,F=Z+A(t,v+5,31)+1;v+=14;for(var E=new n(F),G=new n(19),P=0;P>>4)<16)E[P++]=Y;else{var J=0,K=0;for(16==Y?(K=3+A(t,v,3),v+=2,J=E[P-1]):17==Y?(K=3+A(t,v,7),v+=3):18==Y&&(K=11+A(t,v,127),v+=7);K--;)E[P++]=J}}var L=E.subarray(0,Z),N=E.subarray(Z);m=M(L),b=M(N),g=w(L,m,1),y=w(N,b,1)}if(v>z){if(h)throw"unexpected EOF";break}}f&&c(d+131072);for(var Q=(1<>>4;if((v+=15&J)>z){if(h)throw"unexpected EOF";break}if(!J)throw"invalid length/literal";if(W<256)r[d++]=W;else{if(256==W){V=v,g=null;break}var X=W-254;W>264&&(X=A(t,v,(1<<(tt=i[P=W-257]))-1)+u[P],v+=tt);var $=y[S(t,v)&R],_=$>>>4;if(!$)throw"invalid distance";if(v+=15&$,N=l[_],_>3){var tt=o[_];N+=S(t,v)&(1<z){if(h)throw"unexpected EOF";break}f&&c(d+131072);for(var nt=d+X;d>>8},T=function(t,n,r){var e=n/8|0;t[e]|=r<<=7&n,t[e+1]|=r>>>8,t[e+2]|=r>>>16},Z=function(t,e){for(var i=[],o=0;ov&&(v=s[o].s);var d=new r(v+1),g=I(i[l-1],d,0);if(g>e){o=0;var w=0,y=g-e,m=1<e))break;w+=m-(1<>>=y;w>0;){var x=s[o].s;d[x]=0&&w;--o){var z=s[o].s;d[z]==e&&(--d[z],++w)}g=e}return[new n(d),g]},I=function(t,n,r){return-1==t.s?Math.max(I(t.l,n,r+1),I(t.r,n,r+1)):n[t.s]=r},F=function(t){for(var n=t.length;n&&!t[--n];);for(var e=new r(++n),i=0,o=t[0],a=1,s=function(t){e[i++]=t},f=1;f<=n;++f)if(t[f]==o&&f!=n)++a;else{if(!o&&a>2){for(;a>138;a-=138)s(32754);a>2&&(s(a>10?a-11<<5|28690:a-3<<5|12305),a=0)}else if(a>3){for(s(o),--a;a>6;a-=6)s(8304);a>2&&(s(a-3<<5|8208),a=0)}for(;a--;)s(o);a=1,o=t[f]}return[e.subarray(0,i),n]},E=function(t,n){for(var r=0,e=0;e>>8,t[i+2]=255^t[i],t[i+3]=255^t[i+1];for(var o=0;o4&&!Y[a[J-1]];--J);var K,L,N,Q,R=p+5<<3,V=E(f,y)+E(u,m)+h,W=E(f,g)+E(u,M)+h+14+3*J+E(j,Y)+(2*j[16]+3*j[17]+7*j[18]);if(R<=V&&R<=W)return G(n,v,t.subarray(l,l+p));if(O(n,v,1+(W15&&(O(n,v,tt[q]>>>5&127),v+=tt[q]>>>12)}}else K=b,L=y,N=z,Q=m;for(q=0;q255){var nt;T(n,v,K[257+(nt=s[q]>>>18&31)]),v+=L[nt+257],nt>7&&(O(n,v,s[q]>>>23&31),v+=i[nt]);var rt=31&s[q];T(n,v,N[rt]),v+=Q[rt],rt>3&&(T(n,v,s[q]>>>5&8191),v+=o[rt])}else T(n,v,K[s[q]]),v+=L[s[q]];return T(n,v,K[256]),v+L[256]},j=new e([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),q=new n(0),H=function(t,a,s,f,u,c){var l=t.length,v=new n(f+l+5*(1+Math.ceil(l/7e3))+u),d=v.subarray(f,v.length-u),g=0;if(!a||l<8)for(var w=0;w<=l;w+=65535){var y=w+65535;y>>13,x=8191&m,z=(1<7e3||E>24576)&&L>423){g=P(t,d,0,O,T,Z,F,E,Y,w-Y,g),E=I=F=0,Y=w;for(var N=0;N<286;++N)T[N]=0;for(N=0;N<30;++N)Z[N]=0}var Q=2,R=0,V=x,W=J-K&32767;if(L>2&&B==U(w-W))for(var X=Math.min(b,L)-1,$=Math.min(32767,w),_=Math.min(258,L);W<=$&&--V&&J!=K;){if(t[w+Q]==t[w+Q-W]){for(var tt=0;tt<_&&t[w+tt]==t[w+tt-W];++tt);if(tt>Q){if(Q=tt,R=W,tt>X)break;var nt=Math.min(W,tt-2),rt=0;for(N=0;Nrt&&(rt=it,K=et)}}}W+=(J=K)-(K=k[J])+32768&32767}if(R){O[E++]=268435456|h[Q]<<18|p[R];var ot=31&h[Q],at=31&p[R];F+=i[ot]+o[at],++T[257+ot],++Z[at],H=w+Q,++I}else O[E++]=t[w],++T[t[w]]}}g=P(t,d,c,O,T,Z,F,E,Y,w-Y,g),!c&&7&g&&(g=G(d,g+1,q))}return C(v,0,f+D(g)+u)},Y=function(){for(var t=new e(256),n=0;n<256;++n){for(var r=n,i=9;--i;)r=(1&r&&3988292384)^r>>>1;t[n]=r}return t}(),B=function(){var t=-1;return{p:function(n){for(var r=t,e=0;e>>8;t=r},d:function(){return~t}}},J=function(){var t=1,n=0;return{p:function(r){for(var e=t,i=n,o=r.length,a=0;a!=o;){for(var s=Math.min(a+2655,o);a>16),i=(65535&i)+15*(i>>16)}t=e,n=i},d:function(){return(255&(t%=65521))<<24|t>>>8<<16|(255&(n%=65521))<<8|n>>>8}}},K=function(t,n,r,e,i){return H(t,null==n.level?6:n.level,null==n.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(t.length)))):12+n.mem,r,e,!i)},L=function(t,n){var r={};for(var e in t)r[e]=t[e];for(var e in n)r[e]=n[e];return r},N=function(t,n,r){for(var e=t(),i=""+t,o=i.slice(i.indexOf("[")+1,i.lastIndexOf("]")).replace(/ /g,"").split(","),a=0;a>>0},ut=function(t,n){return ft(t,n)+4294967296*ft(t,n+4)},ht=function(t,n,r){for(;r;++n)t[n]=r,r>>>=8},ct=function(t,n){var r=n.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=n.level<2?4:9==n.level?2:0,t[9]=3,0!=n.mtime&&ht(t,4,Math.floor(new Date(n.mtime||Date.now())/1e3)),r){t[3]=8;for(var e=0;e<=r.length;++e)t[e+10]=r.charCodeAt(e)}},lt=function(t){if(31!=t[0]||139!=t[1]||8!=t[2])throw"invalid gzip data";var n=t[3],r=10;4&n&&(r+=t[10]|2+(t[11]<<8));for(var e=(n>>3&1)+(n>>4&1);e>0;e-=!t[r++]);return r+(2&n)},pt=function(t){var n=t.length;return(t[n-4]|t[n-3]<<8|t[n-2]<<16|t[n-1]<<24)>>>0},vt=function(t){return 10+(t.filename&&t.filename.length+1||0)},dt=function(t,n){var r=n.level,e=0==r?0:r<6?1:9==r?3:2;t[0]=120,t[1]=e<<6|(e?32-2*e:1)},gt=function(t){if(8!=(15&t[0])||t[0]>>>4>7||(t[0]<<8|t[1])%31)throw"invalid zlib data";if(32&t[1])throw"invalid zlib data: preset dictionaries not supported"};function wt(t,n){return n||"function"!=typeof t||(n=t,t={}),this.ondata=n,t}var yt=function(){function t(t,n){n||"function"!=typeof t||(n=t,t={}),this.ondata=n,this.o=t||{}}return t.prototype.p=function(t,n){this.ondata(K(t,this.o,0,0,!n),n)},t.prototype.push=function(t,n){if(this.d)throw"stream finished";if(!this.ondata)throw"no stream handler";this.d=n,this.p(t,n||!1)},t}();_e.Deflate=yt;var mt=function(){return function(t,n){at([X,function(){return[ot,yt]}],this,wt.call(this,t,n),(function(t){var n=new yt(t.data);onmessage=ot(n)}),6)}}();function bt(t,n,r){if(r||(r=n,n={}),"function"!=typeof r)throw"no callback";return it(t,n,[X],(function(t){return rt(xt(t.data[0],t.data[1]))}),0,r)}function xt(t,n){return K(t,n||{},0,0)}_e.AsyncDeflate=mt,_e.deflate=bt,_e.deflateSync=xt;var zt=function(){function t(t){this.s={},this.p=new n(0),this.ondata=t}return t.prototype.e=function(t){if(this.d)throw"stream finished";if(!this.ondata)throw"no stream handler";var r=this.p.length,e=new n(r+t.length);e.set(this.p),e.set(t,r),this.p=e},t.prototype.c=function(t){this.d=this.s.i=t||!1;var n=this.s.b,r=U(this.p,this.o,this.s);this.ondata(C(r,n,this.s.b),this.d),this.o=C(r,this.s.b-32768),this.s.b=this.o.length,this.p=C(this.p,this.s.p/8|0),this.s.p&=7},t.prototype.push=function(t,n){this.e(t),this.c(n)},t}();_e.Inflate=zt;var kt=function(){return function(t){this.ondata=t,at([W,function(){return[ot,zt]}],this,0,(function(){var t=new zt;onmessage=ot(t)}),7)}}();function Mt(t,n,r){if(r||(r=n,n={}),"function"!=typeof r)throw"no callback";return it(t,n,[W],(function(t){return rt(At(t.data[0],et(t.data[1])))}),1,r)}function At(t,n){return U(t,n)}_e.AsyncInflate=kt,_e.inflate=Mt,_e.inflateSync=At;var St=function(){function t(t,n){this.c=B(),this.l=0,this.v=1,yt.call(this,t,n)}return t.prototype.push=function(t,n){yt.prototype.push.call(this,t,n)},t.prototype.p=function(t,n){this.c.p(t),this.l+=t.length;var r=K(t,this.o,this.v&&vt(this.o),n&&8,!n);this.v&&(ct(r,this.o),this.v=0),n&&(ht(r,r.length-8,this.c.d()),ht(r,r.length-4,this.l)),this.ondata(r,n)},t}();_e.Gzip=St,_e.Compress=St;var Dt=function(){return function(t,n){at([X,$,function(){return[ot,yt,St]}],this,wt.call(this,t,n),(function(t){var n=new St(t.data);onmessage=ot(n)}),8)}}();function Ct(t,n,r){if(r||(r=n,n={}),"function"!=typeof r)throw"no callback";return it(t,n,[X,$,function(){return[Ut]}],(function(t){return rt(Ut(t.data[0],t.data[1]))}),2,r)}function Ut(t,n){n||(n={});var r=B(),e=t.length;r.p(t);var i=K(t,n,vt(n),8),o=i.length;return ct(i,n),ht(i,o-8,r.d()),ht(i,o-4,e),i}_e.AsyncGzip=Dt,_e.AsyncCompress=Dt,_e.gzip=Ct,_e.compress=Ct,_e.gzipSync=Ut,_e.compressSync=Ut;var Ot=function(){function t(t){this.v=1,zt.call(this,t)}return t.prototype.push=function(t,n){if(zt.prototype.e.call(this,t),this.v){var r=this.p.length>3?lt(this.p):4;if(r>=this.p.length&&!n)return;this.p=this.p.subarray(r),this.v=0}if(n){if(this.p.length<8)throw"invalid gzip stream";this.p=this.p.subarray(0,-8)}zt.prototype.c.call(this,n)},t}();_e.Gunzip=Ot;var Tt=function(){return function(t){this.ondata=t,at([W,_,function(){return[ot,zt,Ot]}],this,0,(function(){var t=new Ot;onmessage=ot(t)}),9)}}();function Zt(t,n,r){if(r||(r=n,n={}),"function"!=typeof r)throw"no callback";return it(t,n,[W,_,function(){return[It]}],(function(t){return rt(It(t.data[0]))}),3,r)}function It(t,r){return U(t.subarray(lt(t),-8),r||new n(pt(t)))}_e.AsyncGunzip=Tt,_e.gunzip=Zt,_e.gunzipSync=It;var Ft=function(){function t(t,n){this.c=J(),this.v=1,yt.call(this,t,n)}return t.prototype.push=function(t,n){yt.prototype.push.call(this,t,n)},t.prototype.p=function(t,n){this.c.p(t);var r=K(t,this.o,this.v&&2,n&&4,!n);this.v&&(dt(r,this.o),this.v=0),n&&ht(r,r.length-4,this.c.d()),this.ondata(r,n)},t}();_e.Zlib=Ft;var Et=function(){return function(t,n){at([X,tt,function(){return[ot,yt,Ft]}],this,wt.call(this,t,n),(function(t){var n=new Ft(t.data);onmessage=ot(n)}),10)}}();function Gt(t,n,r){if(r||(r=n,n={}),"function"!=typeof r)throw"no callback";return it(t,n,[X,tt,function(){return[Pt]}],(function(t){return rt(Pt(t.data[0],t.data[1]))}),4,r)}function Pt(t,n){n||(n={});var r=J();r.p(t);var e=K(t,n,2,4);return dt(e,n),ht(e,e.length-4,r.d()),e}_e.AsyncZlib=Et,_e.zlib=Gt,_e.zlibSync=Pt;var jt=function(){function t(t){this.v=1,zt.call(this,t)}return t.prototype.push=function(t,n){if(zt.prototype.e.call(this,t),this.v){if(this.p.length<2&&!n)return;this.p=this.p.subarray(2),this.v=0}if(n){if(this.p.length<4)throw"invalid zlib stream";this.p=this.p.subarray(0,-4)}zt.prototype.c.call(this,n)},t}();_e.Unzlib=jt;var qt=function(){return function(t){this.ondata=t,at([W,nt,function(){return[ot,zt,jt]}],this,0,(function(){var t=new jt;onmessage=ot(t)}),11)}}();function Ht(t,n,r){if(r||(r=n,n={}),"function"!=typeof r)throw"no callback";return it(t,n,[W,nt,function(){return[Yt]}],(function(t){return rt(Yt(t.data[0],et(t.data[1])))}),5,r)}function Yt(t,n){return U((gt(t),t.subarray(2,-4)),n)}_e.AsyncUnzlib=qt,_e.unzlib=Ht,_e.unzlibSync=Yt;var Bt=function(){function t(t){this.G=Ot,this.I=zt,this.Z=jt,this.ondata=t}return t.prototype.push=function(t,r){if(!this.ondata)throw"no stream handler";if(this.s)this.s.push(t,r);else{if(this.p&&this.p.length){var e=new n(this.p.length+t.length);e.set(this.p),e.set(t,this.p.length)}else this.p=t;if(this.p.length>2){var i=this,o=function(){i.ondata.apply(i,arguments)};this.s=31==this.p[0]&&139==this.p[1]&&8==this.p[2]?new this.G(o):8!=(15&this.p[0])||this.p[0]>>4>7||(this.p[0]<<8|this.p[1])%31?new this.I(o):new this.Z(o),this.s.push(this.p,r),this.p=null}}},t}();_e.Decompress=Bt;var Jt=function(){function t(t){this.G=Tt,this.I=kt,this.Z=qt,this.ondata=t}return t.prototype.push=function(t,n){Bt.prototype.push.call(this,t,n)},t}();function Kt(t,n,r){if(r||(r=n,n={}),"function"!=typeof r)throw"no callback";return 31==t[0]&&139==t[1]&&8==t[2]?Zt(t,n,r):8!=(15&t[0])||t[0]>>4>7||(t[0]<<8|t[1])%31?Mt(t,n,r):Ht(t,n,r)}function Lt(t,n){return 31==t[0]&&139==t[1]&&8==t[2]?It(t,n):8!=(15&t[0])||t[0]>>4>7||(t[0]<<8|t[1])%31?At(t,n):Yt(t,n)}_e.AsyncDecompress=Jt,_e.decompress=Kt,_e.decompressSync=Lt;var Nt=function(t,r,e,i){for(var o in t){var a=t[o],s=r+o;a instanceof n?e[s]=[a,i]:Array.isArray(a)?e[s]=[a[0],L(i,a[1])]:Nt(a,s+"/",e,i)}},Qt="undefined"!=typeof TextEncoder&&new TextEncoder,Rt="undefined"!=typeof TextDecoder&&new TextDecoder,Vt=0;try{Rt.decode(q,{stream:!0}),Vt=1}catch(t){}var Wt=function(t){for(var n="",r=0;;){var e=t[r++],i=(e>127)+(e>223)+(e>239);if(r+i>t.length)return[n,C(t,r-1)];i?3==i?(e=((15&e)<<18|(63&t[r++])<<12|(63&t[r++])<<6|63&t[r++])-65536,n+=String.fromCharCode(55296|e>>10,56320|1023&e)):n+=String.fromCharCode(1&i?(31&e)<<6|63&t[r++]:(15&e)<<12|(63&t[r++])<<6|63&t[r++]):n+=String.fromCharCode(e)}},Xt=function(){function t(t){this.ondata=t,Vt?this.t=new TextDecoder:this.p=q}return t.prototype.push=function(t,r){if(!this.ondata)throw"no callback";if(r=!!r,this.t){if(this.ondata(this.t.decode(t,{stream:!0}),r),r){if(this.t.decode().length)throw"invalid utf-8 data";this.t=null}}else{if(!this.p)throw"stream finished";var e=new n(this.p.length+t.length);e.set(this.p),e.set(t,this.p.length);var i=Wt(e),o=i[0],a=i[1];if(r){if(a.length)throw"invalid utf-8 data";this.p=null}else this.p=a;this.ondata(o,r)}},t}();_e.DecodeUTF8=Xt;var $t=function(){function t(t){this.ondata=t}return t.prototype.push=function(t,n){if(!this.ondata)throw"no callback";if(this.d)throw"stream finished";this.ondata(_t(t),this.d=n||!1)},t}();function _t(t,r){if(r){for(var e=new n(t.length),i=0;i>1)),s=0,f=function(t){a[s++]=t};for(i=0;ia.length){var u=new n(s+8+(o-i<<1));u.set(a),a=u}var h=t.charCodeAt(i);h<128||r?f(h):h<2048?(f(192|h>>6),f(128|63&h)):h>55295&&h<57344?(f(240|(h=65536+(1047552&h)|1023&t.charCodeAt(++i))>>18),f(128|h>>12&63),f(128|h>>6&63),f(128|63&h)):(f(224|h>>12),f(128|h>>6&63),f(128|63&h))}return C(a,0,s)}function tn(t,n){if(n){for(var r="",e=0;e65535)throw"extra field too long";n+=e+4}return n},sn=function(t,n,r,e,i,o,a,s){var f=e.length,u=r.extra,h=s&&s.length,c=an(u);ht(t,n,null!=a?33639248:67324752),n+=4,null!=a&&(t[n++]=20,t[n++]=r.os),t[n]=20,n+=2,t[n++]=r.flag<<1|(null==o&&8),t[n++]=i&&8,t[n++]=255&r.compression,t[n++]=r.compression>>8;var l=new Date(null==r.mtime?Date.now():r.mtime),p=l.getFullYear()-1980;if(p<0||p>119)throw"date not in range 1980-2099";if(ht(t,n,p<<25|l.getMonth()+1<<21|l.getDate()<<16|l.getHours()<<11|l.getMinutes()<<5|l.getSeconds()>>>1),n+=4,null!=o&&(ht(t,n,r.crc),ht(t,n+4,o),ht(t,n+8,r.size)),ht(t,n+12,f),ht(t,n+14,c),n+=16,null!=a&&(ht(t,n,h),ht(t,n+6,r.attrs),ht(t,n+10,a),n+=14),t.set(e,n),n+=f,c)for(var v in u){var d=u[v],g=d.length;ht(t,n,+v),ht(t,n+2,g),t.set(d,n+4),n+=4+g}return h&&(t.set(s,n),n+=h),n},fn=function(t,n,r,e,i){ht(t,n,101010256),ht(t,n+8,r),ht(t,n+10,r),ht(t,n+12,e),ht(t,n+16,i)},un=function(){function t(t){this.filename=t,this.c=B(),this.size=0,this.compression=0}return t.prototype.process=function(t,n){this.ondata(null,t,n)},t.prototype.push=function(t,n){if(!this.ondata)throw"no callback - add to ZIP archive before pushing";this.c.p(t),this.size+=t.length,n&&(this.crc=this.c.d()),this.process(t,n||!1)},t}();_e.ZipPassThrough=un;var hn=function(){function t(t,n){var r=this;n||(n={}),un.call(this,t),this.d=new yt(n,(function(t,n){r.ondata(null,t,n)})),this.compression=8,this.flag=nn(n.level)}return t.prototype.process=function(t,n){try{this.d.push(t,n)}catch(t){this.ondata(t,null,n)}},t.prototype.push=function(t,n){un.prototype.push.call(this,t,n)},t}();_e.ZipDeflate=hn;var cn=function(){function t(t,n){var r=this;n||(n={}),un.call(this,t),this.d=new mt(n,(function(t,n,e){r.ondata(t,n,e)})),this.compression=8,this.flag=nn(n.level),this.terminate=this.d.terminate}return t.prototype.process=function(t,n){this.d.push(t,n)},t.prototype.push=function(t,n){un.prototype.push.call(this,t,n)},t}();_e.AsyncZipDeflate=cn;var ln=function(){function t(t){this.ondata=t,this.u=[],this.d=1}return t.prototype.add=function(t){var r=this;if(2&this.d)throw"stream finished";var e=_t(t.filename),i=e.length,o=t.comment,a=o&&_t(o),s=i!=t.filename.length||a&&o.length!=a.length,f=i+an(t.extra)+30;if(i>65535)throw"filename too long";var u=new n(f);sn(u,0,t,e,s);var h=[u],c=function(){for(var t=0,n=h;t65535&&M("filename too long",null),k)if(g<16e4)try{M(null,xt(u,v))}catch(t){M(t,null)}else c.push(bt(u,v,M));else M(null,u)},d=0;d65535)throw"filename too long";var w=c?xt(u,h):u,y=w.length,m=B();m.p(u),i.push(L(h,{size:u.length,crc:m.d(),c:w,f:M,m:v,u:l!=s.length||v&&p.length!=d,o:o,compression:c})),o+=30+l+g+y,a+=76+2*(l+g)+(d||0)+y}for(var b=new n(a+22),x=o,z=a-o,k=0;k0){var i=Math.min(this.c,t.length),o=t.subarray(0,i);if(this.c-=i,this.d?this.d.push(o,!this.c):this.k[0].push(o),(t=t.subarray(i)).length)return this.push(t,r)}else{var a=0,s=0,f=void 0,u=void 0;this.p.length?t.length?((u=new n(this.p.length+t.length)).set(this.p),u.set(t,this.p.length)):u=this.p:u=t;for(var h=u.length,c=this.c,l=c&&this.d,p=function(){var t,n=ft(u,s);if(67324752==n){a=1,f=s,v.d=null,v.c=0;var r=st(u,s+6),i=st(u,s+8),o=2048&r,l=8&r,p=st(u,s+26),d=st(u,s+28);if(h>s+30+p+d){var g=[];v.k.unshift(g),a=2;var w,y=ft(u,s+18),m=ft(u,s+22),b=tn(u.subarray(s+30,s+=30+p),!o);4294967295==y?(t=l?[-2]:on(u,s),y=t[0],m=t[1]):l&&(y=-1),s+=d,v.c=y;var x={name:b,compression:i,start:function(){if(!x.ondata)throw"no callback";if(y){var t=e.o[i];if(!t)throw"unknown compression type "+i;(w=y<0?new t(b):new t(b,y,m)).ondata=function(t,n,r){x.ondata(t,n,r)};for(var n=0,r=g;n=0&&(x.size=y,x.originalSize=m),v.onfile(x)}return"break"}if(c){if(134695760==n)return f=s+=12+(-2==c&&8),a=3,v.c=0,"break";if(33639248==n)return f=s-=4,a=3,v.c=0,"break"}},v=this;s65558)return void r("invalid zip file",null);var s=st(t,a+8);s||r(null,{});var f=s,u=ft(t,a+16),h=4294967295==u;if(h){if(a=ft(t,a-12),101075792!=ft(t,a))return void r("invalid zip file",null);f=s=ft(t,a+32),u=ft(t,a+48)}for(var c=function(a){var f=en(t,u,h),c=f[0],l=f[1],p=f[2],v=f[3],d=f[4],g=rn(t,f[5]);u=d;var w=function(t,n){t?(i(),r(t,null)):(o[v]=n,--s||r(null,o))};if(c)if(8==c){var y=t.subarray(g,g+l);if(l<32e4)try{w(null,At(y,new n(p)))}catch(t){w(t,null)}else e.push(Mt(y,{size:p},w))}else w("unknown compression type "+c,null);else w(null,C(t,g,g+l))},l=0;l65558)throw"invalid zip file";var i=st(t,e+8);if(!i)return{};var o=ft(t,e+16),a=4294967295==o;if(a){if(e=ft(t,e-12),101075792!=ft(t,e))throw"invalid zip file";i=ft(t,e+32),o=ft(t,e+48)}for(var s=0;s