define(["@jupyter-widgets/base"],function(__WEBPACK_EXTERNAL_MODULE__10__){return function(t){var e={};function n(i){if(e[i])return e[i].exports;var r=e[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(i,r,function(e){return t[e]}.bind(null,r));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=147)}([function(t,e,n){"use strict";n.r(e);var i="http://www.w3.org/1999/xhtml",r={svg:"http://www.w3.org/2000/svg",xhtml:i,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"},o=function(t){var e=t+="",n=e.indexOf(":");return n>=0&&"xmlns"!==(e=t.slice(0,n))&&(t=t.slice(n+1)),r.hasOwnProperty(e)?{space:r[e],local:t}:t};var a=function(t){var e=o(t);return(e.local?function(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}:function(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===i&&e.documentElement.namespaceURI===i?e.createElement(t):e.createElementNS(n,t)}})(e)};function s(){}var c=function(t){return null==t?s:function(){return this.querySelector(t)}};function l(){return[]}var u=function(t){return null==t?l:function(){return this.querySelectorAll(t)}},h=function(t){return function(){return this.matches(t)}},d=function(t){return new Array(t.length)};function f(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}f.prototype={constructor:f,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};var p="$";function m(t,e,n,i,r,o){for(var a,s=0,c=e.length,l=o.length;se?1:t>=e?0:NaN}function v(t){return function(){this.removeAttribute(t)}}function b(t){return function(){this.removeAttributeNS(t.space,t.local)}}function y(t,e){return function(){this.setAttribute(t,e)}}function x(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function w(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttribute(t):this.setAttribute(t,n)}}function M(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)}}var E=function(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView};function S(t){return function(){this.style.removeProperty(t)}}function A(t,e,n){return function(){this.style.setProperty(t,e,n)}}function T(t,e,n){return function(){var i=e.apply(this,arguments);null==i?this.style.removeProperty(t):this.style.setProperty(t,i,n)}}function k(t,e){return t.style.getPropertyValue(e)||E(t).getComputedStyle(t,null).getPropertyValue(e)}function P(t){return function(){delete this[t]}}function L(t,e){return function(){this[t]=e}}function O(t,e){return function(){var n=e.apply(this,arguments);null==n?delete this[t]:this[t]=n}}function C(t){return t.trim().split(/^|\s+/)}function R(t){return t.classList||new I(t)}function I(t){this._node=t,this._names=C(t.getAttribute("class")||"")}function z(t,e){for(var n=R(t),i=-1,r=e.length;++i=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};function U(){this.textContent=""}function F(t){return function(){this.textContent=t}}function H(t){return function(){var e=t.apply(this,arguments);this.textContent=null==e?"":e}}function q(){this.innerHTML=""}function G(t){return function(){this.innerHTML=t}}function W(t){return function(){var e=t.apply(this,arguments);this.innerHTML=null==e?"":e}}function V(){this.nextSibling&&this.parentNode.appendChild(this)}function X(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Y(){return null}function K(){var t=this.parentNode;t&&t.removeChild(this)}function Z(){return this.parentNode.insertBefore(this.cloneNode(!1),this.nextSibling)}function J(){return this.parentNode.insertBefore(this.cloneNode(!0),this.nextSibling)}var Q={},$=null;"undefined"!=typeof document&&("onmouseenter"in document.documentElement||(Q={mouseenter:"mouseover",mouseleave:"mouseout"}));function tt(t,e,n){return t=et(t,e,n),function(e){var n=e.relatedTarget;n&&(n===this||8&n.compareDocumentPosition(this))||t.call(this,e)}}function et(t,e,n){return function(i){var r=$;$=i;try{t.call(this,this.__data__,e,n)}finally{$=r}}}function nt(t){return t.trim().split(/^|\s+/).map(function(t){var e="",n=t.indexOf(".");return n>=0&&(e=t.slice(n+1),t=t.slice(0,n)),{type:t,name:e}})}function it(t){return function(){var e=this.__on;if(e){for(var n,i=0,r=-1,o=e.length;i=M&&(M=w+1);!(x=b[M])&&++M<_;);y._next=x||null}}return(s=new ct(s,r))._enter=c,s._exit=l,s},enter:function(){return new ct(this._enter||this._groups.map(d),this._parents)},exit:function(){return new ct(this._exit||this._groups.map(d),this._parents)},join:function(t,e,n){var i=this.enter(),r=this,o=this.exit();return i="function"==typeof t?t(i):i.append(t+""),null!=e&&(r=e(r)),null==n?o.remove():n(o),i&&r?i.merge(r).order():r},merge:function(t){for(var e=this._groups,n=t._groups,i=e.length,r=n.length,o=Math.min(i,r),a=new Array(i),s=0;s=0;)(i=r[o])&&(a&&4^i.compareDocumentPosition(a)&&a.parentNode.insertBefore(i,a),a=i);return this},sort:function(t){function e(e,n){return e&&n?t(e.__data__,n.__data__):!e-!n}t||(t=_);for(var n=this._groups,i=n.length,r=new Array(i),o=0;o1?this.each((null==e?S:"function"==typeof e?T:A)(t,e,null==n?"":n)):k(this.node(),t)},property:function(t,e){return arguments.length>1?this.each((null==e?P:"function"==typeof e?O:L)(t,e)):this.node()[t]},classed:function(t,e){var n=C(t+"");if(arguments.length<2){for(var i=R(this.node()),r=-1,o=n.length;++re?1:t>=e?0:NaN},r=function(t){var e;return 1===t.length&&(e=t,t=function(t,n){return i(e(t),n)}),{left:function(e,n,i,r){for(null==i&&(i=0),null==r&&(r=e.length);i>>1;t(e[o],n)<0?i=o+1:r=o}return i},right:function(e,n,i,r){for(null==i&&(i=0),null==r&&(r=e.length);i>>1;t(e[o],n)>0?r=o:i=o+1}return i}}};var o=r(i),a=o.right,s=o.left,c=a,l=function(t,e){null==e&&(e=u);for(var n=0,i=t.length-1,r=t[0],o=new Array(i<0?0:i);nt?1:e>=t?0:NaN},f=function(t){return null===t?NaN:+t},p=function(t,e){var n,i,r=t.length,o=0,a=-1,s=0,c=0;if(null==e)for(;++a1)return c/(o-1)},m=function(t,e){var n=p(t,e);return n?Math.sqrt(n):n},g=function(t,e){var n,i,r,o=t.length,a=-1;if(null==e){for(;++a=n)for(i=r=n;++an&&(i=n),r=n)for(i=r=n;++an&&(i=n),r0)return[t];if((i=e0)for(t=Math.ceil(t/a),e=Math.floor(e/a),o=new Array(r=Math.ceil(e-t+1));++s=0?(o>=M?10:o>=E?5:o>=S?2:1)*Math.pow(10,r):-Math.pow(10,-r)/(o>=M?10:o>=E?5:o>=S?2:1)}function k(t,e,n){var i=Math.abs(e-t)/Math.max(0,n),r=Math.pow(10,Math.floor(Math.log(i)/Math.LN10)),o=i/r;return o>=M?r*=10:o>=E?r*=5:o>=S&&(r*=2),eh;)d.pop(),--f;var p,m=new Array(f+1);for(r=0;r<=f;++r)(p=m[r]=[]).x0=r>0?d[r-1]:u,p.x1=r=1)return+n(t[i-1],i-1,t);var i,r=(i-1)*e,o=Math.floor(r),a=+n(t[o],o,t);return a+(+n(t[o+1],o+1,t)-a)*(r-o)}},C=function(t,e,n){return t=b.call(t,f).sort(i),Math.ceil((n-e)/(2*(O(t,.75)-O(t,.25))*Math.pow(t.length,-1/3)))},R=function(t,e,n){return Math.ceil((n-e)/(3.5*m(t)*Math.pow(t.length,-1/3)))},I=function(t,e){var n,i,r=t.length,o=-1;if(null==e){for(;++o=n)for(i=n;++oi&&(i=n)}else for(;++o=n)for(i=n;++oi&&(i=n);return i},z=function(t,e){var n,i=t.length,r=i,o=-1,a=0;if(null==e)for(;++o=0;)for(e=(i=t[r]).length;--e>=0;)n[--a]=i[e];return n},D=function(t,e){var n,i,r=t.length,o=-1;if(null==e){for(;++o=n)for(i=n;++on&&(i=n)}else for(;++o=n)for(i=n;++on&&(i=n);return i},j=function(t,e){for(var n=e.length,i=new Array(n);n--;)i[n]=t[e[n]];return i},U=function(t,e){if(n=t.length){var n,r,o=0,a=0,s=t[a];for(null==e&&(e=i);++oh}c.mouse("drag")}function m(){Object(y.select)(y.event.view).on("mousemove.drag mouseup.drag",null),E(y.event.view,n),w(),c.mouse("end")}function g(){if(r.apply(this,arguments)){var t,e,n=y.event.changedTouches,i=o.apply(this,arguments),a=n.length;for(t=0;t0&&(n=r-f),S<0?h=d-p:S>0&&(o=a-p),x=j,Q.attr("cursor",W.selection),it());break;default:return}N()},!0).on("keyup.brush",function(){switch(y.event.keyCode){case 16:I&&(g=_=I=!1,it());break;case 18:x===F&&(w<0?l=u:w>0&&(n=r),S<0?h=d:S>0&&(o=a),x=U,it());break;case 32:x===j&&(y.event.altKey?(w&&(l=u-f*w,n=r+f*w),S&&(h=d-p*S,o=a+p*S),x=F):(w<0?l=u:w>0&&(n=r),S<0?h=d:S>0&&(o=a),x=U),Q.attr("cursor",W[b]),it());break;default:return}N()},!0).on("mousemove.brush",nt,!0).on("mouseup.brush",rt,!0);M(y.event.view)}B(),Object(R.b)(v),s.call(v),Z.start()}function nt(){var t=Object(y.mouse)(v);!I||g||_||(Math.abs(t[0]-G[0])>Math.abs(t[1]-G[1])?_=!0:g=!0),G=t,m=!0,N(),it()}function it(){var t;switch(f=G[0]-z[0],p=G[1]-z[1],x){case j:case D:w&&(f=Math.max(P-n,Math.min(O-l,f)),r=n+f,u=l+f),S&&(p=Math.max(L-o,Math.min(C-h,p)),a=o+p,d=h+p);break;case U:w<0?(f=Math.max(P-n,Math.min(O-n,f)),r=n+f,u=l):w>0&&(f=Math.max(P-l,Math.min(O-l,f)),r=n,u=l+f),S<0?(p=Math.max(L-o,Math.min(C-o,p)),a=o+p,d=h):S>0&&(p=Math.max(L-h,Math.min(C-h,p)),a=o,d=h+p);break;case F:w&&(r=Math.max(P,Math.min(O,n-f*w)),u=Math.max(P,Math.min(O,l+f*w))),S&&(a=Math.max(L,Math.min(C,o-p*S)),d=Math.max(L,Math.min(C,h+p*S)))}u1e-6)if(Math.abs(u*s-c*l)>1e-6&&r){var d=n-o,f=i-a,p=s*s+c*c,m=d*d+f*f,g=Math.sqrt(p),_=Math.sqrt(h),v=r*Math.tan((gt-Math.acos((p+h-m)/(2*g*_)))/2),b=v/_,y=v/g;Math.abs(b-1)>1e-6&&(this._+="L"+(t+b*l)+","+(e+b*u)),this._+="A"+r+","+r+",0,0,"+ +(u*d>l*f)+","+(this._x1=t+y*s)+","+(this._y1=e+y*c)}else this._+="L"+(this._x1=t)+","+(this._y1=e);else;},arc:function(t,e,n,i,r,o){t=+t,e=+e;var a=(n=+n)*Math.cos(i),s=n*Math.sin(i),c=t+a,l=e+s,u=1^o,h=o?i-r:r-i;if(n<0)throw new Error("negative radius: "+n);null===this._x1?this._+="M"+c+","+l:(Math.abs(this._x1-c)>1e-6||Math.abs(this._y1-l)>1e-6)&&(this._+="L"+c+","+l),n&&(h<0&&(h=h%_t+_t),h>vt?this._+="A"+n+","+n+",0,1,"+u+","+(t-a)+","+(e-s)+"A"+n+","+n+",0,1,"+u+","+(this._x1=c)+","+(this._y1=l):h>1e-6&&(this._+="A"+n+","+n+",0,"+ +(h>=gt)+","+u+","+(this._x1=t+n*Math.cos(r))+","+(this._y1=e+n*Math.sin(r))))},rect:function(t,e,n,i){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)+"h"+ +n+"v"+ +i+"h"+-n+"Z"},toString:function(){return this._}};var xt=yt;function wt(t){return t.source}function Mt(t){return t.target}function Et(t){return t.radius}function St(t){return t.startAngle}function At(t){return t.endAngle}var Tt=function(){var t=wt,e=Mt,n=Et,i=St,r=At,o=null;function a(){var a,s=pt.call(arguments),c=t.apply(this,s),l=e.apply(this,s),u=+n.apply(this,(s[0]=c,s)),h=i.apply(this,s)-lt,d=r.apply(this,s)-lt,f=u*at(h),p=u*st(h),m=+n.apply(this,(s[0]=l,s)),g=i.apply(this,s)-lt,_=r.apply(this,s)-lt;if(o||(o=a=xt()),o.moveTo(f,p),o.arc(0,0,u,h,d),h===g&&d===_||(o.quadraticCurveTo(0,0,m*at(g),m*st(g)),o.arc(0,0,m,g,_)),o.quadraticCurveTo(0,0,f,p),o.closePath(),a)return o=null,a+""||null}return a.radius=function(t){return arguments.length?(n="function"==typeof t?t:mt(+t),a):n},a.startAngle=function(t){return arguments.length?(i="function"==typeof t?t:mt(+t),a):i},a.endAngle=function(t){return arguments.length?(r="function"==typeof t?t:mt(+t),a):r},a.source=function(e){return arguments.length?(t=e,a):t},a.target=function(t){return arguments.length?(e=t,a):e},a.context=function(t){return arguments.length?(o=null==t?null:t,a):o},a},kt=n(32),Pt=n(7),Lt=Array.prototype.slice,Ot=function(t,e){return t-e},Ct=function(t){for(var e=0,n=t.length,i=t[n-1][1]*t[0][0]-t[n-1][0]*t[0][1];++ei!=f>i&&n<(d-l)*(i-u)/(f-u)+l&&(r=-r)}return r}function Bt(t,e,n){var i,r,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)&&(r=t[i=+(t[0]===e[0])],o=n[i],a=e[i],r<=o&&o<=a||a<=o&&o<=r)}var Nt=function(){},Dt=[[],[[[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]]],[]],jt=function(){var t=1,e=1,n=i.y,r=c;function o(t){var e=n(t);if(Array.isArray(e))e=e.slice().sort(Ot);else{var r=Object(i.i)(t),o=r[0],s=r[1];e=Object(i.A)(o,s,e),e=Object(i.s)(Math.floor(o/e)*e,Math.floor(s/e)*e,e)}return e.map(function(e){return a(t,e)})}function a(n,i){var o=[],a=[];return function(n,i,r){var o,a,c,l,u,h,d=new Array,f=new Array;o=a=-1,l=n[0]>=i,Dt[l<<1].forEach(p);for(;++o=i,Dt[c|l<<1].forEach(p);Dt[l<<0].forEach(p);for(;++a=i,u=n[a*t]>=i,Dt[l<<1|u<<2].forEach(p);++o=i,h=u,u=n[a*t+o+1]>=i,Dt[c|l<<1|u<<2|h<<3].forEach(p);Dt[l|u<<3].forEach(p)}o=-1,u=n[a*t]>=i,Dt[u<<2].forEach(p);for(;++o=i,Dt[u<<2|h<<3].forEach(p);function p(t){var e,n,i=[t[0][0]+o,t[0][1]+a],c=[t[1][0]+o,t[1][1]+a],l=s(i),u=s(c);(e=f[l])?(n=d[u])?(delete f[e.end],delete d[n.start],e===n?(e.ring.push(c),r(e.ring)):d[e.start]=f[n.end]={start:e.start,end:n.end,ring:e.ring.concat(n.ring)}):(delete f[e.end],e.ring.push(c),f[e.end=u]=e):(e=d[u])?(n=f[l])?(delete d[e.start],delete f[n.end],e===n?(e.ring.push(c),r(e.ring)):d[n.start]=f[e.end]={start:n.start,end:e.end,ring:n.ring.concat(e.ring)}):(delete d[e.start],e.ring.unshift(i),d[e.start=l]=e):d[l]=f[u]={start:l,end:u,ring:[i,c]}}Dt[u<<3].forEach(p)}(n,i,function(t){r(t,n,i),Ct(t)>0?o.push([t]):a.push(t)}),a.forEach(function(t){for(var e,n=0,i=o.length;n0&&a0&&s0&&r>0))throw new Error("invalid size");return t=i,e=r,o},o.thresholds=function(t){return arguments.length?(n="function"==typeof t?t:Array.isArray(t)?Rt(Lt.call(t)):Rt(t),o):n},o.smooth=function(t){return arguments.length?(r=t?c:Nt,o):r===c},o};function Ut(t,e,n){for(var i=t.width,r=t.height,o=1+(n<<1),a=0;a=n&&(s>=o&&(c-=t.data[s-o+a*i]),e.data[s-n+a*i]=c/Math.min(s+1,i-1+o-s,o))}function Ft(t,e,n){for(var i=t.width,r=t.height,o=1+(n<<1),a=0;a=n&&(s>=o&&(c-=t.data[a+(s-o)*i]),e.data[a+(s-n)*i]=c/Math.min(s+1,r-1+o-s,o))}function Ht(t){return t[0]}function qt(t){return t[1]}function Gt(){return 1}var Wt=function(){var t=Ht,e=qt,n=Gt,r=960,o=500,a=20,s=2,c=3*a,l=r+2*c>>s,u=o+2*c>>s,h=Rt(20);function d(r){var o=new Float32Array(l*u),d=new Float32Array(l*u);r.forEach(function(i,r,a){var h=+t(i,r,a)+c>>s,d=+e(i,r,a)+c>>s,f=+n(i,r,a);h>=0&&h=0&&d>s),Ft({width:l,height:u,data:d},{width:l,height:u,data:o},a>>s),Ut({width:l,height:u,data:o},{width:l,height:u,data:d},a>>s),Ft({width:l,height:u,data:d},{width:l,height:u,data:o},a>>s),Ut({width:l,height:u,data:o},{width:l,height:u,data:d},a>>s),Ft({width:l,height:u,data:d},{width:l,height:u,data:o},a>>s);var p=h(o);if(!Array.isArray(p)){var m=Object(i.k)(o);p=Object(i.A)(0,m,p),(p=Object(i.s)(0,Math.floor(m/p)*p,p)).shift()}return jt().thresholds(p).size([l,u])(o).map(f)}function f(t){return t.value*=Math.pow(2,-2*s),t.coordinates.forEach(p),t}function p(t){t.forEach(m)}function m(t){t.forEach(g)}function g(t){t[0]=t[0]*Math.pow(2,s)-c,t[1]=t[1]*Math.pow(2,s)-c}function _(){return l=r+2*(c=3*a)>>s,u=o+2*c>>s,d}return d.x=function(e){return arguments.length?(t="function"==typeof e?e:Rt(+e),d):t},d.y=function(t){return arguments.length?(e="function"==typeof t?t:Rt(+t),d):e},d.weight=function(t){return arguments.length?(n="function"==typeof t?t:Rt(+t),d):n},d.size=function(t){if(!arguments.length)return[r,o];var e=Math.ceil(t[0]),n=Math.ceil(t[1]);if(!(e>=0||e>=0))throw new Error("invalid size");return r=e,o=n,_()},d.cellSize=function(t){if(!arguments.length)return 1<=1))throw new Error("invalid cell size");return s=Math.floor(Math.log(t)/Math.LN2),_()},d.thresholds=function(t){return arguments.length?(h="function"==typeof t?t:Array.isArray(t)?Rt(Lt.call(t)):Rt(t),d):h},d.bandwidth=function(t){if(!arguments.length)return Math.sqrt(a*(a+1));if(!((t=+t)>=0))throw new Error("invalid bandwidth");return a=Math.round((Math.sqrt(4*t*t+1)-1)/2),_()},d},Vt={},Xt={},Yt=34,Kt=10,Zt=13;function Jt(t){return new Function("d","return {"+t.map(function(t,e){return JSON.stringify(t)+": d["+e+"]"}).join(",")+"}")}function Qt(t){var e=Object.create(null),n=[];return t.forEach(function(t){for(var i in t)i in e||n.push(e[i]=i)}),n}function $t(t,e){var n=t+"",i=n.length;return i9999?"+"+$t(e,6):$t(e,4))+"-"+$t(t.getUTCMonth()+1,2)+"-"+$t(t.getUTCDate(),2)+(o?"T"+$t(n,2)+":"+$t(i,2)+":"+$t(r,2)+"."+$t(o,3)+"Z":r?"T"+$t(n,2)+":"+$t(i,2)+":"+$t(r,2)+"Z":i||n?"T"+$t(n,2)+":"+$t(i,2)+"Z":"")}var ee=function(t){var e=new RegExp('["'+t+"\n\r]"),n=t.charCodeAt(0);function i(t,e){var i,r=[],o=t.length,a=0,s=0,c=o<=0,l=!1;function u(){if(c)return Xt;if(l)return l=!1,Vt;var e,i,r=a;if(t.charCodeAt(r)===Yt){for(;a++=o?c=!0:(i=t.charCodeAt(a++))===Kt?l=!0:i===Zt&&(l=!0,t.charCodeAt(a)===Kt&&++a),t.slice(r+1,e-1).replace(/""/g,'"')}for(;a=(o=(m+_)/2))?m=o:_=o,(u=n>=(a=(g+v)/2))?g=a:v=a,r=f,!(f=f[h=u<<1|l]))return r[h]=p,t;if(s=+t._x.call(null,f.data),c=+t._y.call(null,f.data),e===s&&n===c)return p.next=f,r?r[h]=p:t._root=p,t;do{r=r?r[h]=new Array(4):t._root=new Array(4),(l=e>=(o=(m+_)/2))?m=o:_=o,(u=n>=(a=(g+v)/2))?g=a:v=a}while((h=u<<1|l)==(d=(c>=a)<<1|s>=o));return r[d]=f,r[h]=p,t}var Ne=function(t,e,n,i,r){this.node=t,this.x0=e,this.y0=n,this.x1=i,this.y1=r};function De(t){return t[0]}function je(t){return t[1]}function Ue(t,e,n){var i=new Fe(null==e?De:e,null==n?je:n,NaN,NaN,NaN,NaN);return null==t?i:i.addAll(t)}function Fe(t,e,n,i,r,o){this._x=t,this._y=e,this._x0=n,this._y0=i,this._x1=r,this._y1=o,this._root=void 0}function He(t){for(var e={data:t.data},n=e;t=t.next;)n=n.next={data:t.data};return e}var qe=Ue.prototype=Fe.prototype;function Ge(t){return t.x+t.vx}function We(t){return t.y+t.vy}qe.copy=function(){var t,e,n=new Fe(this._x,this._y,this._x0,this._y0,this._x1,this._y1),i=this._root;if(!i)return n;if(!i.length)return n._root=He(i),n;for(t=[{source:i,target:n._root=new Array(4)}];i=t.pop();)for(var r=0;r<4;++r)(e=i.source[r])&&(e.length?t.push({source:e,target:i.target[r]=new Array(4)}):i.target[r]=He(e));return n},qe.add=function(t){var e=+this._x.call(null,t),n=+this._y.call(null,t);return Be(this.cover(e,n),e,n,t)},qe.addAll=function(t){var e,n,i,r,o=t.length,a=new Array(o),s=new Array(o),c=1/0,l=1/0,u=-1/0,h=-1/0;for(n=0;nu&&(u=i),rh&&(h=r));if(c>u||l>h)return this;for(this.cover(c,l).cover(u,h),n=0;nt||t>=r||i>e||e>=o;)switch(s=(ed||(o=c.y0)>f||(a=c.x1)=_)<<1|t>=g)&&(c=p[p.length-1],p[p.length-1]=p[p.length-1-l],p[p.length-1-l]=c)}else{var v=t-+this._x.call(null,m.data),b=e-+this._y.call(null,m.data),y=v*v+b*b;if(y=(s=(p+g)/2))?p=s:g=s,(u=a>=(c=(m+_)/2))?m=c:_=c,e=f,!(f=f[h=u<<1|l]))return this;if(!f.length)break;(e[h+1&3]||e[h+2&3]||e[h+3&3])&&(n=e,d=h)}for(;f.data!==t;)if(i=f,!(f=f.next))return this;return(r=f.next)&&delete f.next,i?(r?i.next=r:delete i.next,this):e?(r?e[h]=r:delete e[h],(f=e[0]||e[1]||e[2]||e[3])&&f===(e[3]||e[2]||e[1]||e[0])&&!f.length&&(n?n[d]=f:this._root=f),this):(this._root=r,this)},qe.removeAll=function(t){for(var e=0,n=t.length;ec+f||rl+f||os.index){var p=c-a.x-a.vx,m=l-a.y-a.vy,g=p*p+m*m;gt.r&&(t.r=t[e].r)}function s(){if(e){var i,r,o=e.length;for(n=new Array(o),i=0;i1?(null==n?s.remove(t):s.set(t,f(n)),e):s.get(t)},find:function(e,n,i){var r,o,a,s,c,l=0,u=t.length;for(null==i?i=1/0:i*=i,l=0;l1?(l.on(t,n),e):l.on(t)}}},nn=function(){var t,e,n,i,r=Ie(-30),o=1,a=1/0,s=.81;function c(i){var r,o=t.length,a=Ue(t,Je,Qe).visitAfter(u);for(n=i,r=0;r=a)){(t.data!==e||t.next)&&(0===u&&(f+=(u=ze())*u),0===h&&(f+=(h=ze())*h),f0?1:t<0?-1:0},Pn=Math.sqrt,Ln=Math.tan;function On(t){return t>1?0:t<-1?fn:Math.acos(t)}function Cn(t){return t>1?pn:t<-1?-pn:Math.asin(t)}function Rn(t){return(t=Tn(t/2))*t}function In(){}function zn(t,e){t&&Nn.hasOwnProperty(t.type)&&Nn[t.type](t,e)}var Bn={Feature:function(t,e){zn(t.geometry,e)},FeatureCollection:function(t,e){for(var n=t.features,i=-1,r=n.length;++i=0?1:-1,r=i*n,o=wn(e=(e*=vn)/2+mn),a=Tn(e),s=Gn*a,c=qn*o+s*wn(r),l=s*i*Tn(r);Vn.add(xn(l,c)),Hn=t,qn=o,Gn=a}var $n=function(t){return Xn.reset(),Wn(t,Yn),2*Xn};function ti(t){return[xn(t[1],t[0]),Cn(t[2])]}function ei(t){var e=t[0],n=t[1],i=wn(n);return[i*wn(e),i*Tn(e),Tn(n)]}function ni(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function ii(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 ri(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function oi(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function ai(t){var e=Pn(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}var si,ci,li,ui,hi,di,fi,pi,mi,gi,_i=cn(),vi={point:bi,lineStart:xi,lineEnd:wi,polygonStart:function(){vi.point=Mi,vi.lineStart=Ei,vi.lineEnd=Si,_i.reset(),Yn.polygonStart()},polygonEnd:function(){Yn.polygonEnd(),vi.point=bi,vi.lineStart=xi,vi.lineEnd=wi,Vn<0?(si=-(li=180),ci=-(ui=90)):_i>dn?ui=90:_i<-dn&&(ci=-90),gi[0]=si,gi[1]=li}};function bi(t,e){mi.push(gi=[si=t,li=t]),eui&&(ui=e)}function yi(t,e){var n=ei([t*vn,e*vn]);if(pi){var i=ii(pi,n),r=ii([i[1],-i[0],0],i);ai(r),r=ti(r);var o,a=t-hi,s=a>0?1:-1,c=r[0]*_n*s,l=bn(a)>180;l^(s*hiui&&(ui=o):l^(s*hi<(c=(c+360)%360-180)&&cui&&(ui=e)),l?tAi(si,li)&&(li=t):Ai(t,li)>Ai(si,li)&&(si=t):li>=si?(tli&&(li=t)):t>hi?Ai(si,t)>Ai(si,li)&&(li=t):Ai(t,li)>Ai(si,li)&&(si=t)}else mi.push(gi=[si=t,li=t]);eui&&(ui=e),pi=n,hi=t}function xi(){vi.point=yi}function wi(){gi[0]=si,gi[1]=li,vi.point=bi,pi=null}function Mi(t,e){if(pi){var n=t-hi;_i.add(bn(n)>180?n+(n>0?360:-360):n)}else di=t,fi=e;Yn.point(t,e),yi(t,e)}function Ei(){Yn.lineStart()}function Si(){Mi(di,fi),Yn.lineEnd(),bn(_i)>dn&&(si=-(li=180)),gi[0]=si,gi[1]=li,pi=null}function Ai(t,e){return(e-=t)<0?e+360:e}function Ti(t,e){return t[0]-e[0]}function ki(t,e){return t[0]<=t[1]?t[0]<=e&&e<=t[1]:eAi(i[0],i[1])&&(i[1]=r[1]),Ai(r[0],i[1])>Ai(i[0],i[1])&&(i[0]=r[0])):o.push(i=r);for(a=-1/0,e=0,i=o[n=o.length-1];e<=n;i=r,++e)r=o[e],(s=Ai(i[1],r[0]))>a&&(a=s,si=r[0],li=i[1])}return mi=gi=null,si===1/0||ci===1/0?[[NaN,NaN],[NaN,NaN]]:[[si,ci],[li,ui]]},Vi={sphere:In,point:Xi,lineStart:Ki,lineEnd:Qi,polygonStart:function(){Vi.lineStart=$i,Vi.lineEnd=tr},polygonEnd:function(){Vi.lineStart=Ki,Vi.lineEnd=Qi}};function Xi(t,e){t*=vn;var n=wn(e*=vn);Yi(n*wn(t),n*Tn(t),Tn(e))}function Yi(t,e,n){Oi+=(t-Oi)/++Pi,Ci+=(e-Ci)/Pi,Ri+=(n-Ri)/Pi}function Ki(){Vi.point=Zi}function Zi(t,e){t*=vn;var n=wn(e*=vn);Hi=n*wn(t),qi=n*Tn(t),Gi=Tn(e),Vi.point=Ji,Yi(Hi,qi,Gi)}function Ji(t,e){t*=vn;var n=wn(e*=vn),i=n*wn(t),r=n*Tn(t),o=Tn(e),a=xn(Pn((a=qi*o-Gi*r)*a+(a=Gi*i-Hi*o)*a+(a=Hi*r-qi*i)*a),Hi*i+qi*r+Gi*o);Li+=a,Ii+=a*(Hi+(Hi=i)),zi+=a*(qi+(qi=r)),Bi+=a*(Gi+(Gi=o)),Yi(Hi,qi,Gi)}function Qi(){Vi.point=Xi}function $i(){Vi.point=er}function tr(){nr(Ui,Fi),Vi.point=Xi}function er(t,e){Ui=t,Fi=e,t*=vn,e*=vn,Vi.point=nr;var n=wn(e);Hi=n*wn(t),qi=n*Tn(t),Gi=Tn(e),Yi(Hi,qi,Gi)}function nr(t,e){t*=vn;var n=wn(e*=vn),i=n*wn(t),r=n*Tn(t),o=Tn(e),a=qi*o-Gi*r,s=Gi*i-Hi*o,c=Hi*r-qi*i,l=Pn(a*a+s*s+c*c),u=Cn(l),h=l&&-u/l;Ni+=h*a,Di+=h*s,ji+=h*c,Li+=u,Ii+=u*(Hi+(Hi=i)),zi+=u*(qi+(qi=r)),Bi+=u*(Gi+(Gi=o)),Yi(Hi,qi,Gi)}var ir=function(t){Pi=Li=Oi=Ci=Ri=Ii=zi=Bi=Ni=Di=ji=0,Wn(t,Vi);var e=Ni,n=Di,i=ji,r=e*e+n*n+i*i;return r<1e-12&&(e=Ii,n=zi,i=Bi,Lifn?t+Math.round(-t/gn)*gn:t,e]}function sr(t,e,n){return(t%=gn)?e||n?or(lr(t),ur(e,n)):lr(t):e||n?ur(e,n):ar}function cr(t){return function(e,n){return[(e+=t)>fn?e-gn:e<-fn?e+gn:e,n]}}function lr(t){var e=cr(t);return e.invert=cr(-t),e}function ur(t,e){var n=wn(t),i=Tn(t),r=wn(e),o=Tn(e);function a(t,e){var a=wn(e),s=wn(t)*a,c=Tn(t)*a,l=Tn(e),u=l*n+s*i;return[xn(c*r-u*o,s*n-l*i),Cn(u*r+c*o)]}return a.invert=function(t,e){var a=wn(e),s=wn(t)*a,c=Tn(t)*a,l=Tn(e),u=l*r-c*o;return[xn(c*r+l*o,s*n+u*i),Cn(u*n-s*i)]},a}ar.invert=ar;var hr=function(t){function e(e){return(e=t(e[0]*vn,e[1]*vn))[0]*=_n,e[1]*=_n,e}return t=sr(t[0]*vn,t[1]*vn,t.length>2?t[2]*vn:0),e.invert=function(e){return(e=t.invert(e[0]*vn,e[1]*vn))[0]*=_n,e[1]*=_n,e},e};function dr(t,e,n,i,r,o){if(n){var a=wn(e),s=Tn(e),c=i*n;null==r?(r=e+i*gn,o=e-c/2):(r=fr(a,r),o=fr(a,o),(i>0?ro)&&(r+=i*gn));for(var l,u=r;i>0?u>o:u1&&e.push(e.pop().concat(e.shift()))},result:function(){var n=e;return e=[],t=null,n}}},gr=function(t,e){return bn(t[0]-e[0])=0;--o)r.point((u=l[o])[0],u[1]);else i(d.x,d.p.x,-1,r);d=d.p}l=(d=d.o).z,f=!f}while(!d.v);r.lineEnd()}}};function br(t){if(e=t.length){for(var e,n,i=0,r=t[0];++i=0?1:-1,S=E*M,A=S>fn,T=m*x;if(yr.add(xn(T*E*Tn(S),g*w+T*wn(S))),a+=A?M+E*gn:M,A^f>=n^b>=n){var k=ii(ei(d),ei(v));ai(k);var P=ii(o,k);ai(P);var L=(A^M>=0?-1:1)*Cn(P[2]);(i>L||i===L&&(k[0]||k[1]))&&(s+=A^M>=0?1:-1)}}return(a<-dn||a0){for(d||(o.polygonStart(),d=!0),o.lineStart(),t=0;t1&&2&r&&l.push(l.pop().concat(l.shift())),s.push(l.filter(Mr))}return f}};function Mr(t){return t.length>1}function Er(t,e){return((t=t.x)[0]<0?t[1]-pn-dn:pn-t[1])-((e=e.x)[0]<0?e[1]-pn-dn:pn-e[1])}var Sr=wr(function(){return!0},function(t){var e,n=NaN,i=NaN,r=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(o,a){var s=o>0?fn:-fn,c=bn(o-n);bn(c-fn)0?pn:-pn),t.point(r,i),t.lineEnd(),t.lineStart(),t.point(s,i),t.point(o,i),e=0):r!==s&&c>=fn&&(bn(n-r)dn?yn((Tn(e)*(o=wn(i))*Tn(n)-Tn(i)*(r=wn(e))*Tn(t))/(r*o*a)):(e+i)/2}(n,i,o,a),t.point(r,i),t.lineEnd(),t.lineStart(),t.point(s,i),e=0),t.point(n=o,i=a),r=s},lineEnd:function(){t.lineEnd(),n=i=NaN},clean:function(){return 2-e}}},function(t,e,n,i){var r;if(null==t)r=n*pn,i.point(-fn,r),i.point(0,r),i.point(fn,r),i.point(fn,0),i.point(fn,-r),i.point(0,-r),i.point(-fn,-r),i.point(-fn,0),i.point(-fn,r);else if(bn(t[0]-e[0])>dn){var o=t[0]0,r=bn(e)>dn;function o(t,n){return wn(t)*wn(n)>e}function a(t,n,i){var r=[1,0,0],o=ii(ei(t),ei(n)),a=ni(o,o),s=o[0],c=a-s*s;if(!c)return!i&&t;var l=e*a/c,u=-e*s/c,h=ii(r,o),d=oi(r,l);ri(d,oi(o,u));var f=h,p=ni(d,f),m=ni(f,f),g=p*p-m*(ni(d,d)-1);if(!(g<0)){var _=Pn(g),v=oi(f,(-p-_)/m);if(ri(v,d),v=ti(v),!i)return v;var b,y=t[0],x=n[0],w=t[1],M=n[1];x0^v[1]<(bn(v[0]-y)fn^(y<=v[0]&&v[0]<=x)){var A=oi(f,(-p+_)/m);return ri(A,d),[v,ti(A)]}}}function s(e,n){var r=i?t:fn-t,o=0;return e<-r?o|=1:e>r&&(o|=2),n<-r?o|=4:n>r&&(o|=8),o}return wr(o,function(t){var e,n,c,l,u;return{lineStart:function(){l=c=!1,u=1},point:function(h,d){var f,p=[h,d],m=o(h,d),g=i?m?0:s(h,d):m?s(h+(h<0?fn:-fn),d):0;if(!e&&(l=c=m)&&t.lineStart(),m!==c&&(!(f=a(e,p))||gr(e,f)||gr(p,f))&&(p[0]+=dn,p[1]+=dn,m=o(p[0],p[1])),m!==c)u=0,m?(t.lineStart(),f=a(p,e),t.point(f[0],f[1])):(f=a(e,p),t.point(f[0],f[1]),t.lineEnd()),e=f;else if(r&&e&&i^m){var _;g&n||!(_=a(p,e,!0))||(u=0,i?(t.lineStart(),t.point(_[0][0],_[0][1]),t.point(_[1][0],_[1][1]),t.lineEnd()):(t.point(_[1][0],_[1][1]),t.lineEnd(),t.lineStart(),t.point(_[0][0],_[0][1])))}!m||e&&gr(e,p)||t.point(p[0],p[1]),e=p,c=m,n=g},lineEnd:function(){c&&t.lineEnd(),e=null},clean:function(){return u|(l&&c)<<1}}},function(e,i,r,o){dr(o,t,n,r,e,i)},i?[0,-t]:[-fn,t-fn])},Tr=function(t,e,n,i,r,o){var a,s=t[0],c=t[1],l=0,u=1,h=e[0]-s,d=e[1]-c;if(a=n-s,h||!(a>0)){if(a/=h,h<0){if(a0){if(a>u)return;a>l&&(l=a)}if(a=r-s,h||!(a<0)){if(a/=h,h<0){if(a>u)return;a>l&&(l=a)}else if(h>0){if(a0)){if(a/=d,d<0){if(a0){if(a>u)return;a>l&&(l=a)}if(a=o-c,d||!(a<0)){if(a/=d,d<0){if(a>u)return;a>l&&(l=a)}else if(d>0){if(a0&&(t[0]=s+l*h,t[1]=c+l*d),u<1&&(e[0]=s+u*h,e[1]=c+u*d),!0}}}}},kr=1e9,Pr=-kr;function Lr(t,e,n,r){function o(i,o){return t<=i&&i<=n&&e<=o&&o<=r}function a(i,o,a,c){var u=0,h=0;if(null==i||(u=s(i,a))!==(h=s(o,a))||l(i,o)<0^a>0)do{c.point(0===u||3===u?t:n,u>1?r:e)}while((u=(u+a+4)%4)!==h);else c.point(o[0],o[1])}function s(i,r){return bn(i[0]-t)0?0:3:bn(i[0]-n)0?2:1:bn(i[1]-e)0?1:0:r>0?3:2}function c(t,e){return l(t.x,e.x)}function l(t,e){var n=s(t,1),i=s(e,1);return n!==i?n-i:0===n?e[1]-t[1]:1===n?t[0]-e[0]:2===n?t[1]-e[1]:e[0]-t[0]}return function(s){var l,u,h,d,f,p,m,g,_,v,b,y=s,x=mr(),w={point:M,lineStart:function(){w.point=E,u&&u.push(h=[]);v=!0,_=!1,m=g=NaN},lineEnd:function(){l&&(E(d,f),p&&_&&x.rejoin(),l.push(x.result()));w.point=M,_&&y.lineEnd()},polygonStart:function(){y=x,l=[],u=[],b=!0},polygonEnd:function(){var e=function(){for(var e=0,n=0,i=u.length;nr&&(d-o)*(r-a)>(f-a)*(t-o)&&++e:f<=r&&(d-o)*(r-a)<(f-a)*(t-o)&&--e;return e}(),n=b&&e,o=(l=Object(i.n)(l)).length;(n||o)&&(s.polygonStart(),n&&(s.lineStart(),a(null,null,1,s),s.lineEnd()),o&&vr(l,c,e,a,s),s.polygonEnd());y=s,l=u=h=null}};function M(t,e){o(t,e)&&y.point(t,e)}function E(i,a){var s=o(i,a);if(u&&h.push([i,a]),v)d=i,f=a,p=s,v=!1,s&&(y.lineStart(),y.point(i,a));else if(s&&_)y.point(i,a);else{var c=[m=Math.max(Pr,Math.min(kr,m)),g=Math.max(Pr,Math.min(kr,g))],l=[i=Math.max(Pr,Math.min(kr,i)),a=Math.max(Pr,Math.min(kr,a))];Tr(c,l,t,e,n,r)?(_||(y.lineStart(),y.point(c[0],c[1])),y.point(l[0],l[1]),s||y.lineEnd(),b=!1):s&&(y.lineStart(),y.point(i,a),b=!1)}m=i,g=a,_=s}return w}}var Or,Cr,Rr,Ir=function(){var t,e,n,i=0,r=0,o=960,a=500;return n={stream:function(n){return t&&e===n?t:t=Lr(i,r,o,a)(e=n)},extent:function(s){return arguments.length?(i=+s[0][0],r=+s[0][1],o=+s[1][0],a=+s[1][1],t=e=null,n):[[i,r],[o,a]]}}},zr=cn(),Br={sphere:In,point:In,lineStart:function(){Br.point=Dr,Br.lineEnd=Nr},lineEnd:In,polygonStart:In,polygonEnd:In};function Nr(){Br.point=Br.lineEnd=In}function Dr(t,e){Or=t*=vn,Cr=Tn(e*=vn),Rr=wn(e),Br.point=jr}function jr(t,e){t*=vn;var n=Tn(e*=vn),i=wn(e),r=bn(t-Or),o=wn(r),a=i*Tn(r),s=Rr*n-Cr*i*o,c=Cr*n+Rr*i*o;zr.add(xn(Pn(a*a+s*s),c)),Or=t,Cr=n,Rr=i}var Ur=function(t){return zr.reset(),Wn(t,Br),+zr},Fr=[null,null],Hr={type:"LineString",coordinates:Fr},qr=function(t,e){return Fr[0]=t,Fr[1]=e,Ur(Hr)},Gr={Feature:function(t,e){return Vr(t.geometry,e)},FeatureCollection:function(t,e){for(var n=t.features,i=-1,r=n.length;++idn}).map(l)).concat(Object(i.s)(Mn(a/p)*p,o,p).filter(function(t){return bn(t%g)>dn}).map(u))}return v.lines=function(){return b().map(function(t){return{type:"LineString",coordinates:t}})},v.outline=function(){return{type:"Polygon",coordinates:[h(r).concat(d(s).slice(1),h(n).reverse().slice(1),d(c).reverse().slice(1))]}},v.extent=function(t){return arguments.length?v.extentMajor(t).extentMinor(t):v.extentMinor()},v.extentMajor=function(t){return arguments.length?(r=+t[0][0],n=+t[1][0],c=+t[0][1],s=+t[1][1],r>n&&(t=r,r=n,n=t),c>s&&(t=c,c=s,s=t),v.precision(_)):[[r,c],[n,s]]},v.extentMinor=function(n){return arguments.length?(e=+n[0][0],t=+n[1][0],a=+n[0][1],o=+n[1][1],e>t&&(n=e,e=t,t=n),a>o&&(n=a,a=o,o=n),v.precision(_)):[[e,a],[t,o]]},v.step=function(t){return arguments.length?v.stepMajor(t).stepMinor(t):v.stepMinor()},v.stepMajor=function(t){return arguments.length?(m=+t[0],g=+t[1],v):[m,g]},v.stepMinor=function(t){return arguments.length?(f=+t[0],p=+t[1],v):[f,p]},v.precision=function(i){return arguments.length?(_=+i,l=$r(a,o,90),u=to(e,t,_),h=$r(c,s,90),d=to(r,n,_),v):_},v.extentMajor([[-180,-90+dn],[180,90-dn]]).extentMinor([[-180,-80-dn],[180,80+dn]])}function no(){return eo()()}var io,ro,oo,ao,so=function(t,e){var n=t[0]*vn,i=t[1]*vn,r=e[0]*vn,o=e[1]*vn,a=wn(i),s=Tn(i),c=wn(o),l=Tn(o),u=a*wn(n),h=a*Tn(n),d=c*wn(r),f=c*Tn(r),p=2*Cn(Pn(Rn(o-i)+a*c*Rn(r-n))),m=Tn(p),g=p?function(t){var e=Tn(t*=p)/m,n=Tn(p-t)/m,i=n*u+e*d,r=n*h+e*f,o=n*s+e*l;return[xn(r,i)*_n,xn(o,Pn(i*i+r*r))*_n]}:function(){return[n*_n,i*_n]};return g.distance=p,g},co=function(t){return t},lo=cn(),uo=cn(),ho={point:In,lineStart:In,lineEnd:In,polygonStart:function(){ho.lineStart=fo,ho.lineEnd=go},polygonEnd:function(){ho.lineStart=ho.lineEnd=ho.point=In,lo.add(bn(uo)),uo.reset()},result:function(){var t=lo/2;return lo.reset(),t}};function fo(){ho.point=po}function po(t,e){ho.point=mo,io=oo=t,ro=ao=e}function mo(t,e){uo.add(ao*t-oo*e),oo=t,ao=e}function go(){mo(io,ro)}var _o=ho,vo=1/0,bo=vo,yo=-vo,xo=yo;var wo,Mo,Eo,So,Ao={point:function(t,e){tyo&&(yo=t);exo&&(xo=e)},lineStart:In,lineEnd:In,polygonStart:In,polygonEnd:In,result:function(){var t=[[vo,bo],[yo,xo]];return yo=xo=-(bo=vo=1/0),t}},To=0,ko=0,Po=0,Lo=0,Oo=0,Co=0,Ro=0,Io=0,zo=0,Bo={point:No,lineStart:Do,lineEnd:Fo,polygonStart:function(){Bo.lineStart=Ho,Bo.lineEnd=qo},polygonEnd:function(){Bo.point=No,Bo.lineStart=Do,Bo.lineEnd=Fo},result:function(){var t=zo?[Ro/zo,Io/zo]:Co?[Lo/Co,Oo/Co]:Po?[To/Po,ko/Po]:[NaN,NaN];return To=ko=Po=Lo=Oo=Co=Ro=Io=zo=0,t}};function No(t,e){To+=t,ko+=e,++Po}function Do(){Bo.point=jo}function jo(t,e){Bo.point=Uo,No(Eo=t,So=e)}function Uo(t,e){var n=t-Eo,i=e-So,r=Pn(n*n+i*i);Lo+=r*(Eo+t)/2,Oo+=r*(So+e)/2,Co+=r,No(Eo=t,So=e)}function Fo(){Bo.point=No}function Ho(){Bo.point=Go}function qo(){Wo(wo,Mo)}function Go(t,e){Bo.point=Wo,No(wo=Eo=t,Mo=So=e)}function Wo(t,e){var n=t-Eo,i=e-So,r=Pn(n*n+i*i);Lo+=r*(Eo+t)/2,Oo+=r*(So+e)/2,Co+=r,Ro+=(r=So*t-Eo*e)*(Eo+t),Io+=r*(So+e),zo+=3*r,No(Eo=t,So=e)}var Vo=Bo;function Xo(t){this._context=t}Xo.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,gn)}},result:In};var Yo,Ko,Zo,Jo,Qo,$o=cn(),ta={point:In,lineStart:function(){ta.point=ea},lineEnd:function(){Yo&&na(Ko,Zo),ta.point=In},polygonStart:function(){Yo=!0},polygonEnd:function(){Yo=null},result:function(){var t=+$o;return $o.reset(),t}};function ea(t,e){ta.point=na,Ko=Jo=t,Zo=Qo=e}function na(t,e){Jo-=t,Qo-=e,$o.add(Pn(Jo*Jo+Qo*Qo)),Jo=t,Qo=e}var ia=ta;function ra(){this._string=[]}function oa(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}ra.prototype={_radius:4.5,_circle:oa(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=oa(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}};var aa=function(t,e){var n,i,r=4.5;function o(t){return t&&("function"==typeof r&&i.pointRadius(+r.apply(this,arguments)),Wn(t,n(i))),i.result()}return o.area=function(t){return Wn(t,n(_o)),_o.result()},o.measure=function(t){return Wn(t,n(ia)),ia.result()},o.bounds=function(t){return Wn(t,n(Ao)),Ao.result()},o.centroid=function(t){return Wn(t,n(Vo)),Vo.result()},o.projection=function(e){return arguments.length?(n=null==e?(t=null,co):(t=e).stream,o):t},o.context=function(t){return arguments.length?(i=null==t?(e=null,new ra):new Xo(e=t),"function"!=typeof r&&i.pointRadius(r),o):e},o.pointRadius=function(t){return arguments.length?(r="function"==typeof t?t:(i.pointRadius(+t),+t),o):r},o.projection(t).context(e)},sa=function(t){return{stream:ca(t)}};function ca(t){return function(e){var n=new la;for(var i in t)n[i]=t[i];return n.stream=e,n}}function la(){}function ua(t,e,n){var i=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=i&&t.clipExtent(null),Wn(n,t.stream(Ao)),e(Ao.result()),null!=i&&t.clipExtent(i),t}function ha(t,e,n){return ua(t,function(n){var i=e[1][0]-e[0][0],r=e[1][1]-e[0][1],o=Math.min(i/(n[1][0]-n[0][0]),r/(n[1][1]-n[0][1])),a=+e[0][0]+(i-o*(n[1][0]+n[0][0]))/2,s=+e[0][1]+(r-o*(n[1][1]+n[0][1]))/2;t.scale(150*o).translate([a,s])},n)}function da(t,e,n){return ha(t,[[0,0],e],n)}function fa(t,e,n){return ua(t,function(n){var i=+e,r=i/(n[1][0]-n[0][0]),o=(i-r*(n[1][0]+n[0][0]))/2,a=-r*n[0][1];t.scale(150*r).translate([o,a])},n)}function pa(t,e,n){return ua(t,function(n){var i=+e,r=i/(n[1][1]-n[0][1]),o=-r*n[0][0],a=(i-r*(n[1][1]+n[0][1]))/2;t.scale(150*r).translate([o,a])},n)}la.prototype={constructor:la,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 ma=16,ga=wn(30*vn),_a=function(t,e){return+e?function(t,e){function n(i,r,o,a,s,c,l,u,h,d,f,p,m,g){var _=l-i,v=u-r,b=_*_+v*v;if(b>4*e&&m--){var y=a+d,x=s+f,w=c+p,M=Pn(y*y+x*x+w*w),E=Cn(w/=M),S=bn(bn(w)-1)e||bn((_*P+v*L)/b-.5)>.3||a*d+s*f+c*p2?t[2]%360*vn:0,T()):[g*_n,_*_n,v*_n]},S.angle=function(t){return arguments.length?(b=t%360*vn,T()):b*_n},S.precision=function(t){return arguments.length?(a=_a(s,E=t*t),k()):Pn(E)},S.fitExtent=function(t,e){return ha(S,t,e)},S.fitSize=function(t,e){return da(S,t,e)},S.fitWidth=function(t,e){return fa(S,t,e)},S.fitHeight=function(t,e){return pa(S,t,e)},function(){return e=t.apply(this,arguments),S.invert=e.invert&&A,T()}}function wa(t){var e=0,n=fn/3,i=xa(t),r=i(e,n);return r.parallels=function(t){return arguments.length?i(e=t[0]*vn,n=t[1]*vn):[e*_n,n*_n]},r}function Ma(t,e){var n=Tn(t),i=(n+Tn(e))/2;if(bn(i)=.12&&r<.234&&i>=-.425&&i<-.214?s:r>=.166&&r<.234&&i>=-.214&&i<-.115?c:a).invert(t)},u.stream=function(n){return t&&e===n?t:(i=[a.stream(e=n),s.stream(n),c.stream(n)],r=i.length,t={point:function(t,e){for(var n=-1;++n0?e<-pn+dn&&(e=-pn+dn):e>pn-dn&&(e=pn-dn);var n=r/An(Ba(e),i);return[n*Tn(i*t),r-n*wn(i*t)]}return o.invert=function(t,e){var n=r-e,o=kn(i)*Pn(t*t+n*n);return[xn(t,bn(n))/i*kn(n),2*yn(An(r/o,1/i))-pn]},o}var Da=function(){return wa(Na).scale(109.5).parallels([30,30])};function ja(t,e){return[t,e]}ja.invert=ja;var Ua=function(){return ya(ja).scale(152.63)};function Fa(t,e){var n=wn(t),i=t===e?Tn(t):(n-wn(e))/(e-t),r=n/i+t;if(bn(i)dn&&--r>0);return[t/(.8707+(o=i*i)*(o*(o*o*o*(.003971-.001529*o)-.013791)-.131979)),i]};var es=function(){return ya(ts).scale(175.295)};function ns(t,e){return[wn(e)*Tn(t),Tn(e)]}ns.invert=ka(Cn);var is=function(){return ya(ns).scale(249.5).clipAngle(90+dn)};function rs(t,e){var n=wn(e),i=1+wn(t)*n;return[n*Tn(t)/i,Tn(e)/i]}rs.invert=ka(function(t){return 2*yn(t)});var os=function(){return ya(rs).scale(250).clipAngle(142)};function as(t,e){return[Sn(Ln((pn+e)/2)),-t]}as.invert=function(t,e){return[-e,2*yn(En(t))-pn]};var ss=function(){var t=za(as),e=t.center,n=t.rotate;return t.center=function(t){return arguments.length?e([-t[1],t[0]]):[(t=e())[1],-t[0]]},t.rotate=function(t){return arguments.length?n([t[0],t[1],t.length>2?t[2]+90:90]):[(t=n())[0],t[1],t[2]-90]},n([0,0,90]).scale(159.155)};function cs(t,e){return t.parent===e.parent?1:2}function ls(t,e){return t+e.x}function us(t,e){return Math.max(t,e.y)}var hs=function(){var t=cs,e=1,n=1,i=!1;function r(r){var o,a=0;r.eachAfter(function(e){var n=e.children;n?(e.x=function(t){return t.reduce(ls,0)/t.length}(n),e.y=function(t){return 1+t.reduce(us,0)}(n)):(e.x=o?a+=t(e,o):0,e.y=0,o=e)});var s=function(t){for(var e;e=t.children;)t=e[0];return t}(r),c=function(t){for(var e;e=t.children;)t=e[e.length-1];return t}(r),l=s.x-t(s,c)/2,u=c.x+t(c,s)/2;return r.eachAfter(i?function(t){t.x=(t.x-r.x)*e,t.y=(r.y-t.y)*n}:function(t){t.x=(t.x-l)/(u-l)*e,t.y=(1-(r.y?t.y/r.y:1))*n})}return r.separation=function(e){return arguments.length?(t=e,r):t},r.size=function(t){return arguments.length?(i=!1,e=+t[0],n=+t[1],r):i?null:[e,n]},r.nodeSize=function(t){return arguments.length?(i=!0,e=+t[0],n=+t[1],r):i?[e,n]:null},r};function ds(t){var e=0,n=t.children,i=n&&n.length;if(i)for(;--i>=0;)e+=n[i].value;else e=1;t.value=e}function fs(t,e){var n,i,r,o,a,s=new _s(t),c=+t.value&&(s.value=t.value),l=[s];for(null==e&&(e=ps);n=l.pop();)if(c&&(n.value=+n.data.value),(r=e(n.data))&&(a=r.length))for(n.children=new Array(a),o=a-1;o>=0;--o)l.push(i=n.children[o]=new _s(r[o])),i.parent=n,i.depth=n.depth+1;return s.eachBefore(gs)}function ps(t){return t.children}function ms(t){t.data=t.data.data}function gs(t){var e=0;do{t.height=e}while((t=t.parent)&&t.height<++e)}function _s(t){this.data=t,this.depth=this.height=0,this.parent=null}_s.prototype=fs.prototype={constructor:_s,count:function(){return this.eachAfter(ds)},each:function(t){var e,n,i,r,o=this,a=[o];do{for(e=a.reverse(),a=[];o=e.pop();)if(t(o),n=o.children)for(i=0,r=n.length;i=0;--n)r.push(e[n]);return this},sum:function(t){return this.eachAfter(function(e){for(var n=+t(e.data)||0,i=e.children,r=i&&i.length;--r>=0;)n+=i[r].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(),i=e.ancestors(),r=null;for(t=n.pop(),e=i.pop();t===e;)r=t,t=n.pop(),e=i.pop();return r}(e,t),i=[e];e!==n;)e=e.parent,i.push(e);for(var r=i.length;t!==n;)i.splice(r,0,t),t=t.parent;return i},ancestors:function(){for(var t=this,e=[t];t=t.parent;)e.push(t);return e},descendants:function(){var t=[];return this.each(function(e){t.push(e)}),t},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 fs(this).eachBefore(ms)}};var vs=Array.prototype.slice;var bs=function(t){for(var e,n,i=0,r=(t=function(t){for(var e,n,i=t.length;i;)n=Math.random()*i--|0,e=t[i],t[i]=t[n],t[n]=e;return t}(vs.call(t))).length,o=[];i0&&n*n>i*i+r*r}function Ms(t,e){for(var n=0;n(a*=a)?(i=(l+a-r)/(2*l),o=Math.sqrt(Math.max(0,a/l-i*i)),n.x=t.x-i*s-o*c,n.y=t.y-i*c+o*s):(i=(l+r-a)/(2*l),o=Math.sqrt(Math.max(0,r/l-i*i)),n.x=e.x+i*s-o*c,n.y=e.y+i*c+o*s)):(n.x=e.x+n.r,n.y=e.y)}function ks(t,e){var n=t.r+e.r-1e-6,i=e.x-t.x,r=e.y-t.y;return n>0&&n*n>i*i+r*r}function Ps(t){var e=t._,n=t.next._,i=e.r+n.r,r=(e.x*n.r+n.x*e.r)/i,o=(e.y*n.r+n.y*e.r)/i;return r*r+o*o}function Ls(t){this._=t,this.next=null,this.previous=null}function Os(t){if(!(r=t.length))return 0;var e,n,i,r,o,a,s,c,l,u,h;if((e=t[0]).x=0,e.y=0,!(r>1))return e.r;if(n=t[1],e.x=-n.r,n.x=e.r,n.y=0,!(r>2))return e.r+n.r;Ts(n,e,i=t[2]),e=new Ls(e),n=new Ls(n),i=new Ls(i),e.next=i.previous=n,n.next=e.previous=i,i.next=n.previous=e;t:for(s=3;s0)throw new Error("cycle");return o}return n.id=function(e){return arguments.length?(t=Is(e),n):t},n.parentId=function(t){return arguments.length?(e=Is(t),n):e},n};function Js(t,e){return t.parent===e.parent?1:2}function Qs(t){var e=t.children;return e?e[0]:t.t}function $s(t){var e=t.children;return e?e[e.length-1]:t.t}function tc(t,e,n){var i=n/(e.i-t.i);e.c-=i,e.s+=n,t.c+=i,e.z+=n,e.m+=n}function ec(t,e,n){return t.a.parent===e.parent?t.a:n}function nc(t,e){this._=t,this.parent=null,this.children=null,this.A=null,this.a=this,this.z=0,this.m=0,this.c=0,this.s=0,this.t=null,this.i=e}nc.prototype=Object.create(_s.prototype);var ic=function(){var t=Js,e=1,n=1,i=null;function r(r){var c=function(t){for(var e,n,i,r,o,a=new nc(t,0),s=[a];e=s.pop();)if(i=e._.children)for(e.children=new Array(o=i.length),r=o-1;r>=0;--r)s.push(n=e.children[r]=new nc(i[r],r)),n.parent=e;return(a.parent=new nc(null,0)).children=[a],a}(r);if(c.eachAfter(o),c.parent.m=-c.z,c.eachBefore(a),i)r.eachBefore(s);else{var l=r,u=r,h=r;r.eachBefore(function(t){t.xu.x&&(u=t),t.depth>h.depth&&(h=t)});var d=l===u?1:t(l,u)/2,f=d-l.x,p=e/(u.x+d+f),m=n/(h.depth||1);r.eachBefore(function(t){t.x=(t.x+f)*p,t.y=t.depth*m})}return r}function o(e){var n=e.children,i=e.parent.children,r=e.i?i[e.i-1]:null;if(n){!function(t){for(var e,n=0,i=0,r=t.children,o=r.length;--o>=0;)(e=r[o]).z+=n,e.m+=n,n+=e.s+(i+=e.c)}(e);var o=(n[0].z+n[n.length-1].z)/2;r?(e.z=r.z+t(e._,r._),e.m=e.z-o):e.z=o}else r&&(e.z=r.z+t(e._,r._));e.parent.A=function(e,n,i){if(n){for(var r,o=e,a=e,s=n,c=o.parent.children[0],l=o.m,u=a.m,h=s.m,d=c.m;s=$s(s),o=Qs(o),s&&o;)c=Qs(c),(a=$s(a)).a=e,(r=s.z+h-o.z-l+t(s._,o._))>0&&(tc(ec(s,e,i),e,r),l+=r,u+=r),h+=s.m,l+=o.m,d+=c.m,u+=a.m;s&&!$s(a)&&(a.t=s,a.m+=h-u),o&&!Qs(c)&&(c.t=o,c.m+=l-d,i=e)}return i}(e,r,e.parent.A||i[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 r.separation=function(e){return arguments.length?(t=e,r):t},r.size=function(t){return arguments.length?(i=!1,e=+t[0],n=+t[1],r):i?null:[e,n]},r.nodeSize=function(t){return arguments.length?(i=!0,e=+t[0],n=+t[1],r):i?[e,n]:null},r},rc=function(t,e,n,i,r){for(var o,a=t.children,s=-1,c=a.length,l=t.value&&(r-n)/t.value;++sd&&(d=s),g=u*u*m,(f=Math.max(d/g,g/h))>p){u-=s;break}p=f}_.push(a={value:u,dice:c1?e:1)},n}(oc),cc=function(){var t=sc,e=!1,n=1,i=1,r=[0],o=zs,a=zs,s=zs,c=zs,l=zs;function u(t){return t.x0=t.y0=0,t.x1=n,t.y1=i,t.eachBefore(h),r=[0],e&&t.eachBefore(Hs),t}function h(e){var n=r[e.depth],i=e.x0+n,u=e.y0+n,h=e.x1-n,d=e.y1-n;h=n-1){var u=s[e];return u.x0=r,u.y0=o,u.x1=a,void(u.y1=c)}var h=l[e],d=i/2+h,f=e+1,p=n-1;for(;f>>1;l[m]c-o){var v=(r*_+a*g)/i;t(e,f,g,r,o,v,c),t(f,n,_,v,o,a,c)}else{var b=(o*_+c*g)/i;t(e,f,g,r,o,a,b),t(f,n,_,r,b,a,c)}}(0,c,t.value,e,n,i,r)},uc=function(t,e,n,i,r){(1&t.depth?rc:qs)(t,e,n,i,r)},hc=function t(e){function n(t,n,i,r,o){if((a=t._squarify)&&a.ratio===e)for(var a,s,c,l,u,h=-1,d=a.length,f=t.value;++h1?e:1)},n}(oc),dc=function(t){for(var e,n=-1,i=t.length,r=t[i-1],o=0;++n1&&pc(t[n[i-2]],t[n[i-1]],t[r])<=0;)--i;n[i++]=r}return n.slice(0,i)}var _c=function(t){if((n=t.length)<3)return null;var e,n,i=new Array(n),r=new Array(n);for(e=0;e=0;--e)l.push(t[i[o[e]][2]]);for(e=+s;es!=l>s&&a<(c-n)*(s-i)/(l-i)+n&&(u=!u),c=n,l=i;return u},bc=function(t){for(var e,n,i=-1,r=t.length,o=t[r-1],a=o[0],s=o[1],c=0;++i1);return t+n*o*Math.sqrt(-2*Math.log(r)/r)}}return n.source=t,n}(yc),Mc=function t(e){function n(){var t=wc.source(e).apply(this,arguments);return function(){return Math.exp(t())}}return n.source=t,n}(yc),Ec=function t(e){function n(t){return function(){for(var n=0,i=0;i1)&&(t-=Math.floor(t));var e=Math.abs(t-.5);return Hl.h=360*t-100,Hl.s=1.5-1.5*e,Hl.l=.8-.9*e,Hl+""},Gl=Object(Pt.h)(),Wl=Math.PI/3,Vl=2*Math.PI/3,Xl=function(t){var e;return t=(.5-t)*Math.PI,Gl.r=255*(e=Math.sin(t))*e,Gl.g=255*(e=Math.sin(t+Wl))*e,Gl.b=255*(e=Math.sin(t+Vl))*e,Gl+""};function Yl(t){var e=t.length;return function(n){return t[Math.max(0,Math.min(e-1,Math.floor(n*e)))]}}var Kl=Yl(kc("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725")),Zl=Yl(kc("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf")),Jl=Yl(kc("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4")),Ql=Yl(kc("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921")),$l=function(t){return function(){return t}},tu=Math.abs,eu=Math.atan2,nu=Math.cos,iu=Math.max,ru=Math.min,ou=Math.sin,au=Math.sqrt,su=1e-12,cu=Math.PI,lu=cu/2,uu=2*cu;function hu(t){return t>=1?lu:t<=-1?-lu:Math.asin(t)}function du(t){return t.innerRadius}function fu(t){return t.outerRadius}function pu(t){return t.startAngle}function mu(t){return t.endAngle}function gu(t){return t&&t.padAngle}function _u(t,e,n,i,r,o,a){var s=t-n,c=e-i,l=(a?o:-o)/au(s*s+c*c),u=l*c,h=-l*s,d=t+u,f=e+h,p=n+u,m=i+h,g=(d+p)/2,_=(f+m)/2,v=p-d,b=m-f,y=v*v+b*b,x=r-o,w=d*m-p*f,M=(b<0?-1:1)*au(iu(0,x*x*y-w*w)),E=(w*b-v*M)/y,S=(-w*v-b*M)/y,A=(w*b+v*M)/y,T=(-w*v+b*M)/y,k=E-g,P=S-_,L=A-g,O=T-_;return k*k+P*P>L*L+O*O&&(E=A,S=T),{cx:E,cy:S,x01:-u,y01:-h,x11:E*(r/x-1),y11:S*(r/x-1)}}var vu=function(){var t=du,e=fu,n=$l(0),i=null,r=pu,o=mu,a=gu,s=null;function c(){var c,l,u,h=+t.apply(this,arguments),d=+e.apply(this,arguments),f=r.apply(this,arguments)-lu,p=o.apply(this,arguments)-lu,m=tu(p-f),g=p>f;if(s||(s=c=xt()),dsu)if(m>uu-su)s.moveTo(d*nu(f),d*ou(f)),s.arc(0,0,d,f,p,!g),h>su&&(s.moveTo(h*nu(p),h*ou(p)),s.arc(0,0,h,p,f,g));else{var _,v,b=f,y=p,x=f,w=p,M=m,E=m,S=a.apply(this,arguments)/2,A=S>su&&(i?+i.apply(this,arguments):au(h*h+d*d)),T=ru(tu(d-h)/2,+n.apply(this,arguments)),k=T,P=T;if(A>su){var L=hu(A/h*ou(S)),O=hu(A/d*ou(S));(M-=2*L)>su?(x+=L*=g?1:-1,w-=L):(M=0,x=w=(f+p)/2),(E-=2*O)>su?(b+=O*=g?1:-1,y-=O):(E=0,b=y=(f+p)/2)}var C=d*nu(b),R=d*ou(b),I=h*nu(w),z=h*ou(w);if(T>su){var B,N=d*nu(y),D=d*ou(y),j=h*nu(x),U=h*ou(x);if(m1?0:u<-1?cu:Math.acos(u))/2),V=au(B[0]*B[0]+B[1]*B[1]);k=ru(T,(h-V)/(W-1)),P=ru(T,(d-V)/(W+1))}}E>su?P>su?(_=_u(j,U,C,R,d,P,g),v=_u(N,D,I,z,d,P,g),s.moveTo(_.cx+_.x01,_.cy+_.y01),Psu&&M>su?k>su?(_=_u(I,z,N,D,h,-k,g),v=_u(C,R,j,U,h,-k,g),s.lineTo(_.cx+_.x01,_.cy+_.y01),k=u;--h)s.point(g[h],_[h]);s.lineEnd(),s.areaEnd()}m&&(g[l]=+t(d,l,c),_[l]=+n(d,l,c),s.point(e?+e(d,l,c):g[l],i?+i(d,l,c):_[l]))}if(f)return s=null,f+""||null}function l(){return Mu().defined(r).curve(a).context(o)}return c.x=function(n){return arguments.length?(t="function"==typeof n?n:$l(+n),e=null,c):t},c.x0=function(e){return arguments.length?(t="function"==typeof e?e:$l(+e),c):t},c.x1=function(t){return arguments.length?(e=null==t?null:"function"==typeof t?t:$l(+t),c):e},c.y=function(t){return arguments.length?(n="function"==typeof t?t:$l(+t),i=null,c):n},c.y0=function(t){return arguments.length?(n="function"==typeof t?t:$l(+t),c):n},c.y1=function(t){return arguments.length?(i=null==t?null:"function"==typeof t?t:$l(+t),c):i},c.lineX0=c.lineY0=function(){return l().x(t).y(n)},c.lineY1=function(){return l().x(t).y(i)},c.lineX1=function(){return l().x(e).y(n)},c.defined=function(t){return arguments.length?(r="function"==typeof t?t:$l(!!t),c):r},c.curve=function(t){return arguments.length?(a=t,null!=o&&(s=a(o)),c):a},c.context=function(t){return arguments.length?(null==t?o=s=null:s=a(o=t),c):o},c},Su=function(t,e){return et?1:e>=t?0:NaN},Au=function(t){return t},Tu=function(){var t=Au,e=Su,n=null,i=$l(0),r=$l(uu),o=$l(0);function a(a){var s,c,l,u,h,d=a.length,f=0,p=new Array(d),m=new Array(d),g=+i.apply(this,arguments),_=Math.min(uu,Math.max(-uu,r.apply(this,arguments)-g)),v=Math.min(Math.abs(_)/d,o.apply(this,arguments)),b=v*(_<0?-1:1);for(s=0;s0&&(f+=h);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,l=f?(_-d*b)/f:0;s0?h*l:0)+b,m[c]={data:a[c],index:s,value:h,startAngle:g,endAngle:u,padAngle:v};return m}return a.value=function(e){return arguments.length?(t="function"==typeof e?e:$l(+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?(i="function"==typeof t?t:$l(+t),a):i},a.endAngle=function(t){return arguments.length?(r="function"==typeof t?t:$l(+t),a):r},a.padAngle=function(t){return arguments.length?(o="function"==typeof t?t:$l(+t),a):o},a},ku=Lu(yu);function Pu(t){this._curve=t}function Lu(t){function e(e){return new Pu(t(e))}return e._curve=t,e}function Ou(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(Lu(t)):e()._curve},t}Pu.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 Cu=function(){return Ou(Mu().curve(ku))},Ru=function(){var t=Eu().curve(ku),e=t.curve,n=t.lineX0,i=t.lineX1,r=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 Ou(n())},delete t.lineX0,t.lineEndAngle=function(){return Ou(i())},delete t.lineX1,t.lineInnerRadius=function(){return Ou(r())},delete t.lineY0,t.lineOuterRadius=function(){return Ou(o())},delete t.lineY1,t.curve=function(t){return arguments.length?e(Lu(t)):e()._curve},t},Iu=function(t,e){return[(e=+e)*Math.cos(t-=Math.PI/2),e*Math.sin(t)]},zu=Array.prototype.slice;function Bu(t){return t.source}function Nu(t){return t.target}function Du(t){var e=Bu,n=Nu,i=xu,r=wu,o=null;function a(){var a,s=zu.call(arguments),c=e.apply(this,s),l=n.apply(this,s);if(o||(o=a=xt()),t(o,+i.apply(this,(s[0]=c,s)),+r.apply(this,s),+i.apply(this,(s[0]=l,s)),+r.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?(i="function"==typeof t?t:$l(+t),a):i},a.y=function(t){return arguments.length?(r="function"==typeof t?t:$l(+t),a):r},a.context=function(t){return arguments.length?(o=null==t?null:t,a):o},a}function ju(t,e,n,i,r){t.moveTo(e,n),t.bezierCurveTo(e=(e+i)/2,n,e,r,i,r)}function Uu(t,e,n,i,r){t.moveTo(e,n),t.bezierCurveTo(e,n=(n+r)/2,i,n,i,r)}function Fu(t,e,n,i,r){var o=Iu(e,n),a=Iu(e,n=(n+r)/2),s=Iu(i,n),c=Iu(i,r);t.moveTo(o[0],o[1]),t.bezierCurveTo(a[0],a[1],s[0],s[1],c[0],c[1])}function Hu(){return Du(ju)}function qu(){return Du(Uu)}function Gu(){var t=Du(Fu);return t.angle=t.x,delete t.x,t.radius=t.y,delete t.y,t}var Wu={draw:function(t,e){var n=Math.sqrt(e/cu);t.moveTo(n,0),t.arc(0,0,n,0,uu)}},Vu={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()}},Xu=Math.sqrt(1/3),Yu=2*Xu,Ku={draw:function(t,e){var n=Math.sqrt(e/Yu),i=n*Xu;t.moveTo(0,-n),t.lineTo(i,0),t.lineTo(0,n),t.lineTo(-i,0),t.closePath()}},Zu=Math.sin(cu/10)/Math.sin(7*cu/10),Ju=Math.sin(uu/10)*Zu,Qu=-Math.cos(uu/10)*Zu,$u={draw:function(t,e){var n=Math.sqrt(.8908130915292852*e),i=Ju*n,r=Qu*n;t.moveTo(0,-n),t.lineTo(i,r);for(var o=1;o<5;++o){var a=uu*o/5,s=Math.cos(a),c=Math.sin(a);t.lineTo(c*n,-s*n),t.lineTo(s*i-c*r,c*i+s*r)}t.closePath()}},th={draw:function(t,e){var n=Math.sqrt(e),i=-n/2;t.rect(i,i,n,n)}},eh=Math.sqrt(3),nh={draw:function(t,e){var n=-Math.sqrt(e/(3*eh));t.moveTo(0,2*n),t.lineTo(-eh*n,-n),t.lineTo(eh*n,-n),t.closePath()}},ih=Math.sqrt(3)/2,rh=1/Math.sqrt(12),oh=3*(rh/2+1),ah={draw:function(t,e){var n=Math.sqrt(e/oh),i=n/2,r=n*rh,o=i,a=n*rh+n,s=-o,c=a;t.moveTo(i,r),t.lineTo(o,a),t.lineTo(s,c),t.lineTo(-.5*i-ih*r,ih*i+-.5*r),t.lineTo(-.5*o-ih*a,ih*o+-.5*a),t.lineTo(-.5*s-ih*c,ih*s+-.5*c),t.lineTo(-.5*i+ih*r,-.5*r-ih*i),t.lineTo(-.5*o+ih*a,-.5*a-ih*o),t.lineTo(-.5*s+ih*c,-.5*c-ih*s),t.closePath()}},sh=[Wu,Vu,Ku,th,$u,nh,ah],ch=function(){var t=$l(Wu),e=$l(64),n=null;function i(){var i;if(n||(n=i=xt()),t.apply(this,arguments).draw(n,+e.apply(this,arguments)),i)return n=null,i+""||null}return i.type=function(e){return arguments.length?(t="function"==typeof e?e:$l(e),i):t},i.size=function(t){return arguments.length?(e="function"==typeof t?t:$l(+t),i):e},i.context=function(t){return arguments.length?(n=null==t?null:t,i):n},i},lh=function(){};function uh(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 hh(t){this._context=t}hh.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:uh(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:uh(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};var dh=function(t){return new hh(t)};function fh(t){this._context=t}fh.prototype={areaStart:lh,areaEnd:lh,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:uh(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};var ph=function(t){return new fh(t)};function mh(t){this._context=t}mh.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,i=(this._y0+4*this._y1+e)/6;this._line?this._context.lineTo(n,i):this._context.moveTo(n,i);break;case 3:this._point=4;default:uh(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};var gh=function(t){return new mh(t)};function _h(t,e){this._basis=new hh(t),this._beta=e}_h.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 i,r=t[0],o=e[0],a=t[n]-r,s=e[n]-o,c=-1;++c<=n;)i=c/n,this._basis.point(this._beta*t[c]+(1-this._beta)*(r+i*a),this._beta*e[c]+(1-this._beta)*(o+i*s));this._x=this._y=null,this._basis.lineEnd()},point:function(t,e){this._x.push(+t),this._y.push(+e)}};var vh=function t(e){function n(t){return 1===e?new hh(t):new _h(t,e)}return n.beta=function(e){return t(+e)},n}(.85);function bh(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 yh(t,e){this._context=t,this._k=(1-e)/6}yh.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:bh(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:bh(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 xh=function t(e){function n(t){return new yh(t,e)}return n.tension=function(e){return t(+e)},n}(0);function wh(t,e){this._context=t,this._k=(1-e)/6}wh.prototype={areaStart:lh,areaEnd:lh,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:bh(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 Mh=function t(e){function n(t){return new wh(t,e)}return n.tension=function(e){return t(+e)},n}(0);function Eh(t,e){this._context=t,this._k=(1-e)/6}Eh.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:bh(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 Sh=function t(e){function n(t){return new Eh(t,e)}return n.tension=function(e){return t(+e)},n}(0);function Ah(t,e,n){var i=t._x1,r=t._y1,o=t._x2,a=t._y2;if(t._l01_a>su){var s=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,c=3*t._l01_a*(t._l01_a+t._l12_a);i=(i*s-t._x0*t._l12_2a+t._x2*t._l01_2a)/c,r=(r*s-t._y0*t._l12_2a+t._y2*t._l01_2a)/c}if(t._l23_a>su){var l=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*l+t._x1*t._l23_2a-e*t._l12_2a)/u,a=(a*l+t._y1*t._l23_2a-n*t._l12_2a)/u}t._context.bezierCurveTo(i,r,o,a,t._x2,t._y2)}function Th(t,e){this._context=t,this._alpha=e}Th.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,i=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+i*i,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:Ah(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 kh=function t(e){function n(t){return e?new Th(t,e):new yh(t,0)}return n.alpha=function(e){return t(+e)},n}(.5);function Ph(t,e){this._context=t,this._alpha=e}Ph.prototype={areaStart:lh,areaEnd:lh,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,i=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+i*i,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:Ah(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 Lh=function t(e){function n(t){return e?new Ph(t,e):new wh(t,0)}return n.alpha=function(e){return t(+e)},n}(.5);function Oh(t,e){this._context=t,this._alpha=e}Oh.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,i=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+i*i,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:Ah(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 Ch=function t(e){function n(t){return e?new Oh(t,e):new Eh(t,0)}return n.alpha=function(e){return t(+e)},n}(.5);function Rh(t){this._context=t}Rh.prototype={areaStart:lh,areaEnd:lh,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(t,e){t=+t,e=+e,this._point?this._context.lineTo(t,e):(this._point=1,this._context.moveTo(t,e))}};var Ih=function(t){return new Rh(t)};function zh(t){return t<0?-1:1}function Bh(t,e,n){var i=t._x1-t._x0,r=e-t._x1,o=(t._y1-t._y0)/(i||r<0&&-0),a=(n-t._y1)/(r||i<0&&-0),s=(o*r+a*i)/(i+r);return(zh(o)+zh(a))*Math.min(Math.abs(o),Math.abs(a),.5*Math.abs(s))||0}function Nh(t,e){var n=t._x1-t._x0;return n?(3*(t._y1-t._y0)/n-e)/2:e}function Dh(t,e,n){var i=t._x0,r=t._y0,o=t._x1,a=t._y1,s=(o-i)/3;t._context.bezierCurveTo(i+s,r+s*e,o-s,a-s*n,o,a)}function jh(t){this._context=t}function Uh(t){this._context=new Fh(t)}function Fh(t){this._context=t}function Hh(t){return new jh(t)}function qh(t){return new Uh(t)}function Gh(t){this._context=t}function Wh(t){var e,n,i=t.length-1,r=new Array(i),o=new Array(i),a=new Array(i);for(r[0]=0,o[0]=2,a[0]=t[0]+2*t[1],e=1;e=0;--e)r[e]=(a[e]-r[e+1])/o[e];for(o[i-1]=(t[i]+r[i-1])/2,e=0;e=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 Yh=function(t){return new Xh(t,.5)};function Kh(t){return new Xh(t,0)}function Zh(t){return new Xh(t,1)}var Jh=function(t,e){if((r=t.length)>1)for(var n,i,r,o=1,a=t[e[0]],s=a.length;o=0;)n[e]=e;return n};function $h(t,e){return t[e]}var td=function(){var t=$l([]),e=Qh,n=Jh,i=$h;function r(r){var o,a,s=t.apply(this,arguments),c=r.length,l=s.length,u=new Array(l);for(o=0;o0){for(var n,i,r,o=0,a=t[0].length;o0)for(var n,i,r,o,a,s,c=0,l=t[e[0]].length;c=0?(i[0]=o,i[1]=o+=r):r<0?(i[1]=a,i[0]=a+=r):i[0]=o},id=function(t,e){if((n=t.length)>0){for(var n,i=0,r=t[e[0]],o=r.length;i0&&(i=(n=t[e[0]]).length)>0){for(var n,i,r,o=0,a=1;ao&&(o=e,i=n);return i}var sd=function(t){var e=t.map(cd);return Qh(t).sort(function(t,n){return e[t]-e[n]})};function cd(t){for(var e,n=0,i=-1,r=t.length;++i0)){if(o/=d,d<0){if(o0){if(o>h)return;o>u&&(u=o)}if(o=i-c,d||!(o<0)){if(o/=d,d<0){if(o>h)return;o>u&&(u=o)}else if(d>0){if(o0)){if(o/=f,f<0){if(o0){if(o>h)return;o>u&&(u=o)}if(o=r-l,f||!(o<0)){if(o/=f,f<0){if(o>h)return;o>u&&(u=o)}else if(f>0){if(o0||h<1)||(u>0&&(t[0]=[c+u*d,l+u*f]),h<1&&(t[1]=[c+h*d,l+h*f]),!0)}}}}}function Td(t,e,n,i,r){var o=t[1];if(o)return!0;var a,s,c=t[0],l=t.left,u=t.right,h=l[0],d=l[1],f=u[0],p=u[1],m=(h+f)/2,g=(d+p)/2;if(p===d){if(m=i)return;if(h>f){if(c){if(c[1]>=r)return}else c=[m,n];o=[m,r]}else{if(c){if(c[1]1)if(h>f){if(c){if(c[1]>=r)return}else c=[(n-s)/a,n];o=[(r-s)/a,r]}else{if(c){if(c[1]=i)return}else c=[e,a*e+s];o=[i,a*i+s]}else{if(c){if(c[0]=-Kd)){var f=c*c+l*l,p=u*u+h*h,m=(h*f-l*p)/d,g=(c*p-u*f)/d,_=Cd.pop()||new Rd;_.arc=t,_.site=r,_.x=m+a,_.y=(_.cy=g+s)+Math.sqrt(m*m+g*g),t.circle=_;for(var v=null,b=Vd._;b;)if(_.yYd)s=s.L;else{if(!((r=o-qd(s,a))>Yd)){i>-Yd?(e=s.P,n=s):r>-Yd?(e=s,n=s.N):e=n=s;break}if(!s.R){e=s;break}s=s.R}!function(t){Wd[t.index]={site:t,halfedges:[]}}(t);var c=Dd(t);if(Gd.insert(e,c),e||n){if(e===n)return zd(e),n=Dd(e.site),Gd.insert(c,n),c.edge=n.edge=Md(e.site,c.site),Id(e),void Id(n);if(n){zd(e),zd(n);var l=e.site,u=l[0],h=l[1],d=t[0]-u,f=t[1]-h,p=n.site,m=p[0]-u,g=p[1]-h,_=2*(d*g-f*m),v=d*d+f*f,b=m*m+g*g,y=[(g*v-f*b)/_+u,(d*b-m*v)/_+h];Sd(n.edge,l,p,y),c.edge=Md(l,t,null,y),n.edge=Md(t,p,null,y),Id(e),Id(n)}else c.edge=Md(e.site,c.site)}}function Hd(t,e){var n=t.site,i=n[0],r=n[1],o=r-e;if(!o)return i;var a=t.P;if(!a)return-1/0;var s=(n=a.site)[0],c=n[1],l=c-e;if(!l)return s;var u=s-i,h=1/o-1/l,d=u/l;return h?(-d+Math.sqrt(d*d-2*h*(u*u/(-2*l)-c+l/2+r-o/2)))/h+i:(i+s)/2}function qd(t,e){var n=t.N;if(n)return Hd(n,e);var i=t.site;return i[1]===e?i[0]:1/0}var Gd,Wd,Vd,Xd,Yd=1e-6,Kd=1e-12;function Zd(t,e){return e[1]-t[1]||e[0]-t[0]}function Jd(t,e){var n,i,r,o=t.sort(Zd).pop();for(Xd=[],Wd=new Array(t.length),Gd=new wd,Vd=new wd;;)if(r=Od,o&&(!r||o[1]Yd||Math.abs(r[0][1]-r[1][1])>Yd)||delete Xd[o]}(a,s,c,l),function(t,e,n,i){var r,o,a,s,c,l,u,h,d,f,p,m,g=Wd.length,_=!0;for(r=0;rYd||Math.abs(m-d)>Yd)&&(c.splice(s,0,Xd.push(Ed(a,f,Math.abs(p-t)Yd?[t,Math.abs(h-t)Yd?[Math.abs(d-i)Yd?[n,Math.abs(h-n)Yd?[Math.abs(d-e)=s)return null;var c=t-r.site[0],l=e-r.site[1],u=c*c+l*l;do{r=o.cells[i=a],a=null,r.halfedges.forEach(function(n){var i=o.edges[n],s=i.left;if(s!==r.site&&s||(s=i.right)){var c=t-s[0],l=e-s[1],h=c*c+l*l;hi?(i+r)/2:Math.min(0,i)||Math.max(0,r),a>o?(o+a)/2:Math.min(0,o)||Math.max(0,a))}var ff=function(){var t,e,n=sf,i=cf,r=df,o=uf,a=hf,s=[0,1/0],c=[[-1/0,-1/0],[1/0,1/0]],l=250,u=C.x,h=[],d=Object(b.a)("start","zoom","end"),f=500,p=150,m=0;function g(t){t.property("__zoom",lf).on("wheel.zoom",T).on("mousedown.zoom",k).on("dblclick.zoom",P).filter(a).on("touchstart.zoom",L).on("touchmove.zoom",O).on("touchend.zoom touchcancel.zoom",I).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function _(t,e){return(e=Math.max(s[0],Math.min(s[1],e)))===t.k?t:new ef(e,t.x,t.y)}function v(t,e,n){var i=e[0]-n[0]*t.k,r=e[1]-n[1]*t.k;return i===t.x&&r===t.y?t:new ef(t.k,i,r)}function x(t){return[(+t[0][0]+ +t[1][0])/2,(+t[0][1]+ +t[1][1])/2]}function w(t,e,n){t.on("start.zoom",function(){S(this,arguments).start()}).on("interrupt.zoom end.zoom",function(){S(this,arguments).end()}).tween("zoom",function(){var t=this,r=arguments,o=S(t,r),a=i.apply(t,r),s=n||x(a),c=Math.max(a[1][0]-a[0][0],a[1][1]-a[0][1]),l=t.__zoom,h="function"==typeof e?e.apply(t,r):e,d=u(l.invert(s).concat(c/l.k),h.invert(s).concat(c/h.k));return function(t){if(1===t)t=h;else{var e=d(t),n=c/e[2];t=new ef(n,s[0]-e[0]*n,s[1]-e[1]*n)}o.zoom(null,t)}})}function S(t,e){for(var n,i=0,r=h.length;im}t.zoom("mouse",r(v(t.that.__zoom,t.mouse[0]=Object(y.mouse)(t.that),t.mouse[1]),t.extent,c))},!0).on("mouseup.zoom",function(){i.on("mousemove.zoom mouseup.zoom",null),E(y.event.view,t.moved),af(),t.end()},!0),o=Object(y.mouse)(this),a=y.event.clientX,s=y.event.clientY;M(y.event.view),of(),t.mouse=[o,this.__zoom.invert(o)],Object(R.b)(this),t.start()}}function P(){if(n.apply(this,arguments)){var t=this.__zoom,e=Object(y.mouse)(this),o=t.invert(e),a=t.k*(y.event.shiftKey?.5:2),s=r(v(_(t,a),e,o),i.apply(this,arguments),c);af(),l>0?Object(y.select)(this).transition().duration(l).call(w,s,e):Object(y.select)(this).call(g.transform,s)}}function L(){if(n.apply(this,arguments)){var e,i,r,o,a=S(this,arguments),s=y.event.changedTouches,c=s.length;for(of(),i=0;i0))return a;do{a.push(o=new Date(+n)),e(n,r),t(n)}while(o=e)for(;t(e),!n(e);)e.setTime(e-1)},function(t,i){if(t>=t)if(i<0)for(;++i<=0;)for(;e(t,-1),!n(t););else for(;--i>=0;)for(;e(t,1),!n(t););})},n&&(s.count=function(e,o){return i.setTime(+e),r.setTime(+o),t(i),t(r),Math.floor(n(i,r))},s.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?s.filter(a?function(e){return a(e)%t==0}:function(e){return s.count(0,e)%t==0}):s:null}),s}var a=o(function(){},function(t,e){t.setTime(+t+e)},function(t,e){return e-t});a.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?o(function(e){e.setTime(Math.floor(e/t)*t)},function(e,n){e.setTime(+e+n*t)},function(e,n){return(n-e)/t}):a:null};var s=a,c=a.range,l=6e4,u=6048e5,h=o(function(t){t.setTime(t-t.getMilliseconds())},function(t,e){t.setTime(+t+1e3*e)},function(t,e){return(e-t)/1e3},function(t){return t.getUTCSeconds()}),d=h,f=h.range,p=o(function(t){t.setTime(t-t.getMilliseconds()-1e3*t.getSeconds())},function(t,e){t.setTime(+t+e*l)},function(t,e){return(e-t)/l},function(t){return t.getMinutes()}),m=p,g=p.range,_=o(function(t){t.setTime(t-t.getMilliseconds()-1e3*t.getSeconds()-t.getMinutes()*l)},function(t,e){t.setTime(+t+36e5*e)},function(t,e){return(e-t)/36e5},function(t){return t.getHours()}),v=_,b=_.range,y=o(function(t){t.setHours(0,0,0,0)},function(t,e){t.setDate(t.getDate()+e)},function(t,e){return(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*l)/864e5},function(t){return t.getDate()-1}),x=y,w=y.range;function M(t){return o(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())*l)/u})}var E=M(0),S=M(1),A=M(2),T=M(3),k=M(4),P=M(5),L=M(6),O=E.range,C=S.range,R=A.range,I=T.range,z=k.range,B=P.range,N=L.range,D=o(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()}),j=D,U=D.range,F=o(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()});F.every=function(t){return isFinite(t=Math.floor(t))&&t>0?o(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 H=F,q=F.range,G=o(function(t){t.setUTCSeconds(0,0)},function(t,e){t.setTime(+t+e*l)},function(t,e){return(e-t)/l},function(t){return t.getUTCMinutes()}),W=G,V=G.range,X=o(function(t){t.setUTCMinutes(0,0,0)},function(t,e){t.setTime(+t+36e5*e)},function(t,e){return(e-t)/36e5},function(t){return t.getUTCHours()}),Y=X,K=X.range,Z=o(function(t){t.setUTCHours(0,0,0,0)},function(t,e){t.setUTCDate(t.getUTCDate()+e)},function(t,e){return(e-t)/864e5},function(t){return t.getUTCDate()-1}),J=Z,Q=Z.range;function $(t){return o(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)/u})}var tt=$(0),et=$(1),nt=$(2),it=$(3),rt=$(4),ot=$(5),at=$(6),st=tt.range,ct=et.range,lt=nt.range,ut=it.range,ht=rt.range,dt=ot.range,ft=at.range,pt=o(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()}),mt=pt,gt=pt.range,_t=o(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()});_t.every=function(t){return isFinite(t=Math.floor(t))&&t>0?o(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 vt=_t,bt=_t.range;n.d(e,"g",function(){return o}),n.d(e,"h",function(){return s}),n.d(e,"i",function(){return c}),n.d(e,"L",function(){return s}),n.d(e,"M",function(){return c}),n.d(e,"r",function(){return d}),n.d(e,"s",function(){return f}),n.d(e,"V",function(){return d}),n.d(e,"W",function(){return f}),n.d(e,"j",function(){return m}),n.d(e,"k",function(){return g}),n.d(e,"e",function(){return v}),n.d(e,"f",function(){return b}),n.d(e,"a",function(){return x}),n.d(e,"b",function(){return w}),n.d(e,"B",function(){return E}),n.d(e,"C",function(){return O}),n.d(e,"t",function(){return E}),n.d(e,"u",function(){return O}),n.d(e,"l",function(){return S}),n.d(e,"m",function(){return C}),n.d(e,"x",function(){return A}),n.d(e,"y",function(){return R}),n.d(e,"z",function(){return T}),n.d(e,"A",function(){return I}),n.d(e,"v",function(){return k}),n.d(e,"w",function(){return z}),n.d(e,"c",function(){return P}),n.d(e,"d",function(){return B}),n.d(e,"p",function(){return L}),n.d(e,"q",function(){return N}),n.d(e,"n",function(){return j}),n.d(e,"o",function(){return U}),n.d(e,"D",function(){return H}),n.d(e,"E",function(){return q}),n.d(e,"N",function(){return W}),n.d(e,"O",function(){return V}),n.d(e,"J",function(){return Y}),n.d(e,"K",function(){return K}),n.d(e,"F",function(){return J}),n.d(e,"G",function(){return Q}),n.d(e,"fb",function(){return tt}),n.d(e,"gb",function(){return st}),n.d(e,"X",function(){return tt}),n.d(e,"Y",function(){return st}),n.d(e,"P",function(){return et}),n.d(e,"Q",function(){return ct}),n.d(e,"bb",function(){return nt}),n.d(e,"cb",function(){return lt}),n.d(e,"db",function(){return it}),n.d(e,"eb",function(){return ut}),n.d(e,"Z",function(){return rt}),n.d(e,"ab",function(){return ht}),n.d(e,"H",function(){return ot}),n.d(e,"I",function(){return dt}),n.d(e,"T",function(){return at}),n.d(e,"U",function(){return ft}),n.d(e,"R",function(){return mt}),n.d(e,"S",function(){return gt}),n.d(e,"hb",function(){return vt}),n.d(e,"ib",function(){return bt})},function(t,e){"function"==typeof Object.create?t.exports=function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:t.exports=function(t,e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}},function(t,e,n){var i=n(15),r=i.Buffer;function o(t,e){for(var n in t)e[n]=t[n]}function a(t,e,n){return r(t,e,n)}r.from&&r.alloc&&r.allocUnsafe&&r.allocUnsafeSlow?t.exports=i:(o(i,e),e.Buffer=a),o(r,a),a.from=function(t,e,n){if("number"==typeof t)throw new TypeError("Argument must not be a number");return r(t,e,n)},a.alloc=function(t,e,n){if("number"!=typeof t)throw new TypeError("Argument must be a number");var i=r(t);return void 0!==e?"string"==typeof n?i.fill(e,n):i.fill(e):i.fill(0),i},a.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return r(t)},a.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return i.SlowBuffer(t)}},function(t,e,n){(function(t,n){var i;!function(){var r="object"==typeof self&&self.self===self&&self||"object"==typeof t&&t.global===t&&t||this||{},o=r._,a=Array.prototype,s=Object.prototype,c="undefined"!=typeof Symbol?Symbol.prototype:null,l=a.push,u=a.slice,h=s.toString,d=s.hasOwnProperty,f=Array.isArray,p=Object.keys,m=Object.create,g=function(){},_=function(t){return t instanceof _?t:this instanceof _?void(this._wrapped=t):new _(t)};e.nodeType?r._=_:(!n.nodeType&&n.exports&&(e=n.exports=_),e._=_),_.VERSION="1.9.1";var v,b=function(t,e,n){if(void 0===e)return t;switch(null==n?3:n){case 1:return function(n){return t.call(e,n)};case 3:return function(n,i,r){return t.call(e,n,i,r)};case 4:return function(n,i,r,o){return t.call(e,n,i,r,o)}}return function(){return t.apply(e,arguments)}},y=function(t,e,n){return _.iteratee!==v?_.iteratee(t,e):null==t?_.identity:_.isFunction(t)?b(t,e,n):_.isObject(t)&&!_.isArray(t)?_.matcher(t):_.property(t)};_.iteratee=v=function(t,e){return y(t,e,1/0)};var x=function(t,e){return e=null==e?t.length-1:+e,function(){for(var n=Math.max(arguments.length-e,0),i=Array(n),r=0;r=0&&e<=A};_.each=_.forEach=function(t,e,n){var i,r;if(e=b(e,n),k(t))for(i=0,r=t.length;i0?0:a-1;for(r||(i=e[o?o[s]:s],s+=t);s>=0&&s=3;return e(t,b(n,r,4),i,o)}};_.reduce=_.foldl=_.inject=P(1),_.reduceRight=_.foldr=P(-1),_.find=_.detect=function(t,e,n){var i=(k(t)?_.findIndex:_.findKey)(t,e,n);if(void 0!==i&&-1!==i)return t[i]},_.filter=_.select=function(t,e,n){var i=[];return e=y(e,n),_.each(t,function(t,n,r){e(t,n,r)&&i.push(t)}),i},_.reject=function(t,e,n){return _.filter(t,_.negate(y(e)),n)},_.every=_.all=function(t,e,n){e=y(e,n);for(var i=!k(t)&&_.keys(t),r=(i||t).length,o=0;o=0},_.invoke=x(function(t,e,n){var i,r;return _.isFunction(e)?r=e:_.isArray(e)&&(i=e.slice(0,-1),e=e[e.length-1]),_.map(t,function(t){var o=r;if(!o){if(i&&i.length&&(t=S(t,i)),null==t)return;o=t[e]}return null==o?o:o.apply(t,n)})}),_.pluck=function(t,e){return _.map(t,_.property(e))},_.where=function(t,e){return _.filter(t,_.matcher(e))},_.findWhere=function(t,e){return _.find(t,_.matcher(e))},_.max=function(t,e,n){var i,r,o=-1/0,a=-1/0;if(null==e||"number"==typeof e&&"object"!=typeof t[0]&&null!=t)for(var s=0,c=(t=k(t)?t:_.values(t)).length;so&&(o=i);else e=y(e,n),_.each(t,function(t,n,i){((r=e(t,n,i))>a||r===-1/0&&o===-1/0)&&(o=t,a=r)});return o},_.min=function(t,e,n){var i,r,o=1/0,a=1/0;if(null==e||"number"==typeof e&&"object"!=typeof t[0]&&null!=t)for(var s=0,c=(t=k(t)?t:_.values(t)).length;si||void 0===n)return 1;if(n0?0:r-1;o>=0&&o0?a=o>=0?o:Math.max(o+s,a):s=o>=0?Math.min(o+1,s):o+s+1;else if(n&&o&&s)return i[o=n(i,r)]===r?o:-1;if(r!=r)return(o=e(u.call(i,a,s),_.isNaN))>=0?o+a:-1;for(o=t>0?a:s-1;o>=0&&oe?(i&&(clearTimeout(i),i=null),s=l,a=t.apply(r,o),i||(r=o=null)):i||!1===n.trailing||(i=setTimeout(c,u)),a};return l.cancel=function(){clearTimeout(i),s=0,i=r=o=null},l},_.debounce=function(t,e,n){var i,r,o=function(e,n){i=null,n&&(r=t.apply(e,n))},a=x(function(a){if(i&&clearTimeout(i),n){var s=!i;i=setTimeout(o,e),s&&(r=t.apply(this,a))}else i=_.delay(o,e,this,a);return r});return a.cancel=function(){clearTimeout(i),i=null},a},_.wrap=function(t,e){return _.partial(e,t)},_.negate=function(t){return function(){return!t.apply(this,arguments)}},_.compose=function(){var t=arguments,e=t.length-1;return function(){for(var n=e,i=t[e].apply(this,arguments);n--;)i=t[n].call(this,i);return i}},_.after=function(t,e){return function(){if(--t<1)return e.apply(this,arguments)}},_.before=function(t,e){var n;return function(){return--t>0&&(n=e.apply(this,arguments)),t<=1&&(e=null),n}},_.once=_.partial(_.before,2),_.restArguments=x;var B=!{toString:null}.propertyIsEnumerable("toString"),N=["valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"],D=function(t,e){var n=N.length,i=t.constructor,r=_.isFunction(i)&&i.prototype||s,o="constructor";for(E(t,o)&&!_.contains(e,o)&&e.push(o);n--;)(o=N[n])in t&&t[o]!==r[o]&&!_.contains(e,o)&&e.push(o)};_.keys=function(t){if(!_.isObject(t))return[];if(p)return p(t);var e=[];for(var n in t)E(t,n)&&e.push(n);return B&&D(t,e),e},_.allKeys=function(t){if(!_.isObject(t))return[];var e=[];for(var n in t)e.push(n);return B&&D(t,e),e},_.values=function(t){for(var e=_.keys(t),n=e.length,i=Array(n),r=0;r1&&(i=b(i,e[1])),e=_.allKeys(t)):(i=H,e=C(e,!1,!1),t=Object(t));for(var r=0,o=e.length;r1&&(n=e[1])):(e=_.map(C(e,!1,!1),String),i=function(t,n){return!_.contains(e,n)}),_.pick(t,i,n)}),_.defaults=j(_.allKeys,!0),_.create=function(t,e){var n=w(t);return e&&_.extendOwn(n,e),n},_.clone=function(t){return _.isObject(t)?_.isArray(t)?t.slice():_.extend({},t):t},_.tap=function(t,e){return e(t),t},_.isMatch=function(t,e){var n=_.keys(e),i=n.length;if(null==t)return!i;for(var r=Object(t),o=0;o":">",'"':""","'":"'","`":"`"},W=_.invert(G),V=function(t){var e=function(e){return t[e]},n="(?:"+_.keys(t).join("|")+")",i=RegExp(n),r=RegExp(n,"g");return function(t){return t=null==t?"":""+t,i.test(t)?t.replace(r,e):t}};_.escape=V(G),_.unescape=V(W),_.result=function(t,e,n){_.isArray(e)||(e=[e]);var i=e.length;if(!i)return _.isFunction(n)?n.call(t):n;for(var r=0;r/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var Y=/(.)^/,K={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},Z=/\\|'|\r|\n|\u2028|\u2029/g,J=function(t){return"\\"+K[t]};_.template=function(t,e,n){!e&&n&&(e=n),e=_.defaults({},e,_.templateSettings);var i,r=RegExp([(e.escape||Y).source,(e.interpolate||Y).source,(e.evaluate||Y).source].join("|")+"|$","g"),o=0,a="__p+='";t.replace(r,function(e,n,i,r,s){return a+=t.slice(o,s).replace(Z,J),o=s+e.length,n?a+="'+\n((__t=("+n+"))==null?'':_.escape(__t))+\n'":i?a+="'+\n((__t=("+i+"))==null?'':__t)+\n'":r&&(a+="';\n"+r+"\n__p+='"),e}),a+="';\n",e.variable||(a="with(obj||{}){\n"+a+"}\n"),a="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+a+"return __p;\n";try{i=new Function(e.variable||"obj","_",a)}catch(t){throw t.source=a,t}var s=function(t){return i.call(this,t,_)},c=e.variable||"obj";return s.source="function("+c+"){\n"+a+"}",s},_.chain=function(t){var e=_(t);return e._chain=!0,e};var Q=function(t,e){return t._chain?_(e).chain():e};_.mixin=function(t){return _.each(_.functions(t),function(e){var n=_[e]=t[e];_.prototype[e]=function(){var t=[this._wrapped];return l.apply(t,arguments),Q(this,n.apply(_,t))}}),_},_.mixin(_),_.each(["pop","push","reverse","shift","sort","splice","unshift"],function(t){var e=a[t];_.prototype[t]=function(){var n=this._wrapped;return e.apply(n,arguments),"shift"!==t&&"splice"!==t||0!==n.length||delete n[0],Q(this,n)}}),_.each(["concat","join","slice"],function(t){var e=a[t];_.prototype[t]=function(){return Q(this,e.apply(this._wrapped,arguments))}}),_.prototype.value=function(){return this._wrapped},_.prototype.valueOf=_.prototype.toJSON=_.prototype.value,_.prototype.toString=function(){return String(this._wrapped)},void 0===(i=function(){return _}.apply(e,[]))||(n.exports=i)}()}).call(this,n(25),n(90)(t))},function(t,e,n){"use strict";var i=function(t,e,n){t.prototype=e.prototype=n,n.constructor=t};function r(t,e){var n=Object.create(t.prototype);for(var i in e)n[i]=e[i];return n}function o(){}var a="\\s*([+-]?\\d+)\\s*",s="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",c="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",l=/^#([0-9a-f]{3})$/,u=/^#([0-9a-f]{6})$/,h=new RegExp("^rgb\\("+[a,a,a]+"\\)$"),d=new RegExp("^rgb\\("+[c,c,c]+"\\)$"),f=new RegExp("^rgba\\("+[a,a,a,s]+"\\)$"),p=new RegExp("^rgba\\("+[c,c,c,s]+"\\)$"),m=new RegExp("^hsl\\("+[s,c,c]+"\\)$"),g=new RegExp("^hsla\\("+[s,c,c,s]+"\\)$"),_={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 v(t){var e;return t=(t+"").trim().toLowerCase(),(e=l.exec(t))?new M((e=parseInt(e[1],16))>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):(e=u.exec(t))?b(parseInt(e[1],16)):(e=h.exec(t))?new M(e[1],e[2],e[3],1):(e=d.exec(t))?new M(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=f.exec(t))?y(e[1],e[2],e[3],e[4]):(e=p.exec(t))?y(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=m.exec(t))?S(e[1],e[2]/100,e[3]/100,1):(e=g.exec(t))?S(e[1],e[2]/100,e[3]/100,e[4]):_.hasOwnProperty(t)?b(_[t]):"transparent"===t?new M(NaN,NaN,NaN,0):null}function b(t){return new M(t>>16&255,t>>8&255,255&t,1)}function y(t,e,n,i){return i<=0&&(t=e=n=NaN),new M(t,e,n,i)}function x(t){return t instanceof o||(t=v(t)),t?new M((t=t.rgb()).r,t.g,t.b,t.opacity):new M}function w(t,e,n,i){return 1===arguments.length?x(t):new M(t,e,n,null==i?1:i)}function M(t,e,n,i){this.r=+t,this.g=+e,this.b=+n,this.opacity=+i}function E(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function S(t,e,n,i){return i<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new T(t,e,n,i)}function A(t,e,n,i){return 1===arguments.length?function(t){if(t instanceof T)return new T(t.h,t.s,t.l,t.opacity);if(t instanceof o||(t=v(t)),!t)return new T;if(t instanceof T)return t;var e=(t=t.rgb()).r/255,n=t.g/255,i=t.b/255,r=Math.min(e,n,i),a=Math.max(e,n,i),s=NaN,c=a-r,l=(a+r)/2;return c?(s=e===a?(n-i)/c+6*(n0&&l<1?0:s,new T(s,c,l,t.opacity)}(t):new T(t,e,n,null==i?1:i)}function T(t,e,n,i){this.h=+t,this.s=+e,this.l=+n,this.opacity=+i}function k(t,e,n){return 255*(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)}i(o,v,{displayable:function(){return this.rgb().displayable()},hex:function(){return this.rgb().hex()},toString:function(){return this.rgb()+""}}),i(M,w,r(o,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new M(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new M(this.r*t,this.g*t,this.b*t,this.opacity)},rgb:function(){return this},displayable:function(){return 0<=this.r&&this.r<=255&&0<=this.g&&this.g<=255&&0<=this.b&&this.b<=255&&0<=this.opacity&&this.opacity<=1},hex:function(){return"#"+E(this.r)+E(this.g)+E(this.b)},toString:function(){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+")")}})),i(T,A,r(o,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new T(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new T(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,i=n+(n<.5?n:1-n)*e,r=2*n-i;return new M(k(t>=240?t-240:t+120,r,i),k(t,r,i),k(t<120?t+240:t-120,r,i),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}}));var P=Math.PI/180,L=180/Math.PI,O=.96422,C=1,R=.82521,I=4/29,z=6/29,B=3*z*z,N=z*z*z;function D(t){if(t instanceof F)return new F(t.l,t.a,t.b,t.opacity);if(t instanceof K){if(isNaN(t.h))return new F(t.l,0,0,t.opacity);var e=t.h*P;return new F(t.l,Math.cos(e)*t.c,Math.sin(e)*t.c,t.opacity)}t instanceof M||(t=x(t));var n,i,r=W(t.r),o=W(t.g),a=W(t.b),s=H((.2225045*r+.7168786*o+.0606169*a)/C);return r===o&&o===a?n=i=s:(n=H((.4360747*r+.3850649*o+.1430804*a)/O),i=H((.0139322*r+.0971045*o+.7141733*a)/R)),new F(116*s-16,500*(n-s),200*(s-i),t.opacity)}function j(t,e){return new F(t,0,0,null==e?1:e)}function U(t,e,n,i){return 1===arguments.length?D(t):new F(t,e,n,null==i?1:i)}function F(t,e,n,i){this.l=+t,this.a=+e,this.b=+n,this.opacity=+i}function H(t){return t>N?Math.pow(t,1/3):t/B+I}function q(t){return t>z?t*t*t:B*(t-I)}function G(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function W(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function V(t){if(t instanceof K)return new K(t.h,t.c,t.l,t.opacity);if(t instanceof F||(t=D(t)),0===t.a&&0===t.b)return new K(NaN,0,t.l,t.opacity);var e=Math.atan2(t.b,t.a)*L;return new K(e<0?e+360:e,Math.sqrt(t.a*t.a+t.b*t.b),t.l,t.opacity)}function X(t,e,n,i){return 1===arguments.length?V(t):new K(n,e,t,null==i?1:i)}function Y(t,e,n,i){return 1===arguments.length?V(t):new K(t,e,n,null==i?1:i)}function K(t,e,n,i){this.h=+t,this.c=+e,this.l=+n,this.opacity=+i}i(F,U,r(o,{brighter:function(t){return new F(this.l+18*(null==t?1:t),this.a,this.b,this.opacity)},darker:function(t){return new F(this.l-18*(null==t?1:t),this.a,this.b,this.opacity)},rgb:function(){var t=(this.l+16)/116,e=isNaN(this.a)?t:t+this.a/500,n=isNaN(this.b)?t:t-this.b/200;return new M(G(3.1338561*(e=O*q(e))-1.6168667*(t=C*q(t))-.4906146*(n=R*q(n))),G(-.9787684*e+1.9161415*t+.033454*n),G(.0719453*e-.2289914*t+1.4052427*n),this.opacity)}})),i(K,Y,r(o,{brighter:function(t){return new K(this.h,this.c,this.l+18*(null==t?1:t),this.opacity)},darker:function(t){return new K(this.h,this.c,this.l-18*(null==t?1:t),this.opacity)},rgb:function(){return D(this).rgb()}}));var Z=-.14861,J=1.78277,Q=-.29227,$=-.90649,tt=1.97294,et=tt*$,nt=tt*J,it=J*Q-$*Z;function rt(t,e,n,i){return 1===arguments.length?function(t){if(t instanceof ot)return new ot(t.h,t.s,t.l,t.opacity);t instanceof M||(t=x(t));var e=t.r/255,n=t.g/255,i=t.b/255,r=(it*i+et*e-nt*n)/(it+et-nt),o=i-r,a=(tt*(n-r)-Q*o)/$,s=Math.sqrt(a*a+o*o)/(tt*r*(1-r)),c=s?Math.atan2(a,o)*L-120:NaN;return new ot(c<0?c+360:c,s,r,t.opacity)}(t):new ot(t,e,n,null==i?1:i)}function ot(t,e,n,i){this.h=+t,this.s=+e,this.l=+n,this.opacity=+i}i(ot,rt,r(o,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new ot(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new ot(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=isNaN(this.h)?0:(this.h+120)*P,e=+this.l,n=isNaN(this.s)?0:this.s*e*(1-e),i=Math.cos(t),r=Math.sin(t);return new M(255*(e+n*(Z*i+J*r)),255*(e+n*(Q*i+$*r)),255*(e+n*(tt*i)),this.opacity)}})),n.d(e,"a",function(){return v}),n.d(e,"h",function(){return w}),n.d(e,"e",function(){return A}),n.d(e,"f",function(){return U}),n.d(e,"d",function(){return Y}),n.d(e,"g",function(){return X}),n.d(e,"c",function(){return j}),n.d(e,"b",function(){return rt})},function(t,e,n){"use strict";var i=n(7);function r(t,e,n,i,r){var o=t*t,a=o*t;return((1-3*t+3*o-a)*e+(4-6*o+3*a)*n+(1+3*t+3*o-3*a)*i+a*r)/6}var o=function(t){var e=t.length-1;return function(n){var i=n<=0?n=0:n>=1?(n=1,e-1):Math.floor(n*e),o=t[i],a=t[i+1],s=i>0?t[i-1]:2*o-a,c=i180||n<-180?n-360*Math.round(n/360):n):s(isNaN(t)?e:t)}function u(t){return 1==(t=+t)?h: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(i){return Math.pow(t+i*e,n)}}(e,n,t):s(isNaN(e)?n:e)}}function h(t,e){var n=e-t;return n?c(t,n):s(isNaN(t)?e:t)}var d=function t(e){var n=u(e);function r(t,e){var r=n((t=Object(i.h)(t)).r,(e=Object(i.h)(e)).r),o=n(t.g,e.g),a=n(t.b,e.b),s=h(t.opacity,e.opacity);return function(e){return t.r=r(e),t.g=o(e),t.b=a(e),t.opacity=s(e),t+""}}return r.gamma=t,r}(1);function f(t){return function(e){var n,r,o=e.length,a=new Array(o),s=new Array(o),c=new Array(o);for(n=0;no&&(r=e.slice(o,r),s[a]?s[a]+=r:s[++a]=r),(n=n[0])===(i=i[0])?s[a]?s[a]+=i:s[++a]=i:(s[++a]=null,c.push({i:a,x:v(n,i)})),o=x.lastIndex;return o180?e+=360:e-t>180&&(t+=360),o.push({i:n.push(r(n)+"rotate(",null,i)-2,x:v(t,e)})):e&&n.push(r(n)+"rotate("+e+i)}(o.rotate,a.rotate,s,c),function(t,e,n,o){t!==e?o.push({i:n.push(r(n)+"skewX(",null,i)-2,x:v(t,e)}):e&&n.push(r(n)+"skewX("+e+i)}(o.skewX,a.skewX,s,c),function(t,e,n,i,o,a){if(t!==n||e!==i){var s=o.push(r(o)+"scale(",null,",",null,")");a.push({i:s-4,x:v(t,n)},{i:s-2,x:v(e,i)})}else 1===n&&1===i||o.push(r(o)+"scale("+n+","+i+")")}(o.scaleX,o.scaleY,a.scaleX,a.scaleY,s,c),o=a=null,function(t){for(var e,n=-1,i=c.length;++n=49&&a<=54?a-49+10:a>=17&&a<=22?a-17+10:15&a}return i}function c(t,e,n,i){for(var r=0,o=Math.min(t.length,n),a=e;a=49?s-49+10:s>=17?s-17+10:s}return r}o.isBN=function(t){return t instanceof o||null!==t&&"object"==typeof t&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function(t,e){return t.cmp(e)>0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,n){if("number"==typeof t)return this._initNumber(t,e,n);if("object"==typeof t)return this._initArray(t,e,n);"hex"===e&&(e=16),i(e===(0|e)&&e>=2&&e<=36);var r=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&r++,16===e?this._parseHex(t,r):this._parseBase(t,e,r),"-"===t[0]&&(this.negative=1),this.strip(),"le"===n&&this._initArray(this.toArray(),e,n)},o.prototype._initNumber=function(t,e,n){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(i(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===n&&this._initArray(this.toArray(),e,n)},o.prototype._initArray=function(t,e,n){if(i("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var r=0;r=0;r-=3)a=t[r]|t[r-1]<<8|t[r-2]<<16,this.words[o]|=a<>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===n)for(r=0,o=0;r>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this.strip()},o.prototype._parseHex=function(t,e){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var n=0;n=e;n-=6)r=s(t,n,n+6),this.words[i]|=r<>>26-o&4194303,(o+=24)>=26&&(o-=26,i++);n+6!==e&&(r=s(t,e,n+6),this.words[i]|=r<>>26-o&4194303),this.strip()},o.prototype._parseBase=function(t,e,n){this.words=[0],this.length=1;for(var i=0,r=1;r<=67108863;r*=e)i++;i--,r=r/e|0;for(var o=t.length-n,a=o%i,s=Math.min(o,o-a)+n,l=0,u=n;u1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?""};var l=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],u=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],h=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function d(t,e,n){n.negative=e.negative^t.negative;var i=t.length+e.length|0;n.length=i,i=i-1|0;var r=0|t.words[0],o=0|e.words[0],a=r*o,s=67108863&a,c=a/67108864|0;n.words[0]=s;for(var l=1;l>>26,h=67108863&c,d=Math.min(l,e.length-1),f=Math.max(0,l-t.length+1);f<=d;f++){var p=l-f|0;u+=(a=(r=0|t.words[p])*(o=0|e.words[f])+h)/67108864|0,h=67108863&a}n.words[l]=0|h,c=0|u}return 0!==c?n.words[l]=0|c:n.length--,n.strip()}o.prototype.toString=function(t,e){var n;if(e=0|e||1,16===(t=t||10)||"hex"===t){n="";for(var r=0,o=0,a=0;a>>24-r&16777215)||a!==this.length-1?l[6-c.length]+c+n:c+n,(r+=2)>=26&&(r-=26,a--)}for(0!==o&&(n=o.toString(16)+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(t===(0|t)&&t>=2&&t<=36){var d=u[t],f=h[t];n="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(f).toString(t);n=(p=p.idivn(f)).isZero()?m+n:l[d-m.length]+m+n}for(this.isZero()&&(n="0"+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}i(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(t,e){return i(void 0!==a),this.toArrayLike(a,t,e)},o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,n){var r=this.byteLength(),o=n||Math.max(1,r);i(r<=o,"byte array longer than desired length"),i(o>0,"Requested array length <= 0"),this.strip();var a,s,c="le"===e,l=new t(o),u=this.clone();if(c){for(s=0;!u.isZero();s++)a=u.andln(255),u.iushrn(8),l[s]=a;for(;s=4096&&(n+=13,e>>>=13),e>=64&&(n+=7,e>>>=7),e>=8&&(n+=4,e>>>=4),e>=2&&(n+=2,e>>>=2),n+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,n=0;return 0==(8191&e)&&(n+=13,e>>>=13),0==(127&e)&&(n+=7,e>>>=7),0==(15&e)&&(n+=4,e>>>=4),0==(3&e)&&(n+=2,e>>>=2),0==(1&e)&&n++,n},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var n=0;nt.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,n;this.length>t.length?(e=this,n=t):(e=t,n=this);for(var i=0;it.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){i("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),n=t%26;this._expand(e),n>0&&e--;for(var r=0;r0&&(this.words[r]=~this.words[r]&67108863>>26-n),this.strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){i("number"==typeof t&&t>=0);var n=t/26|0,r=t%26;return this._expand(n+1),this.words[n]=e?this.words[n]|1<t.length?(n=this,i=t):(n=t,i=this);for(var r=0,o=0;o>>26;for(;0!==r&&o>>26;if(this.length=n.length,0!==r)this.words[this.length]=r,this.length++;else if(n!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var n,i,r=this.cmp(t);if(0===r)return this.negative=0,this.length=1,this.words[0]=0,this;r>0?(n=this,i=t):(n=t,i=this);for(var o=0,a=0;a>26,this.words[a]=67108863&e;for(;0!==o&&a>26,this.words[a]=67108863&e;if(0===o&&a>>13,f=0|a[1],p=8191&f,m=f>>>13,g=0|a[2],_=8191&g,v=g>>>13,b=0|a[3],y=8191&b,x=b>>>13,w=0|a[4],M=8191&w,E=w>>>13,S=0|a[5],A=8191&S,T=S>>>13,k=0|a[6],P=8191&k,L=k>>>13,O=0|a[7],C=8191&O,R=O>>>13,I=0|a[8],z=8191&I,B=I>>>13,N=0|a[9],D=8191&N,j=N>>>13,U=0|s[0],F=8191&U,H=U>>>13,q=0|s[1],G=8191&q,W=q>>>13,V=0|s[2],X=8191&V,Y=V>>>13,K=0|s[3],Z=8191&K,J=K>>>13,Q=0|s[4],$=8191&Q,tt=Q>>>13,et=0|s[5],nt=8191&et,it=et>>>13,rt=0|s[6],ot=8191&rt,at=rt>>>13,st=0|s[7],ct=8191&st,lt=st>>>13,ut=0|s[8],ht=8191&ut,dt=ut>>>13,ft=0|s[9],pt=8191&ft,mt=ft>>>13;n.negative=t.negative^e.negative,n.length=19;var gt=(l+(i=Math.imul(h,F))|0)+((8191&(r=(r=Math.imul(h,H))+Math.imul(d,F)|0))<<13)|0;l=((o=Math.imul(d,H))+(r>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(p,F),r=(r=Math.imul(p,H))+Math.imul(m,F)|0,o=Math.imul(m,H);var _t=(l+(i=i+Math.imul(h,G)|0)|0)+((8191&(r=(r=r+Math.imul(h,W)|0)+Math.imul(d,G)|0))<<13)|0;l=((o=o+Math.imul(d,W)|0)+(r>>>13)|0)+(_t>>>26)|0,_t&=67108863,i=Math.imul(_,F),r=(r=Math.imul(_,H))+Math.imul(v,F)|0,o=Math.imul(v,H),i=i+Math.imul(p,G)|0,r=(r=r+Math.imul(p,W)|0)+Math.imul(m,G)|0,o=o+Math.imul(m,W)|0;var vt=(l+(i=i+Math.imul(h,X)|0)|0)+((8191&(r=(r=r+Math.imul(h,Y)|0)+Math.imul(d,X)|0))<<13)|0;l=((o=o+Math.imul(d,Y)|0)+(r>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(y,F),r=(r=Math.imul(y,H))+Math.imul(x,F)|0,o=Math.imul(x,H),i=i+Math.imul(_,G)|0,r=(r=r+Math.imul(_,W)|0)+Math.imul(v,G)|0,o=o+Math.imul(v,W)|0,i=i+Math.imul(p,X)|0,r=(r=r+Math.imul(p,Y)|0)+Math.imul(m,X)|0,o=o+Math.imul(m,Y)|0;var bt=(l+(i=i+Math.imul(h,Z)|0)|0)+((8191&(r=(r=r+Math.imul(h,J)|0)+Math.imul(d,Z)|0))<<13)|0;l=((o=o+Math.imul(d,J)|0)+(r>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(M,F),r=(r=Math.imul(M,H))+Math.imul(E,F)|0,o=Math.imul(E,H),i=i+Math.imul(y,G)|0,r=(r=r+Math.imul(y,W)|0)+Math.imul(x,G)|0,o=o+Math.imul(x,W)|0,i=i+Math.imul(_,X)|0,r=(r=r+Math.imul(_,Y)|0)+Math.imul(v,X)|0,o=o+Math.imul(v,Y)|0,i=i+Math.imul(p,Z)|0,r=(r=r+Math.imul(p,J)|0)+Math.imul(m,Z)|0,o=o+Math.imul(m,J)|0;var yt=(l+(i=i+Math.imul(h,$)|0)|0)+((8191&(r=(r=r+Math.imul(h,tt)|0)+Math.imul(d,$)|0))<<13)|0;l=((o=o+Math.imul(d,tt)|0)+(r>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(A,F),r=(r=Math.imul(A,H))+Math.imul(T,F)|0,o=Math.imul(T,H),i=i+Math.imul(M,G)|0,r=(r=r+Math.imul(M,W)|0)+Math.imul(E,G)|0,o=o+Math.imul(E,W)|0,i=i+Math.imul(y,X)|0,r=(r=r+Math.imul(y,Y)|0)+Math.imul(x,X)|0,o=o+Math.imul(x,Y)|0,i=i+Math.imul(_,Z)|0,r=(r=r+Math.imul(_,J)|0)+Math.imul(v,Z)|0,o=o+Math.imul(v,J)|0,i=i+Math.imul(p,$)|0,r=(r=r+Math.imul(p,tt)|0)+Math.imul(m,$)|0,o=o+Math.imul(m,tt)|0;var xt=(l+(i=i+Math.imul(h,nt)|0)|0)+((8191&(r=(r=r+Math.imul(h,it)|0)+Math.imul(d,nt)|0))<<13)|0;l=((o=o+Math.imul(d,it)|0)+(r>>>13)|0)+(xt>>>26)|0,xt&=67108863,i=Math.imul(P,F),r=(r=Math.imul(P,H))+Math.imul(L,F)|0,o=Math.imul(L,H),i=i+Math.imul(A,G)|0,r=(r=r+Math.imul(A,W)|0)+Math.imul(T,G)|0,o=o+Math.imul(T,W)|0,i=i+Math.imul(M,X)|0,r=(r=r+Math.imul(M,Y)|0)+Math.imul(E,X)|0,o=o+Math.imul(E,Y)|0,i=i+Math.imul(y,Z)|0,r=(r=r+Math.imul(y,J)|0)+Math.imul(x,Z)|0,o=o+Math.imul(x,J)|0,i=i+Math.imul(_,$)|0,r=(r=r+Math.imul(_,tt)|0)+Math.imul(v,$)|0,o=o+Math.imul(v,tt)|0,i=i+Math.imul(p,nt)|0,r=(r=r+Math.imul(p,it)|0)+Math.imul(m,nt)|0,o=o+Math.imul(m,it)|0;var wt=(l+(i=i+Math.imul(h,ot)|0)|0)+((8191&(r=(r=r+Math.imul(h,at)|0)+Math.imul(d,ot)|0))<<13)|0;l=((o=o+Math.imul(d,at)|0)+(r>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(C,F),r=(r=Math.imul(C,H))+Math.imul(R,F)|0,o=Math.imul(R,H),i=i+Math.imul(P,G)|0,r=(r=r+Math.imul(P,W)|0)+Math.imul(L,G)|0,o=o+Math.imul(L,W)|0,i=i+Math.imul(A,X)|0,r=(r=r+Math.imul(A,Y)|0)+Math.imul(T,X)|0,o=o+Math.imul(T,Y)|0,i=i+Math.imul(M,Z)|0,r=(r=r+Math.imul(M,J)|0)+Math.imul(E,Z)|0,o=o+Math.imul(E,J)|0,i=i+Math.imul(y,$)|0,r=(r=r+Math.imul(y,tt)|0)+Math.imul(x,$)|0,o=o+Math.imul(x,tt)|0,i=i+Math.imul(_,nt)|0,r=(r=r+Math.imul(_,it)|0)+Math.imul(v,nt)|0,o=o+Math.imul(v,it)|0,i=i+Math.imul(p,ot)|0,r=(r=r+Math.imul(p,at)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,at)|0;var Mt=(l+(i=i+Math.imul(h,ct)|0)|0)+((8191&(r=(r=r+Math.imul(h,lt)|0)+Math.imul(d,ct)|0))<<13)|0;l=((o=o+Math.imul(d,lt)|0)+(r>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(z,F),r=(r=Math.imul(z,H))+Math.imul(B,F)|0,o=Math.imul(B,H),i=i+Math.imul(C,G)|0,r=(r=r+Math.imul(C,W)|0)+Math.imul(R,G)|0,o=o+Math.imul(R,W)|0,i=i+Math.imul(P,X)|0,r=(r=r+Math.imul(P,Y)|0)+Math.imul(L,X)|0,o=o+Math.imul(L,Y)|0,i=i+Math.imul(A,Z)|0,r=(r=r+Math.imul(A,J)|0)+Math.imul(T,Z)|0,o=o+Math.imul(T,J)|0,i=i+Math.imul(M,$)|0,r=(r=r+Math.imul(M,tt)|0)+Math.imul(E,$)|0,o=o+Math.imul(E,tt)|0,i=i+Math.imul(y,nt)|0,r=(r=r+Math.imul(y,it)|0)+Math.imul(x,nt)|0,o=o+Math.imul(x,it)|0,i=i+Math.imul(_,ot)|0,r=(r=r+Math.imul(_,at)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,at)|0,i=i+Math.imul(p,ct)|0,r=(r=r+Math.imul(p,lt)|0)+Math.imul(m,ct)|0,o=o+Math.imul(m,lt)|0;var Et=(l+(i=i+Math.imul(h,ht)|0)|0)+((8191&(r=(r=r+Math.imul(h,dt)|0)+Math.imul(d,ht)|0))<<13)|0;l=((o=o+Math.imul(d,dt)|0)+(r>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(D,F),r=(r=Math.imul(D,H))+Math.imul(j,F)|0,o=Math.imul(j,H),i=i+Math.imul(z,G)|0,r=(r=r+Math.imul(z,W)|0)+Math.imul(B,G)|0,o=o+Math.imul(B,W)|0,i=i+Math.imul(C,X)|0,r=(r=r+Math.imul(C,Y)|0)+Math.imul(R,X)|0,o=o+Math.imul(R,Y)|0,i=i+Math.imul(P,Z)|0,r=(r=r+Math.imul(P,J)|0)+Math.imul(L,Z)|0,o=o+Math.imul(L,J)|0,i=i+Math.imul(A,$)|0,r=(r=r+Math.imul(A,tt)|0)+Math.imul(T,$)|0,o=o+Math.imul(T,tt)|0,i=i+Math.imul(M,nt)|0,r=(r=r+Math.imul(M,it)|0)+Math.imul(E,nt)|0,o=o+Math.imul(E,it)|0,i=i+Math.imul(y,ot)|0,r=(r=r+Math.imul(y,at)|0)+Math.imul(x,ot)|0,o=o+Math.imul(x,at)|0,i=i+Math.imul(_,ct)|0,r=(r=r+Math.imul(_,lt)|0)+Math.imul(v,ct)|0,o=o+Math.imul(v,lt)|0,i=i+Math.imul(p,ht)|0,r=(r=r+Math.imul(p,dt)|0)+Math.imul(m,ht)|0,o=o+Math.imul(m,dt)|0;var St=(l+(i=i+Math.imul(h,pt)|0)|0)+((8191&(r=(r=r+Math.imul(h,mt)|0)+Math.imul(d,pt)|0))<<13)|0;l=((o=o+Math.imul(d,mt)|0)+(r>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(D,G),r=(r=Math.imul(D,W))+Math.imul(j,G)|0,o=Math.imul(j,W),i=i+Math.imul(z,X)|0,r=(r=r+Math.imul(z,Y)|0)+Math.imul(B,X)|0,o=o+Math.imul(B,Y)|0,i=i+Math.imul(C,Z)|0,r=(r=r+Math.imul(C,J)|0)+Math.imul(R,Z)|0,o=o+Math.imul(R,J)|0,i=i+Math.imul(P,$)|0,r=(r=r+Math.imul(P,tt)|0)+Math.imul(L,$)|0,o=o+Math.imul(L,tt)|0,i=i+Math.imul(A,nt)|0,r=(r=r+Math.imul(A,it)|0)+Math.imul(T,nt)|0,o=o+Math.imul(T,it)|0,i=i+Math.imul(M,ot)|0,r=(r=r+Math.imul(M,at)|0)+Math.imul(E,ot)|0,o=o+Math.imul(E,at)|0,i=i+Math.imul(y,ct)|0,r=(r=r+Math.imul(y,lt)|0)+Math.imul(x,ct)|0,o=o+Math.imul(x,lt)|0,i=i+Math.imul(_,ht)|0,r=(r=r+Math.imul(_,dt)|0)+Math.imul(v,ht)|0,o=o+Math.imul(v,dt)|0;var At=(l+(i=i+Math.imul(p,pt)|0)|0)+((8191&(r=(r=r+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;l=((o=o+Math.imul(m,mt)|0)+(r>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(D,X),r=(r=Math.imul(D,Y))+Math.imul(j,X)|0,o=Math.imul(j,Y),i=i+Math.imul(z,Z)|0,r=(r=r+Math.imul(z,J)|0)+Math.imul(B,Z)|0,o=o+Math.imul(B,J)|0,i=i+Math.imul(C,$)|0,r=(r=r+Math.imul(C,tt)|0)+Math.imul(R,$)|0,o=o+Math.imul(R,tt)|0,i=i+Math.imul(P,nt)|0,r=(r=r+Math.imul(P,it)|0)+Math.imul(L,nt)|0,o=o+Math.imul(L,it)|0,i=i+Math.imul(A,ot)|0,r=(r=r+Math.imul(A,at)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,at)|0,i=i+Math.imul(M,ct)|0,r=(r=r+Math.imul(M,lt)|0)+Math.imul(E,ct)|0,o=o+Math.imul(E,lt)|0,i=i+Math.imul(y,ht)|0,r=(r=r+Math.imul(y,dt)|0)+Math.imul(x,ht)|0,o=o+Math.imul(x,dt)|0;var Tt=(l+(i=i+Math.imul(_,pt)|0)|0)+((8191&(r=(r=r+Math.imul(_,mt)|0)+Math.imul(v,pt)|0))<<13)|0;l=((o=o+Math.imul(v,mt)|0)+(r>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(D,Z),r=(r=Math.imul(D,J))+Math.imul(j,Z)|0,o=Math.imul(j,J),i=i+Math.imul(z,$)|0,r=(r=r+Math.imul(z,tt)|0)+Math.imul(B,$)|0,o=o+Math.imul(B,tt)|0,i=i+Math.imul(C,nt)|0,r=(r=r+Math.imul(C,it)|0)+Math.imul(R,nt)|0,o=o+Math.imul(R,it)|0,i=i+Math.imul(P,ot)|0,r=(r=r+Math.imul(P,at)|0)+Math.imul(L,ot)|0,o=o+Math.imul(L,at)|0,i=i+Math.imul(A,ct)|0,r=(r=r+Math.imul(A,lt)|0)+Math.imul(T,ct)|0,o=o+Math.imul(T,lt)|0,i=i+Math.imul(M,ht)|0,r=(r=r+Math.imul(M,dt)|0)+Math.imul(E,ht)|0,o=o+Math.imul(E,dt)|0;var kt=(l+(i=i+Math.imul(y,pt)|0)|0)+((8191&(r=(r=r+Math.imul(y,mt)|0)+Math.imul(x,pt)|0))<<13)|0;l=((o=o+Math.imul(x,mt)|0)+(r>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(D,$),r=(r=Math.imul(D,tt))+Math.imul(j,$)|0,o=Math.imul(j,tt),i=i+Math.imul(z,nt)|0,r=(r=r+Math.imul(z,it)|0)+Math.imul(B,nt)|0,o=o+Math.imul(B,it)|0,i=i+Math.imul(C,ot)|0,r=(r=r+Math.imul(C,at)|0)+Math.imul(R,ot)|0,o=o+Math.imul(R,at)|0,i=i+Math.imul(P,ct)|0,r=(r=r+Math.imul(P,lt)|0)+Math.imul(L,ct)|0,o=o+Math.imul(L,lt)|0,i=i+Math.imul(A,ht)|0,r=(r=r+Math.imul(A,dt)|0)+Math.imul(T,ht)|0,o=o+Math.imul(T,dt)|0;var Pt=(l+(i=i+Math.imul(M,pt)|0)|0)+((8191&(r=(r=r+Math.imul(M,mt)|0)+Math.imul(E,pt)|0))<<13)|0;l=((o=o+Math.imul(E,mt)|0)+(r>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,i=Math.imul(D,nt),r=(r=Math.imul(D,it))+Math.imul(j,nt)|0,o=Math.imul(j,it),i=i+Math.imul(z,ot)|0,r=(r=r+Math.imul(z,at)|0)+Math.imul(B,ot)|0,o=o+Math.imul(B,at)|0,i=i+Math.imul(C,ct)|0,r=(r=r+Math.imul(C,lt)|0)+Math.imul(R,ct)|0,o=o+Math.imul(R,lt)|0,i=i+Math.imul(P,ht)|0,r=(r=r+Math.imul(P,dt)|0)+Math.imul(L,ht)|0,o=o+Math.imul(L,dt)|0;var Lt=(l+(i=i+Math.imul(A,pt)|0)|0)+((8191&(r=(r=r+Math.imul(A,mt)|0)+Math.imul(T,pt)|0))<<13)|0;l=((o=o+Math.imul(T,mt)|0)+(r>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,i=Math.imul(D,ot),r=(r=Math.imul(D,at))+Math.imul(j,ot)|0,o=Math.imul(j,at),i=i+Math.imul(z,ct)|0,r=(r=r+Math.imul(z,lt)|0)+Math.imul(B,ct)|0,o=o+Math.imul(B,lt)|0,i=i+Math.imul(C,ht)|0,r=(r=r+Math.imul(C,dt)|0)+Math.imul(R,ht)|0,o=o+Math.imul(R,dt)|0;var Ot=(l+(i=i+Math.imul(P,pt)|0)|0)+((8191&(r=(r=r+Math.imul(P,mt)|0)+Math.imul(L,pt)|0))<<13)|0;l=((o=o+Math.imul(L,mt)|0)+(r>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,i=Math.imul(D,ct),r=(r=Math.imul(D,lt))+Math.imul(j,ct)|0,o=Math.imul(j,lt),i=i+Math.imul(z,ht)|0,r=(r=r+Math.imul(z,dt)|0)+Math.imul(B,ht)|0,o=o+Math.imul(B,dt)|0;var Ct=(l+(i=i+Math.imul(C,pt)|0)|0)+((8191&(r=(r=r+Math.imul(C,mt)|0)+Math.imul(R,pt)|0))<<13)|0;l=((o=o+Math.imul(R,mt)|0)+(r>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,i=Math.imul(D,ht),r=(r=Math.imul(D,dt))+Math.imul(j,ht)|0,o=Math.imul(j,dt);var Rt=(l+(i=i+Math.imul(z,pt)|0)|0)+((8191&(r=(r=r+Math.imul(z,mt)|0)+Math.imul(B,pt)|0))<<13)|0;l=((o=o+Math.imul(B,mt)|0)+(r>>>13)|0)+(Rt>>>26)|0,Rt&=67108863;var It=(l+(i=Math.imul(D,pt))|0)+((8191&(r=(r=Math.imul(D,mt))+Math.imul(j,pt)|0))<<13)|0;return l=((o=Math.imul(j,mt))+(r>>>13)|0)+(It>>>26)|0,It&=67108863,c[0]=gt,c[1]=_t,c[2]=vt,c[3]=bt,c[4]=yt,c[5]=xt,c[6]=wt,c[7]=Mt,c[8]=Et,c[9]=St,c[10]=At,c[11]=Tt,c[12]=kt,c[13]=Pt,c[14]=Lt,c[15]=Ot,c[16]=Ct,c[17]=Rt,c[18]=It,0!==l&&(c[19]=l,n.length++),n};function p(t,e,n){return(new m).mulp(t,e,n)}function m(t,e){this.x=t,this.y=e}Math.imul||(f=d),o.prototype.mulTo=function(t,e){var n=this.length+t.length;return 10===this.length&&10===t.length?f(this,t,e):n<63?d(this,t,e):n<1024?function(t,e,n){n.negative=e.negative^t.negative,n.length=t.length+e.length;for(var i=0,r=0,o=0;o>>26)|0)>>>26,a&=67108863}n.words[o]=s,i=a,a=r}return 0!==i?n.words[o]=i:n.length--,n.strip()}(this,t,e):p(this,t,e)},m.prototype.makeRBT=function(t){for(var e=new Array(t),n=o.prototype._countBits(t)-1,i=0;i>=1;return i},m.prototype.permute=function(t,e,n,i,r,o){for(var a=0;a>>=1)r++;return 1<>>=13,n[2*a+1]=8191&o,o>>>=13;for(a=2*e;a>=26,e+=r/67108864|0,e+=o>>>26,this.words[n]=67108863&o}return 0!==e&&(this.words[n]=e,this.length++),this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),n=0;n>>r}return e}(t);if(0===e.length)return new o(1);for(var n=this,i=0;i=0);var e,n=t%26,r=(t-n)/26,o=67108863>>>26-n<<26-n;if(0!==n){var a=0;for(e=0;e>>26-n}a&&(this.words[e]=a,this.length++)}if(0!==r){for(e=this.length-1;e>=0;e--)this.words[e+r]=this.words[e];for(e=0;e=0),r=e?(e-e%26)/26:0;var o=t%26,a=Math.min((t-o)/26,this.length),s=67108863^67108863>>>o<a)for(this.length-=a,l=0;l=0&&(0!==u||l>=r);l--){var h=0|this.words[l];this.words[l]=u<<26-o|h>>>o,u=h&s}return c&&0!==u&&(c.words[c.length++]=u),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(t,e,n){return i(0===this.negative),this.iushrn(t,e,n)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){i("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26,r=1<=0);var e=t%26,n=(t-e)/26;if(i(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==e&&n++,this.length=Math.min(n,this.length),0!==e){var r=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(i("number"==typeof t),i(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(c/67108864|0),this.words[r+n]=67108863&o}for(;r>26,this.words[r+n]=67108863&o;if(0===s)return this.strip();for(i(-1===s),s=0,r=0;r>26,this.words[r]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(t,e){var n=(this.length,t.length),i=this.clone(),r=t,a=0|r.words[r.length-1];0!==(n=26-this._countBits(a))&&(r=r.ushln(n),i.iushln(n),a=0|r.words[r.length-1]);var s,c=i.length-r.length;if("mod"!==e){(s=new o(null)).length=c+1,s.words=new Array(s.length);for(var l=0;l=0;h--){var d=67108864*(0|i.words[r.length+h])+(0|i.words[r.length+h-1]);for(d=Math.min(d/a|0,67108863),i._ishlnsubmul(r,d,h);0!==i.negative;)d--,i.negative=0,i._ishlnsubmul(r,1,h),i.isZero()||(i.negative^=1);s&&(s.words[h]=d)}return s&&s.strip(),i.strip(),"div"!==e&&0!==n&&i.iushrn(n),{div:s||null,mod:i}},o.prototype.divmod=function(t,e,n){return i(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(r=s.div.neg()),"div"!==e&&(a=s.mod.neg(),n&&0!==a.negative&&a.iadd(t)),{div:r,mod:a}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(r=s.div.neg()),{div:r,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(a=s.mod.neg(),n&&0!==a.negative&&a.isub(t)),{div:s.div,mod:a}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modn(t.words[0]))}:this._wordDiv(t,e);var r,a,s},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var n=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),r=t.andln(1),o=n.cmp(i);return o<0||1===r&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modn=function(t){i(t<=67108863);for(var e=(1<<26)%t,n=0,r=this.length-1;r>=0;r--)n=(e*n+(0|this.words[r]))%t;return n},o.prototype.idivn=function(t){i(t<=67108863);for(var e=0,n=this.length-1;n>=0;n--){var r=(0|this.words[n])+67108864*e;this.words[n]=r/t|0,e=r%t}return this.strip()},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){i(0===t.negative),i(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var r=new o(1),a=new o(0),s=new o(0),c=new o(1),l=0;e.isEven()&&n.isEven();)e.iushrn(1),n.iushrn(1),++l;for(var u=n.clone(),h=e.clone();!e.isZero();){for(var d=0,f=1;0==(e.words[0]&f)&&d<26;++d,f<<=1);if(d>0)for(e.iushrn(d);d-- >0;)(r.isOdd()||a.isOdd())&&(r.iadd(u),a.isub(h)),r.iushrn(1),a.iushrn(1);for(var p=0,m=1;0==(n.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(s.isOdd()||c.isOdd())&&(s.iadd(u),c.isub(h)),s.iushrn(1),c.iushrn(1);e.cmp(n)>=0?(e.isub(n),r.isub(s),a.isub(c)):(n.isub(e),s.isub(r),c.isub(a))}return{a:s,b:c,gcd:n.iushln(l)}},o.prototype._invmp=function(t){i(0===t.negative),i(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var r,a=new o(1),s=new o(0),c=n.clone();e.cmpn(1)>0&&n.cmpn(1)>0;){for(var l=0,u=1;0==(e.words[0]&u)&&l<26;++l,u<<=1);if(l>0)for(e.iushrn(l);l-- >0;)a.isOdd()&&a.iadd(c),a.iushrn(1);for(var h=0,d=1;0==(n.words[0]&d)&&h<26;++h,d<<=1);if(h>0)for(n.iushrn(h);h-- >0;)s.isOdd()&&s.iadd(c),s.iushrn(1);e.cmp(n)>=0?(e.isub(n),a.isub(s)):(n.isub(e),s.isub(a))}return(r=0===e.cmpn(1)?a:s).cmpn(0)<0&&r.iadd(t),r},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),n=t.clone();e.negative=0,n.negative=0;for(var i=0;e.isEven()&&n.isEven();i++)e.iushrn(1),n.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;n.isEven();)n.iushrn(1);var r=e.cmp(n);if(r<0){var o=e;e=n,n=o}else if(0===r||0===n.cmpn(1))break;e.isub(n)}return n.iushln(i)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){i("number"==typeof t);var e=t%26,n=(t-e)/26,r=1<>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var e,n=t<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this.strip(),this.length>1)e=1;else{n&&(t=-t),i(t<=67108863,"Number is too big");var r=0|this.words[0];e=r===t?0:rt.length)return 1;if(this.length=0;n--){var i=0|this.words[n],r=0|t.words[n];if(i!==r){ir&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new w(t)},o.prototype.toRed=function(t){return i(!this.red,"Already a number in reduction context"),i(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return i(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return i(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var g={k256:null,p224:null,p192:null,p25519:null};function _(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function v(){_.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function b(){_.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function y(){_.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function x(){_.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function w(t){if("string"==typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else i(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function M(t){w.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}_.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},_.prototype.ireduce=function(t){var e,n=t;do{this.split(n,this.tmp),e=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e0?n.isub(this.p):n.strip(),n},_.prototype.split=function(t,e){t.iushrn(this.n,0,e)},_.prototype.imulK=function(t){return t.imul(this.k)},r(v,_),v.prototype.split=function(t,e){for(var n=Math.min(t.length,9),i=0;i>>22,r=o}r>>>=22,t.words[i-10]=r,0===r&&t.length>10?t.length-=10:t.length-=9},v.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,n=0;n>>=26,t.words[n]=r,e=i}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(g[t])return g[t];var e;if("k256"===t)e=new v;else if("p224"===t)e=new b;else if("p192"===t)e=new y;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new x}return g[t]=e,e},w.prototype._verify1=function(t){i(0===t.negative,"red works only with positives"),i(t.red,"red works only with red numbers")},w.prototype._verify2=function(t,e){i(0==(t.negative|e.negative),"red works only with positives"),i(t.red&&t.red===e.red,"red works only with red numbers")},w.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},w.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},w.prototype.add=function(t,e){this._verify2(t,e);var n=t.add(e);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},w.prototype.iadd=function(t,e){this._verify2(t,e);var n=t.iadd(e);return n.cmp(this.m)>=0&&n.isub(this.m),n},w.prototype.sub=function(t,e){this._verify2(t,e);var n=t.sub(e);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},w.prototype.isub=function(t,e){this._verify2(t,e);var n=t.isub(e);return n.cmpn(0)<0&&n.iadd(this.m),n},w.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},w.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},w.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},w.prototype.isqr=function(t){return this.imul(t,t.clone())},w.prototype.sqr=function(t){return this.mul(t,t)},w.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(i(e%2==1),3===e){var n=this.m.add(new o(1)).iushrn(2);return this.pow(t,n)}for(var r=this.m.subn(1),a=0;!r.isZero()&&0===r.andln(1);)a++,r.iushrn(1);i(!r.isZero());var s=new o(1).toRed(this),c=s.redNeg(),l=this.m.subn(1).iushrn(1),u=this.m.bitLength();for(u=new o(2*u*u).toRed(this);0!==this.pow(u,l).cmp(c);)u.redIAdd(c);for(var h=this.pow(u,r),d=this.pow(t,r.addn(1).iushrn(1)),f=this.pow(t,r),p=a;0!==f.cmp(s);){for(var m=f,g=0;0!==m.cmp(s);g++)m=m.redSqr();i(g=0;i--){for(var l=e.words[i],u=c-1;u>=0;u--){var h=l>>u&1;r!==n[0]&&(r=this.sqr(r)),0!==h||0!==a?(a<<=1,a|=h,(4===++s||0===i&&0===u)&&(r=this.mul(r,n[a]),s=0,a=0)):s=0}c=26}return r},w.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},w.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new M(t)},r(M,w),M.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},M.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},M.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var n=t.imul(e),i=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),r=n.isub(i).iushrn(this.shift),o=r;return r.cmp(this.m)>=0?o=r.isub(this.m):r.cmpn(0)<0&&(o=r.iadd(this.m)),o._forceRed(this)},M.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var n=t.mul(e),i=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),r=n.isub(i).iushrn(this.shift),a=r;return r.cmp(this.m)>=0?a=r.isub(this.m):r.cmpn(0)<0&&(a=r.iadd(this.m)),a._forceRed(this)},M.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,this)}).call(this,n(90)(t))},function(t,e,n){"use strict";var i=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e},r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const o=i(n(6)),a=r(n(89)),s={int8:Int8Array,int16:Int16Array,int32:Int32Array,uint8:Uint8Array,uint16:Uint16Array,uint32:Uint32Array,float32:Float32Array,float64:Float64Array},c={Int8Array:"int8",Int16Array:"int16",Int32Array:"int32",Uint8Array:"uint8",Uint16Array:"uint16",Uint32Array:"uint32",Float32Array:"float32",Float64Array:"float64"};e.array_or_json={deserialize:function t(e,n){if(null==e)return null;let i=null;return o.isNumber(e)?e:(o.isArray(e)?0==e.length||(i=o.isArray(e[0])?o.map(e,function(e){return t(e,n)}):e):e.value&&e.dtype?i=function(t,e){const n=s[t.dtype];null==t&&console.log("data is null"),t.value||console.log("data.buffer is null"),t.value.buffer||console.log("data.buffer is null");const i=new n(t.value.buffer);if(i.type=t.type,t.shape&&t.shape.length>=2){if(t.shape.length>2)throw new Error("only arrays with rank 1 or 2 supported");const e=[];for(let n=0;nt(e,n)):a.default(e)?function(t,e){null==t&&console.log("data is null"),t.buffer||console.log("ar.buffer is null or not defined");const n=c[t.constructor.name],i=t.type||null;return{dtype:n,value:new DataView(t.buffer),shape:[t.length],type:i}}(e):void 0}}},function(t,e,n){"use strict";var i,r=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o,a=n(9),s=n(14),c=n(37),l=n(21),u=n(67),h=function(){function t(t){void 0===t&&(t={}),this._flags=0,this._layout=null,this._parent=null,this._disposed=new l.Signal(this),this.node=o.createNode(t),this.addClass("p-Widget")}return t.prototype.dispose=function(){this.isDisposed||(this.setFlag(t.Flag.IsDisposed),this._disposed.emit(void 0),this.parent?this.parent=null:this.isAttached&&t.detach(this),this._layout&&(this._layout.dispose(),this._layout=null),l.Signal.clearData(this),s.MessageLoop.clearData(this),c.AttachedProperty.clearData(this))},Object.defineProperty(t.prototype,"disposed",{get:function(){return this._disposed},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isDisposed",{get:function(){return this.testFlag(t.Flag.IsDisposed)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isAttached",{get:function(){return this.testFlag(t.Flag.IsAttached)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isHidden",{get:function(){return this.testFlag(t.Flag.IsHidden)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isVisible",{get:function(){return this.testFlag(t.Flag.IsVisible)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"title",{get:function(){return o.titleProperty.get(this)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"id",{get:function(){return this.node.id},set:function(t){this.node.id=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"dataset",{get:function(){return this.node.dataset},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"parent",{get:function(){return this._parent},set:function(e){if(this._parent!==e){if(e&&this.contains(e))throw new Error("Invalid parent widget.");if(this._parent&&!this._parent.isDisposed){var n=new t.ChildMessage("child-removed",this);s.MessageLoop.sendMessage(this._parent,n)}if(this._parent=e,this._parent&&!this._parent.isDisposed){n=new t.ChildMessage("child-added",this);s.MessageLoop.sendMessage(this._parent,n)}this.isDisposed||s.MessageLoop.sendMessage(this,t.Msg.ParentChanged)}},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"layout",{get:function(){return this._layout},set:function(e){if(this._layout!==e){if(this.testFlag(t.Flag.DisallowLayout))throw new Error("Cannot set widget layout.");if(this._layout)throw new Error("Cannot change widget layout.");if(e.parent)throw new Error("Cannot change layout parent.");this._layout=e,e.parent=this}},enumerable:!0,configurable:!0}),t.prototype.children=function(){return this._layout?this._layout.iter():a.empty()},t.prototype.contains=function(t){for(var e=t;e;e=e._parent)if(e===this)return!0;return!1},t.prototype.hasClass=function(t){return this.node.classList.contains(t)},t.prototype.addClass=function(t){this.node.classList.add(t)},t.prototype.removeClass=function(t){this.node.classList.remove(t)},t.prototype.toggleClass=function(t,e){return!0===e?(this.node.classList.add(t),!0):!1===e?(this.node.classList.remove(t),!1):this.node.classList.toggle(t)},t.prototype.update=function(){s.MessageLoop.postMessage(this,t.Msg.UpdateRequest)},t.prototype.fit=function(){s.MessageLoop.postMessage(this,t.Msg.FitRequest)},t.prototype.activate=function(){s.MessageLoop.postMessage(this,t.Msg.ActivateRequest)},t.prototype.close=function(){s.MessageLoop.sendMessage(this,t.Msg.CloseRequest)},t.prototype.show=function(){if(this.testFlag(t.Flag.IsHidden)&&(!this.isAttached||this.parent&&!this.parent.isVisible||s.MessageLoop.sendMessage(this,t.Msg.BeforeShow),this.clearFlag(t.Flag.IsHidden),this.removeClass("p-mod-hidden"),!this.isAttached||this.parent&&!this.parent.isVisible||s.MessageLoop.sendMessage(this,t.Msg.AfterShow),this.parent)){var e=new t.ChildMessage("child-shown",this);s.MessageLoop.sendMessage(this.parent,e)}},t.prototype.hide=function(){if(!this.testFlag(t.Flag.IsHidden)&&(!this.isAttached||this.parent&&!this.parent.isVisible||s.MessageLoop.sendMessage(this,t.Msg.BeforeHide),this.setFlag(t.Flag.IsHidden),this.addClass("p-mod-hidden"),!this.isAttached||this.parent&&!this.parent.isVisible||s.MessageLoop.sendMessage(this,t.Msg.AfterHide),this.parent)){var e=new t.ChildMessage("child-hidden",this);s.MessageLoop.sendMessage(this.parent,e)}},t.prototype.setHidden=function(t){t?this.hide():this.show()},t.prototype.testFlag=function(t){return 0!=(this._flags&t)},t.prototype.setFlag=function(t){this._flags|=t},t.prototype.clearFlag=function(t){this._flags&=~t},t.prototype.processMessage=function(e){switch(e.type){case"resize":this.notifyLayout(e),this.onResize(e);break;case"update-request":this.notifyLayout(e),this.onUpdateRequest(e);break;case"fit-request":this.notifyLayout(e),this.onFitRequest(e);break;case"before-show":this.notifyLayout(e),this.onBeforeShow(e);break;case"after-show":this.setFlag(t.Flag.IsVisible),this.notifyLayout(e),this.onAfterShow(e);break;case"before-hide":this.notifyLayout(e),this.onBeforeHide(e);break;case"after-hide":this.clearFlag(t.Flag.IsVisible),this.notifyLayout(e),this.onAfterHide(e);break;case"before-attach":this.notifyLayout(e),this.onBeforeAttach(e);break;case"after-attach":this.isHidden||this.parent&&!this.parent.isVisible||this.setFlag(t.Flag.IsVisible),this.setFlag(t.Flag.IsAttached),this.notifyLayout(e),this.onAfterAttach(e);break;case"before-detach":this.notifyLayout(e),this.onBeforeDetach(e);break;case"after-detach":this.clearFlag(t.Flag.IsVisible),this.clearFlag(t.Flag.IsAttached),this.notifyLayout(e),this.onAfterDetach(e);break;case"activate-request":this.notifyLayout(e),this.onActivateRequest(e);break;case"close-request":this.notifyLayout(e),this.onCloseRequest(e);break;case"child-added":this.notifyLayout(e),this.onChildAdded(e);break;case"child-removed":this.notifyLayout(e),this.onChildRemoved(e);break;default:this.notifyLayout(e)}},t.prototype.notifyLayout=function(t){this._layout&&this._layout.processParentMessage(t)},t.prototype.onCloseRequest=function(e){this.parent?this.parent=null:this.isAttached&&t.detach(this)},t.prototype.onResize=function(t){},t.prototype.onUpdateRequest=function(t){},t.prototype.onFitRequest=function(t){},t.prototype.onActivateRequest=function(t){},t.prototype.onBeforeShow=function(t){},t.prototype.onAfterShow=function(t){},t.prototype.onBeforeHide=function(t){},t.prototype.onAfterHide=function(t){},t.prototype.onBeforeAttach=function(t){},t.prototype.onAfterAttach=function(t){},t.prototype.onBeforeDetach=function(t){},t.prototype.onAfterDetach=function(t){},t.prototype.onChildAdded=function(t){},t.prototype.onChildRemoved=function(t){},t}();e.Widget=h,function(t){!function(t){t[t.IsDisposed=1]="IsDisposed",t[t.IsAttached=2]="IsAttached",t[t.IsHidden=4]="IsHidden",t[t.IsVisible=8]="IsVisible",t[t.DisallowLayout=16]="DisallowLayout"}(t.Flag||(t.Flag={})),function(t){t.BeforeShow=new s.Message("before-show"),t.AfterShow=new s.Message("after-show"),t.BeforeHide=new s.Message("before-hide"),t.AfterHide=new s.Message("after-hide"),t.BeforeAttach=new s.Message("before-attach"),t.AfterAttach=new s.Message("after-attach"),t.BeforeDetach=new s.Message("before-detach"),t.AfterDetach=new s.Message("after-detach"),t.ParentChanged=new s.Message("parent-changed"),t.UpdateRequest=new s.ConflatableMessage("update-request"),t.FitRequest=new s.ConflatableMessage("fit-request"),t.ActivateRequest=new s.ConflatableMessage("activate-request"),t.CloseRequest=new s.ConflatableMessage("close-request")}(t.Msg||(t.Msg={}));var e=function(t){function e(e,n){var i=t.call(this,e)||this;return i.child=n,i}return r(e,t),e}(s.Message);t.ChildMessage=e;var n=function(t){function e(e,n){var i=t.call(this,"resize")||this;return i.width=e,i.height=n,i}return r(e,t),e}(s.Message);t.ResizeMessage=n,function(t){t.UnknownSize=new t(-1,-1)}(n=t.ResizeMessage||(t.ResizeMessage={})),t.attach=function(e,n,i){if(void 0===i&&(i=null),e.parent)throw new Error("Cannot attach a child widget.");if(e.isAttached||document.body.contains(e.node))throw new Error("Widget is already attached.");if(!document.body.contains(n))throw new Error("Host is not attached.");s.MessageLoop.sendMessage(e,t.Msg.BeforeAttach),n.insertBefore(e.node,i),s.MessageLoop.sendMessage(e,t.Msg.AfterAttach)},t.detach=function(e){if(e.parent)throw new Error("Cannot detach a child widget.");if(!e.isAttached||!document.body.contains(e.node))throw new Error("Widget is not attached.");s.MessageLoop.sendMessage(e,t.Msg.BeforeDetach),e.node.parentNode.removeChild(e.node),s.MessageLoop.sendMessage(e,t.Msg.AfterDetach)}}(h=e.Widget||(e.Widget={})),e.Widget=h,function(t){t.titleProperty=new c.AttachedProperty({name:"title",create:function(t){return new u.Title({owner:t})}}),t.createNode=function(t){return t.node||document.createElement("div")}}(o||(o={}))},function(t,e,n){"use strict";(function(t,i){var r,o=this&&this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var a=n(9),s=n(171),c=function(){function t(t){this.type=t}return Object.defineProperty(t.prototype,"isConflatable",{get:function(){return!1},enumerable:!0,configurable:!0}),t.prototype.conflate=function(t){return!1},t}();e.Message=c;var l=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),Object.defineProperty(e.prototype,"isConflatable",{get:function(){return!0},enumerable:!0,configurable:!0}),e.prototype.conflate=function(t){return!0},e}(c);e.ConflatableMessage=l,function(e){function n(t,e){var n=o.get(t);n&&0!==n.length?a.every(a.retro(n),function(n){return!n||function(t,e,n){var i=!0;try{i="function"==typeof t?t(e,n):t.messageHook(e,n)}catch(t){l(t)}return i}(n,t,e)})&&p(t,e):p(t,e)}e.sendMessage=n,e.postMessage=function(t,e){e.isConflatable&&a.some(r,function(n){return n.handler===t&&!!n.msg&&n.msg.type===e.type&&!!n.msg.isConflatable&&n.msg.conflate(e)})||m(t,e)},e.installMessageHook=function(t,e){var n=o.get(t);n&&-1!==n.indexOf(e)||(n?n.push(e):o.set(t,[e]))},e.removeMessageHook=function(t,e){var n=o.get(t);if(n){var i=n.indexOf(e);-1!==i&&(n[i]=null,_(n))}},e.clearData=function(t){var e=o.get(t);e&&e.length>0&&(a.ArrayExt.fill(e,null),_(e)),a.each(r,function(e){e.handler===t&&(e.handler=null,e.msg=null)})},e.flush=function(){h||0===u||(f(u),h=!0,g(),h=!1)},e.getExceptionHandler=function(){return l},e.setExceptionHandler=function(t){var e=l;return l=t,e};var r=new s.LinkedList,o=new WeakMap,c=new Set,l=function(t){console.error(t)},u=0,h=!1,d="function"==typeof requestAnimationFrame?requestAnimationFrame:t,f="function"==typeof cancelAnimationFrame?cancelAnimationFrame:i;function p(t,e){try{t.processMessage(e)}catch(t){l(t)}}function m(t,e){r.addLast({handler:t,msg:e}),0===u&&(u=d(g))}function g(){if(u=0,!r.isEmpty){var t={handler:null,msg:null};for(r.addLast(t);;){var e=r.removeFirst();if(e===t)return;e.handler&&e.msg&&n(e.handler,e.msg)}}}function _(t){0===c.size&&d(v),c.add(t)}function v(){c.forEach(b),c.clear()}function b(t){a.ArrayExt.removeAllWhere(t,y)}function y(t){return null===t}}(e.MessageLoop||(e.MessageLoop={}))}).call(this,n(51).setImmediate,n(51).clearImmediate)},function(t,e,n){"use strict";(function(t){ /*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh * @license MIT */ var i=n(182),r=n(183),o=n(94);function a(){return c.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function s(t,e){if(a()=a())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a().toString(16)+" bytes");return 0|t}function p(t,e){if(c.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var n=t.length;if(0===n)return 0;for(var i=!1;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return F(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return H(t).length;default:if(i)return F(t).length;e=(""+e).toLowerCase(),i=!0}}function m(t,e,n){var i=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return L(this,e,n);case"utf8":case"utf-8":return A(this,e,n);case"ascii":return k(this,e,n);case"latin1":case"binary":return P(this,e,n);case"base64":return S(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O(this,e,n);default:if(i)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),i=!0}}function g(t,e,n){var i=t[e];t[e]=t[n],t[n]=i}function _(t,e,n,i,r){if(0===t.length)return-1;if("string"==typeof n?(i=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=r?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(r)return-1;n=t.length-1}else if(n<0){if(!r)return-1;n=0}if("string"==typeof e&&(e=c.from(e,i)),c.isBuffer(e))return 0===e.length?-1:v(t,e,n,i,r);if("number"==typeof e)return e&=255,c.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?r?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):v(t,[e],n,i,r);throw new TypeError("val must be string, number or Buffer")}function v(t,e,n,i,r){var o,a=1,s=t.length,c=e.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(t.length<2||e.length<2)return-1;a=2,s/=2,c/=2,n/=2}function l(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}if(r){var u=-1;for(o=n;os&&(n=s-c),o=n;o>=0;o--){for(var h=!0,d=0;dr&&(i=r):i=r;var o=e.length;if(o%2!=0)throw new TypeError("Invalid hex string");i>o/2&&(i=o/2);for(var a=0;a>8,r=n%256,o.push(r),o.push(i);return o}(e,t.length-n),t,n,i)}function S(t,e,n){return 0===e&&n===t.length?i.fromByteArray(t):i.fromByteArray(t.slice(e,n))}function A(t,e,n){n=Math.min(t.length,n);for(var i=[],r=e;r239?4:l>223?3:l>191?2:1;if(r+h<=n)switch(h){case 1:l<128&&(u=l);break;case 2:128==(192&(o=t[r+1]))&&(c=(31&l)<<6|63&o)>127&&(u=c);break;case 3:o=t[r+1],a=t[r+2],128==(192&o)&&128==(192&a)&&(c=(15&l)<<12|(63&o)<<6|63&a)>2047&&(c<55296||c>57343)&&(u=c);break;case 4:o=t[r+1],a=t[r+2],s=t[r+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&(c=(15&l)<<18|(63&o)<<12|(63&a)<<6|63&s)>65535&&c<1114112&&(u=c)}null===u?(u=65533,h=1):u>65535&&(u-=65536,i.push(u>>>10&1023|55296),u=56320|1023&u),i.push(u),r+=h}return function(t){var e=t.length;if(e<=T)return String.fromCharCode.apply(String,t);var n="",i=0;for(;i0&&(t=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(t+=" ... ")),""},c.prototype.compare=function(t,e,n,i,r){if(!c.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===i&&(i=0),void 0===r&&(r=this.length),e<0||n>t.length||i<0||r>this.length)throw new RangeError("out of range index");if(i>=r&&e>=n)return 0;if(i>=r)return-1;if(e>=n)return 1;if(this===t)return 0;for(var o=(r>>>=0)-(i>>>=0),a=(n>>>=0)-(e>>>=0),s=Math.min(o,a),l=this.slice(i,r),u=t.slice(e,n),h=0;hr)&&(n=r),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var o=!1;;)switch(i){case"hex":return b(this,t,e,n);case"utf8":case"utf-8":return y(this,t,e,n);case"ascii":return x(this,t,e,n);case"latin1":case"binary":return w(this,t,e,n);case"base64":return M(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,t,e,n);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var T=4096;function k(t,e,n){var i="";n=Math.min(t.length,n);for(var r=e;ri)&&(n=i);for(var r="",o=e;on)throw new RangeError("Trying to access beyond buffer length")}function R(t,e,n,i,r,o){if(!c.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>r||et.length)throw new RangeError("Index out of range")}function I(t,e,n,i){e<0&&(e=65535+e+1);for(var r=0,o=Math.min(t.length-n,2);r>>8*(i?r:1-r)}function z(t,e,n,i){e<0&&(e=4294967295+e+1);for(var r=0,o=Math.min(t.length-n,4);r>>8*(i?r:3-r)&255}function B(t,e,n,i,r,o){if(n+i>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function N(t,e,n,i,o){return o||B(t,0,n,4),r.write(t,e,n,i,23,4),n+4}function D(t,e,n,i,o){return o||B(t,0,n,8),r.write(t,e,n,i,52,8),n+8}c.prototype.slice=function(t,e){var n,i=this.length;if((t=~~t)<0?(t+=i)<0&&(t=0):t>i&&(t=i),(e=void 0===e?i:~~e)<0?(e+=i)<0&&(e=0):e>i&&(e=i),e0&&(r*=256);)i+=this[t+--e]*r;return i},c.prototype.readUInt8=function(t,e){return e||C(t,1,this.length),this[t]},c.prototype.readUInt16LE=function(t,e){return e||C(t,2,this.length),this[t]|this[t+1]<<8},c.prototype.readUInt16BE=function(t,e){return e||C(t,2,this.length),this[t]<<8|this[t+1]},c.prototype.readUInt32LE=function(t,e){return e||C(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},c.prototype.readUInt32BE=function(t,e){return e||C(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},c.prototype.readIntLE=function(t,e,n){t|=0,e|=0,n||C(t,e,this.length);for(var i=this[t],r=1,o=0;++o=(r*=128)&&(i-=Math.pow(2,8*e)),i},c.prototype.readIntBE=function(t,e,n){t|=0,e|=0,n||C(t,e,this.length);for(var i=e,r=1,o=this[t+--i];i>0&&(r*=256);)o+=this[t+--i]*r;return o>=(r*=128)&&(o-=Math.pow(2,8*e)),o},c.prototype.readInt8=function(t,e){return e||C(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},c.prototype.readInt16LE=function(t,e){e||C(t,2,this.length);var n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt16BE=function(t,e){e||C(t,2,this.length);var n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt32LE=function(t,e){return e||C(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},c.prototype.readInt32BE=function(t,e){return e||C(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},c.prototype.readFloatLE=function(t,e){return e||C(t,4,this.length),r.read(this,t,!0,23,4)},c.prototype.readFloatBE=function(t,e){return e||C(t,4,this.length),r.read(this,t,!1,23,4)},c.prototype.readDoubleLE=function(t,e){return e||C(t,8,this.length),r.read(this,t,!0,52,8)},c.prototype.readDoubleBE=function(t,e){return e||C(t,8,this.length),r.read(this,t,!1,52,8)},c.prototype.writeUIntLE=function(t,e,n,i){(t=+t,e|=0,n|=0,i)||R(this,t,e,n,Math.pow(2,8*n)-1,0);var r=1,o=0;for(this[e]=255&t;++o=0&&(o*=256);)this[e+r]=t/o&255;return e+n},c.prototype.writeUInt8=function(t,e,n){return t=+t,e|=0,n||R(this,t,e,1,255,0),c.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},c.prototype.writeUInt16LE=function(t,e,n){return t=+t,e|=0,n||R(this,t,e,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):I(this,t,e,!0),e+2},c.prototype.writeUInt16BE=function(t,e,n){return t=+t,e|=0,n||R(this,t,e,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):I(this,t,e,!1),e+2},c.prototype.writeUInt32LE=function(t,e,n){return t=+t,e|=0,n||R(this,t,e,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):z(this,t,e,!0),e+4},c.prototype.writeUInt32BE=function(t,e,n){return t=+t,e|=0,n||R(this,t,e,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):z(this,t,e,!1),e+4},c.prototype.writeIntLE=function(t,e,n,i){if(t=+t,e|=0,!i){var r=Math.pow(2,8*n-1);R(this,t,e,n,r-1,-r)}var o=0,a=1,s=0;for(this[e]=255&t;++o>0)-s&255;return e+n},c.prototype.writeIntBE=function(t,e,n,i){if(t=+t,e|=0,!i){var r=Math.pow(2,8*n-1);R(this,t,e,n,r-1,-r)}var o=n-1,a=1,s=0;for(this[e+o]=255&t;--o>=0&&(a*=256);)t<0&&0===s&&0!==this[e+o+1]&&(s=1),this[e+o]=(t/a>>0)-s&255;return e+n},c.prototype.writeInt8=function(t,e,n){return t=+t,e|=0,n||R(this,t,e,1,127,-128),c.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},c.prototype.writeInt16LE=function(t,e,n){return t=+t,e|=0,n||R(this,t,e,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):I(this,t,e,!0),e+2},c.prototype.writeInt16BE=function(t,e,n){return t=+t,e|=0,n||R(this,t,e,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):I(this,t,e,!1),e+2},c.prototype.writeInt32LE=function(t,e,n){return t=+t,e|=0,n||R(this,t,e,4,2147483647,-2147483648),c.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):z(this,t,e,!0),e+4},c.prototype.writeInt32BE=function(t,e,n){return t=+t,e|=0,n||R(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),c.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):z(this,t,e,!1),e+4},c.prototype.writeFloatLE=function(t,e,n){return N(this,t,e,!0,n)},c.prototype.writeFloatBE=function(t,e,n){return N(this,t,e,!1,n)},c.prototype.writeDoubleLE=function(t,e,n){return D(this,t,e,!0,n)},c.prototype.writeDoubleBE=function(t,e,n){return D(this,t,e,!1,n)},c.prototype.copy=function(t,e,n,i){if(n||(n=0),i||0===i||(i=this.length),e>=t.length&&(e=t.length),e||(e=0),i>0&&i=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-e=0;--r)t[r+e]=this[r+n];else if(o<1e3||!c.TYPED_ARRAY_SUPPORT)for(r=0;r>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(o=e;o55295&&n<57344){if(!r){if(n>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(a+1===i){(e-=3)>-1&&o.push(239,191,189);continue}r=n;continue}if(n<56320){(e-=3)>-1&&o.push(239,191,189),r=n;continue}n=65536+(r-55296<<10|n-56320)}else r&&(e-=3)>-1&&o.push(239,191,189);if(r=null,n<128){if((e-=1)<0)break;o.push(n)}else if(n<2048){if((e-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function H(t){return i.toByteArray(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(j,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function q(t,e,n,i){for(var r=0;r=e.length||r>=t.length);++r)e[r+n]=t[r];return r}}).call(this,n(25))},function(t,e,n){"use strict";function i(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}Object.defineProperty(e,"__esModule",{value:!0}),i(n(173)),i(n(174)),i(n(175))},function(t,e,n){"use strict";var i=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e},r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const o=i(n(2)),a=r(n(89)),s=i(n(6)),c=new RegExp("^(((((\\*)|(/*)|(-*))(\\s*)%([aAbBdeHIjmMLpSUwWyYZ]{1}))+)|((\\s*)%([cxX]{1})))$");e.deepCopy=function t(e){if(a.default(e))return e.slice();if(s.isArray(e))return e.map(e=>t(e));if(s.isNumber(e)||s.isString(e))return e;if(s.isDate(e))return new Date(e.getTime());{const n={};for(let i in e)e.hasOwnProperty(i)&&(n[i]=t(e[i]));return n}},e.convert_dates=function(t){if(a.default(t))return t;const e=function(t){const e=new Float64Array(t.map(Number));return e.type="date",e};return t[0]instanceof Array&&t[0][0]instanceof Date?t=t.map(e):t[0]instanceof Date&&(t=e(t)),t},e.getCustomRange=function(t){const e=t[0],n=t[t.length-1];let i;return i=t[0]>t[1]?o.min(t):o.max(t),[o.scaleLinear().range([e,i]),o.scaleLinear().range([i,n])]},e.is_valid_time_format=function(t){return c.test(t)},e.is_array=function(t){return t instanceof Array||a.default(t)},e.getDate=function(t){return null==t?null:new Date(t)}},function(t,e,n){"use strict";var i=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e};Object.defineProperty(e,"__esModule",{value:!0});const r=i(n(10)),o=n(28),a=i(n(12));class s extends r.WidgetModel{defaults(){return Object.assign({},r.WidgetModel.prototype.defaults(),{_model_name:"MarkModel",_model_module:"bqplot",_view_module:"bqplot",_model_module_version:o.semver_range,_view_module_version:o.semver_range,scales:{},scales_metadata:{},preserve_domain:{},display_legend:!1,labels:[],apply_clip:!0,visible:!0,selected_style:{},unselected_style:{},selected:null,enable_hover:!0,tooltip:null,tooltip_style:{opacity:.9},interactions:{hover:"tooltip"},tooltip_location:"mouse"})}initialize(t,e){super.initialize(t,e),this.on("change:scales",this.update_scales,this),this.once("destroy",this.handle_destroy,this),this.dirty=!1,this.display_el_classes=["mark"],this.update_scales()}update_data(){this.update_domains(),this.trigger("data_updated")}update_domains(){}update_scales(){this.unregister_all_scales(this.previous("scales")),this.trigger("scales_updated"),this.update_domains()}unregister_all_scales(t){this.dirty=!0;for(let e in t)t[e].del_domain([],this.model_id+"_"+e);this.dirty=!1}handle_destroy(){this.unregister_all_scales(this.get("scales"))}get_key_for_dimension(t){const e=this.get("scales_metadata");for(let n in e)if(e[n].dimension===t)return n;return null}get_key_for_orientation(t){const e=this.get("scales_metadata");for(let n in e)if(e[n].orientation===t)return n;return null}get_data_dict(t,e){return t}}s.serializers=Object.assign({},r.WidgetModel.serializers,{scales:{deserialize:r.unpack_models},tooltip:{deserialize:r.unpack_models},selected:a.array_or_json}),e.MarkModel=s},function(t,e,n){"use strict";var i=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e};Object.defineProperty(e,"__esModule",{value:!0});const r=i(n(10)),o=i(n(2));n(31);const a=n(14),s=n(92),c=function(){return n(0).event}.bind(this),l=i(n(6));function u(t){return null!=t}e.Mark=class extends r.WidgetView{initialize(){this.setElement(document.createElementNS(o.namespaces.svg,"g")),this.d3el=o.select(this.el),super.initialize.apply(this,arguments)}render(){this.x_padding=0,this.y_padding=0,this.parent=this.options.parent,this.uuid=r.uuid();const t=this.set_scale_views();return this.listenTo(this.model,"scales_updated",()=>{this.set_scale_views().then(l.bind(this.draw,this))}),this.colors=this.model.get("colors"),this.options.clip_id&&this.model.get("apply_clip")&&this.d3el.attr("clip-path","url(#"+this.options.clip_id+")"),this.tooltip_div=o.select(document.createElement("div")).attr("class","mark_tooltip").attr("id","tooltip_"+this.uuid).style("display","none").style("opacity",0),this.bisect=o.bisector(function(t){return t}).left,this.d3el.style("display",this.model.get("visible")?"inline":"none"),this.display_el_classes=[],this.event_metadata={mouse_over:{msg_name:"hover",lookup_data:!0,hit_test:!0},legend_clicked:{msg_name:"legend_click",hit_test:!0},element_clicked:{msg_name:"element_click",lookup_data:!0,hit_test:!0},parent_clicked:{msg_name:"background_click",hit_test:!1},legend_mouse_over:{msg_name:"legend_hover",hit_test:!0}},t}set_scale_views(){for(var t in this.scales)this.stopListening(this.scales[t]);const e=this.model.get("scales"),n=this,i={};return l.each(e,function(t,e){i[e]=n.create_child_view(t)}),r.resolvePromisesDict(i).then(function(t){n.scales=t,n.set_positional_scales(),n.initialize_additional_scales(),n.set_ranges(),n.trigger("mark_scales_updated")})}set_positional_scales(){}initialize_additional_scales(){}set_internal_scales(){}create_listeners(){this.listenTo(this.model,"change:visible",this.update_visibility),this.listenTo(this.model,"change:selected_style",this.selected_style_updated),this.listenTo(this.model,"change:unselected_style",this.unselected_style_updated),this.parent.on("margin_updated",this.relayout,this),this.model.on_some_change(["labels","display_legend"],function(){this.model.trigger("redraw_legend")},this)}remove(){this.model.off(null,null,this),this.d3el.transition("remove").duration(0).remove(),this.tooltip_div.remove(),super.remove()}draw_legend(t,e,n,i,r){return t.selectAll(".legend"+this.uuid).remove(),t.append("g").attr("transform","translate("+e+", "+n+")").attr("class","legend"+this.uuid).on("mouseover",l.bind(this.highlight_axes,this)).on("mouseout",l.bind(this.unhighlight_axes,this)).append("text").text(this.model.get("labels")[0]),[1,1]}highlight_axes(){l.each(this.model.get("scales"),function(t){t.trigger("highlight_axis")})}unhighlight_axes(){l.each(this.model.get("scales"),function(t){t.trigger("unhighlight_axis")})}relayout(){}invert_range(t,e){return[t,e]}invert_point(t){}invert_multi_range(t){return t}update_visibility(t,e){this.d3el.style("display",e?"inline":"none")}get_colors(t){this.colors=this.model.get("colors");const e=this.colors.length;return this.colors[t%e]}get_mark_color(t,e){const n=this.scales.color,i=this.model.get("colors");return n&&void 0!==t.color&&null!==t.color?n.scale(t.color):i[e%i.length]}get_mark_opacity(t,e){const n=this.scales.opacity,i=this.model.get("opacities");return n&&void 0!==t.opacity&&null!==t.opacity?n.scale(t.opacity):i[e%i.length]}selected_style_updated(t,e){this.selected_style=e,this.clear_style(t.previous("selected_style"),this.selected_indices),this.style_updated(e,this.selected_indices)}unselected_style_updated(t,e){this.unselected_style=e;const n=this.selected_indices,i=n?l.range(this.model.mark_data.length).filter(function(t){return-1===n.indexOf(t)}):[];this.clear_style(t.previous("unselected_style"),i),this.style_updated(e,i)}style_updated(t,e,n){this.set_default_style(e),this.set_style_on_elements(t,e)}apply_styles(t){void 0!==t&&null!=t||(t=[this.selected_style,this.unselected_style]);const e=l.range(this.model.mark_data.length);for(var n=0;n0}}},function(t,e,n){"use strict";var i=e;i.version=n(224).version,i.utils=n(225),i.rand=n(116),i.curve=n(57),i.curves=n(230),i.ec=n(238),i.eddsa=n(242)},function(t,e,n){"use strict";(function(t){Object.defineProperty(e,"__esModule",{value:!0});var i,r=n(9),o=function(){function t(t){this.sender=t}return t.prototype.connect=function(t,e){return i.connect(this,t,e)},t.prototype.disconnect=function(t,e){return i.disconnect(this,t,e)},t.prototype.emit=function(t){i.emit(this,t)},t}();e.Signal=o,function(t){t.disconnectBetween=function(t,e){i.disconnectBetween(t,e)},t.disconnectSender=function(t){i.disconnectSender(t)},t.disconnectReceiver=function(t){i.disconnectReceiver(t)},t.disconnectAll=function(t){i.disconnectAll(t)},t.clearData=function(t){i.disconnectAll(t)},t.getExceptionHandler=function(){return i.exceptionHandler},t.setExceptionHandler=function(t){var e=i.exceptionHandler;return i.exceptionHandler=t,e}}(o=e.Signal||(e.Signal={})),e.Signal=o,function(e){e.exceptionHandler=function(t){console.error(t)},e.connect=function(t,e,r){r=r||void 0;var o=n.get(t.sender);if(o||(o=[],n.set(t.sender,o)),s(o,t,e,r))return!1;var a=r||e,c=i.get(a);c||(c=[],i.set(a,c));var l={signal:t,slot:e,thisArg:r};return o.push(l),c.push(l),!0},e.disconnect=function(t,e,r){r=r||void 0;var o=n.get(t.sender);if(!o||0===o.length)return!1;var a=s(o,t,e,r);if(!a)return!1;var c=r||e,u=i.get(c);return a.signal=null,l(o),l(u),!0},e.disconnectBetween=function(t,e){var o=n.get(t);if(o&&0!==o.length){var a=i.get(e);a&&0!==a.length&&(r.each(a,function(e){e.signal&&e.signal.sender===t&&(e.signal=null)}),l(o),l(a))}},e.disconnectSender=function(t){var e=n.get(t);e&&0!==e.length&&(r.each(e,function(t){if(t.signal){var e=t.thisArg||t.slot;t.signal=null,l(i.get(e))}}),l(e))},e.disconnectReceiver=function(t){var e=i.get(t);e&&0!==e.length&&(r.each(e,function(t){if(t.signal){var e=t.signal.sender;t.signal=null,l(n.get(e))}}),l(e))},e.disconnectAll=function(t){var e=n.get(t);e&&e.length>0&&(r.each(e,function(t){t.signal=null}),l(e));var o=i.get(t);o&&o.length>0&&(r.each(o,function(t){t.signal=null}),l(o))},e.emit=function(t,e){var i=n.get(t.sender);if(i&&0!==i.length)for(var r=0,o=i.length;r=0&&(n=t.slice(i+1),t=t.slice(0,i)),t&&!e.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:n}})}function s(t,e){for(var n,i=0,r=t.length;i0)for(var n,i,r=new Array(n),o=0;oc)throw new Error("too late; already scheduled");return n}function _(t,e){var n=v(t,e);if(n.state>h)throw new Error("too late; already running");return n}function v(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}var b=function(t,e){var n,i,r,o=t.__transition,a=!0;if(o){for(r in e=null==e?null:e+"",o)(n=o[r]).name===e?(i=n.state>u&&n.state=0&&(t=t.slice(0,e)),!t||"start"===t})}(e)?g:_;return function(){var a=o(this,t),s=a.on;s!==i&&(r=(i=s).copy()).on(e,n),a.on=r}}var I=i.selection.prototype.constructor;function z(t){return function(){this.style.removeProperty(t)}}function B(t,e,n){var i,r;function o(){var o=e.apply(this,arguments);return o!==r&&(i=(r=o)&&function(t,e,n){return function(i){this.style.setProperty(t,e(i),n)}}(t,o,n)),i}return o._value=e,o}var N=0;function D(t,e,n,i){this._groups=t,this._parents=e,this._name=n,this._id=i}function j(t){return Object(i.selection)().transition(t)}function U(){return++N}var F=i.selection.prototype;D.prototype=j.prototype={constructor:D,select:function(t){var e=this._name,n=this._id;"function"!=typeof t&&(t=Object(i.selector)(t));for(var r=this._groups,o=r.length,a=new Array(o),s=0;sl&&n.name===e)return new D([[t]],G,e,+i);return null};n.d(e,"c",function(){return j}),n.d(e,"a",function(){return W}),n.d(e,"b",function(){return b})},function(t,e){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e,n){"use strict";var i,r,o=0,a=0,s=0,c=1e3,l=0,u=0,h=0,d="object"==typeof performance&&performance.now?performance:Date,f="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function p(){return u||(f(m),u=d.now()+h)}function m(){u=0}function g(){this._call=this._time=this._next=null}function _(t,e,n){var i=new g;return i.restart(t,e,n),i}function v(){p(),++o;for(var t,e=i;e;)(t=u-e._time)>=0&&e._call.call(null,t),e=e._next;--o}function b(){u=(l=d.now())+h,o=a=0;try{v()}finally{o=0,function(){var t,e,n=i,o=1/0;for(;n;)n._call?(o>n._time&&(o=n._time),t=n,n=n._next):(e=n._next,n._next=null,n=t?t._next=e:i=e);r=t,x(o)}(),u=0}}function y(){var t=d.now(),e=t-l;e>c&&(h-=e,l=t)}function x(t){o||(a&&(a=clearTimeout(a)),t-u>24?(t<1/0&&(a=setTimeout(b,t-d.now()-h)),s&&(s=clearInterval(s))):(s||(l=d.now(),s=setInterval(y,c)),o=1,f(b)))}g.prototype=_.prototype={constructor:g,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?p():+n)+(null==e?0:+e),this._next||r===this||(r?r._next=this:i=this,r=this),this._call=t,this._time=n,x()},stop:function(){this._call&&(this._call=null,this._time=1/0,x())}};var w=function(t,e,n){var i=new g;return e=null==e?0:+e,i.restart(function(n){i.stop(),t(n+e)},e,n),i},M=function(t,e,n){var i=new g,r=e;return null==e?(i.restart(t,e,n),i):(e=+e,n=null==n?p():+n,i.restart(function o(a){a+=r,i.restart(o,r+=e,n),t(a)},e,n),i)};n.d(e,"b",function(){return p}),n.d(e,"d",function(){return _}),n.d(e,"e",function(){return v}),n.d(e,"c",function(){return w}),n.d(e,"a",function(){return M})},function(t,e,n){"use strict";var i=function(t,e){if((n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var n,i=t.slice(0,n);return[i.length>1?i[0]+i.slice(2):i,+t.slice(n+1)]},r=function(t){return(t=i(Math.abs(t)))?t[1]:NaN},o=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function a(t){return new s(t)}function s(t){if(!(e=o.exec(t)))throw new Error("invalid format: "+t);var e;this.fill=e[1]||" ",this.align=e[2]||">",this.sign=e[3]||"-",this.symbol=e[4]||"",this.zero=!!e[5],this.width=e[6]&&+e[6],this.comma=!!e[7],this.precision=e[8]&&+e[8].slice(1),this.trim=!!e[9],this.type=e[10]||""}a.prototype=s.prototype,s.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(null==this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(null==this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};var c,l,u,h,d=function(t){t:for(var e,n=t.length,i=1,r=-1;i0){if(!+t[i])break t;r=0}}return r>0?t.slice(0,r)+t.slice(e+1):t},f=function(t,e){var n=i(t,e);if(!n)return t+"";var r=n[0],o=n[1];return o<0?"0."+new Array(-o).join("0")+r:r.length>o+1?r.slice(0,o+1)+"."+r.slice(o+1):r+new Array(o-r.length+2).join("0")},p={"%":function(t,e){return(100*t).toFixed(e)},b:function(t){return Math.round(t).toString(2)},c:function(t){return t+""},d:function(t){return Math.round(t).toString(10)},e:function(t,e){return t.toExponential(e)},f:function(t,e){return t.toFixed(e)},g:function(t,e){return t.toPrecision(e)},o:function(t){return Math.round(t).toString(8)},p:function(t,e){return f(100*t,e)},r:f,s:function(t,e){var n=i(t,e);if(!n)return t+"";var r=n[0],o=n[1],a=o-(c=3*Math.max(-8,Math.min(8,Math.floor(o/3))))+1,s=r.length;return a===s?r:a>s?r+new Array(a-s+1).join("0"):a>0?r.slice(0,a)+"."+r.slice(a):"0."+new Array(1-a).join("0")+i(t,Math.max(0,e+a-1))[0]},X:function(t){return Math.round(t).toString(16).toUpperCase()},x:function(t){return Math.round(t).toString(16)}},m=function(t){return t},g=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"],_=function(t){var e,n,i=t.grouping&&t.thousands?(e=t.grouping,n=t.thousands,function(t,i){for(var r=t.length,o=[],a=0,s=e[0],c=0;r>0&&s>0&&(c+s+1>i&&(s=Math.max(1,i-c)),o.push(t.substring(r-=s,r+s)),!((c+=s+1)>i));)s=e[a=(a+1)%e.length];return o.reverse().join(n)}):m,o=t.currency,s=t.decimal,l=t.numerals?function(t){return function(e){return e.replace(/[0-9]/g,function(e){return t[+e]})}}(t.numerals):m,u=t.percent||"%";function h(t){var e=(t=a(t)).fill,n=t.align,r=t.sign,h=t.symbol,f=t.zero,m=t.width,_=t.comma,v=t.precision,b=t.trim,y=t.type;"n"===y?(_=!0,y="g"):p[y]||(null==v&&(v=12),b=!0,y="g"),(f||"0"===e&&"="===n)&&(f=!0,e="0",n="=");var x="$"===h?o[0]:"#"===h&&/[boxX]/.test(y)?"0"+y.toLowerCase():"",w="$"===h?o[1]:/[%p]/.test(y)?u:"",M=p[y],E=/[defgprs%]/.test(y);function S(t){var o,a,u,h=x,p=w;if("c"===y)p=M(t)+p,t="";else{var S=(t=+t)<0;if(t=M(Math.abs(t),v),b&&(t=d(t)),S&&0==+t&&(S=!1),h=(S?"("===r?r:"-":"-"===r||"("===r?"":r)+h,p=("s"===y?g[8+c/3]:"")+p+(S&&"("===r?")":""),E)for(o=-1,a=t.length;++o(u=t.charCodeAt(o))||u>57){p=(46===u?s+t.slice(o+1):t.slice(o))+p,t=t.slice(0,o);break}}_&&!f&&(t=i(t,1/0));var A=h.length+t.length+p.length,T=A>1)+h+t+p+T.slice(A);break;default:t=T+h+t+p}return l(t)}return v=null==v?6:/[gprs]/.test(y)?Math.max(1,Math.min(21,v)):Math.max(0,Math.min(20,v)),S.toString=function(){return t+""},S}return{format:h,formatPrefix:function(t,e){var n=h(((t=a(t)).type="f",t)),i=3*Math.max(-8,Math.min(8,Math.floor(r(e)/3))),o=Math.pow(10,-i),s=g[8+i/3];return function(t){return n(o*t)+s}}}};function v(t){return l=_(t),u=l.format,h=l.formatPrefix,l}v({decimal:".",thousands:",",grouping:[3],currency:["$",""]});var b=function(t){return Math.max(0,-r(Math.abs(t)))},y=function(t,e){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(r(e)/3)))-r(Math.abs(t)))},x=function(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,r(e)-r(t))+1};n.d(e,"b",function(){return v}),n.d(e,"a",function(){return u}),n.d(e,"d",function(){return h}),n.d(e,"c",function(){return _}),n.d(e,"e",function(){return a}),n.d(e,"f",function(){return b}),n.d(e,"g",function(){return y}),n.d(e,"h",function(){return x})},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.semver_range="^"+n(91).version},function(t,e,n){"use strict";function i(t){return"function"==typeof t.iter?t.iter():new r(t)}Object.defineProperty(e,"__esModule",{value:!0}),e.iter=i,e.each=function(t,e){for(var n,r=0,o=i(t);void 0!==(n=o.next());)if(!1===e(n,r++))return},e.every=function(t,e){for(var n,r=0,o=i(t);void 0!==(n=o.next());)if(!e(n,r++))return!1;return!0},e.some=function(t,e){for(var n,r=0,o=i(t);void 0!==(n=o.next());)if(e(n,r++))return!0;return!1},e.toArray=function(t){for(var e,n=0,r=[],o=i(t);void 0!==(e=o.next());)r[n++]=e;return r};var r=function(){function t(t){this._index=0,this._source=t}return t.prototype.iter=function(){return this},t.prototype.clone=function(){var e=new t(this._source);return e._index=this._index,e},t.prototype.next=function(){if(!(this._index>=this._source.length))return this._source[this._index++]},t}();e.ArrayIterator=r},function(t,e,n){"use strict";var i=n(22),r=n(4);function o(t,e){return 55296==(64512&t.charCodeAt(e))&&(!(e<0||e+1>=t.length)&&56320==(64512&t.charCodeAt(e+1)))}function a(t){return(t>>>24|t>>>8&65280|t<<8&16711680|(255&t)<<24)>>>0}function s(t){return 1===t.length?"0"+t:t}function c(t){return 7===t.length?"0"+t:6===t.length?"00"+t:5===t.length?"000"+t:4===t.length?"0000"+t:3===t.length?"00000"+t:2===t.length?"000000"+t:1===t.length?"0000000"+t:t}e.inherits=r,e.toArray=function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var n=[];if("string"==typeof t)if(e){if("hex"===e)for((t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t),r=0;r>6|192,n[i++]=63&a|128):o(t,r)?(a=65536+((1023&a)<<10)+(1023&t.charCodeAt(++r)),n[i++]=a>>18|240,n[i++]=a>>12&63|128,n[i++]=a>>6&63|128,n[i++]=63&a|128):(n[i++]=a>>12|224,n[i++]=a>>6&63|128,n[i++]=63&a|128)}else for(r=0;r>>0}return a},e.split32=function(t,e){for(var n=new Array(4*t.length),i=0,r=0;i>>24,n[r+1]=o>>>16&255,n[r+2]=o>>>8&255,n[r+3]=255&o):(n[r+3]=o>>>24,n[r+2]=o>>>16&255,n[r+1]=o>>>8&255,n[r]=255&o)}return n},e.rotr32=function(t,e){return t>>>e|t<<32-e},e.rotl32=function(t,e){return t<>>32-e},e.sum32=function(t,e){return t+e>>>0},e.sum32_3=function(t,e,n){return t+e+n>>>0},e.sum32_4=function(t,e,n,i){return t+e+n+i>>>0},e.sum32_5=function(t,e,n,i,r){return t+e+n+i+r>>>0},e.sum64=function(t,e,n,i){var r=t[e],o=i+t[e+1]>>>0,a=(o>>0,t[e+1]=o},e.sum64_hi=function(t,e,n,i){return(e+i>>>0>>0},e.sum64_lo=function(t,e,n,i){return e+i>>>0},e.sum64_4_hi=function(t,e,n,i,r,o,a,s){var c=0,l=e;return c+=(l=l+i>>>0)>>0)>>0)>>0},e.sum64_4_lo=function(t,e,n,i,r,o,a,s){return e+i+o+s>>>0},e.sum64_5_hi=function(t,e,n,i,r,o,a,s,c,l){var u=0,h=e;return u+=(h=h+i>>>0)>>0)>>0)>>0)>>0},e.sum64_5_lo=function(t,e,n,i,r,o,a,s,c,l){return e+i+o+s+l>>>0},e.rotr64_hi=function(t,e,n){return(e<<32-n|t>>>n)>>>0},e.rotr64_lo=function(t,e,n){return(t<<32-n|e>>>n)>>>0},e.shr64_hi=function(t,e,n){return t>>>n},e.shr64_lo=function(t,e,n){return(t<<32-n|e>>>n)>>>0}},function(t,e,n){"use strict";n.r(e);var i=n(0),r=n(24);i.selection.prototype.attrs=function(t){return("function"==typeof t?function(t,e){return t.each(function(){var t=e.apply(this,arguments),n=Object(i.select)(this);for(var r in t)n.attr(r,t[r])})}:function(t,e){for(var n in e)t.attr(n,e[n]);return t})(this,t)},i.selection.prototype.styles=function(t,e){return("function"==typeof t?function(t,e,n){return t.each(function(){var t=e.apply(this,arguments),r=Object(i.select)(this);for(var o in t)r.style(o,t[o],n)})}:function(t,e,n){for(var i in e)t.style(i,e[i],n);return t})(this,t,null==e?"":e)},i.selection.prototype.properties=function(t){return("function"==typeof t?function(t,e){return t.each(function(){var t=e.apply(this,arguments),n=Object(i.select)(this);for(var r in t)n.property(r,t[r])})}:function(t,e){for(var n in e)t.property(n,e[n]);return t})(this,t)},r.c.prototype.attrs=function(t){return("function"==typeof t?function(t,e){return t.each(function(){var n=e.apply(this,arguments),r=Object(i.select)(this).transition(t);for(var o in n)r.attr(o,n[o])})}:function(t,e){for(var n in e)t.attr(n,e[n]);return t})(this,t)},r.c.prototype.styles=function(t,e){return("function"==typeof t?function(t,e,n){return t.each(function(){var r=e.apply(this,arguments),o=Object(i.select)(this).transition(t);for(var a in r)o.style(a,r[a],n)})}:function(t,e,n){for(var i in e)t.style(i,e[i],n);return t})(this,t,null==e?"":e)}},function(t,e,n){"use strict";function i(){}function r(t,e){var n=new i;if(t instanceof i)t.each(function(t,e){n.set(e,t)});else if(Array.isArray(t)){var r,o=-1,a=t.length;if(null==e)for(;++o=i.length)return null!=t&&n.sort(t),null!=e?e(n):n;for(var l,u,h,d=-1,f=n.length,p=i[r++],m=o(),g=s();++di.length)return n;var a,s=r[o-1];return null!=e&&o>=i.length?a=n.entries():(a=[],n.each(function(e,n){a.push({key:n,values:t(e,o)})})),null!=s?a.sort(function(t,e){return s(t.key,e.key)}):a}(a(t,0,l,u),0)},key:function(t){return i.push(t),n},sortKeys:function(t){return r[i.length-1]=t,n},sortValues:function(e){return t=e,n},rollup:function(t){return e=t,n}}};function s(){return{}}function c(t,e,n){t[e]=n}function l(){return o()}function u(t,e,n){t.set(e,n)}function h(){}var d=o.prototype;function f(t,e){var n=new h;if(t instanceof h)t.each(function(t){n.add(t)});else if(t){var i=-1,r=t.length;if(null==e)for(;++i1)for(var n=1;no)throw new RangeError("requested too many random bytes");var n=a.allocUnsafe(t);if(t>0)if(t>r)for(var c=0;c=this._finalSize&&(this._update(this._block),this._block.fill(0));var n=8*this._len;if(n<=4294967295)this._block.writeUInt32BE(n,this._blockSize-4);else{var i=(4294967295&n)>>>0,r=(n-i)/4294967296;this._block.writeUInt32BE(r,this._blockSize-8),this._block.writeUInt32BE(i,this._blockSize-4)}this._update(this._block);var o=this._hash();return t?o.toString(t):o},r.prototype._update=function(){throw new Error("_update must be implemented by subclass")},t.exports=r},function(t,e,n){"use strict";var i=n(3);function r(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 o(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 a(t){return{y:t,m:0,d:1,H:0,M:0,S:0,L:0}}function s(t){var e=t.dateTime,n=t.date,s=t.time,c=t.periods,l=t.days,u=t.shortDays,h=t.months,d=t.shortMonths,p=b(c),m=y(c),g=b(l),_=y(l),v=b(u),Mt=y(u),Et=b(h),St=y(h),At=b(d),Tt=y(d),kt={a:function(t){return u[t.getDay()]},A:function(t){return l[t.getDay()]},b:function(t){return d[t.getMonth()]},B:function(t){return h[t.getMonth()]},c:null,d:U,e:U,f:W,H:F,I:H,j:q,L:G,m:V,M:X,p:function(t){return c[+(t.getHours()>=12)]},Q:xt,s:wt,S:Y,u:K,U:Z,V:J,w:Q,W:$,x:null,X:null,y:tt,Y:et,Z:nt,"%":yt},Pt={a:function(t){return u[t.getUTCDay()]},A:function(t){return l[t.getUTCDay()]},b:function(t){return d[t.getUTCMonth()]},B:function(t){return h[t.getUTCMonth()]},c:null,d:it,e:it,f:ct,H:rt,I:ot,j:at,L:st,m:lt,M:ut,p:function(t){return c[+(t.getUTCHours()>=12)]},Q:xt,s:wt,S:ht,u:dt,U:ft,V:pt,w:mt,W:gt,x:null,X:null,y:_t,Y:vt,Z:bt,"%":yt},Lt={a:function(t,e,n){var i=v.exec(e.slice(n));return i?(t.w=Mt[i[0].toLowerCase()],n+i[0].length):-1},A:function(t,e,n){var i=g.exec(e.slice(n));return i?(t.w=_[i[0].toLowerCase()],n+i[0].length):-1},b:function(t,e,n){var i=At.exec(e.slice(n));return i?(t.m=Tt[i[0].toLowerCase()],n+i[0].length):-1},B:function(t,e,n){var i=Et.exec(e.slice(n));return i?(t.m=St[i[0].toLowerCase()],n+i[0].length):-1},c:function(t,n,i){return Rt(t,e,n,i)},d:L,e:L,f:B,H:C,I:C,j:O,L:z,m:P,M:R,p:function(t,e,n){var i=p.exec(e.slice(n));return i?(t.p=m[i[0].toLowerCase()],n+i[0].length):-1},Q:D,s:j,S:I,u:w,U:M,V:E,w:x,W:S,x:function(t,e,i){return Rt(t,n,e,i)},X:function(t,e,n){return Rt(t,s,e,n)},y:T,Y:A,Z:k,"%":N};function Ot(t,e){return function(n){var i,r,o,a=[],s=-1,c=0,l=t.length;for(n instanceof Date||(n=new Date(+n));++s53)return null;"w"in c||(c.w=1),"Z"in c?(s=(r=o(a(c.y))).getUTCDay(),r=s>4||0===s?i.P.ceil(r):Object(i.P)(r),r=i.F.offset(r,7*(c.V-1)),c.y=r.getUTCFullYear(),c.m=r.getUTCMonth(),c.d=r.getUTCDate()+(c.w+6)%7):(s=(r=e(a(c.y))).getDay(),r=s>4||0===s?i.l.ceil(r):Object(i.l)(r),r=i.a.offset(r,7*(c.V-1)),c.y=r.getFullYear(),c.m=r.getMonth(),c.d=r.getDate()+(c.w+6)%7)}else("W"in c||"U"in c)&&("w"in c||(c.w="u"in c?c.u%7:"W"in c?1:0),s="Z"in c?o(a(c.y)).getUTCDay():e(a(c.y)).getDay(),c.m=0,c.d="W"in c?(c.w+6)%7+7*c.W-(s+5)%7:c.w+7*c.U-(s+6)%7);return"Z"in c?(c.H+=c.Z/100|0,c.M+=c.Z%100,o(c)):e(c)}}function Rt(t,e,n,i){for(var r,o,a=0,s=e.length,c=n.length;a=c)return-1;if(37===(r=e.charCodeAt(a++))){if(r=e.charAt(a++),!(o=Lt[r in f?e.charAt(a++):r])||(i=o(t,n,i))<0)return-1}else if(r!=n.charCodeAt(i++))return-1}return i}return kt.x=Ot(n,kt),kt.X=Ot(s,kt),kt.c=Ot(e,kt),Pt.x=Ot(n,Pt),Pt.X=Ot(s,Pt),Pt.c=Ot(e,Pt),{format:function(t){var e=Ot(t+="",kt);return e.toString=function(){return t},e},parse:function(t){var e=Ct(t+="",r);return e.toString=function(){return t},e},utcFormat:function(t){var e=Ot(t+="",Pt);return e.toString=function(){return t},e},utcParse:function(t){var e=Ct(t,o);return e.toString=function(){return t},e}}}var c,l,u,h,d,f={"-":"",_:" ",0:"0"},p=/^\s*\d+/,m=/^%/,g=/[\\^$*+?|[\]().{}]/g;function _(t,e,n){var i=t<0?"-":"",r=(i?-t:t)+"",o=r.length;return i+(o68?1900:2e3),n+i[0].length):-1}function k(t,e,n){var i=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(n,n+6));return i?(t.Z=i[1]?0:-(i[2]+(i[3]||"00")),n+i[0].length):-1}function P(t,e,n){var i=p.exec(e.slice(n,n+2));return i?(t.m=i[0]-1,n+i[0].length):-1}function L(t,e,n){var i=p.exec(e.slice(n,n+2));return i?(t.d=+i[0],n+i[0].length):-1}function O(t,e,n){var i=p.exec(e.slice(n,n+3));return i?(t.m=0,t.d=+i[0],n+i[0].length):-1}function C(t,e,n){var i=p.exec(e.slice(n,n+2));return i?(t.H=+i[0],n+i[0].length):-1}function R(t,e,n){var i=p.exec(e.slice(n,n+2));return i?(t.M=+i[0],n+i[0].length):-1}function I(t,e,n){var i=p.exec(e.slice(n,n+2));return i?(t.S=+i[0],n+i[0].length):-1}function z(t,e,n){var i=p.exec(e.slice(n,n+3));return i?(t.L=+i[0],n+i[0].length):-1}function B(t,e,n){var i=p.exec(e.slice(n,n+6));return i?(t.L=Math.floor(i[0]/1e3),n+i[0].length):-1}function N(t,e,n){var i=m.exec(e.slice(n,n+1));return i?n+i[0].length:-1}function D(t,e,n){var i=p.exec(e.slice(n));return i?(t.Q=+i[0],n+i[0].length):-1}function j(t,e,n){var i=p.exec(e.slice(n));return i?(t.Q=1e3*+i[0],n+i[0].length):-1}function U(t,e){return _(t.getDate(),e,2)}function F(t,e){return _(t.getHours(),e,2)}function H(t,e){return _(t.getHours()%12||12,e,2)}function q(t,e){return _(1+i.a.count(Object(i.D)(t),t),e,3)}function G(t,e){return _(t.getMilliseconds(),e,3)}function W(t,e){return G(t,e)+"000"}function V(t,e){return _(t.getMonth()+1,e,2)}function X(t,e){return _(t.getMinutes(),e,2)}function Y(t,e){return _(t.getSeconds(),e,2)}function K(t){var e=t.getDay();return 0===e?7:e}function Z(t,e){return _(i.t.count(Object(i.D)(t),t),e,2)}function J(t,e){var n=t.getDay();return t=n>=4||0===n?Object(i.v)(t):i.v.ceil(t),_(i.v.count(Object(i.D)(t),t)+(4===Object(i.D)(t).getDay()),e,2)}function Q(t){return t.getDay()}function $(t,e){return _(i.l.count(Object(i.D)(t),t),e,2)}function tt(t,e){return _(t.getFullYear()%100,e,2)}function et(t,e){return _(t.getFullYear()%1e4,e,4)}function nt(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+_(e/60|0,"0",2)+_(e%60,"0",2)}function it(t,e){return _(t.getUTCDate(),e,2)}function rt(t,e){return _(t.getUTCHours(),e,2)}function ot(t,e){return _(t.getUTCHours()%12||12,e,2)}function at(t,e){return _(1+i.F.count(Object(i.hb)(t),t),e,3)}function st(t,e){return _(t.getUTCMilliseconds(),e,3)}function ct(t,e){return st(t,e)+"000"}function lt(t,e){return _(t.getUTCMonth()+1,e,2)}function ut(t,e){return _(t.getUTCMinutes(),e,2)}function ht(t,e){return _(t.getUTCSeconds(),e,2)}function dt(t){var e=t.getUTCDay();return 0===e?7:e}function ft(t,e){return _(i.X.count(Object(i.hb)(t),t),e,2)}function pt(t,e){var n=t.getUTCDay();return t=n>=4||0===n?Object(i.Z)(t):i.Z.ceil(t),_(i.Z.count(Object(i.hb)(t),t)+(4===Object(i.hb)(t).getUTCDay()),e,2)}function mt(t){return t.getUTCDay()}function gt(t,e){return _(i.P.count(Object(i.hb)(t),t),e,2)}function _t(t,e){return _(t.getUTCFullYear()%100,e,2)}function vt(t,e){return _(t.getUTCFullYear()%1e4,e,4)}function bt(){return"+0000"}function yt(){return"%"}function xt(t){return+t}function wt(t){return Math.floor(+t/1e3)}function Mt(t){return c=s(t),l=c.format,u=c.parse,h=c.utcFormat,d=c.utcParse,c}Mt({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 Et=Date.prototype.toISOString?function(t){return t.toISOString()}:h("%Y-%m-%dT%H:%M:%S.%LZ");var St=+new Date("2000-01-01T00:00:00.000Z")?function(t){var e=new Date(t);return isNaN(e)?null:e}:d("%Y-%m-%dT%H:%M:%S.%LZ");n.d(e,"d",function(){return Mt}),n.d(e,"c",function(){return l}),n.d(e,"f",function(){return u}),n.d(e,"g",function(){return h}),n.d(e,"h",function(){return d}),n.d(e,"e",function(){return s}),n.d(e,"a",function(){return Et}),n.d(e,"b",function(){return St})},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){this.sizeHint=0,this.minSize=0,this.maxSize=1/0,this.stretch=1,this.size=0,this.done=!1};e.BoxSizer=i,function(t){t.calc=function(t,e){var n=t.length;if(0===n)return e;for(var i=0,r=0,o=0,a=0,s=0,c=0;c0&&(a+=_.stretch,s++)}if(e===o)return 0;if(e<=i){for(c=0;c=r){for(c=0;c0&&f>.01;){var p=f,m=a;for(c=0;c0&&f>.01;)for(g=f/d,c=0;c0&&f>.01;)for(p=f,m=a,c=0;c=_.maxSize?(f-=_.maxSize-_.size,a-=_.stretch,_.size=_.maxSize,_.done=!0,d--,s--):(f-=g,_.size+=g));for(;d>0&&f>.01;)for(g=f/d,c=0;c=_.maxSize?(f-=_.maxSize-_.size,_.size=_.maxSize,_.done=!0,d--):(f-=g,_.size+=g))}}return 0},t.adjust=function(t,e,n){0!==t.length&&0!==n&&(n>0?function(t,e,n){for(var i=0,r=0;r<=e;++r){var o=t[r];i+=o.maxSize-o.size}for(var a=0,r=e+1,s=t.length;r=0&&c>0;--r){var o=t[r],l=o.maxSize-o.size;l>=c?(o.sizeHint=o.size+c,c=0):(o.sizeHint=o.size+l,c-=l)}for(var u=n,r=e+1,s=t.length;r0;++r){var o=t[r],l=o.size-o.minSize;l>=u?(o.sizeHint=o.size-u,u=0):(o.sizeHint=o.size-l,u-=l)}}(t,e,n):function(t,e,n){for(var i=0,r=e+1,o=t.length;r0;++r){var a=t[r],l=a.maxSize-a.size;l>=c?(a.sizeHint=a.size+c,c=0):(a.sizeHint=a.size+l,c-=l)}for(var u=n,r=e;r>=0&&u>0;--r){var a=t[r],l=a.size-a.minSize;l>=u?(a.sizeHint=a.size-u,u=0):(a.sizeHint=a.size-l,u-=l)}}(t,e,-n))}}(e.BoxEngine||(e.BoxEngine={}))},function(t,e,n){"use strict";var i,r=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o=n(9),a=n(14),s=n(34),c=n(13),l=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._widgets=[],e}return r(e,t),e.prototype.dispose=function(){for(;this._widgets.length>0;)this._widgets.pop().dispose();t.prototype.dispose.call(this)},Object.defineProperty(e.prototype,"widgets",{get:function(){return this._widgets},enumerable:!0,configurable:!0}),e.prototype.iter=function(){return o.iter(this._widgets)},e.prototype.addWidget=function(t){this.insertWidget(this._widgets.length,t)},e.prototype.insertWidget=function(t,e){e.parent=this.parent;var n=this._widgets.indexOf(e),i=Math.max(0,Math.min(t,this._widgets.length));if(-1===n)return o.ArrayExt.insert(this._widgets,i,e),void(this.parent&&this.attachWidget(i,e));i===this._widgets.length&&i--,n!==i&&(o.ArrayExt.move(this._widgets,n,i),this.parent&&this.moveWidget(n,i,e))},e.prototype.removeWidget=function(t){this.removeWidgetAt(this._widgets.indexOf(t))},e.prototype.removeWidgetAt=function(t){var e=o.ArrayExt.removeAt(this._widgets,t);e&&this.parent&&this.detachWidget(t,e)},e.prototype.init=function(){var e=this;t.prototype.init.call(this),o.each(this,function(t,n){e.attachWidget(n,t)})},e.prototype.attachWidget=function(t,e){var n=this.parent.node.children[t];this.parent.isAttached&&a.MessageLoop.sendMessage(e,c.Widget.Msg.BeforeAttach),this.parent.node.insertBefore(e.node,n),this.parent.isAttached&&a.MessageLoop.sendMessage(e,c.Widget.Msg.AfterAttach)},e.prototype.moveWidget=function(t,e,n){this.parent.isAttached&&a.MessageLoop.sendMessage(n,c.Widget.Msg.BeforeDetach),this.parent.node.removeChild(n.node),this.parent.isAttached&&a.MessageLoop.sendMessage(n,c.Widget.Msg.AfterDetach);var i=this.parent.node.children[e];this.parent.isAttached&&a.MessageLoop.sendMessage(n,c.Widget.Msg.BeforeAttach),this.parent.node.insertBefore(n.node,i),this.parent.isAttached&&a.MessageLoop.sendMessage(n,c.Widget.Msg.AfterAttach)},e.prototype.detachWidget=function(t,e){this.parent.isAttached&&a.MessageLoop.sendMessage(e,c.Widget.Msg.BeforeDetach),this.parent.node.removeChild(e.node),this.parent.isAttached&&a.MessageLoop.sendMessage(e,c.Widget.Msg.AfterDetach)},e}(s.Layout);e.PanelLayout=l},function(t,e,n){"use strict";var i=n(4),r=n(68),o=n(74),a=n(75),s=n(35);function c(t){s.call(this,"digest"),this._hash=t}i(c,s),c.prototype._update=function(t){this._hash.update(t)},c.prototype._final=function(){return this._hash.digest()},t.exports=function(t){return"md5"===(t=t.toLowerCase())?new r:"rmd160"===t||"ripemd160"===t?new o:new c(a(t))}},function(t,e,n){(function(t){function n(t){return Object.prototype.toString.call(t)}e.isArray=function(t){return Array.isArray?Array.isArray(t):"[object Array]"===n(t)},e.isBoolean=function(t){return"boolean"==typeof t},e.isNull=function(t){return null===t},e.isNullOrUndefined=function(t){return null==t},e.isNumber=function(t){return"number"==typeof t},e.isString=function(t){return"string"==typeof t},e.isSymbol=function(t){return"symbol"==typeof t},e.isUndefined=function(t){return void 0===t},e.isRegExp=function(t){return"[object RegExp]"===n(t)},e.isObject=function(t){return"object"==typeof t&&null!==t},e.isDate=function(t){return"[object Date]"===n(t)},e.isError=function(t){return"[object Error]"===n(t)||t instanceof Error},e.isFunction=function(t){return"function"==typeof t},e.isPrimitive=function(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t},e.isBuffer=t.isBuffer}).call(this,n(15).Buffer)},function(t,e,n){(function(e){t.exports=function(t,n){for(var i=Math.min(t.length,n.length),r=new e(i),o=0;o=this._delta8){var n=(t=this.pending).length%this._delta8;this.pending=t.slice(t.length-n,t.length),0===this.pending.length&&(this.pending=null),t=i.join32(t,0,t.length-n,this.endian);for(var r=0;r>>24&255,i[r++]=t>>>16&255,i[r++]=t>>>8&255,i[r++]=255&t}else for(i[r++]=255&t,i[r++]=t>>>8&255,i[r++]=t>>>16&255,i[r++]=t>>>24&255,i[r++]=0,i[r++]=0,i[r++]=0,i[r++]=0,o=8;ot.model_id),n=await Promise.all(t.mark_views.views),i=t.mark_views._models.map(t=>t.model_id),r=e.map(t=>i.indexOf(t));this.mark_views=r.map(t=>n[t])}marks_changed(){this.populate_mark_views().then(()=>this.selected_changed())}handle_custom_messages(t){"reset"===t.type&&this.reset()}set_selected(t,e){this.model.set(t,a(e))}}e.BaseSelector=c;e.BaseXSelector=class extends c{create_scales(){if(this.scale&&this.scale.remove(),this.model.get("scale")){const t=this;return this.create_child_view(this.model.get("scale")).then(function(e){return t.scale=e,t.update_scale_domain(!0),t.set_range([t.scale]),t.scale.on("domain_changed",t.update_scale_domain,t),e})}}update_scale_domain(t=!1){const e="vertical"==this.model.get("orientation")?"y":"x",n=this.parent.padded_range(e,this.scale.model),i=this.parent.range(e);this.scale.expand_domain(n,i)}set_range(t){const e="vertical"==this.model.get("orientation")?"y":"x";for(let n=0;n=0&&(t._idleTimeoutId=setTimeout(function(){t._onTimeout&&t._onTimeout()},e))},n(155),e.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==t&&t.setImmediate||this&&this.setImmediate,e.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==t&&t.clearImmediate||this&&this.clearImmediate}).call(this,n(25))},function(t,e,n){"use strict";var i,r=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o,a=n(42),s=function(t){function e(e){void 0===e&&(e={});var n=t.call(this)||this;return n.addClass("p-Panel"),n.layout=o.createLayout(e),n}return r(e,t),Object.defineProperty(e.prototype,"widgets",{get:function(){return this.layout.widgets},enumerable:!0,configurable:!0}),e.prototype.addWidget=function(t){this.layout.addWidget(t)},e.prototype.insertWidget=function(t,e){this.layout.insertWidget(t,e)},e}(n(13).Widget);e.Panel=s,function(t){t.createLayout=function(t){return t.layout||new a.PanelLayout}}(o||(o={}))},function(t,e,n){"use strict";function i(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}Object.defineProperty(e,"__esModule",{value:!0}),i(n(178)),i(n(179)),i(n(180)),i(n(93)),i(n(264)),i(n(265))},function(t,e,n){"use strict";(function(e){!e.version||0===e.version.indexOf("v0.")||0===e.version.indexOf("v1.")&&0!==e.version.indexOf("v1.8.")?t.exports={nextTick:function(t,n,i,r){if("function"!=typeof t)throw new TypeError('"callback" argument must be a function');var o,a,s=arguments.length;switch(s){case 0:case 1:return e.nextTick(t);case 2:return e.nextTick(function(){t.call(null,n)});case 3:return e.nextTick(function(){t.call(null,n,i)});case 4:return e.nextTick(function(){t.call(null,n,i,r)});default:for(o=new Array(s-1),a=0;a>>24]^u[p>>>16&255]^h[m>>>8&255]^d[255&g]^e[_++],a=l[p>>>24]^u[m>>>16&255]^h[g>>>8&255]^d[255&f]^e[_++],s=l[m>>>24]^u[g>>>16&255]^h[f>>>8&255]^d[255&p]^e[_++],c=l[g>>>24]^u[f>>>16&255]^h[p>>>8&255]^d[255&m]^e[_++],f=o,p=a,m=s,g=c;return o=(i[f>>>24]<<24|i[p>>>16&255]<<16|i[m>>>8&255]<<8|i[255&g])^e[_++],a=(i[p>>>24]<<24|i[m>>>16&255]<<16|i[g>>>8&255]<<8|i[255&f])^e[_++],s=(i[m>>>24]<<24|i[g>>>16&255]<<16|i[f>>>8&255]<<8|i[255&p])^e[_++],c=(i[g>>>24]<<24|i[f>>>16&255]<<16|i[p>>>8&255]<<8|i[255&m])^e[_++],[o>>>=0,a>>>=0,s>>>=0,c>>>=0]}var s=[0,1,2,4,8,16,32,64,128,27,54],c=function(){for(var t=new Array(256),e=0;e<256;e++)t[e]=e<128?e<<1:e<<1^283;for(var n=[],i=[],r=[[],[],[],[]],o=[[],[],[],[]],a=0,s=0,c=0;c<256;++c){var l=s^s<<1^s<<2^s<<3^s<<4;l=l>>>8^255&l^99,n[a]=l,i[l]=a;var u=t[a],h=t[u],d=t[h],f=257*t[l]^16843008*l;r[0][a]=f<<24|f>>>8,r[1][a]=f<<16|f>>>16,r[2][a]=f<<8|f>>>24,r[3][a]=f,f=16843009*d^65537*h^257*u^16843008*a,o[0][l]=f<<24|f>>>8,o[1][l]=f<<16|f>>>16,o[2][l]=f<<8|f>>>24,o[3][l]=f,0===a?a=s=1:(a=u^t[t[t[d^u]]],s^=t[t[s]])}return{SBOX:n,INV_SBOX:i,SUB_MIX:r,INV_SUB_MIX:o}}();function l(t){this._key=r(t),this._reset()}l.blockSize=16,l.keySize=32,l.prototype.blockSize=l.blockSize,l.prototype.keySize=l.keySize,l.prototype._reset=function(){for(var t=this._key,e=t.length,n=e+6,i=4*(n+1),r=[],o=0;o>>24,a=c.SBOX[a>>>24]<<24|c.SBOX[a>>>16&255]<<16|c.SBOX[a>>>8&255]<<8|c.SBOX[255&a],a^=s[o/e|0]<<24):e>6&&o%e==4&&(a=c.SBOX[a>>>24]<<24|c.SBOX[a>>>16&255]<<16|c.SBOX[a>>>8&255]<<8|c.SBOX[255&a]),r[o]=r[o-e]^a}for(var l=[],u=0;u>>24]]^c.INV_SUB_MIX[1][c.SBOX[d>>>16&255]]^c.INV_SUB_MIX[2][c.SBOX[d>>>8&255]]^c.INV_SUB_MIX[3][c.SBOX[255&d]]}this._nRounds=n,this._keySchedule=r,this._invKeySchedule=l},l.prototype.encryptBlockRaw=function(t){return a(t=r(t),this._keySchedule,c.SUB_MIX,c.SBOX,this._nRounds)},l.prototype.encryptBlock=function(t){var e=this.encryptBlockRaw(t),n=i.allocUnsafe(16);return n.writeUInt32BE(e[0],0),n.writeUInt32BE(e[1],4),n.writeUInt32BE(e[2],8),n.writeUInt32BE(e[3],12),n},l.prototype.decryptBlock=function(t){var e=(t=r(t))[1];t[1]=t[3],t[3]=e;var n=a(t,this._invKeySchedule,c.INV_SUB_MIX,c.INV_SBOX,this._nRounds),o=i.allocUnsafe(16);return o.writeUInt32BE(n[0],0),o.writeUInt32BE(n[3],4),o.writeUInt32BE(n[2],8),o.writeUInt32BE(n[1],12),o},l.prototype.scrub=function(){o(this._keySchedule),o(this._invKeySchedule),o(this._key)},t.exports.AES=l},function(t,e,n){var i=n(5).Buffer,r=n(68);t.exports=function(t,e,n,o){if(i.isBuffer(t)||(t=i.from(t,"binary")),e&&(i.isBuffer(e)||(e=i.from(e,"binary")),8!==e.length))throw new RangeError("salt should be Buffer with 8 byte length");for(var a=n/8,s=i.alloc(a),c=i.alloc(o||0),l=i.alloc(0);a>0||o>0;){var u=new r;u.update(l),u.update(t),e&&u.update(e),l=u.digest();var h=0;if(a>0){var d=s.length-a;h=Math.min(a,l.length),l.copy(s,d,0,h),a-=h}if(h0){var f=c.length-o,p=Math.min(o,l.length-h);l.copy(c,f,h,h+p),o-=p}}return l.fill(0),{key:s,iv:c}}},function(t,e,n){"use strict";var i=e;i.base=n(226),i.short=n(227),i.mont=n(228),i.edwards=n(229)},function(t,e,n){var i=n(245),r=n(256),o=n(257),a=n(77),s=n(105),c=n(5).Buffer;function l(t){var e;"object"!=typeof t||c.isBuffer(t)||(e=t.passphrase,t=t.key),"string"==typeof t&&(t=c.from(t));var n,l,u=o(t,e),h=u.tag,d=u.data;switch(h){case"CERTIFICATE":l=i.certificate.decode(d,"der").tbsCertificate.subjectPublicKeyInfo;case"PUBLIC KEY":switch(l||(l=i.PublicKey.decode(d,"der")),n=l.algorithm.algorithm.join(".")){case"1.2.840.113549.1.1.1":return i.RSAPublicKey.decode(l.subjectPublicKey.data,"der");case"1.2.840.10045.2.1":return l.subjectPrivateKey=l.subjectPublicKey,{type:"ec",data:l};case"1.2.840.10040.4.1":return l.algorithm.params.pub_key=i.DSAparam.decode(l.subjectPublicKey.data,"der"),{type:"dsa",data:l.algorithm.params};default:throw new Error("unknown key id "+n)}throw new Error("unknown key type "+h);case"ENCRYPTED PRIVATE KEY":d=function(t,e){var n=t.algorithm.decrypt.kde.kdeparams.salt,i=parseInt(t.algorithm.decrypt.kde.kdeparams.iters.toString(),10),o=r[t.algorithm.decrypt.cipher.algo.join(".")],l=t.algorithm.decrypt.cipher.iv,u=t.subjectPrivateKey,h=parseInt(o.split("-")[1],10)/8,d=s.pbkdf2Sync(e,n,i,h,"sha1"),f=a.createDecipheriv(o,d,l),p=[];return p.push(f.update(u)),p.push(f.final()),c.concat(p)}(d=i.EncryptedPrivateKey.decode(d,"der"),e);case"PRIVATE KEY":switch(n=(l=i.PrivateKey.decode(d,"der")).algorithm.algorithm.join(".")){case"1.2.840.113549.1.1.1":return i.RSAPrivateKey.decode(l.subjectPrivateKey,"der");case"1.2.840.10045.2.1":return{curve:l.algorithm.curve,privateKey:i.ECPrivateKey.decode(l.subjectPrivateKey,"der").privateKey};case"1.2.840.10040.4.1":return l.algorithm.params.priv_key=i.DSAparam.decode(l.subjectPrivateKey,"der"),{type:"dsa",params:l.algorithm.params};default:throw new Error("unknown key id "+n)}throw new Error("unknown key type "+h);case"RSA PUBLIC KEY":return i.RSAPublicKey.decode(d,"der");case"RSA PRIVATE KEY":return i.RSAPrivateKey.decode(d,"der");case"DSA PRIVATE KEY":return{type:"dsa",params:i.DSAPrivateKey.decode(d,"der")};case"EC PRIVATE KEY":return{curve:(d=i.ECPrivateKey.decode(d,"der")).parameters.value,privateKey:d.privateKey};default:throw new Error("unknown key type "+h)}}t.exports=l,l.signature=i.signature},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(9),r=function(t){this.type="text",this.content=t};e.VirtualText=r;var o,a=function(t,e,n){this.type="element",this.tag=t,this.attrs=e,this.children=n};function s(t){for(var e={},n=[],i=1,o=arguments.length;i=c.length)n.appendChild(e(a[h]));else{var d=c[h],f=a[h];if(d!==f)if("text"!==d.type||"text"!==f.type)if("text"!==d.type&&"text"!==f.type){var p=f.attrs.key;if(p&&p in s){var m=s[p];m.vNode!==d&&(i.ArrayExt.move(c,c.indexOf(m.vNode,h+1),h),n.insertBefore(m.element,l),d=m.vNode,l=m.element)}if(d!==f){var g=d.attrs.key;g&&g!==p?(i.ArrayExt.insert(c,h,f),n.insertBefore(e(f),l)):d.tag===f.tag?(r(l,d.attrs,f.attrs),t(l,d.children,f.children),l=l.nextSibling):(i.ArrayExt.insert(c,h,f),n.insertBefore(e(f),l))}else l=l.nextSibling}else i.ArrayExt.insert(c,h,f),n.insertBefore(e(f),l);else l.textContent=f.content,l=l.nextSibling;else l=l.nextSibling}for(h=c.length-u;h>0;--h)n.removeChild(n.lastChild)}};var n={key:!0,className:!0,htmlFor:!0,dataset:!0,style:!0};function r(t,e,i){if(e!==i){var r;for(r in e)r in n||r in i||("on"===r.substr(0,2)?t[r]=null:t.removeAttribute(r));for(r in i)r in n||e[r]===i[r]||("on"===r.substr(0,2)?t[r]=i[r]:t.setAttribute(r,i[r]));e.className!==i.className&&(void 0!==i.className?t.setAttribute("class",i.className):t.removeAttribute("class")),e.htmlFor!==i.htmlFor&&(void 0!==i.htmlFor?t.setAttribute("for",i.htmlFor):t.removeAttribute("for")),e.dataset!==i.dataset&&function(t,e,n){for(var i in e)i in n||t.removeAttribute("data-"+i);for(var r in n)e[r]!==n[r]&&t.setAttribute("data-"+r,n[r])}(t,e.dataset||{},i.dataset||{}),e.style!==i.style&&function(t,e,n){var i,r=t.style;for(i in e)i in n||(r[i]="");for(i in n)e[i]!==n[i]&&(r[i]=n[i])}(t,e.style||{},i.style||{})}}}(o||(o={}))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i,r=n(81),o=function(){function t(t){var e=this;this._onScrollFrame=function(){if(e._scrollTarget){var t=e._scrollTarget,n=t.element,r=t.edge,o=t.distance,a=i.SCROLL_EDGE_SIZE-o,s=Math.pow(a/i.SCROLL_EDGE_SIZE,2),c=Math.max(1,Math.round(s*i.SCROLL_EDGE_SIZE));switch(r){case"top":n.scrollTop-=c;break;case"left":n.scrollLeft-=c;break;case"right":n.scrollLeft+=c;break;case"bottom":n.scrollTop+=c}requestAnimationFrame(e._onScrollFrame)}},this._disposed=!1,this._dropAction="none",this._override=null,this._currentTarget=null,this._currentElement=null,this._promise=null,this._scrollTarget=null,this._resolve=null,this.mimeData=t.mimeData,this.dragImage=t.dragImage||null,this.proposedAction=t.proposedAction||"copy",this.supportedActions=t.supportedActions||"all",this.source=t.source||null}return t.prototype.dispose=function(){if(!this._disposed){if(this._disposed=!0,this._currentTarget){var t=i.createMouseEvent("mouseup",-1,-1);i.dispatchDragLeave(this,this._currentTarget,null,t)}this._finalize("none")}},Object.defineProperty(t.prototype,"isDisposed",{get:function(){return this._disposed},enumerable:!0,configurable:!0}),t.prototype.start=function(t,e){var n=this;if(this._disposed)return Promise.resolve("none");if(this._promise)return this._promise;this._addListeners(),this._attachDragImage(t,e),this._promise=new Promise(function(t,e){n._resolve=t});var r=i.createMouseEvent("mousemove",t,e);return document.dispatchEvent(r),this._promise},t.prototype.handleEvent=function(t){switch(t.type){case"mousemove":this._evtMouseMove(t);break;case"mouseup":this._evtMouseUp(t);break;case"keydown":this._evtKeyDown(t);break;default:t.preventDefault(),t.stopPropagation()}},t.prototype._evtMouseMove=function(t){t.preventDefault(),t.stopPropagation(),this._updateCurrentTarget(t),this._updateDragScroll(t),this._moveDragImage(t.clientX,t.clientY)},t.prototype._evtMouseUp=function(t){if(t.preventDefault(),t.stopPropagation(),0===t.button)if(this._updateCurrentTarget(t),this._currentTarget){if("none"===this._dropAction)return i.dispatchDragLeave(this,this._currentTarget,null,t),void this._finalize("none");var e=i.dispatchDrop(this,this._currentTarget,t);this._finalize(e)}else this._finalize("none")},t.prototype._evtKeyDown=function(t){t.preventDefault(),t.stopPropagation(),27===t.keyCode&&this.dispose()},t.prototype._addListeners=function(){document.addEventListener("mousedown",this,!0),document.addEventListener("mousemove",this,!0),document.addEventListener("mouseup",this,!0),document.addEventListener("mouseenter",this,!0),document.addEventListener("mouseleave",this,!0),document.addEventListener("mouseover",this,!0),document.addEventListener("mouseout",this,!0),document.addEventListener("keydown",this,!0),document.addEventListener("keyup",this,!0),document.addEventListener("keypress",this,!0),document.addEventListener("contextmenu",this,!0)},t.prototype._removeListeners=function(){document.removeEventListener("mousedown",this,!0),document.removeEventListener("mousemove",this,!0),document.removeEventListener("mouseup",this,!0),document.removeEventListener("mouseenter",this,!0),document.removeEventListener("mouseleave",this,!0),document.removeEventListener("mouseover",this,!0),document.removeEventListener("mouseout",this,!0),document.removeEventListener("keydown",this,!0),document.removeEventListener("keyup",this,!0),document.removeEventListener("keypress",this,!0),document.removeEventListener("contextmenu",this,!0)},t.prototype._updateDragScroll=function(t){var e=i.findScrollTarget(t);(this._scrollTarget||e)&&(this._scrollTarget||setTimeout(this._onScrollFrame,500),this._scrollTarget=e)},t.prototype._updateCurrentTarget=function(t){var e=this._currentTarget,n=this._currentTarget,r=this._currentElement,o=document.elementFromPoint(t.clientX,t.clientY);this._currentElement=o,o!==r&&o!==n&&i.dispatchDragExit(this,n,o,t),o!==r&&o!==n&&(n=i.dispatchDragEnter(this,o,n,t)),n!==e&&(this._currentTarget=n,i.dispatchDragLeave(this,e,n,t));var a=i.dispatchDragOver(this,n,t);this._setDropAction(a)},t.prototype._attachDragImage=function(t,e){if(this.dragImage){this.dragImage.classList.add("p-mod-drag-image");var n=this.dragImage.style;n.pointerEvents="none",n.position="fixed",n.top=e+"px",n.left=t+"px",document.body.appendChild(this.dragImage)}},t.prototype._moveDragImage=function(t,e){if(this.dragImage){var n=this.dragImage.style;n.top=e+"px",n.left=t+"px"}},t.prototype._detachDragImage=function(){if(this.dragImage){var t=this.dragImage.parentNode;t&&t.removeChild(this.dragImage)}},t.prototype._setDropAction=function(e){if(e=i.validateAction(e,this.supportedActions),!this._override||this._dropAction!==e)switch(e){case"none":this._dropAction=e,this._override=t.overrideCursor("no-drop");break;case"copy":this._dropAction=e,this._override=t.overrideCursor("copy");break;case"link":this._dropAction=e,this._override=t.overrideCursor("alias");break;case"move":this._dropAction=e,this._override=t.overrideCursor("move")}},t.prototype._finalize=function(t){var e=this._resolve;this._removeListeners(),this._detachDragImage(),this._override&&(this._override.dispose(),this._override=null),this.mimeData.clear(),this._disposed=!0,this._dropAction="none",this._currentTarget=null,this._currentElement=null,this._scrollTarget=null,this._promise=null,this._resolve=null,e&&e(t)},t}();e.Drag=o,function(t){t.overrideCursor=function(t){var n=++e;return document.body.style.cursor=t,document.body.classList.add("p-mod-override-cursor"),new r.DisposableDelegate(function(){n===e&&(document.body.style.cursor="",document.body.classList.remove("p-mod-override-cursor"))})};var e=0}(o=e.Drag||(e.Drag={})),e.Drag=o,function(t){t.SCROLL_EDGE_SIZE=20,t.validateAction=function(t,i){return e[t]&n[i]?t:"none"},t.createMouseEvent=function(t,e,n){var i=document.createEvent("MouseEvent");return i.initMouseEvent(t,!0,!0,window,0,0,0,e,n,!1,!1,!1,!1,0,null),i},t.findScrollTarget=function(e){for(var n=e.clientX,i=e.clientY,r=document.elementFromPoint(n,i);r;r=r.parentElement)if(r.hasAttribute("data-p-dragscroll")){var o=0,a=0;r===document.body&&(o=window.pageXOffset,a=window.pageYOffset);var s=r.getBoundingClientRect(),c=s.top+a,l=s.left+o,u=l+s.width,h=c+s.height;if(!(n=u||i=h)){var d=n-l+1,f=i-c+1,p=u-n,m=h-i,g=Math.min(d,f,p,m);if(!(g>t.SCROLL_EDGE_SIZE)){var _=void 0;switch(g){case m:_="bottom";break;case f:_="top";break;case p:_="right";break;case d:_="left";break;default:throw"unreachable"}var v=r.scrollWidth-r.clientWidth,b=r.scrollHeight-r.clientHeight,y=void 0;switch(_){case"top":y=b>0&&r.scrollTop>0;break;case"left":y=v>0&&r.scrollLeft>0;break;case"right":y=v>0&&r.scrollLeft0&&r.scrollTop0&&1===r&&(this.domain.reverse(),this.trigger("domain_changed",this.domain))}update_domain(){const t=this,e=this.min_from_data?o.min(r.map(this.domains,function(e){return e.length>0?e[0]:t.global_max})):this.min,n=this.max_from_data?o.max(r.map(this.domains,function(e){return e.length>1?e[1]:t.global_min})):this.max,i=.5*(e+n),a=.5*(n-e)/this.get("mid_range"),s=this.domain,c=this.reverse?1:0,l=s[c],u=s[1-c],h=.5*(u+l),d=.5*(u-l)*this.get("min_range"),f=this.get("stabilized");if(f?!(e>=l&&e<=h-d&&n<=u&&n>=h+d):e!==l||n!==u){const t=f?i-a:e,r=f?i+a:n;this.domain=this.reverse?[r,t]:[t,r],this.trigger("domain_changed",this.domain)}}compute_and_set_domain(t,e){if(!t||0===t.length)return void this.set_domain([],e);const n=t[0]instanceof Array?t:[t],i=o.min(n.map(function(t){return o.min(t)})),r=o.max(n.map(function(t){return o.max(t)}));this.set_domain([i,r],e)}}},function(t,e,n){"use strict";var i=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e};Object.defineProperty(e,"__esModule",{value:!0});const r=i(n(2)),o=Math.PI,a=o/180,s=Math.sqrt(3),c=Math.tan(o/6),l=function(t){const e=Math.sqrt(t/o);return"M0,"+e+"A"+e+","+e+" 0 1,1 0,"+-e+"A"+e+","+e+" 0 1,1 0,"+e+"Z"},u=r.map({circle:l,cross:function(t,e){const n=Math.sqrt(t/5)/2;return"M"+-3*n+","+-n+"H"+-n+"V"+-3*n+"H"+n+"V"+-n+"H"+3*n+"V"+n+"H"+n+"V"+3*n+"H"+-n+"V"+n+"H"+-3*n+"Z"},diamond:function(t,e){const n=Math.sqrt(t/(2*c)),i=n*c;return"M0,"+-n+"L"+i+",0 0,"+n+" "+-i+",0Z"},square:function(t,e){const n=Math.sqrt(t)/2;return"M"+-n+","+-n+"L"+n+","+-n+" "+n+","+n+" "+-n+","+n+"Z"},"triangle-down":function(t,e){const n=Math.sqrt(t/s),i=n*s/2;return"M0,"+i+"L"+n+","+-i+" "+-n+","+-i+"Z"},"triangle-up":function(t,e){const n=Math.sqrt(t/s),i=n*s/2;return"M0,"+-i+"L"+n+","+i+" "+-n+","+i+"Z"},arrow:function(t,e){const n=60+-55*e,i=Math.tan(n*a),r=Math.sqrt(t/i),o=r*i/2;return"M0,"+-r+"L"+o+","+r+" "+-o+","+r+"Z"},ellipse:function(t,e){const n=Math.pow(10,e),i=Math.sqrt(t/(o*n)),r=i*n;return"M0,"+r+"A"+i+","+r+" 0 1,1 0,"+-r+"A"+i+","+r+" 0 1,1 0,"+r+"Z"},rectangle:function(t,e){const n=Math.pow(10,e),i=Math.sqrt(t/n)/2,r=i*n;return"M"+-i+","+-r+"L"+i+","+-r+" "+i+","+r+" "+-i+","+r+"Z"}});function h(){return 64}function d(){return"circle"}function f(){return.5}function p(t){return"function"==typeof t?t:function(t){return function(){return t}}(t)}e.symbol=function(){let t=d,e=h,n=f;function i(i,r){return(u.get(t.call(this,i,r))||l)(e.call(this,i,r),n.call(this,i,r))}return i.type=function(e){return arguments.length?(t=p(e),i):t},i.size=function(t){return arguments.length?(e=p(t),i):e},i.skew=function(t){return arguments.length?(n=p(t),i):n},i},e.types=u.keys()},function(t,e,n){"use strict";function i(t){return+t}function r(t){return t*t}function o(t){return t*(2-t)}function a(t){return((t*=2)<=1?t*t:--t*(2-t)+1)/2}function s(t){return t*t*t}function c(t){return--t*t*t+1}function l(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}var u=function t(e){function n(t){return Math.pow(t,e)}return e=+e,n.exponent=t,n}(3),h=function t(e){function n(t){return 1-Math.pow(1-t,e)}return e=+e,n.exponent=t,n}(3),d=function t(e){function n(t){return((t*=2)<=1?Math.pow(t,e):2-Math.pow(2-t,e))/2}return e=+e,n.exponent=t,n}(3),f=Math.PI,p=f/2;function m(t){return 1-Math.cos(t*p)}function g(t){return Math.sin(t*p)}function _(t){return(1-Math.cos(f*t))/2}function v(t){return Math.pow(2,10*t-10)}function b(t){return 1-Math.pow(2,-10*t)}function y(t){return((t*=2)<=1?Math.pow(2,10*t-10):2-Math.pow(2,10-10*t))/2}function x(t){return 1-Math.sqrt(1-t*t)}function w(t){return Math.sqrt(1- --t*t)}function M(t){return((t*=2)<=1?1-Math.sqrt(1-t*t):Math.sqrt(1-(t-=2)*t)+1)/2}var E=4/11,S=6/11,A=8/11,T=.75,k=9/11,P=10/11,L=.9375,O=21/22,C=63/64,R=1/E/E;function I(t){return 1-z(1-t)}function z(t){return(t=+t)0)switch(this._alignment){case"start":break;case"center":d=0,f=o/2;break;case"end":d=0,f=o;break;case"justify":d=o/n,f=0;break;default:throw"unreachable"}for(i=0,r=this._items.length;i>>32-e}function l(t,e,n,i,r,o,a){return c(t+(e&n|~e&i)+r+o|0,a)+e|0}function u(t,e,n,i,r,o,a){return c(t+(e&i|n&~i)+r+o|0,a)+e|0}function h(t,e,n,i,r,o,a){return c(t+(e^n^i)+r+o|0,a)+e|0}function d(t,e,n,i,r,o,a){return c(t+(n^(e|~i))+r+o|0,a)+e|0}i(s,r),s.prototype._update=function(){for(var t=a,e=0;e<16;++e)t[e]=this._block.readInt32LE(4*e);var n=this._a,i=this._b,r=this._c,o=this._d;n=l(n,i,r,o,t[0],3614090360,7),o=l(o,n,i,r,t[1],3905402710,12),r=l(r,o,n,i,t[2],606105819,17),i=l(i,r,o,n,t[3],3250441966,22),n=l(n,i,r,o,t[4],4118548399,7),o=l(o,n,i,r,t[5],1200080426,12),r=l(r,o,n,i,t[6],2821735955,17),i=l(i,r,o,n,t[7],4249261313,22),n=l(n,i,r,o,t[8],1770035416,7),o=l(o,n,i,r,t[9],2336552879,12),r=l(r,o,n,i,t[10],4294925233,17),i=l(i,r,o,n,t[11],2304563134,22),n=l(n,i,r,o,t[12],1804603682,7),o=l(o,n,i,r,t[13],4254626195,12),r=l(r,o,n,i,t[14],2792965006,17),n=u(n,i=l(i,r,o,n,t[15],1236535329,22),r,o,t[1],4129170786,5),o=u(o,n,i,r,t[6],3225465664,9),r=u(r,o,n,i,t[11],643717713,14),i=u(i,r,o,n,t[0],3921069994,20),n=u(n,i,r,o,t[5],3593408605,5),o=u(o,n,i,r,t[10],38016083,9),r=u(r,o,n,i,t[15],3634488961,14),i=u(i,r,o,n,t[4],3889429448,20),n=u(n,i,r,o,t[9],568446438,5),o=u(o,n,i,r,t[14],3275163606,9),r=u(r,o,n,i,t[3],4107603335,14),i=u(i,r,o,n,t[8],1163531501,20),n=u(n,i,r,o,t[13],2850285829,5),o=u(o,n,i,r,t[2],4243563512,9),r=u(r,o,n,i,t[7],1735328473,14),n=h(n,i=u(i,r,o,n,t[12],2368359562,20),r,o,t[5],4294588738,4),o=h(o,n,i,r,t[8],2272392833,11),r=h(r,o,n,i,t[11],1839030562,16),i=h(i,r,o,n,t[14],4259657740,23),n=h(n,i,r,o,t[1],2763975236,4),o=h(o,n,i,r,t[4],1272893353,11),r=h(r,o,n,i,t[7],4139469664,16),i=h(i,r,o,n,t[10],3200236656,23),n=h(n,i,r,o,t[13],681279174,4),o=h(o,n,i,r,t[0],3936430074,11),r=h(r,o,n,i,t[3],3572445317,16),i=h(i,r,o,n,t[6],76029189,23),n=h(n,i,r,o,t[9],3654602809,4),o=h(o,n,i,r,t[12],3873151461,11),r=h(r,o,n,i,t[15],530742520,16),n=d(n,i=h(i,r,o,n,t[2],3299628645,23),r,o,t[0],4096336452,6),o=d(o,n,i,r,t[7],1126891415,10),r=d(r,o,n,i,t[14],2878612391,15),i=d(i,r,o,n,t[5],4237533241,21),n=d(n,i,r,o,t[12],1700485571,6),o=d(o,n,i,r,t[3],2399980690,10),r=d(r,o,n,i,t[10],4293915773,15),i=d(i,r,o,n,t[1],2240044497,21),n=d(n,i,r,o,t[8],1873313359,6),o=d(o,n,i,r,t[15],4264355552,10),r=d(r,o,n,i,t[6],2734768916,15),i=d(i,r,o,n,t[13],1309151649,21),n=d(n,i,r,o,t[4],4149444226,6),o=d(o,n,i,r,t[11],3174756917,10),r=d(r,o,n,i,t[2],718787259,15),i=d(i,r,o,n,t[9],3951481745,21),this._a=this._a+n|0,this._b=this._b+i|0,this._c=this._c+r|0,this._d=this._d+o|0},s.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var t=o.allocUnsafe(16);return t.writeInt32LE(this._a,0),t.writeInt32LE(this._b,4),t.writeInt32LE(this._c,8),t.writeInt32LE(this._d,12),t},t.exports=s},function(t,e,n){t.exports=r;var i=n(70).EventEmitter;function r(){i.call(this)}n(4)(r,i),r.Readable=n(71),r.Writable=n(189),r.Duplex=n(190),r.Transform=n(191),r.PassThrough=n(192),r.Stream=r,r.prototype.pipe=function(t,e){var n=this;function r(e){t.writable&&!1===t.write(e)&&n.pause&&n.pause()}function o(){n.readable&&n.resume&&n.resume()}n.on("data",r),t.on("drain",o),t._isStdio||e&&!1===e.end||(n.on("end",s),n.on("close",c));var a=!1;function s(){a||(a=!0,t.end())}function c(){a||(a=!0,"function"==typeof t.destroy&&t.destroy())}function l(t){if(u(),0===i.listenerCount(this,"error"))throw t}function u(){n.removeListener("data",r),t.removeListener("drain",o),n.removeListener("end",s),n.removeListener("close",c),n.removeListener("error",l),t.removeListener("error",l),n.removeListener("end",u),n.removeListener("close",u),t.removeListener("close",u)}return n.on("error",l),t.on("error",l),n.on("end",u),n.on("close",u),t.on("close",u),t.emit("pipe",n),t}},function(t,e,n){"use strict";var i,r="object"==typeof Reflect?Reflect:null,o=r&&"function"==typeof r.apply?r.apply:function(t,e,n){return Function.prototype.apply.call(t,e,n)};i=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var a=Number.isNaN||function(t){return t!=t};function s(){s.init.call(this)}t.exports=s,s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var c=10;function l(t){return void 0===t._maxListeners?s.defaultMaxListeners:t._maxListeners}function u(t,e,n,i){var r,o,a,s;if("function"!=typeof n)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof n);if(void 0===(o=t._events)?(o=t._events=Object.create(null),t._eventsCount=0):(void 0!==o.newListener&&(t.emit("newListener",e,n.listener?n.listener:n),o=t._events),a=o[e]),void 0===a)a=o[e]=n,++t._eventsCount;else if("function"==typeof a?a=o[e]=i?[n,a]:[a,n]:i?a.unshift(n):a.push(n),(r=l(t))>0&&a.length>r&&!a.warned){a.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=t,c.type=e,c.count=a.length,s=c,console&&console.warn&&console.warn(s)}return t}function h(t,e,n){var i={fired:!1,wrapFn:void 0,target:t,type:e,listener:n},r=function(){for(var t=[],e=0;e0&&(a=e[0]),a instanceof Error)throw a;var s=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw s.context=a,s}var c=r[t];if(void 0===c)return!1;if("function"==typeof c)o(c,this,e);else{var l=c.length,u=p(c,l);for(n=0;n=0;o--)if(n[o]===e||n[o].listener===e){a=n[o].listener,r=o;break}if(r<0)return this;0===r?n.shift():function(t,e){for(;e+1=0;i--)this.removeListener(t,e[i]);return this},s.prototype.listeners=function(t){return d(this,t,!0)},s.prototype.rawListeners=function(t){return d(this,t,!1)},s.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):f.call(t,e)},s.prototype.listenerCount=f,s.prototype.eventNames=function(){return this._eventsCount>0?i(this._events):[]}},function(t,e,n){(e=t.exports=n(96)).Stream=e,e.Readable=e,e.Writable=n(72),e.Duplex=n(36),e.Transform=n(99),e.PassThrough=n(188)},function(t,e,n){"use strict";(function(e,i,r){var o=n(54);function a(t){var e=this;this.next=null,this.entry=null,this.finish=function(){!function(t,e,n){var i=t.entry;t.entry=null;for(;i;){var r=i.callback;e.pendingcb--,r(n),i=i.next}e.corkedRequestsFree?e.corkedRequestsFree.next=t:e.corkedRequestsFree=t}(e,t)}}t.exports=v;var s,c=!e.browser&&["v0.10","v0.9."].indexOf(e.version.slice(0,5))>-1?i:o.nextTick;v.WritableState=_;var l=n(44);l.inherits=n(4);var u={deprecate:n(187)},h=n(97),d=n(5).Buffer,f=r.Uint8Array||function(){};var p,m=n(98);function g(){}function _(t,e){s=s||n(36),t=t||{};var i=e instanceof s;this.objectMode=!!t.objectMode,i&&(this.objectMode=this.objectMode||!!t.writableObjectMode);var r=t.highWaterMark,l=t.writableHighWaterMark,u=this.objectMode?16:16384;this.highWaterMark=r||0===r?r:i&&(l||0===l)?l:u,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var h=!1===t.decodeStrings;this.decodeStrings=!h,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,e){var n=t._writableState,i=n.sync,r=n.writecb;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(n),e)!function(t,e,n,i,r){--e.pendingcb,n?(o.nextTick(r,i),o.nextTick(E,t,e),t._writableState.errorEmitted=!0,t.emit("error",i)):(r(i),t._writableState.errorEmitted=!0,t.emit("error",i),E(t,e))}(t,n,i,e,r);else{var a=w(n);a||n.corked||n.bufferProcessing||!n.bufferedRequest||x(t,n),i?c(y,t,n,a,r):y(t,n,a,r)}}(e,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new a(this)}function v(t){if(s=s||n(36),!(p.call(v,this)||this instanceof s))return new v(t);this._writableState=new _(t,this),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),h.call(this)}function b(t,e,n,i,r,o,a){e.writelen=i,e.writecb=a,e.writing=!0,e.sync=!0,n?t._writev(r,e.onwrite):t._write(r,o,e.onwrite),e.sync=!1}function y(t,e,n,i){n||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,i(),E(t,e)}function x(t,e){e.bufferProcessing=!0;var n=e.bufferedRequest;if(t._writev&&n&&n.next){var i=e.bufferedRequestCount,r=new Array(i),o=e.corkedRequestsFree;o.entry=n;for(var s=0,c=!0;n;)r[s]=n,n.isBuf||(c=!1),n=n.next,s+=1;r.allBuffers=c,b(t,e,!0,e.length,r,"",o.finish),e.pendingcb++,e.lastBufferedRequest=null,o.next?(e.corkedRequestsFree=o.next,o.next=null):e.corkedRequestsFree=new a(e),e.bufferedRequestCount=0}else{for(;n;){var l=n.chunk,u=n.encoding,h=n.callback;if(b(t,e,!1,e.objectMode?1:l.length,l,u,h),n=n.next,e.bufferedRequestCount--,e.writing)break}null===n&&(e.lastBufferedRequest=null)}e.bufferedRequest=n,e.bufferProcessing=!1}function w(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function M(t,e){t._final(function(n){e.pendingcb--,n&&t.emit("error",n),e.prefinished=!0,t.emit("prefinish"),E(t,e)})}function E(t,e){var n=w(e);return n&&(!function(t,e){e.prefinished||e.finalCalled||("function"==typeof t._final?(e.pendingcb++,e.finalCalled=!0,o.nextTick(M,t,e)):(e.prefinished=!0,t.emit("prefinish")))}(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"))),n}l.inherits(v,h),_.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(_.prototype,"buffer",{get:u.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(p=Function.prototype[Symbol.hasInstance],Object.defineProperty(v,Symbol.hasInstance,{value:function(t){return!!p.call(this,t)||this===v&&(t&&t._writableState instanceof _)}})):p=function(t){return t instanceof this},v.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},v.prototype.write=function(t,e,n){var i,r=this._writableState,a=!1,s=!r.objectMode&&(i=t,d.isBuffer(i)||i instanceof f);return s&&!d.isBuffer(t)&&(t=function(t){return d.from(t)}(t)),"function"==typeof e&&(n=e,e=null),s?e="buffer":e||(e=r.defaultEncoding),"function"!=typeof n&&(n=g),r.ended?function(t,e){var n=new Error("write after end");t.emit("error",n),o.nextTick(e,n)}(this,n):(s||function(t,e,n,i){var r=!0,a=!1;return null===n?a=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||e.objectMode||(a=new TypeError("Invalid non-string/buffer chunk")),a&&(t.emit("error",a),o.nextTick(i,a),r=!1),r}(this,r,t,n))&&(r.pendingcb++,a=function(t,e,n,i,r,o){if(!n){var a=function(t,e,n){t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=d.from(e,n));return e}(e,i,r);i!==a&&(n=!0,r="buffer",i=a)}var s=e.objectMode?1:i.length;e.length+=s;var c=e.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(v.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),v.prototype._write=function(t,e,n){n(new Error("_write() is not implemented"))},v.prototype._writev=null,v.prototype.end=function(t,e,n){var i=this._writableState;"function"==typeof t?(n=t,t=null,e=null):"function"==typeof e&&(n=e,e=null),null!=t&&this.write(t,e),i.corked&&(i.corked=1,this.uncork()),i.ending||i.finished||function(t,e,n){e.ending=!0,E(t,e),n&&(e.finished?o.nextTick(n):t.once("finish",n));e.ended=!0,t.writable=!1}(this,i,n)},Object.defineProperty(v.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),v.prototype.destroy=m.destroy,v.prototype._undestroy=m.undestroy,v.prototype._destroy=function(t,e){this.end(),e(t)}}).call(this,n(33),n(51).setImmediate,n(25))},function(t,e,n){"use strict";var i=n(5).Buffer,r=i.isEncoding||function(t){switch((t=""+t)&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function o(t){var e;switch(this.encoding=function(t){var e=function(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}(t);if("string"!=typeof e&&(i.isEncoding===r||!r(t)))throw new Error("Unknown encoding: "+t);return e||t}(t),this.encoding){case"utf16le":this.text=c,this.end=l,e=4;break;case"utf8":this.fillLast=s,e=4;break;case"base64":this.text=u,this.end=h,e=3;break;default:return this.write=d,void(this.end=f)}this.lastNeed=0,this.lastTotal=0,this.lastChar=i.allocUnsafe(e)}function a(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function s(t){var e=this.lastTotal-this.lastNeed,n=function(t,e,n){if(128!=(192&e[0]))return t.lastNeed=0,"�";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"�";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"�"}}(this,t);return void 0!==n?n:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function c(t,e){if((t.length-e)%2==0){var n=t.toString("utf16le",e);if(n){var i=n.charCodeAt(n.length-1);if(i>=55296&&i<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function l(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,n)}return e}function u(t,e){var n=(t.length-e)%3;return 0===n?t.toString("base64",e):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-n))}function h(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function d(t){return t.toString(this.encoding)}function f(t){return t&&t.length?this.write(t):""}e.StringDecoder=o,o.prototype.write=function(t){if(0===t.length)return"";var e,n;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n=0)return r>0&&(t.lastNeed=r-1),r;if(--i=0)return r>0&&(t.lastNeed=r-2),r;if(--i=0)return r>0&&(2===r?r=0:t.lastNeed=r-3),r;return 0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=n;var i=t.length-(n-this.lastNeed);return t.copy(this.lastChar,0,i),t.toString("utf8",e,i)},o.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length}},function(t,e,n){"use strict";var i=n(15).Buffer,r=n(4),o=n(95),a=new Array(16),s=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],c=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],l=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],u=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],h=[0,1518500249,1859775393,2400959708,2840853838],d=[1352829926,1548603684,1836072691,2053994217,0];function f(){o.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}function p(t,e){return t<>>32-e}function m(t,e,n,i,r,o,a,s){return p(t+(e^n^i)+o+a|0,s)+r|0}function g(t,e,n,i,r,o,a,s){return p(t+(e&n|~e&i)+o+a|0,s)+r|0}function _(t,e,n,i,r,o,a,s){return p(t+((e|~n)^i)+o+a|0,s)+r|0}function v(t,e,n,i,r,o,a,s){return p(t+(e&i|n&~i)+o+a|0,s)+r|0}function b(t,e,n,i,r,o,a,s){return p(t+(e^(n|~i))+o+a|0,s)+r|0}r(f,o),f.prototype._update=function(){for(var t=a,e=0;e<16;++e)t[e]=this._block.readInt32LE(4*e);for(var n=0|this._a,i=0|this._b,r=0|this._c,o=0|this._d,f=0|this._e,y=0|this._a,x=0|this._b,w=0|this._c,M=0|this._d,E=0|this._e,S=0;S<80;S+=1){var A,T;S<16?(A=m(n,i,r,o,f,t[s[S]],h[0],l[S]),T=b(y,x,w,M,E,t[c[S]],d[0],u[S])):S<32?(A=g(n,i,r,o,f,t[s[S]],h[1],l[S]),T=v(y,x,w,M,E,t[c[S]],d[1],u[S])):S<48?(A=_(n,i,r,o,f,t[s[S]],h[2],l[S]),T=_(y,x,w,M,E,t[c[S]],d[2],u[S])):S<64?(A=v(n,i,r,o,f,t[s[S]],h[3],l[S]),T=g(y,x,w,M,E,t[c[S]],d[3],u[S])):(A=b(n,i,r,o,f,t[s[S]],h[4],l[S]),T=m(y,x,w,M,E,t[c[S]],d[4],u[S])),n=f,f=o,o=p(r,10),r=i,i=A,y=E,E=M,M=p(w,10),w=x,x=T}var k=this._b+r+M|0;this._b=this._c+o+E|0,this._c=this._d+f+y|0,this._d=this._e+n+x|0,this._e=this._a+i+w|0,this._a=k},f.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var t=i.alloc?i.alloc(20):new i(20);return t.writeInt32LE(this._a,0),t.writeInt32LE(this._b,4),t.writeInt32LE(this._c,8),t.writeInt32LE(this._d,12),t.writeInt32LE(this._e,16),t},t.exports=f},function(t,e,n){(e=t.exports=function(t){t=t.toLowerCase();var n=e[t];if(!n)throw new Error(t+" is not supported (we accept pull requests)");return new n}).sha=n(193),e.sha1=n(194),e.sha224=n(195),e.sha256=n(100),e.sha384=n(196),e.sha512=n(101)},function(t,e,n){"use strict";e.utils=n(202),e.Cipher=n(203),e.DES=n(204),e.CBC=n(205),e.EDE=n(206)},function(t,e,n){var i=n(207),r=n(215),o=n(111);e.createCipher=e.Cipher=i.createCipher,e.createCipheriv=e.Cipheriv=i.createCipheriv,e.createDecipher=e.Decipher=r.createDecipher,e.createDecipheriv=e.Decipheriv=r.createDecipheriv,e.listCiphers=e.getCiphers=function(){return Object.keys(o)}},function(t,e,n){var i={ECB:n(208),CBC:n(209),CFB:n(210),CFB8:n(211),CFB1:n(212),OFB:n(213),CTR:n(109),GCM:n(109)},r=n(111);for(var o in r)r[o].module=i[r[o].mode];t.exports=r},function(t,e,n){(function(e){var i=n(11),r=n(38);function o(t,n){var r=function(t){var e=a(t);return{blinder:e.toRed(i.mont(t.modulus)).redPow(new i(t.publicExponent)).fromRed(),unblinder:e.invm(t.modulus)}}(n),o=n.modulus.byteLength(),s=(i.mont(n.modulus),new i(t).mul(r.blinder).umod(n.modulus)),c=s.toRed(i.mont(n.prime1)),l=s.toRed(i.mont(n.prime2)),u=n.coefficient,h=n.prime1,d=n.prime2,f=c.redPow(n.exponent1),p=l.redPow(n.exponent2);f=f.fromRed(),p=p.fromRed();var m=f.isub(p).imul(u).umod(h);return m.imul(d),p.iadd(m),new e(p.imul(r.unblinder).umod(n.modulus).toArray(!1,o))}function a(t){for(var e=t.modulus.byteLength(),n=new i(r(e));n.cmp(t.modulus)>=0||!n.umod(t.prime1)||!n.umod(t.prime2);)n=new i(r(e));return n}t.exports=o,o.getr=a}).call(this,n(15).Buffer)},function(t,e,n){var i=e;i.utils=n(30),i.common=n(46),i.sha=n(231),i.ripemd=n(235),i.hmac=n(236),i.sha1=i.sha.sha1,i.sha256=i.sha.sha256,i.sha224=i.sha.sha224,i.sha384=i.sha.sha384,i.sha512=i.sha.sha512,i.ripemd160=i.ripemd.ripemd160},function(t,e,n){"use strict";var i,r=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o=n(9),a=n(21),s=function(){function t(t){this._fn=t}return Object.defineProperty(t.prototype,"isDisposed",{get:function(){return!this._fn},enumerable:!0,configurable:!0}),t.prototype.dispose=function(){if(this._fn){var t=this._fn;this._fn=null,t()}},t}();e.DisposableDelegate=s;var c=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._disposed=new a.Signal(e),e}return r(e,t),Object.defineProperty(e.prototype,"disposed",{get:function(){return this._disposed},enumerable:!0,configurable:!0}),e.prototype.dispose=function(){this.isDisposed||(t.prototype.dispose.call(this),this._disposed.emit(void 0),a.Signal.clearData(this))},e}(s);e.ObservableDisposableDelegate=c;var l=function(){function t(){this._isDisposed=!1,this._items=new Set}return Object.defineProperty(t.prototype,"isDisposed",{get:function(){return this._isDisposed},enumerable:!0,configurable:!0}),t.prototype.dispose=function(){this._isDisposed||(this._isDisposed=!0,this._items.forEach(function(t){t.dispose()}),this._items.clear())},t.prototype.contains=function(t){return this._items.has(t)},t.prototype.add=function(t){this._items.add(t)},t.prototype.remove=function(t){this._items.delete(t)},t.prototype.clear=function(){this._items.clear()},t}();e.DisposableSet=l,function(t){t.from=function(e){var n=new t;return o.each(e,function(t){n.add(t)}),n}}(l=e.DisposableSet||(e.DisposableSet={})),e.DisposableSet=l;var u=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._disposed=new a.Signal(e),e}return r(e,t),Object.defineProperty(e.prototype,"disposed",{get:function(){return this._disposed},enumerable:!0,configurable:!0}),e.prototype.dispose=function(){this.isDisposed||(t.prototype.dispose.call(this),this._disposed.emit(void 0),a.Signal.clearData(this))},e}(l);e.ObservableDisposableSet=u,function(t){t.from=function(e){var n=new t;return o.each(e,function(t){n.add(t)}),n}}(u=e.ObservableDisposableSet||(e.ObservableDisposableSet={})),e.ObservableDisposableSet=u},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getKeyboardLayout=function(){return i.keyboardLayout},e.setKeyboardLayout=function(t){i.keyboardLayout=t};var i,r=function(){function t(e,n){this.name=e,this._codes=n,this._keys=t.extractKeys(n)}return t.prototype.keys=function(){return Object.keys(this._keys)},t.prototype.isValidKey=function(t){return t in this._keys},t.prototype.keyForKeydownEvent=function(t){return this._codes[t.keyCode]||""},t}();e.KeycodeLayout=r,function(t){t.extractKeys=function(t){var e=Object.create(null);for(var n in t)e[t[n]]=!0;return e}}(r=e.KeycodeLayout||(e.KeycodeLayout={})),e.KeycodeLayout=r,e.EN_US=new r("en-us",{8:"Backspace",9:"Tab",13:"Enter",19:"Pause",27:"Escape",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",48:"0",49:"1",50:"2",51:"3",52:"4",53:"5",54:"6",55:"7",56:"8",57:"9",59:";",61:"=",65:"A",66:"B",67:"C",68:"D",69:"E",70:"F",71:"G",72:"H",73:"I",74:"J",75:"K",76:"L",77:"M",78:"N",79:"O",80:"P",81:"Q",82:"R",83:"S",84:"T",85:"U",86:"V",87:"W",88:"X",89:"Y",90:"Z",93:"ContextMenu",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9",106:"*",107:"+",109:"-",110:".",111:"/",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"}),function(t){t.keyboardLayout=e.EN_US}(i||(i={}))},function(t,e,n){"use strict";var i,r=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o,a=n(9),s=n(16),c=n(60),l=n(14),u=n(21),h=n(59),d=n(67),f=n(13),p=function(t){function e(n){void 0===n&&(n={});var i=t.call(this,{node:o.createNode()})||this;return i._currentIndex=-1,i._titles=[],i._previousTitle=null,i._dragData=null,i._tabMoved=new u.Signal(i),i._currentChanged=new u.Signal(i),i._tabCloseRequested=new u.Signal(i),i._tabDetachRequested=new u.Signal(i),i._tabActivateRequested=new u.Signal(i),i.addClass("p-TabBar"),i.setFlag(f.Widget.Flag.DisallowLayout),i.tabsMovable=n.tabsMovable||!1,i.allowDeselect=n.allowDeselect||!1,i.insertBehavior=n.insertBehavior||"select-tab-if-needed",i.removeBehavior=n.removeBehavior||"select-tab-after",i.renderer=n.renderer||e.defaultRenderer,i._orientation=n.orientation||"horizontal",i.dataset.orientation=i._orientation,i}return r(e,t),e.prototype.dispose=function(){this._releaseMouse(),this._titles.length=0,this._previousTitle=null,t.prototype.dispose.call(this)},Object.defineProperty(e.prototype,"currentChanged",{get:function(){return this._currentChanged},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"tabMoved",{get:function(){return this._tabMoved},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"tabActivateRequested",{get:function(){return this._tabActivateRequested},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"tabCloseRequested",{get:function(){return this._tabCloseRequested},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"tabDetachRequested",{get:function(){return this._tabDetachRequested},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"currentTitle",{get:function(){return this._titles[this._currentIndex]||null},set:function(t){this.currentIndex=t?this._titles.indexOf(t):-1},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"currentIndex",{get:function(){return this._currentIndex},set:function(t){if((t<0||t>=this._titles.length)&&(t=-1),this._currentIndex!==t){var e=this._currentIndex,n=this._titles[e]||null,i=t,r=this._titles[i]||null;this._currentIndex=i,this._previousTitle=n,this.update(),this._currentChanged.emit({previousIndex:e,previousTitle:n,currentIndex:i,currentTitle:r})}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"orientation",{get:function(){return this._orientation},set:function(t){this._orientation!==t&&(this._releaseMouse(),this._orientation=t,this.dataset.orientation=t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"titles",{get:function(){return this._titles},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"contentNode",{get:function(){return this.node.getElementsByClassName("p-TabBar-content")[0]},enumerable:!0,configurable:!0}),e.prototype.addTab=function(t){return this.insertTab(this._titles.length,t)},e.prototype.insertTab=function(t,e){this._releaseMouse();var n=o.asTitle(e),i=this._titles.indexOf(n),r=Math.max(0,Math.min(t,this._titles.length));return-1===i?(a.ArrayExt.insert(this._titles,r,n),n.changed.connect(this._onTitleChanged,this),this.update(),this._adjustCurrentForInsert(r,n),n):(r===this._titles.length&&r--,i===r?n:(a.ArrayExt.move(this._titles,i,r),this.update(),this._adjustCurrentForMove(i,r),n))},e.prototype.removeTab=function(t){this.removeTabAt(this._titles.indexOf(t))},e.prototype.removeTabAt=function(t){this._releaseMouse();var e=a.ArrayExt.removeAt(this._titles,t);e&&(e.changed.disconnect(this._onTitleChanged,this),e===this._previousTitle&&(this._previousTitle=null),this.update(),this._adjustCurrentForRemove(t,e))},e.prototype.clearTabs=function(){if(0!==this._titles.length){this._releaseMouse();for(var t=0,e=this._titles;t=t&&this._currentIndex++},e.prototype._adjustCurrentForMove=function(t,e){this._currentIndex===t?this._currentIndex=e:this._currentIndex=e?this._currentIndex++:this._currentIndex>t&&this._currentIndex<=e&&this._currentIndex--},e.prototype._adjustCurrentForRemove=function(t,e){var n=this._currentIndex,i=this.removeBehavior;if(n===t){if(0===this._titles.length)return this._currentIndex=-1,void this._currentChanged.emit({previousIndex:t,previousTitle:e,currentIndex:-1,currentTitle:null});if("select-tab-after"===i)return this._currentIndex=Math.min(t,this._titles.length-1),void this._currentChanged.emit({previousIndex:t,previousTitle:e,currentIndex:this._currentIndex,currentTitle:this.currentTitle});if("select-tab-before"===i)return this._currentIndex=Math.max(0,t-1),void this._currentChanged.emit({previousIndex:t,previousTitle:e,currentIndex:this._currentIndex,currentTitle:this.currentTitle});if("select-previous-tab"===i)return this._previousTitle?(this._currentIndex=this._titles.indexOf(this._previousTitle),this._previousTitle=null):this._currentIndex=Math.min(t,this._titles.length-1),void this._currentChanged.emit({previousIndex:t,previousTitle:e,currentIndex:this._currentIndex,currentTitle:this.currentTitle});this._currentIndex=-1,this._currentChanged.emit({previousIndex:t,previousTitle:e,currentIndex:-1,currentTitle:null})}else n>t&&this._currentIndex--},e.prototype._onTitleChanged=function(t){this.update()},e}(f.Widget);e.TabBar=p,function(t){var e=function(){function t(){this.closeIconSelector=".p-TabBar-tabCloseIcon",this._tabID=0,this._tabKeys=new WeakMap}return t.prototype.renderTab=function(t){var e=t.title.caption,n=this.createTabKey(t),i=this.createTabStyle(t),r=this.createTabClass(t),o=this.createTabDataset(t);return h.h.li({key:n,className:r,title:e,style:i,dataset:o},this.renderIcon(t),this.renderLabel(t),this.renderCloseIcon(t))},t.prototype.renderIcon=function(t){var e=this.createIconClass(t);return h.h.div({className:e},t.title.iconLabel)},t.prototype.renderLabel=function(t){return h.h.div({className:"p-TabBar-tabLabel"},t.title.label)},t.prototype.renderCloseIcon=function(t){return h.h.div({className:"p-TabBar-tabCloseIcon"})},t.prototype.createTabKey=function(t){var e=this._tabKeys.get(t.title);return void 0===e&&(e="tab-key-"+this._tabID++,this._tabKeys.set(t.title,e)),e},t.prototype.createTabStyle=function(t){return{zIndex:""+t.zIndex}},t.prototype.createTabClass=function(t){var e="p-TabBar-tab";return t.title.className&&(e+=" "+t.title.className),t.title.closable&&(e+=" p-mod-closable"),t.current&&(e+=" p-mod-current"),e},t.prototype.createTabDataset=function(t){return t.title.dataset},t.prototype.createIconClass=function(t){var e="p-TabBar-tabIcon",n=t.title.iconClass;return n?e+" "+n:e},t}();t.Renderer=e,t.defaultRenderer=new e}(p=e.TabBar||(e.TabBar={})),e.TabBar=p,function(t){t.DRAG_THRESHOLD=5,t.DETACH_THRESHOLD=20,t.createNode=function(){var t=document.createElement("div"),e=document.createElement("ul");return e.className="p-TabBar-content",t.appendChild(e),t},t.asTitle=function(t){return t instanceof d.Title?t:new d.Title(t)},t.parseTransitionDuration=function(t){var e=window.getComputedStyle(t);return 1e3*(parseFloat(e.transitionDuration)||0)},t.snapTabLayout=function(t,e){for(var n=new Array(t.length),i=0,r=t.length;i=t.DRAG_THRESHOLD||r>=t.DRAG_THRESHOLD},t.detachExceeded=function(e,n){var i=e.contentRect;return n.clientX=i.right+t.DETACH_THRESHOLD||n.clientY=i.bottom+t.DETACH_THRESHOLD},t.layoutTabs=function(t,e,n,i){var r,o,a,s;"horizontal"===i?(r=e.pressX,o=n.clientX-e.contentRect.left,a=n.clientX,s=e.contentRect.width):(r=e.pressY,o=n.clientY-e.contentRect.top,a=n.clientY,s=e.contentRect.height);for(var c=e.index,l=o-e.tabPressPos,u=l+e.tabSize,h=0,d=t.length;h>1);if(he.index&&u>m)f=-e.tabSize-p.margin+"px",c=Math.max(c,h);else if(h===e.index){var g=a-r,_=s-(e.tabPos+e.tabSize);f=Math.max(-e.tabPos,Math.min(g,_))+"px"}else f="";"horizontal"===i?t[h].style.left=f:t[h].style.top=f}e.targetIndex=c},t.finalizeTabPosition=function(t,e){var n,i;if(n="horizontal"===e?t.contentRect.width:t.contentRect.height,t.targetIndex===t.index)i=0;else if(t.targetIndex>t.index)i=(r=t.tabLayout[t.targetIndex]).pos+r.size-t.tabSize-t.tabPos;else{var r;i=(r=t.tabLayout[t.targetIndex]).pos-t.tabPos}var o=n-(t.tabPos+t.tabSize),a=Math.max(-t.tabPos,Math.min(i,o));"horizontal"===e?t.tab.style.left=a+"px":t.tab.style.top=a+"px"},t.resetTabPositions=function(t,e){a.each(t,function(t){"horizontal"===e?t.style.left="":t.style.top=""})}}(o||(o={}))},function(t,e,n){"use strict";var i=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e},r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const o=i(n(2)),a=r(n(135)),s="RdYlGn";function c(t){return o.max(Object.keys(t).map(Number))}e.cycle_colors=function(t,e){const n=t.length;if(n>e)return t.slice(0,e);{let i=[],r=Math.floor(e/n);for(;r>0;r--)i=i.concat(t);return i.concat(t.slice(0,e%n))}},e.cycle_colors_from_scheme=function(t,e){t=t in a.default?t:s;const n=a.default[t];let i=e.toString();return 2===e?[n[3][0],n[3][2]]:i in n?n[i]:(i=c(n).toString(),this.cycle_colors(n[i],e))},e.get_linear_scale=function(t){t=t in a.default&&"qual"!==a.default[t].type?t:s;const e=a.default[t],n=e[c(e).toString()];return o.scaleLinear().range(n)},e.get_ordinal_scale=function(t,e){const n=o.scaleOrdinal();return n.range(this.cycle_colors_from_scheme(t,e)),n},e.get_linear_scale_range=function(t){return this.get_linear_scale(t).range()},e.get_ordinal_scale_range=function(t,e){return this.get_ordinal_scale(t,e).range()}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(139);function r(t,e,n){if(0==e.length&&0==n.length)return!1;let i=!0;return 0!=e.length&&(i=i&&e[0]<=t[0]&&t[0]<=e[1]),0!=n.length&&(i=i&&n[0]<=t[1]&&t[1]<=n[1]),i}function o(t,e){return 0==t.length||0==e.length?0!=t.length||0!=e.length:(t.sort(function(t,e){return t-e}),e.sort(function(t,e){return t-e}),t[0]0&&this.scale.domain(this.model.domain),this.offset=0,this.create_event_listeners()}expand_domain(t,e){const n=this.scale.copy();n.clamp(!1),n.domain(this.model.domain),n.range(t),this.scale.domain(e.map(function(t){return n.invert(t)}))}invert(t){return this.scale.invert(t)}invert_range(t){const e=this;return t.map(function(t){return e.invert(t)})}}},function(t,e,n){"use strict";n.r(e);var i=n(1);function r(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t)}return this}function o(t,e){switch(arguments.length){case 0:break;case 1:this.interpolator(t);break;default:this.interpolator(e).domain(t)}return this}var a=n(32),s=Array.prototype,c=s.map,l=s.slice,u={name:"implicit"};function h(){var t=Object(a.c)(),e=[],n=[],i=u;function o(r){var o=r+"",a=t.get(o);if(!a){if(i!==u)return i;t.set(o,a=e.push(r))}return n[(a-1)%n.length]}return o.domain=function(n){if(!arguments.length)return e.slice();e=[],t=Object(a.c)();for(var i,r,s=-1,c=n.length;++si&&(e=n,n=i,i=e),function(t){return Math.max(n,Math.min(i,t))}}function x(t,e,n){var i=t[0],r=t[1],o=e[0],a=e[1];return r2?w:x,r=o=null,f}function f(e){return isNaN(e=+e)?n:(r||(r=i(a.map(t),s,u)))(t(h(e)))}return f.invert=function(n){return h(e((o||(o=i(s,a.map(t),p.o)))(n)))},f.domain=function(t){return arguments.length?(a=c.call(t,g),h===v||(h=y(a)),d()):a.slice()},f.range=function(t){return arguments.length?(s=l.call(t),d()):s.slice()},f.rangeRound=function(t){return s=l.call(t),u=p.t,d()},f.clamp=function(t){return arguments.length?(h=t?y(a):v,f):h!==v},f.interpolate=function(t){return arguments.length?(u=t,d()):u},f.unknown=function(t){return arguments.length?(n=t,f):n},function(n,i){return t=n,e=i,d()}}function S(t,e){return E()(t,e)}var A=n(27),T=function(t,e,n,r){var o,a=Object(i.A)(t,e,n);switch((r=Object(A.e)(null==r?",f":r)).type){case"s":var s=Math.max(Math.abs(t),Math.abs(e));return null!=r.precision||isNaN(o=Object(A.g)(a,s))||(r.precision=o),Object(A.d)(r,s);case"":case"e":case"g":case"p":case"r":null!=r.precision||isNaN(o=Object(A.h)(a,Math.max(Math.abs(t),Math.abs(e))))||(r.precision=o-("e"===r.type));break;case"f":case"%":null!=r.precision||isNaN(o=Object(A.f)(a))||(r.precision=o-2*("%"===r.type))}return Object(A.a)(r)};function k(t){var e=t.domain;return t.ticks=function(t){var n=e();return Object(i.B)(n[0],n[n.length-1],null==t?10:t)},t.tickFormat=function(t,n){var i=e();return T(i[0],i[i.length-1],null==t?10:t,n)},t.nice=function(n){null==n&&(n=10);var r,o=e(),a=0,s=o.length-1,c=o[a],l=o[s];return l0?(c=Math.floor(c/r)*r,l=Math.ceil(l/r)*r,r=Object(i.z)(c,l,n)):r<0&&(c=Math.ceil(c*r)/r,l=Math.floor(l*r)/r,r=Object(i.z)(c,l,n)),r>0?(o[a]=Math.floor(c/r)*r,o[s]=Math.ceil(l/r)*r,e(o)):r<0&&(o[a]=Math.ceil(c*r)/r,o[s]=Math.floor(l*r)/r,e(o)),t},t}function P(){var t=S(v,v);return t.copy=function(){return M(t,P())},r.apply(t,arguments),k(t)}function L(t){var e;function n(t){return isNaN(t=+t)?e:t}return n.invert=n,n.domain=n.range=function(e){return arguments.length?(t=c.call(e,g),n):t.slice()},n.unknown=function(t){return arguments.length?(e=t,n):e},n.copy=function(){return L(t).unknown(e)},t=arguments.length?c.call(t,g):[0,1],k(n)}var O=function(t,e){var n,i=0,r=(t=t.slice()).length-1,o=t[i],a=t[r];return a0){for(;fl)break;g.push(d)}}else for(;f=1;--h)if(!((d=u*h)l)break;g.push(d)}}else g=Object(i.B)(f,p,Math.min(p-f,m)).map(n);return r?g.reverse():g},r.tickFormat=function(t,i){if(null==i&&(i=10===a?".0e":","),"function"!=typeof i&&(i=Object(A.a)(i)),t===1/0)return i;null==t&&(t=10);var o=Math.max(1,a*t/r.ticks().length);return function(t){var r=t/n(Math.round(e(t)));return r*a0?o[i-1]:e[0],i=o?[a[o-1],n]:[a[i-1],a[i]]},c.unknown=function(e){return arguments.length?(t=e,c):c},c.thresholds=function(){return a.slice()},c.copy=function(){return J().domain([e,n]).range(s).unknown(t)},r.apply(k(c),arguments)}function Q(){var t,e=[.5],n=[0,1],o=1;function a(r){return r<=r?n[Object(i.b)(e,r,0,o)]:t}return a.domain=function(t){return arguments.length?(e=l.call(t),o=Math.min(e.length,n.length-1),a):e.slice()},a.range=function(t){return arguments.length?(n=l.call(t),o=Math.min(e.length,n.length-1),a):n.slice()},a.invertExtent=function(t){var i=n.indexOf(t);return[e[i-1],e[i]]},a.unknown=function(e){return arguments.length?(t=e,a):t},a.copy=function(){return Q().domain(e).range(n).unknown(t)},r.apply(a,arguments)}var $=n(3),tt=n(40),et=1e3,nt=60*et,it=60*nt,rt=24*it,ot=7*rt,at=30*rt,st=365*rt;function ct(t){return new Date(t)}function lt(t){return t instanceof Date?+t:+new Date(+t)}function ut(t,e,n,r,o,a,s,l,u){var h=S(v,v),d=h.invert,f=h.domain,p=u(".%L"),m=u(":%S"),g=u("%I:%M"),_=u("%I %p"),b=u("%a %d"),y=u("%b %d"),x=u("%B"),w=u("%Y"),E=[[s,1,et],[s,5,5*et],[s,15,15*et],[s,30,30*et],[a,1,nt],[a,5,5*nt],[a,15,15*nt],[a,30,30*nt],[o,1,it],[o,3,3*it],[o,6,6*it],[o,12,12*it],[r,1,rt],[r,2,2*rt],[n,1,ot],[e,1,at],[e,3,3*at],[t,1,st]];function A(i){return(s(i){this.create_listeners(),this.tick_format=this.generate_tick_formatter(),this.set_scales_range(),this.append_axis()})}create_listeners(){this.listenTo(this.model,"change:scale",(t,e)=>{this.update_scale(t.previous("scale"),e),this.axis.scale(this.axis_scale.scale),this.rescale_axis()}),this.listenTo(this.model,"change:tick_values",this.set_tick_values),this.listenTo(this.model,"change:tick_format",this.tickformat_changed),this.listenTo(this.model,"change:num_ticks",this.set_tick_values),this.listenTo(this.model,"change:tick_rotate",this.apply_tick_styling),this.listenTo(this.model,"change:tick_style",this.apply_tick_styling),this.model.on_some_change(["label","label_color"],this.update_label,this),this.listenTo(this.model,"change:color",this.update_color),this.model.on_some_change(["grid_color","grid_lines"],this.update_grid_lines,this),this.listenTo(this.model,"change:label_location",this.update_label_location),this.listenTo(this.model,"change:label_offset",this.update_label_offset),this.listenTo(this.model,"change:visible",this.update_visibility),this.model.on_some_change(["side","orientation"],this.update_display,this),this.listenTo(this.model,"change:offset",this.update_offset),this.parent.on("margin_updated",this.parent_margin_updated,this)}update_offset(){this.get_offset_promise().then(()=>{this.set_scales_range(),this.update_offset_scale_domain(),this.g_axisline.attr("transform",this.get_axis_transform()),this.update_grid_lines()})}update_display(){this.g_axisline.remove(),this.set_scales_range(),this.append_axis()}set_tick_values(t){let e=[];const n=this.model.get("tick_values"),i=this.model.get("num_ticks");if(null!=n&&n.length>0)this.axis.tickValues(this.get_ticks_from_array_or_length(n));else if(null!=i)this.axis.tickValues(this.get_ticks_from_array_or_length());else if("ordinal"===this.axis_scale.model.type)this.axis.tickValues(this.axis_scale.scale.domain());else if("date"===this.axis_scale.model.type){const t=this.widtht}return this.model.get("tick_format")?o.format(this.model.get("tick_format")):this.guess_tick_format()}set_scales_range(){const t="vertical"===this.model.get("orientation");this.axis_scale.set_range(t?[this.height,0]:[0,this.width]),this.offset_scale&&this.offset_scale.set_range(t?[0,this.width]:[this.height,0])}create_axis(){const t="vertical"===this.model.get("orientation"),e=this.model.get("side");this.axis=t?"right"===e?o.axisRight(this.axis_scale.scale):o.axisLeft(this.axis_scale.scale):"top"===e?o.axisTop(this.axis_scale.scale):o.axisBottom(this.axis_scale.scale)}append_axis(){this.create_axis(),this.update_scales(),this.g_axisline=this.d3el.append("g").attr("class","axis").attr("transform",this.get_axis_transform()).call(this.axis),this.g_axisline.append("text").attr("class","axislabel").attrs(this.get_label_attributes()).styles(this.get_text_styling()).text(this.model.get("label")),this.set_tick_values(),this.update_grid_lines(),this.update_color(),this.apply_tick_styling(),this.update_label()}get_offset_promise(){let t=Promise.resolve();const e=this.model.get("offset"),n="vertical"===this.model.get("orientation");return void 0!==e.value&&null!==e.value?(void 0===e.scale?this.offset_scale=n?this.parent.scale_x:this.parent.scale_y:t=this.create_child_view(e.scale).then(t=>{this.offset_scale=t,"ordinal"!==this.offset_scale.model.type&&this.offset_scale.scale.clamp(!0),this.offset_scale.on("domain_changed",()=>{this.update_offset_scale_domain(),this.g_axisline.attr("transform",this.get_axis_transform()),this.update_grid_lines()})}),this.offset_value=e.value):this.offset_scale=this.offset_value=void 0,t}highlight(){this.g_axisline.classed("axisbold",!0)}unhighlight(){this.g_axisline.classed("axisbold",!1)}get_basic_transform(){const t="vertical"===this.model.get("orientation"),e=this.model.get("side");return t?"right"===e?this.width:0:"top"===e?0:this.height}get_axis_transform(){return"vertical"===this.model.get("orientation")?"translate("+this.process_offset()+", 0)":"translate(0, "+this.process_offset()+")"}process_offset(){if(void 0===this.offset_scale||null===this.offset_scale)return this.get_basic_transform();{let t=this.offset_scale.scale(this.offset_value);return t=void 0===t?this.get_basic_transform():t,this.offset_scale.offset+t}}get_label_attributes(){let t=0;const e=this.model.get("label_location"),n=this.calculate_label_offset(),i="vertical"===this.model.get("orientation"),r=this.model.get("side");return i?("start"===e?t=-this.height:"middle"===e&&(t=-this.height/2),"right"===r?{transform:"rotate(-90)",x:t,y:n,dy:"1ex",dx:"0em"}:{transform:"rotate(-90)",x:t,y:n,dy:"0em",dx:"0em"}):("middle"===e?t=this.width/2:"end"===e&&(t=this.width),"top"===r?{x:t,y:n,dy:"0.75ex",dx:"0em",transform:""}:{x:t,y:n,dy:"0.25ex",dx:"0em",transform:""})}get_text_styling(){const t=this.model.get("label_location");return"start"===t?{"text-anchor":"start"}:"end"===t?{"text-anchor":"end"}:{"text-anchor":"middle"}}update_label(){this.g_axisline.select("text.axislabel").text(this.model.get("label")),this.d3el.selectAll(".axislabel").selectAll("text"),""!==this.model.get("label_color")&&null!==this.model.get("label_color")&&(this.g_axisline.select("text.axislabel").style("fill",this.model.get("label_color")),this.d3el.selectAll(".axislabel").selectAll("text").style("fill",this.model.get("label_color")))}update_label_location(){this.g_axisline.select("text.axislabel").attrs(this.get_label_attributes()).styles(this.get_text_styling())}update_label_offset(t,e){this.label_offset=this.calculate_label_offset(),this.g_axisline.select("text.axislabel").attr("y",this.label_offset)}calculate_label_offset(){let t=this.model.get("label_offset");const e="vertical"===this.model.get("orientation"),n=this.model.get("side");t||(t=e?"4ex":"2em");let i=-1;for(let e=0;et[e]));const r=this.axis_scale.scale.domain(),o=this.axis_scale.scale.domain().length-1;return e=(r[o]-r[0])/(i-1),"date"===this.axis_scale.model.type||"date_color_linear"===this.axis_scale.model.type?(r[0]=r[0].getTime(),r[o]=r[o].getTime(),n=r[o]+.5*e,s.range(r[0],n,e).map(t=>new Date(t))):(n=r[o]+.5*e,s.range(r[0],n,e))}set_scale_promise(t){return this.axis_scale&&this.axis_scale.remove(),this.create_child_view(t).then(t=>{this.displayed.then(()=>{t.trigger("displayed")}),this.axis_scale=t,this.axis_scale.on("domain_changed",this.redraw_axisline,this),this.axis_scale.on("highlight_axis",this.highlight,this),this.axis_scale.on("unhighlight_axis",this.unhighlight,this)})}update_scale(t,e){this.axis_scale.off(),this.set_scale_promise(e)}_get_digits(t){return 0===t?1:Math.floor(Math.log10(Math.abs(t)))+1}_replace_trailing_zeros(t){const e=t.search("e");return-1!=e?t.substring(0,e).replace(/(\.[0-9]*?)0+$/gi,"$1").replace(/\.$/,"")+t.substring(e):t.replace(/(\.[0-9]*?)0+$/gi,"$1").replace(/\.$/,"")}get_format_func(t){if(0===t)return t=>o.format("d")(Math.round(t));const e=-1==t?"":"."+t;return t=>{const n=o.format(e+"g")(t);if(n.replace(/-|\.|e/gi,"").length<6)return this._replace_trailing_zeros(n);if(""===e){let n=o.format(e+"e")(t);return n.length>=7&&(n=o.format(".6e")(t)),this._replace_trailing_zeros(n)}return this._replace_trailing_zeros(o.format(e+"e")(t))}}_linear_scale_precision(t){t=null==t?this.axis_scale.scale.ticks():t;const e=Math.abs(t[1]-t[0]),n=Math.max(Math.abs(t[0]),Math.abs(t[t.length-1])),i=this._get_digits(n),r=this._get_digits(e),o=Math.abs(i-r);return i>=0&&r>0?i<=6?0:Math.min(o,6)+1:r<=0?Math.min(Math.abs(r)+i,6)+1:void 0}linear_sc_format(t){return this.get_format_func(this._linear_scale_precision(t))}date_sc_format(t){t=null==t?this.axis_scale.scale.ticks():t;const e=Math.abs(t[1]-t[0]),n=o.timeFormat(".%L"),i=o.timeFormat(":%S"),r=o.timeFormat("%I:%M"),a=o.timeFormat("%I %p"),s=o.timeFormat("%b %d"),c=o.timeFormat("%b %Y"),l=o.timeFormat("%Y");return t=>{let u=1e3;return 0===Math.floor(e/u)?o.timeSecond(t)=.301?-1:3}guess_tick_format(t){return"linear"==this.axis_scale.model.type||"color_linear"==this.axis_scale.model.type?this.linear_sc_format(t):"date"==this.axis_scale.model.type||"date_color_linear"==this.axis_scale.model.type?this.date_sc_format(t):"log"==this.axis_scale.model.type?this.log_sc_format(t):void 0}get width(){return this.parent.width-this.parent.margin.right-this.parent.margin.left}get height(){return this.parent.height-this.parent.margin.top-this.parent.margin.bottom}get margin(){return this.parent.margin}}},function(t,e){t.exports=r,r.strict=o,r.loose=a;var n=Object.prototype.toString,i={"[object Int8Array]":!0,"[object Int16Array]":!0,"[object Int32Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Uint16Array]":!0,"[object Uint32Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0};function r(t){return o(t)||a(t)}function o(t){return t instanceof Int8Array||t instanceof Int16Array||t instanceof Int32Array||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Uint16Array||t instanceof Uint32Array||t instanceof Float32Array||t instanceof Float64Array}function a(t){return i[n.call(t)]}},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t){t.exports=JSON.parse('{"name":"bqplot","version":"0.5.6","description":"bqplot","author":{"name":"BQPlot Development team","email":"bqplot@bloomberg.net"},"license":"Apache-2.0","main":"lib/index.js","repository":{"type":"git","url":"https://github.com/bloomberg/bqplot.git"},"scripts":{"build":"npm run build:css && npm run build:js && webpack","build:css":"lessc less/bqplot.less css/bqplot.css","build:js":"tsc","watch:js":"tsc --watch","prepublish":"npm run build","test":"karma start --single-run"},"devDependencies":{"@jupyter-widgets/controls":"^1.5.0","@types/chai":"^4.1.7","@types/d3":"^5.7.2","@types/expect.js":"^0.3.29","@types/mocha":"^5.2.7","@types/node":"^12.0.2","@types/sinon":"^7.0.11","chai":"^4.1.2","css-loader":"^3.0.0","file-loader":"^4.0.0","imports-loader":"^0.6.5","json-loader":"^0.5.7","karma":"^4.0.0","karma-chai":"^0.1.0","karma-chrome-launcher":"^2.2.0","karma-mocha":"^1.3.0","karma-mocha-reporter":"^2.2.5","karma-sinon":"^1.0.5","karma-sourcemap-loader":"^0.3.7","karma-typescript":"^3.0.9","karma-typescript-es6-transform":"^1.0.3","karma-webpack":"^3.0.5","less":"^3.8.1","less-loader":"^4.1.0","mocha":"^5.2.0","raw-loader":"~2.0.0","rimraf":"^2.6.1","sinon":"^7.3.2","sinon-chai":"^3.3.0","style-loader":"^0.23.1","typescript":"^3.5.2","webpack":"^4.35.0","webpack-cli":"^3.0.8"},"dependencies":{"@jupyter-widgets/base":"^2 || ^3","@phosphor/messaging":"^1","@phosphor/widgets":"^1","d3":"^5.7.0","d3-selection-multi":"^1.0.1","is-typedarray":"^1.0.0","popper.js":"^1.0.0","three":"^0.91.0","topojson":"^1.6.24","underscore":"^1.8.3"},"files":["dist/","css/","lib/","shaders/"],"jupyterlab":{"extension":"lib/jupyterlab-plugin"}}')},function(t,e,n){"use strict";function i(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}Object.defineProperty(e,"__esModule",{value:!0}),i(n(41)),i(n(66)),i(n(176)),i(n(177)),i(n(266)),i(n(131)),i(n(267)),i(n(268)),i(n(269)),i(n(34)),i(n(130)),i(n(270)),i(n(52)),i(n(42)),i(n(271)),i(n(272)),i(n(132)),i(n(273)),i(n(133)),i(n(134)),i(n(83)),i(n(274)),i(n(67)),i(n(13))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){var e;t.getRandomValues=(e="undefined"!=typeof window&&(window.crypto||window.msCrypto)||n(181)||null)&&"function"==typeof e.getRandomValues?function(t){return e.getRandomValues(t)}:e&&"function"==typeof e.randomFillSync?function(t){return e.randomFillSync(t)}:e&&"function"==typeof e.randomBytes?function(t){for(var n=e.randomBytes(t.length),i=0,r=n.length;i>>0),t[n]=255&e,e>>>=8}}(e.Random||(e.Random={}))},function(t,e){var n={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==n.call(t)}},function(t,e,n){"use strict";var i=n(5).Buffer,r=n(69).Transform;function o(t){r.call(this),this._block=i.allocUnsafe(t),this._blockSize=t,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}n(4)(o,r),o.prototype._transform=function(t,e,n){var i=null;try{this.update(t,e)}catch(t){i=t}n(i)},o.prototype._flush=function(t){var e=null;try{this.push(this.digest())}catch(t){e=t}t(e)},o.prototype.update=function(t,e){if(function(t,e){if(!i.isBuffer(t)&&"string"!=typeof t)throw new TypeError(e+" must be a string or a buffer")}(t,"Data"),this._finalized)throw new Error("Digest already called");i.isBuffer(t)||(t=i.from(t,e));for(var n=this._block,r=0;this._blockOffset+t.length-r>=this._blockSize;){for(var o=this._blockOffset;o0;++a)this._length[a]+=s,(s=this._length[a]/4294967296|0)>0&&(this._length[a]-=4294967296*s);return this},o.prototype._update=function(){throw new Error("_update is not implemented")},o.prototype.digest=function(t){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var e=this._digest();void 0!==t&&(e=e.toString(t)),this._block.fill(0),this._blockOffset=0;for(var n=0;n<4;++n)this._length[n]=0;return e},o.prototype._digest=function(){throw new Error("_digest is not implemented")},t.exports=o},function(t,e,n){"use strict";(function(e,i){var r=n(54);t.exports=b;var o,a=n(94);b.ReadableState=v;n(70).EventEmitter;var s=function(t,e){return t.listeners(e).length},c=n(97),l=n(5).Buffer,u=e.Uint8Array||function(){};var h=n(44);h.inherits=n(4);var d=n(184),f=void 0;f=d&&d.debuglog?d.debuglog("stream"):function(){};var p,m=n(185),g=n(98);h.inherits(b,c);var _=["error","close","destroy","pause","resume"];function v(t,e){t=t||{};var i=e instanceof(o=o||n(36));this.objectMode=!!t.objectMode,i&&(this.objectMode=this.objectMode||!!t.readableObjectMode);var r=t.highWaterMark,a=t.readableHighWaterMark,s=this.objectMode?16:16384;this.highWaterMark=r||0===r?r:i&&(a||0===a)?a:s,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new m,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(p||(p=n(73).StringDecoder),this.decoder=new p(t.encoding),this.encoding=t.encoding)}function b(t){if(o=o||n(36),!(this instanceof b))return new b(t);this._readableState=new v(t,this),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),c.call(this)}function y(t,e,n,i,r){var o,a=t._readableState;null===e?(a.reading=!1,function(t,e){if(e.ended)return;if(e.decoder){var n=e.decoder.end();n&&n.length&&(e.buffer.push(n),e.length+=e.objectMode?1:n.length)}e.ended=!0,E(t)}(t,a)):(r||(o=function(t,e){var n;i=e,l.isBuffer(i)||i instanceof u||"string"==typeof e||void 0===e||t.objectMode||(n=new TypeError("Invalid non-string/buffer chunk"));var i;return n}(a,e)),o?t.emit("error",o):a.objectMode||e&&e.length>0?("string"==typeof e||a.objectMode||Object.getPrototypeOf(e)===l.prototype||(e=function(t){return l.from(t)}(e)),i?a.endEmitted?t.emit("error",new Error("stream.unshift() after end event")):x(t,a,e,!0):a.ended?t.emit("error",new Error("stream.push() after EOF")):(a.reading=!1,a.decoder&&!n?(e=a.decoder.write(e),a.objectMode||0!==e.length?x(t,a,e,!1):A(t,a)):x(t,a,e,!1))):i||(a.reading=!1));return function(t){return!t.ended&&(t.needReadable||t.lengthe.highWaterMark&&(e.highWaterMark=function(t){return t>=w?t=w:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function E(t){var e=t._readableState;e.needReadable=!1,e.emittedReadable||(f("emitReadable",e.flowing),e.emittedReadable=!0,e.sync?r.nextTick(S,t):S(t))}function S(t){f("emit readable"),t.emit("readable"),L(t)}function A(t,e){e.readingMore||(e.readingMore=!0,r.nextTick(T,t,e))}function T(t,e){for(var n=e.length;!e.reading&&!e.flowing&&!e.ended&&e.length=e.length?(n=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.head.data:e.buffer.concat(e.length),e.buffer.clear()):n=function(t,e,n){var i;to.length?o.length:t;if(a===o.length?r+=o:r+=o.slice(0,t),0===(t-=a)){a===o.length?(++i,n.next?e.head=n.next:e.head=e.tail=null):(e.head=n,n.data=o.slice(a));break}++i}return e.length-=i,r}(t,e):function(t,e){var n=l.allocUnsafe(t),i=e.head,r=1;i.data.copy(n),t-=i.data.length;for(;i=i.next;){var o=i.data,a=t>o.length?o.length:t;if(o.copy(n,n.length-t,0,a),0===(t-=a)){a===o.length?(++r,i.next?e.head=i.next:e.head=e.tail=null):(e.head=i,i.data=o.slice(a));break}++r}return e.length-=r,n}(t,e);return i}(t,e.buffer,e.decoder),n);var n}function C(t){var e=t._readableState;if(e.length>0)throw new Error('"endReadable()" called on non-empty stream');e.endEmitted||(e.ended=!0,r.nextTick(R,e,t))}function R(t,e){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}function I(t,e){for(var n=0,i=t.length;n=e.highWaterMark||e.ended))return f("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?C(this):E(this),null;if(0===(t=M(t,e))&&e.ended)return 0===e.length&&C(this),null;var i,r=e.needReadable;return f("need readable",r),(0===e.length||e.length-t0?O(t,e):null)?(e.needReadable=!0,t=0):e.length-=t,0===e.length&&(e.ended||(e.needReadable=!0),n!==t&&e.ended&&C(this)),null!==i&&this.emit("data",i),i},b.prototype._read=function(t){this.emit("error",new Error("_read() is not implemented"))},b.prototype.pipe=function(t,e){var n=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=t;break;case 1:o.pipes=[o.pipes,t];break;default:o.pipes.push(t)}o.pipesCount+=1,f("pipe count=%d opts=%j",o.pipesCount,e);var c=(!e||!1!==e.end)&&t!==i.stdout&&t!==i.stderr?u:b;function l(e,i){f("onunpipe"),e===n&&i&&!1===i.hasUnpiped&&(i.hasUnpiped=!0,f("cleanup"),t.removeListener("close",_),t.removeListener("finish",v),t.removeListener("drain",h),t.removeListener("error",g),t.removeListener("unpipe",l),n.removeListener("end",u),n.removeListener("end",b),n.removeListener("data",m),d=!0,!o.awaitDrain||t._writableState&&!t._writableState.needDrain||h())}function u(){f("onend"),t.end()}o.endEmitted?r.nextTick(c):n.once("end",c),t.on("unpipe",l);var h=function(t){return function(){var e=t._readableState;f("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&s(t,"data")&&(e.flowing=!0,L(t))}}(n);t.on("drain",h);var d=!1;var p=!1;function m(e){f("ondata"),p=!1,!1!==t.write(e)||p||((1===o.pipesCount&&o.pipes===t||o.pipesCount>1&&-1!==I(o.pipes,t))&&!d&&(f("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,p=!0),n.pause())}function g(e){f("onerror",e),b(),t.removeListener("error",g),0===s(t,"error")&&t.emit("error",e)}function _(){t.removeListener("finish",v),b()}function v(){f("onfinish"),t.removeListener("close",_),b()}function b(){f("unpipe"),n.unpipe(t)}return n.on("data",m),function(t,e,n){if("function"==typeof t.prependListener)return t.prependListener(e,n);t._events&&t._events[e]?a(t._events[e])?t._events[e].unshift(n):t._events[e]=[n,t._events[e]]:t.on(e,n)}(t,"error",g),t.once("close",_),t.once("finish",v),t.emit("pipe",n),o.flowing||(f("pipe resume"),n.resume()),t},b.prototype.unpipe=function(t){var e=this._readableState,n={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes?this:(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,n),this);if(!t){var i=e.pipes,r=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var o=0;o>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10)}function d(t){return(t>>>6|t<<26)^(t>>>11|t<<21)^(t>>>25|t<<7)}function f(t){return(t>>>7|t<<25)^(t>>>18|t<<14)^t>>>3}i(c,r),c.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this},c.prototype._update=function(t){for(var e,n=this._w,i=0|this._a,r=0|this._b,o=0|this._c,s=0|this._d,c=0|this._e,p=0|this._f,m=0|this._g,g=0|this._h,_=0;_<16;++_)n[_]=t.readInt32BE(4*_);for(;_<64;++_)n[_]=0|(((e=n[_-2])>>>17|e<<15)^(e>>>19|e<<13)^e>>>10)+n[_-7]+f(n[_-15])+n[_-16];for(var v=0;v<64;++v){var b=g+d(c)+l(c,p,m)+a[v]+n[v]|0,y=h(i)+u(i,r,o)|0;g=m,m=p,p=c,c=s+b|0,s=o,o=r,r=i,i=b+y|0}this._a=i+this._a|0,this._b=r+this._b|0,this._c=o+this._c|0,this._d=s+this._d|0,this._e=c+this._e|0,this._f=p+this._f|0,this._g=m+this._g|0,this._h=g+this._h|0},c.prototype._hash=function(){var t=o.allocUnsafe(32);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t.writeInt32BE(this._h,28),t},t.exports=c},function(t,e,n){var i=n(4),r=n(39),o=n(5).Buffer,a=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],s=new Array(160);function c(){this.init(),this._w=s,r.call(this,128,112)}function l(t,e,n){return n^t&(e^n)}function u(t,e,n){return t&e|n&(t|e)}function h(t,e){return(t>>>28|e<<4)^(e>>>2|t<<30)^(e>>>7|t<<25)}function d(t,e){return(t>>>14|e<<18)^(t>>>18|e<<14)^(e>>>9|t<<23)}function f(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^t>>>7}function p(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^(t>>>7|e<<25)}function m(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^t>>>6}function g(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^(t>>>6|e<<26)}function _(t,e){return t>>>0>>0?1:0}i(c,r),c.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this},c.prototype._update=function(t){for(var e=this._w,n=0|this._ah,i=0|this._bh,r=0|this._ch,o=0|this._dh,s=0|this._eh,c=0|this._fh,v=0|this._gh,b=0|this._hh,y=0|this._al,x=0|this._bl,w=0|this._cl,M=0|this._dl,E=0|this._el,S=0|this._fl,A=0|this._gl,T=0|this._hl,k=0;k<32;k+=2)e[k]=t.readInt32BE(4*k),e[k+1]=t.readInt32BE(4*k+4);for(;k<160;k+=2){var P=e[k-30],L=e[k-30+1],O=f(P,L),C=p(L,P),R=m(P=e[k-4],L=e[k-4+1]),I=g(L,P),z=e[k-14],B=e[k-14+1],N=e[k-32],D=e[k-32+1],j=C+B|0,U=O+z+_(j,C)|0;U=(U=U+R+_(j=j+I|0,I)|0)+N+_(j=j+D|0,D)|0,e[k]=U,e[k+1]=j}for(var F=0;F<160;F+=2){U=e[F],j=e[F+1];var H=u(n,i,r),q=u(y,x,w),G=h(n,y),W=h(y,n),V=d(s,E),X=d(E,s),Y=a[F],K=a[F+1],Z=l(s,c,v),J=l(E,S,A),Q=T+X|0,$=b+V+_(Q,T)|0;$=($=($=$+Z+_(Q=Q+J|0,J)|0)+Y+_(Q=Q+K|0,K)|0)+U+_(Q=Q+j|0,j)|0;var tt=W+q|0,et=G+H+_(tt,W)|0;b=v,T=A,v=c,A=S,c=s,S=E,s=o+$+_(E=M+Q|0,M)|0,o=r,M=w,r=i,w=x,i=n,x=y,n=$+et+_(y=Q+tt|0,Q)|0}this._al=this._al+y|0,this._bl=this._bl+x|0,this._cl=this._cl+w|0,this._dl=this._dl+M|0,this._el=this._el+E|0,this._fl=this._fl+S|0,this._gl=this._gl+A|0,this._hl=this._hl+T|0,this._ah=this._ah+n+_(this._al,y)|0,this._bh=this._bh+i+_(this._bl,x)|0,this._ch=this._ch+r+_(this._cl,w)|0,this._dh=this._dh+o+_(this._dl,M)|0,this._eh=this._eh+s+_(this._el,E)|0,this._fh=this._fh+c+_(this._fl,S)|0,this._gh=this._gh+v+_(this._gl,A)|0,this._hh=this._hh+b+_(this._hl,T)|0},c.prototype._hash=function(){var t=o.allocUnsafe(64);function e(e,n,i){t.writeInt32BE(e,i),t.writeInt32BE(n,i+4)}return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),e(this._gh,this._gl,48),e(this._hh,this._hl,56),t},t.exports=c},function(t,e,n){"use strict";var i=n(4),r=n(197),o=n(35),a=n(5).Buffer,s=n(103),c=n(74),l=n(75),u=a.alloc(128);function h(t,e){o.call(this,"digest"),"string"==typeof e&&(e=a.from(e));var n="sha512"===t||"sha384"===t?128:64;(this._alg=t,this._key=e,e.length>n)?e=("rmd160"===t?new c:l(t)).update(e).digest():e.lengthn||o!=o)throw new TypeError("Bad key length")}}).call(this,n(15).Buffer)},function(t,e,n){(function(e){var n;e.browser?n="utf-8":n=parseInt(e.version.split(".")[0].slice(1),10)>=6?"utf-8":"binary";t.exports=n}).call(this,n(33))},function(t,e,n){var i=n(103),r=n(74),o=n(75),a=n(106),s=n(107),c=n(5).Buffer,l=c.alloc(128),u={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,rmd160:20,ripemd160:20};function h(t,e,n){var a=function(t){return"rmd160"===t||"ripemd160"===t?function(t){return(new r).update(t).digest()}:"md5"===t?i:function(e){return o(t).update(e).digest()}}(t),s="sha512"===t||"sha384"===t?128:64;e.length>s?e=a(e):e.lengtht;)n.ishrn(1);if(n.isEven()&&n.iadd(s),n.testn(1)||n.iadd(c),e.cmp(c)){if(!e.cmp(l))for(;n.mod(u).cmp(h);)n.iadd(f)}else for(;n.mod(o).cmp(d);)n.iadd(f);if(g(p=n.shrn(1))&&g(n)&&_(p)&&_(n)&&a.test(p)&&a.test(n))return n}}},function(t,e,n){var i=n(11),r=n(116);function o(t){this.rand=t||new r.Rand}t.exports=o,o.create=function(t){return new o(t)},o.prototype._randbelow=function(t){var e=t.bitLength(),n=Math.ceil(e/8);do{var r=new i(this.rand.generate(n))}while(r.cmp(t)>=0);return r},o.prototype._randrange=function(t,e){var n=e.sub(t);return t.add(this._randbelow(n))},o.prototype.test=function(t,e,n){var r=t.bitLength(),o=i.mont(t),a=new i(1).toRed(o);e||(e=Math.max(1,r/48|0));for(var s=t.subn(1),c=0;!s.testn(c);c++);for(var l=t.shrn(c),u=s.toRed(o);e>0;e--){var h=this._randrange(new i(2),s);n&&n(h);var d=h.toRed(o).redPow(l);if(0!==d.cmp(a)&&0!==d.cmp(u)){for(var f=1;f0;e--){var u=this._randrange(new i(2),a),h=t.gcd(u);if(0!==h.cmpn(1))return h;var d=u.toRed(r).redPow(c);if(0!==d.cmp(o)&&0!==d.cmp(l)){for(var f=1;f>8,a=255&r;o?n.push(o,a):n.push(a)}return n},i.zero2=r,i.toHex=o,i.encode=function(t,e){return"hex"===e?o(t):t}},function(t,e,n){"use strict";var i=n(30).rotr32;function r(t,e,n){return t&e^~t&n}function o(t,e,n){return t&e^t&n^e&n}function a(t,e,n){return t^e^n}e.ft_1=function(t,e,n,i){return 0===t?r(e,n,i):1===t||3===t?a(e,n,i):2===t?o(e,n,i):void 0},e.ch32=r,e.maj32=o,e.p32=a,e.s0_256=function(t){return i(t,2)^i(t,13)^i(t,22)},e.s1_256=function(t){return i(t,6)^i(t,11)^i(t,25)},e.g0_256=function(t){return i(t,7)^i(t,18)^t>>>3},e.g1_256=function(t){return i(t,17)^i(t,19)^t>>>10}},function(t,e,n){"use strict";var i=n(30),r=n(46),o=n(118),a=n(22),s=i.sum32,c=i.sum32_4,l=i.sum32_5,u=o.ch32,h=o.maj32,d=o.s0_256,f=o.s1_256,p=o.g0_256,m=o.g1_256,g=r.BlockHash,_=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function v(){if(!(this instanceof v))return new v;g.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=_,this.W=new Array(64)}i.inherits(v,g),t.exports=v,v.blockSize=512,v.outSize=256,v.hmacStrength=192,v.padLength=64,v.prototype._update=function(t,e){for(var n=this.W,i=0;i<16;i++)n[i]=t[e+i];for(;i>6],r=0==(32&n);if(31==(31&n)){var o=n;for(n=0;128==(128&o);){if(o=t.readUInt8(e),t.isError(o))return o;n<<=7,n|=127&o}}else n&=31;return{cls:i,primitive:r,tag:n,tagStr:s.tag[n]}}function h(t,e,n){var i=t.readUInt8(n);if(t.isError(i))return i;if(!e&&128===i)return null;if(0==(128&i))return i;var r=127&i;if(r>4)return t.error("length octect is too long");i=0;for(var o=0;o=31)return i.error("Multi-octet tag encoding unsupported");e||(r|=32);return r|=s.tagClassByName[n||"universal"]<<6}(t,e,n,this.reporter);if(i.length<128)return(o=new r(2))[0]=a,o[1]=i.length,this._createEncoderBuffer([o,i]);for(var c=1,l=i.length;l>=256;l>>=8)c++;(o=new r(2+c))[0]=a,o[1]=128|c;l=1+c;for(var u=i.length;u>0;l--,u>>=8)o[l]=255&u;return this._createEncoderBuffer([o,i])},l.prototype._encodeStr=function(t,e){if("bitstr"===e)return this._createEncoderBuffer([0|t.unused,t.data]);if("bmpstr"===e){for(var n=new r(2*t.length),i=0;i=40)return this.reporter.error("Second objid identifier OOB");t.splice(0,2,40*t[0]+t[1])}var o=0;for(i=0;i=128;a>>=7)o++}var s=new r(o),c=s.length-1;for(i=t.length-1;i>=0;i--){a=t[i];for(s[c--]=127&a;(a>>=7)>0;)s[c--]=128|127&a}return this._createEncoderBuffer(s)},l.prototype._encodeTime=function(t,e){var n,i=new Date(t);return"gentime"===e?n=[u(i.getFullYear()),u(i.getUTCMonth()+1),u(i.getUTCDate()),u(i.getUTCHours()),u(i.getUTCMinutes()),u(i.getUTCSeconds()),"Z"].join(""):"utctime"===e?n=[u(i.getFullYear()%100),u(i.getUTCMonth()+1),u(i.getUTCDate()),u(i.getUTCHours()),u(i.getUTCMinutes()),u(i.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+e+" time is not supported yet"),this._encodeStr(n,"octstr")},l.prototype._encodeNull=function(){return this._createEncoderBuffer("")},l.prototype._encodeInt=function(t,e){if("string"==typeof t){if(!e)return this.reporter.error("String int or enum given, but no values map");if(!e.hasOwnProperty(t))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(t));t=e[t]}if("number"!=typeof t&&!r.isBuffer(t)){var n=t.toArray();!t.sign&&128&n[0]&&n.unshift(0),t=new r(n)}if(r.isBuffer(t)){var i=t.length;0===t.length&&i++;var o=new r(i);return t.copy(o),0===t.length&&(o[0]=0),this._createEncoderBuffer(o)}if(t<128)return this._createEncoderBuffer(t);if(t<256)return this._createEncoderBuffer([0,t]);i=1;for(var a=t;a>=256;a>>=8)i++;for(a=(o=new Array(i)).length-1;a>=0;a--)o[a]=255&t,t>>=8;return 128&o[0]&&o.unshift(0),this._createEncoderBuffer(new r(o))},l.prototype._encodeBool=function(t){return this._createEncoderBuffer(t?255:0)},l.prototype._use=function(t,e){return"function"==typeof t&&(t=t(e)),t._getEncoder("der").tree},l.prototype._skipDefault=function(t,e,n){var i,r=this._baseState;if(null===r.default)return!1;var o=t.join();if(void 0===r.defaultBuffer&&(r.defaultBuffer=this._encodeValue(r.default,e,n).join()),o.length!==r.defaultBuffer.length)return!1;for(i=0;i0&&(e=l)}return{cmd:i,ctrl:r,alt:n,shift:o,key:e}}t.parseKeystroke=e,t.normalizeKeystroke=function(t){var n="",i=e(t);return i.ctrl&&(n+="Ctrl "),i.alt&&(n+="Alt "),i.shift&&(n+="Shift "),i.cmd&&s.Platform.IS_MAC&&(n+="Cmd "),n+i.key},t.formatKeystroke=function(t){var n="",i=e(t);return s.Platform.IS_MAC?(i.ctrl&&(n+="⌃ "),i.alt&&(n+="⌥ "),i.shift&&(n+="⇧ "),i.cmd&&(n+="⌘ ")):(i.ctrl&&(n+="Ctrl+"),i.alt&&(n+="Alt+"),i.shift&&(n+="Shift+")),n+i.key},t.keystrokeForKeydownEvent=function(t){var e=c.getKeyboardLayout().keyForKeydownEvent(t);if(!e)return"";var n="";return t.ctrlKey&&(n+="Ctrl "),t.altKey&&(n+="Alt "),t.shiftKey&&(n+="Shift "),t.metaKey&&s.Platform.IS_MAC&&(n+="Cmd "),n+e}}(u=e.CommandRegistry||(e.CommandRegistry={})),e.CommandRegistry=u,function(t){t.CHORD_TIMEOUT=1e3,t.createCommand=function(t){return{execute:t.execute,label:c(t.label,e),mnemonic:c(t.mnemonic,n),iconClass:c(t.iconClass||t.icon,e),iconLabel:c(t.iconLabel,e),caption:c(t.caption,e),usage:c(t.usage,e),className:c(t.className,e),dataset:c(t.dataset,a),isEnabled:t.isEnabled||i,isToggled:t.isToggled||r,isVisible:t.isVisible||i}},t.createKeyBinding=function(t){return{keys:l(t),selector:h(t),command:t.command,args:t.args||o.JSONExt.emptyObject}},t.matchKeyBinding=function(t,e,n){for(var i=null,r=!1,o=1/0,a=0,c=0,l=t.length;co)){var m=s.Selector.calculateSpecificity(u.selector);(!i||p=a)&&(i=u,o=p,a=m)}}else r||-1===f(u.selector,n)||(r=!0)}return{exact:i,partial:r}},t.replayKeyEvent=function(t){t.target.dispatchEvent(function(t){var e=document.createEvent("Event"),n=t.bubbles||!0,i=t.cancelable||!0;return e.initEvent(t.type||"keydown",n,i),e.key=t.key||"",e.keyCode=t.keyCode||0,e.which=t.keyCode||0,e.ctrlKey=t.ctrlKey||!1,e.altKey=t.altKey||!1,e.shiftKey=t.shiftKey||!1,e.metaKey=t.metaKey||!1,e.view=t.view||window,e}(t))};var e=function(){return""},n=function(){return-1},i=function(){return!0},r=function(){return!1},a=function(){return{}};function c(t,e){return void 0===t?e:"function"==typeof t?t:function(){return t}}function l(t){return(s.Platform.IS_WIN?t.winKeys||t.keys:s.Platform.IS_MAC?t.macKeys||t.keys:t.linuxKeys||t.keys).map(u.normalizeKeystroke)}function h(t){if(-1!==t.selector.indexOf(","))throw new Error("Selector cannot contain commas: "+t.selector);if(!s.Selector.isValid(t.selector))throw new Error("Invalid selector: "+t.selector);return t.selector}function d(t,e){if(t.lengthe.length?2:1}function f(t,e){for(var n=e.target,i=e.currentTarget,r=0;null!==n;n=n.parentElement,++r){if(s.Selector.matches(n,t))return r;if(n===i)return-1}return-1}}(i||(i={}))},function(t,e,n){"use strict";var i,r=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),o=this&&this.__assign||function(){return(o=Object.assign||function(t){for(var e,n=1,i=arguments.length;n=this._items.length)&&(t=-1),-1===t||a.canActivate(this._items[t])||(t=-1),this._activeIndex!==t&&(this._activeIndex=t,this.update())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"items",{get:function(){return this._items},enumerable:!0,configurable:!0}),e.prototype.activateNextItem=function(){var t=this._items.length,e=this._activeIndex,n=e=n.length)return n;var r=n.slice(0,i),o=n.slice(i+1),a=n[i];return[r,p.h.span({className:"p-Menu-itemMnemonic"},a),o]},t.prototype.formatShortcut=function(t){var e=t.item.keyBinding;return e?e.keys.map(c.CommandRegistry.formatKeystroke).join(", "):null},t}();t.Renderer=e,t.defaultRenderer=new e}(g=e.Menu||(e.Menu={})),e.Menu=g,function(t){function e(t){return"separator"!==t.type&&t.isEnabled&&t.isVisible}t.TIMER_DELAY=300,t.SUBMENU_OVERLAP=3,t.createNode=function(){var t=document.createElement("div"),e=document.createElement("ul");return e.className="p-Menu-content",t.appendChild(e),t.tabIndex=-1,t},t.canActivate=e,t.createItem=function(t,e){return new n(t.commands,e)},t.hitTestMenus=function(t,e,n){for(var i=t;i;i=i.childMenu)if(u.ElementExt.hitTest(i.node,e,n))return!0;return!1},t.computeCollapsed=function(t){var e=new Array(t.length);s.ArrayExt.fill(e,!1);for(var n=0,i=t.length;n=0;--r)if((a=t[r]).isVisible){if("separator"!==a.type)break;e[r]=!0}for(var o=!1;++no+s&&(e=o+s-p),!r&&n+g>a+c&&(n>a+c?n=a+c-g:n-=g),h.top=Math.max(0,n)+"px",h.left=Math.max(0,e)+"px",h.visibility=""},t.openSubmenu=function(e,n){d.MessageLoop.sendMessage(e,m.Widget.Msg.UpdateRequest);var i=window.pageXOffset,r=window.pageYOffset,o=document.documentElement.clientWidth,a=document.documentElement.clientHeight,s=a,c=e.node,l=c.style;l.top="",l.left="",l.width="",l.height="",l.visibility="hidden",l.maxHeight=s+"px",m.Widget.attach(e,document.body);var h=c.getBoundingClientRect(),f=h.width,p=h.height,g=u.ElementExt.boxSizing(e.node),_=n.getBoundingClientRect(),v=_.right-t.SUBMENU_OVERLAP;v+f>i+o&&(v=_.left+t.SUBMENU_OVERLAP-f);var b=_.top-g.borderTop-g.paddingTop;b+p>r+a&&(b=_.bottom+g.borderBottom+g.paddingBottom-p),l.top=Math.max(0,b)+"px",l.left=Math.max(0,v)+"px",l.visibility=""},t.findMnemonic=function(t,n,i){for(var r=-1,o=-1,a=!1,s=n.toUpperCase(),c=0,l=t.length;c=0&&f1)e.tabBar.removeTab(t.title);else if(e.tabBar.dispose(),this._root!==e){this._root.holdAllSizes();var n=e.parent;e.parent=null;var i=a.ArrayExt.removeFirstOf(n.children,e),r=a.ArrayExt.removeAt(n.handles,i);if(a.ArrayExt.removeAt(n.sizers,i),r.parentNode&&r.parentNode.removeChild(r),n.children.length>1)n.syncHandles();else{var s=n.parent;n.parent=null;var c=n.children[0],l=n.handles[0];if(n.children.length=0,n.handles.length=0,n.sizers.length=0,l.parentNode&&l.parentNode.removeChild(l),this._root===n)return c.parent=null,void(this._root=c);var u=s,h=u.children.indexOf(n);if(c instanceof o.TabLayoutNode)return c.parent=u,void(u.children[h]=c);var d=a.ArrayExt.removeAt(u.handles,h);a.ArrayExt.removeAt(u.children,h),a.ArrayExt.removeAt(u.sizers,h),d.parentNode&&d.parentNode.removeChild(d);for(var f=0,p=c.children.length;f=n.length)&&(i=0);return{type:"tab-area",widgets:n,currentIndex:i}}(t,e):function(t,e){for(var i=t.orientation,r=[],o=[],a=0,s=t.children.length;a=this._left+this._width?null:e=this._top+this._height?null:this},t.prototype.createConfig=function(){return{type:"tab-area",widgets:this.tabBar.titles.map(function(t){return t.owner}),currentIndex:this.tabBar.currentIndex}},t.prototype.holdAllSizes=function(){},t.prototype.fit=function(t,e){var n=0,i=0,r=e.get(this.tabBar),o=this.tabBar.currentTitle,a=o?e.get(o.owner):void 0,s=this.sizers,c=s[0],l=s[1];return r&&r.fit(),a&&a.fit(),r&&!r.isHidden?(n=Math.max(n,r.minWidth),i+=r.minHeight,c.minSize=r.minHeight,c.maxSize=r.maxHeight):(c.minSize=0,c.maxSize=0),a&&!a.isHidden?(n=Math.max(n,a.minWidth),i+=a.minHeight,l.minSize=a.minHeight,l.maxSize=1/0):(l.minSize=0,l.maxSize=1/0),{minWidth:n,minHeight:i,maxWidth:1/0,maxHeight:1/0}},t.prototype.update=function(t,e,n,i,r,o){this._top=e,this._left=t,this._width=n,this._height=i;var a=o.get(this.tabBar),s=this.tabBar.currentTitle,c=s?o.get(s.owner):void 0;if(l.BoxEngine.calc(this.sizers,i),a&&!a.isHidden){var u=this.sizers[0].size;a.update(t,e,n,u),e+=u}if(c&&!c.isHidden){u=this.sizers[1].size;c.update(t,e,n,u)}},t}();t.TabLayoutNode=r;var o=function(){function t(t){this.parent=null,this.normalized=!1,this.children=[],this.sizers=[],this.handles=[],this.orientation=t}return t.prototype.iterAllWidgets=function(){var t=a.map(this.children,function(t){return t.iterAllWidgets()});return new a.ChainIterator(t)},t.prototype.iterUserWidgets=function(){var t=a.map(this.children,function(t){return t.iterUserWidgets()});return new a.ChainIterator(t)},t.prototype.iterSelectedWidgets=function(){var t=a.map(this.children,function(t){return t.iterSelectedWidgets()});return new a.ChainIterator(t)},t.prototype.iterTabBars=function(){var t=a.map(this.children,function(t){return t.iterTabBars()});return new a.ChainIterator(t)},t.prototype.iterHandles=function(){var t=a.map(this.children,function(t){return t.iterHandles()});return a.chain(this.handles,new a.ChainIterator(t))},t.prototype.findTabNode=function(t){for(var e=0,n=this.children.length;e0&&(a.sizeHint=a.size)}u.BoxEngine.adjust(this._sizers,t,n),this.parent&&this.parent.update()}},e.prototype.init=function(){this.parent.dataset.orientation=this.orientation,this.parent.dataset.alignment=this.alignment,t.prototype.init.call(this)},e.prototype.attachWidget=function(t,e){var n=new h.LayoutItem(e),i=o.createHandle(this.renderer),r=o.averageSize(this._sizers),s=o.createSizer(r);a.ArrayExt.insert(this._items,t,n),a.ArrayExt.insert(this._sizers,t,s),a.ArrayExt.insert(this._handles,t,i),this.parent.isAttached&&c.MessageLoop.sendMessage(e,f.Widget.Msg.BeforeAttach),this.parent.node.appendChild(e.node),this.parent.node.appendChild(i),this.parent.isAttached&&c.MessageLoop.sendMessage(e,f.Widget.Msg.AfterAttach),this.parent.fit()},e.prototype.moveWidget=function(t,e,n){a.ArrayExt.move(this._items,t,e),a.ArrayExt.move(this._sizers,t,e),a.ArrayExt.move(this._handles,t,e),this.parent.fit()},e.prototype.detachWidget=function(t,e){var n=a.ArrayExt.removeAt(this._items,t),i=a.ArrayExt.removeAt(this._handles,t);a.ArrayExt.removeAt(this._sizers,t),this.parent.isAttached&&c.MessageLoop.sendMessage(e,f.Widget.Msg.BeforeDetach),this.parent.node.removeChild(e.node),this.parent.node.removeChild(i),this.parent.isAttached&&c.MessageLoop.sendMessage(e,f.Widget.Msg.AfterDetach),n.dispose(),this.parent.fit()},e.prototype.onBeforeShow=function(e){t.prototype.onBeforeShow.call(this,e),this.parent.update()},e.prototype.onBeforeAttach=function(e){t.prototype.onBeforeAttach.call(this,e),this.parent.fit()},e.prototype.onChildShown=function(t){this.parent.fit()},e.prototype.onChildHidden=function(t){this.parent.fit()},e.prototype.onResize=function(t){this.parent.isVisible&&this._update(t.width,t.height)},e.prototype.onUpdateRequest=function(t){this.parent.isVisible&&this._update(-1,-1)},e.prototype.onFitRequest=function(t){this.parent.isAttached&&this._fit()},e.prototype._fit=function(){for(var t=0,n=-1,i=0,r=this._items.length;i0&&(h.sizeHint=h.size),u.isHidden?(h.minSize=0,h.maxSize=0):(u.fit(),h.stretch=e.getStretch(u.widget),o?(h.minSize=u.minWidth,h.maxSize=u.maxWidth,a+=u.minWidth,l=Math.max(l,u.minHeight)):(h.minSize=u.minHeight,h.maxSize=u.maxHeight,l+=u.minHeight,a=Math.max(a,u.minWidth)))}var d=this._box=s.ElementExt.boxSizing(this.parent.node);a+=d.horizontalSum,l+=d.verticalSum;var p=this.parent.node.style;p.minWidth=a+"px",p.minHeight=l+"px",this._dirty=!0,this.parent.parent&&c.MessageLoop.sendMessage(this.parent.parent,f.Widget.Msg.FitRequest),this._dirty&&c.MessageLoop.sendMessage(this.parent,f.Widget.Msg.UpdateRequest)},e.prototype._update=function(t,e){this._dirty=!1;for(var n=0,i=0,r=this._items.length;i0)switch(this._alignment){case"start":break;case"center":g=0,_=m/2;break;case"end":g=0,_=m;break;case"justify":g=m/n,_=0;break;default:throw"unreachable"}for(i=0,r=this._items.length;i{this.parent.tooltip_div.node().appendChild(this.tooltip_div.node()),this.create_tooltip()}),t.then(()=>{this.event_listeners={},this.process_interactions(),this.create_listeners(),this.compute_view_padding(),this.draw()})}set_ranges(){const t=this.scales.x,e=this.scales.y,n=this.scales.size,i=this.scales.opacity,r=this.scales.skew,o=this.scales.rotation;t&&t.set_range(this.parent.padded_range("x",t.model)),e&&e.set_range(this.parent.padded_range("y",e.model)),n&&n.set_range([0,this.model.get("default_size")]),i&&i.set_range([.2,1]),r&&r.set_range([0,1]),o&&o.set_range([0,180])}set_positional_scales(){this.x_scale=this.scales.x,this.y_scale=this.scales.y,this.x_scale||(this.x_scale=this.parent.scale_x),this.y_scale||(this.y_scale=this.parent.scale_y),this.listenTo(this.x_scale,"domain_changed",()=>{if(!this.model.dirty){const t=!0;this.update_position(t)}}),this.listenTo(this.y_scale,"domain_changed",()=>{if(!this.model.dirty){const t=!0;this.update_position(t)}})}initialize_additional_scales(){const t=this.scales.color,e=this.scales.size,n=this.scales.opacity,i=this.scales.skew,r=this.scales.rotation;t&&(this.listenTo(t,"domain_changed",()=>{this.model.dirty||this.color_scale_updated(!0)}),t.on("color_scale_range_changed",this.color_scale_updated,this)),e&&this.listenTo(e,"domain_changed",()=>{this.update_default_size(!0)}),n&&this.listenTo(n,"domain_changed",()=>{this.update_default_opacities(!0)}),i&&this.listenTo(i,"domain_changed",()=>{this.update_default_skew(!0)}),r&&this.listenTo(r,"domain_changed",()=>{this.update_position(!0)})}create_listeners(){super.create_listeners(),this.d3el.on("mouseover",()=>{this.event_dispatcher("mouse_over")}).on("mousemove",()=>{this.event_dispatcher("mouse_move")}).on("mouseout",()=>{this.event_dispatcher("mouse_out")}),this.listenTo(this.model,"data_updated",()=>{this.draw(!0)}),this.listenTo(this.model,"change:tooltip",this.create_tooltip),this.listenTo(this.model,"change:enable_hover",()=>{this.hide_tooltip()}),this.listenTo(this.model,"change:interactions",this.process_interactions),this.listenTo(this.model,"change:enable_move",this.set_drag_behavior),this.listenTo(this.model,"change:selected",this.update_selected),this.listenTo(this.model,"change:hovered_point",this.update_hovered),this.listenTo(this.model,"change:hovered_style",this.hovered_style_updated),this.listenTo(this.model,"change:unhovered_style",this.unhovered_style_updated),this.listenTo(this.parent,"bg_clicked",()=>{this.event_dispatcher("parent_clicked")})}get_element_color(t,e){const n=this.scales.color,i=this.model.get("colors"),r=i.length;return n&&void 0!==t.color&&null!==t.color?n.scale(t.color):i[e%r]}get_element_size(t){const e=this.scales.size;return e&&void 0!==t.size?e.scale(t.size):this.model.get("default_size")}get_element_opacity(t,e){const n=this.scales.opacity,i=this.model.get("default_opacities"),r=i.length;return n&&void 0!==t.opacity?n.scale(t.opacity):i[e%r]}get_element_skew(t){const e=this.scales.skew;return e&&void 0!==t.skew?e.scale(t.skew):this.model.get("default_skew")}get_element_rotation(t){const e=this.scales.rotation;return e&&t.rotation?"rotate("+e.scale(t.rotation)+")":""}relayout(){this.set_ranges(),this.update_position()}update_position(t){const e=this.scales.x,n=this.scales.y,i=!0===t?this.parent.model.get("animation_duration"):0;this.d3el.selectAll(".object_grp").transition("update_position").duration(i).attr("transform",t=>"translate("+(e.scale(t.x)+e.offset)+","+(n.scale(t.y)+n.offset)+")"+this.get_element_rotation(t)),this.x_pixels=this.model.mark_data.map(t=>e.scale(t.x)+e.offset),this.y_pixels=this.model.mark_data.map(t=>n.scale(t.y)+n.offset),this.pixel_coords=this.model.mark_data.map(t=>[e.scale(t.x)+e.offset,n.scale(t.y)+n.offset])}draw(t){this.set_ranges();const e=this.d3el.selectAll(".object_grp").data(this.model.mark_data,t=>t.unique_id),n=e.enter().append("g").attr("class","object_grp");this.update_position(t),this.set_drag_behavior(),n.on("click",(t,e)=>{this.event_dispatcher("element_clicked",{data:t,index:e})}),n.on("mouseover",(t,e)=>{this.scatter_hover_handler({data:t,index:e})}),n.on("mouseout",()=>{this.reset_hover_points()}),this.draw_elements(t,n),e.exit().remove()}draw_elements(t,e){}process_click(t){switch(super.process_click(t),t){case"add":this.event_listeners.parent_clicked=this.add_element,this.event_listeners.element_clicked=()=>{};break;case"delete":this.event_listeners.parent_clicked=()=>{},this.event_listeners.element_clicked=this.delete_element;break;case"select":this.event_listeners.parent_clicked=this.reset_selection,this.event_listeners.element_clicked=this.scatter_click_handler}}reset_hover_points(){this.model.set("hovered_point",null),this.hovered_index=null,this.touch()}scatter_hover_handler(t){const e=t.index;this.model.set("hovered_point",e,{updated_view:this}),this.touch()}reset_selection(){this.model.set("selected",null),this.selected_indices=null,this.touch()}scatter_click_handler(t){const e=t.index,n=this.model.get("selected")||[];let i=Array.from(n);const r=i.indexOf(e),a=o().ctrlKey||o().metaKey;r>-1&&a?i.splice(r,1):a?i.push(e):(i=[]).push(e),this.model.set("selected",0===i.length?null:new Uint32Array(i),{updated_view:this}),this.touch();let s=o();s||(s=window.event),void 0!==s.cancelBubble&&(s.cancelBubble=!0),s.stopPropagation&&s.stopPropagation(),s.preventDefault()}hovered_style_updated(t,e){this.hovered_style=e,this.clear_style(t.previous("hovered_style"),this.hovered_index),this.style_updated(e,this.hovered_index)}unhovered_style_updated(t,e){this.unhovered_style=e;const n=this.hovered_index,i=n?s.range(this.model.mark_data.length).filter(t=>-1===n.indexOf(t)):[];this.clear_style(t.previous("unhovered_style"),i),this.style_updated(e,i)}draw_legend(t,e,n,i,o){this.legend_el=t.selectAll(".legend"+this.uuid).data([this.model.mark_data[0]]);const a=this.model.get("colors"),s=a.length,c=.8*o,l=this.legend_el.enter().append("g").attr("class","legend"+this.uuid).attr("transform",(t,e)=>"translate(0, "+(e*o+n)+")").on("mouseover",()=>{this.event_dispatcher("legend_mouse_over")}).on("mouseout",()=>{this.event_dispatcher("legend_mouse_out")}).on("click",()=>{this.event_dispatcher("legend_clicked")});this.draw_legend_elements(l,c),this.legend_el.append("text").attr("class","legendtext").attr("x",1.2*c).attr("y",c/2).attr("dy","0.35em").text((t,e)=>this.model.get("labels")[e]).style("fill",(t,e)=>a[e%s]);const u=r.max(this.model.get("labels"),t=>Number(t.length));return this.legend_el.exit().remove(),[1,u]}draw_legend_elements(t,e){}invert_point(t){if(void 0===t)return this.model.set("selected",null),void this.touch();const e=this.x_pixels.map(e=>Math.abs(e-t)),n=e.indexOf(r.min(e));this.model.set("selected",new Uint32Array([n])),this.touch()}selector_changed(t,e){if(void 0===t)return this.model.set("selected",null),this.touch(),[];const n=this.pixel_coords,i=new Uint32Array(s.range(n.length)).filter(e=>t(n[e]));this.model.set("selected",i),this.touch()}update_selected(t,e){this.selected_indices=e,this.apply_styles()}update_hovered(t,e){this.hovered_index=null===e?e:[e],this.apply_styles()}apply_styles(t){void 0!==t&&null!=t||(t=[this.selected_style,this.unselected_style,this.hovered_style,this.unhovered_style]),super.apply_styles([t]);const e=s.range(this.model.mark_data.length);this.set_style_on_elements(this.hovered_style,this.hovered_index);const n=this.hovered_index?s.difference(e,this.hovered_index):[];this.set_style_on_elements(this.unhovered_style,n)}clear_style(t,e){let n=this.d3el.selectAll(".element");e&&(n=n.filter((t,n)=>-1!==e.indexOf(n)));const i={};for(let e in t)i[e]=null;n.styles(i)}set_style_on_elements(t,e){if(!e||0===e.length)return;if(0===Object.keys(t).length)return;let n=this.d3el.selectAll(".element");(n=n.filter((t,n)=>-1!==e.indexOf(n))).styles(t)}compute_view_padding(){const t=Math.sqrt(this.model.get("default_size"))/2+1;t===this.x_padding&&t===this.y_padding||(this.x_padding=t,this.y_padding=t,this.trigger("mark_padding_updated"))}update_array(t,e){const n=this.scales.x,i=this.scales.y;if(!this.model.get("restrict_y")){const i=this.model.get("x").slice();i[e]=n.invert(t[0]),this.model.set("x",i)}if(!this.model.get("restrict_x")){const n=this.model.get("y").slice();n[e]=i.invert(t[1]),this.model.set("y",n)}this.touch()}set_drag_behavior(){const t=this.d3el.selectAll(".object_grp");this.model.get("enable_move")?t.call(this.drag_listener):t.on(".drag",null)}set_drag_style(t,e,n){}reset_drag_style(t,e,n){}drag_start(t,e,n){const i=this.scales.x,r=this.scales.y;t[0]=i.scale(t.x)+i.offset,t[1]=r.scale(t.y)+r.offset,this.set_drag_style(t,e,n),this.send({event:"drag_start",point:{x:t.x,y:t.y},index:e})}on_drag(t,e,n){const i=this.scales.x,a=this.scales.y,s=this.model.get("restrict_x"),c=this.model.get("restrict_y");s&&c||(c||(t[0]=o().x),s||(t[1]=o().y),r.select(n).attr("transform",()=>"translate("+t[0]+","+t[1]+")"),this.send({event:"drag",origin:{x:t.x,y:t.y},point:{x:i.invert(t[0]),y:a.invert(t[1])},index:e}),this.model.get("update_on_move")&&this.update_array(t,e))}drag_ended(t,e,n){const i=this.scales.x,r=this.scales.y;this.reset_drag_style(t,e,n),this.update_array(t,e),this.send({event:"drag_end",point:{x:i.invert(t[0]),y:r.invert(t[1])},index:e})}selected_deleter(){o().stopPropagation()}add_element(){const t=r.mouse(this.el),e=[t[0],t[1]],n=this.scales.x,i=this.scales.y,o=this.model.get("x"),a=this.model.get("y"),s=new o.constructor(o.length+1),c=new a.constructor(a.length+1);s.set(o),c.set(a),s[o.length]=n.invert(e[0]),c[a.length]=i.invert(e[1]),this.model.set("x",s),this.model.set("y",c),this.touch()}delete_element(t){const e=t.index;let n=this.model.get("x").slice(),i=this.model.get("y").slice();n.copyWithin(e,e+1,n.length),i.copyWithin(e,e+1,i.length),n=n.slice(0,n.length-1),i=i.slice(0,i.length-1),this.model.set("x",n),this.model.set("y",i),this.touch()}}},function(t,e,n){"use strict";var i=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e};Object.defineProperty(e,"__esModule",{value:!0});const r=n(18),o=i(n(12));class a extends r.MarkModel{defaults(){return Object.assign({},r.MarkModel.prototype.defaults(),{_model_name:"ScatterBaseModel",_view_name:"ScatterBase",x:[],y:[],color:null,opacity:null,size:null,rotation:null,hovered_point:null,scales_metadata:{x:{orientation:"horizontal",dimension:"x"},y:{orientation:"vertical",dimension:"y"},color:{dimension:"color"},size:{dimension:"size"},opacity:{dimension:"opacity"},rotation:{dimension:"rotation"}},hovered_style:{},unhovered_style:{},colors:["steelblue"],default_opacities:[1],enable_move:!1,enable_delete:!1,restrict_x:!1,restrict_y:!1,update_on_move:!1})}initialize(t,e){super.initialize(t,e),this.on_some_change(["x","y","color","opacity","size","rotation"],this.update_data,this),this.on_some_change(["preserve_domain"],this.update_domains,this),this.update_data()}update_mark_data(){let t=this.get("x");const e=this.get("y");if(0===t.length||0===e.length)this.mark_data=[];else{const n=Math.min(t.length,e.length);t=t.slice(0,n);const i=this.get("color")||[],r=this.get("size")||[],o=this.get("opacity")||[],a=this.get("rotation")||[];this.mark_data=Array.prototype.map.call(t,function(t,n){return{x:t,y:e[n],color:i[n],size:r[n],opacity:o[n],rotation:a[n],index:n}})}}update_data(){this.dirty=!0,this.update_mark_data(),this.update_unique_ids(),this.update_domains(),this.dirty=!1,this.trigger("data_updated")}update_unique_ids(){}get_data_dict(t,e){return t}update_domains(){if(!this.mark_data)return;const t=this.get("scales");for(let e in t)if(t.hasOwnProperty(e)){const n=t[e];this.get("preserve_domain")[e]?n.del_domain([],this.model_id+e):n.compute_and_set_domain(this.mark_data.map(function(t){return t[e]}),this.model_id+e)}}}a.serializers=Object.assign({},r.MarkModel.serializers,{x:o.array_or_json,y:o.array_or_json,color:o.array_or_json,opacity:o.array_or_json,size:o.array_or_json,rotation:o.array_or_json,default_opacities:o.array_or_json}),e.ScatterBaseModel=a},function(t,e,n){"use strict";var i=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e};Object.defineProperty(e,"__esModule",{value:!0});const r=n(62),o=i(n(6));e.OrdinalScaleModel=class extends r.ScaleModel{defaults(){return Object.assign({},r.ScaleModel.prototype.defaults(),{_model_name:"OrdinalScaleModel",_view_name:"OrdinalScale",domain:[]})}initialize(t,e){super.initialize(t,e)}set_init_state(){this.type="ordinal",this.min_from_data=!0,this.max_from_data=!0}set_listeners(){this.on("change:domain",this.domain_changed,this),this.domain_changed(),this.on("change:reverse",this.reverse_changed,this),this.reverse_changed()}domain_changed(){this.ord_domain=this.get("domain"),null!==this.ord_domain&&0!==this.ord_domain.length?(this.max_from_data=!1,this.min_from_data=!1,this.domain=this.ord_domain.map(function(t){return t}),this.trigger("domain_changed")):(this.max_from_data=!0,this.min_from_data=!0,this.domain=[],this.update_domain())}reverse_changed(t){const e=void 0!==t&&t.previous("reverse");this.reverse=this.get("reverse");const n=(e+this.reverse)%2;this.domain.length>0&&1===n&&(this.domain.reverse(),this.trigger("domain_changed",this.domain))}update_domain(){let t=[];for(let e in this.domains)t=o.union(t,this.domains[e]);this.domain.length===t.length&&o.intersection(this.domain,t).length===t.length||(this.domain=t,this.trigger("domain_changed",t))}compute_and_set_domain(t,e){if(!this.min_from_data&&!this.max_from_data)return;if(0===t.length)return void this.set_domain([],e);const n=o.flatten(t);this.get("reverse")&&n.reverse(),this.set_domain(n,e)}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.point_in_lasso=function(t,e){for(var n,i,r,o,a=t[0],s=t[1],c=!1,l=0,u=e.length-1;ls!=(o=e[u][1])>s&&a<(i-n)*(s-r)/(o-r)+n&&(c=!c);return c}},function(t,e,n){"use strict";var i=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e};Object.defineProperty(e,"__esModule",{value:!0});const r=i(n(2)),o=n(50);e.ColorScale=class extends o.Scale{render(){this.create_d3_scale(),this.update_extrapolation(),this.model.domain.length>0&&this.scale.domain(this.model.domain),this.offset=0,this.create_event_listeners(),this.set_range()}create_d3_scale(){this.scale=r.scaleLinear()}create_event_listeners(){super.create_event_listeners(),this.listenTo(this.model,"colors_changed",this.set_range),this.model.on("change:extrapolation",function(){this.update_extrapolation(),this.trigger("color_scale_range_changed")},this)}update_extrapolation(){this.scale.clamp("constant"===this.model.get("extrapolation"))}set_range(){this.scale.range(this.model.color_range),this.trigger("color_scale_range_changed")}}},function(t,e,n){"use strict";var i=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e};Object.defineProperty(e,"__esModule",{value:!0});const r=i(n(6)),o=i(n(2)),a=n(63),s=i(n(84));e.ColorScaleModel=class extends a.LinearScaleModel{defaults(){return Object.assign({},a.LinearScaleModel.prototype.defaults(),{_model_name:"ColorScaleModel",_view_name:"ColorScale",mid:null,scheme:"RdYlGn",extrapolation:"constant",colors:null})}set_init_state(){this.type="color_linear",this.color_range=[],this.mid=null}set_listeners(){super.set_listeners(),this.on_some_change(["colors","scheme"],this.colors_changed,this),this.on("change:mid",this.update_domain,this),this.colors_changed()}update_domain(){const t=this,e=this.min_from_data?o.min(r.map(this.domains,function(e){return e.length>0?e[0]:t.global_max})):this.min,n=this.max_from_data?o.max(r.map(this.domains,function(e){return e.length>0?e[e.length-1]:t.global_min})):this.max,i=this.mid;this.mid=this.get("mid");const a=this.domain,s=a.length,c=this.color_range.length;e==a[0]&&n==a[s-1]&&c==s&&this.mid==i||(this.domain=this.create_domain(e,this.mid,n,c),this.trigger("domain_changed",this.domain))}create_domain(t,e,n,i){const r=o.scaleLinear();if(null==e)r.domain([0,i-1]).range([t,n]);else{const o=i/2;r.domain([0,o,i-1]).range([t,e,n])}const a=[];for(let t=0;t0?t:s.get_linear_scale_range(this.get("scheme")),this.update_domain(),this.trigger("colors_changed")}toDomainType(t){return t}}},function(t,e,n){"use strict";var i=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e};Object.defineProperty(e,"__esModule",{value:!0});const r=i(n(6)),o=i(n(2)),a=n(19),s=i(n(64)).symbol;e.Lines=class extends a.Mark{render(){const t=super.render(),e=this;return this.dot=s().size(this.model.get("marker_size")),this.model.get("marker")&&this.dot.type(this.model.get("marker")),this.displayed.then(function(){e.parent.tooltip_div.node().appendChild(e.tooltip_div.node()),e.create_tooltip()}),this.display_el_classes=["line","legendtext","dot"],t.then(function(){e.event_listeners={},e.process_interactions(),e.create_listeners(),e.compute_view_padding(),e.draw(!1)})}set_ranges(){const t=this.scales.x;t&&t.set_range(this.parent.padded_range("x",t.model));const e=this.scales.y;e&&e.set_range(this.parent.padded_range("y",e.model))}set_positional_scales(){const t=this.scales.x,e=this.scales.y;this.listenTo(t,"domain_changed",function(){this.model.dirty||this.update_line_xy()}),this.listenTo(e,"domain_changed",function(){this.model.dirty||this.update_line_xy()})}initialize_additional_scales(){const t=this.scales.color;t&&(this.listenTo(t,"domain_changed",function(){this.update_style()}),t.on("color_scale_range_changed",this.update_style,this))}create_listeners(){super.create_listeners(),this.d3el.on("mouseover",r.bind(function(){this.event_dispatcher("mouse_over")},this)).on("mousemove",r.bind(function(){this.event_dispatcher("mouse_move")},this)).on("mouseout",r.bind(function(){this.event_dispatcher("mouse_out")},this)),this.listenTo(this.model,"change:tooltip",this.create_tooltip),this.listenTo(this.model,"change:interpolation",this.update_path_style),this.listenTo(this.model,"change:close_path",this.update_path_style),this.listenTo(this.model,"change:colors",this.update_style),this.listenTo(this.model,"change:opacities",this.update_style),this.listenTo(this.model,"change:fill_opacities",this.update_style),this.listenTo(this.model,"change:fill_colors",this.update_style),this.listenTo(this.model,"change:fill",this.update_fill),this.listenTo(this.model,"data_updated",function(){this.draw(!0)}),this.listenTo(this.model,"labels_updated",this.update_labels),this.listenTo(this.model,"change:stroke_width",this.update_stroke_width),this.listenTo(this.model,"change:labels_visibility",this.update_legend_labels),this.listenTo(this.model,"change:curves_subset",this.update_curves_subset),this.listenTo(this.model,"change:line_style",this.update_line_style),this.listenTo(this.model,"change:interactions",this.process_interactions),this.listenTo(this.parent,"bg_clicked",function(){this.event_dispatcher("parent_clicked")}),this.listenTo(this.model,"change:marker",this.update_marker),this.listenTo(this.model,"change:marker_size",this.update_marker_size)}update_legend_labels(){"none"===this.model.get("labels_visibility")?(this.d3el.selectAll(".legend").attr("display","none"),this.d3el.selectAll(".curve_label").attr("display","none")):"label"===this.model.get("labels_visibility")?(this.d3el.selectAll(".legend").attr("display","none"),this.d3el.selectAll(".curve_label").attr("display","inline")):(this.d3el.selectAll(".legend").attr("display","inline"),this.d3el.selectAll(".curve_label").attr("display","none"))}update_labels(){this.d3el.selectAll(".curve").data(this.model.mark_data).select(".curve_label").text(function(t){return t.name})}get_line_style(){switch(this.model.get("line_style")){case"solid":return"none";case"dashed":return"10,10";case"dotted":return"2,10";case"dash_dotted":return"10,5,2,5"}}update_line_style(){this.d3el.selectAll(".curve").select(".line").style("stroke-dasharray",r.bind(this.get_line_style,this)),this.legend_el&&this.legend_el.select("path").style("stroke-dasharray",r.bind(this.get_line_style,this))}update_stroke_width(t,e){this.compute_view_padding(),this.d3el.selectAll(".curve").select(".line").style("stroke-width",e),this.legend_el&&this.legend_el.select("path").style("stroke-width",e)}update_style(){const t=this,e=this.model.get("fill"),n=this.model.get("fill_colors"),i=this.model.get("opacities"),r=this.model.get("fill_opacities"),o=this.d3el.selectAll(".curve");o.select(".line").style("opacity",function(t,e){return i[e]}).style("stroke",function(e,i){return t.get_element_color(e,i)||n[i]}).style("fill",function(n,i){return"inside"===e?t.get_fill_color(n,i):""}).style("fill-opacity",function(t,n){return"inside"===e?r[n]:""}),o.select(".area").style("fill",function(e,n){return t.get_fill_color(e,n)}).style("opacity",function(t,e){return r[e]}),this.update_marker_style(),this.legend_el&&(this.legend_el.select(".line").style("stroke",function(e,i){return t.get_element_color(e,i)||n[i]}).style("opacity",function(t,e){return i[e]}).style("fill",function(e,n){return"none"===t.model.get("fill")?"":t.get_fill_color(e,n)}),this.legend_el.select(".dot").style("stroke",function(e,i){return t.get_element_color(e,i)||n[i]}).style("opacity",function(t,e){return i[e]}).style("fill",function(e,i){return t.get_element_color(e,i)||n[i]}),this.legend_el.select("text").style("fill",function(e,i){return t.get_element_color(e,i)||n[i]}).style("opacity",function(t,e){return i[e]})),this.update_stroke_width(this.model,this.model.get("stroke_width")),this.update_line_style()}path_closure(){return this.model.get("close_path")?"Z":""}update_path_style(){const t=this.get_interpolation();this.line.curve(t),this.area.curve(t);const e=this;this.d3el.selectAll(".curve").select(".line").attr("d",function(t){return e.line(t.values)+e.path_closure()}),this.d3el.selectAll(".curve").select(".area").transition("update_path_style").duration(0).attr("d",function(t){return e.area(t.values)}),this.legend_el&&(this.legend_line.curve(t),this.legend_el.selectAll("path").attr("d",this.legend_line(this.legend_path_data)+this.path_closure()))}relayout(){this.set_ranges(),this.update_line_xy(!1)}selector_changed(t,e){if(void 0===t)return this.model.set("selected",null),this.touch(),[];const n=this.pixel_coords,i=new Uint32Array(r.range(n.length)).filter(e=>t(n[e]));this.model.set("selected",i),this.touch()}invert_point(t){if(void 0===t)return this.model.set("selected",null),void this.touch();const e=Math.min(this.bisect(this.x_pixels,t),Math.max(this.x_pixels.length-1,0));this.model.set("selected",new Uint32Array([e])),this.touch()}update_multi_range(t){const e=t[0],n=t[1],i=this.model.x_data[0]instanceof Array?this.model.x_data[0]:this.model.x_data,r=this.bisect(i,e),o=Math.min(this.bisect(i,n),Math.max(i.length-1,0));this.selector_model.set("selected",[r,o]),this.selector.touch()}draw_legend(t,e,n,i,a){const s=this.model.get_labels(),c=this.model.mark_data.map(function(t){return{index:t.index,name:t.name,color:t.color}});this.legend_el=t.selectAll(".legend"+this.uuid).data(c);const l=this,u=.8*a,h=this.model.get("fill_colors"),d=this.model.get("opacities");this.legend_line=o.line().curve(this.get_interpolation()).x(function(t){return t[0]}).y(function(t){return t[1]}),this.legend_path_data=[[0,u],[u/2,0],[u,u/2]];const f=this.legend_el.enter().append("g").attr("class","legend"+this.uuid).attr("transform",function(t,e){return"translate(0, "+(e*a+n)+")"}).on("mouseover",r.bind(function(){this.event_dispatcher("legend_mouse_over")},this)).on("mouseout",r.bind(function(){this.event_dispatcher("legend_mouse_out")},this)).on("click",r.bind(function(){this.event_dispatcher("legend_clicked")},this));f.append("path").attr("class","line").attr("fill","none").attr("d",this.legend_line(this.legend_path_data)+this.path_closure()).style("stroke",function(t,e){return l.get_element_color(t,e)||h[e]}).style("fill",function(t,e){return"none"===l.model.get("fill")?"":l.get_fill_color(t,e)}).style("opacity",function(t,e){return d[e]}).style("stroke-width",this.model.get("stroke_width")).style("stroke-dasharray",r.bind(this.get_line_style,this)),this.model.get("marker")&&f.append("path").attr("class","dot").attr("transform","translate("+u/2+",0)").attr("d",l.dot.size(25)).style("fill",function(t,e){return l.get_element_color(t,e)}),f.append("text").attr("class","legendtext").attr("x",1.2*u).attr("y",u/2).attr("dy","0.35em").text(function(t,e){return s[e]}).style("fill",function(t,e){return l.get_element_color(t,e)||h[e]}).style("opacity",function(t,e){return d[e]}),f.merge(this.legend_el);const p=o.max(s,function(t){return t.length});return this.legend_el.exit().remove(),[this.model.mark_data.length,p]}update_curves_subset(){const t="label"===this.model.get("labels_visibility"),e=this.model.get("curves_subset");e.length>0?(this.d3el.selectAll(".curve").attr("display",function(t,n){return-1!==e.indexOf(n)?"inline":"none"}).select(".curve_label").attr("display",function(n,i){return-1!==e.indexOf(i)&&t?"inline":"none"}),this.legend_el&&this.legend_el.attr("display",function(t,n){return-1!==e.indexOf(n)?"inline":"none"}),this.d3el.selectAll(".curve")):(this.d3el.selectAll(".curve").attr("display","inline").select(".curve_label").attr("display",function(e){return t?"inline":"none"}),this.legend_el&&this.legend_el.attr("display","inline"))}update_fill(){const t=this.model.get("fill"),e="top"===t||"bottom"===t||"between"===t,n=this.scales.y;this.area.defined(function(t){return e&&null!==t.y&&isFinite(n.scale(t.y))}),"bottom"==t?this.area.y0(this.parent.plotarea_height):"top"==t?this.area.y0(0):"between"==t&&this.area.y0(function(t){return n.scale(t.y0)+n.offset});const i=this;this.d3el.selectAll(".curve").select(".area").attr("d",function(t){return i.area(t.values)}),this.d3el.selectAll(".curve").select(".line").style("fill",function(e,n){return"inside"===t?i.get_fill_color(e,n):""}),this.legend_el&&this.legend_el.select("path").style("fill",function(e,n){return"none"===t?"":i.get_fill_color(e,n)})}get_element_color(t,e){const n=this.scales.color;return n&&void 0!==t.color&&null!==t.color?n.scale(t.color):this.get_colors(e)}get_fill_color(t,e){const n=this.model.get("fill_colors");return 0===n.length?this.get_element_color(t,e):n[e]}update_line_xy(t){const e=this.scales.x,n=this.scales.y,i=!0===t?this.parent.model.get("animation_duration"):0;this.line.x(function(t){return e.scale(t.x)+e.offset}).y(function(t){return n.scale(t.y)+n.offset});const r=this.model.get("fill");this.area.x(function(t){return e.scale(t.x)+e.offset}).y1(function(t){return n.scale(t.y)+n.offset}),"bottom"==r?this.area.y0(this.parent.plotarea_height):"top"==r?this.area.y0(0):"between"==r&&this.area.y0(function(t){return n.scale(t.y0)+n.offset});const o=this,a=this.d3el.selectAll(".curve");a.select(".line").transition("update_line_xy").attr("d",function(t){return o.line(t.values)+o.path_closure()}).duration(i),a.select(".area").transition("update_line_xy").attr("d",function(t,e){return o.area(t.values)}).duration(i),a.select(".curve_label").transition("update_line_xy").attr("transform",function(t){const i=t.values[t.values.length-1];return"translate("+e.scale(i.x)+","+n.scale(i.y)+")"}).duration(i),this.update_dots_xy(t),this.x_pixels=this.model.mark_data.length>0?this.model.mark_data[0].values.map(function(t){return e.scale(t.x)+e.offset}):[],this.y_pixels=this.model.mark_data.length>0?this.model.mark_data[0].values.map(function(t){return n.scale(t.y)+n.offset}):[],this.pixel_coords=this.model.mark_data.length>0?this.model.mark_data[0].values.map(function(t){return[e.scale(t.x)+e.offset,n.scale(t.y)+n.offset]}):[]}get_interpolation(){return{linear:o.curveLinear,basis:o.curveBasis,cardinal:o.curveCardinal,monotone:o.curveMonotoneY}[this.model.get("interpolation")]}draw(t){this.set_ranges();const e=this.d3el.selectAll(".curve").data(this.model.mark_data),n=this.scales.y,i=e.enter().append("g").attr("class","curve");i.append("path").attr("class","line").attr("fill","none"),i.append("path").attr("class","area"),i.append("text").attr("class","curve_label").attr("x",3).attr("dy",".35em").attr("display","label"!==this.model.get("labels_visibility")?"none":"inline").text(function(t){return t.name});const a=this.model.get("fill"),s="top"===a||"bottom"===a||"between"===a;e.select(".line").attr("id",function(t,e){return"curve"+(e+1)}).on("click",r.bind(function(){this.event_dispatcher("element_clicked")},this)),this.draw_dots(),this.line=o.line().curve(this.get_interpolation()).defined(function(t){return null!==t.y&&isFinite(n.scale(t.y))}),this.area=o.area().curve(this.get_interpolation()).defined(function(t){return s&&null!==t.y&&isFinite(n.scale(t.y))}),e.exit().remove(),this.update_line_xy(t),this.update_style(),this.update_curves_subset()}draw_dots(){if(this.model.get("marker")){const t=this.d3el.selectAll(".curve").selectAll(".dot").data(function(t,e){return t.values.map(function(t){return{x:t.x,y:t.y,sub_index:t.sub_index}})});t.enter().append("path").attr("class","dot"),t.exit().remove()}}update_dots_xy(t){if(this.model.get("marker")){const e=this.scales.x,n=this.scales.y,i=!0===t?this.parent.model.get("animation_duration"):0;this.d3el.selectAll(".curve").selectAll(".dot").transition("update_dots_xy").duration(i).attr("transform",function(t){return"translate("+(e.scale(t.x)+e.offset)+","+(n.scale(t.y)+n.offset)+")"}).attr("d",this.dot.size(this.model.get("marker_size")).type(this.model.get("marker")))}}compute_view_padding(){let t;if(this.model.get("marker")){const e=Math.sqrt(this.model.get("marker_size"))/2+1,n=this.model.get("stroke_width")/2;t=Math.max(e,n)}else t=this.model.get("stroke_width")/2;const e=t;t===this.x_padding&&e===this.y_padding||(this.x_padding=t,this.y_padding=e,this.trigger("mark_padding_updated"))}update_marker_style(){const t=this,e=this.model.get("fill_colors"),n=this.model.get("opacities");this.d3el.selectAll(".curve").each(function(i,r){o.select(this).selectAll(".dot").style("opacity",n[r]).style("fill",t.get_element_color(i,r)||e[r])})}update_marker(t,e){e?(this.draw_dots(),this.update_dots_xy(!1),this.update_marker_style(),this.legend_el&&this.legend_el.select(".dot").attr("d",this.dot.type(e).size(25))):(this.d3el.selectAll(".dot").remove(),this.legend_el&&this.legend_el.select(".dot").attr("d",this.dot.size(0)))}update_marker_size(t,e){this.compute_view_padding(),this.d3el.selectAll(".dot").attr("d",this.dot.size(e))}clear_style(t,e){}set_default_style(t){}set_style_on_elements(t,e){}}},function(t,e,n){"use strict";var i=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e},r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const o=i(n(10)),a=i(n(2));n(31);const s=i(n(6)),c=i(n(144)),l=r(n(145)),u=i(n(146));u.ShaderChunk.scales=n(309).default;e.Figure=class extends o.DOMWidgetView{constructor(){super(...arguments),this.relayoutRequested=!1}initialize(){this.el.classList.add("bqplot"),this.el.classList.add("figure"),this.el.classList.add("jupyter-widgets"),this.change_theme();const t=document.createElementNS(a.namespaces.svg,"svg");t.classList.add("svg-figure"),this.svg=a.select(t);const e=document.createElementNS(a.namespaces.svg,"svg");e.classList.add("svg-background"),this.svg_background=a.select(e),this.el.appendChild(e),this.el.appendChild(t),this._initial_marks_created=new Promise(t=>{this._initial_marks_created_resolve=t}),super.initialize.apply(this,arguments)}getFigureSize(){const t=this.el.getBoundingClientRect(),e=t.width/t.height,n=this.model.get("min_aspect_ratio"),i=this.model.get("max_aspect_ratio");return ei&&(t.width=t.height*i),t}render(){this.displayed.then(()=>{this.layoutPromise.then(this.renderImpl.bind(this))})}renderImpl(){const t=this.getFigureSize();return this.width=t.width,this.height=t.height,this.id=o.uuid(),this.x_pad_dict={},this.y_pad_dict={},this.x_padding_arr={},this.y_padding_arr={},this.figure_padding_x=this.model.get("padding_x"),this.figure_padding_y=this.model.get("padding_y"),this.clip_id="clip_path_"+this.id,this.margin=this.model.get("fig_margin"),this.update_plotarea_dimensions(),this.plotarea_width<1||this.plotarea_width<1?this.el.style.visibility="hidden":this.el.style.visibility="",this.fig=this.svg.append("g").attr("transform","translate("+this.margin.left+","+this.margin.top+")"),this.fig_background=this.svg_background.append("g").attr("transform","translate("+this.margin.left+","+this.margin.top+")"),this.tooltip_div=a.select(document.createElement("div")).attr("class","tooltip_div"),this.popper_reference=new c.PositionReference({x:0,y:0,width:20,height:20}),this.popper=new l.default(this.popper_reference,this.tooltip_div.node(),{placement:"auto"}),this.bg=this.fig_background.append("rect").attr("class","plotarea_background").attr("x",0).attr("y",0).attr("width",this.plotarea_width).attr("height",this.plotarea_height).styles(this.model.get("background_style")).style("pointer-events","inherit"),this.bg_events=this.fig.append("rect").attr("class","plotarea_events").attr("x",0).attr("y",0).attr("width",this.plotarea_width).attr("height",this.plotarea_height).style("pointer-events","inherit"),this.bg_events.on("click",()=>{this.trigger("bg_clicked")}),this.fig_axes=this.fig_background.append("g"),this.fig_marks=this.fig.append("g"),this.interaction=this.fig.append("g"),this.clip_path=this.svg.append("svg:defs").append("svg:clipPath").attr("id",this.clip_id).append("rect").attr("x",0).attr("y",0).attr("width",this.plotarea_width).attr("height",this.plotarea_height),this.title=this.fig.append("text").attr("class","mainheading").attr("x",.5*this.plotarea_width).attr("y",-this.margin.top/2).attr("dy","1em").styles(this.model.get("title_style")),this.title.text(this.model.get("title")),this.model.on("save_png",this.save_png,this),this.model.on("save_svg",this.save_svg,this),this.create_figure_scales().then(()=>{this.mark_views=new o.ViewList(this.add_mark,this.remove_mark,this);const t=this.mark_views.update(this.model.get("marks")).then(t=>{this.replace_dummy_nodes(t),this.update_marks(t),this.update_legend(),this.set_interaction(this.model.get("interaction")),this._initial_marks_created_resolve(),this.update_gl()});this.axis_views=new o.ViewList(this.add_axis,null,this);const e=this.axis_views.update(this.model.get("axes"));return this.model.on_some_change(["fig_margin","min_aspect_ratio","max_aspect_ratio"],this.relayout,this),this.model.on_some_change(["padding_x","padding_y"],()=>{this.figure_padding_x=this.model.get("padding_x"),this.figure_padding_y=this.model.get("padding_y"),this.trigger("margin_updated")},this),this.model.on("change:axes",(t,e,n)=>{this.axis_views.update(e)},this),this.model.on("change:marks",(t,e,n)=>{this.mark_views.update(e).then(t=>{this.replace_dummy_nodes(t),this.update_marks(t),this.update_legend(),this.update_gl()})},this),this.model.on("change:legend_location",this.update_legend,this),this.model.on("change:title",this.update_title,this),this.model.on("change:interaction",(t,e)=>{Promise.all(this.mark_views.views).then(t=>{this.set_interaction(e)})},this),document.body.appendChild(this.tooltip_div.node()),this.create_listeners(),this.debouncedRelayout=s.debounce(()=>{this.relayout()},300),window.addEventListener("resize",this.debouncedRelayout),this.once("remove",()=>{window.removeEventListener("resize",this.debouncedRelayout)}),Promise.all([t,e])})}createWebGLRenderer(){this.renderer||(this.renderer=new u.WebGLRenderer({antialias:!0,alpha:!0,premultipliedAlpha:!0}),this.renderer.setSize(100,100),this.renderer.setClearAlpha(0),this.renderer.setPixelRatio(this.model.get("pixel_ratio")||window.devicePixelRatio)),this.renderer&&!this.el.contains(this.renderer.domElement)&&this.el.insertBefore(this.renderer.domElement,this.el.childNodes[1]),this.layout_webgl_canvas()}replace_dummy_nodes(t){s.each(t,function(t){null!==t.dummy_node&&(t.dummy_node.parentNode.replaceChild(t.el,t.dummy_node),t.dummy_node=null,this.displayed.then(function(){t.trigger("displayed")}))},this)}create_listeners(){this.listenTo(this.model,"change:title_style",this.title_style_updated),this.listenTo(this.model,"change:background_style",this.background_style_updated),this.listenTo(this.model,"change:layout",this.change_layout),this.listenTo(this.model,"change:legend_style",this.legend_style_updated),this.listenTo(this.model,"change:legend_text",this.legend_text_updated),this.listenTo(this.model,"change:pixel_ratio",()=>{this.renderer&&(this.renderer.setPixelRatio(this.model.get("pixel_ratio")||window.devicePixelRatio),this.update_gl())}),this.listenTo(this.model,"change:theme",this.change_theme)}title_style_updated(){this.title.styles(this.model.get("title_style"))}background_style_updated(){this.bg.styles(this.model.get("background_style"))}legend_style_updated(){this.fig_marks.selectAll(".g_legend").selectAll(".axis").selectAll("rect").styles(this.model.get("legend_style"))}legend_text_updated(){this.fig_marks.selectAll(".g_legend").selectAll("text.legendtext").styles(this.model.get("legend_text"))}create_figure_scales(){const t=this,e=this.create_child_view(this.model.get("scale_x")).then(function(e){t.scale_x=e,t.scale_x.scale.clamp(!0),t.scale_x.set_range([0,t.plotarea_width])}),n=this.create_child_view(this.model.get("scale_y")).then(function(e){t.scale_y=e,t.scale_y.scale.clamp(!0),t.scale_y.set_range([t.plotarea_height,0])});return Promise.all([e,n])}padded_range(t,e){if(!e.get("allow_padding"))return this.range(t);const n=e.model_id;if("x"===t){const t=void 0!==this.x_padding_arr[n]?this.x_padding_arr[n]:0,e=this.plotarea_width*this.figure_padding_x;return[e+t,this.plotarea_width-e-t]}if("y"===t){const t=void 0!==this.y_padding_arr[n]?this.y_padding_arr[n]:0,e=this.plotarea_height*this.figure_padding_y;return[this.plotarea_height-t-e,t+e]}}range(t){return"x"===t?[0,this.plotarea_width]:"y"===t?[this.plotarea_height,0]:void 0}get_mark_plotarea_height(t){if(!t.get("allow_padding"))return this.plotarea_height;const e=t.model_id,n=void 0!==this.y_padding_arr[e]?this.y_padding_arr[e]:0;return this.plotarea_height*(1-this.figure_padding_y)-n-n}get_mark_plotarea_width(t){if(!t.get("allow_padding"))return this.plotarea_width;const e=t.model_id,n=void 0!==this.x_padding_arr[e]?this.x_padding_arr[e]:0;return this.plotarea_width*(1-this.figure_padding_x)-n-n}add_axis(t){const e=this;return this.create_child_view(t).then(function(t){return e.fig_axes.node().appendChild(t.el),e.displayed.then(function(){t.trigger("displayed")}),t})}remove_from_padding_dict(t,e,n){if(null==n)return;const i=n.model_id;void 0!==t[i]&&(delete t[i][e.model.model_id+"_"+e.cid],0===Object.keys(t[i]).length&&delete t[i])}update_padding_dict(t,e,n,i){const r=n.model_id;t[r]||(t[r]={}),t[r][e.model.model_id+"_"+e.cid]=i}mark_scales_updated(t){const e=t.model,n=e.previous("scales");this.remove_from_padding_dict(this.x_pad_dict,t,n[e.get_key_for_orientation("horizontal")]),this.remove_from_padding_dict(this.y_pad_dict,t,n[e.get_key_for_orientation("vertical")]);const i=e.get("scales");this.update_padding_dict(this.x_pad_dict,t,i[e.get_key_for_orientation("horizontal")],t.x_padding),this.update_padding_dict(this.y_pad_dict,t,i[e.get_key_for_orientation("vertical")],t.y_padding),this.update_paddings()}mark_padding_updated(t){const e=t.model,n=e.get("scales");this.update_padding_dict(this.x_pad_dict,t,n[e.get_key_for_orientation("horizontal")],t.x_padding),this.update_padding_dict(this.y_pad_dict,t,n[e.get_key_for_orientation("vertical")],t.y_padding),this.update_paddings()}update_marks(t){this.update_paddings()}remove_mark(t){const e=t.model;e.off("redraw_legend",null,this),e.off("data_updated",null,this),e.off("scales_updated",null,this),e.off("mark_padding_updated",null,this);const n=e.get("scales");this.remove_from_padding_dict(this.x_pad_dict,t,n[e.get_key_for_orientation("horizontal")]),this.remove_from_padding_dict(this.y_pad_dict,t,n[e.get_key_for_orientation("vertical")]),t.remove()}add_mark(t){t.state_change.then(()=>{t.on("data_updated redraw_legend",this.update_legend,this)});const e=this.fig_marks.node().appendChild(document.createElementNS(a.namespaces.svg,"g"));return this.create_child_view(t,{clip_id:this.clip_id}).then(t=>{t.dummy_node=e,t.on("mark_padding_updated",()=>{this.mark_padding_updated(t)},this),t.on("mark_scales_updated",()=>{this.mark_scales_updated(t)},this);let n=t.model.get("scales")[t.model.get_key_for_dimension("x")],i=t.model.get("scales")[t.model.get_key_for_dimension("y")];return void 0===n&&(n=this.scale_x.model),void 0===i&&(i=this.scale_y.model),this.update_padding_dict(this.x_pad_dict,t,n,t.x_padding),this.update_padding_dict(this.y_pad_dict,t,i,t.y_padding),t.render_gl&&this.createWebGLRenderer(),t})}update_paddings(){this.x_padding_arr={},this.y_padding_arr={};const t=this;s.forEach(this.x_pad_dict,function(e,n){let i=0;s.forEach(e,function(t,e){i=Math.max(i,t)}),t.x_padding_arr[n]=i}),s.forEach(this.y_pad_dict,function(e,n){let i=0;s.forEach(e,function(t,e){i=Math.max(i,t)}),t.y_padding_arr[n]=i}),this.trigger("margin_updated")}update_plotarea_dimensions(){this.plotarea_width=this.width-this.margin.left-this.margin.right,this.plotarea_height=this.height-this.margin.top-this.margin.bottom}processPhosphorMessage(t){switch(super.processPhosphorMessage.apply(this,arguments),t.type){case"resize":case"after-show":case"after-attach":if(this.pWidget.isVisible){const t=this.getFigureSize();this.width===t.width&&this.height===t.height||this.debouncedRelayout()}}}relayout(){const t=()=>{this.relayoutRequested=!1;const t=this.getFigureSize();this.width=t.width,this.height=t.height,this.margin=this.model.get("fig_margin"),this.update_plotarea_dimensions(),this.plotarea_width<1||this.plotarea_width<1?this.el.style.visibility="hidden":(this.el.style.visibility="",void 0!==this.scale_x&&null!==this.scale_x&&this.scale_x.set_range([0,this.plotarea_width]),void 0!==this.scale_y&&null!==this.scale_y&&this.scale_y.set_range([this.plotarea_height,0]),this.fig.attr("transform","translate("+this.margin.left+","+this.margin.top+")"),this.fig_background.attr("transform","translate("+this.margin.left+","+this.margin.top+")"),this.title.attrs({x:.5*this.plotarea_width,y:-this.margin.top/2,dy:"1em"}),this.bg.attr("width",this.plotarea_width).attr("height",this.plotarea_height),this.bg_events.attr("width",this.plotarea_width).attr("height",this.plotarea_height),this.clip_path.attr("width",this.plotarea_width).attr("height",this.plotarea_height),this.trigger("margin_updated"),this.update_legend(),this.layout_webgl_canvas())};this.relayoutRequested||(this.relayoutRequested=!0,requestAnimationFrame(t.bind(this)))}layout_webgl_canvas(){this.renderer&&(this.renderer.domElement.style="left: "+this.margin.left+"px; top: "+this.margin.top+"px;",this.renderer.setSize(this.plotarea_width,this.plotarea_height),this.update_gl())}update_legend(){this.fig_marks.selectAll(".g_legend").remove();const t=this.model.get("legend_location"),e=this.fig_marks.append("g").attr("class","g_legend"),n=this;let i=1,r=1;void 0!==this.mark_views&&null!==this.mark_views&&Promise.all(this.mark_views.views).then(function(o){o.forEach(function(t){if(t.model.get("display_legend")){const n=t.draw_legend(e,0,16*i,0,16);i+=n[0],r=n[1]?Math.max(r,n[1]):r}});const a=n.get_legend_coords(t,24,16*(i+1),0);1!==i&&e.insert("g",":first-child").attr("class","axis").append("rect").attr("y",8).attr("x",-8).attr("width",r+2+"em").attr("height",16*i),r="top-right"===t||"right"===t||"bottom-right"===t?-(r+2):1,e.attr("transform","translate("+String(a[0]+16*r)+" "+String(a[1])+") "),e.selectAll("text.legendtext").styles(n.model.get("legend_text")),e.selectAll(".axis").selectAll("rect").styles(n.model.get("legend_style"))})}get_legend_coords(t,e,n,i){let r=0,o=0;const a=this.plotarea_width,s=this.plotarea_height;switch(t){case"top":r=.5*a-e,o=0;break;case"top-right":r=a-i,o=0;break;case"right":r=a-i,o=.5*s-n;break;case"bottom-right":r=a-i,o=s-n;break;case"bottom":r=.5*a-e,o=s-n;break;case"bottom-left":r=0,o=s-n;break;case"left":r=0,o=.5*s-n;break;default:r=0,o=0}return[r,o]}set_interaction(t){return t?t.state_change.then(()=>this.create_child_view(t).then(t=>(this.interaction_view&&this.interaction_view.remove(),this.interaction_view=t,this.interaction.node().appendChild(t.el),this.displayed.then(()=>{t.trigger("displayed")}),t))):(this.interaction_view&&this.interaction_view.remove(),Promise.resolve(null))}update_title(t,e){this.title.text(this.model.get("title"))}remove(){return void 0!==this.mark_views&&null!==this.mark_views&&this.mark_views.remove(),void 0!==this.axis_views&&null!==this.axis_views&&this.axis_views.remove(),void 0!==this.tooltip_div&&this.tooltip_div.remove(),super.remove.apply(this,arguments)}get_svg(){return this.render_gl().then(()=>{const t=this.svg_background.node(),e=this.svg.node(),n=this.plotarea_width,i=this.plotarea_height,r=e.cloneNode(!0);r.setAttribute("version","1.1"),r.setAttribute("xmlns","http://www.w3.org/2000/svg"),r.setAttribute("xmlns:xlink","http://www.w3.org/1999/xlink"),r.style.background=window.getComputedStyle(document.body).background;const o=window.getComputedStyle(this.el);var s=function(t,e){let n="";const i=document.styleSheets;let r;for(let s=0;s0){r=s.selectorText;for(let t=0;t ",":root"])+"\n",c=(s.match(/(--\w[\w-]*)/g)||[]).reduce((t,e)=>`${t}\n\t${e}: ${o.getPropertyValue(e)};`,":root {")+"\n}\n";const l=document.createElement("style");l.setAttribute("type","text/css"),l.innerHTML="";const u=document.createElement("defs");u.appendChild(l);const h=r.children[0],d=t.cloneNode(!0);if(h.insertBefore(d.children[0].children[1],h.children[0]),h.insertBefore(d.children[0].children[0],h.children[0]),this.renderer){const t=this.renderer.domElement.toDataURL("image/png");a.select(h.children[2]).append("image").attr("x",0).attr("y",0).attr("width",1).attr("height",1).attr("preserveAspectRatio","none").attr("transform","scale("+n+", "+i+")").attr("href",t)}return r.insertBefore(u,r.firstChild),r.outerHTML})}get_rendered_canvas(t){return t=t||window.devicePixelRatio,this.get_svg().then(e=>new Promise(n=>{const i=new Image;i.onload=()=>{const e=document.createElement("canvas");e.classList.add("bqplot"),e.width=this.width*t,e.height=this.height*t,e.style.width=this.width,e.style.height=this.height;const r=e.getContext("2d");r.scale(t,t),r.drawImage(i,0,0),n(e)},i.src="data:image/svg+xml;base64,"+btoa(e)}))}save_png(t,e){this.get_rendered_canvas(e).then(e=>{const n=document.createElement("a");n.download=t||"image.png",n.href=e.toDataURL("image/png"),document.body.appendChild(n),n.click()})}save_svg(t){this.get_svg().then(e=>{const n=document.createElement("a");n.download=t||"bqplot.svg",n.href="data:text/plain;charset=utf-8,"+encodeURIComponent(e),document.body.appendChild(n),n.click(),document.body.removeChild(n)})}update_gl(){this._update_requested||(this._update_requested=!0,requestAnimationFrame(this._update_gl.bind(this)))}_update_gl(){this.render_gl(),this._update_requested=!1}render_gl(){return this.renderer?Promise.all(this.mark_views.views).then(t=>{this.renderer.autoClear=!1,this.renderer.autoClearColor=new u.Color(0),this.renderer.clear();let e=s.filter(t,t=>t.render_gl);s.each(e,t=>{t.render_gl()})}):Promise.resolve()}change_theme(){this.el.classList.remove(this.model.previous("theme")),this.el.classList.add(this.model.get("theme"))}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ElementReference=function(){function t(t){this.elt=t}return t.prototype.getBoundingClientRect=function(){return this.elt.getBoundingClientRect()},Object.defineProperty(t.prototype,"clientWidth",{get:function(){return this.elt.clientWidth},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"clientHeight",{get:function(){return this.elt.clientHeight},enumerable:!0,configurable:!0}),t}(),e.PositionReference=function(){function t(t){const e=t.x,n=t.y,i=t.width,r=t.height;this.x=e,this.y=n,this.width=i,this.height=r}return t.prototype.getBoundingClientRect=function(){const t=this.width/2,e=this.height/2;return{left:this.x-t,right:this.x+t,top:this.y-e,bottom:this.y+e,width:this.width,height:this.height}},Object.defineProperty(t.prototype,"clientWidth",{get:function(){return this.width},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"clientHeight",{get:function(){return this.height},enumerable:!0,configurable:!0}),t}()},function(t,e,n){"use strict";n.r(e),function(t){for( /**! * @fileOverview Kickass library to create and place poppers near their reference elements. * @version 1.15.0 * @license * Copyright (c) 2016 Federico Zivolo and contributors * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ var n="undefined"!=typeof window&&"undefined"!=typeof document,i=["Edge","Trident","Firefox"],r=0,o=0;o=0){r=1;break}var a=n&&window.Promise?function(t){var e=!1;return function(){e||(e=!0,window.Promise.resolve().then(function(){e=!1,t()}))}}:function(t){var e=!1;return function(){e||(e=!0,setTimeout(function(){e=!1,t()},r))}};function s(t){return t&&"[object Function]"==={}.toString.call(t)}function c(t,e){if(1!==t.nodeType)return[];var n=t.ownerDocument.defaultView.getComputedStyle(t,null);return e?n[e]:n}function l(t){return"HTML"===t.nodeName?t:t.parentNode||t.host}function u(t){if(!t)return document.body;switch(t.nodeName){case"HTML":case"BODY":return t.ownerDocument.body;case"#document":return t.body}var e=c(t),n=e.overflow,i=e.overflowX,r=e.overflowY;return/(auto|scroll|overlay)/.test(n+r+i)?t:u(l(t))}var h=n&&!(!window.MSInputMethodContext||!document.documentMode),d=n&&/MSIE 10/.test(navigator.userAgent);function f(t){return 11===t?h:10===t?d:h||d}function p(t){if(!t)return document.documentElement;for(var e=f(10)?document.body:null,n=t.offsetParent||null;n===e&&t.nextElementSibling;)n=(t=t.nextElementSibling).offsetParent;var i=n&&n.nodeName;return i&&"BODY"!==i&&"HTML"!==i?-1!==["TH","TD","TABLE"].indexOf(n.nodeName)&&"static"===c(n,"position")?p(n):n:t?t.ownerDocument.documentElement:document.documentElement}function m(t){return null!==t.parentNode?m(t.parentNode):t}function g(t,e){if(!(t&&t.nodeType&&e&&e.nodeType))return document.documentElement;var n=t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_FOLLOWING,i=n?t:e,r=n?e:t,o=document.createRange();o.setStart(i,0),o.setEnd(r,0);var a,s,c=o.commonAncestorContainer;if(t!==c&&e!==c||i.contains(r))return"BODY"===(s=(a=c).nodeName)||"HTML"!==s&&p(a.firstElementChild)!==a?p(c):c;var l=m(t);return l.host?g(l.host,e):g(t,m(e).host)}function _(t){var e="top"===(arguments.length>1&&void 0!==arguments[1]?arguments[1]:"top")?"scrollTop":"scrollLeft",n=t.nodeName;if("BODY"===n||"HTML"===n){var i=t.ownerDocument.documentElement;return(t.ownerDocument.scrollingElement||i)[e]}return t[e]}function v(t,e){var n="x"===e?"Left":"Top",i="Left"===n?"Right":"Bottom";return parseFloat(t["border"+n+"Width"],10)+parseFloat(t["border"+i+"Width"],10)}function b(t,e,n,i){return Math.max(e["offset"+t],e["scroll"+t],n["client"+t],n["offset"+t],n["scroll"+t],f(10)?parseInt(n["offset"+t])+parseInt(i["margin"+("Height"===t?"Top":"Left")])+parseInt(i["margin"+("Height"===t?"Bottom":"Right")]):0)}function y(t){var e=t.body,n=t.documentElement,i=f(10)&&getComputedStyle(n);return{height:b("Height",e,n,i),width:b("Width",e,n,i)}}var x=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},w=function(){function t(t,e){for(var n=0;n2&&void 0!==arguments[2]&&arguments[2],i=f(10),r="HTML"===e.nodeName,o=A(t),a=A(e),s=u(t),l=c(e),h=parseFloat(l.borderTopWidth,10),d=parseFloat(l.borderLeftWidth,10);n&&r&&(a.top=Math.max(a.top,0),a.left=Math.max(a.left,0));var p=S({top:o.top-a.top-h,left:o.left-a.left-d,width:o.width,height:o.height});if(p.marginTop=0,p.marginLeft=0,!i&&r){var m=parseFloat(l.marginTop,10),g=parseFloat(l.marginLeft,10);p.top-=h-m,p.bottom-=h-m,p.left-=d-g,p.right-=d-g,p.marginTop=m,p.marginLeft=g}return(i&&!n?e.contains(s):e===s&&"BODY"!==s.nodeName)&&(p=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=_(e,"top"),r=_(e,"left"),o=n?-1:1;return t.top+=i*o,t.bottom+=i*o,t.left+=r*o,t.right+=r*o,t}(p,e)),p}function k(t){if(!t||!t.parentElement||f())return document.documentElement;for(var e=t.parentElement;e&&"none"===c(e,"transform");)e=e.parentElement;return e||document.documentElement}function P(t,e,n,i){var r=arguments.length>4&&void 0!==arguments[4]&&arguments[4],o={top:0,left:0},a=r?k(t):g(t,e);if("viewport"===i)o=function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=t.ownerDocument.documentElement,i=T(t,n),r=Math.max(n.clientWidth,window.innerWidth||0),o=Math.max(n.clientHeight,window.innerHeight||0),a=e?0:_(n),s=e?0:_(n,"left");return S({top:a-i.top+i.marginTop,left:s-i.left+i.marginLeft,width:r,height:o})}(a,r);else{var s=void 0;"scrollParent"===i?"BODY"===(s=u(l(e))).nodeName&&(s=t.ownerDocument.documentElement):s="window"===i?t.ownerDocument.documentElement:i;var h=T(s,a,r);if("HTML"!==s.nodeName||function t(e){var n=e.nodeName;if("BODY"===n||"HTML"===n)return!1;if("fixed"===c(e,"position"))return!0;var i=l(e);return!!i&&t(i)}(a))o=h;else{var d=y(t.ownerDocument),f=d.height,p=d.width;o.top+=h.top-h.marginTop,o.bottom=f+h.top,o.left+=h.left-h.marginLeft,o.right=p+h.left}}var m="number"==typeof(n=n||0);return o.left+=m?n:n.left||0,o.top+=m?n:n.top||0,o.right-=m?n:n.right||0,o.bottom-=m?n:n.bottom||0,o}function L(t,e,n,i,r){var o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;if(-1===t.indexOf("auto"))return t;var a=P(n,i,o,r),s={top:{width:a.width,height:e.top-a.top},right:{width:a.right-e.right,height:a.height},bottom:{width:a.width,height:a.bottom-e.bottom},left:{width:e.left-a.left,height:a.height}},c=Object.keys(s).map(function(t){return E({key:t},s[t],{area:(e=s[t],e.width*e.height)});var e}).sort(function(t,e){return e.area-t.area}),l=c.filter(function(t){var e=t.width,i=t.height;return e>=n.clientWidth&&i>=n.clientHeight}),u=l.length>0?l[0].key:c[0].key,h=t.split("-")[1];return u+(h?"-"+h:"")}function O(t,e,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;return T(n,i?k(e):g(e,n),i)}function C(t){var e=t.ownerDocument.defaultView.getComputedStyle(t),n=parseFloat(e.marginTop||0)+parseFloat(e.marginBottom||0),i=parseFloat(e.marginLeft||0)+parseFloat(e.marginRight||0);return{width:t.offsetWidth+i,height:t.offsetHeight+n}}function R(t){var e={left:"right",right:"left",bottom:"top",top:"bottom"};return t.replace(/left|right|bottom|top/g,function(t){return e[t]})}function I(t,e,n){n=n.split("-")[0];var i=C(t),r={width:i.width,height:i.height},o=-1!==["right","left"].indexOf(n),a=o?"top":"left",s=o?"left":"top",c=o?"height":"width",l=o?"width":"height";return r[a]=e[a]+e[c]/2-i[c]/2,r[s]=n===s?e[s]-i[l]:e[R(s)],r}function z(t,e){return Array.prototype.find?t.find(e):t.filter(e)[0]}function B(t,e,n){return(void 0===n?t:t.slice(0,function(t,e,n){if(Array.prototype.findIndex)return t.findIndex(function(t){return t[e]===n});var i=z(t,function(t){return t[e]===n});return t.indexOf(i)}(t,"name",n))).forEach(function(t){t.function&&console.warn("`modifier.function` is deprecated, use `modifier.fn`!");var n=t.function||t.fn;t.enabled&&s(n)&&(e.offsets.popper=S(e.offsets.popper),e.offsets.reference=S(e.offsets.reference),e=n(e,t))}),e}function N(t,e){return t.some(function(t){var n=t.name;return t.enabled&&n===e})}function D(t){for(var e=[!1,"ms","Webkit","Moz","O"],n=t.charAt(0).toUpperCase()+t.slice(1),i=0;i1&&void 0!==arguments[1]&&arguments[1],n=X.indexOf(t),i=X.slice(n+1).concat(X.slice(0,n));return e?i.reverse():i}var K={FLIP:"flip",CLOCKWISE:"clockwise",COUNTERCLOCKWISE:"counterclockwise"};function Z(t,e,n,i){var r=[0,0],o=-1!==["right","left"].indexOf(i),a=t.split(/(\+|\-)/).map(function(t){return t.trim()}),s=a.indexOf(z(a,function(t){return-1!==t.search(/,|\s/)}));a[s]&&-1===a[s].indexOf(",")&&console.warn("Offsets separated by white space(s) are deprecated, use a comma (,) instead.");var c=/\s*,\s*|\s+/,l=-1!==s?[a.slice(0,s).concat([a[s].split(c)[0]]),[a[s].split(c)[1]].concat(a.slice(s+1))]:[a];return(l=l.map(function(t,i){var r=(1===i?!o:o)?"height":"width",a=!1;return t.reduce(function(t,e){return""===t[t.length-1]&&-1!==["+","-"].indexOf(e)?(t[t.length-1]=e,a=!0,t):a?(t[t.length-1]+=e,a=!1,t):t.concat(e)},[]).map(function(t){return function(t,e,n,i){var r=t.match(/((?:\-|\+)?\d*\.?\d*)(.*)/),o=+r[1],a=r[2];if(!o)return t;if(0===a.indexOf("%")){var s=void 0;switch(a){case"%p":s=n;break;case"%":case"%r":default:s=i}return S(s)[e]/100*o}if("vh"===a||"vw"===a)return("vh"===a?Math.max(document.documentElement.clientHeight,window.innerHeight||0):Math.max(document.documentElement.clientWidth,window.innerWidth||0))/100*o;return o}(t,r,e,n)})})).forEach(function(t,e){t.forEach(function(n,i){H(n)&&(r[e]+=n*("-"===t[i-1]?-1:1))})}),r}var J={placement:"bottom",positionFixed:!1,eventsEnabled:!0,removeOnDestroy:!1,onCreate:function(){},onUpdate:function(){},modifiers:{shift:{order:100,enabled:!0,fn:function(t){var e=t.placement,n=e.split("-")[0],i=e.split("-")[1];if(i){var r=t.offsets,o=r.reference,a=r.popper,s=-1!==["bottom","top"].indexOf(n),c=s?"left":"top",l=s?"width":"height",u={start:M({},c,o[c]),end:M({},c,o[c]+o[l]-a[l])};t.offsets.popper=E({},a,u[i])}return t}},offset:{order:200,enabled:!0,fn:function(t,e){var n=e.offset,i=t.placement,r=t.offsets,o=r.popper,a=r.reference,s=i.split("-")[0],c=void 0;return c=H(+n)?[+n,0]:Z(n,o,a,s),"left"===s?(o.top+=c[0],o.left-=c[1]):"right"===s?(o.top+=c[0],o.left+=c[1]):"top"===s?(o.left+=c[0],o.top-=c[1]):"bottom"===s&&(o.left+=c[0],o.top+=c[1]),t.popper=o,t},offset:0},preventOverflow:{order:300,enabled:!0,fn:function(t,e){var n=e.boundariesElement||p(t.instance.popper);t.instance.reference===n&&(n=p(n));var i=D("transform"),r=t.instance.popper.style,o=r.top,a=r.left,s=r[i];r.top="",r.left="",r[i]="";var c=P(t.instance.popper,t.instance.reference,e.padding,n,t.positionFixed);r.top=o,r.left=a,r[i]=s,e.boundaries=c;var l=e.priority,u=t.offsets.popper,h={primary:function(t){var n=u[t];return u[t]c[t]&&!e.escapeWithReference&&(i=Math.min(u[n],c[t]-("right"===t?u.width:u.height))),M({},n,i)}};return l.forEach(function(t){var e=-1!==["left","top"].indexOf(t)?"primary":"secondary";u=E({},u,h[e](t))}),t.offsets.popper=u,t},priority:["left","right","top","bottom"],padding:5,boundariesElement:"scrollParent"},keepTogether:{order:400,enabled:!0,fn:function(t){var e=t.offsets,n=e.popper,i=e.reference,r=t.placement.split("-")[0],o=Math.floor,a=-1!==["top","bottom"].indexOf(r),s=a?"right":"bottom",c=a?"left":"top",l=a?"width":"height";return n[s]o(i[s])&&(t.offsets.popper[c]=o(i[s])),t}},arrow:{order:500,enabled:!0,fn:function(t,e){var n;if(!W(t.instance.modifiers,"arrow","keepTogether"))return t;var i=e.element;if("string"==typeof i){if(!(i=t.instance.popper.querySelector(i)))return t}else if(!t.instance.popper.contains(i))return console.warn("WARNING: `arrow.element` must be child of its popper element!"),t;var r=t.placement.split("-")[0],o=t.offsets,a=o.popper,s=o.reference,l=-1!==["left","right"].indexOf(r),u=l?"height":"width",h=l?"Top":"Left",d=h.toLowerCase(),f=l?"left":"top",p=l?"bottom":"right",m=C(i)[u];s[p]-ma[p]&&(t.offsets.popper[d]+=s[d]+m-a[p]),t.offsets.popper=S(t.offsets.popper);var g=s[d]+s[u]/2-m/2,_=c(t.instance.popper),v=parseFloat(_["margin"+h],10),b=parseFloat(_["border"+h+"Width"],10),y=g-t.offsets.popper[d]-v-b;return y=Math.max(Math.min(a[u]-m,y),0),t.arrowElement=i,t.offsets.arrow=(M(n={},d,Math.round(y)),M(n,f,""),n),t},element:"[x-arrow]"},flip:{order:600,enabled:!0,fn:function(t,e){if(N(t.instance.modifiers,"inner"))return t;if(t.flipped&&t.placement===t.originalPlacement)return t;var n=P(t.instance.popper,t.instance.reference,e.padding,e.boundariesElement,t.positionFixed),i=t.placement.split("-")[0],r=R(i),o=t.placement.split("-")[1]||"",a=[];switch(e.behavior){case K.FLIP:a=[i,r];break;case K.CLOCKWISE:a=Y(i);break;case K.COUNTERCLOCKWISE:a=Y(i,!0);break;default:a=e.behavior}return a.forEach(function(s,c){if(i!==s||a.length===c+1)return t;i=t.placement.split("-")[0],r=R(i);var l=t.offsets.popper,u=t.offsets.reference,h=Math.floor,d="left"===i&&h(l.right)>h(u.left)||"right"===i&&h(l.left)h(u.top)||"bottom"===i&&h(l.top)h(n.right),m=h(l.top)h(n.bottom),_="left"===i&&f||"right"===i&&p||"top"===i&&m||"bottom"===i&&g,v=-1!==["top","bottom"].indexOf(i),b=!!e.flipVariations&&(v&&"start"===o&&f||v&&"end"===o&&p||!v&&"start"===o&&m||!v&&"end"===o&&g),y=!!e.flipVariationsByContent&&(v&&"start"===o&&p||v&&"end"===o&&f||!v&&"start"===o&&g||!v&&"end"===o&&m),x=b||y;(d||_||x)&&(t.flipped=!0,(d||_)&&(i=a[c+1]),x&&(o=function(t){return"end"===t?"start":"start"===t?"end":t}(o)),t.placement=i+(o?"-"+o:""),t.offsets.popper=E({},t.offsets.popper,I(t.instance.popper,t.offsets.reference,t.placement)),t=B(t.instance.modifiers,t,"flip"))}),t},behavior:"flip",padding:5,boundariesElement:"viewport",flipVariations:!1,flipVariationsByContent:!1},inner:{order:700,enabled:!1,fn:function(t){var e=t.placement,n=e.split("-")[0],i=t.offsets,r=i.popper,o=i.reference,a=-1!==["left","right"].indexOf(n),s=-1===["top","left"].indexOf(n);return r[a?"left":"top"]=o[n]-(s?r[a?"width":"height"]:0),t.placement=R(e),t.offsets.popper=S(r),t}},hide:{order:800,enabled:!0,fn:function(t){if(!W(t.instance.modifiers,"hide","preventOverflow"))return t;var e=t.offsets.reference,n=z(t.instance.modifiers,function(t){return"preventOverflow"===t.name}).boundaries;if(e.bottomn.right||e.top>n.bottom||e.right2&&void 0!==arguments[2]?arguments[2]:{};x(this,t),this.scheduleUpdate=function(){return requestAnimationFrame(i.update)},this.update=a(this.update.bind(this)),this.options=E({},t.Defaults,r),this.state={isDestroyed:!1,isCreated:!1,scrollParents:[]},this.reference=e&&e.jquery?e[0]:e,this.popper=n&&n.jquery?n[0]:n,this.options.modifiers={},Object.keys(E({},t.Defaults.modifiers,r.modifiers)).forEach(function(e){i.options.modifiers[e]=E({},t.Defaults.modifiers[e]||{},r.modifiers?r.modifiers[e]:{})}),this.modifiers=Object.keys(this.options.modifiers).map(function(t){return E({name:t},i.options.modifiers[t])}).sort(function(t,e){return t.order-e.order}),this.modifiers.forEach(function(t){t.enabled&&s(t.onLoad)&&t.onLoad(i.reference,i.popper,i.options,t,i.state)}),this.update();var o=this.options.eventsEnabled;o&&this.enableEventListeners(),this.state.eventsEnabled=o}return w(t,[{key:"update",value:function(){return function(){if(!this.state.isDestroyed){var t={instance:this,styles:{},arrowStyles:{},attributes:{},flipped:!1,offsets:{}};t.offsets.reference=O(this.state,this.popper,this.reference,this.options.positionFixed),t.placement=L(this.options.placement,t.offsets.reference,this.popper,this.reference,this.options.modifiers.flip.boundariesElement,this.options.modifiers.flip.padding),t.originalPlacement=t.placement,t.positionFixed=this.options.positionFixed,t.offsets.popper=I(this.popper,t.offsets.reference,t.placement),t.offsets.popper.position=this.options.positionFixed?"fixed":"absolute",t=B(this.modifiers,t),this.state.isCreated?this.options.onUpdate(t):(this.state.isCreated=!0,this.options.onCreate(t))}}.call(this)}},{key:"destroy",value:function(){return function(){return this.state.isDestroyed=!0,N(this.modifiers,"applyStyle")&&(this.popper.removeAttribute("x-placement"),this.popper.style.position="",this.popper.style.top="",this.popper.style.left="",this.popper.style.right="",this.popper.style.bottom="",this.popper.style.willChange="",this.popper.style[D("transform")]=""),this.disableEventListeners(),this.options.removeOnDestroy&&this.popper.parentNode.removeChild(this.popper),this}.call(this)}},{key:"enableEventListeners",value:function(){return function(){this.state.eventsEnabled||(this.state=U(this.reference,this.options,this.state,this.scheduleUpdate))}.call(this)}},{key:"disableEventListeners",value:function(){return F.call(this)}}]),t}();Q.Utils=("undefined"!=typeof window?window:t).PopperUtils,Q.placements=V,Q.Defaults=J,e.default=Q}.call(this,n(25))},function(t,e,n){"use strict";function i(){}n.r(e),n.d(e,"WebGLRenderTargetCube",function(){return sn}),n.d(e,"WebGLRenderTarget",function(){return an}),n.d(e,"WebGLRenderer",function(){return to}),n.d(e,"ShaderLib",function(){return yn}),n.d(e,"UniformsLib",function(){return bn}),n.d(e,"UniformsUtils",function(){return mn}),n.d(e,"ShaderChunk",function(){return pn}),n.d(e,"FogExp2",function(){return eo}),n.d(e,"Fog",function(){return no}),n.d(e,"Scene",function(){return io}),n.d(e,"Sprite",function(){return oo}),n.d(e,"LOD",function(){return ao}),n.d(e,"SkinnedMesh",function(){return lo}),n.d(e,"Skeleton",function(){return so}),n.d(e,"Bone",function(){return co}),n.d(e,"Mesh",function(){return mi}),n.d(e,"LineSegments",function(){return fo}),n.d(e,"LineLoop",function(){return po}),n.d(e,"Line",function(){return ho}),n.d(e,"Points",function(){return go}),n.d(e,"Group",function(){return _o}),n.d(e,"VideoTexture",function(){return vo}),n.d(e,"DataTexture",function(){return cn}),n.d(e,"CompressedTexture",function(){return bo}),n.d(e,"CubeTexture",function(){return Ti}),n.d(e,"CanvasTexture",function(){return Vr}),n.d(e,"DepthTexture",function(){return yo}),n.d(e,"Texture",function(){return rn}),n.d(e,"CompressedTextureLoader",function(){return Xa}),n.d(e,"DataTextureLoader",function(){return Ya}),n.d(e,"CubeTextureLoader",function(){return Za}),n.d(e,"TextureLoader",function(){return Ja}),n.d(e,"ObjectLoader",function(){return ec}),n.d(e,"MaterialLoader",function(){return Ws}),n.d(e,"BufferGeometryLoader",function(){return Vs}),n.d(e,"DefaultLoadingManager",function(){return Ga}),n.d(e,"LoadingManager",function(){return qa}),n.d(e,"JSONLoader",function(){return tc}),n.d(e,"ImageLoader",function(){return Ka}),n.d(e,"ImageBitmapLoader",function(){return ac}),n.d(e,"FontLoader",function(){return uc}),n.d(e,"FileLoader",function(){return Va}),n.d(e,"Loader",function(){return Qs}),n.d(e,"LoaderUtils",function(){return $s}),n.d(e,"Cache",function(){return Ha}),n.d(e,"AudioLoader",function(){return wc}),n.d(e,"SpotLightShadow",function(){return Es}),n.d(e,"SpotLight",function(){return Ss}),n.d(e,"PointLight",function(){return As}),n.d(e,"RectAreaLight",function(){return Ls}),n.d(e,"HemisphereLight",function(){return ws}),n.d(e,"DirectionalLightShadow",function(){return Ts}),n.d(e,"DirectionalLight",function(){return ks}),n.d(e,"AmbientLight",function(){return Ps}),n.d(e,"LightShadow",function(){return Ms}),n.d(e,"Light",function(){return xs}),n.d(e,"StereoCamera",function(){return Mc}),n.d(e,"PerspectiveCamera",function(){return Jr}),n.d(e,"OrthographicCamera",function(){return On}),n.d(e,"CubeCamera",function(){return Ec}),n.d(e,"ArrayCamera",function(){return Qr}),n.d(e,"Camera",function(){return Ln}),n.d(e,"AudioListener",function(){return Sc}),n.d(e,"PositionalAudio",function(){return Tc}),n.d(e,"AudioContext",function(){return xc}),n.d(e,"AudioAnalyser",function(){return kc}),n.d(e,"Audio",function(){return Ac}),n.d(e,"VectorKeyframeTrack",function(){return qs}),n.d(e,"StringKeyframeTrack",function(){return Os}),n.d(e,"QuaternionKeyframeTrack",function(){return zs}),n.d(e,"NumberKeyframeTrack",function(){return Ns}),n.d(e,"ColorKeyframeTrack",function(){return Bs}),n.d(e,"BooleanKeyframeTrack",function(){return Cs}),n.d(e,"PropertyMixer",function(){return Pc}),n.d(e,"PropertyBinding",function(){return Gc}),n.d(e,"KeyframeTrack",function(){return Hs}),n.d(e,"AnimationUtils",function(){return Fs}),n.d(e,"AnimationObjectGroup",function(){return Wc}),n.d(e,"AnimationMixer",function(){return Xc}),n.d(e,"AnimationClip",function(){return Gs}),n.d(e,"Uniform",function(){return Yc}),n.d(e,"InstancedBufferGeometry",function(){return Kc}),n.d(e,"BufferGeometry",function(){return Zn}),n.d(e,"Geometry",function(){return Bn}),n.d(e,"InterleavedBufferAttribute",function(){return Zc}),n.d(e,"InstancedInterleavedBuffer",function(){return Qc}),n.d(e,"InterleavedBuffer",function(){return Jc}),n.d(e,"InstancedBufferAttribute",function(){return $c}),n.d(e,"Face3",function(){return Cn}),n.d(e,"Object3D",function(){return Pn}),n.d(e,"Raycaster",function(){return tl}),n.d(e,"Layers",function(){return Mn}),n.d(e,"EventDispatcher",function(){return i}),n.d(e,"Clock",function(){return il}),n.d(e,"QuaternionLinearInterpolant",function(){return Is}),n.d(e,"LinearInterpolant",function(){return js}),n.d(e,"DiscreteInterpolant",function(){return Us}),n.d(e,"CubicInterpolant",function(){return Ds}),n.d(e,"Interpolant",function(){return Rs}),n.d(e,"Triangle",function(){return pi}),n.d(e,"Math",function(){return Ge}),n.d(e,"Spherical",function(){return rl}),n.d(e,"Cylindrical",function(){return ol}),n.d(e,"Plane",function(){return hn}),n.d(e,"Frustum",function(){return dn}),n.d(e,"Sphere",function(){return un}),n.d(e,"Ray",function(){return di}),n.d(e,"Matrix4",function(){return Ve}),n.d(e,"Matrix3",function(){return Ke}),n.d(e,"Box3",function(){return ln}),n.d(e,"Box2",function(){return al}),n.d(e,"Line3",function(){return fi}),n.d(e,"Euler",function(){return wn}),n.d(e,"Vector4",function(){return on}),n.d(e,"Vector3",function(){return Ye}),n.d(e,"Vector2",function(){return We}),n.d(e,"Quaternion",function(){return Xe}),n.d(e,"Color",function(){return _n}),n.d(e,"ImmediateRenderObject",function(){return sl}),n.d(e,"VertexNormalsHelper",function(){return cl}),n.d(e,"SpotLightHelper",function(){return ll}),n.d(e,"SkeletonHelper",function(){return ul}),n.d(e,"PointLightHelper",function(){return hl}),n.d(e,"RectAreaLightHelper",function(){return dl}),n.d(e,"HemisphereLightHelper",function(){return fl}),n.d(e,"GridHelper",function(){return pl}),n.d(e,"PolarGridHelper",function(){return ml}),n.d(e,"FaceNormalsHelper",function(){return gl}),n.d(e,"DirectionalLightHelper",function(){return _l}),n.d(e,"CameraHelper",function(){return vl}),n.d(e,"BoxHelper",function(){return bl}),n.d(e,"Box3Helper",function(){return yl}),n.d(e,"PlaneHelper",function(){return xl}),n.d(e,"ArrowHelper",function(){return wl}),n.d(e,"AxesHelper",function(){return Ml}),n.d(e,"Shape",function(){return ys}),n.d(e,"Path",function(){return bs}),n.d(e,"ShapePath",function(){return sc}),n.d(e,"Font",function(){return cc}),n.d(e,"CurvePath",function(){return vs}),n.d(e,"Curve",function(){return Qa}),n.d(e,"ShapeUtils",function(){return ca}),n.d(e,"WebGLUtils",function(){return Zr}),n.d(e,"WireframeGeometry",function(){return xo}),n.d(e,"ParametricGeometry",function(){return wo}),n.d(e,"ParametricBufferGeometry",function(){return Mo}),n.d(e,"TetrahedronGeometry",function(){return Ao}),n.d(e,"TetrahedronBufferGeometry",function(){return To}),n.d(e,"OctahedronGeometry",function(){return ko}),n.d(e,"OctahedronBufferGeometry",function(){return Po}),n.d(e,"IcosahedronGeometry",function(){return Lo}),n.d(e,"IcosahedronBufferGeometry",function(){return Oo}),n.d(e,"DodecahedronGeometry",function(){return Co}),n.d(e,"DodecahedronBufferGeometry",function(){return Ro}),n.d(e,"PolyhedronGeometry",function(){return Eo}),n.d(e,"PolyhedronBufferGeometry",function(){return So}),n.d(e,"TubeGeometry",function(){return Io}),n.d(e,"TubeBufferGeometry",function(){return zo}),n.d(e,"TorusKnotGeometry",function(){return Bo}),n.d(e,"TorusKnotBufferGeometry",function(){return No}),n.d(e,"TorusGeometry",function(){return Do}),n.d(e,"TorusBufferGeometry",function(){return jo}),n.d(e,"TextGeometry",function(){return fa}),n.d(e,"TextBufferGeometry",function(){return pa}),n.d(e,"SphereGeometry",function(){return ma}),n.d(e,"SphereBufferGeometry",function(){return ga}),n.d(e,"RingGeometry",function(){return _a}),n.d(e,"RingBufferGeometry",function(){return va}),n.d(e,"PlaneGeometry",function(){return $n}),n.d(e,"PlaneBufferGeometry",function(){return ti}),n.d(e,"LatheGeometry",function(){return ba}),n.d(e,"LatheBufferGeometry",function(){return ya}),n.d(e,"ShapeGeometry",function(){return xa}),n.d(e,"ShapeBufferGeometry",function(){return wa}),n.d(e,"ExtrudeGeometry",function(){return ha}),n.d(e,"ExtrudeBufferGeometry",function(){return da}),n.d(e,"EdgesGeometry",function(){return Ea}),n.d(e,"ConeGeometry",function(){return Ta}),n.d(e,"ConeBufferGeometry",function(){return ka}),n.d(e,"CylinderGeometry",function(){return Sa}),n.d(e,"CylinderBufferGeometry",function(){return Aa}),n.d(e,"CircleGeometry",function(){return Pa}),n.d(e,"CircleBufferGeometry",function(){return La}),n.d(e,"BoxGeometry",function(){return Jn}),n.d(e,"BoxBufferGeometry",function(){return Qn}),n.d(e,"ShadowMaterial",function(){return Ca}),n.d(e,"SpriteMaterial",function(){return ro}),n.d(e,"RawShaderMaterial",function(){return Ra}),n.d(e,"ShaderMaterial",function(){return hi}),n.d(e,"PointsMaterial",function(){return mo}),n.d(e,"MeshPhysicalMaterial",function(){return za}),n.d(e,"MeshStandardMaterial",function(){return Ia}),n.d(e,"MeshPhongMaterial",function(){return Ba}),n.d(e,"MeshToonMaterial",function(){return Na}),n.d(e,"MeshNormalMaterial",function(){return Da}),n.d(e,"MeshLambertMaterial",function(){return ja}),n.d(e,"MeshDepthMaterial",function(){return qr}),n.d(e,"MeshDistanceMaterial",function(){return Gr}),n.d(e,"MeshBasicMaterial",function(){return ui}),n.d(e,"LineDashedMaterial",function(){return Ua}),n.d(e,"LineBasicMaterial",function(){return uo}),n.d(e,"Material",function(){return li}),n.d(e,"Float64BufferAttribute",function(){return Vn}),n.d(e,"Float32BufferAttribute",function(){return Wn}),n.d(e,"Uint32BufferAttribute",function(){return Gn}),n.d(e,"Int32BufferAttribute",function(){return qn}),n.d(e,"Uint16BufferAttribute",function(){return Hn}),n.d(e,"Int16BufferAttribute",function(){return Fn}),n.d(e,"Uint8ClampedBufferAttribute",function(){return Un}),n.d(e,"Uint8BufferAttribute",function(){return jn}),n.d(e,"Int8BufferAttribute",function(){return Dn}),n.d(e,"BufferAttribute",function(){return Nn}),n.d(e,"ArcCurve",function(){return ts}),n.d(e,"CatmullRomCurve3",function(){return as}),n.d(e,"CubicBezierCurve",function(){return us}),n.d(e,"CubicBezierCurve3",function(){return hs}),n.d(e,"EllipseCurve",function(){return $a}),n.d(e,"LineCurve",function(){return ds}),n.d(e,"LineCurve3",function(){return fs}),n.d(e,"QuadraticBezierCurve",function(){return ps}),n.d(e,"QuadraticBezierCurve3",function(){return ms}),n.d(e,"SplineCurve",function(){return gs}),n.d(e,"REVISION",function(){return f}),n.d(e,"MOUSE",function(){return p}),n.d(e,"CullFaceNone",function(){return m}),n.d(e,"CullFaceBack",function(){return g}),n.d(e,"CullFaceFront",function(){return _}),n.d(e,"CullFaceFrontBack",function(){return v}),n.d(e,"FrontFaceDirectionCW",function(){return b}),n.d(e,"FrontFaceDirectionCCW",function(){return y}),n.d(e,"BasicShadowMap",function(){return x}),n.d(e,"PCFShadowMap",function(){return w}),n.d(e,"PCFSoftShadowMap",function(){return M}),n.d(e,"FrontSide",function(){return E}),n.d(e,"BackSide",function(){return S}),n.d(e,"DoubleSide",function(){return A}),n.d(e,"FlatShading",function(){return T}),n.d(e,"SmoothShading",function(){return k}),n.d(e,"NoColors",function(){return P}),n.d(e,"FaceColors",function(){return L}),n.d(e,"VertexColors",function(){return O}),n.d(e,"NoBlending",function(){return C}),n.d(e,"NormalBlending",function(){return R}),n.d(e,"AdditiveBlending",function(){return I}),n.d(e,"SubtractiveBlending",function(){return z}),n.d(e,"MultiplyBlending",function(){return B}),n.d(e,"CustomBlending",function(){return N}),n.d(e,"AddEquation",function(){return D}),n.d(e,"SubtractEquation",function(){return j}),n.d(e,"ReverseSubtractEquation",function(){return U}),n.d(e,"MinEquation",function(){return F}),n.d(e,"MaxEquation",function(){return H}),n.d(e,"ZeroFactor",function(){return q}),n.d(e,"OneFactor",function(){return G}),n.d(e,"SrcColorFactor",function(){return W}),n.d(e,"OneMinusSrcColorFactor",function(){return V}),n.d(e,"SrcAlphaFactor",function(){return X}),n.d(e,"OneMinusSrcAlphaFactor",function(){return Y}),n.d(e,"DstAlphaFactor",function(){return K}),n.d(e,"OneMinusDstAlphaFactor",function(){return Z}),n.d(e,"DstColorFactor",function(){return J}),n.d(e,"OneMinusDstColorFactor",function(){return Q}),n.d(e,"SrcAlphaSaturateFactor",function(){return $}),n.d(e,"NeverDepth",function(){return tt}),n.d(e,"AlwaysDepth",function(){return et}),n.d(e,"LessDepth",function(){return nt}),n.d(e,"LessEqualDepth",function(){return it}),n.d(e,"EqualDepth",function(){return rt}),n.d(e,"GreaterEqualDepth",function(){return ot}),n.d(e,"GreaterDepth",function(){return at}),n.d(e,"NotEqualDepth",function(){return st}),n.d(e,"MultiplyOperation",function(){return ct}),n.d(e,"MixOperation",function(){return lt}),n.d(e,"AddOperation",function(){return ut}),n.d(e,"NoToneMapping",function(){return ht}),n.d(e,"LinearToneMapping",function(){return dt}),n.d(e,"ReinhardToneMapping",function(){return ft}),n.d(e,"Uncharted2ToneMapping",function(){return pt}),n.d(e,"CineonToneMapping",function(){return mt}),n.d(e,"UVMapping",function(){return gt}),n.d(e,"CubeReflectionMapping",function(){return _t}),n.d(e,"CubeRefractionMapping",function(){return vt}),n.d(e,"EquirectangularReflectionMapping",function(){return bt}),n.d(e,"EquirectangularRefractionMapping",function(){return yt}),n.d(e,"SphericalReflectionMapping",function(){return xt}),n.d(e,"CubeUVReflectionMapping",function(){return wt}),n.d(e,"CubeUVRefractionMapping",function(){return Mt}),n.d(e,"RepeatWrapping",function(){return Et}),n.d(e,"ClampToEdgeWrapping",function(){return St}),n.d(e,"MirroredRepeatWrapping",function(){return At}),n.d(e,"NearestFilter",function(){return Tt}),n.d(e,"NearestMipMapNearestFilter",function(){return kt}),n.d(e,"NearestMipMapLinearFilter",function(){return Pt}),n.d(e,"LinearFilter",function(){return Lt}),n.d(e,"LinearMipMapNearestFilter",function(){return Ot}),n.d(e,"LinearMipMapLinearFilter",function(){return Ct}),n.d(e,"UnsignedByteType",function(){return Rt}),n.d(e,"ByteType",function(){return It}),n.d(e,"ShortType",function(){return zt}),n.d(e,"UnsignedShortType",function(){return Bt}),n.d(e,"IntType",function(){return Nt}),n.d(e,"UnsignedIntType",function(){return Dt}),n.d(e,"FloatType",function(){return jt}),n.d(e,"HalfFloatType",function(){return Ut}),n.d(e,"UnsignedShort4444Type",function(){return Ft}),n.d(e,"UnsignedShort5551Type",function(){return Ht}),n.d(e,"UnsignedShort565Type",function(){return qt}),n.d(e,"UnsignedInt248Type",function(){return Gt}),n.d(e,"AlphaFormat",function(){return Wt}),n.d(e,"RGBFormat",function(){return Vt}),n.d(e,"RGBAFormat",function(){return Xt}),n.d(e,"LuminanceFormat",function(){return Yt}),n.d(e,"LuminanceAlphaFormat",function(){return Kt}),n.d(e,"RGBEFormat",function(){return Zt}),n.d(e,"DepthFormat",function(){return Jt}),n.d(e,"DepthStencilFormat",function(){return Qt}),n.d(e,"RGB_S3TC_DXT1_Format",function(){return $t}),n.d(e,"RGBA_S3TC_DXT1_Format",function(){return te}),n.d(e,"RGBA_S3TC_DXT3_Format",function(){return ee}),n.d(e,"RGBA_S3TC_DXT5_Format",function(){return ne}),n.d(e,"RGB_PVRTC_4BPPV1_Format",function(){return ie}),n.d(e,"RGB_PVRTC_2BPPV1_Format",function(){return re}),n.d(e,"RGBA_PVRTC_4BPPV1_Format",function(){return oe}),n.d(e,"RGBA_PVRTC_2BPPV1_Format",function(){return ae}),n.d(e,"RGB_ETC1_Format",function(){return se}),n.d(e,"RGBA_ASTC_4x4_Format",function(){return ce}),n.d(e,"RGBA_ASTC_5x4_Format",function(){return le}),n.d(e,"RGBA_ASTC_5x5_Format",function(){return ue}),n.d(e,"RGBA_ASTC_6x5_Format",function(){return he}),n.d(e,"RGBA_ASTC_6x6_Format",function(){return de}),n.d(e,"RGBA_ASTC_8x5_Format",function(){return fe}),n.d(e,"RGBA_ASTC_8x6_Format",function(){return pe}),n.d(e,"RGBA_ASTC_8x8_Format",function(){return me}),n.d(e,"RGBA_ASTC_10x5_Format",function(){return ge}),n.d(e,"RGBA_ASTC_10x6_Format",function(){return _e}),n.d(e,"RGBA_ASTC_10x8_Format",function(){return ve}),n.d(e,"RGBA_ASTC_10x10_Format",function(){return be}),n.d(e,"RGBA_ASTC_12x10_Format",function(){return ye}),n.d(e,"RGBA_ASTC_12x12_Format",function(){return xe}),n.d(e,"LoopOnce",function(){return we}),n.d(e,"LoopRepeat",function(){return Me}),n.d(e,"LoopPingPong",function(){return Ee}),n.d(e,"InterpolateDiscrete",function(){return Se}),n.d(e,"InterpolateLinear",function(){return Ae}),n.d(e,"InterpolateSmooth",function(){return Te}),n.d(e,"ZeroCurvatureEnding",function(){return ke}),n.d(e,"ZeroSlopeEnding",function(){return Pe}),n.d(e,"WrapAroundEnding",function(){return Le}),n.d(e,"TrianglesDrawMode",function(){return Oe}),n.d(e,"TriangleStripDrawMode",function(){return Ce}),n.d(e,"TriangleFanDrawMode",function(){return Re}),n.d(e,"LinearEncoding",function(){return Ie}),n.d(e,"sRGBEncoding",function(){return ze}),n.d(e,"GammaEncoding",function(){return Be}),n.d(e,"RGBEEncoding",function(){return Ne}),n.d(e,"LogLuvEncoding",function(){return De}),n.d(e,"RGBM7Encoding",function(){return je}),n.d(e,"RGBM16Encoding",function(){return Ue}),n.d(e,"RGBDEncoding",function(){return Fe}),n.d(e,"BasicDepthPacking",function(){return He}),n.d(e,"RGBADepthPacking",function(){return qe}),n.d(e,"CubeGeometry",function(){return Jn}),n.d(e,"Face4",function(){return El}),n.d(e,"LineStrip",function(){return Sl}),n.d(e,"LinePieces",function(){return Al}),n.d(e,"MeshFaceMaterial",function(){return Tl}),n.d(e,"MultiMaterial",function(){return kl}),n.d(e,"PointCloud",function(){return Pl}),n.d(e,"Particle",function(){return Ll}),n.d(e,"ParticleSystem",function(){return Ol}),n.d(e,"PointCloudMaterial",function(){return Cl}),n.d(e,"ParticleBasicMaterial",function(){return Rl}),n.d(e,"ParticleSystemMaterial",function(){return Il}),n.d(e,"Vertex",function(){return zl}),n.d(e,"DynamicBufferAttribute",function(){return Bl}),n.d(e,"Int8Attribute",function(){return Nl}),n.d(e,"Uint8Attribute",function(){return Dl}),n.d(e,"Uint8ClampedAttribute",function(){return jl}),n.d(e,"Int16Attribute",function(){return Ul}),n.d(e,"Uint16Attribute",function(){return Fl}),n.d(e,"Int32Attribute",function(){return Hl}),n.d(e,"Uint32Attribute",function(){return ql}),n.d(e,"Float32Attribute",function(){return Gl}),n.d(e,"Float64Attribute",function(){return Wl}),n.d(e,"ClosedSplineCurve3",function(){return Vl}),n.d(e,"SplineCurve3",function(){return Xl}),n.d(e,"Spline",function(){return Yl}),n.d(e,"AxisHelper",function(){return Kl}),n.d(e,"BoundingBoxHelper",function(){return Zl}),n.d(e,"EdgesHelper",function(){return Jl}),n.d(e,"WireframeHelper",function(){return Ql}),n.d(e,"XHRLoader",function(){return $l}),n.d(e,"BinaryTextureLoader",function(){return tu}),n.d(e,"GeometryUtils",function(){return eu}),n.d(e,"ImageUtils",function(){return nu}),n.d(e,"Projector",function(){return iu}),n.d(e,"CanvasRenderer",function(){return ru}),n.d(e,"SceneUtils",function(){return ou}),n.d(e,"LensFlare",function(){return au}),void 0===Number.EPSILON&&(Number.EPSILON=Math.pow(2,-52)),void 0===Number.isInteger&&(Number.isInteger=function(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t}),void 0===Math.sign&&(Math.sign=function(t){return t<0?-1:t>0?1:+t}),"name"in Function.prototype==!1&&Object.defineProperty(Function.prototype,"name",{get:function(){return this.toString().match(/^\s*function\s*([^\(\s]*)/)[1]}}),void 0===Object.assign&&(Object.assign=function(t){if(null==t)throw new TypeError("Cannot convert undefined or null to object");for(var e=Object(t),n=1;n>8&255]+t[e>>16&255]+t[e>>24&255]+"-"+t[255&n]+t[n>>8&255]+"-"+t[n>>16&15|64]+t[n>>24&255]+"-"+t[63&i|128]+t[i>>8&255]+"-"+t[i>>16&255]+t[i>>24&255]+t[255&r]+t[r>>8&255]+t[r>>16&255]+t[r>>24&255]}}(),clamp:function(t,e,n){return Math.max(e,Math.min(n,t))},euclideanModulo:function(t,e){return(t%e+e)%e},mapLinear:function(t,e,n,i,r){return i+(t-e)*(r-i)/(n-e)},lerp:function(t,e,n){return(1-n)*t+n*e},smoothstep:function(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e))*t*(3-2*t)},smootherstep:function(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e))*t*t*(t*(6*t-15)+10)},randInt:function(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat:function(t,e){return t+Math.random()*(e-t)},randFloatSpread:function(t){return t*(.5-Math.random())},degToRad:function(t){return t*Ge.DEG2RAD},radToDeg:function(t){return t*Ge.RAD2DEG},isPowerOfTwo:function(t){return 0==(t&t-1)&&0!==t},ceilPowerOfTwo:function(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))},floorPowerOfTwo:function(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}};function We(t,e){this.x=t||0,this.y=e||0}function Ve(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}function Xe(t,e,n,i){this._x=t||0,this._y=e||0,this._z=n||0,this._w=void 0!==i?i:1}function Ye(t,e,n){this.x=t||0,this.y=e||0,this.z=n||0}function Ke(){this.elements=[1,0,0,0,1,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}Object.defineProperties(We.prototype,{width:{get:function(){return this.x},set:function(t){this.x=t}},height:{get:function(){return this.y},set:function(t){this.y=t}}}),Object.assign(We.prototype,{isVector2:!0,set:function(t,e){return this.x=t,this.y=e,this},setScalar:function(t){return this.x=t,this.y=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(t){return this.x=t.x,this.y=t.y,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this)},addScalar:function(t){return this.x+=t,this.y+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this)},subScalar:function(t){return this.x-=t,this.y-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this},multiply:function(t){return this.x*=t.x,this.y*=t.y,this},multiplyScalar:function(t){return this.x*=t,this.y*=t,this},divide:function(t){return this.x/=t.x,this.y/=t.y,this},divideScalar:function(t){return this.multiplyScalar(1/t)},applyMatrix3:function(t){var e=this.x,n=this.y,i=t.elements;return this.x=i[0]*e+i[3]*n+i[6],this.y=i[1]*e+i[4]*n+i[7],this},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this},clampScalar:(r=new We,o=new We,function(t,e){return r.set(t,t),o.set(e,e),this.clamp(r,o)}),clampLength:function(t,e){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this},negate:function(){return this.x=-this.x,this.y=-this.y,this},dot:function(t){return this.x*t.x+this.y*t.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length()||1)},angle:function(){var t=Math.atan2(this.y,this.x);return t<0&&(t+=2*Math.PI),t},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x,n=this.y-t.y;return e*e+n*n},manhattanDistanceTo:function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)},setLength:function(t){return this.normalize().multiplyScalar(t)},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this},lerpVectors:function(t,e,n){return this.subVectors(e,t).multiplyScalar(n).add(t)},equals:function(t){return t.x===this.x&&t.y===this.y},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t},fromBufferAttribute:function(t,e,n){return void 0!==n&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this},rotateAround:function(t,e){var n=Math.cos(e),i=Math.sin(e),r=this.x-t.x,o=this.y-t.y;return this.x=r*n-o*i+t.x,this.y=r*i+o*n+t.y,this}}),Object.assign(Ve.prototype,{isMatrix4:!0,set:function(t,e,n,i,r,o,a,s,c,l,u,h,d,f,p,m){var g=this.elements;return g[0]=t,g[4]=e,g[8]=n,g[12]=i,g[1]=r,g[5]=o,g[9]=a,g[13]=s,g[2]=c,g[6]=l,g[10]=u,g[14]=h,g[3]=d,g[7]=f,g[11]=p,g[15]=m,this},identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},clone:function(){return(new Ve).fromArray(this.elements)},copy:function(t){var e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],e[9]=n[9],e[10]=n[10],e[11]=n[11],e[12]=n[12],e[13]=n[13],e[14]=n[14],e[15]=n[15],this},copyPosition:function(t){var e=this.elements,n=t.elements;return e[12]=n[12],e[13]=n[13],e[14]=n[14],this},extractBasis:function(t,e,n){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this},makeBasis:function(t,e,n){return this.set(t.x,e.x,n.x,0,t.y,e.y,n.y,0,t.z,e.z,n.z,0,0,0,0,1),this},extractRotation:(h=new Ye,function(t){var e=this.elements,n=t.elements,i=1/h.setFromMatrixColumn(t,0).length(),r=1/h.setFromMatrixColumn(t,1).length(),o=1/h.setFromMatrixColumn(t,2).length();return e[0]=n[0]*i,e[1]=n[1]*i,e[2]=n[2]*i,e[4]=n[4]*r,e[5]=n[5]*r,e[6]=n[6]*r,e[8]=n[8]*o,e[9]=n[9]*o,e[10]=n[10]*o,this}),makeRotationFromEuler:function(t){t&&t.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var e=this.elements,n=t.x,i=t.y,r=t.z,o=Math.cos(n),a=Math.sin(n),s=Math.cos(i),c=Math.sin(i),l=Math.cos(r),u=Math.sin(r);if("XYZ"===t.order){var h=o*l,d=o*u,f=a*l,p=a*u;e[0]=s*l,e[4]=-s*u,e[8]=c,e[1]=d+f*c,e[5]=h-p*c,e[9]=-a*s,e[2]=p-h*c,e[6]=f+d*c,e[10]=o*s}else if("YXZ"===t.order){var m=s*l,g=s*u,_=c*l,v=c*u;e[0]=m+v*a,e[4]=_*a-g,e[8]=o*c,e[1]=o*u,e[5]=o*l,e[9]=-a,e[2]=g*a-_,e[6]=v+m*a,e[10]=o*s}else if("ZXY"===t.order){m=s*l,g=s*u,_=c*l,v=c*u;e[0]=m-v*a,e[4]=-o*u,e[8]=_+g*a,e[1]=g+_*a,e[5]=o*l,e[9]=v-m*a,e[2]=-o*c,e[6]=a,e[10]=o*s}else if("ZYX"===t.order){h=o*l,d=o*u,f=a*l,p=a*u;e[0]=s*l,e[4]=f*c-d,e[8]=h*c+p,e[1]=s*u,e[5]=p*c+h,e[9]=d*c-f,e[2]=-c,e[6]=a*s,e[10]=o*s}else if("YZX"===t.order){var b=o*s,y=o*c,x=a*s,w=a*c;e[0]=s*l,e[4]=w-b*u,e[8]=x*u+y,e[1]=u,e[5]=o*l,e[9]=-a*l,e[2]=-c*l,e[6]=y*u+x,e[10]=b-w*u}else if("XZY"===t.order){b=o*s,y=o*c,x=a*s,w=a*c;e[0]=s*l,e[4]=-u,e[8]=c*l,e[1]=b*u+w,e[5]=o*l,e[9]=y*u-x,e[2]=x*u-y,e[6]=a*l,e[10]=w*u+b}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},makeRotationFromQuaternion:function(t){var e=this.elements,n=t._x,i=t._y,r=t._z,o=t._w,a=n+n,s=i+i,c=r+r,l=n*a,u=n*s,h=n*c,d=i*s,f=i*c,p=r*c,m=o*a,g=o*s,_=o*c;return e[0]=1-(d+p),e[4]=u-_,e[8]=h+g,e[1]=u+_,e[5]=1-(l+p),e[9]=f-m,e[2]=h-g,e[6]=f+m,e[10]=1-(l+d),e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},lookAt:(c=new Ye,l=new Ye,u=new Ye,function(t,e,n){var i=this.elements;return u.subVectors(t,e),0===u.lengthSq()&&(u.z=1),u.normalize(),c.crossVectors(n,u),0===c.lengthSq()&&(1===Math.abs(n.z)?u.x+=1e-4:u.z+=1e-4,u.normalize(),c.crossVectors(n,u)),c.normalize(),l.crossVectors(u,c),i[0]=c.x,i[4]=l.x,i[8]=u.x,i[1]=c.y,i[5]=l.y,i[9]=u.y,i[2]=c.z,i[6]=l.z,i[10]=u.z,this}),multiply:function(t,e){return void 0!==e?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(t,e)):this.multiplyMatrices(this,t)},premultiply:function(t){return this.multiplyMatrices(t,this)},multiplyMatrices:function(t,e){var n=t.elements,i=e.elements,r=this.elements,o=n[0],a=n[4],s=n[8],c=n[12],l=n[1],u=n[5],h=n[9],d=n[13],f=n[2],p=n[6],m=n[10],g=n[14],_=n[3],v=n[7],b=n[11],y=n[15],x=i[0],w=i[4],M=i[8],E=i[12],S=i[1],A=i[5],T=i[9],k=i[13],P=i[2],L=i[6],O=i[10],C=i[14],R=i[3],I=i[7],z=i[11],B=i[15];return r[0]=o*x+a*S+s*P+c*R,r[4]=o*w+a*A+s*L+c*I,r[8]=o*M+a*T+s*O+c*z,r[12]=o*E+a*k+s*C+c*B,r[1]=l*x+u*S+h*P+d*R,r[5]=l*w+u*A+h*L+d*I,r[9]=l*M+u*T+h*O+d*z,r[13]=l*E+u*k+h*C+d*B,r[2]=f*x+p*S+m*P+g*R,r[6]=f*w+p*A+m*L+g*I,r[10]=f*M+p*T+m*O+g*z,r[14]=f*E+p*k+m*C+g*B,r[3]=_*x+v*S+b*P+y*R,r[7]=_*w+v*A+b*L+y*I,r[11]=_*M+v*T+b*O+y*z,r[15]=_*E+v*k+b*C+y*B,this},multiplyScalar:function(t){var e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this},applyToBufferAttribute:function(){var t=new Ye;return function(e){for(var n=0,i=e.count;n=0?1:-1,v=1-g*g;if(v>Number.EPSILON){var b=Math.sqrt(v),y=Math.atan2(b,g*_);m=Math.sin(m*y)/b,a=Math.sin(a*y)/b}var x=a*_;if(s=s*m+h*x,c=c*m+d*x,l=l*m+f*x,u=u*m+p*x,m===1-a){var w=1/Math.sqrt(s*s+c*c+l*l+u*u);s*=w,c*=w,l*=w,u*=w}}t[e]=s,t[e+1]=c,t[e+2]=l,t[e+3]=u}}),Object.defineProperties(Xe.prototype,{x:{get:function(){return this._x},set:function(t){this._x=t,this.onChangeCallback()}},y:{get:function(){return this._y},set:function(t){this._y=t,this.onChangeCallback()}},z:{get:function(){return this._z},set:function(t){this._z=t,this.onChangeCallback()}},w:{get:function(){return this._w},set:function(t){this._w=t,this.onChangeCallback()}}}),Object.assign(Xe.prototype,{set:function(t,e,n,i){return this._x=t,this._y=e,this._z=n,this._w=i,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this.onChangeCallback(),this},setFromEuler:function(t,e){if(!t||!t.isEuler)throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var n=t._x,i=t._y,r=t._z,o=t.order,a=Math.cos,s=Math.sin,c=a(n/2),l=a(i/2),u=a(r/2),h=s(n/2),d=s(i/2),f=s(r/2);return"XYZ"===o?(this._x=h*l*u+c*d*f,this._y=c*d*u-h*l*f,this._z=c*l*f+h*d*u,this._w=c*l*u-h*d*f):"YXZ"===o?(this._x=h*l*u+c*d*f,this._y=c*d*u-h*l*f,this._z=c*l*f-h*d*u,this._w=c*l*u+h*d*f):"ZXY"===o?(this._x=h*l*u-c*d*f,this._y=c*d*u+h*l*f,this._z=c*l*f+h*d*u,this._w=c*l*u-h*d*f):"ZYX"===o?(this._x=h*l*u-c*d*f,this._y=c*d*u+h*l*f,this._z=c*l*f-h*d*u,this._w=c*l*u+h*d*f):"YZX"===o?(this._x=h*l*u+c*d*f,this._y=c*d*u+h*l*f,this._z=c*l*f-h*d*u,this._w=c*l*u-h*d*f):"XZY"===o&&(this._x=h*l*u-c*d*f,this._y=c*d*u-h*l*f,this._z=c*l*f+h*d*u,this._w=c*l*u+h*d*f),!1!==e&&this.onChangeCallback(),this},setFromAxisAngle:function(t,e){var n=e/2,i=Math.sin(n);return this._x=t.x*i,this._y=t.y*i,this._z=t.z*i,this._w=Math.cos(n),this.onChangeCallback(),this},setFromRotationMatrix:function(t){var e,n=t.elements,i=n[0],r=n[4],o=n[8],a=n[1],s=n[5],c=n[9],l=n[2],u=n[6],h=n[10],d=i+s+h;return d>0?(e=.5/Math.sqrt(d+1),this._w=.25/e,this._x=(u-c)*e,this._y=(o-l)*e,this._z=(a-r)*e):i>s&&i>h?(e=2*Math.sqrt(1+i-s-h),this._w=(u-c)/e,this._x=.25*e,this._y=(r+a)/e,this._z=(o+l)/e):s>h?(e=2*Math.sqrt(1+s-i-h),this._w=(o-l)/e,this._x=(r+a)/e,this._y=.25*e,this._z=(c+u)/e):(e=2*Math.sqrt(1+h-i-s),this._w=(a-r)/e,this._x=(o+l)/e,this._y=(c+u)/e,this._z=.25*e),this.onChangeCallback(),this},setFromUnitVectors:function(){var t,e=new Ye;return function(n,i){return void 0===e&&(e=new Ye),(t=n.dot(i)+1)<1e-6?(t=0,Math.abs(n.x)>Math.abs(n.z)?e.set(-n.y,n.x,0):e.set(0,-n.z,n.y)):e.crossVectors(n,i),this._x=e.x,this._y=e.y,this._z=e.z,this._w=t,this.normalize()}}(),inverse:function(){return this.conjugate()},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this.onChangeCallback(),this},dot:function(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this.onChangeCallback(),this},multiply:function(t,e){return void 0!==e?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(t,e)):this.multiplyQuaternions(this,t)},premultiply:function(t){return this.multiplyQuaternions(t,this)},multiplyQuaternions:function(t,e){var n=t._x,i=t._y,r=t._z,o=t._w,a=e._x,s=e._y,c=e._z,l=e._w;return this._x=n*l+o*a+i*c-r*s,this._y=i*l+o*s+r*a-n*c,this._z=r*l+o*c+n*s-i*a,this._w=o*l-n*a-i*s-r*c,this.onChangeCallback(),this},slerp:function(t,e){if(0===e)return this;if(1===e)return this.copy(t);var n=this._x,i=this._y,r=this._z,o=this._w,a=o*t._w+n*t._x+i*t._y+r*t._z;if(a<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,a=-a):this.copy(t),a>=1)return this._w=o,this._x=n,this._y=i,this._z=r,this;var s=Math.sqrt(1-a*a);if(Math.abs(s)<.001)return this._w=.5*(o+this._w),this._x=.5*(n+this._x),this._y=.5*(i+this._y),this._z=.5*(r+this._z),this;var c=Math.atan2(s,a),l=Math.sin((1-e)*c)/s,u=Math.sin(e*c)/s;return this._w=o*l+this._w*u,this._x=n*l+this._x*u,this._y=i*l+this._y*u,this._z=r*l+this._z*u,this.onChangeCallback(),this},equals:function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w},fromArray:function(t,e){return void 0===e&&(e=0),this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this.onChangeCallback(),this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t},onChange:function(t){return this.onChangeCallback=t,this},onChangeCallback:function(){}}),Object.assign(Ye.prototype,{isVector3:!0,set:function(t,e,n){return this.x=t,this.y=e,this.z=n,this},setScalar:function(t){return this.x=t,this.y=t,this.z=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this)},addScalar:function(t){return this.x+=t,this.y+=t,this.z+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this)},subScalar:function(t){return this.x-=t,this.y-=t,this.z-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},multiply:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(t,e)):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this)},multiplyScalar:function(t){return this.x*=t,this.y*=t,this.z*=t,this},multiplyVectors:function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this},applyEuler:(d=new Xe,function(t){return t&&t.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(d.setFromEuler(t))}),applyAxisAngle:function(){var t=new Xe;return function(e,n){return this.applyQuaternion(t.setFromAxisAngle(e,n))}}(),applyMatrix3:function(t){var e=this.x,n=this.y,i=this.z,r=t.elements;return this.x=r[0]*e+r[3]*n+r[6]*i,this.y=r[1]*e+r[4]*n+r[7]*i,this.z=r[2]*e+r[5]*n+r[8]*i,this},applyMatrix4:function(t){var e=this.x,n=this.y,i=this.z,r=t.elements,o=1/(r[3]*e+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*e+r[4]*n+r[8]*i+r[12])*o,this.y=(r[1]*e+r[5]*n+r[9]*i+r[13])*o,this.z=(r[2]*e+r[6]*n+r[10]*i+r[14])*o,this},applyQuaternion:function(t){var e=this.x,n=this.y,i=this.z,r=t.x,o=t.y,a=t.z,s=t.w,c=s*e+o*i-a*n,l=s*n+a*e-r*i,u=s*i+r*n-o*e,h=-r*e-o*n-a*i;return this.x=c*s+h*-r+l*-a-u*-o,this.y=l*s+h*-o+u*-r-c*-a,this.z=u*s+h*-a+c*-o-l*-r,this},project:function(){var t=new Ve;return function(e){return t.multiplyMatrices(e.projectionMatrix,t.getInverse(e.matrixWorld)),this.applyMatrix4(t)}}(),unproject:function(){var t=new Ve;return function(e){return t.multiplyMatrices(e.matrixWorld,t.getInverse(e.projectionMatrix)),this.applyMatrix4(t)}}(),transformDirection:function(t){var e=this.x,n=this.y,i=this.z,r=t.elements;return this.x=r[0]*e+r[4]*n+r[8]*i,this.y=r[1]*e+r[5]*n+r[9]*i,this.z=r[2]*e+r[6]*n+r[10]*i,this.normalize()},divide:function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this},divideScalar:function(t){return this.multiplyScalar(1/t)},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this},clampScalar:function(){var t=new Ye,e=new Ye;return function(n,i){return t.set(n,n,n),e.set(i,i,i),this.clamp(t,e)}}(),clampLength:function(t,e){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(t){return this.normalize().multiplyScalar(t)},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this},lerpVectors:function(t,e,n){return this.subVectors(e,t).multiplyScalar(n).add(t)},cross:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(t,e)):this.crossVectors(this,t)},crossVectors:function(t,e){var n=t.x,i=t.y,r=t.z,o=e.x,a=e.y,s=e.z;return this.x=i*s-r*a,this.y=r*o-n*s,this.z=n*a-i*o,this},projectOnVector:function(t){var e=t.dot(this)/t.lengthSq();return this.copy(t).multiplyScalar(e)},projectOnPlane:function(){var t=new Ye;return function(e){return t.copy(this).projectOnVector(e),this.sub(t)}}(),reflect:function(){var t=new Ye;return function(e){return this.sub(t.copy(e).multiplyScalar(2*this.dot(e)))}}(),angleTo:function(t){var e=this.dot(t)/Math.sqrt(this.lengthSq()*t.lengthSq());return Math.acos(Ge.clamp(e,-1,1))},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x,n=this.y-t.y,i=this.z-t.z;return e*e+n*n+i*i},manhattanDistanceTo:function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)},setFromSpherical:function(t){var e=Math.sin(t.phi)*t.radius;return this.x=e*Math.sin(t.theta),this.y=Math.cos(t.phi)*t.radius,this.z=e*Math.cos(t.theta),this},setFromCylindrical:function(t){return this.x=t.radius*Math.sin(t.theta),this.y=t.y,this.z=t.radius*Math.cos(t.theta),this},setFromMatrixPosition:function(t){var e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this},setFromMatrixScale:function(t){var e=this.setFromMatrixColumn(t,0).length(),n=this.setFromMatrixColumn(t,1).length(),i=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=n,this.z=i,this},setFromMatrixColumn:function(t,e){return this.fromArray(t.elements,4*e)},equals:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t},fromBufferAttribute:function(t,e,n){return void 0!==n&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}}),Object.assign(Ke.prototype,{isMatrix3:!0,set:function(t,e,n,i,r,o,a,s,c){var l=this.elements;return l[0]=t,l[1]=i,l[2]=a,l[3]=e,l[4]=r,l[5]=s,l[6]=n,l[7]=o,l[8]=c,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(t){var e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],this},setFromMatrix4:function(t){var e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this},applyToBufferAttribute:function(){var t=new Ye;return function(e){for(var n=0,i=e.count;n2048||e.height>2048?e.toDataURL("image/jpeg",.6):e.toDataURL("image/png")}(i)}),n.image=i.uuid}return e||(t.textures[this.uuid]=n),n},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(t){if(this.mapping===gt){if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case Et:t.x=t.x-Math.floor(t.x);break;case St:t.x=t.x<0?0:1;break;case At:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||t.y>1)switch(this.wrapT){case Et:t.y=t.y-Math.floor(t.y);break;case St:t.y=t.y<0?0:1;break;case At:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}this.flipY&&(t.y=1-t.y)}}}),Object.defineProperty(rn.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign(on.prototype,{isVector4:!0,set:function(t,e,n,i){return this.x=t,this.y=e,this.z=n,this.w=i,this},setScalar:function(t){return this.x=t,this.y=t,this.z=t,this.w=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setW:function(t){return this.w=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this)},addScalar:function(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this)},subScalar:function(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this},multiplyScalar:function(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this},applyMatrix4:function(t){var e=this.x,n=this.y,i=this.z,r=this.w,o=t.elements;return this.x=o[0]*e+o[4]*n+o[8]*i+o[12]*r,this.y=o[1]*e+o[5]*n+o[9]*i+o[13]*r,this.z=o[2]*e+o[6]*n+o[10]*i+o[14]*r,this.w=o[3]*e+o[7]*n+o[11]*i+o[15]*r,this},divideScalar:function(t){return this.multiplyScalar(1/t)},setAxisAngleFromQuaternion:function(t){this.w=2*Math.acos(t.w);var e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this},setAxisAngleFromRotationMatrix:function(t){var e,n,i,r,o=t.elements,a=o[0],s=o[4],c=o[8],l=o[1],u=o[5],h=o[9],d=o[2],f=o[6],p=o[10];if(Math.abs(s-l)<.01&&Math.abs(c-d)<.01&&Math.abs(h-f)<.01){if(Math.abs(s+l)<.1&&Math.abs(c+d)<.1&&Math.abs(h+f)<.1&&Math.abs(a+u+p-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;var m=(a+1)/2,g=(u+1)/2,_=(p+1)/2,v=(s+l)/4,b=(c+d)/4,y=(h+f)/4;return m>g&&m>_?m<.01?(n=0,i=.707106781,r=.707106781):(i=v/(n=Math.sqrt(m)),r=b/n):g>_?g<.01?(n=.707106781,i=0,r=.707106781):(n=v/(i=Math.sqrt(g)),r=y/i):_<.01?(n=.707106781,i=.707106781,r=0):(n=b/(r=Math.sqrt(_)),i=y/r),this.set(n,i,r,e),this}var x=Math.sqrt((f-h)*(f-h)+(c-d)*(c-d)+(l-s)*(l-s));return Math.abs(x)<.001&&(x=1),this.x=(f-h)/x,this.y=(c-d)/x,this.z=(l-s)/x,this.w=Math.acos((a+u+p-1)/2),this},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this.w=Math.max(t.w,Math.min(e.w,this.w)),this},clampScalar:function(){var t,e;return function(n,i){return void 0===t&&(t=new on,e=new on),t.set(n,n,n,n),e.set(i,i,i,i),this.clamp(t,e)}}(),clampLength:function(t,e){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(t){return this.normalize().multiplyScalar(t)},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this},lerpVectors:function(t,e,n){return this.subVectors(e,t).multiplyScalar(n).add(t)},equals:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t},fromBufferAttribute:function(t,e,n){return void 0!==n&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this}}),an.prototype=Object.assign(Object.create(i.prototype),{constructor:an,isWebGLRenderTarget:!0,setSize:function(t,e){this.width===t&&this.height===e||(this.width=t,this.height=e,this.dispose()),this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.width=t.width,this.height=t.height,this.viewport.copy(t.viewport),this.texture=t.texture.clone(),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.depthTexture=t.depthTexture,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),sn.prototype=Object.create(an.prototype),sn.prototype.constructor=sn,sn.prototype.isWebGLRenderTargetCube=!0,cn.prototype=Object.create(rn.prototype),cn.prototype.constructor=cn,cn.prototype.isDataTexture=!0,Object.assign(ln.prototype,{isBox3:!0,set:function(t,e){return this.min.copy(t),this.max.copy(e),this},setFromArray:function(t){for(var e=1/0,n=1/0,i=1/0,r=-1/0,o=-1/0,a=-1/0,s=0,c=t.length;sr&&(r=l),u>o&&(o=u),h>a&&(a=h)}return this.min.set(e,n,i),this.max.set(r,o,a),this},setFromBufferAttribute:function(t){for(var e=1/0,n=1/0,i=1/0,r=-1/0,o=-1/0,a=-1/0,s=0,c=t.count;sr&&(r=l),u>o&&(o=u),h>a&&(a=h)}return this.min.set(e,n,i),this.max.set(r,o,a),this},setFromPoints:function(t){this.makeEmpty();for(var e=0,n=t.length;ethis.max.x||t.ythis.max.y||t.zthis.max.z)},containsBox:function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z},getParameter:function(t,e){return void 0===e&&(console.warn("THREE.Box3: .getParameter() target is now required"),e=new Ye),e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(t){return!(t.max.xthis.max.x||t.max.ythis.max.y||t.max.zthis.max.z)},intersectsSphere:(Je=new Ye,function(t){return this.clampPoint(t.center,Je),Je.distanceToSquared(t.center)<=t.radius*t.radius}),intersectsPlane:function(t){var e,n;return t.normal.x>0?(e=t.normal.x*this.min.x,n=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,n=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,n+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,n+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,n+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,n+=t.normal.z*this.min.z),e<=t.constant&&n>=t.constant},intersectsTriangle:function(){var t=new Ye,e=new Ye,n=new Ye,i=new Ye,r=new Ye,o=new Ye,a=new Ye,s=new Ye,c=new Ye,l=new Ye;function u(i){var r,o;for(r=0,o=i.length-3;r<=o;r+=3){a.fromArray(i,r);var s=c.x*Math.abs(a.x)+c.y*Math.abs(a.y)+c.z*Math.abs(a.z),l=t.dot(a),u=e.dot(a),h=n.dot(a);if(Math.max(-Math.max(l,u,h),Math.min(l,u,h))>s)return!1}return!0}return function(a){if(this.isEmpty())return!1;this.getCenter(s),c.subVectors(this.max,s),t.subVectors(a.a,s),e.subVectors(a.b,s),n.subVectors(a.c,s),i.subVectors(e,t),r.subVectors(n,e),o.subVectors(t,n);var h=[0,-i.z,i.y,0,-r.z,r.y,0,-o.z,o.y,i.z,0,-i.x,r.z,0,-r.x,o.z,0,-o.x,-i.y,i.x,0,-r.y,r.x,0,-o.y,o.x,0];return!!u(h)&&(!!u(h=[1,0,0,0,1,0,0,0,1])&&(l.crossVectors(i,r),u(h=[l.x,l.y,l.z])))}}(),clampPoint:function(t,e){return void 0===e&&(console.warn("THREE.Box3: .clampPoint() target is now required"),e=new Ye),e.copy(t).clamp(this.min,this.max)},distanceToPoint:function(){var t=new Ye;return function(e){return t.copy(e).clamp(this.min,this.max).sub(e).length()}}(),getBoundingSphere:function(){var t=new Ye;return function(e){return void 0===e&&(console.warn("THREE.Box3: .getBoundingSphere() target is now required"),e=new un),this.getCenter(e.center),e.radius=.5*this.getSize(t).length(),e}}(),intersect:function(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this},union:function(t){return this.min.min(t.min),this.max.max(t.max),this},applyMatrix4:(Ze=[new Ye,new Ye,new Ye,new Ye,new Ye,new Ye,new Ye,new Ye],function(t){return this.isEmpty()?this:(Ze[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),Ze[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),Ze[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),Ze[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),Ze[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),Ze[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),Ze[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),Ze[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(Ze),this)}),translate:function(t){return this.min.add(t),this.max.add(t),this},equals:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}),Object.assign(un.prototype,{set:function(t,e){return this.center.copy(t),this.radius=e,this},setFromPoints:(Qe=new ln,function(t,e){var n=this.center;void 0!==e?n.copy(e):Qe.setFromPoints(t).getCenter(n);for(var i=0,r=0,o=t.length;rthis.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e},getBoundingBox:function(t){return void 0===t&&(console.warn("THREE.Sphere: .getBoundingBox() target is now required"),t=new ln),t.set(this.center,this.center),t.expandByScalar(this.radius),t},applyMatrix4:function(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this},translate:function(t){return this.center.add(t),this},equals:function(t){return t.center.equals(this.center)&&t.radius===this.radius}}),Object.assign(hn.prototype,{set:function(t,e){return this.normal.copy(t),this.constant=e,this},setComponents:function(t,e,n,i){return this.normal.set(t,e,n),this.constant=i,this},setFromNormalAndCoplanarPoint:function(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this},setFromCoplanarPoints:function(){var t=new Ye,e=new Ye;return function(n,i,r){var o=t.subVectors(r,i).cross(e.subVectors(n,i)).normalize();return this.setFromNormalAndCoplanarPoint(o,n),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.normal.copy(t.normal),this.constant=t.constant,this},normalize:function(){var t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this},negate:function(){return this.constant*=-1,this.normal.negate(),this},distanceToPoint:function(t){return this.normal.dot(t)+this.constant},distanceToSphere:function(t){return this.distanceToPoint(t.center)-t.radius},projectPoint:function(t,e){return void 0===e&&(console.warn("THREE.Plane: .projectPoint() target is now required"),e=new Ye),e.copy(this.normal).multiplyScalar(-this.distanceToPoint(t)).add(t)},intersectLine:function(){var t=new Ye;return function(e,n){void 0===n&&(console.warn("THREE.Plane: .intersectLine() target is now required"),n=new Ye);var i=e.delta(t),r=this.normal.dot(i);if(0===r)return 0===this.distanceToPoint(e.start)?n.copy(e.start):void 0;var o=-(e.start.dot(this.normal)+this.constant)/r;return o<0||o>1?void 0:n.copy(i).multiplyScalar(o).add(e.start)}}(),intersectsLine:function(t){var e=this.distanceToPoint(t.start),n=this.distanceToPoint(t.end);return e<0&&n>0||n<0&&e>0},intersectsBox:function(t){return t.intersectsPlane(this)},intersectsSphere:function(t){return t.intersectsPlane(this)},coplanarPoint:function(t){return void 0===t&&(console.warn("THREE.Plane: .coplanarPoint() target is now required"),t=new Ye),t.copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(){var t=new Ye,e=new Ke;return function(n,i){var r=i||e.getNormalMatrix(n),o=this.coplanarPoint(t).applyMatrix4(n),a=this.normal.applyMatrix3(r).normalize();return this.constant=-o.dot(a),this}}(),translate:function(t){return this.constant-=t.dot(this.normal),this},equals:function(t){return t.normal.equals(this.normal)&&t.constant===this.constant}}),Object.assign(dn.prototype,{set:function(t,e,n,i,r,o){var a=this.planes;return a[0].copy(t),a[1].copy(e),a[2].copy(n),a[3].copy(i),a[4].copy(r),a[5].copy(o),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){for(var e=this.planes,n=0;n<6;n++)e[n].copy(t.planes[n]);return this},setFromMatrix:function(t){var e=this.planes,n=t.elements,i=n[0],r=n[1],o=n[2],a=n[3],s=n[4],c=n[5],l=n[6],u=n[7],h=n[8],d=n[9],f=n[10],p=n[11],m=n[12],g=n[13],_=n[14],v=n[15];return e[0].setComponents(a-i,u-s,p-h,v-m).normalize(),e[1].setComponents(a+i,u+s,p+h,v+m).normalize(),e[2].setComponents(a+r,u+c,p+d,v+g).normalize(),e[3].setComponents(a-r,u-c,p-d,v-g).normalize(),e[4].setComponents(a-o,u-l,p-f,v-_).normalize(),e[5].setComponents(a+o,u+l,p+f,v+_).normalize(),this},intersectsObject:(en=new un,function(t){var e=t.geometry;return null===e.boundingSphere&&e.computeBoundingSphere(),en.copy(e.boundingSphere).applyMatrix4(t.matrixWorld),this.intersectsSphere(en)}),intersectsSprite:function(){var t=new un;return function(e){return t.center.set(0,0,0),t.radius=.7071067811865476,t.applyMatrix4(e.matrixWorld),this.intersectsSphere(t)}}(),intersectsSphere:function(t){for(var e=this.planes,n=t.center,i=-t.radius,r=0;r<6;r++){if(e[r].distanceToPoint(n)0?t.min.x:t.max.x,tn.x=i.normal.x>0?t.max.x:t.min.x,$e.y=i.normal.y>0?t.min.y:t.max.y,tn.y=i.normal.y>0?t.max.y:t.min.y,$e.z=i.normal.z>0?t.min.z:t.max.z,tn.z=i.normal.z>0?t.max.z:t.min.z;var r=i.distanceToPoint($e),o=i.distanceToPoint(tn);if(r<0&&o<0)return!1}return!0}),containsPoint:function(t){for(var e=this.planes,n=0;n<6;n++)if(e[n].distanceToPoint(t)<0)return!1;return!0}});var fn,pn={alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif\n",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif\n",alphatest_fragment:"#ifdef ALPHATEST\n\tif ( diffuseColor.a < ALPHATEST ) discard;\n#endif\n",aomap_fragment:"#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_ENVMAP ) && defined( PHYSICAL )\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );\n\t#endif\n#endif\n",aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",begin_vertex:"\nvec3 transformed = vec3( position );\n",beginnormal_vertex:"\nvec3 objectNormal = vec3( normal );\n",bsdfs:"float punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\tif( decayExponent > 0.0 ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\tfloat maxDistanceCutoffFactor = pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\treturn distanceFalloff * maxDistanceCutoffFactor;\n#else\n\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n#endif\n\t}\n\treturn 1.0;\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNL = saturate( dot( geometry.normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\nvec3 BRDF_Specular_GGX_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 AB = vec2( -1.04, 1.04 ) * a004 + r.zw;\n\treturn specularColor * AB.x + AB.y;\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\t\tvec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n\t\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 );\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif\n",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vViewPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vViewPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\tif ( clipped ) discard;\n\t#endif\n#endif\n",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\t#if ! defined( PHYSICAL ) && ! defined( PHONG )\n\t\tvarying vec3 vViewPosition;\n\t#endif\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif\n",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n\tvarying vec3 vViewPosition;\n#endif\n",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n",color_fragment:"#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif\n",color_pars_vertex:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\n\tvColor.xyz = color.xyz;\n#endif",common:"#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI_HALF 1.5707963267949\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#define whiteCompliment(a) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract(sin(sn) * c);\n}\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\tfloat distance = dot( planeNormal, point - pointOnPlane );\n\treturn - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat linearToRelativeLuminance( const in vec3 color ) {\n\tvec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\n\treturn dot( weights, color.rgb );\n}\n",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n#define cubeUV_textureSize (1024.0)\nint getFaceFromDirection(vec3 direction) {\n\tvec3 absDirection = abs(direction);\n\tint face = -1;\n\tif( absDirection.x > absDirection.z ) {\n\t\tif(absDirection.x > absDirection.y )\n\t\t\tface = direction.x > 0.0 ? 0 : 3;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\telse {\n\t\tif(absDirection.z > absDirection.y )\n\t\t\tface = direction.z > 0.0 ? 2 : 5;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\treturn face;\n}\n#define cubeUV_maxLods1 (log2(cubeUV_textureSize*0.25) - 1.0)\n#define cubeUV_rangeClamp (exp2((6.0 - 1.0) * 2.0))\nvec2 MipLevelInfo( vec3 vec, float roughnessLevel, float roughness ) {\n\tfloat scale = exp2(cubeUV_maxLods1 - roughnessLevel);\n\tfloat dxRoughness = dFdx(roughness);\n\tfloat dyRoughness = dFdy(roughness);\n\tvec3 dx = dFdx( vec * scale * dxRoughness );\n\tvec3 dy = dFdy( vec * scale * dyRoughness );\n\tfloat d = max( dot( dx, dx ), dot( dy, dy ) );\n\td = clamp(d, 1.0, cubeUV_rangeClamp);\n\tfloat mipLevel = 0.5 * log2(d);\n\treturn vec2(floor(mipLevel), fract(mipLevel));\n}\n#define cubeUV_maxLods2 (log2(cubeUV_textureSize*0.25) - 2.0)\n#define cubeUV_rcpTextureSize (1.0 / cubeUV_textureSize)\nvec2 getCubeUV(vec3 direction, float roughnessLevel, float mipLevel) {\n\tmipLevel = roughnessLevel > cubeUV_maxLods2 - 3.0 ? 0.0 : mipLevel;\n\tfloat a = 16.0 * cubeUV_rcpTextureSize;\n\tvec2 exp2_packed = exp2( vec2( roughnessLevel, mipLevel ) );\n\tvec2 rcp_exp2_packed = vec2( 1.0 ) / exp2_packed;\n\tfloat powScale = exp2_packed.x * exp2_packed.y;\n\tfloat scale = rcp_exp2_packed.x * rcp_exp2_packed.y * 0.25;\n\tfloat mipOffset = 0.75*(1.0 - rcp_exp2_packed.y) * rcp_exp2_packed.x;\n\tbool bRes = mipLevel == 0.0;\n\tscale = bRes && (scale < a) ? a : scale;\n\tvec3 r;\n\tvec2 offset;\n\tint face = getFaceFromDirection(direction);\n\tfloat rcpPowScale = 1.0 / powScale;\n\tif( face == 0) {\n\t\tr = vec3(direction.x, -direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 1) {\n\t\tr = vec3(direction.y, direction.x, direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 2) {\n\t\tr = vec3(direction.z, direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 3) {\n\t\tr = vec3(direction.x, direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse if( face == 4) {\n\t\tr = vec3(direction.y, direction.x, -direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse {\n\t\tr = vec3(direction.z, -direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\tr = normalize(r);\n\tfloat texelOffset = 0.5 * cubeUV_rcpTextureSize;\n\tvec2 s = ( r.yz / abs( r.x ) + vec2( 1.0 ) ) * 0.5;\n\tvec2 base = offset + vec2( texelOffset );\n\treturn base + s * ( scale - 2.0 * texelOffset );\n}\n#define cubeUV_maxLods3 (log2(cubeUV_textureSize*0.25) - 3.0)\nvec4 textureCubeUV(vec3 reflectedDirection, float roughness ) {\n\tfloat roughnessVal = roughness* cubeUV_maxLods3;\n\tfloat r1 = floor(roughnessVal);\n\tfloat r2 = r1 + 1.0;\n\tfloat t = fract(roughnessVal);\n\tvec2 mipInfo = MipLevelInfo(reflectedDirection, r1, roughness);\n\tfloat s = mipInfo.y;\n\tfloat level0 = mipInfo.x;\n\tfloat level1 = level0 + 1.0;\n\tlevel1 = level1 > 5.0 ? 5.0 : level1;\n\tlevel0 += min( floor( s + 0.5 ), 5.0 );\n\tvec2 uv_10 = getCubeUV(reflectedDirection, r1, level0);\n\tvec4 color10 = envMapTexelToLinear(texture2D(envMap, uv_10));\n\tvec2 uv_20 = getCubeUV(reflectedDirection, r2, level0);\n\tvec4 color20 = envMapTexelToLinear(texture2D(envMap, uv_20));\n\tvec4 result = mix(color10, color20, t);\n\treturn vec4(result.rgb, 1.0);\n}\n#endif\n",defaultnormal_vertex:"vec3 transformedNormal = normalMatrix * objectNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif\n",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, uv ).x * displacementScale + displacementBias );\n#endif\n",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif\n",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif\n",encodings_fragment:" gl_FragColor = linearToOutputTexel( gl_FragColor );\n",encodings_pars_fragment:"\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.xyz, vec3( gammaFactor ) ), value.w );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.w );\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.w );\n}\nvec4 RGBEToLinear( in vec4 value ) {\n\treturn vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n\tfloat maxComponent = max( max( value.r, value.g ), value.b );\n\tfloat fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n\treturn vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.xyz * value.w * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.x, max( value.g, value.b ) );\n\tfloat M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n\tM = ceil( M * 255.0 ) / 255.0;\n\treturn vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.x, max( value.g, value.b ) );\n\tfloat D = max( maxRange / maxRGB, 1.0 );\n\tD = min( floor( D ) / 255.0, 1.0 );\n\treturn vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 LinearToLogLuv( in vec4 value ) {\n\tvec3 Xp_Y_XYZp = value.rgb * cLogLuvM;\n\tXp_Y_XYZp = max(Xp_Y_XYZp, vec3(1e-6, 1e-6, 1e-6));\n\tvec4 vResult;\n\tvResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n\tfloat Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n\tvResult.w = fract(Le);\n\tvResult.z = (Le - (floor(vResult.w*255.0))/255.0)/255.0;\n\treturn vResult;\n}\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 LogLuvToLinear( in vec4 value ) {\n\tfloat Le = value.z * 255.0 + value.w;\n\tvec3 Xp_Y_XYZp;\n\tXp_Y_XYZp.y = exp2((Le - 127.0) / 2.0);\n\tXp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n\tXp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n\tvec3 vRGB = Xp_Y_XYZp.rgb * cLogLuvInverseM;\n\treturn vec4( max(vRGB, 0.0), 1.0 );\n}\n",envmap_fragment:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\tvec2 sampleUV;\n\t\treflectVec = normalize( reflectVec );\n\t\tsampleUV.y = asin( clamp( reflectVec.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\t\tsampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\tvec4 envColor = texture2D( envMap, sampleUV );\n\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\treflectVec = normalize( reflectVec );\n\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0, 0.0, 1.0 ) );\n\t\tvec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\tenvColor = envMapTexelToLinear( envColor );\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif\n",envmap_pars_fragment:"#if defined( USE_ENVMAP ) || defined( PHYSICAL )\n\tuniform float reflectivity;\n\tuniform float envMapIntensity;\n#endif\n#ifdef USE_ENVMAP\n\t#if ! defined( PHYSICAL ) && ( defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) )\n\t\tvarying vec3 vWorldPosition;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\tuniform float flipEnvMap;\n\tuniform int maxMipLevel;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( PHYSICAL )\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif\n",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif\n",envmap_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif\n",fog_vertex:"\n#ifdef USE_FOG\nfogDepth = -mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n varying float fogDepth;\n#endif\n",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = whiteCompliment( exp2( - fogDensity * fogDensity * fogDepth * fogDepth * LOG2 ) );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, fogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif\n",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float fogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif\n",gradientmap_pars_fragment:"#ifdef TOON\n\tuniform sampler2D gradientMap;\n\tvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\t\tfloat dotNL = dot( normal, lightDirection );\n\t\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t\t#ifdef USE_GRADIENTMAP\n\t\t\treturn texture2D( gradientMap, coord ).rgb;\n\t\t#else\n\t\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t\t#endif\n\t}\n#endif\n",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\treflectedLight.indirectDiffuse += PI * texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n#endif\n",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_vertex:"vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\n#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_DIR_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvLightFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n#endif\n",lights_pars_begin:"uniform vec3 ambientLightColor;\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treturn irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\tdirectLight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t\tfloat shadowCameraNear;\n\t\tfloat shadowCameraFar;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tdirectLight.color = pointLight.color;\n\t\tdirectLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n\t\tdirectLight.visible = ( directLight.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tfloat angleCos = dot( directLight.direction, spotLight.direction );\n\t\tif ( angleCos > spotLight.coneCos ) {\n\t\t\tfloat spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\t\tdirectLight.color = spotLight.color;\n\t\t\tdirectLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tirradiance *= PI;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif\n",lights_pars_maps:"#if defined( USE_ENVMAP ) && defined( PHYSICAL )\n\tvec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\tvec4 envMapColor = textureCubeUV( queryVec, 1.0 );\n\t\t#else\n\t\t\tvec4 envMapColor = vec4( 0.0 );\n\t\t#endif\n\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t}\n\tfloat getSpecularMIPLevel( const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar + 0.79248 - 0.5 * log2( pow2( blinnShininessExponent ) + 1.0 );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in GeometricContext geometry, const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( -geometry.viewDir, geometry.normal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( -geometry.viewDir, geometry.normal, refractionRatio );\n\t\t#endif\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( blinnShininessExponent, maxMIPLevel );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\tvec4 envMapColor = textureCubeUV(queryReflectVec, BlinnExponentToGGXRoughness(blinnShininessExponent));\n\t\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\t\tvec2 sampleUV;\n\t\t\tsampleUV.y = asin( clamp( reflectVec.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\t\t\tsampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, sampleUV, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, sampleUV, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0,0.0,1.0 ) );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#endif\n\t\treturn envMapColor.rgb * envMapIntensity;\n\t}\n#endif\n",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;\n",lights_phong_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n\tvec3\tdiffuseColor;\n\tvec3\tspecularColor;\n\tfloat\tspecularShininess;\n\tfloat\tspecularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifdef TOON\n\t\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\t#else\n\t\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\t\tvec3 irradiance = dotNL * directLight.color;\n\t#endif\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)\n",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.specularRoughness = clamp( roughnessFactor, 0.04, 1.0 );\n#ifdef STANDARD\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.clearCoat = saturate( clearCoat );\tmaterial.clearCoatRoughness = clamp( clearCoatRoughness, 0.04, 1.0 );\n#endif\n",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3\tdiffuseColor;\n\tfloat\tspecularRoughness;\n\tvec3\tspecularColor;\n\t#ifndef STANDARD\n\t\tfloat clearCoat;\n\t\tfloat clearCoatRoughness;\n\t#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearCoatDHRApprox( const in float roughness, const in float dotNL ) {\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.specularRoughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos - halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos + halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos + halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos - halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifndef STANDARD\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.directSpecular += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry, material.specularColor, material.specularRoughness );\n\treflectedLight.directDiffuse += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\t#ifndef STANDARD\n\t\treflectedLight.directSpecular += irradiance * material.clearCoat * BRDF_Specular_GGX( directLight, geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 clearCoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifndef STANDARD\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\tfloat dotNL = dotNV;\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.indirectSpecular += ( 1.0 - clearCoatDHR ) * radiance * BRDF_Specular_GGX_Environment( geometry, material.specularColor, material.specularRoughness );\n\t#ifndef STANDARD\n\t\treflectedLight.indirectSpecular += clearCoatRadiance * material.clearCoat * BRDF_Specular_GGX_Environment( geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\n#define Material_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.specularRoughness )\n#define Material_ClearCoat_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.clearCoatRoughness )\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}\n",lights_fragment_begin:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = normalize( vViewPosition );\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( pointLight.shadow, directLight.visible ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( spotLight.shadow, directLight.visible ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( directionalLight.shadow, directLight.visible ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearCoatRadiance = vec3( 0.0 );\n#endif\n",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec3 lightMapIrradiance = texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *= PI;\n\t\t#endif\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( PHYSICAL ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tirradiance += getLightProbeIndirectIrradiance( geometry, maxMipLevel );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getLightProbeIndirectRadiance( geometry, Material_BlinnShininessExponent( material ), maxMipLevel );\n\t#ifndef STANDARD\n\t\tclearCoatRadiance += getLightProbeIndirectRadiance( geometry, Material_ClearCoat_BlinnShininessExponent( material ), maxMipLevel );\n\t#endif\n#endif\n",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, clearCoatRadiance, geometry, material, reflectedLight );\n#endif\n",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#ifdef USE_LOGDEPTHBUF\n\tuniform float logDepthBufFC;\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#endif\n#endif\n",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#endif\n\tuniform float logDepthBufFC;\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t#else\n\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\tgl_Position.z *= gl_Position.w;\n\t#endif\n#endif\n",map_fragment:"#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif\n",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n",map_particle_fragment:"#ifdef USE_MAP\n\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n\tvec4 mapTexel = texture2D( map, uv );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n",map_particle_pars_fragment:"#ifdef USE_MAP\n\tuniform mat3 uvTransform;\n\tuniform sampler2D map;\n#endif\n",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif\n",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];\n\tobjectNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];\n\tobjectNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];\n\tobjectNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];\n#endif\n",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\t#ifndef USE_MORPHNORMALS\n\tuniform float morphTargetInfluences[ 8 ];\n\t#else\n\tuniform float morphTargetInfluences[ 4 ];\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\n\ttransformed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\n\ttransformed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\n\ttransformed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\ttransformed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\n\ttransformed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\n\ttransformed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\n\ttransformed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\n\t#endif\n#endif\n",normal_fragment_begin:"#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t#endif\n#endif\n",normal_fragment_maps:"#ifdef USE_NORMALMAP\n\tnormal = perturbNormal2Arb( -vViewPosition, normal );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif\n",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {\n\t\tvec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n\t\tvec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tvec3 S = normalize( q0 * st1.t - q1 * st0.t );\n\t\tvec3 T = normalize( -q0 * st1.s + q1 * st0.s );\n\t\tvec3 N = normalize( surf_norm );\n\t\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t\tmapN.xy = normalScale * mapN.xy;\n\t\tmat3 tsn = mat3( S, T, N );\n\t\treturn normalize( tsn * mapN );\n\t}\n#endif\n",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn (( near + viewZ ) * far ) / (( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}\n",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif\n",project_vertex:"vec4 mvPosition = modelViewMatrix * vec4( transformed, 1.0 );\ngl_Position = projectionMatrix * mvPosition;\n",dithering_fragment:"#if defined( DITHERING )\n gl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif\n",dithering_pars_fragment:"#if defined( DITHERING )\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif\n",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif\n",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tfloat texture2DShadowLerp( sampler2D depths, vec2 size, vec2 uv, float compare ) {\n\t\tconst vec2 offset = vec2( 0.0, 1.0 );\n\t\tvec2 texelSize = vec2( 1.0 ) / size;\n\t\tvec2 centroidUV = floor( uv * size + 0.5 ) / size;\n\t\tfloat lb = texture2DCompare( depths, centroidUV + texelSize * offset.xx, compare );\n\t\tfloat lt = texture2DCompare( depths, centroidUV + texelSize * offset.xy, compare );\n\t\tfloat rb = texture2DCompare( depths, centroidUV + texelSize * offset.yx, compare );\n\t\tfloat rt = texture2DCompare( depths, centroidUV + texelSize * offset.yy, compare );\n\t\tvec2 f = fract( uv * size + 0.5 );\n\t\tfloat a = mix( lb, lt, f.y );\n\t\tfloat b = mix( rb, rt, f.y );\n\t\tfloat c = mix( a, b, f.x );\n\t\treturn c;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tshadow = (\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif\n",shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n#endif\n",shadowmap_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n#endif\n",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\tDirectionalLight directionalLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tshadow *= bool( directionalLight.shadow ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\tSpotLight spotLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tshadow *= bool( spotLight.shadow ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\tPointLight pointLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tshadow *= bool( pointLight.shadow ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#endif\n\t#endif\n\treturn shadow;\n}\n",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform sampler2D boneTexture;\n\t\tuniform int boneTextureSize;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif\n",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif\n",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n#endif\n",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif\n",tonemapping_pars_fragment:"#ifndef saturate\n\t#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nuniform float toneMappingWhitePoint;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\n#define Uncharted2Helper( x ) max( ( ( x * ( 0.15 * x + 0.10 * 0.50 ) + 0.20 * 0.02 ) / ( x * ( 0.15 * x + 0.50 ) + 0.20 * 0.30 ) ) - 0.02 / 0.30, vec3( 0.0 ) )\nvec3 Uncharted2ToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\n",uv_pars_fragment:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvarying vec2 vUv;\n\tuniform mat3 uvTransform;\n#endif\n",uv_vertex:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n#endif",uv2_pars_fragment:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = uv2;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP )\n\tvec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );\n#endif\n",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldPosition;\nvoid main() {\n\tgl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );\n\tgl_FragColor.a *= opacity;\n}\n",cube_vert:"varying vec3 vWorldPosition;\n#include \nvoid main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n\tgl_Position.z = gl_Position.w;\n}\n",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - gl_FragCoord.z ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( gl_FragCoord.z );\n\t#endif\n}\n",depth_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main () {\n\t#include \n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include \n\t#include \n\t#include \n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}\n",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvWorldPosition = worldPosition.xyz;\n}\n",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldPosition;\n#include \nvoid main() {\n\tvec3 direction = normalize( vWorldPosition );\n\tvec2 sampleUV;\n\tsampleUV.y = asin( clamp( direction.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\tsampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n}\n",equirect_vert:"varying vec3 vWorldPosition;\n#include \nvoid main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n}\n",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}\n",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvLineDistance = scale * lineDistance;\n\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include \n\t#include \n\t#include \n}\n",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\treflectedLight.indirectDiffuse += texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include \n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshbasic_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifdef USE_ENVMAP\n\t#include \n\t#include \n\t#include \n\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshlambert_frag:"uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\treflectedLight.indirectDiffuse = getAmbientLightIrradiance( ambientLightColor );\n\t#include \n\treflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\t#else\n\t\treflectedLight.directDiffuse = vLightFront;\n\t#endif\n\treflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshlambert_vert:"#define LAMBERT\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshphysical_frag:"#define PHYSICAL\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifndef STANDARD\n\tuniform float clearCoat;\n\tuniform float clearCoatRoughness;\n#endif\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshphysical_vert:"#define PHYSICAL\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n}\n",normal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n}\n",normal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}\n",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}\n",points_vert:"uniform float size;\nuniform float scale;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#ifdef USE_SIZEATTENUATION\n\t\tgl_PointSize = size * ( scale / - mvPosition.z );\n\t#else\n\t\tgl_PointSize = size;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include \n}\n",shadow_vert:"#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n"},mn={merge:function(t){for(var e={},n=0;n>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,this},setRGB:function(t,e,n){return this.r=t,this.g=e,this.b=n,this},setHSL:function(){function t(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+6*(e-t)*(2/3-n):t}return function(e,n,i){if(e=Ge.euclideanModulo(e,1),n=Ge.clamp(n,0,1),i=Ge.clamp(i,0,1),0===n)this.r=this.g=this.b=i;else{var r=i<=.5?i*(1+n):i+n-i*n,o=2*i-r;this.r=t(o,r,e+1/3),this.g=t(o,r,e),this.b=t(o,r,e-1/3)}return this}}(),setStyle:function(t){function e(e){void 0!==e&&parseFloat(e)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}var n;if(n=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(t)){var i,r=n[1],o=n[2];switch(r){case"rgb":case"rgba":if(i=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o))return this.r=Math.min(255,parseInt(i[1],10))/255,this.g=Math.min(255,parseInt(i[2],10))/255,this.b=Math.min(255,parseInt(i[3],10))/255,e(i[5]),this;if(i=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o))return this.r=Math.min(100,parseInt(i[1],10))/100,this.g=Math.min(100,parseInt(i[2],10))/100,this.b=Math.min(100,parseInt(i[3],10))/100,e(i[5]),this;break;case"hsl":case"hsla":if(i=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o)){var a=parseFloat(i[1])/360,s=parseInt(i[2],10)/100,c=parseInt(i[3],10)/100;return e(i[5]),this.setHSL(a,s,c)}}}else if(n=/^\#([A-Fa-f0-9]+)$/.exec(t)){var l,u=(l=n[1]).length;if(3===u)return this.r=parseInt(l.charAt(0)+l.charAt(0),16)/255,this.g=parseInt(l.charAt(1)+l.charAt(1),16)/255,this.b=parseInt(l.charAt(2)+l.charAt(2),16)/255,this;if(6===u)return this.r=parseInt(l.charAt(0)+l.charAt(1),16)/255,this.g=parseInt(l.charAt(2)+l.charAt(3),16)/255,this.b=parseInt(l.charAt(4)+l.charAt(5),16)/255,this}t&&t.length>0&&(void 0!==(l=gn[t])?this.setHex(l):console.warn("THREE.Color: Unknown color "+t));return this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this},copyGammaToLinear:function(t,e){return void 0===e&&(e=2),this.r=Math.pow(t.r,e),this.g=Math.pow(t.g,e),this.b=Math.pow(t.b,e),this},copyLinearToGamma:function(t,e){void 0===e&&(e=2);var n=e>0?1/e:1;return this.r=Math.pow(t.r,n),this.g=Math.pow(t.g,n),this.b=Math.pow(t.b,n),this},convertGammaToLinear:function(){var t=this.r,e=this.g,n=this.b;return this.r=t*t,this.g=e*e,this.b=n*n,this},convertLinearToGamma:function(){return this.r=Math.sqrt(this.r),this.g=Math.sqrt(this.g),this.b=Math.sqrt(this.b),this},getHex:function(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getHSL:function(t){void 0===t&&(console.warn("THREE.Color: .getHSL() target is now required"),t={h:0,s:0,l:0});var e,n,i=this.r,r=this.g,o=this.b,a=Math.max(i,r,o),s=Math.min(i,r,o),c=(s+a)/2;if(s===a)e=0,n=0;else{var l=a-s;switch(n=c<=.5?l/(a+s):l/(2-a-s),a){case i:e=(r-o)/l+(r1){for(var e=0;e1){for(var e=0;e0){i.children=[];for(s=0;s0&&(n.geometries=h),d.length>0&&(n.materials=d),f.length>0&&(n.textures=f),p.length>0&&(n.images=p),a.length>0&&(n.shapes=a)}return n.object=i,n;function m(t){var e=[];for(var n in t){var i=t[n];delete i.metadata,e.push(i)}return e}},clone:function(t){return(new this.constructor).copy(this,t)},copy:function(t,e){if(void 0===e&&(e=!0),this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(var n=0;ne&&(e=t[n]);return e}Bn.prototype=Object.assign(Object.create(i.prototype),{constructor:Bn,isGeometry:!0,applyMatrix:function(t){for(var e=(new Ke).getNormalMatrix(t),n=0,i=this.vertices.length;n0)for(d=0;d0&&(this.normalsNeedUpdate=!0)},computeFlatVertexNormals:function(){var t,e,n;for(this.computeFaceNormals(),t=0,e=this.faces.length;t0&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){var t,e,n,i,r;for(n=0,i=this.faces.length;n=0;n--){var p=d[n];for(this.faces.splice(p,1),a=0,s=this.faceVertexUvs.length;a0,g=f.vertexNormals.length>0,_=1!==f.color.r||1!==f.color.g||1!==f.color.b,v=f.vertexColors.length>0,b=0;if(b=M(b,0,0),b=M(b,1,!0),b=M(b,2,!1),b=M(b,3,p),b=M(b,4,m),b=M(b,5,g),b=M(b,6,_),b=M(b,7,v),a.push(b),a.push(f.a,f.b,f.c),a.push(f.materialIndex),p){var y=this.faceVertexUvs[0][r];a.push(A(y[0]),A(y[1]),A(y[2]))}if(m&&a.push(E(f.normal)),g){var x=f.vertexNormals;a.push(E(x[0]),E(x[1]),E(x[2]))}if(_&&a.push(S(f.color)),v){var w=f.vertexColors;a.push(S(w[0]),S(w[1]),S(w[2]))}}function M(t,e,n){return n?t|1<0&&(t.data.colors=l),h.length>0&&(t.data.uvs=[h]),t.data.faces=a,t},clone:function(){return(new Bn).copy(this)},copy:function(t){var e,n,i,r,o,a;this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.name=t.name;var s=t.vertices;for(e=0,n=s.length;e0,a=r[1]&&r[1].length>0,s=t.morphTargets,c=s.length;if(c>0){e=[];for(var l=0;l0){u=[];for(l=0;l0?1:-1,l.push(P.x,P.y,P.z),u.push(v/m),u.push(1-b/g),T+=1}}for(b=0;b65535?Gn:Hn)(t,1):this.index=t},addAttribute:function(t,e){return e&&e.isBufferAttribute||e&&e.isInterleavedBufferAttribute?"index"===t?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),void this.setIndex(e)):(this.attributes[t]=e,this):(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),void this.addAttribute(t,new Nn(arguments[1],arguments[2])))},getAttribute:function(t){return this.attributes[t]},removeAttribute:function(t){return delete this.attributes[t],this},addGroup:function(t,e,n){this.groups.push({start:t,count:e,materialIndex:void 0!==n?n:0})},clearGroups:function(){this.groups=[]},setDrawRange:function(t,e){this.drawRange.start=t,this.drawRange.count=e},applyMatrix:function(t){var e=this.attributes.position;void 0!==e&&(t.applyToBufferAttribute(e),e.needsUpdate=!0);var n=this.attributes.normal;void 0!==n&&((new Ke).getNormalMatrix(t).applyToBufferAttribute(n),n.needsUpdate=!0);return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:function(){var t=new Ve;return function(e){return t.makeRotationX(e),this.applyMatrix(t),this}}(),rotateY:function(){var t=new Ve;return function(e){return t.makeRotationY(e),this.applyMatrix(t),this}}(),rotateZ:function(){var t=new Ve;return function(e){return t.makeRotationZ(e),this.applyMatrix(t),this}}(),translate:function(){var t=new Ve;return function(e,n,i){return t.makeTranslation(e,n,i),this.applyMatrix(t),this}}(),scale:function(){var t=new Ve;return function(e,n,i){return t.makeScale(e,n,i),this.applyMatrix(t),this}}(),lookAt:function(){var t=new Pn;return function(e){t.lookAt(e),t.updateMatrix(),this.applyMatrix(t.matrix)}}(),center:function(){var t=new Ye;return function(){return this.computeBoundingBox(),this.boundingBox.getCenter(t).negate(),this.translate(t.x,t.y,t.z),this}}(),setFromObject:function(t){var e=t.geometry;if(t.isPoints||t.isLine){var n=new Wn(3*e.vertices.length,3),i=new Wn(3*e.colors.length,3);if(this.addAttribute("position",n.copyVector3sArray(e.vertices)),this.addAttribute("color",i.copyColorsArray(e.colors)),e.lineDistances&&e.lineDistances.length===e.vertices.length){var r=new Wn(e.lineDistances.length,1);this.addAttribute("lineDistance",r.copyArray(e.lineDistances))}null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone())}else t.isMesh&&e&&e.isGeometry&&this.fromGeometry(e);return this},setFromPoints:function(t){for(var e=[],n=0,i=t.length;n0){var n=new Float32Array(3*t.normals.length);this.addAttribute("normal",new Nn(n,3).copyVector3sArray(t.normals))}if(t.colors.length>0){var i=new Float32Array(3*t.colors.length);this.addAttribute("color",new Nn(i,3).copyColorsArray(t.colors))}if(t.uvs.length>0){var r=new Float32Array(2*t.uvs.length);this.addAttribute("uv",new Nn(r,2).copyVector2sArray(t.uvs))}if(t.uvs2.length>0){var o=new Float32Array(2*t.uvs2.length);this.addAttribute("uv2",new Nn(o,2).copyVector2sArray(t.uvs2))}for(var a in this.groups=t.groups,t.morphTargets){for(var s=[],c=t.morphTargets[a],l=0,u=c.length;l0){var f=new Wn(4*t.skinIndices.length,4);this.addAttribute("skinIndex",f.copyVector4sArray(t.skinIndices))}if(t.skinWeights.length>0){var p=new Wn(4*t.skinWeights.length,4);this.addAttribute("skinWeight",p.copyVector4sArray(t.skinWeights))}return null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),this},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new ln);var t=this.attributes.position;void 0!==t?this.boundingBox.setFromBufferAttribute(t):this.boundingBox.makeEmpty(),(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox: Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)},computeBoundingSphere:function(){var t=new ln,e=new Ye;return function(){null===this.boundingSphere&&(this.boundingSphere=new un);var n=this.attributes.position;if(n){var i=this.boundingSphere.center;t.setFromBufferAttribute(n),t.getCenter(i);for(var r=0,o=0,a=n.count;o0&&(t.data.groups=JSON.parse(JSON.stringify(s)));var c=this.boundingSphere;return null!==c&&(t.data.boundingSphere={center:c.center.toArray(),radius:c.radius}),t},clone:function(){return(new Zn).copy(this)},copy:function(t){var e,n,i;this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.name=t.name;var r=t.index;null!==r&&this.setIndex(r.clone());var o=t.attributes;for(e in o){var a=o[e];this.addAttribute(e,a.clone())}var s=t.morphAttributes;for(e in s){var c=[],l=s[e];for(n=0,i=l.length;n0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision>0)return"highp";e="mediump"}return"mediump"===e&&t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.MEDIUM_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}var o=void 0!==n.precision?n.precision:"highp",a=r(o);a!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",a,"instead."),o=a);var s=!0===n.logarithmicDepthBuffer,c=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),l=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),u=t.getParameter(t.MAX_TEXTURE_SIZE),h=t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),d=t.getParameter(t.MAX_VERTEX_ATTRIBS),f=t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),p=t.getParameter(t.MAX_VARYING_VECTORS),m=t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),g=l>0,_=!!e.get("OES_texture_float");return{getMaxAnisotropy:function(){if(void 0!==i)return i;var n=e.get("EXT_texture_filter_anisotropic");return i=null!==n?t.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0},getMaxPrecision:r,precision:o,logarithmicDepthBuffer:s,maxTextures:c,maxVertexTextures:l,maxTextureSize:u,maxCubemapSize:h,maxAttributes:d,maxVertexUniforms:f,maxVaryings:p,maxFragmentUniforms:m,vertexTextures:g,floatFragmentTextures:_,floatVertexTextures:g&&_}}function bi(){var t=this,e=null,n=0,i=!1,r=!1,o=new hn,a=new Ke,s={value:null,needsUpdate:!1};function c(){s.value!==e&&(s.value=e,s.needsUpdate=n>0),t.numPlanes=n,t.numIntersection=0}function l(e,n,i,r){var c=null!==e?e.length:0,l=null;if(0!==c){if(l=s.value,!0!==r||null===l){var u=i+4*c,h=n.matrixWorldInverse;a.getNormalMatrix(h),(null===l||l.length65535?Gn:Hn)(a,1),e.update(i,t.ELEMENT_ARRAY_BUFFER),r[n.id]=i,i}}}function wi(t,e,n){var i,r,o;this.setMode=function(t){i=t},this.setIndex=function(t){r=t.type,o=t.bytesPerElement},this.render=function(e,a){t.drawElements(i,a,r,e*o),n.update(a,i)},this.renderInstances=function(t,a,s){var c=e.get("ANGLE_instanced_arrays");null!==c?(c.drawElementsInstancedANGLE(i,s,r,a*o,t.maxInstancedCount),n.update(s,i,t.maxInstancedCount)):console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.")}}function Mi(t){var e={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:e,programs:null,autoReset:!0,reset:function(){e.frame++,e.calls=0,e.triangles=0,e.points=0,e.lines=0},update:function(n,i,r){switch(r=r||1,e.calls++,i){case t.TRIANGLES:e.triangles+=r*(n/3);break;case t.TRIANGLE_STRIP:case t.TRIANGLE_FAN:e.triangles+=r*(n-2);break;case t.LINES:e.lines+=r*(n/2);break;case t.LINE_STRIP:e.lines+=r*(n-1);break;case t.LINE_LOOP:e.lines+=r*n;break;case t.POINTS:e.points+=r*n;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",i)}}}}function Ei(t,e){return Math.abs(e[1])-Math.abs(t[1])}function Si(t){var e={},n=new Float32Array(8);return{update:function(i,r,o,a){var s=i.morphTargetInfluences,c=s.length,l=e[r.id];if(void 0===l){l=[];for(var u=0;u0&&(n.alphaTest=this.alphaTest),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=this.premultipliedAlpha),!0===this.wireframe&&(n.wireframe=this.wireframe),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),!0===this.morphTargets&&(n.morphTargets=!0),!0===this.skinning&&(n.skinning=!0),!1===this.visible&&(n.visible=!1),"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),e){var r=i(t.textures),o=i(t.images);r.length>0&&(n.textures=r),o.length>0&&(n.images=o)}return n},clone:function(){return(new this.constructor).copy(this)},copy:function(t){this.name=t.name,this.fog=t.fog,this.lights=t.lights,this.blending=t.blending,this.side=t.side,this.flatShading=t.flatShading,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.premultipliedAlpha=t.premultipliedAlpha,this.overdraw=t.overdraw,this.visible=t.visible,this.userData=JSON.parse(JSON.stringify(t.userData)),this.clipShadows=t.clipShadows,this.clipIntersection=t.clipIntersection;var e=t.clippingPlanes,n=null;if(null!==e){var i=e.length;n=new Array(i);for(var r=0;r!==i;++r)n[r]=e[r].clone()}return this.clippingPlanes=n,this.shadowSide=t.shadowSide,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),ui.prototype=Object.create(li.prototype),ui.prototype.constructor=ui,ui.prototype.isMeshBasicMaterial=!0,ui.prototype.copy=function(t){return li.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this},hi.prototype=Object.create(li.prototype),hi.prototype.constructor=hi,hi.prototype.isShaderMaterial=!0,hi.prototype.copy=function(t){return li.prototype.copy.call(this,t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=mn.clone(t.uniforms),this.defines=t.defines,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.lights=t.lights,this.clipping=t.clipping,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this.extensions=t.extensions,this},hi.prototype.toJSON=function(t){var e=li.prototype.toJSON.call(this,t);return e.uniforms=this.uniforms,e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader,e},Object.assign(di.prototype,{set:function(t,e){return this.origin.copy(t),this.direction.copy(e),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this},at:function(t,e){return void 0===e&&(console.warn("THREE.Ray: .at() target is now required"),e=new Ye),e.copy(this.direction).multiplyScalar(t).add(this.origin)},lookAt:function(t){return this.direction.copy(t).sub(this.origin).normalize(),this},recast:function(){var t=new Ye;return function(e){return this.origin.copy(this.at(e,t)),this}}(),closestPointToPoint:function(t,e){void 0===e&&(console.warn("THREE.Ray: .closestPointToPoint() target is now required"),e=new Ye),e.subVectors(t,this.origin);var n=e.dot(this.direction);return n<0?e.copy(this.origin):e.copy(this.direction).multiplyScalar(n).add(this.origin)},distanceToPoint:function(t){return Math.sqrt(this.distanceSqToPoint(t))},distanceSqToPoint:function(){var t=new Ye;return function(e){var n=t.subVectors(e,this.origin).dot(this.direction);return n<0?this.origin.distanceToSquared(e):(t.copy(this.direction).multiplyScalar(n).add(this.origin),t.distanceToSquared(e))}}(),distanceSqToSegment:(ni=new Ye,ii=new Ye,ri=new Ye,function(t,e,n,i){ni.copy(t).add(e).multiplyScalar(.5),ii.copy(e).sub(t).normalize(),ri.copy(this.origin).sub(ni);var r,o,a,s,c=.5*t.distanceTo(e),l=-this.direction.dot(ii),u=ri.dot(this.direction),h=-ri.dot(ii),d=ri.lengthSq(),f=Math.abs(1-l*l);if(f>0)if(o=l*u-h,s=c*f,(r=l*h-u)>=0)if(o>=-s)if(o<=s){var p=1/f;a=(r*=p)*(r+l*(o*=p)+2*u)+o*(l*r+o+2*h)+d}else o=c,a=-(r=Math.max(0,-(l*o+u)))*r+o*(o+2*h)+d;else o=-c,a=-(r=Math.max(0,-(l*o+u)))*r+o*(o+2*h)+d;else o<=-s?a=-(r=Math.max(0,-(-l*c+u)))*r+(o=r>0?-c:Math.min(Math.max(-c,-h),c))*(o+2*h)+d:o<=s?(r=0,a=(o=Math.min(Math.max(-c,-h),c))*(o+2*h)+d):a=-(r=Math.max(0,-(l*c+u)))*r+(o=r>0?c:Math.min(Math.max(-c,-h),c))*(o+2*h)+d;else o=l>0?-c:c,a=-(r=Math.max(0,-(l*o+u)))*r+o*(o+2*h)+d;return n&&n.copy(this.direction).multiplyScalar(r).add(this.origin),i&&i.copy(ii).multiplyScalar(o).add(ni),a}),intersectSphere:function(){var t=new Ye;return function(e,n){t.subVectors(e.center,this.origin);var i=t.dot(this.direction),r=t.dot(t)-i*i,o=e.radius*e.radius;if(r>o)return null;var a=Math.sqrt(o-r),s=i-a,c=i+a;return s<0&&c<0?null:s<0?this.at(c,n):this.at(s,n)}}(),intersectsSphere:function(t){return this.distanceToPoint(t.center)<=t.radius},distanceToPlane:function(t){var e=t.normal.dot(this.direction);if(0===e)return 0===t.distanceToPoint(this.origin)?0:null;var n=-(this.origin.dot(t.normal)+t.constant)/e;return n>=0?n:null},intersectPlane:function(t,e){var n=this.distanceToPlane(t);return null===n?null:this.at(n,e)},intersectsPlane:function(t){var e=t.distanceToPoint(this.origin);return 0===e||t.normal.dot(this.direction)*e<0},intersectBox:function(t,e){var n,i,r,o,a,s,c=1/this.direction.x,l=1/this.direction.y,u=1/this.direction.z,h=this.origin;return c>=0?(n=(t.min.x-h.x)*c,i=(t.max.x-h.x)*c):(n=(t.max.x-h.x)*c,i=(t.min.x-h.x)*c),l>=0?(r=(t.min.y-h.y)*l,o=(t.max.y-h.y)*l):(r=(t.max.y-h.y)*l,o=(t.min.y-h.y)*l),n>o||r>i?null:((r>n||n!=n)&&(n=r),(o=0?(a=(t.min.z-h.z)*u,s=(t.max.z-h.z)*u):(a=(t.max.z-h.z)*u,s=(t.min.z-h.z)*u),n>s||a>i?null:((a>n||n!=n)&&(n=a),(s=0?n:i,e)))},intersectsBox:(ei=new Ye,function(t){return null!==this.intersectBox(t,ei)}),intersectTriangle:function(){var t=new Ye,e=new Ye,n=new Ye,i=new Ye;return function(r,o,a,s,c){e.subVectors(o,r),n.subVectors(a,r),i.crossVectors(e,n);var l,u=this.direction.dot(i);if(u>0){if(s)return null;l=1}else{if(!(u<0))return null;l=-1,u=-u}t.subVectors(this.origin,r);var h=l*this.direction.dot(n.crossVectors(t,n));if(h<0)return null;var d=l*this.direction.dot(e.cross(t));if(d<0)return null;if(h+d>u)return null;var f=-l*t.dot(i);return f<0?null:this.at(f/u,c)}}(),applyMatrix4:function(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this},equals:function(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}}),Object.assign(fi.prototype,{set:function(t,e){return this.start.copy(t),this.end.copy(e),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.start.copy(t.start),this.end.copy(t.end),this},getCenter:function(t){return void 0===t&&(console.warn("THREE.Line3: .getCenter() target is now required"),t=new Ye),t.addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(t){return void 0===t&&(console.warn("THREE.Line3: .delta() target is now required"),t=new Ye),t.subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(t,e){return void 0===e&&(console.warn("THREE.Line3: .at() target is now required"),e=new Ye),this.delta(e).multiplyScalar(t).add(this.start)},closestPointToPointParameter:(oi=new Ye,ai=new Ye,function(t,e){oi.subVectors(t,this.start),ai.subVectors(this.end,this.start);var n=ai.dot(ai),i=ai.dot(oi)/n;return e&&(i=Ge.clamp(i,0,1)),i}),closestPointToPoint:function(t,e,n){var i=this.closestPointToPointParameter(t,e);return void 0===n&&(console.warn("THREE.Line3: .closestPointToPoint() target is now required"),n=new Ye),this.delta(n).multiplyScalar(i).add(this.start)},applyMatrix4:function(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this},equals:function(t){return t.start.equals(this.start)&&t.end.equals(this.end)}}),Object.assign(pi,{getNormal:(si=new Ye,function(t,e,n,i){void 0===i&&(console.warn("THREE.Triangle: .getNormal() target is now required"),i=new Ye),i.subVectors(n,e),si.subVectors(t,e),i.cross(si);var r=i.lengthSq();return r>0?i.multiplyScalar(1/Math.sqrt(r)):i.set(0,0,0)}),getBarycoord:function(){var t=new Ye,e=new Ye,n=new Ye;return function(i,r,o,a,s){t.subVectors(a,r),e.subVectors(o,r),n.subVectors(i,r);var c=t.dot(t),l=t.dot(e),u=t.dot(n),h=e.dot(e),d=e.dot(n),f=c*h-l*l;if(void 0===s&&(console.warn("THREE.Triangle: .getBarycoord() target is now required"),s=new Ye),0===f)return s.set(-2,-1,-1);var p=1/f,m=(h*u-l*d)*p,g=(c*d-l*u)*p;return s.set(1-m-g,g,m)}}(),containsPoint:function(){var t=new Ye;return function(e,n,i,r){return pi.getBarycoord(e,n,i,r,t),t.x>=0&&t.y>=0&&t.x+t.y<=1}}()}),Object.assign(pi.prototype,{set:function(t,e,n){return this.a.copy(t),this.b.copy(e),this.c.copy(n),this},setFromPointsAndIndices:function(t,e,n,i){return this.a.copy(t[e]),this.b.copy(t[n]),this.c.copy(t[i]),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this},getArea:function(){var t=new Ye,e=new Ye;return function(){return t.subVectors(this.c,this.b),e.subVectors(this.a,this.b),.5*t.cross(e).length()}}(),getMidpoint:function(t){return void 0===t&&(console.warn("THREE.Triangle: .getMidpoint() target is now required"),t=new Ye),t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},getNormal:function(t){return pi.getNormal(this.a,this.b,this.c,t)},getPlane:function(t){return void 0===t&&(console.warn("THREE.Triangle: .getPlane() target is now required"),t=new Ye),t.setFromCoplanarPoints(this.a,this.b,this.c)},getBarycoord:function(t,e){return pi.getBarycoord(t,this.a,this.b,this.c,e)},containsPoint:function(t){return pi.containsPoint(t,this.a,this.b,this.c)},intersectsBox:function(t){return t.intersectsTriangle(this)},closestPointToPoint:function(){var t=new hn,e=[new fi,new fi,new fi],n=new Ye,i=new Ye;return function(r,o){void 0===o&&(console.warn("THREE.Triangle: .closestPointToPoint() target is now required"),o=new Ye);var a=1/0;if(t.setFromCoplanarPoints(this.a,this.b,this.c),t.projectPoint(r,n),!0===this.containsPoint(n))o.copy(n);else{e[0].set(this.a,this.b),e[1].set(this.b,this.c),e[2].set(this.c,this.a);for(var s=0;s0){var a=r[o[0]];if(void 0!==a)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},t=0,e=a.length;t0)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},t=0,e=s.length;tn.far?null:{distance:c,point:p.clone(),object:t}}function _(t,e,n,a,s,c,d,p){i.fromBufferAttribute(a,c),r.fromBufferAttribute(a,d),o.fromBufferAttribute(a,p);var _=g(t,t.material,e,n,i,r,o,f);if(_){s&&(l.fromBufferAttribute(s,c),u.fromBufferAttribute(s,d),h.fromBufferAttribute(s,p),_.uv=m(f,i,r,o,l,u,h));var v=new Cn(c,d,p);pi.getNormal(i,r,o,v.normal),_.face=v,_.faceIndex=c}return _}return function(d,p){var v,b=this.geometry,y=this.material,x=this.matrixWorld;if(void 0!==y&&(null===b.boundingSphere&&b.computeBoundingSphere(),n.copy(b.boundingSphere),n.applyMatrix4(x),!1!==d.ray.intersectsSphere(n)&&(t.getInverse(x),e.copy(d.ray).applyMatrix4(t),null===b.boundingBox||!1!==e.intersectsBox(b.boundingBox))))if(b.isBufferGeometry){var w,M,E,S,A,T=b.index,k=b.attributes.position,P=b.attributes.uv;if(null!==T)for(S=0,A=T.count;S0&&(R=N);for(var D=0,j=B.length;D0)return t;var r=e*n,o=Oi[r];if(void 0===o&&(o=new Float32Array(r),Oi[r]=o),0!==e){i.toArray(o,0);for(var a=1,s=0;a!==e;++a)s+=n,t[a].toArray(o,s)}return o}function Bi(t,e){var n=Ci[e];void 0===n&&(n=new Int32Array(e),Ci[e]=n);for(var i=0;i!==e;++i)n[i]=t.allocTextureUnit();return n}function Ni(t,e){t.uniform1f(this.addr,e)}function Di(t,e){t.uniform1i(this.addr,e)}function ji(t,e){void 0===e.x?t.uniform2fv(this.addr,e):t.uniform2f(this.addr,e.x,e.y)}function Ui(t,e){void 0!==e.x?t.uniform3f(this.addr,e.x,e.y,e.z):void 0!==e.r?t.uniform3f(this.addr,e.r,e.g,e.b):t.uniform3fv(this.addr,e)}function Fi(t,e){void 0===e.x?t.uniform4fv(this.addr,e):t.uniform4f(this.addr,e.x,e.y,e.z,e.w)}function Hi(t,e){t.uniformMatrix2fv(this.addr,!1,e.elements||e)}function qi(t,e){void 0===e.elements?t.uniformMatrix3fv(this.addr,!1,e):(Ii.set(e.elements),t.uniformMatrix3fv(this.addr,!1,Ii))}function Gi(t,e){void 0===e.elements?t.uniformMatrix4fv(this.addr,!1,e):(Ri.set(e.elements),t.uniformMatrix4fv(this.addr,!1,Ri))}function Wi(t,e,n){var i=n.allocTextureUnit();t.uniform1i(this.addr,i),n.setTexture2D(e||ki,i)}function Vi(t,e,n){var i=n.allocTextureUnit();t.uniform1i(this.addr,i),n.setTextureCube(e||Pi,i)}function Xi(t,e){t.uniform2iv(this.addr,e)}function Yi(t,e){t.uniform3iv(this.addr,e)}function Ki(t,e){t.uniform4iv(this.addr,e)}function Zi(t,e){t.uniform1fv(this.addr,e)}function Ji(t,e){t.uniform1iv(this.addr,e)}function Qi(t,e){t.uniform2fv(this.addr,zi(e,this.size,2))}function $i(t,e){t.uniform3fv(this.addr,zi(e,this.size,3))}function tr(t,e){t.uniform4fv(this.addr,zi(e,this.size,4))}function er(t,e){t.uniformMatrix2fv(this.addr,!1,zi(e,this.size,4))}function nr(t,e){t.uniformMatrix3fv(this.addr,!1,zi(e,this.size,9))}function ir(t,e){t.uniformMatrix4fv(this.addr,!1,zi(e,this.size,16))}function rr(t,e,n){var i=e.length,r=Bi(n,i);t.uniform1iv(this.addr,r);for(var o=0;o!==i;++o)n.setTexture2D(e[o]||ki,r[o])}function or(t,e,n){var i=e.length,r=Bi(n,i);t.uniform1iv(this.addr,r);for(var o=0;o!==i;++o)n.setTextureCube(e[o]||Pi,r[o])}function ar(t,e,n){this.id=t,this.addr=n,this.setValue=function(t){switch(t){case 5126:return Ni;case 35664:return ji;case 35665:return Ui;case 35666:return Fi;case 35674:return Hi;case 35675:return qi;case 35676:return Gi;case 35678:case 36198:return Wi;case 35680:return Vi;case 5124:case 35670:return Di;case 35667:case 35671:return Xi;case 35668:case 35672:return Yi;case 35669:case 35673:return Ki}}(e.type)}function sr(t,e,n){this.id=t,this.addr=n,this.size=e.size,this.setValue=function(t){switch(t){case 5126:return Zi;case 35664:return Qi;case 35665:return $i;case 35666:return tr;case 35674:return er;case 35675:return nr;case 35676:return ir;case 35678:return rr;case 35680:return or;case 5124:case 35670:return Ji;case 35667:case 35671:return Xi;case 35668:case 35672:return Yi;case 35669:case 35673:return Ki}}(e.type)}function cr(t){this.id=t,Li.call(this)}cr.prototype.setValue=function(t,e){for(var n=this.seq,i=0,r=n.length;i!==r;++i){var o=n[i];o.setValue(t,e[o.id])}};var lr=/([\w\d_]+)(\])?(\[|\.)?/g;function ur(t,e){t.seq.push(e),t.map[e.id]=e}function hr(t,e,n){var i=t.name,r=i.length;for(lr.lastIndex=0;;){var o=lr.exec(i),a=lr.lastIndex,s=o[1],c="]"===o[2],l=o[3];if(c&&(s|=0),void 0===l||"["===l&&a+2===r){ur(n,void 0===l?new ar(s,t,e):new sr(s,t,e));break}var u=n.map[s];void 0===u&&ur(n,u=new cr(s)),n=u}}function dr(t,e,n){Li.call(this),this.renderer=n;for(var i=t.getProgramParameter(e,t.ACTIVE_UNIFORMS),r=0;r/gm,function(t,e){var n=pn[e];if(void 0===n)throw new Error("Can not resolve #include <"+e+">");return xr(n)})}function wr(t){return t.replace(/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,function(t,e,n,i){for(var r="",o=parseInt(e);o0?t.gammaFactor:1,y=function(t,e,n){return[(t=t||{}).derivatives||e.envMapCubeUV||e.bumpMap||e.normalMap||e.flatShading?"#extension GL_OES_standard_derivatives : enable":"",(t.fragDepth||e.logarithmicDepthBuffer)&&n.get("EXT_frag_depth")?"#extension GL_EXT_frag_depth : enable":"",t.drawBuffers&&n.get("WEBGL_draw_buffers")?"#extension GL_EXT_draw_buffers : require":"",(t.shaderTextureLOD||e.envMap)&&n.get("EXT_shader_texture_lod")?"#extension GL_EXT_shader_texture_lod : enable":""].filter(vr).join("\n")}(i.extensions,o,e),x=function(t){var e=[];for(var n in t){var i=t[n];!1!==i&&e.push("#define "+n+" "+i)}return e.join("\n")}(s),E=a.createProgram();i.isRawShaderMaterial?((p=[x].filter(vr).join("\n")).length>0&&(p+="\n"),(m=[y,x].filter(vr).join("\n")).length>0&&(m+="\n")):(p=["precision "+o.precision+" float;","precision "+o.precision+" int;","#define SHADER_NAME "+r.name,x,o.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+b,"#define MAX_BONES "+o.maxBones,o.useFog&&o.fog?"#define USE_FOG":"",o.useFog&&o.fogExp?"#define FOG_EXP2":"",o.map?"#define USE_MAP":"",o.envMap?"#define USE_ENVMAP":"",o.envMap?"#define "+d:"",o.lightMap?"#define USE_LIGHTMAP":"",o.aoMap?"#define USE_AOMAP":"",o.emissiveMap?"#define USE_EMISSIVEMAP":"",o.bumpMap?"#define USE_BUMPMAP":"",o.normalMap?"#define USE_NORMALMAP":"",o.displacementMap&&o.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",o.specularMap?"#define USE_SPECULARMAP":"",o.roughnessMap?"#define USE_ROUGHNESSMAP":"",o.metalnessMap?"#define USE_METALNESSMAP":"",o.alphaMap?"#define USE_ALPHAMAP":"",o.vertexColors?"#define USE_COLOR":"",o.flatShading?"#define FLAT_SHADED":"",o.skinning?"#define USE_SKINNING":"",o.useVertexTexture?"#define BONE_TEXTURE":"",o.morphTargets?"#define USE_MORPHTARGETS":"",o.morphNormals&&!1===o.flatShading?"#define USE_MORPHNORMALS":"",o.doubleSided?"#define DOUBLE_SIDED":"",o.flipSided?"#define FLIP_SIDED":"",o.shadowMapEnabled?"#define USE_SHADOWMAP":"",o.shadowMapEnabled?"#define "+u:"",o.sizeAttenuation?"#define USE_SIZEATTENUATION":"",o.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",o.logarithmicDepthBuffer&&e.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_COLOR","\tattribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS","\tattribute vec3 morphTarget0;","\tattribute vec3 morphTarget1;","\tattribute vec3 morphTarget2;","\tattribute vec3 morphTarget3;","\t#ifdef USE_MORPHNORMALS","\t\tattribute vec3 morphNormal0;","\t\tattribute vec3 morphNormal1;","\t\tattribute vec3 morphNormal2;","\t\tattribute vec3 morphNormal3;","\t#else","\t\tattribute vec3 morphTarget4;","\t\tattribute vec3 morphTarget5;","\t\tattribute vec3 morphTarget6;","\t\tattribute vec3 morphTarget7;","\t#endif","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(vr).join("\n"),m=[y,"precision "+o.precision+" float;","precision "+o.precision+" int;","#define SHADER_NAME "+r.name,x,o.alphaTest?"#define ALPHATEST "+o.alphaTest:"","#define GAMMA_FACTOR "+b,o.useFog&&o.fog?"#define USE_FOG":"",o.useFog&&o.fogExp?"#define FOG_EXP2":"",o.map?"#define USE_MAP":"",o.envMap?"#define USE_ENVMAP":"",o.envMap?"#define "+h:"",o.envMap?"#define "+d:"",o.envMap?"#define "+f:"",o.lightMap?"#define USE_LIGHTMAP":"",o.aoMap?"#define USE_AOMAP":"",o.emissiveMap?"#define USE_EMISSIVEMAP":"",o.bumpMap?"#define USE_BUMPMAP":"",o.normalMap?"#define USE_NORMALMAP":"",o.specularMap?"#define USE_SPECULARMAP":"",o.roughnessMap?"#define USE_ROUGHNESSMAP":"",o.metalnessMap?"#define USE_METALNESSMAP":"",o.alphaMap?"#define USE_ALPHAMAP":"",o.vertexColors?"#define USE_COLOR":"",o.gradientMap?"#define USE_GRADIENTMAP":"",o.flatShading?"#define FLAT_SHADED":"",o.doubleSided?"#define DOUBLE_SIDED":"",o.flipSided?"#define FLIP_SIDED":"",o.shadowMapEnabled?"#define USE_SHADOWMAP":"",o.shadowMapEnabled?"#define "+u:"",o.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",o.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",o.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",o.logarithmicDepthBuffer&&e.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"",o.envMap&&e.get("EXT_shader_texture_lod")?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;",o.toneMapping!==ht?"#define TONE_MAPPING":"",o.toneMapping!==ht?pn.tonemapping_pars_fragment:"",o.toneMapping!==ht?_r("toneMapping",o.toneMapping):"",o.dithering?"#define DITHERING":"",o.outputEncoding||o.mapEncoding||o.envMapEncoding||o.emissiveMapEncoding?pn.encodings_pars_fragment:"",o.mapEncoding?gr("mapTexelToLinear",o.mapEncoding):"",o.envMapEncoding?gr("envMapTexelToLinear",o.envMapEncoding):"",o.emissiveMapEncoding?gr("emissiveMapTexelToLinear",o.emissiveMapEncoding):"",o.outputEncoding?(g="linearToOutputTexel",_=o.outputEncoding,v=mr(_),"vec4 "+g+"( vec4 value ) { return LinearTo"+v[0]+v[1]+"; }"):"",o.depthPacking?"#define DEPTH_PACKING "+i.depthPacking:"","\n"].filter(vr).join("\n")),c=yr(c=br(c=xr(c),o),o),l=yr(l=br(l=xr(l),o),o);var S=p+(c=wr(c)),A=m+(l=wr(l)),T=fr(a,a.VERTEX_SHADER,S),k=fr(a,a.FRAGMENT_SHADER,A);a.attachShader(E,T),a.attachShader(E,k),void 0!==i.index0AttributeName?a.bindAttribLocation(E,0,i.index0AttributeName):!0===o.morphTargets&&a.bindAttribLocation(E,0,"position"),a.linkProgram(E);var P,L,O=a.getProgramInfoLog(E).trim(),C=a.getShaderInfoLog(T).trim(),R=a.getShaderInfoLog(k).trim(),I=!0,z=!0;return!1===a.getProgramParameter(E,a.LINK_STATUS)?(I=!1,console.error("THREE.WebGLProgram: shader error: ",a.getError(),"gl.VALIDATE_STATUS",a.getProgramParameter(E,a.VALIDATE_STATUS),"gl.getProgramInfoLog",O,C,R)):""!==O?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",O):""!==C&&""!==R||(z=!1),z&&(this.diagnostics={runnable:I,material:i,programLog:O,vertexShader:{log:C,prefix:p},fragmentShader:{log:R,prefix:m}}),a.deleteShader(T),a.deleteShader(k),this.getUniforms=function(){return void 0===P&&(P=new dr(a,E,t)),P},this.getAttributes=function(){return void 0===L&&(L=function(t,e){for(var n={},i=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES),r=0;r0,maxBones:d,useVertexTexture:n.floatVertexTextures,morphTargets:e.morphTargets,morphNormals:e.morphNormals,maxMorphTargets:t.maxMorphTargets,maxMorphNormals:t.maxMorphNormals,numDirLights:i.directional.length,numPointLights:i.point.length,numSpotLights:i.spot.length,numRectAreaLights:i.rectArea.length,numHemiLights:i.hemi.length,numClippingPlanes:c,numClipIntersection:l,dithering:e.dithering,shadowMapEnabled:t.shadowMap.enabled&&u.receiveShadow&&o.length>0,shadowMapType:t.shadowMap.type,toneMapping:t.toneMapping,physicallyCorrectLights:t.physicallyCorrectLights,premultipliedAlpha:e.premultipliedAlpha,alphaTest:e.alphaTest,doubleSided:e.side===A,flipSided:e.side===S,depthPacking:void 0!==e.depthPacking&&e.depthPacking}},this.getProgramCode=function(e,n){var i=[];if(n.shaderID?i.push(n.shaderID):(i.push(e.fragmentShader),i.push(e.vertexShader)),void 0!==e.defines)for(var r in e.defines)i.push(r),i.push(e.defines[r]);for(var a=0;a1&&n.sort(Ar),i.length>1&&i.sort(Tr)}}}function Pr(){var t={};return{get:function(e,n){var i=e.id+","+n.id,r=t[i];return void 0===r&&(r=new kr,t[i]=r),r},dispose:function(){t={}}}}function Lr(){var t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];var n;switch(e.type){case"DirectionalLight":n={direction:new Ye,color:new _n,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new We};break;case"SpotLight":n={position:new Ye,direction:new Ye,color:new _n,distance:0,coneCos:0,penumbraCos:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new We};break;case"PointLight":n={position:new Ye,color:new _n,distance:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new We,shadowCameraNear:1,shadowCameraFar:1e3};break;case"HemisphereLight":n={direction:new Ye,skyColor:new _n,groundColor:new _n};break;case"RectAreaLight":n={color:new _n,position:new Ye,halfWidth:new Ye,halfHeight:new Ye}}return t[e.id]=n,n}}}var Or,Cr,Rr,Ir,zr,Br,Nr,Dr,jr=0;function Ur(){var t=new Lr,e={id:jr++,hash:"",ambient:[0,0,0],directional:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],point:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]},n=new Ye,i=new Ve,r=new Ve;return{setup:function(o,a,s){for(var c=0,l=0,u=0,h=0,d=0,f=0,p=0,m=0,g=s.matrixWorldInverse,_=0,v=o.length;_0:s&&s.isGeometry&&(_=s.morphTargets&&s.morphTargets.length>0)),e.isSkinnedMesh&&!1===n.skinning&&console.warn("THREE.WebGLShadowMap: THREE.SkinnedMesh with material.skinning set to false:",e);var v=e.isSkinnedMesh&&n.skinning,b=0;_&&(b|=l),v&&(b|=u),c=h[b]}if(t.localClippingEnabled&&!0===n.clipShadows&&0!==n.clippingPlanes.length){var y=c.uuid,x=n.uuid,w=p[y];void 0===w&&(w={},p[y]=w);var M=w[x];void 0===M&&(M=c.clone(),w[x]=M),c=M}return c.visible=n.visible,c.wireframe=n.wireframe,c.side=null!=n.shadowSide?n.shadowSide:m[n.side],c.clipShadows=n.clipShadows,c.clippingPlanes=n.clippingPlanes,c.clipIntersection=n.clipIntersection,c.wireframeLinewidth=n.wireframeLinewidth,c.linewidth=n.linewidth,i&&c.isMeshDistanceMaterial&&(c.referencePosition.copy(r),c.nearDistance=o,c.farDistance=a),c}function L(n,r,o,a){if(!1!==n.visible){if(n.layers.test(r.layers)&&(n.isMesh||n.isLine||n.isPoints)&&n.castShadow&&(!n.frustumCulled||i.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(o.matrixWorldInverse,n.matrixWorld);var s=e.update(n),l=n.material;if(Array.isArray(l))for(var u=s.groups,h=0,d=u.length;h 0 ) {","\t\tfloat fogFactor = 0.0;","\t\tif ( fogType == 1 ) {","\t\t\tfogFactor = smoothstep( fogNear, fogFar, fogDepth );","\t\t} else {","\t\t\tconst float LOG2 = 1.442695;","\t\t\tfogFactor = exp2( - fogDensity * fogDensity * fogDepth * fogDepth * LOG2 );","\t\t\tfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );","\t\t}","\t\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );","\t}","}"].join("\n")),e.compileShader(n),e.compileShader(i),e.attachShader(t,n),e.attachShader(t,i),e.linkProgram(t),t}(),c={position:e.getAttribLocation(s,"position"),uv:e.getAttribLocation(s,"uv")},l={uvOffset:e.getUniformLocation(s,"uvOffset"),uvScale:e.getUniformLocation(s,"uvScale"),rotation:e.getUniformLocation(s,"rotation"),center:e.getUniformLocation(s,"center"),scale:e.getUniformLocation(s,"scale"),color:e.getUniformLocation(s,"color"),map:e.getUniformLocation(s,"map"),opacity:e.getUniformLocation(s,"opacity"),modelViewMatrix:e.getUniformLocation(s,"modelViewMatrix"),projectionMatrix:e.getUniformLocation(s,"projectionMatrix"),fogType:e.getUniformLocation(s,"fogType"),fogDensity:e.getUniformLocation(s,"fogDensity"),fogNear:e.getUniformLocation(s,"fogNear"),fogFar:e.getUniformLocation(s,"fogFar"),fogColor:e.getUniformLocation(s,"fogColor"),fogDepth:e.getUniformLocation(s,"fogDepth"),alphaTest:e.getUniformLocation(s,"alphaTest")};var i=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");i.width=8,i.height=8;var h=i.getContext("2d");h.fillStyle="white",h.fillRect(0,0,8,8),u=new Vr(i)}function m(t,e){return t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:e.id-t.id}this.render=function(r,g,_){if(0!==r.length){void 0===s&&p(),n.useProgram(s),n.initAttributes(),n.enableAttribute(c.position),n.enableAttribute(c.uv),n.disableUnusedAttributes(),n.disable(e.CULL_FACE),n.enable(e.BLEND),e.bindBuffer(e.ARRAY_BUFFER,o),e.vertexAttribPointer(c.position,2,e.FLOAT,!1,16,0),e.vertexAttribPointer(c.uv,2,e.FLOAT,!1,16,8),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,a),e.uniformMatrix4fv(l.projectionMatrix,!1,_.projectionMatrix.elements),n.activeTexture(e.TEXTURE0),e.uniform1i(l.map,0);var v=0,b=0,y=g.fog;y?(e.uniform3f(l.fogColor,y.color.r,y.color.g,y.color.b),y.isFog?(e.uniform1f(l.fogNear,y.near),e.uniform1f(l.fogFar,y.far),e.uniform1i(l.fogType,1),v=1,b=1):y.isFogExp2&&(e.uniform1f(l.fogDensity,y.density),e.uniform1i(l.fogType,2),v=2,b=2)):(e.uniform1i(l.fogType,0),v=0,b=0);for(var x=0,w=r.length;x=1):-1!==U.indexOf("OpenGL ES")&&(j=parseFloat(/^OpenGL\ ES\ ([0-9])/.exec(U)[1]),D=j>=2);var F=null,H={},q=new on,G=new on;function W(e,n,i){var r=new Uint8Array(4),o=t.createTexture();t.bindTexture(e,o),t.texParameteri(e,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(e,t.TEXTURE_MAG_FILTER,t.NEAREST);for(var a=0;ae||t.height>e){if("data"in t)return void console.warn("THREE.WebGLRenderer: image in DataTexture is too big ("+t.width+"x"+t.height+").");var n=e/Math.max(t.width,t.height),i=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");return i.width=Math.floor(t.width*n),i.height=Math.floor(t.height*n),i.getContext("2d").drawImage(t,0,0,t.width,t.height,0,0,i.width,i.height),console.warn("THREE.WebGLRenderer: image is too big ("+t.width+"x"+t.height+"). Resized to "+i.width+"x"+i.height,t),i}return t}function h(t){return Ge.isPowerOfTwo(t.width)&&Ge.isPowerOfTwo(t.height)}function d(t,e){return t.generateMipmaps&&e&&t.minFilter!==Tt&&t.minFilter!==Lt}function f(e,n,r,o){t.generateMipmap(e),i.get(n).__maxMipLevel=Math.log2(Math.max(r,o))}function p(e){return e===Tt||e===kt||e===Pt?t.NEAREST:t.LINEAR}function m(e){var n=e.target;n.removeEventListener("dispose",m),function(e){var n=i.get(e);if(e.image&&n.__image__webglTextureCube)t.deleteTexture(n.__image__webglTextureCube);else{if(void 0===n.__webglInit)return;t.deleteTexture(n.__webglTexture)}i.remove(e)}(n),n.isVideoTexture&&delete l[n.id],a.memory.textures--}function g(e){var n=e.target;n.removeEventListener("dispose",g),function(e){var n=i.get(e),r=i.get(e.texture);if(!e)return;void 0!==r.__webglTexture&&t.deleteTexture(r.__webglTexture);e.depthTexture&&e.depthTexture.dispose();if(e.isWebGLRenderTargetCube)for(var o=0;o<6;o++)t.deleteFramebuffer(n.__webglFramebuffer[o]),n.__webglDepthbuffer&&t.deleteRenderbuffer(n.__webglDepthbuffer[o]);else t.deleteFramebuffer(n.__webglFramebuffer),n.__webglDepthbuffer&&t.deleteRenderbuffer(n.__webglDepthbuffer);i.remove(e.texture),i.remove(e)}(n),a.memory.textures--}function _(e,p){var g=i.get(e);if(e.isVideoTexture&&function(t){var e=t.id,n=a.render.frame;l[e]!==n&&(l[e]=n,t.update())}(e),e.version>0&&g.__version!==e.version){var _=e.image;if(void 0===_)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined",e);else{if(!1!==_.complete)return void function(e,i,l){void 0===e.__webglInit&&(e.__webglInit=!0,i.addEventListener("dispose",m),e.__webglTexture=t.createTexture(),a.memory.textures++);n.activeTexture(t.TEXTURE0+l),n.bindTexture(t.TEXTURE_2D,e.__webglTexture),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,i.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,i.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,i.unpackAlignment);var p=u(i.image,r.maxTextureSize);(function(t){return t.wrapS!==St||t.wrapT!==St||t.minFilter!==Tt&&t.minFilter!==Lt})(i)&&!1===h(p)&&(p=function(t){return t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof ImageBitmap?(void 0===s&&(s=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")),s.width=Ge.floorPowerOfTwo(t.width),s.height=Ge.floorPowerOfTwo(t.height),s.getContext("2d").drawImage(t,0,0,s.width,s.height),console.warn("THREE.WebGLRenderer: image is not power of two ("+t.width+"x"+t.height+"). Resized to "+s.width+"x"+s.height,t),s):t}(p));var g=h(p),_=o.convert(i.format),b=o.convert(i.type);v(t.TEXTURE_2D,i,g);var y,x=i.mipmaps;if(i.isDepthTexture){var w=t.DEPTH_COMPONENT;if(i.type===jt){if(!c)throw new Error("Float Depth Texture only supported in WebGL2.0");w=t.DEPTH_COMPONENT32F}else c&&(w=t.DEPTH_COMPONENT16);i.format===Jt&&w===t.DEPTH_COMPONENT&&i.type!==Bt&&i.type!==Dt&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),i.type=Bt,b=o.convert(i.type)),i.format===Qt&&(w=t.DEPTH_STENCIL,i.type!==Gt&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),i.type=Gt,b=o.convert(i.type))),n.texImage2D(t.TEXTURE_2D,0,w,p.width,p.height,0,_,b,null)}else if(i.isDataTexture)if(x.length>0&&g){for(var M=0,E=x.length;M-1?n.compressedTexImage2D(t.TEXTURE_2D,M,_,y.width,y.height,0,y.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):n.texImage2D(t.TEXTURE_2D,M,_,y.width,y.height,0,_,b,y.data);e.__maxMipLevel=x.length-1}else if(x.length>0&&g){for(var M=0,E=x.length;M1||i.get(a).__currentAnisotropy)&&(t.texParameterf(n,c.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,r.getMaxAnisotropy())),i.get(a).__currentAnisotropy=a.anisotropy)}}function b(e,r,a,s){var c=o.convert(r.texture.format),l=o.convert(r.texture.type);n.texImage2D(s,0,c,r.width,r.height,0,c,l,null),t.bindFramebuffer(t.FRAMEBUFFER,e),t.framebufferTexture2D(t.FRAMEBUFFER,a,s,i.get(r.texture).__webglTexture,0),t.bindFramebuffer(t.FRAMEBUFFER,null)}function y(e,n){t.bindRenderbuffer(t.RENDERBUFFER,e),n.depthBuffer&&!n.stencilBuffer?(t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_COMPONENT16,n.width,n.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.RENDERBUFFER,e)):n.depthBuffer&&n.stencilBuffer?(t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_STENCIL,n.width,n.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.RENDERBUFFER,e)):t.renderbufferStorage(t.RENDERBUFFER,t.RGBA4,n.width,n.height),t.bindRenderbuffer(t.RENDERBUFFER,null)}function x(e){var n=i.get(e),r=!0===e.isWebGLRenderTargetCube;if(e.depthTexture){if(r)throw new Error("target.depthTexture not supported in Cube render targets");!function(e,n){if(n&&n.isWebGLRenderTargetCube)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(t.FRAMEBUFFER,e),!n.depthTexture||!n.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");i.get(n.depthTexture).__webglTexture&&n.depthTexture.image.width===n.width&&n.depthTexture.image.height===n.height||(n.depthTexture.image.width=n.width,n.depthTexture.image.height=n.height,n.depthTexture.needsUpdate=!0),_(n.depthTexture,0);var r=i.get(n.depthTexture).__webglTexture;if(n.depthTexture.format===Jt)t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,r,0);else{if(n.depthTexture.format!==Qt)throw new Error("Unknown depthTexture format");t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.TEXTURE_2D,r,0)}}(n.__webglFramebuffer,e)}else if(r){n.__webglDepthbuffer=[];for(var o=0;o<6;o++)t.bindFramebuffer(t.FRAMEBUFFER,n.__webglFramebuffer[o]),n.__webglDepthbuffer[o]=t.createRenderbuffer(),y(n.__webglDepthbuffer[o],e)}else t.bindFramebuffer(t.FRAMEBUFFER,n.__webglFramebuffer),n.__webglDepthbuffer=t.createRenderbuffer(),y(n.__webglDepthbuffer,e);t.bindFramebuffer(t.FRAMEBUFFER,null)}this.setTexture2D=_,this.setTextureCube=function(e,s){var c=i.get(e);if(6===e.image.length)if(e.version>0&&c.__version!==e.version){c.__image__webglTextureCube||(e.addEventListener("dispose",m),c.__image__webglTextureCube=t.createTexture(),a.memory.textures++),n.activeTexture(t.TEXTURE0+s),n.bindTexture(t.TEXTURE_CUBE_MAP,c.__image__webglTextureCube),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,e.flipY);for(var l=e&&e.isCompressedTexture,p=e.image[0]&&e.image[0].isDataTexture,g=[],_=0;_<6;_++)g[_]=l||p?p?e.image[_].image:e.image[_]:u(e.image[_],r.maxCubemapSize);var b=g[0],y=h(b),x=o.convert(e.format),w=o.convert(e.type);for(v(t.TEXTURE_CUBE_MAP,e,y),_=0;_<6;_++)if(l)for(var M,E=g[_].mipmaps,S=0,A=E.length;S-1?n.compressedTexImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+_,S,x,M.width,M.height,0,M.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+_,S,x,M.width,M.height,0,x,w,M.data);else p?n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+_,0,x,g[_].width,g[_].height,0,x,w,g[_].data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+_,0,x,x,w,g[_]);c.__maxMipLevel=l?E.length-1:0,d(e,y)&&f(t.TEXTURE_CUBE_MAP,e,b.width,b.height),c.__version=e.version,e.onUpdate&&e.onUpdate(e)}else n.activeTexture(t.TEXTURE0+s),n.bindTexture(t.TEXTURE_CUBE_MAP,c.__image__webglTextureCube)},this.setTextureCubeDynamic=function(e,r){n.activeTexture(t.TEXTURE0+r),n.bindTexture(t.TEXTURE_CUBE_MAP,i.get(e).__webglTexture)},this.setupRenderTarget=function(e){var r=i.get(e),o=i.get(e.texture);e.addEventListener("dispose",g),o.__webglTexture=t.createTexture(),a.memory.textures++;var s=!0===e.isWebGLRenderTargetCube,c=h(e);if(s){r.__webglFramebuffer=[];for(var l=0;l<6;l++)r.__webglFramebuffer[l]=t.createFramebuffer()}else r.__webglFramebuffer=t.createFramebuffer();if(s){for(n.bindTexture(t.TEXTURE_CUBE_MAP,o.__webglTexture),v(t.TEXTURE_CUBE_MAP,e.texture,c),l=0;l<6;l++)b(r.__webglFramebuffer[l],e,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+l);d(e.texture,c)&&f(t.TEXTURE_CUBE_MAP,e.texture,e.width,e.height),n.bindTexture(t.TEXTURE_CUBE_MAP,null)}else n.bindTexture(t.TEXTURE_2D,o.__webglTexture),v(t.TEXTURE_2D,e.texture,c),b(r.__webglFramebuffer,e,t.COLOR_ATTACHMENT0,t.TEXTURE_2D),d(e.texture,c)&&f(t.TEXTURE_2D,e.texture,e.width,e.height),n.bindTexture(t.TEXTURE_2D,null);e.depthBuffer&&x(e)},this.updateRenderTargetMipmap=function(e){var r=e.texture;if(d(r,h(e))){var o=e.isWebGLRenderTargetCube?t.TEXTURE_CUBE_MAP:t.TEXTURE_2D,a=i.get(r).__webglTexture;n.bindTexture(o,a),f(o,r,e.width,e.height),n.bindTexture(o,null)}}}function Zr(t,e){return{convert:function(n){var i;if(n===Et)return t.REPEAT;if(n===St)return t.CLAMP_TO_EDGE;if(n===At)return t.MIRRORED_REPEAT;if(n===Tt)return t.NEAREST;if(n===kt)return t.NEAREST_MIPMAP_NEAREST;if(n===Pt)return t.NEAREST_MIPMAP_LINEAR;if(n===Lt)return t.LINEAR;if(n===Ot)return t.LINEAR_MIPMAP_NEAREST;if(n===Ct)return t.LINEAR_MIPMAP_LINEAR;if(n===Rt)return t.UNSIGNED_BYTE;if(n===Ft)return t.UNSIGNED_SHORT_4_4_4_4;if(n===Ht)return t.UNSIGNED_SHORT_5_5_5_1;if(n===qt)return t.UNSIGNED_SHORT_5_6_5;if(n===It)return t.BYTE;if(n===zt)return t.SHORT;if(n===Bt)return t.UNSIGNED_SHORT;if(n===Nt)return t.INT;if(n===Dt)return t.UNSIGNED_INT;if(n===jt)return t.FLOAT;if(n===Ut&&null!==(i=e.get("OES_texture_half_float")))return i.HALF_FLOAT_OES;if(n===Wt)return t.ALPHA;if(n===Vt)return t.RGB;if(n===Xt)return t.RGBA;if(n===Yt)return t.LUMINANCE;if(n===Kt)return t.LUMINANCE_ALPHA;if(n===Jt)return t.DEPTH_COMPONENT;if(n===Qt)return t.DEPTH_STENCIL;if(n===D)return t.FUNC_ADD;if(n===j)return t.FUNC_SUBTRACT;if(n===U)return t.FUNC_REVERSE_SUBTRACT;if(n===q)return t.ZERO;if(n===G)return t.ONE;if(n===W)return t.SRC_COLOR;if(n===V)return t.ONE_MINUS_SRC_COLOR;if(n===X)return t.SRC_ALPHA;if(n===Y)return t.ONE_MINUS_SRC_ALPHA;if(n===K)return t.DST_ALPHA;if(n===Z)return t.ONE_MINUS_DST_ALPHA;if(n===J)return t.DST_COLOR;if(n===Q)return t.ONE_MINUS_DST_COLOR;if(n===$)return t.SRC_ALPHA_SATURATE;if((n===$t||n===te||n===ee||n===ne)&&null!==(i=e.get("WEBGL_compressed_texture_s3tc"))){if(n===$t)return i.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===te)return i.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===ee)return i.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===ne)return i.COMPRESSED_RGBA_S3TC_DXT5_EXT}if((n===ie||n===re||n===oe||n===ae)&&null!==(i=e.get("WEBGL_compressed_texture_pvrtc"))){if(n===ie)return i.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===re)return i.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===oe)return i.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===ae)return i.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(n===se&&null!==(i=e.get("WEBGL_compressed_texture_etc1")))return i.COMPRESSED_RGB_ETC1_WEBGL;if((n===ce||n===le||n===ue||n===he||n===de||n===fe||n===pe||n===me||n===ge||n===_e||n===ve||n===be||n===ye||n===xe)&&null!==(i=e.get("WEBGL_compressed_texture_astc")))return n;if((n===F||n===H)&&null!==(i=e.get("EXT_blend_minmax"))){if(n===F)return i.MIN_EXT;if(n===H)return i.MAX_EXT}return n===Gt&&null!==(i=e.get("WEBGL_depth_texture"))?i.UNSIGNED_INT_24_8_WEBGL:0}}}function Jr(t,e,n,i){Ln.call(this),this.type="PerspectiveCamera",this.fov=void 0!==t?t:50,this.zoom=1,this.near=void 0!==n?n:.1,this.far=void 0!==i?i:2e3,this.focus=10,this.aspect=void 0!==e?e:1,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}function Qr(t){Jr.call(this),this.cameras=t||[]}function $r(t){var e=this,n=null,i=null,r=null,o=new Ve,a=new Ve;"undefined"!=typeof window&&"VRFrameData"in window&&(i=new window.VRFrameData);var s=new Ve,c=new Xe,l=new Ye,u=new Jr;u.bounds=new on(0,0,.5,1),u.layers.enable(1);var h=new Jr;h.bounds=new on(.5,0,.5,1),h.layers.enable(2);var d,f,p=new Qr([u,h]);function m(){if(null!==n&&n.isPresenting){var i=n.getEyeParameters("left"),r=i.renderWidth,o=i.renderHeight;f=t.getPixelRatio(),d=t.getSize(),t.setDrawingBufferSize(2*r,o,1)}else e.enabled&&t.setDrawingBufferSize(d.width,d.height,f)}p.layers.enable(1),p.layers.enable(2),"undefined"!=typeof window&&window.addEventListener("vrdisplaypresentchange",m,!1),this.enabled=!1,this.userHeight=1.6,this.getDevice=function(){return n},this.setDevice=function(t){void 0!==t&&(n=t)},this.setPoseTarget=function(t){void 0!==t&&(r=t)},this.getCamera=function(t){if(null===n)return t;n.depthNear=t.near,n.depthFar=t.far,n.getFrameData(i);var d=n.stageParameters;d?o.fromArray(d.sittingToStandingTransform):o.makeTranslation(0,e.userHeight,0);var f=i.pose,m=null!==r?r:t;if(m.matrix.copy(o),m.matrix.decompose(m.position,m.quaternion,m.scale),null!==f.orientation&&(c.fromArray(f.orientation),m.quaternion.multiply(c)),null!==f.position&&(c.setFromRotationMatrix(o),l.fromArray(f.position),l.applyQuaternion(c),m.position.add(l)),m.updateMatrixWorld(),!1===n.isPresenting)return t;u.near=t.near,h.near=t.near,u.far=t.far,h.far=t.far,p.matrixWorld.copy(t.matrixWorld),p.matrixWorldInverse.copy(t.matrixWorldInverse),u.matrixWorldInverse.fromArray(i.leftViewMatrix),h.matrixWorldInverse.fromArray(i.rightViewMatrix),a.getInverse(o),u.matrixWorldInverse.multiply(a),h.matrixWorldInverse.multiply(a);var g=m.parent;null!==g&&(s.getInverse(g.matrixWorld),u.matrixWorldInverse.multiply(s),h.matrixWorldInverse.multiply(s)),u.matrixWorld.getInverse(u.matrixWorldInverse),h.matrixWorld.getInverse(h.matrixWorldInverse),u.projectionMatrix.fromArray(i.leftProjectionMatrix),h.projectionMatrix.fromArray(i.rightProjectionMatrix),p.projectionMatrix.copy(u.projectionMatrix);var _=n.getLayers();if(_.length){var v=_[0];null!==v.leftBounds&&4===v.leftBounds.length&&u.bounds.fromArray(v.leftBounds),null!==v.rightBounds&&4===v.rightBounds.length&&h.bounds.fromArray(v.rightBounds)}return p},this.getStandingMatrix=function(){return o},this.submitFrame=function(){n&&n.isPresenting&&n.submitFrame()},this.dispose=function(){"undefined"!=typeof window&&window.removeEventListener("vrdisplaypresentchange",m)}}function to(t){console.log("THREE.WebGLRenderer",f);var e=void 0!==(t=t||{}).canvas?t.canvas:document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),n=void 0!==t.context?t.context:null,i=void 0!==t.alpha&&t.alpha,r=void 0===t.depth||t.depth,o=void 0===t.stencil||t.stencil,a=void 0!==t.antialias&&t.antialias,s=void 0===t.premultipliedAlpha||t.premultipliedAlpha,c=void 0!==t.preserveDrawingBuffer&&t.preserveDrawingBuffer,l=void 0!==t.powerPreference?t.powerPreference:"default",u=null,h=null;this.domElement=e,this.context=null,this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.gammaFactor=2,this.gammaInput=!1,this.gammaOutput=!1,this.physicallyCorrectLights=!1,this.toneMapping=dt,this.toneMappingExposure=1,this.toneMappingWhitePoint=1,this.maxMorphTargets=8,this.maxMorphNormals=4;var d,p,m,g,_,v,b,y,x,w,M,E,S,A,T,k,L,O,C,R=this,I=!1,z=null,B=null,N=-1,D="",j=null,U=null,F=new on,H=new on,q=null,G=0,W=e.width,V=e.height,X=1,Y=new on(0,0,W,V),K=new on(0,0,W,V),Z=!1,J=new dn,Q=new bi,$=!1,tt=!1,et=new Ve,nt=new Ye;function it(){return null===z?X:1}try{var rt={alpha:i,depth:r,stencil:o,antialias:a,premultipliedAlpha:s,preserveDrawingBuffer:c,powerPreference:l};if(e.addEventListener("webglcontextlost",ct,!1),e.addEventListener("webglcontextrestored",lt,!1),null===(d=n||e.getContext("webgl",rt)||e.getContext("experimental-webgl",rt)))throw null!==e.getContext("webgl")?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.");void 0===d.getShaderPrecisionFormat&&(d.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(t){console.error("THREE.WebGLRenderer: "+t.message)}function ot(){(p=new yi(d)).get("WEBGL_depth_texture"),p.get("OES_texture_float"),p.get("OES_texture_float_linear"),p.get("OES_texture_half_float"),p.get("OES_texture_half_float_linear"),p.get("OES_standard_derivatives"),p.get("OES_element_index_uint"),p.get("ANGLE_instanced_arrays"),C=new Zr(d,p),m=new vi(d,p,t),(g=new Yr(d,p,C)).scissor(H.copy(K).multiplyScalar(X)),g.viewport(F.copy(Y).multiplyScalar(X)),_=new Mi(d),v=new Sr,b=new Kr(d,p,g,v,m,C,_),y=new xn(d),x=new xi(d,y,_),w=new Ai(x,_),T=new Si(d),M=new Er(R,p,m),E=new Pr,S=new Hr,A=new gi(R,g,x,s),k=new _i(d,p,_),L=new wi(d,p,_),O=new Xr(R,d,g,b,m),_.programs=M.programs,R.context=d,R.capabilities=m,R.extensions=p,R.properties=v,R.renderLists=E,R.state=g,R.info=_}ot();var at=new $r(R);this.vr=at;var st=new Wr(R,w,m.maxTextureSize);function ct(t){t.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),I=!0}function lt(){console.log("THREE.WebGLRenderer: Context Restored."),I=!1,ot()}function ut(t){var e=t.target;e.removeEventListener("dispose",ut),function(t){ht(t),v.remove(t)}(e)}function ht(t){var e=v.get(t).program;t.program=void 0,void 0!==e&&M.releaseProgram(e)}this.shadowMap=st,this.getContext=function(){return d},this.getContextAttributes=function(){return d.getContextAttributes()},this.forceContextLoss=function(){var t=p.get("WEBGL_lose_context");t&&t.loseContext()},this.forceContextRestore=function(){var t=p.get("WEBGL_lose_context");t&&t.restoreContext()},this.getPixelRatio=function(){return X},this.setPixelRatio=function(t){void 0!==t&&(X=t,this.setSize(W,V,!1))},this.getSize=function(){return{width:W,height:V}},this.setSize=function(t,n,i){var r=at.getDevice();r&&r.isPresenting?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(W=t,V=n,e.width=t*X,e.height=n*X,!1!==i&&(e.style.width=t+"px",e.style.height=n+"px"),this.setViewport(0,0,t,n))},this.getDrawingBufferSize=function(){return{width:W*X,height:V*X}},this.setDrawingBufferSize=function(t,n,i){W=t,V=n,X=i,e.width=t*i,e.height=n*i,this.setViewport(0,0,t,n)},this.getCurrentViewport=function(){return F},this.setViewport=function(t,e,n,i){Y.set(t,V-e-i,n,i),g.viewport(F.copy(Y).multiplyScalar(X))},this.setScissor=function(t,e,n,i){K.set(t,V-e-i,n,i),g.scissor(H.copy(K).multiplyScalar(X))},this.setScissorTest=function(t){g.setScissorTest(Z=t)},this.getClearColor=function(){return A.getClearColor()},this.setClearColor=function(){A.setClearColor.apply(A,arguments)},this.getClearAlpha=function(){return A.getClearAlpha()},this.setClearAlpha=function(){A.setClearAlpha.apply(A,arguments)},this.clear=function(t,e,n){var i=0;(void 0===t||t)&&(i|=d.COLOR_BUFFER_BIT),(void 0===e||e)&&(i|=d.DEPTH_BUFFER_BIT),(void 0===n||n)&&(i|=d.STENCIL_BUFFER_BIT),d.clear(i)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.clearTarget=function(t,e,n,i){this.setRenderTarget(t),this.clear(e,n,i)},this.dispose=function(){e.removeEventListener("webglcontextlost",ct,!1),e.removeEventListener("webglcontextrestored",lt,!1),E.dispose(),S.dispose(),v.dispose(),w.dispose(),at.dispose(),gt()},this.renderBufferImmediate=function(t,e,n){g.initAttributes();var i=v.get(t);t.hasPositions&&!i.position&&(i.position=d.createBuffer()),t.hasNormals&&!i.normal&&(i.normal=d.createBuffer()),t.hasUvs&&!i.uv&&(i.uv=d.createBuffer()),t.hasColors&&!i.color&&(i.color=d.createBuffer());var r=e.getAttributes();if(t.hasPositions&&(d.bindBuffer(d.ARRAY_BUFFER,i.position),d.bufferData(d.ARRAY_BUFFER,t.positionArray,d.DYNAMIC_DRAW),g.enableAttribute(r.position),d.vertexAttribPointer(r.position,3,d.FLOAT,!1,0,0)),t.hasNormals){if(d.bindBuffer(d.ARRAY_BUFFER,i.normal),!n.isMeshPhongMaterial&&!n.isMeshStandardMaterial&&!n.isMeshNormalMaterial&&!0===n.flatShading)for(var o=0,a=3*t.count;o=0){var l=r[s];if(void 0!==l){var u=l.normalized,h=l.itemSize,f=y.get(l);if(void 0===f)continue;var m=f.buffer,_=f.type,v=f.bytesPerElement;if(l.isInterleavedBufferAttribute){var b=l.data,x=b.stride,w=l.offset;b&&b.isInstancedInterleavedBuffer?(g.enableAttributeAndDivisor(c,b.meshPerAttribute),void 0===n.maxInstancedCount&&(n.maxInstancedCount=b.meshPerAttribute*b.count)):g.enableAttribute(c),d.bindBuffer(d.ARRAY_BUFFER,m),d.vertexAttribPointer(c,h,_,u,x*v,(i*x+w)*v)}else l.isInstancedBufferAttribute?(g.enableAttributeAndDivisor(c,l.meshPerAttribute),void 0===n.maxInstancedCount&&(n.maxInstancedCount=l.meshPerAttribute*l.count)):g.enableAttribute(c),d.bindBuffer(d.ARRAY_BUFFER,m),d.vertexAttribPointer(c,h,_,u,0,i*h*v)}else if(void 0!==a){var M=a[s];if(void 0!==M)switch(M.length){case 2:d.vertexAttrib2fv(c,M);break;case 3:d.vertexAttrib3fv(c,M);break;case 4:d.vertexAttrib4fv(c,M);break;default:d.vertexAttrib1fv(c,M)}}}}g.disableUnusedAttributes()}(i,s,n),null!==h&&d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,u.buffer));var v=1/0;null!==h?v=h.count:void 0!==f&&(v=f.count);var b=n.drawRange.start*m,w=n.drawRange.count*m,M=null!==o?o.start*m:0,E=null!==o?o.count*m:1/0,S=Math.max(b,M),A=Math.min(v,b+w,M+E)-1,P=Math.max(0,A-S+1);if(0!==P){if(r.isMesh)if(!0===i.wireframe)g.setLineWidth(i.wireframeLinewidth*it()),_.setMode(d.LINES);else switch(r.drawMode){case Oe:_.setMode(d.TRIANGLES);break;case Ce:_.setMode(d.TRIANGLE_STRIP);break;case Re:_.setMode(d.TRIANGLE_FAN)}else if(r.isLine){var O=i.linewidth;void 0===O&&(O=1),g.setLineWidth(O*it()),r.isLineSegments?_.setMode(d.LINES):r.isLineLoop?_.setMode(d.LINE_LOOP):_.setMode(d.LINE_STRIP)}else r.isPoints&&_.setMode(d.POINTS);n&&n.isInstancedBufferGeometry?n.maxInstancedCount>0&&_.renderInstances(n,S,P):_.render(S,P)}},this.compile=function(t,e){(h=S.get(t,e)).init(),t.traverse(function(t){t.isLight&&(h.pushLight(t),t.castShadow&&h.pushShadow(t))}),h.setupLights(e),t.traverse(function(e){if(e.material)if(Array.isArray(e.material))for(var n=0;n=0&&t.numSupportedMorphTargets++}if(t.morphNormals){t.numSupportedMorphNormals=0;for(f=0;f=0&&t.numSupportedMorphNormals++}var p=i.shader.uniforms;(t.isShaderMaterial||t.isRawShaderMaterial)&&!0!==t.clipping||(i.numClippingPlanes=Q.numPlanes,i.numIntersection=Q.numIntersection,p.clippingPlanes=Q.uniform),i.fog=e,i.lightsHash=r.state.hash,t.lights&&(p.ambientLightColor.value=r.state.ambient,p.directionalLights.value=r.state.directional,p.spotLights.value=r.state.spot,p.rectAreaLights.value=r.state.rectArea,p.pointLights.value=r.state.point,p.hemisphereLights.value=r.state.hemi,p.directionalShadowMap.value=r.state.directionalShadowMap,p.directionalShadowMatrix.value=r.state.directionalShadowMatrix,p.spotShadowMap.value=r.state.spotShadowMap,p.spotShadowMatrix.value=r.state.spotShadowMatrix,p.pointShadowMap.value=r.state.pointShadowMap,p.pointShadowMatrix.value=r.state.pointShadowMatrix);var m=i.program.getUniforms(),g=dr.seqWithValue(m.seq,p);i.uniformsList=g}function wt(t,e,n,i){G=0;var r=v.get(n),o=h.state.lights;if($&&(tt||t!==j)){var a=t===j&&n.id===N;Q.setState(n.clippingPlanes,n.clipIntersection,n.clipShadows,t,r,a)}!1===n.needsUpdate&&(void 0===r.program?n.needsUpdate=!0:n.fog&&r.fog!==e?n.needsUpdate=!0:n.lights&&r.lightsHash!==o.state.hash?n.needsUpdate=!0:void 0===r.numClippingPlanes||r.numClippingPlanes===Q.numPlanes&&r.numIntersection===Q.numIntersection||(n.needsUpdate=!0)),n.needsUpdate&&(xt(n,e,i),n.needsUpdate=!1);var s,c,l=!1,u=!1,f=!1,p=r.program,_=p.getUniforms(),b=r.shader.uniforms;if(g.useProgram(p.program)&&(l=!0,u=!0,f=!0),n.id!==N&&(N=n.id,u=!0),l||t!==j){if(_.setValue(d,"projectionMatrix",t.projectionMatrix),m.logarithmicDepthBuffer&&_.setValue(d,"logDepthBufFC",2/(Math.log(t.far+1)/Math.LN2)),j!==(U||t)&&(j=U||t,u=!0,f=!0),n.isShaderMaterial||n.isMeshPhongMaterial||n.isMeshStandardMaterial||n.envMap){var y=_.map.cameraPosition;void 0!==y&&y.setValue(d,nt.setFromMatrixPosition(t.matrixWorld))}(n.isMeshPhongMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial||n.skinning)&&_.setValue(d,"viewMatrix",t.matrixWorldInverse)}if(n.skinning){_.setOptional(d,i,"bindMatrix"),_.setOptional(d,i,"bindMatrixInverse");var x=i.skeleton;if(x){var w=x.bones;if(m.floatVertexTextures){if(void 0===x.boneTexture){var M=Math.sqrt(4*w.length);M=Ge.ceilPowerOfTwo(M),M=Math.max(M,4);var E=new Float32Array(M*M*4);E.set(x.boneMatrices);var S=new cn(E,M,M,Xt,jt);S.needsUpdate=!0,x.boneMatrices=E,x.boneTexture=S,x.boneTextureSize=M}_.setValue(d,"boneTexture",x.boneTexture),_.setValue(d,"boneTextureSize",x.boneTextureSize)}else _.setOptional(d,x,"boneMatrices")}}return u&&(_.setValue(d,"toneMappingExposure",R.toneMappingExposure),_.setValue(d,"toneMappingWhitePoint",R.toneMappingWhitePoint),n.lights&&(c=f,(s=b).ambientLightColor.needsUpdate=c,s.directionalLights.needsUpdate=c,s.pointLights.needsUpdate=c,s.spotLights.needsUpdate=c,s.rectAreaLights.needsUpdate=c,s.hemisphereLights.needsUpdate=c),e&&n.fog&&function(t,e){t.fogColor.value=e.color,e.isFog?(t.fogNear.value=e.near,t.fogFar.value=e.far):e.isFogExp2&&(t.fogDensity.value=e.density)}(b,e),n.isMeshBasicMaterial?Mt(b,n):n.isMeshLambertMaterial?(Mt(b,n),function(t,e){e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap)}(b,n)):n.isMeshPhongMaterial?(Mt(b,n),n.isMeshToonMaterial?function(t,e){Et(t,e),e.gradientMap&&(t.gradientMap.value=e.gradientMap)}(b,n):Et(b,n)):n.isMeshStandardMaterial?(Mt(b,n),n.isMeshPhysicalMaterial?function(t,e){t.clearCoat.value=e.clearCoat,t.clearCoatRoughness.value=e.clearCoatRoughness,St(t,e)}(b,n):St(b,n)):n.isMeshDepthMaterial?(Mt(b,n),function(t,e){e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(b,n)):n.isMeshDistanceMaterial?(Mt(b,n),function(t,e){e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias);t.referencePosition.value.copy(e.referencePosition),t.nearDistance.value=e.nearDistance,t.farDistance.value=e.farDistance}(b,n)):n.isMeshNormalMaterial?(Mt(b,n),function(t,e){e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale);e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale));e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(b,n)):n.isLineBasicMaterial?(function(t,e){t.diffuse.value=e.color,t.opacity.value=e.opacity}(b,n),n.isLineDashedMaterial&&function(t,e){t.dashSize.value=e.dashSize,t.totalSize.value=e.dashSize+e.gapSize,t.scale.value=e.scale}(b,n)):n.isPointsMaterial?function(t,e){if(t.diffuse.value=e.color,t.opacity.value=e.opacity,t.size.value=e.size*X,t.scale.value=.5*V,t.map.value=e.map,null!==e.map){if(!0===e.map.matrixAutoUpdate){var n=e.map.offset,i=e.map.repeat,r=e.map.rotation,o=e.map.center;e.map.matrix.setUvTransform(n.x,n.y,i.x,i.y,r,o.x,o.y)}t.uvTransform.value.copy(e.map.matrix)}}(b,n):n.isShadowMaterial&&(b.color.value=n.color,b.opacity.value=n.opacity),void 0!==b.ltc_1&&(b.ltc_1.value=bn.LTC_1),void 0!==b.ltc_2&&(b.ltc_2.value=bn.LTC_2),dr.upload(d,r.uniformsList,b,R)),n.isShaderMaterial&&!0===n.uniformsNeedUpdate&&(dr.upload(d,r.uniformsList,b,R),n.uniformsNeedUpdate=!1),_.setValue(d,"modelViewMatrix",i.modelViewMatrix),_.setValue(d,"normalMatrix",i.normalMatrix),_.setValue(d,"modelMatrix",i.matrixWorld),p}function Mt(t,e){var n;if(t.opacity.value=e.opacity,e.color&&(t.diffuse.value=e.color),e.emissive&&t.emissive.value.copy(e.emissive).multiplyScalar(e.emissiveIntensity),e.map&&(t.map.value=e.map),e.alphaMap&&(t.alphaMap.value=e.alphaMap),e.specularMap&&(t.specularMap.value=e.specularMap),e.envMap&&(t.envMap.value=e.envMap,t.flipEnvMap.value=e.envMap&&e.envMap.isCubeTexture?-1:1,t.reflectivity.value=e.reflectivity,t.refractionRatio.value=e.refractionRatio,t.maxMipLevel.value=v.get(e.envMap).__maxMipLevel),e.lightMap&&(t.lightMap.value=e.lightMap,t.lightMapIntensity.value=e.lightMapIntensity),e.aoMap&&(t.aoMap.value=e.aoMap,t.aoMapIntensity.value=e.aoMapIntensity),e.map?n=e.map:e.specularMap?n=e.specularMap:e.displacementMap?n=e.displacementMap:e.normalMap?n=e.normalMap:e.bumpMap?n=e.bumpMap:e.roughnessMap?n=e.roughnessMap:e.metalnessMap?n=e.metalnessMap:e.alphaMap?n=e.alphaMap:e.emissiveMap&&(n=e.emissiveMap),void 0!==n){if(n.isWebGLRenderTarget&&(n=n.texture),!0===n.matrixAutoUpdate){var i=n.offset,r=n.repeat,o=n.rotation,a=n.center;n.matrix.setUvTransform(i.x,i.y,r.x,r.y,o,a.x,a.y)}t.uvTransform.value.copy(n.matrix)}}function Et(t,e){t.specular.value=e.specular,t.shininess.value=Math.max(e.shininess,1e-4),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale)),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}function St(t,e){t.roughness.value=e.roughness,t.metalness.value=e.metalness,e.roughnessMap&&(t.roughnessMap.value=e.roughnessMap),e.metalnessMap&&(t.metalnessMap.value=e.metalnessMap),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale)),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias),e.envMap&&(t.envMapIntensity.value=e.envMapIntensity)}this.animate=function(t){null!==(mt=t)?pt||(_t(),pt=!0):gt()},this.render=function(t,e,n,i){if(e&&e.isCamera){if(!I){D="",N=-1,j=null,!0===t.autoUpdate&&t.updateMatrixWorld(),null===e.parent&&e.updateMatrixWorld(),at.enabled&&(e=at.getCamera(e)),(h=S.get(t,e)).init(),t.onBeforeRender(R,t,e,n),et.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),J.setFromMatrix(et),tt=this.localClippingEnabled,$=Q.init(this.clippingPlanes,tt,e),(u=E.get(t,e)).init(),function t(e,n,i){if(!1===e.visible)return;var r=e.layers.test(n.layers);if(r)if(e.isLight)h.pushLight(e),e.castShadow&&h.pushShadow(e);else if(e.isSprite)e.frustumCulled&&!J.intersectsSprite(e)||h.pushSprite(e);else if(e.isImmediateRenderObject)i&&nt.setFromMatrixPosition(e.matrixWorld).applyMatrix4(et),u.push(e,null,e.material,nt.z,null);else if((e.isMesh||e.isLine||e.isPoints)&&(e.isSkinnedMesh&&e.skeleton.update(),!e.frustumCulled||J.intersectsObject(e))){i&&nt.setFromMatrixPosition(e.matrixWorld).applyMatrix4(et);var o=w.update(e),a=e.material;if(Array.isArray(a))for(var s=o.groups,c=0,l=s.length;c=m.maxTextures&&console.warn("THREE.WebGLRenderer: Trying to use "+t+" texture units while this GPU supports only "+m.maxTextures),G+=1,t},this.setTexture2D=(ft=!1,function(t,e){t&&t.isWebGLRenderTarget&&(ft||(console.warn("THREE.WebGLRenderer.setTexture2D: don't use render targets as textures. Use their .texture property instead."),ft=!0),t=t.texture),b.setTexture2D(t,e)}),this.setTexture=function(){var t=!1;return function(e,n){t||(console.warn("THREE.WebGLRenderer: .setTexture is deprecated, use setTexture2D instead."),t=!0),b.setTexture2D(e,n)}}(),this.setTextureCube=function(){var t=!1;return function(e,n){e&&e.isWebGLRenderTargetCube&&(t||(console.warn("THREE.WebGLRenderer.setTextureCube: don't use cube render targets as textures. Use their .texture property instead."),t=!0),e=e.texture),e&&e.isCubeTexture||Array.isArray(e.image)&&6===e.image.length?b.setTextureCube(e,n):b.setTextureCubeDynamic(e,n)}}(),this.getRenderTarget=function(){return z},this.setRenderTarget=function(t){z=t,t&&void 0===v.get(t).__webglFramebuffer&&b.setupRenderTarget(t);var e=null,n=!1;if(t){var i=v.get(t).__webglFramebuffer;t.isWebGLRenderTargetCube?(e=i[t.activeCubeFace],n=!0):e=i,F.copy(t.viewport),H.copy(t.scissor),q=t.scissorTest}else F.copy(Y).multiplyScalar(X),H.copy(K).multiplyScalar(X),q=Z;if(B!==e&&(d.bindFramebuffer(d.FRAMEBUFFER,e),B=e),g.viewport(F),g.scissor(H),g.setScissorTest(q),n){var r=v.get(t.texture);d.framebufferTexture2D(d.FRAMEBUFFER,d.COLOR_ATTACHMENT0,d.TEXTURE_CUBE_MAP_POSITIVE_X+t.activeCubeFace,r.__webglTexture,t.activeMipMapLevel)}},this.readRenderTargetPixels=function(t,e,n,i,r,o){if(t&&t.isWebGLRenderTarget){var a=v.get(t).__webglFramebuffer;if(a){var s=!1;a!==B&&(d.bindFramebuffer(d.FRAMEBUFFER,a),s=!0);try{var c=t.texture,l=c.format,u=c.type;if(l!==Xt&&C.convert(l)!==d.getParameter(d.IMPLEMENTATION_COLOR_READ_FORMAT))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!(u===Rt||C.convert(u)===d.getParameter(d.IMPLEMENTATION_COLOR_READ_TYPE)||u===jt&&(p.get("OES_texture_float")||p.get("WEBGL_color_buffer_float"))||u===Ut&&p.get("EXT_color_buffer_half_float")))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");d.checkFramebufferStatus(d.FRAMEBUFFER)===d.FRAMEBUFFER_COMPLETE?e>=0&&e<=t.width-i&&n>=0&&n<=t.height-r&&d.readPixels(e,n,i,r,C.convert(l),C.convert(u),o):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{s&&d.bindFramebuffer(d.FRAMEBUFFER,B)}}}else console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.")},this.copyFramebufferToTexture=function(t,e,n){var i=e.image.width,r=e.image.height,o=C.convert(e.format);this.setTexture2D(e,0),d.copyTexImage2D(d.TEXTURE_2D,n||0,o,t.x,t.y,i,r,0)},this.copyTextureToTexture=function(t,e,n,i){var r=e.image.width,o=e.image.height,a=C.convert(n.format),s=C.convert(n.type),c=e.isDataTexture?e.image.data:e.image;this.setTexture2D(n,0),d.texSubImage2D(d.TEXTURE_2D,i||0,t.x,t.y,r,o,a,s,c)}}function eo(t,e){this.name="",this.color=new _n(t),this.density=void 0!==e?e:25e-5}function no(t,e,n){this.name="",this.color=new _n(t),this.near=void 0!==e?e:1,this.far=void 0!==n?n:1e3}function io(){Pn.call(this),this.type="Scene",this.background=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0}function ro(t){li.call(this),this.type="SpriteMaterial",this.color=new _n(16777215),this.map=null,this.rotation=0,this.fog=!1,this.lights=!1,this.setValues(t)}function oo(t){Pn.call(this),this.type="Sprite",this.material=void 0!==t?t:new ro,this.center=new We(.5,.5)}function ao(){Pn.call(this),this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}})}function so(t,e){if(t=t||[],this.bones=t.slice(0),this.boneMatrices=new Float32Array(16*this.bones.length),void 0===e)this.calculateInverses();else if(this.bones.length===e.length)this.boneInverses=e.slice(0);else{console.warn("THREE.Skeleton boneInverses is the wrong length."),this.boneInverses=[];for(var n=0,i=this.bones.length;n=0?(t(g-1e-5,m,h),d.subVectors(u,h)):(t(g+1e-5,m,h),d.subVectors(h,u)),m-1e-5>=0?(t(g,m-1e-5,h),f.subVectors(u,h)):(t(g,m+1e-5,h),f.subVectors(h,u)),l.crossVectors(d,f).normalize(),s.push(l.x,l.y,l.z),c.push(g,m)}}for(i=0;i.9&&a<.1&&(e<.2&&(o[t+0]+=1),n<.2&&(o[t+2]+=1),i<.2&&(o[t+4]+=1))}}()}(),this.addAttribute("position",new Wn(r,3)),this.addAttribute("normal",new Wn(r.slice(),3)),this.addAttribute("uv",new Wn(o,2)),0===i?this.computeVertexNormals():this.normalizeNormals()}function Ao(t,e){Bn.call(this),this.type="TetrahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new To(t,e)),this.mergeVertices()}function To(t,e){So.call(this,[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],t,e),this.type="TetrahedronBufferGeometry",this.parameters={radius:t,detail:e}}function ko(t,e){Bn.call(this),this.type="OctahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new Po(t,e)),this.mergeVertices()}function Po(t,e){So.call(this,[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],t,e),this.type="OctahedronBufferGeometry",this.parameters={radius:t,detail:e}}function Lo(t,e){Bn.call(this),this.type="IcosahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new Oo(t,e)),this.mergeVertices()}function Oo(t,e){var n=(1+Math.sqrt(5))/2,i=[-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1];So.call(this,i,[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],t,e),this.type="IcosahedronBufferGeometry",this.parameters={radius:t,detail:e}}function Co(t,e){Bn.call(this),this.type="DodecahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new Ro(t,e)),this.mergeVertices()}function Ro(t,e){var n=(1+Math.sqrt(5))/2,i=1/n,r=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-i,-n,0,-i,n,0,i,-n,0,i,n,-i,-n,0,-i,n,0,i,-n,0,i,n,0,-n,0,-i,n,0,-i,-n,0,i,n,0,i];So.call(this,r,[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],t,e),this.type="DodecahedronBufferGeometry",this.parameters={radius:t,detail:e}}function Io(t,e,n,i,r,o){Bn.call(this),this.type="TubeGeometry",this.parameters={path:t,tubularSegments:e,radius:n,radialSegments:i,closed:r},void 0!==o&&console.warn("THREE.TubeGeometry: taper has been removed.");var a=new zo(t,e,n,i,r);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals,this.fromBufferGeometry(a),this.mergeVertices()}function zo(t,e,n,i,r){Zn.call(this),this.type="TubeBufferGeometry",this.parameters={path:t,tubularSegments:e,radius:n,radialSegments:i,closed:r},e=e||64,n=n||1,i=i||8,r=r||!1;var o=t.computeFrenetFrames(e,r);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals;var a,s,c=new Ye,l=new Ye,u=new We,h=new Ye,d=[],f=[],p=[],m=[];function g(r){h=t.getPointAt(r/e,h);var a=o.normals[r],u=o.binormals[r];for(s=0;s<=i;s++){var p=s/i*Math.PI*2,m=Math.sin(p),g=-Math.cos(p);l.x=g*a.x+m*u.x,l.y=g*a.y+m*u.y,l.z=g*a.z+m*u.z,l.normalize(),f.push(l.x,l.y,l.z),c.x=h.x+n*l.x,c.y=h.y+n*l.y,c.z=h.z+n*l.z,d.push(c.x,c.y,c.z)}}!function(){for(a=0;an)){var i=t.ray.origin.distanceTo(Or);it.far||e.push({distance:i,point:Or.clone(),face:null,object:this})}}),clone:function(){return new this.constructor(this.material).copy(this)},copy:function(t){return Pn.prototype.copy.call(this,t),void 0!==t.center&&this.center.copy(t.center),this}}),ao.prototype=Object.assign(Object.create(Pn.prototype),{constructor:ao,copy:function(t){Pn.prototype.copy.call(this,t,!1);for(var e=t.levels,n=0,i=e.length;n1){t.setFromMatrixPosition(n.matrixWorld),e.setFromMatrixPosition(this.matrixWorld);var r=t.distanceTo(e);i[0].object.visible=!0;for(var o=1,a=i.length;o=i[o].distance;o++)i[o-1].object.visible=!1,i[o].object.visible=!0;for(;oa))d.applyMatrix4(this.matrixWorld),(M=i.ray.origin.distanceTo(d))i.far||r.push({distance:M,point:h.clone().applyMatrix4(this.matrixWorld),index:_,face:null,faceIndex:null,object:this})}else for(_=0,v=m.length/3-1;_a))d.applyMatrix4(this.matrixWorld),(M=i.ray.origin.distanceTo(d))i.far||r.push({distance:M,point:h.clone().applyMatrix4(this.matrixWorld),index:_,face:null,faceIndex:null,object:this})}}else if(s.isGeometry){var x=s.vertices,w=x.length;for(_=0;_a))d.applyMatrix4(this.matrixWorld),(M=i.ray.origin.distanceTo(d))i.far||r.push({distance:M,point:h.clone().applyMatrix4(this.matrixWorld),index:_,face:null,faceIndex:null,object:this})}}}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),fo.prototype=Object.assign(Object.create(ho.prototype),{constructor:fo,isLineSegments:!0,computeLineDistances:function(){var t=new Ye,e=new Ye;return function(){var n=this.geometry;if(n.isBufferGeometry)if(null===n.index){for(var i=n.attributes.position,r=[],o=0,a=i.count;oi.far)return;r.push({distance:c,distanceToRay:Math.sqrt(a),point:d.clone(),index:n,face:null,object:o})}}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),_o.prototype=Object.assign(Object.create(Pn.prototype),{constructor:_o,isGroup:!0}),vo.prototype=Object.assign(Object.create(rn.prototype),{constructor:vo,isVideoTexture:!0,update:function(){var t=this.image;t.readyState>=t.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}),bo.prototype=Object.create(rn.prototype),bo.prototype.constructor=bo,bo.prototype.isCompressedTexture=!0,yo.prototype=Object.create(rn.prototype),yo.prototype.constructor=yo,yo.prototype.isDepthTexture=!0,xo.prototype=Object.create(Zn.prototype),xo.prototype.constructor=xo,wo.prototype=Object.create(Bn.prototype),wo.prototype.constructor=wo,Mo.prototype=Object.create(Zn.prototype),Mo.prototype.constructor=Mo,Eo.prototype=Object.create(Bn.prototype),Eo.prototype.constructor=Eo,So.prototype=Object.create(Zn.prototype),So.prototype.constructor=So,Ao.prototype=Object.create(Bn.prototype),Ao.prototype.constructor=Ao,To.prototype=Object.create(So.prototype),To.prototype.constructor=To,ko.prototype=Object.create(Bn.prototype),ko.prototype.constructor=ko,Po.prototype=Object.create(So.prototype),Po.prototype.constructor=Po,Lo.prototype=Object.create(Bn.prototype),Lo.prototype.constructor=Lo,Oo.prototype=Object.create(So.prototype),Oo.prototype.constructor=Oo,Co.prototype=Object.create(Bn.prototype),Co.prototype.constructor=Co,Ro.prototype=Object.create(So.prototype),Ro.prototype.constructor=Ro,Io.prototype=Object.create(Bn.prototype),Io.prototype.constructor=Io,zo.prototype=Object.create(Zn.prototype),zo.prototype.constructor=zo,Bo.prototype=Object.create(Bn.prototype),Bo.prototype.constructor=Bo,No.prototype=Object.create(Zn.prototype),No.prototype.constructor=No,Do.prototype=Object.create(Bn.prototype),Do.prototype.constructor=Do,jo.prototype=Object.create(Zn.prototype),jo.prototype.constructor=jo;var Uo=function(t,e,n){n=n||2;var i,r,o,a,s,c,l,u=e&&e.length,h=u?e[0]*n:t.length,d=Fo(t,0,h,n,!0),f=[];if(!d)return f;if(u&&(d=function(t,e,n,i){var r,o,a,s,c,l=[];for(r=0,o=e.length;r80*n){i=o=t[0],r=a=t[1];for(var p=n;po&&(o=s),c>a&&(a=c);l=0!==(l=Math.max(o-i,a-r))?1/l:0}return qo(d,f,n,i,r,l),f};function Fo(t,e,n,i,r){var o,a;if(r===function(t,e,n,i){for(var r=0,o=e,a=n-i;o0)for(o=e;o=e;o-=i)a=oa(o,t[o],t[o+1],a);return a&&ea(a,a.next)&&(aa(a),a=a.next),a}function Ho(t,e){if(!t)return t;e||(e=t);var n,i=t;do{if(n=!1,i.steiner||!ea(i,i.next)&&0!==ta(i.prev,i,i.next))i=i.next;else{if(aa(i),(i=e=i.prev)===i.next)break;n=!0}}while(n||i!==e);return e}function qo(t,e,n,i,r,o,a){if(t){!a&&o&&function(t,e,n,i){var r=t;do{null===r.z&&(r.z=Zo(r.x,r.y,e,n,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,function(t){var e,n,i,r,o,a,s,c,l=1;do{for(n=t,t=null,o=null,a=0;n;){for(a++,i=n,s=0,e=0;e0||c>0&&i;)0!==s&&(0===c||!i||n.z<=i.z)?(r=n,n=n.nextZ,s--):(r=i,i=i.nextZ,c--),o?o.nextZ=r:t=r,r.prevZ=o,o=r;n=i}o.nextZ=null,l*=2}while(a>1)}(r)}(t,i,r,o);for(var s,c,l=t;t.prev!==t.next;)if(s=t.prev,c=t.next,o?Wo(t,i,r,o):Go(t))e.push(s.i/n),e.push(t.i/n),e.push(c.i/n),aa(t),t=c.next,l=c.next;else if((t=c)===l){a?1===a?qo(t=Vo(t,e,n),e,n,i,r,o,2):2===a&&Xo(t,e,n,i,r,o):qo(Ho(t),e,n,i,r,o,1);break}}}function Go(t){var e=t.prev,n=t,i=t.next;if(ta(e,n,i)>=0)return!1;for(var r=t.next.next;r!==t.prev;){if(Qo(e.x,e.y,n.x,n.y,i.x,i.y,r.x,r.y)&&ta(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function Wo(t,e,n,i){var r=t.prev,o=t,a=t.next;if(ta(r,o,a)>=0)return!1;for(var s=r.xo.x?r.x>a.x?r.x:a.x:o.x>a.x?o.x:a.x,u=r.y>o.y?r.y>a.y?r.y:a.y:o.y>a.y?o.y:a.y,h=Zo(s,c,e,n,i),d=Zo(l,u,e,n,i),f=t.nextZ;f&&f.z<=d;){if(f!==t.prev&&f!==t.next&&Qo(r.x,r.y,o.x,o.y,a.x,a.y,f.x,f.y)&&ta(f.prev,f,f.next)>=0)return!1;f=f.nextZ}for(f=t.prevZ;f&&f.z>=h;){if(f!==t.prev&&f!==t.next&&Qo(r.x,r.y,o.x,o.y,a.x,a.y,f.x,f.y)&&ta(f.prev,f,f.next)>=0)return!1;f=f.prevZ}return!0}function Vo(t,e,n){var i=t;do{var r=i.prev,o=i.next.next;!ea(r,o)&&na(r,i,i.next,o)&&ia(r,o)&&ia(o,r)&&(e.push(r.i/n),e.push(i.i/n),e.push(o.i/n),aa(i),aa(i.next),i=t=o),i=i.next}while(i!==t);return i}function Xo(t,e,n,i,r,o){var a=t;do{for(var s=a.next.next;s!==a.prev;){if(a.i!==s.i&&$o(a,s)){var c=ra(a,s);return a=Ho(a,a.next),c=Ho(c,c.next),qo(a,e,n,i,r,o),void qo(c,e,n,i,r,o)}s=s.next}a=a.next}while(a!==t)}function Yo(t,e){return t.x-e.x}function Ko(t,e){if(e=function(t,e){var n,i=e,r=t.x,o=t.y,a=-1/0;do{if(o<=i.y&&o>=i.next.y&&i.next.y!==i.y){var s=i.x+(o-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(s<=r&&s>a){if(a=s,s===r){if(o===i.y)return i;if(o===i.next.y)return i.next}n=i.x=i.x&&i.x>=u&&r!==i.x&&Qo(on.x)&&ia(i,t)&&(n=i,d=c),i=i.next;return n}(t,e)){var n=ra(e,t);Ho(n,n.next)}}function Zo(t,e,n,i,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-n)*r)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-i)*r)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Jo(t){var e=t,n=t;do{e.x=0&&(t-a)*(i-s)-(n-a)*(e-s)>=0&&(n-a)*(o-s)-(r-a)*(i-s)>=0}function $o(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&na(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}(t,e)&&ia(t,e)&&ia(e,t)&&function(t,e){var n=t,i=!1,r=(t.x+e.x)/2,o=(t.y+e.y)/2;do{n.y>o!=n.next.y>o&&n.next.y!==n.y&&r<(n.next.x-n.x)*(o-n.y)/(n.next.y-n.y)+n.x&&(i=!i),n=n.next}while(n!==t);return i}(t,e)}function ta(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function ea(t,e){return t.x===e.x&&t.y===e.y}function na(t,e,n,i){return!!(ea(t,e)&&ea(n,i)||ea(t,i)&&ea(n,e))||ta(t,e,n)>0!=ta(t,e,i)>0&&ta(n,i,t)>0!=ta(n,i,e)>0}function ia(t,e){return ta(t.prev,t,t.next)<0?ta(t,e,t.next)>=0&&ta(t,t.prev,e)>=0:ta(t,e,t.prev)<0||ta(t,t.next,e)<0}function ra(t,e){var n=new sa(t.i,t.x,t.y),i=new sa(e.i,e.x,e.y),r=t.next,o=e.prev;return t.next=e,e.prev=t,n.next=r,r.prev=n,i.next=n,n.prev=i,o.next=i,i.prev=o,i}function oa(t,e,n,i){var r=new sa(t,e,n);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function aa(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function sa(t,e,n){this.i=t,this.x=e,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}var ca={area:function(t){for(var e=t.length,n=0,i=e-1,r=0;r2&&t[e-1].equals(t[0])&&t.pop()}function ua(t,e){for(var n=0;n0)&&p.push(x,w,E),(c!==n-1||l0&&_(!0),e>0&&_(!1)),this.setIndex(l),this.addAttribute("position",new Wn(u,3)),this.addAttribute("normal",new Wn(h,3)),this.addAttribute("uv",new Wn(d,2))}function Ta(t,e,n,i,r,o,a){Sa.call(this,0,t,e,n,i,r,o,a),this.type="ConeGeometry",this.parameters={radius:t,height:e,radialSegments:n,heightSegments:i,openEnded:r,thetaStart:o,thetaLength:a}}function ka(t,e,n,i,r,o,a){Aa.call(this,0,t,e,n,i,r,o,a),this.type="ConeBufferGeometry",this.parameters={radius:t,height:e,radialSegments:n,heightSegments:i,openEnded:r,thetaStart:o,thetaLength:a}}function Pa(t,e,n,i){Bn.call(this),this.type="CircleGeometry",this.parameters={radius:t,segments:e,thetaStart:n,thetaLength:i},this.fromBufferGeometry(new La(t,e,n,i)),this.mergeVertices()}function La(t,e,n,i){Zn.call(this),this.type="CircleBufferGeometry",this.parameters={radius:t,segments:e,thetaStart:n,thetaLength:i},t=t||1,e=void 0!==e?Math.max(3,e):8,n=void 0!==n?n:0,i=void 0!==i?i:2*Math.PI;var r,o,a=[],s=[],c=[],l=[],u=new Ye,h=new We;for(s.push(0,0,0),c.push(0,0,1),l.push(.5,.5),o=0,r=3;o<=e;o++,r+=3){var d=n+o/e*i;u.x=t*Math.cos(d),u.y=t*Math.sin(d),s.push(u.x,u.y,u.z),c.push(0,0,1),h.x=(s[r]/t+1)/2,h.y=(s[r+1]/t+1)/2,l.push(h.x,h.y)}for(r=1;r<=e;r++)a.push(r,r+1,0);this.setIndex(a),this.addAttribute("position",new Wn(s,3)),this.addAttribute("normal",new Wn(c,3)),this.addAttribute("uv",new Wn(l,2))}ha.prototype=Object.create(Bn.prototype),ha.prototype.constructor=ha,da.prototype=Object.create(Zn.prototype),da.prototype.constructor=da,da.prototype.getArrays=function(){var t=this.getAttribute("position"),e=t?Array.prototype.slice.call(t.array):[],n=this.getAttribute("uv"),i=n?Array.prototype.slice.call(n.array):[],r=this.index;return{position:e,uv:i,index:r?Array.prototype.slice.call(r.array):[]}},da.prototype.addShapeList=function(t,e){var n=t.length;e.arrays=this.getArrays();for(var i=0;iNumber.EPSILON){var d=Math.sqrt(u),f=Math.sqrt(c*c+l*l),p=e.x-s/d,m=e.y+a/d,g=((n.x-l/f-p)*l-(n.y+c/f-m)*c)/(a*l-s*c),_=(i=p+a*g-t.x)*i+(r=m+s*g-t.y)*r;if(_<=2)return new We(i,r);o=Math.sqrt(_/2)}else{var v=!1;a>Number.EPSILON?c>Number.EPSILON&&(v=!0):a<-Number.EPSILON?c<-Number.EPSILON&&(v=!0):Math.sign(s)===Math.sign(l)&&(v=!0),v?(i=-s,r=a,o=Math.sqrt(u)):(i=a,r=s,o=Math.sqrt(u/2))}return new We(i/o,r/o)}for(var F=[],H=0,q=L.length,G=q-1,W=H+1;H=0;C--){for(I=C/v,z=g*Math.cos(I*Math.PI/2),R=_*Math.sin(I*Math.PI/2),H=0,q=L.length;H=0;){n=H,(i=H-1)<0&&(i=t.length-1);var r=0,o=x+2*v;for(r=0;r0||0===t.search(/^data\:image\/jpeg/);r.format=i?Vt:Xt,r.needsUpdate=!0,void 0!==e&&e(r)},n,i),r},setCrossOrigin:function(t){return this.crossOrigin=t,this},setPath:function(t){return this.path=t,this}}),Object.assign(Qa.prototype,{getPoint:function(){return console.warn("THREE.Curve: .getPoint() not implemented."),null},getPointAt:function(t,e){var n=this.getUtoTmapping(t);return this.getPoint(n,e)},getPoints:function(t){void 0===t&&(t=5);for(var e=[],n=0;n<=t;n++)e.push(this.getPoint(n/t));return e},getSpacedPoints:function(t){void 0===t&&(t=5);for(var e=[],n=0;n<=t;n++)e.push(this.getPointAt(n/t));return e},getLength:function(){var t=this.getLengths();return t[t.length-1]},getLengths:function(t){if(void 0===t&&(t=this.arcLengthDivisions),this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var e,n,i=[],r=this.getPoint(0),o=0;for(i.push(0),n=1;n<=t;n++)o+=(e=this.getPoint(n/t)).distanceTo(r),i.push(o),r=e;return this.cacheArcLengths=i,i},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(t,e){var n,i=this.getLengths(),r=0,o=i.length;n=e||t*i[o-1];for(var a,s=0,c=o-1;s<=c;)if((a=i[r=Math.floor(s+(c-s)/2)]-n)<0)s=r+1;else{if(!(a>0)){c=r;break}c=r-1}if(i[r=c]===n)return r/(o-1);var l=i[r];return(r+(n-l)/(i[r+1]-l))/(o-1)},getTangent:function(t){var e=t-1e-4,n=t+1e-4;e<0&&(e=0),n>1&&(n=1);var i=this.getPoint(e);return this.getPoint(n).clone().sub(i).normalize()},getTangentAt:function(t){var e=this.getUtoTmapping(t);return this.getTangent(e)},computeFrenetFrames:function(t,e){var n,i,r,o=new Ye,a=[],s=[],c=[],l=new Ye,u=new Ve;for(n=0;n<=t;n++)i=n/t,a[n]=this.getTangentAt(i),a[n].normalize();s[0]=new Ye,c[0]=new Ye;var h=Number.MAX_VALUE,d=Math.abs(a[0].x),f=Math.abs(a[0].y),p=Math.abs(a[0].z);for(d<=h&&(h=d,o.set(1,0,0)),f<=h&&(h=f,o.set(0,1,0)),p<=h&&o.set(0,0,1),l.crossVectors(a[0],o).normalize(),s[0].crossVectors(a[0],l),c[0].crossVectors(a[0],s[0]),n=1;n<=t;n++)s[n]=s[n-1].clone(),c[n]=c[n-1].clone(),l.crossVectors(a[n-1],a[n]),l.length()>Number.EPSILON&&(l.normalize(),r=Math.acos(Ge.clamp(a[n-1].dot(a[n]),-1,1)),s[n].applyMatrix4(u.makeRotationAxis(l,r))),c[n].crossVectors(a[n],s[n]);if(!0===e)for(r=Math.acos(Ge.clamp(s[0].dot(s[t]),-1,1)),r/=t,a[0].dot(l.crossVectors(s[0],s[t]))>0&&(r=-r),n=1;n<=t;n++)s[n].applyMatrix4(u.makeRotationAxis(a[n],r*n)),c[n].crossVectors(a[n],s[n]);return{tangents:a,normals:s,binormals:c}},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.arcLengthDivisions=t.arcLengthDivisions,this},toJSON:function(){var t={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t},fromJSON:function(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}}),$a.prototype=Object.create(Qa.prototype),$a.prototype.constructor=$a,$a.prototype.isEllipseCurve=!0,$a.prototype.getPoint=function(t,e){for(var n=e||new We,i=2*Math.PI,r=this.aEndAngle-this.aStartAngle,o=Math.abs(r)i;)r-=i;r0?0:(Math.floor(Math.abs(u)/s.length)+1)*s.length:0===h&&u===c-1&&(u=c-2,h=1),this.closed||u>0?n=s[(u-1)%c]:(ns.subVectors(s[0],s[1]).add(s[0]),n=ns),i=s[u%c],r=s[(u+1)%c],this.closed||u+2i.length-2?i.length-1:o+1],u=i[o>i.length-3?i.length-1:o+2];return n.set(ss(a,s.x,c.x,l.x,u.x),ss(a,s.y,c.y,l.y,u.y)),n},gs.prototype.copy=function(t){Qa.prototype.copy.call(this,t),this.points=[];for(var e=0,n=t.points.length;e=e){var r=n[i]-e,o=this.curves[i],a=o.getLength(),s=0===a?0:1-r/a;return o.getPointAt(s)}i++}return null},getLength:function(){var t=this.getCurveLengths();return t[t.length-1]},updateArcLengths:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var t=[],e=0,n=0,i=this.curves.length;n1&&!n[n.length-1].equals(n[0])&&n.push(n[0]),n},copy:function(t){Qa.prototype.copy.call(this,t),this.curves=[];for(var e=0,n=t.curves.length;e0){var l=c.getPoint(0);l.equals(this.currentPoint)||this.lineTo(l.x,l.y)}this.curves.push(c);var u=c.getPoint(1);this.currentPoint.copy(u)},copy:function(t){return vs.prototype.copy.call(this,t),this.currentPoint.copy(t.currentPoint),this},toJSON:function(){var t=vs.prototype.toJSON.call(this);return t.currentPoint=this.currentPoint.toArray(),t},fromJSON:function(t){return vs.prototype.fromJSON.call(this,t),this.currentPoint.fromArray(t.currentPoint),this}}),ys.prototype=Object.assign(Object.create(bs.prototype),{constructor:ys,getPointsHoles:function(t){for(var e=[],n=0,i=this.holes.length;n=r)break t;var s=e[1];t=(r=e[--n-1]))break e}o=n,n=0}for(;n>>1;te;)--o;if(++o,0!==r||o!==i){r>=o&&(r=(o=Math.max(o,1))-1);var a=this.getValueSize();this.times=Fs.arraySlice(n,r,o),this.values=Fs.arraySlice(this.values,r*a,o*a)}return this},validate:function(){var t=!0,e=this.getValueSize();e-Math.floor(e)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),t=!1);var n=this.times,i=this.values,r=n.length;0===r&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);for(var o=null,a=0;a!==r;a++){var s=n[a];if("number"==typeof s&&isNaN(s)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,a,s),t=!1;break}if(null!==o&&o>s){console.error("THREE.KeyframeTrack: Out of order keys.",this,a,s,o),t=!1;break}o=s}if(void 0!==i&&Fs.isTypedArray(i)){a=0;for(var c=i.length;a!==c;++a){var l=i[a];if(isNaN(l)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,l),t=!1;break}}}return t},optimize:function(){for(var t=this.times,e=this.values,n=this.getValueSize(),i=this.getInterpolation()===Te,r=1,o=t.length-1,a=1;a0){t[r]=t[o];for(p=o*n,m=r*n,d=0;d!==n;++d)e[m+d]=e[p+d];++r}return r!==t.length&&(this.times=Fs.arraySlice(t,0,r),this.values=Fs.arraySlice(e,0,r*n)),this}}),qs.prototype=Object.assign(Object.create(Hs.prototype),{constructor:qs,ValueTypeName:"vector"}),Object.assign(Gs,{parse:function(t){for(var e=[],n=t.tracks,i=1/(t.fps||1),r=0,o=n.length;r!==o;++r)e.push(Hs.parse(n[r]).scale(i));return new Gs(t.name,t.duration,e)},toJSON:function(t){for(var e=[],n=t.tracks,i={name:t.name,duration:t.duration,tracks:e},r=0,o=n.length;r!==o;++r)e.push(Hs.toJSON(n[r]));return i},CreateFromMorphTargetSequence:function(t,e,n,i){for(var r=e.length,o=[],a=0;a1){var l=i[h=c[1]];l||(i[h]=l=[]),l.push(s)}}var u=[];for(var h in i)u.push(Gs.CreateFromMorphTargetSequence(h,i[h],e,n));return u},parseAnimation:function(t,e){if(!t)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;for(var n=function(t,e,n,i,r){if(0!==n.length){var o=[],a=[];Fs.flattenJSON(n,o,a,i),0!==o.length&&r.push(new t(e,o,a))}},i=[],r=t.name||"default",o=t.length||-1,a=t.fps||30,s=t.hierarchy||[],c=0;c1?t.skinWeights[i+1]:0,s=n>2?t.skinWeights[i+2]:0,c=n>3?t.skinWeights[i+3]:0;e.skinWeights.push(new on(o,a,s,c))}if(t.skinIndices)for(i=0,r=t.skinIndices.length;i1?t.skinIndices[i+1]:0,h=n>2?t.skinIndices[i+2]:0,d=n>3?t.skinIndices[i+3]:0;e.skinIndices.push(new on(l,u,h,d))}e.bones=t.bones,e.bones&&e.bones.length>0&&(e.skinWeights.length!==e.skinIndices.length||e.skinIndices.length!==e.vertices.length)&&console.warn("When skinning, number of vertices ("+e.vertices.length+"), skinIndices ("+e.skinIndices.length+"), and skinWeights ("+e.skinWeights.length+") should match.")}(t,n),function(t,e){var n=t.scale;if(void 0!==t.morphTargets)for(var i=0,r=t.morphTargets.length;i0){console.warn('THREE.JSONLoader: "morphColors" no longer supported. Using them as face colors.');var u=e.faces,h=t.morphColors[0].colors;for(i=0,r=u.length;i0&&(e.animations=n)}(t,n),n.computeFaceNormals(),n.computeBoundingSphere(),void 0===t.materials||0===t.materials.length?{geometry:n}:{geometry:n,materials:Qs.prototype.initMaterials(t.materials,e,this.crossOrigin)}}}),Object.assign(ec.prototype,{load:function(t,e,n,i){""===this.texturePath&&(this.texturePath=t.substring(0,t.lastIndexOf("/")+1));var r=this;new Va(r.manager).load(t,function(n){var o=null;try{o=JSON.parse(n)}catch(e){return void 0!==i&&i(e),void console.error("THREE:ObjectLoader: Can't parse "+t+".",e.message)}var a=o.metadata;void 0!==a&&void 0!==a.type&&"geometry"!==a.type.toLowerCase()?r.parse(o,e):console.error("THREE.ObjectLoader: Can't load "+t+". Use THREE.JSONLoader instead.")},n,i)},setTexturePath:function(t){this.texturePath=t},setCrossOrigin:function(t){this.crossOrigin=t},parse:function(t,e){var n=this.parseShape(t.shapes),i=this.parseGeometries(t.geometries,n),r=this.parseImages(t.images,function(){void 0!==e&&e(s)}),o=this.parseTextures(t.textures,r),a=this.parseMaterials(t.materials,o),s=this.parseObject(t.object,i,a);return t.animations&&(s.animations=this.parseAnimations(t.animations)),void 0!==t.images&&0!==t.images.length||void 0!==e&&e(s),s},parseShape:function(t){var e={};if(void 0!==t)for(var n=0,i=t.length;n0){var o=new Ka(new qa(e));o.setCrossOrigin(this.crossOrigin);for(var a=0,s=t.length;a0?new lo(a,s):new mi(a,s);break;case"LOD":i=new ao;break;case"Line":i=new ho(r(t.geometry),o(t.material),t.mode);break;case"LineLoop":i=new po(r(t.geometry),o(t.material));break;case"LineSegments":i=new fo(r(t.geometry),o(t.material));break;case"PointCloud":case"Points":i=new go(r(t.geometry),o(t.material));break;case"Sprite":i=new oo(o(t.material));break;case"Group":i=new _o;break;default:i=new Pn}if(i.uuid=t.uuid,void 0!==t.name&&(i.name=t.name),void 0!==t.matrix?(i.matrix.fromArray(t.matrix),i.matrix.decompose(i.position,i.quaternion,i.scale)):(void 0!==t.position&&i.position.fromArray(t.position),void 0!==t.rotation&&i.rotation.fromArray(t.rotation),void 0!==t.quaternion&&i.quaternion.fromArray(t.quaternion),void 0!==t.scale&&i.scale.fromArray(t.scale)),void 0!==t.castShadow&&(i.castShadow=t.castShadow),void 0!==t.receiveShadow&&(i.receiveShadow=t.receiveShadow),t.shadow&&(void 0!==t.shadow.bias&&(i.shadow.bias=t.shadow.bias),void 0!==t.shadow.radius&&(i.shadow.radius=t.shadow.radius),void 0!==t.shadow.mapSize&&i.shadow.mapSize.fromArray(t.shadow.mapSize),void 0!==t.shadow.camera&&(i.shadow.camera=this.parseObject(t.shadow.camera))),void 0!==t.visible&&(i.visible=t.visible),void 0!==t.frustumCulled&&(i.frustumCulled=t.frustumCulled),void 0!==t.renderOrder&&(i.renderOrder=t.renderOrder),void 0!==t.userData&&(i.userData=t.userData),void 0!==t.children)for(var c=t.children,l=0;lNumber.EPSILON){if(l<0&&(a=e[o],c=-c,s=e[r],l=-l),t.ys.y)continue;if(t.y===a.y){if(t.x===a.x)return!0}else{var u=l*(t.x-a.x)-c*(t.y-a.y);if(0===u)return!0;if(u<0)continue;i=!i}}else{if(t.y!==a.y)continue;if(s.x<=t.x&&t.x<=a.x||a.x<=t.x&&t.x<=s.x)return!0}}return i}var r=ca.isClockWise,o=this.subPaths;if(0===o.length)return[];if(!0===e)return n(o);var a,s,c,l=[];if(1===o.length)return s=o[0],(c=new ys).curves=s.curves,l.push(c),l;var u=!r(o[0].getPoints());u=t?!u:u;var h,d,f=[],p=[],m=[],g=0;p[g]=void 0,m[g]=[];for(var _=0,v=o.length;_1){for(var b=!1,y=[],x=0,w=p.length;x0&&(b||(m=f))}_=0;for(var k=p.length;_0){this.source.connect(this.filters[0]);for(var t=1,e=this.filters.length;t0){this.source.disconnect(this.filters[0]);for(var t=1,e=this.filters.length;t=.5)for(var o=0;o!==r;++o)t[e+o]=t[n+o]},_slerp:function(t,e,n,i){Xe.slerpFlat(t,e,t,e,t,n,i)},_lerp:function(t,e,n,i,r){for(var o=1-i,a=0;a!==r;++a){var s=e+a;t[s]=t[s]*o+t[n+a]*i}}});var Lc,Oc,Cc,Rc,Ic,zc,Bc,Nc,Dc,jc,Uc,Fc,Hc;function qc(t,e,n){var i=n||Gc.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,i)}function Gc(t,e,n){this.path=e,this.parsedPath=n||Gc.parseTrackName(e),this.node=Gc.findNode(t,this.parsedPath.nodeName)||t,this.rootNode=t}function Wc(){this.uuid=Ge.generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;var t={};this._indicesByUUID=t;for(var e=0,n=arguments.length;e!==n;++e)t[arguments[e].uuid]=e;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};var i=this;this.stats={objects:{get total(){return i._objects.length},get inUse(){return this.total-i.nCachedObjects_}},get bindingsPerObject(){return i._bindings.length}}}function Vc(t,e,n){this._mixer=t,this._clip=e,this._localRoot=n||null;for(var i=e.tracks,r=i.length,o=new Array(r),a={endingStart:ke,endingEnd:ke},s=0;s!==r;++s){var c=i[s].createInterpolant(null);o[s]=c,c.settings=a}this._interpolantSettings=a,this._interpolants=o,this._propertyBindings=new Array(r),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=Me,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}function Xc(t){this._root=t,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}function Yc(t){"string"==typeof t&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),t=arguments[1]),this.value=t}function Kc(){Zn.call(this),this.type="InstancedBufferGeometry",this.maxInstancedCount=void 0}function Zc(t,e,n,i){this.data=t,this.itemSize=e,this.offset=n,this.normalized=!0===i}function Jc(t,e){this.array=t,this.stride=e,this.count=void 0!==t?t.length/e:0,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.version=0}function Qc(t,e,n){Jc.call(this,t,e),this.meshPerAttribute=n||1}function $c(t,e,n){Nn.call(this,t,e),this.meshPerAttribute=n||1}function tl(t,e,n,i){this.ray=new di(t,e),this.near=n||0,this.far=i||1/0,this.params={Mesh:{},Line:{},LOD:{},Points:{threshold:1},Sprite:{}},Object.defineProperties(this.params,{PointCloud:{get:function(){return console.warn("THREE.Raycaster: params.PointCloud has been renamed to params.Points."),this.Points}}})}function el(t,e){return t.distance-e.distance}function nl(t,e,n,i){if(!1!==t.visible&&(t.raycast(e,n),!0===i))for(var r=t.children,o=0,a=r.length;o=e){var u=e++,h=t[u];n[h.uuid]=l,t[l]=h,n[c]=u,t[u]=s;for(var d=0,f=r;d!==f;++d){var p=i[d],m=p[u],g=p[l];p[l]=m,p[u]=g}}}this.nCachedObjects_=e},uncache:function(){for(var t=this._objects,e=t.length,n=this.nCachedObjects_,i=this._indicesByUUID,r=this._bindings,o=r.length,a=0,s=arguments.length;a!==s;++a){var c=arguments[a],l=c.uuid,u=i[l];if(void 0!==u)if(delete i[l],u0)for(var c=this._interpolants,l=this._propertyBindings,u=0,h=c.length;u!==h;++u)c[u].evaluate(a),l[u].accumulate(i,s)}else this._updateWeight(t)},_updateWeight:function(t){var e=0;if(this.enabled){e=this.weight;var n=this._weightInterpolant;if(null!==n){var i=n.evaluate(t)[0];e*=i,t>n.parameterPositions[1]&&(this.stopFading(),0===i&&(this.enabled=!1))}}return this._effectiveWeight=e,e},_updateTimeScale:function(t){var e=0;if(!this.paused){e=this.timeScale;var n=this._timeScaleInterpolant;if(null!==n)e*=n.evaluate(t)[0],t>n.parameterPositions[1]&&(this.stopWarping(),0===e?this.paused=!0:this.timeScale=e)}return this._effectiveTimeScale=e,e},_updateTime:function(t){var e=this.time+t;if(0===t)return e;var n=this._clip.duration,i=this.loop,r=this._loopCount;if(i===we){-1===r&&(this._loopCount=0,this._setEndings(!0,!0,!1));t:{if(e>=n)e=n;else{if(!(e<0))break t;e=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{var o=i===Ee;if(-1===r&&(t>=0?(r=0,this._setEndings(!0,0===this.repetitions,o)):this._setEndings(0===this.repetitions,!0,o)),e>=n||e<0){var a=Math.floor(e/n);e-=n*a,r+=Math.abs(a);var s=this.repetitions-r;if(s<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,e=t>0?n:0,this._mixer.dispatchEvent({type:"finished",action:this,direction:t>0?1:-1});else{if(1===s){var c=t<0;this._setEndings(c,!c,o)}else this._setEndings(!1,!1,o);this._loopCount=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}if(o&&1==(1&r))return this.time=e,n-e}return this.time=e,e},_setEndings:function(t,e,n){var i=this._interpolantSettings;n?(i.endingStart=Pe,i.endingEnd=Pe):(i.endingStart=t?this.zeroSlopeAtStart?Pe:ke:Le,i.endingEnd=e?this.zeroSlopeAtEnd?Pe:ke:Le)},_scheduleFading:function(t,e,n){var i=this._mixer,r=i.time,o=this._weightInterpolant;null===o&&(o=i._lendControlInterpolant(),this._weightInterpolant=o);var a=o.parameterPositions,s=o.sampleValues;return a[0]=r,s[0]=e,a[1]=r+t,s[1]=n,this}}),Xc.prototype=Object.assign(Object.create(i.prototype),{constructor:Xc,_bindAction:function(t,e){var n=t._localRoot||this._root,i=t._clip.tracks,r=i.length,o=t._propertyBindings,a=t._interpolants,s=n.uuid,c=this._bindingsByRootAndName,l=c[s];void 0===l&&(l={},c[s]=l);for(var u=0;u!==r;++u){var h=i[u],d=h.name,f=l[d];if(void 0!==f)o[u]=f;else{if(void 0!==(f=o[u])){null===f._cacheIndex&&(++f.referenceCount,this._addInactiveBinding(f,s,d));continue}var p=e&&e._propertyBindings[u].binding.parsedPath;++(f=new Pc(Gc.create(n,d,p),h.ValueTypeName,h.getValueSize())).referenceCount,this._addInactiveBinding(f,s,d),o[u]=f}a[u].resultBuffer=f.buffer}},_activateAction:function(t){if(!this._isActiveAction(t)){if(null===t._cacheIndex){var e=(t._localRoot||this._root).uuid,n=t._clip.uuid,i=this._actionsByClip[n];this._bindAction(t,i&&i.knownActions[0]),this._addInactiveAction(t,n,e)}for(var r=t._propertyBindings,o=0,a=r.length;o!==a;++o){var s=r[o];0==s.useCount++&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(t)}},_deactivateAction:function(t){if(this._isActiveAction(t)){for(var e=t._propertyBindings,n=0,i=e.length;n!==i;++n){var r=e[n];0==--r.useCount&&(r.restoreOriginalState(),this._takeBackBinding(r))}this._takeBackAction(t)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}},_isActiveAction:function(t){var e=t._cacheIndex;return null!==e&&ethis.max.x||t.ythis.max.y)},containsBox:function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y},getParameter:function(t,e){return void 0===e&&(console.warn("THREE.Box2: .getParameter() target is now required"),e=new We),e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(t){return!(t.max.xthis.max.x||t.max.ythis.max.y)},clampPoint:function(t,e){return void 0===e&&(console.warn("THREE.Box2: .clampPoint() target is now required"),e=new We),e.copy(t).clamp(this.min,this.max)},distanceToPoint:function(){var t=new We;return function(e){return t.copy(e).clamp(this.min,this.max).sub(e).length()}}(),intersect:function(t){return this.min.max(t.min),this.max.min(t.max),this},union:function(t){return this.min.min(t.min),this.max.max(t.max),this},translate:function(t){return this.min.add(t),this.max.add(t),this},equals:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}),sl.prototype=Object.create(Pn.prototype),sl.prototype.constructor=sl,sl.prototype.isImmediateRenderObject=!0,cl.prototype=Object.create(fo.prototype),cl.prototype.constructor=cl,cl.prototype.update=function(){var t=new Ye,e=new Ye,n=new Ke;return function(){var i=["a","b","c"];this.object.updateMatrixWorld(!0),n.getNormalMatrix(this.object.matrixWorld);var r=this.object.matrixWorld,o=this.geometry.attributes.position,a=this.object.geometry;if(a&&a.isGeometry)for(var s=a.vertices,c=a.faces,l=0,u=0,h=c.length;u.99999?this.quaternion.set(0,0,0,1):t.y<-.99999?this.quaternion.set(1,0,0,0):(Hc.set(t.z,0,-t.x).normalize(),Fc=Math.acos(t.y),this.quaternion.setFromAxisAngle(Hc,Fc))}),wl.prototype.setLength=function(t,e,n){void 0===e&&(e=.2*t),void 0===n&&(n=.2*e),this.line.scale.set(1,Math.max(0,t-e),1),this.line.updateMatrix(),this.cone.scale.set(n,e,n),this.cone.position.y=t,this.cone.updateMatrix()},wl.prototype.setColor=function(t){this.line.material.color.copy(t),this.cone.material.color.copy(t)},Ml.prototype=Object.create(fo.prototype),Ml.prototype.constructor=Ml;var Sl=0,Al=1;function Tl(t){return console.warn("THREE.MeshFaceMaterial has been removed. Use an Array instead."),t}function kl(t){return void 0===t&&(t=[]),console.warn("THREE.MultiMaterial has been removed. Use an Array instead."),t.isMultiMaterial=!0,t.materials=t,t.clone=function(){return t.slice()},t}function Pl(t,e){return console.warn("THREE.PointCloud has been renamed to THREE.Points."),new go(t,e)}function Ll(t){return console.warn("THREE.Particle has been renamed to THREE.Sprite."),new oo(t)}function Ol(t,e){return console.warn("THREE.ParticleSystem has been renamed to THREE.Points."),new go(t,e)}function Cl(t){return console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."),new mo(t)}function Rl(t){return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."),new mo(t)}function Il(t){return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."),new mo(t)}function zl(t,e,n){return console.warn("THREE.Vertex has been removed. Use THREE.Vector3 instead."),new Ye(t,e,n)}function Bl(t,e){return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setDynamic( true ) instead."),new Nn(t,e).setDynamic(!0)}function Nl(t,e){return console.warn("THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead."),new Dn(t,e)}function Dl(t,e){return console.warn("THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead."),new jn(t,e)}function jl(t,e){return console.warn("THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead."),new Un(t,e)}function Ul(t,e){return console.warn("THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead."),new Fn(t,e)}function Fl(t,e){return console.warn("THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead."),new Hn(t,e)}function Hl(t,e){return console.warn("THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead."),new qn(t,e)}function ql(t,e){return console.warn("THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead."),new Gn(t,e)}function Gl(t,e){return console.warn("THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead."),new Wn(t,e)}function Wl(t,e){return console.warn("THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead."),new Vn(t,e)}function Vl(t){console.warn("THREE.ClosedSplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."),as.call(this,t),this.type="catmullrom",this.closed=!0}function Xl(t){console.warn("THREE.SplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."),as.call(this,t),this.type="catmullrom"}function Yl(t){console.warn("THREE.Spline has been removed. Use THREE.CatmullRomCurve3 instead."),as.call(this,t),this.type="catmullrom"}function Kl(t){return console.warn("THREE.AxisHelper has been renamed to THREE.AxesHelper."),new Ml(t)}function Zl(t,e){return console.warn("THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead."),new bl(t,e)}function Jl(t,e){return console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead."),new fo(new Ea(t.geometry),new uo({color:void 0!==e?e:16777215}))}function Ql(t,e){return console.warn("THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead."),new fo(new xo(t.geometry),new uo({color:void 0!==e?e:16777215}))}function $l(t){return console.warn("THREE.XHRLoader has been renamed to THREE.FileLoader."),new Va(t)}function tu(t){return console.warn("THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader."),new Ya(t)}Qa.create=function(t,e){return console.log("THREE.Curve.create() has been deprecated"),t.prototype=Object.create(Qa.prototype),t.prototype.constructor=t,t.prototype.getPoint=e,t},Object.assign(vs.prototype,{createPointsGeometry:function(t){console.warn("THREE.CurvePath: .createPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");var e=this.getPoints(t);return this.createGeometry(e)},createSpacedPointsGeometry:function(t){console.warn("THREE.CurvePath: .createSpacedPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");var e=this.getSpacedPoints(t);return this.createGeometry(e)},createGeometry:function(t){console.warn("THREE.CurvePath: .createGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");for(var e=new Bn,n=0,i=t.length;n .svg-background {\n position: absolute;\n width: 100%;\n height: 100%;\n z-index: 0;\n}\n.bqplot > canvas {\n position: absolute;\n pointer-events: none;\n z-index: 0;\n}\n.bqplot > svg {\n z-index: 0;\n font: 11px sans-serif;\n user-select: none;\n -ms-user-select: none;\n -khtml-user-select: none;\n -webkit-user-select: none;\n flex-grow: 1;\n}\n.bqplot > svg .svg-figure {\n background: var(--bq-background);\n}\n.bqplot > svg .axis rect {\n stroke: var(--bq-axis-rect-stroke);\n opacity: var(--bq-axis-rect-opacity);\n}\n.bqplot > svg .axis .tick line {\n stroke: var(--bq-axis-tick-stroke);\n stroke-width: var(--bq-axis-tick-stroke-width);\n opacity: var(--bq-axis-tick-opacity);\n}\n.bqplot > svg .axis .tick.short line {\n stroke: var(--bq-axis-tick-short-stroke);\n}\n.bqplot > svg .axis .tick text {\n fill: var(--bq-axis-tick-text-fill);\n font: var(--bq-axis-tick-text-font);\n}\n.bqplot > svg .axis line {\n shape-rendering: crispEdges;\n font: 10px sans-serif;\n stroke-width: 1px;\n}\n.bqplot > svg .axis path,\n.bqplot > svg .axis line {\n fill: none;\n}\n.bqplot > svg .axis path {\n stroke: var(--bq-axis-path-stroke);\n}\n.bqplot > svg .axis text.axislabel,\n.bqplot > svg .axis tspan.axislabel {\n text-anchor: end;\n fill: var(--bq-axislabel-fill);\n font: var(--bq-axislabel-font);\n}\n.bqplot > svg .axis .tick text {\n cursor: default;\n}\n.bqplot > svg .axis.axisbold path {\n stroke-width: 3px;\n}\n.bqplot > svg .axis.axisbold text,\n.bqplot > svg .axis.axisbold text.axislabel {\n font-weight: bolder;\n}\n.bqplot > svg .stick,\n.bqplot > svg .zeroLine {\n stroke: var(--bq-stick-stroke);\n fill: var(--bq-stick-fill);\n}\n.bqplot > svg .sticktext {\n fill: var(--bq-sticktext-fill);\n}\n.bqplot > svg .bargroup rect,\n.bqplot > svg .boxplot rect,\n.bqplot > svg .slice rect,\n.bqplot > svg .bargroup path,\n.bqplot > svg .boxplot path,\n.bqplot > svg .slice path,\n.bqplot > svg .bargroup line,\n.bqplot > svg .boxplot line,\n.bqplot > svg .slice line {\n stroke: var(--bq-default-stroke);\n}\n.bqplot > svg .zeroLine {\n shape-rendering: crispEdges;\n}\n.bqplot > svg text.mainheading {\n text-anchor: middle;\n fill: var(--bq-mainheading-fill);\n font: var(--bq-mainheading-font);\n font-size: var(--bq-mainheading-font-size);\n}\n.bqplot > svg text.legendtext {\n text-anchor: start;\n font: 14px sans-serif;\n}\n.bqplot > svg text.dot_text {\n fill: var(--bq-content-font-color);\n}\n.bqplot > svg .indsel {\n stroke: red;\n}\n.bqplot > svg .brushintsel .selection {\n fill: var(--bq-selector-fill);\n stroke: none;\n}\n.bqplot > svg .intsel {\n fill: var(--bq-selector-fill);\n stroke: none;\n fill-opacity: 0.3;\n}\n.bqplot > svg .intselmouse {\n visibility: hidden;\n pointer-events: all;\n /*none?*/\n}\n.bqplot > svg .multiselector .active {\n pointer-events: all;\n}\n.bqplot > svg .multiselector .active .selection {\n stroke: green;\n}\n.bqplot > svg .multiselector .active .overlay {\n pointer-events: all;\n}\n.bqplot > svg .multiselector .inactive {\n pointer-events: none;\n}\n.bqplot > svg .multiselector .inactive .selection {\n stroke: red;\n}\n.bqplot > svg .multiselector .inactive .overlay {\n pointer-events: none;\n}\n.bqplot > svg .multiselector .visible {\n pointer-events: all;\n}\n.bqplot > svg .multiselector .visible .selection {\n stroke: red;\n}\n.bqplot > svg .multiselector .visible .overlay {\n pointer-events: none;\n}\n.bqplot > svg .lassoselector .selected {\n opacity: 0.3;\n}\n.bqplot > svg .lassoselector path {\n fill: none;\n stroke: orange;\n stroke-width: 4;\n}\n.bqplot > svg .plotarea_background {\n fill: var(--bq-plotarea-background-fill);\n}\n.bqplot > svg .plotarea_events {\n opacity: 0;\n}\n.tooltip_div {\n z-index: 1001;\n}\n.mark_tooltip {\n pointer-events: none;\n z-index: 1001;\n border: var(--bq-mark-tooltip-border);\n border-radius: var(--bq-mark-tooltip-border-radius);\n box-shadow: var(--bq-mark-tooltip-box-shadow);\n -webkit-user-select: var(--bq-mark-tooltip--webkit-user-select);\n -moz-user-select: var(--bq-mark-tooltip--moz-user-select);\n background-color: var(--bq-mark-tooltip-background-color);\n}\n.mark_tooltip > .bqplot.figure {\n width: 427px;\n height: 320px;\n}\n.mark_tooltip td {\n border: var(--bq-mark-tooltip-td-border);\n}\n.mark_tooltip table {\n border-radius: 5px;\n background: var(--bq-mark-tooltip-background);\n}\n.mark_tooltip .tooltiptext {\n text-align: center;\n padding: 0.5em;\n}\n.world_map path {\n stroke: var(--bq-world-map-path-stroke);\n stroke-width: var(--bq-world-map-path-stroke-width);\n fill: var(--bq-world-map-path-fill);\n}\n.world_map .hovered {\n fill: Orange;\n stroke: Orange;\n stroke-width: 2.5px;\n}\n.world_map #container {\n margin: 10px 10%;\n border: 2px solid #000;\n border-radius: 5px;\n height: 100%;\n overflow: hidden;\n background: #F0F8FF;\n}\n.world_map .graticule {\n fill: none;\n stroke: #bbb;\n stroke-width: 0.5px;\n stroke-opacity: 0.5;\n}\n.g_legend {\n fill: none;\n}\n.pie polyline {\n opacity: var(--bq-pie-polyline-opacity);\n stroke: var(--bq-pie-polyline-stroke);\n stroke-width: var(--bq-pie-polyline-stroke-width);\n fill: var(--bq-pie-polyline-fill);\n}\n.network .node .element {\n fill: var(--bq-network-node-element-fill);\n stroke: var(--bq-network-node-element-stroke);\n stroke-width: var(--bq-network-node-element-stroke-width);\n}\n.network .link {\n fill: var(--bq-network-link-fill);\n stroke: var(--bq-network-link-stroke);\n stroke-width: var(--bq-network-link-stroke-width);\n}\n.network .node .label {\n font: var(--bq-network-node-label-font);\n pointer-events: var(--bq-network-node-label-pointer-events);\n text-shadow: var(--bq-network-node-label-text-shadow);\n}\n.linkarrow {\n fill: var(--bq-linkarrow-fill);\n}\n',""])},function(t,e,n){"use strict";t.exports=function(t){var e=[];return e.toString=function(){return this.map(function(e){var n=function(t,e){var n=t[1]||"",i=t[3];if(!i)return n;if(e&&"function"==typeof btoa){var r=(a=i,s=btoa(unescape(encodeURIComponent(JSON.stringify(a)))),c="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(s),"/*# ".concat(c," */")),o=i.sources.map(function(t){return"/*# sourceURL=".concat(i.sourceRoot).concat(t," */")});return[n].concat(o).concat([r]).join("\n")}var a,s,c;return[n].join("\n")}(e,t);return e[2]?"@media ".concat(e[2],"{").concat(n,"}"):n}).join("")},e.i=function(t,n){"string"==typeof t&&(t=[[null,t,""]]);for(var i={},r=0;r=0&&u.splice(e,1)}function g(t){var e=document.createElement("style");if(void 0===t.attrs.type&&(t.attrs.type="text/css"),void 0===t.attrs.nonce){var i=function(){0;return n.nc}();i&&(t.attrs.nonce=i)}return _(e,t.attrs),p(t,e),e}function _(t,e){Object.keys(e).forEach(function(n){t.setAttribute(n,e[n])})}function v(t,e){var n,i,r,o;if(e.transform&&t.css){if(!(o="function"==typeof e.transform?e.transform(t.css):e.transform.default(t.css)))return function(){};t.css=o}if(e.singleton){var a=l++;n=c||(c=g(e)),i=x.bind(null,n,a,!1),r=x.bind(null,n,a,!0)}else t.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=function(t){var e=document.createElement("link");return void 0===t.attrs.type&&(t.attrs.type="text/css"),t.attrs.rel="stylesheet",_(e,t.attrs),p(t,e),e}(e),i=function(t,e,n){var i=n.css,r=n.sourceMap,o=void 0===e.convertToAbsoluteUrls&&r;(e.convertToAbsoluteUrls||o)&&(i=h(i));r&&(i+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(r))))+" */");var a=new Blob([i],{type:"text/css"}),s=t.href;t.href=URL.createObjectURL(a),s&&URL.revokeObjectURL(s)}.bind(null,n,e),r=function(){m(n),n.href&&URL.revokeObjectURL(n.href)}):(n=g(e),i=function(t,e){var n=e.css,i=e.media;i&&t.setAttribute("media",i);if(t.styleSheet)t.styleSheet.cssText=n;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(n))}}.bind(null,n),r=function(){m(n)});return i(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap)return;i(t=e)}else r()}}t.exports=function(t,e){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");(e=e||{}).attrs="object"==typeof e.attrs?e.attrs:{},e.singleton||"boolean"==typeof e.singleton||(e.singleton=a()),e.insertInto||(e.insertInto="head"),e.insertAt||(e.insertAt="bottom");var n=f(t,e);return d(n,e),function(t){for(var i=[],r=0;rArray.prototype.slice.call(t,0)));this.mark_data=n.map((t,n)=>{const i=Math.floor(n/e),r=n%e;return{row_num:i,row:this.rows[i],column:this.columns[r],column_num:r,color:t,_cell_num:n}}),this.identify_modes(),this.update_domains(),this.dirty=!1,this.trigger("data_updated")}update_domains(){if(!this.mark_data)return;const t=this.get("scales"),e=t.row,n=t.column,i=t.color;this.get("preserve_domain").row?e.del_domain([],this.model_id+"_row"):e.compute_and_set_domain(this.rows,this.model_id+"_row"),this.get("preserve_domain").column?n.del_domain([],this.model_id+"_column"):n.compute_and_set_domain(this.columns,this.model_id+"_column"),null!=i&&(this.get("preserve_domain").color?i.del_domain([],this.model_id+"_color"):i.compute_and_set_domain(this.mark_data.map(function(t){return t.color}),this.model_id+"_color"))}get_data_dict(t,e){return t}identify_modes(){const t={},e=this.get("scales"),n=e.row,i=e.column,r=this.colors.length,o=this.colors[0].length;"ordinal"===n.type?t.row="middle":r===this.rows.length-1?t.row="boundaries":r===this.rows.length?t.row="expand_one":r===this.rows.length+1&&(t.row="expand_two"),"ordinal"===i.type?t.column="middle":o===this.columns.length-1?t.column="boundaries":o===this.columns.length?t.column="expand_one":o===this.columns.length+1&&(t.column="expand_two"),this.modes=t}}s.serializers=Object.assign({},o.MarkModel.serializers,{row:a.array_or_json,column:a.array_or_json,color:a.array_or_json}),e.GridHeatMapModel=s},function(t,e,n){(function(t,e){!function(t,n){"use strict";if(!t.setImmediate){var i,r,o,a,s,c=1,l={},u=!1,h=t.document,d=Object.getPrototypeOf&&Object.getPrototypeOf(t);d=d&&d.setTimeout?d:t,"[object process]"==={}.toString.call(t.process)?i=function(t){e.nextTick(function(){p(t)})}:!function(){if(t.postMessage&&!t.importScripts){var e=!0,n=t.onmessage;return t.onmessage=function(){e=!1},t.postMessage("","*"),t.onmessage=n,e}}()?t.MessageChannel?((o=new MessageChannel).port1.onmessage=function(t){p(t.data)},i=function(t){o.port2.postMessage(t)}):h&&"onreadystatechange"in h.createElement("script")?(r=h.documentElement,i=function(t){var e=h.createElement("script");e.onreadystatechange=function(){p(t),e.onreadystatechange=null,r.removeChild(e),e=null},r.appendChild(e)}):i=function(t){setTimeout(p,0,t)}:(a="setImmediate$"+Math.random()+"$",s=function(e){e.source===t&&"string"==typeof e.data&&0===e.data.indexOf(a)&&p(+e.data.slice(a.length))},t.addEventListener?t.addEventListener("message",s,!1):t.attachEvent("onmessage",s),i=function(e){t.postMessage(a+e,"*")}),d.setImmediate=function(t){"function"!=typeof t&&(t=new Function(""+t));for(var e=new Array(arguments.length-1),n=0;n=n)){for(var i=t[e],r=e+1;r0;){var c=s>>1,l=a+c;n(t[l],e)<0?(a=l+1,s-=c+1):s=c}return a},t.upperBound=function(t,e,n,i,r){void 0===i&&(i=0),void 0===r&&(r=-1);var o=t.length;if(0===o)return 0;for(var a=i=i<0?Math.max(0,i+o):Math.min(i,o-1),s=(r=r<0?Math.max(0,r+o):Math.min(r,o-1))-i+1;s>0;){var c=s>>1,l=a+c;n(t[l],e)>0?s=c:(a=l+1,s-=c+1)}return a},t.move=function(t,e,n){var i=t.length;if(!(i<=1)&&(e=e<0?Math.max(0,e+i):Math.min(e,i-1))!==(n=n<0?Math.max(0,n+i):Math.min(n,i-1))){for(var r=t[e],o=e=(i=i<0?Math.max(0,i+r):Math.min(i,r-1)))){var a=i-n+1;if(e>0?e%=a:e<0&&(e=(e%a+a)%a),0!==e){var s=n+e;o(t,n,s-1),o(t,s,i),o(t,n,i)}}},t.fill=function(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=-1);var r=t.length;if(0!==r){var o;n=n<0?Math.max(0,n+r):Math.min(n,r-1),o=(i=i<0?Math.max(0,i+r):Math.min(i,r-1))e;--r)t[r]=t[r-1];t[e]=n},t.removeAt=a,t.removeFirstOf=function(t,n,i,r){void 0===i&&(i=0),void 0===r&&(r=-1);var o=e(t,n,i,r);return-1!==o&&a(t,o),o},t.removeLastOf=function(t,e,i,r){void 0===i&&(i=-1),void 0===r&&(r=0);var o=n(t,e,i,r);return-1!==o&&a(t,o),o},t.removeAllOf=function(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=-1);var r=t.length;if(0===r)return 0;n=n<0?Math.max(0,n+r):Math.min(n,r-1),i=i<0?Math.max(0,i+r):Math.min(i,r-1);for(var o=0,a=0;a=n&&a<=i&&t[a]===e?o++:i=n)&&t[a]===e?o++:o>0&&(t[a-o]=t[a]);return o>0&&(t.length=r-o),o},t.removeFirstWhere=function(t,e,n,r){var o;void 0===n&&(n=0),void 0===r&&(r=-1);var s=i(t,e,n,r);return-1!==s&&(o=a(t,s)),{index:s,value:o}},t.removeLastWhere=function(t,e,n,i){var o;void 0===n&&(n=-1),void 0===i&&(i=0);var s=r(t,e,n,i);return-1!==s&&(o=a(t,s)),{index:s,value:o}},t.removeAllWhere=function(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=-1);var r=t.length;if(0===r)return 0;n=n<0?Math.max(0,n+r):Math.min(n,r-1),i=i<0?Math.max(0,i+r):Math.min(i,r-1);for(var o=0,a=0;a=n&&a<=i&&e(t[a],a)?o++:i=n)&&e(t[a],a)?o++:o>0&&(t[a-o]=t[a]);return o>0&&(t.length=r-o),o}}(e.ArrayExt||(e.ArrayExt={}))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(29);e.chain=function(){for(var t=[],e=0;e0&&(o=r);return o}},e.minmax=function(t,e){var n=i.iter(t),r=n.next();if(void 0!==r){for(var o=r,a=r;void 0!==(r=n.next());)e(r,o)<0?o=r:e(r,a)>0&&(a=r);return[o,a]}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(29);e.map=function(t,e){return new r(i.iter(t),e)};var r=function(){function t(t,e){this._index=0,this._source=t,this._fn=e}return t.prototype.iter=function(){return this},t.prototype.clone=function(){var e=new t(this._source.clone(),this._fn);return e._index=this._index,e},t.prototype.next=function(){var t=this._source.next();if(void 0!==t)return this._fn.call(void 0,t,this._index++)},t}();e.MapIterator=r},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.range=function(t,e,n){return void 0===e?new r(0,t,1):new r(t,e,void 0===n?1:n)};var i,r=function(){function t(t,e,n){this._index=0,this._start=t,this._stop=e,this._step=n,this._length=i.rangeLength(t,e,n)}return t.prototype.iter=function(){return this},t.prototype.clone=function(){var e=new t(this._start,this._stop,this._step);return e._index=this._index,e},t.prototype.next=function(){if(!(this._index>=this._length))return this._start+this._step*this._index++},t}();e.RangeIterator=r,function(t){t.rangeLength=function(t,e,n){return 0===n?1/0:t>e&&n>0?0:t=this._source.length))return this._source[this._index--]},t}();e.RetroArrayIterator=i},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(29);e.topologicSort=function(t){var e=[],n=new Set,r=new Map;return i.each(t,function(t){var e=t[0],n=t[1],i=r.get(n);i?i.push(e):r.set(n,[e])}),r.forEach(function(t,e){o(e)}),e;function o(t){if(!n.has(t)){n.add(t);var i=r.get(t);i&&i.forEach(o),e.push(t)}}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(29);e.stride=function(t,e){return new r(i.iter(t),e)};var r=function(){function t(t,e){this._source=t,this._step=e}return t.prototype.iter=function(){return this},t.prototype.clone=function(){return new t(this._source.clone(),this._step)},t.prototype.next=function(){for(var t=this._source.next(),e=this._step-1;e>0;--e)this._source.next();return t},t}();e.StrideIterator=r},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){function e(t,e,n){void 0===n&&(n=0);for(var i=new Array(e.length),r=0,o=n,a=e.length;r=i.left&&e=i.top&&n=n.bottom||(i.topn.bottom&&i.height>=n.height?t.scrollTop-=n.top-i.top:i.topn.height?t.scrollTop-=n.bottom-i.bottom:i.bottom>n.bottom&&i.height0;)if(d(n))e++;else if(d(i))u++;else if(d(r))u++;else if(d(a))h++;else if(d(s))u++;else if(d(o))h++;else if(!d(c))return 0;return(e=Math.min(e,255))<<16|(u=Math.min(u,255))<<8|(h=Math.min(h,255))};var n=/^#[^\s\+>~#\.\[:]+/,i=/^\.[^\s\+>~#\.\[:]+/,r=/^\[[^\]]+\]/,o=/^[^\s\+>~#\.\[:]+/,a=/^(::[^\s\+>~#\.\[:]+|:first-line|:first-letter|:before|:after)/,s=/^:[^\s\+>~#\.\[:]+/,c=/^[\s\+>~\*]+/,l=/:not\(([^\)]+)\)/g}(i||(i={}))},function(t,e,n){"use strict";var i,r=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o,a=n(66),s=function(t){function e(e){void 0===e&&(e={});var n=t.call(this,{layout:o.createLayout(e)})||this;return n.addClass("p-BoxPanel"),n}return r(e,t),Object.defineProperty(e.prototype,"direction",{get:function(){return this.layout.direction},set:function(t){this.layout.direction=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"alignment",{get:function(){return this.layout.alignment},set:function(t){this.layout.alignment=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"spacing",{get:function(){return this.layout.spacing},set:function(t){this.layout.spacing=t},enumerable:!0,configurable:!0}),e.prototype.onChildAdded=function(t){t.child.addClass("p-BoxPanel-child")},e.prototype.onChildRemoved=function(t){t.child.removeClass("p-BoxPanel-child")},e}(n(52).Panel);e.BoxPanel=s,function(t){t.getStretch=function(t){return a.BoxLayout.getStretch(t)},t.setStretch=function(t,e){a.BoxLayout.setStretch(t,e)},t.getSizeBasis=function(t){return a.BoxLayout.getSizeBasis(t)},t.setSizeBasis=function(t,e){a.BoxLayout.setSizeBasis(t,e)}}(s=e.BoxPanel||(e.BoxPanel={})),e.BoxPanel=s,function(t){t.createLayout=function(t){return t.layout||new a.BoxLayout(t)}}(o||(o={}))},function(t,e,n){"use strict";var i,r=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),o=this&&this.__assign||function(){return(o=Object.assign||function(t){for(var e,n=1,i=arguments.length;n=i.length)n.scrollTop=0;else{var b=n.children[c];u.ElementExt.scrollIntoViewIfNeeded(n,b)}}else h.VirtualDOM.render(null,n)},e.prototype._evtClick=function(t){if(0===t.button){var e=s.ArrayExt.findFirstIndex(this.contentNode.children,function(e){return e.contains(t.target)});-1!==e&&(t.preventDefault(),t.stopPropagation(),this._execute(e))}},e.prototype._evtKeyDown=function(t){if(!(t.altKey||t.ctrlKey||t.metaKey||t.shiftKey))switch(t.keyCode){case 13:t.preventDefault(),t.stopPropagation(),this._execute(this._activeIndex);break;case 38:t.preventDefault(),t.stopPropagation(),this._activatePreviousItem();break;case 40:t.preventDefault(),t.stopPropagation(),this._activateNextItem()}},e.prototype._activateNextItem=function(){if(this._results&&0!==this._results.length){var t=this._activeIndex,e=this._results.length,n=t0?i-4:i,h=0;h>16&255,s[c++]=e>>8&255,s[c++]=255&e;2===a&&(e=r[t.charCodeAt(h)]<<2|r[t.charCodeAt(h+1)]>>4,s[c++]=255&e);1===a&&(e=r[t.charCodeAt(h)]<<10|r[t.charCodeAt(h+1)]<<4|r[t.charCodeAt(h+2)]>>2,s[c++]=e>>8&255,s[c++]=255&e);return s},e.fromByteArray=function(t){for(var e,n=t.length,r=n%3,o=[],a=0,s=n-r;as?s:a+16383));1===r?(e=t[n-1],o.push(i[e>>2]+i[e<<4&63]+"==")):2===r&&(e=(t[n-2]<<8)+t[n-1],o.push(i[e>>10]+i[e>>4&63]+i[e<<2&63]+"="));return o.join("")};for(var i=[],r=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,c=a.length;s0)throw new Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("=");return-1===n&&(n=e),[n,n===e?0:4-n%4]}function u(t,e,n){for(var r,o,a=[],s=e;s>18&63]+i[o>>12&63]+i[o>>6&63]+i[63&o]);return a.join("")}r["-".charCodeAt(0)]=62,r["_".charCodeAt(0)]=63},function(t,e){e.read=function(t,e,n,i,r){var o,a,s=8*r-i-1,c=(1<>1,u=-7,h=n?r-1:0,d=n?-1:1,f=t[e+h];for(h+=d,o=f&(1<<-u)-1,f>>=-u,u+=s;u>0;o=256*o+t[e+h],h+=d,u-=8);for(a=o&(1<<-u)-1,o>>=-u,u+=i;u>0;a=256*a+t[e+h],h+=d,u-=8);if(0===o)o=1-l;else{if(o===c)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,i),o-=l}return(f?-1:1)*a*Math.pow(2,o-i)},e.write=function(t,e,n,i,r,o){var a,s,c,l=8*o-r-1,u=(1<>1,d=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,f=i?0:o-1,p=i?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=u):(a=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-a))<1&&(a--,c*=2),(e+=a+h>=1?d/c:d*Math.pow(2,1-h))*c>=2&&(a++,c/=2),a+h>=u?(s=0,a=u):a+h>=1?(s=(e*c-1)*Math.pow(2,r),a+=h):(s=e*Math.pow(2,h-1)*Math.pow(2,r),a=0));r>=8;t[n+f]=255&s,f+=p,s/=256,r-=8);for(a=a<0;t[n+f]=255&a,f+=p,a/=256,l-=8);t[n+f-p]|=128*m}},function(t,e){},function(t,e,n){"use strict";var i=n(5).Buffer,r=n(186);t.exports=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.head=null,this.tail=null,this.length=0}return t.prototype.push=function(t){var e={data:t,next:null};this.length>0?this.tail.next=e:this.head=e,this.tail=e,++this.length},t.prototype.unshift=function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length},t.prototype.shift=function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}},t.prototype.clear=function(){this.head=this.tail=null,this.length=0},t.prototype.join=function(t){if(0===this.length)return"";for(var e=this.head,n=""+e.data;e=e.next;)n+=t+e.data;return n},t.prototype.concat=function(t){if(0===this.length)return i.alloc(0);if(1===this.length)return this.head.data;for(var e,n,r,o=i.allocUnsafe(t>>>0),a=this.head,s=0;a;)e=a.data,n=o,r=s,e.copy(n,r),s+=a.data.length,a=a.next;return o},t}(),r&&r.inspect&&r.inspect.custom&&(t.exports.prototype[r.inspect.custom]=function(){var t=r.inspect({length:this.length});return this.constructor.name+" "+t})},function(t,e){},function(t,e,n){(function(e){function n(t){try{if(!e.localStorage)return!1}catch(t){return!1}var n=e.localStorage[t];return null!=n&&"true"===String(n).toLowerCase()}t.exports=function(t,e){if(n("noDeprecation"))return t;var i=!1;return function(){if(!i){if(n("throwDeprecation"))throw new Error(e);n("traceDeprecation")?console.trace(e):console.warn(e),i=!0}return t.apply(this,arguments)}}}).call(this,n(25))},function(t,e,n){"use strict";t.exports=o;var i=n(99),r=n(44);function o(t){if(!(this instanceof o))return new o(t);i.call(this,t)}r.inherits=n(4),r.inherits(o,i),o.prototype._transform=function(t,e,n){n(null,t)}},function(t,e,n){t.exports=n(72)},function(t,e,n){t.exports=n(36)},function(t,e,n){t.exports=n(71).Transform},function(t,e,n){t.exports=n(71).PassThrough},function(t,e,n){var i=n(4),r=n(39),o=n(5).Buffer,a=[1518500249,1859775393,-1894007588,-899497514],s=new Array(80);function c(){this.init(),this._w=s,r.call(this,64,56)}function l(t){return t<<30|t>>>2}function u(t,e,n,i){return 0===t?e&n|~e&i:2===t?e&n|e&i|n&i:e^n^i}i(c,r),c.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},c.prototype._update=function(t){for(var e,n=this._w,i=0|this._a,r=0|this._b,o=0|this._c,s=0|this._d,c=0|this._e,h=0;h<16;++h)n[h]=t.readInt32BE(4*h);for(;h<80;++h)n[h]=n[h-3]^n[h-8]^n[h-14]^n[h-16];for(var d=0;d<80;++d){var f=~~(d/20),p=0|((e=i)<<5|e>>>27)+u(f,r,o,s)+c+n[d]+a[f];c=s,s=o,o=l(r),r=i,i=p}this._a=i+this._a|0,this._b=r+this._b|0,this._c=o+this._c|0,this._d=s+this._d|0,this._e=c+this._e|0},c.prototype._hash=function(){var t=o.allocUnsafe(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t},t.exports=c},function(t,e,n){var i=n(4),r=n(39),o=n(5).Buffer,a=[1518500249,1859775393,-1894007588,-899497514],s=new Array(80);function c(){this.init(),this._w=s,r.call(this,64,56)}function l(t){return t<<5|t>>>27}function u(t){return t<<30|t>>>2}function h(t,e,n,i){return 0===t?e&n|~e&i:2===t?e&n|e&i|n&i:e^n^i}i(c,r),c.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},c.prototype._update=function(t){for(var e,n=this._w,i=0|this._a,r=0|this._b,o=0|this._c,s=0|this._d,c=0|this._e,d=0;d<16;++d)n[d]=t.readInt32BE(4*d);for(;d<80;++d)n[d]=(e=n[d-3]^n[d-8]^n[d-14]^n[d-16])<<1|e>>>31;for(var f=0;f<80;++f){var p=~~(f/20),m=l(i)+h(p,r,o,s)+c+n[f]+a[p]|0;c=s,s=o,o=u(r),r=i,i=m}this._a=i+this._a|0,this._b=r+this._b|0,this._c=o+this._c|0,this._d=s+this._d|0,this._e=c+this._e|0},c.prototype._hash=function(){var t=o.allocUnsafe(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t},t.exports=c},function(t,e,n){var i=n(4),r=n(100),o=n(39),a=n(5).Buffer,s=new Array(64);function c(){this.init(),this._w=s,o.call(this,64,56)}i(c,r),c.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this},c.prototype._hash=function(){var t=a.allocUnsafe(28);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t},t.exports=c},function(t,e,n){var i=n(4),r=n(101),o=n(39),a=n(5).Buffer,s=new Array(160);function c(){this.init(),this._w=s,o.call(this,128,112)}i(c,r),c.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this},c.prototype._hash=function(){var t=a.allocUnsafe(48);function e(e,n,i){t.writeInt32BE(e,i),t.writeInt32BE(n,i+4)}return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),t},t.exports=c},function(t,e,n){"use strict";var i=n(4),r=n(5).Buffer,o=n(35),a=r.alloc(128),s=64;function c(t,e){o.call(this,"digest"),"string"==typeof e&&(e=r.from(e)),this._alg=t,this._key=e,e.length>s?e=t(e):e.length>>0},e.writeUInt32BE=function(t,e,n){t[0+n]=e>>>24,t[1+n]=e>>>16&255,t[2+n]=e>>>8&255,t[3+n]=255&e},e.ip=function(t,e,n,i){for(var r=0,o=0,a=6;a>=0;a-=2){for(var s=0;s<=24;s+=8)r<<=1,r|=e>>>s+a&1;for(s=0;s<=24;s+=8)r<<=1,r|=t>>>s+a&1}for(a=6;a>=0;a-=2){for(s=1;s<=25;s+=8)o<<=1,o|=e>>>s+a&1;for(s=1;s<=25;s+=8)o<<=1,o|=t>>>s+a&1}n[i+0]=r>>>0,n[i+1]=o>>>0},e.rip=function(t,e,n,i){for(var r=0,o=0,a=0;a<4;a++)for(var s=24;s>=0;s-=8)r<<=1,r|=e>>>s+a&1,r<<=1,r|=t>>>s+a&1;for(a=4;a<8;a++)for(s=24;s>=0;s-=8)o<<=1,o|=e>>>s+a&1,o<<=1,o|=t>>>s+a&1;n[i+0]=r>>>0,n[i+1]=o>>>0},e.pc1=function(t,e,n,i){for(var r=0,o=0,a=7;a>=5;a--){for(var s=0;s<=24;s+=8)r<<=1,r|=e>>s+a&1;for(s=0;s<=24;s+=8)r<<=1,r|=t>>s+a&1}for(s=0;s<=24;s+=8)r<<=1,r|=e>>s+a&1;for(a=1;a<=3;a++){for(s=0;s<=24;s+=8)o<<=1,o|=e>>s+a&1;for(s=0;s<=24;s+=8)o<<=1,o|=t>>s+a&1}for(s=0;s<=24;s+=8)o<<=1,o|=t>>s+a&1;n[i+0]=r>>>0,n[i+1]=o>>>0},e.r28shl=function(t,e){return t<>>28-e};var i=[14,11,17,4,27,23,25,0,13,22,7,18,5,9,16,24,2,20,12,21,1,8,15,26,15,4,25,19,9,1,26,16,5,11,23,8,12,7,17,0,22,3,10,14,6,20,27,24];e.pc2=function(t,e,n,r){for(var o=0,a=0,s=i.length>>>1,c=0;c>>i[c]&1;for(c=s;c>>i[c]&1;n[r+0]=o>>>0,n[r+1]=a>>>0},e.expand=function(t,e,n){var i=0,r=0;i=(1&t)<<5|t>>>27;for(var o=23;o>=15;o-=4)i<<=6,i|=t>>>o&63;for(o=11;o>=3;o-=4)r|=t>>>o&63,r<<=6;r|=(31&t)<<1|t>>>31,e[n+0]=i>>>0,e[n+1]=r>>>0};var r=[14,0,4,15,13,7,1,4,2,14,15,2,11,13,8,1,3,10,10,6,6,12,12,11,5,9,9,5,0,3,7,8,4,15,1,12,14,8,8,2,13,4,6,9,2,1,11,7,15,5,12,11,9,3,7,14,3,10,10,0,5,6,0,13,15,3,1,13,8,4,14,7,6,15,11,2,3,8,4,14,9,12,7,0,2,1,13,10,12,6,0,9,5,11,10,5,0,13,14,8,7,10,11,1,10,3,4,15,13,4,1,2,5,11,8,6,12,7,6,12,9,0,3,5,2,14,15,9,10,13,0,7,9,0,14,9,6,3,3,4,15,6,5,10,1,2,13,8,12,5,7,14,11,12,4,11,2,15,8,1,13,1,6,10,4,13,9,0,8,6,15,9,3,8,0,7,11,4,1,15,2,14,12,3,5,11,10,5,14,2,7,12,7,13,13,8,14,11,3,5,0,6,6,15,9,0,10,3,1,4,2,7,8,2,5,12,11,1,12,10,4,14,15,9,10,3,6,15,9,0,0,6,12,10,11,1,7,13,13,8,15,9,1,4,3,5,14,11,5,12,2,7,8,2,4,14,2,14,12,11,4,2,1,12,7,4,10,7,11,13,6,1,8,5,5,0,3,15,15,10,13,3,0,9,14,8,9,6,4,11,2,8,1,12,11,7,10,1,13,14,7,2,8,13,15,6,9,15,12,0,5,9,6,10,3,4,0,5,14,3,12,10,1,15,10,4,15,2,9,7,2,12,6,9,8,5,0,6,13,1,3,13,4,14,14,0,7,11,5,3,11,8,9,4,14,3,15,2,5,12,2,9,8,5,12,15,3,10,7,11,0,14,4,1,10,7,1,6,13,0,11,8,6,13,4,13,11,0,2,11,14,7,15,4,0,9,8,1,13,10,3,14,12,3,9,5,7,12,5,2,10,15,6,8,1,6,1,6,4,11,11,13,13,8,12,1,3,4,7,10,14,7,10,9,15,5,6,0,8,15,0,14,5,2,9,3,2,12,13,1,2,15,8,13,4,8,6,10,15,3,11,7,1,4,10,12,9,5,3,6,14,11,5,0,0,14,12,9,7,2,7,2,11,1,4,14,1,7,9,4,12,10,14,8,2,13,0,15,6,12,10,9,13,0,15,3,3,5,5,6,8,11];e.substitute=function(t,e){for(var n=0,i=0;i<4;i++){n<<=4,n|=r[64*i+(t>>>18-6*i&63)]}for(i=0;i<4;i++){n<<=4,n|=r[256+64*i+(e>>>18-6*i&63)]}return n>>>0};var o=[16,25,12,11,3,20,4,15,31,17,9,6,27,14,1,22,30,24,8,18,0,5,29,23,13,19,2,26,10,21,28,7];e.permute=function(t){for(var e=0,n=0;n>>o[n]&1;return e>>>0},e.padSplit=function(t,e,n){for(var i=t.toString(2);i.length0;i--)e+=this._buffer(t,e),n+=this._flushBuffer(r,n);return e+=this._buffer(t,e),r},r.prototype.final=function(t){var e,n;return t&&(e=this.update(t)),n="encrypt"===this.type?this._finalEncrypt():this._finalDecrypt(),e?e.concat(n):n},r.prototype._pad=function(t,e){if(0===e)return!1;for(;e>>1];n=a.r28shl(n,s),r=a.r28shl(r,s),a.pc2(n,r,t.keys,o)}},l.prototype._update=function(t,e,n,i){var r=this._desState,o=a.readUInt32BE(t,e),s=a.readUInt32BE(t,e+4);a.ip(o,s,r.tmp,0),o=r.tmp[0],s=r.tmp[1],"encrypt"===this.type?this._encrypt(r,o,s,r.tmp,0):this._decrypt(r,o,s,r.tmp,0),o=r.tmp[0],s=r.tmp[1],a.writeUInt32BE(n,o,i),a.writeUInt32BE(n,s,i+4)},l.prototype._pad=function(t,e){for(var n=t.length-e,i=e;i>>0,o=d}a.rip(s,o,i,r)},l.prototype._decrypt=function(t,e,n,i,r){for(var o=n,s=e,c=t.keys.length-2;c>=0;c-=2){var l=t.keys[c],u=t.keys[c+1];a.expand(o,t.tmp,0),l^=t.tmp[0],u^=t.tmp[1];var h=a.substitute(l,u),d=o;o=(s^a.permute(h))>>>0,s=d}a.rip(o,s,i,r)}},function(t,e,n){"use strict";var i=n(22),r=n(4),o={};function a(t){i.equal(t.length,8,"Invalid IV length"),this.iv=new Array(8);for(var e=0;e15){var t=this.cache.slice(0,16);return this.cache=this.cache.slice(16),t}return null},d.prototype.flush=function(){for(var t=16-this.cache.length,e=o.allocUnsafe(t),n=-1;++n>a%8,t._prev=o(t._prev,n?i:r);return s}function o(t,e){var n=t.length,r=-1,o=i.allocUnsafe(t.length);for(t=i.concat([t,i.from([e])]);++r>7;return o}e.encrypt=function(t,e,n){for(var o=e.length,a=i.allocUnsafe(o),s=-1;++s>>0,0),e.writeUInt32BE(t[1]>>>0,4),e.writeUInt32BE(t[2]>>>0,8),e.writeUInt32BE(t[3]>>>0,12),e}function a(t){this.h=t,this.state=i.alloc(16,0),this.cache=i.allocUnsafe(0)}a.prototype.ghash=function(t){for(var e=-1;++e0;e--)i[e]=i[e]>>>1|(1&i[e-1])<<31;i[0]=i[0]>>>1,n&&(i[0]=i[0]^225<<24)}this.state=o(r)},a.prototype.update=function(t){var e;for(this.cache=i.concat([this.cache,t]);this.cache.length>=16;)e=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(e)},a.prototype.final=function(t,e){return this.cache.length&&this.ghash(i.concat([this.cache,r],16)),this.ghash(o([0,t,0,e])),this.state},t.exports=a},function(t,e,n){var i=n(112),r=n(5).Buffer,o=n(78),a=n(113),s=n(35),c=n(55),l=n(56);function u(t,e,n){s.call(this),this._cache=new h,this._last=void 0,this._cipher=new c.AES(e),this._prev=r.from(n),this._mode=t,this._autopadding=!0}function h(){this.cache=r.allocUnsafe(0)}function d(t,e,n){var s=o[t.toLowerCase()];if(!s)throw new TypeError("invalid suite type");if("string"==typeof n&&(n=r.from(n)),"GCM"!==s.mode&&n.length!==s.iv)throw new TypeError("invalid iv length "+n.length);if("string"==typeof e&&(e=r.from(e)),e.length!==s.key/8)throw new TypeError("invalid key length "+e.length);return"stream"===s.type?new a(s.module,e,n,!0):"auth"===s.type?new i(s.module,e,n,!0):new u(s.module,e,n)}n(4)(u,s),u.prototype._update=function(t){var e,n;this._cache.add(t);for(var i=[];e=this._cache.get(this._autopadding);)n=this._mode.decrypt(this,e),i.push(n);return r.concat(i)},u.prototype._final=function(){var t=this._cache.flush();if(this._autopadding)return function(t){var e=t[15];if(e<1||e>16)throw new Error("unable to decrypt data");var n=-1;for(;++n16)return e=this.cache.slice(0,16),this.cache=this.cache.slice(16),e}else if(this.cache.length>=16)return e=this.cache.slice(0,16),this.cache=this.cache.slice(16),e;return null},h.prototype.flush=function(){if(this.cache.length)return this.cache},e.createDecipher=function(t,e){var n=o[t.toLowerCase()];if(!n)throw new TypeError("invalid suite type");var i=l(e,!1,n.key,n.iv);return d(t,i.key,i.iv)},e.createDecipheriv=d},function(t,e){e["des-ecb"]={key:8,iv:0},e["des-cbc"]=e.des={key:8,iv:8},e["des-ede3-cbc"]=e.des3={key:24,iv:8},e["des-ede3"]={key:24,iv:0},e["des-ede-cbc"]={key:16,iv:8},e["des-ede"]={key:16,iv:0}},function(t,e,n){(function(t){var i=n(114),r=n(220),o=n(221);var a={binary:!0,hex:!0,base64:!0};e.DiffieHellmanGroup=e.createDiffieHellmanGroup=e.getDiffieHellman=function(e){var n=new t(r[e].prime,"hex"),i=new t(r[e].gen,"hex");return new o(n,i)},e.createDiffieHellman=e.DiffieHellman=function e(n,r,s,c){return t.isBuffer(r)||void 0===a[r]?e(n,"binary",r,s):(r=r||"binary",c=c||"binary",s=s||new t([2]),t.isBuffer(s)||(s=new t(s,c)),"number"==typeof n?new o(i(n,s),s,!0):(t.isBuffer(n)||(n=new t(n,r)),new o(n,s,!0)))}}).call(this,n(15).Buffer)},function(t,e){},function(t,e){},function(t){t.exports=JSON.parse('{"modp1":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff"},"modp2":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff"},"modp5":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff"},"modp14":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff"},"modp15":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff"},"modp16":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff"},"modp17":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff"},"modp18":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff"}}')},function(t,e,n){(function(e){var i=n(11),r=new(n(115)),o=new i(24),a=new i(11),s=new i(10),c=new i(3),l=new i(7),u=n(114),h=n(38);function d(t,n){return n=n||"utf8",e.isBuffer(t)||(t=new e(t,n)),this._pub=new i(t),this}function f(t,n){return n=n||"utf8",e.isBuffer(t)||(t=new e(t,n)),this._priv=new i(t),this}t.exports=m;var p={};function m(t,e,n){this.setGenerator(e),this.__prime=new i(t),this._prime=i.mont(this.__prime),this._primeLen=t.length,this._pub=void 0,this._priv=void 0,this._primeCode=void 0,n?(this.setPublicKey=d,this.setPrivateKey=f):this._primeCode=8}function g(t,n){var i=new e(t.toArray());return n?i.toString(n):i}Object.defineProperty(m.prototype,"verifyError",{enumerable:!0,get:function(){return"number"!=typeof this._primeCode&&(this._primeCode=function(t,e){var n=e.toString("hex"),i=[n,t.toString(16)].join("_");if(i in p)return p[i];var h,d=0;if(t.isEven()||!u.simpleSieve||!u.fermatTest(t)||!r.test(t))return d+=1,d+="02"===n||"05"===n?8:4,p[i]=d,d;switch(r.test(t.shrn(1))||(d+=2),n){case"02":t.mod(o).cmp(a)&&(d+=8);break;case"05":(h=t.mod(s)).cmp(c)&&h.cmp(l)&&(d+=8);break;default:d+=4}return p[i]=d,d}(this.__prime,this.__gen)),this._primeCode}}),m.prototype.generateKeys=function(){return this._priv||(this._priv=new i(h(this._primeLen))),this._pub=this._gen.toRed(this._prime).redPow(this._priv).fromRed(),this.getPublicKey()},m.prototype.computeSecret=function(t){var n=(t=(t=new i(t)).toRed(this._prime)).redPow(this._priv).fromRed(),r=new e(n.toArray()),o=this.getPrime();if(r.length0&&n.ishrn(i),n}function h(t,n,r){var o,a;do{for(o=new e(0);8*o.length=0;){var o;if(r.isOdd()){var a=r.andln(i-1);o=a>(i>>1)-1?(i>>1)-a:a,r.isubn(o)}else o=0;n.push(o);for(var s=0!==r.cmpn(0)&&0===r.andln(i-1)?e+1:1,c=1;c0||e.cmpn(-r)>0;){var o,a,s,c=t.andln(3)+i&3,l=e.andln(3)+r&3;3===c&&(c=-1),3===l&&(l=-1),o=0==(1&c)?0:3!=(s=t.andln(7)+i&7)&&5!==s||2!==l?c:-c,n[0].push(o),a=0==(1&l)?0:3!=(s=e.andln(7)+r&7)&&5!==s||2!==c?l:-l,n[1].push(a),2*i===o+1&&(i=1-i),2*r===a+1&&(r=1-r),t.iushrn(1),e.iushrn(1)}return n},i.cachedProperty=function(t,e,n){var i="_"+e;t.prototype[e]=function(){return void 0!==this[i]?this[i]:this[i]=n.call(this)}},i.parseBytes=function(t){return"string"==typeof t?i.toArray(t,"hex"):t},i.intFromLE=function(t){return new r(t,"hex","le")}},function(t,e,n){"use strict";var i=n(11),r=n(20).utils,o=r.getNAF,a=r.getJSF,s=r.assert;function c(t,e){this.type=t,this.p=new i(e.p,16),this.red=e.prime?i.red(e.prime):i.mont(this.p),this.zero=new i(0).toRed(this.red),this.one=new i(1).toRed(this.red),this.two=new i(2).toRed(this.red),this.n=e.n&&new i(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4);var n=this.n&&this.p.div(this.n);!n||n.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function l(t,e){this.curve=t,this.type=e,this.precomputed=null}t.exports=c,c.prototype.point=function(){throw new Error("Not implemented")},c.prototype.validate=function(){throw new Error("Not implemented")},c.prototype._fixedNafMul=function(t,e){s(t.precomputed);var n=t._getDoubles(),i=o(e,1),r=(1<=c;e--)l=(l<<1)+i[e];a.push(l)}for(var u=this.jpoint(null,null,null),h=this.jpoint(null,null,null),d=r;d>0;d--){for(c=0;c=0;l--){for(e=0;l>=0&&0===a[l];l--)e++;if(l>=0&&e++,c=c.dblp(e),l<0)break;var u=a[l];s(0!==u),c="affine"===t.type?u>0?c.mixedAdd(r[u-1>>1]):c.mixedAdd(r[-u-1>>1].neg()):u>0?c.add(r[u-1>>1]):c.add(r[-u-1>>1].neg())}return"affine"===t.type?c.toP():c},c.prototype._wnafMulAdd=function(t,e,n,i,r){for(var s=this._wnafT1,c=this._wnafT2,l=this._wnafT3,u=0,h=0;h=1;h-=2){var f=h-1,p=h;if(1===s[f]&&1===s[p]){var m=[e[f],null,null,e[p]];0===e[f].y.cmp(e[p].y)?(m[1]=e[f].add(e[p]),m[2]=e[f].toJ().mixedAdd(e[p].neg())):0===e[f].y.cmp(e[p].y.redNeg())?(m[1]=e[f].toJ().mixedAdd(e[p]),m[2]=e[f].add(e[p].neg())):(m[1]=e[f].toJ().mixedAdd(e[p]),m[2]=e[f].toJ().mixedAdd(e[p].neg()));var g=[-3,-1,-5,-7,0,7,5,1,3],_=a(n[f],n[p]);u=Math.max(_[0].length,u),l[f]=new Array(u),l[p]=new Array(u);for(var v=0;v=0;h--){for(var M=0;h>=0;){var E=!0;for(v=0;v=0&&M++,x=x.dblp(M),h<0)break;for(v=0;v0?S=c[v][A-1>>1]:A<0&&(S=c[v][-A-1>>1].neg()),x="affine"===S.type?x.mixedAdd(S):x.add(S))}}for(h=0;h=Math.ceil((t.bitLength()+1)/e.step)},l.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],i=this,r=0;r=0&&(a=e,s=n),i.negative&&(i=i.neg(),r=r.neg()),a.negative&&(a=a.neg(),s=s.neg()),[{a:i,b:r},{a:a,b:s}]},l.prototype._endoSplit=function(t){var e=this.endo.basis,n=e[0],i=e[1],r=i.b.mul(t).divRound(this.n),o=n.b.neg().mul(t).divRound(this.n),a=r.mul(n.a),s=o.mul(i.a),c=r.mul(n.b),l=o.mul(i.b);return{k1:t.sub(a).sub(s),k2:c.add(l).neg()}},l.prototype.pointFromX=function(t,e){(t=new o(t,16)).red||(t=t.toRed(this.red));var n=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),i=n.redSqrt();if(0!==i.redSqr().redSub(n).cmp(this.zero))throw new Error("invalid point");var r=i.fromRed().isOdd();return(e&&!r||!e&&r)&&(i=i.redNeg()),this.point(t,i)},l.prototype.validate=function(t){if(t.inf)return!0;var e=t.x,n=t.y,i=this.a.redMul(e),r=e.redSqr().redMul(e).redIAdd(i).redIAdd(this.b);return 0===n.redSqr().redISub(r).cmpn(0)},l.prototype._endoWnafMulAdd=function(t,e,n){for(var i=this._endoWnafT1,r=this._endoWnafT2,o=0;o":""},u.prototype.isInfinity=function(){return this.inf},u.prototype.add=function(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(0===this.x.cmp(t.x))return this.curve.point(null,null);var e=this.y.redSub(t.y);0!==e.cmpn(0)&&(e=e.redMul(this.x.redSub(t.x).redInvm()));var n=e.redSqr().redISub(this.x).redISub(t.x),i=e.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,i)},u.prototype.dbl=function(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(0===t.cmpn(0))return this.curve.point(null,null);var e=this.curve.a,n=this.x.redSqr(),i=t.redInvm(),r=n.redAdd(n).redIAdd(n).redIAdd(e).redMul(i),o=r.redSqr().redISub(this.x.redAdd(this.x)),a=r.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)},u.prototype.getX=function(){return this.x.fromRed()},u.prototype.getY=function(){return this.y.fromRed()},u.prototype.mul=function(t){return t=new o(t,16),this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)},u.prototype.mulAdd=function(t,e,n){var i=[this,e],r=[t,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,r):this.curve._wnafMulAdd(1,i,r,2)},u.prototype.jmulAdd=function(t,e,n){var i=[this,e],r=[t,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,r,!0):this.curve._wnafMulAdd(1,i,r,2,!0)},u.prototype.eq=function(t){return this===t||this.inf===t.inf&&(this.inf||0===this.x.cmp(t.x)&&0===this.y.cmp(t.y))},u.prototype.neg=function(t){if(this.inf)return this;var e=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var n=this.precomputed,i=function(t){return t.neg()};e.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(i)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(i)}}}return e},u.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},a(h,s.BasePoint),l.prototype.jpoint=function(t,e,n){return new h(this,t,e,n)},h.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),e=t.redSqr(),n=this.x.redMul(e),i=this.y.redMul(e).redMul(t);return this.curve.point(n,i)},h.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},h.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.z.redSqr(),n=this.z.redSqr(),i=this.x.redMul(e),r=t.x.redMul(n),o=this.y.redMul(e.redMul(t.z)),a=t.y.redMul(n.redMul(this.z)),s=i.redSub(r),c=o.redSub(a);if(0===s.cmpn(0))return 0!==c.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var l=s.redSqr(),u=l.redMul(s),h=i.redMul(l),d=c.redSqr().redIAdd(u).redISub(h).redISub(h),f=c.redMul(h.redISub(d)).redISub(o.redMul(u)),p=this.z.redMul(t.z).redMul(s);return this.curve.jpoint(d,f,p)},h.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var e=this.z.redSqr(),n=this.x,i=t.x.redMul(e),r=this.y,o=t.y.redMul(e).redMul(this.z),a=n.redSub(i),s=r.redSub(o);if(0===a.cmpn(0))return 0!==s.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=a.redSqr(),l=c.redMul(a),u=n.redMul(c),h=s.redSqr().redIAdd(l).redISub(u).redISub(u),d=s.redMul(u.redISub(h)).redISub(r.redMul(l)),f=this.z.redMul(a);return this.curve.jpoint(h,d,f)},h.prototype.dblp=function(t){if(0===t)return this;if(this.isInfinity())return this;if(!t)return this.dbl();if(this.curve.zeroA||this.curve.threeA){for(var e=this,n=0;n=0)return!1;if(n.redIAdd(r),0===this.x.cmp(n))return!0}},h.prototype.inspect=function(){return this.isInfinity()?"":""},h.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},function(t,e,n){"use strict";var i=n(57),r=n(11),o=n(4),a=i.base,s=n(20).utils;function c(t){a.call(this,"mont",t),this.a=new r(t.a,16).toRed(this.red),this.b=new r(t.b,16).toRed(this.red),this.i4=new r(4).toRed(this.red).redInvm(),this.two=new r(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function l(t,e,n){a.BasePoint.call(this,t,"projective"),null===e&&null===n?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new r(e,16),this.z=new r(n,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}o(c,a),t.exports=c,c.prototype.validate=function(t){var e=t.normalize().x,n=e.redSqr(),i=n.redMul(e).redAdd(n.redMul(this.a)).redAdd(e);return 0===i.redSqrt().redSqr().cmp(i)},o(l,a.BasePoint),c.prototype.decodePoint=function(t,e){return this.point(s.toArray(t,e),1)},c.prototype.point=function(t,e){return new l(this,t,e)},c.prototype.pointFromJSON=function(t){return l.fromJSON(this,t)},l.prototype.precompute=function(){},l.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},l.fromJSON=function(t,e){return new l(t,e[0],e[1]||t.one)},l.prototype.inspect=function(){return this.isInfinity()?"":""},l.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},l.prototype.dbl=function(){var t=this.x.redAdd(this.z).redSqr(),e=this.x.redSub(this.z).redSqr(),n=t.redSub(e),i=t.redMul(e),r=n.redMul(e.redAdd(this.curve.a24.redMul(n)));return this.curve.point(i,r)},l.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},l.prototype.diffAdd=function(t,e){var n=this.x.redAdd(this.z),i=this.x.redSub(this.z),r=t.x.redAdd(t.z),o=t.x.redSub(t.z).redMul(n),a=r.redMul(i),s=e.z.redMul(o.redAdd(a).redSqr()),c=e.x.redMul(o.redISub(a).redSqr());return this.curve.point(s,c)},l.prototype.mul=function(t){for(var e=t.clone(),n=this,i=this.curve.point(null,null),r=[];0!==e.cmpn(0);e.iushrn(1))r.push(e.andln(1));for(var o=r.length-1;o>=0;o--)0===r[o]?(n=n.diffAdd(i,this),i=i.dbl()):(i=n.diffAdd(i,this),n=n.dbl());return i},l.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},l.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},l.prototype.eq=function(t){return 0===this.getX().cmp(t.getX())},l.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},l.prototype.getX=function(){return this.normalize(),this.x.fromRed()}},function(t,e,n){"use strict";var i=n(57),r=n(20),o=n(11),a=n(4),s=i.base,c=r.utils.assert;function l(t){this.twisted=1!=(0|t.a),this.mOneA=this.twisted&&-1==(0|t.a),this.extended=this.mOneA,s.call(this,"edwards",t),this.a=new o(t.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new o(t.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new o(t.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),c(!this.twisted||0===this.c.fromRed().cmpn(1)),this.oneC=1==(0|t.c)}function u(t,e,n,i,r){s.BasePoint.call(this,t,"projective"),null===e&&null===n&&null===i?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new o(e,16),this.y=new o(n,16),this.z=i?new o(i,16):this.curve.one,this.t=r&&new o(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}a(l,s),t.exports=l,l.prototype._mulA=function(t){return this.mOneA?t.redNeg():this.a.redMul(t)},l.prototype._mulC=function(t){return this.oneC?t:this.c.redMul(t)},l.prototype.jpoint=function(t,e,n,i){return this.point(t,e,n,i)},l.prototype.pointFromX=function(t,e){(t=new o(t,16)).red||(t=t.toRed(this.red));var n=t.redSqr(),i=this.c2.redSub(this.a.redMul(n)),r=this.one.redSub(this.c2.redMul(this.d).redMul(n)),a=i.redMul(r.redInvm()),s=a.redSqrt();if(0!==s.redSqr().redSub(a).cmp(this.zero))throw new Error("invalid point");var c=s.fromRed().isOdd();return(e&&!c||!e&&c)&&(s=s.redNeg()),this.point(t,s)},l.prototype.pointFromY=function(t,e){(t=new o(t,16)).red||(t=t.toRed(this.red));var n=t.redSqr(),i=n.redSub(this.c2),r=n.redMul(this.d).redMul(this.c2).redSub(this.a),a=i.redMul(r.redInvm());if(0===a.cmp(this.zero)){if(e)throw new Error("invalid point");return this.point(this.zero,t)}var s=a.redSqrt();if(0!==s.redSqr().redSub(a).cmp(this.zero))throw new Error("invalid point");return s.fromRed().isOdd()!==e&&(s=s.redNeg()),this.point(s,t)},l.prototype.validate=function(t){if(t.isInfinity())return!0;t.normalize();var e=t.x.redSqr(),n=t.y.redSqr(),i=e.redMul(this.a).redAdd(n),r=this.c2.redMul(this.one.redAdd(this.d.redMul(e).redMul(n)));return 0===i.cmp(r)},a(u,s.BasePoint),l.prototype.pointFromJSON=function(t){return u.fromJSON(this,t)},l.prototype.point=function(t,e,n,i){return new u(this,t,e,n,i)},u.fromJSON=function(t,e){return new u(t,e[0],e[1],e[2])},u.prototype.inspect=function(){return this.isInfinity()?"":""},u.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},u.prototype._extDbl=function(){var t=this.x.redSqr(),e=this.y.redSqr(),n=this.z.redSqr();n=n.redIAdd(n);var i=this.curve._mulA(t),r=this.x.redAdd(this.y).redSqr().redISub(t).redISub(e),o=i.redAdd(e),a=o.redSub(n),s=i.redSub(e),c=r.redMul(a),l=o.redMul(s),u=r.redMul(s),h=a.redMul(o);return this.curve.point(c,l,h,u)},u.prototype._projDbl=function(){var t,e,n,i=this.x.redAdd(this.y).redSqr(),r=this.x.redSqr(),o=this.y.redSqr();if(this.curve.twisted){var a=(l=this.curve._mulA(r)).redAdd(o);if(this.zOne)t=i.redSub(r).redSub(o).redMul(a.redSub(this.curve.two)),e=a.redMul(l.redSub(o)),n=a.redSqr().redSub(a).redSub(a);else{var s=this.z.redSqr(),c=a.redSub(s).redISub(s);t=i.redSub(r).redISub(o).redMul(c),e=a.redMul(l.redSub(o)),n=a.redMul(c)}}else{var l=r.redAdd(o);s=this.curve._mulC(this.z).redSqr(),c=l.redSub(s).redSub(s);t=this.curve._mulC(i.redISub(l)).redMul(c),e=this.curve._mulC(l).redMul(r.redISub(o)),n=l.redMul(c)}return this.curve.point(t,e,n)},u.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},u.prototype._extAdd=function(t){var e=this.y.redSub(this.x).redMul(t.y.redSub(t.x)),n=this.y.redAdd(this.x).redMul(t.y.redAdd(t.x)),i=this.t.redMul(this.curve.dd).redMul(t.t),r=this.z.redMul(t.z.redAdd(t.z)),o=n.redSub(e),a=r.redSub(i),s=r.redAdd(i),c=n.redAdd(e),l=o.redMul(a),u=s.redMul(c),h=o.redMul(c),d=a.redMul(s);return this.curve.point(l,u,d,h)},u.prototype._projAdd=function(t){var e,n,i=this.z.redMul(t.z),r=i.redSqr(),o=this.x.redMul(t.x),a=this.y.redMul(t.y),s=this.curve.d.redMul(o).redMul(a),c=r.redSub(s),l=r.redAdd(s),u=this.x.redAdd(this.y).redMul(t.x.redAdd(t.y)).redISub(o).redISub(a),h=i.redMul(c).redMul(u);return this.curve.twisted?(e=i.redMul(l).redMul(a.redSub(this.curve._mulA(o))),n=c.redMul(l)):(e=i.redMul(l).redMul(a.redSub(o)),n=this.curve._mulC(c).redMul(l)),this.curve.point(h,e,n)},u.prototype.add=function(t){return this.isInfinity()?t:t.isInfinity()?this:this.curve.extended?this._extAdd(t):this._projAdd(t)},u.prototype.mul=function(t){return this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve._wnafMul(this,t)},u.prototype.mulAdd=function(t,e,n){return this.curve._wnafMulAdd(1,[this,e],[t,n],2,!1)},u.prototype.jmulAdd=function(t,e,n){return this.curve._wnafMulAdd(1,[this,e],[t,n],2,!0)},u.prototype.normalize=function(){if(this.zOne)return this;var t=this.z.redInvm();return this.x=this.x.redMul(t),this.y=this.y.redMul(t),this.t&&(this.t=this.t.redMul(t)),this.z=this.curve.one,this.zOne=!0,this},u.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},u.prototype.getX=function(){return this.normalize(),this.x.fromRed()},u.prototype.getY=function(){return this.normalize(),this.y.fromRed()},u.prototype.eq=function(t){return this===t||0===this.getX().cmp(t.getX())&&0===this.getY().cmp(t.getY())},u.prototype.eqXToP=function(t){var e=t.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(e))return!0;for(var n=t.clone(),i=this.curve.redN.redMul(this.z);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(e.redIAdd(i),0===this.x.cmp(e))return!0}},u.prototype.toP=u.prototype.normalize,u.prototype.mixedAdd=u.prototype.add},function(t,e,n){"use strict";var i,r=e,o=n(80),a=n(20),s=a.utils.assert;function c(t){"short"===t.type?this.curve=new a.curve.short(t):"edwards"===t.type?this.curve=new a.curve.edwards(t):this.curve=new a.curve.mont(t),this.g=this.curve.g,this.n=this.curve.n,this.hash=t.hash,s(this.g.validate(),"Invalid curve"),s(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function l(t,e){Object.defineProperty(r,t,{configurable:!0,enumerable:!0,get:function(){var n=new c(e);return Object.defineProperty(r,t,{configurable:!0,enumerable:!0,value:n}),n}})}r.PresetCurve=c,l("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:o.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),l("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:o.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),l("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:o.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),l("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:o.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),l("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:o.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),l("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["9"]}),l("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{i=n(237)}catch(t){i=void 0}l("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:o.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",i]})},function(t,e,n){"use strict";e.sha1=n(232),e.sha224=n(233),e.sha256=n(119),e.sha384=n(234),e.sha512=n(120)},function(t,e,n){"use strict";var i=n(30),r=n(46),o=n(118),a=i.rotl32,s=i.sum32,c=i.sum32_5,l=o.ft_1,u=r.BlockHash,h=[1518500249,1859775393,2400959708,3395469782];function d(){if(!(this instanceof d))return new d;u.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}i.inherits(d,u),t.exports=d,d.blockSize=512,d.outSize=160,d.hmacStrength=80,d.padLength=64,d.prototype._update=function(t,e){for(var n=this.W,i=0;i<16;i++)n[i]=t[e+i];for(;ithis.blockSize&&(t=(new this.Hash).update(t).digest()),r(t.length<=this.blockSize);for(var e=t.length;e0))return s.iaddn(1),this.keyFromPrivate(s)}},l.prototype._truncateToN=function(t,e){var n=8*t.byteLength()-this.n.bitLength();return n>0&&(t=t.ushrn(n)),!e&&t.cmp(this.n)>=0?t.sub(this.n):t},l.prototype.sign=function(t,e,n,o){"object"==typeof n&&(o=n,n=null),o||(o={}),e=this.keyFromPrivate(e,n),t=this._truncateToN(new i(t,16));for(var a=this.n.byteLength(),s=e.getPrivate().toArray("be",a),l=t.toArray("be",a),u=new r({hash:this.hash,entropy:s,nonce:l,pers:o.pers,persEnc:o.persEnc||"utf8"}),h=this.n.sub(new i(1)),d=0;;d++){var f=o.k?o.k(d):new i(u.generate(this.n.byteLength()));if(!((f=this._truncateToN(f,!0)).cmpn(1)<=0||f.cmp(h)>=0)){var p=this.g.mul(f);if(!p.isInfinity()){var m=p.getX(),g=m.umod(this.n);if(0!==g.cmpn(0)){var _=f.invm(this.n).mul(g.mul(e.getPrivate()).iadd(t));if(0!==(_=_.umod(this.n)).cmpn(0)){var v=(p.getY().isOdd()?1:0)|(0!==m.cmp(g)?2:0);return o.canonical&&_.cmp(this.nh)>0&&(_=this.n.sub(_),v^=1),new c({r:g,s:_,recoveryParam:v})}}}}}},l.prototype.verify=function(t,e,n,r){t=this._truncateToN(new i(t,16)),n=this.keyFromPublic(n,r);var o=(e=new c(e,"hex")).r,a=e.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;if(a.cmpn(1)<0||a.cmp(this.n)>=0)return!1;var s,l=a.invm(this.n),u=l.mul(t).umod(this.n),h=l.mul(o).umod(this.n);return this.curve._maxwellTrick?!(s=this.g.jmulAdd(u,n.getPublic(),h)).isInfinity()&&s.eqXToP(o):!(s=this.g.mulAdd(u,n.getPublic(),h)).isInfinity()&&0===s.getX().umod(this.n).cmp(o)},l.prototype.recoverPubKey=function(t,e,n,r){a((3&n)===n,"The recovery param is more than two bits"),e=new c(e,r);var o=this.n,s=new i(t),l=e.r,u=e.s,h=1&n,d=n>>1;if(l.cmp(this.curve.p.umod(this.curve.n))>=0&&d)throw new Error("Unable to find sencond key candinate");l=d?this.curve.pointFromX(l.add(this.curve.n),h):this.curve.pointFromX(l,h);var f=e.r.invm(o),p=o.sub(s).mul(f).umod(o),m=u.mul(f).umod(o);return this.g.mulAdd(p,l,m)},l.prototype.getKeyRecoveryParam=function(t,e,n,i){if(null!==(e=new c(e,i)).recoveryParam)return e.recoveryParam;for(var r=0;r<4;r++){var o;try{o=this.recoverPubKey(t,e,r)}catch(t){continue}if(o.eq(n))return r}throw new Error("Unable to find valid recovery factor")}},function(t,e,n){"use strict";var i=n(80),r=n(117),o=n(22);function a(t){if(!(this instanceof a))return new a(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=r.toArray(t.entropy,t.entropyEnc||"hex"),n=r.toArray(t.nonce,t.nonceEnc||"hex"),i=r.toArray(t.pers,t.persEnc||"hex");o(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,n,i)}t.exports=a,a.prototype._init=function(t,e,n){var i=t.concat(e).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var r=0;r=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(n||[])),this._reseed=1},a.prototype.generate=function(t,e,n,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof e&&(i=n,n=e,e=null),n&&(n=r.toArray(n,i||"hex"),this._update(n));for(var o=[];o.length"}},function(t,e,n){"use strict";var i=n(11),r=n(20).utils,o=r.assert;function a(t,e){if(t instanceof a)return t;this._importDER(t,e)||(o(t.r&&t.s,"Signature without r or s"),this.r=new i(t.r,16),this.s=new i(t.s,16),void 0===t.recoveryParam?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}function s(){this.place=0}function c(t,e){var n=t[e.place++];if(!(128&n))return n;for(var i=15&n,r=0,o=0,a=e.place;o>>3);for(t.push(128|n);--n;)t.push(e>>>(n<<3)&255);t.push(e)}}t.exports=a,a.prototype._importDER=function(t,e){t=r.toArray(t,e);var n=new s;if(48!==t[n.place++])return!1;if(c(t,n)+n.place!==t.length)return!1;if(2!==t[n.place++])return!1;var o=c(t,n),a=t.slice(n.place,o+n.place);if(n.place+=o,2!==t[n.place++])return!1;var l=c(t,n);if(t.length!==l+n.place)return!1;var u=t.slice(n.place,l+n.place);return 0===a[0]&&128&a[1]&&(a=a.slice(1)),0===u[0]&&128&u[1]&&(u=u.slice(1)),this.r=new i(a),this.s=new i(u),this.recoveryParam=null,!0},a.prototype.toDER=function(t){var e=this.r.toArray(),n=this.s.toArray();for(128&e[0]&&(e=[0].concat(e)),128&n[0]&&(n=[0].concat(n)),e=l(e),n=l(n);!(n[0]||128&n[1]);)n=n.slice(1);var i=[2];u(i,e.length),(i=i.concat(e)).push(2),u(i,n.length);var o=i.concat(n),a=[48];return u(a,o.length),a=a.concat(o),r.encode(a,t)}},function(t,e,n){"use strict";var i=n(80),r=n(20),o=r.utils,a=o.assert,s=o.parseBytes,c=n(243),l=n(244);function u(t){if(a("ed25519"===t,"only tested with ed25519 so far"),!(this instanceof u))return new u(t);t=r.curves[t].curve;this.curve=t,this.g=t.g,this.g.precompute(t.n.bitLength()+1),this.pointClass=t.point().constructor,this.encodingLength=Math.ceil(t.n.bitLength()/8),this.hash=i.sha512}t.exports=u,u.prototype.sign=function(t,e){t=s(t);var n=this.keyFromSecret(e),i=this.hashInt(n.messagePrefix(),t),r=this.g.mul(i),o=this.encodePoint(r),a=this.hashInt(o,n.pubBytes(),t).mul(n.priv()),c=i.add(a).umod(this.curve.n);return this.makeSignature({R:r,S:c,Rencoded:o})},u.prototype.verify=function(t,e,n){t=s(t),e=this.makeSignature(e);var i=this.keyFromPublic(n),r=this.hashInt(e.Rencoded(),i.pubBytes(),t),o=this.g.mul(e.S());return e.R().add(i.pub().mul(r)).eq(o)},u.prototype.hashInt=function(){for(var t=this.hash(),e=0;e=e)throw new Error("invalid sig")}t.exports=function(t,n,c,l,u){var h=o(c);if("ec"===h.type){if("ecdsa"!==l&&"ecdsa/rsa"!==l)throw new Error("wrong public key type");return function(t,e,n){var i=a[n.data.algorithm.curve.join(".")];if(!i)throw new Error("unknown curve "+n.data.algorithm.curve.join("."));var o=new r(i),s=n.data.subjectPrivateKey.data;return o.verify(e,t,s)}(t,n,h)}if("dsa"===h.type){if("dsa"!==l)throw new Error("wrong public key type");return function(t,e,n){var r=n.data.p,a=n.data.q,c=n.data.g,l=n.data.pub_key,u=o.signature.decode(t,"der"),h=u.s,d=u.r;s(h,a),s(d,a);var f=i.mont(r),p=h.invm(a);return 0===c.toRed(f).redPow(new i(e).mul(p).mod(a)).fromRed().mul(l.toRed(f).redPow(d.mul(p).mod(a)).fromRed()).mod(r).mod(a).cmp(d)}(t,n,h)}if("rsa"!==l&&"ecdsa/rsa"!==l)throw new Error("wrong public key type");n=e.concat([u,n]);for(var d=h.modulus.byteLength(),f=[1],p=0;n.length+f.length+2n-d-2)throw new Error("message too long");var f=h.alloc(n-i-d-2),p=n-u-1,m=r(u),g=s(h.concat([l,f,h.alloc(1,1),e],p),a(m,p)),_=s(m,a(g,u));return new c(h.concat([h.alloc(1),_,g],n))}(p,e);else if(1===d)f=function(t,e,n){var i,o=e.length,a=t.modulus.byteLength();if(o>a-11)throw new Error("message too long");i=n?h.alloc(a-o-3,255):function(t){var e,n=h.allocUnsafe(t),i=0,o=r(2*t),a=0;for(;i=0)throw new Error("data too long for modulus")}return n?u(f,p):l(f,p)}},function(t,e,n){var i=n(58),r=n(126),o=n(127),a=n(11),s=n(79),c=n(43),l=n(128),u=n(5).Buffer;t.exports=function(t,e,n){var h;h=t.padding?t.padding:n?1:4;var d,f=i(t),p=f.modulus.byteLength();if(e.length>p||new a(e).cmp(f.modulus)>=0)throw new Error("decryption error");d=n?l(new a(e),f):s(e,f);var m=u.alloc(p-d.length);if(d=u.concat([m,d],p),4===h)return function(t,e){var n=t.modulus.byteLength(),i=c("sha1").update(u.alloc(0)).digest(),a=i.length;if(0!==e[0])throw new Error("decryption error");var s=e.slice(1,a+1),l=e.slice(a+1),h=o(s,r(l,a)),d=o(l,r(h,n-a-1));if(function(t,e){t=u.from(t),e=u.from(e);var n=0,i=t.length;t.length!==e.length&&(n++,i=Math.min(t.length,e.length));var r=-1;for(;++r=e.length){o++;break}var a=e.slice(2,r-1);("0002"!==i.toString("hex")&&!n||"0001"!==i.toString("hex")&&n)&&o++;a.length<8&&o++;if(o)throw new Error("decryption error");return e.slice(r)}(0,d,n);if(3===h)return d;throw new Error("unknown padding")}},function(t,e,n){"use strict";(function(t,i){function r(){throw new Error("secure random number generation not supported by this browser\nuse chrome, FireFox or Internet Explorer 11")}var o=n(5),a=n(38),s=o.Buffer,c=o.kMaxLength,l=t.crypto||t.msCrypto,u=Math.pow(2,32)-1;function h(t,e){if("number"!=typeof t||t!=t)throw new TypeError("offset must be a number");if(t>u||t<0)throw new TypeError("offset must be a uint32");if(t>c||t>e)throw new RangeError("offset out of range")}function d(t,e,n){if("number"!=typeof t||t!=t)throw new TypeError("size must be a number");if(t>u||t<0)throw new TypeError("size must be a uint32");if(t+e>n||t>c)throw new RangeError("buffer too small")}function f(t,e,n,r){if(i.browser){var o=t.buffer,s=new Uint8Array(o,e,n);return l.getRandomValues(s),r?void i.nextTick(function(){r(null,t)}):t}if(!r)return a(n).copy(t,e),t;a(n,function(n,i){if(n)return r(n);i.copy(t,e),r(null,t)})}l&&l.getRandomValues||!i.browser?(e.randomFill=function(e,n,i,r){if(!(s.isBuffer(e)||e instanceof t.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');if("function"==typeof n)r=n,n=0,i=e.length;else if("function"==typeof i)r=i,i=e.length-n;else if("function"!=typeof r)throw new TypeError('"cb" argument must be a function');return h(n,e.length),d(i,n,e.length),f(e,n,i,r)},e.randomFillSync=function(e,n,i){void 0===n&&(n=0);if(!(s.isBuffer(e)||e instanceof t.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');h(n,e.length),void 0===i&&(i=e.length-n);return d(i,n,e.length),f(e,n,i)}):(e.randomFill=r,e.randomFillSync=r)}).call(this,n(25),n(33))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(t){this.name=t,this._tokenStructuralPropertyT=null};e.Token=i},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(93);!function(t){t.uuid4=function(){for(var t=new Uint8Array(16),e=new Array(256),n=0;n<16;++n)e[n]="0"+n.toString(16);for(n=16;n<256;++n)e[n]=n.toString(16);return function(){return i.Random.getRandomValues(t),t[6]=64|15&t[6],t[8]=128|63&t[8],e[t[0]]+e[t[1]]+e[t[2]]+e[t[3]]+"-"+e[t[4]]+e[t[5]]+"-"+e[t[6]]+e[t[7]]+"-"+e[t[8]]+e[t[9]]+"-"+e[t[10]]+e[t[11]]+e[t[12]]+e[t[13]]+e[t[14]]+e[t[15]]}}()}(e.UUID||(e.UUID={}))},function(t,e,n){"use strict";var i=this&&this.__assign||function(){return(i=Object.assign||function(t){for(var e,n=1,i=arguments.length;n_&&p>_&&f>v&&m>v)return{zone:"widget-all",target:h};switch(d/=_,f/=v,p/=_,m/=v,Math.min(d,f,p,m)){case d:g="widget-left";break;case f:g="widget-top";break;case p:g="widget-right";break;case m:g="widget-bottom";break;default:throw"unreachable"}return{zone:g,target:h}},t.getDropRef=function(t){return 0===t.titles.length?null:t.currentTitle?t.currentTitle.owner:t.titles[t.titles.length-1].owner}}(o||(o={}))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(9),r=n(21),o=function(){function t(){this._counter=0,this._widgets=[],this._activeWidget=null,this._currentWidget=null,this._numbers=new Map,this._nodes=new Map,this._activeChanged=new r.Signal(this),this._currentChanged=new r.Signal(this)}return t.prototype.dispose=function(){var t=this;this._counter<0||(this._counter=-1,r.Signal.clearData(this),i.each(this._widgets,function(e){e.node.removeEventListener("focus",t,!0),e.node.removeEventListener("blur",t,!0)}),this._activeWidget=null,this._currentWidget=null,this._nodes.clear(),this._numbers.clear(),this._widgets.length=0)},Object.defineProperty(t.prototype,"currentChanged",{get:function(){return this._currentChanged},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"activeChanged",{get:function(){return this._activeChanged},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isDisposed",{get:function(){return this._counter<0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"currentWidget",{get:function(){return this._currentWidget},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"activeWidget",{get:function(){return this._activeWidget},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"widgets",{get:function(){return this._widgets},enumerable:!0,configurable:!0}),t.prototype.focusNumber=function(t){var e=this._numbers.get(t);return void 0===e?-1:e},t.prototype.has=function(t){return this._numbers.has(t)},t.prototype.add=function(t){if(!this._numbers.has(t)){var e=t.node.contains(document.activeElement),n=e?this._counter++:-1;this._widgets.push(t),this._numbers.set(t,n),this._nodes.set(t.node,t),t.node.addEventListener("focus",this,!0),t.node.addEventListener("blur",this,!0),t.disposed.connect(this._onWidgetDisposed,this),e&&this._setWidgets(t,t)}},t.prototype.remove=function(t){var e=this;if(this._numbers.has(t)&&(t.disposed.disconnect(this._onWidgetDisposed,this),t.node.removeEventListener("focus",this,!0),t.node.removeEventListener("blur",this,!0),i.ArrayExt.removeFirstOf(this._widgets,t),this._nodes.delete(t.node),this._numbers.delete(t),this._currentWidget===t)){var n=i.filter(this._widgets,function(t){return-1!==e._numbers.get(t)}),r=i.max(n,function(t,n){return e._numbers.get(t)-e._numbers.get(n)})||null;this._setWidgets(r,null)}},t.prototype.handleEvent=function(t){switch(t.type){case"focus":this._evtFocus(t);break;case"blur":this._evtBlur(t)}},t.prototype._setWidgets=function(t,e){var n=this._currentWidget;this._currentWidget=t;var i=this._activeWidget;this._activeWidget=e,n!==t&&this._currentChanged.emit({oldValue:n,newValue:t}),i!==e&&this._activeChanged.emit({oldValue:i,newValue:e})},t.prototype._evtFocus=function(t){var e=this._nodes.get(t.currentTarget);e!==this._currentWidget&&this._numbers.set(e,this._counter++),this._setWidgets(e,e)},t.prototype._evtBlur=function(t){var e=this._nodes.get(t.currentTarget),n=t.relatedTarget;n&&(e.node.contains(n)||i.find(this._widgets,function(t){return t.node.contains(n)}))||this._setWidgets(this._currentWidget,null)},t.prototype._onWidgetDisposed=function(t){this.remove(t)},t}();e.FocusTracker=o},function(t,e,n){"use strict";var i,r=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o,a=n(9),s=n(16),c=n(14),l=n(37),u=n(41),h=n(34),d=n(13),f=function(t){function e(e){void 0===e&&(e={});var n=t.call(this,e)||this;return n._dirty=!1,n._rowSpacing=4,n._columnSpacing=4,n._items=[],n._rowStarts=[],n._columnStarts=[],n._rowSizers=[new u.BoxSizer],n._columnSizers=[new u.BoxSizer],n._box=null,void 0!==e.rowCount&&o.reallocSizers(n._rowSizers,e.rowCount),void 0!==e.columnCount&&o.reallocSizers(n._columnSizers,e.columnCount),void 0!==e.rowSpacing&&(n._rowSpacing=o.clampValue(e.rowSpacing)),void 0!==e.columnSpacing&&(n._columnSpacing=o.clampValue(e.columnSpacing)),n}return r(e,t),e.prototype.dispose=function(){a.each(this._items,function(t){var e=t.widget;t.dispose(),e.dispose()}),this._box=null,this._items.length=0,this._rowStarts.length=0,this._rowSizers.length=0,this._columnStarts.length=0,this._columnSizers.length=0,t.prototype.dispose.call(this)},Object.defineProperty(e.prototype,"rowCount",{get:function(){return this._rowSizers.length},set:function(t){t!==this.rowCount&&(o.reallocSizers(this._rowSizers,t),this.parent&&this.parent.fit())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"columnCount",{get:function(){return this._columnSizers.length},set:function(t){t!==this.columnCount&&(o.reallocSizers(this._columnSizers,t),this.parent&&this.parent.fit())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rowSpacing",{get:function(){return this._rowSpacing},set:function(t){t=o.clampValue(t),this._rowSpacing!==t&&(this._rowSpacing=t,this.parent&&this.parent.fit())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"columnSpacing",{get:function(){return this._columnSpacing},set:function(t){t=o.clampValue(t),this._columnSpacing!==t&&(this._columnSpacing=t,this.parent&&this.parent.fit())},enumerable:!0,configurable:!0}),e.prototype.rowStretch=function(t){var e=this._rowSizers[t];return e?e.stretch:-1},e.prototype.setRowStretch=function(t,e){var n=this._rowSizers[t];n&&(e=o.clampValue(e),n.stretch!==e&&(n.stretch=e,this.parent&&this.parent.update()))},e.prototype.columnStretch=function(t){var e=this._columnSizers[t];return e?e.stretch:-1},e.prototype.setColumnStretch=function(t,e){var n=this._columnSizers[t];n&&(e=o.clampValue(e),n.stretch!==e&&(n.stretch=e,this.parent&&this.parent.update()))},e.prototype.iter=function(){return a.map(this._items,function(t){return t.widget})},e.prototype.addWidget=function(t){-1===a.ArrayExt.findFirstIndex(this._items,function(e){return e.widget===t})&&(this._items.push(new h.LayoutItem(t)),this.parent&&this.attachWidget(t))},e.prototype.removeWidget=function(t){var e=a.ArrayExt.findFirstIndex(this._items,function(e){return e.widget===t});if(-1===e){var n=a.ArrayExt.removeAt(this._items,e);this.parent&&this.detachWidget(t),n.dispose()}},e.prototype.init=function(){var e=this;t.prototype.init.call(this),a.each(this,function(t){e.attachWidget(t)})},e.prototype.attachWidget=function(t){this.parent.isAttached&&c.MessageLoop.sendMessage(t,d.Widget.Msg.BeforeAttach),this.parent.node.appendChild(t.node),this.parent.isAttached&&c.MessageLoop.sendMessage(t,d.Widget.Msg.AfterAttach),this.parent.fit()},e.prototype.detachWidget=function(t){this.parent.isAttached&&c.MessageLoop.sendMessage(t,d.Widget.Msg.BeforeDetach),this.parent.node.removeChild(t.node),this.parent.isAttached&&c.MessageLoop.sendMessage(t,d.Widget.Msg.AfterDetach),this.parent.fit()},e.prototype.onBeforeShow=function(e){t.prototype.onBeforeShow.call(this,e),this.parent.update()},e.prototype.onBeforeAttach=function(e){t.prototype.onBeforeAttach.call(this,e),this.parent.fit()},e.prototype.onChildShown=function(t){this.parent.fit()},e.prototype.onChildHidden=function(t){this.parent.fit()},e.prototype.onResize=function(t){this.parent.isVisible&&this._update(t.width,t.height)},e.prototype.onUpdateRequest=function(t){this.parent.isVisible&&this._update(-1,-1)},e.prototype.onFitRequest=function(t){this.parent.isAttached&&this._fit()},e.prototype._fit=function(){for(var t=0,n=this.rowCount;t=i)){var a=(i-r)/(n-e+1);for(o=e;o<=n;++o)t[o].minSize+=a}}else{var s=t[e];s.minSize=Math.max(s.minSize,i)}}}(o||(o={}))},function(t,e,n){"use strict";var i,r=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o,a=n(9),s=n(16),c=n(82),l=n(14),u=n(59),h=n(13),d=function(t){function e(n){void 0===n&&(n={});var i=t.call(this,{node:o.createNode()})||this;return i._activeIndex=-1,i._menus=[],i._childMenu=null,i.addClass("p-MenuBar"),i.setFlag(h.Widget.Flag.DisallowLayout),i.renderer=n.renderer||e.defaultRenderer,i}return r(e,t),e.prototype.dispose=function(){this._closeChildMenu(),this._menus.length=0,t.prototype.dispose.call(this)},Object.defineProperty(e.prototype,"childMenu",{get:function(){return this._childMenu},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"contentNode",{get:function(){return this.node.getElementsByClassName("p-MenuBar-content")[0]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"activeMenu",{get:function(){return this._menus[this._activeIndex]||null},set:function(t){this.activeIndex=t?this._menus.indexOf(t):-1},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"activeIndex",{get:function(){return this._activeIndex},set:function(t){(t<0||t>=this._menus.length)&&(t=-1),this._activeIndex!==t&&(this._activeIndex=t,this.update())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"menus",{get:function(){return this._menus},enumerable:!0,configurable:!0}),e.prototype.openActiveMenu=function(){-1!==this._activeIndex&&(this._openChildMenu(),this._childMenu&&(this._childMenu.activeIndex=-1,this._childMenu.activateNextItem()))},e.prototype.addMenu=function(t){this.insertMenu(this._menus.length,t)},e.prototype.insertMenu=function(t,e){this._closeChildMenu();var n=this._menus.indexOf(e),i=Math.max(0,Math.min(t,this._menus.length));if(-1===n)return a.ArrayExt.insert(this._menus,i,e),e.addClass("p-MenuBar-menu"),e.aboutToClose.connect(this._onMenuAboutToClose,this),e.menuRequested.connect(this._onMenuMenuRequested,this),e.title.changed.connect(this._onTitleChanged,this),void this.update();i===this._menus.length&&i--,n!==i&&(a.ArrayExt.move(this._menus,n,i),this.update())},e.prototype.removeMenu=function(t){this.removeMenuAt(this._menus.indexOf(t))},e.prototype.removeMenuAt=function(t){this._closeChildMenu();var e=a.ArrayExt.removeAt(this._menus,t);e&&(e.aboutToClose.disconnect(this._onMenuAboutToClose,this),e.menuRequested.disconnect(this._onMenuMenuRequested,this),e.title.changed.disconnect(this._onTitleChanged,this),e.removeClass("p-MenuBar-menu"),this.update())},e.prototype.clearMenus=function(){if(0!==this._menus.length){this._closeChildMenu();for(var t=0,e=this._menus;t=n.length)return n;var r=n.slice(0,i),o=n.slice(i+1),a=n[i];return[r,u.h.span({className:"p-MenuBar-itemMnemonic"},a),o]},t}();t.Renderer=e,t.defaultRenderer=new e}(d=e.MenuBar||(e.MenuBar={})),e.MenuBar=d,function(t){t.createNode=function(){var t=document.createElement("div"),e=document.createElement("ul");return e.className="p-MenuBar-content",t.appendChild(e),t.tabIndex=-1,t},t.findMnemonic=function(t,e,n){for(var i=-1,r=-1,o=!1,a=e.toUpperCase(),s=0,c=t.length;s=0&&h{this.d3el.on("mousedown",()=>this.mousedown()),this.set_limits()}),this.update_line_index(),this.listenTo(this.model,"change:line_index",this.update_line_index),this.model.on_some_change(["min_x","max_x"],this.set_limits,this)}set_lines_view(){const t=this.parent,e=this.model.get("lines");return Promise.all(t.mark_views.views).then(n=>{const i=t.mark_views._models.map(t=>t.model_id).indexOf(e.model_id);this.lines_view=n[i]})}mousedown(){this.active=!0,this.mouse_entry(!1),this.d3el.on("mousemove",()=>{this.mousemove()}),this.d3el.on("mouseleave",()=>{this.mouseup()}),this.d3el.on("mouseup",()=>{this.mouseup()})}mouseup(){if(this.active){this.mouse_entry(!0);const t=this.model.get("lines");t.set("y",s(o.deepCopy(t.y_data))),this.lines_view.touch(),this.active=!1,this.d3el.on("mousemove",null),this.d3el.on("mouseleave",null),this.d3el.on("mouseup",null)}}mousemove(){this.mouse_entry(!0)}mouse_entry(t){if(this.active){const e=this.model.get("lines"),n=Math.min(this.line_index,e.x_data.length-1),i=r.mouse(this.el);t&&"previous_pos"in this||(this.previous_pos=i);const o=this.lines_view.scales.x.scale,a=this.lines_view.scales.y.scale,s=o.invert(i[0]),c=a.invert(i[1]),l=o.invert(this.previous_pos[0]);a.invert(this.previous_pos[1]);const u=this.nns(e.x_data[n],l),h=this.nns(e.x_data[n],s),d=Math.min(u,h),f=Math.max(u,h);for(let t=d;t<=f;++t)(!this.valid_min||e.x_data[n][t]>=this.min_x)&&(!this.valid_max||e.x_data[n][t]<=this.max_x)&&(e.y_data[this.line_index][t]=c);const p=e.x_data[n].map((t,n)=>({x:t,y:e.y_data[this.line_index][n]}));this.lines_view.d3el.select("#curve"+(this.line_index+1)).attr("d",function(t){return this.lines_view.line(p)}.bind(this)),this.previous_pos=i}}capnfloor(t){return Math.max(Math.min(t,this.model.get("max_x")),this.model.get("min_x"))}set_limits(){"date"==this.lines_view.scales.x.model.type?(this.min_x=o.getDate(this.model.get("min_x")),this.valid_min=!(null===this.min_x||void 0===this.min_x||isNaN(this.min_x.getTime())),this.max_x=o.getDate(this.model.get("max_x")),this.valid_max=!(null===this.max_x||void 0===this.max_x||isNaN(this.max_x.getTime()))):(this.min_x=this.model.get("min_x"),this.max_x=this.model.get("max_x"),this.valid_min=!(null===this.min_x||void 0===this.min_x),this.valid_max=!(null===this.max_x||void 0===this.max_x))}nns(t,e){const n=this.lines_view.bisect(t,e);return e-t[n-1]>t[n]-e?n:n-1}update_line_index(){this.line_index=this.model.get("line_index")}}},function(t,e,n){"use strict";var i=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e};Object.defineProperty(e,"__esModule",{value:!0});const r=i(n(2));n(31);const o=function(){return n(0).event}.bind(this),a=i(n(6)),s=n(19);e.Bars=class extends s.Mark{render(){const t=super.render.apply(this);return this.set_internal_scales(),this.selected_indices=this.model.get("selected"),this.selected_style=this.model.get("selected_style"),this.unselected_style=this.model.get("unselected_style"),this.display_el_classes=["bar","legendtext"],this.displayed.then(()=>{this.parent.tooltip_div.node().appendChild(this.tooltip_div.node()),this.create_tooltip()}),t.then(()=>{this.event_listeners={},this.process_interactions(),this.create_listeners(),this.compute_view_padding(),this.draw()})}set_scale_orientation(){this.dom_scale=this.scales.x,this.range_scale=this.scales.y}set_ranges(){const t=this.model.get("orientation");this.set_scale_orientation();const e=this.dom_scale,n=this.range_scale,i="vertical"===t?"x":"y",r="vertical"===t?"y":"x";"ordinal"!==e.model.type?e.set_range(this.parent.padded_range(i,e.model)):e.set_range(this.parent.padded_range(i,e.model),this.model.get("padding")),n.set_range(this.parent.padded_range(r,n.model)),this.dom_offset=0,this.range_offset="vertical"===t?n.offset:-n.offset}set_positional_scales(){const t=this.scales.x,e=this.scales.y;this.listenTo(t,"domain_changed",function(){this.model.dirty||this.draw()}),this.listenTo(e,"domain_changed",function(){this.model.dirty||this.draw()})}set_internal_scales(){this.x=r.scaleBand(),this.x1=r.scaleBand()}adjust_offset(){"ordinal"!==this.dom_scale.model.type?"center"===this.model.get("align")?this.dom_offset=-(this.x.bandwidth()/2).toFixed(2):"left"===this.model.get("align")?this.dom_offset=-this.x.bandwidth().toFixed(2):this.dom_offset=0:"center"===this.model.get("align")?this.dom_offset=0:"left"===this.model.get("align")?this.dom_offset=-this.x.bandwidth()/2:this.dom_offset=this.x.bandwidth()/2}create_listeners(){super.create_listeners.apply(this),this.d3el.on("mouseover",a.bind(function(){this.event_dispatcher("mouse_over")},this)).on("mousemove",a.bind(function(){this.event_dispatcher("mouse_move")},this)).on("mouseout",a.bind(function(){this.event_dispatcher("mouse_out")},this)),this.listenTo(this.model,"data_updated",function(){this.draw(!0)}),this.listenTo(this.model,"change:colors",this.update_colors),this.listenTo(this.model,"colors_updated",this.update_colors),this.listenTo(this.model,"change:type",this.update_type),this.listenTo(this.model,"change:align",this.relayout),this.listenTo(this.model,"change:padding",this.relayout),this.listenTo(this.model,"change:orientation",this.relayout),this.listenTo(this.model,"change:tooltip",this.create_tooltip),this.model.on_some_change(["stroke","opacities","fill","stroke_width"],this.apply_styles,this),this.listenTo(this.model,"change:selected",this.update_selected),this.listenTo(this.model,"change:interactions",this.process_interactions),this.listenTo(this.parent,"bg_clicked",function(){this.event_dispatcher("parent_clicked")}),this.model.on_some_change(["label_display_format","label_font_style","label_display","label_display_vertical_offset","label_display_horizontal_offset"],this.draw,this)}process_click(t){super.process_click(t),"select"===t&&(this.event_listeners.parent_clicked=this.reset_selection,this.event_listeners.element_clicked=this.bar_click_handler)}draw_zero_line(){this.set_scale_orientation();const t=this.range_scale;"vertical"===this.model.get("orientation")?this.d3el.select(".zeroLine").attr("x1",0).attr("x2",this.parent.plotarea_width).attr("y1",t.scale(this.model.base_value)).attr("y2",t.scale(this.model.base_value)):this.d3el.select(".zeroLine").attr("x1",t.scale(this.model.base_value)).attr("x2",t.scale(this.model.base_value)).attr("y1",0).attr("y2",this.parent.plotarea_height)}relayout(){this.set_ranges(),this.compute_view_padding(),this.draw_zero_line(),this.x.rangeRound(this.set_x_range()),this.x.padding(this.model.get("padding")),this.adjust_offset(),this.x1.rangeRound([0,this.x.bandwidth().toFixed(2)]),this.draw_bars()}invert_point(t){if(void 0===t)return this.model.set("selected",null),void this.touch();const e=this.x_pixels.map(function(e){return Math.abs(e-t)});this.model.set("selected",new Uint32Array([e.indexOf(r.min(e))])),this.touch()}selector_changed(t,e){if(void 0===t)return this.model.set("selected",null),this.touch(),[];const n=this.pixel_coords,i=new Uint32Array(a.range(n.length)).filter(t=>{let i=n[t];for(let t=0;t0&&this.x1.domain(a.range(this.model.mark_data[0].values.length)).rangeRound([0,this.x.bandwidth().toFixed(2)]),n.exit().remove(),(n=n.enter().append("g").attr("class","bargroup").merge(n)).order(),n.on("click",function(t,n){return e.event_dispatcher("element_clicked",{data:t,index:n})});const r=n.selectAll(".bar").data(function(t){return t.values});if(r.enter().append("rect").attr("class","bar").attr("width",0).attr("height",0),r.exit().remove(),this.model.get("label_display")||n.selectAll("text").remove(),this.model.get("label_display")){const t=n.selectAll(".bar_label").data(function(t){return t.values});t.exit().remove(),t.enter().append("text").attr("class","bar_label").attr("width",0).attr("height",0)}this.draw_bars(t),this.apply_styles(),this.d3el.selectAll(".zeroLine").remove(),this.d3el.append("g").append("line").attr("class","zeroLine"),this.draw_zero_line()}draw_bars(t){const e=this.d3el.selectAll(".bargroup"),n=e.selectAll(".bar"),i=!0===t?this.parent.model.get("animation_duration"):0,o=!0===t?"update_bars":"draw_bars",a=this,s=this.model.get("orientation"),c=this.dom_scale,l=this.range_scale,u="vertical"===s?"x":"y",h="vertical"===s?"y":"x",d="vertical"===s?"width":"height",f="vertical"===s?"height":"width";if("ordinal"===c.model.type){const t=r.max(this.parent.range(u));e.attr("transform",function(e){return"vertical"===s?"translate("+((void 0!==c.scale(e.key)?c.scale(e.key):t)+a.dom_offset)+", 0)":"translate(0, "+((void 0!==c.scale(e.key)?c.scale(e.key):t)+a.dom_offset)+")"})}else e.attr("transform",function(t){return"vertical"===s?"translate("+(c.scale(t.key)+a.dom_offset)+", 0)":"translate(0, "+(c.scale(t.key)+a.dom_offset)+")"});const p="stacked"===this.model.get("type");let m=1;p?(m=Math.max(1,this.x.bandwidth()),n.transition(o).duration(i).attr(u,0).attr(d,m.toFixed(2)).attr(h,function(t){return"y"===h?l.scale(t.y1):l.scale(t.y0)}).attr(f,function(t){return Math.abs(l.scale(t.y1+t.y_ref)-l.scale(t.y1))})):(m=Math.max(1,this.x1.bandwidth()),n.transition(o).duration(i).attr(u,function(t,e){return a.x1(e)}).attr(d,m.toFixed(2)).attr(h,function(t){return r.min([l.scale(t.y),l.scale(a.model.base_value)])}).attr(f,function(t){return Math.abs(l.scale(a.model.base_value)-l.scale(t.y))})),this.manageBarLabels(e,m,u,h),this.pixel_coords=this.model.mark_data.map(function(t){const e=t.key,n=c.scale(e)+a.dom_offset;return t.values.map(function(t){const e={};return e[u]=p?n:n+a.x1(t.sub_index),e[h]=p?"y"===h?l.scale(t.y1):l.scale(t.y0):r.min([l.scale(t.y),l.scale(a.model.base_value)]),e[d]=m,e[f]=p?Math.abs(l.scale(t.y1+t.y_ref)-l.scale(t.y1)):Math.abs(l.scale(a.model.base_value)-l.scale(t.y_ref)),[[e.x,e.x+e.width],[e.y,e.y+e.height]]})}),this.x_pixels=this.model.mark_data.map(function(t){return c.scale(t.key)+c.offset})}get offsetVertical(){return this.model.get("label_display_vertical_offset")}get offsetHorizontal(){return this.model.get("label_display_horizontal_offset")}get baseLine(){return this.model.get("base")}get barOrientation(){return this.model.get("orientation")}manageBarLabels(t,e,n,i){this.model.get("label_display")&&("stacked"===this.model.get("type")?this.stackedBarLabels(t,e,n,i):this.groupedBarLabels(t,e),this.updateBarLabelsStyle())}stackedBarLabels(t,e,n,i){const r=this.baseLine,o=this.barOrientation;t.selectAll(".bar_label").attr(n,t=>0).attr(i,t=>t.y<=r?this.range_scale.scale(t.y0):this.range_scale.scale(t.y1)).style("font-weight","400").style("text-anchor",(t,e)=>this.styleBarLabelTextAnchor(t,o,r)).style("dominant-baseline",(t,e)=>this.styleBarLabelDominantBaseline(t,r,o)).attr("transform",(t,n)=>this.transformBarLabel(t,r,this.offsetHorizontal,this.offsetVertical,e,o))}groupedBarLabels(t,e){const n=this.baseLine,i=this.barOrientation;t.selectAll(".bar_label").attr("x",(t,e)=>"horizontal"===i?this.range_scale.scale(t.y):this.x1(e)).attr("y",(t,e)=>"horizontal"===i?this.x1(e):this.range_scale.scale(t.y)).style("font-weight","400").style("text-anchor",(t,e)=>this.styleBarLabelTextAnchor(t,i,n)).style("dominant-baseline",(t,e)=>this.styleBarLabelDominantBaseline(t,n,i)).attr("transform",(t,r)=>this.transformBarLabel(t,n,this.offsetHorizontal,this.offsetVertical,e,i))}transformBarLabel(t,e,n,i,r,o){return"horizontal"===o?t.y<=e?`translate(${t.y0<=e?0-i:0+i}, ${r/2+n})`:`translate(${t.y1<=e?0-i:0+i}, ${r/2+n})`:t.y<=e?`translate(${r/2+n},\n ${t.y0<=e?0-i:0+i})`:`translate(${r/2+n},\n ${t.y1<=e?0-i:0+i})`}styleBarLabelTextAnchor(t,e,n){return"horizontal"===e?t.y<=n?"start":"end":"middle"}styleBarLabelDominantBaseline(t,e,n){return"horizontal"===n?"central":t.y<=e?"text-after-edge":"text-before-edge"}updateBarLabelsStyle(){const t=this.model.get("label_display_format"),e=t?r.format(t):null;let n=this.d3el.selectAll(".bar_label").text((t,n)=>e?e(t.y):null);const i=this.model.get("label_font_style");for(const t in i)n=n.style(t,i[t])}update_type(t,e){this.model.update_domains(),this.draw()}update_colors(){const t=this,e=this.scales.color;this.model.mark_data.length>0&&(this.model.is_y_2d?this.d3el.selectAll(".bargroup").selectAll(".bar").style("fill",function(n,i){return void 0!==n.color&&void 0!==e?e.scale(n.color):t.get_colors(n.color_index)}):this.d3el.selectAll(".bar").style("fill",function(n,i){return void 0!==n.color&&void 0!==e?e.scale(n.color):t.get_colors(n.color_index)})),this.legend_el&&(this.legend_el.selectAll(".legendrect").style("fill",function(n,i){return n.color&&e?e.scale(n.color):t.get_colors(n.color_index)}),this.legend_el.selectAll(".legendtext").style("fill",function(n,i){return void 0!==n.color&&void 0!==e?e.scale(n.color):t.get_colors(n.color_index)}))}draw_legend(t,e,n,i,o){if(!this.model.is_y_2d&&1!==this.model.get("colors").length&&"element"!==this.model.get("color_mode"))return[0,0];const s=this.model.mark_data[0].values.map(function(t){return{index:t.sub_index,color:t.color,color_index:t.color_index}}),c=this.scales.color;this.legend_el=t.selectAll(".legend"+this.uuid).data(s);const l=this,u=.8*o,h=this.legend_el.enter().append("g").attr("class","legend"+this.uuid).attr("transform",function(t,e){return"translate(0, "+(e*o+n)+")"}).on("mouseover",a.bind(function(){this.event_dispatcher("legend_mouse_over")},this)).on("mouseout",a.bind(function(){this.event_dispatcher("legend_mouse_out")},this)).on("click",a.bind(function(){this.event_dispatcher("legend_clicked")},this));h.append("rect").classed("legendrect",!0).style("fill",function(t,e){return void 0!==t.color&&void 0!==c?c.scale(t.color):l.get_colors(t.color_index)}).attr("x",0).attr("y",0).attr("width",u).attr("height",u),h.append("text").attr("class","legendtext").attr("x",1.2*u).attr("y",u/2).attr("dy","0.35em").text(function(t,e){return l.model.get("labels")[e]}).style("fill",function(t,e){return void 0!==t.color&&void 0!==c?c.scale(t.color):l.get_colors(t.color_index)}),h.merge(this.legend_el);const d=r.max(this.model.get("labels"),function(t){return t.length});return this.legend_el.exit().remove(),[this.model.mark_data[0].values.length,d]}clear_style(t,e){if(!e||0===e.length)return;if(0===Object.keys(t).length)return;const n=this.d3el.selectAll(".bargroup").filter((t,n)=>-1!==e.indexOf(n)),i={};for(const e in t)i[e]=null;n.selectAll(".bar").styles(i)}set_style_on_elements(t,e){e&&0!==e.length&&0!==Object.keys(t).length&&this.d3el.selectAll(".bargroup").filter((t,n)=>-1!==e.indexOf(n)).selectAll(".bar").styles(t)}set_default_style(t){if(!t||0===t.length)return;const e=this.d3el.selectAll(".bargroup").filter((e,n)=>-1!==t.indexOf(n)),n=this.model.get("fill"),i=this.model.get("stroke"),r=this.model.get("stroke_width");e.selectAll(".bar").style("fill",n?this.get_mark_color.bind(this):"none").style("stroke",i||this.get_mark_color.bind(this)).style("opacity",this.get_mark_opacity.bind(this)).style("stroke-width",r)}set_x_range(){const t=this.dom_scale;return"ordinal"===t.model.type?t.scale.range():[t.scale(r.min(this.x.domain())),t.scale(r.max(this.x.domain()))]}bar_click_handler(t){const e=t.index,n=this,i=this.model.get("selected")||[];let s=Array.from(i);const c=s.indexOf(e),l=o().ctrlKey||o().metaKey;if(c>-1&&l)s.splice(c,1);else if(o().shiftKey){if(c>-1)return;const t=0!==s.length?r.min(s):-1,i=0!==s.length?r.max(s):n.model.mark_data.length;e>i?a.range(i+1,e+1).forEach(function(t){s.push(t)}):e-1&&l)a.splice(c,1);else if(s().shiftKey){if(c>-1)return;const t=0!==a.length?r.min(a):-1,i=0!==a.length?r.max(a):n.model.mark_data.length;e>i?o.range(i+1,e+1).forEach(function(t){a.push(t)}):ee.y[t.model.px.c]?i:n}),this.legend_el&&this.legend_el.selectAll("path").style("fill",n)}update_opacities(){const t=this.model.get("opacities");this.d3el.selectAll(".stick").style("opacity",function(e,n){return t[n]}),this.legend_el&&this.legend_el.selectAll("path").attr("opacity",function(e,n){return t[n]})}update_marker(){const t=this.model.get("marker");this.legend_el&&this.rect_dim&&this.draw_legend_icon(this.rect_dim,this.legend_el),this.draw_mark_paths(t,this.d3el,this.model.mark_data.map(function(t,e){return t[1]}))}update_selected_colors(t,e){let n=o.range(t,e+1);n.length==this.model.mark_data.length&&(n=[]);const i=this,r=this.model.get("stroke"),a=this.model.get("colors"),s=a[0]?a[0]:r,c=a[1]?a[1]:r,l=this.model.px;o.range(0,this.model.mark_data.length).forEach(function(t){i.d3el.selectAll("#stick"+t).style("stroke",r)}),n.forEach(function(t){i.d3el.selectAll("#stick"+t).style("stroke",function(t){return t[l.o]>t[l.c]?c:s})})}invert_range(t,e){if(void 0===t||void 0===e||0===this.model.mark_data.length)return this.update_selected_colors(-1,-1),[];const n=new Uint32Array(o.range(this.model.mark_data.length)),i=this,r=n.filter(n=>{const r=i.x_pixels[n];return r>=t&&r<=e}),a=this.scales.x;let s=-1,c=-1;return r.length>0&&(t!==a.scale.range()[0]||e!==a.scale.range()[1])&&(s=r[0],c=r[r.length-1]),this.update_selected_colors(s,c),this.model.set("selected",r),this.touch(),super.invert_range(t,e)}invert_point(t){const e=this.x_pixels.map(function(e){return Math.abs(e-t)}),n=e.indexOf(r.min(e));this.update_selected_colors(n,n),this.model.set("selected",[n]),this.touch()}draw(){const t=this.scales.x,e=this.scales.y;this.set_ranges();const n=this.model.get("colors"),i=this.model.get("opacities"),o=n[0]?n[0]:"none",a=n[1]?n[1]:"none",s=this.model.px,c=this.d3el.selectAll(".stick").data(this.model.mark_data.map(function(t,e){return{x:t[0],y:t[1],index:e}})),l=c.enter().append("g").attr("class","stick").attr("id",function(t,e){return"stick"+e}).style("stroke",this.model.get("stroke")).style("opacity",function(t,e){return i[e]});l.append("path").attr("class","stick_head"),l.append("path").attr("class","stick_tail"),l.append("path").attr("class","stick_body"),c.exit().remove();const u=this;let h=s.h;if(-1===s.h&&(h=s.o),this.d3el.selectAll(".stick").style("fill",function(t,e){return t.y[s.o]>t.y[s.c]?a:o}).attr("stroke-width",this.model.get("stroke_width")),"ordinal"===t.model.type){const n=r.max(this.parent.range("x"));this.d3el.selectAll(".stick").attr("transform",function(i,r){return"translate("+((void 0!==t.scale(u.model.mark_data[r][0])?t.scale(u.model.mark_data[r][0]):n)+t.scale.bandwidth()/2)+","+(e.scale(i.y[h])+e.offset)+")"})}else this.d3el.selectAll(".stick").attr("transform",function(n,i){return"translate("+(t.scale(u.model.mark_data[i][0])+t.offset)+","+(e.scale(n.y[h])+e.offset)+")"});this.d3el.selectAll(".stick").on("click",(t,e)=>u.event_dispatcher("element_clicked",{data:t,index:e})),this.draw_mark_paths(this.model.get("marker"),this.d3el,this.model.mark_data.map(function(t){return t[1]})),this.x_pixels=this.model.mark_data.map(function(e){return t.scale(e[0])+t.offset})}draw_mark_paths(t,e,n){const i=this.model.px,r=this,o=[],a=[],s=[],c=[],l=[],u=[],h=[],d=[];let f=this.calculate_mark_width();const p=this.scales.x,m=this.scales.y;let g,_;for(var v=0;vn[v][i.c]?o[v]:c[v],u[v]=n[v][i.o]=0;return{index:i,sub_index:r,x:t,y0:l?o:s+=c,y1:l?o+=c:(a+=c)-c,y_ref:c,y:e[i]}}),r.pos_max=o,r.neg_max=a,r}),this.is_y_2d=this.mark_data[0].values.length>1,this.update_color()),this.update_domains(),this.trigger("data_updated")}get_data_dict(t,e){return t}update_color(){if(!this.mark_data)return;const t=this.get("color")||[],e=this.get("scales").color,n=this.get("color_mode"),i="group"===n||"auto"===n&&!this.is_y_2d;this.mark_data.forEach(function(e,n){e.values.forEach(function(e,r){e.color_index=i?n:r,e.color=t[e.color_index]})}),e&&t.length>0&&(this.get("preserve_domain").color?e.del_domain([],this.model_id+"_color"):e.compute_and_set_domain(t,this.model_id+"_color"))}update_domains(){if(!this.mark_data)return;const t=this.get("scales"),e=t.x,n=t.y;if(this.get("preserve_domain").x?e.del_domain([],this.model_id+"_x"):e.compute_and_set_domain(this.mark_data.map(function(t){return t.key}),this.model_id+"_x"),this.get("preserve_domain").y)n.del_domain([],this.model_id+"_y");else if("stacked"===this.get("type"))n.compute_and_set_domain([r.min(this.mark_data,function(t){return t.neg_max}),r.max(this.mark_data,function(t){return t.pos_max}),this.base_value],this.model_id+"_y");else{const t=r.min(this.mark_data,function(t){return r.min(t.values,function(t){return t.y_ref})}),e=r.max(this.mark_data,function(t){return r.max(t.values,function(t){return t.y_ref})});n.compute_and_set_domain([t,e,this.base_value],this.model_id+"_y")}}}c.serializers=Object.assign({},a.MarkModel.serializers,{x:s.array_or_json,y:s.array_or_json,color:s.array_or_json}),e.BarsModel=c},function(t,e,n){"use strict";var i=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e};Object.defineProperty(e,"__esModule",{value:!0});const r=i(n(6)),o=i(n(2)),a=function(){return n(0).event}.bind(this),s=i(n(17)),c=n(19);e.Hist=class extends c.Mark{render(){const t=super.render();this.selected_indices=this.calc_bar_indices_from_data_idx(this.model.get("selected")),this.selected_style=this.model.get("selected_style"),this.unselected_style=this.model.get("unselected_style"),this.display_el_classes=["rect","legendtext"];const e=this;return this.displayed.then(function(){e.parent.tooltip_div.node().appendChild(e.tooltip_div.node()),e.create_tooltip()}),t.then(function(){e.event_listeners={},e.process_interactions(),e.create_listeners(),e.draw(),e.update_selected(e.model,e.model.get("selected"))})}set_ranges(){const t=this.scales.sample;t&&t.set_range(this.parent.padded_range("x",t.model));const e=this.scales.count;e&&e.set_range(this.parent.padded_range("y",e.model))}set_positional_scales(){const t=this.scales.sample,e=this.scales.count;this.listenTo(t,"domain_changed",function(){this.model.dirty||this.model.update_data()}),this.listenTo(e,"domain_changed",function(){this.model.dirty||this.draw()})}create_listeners(){super.create_listeners(),this.d3el.on("mouseover",r.bind(function(){this.event_dispatcher("mouse_over")},this)).on("mousemove",r.bind(function(){this.event_dispatcher("mouse_move")},this)).on("mouseout",r.bind(function(){this.event_dispatcher("mouse_out")},this)),this.listenTo(this.model,"change:tooltip",this.create_tooltip),this.listenTo(this.model,"data_updated",this.draw),this.listenTo(this.model,"change:colors",this.update_colors),this.model.on_some_change(["stroke","opacities"],this.update_stroke_and_opacities,this),this.listenTo(this.model,"change:selected",this.update_selected),this.listenTo(this.model,"change:interactions",this.process_interactions),this.listenTo(this.parent,"bg_clicked",function(){this.event_dispatcher("parent_clicked")})}process_click(t){super.process_click(t),"select"===t&&(this.event_listeners.parent_clicked=this.reset_selection,this.event_listeners.element_clicked=this.bar_click_handler)}update_colors(){this.d3el.selectAll(".bargroup").selectAll("rect").style("fill",(t,e)=>this.get_colors(t.index)),this.model.get("labels")&&this.d3el.selectAll(".bargroup").selectAll("text").style("fill",(t,e)=>this.get_colors(e)),this.legend_el&&(this.legend_el.selectAll("rect").style("fill",(t,e)=>this.get_colors(e)),this.legend_el.selectAll("text").style("fill",(t,e)=>this.get_colors(e)))}update_stroke_and_opacities(){const t=this.model.get("stroke"),e=this.model.get("opacities");this.d3el.selectAll(".rect").style("stroke",t).style("opacity",function(t,n){return e[n]})}calculate_bar_width(){const t=this.scales.sample;let e=(t.scale(this.model.max_x)-t.scale(this.model.min_x))/this.model.num_bins;return e>=10&&(e-=2),e}relayout(){this.set_ranges();const t=this.scales.sample,e=this.scales.count;this.d3el.selectAll(".bargroup").attr("transform",function(n){return"translate("+t.scale(n.x0)+","+e.scale(n.y)+")"});const n=this.calculate_bar_width();this.d3el.selectAll(".bargroup").select("rect").transition("relayout").duration(this.parent.model.get("animation_duration")).attr("x",2).attr("width",n).attr("height",function(t){return e.scale(0)-e.scale(t.y)})}draw(){this.set_ranges();const t=[];this.model.mark_data.forEach(function(e,n){t.push(n)});const e=this.scales.sample,n=this.scales.count,i=this,r=this.calculate_bar_width();let o=this.d3el.selectAll(".bargroup").data(this.model.mark_data);o.exit().remove();const a=o.enter().append("g").attr("class","bargroup");a.append("rect").attr("class","rect").attr("x",2).attr("width",0).attr("height",0),(o=a.merge(o)).attr("transform",function(t){return"translate("+e.scale(t.x0)+","+n.scale(t.y)+")"}),o.select(".rect").style("fill",(t,e)=>this.get_colors(t.index)).on("click",function(t,e){return i.event_dispatcher("element_clicked",{data:t,index:e})}).attr("id",function(t,e){return"rect"+e}).transition("draw").duration(this.parent.model.get("animation_duration")).attr("width",r).attr("height",function(t){return n.scale(0)-n.scale(t.y)}),this.bin_pixels=this.model.x_bins.map(function(t){return e.scale(t)+e.offset}),this.pixel_coords=this.model.mark_data.map(function(t){const i=e.scale(t.x0);return[[i,i+r],[0,t.y].map(n.scale)]}),this.update_stroke_and_opacities()}bar_click_handler(t){const e=t.index,n=this,i=this.selected_indices;let c=i?s.deepCopy(i):[];const l=c.indexOf(e),u=a().ctrlKey||a().metaKey;if(l>-1&&u)c.splice(l,1);else if(a().shiftKey){if(l>-1)return;const t=0!==c.length?o.min(c):-1,i=0!==c.length?o.max(c):n.model.mark_data.length;e>i?r.range(i+1,e+1).forEach(function(t){c.push(t)}):ee(n[t]));this.model.set("selected",this.calc_data_indices(i)),this.touch()}calc_data_indices(t){const e=this.reduce_intervals(t);if(0===e.length)return[];const n=this.model.get("sample"),i=e.length;return new Uint32Array(r.range(n.length)).filter(t=>{const r=n[t];for(let t=0;t=e[t][0])return!0;return!1})}reduce_intervals(t){const e=[];if(0!==t.length){t.sort();let n=t[0],i=t[0];for(let r=1;r=s.model.x_bins[n]&&a[t]<=s.model.x_bins[i]})}calc_bar_indices_from_data_idx(t){if(null===t)return null;const e=this.model.get("sample"),n=Array.from(t).map(function(t){return e[t]});let i=[];for(let t=0;t4)i(n),t=[],e=[];else{const i=this.px;(-1===this.px.h||e.every(function(t){return t[i.h]===r.max(t)&&t[i.l]===r.min(t)}))&&e.every(function(t){return t.length===n.length})||(t=[],e=[],console&&console.error("Invalid OHLC data"))}t.length>e.length?t=t.slice(0,e.length):t.length0&&(c=this.mark_data[t][0]-this.mark_data[t-1][0])s&&(s=l);if(this.mark_data.length<2&&(a=0),this.get("preserve_domain").x||0===this.mark_data.length?e.del_domain([],this.model_id+"_x"):"ordinal"===e.type?e.compute_and_set_domain(this.mark_data.map(function(t){return t[0]})):(i=r.min(this.mark_data.map(function(t){return t[0]})),(o=r.max(this.mark_data.map(function(t){return t[0]})))instanceof Date&&(o=o.getTime()),e.set_domain([i-a/2,o+a/2],this.model_id+"_x")),this.get("preserve_domain").y||0===this.mark_data.length)n.del_domain([],this.model_id+"_y");else{let t=this.px.h,e=this.px.l;-1!==t&&-1!==e||(t=this.px.o,e=this.px.c),i=r.min(this.mark_data.map(function(n){return n[1][e]n[1][e]?n[1][t]:n[1][e]})))instanceof Date&&(o=o.getTime()),n.set_domain([i-s,o+s],this.model_id+"_y")}}get_data_dict(t,e){const n=this,i={index:e,x:t.x};return["open","low","high","close"].forEach(function(e){i[e]=t.y[n.px[e.substr(0,1)]]}),i}}c.serializers=Object.assign({},a.MarkModel.serializers,{x:s.array_or_json,y:s.array_or_json}),e.OHLCModel=c},function(t,e,n){"use strict";var i=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e};Object.defineProperty(e,"__esModule",{value:!0});const r=i(n(2)),o=n(18),a=i(n(12));class s extends o.MarkModel{defaults(){return Object.assign({},o.MarkModel.prototype.defaults(),{_model_name:"HistModel",_view_name:"Hist",sample:[],count:[],scales_metadata:{sample:{orientation:"horizontal",dimension:"x"},count:{orientation:"vertical",dimension:"y"}},bins:10,midpoints:[],colors:["steelblue"],stroke:null,opacities:[],normalized:!1})}initialize(t,e){super.initialize(t,e),this.mark_data=[],this.on_some_change(["bins","sample","preserve_domain"],this.update_data,this),this.update_data(),this.on("change:normalized",function(){this.normalize_data(!0)},this),this.normalize_data(!0)}update_data(){let t=this.get("sample");const e=this.get("scales").sample;if(this.num_bins=this.get("bins"),0==t.length)this.mark_data=[],this.x_mid=[],this.count=[],this.x_bins=[];else{this.get("preserve_domain").sample?e.del_domain([],this.model_id+"_sample"):e.compute_and_set_domain(t,this.model_id+"_sample"),this.min_x=e.domain[0],this.max_x=e.domain[1];const n=this;t=t.filter(function(t){return t<=n.max_x&&t>=n.min_x});const i=Array.prototype.map.call(t,function(t,e){return{index:e,value:t}});this.x_bins=this.create_uniform_bins(this.min_x,this.max_x,this.num_bins),this.x_mid=this.x_bins.map(function(t,e){return.5*(t+n.x_bins[e-1])}).slice(1),this.mark_data=r.histogram().thresholds(this.x_bins).value(function(t){return t.value})(i),this.mark_data.forEach(function(t,e){t.index=e})}this.normalize_data(!1),this.set("midpoints",this.x_mid),this.set("count",new Float64Array(this.count)),this.update_domains(),this.save_changes(),this.trigger("data_updated")}normalize_data(t){if(this.count=this.mark_data.map(function(t){return t.length}),this.get("normalized")){let t=1;this.mark_data.length>0&&(t=this.mark_data[0].x1-this.mark_data[0].x0);const e=this.count.reduce(function(t,e){return t+e},0);0!=e&&(this.count=this.count.map(function(n){return n/(e*t)}))}const e=this;this.mark_data.forEach(function(t,n){t.y=e.count[n]}),t&&(this.set("count",new Float64Array(this.count)),this.update_domains(),this.save_changes(),this.trigger("data_updated"))}get_data_dict(t,e){const n={};return n.midpoint=this.x_mid[e],n.bin_start=this.x_bins[e],n.bin_end=this.x_bins[e+1],n.index=e,n.count=this.count[e],n}update_domains(){if(!this.mark_data)return;const t=this.get("scales").count;this.get("preserve_domain").count||t.set_domain([0,1.05*r.max(this.mark_data,function(t){return t.y})],this.model_id+"_count")}create_uniform_bins(t,e,n){const i=(e-t)/n,r=[];for(let e=0;e-1?n:e})}selector_changed(t,e){if(void 0===t)return this.model.set("selected",null),this.touch(),this.update_selected_colors([]),[];const n=this.pixel_coords,i=new Uint32Array(a.range(n.length)).filter(t=>e(n[t]));this.update_selected_colors(i),this.model.set("selected",i),this.touch()}invert_point(t){if(void 0===t)return this.update_selected_colors([]),this.model.set("selected",null),void this.touch();const e=this.x_pixels.map(function(e){return Math.abs(e-t)}),n=e.indexOf(r.min(e));return this.model.set("selected",new Uint32Array([n])),this.update_selected_colors([n]),this.touch(),n}prepareBoxPlots(){const t=!1!==this.model.get("auto_detect_outliers"),e=this.scales.x,n=this.scales.y;this.plotData=[],this.outlierData=[];for(let i=0;ic||ra.whiskerMin&&(a.whiskerMin=r),r-1&&l)s.splice(c,1);else if(o().shiftKey){if(c>-1)return;const t=0!==s.length?r.min(s):-1,i=0!==s.length?r.max(s):n.model.mark_data.length;e>i?a.range(i+1,e+1).forEach(function(t){s.push(t)}):e0?this.scale.range(a.cycle_colors(this.model.get("colors"),this.scale.domain().length)):this.scale.range(a.get_ordinal_scale_range(this.model.get("scheme"),this.scale.domain().length)),this.trigger("color_scale_range_changed")}model_domain_changed(){super.model_domain_changed(),this.set_range()}colors_changed(){this.set_range()}}},function(t,e,n){"use strict";var i=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e};Object.defineProperty(e,"__esModule",{value:!0});const r=i(n(2)),o=i(n(6)),a=n(18),s=i(n(12));class c extends a.MarkModel{defaults(){return Object.assign({},a.MarkModel.prototype.defaults(),{_model_name:"BoxplotModel",_view_name:"Boxplot",x:[],y:[],scales_metadata:{x:{orientation:"horizontal",dimension:"x"},y:{orientation:"vertical",dimension:"y"}},stroke:null,box_fill_color:"dodgerblue",outlier_fill_color:"gray",opacities:[],box_width:null,auto_detect_outliers:!0})}initialize(){super.initialize.apply(this,arguments),this.on_some_change(["x","y"],this.update_data,this),this.on_some_change(["preserve_domain"],this.update_domains,this),this.update_data(),this.update_domains()}update_data(){let t=this.get("x"),e=this.get("y");e.forEach(function(t){t.sort(function(t,e){return t-e})}),t.length>e.length?t=t.slice(0,e.length):t.length0?Math.abs((e[1]-t[1])/n.bandwidth()):0;this.scale.range(e),this.scale.paddingInner(0),this.scale.paddingOuter(i)}invert(t){const e=this,n=this.scale.domain(),i=n.map(function(t){return e.scale(t)+e.scale.bandwidth()/2}).map(function(e){return Math.abs(t-e)});return n[i.indexOf(r.min(i))]}invert_range(t){const e=this,n=this.scale.domain(),i=n.map(function(t){return e.scale(t)+e.scale.bandwidth()/2});return a.range(i.length).filter(function(e){return i[e]>=t[0]&&i[e]<=t[1]}).map(function(t){return n[t]})}}},function(t,e,n){"use strict";var i=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e};Object.defineProperty(e,"__esModule",{value:!0});const r=i(n(2)),o=n(136);e.Label=class extends o.ScatterBase{create_listeners(){super.create_listeners(),this.model.on_some_change(["font_weight","default_size","colors","align","font_unit"],this.update_style,this),this.model.on_some_change(["x","y","x_offset","y_offset","rotate_angle"],this.update_position,this)}update_default_opacities(t){if(!this.model.dirty){const e=!0===t?this.parent.model.get("animation_duration"):0,n=this;this.d3el.selectAll(".label").transition("update_default_opacities").duration(e).style("opacity",function(t,e){return n.get_element_opacity(t,e)})}}update_default_size(t){if(this.compute_view_padding(),!this.model.dirty){const e=!0===t?this.parent.model.get("animation_duration"):0,n=this;this.d3el.selectAll(".label").transition("update_default_size").duration(e).style("font-size",function(t,e){return n.get_element_size(t)})}}relayout(){this.set_ranges(),this.update_position()}draw_elements(t,e){e.append("text").classed("label element",!0),this.update_text(),this.update_style(),this.update_default_opacities(!0)}update_text(){this.d3el.selectAll(".object_grp").select(".label").text(function(t){return t.text})}get_element_size(t){const e=this.scales.size,n=this.model.get("font_unit");return e&&void 0!==t.size?e.scale(t.size)+n:this.model.get("default_size")+n}get_element_rotation(t){const e=this.scales.rotation;return e&&t.rotation?"rotate("+e.scale(t.rotation)+")":"rotate("+this.model.get("rotate_angle")+")"}update_position(){const t=this,e=this.x_scale,n=this.y_scale,i=this.model.get("x_offset"),r=this.model.get("y_offset");this.d3el.selectAll(".object_grp").attr("transform",function(o){return"translate("+(e.scale(o.x)+e.offset+i)+","+(n.scale(o.y)+n.offset+r)+")"+t.get_element_rotation(o)})}update_style(){const t=this;this.d3el.selectAll(".object_grp").select("text").attr("dominant-baseline","central").style("font-size",function(e,n){return t.get_element_size(e)}).style("font-weight",this.model.get("font_weight")).style("text-anchor",this.model.get("align")),this.d3el.selectAll(".label").style("fill",function(e,n){return t.get_element_color(e,n)})}color_scale_updated(t){const e=this,n=!0===t?this.parent.model.get("animation_duration"):0;this.d3el.selectAll(".object_grp").select("text").transition("color_scale_updated").duration(n).style("fill",function(t,n){return e.get_element_color(t,n)})}set_default_style(t){if(!t||0===t.length)return;const e=this.d3el.selectAll(".element").filter(function(e,n){return-1!==t.indexOf(n)}),n=this;e.style("font-size",function(t,e){return n.get_element_size(t)}).style("font-weight",this.model.get("font_weight")).style("text-anchor",this.model.get("align")).style("fill",function(t,e){return n.get_element_color(t,e)})}set_drag_style(t,e,n){const i=this.model.get("drag_size")*this.model.get("default_size")+this.model.get("font_unit");r.select(n).select("text").classed("drag_label",!0).transition("set_drag_style").style("font-size",i)}reset_drag_style(t,e,n){r.select(n).select("text").classed("drag_label",!1).transition("reset_drag_style").style("font-size",this.get_element_size(t))}update_default_skew(){}}},function(t,e,n){"use strict";var i=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e};Object.defineProperty(e,"__esModule",{value:!0});const r=i(n(2)),o=n(137),a=i(n(12));class s extends o.ScatterBaseModel{defaults(){return Object.assign({},o.ScatterBaseModel.prototype.defaults(),{_model_name:"LabelModel",_view_name:"Label",x_offset:0,y_offset:0,colors:r.scaleOrdinal(r.schemeCategory10).range(),rotate_angle:0,text:null,default_size:16,drag_size:1,font_unit:"px",font_weight:"bold",align:"start"})}initialize(t,e){super.initialize(t,e),this.on("change:text",this.update_data,this)}update_mark_data(){super.update_mark_data();const t=this.get("text");this.mark_data.forEach(function(e,n){e.text=t[n]})}update_unique_ids(){this.mark_data.forEach(function(t,e){t.unique_id="Label"+e})}}s.serializers=Object.assign({},o.ScatterBaseModel.serializers,{text:a.array_or_json}),e.LabelModel=s},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const i=n(138);e.OrdinalColorScaleModel=class extends i.OrdinalScaleModel{defaults(){return Object.assign({},i.OrdinalScaleModel.prototype.defaults(),{_model_name:"OrdinalColorScaleModel",_view_name:"OrdinalColorScale",domain:[]})}}},function(t,e,n){"use strict";var i=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e};Object.defineProperty(e,"__esModule",{value:!0});const r=i(n(2)),o=function(){return n(0).event}.bind(this),a=i(n(6)),s=i(n(49)),c=i(n(17)),l=i(n(85));class u extends s.BaseXYSelector{brush_render(){this.brushing=!1}color_change(){null!==this.model.get("color")&&this.brushsel.select(".selection").style("fill",this.model.get("color"))}brush_start(){this.model.set("brushing",!0),this.touch(),this.brushing=!0}brush_move(){this.convert_and_save()}brush_end(){this.model.set("brushing",!1),this.convert_and_save(),this.brushing=!1}adjust_rectangle(){"vertical"==this.model.get("orientation")?this.d3el.selectAll("rect").attr("x",0).attr("width",this.width):this.d3el.selectAll("rect").attr("y",0).attr("height",this.height)}update_mark_selected(t,e){if(void 0===t||0===t.length)return void a.each(this.mark_views,function(t){return t.selector_changed()});let n,i;if(void 0===e){const e=this.model.get("orientation");n="vertical"==e?[]:t,i="vertical"==e?t:[]}else n=t,i=e;const r=function(t){return l.point_in_rectangle(t,n,i)},o=function(t){return l.rect_inter_rect(t[0],t[1],n,i)};a.each(this.mark_views,function(t){t.selector_changed(r,o)},this)}}class h extends s.BaseXSelector{brush_render(){this.brushing=!1}color_change(){null!==this.model.get("color")&&this.brushsel.select(".selection").style("fill",this.model.get("color"))}brush_start(){this.model.set("brushing",!0),this.touch(),this.brushing=!0}brush_move(){this.convert_and_save()}brush_end(){this.model.set("brushing",!1),this.convert_and_save(),this.brushing=!1}adjust_rectangle(){"vertical"==this.model.get("orientation")?this.d3el.selectAll("rect").attr("x",0).attr("width",this.width):this.d3el.selectAll("rect").attr("y",0).attr("height",this.height)}update_mark_selected(t,e){if(void 0===t||0===t.length)return void a.each(this.mark_views,function(t){return t.selector_changed()});let n,i;if(void 0===e){const e=this.model.get("orientation");n="vertical"==e?[]:t,i="vertical"==e?t:[]}else n=t,i=e;n.length&&n.sort(function(t,e){return t-e}),i.length&&i.sort(function(t,e){return t-e});const r=function(t,e){if(void 0===e){const e=t;return l.point_in_rectangle(e,n,i)}const r=Math.min(t.length,e.length),o=new Uint8Array(r);if(n.length&&i.length){for(let a=0;at-e;e.sort(i),n.sort(i);const o=e.map(this.x_scale.invert.bind(this.x_scale)).sort((t,e)=>t-e),a=n.map(this.y_scale.invert.bind(this.y_scale)).sort((t,e)=>t-e);this.update_mark_selected(e,n),this.set_selected("selected_x",o),this.set_selected("selected_y",a),this.touch()}else this.empty_selection()}selected_changed(){if(this.brushing)return;const t=this.model.get("selected_x")||[],e=this.model.get("selected_y")||[];if(0===t.length||0===e.length)this.update_mark_selected();else{if(2!=t.length||2!=e.length)return;{const n=[[t[0],e[0]],[t[1],e[1]]];this.brush.extent(n);const i=t.map(this.x_scale.scale).sort(function(t,e){return t-e}),r=e.map(this.y_scale.scale).sort(function(t,e){return t-e});this.update_mark_selected(i,r)}}}relayout(){if(super.relayout(),this.d3el.select(".background").attr("width",this.width).attr("height",this.height),this.set_x_range([this.x_scale]),this.set_y_range([this.y_scale]),this.brush.extent([[0,0],[this.width,this.height]]),this.model.get("selected_x")&&this.model.get("selected_y")){const t=this.model.get("selected_x").map(this.x_scale.scale).sort(function(t,e){return t-e}),e=this.model.get("selected_y").map(this.y_scale.scale).sort(function(t,e){return t-e});this.brush.move(this.d3el,[[t[0],e[0]],[t[1],e[1]]]),this.brushsel=this.d3el.call(this.brush)}}adjust_rectangle(){}reset(){}};function d(t,e,n){n&&n.forEach(function(e){t.classed(e,!1)}),e&&e.forEach(function(e){t.classed(e,!0)})}e.BrushIntervalSelector=class extends h{render(){super.render(),this.brush_render();const t=this,e=this.create_scales();Promise.all([this.mark_views_promise,e]).then(function(){t.brush=("vertical"==t.model.get("orientation")?r.brushY():r.brushX()).on("start",a.bind(t.brush_start,t)).on("brush",a.bind(t.brush_move,t)).on("end",a.bind(t.brush_end,t)),t.brush.extent([[0,0],[t.width,t.height]]),t.d3el.attr("class","selector brushintsel"),t.brushsel=t.d3el.call(t.brush),t.adjust_rectangle(),t.color_change(),t.create_listeners(),t.selected_changed()})}create_listeners(){super.create_listeners(),this.listenTo(this.model,"change:color",this.color_change)}empty_selection(){this.update_mark_selected(),this.model.set("selected",new Uint32Array([])),this.touch()}convert_and_save(){const t=o();if(t.sourceEvent)if(t.selection){const e=t.selection,n=e.map(this.scale.invert.bind(this.scale)).sort((t,e)=>t-e);this.update_mark_selected(e),this.set_selected("selected",n),this.touch()}else this.empty_selection()}update_scale_domain(t){super.update_scale_domain(),!0!==t&&this.selected_changed()}selected_changed(){if(this.brushing)return;const t=this.model.get("selected")||[];if(0===t.length)this.update_mark_selected();else{if(2!=t.length)return;{const e=[t[0],t[1]];this.brush.extent(e);const n=e.map(this.scale.scale).sort((t,e)=>t-e);this.update_mark_selected(n)}}}relayout(){if(super.relayout(),this.adjust_rectangle(),this.d3el.select(".background").attr("width",this.width).attr("height",this.height),this.set_range([this.scale]),this.brush.extent([[0,0],[this.width,this.height]]),this.model.get("selected")){const t=this.model.get("selected").map(this.scale.scale).sort(function(t,e){return t-e});this.brush.move(this.d3el,t),this.brushsel=this.d3el.call(this.brush)}}reset(){}};e.MultiSelector=class extends h{render(){super.render.apply(this);const t=this;this.names=this.model.get("names"),this.curr_index=0;const e=this.create_scales();Promise.all([this.mark_views_promise,e]).then(function(){t.d3el.attr("class","multiselector"),t.d3el.attr("width",t.width),t.d3el.attr("height",t.height),t.create_brush(),t.selecting_brush=!1,t.create_listeners()})}create_listeners(){super.create_listeners(),this.listenTo(this.model,"change:names",this.labels_change),this.listenTo(this.model,"change:color",this.color_change)}labels_change(t,e){const n=t.previous("names");this.names=e;const i=a.range(this.curr_index+1),r=this,o=c.deepCopy(this.model.get("selected"));i.forEach(function(t){const e=r.get_label(t),i=r.get_label(t,n);i!==e&&(r.d3el.select(".brush_text_"+t).text(e),o[e]=o[i],delete o[i])}),this.set_selected("_selected",o),this.touch()}create_brush(){const t=this,e=this.curr_index,n=("vertical"==this.model.get("orientation")?r.brushY():r.brushX()).on("start",()=>{this.brush_start()}).on("brush",()=>{this.brush_move(e,this)}).on("end",()=>{this.brush_end(e,this)});n.extent([[0,0],[this.width,this.height]]);const i=this.d3el.append("g").attr("class","selector brushintsel active");i.append("text").text(this.get_label(this.curr_index)).attr("class","brush_text_"+this.curr_index).style("text-anchor","middle").style("stroke","yellow").style("font-size","16px").style("display","none"),"vertical"==this.model.get("orientation")?i.select("text").attr("x",30):i.select("text").attr("y",30),i.call(n),this.color_change(),this.adjust_rectangle();const a=i.on("mousedown.brush");i.on("mousedown.brush",function(){const e=o().ctrlKey||o().metaKey;o().shiftKey&&e?t.reset():e?(d(r.select(this),["inactive"],["active"]),t.create_brush()):o().shiftKey&&!1===t.selecting_brush?(d(t.d3el.selectAll(".selector"),["visible"],["active","inactive"]),t.selecting_brush=!0):(d(t.d3el.selectAll(".selector"),["inactive"],["visible"]),d(r.select(this),["active"],["inactive"]),a.call(this),t.selecting_brush=!1)}),this.curr_index=this.curr_index+1}get_label(t,e){return null==e&&(e=this.names),e.length>t?e[t]:t}brush_start(){this.model.set("brushing",!0),this.touch()}brush_move(t,e){const n=o().selection,i=!this.model.get("show_names");r.select(e).select("text").style("display",!n||i?"none":"inline"),this.set_text_location(e,n),this.convert_and_save(n,t)}brush_end(t,e){const n=o().selection;this.model.set("brushing",!1),this.convert_and_save(n,t)}set_text_location(t,e){const n="vertical"==this.model.get("orientation")?"y":"x",i=(e[0]+e[1])/2;r.select(t).select("text").attr(n,i)}reset(){this.d3el.selectAll(".selector").remove(),this.model.set("_selected",{}),this.curr_index=0,this.touch(),this.create_brush()}convert_and_save(t,e){if(t){const n=c.deepCopy(this.model.get("_selected"));n[this.get_label(e)]=t.map(this.scale.invert.bind(this.scale)),this.update_mark_selected(t),this.model.set("_selected",n),this.touch()}else this.update_mark_selected(),this.model.set("_selected",{}),this.touch()}selected_changed(){}color_change(){null!==this.model.get("color")&&this.d3el.selectAll(".selector").style("fill",this.model.get("color"))}relayout(){super.relayout(),this.adjust_rectangle(),this.d3el.select(".background").attr("width",this.width).attr("height",this.height),this.set_range([this.scale])}remove(){this.model.off("change:names",null,this),super.remove()}}},function(t,e,n){"use strict";var i=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e};Object.defineProperty(e,"__esModule",{value:!0});const r=i(n(2)),o=function(){return n(0).event}.bind(this),a=i(n(6)),s=n(49),c=i(n(85));e.LassoSelector=class extends s.BaseXYSelector{render(){super.render();const t=this.create_scales();this.line=r.line(),this.all_vertices={},this.lasso_counter=0;const e=this;Promise.all([this.mark_views_promise,t]).then(()=>{const t=r.drag().on("start",function(){e.drag_start()}).on("drag",function(){e.drag_move()}).on("end",function(){e.drag_end()});r.select(window).on("keydown",()=>{this.keydown()}),e.d3el.attr("class","lassoselector"),e.background=e.d3el.append("rect").attr("x",0).attr("y",0).attr("width",e.width).attr("height",e.height).attr("visibility","hidden").attr("pointer-events","all").style("cursor","crosshair").call(t),e.create_listeners()})}create_listeners(){super.create_listeners(),this.listenTo(this.model,"change:color",this.change_color)}change_color(t,e){e&&this.d3el.selectAll("path").style("stroke",e)}create_new_lasso(){const t=this.d3el.append("path").attr("id","l"+ ++this.lasso_counter).on("click",function(){const t=r.select(this);t.classed("selected",!t.classed("selected"))}),e=this.model.get("color");e&&t.style("stroke",e)}drag_start(){this.current_vertices=[],this.create_new_lasso()}drag_move(){this.current_vertices.push(r.mouse(this.background.node())),this.d3el.select("#l"+this.lasso_counter).attr("d",this.line(this.current_vertices))}drag_end(){const t="l"+this.lasso_counter;this.d3el.select("#"+t).attr("d",this.line(this.current_vertices)+"Z"),this.all_vertices[t]=this.current_vertices,this.update_mark_selected(this.all_vertices)}update_mark_selected(t){void 0!==t&&0!==t.length||a.each(this.mark_views,function(t){return t.selector_changed()});const e=function(e){for(let n in t)if(c.point_in_lasso(e,t[n]))return!0;return!1},n=function(e){for(let n in t)if(c.lasso_inter_rect(e[0],e[1],t[n]))return!0;return!1};a.each(this.mark_views,function(t){t.selector_changed(e,n)},this)}relayout(){super.relayout(),this.background.attr("width",this.width).attr("height",this.height)}keydown(){if(46===o().keyCode){const t=this.d3el.selectAll(".selected"),e=this.all_vertices;t.each(function(){const t=r.select(this).attr("id");delete e[t]}),t.remove(),this.update_mark_selected(this.all_vertices)}}reset(){this.lasso_counter=0,this.all_vertices={},this.d3el.selectAll("path").remove(),this.update_mark_selected()}selected_changed(){}}},function(t,e,n){"use strict";var i=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e};Object.defineProperty(e,"__esModule",{value:!0});const r=i(n(10)),o=i(n(2)),a=function(){return n(0).event}.bind(this),s=i(n(61)),c=i(n(6));e.PanZoom=class extends s.Interaction{render(){super.render();const t=this;this.d3el.style("cursor","move").on("mousedown",function(){t.mousedown()}).on("mousemove",function(){t.mousemove()}).on("mouseup",function(){t.mouseup()}).on("mousewheel",function(){t.mousewheel()}).on("DOMMouseScroll.zoom",function(){t.mousewheel()}).on("mousewheel.zoom",null).on("wheel.zoom",null),this.active=!1,this.update_scales(),this.listenTo(this.model,"change:scales",this.update_scales),this.set_ranges(),this.listenTo(this.parent,"margin_updated",this.set_ranges)}update_scales(){const t=this.model.get("scales"),e=this;this.scale_promises=r.resolvePromisesDict({x:Promise.all((t.x||[]).map(function(t){return e.create_child_view(t)})),y:Promise.all((t.y||[]).map(function(t){return e.create_child_view(t)}))}),r.resolvePromisesDict(this.scale_promises).then(c.bind(this.set_ranges,this))}set_ranges(){const t=this;let e;this.scale_promises.then(function(n){const i=n.x;for(e=0;e{["x","y"].forEach(n=>{t[n].forEach((t,i)=>{if(t.scale.invert){const r=t.scale.copy().domain(this.domains_in_order[n][i]),o=r(this.domains_in_order[n][i][0]),a=r(this.domains_in_order[n][i][1]),s=r.invert(o-e[n]),c=r.invert(a-e[n]);this.set_scale_attribute(t.model,"min",s),this.set_scale_attribute(t.model,"max",c),t.touch()}})})})}}mousewheel(){if(this.model.get("allow_zoom")){a().preventDefault();const t=a().wheelDelta||-40*a().detail,e=o.mouse(this.el);this._zoom(e,t)}}_zoom(t,e){if(e){e>0?this.d3el.style("cursor","zoom-in"):this.d3el.style("cursor","zoom-out");const n={x:t[0],y:t[1]},i=Math.exp(.001*-e);return this.scale_promises.then(t=>{["x","y"].forEach(e=>{t[e].forEach((t,r)=>{if(t.scale.invert){const r=t.scale;let[o,a]=t.model.get_domain_slice_in_order();const s=r(o),c=r(a);o=r.invert((1-i)*n[e]+i*s),a=r.invert((1-i)*n[e]+i*c),this.set_scale_attribute(t.model,"min",o),this.set_scale_attribute(t.model,"max",a),t.touch()}})})})}}set_scale_attribute(t,e,n){"date"==t.type?(n=n instanceof Date?n:new Date(n),t.set_date_elem(e,n)):t.set(e,n)}}},function(t,e,n){"use strict";var i=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e};Object.defineProperty(e,"__esModule",{value:!0});const r=i(n(2)),o=n(88);e.ColorAxis=class extends o.Axis{render(){this.parent=this.options.parent,this.vertical="vertical"===this.model.get("orientation");const t=this.set_scale(this.model.get("scale"));this.side=this.model.get("side"),this.x_offset=100,this.y_offset=40,this.bar_height=20,this.d3el.attr("class","ColorBar").attr("display",this.model.get("visible")?"inline":"none").attr("transform",this.get_topg_transform()),this.ordinal=!1,this.num_ticks=this.model.get("num_ticks");const e=this;return t.then(function(){e.create_listeners(),e.tick_format=e.generate_tick_formatter(),e.set_scales_range(),e.append_axis()})}create_listeners(){this.listenTo(this.model,"change:scale",function(t,e){this.update_scale(t.previous("scale"),e),this.axis.scale(this.axis_scale.scale),this.rescale_axis()}),this.listenTo(this.model,"change:tick_format",this.tickformat_changed),this.axis_scale.on("domain_changed",this.redraw_axisline,this),this.axis_scale.on("color_scale_range_changed",this.redraw_axis,this),this.axis_scale.on("highlight_axis",this.highlight,this),this.axis_scale.on("unhighlight_axis",this.unhighlight,this),this.parent.on("margin_updated",this.parent_margin_updated,this),this.listenTo(this.model,"change:visible",this.update_visibility),this.listenTo(this.model,"change:label",this.update_label),this.model.on_some_change(["side","orientation"],this.update_display,this)}update_display(){this.side=this.model.get("side"),this.vertical="vertical"===this.model.get("orientation"),this.vertical?this.axis="right"===this.side?r.axisRight(this.axis_scale.scale):r.axisLeft(this.axis_scale.scale):this.axis="top"===this.side?r.axisTop(this.axis_scale.scale):r.axisBottom(this.axis_scale.scale),this.g_axisline.remove(),this.g_axisline=this.d3el.select("#colorBarG"+this.cid).append("g").attr("class","axis"),this.rescale_axis(),this.d3el.select("#colorBarG"+this.cid).attr("transform",this.get_colorbar_transform()),this.d3el.select("#colorBarG"+this.cid).select(".g-rect").attr("transform",this.vertical?"rotate(-90)":""),this.redraw_axisline()}set_scale(t){const e=this;return this.axis_scale&&this.axis_scale.remove(),this.create_child_view(t).then(function(t){e.displayed.then(function(){t.trigger("displayed")}),e.axis_scale=t,"date_color_linear"===e.axis_scale.model.type?e.axis_line_scale=r.scaleTime().nice():"ordinal"===e.axis_scale.model.type?(e.axis_line_scale=r.scaleBand(),e.ordinal=!0):e.axis_line_scale=r.scaleLinear()})}append_axis(){void 0!==this.model.get("label")&&null!==this.model.get("label")&&this.d3el.append("g").attr("transform",this.get_label_transform()).attr("class","axis label_g").append("text").append("tspan").attr("id","text_elem").attr("dy","0.5ex").attr("class","axislabel").style("text-anchor",this.vertical?"middle":"end").text(this.model.get("label"));const t=this.d3el.append("g").attr("id","colorBarG"+this.cid);this.draw_color_bar(),this.set_axisline_domain(),this.g_axisline=t.append("g").attr("class","axis"),this.vertical?this.axis="right"===this.side?r.axisRight(this.axis_scale.scale):r.axisLeft(this.axis_scale.scale):this.axis="top"===this.side?r.axisTop(this.axis_scale.scale):r.axisBottom(this.axis_scale.scale),this.axis=this.axis.tickFormat(this.tick_format),this.redraw_axisline()}draw_color_bar(){const t=this.d3el.select("#colorBarG"+this.cid);t.attr("transform",this.get_colorbar_transform());const e=this;t.selectAll(".g-rect").remove(),t.selectAll(".g-defs").remove(),this.colors=this.axis_scale.scale.range();const n=100/(this.colors.length-1);if(this.ordinal){const n=this.get_color_bar_width()/this.colors.length;let i=t.append("g").attr("class","g-rect axis").selectAll("rect").data(this.colors);i=i.enter().append("rect").attr("y",0).attr("height",this.bar_height).attr("width",n).style("fill",function(t){return t}).merge(i),this.vertical?i.attr("x",function(t,i){return i*n-(e.height-2*e.x_offset)}):i.attr("x",function(t,e){return e*n})}else t.append("g").attr("class","g-defs").append("defs").append("linearGradient").attrs({id:"colorBarGradient"+this.cid,x1:"0%",y1:"0%",x2:"100%",y2:"0%"}).selectAll("stop").data(this.colors).enter().append("stop").attrs({offset:function(t,e){return n*e+"%"},"stop-color":function(t,n){return e.colors[n]},"stop-opacity":1}),t.append("g").attr("class","g-rect axis").append("rect").attrs({width:this.get_color_bar_width(),height:this.bar_height,x:this.vertical?-(this.height-2*this.x_offset):0,y:0,"stroke-width":1}).style("fill","url(#colorBarGradient"+this.cid+")");this.vertical&&t.select(".g-rect").attr("transform","rotate(-90)")}get_topg_transform(){return this.vertical?"right"===this.side?"translate("+String(this.get_basic_transform()+this.margin.right/2-this.bar_height)+", 0)":"translate("+String(this.get_basic_transform()-this.margin.left/2+this.bar_height)+", 0)":"top"===this.side?"translate(0, "+String(this.get_basic_transform()-this.margin.top+this.bar_height+24)+")":"translate(0, "+String(this.get_basic_transform()+this.margin.bottom-this.bar_height-24)+")"}get_label_transform(){return this.vertical?"translate("+("right"===this.side?this.bar_height/2:-this.bar_height/2)+", "+(this.x_offset-15)+")":"translate("+(this.x_offset-5)+", "+this.bar_height/2+")"}get_colorbar_transform(){return this.vertical?"translate(0, "+String(this.x_offset)+")":"translate("+String(this.x_offset)+", 0)"}set_axisline_scale_range(){const t=this.vertical?[this.height-2*this.x_offset,0]:[0,this.width-2*this.x_offset];if(this.ordinal)this.axis_line_scale.rangeRound(t).padding(.05);else{const e=this.axis_scale.model.mid;null==e?this.axis_line_scale.range(t):this.axis_line_scale.range([t[0],.5*(t[0]+t[1]),t[1]])}}set_scales_range(){this.axis_scale.set_range(),this.set_axisline_scale_range()}get_color_bar_width(){return this.vertical?this.height-2*this.x_offset:this.width-2*this.x_offset}update_label(){this.d3el.select("#text_elem").text(this.model.get("label"))}rescale_axis(){this.set_axisline_scale_range(),this.d3el.attr("transform",this.get_topg_transform());const t=this,e=this.get_color_bar_width()/this.colors.length;if(this.ordinal){const n=this.d3el.select("#colorBarG"+this.cid).select(".g-rect").selectAll("rect").attr("width",e);this.vertical?n.attr("x",function(n,i){return i*e-(t.height-2*t.x_offset)}):n.attr("x",function(t,n){return n*e})}else this.d3el.select("#colorBarG"+this.cid).select(".g-rect").selectAll("rect").attr("width",this.get_color_bar_width()).attr("x",this.vertical?-(this.height-2*this.x_offset):0);void 0!==this.model.get("label")&&null!==this.model.get("label")&&this.d3el.select(".label_g").attr("transform",this.get_label_transform()).select("#text_elem").style("text-anchor",this.vertical?"middle":"end"),this.g_axisline.call(this.axis)}redraw_axisline(){if(this.axis){let t;this.set_axisline_domain(),this.set_axisline_scale_range(),this.axis.scale(this.axis_line_scale),this.set_tick_values(),t=this.vertical?"translate("+("right"===this.side?this.bar_height:0)+", 0)":"translate(0, "+("top"===this.side?0:this.bar_height)+")",this.g_axisline.attr("transform",t).call(this.axis)}}set_axisline_domain(){const t=this.axis_scale.scale.domain();if(this.ordinal)this.axis_line_scale.domain(t);else{const e=this.axis_scale.model.mid;null==e?this.axis_line_scale.domain([t[0],t[t.length-1]]):this.axis_line_scale.domain([t[0],e,t[t.length-1]])}}redraw_axis(){this.draw_color_bar(),this.redraw_axisline()}}},function(t,e,n){"use strict";var i=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e};Object.defineProperty(e,"__esModule",{value:!0});const r=i(n(10)),o=n(28),a=i(n(6));class s extends r.WidgetModel{defaults(){return Object.assign({},r.WidgetModel.prototype.defaults(),{_model_name:"PanZoomModel",_view_name:"PanZoom",_model_module:"bqplot",_view_module:"bqplot",_model_module_version:o.semver_range,_view_module_version:o.semver_range,scales:{},allow_pan:!0,allow_zoom:!0})}initialize(t,e){super.initialize(t,e),this.on("change:scales",this.snapshot_scales,this),this.snapshot_scales()}reset_scales(){r.resolvePromisesDict(this.get("scales")).then(t=>{a.each(Object.keys(t),e=>{a.each(t[e],(t,n)=>{t.set_state(this.scales_states[e][n])},this)},this)})}snapshot_scales(){r.resolvePromisesDict(this.get("scales")).then(t=>{this.scales_states=Object.keys(t).reduce((e,n)=>(e[n]=t[n].map(t=>t.get_state()),e),{})})}}s.serializers=Object.assign({},r.WidgetModel.serializers,{scales:{deserialize:r.unpack_models}}),e.PanZoomModel=s},function(t,e,n){"use strict";var i=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e};Object.defineProperty(e,"__esModule",{value:!0});const r=i(n(2));n(31);const o=function(){return n(0).event}.bind(this),a=i(n(6)),s=n(19),c=n(17);e.Pie=class extends s.Mark{render(){const t=super.render();this.selected_indices=this.model.get("selected"),this.selected_style=this.model.get("selected_style"),this.unselected_style=this.model.get("unselected_style"),this.display_el_classes=["slice","text"],this.pie_g=this.d3el.append("g").attr("class","pie"),this.pie_g.append("g").attr("class","slices"),this.pie_g.append("g").attr("class","labels"),this.pie_g.append("g").attr("class","lines");const e=this.model.get("radius"),n=this.model.get("inner_radius");return"outside"===this.model.get("display_labels")?(this.arc=r.arc().outerRadius(.8*e).innerRadius(.8*n),this.outer_arc=r.arc().innerRadius(.9*e).outerRadius(.9*e)):this.arc=r.arc().outerRadius(e).innerRadius(n),this.displayed.then(()=>{this.parent.tooltip_div.node().appendChild(this.tooltip_div.node()),this.create_tooltip()}),t.then(()=>{this.event_listeners={},this.process_interactions(),this.create_listeners(),this.compute_view_padding(),this.draw()},null)}set_ranges(){const t=this.scales.x;t&&(t.set_range(this.parent.padded_range("x",t.model)),this.x_offset=t.offset);const e=this.scales.y;e&&(e.set_range(this.parent.padded_range("y",e.model)),this.y_offset=e.offset)}set_positional_scales(){const t=this.scales.x?this.scales.x:this.parent.scale_x,e=this.scales.y?this.scales.y:this.parent.scale_y,n=this;this.listenTo(t,"domain_changed",function(){n.model.dirty||n.draw()}),this.listenTo(e,"domain_changed",function(){n.model.dirty||n.draw()})}create_listeners(){super.create_listeners(),this.d3el.on("mouseover",a.bind(function(){this.event_dispatcher("mouse_over")},this)).on("mousemove",a.bind(function(){this.event_dispatcher("mouse_move")},this)).on("mouseout",a.bind(function(){this.event_dispatcher("mouse_out")},this)),this.listenTo(this.model,"data_updated",function(){this.draw(!0)}),this.listenTo(this.model,"colors_updated",this.updateSlices),this.model.on_some_change(["inner_radius","radius"],function(){this.compute_view_padding(),this.update_radius(!0)},this),this.model.on_some_change(["colors","stroke","opacities"],this.updateSlices,this),this.model.on_some_change(["x","y"],function(){this.position_center(!0)},this),this.model.on_some_change(["display_labels","label_color","font_size","font_weight","display_values","values_format"],function(){this.updateLabels(!0)},this),this.model.on_some_change(["start_angle","end_angle","sort"],function(){this.draw(!0)},this),this.listenTo(this.model,"labels_updated",function(){this.updateLabels(!0),this.updatePolylines(!0)}),this.listenTo(this.model,"change:selected",function(){this.selected_indices=this.model.get("selected"),this.apply_styles()}),this.listenTo(this.model,"change:interactions",this.process_interactions),this.listenTo(this.parent,"bg_clicked",function(){this.event_dispatcher("parent_clicked")})}process_click(t){super.process_click(t),"select"===t&&(this.event_listeners.parent_clicked=this.reset_selection,this.event_listeners.element_clicked=this.click_handler)}relayout(){this.set_ranges(),this.position_center(),this.update_radius()}position_center(t){const e=!0===t?this.parent.model.get("animation_duration"):0,n=this.scales.x?this.scales.x:this.parent.scale_x,i=this.scales.y?this.scales.y:this.parent.scale_y,r="date"===n.model.type?c.getDate(this.model.get("x")):this.model.get("x"),o="date"===i.model.type?c.getDate(this.model.get("y")):this.model.get("y"),a="translate("+(n.scale(r)+n.offset)+", "+(i.scale(o)+i.offset)+")";this.pie_g.transition("position_center").duration(e).attr("transform",a)}update_radius(t){const e=!0===t?this.parent.model.get("animation_duration"):0,n=this.model.get("radius"),i=this.model.get("inner_radius"),r=this.model.get("display_labels");"inside"===r?this.arc.outerRadius(n).innerRadius(i):"outside"===r&&(this.arc.outerRadius(.8*n).innerRadius(.8*i),this.outer_arc.innerRadius(.9*n).outerRadius(.9*n));const o=this.pie_g.select(".slices"),a=this.pie_g.select(".labels"),s=this.pie_g.select(".lines"),c=this;o.selectAll(".slice").transition("update_radius").duration(e).attr("d",this.arc),"inside"===r?a.selectAll("text").transition("update_radius").duration(e).attr("transform",function(t){return"translate("+c.arc.centroid(t)+")"}):"outside"===r&&(a.selectAll("text").transition("update_radius").duration(e).attr("transform",function(t){const e=c.outer_arc.centroid(t);return e[0]=n*("left"===c.mid_angle_location(t)?-1:1),"translate("+e+")"}),s.selectAll("polyline").transition("update_radius").duration(e).attr("points",function(t){const e=c.outer_arc.centroid(t);return e[0]=.95*n*("left"===c.mid_angle_location(t)?-1:1),[c.arc.centroid(t),c.outer_arc.centroid(t),e]}))}mid_angle_location(t){const e=(t.startAngle+t.endAngle)/2;return e>Math.PI||e<0&&e>-Math.PI?"left":"right"}draw(t){this.set_ranges(),this.position_center(t),this.d3Pie=r.pie().startAngle(2*this.model.get("start_angle")*Math.PI/360).endAngle(2*this.model.get("end_angle")*Math.PI/360).value(function(t){return t.size}),this.model.get("sort")||this.d3Pie.sort(null),this.updateSlices(t),this.updateLabels(t),this.updatePolylines(t)}updateSlices(t){const e=this,n=!0===t?this.parent.model.get("animation_duration"):0,i=this.pie_g.select(".slices").selectAll(".slice").data(this.d3Pie(this.model.mark_data)),o=this.model.get("stroke"),a=this.model.get("opacities"),s=this.scales.color;i.enter().append("path").attr("class","slice").each(function(t){this._current=t}).on("click",function(t,n){return e.event_dispatcher("element_clicked",{data:t,index:n})}).merge(i).transition("draw").duration(n).style("fill",function(t,n){return void 0!==t.data.color&&void 0!==s?s.scale(t.data.color):e.get_colors(t.data.index)}).style("stroke",o).style("opacity",(t,e)=>a[e]).attrTween("d",function(t){const n=r.interpolate(this._current,t);return this._current=t,function(t){return e.arc(n(t))}}),i.exit().transition("remove").duration(n).style("opacity",0).remove(),this.apply_styles()}updateLabels(t){const e=this,n=!0===t?this.parent.model.get("animation_duration"):0,i=this.model.get("display_labels"),o=this.model.get("display_values"),a=r.format(this.model.get("values_format")),s=this.pie_g.select(".labels").selectAll("text").data(this.d3Pie(this.model.mark_data)),c=s.enter().append("text").attr("dy",".35em").style("opacity",0).each(function(t){this._current=t}).merge(s).transition("draw").duration(n).text(t=>""===t.data.label?"":o?t.data.label+": "+a(t.data.size):t.data.label).style("font-weight",this.model.get("font_weight")).style("font-size",this.model.get("font_size")).style("opacity",t=>"none"===i||0==t.value?0:1),l=this.model.get("label_color");void 0!==l&&c.style("fill",l),"inside"===i?c.attr("transform",t=>"translate("+this.arc.centroid(t)+")").style("text-anchor","middle"):"outside"===i&&c.attrTween("transform",function(t){const n=r.interpolate(this._current,t),i=this;return function(r){const o=n(r);i._current=o;const a=e.outer_arc.centroid(o);return a[0]=e.model.get("radius")*("left"===e.mid_angle_location(t)?-1:1),"translate("+a+")"}}).styleTween("text-anchor",function(t){const n=r.interpolate(this._current,t);return function(t){const i=n(t);return"left"===e.mid_angle_location(i)?"end":"start"}}),s.exit().remove()}updatePolylines(t){const e=this,n=!0===t?this.parent.model.get("animation_duration"):0,i=this.model.get("display_labels"),o=this.pie_g.select(".lines").selectAll("polyline").data(this.d3Pie(this.model.mark_data)),a=o.enter().append("polyline").each(function(t){this._current=t}).merge(o).transition("draw").duration(n).style("opacity",t=>"outside"!==i||0==t.value||""===t.data.label?0:1);"outside"===i&&a.attrTween("points",function(t){this._current=this._current;const n=r.interpolate(this._current,t),i=this;return function(t){const r=n(t);i._current=r;const o=e.outer_arc.centroid(r);return o[0]=.95*e.model.get("radius")*("left"===e.mid_angle_location(r)?-1:1),[e.arc.centroid(r),e.outer_arc.centroid(r),o]}}),o.exit().remove()}clear_style(t,e){let n=this.pie_g.selectAll(".slice");e&&(n=n.filter(function(t,n){return-1!==e.indexOf(n)}));const i={};for(let e in t)i[e]=null;n.styles(i)}set_style_on_elements(t,e){if(null==e||0===e.length)return;let n=this.pie_g.selectAll(".slice");(n=n.filter(function(t,n){return-1!==e.indexOf(n)})).styles(t)}set_default_style(t){const e=this,n=this.model.get("stroke"),i=this.model.get("opacities"),r=this.scales.color;this.pie_g.select(".slices").selectAll(".slice").style("fill",function(t,n){return void 0!==t.data.color&&void 0!==r?r.scale(t.data.color):e.get_colors(t.data.index)}).style("stroke",n).style("opacity",(t,e)=>i[e])}click_handler(t){const e=t.index,n=this,i=this.model.get("selected")||[];let s=Array.from(i);const c=s.indexOf(e),l=o().ctrlKey||o().metaKey;if(c>-1&&l)s.splice(c,1);else{if(o().shiftKey){if(c>-1)return;const t=0!==s.length?r.min(s):-1,i=0!==s.length?r.max(s):n.model.mark_data.length;e>i?a.range(i+1,e).forEach(function(t){s.push(t)}):e0&&this.scale.domain(this.model.domain),this.offset=0,this.create_event_listeners()}}},function(t,e,n){"use strict";var i=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e};Object.defineProperty(e,"__esModule",{value:!0});const r=n(136),o=i(n(64)),a=i(n(2)),s=o.symbol;e.Scatter=class extends r.ScatterBase{render(){return this.dot=s().type(this.model.get("marker")).size(this.model.get("default_size")).skew(this.model.get("default_skew")),super.render()}create_listeners(){super.create_listeners(),this.listenTo(this.model,"change:colors",this.update_colors),this.listenTo(this.model,"change:stroke",this.update_stroke),this.listenTo(this.model,"change:stroke_width",this.update_stroke_width),this.listenTo(this.model,"change:default_opacities",this.update_default_opacities),this.listenTo(this.model,"change:default_skew",this.update_default_skew),this.listenTo(this.model,"change:marker",this.update_marker),this.listenTo(this.model,"change:default_size",this.update_default_size),this.listenTo(this.model,"change:fill",this.update_fill),this.listenTo(this.model,"change:display_names",this.update_names)}update_colors(t,e){if(!this.model.dirty){const t=this,n=this.model.get("stroke"),i=e.length;this.d3el.selectAll(".dot").style("fill",this.model.get("fill")?function(e,n){return t.get_element_color(e,n)}:"none").style("stroke",n||function(e,n){return t.get_element_color(e,n)}),this.legend_el&&(this.legend_el.select("path").style("fill",function(t,n){return e[n%i]}).style("stroke",n||function(t,n){return e[n%i]}),this.legend_el.select("text").style("fill",this.model.get("fill")?function(t,n){return e[n%i]}:"none"))}this.apply_styles()}update_fill(t,e){const n=this,i=this.model.get("colors"),r=i.length;this.d3el.selectAll(".dot").style("fill",e?function(t,e){return n.get_element_color(t,e)}:"none"),this.legend_el&&this.legend_el.selectAll("path").style("fill",e?function(t,e){return i[e%r]}:"none")}update_stroke_width(){const t=this.model.get("stroke_width");this.d3el.selectAll(".dot").style("stroke-width",t),this.legend_el&&this.legend_el.selectAll("path").style("stroke-width",t)}update_stroke(t,e){const n=this,i=this.model.get("stroke");this.d3el.selectAll(".dot").style("stroke",i||function(t,e){return n.get_element_color(t,e)}),this.legend_el&&this.legend_el.selectAll("path").style("stroke",i)}update_default_opacities(t){if(!this.model.dirty){const e=this.model.get("default_opacities"),n=this.model.get("colors"),i=n.length,r=e.length,o=!0===t?this.parent.model.get("animation_duration"):0,a=this;this.d3el.selectAll(".dot").transition("update_default_opacities").duration(o).style("opacity",function(t,e){return a.get_element_opacity(t,e)}),this.legend_el&&this.legend_el.select("path").style("opacity",function(t,n){return e[n%r]}).style("fill",function(t,e){return n[e%i]})}}update_marker(t,e){this.model.dirty||(this.d3el.selectAll(".dot").transition("update_marker").duration(this.parent.model.get("animation_duration")).attr("d",this.dot.type(e)),this.legend_el&&this.legend_el.select("path").attr("d",this.dot.type(e)))}update_default_skew(t){if(!this.model.dirty){const e=!0===t?this.parent.model.get("animation_duration"):0,n=this;this.d3el.selectAll(".dot").transition("update_default_skew").duration(e).attr("d",this.dot.skew(function(t){return n.get_element_skew(t)}))}}update_default_size(t){if(this.compute_view_padding(),!this.model.dirty){const e=!0===t?this.parent.model.get("animation_duration"):0,n=this;this.d3el.selectAll(".dot").transition("update_default_size").duration(e).attr("d",this.dot.size(function(t){return n.get_element_size(t)})),this.update_names(t)}}update_names(t){const e=this,n=this.model.get("names")||[],i=this.model.get("display_names")&&0!==n.length,r=t?this.parent.model.get("animation_duration"):0;this.d3el.selectAll(".object_grp").select("text").text(function(t){return t.name}).transition("update_names").duration(r).attr("transform",function(t){const n=Math.sqrt(e.get_element_size(t))/2;return"translate("+n+","+-n+")"}).attr("display",function(t){return i?"inline":"none"})}color_scale_updated(t){const e=this,n=this.model.get("fill"),i=this.model.get("stroke"),r=!0===t?this.parent.model.get("animation_duration"):0;this.d3el.selectAll(".object_grp").select("path").transition("color_scale_updated").duration(r).style("fill",n?function(t,n){return e.get_element_color(t,n)}:"none").style("stroke",i||function(t,n){return e.get_element_color(t,n)})}draw_elements(t,e){const n=this,i=!0===t?this.parent.model.get("animation_duration"):0,r=this.d3el.selectAll(".object_grp");e.append("path").attr("class","dot element"),e.append("text").attr("class","dot_text"),r.select("path").transition("draw_elements").duration(i).attr("d",this.dot.size(function(t){return n.get_element_size(t)}).skew(function(t){return n.get_element_skew(t)})),this.update_names(t),this.apply_styles()}draw_legend_elements(t,e){const n=this.model.get("colors"),i=n.length,r=this.model.get("stroke");t.append("path").attr("transform",function(t,n){return"translate( "+e/2+", "+e/2+")"}).attr("d",this.dot.size(64)).style("fill",this.model.get("fill")?function(t,e){return n[e%i]}:"none").style("stroke",r||function(t,e){return n[e%i]})}set_default_style(t){if(!t||0===t.length)return;const e=this.d3el.selectAll(".element").filter(function(e,n){return-1!==t.indexOf(n)}),n=this.model.get("fill"),i=this.model.get("stroke"),r=this.model.get("stroke_width"),o=this;e.style("fill",n?function(t,e){return o.get_element_color(t,e)}:"none").style("stroke",i||function(t,e){return o.get_element_color(t,e)}).style("opacity",function(t,e){return o.get_element_opacity(t,e)}).style("stroke-width",r)}set_drag_style(t,e,n){a.select(n).select("path").classed("drag_scatter",!0).transition("set_drag_style").attr("d",this.dot.size(5*this.model.get("default_size")));const i=this.model.get("drag_color");i&&a.select(n).select("path").style("fill",i).style("stroke",i)}reset_drag_style(t,e,n){const i=this.model.get("stroke"),r=this.get_element_color(t,e);a.select(n).select("path").classed("drag_scatter",!1).transition("reset_drag_style").attr("d",this.dot.size(this.get_element_size(t))),this.model.get("drag_color")&&a.select(n).select("path").style("fill",r).style("stroke",i||r)}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const i=n(63),r=n(17);e.DateScaleModel=class extends i.LinearScaleModel{defaults(){return Object.assign({},i.LinearScaleModel.prototype.defaults(),{_model_name:"DateScaleModel",_view_name:"DateScale",min:null,max:null})}set_init_state(){this.type="date",this.global_min=(new Date).setTime(0),this.global_max=new Date}min_max_changed(){this.min=r.getDate(this.get("min")),this.max=r.getDate(this.get("max")),this.min_from_data=null===this.min,this.max_from_data=null===this.max,this.update_domain()}}},function(t,e,n){"use strict";var i=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e};Object.defineProperty(e,"__esModule",{value:!0});const r=i(n(2)),o=i(n(6)),a=n(18),s=i(n(12)),c=i(n(17));class l extends a.MarkModel{defaults(){return Object.assign({},a.MarkModel.prototype.defaults(),{_model_name:"LinesModel",_view_name:"Lines",x:[],y:[],color:null,scales_metadata:{x:{orientation:"horizontal",dimension:"x"},y:{orientation:"vertical",dimension:"y"},color:{dimension:"color"}},colors:r.scaleOrdinal(r.schemeCategory10).range(),fill_colors:r.scaleOrdinal(r.schemeCategory10).range(),stroke_width:2,labels_visibility:"none",curves_subset:[],line_style:"solid",interpolation:"linear",close_path:!1,fill:"none",marker:null,marker_size:64,opacities:[],fill_opacities:[]})}initialize(t,e){super.initialize(t,e),this.on_some_change(["x","y","color"],this.update_data,this),this.on("change:labels",this.update_labels,this),this.on_some_change(["preserve_domain"],this.update_domains,this),this.update_data(),this.update_domains()}update_data(){this.dirty=!0;const t=this;this.x_data=this.get("x"),this.y_data=this.get("y"),this.color_data=this.get("color")||[];let e=this.get("labels");if(0===this.x_data.length||0===this.y_data.length)this.mark_data=[];else{this.x_data=c.is_array(this.x_data[0])?this.x_data:[this.x_data],this.y_data=c.is_array(this.y_data[0])?this.y_data:[this.y_data],e=this.get_labels();const n=this.y_data.length;1==this.x_data.length&&n>1?this.mark_data=e.map(function(e,i){return{name:e,values:Array.prototype.map.call(t.y_data[i],function(e,r){return{x:t.x_data[0][r],y:e,y0:t.y_data[Math.min(i+1,n-1)][r],sub_index:r}}),color:t.color_data[i],index:i}}):this.mark_data=e.map(function(e,i){return{name:e,values:r.zip(t.x_data[i],t.y_data[i]).map(function(e,r){return{x:e[0],y:e[1],y0:t.y_data[Math.min(i+1,n-1)][r],sub_index:r}}),color:t.color_data[i],index:i}})}this.update_domains(),this.dirty=!1,this.trigger("data_updated")}update_labels(){const t=this.get_labels();this.mark_data.forEach(function(e,n){e.name=t[n]}),this.trigger("labels_updated")}get_labels(){let t=this.get("labels");const e=1==this.x_data.length?this.y_data.length:Math.min(this.x_data.length,this.y_data.length);return t.length>e?t=t.slice(0,e):t.length0?this.size:parseInt(this.rect.attr("width")),n=(this.height-t[1])/this.height,i=this.freeze_but_move?e:Math.round(n*this.width);let r;r=t[0]-i/2<0?0:t[0]+i/2>this.width?this.width-i:t[0]-i/2,this.rect.attr("x",r),this.rect.attr("width",i);const a=[r,r+i];this.set_selected("selected",this.scale.invert_range(a)),this.update_mark_selected(a,void 0),this.touch(),this.dirty=!1}update_mark_selected(t,e){let n,i;if(void 0!==t&&0!==t.length||r.each(this.mark_views,function(t){return t.selector_changed()}),void 0===e){const e=this.model.get("orientation");n="vertical"==e?[]:t,i="vertical"==e?t:[]}else n=t,i=e;const o=function(t){return s.point_in_rectangle(t,n,i)},a=function(t){return s.rect_inter_rect(t[0],t[1],n,i)};r.each(this.mark_views,function(t){t.selector_changed(o,a)},this)}relayout(){super.relayout(),this.adjust_rectangle(),this.background.attr("width",this.width).attr("height",this.height),this.set_range([this.scale])}reset(){this.rect.attr("x",0).attr("width",0),this.model.set("selected",null),this.update_mark_selected(void 0,void 0),this.touch()}update_scale_domain(t){super.update_scale_domain(),!0!==t&&this.selected_changed()}selected_changed(){if(this.dirty)return;const t=this.model.get("selected")||[];if(0===t.length)this.reset();else{if(2!=t.length)return;{let e=t.map(this.scale.scale);e=e.sort(function(t,e){return t-e}),this.rect.attrs({x:e[0],width:e[1]-e[0]}).style("display","inline"),this.active=!0,this.update_mark_selected(e,void 0)}}}adjust_rectangle(){"vertical"==this.model.get("orientation")?this.d3el.selectAll("rect").attr("x",0).attr("width",this.width):this.d3el.selectAll("rect").attr("y",0).attr("height",this.height)}}},function(t,e,n){"use strict";var i=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e};Object.defineProperty(e,"__esModule",{value:!0});const r=i(n(2)),o=n(86);e.LogScale=class extends o.LinearScale{render(){this.scale=r.scaleLog(),this.model.domain.length>0&&this.scale.domain(this.model.domain),this.offset=0,this.create_event_listeners()}}},function(t,e,n){"use strict";n.r(e),e.default="float scale_transform_linear(float domain_value, vec2 range, vec2 domain) {\n float normalized = (domain_value - domain[0]) / (domain[1] - domain[0]);\n float range_value = normalized * (range[1] - range[0]) + range[0];\n return range_value;\n}\n\nfloat scale_transform_linear_inverse(float range_value, vec2 range, vec2 domain) {\n float normalized = (range_value - range[0]) / (range[1] - range[0]);\n float domain_value = normalized * (domain[1] - domain[0]) + domain[0];\n return domain_value;\n}\n\nfloat scale_transform_log(float domain_value, vec2 range, vec2 domain) {\n float normalized = (log(domain_value) - log(domain[0])) / (log(domain[1]) - log(domain[0]));\n float range_value = normalized * (range[1] - range[0]) + range[0];\n return range_value;\n}\n\nfloat scale_transform_log_inverse(float range_value, vec2 range, vec2 domain) {\n float normalized = (range_value - range[0]) / (range[1] - range[0]);\n float domain_value = exp(normalized * (log(domain[1]) - log(domain[0])) + log(domain[0]));\n return domain_value;\n}"},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const i=n(63);e.LogScaleModel=class extends i.LinearScaleModel{defaults(){return Object.assign({},i.LinearScaleModel.prototype.defaults(),{_model_name:"LogScaleModel",_view_name:"LogScale",domain:[]})}set_init_state(){this.type="log",this.global_min=Number.MIN_VALUE,this.global_max=Number.POSITIVE_INFINITY}}},function(t,e,n){"use strict";var i=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e};Object.defineProperty(e,"__esModule",{value:!0});const r=i(n(10)),o=n(28);class a extends r.DOMWidgetModel{defaults(){return Object.assign({},r.DOMWidgetModel.prototype.defaults(),{_model_name:"FigureModel",_view_name:"Figure",_model_module:"bqplot",_view_module:"bqplot",_model_module_version:o.semver_range,_view_module_version:o.semver_range,title:"",axes:[],marks:[],interaction:null,scale_x:void 0,scale_y:void 0,title_style:{},background_style:{},legend_style:{},legend_text:{},theme:"classic",min_aspect_ratio:.01,max_aspect_ratio:100,pixel_ratio:null,fig_margin:{top:60,bottom:60,left:60,right:60},padding_x:0,padding_y:.025,legend_location:"top-right",animation_duration:0})}initialize(t,e){super.initialize(t,e),this.on("msg:custom",this.handle_custom_messages,this)}handle_custom_messages(t){"save_png"===t.type?this.trigger("save_png",t.filename,t.scale):"save_svg"===t.type&&this.trigger("save_svg",t.filename)}save_png(){this.trigger("save_png")}}a.serializers=Object.assign({},r.DOMWidgetModel.serializers,{marks:{deserialize:r.unpack_models},axes:{deserialize:r.unpack_models},interaction:{deserialize:r.unpack_models},scale_x:{deserialize:r.unpack_models},scale_y:{deserialize:r.unpack_models},layout:{deserialize:r.unpack_models}}),e.FigureModel=a},function(t,e,n){"use strict";var i=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e};Object.defineProperty(e,"__esModule",{value:!0});const r=i(n(10)),o=i(n(2)),a=()=>n(0).event,s=n(19);e.Map=class extends s.Mark{render(){const t=super.render();return this.map=this.d3el.append("svg").attr("viewBox","0 0 1200 980"),this.width=this.parent.plotarea_width,this.height=this.parent.plotarea_height,this.map_id=r.uuid(),this.enable_hover=this.model.get("enable_hover"),this.display_el_classes=["event_layer"],this.displayed.then(()=>{this.parent.tooltip_div.node().appendChild(this.tooltip_div.node()),this.create_tooltip()}),t.then(()=>{this.event_listeners={},this.process_interactions(),this.create_listeners(),this.draw()})}set_ranges(){}set_positional_scales(){const t=this.scales.projection;this.listenTo(t,"domain_changed",()=>{this.model.dirty||this.draw()})}initialize_additional_scales(){const t=this.scales.color;t&&(this.listenTo(t,"domain_changed",()=>{this.update_style()}),t.on("color_scale_range_changed",this.update_style,this))}remove_map(){o.selectAll(".world_map.map"+this.map_id).remove()}draw(){this.set_ranges(),this.remove_map(),this.transformed_g=this.map.append("g").attr("class","world_map map"+this.map_id),this.fill_g=this.transformed_g.append("g"),this.highlight_g=this.transformed_g.append("g"),this.stroke_g=this.transformed_g.append("g");const t=this.scales.projection;this.fill_g.selectAll("path").data(this.model.geodata).enter().append("path").attr("d",t.path).style("fill",(t,e)=>this.fill_g_colorfill(t,e)),this.stroke_g.selectAll("path").data(this.model.geodata).enter().append("path").attr("class","event_layer").attr("d",t.path).style("fill-opacity",0).on("click",(t,e)=>this.event_dispatcher("element_clicked",{data:t,index:e})),this.validate_color(this.model.get("stroke_color"))&&this.stroke_g.selectAll("path").style("stroke",this.model.get("stroke_color")),this.zoom=o.zoom().scaleExtent([1,8]).on("zoom",()=>{this.zoomed(this)}),this.parent.bg_events.call(this.zoom),this.parent.bg_events.on("dblclick.zoom",null),this.parent.bg_events.on("dblclick",()=>{this.reset_zoom(this)})}validate_color(t){return""!==t}mouseover_handler(){if(!this.model.get("hover_highlight"))return;const t=o.select(a().target);if(this.is_hover_element(t)){const e=t.data()[0],n=this.model.get("selected")||[],i=Array.from(n),r=this.highlight_g.append(()=>t.node().cloneNode(!0));r.classed("hovered",!0),r.classed("event_layer",!1),this.validate_color(this.model.get("hovered_styles").hovered_stroke)&&-1===i.indexOf(e.id)&&r.style("stroke",this.model.get("hovered_styles").hovered_stroke).style("stroke-width",this.model.get("hovered_styles").hovered_stroke_width),this.validate_color(this.model.get("hovered_styles").hovered_fill)&&-1===i.indexOf(e.id)&&r.style("fill-opacity",1).style("fill",()=>this.model.get("hovered_styles").hovered_fill)}}mouseout_handler(){if(!this.model.get("hover_highlight"))return;const t=o.select(a().target);this.is_hover_element(t)&&(t.transition("mouseout_handler").style("fill",(t,e)=>this.fill_g_colorfill(t,e)).style("stroke",(t,e)=>this.hoverfill(t,e)),this.highlight_g.selectAll(".hovered").remove())}click_handler(){const t=o.select(a().target);if(this.is_hover_element(t)){const e=t.data()[0],n=this.model.get("selected")||[],i=Array.from(n),r=i.indexOf(e.id);if(r>-1){i.splice(r,1),t.transition("click_handler").style("fill-opacity",0),this.highlight_g.selectAll(".hovered").remove();const n="#c".concat(e.id.toString());o.select(n).remove()}else this.highlight_g.selectAll(".hovered").remove(),this.highlight_g.append(()=>t.node().cloneNode(!0)).attr("id","c"+e.id).classed("selected",!0).classed("event_layer",!1),this.validate_color(this.model.get("selected_styles").selected_fill)&&this.highlight_g.selectAll(".selected").style("fill-opacity",1).style("fill",this.model.get("selected_styles").selected_fill),this.validate_color(this.model.get("selected_styles").selected_stroke)&&this.highlight_g.selectAll(".selected").style("stroke",this.model.get("selected_styles").selected_stroke).style("stroke-width",this.model.get("selected_styles").selected_stroke_width),i.push(e.id),this.model.set("selected",i),this.touch();this.model.set("selected",0===i.length?null:i,{updated_view:this}),this.touch()}}reset_zoom(t){t.zoom.transform(t.parent.bg,o.zoomIdentity)}zoomed(t){const e=a().transform,n=t.height/3,i=2*t.width;e.x=Math.min(t.width/2*(e.k-1),Math.max(i/2*(1-e.k),e.x)),e.y=Math.min(t.height/2*(e.k-1)+this.height*e.k,Math.max(n/2*(1-e.k)-t.width*e.k,e.y)),t.transformed_g.style("stroke-width",1/e.k).attr("transform",e)}create_listeners(){this.d3el.on("mouseover",()=>{this.event_dispatcher("mouse_over")}).on("mousemove",()=>{this.event_dispatcher("mouse_move")}).on("mouseout",()=>{this.event_dispatcher("mouse_out")}),this.listenTo(this.model,"data_updated",this.draw),this.listenTo(this.model,"change:color",this.update_style),this.listenTo(this.model,"change:stroke_color",this.change_stroke_color),this.listenTo(this.model,"change:colors",this.change_map_color),this.listenTo(this.model,"change:selected",this.change_selected),this.listenTo(this.model,"change:selected_styles",()=>{this.change_selected_fill(),this.change_selected_stroke()}),this.listenTo(this.model,"change:interactions",this.process_interactions),this.listenTo(this.parent,"bg_clicked",()=>{this.event_dispatcher("parent_clicked")})}process_click(t){super.process_click(t),"select"===t&&(this.event_listeners.parent_clicked=this.reset_selection,this.event_listeners.element_clicked=this.click_handler)}process_hover(t){super.process_hover(t),"tooltip"===t&&(this.event_listeners.mouse_over=()=>(this.mouseover_handler(),this.refresh_tooltip()),this.event_listeners.mouse_move=this.move_tooltip,this.event_listeners.mouse_out=()=>(this.mouseout_handler(),this.hide_tooltip()))}change_selected_fill(){this.validate_color(this.model.get("selected_styles").selected_fill)?this.highlight_g.selectAll(".selected").style("fill-opacity",1).style("fill",this.model.get("selected_styles").selected_fill):this.highlight_g.selectAll(".selected").style("fill-opacity",0)}change_selected_stroke(){this.validate_color(this.model.get("selected_styles").selected_stroke)?this.highlight_g.selectAll(".selected").style("stroke-width",this.model.get("selected_styles").selected_stroke_width).style("stroke",this.model.get("selected_styles").selected_stroke):this.highlight_g.selectAll(".selected").style("stroke-width",0)}change_selected(){this.highlight_g.selectAll("path").remove();const t=this.model.get("selected"),e=t||[],n=this.stroke_g.selectAll("path").data();this.stroke_g.selectAll("path").style("stroke",(t,e)=>this.hoverfill(t,e));const i=this.stroke_g.selectAll("path");for(let t=0;t-1&&this.highlight_g.append(()=>i.nodes()[t].cloneNode(!0)).attr("id",n[t].id).style("fill-opacity",()=>this.validate_color(this.model.get("selected_styles").selected_fill)?1:0).style("fill",this.model.get("selected_styles").selected_fill).style("stroke-opacity",()=>this.validate_color(this.model.get("selected_styles").selected_stroke)?1:0).style("stroke",this.model.get("selected_styles").selected_stroke).style("stroke-width",this.model.get("selected_styles").selected_stroke_width).classed("selected",!0)}reset_selection(){this.model.set("selected",[]),this.touch(),this.highlight_g.selectAll(".selected").remove(),o.select(this.d3el.parentNode).selectAll("path").classed("selected",!1),o.select(this.d3el.parentNode).selectAll("path").classed("hovered",!1),this.stroke_g.selectAll("path").style("stroke",(t,e)=>this.hoverfill(t,e)),this.fill_g.selectAll("path").classed("selected",!1).style("fill",(t,e)=>this.fill_g_colorfill(t,e))}change_stroke_color(){this.stroke_g.selectAll("path").style("stroke",this.model.get("stroke_color"))}change_map_color(){this.is_object_empty(this.model.get("color"))&&this.fill_g.selectAll("path").style("fill",(t,e)=>this.fill_g_colorfill(t,e))}update_style(){const t=this.model.get("color");this.is_object_empty(t)||this.fill_g.selectAll("path").style("fill",(t,e)=>this.fill_g_colorfill(t,e))}is_object_empty(t){return 0===Object.keys(t).length&&t.constructor===Object}hoverfill(t,e){const n=this.model.get("selected");return(n||[]).indexOf(t.id)>-1&&this.validate_color(this.model.get("selected_styles").selected_stroke)?this.model.get("selected_styles").selected_stroke:this.model.get("stroke_color")}fill_g_colorfill(t,e){const n=this.scales.color,i=this.model.get("selected"),r=i||[],o=this.model.get("color"),a=this.model.get("colors");return r.indexOf(t.id)>-1?this.model.get("selected_styles").selected_fill:this.is_object_empty(o)?a[t.id]||a.default_color:void 0===o[t.id]||null===o[t.id]||"nan"===o[t.id]||void 0===n?a.default_color:n.scale(o[t.id])}clear_style(){}compute_view_padding(){}set_default_style(){}set_style_on_elements(){}}},function(t,e,n){"use strict";var i=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e};Object.defineProperty(e,"__esModule",{value:!0});const r=n(10),o=i(n(2)),a=i(n(17)),s=i(n(6));e.Tooltip=class extends r.DOMWidgetView{initialize(){this.d3el=o.select(this.el),super.initialize.apply(this,arguments)}render(){this.parent=this.options.parent,this.update_formats(),this.create_listeners(),this.create_table()}create_listeners(){this.listenTo(this.parent,"update_tooltip",this.update_tooltip),this.model.on_some_change(["fields","show_labels","labels"],this.create_table,this),this.listenTo(this.model,"change:formats",this.update_formats)}update_formats(){const t=this.model.get("fields"),e=this.model.get("formats");this.tooltip_formats=t.map(function(t,n){const i=e[n];return void 0===i||""===i?function(t){return t}:a.is_valid_time_format(i)?o.timeFormat(i):o.format(i)})}update_tooltip(t){const e=this;this.d3el.select("table").selectAll("tr").select(".datavalue").text((n,i)=>e.tooltip_formats[i](t[n]))}create_table(){const t=this.model.get("fields"),e=s.clone(this.model.get("labels"));for(let n=e.length;ne[n]).attr("class","tooltiptext datafield"),i.append("td").attr("class","tooltiptext datavalue"),this.update_formats()}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const i=n(10),r=n(28);e.TooltipModel=class extends i.DOMWidgetModel{defaults(){return Object.assign({},i.DOMWidgetModel.prototype.defaults(),{_model_name:"TooltipModel",_view_name:"Tooltip",_model_module:"bqplot",_view_module:"bqplot",_model_module_version:r.semver_range,_view_module_version:r.semver_range,fields:[],formats:[],show_labels:!0,labels:[]})}}},function(t,e,n){"use strict";var i=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e};Object.defineProperty(e,"__esModule",{value:!0});const r=i(n(2)),o=n(142);e.FlexLine=class extends o.Lines{render(){const t=super.render.apply(this),e=this;return t.then(function(){e.create_listeners(),e.draw()})}set_ranges(){super.set_ranges();const t=this.scales.width;t&&t.set_range([.5,this.model.get("stroke_width")])}create_listeners(){super.create_listeners(),this.listenTo(this.model,"change:labels_visibility",this.update_legend_labels)}draw_legend(t,e,n,i,o){const a=t.selectAll(".legend"+this.uuid).data(this.model.mark_data,function(t,e){return t.name}),s=this,c=.8*o;a.enter().append("g").attr("class","legend"+this.uuid).attr("transform",function(t,e){return"translate(0, "+(e*o+n)+")"}).append("line").style("stroke",function(t,e){return s.get_colors(e)}).attr("x1",0).attr("x2",c).attr("y1",c/2).attr("y2",c/2),a.append("text").attr("class","legendtext").attr("x",1.2*c).attr("y",c/2).attr("dy","0.35em").text(function(t,e){return s.model.get("labels")[e]}).style("fill",function(t,e){return s.get_colors(e)});const l=r.max(this.model.get("labels"),function(t){return t.length});return a.exit().remove(),[this.model.mark_data.length,l]}set_positional_scales(){const t=this.scales.x,e=this.scales.y;this.listenTo(t,"domain_changed",function(){this.model.dirty||this.draw()}),this.listenTo(e,"domain_changed",function(){this.model.dirty||this.draw()})}initialize_additional_scales(){const t=this.scales.color;t&&(this.listenTo(t,"domain_changed",function(){this.draw()}),t.on("color_scale_range_changed",this.draw,this))}draw(){this.set_ranges();let t=this.d3el.selectAll(".curve").data(this.model.mark_data,function(t,e){return t.name});t.exit().transition("draw").duration(this.parent.model.get("animation_duration")).remove(),t=t.enter().append("g").attr("class","curve").merge(t);const e=this.scales.x,n=this.scales.y,i=this;t.nodes().forEach(function(t,o){let a=r.select(t).selectAll("line").data(i.model.mark_data[o].values);(a=a.enter().append("line").merge(a)).attr("class","line-elem").attr("x1",function(t){return e.scale(t.x1)}).attr("x2",function(t){return e.scale(t.x2)}).attr("y1",function(t){return n.scale(t.y1)}).attr("y2",function(t){return n.scale(t.y2)}).attr("stroke",function(t){return i.get_element_color(t)}).attr("stroke-width",function(t){return i.get_element_width(t)})})}get_element_color(t){const e=this.scales.color;return void 0!==e&&void 0!==t.color?e.scale(t.color):this.model.get("colors")[0]}get_element_width(t){const e=this.scales.width;return void 0!==e&&void 0!==t.size?e.scale(t.size):this.model.get("stroke_width")}relayout(){super.relayout(),this.set_ranges();const t=this.scales.x,e=this.scales.y;this.d3el.selectAll(".curve").selectAll(".line-elem").transition("relayout").duration(this.parent.model.get("animation_duration")).attr("x1",function(e){return t.scale(e.x1)}).attr("x2",function(e){return t.scale(e.x2)}).attr("y1",function(t){return e.scale(t.y1)}).attr("y2",function(t){return e.scale(t.y2)})}}},function(t,e,n){"use strict";var i=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e};Object.defineProperty(e,"__esModule",{value:!0});const r=n(18),o=i(n(317));e.MapModel=class extends r.MarkModel{defaults(){return Object.assign({},r.MarkModel.prototype.defaults(),{_model_name:"MapModel",_view_name:"Map",color:{},hover_highlight:!0,hovered_styles:{hovered_fill:"Orange",hovered_stroke:null,hovered_stroke_width:2},stroke_color:null,default_color:null,scales_metadata:{color:{dimension:"color"},projection:{dimension:"geo"}},selected_styles:{selected_fill:"Red",selected_stroke:null,selected_stroke_width:2},map_data:void 0})}initialize(t,e){super.initialize(t,e),this.on("change:map_data",this.update_data,this),this.on("change:color",this.color_data_updated,this),this.update_data(),this.update_domains()}update_data(){this.dirty=!0;const t=this.get("map_data");"Topology"==t.type?this.geodata=o.feature(t,t.objects.subunits).features:this.geodata=t.features,this.color_data_updated(),this.dirty=!1,this.trigger("data_updated")}update_properties(t){t.properties?t.properties.color=this.color_data[t.id]:t.properties={color:this.color_data[t.id]}}color_data_updated(){this.update_domains(),this.geodata.map(t=>this.update_properties(t))}update_domains(){const t=this.get("scales").color;this.color_data=this.get("color"),null!=t&&(this.get("preserve_domain").color?t.del_domain([],this.model_id+"_color"):t.compute_and_set_domain(Object.keys(this.color_data).map(t=>this.color_data[t]),this.model_id+"_color"))}get_data_dict(t,e){return Object.assign({},t.properties,{id:t.id})}}},function(t,e,n){!function(t){"use strict";function e(){}function n(t){if(!t)return e;var n,i,r=t.scale[0],o=t.scale[1],a=t.translate[0],s=t.translate[1];return function(t,e){e||(n=i=0),t[0]=(n+=t[0])*r+a,t[1]=(i+=t[1])*o+s}}function i(t,e){for(var n=0,i=t.length;n>>1;t[r]1){var c,l=[],u={LineString:o,MultiLineString:s,Polygon:s,MultiPolygon:function(t){t.forEach(s)}};!function t(e){"GeometryCollection"===e.type?e.geometries.forEach(t):e.type in u&&(c=e,u[e.type](e.arcs))}(e),l.forEach(arguments.length<3?function(t){i.push(t[0].i)}:function(t){n(t[0].g,t[t.length-1].g)&&i.push(t[0].i)})}else for(var h=0,d=t.arcs.length;h1)for(var o,s,l=1,u=c(r[0]);lu&&(s=r[0],r[0]=r[l],r[l]=s,u=o);return r})}}function u(t,e){return t[1][2]-e[1][2]}t.version="1.6.27",t.mesh=function(t){return o(t,s.apply(this,arguments))},t.meshArcs=s,t.merge=function(t){return o(t,l.apply(this,arguments))},t.mergeArcs=l,t.feature=function(t,e){return"GeometryCollection"===e.type?{type:"FeatureCollection",features:e.geometries.map(function(e){return r(t,e)})}:r(t,e)},t.neighbors=function(t){var e={},n=t.map(function(){return[]});function r(t,n){t.forEach(function(t){t<0&&(t=~t);var i=e[t];i?i.push(n):e[t]=[n]})}function o(t,e){t.forEach(function(t){r(t,e)})}var a={LineString:r,MultiLineString:o,Polygon:o,MultiPolygon:function(t,e){t.forEach(function(t){o(t,e)})}};for(var s in t.forEach(function t(e,n){"GeometryCollection"===e.type?e.geometries.forEach(function(e){t(e,n)}):e.type in a&&a[e.type](e.arcs,n)}),e)for(var c=e[s],l=c.length,u=0;u0;){var i=(n+1>>1)-1,r=e[i];if(u(t,r)>=0)break;e[r._=n]=r,e[t._=n=i]=t}}function r(t,i){for(;;){var r=i+1<<1,o=r-1,a=i,s=e[a];if(o0&&(t=e[n],r(e[t._=0]=t,0)),i}},t.remove=function(t){var o,a=t._;if(e[a]===t)return a!==--n&&(u(o=e[n],t)<0?i:r)(e[o._=a]=o,a),a},t}();function s(t){a.remove(t),t[1][2]=i(t),a.push(t)}return i||(i=c),t.arcs.forEach(function(t){var e,n,c,l,u=[],h=0;for(n=0,c=t.length;n({display:e[n],name:t,color:Number.isNaN(i[n])?void 0:i[n],group:this.group_data[n],ref_data:null===this.ref_data||void 0===this.ref_data?null:this.ref_data[n]}));this.update_domains(),this.grouped_data=a.groupBy(r,function(e,n){return t.group_data[n]}),this.groups=[],this.running_sums=[],this.running_sums[0]=0;let o=0;for(let t in this.grouped_data)this.groups.push(t),o+=this.grouped_data[t].length,this.running_sums.push(o);this.running_sums.pop()}update_domains(){const t=this.model.get("scales").color,e=this.model.get("color");t&&e.length>0&&t.compute_and_set_domain(e,this.model.model_id)}set_area_dimensions(t){this.num_rows=this.model.get("rows"),this.num_cols=this.model.get("cols"),this.row_groups=this.model.get("row_groups"),void 0!==this.num_cols&&null!==this.num_cols&&0!==this.num_cols?(this.row_groups>1&&this.num_cols%2==0&&this.num_cols++,this.num_rows=Math.floor(t/this.num_cols),this.num_rows=t%this.num_cols==0?this.num_rows:this.num_rows+1):void 0!==this.num_rows&&null!==this.num_rows&&0!==this.num_rows?(this.num_cols=Math.floor(t/this.num_rows),this.num_cols=t%this.num_rows==0?this.num_cols:this.num_cols+1,this.row_groups>1&&this.num_cols%2==0&&this.num_cols++):(this.num_cols=Math.floor(Math.sqrt(t)),this.row_groups>1&&this.num_cols%2==0&&this.num_cols++,this.num_rows=Math.floor(t/this.num_cols),this.num_rows=t%this.num_cols==0?this.num_rows:this.num_rows+1),this.row_groups=Math.min(this.row_groups,this.num_rows),1==this.row_groups&&(this.num_cols=Math.floor(t/this.num_rows),this.num_cols=t%this.num_rows==0?this.num_cols:this.num_cols+1),this.set_row_limits()}compute_dimensions_and_draw(){this.set_area_dimensions(this.data.length),this.update_plotarea_dimensions(),this.draw_map(),this.clear_selected(),this.apply_selected(),this.fig_hover.selectAll("rect").remove(),this.hide_tooltip()}update_default_tooltip(){this.tooltip_fields=this.model.get("tooltip_fields");const t=this.model.get("tooltip_formats");this.tooltip_formats=this.tooltip_fields.map(function(e,n){const i=t[n];return void 0===i||""===i?function(t){return t}:l.format(i)})}create_scale_views(){for(let t in this.scales)this.stopListening(this.scales[t]);const t=this.model.get("scales"),e=this,n={};return a.each(t,function(t,i){n[i]=e.create_child_view(t)}),o.resolvePromisesDict(n).then(function(t){e.scales=t,e.set_scales()})}set_scales(){const t=this,e=this.scales.color;e&&(e.set_range(),e.on("color_scale_range_changed",t.update_map_colors,t),this.update_domains(),this.listenTo(e,"domain_changed",function(){t.update_map_colors()}),this.update_map_colors())}show_groups(t,e){this.fig_names.style("display",e?"inline":"none"),this.fig_map.selectAll(".market_map_text").style("opacity",e?.2:1),this.fig_map.selectAll(".market_map_rect").style("stroke-opacity",e?.2:1)}draw_map(){this.reset_drawing_controls(),this.fig_map.selectAll(".element_group").remove(),this.fig_names.selectAll(".names_object").remove(),this.rect_groups=this.fig_map.selectAll(".element_group").data(this.groups);const t=this.scales.color,e=this;this.rect_groups=this.rect_groups.enter().append("g").attr("class","element_group").attr("transform",function(t,n){return e.get_group_transform(n)}).merge(this.rect_groups),this.rect_groups.exit().remove(),this.end_points=[],this.rect_groups.nodes().forEach(function(n,i){const r=e.grouped_data[e.groups[i]],o=e.get_new_cords(),a=e.get_end_points(o[2],r.length,o[0],o[1],o[3],o[4]);a.forEach(function(t){e.end_points.push(t)});const s=e.running_sums[i];let c=l.select(n).selectAll(".rect_element").data(r);const u=c.enter().append("g").classed("rect_element",!0);u.append("rect").attr("x",0).attr("y",0).classed("market_map_rect",!0),u.append("text").classed("market_map_text",!0).style("text-anchor","middle").style("pointer-events","none").style("dominant-baseline","central"),(c=u.merge(c)).attr("transform",function(t,n){return e.get_cell_transform(n)}).on("click",function(t,n){e.cell_click_handler(t,s+n,this)}).on("mouseover",function(t,n){e.mouseover_handler(t,s+n,this)}).on("mousemove",function(t){e.mousemove_handler()}).on("mouseout",function(t,n){e.mouseout_handler(t,s+n,this)}).attr("class",function(t,e){return l.select(this).attr("class")+" rect_"+(s+e)}),c.selectAll(".market_map_rect").attr("width",e.column_width).attr("height",e.row_height).style("stroke-opacity",e.model.get("show_groups")?.2:1).style("stroke",e.model.get("stroke")).style("fill",function(n,r){return t&&void 0!==n.color&&null!==n.color?t.scale(n.color):e.colors_map(i)}),c.selectAll(".market_map_text").attr("x",e.column_width/2).attr("y",e.row_height/2).text(function(t,e){return t.display}).style("opacity",e.model.get("show_groups")?.2:1),c.exit().remove(),e.create_bounding_path(n,a);const h=l.min(a,function(t){return t.x}),d=l.min(a,function(t){return t.y});e.fig_names.append("foreignObject").attr("class","names_object").attr("x",h).attr("y",d).append("xhtml:div").attr("class","names_div").styles({display:"flex","flex-direction":"row","align-content":"center","align-items":"center",width:"100%",height:"100%","justify-content":"center","word-wrap":"break-word",font:"24px sans-serif",color:"black"}).text(e.groups[i])}),this.update_font_style(),this.draw_group_names()}draw_group_names(){const t=this.svg.selectAll(".bounding_path").nodes().map(function(t){return t.getBoundingClientRect()});this.fig_names.selectAll(".names_object").data(t).attr("width",function(t){return t.width}).attr("height",function(t){return t.height})}recolor_chart(){const t=this;this.update_data(),this.rect_groups=this.fig.selectAll(".element_group").data(this.groups);const e=this.scales.color;this.rect_groups.nodes().forEach(function(n,i){const r=t.grouped_data[t.groups[i]];l.select(n).selectAll(".rect_element").data(r).select("rect").style("stroke",t.model.get("stroke")).style("fill",function(n,r){return e&&void 0!==n.color&&null!==n.color?e.scale(n.color):t.colors_map(i)})})}update_font_style(){this.svg.selectAll(".market_map_text").styles(this.model.get("font_style"))}update_map_colors(){void 0!==this.rect_groups&&null!==this.rect_groups&&this.recolor_chart()}cell_click_handler(t,e,n){if(this.model.get("enable_select")){const e=this.model.get("selected").slice(),n=e.indexOf(t.name);-1==n?e.push(t.name):e.splice(n,1),this.model.set("selected",e),this.touch()}}apply_selected(){const t=this.model.get("selected"),e=this;null==t||0===t.length?this.clear_selected():t.forEach(function(t){const n=e.fig_map.selectAll(".rect_element").filter(function(e,n){return e.name===t});e.fig_click.append("rect").data(n.data()).attr("transform",n.attr("transform")).attr("x",0).attr("y",0).attr("width",e.column_width).attr("height",e.row_height).styles({stroke:e.selected_stroke,"stroke-width":"3px",fill:"none"})})}clear_selected(){this.fig_click.selectAll("rect").remove()}mouseover_handler(t,e,n){const i=l.select(n).attr("transform");this.model.get("enable_hover")&&(this.fig_hover.append("rect").attr("class","hover_"+e).attr("transform",i).attr("x",0).attr("y",0).attr("width",this.column_width).attr("height",this.row_height).styles({stroke:this.hovered_stroke,"stroke-width":"3px",fill:"none","pointer-events":"none"}),this.show_tooltip(l.event,t),this.send({event:"hover",data:t.name,ref_data:t.ref_data}))}update_selected_stroke(t,e){this.selected_stroke=e,this.fig_click.selectAll("rect").style("stroke",e)}update_hovered_stroke(t,e){this.hovered_stroke=e}mouseout_handler(t,e,n){this.fig_hover.select(".hover_"+e).remove(),this.hide_tooltip()}show_tooltip(t,e){const n=this;if(this.tooltip_view||this.tooltip_fields&&0!=this.tooltip_fields.length){const t=this.tooltip_div;t.transition().styles({opacity:.9,display:null}),this.move_tooltip(),t.select("table").remove();const i=e.ref_data;if(!this.tooltip_view){const e=t.append("table").selectAll("tr").data(this.tooltip_fields);e.exit().remove();const r=e.enter().append("tr");r.append("td").attr("class","tooltiptext").text(function(t){return t}),r.append("td").attr("class","tooltiptext").text(function(t,e){return null==i?null:n.tooltip_formats[e](i[t])})}this.popper.enableEventListeners(),this.move_tooltip()}}mousemove_handler(){this.move_tooltip()}move_tooltip(){this.popper_reference.x=l.event.clientX,this.popper_reference.y=l.event.clientY,this.popper.scheduleUpdate()}hide_tooltip(){this.tooltip_div.style("pointer-events","none"),this.tooltip_div.transition().styles({opacity:0,display:"none"}),this.popper.disableEventListeners()}create_tooltip_widget(){const t=this.model.get("tooltip_widget");null!==this.tooltip_view&&void 0!==this.tooltip_view&&(this.tooltip_view.remove(),this.tooltip_view=null);const e=this;t&&this.create_child_view(t).then(function(t){e.tooltip_view=t,s.MessageLoop.sendMessage(t.pWidget,c.Widget.Msg.BeforeAttach),e.tooltip_div.node().appendChild(t.el),s.MessageLoop.sendMessage(t.pWidget,c.Widget.Msg.AfterAttach)})}get_group_transform(t){return"translate(0, 0)"}get_cell_transform(t){return this.past_border_y()?this.prev_y+=this.y_direction:this.past_border_x()?(this.y_direction=-1*this.y_direction,this.prev_x+=this.x_direction):(this.x_direction=-1*this.x_direction,this.prev_y+=this.y_direction,this.group_iter+=1),"translate("+this.prev_x*this.column_width+", "+this.prev_y*this.row_height+")"}get_new_cords(){let t=this.prev_x,e=this.prev_y,n=this.y_direction,i=this.x_direction,r=this.group_iter;return this.past_border_y()?e+=this.y_direction:this.past_border_x()?(n=-1*this.y_direction,t+=this.x_direction):(i=-1*this.x_direction,e+=this.y_direction,r+=1),[t,e,r,i,n,t*this.column_width,e*this.row_height]}past_border_y(){return 1==this.y_direction?this.prev_y+1this.row_limits[this.group_iter-1]-1}past_border_x(){return 1==this.x_direction?this.prev_x+1-1}colors_updated(){this.colors=this.model.get("colors"),this.recolor_chart()}get_color(t,e){return this.colors[t%e]}set_row_limits(){const t=Math.floor(this.num_rows/this.row_groups);this.row_limits=[];for(let e=this.row_groups-1;e>-1;e--)this.row_limits.unshift(e*t);this.row_limits[this.row_groups]=this.num_rows}get_end_points(t,e,n,i,r,o){let a=this.row_limits[t-1],s=this.row_limits[t],c=!1,l=r,u=o;const h=[];let d,f=1==u?s-i:i-a+1,p=1==l?this.num_cols-1-n:n,m=e,g=s-a;if(0!==m){this.calc_end_point_source(n,i,l,u).forEach(function(t){h.push(t)});const t=Math.min(f,m);if(t===m)return this.calc_end_point_source(n,i,-1*l,u).forEach(function(t){h.push(t)}),d=i+(m-1)*u,this.calc_end_point_dest(n,d,-1*l,u).forEach(function(t){h.push(t)}),this.calc_end_point_dest(n,d,l,u).forEach(function(t){h.push(t)}),h;if(m-=t,0===p?this.calc_end_point_source(n,i,-1*l,u).forEach(function(t){h.push(t)}):f!==s-a?(this.calc_end_point_source(n,i,-1*l,u).forEach(function(t){h.push(t)}),m>g&&this.calc_end_point_dest(n+l,1==u?a:s-1,-1*l,-1*u).forEach(function(t){h.push(t)})):mg&&(n+=l)}for(;m>g;){let e;if(g*pp?(n=1===l?this.num_cols-1:0,0!==p&&this.calc_end_point_dest(n,a,l,-1).forEach(function(t){h.push(t)}),e=p,p=this.num_cols,t+=1,a=s,s=this.row_limits[t],i=a,l*=-1,u=Math.pow(-1,e)*u*-1,this.calc_end_point_dest(n,s-1,-1*l,1).forEach(function(t){h.push(t)})):e===p?(n=1===l?this.num_cols-1:0,0!==p&&this.calc_end_point_dest(n,a,l,-1).forEach(function(t){h.push(t)}),e=p,p=this.num_cols,(t+=1)1&&d>0;){const t=i.filter(function(t){return t[a]==u});if(t.length>0){o++;const e=l.min(t,function(t){return t[s]}),r=l.max(t,function(t){return t[s]});if(eh)if("y"==a)f=1==this.x_direction?r:e;else{const n=t.filter(function(t){return t[s]h});f=1==n.length?e:1==i.length?r:l.max(n,function(t){return t[s]})}else f=e>h?e:r;i.filter(function(t){return t[a]==u&&t[s]==f}).forEach(function(t){i.splice(i.indexOf(t),1)});const c={};c[a]=u,c[s]=f,n.push(c)}else f=h;const e=a;a=s,s=e,h=u,u=f,d--}i.length>0&&n.push(i[0]),n.push(e[0]);const p=l.line().curve(l.curveLinear).x(function(t){return t.x}).y(function(t){return t.y});return l.select(t).append("path").attr("class","bounding_path").attr("d",function(){return p(n)}).attr("fill","none").style("stroke",this.model.get("group_stroke")).style("stroke-width",3)}calc_end_point_source(t,e,n,i){return e=1==i?e:e+1,[{x:(t=1==n?t:t+1)*this.column_width,y:e*this.row_height}]}calc_end_point_dest(t,e,n,i){return e=-1==i?e:e+1,[{x:(t=-1==n?t:t+1)*this.column_width,y:e*this.row_height}]}}},function(t,e,n){"use strict";var i=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e};Object.defineProperty(e,"__esModule",{value:!0});const r=i(n(2));n(31);const o=function(){return n(0).event}.bind(this),a=i(n(6)),s=n(19);e.GridHeatMap=class extends s.Mark{render(){const t=super.render(),e=this;return this.displayed.then(function(){e.parent.tooltip_div.node().appendChild(e.tooltip_div.node()),e.create_tooltip()}),this.selected_indices=this.model.get("selected"),this.selected_style=this.model.get("selected_style"),this.unselected_style=this.model.get("unselected_style"),this.anchor_style=this.model.get("anchor_style"),this.display_el_classes=["heatmapcell"],t.then(function(){e.event_listeners={},e.process_interactions(),e.create_listeners(),e.compute_view_padding(),e.draw()})}initialize_additional_scales(){const t=this.scales.color;t&&(this.listenTo(t,"domain_changed",function(){this.apply_styles()}),t.on("color_scale_range_changed",this.apply_styles,this))}set_ranges(){const t=this.scales.row;if(t){const e=this.parent.padded_range("y",t.model);t.set_range(e)}const e=this.scales.column;e&&e.set_range(this.parent.padded_range("x",e.model))}set_positional_scales(){const t=this.scales.column,e=this.scales.row;this.listenTo(t,"domain_changed",function(){this.model.dirty||this.draw()}),this.listenTo(e,"domain_changed",function(){this.model.dirty||this.draw()})}expand_scale_domain(t,e,n,i){let o,a;if("expand_one"===n){const n=(o=e.map(function(e){return t.scale(e)})).slice(1).map(function(t,e){return t-o[e]});if(a=0,n[0]<0?(i=!i,a=r.max(n)):a=r.min(n),i){const n=o[o.length-1]+a;return[e[0],t.invert(n)]}{const n=o[0]-a;return[t.invert(n),e[o.length-1]]}}if("expand_two"===n){o=e.map(function(e){return t.scale(e)}),a=r.min(o.slice(1).map(function(t,e){return t-o[e]}));const n=o[o.length-1]+a,i=o[0]-a;return[t.invert(i),t.invert(n)]}}create_listeners(){super.create_listeners(),this.listenTo(this.model,"change:stroke",this.update_stroke),this.listenTo(this.model,"change:opacity",this.update_opacity),this.d3el.on("mouseover",a.bind(function(){this.event_dispatcher("mouse_over")},this)).on("mousemove",a.bind(function(){this.event_dispatcher("mouse_move")},this)).on("mouseout",a.bind(function(){this.event_dispatcher("mouse_out")},this)),this.listenTo(this.model,"data_updated",this.draw),this.listenTo(this.model,"change:tooltip",this.create_tooltip),this.listenTo(this.parent,"bg_clicked",function(){this.event_dispatcher("parent_clicked")}),this.model.on_some_change(["display_format","font_style"],this.update_labels,this),this.listenTo(this.model,"change:selected",this.update_selected),this.listenTo(this.model,"change:interactions",this.process_interactions)}click_handler(t){const e=this.model.colors[0].length,n=t.row_num*e+t.column_num,i=t.row_num,r=t.column_num,s=this;let c=Array.from(this.model.get("selected")||[]),l=this._cell_nums_from_indices(c);const u=l.indexOf(n),h=o().ctrlKey||o().metaKey;if(u>-1&&h)c.splice(u,1);else if(h||(l=[],c=[]),c.push([i,r]),l.push(s._cell_nums_from_indices([[i,r]])[0]),o().shiftKey){if(u>-1)return;const t=0!==l.length?s.anchor_cell_index[0]:i,e=0!==l.length?s.anchor_cell_index[1]:r;a.range(Math.min(i,t),Math.max(i,t)+1).forEach(function(t){a.range(Math.min(r,e),Math.max(r,e)+1).forEach(function(e){const n=s._cell_nums_from_indices([[t,e]])[0];-1===l.indexOf(n)&&(l.push(n),c.push([t,e]))})})}else this.anchor_cell_index=[i,r];this.model.set("selected",0===c.length?null:c,{updated_view:this}),this.touch();let d=o();d||(d=window.event),void 0!==d.cancelBubble&&(d.cancelBubble=!0),d.stopPropagation&&d.stopPropagation(),d.preventDefault(),this.selected_indices=c,this.apply_styles()}update_selected(t,e){this.selected_indices=e,this.apply_styles()}set_style_on_elements(t,e,n){e&&(0!==e.length||n&&0!==n.length)&&0!==Object.keys(t).length&&(n=n&&0!==n.length?n:this._filter_cells_by_cell_num(this._cell_nums_from_indices(e))).styles(t)}set_default_style(t,e){if(!t||0===t.length&&(!e||0===e.length))return;e=e&&0!==e.length?e:this._filter_cells_by_cell_num(this._cell_nums_from_indices(t));const n=this.model.get("stroke"),i=this.model.get("opacity"),r=this;e.style("fill",function(t){return r.get_element_fill(t)}).style("opacity",i).style("stroke",n)}clear_style(t,e,n){if(0===Object.keys(t).length)return;n&&0!==n.length||(n=e?this._filter_cells_by_cell_num(this._cell_nums_from_indices(e)):this.display_cells);const i={};for(let e in t)i[e]=null;n.styles(i)}_filter_cells_by_cell_num(t){return null==t?[]:this.display_cells.filter(function(e){return-1!==t.indexOf(e._cell_num)})}selected_style_updated(t,e){this.selected_style=e,this.clear_style(t.previous("selected_style"),this.selected_indices,this.selected_elements),this.style_updated(e,this.selected_indices,this.selected_elements)}unselected_style_updated(t,e){this.unselected_style=e,this.clear_style(t.previous("unselected_style"),[],this.unselected_elements),this.style_updated(e,[],this.unselected_elements)}apply_styles(){const t=this.model.colors.length,e=this.model.colors[0].length;this.clear_style(this.selected_style),this.clear_style(this.unselected_style),this.clear_style(this.anchor_style),this.set_default_style([],this.display_cells);const n=this._cell_nums_from_indices(this.selected_indices),i=null===n||0===n.length?[]:a.difference(a.range(t*e),n);if(this.selected_elements=this._filter_cells_by_cell_num(n),this.set_style_on_elements(this.selected_style,this.selected_indices,this.selected_elements),this.unselected_elements=this._filter_cells_by_cell_num(i),this.set_style_on_elements(this.unselected_style,[],this.unselected_elements),null!==this.anchor_cell_index&&void 0!==this.anchor_cell_index){const t=this._cell_nums_from_indices([this.anchor_cell_index]);this.anchor_element=this._filter_cells_by_cell_num(t),this.set_style_on_elements(this.anchor_style,[],this.anchor_element)}}style_updated(t,e,n){this.set_default_style(e,n),this.set_style_on_elements(t,e,n)}reset_selection(){this.model.set("selected",null),this.touch(),this.selected_indices=null,this.clear_style(this.selected_style),this.clear_style(this.unselected_style),this.clear_style(this.anchor_style),this.set_default_style([],this.display_cells)}relayout(){this.set_ranges(),this.compute_view_padding(),this.draw()}_cell_nums_from_indices(t){if(null==t)return null;const e=this.model.colors[0].length;return t.map(function(t){return t[0]*e+t[1]})}invert_point(t){}selector_changed(t,e){if(void 0===t)return this.model.set("selected",null),this.touch(),[];const n=a.range(this.model.colors[0].length),i=a.range(this.model.colors.length),r=this,o=a.filter(n,function(t){return e([r.column_pixels[t],[]])}),s=a.filter(i,function(t){return e([[],r.row_pixels[t]])});let c=o.map(function(t){return s.map(function(e){return[e,t]})});c=a.flatten(c,!0),this.model.set("selected",c),this.touch()}draw(){this.set_ranges();const t=this,e=this.model.colors.length,n=this.model.colors[0].length,i=this.scales.row,o=this.scales.column,s="start"===this.model.get("row_align"),c="start"===this.model.get("column_align");let l;"middle"!==this.model.modes.row&&"boundaries"!==this.model.modes.row&&(l=this.expand_scale_domain(i,this.model.rows,this.model.modes.row,s),(r.min(l)r.max(i.model.domain))&&i.model.compute_and_set_domain(l,i.model.model_id)),"middle"!==this.model.modes.column&&"boundaries"!==this.model.modes.column&&(l=this.expand_scale_domain(o,this.model.columns,this.model.modes.column,c),(r.min(l)r.max(o.model.domain))&&o.model.compute_and_set_domain(l,o.model.model_id));const u=this.get_tile_plotting_data(i,this.model.rows,this.model.modes.row,s),h=this.get_tile_plotting_data(o,this.model.columns,this.model.modes.column,c);this.row_pixels=u.start.map(function(t,e){return[t,t+u.widths[e]]}),this.column_pixels=h.start.map(function(t,e){return[t,t+h.widths[e]]}),this.display_rows=this.d3el.selectAll(".heatmaprow").data(a.range(e)).join("g").attr("class","heatmaprow").attr("transform",function(t){return"translate(0, "+u.start[t]+")"});const d=a.range(n),f=a.range(e).map(function(e){return d.map(function(i){return t.model.mark_data[e*n+i]})});this.display_cells=this.display_rows.selectAll(".heatmapcell").data(function(t,e){return f[e]}).join("rect").attr("class","heatmapcell").on("click",a.bind(function(){this.event_dispatcher("element_clicked")},this)),this.display_cells.attr("x",function(t,e){return h.start[e]}).attr("y",0).attr("width",function(t,e){return h.widths[e]}).attr("height",function(t){return u.widths[t.row_num]}),this.display_cell_labels=this.display_rows.selectAll(".heatmapcell_label").data(function(t,e){return f[e]}).join("text").attr("class","heatmapcell_label").attr("x",function(t,e){return h.start[e]+h.widths[e]/2}).attr("y",function(t){return u.widths[t.row_num]/2}).style("text-anchor","middle").style("fill","black").style("pointer-events","none").style("dominant-baseline","central"),this.apply_styles(),this.update_labels(),this.display_cells.on("click",function(e,n){return t.event_dispatcher("element_clicked",{data:e.color,index:n,row_num:e.row_num,column_num:e.column_num})})}update_stroke(t,e){this.display_cells.style("stroke",e)}update_opacity(t,e){this.display_cells.style("opacity",e)}update_labels(){const t=this.model.get("display_format"),e=t?r.format(t):null;let n=this.d3el.selectAll(".heatmapcell_label").text(function(t,n){return e?e(t.color):null});const i=this.model.get("font_style");for(const t in i)n=n.style(t,i[t])}get_tile_plotting_data(t,e,n,i){let o=[],a=[];if(e=Array.from(e),"middle"===n)return o=e.map(function(e){return t.scale(e)}),a=e.map(function(e){return t.scale.bandwidth()}),{start:o,widths:a};if("boundaries"===n){const n=e.map(function(e){return t.scale(e)});a=[];for(let t=1;tn[0]?n.slice(0,-1):n.slice(1),widths:a}}if("expand_one"===n){let n;return i?(a=(o=e.map(function(e){return t.scale(e)})).slice(1).map(function(t,e){return Math.abs(t-o[e])}),n=r.max(t.scale.range()),a=o[0]o[0]?(o.unshift(Math.abs(n)),a.splice(0,0,o[1]-o[0]),o.pop()):(a=Array.prototype.concat(a,[Math.abs(n-o.slice(-1)[0])]),(o=Array.prototype.concat(o,n)).splice(0,1))),{widths:a,start:o}}if("expand_two"===n){const n=(o=e.map(function(e){return t.scale(e)}))[1]-o[0]>0;let i=n?r.min(t.scale.range()):r.max(t.scale.range());return o.splice(0,0,i),a=o.slice(1).map(function(t,e){return Math.abs(t-o[e])}),i=n?r.max(t.scale.range()):r.min(t.scale.range()),a[a.length]=Math.abs(i-o.slice(-1)[0]),{start:o,widths:a}}}get_element_fill(t){return null===t.color?this.model.get("null_color"):this.scales.color.scale(t.color)}process_click(t){super.process_click(t),"select"===t&&(this.event_listeners.parent_clicked=this.reset_selection,this.event_listeners.element_clicked=this.click_handler)}compute_view_padding(){}}},function(t,e,n){"use strict";var i=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e};Object.defineProperty(e,"__esModule",{value:!0});const r=i(n(10)),o=i(n(2)),a=i(n(12)),s=n(28);class c extends r.WidgetModel{defaults(){return Object.assign({},r.WidgetModel.prototype.defaults(),{_model_name:"MarketMapModel",_view_name:"MarketMap",_model_module:"bqplot",_view_module:"bqplot",_model_module_version:s.semver_range,_view_module_version:s.semver_range,map_width:1080,map_height:800,names:[],groups:[],display_text:[],ref_data:void 0,title:"",tooltip_fields:[],tooltip_formats:[],show_groups:!1,cols:0,rows:0,row_groups:1,colors:o.scaleOrdinal(o.schemeCategory10).range(),scales:{},axes:[],color:[],map_margin:{top:50,right:50,left:50,bottom:50},preserve_aspect:!1,stroke:"white",group_stroke:"black",selected_stroke:"dodgerblue",hovered_stroke:"orangered",font_style:{},title_style:{},selected:[],enable_hover:!0,enable_select:!0,tooltip_widget:null})}}c.serializers=Object.assign({},r.WidgetModel.serializers,{scales:{deserialize:r.unpack_models},axes:{deserialize:r.unpack_models},tooltip_widget:{deserialize:r.unpack_models},style:{deserialize:r.unpack_models},layout:{deserialize:r.unpack_models},names:a.array_or_json,groups:a.array_or_json,display_text:a.array_or_json,color:a.array_or_json}),e.MarketMapModel=c},function(t,e,n){"use strict";var i=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e};Object.defineProperty(e,"__esModule",{value:!0});const r=i(n(2)),o=i(n(6)),a=n(19);e.HeatMap=class extends a.Mark{render(){const t=super.render(),e=this;return this.displayed.then(function(){e.parent.tooltip_div.node().appendChild(e.tooltip_div.node()),e.create_tooltip()}),this.image=r.select(this.el).append("image").classed("heatmap",!0).attr("width",this.parent.width).attr("height",this.parent.height),this.canvas=document.createElement("canvas"),t.then(function(){e.event_listeners={},e.process_interactions(),e.create_listeners(),e.compute_view_padding(),e.draw()})}set_ranges(){const t=this.scales.x;if(t){const e=this.parent.padded_range("x",t.model);t.set_range(e)}const e=this.scales.y;e&&e.set_range(this.parent.padded_range("y",e.model))}set_positional_scales(){const t=this.scales.x,e=this.scales.y;this.listenTo(t,"domain_changed",function(){this.model.dirty||this.draw()}),this.listenTo(e,"domain_changed",function(){this.model.dirty||this.draw()})}initialize_additional_scales(){const t=this.scales.color;t&&(this.listenTo(t,"domain_changed",function(){this.draw()}),t.on("color_scale_range_changed",this.draw,this))}create_listeners(){super.create_listeners(),this.d3el.on("mouseover",o.bind(function(){this.event_dispatcher("mouse_over")},this)).on("mousemove",o.bind(function(){this.event_dispatcher("mouse_move")},this)).on("mouseout",o.bind(function(){this.event_dispatcher("mouse_out")},this)),this.listenTo(this.model,"data_updated",this.draw),this.listenTo(this.model,"change:tooltip",this.create_tooltip),this.listenTo(this.parent,"bg_clicked",function(){this.event_dispatcher("parent_clicked")}),this.listenTo(this.model,"change:interactions",this.process_interactions)}click_handler(t){}relayout(){this.set_ranges(),this.compute_view_padding(),this.draw()}drawCanvas(){this.image.attr("href",this.canvas.toDataURL("image/png"))}draw(){this.set_ranges();const t=this.getPlottingData();this.canvas.setAttribute("width",t.totalWidth),this.canvas.setAttribute("height",t.totalHeight);const e=this.canvas.getContext("2d");this.model.mark_data.color.forEach((n,i)=>{const r=t.heights[i],o=t.yOrigin+t.yStartPoints[i];n.forEach((n,i)=>{const a=t.widths[i],s=t.xOrigin+t.xStartPoints[i];e.fillStyle=this.getElementFill(n),e.fillRect(s,o,this.expandRect(a),this.expandRect(r))})}),this.image.attr("width",t.totalWidth).attr("height",t.totalHeight).attr("x",t.x0).attr("y",t.y0),this.drawCanvas()}expandRect(t){return t>0?t+.5:t-.5}getPlottingData(){const t=Array.from(this.model.mark_data.x).map(this.scales.x.scale),e=Array.from(this.model.mark_data.y).map(this.scales.y.scale),n=this.scales.x.model.get("reverse"),i=this.scales.y.model.get("reverse"),r=this.getPadding(t,e),o=this.computeRectSizes(t,r.left,r.right),a=this.computeRectSizes(e,r.bottom,r.top,!0),s=Math.abs(t[t.length-1]-t[0]+r.left+r.right),c=Math.abs(e[0]-e[e.length-1]+r.top+r.bottom),l=t[0]-r.left,u=e[e.length-1]-r.top;return{widths:o,heights:a,totalWidth:s,totalHeight:c,xOrigin:n?s:0,yOrigin:i?c:0,xStartPoints:t.map((e,n)=>0==n?0:.5*(e+t[n-1])-l),yStartPoints:e.map((t,n)=>n==e.length-1?0:.5*(t+e[n+1])-u),x0:n?l-s:l,y0:i?u-c:u}}getPadding(t,e){const n=t.length,i=e.length;return{left:.5*(t[1]-t[0]),right:.5*(t[n-1]-t[n-2]),bottom:.5*-(e[1]-e[0]),top:.5*-(e[i-1]-e[i-2])}}computeRectSizes(t,e,n,i=!1){const r=i?-1:1;return t.map((i,o)=>0==o?r*(t[1]-i)*.5+e:o==t.length-1?r*(i-t[o-1])*.5+n:r*(t[o+1]-t[o-1])*.5)}getElementFill(t){return null===t?this.model.get("null_color"):this.scales.color.scale(t)}clear_style(t,e,n){}compute_view_padding(){}set_default_style(t,e){}set_style_on_elements(t,e,n){}}},function(t,e,n){"use strict";var i=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e};Object.defineProperty(e,"__esModule",{value:!0});const r=n(18),o=i(n(12));class a extends r.MarkModel{defaults(){return Object.assign({},r.MarkModel.prototype.defaults(),{_model_name:"HeatMapModel",_view_name:"HeatMap",x:[],y:[],color:null,scales_metadata:{x:{orientation:"horizontal",dimension:"x"},y:{orientation:"vertical",dimension:"y"},color:{dimension:"color"}},null_color:"black"})}initialize(t,e){super.initialize(t,e),this.on_some_change(["x","y","color"],this.update_data,this),this.on_some_change(["preserve_domain"],this.update_domains,this),this.update_data(),this.update_domains()}update_data(){this.dirty=!0,this.mark_data={x:this.get("x"),y:this.get("y"),color:this.get("color")},this.update_domains(),this.dirty=!1,this.trigger("data_updated")}update_domains(){if(!this.mark_data)return;const t=this.get("scales"),e=t.x,n=t.y,i=t.color,r=[].concat.apply([],this.mark_data.color.map(t=>Array.prototype.slice.call(t,0)));this.get("preserve_domain").x?e.del_domain([],this.model_id+"_x"):e.compute_and_set_domain(this.mark_data.x,this.model_id+"_x"),this.get("preserve_domain").y?n.del_domain([],this.model_id+"_y"):n.compute_and_set_domain(this.mark_data.y,this.model_id+"_y"),null!=i&&(this.get("preserve_domain").color?i.del_domain([],this.model_id+"_color"):i.compute_and_set_domain(r,this.model_id+"_color"))}get_data_dict(t,e){return t}}a.serializers=Object.assign({},r.MarkModel.serializers,{x:o.array_or_json,y:o.array_or_json,color:o.array_or_json}),e.HeatMapModel=a},function(t,e,n){"use strict";var i=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e};Object.defineProperty(e,"__esModule",{value:!0});const r=i(n(10)),o=n(28),a=i(n(6));class s extends r.DOMWidgetModel{defaults(){return Object.assign({},r.DOMWidgetModel.prototype.defaults(),{_model_name:"ToolbarModel",_view_name:"Toolbar",_model_module:"bqplot",_view_module:"bqplot",_model_module_version:o.semver_range,_view_module_version:o.semver_range,figure:void 0,_panning:!1,_panzoom:null})}panzoom(){const t=this.get("figure");if(this.get("_panning"))t&&(t.set("interaction",this.cached_interaction),t.save_changes()),this.set("_panning",!1),this.save_changes();else{if(t){this.cached_interaction=t.get("interaction");const e=this.get("_panzoom");e?(t.set("interaction",e),t.save_changes()):this._create_panzoom_model(t).then(e=>{this.set("_panzoom",e),this.save_changes(),t.set("interaction",e),t.save_changes()})}this.set("_panning",!0),this.save_changes()}}reset(){const t=this.get("figure");if(t){t.set("interaction",this.cached_interaction),t.save_changes();const e=this.get("_panzoom");e.reset_scales(),e.close(),this.set("_panzoom",null),this.set("_panning",!1),this.save_changes()}}save_png(){const t=this.get("figure");t&&t.save_png()}_create_panzoom_model(t){return this.widget_manager.new_widget({model_name:"PanZoomModel",model_module:"bqplot",model_module_version:t.get("_model_module_version"),view_name:"PanZoom",view_module:"bqplot",view_module_version:t.get("_view_module_version")}).then(function(e){return Promise.all(t.get("marks")).then(function(t){const n=[],i=[];for(let e=0;e{t.preventDefault(),this.model.panzoom()};const e=document.createElement("i");e.className="fa fa-arrows",t.appendChild(e);const n=document.createElement("button");n.classList.add("jupyter-widgets"),n.classList.add("jupyter-button"),n.classList.add("widget-button"),n.setAttribute("data-toggle","tooltip"),n.setAttribute("title","Reset"),n.onclick=t=>{t.preventDefault(),this.model.reset()};const i=document.createElement("i");i.className="fa fa-refresh",n.appendChild(i);const r=document.createElement("button");r.classList.add("jupyter-widgets"),r.classList.add("jupyter-button"),r.classList.add("widget-button"),r.setAttribute("data-toggle","tooltip"),r.setAttribute("title","Save"),r.onclick=t=>{t.preventDefault(),this.model.save_png()};const o=document.createElement("i");o.className="fa fa-save",r.appendChild(o),this.el.appendChild(t),this.el.appendChild(n),this.el.appendChild(r),this._panzoom=t,this.update()}update(){this.model.get("_panning")?this._panzoom.classList.add("mod-active"):this._panzoom.classList.remove("mod-active")}}},function(t,e,n){"use strict";var i=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e};Object.defineProperty(e,"__esModule",{value:!0});const r=n(18),o=i(n(12));class a extends r.MarkModel{defaults(){return Object.assign({},r.MarkModel.prototype.defaults(),{_model_name:"GraphModel",_view_name:"Graph",x:[],y:[],color:null,hovered_point:null,scales_metadata:{x:{orientation:"horizontal",dimension:"x"},y:{orientation:"vertical",dimension:"y"},color:{dimension:"color"}},colors:[]})}initialize(t,e){super.initialize(t,e),this.on_some_change(["x","y","color","link_color","node_data","link_data","link_color"],this.update_data,this),this.on_some_change(["preserve_domain"],this.update_domains,this),this.update_data()}update_node_data(){let t=this.get("node_data");const e=this.get("x"),n=this.get("y"),i=this.get("color")||[],r=this.get("scales").color;t.length>0&&"string"==typeof t[0]&&(t=t.map(function(t){return{label:t}})),this.mark_data=[];const o=this;t.forEach(function(t,e){t.label=t.label||"N"+e,t.label_display=t.label_display||"center",t.shape=t.shape||"circle",t.shape_attrs=function(t,e){const n={};switch(t){case"circle":n.r=e.r||15;break;case"rect":n.width=e.width||25,n.height=e.height||.8*n.width,n.rx=e.rx||0,n.ry=e.ry||0;break;case"ellipse":n.rx=e.rx||20,n.ry=e.ry||.6*n.rx;break;default:console.log("Invalid shape passed - ",t)}return n}(t.shape,t.shape_attrs||{}),t.value=t.value||null,o.mark_data.push(t)}),0!==e.length&&0!==n.length&&(r&&(this.get("preserve_domain").color?r.del_domain([],this.model_id+"_color"):r.compute_and_set_domain(i,this.model_id+"_color")),this.mark_data.forEach(function(t,r){t.xval=e[r],t.yval=n[r],t.color=i[r]}))}update_link_data(){const t=this.get("scales").link_color;this.link_data=this.get("link_data");let e=this.get("link_matrix");const n=this.get("link_color"),i=this;void 0!==t&&n.length>0&&(e=n),0===this.link_data.length&&e.length>0&&e.forEach(function(t,e){t.forEach(function(t,n){null!==t&&i.link_data.push({source:e,target:n,value:t})})})}update_data(){this.dirty=!0,this.update_node_data(),this.update_link_data(),this.update_unique_ids(),this.update_domains(),this.dirty=!1,this.trigger("data_updated")}update_unique_ids(){}get_data_dict(t,e){return t}update_domains(){const t={x:"xval",y:"yval"};if(!this.mark_data)return;const e=this.get("scales");for(let n in e)if(e.hasOwnProperty(n)){const i=e[n];this.get("preserve_domain")[n]?i.del_domain([],this.model_id+n):i.compute_and_set_domain(this.mark_data.map(function(e){return e[n]||e[t[n]]}),this.model_id+n)}}}a.serializers=Object.assign({},r.MarkModel.serializers,{x:o.array_or_json,y:o.array_or_json,color:o.array_or_json,link_color:o.array_or_json,link_matrix:o.array_or_json}),e.GraphModel=a},function(t,e,n){"use strict";var i=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e};Object.defineProperty(e,"__esModule",{value:!0});const r=i(n(2));n(31);const o=function(){return n(0).event}.bind(this),a=i(n(6)),s=n(19);e.Graph=class extends s.Mark{render(){let t=super.render();const e=this;return this.selected_style=this.model.get("selected_style"),this.unselected_style=this.model.get("unselected_style"),this.selected_indices=this.model.get("selected"),this.hovered_style=this.model.get("hovered_style"),this.unhovered_style=this.model.get("unhovered_style"),this.hovered_index=this.model.get("hovered_point")?[this.model.get("hovered_point")]:null,this.display_el_classes=["element"],this.event_metadata={mouse_over:{msg_name:"hover",lookup_data:!1,hit_test:!0},element_clicked:{msg_name:"element_click",lookup_data:!1,hit_test:!0},parent_clicked:{msg_name:"background_click",hit_test:!1}},this.displayed.then(function(){e.parent.tooltip_div.node().appendChild(e.tooltip_div.node()),e.create_tooltip()}),this.d3el.attr("class","network"),this.arrow=this.parent.svg.append("defs").append("marker").attr("id","arrow").attr("refX",0).attr("refY",3).attr("markerWidth",10).attr("markerHeight",10).attr("orient","auto").append("path").attr("class","linkarrow").attr("d","M0,0 L0,6 L9,3 z"),t.then(function(){e.event_listeners={},e.process_interactions(),e.create_listeners(),e.compute_view_padding(),e.draw()})}set_ranges(){const t=this.scales.x,e=this.scales.y;t&&t.set_range(this.parent.padded_range("x",t.model)),e&&e.set_range(this.parent.padded_range("y",e.model))}set_positional_scales(){this.x_scale=this.scales.x,this.y_scale=this.scales.y,this.x_scale||(this.x_scale=this.parent.scale_x),this.y_scale||(this.y_scale=this.parent.scale_y),this.listenTo(this.x_scale,"domain_changed",function(){this.model.dirty||this.update_position()}),this.listenTo(this.y_scale,"domain_changed",function(){this.model.dirty||this.update_position()})}relayout(){this.set_ranges(),this.update_position()}update_position(){const t=this.scales.x,e=this.scales.y;this.set_ranges(),t&&e&&(this.model.mark_data.forEach(function(n){n.x=t.scale(n.xval)+t.offset,n.y=e.scale(n.yval)+e.offset}),this.force_layout&&(this.force_layout.nodes(this.model.mark_data).force("link",r.forceLink(this.model.link_data).distance(this.model.get("link_distance"))),this.links&&this.links.data(this.model.link_data),this.nodes&&this.nodes.data(this.force_layout.nodes()),this.nodes&&this.links&&this.tick()))}initialize_additional_scales(){const t=this.scales.color;t&&(this.listenTo(t,"domain_changed",function(){this.color_scale_updated()}),t.on("color_scale_range_changed",this.color_scale_updated,this));const e=this.scales.link_color;e&&this.listenTo(e,"domain_changed",function(){this.link_color_scale_updated()})}create_listeners(){super.create_listeners(),this.d3el.on("mouseover",a.bind(function(){this.event_dispatcher("mouse_over")},this)).on("mousemove",a.bind(function(){this.event_dispatcher("mouse_move")},this)).on("mouseout",a.bind(function(){this.event_dispatcher("mouse_out")},this)),this.listenTo(this.model,"change:charge",this.update_charge),this.listenTo(this.model,"change:link_distance",this.update_link_distance),this.listenTo(this.model,"data_updated",this.data_updated),this.listenTo(this.model,"change:tooltip",this.create_tooltip),this.listenTo(this.model,"change:enable_hover",function(){this.hide_tooltip()}),this.listenTo(this.model,"change:interactions",this.process_interactions),this.listenTo(this.model,"change:selected",this.update_selected),this.listenTo(this.model,"change:hovered_point",this.update_hovered),this.listenTo(this.model,"change:hovered_style",this.hovered_style_updated),this.listenTo(this.model,"change:unhovered_style",this.unhovered_style_updated),this.listenTo(this.parent,"bg_clicked",function(){this.event_dispatcher("parent_clicked")})}data_updated(){this.draw(),this.relayout()}get_node_color(t,e){const n=this.scales.color,i=this.model.get("colors"),r=i.length;return n&&void 0!==t.color?n.scale(t.color):i[e%r]}draw(){this.set_ranges();const t=this.scales.x,e=this.scales.y,n=this.scales.link_color;this.d3el.selectAll(".node").remove(),this.d3el.selectAll(".link").remove(),t&&e&&this.model.mark_data.forEach(function(n){n.x=t.scale(n.xval)+t.offset,n.y=e.scale(n.yval)+e.offset});const i=this.parent.fig.node().getBBox(),o=i.width,s=i.height;this.force_layout=r.forceSimulation().force("center",r.forceCenter(o/2,s/2)).force("forceX",r.forceX().strength(.1).x(o/2)).force("forceY",r.forceY().strength(.1).y(s/2)),t||e||this.force_layout.force("charge",r.forceManyBody().strength(this.model.get("charge"))).on("tick",a.bind(this.tick,this));const c=this.model.get("directed");this.links=this.d3el.selectAll(".link").data(this.model.link_data).enter().append("path").attr("class","link").style("stroke",function(t){return n?n.scale(t.value):null}).style("stroke-width",function(t){return t.link_width}).attr("marker-mid",c?"url(#arrow)":null),this.force_layout.nodes(this.model.mark_data).force("link",r.forceLink(this.model.link_data).distance(this.model.get("link_distance")));const l=this;this.nodes=this.d3el.selectAll(".node").data(this.force_layout.nodes()).enter().append("g").attr("class","node").call(r.drag().on("start",a.bind(l.dragstarted,l)).on("drag",a.bind(l.dragged,l)).on("end",a.bind(l.dragended,l))),this.nodes.append(function(t){return document.createElementNS(r.namespaces.svg,t.shape)}).attr("class","element").each(function(t){const e=r.select(this);for(let n in t.shape_attrs)e.attr(n,t.shape_attrs[n])}).style("fill",function(t,e){return l.get_node_color(t,e)}),this.nodes.append("text").attr("class","label").attr("text-anchor",function(t){return"center"===t.label_display?"middle":"start"}).attr("x",function(t){let e=0;if("outside"===t.label_display)switch(t.shape){case"rect":e=t.shape_attrs.width/2+5;break;case"circle":e=t.shape_attrs.r+5;break;case"ellipse":e=t.shape_attrs.rx+5;break;default:e=0}return e}).attr("y",".31em").text(function(t){return t.label}).style("display",function(t){return"none"===t.label_display?"none":"inline"}),this.nodes.on("click",a.bind(function(t,e){this.event_dispatcher("element_clicked",{data:t,index:e})},this)),this.nodes.on("mouseover",a.bind(function(t,e){this.hover_handler({data:t,index:e})},this)),this.nodes.on("mouseout",a.bind(function(){this.reset_hover_points()},this))}dragstarted(t){o().active||this.force_layout.alphaTarget(.4).restart(),t.fx=t.x,t.fy=t.y}dragged(t){t.fx=o().x,t.fy=o().y}dragended(t){o().active||this.force_layout.alphaTarget(.4),t.fx=null,t.fy=null}color_scale_updated(){const t=this;this.nodes.selectAll(".element").style("fill",function(e,n){return t.get_node_color(e,n)})}link_color_scale_updated(){const t=this.scales.link_color;this.links.style("stroke",function(e){return t?t.scale(e.value):null})}process_click(t){super.process_click(t),"select"===t&&(this.event_listeners.parent_clicked=this.reset_selection,this.event_listeners.element_clicked=this.click_handler)}reset_hover_points(){this.links.style("opacity",1),this.model.set("hovered_point",null),this.hovered_index=null,this.touch()}hover_handler(t){const e=t.data,n=t.index;this.model.get("highlight_links")?this.links.style("opacity",function(t){return t.source.label===e.label||t.target.label===e.label?1:.1}):this.links.style("opacity",1),this.model.set("hovered_point",n,{updated_view:this}),this.touch()}reset_selection(){this.model.set("selected",null),this.selected_indices=null,this.touch()}click_handler(t){const e=t.index,n=this.model.get("selected")||[];let i=Array.from(n);const r=i.indexOf(e),a=o().ctrlKey||o().metaKey;r>-1&&a?i.splice(r,1):a?i.push(e):(i=[]).push(e),this.model.set("selected",0===i.length?null:i,{updated_view:this}),this.touch();let s=o();s||(s=window.event),void 0!==s.cancelBubble&&(s.cancelBubble=!0),s.stopPropagation&&s.stopPropagation(),s.preventDefault()}hovered_style_updated(t,e){this.hovered_style=e,this.clear_style(t.previous("hovered_style"),this.hovered_index),this.style_updated(e,this.hovered_index)}unhovered_style_updated(t,e){this.unhovered_style=e;const n=this.hovered_index,i=n?a.range(this.model.mark_data.length).filter(function(t){return-1===n.indexOf(t)}):[];this.clear_style(t.previous("unhovered_style"),i),this.style_updated(e,i)}update_selected(t,e){this.selected_indices=e,this.apply_styles()}update_hovered(t,e){this.hovered_index=null===e?e:[e],this.apply_styles()}apply_styles(t){null==t&&(t=[this.selected_style,this.unselected_style,this.hovered_style,this.unhovered_style]),super.apply_styles(t);const e=a.range(this.model.mark_data.length);this.set_style_on_elements(this.hovered_style,this.hovered_index);const n=this.hovered_index?a.difference(e,this.hovered_index):[];this.set_style_on_elements(this.unhovered_style,n)}clear_style(t,e){let n=this.d3el.selectAll(".element");e&&(n=n.filter(function(t,n){return-1!==e.indexOf(n)}));const i={};for(let e in t)i[e]=null;n.styles(i)}set_style_on_elements(t,e){if(!e||0===e.length)return;if(void 0!==t&&0===Object.keys(t).length)return;let n=this.d3el.selectAll(".element");(n=n.filter(function(t,n){return-1!==e.indexOf(n)})).styles(t)}compute_view_padding(){const t=r.max(this.model.mark_data.map(function(t){return(t.shape_attrs.r||t.shape_attrs.width/2||t.shape_attrs.rx)+1})),e=r.max(this.model.mark_data.map(function(t){return(t.shape_attrs.r||t.shape_attrs.height/2||t.shape_attrs.ry)+1}));t===this.x_padding&&e===this.y_padding||(this.x_padding=t,this.y_padding=t,this.trigger("mark_padding_updated"))}selected_deleter(){o().stopPropagation()}update_link_distance(){const t=this.scales.x,e=this.scales.y,n=this.model.get("link_distance");t||e||this.force_layout.linkDistance(n).start()}update_charge(){const t=this.scales.x,e=this.scales.y,n=this.model.get("charge");t||e||this.force_layout.charge(n).start()}link_arc(t){const e=t.target.x-t.source.x,n=t.target.y-t.source.y,i=Math.sqrt(e*e+n*n);return"M"+t.source.x+","+t.source.y+"A"+i+","+i+" 0 0,1 "+t.target.x+","+t.target.y}link_line(t){const e=(t.source.x+t.target.x)/2,n=(t.source.y+t.target.y)/2;return"M"+t.source.x+","+t.source.y+"L"+e+","+n+"L"+t.target.x+","+t.target.y}link_slant_line(t){const e=(t.source.x+t.target.x)/2;return"M"+t.source.x+","+t.source.y+"L"+e+","+t.target.y+"L"+t.target.x+","+t.target.y}tick(){const t=this.model.get("link_type");this.nodes.attr("transform",function(t){return"translate("+t.x+","+t.y+")"}),this.nodes.select("rect").attr("transform",function(t){return"translate("+-t.shape_attrs.width/2+","+-t.shape_attrs.height/2+")"});let e=this.link_arc;switch(t){case"arc":e=this.link_arc;break;case"line":e=this.link_line;break;case"slant_line":e=this.link_slant_line;break;default:e=this.link_arc}this.links.attr("d",function(t){return e(t)})}set_default_style(t){}}},function(t,e,n){"use strict";var i=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e};Object.defineProperty(e,"__esModule",{value:!0});const r=i(n(2)),o=n(19),a=i(n(6));e.Image=class extends o.Mark{render(){const t=super.render(),e=this.d3el||this.el;this.im=e.append("image").attr("x",0).attr("y",0).attr("width",1).attr("height",1).attr("preserveAspectRatio","none"),this.update_image(),this.event_metadata={mouse_over:{msg_name:"hover",lookup_data:!1,hit_test:!0},legend_clicked:{msg_name:"legend_click",hit_test:!0},element_clicked:{msg_name:"element_click",lookup_data:!1,hit_test:!1},parent_clicked:{msg_name:"background_click",hit_test:!1}};const n=this;return t.then(function(){n.event_listeners={},n.reset_click(),n.create_listeners(),n.listenTo(n.parent,"margin_updated",function(){n.draw(!1)})})}set_positional_scales(){const t=this.scales.x,e=this.scales.y;this.listenTo(t,"domain_changed",function(){this.model.dirty||this.draw()}),this.listenTo(e,"domain_changed",function(){this.model.dirty||this.draw()})}set_ranges(){const t=this.scales.x,e=this.scales.y;t&&t.set_range(this.parent.padded_range("x",t.model)),e&&e.set_range(this.parent.padded_range("y",e.model))}create_listeners(){super.create_listeners(),this.listenTo(this.model,"change:image",this.update_image),this.listenTo(this.model,"data_updated",function(){this.draw(!0)})}update_image(){this.im.attr("href")&&URL.revokeObjectURL(this.im.attr("href"));const t=this.model.get("image"),e=new Blob([t.get("value")],{type:"image/"+t.get("format")}),n=URL.createObjectURL(e);this.im.attr("href",n)}remove(){URL.revokeObjectURL(this.im.attr("href")),super.remove()}relayout(){this.draw(!0)}img_send_message(t,e){const n=this.event_metadata[t],i={click_x:this.scales.x.invert(r.mouse(this.el)[0]),click_y:this.scales.y.invert(r.mouse(this.el)[1])};this.send({event:n.msg_name,data:i})}draw(t){this.set_ranges();const e=this.scales.x?this.scales.x:this.parent.scale_x,n=this.scales.y?this.scales.y:this.parent.scale_y,i=t?this.parent.model.get("animation_duration"):0,o=this.d3el||this.el,s=this.model.mark_data.x.map(e.scale),c=this.model.mark_data.y.map(n.scale);o.selectAll("image").transition().duration(i).attr("transform",function(t){return"translate("+(s[0]+e.offset)+","+(c[1]+n.offset)+") scale("+(s[1]-s[0])+", "+(c[0]-c[1])+")"}),o.on("click",a.bind(function(t,e){this.img_send_message("element_clicked",{data:r.event,index:e})},this))}clear_style(t,e,n){}compute_view_padding(){}set_default_style(t,e){}set_style_on_elements(t,e,n){}}},function(t,e,n){"use strict";var i=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e};Object.defineProperty(e,"__esModule",{value:!0});const r=i(n(10)),o=n(18),a=i(n(12));class s extends o.MarkModel{defaults(){return Object.assign({},o.MarkModel.prototype.defaults(),{_model_name:"ImageModel",_view_name:"Image",x:[0,1],y:[0,1],scales_metadata:{x:{orientation:"horizontal",dimension:"x"},y:{orientation:"vertical",dimension:"y"}}})}initialize(t,e){super.initialize(t,e),this.on_some_change(["x","y"],this.update_data,this),this.on_some_change(["preserve_domain"],this.update_domains,this),this.update_data()}update_data(){this.mark_data={x:this.get("x"),y:this.get("y")},this.update_domains(),this.trigger("data_updated")}update_domains(){if(!this.mark_data)return;const t=this.get("scales"),e=t.x,n=t.y;e&&(this.get("preserve_domain").x?e.del_domain([],this.model_id+"_x"):e.compute_and_set_domain(this.mark_data.x,this.model_id+"_x")),n&&(this.get("preserve_domain").y?n.del_domain([],this.model_id+"_y"):n.compute_and_set_domain(this.mark_data.y,this.model_id+"_y"))}}s.serializers=Object.assign({},o.MarkModel.serializers,{image:{deserialize:r.unpack_models},x:a.array_or_json,y:a.array_or_json}),e.ImageModel=s},function(t,e,n){"use strict";var i=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e};Object.defineProperty(e,"__esModule",{value:!0});const r=n(19),o=i(n(2)),a=i(n(64)),s=i(n(6)),c=n(17),l=i(n(146)),u=a.symbol,h=function(t){if(t instanceof Float32Array)return t;if("function"==typeof t[Symbol.iterator]){const e=t.length;let n=new Float32Array(e);for(let i=0;it/(e.length-1))),i=[];s.map(s.range(256),t=>{const e=t/255,r=o.color(String(n(e))).hex(),a=String(r),s=[parseInt("0x"+a.substring(1,3)),parseInt("0x"+a.substring(3,5)),parseInt("0x"+a.substring(5,7))];i.push(s[0],s[1],s[2])});const r=new Uint8Array(i),a=new l.DataTexture(r,256,1,l.RGBFormat,l.UnsignedByteType);return a.needsUpdate=!0,a};class p{constructor(t,e=1,n=1,i=!1){this.array=t,this.item_size=e,this.mesh_per_attribute=n,this.normalized=i}}class m extends p{constructor(t,e=1,n=1,i=!1,r=!0){super(t,e,n,i),this.use_colormap=r}}class g extends p{constructor(t,e=1,n=1,i=!1,r=!0){super(t,e,n,i),this.use_selection=r}}e.ScatterGL=class extends r.Mark{render(){const t=super.render();this.transitions=[],this.invalidated_pixel_position=!0,this.dot=u().type(this.model.get("marker")),this.instanced_geometry=new l.InstancedBufferGeometry;const e=new Float32Array([-.5,.5,0,.5,.5,0,-.5,-.5,0,.5,-.5,0]);this.instanced_geometry.addAttribute("position",new l.Float32BufferAttribute(e,3));const i=new Float32Array([0,1,1,1,0,0,1,0]);this.instanced_geometry.addAttribute("uv",new l.Float32BufferAttribute(i,2));const r=new Uint16Array([0,2,1,2,3,1]);return this.instanced_geometry.index=new l.Uint16BufferAttribute(r,1),this.scatter_material=new l.RawShaderMaterial({uniforms:{domain_x:{type:"2f",value:[0,10]},domain_y:{type:"2f",value:[-12,12]},domain_z:{type:"2f",value:[0,1]},domain_size:{type:"2f",value:[0,1]},domain_color:{type:"2f",value:[0,1]},domain_rotation:{type:"2f",value:[0,180]},domain_opacity:{type:"2f",value:[0,1]},range_x:{type:"2f",value:[0,1]},range_y:{type:"2f",value:[0,1]},range_z:{type:"2f",value:[0,1]},range_size:{type:"2f",value:[0,1]},range_rotation:{type:"2f",value:[0,Math.PI]},range_opacity:{type:"2f",value:[0,1]},animation_time_x:{type:"f",value:1},animation_time_y:{type:"f",value:1},animation_time_z:{type:"f",value:1},animation_time_size:{type:"f",value:1},animation_time_color:{type:"f",value:1},animation_time_rotation:{type:"f",value:1},animation_time_opacity:{type:"f",value:1},has_selection:{type:"b",value:!1},has_hover:{type:"b",value:!1},has_selected_fill:{type:"b",value:!1},has_selected_stroke:{type:"b",value:!1},has_selected_opacity:{type:"b",value:!1},has_unselected_fill:{type:"b",value:!1},has_unselected_stroke:{type:"b",value:!1},has_unselected_opacity:{type:"b",value:!1},has_hovered_fill:{type:"b",value:!1},has_hovered_stroke:{type:"b",value:!1},has_hovered_opacity:{type:"b",value:!1},has_unhovered_fill:{type:"b",value:!1},has_unhovered_stroke:{type:"b",value:!1},has_unhovered_opacity:{type:"b",value:!1},selected_fill:{type:"4f",value:[1,0,0,1]},selected_stroke:{type:"4f",value:[1,0,0,1]},selected_opacity:{value:1},unselected_fill:{type:"4f",value:[1,0,0,1]},unselected_stroke:{type:"4f",value:[1,0,0,1]},unselected_opacity:{value:1},hovered_fill:{type:"4f",value:[0,1,0,1]},hovered_opacity:{value:1},hovered_stroke:{type:"4f",value:[0,1,0,1]},unhovered_fill:{type:"4f",value:[0,1,0,1]},unhovered_stroke:{type:"4f",value:[0,1,0,1]},unhovered_opacity:{value:1},default_stroke_color:{type:"4f",value:[0,0,0,0]},colormap:{type:"t",value:null},fill:{type:"b",value:!0},stroke_width:{type:"f",value:1.5},marker_scale:{type:"f",value:1}},vertexShader:n(331).default,fragmentShader:n(332).default,transparent:!0,depthTest:!1,depthWrite:!1,blending:l.CustomBlending,blendEquation:l.AddEquation,blendSrc:l.OneFactor,blendDst:l.OneMinusSrcAlphaFactor,blendEquationAlpha:l.AddEquation,blendSrcAlpha:l.OneFactor,blendDstAlpha:l.OneMinusSrcAlphaFactor}),this.mesh=new l.Mesh(this.instanced_geometry,this.scatter_material),t.then(()=>{this.camera=new l.OrthographicCamera(-.5,.5,.5,-.5,-1e4,1e4),this.camera.position.z=10,this.scene=new l.Scene;const t=new p(h(this.model.get("x")));this.x=this.initialize_attribute("x",t),this.x_previous=this.initialize_attribute("x_previous",t);const e=new p(h(this.model.get("y")));this.y=this.initialize_attribute("y",e),this.y_previous=this.initialize_attribute("y_previous",e),this.markers_number=Math.min(this.x.array.length,this.y.array.length),this.instanced_geometry.maxInstancedCount=this.markers_number;const n=this.get_color_attribute_parameters();this.color=this.initialize_attribute("color",n),this.scatter_material.defines.USE_COLORMAP=n.use_colormap;const i=this.get_opacity_attribute_parameters();this.opacity=this.initialize_attribute("opacity",i),this.opacity_previous=this.initialize_attribute("opacity_previous",i);const r=this.get_size_attribute_parameters();this.size=this.initialize_attribute("size",r),this.size_previous=this.initialize_attribute("size_previous",r);const o=this.get_rotation_attribute_parameters();this.rotation=this.initialize_attribute("rotation",o),this.rotation_previous=this.initialize_attribute("rotation_previous",o);const a=this.get_selected_attribute_parameters();this.selected=this.initialize_attribute("selected",a),this.scatter_material.uniforms.has_selection.value=a.use_selection,this.scatter_material.needsUpdate=!0,this.scene.add(this.mesh),this.create_listeners(),this.compute_view_padding(),this.update_scene(),this.listenTo(this.parent,"margin_updated",()=>{this.update_scene()})})}initialize_attribute(t,e){const n=new l.InstancedBufferAttribute(e.array,e.item_size,e.mesh_per_attribute);return n.normalized=e.normalized,n.dynamic=!0,this.instanced_geometry.addAttribute(t,n),n}get_color_attribute_parameters(){if(this.model.get("color")){const t=this.model.get("color");let e;return t.length{const i=new l.Color(n[e%n.length]);t[3*e+0]=i.r,t[3*e+1]=i.g,t[3*e+2]=i.b}),e=1;return new m(t,3,e,!1,!1)}}get_opacity_attribute_parameters(){let t=this.model.get("default_opacities")||[1];if(0==t.length&&(t=[1]),this.model.get("opacity")){const e=this.model.get("opacity");let n;return e.length{i+=e.length,n[i]=t[i%t.length]})):n=h(e),new p(n,1,1)}{let e,n;return 1==t.length?(e=h(t),n=this.markers_number):(e=h(this.markers_number),n=1,s.each(s.range(this.markers_number),n=>{e[n]=t[n%t.length]})),new p(e,1,n)}}get_size_attribute_parameters(){if(this.model.get("size")){const t=this.model.get("size");let e;return t.length{s.each(["stroke","fill","opacity"],e=>{this.scatter_material.uniforms[`has_${t}_${e}`].value=Boolean(this.model.get(`${t}_style`)[e]),this.scatter_material.uniforms[`has_un${t}_${e}`].value=Boolean(this.model.get(`un${t}_style`)[e]),s.contains(["opacity"],e)?(this.scatter_material.uniforms[`${t}_${e}`].value=this.model.get(`${t}_style`)[e],this.scatter_material.uniforms[`un${t}_${e}`].value=this.model.get(`un${t}_style`)[e]):(this.scatter_material.uniforms[`${t}_${e}`].value=d(this.model.get(`${t}_style`)[e],"green"),this.scatter_material.uniforms[`un${t}_${e}`].value=d(this.model.get(`un${t}_style`)[e],"green"))})}),this.camera.left=0,this.camera.right=t.plotarea_width,this.camera.bottom=0,this.camera.top=t.plotarea_height,this.camera.updateProjectionMatrix(),this.scatter_material.uniforms.range_x.value=i,this.scatter_material.uniforms.range_y.value=[r[1],r[0]],this.scatter_material.uniforms.domain_x.value=e.scale.domain(),this.scatter_material.uniforms.domain_y.value=n.scale.domain(),this.scales.size)this.scatter_material.uniforms.range_size.value=this.scales.size.scale.range(),this.scatter_material.uniforms.domain_size.value=this.scales.size.scale.domain();else{const t=this.model.get("default_size");this.scatter_material.uniforms.range_size.value=[0,t],this.scatter_material.uniforms.domain_size.value=[0,t]}this.scales.rotation&&(this.scatter_material.uniforms.range_rotation.value=this.scales.rotation.scale.range(),this.scatter_material.uniforms.domain_rotation.value=this.scales.rotation.scale.domain()),this.scales.opacity&&(this.scatter_material.uniforms.range_opacity.value=this.scales.opacity.scale.range(),this.scatter_material.uniforms.domain_opacity.value=this.scales.opacity.scale.domain()),t.renderer.render(this.scene,this.camera);const o=[];for(let t=0;t0&&this.update_scene()}create_listeners(){super.create_listeners(),this.listenTo(this.model,"change:x",this.update_x),this.listenTo(this.model,"change:y",this.update_y),this.listenTo(this.model,"change:color change:colors change:unselected_style",this.update_color),this.listenTo(this.model,"change:opacity change:default_opacities",this.update_opacity),this.listenTo(this.model,"change:size change:default_size",this.update_size),this.listenTo(this.model,"change:rotation",this.update_rotation),this.listenTo(this.model,"change:selected",this.update_selected),this.listenTo(this.model,"change:marker",this.update_marker),this.update_marker(),this.listenTo(this.model,"change:stroke",this.update_stroke),this.update_stroke(),this.listenTo(this.model,"change:stroke_width",this.update_stroke_width),this.update_stroke_width();const t=()=>{this.mesh.visible=this.model.get("visible"),this.update_scene()};this.listenTo(this.model,"change:visible",t),t();const e=()=>{this.scatter_material.defines.FILL=this.model.get("fill")?1:0,this.scatter_material.needsUpdate=!0,this.update_scene()};this.listenTo(this.model,"change:fill",e),e(),this.listenTo(this.model,"change",this.update_legend)}update_attribute(t,e,n){return e.meshPerAttribute!=n.mesh_per_attribute?e=this.initialize_attribute(t,n):e.array.length{})){if(r){if(e.array.length{})){this.scatter_material.uniforms["animation_time_"+t].value=0,this.transition(e=>{this.scatter_material.uniforms["animation_time_"+t].value=e},e,this)}update_x(t=!0){const e=h(this.model.get("x")),n=Math.min(e.length,this.y.array.length);this.markers_number!=n&&this.update_markers_number(n),[this.x,this.x_previous]=this.update_attributes("x",this.x,this.x_previous,new p(e,1,1)),t&&this.update_scene()}update_y(t=!0){const e=h(this.model.get("y")),n=Math.min(this.x.array.length,e.length);this.markers_number!=n&&this.update_markers_number(n),[this.y,this.y_previous]=this.update_attributes("y",this.y,this.y_previous,new p(e,1,1)),t&&this.update_scene()}update_markers_number(t){const e=this.markers_number;this.markers_number=t,this.instanced_geometry.maxInstancedCount=t,this.markers_number>e&&(this.update_color(!1),this.update_opacity(!1),this.update_size(!1),this.update_rotation(!1),this.update_selected(!1))}update_color(t=!0){const e=this.get_color_attribute_parameters();this.color=this.update_attribute("color",this.color,e),this.color.normalized=e.normalized,this.scatter_material.defines.USE_COLORMAP=e.use_colormap,this.scatter_material.needsUpdate=!0,t&&this.update_scene()}update_opacity(t=!0){const e=this.get_opacity_attribute_parameters();[this.opacity,this.opacity_previous]=this.update_attributes("opacity",this.opacity,this.opacity_previous,e),t&&this.update_scene()}update_size(t=!0){const e=this.get_size_attribute_parameters();[this.size,this.size_previous]=this.update_attributes("size",this.size,this.size_previous,e),t&&this.update_scene()}update_rotation(t=!0){const e=this.get_rotation_attribute_parameters();[this.rotation,this.rotation_previous]=this.update_attributes("rotation",this.rotation,this.rotation_previous,e),t&&this.update_scene()}update_selected(t=!0){const e=this.get_selected_attribute_parameters();this.selected=this.update_attribute("selected",this.selected,e),this.scatter_material.uniforms.has_selection.value=e.use_selection,t&&this.update_scene()}update_marker(){const t=this.model.get("marker");this.dot.type(t),"circle"===t&&(this.scatter_material.uniforms.marker_scale.value=1/Math.sqrt(Math.PI),this.scatter_material.defines.FAST_DRAW=1),"square"===t&&(this.scatter_material.uniforms.marker_scale.value=.5,this.scatter_material.defines.FAST_DRAW=2),"arrow"===t&&(this.scatter_material.uniforms.marker_scale.value=2,this.scatter_material.defines.FAST_DRAW=3),"cross"===t&&(this.scatter_material.uniforms.marker_scale.value=3/(2*Math.sqrt(5)),this.scatter_material.defines.FAST_DRAW=4),"triangle-up"===t&&(this.scatter_material.uniforms.marker_scale.value=2,this.scatter_material.defines.FAST_DRAW=5),"triangle-down"===t&&(this.scatter_material.uniforms.marker_scale.value=2,this.scatter_material.defines.FAST_DRAW=6),this.scatter_material.needsUpdate=!0,this.update_scene()}update_stroke(){const t=this.model.get("stroke");t?(this.scatter_material.uniforms.default_stroke_color.value=d(t),this.scatter_material.defines.HAS_DEFAULT_STROKE_COLOR=!0):this.scatter_material.defines.HAS_DEFAULT_STROKE_COLOR=!1,this.scatter_material.needsUpdate=!0,this.update_scene()}update_stroke_width(){this.scatter_material.uniforms.stroke_width.value=this.model.get("stroke_width"),this.update_scene()}update_color_map(){if(this.scatter_material.uniforms.colormap.value=f(this.scales.color),this.scales.color){const t=this.model.get("color");if(t){let e,n;e=null!==this.scales.color.model.min?this.scales.color.model.min:Math.min(...t),n=null!==this.scales.color.model.max?this.scales.color.model.max:Math.max(...t),this.scatter_material.uniforms.domain_color.value=[e,n]}else null!==this.scales.color.model.min&&null!==this.scales.color.model.max?this.scatter_material.uniforms.domain_color.value=[this.scales.color.model.min,this.scales.color.model.max]:console.warn("no color set, and color scale does not have a min or max")}this.update_scene()}update_position(t){this.update_scene(),this.invalidate_pixel_position()}invalidate_pixel_position(){this.invalidated_pixel_position=!0}ensure_pixel_position(){this.invalidated_pixel_position&&this.update_pixel_position()}update_pixel_position(t){const e=this.scales.x,n=this.scales.y,i=this.model.get("x"),r=this.model.get("y"),o=Math.min(i.length,r.length);this.pixel_x=new Float64Array(o),this.pixel_y=new Float64Array(o);for(let t=0;t{this.update_scene()}),n&&this.listenTo(n,"domain_changed",()=>{this.update_scene()}),i&&this.listenTo(i,"domain_changed",()=>{this.update_scene()})}set_ranges(){const t=this.scales.x,e=this.scales.y,n=this.scales.size,i=this.scales.opacity,r=this.scales.skew,o=this.scales.rotation;t&&t.set_range(this.parent.padded_range("x",t.model)),e&&e.set_range(this.parent.padded_range("y",e.model)),n&&n.set_range([0,this.model.get("default_size")]),i&&i.set_range([.2,1]),r&&r.set_range([0,1]),o&&o.set_range([0,Math.PI])}transition(t,e,n){const i=this;return new function(){this.time_start=(new Date).getTime(),this.duration=i.parent.model.get("animation_duration"),this.cancelled=!1,this.called_on_done=!1,this.set=function(t){this.objects.push(t)},this.is_done=function(){return(new Date).getTime()-this.time_start>=this.duration||this.cancelled},this.cancel=function(){this.cancelled=!0},this.update=function(){if(this.cancelled)return;const r=((new Date).getTime()-this.time_start)/this.duration,o=Math.min(1,r);t.apply(n,[o]),r>=1&&!this.called_on_done&&(this.called_on_done=!0,e.apply(n)),i.update_scene()},this.duration?i.transitions.push(this):(t.apply(n,[1]),e.apply(n),i.update_scene())}}draw_legend(t,e,n,i,r){this.legend_el=t.selectAll(".legend"+this.uuid).data([{}]);const a=this.model.get("colors"),s=a.length,c=this,l=.8*r,u=this.legend_el.enter().append("g").attr("class","legend"+this.uuid).attr("transform",function(t,e){return"translate(0, "+(e*r+n)+")"});this.draw_legend_elements(u,l),this.legend_el.append("text").attr("class","legendtext").attr("x",1.2*l).attr("y",l/2).attr("dy","0.35em").text(function(t,e){return c.model.get("labels")[e]}).style("fill",function(t,e){return a[e%s]});const h=o.max(this.model.get("labels"),function(t){return t.length});return this.legend_el.exit().remove(),[1,h]}draw_legend_elements(t,e){const n=this.model.get("colors"),i=this.model.get("stroke"),r=this.model.get("fill");t.append("path").attr("transform",function(t,n){return"translate( "+e/2+", "+e/2+")"}).attr("d",this.dot.size(64)).style("fill",r?n[0]:"none").style("stroke",i||n[0])}update_legend(){if(this.legend_el){const t=this.model.get("colors"),e=this.model.get("stroke"),n=this.model.get("fill");this.legend_el.select("path").style("fill",n?t[0]:"none").style("stroke",e||t[0]),this.legend_el.select("text").style("fill",n?t[0]:"none"),this.legend_el&&this.legend_el.select("path").attr("d",this.dot.type(this.model.get("marker")))}}relayout(){this.set_ranges(),this.update_position()}compute_view_padding(){const t=Math.sqrt(this.model.get("default_size"))/2+1;t===this.x_padding&&t===this.y_padding||(this.x_padding=t,this.y_padding=t,this.trigger("mark_padding_updated"))}draw(t){}clear_style(t,e,n){}set_default_style(t,e){}set_style_on_elements(t,e,n){}}},function(t,e,n){"use strict";n.r(e),e.default='#include \n#include \n\nuniform mat4 projectionMatrix;\nuniform mat4 modelViewMatrix;\n\n // for animation, all between 0 and 1\nuniform float animation_time_x;\nuniform float animation_time_y;\nuniform float animation_time_z;\nuniform float animation_time_size;\nuniform float animation_time_rotation;\nuniform float animation_time_opacity;\n\n#ifdef HAS_DEFAULT_STROKE_COLOR\nuniform vec4 default_stroke_color;\n#endif\n\nuniform bool has_selection;\nuniform bool has_hover;\n\n// maybe faster to use #IFDEFS\nuniform bool has_selected_fill;\nuniform vec4 selected_fill;\nuniform bool has_selected_stroke;\nuniform vec4 selected_stroke;\nuniform bool has_selected_opacity;\nuniform float selected_opacity;\n\nuniform bool has_unselected_fill;\nuniform vec4 unselected_fill;\nuniform bool has_unselected_stroke;\nuniform vec4 unselected_stroke;\nuniform bool has_unselected_opacity;\nuniform float unselected_opacity;\n\n\nuniform bool has_hovered_fill;\nuniform vec4 hovered_fill;\nuniform bool has_hovered_stroke;\nuniform vec4 hovered_stroke;\nuniform bool has_hovered_opacity;\nuniform float hovered_opacity;\n\nuniform bool has_unhovered_fill;\nuniform vec4 unhovered_fill;\nuniform bool has_unhovered_stroke;\nuniform vec4 unhovered_stroke;\nuniform bool has_unhovered_opacity;\nuniform float unhovered_opacity;\n\nuniform vec2 domain_x;\nuniform vec2 domain_y;\nuniform vec2 domain_z;\nuniform vec2 domain_size;\nuniform vec2 domain_rotation;\nuniform vec2 domain_opacity;\n\nuniform vec2 range_x;\nuniform vec2 range_y;\nuniform vec2 range_z;\nuniform vec2 range_size;\nuniform vec2 range_rotation;\nuniform vec2 range_opacity;\n\nuniform bool fill;\nuniform float stroke_width;\nuniform float marker_scale;\n\nvarying vec4 v_fill_color;\nvarying vec4 v_stroke_color;\nvarying float v_inner_size;\nvarying float v_outer_size;\nvarying vec2 v_pixel;\n\nattribute vec3 position;\nattribute vec2 uv;\n\nattribute float x;\nattribute float x_previous;\nattribute float y;\nattribute float y_previous;\n\nattribute float size;\nattribute float size_previous;\n\nattribute float rotation;\nattribute float rotation_previous;\n\nattribute float opacity;\nattribute float opacity_previous;\n\n// Boolean or int not supported for attributes, using a float instead\nattribute float selected;\n\nuniform sampler2D colormap;\nuniform vec2 domain_color;\n\n#ifdef USE_COLORMAP\nattribute float color;\n#else\nattribute vec3 color;\n#endif\n\n\n#define SCALE_X(x) scale_transform_linear(x, range_x, domain_x)\n#define SCALE_Y(x) scale_transform_linear(x, range_y, domain_y)\n#define SCALE_SIZE(x) scale_transform_linear(x, range_size, domain_size)\n#define SCALE_ROTATION(x) scale_transform_linear(x, range_rotation, domain_rotation)\n#define SCALE_OPACITY(x) scale_transform_linear(x, range_opacity, domain_opacity)\n\nvec3 rotate_xy(vec3 x, float angle) {\n float sina = sin(angle);\n float cosa = cos(angle);\n mat2 m = mat2(cosa, -sina, sina, cosa);\n return vec3(m * x.xy, x.z);\n}\n\nvoid main(void) {\n\n vec3 animation_time = vec3(animation_time_x, animation_time_y, animation_time_z);\n\n\n vec3 domain_offset = vec3(domain_x.x, domain_y.x, domain_z.x);\n vec3 domain_scale = vec3(domain_x.y, domain_y.y, domain_z.y) - domain_offset;\n vec3 range_offset = vec3(range_x.x, range_y.x, range_z.x);\n vec3 range_scale = vec3(range_x.y, range_y.y, range_z.y) - range_offset;\n\n vec3 center = mix(vec3(x_previous, y_previous, 0), vec3(x, y, 0), animation_time);\n\n // vec3 center_normalized = (center - domain_offset) / domain_scale;\n // vec3 center_pixels = ((center_normalized*2.)-0.) * range_scale + range_offset;\n // times 2 because the normalized coordinates go from [-1, 1]\n vec3 center_pixels = vec3(SCALE_X(center.x), SCALE_Y(center.y), 0) * 2.;\n\n\n // times 4 because of the normalized coordinates, and radius vs diameter use\n float marker_size = sqrt(mix(SCALE_SIZE(size_previous), SCALE_SIZE(size), animation_time_size)) * marker_scale * 4.;\n // we draw larger than the size for the stroke_width (on both side)\n\n // `v_inner_size` is the marker "radius" without the stroke, `v_outer_size` is the marker "radius" with the stroke\n v_inner_size = marker_size * 0.5 - stroke_width;\n v_outer_size = marker_size * 0.5 + stroke_width;\n\n // `full_size` is the marker "diameter" with the stroke\n float full_size = marker_size + 2.0 * stroke_width;\n\n // `v_pixel` is the pixel position relatively to the marker,\n // e.g. vec2(0.) would be the center of the square marker\n // e.g. vec2(0.5 * full_size) would be the top-right pixel of the square marker\n v_pixel = (uv - 0.5) * (full_size);\n\n float angle = SCALE_ROTATION(mix(rotation_previous, rotation, animation_time_rotation));\n vec3 model_pos = rotate_xy(position, 1.) * full_size + center_pixels;\n\n#ifdef USE_COLORMAP\n float color_index = (color - domain_color.x) / (domain_color.y - domain_color.x);\n vec4 color_rgba = texture2D(colormap, vec2(color_index, 0));\n#else\n vec4 color_rgba = vec4(color, 1.0);\n#endif\n\n v_fill_color = color_rgba;\n v_stroke_color = color_rgba;\n\n#ifdef HAS_DEFAULT_STROKE_COLOR\n v_stroke_color = default_stroke_color;\n#endif\n\n float opacity_value = SCALE_OPACITY(mix(opacity_previous, opacity, animation_time_opacity));\n v_fill_color.a *= opacity_value;\n v_stroke_color.a *= opacity_value;\n\n if(has_selection) {\n if(has_selected_fill && selected > 0.5 )\n v_fill_color = selected_fill;\n if(has_unselected_fill && selected < 0.5 )\n v_fill_color = unselected_fill;\n if(has_selected_stroke && selected > 0.5 )\n v_stroke_color = selected_stroke;\n if(has_unselected_stroke && selected < 0.5 )\n v_stroke_color = unselected_stroke;\n if(has_selected_opacity && selected > 0.5 ) {\n v_stroke_color.a *= selected_opacity;\n v_fill_color.a *= selected_opacity;\n }\n if(has_unselected_opacity && selected < 0.5 ) {\n v_stroke_color.a *= unselected_opacity;\n v_fill_color.a *= unselected_opacity;\n }\n }\n\n v_fill_color.rgb *= v_fill_color.a;\n v_stroke_color.rgb *= v_stroke_color.a;\n\n // color_rgba = has_selection && has_selected_color ? (selected > 0.5 ? selected_color : unselected_color) : color_rgba;\n gl_Position = projectionMatrix * vec4(rotate_xy(position, angle) * full_size, 1.0) +\n projectionMatrix * modelViewMatrix * vec4(center_pixels + vec3(0., 0., 0.), 1.0);\n}\n'},function(t,e,n){"use strict";n.r(e),e.default="#include \n#include \n\nprecision highp float;\nprecision highp int;\n\n#define FAST_CIRCLE 1\n#define FAST_SQUARE 2\n#define FAST_ARROW 3\n#define FAST_CROSS 4\n#define FAST_TRIANGLE_UP 5\n#define FAST_TRIANGLE_DOWN 6\n\n// This parameter is used for reducing aliasing\n#define SMOOTH_PIXELS 1.0\n\n// ANGLE_X = X * PI / 180.\n#define ANGLE_20 0.3490658503988659\n#define ANGLE_60 1.0471975511965976\n\nvarying vec4 v_fill_color;\nvarying vec4 v_stroke_color;\nvarying float v_inner_size;\nvarying float v_outer_size;\nvarying vec2 v_pixel;\n\nuniform float stroke_width;\n\n\n/*\n * Rotate a point in the 2-D plane, given an angle in radians\n */\nvec2 rotate_xy(vec2 x, float angle) {\n float sina = sin(angle);\n float cosa = cos(angle);\n mat2 m = mat2(cosa, -sina, sina, cosa);\n return m * x.xy;\n}\n\n/*\n * Returns 1.0 if pixel inside of a circle (0.0 otherwise) given the circle radius and the\n * pixel position.\n */\nfloat smooth_circle(in float radius, in vec2 pixel_position) {\n // This function does not use the ellipse function for optimization purpose\n // Circle equation: x^2 + y^2 = radius^2\n float d = dot(pixel_position, pixel_position);\n float r1 = pow(radius - SMOOTH_PIXELS, 2.0);\n float r2 = pow(radius + SMOOTH_PIXELS, 2.0);\n return 1.0 - smoothstep(r1, r2, d);\n}\n\n/*\n * Returns 1.0 if pixel inside of an ellipse (0.0 otherwise) given the ellipse radius and the\n * pixel position.\n */\nfloat smooth_ellipse(in float a, in float b, in vec2 pixel_position) {\n // Ellipse equation: b^2 * x^2 + a^2 * y^2 = a^2 * b^2\n float r_x = pow(a, 2.0);\n float r_y = pow(b, 2.0);\n float d = r_y * pow(pixel_position.x, 2.0) + r_x * pow(pixel_position.y, 2.0);\n float r1 = pow(a - SMOOTH_PIXELS, 2.0) * pow(b - SMOOTH_PIXELS, 2.0);\n float r2 = pow(a + SMOOTH_PIXELS, 2.0) * pow(b + SMOOTH_PIXELS, 2.0);\n return 1.0 - smoothstep(r1, r2, d);\n}\n\n/*\n * Returns 1.0 if pixel inside of a rectangle (0.0 otherwise) given the rectangle half-size\n * on the x and y axes and the pixel position.\n */\nfloat smooth_rectangle(in vec2 size, in vec2 pixel_position) {\n vec2 rec = smoothstep(vec2(-SMOOTH_PIXELS), vec2(SMOOTH_PIXELS), size - abs(pixel_position));\n return rec.x * rec.y;\n}\n\n/*\n * Returns 1.0 if pixel inside of a rectangle (0.0 otherwise) given the rectangle half-size\n * on the x and y axes and the pixel position.\n */\nfloat rectangle(in vec2 size, in vec2 pixel_position) {\n vec2 rec = step(0.0, size - abs(pixel_position));\n return rec.x * rec.y;\n}\n\n/*\n * Returns 1.0 if pixel inside of a square (0.0 otherwise) given the square half-size\n * and the pixel position.\n */\nfloat smooth_square(in float size, in vec2 pixel_position) {\n return smooth_rectangle(vec2(size), pixel_position);\n}\n\nfloat smooth_isosceles_triangle(in float angle, in float height, in vec2 pixel_position) {\n float half_angle = angle / 2.0;\n\n // The triangle center is on vec2(0.0, -height/3.0)\n vec2 translated_pixel = vec2(pixel_position.x, pixel_position.y - height / 3.0);\n\n vec2 pixel_left = rotate_xy(translated_pixel, -half_angle);\n vec2 pixel_right = rotate_xy(translated_pixel, half_angle);\n\n float half_height = height * 0.5;\n\n float half_bottom = half_height * tan(half_angle);\n\n return smoothstep(-SMOOTH_PIXELS, SMOOTH_PIXELS, half_bottom + pixel_left.x) *\n smoothstep(-SMOOTH_PIXELS, SMOOTH_PIXELS, half_bottom - pixel_right.x) *\n smoothstep(-SMOOTH_PIXELS, SMOOTH_PIXELS, translated_pixel.y + half_height);\n}\n\n\n/*\n * Returns 1.0 if pixel inside of a cross shape (0.0 otherwise) given the cross half-size\n * on the x and y axes and the pixel position.\n */\nfloat cross(in vec2 size, in vec2 pixel_position) {\n float cross_shape = rectangle(size.xy, pixel_position) +\n rectangle(size.yx, pixel_position);\n return clamp(cross_shape, 0.0, 1.0);\n}\n\n\nvoid main(void) {\n // fill_weight and stroke_weight are color factors\n // e.g. if fill_weight == 1.0 then the pixel color will be v_fill_color\n // e.g. if stroke_weight == 1.0 then the pixel color will be v_stroke_color\n float fill_weight = 0.0;\n float stroke_weight = 0.0;\n\n // Note for the reader: In the following code,\n // - `1.0` -> True\n // - `0.0` -> False\n // - `1.0 - A` -> NOT A\n // - `A + B` -> A OR B\n // - `A * B` -> A AND B\n\n float inner_shape = 0.0;\n float outer_shape = 0.0;\n\n#if FAST_DRAW == FAST_CIRCLE\n\n inner_shape = smooth_circle(v_inner_size, v_pixel);\n outer_shape = smooth_circle(v_outer_size, v_pixel);\n\n#elif FAST_DRAW == FAST_SQUARE\n\n inner_shape = smooth_square(v_inner_size, v_pixel);\n outer_shape = 1.0; // Always in the outer_shape\n\n#elif FAST_DRAW == FAST_CROSS\n\n float r = v_outer_size / 3.0;\n\n inner_shape = cross(vec2(v_inner_size, r - 2.0 * stroke_width), v_pixel);\n outer_shape = cross(vec2(r, v_outer_size), v_pixel);\n\n#elif FAST_DRAW == FAST_ARROW\n\n inner_shape = smooth_isosceles_triangle(ANGLE_20, v_inner_size, v_pixel);\n outer_shape = smooth_isosceles_triangle(ANGLE_20, v_outer_size, v_pixel);\n\n#elif FAST_DRAW == FAST_TRIANGLE_UP\n\n inner_shape = smooth_isosceles_triangle(ANGLE_60, v_inner_size, v_pixel);\n outer_shape = smooth_isosceles_triangle(ANGLE_60, v_outer_size, v_pixel);\n\n#elif FAST_DRAW == FAST_TRIANGLE_DOWN\n\n vec2 reversed_pixel = vec2(v_pixel.x, -v_pixel.y);\n\n inner_shape = smooth_isosceles_triangle(ANGLE_60, v_inner_size, reversed_pixel);\n outer_shape = smooth_isosceles_triangle(ANGLE_60, v_outer_size, reversed_pixel);\n\n#endif\n\n // `inner_shape` is the shape without the stroke, `outer_shape` is the shape with the stroke\n // note that the stroke is always drawn, only that it has the `v_fill_color` if stroke is None\n fill_weight = inner_shape;\n stroke_weight = (1.0 - inner_shape) * outer_shape;\n\n#if !FILL\n fill_weight = 0.0;\n#endif\n\n gl_FragColor = v_fill_color * fill_weight + v_stroke_color * stroke_weight;\n}\n"},function(t,e,n){"use strict";var i=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e};Object.defineProperty(e,"__esModule",{value:!0});const r=n(18),o=i(n(12));class a extends r.MarkModel{defaults(){return Object.assign({},r.MarkModel.prototype.defaults(),{_model_name:"ScatterGLModel",_view_name:"ScatterGL",x:[],y:[],color:null,skew:null,marker:"circle",stroke:null,stroke_width:1.5,default_skew:.5,default_size:64,names:[],display_names:!0,fill:!0,drag_color:null,drag_size:5,names_unique:!0})}initialize(t,e){super.initialize(t,e),this.update_domains()}update_domains(){var t=this.get("scales");for(var e in t)if(t.hasOwnProperty(e)&&"color"!=e){var n=t[e];this.get("preserve_domain")[e]?n.del_domain([],this.model_id+e):n.compute_and_set_domain(this.get(e),this.model_id+e)}}}a.serializers=Object.assign({},r.MarkModel.serializers,{x:o.array_or_json,y:o.array_or_json,color:o.array_or_json,size:o.array_or_json,rotation:o.array_or_json,opacity:o.array_or_json,default_opacities:o.array_or_json}),e.ScatterGLModel=a}])}); //# sourceMappingURL=index.js.map